01: /*
02: * <copyright>
03: *
04: * Copyright 1997-2004 Networks Associates Technology, Inc
05: * under sponsorship of the Defense Advanced Research Projects
06: * Agency (DARPA).
07: *
08: * You can redistribute this software and/or modify it under the
09: * terms of the Cougaar Open Source License as published on the
10: * Cougaar Open Source Website (www.cougaar.org).
11: *
12: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23: *
24: * </copyright>
25: *
26: * Created on September 12, 2001, 10:55 AM
27: */
28:
29: package org.cougaar.core.service.identity;
30:
31: /**
32: * A reason for revoking a certificate.
33: * <p>
34: * These reasons match RFC 2459 section 5.3.1.
35: */
36: public class CrlReason {
37: // revocation reasons:
38: public static final int UNSPECIFIED = 0;
39: public static final int KEY_COMPROMISE = 1;
40: public static final int CA_COMPROMISE = 2;
41: public static final int AFFILIATION_CHANGED = 3;
42: public static final int SUPERSEDED = 4;
43: public static final int CESSATION_OF_OPERATION = 5;
44: public static final int CERTIFICATE_HOLD = 6;
45: public static final int REMOVE_FROM_CRL = 8;
46: public static final int PRIVILEGE_WITHDRAWN = 9;
47: public static final int AA_COMPROMISE = 10;
48:
49: private int reason;
50:
51: // private constructor, called only within this class
52: public CrlReason(int value) {
53: reason = value;
54: }
55:
56: public int getReason() {
57: return reason;
58: }
59:
60: public String getReasonAsString() {
61: switch (reason) {
62: case UNSPECIFIED:
63: return "UNSPECIFIED";
64: case KEY_COMPROMISE:
65: return "KEY_COMPROMISE";
66: case CA_COMPROMISE:
67: return "CA_COMPROMISE";
68: case AFFILIATION_CHANGED:
69: return "AFFILIATION_CHANGED";
70: case SUPERSEDED:
71: return "SUPERSEDED";
72: case CESSATION_OF_OPERATION:
73: return "CESSATION_OF_OPERATION";
74: case CERTIFICATE_HOLD:
75: return "CERTIFICATE_HOLD";
76: case REMOVE_FROM_CRL:
77: return "REMOVE_FROM_CRL";
78: case PRIVILEGE_WITHDRAWN:
79: return "PRIVILEGE_WITHDRAWN";
80: case AA_COMPROMISE:
81: return "AA_COMPROMISE";
82: default:
83: return "UNKNOWN (" + reason + ")";
84: }
85: }
86:
87: public String toString() {
88: return "Certificate revoked due to " + getReasonAsString();
89: }
90: }
|