Key Rotation
Key lifecycle
Section titled “Key lifecycle”Each Cosmictron signing key has a lifecycle:
Generated ──► Active ──► Retiring ──► Retired │ Cross-signed by new key- Active — used to sign new events
- Retiring — new key is now active; old key is kept for verification of historical events
- Retired — key is archived; its public key remains in the key registry for verification
Rotating the signing key
Section titled “Rotating the signing key”-
Generate the new key
Terminal window cosmictron-cli keys generate --type ed25519 --name signing-2026-04 -
Cross-sign the new key with the old key
This produces a certificate binding the new public key to the old key’s trust chain:
Terminal window cosmictron-cli keys cross-sign \--old-key signing-2025-10 \--new-key signing-2026-04 -
Activate the new key
Terminal window cosmictron-cli keys activate signing-2026-04From this point, new events are signed with the new key. Old events remain valid under the old key.
-
Verify continuity
Terminal window cosmictron-cli audit verify --check key-continuityThe verifier confirms that every event is signed by a key in the continuous trust chain.
-
Retire the old key
After a retention period (typically 90 days):
Terminal window cosmictron-cli keys retire signing-2025-10
Key registry
Section titled “Key registry”The key registry records all keys and their lifecycle state:
cosmictron-cli keys listID Status Created Expiressigning-2025-10 retiring 2025-10-01T00:00:00 2026-04-01T00:00:00signing-2026-04 active 2026-04-01T00:00:00 2026-10-01T00:00:00Emergency key rotation
Section titled “Emergency key rotation”If a key is compromised:
# Immediately stop signing with the compromised keycosmictron-cli keys revoke signing-2025-10 --reason "key compromise"
# Generate emergency replacementcosmictron-cli keys generate --type ed25519 --name signing-emergency-2026-04
# Activate immediately (cannot cross-sign from compromised key)cosmictron-cli keys activate signing-emergency-2026-04 --emergencyAutomated rotation
Section titled “Automated rotation”Set a rotation schedule in config.toml:
[compliance.key_rotation]rotation_interval_days = 180auto_cross_sign = truenotify_on_rotation = "compliance@yourorg.com"Key storage recommendations
Section titled “Key storage recommendations”| Environment | Recommendation |
|---|---|
| Development | File system (keys/ directory) |
| Staging | HashiCorp Vault or AWS Secrets Manager |
| Production | HSM (Hardware Security Module) or Vault with HSM backend |
| Multi-party | FROST threshold shares distributed across key holders |