I am new to this whole encryption thing. I am creating a program to send some information to a vendor of ours. The problem I am running into is that they require that no padding be applied to the input. From my understanding this cant be achieved using CBC (unless the data is always a multiple of the block size - 256)? Does this mean I need to use a different cipher mode to be able to do this with .NET or how should I go about this? It needs to be encrypted with AES 256 (both key and block size) with no IV.
What are my options to be able to do this?
string[] keyArray = key.Split(','); //key is string 32 numbers 45,-12,...
sbyte[] sBytes = new sbyte[keyArray.Length]; for (int i = 0; i < keyArray.Length; i++) { sBytes[i] = Convert.ToSByte(keyArray[i]); } byte[] bytes = (byte[])(Array)sBytes; RijndaelManaged tdes = new RijndaelManaged(); tdes.Key = bytes; tdes.BlockSize = 256; tdes.KeySize = 256; tdes.Mode = CipherMode.CBC; tdes.Padding = PaddingMode.None; ICryptoTransform crpyt = tdes.CreateEncryptor(); byte[] userData = Encoding.UTF8.GetBytes(userId); byte[] dateData = Encoding.UTF8.GetBytes(currentTime); byte[] userCipher = crpyt.TransformFinalBlock(userData, 0, userData.Length); byte[] dateCipher = crpyt.TransformFinalBlock(dateData, 0, dateData.Length); string encryptedUser = Convert.ToBase64String(userCipher); string encrpytedDate = Convert.ToBase64String(dateCipher); string url = baseURL + "username="+ encryptedUser + "×tamp="+ encrpytedDate; Response.Redirect(url);