I am working with a custom board based on nrf52833 , SDK 17.1.0 and ble_nus service implemented.
Final goal is to be able to connect to devices only if they provide the correct password.
To do that, I have implemented peer_manager library with:
#define SEC_PARAM_BOND 1 /**< Perform bonding. */
#define SEC_PARAM_MITM 1 /**< Man In The Middle protection not required. */
#define SEC_PARAM_LESC 0 /**< LE Secure Connections enabled. */
#define SEC_PARAM_KEYPRESS 0 /**< Keypress notifications not enabled. */
#define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_DISPLAY_ONLY /**< No I/O capabilities. BLE_GAP_IO_CAPS_DISPLAY_ONLY */
#define SEC_PARAM_OOB 0 /**< Out Of Band data not available. */
#define SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE 16
and a static STATIC_PASSKEY.
After implementation, device requires password to make a bond with a central but it does not require any security for connections.
After reading some threads, I mix peer_manager implementation with whitelist so as to limit connection to devices bonded.
Now, I am able to pair with one central and then only connections with that central are allowed. However, I would like to pair with more central devices and it seems that I need to delete whitelist in order to include a new pair device. I checked MAX_BOND devices and it is 8, so theoretically, application should be able to have a whitelist of 8 device
As I said, final goal is to be able to connect to devices only if they provide the correct password.