private static void Decrypt(string sourceFile, string targetFile, IEncryptorFactory factory) { using (Stream stream = new FileStream(sourceFile, FileMode.Open)) using (Stream writer = new FileStream(targetFile, FileMode.Create)) using (var encryptStream = new CryptoStream(stream, factory.CreateDecryptor(), CryptoStreamMode.Read)) { encryptStream.ReadInto(writer); } }