summary refs log tree commit diff
path: root/crypto/src/asn1/crmf/PopoSigningKeyInput.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/crmf/PopoSigningKeyInput.cs')
-rw-r--r--crypto/src/asn1/crmf/PopoSigningKeyInput.cs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crypto/src/asn1/crmf/PopoSigningKeyInput.cs b/crypto/src/asn1/crmf/PopoSigningKeyInput.cs
index f2517aa57..2853e9486 100644
--- a/crypto/src/asn1/crmf/PopoSigningKeyInput.cs
+++ b/crypto/src/asn1/crmf/PopoSigningKeyInput.cs
@@ -18,10 +18,7 @@ namespace Org.BouncyCastle.Asn1.Crmf
 
             if (authInfo is Asn1TaggedObject tagObj)
             {
-                if (tagObj.TagNo != 0)
-                    throw new ArgumentException("Unknown authInfo tag: " + tagObj.TagNo, nameof(seq));
-
-                sender = GeneralName.GetInstance(tagObj.GetObject());
+                sender = GeneralName.GetInstance(Asn1Utilities.GetExplicitContextBaseObject(tagObj, 0));
             }
             else
             {
@@ -33,13 +30,16 @@ namespace Org.BouncyCastle.Asn1.Crmf
 
         public static PopoSigningKeyInput GetInstance(object obj)
         {
-            if (obj is PopoSigningKeyInput)
-                return (PopoSigningKeyInput)obj;
-
-            if (obj is Asn1Sequence)
-                return new PopoSigningKeyInput((Asn1Sequence)obj);
+            if (obj == null)
+                return null;
+            if (obj is PopoSigningKeyInput popoSigningKeyInput)
+                return popoSigningKeyInput;
+            return new PopoSigningKeyInput(Asn1Sequence.GetInstance(obj));
+        }
 
-            throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
+        public static PopoSigningKeyInput GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+            return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
         }
 
         /** Creates a new PopoSigningKeyInput with sender name as authInfo. */