Tutorial 4: Key Lifecycle and Secrets

Unit 2 ยท Cryptography and key management

Objectives

A key lifecycle begins with generation and continues through activation, distribution, use, rotation, suspension, revocation, archival, and destruction. Secrets in source code, images, logs, or chat persist longer than expected. Central secret managers, access policies, audit trails, and short-lived credentials reduce exposure.

application -> workload identity -> secret manager -> short-lived credential
operator request -> approval + audit -> controlled access

Rotation must be compatible with overlapping old and new keys, rollback, and recovery. Backups of encrypted data are useless if the keys are lost, but a broadly accessible backup key defeats isolation. Document custodians, dual control, and emergency procedures.

Exercises

  1. Create a lifecycle for an API signing key.
  2. Find secret leakage paths in a deployment pipeline.
  3. Design break-glass access with approval and logging.

Self-check

  1. Why rotate keys?
  2. Why use short-lived credentials?
  3. What is break-glass access?

Self-Check Quiz

1. Where should application secrets normally live?

AnswerIn a managed secret system with scoped access, auditability, and controlled rotation, not source code or committed configuration.

2. What must rotation include besides generating a new key?

AnswerDistribution, overlap or cutover, validation, revocation of the old key, rollback planning, and recovery testing.

Homework

  1. Review the key lifecycle of a multi-service platform.
  2. Specify access, rotation, and recovery controls.
  3. Write an incident response step for a leaked credential.
Sample answerContain the credential, identify scope and use, revoke or disable it, issue a replacement through the secret manager, search logs and repositories for propagation, repair the leakage path, and document evidence and residual risk.