Keeping the key and IV safe when AES256 encrypting publicly known data I am encrypting some publicly known data, and some private data using the same key, using AES256 with CBC.

An attacker does not have the ability to choose what the public data is.

Is this safe?  (It looks to be, according to: Why is AES resistant to known-plaintext attacks?)

Assume I encrypt 4096_zeros.plain (public data) and my_private_data.plain with the same key and iv, producing 4096_zeros.crypt and my_private_data.crypt.

Is it possible for an attacker to use 4096_zeros.crypt to speed up either:


the decryption of my_private_data.crypt, or
the recovery of the key and iv.


Is using (and storing) a different iv for each file sufficient?  (Am I correct in thinking that I'd need to store the iv with the encrypted data?)

If not, would adding 32 random bytes to the start of each file (which would be ignored after decrypting) be sufficient?
Take a look at this article it explains the IV can be publicly known once you have encrypted your data.


  Is using (and storing) a different iv for each file sufficient? (Am I
  correct in thinking that I'd need to store the iv with the encrypted
  data?)


Yes, as a matter of fact i would not recommend using an IV twice, just for safety.


  Is this safe? (It looks to be, according to: Why is AES resistant to known-plaintext attacks?)


Yes, like the article says they would still have to bruteforce the key to get the cipher text

So there is no problem in doing this, though if data is public why would you encrypt it? everyone knows it, why go through all the trouble?

Use a MAC, to quote the page i linked to:


  Altering the IV Before Decryption
  
  If the adversary can alter the IV, without detection, before the
  ciphertext is decrypted, then they can corrupt the first block of
  plaintext. If the adversary knows the first block of plaintext is P
  and the original IV is OIV, and wants it to decrypt to Z, they can
  alter the IV to be P XOR Z XOR OIV, which will cause the first block
  to decrypt to Z (since (P XOR OIV) XOR (P XOR Z XOR OIV) = Z).
  
  Encryption provides secrecy, not authentication or integrety. If
  encryption is used in a setting where the adversary can modify the IV
  or ciphertext, it must be authenticated. The right way to do this is
  to have the sending party apply a keyed Message Authentication Code
  (MAC), like HMAC, to the IV and ciphertext, and have the receiving
  party check that the MAC is correct before decrypting.