Increasing the diffusion of the AES-CBC encryption algorithm in pycrypto for python

324 views Asked by At

When encryption is done using the AES-CBC algorithm, the encryption can be thought of as chaining the cipher texts with the previous ones and an IV. However, if its on CBC mode, we give our cipher text forward diffusive properties (i.e. if we change but i in our cipher, plaintext is change for all blocks after that). To make malleability attacks harder, one can chain the cipher texts during encryption on both directions (or implement something similar as in the bitLocker paper).

Does anyone know if there a implementation of pyCrypto that provides a chaining of the cipher texts using both direction?

One way that I thought of solving this was getting the original cipher text, reversing it using python and then feed it to pyCrypto. However, this seemed a little brute force because the whole point of pyCrypto is to take advantage of their C level implementation (while reversing a string would introduce a obvious unfortunate performance hit).

1

There are 1 answers

0
Maarten Bodewes On

No, as far as I know there are no modes in pyCrypto that do this. This strong diffusion of the plaintext after an error in the ciphertext is called error propagation. Error propagation is nowadays not considered that important anymore; if you want to provide integrity of the plaintext then you add a MAC (say, HMAC) over the ciphertext instead, or you use an authenticated cipher (which basically provides integrity on top of confidentiality). Unfortunately I didn't see any authenticated cipher modes in pyCrypto.