Section 19.3.1

Public key fingerprints and truncated identifiers

Definition

A public key fingerprint is a value computed from a public key by a cryptographic hash function §5.1, whose fixed-length output cannot feasibly be matched by a different input. Comparing fingerprints replaces comparing whole keys. A truncated identifier keeps only tt bits of such a value; fewer bits make two keys with the same identifier easier to find. A keyed fingerprint is computed with a secret key as well, for example by HMAC §5.8 (hash-based message authentication code), so that only holders of the secret key can compute it.

Where it fits

Main entry: Birthday bound (§5.6).

A fingerprint lets a person check a public key received over an untrusted channel against a reference value obtained over a trusted one, such as a label printed on a device. In OpenPGP, the standard for encrypted and signed e-mail that grew out of the program PGP (Pretty Good Privacy), a version 4 key has a 160-bit fingerprint computed with SHA-1 (Secure Hash Algorithm §14.1 1). The last 64 bits of that fingerprint form the long key ID, and the last 32 bits form the short key ID.

The Birthday bound entry gives the numbers behind truncation. A tt-bit identifier takes 2t2^{t} values, so among 2t+12^{t} + 1 different keys two must share one, by the pigeonhole principle (more items than boxes puts two items in one box). With t=2t = 2, the four identifiers 00, 01, 10 and 11 cannot keep five keys apart, whatever the hash function. Two attacker efforts matter.

An unkeyed fingerprint identifies its key to anyone who holds the candidate keys: public keys are public, so an observer computes the fingerprint of each candidate and compares. A keyed fingerprint, for example tt bits of HMAC(K,pk)\mathrm{HMAC}(K, \mathrm{pk}) for a secret key KK and a public key pk\mathrm{pk}, blocks that test for anyone without KK, as long as HMAC behaves as a pseudorandom function §15.1 (with a secret key, its outputs look random). The keyed fingerprint still reveals two things.

Fresh randomness removes the equality leak. The resolvable private address §7.31 of Bluetooth Low Energy §7.1 is a fresh random value followed by a 24-bit keyed hash of that value, computed with the device’s identity resolving key §7.29. The device replaces the random value at intervals, so its successive addresses look unrelated to an observer without that key, while a holder of the key still recognizes the device.

Limits and common mistakes

A matching fingerprint is not a proof of possession §5.30. Anyone can copy a public key and its fingerprint. To learn that a party holds the matching private key, have that party sign a fresh challenge with that private key and verify the digital signature §5.14.

A fingerprint check is only as trustworthy as the channel that delivered the reference value. An attacker who can replace the reference makes the check approve the attacker’s own key.

A system that uses a truncated identifier as a unique name must say what happens when two keys share it: refuse, ask for the full fingerprint, or compare the whole keys. Taking the first match silently selects a key, possibly the attacker’s.

Questions answered

Does publishing a keyed fingerprint reveal nothing?

No. A keyed fingerprint, a short value computed from a public key together with a secret key KK, for example by HMAC (hash-based message authentication code), hides which public key it belongs to only from observers who lack KK and cannot get any system to compute keyed fingerprints for them. Even those observers learn equality: one public key always yields the same keyed fingerprint, so they can link all of its appearances and count how many distinct keys appear. Anyone who holds KK, obtains it later, or can query a system that computes keyed fingerprints of chosen keys can compute the fingerprint of every candidate public key and so identify the key, because public keys are public and the candidates are usually known. A leak of KK exposes every fingerprint ever published under it, old ones included.

Truncating the fingerprint adds collisions, different keys with the same value, which make a match ambiguous but do not hide identity. To stop linking, mix a fresh random value into each published fingerprint.

Related entries: Cryptographic hash function (§5.1), Proof of possession (§5.30), Unlinkability (§5.46), Second-preimage resistance (§5.4), Collision resistance (§5.5), Resolvable private address (RPA) (§7.31).