Section 7.28

Long-term key (LTK)

Definition

The long-term key (LTK) is the 16-byte secret key that two paired BLE §7.1 (Bluetooth Low Energy) devices share, and from which each encrypted connection derives a new session key. LE Secure Connections §7.21 pairing §7.17 computes the LTK on both devices from an elliptic-curve Diffie–Hellman §19.1.5 shared secret; LE legacy pairing §7.20 has one device generate it and send it to the other. Devices that bond store the LTK, so that later connections are encrypted without pairing again. The LTK authenticates a link partner, not the author of the data that the partner sends.

The idea

Pairing is slow and may need the user to compare numbers or type a passkey. A fitness band that reconnects to its phone dozens of times a day cannot pair every time. So pairing ends with a key that the devices keep: the LTK. On every reconnection, the two devices combine the LTK with fresh random values to make a session key for that connection only, so the traffic of different connections is encrypted under different keys.

A house key shared by two flatmates is a fair picture: either can open the door, and the door cannot tell which one did. The LTK proves that the device at the other end of the link holds the key, nothing more. Whatever that device sends, from any application, from a server it forwards for, or from malware it runs, arrives through the same encrypted link. That is why the LTK cannot decide who may author an object such as a configuration or a software update. The picture stops at one point: a house key opens one door, while one LTK protects every connection between the two devices until someone deletes the bond.

How it works

How the LTK is created.

Storage. Devices that bond store the LTK in non-volatile memory, typically flash memory §6.6, together with the partner’s identity address §7.30, the key size and whether the key was authenticated. Deleting the bond deletes the LTK; pairing again replaces it.

Use on reconnection. The central starts encryption.

  1. The central’s link layer §7.6, the part of the Bluetooth chip that sends and receives packets, sends the encryption request LL_ENC_REQ unencrypted. It carries Rand (8 bytes) and EDIV (2 bytes) to name the LTK, both zero after Secure Connections pairing, plus 8 fresh random bytes SKDm\mathrm{SKD}_m and 4 fresh random bytes IVm\mathrm{IV}_m.

  2. The peripheral’s link layer asks the peripheral’s host, the software that keeps the bond records, for the LTK. The host finds it by EDIV and Rand after legacy pairing, or by the identity of the connected central after Secure Connections pairing, or reports that it has none.

  3. The peripheral answers with the encryption response LL_ENC_RSP, which carries its own 8 random bytes SKDs\mathrm{SKD}_s and 4 random bytes IVs\mathrm{IV}_s.

  4. Both devices form the 16-byte session key diversifier SKD from SKDm\mathrm{SKD}_m and SKDs\mathrm{SKD}_s, and compute the session key SK\mathrm{SK} by encrypting SKD with AES (Advanced Encryption Standard) under the LTK. They also form an 8-byte initialization vector (IV) from IVm\mathrm{IV}_m and IVs\mathrm{IV}_s.

  5. From then on, each packet that is not empty is encrypted under SK\mathrm{SK} and carries a 4-byte integrity §1.9 check; an empty packet, which a device sends when it has nothing to send, goes unencrypted and without the check. If the two devices hold different LTKs, the first encrypted packet fails its check and the connection ends.

Worked example

Reconnection after legacy pairing. During pairing, sensor S, the peripheral, gave phone P an LTK with EDIV 0x1A2B and Rand 0x0123456789ABCDEF. Today P reconnects. Its LL_ENC_REQ carries Rand, EDIV, SKDm\mathrm{SKD}_m and IVm\mathrm{IV}_m: 8+2+8+4=228 + 2 + 8 + 4 = 22 bytes. S’s host looks up the pair (0x1A2B, 0x0123456789ABCDEF) and returns the LTK. S’s LL_ENC_RSP carries 8+4=128 + 4 = 12 bytes. SKD has 8+8=168 + 8 = 16 bytes, exactly one AES block, and one AES encryption of it under the LTK gives the 16-byte session key. The IV has 4+4=84 + 4 = 8 bytes.

What a recording plus the LTK gives. Everything in the two messages crossed the radio unencrypted. An attacker who recorded today’s connection, and later reads the LTK out of the memory of a lost phone, computes the session key from the recorded SKD and decrypts the whole recording, and every other recorded connection of this bond. The LTK therefore gives no forward secrecy §5.33 across reconnections: its later compromise exposes earlier connections.

