locked
Creating pkcs7 signature with SHA256 RRS feed

  • Question

  • I am trying to compute a signature this way:

    System.Security.Cryptography.Pkcs.ContentInfo contentInfo = new System.Security.Cryptography.Pkcs.ContentInfo(inputBytes);
    SignedCms signedCms = new SignedCms(contentInfo);
    CmsSigner cmsSigner = new CmsSigner(cert);
    cmsSigner.DigestAlgorithm = new Oid("1.3.14.3.2.26");
    signedCms.ComputeSignature(cmsSigner, false);
    byte[] enc = signedCms.Encode();
    

    This works fine, because the Oid is for SHA1, but if I replace it with OID for SHA256:

    2.16.840.1.101.3.4.2.1

    it will wail with "Invalid algorithm specified".

    Any ideas? 

    I am using windows xp sp3 .NET 3.5 sp1

     

    • Moved by SamAgain Wednesday, September 29, 2010 3:20 AM not CLR specific (From:Common Language Runtime)
    Monday, September 27, 2010 2:15 PM

Answers