winform配置⽂件的加密解密
winform 配置⽂件的加密解密
Visual Studio 命令提⽰(2010) 窗⼝下直接输⼊ :
解密
aspnet_regiis -pdf connectionStrings 程序⽂件夹全⽬录
加密
aspnet_regiis -pef connectionStrings 程序⽂件夹全⽬录
注意:加密解密过程中必须把配置⽂件名称改为fig
程序运⾏⼀定要改回来
也可以通过运⾏CMD切换到命令提⽰符下,进⼊到C:\WINDOWS\Microsoft\Framework\下,
其中 xxxx 是你所⽤的Framework版本,可以通过打开上述⽬录得到。
=================================================
配置⽂件:加密前
<?xml version="1.0" encoding="utf-8" ?>cipher命令
<configuration>
<connectionStrings>
<add name="str1" connectionString="data source=127.0.0.1;database=CustomerServiceDB;
uid=sa;pwd=123" />
</connectionStrings>
</configuration>
===================================
配置⽂件:加密后
===================================
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">
<EncryptedData Type="/2001/04/xmlenc#Element"
xmlns="/2001/04/xmlenc#">
<EncryptionMethod Algorithm="/2001/04/xmlenc#tripledes-cbc" />
<KeyInfo xmlns="/2000/09/xmldsig#">
<EncryptedKey xmlns="/2001/04/xmlenc#">
<EncryptionMethod Algorithm="/2001/04/xmlenc#rsa-1_5" />
<KeyInfo xmlns="/2000/09/xmldsig#">
<KeyName>Rsa Key</KeyName>
</KeyInfo>
<CipherData>
<CipherValue>UqupaYVDA7WOWEWwG1foftuhquDgLMkmgGQbDGceawbDOQzjdRQzRU9/tyr1GT0qHnAP5tAm/2PO1SaFQ EHva6a3yVUaDdHjXYdpNx5YiI0O5sXssWZCRE7kwFPHKoK6RsIMEqjgVDFEkWFhwgjDUsIiL1TURpMcCL6HfPtP
+ns=</CipherValue>
</CipherData>
</EncryptedKey>
</KeyInfo>
<CipherData>
<CipherValue>w9cu5AenHpo4oAVZYogic3CY9nQDFkutN4OAxYnmP/iBFfwdqBBJav/h7pGUrN+
+gWjT9t9IBkTWlLKd0/mEB2IIdmuvwEDLywxNZvPacbyzRI1tLlKf6oD0VLkkEqxgHD6Vh+AaM
+zypwKttzKRrAIt6uxxOzinz7cLWXEZwYfmX+ZZ7+ob8hbh0rW0Ehn2bq4DjhysROW98DPublmnJw==</CipherValue>
</CipherData>
</EncryptedData>
</connectionStrings>
</configuration>
====================================================================================
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论