001: package org.bouncycastle.asn1.x509;
002:
003: import org.bouncycastle.asn1.DEREnumerated;
004:
005: /**
006: * The CRLReason enumeration.
007: * <pre>
008: * CRLReason ::= ENUMERATED {
009: * unspecified (0),
010: * keyCompromise (1),
011: * cACompromise (2),
012: * affiliationChanged (3),
013: * superseded (4),
014: * cessationOfOperation (5),
015: * certificateHold (6),
016: * removeFromCRL (8),
017: * privilegeWithdrawn (9),
018: * aACompromise (10)
019: * }
020: * </pre>
021: */
022: public class CRLReason extends DEREnumerated {
023: /**
024: * @deprecated use lower case version
025: */
026: public static final int UNSPECIFIED = 0;
027: /**
028: * @deprecated use lower case version
029: */
030: public static final int KEY_COMPROMISE = 1;
031: /**
032: * @deprecated use lower case version
033: */
034: public static final int CA_COMPROMISE = 2;
035: /**
036: * @deprecated use lower case version
037: */
038: public static final int AFFILIATION_CHANGED = 3;
039: /**
040: * @deprecated use lower case version
041: */
042: public static final int SUPERSEDED = 4;
043: /**
044: * @deprecated use lower case version
045: */
046: public static final int CESSATION_OF_OPERATION = 5;
047: /**
048: * @deprecated use lower case version
049: */
050: public static final int CERTIFICATE_HOLD = 6;
051: /**
052: * @deprecated use lower case version
053: */
054: public static final int REMOVE_FROM_CRL = 8;
055: /**
056: * @deprecated use lower case version
057: */
058: public static final int PRIVILEGE_WITHDRAWN = 9;
059: /**
060: * @deprecated use lower case version
061: */
062: public static final int AA_COMPROMISE = 10;
063:
064: public static final int unspecified = 0;
065: public static final int keyCompromise = 1;
066: public static final int cACompromise = 2;
067: public static final int affiliationChanged = 3;
068: public static final int super seded = 4;
069: public static final int cessationOfOperation = 5;
070: public static final int certificateHold = 6;
071: // 7 -> unknown
072: public static final int removeFromCRL = 8;
073: public static final int privilegeWithdrawn = 9;
074: public static final int aACompromise = 10;
075:
076: private static final String[] reasonString = { "unspecified",
077: "keyCompromise", "cACompromise", "affiliationChanged",
078: "superseded", "cessationOfOperation", "certificateHold",
079: "unknown", "removeFromCRL", "privilegeWithdrawn",
080: "aACompromise" };
081:
082: public CRLReason(int reason) {
083: super (reason);
084: }
085:
086: public CRLReason(DEREnumerated reason) {
087: super (reason.getValue().intValue());
088: }
089:
090: public String toString() {
091: String str;
092: int reason = getValue().intValue();
093: if (reason < 0 || reason > 10) {
094: str = "invalid";
095: } else {
096: str = reasonString[reason];
097: }
098: return "CRLReason: " + str;
099: }
100: }
|