How HTTPS Really Works (And What the Classic Explanation Gets Wrong)
The old story says the client encrypts a session key with the server's public key. Modern TLS 1.3 does something better. Here is the actual handshake.
On this page
If you learned HTTPS from a diagram, you probably learned that the browser takes the server’s public key from the certificate, encrypts a random session key with it, and sends it over. That was real once. It is not how modern TLS works, and the difference is exactly why recorded traffic today stays unreadable even if a server key leaks tomorrow.
The sequence in TLS 1.3
- TCP connects first
Before any security, client and server complete the ordinary TCP three-way handshake. Nothing is encrypted yet.
- ClientHello: offer and key share
The client says which cipher suites and protocol versions it supports, and immediately includes its half of a key exchange (an ephemeral public value). Sending this up front is what lets TLS 1.3 finish in one round trip.
- ServerHello: choose and key share
The server picks a cipher suite and returns its own ephemeral value. Both sides can now compute the same shared secret, and everything after this point in the handshake is already encrypted.
- Certificate and proof of identity
The server sends its certificate chain and a signature over the handshake transcript made with the certificate’s private key. The client validates the chain up to a trusted certificate authority, checks the domain name and expiry, and verifies the signature.
- Finished messages, then application data
Each side sends a Finished message proving it derived the same keys and saw the same handshake. From here, HTTP requests and responses flow encrypted with a symmetric cipher.
The three jobs TLS is doing
Why the old explanation is outdated
In RSA key transport, the client generated the session key and encrypted it to the server’s long-term public key. That has a nasty property: whoever later obtains the server’s private key can decrypt every recorded session that used it.
With ephemeral Diffie-Hellman, the session secret is derived from values that are thrown away after the handshake. The certificate’s private key only signs to prove identity. Stealing it later lets an attacker impersonate the server going forward, but not decrypt yesterday’s captured traffic. That property is forward secrecy, and TLS 1.3 makes it mandatory.
Public-key math is orders of magnitude slower than symmetric ciphers. TLS spends the expensive operations on authentication and agreeing a secret, then protects the actual bytes with fast symmetric encryption. This is the same split in every secure protocol you will meet.
What the padlock does and does not promise
The padlock means the connection is encrypted and the server controls the domain you typed. It does not mean the site is trustworthy, honest, or free of malware. A phishing site on its own look-alike domain can have a perfectly valid certificate.
Do
Enable TLS 1.3, automate certificate renewal, redirect HTTP to HTTPS, and add HSTS so browsers refuse to downgrade.
Don't
Treat HTTPS as proof of legitimacy for users, or leave old protocol versions and RSA key exchange suites enabled “for compatibility” without a reason.
Takeaway
HTTPS is TCP, then a TLS handshake that authenticates the server and agrees fresh keys, then symmetric encryption for everything. The detail worth keeping is that identity and key agreement are separate: the certificate proves who you are talking to, the ephemeral exchange creates a secret that dies with the session.
Frequently asked questions
Does the client encrypt the session key with the server's public key in TLS 1.3?
No. That was RSA key transport, used in older TLS versions and removed from TLS 1.3. Today both sides run an ephemeral Diffie-Hellman exchange to derive a shared secret. The certificate's key is used only to sign the handshake and prove the server's identity, not to carry the session key.
What is forward secrecy and why does it matter?
Forward secrecy means each session uses fresh, ephemeral keys that are discarded afterwards. If an attacker records your traffic today and steals the server's private key next year, they still cannot decrypt old sessions, because the session keys were never derivable from that long-term key.
What does the certificate actually prove?
It binds a domain name to a public key and is signed by a certificate authority the browser trusts. The server proves it holds the matching private key by signing handshake data. Together this tells the client it is talking to the real owner of that domain, not a middleman.
Why does TLS switch to symmetric encryption for the data?
Asymmetric operations are far slower than symmetric ones. TLS uses public-key techniques only to authenticate and agree on a shared secret, then encrypts all application data with fast symmetric ciphers, authenticated so tampering is detected.



/* Comments */
Comments are offline right now — we reconnect automatically, nothing is lost.