summary refs log tree commit diff
path: root/crypto/src/asn1/x509
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/x509
parentRefactoring in Cms (diff)
downloadBouncyCastle.NET-ed25519-e3d12a2c33a7a9d0f371e1d5ff07f7ab7a3eb7ae.tar.xz
Refactoring around Asn1EncodableVector
Diffstat (limited to 'crypto/src/asn1/x509')
-rw-r--r--crypto/src/asn1/x509/AuthorityKeyIdentifier.cs2
-rw-r--r--crypto/src/asn1/x509/CertificatePair.cs2
-rw-r--r--crypto/src/asn1/x509/IetfAttrSyntax.cs2
-rw-r--r--crypto/src/asn1/x509/IssuingDistributionPoint.cs2
-rw-r--r--crypto/src/asn1/x509/NoticeReference.cs2
-rw-r--r--crypto/src/asn1/x509/PolicyMappings.cs2
-rw-r--r--crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs2
-rw-r--r--crypto/src/asn1/x509/RoleSyntax.cs2
-rw-r--r--crypto/src/asn1/x509/TBSCertificateStructure.cs2
-rw-r--r--crypto/src/asn1/x509/UserNotice.cs2
-rw-r--r--crypto/src/asn1/x509/V2Form.cs2
-rw-r--r--crypto/src/asn1/x509/qualified/SemanticsInformation.cs2
12 files changed, 12 insertions, 12 deletions
diff --git a/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs b/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
index 64cfce214..810fda82e 100644
--- a/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
+++ b/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
@@ -166,7 +166,7 @@ namespace Org.BouncyCastle.Asn1.X509
          */
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(3);
             v.AddOptionalTagged(false, 0, keyidentifier);
             v.AddOptionalTagged(false, 1, certissuer);
             v.AddOptionalTagged(false, 2, certserno);
diff --git a/crypto/src/asn1/x509/CertificatePair.cs b/crypto/src/asn1/x509/CertificatePair.cs
index 69861e1dc..055144464 100644
--- a/crypto/src/asn1/x509/CertificatePair.cs
+++ b/crypto/src/asn1/x509/CertificatePair.cs
@@ -128,7 +128,7 @@ namespace Org.BouncyCastle.Asn1.X509
 		*/
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(2);
             v.AddOptionalTagged(true, 0, forward);
             v.AddOptionalTagged(true, 1, reverse);
             return new DerSequence(v);
diff --git a/crypto/src/asn1/x509/IetfAttrSyntax.cs b/crypto/src/asn1/x509/IetfAttrSyntax.cs
index 61fe78561..024c8dd68 100644
--- a/crypto/src/asn1/x509/IetfAttrSyntax.cs
+++ b/crypto/src/asn1/x509/IetfAttrSyntax.cs
@@ -143,7 +143,7 @@ namespace Org.BouncyCastle.Asn1.X509
          */
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(2);
             v.AddOptionalTagged(true, 0, policyAuthority);
             v.Add(new DerSequence(values));
             return new DerSequence(v);
diff --git a/crypto/src/asn1/x509/IssuingDistributionPoint.cs b/crypto/src/asn1/x509/IssuingDistributionPoint.cs
index 0287fd8f5..8ae4cafa0 100644
--- a/crypto/src/asn1/x509/IssuingDistributionPoint.cs
+++ b/crypto/src/asn1/x509/IssuingDistributionPoint.cs
@@ -70,7 +70,7 @@ namespace Org.BouncyCastle.Asn1.X509
 			this._onlyContainsUserCerts = onlyContainsUserCerts;
 			this._onlySomeReasons = onlySomeReasons;
 
