Click here to Skip to main content
15,886,728 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
public string Decrypt(string str)
{
str = str.Replace(" ", "+");
string DecryptKey = "2013;[pnuLIT)WebCodeExpert";
byte[] byKey = { };
byte[] IV = { 18, 52, 86, 120, 144, 171, 205, 239 };
byte[] inputByteArray = new byte[str.Length];

byKey = System.Text.Encoding.UTF8.GetBytes(DecryptKey.Substring(0, 8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
inputByteArray = Convert.FromBase64String(str.Replace(" ", "+"));
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());
}

how to solve the above error Please help.........
Posted
Comments
Bernhard Hiller 22-Oct-13 3:16am    
How did you "encrypt" the data? How does that input string look like?
And that str.Replace(" ", "+") which you do twice seems not useful at all.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900