Friday, 19 October 2018

Elliptic Curve Cryptography

An elliptic curve is a set of points that satisfies a math equation:
   y2 = x3 + ax + b

The graph looks like

‌The graph has interesting properties
any point on curve can be reflected on x-axis , and remains on the curve
any non-vertical line can intersect at most 3 points on the curve
Easy to go forward, hard to reverse -> property of trap-door function


An elliptic curve crypto-system can be defined by picking a prime number as a maximum, a curve equation and a public point on the curve.


A private key is a number N, and a public key is the public point dotted with itself N times. ( multiplied the public point N times) 

Computing the private key from the public key - elliptic curve discrete logarithm function , eg. y = g ^ x mod q 

Discrete logarithm function, hard to solve x (nobody knows x from y) (think of y as public key , x as private key)

It is a good trap-door function

It can obtain same level of security with smaller key size (compare to RSA)

For Bitcoin, secp256k1 is the parameters of the elliptic curve used in Bitcoin public key cryptography. The graph of secp256k1 elliptic curve:

secp256k1 details:

y2 = x3+ax+b over P, is defined by T = (P,a,b,G,n,h) , where:

a = 0, b = 7 , so y2 = x3+7
P = large prime number : 2256 - 232 - 29 - 28 - 27 - 26 - 24 - 1
G = 02 79BE667E F9DCBBAC 55A06295 CE870B07 029BFCDB 2DCE28D9 59F2815B 16F81798
h = 01
n = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141