3
$\begingroup$

If you have 4 16-byte blocks of plaintext to encrypt does each block have a different 128 bit original key? Or do they all use the same?

$\endgroup$
7
$\begingroup$

TL;DR no it doesn't use different keys for each block; the key stays the same. AES has been designed to be able to encrypt many blocks with the same key.


AES is a block cipher. As a block cipher it can only encrypt / decrypt (or permute) one block of plaintext / ciphertext at a time. How you encrypt 4 concatenated blocks of plaintext isn't specified by AES. So in that sense it is impossible to answer your question.

Generally the block cipher AES is however used in a block cipher mode of operation such as CBC. These modes of operation take an already keyed block cipher as parameter. So in a mode of operation the key stays the same. This also goes for the derived sub-keys or round keys that are calculated during initialization of the block cipher that performs the key schedule.

In principle you could create a mode that uses different keys for each block encrypt (probably using some kind of calculation to calculate each "block key" from a key seed). That would however require you calculate the key schedule for each block. Furthermore, it would likely allow related key attacks, to which at least AES-256 is susceptible.

Proposing such a mode during a crypto conference is probably not advisable.


If the 16 byte blocks are separate messages then it is of course also possible to use the same key. If you're not concerned about leaking information about equality of the plaintext then you can also simply use the block cipher directly.

The modes of operation specified for block ciphers such as CBC, GCM (and so on) also work for smaller messages. Note that you need to use an IV if you want to reuse the key for most modes of operation. Using an IV is required for modes of operation that provide CPA security.

If you want to use different keys then that's also possible, for instance by deriving keys from a master key using a KDF.

$\endgroup$
1
$\begingroup$

You may use the same key, but you need to use different (unique) IV (initialization vector).

There are multiple encryption modes to encrypt multiple blocks using the same key.

$\endgroup$
  • $\begingroup$ The question is asking about encrypting multiple blocks with the same or different keys, not encrypting multiple files (which is where an IV is relevant). Suggesting to use a unique IV for every block encrypted with the same key is nonsensical. $\endgroup$ – forest Aug 1 '18 at 2:16

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.

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