Currently I am using Java 7 and I am unable to connect to LDAPS. I tried with the code below, but I am still unable to connect:
SSLContext ctx = SSLContext.getInstance("TLSv1.2");
ctx.init(null, null, null);
SSLContext.setDefault(ctx);
Below is the error I get from my program:
2018-04-10 15:21:23,446 INFO [stdout] (EJB default - 1) EJB default - 1, WRITE: TLSv1.2 Handshake, length = 221
2018-04-10 15:21:23,446 INFO [stdout] (EJB default - 1) EJB default - 1, READ: TLSv1.2 Alert, length = 2
2018-04-10 15:21:23,446 INFO [stdout] (EJB default - 1) EJB default - 1, RECV TLSv1 ALERT: fatal, handshake_failure
2018-04-10 15:21:23,446 INFO [stdout] (EJB default - 1) EJB default - 1, called closeSocket()
2018-04-10 15:21:23,446 INFO [stdout] (EJB default - 1) EJB default - 1, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
After that I have tried to run Protocol Test to check supported protocols:
Supported Protocols: 5
SSLv2Hello
SSLv3
TLSv1
TLSv1.1
TLSv1.2
Enabled Protocols: 1
TLSv1
I have added the line below to disable TLSv1 and enable TLSv1.2 in java.security
:
jdk.tls.disabledAlgorithms= SSLv3, SSLv2Hello, TLSv1, TLSv1.1
And run again the Protocol Test and it the result is:
Supported Protocols: 5
SSLv2Hello
SSLv3
TLSv1
TLSv1.1
TLSv1.2
Enabled Protocols: 0
I have confirmed that my LDAPS server is supported and uses TLSv1.2. I also enabled TLS1.2 in Java Control Panel because whenever I tried to use TLSv1 it causes protocol_version
error
My questions are:
- What is
RECV TLSv1 ALERT: fatal, handshake_failure
? - How to enable TLSv1.2 in supported Protocols?
- Edit Does Java 7 or 8 support cipher suite:
ECDHE-ECDSA-AES256-GCM-SHA384
?
I'm using Java 1.7_80.
jdk.tls.client.protocols="TLSv1.2"
and disabling the others? Note that the support for TLS 1.2 and the support of ECDSA means that the combination of both is supported; cipher suites need to be implemented, they are not magically combined. – Maarten Bodewes