There is a requirement to implement additional level of security for an application. Let's say there is a table with 10'000'000 users. The sensitive fields are user.first_name and user.last_name. We need to encrypt that data before storing it into the database and later decrypt on the application level to show it on the UI.
As far as I can see the recommended way to do it with KMS is:
Write Part
- call KMS service to get data key
- encrypt the fields using data key
- on the application level persist user record with encrypted fields into the database
Read Part
- retrieve the record with encrypted fields from the database
- decrypt the fields using data key
- show the data on the UI
I have a set of questions that i need to clarify:
- Does it make sense to use a new data key for each user?
- 10'000'000 users means 10'000'000 different data keys , what is the best practice to store them and access them from the machine that is doing decryption?
- Is it ok to have a single data key for the whole user table?
- What is the best practice to store a single key securely on local machine?
- What will happen when accidentally the data key will be lost? Are there any recovery procedures?