From 46b90db872db7aaa0ef8f4e1a3a5d3335478c320 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 23 Aug 2022 14:25:10 +0700 Subject: Merge IDsaExt into IDsa --- crypto/src/crypto/IDSA.cs | 39 +++++++++-------------- crypto/src/crypto/IDsaExt.cs | 17 ---------- crypto/src/crypto/signers/DsaDigestSigner.cs | 4 +-- crypto/src/crypto/signers/DsaSigner.cs | 2 +- crypto/src/crypto/signers/ECDsaSigner.cs | 3 +- crypto/src/crypto/signers/ECGOST3410Signer.cs | 2 +- crypto/src/crypto/signers/ECNRSigner.cs | 2 +- crypto/src/crypto/signers/GOST3410DigestSigner.cs | 2 -- crypto/src/crypto/signers/GOST3410Signer.cs | 2 +- 9 files changed, 22 insertions(+), 51 deletions(-) delete mode 100644 crypto/src/crypto/IDsaExt.cs (limited to 'crypto/src') diff --git a/crypto/src/crypto/IDSA.cs b/crypto/src/crypto/IDSA.cs index 7d1fd5197..459914f1f 100644 --- a/crypto/src/crypto/IDSA.cs +++ b/crypto/src/crypto/IDSA.cs @@ -4,38 +4,29 @@ using Org.BouncyCastle.Math; namespace Org.BouncyCastle.Crypto { - /** - * interface for classes implementing the Digital Signature Algorithm - */ + /// Interface for classes implementing the Digital Signature Algorithm public interface IDsa { + /// The algorithm name. string AlgorithmName { get; } - /** - * initialise the signer for signature generation or signature - * verification. - * - * @param forSigning true if we are generating a signature, false - * otherwise. - * @param param key parameters for signature generation. - */ + /// Initialise the signer for signature generation or signature verification. + /// true if we are generating a signature, false otherwise. + /// key parameters for signature generation. void Init(bool forSigning, ICipherParameters parameters); - /** - * sign the passed in message (usually the output of a hash function). - * - * @param message the message to be signed. - * @return two big integers representing the r and s values respectively. - */ + /// Sign the passed in message (usually the output of a hash function). + /// the message to be signed. + /// two big integers representing the r and s values respectively. BigInteger[] GenerateSignature(byte[] message); - /** - * verify the message message against the signature values r and s. - * - * @param message the message that was supposed to have been signed. - * @param r the r signature value. - * @param s the s signature value. - */ + /// The order of the group that the r, s values in signatures belong to. + BigInteger Order { get; } + + /// Verify the message message against the signature values r and s. + /// the message that was supposed to have been signed. + /// the r signature value. + /// the s signature value. bool VerifySignature(byte[] message, BigInteger r, BigInteger s); } } diff --git a/crypto/src/crypto/IDsaExt.cs b/crypto/src/crypto/IDsaExt.cs deleted file mode 100644 index 15b55787a..000000000 --- a/crypto/src/crypto/IDsaExt.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -using Org.BouncyCastle.Math; - -namespace Org.BouncyCastle.Crypto -{ - /// - /// An "extended" interface for classes implementing DSA-style algorithms, that provides access - /// to the group order. - /// - public interface IDsaExt - : IDsa - { - /// The order of the group that the r, s values in signatures belong to. - BigInteger Order { get; } - } -} diff --git a/crypto/src/crypto/signers/DsaDigestSigner.cs b/crypto/src/crypto/signers/DsaDigestSigner.cs index 15444a0f7..da8a8c62d 100644 --- a/crypto/src/crypto/signers/DsaDigestSigner.cs +++ b/crypto/src/crypto/signers/DsaDigestSigner.cs @@ -24,7 +24,7 @@ namespace Org.BouncyCastle.Crypto.Signers } public DsaDigestSigner( - IDsaExt dsa, + IDsa dsa, IDigest digest, IDsaEncoding encoding) { @@ -140,7 +140,7 @@ namespace Org.BouncyCastle.Crypto.Signers protected virtual BigInteger GetOrder() { - return dsa is IDsaExt ? ((IDsaExt)dsa).Order : null; + return dsa.Order; } } } diff --git a/crypto/src/crypto/signers/DsaSigner.cs b/crypto/src/crypto/signers/DsaSigner.cs index 1f5d9b937..7799edc0e 100644 --- a/crypto/src/crypto/signers/DsaSigner.cs +++ b/crypto/src/crypto/signers/DsaSigner.cs @@ -12,7 +12,7 @@ namespace Org.BouncyCastle.Crypto.Signers * Cryptography", pages 452 - 453. */ public class DsaSigner - : IDsaExt + : IDsa { protected readonly IDsaKCalculator kCalculator; diff --git a/crypto/src/crypto/signers/ECDsaSigner.cs b/crypto/src/crypto/signers/ECDsaSigner.cs index 0a265d96e..590c3236b 100644 --- a/crypto/src/crypto/signers/ECDsaSigner.cs +++ b/crypto/src/crypto/signers/ECDsaSigner.cs @@ -1,6 +1,5 @@ using System; -using Org.BouncyCastle.Crypto.Digests; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Math; using Org.BouncyCastle.Math.EC; @@ -14,7 +13,7 @@ namespace Org.BouncyCastle.Crypto.Signers * EC-DSA as described in X9.62 */ public class ECDsaSigner - : IDsaExt + : IDsa { private static readonly BigInteger Eight = BigInteger.ValueOf(8); diff --git a/crypto/src/crypto/signers/ECGOST3410Signer.cs b/crypto/src/crypto/signers/ECGOST3410Signer.cs index 7df43f0a0..7b3833b66 100644 --- a/crypto/src/crypto/signers/ECGOST3410Signer.cs +++ b/crypto/src/crypto/signers/ECGOST3410Signer.cs @@ -14,7 +14,7 @@ namespace Org.BouncyCastle.Crypto.Signers * GOST R 34.10-2001 Signature Algorithm */ public class ECGost3410Signer - : IDsaExt + : IDsa { private ECKeyParameters key; private SecureRandom random; diff --git a/crypto/src/crypto/signers/ECNRSigner.cs b/crypto/src/crypto/signers/ECNRSigner.cs index bc193e797..b22d7a977 100644 --- a/crypto/src/crypto/signers/ECNRSigner.cs +++ b/crypto/src/crypto/signers/ECNRSigner.cs @@ -13,7 +13,7 @@ namespace Org.BouncyCastle.Crypto.Signers * EC-NR as described in IEEE 1363-2000 */ public class ECNRSigner - : IDsaExt + : IDsa { private bool forSigning; private ECKeyParameters key; diff --git a/crypto/src/crypto/signers/GOST3410DigestSigner.cs b/crypto/src/crypto/signers/GOST3410DigestSigner.cs index 81a5ff1cc..17a7b659b 100644 --- a/crypto/src/crypto/signers/GOST3410DigestSigner.cs +++ b/crypto/src/crypto/signers/GOST3410DigestSigner.cs @@ -15,8 +15,6 @@ namespace Org.BouncyCastle.Crypto.Signers private int halfSize; private bool forSigning; - - public Gost3410DigestSigner( IDsa signer, IDigest digest) diff --git a/crypto/src/crypto/signers/GOST3410Signer.cs b/crypto/src/crypto/signers/GOST3410Signer.cs index bcc1125b1..a0d8f8a1f 100644 --- a/crypto/src/crypto/signers/GOST3410Signer.cs +++ b/crypto/src/crypto/signers/GOST3410Signer.cs @@ -11,7 +11,7 @@ namespace Org.BouncyCastle.Crypto.Signers * Gost R 34.10-94 Signature Algorithm */ public class Gost3410Signer - : IDsaExt + : IDsa { private Gost3410KeyParameters key; private SecureRandom random; -- cgit 1.5.1