summary refs log tree commit diff
path: root/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs')
-rw-r--r--crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs19
1 files changed, 9 insertions, 10 deletions
diff --git a/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs b/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs
index a3ec5e4df..d39c57bc9 100644
--- a/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs
+++ b/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs
@@ -1,7 +1,3 @@
-using System;
-
-using Org.BouncyCastle.Utilities;
-
 namespace Org.BouncyCastle.Asn1.Cmp
 {
 	public class CAKeyUpdAnnContent
@@ -9,13 +5,16 @@ namespace Org.BouncyCastle.Asn1.Cmp
 	{
         public static CAKeyUpdAnnContent GetInstance(object obj)
         {
-            if (obj is CAKeyUpdAnnContent content)
-                return content;
-
-            if (obj is Asn1Sequence seq)
-                return new CAKeyUpdAnnContent(seq);
+            if (obj == null)
+                return null;
+            if (obj is CAKeyUpdAnnContent caKeyUpdAnnContent)
+                return caKeyUpdAnnContent;
+            return new CAKeyUpdAnnContent(Asn1Sequence.GetInstance(obj));
+        }
 
-            throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), nameof(obj));
+        public static CAKeyUpdAnnContent GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+            return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
         }
 
         private readonly CmpCertificate m_oldWithNew;