A Tutorial of Elliptic Curve Cryptography
A Tutorial of Elliptic Curve Cryptography
A Tutorial of Elliptic Curve Cryptography
Contents
I. II. Introduction Elliptic Curves over Real Number
III. Elliptic Curves over Prime Field and Binary Field IV. Security Strength of ECC System V. ECC Protocols
Fuwen Liu
I. Introduction
Fuwen Liu
Basic concept
Cryptography is a mathematical based technology to ensure the information security over a public channel. There are two objectives: Privacy: No information is accessible to unauthorized parties Authentication: Information is not alerted in transition and the communication parties are legitimate. Cryptography systems can be distinguished in two categories[1]: Unconditionally secure system: It resist any cryptanalytic attack no matter how much computation is used.
One-time pad system is a typical example Require the length of the key stream equivalent to that of plaintext Rarely deployed in practice
Conditionally secure system: It is computationally infeasible to be broken, but would succumb to an attack with unlimited computation.
Basically modern cryptographic systems are constructed on the basis of the conditionally secure principle.
Fuwen Liu
Motivation
Public key cryptographic algorithms (asymmetric key algorithms) play an important role in providing security services: Key management User authentication Signature Certificate Public key cryptography systems are constructed by relying on the hardness of mathematical problems RSA: based on the integer factorization problem DH: based on the discrete logarithm problem The main problem of conventional public key cryptography systems is that the key size has to be sufficient large in order to meet the high-level security requirement. This results in lower speed and consumption of more bandwidth Solution: Elliptic Curve Cryptography system
A Tutorial on Elliptic Curve Cryptography 5
Fuwen Liu
History of ECC
In 1985, Neal Koblitz [2] and Victor Miller [3] independently proposed using elliptic curves to design public key cryptographic systems. In the late 1990`s, ECC was standardized by a number of organizations and it started receiving commercial acceptance. Nowadays, it is mainly used in the resource constrained environments, such as ad-hoc wireless networks and mobile networks. There is a tend that conventional public key cryptographic systems are gradually replaced with ECC systems. As computational power evolves, the key size of the conventional systems is required to be increased dramatically.
Fuwen Liu
Fuwen Liu
Overview
Elliptic curves have been studied by mathematicians for over a hundred years. They have been deployed in diverse areas Number theory: proving Fermat`s Last Theorem in 1995 [4] The equation x n + y n = z n has no nonzero integer solutions for x,y,z when the
integer n is grater than 2.
Fuwen Liu
Definition
An elliptic curve E over R (real numbers) is defined by a Weierstrass equation
E : y 2 + a1 xy + a3 y = x3 + a2 x 2 + a4 x + a6
where a1, a2, a3, a4,a5 K and0. is the discriminant of E and is defined as follows: 2 3 2
= d 2 d8 8d 4 27d 6 + 9d 2d 4d 6 d 2 = a12 + 4a2 d 4 = 2a4 + a1a3
2 d 6 = a3 + 4a6 2 2 d8 = a12a6 + 4a2a6 a1a3a4 + a2a3 a4
Points: If both the coordinates of the point PE or P= (the point at infinity, or zero element ). The set of points on E is:
E ( L) = {( x, y) R R : y 2 + a1xy + a3 y x3 a2 x2 a4 x a6 = 0} {}
A Tutorial on Elliptic Curve Cryptography 9
Fuwen Liu
and set
a1 = 0, a3 = 0
a2 a1 x + a3 ( x, y ) ( x , y ) 3 2
we get one of the simplified Weierstrass equations: y By performing the following change of variables:
= x 3 + ax + b
2 a3 3 a12a4 + a3 ( x, y ) (a x + , a1 y + ) 3 a1 a1 2 1
y 2 + xy = x 3 + ax 2 + b
A Tutorial on Elliptic Curve Cryptography 10
Fuwen Liu
Example Curves of y 2 = x 3 + ax + b
11
Fuwen Liu
Addition law
Addition law of elliptic curve E has the following properties: Identity: Inverse: P+=+P=P P+(-P)=
P E P E P,Q,R E P, Q E
12
Fuwen Liu
Point addition
Geometry approach: To add two distinct points P and Q on an elliptic curve, draw a straight line between them. The line will intersect the elliptic cure at exactly one more point R. The reflection of the point R with respect to x-axis gives the point R, which is the results of addition of points R and Q
-R
13
Fuwen Liu
Point doubling
Geometry approach: To the point P on elliptic curve, draw the tangent line to the elliptic curve at P. The line intersects the elliptic cure at the point R. The reflection of the point R with respect to x-axis gives the point R, which is the results of doubling of point P.
-R
R=2P
14
Fuwen Liu
In the same way, for the curve E: y + xy = x + ax + b. R=P+Q=(xR,yR) can be determined by the following formulae:
x R = 2 + + x P + xQ + a yR = ( x p + xR ) + xR + yP where : = yQ + y P xQ + x p
15
Fuwen Liu
In the same way, for the curve E: y + xy = x + ax + b. R=2P=(xR,yR) can be determined by the following formulae:
2 3 2
x R = 2 + + a
2 yR = xP + xR + xR
where : = x P + y P / x P
16
Fuwen Liu
+ 2 . 35 + 0 . 1 = 3 . 89
(From www.certicom.com)
17
Fuwen Liu
(From www.certicom.com)
18
Fuwen Liu
19
Fuwen Liu
Motivation
Elliptic curves over real numbers Calculations prove to be slow Inaccurate due to rounding error Infinite field Cryptographic schemes need fast and accurate arithmetic In the cryptographic schemes, elliptic curves over two finite fields are mostly used.
Prime field Fp , where p is a prime. Binary field F2m, where m is a positive integer.
20
Fuwen Liu
EC over Fp
The equation of the elliptic curve over Fp is defined as: y 2 mod p = ( x 3 + ax + b ) mod p
where : ( 4 a 3 + 27 b 2 ) mod p 0 x , y , a , b [0 , p 1 ]
The points on E are denoted as: E(Fp )={(x,y):x,yFp satisfy y2=x3+ax+b}{} Example: Elliptic curve y 2 = x 3 + x over the Prime field F23. The points in the curve are the Following:
(0,0) (1,5) (1,18) (9,5) (9,18) (11,10) (11,13) (13,5) (13,18) (15,3) (15,20) (16,8) (16,15) (17,10) (17,13) (18,10) (18,13) (19,1) (19,22) (20,4) (20,19) (21,6) (21,17)
(From www.certicom.com)
A Tutorial on Elliptic Curve Cryptography 21
Fuwen Liu
Point doubling:
x R = ( 2 2 x P ) mod p y R = ( ( x p x R ) y P ) mod p
2 +a 3xP where : = mod p 2yp
22
Fuwen Liu
y R = (16 (1 16 ) 5 ) mod 23 = 245 mod 23 = 15 mod 23 = 8 So the R=P+Q=(16,8) The doubling point of P can be computed as: 3 12 + 1 2 1 mod 23 = mod 23 = 2 mod 23 mod 23 = 2 14 mod 23 = 5 = 25 5 5 x R = ( 5 2 1 1 ) mod 23 = 23 mod 23 = 0
y R = ( 5 (1 0 ) 5 ) mod 23 = 0 mod 23 = 0
So the R=2P=(0,0) Point addition and doubling need to perform modular arithmetic (addition, subtraction, multiplication, inversion)
A Tutorial on Elliptic Curve Cryptography 23
Fuwen Liu
EC over F2m
A elliptic curve E over the finite field F2m is given through the following equation.
y 2 + xy = x 3 + ax
Where x, y, a, b F2m
+b
24
Fuwen Liu
(From www.certicom.com)
25
Fuwen Liu
y 2 + xy = x 3 + ax
+b
Let P=(xP, yP) on the curve curve Then R=2P can be computed:
y 2 + xy = x 3 + ax
+b
x R = 2 + + a
2 yR = xP + xR + xR
where : = x P + y P / x P
Note that all calculations are performed using the rules of arithmetic in F2m
26
Fuwen Liu
+ xy = x 3 + g 4 x 2 + 1
x R = 2 + + x P + xQ + a = ( g 2 ) 2 + g 2 + g 5 + g 9 + g 4 = g 3 y R = ( x p + x R ) + x R + y P = g 2 ( g 5 + g 3 ) + g 3 + g 3 = g 13
Let P=(xP, yP) on the curve curve y 2 + xy = x 3 Then R=2P can be computed: = x P + y P / x P = g 5 + g 3 / g 5 = g 5 + g 13 = g 7
x R = 2 + + a = ( g 7 )2 + g 7 + g 4 = 1
2 yR = xP + x R + x R = ( g 5 ) 2 + g 7 + 1 = g 13
+ ax + b
Point addition and doubling need to perform the polynomial arithmetic ( addition, subtraction, multiplication, and division)
A Tutorial on Elliptic Curve Cryptography 27
Fuwen Liu
Point Representation
The normal (x, y) pairs are denoted as affine coordinates. It has disadvantages in performing point addition and doubling. Expensive inverse operations are involved. The normal (x, y) pairs can be represented by the triplet (X, Y, Z), which is called the projective coordinates. The relationship between (x, y) and (X, Y,Z) is: ( X ,Y , Z ) = (c x , d y , )
( x, y ) = ( X / Z c ,Y / Z d ) where : 0
There are a number of types of coordinates when c, d are set different values, such as standard[5], Jacobian[5], Lopez-Dahab[6]. The use of projective coordinates can avoid the expensive inverse operations. But it requires more multiplications in the field operation. If the ratio of Inverse/Multiplication is big, the resulting computation cost of point addition is less than that using affine coordinates.
28
Fuwen Liu
29
Fuwen Liu
30
Fuwen Liu
Scalar Multiplication
Intuitive approach: dP= P+P++P
d times
It requires d-1 times point addition over the elliptic curve. Observation: To compute 17 P, we could start with 2P, double that, and that two more times, finally add P, i.e. 17P=2(2(2(2P)))+P. This needs only 4 point doublings and one point addition instead of 16 point additions in the intuitive approach. This is called Double-and-Add algorithm.
31
Fuwen Liu
Double-and-Add algorithm
Let d=(dt-1, dt-2,d0) be the binary representation of d, then
d =
t 1
d
i=0
2i
dP = ( d i 2 i ) P = ( d t 1 2 t 1 P ) + ... + ( d 1 2 P ) + d 0 P
i=0
t 1
= 2 ( 2 (... 2 ( 2 d t 1 P ) + d t 2 P ) + ...) + d 1 P ) + d 0 P
Double-and-Add algorithm: Input: d=(dt-1, dt-2,d0) , PE. 1. QO 2. For i from 0 to t-1 do 2.1 If di=1 then QQ+P 2.2 P2P Output: dP=Q
32
Fuwen Liu
33
Fuwen Liu
Complexity of an Algorithm
Definition: Let A be an algorithm whose input has bit-length n
A is a polynomial-time algorithm if its running time is O(nc) for some constant c>0, such as n10 A is a subexponential-time algorithm if its running time is O(eo(n)), such as en . A is an exponential-time algorithm if its running time is O(cn) or O(nf(n)) for c>1, 2 such as 1.1n and nn .
1/3
Fuwen Liu
A public key cryptosystem consist of a private key that is kept secret, and a public key which is accessible to the public. The straightforward way to break the public key cryptosystem is to draw the private key from the public key. But the required computation cost is equivalent to solving these difficult mathematic problems.
Fuwen Liu
RSA
RSA key pair generation.
Randomly select two large primes p and q, and pq Compute n=pq and =(p-1)(q-1) Select an arbitrary integer e with 1<e< and gcd (e,)=1. Compute the integer d satisfying 1<d< and ed1 (mod ) The public key is (n,e), the private key is d.
Observation: If we can derive the primes p and q from n, =(p1)(q-1) can be computed. The enables the determination of the private key de-1 (mod ). Multiplying two prime integers together is easy, but factoring the product of two prime numbers is much more difficult.
Fuwen Liu
Factoring problem
Definition
Given a positive integer n, find its two prime factorization p and q.
The best published solution to the factoring problem is the general number field sieve (GNFS) algorithm, which, for a number n, its running time is:
Ln [1 / 3,1.923] = O ( e
Fuwen Liu
Deffie-Hellman
DH key pair generation
G is finite group with generator g, p is a prime and q is a prime divisor of p-1. Randomly select x from [1, q-1] Compute y=gx (mod p) The public key is y, and private key is x.
Observation: x=logg y(mod p), x is called the discrete logarithm of y to the base g. Given g,x, and p, it is trivial to calculate y. However, given y, g, and p it is difficult to calculate x.
Fuwen Liu
The fastest algorithm known for solving discrete logarithm problem is still GNFS which has a subexponential running time.
Fuwen Liu
ECC
Key pair generation
Randomly select d [1, n-1]. Compute Q=dP, P, Q is a point on the curve Public key is Q, private key is d
The naive algorithm to draw the d from Q is the computation of a sequence of points P, 2P, 3P, 4P, until Q=dP. Hasse Theorem: the number of points of E(Fq) is denoted by # E(Fq) , which is determined by
# E ( Fq ) = q + 1 t where t 2 q
Usually q is a large prime number whose length is greater than 160 bit. So # E(Fq) is also a big number. Thus it is computationally infeasible to solve d from Q by using the naive algorithm.
Fuwen Liu
The fastest algorithm to solve ECDLP is Pollards rho algorithm, its running time is
q
2
Pollards rho algorithm is an exponential-time algorithm
Fuwen Liu
The reason is that there exist subexponential-time algorithms for factoring and discrete logarithm problem, whilst only exponential-time algorithms for ECDLP.
Fuwen Liu
Fuwen Liu
44
Fuwen Liu
Bob
Signature verification 1.Verify that r, s are in the interval [1, n-1] 2.Compute e=H(m), where H is a hash functon, m is the message. 3.Compute w=s-1 mod n 4.Compute u1=ew mod n and u2=rw mod n. 5.Compute X=u1P+u2QA=(x1,y1) 6.Compute v=x1 mod n 7.Accept the signature if and only if v=r
m, r ,s
45
Fuwen Liu
46
Fuwen Liu
Bob
QA QB
Ephemeral key pair generation Select a private key nB [1, n-1] Calculate public key QB=nBP
47
Fuwen Liu
An Example of ECDH
Alice and Bob make a key agreement over the following prime, curve, and point. p=3851, E:y2=X3+324x+1287, P=(920,303)E(F3851) Alice chooses the private key nA=1194, computes QA=1194P=(2067,2178)E(F3851), and sends it to Bob. Bob chooses the private key nB=1759 computes QA=1759P=(3684,3125)E(F3851), and sends it to Alice. Alice computes nAQB=1194(3684,3125)=(3347,1242) E(F3851) Bob computes nBQA=1759(2067,2178)=(3347,1242) E(F3851)
Fuwen Liu
Alice (QA,dA)
1.Select a random kA from [1,n-1], compute ephemeral public key RA=kAP, sends IDA, RA to Bob
3. Receiving message 2, Alice does the following 3.1 Compute sA=(kA+RAdA) mod n and Z=hsA(RB+RBQB ) 3.2 (k1, k2)KDF(xZ ) 3.3 Compute t=MACk1(2,IDB,IDA, RB,RA) and verify that t=tB 3.4 Compute tA=MACk1(3,IDA,IDB, RA,RB) 3.5 Send tA to Bob
Fuwen Liu
Explanation of ECMQV
Resist against the man-in-the-middle attack
The quantity sA=(kA+RAdA) mod n serves as an implicit signature for Alice. It is a signature in the sense that only person who knows Alices private key dA can produce sA. Bob indirectly verifies its validity by using sAP=RA+RAQA In the same way, the quantity sB=(kB+RBdB) mod n serves as an implicit signature for Bob. The shared secret between Alice and Bob is Z Bob computes Z=hsB(RA+RAQA)=hsBsAP Alice computes Z=hsA(RB+RBQB )=hsAsBP The function of MAC is to ensure that the messages exchanged between Alice and Bob are authentic.
A Tutorial on Elliptic Curve Cryptography 50
Fuwen Liu
51
Fuwen Liu
Fuwen Liu
Patents
The general idea of ECC was not patented [8], but there are a number of patents regarding the efficient implementation from the underlying layer (finite field arithmetic ) to the highest layer (protocols) The patent issue for elliptic curve cryptosystems is the opposite of that for RSA and Diffie-Hellman, where the cryptosystems themselves have patents, but efficient implementation techniques often do not [8].
Certicom holds more than 130 patents related to ECC. It has sold 26 patents to NSA and NISA in the value of 26 million US$, which covers the prime field curves with primes of 256 bits, 384 bits and 521 bits. Certicom was taken over by the RIM( Research in Motion) with the offer of 130 million C$ in 2009.
Fuwen Liu
Standards
Titel Public Key Cryptography for the Financial Services Industry, Key Agreement and Key Transport Using Elliptic Curve Cryptography Standard Specifications For Public-Key Cryptography Information technology Security techniques Cryptographic techniques based on elliptic curves Recommendation on key establishment schemes
Fuwen Liu
55
Fuwen Liu
Final Remarks
The mathematic background of ECC is more complex than other cryptographic systems
Geometry, abstract algebra, number theory
ECC provides greater security and more efficient performance than the first generation public key techniques (RSA and Diffie-Hellman)
Mobile systems Systems required high security level ( such as 256 bit AES)
The next step is to apply the ECDH principle to the group key management protocol. Unless the explicit statement of sources, the materials used in this tutorial are from Hankersons book[9] and www.certicom.com.
56
Fuwen Liu
57
Fuwen Liu
Reference
(1) (2) (3) (4) (5) (6) (7) (8) (9) W. Diffie and M. Hellman: New Directions in Cryptography. IEEE Transactions on Information Theory, 22:644-654,1976. N. Koblitz. Elliptic curve cryptosystems. Mathematics of Computation, 48:203209,1987. V. Miller. Use of elliptic curves in cryptography. Advances in CryptologyCRYPTO 85 (LNCS 218) [483], 417426, 1986. G. Faltings (July 1995): The Proof of Fermat's Last Theorem by R. Taylor and A. Wiles. Notices of the AMS 42 (7): 743746. ISSN 0002-9920. July 1995. I. Blake, G. Seroussi, and N. Smart: Elliptic Curves in Cryptography. Cambridge, U.K.: Cambridge University Press, 1999, vol 265. J. Lopez and R. Dahab: Improved algorithms for elliptic curve arithmetic in GF(2n). Selected Areas in CryptographySAC 98 (LNCS 1556) [457], 201212, 1999. A. Fernandes: Elliptic Curve cryptography. Dr. Dobbs Journal, December 1999. RSA Laboratory: FAQ. http://www.rsa.com/rsalabs/node.asp?id=2325 D. Hankerson, A. Menezes, and S. Vanstone: Guide to Elliptic Curve Cryptography. Springer, 2004.
Key Management for Curve Dynamic Peer Group A Tutorial on Elliptic Cryptography 58
Fuwen Liu