0

I want to enable TLSv1.2 as default protocol for clients in jdk7. I can see java 7 supports TLS v1.1, 1.2 but the default enabled is TLSv1.0.

I have gone through some post like this one here which says the client application has to specify in startup scripts which security protocol they want to use or the other way to do this is by java programming.

So is there any way out by which I can chnage the default enabled protocol to TLSv1.2 So that no chnage is required in all the running client application.

This is the code which we are using to initiate SSL connection.

//create the SSLContext with your key manager and trust
//manager, and get your socket factory from the context:
SSLContext ctx = SSLContext.getInstance("SSL");
ctx.init(km, tm, null);
SSLSocketFactory factory = ctx.getSocketFactory();
halfer
  • 19,824
  • 17
  • 99
  • 186
Nikhil Agrawal
  • 26,128
  • 21
  • 90
  • 126
  • Enabling TLSv1.2 in JDK is a broad term. can you add the code in your post which makes initiates SSL connection ? And also how do you launch your client application ? (There is no way to drop this magic of code into your running application (without restart) if your client talks to server directly and you have no controller over server) – jmj May 30 '17 at 06:49
  • @JigarJoshi Thanks for the reply. I added the code. Client application is deployed on weblogic managed server so to restart the application we restart the managed server. – Nikhil Agrawal May 30 '17 at 06:59
  • Looks like duplicate of https://superuser.com/questions/747377/enable-tls-1-1-and-1-2-for-clients-on-java-7 – eis May 30 '17 at 07:03
  • What exact Java version do you use? (OpenJDK or Oracle JDK? what build?) Why not upgrading to JDK 8? – apangin May 31 '17 at 23:31

1 Answers1

1

Change it to this at the entry point of your Main

    SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
    sslContext.init(null, null, null);
    SSLContext.setDefault(sslContext);
jmj
  • 237,923
  • 42
  • 401
  • 438