Is it safe to encrypt twice with AES, with any mode? Are any combinations of AES, e.g. AES with XTS and AES with CBC, or twice with AES and XTS, more unsafe than just having it encrypted once?

I know CBC isn't very safe in many applications, but the question is if the security somehow becomes degraded if combined in any manner.

In more realistic settings this could apply to having an encrypted root partition, and then running an encrypted virtual machine inside of that encrypted file system.

As a specific example, LUKS for Linux, standard settings. You encrypt it twice, once for your root file system, and once for your guest VM, another Linux system with LUKS.

Is the VM then less safe than it otherwise would have been if it was only encrypted once, i.e. with the host system not being encrypted?

1 Answer 1


Is it safe to encrypt twice with AES, with any mode?

As long as you don't mess anything up in the implementation, the security should be at least as good as the least secure encryption. An example of such a mis-implementation (suggested by the comment) would be if you accidentally encrypted twice with AES-CTR mode using the same key and same IV (this is a mis-implementation since the IV must never be repeated with the same key). Such a mis-implementation and repeated application would result in the "double encryption" just returning the plain text.

You might expect much more security (for example if you use two different keys), but this is not always the case due to attacks like the "meet-in-the-middle" attack.

For example, the encryption algorithm "2DES" is two applications of DES with different keys, but there is a meet-in-the-middle attack on 2DES. This is is why people used 3DES, but nobody used 2DES.

  • As another example, encrypting the same thing twice with the same key in CTR mode will result in no encryption at all... (fortunately in OP's case the keys should be derived with unique salts even if the same passphrase is used) Jun 7, 2019 at 1:22

You must log in to answer this question.

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