4
$\begingroup$

I am working with this black box cryptography scheme. I know the plain text, cipher text, and everything else except how they whiten the data (or key?). Everything is 128 bit, 16 bytes.

I have two keys, one is the called the 'WhiteningKey' and the other is called the 'AESKey.' If I set the 'WhiteningKey' to zero bytes, then I can encrypt/decrypt data using AES-ECB and get the correct encrypted data (matches the ciphertext from the black box output). I think there is either an inverse s-box or something else because to decrypt data I encrypt it and vise versa. My crypto library does not support inverse s-box so I have yet to test this, but I also thought about it being AES-CFB, with the IV being the 'WhiteningKey.'

I have heard of XEX (XOR-ENCRYPT-XOR) and I don't think this would be how it incorporates the whitening because if you look at null byte blocks they are not the same (prevents replay) (note that they are the same if whitening key is null).

I do not think it would be CBC (or similar modes where whitening key is the IV) because the system needs random access read/writes. And to my current knowledge you have to encrypt/decrypt all prior blocks to obtain current plain/cipher text block.

Here is some data I collected that I used AES-128-ECB to reproduce results from black box:

Whitening Key: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

AES-128-ECB Key: 74 50 74 60 E3 89 52 57 43 17 8D 9A 75 38 04 6E

plain text: 4E 4E 44 5E 00 00 D8 1E 00 00 01 00 00 04 00 00

cipher text: 2D 68 D9 8E 2C 06 6E 56 D1 8F B2 78 43 2B A7 23

Here is some data I collected from the black box where I do not know how the whitening key is incorporated into the algorithm (blocks 2 is right after block 1, they are consecutive):

Whitening Key: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55

AES Key: 74 50 74 60 E3 89 52 57 43 17 8D 9A 75 38 04 6E

plain text 1: 4E 4E 44 5E 00 00 D8 1E 00 00 01 00 00 04 00 00

plain text 2: 07 60 00 00 78 2B 16 02 81 30 0D 49 C2 32 F1 45

cipher text block 1: 05 D2 AB 98 31 A8 DD 3F 7F 04 1B B5 17 74 68 B6

cipher text block 2: BE DB D3 8A A9 D3 80 4E FE EE DA 57 71 83 0F 74

Example of me encrypting data and an actual dump of encrypted memory.

All this makes me ask: How can I find or reverse engineer the whitening in an AES algorithm? Is there a general approach to do so?

$\endgroup$
  • $\begingroup$ Why do you only supply single block plaintext / ciphertext? If you want to establish a mode I'd try at least two blocks. $\endgroup$ – Maarten Bodewes Nov 6 '16 at 23:56
  • $\begingroup$ @MaartenBodewes I just edited the post, thank you that makes sense. The whitening key could possibly be altered after each block encryption but I do not know how it is derived or applied. $\endgroup$ – John Nov 7 '16 at 0:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.