CSPspEmu.Core.Crypto.Kirk.DecryptAes C# (CSharp) Method

DecryptAes() public static method

public static DecryptAes ( byte Input, byte Key, byte IV = null ) : byte[]
Input byte
Key byte
IV byte
return byte[]
        public static byte[] DecryptAes(byte[] Input, byte[] Key, byte[] IV = null)
        {
            if (IV == null) IV = new byte[16];

            Logger.Notice("DecryptAes({0}, {1}, {2})", Input.Length, Key.Length, IV.Length);

            using (var AES = Aes.Create())
            {
                AES.Padding = PaddingMode.Zeros;
                var Decryptor = AES.CreateDecryptor(Key, IV);

                int DataSize = Input.Length;

                if ((DataSize % 16) != 0)
                {
                    var Input2 = new byte[MathUtils.NextAligned(Input.Length, 16)];
                    Array.Copy(Input, Input2, Input.Length);
                    Input = Input2;
                }

                return new CryptoStream(new MemoryStream(Input), Decryptor, CryptoStreamMode.Read).ReadBytes(DataSize);
            }
        }

Same methods

Kirk::DecryptAes ( byte Key, byte Input, byte Output, int Size ) : void