From 74b8406de0eeae6e9a4546505a0d9058e19c48db Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 20 Apr 2022 18:24:53 +0700 Subject: No HMacDsaKCalculator for verification --- crypto/src/tls/crypto/impl/bc/BcTlsDsaVerifier.cs | 4 ++-- crypto/src/tls/crypto/impl/bc/BcTlsDssVerifier.cs | 8 ++------ crypto/src/tls/crypto/impl/bc/BcTlsECDsa13Verifier.cs | 3 +-- crypto/src/tls/crypto/impl/bc/BcTlsECDsaVerifier.cs | 4 ++-- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/crypto/src/tls/crypto/impl/bc/BcTlsDsaVerifier.cs b/crypto/src/tls/crypto/impl/bc/BcTlsDsaVerifier.cs index bc8395ac5..57bbc09cd 100644 --- a/crypto/src/tls/crypto/impl/bc/BcTlsDsaVerifier.cs +++ b/crypto/src/tls/crypto/impl/bc/BcTlsDsaVerifier.cs @@ -16,9 +16,9 @@ namespace Org.BouncyCastle.Tls.Crypto.Impl.BC { } - protected override IDsa CreateDsaImpl(int cryptoHashAlgorithm) + protected override IDsa CreateDsaImpl() { - return new DsaSigner(new HMacDsaKCalculator(m_crypto.CreateDigest(cryptoHashAlgorithm))); + return new DsaSigner(); } protected override short SignatureAlgorithm diff --git a/crypto/src/tls/crypto/impl/bc/BcTlsDssVerifier.cs b/crypto/src/tls/crypto/impl/bc/BcTlsDssVerifier.cs index f2e371067..01f9265cc 100644 --- a/crypto/src/tls/crypto/impl/bc/BcTlsDssVerifier.cs +++ b/crypto/src/tls/crypto/impl/bc/BcTlsDssVerifier.cs @@ -16,7 +16,7 @@ namespace Org.BouncyCastle.Tls.Crypto.Impl.BC { } - protected abstract IDsa CreateDsaImpl(int cryptoHashAlgorithm); + protected abstract IDsa CreateDsaImpl(); protected abstract short SignatureAlgorithm { get; } @@ -26,11 +26,7 @@ namespace Org.BouncyCastle.Tls.Crypto.Impl.BC if (algorithm != null && algorithm.Signature != SignatureAlgorithm) throw new InvalidOperationException("Invalid algorithm: " + algorithm); - int cryptoHashAlgorithm = (null == algorithm) - ? CryptoHashAlgorithm.sha1 - : TlsCryptoUtilities.GetHash(algorithm.Hash); - - ISigner signer = new DsaDigestSigner(CreateDsaImpl(cryptoHashAlgorithm), new NullDigest()); + ISigner signer = new DsaDigestSigner(CreateDsaImpl(), new NullDigest()); signer.Init(false, m_publicKey); if (algorithm == null) { diff --git a/crypto/src/tls/crypto/impl/bc/BcTlsECDsa13Verifier.cs b/crypto/src/tls/crypto/impl/bc/BcTlsECDsa13Verifier.cs index 8488dc8d2..8a45c23ad 100644 --- a/crypto/src/tls/crypto/impl/bc/BcTlsECDsa13Verifier.cs +++ b/crypto/src/tls/crypto/impl/bc/BcTlsECDsa13Verifier.cs @@ -29,8 +29,7 @@ namespace Org.BouncyCastle.Tls.Crypto.Impl.BC if (algorithm == null || SignatureScheme.From(algorithm) != m_signatureScheme) throw new InvalidOperationException("Invalid algorithm: " + algorithm); - int cryptoHashAlgorithm = SignatureScheme.GetCryptoHashAlgorithm(m_signatureScheme); - IDsa dsa = new ECDsaSigner(new HMacDsaKCalculator(m_crypto.CreateDigest(cryptoHashAlgorithm))); + IDsa dsa = new ECDsaSigner(); ISigner signer = new DsaDigestSigner(dsa, new NullDigest()); signer.Init(false, m_publicKey); diff --git a/crypto/src/tls/crypto/impl/bc/BcTlsECDsaVerifier.cs b/crypto/src/tls/crypto/impl/bc/BcTlsECDsaVerifier.cs index 1cd6ff1ea..4d6f893d7 100644 --- a/crypto/src/tls/crypto/impl/bc/BcTlsECDsaVerifier.cs +++ b/crypto/src/tls/crypto/impl/bc/BcTlsECDsaVerifier.cs @@ -16,9 +16,9 @@ namespace Org.BouncyCastle.Tls.Crypto.Impl.BC { } - protected override IDsa CreateDsaImpl(int cryptoHashAlgorithm) + protected override IDsa CreateDsaImpl() { - return new ECDsaSigner(new HMacDsaKCalculator(m_crypto.CreateDigest(cryptoHashAlgorithm))); + return new ECDsaSigner(); } protected override short SignatureAlgorithm -- cgit 1.4.1