1. SET YOUR PADDING METHOD AND MODE EXPLICITLY
If you just want zero's then fine, but be explicit! And do the same on the other side!
If you just want to use the Electronic Code Book (ECB) mode then fine, but spell it out!
2. ALWAYS SET YOUR KEY SIZE AND BLOCK SIZE EXPLICITLY, AND BEFORE SETTING THE ACTUAL KEY OR IV PARAMETERS
This kicked my ass for at least an hour before I tried moving the statements around on in a fit of
3. IF YOU USE RANDOM IV'S (and you should), SAVE AND/OR DISPLAY AND/OR EMBED THEM SOMEWHERE SAFE FOR THE DECRYPTION PROCESS
Your data will never come out looking the same again if you don't know what IV was set before you encrypted it. And I do recommend using an IV (yes an actual, non-null, random or pseudo-random, honest-to-goodness, IV),
private string Decrypt(string B64Key, string B64IV, string B64data)
byte key = Convert.FromBase64String(B64Key);
byte IV = Convert.FromBase64String(B64IV);
byte data = Convert.FromBase64String(B64data);
//AesManaged can be dropped in here if needs be
RijndaelManaged myCrypto = new RijndaelManaged();
myCrypto.BlockSize = 128; // SET FIRST!
myCrypto.KeySize = 192; // SET FIRST!
myCrypto.Key = key;
myCrypto.IV = IV;
myCrypto.Mode = CipherMode.CBC;
myCrypto.Padding = PaddingMode.Zeros;
//change to Create.Encryptor and the function is reusable
ICryptoTransform ict = myCrypto.CreateDecryptor();
byte output = ict.TransformFinalBlock(data, 0, data.Length);
Encoding txtEncoder = new UTF8Encoding();
string result = txtEncoder.GetString(output);
// do post-processing here