Search code examples
javatls1.2sslv3sslcontextssl-security

Log displays TLSv1 instead of SSLv3


I have enabled logs in my application using -Djavax.net.debug=all option. Code that have written is supposed to use SSLv3 protocol, but in logs when I am checking it is displaying as ::

*** ClientHello, TLSv1

*** ServerHello, TLSv1

As far as I understand from reading is, Client and Server using TLSv1 for handshake, but as I have used SSLv3 in my code while initiating socket, ideally it should print SSLv3 instead TLSv1.

Below is the code snippet I have used :

SSLContextBuilder builder = new SSLContextBuilder();
builder.useProtocol("SSLv3");

SSLContext sslContext = builder.build();

Can someone please clarify the reason for the same, or is there something else I have missed out. Just to add on I am on Java 7.


Solution

  • Most probably SSLv3 is just not supported by server (which is recommended configuration nowadays because of security), so the lib uses least supported TLS version.

    UPD: seems that hello format says nothing about what protocol will be used in fact. There's something from Java docs:

    Currently, the SSLv3, TLSv1, and TLSv1.1 protocols allow you to send SSLv3, TLSv1, and TLSv1.1 hellos encapsulated in an SSLv2 format hello. For more details on the reasons for allowing this compatibility in these protocols, see Appendix E in the appropriate RFCs (previously listed).

    Note that some SSL/TLS servers do not support the v2 hello format and require that client hellos conform to the SSLv3 or TLSv1 client hello formats.

    The SSLv2Hello option controls the SSLv2 encapsulation. If SSLv2Hello is disabled on the client, then all outgoing messages will conform to the SSLv3/TLSv1 client hello format. If SSLv2Hello is disabled on the server, then all incoming messages must conform to the SSLv3/TLSv1 client hello format.