TLS 1.2 Handshake

The complete TLS 1.2 handshake from ClientHello to Finished — certificate exchange, key agreement, and when encryption actually starts, animated step by step.

Scenario

Speed
TCP CONNECTIONTLS 1.2 HANDSHAKEENCRYPTED DATAClientServer1SYN seq=1002SYN, ACK seq=300 ack=1013ACK seq=101 ack=3014ClientHello (SNI, ALPN)5ServerHello, Certificate,[ServerKeyExchange], ServerHelloDone6ClientKeyExchange, ChangeCipherSpec,{Finished}7ChangeCipherSpec, {Finished}↓ everything below is encrypted8HTTP GET /
ClientESTABLISHED
ServerESTABLISHED

Current step 8/8

HTTP GET /

Application data now flows — over TLS as encrypted records.

Round trips to first byte

3 RTT

TCP 1 + TLS 2 = 3 round trips before the first byte

TCP segmentTLS handshakeApplication data

Numbers above arrows are the step order. In TLS 1.3, parts in {} are already encrypted — the certificate that was plaintext in 1.2 is hidden. Brackets [] mark conditional messages sent only with those cipher suites.

After TCP's 1 RTT, TLS 1.2 needs two more round trips: ClientHello ↔ ServerHello+Certificate, then ClientKeyExchange ↔ Finished — 3 RTT total before the first application byte.

ClientKeyExchange is the crux: the premaster secret encrypted with the server's public key lets both sides derive identical session keys from it plus the hello randoms. Only the server's private key can decrypt it, so eavesdroppers learn nothing.

Its weaknesses: RSA key exchange lacks forward secrecy (a later key leak exposes recorded traffic), and the certificate travels in plaintext. TLS 1.3 fixed both. TCP/TLS Handshake Visualizer

Frequently asked questions

What does the Finished message do?
It sends a hash of the entire handshake, encrypted with the session key — if a middleman tampered with any message, the hash won't match and the handshake fails. It's the downgrade-attack defense.
Does ECDHE give forward secrecy in 1.2?
Yes — ephemeral DH keys make session keys independent of the server's private key. TLS 1.2 supports it via ECDHE cipher suites; 1.3 made it mandatory.

Other scenarios