Key management: the life of a key
A strong algorithm protects nothing if its key is guessable, copied, kept too long or lost. Key management is the care of keys from the moment they are made until they are destroyed: how they are created, shared, stored, changed, backed up, controlled and finally erased. It is like the rules a bank keeps for its vault keys and combinations. No background beyond the earlier cryptography is assumed. Most practical failures of cryptography are failures here.
By the end of this unit you will be able to:
- Put in order the states of a key from pre-activation to destruction
- Explain key wrapping and tell apart key-encrypting keys, data-encrypting keys, master keys and session keys
- Explain what a cryptoperiod is and choose the factors that shorten or lengthen it
- Tell apart split knowledge, dual control, M of N control and key escrow
- Choose the access controls and the response for a key that may have been compromised
The backups only one volunteer could open
An illustrative example
A small charity encrypts its nightly backups of donor records. A volunteer set it up and kept the key in a file on his own laptop. Nobody else ever asked for it.
The volunteer moves abroad and stops answering email. Six months later the charity's server fails. The backups are complete, current and unreadable.
What arrangement would have let the charity open its backups without trusting any one person with the key?
A key is born, used and destroyed
Every key passes through a set of key states, from creation to destruction. Each state says what the key may do.
- Pre-activation
- Generated but not yet authorised for use.
- Active
- May be used to protect information, for example to or sign, and to process it.
- Suspended
- Use paused for a time, for example while a possible loss is investigated.
- Deactivated
- No longer used to protect new information. It may still or verify what it protected earlier.
- Compromised
- Known or suspected to be in unauthorised hands. Used, at most, to process old information with great care.
- Destroyed
- Erased. A record that it existed may remain in logs.
A key moves through six states from creation to erasure
Read this figure as text
Every key passes through a set of key states, from creation to destruction, and each state says what the key may do. A key moves to compromised on suspicion alone, because waiting for proof leaves an attacker free to use it.
- Pre-activation: the key has been generated but is not yet authorised for use. When it is authorised it becomes active. A key that is never used goes straight to destroyed.
- Active: the key may protect information, for example to encrypt or sign, and process it. Its use can be suspended for a time, for example while a possible loss is investigated, and later resumed.
- When its cryptoperiod ends, an active key is deactivated. It protects nothing new but may still decrypt or verify what it protected earlier, and it may be archived for as long as old data must be read.
- From active or suspended, a key becomes compromised as soon as compromise is suspected, not only when it is proved. It is used, at most, to process old information with great care.
- Deactivated and compromised keys are destroyed when no longer needed, by zeroisation. A record that the key existed may remain in logs.
A key moves to compromised on suspicion alone. Waiting for proof leaves an attacker free to use it.
Making keys and getting them where they are needed
A key must be unpredictable. It is produced by an approved random bit generator, a component designed to give output that cannot be guessed. Keys made from the time of day, a name or a weak password can be found by an attacker who repeats the method.
A hardware security module (HSM) is a tamper-resistant device that generates, stores and uses keys inside itself, so that sensitive keys never appear in ordinary memory. Independent laboratories test such modules against Federal Information Processing Standard (FIPS) 140-3, the United States standard for such modules, which sets four security levels.
Keys reach the other party in three ways.
- Out-of-band: by a separate route, such as a courier or a sealed letter.
- Key transport: one party chooses the key and sends it encrypted under the recipient's public key.
- Key agreement: both parties contribute, as in Diffie-Hellman, and the key never travels.
Key derivation produces further keys from an existing secret by a fixed calculation, so that one master secret can give many working keys without each being delivered.
Storing keys, and keys that protect keys
A key stored in plain form beside the data it protects protects nothing. Keys are kept in an HSM, in a key management service, or encrypted under another key.
Key wrapping is encrypting one key with another , in a way that also detects any change to it.
- Data-encrypting key (DEK)
- Encrypts the data itself. Often one for each file, disk or database.
- Key-encrypting key (KEK)
- Encrypts other keys, never data. It stays in the HSM; wrapped data keys can be stored beside the data.
- Master key
- A long-lived key at the top of a hierarchy, from which other keys are protected or derived.
- Session key
- A short-lived key for one connection or exchange, discarded afterwards.
The hierarchy keeps the most valuable key in the fewest places. Thousands of wrapped data keys can be stored anywhere, because each is useless without the one key-encrypting key held in the HSM.
Common misconception
“Storing an encryption key next to the data it protects defeats the point of encrypting.”
That is true of a key in plain form. A wrapped key is itself encrypted, and is safe beside the data so long as the key-encrypting key is held elsewhere.
Rotation and the cryptoperiod
A cryptoperiod is the length of time a particular key is authorised for use. Rotation is replacing a key with a new one at the end of its , or sooner if needed.
A limited cryptoperiod limits how much data an attacker can study under one key, how much is exposed if the key leaks, and how long an attacker has to steal or break it.
| Shorter when | Longer is acceptable when |
|---|---|
| The key protects a large volume of data or transactions | Little data is protected |
| The key is held in software on ordinary computers | The key never leaves a validated HSM |
| Many devices or people share one copy | One system alone holds the key |
| Staff who handled the key leave | Handling staff are stable and vetted |
| The threat is strong or the algorithm is ageing | The has a wide safety margin |
A compromised key's cryptoperiod ends at once, whatever the schedule said.
Escrow, recovery and shared control
Losing a key loses everything it encrypted. Key escrow is lodging a copy of an with a trusted party. Key recovery is the authorised retrieval or rebuilding of a lost key from a backup, an archive or an escrowed copy. Recovery is usually carried out by named recovery agents, whose actions are logged. Signing keys are not escrowed, because a second copy weakens .
Three controls stop one person acting alone, and a fourth, escrow, is often confused with them.
| Control | What it means | Example |
|---|---|---|
| Split knowledge | The key is divided into parts; no single part reveals anything about it | Two clerks each hold a random-looking component; the master key is the two combined, and neither component alone reveals any of it |
| Dual control | Two or more people must act together to carry out a task; none can do it alone | Two officers must both present cards to open the HSM's administration |
| M of N control | The key is split into N shares; any M of them rebuild it, and fewer reveal nothing | Any 3 of 5 directors can restore the backup key |
| Key escrow | A copy of the key is lodged with a trusted third party | A bank holds the charity's backup key in a sealed envelope |
Split knowledge is about who holds the secret; dual control is about who must be present to act. They are often used together.
Key archival keeps a deactivated key, protected, for as long as old data must stay readable. When nothing needs it, the key is destroyed by zeroisation: overwriting it so its value cannot be retrieved.
Who may touch a key, and what to do when one leaks
Access to keys is managed like access to the most sensitive data.
- : a program or person gets only the key uses its job needs, such as decrypt but not export.
- : the who administer keys are not the users who rely on them.
- : every creation, use, export and deletion of a key is recorded and reviewed.
When a key is suspected compromised, the response follows a fixed order.
- Mark the key compromised and stop using it to protect anything new.
- Revoke any that carries it, so refuse it.
- Generate and distribute a replacement.
- Re-protect data and keys that the old key protected.
- Find out how the compromise happened and close that route.
Worked example: Three of five directors restore the charity's backup key
After the loss, the charity makes a new backup key and splits it into 5 shares under M of N control, with M = 3. Each of its five directors holds one share on a sealed card.
- The server fails again. Directors A, C and E bring their cards. Three shares are present, so the key is rebuilt and the backups are restored.
- Director B has lost his card. Four shares remain, more than the three needed, so nothing is lost. A new key and five new shares are made, because a lost share may have been found by someone.
- Two directors plot to read donor records. Two shares are fewer than three, and reveal nothing about the key.
- The rebuilding is done with two trustees present and recorded in the log, which adds dual control to the split.
No single director can read the backups, any two cannot, and the loss of one or two cards does not lose the data.
A question, worked through
An insurer holds 40 terabytes of encrypted customer files. A new policy requires the key protecting them to be rotated every year. Encrypting all 40 terabytes again would take about three weeks and slow every system. The architect asks the security manager to choose a design.
Which design BEST meets the yearly rotation requirement?
Decide on your answer, then open the reasoning
- The requirement is a yearly rotation of the protecting key, at a cost the business can bear.
- Rule out c. It breaks the policy by changing the period instead of the key.
- Rule out d. It has the right structure and rotates nothing.
- Between a and b: both rotate yearly. Option b re-encrypts 40 terabytes, with three weeks of slower systems every year.
- Option a re-wraps only the small data keys under the new key-encrypting key, which takes minutes. Data keys are then replaced on their own schedule as files change.
Answer: A. Encrypt files with data keys wrapped by a key-encrypting key, and rotate the wrapping key yearly
Choosing between good answers
- A question asks how to stop one person from recovering or using a key alone
- choose split knowledge or M of N control for holding it, and dual control for acting on it.
- An organisation must be able to read encrypted data if a key holder is unavailable
- choose key escrow or recovery agents for encryption keys. Never escrow signing keys.
- A key is only suspected of compromise
- treat it as compromised now. Do not wait for proof or for the next scheduled rotation.
- A question asks how to rotate the key over a large store of encrypted data cheaply
- choose key wrapping: rotate the key-encrypting key and re-wrap the data keys.
Check your understanding
4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.
These questions are drafts that no named reviewer has approved yet.
Question 1 of 4
What to remember
- Key states run pre-activation, active, suspended, deactivated, compromised and destroyed. Suspicion alone moves a key to compromised.
- Keys come from approved random generators and are best generated, stored and used inside a hardware security module.
- Key wrapping protects data keys with a key-encrypting key, so only one key needs the strongest protection and rotation is cheap.
- A cryptoperiod limits how long a key is used. It ends at once when the key is compromised.
- Split knowledge divides the secret, dual control requires people to act together, M of N lets any M of N shares rebuild a key, and escrow lodges a copy with a trusted party.
- Keys are governed by least privilege, separation of duties and logging, and destroyed by zeroisation.
Say it from memory
Name the main key management practices from generation to destruction, including rotation and access management.
Generate keys with an approved random generator, ideally in an HSM. Distribute them out-of-band, by key transport or by key agreement. Store them wrapped under a key-encrypting key. Rotate them at the end of each cryptoperiod, or at once on compromise. Back up encryption keys by escrow or recovery agents, using split knowledge, dual control or M of N. Control access by least privilege, separation of duties and logging. Archive, then destroy by zeroisation.
How does a deactivated key differ from a compromised key, and when does a key move to compromised?
A deactivated key is no longer used to protect new information, but may still decrypt or verify what it protected earlier. A compromised key is known or suspected to be in unauthorised hands and is used, at most, to process old information with great care. A key moves to compromised on suspicion alone.
What is key derivation, and what are the three ways a key reaches the other party?
Key derivation produces further keys from an existing secret by a fixed calculation, so one master secret gives many working keys without each being delivered. Keys travel out-of-band by a separate route, by key transport under the recipient's public key, or by key agreement, where both contribute and the key never travels.
How does a data-encrypting key differ from a key-encrypting key, and why is a wrapped key safe beside the data?
A data-encrypting key encrypts the data itself, often one per file, disk or database. A key-encrypting key encrypts other keys, never data, and stays in the HSM. A wrapped key is itself encrypted, so it is useless without the key-encrypting key held elsewhere.
How does split knowledge differ from dual control, and what is M of N control?
Split knowledge divides the key into parts so no single part reveals anything; it is about who holds the secret. Dual control requires two or more people to act together; it is about who must be present to act. M of N control splits the key into N shares, any M of which rebuild it.
In what order do you respond when a key is suspected compromised?
Mark the key compromised and stop using it to protect anything new. Revoke any certificate that carries it. Generate and distribute a replacement. Re-protect data and keys the old key protected. Find out how the compromise happened and close that route.
Sources
- NIST SP 800-57 Part 1 Rev. 5: Recommendation for Key Management, NISTKey states; the compromised state entered on suspicion; key wrapping, key-encrypting and data-encrypting keys; key derivation; key recovery; split knowledge with k of n shares; the definition, purposes and factors of a cryptoperiod; private signature keys not archived.
- FIPS 140-3: Security Requirements for Cryptographic Modules, National Institute of Standards and TechnologyFIPS 140-3 security requirements for cryptographic modules at four increasing levels.
- NIST CSRC Glossary: hardware security module (HSM), NISTA hardware security module as a tamper-resistant physical device that protects and manages keys and performs cryptographic operations.
- Key escrow, NIST CSRC glossary, NISTKey escrow as retention of the private key associated with an encryption certificate, to support key recovery.
- Zeroization, NIST CSRC glossary, NISTDestroying a key or secret so that its value can no longer be retrieved, called zeroisation in FIPS 140.
- Dual control, PCI Security Standards Council glossary, PCI Security Standards CouncilDual control as two or more separate entities acting together so that no one person can access or use the protected material alone.
- NIST CSRC Glossary: split knowledge, NISTSplit knowledge as a key split into shares, each of which provides no knowledge of the key.