From d2c5b877bf9dad0ef9b393af2c17a6445780f0c4 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 22 Jun 2022 14:25:40 +0700 Subject: ObsoleteAttribute cleanup --- crypto/src/math/ec/ECCurve.cs | 87 +++++++--------------- crypto/src/math/ec/ECFieldElement.cs | 74 ------------------ crypto/src/pkcs/PKCS12StoreBuilder.cs | 3 +- crypto/src/pkcs/Pkcs12Store.cs | 40 +--------- crypto/src/security/SignerUtilities.cs | 2 +- crypto/src/x509/X509V1CertificateGenerator.cs | 69 ++--------------- .../x509/X509V2AttributeCertificateGenerator.cs | 54 +------------- crypto/src/x509/X509V2CRLGenerator.cs | 55 +------------- crypto/src/x509/X509V3CertificateGenerator.cs | 55 +------------- 9 files changed, 39 insertions(+), 400 deletions(-) (limited to 'crypto/src') diff --git a/crypto/src/math/ec/ECCurve.cs b/crypto/src/math/ec/ECCurve.cs index c0e27a449..52d634cd2 100644 --- a/crypto/src/math/ec/ECCurve.cs +++ b/crypto/src/math/ec/ECCurve.cs @@ -721,13 +721,8 @@ namespace Org.BouncyCastle.Math.EC this.m_coord = FP_DEFAULT_COORDS; } - [Obsolete("Use constructor taking order/cofactor")] - protected FpCurve(BigInteger q, BigInteger r, ECFieldElement a, ECFieldElement b) - : this(q, r, a, b, null, null) - { - } - - protected FpCurve(BigInteger q, BigInteger r, ECFieldElement a, ECFieldElement b, BigInteger order, BigInteger cofactor) + internal FpCurve(BigInteger q, BigInteger r, ECFieldElement a, ECFieldElement b, BigInteger order, + BigInteger cofactor) : base(q) { this.m_q = q; @@ -777,6 +772,9 @@ namespace Org.BouncyCastle.Math.EC public override ECFieldElement FromBigInteger(BigInteger x) { + if (x == null || x.SignValue < 0 || x.CompareTo(m_q) >= 0) + throw new ArgumentException("value invalid for Fp field element", "x"); + return new FpFieldElement(this.m_q, this.m_r, x); } @@ -873,32 +871,11 @@ namespace Org.BouncyCastle.Math.EC private static IFiniteField BuildField(int m, int k1, int k2, int k3) { - if (k1 == 0) - { - throw new ArgumentException("k1 must be > 0"); - } - - if (k2 == 0) - { - if (k3 != 0) - { - throw new ArgumentException("k3 must be 0 if k2 == 0"); - } - - return FiniteFields.GetBinaryExtensionField(new int[]{ 0, k1, m }); - } - - if (k2 <= k1) - { - throw new ArgumentException("k2 must be > k1"); - } - - if (k3 <= k2) - { - throw new ArgumentException("k3 must be > k2"); - } + int[] exponents = (k2 | k3) == 0 + ? new int[]{ 0, k1, m } + : new int[]{ 0, k1, k2, k3, m }; - return FiniteFields.GetBinaryExtensionField(new int[]{ 0, k1, k2, k3, m }); + return FiniteFields.GetBinaryExtensionField(exponents); } protected AbstractF2mCurve(int m, int k1, int k2, int k3) @@ -1253,15 +1230,8 @@ namespace Org.BouncyCastle.Math.EC * @param cofactor The cofactor of the elliptic curve, i.e. * #Ea(F2m) = h * n. */ - public F2mCurve( - int m, - int k1, - int k2, - int k3, - BigInteger a, - BigInteger b, - BigInteger order, - BigInteger cofactor) + public F2mCurve(int m, int k1, int k2, int k3, BigInteger a, BigInteger b, BigInteger order, + BigInteger cofactor) : base(m, k1, k2, k3) { this.m = m; @@ -1272,29 +1242,13 @@ namespace Org.BouncyCastle.Math.EC this.m_cofactor = cofactor; this.m_infinity = new F2mPoint(this, null, null); - if (k1 == 0) - throw new ArgumentException("k1 must be > 0"); - - if (k2 == 0) - { - if (k3 != 0) - throw new ArgumentException("k3 must be 0 if k2 == 0"); - } - else - { - if (k2 <= k1) - throw new ArgumentException("k2 must be > k1"); - - if (k3 <= k2) - throw new ArgumentException("k3 must be > k2"); - } - this.m_a = FromBigInteger(a); this.m_b = FromBigInteger(b); this.m_coord = F2M_DEFAULT_COORDS; } - protected F2mCurve(int m, int k1, int k2, int k3, ECFieldElement a, ECFieldElement b, BigInteger order, BigInteger cofactor) + internal F2mCurve(int m, int k1, int k2, int k3, ECFieldElement a, ECFieldElement b, BigInteger order, + BigInteger cofactor) : base(m, k1, k2, k3) { this.m = m; @@ -1303,8 +1257,8 @@ namespace Org.BouncyCastle.Math.EC this.k3 = k3; this.m_order = order; this.m_cofactor = cofactor; - this.m_infinity = new F2mPoint(this, null, null); + this.m_a = a; this.m_b = b; this.m_coord = F2M_DEFAULT_COORDS; @@ -1345,7 +1299,14 @@ namespace Org.BouncyCastle.Math.EC public override ECFieldElement FromBigInteger(BigInteger x) { - return new F2mFieldElement(this.m, this.k1, this.k2, this.k3, x); + if (x == null || x.SignValue < 0 || x.BitLength > m) + throw new ArgumentException("value invalid for F2m field element", "x"); + + int[] ks = (k2 | k3) == 0 + ? new int[]{ k1 } + : new int[]{ k1, k2, k3 }; + + return new F2mFieldElement(m, ks, new LongArray(x)); } protected internal override ECPoint CreateRawPoint(ECFieldElement x, ECFieldElement y) @@ -1470,7 +1431,9 @@ namespace Org.BouncyCastle.Math.EC private ECPoint CreatePoint(long[] x, long[] y) { int m = m_outer.m; - int[] ks = m_outer.IsTrinomial() ? new int[] { m_outer.k1 } : new int[] { m_outer.k1, m_outer.k2, m_outer.k3 }; + int[] ks = m_outer.IsTrinomial() + ? new int[]{ m_outer.k1 } + : new int[]{ m_outer.k1, m_outer.k2, m_outer.k3 }; ECFieldElement X = new F2mFieldElement(m, ks, new LongArray(x)); ECFieldElement Y = new F2mFieldElement(m, ks, new LongArray(y)); diff --git a/crypto/src/math/ec/ECFieldElement.cs b/crypto/src/math/ec/ECFieldElement.cs index ed530b6b7..774dfb9f1 100644 --- a/crypto/src/math/ec/ECFieldElement.cs +++ b/crypto/src/math/ec/ECFieldElement.cs @@ -128,17 +128,8 @@ namespace Org.BouncyCastle.Math.EC return null; } - [Obsolete("Use ECCurve.FromBigInteger to construct field elements")] - public FpFieldElement(BigInteger q, BigInteger x) - : this(q, CalculateResidue(q), x) - { - } - internal FpFieldElement(BigInteger q, BigInteger r, BigInteger x) { - if (x == null || x.SignValue < 0 || x.CompareTo(q) >= 0) - throw new ArgumentException("value invalid in Fp field element", "x"); - this.q = q; this.r = r; this.x = x; @@ -649,71 +640,6 @@ namespace Org.BouncyCastle.Math.EC */ internal LongArray x; - /** - * Constructor for Ppb. - * @param m The exponent m of - * F2m. - * @param k1 The integer k1 where xm + - * xk3 + xk2 + xk1 + 1 - * represents the reduction polynomial f(z). - * @param k2 The integer k2 where xm + - * xk3 + xk2 + xk1 + 1 - * represents the reduction polynomial f(z). - * @param k3 The integer k3 where xm + - * xk3 + xk2 + xk1 + 1 - * represents the reduction polynomial f(z). - * @param x The BigInteger representing the value of the field element. - */ - [Obsolete("Use ECCurve.FromBigInteger to construct field elements")] - public F2mFieldElement( - int m, - int k1, - int k2, - int k3, - BigInteger x) - { - if (x == null || x.SignValue < 0 || x.BitLength > m) - throw new ArgumentException("value invalid in F2m field element", "x"); - - if ((k2 == 0) && (k3 == 0)) - { - this.representation = Tpb; - this.ks = new int[] { k1 }; - } - else - { - if (k2 >= k3) - throw new ArgumentException("k2 must be smaller than k3"); - if (k2 <= 0) - throw new ArgumentException("k2 must be larger than 0"); - - this.representation = Ppb; - this.ks = new int[] { k1, k2, k3 }; - } - - this.m = m; - this.x = new LongArray(x); - } - - /** - * Constructor for Tpb. - * @param m The exponent m of - * F2m. - * @param k The integer k where xm + - * xk + 1 represents the reduction - * polynomial f(z). - * @param x The BigInteger representing the value of the field element. - */ - [Obsolete("Use ECCurve.FromBigInteger to construct field elements")] - public F2mFieldElement( - int m, - int k, - BigInteger x) - : this(m, k, 0, 0, x) - { - // Set k1 to k, and set k2 and k3 to 0 - } - internal F2mFieldElement(int m, int[] ks, LongArray x) { this.m = m; diff --git a/crypto/src/pkcs/PKCS12StoreBuilder.cs b/crypto/src/pkcs/PKCS12StoreBuilder.cs index b61a9ea63..50d927af7 100644 --- a/crypto/src/pkcs/PKCS12StoreBuilder.cs +++ b/crypto/src/pkcs/PKCS12StoreBuilder.cs @@ -10,7 +10,6 @@ namespace Org.BouncyCastle.Pkcs private DerObjectIdentifier keyAlgorithm = PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc; private DerObjectIdentifier certAlgorithm = PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc; private DerObjectIdentifier keyPrfAlgorithm = null; - private DerObjectIdentifier certPrfAlgorithm = null; private bool useDerEncoding = false; public Pkcs12StoreBuilder() @@ -19,7 +18,7 @@ namespace Org.BouncyCastle.Pkcs public Pkcs12Store Build() { - return new Pkcs12Store(keyAlgorithm, keyPrfAlgorithm, certAlgorithm, certPrfAlgorithm, useDerEncoding); + return new Pkcs12Store(keyAlgorithm, keyPrfAlgorithm, certAlgorithm, useDerEncoding); } public Pkcs12StoreBuilder SetCertAlgorithm(DerObjectIdentifier certAlgorithm) diff --git a/crypto/src/pkcs/Pkcs12Store.cs b/crypto/src/pkcs/Pkcs12Store.cs index 1e951ace5..d09b8828f 100644 --- a/crypto/src/pkcs/Pkcs12Store.cs +++ b/crypto/src/pkcs/Pkcs12Store.cs @@ -29,7 +29,6 @@ namespace Org.BouncyCastle.Pkcs private readonly DerObjectIdentifier keyAlgorithm; private readonly DerObjectIdentifier keyPrfAlgorithm; private readonly DerObjectIdentifier certAlgorithm; - private readonly DerObjectIdentifier certPrfAlgorithm; private readonly bool useDerEncoding; private AsymmetricKeyEntry unmarkedKeyEntry = null; @@ -85,50 +84,15 @@ namespace Org.BouncyCastle.Pkcs } } - internal Pkcs12Store( - DerObjectIdentifier keyAlgorithm, - DerObjectIdentifier certAlgorithm, - bool useDerEncoding) - { - this.keyAlgorithm = keyAlgorithm; - this.keyPrfAlgorithm = null; - this.certAlgorithm = certAlgorithm; - this.certPrfAlgorithm = null; - this.useDerEncoding = useDerEncoding; - } - - internal Pkcs12Store( - DerObjectIdentifier keyAlgorithm, - DerObjectIdentifier keyPrfAlgorithm, - DerObjectIdentifier certAlgorithm, - DerObjectIdentifier certPrfAlgorithm, - bool useDerEncoding) + internal Pkcs12Store(DerObjectIdentifier keyAlgorithm, DerObjectIdentifier keyPrfAlgorithm, + DerObjectIdentifier certAlgorithm, bool useDerEncoding) { this.keyAlgorithm = keyAlgorithm; this.keyPrfAlgorithm = keyPrfAlgorithm; this.certAlgorithm = certAlgorithm; - this.certPrfAlgorithm = certPrfAlgorithm; this.useDerEncoding = useDerEncoding; } - // TODO Consider making obsolete - // [Obsolete("Use 'Pkcs12StoreBuilder' instead")] - public Pkcs12Store() - : this(PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc, - PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc, false) - { - } - - // TODO Consider making obsolete -// [Obsolete("Use 'Pkcs12StoreBuilder' and 'Load' method instead")] - public Pkcs12Store( - Stream input, - char[] password) - : this() - { - Load(input, password); - } - protected virtual void LoadKeyBag(PrivateKeyInfo privKeyInfo, Asn1Set bagAttributes) { AsymmetricKeyParameter privKey = PrivateKeyFactory.CreateKey(privKeyInfo); diff --git a/crypto/src/security/SignerUtilities.cs b/crypto/src/security/SignerUtilities.cs index 8a289897e..b3a49dea8 100644 --- a/crypto/src/security/SignerUtilities.cs +++ b/crypto/src/security/SignerUtilities.cs @@ -690,7 +690,7 @@ namespace Org.BouncyCastle.Security public static ISigner InitSigner(string algorithm, bool forSigning, AsymmetricKeyParameter privateKey, SecureRandom random) { - ISigner signer = SignerUtilities.GetSigner(algorithm); + ISigner signer = GetSigner(algorithm); signer.Init(forSigning, ParameterUtilities.WithRandom(privateKey, random)); return signer; } diff --git a/crypto/src/x509/X509V1CertificateGenerator.cs b/crypto/src/x509/X509V1CertificateGenerator.cs index c571d2525..99543778b 100644 --- a/crypto/src/x509/X509V1CertificateGenerator.cs +++ b/crypto/src/x509/X509V1CertificateGenerator.cs @@ -4,9 +4,7 @@ using System.Collections; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; -using Org.BouncyCastle.Crypto.Operators; using Org.BouncyCastle.Math; -using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.X509 @@ -16,10 +14,7 @@ namespace Org.BouncyCastle.X509 /// public class X509V1CertificateGenerator { - private V1TbsCertificateGenerator tbsGen; - private DerObjectIdentifier sigOID; - private AlgorithmIdentifier sigAlgId; - private string signatureAlgorithm; + private V1TbsCertificateGenerator tbsGen; /// /// Default Constructor. @@ -114,69 +109,18 @@ namespace Org.BouncyCastle.X509 } } - /// - /// Set the signature algorithm that will be used to sign this certificate. - /// This can be either a name or an OID, names are treated as case insensitive. - /// - /// string representation of the algorithm name - [Obsolete("Not needed if Generate used with an ISignatureFactory")] - public void SetSignatureAlgorithm( - string signatureAlgorithm) - { - this.signatureAlgorithm = signatureAlgorithm; - - try - { - sigOID = X509Utilities.GetAlgorithmOid(signatureAlgorithm); - } - catch (Exception) - { - throw new ArgumentException("Unknown signature type requested", "signatureAlgorithm"); - } - - sigAlgId = X509Utilities.GetSigAlgID(sigOID, signatureAlgorithm); - - tbsGen.SetSignature(sigAlgId); - } - - /// - /// Generate a new X509Certificate. - /// - /// The private key of the issuer used to sign this certificate. - /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureFactory")] - public X509Certificate Generate( - AsymmetricKeyParameter privateKey) - { - return Generate(privateKey, null); - } - - /// - /// Generate a new X509Certificate specifying a SecureRandom instance that you would like to use. - /// - /// The private key of the issuer used to sign this certificate. - /// The Secure Random you want to use. - /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureFactory")] - public X509Certificate Generate( - AsymmetricKeyParameter privateKey, - SecureRandom random) - { - return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); - } - /// /// Generate a new X509Certificate using the passed in SignatureCalculator. /// - /// A signature calculator factory with the necessary algorithm details. + /// A signature calculator factory with the necessary algorithm details. /// An X509Certificate. - public X509Certificate Generate(ISignatureFactory signatureCalculatorFactory) + public X509Certificate Generate(ISignatureFactory signatureFactory) { - tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); + tbsGen.SetSignature((AlgorithmIdentifier)signatureFactory.AlgorithmDetails); TbsCertificateStructure tbsCert = tbsGen.GenerateTbsCertificate(); - IStreamCalculator streamCalculator = signatureCalculatorFactory.CreateCalculator(); + IStreamCalculator streamCalculator = signatureFactory.CreateCalculator(); byte[] encoded = tbsCert.GetDerEncoded(); @@ -184,7 +128,8 @@ namespace Org.BouncyCastle.X509 Platform.Dispose(streamCalculator.Stream); - return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect()); + return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureFactory.AlgorithmDetails, + ((IBlockResult)streamCalculator.GetResult()).Collect()); } private X509Certificate GenerateJcaObject( diff --git a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs index f49eea63f..643604181 100644 --- a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs +++ b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs @@ -4,9 +4,7 @@ using System.Collections; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; -using Org.BouncyCastle.Crypto.Operators; using Org.BouncyCastle.Math; -using Org.BouncyCastle.Security; using Org.BouncyCastle.Security.Certificates; using Org.BouncyCastle.Utilities; @@ -17,10 +15,7 @@ namespace Org.BouncyCastle.X509 { private readonly X509ExtensionsGenerator extGenerator = new X509ExtensionsGenerator(); - private V2AttributeCertificateInfoGenerator acInfoGen; - private DerObjectIdentifier sigOID; - private AlgorithmIdentifier sigAlgId; - private string signatureAlgorithm; + private V2AttributeCertificateInfoGenerator acInfoGen; public X509V2AttributeCertificateGenerator() { @@ -67,31 +62,6 @@ namespace Org.BouncyCastle.X509 acInfoGen.SetEndDate(new DerGeneralizedTime(date)); } - /// - /// Set the signature algorithm. This can be either a name or an OID, names - /// are treated as case insensitive. - /// - /// The algorithm name. - [Obsolete("Not needed if Generate used with an ISignatureFactory")] - public void SetSignatureAlgorithm( - string signatureAlgorithm) - { - this.signatureAlgorithm = signatureAlgorithm; - - try - { - sigOID = X509Utilities.GetAlgorithmOid(signatureAlgorithm); - } - catch (Exception) - { - throw new ArgumentException("Unknown signature type requested"); - } - - sigAlgId = X509Utilities.GetSigAlgID(sigOID, signatureAlgorithm); - - acInfoGen.SetSignature(sigAlgId); - } - /// Add an attribute. public void AddAttribute( X509Attribute attribute) @@ -129,28 +99,6 @@ namespace Org.BouncyCastle.X509 extGenerator.AddExtension(new DerObjectIdentifier(oid), critical, extensionValue); } - /// - /// Generate an X509 certificate, based on the current issuer and subject. - /// - [Obsolete("Use Generate with an ISignatureFactory")] - public IX509AttributeCertificate Generate( - AsymmetricKeyParameter privateKey) - { - return Generate(privateKey, null); - } - - /// - /// Generate an X509 certificate, based on the current issuer and subject, - /// using the supplied source of randomness, if required. - /// - [Obsolete("Use Generate with an ISignatureFactory")] - public IX509AttributeCertificate Generate( - AsymmetricKeyParameter privateKey, - SecureRandom random) - { - return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); - } - /// /// Generate a new X.509 Attribute Certificate using the passed in SignatureCalculator. /// diff --git a/crypto/src/x509/X509V2CRLGenerator.cs b/crypto/src/x509/X509V2CRLGenerator.cs index d16178ffa..ba5c7de2d 100644 --- a/crypto/src/x509/X509V2CRLGenerator.cs +++ b/crypto/src/x509/X509V2CRLGenerator.cs @@ -21,10 +21,7 @@ namespace Org.BouncyCastle.X509 { private readonly X509ExtensionsGenerator extGenerator = new X509ExtensionsGenerator(); - private V2TbsCertListGenerator tbsGen; - private DerObjectIdentifier sigOID; - private AlgorithmIdentifier sigAlgId; - private string signatureAlgorithm; + private V2TbsCertListGenerator tbsGen; public X509V2CrlGenerator() { @@ -130,30 +127,6 @@ namespace Org.BouncyCastle.X509 } } - /// - /// Set the signature algorithm that will be used to sign this CRL. - /// - /// - [Obsolete("Not needed if Generate used with an ISignatureFactory")] - public void SetSignatureAlgorithm( - string signatureAlgorithm) - { - this.signatureAlgorithm = signatureAlgorithm; - - try - { - sigOID = X509Utilities.GetAlgorithmOid(signatureAlgorithm); - } - catch (Exception e) - { - throw new ArgumentException("Unknown signature type requested", e); - } - - sigAlgId = X509Utilities.GetSigAlgID(sigOID, signatureAlgorithm); - - tbsGen.SetSignature(sigAlgId); - } - /** * add a given extension field for the standard extensions tag (tag 0) */ @@ -198,32 +171,6 @@ namespace Org.BouncyCastle.X509 extGenerator.AddExtension(oid, critical, new DerOctetString(extensionValue)); } - /// - /// Generate an X.509 CRL, based on the current issuer and subject. - /// - /// The private key of the issuer that is signing this certificate. - /// An X509Crl. - [Obsolete("Use Generate with an ISignatureFactory")] - public X509Crl Generate( - AsymmetricKeyParameter privateKey) - { - return Generate(privateKey, null); - } - - /// - /// Generate an X.509 CRL, based on the current issuer and subject using the specified secure random. - /// - /// The private key of the issuer that is signing this certificate. - /// Your Secure Random instance. - /// An X509Crl. - [Obsolete("Use Generate with an ISignatureFactory")] - public X509Crl Generate( - AsymmetricKeyParameter privateKey, - SecureRandom random) - { - return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); - } - /// /// Generate a new X509Crl using the passed in SignatureCalculator. /// diff --git a/crypto/src/x509/X509V3CertificateGenerator.cs b/crypto/src/x509/X509V3CertificateGenerator.cs index bc619c37b..47e58ddb5 100644 --- a/crypto/src/x509/X509V3CertificateGenerator.cs +++ b/crypto/src/x509/X509V3CertificateGenerator.cs @@ -20,10 +20,7 @@ namespace Org.BouncyCastle.X509 { private readonly X509ExtensionsGenerator extGenerator = new X509ExtensionsGenerator(); - private V3TbsCertificateGenerator tbsGen; - private DerObjectIdentifier sigOid; - private AlgorithmIdentifier sigAlgId; - private string signatureAlgorithm; + private V3TbsCertificateGenerator tbsGen; public X509V3CertificateGenerator() { @@ -107,30 +104,6 @@ namespace Org.BouncyCastle.X509 tbsGen.SetSubjectPublicKeyInfo(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey)); } - /// - /// Set the signature algorithm that will be used to sign this certificate. - /// - /// - [Obsolete("Not needed if Generate used with an ISignatureFactory")] - public void SetSignatureAlgorithm( - string signatureAlgorithm) - { - this.signatureAlgorithm = signatureAlgorithm; - - try - { - sigOid = X509Utilities.GetAlgorithmOid(signatureAlgorithm); - } - catch (Exception) - { - throw new ArgumentException("Unknown signature type requested: " + signatureAlgorithm); - } - - sigAlgId = X509Utilities.GetSigAlgID(sigOid, signatureAlgorithm); - - tbsGen.SetSignature(sigAlgId); - } - /// /// Set the subject unique ID - note: it is very rare that it is correct to do this. /// @@ -271,32 +244,6 @@ namespace Org.BouncyCastle.X509 } } - /// - /// Generate an X509Certificate. - /// - /// The private key of the issuer that is signing this certificate. - /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureFactory")] - public X509Certificate Generate( - AsymmetricKeyParameter privateKey) - { - return Generate(privateKey, null); - } - - /// - /// Generate an X509Certificate using your own SecureRandom. - /// - /// The private key of the issuer that is signing this certificate. - /// You Secure Random instance. - /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureFactory")] - public X509Certificate Generate( - AsymmetricKeyParameter privateKey, - SecureRandom random) - { - return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); - } - /// /// Generate a new X509Certificate using the passed in SignatureCalculator. /// -- cgit 1.5.1