Philippe Camacho wrote:

   Hello,

I try to use SGN_Digest with the algorithm SEC_OID_PKCS1_RSA_ENCRYPTION but it fails: The error code given by PR_GetError is -8186 (Bad algorithm). I tried other algorithms but it still failed...
Which algorithm I am supposed to use?


Easy thing to confuse (I had to look at the code to determine the problem).

The algorithm is the digest algorithm. You need to tell SGN_Digest what Digest algorithm you used in order for it to encode that algorithm in the RSA signature (a requirement for PKCS #1). In NSS 3.9.x the valid values are:

SEC_OID_MD2
SEC_OID_MD5
SEC_OID_SHA1
SEC_OID_SHA256
SEC_OID_SHA384
SEC_OID_SHA512

SGN_Digest uses the key type to determine it's using RSA_PKCS1 or DSA (DSA should only take SHA1 digets, though looking at the code, that is not enforced).

bob


Thanks for help. _______________________________________________ mozilla-crypto mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-crypto


_______________________________________________
mozilla-crypto mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-crypto

Reply via email to