public void Decrypt(Stream cipherStream, Stream Stream, byte[] iv)
        {
            var alg = Create();

            alg.IV = iv.Clone() as byte[];
            using (var decryptor = alg.CreateDecryptor(alg.Key, alg.IV))
                using (var crypto = new CryptoStream(cipherStream, decryptor, CryptoStreamMode.Read))
                {
                    crypto.ScanAndWriteTo(Stream, BufferSize);
                }
        }
示例#2
0
        public void Decrypt(Stream cipherStream, Stream Stream, byte[] iv)
        {
            var alg = InnerCreateAlgorithm();

            if (Mode == CipherMode.ECB)
            {
                alg.IV = EmptyIV;
            }
            else
            {
                alg.IV = iv.Clone() as byte[];
            }

            using var decryptor = alg.CreateDecryptor(alg.Key, alg.IV);
            using var crypto    = new CryptoStream(cipherStream, decryptor, CryptoStreamMode.Read);
            crypto.ScanAndWriteTo(Stream, BufferSize);
        }