在开发期间保护连接字符串

发布于 2024-09-24 19:20:43 字数 444 浏览 2 评论 0原文

我们需要在开发过程中保护连接字符串。在服务器上,我们使用 DPAPI,效果很好。 DPAPI 不是开发期间的一个选项,因为连接字符串需要在许多计算机上解密。

用于开发的一些用户名/密码相当敏感,我们不希望它们四处流传。对于所有开发人员来说,能够解密它们很好,只是想确保如果其他人拿到了开发配置文件,那么该人就无法解密连接字符串。由于外部限制,不能选择使用所有服务帐户来代替敏感的用户名/密码。

我的第一个倾向是使用 RSA 提供程序在开发计算机上加密和安装证书。

所以我的问题是;

1)你如何处理这个问题?

2) 如果您采用 RSA 方法,是否有比 此更多的最新文档谢谢

We need to protect connection strings during development. On servers we use DPAPI which works fine. DPAPI is not an option during dev since the connection strings will need to be decrypted on many machines.

Some of the user names/password used for dev are rather sensitive and we don't want them floating around. It's fine for all the devs to be able to decrypt them, just want to ensure that if someone else gets their hands on the dev config files that person can't decrypt the connection strings. Using all service accounts instead of sensitive username/password is not an option due to external constraints.

My first inclination is to use the RSA provider for encrypting and installing the cert on the dev machines.

So my questions are;

1) How do you approach this issue?

2) If you take the RSA approach is there more up-to-date documentation than this

Thanks

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

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

发布评论

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

评论(1

星光不落少年眉 2024-10-01 19:20:43

经过更多研究后,我们采用了 RSA 方法。在此处找到了一些更新的文档。如果您要走这条路,请确保您阅读了该链接中与 RSA 相关的所有内容。如果有人感兴趣,下面是我们使用的步骤...

--仅限第一次

-创建密钥容器,使其可导出

aspnet_regiis -pc "MyKeys" -exp

-将此部分添加到配置文件

<configProtectedData>
  <providers>
    <add name="RsaProvider"
         type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0,
                    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
                    processorArchitecture=MSIL"


         keyContainerName="MyKeys"
         useMachineContainer="true" />
  </providers>
</configProtectedData>

-加密连接字符串

aspnet_regiis -pef "connectionStrings" "C:\Working\MyApplication" -prov RsaProvider

-给出配置文件

-解密

aspnet_regiis -pdf "connectionStrings" "C:\Working\MyApplication"

-导出密钥(将创建keys.xml)

aspnet_regiis -pc "MyKeys" -exp

--在其他机器上

-将keys.xml保存在某处

-导入密钥。确保名称(例如 MyKeys)相同

aspnet_regiis -pi“MyKeys”keys.xml

-删除keys.xml!!!!!!!!!!!!!!!

- 如果作为 Web 应用程序的一部分运行,则向服务帐户授予权限,

例如aspnet_regiis -pa“PcscDev”“ASPNET”

Well after more research we went with the RSA approach. Found some more updated documentation here. If you are going down this road make sure you read everything RSA related in that link. Below are the steps we used if anyone is interested...

--FIRST TIME ONLY

-create the key container, making it exportable

aspnet_regiis -pc "MyKeys" -exp

-add this section to config file

<configProtectedData>
  <providers>
    <add name="RsaProvider"
         type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0,
                    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a,
                    processorArchitecture=MSIL"


         keyContainerName="MyKeys"
         useMachineContainer="true" />
  </providers>
</configProtectedData>

-encrypt the connection strings

aspnet_regiis -pef "connectionStrings" "C:\Working\MyApplication" -prov RsaProvider

-give out the config file

-to decrypt

aspnet_regiis -pdf "connectionStrings" "C:\Working\MyApplication"

-export keys (will create keys.xml)

aspnet_regiis -pc "MyKeys" -exp

--On some other machine

-save keys.xml somewhere

-import the keys. make sure the name (e.g. MyKeys) is the same

aspnet_regiis -pi "MyKeys" keys.xml

-delete keys.xml!!!!!!!!!!!!!!

-give permissions to the service account if running as part of a webapp

e.g. aspnet_regiis -pa "PcscDev" "ASPNET"

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