# HG changeset patch # User xuelei # Date 1526921603 25200 # Node ID 6425233b756715cad97a11473faaf429d9beea68 # Parent a0f3377c58c78b30048e54493ef2f35ae065ad3f No more renegotiation in TLS 1.3 diff -r a0f3377c58c7 -r 6425233b7567 test/jdk/sun/security/ssl/SSLSocketImpl/InvalidateServerSessionRenegotiate.java --- a/test/jdk/sun/security/ssl/SSLSocketImpl/InvalidateServerSessionRenegotiate.java Mon May 21 08:16:24 2018 -0700 +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/InvalidateServerSessionRenegotiate.java Mon May 21 09:53:23 2018 -0700 @@ -21,19 +21,25 @@ * questions. */ +// +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. +// + /* * @test * @bug 4403428 * @summary Invalidating JSSE session on server causes SSLProtocolException - * @run main/othervm InvalidateServerSessionRenegotiate - * - * SunJSSE does not support dynamic system properties, no way to re-use - * system properties in samevm/agentvm mode. + * @run main/othervm InvalidateServerSessionRenegotiate SSLv3 + * @run main/othervm InvalidateServerSessionRenegotiate TLSv1 + * @run main/othervm InvalidateServerSessionRenegotiate TLSv1.1 + * @run main/othervm InvalidateServerSessionRenegotiate TLSv1.2 * @author Brad Wetmore */ import java.io.*; import java.net.*; +import java.security.Security; import javax.net.ssl.*; public class InvalidateServerSessionRenegotiate implements @@ -157,6 +163,7 @@ (SSLSocketFactory) SSLSocketFactory.getDefault(); SSLSocket sslSocket = (SSLSocket) sslsf.createSocket("localhost", serverPort); + sslSocket.setEnabledProtocols(new String[] { tlsProtocol }); InputStream sslIS = sslSocket.getInputStream(); OutputStream sslOS = sslSocket.getOutputStream(); @@ -187,6 +194,9 @@ volatile Exception serverException = null; volatile Exception clientException = null; + // the specified protocol + private static String tlsProtocol; + public static void main(String[] args) throws Exception { String keyFilename = System.getProperty("test.src", "./") + "/" + pathToStores + @@ -200,8 +210,13 @@ System.setProperty("javax.net.ssl.trustStore", trustFilename); System.setProperty("javax.net.ssl.trustStorePassword", passwd); - if (debug) + if (debug) { System.setProperty("javax.net.debug", "all"); + } + + Security.setProperty("jdk.tls.disabledAlgorithms", ""); + + tlsProtocol = args[0]; /* * Start the tests. diff -r a0f3377c58c7 -r 6425233b7567 test/jdk/sun/security/ssl/SSLSocketImpl/NoImpactServerRenego.java --- a/test/jdk/sun/security/ssl/SSLSocketImpl/NoImpactServerRenego.java Mon May 21 08:16:24 2018 -0700 +++ b/test/jdk/sun/security/ssl/SSLSocketImpl/NoImpactServerRenego.java Mon May 21 09:53:23 2018 -0700 @@ -28,12 +28,19 @@ * @test * @bug 7188658 * @summary Add possibility to disable client initiated renegotiation - * @run main/othervm - * -Djdk.tls.rejectClientInitiatedRenegotiation=true NoImpactServerRenego + * @run main/othervm -Djdk.tls.rejectClientInitiatedRenegotiation=true + * NoImpactServerRenego SSLv3 + * @run main/othervm -Djdk.tls.rejectClientInitiatedRenegotiation=true + * NoImpactServerRenego TLSv1 + * @run main/othervm -Djdk.tls.rejectClientInitiatedRenegotiation=true + * NoImpactServerRenego TLSv1.1 + * @run main/othervm -Djdk.tls.rejectClientInitiatedRenegotiation=true + * NoImpactServerRenego TLSv1.2 */ import java.io.*; import java.net.*; +import java.security.Security; import javax.net.ssl.*; public class NoImpactServerRenego implements @@ -157,6 +164,7 @@ (SSLSocketFactory) SSLSocketFactory.getDefault(); SSLSocket sslSocket = (SSLSocket) sslsf.createSocket("localhost", serverPort); + sslSocket.setEnabledProtocols(new String[] { tlsProtocol }); InputStream sslIS = sslSocket.getInputStream(); OutputStream sslOS = sslSocket.getOutputStream(); @@ -187,6 +195,9 @@ volatile Exception serverException = null; volatile Exception clientException = null; + // the specified protocol + private static String tlsProtocol; + public static void main(String[] args) throws Exception { String keyFilename = System.getProperty("test.src", "./") + "/" + pathToStores + @@ -200,8 +211,13 @@ System.setProperty("javax.net.ssl.trustStore", trustFilename); System.setProperty("javax.net.ssl.trustStorePassword", passwd); - if (debug) + if (debug) { System.setProperty("javax.net.debug", "all"); + } + + Security.setProperty("jdk.tls.disabledAlgorithms", ""); + + tlsProtocol = args[0]; /* * Start the tests.