Skip to content
ExtendedSource checked

Elliptic Curve Diffie-Hellman

Establishes a shared secret using elliptic-curve key exchange.

Quick Facts

Compact metadata for implementation and discovery.

Category
Cryptography
Difficulty
Advanced
Family
Key Agreement
Tier
Extended
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
4
Code example
Not ready
Visualization
Ready
Aliases
ECDH

Overview

ECDH applies the Diffie-Hellman idea to elliptic curves, giving compact keys and efficient shared secret agreement.

Core Concepts

security primitivecurve point operationshared secretsecurity assumptionkey agreementkey materialmessage transformation

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(k^2)

Average

O(k^2)

Worst

O(k^3)

Space

O(k)

When to Use

  • Use Elliptic Curve Diffie-Hellman when you need to combine a private scalar with a public curve point.
  • Use it for tLS key agreement with inputs like curve parameters.
  • Use it only through reviewed libraries when the security goal matches the primitive.
  • Use it when the Key Agreement tradeoff is acceptable for the problem size.

When Not to Use

  • Avoid custom implementations for production security or when key, nonce, and padding rules are unclear.
  • Avoid it when O(k^3) worst-case behavior is too costly for the expected input size.
  • Avoid it when the required output is not shared secret.

What It Does

  • Combines a private scalar with a public curve point
  • Derives a shared secret point

Use Cases

  • TLS key agreement
  • Secure messaging
  • Mobile-friendly cryptography

Inputs

  • Curve parameters
  • Private key
  • Peer public key

Outputs

  • Shared secret

Key Formulas (1)

Shared point

sharedpoint = privatescalar · peerpublic point
shared_point = private_scalar * peer_public_point

Uses scalar multiplication on an elliptic curve to derive shared key material.

Pseudocode

  1. 1.Generate a private scalar
  2. 2.Compute the matching public curve point
  3. 3.Receive the peer public point
  4. 4.Multiply the peer point by the private scalar
  5. 5.Derive key material from the shared point

Canonical Example

Input
message = 'pay $10', key material = configured securely
Output
protected value such as a digest, signature, shared secret, or ciphertext
Explanation
Elliptic Curve Diffie-Hellman: The primitive transforms the message according to a specific security purpose.

Implementation Notes

  • Keep the input contract explicit: Curve parameters; Private key; Peer public key.
  • Use this step as the implementation spine: Generate a private scalar.
  • Then preserve the next state change: Compute the matching public curve point.
  • Validate parameters, key sizes, nonces, salts, and error handling against the library's recommended API.

Common Pitfalls

  • Implementations must validate public keys and use approved curves.
  • Confusing encryption, hashing, signatures, and authentication codes as interchangeable tools.
  • Returning shared secret without handling empty, invalid, or boundary inputs.

Interactive Mechanism Walkthrough

Graph Frontier & Edge Relaxation

Show two parties exchanging public curve points and deriving one secret.

Elliptic Curve Diffie-Hellman mechanism walkthrough step 1 of 5suvwxt
Step 1 of 5: Generate a private scalar
ecdh-exchange

Notes

Elliptic Curve Diffie-Hellman operates in O(k^2) time and O(k) space within the Key Agreement family. Key governing relation: shared_point = private_scalar * peer_public_point. Often compared with Diffie-Hellman Key Exchange and Elliptic Curve Digital Signature Algorithm.

Sources (1)

What each reference supports for this entry.

NIST SP 800-56A Rev. 3

Documentation

NIST recommendation for finite-field and elliptic-curve discrete-logarithm key establishment.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

ECDH is an elliptic-curve variant of Diffie-Hellman key exchange.

Often paired withHKDF

ECDH shared secrets are commonly expanded with HKDF.

Tags

CryptographyElliptic CurveKey ExchangeSecurity