pkc-intro
pkc-intro
Public key
Cryptography
Prof. Sugata Gangopadhyay
Department of Computer Science and
Engineering
Indian Institute of Technology Roorkee
Public key cryptosystems
For Alice 𝑘 = 𝑔𝑏𝑎 (mod 𝑝) and for Bob 𝑘 = 𝑔𝑎𝑏 (mod 𝑝).
Since 𝑎𝑏 ≡ 𝑏𝑎 (mod 𝑝 − 1), the two parties have computed the same value.
Example: Diffie-Hellman protocol
• Let 𝑝 = 5 and 𝑔 = 2. Suppose Alice chooses 𝑎 = 2 and
sends
𝑔𝑎 = 22 mod 5 = 4
Suppose Bob chooses 𝑏 = 3 and sends 𝑔𝑏 = 23 mod 5 = 3
to Alice.
• In this way Alice and Bob agrees upon the secret key 𝐾 = 4.
Security of Diffie-Hellman protocol
• Let 𝑝 be a prime number, 𝑔 ∈ ℤ𝑝∗ is a
generator, and ℎ = 𝑔𝑎 mod 𝑝.
• Therefore, 𝑥 𝜙 𝑛
=𝑥 𝑝−1 𝑞−1
≡
1 mod 𝑛
the same size. Number of steps: Let 𝑛 = 𝑝𝑞, where 𝑝 and 𝑞 are primes.
approximately (log 2 𝑝)2 .
Let 𝒫 = 𝒞 = ℤ𝑛 , and define
𝒦 = 𝑛, 𝑝, 𝑞, 𝑎, 𝑏 : 𝑎𝑏 ≡ 1 𝑚𝑜𝑑 𝜙 𝑛 ,
where 𝜙 𝑛 = 𝜙 𝑝𝑞 = (𝑝 − 1)(𝑞 − 1).
• For computing 𝜙 𝑛 the number of steps
is approximately (log 2 𝑝)2 . For 𝑘 ∈ 𝑛, 𝑝, 𝑞, 𝑎, 𝑏 ∈ 𝒦
Encryption: 𝑒𝑘 𝑥 = 𝑥 𝑏 𝑚𝑜𝑑 𝑛, for all
𝑥 ∈ ℤ𝑛 ;
Decryption: 𝑑 𝑦 = 𝑦 𝑎 𝑚𝑜𝑑 𝑛, for all
• Next is to decide whether 𝑎 is coprime to 𝑦 ∈ ℤ𝑛 .
𝜙 𝑛 = (𝑝 − 1)(𝑞 − 1) and if so find 𝑏.
The key is split into two parts.
Public key: 𝑛, 𝑏 ;
Private key: (𝑝, 𝑞, 𝑎).
Complexity of RSA computation
• Next is to decide whether 𝑎 is coprime to Let 𝑛 = 𝑝𝑞, where 𝑝 and 𝑞 are primes.
?
Let 𝒫 = 𝒞 = ℤ𝑛 , and define
gcd a, 𝜙 𝑛 =
ฎ 1 and if so find 𝑏. 𝒦 = 𝑛, 𝑝, 𝑞, 𝑎, 𝑏 : 𝑎𝑏 ≡ 1 𝑚𝑜𝑑 𝜙 𝑛 ,
where 𝜙 𝑛 = 𝜙 𝑝𝑞 = (𝑝 − 1)(𝑞 − 1).
For 𝑘 ∈ 𝑛, 𝑝, 𝑞, 𝑎, 𝑏 ∈ 𝒦
Encryption: 𝑒𝑘 𝑥 = 𝑥 𝑏 𝑚𝑜𝑑 𝑛, for all
• This is done by an algorithm called square 𝑥 ∈ ℤ𝑛 ;
and multiply. Decryption: 𝑑 𝑦 = 𝑦 𝑎 𝑚𝑜𝑑 𝑛, for all
𝑦 ∈ ℤ𝑛 .