public SymmetricEncryption(SymmetricAlgorithm Algorithm)
{
if(Algorithm.Mode != CipherMode.CBC) {
throw new Exception("SymmetricEncryption requires the symmetric algorithm to use CBC.");
}
rng = new RNGCryptoServiceProvider();
_sa = Algorithm;
// We take care of PKCS7 padding here due to issues in the underlying implementations...
_sa.Padding = PaddingMode.None;
BlockSizeByte = _sa.BlockSize / 8;
// Match the same size as our Window size...
_decryptors = new Brunet.Collections.Cache(64);
_enc_iv = new byte[BlockSizeByte];
rng.GetBytes(_enc_iv);
_enc = _sa.CreateEncryptor(_sa.Key, _enc_iv);
_temp = new byte[BlockSizeByte];
}