← Lessons

quiz vs the machine

Gold1440

Networking

The TLS Handshake Walkthrough

How two parties agree on keys before sending any secret data.

6 min read · core · beat Gold to climb

Agreeing in the Open

Transport Layer Security protects a connection, but first the two sides must agree on keys while an eavesdropper may be watching. The handshake is the opening exchange that authenticates the server and derives a shared secret.

The Core Steps

The client opens the conversation and the server responds with its identity and choices.

  • The client sends a hello listing supported versions, cipher suites, and a key share.
  • The server replies with its chosen cipher, its certificate, and its own key share.
  • Both sides combine the key shares to compute the same session keys.

Authentication and Finish

The certificate lets the client check the server is who it claims to be, verified against a trusted authority. Each side then sends a finished message covering the whole handshake, so any tampering breaks the check.

  • The client verifies the certificate chain.
  • Both sides confirm they derived matching keys.
  • After finished messages, application data flows encrypted.

Why the Order Matters

Key shares are exchanged before secrets so no long term key needs to encrypt the session. The certificate binds the public key to the name, stopping an attacker from impersonating the server.

Key idea

The TLS handshake exchanges hellos and key shares, authenticates the server with a certificate, and confirms matching session keys with finished messages before any application data is sent.

Check yourself

Answer to earn rating on the learn ladder.

1. What does the server send to prove its identity in the handshake?

2. Why do both sides exchange key shares during the handshake?

3. What protects the handshake messages from tampering?