You are here

Changing Encryption settings using API | Cypress Semiconductor

Changing Encryption settings using API

Summary: 2 Replies, Latest post by Jonathan on 17 Oct 2016 09:39 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
Jonathan's picture
6 posts

I've been working on combining the OTA Fixed Stack bootloading functionality into the WPT Receiver example project, and I've been able to overcome a number of challenges in getting everything setup and configured correctly, however I am stuck on the issue of encryption.

The OTA bootloader security settings use "unauthenticated pair with encryption" and "Bonding", however the WPT Receiver needs to switch over and use the "no security" and "no bonding" security settings. Since the BLE Stack resides in the bootloader, I use the GUI to configure it for the OTA bootloader security settings (and this works just fine and I have no trouble performing OTA updates with CySmart). However, in the application code of the WPT Receiver, I am trying to change the settings to no security and no bonding in the code.

I've added code to update the cyBle_authInfo variable before making the call the CyBle_Start() in my int main() function, as shown below:

    /* Start CYBLE component and register generic event handler */

It appears that this takes effect, as I'll explain below, but that there is still something missing from truly configuring the security settings properly. Here's what I observe with CySmart when trying to interact with the WPT Receiver (not in bootloader mode): I can connect to the device, no problem, then I discover all attributes, also no problem. However, when I click the button to "Enable All Notifications", I get the error message saying "Write characteristic descriptor failed. Insufficient encryption". Note that when running the original WPT Receiver example project, "Enable All Notifications" works just fine. 

So this leads me to believe that the code shown above to update isn't taking effect, BUT, when I click "Pair" in CySmart, it responds with the message "Authentication failed. Pairing is not supported by the peer device.", so that leads me to believe that my update to cyBle_authInfo.bonding is working just fine. As you can imagine, I'm a bit perplexed as to what I need to do from here. I've scoured the BLE Stack documentation looking for any other related API calls to try in order to get the security settings to update or otherwise change the encryption settings.

I'd absolutely appreciate it if anyone could point out what I'm missing, or what else I should try in order to ensure I've removed the BLE encryption requirement from the application part of my program. Thanks so much!

jrow's picture
Cypress Employee
27 posts

The problem here is most likely in your GATT definition, which has security settings defined independently from the cyBle_authInfo structure. Can you check the Permissions section for the characteristic(s) in question in the BLE component configurator? Make sure that there are no security requirements for any enabled actions (read or write).

Jonathan's picture
6 posts

Thanks for pointing that out. I had a look and they were set for Encryption required, so changing them to No encryption required and rebuilding the code resulted in exactly the behavior I was looking for. Thanks so much for your help on this issue!

Log in to post new comments.