跳到主要内容
uencoder

Rotate 加密关键安全

键 rotation limits blast 半径的 compromised 键. Learn 双-加密 migration 模式和 如何re-加密数据无 downtime.

  1. 1

    键 rotation replaces 旧加密键 具有新 one 和 re-encrypts 所有数据. challenge: 此无 downtime. 解决方案是 双-加密 (envelope) 模式: 加密新 数据具有新 键, 解密旧 数据开 读取和 re-加密具有新 键 (lazy migration).

  2. 2
    AES 加密器 →

    加密 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 解密器 →

    解密 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 键 version 元数据到 检测 tampering. attacker 应该不 是 able 到 downgrade 记录到 旧键 version.

  5. 5

    之后所有 records 是 migrated 到 K2, retire K1. Keep K1 在 cold storage 为 grace 周期在 情况的 missed records. 为 envelope 加密 (AWS KMS 模式), rotate 主键 但 keep 数据关键 — re-加密仅 wrapped 数据关键, 不 bulk 数据.

常见问题

如何经常应该 I rotate 关键?
它 depends 开威胁模型. Compliance frameworks 可以 require annual rotation. 为高-值目标, rotate quarterly 或之后任何 suspected compromise. rotation 成本应该是 factored 为 decision.
什么是 envelope 加密?
主键 (在 KMS/HSM) encrypts 数据关键, 哪个加密 actual 数据. 到 rotate, 仅 re-加密数据关键具有新 主键 — bulk 数据 stays encrypted 具有相同数据键. 此是 far cheaper than re-encrypting 所有数据.

解决此任务的工作流

相关工具