[an error occurred while processing this directive]
Due May 4, 10 points
In this programming assignment, you will implement decryption with the RSA public key system. You will be modifying two java class files, starting from skeletons that can be accessed from my public directories. After the modifications, you will be able to decrypt a message that I have encrypted.
To set up for this programming assignment, you should copy the directory
~gshute/public/cs5651/pa3
into your own directory hierarchy.
You can do this by logging into a UNIX account, moving into the directory
where you want to create a subdirectory for this programming assignment,
and giving the following command:
cp -r ~gshute/public/cs5651/pa3 .
After you have done this, you will have a new subdirectory named "pa3". If you list the contents of this directory you should see the following files:
To complete this assignment, you will need to add code to both of the .java files and compile them. These files contain "FIXME" comments that indicate where you need to add code and what the added code should do.
When your code is working correctly, you can see the plaintext message by giving the following command:
java Decrypt key.pub < ciphertextIf you want to save the plaintext message you can do so with the following command:
java Decrypt key.pub < ciphertext > plaintext
The "ciphertext" and "key.pub" files contain sequences of big integers encoded in a textual format. The textual format for each big integer is the hexadecimal representation of the number, chopped into lines with no more than 72 digits per line. Each big integer is followed by a blank line.
The BigIntegerReader class provides a read()
method for
reading big integers from files, one at a time.
The Decrypt class just has a main()
method that reads
key modulus and exponent big integers from a key file specified on the
command line, then reads ciphertext big integers from System.in.
All of the big integer reads are done by setting up BigIntegerReader
objects and invoking their read()
methods.
The RSA decryption algorithm is applied to each ciphertext big integer
to get a plaintext big integer.
A plaintext big integers named "plainNumber" can be converted to a
string with the following code:
String plainString = new String(plainNumber.toByteArray());Each of these string is printed to System.out.
The modpow()
method of the java.math.BigInteger class makes
easy work of the RSA decryption algorithm.
You should check the Java documentation for this method to get its
parametrization correct.
You should turn in copies of your modified .java files for the BigIntegerReader and Decrypt classes along with a printout of the output of your program using the provided key and ciphertext. These should be turned in to your TA on or before May 4. This is the last day of lecture for the course.
[an error occurred while processing this directive]