Key management is the set of policies, procedures and controls that govern cryptographic keys through their lifecycle: generation, distribution, storage, use, rotation, revocation and destruction. NIST's SP 800-57 framework states that the security of encrypted information depends on the strength of the keys and the protection provided to them. Most use a key management system such as AWS KMS, Azure Key Vault or Google Cloud KMS, backed by hardware security modules for high-value keys.
Key takeaways
- Encryption is only as strong as its keys: NIST states that the security of encrypted data directly depends on key strength and key protection.
- Every key has a lifecycle — generate, distribute, store, use, rotate, revoke, destroy — and a cryptoperiod that limits how long it may be used.
- Use a managed KMS with envelope encryption and hardware-backed storage; never store keys in code, config files or plain text.
Encryption gets the headlines, but keys do the work. A 256-bit algorithm is mathematically strong; the key that drives it is a string of bits that can be stolen, leaked, forgotten or left in a config file. When encryption fails in practice, the key is usually the reason.
What is key management?
Key management is the set of policies, procedures and technical controls that govern cryptographic keys through their entire lifecycle: generation, distribution, storage, use, rotation, revocation and destruction.
NIST's foundational guidance, SP 800-57 Part 1, frames it around two ideas: a defined set of key states that every key moves through, and a cryptoperiod — the bounded span of time a given key is authorized for use. A key does not just exist; it is pre-activated, made active, eventually deactivated and destroyed, and a well-run system knows which state each key is in at all times.
The stakes are stated bluntly in the NIST standard itself: the security of information protected by cryptography directly depends on the strength of the keys, the effectiveness of the cryptographic mechanisms and protocols associated with the keys, and the protection provided to the keys. Secret and private keys need to be protected against unauthorized disclosure, and all keys need to be protected against modification.
In plain terms: encryption converts your data into unreadable ciphertext, and the key converts it back. Whoever holds the key holds the data. Key management is the discipline of making sure the right systems hold the right keys — and nobody else does.
Why does key management matter?
Key management matters because a strong cipher with a weak key is a weak system. Attackers rarely break the mathematics; they steal the key, find it in a repository, or exploit a system that never rotated it.
Consider the failure modes. A key hard-coded in source code ends up in a public repository. A key stored in plain text on a server is copied in a breach. A key that was never rotated protects ten years of data, so one compromise exposes a decade. A key with no backup is lost in a hardware failure, and the data it protected becomes permanently unreadable.
Regulation makes the discipline mandatory, not optional. PCI DSS v4.0 imposes explicit obligations on how keys must be managed for card data, and HIPAA and FIPS 140-2/140-3 impose similar requirements for health data and government systems. An auditor's first question about encryption is rarely which algorithm you use — it is how you manage the keys.
Key management also decides whether you can recover. If a key is lost and there is no backup, the data it protects is gone for good. That is why the lifecycle includes backup and destruction as first-class stages, not afterthoughts.
What are the stages of the key lifecycle?
The key lifecycle has six stages, and each one has specific security requirements. A failure at any stage undermines the whole system, no matter how strong the other stages are.
| Stage | What happens | Key control |
|---|---|---|
| 1. Generation | Key created from a random source | Certified random-bit generator; generate inside the HSM |
| 2. Distribution | Key delivered to authorized systems | Key-encrypting keys or asymmetric wrapping; never plain text |
| 3. Storage | Key rests until needed | HSM or encrypted key store; split knowledge for manual handling |
| 4. Use and rotation | Key encrypts, decrypts or signs | Least-privilege access; full audit logging; rotate on schedule |
| 5. Revocation | Compromised key marked invalid | Immediate revocation; re-encrypt affected data |
| 6. Destruction | Key retired permanently | Cryptographic erasure of all copies, including backups |
Generation: start with real randomness
Keys must be generated using a cryptographically secure random number generator with sufficient entropy. Weak entropy — a predictable seed, a user-chosen passphrase, a bad random source — fatally undermines the key no matter how long it is.
The safest practice is to generate the key inside the boundary of the device that will store and use it, for example inside an HSM, so the key material never exists in plain text outside that boundary.
Distribution: never send a key in plain text
Keys must travel to authorized destinations through secure channels. Symmetric keys are protected in transit by wrapping them with a key-encrypting key; public keys travel openly because only the private half is sensitive. Manual distribution must use split-knowledge procedures, so no single person ever holds a whole key.
Storage: protect keys like the data they guard
Keys at rest need the same care as the data they protect. That means hardware-backed storage for high-sensitivity keys, encrypted key stores, and strict access control over who — and which systems — can read them.
Use and rotation: limit what one key can lose
Access to keys must be restricted to authorized systems and users with a documented need, and every use should be logged. Rotation replaces a key before its cryptoperiod expires, which limits the volume of data any single key protects and bounds the damage from an undetected compromise.
Revocation and destruction: end the key cleanly
Revocation immediately invalidates a compromised or superseded key so it can no longer decrypt data or authenticate. Destruction must erase all copies, including backups — a key that survives in a backup is not destroyed. AWS KMS adds a 7-to-30-day waiting period before permanent deletion, so a mistaken delete can be reversed.
Symmetric vs asymmetric keys: what's the difference?
Symmetric keys use one shared secret for both encryption and decryption, while asymmetric keys use a public key to encrypt and a private key to decrypt. Most systems use both: asymmetric keys to exchange a symmetric key, then symmetric encryption for the data itself.
| Symmetric keys | Asymmetric keys | |
|---|---|---|
| Keys | One shared secret (e.g. AES-256) | Public and private key pair (e.g. RSA, ECC) |
| Speed | Fast; used for bulk data | Slow; used for key exchange and signatures |
| Distribution problem | Sharing the secret securely is hard | Public key can travel openly |
| Main risk | Secret leaks and the data is open | Private key theft; needs certificate management |
| Key management focus | Rotation, wrapping, access control | Private key protection, certificates, revocation |
The management burden differs. Symmetric keys are simpler but harder to distribute, because every party that needs the key must receive the same secret without exposing it. Asymmetric keys solve distribution but add certificate management: you must know which public key belongs to whom, and revoke it when the private key is compromised.
TLS uses both — an asymmetric handshake to agree on a symmetric session key, then symmetric encryption for the traffic.
What is a key management system (KMS)?
A key management system is the governance layer for cryptographic keys. It enforces consistent policy across an organization: generation standards, rotation schedules, access controls and audit logging, in one place instead of scattered across applications.
AWS describes its KMS as giving you control over the lifecycle and permissions of your keys, with the ability to control who can manage keys separately from who can use them, as documented in the AWS KMS documentation. That separation of duties is central: the person who administers the system should not necessarily be able to use the keys it holds.
A KMS typically handles key creation, storage, rotation, access policy, usage logging and deletion scheduling. It integrates with the services around it — storage, databases, compute — so applications encrypt data without ever seeing the master key. Every use is logged, so you can answer the auditor's question: who used which key, on what, and when?
| KMS | Best for | Standout feature | Hardware backing |
|---|---|---|---|
| AWS KMS | AWS estates | Envelope encryption in every AWS service; External Key Store | FIPS 140-3 Level 3 HSMs |
| Azure Key Vault | Azure estates | Entra ID access control; Managed HSM tier | Premium: FIPS 140-3 Level 3 (new keys) |
| Google Cloud KMS | Google Cloud estates | External Key Manager for sovereignty | Cloud HSM: FIPS 140-2 Level 3 |
| HashiCorp Vault | Multi-cloud, DevOps teams | Encryption-as-a-service; dynamic secrets | FIPS 140-2 Level 3 with a Level 3 HSM |
| Thales CipherTrust | Enterprise, multi-cloud custody | Bring and hold your own key | BYOK/HYOK via Luna HSM |
The practical rule is simple: start with the native KMS of the cloud you already run in. It is usage-priced, deeply integrated and publishes its rates. Add a multi-cloud or enterprise platform only when custody, sovereignty or multi-cloud policy forces you to.
KMS vs HSM: what's the difference?
A KMS manages keys; an HSM protects them in hardware. The two are complementary, and most serious setups use both.
An HSM is a tamper-resistant hardware device that generates, stores and uses cryptographic keys inside a protected boundary. Key material never leaves the device in plain text, and the hardware resists physical tampering — it can zeroize its keys if someone opens the case. HSMs are validated against FIPS 140-2 or FIPS 140-3, with Level 3 as the common bar for high-assurance use.
The difference in practice is custody and control. A cloud KMS holds your keys in the provider's HSM fleet; you control access policy, but the provider operates the hardware. A dedicated HSM — on-premises, or a cloud Managed HSM tier — gives you a single-tenant device where even the provider cannot access key material.
Azure illustrates the tiers well: Key Vault Standard protects keys with software cryptographic modules, Premium adds HSM-protected keys, and Managed HSM is a separate single-tenant FIPS 140-3 Level 3 service where the customer controls the security domain. Choose the tier that matches the sensitivity of the data, not the size of the budget.
How does envelope encryption work?
Envelope encryption protects data with two keys instead of one: a short-lived data key encrypts the data, and a master key in the KMS encrypts the data key. Only the encrypted data key travels with the data.
The pattern solves two problems at once. First, speed: symmetric data keys encrypt large files quickly, while the master key is used only for the small job of wrapping them. Second, rotation: rotating the master key only re-wraps the data keys, so you do not have to re-encrypt every file.
It also makes access control enforceable. To read data, an application must have permission to use the master key in the KMS, and that use is logged. Revoke the permission and the data becomes unreadable — even though the ciphertext never moved. That property, cryptographic erasure by key destruction, is how cloud providers delete data on request.
Key management best practices
Good key management is mostly discipline, not technology. These practices cover the failures that cause real incidents.
- Generate keys in hardware. Use a certified random source and generate keys inside the HSM or KMS boundary whenever possible.
- Centralize in a KMS. One system, one policy, one audit trail. Scattered keys in config files and code are unmanageable by definition.
- Separate duties. Key custodians govern the lifecycle, key users perform cryptographic operations, and key administrators manage the infrastructure. No one role should do all three.
- Automate rotation. Manual rotation gets skipped. Cloud KMS services rotate customer keys automatically on a schedule you set, and older key versions stay available to decrypt previously encrypted data.
- Log every use. Every key operation should be recorded with who, what and when. AWS KMS integrates with CloudTrail for exactly this, and the other cloud KMS services have equivalents.
- Back up keys under a different key. A lost key means lost data, so back up — but protect the backup with its own key and its own access controls.
- Plan for the post-quantum transition. Build crypto-agility now: the ability to swap algorithms through configuration rather than rebuilding every application that touches a key.
- Automate certificate lifecycles too. TLS certificates are keys with expiry dates, and the CA/Browser Forum has been shortening maximum lifetimes: 398 days now, dropping to 200 days in March 2026, 100 days in 2027 and 47 days in 2029. Manual renewal will not keep up.
Check your own TLS setup while you are at it: our free SSL checker shows your certificate chain, expiry and configuration in seconds.
Common key management mistakes
The same mistakes appear in incident after incident. Avoiding them covers most of the risk.
Keys in code and config. Hard-coding a key in source code, a config file or an environment variable that gets committed is the most common key management failure. Use a secrets manager or KMS, and scan repositories for leaked keys.
One key for everything. A single key that protects all data means one compromise exposes everything. Use unique data keys per object or session, wrapped by a small number of master keys.
Never rotating. A key that has protected data for years is a bigger prize than one rotated last month, and the volume of data it protects grows every day. Set cryptoperiods and automate them.
No revocation plan. Teams that cannot revoke a key quickly will hesitate when they need it most. Practice revocation the way you practice backups: rehearse it before the incident.
Deleting without a waiting period. Deleting a key destroys the data it protects. Use the KMS soft-delete window, and require a second approver for key deletion — the same way you would for deleting a production database.
Forgetting the human side. Keys need owners, documented procedures and trained custodians. A KMS with no named owner and no runbook is a system that fails the first time its only expert goes on holiday. If your team handles certificates too, our guide to what DMARC is shows the same lifecycle thinking applied to email authentication.
The bottom line
Key management is the unglamorous half of encryption, and it is the half that decides whether encryption works. Generate keys with real randomness, store them in hardware-backed systems, rotate them on schedule, log every use and destroy them cleanly.
Start with the native KMS of the cloud you already use, turn on automatic rotation, and separate who can manage keys from who can use them. Then check the certificates that depend on those keys: our free SSL checker will tell you what expires soon and what needs attention.
Frequently asked questions
What is key management in simple terms?
Key management is everything you do with encryption keys besides the encryption itself: creating them safely, giving them to the right systems, storing them where attackers cannot reach them, replacing them on schedule, and destroying them securely when they retire. If encryption is the lock, key management is deciding who holds the keys and what happens when one is lost.
What is the difference between a KMS and an HSM?
A KMS is a service that manages keys through their lifecycle: generation, storage, rotation, access control and audit logging. An HSM is tamper-resistant hardware that generates and uses keys inside a protected boundary so key material never leaves the device. Most cloud KMS services run on HSMs behind the scenes, and high-assurance setups add a dedicated HSM tier.
What is a cryptoperiod?
A cryptoperiod is the bounded span of time during which a specific key is authorized for use, as defined in NIST SP 800-57. When the cryptoperiod expires, the key must be replaced. Cryptoperiods limit how much data any single key protects and how much damage a compromise can do.
How often should encryption keys be rotated?
It depends on the key's use, the sensitivity of the data and the volume protected. NIST SP 800-57 recommends cryptoperiods based on algorithm, key size and data sensitivity. As a rule, automate rotation where you can: cloud KMS services rotate customer keys automatically on a schedule you control, and data keys should be unique per object or session.
What is envelope encryption?
Envelope encryption encrypts data with a short-lived data key, then encrypts that data key with a master key stored in a KMS. Only the encrypted data key travels with the data, so the master key never leaves the KMS. It lets you encrypt large amounts of data fast while keeping the master key under central control and audit.
What happens if an encryption key is lost?
If a key is lost and there is no backup, the data it protects is unrecoverable — permanently. That is why key management separates duties: keys are backed up under the control of a different key, access is logged, and deletion usually has a waiting period — 7 to 30 days in AWS KMS — so a mistaken delete can be reversed.
Is key management the same as password management?
No. Password management stores human credentials for logging in. Key management governs cryptographic keys used by systems to encrypt data, sign software and authenticate services. The principles overlap — protect the secret, control access, rotate it — but keys are machine credentials managed by infrastructure, not secrets a person types.
Sources
- NIST — Recommendation for Key Management, Part 1: General (SP 800-57 Part 1 Rev. 5)
- AWS — AWS Key Management Service Documentation
- Google Cloud — Key Management Service
- Microsoft Learn — About Azure Key Vault keys
- HashiCorp — Vault HSM and seal wrap
- Thales — CipherTrust Cloud Key Manager for AWS External Key Store
- DigiCert — TLS certificate lifetimes will officially reduce to 47 days
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against NIST SP 800-57 Part 1 Rev. 5, AWS KMS documentation, Google Cloud KMS documentation, Azure Key Vault documentation, HashiCorp Vault documentation and Thales key management documentation, with vendor service details from each provider's published pages.
How we write and fact-check →