Authentication Fails After Reprogramming because of old encryption key

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

cross mob
CoNe_349661
Level 1
Level 1
First like received

I am using unauthenticated pairing with encryption and bonding in server mode. When I connect an iOS device to the peripheral the first time everything is happy and the bonding works great. However, once I update the firmware on the peripheral, I cannot connect to the iOS device anymore unless I go into the iOS settings and forget the device (ie erase the saved encryption key). How do I recognize that the encryption key is not correct and request a new key to be shared? Or is there some other issue I am missing? Thanks!

0 Likes
8 Replies
Anonymous
Not applicable

Hi Neslen,

   

 

   

When you reprogram the device it erases the bonded information of the phone.

   

 

   

So two device after pairing and bonding, from the next time onwards they won't expect to exchange the keys.

   

 

   

After programming keys would be deleted so when phone sends pairing request, server would respond that it has no keys related to that device.

   

 

   

It is expected scenario only. Based on the device address, phone always thinks that it is the known bonded device.

   

 

   

if encryption key is not correct then pairing process will fail. You are not supposed to request new keys with the same address and with same peer device

   

 

   

 

   

Regards,

   

Vikas

0 Likes
CoNe_349661
Level 1
Level 1
First like received

I am a little confused... If the server recognizes that it doesn't have any keys related to that device, does it automatically respond to the phone without any coding on my part? It seems like it does automatically respond but iOS may be having a problem with the response, and here's why I think that's the case:

   

When I use CySmart on my android device, I connect and bond the first time, disconnect and reprogram the server, and when I try to reconnect, the android phone automatically recognizes that the key doesn't work anymore and re-pairs with the server. HOWEVER, using CySmart on my iOS device, I connect and bond the first time, disconnect and reprogram the server, and when I try to connect again, the connection process just times out and won't connect unless I manually forget the device in the iOS settings.

   

Is there something wrong with how the Cypress chip responds to iOS devices as opposed to android devices? Because everything seems fine on android but iOS struggles with out of date keys. Or is there something on the iOS app side that needs to be done that both my App developer AND the CySmart app developer missed? 

   

Does this make sense?

0 Likes
Anonymous
Not applicable

I'm facing the same issue, my cyble works as hid peripheral, using unauthenticated pairing with encryption , first time works, my problem is it can not disconnect from ios phone, when I disconnect, it will auto reconnect back, so there is no chance that other phone to pair and connect to it if I do not forget it or turn off bluetooth on ios phone.

0 Likes
Anonymous
Not applicable

I think cypress ble stack should give application level an event that the key has been lost, so the engineer could disconnect the central if the central still retain the connection even the slave response key lost.

0 Likes
Anonymous
Not applicable

Hi CodyNeslen,

   

I have same issue as you on iOS device. However I use authentication, I can connect as well at the first time. But after restart cypress module then iOS cysmart app can not connect anymore, always get time out.

   

Did you find any solution?

   

Thanks

0 Likes
Anonymous
Not applicable

Hi,

   

Update to all of you. After I tried to forget device in bluetooth setting, I can connect again as well.

   

Thanks

0 Likes
Anonymous
Not applicable

Hi @n.congvu_1902076,

   

I am using CySmart and I see the same behavior.  How do you make it to forget device in cySmart?  

0 Likes
Anonymous
Not applicable

On the PC CySmart, highlight the device in the "Device List" window and click on "Remove".

   

On Android CySmart, you can use "Forget" in the Bluetooth Settings or touch the "Paired" button top right of the entry for your device in "Ble Devices" screen.

   

No idea about iOS CYSmart but guess it is similar to Android.

0 Likes