Who sent the command. Over the encrypted link, P sends S the command “set sampling interval to 20 ms”. S’s link layer accepts the packet, because its integrity check passed under the session key, so it came from a holder of the LTK. Any application on P could have sent it, and so could malware on P. Now suppose that S accepts a configuration only if it carries a digital signature §5.14 by its manufacturer V over the configuration’s bytes and S’s model number, and checks it with V’s public key, which S received during manufacturing. P can forward V’s signed configuration. If P changes 20 ms to 1 ms, the signature check fails, although the link check still passes. The two checks answer different questions.

Stated precisely

Let EK(x)E_K(x) denote AES encryption of the 16-byte block xx under the 16-byte key KK. On every encrypted connection SK=ELTK(SKD),\mathrm{SK} = E_{\mathrm{LTK}}(\mathrm{SKD}), where SKD is formed from the two 8-byte random values exchanged unencrypted at the start of encryption. Assume that the LTK is known only to the two bonded devices, and that the per-packet encryption and integrity check are secure. Then the content of every packet that a device accepts on the connection was produced under SK\mathrm{SK} by one of the two holders of the LTK, during this connection, and was not altered or replayed within it. Empty packets carry no integrity check, and the check leaves out three header bits that number packets, acknowledge them and announce more data. An outsider can forge or change those, which can disturb delivery but cannot change any content. That is the whole statement. It names a key holder, not a person, an application or an author. Because both devices hold the same LTK, it cannot show a third party which of the two produced a packet.

Application-level origin authority is a different statement: object OO was created or approved by author VV, who is allowed to issue it for this target. It is established by a credential that only VV holds, such as V’s private signing key, checked by the receiver over the bytes of OO and their context, such as the target device and a version number. Neither statement follows from the other. Keeping the link key and the author’s key apart, each for its own purpose, is an instance of key separation §5.23. An application can deliberately grant authority to every bonded partner. That is an authorization §1.7 policy, and it makes the authority exactly as trustworthy as the least trustworthy bonded device.

Limits and common mistakes

The LTK is only as good as the pairing that made it. An LTK from Just Works §7.22 may be shared with a man-in-the-middle §7.26 (MITM) attacker. An LTK sent during LE legacy pairing can be read by anyone who recorded the pairing and recovered its short-term key.

A stolen LTK exposes the past and the future of the bond: every recorded connection, because SKD travels unencrypted, and every future one until the bond is deleted. Store the LTK where software and debug interfaces cannot read it, for example in protected memory or a secure element §5.38.

The LTK does not change by itself. Restarting encryption on a connection produces a new session key from the same LTK; only pairing again produces a new LTK.

A legitimate LTK holder can lie. A compromised or misbehaving phone still holds the key and can send any bytes, drop traffic, or forward an object it has altered.

Possession of the LTK proves nothing to a third party. Both devices hold the key, so neither can use it to prove to anyone else what the other sent.

Link protection ends at the receiver’s link layer. After decryption the bytes are plain data inside the receiving device and carry no record of the link that delivered them.

Questions answered

Can possession of an LTK replace application-level origin authority?

No. Possession of the long-term key (LTK) shows only that a device holds the link key of a BLE (Bluetooth Low Energy) bond, not that the data it sends was created by an author entitled to issue it. The LTK is the secret key that two paired devices share and use to encrypt every connection between them. Data accepted on the encrypted link came from one of the two key holders: the bonded device, or anyone who copied its key. Whatever that device sends, whether from a legitimate application, from a server it forwards for, or from malware, passes the same check. The LTK is also held by both ends, protects one radio hop only, and leaves no proof in the data once the receiver has decrypted it.

Application-level origin authority needs a credential that only the authorized author holds, such as the author’s private key for a digital signature, or a key for a message authentication code §5.7 that the forwarding device does not have. The receiver checks the credential over the object’s bytes and context, such as the target device and version, whatever link carried the object. A system may deliberately decide that every bonded device may issue commands. That is an explicit authorization policy, and the system then trusts every bonded device, and every holder of its key, as an author.

Related entries: Key separation (§5.23), Key provisioning (§5.28), Channel confidentiality versus object authenticity (§7.34), Bonding (§7.18), Forward secrecy (§5.33), Authenticity versus authorship (§1.38), Digital signature (§5.14). Further reading: [18, 93].