Cryptography-Vit-Module 3
Cryptography-Vit-Module 3
By,
[Link].N.G.,
Assistant Professor Senior,
Department of Analytics,
School of Computer Science and Engineering,
Vellore Institute of Technology, Vellore.
• Public-key cryptography is asymmetric, involving the use of two separate • Public Key Certificate
keys. • A digital document issued and digitally signed by the private key of a Certification
Authority that binds the name of a subscriber to a public key.
• Misconceptions concerning public-key encryption • Public Key (Asymmetric) Cryptographic Algorithm
• Public-key encryption is more secure from cryptanalysis than is symmetric
encryption. • A cryptographic algorithm that uses two related keys, a public key and a private key.
• Public-key encryption is a general-purpose technique that has made symmetric • The two keys have the property that deriving the private key from the public key is
encryption obsolete computationally infeasible.
• Key distribution is trivial when using public-key encryption, compared to the rather • Public Key Infrastructure (PKI)
cumbersome handshaking involved with key distribution centers for symmetric • A set of policies, processes, server platforms, software and workstations used for
encryption. the purpose of administering certificates and public-private key pairs, including the
Prepared by: [Link].N.G., Asst Prof Senior, Dept of ability to issue, maintain,Prepared
and revoke public
by: [Link].N.G., keySenior,
Asst Prof certificates.
Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 1 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 2 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 3 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 4 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 5 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
R = <Zn , +, × >
• Key-Generation Group:
G = <Z f(n)∗, × >
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 6 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 7 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 8 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 9 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 10 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
P=[C2 × C1 p−1−d]
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 11 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Proof Example
−1
• The ElGamal decryption expression 𝐶2 × 𝐶1𝑑 can be verified to • Bob chooses p = 11 and e1 = 2 and d = 3, e2 = e1d = 8.
be P as: • So the public keys are (2, 8, 11) and the private key is 3. Alice chooses
−1 −1 r = 4 and calculates C1 and C2 for the plaintext 7.
• 𝐶2 × 𝐶1𝑑 𝑚𝑜𝑑 𝑝 = 𝑒2𝑟 × 𝑃 × 𝑒1𝑟𝑑 𝑚𝑜𝑑 𝑝
−1
= 𝑒1𝑟𝑑 ×𝑃× 𝑒1𝑟𝑑 =𝑃
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Analysis Example
• Interesting point about ELGamal cryptosystem is that, • Bob uses a random integer of 512 bits. The integer p is a 155-digit
• Alice creates r and keeps it secret and number (the ideal is 300 digits). Bob then chooses e1, d, and
• Bob creates d and keeps it secret. calculates e2, as shown below:
• Alice creates (C1, C2) with r without having any knowledge about d
• 𝐶2 = 𝑒2𝑟 × 𝑃 𝑚𝑜𝑑 𝑝 = 𝑒1𝑟𝑑 × 𝑃 𝑚𝑜𝑑 𝑝 where, 𝑒1𝑟𝑑 acts as
mask that hides P.
• Bob has (C1, C2 and d) but doesn’t have knowledge about r,
• 𝐶1 = 𝑒1𝑟 𝑚𝑜𝑑 𝑝;
• 𝐶1𝑑 = 𝑒1𝑟𝑑 𝑚𝑜𝑑 𝑝
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 12 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Binary
curves Prime
over curves
GF(2m) over Zp
• Variables and coefficients all take on • Use a cubic equation in which the variables
values in GF(2m) and in calculations and coefficients all take on values in the set
• Bob calculates the plaintext P = C2 × ((C1)d)−1 mod p = 3200 mod p. are performed over GF(2m) of integers from 0 through p-1 and in which
• Best for hardware applications calculations are performed modulo p
Prepared by: [Link].N.G., Asst Prof Senior, Dept of • Best Asst
Prepared by: [Link].N.G., for Prof
software applications
Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Elliptic Curve Arithmetic - Elliptic Curves Over Elliptic Curve Arithmetic - Elliptic Curves Over
Zp or GF(p) Zp or GF(p)
• For elliptic curves over Zp, as with real numbers, we limit ourselves to • Now consider the set EP(a,b)
equations (1), consisting of all pairs of integers
(x,y) that satisfy Equation,
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 13 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Elliptic Curve Arithmetic - Elliptic Curves Over Elliptic Curve Arithmetic - Elliptic Curves Over
Zp or GF(p) Zp or GF(p)
• It can be shown that a finite abelian group can be defined based on
the set EP(a,b) provided that (x3+ab+b) mod p has no repeated factors
• The rules for addition over EP(a,b). For all points P,Q € EP(a,b)
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Elliptic Curve Arithmetic - Elliptic Curves Over Elliptic Curve Arithmetic - Elliptic Curves Over Zp or
Zp or GF(p) GF(p)
P+Q
6 2P
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 14 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Elliptic Curve Arithmetic - Elliptic Curves Over Elliptic Curve Arithmetic - Elliptic Curves Over
Zp or GF(p) Zp or GF(p)
• Define an elliptic curve E13 (1,1). • Let us add two points in E13 (1,1), R = P + Q, where
• The equation is y2 = x3 + x + 1 P = (4, 2) and Q = (10, 6).
Solution:
• λ = (6 − 2) × (10 − 4)−1 mod 13 = 4 × 6−1 mod 13 = 5 mod 13.
• x = (52 − 4 −10) mod 13 = 11 mod 13.
• y = [5 (4 −11) − 2] mod 13 = 2 mod 13.
• R = (11, 2), which is a point on the curve
8)
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
• Decryption
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 15 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 16 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 17 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 18 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
Diffie-Hellman Key Agreement – Real Time Diffie-Hellman Key Agreement – Real Time
Example Example
• Let us give a more realistic example. We used a program to create a
random integer of 512 bits (the ideal is 1024 bits).
• The integer p is a 159-digit number.
• We also choose g, x, and y as shown below:
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Man-in-the-Middle Attack
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 19 of 20
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore.
• Decryption
C2 – nB C1
Prepared by: [Link].N.G., Asst Prof Senior, Dept of Prepared by: [Link].N.G., Asst Prof Senior, Dept of
Analytics, SCOPE, VIT, Vellore. Analytics, SCOPE, VIT, Vellore.
Prepared by: [Link].N.G., Asst Prof Senior, SCOPE, VIT, Vellore. Page 20 of 20