“SymmetricAlgorithm.Create(string)”已过时:“Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead
“SymmetricAlgorithm.Create(string)”已过时:“Cryptographic factory methods accepting an algorithm name are obsolete. Use the parameterless Create factory method on the algorithm type instead
解决方案
改为TripleDES.Create()方法
C# 全选
/// <summary>
/// TripleDES加密
/// </summary>
/// <param name="clearText">明文字符串</param>
/// <param name="key">16位key</param>
/// <param name="iv">8位iv</param>
/// <returns></returns>
public static string TripleDESEncrypt(string clearText, string key, string iv)
{
SymmetricAlgorithm provider = TripleDES.Create();
provider.Key = Encoding.UTF8.GetBytes(key);//16位
provider.IV = Encoding.UTF8.GetBytes(iv);//8位
ICryptoTransform encryptor = provider.CreateEncryptor();
return Encrypt(clearText, encryptor);
}
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网