author | wetmore |
Fri, 11 May 2018 15:53:12 -0700 | |
branch | JDK-8145252-TLS13-branch |
changeset 56542 | 56aaa6cb3693 |
parent 47216 | 71c04702a3d5 |
child 56570 | 60ff67126765 |
permissions | -rw-r--r-- |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
1 |
/* |
56542 | 2 |
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
4 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
8 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
13 |
* accompanied this code). |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
14 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
18 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
21 |
* questions. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
22 |
*/ |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
23 |
|
42464 | 24 |
// |
25 |
// Please run in othervm mode. SunJSSE does not support dynamic system |
|
26 |
// properties, no way to re-use system properties in samevm/agentvm mode. |
|
27 |
// |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
28 |
|
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
29 |
/* |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
30 |
* @test |
42464 | 31 |
* @bug 8161106 8170329 |
43335
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
32 |
* @modules jdk.crypto.ec |
42464 | 33 |
* @summary Improve SSLSocket test template |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
34 |
* @run main/othervm SSLSocketTemplate |
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
35 |
*/ |
43335
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
36 |
|
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
37 |
import java.io.ByteArrayInputStream; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
38 |
import java.io.InputStream; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
39 |
import java.io.IOException; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
40 |
import java.io.OutputStream; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
41 |
import javax.net.ssl.KeyManagerFactory; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
42 |
import javax.net.ssl.SSLContext; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
43 |
import javax.net.ssl.SSLServerSocket; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
44 |
import javax.net.ssl.SSLServerSocketFactory; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
45 |
import javax.net.ssl.SSLSocket; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
46 |
import javax.net.ssl.SSLSocketFactory; |
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
47 |
import javax.net.ssl.TrustManagerFactory; |
42464 | 48 |
import java.net.InetSocketAddress; |
49 |
import java.net.SocketTimeoutException; |
|
50 |
import java.security.KeyStore; |
|
51 |
import java.security.PrivateKey; |
|
52 |
import java.security.KeyFactory; |
|
53 |
import java.security.cert.Certificate; |
|
54 |
import java.security.cert.CertificateFactory; |
|
43335
911fcebb04d2
8173478: SSL related tests failes with message: "java.security.NoSuchAlgorithmException: EC KeyFactory not available"
skovalev
parents:
42920
diff
changeset
|
55 |
import java.security.spec.PKCS8EncodedKeySpec; |
42464 | 56 |
import java.util.Base64; |
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
57 |
|
42464 | 58 |
import java.util.concurrent.CountDownLatch; |
59 |
import java.util.concurrent.TimeUnit; |
|
60 |
||
61 |
/** |
|
62 |
* Template to help speed your client/server tests. |
|
63 |
* |
|
64 |
* Two examples that use this template: |
|
65 |
* test/sun/security/ssl/ServerHandshaker/AnonCipherWithWantClientAuth.java |
|
66 |
* test/sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java |
|
67 |
*/ |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
68 |
public class SSLSocketTemplate { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
69 |
|
42464 | 70 |
/* |
71 |
* ================== |
|
72 |
* Run the test case. |
|
73 |
*/ |
|
74 |
public static void main(String[] args) throws Exception { |
|
75 |
(new SSLSocketTemplate()).run(); |
|
76 |
} |
|
77 |
||
78 |
/* |
|
79 |
* Run the test case. |
|
80 |
*/ |
|
81 |
public void run() throws Exception { |
|
82 |
bootup(); |
|
83 |
} |
|
84 |
||
85 |
/* |
|
86 |
* Define the server side application of the test for the specified socket. |
|
87 |
*/ |
|
88 |
protected void runServerApplication(SSLSocket socket) throws Exception { |
|
89 |
// here comes the test logic |
|
90 |
InputStream sslIS = socket.getInputStream(); |
|
91 |
OutputStream sslOS = socket.getOutputStream(); |
|
92 |
||
93 |
sslIS.read(); |
|
94 |
sslOS.write(85); |
|
95 |
sslOS.flush(); |
|
96 |
} |
|
97 |
||
98 |
/* |
|
99 |
* Define the client side application of the test for the specified socket. |
|
100 |
* This method is used if the returned value of |
|
101 |
* isCustomizedClientConnection() is false. |
|
102 |
* |
|
103 |
* @param socket may be null is no client socket is generated. |
|
104 |
* |
|
105 |
* @see #isCustomizedClientConnection() |
|
106 |
*/ |
|
107 |
protected void runClientApplication(SSLSocket socket) throws Exception { |
|
108 |
InputStream sslIS = socket.getInputStream(); |
|
109 |
OutputStream sslOS = socket.getOutputStream(); |
|
110 |
||
111 |
sslOS.write(280); |
|
112 |
sslOS.flush(); |
|
113 |
sslIS.read(); |
|
114 |
} |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
115 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
116 |
/* |
42464 | 117 |
* Define the client side application of the test for the specified |
118 |
* server port. This method is used if the returned value of |
|
119 |
* isCustomizedClientConnection() is true. |
|
120 |
* |
|
121 |
* Note that the client need to connect to the server port by itself |
|
122 |
* for the actual message exchange. |
|
123 |
* |
|
124 |
* @see #isCustomizedClientConnection() |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
125 |
*/ |
42464 | 126 |
protected void runClientApplication(int serverPort) throws Exception { |
127 |
// blank |
|
128 |
} |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
129 |
|
42464 | 130 |
/* |
131 |
* Create an instance of SSLContext for client use. |
|
132 |
*/ |
|
133 |
protected SSLContext createClientSSLContext() throws Exception { |
|
134 |
return createSSLContext(trustedCertStrs, |
|
135 |
endEntityCertStrs, endEntityPrivateKeys, |
|
56542 | 136 |
endEntityPrivateKeyAlgs, |
42464 | 137 |
endEntityPrivateKeyNames, |
138 |
getClientContextParameters()); |
|
139 |
} |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
140 |
|
42464 | 141 |
/* |
142 |
* Create an instance of SSLContext for server use. |
|
143 |
*/ |
|
144 |
protected SSLContext createServerSSLContext() throws Exception { |
|
145 |
return createSSLContext(trustedCertStrs, |
|
146 |
endEntityCertStrs, endEntityPrivateKeys, |
|
56542 | 147 |
endEntityPrivateKeyAlgs, |
42464 | 148 |
endEntityPrivateKeyNames, |
149 |
getServerContextParameters()); |
|
150 |
} |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
151 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
152 |
/* |
42464 | 153 |
* The parameters used to configure SSLContext. |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
154 |
*/ |
42464 | 155 |
protected static final class ContextParameters { |
156 |
final String contextProtocol; |
|
157 |
final String tmAlgorithm; |
|
158 |
final String kmAlgorithm; |
|
159 |
||
160 |
ContextParameters(String contextProtocol, |
|
161 |
String tmAlgorithm, String kmAlgorithm) { |
|
162 |
||
163 |
this.contextProtocol = contextProtocol; |
|
164 |
this.tmAlgorithm = tmAlgorithm; |
|
165 |
this.kmAlgorithm = kmAlgorithm; |
|
166 |
} |
|
167 |
} |
|
168 |
||
169 |
/* |
|
170 |
* Get the client side parameters of SSLContext. |
|
171 |
*/ |
|
172 |
protected ContextParameters getClientContextParameters() { |
|
173 |
return new ContextParameters("TLS", "PKIX", "NewSunX509"); |
|
174 |
} |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
175 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
176 |
/* |
42464 | 177 |
* Get the server side parameters of SSLContext. |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
178 |
*/ |
42464 | 179 |
protected ContextParameters getServerContextParameters() { |
180 |
return new ContextParameters("TLS", "PKIX", "NewSunX509"); |
|
181 |
} |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
182 |
|
42464 | 183 |
/* |
184 |
* Does the client side use customized connection other than |
|
185 |
* explicit Socket.connect(), for example, URL.openConnection()? |
|
186 |
*/ |
|
187 |
protected boolean isCustomizedClientConnection() { |
|
188 |
return false; |
|
189 |
} |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
190 |
|
42464 | 191 |
/* |
42920
781f5e69910b
8168935: sun/security/ssl/SSLContextImpl/TrustTrustedCert.java failed Intermittently
mli
parents:
42464
diff
changeset
|
192 |
* Configure the server side socket. |
781f5e69910b
8168935: sun/security/ssl/SSLContextImpl/TrustTrustedCert.java failed Intermittently
mli
parents:
42464
diff
changeset
|
193 |
*/ |
781f5e69910b
8168935: sun/security/ssl/SSLContextImpl/TrustTrustedCert.java failed Intermittently
mli
parents:
42464
diff
changeset
|
194 |
protected void configureServerSocket(SSLServerSocket socket) { |
781f5e69910b
8168935: sun/security/ssl/SSLContextImpl/TrustTrustedCert.java failed Intermittently
mli
parents:
42464
diff
changeset
|
195 |
|
781f5e69910b
8168935: sun/security/ssl/SSLContextImpl/TrustTrustedCert.java failed Intermittently
mli
parents:
42464
diff
changeset
|
196 |
} |
781f5e69910b
8168935: sun/security/ssl/SSLContextImpl/TrustTrustedCert.java failed Intermittently
mli
parents:
42464
diff
changeset
|
197 |
|
781f5e69910b
8168935: sun/security/ssl/SSLContextImpl/TrustTrustedCert.java failed Intermittently
mli
parents:
42464
diff
changeset
|
198 |
/* |
42464 | 199 |
* ============================================= |
200 |
* Define the client and server side operations. |
|
201 |
* |
|
202 |
* If the client or server is doing some kind of object creation |
|
203 |
* that the other side depends on, and that thread prematurely |
|
204 |
* exits, you may experience a hang. The test harness will |
|
205 |
* terminate all hung threads after its timeout has expired, |
|
206 |
* currently 3 minutes by default, but you might try to be |
|
207 |
* smart about it.... |
|
208 |
*/ |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
209 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
210 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
211 |
* Is the server ready to serve? |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
212 |
*/ |
42464 | 213 |
private final CountDownLatch serverCondition = new CountDownLatch(1); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
214 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
215 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
216 |
* Is the client ready to handshake? |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
217 |
*/ |
42464 | 218 |
private final CountDownLatch clientCondition = new CountDownLatch(1); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
219 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
220 |
/* |
42464 | 221 |
* What's the server port? Use any free port by default |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
222 |
*/ |
42464 | 223 |
private volatile int serverPort = 0; |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
224 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
225 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
226 |
* Define the server side of the test. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
227 |
*/ |
42464 | 228 |
private void doServerSide() throws Exception { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
229 |
// kick start the server side service |
42464 | 230 |
SSLContext context = createServerSSLContext(); |
231 |
SSLServerSocketFactory sslssf = context.getServerSocketFactory(); |
|
232 |
SSLServerSocket sslServerSocket = |
|
233 |
(SSLServerSocket)sslssf.createServerSocket(serverPort); |
|
42920
781f5e69910b
8168935: sun/security/ssl/SSLContextImpl/TrustTrustedCert.java failed Intermittently
mli
parents:
42464
diff
changeset
|
234 |
configureServerSocket(sslServerSocket); |
42464 | 235 |
serverPort = sslServerSocket.getLocalPort(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
236 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
237 |
// Signal the client, the server is ready to accept connection. |
42464 | 238 |
serverCondition.countDown(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
239 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
240 |
// Try to accept a connection in 30 seconds. |
42464 | 241 |
SSLSocket sslSocket; |
242 |
try { |
|
243 |
sslServerSocket.setSoTimeout(30000); |
|
244 |
sslSocket = (SSLSocket)sslServerSocket.accept(); |
|
245 |
} catch (SocketTimeoutException ste) { |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
246 |
// Ignore the test case if no connection within 30 seconds. |
42464 | 247 |
System.out.println( |
248 |
"No incoming client connection in 30 seconds. " + |
|
249 |
"Ignore in server side."); |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
250 |
return; |
42464 | 251 |
} finally { |
252 |
sslServerSocket.close(); |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
253 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
254 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
255 |
// handle the connection |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
256 |
try { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
257 |
// Is it the expected client connection? |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
258 |
// |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
259 |
// Naughty test cases or third party routines may try to |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
260 |
// connection to this server port unintentionally. In |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
261 |
// order to mitigate the impact of unexpected client |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
262 |
// connections and avoid intermittent failure, it should |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
263 |
// be checked that the accepted connection is really linked |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
264 |
// to the expected client. |
42464 | 265 |
boolean clientIsReady = |
266 |
clientCondition.await(30L, TimeUnit.SECONDS); |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
267 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
268 |
if (clientIsReady) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
269 |
// Run the application in server side. |
42464 | 270 |
runServerApplication(sslSocket); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
271 |
} else { // Otherwise, ignore |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
272 |
// We don't actually care about plain socket connections |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
273 |
// for TLS communication testing generally. Just ignore |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
274 |
// the test if the accepted connection is not linked to |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
275 |
// the expected client or the client connection timeout |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
276 |
// in 30 seconds. |
42464 | 277 |
System.out.println( |
278 |
"The client is not the expected one or timeout. " + |
|
279 |
"Ignore in server side."); |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
280 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
281 |
} finally { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
282 |
sslSocket.close(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
283 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
284 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
285 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
286 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
287 |
* Define the client side of the test. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
288 |
*/ |
42464 | 289 |
private void doClientSide() throws Exception { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
290 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
291 |
// Wait for server to get started. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
292 |
// |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
293 |
// The server side takes care of the issue if the server cannot |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
294 |
// get started in 90 seconds. The client side would just ignore |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
295 |
// the test case if the serer is not ready. |
42464 | 296 |
boolean serverIsReady = |
297 |
serverCondition.await(90L, TimeUnit.SECONDS); |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
298 |
if (!serverIsReady) { |
42464 | 299 |
System.out.println( |
300 |
"The server is not ready yet in 90 seconds. " + |
|
301 |
"Ignore in client side."); |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
302 |
return; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
303 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
304 |
|
42464 | 305 |
if (isCustomizedClientConnection()) { |
306 |
// Signal the server, the client is ready to communicate. |
|
307 |
clientCondition.countDown(); |
|
308 |
||
309 |
// Run the application in client side. |
|
310 |
runClientApplication(serverPort); |
|
311 |
||
312 |
return; |
|
313 |
} |
|
314 |
||
315 |
SSLContext context = createClientSSLContext(); |
|
316 |
SSLSocketFactory sslsf = context.getSocketFactory(); |
|
317 |
||
318 |
try (SSLSocket sslSocket = (SSLSocket)sslsf.createSocket()) { |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
319 |
try { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
320 |
sslSocket.connect( |
42464 | 321 |
new InetSocketAddress("localhost", serverPort), 15000); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
322 |
} catch (IOException ioe) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
323 |
// The server side may be impacted by naughty test cases or |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
324 |
// third party routines, and cannot accept connections. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
325 |
// |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
326 |
// Just ignore the test if the connection cannot be |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
327 |
// established. |
42464 | 328 |
System.out.println( |
329 |
"Cannot make a connection in 15 seconds. " + |
|
330 |
"Ignore in client side."); |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
331 |
return; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
332 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
333 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
334 |
// OK, here the client and server get connected. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
335 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
336 |
// Signal the server, the client is ready to communicate. |
42464 | 337 |
clientCondition.countDown(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
338 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
339 |
// There is still a chance in theory that the server thread may |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
340 |
// wait client-ready timeout and then quit. The chance should |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
341 |
// be really rare so we don't consider it until it becomes a |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
342 |
// real problem. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
343 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
344 |
// Run the application in client side. |
42464 | 345 |
runClientApplication(sslSocket); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
346 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
347 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
348 |
|
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
349 |
/* |
42464 | 350 |
* ============================================= |
351 |
* Stuffs to customize the SSLContext instances. |
|
352 |
*/ |
|
353 |
||
354 |
/* |
|
355 |
* ======================================= |
|
356 |
* Certificates and keys used in the test. |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
357 |
*/ |
42464 | 358 |
// Trusted certificates. |
359 |
private final static String[] trustedCertStrs = { |
|
360 |
// SHA256withECDSA, curve prime256v1 |
|
361 |
// Validity |
|
362 |
// Not Before: Nov 25 04:19:51 2016 GMT |
|
363 |
// Not After : Nov 5 04:19:51 2037 GMT |
|
364 |
// Subject Key Identifier: |
|
365 |
// CA:48:E8:00:C1:42:BD:59:9B:79:D9:B4:B4:CE:3F:68:0C:C8:C4:0C |
|
366 |
"-----BEGIN CERTIFICATE-----\n" + |
|
367 |
"MIICHDCCAcGgAwIBAgIJAJtKs6ZEcVjxMAoGCCqGSM49BAMCMDsxCzAJBgNVBAYT\n" + |
|
368 |
"AlVTMQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + |
|
369 |
"ZTAeFw0xNjExMjUwNDE5NTFaFw0zNzExMDUwNDE5NTFaMDsxCzAJBgNVBAYTAlVT\n" + |
|
370 |
"MQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2VyaXZjZTBZ\n" + |
|
371 |
"MBMGByqGSM49AgEGCCqGSM49AwEHA0IABKMO/AFDHZia65RaqMIBX7WBdtzFj8fz\n" + |
|
372 |
"ggqMADLJhoszS6qfTUDYskETw3uHfB3KAOENsoKX446qFFPuVjxS1aejga0wgaow\n" + |
|
373 |
"HQYDVR0OBBYEFMpI6ADBQr1Zm3nZtLTOP2gMyMQMMGsGA1UdIwRkMGKAFMpI6ADB\n" + |
|
374 |
"Qr1Zm3nZtLTOP2gMyMQMoT+kPTA7MQswCQYDVQQGEwJVUzENMAsGA1UEChMESmF2\n" + |
|
375 |
"YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2WCCQCbSrOmRHFY8TAPBgNV\n" + |
|
376 |
"HRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBBjAKBggqhkjOPQQDAgNJADBGAiEA5cJ/\n" + |
|
377 |
"jirBbXxzpZ6kdp/Zb/yrIBnr4jiPGJTLgRTb8s4CIQChUDfP1Zqg0qJVfqFNaL4V\n" + |
|
378 |
"a0EAeJHXGZnvCGGqHzoxkg==\n" + |
|
379 |
"-----END CERTIFICATE-----", |
|
380 |
||
381 |
// SHA256withRSA, 2048 bits |
|
382 |
// Validity |
|
56542 | 383 |
// Not Before: Apr 12 06:51:49 2018 GMT |
384 |
// Not After : Apr 7 06:51:49 2038 GMT |
|
42464 | 385 |
// Subject Key Identifier: |
56542 | 386 |
// 14:AE:A5:A9:2C:0F:E3:25:BA:1B:AD:B6:A7:DB:07:F0:4D:14:49:97 |
42464 | 387 |
"-----BEGIN CERTIFICATE-----\n" + |
56542 | 388 |
"MIIDTDCCAjSgAwIBAgIJALzz9cKBmONRMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNV\n" + |
389 |
"BAYTAlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2Vy\n" + |
|
390 |
"aXZjZTAeFw0xODA0MTIwNjUxNDlaFw0zODA0MDcwNjUxNDlaMDsxCzAJBgNVBAYT\n" + |
|
391 |
"AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + |
|
392 |
"ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANPfPtImftkV2UAB+QPa\n" + |
|
393 |
"R9udeRxApNphb+70T1p3GFql8sUG6/Rbao5H1QllzZ22+J6xoLVftaDp1S3QibTn\n" + |
|
394 |
"3hv0KPuzsA7zi83GRp8STSHcwOU5zq5yzkFEPQrQxOYfaRzLrv7+sznXpaWCPb/6\n" + |
|
395 |
"wGktZrHBXZE0eT1wid7h3DoiOCu1BBLPAImiSk5SVadvQkk6uua4W3M78dzbrE8s\n" + |
|
396 |
"k6O40Nxyi3gVURU0U/IIm8ur89rYUThzlEdTKRdUfG38oyUvqFclwCbp+3F9BxIa\n" + |
|
397 |
"5WWmj0avrSFCAuwAoCY762Iah0bRv1SKTE9RzO1P07GNyyIuOZ2J6TlXVBWfzE9V\n" + |
|
398 |
"DmcCAwEAAaNTMFEwHQYDVR0OBBYEFBSupaksD+MluhuttqfbB/BNFEmXMB8GA1Ud\n" + |
|
399 |
"IwQYMBaAFBSupaksD+MluhuttqfbB/BNFEmXMA8GA1UdEwEB/wQFMAMBAf8wDQYJ\n" + |
|
400 |
"KoZIhvcNAQELBQADggEBALXVlY46/qvk7aVrDbJ/u/jmA+gGnEF7PZWg6tuwzME/\n" + |
|
401 |
"GDd28xwALHw+MgH6sFkKnCCfGnzuLPUMezMNLQxj+uosJvDHkBJ7hReDfowMcTz2\n" + |
|
402 |
"j0IR+RljNfGcd8lyfq9Jc6t8tTlPLG1ek/ObIMU/NLeK3faqGFLmoJ+xiDGVWhk3\n" + |
|
403 |
"uPhvc1l1riWaIP67PxpHOuBbOwwFyrkQ7jC0ymi0bdwG4m6BQ1KbWNXoWBnVSTNN\n" + |
|
404 |
"94C+FOEN6WnxwdX0BA2CPObs3YiUjctzXYaSixG952Lh6lwasrhqd1h6fogtTS4M\n" + |
|
405 |
"7dfJ99aNjmiQroC7xIe7OIRmGM/UbwA/K5zfQSayuNQ=\n" + |
|
42464 | 406 |
"-----END CERTIFICATE-----", |
407 |
||
408 |
// SHA256withDSA, 2048 bits |
|
409 |
// Validity |
|
410 |
// Not Before: Nov 25 04:19:56 2016 GMT |
|
411 |
// Not After : Nov 5 04:19:56 2037 GMT |
|
412 |
// Subject Key Identifier: |
|
413 |
// 19:46:10:43:24:6A:A5:14:BE:E2:92:01:79:F0:4C:5F:E1:AE:81:B5 |
|
414 |
"-----BEGIN CERTIFICATE-----\n" + |
|
415 |
"MIIFCzCCBLGgAwIBAgIJAOnEn6YZD/sAMAsGCWCGSAFlAwQDAjA7MQswCQYDVQQG\n" + |
|
416 |
"EwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2\n" + |
|
417 |
"Y2UwHhcNMTYxMTI1MDQxOTU2WhcNMzcxMTA1MDQxOTU2WjA7MQswCQYDVQQGEwJV\n" + |
|
418 |
"UzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2Y2Uw\n" + |
|
419 |
"ggNGMIICOQYHKoZIzjgEATCCAiwCggEBAJa17ZYdIChv5yeYuPK3zXxgUEGGsdUD\n" + |
|
420 |
"AzfQUxtMryCtc3aNgWLxsN1/QYvp9v+hh4twnG20VemCEH9Qlx06Pxg74DwSOA83\n" + |
|
421 |
"SecO2y7cdgmrHpep9drxKbXVZafwBhbTSwhV+IDO7EO6+LaRvZuya/YOqNIE9ENx\n" + |
|
422 |
"FVk0NrNsDB6pfDEXZsCZALMN2mcl8KGn1q7vdzJQUEV7F6uLGP33znVfmQyWJH3Y\n" + |
|
423 |
"W09WVCFXHvDzZHGXDO2O2QwIU1B5AsXnOGeLnKgXzErCoNKwUbVFP0W0OVeJo4pc\n" + |
|
424 |
"ZfL/8TVELGG90AuuH1V3Gsq6PdzCDPw4Uv/v5m7/6kwXqBQxAJA7jhMCIQCORIGV\n" + |
|
425 |
"mHy5nBLRhIP4vC7vsTxb4CTApPVmZeL5gTIwtQKCAQB2VZLY22k2+IQM6deRGK3L\n" + |
|
426 |
"l7tPChGrKnGmTbtUThIza70Sp9DmTBiLzMEY+IgG8kYuT5STVxWjs0cxXCKZGMQW\n" + |
|
427 |
"tioMtiXPA2M3HA0/8E0mDLSmzb0RAd2xxnDyGsuqo1eVmx7PLjN3bn3EjhD/+j3d\n" + |
|
428 |
"Jx3ZVScMGyq7sVWppUvpudEXi+2etf6GUHjrcX27juo7u4zQ1ezC/HYG1H+jEFqG\n" + |
|
429 |
"hdQ6b7H+LBHZH9LegOyIZTMrzAY/TwIr77sXrNJWRoxmDErKB+8bRDybYhNJswlZ\n" + |
|
430 |
"m0N5YYUlPmepgbl6XzwCv0y0d81h3bayqIPLXEUtRAl9GuM0hNAlA1Y+qSn9xLFY\n" + |
|
431 |
"A4IBBQACggEAZgWC0uflwqQQP1GRU1tolmFZwyVtKre7SjYgCeQBrOa0Xnj/SLaD\n" + |
|
432 |
"g1HZ1oH0hccaR/45YouJiCretbbsQ77KouldGSGqTHJgRL75Y2z5uvxa60+YxZ0Z\n" + |
|
433 |
"v8xvZnj4seyOjgJLxSSYSPl5n/F70RaNiCLVz/kGe6OQ8KoAeQjdDTOHXCegO9KX\n" + |
|
434 |
"tvhM7EaYc8CII9OIR7S7PXJW0hgLKynZcu/Unh02aM0ABh/uLmw1+tvo8e8KTp98\n" + |
|
435 |
"NKYSVf6kV3/ya58n4h64UbIYL08JoKUM/5SFETcKAZTU0YKZbpWTM79oJMr8oYVk\n" + |
|
436 |
"P9jKitNsXq0Xkzt5dSO0kfu/kM7zpnaFsqOBrTCBqjAdBgNVHQ4EFgQUGUYQQyRq\n" + |
|
437 |
"pRS+4pIBefBMX+GugbUwawYDVR0jBGQwYoAUGUYQQyRqpRS+4pIBefBMX+GugbWh\n" + |
|
438 |
"P6Q9MDsxCzAJBgNVBAYTAlVTMQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5K\n" + |
|
439 |
"U1NFIFRlc3QgU2VyaXZjZYIJAOnEn6YZD/sAMA8GA1UdEwEB/wQFMAMBAf8wCwYD\n" + |
|
440 |
"VR0PBAQDAgEGMAsGCWCGSAFlAwQDAgNHADBEAiAwBafz5RRR9nc4cCYoYuBlT/D9\n" + |
|
441 |
"9eayhkjhBY/zYunypwIgNp/JnFR88/T4hh36QfSKBGXId9RBCM6uaOkOKnEGkps=\n" + |
|
442 |
"-----END CERTIFICATE-----" |
|
443 |
}; |
|
444 |
||
445 |
// End entity certificate. |
|
446 |
private final static String[] endEntityCertStrs = { |
|
447 |
// SHA256withECDSA, curve prime256v1 |
|
448 |
// Validity |
|
449 |
// Not Before: Nov 25 04:19:51 2016 GMT |
|
450 |
// Not After : Aug 12 04:19:51 2036 GMT |
|
451 |
// Authority Key Identifier: |
|
452 |
// CA:48:E8:00:C1:42:BD:59:9B:79:D9:B4:B4:CE:3F:68:0C:C8:C4:0C |
|
453 |
"-----BEGIN CERTIFICATE-----\n" + |
|
454 |
"MIIB1zCCAXygAwIBAgIJAPFq2QL/nUNZMAoGCCqGSM49BAMCMDsxCzAJBgNVBAYT\n" + |
|
455 |
"AlVTMQ0wCwYDVQQKEwRKYXZhMR0wGwYDVQQLExRTdW5KU1NFIFRlc3QgU2VyaXZj\n" + |
|
456 |
"ZTAeFw0xNjExMjUwNDE5NTFaFw0zNjA4MTIwNDE5NTFaMFUxCzAJBgNVBAYTAlVT\n" + |
|
457 |
"MQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZjZTEY\n" + |
|
458 |
"MBYGA1UEAwwPUmVncmVzc2lvbiBUZXN0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD\n" + |
|
459 |
"QgAE4yvRGVvy9iVATyuHPJVdX6+lh/GLm/sRJ5qLT/3PVFOoNIvlEVNiARo7xhyj\n" + |
|
460 |
"2p6bnf32gNg5Ye+QCw20VUv9E6NPME0wCwYDVR0PBAQDAgPoMB0GA1UdDgQWBBSO\n" + |
|
461 |
"hHlHZQp9hyBfSGTSQWeszqMXejAfBgNVHSMEGDAWgBTKSOgAwUK9WZt52bS0zj9o\n" + |
|
462 |
"DMjEDDAKBggqhkjOPQQDAgNJADBGAiEAu3t6cvFglBAZfkhZlEwB04ZjUFqyfiRj\n" + |
|
463 |
"4Hr275E4ZoQCIQDUEonJHlmA19J6oobfR5lYsmoqPm1r0DPm/IiNNKGKKA==\n" + |
|
464 |
"-----END CERTIFICATE-----", |
|
465 |
||
466 |
// SHA256withRSA, 2048 bits |
|
467 |
// Validity |
|
56542 | 468 |
// Not Before: Apr 12 06:52:29 2018 GMT |
469 |
// Not After : Apr 7 06:52:29 2038 GMT |
|
42464 | 470 |
// Authority Key Identifier: |
56542 | 471 |
// 14:AE:A5:A9:2C:0F:E3:25:BA:1B:AD:B6:A7:DB:07:F0:4D:14:49:97 |
42464 | 472 |
"-----BEGIN CERTIFICATE-----\n" + |
56542 | 473 |
"MIIDDDCCAfQCCQDd9PfUCpKn0DANBgkqhkiG9w0BAQsFADA7MQswCQYDVQQGEwJV\n" + |
474 |
"UzENMAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2Y2Uw\n" + |
|
475 |
"HhcNMTgwNDEyMDY1MjI5WhcNMzgwNDA3MDY1MjI5WjBVMQswCQYDVQQGEwJVUzEN\n" + |
|
476 |
"MAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2Y2UxGDAW\n" + |
|
477 |
"BgNVBAMMD1JlZ3Jlc3Npb24gVGVzdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\n" + |
|
478 |
"AQoCggEBAJWFd+AEAZWRBbua9ax4CJgyXoU3Nx9zwkxbxz2DGZ5sJb/64b/mKBz4\n" + |
|
479 |
"mgT6cknJPrCv3vLg9v6WzlpIqISzEP6ARxmMDTomt8ppRFqDq31uGJ3cKWvhpwG1\n" + |
|
480 |
"92HwJUxvbjZYvqszXA5piOtFWa+uBavKSF/dXXrMXijDl6LbL3GU4pZLmeUP8PRy\n" + |
|
481 |
"UfwWhcy3HikBIx7fGCcNB+dHXtB5DTgxdR8ypTCB5xFfhgL9EqO8X0pin+bubfpF\n" + |
|
482 |
"5IY68p5B4ob7EdNmBCTUyFAN3Mh9r49ZzwpYIvi9shNmddwMakJOB9YaMsRmc3Ea\n" + |
|
483 |
"mUVpdR0fR8bY5RtgZwEhtaizp2DkS0ECAwEAATANBgkqhkiG9w0BAQsFAAOCAQEA\n" + |
|
484 |
"pUqCPnpeUITq9tfDdB9rolb5dV3fIhRtj0rsjimKbcMAeYAkb3qHvlZOLZ/PMD3v\n" + |
|
485 |
"y8J9TJ88YPGGOUXCsAqJ88Ous883xqLkOjZYEiY/0gdU2/v6uQ35lgHtJynmzO3E\n" + |
|
486 |
"YUbwleJETUNA66sOtiW7om9vcAVPu3mmea5bZkkdwxydn/IZvVYp5JLu4MuJpfh1\n" + |
|
487 |
"lWpC3z2U7DgZrt4ZQGzok+DRnGiKIOo+G2JvLVIKz/rbsIbjDBqQTdt7TKLu8wbV\n" + |
|
488 |
"UdN8SOF7qZhBpiwQHZCmiw8KhQ5R/aNDQxCVfMOXcAGqmiFpdHPqWgxCob778mjc\n" + |
|
489 |
"Na2CGaztVh+f9MSz3j/Hmg==\n" + |
|
490 |
"-----END CERTIFICATE-----", |
|
491 |
||
492 |
// SHA256withRSA, curv prime256v1 |
|
493 |
// Validity |
|
494 |
// Not Before: Apr 12 06:54:43 2018 GMT |
|
495 |
// Not After : Apr 7 06:54:43 2038 GMT |
|
496 |
// Authority Key Identifier: |
|
497 |
// 14:AE:A5:A9:2C:0F:E3:25:BA:1B:AD:B6:A7:DB:07:F0:4D:14:49:97 |
|
498 |
"-----BEGIN CERTIFICATE-----\n" + |
|
499 |
"MIICQTCCASkCCQDd9PfUCpKn0TANBgkqhkiG9w0BAQsFADA7MQswCQYDVQQGEwJV\n" + |
|
500 |
"UzENMAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2Y2Uw\n" + |
|
501 |
"HhcNMTgwNDEyMDY1NDQzWhcNMzgwNDA3MDY1NDQzWjBVMQswCQYDVQQGEwJVUzEN\n" + |
|
502 |
"MAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2Y2UxGDAW\n" + |
|
503 |
"BgNVBAMMD1JlZ3Jlc3Npb24gVGVzdDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA\n" + |
|
504 |
"BOlOthBVzSCU0TPRiW+O4mhOn0ZHE338wLhy4HYiMnuBVWzl2L7krSpCXKM/b//a\n" + |
|
505 |
"/0YPobAEXKbShh0oFxo51IIwDQYJKoZIhvcNAQELBQADggEBAD/a7z31ODFCSdyf\n" + |
|
506 |
"AUq5vYsVZIV4s2J2tJh5piYoipP0BKRcthw1RtvqbNZFjB5DLyWVq39Tk6gCJvKo\n" + |
|
507 |
"csaV3O/VRaQWRyLD1Ak7T0oG5eZDlpYWwjzyMMR32NjOyRG6clWWQx5O7Pc2uxvz\n" + |
|
508 |
"GL8Pf+YgKU5QLqcghN+104e3+GMzmNccmK5nBmr2Lz1Hy54JxGRXUEKI85VoiUgk\n" + |
|
509 |
"ArF0RLeUQxBFFBrYBsqLY6DI+Rgvhxk9ri9Udoa3sn8pYfNqxe1beyazbn4ChM6z\n" + |
|
510 |
"y/7/we+wAnPaPSReugkDO4w/XqUGKa26EiPrQ/9s0QGhKyqeNg/CRY+FEH0sEjuK\n" + |
|
511 |
"ycLgJK0=\n" + |
|
42464 | 512 |
"-----END CERTIFICATE-----", |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
513 |
|
42464 | 514 |
// SHA256withDSA, 2048 bits |
515 |
// Validity |
|
516 |
// Not Before: Nov 25 04:19:56 2016 GMT |
|
517 |
// Not After : Aug 12 04:19:56 2036 GMT |
|
518 |
// Authority Key Identifier: |
|
519 |
// 19:46:10:43:24:6A:A5:14:BE:E2:92:01:79:F0:4C:5F:E1:AE:81:B5 |
|
520 |
"-----BEGIN CERTIFICATE-----\n" + |
|
521 |
"MIIE2jCCBICgAwIBAgIJAONcI1oba9V9MAsGCWCGSAFlAwQDAjA7MQswCQYDVQQG\n" + |
|
522 |
"EwJVUzENMAsGA1UEChMESmF2YTEdMBsGA1UECxMUU3VuSlNTRSBUZXN0IFNlcml2\n" + |
|
523 |
"Y2UwHhcNMTYxMTI1MDQxOTU2WhcNMzYwODEyMDQxOTU2WjBVMQswCQYDVQQGEwJV\n" + |
|
524 |
"UzENMAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2Y2Ux\n" + |
|
525 |
"GDAWBgNVBAMMD1JlZ3Jlc3Npb24gVGVzdDCCA0YwggI5BgcqhkjOOAQBMIICLAKC\n" + |
|
526 |
"AQEAlrXtlh0gKG/nJ5i48rfNfGBQQYax1QMDN9BTG0yvIK1zdo2BYvGw3X9Bi+n2\n" + |
|
527 |
"/6GHi3CcbbRV6YIQf1CXHTo/GDvgPBI4DzdJ5w7bLtx2Casel6n12vEptdVlp/AG\n" + |
|
528 |
"FtNLCFX4gM7sQ7r4tpG9m7Jr9g6o0gT0Q3EVWTQ2s2wMHql8MRdmwJkAsw3aZyXw\n" + |
|
529 |
"oafWru93MlBQRXsXq4sY/ffOdV+ZDJYkfdhbT1ZUIVce8PNkcZcM7Y7ZDAhTUHkC\n" + |
|
530 |
"xec4Z4ucqBfMSsKg0rBRtUU/RbQ5V4mjilxl8v/xNUQsYb3QC64fVXcayro93MIM\n" + |
|
531 |
"/DhS/+/mbv/qTBeoFDEAkDuOEwIhAI5EgZWYfLmcEtGEg/i8Lu+xPFvgJMCk9WZl\n" + |
|
532 |
"4vmBMjC1AoIBAHZVktjbaTb4hAzp15EYrcuXu08KEasqcaZNu1ROEjNrvRKn0OZM\n" + |
|
533 |
"GIvMwRj4iAbyRi5PlJNXFaOzRzFcIpkYxBa2Kgy2Jc8DYzccDT/wTSYMtKbNvREB\n" + |
|
534 |
"3bHGcPIay6qjV5WbHs8uM3dufcSOEP/6Pd0nHdlVJwwbKruxVamlS+m50ReL7Z61\n" + |
|
535 |
"/oZQeOtxfbuO6ju7jNDV7ML8dgbUf6MQWoaF1Dpvsf4sEdkf0t6A7IhlMyvMBj9P\n" + |
|
536 |
"Aivvuxes0lZGjGYMSsoH7xtEPJtiE0mzCVmbQ3lhhSU+Z6mBuXpfPAK/TLR3zWHd\n" + |
|
537 |
"trKog8tcRS1ECX0a4zSE0CUDVj6pKf3EsVgDggEFAAKCAQBEGmdP55PyE3M+Q3fU\n" + |
|
538 |
"dCGq0sbKw/04xPVhaNYRnRKNR82n+wb8bMCI1vvFqXy1BB6svti4mTHbQZ8+bQXm\n" + |
|
539 |
"gyce67uYMwIa5BIk6omNGCeW/kd4ruPgyFxeb6O/Y/7w6AWyRmQttlxRA5M5OhSC\n" + |
|
540 |
"tVS4oVC1KK1EfHAUh7mu8S8GrWJoJAWA3PM97Oy/HSGCEUl6HGEu1m7FHPhOKeYG\n" + |
|
541 |
"cLkSaov5cbCYO76smHchI+tdUciVqeL3YKQdS+KAzsQoeAZIu/WpbaI1V+5/rSG1\n" + |
|
542 |
"I94uBITLCjlJfJZ1aredCDrRXOFH7qgSBhM8/WzwFpFCnnpbSKMgrcrKubsFmW9E\n" + |
|
543 |
"jQhXo2MwYTALBgNVHQ8EBAMCA+gwHQYDVR0OBBYEFNA9PhQOjB+05fxxXPNqe0OT\n" + |
|
544 |
"doCjMB8GA1UdIwQYMBaAFBlGEEMkaqUUvuKSAXnwTF/hroG1MBIGA1UdEQEB/wQI\n" + |
|
545 |
"MAaHBH8AAAEwCwYJYIZIAWUDBAMCA0cAMEQCIE0LM2sZi+L8tjH9sgjLEwJmYZvO\n" + |
|
546 |
"yqNfQnXrkTCb+MLMAiBZLaRTVJrOW3edQjum+SonKKuiN22bRclO6pGuNRCtng==\n" + |
|
547 |
"-----END CERTIFICATE-----" |
|
548 |
}; |
|
549 |
||
550 |
// Private key in the format of PKCS#8. |
|
551 |
private final static String[] endEntityPrivateKeys = { |
|
552 |
// |
|
553 |
// EC private key related to cert endEntityCertStrs[0]. |
|
554 |
// |
|
555 |
"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgGAy4Pxrd2keM7AdP\n" + |
|
556 |
"VNUMEO5iO681v4/tstVGfdXkCTuhRANCAATjK9EZW/L2JUBPK4c8lV1fr6WH8Yub\n" + |
|
557 |
"+xEnmotP/c9UU6g0i+URU2IBGjvGHKPanpud/faA2Dlh75ALDbRVS/0T", |
|
558 |
||
559 |
// |
|
560 |
// RSA private key related to cert endEntityCertStrs[1]. |
|
561 |
// |
|
56542 | 562 |
"MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCVhXfgBAGVkQW7\n" + |
563 |
"mvWseAiYMl6FNzcfc8JMW8c9gxmebCW/+uG/5igc+JoE+nJJyT6wr97y4Pb+ls5a\n" + |
|
564 |
"SKiEsxD+gEcZjA06JrfKaURag6t9bhid3Clr4acBtfdh8CVMb242WL6rM1wOaYjr\n" + |
|
565 |
"RVmvrgWrykhf3V16zF4ow5ei2y9xlOKWS5nlD/D0clH8FoXMtx4pASMe3xgnDQfn\n" + |
|
566 |
"R17QeQ04MXUfMqUwgecRX4YC/RKjvF9KYp/m7m36ReSGOvKeQeKG+xHTZgQk1MhQ\n" + |
|
567 |
"DdzIfa+PWc8KWCL4vbITZnXcDGpCTgfWGjLEZnNxGplFaXUdH0fG2OUbYGcBIbWo\n" + |
|
568 |
"s6dg5EtBAgMBAAECggEBAI5toQ8HQesTRf67UaKEhMtVz6veOOgBAOhz1IrHwzOh\n" + |
|
569 |
"mSQS+9AskbFnLm/nkc6voMP2A84gdad2SALAi6Y8XMfRsein/EGUeCabt7zxB/5n\n" + |
|
570 |
"TZOyENLvFIMQryHf++efjcC/MIEsX1hrNz3FxfUPM9+8xMxstYsv+dGi32MGn171\n" + |
|
571 |
"G1AKFOqs/n0X16Sh1kLtkHq1xaqZJUYQyrBasFtCPDwCFhhkwsxGQZ2Dcy3gFDxy\n" + |
|
572 |
"5O5IMSxFtaoiTLrnA/X4MxM3OyA57EG+KWtrokahTMmhPwysodlIS8kw3ROtCYBx\n" + |
|
573 |
"7FLclf49LDtiUtjLoyF+I8WCr44/zp7c13HlBijoNAECgYEAxdSLeCkWSuopZmjP\n" + |
|
574 |
"j0Cj00pME3W3gsy/1QQxRM+FfRQ6U1evNLp4JKakJUlZ+/xtsd1H9a6FAEzrgcbJ\n" + |
|
575 |
"xY8W++3IFUNLYop9c9/VXaaKLG2QyfoqBNAHROKyRxoKihDdPgNFwxcwI2tWJEnE\n" + |
|
576 |
"kBDZ+Kn4dAcxO3j/nVzD/Gvg5PECgYEAwXyGSo7Xzf0zwej1uVx5kSOKfn5dRUbr\n" + |
|
577 |
"2DDUleMFm7pnOIDriQ+pz6euROJNieoesX1Bo/PaML2095ljb19DI9U1OWMXFhTL\n" + |
|
578 |
"lKH/yOuDAdUTswp085ohPOCr48+QWLL6Awicd08L6tjg7Fm4j+VXaaNBbXuXOfjG\n" + |
|
579 |
"KeK+FOU9i1ECgYA4NNcbYLEQv87bZdPy426oTWen774fz4SBRRuqbTuD+gdIPpVs\n" + |
|
580 |
"6b3Qy/e/EEQcr++KpVAYoWjwWOpgiNYy5yCkmz5JrEDy0l4qWeIJJZQEY2zLtePS\n" + |
|
581 |
"Ujh+fdohEWkFKR1yzQM5FpF6vrhOvxa1x9PmLoSEkraOKyaU0xJr2UqgQQKBgGG1\n" + |
|
582 |
"yPuN912HKMQcKTtaf+nT0PTgS6nYjvG2dyTaaNKj58yZDllBF7hOLauLvSyQlr97\n" + |
|
583 |
"SdLKKr3Cj8kaJSTxLq7B1QcOC3KTPdvpk4qbpKUgPbqE5Vq/01ky/JsnDvY8LBWs\n" + |
|
584 |
"G5gEyzfmHnA9Pv8sCmDGmRv49f3IrAoq/2L+AX6BAoGBAJ1Wf2Qg8ox75ir0e1kH\n" + |
|
585 |
"8r+Lmr3gsoxKfh/0fTPV5mbH7PBOSzXwg5fiDUngy9aMDkqCAum5y2Jg0aHhx1Df\n" + |
|
586 |
"0dTiKsMBCEmPI3/2/O6gJ+HJ0xX6LxmwU9m21xM055IuS5oDXJhonJa2fWusQS1s\n" + |
|
587 |
"oqd5EGtoPFy0ccqHzYCv3F5A", |
|
42464 | 588 |
|
589 |
// |
|
56542 | 590 |
// EC private key related to cert endEntityCertStrs[2]. |
591 |
// |
|
592 |
"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgomzbfLMRU6+4FNsa\n" + |
|
593 |
"KQ+qutNxLGgKmRcXWGbFKt71RzqhRANCAATpTrYQVc0glNEz0YlvjuJoTp9GRxN9\n" + |
|
594 |
"/MC4cuB2IjJ7gVVs5di+5K0qQlyjP2//2v9GD6GwBFym0oYdKBcaOdSC", |
|
595 |
||
596 |
// |
|
597 |
// DSA private key related to cert endEntityCertStrs[3]. |
|
42464 | 598 |
// |
599 |
"MIICZAIBADCCAjkGByqGSM44BAEwggIsAoIBAQCWte2WHSAob+cnmLjyt818YFBB\n" + |
|
600 |
"hrHVAwM30FMbTK8grXN2jYFi8bDdf0GL6fb/oYeLcJxttFXpghB/UJcdOj8YO+A8\n" + |
|
601 |
"EjgPN0nnDtsu3HYJqx6XqfXa8Sm11WWn8AYW00sIVfiAzuxDuvi2kb2bsmv2DqjS\n" + |
|
602 |
"BPRDcRVZNDazbAweqXwxF2bAmQCzDdpnJfChp9au73cyUFBFexerixj99851X5kM\n" + |
|
603 |
"liR92FtPVlQhVx7w82RxlwztjtkMCFNQeQLF5zhni5yoF8xKwqDSsFG1RT9FtDlX\n" + |
|
604 |
"iaOKXGXy//E1RCxhvdALrh9VdxrKuj3cwgz8OFL/7+Zu/+pMF6gUMQCQO44TAiEA\n" + |
|
605 |
"jkSBlZh8uZwS0YSD+Lwu77E8W+AkwKT1ZmXi+YEyMLUCggEAdlWS2NtpNviEDOnX\n" + |
|
606 |
"kRity5e7TwoRqypxpk27VE4SM2u9EqfQ5kwYi8zBGPiIBvJGLk+Uk1cVo7NHMVwi\n" + |
|
607 |
"mRjEFrYqDLYlzwNjNxwNP/BNJgy0ps29EQHdscZw8hrLqqNXlZsezy4zd259xI4Q\n" + |
|
608 |
"//o93Scd2VUnDBsqu7FVqaVL6bnRF4vtnrX+hlB463F9u47qO7uM0NXswvx2BtR/\n" + |
|
609 |
"oxBahoXUOm+x/iwR2R/S3oDsiGUzK8wGP08CK++7F6zSVkaMZgxKygfvG0Q8m2IT\n" + |
|
610 |
"SbMJWZtDeWGFJT5nqYG5el88Ar9MtHfNYd22sqiDy1xFLUQJfRrjNITQJQNWPqkp\n" + |
|
611 |
"/cSxWAQiAiAKHYbYwEy0XS9J0MeKQmqPswn0nCJKvH+esfMKkZvV3w==" |
|
612 |
}; |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
613 |
|
56542 | 614 |
// Private key algorithm of endEntityPrivateKeys. |
615 |
private final static String[] endEntityPrivateKeyAlgs = { |
|
616 |
"EC", |
|
617 |
"RSA", |
|
618 |
"EC", |
|
619 |
"DSA", |
|
620 |
}; |
|
621 |
||
42464 | 622 |
// Private key names of endEntityPrivateKeys. |
623 |
private final static String[] endEntityPrivateKeyNames = { |
|
56542 | 624 |
"ecdsa", |
625 |
"rsa", |
|
626 |
"ec-rsa", |
|
627 |
"dsa", |
|
42464 | 628 |
}; |
629 |
||
630 |
/* |
|
631 |
* Create an instance of SSLContext with the specified trust/key materials. |
|
632 |
*/ |
|
633 |
private SSLContext createSSLContext( |
|
634 |
String[] trustedMaterials, |
|
635 |
String[] keyMaterialCerts, |
|
636 |
String[] keyMaterialKeys, |
|
637 |
String[] keyMaterialKeyAlgs, |
|
56542 | 638 |
String[] keyMaterialKeyNames, |
42464 | 639 |
ContextParameters params) throws Exception { |
640 |
||
641 |
KeyStore ts = null; // trust store |
|
642 |
KeyStore ks = null; // key store |
|
643 |
char passphrase[] = "passphrase".toCharArray(); |
|
644 |
||
645 |
// Generate certificate from cert string. |
|
646 |
CertificateFactory cf = CertificateFactory.getInstance("X.509"); |
|
647 |
||
648 |
// Import the trused certs. |
|
649 |
ByteArrayInputStream is; |
|
650 |
if (trustedMaterials != null && trustedMaterials.length != 0) { |
|
651 |
ts = KeyStore.getInstance("JKS"); |
|
652 |
ts.load(null, null); |
|
653 |
||
654 |
Certificate[] trustedCert = |
|
655 |
new Certificate[trustedMaterials.length]; |
|
656 |
for (int i = 0; i < trustedMaterials.length; i++) { |
|
657 |
String trustedCertStr = trustedMaterials[i]; |
|
658 |
||
659 |
is = new ByteArrayInputStream(trustedCertStr.getBytes()); |
|
660 |
try { |
|
661 |
trustedCert[i] = cf.generateCertificate(is); |
|
662 |
} finally { |
|
663 |
is.close(); |
|
664 |
} |
|
665 |
||
666 |
ts.setCertificateEntry("trusted-cert-" + i, trustedCert[i]); |
|
667 |
} |
|
668 |
} |
|
669 |
||
670 |
// Import the key materials. |
|
671 |
// |
|
672 |
// Note that certification pathes bigger than one are not supported yet. |
|
673 |
boolean hasKeyMaterials = |
|
674 |
(keyMaterialCerts != null) && (keyMaterialCerts.length != 0) && |
|
675 |
(keyMaterialKeys != null) && (keyMaterialKeys.length != 0) && |
|
676 |
(keyMaterialKeyAlgs != null) && (keyMaterialKeyAlgs.length != 0) && |
|
677 |
(keyMaterialCerts.length == keyMaterialKeys.length) && |
|
678 |
(keyMaterialCerts.length == keyMaterialKeyAlgs.length); |
|
679 |
if (hasKeyMaterials) { |
|
680 |
ks = KeyStore.getInstance("JKS"); |
|
681 |
ks.load(null, null); |
|
682 |
||
683 |
for (int i = 0; i < keyMaterialCerts.length; i++) { |
|
684 |
String keyCertStr = keyMaterialCerts[i]; |
|
685 |
||
686 |
// generate the private key. |
|
687 |
PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec( |
|
688 |
Base64.getMimeDecoder().decode(keyMaterialKeys[i])); |
|
689 |
KeyFactory kf = |
|
690 |
KeyFactory.getInstance(keyMaterialKeyAlgs[i]); |
|
691 |
PrivateKey priKey = kf.generatePrivate(priKeySpec); |
|
692 |
||
693 |
// generate certificate chain |
|
694 |
is = new ByteArrayInputStream(keyCertStr.getBytes()); |
|
695 |
Certificate keyCert = null; |
|
696 |
try { |
|
697 |
keyCert = cf.generateCertificate(is); |
|
698 |
} finally { |
|
699 |
is.close(); |
|
700 |
} |
|
701 |
||
702 |
Certificate[] chain = new Certificate[] { keyCert }; |
|
703 |
||
704 |
// import the key entry. |
|
56542 | 705 |
ks.setKeyEntry("cert-" + keyMaterialKeyNames[i], |
42464 | 706 |
priKey, passphrase, chain); |
707 |
} |
|
708 |
} |
|
709 |
||
710 |
// Create an SSLContext object. |
|
711 |
TrustManagerFactory tmf = |
|
712 |
TrustManagerFactory.getInstance(params.tmAlgorithm); |
|
713 |
tmf.init(ts); |
|
714 |
||
715 |
SSLContext context = SSLContext.getInstance(params.contextProtocol); |
|
716 |
if (hasKeyMaterials && ks != null) { |
|
717 |
KeyManagerFactory kmf = |
|
718 |
KeyManagerFactory.getInstance(params.kmAlgorithm); |
|
719 |
kmf.init(ks, passphrase); |
|
720 |
||
721 |
context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); |
|
722 |
} else { |
|
723 |
context.init(null, tmf.getTrustManagers(), null); |
|
724 |
} |
|
725 |
||
726 |
return context; |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
727 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
728 |
|
42464 | 729 |
/* |
730 |
* ================================================= |
|
731 |
* Stuffs to boot up the client-server mode testing. |
|
732 |
*/ |
|
733 |
private Thread clientThread = null; |
|
734 |
private Thread serverThread = null; |
|
735 |
private volatile Exception serverException = null; |
|
736 |
private volatile Exception clientException = null; |
|
737 |
||
738 |
/* |
|
739 |
* Should we run the client or server in a separate thread? |
|
740 |
* Both sides can throw exceptions, but do you have a preference |
|
741 |
* as to which side should be the main thread. |
|
742 |
*/ |
|
743 |
private static final boolean separateServerThread = false; |
|
744 |
||
745 |
/* |
|
746 |
* Boot up the testing, used to drive remainder of the test. |
|
747 |
*/ |
|
748 |
private void bootup() throws Exception { |
|
749 |
Exception startException = null; |
|
750 |
try { |
|
751 |
if (separateServerThread) { |
|
752 |
startServer(true); |
|
753 |
startClient(false); |
|
754 |
} else { |
|
755 |
startClient(true); |
|
756 |
startServer(false); |
|
757 |
} |
|
758 |
} catch (Exception e) { |
|
759 |
startException = e; |
|
760 |
} |
|
761 |
||
762 |
/* |
|
763 |
* Wait for other side to close down. |
|
764 |
*/ |
|
765 |
if (separateServerThread) { |
|
766 |
if (serverThread != null) { |
|
767 |
serverThread.join(); |
|
768 |
} |
|
769 |
} else { |
|
770 |
if (clientThread != null) { |
|
771 |
clientThread.join(); |
|
772 |
} |
|
773 |
} |
|
42155
c9b28ab5297b
8168969: Merge SSLSocketSample and SSLSocketTemplate
asmotrak
parents:
41595
diff
changeset
|
774 |
|
42464 | 775 |
/* |
776 |
* When we get here, the test is pretty much over. |
|
777 |
* Which side threw the error? |
|
778 |
*/ |
|
779 |
Exception local; |
|
780 |
Exception remote; |
|
781 |
||
782 |
if (separateServerThread) { |
|
783 |
remote = serverException; |
|
784 |
local = clientException; |
|
785 |
} else { |
|
786 |
remote = clientException; |
|
787 |
local = serverException; |
|
788 |
} |
|
789 |
||
790 |
Exception exception = null; |
|
791 |
||
792 |
/* |
|
793 |
* Check various exception conditions. |
|
794 |
*/ |
|
795 |
if ((local != null) && (remote != null)) { |
|
796 |
// If both failed, return the curthread's exception. |
|
797 |
local.initCause(remote); |
|
798 |
exception = local; |
|
799 |
} else if (local != null) { |
|
800 |
exception = local; |
|
801 |
} else if (remote != null) { |
|
802 |
exception = remote; |
|
803 |
} else if (startException != null) { |
|
804 |
exception = startException; |
|
805 |
} |
|
806 |
||
807 |
/* |
|
808 |
* If there was an exception *AND* a startException, |
|
809 |
* output it. |
|
810 |
*/ |
|
811 |
if (exception != null) { |
|
812 |
if (exception != startException && startException != null) { |
|
813 |
exception.addSuppressed(startException); |
|
814 |
} |
|
815 |
throw exception; |
|
816 |
} |
|
817 |
||
818 |
// Fall-through: no exception to throw! |
|
819 |
} |
|
820 |
||
821 |
private void startServer(boolean newThread) throws Exception { |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
822 |
if (newThread) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
823 |
serverThread = new Thread() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
824 |
@Override |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
825 |
public void run() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
826 |
try { |
42464 | 827 |
doServerSide(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
828 |
} catch (Exception e) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
829 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
830 |
* Our server thread just died. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
831 |
* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
832 |
* Release the client, if not active already... |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
833 |
*/ |
42464 | 834 |
logException("Server died", e); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
835 |
serverException = e; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
836 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
837 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
838 |
}; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
839 |
serverThread.start(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
840 |
} else { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
841 |
try { |
42464 | 842 |
doServerSide(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
843 |
} catch (Exception e) { |
42464 | 844 |
logException("Server failed", e); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
845 |
serverException = e; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
846 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
847 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
848 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
849 |
|
42464 | 850 |
private void startClient(boolean newThread) throws Exception { |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
851 |
if (newThread) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
852 |
clientThread = new Thread() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
853 |
@Override |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
854 |
public void run() { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
855 |
try { |
42464 | 856 |
doClientSide(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
857 |
} catch (Exception e) { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
858 |
/* |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
859 |
* Our client thread just died. |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
860 |
*/ |
42464 | 861 |
logException("Client died", e); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
862 |
clientException = e; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
863 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
864 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
865 |
}; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
866 |
clientThread.start(); |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
867 |
} else { |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
868 |
try { |
42464 | 869 |
doClientSide(); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
870 |
} catch (Exception e) { |
42464 | 871 |
logException("Client failed", e); |
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
872 |
clientException = e; |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
873 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
874 |
} |
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
875 |
} |
42464 | 876 |
|
877 |
private synchronized void logException(String prefix, Throwable cause) { |
|
878 |
System.out.println(prefix + ": " + cause); |
|
879 |
cause.printStackTrace(System.out); |
|
880 |
} |
|
41196
240314163e51
8164591: sun/net/www/protocol/https/HttpsClient/ServerIdentityTest.java failed with SSLHandshakeException
asmotrak
parents:
diff
changeset
|
881 |
} |
56542 | 882 |