I have 10+ legacy VB6/VB.NET applications. They establish connections to databases (ODBC/Thick client). The connections strings are all just strings in the source, plain text. My current task is to remove all occurrences of the database's password; I'm trying to decide the best approach.
What I've gathered/decided thus far:
Using just the app.config is not enough. The production DB password would then be in the appname.manifest.config on the user's machine.. in plain text! Unacceptable for my needs.
Encryption/Decryption (app.config with ConfigurationManager .NET class) on the main load/close events is an option. Is it a good one? Tim Corey says don't do it.. ugh.
I have all the DB passwords available on the IIS site that my web services use. They are stored in the connection strings (web.config) correctly. I am able to retrieve them from web services.. why shouldn't I use a web service to return the correct connection string? Because of security reasons - authorization and authentication.. is that solely it?
Use a web service call to return the database password, making sure your security is perfect?
Edit: You some real options when removing the password from your legacy database application:
- Just update your password and continue the cycle. Re-publish everything :(
- Refactor the code, and remove database operations out of the view section of your desktop code. Put it into a web-service. Do NOT write SQL within your views/forms at all costs!
- Use a web-service to return your connection string lol. Not great - works but not recommended unless you don't feel there are enough negatives with this solution. (Authen/Authorization/Hackers/its janky/etc)
- Use app.config and be OK with your password being in plain text. Optionally encrypt it. Salt + Hash would be GREAT! This is the ideal solution IMO if it wasn't such a huge task. <--