My aim is to create a WPF application that will be used on different PCs and would have App.config with a skeleton of Connection strings like the following:
<connectionStrings>
<add name="ConnectionString" connectionString="Server=[Server1];Database=[TargetDB];User Id=[Username];Password=[Password];" providerName="System.Data.SqlClient"/>
<add name="ConnectionStringMirror" connectionString="Data Source=[Server1];Failover Partner=[Server2];Initial Catalog=[TargetDB];User Id=[Username];Password=[Password];Integrated Security=[DBAuth];" providerName="System.Data.SqlClient"/>
</connectionStrings>
Once the user inputs the connection string details, the application will encrypt the connection string, and the WPF application will be able to decrypt the string and utilise it to connect to a database.
I looked into a couple of questions with regard to Encryption which I want to implement on SQL connection strings, however, I can’t seem to narrow down the best approach for encrypting the connection string and the level of security.
Questions that I looked at are:
Encrypt password in App.config
Encrypt and decrypt a string in C#?
Encrypt part of appConfig configSection c#
App.config – encrypted section error: