This is a refresh for a roughly 3.5 year old thread (August 2007). I decided to do a quick check to see if the problem went away but alas I get the same behavior. I started looking through the code again and came up with a few things.

As a quick re-cap, if I call "computeMacData" on a PFX while FIPS mode is enabled on the softtoken, I get the Exception "Failed to import PBA key from PBA-generated bits."
Original thread:
http://groups.google.com/group/mozilla.dev.tech.crypto/browse_thread/thread/15280305838e5538/b53a2c6e3401260f

Wan-Teh had pointed me to some things here:
http://groups.google.com/group/mozilla.dev.tech.crypto/msg/b53a2c6e3401260f

In his snippet from PK11KeyGenerator there's the comment:
/* special case, construct key by hand. Bug #336587 */

This might pre-date the current mozilla bugzilla, because that bug ID doesn't have anything to do with NSS/JSS.

So the reason I'm bringing this up is that NSS's pk12util command doesn't seem to have any issues exporting PKCS12 files while in FIPS mode. Clearly the code is there in NSS to do this in a way that conforms and doesn't throw an error. I started looking through the NSS code and ended up in http://mxr.mozilla.org/security/source/security/nss/lib/pkcs12/p12e.c, which is quite scary. The MAC is computed starting here:
http://mxr.mozilla.org/security/source/security/nss/lib/pkcs12/p12e.c#1586

TLDR:
At 1638 of pk12e.c (http://mxr.mozilla.org/security/source/security/nss/lib/pkcs12/p12e.c#1638), NSS just does a pkcs11 keygen to create the mac key. Could this code be utilized in PK11KeyGenerator.c instead of the current method which bombs in FIPS mode?

Alternatively, the PFX class in JSS does a lot of the work within Java to create the PFX. Would it perhaps be better to pass this off to NSS and have NSS hand back the encoded bytes to JSS? CryptoStore.createEncryptedPrivateKeyInfo functions in a similar manner where it completely passes off the work to NSS.

Thanks,
Dave
--
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to