Martin Buechler wrote:

Nelson B wrote:
...
 >
 > pk11_backupGetSignLength only works with keys that have the CKA_SIGN
 > attribute set to TRUE.  Consequenly, one would expect it would fail
 > with many decryption private keys.  I'm pretty sure that's why NSS
 > doesn't attempt to call pk11_backupGetSignLength in the
 > encrypt/decrypt case.
 >
...

NSS executes the encrypt/decrypt test branch only if the key has
CKA_DECRYPT set to TRUE. With test mechanism CKM_RSA_PKCS the module
would do the padding and an C_Encrypt call in 'pk11_backupGetEncryptLength' would give back the length that NSS is looking for. Isn't it?

I think you're suggesting that one could write a pk11_backupGetEncryptLength function that would use C_Encrypt in the same way that pk11_backupGetSignLength uses C_Sign to get the output buffer length. Yes, I believe that should work too.

I had thought of that before, but didn't suggest it because there is
a MUCH easier way to get the public key modulus size, easier even
than what PK11_GetPrivateModulusLen does.

BTW, I should correct something I wrote previously.  I suggested that
CKA_MODULUS_BITS was not in PKCS11 v1.0.  That was incorrect.  So,
I don't know why NSS wasn't using that.

Even if you don't have time to write the patch, please take the time
to write the bug report, or if you can't, tell me (in a posting to this
group) and I will.

Nelson

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

Reply via email to