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"

 

posted @ 2008-04-01 12:22  protorock  阅读(370)  评论(0编辑  收藏  举报