How the TLS Handshake Works

Intermediate
8 min read· Security

The TLS handshake is the negotiation that happens before any HTTPS data is exchanged. It lets a client and server agree on encryption, verify the server identity via a certificate, and securely establish a shared session key — all over an insecure network. It cleverly uses slow asymmetric cryptography just to set up a fast symmetric key that encrypts the actual traffic. TLS 1.3 streamlined this to a single round trip and mandated forward secrecy, making HTTPS both faster and safer.

Think of agreeing on a secret code before talking

Two people who have never met want to talk privately in a crowded room. First, one shows verified ID so the other knows who they are (the certificate). Then, using a clever public method anyone could watch, they jointly arrive at a secret passphrase that eavesdroppers cannot derive (the key exchange). From then on they whisper in a shared code that is fast to speak (symmetric encryption). The upfront ceremony is the handshake; the private chat afterward is your encrypted session.

Step by Step

1 / 5

Key Concepts

Asymmetric vs Symmetric

The handshake uses slow asymmetric cryptography (public/private keys) to authenticate and agree on a key, then switches to fast symmetric encryption (one shared key) for the bulk data — the best of both.

Certificate and CA

The server certificate binds its public key to its domain and is signed by a trusted Certificate Authority. The client trust in the CA is what lets it trust the server identity.

Forward Secrecy

Using ephemeral key exchange so each session key is unique and not derivable from the server long-term private key. Even if that key is later stolen, past sessions stay secret. TLS 1.3 requires it.

TLS 1.3 Improvements

TLS 1.3 reduced the handshake to one round trip (with a 0-RTT resumption option), removed weak legacy algorithms, and mandated forward secrecy — making HTTPS faster and more secure than TLS 1.2.

Key Facts

  • The handshake authenticates the server and agrees a key without ever transmitting the shared secret in the clear — that is the core cryptographic trick.
  • Asymmetric cryptography is used only to bootstrap; the actual data is encrypted with much faster symmetric keys.
  • TLS 1.3 cut the handshake to a single round trip and made forward secrecy mandatory, so intercepted traffic cannot be decrypted later even if the server key leaks.

Real-World Applications

Every HTTPS connection

Loading a website over HTTPS performs a TLS handshake first: your browser verifies the site certificate and negotiates a session key, after which all page data is encrypted end to end.

Securing API and service traffic

APIs and internal services use TLS (and often mutual TLS) so requests and responses are encrypted and the server identity is verified, protecting credentials and data from network eavesdropping.

Frequently Asked Questions

What happens during a TLS handshake?

The client and server negotiate security parameters, the server proves its identity with a certificate, and both sides establish a shared session key over the insecure network. Specifically: the client proposes supported versions and cipher suites, the server responds and sends its CA-signed certificate, the client verifies that certificate, both derive a shared secret via a key-exchange algorithm without transmitting it, and then they switch to fast symmetric encryption for the actual data. All of this happens before any application data is sent.

Why does TLS use both asymmetric and symmetric encryption?

Asymmetric cryptography (public/private key pairs) is excellent for authentication and securely agreeing on a key, but it is computationally slow. Symmetric cryptography (a single shared key) is much faster but requires both parties to already share a secret. TLS combines them: it uses asymmetric methods during the handshake to authenticate the server and establish a shared session key, then uses that key with fast symmetric encryption for all the actual data. This gives both strong security and good performance.

What is forward secrecy in TLS?

Forward secrecy means each session uses a unique, ephemeral key that cannot be reconstructed from the server long-term private key. So even if an attacker records encrypted traffic today and later steals the server private key, they still cannot decrypt those past sessions. It is achieved with ephemeral key-exchange algorithms, and TLS 1.3 makes it mandatory, closing a serious risk present in older configurations.

How is TLS 1.3 better than TLS 1.2?

TLS 1.3 streamlined the handshake to a single round trip (with an optional 0-RTT mode for resumed connections), reducing latency. It removed outdated and weak cryptographic algorithms that had caused vulnerabilities, and it made forward secrecy mandatory so past sessions remain secure even if the server key is later compromised. The result is a handshake that is both faster and more secure than TLS 1.2.

Related Topics