

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


In this programming assignment you will implement the RSA protocol for asym- metric cryptography. As part of this project you will implement algorithms re- lated to cryptography, i.e. finding prime numbers, performing arithmetic of large integers, fast exponentiation, encryption, decryption. (NO you are not allowed to use libraries (for example, for cryptography-related functions or arithmetic of large integers); however, you are more than welcome to read, but not duplicate, already existing code.) After you implement your RSA algorithm, you will send to your TA (chris- [email protected]) your public key (e, N ). Make sure that e is small, 3 or 5 should suffice, certainly keep e < 10. We will decide the exact format of the email later so that Christos can reply easily/quickly. We will use your public key to encrypt a particular phrase K and send to you the encrypted message. You will have to use your private key d to retrieve the phrase K. You will submit the decrypted K, your code, and write a very short report with your observations.
You will generate a pair of public and private keys. The size of these keys should be 8 bytes (128 bits). (The most significant bytes of p and q should not be zero.) Thus, you will need to implement algorithms that generate random numbers of 8 bytes (use the random number generators supported by your programming environment) and test for primality. Then, you will implement the RSA encryption and decryption schemes. Your algorithms should be able to take as input an array of bytes and output an encrypted/decrypted array of bytes. You should answer the following questions:
Most of the programming languages have libraries that implement the re- quired functionality (e.g. BigInteger in Java). For extra credit you should imple- ment the required functionality using these libraries and compare your results. (In general it is good to use these libraries to get a feeling of the work involved and to test your code.) To some extend, in this project you will implement your own big integer library (and RSA)!
Please follow the following instructions as closely as possible: