summary refs log tree commit diff
path: root/crypto/src/asn1/cmp
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/asn1/cmp
parentRefactoring in Cms (diff)
downloadBouncyCastle.NET-ed25519-e3d12a2c33a7a9d0f371e1d5ff07f7ab7a3eb7ae.tar.xz
Refactoring around Asn1EncodableVector
Diffstat (limited to 'crypto/src/asn1/cmp')
-rw-r--r--crypto/src/asn1/cmp/Challenge.cs2
-rw-r--r--crypto/src/asn1/cmp/PKIHeaderBuilder.cs22
-rw-r--r--crypto/src/asn1/cmp/RevRepContentBuilder.cs2
3 files changed, 7 insertions, 19 deletions
diff --git a/crypto/src/asn1/cmp/Challenge.cs b/crypto/src/asn1/cmp/Challenge.cs
index 21958da67..b86c3d800 100644
--- a/crypto/src/asn1/cmp/Challenge.cs
+++ b/crypto/src/asn1/cmp/Challenge.cs
@@ -111,7 +111,7 @@ namespace Org.BouncyCastle.Asn1.Cmp
 		 */
         public override Asn1Object ToAsn1Object()
 		{
-			Asn1EncodableVector v = new Asn1EncodableVector();
+			Asn1EncodableVector v = new Asn1EncodableVector(2);
 			v.AddOptional(m_owf);
 			v.Add(m_witness, m_challenge);
 			return new DerSequence(v);
diff --git a/crypto/src/asn1/cmp/PKIHeaderBuilder.cs b/crypto/src/asn1/cmp/PKIHeaderBuilder.cs
index ab8db958a..6c7a2db63 100644
--- a/crypto/src/asn1/cmp/PKIHeaderBuilder.cs
+++ b/crypto/src/asn1/cmp/PKIHeaderBuilder.cs
@@ -126,26 +126,14 @@ namespace Org.BouncyCastle.Asn1.Cmp
 			return this;
 		}
 
-		private static Asn1Sequence MakeGeneralInfoSeq(
-			InfoTypeAndValue generalInfo)
+		private static Asn1Sequence MakeGeneralInfoSeq(InfoTypeAndValue generalInfo)
 		{
 			return new DerSequence(generalInfo);
 		}
-		
-		private static Asn1Sequence MakeGeneralInfoSeq(
-			InfoTypeAndValue[] generalInfos)
-		{
-			Asn1Sequence genInfoSeq = null;
-			if (generalInfos != null)
-			{
-				Asn1EncodableVector v = new Asn1EncodableVector();
-				for (int i = 0; i < generalInfos.Length; ++i)
-				{
-					v.Add(generalInfos[i]);
-				}
-				genInfoSeq = new DerSequence(v);
-			}
-			return genInfoSeq;
+
+		private static Asn1Sequence MakeGeneralInfoSeq(InfoTypeAndValue[] generalInfos)
+		{
+			return generalInfos == null ? null : new DerSequence(generalInfos);
 		}
 
 		/**
diff --git a/crypto/src/asn1/cmp/RevRepContentBuilder.cs b/crypto/src/asn1/cmp/RevRepContentBuilder.cs
index f23bed8b5..4ff85483e 100644
--- a/crypto/src/asn1/cmp/RevRepContentBuilder.cs
+++ b/crypto/src/asn1/cmp/RevRepContentBuilder.cs
@@ -35,7 +35,7 @@ namespace Org.BouncyCastle.Asn1.Cmp
 
 		public virtual RevRepContent Build()
 		{
-			Asn1EncodableVector v = new Asn1EncodableVector();
+			Asn1EncodableVector v = new Asn1EncodableVector(3);
 
 			v.Add(new DerSequence(m_status));