Zum Inhalt springen
uencoder

Rotate Verschlüsselung Schlüssel safely

Schlüssel rotation limits der blast radius von ein compromised Schlüssel. Lernen der double-Verschlüsselung migration Muster und wie in re-verschlüsseln Daten ohne 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
    AES-Verschlüsseler →

    Verschlüsseln 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
    AES-Entschlüsseler →

    Entschlüsseln 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
    Hash-Rechner →

    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.

Häufige Fragen

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, die diese Aufgabe lösen

Verwandte Tools