コード例 #1
0
        /// <summary>
        /// Decrypt an chunk of data
        /// </summary>
        /// <param name="data">
        /// Data that you want to decrypt (expected format is 4 bytes which
        /// corresponds to the IV length, the IV iteself, and then the data to decrypt)
        /// </param>
        /// <returns>Decrypted data</returns>
        public byte[] Decrypt(byte[] data)
        {
            using (var ms = new MemoryStream())
            {
                using (var aes = new AESDecryptStream(_key, ms, false))
                {
                    aes.Write(data, 0, data.Length);
                }

                return(ms.ToArray());
            }
        }
コード例 #2
0
        /// <summary>
        /// Decrypt an chunk of data
        /// </summary>
        /// <param name="data">
        /// Data that you want to decrypt (expected format is 4 bytes which 
        /// corresponds to the IV length, the IV iteself, and then the data to decrypt)
        /// </param>
        /// <returns>Decrypted data</returns>
        public byte[] Decrypt(byte[] data)
        {
            using (var ms = new MemoryStream())
            {
                using (var aes = new AESDecryptStream(_key, ms, false))
                {
                    aes.Write(data, 0, data.Length);
                }

                return ms.ToArray();
            }
        }