Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

    ContentInfo content = new ContentInfo(new Oid("1.2.840.113549.1.7.5"), Encoding.UTF8.GetBytes(str.ToString()));
    
    SignedCms signedCms = new SignedCms(content, true);
    CmsSigner cmsSigner = new CmsSigner(cert);

    cmsSigner.IncludeOption = X509IncludeOption.EndCertOnly;
    cmsSigner.DigestAlgorithm = new Oid("2.16.840.1.101.3.4.2.1");
    cmsSigner.SignerIdentifierType = SubjectIdentifierType.IssuerAndSerialNumber;


    Pkcs9AttributeObject att = new Pkcs9AttributeObject();
    AsnEncodedData data = new AsnEncodedData(new SHA1Managed().ComputeHash(cert.RawData));

    cmsSigner.SignedAttributes.Add(new Pkcs9SigningTime(DateTime.UtcNow));
    //cmsSigner.SignedAttributes.Add(new Pkcs9ContentType());
    //cmsSigner.SignedAttributes.Add(new Pkcs9MessageDigest());
   
    signedCms.ComputeSignature(cmsSigner);
    return Convert.ToBase64String(signedCms.Encode());

I have used this code to sign a document and this code is working fine but my problem is that there is another requirement needed to add "SigningCertificateV2" attribute as a signed attribute...

I have already added ContentType, MessageDigest and SigningTime. But i dont know how to add "SigningCertificateV2" attribute.. (1.2.840.113549.1.9.16.2.47)

Can You please help me with this?

question from:https://stackoverflow.com/questions/65914439/adding-signingcertificatev2-attribute-to-signedcms

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...