summary refs log tree commit diff
path: root/crypto/src/asn1/cmp/RootCaKeyUpdateContent.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-07-21 00:26:34 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-07-21 00:26:34 +0700
commit9f36987f992075b2f61214f6d83433efd597e93e (patch)
tree4cc2e19d8dc1229479acbcdf2bb62811b0344785 /crypto/src/asn1/cmp/RootCaKeyUpdateContent.cs
parentRefactoring in Asn1.Cms (diff)
downloadBouncyCastle.NET-ed25519-9f36987f992075b2f61214f6d83433efd597e93e.tar.xz
Refactoring in Asn1.Cmp
Diffstat (limited to 'crypto/src/asn1/cmp/RootCaKeyUpdateContent.cs')
-rw-r--r--crypto/src/asn1/cmp/RootCaKeyUpdateContent.cs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/src/asn1/cmp/RootCaKeyUpdateContent.cs b/crypto/src/asn1/cmp/RootCaKeyUpdateContent.cs
index 64da80d6c..f00090f23 100644
--- a/crypto/src/asn1/cmp/RootCaKeyUpdateContent.cs
+++ b/crypto/src/asn1/cmp/RootCaKeyUpdateContent.cs
@@ -31,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.Cmp
 
         public static RootCaKeyUpdateContent GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
         {
-            return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
+            return new RootCaKeyUpdateContent(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
         }
 
         private readonly CmpCertificate m_newWithNew;
@@ -40,10 +40,7 @@ namespace Org.BouncyCastle.Asn1.Cmp
 
         public RootCaKeyUpdateContent(CmpCertificate newWithNew, CmpCertificate newWithOld, CmpCertificate oldWithNew)
         {
-            if (newWithNew == null)
-                throw new ArgumentNullException(nameof(newWithNew));
-
-            m_newWithNew = newWithNew;
+            m_newWithNew = newWithNew ?? throw new ArgumentNullException(nameof(newWithNew));
             m_newWithOld = newWithOld;
             m_oldWithNew = oldWithNew;
         }
@@ -84,7 +81,8 @@ namespace Org.BouncyCastle.Asn1.Cmp
 
         public override Asn1Object ToAsn1Object()
         {
-            Asn1EncodableVector v = new Asn1EncodableVector(m_newWithNew);
+            Asn1EncodableVector v = new Asn1EncodableVector(3);
+            v.Add(m_newWithNew);
             v.AddOptionalTagged(true, 0, m_newWithOld);
             v.AddOptionalTagged(true, 1, m_oldWithNew);
             return new DerSequence(v);