注册 登录
编程论坛 C# 论坛

这段代码错在那里啦?

dreamhouse 发布于 2013-12-12 15:45, 565 次点击
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;
}
1 回复
#2
qw11617485792013-12-16 10:47
string strPlainText = srDecrypt.ReadLine();
srDecrypt被引用不能Close
1