summary refs log tree commit diff
path: root/crypto/src/asn1/cmp/PKIMessage.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cmp/PKIMessage.cs')
-rw-r--r--crypto/src/asn1/cmp/PKIMessage.cs14
1 files changed, 2 insertions, 12 deletions
diff --git a/crypto/src/asn1/cmp/PKIMessage.cs b/crypto/src/asn1/cmp/PKIMessage.cs
index 086a2d938..c87bf2126 100644
--- a/crypto/src/asn1/cmp/PKIMessage.cs
+++ b/crypto/src/asn1/cmp/PKIMessage.cs
@@ -122,19 +122,9 @@ namespace Org.BouncyCastle.Asn1.Cmp
         public override Asn1Object ToAsn1Object()
         {
             Asn1EncodableVector v = new Asn1EncodableVector(header, body);
-
-            AddOptional(v, 0, protection);
-            AddOptional(v, 1, extraCerts);
-
+            v.AddOptionalTagged(true, 0, protection);
+            v.AddOptionalTagged(true, 1, extraCerts);
             return new DerSequence(v);
         }
-
-        private static void AddOptional(Asn1EncodableVector v, int tagNo, Asn1Encodable obj)
-        {
-            if (obj != null)
-            {
-                v.Add(new DerTaggedObject(true, tagNo, obj));
-            }
-        }
     }
 }