ECDH
Cheat sheet · https://pcornel.dk/topic.php?topic=4700
Answer
ECDH (elliptic-curve Diffie-Hellman) lets two parties derive a shared secret over an open channel using their EC key pairs. Ephemeral ECDHE in TLS 1.3 gives perfect forward secrecy.
Remember
- Ephemeral ECDHE gives forward secrecy.
- Both sides must use the same curve.
- Authenticate the exchange to stop MITM.
First checks
openssl genpkey -algorithm X25519 -out a.pem; openssl pkeyutl -derive -inkey a.pem -peerkey b-pub.pem -out shared.bin— ECDH deriveopenssl s_client -connect <host>:443 </dev/null | grep 'Server Temp Key'— TLS ECDHE- KDF applied to shared secret — HKDF
Verify in this order
private + peer public → shared secret → KDF → keys
Where it usually breaks
First mismatch in key/secret generation → storage/rotation → trust/certificate validation → protocol negotiation → cryptographic operation → peer/application verification; preserve identity/policy/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4700