Example usage for org.bouncycastle.asn1.esf CrlListID getCrls

List of usage examples for org.bouncycastle.asn1.esf CrlListID getCrls

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.esf CrlListID getCrls.

Prototype

public CrlValidatedID[] getCrls() 

Source Link

Usage

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 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<CRLRef> getCRLRefs() {

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

    try {/*from   w w w .  ja v a2s.  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;
}