web.config 加密步骤
1.创建一个RSA密钥容器
aspnet_regiis -pc "MyKeys" -exp
2.授予asp.net标识对RSA容器的访问权限
aspnet_regiis -pa "MyKeys" "NT AUTHORITY\NETWORK SERVICE"
3.在Web.config 中指定加密保护提供程序(Provider)
<configuration>
<configProtectedData>
<add name="MyProvider"
type="System.Cofiguration.RsaProtectedConfigurationProvider"
keyContainerName="MyKeys"
useMachineContainer="true" />
</configProtectedData>
</configuration>
4. 加密<connectionStrings>节
aspnet_regiis -pe "connectionStrings" -app "/MyApp" -prov "MyProvider"
5. 导出RSA 密钥容器
aspnet_regiis -px "MyKeys" "c:\keys.xml" -pri
6. 删除RSA密钥容器
aspnet_regiis -pz "MyKeys"
7.从XML中导入RSA 密钥容器
aspnet_regiis -pi "MyKeys" "c:\keys.xml"
8.授予asp.net标识对RSA容器的访问权限
aspnet_regiis -pa "MyKeys" "NT AUTHORITY\NETWORK SERVICE"