Pairing and Bonding Process#
Bluetooth Low Energy (BLE) security uses pairing to establish encryption keys and bonding to store keys for future connections. The SiWx917 supports multiple pairing methods and secure key exchange.
Pairing Methods#
Just Works:
No user interaction required
Suitable for devices without displays/keyboards
Lower security (no MITM protection)
Numeric Comparison:
Both devices display 6-digit number
User confirms numbers match
Provides MITM protection
Passkey Entry:
One device displays passkey, other device enters it
Suitable for device + phone/tablet scenarios
Provides MITM protection
Out-of-Band (OOB):
Key exchange through alternative channel (NFC, etc.)
Not available in the current stack; pairing returns error
0x4B02(SMP OOB not available)
Pairing Process#
1. Set Pairing Capabilities:
Use
rsi_ble_set_smp_pairing_cap_data()to configure pairing capabilities; the payload is the structurersi_ble_set_smp_pairing_capabilty_dataIn that structure, specify: IO capability, OOB data flag, authentication requirements, encryption key size, and keys to be exchanged (for example, LTK, IRK, CSRK)
Key distribution is set separately for initiator (
ini_key_distribution) and responder (rsp_key_distribution) with bits for EncKey/LTK, IdKey/IRK, and Sign/CSRK
2. Initiate Pairing:
Use
rsi_ble_smp_pair_request()to initiate pairingOr respond to pairing request from peer using
rsi_ble_smp_pair_response()
3. Handle Pairing Events:
Register SMP callbacks using
rsi_ble_smp_register_callbacks()Handle passkey events:
rsi_ble_smp_passkey()for passkey entryHandle pairing failure:
rsi_ble_smp_pair_failed()for error handling
4. Key Exchange:
Pairing establishes encryption keys
Long-Term Key (LTK) used for encryption
Handle LTK request:
rsi_ble_ltk_req_reply()for reconnection
Bonding#
Bonding Process:
Bonding stores pairing keys for future connections
Bonded devices can reconnect without re-pairing
The application is responsible for storing bonding keys (LTK, IRK, etc.); the stack does not persist them automatically.
Bonding Management:
Bonding occurs automatically after successful pairing
Bonded device information stored in resolving list
Use resolving list APIs to manage bonded devices
Security Best Practices#
Pairing Method Selection:
Use Numeric Comparison or Passkey Entry when possible (better security)
Use Just Works only when user interaction not possible
Consider application security requirements
Key Management:
Store encryption keys securely
Protect IRKs and LTKs from unauthorized access
Implement proper key rotation if required
APIs Used in This Section#
Topic | APIs / symbols | Reference |
|---|---|---|
Pairing — capabilities and procedures |
| |
SMP — register callbacks |
|
SDK: Developing with WiSeConnect SDK, BLE API Reference guide — Overview.