You open your bank's website and type in your password. Before that password leaves your browser, something important has already happened: your browser and the bank's server have spent a few milliseconds agreeing on how they'll talk, proving who they are, and creating a secret that only the two of them share.
That negotiation is the TLS handshake. Most developers know the acronym. Far fewer can describe what actually happens, and that gap matters, because the handshake is where HTTPS's security is either established or fails.
the two jobs of the handshake
TLS does two things before secure communication can begin:
- Verify identity. The client confirms it's talking to the real server, not an impostor.
- Establish keys. Both sides create shared secret keys used to encrypt everything afterward.
Only after both are complete does HTTP data start moving. Everything after the handshake is symmetric encryption with keys that never crossed the network in readable form.
the sequence, step by step
The details vary by TLS version, but the flow in TLS 1.3, the modern standard, looks like this:
sequenceDiagram
participant C as Browser
participant S as Bank server
C->>S: ClientHello: supported versions, ciphers, key share
S->>C: ServerHello: chosen cipher, key share
S->>C: Certificate, signature proving key ownership
C->>C: Verify certificate chain and hostname
C->>S: Finished
S->>C: Finished
Note over C,S: Both derive the same session keys
C->>S: Encrypted HTTP request with passwordHere is what each step is doing.
1. The client says what it supports. The browser's ClientHello lists the TLS versions and cipher suites it can use, and includes a key share, a piece of public key material for a key exchange.
2. The server chooses. It picks the strongest mutually supported options and replies with its own key share. Both sides can now compute a shared secret, even though everything they've sent so far is visible to anyone watching.
3. The server proves its identity. It sends its certificate and a signature made with the certificate's private key. The signature shows the server actually controls that key, not just that it possesses a copy of a public certificate.
4. The client verifies. The browser checks that the certificate was issued by a trusted certificate authority, that it hasn't expired, and that its name matches the domain you typed. If any of those checks fail, the browser warns you or stops.
5. Both sides finish. Each derives the session keys from the shared secret and confirms the handshake messages weren't tampered with.
Only then does the encrypted HTTP request, including your password, travel the wire.
why the network sees encrypted data, not your password
Someone on the same café Wi-Fi can see that you connected to the bank, when, and how much data moved. They can't read the contents, because the keys that decrypt the traffic exist only on your device and the bank's server.
That property depends on the key exchange. Modern TLS uses ephemeral key exchange, meaning each session generates fresh keys that are discarded afterward. Even if the server's long-term private key were stolen later, past sessions remain protected. This is called forward secrecy, and it's one reason TLS 1.3 removed older key exchange methods that lacked it.
what the certificate does and doesn't prove
A certificate proves a server controls a key that a trusted authority has bound to a domain name. It doesn't prove the business behind that domain is honest, the website design is legitimate, or the server is free of vulnerabilities.
Phishing sites can and do obtain valid certificates for their own domains. The padlock in the browser means the connection is encrypted and the domain matches the certificate. It doesn't mean the domain is the one you intended to visit. Check the address itself.
common failure points
Understanding the handshake makes these failures easier to diagnose:
- -Expired or misconfigured certificates. The verification step fails, and clients refuse to connect, as covered in the certificate lifecycle post.
- -Missing intermediate certificates. The server sends a leaf certificate, but the client can't build a chain to a trusted root.
- -Hostname mismatch. The certificate was issued for a different name, so validation fails even though the certificate itself is valid.
- -Incompatible protocols or ciphers. No common option exists in step 2, so the handshake ends before identity is even checked.
- -Clock skew. A device with an incorrect time may consider a valid certificate expired or not yet valid.
When troubleshooting, the handshake is the place to look: which step failed tells you what to fix.
what to do with this knowledge
A few practical habits follow from understanding the handshake:
- -Use TLS 1.2 at minimum, and prefer TLS 1.3 where your clients support it.
- -Serve the full certificate chain, not just the leaf certificate.
- -Disable legacy protocols and weak cipher suites.
- -Test the live endpoint with tools such as
openssl s_clientto see exactly what clients receive.
Tools that show the handshake step by step make abstract concepts concrete. Running one against a site you use is one of the fastest ways to understand this process.
the takeaway
TLS does two essential things before any secure communication starts. It verifies the server's identity through its certificate, and it establishes shared keys that encrypt the session. Once the handshake completes, HTTPS can safely carry your data, even across networks you don't trust.
Learn the handshake, not just the acronym. When something breaks in production, the failure almost always sits at a specific step in that sequence, and knowing the sequence is how you find it.