Csc466/566 Computer Security Midterm Exam Cheat-Sheet
Csc466/566 Computer Security Midterm Exam Cheat-Sheet
1
1. The inverse of x in Zn exists when A.8 Elgamal Encryption
GCD(n, x) = 1.
• Bob (Key generation):
• Calculate GCD(n, x) = (1, i, j) such that
1 = ix + jn. Then (ix + jn) mod n = 1. Pick a prime p.
ix mod n = 1 and i is x’s multiplicative in- 2. Find a generator g for Zp .
verse in Zn . 3. Pick a random number x between 1
and p − 2.
4. Compute y = gx mod p.
A.6 RSA
– PB = (p, g, y) is Bob’s RSA public key.
• Bob (Key generation):
– SB = x is Bob’ RSA private key.
1. Generate two large random primes p
and q. • Alice (encrypt and send a message M to
2. Compute n = pq. Bob):
3. Select a small odd integer e relatively 1. Get Bob’s public key PB = (p, g, y).
prime with φ(n). 2. Pick a random number k between 1
4. Compute φ(n) = (p − 1)(q − 1). and p − 2.
5. Compute d = e−1 mod φ(n). 3. Compute the ciphertext C = (a, b):
– PB = (e, n) is Bob’s RSA public key. a = gk mod p
– SB = (d, n) is Bob’ RSA private key.
b = M y k mod p
• Alice (encrypt and send a message M to
• Bob (decrypt a message C = (a, b) received
Bob):
from Alice):
1. Get Bob’s public key PB = (e, n).
1. Compute M = b(ax )−1 mod p.
2. Compute C = M e mod n.
• Bob (decrypt a message C received from Al- A.9 RSA Signature Scheme
ice):
• Bob (Key generation): As before.
1. Compute M = C d mod n.
– PB = (e, n) is Bob’s RSA public key.
– SB = (d, n) is Bob’ RSA private key.
A.7 Diffie-Hellman Key Exchange
• Bob (sign a secret message M ):
1. All parties (set-up):
1. Compute S = M d mod n.
(a) Pick p, a prime number. 2. Send M, S to Alice.
(b) Pick g, a generator for Zp .
• Alice (verify signature S received from
2. Alice: Bob):
(a) Pick a random x ∈ Zp , x > 0. 1. Receive M, S from Alice.
(b) Compute X = gx mod p. ?
2. Verify that M = S e mod n.
(c) Send X to Bob.
3. Bob: A.10 Elgamal Signature Scheme
(a) Pick a random y ∈ Zp , x > 0. • Alice (Key generation): As before.
(b) Compute Y = gy mod p.
1. Pick a prime p.
(c) Send Y to Alice
2. Find a generator g for Zp .
4. Alice computes the secret: K1 = Y x mod p. 3. Pick a random number x between 1
5. Bob computes the secret: K2 = X y mod p. and p − 2.
2
4. Compute y = gx mod p.
– PA = (p, g, y) is Alice’s RSA public
key.
– SA = x is Alice’ RSA private key.
• Alice (sign message M and send to Bob):
1. Pick a random number k.
2. Compute the signature S = (a, b):
a = gk mod p
b = k−1 (M − xa) mod (p − 1)