Sign up ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I need to securely generate RSA key pair and I need to have access to private exponent in order to process it further.

What's the difference in FIPS 140-2 and FIPS 186-4 in connection with RSA key pair generation?

If I understand it correctly generating RSA key pair in FIPS 140-2 compliant environment will never show the private part of the RSA key pair as it is protected by cryptographic module.

FIPS 186-4 is about validating that RSA key pair was correctly generated and fulfils requirements about primes and exponents.

So if I want to securely generate RSA key pair and I want to have access to its private part in a clear-text form, I need to use FIPS 186-4 compliant generation and validation.

Am I correct? Do I understand these correctly?

share|improve this question
Does it mean that OpenSSL operating in FIPS 140-2 mode are generating RSA key pair, validating it according FIPS 186-4, and displaying public and private part in clear text on screen? Could you confirm it? – user1563721 Mar 13 at 16:23
I'm a little bit confused. If you use FIPS 140-2 validated Java card and load on it application that are revealing generated RSA private key in clear, doesn't it mean that you are not using the card according its security policy and therefore RSA generated key and in general the card itself is not used according FIPS 140-2? Basically if you say that you have generated RSA key pair in FIPS 140-2 validated environment and get clear private key it means something is wrong...because you get the private exponent in clear which contradicts with FIPS 140-2 Java card. – user1563721 Mar 14 at 10:52
I also found that RSA BSAFE Share for Java Platform 6.1.1 is FIPS 140-2 validated and there is an sample code to generate RSA key pair and print it on screen. The question is how can I verify if it is really generated according standards. They have a method to validate generated key pair according to the SP 800-89. – user1563721 Mar 14 at 11:52

1 Answer 1

up vote 1 down vote accepted

FIPS 140-2 specifies conditions applicable to the environment of RSA (and other) key generation, and refers to FIPS 186-4 for the generation itself.

Several recent Java Card Smart Cards can internally generate RSA-2048 key pairs per FIPS 186-4, with security policy and FIPS 140-2 level 3 certificate to attest that. Here is the one on top of the list at time of writing. A trivial Java Card applet runnign in that Smart Card's Java Card Virtual Machine can generate such RSA key, and export the private key, in clear if you want that. Such key would be for a FIPS-approved algorithm (certs# 1506-1507), and generated according to FIPS 186-4, as attested by a FIPS 140-2 level 3 certificate. That's not enough to pretend that the key was generated in a FIPS 140-2 compliant environment, because the security policy mentions

  • "The module is a limited operational environment under the FIPS 140-2 definitions";
  • accordingly the FIPS 140-2 level 3 certificate does not cover "operation environment";
  • "firmware loaded into this module (..) requires a separate FIPS 140-2 validation" where my reading is that this sentence applies to Java Card applets.

However a (less trivial) Java Card applet could "securely generate RSA key pair (with) access to private exponent in order to process it further" (as asked), for some definition of process like encryption of the private key under a master public key (a form of key escrow). I do not rule out that a FIPS 140-2 validation of that applet could be obtained, such that it would then be correct to tell that the RSA key pair was generated in a FIPS 140-2 validated environment.

share|improve this answer
That's look almost what I want to achieve. What about using a cryptographic PKCS#11 enabled FIPS 140-2 validated USB token and export private key of generated RSA key pair using a symmetric wrapping key? Something like you are suggesting. This could be secure and compliant to all standards because I would use only algorithms that was approved and validated. I wouldn't load my application into it. The wrapping key would be a known key in components. – user1563721 Mar 14 at 17:10
@user1563721: sorry, I pass at interpreting FIPS 140-2 rules applied to PKCS#11 certified tokens to guess what form of private key export remains possible. – fgrieu Mar 15 at 11:18
I will get encrypted private key in the PKCS#8 format which I would be able to decrypt on secured desktop in case I know the symmetric wrapping key. I just need to find out if there is some USB token or smart card able to do that. – user1563721 Mar 15 at 14:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.