SyrupPayJose.Jwa.Alg.AesWrapEngine.AesDec C# (CSharp) Method

AesDec() private static method

private static AesDec ( byte sharedKey, byte cipherText ) : byte[]
sharedKey byte
cipherText byte
return byte[]
        private static byte[] AesDec(byte[] sharedKey, byte[] cipherText)
        {
            using (Rijndael aes = Rijndael.Create())
            {
                aes.Key = sharedKey;
                aes.Mode = CipherMode.ECB;
                aes.Padding = PaddingMode.None;

                using (MemoryStream ms = new MemoryStream())
                {
                    using (ICryptoTransform decryptor = aes.CreateDecryptor(aes.Key, aes.IV))
                    {
                        using (CryptoStream cs = new CryptoStream(ms, decryptor, CryptoStreamMode.Write))
                        {
                            cs.Write(cipherText, 0, cipherText.Length);
                            cs.FlushFinalBlock();

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