using System.Security.Cryptography;
public static void Main()
string testStr = "3980523";
byte[] Key = new byte[]{0x8e, 0xe8, 0x00, 0xaa, 0x09, 0xc8, 0xc2, 0x04, 0xf3, 0x14, 0x92, 0x8a, 0x5a, 0x9a, 0x09, 0x3a, 0x6f, 0xa9, 0x67, 0x1e, 0x7e, 0x7f, 0x8f, 0x93, 0x1d, 0x11, 0xc1, 0x0e, 0x11, 0xf2, 0xcc, 0x9e};
byte[] IV = new byte[]{0x8e, 0xe8, 0x00, 0xaa, 0x09, 0xc8, 0xc2, 0x04, 0xf3, 0x14, 0x92, 0x8a, 0x5a, 0x9a, 0x09, 0x3a};
byte[] ret = Program.Encrypt(testStr, Key, IV);
string retBase64 = Convert.ToBase64String(ret);
Console.WriteLine(retBase64);
Console.WriteLine(Program.Base64Encode(retBase64));
public static string Base64Encode(string plainText) {
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
public static byte[] Encrypt(string plainText, byte[] Key, byte[] IV)
using (AesManaged aes = new AesManaged())
ICryptoTransform encryptor = aes.CreateEncryptor(Key, IV);
using (MemoryStream ms = new MemoryStream())
using (CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write))
using (StreamWriter sw = new StreamWriter(cs))
encrypted = ms.ToArray();