Petar Popara wrote:

When signing using RSA private key it works just fine. When signing using DSA private key I got -8192 error. Am I doing something wrong?


_______________________________________________
mozilla-crypto mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-crypto


Without looking at the code, I can't tell for sure, but it's probably a problem with the hash.

RSA will happily sign any hash or hash size you provide. To get a standard RSA signature you need to provide a DER Encoded value with the hash. DSA can only sign SHA1 20 byte hashes. (definition of DSA). If you have the NSS source code, you can see an example of how SGN_End() does this. (the other option, of course, is to ouse the SGN_ functions to produce your signature).

(Actually look to see if SGN_Digest will do exactly what you want. SGN_Digest takes already digested data and produces a signature appropriate for the key type).

bob

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Reply via email to