How Does SSL Work? The TLS Handshake Explained Step by Step

Summarize this article with AI:

Table of Contents

SSL, now properly called TLS, lets a browser and a server agree on secret keys before any page data moves. The server proves its identity with a certificate. Both sides then use shared keys to encrypt everything, so outsiders see only scrambled bytes.

Definition: TLS (Transport Layer Security) is the protocol behind the padlock. SSL is its older name, and the SSL versions themselves are no longer safe to use.

What Happens When You Open an HTTPS Website?

Your browser opens a connection and starts a handshake before sending the page request. The two sides agree on a TLS version and cipher, the server shows its certificate, and both derive session keys. Only then does the encrypted HTTP request go through.

Think of it as showing ID and agreeing a private code before a conversation starts. The conversation itself is the page you asked for.

What Are the Steps of a TLS Handshake?

The client sends a hello with its supported versions and key shares. The server answers with its choice and a certificate. Each side proves it holds the right keys, then both send Finished messages. We captured a real handshake to show the order.

TLS 1.3 handshake sequence diagram

Recreated diagram. Message names and sizes come from a real OpenSSL 3.0.13 trace against a local test server, 2 December 2026.

  1. ClientHello: the browser lists supported versions, ciphers and a key share.
  2. ServerHello: the server picks one and sends its own key share.
  3. EncryptedExtensions and Certificate: the server sends its certificate chain.
  4. CertificateVerify: the server signs the handshake to prove it owns the private key.
  5. Finished: both sides confirm the handshake was not altered.

In TLS 1.3, every message after ServerHello is encrypted, according to the TLS 1.3 specification.

How Do the Browser and Server Agree on a Secret Key?

Both sides run an ephemeral Diffie-Hellman exchange. Each sends a public value, and each combines it with its own private value to reach the same secret. The secret itself never crosses the wire. In our test the curve was X25519, a common choice.

TLS key exchange four step diagram

Recreated diagram. Values come from a real s_client connection to our test server: the key exchange curve, the signature digest and the cipher suite.

Because the keys are temporary, stealing the server's private key later does not expose old recordings. That property is called forward secrecy.

What Does the Certificate Do in the Handshake?

The certificate ties the server's public key to a domain name, and a CA signs it. The browser checks the signature chain, the dates and the name. If any check fails, it shows a warning. This step stops an impostor from pretending to be the site.

If the chain is incomplete, verification fails. See what an intermediate certificate is for the usual cause, and how a certificate authority works for who signs what.

How Is TLS 1.3 Different from TLS 1.2?

TLS 1.3 removes legacy options and hides more of the handshake. The RFC lists static RSA and plain Diffie-Hellman suites as removed, so every key exchange gives forward secrecy. It also encrypts handshake messages after ServerHello. TLS 1.2 shows the certificate in the clear.

TLS 1.3 and TLS 1.2 handshake size comparison chart

Recreated chart from two real traces of the same server. TLS 1.2 adds ServerKeyExchange and ClientKeyExchange, and its certificate travels unencrypted.

PointTLS 1.2TLS 1.3
Handshake after ServerHelloSent in the clearEncrypted
Certificate visible on the wireYesNo, it is encrypted
Static RSA key exchangeAllowedRemoved
Cipher in our testECDHE-RSA-AES256-GCM-SHA384TLS_AES_256_GCM_SHA384

Does SSL Still Exist, or Is It All TLS Now?

The name SSL lives on, but the protocol does not. SSL 3.0 was declared not sufficiently secure, and RFC 7568 requires that it not be used. Today's connections use TLS 1.2 or 1.3. A product called an SSL certificate is really a TLS certificate.

The IETF's SSLv3 prohibition explains the change. For the naming history, see SSL, TLS and HTTPS explained.

What Is Encrypted After the Handshake?

Everything the browser and server exchange: the request URL path, headers, cookies, form data and the page itself. Symmetric encryption does the work, because it is fast. An eavesdropper still sees the server's IP address and the connection's size and timing.

  • Encrypted: page content, cookies, form fields, headers.
  • Visible to the network: IP addresses and traffic volume.
  • Often visible: the site name in the handshake, unless extra privacy features are used.

How can You See the Handshake Yourself?

Run openssl s_client with the -trace option against any HTTPS server and read the messages. For your own site, add -servername so the right certificate is chosen. The output lists each handshake message, the protocol, the cipher and the verification result.

openssl s_client -connect www.example.com:443 -servername www.example.com -trace

We ran it against a local test server only. Run it on your own domain to see your real setup.

Frequently Asked Questions

Is SSL the same as TLS?

TLS replaced SSL. People still say SSL, but the secure versions are all TLS.

Does the padlock mean a site is safe?

No. It means the connection is encrypted and the certificate matched the domain. The site's owner could still be malicious.

Is the certificate used to encrypt my data?

Not directly. It proves identity and carries a public key. The data is encrypted with session keys from the handshake.

Why does the handshake use two kinds of cryptography?

Public-key methods authenticate and agree on keys. Symmetric ciphers then encrypt the data, because they are much faster.

How many round trips does TLS 1.3 need?

TLS 1.3 needs one round trip for a full handshake. The RFC also adds an optional 0-RTT mode that trades away some security properties.