# What Is Key Rotation? Definition and Examples

> Key rotation is replacing a cryptographic key with a newly generated one, on a schedule or after an incident, to limit the damage of a compromise.

Source: https://ssl.sh/glossary/key-rotation/
Last updated: 2026-11-10

Key rotation means retiring a key and switching to a freshly generated one. For TLS servers it usually happens at certificate renewal: instead of reusing the old [private key](https://ssl.sh/glossary/private-key/) in a new CSR, you generate a new key pair. Certbot does this by default on every renewal unless you pass `--reuse-key`. Rotation also applies to CA keys, which are replaced by new roots and intermediates over time, and to [session ticket](https://ssl.sh/glossary/session-ticket/) keys, which servers should change frequently to preserve forward secrecy.

## Why it matters
A key that is never changed accumulates exposure in backups, old servers and former staff laptops. Regular rotation bounds how long an undetected leak stays useful. As maximum certificate validity drops (200 days from 2026-03-15, 47 days from 2029-03-15), automated renewal makes per-renewal rotation nearly free. Rotation must be coordinated with anything that references the key directly, such as [certificate pinning](https://ssl.sh/glossary/certificate-pinning/) or DANE [TLSA](https://ssl.sh/glossary/tlsa/) records of type 3 1 1: publish the new key's hash first, wait for caches to expire, then switch.

## Example
```bash
# pre-generate the next key and publish its TLSA record before switching
openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out next.key
openssl pkey -in next.key -pubout -outform DER | openssl sha256
# -> add "_25._tcp.mail.example.com. IN TLSA 3 1 1 <hash>" next to the current record
```

## Common misconceptions
- **Renewing a certificate rotates the key.** Only if a new key was generated; some tools and many manual workflows reuse the old one.
- **Rotation is only needed after a breach.** Scheduled rotation limits the damage of compromises you never detect.
- **Rotating a key requires revoking the old certificate.** Revocation is for compromise; after a routine rotation the old certificate can simply expire.

## Related terms

- [私钥](https://ssl.sh/zh/glossary/private-key/): 私钥是非对称密钥对中保密的那一半，TLS 服务器用它证明自己拥有证书里的那把公钥。
- [证书续期](https://ssl.sh/zh/glossary/certificate-renewal/): 证书续期是在证书到期前申请一张新证书来替换它，最好全自动完成并同时更换密钥对。
- [证书锁定](https://ssl.sh/zh/glossary/certificate-pinning/): 证书锁定是客户端侧的一项检查：只有服务器证书链中包含事先配置好的特定证书或公钥时，客户端才接受这次连接。
- [TLSA 记录](https://ssl.sh/zh/glossary/tlsa/): TLSA 记录是一种 DNS 记录，声明某个端口和协议上的 TLS 服务必须出示哪张证书或哪个公钥，供 DANE 校验使用。
- [DANE](https://ssl.sh/zh/glossary/dane/): DANE 是一种利用经 DNSSEC 签名的 TLSA 记录，把 TLS 服务器的证书或公钥与其域名绑定起来的协议。
- [Session Ticket](https://ssl.sh/zh/glossary/session-ticket/): Session Ticket 是服务器交给客户端保管的加密会话状态，客户端下次连接时出示它即可恢复会话，服务器无需保存任何状态。
- [HSM](https://ssl.sh/zh/glossary/hsm/): HSM 是一种防篡改的硬件设备，在内部生成、保存并使用密钥，私钥不会以明文形式离开设备。
- [证书吊销](https://ssl.sh/zh/glossary/revocation/): 证书吊销是 CA 在证书到期前宣布其作废的操作，通过 CRL 或 OCSP 对外公布，使客户端不再信任这张证书。
