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