Skip to content

Commit 3a4b90f

Browse files
committed
8202343: Disable TLS 1.0 and 1.1
Reviewed-by: xuelei, dfuchs, coffeys
1 parent 342ccf6 commit 3a4b90f

File tree

21 files changed

+299
-123
lines changed

21 files changed

+299
-123
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024, \
731731
# Example:
732732
# jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048, \
733733
# rsa_pkcs1_sha1, secp224r1
734-
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, \
735-
EC keySize < 224, 3DES_EDE_CBC, anon, NULL
734+
jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
735+
DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL
736736

737737
#
738738
# Legacy algorithms for Secure Socket Layer/Transport Layer Security (SSL/TLS)

test/jdk/java/net/httpclient/TlsContextTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import static java.net.http.HttpClient.Version.HTTP_2;
4343
import static java.net.http.HttpResponse.BodyHandlers.ofString;
4444
import static org.testng.Assert.assertEquals;
45+
import jdk.test.lib.security.SecurityUtils;
4546

4647
/*
4748
* @test
@@ -72,6 +73,9 @@ public class TlsContextTest implements HttpServerAdapters {
7273

7374
@BeforeTest
7475
public void setUp() throws Exception {
76+
// Re-enable TLSv1 and TLSv1.1 since test depends on them
77+
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1", "TLSv1.1");
78+
7579
server = SimpleSSLContext.getContext("TLS");
7680
final ExecutorService executor = Executors.newCachedThreadPool();
7781
https2Server = HttpTestServer.of(

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2020, 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
@@ -25,6 +25,7 @@
2525
* @test
2626
* @bug 5019096
2727
* @summary Add scatter/gather APIs for SSLEngine
28+
* @library /test/lib
2829
* @run main/othervm Arrays SSL
2930
* @run main/othervm Arrays TLS
3031
* @run main/othervm Arrays SSLv3
@@ -41,6 +42,8 @@
4142
import java.security.*;
4243
import java.nio.*;
4344

45+
import jdk.test.lib.security.SecurityUtils;
46+
4447
public class Arrays {
4548

4649
private static boolean debug = false;
@@ -182,6 +185,14 @@ private void runTest() throws Exception {
182185
private static String contextVersion;
183186
public static void main(String args[]) throws Exception {
184187
contextVersion = args[0];
188+
// Re-enable context version if it is disabled.
189+
// If context version is SSLv3, TLSv1 needs to be re-enabled.
190+
if (contextVersion.equals("SSLv3")) {
191+
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1");
192+
} else if (contextVersion.equals("TLSv1") ||
193+
contextVersion.equals("TLSv1.1")) {
194+
SecurityUtils.removeFromDisabledTlsAlgs(contextVersion);
195+
}
185196

186197
Arrays test;
187198

test/jdk/javax/net/ssl/TLS/TLSClientPropertyTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2020, 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 8049432 8069038 8234723
26+
* @bug 8049432 8069038 8234723 8202343
2727
* @summary New tests for TLS property jdk.tls.client.protocols
2828
* @summary javax/net/ssl/TLS/TLSClientPropertyTest.java needs to be
2929
* updated for JDK-8061210
@@ -79,7 +79,7 @@ public static void main(String[] args) throws Exception {
7979
}
8080
contextProtocol = null;
8181
expectedDefaultProtos = new String[] {
82-
"TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"
82+
"TLSv1.2", "TLSv1.3"
8383
};
8484
break;
8585
case "SSLv3":
@@ -90,26 +90,24 @@ public static void main(String[] args) throws Exception {
9090
case "TLSv1":
9191
contextProtocol = "TLSv1";
9292
expectedDefaultProtos = new String[] {
93-
"TLSv1"
9493
};
9594
break;
9695
case "TLSv11":
9796
contextProtocol = "TLSv1.1";
9897
expectedDefaultProtos = new String[] {
99-
"TLSv1", "TLSv1.1"
10098
};
10199
break;
102100
case "TLSv12":
103101
contextProtocol = "TLSv1.2";
104102
expectedDefaultProtos = new String[] {
105-
"TLSv1", "TLSv1.1", "TLSv1.2"
103+
"TLSv1.2"
106104
};
107105
break;
108106
case "TLSv13":
109107
case "TLS":
110108
contextProtocol = "TLSv1.3";
111109
expectedDefaultProtos = new String[] {
112-
"TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"
110+
"TLSv1.2", "TLSv1.3"
113111
};
114112
break;
115113
case "WrongProperty":

test/jdk/javax/net/ssl/TLSCommon/interop/JdkProcClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import java.util.HashMap;
2828
import java.util.Map;
2929

30+
import jdk.test.lib.security.SecurityUtils;
31+
3032
/*
3133
* A JDK client process.
3234
*/
@@ -158,6 +160,9 @@ public static void main(String[] args) throws Exception {
158160
String serverNamesStr = System.getProperty(JdkProcUtils.PROP_SERVER_NAMES);
159161
String appProtocolsStr = System.getProperty(JdkProcUtils.PROP_APP_PROTOCOLS);
160162

163+
// Re-enable TLSv1 and TLSv1.1 since client depends on them
164+
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1", "TLSv1.1");
165+
161166
JdkClient.Builder builder = new JdkClient.Builder();
162167
builder.setCertTuple(JdkProcUtils.createCertTuple(
163168
trustedCertsStr, eeCertsStr));

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2020, 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
@@ -27,6 +27,7 @@
2727
* @test
2828
* @bug 4873188
2929
* @summary Support TLS 1.1
30+
* @library /test/lib
3031
* @modules java.security.jgss
3132
* java.security.jgss/sun.security.jgss.krb5
3233
* java.security.jgss/sun.security.krb5:+open
@@ -50,6 +51,8 @@
5051
import javax.net.ssl.SSLSocket;
5152
import javax.net.ssl.SSLSocketFactory;
5253

54+
import jdk.test.lib.security.SecurityUtils;
55+
5356
public class GenericBlockCipher {
5457

5558
/*
@@ -171,6 +174,9 @@ void doClientSide() throws Exception {
171174
volatile Exception clientException = null;
172175

173176
public static void main(String[] args) throws Exception {
177+
// Re-enable TLSv1.1 since test depends on it.
178+
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1.1");
179+
174180
String keyFilename =
175181
System.getProperty("test.src", ".") + "/" + pathToStores +
176182
"/" + keyStoreFile;

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2020, 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
@@ -24,11 +24,14 @@
2424
import javax.net.ssl.SSLServerSocket;
2525
import javax.net.ssl.SSLSocket;
2626

27+
import jdk.test.lib.security.SecurityUtils;
28+
2729
/*
2830
* @test
2931
* @bug 8234728
3032
* @library /javax/net/ssl/templates
3133
* /javax/net/ssl/TLSCommon
34+
* /test/lib
3235
* @summary Test TLS ciphersuites order set through System properties
3336
* @run main/othervm
3437
* -Djdk.tls.client.cipherSuites=TLS_CHACHA20_POLY1305_SHA256,TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384
@@ -95,6 +98,10 @@ public static void main(String[] args) {
9598

9699
private SystemPropCipherSuitesOrder(String protocol) {
97100
this.protocol = protocol;
101+
// Re-enable protocol if disabled.
102+
if (protocol.equals("TLSv1") || protocol.equals("TLSv1.1")) {
103+
SecurityUtils.removeFromDisabledTlsAlgs(protocol);
104+
}
98105
}
99106

100107
// Servers are configured before clients, increment test case after.

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2020, 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
@@ -24,11 +24,14 @@
2424
import javax.net.ssl.SSLServerSocket;
2525
import javax.net.ssl.SSLSocket;
2626

27+
import jdk.test.lib.security.SecurityUtils;
28+
2729
/*
2830
* @test
2931
* @bug 8234728
3032
* @library /javax/net/ssl/templates
3133
* /javax/net/ssl/TLSCommon
34+
* /test/lib
3235
* @summary Test TLS ciphersuites order.
3336
* Parameter order: <protocol> <client cipher order> <server cipher order>
3437
* @run main/othervm TLSCipherSuitesOrder TLSv13 ORDERED default
@@ -67,6 +70,10 @@ public static void main(String[] args) {
6770

6871
private TLSCipherSuitesOrder(String protocol, String[] clientcipherSuites,
6972
String[] servercipherSuites) {
73+
// Re-enable protocol if it is disabled.
74+
if (protocol.equals("TLSv1") || protocol.equals("TLSv1.1")) {
75+
SecurityUtils.removeFromDisabledTlsAlgs(protocol);
76+
}
7077
this.protocol = protocol;
7178
this.clientcipherSuites = clientcipherSuites;
7279
this.servercipherSuites = servercipherSuites;

test/jdk/sun/security/ssl/CipherSuite/DisabledCurve.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/*
2525
* @test
2626
* @bug 8246330
27-
* @library /javax/net/ssl/templates
27+
* @library /javax/net/ssl/templates /test/lib
2828
* @run main/othervm -Djdk.tls.namedGroups="secp384r1"
2929
DisabledCurve DISABLE_NONE PASS
3030
* @run main/othervm -Djdk.tls.namedGroups="secp384r1"
@@ -37,6 +37,8 @@
3737
import javax.net.ssl.SSLContext;
3838
import javax.net.ssl.SSLException;
3939

40+
import jdk.test.lib.security.SecurityUtils;
41+
4042
public class DisabledCurve extends SSLSocketTemplate {
4143

4244
private static volatile int index;
@@ -97,6 +99,9 @@ public static void main(String[] args) throws Exception {
9799
Security.setProperty("jdk.certpath.disabledAlgorithms", "secp384r1");
98100
}
99101

102+
// Re-enable TLSv1 and TLSv1.1 since test depends on it.
103+
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1", "TLSv1.1");
104+
100105
for (index = 0; index < protocols.length; index++) {
101106
try {
102107
(new DisabledCurve()).run();

test/jdk/sun/security/ssl/CipherSuite/NamedGroupsWithCipherSuite.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@
2525
import javax.net.ssl.SSLServerSocket;
2626
import javax.net.ssl.SSLSocket;
2727

28+
import jdk.test.lib.security.SecurityUtils;
29+
2830
/*
2931
* @test
3032
* @bug 8224650 8242929
3133
* @library /javax/net/ssl/templates
3234
* /javax/net/ssl/TLSCommon
35+
* /test/lib
3336
* @summary Test TLS ciphersuite with each individual supported group
3437
* @run main/othervm NamedGroupsWithCipherSuite x25519
3538
* @run main/othervm NamedGroupsWithCipherSuite X448
@@ -145,6 +148,9 @@ public static void main(String[] args) throws Exception {
145148
System.setProperty("jdk.tls.namedGroups", namedGroup);
146149
System.out.println("NamedGroup: " + namedGroup);
147150

151+
// Re-enable TLSv1 and TLSv1.1 since test depends on it.
152+
SecurityUtils.removeFromDisabledTlsAlgs("TLSv1", "TLSv1.1");
153+
148154
for (Protocol protocol : PROTOCOLS) {
149155
for (CipherSuite cipherSuite : CIPHER_SUITES) {
150156
// Named group converted to lower case just

0 commit comments

Comments
 (0)