diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-14 15:07:49 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-14 15:07:49 +0700 |
commit | dc8b86c13c769e6de9a5c38e3c67921b034a2394 (patch) | |
tree | b79eb20bc7ed797e7624ccb5ceb8293ed429751e /crypto/src/asn1/isismtt | |
parent | Refactor using MapElements (diff) | |
download | BouncyCastle.NET-ed25519-dc8b86c13c769e6de9a5c38e3c67921b034a2394.tar.xz |
Refactoring in Asn1
Diffstat (limited to 'crypto/src/asn1/isismtt')
-rw-r--r-- | crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs b/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs index 413b3bd7f..0348b0916 100644 --- a/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs +++ b/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs @@ -53,23 +53,19 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.Ocsp private readonly byte[] publicKeyCert; private readonly byte[] attributeCert; - public static RequestedCertificate GetInstance( - object obj) + public static RequestedCertificate GetInstance(object obj) { - if (obj == null || obj is RequestedCertificate) - { - return (RequestedCertificate) obj; - } + if (obj == null) + return null; + + if (obj is RequestedCertificate requestedCertificate) + return requestedCertificate; if (obj is Asn1Sequence) - { return new RequestedCertificate(X509CertificateStructure.GetInstance(obj)); - } - if (obj is Asn1TaggedObject) - { - return new RequestedCertificate((Asn1TaggedObject) obj); - } + if (obj is Asn1TaggedObject taggedObject) + return new RequestedCertificate(taggedObject); throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } |