Key exchange (Diffie-Hellman)
Key exchange lets two computers that have never met agree a secret key while someone listens to every message, without the listener learning the key. They then use that key for fast symmetric encryption.
Two people each mix a secret paint colour into a shared public colour and swap the results. Each adds their own secret again and both end up with the same final colour. An onlooker who saw the swapped pots cannot unmix them.
- Your phone or laptop
- 1Key exchange Your device and the site agree a secret key over the open internet. Today: X25519 (elliptic curves) Breakable by a large quantum computer. Browsers now add ML-KEM alongside it.
- 2Certificate and signature The site proves it is your bank and not an impostor. Today: RSA or ECDSA signatures Breakable by a large quantum computer. No post-quantum certificates are used on the public web yet. Chrome plans to start in 2027.
- 3Encrypted data Everything you send and receive is scrambled with the shared key. Today: AES or ChaCha20 Safe with today's key sizes. Quantum computers only weaken it slightly.
- 4Integrity checks Every message carries a tag that shows if anyone tampered with it. Today: Built into AES-GCM or ChaCha20-Poly1305 Safe. Quantum computers barely affect these checks.
- The website
Why it matters
Nearly every secure connection on the internet starts with one.
Where you meet it
Every time you load an https website or start a WhatsApp chat.
- 1Record An attacker copies encrypted traffic, such as a VPN tunnel or a messaging session. When: Today Nothing alerts the victim.
- 2Store The recording is kept, possibly for decades, until it can be read. When: Years Mosca's rule: if secrecy time plus migration time exceeds the time to Q-Day, you are already late.
- 3Break the key exchange A large quantum computer recovers the session key from the recorded key exchange. When: Q-Day, date unknown The bulk AES encryption does not need breaking.
- 4Defence: hybrid key exchange now Traffic protected with ML-KEM today cannot be decrypted this way later. When: Already default in major browsers Why key exchange is upgraded first.
Go deeper history and technical detail
Published by Diffie and Hellman in 1976. Today's versions mostly use elliptic curves (ECDH, often the curve X25519). Because Shor's algorithm breaks it, the post-quantum replacement is a 'key encapsulation mechanism' (KEM), standardised by NIST as ML-KEM. Browsers now commonly run both side by side, which is called a hybrid.
Read or watch next
- How Public Key Cryptography Really WorksQuanta Magazine (2024), article
- KEMs and Post-Quantum ageFilippo Valsorda, blog post
- New Directions in CryptographyWhitfield Diffie and Martin Hellman (1976), paper
- CryptographyJonathan Katz, University of Maryland on Coursera, course
- CS255: Introduction to CryptographyDan Boneh, Stanford University (Winter 2025), course
- Diffie-Hellman Key ExchangeArt of the Problem, video
Related terms
Cite this page Encryption Observer, “Key exchange (Diffie-Hellman)”, encryption.observer/terms/key-exchange/, checked December 2026.