加密网站配置文件中的信息
加密网站中的配置信息,我们不需要写任何代码,也不需要修改任何代码,只需要使用 aspnet_regiis 工具修改配置文件即可. 比如我们有下面一个配置文件需要加密: <configuration> <connectionStrings> <add name="SqlServices" connectionString="Data Source=localhost; Integrated Security=SSPI;Initial Catalog=Northwind;" /> </connectionStrings> </configuration> 假设这个配置文件在 MyApplication 目录下。 加密命令 aspnet_regiis -pe "connectionStrings" -app "/MyApplication" aspnet_regiis 命令在你安装的 .net Framework 目录下, 默认在: C:\WINDOWS\Microsoft.Net\Framework\v2.0.* 加密后的效果: <configuration> <connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider"> <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#"> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" /> <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> <EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#"> <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" /> <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> &nbs [1] [2] [3] 下一页
|