I'm studying the SSL/TLS protocol, more specifically its handshake. I know that initially, a client sends a Client Hello message to the server which includes the TLS version supported by the client.
I have an application that uses HTTPS connections, implemented with WinHTTP in the client and Apache Java in the server. I'm tracing the HTTPS traffic with Wireshark, which looks like this:
Client Hello, version-TLS 1.2 Server Hello, version-TLS 1.2 Client Key Exchange, version-TLS 1.2 Client Cipher spec, version-TLS 1.2 Application data, version-TLS 1.2 Encrypted alert version-TLS 1.2 [from client] FIN version-TLS 1.2 ACK version-TLS 1.2
I don't know what
Encrypted alert means (in Wireshark it is displayed as
Encrypt alert (21)) - since it is sent by the client I'm assuming it's a Close notify alert.
A few seconds after the initial session is closed, a new session starts as follows:
Client Hello, version-TLS 1.0 Server Hello, version-TLS 1.0 Client Key Exchange, version-TLS 1.0 Client Cipher spec, version-TLS 1.0 Application data, version-TLS 1.0 Encrypted alert version-TLS 1.0 [from client] FIN version-TLS 1.0 ACK version-TLS 1.0
From this, I conclude the version changes, and so the cipher.
This doesn't seem to happen every time: Sometimes a new session will use TLS 1.2, sometimes it falls back to TLS 1.0. What's the reason of this?