Elliptic Curves: ECDH, EC Elgamal, Curve25519

17 Dec 2021


§ Motivation

We've seen how we can generate cyclic groups over elliptic curves, but not how these groups can be used in cryptography. We'll see that many algorithms can be generalised over any cyclic group and not just quotient groups.

§ Elliptic Diffie-Hellman Key Exchange

ECDHE

Alice and Bob agree to use a particular elliptic curve E(Fp)E(\mathbb{F}_p) and a particular point PE(Fp)P \in E(\mathbb{F}_p). Alice and Bob then choose private keys nAn_A and nBn_B, and then they compute the following public keys

QA=nAPQB=nBP.Q_A = n_AP \quad Q_B = n_BP.

They then exchange public keys, Alice can create the shared secret by computing nAQBn_AQ_B and Bob by nBQAn_BQ_A.

We've substituted exponentiation of an element in a quotient group with the multiplication of a elliptic point.

§ Elliptic Elgamal Public Key System

EC-Elgamal

Alice and Bob agree to use a particular elliptic curve E(Fp)E(\mathbb{F}_p) and a particular point PE(Fp)P \in E(\mathbb{F}_p). Alice chooses a private key nAn_A and publishes public key QA=nAPQ_A = n_AP. Bob has text given as a point ME(Fp)M \in E(\mathbb{F}_p). Then, Bob encrypts his message by choosing a random element kk and computes the vlues

C1=kPC2=M+kQAC_1 = kP\quad C_2 = M + kQ_A

Bob then sends the values (C1,C2)(C_1, C_2) (which is a 4-1 message expansion) to Alice who computes

C2nAC1=M+K(nAP)nA(kP)=M.C_2 - n_AC_1 = M + K(n_AP) - n_A(kP) = M.

As for the point MM, we need to define a function f:NE(Fp)f : \mathbb{N} \to E(\mathbb{F}_p) that is invertible. One such method is to let the message be the xx coordinate of the point and then computing the corresponding yy value.

§ Curve25519

One popular elliptic curve is Curve25519 which is designed to be used in ECDH, it is defined using the finite field of prime order 2255192^{255} - 19 and the by the elliptic equation

E:y2=x3+486662x2+x.E : y^2 = x^3 + 486662x^2 + x.

It uses the base point of x=9x=9, which has an prime order of around 22522^{252}.

This curve is popular because it is resistant against timing attacks, and can accept any 3232-byte string as a public key. It is also used as an alternative to the P-256 curve used in the Dual_EC_DRBG algorithm as it was uncovered in 2013 that the NSA built in a backdoor.