How TLS agrees without sending a key
One round trip, a secret the network cannot see, and no key on the wire. The mechanism, not the mythology.
The browser opens a connection and within a single round trip both ends hold a secret the whole network between them does not know. No key was ever sent. That is the least believable part of TLS, and it rests only on arithmetic anyone can check.
Two keys, two different jobs
A public key pair is not an "encryption key" in the ordinary sense. It is a way to prove identity.
The server keeps the private key and never sends it. The certificate contains the matching public key, and a CA has signed that certificate. When the browser trusts the CA, the certificate becomes an assertion: "this public key belongs to khanhsec.com".
The only job that pair has in TLS 1.3 is to sign one handshake message. It does not encrypt data. The data travels under a different key, generated for this session alone.
Exchanging a key without sending one
The mechanism is elliptic-curve Diffie–Hellman, and the idea is graspable without a proof:
- Each side picks a random secret nobody else knows.
- Each side computes a public point from it and sends that point.
- Both combine the other's point with their own secret to arrive at the same third point.
An eavesdropper sees both public points. Deriving the third point from them is equivalent to solving the discrete logarithm on the curve — no efficient algorithm is known.
The secret numbers are discarded immediately after use. Every connection gets a fresh pair.
Why forward secrecy matters
The session key does not exist before the session starts. It is generated during the handshake and lives only in the memory of the two endpoints.
The consequence: if the server's private key leaks tomorrow, an attacker gains future sessions but cannot decrypt traffic they recorded before. Old captures stay blank.
# The key type on the certificate (a signing key, not the session key)
openssl s_client -connect khanhsec.com:443 -tls1_3 </dev/null 2>/dev/null \
| openssl x509 -noout -text | grep -A1 "Public Key Algorithm"
# The group both sides agreed on; on current OpenSSL this is usually a
# hybrid with ML-KEM rather than plain X25519
openssl s_client -connect khanhsec.com:443 -tls1_3 </dev/null 2>/dev/null \
| grep -iE "Temp Key|group"Signatures: proof without disclosure
The remaining weakness is the key exchange itself. A man in the middle can run Diffie–Hellman with you using a pair of their own, and run a separate session with the real server.
Signatures stop that. The server signs a hash of the whole transcript — including the public point it just sent. The browser verifies the signature against the public key in the certificate. The attacker has no private key, so they cannot produce a signature over their own transcript.
The signature covers the transcript, not the application data. All of its value comes from the transcript being bound to the public point exchanged in this exact session — so an old signature cannot be replayed onto a new one.
Comments
Get new posts by email
No ads, no tracking. Just new posts, unsubscribe any time.