summary refs log tree commit diff
path: root/crypto/src/asn1/LazyASN1InputStream.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/LazyASN1InputStream.cs')
-rw-r--r--crypto/src/asn1/LazyASN1InputStream.cs19
1 files changed, 16 insertions, 3 deletions
diff --git a/crypto/src/asn1/LazyASN1InputStream.cs b/crypto/src/asn1/LazyASN1InputStream.cs
index 8dfbba122..8807416f4 100644
--- a/crypto/src/asn1/LazyASN1InputStream.cs
+++ b/crypto/src/asn1/LazyASN1InputStream.cs
@@ -16,8 +16,18 @@ namespace Org.BouncyCastle.Asn1
         {
         }
 
-        internal LazyAsn1InputStream(Stream input, int limit, byte[][] tmpBuffers)
-            : base(input, limit, tmpBuffers)
+        public LazyAsn1InputStream(Stream input, int limit)
+            : base(input, limit)
+        {
+        }
+
+        public LazyAsn1InputStream(Stream input, int limit, bool leaveOpen)
+            : base(input, limit, leaveOpen)
+        {
+        }
+
+        internal LazyAsn1InputStream(Stream input, int limit, bool leaveOpen, byte[][] tmpBuffers)
+            : base(input, limit, leaveOpen, tmpBuffers)
         {
         }
 
@@ -37,7 +47,10 @@ namespace Org.BouncyCastle.Asn1
             if (remaining < 1)
                 return new Asn1EncodableVector(0);
 
-            return new LazyAsn1InputStream(defIn, remaining, tmpBuffers).ReadVector();
+            using (var sub = new LazyAsn1InputStream(defIn, remaining, leaveOpen: true, tmpBuffers))
+            {
+                return sub.ReadVector();
+            }
         }
     }
 }