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/ISignatureCalculatorFactory.cs
index bb733818d..b60adb168 100644
--- a/crypto/src/crypto/ISignatureCalculator.cs
+++ b/crypto/src/crypto/ISignatureCalculatorFactory.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 ISignatureCalculatorFactory
{
/// <summary>The algorithm details object for this calculator.</summary>
Object AlgorithmDetails { get ; }
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.
/// </summary>
- 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
/// </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 Asn1SignatureCalculatorFactory (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 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);
}
/// <summary>
@@ -288,7 +288,7 @@ namespace Org.BouncyCastle.Ocsp
/// <param name="producedAt">"produced at" date.</param>
/// <returns></returns>
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
/// <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 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);
}
/// <summary>
@@ -240,7 +240,7 @@ namespace Org.BouncyCastle.Pkcs
/// <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,
+ 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.
/// </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 ISignatureCalculatorFactory")]
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 ISignatureCalculatorFactory")]
public X509Certificate Generate(
AsymmetricKeyParameter privateKey)
{
@@ -159,12 +159,12 @@ 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 ISignatureCalculatorFactory")]
public X509Certificate Generate(
AsymmetricKeyParameter privateKey,
SecureRandom random)
{
- return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random));
+ return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random));
}
/// <summary>
@@ -172,7 +172,7 @@ namespace Org.BouncyCastle.X509
/// </summary>
/// <param name="signatureCalculator">A signature calculator with the necessary algorithm details.</param>
/// <returns>An X509Certificate.</returns>
- 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.
/// </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 ISignatureCalculatorFactory")]
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 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.
/// </summary>
- [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));
}
/// <summary>
@@ -157,7 +157,7 @@ namespace Org.BouncyCastle.X509
/// </summary>
/// <param name="signatureCalculator">A signature calculator with the necessary algorithm details.</param>
/// <returns>An IX509AttributeCertificate.</returns>
- 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.
/// </summary>
/// <param name="signatureAlgorithm"/>
- [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
/// </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 ISignatureCalculatorFactory")]
public X509Crl Generate(
AsymmetricKeyParameter privateKey)
{
@@ -216,12 +216,12 @@ 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 ISignatureCalculatorFactory")]
public X509Crl Generate(
AsymmetricKeyParameter privateKey,
SecureRandom random)
{
- return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random));
+ return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random));
}
/// <summary>
@@ -229,7 +229,7 @@ namespace Org.BouncyCastle.X509
/// </summary>
/// <param name="signatureCalculator">A signature calculator with the necessary algorithm details.</param>
/// <returns>An X509Crl.</returns>
- 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.
/// </summary>
/// <param name="signatureAlgorithm"/>
- [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
/// </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 ISignatureCalculatorFactory")]
public X509Certificate Generate(
AsymmetricKeyParameter privateKey)
{
@@ -290,12 +290,12 @@ 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 ISignatureCalculatorFactory")]
public X509Certificate Generate(
AsymmetricKeyParameter privateKey,
SecureRandom random)
{
- return Generate(new Asn1SignatureCalculator(signatureAlgorithm, privateKey, random));
+ return Generate(new Asn1SignatureCalculatorFactory(signatureAlgorithm, privateKey, random));
}
/// <summary>
@@ -303,7 +303,7 @@ namespace Org.BouncyCastle.X509
/// </summary>
/// <param name="signatureCalculator">A signature calculator with the necessary algorithm details.</param>
/// <returns>An X509Certificate.</returns>
- 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);
|