I understand that using salted hashing is the preferred method to save passwords in a database. However this works only when for interactive purposes. For example,
- User uses an registration form to fill passwords which is then saved as salted hash entry in the database.
- Next time when logs in with a password, the hashed value of it is compared against the database entry.
So far so good. What if I want to automate this login itself? ie., instead of user entering the password in an online form to submit the login password, I want to store the password somewhere in my local machine so that I may use it for automated authentication in the login form. The trouble is, I can't use salted hashing here as it is one-way and hence I need to go for encryption. If I choose encryption, I need to use a secure key to decryption which again must be stored somewhere. If I need to encrypt, how do I do this securely? If not, what is the best method. Is there a best practice for this sort of thing?
I have seen some failed implementations which have been cracked. SQL developer for example, https://stackoverflow.com/a/3109774/350136