If encryption keys should have a lifecycle of generated, distributed, stored, replaced, deleted. How do I decrypt data that was encrypted with Key0 when I am now using Key1, or Key2?

I am referring to encrypted data at rest held in a mongoDB database.


While there is no generalized solution, there are a few ideas on how to do that, based on what part of trust you're willing to give to the system:

  • decouple access keys from storage keys (store with random keys, which then are encrypted with access keys). make the system wrap new storage keys in your public key/identity-bound key for you to access. you trust the system to be honest and supplying new storage keys only to you.
  • trust re-keying software (one of nice ideas is to have compaction cycle in your DB, which removes obsolete records and re-keys everything, defragmenting your storage and updating every record sequentially) to have additional key to use at re-keying/compaction cycle.
  • trust the system to regenerate new keys and supply them to you over trusted channel (e.g. system signs every new storage key and sends it to you).
  • safely derive new key from old one with user being present with his private key for interactive protocol, in which parties (db and user) will derive new storage secret. requires online presence and being able to run key derivation protocol, which is only computationally cheaper than re-crypting everythign from key0 to key1 yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.