首页 > 代码库 > DecryptData
DecryptData
public static byte[] DecryptData(byte[] fileArry)
{
//MemoryStream inStream = new MemoryStream(fileArry);
MemoryStream inStream = new MemoryStream();
inStream.Write(fileArry, 0, fileArry.Length);
long a = inStream.Position;
inStream.Seek(0, SeekOrigin.Begin);
long b = inStream.Position;
MemoryStream outStream = new MemoryStream();
//inStream.Seek(0, SeekOrigin.Begin);
outStream.SetLength(0);
byte[] bin = new byte[tempLenth];
long rdlen = 0;
long totlen = fileArry.Length;
int len;
DES des = new DESCryptoServiceProvider();
CryptoStream encStream = new CryptoStream(outStream, des.CreateDecryptor(desKey, desIV), CryptoStreamMode.Write);
while (rdlen < totlen)
{
len = inStream.Read(bin, 0, tempLenth);
encStream.Write(bin, 0, len);
rdlen = rdlen + len;
}
outStream.Close();
encStream.Close();
//
byte[] outArry = outStream.ToArray();
//outStream.Close();
return outArry;
}
DecryptData