summary refs log tree commit diff
path: root/crypto/src/cms/CMSSignedData.cs
diff options
context:
space:
mode:
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++)
 			{