Asymmetric Key Cryptography
Asymmetric Key Cryptography
Asymmetric Key Cryptography
Asymmetric Key
Cryptography
Abhishek Bichhawat 10/02/2023
Challenges with Symmetric Key Cryptography
2
Challenges with Symmetric Key Cryptography
3
Diffie-Hellman-Merkle (DH) Key Exchange
4
DH Key Exchange
5
DH Key Exchange
g and p are
public values
Generate x Generate y
6
Man-in-the-middle Attack
● Desired Property
○ Alice and Bob should know the shared secret
● What if there is a man-in-the-middle?
○ Alice thinks she is talking to Bob
○ Bob thinks he is talking to Alice
○ But, both are talking to Mallory who
now shares secret keys with both
Alice and Bob (reading all their
messages comfortably)!
○ DH (as is described) is not secure against a MITM
7
Public Key Cryptography
● Key generation:
○ Choose two large prime numbers p and q such that p ≠ q,
randomly and independently of each other.
○ Pick integer e coprime with (p-1)(q-1) (i.e., gcd(e, (p-1)(q-1)) = 1)
○ Compute d such that
ed mod (p-1)(q-1) = 1 mod (p-1)(q-1) (or) ed mod (p-1)(q-1) = 1
○ n = pq (Factoring problem)
○ Private key = (n, d)
○ Public key = (n, e)
● Messages are a numbers
11
RSA
● Encryption:
○ E(n, e)(m) = me mod n
● Decryption:
○ D(n, d)(c) = cd mod n
● D(n, d)(E(n, e)(m)) = m (ed mod (p-1)(q-1) = 1)
(ed - 1 = h(p-1) = k(q-1))
12
RSA
● Encryption:
○ E(n, e)(m) = me mod n
● Decryption:
○ D(n, d)(c) = cd mod n
● Let p = 7 and q = 17
○ n = 7 * 17 = 119
○ (p-1)(q-1) = 96
○ e should be coprime with 96 - choose 5
○ Compute d such that ed mod (p-1)(q-1) = 1, i.e., 5*d mod 96 = 1
■ Assume d is 77
13
RSA
● Encryption:
○ E(n, e)(m) = me mod n
● Decryption:
○ D(n, d)(c) = cd mod n
● D(n, d)(E(n, e)(m)) = m (ed - 1 = h(p-1) = k(q-1))
(me mod pq)d mod pq = m mod pq
med mod pq = m mod pq
14
RSA
● Encryption:
○ E(n, e)(m) = me mod n
● Decryption:
○ D(n, d)(c) = cd mod n
● D(n, d)(E(n, e)(m)) = m (ed - 1 = h(p-1) = k(q-1))
(me mod pq)d mod pq = m mod pq
med mod pq = m mod pq
med mod p = m mod p med mod q = m mod q
med - 1 m mod p = m mod p …
m(p - 1)h m mod p = m mod p … Fermat’s little theorem
(m(p - 1))h m mod p = m mod p … ap − 1 ≡ 1 (mod p) 15
RSA
● Encryption:
○ E(n, e)(m) = me mod n
● Decryption:
○ D(n, d)(c) = cd mod n
● D(n, d)(E(n, e)(m)) = m (ed - 1 = h(p-1) = k(q-1))
(me mod pq)d mod pq = m mod pq
med mod pq = m mod pq
med mod p = m mod p med mod q = m mod q
med - 1 m mod p = m mod p …
m(p - 1)h m mod p = m mod p …
(m(p - 1))h m mod p = m mod p … Fermat’s little theorem
1h m mod p = m mod p … ap − 1 ≡ 1 (mod p) 16
Attacks on RSA
● Bleichenbacher attack
○ Encryption with e = 3 can be decrypted easily
● Hastad’s broadcast attack (Coppersmith’s attack)
○ Clear-text message m sent to e or more recipients that share the
same exponent e, but different n (p and q), can be decrypted easily
via the Chinese remainder theorem.
○ c1 = m3 mod n1, c2 = m3 mod n2, c3 = m3 mod n3
○ Chinese remainder theorem gives c’ = m3 mod n1*n2*n3 = m3
(m3 .is smaller than n1*n2*n3)
17
Attacks on RSA
● Bleichenbacher attack
○ Encryption with e = 3 can be decrypted easily
● Hastad’s broadcast attack (Coppersmith’s attack)
● Deterministic encryption algorithm
○ Chosen plaintext attack against the cryptosystem
○ RSA without padding is not semantically secure
18
Attacks on RSA
● Bleichenbacher attack
○ Encryption with e = 3 can be decrypted easily
● Hastad’s broadcast attack (Coppersmith’s attack)
● Deterministic encryption algorithm
○ Chosen plaintext attack against the cryptosystem
● Vulnerable to chosen ciphertext attack
○ Product of two ciphertexts is equal to the encryption of the
product of the respective plaintexts
19
Attacks on RSA
● Bleichenbacher attack
○ Encryption with e = 3 can be decrypted easily
● Hastad’s broadcast attack (Coppersmith’s attack)
● Deterministic encryption algorithm
○ Chosen plaintext attack against the cryptosystem
● Vulnerable to chosen ciphertext attack
○ Product of two ciphertexts is equal to the encryption of the
product of the respective plaintexts
● Timing and power attacks
○ Measure time and power consumption to figure operations
20
Digital Signatures
21
Digital Signatures
22
Digital Signatures
YES!
Certificate Authority
Is this Alice’s
signature? 23
Digital Signatures
D E
M S S,M
24
RSA Signatures
● Existential forgery
○ The attacker manages to forge a signature of (at least) one
message, but not necessarily of his choice
● Selective forgery
○ The attacker manages to forge a signature of (at least) one
message of his choice
● Universal forgery
○ The attacker manages to forge a signature of any message
26
Summary
27