WinForm encryption and decryption of configuration files

Source: Internet
Author: User
Tags connectionstrings

WinForm encryption and decryption of configuration files
Direct input under the Visual Studio command Prompt (2010) window:
Decrypt
Aspnet_regiis-pdf connectionStrings program folder full directory


Encryption
ASPNET_REGIIS-PEF connectionStrings program folder full directory

Note: The configuration file name must be changed to Web. config during encryption and decryption
Program operation must be changed back App.cong

You can also switch to the command prompt by running cmd and go to C:\WINDOWS\Microsoft.net\Framework\v2.0.xxxx,
Where xxxx is the version of the framework you are using, you can get it by opening the above directory.
=================================================


Configuration file: Before encryption
<?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>
===================================
Configuration file: After encryption
===================================


<?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 encryption and decryption of configuration files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.