2023-02-16 359
我需要匹配由存储在aspnet_membership表中的用户和安全答案输入的安全答案.
我不想使用ResetPassword(“securityAnswer”)方法来验证用户.
是有没有办法加密输入的安全答案或解密存储的安全答案.
谢谢.
将输入的sec ans转换为字节数组/
Dim bytes As Byte() = Encoding.Unicode.GetBytes(secAns)
/这非常初始化将密钥转换为基本64字符串以获得原始磁带密码./
Dim src As Byte() = Convert.FromBase64String(key)
/*Concatenate sec ans and hash key*/
Dim dst As Byte() = New Byte(src.Length + (bytes.Length - 1)) {}
Buffer.BlockCopy(src, 0, dst, 0, src.Length)
Buffer.BlockCopy(bytes, 0, dst, src.Length, bytes.Length)
/*Create algo object for SHA1*/
Dim algorithm As HashAlgorithm = HashAlgorithm.Create("SHA1")
/*Compute hash value of concatenated ans and key*/
Dim inArray As Byte() = algorithm.ComputeHash(dst)
/*Convert hashed ans back to string*/
Dim hashedAns As String = Convert.ToBase64String(inArray)
我知道这是一种旧的….但我无法获得这个问题的任何帖子答案来工作,但我通过试验和错误来解释,”安全答案”是存储类似于如何存储密码(如果您有密码设置为哈希).我能够使用以下帖子对密码的答案来完成上述原始问题的目标:
ASP.NET Membership C# – 如何比较现有密码/散列
我刚刚使用数据库中的密码中的盐,它像魅力一样工作.希望这有助于别人留出他们的头发.
无法解密存储在成员资格表中的安全答案.
您可以哈希答案您收到的答案,然后将其与存储在数据库中的哈希值进行比较.
对于那个使用 formsauthentication.hashpasswordforstoringinconfigfile ..
以上所述是小编给大家介绍的Asp.net会员-如何明确地匹配安全答案?,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持!
原文链接:https://77isp.com/post/34050.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日
扫码二维码
获取最新动态