I am testing OOB keys with bonding, using a PSoC 4 BLE as the central and a PRoC BLE as the peripheral. For initial testing the key is just statically declared in each project, this removes the key transmission as a source of my problem.
When I initially program both the central and peripheral, they authenticate using the OOB data and store their bonding data. If I reset or power cycle either the central or peripheral they authenticate with the stored bonding data. It works very well.
If I reprogram the central, the peripheral asks for authentication and the central provides the OOB data then stores the bonding data.
The problem comes when I reprogram the peripheral. Then the central tries to authenticate with the stored bonding data and the peripheral rejects it. I get a CYBLE_EVT_GAP_AUTH_FAILED event with a passed in parameter of CYBLE_GAP_AUTH_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE.
I've tried
- CyBle_GapRemoveBondedDevice, and
- CyBle_GapRemoveBondedDevice, followed by CyBle_StoreBondingData
Then I always do:
CyBle_GapSetOobData(m_connHandle.bdHandle, CYBLE_GAP_OOB_ENABLE, securityKey, NULL, NULL);
CyBle_GapAuthReq(m_connHandle.bdHandle, &cyBle_authInfo);
No matter what I do the authorization fails with the insufficient encryption key size until I reprogram the central (clearing out the bonding data in flash).