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 | |
parent | Refactoring in PublicKeyFactory (diff) | |
download | BouncyCastle.NET-ed25519-4af2753c154c2f5cab5a48093a666b275ad81339.tar.xz |
Misc. ASN.1 updates
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r-- | crypto/src/asn1/ASN1StreamParser.cs | 26 | ||||
-rw-r--r-- | crypto/src/asn1/pkcs/SignedData.cs | 4 | ||||
-rw-r--r-- | crypto/src/asn1/tsp/Accuracy.cs | 4 | ||||
-rw-r--r-- | crypto/src/asn1/util/Asn1Dump.cs | 4 | ||||
-rw-r--r-- | crypto/src/asn1/x509/TBSCertList.cs | 4 | ||||
-rw-r--r-- | crypto/src/asn1/x509/TBSCertificateStructure.cs | 2 |
6 files changed, 23 insertions, 21 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; + } } } diff --git a/crypto/src/asn1/pkcs/SignedData.cs b/crypto/src/asn1/pkcs/SignedData.cs index 3442e671c..ae335103c 100644 --- a/crypto/src/asn1/pkcs/SignedData.cs +++ b/crypto/src/asn1/pkcs/SignedData.cs @@ -66,9 +66,9 @@ namespace Org.BouncyCastle.Asn1.Pkcs // an interesting feature of SignedData is that there appear to be varying implementations... // for the moment we ignore anything which doesn't fit. // - if (o is DerTaggedObject) + if (o is Asn1TaggedObject) { - DerTaggedObject tagged = (DerTaggedObject) o; + Asn1TaggedObject tagged = (Asn1TaggedObject)o; switch (tagged.TagNo) { diff --git a/crypto/src/asn1/tsp/Accuracy.cs b/crypto/src/asn1/tsp/Accuracy.cs index c5a5ca119..9da8f1d68 100644 --- a/crypto/src/asn1/tsp/Accuracy.cs +++ b/crypto/src/asn1/tsp/Accuracy.cs @@ -54,9 +54,9 @@ namespace Org.BouncyCastle.Asn1.Tsp { seconds = (DerInteger) seq[i]; } - else if (seq[i] is DerTaggedObject) + else if (seq[i] is Asn1TaggedObject) { - DerTaggedObject extra = (DerTaggedObject) seq[i]; + Asn1TaggedObject extra = (Asn1TaggedObject)seq[i]; switch (extra.TagNo) { diff --git a/crypto/src/asn1/util/Asn1Dump.cs b/crypto/src/asn1/util/Asn1Dump.cs index 6a21ee2af..019041789 100644 --- a/crypto/src/asn1/util/Asn1Dump.cs +++ b/crypto/src/asn1/util/Asn1Dump.cs @@ -63,7 +63,7 @@ namespace Org.BouncyCastle.Asn1.Utilities } } } - else if (obj is DerTaggedObject) + else if (obj is Asn1TaggedObject) { string tab = indent + Tab; buf.Append(indent); @@ -76,7 +76,7 @@ namespace Org.BouncyCastle.Asn1.Utilities buf.Append("Tagged ["); } - DerTaggedObject o = (DerTaggedObject)obj; + Asn1TaggedObject o = (Asn1TaggedObject)obj; buf.Append(((int)o.TagNo).ToString()); buf.Append(']'); diff --git a/crypto/src/asn1/x509/TBSCertList.cs b/crypto/src/asn1/x509/TBSCertList.cs index 5767a7f21..2b3646052 100644 --- a/crypto/src/asn1/x509/TBSCertList.cs +++ b/crypto/src/asn1/x509/TBSCertList.cs @@ -193,13 +193,13 @@ namespace Org.BouncyCastle.Asn1.X509 } if (seqPos < seq.Count - && !(seq[seqPos] is DerTaggedObject)) + && !(seq[seqPos] is Asn1TaggedObject)) { revokedCertificates = Asn1Sequence.GetInstance(seq[seqPos++]); } if (seqPos < seq.Count - && seq[seqPos] is DerTaggedObject) + && seq[seqPos] is Asn1TaggedObject) { crlExtensions = X509Extensions.GetInstance(seq[seqPos]); } diff --git a/crypto/src/asn1/x509/TBSCertificateStructure.cs b/crypto/src/asn1/x509/TBSCertificateStructure.cs index e69e985f5..da378391e 100644 --- a/crypto/src/asn1/x509/TBSCertificateStructure.cs +++ b/crypto/src/asn1/x509/TBSCertificateStructure.cs @@ -69,7 +69,7 @@ namespace Org.BouncyCastle.Asn1.X509 // // some certficates don't include a version number - we assume v1 // - if (seq[0] is DerTaggedObject) + if (seq[0] is Asn1TaggedObject) { version = DerInteger.GetInstance((Asn1TaggedObject)seq[0], true); } |