diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-08-04 17:58:40 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-08-04 17:58:40 +0700 |
commit | 4af2753c154c2f5cab5a48093a666b275ad81339 (patch) | |
tree | c3e4f221e24f69ae6ed510aa35ef0a5967264229 /crypto/src/asn1/ASN1StreamParser.cs | |
parent | Refactoring in PublicKeyFactory (diff) | |
download | BouncyCastle.NET-ed25519-4af2753c154c2f5cab5a48093a666b275ad81339.tar.xz |
Misc. ASN.1 updates
Diffstat (limited to 'crypto/src/asn1/ASN1StreamParser.cs')
-rw-r--r-- | crypto/src/asn1/ASN1StreamParser.cs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/crypto/src/asn1/ASN1StreamParser.cs b/crypto/src/asn1/ASN1StreamParser.cs index 0c6b4413a..3eaaadaee 100644 --- a/crypto/src/asn1/ASN1StreamParser.cs +++ b/crypto/src/asn1/ASN1StreamParser.cs @@ -218,17 +218,19 @@ namespace Org.BouncyCastle.Asn1 } } - internal Asn1EncodableVector ReadVector() - { - Asn1EncodableVector v = new Asn1EncodableVector(); - - IAsn1Convertible obj; - while ((obj = ReadObject()) != null) - { - v.Add(obj.ToAsn1Object()); - } - - return v; - } + internal Asn1EncodableVector ReadVector() + { + IAsn1Convertible obj = ReadObject(); + if (null == obj) + return new Asn1EncodableVector(0); + + Asn1EncodableVector v = new Asn1EncodableVector(); + do + { + v.Add(obj.ToAsn1Object()); + } + while ((obj = ReadObject()) != null); + return v; + } } } |