0% found this document useful (0 votes)
90 views

Ecc!

Uploaded by

shrass0357
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

Ecc!

Uploaded by

shrass0357
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Elliptic Curve Cryptography

(ECC)
Basics of Elliptic Curve (EC)
• Set of points that satisfy a specific mathematical
equation. The cubic equation of an elliptic curve is
given below;
Y2  X3 + aX + b for some constants ‘a’ and ‘b’
with the condition 4a3 + 27b2 ≠ 0.
Types of EC
1. EC over real number.
2. EC over complex number.
3. EC over finite field. (GF(2), GF(5), GF(8),……..)
– NOTE: EC over Finite field is used in cryptography.
– Equation of EC over FF is:
Y2  X3 + aX + b mod p with the condition
4a3 + 27b2 mod p ≠ 0 where a and b
should not be greater than p.
1. Construction of EC
over Finite field
Construct EC over finite field
• Example : Let us consider Z/11 i.e., GF(11)
• Set of all integers in GF(11) = {0,1,2,…….,10}
satisfies the equation
Y2  X3 + aX + b mod p with the condition
4a3 + 27b2 mod p ≠ 0
• Let us take a = 1 and b = 1 then check whether
this satisfies the condition 4a3 + 27b2 mod p ≠ 0
4(13)+ 27(1)2 mod 11 = 31 mod 11 = 9 ≠ 0
• Thus a =1 and b =1 satisfies the condition
Compute all the points on EC
• Consider the equation;
Y2  X3 + aX + b mod p, we can rewrite this
equation as
Y2 mod p = X3 + aX + b mod p
• Substitute a = 1, b = 1, and p = 11 in the above
equation ;
Y2 mod 11 = X3 + X + 1 mod 11
• Use the above equation to find all the points
in EC.
Set of points on the curve
• In the table, find the values of X and Y to
satisfies the equation;
Y2 mod 11 = X3 + X + 1 mod 11
• For example when X = 0 and Y = 1, we will get
the same result which means ‘1’ in the table.
So, consider the point (0,1)
• Similarly, consider other points such as (0,10),
(1,5), (1,6), (2,0), (3,3), (3,8), (4,5), (4,6), (6,5),
(6,6), (8,2), (8,9)
Plotting elliptic curve E11(1,1)with
discovered set of points
12

10 0, 10

8, 9

8 3, 8

6 1, 6 4, 6 6, 6

1, 5 4, 5 6, 5

3, 3

2 8, 2

0, 1

0 2, 0
0 1 2 3 4 5 6 7 8 9
2. Check if the point falls
on the curve
Check if the point falls on the curve
• Check the point (3,8) falls on the elliptic group
E11(1,1).
• Consider the equation;
Y2 mod 11 = X3 + X + 1 mod 11
• Substitute X = 3 and Y = 8 in the above equation;
82 mod 11 = 33 + 3 + 1 mod 11
9 = 31 mod 11
9=9
• This says that the given point (3,8) satisfies the
equation, hence the point (3,8) lies in the curve
E11(1,1).
3. Adding two points on
the curve
(a)P + Q
(b)P + P
(a) Adding two points P and Q on the
EC

Visual representation of adding P and Q on the elliptic curve


Algebraic representation of finding
P+Q
• Let us consider P = (x1,y1) and Q = (x2,y2)
be in the elliptic group Ep(a,b) and Q ≠ -P
and P ≠ Q.
• The rule for addition over the elliptic
group Ep(a,b) is;
x3 = 2 - x1- x2 mod p
y3 =  (x1- x3) - y1 mod p
Where  = [(y2-y1)/(x2- x1) ]mod p
Example – (3,8) + (6,5) on E11(1,1)
• Let us take P = (3,8) and Q = (6,5), here Q ≠ -P and
P ≠ Q.
• Given; (x1, y1) = (3,8) and (x2, y2) = (6,5)
1. Compute  = [(y2-y1)/(x2- x1) ]mod p
= [(5-8)/(6-3) ]mod 11
= [(-3)/3 ]mod 11
= -1 mod 11
= 11 – (1 mod 11) = 11 -1 = 10
 = 10
