If a part of my data is damaged, corrupted, or deleted, is it then still possible to decrypt the rest of the data if you still have the key?

The situation: a piece of data (something like a document for example) encrypted with AES with a 256-bit key with XTS as the mode of operation.


It depends. (Usual answer to this kind of questions. We would need more details about the data damage to answer)

XTS encryption mode is short for XEX-based tweaked-codebook mode with ciphertext stealing, and XEX stands for Xor-encrypt-xor.

Let's look how the XEX mode is defined: enter image description here (image from wikipedia)

XTS definition changes only how the last block is encrypted, iff the size is not a blocsize multiple.

This mode is a tweakable mode designed to efficient process of consecutive blocks within one data unit. The tweak is represented as a combination of the sector address and index of the block within the sector.

The mode could be defined a tweakable-ECB, so there is no chaining between different blocs. So, you're supposed to recover all sectors that contains no-damaged data. The tweak is given by the sector number and allows to avoid that the same block is encrpyted in the same way if it is stored in different disk sectors, but this mode is deterministic, same data in the same place are always encrypted in the same way.

The problem is that stored and damaged data could be necessary to read the remaining part of the file (a file header, for example).

The ability to decrypt non-damaged sectors is due also to the lack of integrity. Usually if ciphertext has been modified you should not decrypt it at all. And good encryption libraries enforce this binary behaviour.

An image can show how this mode behaves with data modifications: enter image description here (image from this interesting page)

The same page explains how the presence of a diffuser could break your ability to decrypt data for the whole sector even if only a block is damaged. As far as I know neither dm-crypt nor bitlocker implement a diffuser at the present moment.

So, my final answer is that you're able to recover all sectors containing no-damaged data. If damaged data are all in a small portion of the disk you'll recover the rest of the disk woth no problem, but if the damaged data are sparse, you (probably) will not able to read your data.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.