EC Cryptography Tutorials - Herong's Tutorial Examples - v1.02, by Dr. Herong Yang
What Is ECDH Key Exchange
This section introduces what is ECDH Key Exchange - a protocol that uses the Elliptic Curve group property to establish a shared secret key without sending it directly to each other.
What Is ECDH Key Exchange? ECDH (Elliptic Curve Diffie-Hellman) Key Exchange is a protocol that uses the Elliptic Curve group property to establish a shared secret key without sending it directly to each other.
The Wikipedia description of ECDH Key Exchange is: "Elliptic-curve Diffie-Hellman (ECDH) is an anonymous key agreement protocol that allows two parties, each having an elliptic-curve public-private key pair, to establish a shared secret over an insecure channel."
Here are the steps used by Alice and Bob to establish a shared secret key using the ECDH Key Exchange protocol:
1. Shared Domain Parameters - Alice and Bob shares an identical elliptic curve subgroup defined by a set of domain parameters: (p,a,b,G,n,h):
p: The modulo used to specify the reduced elliptic curve group. a: The first coefficient of the elliptic curve. b: The second coefficient of the elliptic curve. G: The generator (base point) of the subgroup. n: The order of the subgroup. h: The cofactor of the subgroup.
2. Alice generates a private and public key pair: dA and QA = dA*G. the scalar multiplication with the generator, QA = dA*G, to Bob.
3. Bob generates a private and public key pair: dB and QB = dB*G.
4. Alice and Bob exchange their public keys: QA and QB.
5. Alice computes another scalar multiplication, SA = dA*QB and derives a shared secret key with a shared function, sA = f(SA).
6. Bob computes another scalar multiplication, SB = dB*QA and derives a shared secret key with a shared function, sB = f(SB).
7. Alice can now use sA to encrypt any message and send the encrypted version to Bob.
8. Bob can use sB to decrypt the encrypted message.
We can easily proof that:
sA = sB, because sA = f(dA*QB) = f(dA*(dB*G)) = f(dB*(dA*G)) = f(dA*QB) = sB
One commonly used shared function f(P) is to take x-coordinate of the point P:
If P = (x,y), then f(P) = x
Based on the above steps, we can say that ECDH (Elliptic Curve Diffie-Hellman) Key Exchange protocol is to perform a scalar multiplication of one's own EC private key and other's EC public key to obtain the common shared secret key.
Table of Contents
Geometric Introduction to Elliptic Curves
Algebraic Introduction to Elliptic Curves
Abelian Group and Elliptic Curves
Discrete Logarithm Problem (DLP)
Generators and Cyclic Subgroups
tinyec - Python Library for ECC
►ECDH (Elliptic Curve Diffie-Hellman) Key Exchange
ECDSA (Elliptic Curve Digital Signature Algorithm)