TruckDriver
TruckDriver

Reputation: 1456

What is the TLS version in this code snippet of Java 1.7?

I am passing JVM parameter as -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2. But in code ,I am explicitly getting the SSL context object as SSLContext sc = null; sc = SSLContext.getInstance("TLS");.

Will the TLS version be highest version (1.2) in this case, or i need to explicitly get the TLS version as

sc = SSLContext.getInstance("TLSv1.2");

to support TLS version 1.2

Upvotes: 2

Views: 1367

Answers (1)

Thilo
Thilo

Reputation: 262644

Probably not.

According to the documentation, this setting is only used by HttpsURLConnection and URl#openStream.

https.protocols

Controls the protocol version used by Java clients which obtain https connections through use of the HttpsURLConnection class or via URL.openStream() operations.

If you directly obtain your own SSLContext, the setting is likely not consulted.

Upvotes: 1

Related Questions