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?

  • 1
    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. Commented Nov 24, 2018 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. Commented Nov 24, 2018 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. Commented Nov 24, 2018 at 15:18

2 Answers 2


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 in a key-management system 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)

According to this example, the starting state for all new keys is Generated. When it’s ready for use (perhaps once you’ve configured other systems to use it), you execute an Activate state change to promote it to Active. The key will be available for encryption and decryption.

Let’s say your data owner wants keys rotated annually. You would schedule a Deactivation event for one year after the key is activated, and when the time comes, the event fires and the key is transitioned into the Inactive state. Your system will probably also generate a new key at the same time, and activate it. That’s a key rotation. While a key is inactive, your system can still use it to decrypt old data, but it can’t be used to encrypt anymore — only the new key can be used for that.

Finally, when you want the data destroyed, you have a Retirement event, and the key is transitioned to Retired state, and the bits are wiped. Data recovery becomes very difficult, depending entirely on your ability to restore keys from backups, etc. And once your key manager executes a rotation on its internal Key Encrypting Key, it’s all over - the old keys are gone, and the old backups are useless.

This isn’t the only path, of course. Additional states can be defined for keys that are “suspect”, “lost”, and/or “compromised”. All kinds of rules regarding state transitions can be created.

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.

You must log in to answer this question.

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