-			Asn1EncodableVector vec = new Asn1EncodableVector();
+			Asn1EncodableVector vec = new Asn1EncodableVector(6);
 			if (distributionPoint != null)
 			{	// CHOICE item so explicitly tagged
 				vec.Add(new DerTaggedObject(true, 0, distributionPoint));
diff --git a/crypto/src/asn1/x509/NoticeReference.cs b/crypto/src/asn1/x509/NoticeReference.cs
index 98a64ec55..2fb275d8f 100644
--- a/crypto/src/asn1/x509/NoticeReference.cs
+++ b/crypto/src/asn1/x509/NoticeReference.cs
@@ -28,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
         private static Asn1EncodableVector ConvertVector(IList<object> numbers)
         {
-            Asn1EncodableVector av = new Asn1EncodableVector();
+            Asn1EncodableVector av = new Asn1EncodableVector(numbers.Count);
 
             foreach (object o in numbers)
             {
diff --git a/crypto/src/asn1/x509/PolicyMappings.cs b/crypto/src/asn1/x509/PolicyMappings.cs
index a077f2059..01a6ae88f 100644
--- a/crypto/src/asn1/x509/PolicyMappings.cs
+++ b/crypto/src/asn1/x509/PolicyMappings.cs
@@ -38,7 +38,7 @@ namespace Org.BouncyCastle.Asn1.X509
 		 */
 		public PolicyMappings(IDictionary<string, string> mappings)
 		{
-			Asn1EncodableVector v = new Asn1EncodableVector();
+			Asn1EncodableVector v = new Asn1EncodableVector(mappings.Count);
 
 			foreach (var entry in mappings)
 			{
diff --git a/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs b/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs
index a87c2ee9e..2ca1557bc 100644
--- a/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs
+++ b/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs
@@ -66,7 +66,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(2);
             v.AddOptionalTagged(false, 0, _notBefore);
             v.AddOptionalTagged(false, 1, _notAfter);
             return new DerSequence(v);
diff --git a/crypto/src/asn1/x509/RoleSyntax.cs b/crypto/src/asn1/x509/RoleSyntax.cs
index b5b217b6b..163b3d07e 100644
--- a/crypto/src/asn1/x509/RoleSyntax.cs
+++ b/crypto/src/asn1/x509/RoleSyntax.cs
@@ -192,7 +192,7 @@ namespace Org.BouncyCastle.Asn1.X509
 		*/
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(2);
             v.AddOptionalTagged(false, 0, roleAuthority);
             v.Add(new DerTaggedObject(true, 1, roleName));
             return new DerSequence(v);
diff --git a/crypto/src/asn1/x509/TBSCertificateStructure.cs b/crypto/src/asn1/x509/TBSCertificateStructure.cs
index bd08d8bb8..5e3bf2601 100644
--- a/crypto/src/asn1/x509/TBSCertificateStructure.cs
+++ b/crypto/src/asn1/x509/TBSCertificateStructure.cs
@@ -216,7 +216,7 @@ namespace Org.BouncyCastle.Asn1.X509
             if (null == property || Platform.EqualsIgnoreCase("true", property))
                 return seq;
 
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(8);
 
             // DEFAULT Zero
             if (!version.HasValue(0))
diff --git a/crypto/src/asn1/x509/UserNotice.cs b/crypto/src/asn1/x509/UserNotice.cs
index 801ca0ded..c9a5e5309 100644
--- a/crypto/src/asn1/x509/UserNotice.cs
+++ b/crypto/src/asn1/x509/UserNotice.cs
@@ -101,7 +101,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(2);
             v.AddOptional(noticeRef, explicitText);
             return new DerSequence(v);
         }
diff --git a/crypto/src/asn1/x509/V2Form.cs b/crypto/src/asn1/x509/V2Form.cs
index 53475ffbe..ca1b75095 100644
--- a/crypto/src/asn1/x509/V2Form.cs
+++ b/crypto/src/asn1/x509/V2Form.cs
@@ -114,7 +114,7 @@ namespace Org.BouncyCastle.Asn1.X509
          */
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(3);
             v.AddOptional(issuerName);
             v.AddOptionalTagged(false, 0, baseCertificateID);
             v.AddOptionalTagged(false, 1, objectDigestInfo);
diff --git a/crypto/src/asn1/x509/qualified/SemanticsInformation.cs b/crypto/src/asn1/x509/qualified/SemanticsInformation.cs
index 23818e916..1106e10b1 100644
--- a/crypto/src/asn1/x509/qualified/SemanticsInformation.cs
+++ b/crypto/src/asn1/x509/qualified/SemanticsInformation.cs
@@ -104,7 +104,7 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified
 
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector();
+            Asn1EncodableVector v = new Asn1EncodableVector(2);
             v.AddOptional(semanticsIdentifier);
 
             if (null != nameRegistrationAuthorities)