I started with the API surface and storage, which felt natural, but the interviewer kept pushing on the threat model before I'd even finished the basic design.
Start by clarifying requirements and scale, then design a secure, highly available KMS with clear APIs, robust key lifecycle management, and defense-in-depth. Structure your answer around core components: key generation/storage, access control, auditing, rotation, and threat model, while addressing latency, availability, and compromise scenarios.
Pro tip: Emphasize that key material never leaves the KMS in plaintext, and use envelope encryption to minimize exposure. Also, discuss how you'd handle key compromise with automated rotation and revocation, showing you think about operational security.
Ask about expected QPS, key types (symmetric/asymmetric), compliance needs (e.g., FIPS 140-2), and multi-region requirements to scope the design.
Define APIs for key creation, retrieval (encrypt/decrypt), rotation, and revocation. Specify that clients request key material by key ID, but keys are used within KMS for crypto operations to avoid exposure.
Implement strong authentication (mTLS, IAM), fine-grained authorization (ACLs, RBAC), and audit logging for all key operations. Use HSMs for key storage and envelope encryption for data.
Describe automatic rotation policies, versioning, and usage limits (e.g., max operations per key). Ensure old versions remain for decryption but not encryption.
Design for low latency with caching and geo-replication. Plan for key compromise with automated revocation, re-encryption, and blast radius minimization.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.