Skip to content
Advertisement

How to force java SSLContext to use TLSv1.1

How do I get a jersey client to use TLSv1.1? I’m trying to force a com.sun.jersey.client.urlconnection.HTTPSProperties (jersey client code eventually goes to this class) to use TLSv1.1 (or TLSv1) to write test code that confirms a server’s protocols. As I setup the client, I do the following:

JavaScript

Inside HTTPSProperties (I downloaded the 1.x source so this may be wrong) I see:

JavaScript

If I use SSLContext.getInstance("TLS"); instead, the code works fine. I’ve tried add System.setProperty("https.protocols", "TLSv1.1"); but it still doesn’t work. The code above gives the stack trace:

JavaScript

My server (Jetty 9.4.41) thinks it is allowing TLSV1.1. When I dump the sslFactory I get:

JavaScript

Any help is appreciated! Thanks in advance.

Advertisement

Answer

I simplified the question to how do I force a client to use TLSv1.1

I gave up using the jersey client and just used HttpsURLConnection. Turns out using the System.setProperties wasn’t a good ideal but the Diagnostics link from Tasos P. gave me ViewMyClient from SSL Labs.

Code below results in a report that SSL 3, TLS 1.0, and 1.1 are available but TLS 1.2, 1.3 and SSL 2 are not.

JavaScript
Advertisement