diff options
Diffstat (limited to 'crypto/src')
-rw-r--r-- | crypto/src/cms/CMSSignedDataGenerator.cs | 6 | ||||
-rw-r--r-- | crypto/src/cms/SignerInfoGenerator.cs | 21 | ||||
-rw-r--r-- | crypto/src/crypto/ISignatureFactory.cs (renamed from crypto/src/crypto/ISignatureCalculator.cs) | 2 | ||||
-rw-r--r-- | crypto/src/crypto/IVerifierFactory.cs (renamed from crypto/src/crypto/ISignatureVerifier.cs) | 2 | ||||
-rw-r--r-- | crypto/src/crypto/IVerifierFactoryProvider.cs (renamed from crypto/src/crypto/ISignatureVerifierProvider.cs) | 4 | ||||
-rw-r--r-- | crypto/src/crypto/operators/Asn1Signature.cs | 22 | ||||
-rw-r--r-- | crypto/src/ocsp/BasicOCSPRespGenerator.cs | 12 | ||||
-rw-r--r-- | crypto/src/pkcs/Pkcs10CertificationRequest.cs | 22 | ||||
-rw-r--r-- | crypto/src/x509/X509Certificate.cs | 8 | ||||
-rw-r--r-- | crypto/src/x509/X509Crl.cs | 8 | ||||
-rw-r--r-- | crypto/src/x509/X509V1CertificateGenerator.cs | 18 | ||||
-rw-r--r-- | crypto/src/x509/X509V2AttributeCertificate.cs | 8 | ||||
-rw-r--r-- | crypto/src/x509/X509V2AttributeCertificateGenerator.cs | 16 | ||||
-rw-r--r-- | crypto/src/x509/X509V2CRLGenerator.cs | 18 | ||||
-rw-r--r-- | crypto/src/x509/X509V3CertificateGenerator.cs | 18 |
15 files changed, 92 insertions, 93 deletions
diff --git a/crypto/src/cms/CMSSignedDataGenerator.cs b/crypto/src/cms/CMSSignedDataGenerator.cs index f4720597d..a80cde509 100644 --- a/crypto/src/cms/CMSSignedDataGenerator.cs +++ b/crypto/src/cms/CMSSignedDataGenerator.cs @@ -43,7 +43,7 @@ namespace Org.BouncyCastle.Cms { private readonly CmsSignedGenerator outer; - private readonly ISignatureCalculator sigCalc; + private readonly ISignatureFactory sigCalc; private readonly SignerIdentifier signerIdentifier; private readonly string digestOID; private readonly string encOID; @@ -66,7 +66,7 @@ namespace Org.BouncyCastle.Cms string signatureName = digestName + "with" + Helper.GetEncryptionAlgName(encOID); this.outer = outer; - this.sigCalc = new Asn1SignatureCalculator(signatureName, key); + this.sigCalc = new Asn1SignatureFactory(signatureName, key); this.signerIdentifier = signerIdentifier; this.digestOID = digestOID; this.encOID = encOID; @@ -77,7 +77,7 @@ namespace Org.BouncyCastle.Cms internal SignerInf( CmsSignedGenerator outer, - ISignatureCalculator sigCalc, + ISignatureFactory sigCalc, SignerIdentifier signerIdentifier, CmsAttributeTableGenerator sAttr, CmsAttributeTableGenerator unsAttr, diff --git a/crypto/src/cms/SignerInfoGenerator.cs b/crypto/src/cms/SignerInfoGenerator.cs index 62db40ad8..7b9318cc9 100644 --- a/crypto/src/cms/SignerInfoGenerator.cs +++ b/crypto/src/cms/SignerInfoGenerator.cs @@ -17,21 +17,21 @@ namespace Org.BouncyCastle.Cms public class SignerInfoGenerator { internal X509Certificate certificate; - internal ISignatureCalculator contentSigner; + internal ISignatureFactory contentSigner; internal SignerIdentifier sigId; internal CmsAttributeTableGenerator signedGen; internal CmsAttributeTableGenerator unsignedGen; private bool isDirectSignature; - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculator contentSigner): this(sigId, contentSigner, false) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureFactory signerFactory): this(sigId, signerFactory, false) { } - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculator contentSigner, bool isDirectSignature) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureFactory signerFactory, bool isDirectSignature) { this.sigId = sigId; - this.contentSigner = contentSigner; + this.contentSigner = signerFactory; this.isDirectSignature = isDirectSignature; if (this.isDirectSignature) { @@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Cms } } - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculator contentSigner, CmsAttributeTableGenerator signedGen, CmsAttributeTableGenerator unsignedGen) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureFactory contentSigner, CmsAttributeTableGenerator signedGen, CmsAttributeTableGenerator unsignedGen) { this.sigId = sigId; this.contentSigner = contentSigner; @@ -117,7 +117,7 @@ namespace Org.BouncyCastle.Cms * @return a SignerInfoGenerator * @throws OperatorCreationException if the generator cannot be built. */ - public SignerInfoGenerator Build(ISignatureCalculator contentSigner, X509Certificate certificate) + public SignerInfoGenerator Build(ISignatureFactory contentSigner, X509Certificate certificate) { SignerIdentifier sigId = new SignerIdentifier(new IssuerAndSerialNumber(certificate.IssuerDN, new DerInteger(certificate.SerialNumber))); @@ -132,19 +132,18 @@ namespace Org.BouncyCastle.Cms * Build a generator with the passed in subjectKeyIdentifier as the signerIdentifier. If used you should * try to follow the calculation described in RFC 5280 section 4.2.1.2. * - * @param contentSigner operator for generating the final signature in the SignerInfo with. + * @param signerFactory operator factory for generating the final signature in the SignerInfo with. * @param subjectKeyIdentifier key identifier to identify the public key for verifying the signature. * @return a SignerInfoGenerator - * @throws OperatorCreationException if the generator cannot be built. */ - public SignerInfoGenerator Build(ISignatureCalculator contentSigner, byte[] subjectKeyIdentifier) + public SignerInfoGenerator Build(ISignatureFactory signerFactory, byte[] subjectKeyIdentifier) { SignerIdentifier sigId = new SignerIdentifier(new DerOctetString(subjectKeyIdentifier)); - return CreateGenerator(contentSigner, sigId); + return CreateGenerator(signerFactory, sigId); } - private SignerInfoGenerator CreateGenerator(ISignatureCalculator contentSigner, SignerIdentifier sigId) + private SignerInfoGenerator CreateGenerator(ISignatureFactory contentSigner, SignerIdentifier sigId) { if (directSignature) { diff --git a/crypto/src/crypto/ISignatureCalculator.cs b/crypto/src/crypto/ISignatureFactory.cs index bb733818d..cbca7d1a7 100644 --- a/crypto/src/crypto/ISignatureCalculator.cs +++ b/crypto/src/crypto/ISignatureFactory.cs @@ -5,7 +5,7 @@ namespace Org.BouncyCastle.Crypto /// <summary> /// Base interface for operators that serve as stream-based signature calculators. /// </summary> - public interface ISignatureCalculator + public interface ISignatureFactory { /// <summary>The algorithm details object for this calculator.</summary> Object AlgorithmDetails { get ; } diff --git a/crypto/src/crypto/ISignatureVerifier.cs b/crypto/src/crypto/IVerifierFactory.cs index 1f42a0256..9502b14a7 100644 --- a/crypto/src/crypto/ISignatureVerifier.cs +++ b/crypto/src/crypto/IVerifierFactory.cs @@ -5,7 +5,7 @@ namespace Org.BouncyCastle.Crypto /// <summary> /// Base interface for operators that serve as stream-based signature verifiers. /// </summary> - public interface ISignatureVerifier + public interface IVerifierFactory { /// <summary>The algorithm details object for this verifier.</summary> Object AlgorithmDetails { get ; } diff --git a/crypto/src/crypto/ISignatureVerifierProvider.cs b/crypto/src/crypto/IVerifierFactoryProvider.cs index 20180e22a..9cfcbb2c1 100644 --- a/crypto/src/crypto/ISignatureVerifierProvider.cs +++ b/crypto/src/crypto/IVerifierFactoryProvider.cs @@ -5,14 +5,14 @@ namespace Org.BouncyCastle.Crypto /// <summary> /// Base interface for a provider to support the dynamic creation of signature verifiers. /// </summary> - public interface ISignatureVerifierProvider + public interface IVerifierFactoryProvider { /// <summary> /// Return a signature verfier for signature algorithm described in the passed in algorithm details object. /// </summary> /// <param name="algorithmDetails">The details of the signature algorithm verification is required for.</param> /// <returns>A new signature verifier.</returns> - ISignatureVerifier CreateSignatureVerifier (Object algorithmDetails); + IVerifierFactory CreateVerifierFactory (Object algorithmDetails); } } diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs index 9e66b6f0c..d7af3ab13 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -326,10 +326,10 @@ namespace Org.BouncyCastle.Crypto.Operators } /// <summary> - /// Calculator class for signature generation in ASN.1 based profiles that use an AlgorithmIdentifier to preserve + /// Calculator factory class for signature generation in ASN.1 based profiles that use an AlgorithmIdentifier to preserve /// signature algorithm details. /// </summary> - public class Asn1SignatureCalculator: ISignatureCalculator + public class Asn1SignatureFactory: ISignatureFactory { private readonly AlgorithmIdentifier algID; private readonly string algorithm; @@ -341,7 +341,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// </summary> /// <param name="algorithm">The name of the signature algorithm to use.</param> /// <param name="privateKey">The private key to be used in the signing operation.</param> - public Asn1SignatureCalculator (string algorithm, AsymmetricKeyParameter privateKey): this(algorithm, privateKey, null) + public Asn1SignatureFactory (string algorithm, AsymmetricKeyParameter privateKey): this(algorithm, privateKey, null) { } @@ -351,7 +351,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// <param name="algorithm">The name of the signature algorithm to use.</param> /// <param name="privateKey">The private key to be used in the signing operation.</param> /// <param name="random">The source of randomness to be used in signature calculation.</param> - public Asn1SignatureCalculator (string algorithm, AsymmetricKeyParameter privateKey, SecureRandom random) + public Asn1SignatureFactory (string algorithm, AsymmetricKeyParameter privateKey, SecureRandom random) { DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid (algorithm); @@ -441,7 +441,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// Verifier class for signature verification in ASN.1 based profiles that use an AlgorithmIdentifier to preserve /// signature algorithm details. /// </summary> - public class Asn1SignatureVerifier: ISignatureVerifier + public class Asn1VerifierFactory: IVerifierFactory { private readonly AlgorithmIdentifier algID; private readonly AsymmetricKeyParameter publicKey; @@ -451,7 +451,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// </summary> /// <param name="algorithm">The name of the signature algorithm to use.</param> /// <param name="publicKey">The public key to be used in the verification operation.</param> - public Asn1SignatureVerifier (String algorithm, AsymmetricKeyParameter publicKey) + public Asn1VerifierFactory (String algorithm, AsymmetricKeyParameter publicKey) { DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid (algorithm); @@ -459,7 +459,7 @@ namespace Org.BouncyCastle.Crypto.Operators this.algID = X509Utilities.GetSigAlgID (sigOid, algorithm); } - public Asn1SignatureVerifier (AlgorithmIdentifier algorithm, AsymmetricKeyParameter publicKey) + public Asn1VerifierFactory (AlgorithmIdentifier algorithm, AsymmetricKeyParameter publicKey) { this.publicKey = publicKey; this.algID = algorithm; @@ -529,7 +529,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// <summary> /// Provider class which supports dynamic creation of signature verifiers. /// </summary> - public class Asn1SignatureVerifierProvider: ISignatureVerifierProvider + public class Asn1VerifierFactoryProvider: IVerifierFactoryProvider { private readonly AsymmetricKeyParameter publicKey; @@ -537,14 +537,14 @@ namespace Org.BouncyCastle.Crypto.Operators /// Base constructor - specify the public key to be used in verification. /// </summary> /// <param name="publicKey">The public key to be used in creating verifiers provided by this object.</param> - public Asn1SignatureVerifierProvider(AsymmetricKeyParameter publicKey) + public Asn1VerifierFactoryProvider(AsymmetricKeyParameter publicKey) { this.publicKey = publicKey; } - public ISignatureVerifier CreateSignatureVerifier(Object algorithmDetails) + public IVerifierFactory CreateVerifierFactory(Object algorithmDetails) { - return new Asn1SignatureVerifier ((AlgorithmIdentifier)algorithmDetails, publicKey); + return new Asn1VerifierFactory ((AlgorithmIdentifier)algorithmDetails, publicKey); } /// <summary> diff --git a/crypto/src/ocsp/BasicOCSPRespGenerator.cs b/crypto/src/ocsp/BasicOCSPRespGenerator.cs index 9735ba177..7705071fd 100644 --- a/crypto/src/ocsp/BasicOCSPRespGenerator.cs +++ b/crypto/src/ocsp/BasicOCSPRespGenerator.cs @@ -185,7 +185,7 @@ namespace Org.BouncyCastle.Ocsp } private BasicOcspResp GenerateResponse( - ISignatureCalculator signatureCalculator, + ISignatureFactory signatureCalculator, X509Certificate[] chain, DateTime producedAt) { @@ -277,27 +277,27 @@ namespace Org.BouncyCastle.Ocsp throw new ArgumentException("no signing algorithm specified"); } - return GenerateResponse(new Asn1SignatureCalculator(signingAlgorithm, privateKey, random), chain, producedAt); + return GenerateResponse(new Asn1SignatureFactory(signingAlgorithm, privateKey, random), chain, producedAt); } /// <summary> /// Generate the signed response using the passed in signature calculator. /// </summary> - /// <param name="signatureCalculator">Implementation of signing calculator.</param> + /// <param name="signatureCalculatorFactory">Implementation of signing calculator factory.</param> /// <param name="chain">The certificate chain associated with the response signer.</param> /// <param name="producedAt">"produced at" date.</param> /// <returns></returns> public BasicOcspResp Generate( - ISignatureCalculator signatureCalculator, + ISignatureFactory signatureCalculatorFactory, X509Certificate[] chain, DateTime producedAt) { - if (signatureCalculator == null) + if (signatureCalculatorFactory == null) { throw new ArgumentException("no signature calculator specified"); } - return GenerateResponse(signatureCalculator, chain, producedAt); + return GenerateResponse(signatureCalculatorFactory, chain, producedAt); } /** diff --git a/crypto/src/pkcs/Pkcs10CertificationRequest.cs b/crypto/src/pkcs/Pkcs10CertificationRequest.cs index 6c6b4c87d..ce4814c23 100644 --- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs +++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs @@ -209,7 +209,7 @@ namespace Org.BouncyCastle.Pkcs /// <param name="publicKey">Public Key to be included in cert reqest.</param> /// <param name="attributes">ASN1Set of Attributes.</param> /// <param name="signingKey">Matching Private key for nominated (above) public key to be used to sign the request.</param> - [Obsolete("Use constructor with an ISignatureCalculator")] + [Obsolete("Use constructor with an ISignatureFactory")] public Pkcs10CertificationRequest( string signatureAlgorithm, X509Name subject, @@ -228,25 +228,25 @@ namespace Org.BouncyCastle.Pkcs if (!signingKey.IsPrivate) throw new ArgumentException("key for signing must be private", "signingKey"); - init(new Asn1SignatureCalculator(signatureAlgorithm, signingKey), subject, publicKey, attributes, signingKey); + init(new Asn1SignatureFactory(signatureAlgorithm, signingKey), subject, publicKey, attributes, signingKey); } /// <summary> /// Instantiate a Pkcs10CertificationRequest object with the necessary credentials. /// </summary> - ///<param name="signatureCalculator">The signature calculator to sign the PKCS#10 request with.</param> + ///<param name="signatureCalculatorFactory">The factory for signature calculators to sign the PKCS#10 request with.</param> /// <param name="subject">X509Name of subject eg OU="My unit." O="My Organisatioin" C="au" </param> /// <param name="publicKey">Public Key to be included in cert reqest.</param> /// <param name="attributes">ASN1Set of Attributes.</param> /// <param name="signingKey">Matching Private key for nominated (above) public key to be used to sign the request.</param> public Pkcs10CertificationRequest( - ISignatureCalculator signatureCalculator, + ISignatureFactory signatureCalculatorFactory, X509Name subject, AsymmetricKeyParameter publicKey, Asn1Set attributes, AsymmetricKeyParameter signingKey) { - if (signatureCalculator == null) + if (signatureCalculatorFactory == null) throw new ArgumentNullException("signatureCalculator"); if (subject == null) throw new ArgumentNullException("subject"); @@ -257,11 +257,11 @@ namespace Org.BouncyCastle.Pkcs if (!signingKey.IsPrivate) throw new ArgumentException("key for signing must be private", "signingKey"); - init(signatureCalculator, subject, publicKey, attributes, signingKey); + init(signatureCalculatorFactory, subject, publicKey, attributes, signingKey); } private void init( - ISignatureCalculator signatureCalculator, + ISignatureFactory signatureCalculator, X509Name subject, AsymmetricKeyParameter publicKey, Asn1Set attributes, @@ -322,17 +322,17 @@ namespace Org.BouncyCastle.Pkcs public bool Verify( AsymmetricKeyParameter publicKey) { - return Verify(new Asn1SignatureVerifierProvider(publicKey)); + return Verify(new Asn1VerifierFactoryProvider(publicKey)); } public bool Verify( - ISignatureVerifierProvider verifierProvider) + IVerifierFactoryProvider verifierProvider) { - return Verify(verifierProvider.CreateSignatureVerifier(sigAlgId)); + return Verify(verifierProvider.CreateVerifierFactory(sigAlgId)); } public bool Verify( - ISignatureVerifier verifier) + IVerifierFactory verifier) { try { diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs index c323fc8f1..9c65f095a 100644 --- a/crypto/src/x509/X509Certificate.cs +++ b/crypto/src/x509/X509Certificate.cs @@ -547,7 +547,7 @@ namespace Org.BouncyCastle.X509 public virtual void Verify( AsymmetricKeyParameter key) { - CheckSignature(new Asn1SignatureVerifier(c.SignatureAlgorithm, key)); + CheckSignature(new Asn1VerifierFactory(c.SignatureAlgorithm, key)); } /// <summary> @@ -557,13 +557,13 @@ namespace Org.BouncyCastle.X509 /// <returns>True if the signature is valid.</returns> /// <exception cref="Exception">If verifier provider is not appropriate or the certificate algorithm is invalid.</exception> public virtual void Verify( - ISignatureVerifierProvider verifierProvider) + IVerifierFactoryProvider verifierProvider) { - CheckSignature(verifierProvider.CreateSignatureVerifier (c.SignatureAlgorithm)); + CheckSignature(verifierProvider.CreateVerifierFactory (c.SignatureAlgorithm)); } protected virtual void CheckSignature( - ISignatureVerifier verifier) + IVerifierFactory verifier) { if (!IsAlgIDEqual(c.SignatureAlgorithm, c.TbsCertificate.Signature)) throw new CertificateException("signature algorithm in TBS cert not same as outer cert"); diff --git a/crypto/src/x509/X509Crl.cs b/crypto/src/x509/X509Crl.cs index 0679cb240..087aab23c 100644 --- a/crypto/src/x509/X509Crl.cs +++ b/crypto/src/x509/X509Crl.cs @@ -84,7 +84,7 @@ namespace Org.BouncyCastle.X509 public virtual void Verify( AsymmetricKeyParameter publicKey) { - Verify(new Asn1SignatureVerifierProvider(publicKey)); + Verify(new Asn1VerifierFactoryProvider(publicKey)); } /// <summary> @@ -94,13 +94,13 @@ namespace Org.BouncyCastle.X509 /// <returns>True if the signature is valid.</returns> /// <exception cref="Exception">If verifier provider is not appropriate or the CRL algorithm is invalid.</exception> public virtual void Verify( - ISignatureVerifierProvider verifierProvider) + IVerifierFactoryProvider verifierProvider) { - CheckSignature(verifierProvider.CreateSignatureVerifier(c.SignatureAlgorithm)); + CheckSignature(verifierProvider.CreateVerifierFactory(c.SignatureAlgorithm)); } protected virtual void CheckSignature( - ISignatureVerifier verifier) + IVerifierFactory verifier) { if (!c.SignatureAlgorithm.Equals(c.TbsCertList.Signature)) { diff --git a/crypto/src/x509/X509V1CertificateGenerator.cs b/crypto/src/x509/X509V1CertificateGenerator.cs index 2279767e3..79e3862e4 100644 --- a/crypto/src/x509/X509V1CertificateGenerator.cs +++ b/crypto/src/x509/X509V1CertificateGenerator.cs @@ -121,7 +121,7 @@ namespace Org.BouncyCastle.X509 /// This can be either a name or an OID, names are treated as case insensitive. /// </summary> /// <param name="signatureAlgorithm">string representation of the algorithm name</param> - [Obsolete("Not needed if Generate used with an ISignatureCalculator")] + [Obsolete("Not needed if Generate used with an ISignatureFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -146,7 +146,7 @@ namespace Org.BouncyCastle.X509 /// </summary> /// <param name="privateKey">The private key of the issuer used to sign this certificate.</param> /// <returns>An X509Certificate.</returns> - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey) { @@ -159,26 +159,26 @@ namespace Org.BouncyCastle.X509 /// <param name="privateKey">The private key of the issuer used to sign this certificate.</param> /// <param name="random">The Secure Random you want to use.</param> /// <returns>An X509Certificate.</returns> - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); } /// <summary> /// Generate a new X509Certificate using the passed in SignatureCalculator. /// </summary> - /// <param name="signatureCalculator">A signature calculator with the necessary algorithm details.</param> + /// <param name="signatureCalculatorFactory">A signature calculator factory with the necessary algorithm details.</param> /// <returns>An X509Certificate.</returns> - public X509Certificate Generate(ISignatureCalculator signatureCalculator) + public X509Certificate Generate(ISignatureFactory signatureCalculatorFactory) { - tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); + tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); TbsCertificateStructure tbsCert = tbsGen.GenerateTbsCertificate(); - IStreamCalculator streamCalculator = signatureCalculator.CreateCalculator(); + IStreamCalculator streamCalculator = signatureCalculatorFactory.CreateCalculator(); byte[] encoded = tbsCert.GetDerEncoded(); @@ -186,7 +186,7 @@ namespace Org.BouncyCastle.X509 streamCalculator.Stream.Close(); - return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect()); + return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect()); } private X509Certificate GenerateJcaObject( diff --git a/crypto/src/x509/X509V2AttributeCertificate.cs b/crypto/src/x509/X509V2AttributeCertificate.cs index cc72c23bb..9de9cb538 100644 --- a/crypto/src/x509/X509V2AttributeCertificate.cs +++ b/crypto/src/x509/X509V2AttributeCertificate.cs @@ -155,7 +155,7 @@ namespace Org.BouncyCastle.X509 public virtual void Verify( AsymmetricKeyParameter key) { - CheckSignature(new Asn1SignatureVerifier(cert.SignatureAlgorithm, key)); + CheckSignature(new Asn1VerifierFactory(cert.SignatureAlgorithm, key)); } /// <summary> @@ -165,13 +165,13 @@ namespace Org.BouncyCastle.X509 /// <returns>True if the signature is valid.</returns> /// <exception cref="Exception">If verifier provider is not appropriate or the certificate algorithm is invalid.</exception> public virtual void Verify( - ISignatureVerifierProvider verifierProvider) + IVerifierFactoryProvider verifierProvider) { - CheckSignature(verifierProvider.CreateSignatureVerifier(cert.SignatureAlgorithm)); + CheckSignature(verifierProvider.CreateVerifierFactory(cert.SignatureAlgorithm)); } protected virtual void CheckSignature( - ISignatureVerifier verifier) + IVerifierFactory verifier) { if (!cert.SignatureAlgorithm.Equals(cert.ACInfo.Signature)) { diff --git a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs index b6ab45c64..8fd5dfdb9 100644 --- a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs +++ b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs @@ -73,7 +73,7 @@ namespace Org.BouncyCastle.X509 /// are treated as case insensitive. /// </summary> /// <param name="signatureAlgorithm">The algorithm name.</param> - [Obsolete("Not needed if Generate used with an ISignatureCalculator")] + [Obsolete("Not needed if Generate used with an ISignatureFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -133,7 +133,7 @@ namespace Org.BouncyCastle.X509 /// <summary> /// Generate an X509 certificate, based on the current issuer and subject. /// </summary> - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureFactory")] public IX509AttributeCertificate Generate( AsymmetricKeyParameter privateKey) { @@ -144,20 +144,20 @@ namespace Org.BouncyCastle.X509 /// Generate an X509 certificate, based on the current issuer and subject, /// using the supplied source of randomness, if required. /// </summary> - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureFactory")] public IX509AttributeCertificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); } /// <summary> /// Generate a new X.509 Attribute Certificate using the passed in SignatureCalculator. /// </summary> - /// <param name="signatureCalculator">A signature calculator with the necessary algorithm details.</param> + /// <param name="signatureCalculatorFactory">A signature calculator factory with the necessary algorithm details.</param> /// <returns>An IX509AttributeCertificate.</returns> - public IX509AttributeCertificate Generate(ISignatureCalculator signatureCalculator) + public IX509AttributeCertificate Generate(ISignatureFactory signatureCalculatorFactory) { if (!extGenerator.IsEmpty) { @@ -168,7 +168,7 @@ namespace Org.BouncyCastle.X509 byte[] encoded = acInfo.GetDerEncoded(); - IStreamCalculator streamCalculator = signatureCalculator.CreateCalculator(); + IStreamCalculator streamCalculator = signatureCalculatorFactory.CreateCalculator(); streamCalculator.Stream.Write(encoded, 0, encoded.Length); @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.X509 Asn1EncodableVector v = new Asn1EncodableVector(); - v.Add(acInfo, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); + v.Add(acInfo, (AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); try { diff --git a/crypto/src/x509/X509V2CRLGenerator.cs b/crypto/src/x509/X509V2CRLGenerator.cs index 869722219..6c9ffe7e5 100644 --- a/crypto/src/x509/X509V2CRLGenerator.cs +++ b/crypto/src/x509/X509V2CRLGenerator.cs @@ -134,7 +134,7 @@ namespace Org.BouncyCastle.X509 /// Set the signature algorithm that will be used to sign this CRL. /// </summary> /// <param name="signatureAlgorithm"/> - [Obsolete("Not needed if Generate used with an ISignatureCalculator")] + [Obsolete("Not needed if Generate used with an ISignatureFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -203,7 +203,7 @@ namespace Org.BouncyCastle.X509 /// </summary> /// <param name="privateKey">The private key of the issuer that is signing this certificate.</param> /// <returns>An X509Crl.</returns> - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Crl Generate( AsymmetricKeyParameter privateKey) { @@ -216,26 +216,26 @@ namespace Org.BouncyCastle.X509 /// <param name="privateKey">The private key of the issuer that is signing this certificate.</param> /// <param name="random">Your Secure Random instance.</param> /// <returns>An X509Crl.</returns> - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Crl Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); } /// <summary> /// Generate a new X509Crl using the passed in SignatureCalculator. /// </summary> - /// <param name="signatureCalculator">A signature calculator with the necessary algorithm details.</param> + /// <param name="signatureCalculatorFactory">A signature calculator factory with the necessary algorithm details.</param> /// <returns>An X509Crl.</returns> - public X509Crl Generate(ISignatureCalculator signatureCalculator) + public X509Crl Generate(ISignatureFactory signatureCalculatorFactory) { - tbsGen.SetSignature((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); + tbsGen.SetSignature((AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); TbsCertificateList tbsCertList = GenerateCertList(); - IStreamCalculator streamCalculator = signatureCalculator.CreateCalculator(); + IStreamCalculator streamCalculator = signatureCalculatorFactory.CreateCalculator(); byte[] encoded = tbsCertList.GetDerEncoded(); @@ -243,7 +243,7 @@ namespace Org.BouncyCastle.X509 streamCalculator.Stream.Close(); - return GenerateJcaObject(tbsCertList, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect()); + return GenerateJcaObject(tbsCertList, (AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect()); } private TbsCertificateList GenerateCertList() diff --git a/crypto/src/x509/X509V3CertificateGenerator.cs b/crypto/src/x509/X509V3CertificateGenerator.cs index d8cdc7521..51488bd2a 100644 --- a/crypto/src/x509/X509V3CertificateGenerator.cs +++ b/crypto/src/x509/X509V3CertificateGenerator.cs @@ -112,7 +112,7 @@ namespace Org.BouncyCastle.X509 /// Set the signature algorithm that will be used to sign this certificate. /// </summary> /// <param name="signatureAlgorithm"/> - [Obsolete("Not needed if Generate used with an ISignatureCalculator")] + [Obsolete("Not needed if Generate used with an ISignatureFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -277,7 +277,7 @@ namespace Org.BouncyCastle.X509 /// </summary> /// <param name="privateKey">The private key of the issuer that is signing this certificate.</param> /// <returns>An X509Certificate.</returns> - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey) { @@ -290,22 +290,22 @@ namespace Org.BouncyCastle.X509 /// <param name="privateKey">The private key of the issuer that is signing this certificate.</param> /// <param name="random">You Secure Random instance.</param> /// <returns>An X509Certificate.</returns> - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); } /// <summary> /// Generate a new X509Certificate using the passed in SignatureCalculator. /// </summary> - /// <param name="signatureCalculator">A signature calculator with the necessary algorithm details.</param> + /// <param name="signatureCalculatorFactory">A signature calculator factory with the necessary algorithm details.</param> /// <returns>An X509Certificate.</returns> - public X509Certificate Generate(ISignatureCalculator signatureCalculator) + public X509Certificate Generate(ISignatureFactory signatureCalculatorFactory) { - tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); + tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); if (!extGenerator.IsEmpty) { @@ -314,7 +314,7 @@ namespace Org.BouncyCastle.X509 TbsCertificateStructure tbsCert = tbsGen.GenerateTbsCertificate(); - IStreamCalculator streamCalculator = signatureCalculator.CreateCalculator(); + IStreamCalculator streamCalculator = signatureCalculatorFactory.CreateCalculator(); byte[] encoded = tbsCert.GetDerEncoded(); @@ -322,7 +322,7 @@ namespace Org.BouncyCastle.X509 streamCalculator.Stream.Close (); - return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect()); + return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails, ((IBlockResult)streamCalculator.GetResult()).Collect()); } private X509Certificate GenerateJcaObject( |