我正在加密文本并通过 QueryString 发送它。
"8ZnSq13yv2yYVDsehDnNUNp/yIFqsAQh4XNPbV1eLMpk/dMWpc/YnMMEBy29MlgcYqpV2XPOf/Rpiz5S85VN/fkLbGTCkL/clBHh983Cp s="
解密函数如下
public static string Decrypt(string stringToDecrypt)//Decrypt the content
{
try
{
byte[] key = Convert2ByteArray(DESKey);
byte[] IV = Convert2ByteArray(DESIV);
int len = stringToDecrypt.Length;
byte[] inputByteArray = Convert.FromBase64String(stringToDecrypt);
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(key, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
Encoding encoding = Encoding.UTF8; return encoding.GetString(ms.ToArray());
}
catch (System.Exception ex)
{
throw ex;
}
}
我应该怎么做才能解决这个问题?