1
Answer

Bad data exception in decryption

Akash Dani

Akash Dani

5y
1.8k
1
I am using TripleDES algoritm for encryption and decryption. When I try to decrypt the value it shows Bad data exception
Is there any way to solve this?

My code:

public string DecryptTripleDES(string CypherText, string key)
{

byte[] inputBuffer = Convert.FromBase64String(CypherText);
return Encoding.Unicode.GetString(PCIDSS.CreateDES(key).CreateDecryptor().TransformFinalBlock(inputBuffer,0, inputBuffer.Length));

Answers (1)