Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated
Key management is the operation of making, keeping, and replacing encryption keys safely. RFC 4949 explains it as the handling of keying material throughout its life, together with the supervision and management of that work. The work includes ordering, generating, storing, preserving, distributing, destroying, and auditing.
How does key management work?
Think of how spare keys to a building are run. You make a key, put it in a safe, record in a ledger whom you gave it to, change the lock itself from time to time, and collect and destroy every key that is no longer needed. If any one step is missing, the strength of the key loses its meaning.
NIST's SP 800-57 Part 1 is a document that brings together general guidance and good practice for handling the material of cryptographic keys. It sets out the protection each kind of key needs and the functions of key management. The detailed standards are for specialists, but the ideas an operator should grasp are laid out readably in OWASP's key management sheet.
According to OWASP's sheet, keys are made inside a cryptographic component that conforms to a standard, and a hardware component is preferable. In storage, the conditions are not leaving keys in plain text and not putting them where the source code lives. For replacement, you decide a plan and record it in a document, and a form that can be replaced automatically is recommended. Disposal means deleting every copy of the key, including those in backups and storage copies.
If a key may have got out, disable it at once. The sheet also asks that the recovery procedure for that case be written down beforehand.
Places where cryptography tends to fail are set out on the page on cryptographic failures. What is visible from outside about your site can be checked with the free URL check.
Why does key management matter?
Even if the cipher method is standard, if the key gets out the protection does not work. For example, AES is a standard method, but if the key is left in plain text in a settings file or put in a shared folder, that is the end of it. In daily operation, rules on where a key sits and how it is handled make more difference than the choice of method. If you want to talk through where your keys sit, contact us.
OWASP's sheet also asks that keys and secret information be given only the minimum permissions, that you record who can see a key in plain text, and that mechanisms and procedures be checked regularly. There is also a rule that one key is used for one purpose only.
Even when the person in charge changes, keep it a state where the location of keys and the time for replacement are known. The handling of secrets close to keys, such as passwords and API keys, is set out in secrets management.
Related terms
- Cryptographic failures: a state in which mistakes in using ciphers or handling keys let protected information be read
- AES: the standard common-key cipher used around the world
- Secrets management: the operation of putting passwords and keys in a dedicated safe to protect them
- PKI (public key infrastructure): the whole mechanism that supports issuing and managing certificates
Frequently asked questions
How often should I replace keys?
There is no single fixed interval. OWASP's sheet asks that a replacement plan be decided from the assumed threats and a risk assessment, and recorded in a document.
Is it a problem to write a key in a settings file?
Yes. OWASP's sheet asks that keys not be put where the source code lives or embedded in build outputs, and not stored in plain text. Make it so that keys are taken out of a dedicated storage mechanism.
Next step
First list where the keys and secret information you use are kept. Mistakes in using cryptography are in cryptographic failures. The free URL check shows only what is visible from outside, and for a review of where keys are kept, contact us.
Frequently asked questions
How often should I replace keys?
There is no single fixed interval. OWASP's sheet asks that a replacement plan be decided from the assumed threats and a risk assessment, and recorded in a document.
Is it a problem to write a key in a settings file?
Yes. OWASP's sheet asks that keys not be put where the source code lives or embedded in build outputs, and not stored in plain text. Make it so that keys are taken out of a dedicated storage mechanism.