I have a .mat file which contains 10 plaintexts and 10 ciphertexts which are correctly encrypted with AES-128 algorithm. It also contains 10 more ciphertexts which are wrongly encrypted. The fault is that there is a bitflip in every byte at the input of the last subbyte operation. I also have every single step of AES-128 (encryption/decryption) algorithm in matlab code. My goal is to find the cipherkey.

Here are some tips I got, but still I can't find a way to complete my task:

You can calculate the cipherkey byte per byte cause the last round (subbyte, shiftrows, addroundkey) does modify each byte separately. You can ignore the shiftrows operation cause it does only affect the position. What you have to do is: you guess the key byte, calculate back to the input of the last subbyte operation for both the correct and the faulty ciphertext. Now you can compare them both and check whether the guess of the keybyte was good (think about what characteristics they should have when comparing them). Maybe you have to use multiple pairs of ciphertexts to find one key-byte. After you found the keybyte you can repeat this for all 15 other key-bytes.

I will also attach a screenshot of the result I get loading the .mat file.

Do you have any ideas on what to do with the code in order to find the cipherkey?

Thanks in advance for your help.

  • $\begingroup$ By every step do you just mean that you have AES implemented in MatLab or do you mean you have the internal values while encrypting each of the plaintexts? $\endgroup$ – Thomas M. DuBuisson Jan 22 '17 at 16:07
  • $\begingroup$ @ThomasM.DuBuisson I have the whole AES implemented in matlab. Both encryption and decryption. Thanks in advance $\endgroup$ – MPA Jan 22 '17 at 16:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.