本文介绍了Asp.net身份密码哈希的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的ASP.net身份项目带来一些有益的code和接口的网站安全。要使用接口(而不是使用标准的实体框架实现包含在MVC 5模板)实现自定义系统中的 IPasswordHasher 是必需的。

在ASP.net身份

IPasswordHasher 接口

 命名空间Microsoft.AspNet.Identity
{
    公共接口IPasswordHasher
    {
         字符串HashPassword(字符串密码);
         PasswordVerificationResult VerifyHashedPassword(字符串hashedPassword,串providedPassword);
    }
}

是否有可能在ASP.net身份和通过该接口使用密码对盐更安全的加密?


解决方案

Yes, the interface is provided for the new implementation of PasswordHasher already present in Core framework.

Also note that the default implementation is already using Salt+Bytes.

After creating custom PasswordHasher (say MyPasswordHasher), you can assign it to UserManager instance like userManager.PasswordHasher=new MyPasswordHasher()

See one example of such IPasswordHasher

For implementing alternate system from EF,- You shall implement all Core interfaces.- IPasswordHasher implementation is not required. PasswordHasher is already provided in Core framework as it's implementation.

这篇关于Asp.net身份密码哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 20:53