0

in our SaaS application we store different integration tokens from apps like Trello, Pivotal, Intercom etc, based on Oauth tokens, which we want to additionally (on top of the default database encryption at rest) symmetrically encrypt and decrypt using best practices. Given the criticality of the tokens (not cardholder data), but still very sensitive authentication tokens, which one of the following approaches would you recommend ?

  1. Using Encryption as a Service mechanism, which will simply encrypt and decrypt every single payload using a single API call (e.g. Hashicorp Vault, Transit engine), where each customer/space will have it's own master key.
  2. Using Envelope encryption, where DEK will be stored next to the data in the main database and the KEK will be stored in some KMS (e.g. Vault K/V mode), where each customer/space will have it's own master key and each row (data record/object) will have it's own data encryption key.

The difference between both approaches is that the first one does not include usage of Data Encryption keys and "two way encryption".

1 Answer 1

1

In general, the enveloped encryption is more flexible with only a small bandwidth overhead, so there's no reason not to do it?

You get flexibility in the sense that:

  1. If you happen to need to add a second decryption service, then you can simply re-encrypt the DEK for that decryption service rather than needing to re-encrypt the (presumably much larger) data payloads. For example you might in the future want a disaster recovery site with different encryption keys from the primary site.
  2. If your organization has a key rotation policy (ex.: all encryption-at-rest keys must be rotated every year), then it's generally easier to implement this as enveloped data where you need to re-encrypt the DEKs for a new KEK, as opposed to needing to find and re-encrypt all the data.
    • A special case of this is if your decryption service gets hacked and you have to roll over your master encryption key in an emergency situation.

Implementing this fully involves more than just the encryption format since you need to worry about where you're storing the DEKs and have a procedure for pulling them down and re-encrypting them. But the point is that choosing enveloped data now gives you all sorts of options down the line that you wouldn't have otherwise.

6
  • So what would be your recommended approach? Would you go for envelope encryption or would you just use the EaaS provided by Hashicorp directly without caring about management of DEKs?
    – MGL
    Apr 1, 2021 at 17:21
  • I don't like to give "I would do ..." advice from the other side of the internet without without knowing all the details of your environment and requirements. "envelopedData-vs-EaaS" is a bit of a false dichotomy; it's like asking whether you should buy a $10 ratchet or a $150 torque wrench; the torque wrench is a strictly better tool, but the $10 wrench is fine if you don't care about controlling your torque. If I was architecting your system, I would want to build in a key-rotation mechanism, which is way easier to do with envelop data. But if EaaS does what you need, then do that. Apr 1, 2021 at 19:34
  • 1
    We absolutely have a requirement by policy that we need to rotate keys on annual basis, so I'd take your advise as more of a recommendation for the envelope encryption approach.
    – MGL
    Apr 1, 2021 at 20:13
  • What would be your thoughts on the Vault EaaS re-wrapping strategy (learn.hashicorp.com/tutorials/vault/…)? Can this be compared to what you are refering as "easier way to rotate keys"?
    – MGL
    Apr 2, 2021 at 14:28
  • @MGL I'm a bit uncomfortable giving you a product recommendation or blessing without knowing your environment, and based only on a quick read of a page about a product I've never used; but it looks reasonable, though the thing that comes to mind is that clearly Vault keeps and has access to the entire history of encryption keys, so that key rotation mechanism does not protect against insider threat from a rogue security engineer. I also don't know if any other commercial products do key wrapping in a way that protects against that. Apr 2, 2021 at 23:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .