Once in a great while (rairly) I recieve the following exception upon decrypting data using TripleDES in my web application: 'Length of the data to decrypt is invalid'.
Stack Trace: at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) at System.Security.Cryptography.CryptoStream.FlushFinalBlock() at EncryptionOperations.Transform(Byte[] input, ICryptoTransform CryptoTransform) at EncryptionOperations.Decrypt(String text) at MyAppName.Page_Load(Object sender, EventArgs e)
I have done some research and the only thing I found similar reccomends converting to and from Base64String when encrypting and decrypting. I do that in my code, here Public Function Encrypt(ByVal text As String) Go to the complete details ...