Section 5.25

Root key and root seed

Definition

A root key is the secret key at the top of a key hierarchy, a tree in which each key is derived from, encrypted under, or certified by the key above it. A root seed is a secret random value from which a fixed computation generates the root key, or the whole hierarchy, on demand; the seed is an input to that computation, not itself a key for encryption or authentication §1.6. Whoever learns a root key or root seed can compute every key derived from it and public inputs alone.

The idea

A system with many keys needs a starting point. A manufacturer that installs keys in a million devices would otherwise have to store and protect a million unrelated secrets. A hierarchy reduces the problem: the one secret at the top is protected with the most care, and every other key is computed from it, encrypted under it, or certified by it, either directly or through keys in between. That one secret is the root key.

A root seed solves a storage problem. The TPM (Trusted Platform Module) 2.0 specification of the Trusted Computing Group defines a security component, often a separate chip, that keeps secrets called Primary Seeds: large random values that the TPM keeps while the power is off and that never leave it in any form. Storing a key pair for every set of key parameters a user might ask for would need, in the specification’s words, a prohibitive amount of non-volatile memory, memory that keeps its content without power. Instead the TPM feeds a seed and the requested parameters into a key derivation function §5.20, an algorithm §14.1 that turns a secret and public inputs into keys. As long as the seed does not change, the same parameters give the same key. One seed takes little memory, and every key computed from it can be recreated whenever that key is needed.

The price of both is concentration: everything below the root shares one point of failure. NIST Special Publication 800-57 Part 1 lists a key-derivation key used in the derivation of keys by a large number of entities among its examples of keys whose compromise might be particularly difficult or expensive to recover from.

How it works

Three kinds of link connect a root to the keys below it, and each kind gives the root a different power.

A root key or root seed passes through five stages.

  1. Generation. It comes from a CSPRNG §5.27 (cryptographically secure pseudorandom number generator). NIST Special Publication 800-57 notes that a derived key is no stronger than the secret value it is derived from, so the root must be at least as hard to guess as any key below it needs to be.

  2. Custody. It is kept in the best-protected place available, such as a secure element §5.38 (a separate chip that stores keys and uses them without exporting them) or a hardware security module (a physical device that safeguards keys and performs cryptographic processing). Every backup is one more place it can leak from.

  3. Use. It does one job. NIST Special Publication 800-108 requires that a key-derivation key in a key hierarchy be used for derivation and nothing else [306].

  4. Replacement. A new root comes from fresh randomness and reaches its place over a path that the old root does not protect on its own.

  5. Destruction. The old root is erased everywhere, backups included, once nothing needs it. Erasing a secret beyond recovery is secret zeroization §5.37.

Worked example

The values are invented. Each derivation is one call of HMAC-SHA-256 §5.9, that is HMAC §5.8 (hash-based message authentication code) built on SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output), keyed with the parent and applied to a distinct public label. If HMAC behaves as a pseudorandom function §15.1 (a keyed function whose outputs look random to anyone without the key), as is commonly assumed, this is a simple key derivation function. Every value is 32 bytes; only the first 8 bytes are shown, in hexadecimal.

  1. The root seed SS is the 32 bytes 0x00, 0x01, and so on up to 0x1f, a pattern chosen only to keep the example readable; a real seed comes from a CSPRNG.

  2. The root key is R=HMAC(S,𝚛𝚘𝚘𝚝 𝚔𝚎𝚢 𝚟𝟷)R = \mathrm{HMAC}(S, \texttt{root key v1}), which begins 93 ad b3 c0 94 cd 79 80.

  3. The update key is U=HMAC(R,𝚞𝚙𝚍𝚊𝚝𝚎)U = \mathrm{HMAC}(R, \texttt{update}), which begins 6e 78 7e 48 e8 bf 48 5d.

  4. The recovery key §5.31 is V=HMAC(R,𝚛𝚎𝚌𝚘𝚟𝚎𝚛𝚢)V = \mathrm{HMAC}(R, \texttt{recovery}), which begins aa 74 39 66 26 7a 4f c9.

  5. A planned successor root is derived from the old one: R2=HMAC(R,𝚛𝚘𝚘𝚝 𝚔𝚎𝚢 𝚟𝟸)R_2 = \mathrm{HMAC}(R, \texttt{root key v2}), which begins 60 6f 9f 1f 04 9a 49 5b. Its update key is U2=HMAC(R2,𝚞𝚙𝚍𝚊𝚝𝚎)U_2 = \mathrm{HMAC}(R_2, \texttt{update}), which begins 04 08 45 9b 2d bd 0b 52.

An attacker learns RR. With the public labels and 4 HMAC calls, the attacker computes UU, VV, R2R_2 and U2U_2, the same bytes the owner holds. The successor root R2R_2 gives no protection, because it is a function of RR. NIST Special Publication 800-57 describes the same weakness for key update, in which each new key is derived from the one before: an adversary who obtains one key in the chain and knows the update process can determine the keys that follow it.

