summary refs log tree commit diff
path: root/crypto/src/asn1/x509/X509Extensions.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-12-19 19:58:48 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-12-19 19:58:48 +0700
commit6fb989bac0f41e33fe4ce0eef3cf5320d5abbd04 (patch)
treea69393c5b85c5dba7d466246d24380ddb8df7082 /crypto/src/asn1/x509/X509Extensions.cs
parentMicrosoft.SourceLink.GitHub 8.0.0 (diff)
downloadBouncyCastle.NET-ed25519-6fb989bac0f41e33fe4ce0eef3cf5320d5abbd04.tar.xz
Refactoring around Asn1TaggedObject
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));
         }
 
         /**