I wrote this series because I am inquisitive about some strange things in the TLS series. Elliptic-curve Diffie–Hellman (ECDHE) is one of them. Please check TLS-part 1 to get the details. So why ECDHE and what is it? Let’s start to explore.

Picture 1. Client Hello message in TLS handshake

Why ECDHE? The reasons are:

From the picture above, we see ECDHE in some cipher suites. ECDHE uses Elliptic Curve Over Finite Fields to generate the session keys (This is the key we got after the handshake finish in Part 1). What is an Elliptic Curve?

Elliptic Curve

An Elliptic Curve (EC) is a type of algebraic curve that is defined by this formula:

\[ y^2 = (x^3 + ax + b) \]

Picture 2. An Elliptic Curve

To play a bit with Elliptic Curve please access this link: Elliptic Curves – GeoGebra

Point Addition

Picture 3. Point Addition

To add P for Q we draw a line from P to Q and intersect with the Elliptic Curve at a point called R then we reflect the R point with the x-axis to get the result S = P + Q.

You can do some Point Addition testing here: Elliptic Curve Sum – GeoGebra

Point Doubling

Picture 4. Point Doubling

When P = Q the result of point addition is S = 2P called point doubling.

Formula

\(x_{s} = s^2 – x_{q} – x_{p}\) \(\\\) \(y_{s} = s(x_{q} – x_{s}) – y_{p}\) \(\\\) \(\text{Point Addition,} \ P \neq Q\) \(\\\) \(s = \frac{y_{q} – y_{p}}{x_{q}-x_{p}}\) \(\\\) \(\text{Point Doubling,} \ P = Q\) \(\\\) \(s = \frac{3x_{p}^2 + a}{2y_{q}}\) \(\\\)

As said at the beginning of this topic, ECDHE uses an Elliptic Curve Over Finite Fields (ECOFF) to generate the session keys so what is the ECOFF? Let’s discuss the next topic. Thanks for reading!