From 915e22e211991a8be5bfe4cd3b37650b6740acc2 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 27 Jan 2023 01:46:50 +0700 Subject: Add CrlID.GetInstance methods, obsolete public constructor --- crypto/src/asn1/ocsp/CrlID.cs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/crypto/src/asn1/ocsp/CrlID.cs b/crypto/src/asn1/ocsp/CrlID.cs index 24dda4edf..8736b83ab 100644 --- a/crypto/src/asn1/ocsp/CrlID.cs +++ b/crypto/src/asn1/ocsp/CrlID.cs @@ -9,8 +9,24 @@ namespace Org.BouncyCastle.Asn1.Ocsp private readonly DerInteger crlNum; private readonly Asn1GeneralizedTime crlTime; - // TODO Add GetInstance method(s) and make this private? - public CrlID(Asn1Sequence seq) + public static CrlID GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); + } + + public static CrlID GetInstance(object obj) + { + if (obj == null) + return null; + if (obj is CrlID crlID) + return crlID; +#pragma warning disable CS0618 // Type or member is obsolete + return new CrlID(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete + } + + [Obsolete("Use 'GetInstance' instead")] + public CrlID(Asn1Sequence seq) { foreach (Asn1TaggedObject o in seq) { -- cgit 1.4.1