Use this when deriving shared secrets with elliptic-curve Diffie-Hellman.
ECDH
ECDH (elliptic-curve Diffie-Hellman) lets two parties derive a shared secret over an open channel using their EC key pairs. Ephemeral ECDHE in TLS 1.3 gives perfect forward secrecy.
1. ECDH derives a shared secret from key pairs.
2. Ephemeral (ECDHE) for forward secrecy.
3. Feed the output through a KDF (HKDF).
4. Authenticate the exchange.
5. X25519 is common.
private + peer public → shared secret → KDF → keys
Context & applicabilityCommon mistakes · platform/version boundaries
- Static ECDH (reused keys) where forward secrecy is required.
- Not validating that a received point lies on the curve (invalid-curve attacks) — use well-tested libraries.
- Using the raw shared secret as a key; always run it through a KDF (HKDF).
- Mixing up ECDH (key agreement) with ECDSA (signatures).
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Ephemeral ECDHE gives forward secrecy.
- Both sides must use the same curve.
- Authenticate the exchange to stop MITM.
openssl genpkey -algorithm X25519 -out a.pem; openssl pkeyutl -derive -inkey a.pem -peerkey b-pub.pem -out shared.bin— ECDH deriveopenssl s_client -connect <host>:443 </dev/null | grep 'Server Temp Key'— TLS ECDHE- KDF applied to shared secret — HKDF
ReferenceWhy it matters1 section · depth on demand
ECDH vs ECDHE
- ECDH with static keys gives the same shared secret each time; no forward secrecy.
- ECDHE (ephemeral) generates a new key pair per session, so a stolen long-term key cannot decrypt old sessions.
TLS 1.3 only allows ephemeral key exchange. The shared secret is fed into a KDF (HKDF) to derive the actual encryption keys.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
ECDH (Elliptic Curve Diffie-Hellman) lets two parties derive a shared secret over an insecure channel using elliptic-curve key pairs. In its ephemeral form (ECDHE) a new key pair is generated for each session, providing forward secrecy.
Where it is used:
| Protocol | Use |
|---|---|
| TLS 1.2/1.3 | ECDHE key exchange (X25519, P-256) |
| SSH | curve25519-sha256 key exchange |
| IPsec IKEv2 | DH groups 19, 20, 21, 31 |
| Signal, WireGuard | X25519 |
Modern TLS increasingly uses hybrid post-quantum key exchange (X25519 combined with ML-KEM) to protect recorded traffic against future quantum decryption.
Where ECDHE is used
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Asymmetric Cryptography → ECDH. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://csrc.nist.gov/pubs/fips/186-5/final · confidence 94%