diff options
Diffstat (limited to 'crypto/src/asn1/x509')
-rw-r--r-- | crypto/src/asn1/x509/IssuerSerial.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/src/asn1/x509/IssuerSerial.cs b/crypto/src/asn1/x509/IssuerSerial.cs index 09b6dae18..8e7ba1fa6 100644 --- a/crypto/src/asn1/x509/IssuerSerial.cs +++ b/crypto/src/asn1/x509/IssuerSerial.cs @@ -19,6 +19,21 @@ namespace Org.BouncyCastle.Asn1.X509 return new IssuerSerial(Asn1Sequence.GetInstance(obj, explicitly)); } + public static IssuerSerial GetOptional(Asn1Encodable element) + { + if (element == null) + throw new ArgumentNullException(nameof(element)); + + if (element is IssuerSerial issuerSerial) + return issuerSerial; + + Asn1Sequence asn1Sequence = Asn1Sequence.GetOptional(element); + if (asn1Sequence != null) + return new IssuerSerial(asn1Sequence); + + return null; + } + private readonly GeneralNames issuer; private readonly DerInteger serial; private readonly DerBitString issuerUid; |