Example usage for org.bouncycastle.asn1.cms Attribute toASN1Object

List of usage examples for org.bouncycastle.asn1.cms Attribute toASN1Object

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.cms Attribute toASN1Object.

Prototype

public ASN1Primitive toASN1Object() 

Source Link

Usage

From source file:passwdmanager.hig.no.lds.DG_SOD.java

private static ASN1Set createAuthenticatedAttributes(String digestAlgorithm, byte[] contentBytes)
        throws NoSuchAlgorithmException {
    MessageDigest dig = MessageDigest.getInstance(digestAlgorithm);
    byte[] digestedContentBytes = dig.digest(contentBytes);
    ASN1OctetString digestedContent = new DEROctetString(digestedContentBytes);
    Attribute contentTypeAttribute = new Attribute(RFC_3369_CONTENT_TYPE_OID, createSingletonSet(ICAO_SOD_OID));
    Attribute messageDigestAttribute = new Attribute(RFC_3369_MESSAGE_DIGEST_OID,
            createSingletonSet(digestedContent));
    ASN1Encodable[] result = { contentTypeAttribute.toASN1Object(), messageDigestAttribute.toASN1Object() };
    return new DERSet(result);
}