summary refs log tree commit diff
path: root/crypto/src/asn1/util
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-03-05 14:45:49 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-03-05 14:45:49 +0700
commit6b59dbbece3b1509b83b8479259a3c6059e9a60b (patch)
tree3dca66ea9a1e8aa02ac6099cde5844155783bd7b /crypto/src/asn1/util
parentRefactor Asn1Set classes (diff)
downloadBouncyCastle.NET-ed25519-6b59dbbece3b1509b83b8479259a3c6059e9a60b.tar.xz
Support 'leaveOpen' in Asn1 streams
Diffstat (limited to 'crypto/src/asn1/util')
-rw-r--r--crypto/src/asn1/util/Asn1Dump.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/src/asn1/util/Asn1Dump.cs b/crypto/src/asn1/util/Asn1Dump.cs
index 3a19f1276..67fbba979 100644
--- a/crypto/src/asn1/util/Asn1Dump.cs
+++ b/crypto/src/asn1/util/Asn1Dump.cs
@@ -256,11 +256,13 @@ namespace Org.BouncyCastle.Asn1.Utilities
         /// <summary>Parse ASN.1 objects from input <see cref="Stream"/>, and write them to the output.</summary>
         public static void Dump(Stream input, TextWriter output)
         {
-            Asn1InputStream asn1InputStream = new Asn1InputStream(input);
-            Asn1Object asn1Object;
-            while ((asn1Object = asn1InputStream.ReadObject()) != null)
+            using (var asn1In = new Asn1InputStream(input, int.MaxValue, leaveOpen: true))
             {
-                output.Write(DumpAsString(asn1Object));
+                Asn1Object asn1Object;
+                while ((asn1Object = asn1In.ReadObject()) != null)
+                {
+                    output.Write(DumpAsString(asn1Object));
+                }
             }
         }