56542
|
1 |
/*
|
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
public enum CipherSuite {
|
|
25 |
|
|
26 |
TLS_AES_256_GCM_SHA384(
|
|
27 |
0x1302, Protocol.TLSV1_3, Protocol.TLSV1_3),
|
|
28 |
TLS_AES_128_GCM_SHA256(
|
|
29 |
0x1301, Protocol.TLSV1_3, Protocol.TLSV1_3),
|
|
30 |
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256(
|
|
31 |
0xCCAA, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
32 |
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256(
|
|
33 |
0xCCA9, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
34 |
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256(
|
|
35 |
0xCCA8, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
36 |
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384(
|
|
37 |
0xC032, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
38 |
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256(
|
|
39 |
0xC031, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
40 |
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(
|
|
41 |
0xC030, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
42 |
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256(
|
|
43 |
0xC02F, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
44 |
TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384(
|
|
45 |
0xC02E, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
46 |
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256(
|
|
47 |
0xC02D, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
48 |
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(
|
|
49 |
0xC02C, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
50 |
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(
|
|
51 |
0xC02B, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
52 |
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(
|
|
53 |
0xC02A, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
54 |
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(
|
|
55 |
0xC029, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
56 |
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(
|
|
57 |
0xC028, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
58 |
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(
|
|
59 |
0xC027, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
60 |
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(
|
|
61 |
0xC026, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
62 |
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA(
|
|
63 |
0xC025, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
64 |
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(
|
|
65 |
0xC025, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
66 |
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384(
|
|
67 |
0xC024, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
68 |
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256(
|
|
69 |
0xC023, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
70 |
TLS_ECDH_anon_WITH_AES_256_CBC_SHA(
|
|
71 |
0xC019, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
72 |
TLS_ECDH_anon_WITH_AES_128_CBC_SHA(
|
|
73 |
0xC018, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
74 |
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA(
|
|
75 |
0xC017, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
76 |
TLS_ECDH_anon_WITH_RC4_128_SHA(
|
|
77 |
0xC016, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
78 |
TLS_ECDH_anon_WITH_NULL_SHA(
|
|
79 |
0xC015, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
80 |
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(
|
|
81 |
0xC014, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
82 |
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(
|
|
83 |
0xC013, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
84 |
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA(
|
|
85 |
0xC012, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
86 |
TLS_ECDHE_RSA_WITH_RC4_128_SHA(
|
|
87 |
0xC011, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
88 |
TLS_ECDHE_RSA_WITH_NULL_SHA(
|
|
89 |
0xC010, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
90 |
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA(
|
|
91 |
0xC00F, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
92 |
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA(
|
|
93 |
0xC00E, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
94 |
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA(
|
|
95 |
0xC00D, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
96 |
TLS_ECDH_RSA_WITH_RC4_128_SHA(
|
|
97 |
0xC00C, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
98 |
TLS_ECDH_RSA_WITH_NULL_SHA(
|
|
99 |
0xC00B, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
100 |
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(
|
|
101 |
0xC00A, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
102 |
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(
|
|
103 |
0xC009, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
104 |
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA(
|
|
105 |
0xC008, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
106 |
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA(
|
|
107 |
0xC007, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
108 |
TLS_ECDHE_ECDSA_WITH_NULL_SHA(
|
|
109 |
0xC006, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
110 |
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA(
|
|
111 |
0xC003, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
112 |
TLS_ECDH_ECDSA_WITH_RC4_128_SHA(
|
|
113 |
0xC002, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
114 |
TLS_ECDH_ECDSA_WITH_NULL_SHA(
|
|
115 |
0xC001, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
116 |
TLS_EMPTY_RENEGOTIATION_INFO_SCSV(
|
|
117 |
0x00FF, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
118 |
TLS_DH_anon_WITH_AES_256_GCM_SHA384(
|
|
119 |
0x00A7, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
120 |
TLS_DH_anon_WITH_AES_128_GCM_SHA256(
|
|
121 |
0x00A6, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
122 |
TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(
|
|
123 |
0x00A3, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
124 |
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(
|
|
125 |
0x00A2, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
126 |
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(
|
|
127 |
0x009F, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
128 |
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(
|
|
129 |
0x009E, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
130 |
TLS_RSA_WITH_AES_256_GCM_SHA384(
|
|
131 |
0x009D, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
132 |
TLS_RSA_WITH_AES_128_GCM_SHA256(
|
|
133 |
0x009C, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
134 |
TLS_DH_anon_WITH_AES_256_CBC_SHA256(
|
|
135 |
0x006D, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
136 |
TLS_DH_anon_WITH_AES_128_CBC_SHA256(
|
|
137 |
0x006C, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
138 |
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(
|
|
139 |
0x006B, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
140 |
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(
|
|
141 |
0x006A, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
142 |
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(
|
|
143 |
0x0067, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
144 |
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA(
|
|
145 |
0x004C, Protocol.TLSV1, Protocol.TLSV1_2),
|
|
146 |
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(
|
|
147 |
0x0040, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
148 |
TLS_RSA_WITH_AES_256_CBC_SHA256(
|
|
149 |
0x003D, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
150 |
TLS_RSA_WITH_AES_128_CBC_SHA256(
|
|
151 |
0x003C, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
152 |
TLS_RSA_WITH_NULL_SHA256(
|
|
153 |
0x003B, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
154 |
TLS_DH_anon_WITH_AES_256_CBC_SHA(
|
|
155 |
0x003A, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
156 |
TLS_DHE_RSA_WITH_AES_256_CBC_SHA(
|
|
157 |
0x0039, Protocol.TLSV1, Protocol.TLSV1_2),
|
|
158 |
TLS_DHE_DSS_WITH_AES_256_CBC_SHA(
|
|
159 |
0x0038, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
160 |
TLS_RSA_WITH_AES_256_CBC_SHA(
|
|
161 |
0x0035, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
162 |
TLS_DH_anon_WITH_AES_128_CBC_SHA(
|
|
163 |
0x0034, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
164 |
TLS_DHE_RSA_WITH_AES_128_CBC_SHA(
|
|
165 |
0x0033, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
166 |
TLS_DHE_DSS_WITH_AES_128_CBC_SHA(
|
|
167 |
0x0032, Protocol.TLSV1_2, Protocol.TLSV1_2),
|
|
168 |
TLS_RSA_WITH_AES_128_CBC_SHA(
|
|
169 |
0x002F, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
170 |
TLS_KRB5_WITH_3DES_EDE_CBC_MD5(
|
|
171 |
0x0023, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
172 |
TLS_KRB5_WITH_DES_CBC_MD5(
|
|
173 |
0x0022, Protocol.SSLV3, Protocol.TLSV1_1),
|
|
174 |
TLS_KRB5_WITH_3DES_EDE_CBC_SHA(
|
|
175 |
0x001F, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
176 |
TLS_KRB5_WITH_DES_CBC_SHA(
|
|
177 |
0x001E, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
178 |
SSL_DH_anon_WITH_3DES_EDE_CBC_SHA(
|
|
179 |
0x001B, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
180 |
SSL_DH_anon_WITH_DES_CBC_SHA(
|
|
181 |
0x001A, Protocol.SSLV3, Protocol.TLSV1_1),
|
|
182 |
SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA(
|
|
183 |
0x0019, Protocol.SSLV3, Protocol.TLSV1),
|
|
184 |
SSL_DH_anon_WITH_RC4_128_MD5(
|
|
185 |
0x0018, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
186 |
SSL_DH_anon_EXPORT_WITH_RC4_40_MD5(
|
|
187 |
0x0017, Protocol.SSLV3, Protocol.TLSV1),
|
|
188 |
SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA(
|
|
189 |
0x0016, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
190 |
SSL_DHE_RSA_WITH_DES_CBC_SHA(
|
|
191 |
0x0015, Protocol.SSLV3, Protocol.TLSV1_1),
|
|
192 |
SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA(
|
|
193 |
0x0014, Protocol.SSLV3, Protocol.TLSV1),
|
|
194 |
SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA(
|
|
195 |
0x0013, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
196 |
SSL_DHE_DSS_WITH_DES_CBC_SHA(
|
|
197 |
0x0012, Protocol.SSLV3, Protocol.TLSV1_1),
|
|
198 |
SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA(
|
|
199 |
0x0011, Protocol.SSLV3, Protocol.TLSV1),
|
|
200 |
SSL_RSA_WITH_3DES_EDE_CBC_SHA(
|
|
201 |
0x000A, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
202 |
SSL_RSA_WITH_DES_CBC_SHA(
|
|
203 |
0x0009, Protocol.SSLV3, Protocol.TLSV1_1),
|
|
204 |
SSL_RSA_EXPORT_WITH_DES40_CBC_SHA(
|
|
205 |
0x0008, Protocol.SSLV3, Protocol.TLSV1),
|
|
206 |
SSL_RSA_WITH_RC4_128_SHA(
|
|
207 |
0x0005, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
208 |
SSL_RSA_WITH_RC4_128_MD5(
|
|
209 |
0x0004, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
210 |
SSL_RSA_EXPORT_WITH_RC4_40_MD5(
|
|
211 |
0x0003, Protocol.SSLV3, Protocol.TLSV1),
|
|
212 |
SSL_RSA_WITH_NULL_SHA(
|
|
213 |
0x0002, Protocol.SSLV3, Protocol.TLSV1_2),
|
|
214 |
SSL_RSA_WITH_NULL_MD5(
|
|
215 |
0x0001, Protocol.SSLV3, Protocol.TLSV1_2);
|
|
216 |
|
|
217 |
public final int id;
|
|
218 |
public final Protocol startProtocol;
|
|
219 |
public final Protocol endProtocol;
|
|
220 |
|
|
221 |
private CipherSuite(
|
|
222 |
int id,
|
|
223 |
Protocol startProtocol,
|
|
224 |
Protocol endProtocol) {
|
|
225 |
this.id = id;
|
|
226 |
this.startProtocol = startProtocol;
|
|
227 |
this.endProtocol = endProtocol;
|
|
228 |
}
|
|
229 |
|
|
230 |
public boolean supportedByProtocol(Protocol protocol) {
|
|
231 |
return startProtocol.id <= protocol.id
|
|
232 |
&& protocol.id <= endProtocol.id;
|
|
233 |
}
|
|
234 |
|
|
235 |
public static CipherSuite cipherSuite(String name) {
|
|
236 |
return CipherSuite.valueOf(CipherSuite.class, name);
|
|
237 |
}
|
|
238 |
}
|