Example usage for org.bouncycastle.asn1.ess OtherCertID OtherCertID

List of usage examples for org.bouncycastle.asn1.ess OtherCertID OtherCertID

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.ess OtherCertID OtherCertID.

Prototype

private OtherCertID(ASN1Sequence seq) 

Source Link

Document

constructor

Usage

From source file:eu.europa.ec.markt.dss.signature.cades.CAdESProfileC.java

License:Open Source License

/**
 * Create a reference to a X509Certificate
 * /*from  w  ww . j a  v  a  2 s  .co  m*/
 * @param cert
 * @return
 * @throws NoSuchAlgorithmException
 * @throws CertificateEncodingException
 */
private OtherCertID makeOtherCertID(X509Certificate cert)
        throws NoSuchAlgorithmException, CertificateEncodingException {
    MessageDigest sha1digest = MessageDigest.getInstance(X509ObjectIdentifiers.id_SHA1.getId(),
            new BouncyCastleProvider());
    byte[] d = sha1digest.digest(cert.getEncoded());
    LOG.info(new DEROctetString(d).getDERObject().toString());
    OtherHash hash = new OtherHash(sha1digest.digest(cert.getEncoded()));
    OtherCertID othercertid = new OtherCertID(new DERSequence(hash.getDERObject()));
    return othercertid;
}