I am trying to encrypt a string with AES 128 encryption, using CBC mode, with Zero Padding. Sadly, i do not know how to do this, as many attempts have gone unsuccessful. I have code in C# and was wondering whether anyone can help me getting my encryption working. the code:
`using System;
using System.Security.Cryptography;
using System.Text;
using System.IO;
byte[] request = UTF8Encoding.UTF8.GetBytes("{string which needs encrypting}");
byte[] key = UTF8Encoding.UTF8.GetBytes("{key}");
byte[] iv = UTF8Encoding.UTF8.GetBytes("{iv}");
AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
aes.Key = key;
aes.IV = iv;
aes.Mode = CipherMode.CBC;
aes.Padding = PaddingMode.Zeros;
ICryptoTransform cTransform = aes.CreateEncryptor();
byte[] result = cTransform.TransformFinalBlock(request, 0, request.Length);
aes.Clear()
string encryptedRequest = Convert.ToBase64String(result, 0, result.Length);`
ive looked a common crypto, but i cannot see an option to CBC mode [i dont know cccrypto much anyways, maybe i overlook?] thanks;