我应该在哪里存储不以纯文本形式存储的 Azure 角色设置?
看起来存储 Azure 角色设置的标准方法位于 .cscfg 文件中的
标记下。看起来很方便,但该文件没有以任何方式加密 - 它是一个 XML,以纯文本形式上传到 Azure 门户,并以纯文本形式存储,可以随时编辑。
在我的应用程序中,我需要一些不应存储为纯文本的设置,例如 SQL Azure 数据库的密码。我不想拥有包含该密码的纯文本 XML 文件。如何存储此类角色设置?
Looks like the standard way of storing settings of Azure roles is under <ConfigurationSettings>
tag in the .cscfg file. Looks convenient, but the file is not encrypted in any way - it is an XML that is uploaded to the Azure portal as plain text and is stored as plain text and can be edited at any time.
In my application I'll need settings that should not be stored as plain text - like for example a password to my SQL Azure database. I'd rather not have a plaintext XML file with that password. How do I store such role settings?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在本地执行此操作的典型方法是在单台计算机上使用 DPAPI。当然,这在网络农场中存在问题。要解决此问题,您可以在每台计算机上共享一个密钥并进行加密。最简单的方法是使用基于证书的加密。
没有什么反对 Michael 引用的 SQL Azure 帖子,但这必须是有史以来最长的系列,告诉您使用 PKCS12 配置提供程序。使用该提供程序的唯一原因是它与 ASP.NET 的内置工具结合使用,可以自动从 appSettings 读取。它对需要更改的 ServiceConfiguration 没有帮助。
如果您想要做的只是安全地保护某个设置(通常在 ServiceConfig 中)并且您不介意编写一个实用程序类来执行此操作,那么您可以将这两个函数与上传到 Windows Azure 的任何证书(带有私钥)一起使用。这正是服务配置中远程访问密码的加密方式。
加密:
解密:
The typical way to do this on-premises is to use DPAPI on a single machine. Of course, this has problems on a web farm. To work around this, you can share a single key on each machine and encrypt. The easiest way to do this is to use certificate based encryption.
Nothing against the SQL Azure posts referenced by Michael, but that had to be the longest series ever to tell you to use the PKCS12 configuration provider. The only reason to use that provider is that it works in conjuction with the built-in tooling from ASP.NET that can read from appSettings automatically. It doesn't help with ServiceConfiguration that needs to change.
If all you want to do is securely protect a setting (typically in ServiceConfig) and you don't mind writing a utility class to do it, then you can use these two functions with any certificate (with private key) uploaded to Windows Azure. This is exactly how the password for remote access is encrypted in the Service Configuration.
Encrypt:
Decrypt:
查看 SQL Azure 博客,他们的博客正是关于这一点的!
也,以前的帖子
http://blogs.msdn.com/b/sqlazure/archive/tags /安全/
Check the SQL Azure blog, they blogged exactly about this!
also, previous posts at
http://blogs.msdn.com/b/sqlazure/archive/tags/security/