Java 类org.bouncycastle.asn1.esf.CrlOcspRef 实例源码

项目:dss    文件:CAdESSignature.java   
@Override
public List<CRLRef> getCRLRefs() {

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

    try {
        final Attribute attribute = getUnsignedAttribute(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;
}
项目:dss    文件:CAdESSignature.java   
@Override
public List<OCSPRef> getOCSPRefs() {

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

    final Attribute attribute = getUnsignedAttribute(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;
}