日期:2014-05-17 浏览次数:20828 次
/// <summary>
/// 解密文件内容
/// </summary>
/// <param name="infile">传入的待解密的文件路径</param>
/// <param name="decryptKey">string decryptKey = "12345768";</param>
/// <param name="Keys">byte[] Keys = new byte[] { 83, 40, 69, 40, 56, 39, 50, 74 };</param>
/// <returns></returns>
public string DecryptorMethod(string infile, string decryptKey, byte[] Keys)
{
string str = "";
if (infile != string.Empty)
{
try
{
using (FileStream stream = new FileStream(infile, FileMode.Open, FileAccess.Read))
{
DESCryptoServiceProvider provider = new DESCryptoServiceProvider();
byte[] bytes = Encoding.UTF8.GetBytes(decryptKey);
byte[] rgbIV = Keys;
ICryptoTransform transform = provider.CreateDecryptor(bytes, rgbIV);
using (CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Read))