I'm writing a winforms application that stores usernames and passwords locally within a configuration file so that the person using the application does not have to retype their credentials every time they log in to the various services my application supports. It is absolutely necessary that the password be able to be decrypted so I opted for using ProtectedData and the Protect and Unprotect methods to securely store passwords. This made it easy to pass on responsibility of protecting their data to Windows and the end user rather than worrying about keys and such myself.
Now I want to offer the user the ability to move settings between installations. A great example of this is if they wished to keep a backup of lots of different account settings, or they want to move to a different computer.
I've worked it out to be something like this:
- User clicks "export accounts" button
- Application decrypts the stored settings using Unprotect
- Application writes the settings to a plaintext "backup" which will then be imported and re-ecrypted on the new account.
All of this sounds great up to step #3. Step 3 bothers me because it places the passwords in plaintext. Is there a best practice for import/export of credentials in such a scenario or would be be considered "okay" to make it the user's responsibility to secure the exported file? To me, assuming that the user secures their Windows account properly, this seems like it would be okay to assume. I've kicked around the idea of not even allowing them to import/export the settings files but this seems like it could be a major inconvenience. Similarly, I could also be building towards an extremely rare edge-case where someone has so many stored accounts that it would take just short of a decade to re-input manually.
If anyone who has experience doing such a thing would chime in with best practices/advice for this I'd really appreciate it. I'm fairly new to having to deal with all the complications of storing credentials.