Skip to content

Commit 882d635

Browse files
artur-oracleseanjmullan
authored andcommitted
8245545: Disable TLS_RSA cipher suites
Reviewed-by: mullan
1 parent 8f22db2 commit 882d635

File tree

13 files changed

+64
-46
lines changed

13 files changed

+64
-46
lines changed

src/java.base/share/conf/security/java.security

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ http.auth.digest.disabledAlgorithms = MD5, SHA-1
746746
# rsa_pkcs1_sha1, secp224r1, TLS_RSA_*
747747
jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, DTLSv1.0, RC4, DES, \
748748
MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
749-
ECDH
749+
ECDH, TLS_RSA_*
750750

751751
#
752752
# Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)

test/jdk/javax/net/ssl/DTLS/CipherSuite.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,16 +33,16 @@
3333
* jdk.crypto.ec
3434
* @library /test/lib
3535
* @build DTLSOverDatagram
36-
* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA
36+
* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA re-enable
3737
* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
38-
* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA256
38+
* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_CBC_SHA256 re-enable
3939
* @run main/othervm CipherSuite TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
4040
* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
4141
* @run main/othervm CipherSuite TLS_DHE_RSA_WITH_AES_128_CBC_SHA
4242
* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA re-enable
4343
* @run main/othervm CipherSuite TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
4444
* @run main/othervm CipherSuite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
45-
* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_GCM_SHA256
45+
* @run main/othervm CipherSuite TLS_RSA_WITH_AES_128_GCM_SHA256 re-enable
4646
* @run main/othervm CipherSuite TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 re-enable
4747
* @run main/othervm CipherSuite TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
4848
* @run main/othervm CipherSuite TLS_DHE_DSS_WITH_AES_128_GCM_SHA256

