Search code examples
passwordspassword-storage

Saving login password


I'm writing a desktop app that retrieves e-mails from an IMAP server. For convenience, the user is given the option to save his username and password for the login screen, so he doesn't have to enter it each time. Can I save the password as plain text? If not, then how do I do this?

(Note that storing a password hash is not appropriate here because the program must know the exact username and password in order to automatically log into the IMAP server.)


Solution

  • On Windows, you can store the password using DPAPI.
    In .Net, that's the ProtectedData class.