A chat app I'm developing requires storing the chat history on the server. Whats the best way to securely store this? I do not want to store plain-text chat logs in a table.
My initial thought was storing them encrypted based on the *users password, however if the user forgets his password, whats the best way to handle that? Since I have no idea what the password is to decrypt and re-encrypt with the new password.
Another solution was encrypt everything with a public key, and keep the private key stored on a separate machine (and in local memory for that server) and fetch it when its needed to decrypt and grab the full chat history.
Any help or case-studies would be awesome.
*added to avoid confusion