Hi all,
We are creating sample application for windows mobile using Rijndael algorithm. Its working fine. But the problem is when we decrypt the data there is a 8 bit padding up on the right side of the value for the example, we are encrypting a Unique key for transaction and it looks like this :
Before encryption: MI03112009044625000000000000008024754008
After Decryption: MI03112009044625000000000000008024754008揞⑁㋬㓠⥳空⠜資
can anyone help on this right padding happening in the original value.
Code: Encryption:
byte[] inputData = System.Text.Encoding.Unicode.GetBytes(inputDataString);
MemoryStream stream = new MemoryStream();
CryptoStream cStream = new CryptoStream(stream, RijndaelAlg.CreateEncryptor(key, value), CryptoStreamMode.Write);
cStream.Write(inputData, 0, inputData.Length);
cStream.Close();
Decryption:
MemoryStream stream = new MemoryStream(outputData);
CryptoStream cStream = new CryptoStream(stream, RijndaelAlg.CreateDecryptor(key, value), CryptoStreamMode.Read);
cStream.Read(outputData, 0, outputData.Length);
cStream.Close();
byte[] decryptedData = stream.ToArray();
return System.Text.Encoding.Unicode.GetString(decryptedData, 0, decryptedData.Length);
Is there any other solution for this? Because we cant get the original data length
Geetha