I am trying to Encrypt / Decrypt data to use in the Querystring.
Most of the time, the encrypted data ends with the "equal" symbol '='
The following are some examples of encrypted string
1 - LS07D43u6Hs=
2 - oHPgq6hz0A0=
3 - 4ugeuARQvXw=
abc - gZfrQVAk9Ic=
encode me - RfSQYXX1P4MU7LhMsfsG8w==
I copied the codes from here and changed a bit.
http://www.deltasblog.co.uk/code-snippets/basic-encryptiondecryption-c/
byte[] inputArray = UTF8Encoding.UTF8.GetBytes("encode me");
TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider();
tripleDES.Key = UTF8Encoding.UTF8.GetBytes("abcd123456Idlaaz");
tripleDES.Mode = CipherMode.ECB;
tripleDES.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = tripleDES.CreateEncryptor();
byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length);
tripleDES.Clear();
Response.Write(Convert.ToBase64String(resultArray, 0, resultArray.Length));
I tried to change the Key, PaddingMode, CipherMode, but no luck. It always return = at the end. Please help me.