【问题标题】:What is the impact of appName in DpapiDataProtectionProvider constructorDpapiDataProtectionProvider构造函数中appName的影响是什么
【发布时间】:2016-04-06 09:48:23
【问题描述】:

在我们的IdentityManager 类中,我们有以下行:

protectionProvider = new DpapiDataProtectionProvider("OurProduct");

最后一个参数的含义是什么,它与站点在 IIS 上的设置方式有什么关系吗?

背景: 很长一段时间以来,我们一直在轻松地将具有自定义 IdentityManager 类的 MVC5 站点部署到验证环境,但现在在尝试重置用户密码时遇到以下问题:

System.Security.Cryptography.CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.

以下线程中描述了一些解决方案: Generating reset password token does not work in Azure Website

一切都位于同一台机器上:IIS、Sql Server、Firefox 测试浏览器。

很遗憾,我没有完全掌握这些概念,我正试图弄清楚测试环境是如何变化的,以便在以前从未发生过的情况下触发这个问题?

【问题讨论】:

  • ps。我们通过更改目标机器上的 IIS 设置解决了这个问题。找到应用程序池,打开 Advanced Settings 并将 Load User Profile 更改为 true。我不会用这个作为这个问题的答案,因为那不是问题。

标签: c# asp.net-identity owin


【解决方案1】:

由于我来这里寻找这个并且没有答案,我决定看一下代码。看起来 DataProtector.cs 使用应用程序名称(连同主要用途和特定用途)来创建 SHA 256 哈希。

因为散列是one way street,所以在里面放任何你想要的东西应该是很安全的。我想更复杂会更好,但应用程序的名称应该没问题。

希望这对其他过于偏执的人有所帮助。

【讨论】:

  • 这不是哈希,这是一种加密机制,让您能够解密数据。
  • 我已经有一段时间没有看到这个了。有时间我再看看。
猜你喜欢
  • 1970-01-01
  • 2018-04-26
  • 2018-02-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-04-29
  • 2013-12-16
  • 2012-10-16
相关资源
最近更新 更多