From 0b0a6567a14b9d74780dc5ee1f26de46278e416a Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 10:42:38 +1100 Subject: renamed ISignatureCalculator to ISignatureCalculatorFactory --- crypto/src/cms/CMSSignedDataGenerator.cs | 6 +++--- crypto/src/cms/SignerInfoGenerator.cs | 14 ++++++------- crypto/src/crypto/ISignatureCalculator.cs | 23 ---------------------- crypto/src/crypto/ISignatureCalculatorFactory.cs | 23 ++++++++++++++++++++++ crypto/src/crypto/operators/Asn1Signature.cs | 6 +++--- crypto/src/ocsp/BasicOCSPRespGenerator.cs | 6 +++--- crypto/src/pkcs/Pkcs10CertificationRequest.cs | 8 ++++---- crypto/src/x509/X509V1CertificateGenerator.cs | 10 +++++----- .../x509/X509V2AttributeCertificateGenerator.cs | 10 +++++----- crypto/src/x509/X509V2CRLGenerator.cs | 10 +++++----- crypto/src/x509/X509V3CertificateGenerator.cs | 10 +++++----- crypto/test/src/cms/test/SignedDataTest.cs | 4 ++-- 12 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 crypto/src/crypto/ISignatureCalculator.cs create mode 100644 crypto/src/crypto/ISignatureCalculatorFactory.cs (limited to 'crypto') diff --git a/crypto/src/cms/CMSSignedDataGenerator.cs b/crypto/src/cms/CMSSignedDataGenerator.cs index f4720597d..60d723d60 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 ISignatureCalculatorFactory 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 Asn1SignatureCalculatorFactory(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, + ISignatureCalculatorFactory sigCalc, SignerIdentifier signerIdentifier, CmsAttributeTableGenerator sAttr, CmsAttributeTableGenerator unsAttr, diff --git a/crypto/src/cms/SignerInfoGenerator.cs b/crypto/src/cms/SignerInfoGenerator.cs index 62db40ad8..69196bdd1 100644 --- a/crypto/src/cms/SignerInfoGenerator.cs +++ b/crypto/src/cms/SignerInfoGenerator.cs @@ -17,18 +17,18 @@ namespace Org.BouncyCastle.Cms public class SignerInfoGenerator { internal X509Certificate certificate; - internal ISignatureCalculator contentSigner; + internal ISignatureCalculatorFactory 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, ISignatureCalculatorFactory contentSigner): this(sigId, contentSigner, false) { } - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculator contentSigner, bool isDirectSignature) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory contentSigner, bool isDirectSignature) { this.sigId = sigId; this.contentSigner = contentSigner; @@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Cms } } - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculator contentSigner, CmsAttributeTableGenerator signedGen, CmsAttributeTableGenerator unsignedGen) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory 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(ISignatureCalculatorFactory contentSigner, X509Certificate certificate) { SignerIdentifier sigId = new SignerIdentifier(new IssuerAndSerialNumber(certificate.IssuerDN, new DerInteger(certificate.SerialNumber))); @@ -137,14 +137,14 @@ namespace Org.BouncyCastle.Cms * @return a SignerInfoGenerator * @throws OperatorCreationException if the generator cannot be built. */ - public SignerInfoGenerator Build(ISignatureCalculator contentSigner, byte[] subjectKeyIdentifier) + public SignerInfoGenerator Build(ISignatureCalculatorFactory contentSigner, byte[] subjectKeyIdentifier) { SignerIdentifier sigId = new SignerIdentifier(new DerOctetString(subjectKeyIdentifier)); return CreateGenerator(contentSigner, sigId); } - private SignerInfoGenerator CreateGenerator(ISignatureCalculator contentSigner, SignerIdentifier sigId) + private SignerInfoGenerator CreateGenerator(ISignatureCalculatorFactory contentSigner, SignerIdentifier sigId) { if (directSignature) { diff --git a/crypto/src/crypto/ISignatureCalculator.cs b/crypto/src/crypto/ISignatureCalculator.cs deleted file mode 100644 index bb733818d..000000000 --- a/crypto/src/crypto/ISignatureCalculator.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace Org.BouncyCastle.Crypto -{ - /// - /// Base interface for operators that serve as stream-based signature calculators. - /// - public interface ISignatureCalculator - { - /// The algorithm details object for this calculator. - Object AlgorithmDetails { get ; } - - /// - /// Create a stream calculator for this signature calculator. The stream - /// calculator is used for the actual operation of entering the data to be signed - /// and producing the signature block. - /// - /// A calculator producing an IBlockResult with a signature in it. - IStreamCalculator CreateCalculator(); - } -} - - diff --git a/crypto/src/crypto/ISignatureCalculatorFactory.cs b/crypto/src/crypto/ISignatureCalculatorFactory.cs new file mode 100644 index 000000000..b60adb168 --- /dev/null +++ b/crypto/src/crypto/ISignatureCalculatorFactory.cs @@ -0,0 +1,23 @@ +using System; + +namespace Org.BouncyCastle.Crypto +{ + /// + /// Base interface for operators that serve as stream-based signature calculators. + /// + public interface ISignatureCalculatorFactory + { + /// The algorithm details object for this calculator. + Object AlgorithmDetails { get ; } + + /// + /// Create a stream calculator for this signature calculator. The stream + /// calculator is used for the actual operation of entering the data to be signed + /// and producing the signature block. + /// + /// A calculator producing an IBlockResult with a signature in it. + IStreamCalculator CreateCalculator(); + } +} + + diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs index 9e66b6f0c..92a33e596 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -329,7 +329,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// Calculator class for signature generation in ASN.1 based profiles that use an AlgorithmIdentifier to preserve /// signature algorithm details. /// - public class Asn1SignatureCalculator: ISignatureCalculator + public class Asn1SignatureCalculatorFactory: ISignatureCalculatorFactory { private readonly AlgorithmIdentifier algID; private readonly string algorithm; @@ -341,7 +341,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// /// The name of the signature algorithm to use. /// The private key to be used in the signing operation. - public Asn1SignatureCalculator (string algorithm, AsymmetricKeyParameter privateKey): this(algorithm, privateKey, null) + public Asn1SignatureCalculatorFactory (string algorithm, AsymmetricKeyParameter privateKey): this(algorithm, privateKey, null) { } @@ -351,7 +351,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// The name of the signature algorithm to use. /// The private key to be used in the signing operation. /// The source of randomness to be used in signature calculation. - public Asn1SignatureCalculator (string algorithm, AsymmetricKeyParameter privateKey, SecureRandom random) + public Asn1SignatureCalculatorFactory (string algorithm, AsymmetricKeyParameter privateKey, SecureRandom random) { DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid (algorithm); diff --git a/crypto/src/ocsp/BasicOCSPRespGenerator.cs b/crypto/src/ocsp/BasicOCSPRespGenerator.cs index 9735ba177..14307c3ee 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, + ISignatureCalculatorFactory signatureCalculator, X509Certificate[] chain, DateTime producedAt) { @@ -277,7 +277,7 @@ namespace Org.BouncyCastle.Ocsp throw new ArgumentException("no signing algorithm specified"); } - return GenerateResponse(new Asn1SignatureCalculator(signingAlgorithm, privateKey, random), chain, producedAt); + return GenerateResponse(new Asn1SignatureCalculatorFactory(signingAlgorithm, privateKey, random), chain, producedAt); } /// @@ -288,7 +288,7 @@ namespace Org.BouncyCastle.Ocsp /// "produced at" date. /// public BasicOcspResp Generate( - ISignatureCalculator signatureCalculator, + ISignatureCalculatorFactory signatureCalculator, X509Certificate[] chain, DateTime producedAt) { diff --git a/crypto/src/pkcs/Pkcs10CertificationRequest.cs b/crypto/src/pkcs/Pkcs10CertificationRequest.cs index 6c6b4c87d..1638dcb23 100644 --- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs +++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs @@ -209,7 +209,7 @@ namespace Org.BouncyCastle.Pkcs /// Public Key to be included in cert reqest. /// ASN1Set of Attributes. /// Matching Private key for nominated (above) public key to be used to sign the request. - [Obsolete("Use constructor with an ISignatureCalculator")] + [Obsolete("Use constructor with an ISignatureCalculatorFactory")] public Pkcs10CertificationRequest( string signatureAlgorithm, X509Name subject, @@ -228,7 +228,7 @@ 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 Asn1SignatureCalculatorFactory(signatureAlgorithm, signingKey), subject, publicKey, attributes, signingKey); } /// @@ -240,7 +240,7 @@ namespace Org.BouncyCastle.Pkcs /// ASN1Set of Attributes. /// Matching Private key for nominated (above) public key to be used to sign the request. public Pkcs10CertificationRequest( - ISignatureCalculator signatureCalculator, + ISignatureCalculatorFactory signatureCalculator, X509Name subject, AsymmetricKeyParameter publicKey, Asn1Set attributes, @@ -261,7 +261,7 @@ namespace Org.BouncyCastle.Pkcs } private void init( - ISignatureCalculator signatureCalculator, + ISignatureCalculatorFactory signatureCalculator, X509Name subject, AsymmetricKeyParameter publicKey, Asn1Set attributes, diff --git a/crypto/src/x509/X509V1CertificateGenerator.cs b/crypto/src/x509/X509V1CertificateGenerator.cs index 2279767e3..92829eac3 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. /// /// string representation of the algorithm name - [Obsolete("Not needed if Generate used with an ISignatureCalculator")] + [Obsolete("Not needed if Generate used with an ISignatureCalculatorFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -146,7 +146,7 @@ namespace Org.BouncyCastle.X509 /// /// The private key of the issuer used to sign this certificate. /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureCalculatorFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey) { @@ -159,12 +159,12 @@ namespace Org.BouncyCastle.X509 /// 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 ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureCalculatorFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random)); } /// @@ -172,7 +172,7 @@ namespace Org.BouncyCastle.X509 /// /// A signature calculator with the necessary algorithm details. /// An X509Certificate. - public X509Certificate Generate(ISignatureCalculator signatureCalculator) + public X509Certificate Generate(ISignatureCalculatorFactory signatureCalculator) { tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); diff --git a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs index b6ab45c64..28db75d0f 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. /// /// The algorithm name. - [Obsolete("Not needed if Generate used with an ISignatureCalculator")] + [Obsolete("Not needed if Generate used with an ISignatureCalculatorFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -133,7 +133,7 @@ namespace Org.BouncyCastle.X509 /// /// Generate an X509 certificate, based on the current issuer and subject. /// - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureCalculatorFactory")] public IX509AttributeCertificate Generate( AsymmetricKeyParameter privateKey) { @@ -144,12 +144,12 @@ namespace Org.BouncyCastle.X509 /// Generate an X509 certificate, based on the current issuer and subject, /// using the supplied source of randomness, if required. /// - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureCalculatorFactory")] public IX509AttributeCertificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random)); } /// @@ -157,7 +157,7 @@ namespace Org.BouncyCastle.X509 /// /// A signature calculator with the necessary algorithm details. /// An IX509AttributeCertificate. - public IX509AttributeCertificate Generate(ISignatureCalculator signatureCalculator) + public IX509AttributeCertificate Generate(ISignatureCalculatorFactory signatureCalculator) { if (!extGenerator.IsEmpty) { diff --git a/crypto/src/x509/X509V2CRLGenerator.cs b/crypto/src/x509/X509V2CRLGenerator.cs index 869722219..4504d39a6 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. /// /// - [Obsolete("Not needed if Generate used with an ISignatureCalculator")] + [Obsolete("Not needed if Generate used with an ISignatureCalculatorFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -203,7 +203,7 @@ namespace Org.BouncyCastle.X509 /// /// The private key of the issuer that is signing this certificate. /// An X509Crl. - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureCalculatorFactory")] public X509Crl Generate( AsymmetricKeyParameter privateKey) { @@ -216,12 +216,12 @@ namespace Org.BouncyCastle.X509 /// The private key of the issuer that is signing this certificate. /// Your Secure Random instance. /// An X509Crl. - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureCalculatorFactory")] public X509Crl Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random)); } /// @@ -229,7 +229,7 @@ namespace Org.BouncyCastle.X509 /// /// A signature calculator with the necessary algorithm details. /// An X509Crl. - public X509Crl Generate(ISignatureCalculator signatureCalculator) + public X509Crl Generate(ISignatureCalculatorFactory signatureCalculator) { tbsGen.SetSignature((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); diff --git a/crypto/src/x509/X509V3CertificateGenerator.cs b/crypto/src/x509/X509V3CertificateGenerator.cs index d8cdc7521..b046838e8 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. /// /// - [Obsolete("Not needed if Generate used with an ISignatureCalculator")] + [Obsolete("Not needed if Generate used with an ISignatureCalculatorFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -277,7 +277,7 @@ namespace Org.BouncyCastle.X509 /// /// The private key of the issuer that is signing this certificate. /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureCalculatorFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey) { @@ -290,12 +290,12 @@ namespace Org.BouncyCastle.X509 /// The private key of the issuer that is signing this certificate. /// You Secure Random instance. /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureCalculator")] + [Obsolete("Use Generate with an ISignatureCalculatorFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random)); } /// @@ -303,7 +303,7 @@ namespace Org.BouncyCastle.X509 /// /// A signature calculator with the necessary algorithm details. /// An X509Certificate. - public X509Certificate Generate(ISignatureCalculator signatureCalculator) + public X509Certificate Generate(ISignatureCalculatorFactory signatureCalculator) { tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); diff --git a/crypto/test/src/cms/test/SignedDataTest.cs b/crypto/test/src/cms/test/SignedDataTest.cs index 2b5d147f6..2c6f217da 100644 --- a/crypto/test/src/cms/test/SignedDataTest.cs +++ b/crypto/test/src/cms/test/SignedDataTest.cs @@ -532,9 +532,9 @@ namespace Org.BouncyCastle.Cms.Tests CmsSignedDataGenerator gen = new CmsSignedDataGenerator(); gen.AddSignerInfoGenerator(new SignerInfoGeneratorBuilder().Build( - new Asn1SignatureCalculator("SHA1withRSA", OrigKP.Private), OrigCert)); + new Asn1SignatureCalculatorFactory("SHA1withRSA", OrigKP.Private), OrigCert)); gen.AddSignerInfoGenerator(new SignerInfoGeneratorBuilder().Build( - new Asn1SignatureCalculator("MD5withRSA", OrigKP.Private), OrigCert)); + new Asn1SignatureCalculatorFactory("MD5withRSA", OrigKP.Private), OrigCert)); gen.AddCertificates(x509Certs); -- cgit 1.4.1 From bb74525e072a8530f94e06f12be440932682134c Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 10:46:28 +1100 Subject: updated to reflect name change --- crypto/crypto.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crypto') diff --git a/crypto/crypto.csproj b/crypto/crypto.csproj index b80a3fec0..7c070e9b0 100644 --- a/crypto/crypto.csproj +++ b/crypto/crypto.csproj @@ -3084,7 +3084,7 @@ BuildAction = "Compile" /> -- cgit 1.4.1 From 664568d7ef29cebdb89a51fbdd26e355f1aa18bb Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 10:49:44 +1100 Subject: comment update --- crypto/src/crypto/operators/Asn1Signature.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crypto') diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs index 92a33e596..0943b43f7 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -326,7 +326,7 @@ namespace Org.BouncyCastle.Crypto.Operators } /// - /// 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. /// public class Asn1SignatureCalculatorFactory: ISignatureCalculatorFactory -- cgit 1.4.1 From 1972253ba6e7dab835eb133661fc6542727f40fd Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 10:53:36 +1100 Subject: comment update --- crypto/src/x509/X509V1CertificateGenerator.cs | 10 +++++----- crypto/src/x509/X509V2AttributeCertificateGenerator.cs | 8 ++++---- crypto/src/x509/X509V2CRLGenerator.cs | 10 +++++----- crypto/src/x509/X509V3CertificateGenerator.cs | 10 +++++----- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'crypto') diff --git a/crypto/src/x509/X509V1CertificateGenerator.cs b/crypto/src/x509/X509V1CertificateGenerator.cs index 92829eac3..a311d823a 100644 --- a/crypto/src/x509/X509V1CertificateGenerator.cs +++ b/crypto/src/x509/X509V1CertificateGenerator.cs @@ -170,15 +170,15 @@ namespace Org.BouncyCastle.X509 /// /// Generate a new X509Certificate using the passed in SignatureCalculator. /// - /// A signature calculator with the necessary algorithm details. + /// A signature calculator factory with the necessary algorithm details. /// An X509Certificate. - public X509Certificate Generate(ISignatureCalculatorFactory signatureCalculator) + public X509Certificate Generate(ISignatureCalculatorFactory 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/X509V2AttributeCertificateGenerator.cs b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs index 28db75d0f..195030554 100644 --- a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs +++ b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs @@ -155,9 +155,9 @@ namespace Org.BouncyCastle.X509 /// /// Generate a new X.509 Attribute Certificate using the passed in SignatureCalculator. /// - /// A signature calculator with the necessary algorithm details. + /// A signature calculator factory with the necessary algorithm details. /// An IX509AttributeCertificate. - public IX509AttributeCertificate Generate(ISignatureCalculatorFactory signatureCalculator) + public IX509AttributeCertificate Generate(ISignatureCalculatorFactory 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 4504d39a6..4cfd1b6d9 100644 --- a/crypto/src/x509/X509V2CRLGenerator.cs +++ b/crypto/src/x509/X509V2CRLGenerator.cs @@ -227,15 +227,15 @@ namespace Org.BouncyCastle.X509 /// /// Generate a new X509Crl using the passed in SignatureCalculator. /// - /// A signature calculator with the necessary algorithm details. + /// A signature calculator factory with the necessary algorithm details. /// An X509Crl. - public X509Crl Generate(ISignatureCalculatorFactory signatureCalculator) + public X509Crl Generate(ISignatureCalculatorFactory 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 b046838e8..f19016f84 100644 --- a/crypto/src/x509/X509V3CertificateGenerator.cs +++ b/crypto/src/x509/X509V3CertificateGenerator.cs @@ -301,11 +301,11 @@ namespace Org.BouncyCastle.X509 /// /// Generate a new X509Certificate using the passed in SignatureCalculator. /// - /// A signature calculator with the necessary algorithm details. + /// A signature calculator factory with the necessary algorithm details. /// An X509Certificate. - public X509Certificate Generate(ISignatureCalculatorFactory signatureCalculator) + public X509Certificate Generate(ISignatureCalculatorFactory 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( -- cgit 1.4.1 From da484dcb85bdeae6b2f8b9e81ba03be67cae5764 Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 10:59:46 +1100 Subject: comment update --- crypto/src/cms/SignerInfoGenerator.cs | 13 ++++++------- crypto/src/ocsp/BasicOCSPRespGenerator.cs | 8 ++++---- crypto/src/pkcs/Pkcs10CertificationRequest.cs | 8 ++++---- 3 files changed, 14 insertions(+), 15 deletions(-) (limited to 'crypto') diff --git a/crypto/src/cms/SignerInfoGenerator.cs b/crypto/src/cms/SignerInfoGenerator.cs index 69196bdd1..67600dea4 100644 --- a/crypto/src/cms/SignerInfoGenerator.cs +++ b/crypto/src/cms/SignerInfoGenerator.cs @@ -23,15 +23,15 @@ namespace Org.BouncyCastle.Cms internal CmsAttributeTableGenerator unsignedGen; private bool isDirectSignature; - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory contentSigner): this(sigId, contentSigner, false) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory signerFactory): this(sigId, signerFactory, false) { } - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory contentSigner, bool isDirectSignature) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory signerFactory, bool isDirectSignature) { this.sigId = sigId; - this.contentSigner = contentSigner; + this.contentSigner = signerFactory; this.isDirectSignature = isDirectSignature; if (this.isDirectSignature) { @@ -132,16 +132,15 @@ 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(ISignatureCalculatorFactory contentSigner, byte[] subjectKeyIdentifier) + public SignerInfoGenerator Build(ISignatureCalculatorFactory signerFactory, byte[] subjectKeyIdentifier) { SignerIdentifier sigId = new SignerIdentifier(new DerOctetString(subjectKeyIdentifier)); - return CreateGenerator(contentSigner, sigId); + return CreateGenerator(signerFactory, sigId); } private SignerInfoGenerator CreateGenerator(ISignatureCalculatorFactory contentSigner, SignerIdentifier sigId) diff --git a/crypto/src/ocsp/BasicOCSPRespGenerator.cs b/crypto/src/ocsp/BasicOCSPRespGenerator.cs index 14307c3ee..508d94ec5 100644 --- a/crypto/src/ocsp/BasicOCSPRespGenerator.cs +++ b/crypto/src/ocsp/BasicOCSPRespGenerator.cs @@ -283,21 +283,21 @@ namespace Org.BouncyCastle.Ocsp /// /// Generate the signed response using the passed in signature calculator. /// - /// Implementation of signing calculator. + /// Implementation of signing calculator factory. /// The certificate chain associated with the response signer. /// "produced at" date. /// public BasicOcspResp Generate( - ISignatureCalculatorFactory signatureCalculator, + ISignatureCalculatorFactory 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 1638dcb23..692ab2bd3 100644 --- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs +++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs @@ -234,19 +234,19 @@ namespace Org.BouncyCastle.Pkcs /// /// Instantiate a Pkcs10CertificationRequest object with the necessary credentials. /// - ///The signature calculator to sign the PKCS#10 request with. + ///The factory for signature calculators to sign the PKCS#10 request with. /// X509Name of subject eg OU="My unit." O="My Organisatioin" C="au" /// Public Key to be included in cert reqest. /// ASN1Set of Attributes. /// Matching Private key for nominated (above) public key to be used to sign the request. public Pkcs10CertificationRequest( - ISignatureCalculatorFactory signatureCalculator, + ISignatureCalculatorFactory 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,7 +257,7 @@ 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( -- cgit 1.4.1 From 0178c1bb391ac346c6a75b4ad7a6bed73843c704 Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 16:31:54 +1100 Subject: Final naming refactor --- crypto/src/cms/CMSSignedDataGenerator.cs | 6 +++--- crypto/src/cms/SignerInfoGenerator.cs | 14 +++++++------- crypto/src/crypto/ISignatureCalculatorFactory.cs | 2 +- crypto/src/crypto/ISignatureVerifier.cs | 21 --------------------- crypto/src/crypto/ISignatureVerifierProvider.cs | 18 ------------------ crypto/src/crypto/IVerifierFactory.cs | 21 +++++++++++++++++++++ crypto/src/crypto/IVerifierFactoryProvider.cs | 18 ++++++++++++++++++ crypto/src/crypto/operators/Asn1Signature.cs | 18 +++++++++--------- crypto/src/ocsp/BasicOCSPRespGenerator.cs | 6 +++--- crypto/src/pkcs/Pkcs10CertificationRequest.cs | 12 ++++++------ crypto/src/x509/X509Certificate.cs | 6 +++--- crypto/src/x509/X509Crl.cs | 4 ++-- crypto/src/x509/X509V1CertificateGenerator.cs | 10 +++++----- crypto/src/x509/X509V2AttributeCertificate.cs | 6 +++--- .../src/x509/X509V2AttributeCertificateGenerator.cs | 10 +++++----- crypto/src/x509/X509V2CRLGenerator.cs | 10 +++++----- crypto/src/x509/X509V3CertificateGenerator.cs | 10 +++++----- crypto/test/src/cms/test/SignedDataTest.cs | 4 ++-- 18 files changed, 98 insertions(+), 98 deletions(-) delete mode 100644 crypto/src/crypto/ISignatureVerifier.cs delete mode 100644 crypto/src/crypto/ISignatureVerifierProvider.cs create mode 100644 crypto/src/crypto/IVerifierFactory.cs create mode 100644 crypto/src/crypto/IVerifierFactoryProvider.cs (limited to 'crypto') diff --git a/crypto/src/cms/CMSSignedDataGenerator.cs b/crypto/src/cms/CMSSignedDataGenerator.cs index 60d723d60..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 ISignatureCalculatorFactory 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 Asn1SignatureCalculatorFactory(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, - ISignatureCalculatorFactory sigCalc, + ISignatureFactory sigCalc, SignerIdentifier signerIdentifier, CmsAttributeTableGenerator sAttr, CmsAttributeTableGenerator unsAttr, diff --git a/crypto/src/cms/SignerInfoGenerator.cs b/crypto/src/cms/SignerInfoGenerator.cs index 67600dea4..7b9318cc9 100644 --- a/crypto/src/cms/SignerInfoGenerator.cs +++ b/crypto/src/cms/SignerInfoGenerator.cs @@ -17,18 +17,18 @@ namespace Org.BouncyCastle.Cms public class SignerInfoGenerator { internal X509Certificate certificate; - internal ISignatureCalculatorFactory contentSigner; + internal ISignatureFactory contentSigner; internal SignerIdentifier sigId; internal CmsAttributeTableGenerator signedGen; internal CmsAttributeTableGenerator unsignedGen; private bool isDirectSignature; - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory signerFactory): this(sigId, signerFactory, false) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureFactory signerFactory): this(sigId, signerFactory, false) { } - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory signerFactory, bool isDirectSignature) + internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureFactory signerFactory, bool isDirectSignature) { this.sigId = sigId; this.contentSigner = signerFactory; @@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Cms } } - internal SignerInfoGenerator(SignerIdentifier sigId, ISignatureCalculatorFactory 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(ISignatureCalculatorFactory contentSigner, X509Certificate certificate) + public SignerInfoGenerator Build(ISignatureFactory contentSigner, X509Certificate certificate) { SignerIdentifier sigId = new SignerIdentifier(new IssuerAndSerialNumber(certificate.IssuerDN, new DerInteger(certificate.SerialNumber))); @@ -136,14 +136,14 @@ namespace Org.BouncyCastle.Cms * @param subjectKeyIdentifier key identifier to identify the public key for verifying the signature. * @return a SignerInfoGenerator */ - public SignerInfoGenerator Build(ISignatureCalculatorFactory signerFactory, byte[] subjectKeyIdentifier) + public SignerInfoGenerator Build(ISignatureFactory signerFactory, byte[] subjectKeyIdentifier) { SignerIdentifier sigId = new SignerIdentifier(new DerOctetString(subjectKeyIdentifier)); return CreateGenerator(signerFactory, sigId); } - private SignerInfoGenerator CreateGenerator(ISignatureCalculatorFactory contentSigner, SignerIdentifier sigId) + private SignerInfoGenerator CreateGenerator(ISignatureFactory contentSigner, SignerIdentifier sigId) { if (directSignature) { diff --git a/crypto/src/crypto/ISignatureCalculatorFactory.cs b/crypto/src/crypto/ISignatureCalculatorFactory.cs index b60adb168..cbca7d1a7 100644 --- a/crypto/src/crypto/ISignatureCalculatorFactory.cs +++ b/crypto/src/crypto/ISignatureCalculatorFactory.cs @@ -5,7 +5,7 @@ namespace Org.BouncyCastle.Crypto /// /// Base interface for operators that serve as stream-based signature calculators. /// - public interface ISignatureCalculatorFactory + public interface ISignatureFactory { /// The algorithm details object for this calculator. Object AlgorithmDetails { get ; } diff --git a/crypto/src/crypto/ISignatureVerifier.cs b/crypto/src/crypto/ISignatureVerifier.cs deleted file mode 100644 index 1f42a0256..000000000 --- a/crypto/src/crypto/ISignatureVerifier.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Org.BouncyCastle.Crypto -{ - /// - /// Base interface for operators that serve as stream-based signature verifiers. - /// - public interface ISignatureVerifier - { - /// The algorithm details object for this verifier. - Object AlgorithmDetails { get ; } - - /// - /// Create a stream calculator for this verifier. The stream - /// calculator is used for the actual operation of entering the data to be verified - /// and producing a result which can be used to verify the original signature. - /// - /// A calculator producing an IVerifier which can verify the signature. - IStreamCalculator CreateCalculator(); - } -} diff --git a/crypto/src/crypto/ISignatureVerifierProvider.cs b/crypto/src/crypto/ISignatureVerifierProvider.cs deleted file mode 100644 index 20180e22a..000000000 --- a/crypto/src/crypto/ISignatureVerifierProvider.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Org.BouncyCastle.Crypto -{ - /// - /// Base interface for a provider to support the dynamic creation of signature verifiers. - /// - public interface ISignatureVerifierProvider - { - /// - /// Return a signature verfier for signature algorithm described in the passed in algorithm details object. - /// - /// The details of the signature algorithm verification is required for. - /// A new signature verifier. - ISignatureVerifier CreateSignatureVerifier (Object algorithmDetails); - } -} - diff --git a/crypto/src/crypto/IVerifierFactory.cs b/crypto/src/crypto/IVerifierFactory.cs new file mode 100644 index 000000000..9502b14a7 --- /dev/null +++ b/crypto/src/crypto/IVerifierFactory.cs @@ -0,0 +1,21 @@ +using System; + +namespace Org.BouncyCastle.Crypto +{ + /// + /// Base interface for operators that serve as stream-based signature verifiers. + /// + public interface IVerifierFactory + { + /// The algorithm details object for this verifier. + Object AlgorithmDetails { get ; } + + /// + /// Create a stream calculator for this verifier. The stream + /// calculator is used for the actual operation of entering the data to be verified + /// and producing a result which can be used to verify the original signature. + /// + /// A calculator producing an IVerifier which can verify the signature. + IStreamCalculator CreateCalculator(); + } +} diff --git a/crypto/src/crypto/IVerifierFactoryProvider.cs b/crypto/src/crypto/IVerifierFactoryProvider.cs new file mode 100644 index 000000000..5dc2f9ea4 --- /dev/null +++ b/crypto/src/crypto/IVerifierFactoryProvider.cs @@ -0,0 +1,18 @@ +using System; + +namespace Org.BouncyCastle.Crypto +{ + /// + /// Base interface for a provider to support the dynamic creation of signature verifiers. + /// + public interface IVerifierFactoryProvider + { + /// + /// Return a signature verfier for signature algorithm described in the passed in algorithm details object. + /// + /// The details of the signature algorithm verification is required for. + /// A new signature verifier. + IVerifierFactory CreateSignatureVerifier (Object algorithmDetails); + } +} + diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs index 0943b43f7..4f1e16761 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -329,7 +329,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// Calculator factory class for signature generation in ASN.1 based profiles that use an AlgorithmIdentifier to preserve /// signature algorithm details. /// - public class Asn1SignatureCalculatorFactory: ISignatureCalculatorFactory + public class Asn1SignatureFactory: ISignatureFactory { private readonly AlgorithmIdentifier algID; private readonly string algorithm; @@ -341,7 +341,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// /// The name of the signature algorithm to use. /// The private key to be used in the signing operation. - public Asn1SignatureCalculatorFactory (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 /// The name of the signature algorithm to use. /// The private key to be used in the signing operation. /// The source of randomness to be used in signature calculation. - public Asn1SignatureCalculatorFactory (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. /// - 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 /// /// The name of the signature algorithm to use. /// The public key to be used in the verification operation. - 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 /// /// Provider class which supports dynamic creation of signature verifiers. /// - public class Asn1SignatureVerifierProvider: ISignatureVerifierProvider + public class Asn1SignatureVerifierProvider: IVerifierFactoryProvider { private readonly AsymmetricKeyParameter publicKey; @@ -542,9 +542,9 @@ namespace Org.BouncyCastle.Crypto.Operators this.publicKey = publicKey; } - public ISignatureVerifier CreateSignatureVerifier(Object algorithmDetails) + public IVerifierFactory CreateSignatureVerifier(Object algorithmDetails) { - return new Asn1SignatureVerifier ((AlgorithmIdentifier)algorithmDetails, publicKey); + return new Asn1VerifierFactory ((AlgorithmIdentifier)algorithmDetails, publicKey); } /// diff --git a/crypto/src/ocsp/BasicOCSPRespGenerator.cs b/crypto/src/ocsp/BasicOCSPRespGenerator.cs index 508d94ec5..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( - ISignatureCalculatorFactory signatureCalculator, + ISignatureFactory signatureCalculator, X509Certificate[] chain, DateTime producedAt) { @@ -277,7 +277,7 @@ namespace Org.BouncyCastle.Ocsp throw new ArgumentException("no signing algorithm specified"); } - return GenerateResponse(new Asn1SignatureCalculatorFactory(signingAlgorithm, privateKey, random), chain, producedAt); + return GenerateResponse(new Asn1SignatureFactory(signingAlgorithm, privateKey, random), chain, producedAt); } /// @@ -288,7 +288,7 @@ namespace Org.BouncyCastle.Ocsp /// "produced at" date. /// public BasicOcspResp Generate( - ISignatureCalculatorFactory signatureCalculatorFactory, + ISignatureFactory signatureCalculatorFactory, X509Certificate[] chain, DateTime producedAt) { diff --git a/crypto/src/pkcs/Pkcs10CertificationRequest.cs b/crypto/src/pkcs/Pkcs10CertificationRequest.cs index 692ab2bd3..c581f8b34 100644 --- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs +++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs @@ -209,7 +209,7 @@ namespace Org.BouncyCastle.Pkcs /// Public Key to be included in cert reqest. /// ASN1Set of Attributes. /// Matching Private key for nominated (above) public key to be used to sign the request. - [Obsolete("Use constructor with an ISignatureCalculatorFactory")] + [Obsolete("Use constructor with an ISignatureFactory")] public Pkcs10CertificationRequest( string signatureAlgorithm, X509Name subject, @@ -228,7 +228,7 @@ namespace Org.BouncyCastle.Pkcs if (!signingKey.IsPrivate) throw new ArgumentException("key for signing must be private", "signingKey"); - init(new Asn1SignatureCalculatorFactory(signatureAlgorithm, signingKey), subject, publicKey, attributes, signingKey); + init(new Asn1SignatureFactory(signatureAlgorithm, signingKey), subject, publicKey, attributes, signingKey); } /// @@ -240,7 +240,7 @@ namespace Org.BouncyCastle.Pkcs /// ASN1Set of Attributes. /// Matching Private key for nominated (above) public key to be used to sign the request. public Pkcs10CertificationRequest( - ISignatureCalculatorFactory signatureCalculatorFactory, + ISignatureFactory signatureCalculatorFactory, X509Name subject, AsymmetricKeyParameter publicKey, Asn1Set attributes, @@ -261,7 +261,7 @@ namespace Org.BouncyCastle.Pkcs } private void init( - ISignatureCalculatorFactory signatureCalculator, + ISignatureFactory signatureCalculator, X509Name subject, AsymmetricKeyParameter publicKey, Asn1Set attributes, @@ -326,13 +326,13 @@ namespace Org.BouncyCastle.Pkcs } public bool Verify( - ISignatureVerifierProvider verifierProvider) + IVerifierFactoryProvider verifierProvider) { return Verify(verifierProvider.CreateSignatureVerifier(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..a0c102e98 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)); } /// @@ -557,13 +557,13 @@ namespace Org.BouncyCastle.X509 /// True if the signature is valid. /// If verifier provider is not appropriate or the certificate algorithm is invalid. public virtual void Verify( - ISignatureVerifierProvider verifierProvider) + IVerifierFactoryProvider verifierProvider) { CheckSignature(verifierProvider.CreateSignatureVerifier (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..0492720a2 100644 --- a/crypto/src/x509/X509Crl.cs +++ b/crypto/src/x509/X509Crl.cs @@ -94,13 +94,13 @@ namespace Org.BouncyCastle.X509 /// True if the signature is valid. /// If verifier provider is not appropriate or the CRL algorithm is invalid. public virtual void Verify( - ISignatureVerifierProvider verifierProvider) + IVerifierFactoryProvider verifierProvider) { CheckSignature(verifierProvider.CreateSignatureVerifier(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 a311d823a..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. /// /// string representation of the algorithm name - [Obsolete("Not needed if Generate used with an ISignatureCalculatorFactory")] + [Obsolete("Not needed if Generate used with an ISignatureFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -146,7 +146,7 @@ namespace Org.BouncyCastle.X509 /// /// The private key of the issuer used to sign this certificate. /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureCalculatorFactory")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey) { @@ -159,12 +159,12 @@ namespace Org.BouncyCastle.X509 /// 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 ISignatureCalculatorFactory")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); } /// @@ -172,7 +172,7 @@ namespace Org.BouncyCastle.X509 /// /// A signature calculator factory with the necessary algorithm details. /// An X509Certificate. - public X509Certificate Generate(ISignatureCalculatorFactory signatureCalculatorFactory) + public X509Certificate Generate(ISignatureFactory signatureCalculatorFactory) { tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); diff --git a/crypto/src/x509/X509V2AttributeCertificate.cs b/crypto/src/x509/X509V2AttributeCertificate.cs index cc72c23bb..ad9c467c6 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)); } /// @@ -165,13 +165,13 @@ namespace Org.BouncyCastle.X509 /// True if the signature is valid. /// If verifier provider is not appropriate or the certificate algorithm is invalid. public virtual void Verify( - ISignatureVerifierProvider verifierProvider) + IVerifierFactoryProvider verifierProvider) { CheckSignature(verifierProvider.CreateSignatureVerifier(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 195030554..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. /// /// The algorithm name. - [Obsolete("Not needed if Generate used with an ISignatureCalculatorFactory")] + [Obsolete("Not needed if Generate used with an ISignatureFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -133,7 +133,7 @@ namespace Org.BouncyCastle.X509 /// /// Generate an X509 certificate, based on the current issuer and subject. /// - [Obsolete("Use Generate with an ISignatureCalculatorFactory")] + [Obsolete("Use Generate with an ISignatureFactory")] public IX509AttributeCertificate Generate( AsymmetricKeyParameter privateKey) { @@ -144,12 +144,12 @@ namespace Org.BouncyCastle.X509 /// Generate an X509 certificate, based on the current issuer and subject, /// using the supplied source of randomness, if required. /// - [Obsolete("Use Generate with an ISignatureCalculatorFactory")] + [Obsolete("Use Generate with an ISignatureFactory")] public IX509AttributeCertificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); } /// @@ -157,7 +157,7 @@ namespace Org.BouncyCastle.X509 /// /// A signature calculator factory with the necessary algorithm details. /// An IX509AttributeCertificate. - public IX509AttributeCertificate Generate(ISignatureCalculatorFactory signatureCalculatorFactory) + public IX509AttributeCertificate Generate(ISignatureFactory signatureCalculatorFactory) { if (!extGenerator.IsEmpty) { diff --git a/crypto/src/x509/X509V2CRLGenerator.cs b/crypto/src/x509/X509V2CRLGenerator.cs index 4cfd1b6d9..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. /// /// - [Obsolete("Not needed if Generate used with an ISignatureCalculatorFactory")] + [Obsolete("Not needed if Generate used with an ISignatureFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -203,7 +203,7 @@ namespace Org.BouncyCastle.X509 /// /// The private key of the issuer that is signing this certificate. /// An X509Crl. - [Obsolete("Use Generate with an ISignatureCalculatorFactory")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Crl Generate( AsymmetricKeyParameter privateKey) { @@ -216,12 +216,12 @@ namespace Org.BouncyCastle.X509 /// The private key of the issuer that is signing this certificate. /// Your Secure Random instance. /// An X509Crl. - [Obsolete("Use Generate with an ISignatureCalculatorFactory")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Crl Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); } /// @@ -229,7 +229,7 @@ namespace Org.BouncyCastle.X509 /// /// A signature calculator factory with the necessary algorithm details. /// An X509Crl. - public X509Crl Generate(ISignatureCalculatorFactory signatureCalculatorFactory) + public X509Crl Generate(ISignatureFactory signatureCalculatorFactory) { tbsGen.SetSignature((AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); diff --git a/crypto/src/x509/X509V3CertificateGenerator.cs b/crypto/src/x509/X509V3CertificateGenerator.cs index f19016f84..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. /// /// - [Obsolete("Not needed if Generate used with an ISignatureCalculatorFactory")] + [Obsolete("Not needed if Generate used with an ISignatureFactory")] public void SetSignatureAlgorithm( string signatureAlgorithm) { @@ -277,7 +277,7 @@ namespace Org.BouncyCastle.X509 /// /// The private key of the issuer that is signing this certificate. /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureCalculatorFactory")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey) { @@ -290,12 +290,12 @@ namespace Org.BouncyCastle.X509 /// The private key of the issuer that is signing this certificate. /// You Secure Random instance. /// An X509Certificate. - [Obsolete("Use Generate with an ISignatureCalculatorFactory")] + [Obsolete("Use Generate with an ISignatureFactory")] public X509Certificate Generate( AsymmetricKeyParameter privateKey, SecureRandom random) { - return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random)); + return Generate(new Asn1SignatureFactory(signatureAlgorithm, privateKey, random)); } /// @@ -303,7 +303,7 @@ namespace Org.BouncyCastle.X509 /// /// A signature calculator factory with the necessary algorithm details. /// An X509Certificate. - public X509Certificate Generate(ISignatureCalculatorFactory signatureCalculatorFactory) + public X509Certificate Generate(ISignatureFactory signatureCalculatorFactory) { tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculatorFactory.AlgorithmDetails); diff --git a/crypto/test/src/cms/test/SignedDataTest.cs b/crypto/test/src/cms/test/SignedDataTest.cs index 2c6f217da..89f7eea7d 100644 --- a/crypto/test/src/cms/test/SignedDataTest.cs +++ b/crypto/test/src/cms/test/SignedDataTest.cs @@ -532,9 +532,9 @@ namespace Org.BouncyCastle.Cms.Tests CmsSignedDataGenerator gen = new CmsSignedDataGenerator(); gen.AddSignerInfoGenerator(new SignerInfoGeneratorBuilder().Build( - new Asn1SignatureCalculatorFactory("SHA1withRSA", OrigKP.Private), OrigCert)); + new Asn1SignatureFactory("SHA1withRSA", OrigKP.Private), OrigCert)); gen.AddSignerInfoGenerator(new SignerInfoGeneratorBuilder().Build( - new Asn1SignatureCalculatorFactory("MD5withRSA", OrigKP.Private), OrigCert)); + new Asn1SignatureFactory("MD5withRSA", OrigKP.Private), OrigCert)); gen.AddCertificates(x509Certs); -- cgit 1.4.1 From ac3b5b9b2f0e2f5946916b9b8790c2b1767d18f6 Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 16:33:48 +1100 Subject: added changed files --- crypto/crypto.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crypto') diff --git a/crypto/crypto.csproj b/crypto/crypto.csproj index 7c070e9b0..b147fa9c7 100644 --- a/crypto/crypto.csproj +++ b/crypto/crypto.csproj @@ -3084,17 +3084,17 @@ BuildAction = "Compile" /> -- cgit 1.4.1 From ddb68091eb12df5a866a585d03dd4e645b1b1473 Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 16:39:50 +1100 Subject: fixed file name --- crypto/src/crypto/ISignatureFactory.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 crypto/src/crypto/ISignatureFactory.cs (limited to 'crypto') diff --git a/crypto/src/crypto/ISignatureFactory.cs b/crypto/src/crypto/ISignatureFactory.cs new file mode 100644 index 000000000..cbca7d1a7 --- /dev/null +++ b/crypto/src/crypto/ISignatureFactory.cs @@ -0,0 +1,23 @@ +using System; + +namespace Org.BouncyCastle.Crypto +{ + /// + /// Base interface for operators that serve as stream-based signature calculators. + /// + public interface ISignatureFactory + { + /// The algorithm details object for this calculator. + Object AlgorithmDetails { get ; } + + /// + /// Create a stream calculator for this signature calculator. The stream + /// calculator is used for the actual operation of entering the data to be signed + /// and producing the signature block. + /// + /// A calculator producing an IBlockResult with a signature in it. + IStreamCalculator CreateCalculator(); + } +} + + -- cgit 1.4.1 From 97244e96eee11da4255a6eca3c45f3e321602694 Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 20:39:19 +1100 Subject: Fixed naming of Asn1 implementation --- crypto/src/crypto/operators/Asn1Signature.cs | 4 ++-- crypto/src/pkcs/Pkcs10CertificationRequest.cs | 2 +- crypto/src/x509/X509Crl.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crypto') diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs index 4f1e16761..8060e27cc 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -529,7 +529,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// /// Provider class which supports dynamic creation of signature verifiers. /// - public class Asn1SignatureVerifierProvider: IVerifierFactoryProvider + public class Asn1VerifierFactoryProvider: IVerifierFactoryProvider { private readonly AsymmetricKeyParameter publicKey; @@ -537,7 +537,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// Base constructor - specify the public key to be used in verification. /// /// The public key to be used in creating verifiers provided by this object. - public Asn1SignatureVerifierProvider(AsymmetricKeyParameter publicKey) + public Asn1VerifierFactoryProvider(AsymmetricKeyParameter publicKey) { this.publicKey = publicKey; } diff --git a/crypto/src/pkcs/Pkcs10CertificationRequest.cs b/crypto/src/pkcs/Pkcs10CertificationRequest.cs index c581f8b34..f9f5e7c6c 100644 --- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs +++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs @@ -322,7 +322,7 @@ namespace Org.BouncyCastle.Pkcs public bool Verify( AsymmetricKeyParameter publicKey) { - return Verify(new Asn1SignatureVerifierProvider(publicKey)); + return Verify(new Asn1VerifierFactoryProvider(publicKey)); } public bool Verify( diff --git a/crypto/src/x509/X509Crl.cs b/crypto/src/x509/X509Crl.cs index 0492720a2..7b9547a1c 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)); } /// -- cgit 1.4.1 From 588557ad7e6ae5be5408d53c06c671b496594005 Mon Sep 17 00:00:00 2001 From: David Hook Date: Sat, 24 Oct 2015 20:42:08 +1100 Subject: Fixed method name on verifier factory class --- crypto/src/crypto/IVerifierFactoryProvider.cs | 2 +- crypto/src/crypto/operators/Asn1Signature.cs | 2 +- crypto/src/pkcs/Pkcs10CertificationRequest.cs | 2 +- crypto/src/x509/X509Certificate.cs | 2 +- crypto/src/x509/X509Crl.cs | 2 +- crypto/src/x509/X509V2AttributeCertificate.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crypto') diff --git a/crypto/src/crypto/IVerifierFactoryProvider.cs b/crypto/src/crypto/IVerifierFactoryProvider.cs index 5dc2f9ea4..9cfcbb2c1 100644 --- a/crypto/src/crypto/IVerifierFactoryProvider.cs +++ b/crypto/src/crypto/IVerifierFactoryProvider.cs @@ -12,7 +12,7 @@ namespace Org.BouncyCastle.Crypto /// /// The details of the signature algorithm verification is required for. /// A new signature verifier. - IVerifierFactory CreateSignatureVerifier (Object algorithmDetails); + IVerifierFactory CreateVerifierFactory (Object algorithmDetails); } } diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs index 8060e27cc..d7af3ab13 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -542,7 +542,7 @@ namespace Org.BouncyCastle.Crypto.Operators this.publicKey = publicKey; } - public IVerifierFactory CreateSignatureVerifier(Object algorithmDetails) + public IVerifierFactory CreateVerifierFactory(Object algorithmDetails) { return new Asn1VerifierFactory ((AlgorithmIdentifier)algorithmDetails, publicKey); } diff --git a/crypto/src/pkcs/Pkcs10CertificationRequest.cs b/crypto/src/pkcs/Pkcs10CertificationRequest.cs index f9f5e7c6c..ce4814c23 100644 --- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs +++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs @@ -328,7 +328,7 @@ namespace Org.BouncyCastle.Pkcs public bool Verify( IVerifierFactoryProvider verifierProvider) { - return Verify(verifierProvider.CreateSignatureVerifier(sigAlgId)); + return Verify(verifierProvider.CreateVerifierFactory(sigAlgId)); } public bool Verify( diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs index a0c102e98..9c65f095a 100644 --- a/crypto/src/x509/X509Certificate.cs +++ b/crypto/src/x509/X509Certificate.cs @@ -559,7 +559,7 @@ namespace Org.BouncyCastle.X509 public virtual void Verify( IVerifierFactoryProvider verifierProvider) { - CheckSignature(verifierProvider.CreateSignatureVerifier (c.SignatureAlgorithm)); + CheckSignature(verifierProvider.CreateVerifierFactory (c.SignatureAlgorithm)); } protected virtual void CheckSignature( diff --git a/crypto/src/x509/X509Crl.cs b/crypto/src/x509/X509Crl.cs index 7b9547a1c..087aab23c 100644 --- a/crypto/src/x509/X509Crl.cs +++ b/crypto/src/x509/X509Crl.cs @@ -96,7 +96,7 @@ namespace Org.BouncyCastle.X509 public virtual void Verify( IVerifierFactoryProvider verifierProvider) { - CheckSignature(verifierProvider.CreateSignatureVerifier(c.SignatureAlgorithm)); + CheckSignature(verifierProvider.CreateVerifierFactory(c.SignatureAlgorithm)); } protected virtual void CheckSignature( diff --git a/crypto/src/x509/X509V2AttributeCertificate.cs b/crypto/src/x509/X509V2AttributeCertificate.cs index ad9c467c6..9de9cb538 100644 --- a/crypto/src/x509/X509V2AttributeCertificate.cs +++ b/crypto/src/x509/X509V2AttributeCertificate.cs @@ -167,7 +167,7 @@ namespace Org.BouncyCastle.X509 public virtual void Verify( IVerifierFactoryProvider verifierProvider) { - CheckSignature(verifierProvider.CreateSignatureVerifier(cert.SignatureAlgorithm)); + CheckSignature(verifierProvider.CreateVerifierFactory(cert.SignatureAlgorithm)); } protected virtual void CheckSignature( -- cgit 1.4.1 From 972f9d9a57e141d3171e8714eb953ad4852ab780 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sun, 25 Oct 2015 21:05:01 +0700 Subject: Add suffix check for test files --- crypto/test/src/pkcs/test/EncryptedPrivateKeyInfoTest.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crypto') diff --git a/crypto/test/src/pkcs/test/EncryptedPrivateKeyInfoTest.cs b/crypto/test/src/pkcs/test/EncryptedPrivateKeyInfoTest.cs index a41c99266..23639b112 100644 --- a/crypto/test/src/pkcs/test/EncryptedPrivateKeyInfoTest.cs +++ b/crypto/test/src/pkcs/test/EncryptedPrivateKeyInfoTest.cs @@ -59,11 +59,14 @@ namespace Org.BouncyCastle.Pkcs.Tests doOpensslTestKeys(); } - private void doOpensslTestKeys() + private void doOpensslTestKeys() { string[] names = GetTestDataEntries("keys"); foreach (string name in names) { + if (!name.EndsWith(".key")) + continue; + // Console.Write(name + " => "); Stream data = GetTestDataAsStream(name); AsymmetricKeyParameter key = PrivateKeyFactory.DecryptKey("12345678a".ToCharArray(), data); -- cgit 1.4.1 From 4caeedd6d96eb56729db72af5926d28130e18f3b Mon Sep 17 00:00:00 2001 From: David Hook Date: Mon, 26 Oct 2015 14:57:03 +1100 Subject: removed file --- crypto/src/crypto/ISignatureCalculatorFactory.cs | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 crypto/src/crypto/ISignatureCalculatorFactory.cs (limited to 'crypto') diff --git a/crypto/src/crypto/ISignatureCalculatorFactory.cs b/crypto/src/crypto/ISignatureCalculatorFactory.cs deleted file mode 100644 index cbca7d1a7..000000000 --- a/crypto/src/crypto/ISignatureCalculatorFactory.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace Org.BouncyCastle.Crypto -{ - /// - /// Base interface for operators that serve as stream-based signature calculators. - /// - public interface ISignatureFactory - { - /// The algorithm details object for this calculator. - Object AlgorithmDetails { get ; } - - /// - /// Create a stream calculator for this signature calculator. The stream - /// calculator is used for the actual operation of entering the data to be signed - /// and producing the signature block. - /// - /// A calculator producing an IBlockResult with a signature in it. - IStreamCalculator CreateCalculator(); - } -} - - -- cgit 1.4.1 From 8ccc3bd4a9a1246a6df5cf5af31ad759048d295a Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 26 Oct 2015 11:20:54 +0700 Subject: Add entry for Michael Krueger --- crypto/Contributors.html | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crypto') diff --git a/crypto/Contributors.html b/crypto/Contributors.html index c62928932..3d0992f68 100644 --- a/crypto/Contributors.html +++ b/crypto/Contributors.html @@ -125,6 +125,9 @@
  • Oscar Jacobsson (https://github.com/OscarAyoy) - patch to fix DerEnumerated constructor (including test coverage).

  • +
  • +

    Michael Krueger <michael.krueger@secardeo.com> - patch to fix Asn1.Cmp.RevDetails constructor.

    +
  • -- cgit 1.4.1 From db31d1f8b919f9e9ba237d6289c693ed17246a94 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 26 Oct 2015 11:23:45 +0700 Subject: Update version to 1.8.0-RC.3 --- crypto/NBuild.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crypto') diff --git a/crypto/NBuild.build b/crypto/NBuild.build index 8d2c027b1..84fc5d68b 100644 --- a/crypto/NBuild.build +++ b/crypto/NBuild.build @@ -16,7 +16,7 @@ - + -- cgit 1.4.1