summary refs log tree commit diff
path: root/crypto/src/asn1/cmp/CertConfirmContent.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-02-01 21:07:46 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-02-01 21:07:46 +0700
commitdb9b19e3f17a2aee8afcd673ef9327bb8646b87a (patch)
treea16cf94d902be26f7f00a5218cafa15fe28cf233 /crypto/src/asn1/cmp/CertConfirmContent.cs
parentAdd GetInstanceFromChoice helper (diff)
downloadBouncyCastle.NET-ed25519-db9b19e3f17a2aee8afcd673ef9327bb8646b87a.tar.xz
Overhaul Asn1.Cmp
Diffstat (limited to '')
-rw-r--r--crypto/src/asn1/cmp/CertConfirmContent.cs27
1 files changed, 13 insertions, 14 deletions
diff --git a/crypto/src/asn1/cmp/CertConfirmContent.cs b/crypto/src/asn1/cmp/CertConfirmContent.cs
index 8e75dfbd0..e11826d6b 100644
--- a/crypto/src/asn1/cmp/CertConfirmContent.cs
+++ b/crypto/src/asn1/cmp/CertConfirmContent.cs
@@ -1,22 +1,21 @@
-using System;
-
-using Org.BouncyCastle.Utilities;
-
 namespace Org.BouncyCastle.Asn1.Cmp
 {
-	public class CertConfirmContent
+    public class CertConfirmContent
 		: Asn1Encodable
 	{
-		public static CertConfirmContent GetInstance(object obj)
-		{
-			if (obj is CertConfirmContent content)
-				return content;
-
-			if (obj is Asn1Sequence seq)
-				return new CertConfirmContent(seq);
+        public static CertConfirmContent GetInstance(object obj)
+        {
+            if (obj == null)
+                return null;
+            if (obj is CertConfirmContent certConfirmContent)
+                return certConfirmContent;
+            return new CertConfirmContent(Asn1Sequence.GetInstance(obj));
+        }
 
-            throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), nameof(obj));
-		}
+        public static CertConfirmContent GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+            return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
+        }
 
         private readonly Asn1Sequence m_content;