Elliptic-curve cryptography
For the moment, this GitHub repository covers nearly all the essentials of Elliptic Curve Cryptography and its associated attacks.
I will only add here information that are not explicitly covered by this repo or custom Python scripts.
Parameters
| Name | Description |
|---|---|
| \(p\) | The prime defining the curve’s field \(\mathbb{F}_p\) |
| \(a\) | The coefficient for \(x\) in the equation \(y^2 = x^3 + ax + b\) |
| \(b\) | The constant term of the equation |
| \(G\) | A point on the curve that generates a subgroup of large prime order \(n\) |
| \(n\) | Integer order of \(G\), means that \(nG=\mathcal{O}\), where \(\mathcal{O}\) is the identity element |
Parameters recovery
Remainder: An elliptic curve is defined over a finite field \(\mathbb{F}_p\) as
\[ Y^2 = X^3 + aX + b \mod p \quad \forall a, b \in \mathbb{F}_p \]Let’s suppose that you don’t the parameters \(a\) and \(b\), and only have access to two points on this curve \(P_1 = (X_1, Y_1)\) and \(P_2 = (X_2, Y_2)\), then you can uniquely recover those parameters using the following formulas
Given our two points, we have
\[ \begin{equation} Y_1^2 = X_1^3 + aX_1 + b \mod p \tag{1} \end{equation} \]\[ \begin{equation} Y_2^2 = X_2^3 + aX_2 + b \mod p \tag{2} \end{equation} \]which means, that by re-arranging (2), we get
\[ \begin{equation} b = Y_2^2 - X_2^3 - aX_2 \mod p \tag{3} \end{equation} \]thus, by replacing in (1)
\[ \begin{aligned} Y_1^2 &= X_1^3 + aX_1 + Y_2^2 - X_2^3 - aX_2 &\mod p \\ \Longleftrightarrow \quad Y_1^2 &= X_1^3 - X_2^3 + Y_2^2 + a(X_1 - X_2) &\mod p \\ \\ \Longleftrightarrow \quad a &= \frac{Y_1^2 - Y_2^2 + X_1^3 - X_2^3}{X_1 - X_2} &\mod p \\ \end{aligned} \]Now that we know \(a\), we can easily recover \(b\) by using (3)
| |
Check for bad curves
Here is a simple Python script that checks for bad curves, including singular, supersingular, and anomalous curves.
These are curves that are considered weak for cryptographic applications because on such curves, we can use specific methods and algorithms to simplify the ECDLP problem and solve it efficiently.
| |