CSharp examples for System.Security.Cryptography:AES
Aes Decoding
using System.Text; using System.Security.Cryptography; using System.Web; using System.Linq; using System.Collections.Generic; using System;//w ww . j ava 2 s . c o m public class Main{ /// AES decode public static string AesDecoding(string data, string key, Encoding encoding) { var hashMd5 = new MD5CryptoServiceProvider(); byte[] keyArray = hashMd5.ComputeHash(encoding.GetBytes(key)); byte[] toEncryptArray = Convert.FromBase64String(data); RijndaelManaged rijndaelManaged = new System.Security.Cryptography.RijndaelManaged(); rijndaelManaged.Key = keyArray; rijndaelManaged.Mode = CipherMode.ECB; rijndaelManaged.Padding = PaddingMode.PKCS7; ICryptoTransform cTransform = rijndaelManaged.CreateDecryptor(); byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); return encoding.GetString(resultArray, 0, resultArray.Length); } }