I want to implement secure communications between an ESP32 and a smartphone using BLE. Since the board with the ESP32 does not have display or input capabilities, I guess ECDH key exchange with no MITM protection (OOB is not an option) is the safest level. OTOH, I am not interested in storing LTK (bonding) as many devices will access the ESP32, so it is fine to repeat the pairing process every time.
After a few seconds after an apparently successful connection, an error from the BLE stack is triggered and the ESP32 disconnects from the paired device.
Code: Select all
I (1182) btc_spp: event ESP_SPP_INIT_EVT received I (1202) gatts: event ESP_GATTS_REG_EVT received I (1202) gatts: event ESP_GATTS_CREAT_ATTR_TAB_EVT received I (1202) ble_gap: event ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT received I (1212) gatts: event ESP_GATTS_START_EVT received I (1212) ble_gap: event ESP_GAP_BLE_ADV_START_COMPLETE_EVT received I (21262) gatts: event ESP_GATTS_CONNECT_EVT received I (21262) ble_gap: Remote address: I (21262) ble_gap: 0x3ffd4382 7e 9d 66 67 62 15 |~.fgb.| W (21272) BT_SMP: Non bonding: No keys will be exchanged I (22002) ble_gap: event ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT received W (24582) BT_L2CAP: L2CA_EnableUpdateBleConnParams - unknown BD_ADDR 7e9d66676215 E (24592) BT_BTM: Device not found I (24592) gatts: event ESP_GATTS_DISCONNECT_EVT received I (24602) ble_gap: event ESP_GAP_BLE_AUTH_CMPL_EVT received E (24602) ble_gap: authentication failed, reason=0x66 I (24612) ble_gap: event ESP_GAP_BLE_ADV_START_COMPLETE_EVT received