1

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.

1 Answer 1

3

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.

11
  • Interesting! I did try the ecb method (although I forgot to mention it), but the output seemed misleading. It would seem I missed that step of converting it back to hex. What is the preferred way to do that? Commented Aug 15, 2015 at 19:44
  • 1
    Any tool you used to convert the hex into raw bytes should presumably be able to do the reverse, too. Or you could run the output file through a hex dump tool like xxd. Commented Aug 15, 2015 at 19:47
  • It would seem I missed that step as well. Thanks for the info! Commented Aug 15, 2015 at 19:47
  • Wondering if I'm still doing this wrong. This is my command: openssl.exe enc -d -aes-256-ecb -K 8000000000000000000000000000000000000000000000000000000000000001 -in ../Excersizes/AES-decrypt-256bitkey/output.bin -out ../Excersizes/AES-decrypt-256bitkey/plaintext.bin -nopad Without the nopad I get "bad decrypt" Commented Aug 15, 2015 at 20:13
  • 1
    That command looks good to me. How many bytes long is your ciphertext file? And if you do a hex dump of it, does the content look like the hex string in the exercise? Commented Aug 15, 2015 at 20:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .