Available on crate feature ecdh only.
Expand description

Elliptic Curve Diffie-Hellman Support.

This module contains a generic ECDH implementation which is usable with any elliptic curve which implements the ProjectiveArithmetic trait (presently the k256 and p256 crates)

ECDH Ephemeral (ECDHE) Usage

Ephemeral Diffie-Hellman provides a one-time key exchange between two peers using a randomly generated set of keys for each exchange.

In practice ECDHE is used as part of an Authenticated Key Exchange (AKE) protocol (e.g. SIGMA), where an existing cryptographic trust relationship can be used to determine the authenticity of the ephemeral keys, such as a digital signature. Without such an additional step, ECDHE is insecure! (see security warning below)

See the documentation for the EphemeralSecret type for more information on performing ECDH ephemeral key exchanges.

Static ECDH Usage

Static ECDH key exchanges are supported via the low-level diffie_hellman function.


Ephemeral Diffie-Hellman Secret.

Shared secret value computed via ECDH key agreement.


Low-level Elliptic Curve Diffie-Hellman (ECDH) function.