I am developing a web application in which each user has some part of his data that is stored encrypted. We are hosted on AWS and I want to use KMS as part of the solution. To not make the solution overly expensive (AWS charges per key) I was thinking of the following solution:
- I generate 1 RSA master key in AWS KMS
- For each user I generate an AES key (to be used later in GCM mode) in my application and store it encrypted using the public part of my master key (using PKCS#1 v2 padding).
- The user's data is encrypted using the AES key (GCM mode with random IV)
- When working with the data I only need to request KMS to decrypt the user AES key, all operations after that are done with the decrypted AES key
Is anybody aware of somebody using a solution like this or any security pitfalls? Yes - if the master private key leaks we are in trouble, but that is on AWS to protect.