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

项目:signer    文件:RevocationRefs.java   
/**
 * make OcspResponsesID from BasicOCSPResp
 * 
 * @param ocspResp
 * @return OcspResponsesID
 * @throws NoSuchAlgorithmException
 * @throws OCSPException
 * @throws IOException
 */
private OcspResponsesID makeOcspResponsesID(BasicOCSPResp ocspResp)
        throws NoSuchAlgorithmException, OCSPException, IOException {

    Digest digest = DigestFactory.getInstance().factoryDefault();
    digest.setAlgorithm(DigestAlgorithmEnum.SHA_256);

    byte[] digestValue = digest.digest(ocspResp.getEncoded());
    OtherHash hash = new OtherHash(digestValue);

    OcspResponsesID ocsprespid = new OcspResponsesID(new OcspIdentifier(
            ocspResp.getResponderId().toASN1Object(),
            new DERGeneralizedTime(ocspResp.getProducedAt())), hash);

    return ocsprespid;
}
项目:dss    文件:CRLRef.java   
/**
 * The default constructor for CRLRef.
 *
 * @param cmsRef
 * @throws ParseException
 */
public CRLRef(CrlValidatedID cmsRef) {
    try {

        final CrlIdentifier crlIdentifier = cmsRef.getCrlIdentifier();
        if (crlIdentifier != null) {
            crlIssuer = crlIdentifier.getCrlIssuer();
            crlIssuedTime = crlIdentifier.getCrlIssuedTime().getDate();
            crlNumber = crlIdentifier.getCrlNumber();
        }
        final OtherHash crlHash = cmsRef.getCrlHash();

        digestAlgorithm = DigestAlgorithm.forOID(crlHash.getHashAlgorithm().getAlgorithm().getId());
        digestValue = crlHash.getHashValue();
    } catch (ParseException ex) {
        throw new DSSException(ex);
    }
}
项目: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;
}
项目:dss    文件:OCSPRef.java   
/**
 * The default constructor for OCSPRef.
 */
public OCSPRef(final OtherHash otherHash, final boolean matchOnlyBasicOCSPResponse) {

    if (otherHash != null) { // -444

        this.digestAlgorithm = DigestAlgorithm.forOID(otherHash.getHashAlgorithm().getAlgorithm().getId());
        this.digestValue = otherHash.getHashValue();
    }
    this.matchOnlyBasicOCSPResponse = matchOnlyBasicOCSPResponse;
}