How do I get the Cipher used by an HTTPS Connection in Java? I need to find the TLS version used whether it's TLS 1.1 or 1.2 after hitting the URLusing the below code:
url = new URL(https_url);
HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
Screenshot of the firefox browser is give below. Can any one help me in getting this? TLS Version
I have tried
SSLSocket socket = (SSLSocket) con.getSSLSocketFactory().createSocket();
String[] test = socket.getSSLParameters().getProtocols();
But this gives the list of protocols that are enabled for the connection. Where as I need the the protocol that was used in the response from the server.
The screenshot attached shows what I expecting to read(TLS 1.2)