From 2e690b9bb3da422608a86f70fc9090923b398694 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 15 Oct 2021 16:10:37 +0700 Subject: Refactor ASN.1 parsers --- crypto/src/asn1/BERSetParser.cs | 42 +++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'crypto/src/asn1/BERSetParser.cs') diff --git a/crypto/src/asn1/BERSetParser.cs b/crypto/src/asn1/BERSetParser.cs index aa9ccbc12..9da964c61 100644 --- a/crypto/src/asn1/BERSetParser.cs +++ b/crypto/src/asn1/BERSetParser.cs @@ -1,24 +1,30 @@ +using System; + namespace Org.BouncyCastle.Asn1 { - public class BerSetParser - : Asn1SetParser - { - private readonly Asn1StreamParser _parser; + public class BerSetParser + : Asn1SetParser + { + private readonly Asn1StreamParser _parser; + + internal BerSetParser(Asn1StreamParser parser) + { + this._parser = parser; + } - internal BerSetParser( - Asn1StreamParser parser) - { - this._parser = parser; - } + public IAsn1Convertible ReadObject() + { + return _parser.ReadObject(); + } - public IAsn1Convertible ReadObject() - { - return _parser.ReadObject(); - } + public Asn1Object ToAsn1Object() + { + return Parse(_parser); + } - public Asn1Object ToAsn1Object() - { - return new BerSet(_parser.ReadVector(), false); - } - } + internal static BerSet Parse(Asn1StreamParser sp) + { + return new BerSet(sp.ReadVector()); + } + } } -- cgit 1.4.1