NOTE: I am aware that many similar questions exist on the topic of storing passwords safely, however, I am posting this because I believe it is different enough from existing password storage questions because this question is primarily about how a service can securely send the user a randomly-generated password in plaintext and yet keep it secure on their end (I.e. in the database) instead of storing a user-provided password securely.
I noticed the VPN service I use (PIA) is on the list of plain text offenders, and my biased opinion is that they don’t. Regardless, I’m wondering if it is indeed a good idea for a service like PIA to generate user passwords and send them to the user in plaintext while still securely storing them in a database using best practices as described elsewhere (hashing, salting, multiple iterations, etc).
If I were to implement something like this, my thought would be to make a flow something like this:
- User signs up (and doesnt provide a password)
- Generate a password and temporarily store it
- Transmit the password in plaintext to the user via whatever method
- Hash the password and store it in the database
- Permanently delete the stored plaintext password and/or overwrite it a bit.
My question is, is it possible to achieve the functionality described above in bold either in a way similar to what is listed above or in a different way?
Note: I am not asking about the security of transmitting the password, just about if there is a good way for the service to keep it secure on their end while still being able to send the user their password in the clear.