Skip to the guide

Secrets and key management

IntermediateConcept3 pages

Every system runs on secrets: database passwords, payment API keys, the key that signs tokens, the keys that encrypt data at rest. Interviewers ask where they live, how a service gets them without yet another password, how they change without downtime, and how you encrypt petabytes without sending them through a key service.

The caretaker's office

In a large block of flats, the caretaker keeps every key in his office. Staff sign keys out with their staff badge, and he logs each one. The spare key for each flat sits in a sealed envelope by that flat's door; only the caretaker can open the envelopes, and only in his office, so a burglar who finds one has a sealed envelope and nothing more. His own seal never leaves the office. And for contractors, he cuts keys that stop working at 6 pm.

  • the office → a key management service (KMS) and a secrets manager
  • the logbook → an audit log of every use
  • showing a staff badge → workload identity: the platform vouches for the service, no stored password
  • the sealed envelope by each door → a data key, stored encrypted next to the data it protects (envelope encryption)
  • the seal that never leaves → the root key, kept in the KMS's hardware
  • keys that stop at 6 pm → short-lived, dynamic credentials