diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-11-17 10:09:10 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-11-17 10:09:10 +0700 |
commit | ae66e668da98ed3ceac7fa28bb2e9f92a220e595 (patch) | |
tree | d207ea604246fe78526ffb88fc0f959eab6bd0c9 /crypto/src/util/io/BinaryReaders.cs | |
parent | Improvements to OaepEncoding (diff) | |
download | BouncyCastle.NET-ed25519-ae66e668da98ed3ceac7fa28bb2e9f92a220e595.tar.xz |
Refactor LMS parsing
Diffstat (limited to 'crypto/src/util/io/BinaryReaders.cs')
-rw-r--r-- | crypto/src/util/io/BinaryReaders.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/src/util/io/BinaryReaders.cs b/crypto/src/util/io/BinaryReaders.cs index c5f99a712..ed4b57d0a 100644 --- a/crypto/src/util/io/BinaryReaders.cs +++ b/crypto/src/util/io/BinaryReaders.cs @@ -1,10 +1,19 @@ using System; using System.IO; +using System.Text; namespace Org.BouncyCastle.Utilities.IO { public static class BinaryReaders { + internal static T Parse<T>(Func<BinaryReader, T> parse, Stream stream, bool leaveOpen) + { + using (var binaryReader = new BinaryReader(stream, Encoding.UTF8, leaveOpen)) + { + return parse(binaryReader); + } + } + public static byte[] ReadBytesFully(BinaryReader binaryReader, int count) { byte[] bytes = binaryReader.ReadBytes(count); |