91.561 Project 1 (Due
March 31 midnight)
Write a client-server program using socket API to implement
RSA as follows:
- Let n = 3407 x 6917. The server uses it to create an RSA system (i.e., e and d) upon requests from clients.
- The
client asks the server for his RSA parameter (n, e) and generates a pseudo
random number r < n, encrypts n, and sends the encrypted number to the server.
- The
server decrypts the cipher and obtains r.
In this project, you will need to implement the followings:
- Euclid’s algorithm, to
find e such that e is relatively prime to φ(n).
- Fast
exponentiation algorithm
- Euler’s
theorem to find d such that d is an inverse of e mod n.
- BBS to
generate a pseudo random number. Since a random sequence generated using
BBS may not be an integer, you need to make it to an integer. A simple way
to do so is to add 1 at the beginning if the first digit in the sequence
generated by BBS is 0. That is, if BBS generates 011001, then use 1011001
as the random number. For convenience, let p = 1223 and q = 5003.
- Master-slave
concurrent server program on the server program to handle multiple
requests.
The C language is preferred, although Java is acceptable.