C# .net 加密与解密 DES
具体.net的C#程序里是这样的:估计是加密还是解密:publicstaticstringToDecrypt(stringPlainStr){stringstr="";t...
具体.net的C#程序里是这样的:估计是加密还是解密:
public static string ToDecrypt(string PlainStr)
{
string str = "";
try
{
byte[] buffer = Convert.FromBase64String(PlainStr);
MemoryStream stream2 = new MemoryStream();
DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
CryptoStream stream = new CryptoStream(stream2, provider.CreateDecryptor(Encoding.Default.GetBytes("40000000"), Encoding.Default.GetBytes("爱拓无痕")), CryptoStreamMode.Write);
stream.Write(buffer, 0, buffer.Length);
stream.FlushFinalBlock();
str = Encoding.Default.GetString(stream2.ToArray());
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
Exception exception = exception1;
Interaction.MsgBox("您的授权不正确,请联系作者是!", MsgBoxStyle.Information, "提示");
ProjectData.EndApp();
ProjectData.ClearProjectError();
}
return str;
}
求解。 展开
public static string ToDecrypt(string PlainStr)
{
string str = "";
try
{
byte[] buffer = Convert.FromBase64String(PlainStr);
MemoryStream stream2 = new MemoryStream();
DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
CryptoStream stream = new CryptoStream(stream2, provider.CreateDecryptor(Encoding.Default.GetBytes("40000000"), Encoding.Default.GetBytes("爱拓无痕")), CryptoStreamMode.Write);
stream.Write(buffer, 0, buffer.Length);
stream.FlushFinalBlock();
str = Encoding.Default.GetString(stream2.ToArray());
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
Exception exception = exception1;
Interaction.MsgBox("您的授权不正确,请联系作者是!", MsgBoxStyle.Information, "提示");
ProjectData.EndApp();
ProjectData.ClearProjectError();
}
return str;
}
求解。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询