2. Compute x3 = 2 - x1- x2 mod p
= 102 – 3 – 6 mod 11
= 100 – 9 mod 11 = 91 mod 11
x3 = 3
3. Compute y3 =  (x1- x3) - y1 mod p
= 10 (3 - 3) - 8 mod 11
= – 8 mod 11
= 11 – (8 mod 11) = 11 – 8 = 3
y3 = 3
Hence, by adding (3,8) and (6,5) , we will get the
resultant point (3,3). Now we need to check
whether this resultant point (3,3) lies on the
curve E11(1,1)
Check (3,3) lies on E11(1,1)
• Let us consider the equation,
Y2 mod 11 = X3 + X + 1 mod 11
• Substitute X = 3 and Y = 3 in the above equation ;
32 mod 11 = 33 + 3 + 1 mod 11
9 = 31 mod 11
9=9
It satisfies the equation. Therefore, the resultant
point (3,3) is also lies in the elliptic group E11(1,1).
(b) Adding a point ‘P’ with ‘P’

NOTE: Doubling of points


(Multiplication)
2P = P + P
3P = P + P + P
4P = P + P + P + P
Visual representation of P + P …………….
NP = Adding ‘P’, N times
ECDLP (EC Discrete Logarithm
Problem)
• Suppose that you are given two points P and Q.
• The ECDLP is to find an integer ‘n’ satisfying
Q = P + P +……..+ P = nP
• If prime P is large, then it is very difficult to find
‘n’.
• The extreme difficulty of the ECDLP yields highly
efficient cryptosystems that are in widespread
use protecting everything from your bank
account to your government’s secrets.
P + P using algebraic expression
• Let us consider the point P(x,y) in the elliptic
group Ep(a,b).
• The rules for adding P with P over the elliptic
group Ep(a,b) is;
x3 = 2 - x- x mod p
y3 =  (x- x3) - y mod p
Where  = [(3x2+a)/(2y) ]mod p
Example
• P(4,6) over E11(1,1). Find P + P.
1. Compute  = [(3x2+a)/(2y) ]mod p
= [(3*42+1)/(2*1) ]mod 11
= (49/12) mod 11
= 49 mod 11* 12-1 mod 11
=5*1
=5
NOTE:
12-1 mod 11 => (12 * d)%11 = 1 => d = 1
2. Compute x3 = 2 – x – x mod p
= 52 – 4 – 4 mod 11
= 25 – 8 mod 11 = 17 mod 11
x3 = 6
3. Compute y3 =  (x- x3) - y mod p
= 5 (4 - 6) - 6 mod 11
= 5(– 2) - 6 mod 11
= -10 – 6 mod 11 = -16 mod 11
= 11 – (16 mod 11) = 11 – 5 = 6
y3 = 6
Hence, by adding (4,6) and (4,6) , we will get the resultant
point (6,6). Now we need to check whether this
resultant point (6,6) lies on the curve E11(1,1)
Check (6,6) lies onE11(1,1)
• Consider the equation;
Y2 mod 11 = X3 + X + 1 mod 11
• Substitute X = 6 and Y = 6 in the above
equation ;
62 mod 11 = 63 + 6 + 1 mod 11
36 mod 11 = 223 mod 11
3=3
It satisfies the equation. Therefore, the resultant
point (6,6) is also lies in the elliptic group
E11(1,1).
Properties of EC
Properties of EC
• Consider the EC ‘E’. The set of points on the curve over
a finite field Fp. E(Fp) is a finite abelian group.
• Let’s begin by showing that E(Fp) is a group.
– Closure: Consider points P, Q  E(Fp) then P + Q  E(Fp).
Hence closure holds.
– Identity: The identity element is the point at infinity O. P +
O = O + P = P.
– Associativity: Consider the points P, Q, R  E(Fp) then (P +
Q) + R = P + (Q + R).
– Additive inverse: if x2 = x1, and y2 = -y1, that is P = (x1,y1)
and Q = (x2,y2) = (x1,-y1) = -P then P + Q = O. Hence, E(Fp)
is a group.
• E(Fp) is an abelian, for points P, Q  E(Fp), P + Q = Q +
P. Hence, E(Fp) is an abelian group.
Elliptic Curve Cryptography
(ECC)
Elliptic Curve Cryptography
• Use the concept of EC in cryptography & it is
an Asymmetric cryptography technique.
• Steps:
1. Encode a plain text message as a point on the
curve.
2. Establish private key and public key.
3. Encrypt the message using public key.
4. Decrypt the message using private key.
Step-1
• Encode the plaintext m to be sent as an
x-y point Pm.
• There are relatively straightforward
techniques to perform such mappings.
• Require a point G and an elliptic group Ep(a,b)
as parameters.
• Example:
Let us take Pm = (4,6) where Pm  E11(1,1)
Step - 2
• Establish a public and private keys:
1. Select a private (secret) key ‘n’, where 1  n 
p-1.
2. Choose the generator point G  Ep(a,b).
3. Compute the public key as PU = n*G.
Step-2 : Example
• G = (1,5)  E11(1,1)
• n=2
• PU = n*G = 2G (adding point G two times)
To find 2G = (1,5) + (1,5):
– Compute  = [(3x2+a)/(2y) ]mod p
= [(3(12)+1)/(2*5) ]mod 11
= (4/10) mod 11
= 4 * 10-1 mod 11
= 4 * 10 mod 11 = 40 mod 11 = 7
=7
NOTE: To find the multiplicative inverse
10-1 mod 11 [(10*d)%11] = 1  here d = 10
Compute x3 = 2 – x – x mod p
= 72 – 1 – 1 mod 11
= 49 – 2 mod 11 = 47 mod 11
x3 = 3
Compute y3 =  (x- x3) - y mod p
= 7 (1 - 3) - 5 mod 11
= - 19 mod 11
= 11 – (19 mod 11)
= 11 – 8
y3 = 3
Therefore, the coordinates of 2G is (3,3).
• Pm = (4,6)
• PU = (3,3)
• n=2
• G = (1,5)
Step - 3
• Encryption:
1. Choose a random positive number ‘k’
where 1  k  p-1.
2. Then produces a cipertext Cm as a pair
points: Cm = {kG, Pm+kPU}
3. C1 = kG and C2 = Pm+kPU
Step – 3 : Example
• Lets take k = 2
1. Compute C1 = kG = 2G
As we know 2G = (1,5) + (1,5) = (3,3)
Therefore C1 = (3,3)
2. Compute C2 = (Pm+kPU), where Pm = (4,6),
k = 2 and PU=(3,3).
C2 = (Pm+kPU)
= (4,6) + 2 (3,3)
• First Compute 2 (3,3) = (3,3) + (3,3) as
follows;
– Compute  = [(3x2+a)/(2y) ]mod p
= [(3(32)+1)/(2*3) ]mod 11
= (28/6) mod 11
= 28 * 6-1 mod 11
= 28 * 2 mod 11
=1
Compute x3 = 2 – x – x mod p
= 12 – 3 – 3 mod 11
= 1 – 6 mod 11
= -5 mod 11 = 11 – (5 mod 11) = 11 - 5
x3 = 6
Compute y3 =  (x- x3) - y mod p
= 1 (3 - 6) - 3 mod 11
= - 6 mod 11
= 11 – (6 mod 11)
= 11 – 6
y3 = 5
Therefore, (3,3) + (3,3) = (6,5)
• Compute C2 = (Pm+kPU), where Pm = (4,6),
k = 2 and PU=(3,3).
C2 = (Pm+kPU)
= (4,6) + 2 (3,3)
As we computed 2 (3,3) = (6,5) so substitute
this in the above equation,
C2 = (4,6) + (6,5)
Now add two different points (4,6) and (6,5)
as follows;
• Compute  = [(y2-y1)/(x2- x1) ]mod p
= [(5-6)/(6-4) ]mod 11
= [(-1)/2 ]mod 11
= (-1) * 2-1mod 11
= – 6 mod 11 = 11 – (6 mod 11)
= 11 - 6
=5
• Compute x3 = 2 - x1- x2 mod p
= 52 – 4– 6 mod 11
= 25 – 10 mod 11 = 15 mod 11
x3 = 4
• Compute y3 =  (x1- x3) - y1 mod p
= 5 (4 - 4) - 6 mod 11
= – 6 mod 11
= 11 – (6 mod 11) = 11 – 6
y3 = 5
Therefore, C2 = (4,5)
Finally the encrypted message is Cm = (C1, C2) = {(3,3),(4,5)}
Step - 4
• Decryption:
• Compute Pm = C2 – [n C1]
Step-4: Example
• Pm = C2 – [n C1], where C1 = (3,3),
C2 = (4,5), n=2.
Pm = (4,5) – [2(3,3)]
As we computed 2 (3,3) = (6,5) so substitute
this in the above equation,
Pm = (4,5) – (6,5)
We can rewrite the above equation by
considering the following representation;
• Let consider the following representation;

