25-Encryption and Decryption Using Elliptic Curve Cryptosystem (ECC) - 25-09-2024
25-Encryption and Decryption Using Elliptic Curve Cryptosystem (ECC) - 25-09-2024
by
Dr M Rajasekhara Babu
School of
Computer Science and Engineering
Encryption
Decryption
Summary, References
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 2
Objectives & Teaching Learning Material
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 3
Session Plan
Skill and
Time Learning Aid and Typical Student
Content Faculty Approach Competency
(in min) Methodology Activity
Developed
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 4
Steps in Encryption and Decryption using ECC
Given in the Problem
• Step 1:
– 𝑝𝑟 = 7
– Compute public key of sender(spub)
– Message ≡
xM , yM = (3, 4) • Step 2:
– g ≡ xg , yg = 3, 3 – Compute Public key of receiver(rpub)
– 𝑠𝑝𝑟𝑖𝑣 = 3 • Step 3:
– 𝑟𝑝𝑟𝑖𝑣 = 2
– Compute secret key of Sender (skey)
Computed
• Step 4:
– 𝑠𝑝𝑢𝑏 = (5,5)
– Compute Secret key of receiver (rkey)
– 𝑟𝑝𝑢𝑏 = 1,4
– 𝑠𝑘𝑒𝑦 = 1,3 • Step 5:
– 𝑟𝑘𝑒𝑦 = (1,3) – Encryption: Generate Cypher Message CM)) from original message
• Step 6:
– Decryption: Generate original message from Cypher Message CM))
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 5
Encryption and Decryption
Given in the Problem
– 𝑝𝑟 = 7
• Encryption Process
– Message ≡ – The original message is encoded by mapping it to a point on the
xM , yM = (3, 4) elliptic curve
– g ≡ xg , yg = 3, 3
• CM = spriv g, Message + ske𝑦 or rkey as skey = rkey
– 𝑠𝑝𝑟𝑖𝑣 = 3
• CM = spriv g, Message + spriv rpub
– 𝑟𝑝𝑟𝑖𝑣 = 2
Computed – Both coordinates of CM (x and y) are points on the elliptic curve
– 𝑠𝑝𝑢𝑏 = (5,5) • Decryption Process
– 𝑟𝑝𝑢𝑏 = 1,4
– The receiver decrypts the message by subtracting the product of
– 𝑠𝑘𝑒𝑦 = 1,3
their private key (rpriv ) and the first coordinate of CM from the
– 𝑟𝑘𝑒𝑦 = (1,3)
second coordinate of CM : Message + 𝑠𝑝𝑟𝑖𝑣 𝑟𝑝𝑢𝑏 − 𝑟𝑝𝑟𝑖𝑣 𝑠𝑝𝑟𝑖𝑣 𝑔
= Message + 𝑠𝑝𝑟𝑖𝑣 𝑟𝑝𝑟𝑖𝑣 𝑔 − (𝑟𝑝𝑟𝑖𝑣 𝑠𝑝𝑟𝑖𝑣 𝑔)
• Where 𝑟𝑝𝑢𝑏 = 𝑟𝑝𝑟𝑖𝑣 𝑔. Hence it simplifies to:
Message + 𝑠𝑝𝑟𝑖𝑣 𝑟𝑝𝑟𝑖𝑣 𝑔 − 𝑠𝑝𝑟𝑖𝑣 𝑟𝑝𝑟𝑖𝑣 𝑔 = Message
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 6
ECC: Encryption and Decryption
Given in the Problem
– 𝑝𝑟 = 7
• Encryption Process
– Message ≡ – The original message is encoded by mapping it to a point on the
xM , yM = (3, 4) elliptic curve
– g ≡ xg , yg = 3, 3
• CM = spriv g, Message + ske𝑦 or rkey as skey = rkey
– 𝑠𝑝𝑟𝑖𝑣 = 3
• CM = spriv g, Message + spriv rpub
– 𝑟𝑝𝑟𝑖𝑣 = 2
Computed – Both coordinates of CM (x and y) are points on the elliptic curve
– 𝑠𝑝𝑢𝑏 = (5,5) • Decryption Process
– 𝑟𝑝𝑢𝑏 = 1,4
– The receiver decrypts the message by subtracting the product of
– 𝑠𝑘𝑒𝑦 = 1,3
their private key (rpriv ) and the first coordinate of CM from the
– 𝑟𝑘𝑒𝑦 = (1,3)
second coordinate of CM : Message + 𝑠𝑝𝑟𝑖𝑣 𝑟𝑝𝑢𝑏 − 𝑟𝑝𝑟𝑖𝑣 𝑠𝑝𝑟𝑖𝑣 𝑔
= Message + 𝑠𝑝𝑟𝑖𝑣 𝑟𝑝𝑟𝑖𝑣 𝑔 − (𝑟𝑝𝑟𝑖𝑣 𝑠𝑝𝑟𝑖𝑣 𝑔)
• Where 𝑟𝑝𝑢𝑏 = 𝑟𝑝𝑟𝑖𝑣 𝑔. Hence it simplifies to:
Message + 𝑠𝑝𝑟𝑖𝑣 𝑟𝑝𝑟𝑖𝑣 𝑔 − 𝑠𝑝𝑟𝑖𝑣 𝑟𝑝𝑟𝑖𝑣 𝑔 = Message
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 7
Steps in Encryption and Decryption using ECC
Given in the Problem
– 𝑝𝑟 = 7
• Step 1:
– Message ≡ – Compute public key of sender(spub)
xM , yM = (3, 4) • Step 2:
– g ≡ xg , yg = 3, 3 – Compute Public key of receiver(rpub)
– 𝑠𝑝𝑟𝑖𝑣 = 3
• Step 3:
– 𝑟𝑝𝑟𝑖𝑣 = 2
– Compute secret key of Sender (skey)
Computed
– 𝑠𝑝𝑢𝑏 = (5,5) • Step 4:
– 𝑟𝑝𝑢𝑏 = 1,4 – Compute Secret key of receiver (rkey)
– 𝑠𝑘𝑒𝑦 = 1,3 • Step 5:
– 𝑟𝑘𝑒𝑦 = (1,3) – Encryption: Generate Cypher Message CM)) from original message
• Step 6:
– Decryption: Generate original message from Cypher Message CM))
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 8
ECC(Encryption): Computation of Ciphertext CM
Given in the Problem
– 𝑝𝑟 = 7
• CM = spriv g, Message + ske𝑦 or rkey as skey = rkey
– Message ≡
xM , yM = (3, 4)
• CM = spriv g, Message + spriv rpub
– g ≡ xg , yg = 3, 3
– 𝑠𝑝𝑟𝑖𝑣 = 3
spriv g=𝑠𝑝𝑢𝑏 = (5,5); Message = (3, 4); ske𝑦 or rkey =(1,3)
– 𝑟𝑝𝑟𝑖𝑣 = 2
Computed Find CM
– 𝑠𝑝𝑢𝑏 = (5,5)
– 𝑟𝑝𝑢𝑏 = 1,4 𝐶𝑀 = 𝐶𝑀 = {(5, 5), (3, 4) + (1, 3)}
– 𝑠𝑘𝑒𝑦 = 1,3
– 𝑟𝑘𝑒𝑦 = (1,3)
𝑠𝑝𝑟𝑖𝑣 𝑔, 𝑀𝑒𝑠𝑠𝑎𝑔𝑒 𝐶𝑀 = {(5, 5), (3, 4) + (1, 3)}
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 9
ECC(Encryption): Computation of Ciphertext CM:Slope
Key Generation and
Exchange • Consider two points A(3,4) and B(1,3) for E7(1,0)
Encryption and Decryption
– Example for ECC
then compute xL
Encryption and
Decryption xJ=3; yJ=4; xK=1; yK=3; p=7; a=1;b=0
Determine the public key of
receiver
– Double 𝑟𝑝𝑢𝑏 ≡ 𝑥𝐹 , 𝑦𝐹 Find the slope (λ)
• Elliptic Curve
Cryptosystem (ECC): (𝑦𝐽 −𝑦𝐾 ) (4 − 3) 1
Slope λ= (mod p) if A≠ B =
(𝑥𝐽 −𝑥𝐾 ) (3 − 1) 2
• Compute xF
• Compute yF Value of 2λmod 7
1
– Addition: (𝑥𝐸 , 𝑦𝐸 ) λ 1 2 3 4 𝜆 = mod 7
• Elliptic Curve
2
Cryptosystem (ECC): 2λ 2 4 6 8
Slope 2λ𝒎𝒐𝒅 𝟕 2 4 6 1 𝜆=4
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 10
ECC(Encryption): Computation of Ciphertext CM:Compute xL
Key Generation and
Exchange • Consider two points A(3,4) and B(1,3) for E7(1,0)
Encryption and Decryption
– Example for ECC
then compute xL
Encryption and
Decryption xJ=3; yJ=4; xK=1; yK=3; p=7; a=1;b=0, λ=4
Determine the public key of
receiver
– Double 𝑟𝑝𝑢𝑏 ≡ 𝑥𝐹 , 𝑦𝐹 Find xL
• Elliptic Curve
Cryptosystem (ECC):
Slope xL= λ2-xJ-xK (mod p) xL = 42 − 3 − 1 mod 7
• Compute xF
• Compute yF
– Addition: (𝑥𝐸 , 𝑦𝐸 ) xL= 12 (mod 7)
• Elliptic Curve
Cryptosystem (ECC):
Slope xL = 5
• Compute xH
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 11
ECC(Encryption): Computation of Ciphertext CM:Compute yL
Key Generation and
Exchange • Consider two points A(3,4) and B(1,3) for E7(1,0)
Encryption and Decryption
– Example for ECC
then compute yL
Encryption and
Decryption
Determine the public key of
xJ=3; yJ=4; xK=1; yK=3; p=7; a=1;b=0, λ=4; xL = 5
receiver
– Double 𝑟𝑝𝑢𝑏 ≡ 𝑥𝐹 , 𝑦𝐹 Find yL
• Elliptic Curve
Cryptosystem (ECC):
Slope 𝑦𝐿 = 𝜆(𝑥𝐽 − 𝑥𝐿 ) − 𝑦𝐽 (𝑚𝑜𝑑 𝑝) yL= 4*(3-5)-4 (mod 7)
• Compute xF
• Compute yF
– Addition: (𝑥𝐸 , 𝑦𝐸 ) yL= −12(mod 7)
• Elliptic Curve
Cryptosystem (ECC):
Slope yL=2
• Compute xH
• Compute yF
(3, 4) + (1, 3) = 𝑥𝐿 , 𝑦𝐿 ≡ (5,2)
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 12
ECC(Encryption): Computation of Ciphertext CM
Given in the Problem
– 𝑝𝑟 = 7
• CM = spriv g, Message + ske𝑦 or rkey as skey = rkey
– Message ≡
xM , yM = (3, 4)
• CM = spriv g, Message + spriv rpub
– g ≡ xg , yg = 3, 3
– 𝑠𝑝𝑟𝑖𝑣 = 3
spriv g=𝑠𝑝𝑢𝑏 = (5,5); Message = (3, 4); ske𝑦 or rkey =(1,3)
– 𝑟𝑝𝑟𝑖𝑣 = 2
Computed Find CM
– 𝑠𝑝𝑢𝑏 = (5,5)
– 𝑟𝑝𝑢𝑏 = 1,4 𝐶𝑀 = 𝐶𝑀 = {(5, 5), (3, 4) + (1, 3)}
– 𝑠𝑘𝑒𝑦 = 1,3
– 𝑟𝑘𝑒𝑦 = (1,3)
𝑠𝑝𝑟𝑖𝑣 𝑔, 𝑀𝑒𝑠𝑠𝑎𝑔𝑒 𝐶𝑀 = {(5, 5), (3, 4) + (1, 3)}
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 18
ECC(Decryption): Computation of Message
Given in the Problem
– 𝑝𝑟 = 7
• Message = Message + spriv rpub − 𝑟𝑝𝑟𝑖𝑣 𝑠𝑝𝑟𝑖𝑣 𝑔
– Message ≡
xM , yM = (3, 4)
– g ≡ xg , yg = 3, 3 𝑟𝑝𝑟𝑖𝑣 = 2;spriv g = (5,5); Message = (3, 4); spriv rpri𝑣 =
– 𝑠𝑝𝑟𝑖𝑣 = 3 ske𝑦 =(1,3)
– 𝑟𝑝𝑟𝑖𝑣 = 2
Computed Find Message
– 𝑠𝑝𝑢𝑏 = (5,5)
Message = Message = 3,4 + 1,3 − 2 ∗ 5,5
– 𝑟𝑝𝑢𝑏 = 1,4
CM , +spriv rpub − rpriv spriv g Message = { 5, 2 − (1, 3)}
– 𝑠𝑘𝑒𝑦 = 1,3
– 𝑟𝑘𝑒𝑦 = (1,3)
Message = Expression as negation (5,2) +(1,-3)=
CM , + skey − rpriv spub (5,2)+(1,-3 mod 7)== 5,2 +
1, −3 + 7 𝑚𝑜𝑑 7 = 5,2 + (1,4)
𝜆=3
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 20
ECC(Decryption): Computation of Message: Compute xT
Given in the Problem
– 𝑝𝑟 = 7 • Consider two points A(5,2) and B(1,4) for E7(1,0)
– Message ≡ then compute xT
xM , yM = (3, 4)
– g ≡ xg , yg = 3, 3
– 𝑠𝑝𝑟𝑖𝑣 = 3
xo=5; yo=2; xs=1; ys=4; p=7; a=1;b=0; λ=3
– 𝑟𝑝𝑟𝑖𝑣 = 2
Computed
Find xT
– 𝑠𝑝𝑢𝑏 = (5,5)
– 𝑟𝑝𝑢𝑏 = 1,4 xT= λ2-xo-xs (mod p) xT = 32-5-1 (mod 7)
– 𝑠𝑘𝑒𝑦 = 1,3
– 𝑟𝑘𝑒𝑦 = (1,3) xT= 3 (mod 7)
xT =3
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 21
ECC(Decryption): Computation of Message: Compute yT
Given in the Problem
– 𝑝𝑟 = 7 • Consider two points A(5,2) and B(1,4) for E7(1,0)
– Message ≡ then compute yT
xM , yM = (3, 4)
– g ≡ xg , yg = 3, 3
– 𝑠𝑝𝑟𝑖𝑣 = 3
xo=5; yo=2; xs=1; ys=4; p=7; a=1;b=0; λ=3; xT=3
– 𝑟𝑝𝑟𝑖𝑣 = 2
Computed Find yT
– 𝑠𝑝𝑢𝑏 = (5,5)
– 𝑟𝑝𝑢𝑏 = 1,4 yT = λ(xo-xT)-yo(mod p) yT = 3*(5-3)-2 (mod 7)
– 𝑠𝑘𝑒𝑦 = 1,3
– 𝑟𝑘𝑒𝑦 = (1,3) yT = 4(mod 7)
yT =4
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 25
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 26
Dr M Rajasekhara Babu, Professor; School of C.S.E, Vellore Institute of Technology (VIT)-Vellore; 4-Oct-24 4:20 PM Slide. 27