C#connectionString加密问题 [英] C# connectionString encryption questions
问题描述
-
它说
连接字符串只能在计算机上加密。
我们有一个发行机,将构建我们的应用程序,它将生成OurApp.exe.config,然后将其安装到许多产品机器上。我们是否需要将此加密过程与我们的应用程序分开并在单独的产品机器上运行? -
我们可能会使用code > RSAProtectedConfigurationProvider 。它提到我们需要这个提供者的
加密密钥
。何时以及如何提供加密密钥?
谢谢,
你只需要运行加密过程一次。但是,生成机器密钥后,需要在目标机器的所有machine.config文件中传播。 machine.config应该位于这里:
%FRAMEWORKDIR%\%FRAMEWORKVERSION%\CONFIG
如何:在ASP.NET 2.0中配置MachineKey
:此链接有一个配置密钥的部分< machineKey validationKey =[生成的值在这里]
以及如何在机器之间共享。
decryptKey =AutoGenerate,IsolateApps
validation =SHA1decrypt =Auto/>
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.
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?We may use the "
RSAProtectedConfigurationProvider
". It mentioned we needencryption key
for that provider. when and how we should provide the encryption key?
thanks,
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
How To: Configure MachineKey in ASP.NET 2.0
: This link has a section on configuring the config key <machineKey validationKey="[generated value here]"
and how to share this between machines.
decryptionKey="AutoGenerate,IsolateApps"
validation="SHA1" decryption="Auto" />
这篇关于C#connectionString加密问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!