This is a library for adding dynamic pairing functionality to an application using the Gazell Link Layer.
The library is customized for pairing a Gazell Host (typically a USB dongle) with one or more Gazell Devices (e.g. a mouse, keyboard or remote control). The pairing information is dynamically exchanged during runtime, enabling any Device to pair with any Host.
Pairing concept
The pairing library implies a few restrictions on how the Gazell link layer can be used by the main application:
The carrier detect functionality of nRF24L01+/nRF24LE1/nRF24LU1+ is employed for implementing close-proximity pairing. By measuring the receive signal strength when a pairing request is received from a Device, the Host is able to estimate the relative proximity of the requesting Device.
Proximity estimation is essential to avoid confusion when pairing in certain environments, for example in an office.
It is only Devices residing close (10-30cm) to the Host that will be allowed to pair. Deliberately limiting the range during pairing will prevent the "pairing to the Host next door" situation.
The operations performed by the pairing library can be divided into the following main stages:
All these stages are required in order to send encrypted user data from a Device to a Host. If encryption is not required, only the "system address exchange" stage needs to be committed before uncrypted user data can be sent on pipe 2-5.
An unpaired Host and Device share the following factory preset parameters:
In addition, every Host has the following unique parameters:
The System Address will be used as address when a paired Device is communicating with the Host. In addition, the System Address serves as a seed for generating the subset of RF channels to be used.
The following are considered a secret:
The Secret Key will be common for all Devices and Hosts.
The "Dongle ID" will be unique for every individual Host.
Factory presets
During system address exchange the Host provides its unique system address to a Device.
The system address is not considered a secret and can be distributed without any particular security precautions.
System address exchange
The Host ID is considered a secret, and the following security precautions are being taken:
Host ID exchange
Before the Host ID is sent from the Host to the Device, it is possible for the application to add an additional validation stage. This validation stage would typically contain some kind of user intervention, for example that the user is requested to write a keycode on the Device, displayed on a screen on the Host.
This requires the Device to be able to send user data before all parameters normally used for encrypting user data have been exchanged. Nevertheless, it is still possible to send encrypted data during the validation stage. This data will be encrypted in the same fashion as normal user data, described in Encrypted user data exchange, except for the following differences:
As the same session token is used through the entire validation stage, the data exchange in the validation stage will have the following properties:
Main security weakness:
The Host ID may be compromised if all of the following criteria are fulfilled:
The Dynamic Key will be used for encrypting user data. Update of the Dynamic Key can at any time be initialized by a Device.
The Dynamic Key is considered a secret, and the following security precautions are being taken:
Dynamic Key exchange
The main reasons for using a dynamic key for encryption of user data are:
Main security weakness:
The Dynamic Key may be compromised if all of the following criteria are fulfilled:
When sending encrypted user data the following security precautions are being taken:
Encrypted user data exchange
Main security weakness:
The data exchange may be compromised if all of the following criteria are fulfilled:
Frequency analysis attacks
Frequency analysis is the study of the frequency of letters, or groups of letters, in the chiphertext. Even the most advanced and "unbreakable" ciphers, as for example AES, does not necessarily provide security against this type of attack, unless precautions for such an attack is being taken. Frequency analysis is based on the fact that certain letters and combinations of letters occur with varying frequencies. Moreover, there is a characteristic distribution of letters that is roughly the same for almost all samples of a given language. For instance, for the English language, "e" tends to be very common, while "X" is very rare. Knowing these properties of a given language, it can be possible to decipher the packets sent from the keyboard, based on analysis of previous sent chiphertext packets, without having to break the cipher itself
"Hostile" Device attack
Here, we have defined a "hostile" Device attack as the scenario where a hostile third part Device has been able to pair with the Host and start sending data that will be interpreted as trusted user data by the Host.
For example, having such an capability with a wireless keyboard, an attacker can easily perform a range of operations on the host PC, like damaging contents on the PC or install spy-ware or key-logging software.
Man-in-the-middle attack
The man-in-the-middle attack is a form of active eavesdropping in which the attacker makes independent connections with the victims and relays messages between them, making them believe that they are talking directly to each other over a private connection, when in fact the entire conversation is controlled by the attacker.
Replay attacks
A replay attack is an attack where previously sent packets, or groups of packets, are recorded by a third part, and re-sent to the receiver.
Here, the third part is not actually deciphering the keyboard packets, but can still able to repeat commands previously sent to the receiver.
For example, a typical "log in" sequence on a PC consisting of entering a username and a password is in particular vulnerable for a replay attack.
Session token
Here, a session token is a random, or pseudo random, number used for adding randomness to encryption of data packets. The session token is not assumed as a secret.
The session token is generated prior to every new session and discarded after the session has ended.
Here, a session consists of one message being sent from a transmitter to a recipient and one message being sent in return from the recipient to the transmitter