Home / Learn Secure SQL / Key Management Basics

Key Management Basics

Where encryption keys live, and why that question matters more than the algorithm.

Bottom lineWhere encryption keys live, and why that question matters more than the algorithm.

Breaking it down

Two key-storage choicesKey stored with/near theencrypted dataCompromising the data storealso exposes the keyDefeats much of the purpose ofencryptingKey stored in adedicated KMSSeparate access control,separate audit trailCompromising the data storealone does not expose the key
Two key-storage choices

In plain terms

Key management covers how encryption keys are generated, stored, rotated, and controlled access to; a well-chosen encryption algorithm provides little real protection if its key sits next to the encrypted data it protects, or is hard-coded in application source.

Why we use it

The question 'where does the key live, and who can access it' is usually more important in practice than which specific encryption algorithm was chosen, since a compromised or poorly-stored key undermines even a strong algorithm completely.

Under the hood

Use a dedicated key management service (a cloud provider's KMS, or HashiCorp Vault) rather than storing keys alongside the data they protect or in application source code, and define clear key rotation and access-control policies, same as the credential rotation ideas from the access control part.

Real-world use

  • Web application code review
  • Backend development
  • Database administration

Every major cloud provider offers a managed Key Management Service (KMS) designed exactly for this purpose; using it is almost always preferable to building custom key storage.

Quick quiz

1. Key management is often more important in practice than...