From 515f53364796324fc2b024e1ccab9b5adc4bcd7b Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 12 Jan 2023 18:15:17 +0700 Subject: Improvements to EdDSA use cases - see https://github.com/bcgit/bc-csharp/issues/406 --- crypto/src/cms/CMSSignedDataStreamGenerator.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'crypto/src/cms') diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index 33b661761..48abfbfa2 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -102,18 +102,18 @@ namespace Org.BouncyCastle.Cms if (_sAttr != null) { - _sig = Helper.GetSignatureInstance(signatureName); - } - else + _sig = SignerUtilities.InitSigner(signatureName, true, key, outer.m_random); + } + else { // Note: Need to use raw signatures here since we have already calculated the digest if (_encName.Equals("RSA")) { - _sig = Helper.GetSignatureInstance("RSA"); - } - else if (_encName.Equals("DSA")) + _sig = SignerUtilities.InitSigner("RSA", true, key, outer.m_random); + } + else if (_encName.Equals("DSA")) { - _sig = Helper.GetSignatureInstance("NONEwithDSA"); + _sig = SignerUtilities.InitSigner("NONEwithDSA", true, key, outer.m_random); } // TODO Add support for raw PSS // else if (_encName.equals("RSAandMGF1")) @@ -135,10 +135,8 @@ namespace Org.BouncyCastle.Cms { throw new SignatureException("algorithm: " + _encName + " not supported in base signatures."); } - } - - _sig.Init(true, new ParametersWithRandom(key, outer.m_random)); - } + } + } public SignerInfo Generate(DerObjectIdentifier contentType, AlgorithmIdentifier digestAlgorithm, byte[] calculatedDigest) -- cgit 1.4.1