Bluetooth Classic pairing on/off

kluverp
Posts: 26
Joined: Mon Jun 18, 2018 7:08 am

Bluetooth Classic pairing on/off

Postby kluverp » Mon Nov 18, 2019 6:10 am

Hi all,

I'am working on a esp32 project that uses Bluetooth. Now I'am looking into the Bluetooth classic example using SPP (the "bt_spp_acceptor" as a starting point).
This is exactly what I need, so I can use the Bluetooth connection as a serial port.

Now the real question: I can connect with any device to my ESP32 client. How do I limit this? I only want devices to connect to my ESP that are 'mine'.

Now everybody with a notebook can connect to my ESP32 using bluetooth via the "JustWorks" method, and they can read/write on my serial port.

What I actually want is something of a password/whitelist so I can block access to unrestricted users.

Any idea on how to do this?

I now the BLE example has features like 'whitelisting' but I can't seem to find those on the "Bluetooth Classing API".


kluverp
Posts: 26
Joined: Mon Jun 18, 2018 7:08 am

Re: Bluetooth Classic pairing on/off

Postby kluverp » Mon Nov 18, 2019 12:19 pm


ESP_sushant
Posts: 8
Joined: Mon Aug 26, 2019 6:10 am

Re: Bluetooth Classic pairing on/off

Postby ESP_sushant » Mon Nov 18, 2019 4:39 pm

"Passkey entry" pairing option can be used to enforce SSP (Secure Simple Pairing) instead of Legacy pairing.
Please check following API to reply the passkey value:

Code: Select all

esp_err_t esp_bt_gap_ssp_passkey_reply(esp_bd_addr_t bd_addr, bool accept, uint32_t passkey)
Thanks.

kluverp
Posts: 26
Joined: Mon Jun 18, 2018 7:08 am

Re: Bluetooth Classic pairing on/off

Postby kluverp » Tue Nov 19, 2019 6:03 am

kluverp wrote:
Mon Nov 18, 2019 12:19 pm
Thanks!
So I may assure only Legacy pairing is an option now?
For anyone looking into this as well.
From IDF version 3.3 and up you can disable the "Simple Secure Pairing" via "make menuconfig".

I was on IDF 3.2 thus, the option was not available yet. When you keep SSP on, and your 'other' device does support SSP, the ESP will use SSP even though you have SSP 'commented out'.
But from IDF 3.3 and up, you can disable SSP as whole and then Legacy pairing is in effect. See examples in IDF 3.3.

Also a 16 bit pincode is an option, what I am using now.

Who is online

Users browsing this forum: Bing [Bot] and 103 guests