CS283 PublicKey
CS283 PublicKey
CSCI 172/283
Fall 2010
Public Key Cryptography
New paradigm introduced by Diffie and
Hellman
The mailbox analogy:
Bob has a locked mailbox
Alice can insert a letter into the box, but can’t
unlock it to take mail out
Bob has the key and can take mail out
IL!
F A
Solution 2
Alice sends the key at some time prior to
sending Bob the encrypted message
IL!
F A
Solution 3 – Use public key
crypto
Diffie Hellman Key Exchange
All users share common modulus, p, and element g
g ≠ 0, g ≠ 1, and g ≠ p-1
Alice chooses her private key, k
A
Computes K = gkA mod p and sends it to Bob in the
A
clear
Bob chooses his private key, k
B
Computes K = gkB mod p and sends it to Alice in the
B
clear
When Alice and Bob want to agree on a shared key,
they compute a shared secret S
S = KBkA mod p
A,B
S = K kB mod p
B,A A
Why does DH work?
SA,B = SB,A
(gkA) kB mod p = (gkB) kA mod p
Eve knows
g and p
KA and KB
Why can’t Eve compute the secret?
Given:
Multiplicative group G
Element a in G
Output b
Find:
Unique solution to ax = b in G
x is log b
a
Eve Bob
Alice
Example: (10) = 4
1, 3, 7, 9
Example: (7) = 6
1, 2, 3, 4, 5, 6
If n is prime, (n) = n-1
RSA keys
Choose 2 large primes, p and q
N = pq
(N) = (p-1)(q-1)
Choose e < N such that gcd(e, (N))=1
d such that ed = 1 mod (N)
c = me mod N m = cd mod N
Bob
Alice
Toy example
p=7, q=11
N=77
(N) = (6)(10) = 60
Bob chooses e=17
Uses extended Euclidean algorithm to find
inverse of e mod 60
Finds d=53
http://xkcd.com/538/