给配置文件加密,FrameWork2.0自带加密功能,只能对web.config加密,所以,如果是C/S项目,那么只要把app.config改成web.config即可。
打开SDK
-pef 加密
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.;Initial Catalog=HRMS20;Persist Security Info=True;User ID=sa;PassWord=sa" providerName="System.Data.SqlClient"/> </connectionStrings></connectionStrings>
aspnet_regiis -pef "节点名" "配置文件路径"
-pdf 解密
aspnet_regiis -pdf "节点名" "配置文件路径"
<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#"> <KeyName>RSA Key</KeyName> </KeyInfo> <CipherData>