0

I'm building a SaaS app in PHP that will involve users storing their client's names and addresses in our database. I intend to encrypt the data using the defuse/php-encryption library which allows individual users to have their own encryption key protected by their login password. My question is, if I do this, how do I manage the case where the user has forgotten their password? If their password is forgotten, the key is subsequently lost and I have no way of recovering it. I thought I'd be able store the key twice, one protected with the user password and the second protected by a strong admin password, with the user having to phone up to reset their account. However, from what I can see, the php-encryption library does not allow for this.

I'd like to avoid having a global key as it would have to be stored somewhere in the source code or db.

1 Answer 1

0

You can't use the user's login password for the reason you've noted so if you're going to encrypt the data you have to either save the password or be able to generate it. Maybe the password is the user's login ID hashed.

It seems like you want the password for the encrypted data to be a secret not kept by your program. That can't happen without the possibility of losing the data.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .