|
1 | 1 | /* |
2 | | - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
52 | 52 | * @test |
53 | 53 | * @bug 8205111 |
54 | 54 | * @summary Test TLS with different types of supported keys. |
55 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pkcs1_sha1 TLS_AES_128_GCM_SHA256 |
56 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pkcs1_sha256 TLS_AES_128_GCM_SHA256 |
57 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pkcs1_sha384 TLS_AES_128_GCM_SHA256 |
58 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pkcs1_sha512 TLS_AES_128_GCM_SHA256 |
59 | | - * @run main/othervm TLSTest TLSv1.3 ec_rsa_pkcs1_sha256 TLS_AES_128_GCM_SHA256 |
60 | | - * @run main/othervm TLSTest TLSv1.3 ecdsa_sha1 TLS_AES_128_GCM_SHA256 |
61 | | - * @run main/othervm TLSTest TLSv1.3 ecdsa_secp384r1_sha384 |
| 55 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pkcs1_sha1 TLS_AES_128_GCM_SHA256 |
| 56 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pkcs1_sha256 TLS_AES_128_GCM_SHA256 |
| 57 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pkcs1_sha384 TLS_AES_128_GCM_SHA256 |
| 58 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pkcs1_sha512 TLS_AES_128_GCM_SHA256 |
| 59 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 ec_rsa_pkcs1_sha256 TLS_AES_128_GCM_SHA256 |
| 60 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 ecdsa_sha1 TLS_AES_128_GCM_SHA256 |
| 61 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 ecdsa_secp384r1_sha384 |
62 | 62 | * TLS_AES_128_GCM_SHA256 |
63 | | - * @run main/othervm TLSTest TLSv1.3 ecdsa_secp521r1_sha512 |
| 63 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 ecdsa_secp521r1_sha512 |
64 | 64 | * TLS_AES_128_GCM_SHA256 |
65 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_rsae_sha256 TLS_AES_128_GCM_SHA256 |
66 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_rsae_sha384 TLS_AES_128_GCM_SHA256 |
67 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_rsae_sha512 TLS_AES_128_GCM_SHA256 |
68 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_pss_sha256 TLS_AES_128_GCM_SHA256 |
69 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_pss_sha384 TLS_AES_128_GCM_SHA256 |
70 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_pss_sha512 TLS_AES_128_GCM_SHA256 |
| 65 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_rsae_sha256 TLS_AES_128_GCM_SHA256 |
| 66 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_rsae_sha384 TLS_AES_128_GCM_SHA256 |
| 67 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_rsae_sha512 TLS_AES_128_GCM_SHA256 |
| 68 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_pss_sha256 TLS_AES_128_GCM_SHA256 |
| 69 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_pss_sha384 TLS_AES_128_GCM_SHA256 |
| 70 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_pss_sha512 TLS_AES_128_GCM_SHA256 |
71 | 71 | * |
72 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pkcs1_sha1 TLS_AES_256_GCM_SHA384 |
73 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pkcs1_sha256 TLS_AES_256_GCM_SHA384 |
74 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pkcs1_sha384 TLS_AES_256_GCM_SHA384 |
75 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pkcs1_sha512 TLS_AES_256_GCM_SHA384 |
76 | | - * @run main/othervm TLSTest TLSv1.3 ec_rsa_pkcs1_sha256 TLS_AES_256_GCM_SHA384 |
77 | | - * @run main/othervm TLSTest TLSv1.3 ecdsa_sha1 TLS_AES_256_GCM_SHA384 |
78 | | - * @run main/othervm TLSTest TLSv1.3 ecdsa_secp384r1_sha384 |
| 72 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pkcs1_sha1 TLS_AES_256_GCM_SHA384 |
| 73 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pkcs1_sha256 TLS_AES_256_GCM_SHA384 |
| 74 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pkcs1_sha384 TLS_AES_256_GCM_SHA384 |
| 75 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pkcs1_sha512 TLS_AES_256_GCM_SHA384 |
| 76 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 ec_rsa_pkcs1_sha256 TLS_AES_256_GCM_SHA384 |
| 77 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 ecdsa_sha1 TLS_AES_256_GCM_SHA384 |
| 78 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 ecdsa_secp384r1_sha384 |
79 | 79 | * TLS_AES_256_GCM_SHA384 |
80 | | - * @run main/othervm TLSTest TLSv1.3 ecdsa_secp521r1_sha512 |
| 80 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 ecdsa_secp521r1_sha512 |
81 | 81 | * TLS_AES_256_GCM_SHA384 |
82 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_rsae_sha256 TLS_AES_256_GCM_SHA384 |
83 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_rsae_sha384 TLS_AES_256_GCM_SHA384 |
84 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_rsae_sha512 TLS_AES_256_GCM_SHA384 |
85 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_pss_sha256 TLS_AES_256_GCM_SHA384 |
86 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_pss_sha384 TLS_AES_256_GCM_SHA384 |
87 | | - * @run main/othervm TLSTest TLSv1.3 rsa_pss_pss_sha512 TLS_AES_256_GCM_SHA384 |
| 82 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_rsae_sha256 TLS_AES_256_GCM_SHA384 |
| 83 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_rsae_sha384 TLS_AES_256_GCM_SHA384 |
| 84 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_rsae_sha512 TLS_AES_256_GCM_SHA384 |
| 85 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_pss_sha256 TLS_AES_256_GCM_SHA384 |
| 86 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_pss_sha384 TLS_AES_256_GCM_SHA384 |
| 87 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.3 rsa_pss_pss_sha512 TLS_AES_256_GCM_SHA384 |
88 | 88 | * |
89 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pkcs1_sha1 TLS_RSA_WITH_AES_128_CBC_SHA |
90 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pkcs1_sha256 |
| 89 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pkcs1_sha1 TLS_RSA_WITH_AES_128_CBC_SHA |
| 90 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pkcs1_sha256 |
91 | 91 | * TLS_RSA_WITH_AES_128_CBC_SHA |
92 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pkcs1_sha384 |
| 92 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pkcs1_sha384 |
93 | 93 | * TLS_RSA_WITH_AES_256_GCM_SHA384 |
94 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pkcs1_sha512 |
| 94 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pkcs1_sha512 |
95 | 95 | * TLS_RSA_WITH_AES_128_GCM_SHA256 |
96 | | - * @run main/othervm TLSTest TLSv1.2 ec_rsa_pkcs1_sha256 |
| 96 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 ec_rsa_pkcs1_sha256 |
97 | 97 | * TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 |
98 | | - * @run main/othervm TLSTest TLSv1.2 ecdsa_sha1 |
| 98 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 ecdsa_sha1 |
99 | 99 | * TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 |
100 | | - * @run main/othervm TLSTest TLSv1.2 ecdsa_secp384r1_sha384 |
| 100 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 ecdsa_secp384r1_sha384 |
101 | 101 | * TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 |
102 | | - * @run main/othervm TLSTest TLSv1.2 ecdsa_secp521r1_sha512 |
| 102 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 ecdsa_secp521r1_sha512 |
103 | 103 | * TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA |
104 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pss_rsae_sha256 |
| 104 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pss_rsae_sha256 |
105 | 105 | * TLS_RSA_WITH_AES_256_CBC_SHA256 |
106 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pss_rsae_sha384 |
| 106 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pss_rsae_sha384 |
107 | 107 | * TLS_RSA_WITH_AES_256_CBC_SHA |
108 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pss_rsae_sha512 |
| 108 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pss_rsae_sha512 |
109 | 109 | * TLS_RSA_WITH_AES_128_CBC_SHA256 |
110 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pss_pss_sha256 |
| 110 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pss_pss_sha256 |
111 | 111 | * TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 |
112 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pss_pss_sha384 |
| 112 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pss_pss_sha384 |
113 | 113 | * TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 |
114 | | - * @run main/othervm TLSTest TLSv1.2 rsa_pss_pss_sha512 |
| 114 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.2 rsa_pss_pss_sha512 |
115 | 115 | * TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 |
116 | 116 | * |
117 | | - * @run main/othervm TLSTest TLSv1.1 rsa_pkcs1_sha1 TLS_RSA_WITH_AES_128_CBC_SHA |
118 | | - * @run main/othervm TLSTest TLSv1.1 rsa_pkcs1_sha256 |
| 117 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.1 rsa_pkcs1_sha1 TLS_RSA_WITH_AES_128_CBC_SHA |
| 118 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.1 rsa_pkcs1_sha256 |
119 | 119 | * TLS_RSA_WITH_AES_256_CBC_SHA |
120 | | - * @run main/othervm TLSTest TLSv1.1 rsa_pkcs1_sha384 |
| 120 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.1 rsa_pkcs1_sha384 |
121 | 121 | * TLS_RSA_WITH_AES_128_CBC_SHA |
122 | | - * @run main/othervm TLSTest TLSv1.1 rsa_pkcs1_sha512 |
| 122 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.1 rsa_pkcs1_sha512 |
123 | 123 | * TLS_RSA_WITH_AES_256_CBC_SHA |
124 | | - * @run main/othervm TLSTest TLSv1.1 rsa_pss_rsae_sha256 |
| 124 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.1 rsa_pss_rsae_sha256 |
125 | 125 | * TLS_RSA_WITH_AES_128_CBC_SHA |
126 | | - * @run main/othervm TLSTest TLSv1.1 rsa_pss_rsae_sha384 |
| 126 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.1 rsa_pss_rsae_sha384 |
127 | 127 | * TLS_RSA_WITH_AES_256_CBC_SHA |
128 | | - * @run main/othervm TLSTest TLSv1.1 rsa_pss_rsae_sha512 |
| 128 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1.1 rsa_pss_rsae_sha512 |
129 | 129 | * TLS_RSA_WITH_AES_128_CBC_SHA |
130 | 130 | * |
131 | | - * @run main/othervm TLSTest TLSv1 rsa_pkcs1_sha1 TLS_RSA_WITH_AES_128_CBC_SHA |
132 | | - * @run main/othervm TLSTest TLSv1 rsa_pkcs1_sha256 TLS_RSA_WITH_AES_256_CBC_SHA |
133 | | - * @run main/othervm TLSTest TLSv1 rsa_pkcs1_sha384 TLS_RSA_WITH_AES_128_CBC_SHA |
134 | | - * @run main/othervm TLSTest TLSv1 rsa_pkcs1_sha512 TLS_RSA_WITH_AES_256_CBC_SHA |
135 | | - * @run main/othervm TLSTest TLSv1 rsa_pss_rsae_sha256 |
| 131 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1 rsa_pkcs1_sha1 TLS_RSA_WITH_AES_128_CBC_SHA |
| 132 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1 rsa_pkcs1_sha256 TLS_RSA_WITH_AES_256_CBC_SHA |
| 133 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1 rsa_pkcs1_sha384 TLS_RSA_WITH_AES_128_CBC_SHA |
| 134 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1 rsa_pkcs1_sha512 TLS_RSA_WITH_AES_256_CBC_SHA |
| 135 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1 rsa_pss_rsae_sha256 |
136 | 136 | * TLS_RSA_WITH_AES_128_CBC_SHA |
137 | | - * @run main/othervm TLSTest TLSv1 rsa_pss_rsae_sha384 |
| 137 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1 rsa_pss_rsae_sha384 |
138 | 138 | * TLS_RSA_WITH_AES_256_CBC_SHA |
139 | | - * @run main/othervm TLSTest TLSv1 rsa_pss_rsae_sha512 |
| 139 | + * @run main/othervm -Djavax.net.debug=ssl,handshake TLSTest TLSv1 rsa_pss_rsae_sha512 |
140 | 140 | * TLS_RSA_WITH_AES_128_CBC_SHA |
141 | 141 | */ |
142 | 142 | public class TLSTest { |
@@ -281,7 +281,7 @@ void doClientSide() throws Exception { |
281 | 281 | keyType.getTrustedCert(), null, null, keyType.getKeyType()); |
282 | 282 | SSLSocketFactory sslsf = ctx.getSocketFactory(); |
283 | 283 | try (SSLSocket sslSocket |
284 | | - = (SSLSocket) sslsf.createSocket("localhost", serverPort)) { |
| 284 | + = (SSLSocket) sslsf.createSocket(InetAddress.getLoopbackAddress(), serverPort)) { |
285 | 285 | // Specify the client cipher suites |
286 | 286 | sslSocket.setEnabledCipherSuites(new String[]{this.cipher}); |
287 | 287 | sslSocket.setEnabledProtocols(new String[]{this.tlsProtocol}); |
|
0 commit comments