01: package org.bouncycastle.asn1.cmp;
02:
03: import org.bouncycastle.asn1.ASN1Encodable;
04: import org.bouncycastle.asn1.DERInteger;
05: import org.bouncycastle.asn1.DERObject;
06:
07: public class PKIStatus extends ASN1Encodable {
08: public static final int GRANTED = 0;
09: public static final int GRANTED_WITH_MODS = 1;
10: public static final int REJECTION = 2;
11: public static final int WAITING = 3;
12: public static final int REVOCATION_WARNING = 4;
13: public static final int REVOCATION_NOTIFICATION = 5;
14: public static final int KEY_UPDATE_WARNING = 6;
15:
16: public static final PKIStatus granted = new PKIStatus(GRANTED);
17: public static final PKIStatus grantedWithMods = new PKIStatus(
18: GRANTED_WITH_MODS);
19: public static final PKIStatus rejection = new PKIStatus(REJECTION);
20: public static final PKIStatus waiting = new PKIStatus(WAITING);
21: public static final PKIStatus revocationWarning = new PKIStatus(
22: REVOCATION_WARNING);
23: public static final PKIStatus revocationNotification = new PKIStatus(
24: REVOCATION_NOTIFICATION);
25: public static final PKIStatus keyUpdateWaiting = new PKIStatus(
26: KEY_UPDATE_WARNING);
27:
28: private DERInteger value;
29:
30: private PKIStatus(int value) {
31: this (new DERInteger(value));
32: }
33:
34: private PKIStatus(DERInteger value) {
35: this .value = value;
36: }
37:
38: public static PKIStatus getInstance(Object o) {
39: if (o instanceof PKIStatus) {
40: return (PKIStatus) o;
41: }
42:
43: if (o instanceof DERInteger) {
44: return new PKIStatus((DERInteger) o);
45: }
46:
47: throw new IllegalArgumentException("Invalid object: "
48: + o.getClass().getName());
49: }
50:
51: public DERObject toASN1Object() {
52: return value;
53: }
54: }
|