public static string EncryptAES(this string input, string password) { if (password.Length > 16) { password = password.Substring(0, 16); } else { StringBuilder sb = new StringBuilder(); for (int i = password.Length; i < 16; i++) { sb.Append("*"); } password += sb; } byte[] inputbytes = Encoding.UTF8.GetBytes(input); byte[] passbytes = Encoding.UTF8.GetBytes(password); if (passbytes.Length > 17) { Array.Resize(ref passbytes, 16); } byte[] outbytes = Cipher.AES_EncryptByte(inputbytes, passbytes, DefaultIV); return(Convert.ToBase64String(outbytes)); }