CS574 Spring 2008

* --------------------------------------------------------------------- *

Assignment #1


The assignment will be to write a program that will encrypt and decrypt a stream of bytes using the RSA algorithm.

There are three parts to this assignment:

Part 1:

Generate an RSA keypair, with at least one key > 1000. Implement the "KeyObject" interface.

Part 2:

Using the keypair generated in part 1, encrypt or decrypt a stream of characters, chunked into 3-byte blocks. Use a nonce to defend against a codebook attack. Implement the "RSAAlgorithm" interface.

Part 3:

Implement the CBC Block cipher mode. Implement the BlockMode interface. (Implementations of the BlockCipher interface will not be tested; an implementation will be provided to your code in my tests.)

Constraints:

The program shall be written in Java WITHOUT using any of the crypto classes, or any third-party support libraries. When in doubt, consult with the instructor first. If you need something outside of the java.lang, java.io, java.math, and java.util packages, doubt.

The program shall be able to be compiled and run on rohan without modification. Work where you like.

The program shall use the specified interfaces and directory structure, as provided by your instructor. The template for the project (and the interfaces) can be found at:

http://www-rohan.sdsu.edu/~stremler/CS574/assignments/AS1_Template.tar
or
http://www-rohan.sdsu.edu/~stremler/CS574/assignments/AS1_Template.jar

The program shall be turned in using the script provided by the instructor, to be run on Rohan.

Rules:

Your code does NOT have to worry about acquiring sufficient entropy or randomness. Using the java.util.Random class is good enough.

Assume that you're only encrypting single-byte characters, not 16-bit Java chars.

The turned in material will ONLY be text files; turning in binary or non-printable files will be taken as an attempt to subvert the grading process, and you may be penalized, up to and including an automatic failure for the assignment.

Every source file will include a comment header at the top of the file that provides your name, the class number, the semester, an assignment identifier, and the name of the file.

Your code should be commented appropriately.

Your code should be formatted properly; use either spaces or tabs for indentation, but not both. Choose a reasonable right margin.

Suggestions:

Use a version-control system (CVS, RCS, Mercurial, etc.) for all of your code. Start using it early, and check in frequently. There's no better defense against suspicions of cheating than a history of development. If you can, use rohan for your repository, as rohan has a regular backup schedule.

Test your code. Write your own unit tests. JUnit is pretty easy to use; once you have a template in place, adding new tests is easy.

Look at the build.xml file. There are places where you can modify and extend its functionality.

Interfaces:

The interfaces you should be coding and compiling against are provided in the tar file.

Documentation for the interfaces can be found here: http://www-rohan.sdsu.edu/~stremler/CS574/assignments/AS1_Docs/

Updates

* --------------------------------------------------------------------- *
$Id: AS1.html,v 1.7 2008/03/22 05:44:32 stremler Exp stremler $