When to rotate
Rotate your master key when:- A team member with access to the key leaves the organization
- Your secret manager audit requires periodic rotation
- You suspect the key may have been exposed
- Compliance requirements mandate rotation (e.g., PCI DSS)
- After routine deployments
- When adding new content (each content ID gets a unique derived key)
- When revoking individual viewer access (use leases instead)
How rotation works
Step-by-step
1. Generate a new master key
2. Deploy with dual keys
Update the key server to accept both old and new keys:- New content uses the new key
- Old content still works — the key server tries the primary key first, then falls back to the old key
- Players don’t need any changes
3. Re-encrypt existing content
Use the CLI to re-encrypt content with the new key:4. Verify playback with the new key
Before removing the old key, verify that re-encrypted content plays back correctly:5. Remove the old key
Once all content has been re-encrypted and verified:FALLBACK_MASTER_KEY_HEX and FALLBACK_SALT_HEX. Delete the old key from your secret manager.
CDN cache invalidation
After re-encrypting content, invalidate the CDN cache for the affected segments:.m3u8) should already have short cache TTLs, so they’ll pick up the new EXT-X-KEY URI automatically.
Safety notes
- Never delete the old key before re-encryption is complete. Content encrypted with the old key becomes permanently inaccessible.
- Test on a single content item first. Re-encrypt one video, verify playback, then proceed with the rest.
- Keep the dual-key period short. The longer both keys are active, the larger the window of exposure if the old key was compromised.
- The salt can stay the same. If you only need to rotate the master key (not the salt), you can reuse the existing salt. However, rotating both is recommended.