summary refs log tree commit diff
path: root/crypto/src/asn1/crmf/PopoSigningKey.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/crmf/PopoSigningKey.cs')
-rw-r--r--crypto/src/asn1/crmf/PopoSigningKey.cs18
1 files changed, 7 insertions, 11 deletions
diff --git a/crypto/src/asn1/crmf/PopoSigningKey.cs b/crypto/src/asn1/crmf/PopoSigningKey.cs
index caa226b56..c4b0594f7 100644
--- a/crypto/src/asn1/crmf/PopoSigningKey.cs
+++ b/crypto/src/asn1/crmf/PopoSigningKey.cs
@@ -20,10 +20,8 @@ namespace Org.BouncyCastle.Asn1.Crmf
             {
                 index++;
 
-                if (tagObj.TagNo != 0)
-                    throw new ArgumentException( "Unknown PopoSigningKeyInput tag: " + tagObj.TagNo, nameof(seq));
-
-                poposkInput = PopoSigningKeyInput.GetInstance(tagObj.GetObject());
+                poposkInput = PopoSigningKeyInput.GetInstance(
+                    Asn1Utilities.GetContextBaseUniversal(tagObj, 0, false, Asn1Tags.Sequence));
             }
             algorithmIdentifier = AlgorithmIdentifier.GetInstance(seq[index++]);
             signature = DerBitString.GetInstance(seq[index]);
@@ -31,13 +29,11 @@ namespace Org.BouncyCastle.Asn1.Crmf
 
         public static PopoSigningKey GetInstance(object obj)
         {
-            if (obj is PopoSigningKey)
-                return (PopoSigningKey)obj;
-
-            if (obj is Asn1Sequence)
-                return new PopoSigningKey((Asn1Sequence)obj);
-
-            throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
+            if (obj == null)
+                return null;
+            if (obj is PopoSigningKey popoSigningKey)
+                return popoSigningKey;
+            return new PopoSigningKey(Asn1Sequence.GetInstance(obj));
         }
 
         public static PopoSigningKey GetInstance(Asn1TaggedObject obj, bool isExplicit)