blob: 72b0c740341f3a16e34892e623bdae03c3954262 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
using System;
using Org.BouncyCastle.Math;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.Cmp
{
public enum PkiStatus
{
Granted = 0,
GrantedWithMods = 1,
Rejection = 2,
Waiting = 3,
RevocationWarning = 4,
RevocationNotification = 5,
KeyUpdateWarning = 6,
}
public class PkiStatusEncodable
: Asn1Encodable
{
public static readonly PkiStatusEncodable granted = new PkiStatusEncodable(PkiStatus.Granted);
public static readonly PkiStatusEncodable grantedWithMods = new PkiStatusEncodable(PkiStatus.GrantedWithMods);
public static readonly PkiStatusEncodable rejection = new PkiStatusEncodable(PkiStatus.Rejection);
public static readonly PkiStatusEncodable waiting = new PkiStatusEncodable(PkiStatus.Waiting);
public static readonly PkiStatusEncodable revocationWarning = new PkiStatusEncodable(PkiStatus.RevocationWarning);
public static readonly PkiStatusEncodable revocationNotification = new PkiStatusEncodable(PkiStatus.RevocationNotification);
public static readonly PkiStatusEncodable keyUpdateWaiting = new PkiStatusEncodable(PkiStatus.KeyUpdateWarning);
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))
{
}
private PkiStatusEncodable(DerInteger status)
{
this.status = status;
}
public virtual BigInteger Value
{
get { return status.Value; }
}
public override Asn1Object ToAsn1Object()
{
return status;
}
}
}
|