locked
"The handle is invalid" at System.Security.Cryptography.Pkcs RRS feed

  • Question

  • Hello, mi name is Gonzalo and i have a problem when i try to sign a document (through a certificate) using System.Security.Cryptography.Pkcs

    Here there is some more details abot the error:

    ERROR: The handle is invalid.

    Stack trace:    at System.Security.Cryptography.Pkcs.PkcsUtils.CreateSignerEncodeInfo(CmsSigner signer, Boolean silent)
       at System.Security.Cryptography.Pkcs.SignedCms.Sign(CmsSigner signer, Boolean silent)
       at System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature(CmsSigner signer, Boolean silent)
       at PdfSigner.Signer.SignMsg(Byte[] Message, X509Certificate2 SignerCertificate, Boolean Detached)
       at PdfSigner.Signer.SignPdf(Byte[] PdfContent, X509Certificate2 Certificate, String Reason, String Location, Boolean AddVisibleSign)
       at NsiisNet.FuncionesUtiles.FirmarPDF(Byte[] Pdf, String path, Boolean mostrarArchivo) in C:\Backup\NsiisNet\NsiisNet\Clases\FuncionesUtiles.vb:line 369

    And the properties of the signer object:

    Certificate: SERIALNUMBER=CUIL 30618490285, C=AR, CN=JURIDICA PERSONA

      Store: My

      HasPrivateKey: True

     DigestAlgorithm: 
      FriendlyName: sha1
      Value: 1.3.14.3.2.26
    IncludeOption: EndCertOnly
    SignedAttributes: 
    SignerIdentifierType: IssuerAndSerialNumber
    UnsignedAttributes: 

    Do you know the origin of the error? Can you help me?

    Thank you

    Friday, August 25, 2017 2:12 PM