Reference no: EM132212089
Question :
You are to write programs to encrypt (and decrypt) data using symmetric encryption and MAC. For encryption you should use the 32 bit encryption program provided and if you want a hash, use a 32-bit hash function.
Step 1: Design a method to compute a MAC. You can use the standard HMAC function nor design your own. If you have a "keyed MAC", use the same key that you use for encryption
Step 2: Create two files one containing ASCII text and one containing binary data. Both files should be exactly 1024 bytes long. A binary file is provided here, you can choose to use it or create your own. Do step 3 and 4 for both files, separately.
Step 3: Read the 1024 byte file into a 1024 byte buffer called plain_buff (in memory). Encrypt plain_buf (and add MAC) and put the result into cipher_buff. Note that cipher_buf will be larger than plain_buff. There will be one MAC for the entire buffer. Same key is used for encryption and MAC.
Step 4: Decrypt the data cipher_buff and put the result into decr_buff. Check the MAC to ensure the decryption was fine. Also double check that the data in plain_buff and decr_buff are identical. Once you are done with the above do the following experiments:
1. Can you decrypt cipher_buff with a wrong key? Do you get a hash mismatch?
2. Can you modify and cipher_buf and decrypt with correct key?
3. Can you, in any way, modify cipher_buff and decrypt with any key that results in a successful MAC verify.
4. Assume you do not know the key used for encryption and MAC. Can you brute force and decrypt cipher_buff and get correct decryption (without any assumptions about the data type in the original plain_buff.
SUBMIT : A short report explaining what you did and how is good enough, or a pseudocode. Code isn't really needed. Pseudocode doesn't need to be in any specific language, just a brief description will do.