Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Bluetooth pairing work?

Tags:

How exactly does Bluetooth paring work? What is communicated between each device during the pairing process?


I was told if you had device-A wanting to pair with device-B:

  • A sends a 'unique key' to device B on some wavelength/frequency
  • B returns an 'echo' back to A, and hence the devices pair.

    +-----+     key    +-----+  |     |  ---->     |     | |  A  |            |  B  | |     |     <----  |     | +-----+     echoed +-----+  

This seems to be inaccurate, so would anyone be able to either expand further or actually explain how/what is communicated to result in a successful pairing of the devices?


I was thinking of incorporating some of this research into a final year project (University), but would at least need to know the something of the Bluetooth programming pairing first.

Any help would be much appreciated in describing how these initial communications work.


I've heard of terms such as 'parked mode', and 'passive mode' within my research, but am yet to find any 'useful' information in the programming behind the design, (and hence I have asked this question). The likes of googling this type of topic is also quite difficult as it seems to bring up stuff like 'how to turn your bluetooth on' pages, and not the design of the programming behind it.

like image 298
jbutler483 Avatar asked Dec 08 '14 14:12

jbutler483


People also ask

What happens during Bluetooth pairing?

When devices pair up, they share their addresses, names, and profiles, and usually store them in memory. The also share a common secret key, which allows them to bond whenever they're together in the future. Pairing usually requires an authentication process where a user must validate the connection between devices.

What is difference between pairing and connecting in Bluetooth?

A Bluetooth connection is a transmission between two Bluetooth devices. Pairing is a requirement before the devices can connect. After pairing, both devices store the information and you don't need to repeat the procedure.

How does Bluetooth communicate between devices?

Bluetooth devices communicate using low-power radio waves on a frequency band between 2.400 GHz and 2.483. 5 GHz [source: Bluetooth Special Interest Group (SIG)]. This is one of a handful of bands that is set aside by international agreement for the use of industrial, scientific and medical devices (ISM).


1 Answers

Bluetooth Secure Simple Pairing uses Elliptic Curve Diffie Hellman (ECDH) public key cryptography with approximately 95 bits of entropy using the FIPS approved P192 elliptic curve.

E:y2=x3 +ax+b(modp) 

The following parameters are given:

  • The prime modulus p, order r, base point x-coordinate Gx, base point y- coordinate Gy.
  • The integers p and r are given in decimal form; bit strings and field elements are given in hex.

    p = 6277101735386680763835789423207666416083908700390324961279 r = 6277101735386680763835789423176059013767194773182842284081 b = 64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1 Gx = 188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012 Gy = 07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811 

There are five phases of Secure Simple Pairing:

1. Public key exchange

Each device generates its own Elliptic Curve Diffie-Hellman (ECDH) public-private key pair.


2. Authentication Stage 1

1 of 3 protocol options is chosen by the connecting devices based on the IO capabilities of the two devices. These are:

  • Numeric Comparison,
  • Out-of-Band,
  • Passkey Entry

3. Authentication Stage 2

Each device confirms that both devices have successfully completed the exchange as stipulated by which of protocol was chosen and used in the previous step.


4. Link key calculation

A link key is computed from the derived shared key and the publicly exchanged data. This is the numeric code shown to the user.


5. LMP Authentication and Encryption

The encryption keys are generated. The devices are successfully connected.


      enter image description here       enter image description here



Further Reading:

  • Bluetooth user Interface Flow Diagrams for Bluetooth Secure Simple Pairing Devices (PDF)
  • Bluetooth Core Complete Specification v4.0 vol0 (ZIP/PDF)

    the core specification is 138 pages and to fully answer your question would take at least 20 so to fully answer your question you'll need to read the references

like image 198
davidcondrey Avatar answered Sep 29 '22 19:09

davidcondrey