Example usage for org.bouncycastle.asn1.esf OcspListID getOcspResponses

List of usage examples for org.bouncycastle.asn1.esf OcspListID getOcspResponses

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.esf OcspListID getOcspResponses.

Prototype

public OcspResponsesID[] getOcspResponses() 

Source Link

Usage

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;
    }//from  w w  w.j av  a2s .  co 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<OCSPRef> getOCSPRefs() {

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

    final AttributeTable unsignedAttributes = signerInformation.getUnsignedAttributes();
    if (unsignedAttributes == null) {
        return list;
    }//from ww  w .  j  av a  2  s  . com

    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;
}