Notes and Requirements for AES CTR/CBC Implementations
- You are assumed to use Java. Before
submitting your programs, upload to your unity account and test. Make sure
they can make and run.
- Submit 3 files
Your program should take three
arguments: mode, IV, and key. Mode could be either "enc", which
stands for encryption, or "dec", which stands for decryption. IV
and key are strings to be converted into the initialization vector and the
- AESCTR.java -- AES
- AESCBC.java -- AES
- Submit a make file with your programs.
When make is typed, all class files should be produced
Use "UTF8" encoding for the IV and the key. This means that you can use, for example, IVString.getBytes ("UTF-8") to get the byte value for the IV.
Assume the plaintext
is stored in a file named "plain-in" for encryption, and store the
ciphertext in a file named "cipher-out". Similarly, for decryption,
assume the cipher text is in a file named "cipher-in", and store
the plaintext in a file named "plain-out".
For example, you may use the following command to encrypt the plaintext in
a file named "plain-in" and store the ciphertext in a file named
"cipher-out", using IV 1234567887654321 and key 8765432112345678.
java AESCTR enc 1234567887654321 8765432112345678
java AESCBC enc 1234567887654321 8765432112345678
- Padding: Simply pad 0's to fill in the last block. That is, if the last
block is already full, do nothing. If the last block doesn't have 16 bytes,
repeatedly put byte 0 until you have 16 bytes. Assume you don't have byte 0
in the plain text. During decryption, simply remove bytes with value 0 from
- Use AES/ECB/NOPadding as the transformation. Use doFinal or update method
to encrypt/decrypt each block.
- You should test your program before submission. At least make sure you can
get the plaintext back. Also check with TA's test vectors.
- In the CTR mode, the IV can be represented as a 16 byte array IV. Assume IV as the most significant byte and IV the least significant byte. In other words, each time you increment IV, add one to IV and process the other bytes appropriately.
- Grading. If your program can
run, you get 6 basic points. You get 7 points for correct execution of AESCTR, and another 7 points for that of AESCBC.
- Submission: You need to submit your 3 files online through the "Submit
Download test vectors.
Please direct all questions about the text vectors to the TA.