Example usage for org.bouncycastle.asn1.esf CrlOcspRef getInstance

List of usage examples for org.bouncycastle.asn1.esf CrlOcspRef getInstance

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.esf CrlOcspRef getInstance.

Prototype

public static CrlOcspRef getInstance(Object obj) 

Source Link

Usage

From source file:eu.europa.ec.markt.dss.validation.cades.CAdESSignature.java

License:Open Source License

@Override
public List<CRLRef> getCRLRefs() {
    List<CRLRef> list = new ArrayList<CRLRef>();

    if (signerInformation.getUnsignedAttributes() != null) {
        Attribute completeRevocationRefsAttr = signerInformation.getUnsignedAttributes()
                .get(PKCSObjectIdentifiers.id_aa_ets_revocationRefs);
        if (completeRevocationRefsAttr != null && completeRevocationRefsAttr.getAttrValues().size() > 0) {
            DERSequence completeCertificateRefs = (DERSequence) completeRevocationRefsAttr.getAttrValues()
                    .getObjectAt(0);/*from  ww  w .  j  a  v  a 2  s .  com*/
            for (int i1 = 0; i1 < completeCertificateRefs.size(); i1++) {
                CrlOcspRef otherCertId = CrlOcspRef.getInstance(completeCertificateRefs.getObjectAt(i1));
                for (CrlValidatedID id : otherCertId.getCrlids().getCrls()) {
                    list.add(new CRLRef(id));
                }
            }
        }
    }

    return list;
}

From source file:eu.europa.ec.markt.dss.validation.cades.CAdESSignature.java

License:Open Source License

@Override
public List<OCSPRef> getOCSPRefs() {
    List<OCSPRef> list = new ArrayList<OCSPRef>();

    if (signerInformation.getUnsignedAttributes() != null) {
        Attribute completeRevocationRefsAttr = signerInformation.getUnsignedAttributes()
                .get(PKCSObjectIdentifiers.id_aa_ets_revocationRefs);
        if (completeRevocationRefsAttr != null && completeRevocationRefsAttr.getAttrValues().size() > 0) {
            DERSequence completeRevocationRefs = (DERSequence) completeRevocationRefsAttr.getAttrValues()
                    .getObjectAt(0);/*from ww  w.  ja v a  2s.  c  om*/
            for (int i1 = 0; i1 < completeRevocationRefs.size(); i1++) {
                CrlOcspRef otherCertId = CrlOcspRef.getInstance(completeRevocationRefs.getObjectAt(i1));

                for (OcspResponsesID id : otherCertId.getOcspids().getOcspResponses()) {
                    list.add(new OCSPRef(id, true));
                }
            }
        }
    }

    return list;
}

From source file:eu.europa.ec.markt.dss.validation102853.cades.CAdESSignature.java

License:Open Source License

@Override
public List<CRLRef> getCRLRefs() {

    final List<CRLRef> list = new ArrayList<CRLRef>();

    try {/*from w w w  .  j av  a 2  s. c  om*/
        final AttributeTable attributes = signerInformation.getUnsignedAttributes();
        if (attributes == null) {
            return list;
        }

        final Attribute attribute = attributes.get(PKCSObjectIdentifiers.id_aa_ets_revocationRefs);

        if (attribute == null) {
            return list;
        }

        final ASN1Set attrValues = attribute.getAttrValues();
        if (attrValues.size() <= 0) {
            return list;
        }

        final ASN1Encodable attrValue = attrValues.getObjectAt(0);
        final ASN1Sequence completeCertificateRefs = (ASN1Sequence) attrValue;
        for (int ii = 0; ii < completeCertificateRefs.size(); ii++) {

            final ASN1Encodable completeCertificateRef = completeCertificateRefs.getObjectAt(ii);
            final CrlOcspRef otherCertId = CrlOcspRef.getInstance(completeCertificateRef);
            final CrlListID otherCertIds = otherCertId.getCrlids();
            if (otherCertIds != null) {

                for (final CrlValidatedID id : otherCertIds.getCrls()) {

                    final CRLRef crlRef = new CRLRef(id);
                    list.add(crlRef);
                }
            }
        }
    } catch (Exception e) {
        // When error in computing or in format, the algorithm just continues.
        LOG.warn("When error in computing or in format the algorithm just continue...", e);
    }

    return list;
}

From source file:eu.europa.ec.markt.dss.validation102853.cades.CAdESSignature.java

