Search in sources :

Example 1 with SigPolicyQualifierInfo

use of org.bouncycastle.asn1.esf.SigPolicyQualifierInfo in project signer by demoiselle.

the class IdSigningPolicy method getValue.

/**
 * org.bouncycastle.asn1.ASN1ObjectIdentifier sigPolicyId
 * org.bouncycastle.asn1.esf.OtherHashAlgAndValue sigPolicyHash
 * List<org.bouncycastle.asn1.esf.SigPolicyQualifierInfo> sigPolicyQualifierInfos
 */
@Override
public Attribute getValue() {
    // Atributo 1
    ASN1ObjectIdentifier sigPolicyId = new ASN1ObjectIdentifier(signaturePolicy.getSignPolicyInfo().getSignPolicyIdentifier().getValue());
    // Atributo 2
    OtherHashAlgAndValue sigPolicyHash = new OtherHashAlgAndValue(new AlgorithmIdentifier(new ASN1ObjectIdentifier(signaturePolicy.getSignPolicyHashAlg().getAlgorithm().getValue())), signaturePolicy.getSignPolicyHash().getDerOctetString());
    // Atributo 3
    List<SigPolicyQualifierInfo> sigPolicyQualifierInfos = new ArrayList<SigPolicyQualifierInfo>();
    ASN1ObjectIdentifier sigPolicyQualifierId = new ASN1ObjectIdentifier("1.2.840.113549.1.9.16.5.1");
    DERIA5String sigQualifier = new DERIA5String(signaturePolicy.getSignPolicyURI());
    SigPolicyQualifierInfo bcSigPolicyQualifierInfo = new SigPolicyQualifierInfo(sigPolicyQualifierId, sigQualifier);
    sigPolicyQualifierInfos.add(bcSigPolicyQualifierInfo);
    SigPolicyQualifiers sigPolicyQualifiers = new SigPolicyQualifiers(sigPolicyQualifierInfos.toArray(new SigPolicyQualifierInfo[] {}));
    SignaturePolicyId signaturePolicyId = new SignaturePolicyId(sigPolicyId, sigPolicyHash, sigPolicyQualifiers);
    return new Attribute(new ASN1ObjectIdentifier(oid), new DERSet(signaturePolicyId));
}
Also used : SigPolicyQualifierInfo(org.bouncycastle.asn1.esf.SigPolicyQualifierInfo) DERIA5String(org.bouncycastle.asn1.DERIA5String) SignedAttribute(org.demoiselle.signer.policy.impl.cades.pkcs7.attribute.SignedAttribute) Attribute(org.bouncycastle.asn1.cms.Attribute) ArrayList(java.util.ArrayList) SignaturePolicyId(org.bouncycastle.asn1.esf.SignaturePolicyId) SigPolicyQualifiers(org.bouncycastle.asn1.esf.SigPolicyQualifiers) DERSet(org.bouncycastle.asn1.DERSet) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) OtherHashAlgAndValue(org.bouncycastle.asn1.esf.OtherHashAlgAndValue) AlgorithmIdentifier(org.bouncycastle.asn1.x509.AlgorithmIdentifier)

Aggregations

ArrayList (java.util.ArrayList)1 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)1 DERIA5String (org.bouncycastle.asn1.DERIA5String)1 DERSet (org.bouncycastle.asn1.DERSet)1 Attribute (org.bouncycastle.asn1.cms.Attribute)1 OtherHashAlgAndValue (org.bouncycastle.asn1.esf.OtherHashAlgAndValue)1 SigPolicyQualifierInfo (org.bouncycastle.asn1.esf.SigPolicyQualifierInfo)1 SigPolicyQualifiers (org.bouncycastle.asn1.esf.SigPolicyQualifiers)1 SignaturePolicyId (org.bouncycastle.asn1.esf.SignaturePolicyId)1 AlgorithmIdentifier (org.bouncycastle.asn1.x509.AlgorithmIdentifier)1 SignedAttribute (org.demoiselle.signer.policy.impl.cades.pkcs7.attribute.SignedAttribute)1