C#的connectionString加密问题 [英] C# connectionString encryption questions

查看:862
本文介绍了C#的connectionString加密问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习如何ConnectionString中为我们的C#(3.5)申请加密。我阅读.NET Framwork开发人员指南(的http:// msdn.microsoft.com/en-us/library/89211k9b(VS.80).aspx )有关保护连接字符串。但不能完全理解其内容。

I am learning how to encrypt the ConnectionString for our C# (3.5) Application. I read the .Net Framwork Developer Guide (http://msdn.microsoft.com/en-us/library/89211k9b(VS.80).aspx) about securing connection string. but not fully understand the contents.


  1. 它说:连接字符串只能在解密在它被加密的电脑。我们有一个版本的机器,将构建我们的应用程序,它会产生OurApp.exe.config,然后将其安装到许多产品的机器。是MEAM我们必须有这个加密过程与我们的应用分离,个别产品整机运行呢?

  1. It says "The connection string can only be decrypted on the computer on which it was encrypted." We have a release machine which will build our application which will generate the OurApp.exe.config and then install it to many product machines. Is that meam we have to have this encryption process separated with our application and run it at individual product machine?

我们可以使用 RSAProtectedConfigurationProvider 。它提到我们需要加密密钥为该供应商。何时以及我们应该如何提供加密密钥?

We may use the "RSAProtectedConfigurationProvider". It mentioned we need encryption key for that provider. when and how we should provide the encryption key?

感谢,

推荐答案

您只需要运行一次加密过程。然而,生成机键后,你需要传播,在目标机器上所有的machine.config文件。在machine.config应设在这里:

You only have to run the encryption process once. However, after generating the machine key, you need to propagate that in all the machine.config files in the target machines. The machine.config should be located here:

%FRAMEWORKDIR%\%FRAMEWORKVERSION%\CONFIG

如何配置的machineKey在ASP.NET 2.0
:这个链接对配置的配置键部分<的machineKey的validationKey =[生成的值这里]结果
decryptionKey =自动生成,IsolateApps
验证=SHA1解密=自动/方式>
,以及如何在机器之间分享这个

How To: Configure MachineKey in ASP.NET 2.0 : This link has a section on configuring the config key <machineKey validationKey="[generated value here]"
decryptionKey="AutoGenerate,IsolateApps" validation="SHA1" decryption="Auto" />
and how to share this between machines.

这篇关于C#的connectionString加密问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