License:Open Source License

@Override
public List<OCSPRef> getOCSPRefs() {

    final List<OCSPRef> list = new ArrayList<OCSPRef>();

    final AttributeTable attributes = signerInformation.getUnsignedAttributes();
    if (attributes == null) {
        return list;
    }/*w  w  w  .  j  a v  a2  s.  c  o m*/

    final Attribute attribute = attributes.get(PKCSObjectIdentifiers.id_aa_ets_revocationRefs);
    if (attribute == null) {
        return list;
    }
    final ASN1Set attrValues = attribute.getAttrValues();
    if (attrValues.size() <= 0) {
        return list;
    }

    final ASN1Encodable attrValue = attrValues.getObjectAt(0);
    final ASN1Sequence completeRevocationRefs = (ASN1Sequence) attrValue;
    for (int i = 0; i < completeRevocationRefs.size(); i++) {
        final CrlOcspRef otherCertId = CrlOcspRef.getInstance(completeRevocationRefs.getObjectAt(i));
        final OcspListID ocspids = otherCertId.getOcspids();
        if (ocspids != null) {
            for (final OcspResponsesID id : ocspids.getOcspResponses()) {
                list.add(new OCSPRef(id, true));
            }
        }
    }
    return list;
}

From source file:eu.europa.esig.dss.cades.validation.CAdESSignature.java

License:Open Source License

@Override
public List<CRLRef> getCRLRefs() {

    final List<CRLRef> list = new ArrayList<CRLRef>();

    try {/*from ww w  .j a  va  2  s .c o  m*/
        final AttributeTable attributes = signerInformation.getUnsignedAttributes();
        if (attributes == null) {
            return list;
        }

        final Attribute attribute = attributes.get(PKCSObjectIdentifiers.id_aa_ets_revocationRefs);

        if (attribute == null) {
            return list;
        }

        final ASN1Set attrValues = attribute.getAttrValues();
        if (attrValues.size() <= 0) {
            return list;
        }

        final ASN1Encodable attrValue = attrValues.getObjectAt(0);
        final ASN1Sequence completeCertificateRefs = (ASN1Sequence) attrValue;
        for (int ii = 0; ii < completeCertificateRefs.size(); ii++) {

            final ASN1Encodable completeCertificateRef = completeCertificateRefs.getObjectAt(ii);
            final CrlOcspRef otherCertId = CrlOcspRef.getInstance(completeCertificateRef);
            final CrlListID otherCertIds = otherCertId.getCrlids();
            if (otherCertIds != null) {

                for (final CrlValidatedID id : otherCertIds.getCrls()) {

                    final CRLRef crlRef = new CRLRef(id);
                    list.add(crlRef);
                }
            }
        }
    } catch (Exception e) {
        // When error in computing or in format, the algorithm just
        // continues.
        LOG.warn("When error in computing or in format the algorithm just continue...", e);
    }
    return list;
}

From source file:eu.europa.esig.dss.cades.validation.CAdESSignature.java

License:Open Source License

@Override
public List<OCSPRef> getOCSPRefs() {

    final List<OCSPRef> list = new ArrayList<OCSPRef>();

    final AttributeTable unsignedAttributes = signerInformation.getUnsignedAttributes();
    if (unsignedAttributes == null) {
        return list;
    }/*www  . ja v  a2 s.  co m*/

    final Attribute attribute = unsignedAttributes.get(PKCSObjectIdentifiers.id_aa_ets_revocationRefs);
    if (attribute == null) {
        return list;
    }
    final ASN1Set attrValues = attribute.getAttrValues();
    if (attrValues.size() <= 0) {
        return list;
    }

    final ASN1Encodable attrValue = attrValues.getObjectAt(0);
    final ASN1Sequence completeRevocationRefs = (ASN1Sequence) attrValue;
    for (int i = 0; i < completeRevocationRefs.size(); i++) {

        final CrlOcspRef otherCertId = CrlOcspRef.getInstance(completeRevocationRefs.getObjectAt(i));
        final OcspListID ocspListID = otherCertId.getOcspids();
        if (ocspListID != null) {
            for (final OcspResponsesID ocspResponsesID : ocspListID.getOcspResponses()) {

                final OtherHash otherHash = ocspResponsesID.getOcspRepHash();
                final OCSPRef ocspRef = new OCSPRef(otherHash, true);
                list.add(ocspRef);
            }
        }
    }
    return list;
}