2023-02-16 276
我们正在使用ASP.NET成员资格提供商进行用户注册并登录新网站.我们的旧系统加密的用户密码,以便我们可以根据需要恢复它们.
我在弄清楚是否可以使用ASP.NET成员资格函数来简单地加密密码时遇到了很多麻烦
对此的文档是不存在的.
我知道如何配置web.config将其存储为加密ALA
PasswordFormat =”加密”提供商中并在MachineKey中分配验证Keke,但是似乎仍然被哈希(尽管它是很好的加密).无论哪样
谢谢!
以可回收格式存储密码是一个非常糟糕的主意.如果您可以恢复它们,那么任何闯入服务器的人都可以.
最好使用标准哈希+盐方法并拥有密码重置机制来处理用户忘记密码的情况.
您需要使用passwordformat =”加密”而不是passwordformat =” hashed”.然后,您可以使用 MemberHippRovider的解密方法必要时解密密码.
Imports System.Web.Security
Public Class PasswordRecovery
Inherits SqlMembershipProvider
Public Function GetDecryptedPassword(ByVal password As String) As String
Try
Dim _encodedPassword() As Byte = Convert.FromBase64String(password)
Dim _bytes() As Byte = DecryptPassword(_encodedPassword)
If _bytes Is Nothing Then
Return ""
Else
Return System.Text.Encoding.Unicode.GetString(_bytes, &H10, _bytes.Length - &H10)
End If
Catch ex As Exception
Throw New Exception("Error decrypting password.", ex)
End Try
End Function
End Class
以上所述是小编给大家介绍的如何?在ASP.NET中加密和解密用户会员密码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!
原文链接:https://77isp.com/post/33882.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态