a2f1e0185f9bafc5ac37aeea9fe18bc40646bacc
[captive-validator.git] / src / com / verisign / tat / dnssec / SecurityStatus.java
1 /***************************** -*- Java -*- ********************************\
2  *                                                                         *
3  *   Copyright (c) 2009 VeriSign, Inc. All rights reserved.                *
4  *                                                                         *
5  * This software is provided solely in connection with the terms of the    *
6  * license agreement.  Any other use without the prior express written     *
7  * permission of VeriSign is completely prohibited.  The software and      *
8  * documentation are "Commercial Items", as that term is defined in 48     *
9  * C.F.R.  section 2.101, consisting of "Commercial Computer Software" and *
10  * "Commercial Computer Software Documentation" as such terms are defined  *
11  * in 48 C.F.R. section 252.227-7014(a)(5) and 48 C.F.R. section           *
12  * 252.227-7014(a)(1), and used in 48 C.F.R. section 12.212 and 48 C.F.R.  *
13  * section 227.7202, as applicable.  Pursuant to the above and other       *
14  * relevant sections of the Code of Federal Regulations, as applicable,    *
15  * VeriSign's publications, commercial computer software, and commercial   *
16  * computer software documentation are distributed and licensed to United  *
17  * States Government end users with only those rights as granted to all    *
18  * other end users, according to the terms and conditions contained in the *
19  * license agreement(s) that accompany the products and software           *
20  * documentation.                                                          *
21  *                                                                         *
22 \***************************************************************************/
23
24 package com.verisign.tat.dnssec;
25
26 /**
27  * Codes for DNSSEC security statuses.
28  * 
29  * @author davidb
30  */
31 public class SecurityStatus {
32     public static final byte INVALID = -1;
33
34     /**
35      * UNCHECKED means that object has yet to be validated.
36      */
37     public static final byte UNCHECKED = 0;
38
39     /**
40      * BOGUS means that the object (RRset or message) failed to validate
41      * (according to local policy), but should have validated.
42      */
43     public static final byte BOGUS = 1;
44
45     /**
46      * BAD is a synonym for BOGUS.
47      */
48     public static final byte BAD = BOGUS;
49
50     /**
51      * INDTERMINATE means that the object is insecure, but not authoritatively
52      * so. Generally this means that the RRset is not below a configured trust
53      * anchor.
54      */
55     public static final byte INDETERMINATE = 2;
56
57     /**
58      * INSECURE means that the object is authoritatively known to be insecure.
59      * Generally this means that this RRset is below a trust anchor, but also
60      * below a verified, insecure delegation.
61      */
62     public static final byte INSECURE = 3;
63
64     /**
65      * SECURE means that the object (RRset or message) validated according to
66      * local policy.
67      */
68     public static final byte SECURE = 4;
69     private byte status;
70
71     public SecurityStatus() {
72         status = UNCHECKED;
73     }
74
75     public SecurityStatus(byte status) {
76         setStatus(status);
77     }
78
79     public static String string(int status) {
80         switch (status) {
81         case INVALID:
82             return "Invalid";
83
84         case BOGUS:
85             return "Bogus";
86
87         case SECURE:
88             return "Secure";
89
90         case INSECURE:
91             return "Insecure";
92
93         case INDETERMINATE:
94             return "Indeterminate";
95
96         case UNCHECKED:
97             return "Unchecked";
98
99         default:
100             return "UNKNOWN";
101         }
102     }
103
104     public byte getStatus() {
105         return status;
106     }
107
108     public void setStatus(byte status) {
109         this.status = status;
110     }
111 }