test/jdk/javax/net/ssl/SSLEngine/Basics.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,8 @@ public class Basics {
5757
"/" + TRUSTSTORE_FILE;
5858

5959
public static void main(String[] args) throws Exception {
60-
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1");
60+
// Re-enable TLSv1.1 and TLS_RSA_* since test depends on it.
61+
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1", "TLS_RSA_*");
6162

6263
runTest("TLSv1.3", "TLS_AES_256_GCM_SHA384");
6364
runTest("TLSv1.2", "TLS_RSA_WITH_AES_256_GCM_SHA384");

test/jdk/javax/net/ssl/SSLEngine/EngineCloseOnAlert.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
2626
* @bug 8133632
2727
* @summary javax.net.ssl.SSLEngine does not properly handle received
2828
* SSL fatal alerts
29-
* @run main EngineCloseOnAlert
29+
* @library /test/lib
30+
* @run main/othervm EngineCloseOnAlert
3031
*/
3132

3233
import java.io.FileInputStream;
@@ -36,6 +37,7 @@
3637
import java.util.*;
3738
import java.security.*;
3839
import static javax.net.ssl.SSLEngineResult.HandshakeStatus.*;
40+
import jdk.test.lib.security.SecurityUtils;
3941

4042
public class EngineCloseOnAlert {
4143

@@ -61,6 +63,8 @@ public interface TestCase {
6163
}
6264

6365
public static void main(String[] args) throws Exception {
66+
// Re-enable TLS_RSA_* since test depends on it.
67+
SecurityUtils.removeFromDisabledTlsAlgs("TLS_RSA_*");
6468
int failed = 0;
6569
List<TestCase> testMatrix = new LinkedList<TestCase>() {{
6670
add(clientReceivesAlert);

test/jdk/javax/net/ssl/TLSv11/GenericBlockCipher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -172,8 +172,8 @@ void doClientSide() throws Exception {
172172
volatile Exception clientException = null;
173173

174174
public static void main(String[] args) throws Exception {
175-
// Re-enable TLSv1.1 since test depends on it.
176-
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1");
175+
// Re-enable TLSv1.1 and TLS_RSA_* since test depends on it.
176+
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1", "TLS_RSA_*");
177177

178178
String keyFilename =
179179
System.getProperty("test.src", ".") + "/" + pathToStores +

test/jdk/javax/net/ssl/TLSv12/ProtocolFilter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,13 +28,16 @@
2828
* @test
2929
* @bug 8052406
3030
* @summary SSLv2Hello protocol may be filter out unexpectedly
31+
* @library /test/lib
3132
* @run main/othervm ProtocolFilter
3233
*/
3334

3435
import java.io.*;
3536
import java.net.*;
3637
import javax.net.ssl.*;
3738

39+
import jdk.test.lib.security.SecurityUtils;
40+
3841
public class ProtocolFilter {
3942

4043
/*
@@ -156,6 +159,8 @@ void doClientSide() throws Exception {
156159
volatile Exception clientException = null;
157160

158161
public static void main(String[] args) throws Exception {
162+
// Re-enable TLS_RSA_* since test depends on it.
163+
SecurityUtils.removeFromDisabledTlsAlgs("TLS_RSA_*");
159164
String keyFilename =
160165
System.getProperty("test.src", ".") + "/" + pathToStores +
161166
"/" + keyStoreFile;

test/jdk/javax/net/ssl/ciphersuites/DisabledAlgorithms.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 8076221 8211883 8163327 8279164
26+
* @bug 8076221 8211883 8163327 8279164 8245545
2727
* @summary Check if weak cipher suites are disabled
2828
* @library /javax/net/ssl/templates
2929
* @modules jdk.crypto.ec
@@ -124,7 +124,13 @@ public class DisabledAlgorithms {
124124
"TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA",
125125
"TLS_ECDH_RSA_WITH_AES_256_CBC_SHA",
126126
"TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA",
127-
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA"
127+
"TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
128+
"TLS_RSA_WITH_AES_256_GCM_SHA384",
129+
"TLS_RSA_WITH_AES_128_GCM_SHA256",
130+
"TLS_RSA_WITH_AES_256_CBC_SHA256",
131+
"TLS_RSA_WITH_AES_128_CBC_SHA256",
132+
"TLS_RSA_WITH_AES_256_CBC_SHA",
133+
"TLS_RSA_WITH_AES_128_CBC_SHA"
128134
};
129135

130136
public static void main(String[] args) throws Exception {

test/jdk/javax/net/ssl/sanity/ciphersuites/CheckCipherSuites.java

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 4750141 4895631 8217579 8163326 8279164
26+
* @bug 4750141 4895631 8217579 8163326 8279164 8245545
2727
* @summary Check enabled and supported ciphersuites are correct
2828
* @run main/othervm CheckCipherSuites default
2929
* @run main/othervm CheckCipherSuites limited
@@ -99,12 +99,6 @@ public class CheckCipherSuites {
9999
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
100100

101101
// deprecated
102-
"TLS_RSA_WITH_AES_256_GCM_SHA384",
103-
"TLS_RSA_WITH_AES_128_GCM_SHA256",
104-
"TLS_RSA_WITH_AES_256_CBC_SHA256",
105-
"TLS_RSA_WITH_AES_128_CBC_SHA256",
106-
"TLS_RSA_WITH_AES_256_CBC_SHA",
107-
"TLS_RSA_WITH_AES_128_CBC_SHA",
108102
"TLS_EMPTY_RENEGOTIATION_INFO_SCSV"
109103
};
110104

@@ -124,9 +118,6 @@ public class CheckCipherSuites {
124118
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
125119
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
126120
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
127-
"TLS_RSA_WITH_AES_128_GCM_SHA256",
128-
"TLS_RSA_WITH_AES_128_CBC_SHA256",
129-
"TLS_RSA_WITH_AES_128_CBC_SHA",
130121
"TLS_EMPTY_RENEGOTIATION_INFO_SCSV"
131122
};
132123

@@ -194,12 +185,6 @@ public class CheckCipherSuites {
194185
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
195186

196187
// deprecated
197-
"TLS_RSA_WITH_AES_256_GCM_SHA384",
198-
"TLS_RSA_WITH_AES_128_GCM_SHA256",
199-
"TLS_RSA_WITH_AES_256_CBC_SHA256",
200-
"TLS_RSA_WITH_AES_128_CBC_SHA256",
201-
"TLS_RSA_WITH_AES_256_CBC_SHA",
202-
"TLS_RSA_WITH_AES_128_CBC_SHA",
203188
"TLS_EMPTY_RENEGOTIATION_INFO_SCSV"
204189
};
205190

@@ -219,9 +204,6 @@ public class CheckCipherSuites {
219204
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
220205
"TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
221206
"TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
222-
"TLS_RSA_WITH_AES_128_GCM_SHA256",
223-
"TLS_RSA_WITH_AES_128_CBC_SHA256",
224-
"TLS_RSA_WITH_AES_128_CBC_SHA",
225207
"TLS_EMPTY_RENEGOTIATION_INFO_SCSV"
226208
};
227209

test/jdk/javax/net/ssl/sanity/ciphersuites/SystemPropCipherSuitesOrder.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,7 @@
2121
* questions.
2222
*/
2323
import java.util.Arrays;
24+
import java.util.stream.Stream;
2425
import javax.net.ssl.SSLServerSocket;
2526
import javax.net.ssl.SSLSocket;
2627

@@ -86,8 +87,20 @@ public static void main(String[] args) {
8687
clientcipherSuites
8788
= toArray(System.getProperty("jdk.tls.client.cipherSuites"));
8889
System.out.printf("SYSTEM PROPERTIES: ServerProp:%s - ClientProp:%s%n",
89-
Arrays.deepToString(servercipherSuites),
90-
Arrays.deepToString(clientcipherSuites));
90+
Arrays.deepToString(servercipherSuites),
91+
Arrays.deepToString(clientcipherSuites));
92+
93+
// Re-enable TLS_RSA_* cipher suites if needed since test depends on it.
94+
if (Stream.concat(
95+
Arrays.stream(
96+
servercipherSuites == null
97+
? new String[0] : servercipherSuites),
98+
Arrays.stream(
99+
clientcipherSuites == null
100+
? new String[0] : clientcipherSuites))
101+
.anyMatch(s -> s.startsWith("TLS_RSA_"))) {
102+
SecurityUtils.removeFromDisabledTlsAlgs("TLS_RSA_*");
103+
}
91104

92105
try {
93106
new SystemPropCipherSuitesOrder(args[0]).run();

test/jdk/javax/net/ssl/sanity/ciphersuites/TLSCipherSuitesOrder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -58,6 +58,8 @@ public class TLSCipherSuitesOrder extends SSLSocketTemplate {
5858
private final String[] clientcipherSuites;
5959

6060
public static void main(String[] args) {
61+
// Re-enable TLS_RSA_* since test depends on it.
62+
SecurityUtils.removeFromDisabledTlsAlgs("TLS_RSA_*");
6163
PROTOCOL protocol = PROTOCOL.valueOf(args[0]);
6264
try {
6365
new TLSCipherSuitesOrder(protocol.getProtocol(),

0 commit comments

Comments
 (0)