6
$\begingroup$

I am using AES to encrypt my data. I have only 128 bit block that I am encrypting using AES. I am using AES in CTR (counter) mode, since it is always to advisable to use block ciphers along with modes of operation… but I think this is generally the case when you have more than one block of data.

Should I also be using AES in Counter mode to encrypt a single block? And does AES of single block in CTR mode enhance my confidentiality?

$\endgroup$
  • $\begingroup$ What is the entropy of your input ? (i.e. what do you want to encrypt: random strings? fixed strings?) $\endgroup$ – Ruggero Dec 13 '16 at 15:32
  • $\begingroup$ @Ruggero fixed strings $\endgroup$ – Infinity Dec 13 '16 at 17:10
  • $\begingroup$ Symmetrically encrypting small data makes no sense: if you can securely transmit the key, you can just as well securely transmit the data. $\endgroup$ – fkraiem Dec 14 '16 at 5:49
9
$\begingroup$

Even though you are only encrypting one block at a time, think about what would happen if your input data happens to be the same as a previous encryption. Even though you are encrypting the blocks days or weeks apart, plain encryption (aka ECB mode) would have the same problems as usual. Counter/CBC/... are designed to avoid that problem. If you know the input data won't repeat (sequence number, etc. as part of your data) then you won't have the repeating blocks problem of ECB where identical plaintext, when encrypted with the same key, always outputs the same ciphertext.

$\endgroup$
4
$\begingroup$

The generic advice, which is more likely applicable than not, is that you should use something that provides both authenticity and confidentiality. Since neither ECB (or equivalently your "modeless" single-block encryption), CBC nor CTR provide authenticity, then the likely answer is that you should not use any of those, at least not by themselves. You should use an authenticated encryption algorithm.

Also, if you're thinking about modes of operation, there's a good chance that you're looking at your problem a the wrong level of abstraction. Your application wants an (authenticated) encryption algorithm; a block cipher is technically an encryption algorithm, but practically it should be seen as a building block that a cryptographer uses to design such algorithms. You shouldn't be thinking what block cipher mode should you use, but rather, what library for your language provides a set of secure and hard-to-misuse cryptographic algorithms.

See Bernstein, Lange and Schwabe's paper on the design of the NaCl library for an exposition of this philosophy.

$\endgroup$
3
$\begingroup$

If you use each key just for one block of data, ECB mode (i.e. just plain block cipher) would be acceptable.

But then the next developer comes around and adds a second block of data, and forgets to choose a suitable mode of operation.

So better just start with a safe mode of operation. (Also, don't forget a MAC, or use a mode of operation which includes one.)

$\endgroup$

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.