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/CMSSignedGenerator.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/CMSSignedGenerator.cs')
-rw-r--r-- | crypto/src/cms/CMSSignedGenerator.cs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/crypto/src/cms/CMSSignedGenerator.cs b/crypto/src/cms/CMSSignedGenerator.cs index 58f66f214..c16f6e83c 100644 --- a/crypto/src/cms/CMSSignedGenerator.cs +++ b/crypto/src/cms/CMSSignedGenerator.cs @@ -15,6 +15,7 @@ using Org.BouncyCastle.Asn1.Rosstandart; using Org.BouncyCastle.Asn1.TeleTrust; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Asn1.X9; +using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities.Collections; using Org.BouncyCastle.X509; @@ -481,7 +482,7 @@ namespace Org.BouncyCastle.Cms } } - public class CmsSignedGenerator + public abstract class CmsSignedGenerator { /** * Default type for the signed data. @@ -516,19 +517,21 @@ namespace Org.BouncyCastle.Cms internal bool _useDerForCerts = false; internal bool _useDerForCrls = false; - protected readonly SecureRandom rand; + protected readonly SecureRandom m_random; protected CmsSignedGenerator() - : this(new SecureRandom()) + : this(CryptoServicesRegistrar.GetSecureRandom()) { } /// <summary>Constructor allowing specific source of randomness</summary> - /// <param name="rand">Instance of <c>SecureRandom</c> to use.</param> - protected CmsSignedGenerator( - SecureRandom rand) + /// <param name="random">Instance of <c>SecureRandom</c> to use.</param> + protected CmsSignedGenerator(SecureRandom random) { - this.rand = rand; + if (random == null) + throw new ArgumentNullException(nameof(random)); + + m_random = random; } internal protected virtual IDictionary<CmsAttributeTableParameter, object> GetBaseParameters( |