• Where –P is the reflection of P and the difference


between P and –P is no change in x and the sign of y
varies.
• So we can rewrite the equation
Pm = (4,5) – (6,5)
= (4,5) + (6,-5)
Here -5 mod 11 = 11 – (5 mod 11) = 11 – 5 = 6, so we
replace -5 by 6, then finally we get;
Pm = (4,5) + (6,6) Now add these two points
• Pm = (4,5) + (6,6) :
Compute  = [(y2-y1)/(x2- x1) ]mod p
= [(6-5)/(6-4) ]mod 11
= [1/2 ]mod 11
= 1 * 2-1mod 11
=6
Compute x3 = 2 - x1- x2 mod p
= 62 – 4– 6 mod 11
= 36 – 10 mod 11 = 26 mod 11
x3 = 4
Compute y3 =  (x1- x3) - y1 mod p
= 6 (4 - 4) - 5 mod 11
= – 5 mod 11
= 11 – (5 mod 11) = 11 – 5
y3 = 6
Therefore, the plaintext Pm = (4,6)
Advantages of ECC over RSA
• ECC, it takes one-sixth the computational
effort to provide the same level of
cryptographic security that you get with 1024
bit RSA and is 15 times faster.
• Because of the much smaller key sizes involved,
ECC algorithms can be implemented on
smartcards. Contactless smart cards work only
with ECC.
• ECC has become important for wireless sensor
networks.
• ECC is also serving as the standard mode of
encryption that is used widely by various web
applications.
• Popular crypto currencies such as Bitcoin and
Ethereum make use of the Elliptic curve digital
signature algorithm (ECDSA) particularly in
signing transactions due to the security levels
offered by ECC.
Elliptic curve Diffie Hellmen
(ECDH)
Key exchange Algorithm
Elliptic curve Diffie Hellmen (ECDH)
Key exchange
• The Diffie-Hellman algorithm is being used to establish
a shared secret that can be used for
secret communications using the elliptic curve.
• Let us consider 4 variables, one prime P and G
(generator) and two private values a and b.
• P and G are both publicly available.
• Users (say Alice and Bob) pick private values a and b
and they generate a key and exchange it publicly.
• The opposite person receives the key and that
generates a secret key, after which they have the same
secret key to encrypt.
Steps involved in ECDH algorithm
Example
• Step 1: Alice and Bob get public numbers P = 23, G = 9
• Step 2: Alice selected a private key a = 4 and Bob
selected a private key b = 3
• Step 3: Alice and Bob compute public values
– Alice: x = (Ga mod P) =(94 mod 23) = (6561 mod 23) = 6
– Bob: y = (Gb mod P) = (729 mod 23) = 16
• Step 4: Alice and Bob exchange public numbers
• Step 5: Alice receives public key y =16 and Bob receives
public key x = 6
• Step 6: Alice and Bob compute symmetric keys
– Alice: ka = ya mod P = 164 mod 23 = 65536 mod 23 = 9
– Bob: kb = xb mod P = 63 mod 23 = 216 mod 23 = 9
• Step 7: 9 is the shared secret key.
Exercises
1. If P = (13,7) E23(1,1) then find – P.
• Solution:
NOTE: if P = (x1,y1) then – P = (x1,-y1)
-P = (13,-7)
Where – 7 mod 23 = 23 – (7 mod 23) = 23 – 7= 16
So, -P = (13,16)
2. Consider an EC point G = {15, 13} on the
elliptic curve over finite field y2 ≡ x3 + 7 (mod
17) and multiply it by k = 6. Find P = kG.
• Hint: 2P = P + P, 3P = P + 2P, 4P = P + 3P,…….
Solution:
P = kG = 6 * (15,13) = (5, 8)

You might also like