Dhanraj MC
Dhanraj MC

Reputation: 21

Support for TLSv1.1 in jdk 1.7.0_79

We have tried the below code to identify the protocols supported by the java version 1.7.0_79

SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket soc = (SSLSocket) factory.createSocket();

// Returns the names of the protocol versions which are
// currently enabled for use on this connection.
String[] protocols = soc.getEnabledProtocols();

System.out.println("Enabled protocols:");
for (String s : protocols) {
  System.out.println(s);
}

Output for the above program..

1.7.0_79 
Enabled protocols: 
TLSv1

In order to support TLSv1.1 we have tried following options

in java.security which didn't help as well. Could someone help in identifying the changes to be done in jdk 1.7.0_79?

Upvotes: 1

Views: 1892

Answers (1)

Prakash_se7en
Prakash_se7en

Reputation: 88

you were almost there .You can disable TLSv1.0 by adding below entries in your code for JDK 1.7.0_79

sslSocket.setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});

for further explaination please refer here

Example

SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslSocket = (SSLSocket) factory.createSocket();
sslSocket.setEnabledProtocols(new String[] {"TLSv1.1", "TLSv1.2"});
// Returns the names of the protocol versions which are
// currently enabled for use on this connection.
String[] protocols = sslSocket.getEnabledProtocols();

System.out.println("Enabled protocols:");
for (String s : protocols) {
  System.out.println(s);
}

Output-

Enabled protocols:
TLSv1.1
TLSv1.2

Other ways

In addition ,if you were allowed migrating to JDK1.8 then by default it disables TLSv1.0 and supports TLSv1.1,TLSv1.2

Upvotes: 1

Related Questions