Aller au contenu
uencoder

Rotate chiffrement clés safely

Clé rotation limits le blast radius de un compromised clé. Apprendre le double-chiffrement migration motif et comment en re-chiffrer données sans downtime.

  1. 1

    Key rotation replaces an old encryption key with a new one and re-encrypts all data. The challenge: doing this without downtime. The solution is the double-encryption (envelope) pattern: encrypt new data with the new key, decrypt old data on read and re-encrypt with the new key (lazy migration).

  2. 2
    Chiffreur AES →

    Chiffrer new data with the new key (K2). Store a key version indicator alongside the ciphertext so the decryptor knows which key to use.

  3. 3
    Déchiffreur AES →

    Déchiffrer old data (encrypted with K1) on read. After successful decryption, immediately re-encrypt with K2 and update the stored ciphertext. This is lazy migration — data is migrated as it is accessed.

  4. 4
    Calculatrice de hash →

    Hash the key version metadata to detect tampering. An attacker should not be able to downgrade a record to an old key version.

  5. 5

    After all records are migrated to K2, retire K1. Keep K1 in cold storage for a grace period in case of missed records. For envelope encryption (AWS KMS pattern), rotate the master key but keep data keys — re-encrypt only the wrapped data keys, not the bulk data.

Questions fréquentes

How often should I rotate keys?
It depends on the threat model. Compliance frameworks may require annual rotation. For high-value targets, rotate quarterly or after any suspected compromise. The rotation cost should be factored into the decision.
What is envelope encryption?
A master key (in a KMS/HSM) encrypts data keys, which encrypt the actual data. To rotate, only re-encrypt the data keys with the new master key — the bulk data stays encrypted with the same data key. This is far cheaper than re-encrypting all data.

Workflows résolvant cette tâche

Outils associés