[][src]Module elliptic_curve::ecdh

This is supported on crate feature ecdh only.

Elliptic Curve Diffie-Hellman (Ephemeral) 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)

Usage

Have each participant generate an EphemeralSecret value, compute the PublicKey for that value, exchange public keys, then each participant uses their EphemeralSecret and the other participant's PublicKey to compute a SharedSecret value.

⚠️ SECURITY WARNING ⚠️

Ephemeral Diffie-Hellman exchanges are unauthenticated and without a further authentication step are trivially vulnerable to man-in-the-middle attacks!

These exchanges should be performed in the context of a protocol which takes further steps to authenticate the peers in a key exchange.

Structs

EphemeralSecret

Ephemeral Diffie-Hellman Secret.

SharedSecret

Shared secret value computed via ECDH key agreement.