java.lang.IllegalArgumentException: TLSv1.2 on JRE 1.5

28.1k views Asked by At

I am trying to consume TLSv1.2 enabled protocol web services on JRE 1.5 and facing below issue. Looks like TLSv1.2 does not supported by JRE1.5 but at the same time we cannot upgrade our target environment to a latest version of JRE. IS there any way to make this work in jdk1.5 itself?

Exception in thread "main" java.lang.IllegalArgumentException: TLSv1.2
    at com.sun.net.ssl.internal.ssl.ProtocolVersion.valueOf(ProtocolVersion.java:120)
    at com.sun.net.ssl.internal.ssl.ProtocolList.<init>(ProtocolList.java:36)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.setEnabledProtocols(SSLSocketImpl.java:2017)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:396)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:170)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:857)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
    at TLSHandshake.main(TLSHandshake.java:43)

Thanks in advance

2

There are 2 answers

0
Robert On

Most developer questions that end with "is it possible?" can be answered yes. The only problem may be the necessary effort and the costs...

Java is at large parts a modular architecture which means that you can implement own modules that replace and extend functionality from Java.

If you want you can implement your own networking implementation that uses a JNI part for establishing TLS 1.2 connections. The JNI part would use one of the common SSL/TLS native libraries such as OpenSSL/LibreSSL/gnutls,...).

From my understanding this would require an very experienced Java and C/C++ developer (team) for some weeks/months.

From a long term perspective using that developer (team) for migrating to Java 1.7/1.8 would make more sense.

0
Andrius Bentkus On

You can use the bouncy castle tls provider library, it has support for jdk 1.5

The download site for their libraries is here https://www.bouncycastle.org/latest_releases.html you can also use maven.

There is also an example on how to use their provider: https://github.com/bcgit/bc-java/blob/master/tls/src/test/java/org/bouncycastle/jsse/provider/test/BCJSSEClientTest.java#L31-L35