The attacker does not learn SS. NIST Special Publication 800-57 requires a key derivation method to be one-way, so that the secret it starts from cannot be determined from the derived keys, and requires that no derived key can be determined from other derived keys. Keys derived from SS along other paths, not through RR, therefore stay protected. An attacker who learned SS instead would hold RR and everything below it.

The owner replaces the root. The new root NN is 32 fresh bytes from a CSPRNG, so NN depends on no value the attacker knows. If NN is installed in person, or sent encrypted under a key the attacker does not have, NN and every key derived from it are protected. If NN is sent encrypted under a transport key derived from RR, and the attacker recorded the transfer, the attacker derives the transport key from RR, decrypts the recording and learns NN.

Stated precisely

Model the keys as a dependency graph. Each way to compute a key YY has the form Y=F(X1,…,Xk,p)Y = F(X_1, \dots, X_k,\ p), where X1X_1 to XkX_k are its secret inputs, pp is public data such as labels, identifiers and recorded ciphertexts (encrypted data), and FF is a public computation such as derivation or decryption. A key can have several ways, or none. A fresh root NN comes from fresh randomness, so at first no computation from other values gives it. Once a copy of NN wrapped under a transport key TT is recorded as the ciphertext CC, the decryption N=Dec(T,C)N = \mathrm{Dec}(T, C), where Dec(T,C)\mathrm{Dec}(T, C) means CC decrypted with the key TT, is a way to compute NN. Call a secret exposed when the attacker knows it. Then:

  1. Exposure. A key is exposed if at least one way to compute it has all of its secret inputs exposed, because the attacker can run that public computation.

  2. Protection. A key that was not disclosed directly stays protected if every way to compute it needs at least one secret that is not exposed, provided that this secret is uniformly random and nothing the attacker sees reveals it. Two common forms of FF meet this condition: a pseudorandom function keyed with that secret, and the exclusive-or of that secret with other values of the same length that do not depend on it, which NIST Special Publication 800-133 allows for combining independently generated keys when at least one component is at least as unpredictable as the combined key must be.

A root is special only because every key linked below it, directly or through keys in between, by derivation or by wrapping whose wrapped copy was recorded, can be computed from the root and public data alone. A root seed lies above the root keys it generates. Because derivation is one-way, learning one generated key does not reveal the seed, while learning the seed reveals every key generated from it. For certification links the rule reads differently: exposing a signing root exposes no private key below it, but lets the attacker produce certificates that every verifier trusting the root accepts, until the verifiers stop trusting that root.

Limits and common mistakes

A root can be weak whatever its length. A value made from a serial number, a time stamp or a fixed test pattern is easy to guess, and nothing derived from it can be harder to guess.

Rotation by derivation is not recovery. A successor root computed from a disclosed root is disclosed as well, as the worked example shows.

A replaced root stops being a risk only when every copy of it is erased. A replaced root that still exists in a backup, a factory station or a log can be disclosed later, and then everything that depends on it is exposed after the fact.

A deterministic hierarchy gives no forward secrecy §5.33, which is protection of earlier sessions after a long-term key, a key kept and used across many sessions, leaks. Forward secrecy needs session keys built from fresh secrets that are erased after use.

The names describe a position, not a quality. Calling a value a root key or root seed says where it sits in the hierarchy. It does not say that the value was generated well, is stored safely or was never exported.

Changing a root seed abandons what it protected. The TPM 2.0 specification states that when a Primary Seed changes, the objects it protected, which are keys and data that belong to a hierarchy, can no longer be used; changing the Storage Primary Seed, the seed at the root of the TPM’s storage hierarchy, invalidates every object in that hierarchy, and those objects cannot be recreated.

Questions answered

Which later keys remain protected after disclosure of a provisioning root?

Only later keys that depend on at least one secret the attacker does not know and cannot obtain remain protected; every later key computed from the disclosed root and public inputs is exposed. A provisioning root is the root key or root seed from which a manufacturer or operator computes the keys it installs in devices.

These later keys are exposed, even though they are created after the disclosure:

If the root also certifies keys, existing private keys stay secret, but the attacker can certify keys of its own that devices trust until they stop trusting the root.

These later keys remain protected:

TLS (Transport Layer Security) 1.3 states the last point for its own long-term keys, the signature keys and pre-shared keys that a party keeps across many connections: RFC 8446, Appendix E.1.5 [325], says that TLS does not provide security for handshakes that take place after a peer’s long-term secret is compromised.

Related entries: Entropy and min-entropy (§5.26), Forward secrecy (§5.33), Post-compromise security (§5.34), Secret zeroization (§5.37), Per-device key derivation (§5.24), Key rotation (§5.29), Secure element (§5.38), Key provisioning (§5.28), Key derivation function (KDF) (§5.20). Further reading: [147, 148, 306, 325].