Simple and practical method for web. Config encryption and decryption

Source: Internet
Author: User

Web. most of the config files do not need to be seen by others. The following provides an encryption and decryption Statement, which is concise, convenient, and practical. First, you can see the effect, as for the principles of encryption, I have made a lot of instructions on other web pages. Here I will only demonstrate the effect. <ConnectionStrings> <add name = "SQLConnString1" connectionString = "server = WJW-PC \ SQL2008; user id = sa; password = 12345; Initial Catalog = dbFASH; min pool size = 4; max pool size = 400; "/> <add name =" eziyaConnectionString1 "connectionString =" Data Source = HOME-COMPUTER; Initial Catalog = dbFASH; integrated Security = True; MultipleActiveResultSets = False; Packet Size = 4096; Application Name = & quot; Microsoft SQL Server Management Studio & quot; "providerName =" System. data. sqlClient "/> <add name =" eziyaConnectionString2 "connectionString =" Data Source = 192.168.1.200; Initial Catalog = dbFASH; Persist Security Info = True; User ID = taoka; MultipleActiveResultSets = False; packet Size = 4096; Application Name = & quot; Microsoft SQL Server Management Studio & quot; "providerName =" System. data. sqlClient "/> <add name =" eziyaConnectionString3 "connectionString =" Data Source = 192.168.61.160; Initial Catalog = dbFASH; Persist Security Info = True; User ID = sa; MultipleActiveResultSets = False; packet Size = 4096; Application Name = & quot; Microsoft SQL Server Management Studio & quot; "providerName =" System. data. sqlClient "/> </connectionStrings> Node Code of the encrypted connectionStrings <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> keys + keys/j + YCvH/r6ABoE/queues/W7f7Wkqj + FDwse + keys + p5Apf0E = </CipherValue> </CipherData> </EncryptedKey> </KeyInfo> <CipherData> <CipherValue> s3PKarSQ/tlnG5YcE/z/KLbnSLljw/nOj + signature + OM3f0WOh57evnW Examples/5 CTCGfZ/k0u + jWAGYYuOxlT6/examples + d3itc + h + examples + IulmOYWEnp2xwC + Sm/examples // examples/examples + samples + xRFT9btNWm/examples + 5cp + oISOyMMkFYvzCs TKpYYYwQ/xW/samples + aPLyPrBjsVddfnO/samples/I4/Vb7vsX2VoaFc0BrMxzYe6z/samples/5/N46gofk7g/W/samples/Samples Response + response/response // response + 0HLAsBsPzLRrppHyFMqIBuNe1iWxBM + j3PQUeN + oXJog79YoFxdd4cf1 + jMZn0 + ee7aOvEu4WGv3 Lost/n/MsLpVJmJTzA + lost/71cBSE8KSLOj/aGf2p4UBSUPRk = </CipherValue> </CipherData> </EncryptedData> </connectionStrings> the connection information is completely invisible! Below are two. bat batch file encryption: @ echo off C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis.exe-Arg "connectionStrings" "E: \ code \ proj \ Web" decryption: @ echo off C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.50727 \ aspnet_regiis.exe-pdf "connectionStrings" "E: \ code \ proj \ Web" PAUSE directly copy the statement. in the BAT file, E: \ code \ proj \ Web is the corresponding web. the path of config, which can only be operated on one computer; otherwise, it is irreversible.

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.