diff options
Diffstat (limited to 'crypto/src/asn1/cmp/PKIStatus.cs')
-rw-r--r-- | crypto/src/asn1/cmp/PKIStatus.cs | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/crypto/src/asn1/cmp/PKIStatus.cs b/crypto/src/asn1/cmp/PKIStatus.cs index ba757dfcf..72b0c7403 100644 --- a/crypto/src/asn1/cmp/PKIStatus.cs +++ b/crypto/src/asn1/cmp/PKIStatus.cs @@ -27,7 +27,21 @@ namespace Org.BouncyCastle.Asn1.Cmp public static readonly PkiStatusEncodable revocationNotification = new PkiStatusEncodable(PkiStatus.RevocationNotification); public static readonly PkiStatusEncodable keyUpdateWaiting = new PkiStatusEncodable(PkiStatus.KeyUpdateWarning); - private readonly DerInteger status; + public static PkiStatusEncodable GetInstance(object obj) + { + if (obj == null) + return null; + if (obj is PkiStatusEncodable pkiStatusEncodable) + return pkiStatusEncodable; + return new PkiStatusEncodable(DerInteger.GetInstance(obj)); + } + + public static PkiStatusEncodable GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return GetInstance(DerInteger.GetInstance(taggedObject, declaredExplicit)); + } + + private readonly DerInteger status; private PkiStatusEncodable(PkiStatus status) : this(new DerInteger((int)status)) @@ -39,17 +53,6 @@ namespace Org.BouncyCastle.Asn1.Cmp this.status = status; } - public static PkiStatusEncodable GetInstance(object obj) - { - if (obj is PkiStatusEncodable) - return (PkiStatusEncodable)obj; - - if (obj is DerInteger) - return new PkiStatusEncodable((DerInteger)obj); - - throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); - } - public virtual BigInteger Value { get { return status.Value; } |