I'm a PHP web developer who has been trying to learn and understand how to encrypt and secure the data stored on a database with PHP Sodium.
In terms of security knowledge I am very new to the area besides applying basic password_hash / password_verify with bycrypt for passwords and use PDO actively when handling data, otherwise I have little to no understanding of how to encrypt / decrypt e.g. messages, files or other sensitive information.
What I'm trying to understand
- How to encrypt and store data with PHP Sodium to a database. "do unique keys need to be stored with each piece of data or each row of data?"
- What should and shouldn't be encrypted. "only sensitive data? or all data?"
- How to search for encrypted database data "by user search or by website/application request".
- How to Decrypt data stored on a database with PHP sodium.
Example
If an article named "StackExchange" is encrypted and then stored in the database as e.g. "TO+/ve+/vUTvv73v...".
How is it possible to search/load that encrypted information and return it in a plainText format either by viewing a public page or accessing it with an authorized user account?
Objectives
- To learn the basics / find out where to look for resources "in relation to the above"
- Understanding how PHP Sodium works with encryption & decryption for databases "mainly using mysql / postgresql"
- Decrypting encrypted data were appropriate.