wire / wire-format / diffie-hellman

Diffie-Hellman key exchange

Diffie-Hellman (DH) is a key exchange protocol. Two parties agree on a public prime p and generator g. Alice sends A = g^a mod p. Bob sends B = g^b mod p. Both compute shared secret s = B^a = A^b = g^(ab) mod p. Eavesdropper sees g, p, A, B but cannot compute s (discrete logarithm problem). Finite field DH (FFDHE) and elliptic curve DH (ECDH/X25519) are the modern variants.

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: Diffie-Hellman key exchange

wire format

spec: Diffie-Hellman (1976)

Diffie-Hellman (DH) is a key exchange protocol. Two parties agree on a public prime p and generator g. Alice sends A = g^a mod p. Bob sends B = g^b mod p. Both compute shared secret s = B^a = A^b = g^(ab) mod p. Eavesdropper sees g, p, A, B but cannot compute s (discrete logarithm problem). Finite field DH (FFDHE) and elliptic curve DH (ECDH/X25519) are the modern variants.

fieldsizemeaning
Prime (p)variable (2048+ bits)Large prime modulus. Must be a safe prime (p = 2q+1 where q is also prime) for security.
Generator (g)variableGenerator of the multiplicative group mod p. Usually 2 or 5.
Alice's private key (a)variableRandom secret (256+ bits).
Alice's public key (A)variableA = g^a mod p. Sent to Bob.
Bob's private key (b)variableRandom secret (256+ bits).
Bob's public key (B)variableB = g^b mod p. Sent to Alice.
Shared secret (s)variables = B^a = A^b = g^(ab) mod p. Used as key material (after KDF).
X25519 (ECDH)variantElliptic curve DH on Curve25519. 32-byte keys, 32-byte shared secret. Faster and simpler than FFDHE.

example:

00 00

Diffie-Hellman (placeholder)


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/diffie-hellman or /wire-format/diffie-hellman.json