Skip to content
ecdsa.com

ECDH (Elliptic-Curve Diffie–Hellman)

Key agreement in which each party combines its own elliptic-curve private key with the other's public key to compute the same shared secret, the x-coordinate of d_A·d_B·G.
Also written asElliptic Curve Diffie-HellmanECDH key agreementECC CDH

Each side has a private scalar d and public point Q = d·G; both compute Z, the x-coordinate of d_A·Q_B = d_B·Q_A. Z is not a key: it goes through a key derivation function such as HKDF (TLS 1.3), the SP 800-56C one-step KDF or Concat KDF (JOSE ECDH-ES). NIST SP 800-56A Rev. 3 specifies the primitive and the scheme variants (ephemeral-ephemeral, ephemeral-static and so on).

The receiver must validate the peer's point: on the curve, not the point at infinity, in the right subgroup (SP 800-56A §5.6.2.3). Skipping this enables invalid-curve attacks that extract a static private key over a few hundred queries, which hit several JOSE libraries' ECDH-ES in 2017. X25519's design reduces the check to rejecting an all-zero result.

Ephemeral keys (ECDHE) provide forward secrecy and are the only kind TLS 1.3 uses; static-recipient ECDH appears in ECIES, JWE ECDH-ES and HPKE. Groups in use are secp256r1, secp384r1, x25519 and x448. ECDH and ECDSA share curves and key formats, but SP 800-57 Part 1 recommends using each key for one purpose only. NIST IR 8547 (draft) proposes disallowing ECDH after 2035; hybrids such as X25519MLKEM768 are the migration path.

Standards and references

All terms