1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.kerberos.shared.crypto.encryption;
21
22
23 import java.util.Arrays;
24 import java.util.Collections;
25 import java.util.List;
26
27 import org.apache.directory.server.i18n.I18n;
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 public final class KeyUsage implements Comparable<KeyUsage>
44 {
45
46
47
48 public static final KeyUsagerypto/encryption/KeyUsage.html#KeyUsage">KeyUsage AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY = new KeyUsage( 1, I18n.err( I18n.ERR_603 ) );
49
50
51
52
53 public static final KeyUsagecrypto/encryption/KeyUsage.html#KeyUsage">KeyUsage AS_OR_TGS_REP_TICKET_WITH_SRVKEY = new KeyUsage( 2, I18n.err( I18n.ERR_604 ) );
54
55
56
57
58 public static final KeyUsageshared/crypto/encryption/KeyUsage.html#KeyUsage">KeyUsage AS_REP_ENC_PART_WITH_CKEY = new KeyUsage( 3, I18n.err( I18n.ERR_605 ) );
59
60
61
62
63 public static final KeyUsageUsage.html#KeyUsage">KeyUsage TGS_REQ_KDC_REQ_BODY_AUTHZ_DATA_ENC_WITH_TGS_SESS_KEY = new KeyUsage( 4,
64 I18n.err( I18n.ERR_606 ) );
65
66
67
68
69 public static final KeyUsageage.html#KeyUsage">KeyUsage TGS_REQ_KDC_REQ_BODY_AUTHZ_DATA_ENC_WITH_AUTHNT_SUB_KEY = new KeyUsage( 5,
70 I18n.err( I18n.ERR_607 ) );
71
72
73
74
75 public static final KeyUsage.html#KeyUsage">KeyUsage TGS_REQ_PA_TGS_REQ_PADATA_AP_REQ_AUTHNT_CKSUM_TGS_SESS_KEY = new KeyUsage( 6,
76 I18n.err( I18n.ERR_608 ) );
77
78
79
80
81 public static final KeyUsagetion/KeyUsage.html#KeyUsage">KeyUsage TGS_REQ_PA_TGS_REQ_PADATA_AP_REQ_TGS_SESS_KEY = new KeyUsage( 7,
82 I18n.err( I18n.ERR_609 ) );
83
84
85
86
87 public static final KeyUsageed/crypto/encryption/KeyUsage.html#KeyUsage">KeyUsage TGS_REP_ENC_PART_TGS_SESS_KEY = new KeyUsage( 8, I18n.err( I18n.ERR_610 ) );
88
89
90
91
92 public static final KeyUsagepto/encryption/KeyUsage.html#KeyUsage">KeyUsage TGS_REP_ENC_PART_TGS_AUTHNT_SUB_KEY = new KeyUsage( 9, I18n.err( I18n.ERR_610 ) );
93
94
95
96
97 public static final KeyUsagered/crypto/encryption/KeyUsage.html#KeyUsage">KeyUsage AP_REQ_AUTHNT_CKSUM_SESS_KEY = new KeyUsage( 10, I18n.err( I18n.ERR_612 ) );
98
99
100
101
102 public static final KeyUsageos/shared/crypto/encryption/KeyUsage.html#KeyUsage">KeyUsage AP_REQ_AUTHNT_SESS_KEY = new KeyUsage( 11, I18n.err( I18n.ERR_613 ) );
103
104
105
106
107 public static final KeyUsage/shared/crypto/encryption/KeyUsage.html#KeyUsage">KeyUsage AP_REP_ENC_PART_SESS_KEY = new KeyUsage( 12, I18n.err( I18n.ERR_614 ) );
108
109
110
111
112 public static final KeyUsagered/crypto/encryption/KeyUsage.html#KeyUsage">KeyUsage KRB_PRIV_ENC_PART_CHOSEN_KEY = new KeyUsage( 13, I18n.err( I18n.ERR_615 ) );
113
114
115
116
117 private static final KeyUsage[] values =
118 {
119 AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY,
120 AS_OR_TGS_REP_TICKET_WITH_SRVKEY,
121 AS_REP_ENC_PART_WITH_CKEY,
122 TGS_REQ_KDC_REQ_BODY_AUTHZ_DATA_ENC_WITH_TGS_SESS_KEY,
123 TGS_REQ_KDC_REQ_BODY_AUTHZ_DATA_ENC_WITH_AUTHNT_SUB_KEY,
124 TGS_REQ_PA_TGS_REQ_PADATA_AP_REQ_AUTHNT_CKSUM_TGS_SESS_KEY,
125 TGS_REQ_PA_TGS_REQ_PADATA_AP_REQ_TGS_SESS_KEY,
126 TGS_REP_ENC_PART_TGS_SESS_KEY,
127 TGS_REP_ENC_PART_TGS_AUTHNT_SUB_KEY,
128 AP_REQ_AUTHNT_CKSUM_SESS_KEY,
129 AP_REQ_AUTHNT_SESS_KEY,
130 AP_REP_ENC_PART_SESS_KEY,
131 KRB_PRIV_ENC_PART_CHOSEN_KEY };
132
133
134
135
136 public static final List<KeyUsage> VALUES = Collections.unmodifiableList( Arrays.asList( values ) );
137
138 private final int ordinal;
139 private final String name;
140
141
142
143
144
145 private KeyUsage( int ordinal, String name )
146 {
147 this.ordinal = ordinal;
148 this.name = name;
149 }
150
151
152
153
154
155
156
157
158 public static KeyUsage getTypeByOrdinal( int type )
159 {
160 for ( int ii = 0; ii < values.length; ii++ )
161 {
162 if ( values[ii].ordinal == type )
163 {
164 return values[ii];
165 }
166 }
167
168 return AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY;
169 }
170
171
172
173
174
175
176
177 public int getOrdinal()
178 {
179 return ordinal;
180 }
181
182
183 public int compareTo( KeyUsage that )
184 {
185 return ordinal - that.ordinal;
186 }
187
188
189 public String toString()
190 {
191 return name + " (" + ordinal + ")";
192 }
193 }