summary refs log tree commit diff
path: root/crypto/src/asn1/Asn1InputStream.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/Asn1InputStream.cs')
-rw-r--r--crypto/src/asn1/Asn1InputStream.cs16
1 files changed, 3 insertions, 13 deletions
diff --git a/crypto/src/asn1/Asn1InputStream.cs b/crypto/src/asn1/Asn1InputStream.cs
index 6e097e86d..3f7a65cc9 100644
--- a/crypto/src/asn1/Asn1InputStream.cs
+++ b/crypto/src/asn1/Asn1InputStream.cs
@@ -107,23 +107,13 @@ namespace Org.BouncyCastle.Asn1
         {
             if (!constructed)
             {
-                // Note: !CONSTRUCTED => IMPLICIT
                 byte[] contentsOctets = defIn.ToArray();
-
-                if (Asn1Tags.Application == tagClass)
-                    return new DerApplicationSpecific(false, tagNo, contentsOctets);
-
-                return new DLTaggedObject(false, tagNo, new DerOctetString(contentsOctets));
+                return Asn1TaggedObject.CreatePrimitive(tagClass, tagNo, contentsOctets);
             }
 
+            bool isIL = false;
             Asn1EncodableVector contentsElements = ReadVector(defIn);
-
-            if (Asn1Tags.Application == tagClass)
-                return new DerApplicationSpecific(tagNo, contentsElements);
-
-            return contentsElements.Count == 1
-                ? new DLTaggedObject(true, tagNo, contentsElements[0])
-                : new DLTaggedObject(false, tagNo, DLSequence.FromVector(contentsElements));
+            return Asn1TaggedObject.CreateConstructed(tagClass, tagNo, isIL, contentsElements);
         }
 
         internal virtual Asn1EncodableVector ReadVector()