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));
}
Aggregations