Basic AES decryption problem
I'm working through the book Cryptography Engineering, and the current problem goes something like this:
Using an existing cryptography library, decrypt the following ciphertext (in hex form):
539b333b39706d149028cfe1d9d4a407
with the following 256-bit key (also in hex):
8000000000000000000000000000000000000000000000000000000000000001
using AES.
I'm a little stumped here. I'm using OpenSSL, but using the -aes256
parameter asks for an IV which clearly isn't given in this problem. Putting in all zeros for the IV yields bad decryption. Attempting to use some other AES encryption methods didn't get me much further. I may be in over my head here, but just trying to learn how this stuff works for fun. I'm a video game programmer so this is all new to me. Any assistance with this textbook problem would be greatly appreciated!
Note: I've done the exhaustive Stack Overflow and Google searches, but wasn't making any headway after about an hour.
Solution 1:
Since no mode of operation is specified, and since the ciphertext length equals the size of one AES cipher block (128 bits = 32 hex digits = 16 bytes), it seems likely that you're expected to use the raw block cipher (a.k.a. "ECB mode").
You can, in fact, do this using openssl enc. The options you'll need are -aes-256-ecb
, which will select the AES-256 cipher in ECB mode, and -nopad
, which will turn off message padding.*
Of course, you'll also first need to convert the ciphertext from hex into raw bytes. (You can use the -K
option to supply the key directly in hex.) The output plaintext will not be printable ASCII, but converting it back into hex should reveal a clear pattern.
*) In fact, your plaintext does happen to end in valid PKCS#7 padding, so openssl will happily decrypt it even without -nopad
. However, I'm assuming that this is just a coincidence.