I have a WPF application with connections strings stored in the App.config. What is the best way of encrypting these connection strings in a click-once deployment?
Thanks
I have a WPF application with connections strings stored in the App.config. What is the best way of encrypting these connection strings in a click-once deployment?
Thanks
If this is a connectionString that will be configured and used on a single computer (not shared across multiple computers) by an instance of your application, you can use the .NET managed wrapper of the DPAPI (Data Protection API) - the ProtectedData class (System.Security.Cryptography).
A neat trick you could also use (should you decide to use this class) is to create extension methods for Encoding and Decoding a string, so the operations become as simple as:
string encodedString = myConnectionString.EncodeString();
string decodedString = encodedString.DecodeString();
Hope this helps!
I've asked a similar question here with other interesting answers