public GenericCbcModeCryptoTransform(IGenericBlockCipher cipher, bool forEncryption, byte[] iv)
{
if (cipher == null)
throw new ArgumentNullException("cipher");
if (iv == null)
throw new ArgumentNullException("iv");
if (iv.Length != cipher.BlockSize)
throw new ArgumentException("IV length " + iv.Length + ", expected " + cipher.BlockSize);
_cipher = cipher;
_blockSize = cipher.BlockSize;
_encrypting = forEncryption;
_originalIV = (byte[])iv.Clone();
_currentIV = new byte[_blockSize];
Reset();
}