Diffie-Hellman (DH) is a key exchange method, published in 1976, that lets two parties derive the same shared secret while only exchanging public values. Someone who records the whole exchange still cannot compute the secret efficiently.
Why it matters
TLS needs both sides to hold the same symmetric key before encrypted data flows, and DH is how most connections get it. Each side generates a temporary private value, sends a matching public value, and combines the other side's public value with its own private one. The result is identical on both ends. When the private values are thrown away after each session (the "ephemeral" variants, DHE and ECDHE), the connection gains forward secrecy, meaning stolen server keys cannot decrypt old recordings. TLS 1.3 allows only ephemeral exchanges.
Example
In TLS 1.2 a cipher suite name shows which variant is used:
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
ECDHE is elliptic-curve Diffie-Hellman with ephemeral keys. RSA is only the signature algorithm that proves the server's identity.
Common mistakes
- Thinking DH encrypts data. It only produces a shared key; a symmetric cipher does the encryption.
- Using small DH groups, such as 1024-bit, which are considered too weak today.
- Forgetting that unauthenticated DH is open to a man-in-the-middle, which is why the handshake also signs it.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.