diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-24 21:09:53 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-24 21:09:53 +0700 |
commit | 9e6bf00421507c0d9fd2eb634fe877198b732b22 (patch) | |
tree | bd694bf5c81812a3e9bc572fe704aea377ae4df3 /crypto | |
parent | Cleanup in tests (diff) | |
download | BouncyCastle.NET-ed25519-9e6bf00421507c0d9fd2eb634fe877198b732b22.tar.xz |
Replace Dump program with static utility method
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/asn1/util/Asn1Dump.cs | 11 | ||||
-rw-r--r-- | crypto/src/asn1/util/Dump.cs | 30 |
2 files changed, 11 insertions, 30 deletions
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 } } + /// <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) + { + 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 |