From a comment:
The problem was gone once i manually set padding to NONE
whats wrong with this code?? VS2010 does compile it, but it gives error when run from VS2010, saying cs.close() padding is not valid, can anyone help? thanks
public static byte[] Decrypt(byte[] cipherData,byte[] Key, byte[] IV)
{
MemoryStream ms = new MemoryStream();
Rijndael alg = Rijndael.Create();
alg.Key = Key;
alg.IV = IV;
alg.Padding = PaddingMode.PKCS7, ;
CryptoStream cs = new CryptoStream(ms,
alg.CreateDecryptor(), CryptoStreamMode.Write);
cs.Write(cipherData, 0, cipherData.Length);
cs.Close();
byte[] decryptedData = ms.ToArray();
return decryptedData;