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

项目: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;
}