diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-01-27 01:58:23 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-01-27 01:58:23 +0700 |
commit | e71fe27c302d36e6355d9da12f3d9ec51540825a (patch) | |
tree | 6aa065f627d14e659e68ae0cbe355b656af3e40f /crypto/src/asn1/ocsp | |
parent | Add CrlID.GetInstance methods, obsolete public constructor (diff) | |
download | BouncyCastle.NET-ed25519-e71fe27c302d36e6355d9da12f3d9ec51540825a.tar.xz |
Misc. cleanup after bc-fips-csharp updates
Diffstat (limited to 'crypto/src/asn1/ocsp')
-rw-r--r-- | crypto/src/asn1/ocsp/CertID.cs | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/crypto/src/asn1/ocsp/CertID.cs b/crypto/src/asn1/ocsp/CertID.cs index 523f6b87c..12a111ec9 100644 --- a/crypto/src/asn1/ocsp/CertID.cs +++ b/crypto/src/asn1/ocsp/CertID.cs @@ -1,12 +1,10 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; -using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { - public class CertID + public class CertID : Asn1Encodable { private readonly AlgorithmIdentifier hashAlgorithm; @@ -14,27 +12,18 @@ namespace Org.BouncyCastle.Asn1.Ocsp private readonly Asn1OctetString issuerKeyHash; private readonly DerInteger serialNumber; - public static CertID GetInstance( - Asn1TaggedObject obj, - bool explicitly) + public static CertID GetInstance(Asn1TaggedObject obj, bool explicitly) { return GetInstance(Asn1Sequence.GetInstance(obj, explicitly)); } - public static CertID GetInstance( - object obj) + public static CertID GetInstance(object obj) { - if (obj == null || obj is CertID) - { - return (CertID)obj; - } - - if (obj is Asn1Sequence) - { - return new CertID((Asn1Sequence)obj); - } - - throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); + if (obj == null) + return null; + if (obj is CertID certID) + return certID; + return new CertID(Asn1Sequence.GetInstance(obj)); } public CertID( @@ -49,8 +38,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp this.serialNumber = serialNumber; } - private CertID( - Asn1Sequence seq) + private CertID(Asn1Sequence seq) { if (seq.Count != 4) throw new ArgumentException("Wrong number of elements in sequence", "seq"); |