You are on page 1of 20

Asymmetric Key

Cryptography
(Public key cryptography)

04/01/2024 V.madhu Viswanatham 1


Symmetric-key cryptography based on sharing secrecy

• In symmetric –key cryptography, symbols are permuted or substituted


• In asymmetric-key cryptography, numbers are manipulated.
• Symmetric-key cryptography based on sharing secrecy
• Asymmetric-key cryptography based on personal secrecy

04/01/2024 V.madhu Viswanatham 2


Encryption with a Public Key System

04/01/2024 V.madhu Viswanatham 3


• Put (lock, locking key) in the
public domain, i.e., in a post
office.
• Anyone who wants to send me a
letter confidentially can do the
following:
– Buy a strong box
– Use my lock with the locking key
to lock the letter inside.
– Send me the locked box.
Lo Unl
cki ocki
ng ng
Ke key
y
04/01/2024 V.madhu Viswanatham 4
Key Exchange with a Public Key System

Bob (ke , k d) is the key pair Alice


of Alice

session encryted session


key sess. key key
k E k (k) k
Alice’s e Alice’s
public Private
Key k e Key k d

Bob generates the session key k, sends Alice the encrypted session key.

04/01/2024 V.madhu Viswanatham 5


The Idea of Public Key Cryptography
• Trapdoor One-Way Function
Given y and a trapdoor,x can be computed easily.

04/01/2024 WECP 6
Symmetric Vs Asymmetric Key
Characteristics Symmetric key Asymmetric key

Key used for Same Key is used for One key is used for encryption
encryption/decryption encryption and and another different key is
decryption used for decryption
Speed of Very fast slower
Encryption/decryption
Size of resulting cipher Usually same as or less More than the original text
text than the original text size size
Key agreement/exchange A big problem No problem

Number of keys required N(N-1)/2 secret keys N secrete keys


Usage Mainly used for encryption Can be used for encryption
and and decryption as well as for
decryption(Confidentiality digital signature
),cannot be used for
Digital signature

04/01/2024 V.madhu Viswanatham 7


Applications of public_key cryptography

• Encryption/decryption
• Digital Signature(Authentication)
• Key Exchange
Example:
RSA: √ √ √
Diffie_Hellman: × × √
DSA: × √ ×

04/01/2024 V.madhu Viswanatham 8


RSA Key-Generation
• Select two large primes p and q such that p≠q
• n p×q
• Ø(n) (p-1) × (q-1)
• Select e such that 1<e< Ø(n) and e is coprime to Ø(n).
• d e-1 mod Ø(n) //d is Inverse of e modulo Ø(n)
• Public_key (e,n) //To be announced publicly
• Private_key d // To be kept secret

04/01/2024 V.madhu Viswanatham 9


• Encryption C=Pe mod n
• Decryption P=Cd mod n
• Fast Exponentiation algorithm:
c=0,d=1
for i= k downto 0
do c=2 × c
d=(d × d) mod n
if bi =1
then c=c+1
d=(d × a) mod n
Return d

04/01/2024 V.madhu Viswanatham 10


Alice wants to send the message “THIS IS A TEST”, which
can be changed to a numeric value using the 00−26
encoding scheme (26 is the space character).

The ciphertext calculated by Alice is C = Pe, which is

10.11
Bob can recover the plaintext from the ciphertext using P =
Cd, which is

The recovered plaintext is “THIS IS A TEST” after


decoding.

10.12
Here is a more realistic example. We choose a 512-bit p
and q, calculate n and f(n), then choose e and test for
relative primeness with f(n). We then calculate d. Finally,
we show the results of encryption and decryption. The
integer p is a 159-digit number.

10.13
Continued

The modulus n = p × q. It has 309 digits.

f(n) = (p − 1)(q − 1) has 309 digits.

10.14
Continued

Bob chooses e = 35535 (the ideal is 65537) and tests it to


make sure it is relatively prime with f(n). He then finds the
inverse of e modulo f(n) and calls it d.

10.15
Attacks on RSA
• Factorization Attack
• Chosen-Ciphertext Attack
• Plaintext Attacks
- Short Message Attack
- Cycling Attaack
• Timing Attack

04/01/2024 V.madhu Viswanatham 16


Diffie-Hellman Key exchange Protocol

A B

1 R1=gx mod p

2 R1
R2=gy mod p 3

R2 4

5 K=(R2)x mod p K=(R1)y mod p 6

K=gxy mod p

04/01/2024 V.madhu Viswanatham 17


• K = (R2)x mod p
= (gy mod p)x mod p
= (gy)x mod p
= (gyx) mod p
= (gxy) mod p
= (gx)ymod p
= (gx mod p)y mod p
= (R1)y mod p

04/01/2024 V.madhu Viswanatham 18


• Both A and B need to choose a large prime number p on the order of 300 decimal digits(1024
bits) and g, is a primitive root of order p-1 in the group<Z p*,×>
• A chooses a large random number x such that 0≤x ≤ p – 1 and calculates R 1 =gx mod p.
• B chooses another large random number y such that 0≤y ≤ p – 1 and calculates R 2=gymod p.
• A sends R1 to B.
• B sends R2 to A.
• A computes symmetric key,K=(R2)x mod p
• B computes symmetric key,K=(R1)y mod p

04/01/2024 V.madhu Viswanatham 19


Security of Diffie-Hellman
• Discrete Logarithm Attack
• Man-in-the-middle Attack

04/01/2024 V.madhu Viswanatham 20

You might also like