CYBLE_GAP_AUTH_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE When Bonded Peripheral is Reprogrammed

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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 

   
        
  1. CyBle_GapRemoveBondedDevice, and
  2.     
  3. CyBle_GapRemoveBondedDevice, followed by CyBle_StoreBondingData
  4.    
   

​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).

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

   

If I understood correctly, the problem arises you have rerogrammed the peripheral and not the central. This is expected as bonding information need to be present in both the devices. But it should have worked once you used the the CyBle_GapRemoveBondedDevice and the further steps you have mentioned on the central side. Even after this if the authentication fails, there could be a possiblity that the flash reomval was not yed done properlt. You need to call the CyBle_StoreBondingData API again and again till that API returns success (usually it requires to call twice, not more). Did you confitm that the API returns true?

   

Regards,

   

- Madhu Sudhan

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

   

If I understood correctly, the problem arises you have rerogrammed the peripheral and not the central. This is expected as bonding information need to be present in both the devices. But it should have worked once you used the the CyBle_GapRemoveBondedDevice and the further steps you have mentioned on the central side. Even after this if the authentication fails, there could be a possiblity that the flash reomval was not yed done properlt. You need to call the CyBle_StoreBondingData API again and again till that API returns success (usually it requires to call twice, not more). Did you confitm that the API returns true?

   

Regards,

   

- Madhu Sudhan

0 Likes