1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.shared.kerberos.crypto.checksum;
21
22
23
24
25
26
27
28 public enum ChecksumType implements Comparable<ChecksumType>
29 {
30
31
32
33 UNKNOWN(-1, "UNKNOWN"),
34
35
36
37
38 NULL(0, "NULL"),
39
40
41
42
43 CRC32(1, "CRC32"),
44
45
46
47
48 RSA_MD4(2, "rsa-md4"),
49
50
51
52
53 RSA_MD4_DES(3, "rsa-md4-des"),
54
55
56
57
58 DES_MAC(4, "des-mac"),
59
60
61
62
63 DES_MAC_K(5, "rsa-md5"),
64
65
66
67
68 RSA_MD4_DES_K(6, "rsa-md5"),
69
70
71
72
73 RSA_MD5(7, "rsa-md5"),
74
75
76
77
78 RSA_MD5_DES(8, "rsa-md5-des"),
79
80
81
82
83 RSA_MD5_DES3(9, "rsa-md5-des3"),
84
85
86
87
88 SHA1(10, "sha1"),
89
90
91
92
93 HMAC_SHA1_DES3_KD(12, "hmac-sha1-des3-kd"),
94
95
96
97
98 HMAC_SHA1_DES3(13, "hmac-sha1-des3"),
99
100
101
102
103 SHA1_2(14, "sha1"),
104
105
106
107
108 HMAC_SHA1_96_AES128(15, "hmac-sha1-96-aes128"),
109
110
111
112
113 HMAC_SHA1_96_AES256(16, "hmac-sha1-96-aes256"),
114
115
116
117
118 HMAC_SHA256_128_AES128(19, "hmac-sha256-128-aes128"),
119
120
121
122
123 HMAC_SHA384_192_AES256(20, "hmac-sha384-192-aes256"),
124
125
126
127
128 HMAC_MD5(-138, "hmac-md5");
129
130
131
132
133 private final int value;
134
135
136
137
138 private final String name;
139
140
141
142
143
144 private ChecksumType( int value, String name )
145 {
146 this.value = value;
147 this.name = name;
148 }
149
150
151
152
153
154
155
156
157 public static ChecksumType getTypeByValue( int type )
158 {
159 switch ( type )
160 {
161 case -1:
162 return UNKNOWN;
163 case 0:
164 return NULL;
165 case 1:
166 return CRC32;
167 case 2:
168 return RSA_MD4;
169 case 3:
170 return RSA_MD4_DES;
171 case 4:
172 return DES_MAC;
173 case 5:
174 return DES_MAC_K;
175 case 6:
176 return RSA_MD4_DES_K;
177 case 7:
178 return RSA_MD5;
179 case 8:
180 return RSA_MD5_DES;
181 case 9:
182 return RSA_MD5_DES3;
183 case 10:
184 return SHA1;
185 case 12:
186 return HMAC_SHA1_DES3_KD;
187 case 13:
188 return HMAC_SHA1_DES3;
189 case 14:
190 return SHA1_2;
191 case 15:
192 return HMAC_SHA1_96_AES128;
193 case 16:
194 return HMAC_SHA1_96_AES256;
195 case 19:
196 return HMAC_SHA256_128_AES128;
197 case 20:
198 return HMAC_SHA384_192_AES256;
199 case -138:
200 return HMAC_MD5;
201 default:
202 return UNKNOWN;
203 }
204 }
205
206
207
208
209
210
211
212 public int getValue()
213 {
214 return value;
215 }
216
217
218
219
220
221
222
223 public String getName()
224 {
225 return name;
226 }
227
228
229
230
231
232 @Override
233 public String toString()
234 {
235 return getName() + " (" + value + ")";
236 }
237 }