I haven't found a duplicate which explains with sufficient clarity how does the process of rotating encryption keys work in simple layman terms.

I know how private/public key cryptography works, I know how symmetric cryptography works but I can't understand how rotating a private key works.

Do I decrypt all of the encrypted content, generate a new private key and then re-encrypt everything? Or perhaps do I generate a new private key and decrypt and encrypt with the new key just part of the data so now I need two keys (the new and the old) to decrypt the whole?

  • Can you please provide more context? If it is about data in transit (i.e. TLS, SSH...) it does not matter if any previous data where protected by a different key since they are not needed anymore. In context of data storage commonly long-lived (and stronger) keys are used and no rotation is done. And then are cases where the rotated key is not actually the encryption key but only used to protect the real encryption keys - which are kept constant. So please provide as much details as possible about the actual use case you are interested in. – Steffen Ullrich Nov 24 '18 at 15:04
  • Could you expand on the use cases where keys rotation is needed and why a longer key would render this need useless? I can't come up with a specific use case since I haven't understood the necessity as well. I only heard the term around. – user3834459 Nov 24 '18 at 15:07
  • Given that computers get faster you'll need larger key sizes in the future to get the same amount of protection you have today with shorter sizes. That's why you use large key sizes and better protection of keys for long-term storage. If short-term is enough (like with data in transit) then you can go the cheaper way: smaller key sizes, less protection of keys and instead switching to a new key often enough. – Steffen Ullrich Nov 24 '18 at 15:18

In layman's terms, rotating an encryption key implies:

  1. Generate new key(s)
  2. Re-encrypt all data that was encrypted using the old key, using new key(s)
  3. Delete old encrypted data and old encrypted key

Key rotation generally applies to data that is encrypted at rest, as opposed to something like TLS, because it reflects the need to deal with all the old stuff that's still encrypted with the old key.


The meaning of rotate is going to depend on your data owner’s security policy.

It may help to understand how keys are often managed using a key lifecycle state chart. A typical key lifecycle looks like this:

  1. Generated (new, not to be used yet)
  2. Active (encrypt/decrypt)
  3. Inactive (decrypt-only)
  4. Retired (key irrevocably destroyed)

Additionally, states can be defined for keys that are “suspect”, “lost”, and/or “compromised”.

Rules are defined regarding how and when a key will transition from one state to another, which transitions are legal, and when. You’ll also see a rule that if a key is compromised it will require all the data to be re-encrypted with a new key (among many other disaster recovery tasks.)

In some organizations a key rotation will require a rotated key to be changed to an inactive state, and a new version of the key will need to be generated for encrypting new data. When the new key is made active, the old key is made inactive. The old data remains encrypted with its same old key until the key is retired, and then the old key is destroyed. This way, the old data doesn’t have to be decrypted and then re-encrypted with the new key. The application consuming the data has to use the same version of the key that was used when the data was encrypted.

Other organizations may have no inactive state, and a key rotation will require the old key to be retired and all previously encrypted data to be re-encrypted.

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.