author | ohair |
Tue, 25 May 2010 15:58:33 -0700 | |
changeset 5506 | 202f599c92aa |
parent 5166 | 81f798aa5765 |
child 6856 | 533f4ad71f88 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 4750141 4895631 |
|
27 |
* @summary Check enabled and supported ciphersuites are correct |
|
28 |
*/ |
|
29 |
||
30 |
import java.util.*; |
|
31 |
||
32 |
import javax.net.ssl.*; |
|
33 |
||
34 |
import javax.crypto.Cipher; |
|
35 |
import javax.crypto.spec.*; |
|
36 |
||
37 |
public class CheckCipherSuites { |
|
38 |
||
39 |
private final static String[] ENABLED_DEFAULT = { |
|
40 |
"SSL_RSA_WITH_RC4_128_MD5", |
|
41 |
"SSL_RSA_WITH_RC4_128_SHA", |
|
42 |
"TLS_RSA_WITH_AES_128_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
43 |
"TLS_ECDH_ECDSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
44 |
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
45 |
"TLS_ECDH_RSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
46 |
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
47 |
"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
48 |
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
49 |
"TLS_ECDHE_RSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
50 |
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", |
2 | 51 |
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA", |
52 |
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA", |
|
53 |
"SSL_RSA_WITH_3DES_EDE_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
54 |
"TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
55 |
"TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
56 |
"TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
57 |
"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", |
2 | 58 |
"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", |
59 |
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", |
|
60 |
"SSL_RSA_WITH_DES_CBC_SHA", |
|
61 |
"SSL_DHE_RSA_WITH_DES_CBC_SHA", |
|
62 |
"SSL_DHE_DSS_WITH_DES_CBC_SHA", |
|
63 |
"SSL_RSA_EXPORT_WITH_RC4_40_MD5", |
|
64 |
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", |
|
65 |
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", |
|
66 |
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", |
|
67 |
}; |
|
68 |
||
69 |
private final static String[] ENABLED_UNLIMITED = { |
|
70 |
"SSL_RSA_WITH_RC4_128_MD5", |
|
71 |
"SSL_RSA_WITH_RC4_128_SHA", |
|
72 |
"TLS_RSA_WITH_AES_128_CBC_SHA", |
|
73 |
"TLS_RSA_WITH_AES_256_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
74 |
"TLS_ECDH_ECDSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
75 |
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
76 |
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
77 |
"TLS_ECDH_RSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
78 |
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
79 |
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
80 |
"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
81 |
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
82 |
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
83 |
"TLS_ECDHE_RSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
84 |
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
85 |
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", |
2 | 86 |
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA", |
87 |
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA", |
|
88 |
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA", |
|
89 |
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA", |
|
90 |
"SSL_RSA_WITH_3DES_EDE_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
91 |
"TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
92 |
"TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
93 |
"TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
94 |
"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", |
2 | 95 |
"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", |
96 |
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", |
|
97 |
"SSL_RSA_WITH_DES_CBC_SHA", |
|
98 |
"SSL_DHE_RSA_WITH_DES_CBC_SHA", |
|
99 |
"SSL_DHE_DSS_WITH_DES_CBC_SHA", |
|
100 |
"SSL_RSA_EXPORT_WITH_RC4_40_MD5", |
|
101 |
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", |
|
102 |
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", |
|
103 |
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", |
|
104 |
}; |
|
105 |
||
106 |
// supported ciphersuites using default JCE policy jurisdiction files |
|
107 |
// AES/256 unavailable |
|
108 |
private final static String[] SUPPORTED_DEFAULT = { |
|
109 |
"SSL_RSA_WITH_RC4_128_MD5", |
|
110 |
"SSL_RSA_WITH_RC4_128_SHA", |
|
111 |
"TLS_RSA_WITH_AES_128_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
112 |
"TLS_ECDH_ECDSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
113 |
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
114 |
"TLS_ECDH_RSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
115 |
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
116 |
"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
117 |
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
118 |
"TLS_ECDHE_RSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
119 |
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", |
2 | 120 |
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA", |
121 |
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA", |
|
122 |
"SSL_RSA_WITH_3DES_EDE_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
123 |
"TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
124 |
"TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
125 |
"TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
126 |
"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", |
2 | 127 |
"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", |
128 |
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", |
|
129 |
"SSL_RSA_WITH_DES_CBC_SHA", |
|
130 |
"SSL_DHE_RSA_WITH_DES_CBC_SHA", |
|
131 |
"SSL_DHE_DSS_WITH_DES_CBC_SHA", |
|
132 |
"SSL_RSA_EXPORT_WITH_RC4_40_MD5", |
|
133 |
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", |
|
134 |
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", |
|
135 |
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
136 |
|
2 | 137 |
"SSL_RSA_WITH_NULL_MD5", |
138 |
"SSL_RSA_WITH_NULL_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
139 |
"TLS_ECDH_ECDSA_WITH_NULL_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
140 |
"TLS_ECDH_RSA_WITH_NULL_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
141 |
"TLS_ECDHE_ECDSA_WITH_NULL_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
142 |
"TLS_ECDHE_RSA_WITH_NULL_SHA", |
2 | 143 |
"SSL_DH_anon_WITH_RC4_128_MD5", |
144 |
"TLS_DH_anon_WITH_AES_128_CBC_SHA", |
|
145 |
"SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", |
|
146 |
"SSL_DH_anon_WITH_DES_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
147 |
"TLS_ECDH_anon_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
148 |
"TLS_ECDH_anon_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
149 |
"TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", |
2 | 150 |
"SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", |
151 |
"SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
152 |
"TLS_ECDH_anon_WITH_NULL_SHA", |
2 | 153 |
"TLS_KRB5_WITH_RC4_128_SHA", |
154 |
"TLS_KRB5_WITH_RC4_128_MD5", |
|
155 |
"TLS_KRB5_WITH_3DES_EDE_CBC_SHA", |
|
156 |
"TLS_KRB5_WITH_3DES_EDE_CBC_MD5", |
|
157 |
"TLS_KRB5_WITH_DES_CBC_SHA", |
|
158 |
"TLS_KRB5_WITH_DES_CBC_MD5", |
|
159 |
"TLS_KRB5_EXPORT_WITH_RC4_40_SHA", |
|
160 |
"TLS_KRB5_EXPORT_WITH_RC4_40_MD5", |
|
161 |
"TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
162 |
"TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5", |
2 | 163 |
}; |
164 |
||
165 |
// supported ciphersuites using unlimited JCE policy jurisdiction files |
|
166 |
// AES/256 available |
|
167 |
private final static String[] SUPPORTED_UNLIMITED = { |
|
168 |
"SSL_RSA_WITH_RC4_128_MD5", |
|
169 |
"SSL_RSA_WITH_RC4_128_SHA", |
|
170 |
"TLS_RSA_WITH_AES_128_CBC_SHA", |
|
171 |
"TLS_RSA_WITH_AES_256_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
172 |
"TLS_ECDH_ECDSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
173 |
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
174 |
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
175 |
"TLS_ECDH_RSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
176 |
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
177 |
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
178 |
"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
179 |
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
180 |
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
181 |
"TLS_ECDHE_RSA_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
182 |
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
183 |
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA", |
2 | 184 |
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA", |
185 |
"TLS_DHE_RSA_WITH_AES_256_CBC_SHA", |
|
186 |
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA", |
|
187 |
"TLS_DHE_DSS_WITH_AES_256_CBC_SHA", |
|
188 |
"SSL_RSA_WITH_3DES_EDE_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
189 |
"TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
190 |
"TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
191 |
"TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
192 |
"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", |
2 | 193 |
"SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA", |
194 |
"SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", |
|
195 |
"SSL_RSA_WITH_DES_CBC_SHA", |
|
196 |
"SSL_DHE_RSA_WITH_DES_CBC_SHA", |
|
197 |
"SSL_DHE_DSS_WITH_DES_CBC_SHA", |
|
198 |
"SSL_RSA_EXPORT_WITH_RC4_40_MD5", |
|
199 |
"SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", |
|
200 |
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", |
|
201 |
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
202 |
|
2 | 203 |
"SSL_RSA_WITH_NULL_MD5", |
204 |
"SSL_RSA_WITH_NULL_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
205 |
"TLS_ECDH_ECDSA_WITH_NULL_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
206 |
"TLS_ECDH_RSA_WITH_NULL_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
207 |
"TLS_ECDHE_ECDSA_WITH_NULL_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
208 |
"TLS_ECDHE_RSA_WITH_NULL_SHA", |
2 | 209 |
"SSL_DH_anon_WITH_RC4_128_MD5", |
210 |
"TLS_DH_anon_WITH_AES_128_CBC_SHA", |
|
211 |
"TLS_DH_anon_WITH_AES_256_CBC_SHA", |
|
212 |
"SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", |
|
213 |
"SSL_DH_anon_WITH_DES_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
214 |
"TLS_ECDH_anon_WITH_RC4_128_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
215 |
"TLS_ECDH_anon_WITH_AES_128_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
216 |
"TLS_ECDH_anon_WITH_AES_256_CBC_SHA", |
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
217 |
"TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA", |
2 | 218 |
"SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", |
219 |
"SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
220 |
"TLS_ECDH_anon_WITH_NULL_SHA", |
2 | 221 |
"TLS_KRB5_WITH_RC4_128_SHA", |
222 |
"TLS_KRB5_WITH_RC4_128_MD5", |
|
223 |
"TLS_KRB5_WITH_3DES_EDE_CBC_SHA", |
|
224 |
"TLS_KRB5_WITH_3DES_EDE_CBC_MD5", |
|
225 |
"TLS_KRB5_WITH_DES_CBC_SHA", |
|
226 |
"TLS_KRB5_WITH_DES_CBC_MD5", |
|
227 |
"TLS_KRB5_EXPORT_WITH_RC4_40_SHA", |
|
228 |
"TLS_KRB5_EXPORT_WITH_RC4_40_MD5", |
|
229 |
"TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA", |
|
5166
81f798aa5765
6693917: regression tests need to update for supporting ECC on solaris 11
xuelei
parents:
2
diff
changeset
|
230 |
"TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5", |
2 | 231 |
}; |
232 |
||
233 |
private static void showSuites(String[] suites) { |
|
234 |
if ((suites == null) || (suites.length == 0)) { |
|
235 |
System.out.println("<none>"); |
|
236 |
} |
|
237 |
for (int i = 0; i < suites.length; i++) { |
|
238 |
System.out.println(" " + suites[i]); |
|
239 |
} |
|
240 |
} |
|
241 |
||
242 |
public static void main(String[] args) throws Exception { |
|
243 |
long start = System.currentTimeMillis(); |
|
244 |
||
245 |
String[] ENABLED; |
|
246 |
String[] SUPPORTED; |
|
247 |
try { |
|
248 |
Cipher c = Cipher.getInstance("AES/CBC/NoPadding"); |
|
249 |
SecretKeySpec key = new SecretKeySpec(new byte[32], "AES"); |
|
250 |
c.init(Cipher.ENCRYPT_MODE, key); |
|
251 |
System.out.println("AES/256 is available"); |
|
252 |
ENABLED = ENABLED_UNLIMITED; |
|
253 |
SUPPORTED = SUPPORTED_UNLIMITED; |
|
254 |
} catch (Exception e) { |
|
255 |
System.out.println("AES/256 is NOT available (" + e + ")"); |
|
256 |
ENABLED = ENABLED_DEFAULT; |
|
257 |
SUPPORTED = SUPPORTED_DEFAULT; |
|
258 |
} |
|
259 |
||
260 |
SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault(); |
|
261 |
SSLSocket socket = (SSLSocket)factory.createSocket(); |
|
262 |
String[] enabled = socket.getEnabledCipherSuites(); |
|
263 |
||
264 |
System.out.println("Default enabled ciphersuites:"); |
|
265 |
showSuites(enabled); |
|
266 |
||
267 |
if (Arrays.equals(ENABLED, enabled) == false) { |
|
268 |
System.out.println("*** MISMATCH, should be ***"); |
|
269 |
showSuites(ENABLED); |
|
270 |
throw new Exception("Enabled ciphersuite mismatch"); |
|
271 |
} |
|
272 |
System.out.println("OK"); |
|
273 |
System.out.println(); |
|
274 |
||
275 |
String[] supported = socket.getSupportedCipherSuites(); |
|
276 |
System.out.println("Supported ciphersuites:"); |
|
277 |
showSuites(supported); |
|
278 |
||
279 |
if (Arrays.equals(SUPPORTED, supported) == false) { |
|
280 |
System.out.println("*** MISMATCH, should be ***"); |
|
281 |
showSuites(SUPPORTED); |
|
282 |
throw new Exception("Supported ciphersuite mismatch"); |
|
283 |
} |
|
284 |
System.out.println("OK"); |
|
285 |
||
286 |
long end = System.currentTimeMillis(); |
|
287 |
System.out.println("Done (" + (end - start) + " ms)."); |
|
288 |
} |
|
289 |
||
290 |
} |