0

I'm using the package betterapp\LaravelDbEncrypter to encrypt some data in the DB.

If something goes wrong and I lose the access to the server, even if I have a back up of the database in a different place, I won't be able to access that data anymore.

What could be the best approach to save a back up of the database, so it can be recovered even if Laravel's app key is not the same anymore?

I was thinking about decrypting all values and saving the backup within a 7z with password. What do you think?

Inigo EC
  • 2,178
  • 3
  • 22
  • 31

1 Answers1

1

The package uses Larave's Encryption feature which relies on the value of your APP_KEY in your .env file.

To be able to restore your database backup you need the same APP_KEY-value in your second, restored application.

I would advice to keep a copy of the APP_KEY in a safe location. Like a password manager like 1Password or LastPass.

Decrypting all encrypted values in your database seems to me like a lot of work. As you would probably would have to encrypt them again in your restored app.

stefanzweifel
  • 1,434
  • 14
  • 9