Esempio n. 1
0
        private static byte[] AESECBDecrypt(byte[] key, byte[] data)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                using (var aes = Util.GetAesProvider())
                {
                    aes.Mode    = CipherMode.ECB;
                    aes.Padding = PaddingMode.None;

                    using (CryptoStream cs = new CryptoStream(ms, aes.CreateDecryptor(key, new byte[0x10]), CryptoStreamMode.Write))
                    {
                        cs.Write(data, 0, data.Length);
                        cs.FlushFinalBlock();

                        return(ms.ToArray());
                    }
                }
            }
        }