MATH 250 Project #2 RSA Cryptography Due: Wednesday, March 10 This project is to familiarize you with the RSA encryption algorithm. You have two options for this project - programming, or non-programming. You only need to do one of the options. Option 1: Programming Write a program to implement the RSA algorithm for cryptography. (Refer to Section 4.5 of your text for details of the algorithm.) Set up: 1) Choose two large primes, p and q. (There are a number of sites on-line where you can find large primes.) 2) Compute n = p* q, and = (p-1)(q-1). 3) Select an integer e, with 1 < e < , gcd(e, ) = 1. (You could either write an algorithm to test gcds, or you could just calculate it by hand.) 4) Compute the integer d, 1 < d < such that ed 1 (mod ). The numbers e and d are called inverses (mod ). To do this, I suggest two possibilities – i) research the BigInteger class in Java. It has a method to compute inverses modulo a specified number. (It also has other methods that would be useful!) Or, ii) Look up the Extended Euclidean Algorithm. This is an algorithm to find d. Save this number d in a constant or variable. 5) Make n and e public. (Send them to me as a pair (n, e). I will expect that the first component is the modulus, and the second is the exponent.) Encryption should do the following: 1) Convert the message into numbers, using the ASCII representation for characters. (For example, in ASCII, A = 65, B = 66, … , space = 32, period = 46. You may find an ASCII table online.) 2) Obtain the public key (n, e) of who you want to send a message to. (You should choose yourself for testing purposes. Then try mine.) 3) Encipher each letter (now a number, say m) by computing c me (mod n). Remember, you don’t want to directly compute the exponentiation. You should either program the method of repeated squaring, or look at what the BigInteger class offers. 4) Send the encrypted text to the specific person. (You may want to just print this to the screen, then you can copy and paste into an email to send.) Decryption should do the following: 1) When you receive a string of numbers, such as 1743 452 625, use your private key d to compute 1743d (mod n), 452d (mod n) and 625d (mod n). This n is from your public key. 2) Take the results of these and translate back into letters, using the same scheme as above. Option 2: Non-Programming You will become more familiar with the mathematics behind the algorithm, and will research some applications where and how RSA is currently being used. 1) Each person who participates in an RSA system chooses large primes p and q, then computes n = p*q and = (p-1)(q-1). They then choose an integer e, with 1 < e < , and gcd(e, ) = 1. Next they compute the integer d, 1 < d < such that ed 1 (mod ). Research the Extended Euclidean Algorithm to find out how to find d. Explain how the algorithm works, and then work exercise 21 in Section 4.5 to demonstrate how RSA works. (You must show all work.) Cite any references used! 2) Prove the following two theorems. You must cite any reference sources you use! Theorem 1: Suppose r1, r2, …r is a set of integers such that gcd(ri, n) = 1 for each i, 1 i , and ri rj (mod n) for i j. If a is a positive integer with gcd(a, n) = 1, then ar1, ar2, …, ar is also a set of integers such that gcd(ari, n) = 1 for each i, 1 i , and ari arj (mod n) for i j. Theorem 2 (Euler’s Theorem): If n = p*q is a positive integer and a is an integer with gcd(a, n) = 1, then a 1 (mod n), where = (p-1)(q-1). 3) One of the beauties of RSA is that once the encryption key e has been chosen and the decryption key d has been determined, we have med m (mod n). Show how Euler’s Theorem can be used to get this result in RSA by working through exercise 35 in Section 4.5. 4) Do some research on how and where RSA cryptography is currently being used. Write several pages discussing applications that use RSA, any limitations involved in using RSA, and what size numbers need to be involved to keep it secure. You must cite any sources used!