TCP + TLS Handshake — animated

Every HTTPS page load starts with two handshakes: TCP's three-way handshake (SYN, SYN-ACK, ACK) opens the connection, then the TLS 1.3 handshake agrees encryption keys and checks the server's certificate — all before a single byte of the page is sent. Step through both, and watch the exact moment the conversation goes dark to eavesdroppers.

TCP connection · then TLS 1.3 inside it · HTTPS port 443 💻 Clientyour browser · port 51000 🌐 Servercertcrack.com · port 443 SYN
🔓 Plaintext phase — anyone on the path can read these messages.

🔍 Packet inspector — this message

Direction—
Flags / contents—
TCP Seq—
TCP Ack—
Ports—
Encrypted?—

The four ideas behind the handshake

Why three ways, not two?

The SYN / SYN-ACK / ACK exchange does two jobs at once: both sides announce their starting sequence numbers, and each side gets proof that traffic flows in both directions. Cut it to two messages and the server could never confirm the client received its number — the conversation would start on trust, not evidence.

Why TLS 1.3 is faster

TLS 1.2 needed two round trips before data could flow. TLS 1.3 needs just one: the client guesses the key-exchange group and sends its ECDHE key share inside the very first ClientHello, so the server can reply with everything at once. Legacy ciphers and the extra round trip were deleted — speed and safety in the same move.

Forward secrecy

The session keys come from ephemeral Diffie-Hellman (ECDHE): fresh keys, created for this one connection and thrown away afterwards. Record all the traffic today and steal the server's private key next year, and the recording still won't decrypt — the key that could open it no longer exists anywhere.

What the padlock does — and doesn't — prove

It proves the connection is encrypted and that you're talking to whoever holds a valid certificate for that exact domain. It does not prove the site is honest, competent or safe — a phishing site can have a perfectly valid padlock. And the network can still see which server (and usually which domain) you're visiting.

Keep the journey going

Where this appears on your exam

Questions students ask

What is the difference between TCP and TLS?
TCP is the transport: it turns the unreliable network into a reliable, ordered stream of bytes, but it offers no privacy at all. TLS runs on top of a TCP connection and adds three things TCP lacks: encryption (nobody in the middle can read the data), integrity (tampering is detected) and authentication (a certificate proves which server you are really talking to). HTTPS is simply HTTP carried inside TLS over TCP.

What can someone watching the network still see during an HTTPS session?
Quite a lot about the connection, nothing about the content. An on-path observer sees both IP addresses and ports, the domain name in the SNI field of the ClientHello (unless Encrypted Client Hello is used), the timing and sizes of packets, and how long the session lasts. They cannot see page contents, full URLs, form entries or passwords — those only ever travel encrypted after the ServerHello.

How is QUIC different from TCP plus TLS?
QUIC replaces the separate TCP handshake entirely. It runs over UDP and folds the TLS 1.3 handshake into its own connection setup, so transport and encryption are negotiated together in one round trip — and a returning client can sometimes send data immediately (0-RTT). It also removes TCP head-of-line blocking by giving each stream its own delivery order.

Why can't an attacker just copy the server's certificate and impersonate the site?
A certificate is public and copying it is easy — but it is only half of the identity. During the handshake the server must also produce a CertificateVerify signature over the conversation, which can only be created with the private key matching that certificate. The attacker does not have the private key, so the signature check fails and the browser aborts the connection.