


IIS配置節(jié)的加密和解密
可以使用 ASP.NET IIS 注冊(cè)工具 (Aspnet_regiis.exe) 加密或解密 Web 配置文件的各節(jié)。在處理 Web.config 文件時(shí),ASP.NET 將自動(dòng)解密已加密的配置元素。
可以使用 ASP.NET IIS 注冊(cè)工具 (Aspnet_regiis.exe) 加密或解密 Web 配置文件的各節(jié)。在處理 Web.config 文件時(shí),ASP.NET 將自動(dòng)解密已加密的配置元素。
下面是詳細(xì)的操作步驟:
aspnet_regiis.exe 在 \WINDOWS\Microsoft.Net\Framework\v2.0.* 目錄下。
1、創(chuàng)建 RSA 密鑰容器
aspnet_regiis -pc "密鑰容器名稱(chēng)" -exp aspnet_regiis -pc "密鑰容器名稱(chēng)" -exp
2、導(dǎo)出 RSA 密鑰容器
aspnet_regiis -px "密鑰容器名稱(chēng)" keys.xml -pri aspnet_regiis -px "密鑰容器名稱(chēng)" keys.xml -pri
3、導(dǎo)入 RSA 密鑰容器
aspnet_regiis -pi "密鑰容器名稱(chēng)" keys.xml aspnet_regiis -pi "密鑰容器名稱(chēng)" keys.xml
4、刪除 RSA 密鑰容器(該步驟可以忽略),卸載 .NET Framework 時(shí)不會(huì)刪除 RSA 密鑰容器,需要手工刪除。
aspnet_regiis -pz "密鑰容器名稱(chēng)" aspnet_regiis -pz "密鑰容器名稱(chēng)"
5、授予對(duì) RSA 密鑰容器的訪(fǎng)問(wèn)權(quán)限
aspnet_regiis -pa "密鑰容器名稱(chēng)" "NT AUTHORITY\NETWORK SERVICE" aspnet_regiis -pa "密鑰容器名稱(chēng)" "NT AUTHORITY\NETWORK SERVICE"
6、指定受保護(hù)的配置提供程序,修改 Web.config 文件,添加 <configProtectedData> 節(jié),如下
<configuration>
<configProtectedData>
<providers>
<add name="加密和解密的提供程序名稱(chēng)" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" keyContainerName="密鑰容器名稱(chēng)" useMachineContainer="true" />
</providers>
</configProtectedData> </configuration> <configuration>
<configProtectedData>
<providers>
<add name="加密和解密的提供程序名稱(chēng)" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" keyContainerName="密鑰容器名稱(chēng)" useMachineContainer="true" />
</providers>
</configProtectedData>
</configuration>
7、加密 Web 配置節(jié)
aspnet_regiis -pe "connectionStrings" -app "/應(yīng)用程序名稱(chēng)" -prov "加密和解密的提供程序名稱(chēng)" aspnet_regiis -pe "connectionStrings" -app "/應(yīng)用程序名稱(chēng)" -prov "加密和解密的提供程序名稱(chēng)"
8、解密 Web 配置節(jié)(該步驟可以忽略),應(yīng)用程序內(nèi)部能夠自動(dòng)進(jìn)行解密,無(wú)需特別處理。
aspnet_regiis -pd "connectionStrings" -app "/應(yīng)用程序名稱(chēng)"
關(guān)鍵詞:IIS 配置 加密 解密
新文章:
- CentOS7下圖形配置網(wǎng)絡(luò)的方法
- CentOS 7如何添加刪除用戶(hù)
- 如何解決centos7雙系統(tǒng)后丟失windows啟動(dòng)項(xiàng)
- CentOS單網(wǎng)卡如何批量添加不同IP段
- CentOS下iconv命令的介紹
- Centos7 SSH密鑰登陸及密碼密鑰雙重驗(yàn)證詳解
- CentOS 7.1添加刪除用戶(hù)的方法
- CentOS查找/掃描局域網(wǎng)打印機(jī)IP講解
- CentOS7使用hostapd實(shí)現(xiàn)無(wú)AP模式的詳解
- su命令不能切換root的解決方法
- 解決VMware下CentOS7網(wǎng)絡(luò)重啟出錯(cuò)
- 解決Centos7雙系統(tǒng)后丟失windows啟動(dòng)項(xiàng)
- CentOS下如何避免文件覆蓋
- CentOS7和CentOS6系統(tǒng)有什么不同呢
- Centos 6.6默認(rèn)iptable規(guī)則詳解