summary refs log tree commit diff
path: root/crypto/src/cms/CMSSignedData.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-02-17 17:58:20 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-02-17 17:58:20 +0700
commite3d12a2c33a7a9d0f371e1d5ff07f7ab7a3eb7ae (patch)
treea0a855afdfbfe6a4cc8a5b026f9b815ee7147d4b /crypto/src/cms/CMSSignedData.cs
parentRefactoring in Cms (diff)
downloadBouncyCastle.NET-ed25519-e3d12a2c33a7a9d0f371e1d5ff07f7ab7a3eb7ae.tar.xz
Refactoring around Asn1EncodableVector
Diffstat (limited to 'crypto/src/cms/CMSSignedData.cs')
-rw-r--r--crypto/src/cms/CMSSignedData.cs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/src/cms/CMSSignedData.cs b/crypto/src/cms/CMSSignedData.cs
index 10278784e..5a73df4f1 100644
--- a/crypto/src/cms/CMSSignedData.cs
+++ b/crypto/src/cms/CMSSignedData.cs
@@ -276,10 +276,10 @@ namespace Org.BouncyCastle.Cms
 			//
 			// replace the signers in the SignedData object
 			//
-			Asn1EncodableVector digestAlgs = new Asn1EncodableVector();
-			Asn1EncodableVector vec = new Asn1EncodableVector();
-
-			foreach (SignerInformation signer in signerInformationStore.GetSigners())
+			var storeSigners = signerInformationStore.GetSigners();
+            Asn1EncodableVector digestAlgs = new Asn1EncodableVector(storeSigners.Count);
+            Asn1EncodableVector vec = new Asn1EncodableVector(storeSigners.Count);
+            foreach (SignerInformation signer in storeSigners)
 			{
 				digestAlgs.Add(Helper.FixAlgID(signer.DigestAlgorithmID));
 				vec.Add(signer.ToSignerInfo());
@@ -292,9 +292,9 @@ namespace Org.BouncyCastle.Cms
 			//
 			// signers are the last item in the sequence.
 			//
-			vec = new Asn1EncodableVector(
-				sD[0], // version
-				digests);
+			vec = new Asn1EncodableVector(sD.Count);
+			vec.Add(sD[0]); // version
+			vec.Add(digests);
 
 			for (int i = 2; i != sD.Count - 1; i++)
 			{