码迷,mamicode.com
首页 > Windows程序 > 详细

winform 配置文件的加密解密

时间:2014-11-26 18:13:34      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:des   winform   blog   http   io   os   sp   for   文件   

 

winform 配置文件的加密解密
Visual Studio 命令提示(2010) 窗口下直接输入 :
解密
aspnet_regiis -pdf connectionStrings 程序文件夹全目录


加密
aspnet_regiis -pef connectionStrings 程序文件夹全目录

注意:加密解密过程中必须把配置文件名称改为web.config
程序运行一定要改回来App.cong

也可以通过运行CMD切换到命令提示符下,进入到C:\WINDOWS\Microsoft.net\Framework\v2.0.xxxx下,
其中 xxxx 是你所用的Framework版本,可以通过打开上述目录得到。
=================================================

bubuko.com,布布扣
配置文件:加密前
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="str1" connectionString="data source=127.0.0.1;database=CustomerServiceDB;
uid=sa;pwd=123" />
</connectionStrings>
</configuration>
===================================
配置文件:加密后
===================================

   bubuko.com,布布扣
<?xml version="1.0" encoding="utf-8" ?>
<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>

<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>
====================================================================================

winform 配置文件的加密解密

标签:des   winform   blog   http   io   os   sp   for   文件   

原文地址:http://www.cnblogs.com/laopo/p/4123397.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!