diff options
Diffstat (limited to 'crypto/src/pqc/crypto/lms/LMSKeyPairGenerator.cs')
-rw-r--r-- | crypto/src/pqc/crypto/lms/LMSKeyPairGenerator.cs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crypto/src/pqc/crypto/lms/LMSKeyPairGenerator.cs b/crypto/src/pqc/crypto/lms/LMSKeyPairGenerator.cs index e1afb00d9..4c1f129fd 100644 --- a/crypto/src/pqc/crypto/lms/LMSKeyPairGenerator.cs +++ b/crypto/src/pqc/crypto/lms/LMSKeyPairGenerator.cs @@ -15,16 +15,15 @@ namespace Org.BouncyCastle.Pqc.Crypto.Lms public AsymmetricCipherKeyPair GenerateKeyPair() { - SecureRandom source = m_parameters.Random; + var random = m_parameters.Random; + byte[] I = SecureRandom.GetNextBytes(random, 16); - byte[] I = new byte[16]; - source.NextBytes(I); + var lmsParameters = m_parameters.LmsParameters; + var sigParameters = lmsParameters.LMSigParameters; + var otsParameters = lmsParameters.LMOtsParameters; + byte[] rootSecret = SecureRandom.GetNextBytes(random, sigParameters.M); - byte[] rootSecret = new byte[32]; - source.NextBytes(rootSecret); - - LmsPrivateKeyParameters privKey = Lms.GenerateKeys(m_parameters.LmsParameters.LMSigParameters, - m_parameters.LmsParameters.LMOtsParameters, 0, I, rootSecret); + LmsPrivateKeyParameters privKey = Lms.GenerateKeys(sigParameters, otsParameters, 0, I, rootSecret); return new AsymmetricCipherKeyPair(privKey.GetPublicKey(), privKey); } |