diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-23 13:24:28 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-23 13:24:28 +0700 |
commit | 91d0463fd5bcfd29d8573daac2912c340fba715c (patch) | |
tree | 382edefabbe9dd4426afc5c82767a5676f44c3b2 /crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs | |
parent | Refactoring in Pqc.Crypto.Sike (diff) | |
download | BouncyCastle.NET-ed25519-91d0463fd5bcfd29d8573daac2912c340fba715c.tar.xz |
SecureRandom refactoring in Cms
Diffstat (limited to 'crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs')
-rw-r--r-- | crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs index 4a8b57aad..6a362e13f 100644 --- a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs @@ -46,10 +46,9 @@ namespace Org.BouncyCastle.Cms } /// <summary>Constructor allowing specific source of randomness</summary> - /// <param name="rand">Instance of <c>SecureRandom</c> to use.</param> - public CmsEnvelopedDataStreamGenerator( - SecureRandom rand) - : base(rand) + /// <param name="random">Instance of <c>SecureRandom</c> to use.</param> + public CmsEnvelopedDataStreamGenerator(SecureRandom random) + : base(random) { } @@ -104,7 +103,7 @@ namespace Org.BouncyCastle.Cms { try { - recipientInfos.Add(rig.Generate(encKey, rand)); + recipientInfos.Add(rig.Generate(encKey, m_random)); } catch (InvalidKeyException e) { @@ -162,7 +161,7 @@ namespace Org.BouncyCastle.Cms eiGen.GetRawOutputStream(), 0, false, _bufferSize); IBufferedCipher cipher = CipherUtilities.GetCipher(encAlgID.Algorithm); - cipher.Init(true, new ParametersWithRandom(cipherParameters, rand)); + cipher.Init(true, new ParametersWithRandom(cipherParameters, m_random)); CipherStream cOut = new CipherStream(octetOutputStream, null, cipher); return new CmsEnvelopedDataOutputStream(this, cOut, cGen, envGen, eiGen); @@ -191,7 +190,7 @@ namespace Org.BouncyCastle.Cms { CipherKeyGenerator keyGen = GeneratorUtilities.GetKeyGenerator(encryptionOid); - keyGen.Init(new KeyGenerationParameters(rand, keyGen.DefaultStrength)); + keyGen.Init(new KeyGenerationParameters(m_random, keyGen.DefaultStrength)); return Open(outStream, encryptionOid, keyGen); } @@ -207,7 +206,7 @@ namespace Org.BouncyCastle.Cms { CipherKeyGenerator keyGen = GeneratorUtilities.GetKeyGenerator(encryptionOid); - keyGen.Init(new KeyGenerationParameters(rand, keySize)); + keyGen.Init(new KeyGenerationParameters(m_random, keySize)); return Open(outStream, encryptionOid, keyGen); } |