• caglararli@hotmail.com
  • 05386281520

How to avoid performance issues with envelope encryption when using separate DEK’s for each piece of data?

Çağlar Arlı      -    4 Views

How to avoid performance issues with envelope encryption when using separate DEK’s for each piece of data?

Posted this first on stackoverflow but was suggested to repost it here.

I am planning on using envelope encryption for data stored in a database in a multi-tenant solution. Envelope encryption suggest creating a separate DEK (Data Encryption Key) for each piece of data and then encrypt the data with the DEK and store encrypted data together with the wrapped DEK (wrapped by the Key Encryption Key).

When retrieving data we have to go through the process of unwrapping the DEK before doing decryption of the data, as the unwrapping is suggested to be done in a KMS (Key Management System) for security reasons it will take some time, like 10-50ms as it is a remote call.

As the unwrapping is costly keeping a separate DEK for each piece of data could have some major performance issues when having to decrypt a lot of data i.e. a SQL query that returns a lot of rows.

How to avoid this performance hit? The only solution I currently see is to use a DEK for multiple pieces of data, like the entire tenant, user or other group of data. Though this will probably bring in the need for rotating the DEK.

  1. Is it possible to have a separate DEK for each piece of data without the above performance issue? If so how are you solving this?
  2. The practical solution as I see it is to keep a DEK per tenant and rotate them, this will reduce the unwrapping operations to a couple per tenant. Is this viable or not recommended?

Any guidance is appreciated.