diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-02-08 19:26:46 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-02-08 19:26:46 +0700 |
commit | 50335415dd4d1809782181874e38a275734b76f5 (patch) | |
tree | 36ce4b945cf1326487e168cda480ed7fd3e2d9d9 /crypto/src/asn1/x509 | |
parent | Env. var. to enforce correct X.509 cert encoding (diff) | |
download | BouncyCastle.NET-ed25519-50335415dd4d1809782181874e38a275734b76f5.tar.xz |
New HasValue methods
Diffstat (limited to 'crypto/src/asn1/x509')
-rw-r--r-- | crypto/src/asn1/x509/AttributeCertificateInfo.cs | 2 | ||||
-rw-r--r-- | crypto/src/asn1/x509/GeneralSubtree.cs | 2 | ||||
-rw-r--r-- | crypto/src/asn1/x509/TBSCertificateStructure.cs | 11 |
3 files changed, 7 insertions, 8 deletions
diff --git a/crypto/src/asn1/x509/AttributeCertificateInfo.cs b/crypto/src/asn1/x509/AttributeCertificateInfo.cs index 29abaa6e4..d466bbd14 100644 --- a/crypto/src/asn1/x509/AttributeCertificateInfo.cs +++ b/crypto/src/asn1/x509/AttributeCertificateInfo.cs @@ -149,7 +149,7 @@ namespace Org.BouncyCastle.Asn1.X509 { Asn1EncodableVector v = new Asn1EncodableVector(9); - if (version.IntValueExact != 0) + if (!version.HasValue(0)) { v.Add(version); } diff --git a/crypto/src/asn1/x509/GeneralSubtree.cs b/crypto/src/asn1/x509/GeneralSubtree.cs index a42ec4643..7dbacd229 100644 --- a/crypto/src/asn1/x509/GeneralSubtree.cs +++ b/crypto/src/asn1/x509/GeneralSubtree.cs @@ -173,7 +173,7 @@ namespace Org.BouncyCastle.Asn1.X509 { Asn1EncodableVector v = new Asn1EncodableVector(baseName); - if (minimum != null && minimum.Value.SignValue != 0) + if (minimum != null && !minimum.HasValue(0)) { v.Add(new DerTaggedObject(false, 0, minimum)); } diff --git a/crypto/src/asn1/x509/TBSCertificateStructure.cs b/crypto/src/asn1/x509/TBSCertificateStructure.cs index e600685f0..bd08d8bb8 100644 --- a/crypto/src/asn1/x509/TBSCertificateStructure.cs +++ b/crypto/src/asn1/x509/TBSCertificateStructure.cs @@ -1,6 +1,5 @@ using System; -using Org.BouncyCastle.Math; using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 @@ -82,15 +81,15 @@ namespace Org.BouncyCastle.Asn1.X509 bool isV1 = false; bool isV2 = false; - if (version.Value.Equals(BigInteger.Zero)) + if (version.HasValue(0)) { isV1 = true; } - else if (version.Value.Equals(BigInteger.One)) + else if (version.HasValue(1)) { isV2 = true; } - else if (!version.Value.Equals(BigInteger.Two)) + else if (!version.HasValue(2)) { throw new ArgumentException("version number not recognised"); } @@ -220,7 +219,7 @@ namespace Org.BouncyCastle.Asn1.X509 Asn1EncodableVector v = new Asn1EncodableVector(); // DEFAULT Zero - if (!version.HasValue(BigIntegers.Zero)) + if (!version.HasValue(0)) { v.Add(new DerTaggedObject(true, 0, version)); } @@ -238,7 +237,7 @@ namespace Org.BouncyCastle.Asn1.X509 } else { - v.Add(new DerSequence()); + v.Add(DerSequence.Empty); } v.Add(subjectPublicKeyInfo); |