diff options
author | David Hook <dgh@bouncycastle.org> | 2015-10-12 16:39:22 +1100 |
---|---|---|
committer | David Hook <dgh@bouncycastle.org> | 2015-10-12 16:39:22 +1100 |
commit | 454a3299691ed04f7be1cf4866af2c3f90621fd2 (patch) | |
tree | e4099ef725af5a7ff5f7e418bd91a9c6311a13c1 | |
parent | Initial cut of signature generation operators. (diff) | |
download | BouncyCastle.NET-ed25519-454a3299691ed04f7be1cf4866af2c3f90621fd2.tar.xz |
Fixed generics
-rw-r--r-- | crypto/src/crypto/ISignatureCalculator.cs | 10 | ||||
-rw-r--r-- | crypto/src/crypto/ISignatureVerifier.cs | 4 | ||||
-rw-r--r-- | crypto/src/crypto/ISignatureVerifierProvider.cs | 4 | ||||
-rw-r--r-- | crypto/src/crypto/operators/Asn1Signature.cs | 14 | ||||
-rw-r--r-- | crypto/src/x509/X509V1CertificateGenerator.cs | 6 | ||||
-rw-r--r-- | crypto/src/x509/X509V2AttributeCertificateGenerator.cs | 4 | ||||
-rw-r--r-- | crypto/src/x509/X509V2CRLGenerator.cs | 6 | ||||
-rw-r--r-- | crypto/src/x509/X509V3CertificateGenerator.cs | 6 |
8 files changed, 24 insertions, 30 deletions
diff --git a/crypto/src/crypto/ISignatureCalculator.cs b/crypto/src/crypto/ISignatureCalculator.cs index 2b7c0378e..3d7f935b2 100644 --- a/crypto/src/crypto/ISignatureCalculator.cs +++ b/crypto/src/crypto/ISignatureCalculator.cs @@ -1,21 +1,15 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; using System.IO; -using Org.BouncyCastle.Security; -using Org.BouncyCastle.Utilities; - - namespace Org.BouncyCastle.Crypto { /// <summary> /// Base interface for operators that serve as stream-based signature calculators. /// </summary> - public interface ISignatureCalculator<out A> + public interface ISignatureCalculator { /// <summary>The algorithm details object for this calculator.</summary> - A AlgorithmDetails { get ; } + Object AlgorithmDetails { get ; } /// <summary>Return a "bucket" stream which only exists to update the calculator.</summary> /// <returns>A stream to write to in order to update the calculator.</returns> diff --git a/crypto/src/crypto/ISignatureVerifier.cs b/crypto/src/crypto/ISignatureVerifier.cs index 10463259d..1c6cd0e49 100644 --- a/crypto/src/crypto/ISignatureVerifier.cs +++ b/crypto/src/crypto/ISignatureVerifier.cs @@ -6,10 +6,10 @@ namespace Org.BouncyCastle.Crypto /// <summary> /// Base interface for operators that serve as stream-based signature verifiers. /// </summary> - public interface ISignatureVerifier<out A> + public interface ISignatureVerifier { /// <summary>The algorithm details object for this verifier.</summary> - A AlgorithmDetails { get ; } + Object AlgorithmDetails { get ; } /// <summary>Return a "bucket" stream which only exists to update the verifier.</summary> /// <returns>A stream to write to in order to update the verifier.</returns> diff --git a/crypto/src/crypto/ISignatureVerifierProvider.cs b/crypto/src/crypto/ISignatureVerifierProvider.cs index 39264f50e..20180e22a 100644 --- a/crypto/src/crypto/ISignatureVerifierProvider.cs +++ b/crypto/src/crypto/ISignatureVerifierProvider.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<A> + public interface ISignatureVerifierProvider { /// <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<A> CreateSignatureVerifier (A algorithmDetails); + ISignatureVerifier CreateSignatureVerifier (Object algorithmDetails); } } diff --git a/crypto/src/crypto/operators/Asn1Signature.cs b/crypto/src/crypto/operators/Asn1Signature.cs index 8af46aa39..cc1b7f2eb 100644 --- a/crypto/src/crypto/operators/Asn1Signature.cs +++ b/crypto/src/crypto/operators/Asn1Signature.cs @@ -251,7 +251,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<AlgorithmIdentifier> + public class Asn1SignatureCalculator: ISignatureCalculator { private readonly AlgorithmIdentifier algID; private readonly ISigner sig; @@ -289,7 +289,7 @@ namespace Org.BouncyCastle.Crypto.Operators this.algID = X509Utilities.GetSigAlgID (sigOid, algorithm); } - public AlgorithmIdentifier AlgorithmDetails + public Object AlgorithmDetails { get { return this.algID; } } @@ -339,7 +339,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<AlgorithmIdentifier> + public class Asn1SignatureVerifier: ISignatureVerifier { private readonly AlgorithmIdentifier algID; private readonly ISigner sig; @@ -371,7 +371,7 @@ namespace Org.BouncyCastle.Crypto.Operators this.algID = algorithm; } - public AlgorithmIdentifier AlgorithmDetails + public Object AlgorithmDetails { get { return this.algID; } } @@ -412,7 +412,7 @@ namespace Org.BouncyCastle.Crypto.Operators /// <summary> /// Provider class which supports dynamic creation of signature verifiers. /// </summary> - public class Asn1SignatureVerifierProvider: ISignatureVerifierProvider<AlgorithmIdentifier> + public class Asn1SignatureVerifierProvider: ISignatureVerifierProvider { private readonly AsymmetricKeyParameter publicKey; @@ -425,9 +425,9 @@ namespace Org.BouncyCastle.Crypto.Operators this.publicKey = publicKey; } - public ISignatureVerifier<AlgorithmIdentifier> CreateSignatureVerifier(AlgorithmIdentifier algorithmDetails) + public ISignatureVerifier CreateSignatureVerifier(Object algorithmDetails) { - return new Asn1SignatureVerifier (algorithmDetails, publicKey); + return new Asn1SignatureVerifier ((AlgorithmIdentifier)algorithmDetails, publicKey); } /// <summary> diff --git a/crypto/src/x509/X509V1CertificateGenerator.cs b/crypto/src/x509/X509V1CertificateGenerator.cs index 8201a66ec..0ab6f4b77 100644 --- a/crypto/src/x509/X509V1CertificateGenerator.cs +++ b/crypto/src/x509/X509V1CertificateGenerator.cs @@ -172,9 +172,9 @@ 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<AlgorithmIdentifier> signatureCalculator) + public X509Certificate Generate(ISignatureCalculator signatureCalculator) { - tbsGen.SetSignature (signatureCalculator.AlgorithmDetails); + tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); TbsCertificateStructure tbsCert = tbsGen.GenerateTbsCertificate(); @@ -186,7 +186,7 @@ namespace Org.BouncyCastle.X509 sigStream.Close (); - return GenerateJcaObject(tbsCert, signatureCalculator.AlgorithmDetails, signatureCalculator.Signature()); + return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, signatureCalculator.Signature()); } private X509Certificate GenerateJcaObject( diff --git a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs index 1cbdbcfcb..33aa40c6e 100644 --- a/crypto/src/x509/X509V2AttributeCertificateGenerator.cs +++ b/crypto/src/x509/X509V2AttributeCertificateGenerator.cs @@ -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<AlgorithmIdentifier> signatureCalculator) + public IX509AttributeCertificate Generate(ISignatureCalculator signatureCalculator) { if (!extGenerator.IsEmpty) { @@ -176,7 +176,7 @@ namespace Org.BouncyCastle.X509 Asn1EncodableVector v = new Asn1EncodableVector(); - v.Add(acInfo, signatureCalculator.AlgorithmDetails); + v.Add(acInfo, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); try { diff --git a/crypto/src/x509/X509V2CRLGenerator.cs b/crypto/src/x509/X509V2CRLGenerator.cs index ef0464a82..c7295f5db 100644 --- a/crypto/src/x509/X509V2CRLGenerator.cs +++ b/crypto/src/x509/X509V2CRLGenerator.cs @@ -229,9 +229,9 @@ 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<AlgorithmIdentifier> signatureCalculator) + public X509Crl Generate(ISignatureCalculator signatureCalculator) { - tbsGen.SetSignature(signatureCalculator.AlgorithmDetails); + tbsGen.SetSignature((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); TbsCertificateList tbsCertList = GenerateCertList(); @@ -243,7 +243,7 @@ namespace Org.BouncyCastle.X509 sigStream.Close(); - return GenerateJcaObject(tbsCertList, signatureCalculator.AlgorithmDetails, signatureCalculator.Signature()); + return GenerateJcaObject(tbsCertList, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, signatureCalculator.Signature()); } private TbsCertificateList GenerateCertList() diff --git a/crypto/src/x509/X509V3CertificateGenerator.cs b/crypto/src/x509/X509V3CertificateGenerator.cs index 252b91aa4..f3bcea5f0 100644 --- a/crypto/src/x509/X509V3CertificateGenerator.cs +++ b/crypto/src/x509/X509V3CertificateGenerator.cs @@ -303,9 +303,9 @@ 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<AlgorithmIdentifier> signatureCalculator) + public X509Certificate Generate(ISignatureCalculator signatureCalculator) { - tbsGen.SetSignature (signatureCalculator.AlgorithmDetails); + tbsGen.SetSignature ((AlgorithmIdentifier)signatureCalculator.AlgorithmDetails); if (!extGenerator.IsEmpty) { @@ -322,7 +322,7 @@ namespace Org.BouncyCastle.X509 sigStream.Close (); - return GenerateJcaObject(tbsCert, signatureCalculator.AlgorithmDetails, signatureCalculator.Signature()); + return GenerateJcaObject(tbsCert, (AlgorithmIdentifier)signatureCalculator.AlgorithmDetails, signatureCalculator.Signature()); } private X509Certificate GenerateJcaObject( |