I am implementing an log-structured file system and want to encrypt a series of blocks by using the .NET Cryptography namespace. I've chosen the Aes symmetric encryption, created the key and the initial, random Initialization Vector.
So far so good, using the ICryptoTransform
returned by SymmetricAlgorithm.CreateEncryptor()
it is possible to encrypt the individual blocks.
To enable "random access" retrieval at decryption time, the intermediate initialization vectors need to be stored alongside with the encrypted blocks.
But I can't see a way to extract the intermediate IVs? They must be stored in the instance that implements the encryption algorithm, but - as I can see - the current IV is not accessible.
Of course, this limitation can be circumvented by generating random IVs, or by misusing encrypted data to encrypt the next block in the chain. But this feels like a hack due to the fact the that block chaining is supported in most of the symmetric algorithms which - as I assume - are just reusing the resulting vector from the previous block's encryption.