CS338 Computer Security Monday, 25 September 2023 + Modular arithmetic - Integers - Multiplication - Division + Diffie Hellman steps - Alice comes up with some integers g, p (often chosen from a standard list) x (random, x < p) a = g^x mod p - Alice sends (g, p, a) to Bob - Bob comes up with <-- if Bob doesn't like g, p, he can cancel here y (random, y < p) b = g^y mod p - Bob sends y to Alice - Alice computes b^x mod p = (g^y)^x mod p = g^(xy) mod p <-- K - Bob computes a^y mod p = (g^x)^y mod p = g^(xy) mod p <-- K NOTE: Alice doesn't know y; Bob doesn't know x + RSA encryption - Bob generates p, q (random primes) n = p * q e (with a bunch of properties--check the wikipedia page for details) d (such that e * d = 1 mod (p-1)(q-1)) - Bob publicizes (n, e) (Bob's "public key") - Alice's message m < n - Alice computes c = m^e mod n (the ciphertext; i.e., the encrypted message) - Alice sends c to Bob - Bob computes c^d mod n = ...[math]... = m + Doing the RSA part - I have n and e - Brute-force, factor n into p * q (observe that p and q are prime) - Brute-force, find d with the appropriate property with respect to e, p, and q - For each message block M, compute M^d mod n - Take the resulting decrypted blocks and try to make ASCII characters out of them