Section 5.39

Public measurement key

Definition

A public measurement key is a cryptographic key that is deliberately disclosed, for example in a paper or a standard, so that others can repeat a measurement or check a computation byte for byte. It is usually the key of a message authentication code §5.7 (MAC) or a cipher, where one key both creates and checks, so every reader can do everything a key holder can. The name is descriptive, not a standard term, and the key is not the public half of a key pair in public-key cryptography §5.15.

The idea

Cryptographic code is checked against known values. A test vector is a published set of inputs together with the correct output, for example a key, a message, and the tag that a correct implementation must produce. A researcher who measures how long an authentication §1.6 check takes on a small device also wants others to repeat the measurement with the same bytes. Both need the key to be public, because nobody can recompute an output from a key they do not know.

Publishing a key is harmless for these purposes and fatal for others. The security promise of a MAC is that nobody can produce a valid tag for a new message, and that promise is about parties who do not have the key. Everyone who has read a published key has it. The useful question is therefore not whether a public key is secure, but which claims about a system do not depend on anyone being unable to compute with the key. Speed, memory use, and whether an implementation computes the right function do not depend on it. Authentication of origin, confidentiality §1.8 and protection against replayed messages do.

How it works

Sort each claim made by a test or an experiment by asking one question: would the claim change if every participant could compute with the key?

Claims that survive a public key.

Claims that fail against anyone who holds the key.

Two rules follow. First, a key protects only against parties who do not have it, so every claim must say who has it: the authors of a paper and its readers, a laboratory team, or the whole world. Second, a public measurement key must never become a production key. Code that accepts it is built only for testing, and a production build checks that its configured key differs from every published test key and refuses to run otherwise.

Worked example

Test case 1 of RFC 4231 publishes these values for HMAC-SHA-256 §5.9, the hash-based message authentication code §5.8 (HMAC) built on SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output):

b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7

An implementation that outputs this tag passes a conformance check: it computes HMAC-SHA-256 correctly for these inputs. A measurement of how long a device takes for this computation is a valid cost figure for a 20-byte key and an 8-byte message.

Now let the same key protect commands sent by Alice’s lab device to Bob’s. Anyone who has read RFC 4231 can produce a valid tag for a message Alice never sent. For the 8 bytes Hi Thera, which differ from Alice’s message in the last byte, one HMAC computation gives

0c4364760c12929989edaa671abb2b58006f583bc88e342cb0f4a017c508f826

and Bob’s device accepts the message. The forgery needed no attack on HMAC: it succeeded with probability 1 at the cost of one computation. Against a secret key, a forger who guesses a 32-byte tag is right with probability 2−2562^{-256}.

Stated precisely

Write Tag(K,m)\mathrm{Tag}(K, m) for the tag of message mm under key KK. The standard security notion for a MAC is EUF-CMA (existential unforgeability under chosen-message attack). An attacker that does not know KK may obtain Tag(K,mi)\mathrm{Tag}(K, m_i) for any messages m1,…,mqm_1, \dots, m_q it chooses. The notion requires that the attacker then produces a pair (m,t)(m, t), with mm different from every mim_i and t=Tag(K,m)t = \mathrm{Tag}(K, m), only with negligible probability, meaning a probability too small to matter, such as 2−1282^{-128}. The notion assumes that KK is chosen uniformly at random and is unknown to the attacker.

A party that knows KK succeeds with probability 1, by computing t=Tag(K,m)t = \mathrm{Tag}(K, m) for any new mm. With a public measurement key, the guarantee therefore holds against exactly the parties who do not know KK, and once KK is published that set is empty. The claims that survive are those that hold even for an attacker who knows KK: that the implementation computes Tag\mathrm{Tag} (conformance), and the measured costs, under the assumption that the cost does not depend on the value of KK.

Limits and common mistakes

A public measurement key is not a public key. In a digital signature §5.14 scheme, the verification key is meant to be published and the signing key stays private, so publishing the verification key costs nothing. Publishing a MAC key, a symmetric encryption key, or the private half of a signature key pair gives away every guarantee that rests on it.

Test keys that reach shipped products are a documented failure. In 2024 the security firm Binarly reported, under the name PKfail, that firmware for personal computers from several vendors shipped with a test signing key labeled DO NOT TRUST, whose private half had appeared in a public code repository [342]. Whoever held that private half could make the secure boot §6.31 check of those computers accept software of their choosing.

A name adds no protection. A receiver accepts whatever tag the key produces, whether the key is called a test key, a measurement key or anything else.

A cost measured with a public key transfers to a secret key only if the cost does not depend on the key’s value. A running time that depends on the key is itself a timing leak. A power draw that depends on the key is what power analysis exploits: an attacker measures the chip’s power while it uses the key and recovers the key from the measurements.

A key known only to the participants still protects against outsiders. Once it is published, that protection is gone too, and the key can never become secret again.

Questions answered

Which security claims still hold when all experiment participants know the key?

Only the claims that do not depend on any participant being unable to compute with the key still hold: conformance, cost measurements, the logic of the rejection checks, detection of accidental corruption, and every ordinary guarantee against outsiders who do not know the key. Conformance means that the implementation computes the algorithm §14.1 correctly, shown by reproducing a published output. Cost measurements, such as time, energy and memory, stay valid when the implementation’s cost does not depend on the key’s value. Rejection tests stay valid: a receiver still rejects a wrong tag, the short value that a message authentication code (MAC) computes from the key and the message. Random bit errors are still detected with overwhelming probability.

Against the participants themselves, every claim that rests on the key being secret fails. Any participant can produce a valid tag for any message, so a valid tag shows neither who sent a message, nor that it is unaltered, nor that it is fresh; and any participant can decrypt data encrypted under the key. If the experiment must also show who produced each record, or that no participant altered it, it needs a separate mechanism, such as a key the participants do not hold or a digital signature by a party outside the group.

Related entries: Message authentication code (MAC) (§5.7), Digital signature (§5.14), Mechanism versus evidence (§1.37), Constant-time cryptographic implementation (§5.36). Further reading: [167, 342].