php这边当如何写,才能解密.net来的链接参数????
using System;
using System.Security.Cryptography;
using System.IO;namespace fseip.App_Code
{
/// <summary>
/// DESEncode 的摘要说明。
/// </summary>
public class DESEncode
{
/// <summary>
/// 字串加密
/// </summary>
/// <param name="strText">需要加密的文本内容</param>
/// <returns>加密后的密文</returns>
public string Encrypt(string strText)
{
string strEncrKey="FSOA's key";
Byte[] byKey = {};
Byte[] IV  = {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};
try
{
byKey = System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(0, 8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
Byte[] inputByteArray  = System.Text.Encoding.UTF8.GetBytes(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
return Convert.ToBase64String(ms.ToArray());
}
catch(Exception ex)
{
return ex.Message;
} } /// <summary>
/// 字串解密
/// </summary>
/// <param name="strText">需解密的密文</param>
/// <returns>解密出来的原文</returns>
public string Decrypt(string strText)
{
string strDecrKey="FSOA's key";
Byte[] byKey  = {};
Byte[] IV = {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};
Byte[] inputByteArray = new byte[strText.Length];
try
{
byKey = System.Text.Encoding.UTF8.GetBytes(strDecrKey.Substring(0,8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
inputByteArray = Convert.FromBase64String(strText);
MemoryStream  ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
return encoding.GetString(ms.ToArray());
}
catch(Exception ex)
{
return ex.Message;
}
}
}
}