# [−][src]Module elliptic_curve::ecdh

**crate feature**only.

`ecdh`

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 | `ecdh` Ephemeral Diffie-Hellman Secret. |

SharedSecret | `ecdh` Shared secret value computed via ECDH key agreement. |

## Type Definitions

PublicKey | `ecdh` Elliptic Curve Diffie-Hellman public keys. |