update dnsjava library
[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 /**
28  * Codes for DNSSEC security statuses.
29  *
30  * @author davidb
31  */
32 public class SecurityStatus {
33     public static final byte INVALID = -1;
34
35     /**
36      * UNCHECKED means that object has yet to be validated.
37      */
38     public static final byte UNCHECKED = 0;
39
40     /**
41      * BOGUS means that the object (RRset or message) failed to validate
42      * (according to local policy), but should have validated.
43      */
44     public static final byte BOGUS = 1;
45
46     /**
47      * BAD is a synonym for BOGUS.
48      */
49     public static final byte BAD = BOGUS;
50
51     /**
52      * INDTERMINATE means that the object is insecure, but not authoritatively
53      * so. Generally this means that the RRset is not below a configured trust
54      * anchor.
55      */
56     public static final byte INDETERMINATE = 2;
57
58     /**
59      * INSECURE means that the object is authoritatively known to be insecure.
60      * Generally this means that this RRset is below a trust anchor, but also
61      * below a verified, insecure delegation.
62      */
63     public static final byte INSECURE = 3;
64
65     /**
66      * SECURE means that the object (RRset or message) validated according to
67      * local policy.
68      */
69     public static final byte SECURE = 4;
70     private byte status;
71
72     public SecurityStatus() {
73         status                       = UNCHECKED;
74     }
75
76     public SecurityStatus(byte status) {
77         setStatus(status);
78     }
79
80     public static String string(int status) {
81         switch (status) {
82             case INVALID:
83                 return "Invalid";
84
85             case BOGUS:
86                 return "Bogus";
87
88             case SECURE:
89                 return "Secure";
90
91             case INSECURE:
92                 return "Insecure";
93
94             case INDETERMINATE:
95                 return "Indeterminate";
96
97             case UNCHECKED:
98                 return "Unchecked";
99
100             default:
101                 return "UNKNOWN";
102         }
103     }
104
105     public byte getStatus() {
106         return status;
107     }
108
109     public void setStatus(byte status) {
110         this.status = status;
111     }
112 }