You are here

CYBLE_GAP_AUTH_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE When Bonded Peripheral is Reprogrammed | Cypress Semiconductor


Summary: 1 Reply, Latest post by Madhu Sudhan on 04 Sep 2016 12:13 PM PDT
Verified Answers: 1
Last post
Log in to post new comments.
manderson_1499671's picture
1 post

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

mady's picture
Cypress Employee
1113 posts


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?


- Madhu Sudhan

Log in to post new comments.