通过下面的一个方法输出了一个字符串sss
public static string DecodeAES(byte[] byKey, byte[] byIV, string data)
{
AesCryptoServiceProvider cryptoProvider = new AesCryptoServiceProvider();
cryptoProvider.BlockSize = 128;
cryptoProvider.Mode = CipherMode.ECB;
cryptoProvider.Padding = PaddingMode.Zeros;
byte[] byEnc;
try
{
byEnc = Convert.FromBase64String(data);
}
catch
{
return null;
}
MemoryStream ms = new MemoryStream(byEnc);
CryptoStream cst = new CryptoStream(ms, cryptoProvider.CreateDecryptor(byKey, byIV), CryptoStreamMode.Read);
StreamReader sr = new StreamReader(cst);
string sss = sr.ReadToEnd();
return sss;
然后
string mysss = System.Web.HttpUtility.UrlDecode(sss,Encoding.Unicode);
Response.Write(mysss);
得到的是乱码,如下,请问如何才能正确得到正常的字符串,谢谢
貌似AES的解密。但没看到调用。