Click here to Skip to main content
16,005,826 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I have search the net on how can I encrypt my App.config that I created in VB Winform.

I found this article on this site

[^]

What I`m expecting is that when I view the App.Config file in the Application Folder I should not be able to view the Database user and Password but, it does not seems to be working.

Here is my App Config Code.


<?xml
                  Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="EncrpytOracle_Connection"
               type="System.Configuration.ClientSettingsSection, System,
                    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a561934e089"
               requirePermission="false"/>
    </sectionGroup>
  </configSections>

  <connectionStrings>
    <add name="Oracle_Connection" connectionString="Driver=Microsoft ODBC for Oracle;uid=SOMEID;pwd=SOMEPWD;server=SOMEDB"/>
  </connectionStrings>
    <system.diagnostics>
        <sources>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                <listeners>
                    <add name="FileLog"/>
                    <!-- Uncomment the below section to write to the Application Event Log -->
                    <!--<add name="EventLog"/>-->
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
            <add name="FileLog"
                 type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" 
                 initializeData="FileLogWriter"/>
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
    </system.diagnostics>
</configuration>">


As you can see in my connection string DB user Name, Password and Server is visible.

How do I encrypt it?

Please also check the my Class for decryption.


<pre lang="Imports System.Configuration<br mode=" hold=" /><br mode=" configurationsection=")<br mode=">


This is actually my 1st time to use app config encryption.

Can someone kindly give me an advice.

Thank you.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900