Advertisement

07.17.2008 at 11:00AM PDT, ID: 23574258
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

How do I encrypt a password in a config file so that it may be decrypted via code on a user machine?

Asked by hi2way in .Net Editors & IDEs, .NET, Visual Studio

Tags:

I have a connection string that is built dynamically on a user's machine.  The connection string is used to open a database for which a password.  The password is constant.  I added the password to the myapp.exe.config file and encrypted it (see protection method and xml text below).

However, the user gets an error stating that "Decrypt  Failed on Provider" when the encrypted password is referenced.

Could someone help me understand how to encrypt the password on my machine in a way that it may still be referenced on a user's machine.


Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
Encryption method:
 
   Sub sEncryptConfig()
      Dim config As System.Configuration.Configuration = _
         ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
      Dim provider As String = _
         "DataProtectionConfigurationProvider"
 
      'Encrypt the connection strings.
      Dim connStrings As ConfigurationSection = _
         config.ConnectionStrings
      connStrings.SectionInformation.ProtectSection(provider)
      connStrings.SectionInformation.ForceSave = True
      config.Save(ConfigurationSaveMode.Full)
 
   End Sub
 
xml file - result of encryption:
 
   <appSettings configProtectionProvider="DataProtectionConfigurationProvider">
      <EncryptedData>
         <CipherData>
            <CipherValue>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAJYioTuDPPkScPVDoNSyNxgQAAAACAAAAAAADZgAAqAAAABAAAAA6TLzeZ7DEG8HB7uFwguE6AAAAAASAAACgAAAAEAAAACjPJDjmFqDqpxwnwdJiu/XQAAAAFfsVYysjzxmdTIhcgD8xmmfMxBAdh6k/OWJacNWOq65xYVumdV7CKn++rGMigPmnvEQbGttCwB+lig+titC3gNGgUId2foV6tnQG0GDUjBpiO6vy/Lg14DeEhiLd27+8TzF2hVBpdvsHfygyC6P2DB6u4UYMHGupBt5VpQHdqKYE0GP+IKfiFa4yRCBS0b86MWGLXMSHcoC8zCw1mPzIqPPFlrCCvHZ+UazIyBdRJh212PyaFyUA9V3eFDmSCrMwgfzD5/wfV5p7UknM3cvkmRQAAACmlhk0cZzBMtxVqHhLOlYvi5WLBw==</CipherValue>
         </CipherData>
      </EncryptedData>
   </appSettings>
[+][-]07.17.2008 at 11:28AM PDT, ID: 22028513

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.17.2008 at 12:18PM PDT, ID: 22029066

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.18.2008 at 09:05AM PDT, ID: 22037244

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .Net Editors & IDEs, .NET, Visual Studio
Tags: vb.net 2005
Sign Up Now!
Solution Provided By: graye
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.18.2008 at 03:05PM PDT, ID: 22040217

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.28.2008 at 07:56AM PDT, ID: 22103758

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.31.2008 at 01:36PM PDT, ID: 22133270

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.31.2008 at 02:53PM PDT, ID: 22133875

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628