![]() |
#2
qw11617485792013-12-16 10:47
|
public void JIEMI(string strDESKey,string strCipher,string strDESIV)
{
byte[] bytesDESKey = ASCIIEncoding.ASCII.GetBytes(strDESKey);//密匙
byte[] bytesSDESIV = ASCIIEncoding.ASCII.GetBytes(strDESIV);//向量
byte[] bytesCipher = ASCIIEncoding.Unicode.GetBytes(strCipher);//密文
DESCryptoServicePrvoider desDecrypt = new DESCryptoServicePrvoider();
MemoryStream msDecrypt = new MemoryStream(bytesCipher);
CryptoStream csDecrypt = new CryptoStream(msDecrypt, desDecrypt.CreateDecryptor(bytesDESKey, bytesDESIV), CryptoStreamMode.Read);
StreamReader srDecrypt = new StreamReader(csDecrypt);
string strPlainText = srDecrypt.ReadLine();
srDecrypt.close();
csDecrypt.Close();
msDecrypt.Close();
return strPlainText;
}