summary refs log tree commit diff
path: root/crypto/src/asn1/x509/X509Extensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/x509/X509Extensions.cs')
-rw-r--r--crypto/src/asn1/x509/X509Extensions.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/src/asn1/x509/X509Extensions.cs b/crypto/src/asn1/x509/X509Extensions.cs
index d4497d255..af0655f8e 100644
--- a/crypto/src/asn1/x509/X509Extensions.cs
+++ b/crypto/src/asn1/x509/X509Extensions.cs
@@ -214,14 +214,11 @@ namespace Org.BouncyCastle.Asn1.X509
             if (obj is Asn1Sequence sequence)
                 return new X509Extensions(sequence);
 
+            // TODO[api] Rename this class to just Extensions and drop support for this
             if (obj is Asn1TaggedObject taggedObject)
-            {
-                Asn1Utilities.CheckTagClass(taggedObject, Asn1Tags.ContextSpecific);
-
-                return GetInstance(taggedObject.GetBaseObject().ToAsn1Object());
-            }
+                return GetInstance(Asn1Utilities.CheckContextTag(taggedObject).GetBaseObject().ToAsn1Object());
 
-            throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
+            throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), nameof(obj));
         }
 
         /**