Question: Manipulate the given python code to provide plaintext message. Use the given ciphertext, key, and IV in the code and provide the output plaintext message.

Manipulate the given python code to provide plaintext message. Use the given ciphertext, key, and IV in the code and provide the output plaintext message.

Ciphertext: d7caaefcc4734c1dc1889697fea7e9a6624c065337b7203111ecb06ce5b3f9dc8f750914890ba9a6b2c8f8d4c9b62fbf7c08c1d43d08027ef969971608ce331425735a8aa42cef854c227e3f75b2e3cea5b59776f265b1500fc425f615 a42e66f891924a712e2d5102df9ec8b9846833a49b040d23958deb3da3a354 b8eb3d7f

Key: f08c84258b8a11cec37509d5400bc10?

IV: 60828d2030c2154f8b88d368078b31a?

The question mark in the key and IV stands for the missing hex character, which is to be found out using looping in python. Please provide the plaintext message and the final python code as answer to this question.

Python Code:

from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad #from Crypto.Random import get_random_bytesb from binascii import unhexlify, hexlify

#place secret message here data = b'Secret Message goes here'

# generate a random key and IV #key = get_random_bytes(16) #iv = get_random_bytes(16)

# load a defined random key and IV key = unhexlify('deadbeefdeadbeefdeadbeefdeadbeef') iv = unhexlify('0123456789abcdeffedcba9876543210')

# Available Modes are: # AES.MODE_ECB (does not require an IV) # AES.MODE_CBC # AES.MODE_CFB # AES.MODE_OFB # AES.MODE_CTR

# Create an AES object called cipher1 cipher1 = AES.new(key,AES.MODE_CBC, iv) # Encrypt the message with padding ct = cipher1.encrypt(pad(data,16)) # Print the ciphertext in hexadecimal format print("Ciphertext (in hex) ", hexlify(ct))

# Create another AES object this time called cipher2 cipher2 = AES.new(key,AES.MODE_CBC, iv) # Decrypt the previously encrypted message (ct) pt = unpad(cipher2.decrypt(ct),16) # Print out the original message, showing it did not change print('Plaintext message: ', pt)

# Asset will ensure the statement is true # or the program will fail hard assert(data==pt)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!