summary refs log tree commit diff
path: root/crypto/src/asn1/DERExternal.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/DERExternal.cs')
-rw-r--r--crypto/src/asn1/DERExternal.cs8
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/src/asn1/DERExternal.cs b/crypto/src/asn1/DERExternal.cs
index 8cb7d040b..cfe0ae701 100644
--- a/crypto/src/asn1/DERExternal.cs
+++ b/crypto/src/asn1/DERExternal.cs
@@ -251,11 +251,9 @@ namespace Org.BouncyCastle.Asn1
 
         private static Asn1Object GetExternalContent(Asn1TaggedObject encoding)
         {
-            int tagClass = encoding.TagClass, tagNo = encoding.TagNo;
-            if (Asn1Tags.ContextSpecific != tagClass)
-                throw new ArgumentException("invalid tag: " + Asn1Utilities.GetTagText(tagClass, tagNo), "encoding");
+            Asn1Utilities.CheckContextTag(encoding);
 
-            switch (tagNo)
+            switch (encoding.TagNo)
             {
             case 0:
                 return encoding.GetExplicitBaseObject().ToAsn1Object();
@@ -264,7 +262,7 @@ namespace Org.BouncyCastle.Asn1
             case 2:
                 return DerBitString.GetInstance(encoding, false);
             default:
-                throw new ArgumentException("invalid tag: " + Asn1Utilities.GetTagText(tagClass, tagNo), "encoding");
+                throw new ArgumentException("invalid tag: " + Asn1Utilities.GetTagText(encoding), nameof(encoding));
             }
         }