diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-09 16:58:56 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-11-09 16:58:56 +0700 |
commit | 2db852aaef49cf79e953e16f088e2190aef641f1 (patch) | |
tree | 3ef973b7b16ac2d7615a744b408e5d2e75e18d2b /crypto/src/cms/SignerInformation.cs | |
parent | Remove NET7_0 directive for now (diff) | |
download | BouncyCastle.NET-ed25519-2db852aaef49cf79e953e16f088e2190aef641f1.tar.xz |
Simplify digest calculation
Diffstat (limited to '')
-rw-r--r-- | crypto/src/cms/SignerInformation.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crypto/src/cms/SignerInformation.cs b/crypto/src/cms/SignerInformation.cs index 6454e6d3d..bb74c86cc 100644 --- a/crypto/src/cms/SignerInformation.cs +++ b/crypto/src/cms/SignerInformation.cs @@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Cms SignerInfo info, DerObjectIdentifier contentType, CmsProcessable content, - IDigestCalculator digestCalculator) + byte[] calculatedDigest) { this.info = info; this.sid = new SignerID(); @@ -83,8 +83,9 @@ namespace Org.BouncyCastle.Cms this.signature = (byte[])info.EncryptedDigest.GetOctets().Clone(); this.content = content; - this.calculatedDigest = (digestCalculator != null) ? digestCalculator.GetDigest() : null; - } + this.calculatedDigest = calculatedDigest; + + } /** * Protected constructor. In some cases clients have their own idea about how to encode @@ -300,8 +301,10 @@ namespace Org.BouncyCastle.Cms SignerInfo si = SignerInfo.GetInstance(asn1Obj.ToAsn1Object()); string digestName = CmsSignedHelper.Instance.GetDigestAlgName(si.DigestAlgorithm.Algorithm.Id); + IDigest digest = CmsSignedHelper.Instance.GetDigestInstance(digestName); + byte[] hash = DigestUtilities.DoFinal(digest, GetSignature()); - counterSignatures.Add(new SignerInformation(si, null, null, new CounterSignatureDigestCalculator(digestName, GetSignature()))); + counterSignatures.Add(new SignerInformation(si, null, null, hash)); } } |