Computer and Network Security

advertisement
Computer and Network Security
Exercise #1: RSA Programming
Liran Katzir
Dr. Ron Rymon
Purpose: Hands-on experience implementing an encryption algorithm.
Statement of Work: Follow the RSA specification to implement a fully-functional utility
for encrypting and decrypting messages. You must use Java for this exercise. The
exercise shall be submitted in groups of 2-3 students. However, I highly recommend that
each student implement the main functions on his/her own. The due date is May 10.
Submissions by May 3 will receive a 10% bonus. Late submissions will be penalized
2/100 points per day.
Files:
 ex1.RsaAlgorithm – an interface you will need to implement.
 ex1.RsaImplTest – this class has a main method you can run to test you
implementation.
 ex1.RsaKey – an interface you need to implement ex1.RsaAlgorithm.
 ex1.RsaKeyImpl - a simple implementation of ex1.RsaKey you can use (You can
avoid using it if you really want to).
 ex1.ReferenceRsa – a reference implementation of ex1.RsaAlgorithm,
ex1.RsaImplTest uses this class to test your implementation.
 ex1.RsaAlgorithmSingleton – a singleton class that holds an instance of your
implementation.
 doc.zip – holds the javadoc output of these files.
What you need to submit:
 A class named ex1.RsaAlgorithmImpl that implements ex1.RsaAlgorithm, This
implementation must NOT use the BigInteger class.
 Any class that you want except classes that are named as one of the input files,
e.g. do not submit a class named ex1.RsaAlgorithmSingleton.
 You must include brief programmer documentation, indicating the main classes,
functions and interfaces.
 Please submit a hardcopy of the source code + docs in class on the due date, or in
the class immediately after the electronic submission.
Remark:
 Any ex1.RsaAlgorithmImpl implementation using BigInteger is not acceptable.
 Liran's implementation is about 500 lines, so if your program is > 2500 lines you
are probably doing something wrong.



Your implementation does not have to be fast, it just has to work in a reasonable
amount of time.
You are not tested for speed and complexity, BUT exhaustive search
implementation will get a lot less credit.
Your class must be name “ex1.RsaAlgorithmImpl” so that ex1.RsaImplTest.main
will work correctly since it uses name convention reflection to obtain an instance.
Submission: Please submit electronically (compressed!) to lkatzir@idc.ac.il:
Important: Please follow the course website for updates of this document. We will post
clarifications and answers to common questions.
Good Luck!
Frequently Asked Questions
1. You may implement your own MyBigInteger using only “basic” java command and
classes, explicitly not using BigInteger nor extending BigInteger. Of course your
implementation can include only a limited number of methods.
2. p and q are limited to 2^32 n and e and d are limited 2^64 therefore the steps for
finding p, q, n, e, and d are limited long (if you are using modulo after each “small”
computation).
3. The time for finding 1000 primes took my program 500ms (my project
implementation) if your implementation takes a couple of minutes you are doing
something wrong, like not using modulo after each squaring.
Download