ECDH Key Agreement

Demonstrate ECDH key agreement: two parties exchange public keys and independently derive the same shared secret. Paste Alice's private key and Bob's public key (or vice versa).

Privacy: this tool processes your data entirely in your browser. Nothing you paste or type is sent to the server.

Paste your private key from ECDSA/ECDH Key Generator.

Paste the other party's public key.

Result

Enter your values and press Calculate — the result appears here.

Worked examples

Derive shared secret

  • privateKeyA = {"kty":"EC","crv":"P-256","d":"..."}
  • publicKeyB = {"kty":"EC","crv":"P-256","x":"...","y":"..."}

Result: Hex-encoded shared secret.

Frequently asked questions

How does ECDH work?

Alice generates a key pair (private key A, public key A). Bob generates a key pair (private key B, public key B). They exchange public keys. Alice computes SharedSecret = ECDH(privateKeyA, publicKeyB). Bob computes SharedSecret = ECDH(privateKeyB, publicKeyA). Both get the same result.

Is ECDH secure?

Yes, ECDH is secure under the Elliptic Curve Diffie-Hellman assumption. An eavesdropper who sees both public keys cannot compute the shared secret without solving the discrete logarithm problem.

What should I do with the shared secret?

The shared secret is typically used as input to a key derivation function (like HKDF) to derive encryption keys. Never use it directly as an encryption key.

Copied!