This project is read-only.

Exception when signing XADES

Feb 16, 2011 at 8:37 AM

I'm trying to sign an xml with your p12 certificate (or any other pfx in the system) and I get an Exception "

System.Security.Cryptography.CryptographicException: La contraseña de red especificada no es válida.

Is anything missing?

 Thank you in advance

Best regards

 Manuel

 

Feb 17, 2011 at 10:11 AM
mpino wrote:

I'm trying to sign an xml with your p12 certificate (or any other pfx in the system) and I get an Exception "

 

System.Security.Cryptography.CryptographicException: La contraseña de red especificada no es válida.

Is anything missing?

 Thank you in advance

Best regards

 Manuel

 

 

 

 Substituting the .p12 or .pfx by a .cer certificate dissapear the exception, but now I get an "Invalid signature" when veryfing after signing. Any idea?

Thanks in advance

Best regards,

Manuel

Feb 17, 2011 at 1:57 PM

Hi Manuel,

Can you please post a code snippet showing how are using the library? At first glance, it seems like you're not passing the password string for the pfx. As for the .cer file, it usually contains only the public key of the certificate which would explain why the exception is not thrown. 

There's some issue validating the signature (see  this link). I'm currently working on it and I hope a new correction will be published soon.

Regards

Víctor

Feb 17, 2011 at 6:34 PM
Buenas tardes Victor
Ante todo, gracias por tu respuesta y por la rapidez de la misma. El código que utilizo es el de test XadesNet.exe seleccionando uno de los certificados del almacen (en este caso da signature invalid). Con este otro que yo utilizo no da error al firmar pero al verificar me aparece "Signer public key cannot be found":

Dim certificate AsNewX509Certificate2

certificate = NewX509Certificate2("c:\temp\xadesnettest.p12", "xadesnet")

' Single signature to a file

XmlDsigHelper.Sign("input.xml").Using(certificate).SignToFile("output.xml")

Un saludo y muchas gracias por vuestra paciencia
Manuel Pino