带有 ASP.NET 服务帐户的 DPAPI

发布于 2024-08-03 10:55:30 字数 188 浏览 2 评论 0原文

我想在将数据保存到数据库之前对其进行加密。对数据的访问由应用程序控制。因此,具有管理员角色的任何人都应该能够查看数据。我希望能够保护用于加密/解密数据的加密密钥。我不想使用 DPAPI 机器密钥,因为服务器托管多个应用程序。

我想知道是否可以创建一个服务帐户并使用该帐户的登录凭据来加密 web.config 文件中的密钥。

谢谢

I want to encrypt data before saving it to the database. The access to the data is controlled by the application. So anyone with Admin role should be able to see the data. I want to be able to protect the encryption key used to encrypt/decrypt the data. I dont want to use the DPAPI machine key since the server hosts multiple apps.

I was wondering if it is possible to create a service account and use that account's logon credential to encrypt the key in the web.config file.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爺獨霸怡葒院 2024-08-10 10:55:30

好的,答案有点是或否,具体取决于您的堆栈。

如果您托管在 IIS 7 上,那么您应该能够仅使用专用应用程序池并使用新的 LoadUserProfile 功能 - 这将允许 DPAPI 使用用户存储。

IIS 6 没有该功能,因此严格的答案是否定的 - 但 Microsoft 提供了一个很好的示例来说明如何获得类似的最终结果。他们使用服务来进行加密/解密,因为 Windows 服务控制管理器加载用户配置文件(从而允许 DPAPI 工作)。

相当长,但应该可以解决问题:

读起来 microsoft.com/en-us/library/aa302404.aspx#secnetht09_topic2" rel="nofollow noreferrer">构建安全的 ASP.NET 应用程序:身份验证、授权和安全通信

Ok, the answer is kinda yes and no depending on your stack..

If you're hosted on IIS 7 then you should be able to just use a dedicated app pool and use the new LoadUserProfile feature - which will allow DPAPI to make use of the user store.

IIS 6 doesn't have that feature so on that one the strict answer is no - but Microsoft have provided a nice example of how to get a similar end result. They use a service to do the encryption/decryption as the windows service control manager loads the user profile (thus allowing DPAPI to work)

Its a fairly length read, but should do the trick:

Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文