Net6下加密类过期更新
1. warning SYSLIB0021: “DESCryptoServiceProvider”已过时:“Derived cryptographic types are obsolete. Use the Create method on the base type instead.”
var des = new DESCryptoServiceProvider(); 修改为:using var des = DES.Create();
2. warning SYSLIB0021: MD5CryptoServiceProvider”已过时:“Derived cryptographic types are obsolete. Use the Create method on the base type instead.
MD5 md5 = new MD5CryptoServiceProvider(); 修改为: using MD5 md5 = MD5.Create();
3. warning SYSLIB0021: “SHA1Managed”已过时:“Derived cryptographic types are obsolete. Use the Create method on the base type instead.”
var hash = new SHA1Managed(); 替换为: using var hash = SHA1.Create(); 其他类似: SHA256.Create(); SHA512.Create();
4. “RNGCryptoServiceProvider”已过时:“RNGCryptoServiceProvider is obsolete. To generate a random number, use one of the RandomNumberGenerator static methods instead.”
RandomNumberGenerator.GetInt32(Int32) RandomNumberGenerator.Create()
5. warning SYSLIB0022: “RijndaelManaged”已过时:“The Rijndael and RijndaelManaged types are obsolete. Use Aes instead.”
var rDel = new RijndaelManaged(); 替换为 using var rDel = Aes.Create("AesManaged")
记得都加上using及时释放资源!!
using
__EOF__

本文链接:https://www.cnblogs.com/pccai/p/16341573.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战