Skip to main content
Definition Website Computer and Technology

Diffie-Hellman Key Exchange

Subject: Computer and Technology noun /ˈdɪf.i ˈhɛl.mən kiː ɪksˈtʃeɪndʒ/ 1 definition

  1. Definition (noun)

    Entry #337 · Updated

    Diffie-Hellman Key Exchange (DH) is a foundational public-key cryptographic protocol that enables two parties to establish an identical shared secret over an insecure network without having shared any keys in advance. Using publicly agreed domain parameters—such as a large prime modulus and generator or an elliptic-curve base point—each participant combines a private secret exponent or scalar with those parameters to derive a public value, transmits it to the peer, and applies their own private value to the peer's public value to reach the same result. Security rests on the computational infeasibility of solving the discrete logarithm or computational Diffie-Hellman problem, preventing passive eavesdroppers who observe only the public parameters and exchanged values from computing the shared secret. Because basic DH does not verify participant identities or encrypt application payloads directly, real-world protocols pair it with digital signatures or certificates to defeat man-in-the-middle attacks and pass the shared secret through a Key Derivation Function (KDF) to produce symmetric session keys.

    Common Forms

    • Finite-Field Diffie-Hellman (FFDH): Executes modular exponentiation in a multiplicative group modulo a large prime (such as standardized RFC 7919 groups), serving as the classic construction used in SSH, IPsec IKE, and older TLS deployments.

    • Elliptic-Curve Diffie-Hellman (ECDH): Performs scalar point multiplication over elliptic curves such as NIST P-256 or Curve25519 (X25519), providing equivalent security to finite-field groups with substantially smaller keys and lower latency.

    • Ephemeral Diffie-Hellman (DHE and ECDHE): Generates fresh, single-use key pairs for each session rather than reusing static keys, guaranteeing forward secrecy so later compromise of long-term identity keys cannot decrypt recorded traffic.

    • Static Diffie-Hellman: Reuses long-term Diffie-Hellman key pairs across multiple sessions to eliminate per-handshake key generation, sacrificing forward secrecy unless paired with an ephemeral peer key.

    Example

    When a client initiates a TLS 1.3 handshake with an HTTPS server, both endpoints perform an ephemeral X25519 Elliptic-Curve Diffie-Hellman exchange by sending 32-byte public keys in their ClientHello and ServerHello key_share extensions while the server authenticates the exchange with an X.509 certificate signature. Each side multiplies its own 32-byte private scalar by the peer's public value to compute the identical shared secret, which TLS 1.3 passes into HKDF-Extract and HKDF-Expand-Label to derive AES-256-GCM traffic keys.