C# - AES Encrypt
input: string message, string keycode
output: string BASE64String
using System.Security.Cryptography;
RijndaelManaged aesCipher = new RijndaelManaged();
ASCIIEncoding textConverter = new ASCIIEncoding();
Byte[] iv;
aesCipher.KeySize = 128;
aesCipher.BlockSize = 128;
aesCipher.Mode = CipherMode.ECB;
aesCipher.Padding = PaddingMode.Zeros;
aesCipher.Key = textConverter.GetBytes(keycode);
ICryptoTransform crypto = aesCipher.CreateEncryptor();
Byte[] toEncrypt = textConverter.GetBytes(messg);
Byte[] cipherText = crypto.TransformFinalBlock(toEncrypt, 0, toEncrypt.Length);
String base64Str = "";
base64Str = Convert.ToBase64String(cipherText);
output: string BASE64String
using System.Security.Cryptography;
RijndaelManaged aesCipher = new RijndaelManaged();
ASCIIEncoding textConverter = new ASCIIEncoding();
Byte[] iv;
aesCipher.KeySize = 128;
aesCipher.BlockSize = 128;
aesCipher.Mode = CipherMode.ECB;
aesCipher.Padding = PaddingMode.Zeros;
aesCipher.Key = textConverter.GetBytes(keycode);
ICryptoTransform crypto = aesCipher.CreateEncryptor();
Byte[] toEncrypt = textConverter.GetBytes(messg);
Byte[] cipherText = crypto.TransformFinalBlock(toEncrypt, 0, toEncrypt.Length);
String base64Str = "";
base64Str = Convert.ToBase64String(cipherText);