Definition
Key separation is the key-management rule that each cryptographic key serves a single purpose, and that keys serving different purposes are independent, so that an attacker who learns or misuses one key gains nothing against another. A purpose is one kind of operation for one role, such as authenticating ordinary commands or authorizing a recovery. NIST Special Publication 800-57 states the first half: in general, a single key shall be used for only one purpose. NIST Special Publication 800-108 requires the second half for keys derived from one parent key [306].
The idea
A device holds one secret key and uses it for two jobs. It proves its identity by answering challenges: the server sends some bytes, and the device returns the HMAC §5.8 (hash-based message authentication code) of those bytes, a value only a holder of the key can compute. The device also computes its encryption key for sessions as the HMAC of the text session. An attacker who sends the challenge session receives the session key as the answer. Each job is safe on its own. Sharing one key lets one job hand out the other job’s secret.
NIST Special Publication 800-57 Part 1 gives three reasons for one key per purpose. Using one key in two cryptographic processes may weaken the security of one or both. Limiting the use of a key limits the damage if the key is compromised. And some uses interfere with each other. Its example of interference is a key pair used both to decrypt keys sent to its owner and to sign: the decryption key may have to be kept after its public key is no longer used, to decrypt keys sent earlier, while the signing key must be destroyed at the end of its period of use, and no single lifetime satisfies both.
The keys of a building are a fair picture. The cleaner’s key opens the offices but not the safe, so a lost cleaner’s key means new office locks, not a new safe. The picture stops in two places. A copied cryptographic key leaves no trace, so its loss may go unnoticed. And two cryptographic keys computed from one parent key are separate only while the parent key stays secret.
How it works
Key separation is put in place in five steps.
Write a key table. For each key, record its purpose, the operations it may authorize, its holder, its storage place and its lifetime. NIST Special Publication 800-57 counts a key’s identifier and purpose as metadata that must be protected so that the key is used correctly.
Create independent keys. Either generate each key separately from a CSPRNG §5.27 (cryptographically secure pseudorandom number generator), or derive each key from one parent key with a key derivation function §5.20, giving every derivation a distinct label. A parent key is then used for derivation only: NIST Special Publication 800-108 requires that the key-derivation keys (keys used to derive other keys) in a key hierarchy (a tree of keys in which each key is derived from the one above it) be used for no other purpose.
Hand out keys by need. Each party receives only the keys for its own operations, which is least privilege §1.15 (giving each party only the access its job needs). A party that receives a parent key can compute every key below it, so a parent key stays with the party that derives.
Bind each key to its purpose at the verifier. The verifier keeps, for each key, the set of operations that key may authorize, and checks that set before it acts. If the verifier accepts any of the keys for any operation, the separation is lost: the attacker needs only the least protected key.
Store each key according to its use. A key used often has to be reachable by online systems and is exposed more. A key used rarely, such as a key for recovery, can be kept offline.
TUF §21.10 (The Update Framework), a design for securing software updates, applies the rule. TUF splits the signing work among roles, each with its own keys, and each role signs its own metadata file, a file that describes the available updates. The root role’s file lists the trusted keys of the other top-level roles (the four fundamental ones are root, targets, snapshot and timestamp), so the root keys §5.25 can replace the key of any other top-level role; the specification asks that root keys be kept offline. The timestamp role signs a small file that is re-signed often, and its key is an online key and thus at high risk. TUF therefore advises that a separate key sign the snapshot file, which lists the current versions of the files that describe the update packages, so that the snapshot key can be kept offline.
Worked example
The example uses HMAC-SHA-256 §5.9, which is HMAC built on SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output); its outputs are 32 bytes, written here in hexadecimal. The keys are invented for the example; real keys come from a CSPRNG. The key is the 32 bytes 0x00, 0x01, and so on up to 0x1f.
One key for both jobs. The attacker sends the challenge session, the 7 ASCII bytes 73 65 73 73 69 6f 6e. The device answers with :
9b0b5ca3ddb4e3e6664f124026c77c8f053641bd138d1d745b8834c67ec7f6fd
The device’s session key is also , computed from the same key and the same 7 bytes, so it is the same 32 bytes. The attacker now holds the session key and can read the session. One challenge was enough, and no cryptographic weakness was used.
Two separate keys. Now the device holds , the same 32 bytes as , for challenges only, and , the 32 bytes 0x20, 0x21, and so on up to 0x3f, for deriving session keys only. The answer to the challenge session is , the same 32 bytes as above. The session key is now :
fe132bb53c1ef6b7fd959089785df34c638d3823b4693595cba1a7fc82ccb883
The answer no longer reveals the session key. If HMAC is a pseudorandom function §15.1 (a keyed function whose outputs look random to anyone without the key) and is secret, uniformly random and independent of , no number of answers computed with helps the attacker predict values computed with .
Stated precisely
Two NIST rules together make up key separation.
Usage rule (NIST Special Publication 800-57 Part 1, Section 5.2): in general, a single key shall be used for only one purpose, for example encryption, integrity §1.9 authentication §1.6, key wrapping §19.1.12, random bit generation or digital signatures §5.14. The same section permits one key for one process that provides several services at once, such as authenticated encryption §5.16, which encrypts and authenticates data in a single operation.
Independence rule (NIST Special Publication 800-108, Section 6.5): keys derived from the same key-derivation key shall be separate, in the sense that the compromise of some keys does not degrade the security strength of any other key. As a test: an attacker who has learned some of the keys must find it no easier to tell any remaining key apart from a random string of the same length than an attacker who has learned none.
The independence rule is met in three ways.
Keys generated independently from a CSPRNG are independent by construction.
Keys derived from one parent key are independent when the parent key is secret and uniformly random, the derivation function is a pseudorandom function, and every derivation uses a different input; NIST Special Publication 800-108 names a different Label for each purpose, and different identities in the Context for different parties, as ways to make the inputs differ.
Keys cut from the output of a single derivation come from non-overlapping parts of that output.
The independence rule says nothing about the parent: an attacker who learns the parent key computes every key derived from it.
Key separation also needs enforcement. The guarantee holds only if every verifier accepts each key for its own purposes and refuses it for all others.
Limits and common mistakes
Separation limits what a stolen key can do beyond its purpose. It does not reduce what the key may legitimately do: a stolen key for ordinary commands still sends any ordinary command until it is replaced.
Keys derived from one parent share its fate. Their separation holds only while the parent key is secret, and a party that holds the parent is separated from none of the children.
Copies are not separate keys. Two variables, files or names that hold the same bytes are one key.
Authority can reconnect through a service. If the holder of one key can ask a service that holds another key to act on its behalf, the first key has the second key’s power in practice. This is the confused deputy problem §1.25: a program that holds an authority is tricked into using it for a less trusted caller.
More keys mean more work: each needs generation, provisioning, storage, rotation and revocation, and each step can fail.
Domain separation §5.22 and key separation solve different problems. A domain label inside every input stops two uses of one key from processing the same bytes, and would also have stopped the attack in the worked example. Only separate keys confine the damage when a key leaks, let keys have different holders and lifetimes, and keep one key away from two different algorithms §14.1.
Questions answered
What is gained by separate origin and recovery keys §5.31?
Separate keys mean that theft of the key used for everyday messages does not also give away the power to take back control. Here the origin key is the key whose tags or signatures prove that ordinary messages, such as software updates, come from the legitimate sender. The recovery key is a second key whose only power is to restore control, for example by installing a new origin key after the old one was stolen. Three gains follow.
Recovery after theft. A thief who holds the origin key can send ordinary messages but cannot install keys. The owner authorizes a key replacement with the recovery key, and the stolen origin key stops working. With a single key, the thief could also replace that key and lock the owner out.
Less exposure for the recovery key. The origin key is used often, so online systems must reach it. The recovery key is used rarely, so it can be kept offline, where it is much harder to steal.
Independent lifetimes. The origin key can be replaced on a schedule without touching the recovery key.
The gains hold only under three conditions. The device accepts only the recovery key for recovery operations. The recovery key cannot be computed from the origin key or from any secret stored with it, such as a shared parent key. And different systems hold the two keys. Separation does not undo what a thief did with the origin key before recovery, and theft of the recovery key itself remains the worse case.
Related entries: Domain separation (§5.22), Per-device key derivation (§5.24), Root key and root seed (§5.25), Confused deputy (§1.25), Recovery key (§5.31), Key rotation (§5.29), Least privilege (§1.15), Key derivation function (KDF) (§5.20). Further reading: [147, 213, 306].