Now I have read somewhere, that it is a good idea to have your database designed in such a way, hat even if someone gets hold of it, they can't get at sensitive info (password, etc.).
However, as far as I know, the GDPR classifies email addresses as sensitive/personal info, so that should be protected as well. Since I will be sending confirmation and notification emails, a hash will not be good, and I have no idea where I should encrypt the email addresses: If at a php level, I will either have a hard-coded key (BAD) or a configuration file with a key in it (more problems). I have been told that I can do it at a database level but if I'm protecting them against the database being stolen, wouldn't that also steal the encryption key?
What is the proper way to keep emails hidden even if the database is compromised?