-
|
Hello, When using FIPS version of Bouncy Castle dlls to read RSA private/public keys, I suppose it follows the FIPS guidelines to deal with those keys in-memory, such as encrypting and zeroizing them. How about the regular Bouncy Castle library (non-FIPS)? Does it also apply this type of protection to RSA keys that are in memory? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
I looked into this, since I was curious too. Short answer: the non-FIPS version of BouncyCastle does not protect private keys in memory. No encryption, no zeroization, no Here's what I found in the source code. Asymmetric keys are stored as plain
|
Beta Was this translation helpful? Give feedback.
-
|
@KonradSop This answers my question, thank you very much for the detailed explanation! |
Beta Was this translation helpful? Give feedback.
I looked into this, since I was curious too. Short answer: the non-FIPS version of BouncyCastle does not protect private keys in memory. No encryption, no zeroization, no
IDisposable.Here's what I found in the source code.
Asymmetric keys are stored as plain
BigIntegerRSA private keys (
RsaPrivateCrtKeyParameters) keep all the sensitive values --p,q,dP,dQ,qInv, the private exponent -- asBigIntegerfields.BigIntegeris a sealed class with areadonly uint[]for its internal data, so there's no way to zero it out in place. This is the same for EC, DH, and DSA private keys.What surprised me is that newer algorithms like Ed25519, X25519, and ML-KEM store their private keys as
byte[]a…