BAEL-6898: Add Debug property for ssl Handshakes (#14822)

This commit is contained in:
Harry9656 2023-10-09 09:53:54 +02:00 committed by GitHub
parent 0e7c032aa8
commit 901951bff7
3 changed files with 14 additions and 15 deletions

View File

@ -15,10 +15,8 @@ public class SimpleClient {
SocketFactory factory = SSLSocketFactory.getDefault(); SocketFactory factory = SSLSocketFactory.getDefault();
try (Socket connection = factory.createSocket(host, port)) { try (Socket connection = factory.createSocket(host, port)) {
((SSLSocket) connection).setEnabledCipherSuites( ((SSLSocket) connection).setEnabledCipherSuites(new String[] { "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" });
new String[] { "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256"}); ((SSLSocket) connection).setEnabledProtocols(new String[] { "TLSv1.2" });
((SSLSocket) connection).setEnabledProtocols(
new String[] { "TLSv1.2"});
SSLParameters sslParams = new SSLParameters(); SSLParameters sslParams = new SSLParameters();
sslParams.setEndpointIdentificationAlgorithm("HTTPS"); sslParams.setEndpointIdentificationAlgorithm("HTTPS");
((SSLSocket) connection).setSSLParameters(sslParams); ((SSLSocket) connection).setSSLParameters(sslParams);
@ -28,6 +26,7 @@ public class SimpleClient {
} }
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
System.setProperty("javax.net.debug", "ssl:handshake");
System.out.println(startClient("localhost", 8443)); System.out.println(startClient("localhost", 8443));
} }
} }

View File

@ -14,11 +14,10 @@ public class SimpleServer {
ServerSocketFactory factory = SSLServerSocketFactory.getDefault(); ServerSocketFactory factory = SSLServerSocketFactory.getDefault();
try (ServerSocket listener = factory.createServerSocket(port)) { try (ServerSocket listener = factory.createServerSocket(port)) {
System.setProperty("javax.net.debug", "ssl:handshake");
((SSLServerSocket) listener).setNeedClientAuth(true); ((SSLServerSocket) listener).setNeedClientAuth(true);
((SSLServerSocket) listener).setEnabledCipherSuites( ((SSLServerSocket) listener).setEnabledCipherSuites(new String[] { "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" });
new String[] { "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256"}); ((SSLServerSocket) listener).setEnabledProtocols(new String[] { "TLSv1.2" });
((SSLServerSocket) listener).setEnabledProtocols(
new String[] { "TLSv1.2"});
while (true) { while (true) {
try (Socket socket = listener.accept()) { try (Socket socket = listener.accept()) {
PrintWriter out = new PrintWriter(socket.getOutputStream(), true); PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
@ -29,6 +28,7 @@ public class SimpleServer {
} }
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
System.setProperty("javax.net.debug", "ssl:handshake");
startServer(8443); startServer(8443);
} }
} }