how to set signer attribute signer-attributes-v2 in PADES digital signature in java with IAIK or Bouncy castle?

Hi i want to add signer attribute signer-attributes-v2 in Pades digital Signture through IAIK or Bouncy castle using this strucute

signer-attributes-v2
id-aa-ets-signerAttrV2 OBJECT IDENTIFIER ::= { itu-t(0) identified-organization(4)
etsi(0) cades(19122) attributes(1) 1 }
SignerAttributeV2 ::= SEQUENCE {
claimedAttributes [0] ClaimedAttributes OPTIONAL,
certifiedAttributesV2 [1] CertifiedAttributesV2 OPTIONAL,
signedAssertions [2] SignedAssertions OPTIONAL
} 

this is what i have added

org.bouncycastle.asn1.ASN1EncodableVector v_attributeValue = new org.bouncycastle.asn1.ASN1EncodableVector(); // vector of attribute values
        org.bouncycastle.asn1.DERGeneralString obj_signerRole = new org.bouncycastle.asn1.DERGeneralString(a_strSignerRole);
        v_attributeValue.add(obj_signerRole);

        org.bouncycastle.asn1.DERSet obj_setAttributeValues = new org.bouncycastle.asn1.DERSet(v_attributeValue);
        org.bouncycastle.asn1.DERObjectIdentifier obj_attributeType = new org.bouncycastle.asn1.DERObjectIdentifier("1.2.3");

        org.bouncycastle.asn1.ASN1EncodableVector v_attribute = new org.bouncycastle.asn1.ASN1EncodableVector(); // claimed attributes
        v_attribute.add(obj_attributeType);
        v_attribute.add(obj_setAttributeValues);

        org.bouncycastle.asn1.DERSequence obj_attributeSeq = new org.bouncycastle.asn1.DERSequence(v_attribute);

        org.bouncycastle.asn1.ASN1EncodableVector v_claimedAttributes = new org.bouncycastle.asn1.ASN1EncodableVector(); // claimed attributes
        v_claimedAttributes.add(obj_attributeSeq);

i am not able to add these

certifiedAttributesV2 [1] CertifiedAttributesV2 OPTIONAL,
signedAssertions [2] SignedAssertions OPTIONAL

can anybody help me by giving some hint ?
i will be great-full Thanks.

Leave a Reply

avatar
  Subscribe  
Notify of