/// <summary> /// AES算法加密 /// </summary> /// <param name="plainText">需要加密的字符串</param> /// <param name="key">密匙</param> /// <returns>加密后的Base64字符串</returns> /// <exception cref="System.ArgumentNullException">参数为空时,导致异常.</exception> public static string AesEncrypt(this string plainText, string key) { // Check arguments. if (plainText == null || plainText.Length < 1) throw new ArgumentNullException("plainText"); if (key == null || key.Length < 1) throw new ArgumentNullException("Key"); // Return the encrypted base 64 string from the memory stream. return plainText.AesEncrypt(key, "www.allyn.com.cn"); }
/// <summary> /// AES算法加密 /// </summary> /// <param name="plainText">需要加密的字符串</param> /// <param name="key">密匙</param> /// <returns>加密后的Base64字符串</returns> /// <exception cref="System.ArgumentNullException">参数为空时,导致异常.</exception> public static string AesEncrypt(this string plainText) { // Check arguments. if (plainText == null || plainText.Length < 1) throw new ArgumentNullException("plainText"); // Return the encrypted base 64 string from the memory stream. return plainText.AesEncrypt("*****@*****.**"); }