The Diffie-Hellman key exchange protocol, named after Whitfield Diffie and Martin Hellman, is a protocol for two parties to create a shared secret over a public channel without revealing information about the key.
The exchange is made possible by using commutativity in finite cyclic groups, particularly with elliptic curve cyclic groups. That is to say, given a common generator point on an elliptic curve over a finite field
Alice:
Bob:
Finally:
As such, Alice and Bob have computed a shared secret
This protocol is often used to exchange a cryptographic key to be used in a symmetric encryption algorithm and is used in protocols such as SSH, HTTPS, and a variant of it in the Signal Protocol.
In practice, each of the two parties performs the following.
- Generate a local secret
$a \in \mathbb{F}_p$ with a cryptographically secure pseudorandom number generator. - Add the generator point
$G \in E(\mathbb{F}_p)$ to itself$a$ times via elliptic curve point addition and doubling. - Publish the generated point
$A \in E(\mathbb{F}_p)$ so the other party can receive it. - Receive the other party's generated point
$B \in E(\mathbb{F}_p)$ - Add the other party's generated point
$B$ to itself$a$ times via elliptic curve point addition and doubling. - The generated point is the shared secret.
A variant of the Diffie-Hellman key exchange protocol is the tripartite Diffie-Hellman key exchange. There are a few variants with different tradeoffs, but we focus on single-round tripartite Diffie-Hellman, which enables a single transmission from each party, irrespective of ordering.
However, for the single-round tripartite Diffie-Hellman, we use the bilinearity of an elliptic curve pairing. The elliptic curves over which the pairing exists are $E(\mathbb{F}p)$ as above and $E(\mathbb{F}{p^2})$, which is the same elliptic curve function but with scalars as elements of a polynomial field extension $\mathbb{F}{p^2}$. The ellipitic curve pairing function is $e : E(\mathbb{F}p) \times E(\mathbb{F}{p^2}) \rightarrow \mathbb{F}{p^{12}}$, where the output is an element of a polynomial extension field of degree 12. Alice, Bob, and Charlie agree on two generator points $G_1 \in E(\mathbb{F}p)$ and $G_2 \in E(\mathbb{F}{p^2})$, each chose their respective secret scalar
Alice:
Bob:
Charlie:
Finally:
Note that the ordering of points works out the same, that is to say
The steps for each party are as follows.
- Generate a local secret
$a \in \mathbb{F}_p$ with a cryptographically secure pseudorandom number generator. - Add the generator point of each curve $G_1 \in E(\mathbb{F}p)$ and $G_2 \in E(\mathbb{F}{p^2})$ to itself
$a$ times via elliptic curve point addition and doubling. - Publish the generated pair $(A_1, A_2) \in (E(\mathbb{F}p), E(\mathbb{F}{p^2}))$ so the other parties can receive it.
- Receive the other parties' pairs of generated points
$(B_1, B_2)$ and$(C_1, C_2)$ - Compute the ellptic curve pairing
$e(B_1, C_2)$ (or $e(C_1, B_2)$). - Exponentiate the output of the elliptic curve pairing to the power of
$a$ :$e(B_1, C_2)^a$ - The final scalar in
$\mathbb{F}_{p^{12}}$ is the shared secret.