summary refs log tree commit diff
path: root/crypto/src/asn1/DerObjectIdentifier.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/DerObjectIdentifier.cs')
-rw-r--r--crypto/src/asn1/DerObjectIdentifier.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/src/asn1/DerObjectIdentifier.cs b/crypto/src/asn1/DerObjectIdentifier.cs
index 835f18d3d..91e427d0b 100644
--- a/crypto/src/asn1/DerObjectIdentifier.cs
+++ b/crypto/src/asn1/DerObjectIdentifier.cs
@@ -65,13 +65,13 @@ namespace Org.BouncyCastle.Asn1
         public static DerObjectIdentifier GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
         {
             /*
-             * TODO[asn1] This block here is for backward compatibility, but should eventually be removed.
+             * TODO[api] This block is for backward compatibility, but should be removed.
              * 
              * - see https://github.com/bcgit/bc-java/issues/1015
              */
-            if (!declaredExplicit && !taggedObject.IsParsed())
+            if (!declaredExplicit && !taggedObject.IsParsed() && Asn1Tags.ContextSpecific == taggedObject.TagClass)
             {
-                Asn1Object baseObject = taggedObject.GetObject();
+                Asn1Object baseObject = taggedObject.GetBaseObject().ToAsn1Object();
                 if (!(baseObject is DerObjectIdentifier))
                     return FromContents(Asn1OctetString.GetInstance(baseObject).GetOctets());
             }