When you open your bank's website, your browser and the bank's server first set up a protected connection, and the set of rules they follow to do it is called TLS, short for Transport Layer Security. The padlock beside the address means TLS is running. This page follows version 1.3, the current version, one message at a time and explains each term before using it.
What TLS has to do
Every machine between you and the bank can copy the packets it forwards. Call a stranger on the same cafe Wi-Fi Mallory. She can read your data, change it on the way, or pose as the bank. To stop all three, a connection needs three guarantees: confidentiality, which means only you and the bank can read the data, integrity, which means any change on the way is noticed, and authentication, which means you know who is at the other end.
TLS 1.3 gets them from three tools. A key exchange lets both sides create a shared secret without ever sending it. A certificate and a signature prove who the server is. A fast cipher called AES-GCM then protects the data with keys built from the secret.
Step 1: ClientHello with a key share
The browser speaks first. Its message, called ClientHello, lists the TLS versions and the ciphers it supports, where a cipher is a method for scrambling data with a key. It also carries a key share, which is the public half of a Diffie-Hellman exchange. Browsers commonly use X25519, an elliptic-curve version whose key share is 32 bytes long.
The browser has to guess which exchange the server will accept, and it sends the key share for that guess right away instead of asking first. That guess is what lets TLS 1.3 finish in one round trip. If the server does not support it, the server asks the browser to try again, which costs one extra trip. Mallory can read this message, but a key share is public by design and tells her nothing she can use.
Step 2: ServerHello and the session keys
The server answers with ServerHello, which names the cipher it chose and carries its own key share. Now both sides hold the other's public value, so each can compute the same secret number while Mallory, who has seen only public values, cannot. Both sides feed that secret, together with a hash of the messages so far, into a key derivation function. A hash is a fixed-size fingerprint of data, and a key derivation function stretches one secret into several independent keys.
The results are the session keys, symmetric keys that protect this one connection and nothing else. There are separate keys for each direction and each stage of the connection, which limits the damage if one is ever exposed.
Step 3: the encrypted certificate and signature
Everything after ServerHello is already encrypted with keys derived from the shared secret, including the certificate. A certificate is a signed statement from a certificate authority saying that a given public key belongs to a given name, for example bank.example, between two dates. The server sends its certificate chain and also a signature over the handshake so far, made with its private key. The signature shows that the server holds the private key named in the certificate, and because it covers this particular handshake it cannot be replayed into another connection.
The browser checks the chain up to a root authority that its device already trusts, then checks the name, the dates and the signature. This is the authentication step. Signatures are made with RSA or an elliptic-curve scheme.
Step 4: Finished
Each side now sends a Finished message, which is a short tag computed over the whole handshake with a key derived from the secret. If Mallory had altered any earlier message, for instance to strip out the stronger ciphers, the two sides would have seen different handshakes, the tags would not match and the connection would be dropped.
Step 5: your data, protected with AES-GCM
From here your request travels inside AES-GCM. AES, the Advanced Encryption Standard, scrambles data with a single shared key, and the GCM mode attaches a 16-byte tag computed from the key and the ciphertext. If anyone changes even one bit, the receiver's recomputed tag no longer matches and the message is thrown away. Mallory can see only that roughly 200 bytes went by.
Why it takes one round trip
The browser's first message already contains its key share, so after a single trip to the server and back both sides hold session keys. The browser sends its Finished message together with the first request, so no further waiting is needed. This count starts once the underlying TCP connection exists. TLS 1.2 needed two round trips because the key exchange began only after an initial exchange of hellos.
Forward secrecy
The secret numbers behind each key share are created fresh for every connection and deleted afterwards. A server key stolen next year therefore cannot unlock last month's recordings, a property called forward secrecy. Older TLS versions let the browser invent a session key and lock it with the bank's RSA public key, so one leaked private key could open every recording at once. TLS 1.3 removed that option for this reason.
Forward secrecy has a limit. It protects against a stolen server key, but a future quantum computer would not need that key, because it could solve each recorded key exchange directly. That is why browsers are adding post-quantum key exchange to the handshake.
The three guarantees and their tools
| Guarantee | Tool | Where it appears |
|---|---|---|
| Confidentiality | Key exchange, then AES-GCM | Steps 1, 2 and 5 |
| Integrity | AES-GCM tag, Finished messages | Steps 4 and 5 |
| Authentication | Certificate chain and the server's signature | Step 3 |
Common questions
Is TLS the same as SSL?
SSL is the older protocol that TLS grew out of. People still say SSL, but every current connection uses TLS.
Does the padlock mean a site is trustworthy?
It means the connection is encrypted and the certificate matched the name in the address. It says nothing about whether the owner of that name is honest.