I see plenty of answers for what and how to use IV. But is it important to keep the IV saved for decryption? I would think so, but I haven't seen anyone saying anything about this.

If you want a specific encryption for this to be about then AES-256-CBC


Yes, you do need to save the IV. In CBC mode, the IV is XORed with the first block of data before encryption in order to prevent leakage of information about the plaintext, specifically whether the first block of two ciphertexts using the same key also start with the same plaintext. You are correct in your belief that you will not be able to decrypt your data correctly without it.

  • Alternatively, add a garbage block to the beginning of the data and discard it upon decryption. – Andrew Hoffman Nov 26 '14 at 14:15

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.