1
$\begingroup$

I am developing an application that is going to use AES encryption.

Since it is going to use a different key for every message encrypted...

  • Would it be secure to use a constant IV? (i.e null bytes)
  • Would it be secure to not pad the encrypted message?
$\endgroup$
5
  • 3
    $\begingroup$ I'm not sure what you mean by the second question: padding is either required to make the message a suitable size or it isn't. Key reuse should have nothing to do with it. $\endgroup$
    – otus
    Jan 19 '16 at 15:22
  • 2
    $\begingroup$ Also, the answers to any questions about IV or padding will generally depend on the block cipher mode you're using (as it's the mode, rather than AES, which actually uses the IV/padding). What mode would you be using? $\endgroup$
    – poncho
    Jan 19 '16 at 15:26
  • $\begingroup$ I use CBC. I always thought the padding was added for security reasons. Is that wrong? $\endgroup$ Jan 19 '16 at 15:45
  • 1
    $\begingroup$ @NathanParker AES works on a single block of 16 bytes. A non-streaming mode like CBC works on multiple blocks of 16 bytes. If you want to encrypt some plaintext that is not a multiple of the block size, then you need to pad it to reach a multiple of the block size. PKCS#7 padding for example adds 1 to 16 bytes of padding and each of those bytes' numeric value denotes how many bytes were added, so you can remove them after decryption by looking at the last byte. $\endgroup$
    – Artjom B.
    Jan 19 '16 at 16:06
  • $\begingroup$ Thanks very much mate, I finally understood that. Have a nice day! $\endgroup$ Jan 19 '16 at 16:16

This site is temporarily in read only mode and not accepting new answers.

Browse other questions tagged .