Diffie-Hellman (DH) and Elliptic Curve Diffie-Hellman (ECDH) are key agreement protocols that allow two parties to establish a shared secret over an insecure channel without prior shared keys.
Inputs
Mode: Choose between Classic DH (finite field) or ECDH (elliptic curve).
DH Group / Curve: The parameter set to use. Classic DH uses MODP groups; ECDH uses named curves.
Private Key: Your private key (random scalar). Keep this secret.
Their Public Key: The other party's public key to compute the shared secret.
Tips
DH alone does not authenticate parties — combine with signatures or certificates.
ECDH with P-256 is preferred over classic DH for new applications.
The shared secret should be passed through a KDF (like HKDF) before use as a key.