The objective of this lab is to explore the different modes of operation of block ciphers by implementing 5 of the modes.
Write a program that encrypts a given plaintext file with the given key. The program gets the name of the file that contains the key, name of the file that contains the plaintext, and a prefix for the names of the file containing the ciphertexts from the command line. The program will encrypt the plaintext file in the 5 modes below using 128-bit AES and produce a file for each mode below.
4. CFB (128-bit)
5. CTR (counter starts with 0)
After producing the 5 ciphertext files, the program will decrypt these files and store the decrypted texts in 5 separate files. NoteCBC,OFB, and CFB modes require an initialization vector (IV). Use the SecureRandom class in Java to generate the IVs. Note that you need to keep these IVs for decryptions in modes CBC, CFB, and OFB.
So, if the program is run by
encrypt key.txt plain.txt cipher
then the program will produce 10 files :
Note that at the end of a successful run, the files cipherECBdec.txt, cipherCBCdec.txt, cipherOFBdec.txt, cipherCFBdec.txt, cipherCTRdec.txt will all contain the same data which will be the pliantext that you started with. The plaintext will be given in hexadecimal one block per line. You can assume that each line will have 32 hex digits (hence you will NOT need to do any padding.)
Plain text file:
Recently Asked Questions
- Suppose that a government raises taxes and government purchases by equal amounts. a) What happens to the interest rate and investment in response to this
- When is a negative cash balance reported on the balance sheet?
- Prior to the modern way of software development programmers spent an awful lot of time in coming up with just a simple software. further to this, the outcomes