From 9e6bf00421507c0d9fd2eb634fe877198b732b22 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 24 Jun 2022 21:09:53 +0700 Subject: Replace Dump program with static utility method --- crypto/src/asn1/util/Asn1Dump.cs | 11 +++++++++++ crypto/src/asn1/util/Dump.cs | 30 ------------------------------ 2 files changed, 11 insertions(+), 30 deletions(-) delete mode 100644 crypto/src/asn1/util/Dump.cs diff --git a/crypto/src/asn1/util/Asn1Dump.cs b/crypto/src/asn1/util/Asn1Dump.cs index 406511a72..64d88c373 100644 --- a/crypto/src/asn1/util/Asn1Dump.cs +++ b/crypto/src/asn1/util/Asn1Dump.cs @@ -243,6 +243,17 @@ namespace Org.BouncyCastle.Asn1.Utilities } } + /// Parse ASN.1 objects from input , and write them to the output. + public static void Dump(Stream input, TextWriter output) + { + Asn1InputStream asn1InputStream = new Asn1InputStream(input); + Asn1Object asn1Object; + while ((asn1Object = asn1InputStream.ReadObject()) != null) + { + output.Write(DumpAsString(asn1Object)); + } + } + /** * dump out a DER object as a formatted string, in non-verbose mode * diff --git a/crypto/src/asn1/util/Dump.cs b/crypto/src/asn1/util/Dump.cs deleted file mode 100644 index e313fe879..000000000 --- a/crypto/src/asn1/util/Dump.cs +++ /dev/null @@ -1,30 +0,0 @@ -#if !PORTABLE -using System; -using System.IO; - -using Org.BouncyCastle.Utilities; - -namespace Org.BouncyCastle.Asn1.Utilities -{ - public sealed class Dump - { - private Dump() - { - } - - public static void Main(string[] args) - { - FileStream fIn = File.OpenRead(args[0]); - Asn1InputStream bIn = new Asn1InputStream(fIn); - - Asn1Object obj; - while ((obj = bIn.ReadObject()) != null) - { - Console.WriteLine(Asn1Dump.DumpAsString(obj)); - } - - Platform.Dispose(bIn); - } - } -} -#endif -- cgit 1.4.1