2

I'm using RijndaelManaged to encrypt and decrypt data. I may well have misunderstood the point of an initialization vector, but I am finding that if I set it to a different value when decrypting my data, all but the first 16 characters are still decrypted correctly. Is that expected behaviour?

matthewk
  • 1,841
  • 17
  • 31

1 Answers1

3

Yes. In CBC mode each cyphertext block is used as the IV for the next cyphertext block. Using a faulty IV will mess up the first 16 byte block, but subsequent blocks will be unaffected. This can be a useful property as it allows error recovery after a faulty block, which can be important in some situations. It also illustrates why it is not really necessary to keep the IV secret (unlike the key!).

rossum
  • 15,344
  • 1
  • 24
  • 38