Asp.net 身份哈希安全吗?

2023-12-23

我在以下 url 中引用了以下网站的 Rijndael 和 Asp.net 哈希实现。

  1. 莱因达尔 -如何使用密码生成 Rijndael KEY 和 IV? https://stackoverflow.com/questions/6482883/how-to-generate-rijndael-key-and-iv-using-a-passphrase
  2. Asp.net 哈希 -ASP.NET Identity 默认密码哈希器,它是如何工作的并且安全吗? https://stackoverflow.com/questions/20621950/asp-net-identity-default-password-hasher-how-does-it-work-and-is-it-secure

在这两个实施中, 以下用于获取密码的随机字节。RijnDael

Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(password, SALT);

Asp.net 身份哈希

Rfc2898DeriveBytes bytes = new Rfc2898DeriveBytes(providedPassword, salt, HasingIterationsCount)

在上述代码之后,RijnDael 对返回的字节应用加密。 但 asp.net 身份复制结果,因为它与盐字节数组一样,并返回散列键。

这里我有一个困惑。 RijnDael 和 Asp.net 身份哈希使用相同的Rfc2898DeriveBytes.

当 RijnDael 可以解密加密密钥(这是在 Rfc2898DeriveBytes 的帮助下完成)时,为什么我们可以解密 Asp.net Identity 哈希密钥?

有可能这样做吗? Asp.net 身份安全吗?


是的,ASP.NET 的密码散列方法是安全的。

在您提供的示例中,用户正在使用加密技术称为高级加密标准(AES,也称为 Rijndael)。这就是秘密可以被解密的原因。

用户仅使用Rfc2898DeriveBytes类以获得key https://en.wikipedia.org/wiki/Key_%28cryptography%29 and an 初始化向量 https://en.wikipedia.org/wiki/Initialization_vector.

该类不用于散列秘密消息。加密就是隐藏消息。

ASP.NET 使用Rfc2898DeriveBytes类来哈希密码。此过程无法逆转。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Asp.net 身份哈希安全吗? 的相关文章

随机推荐