PSOC 4 BLE Android Keypass Authentication

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

cross mob
ChNi_2249236
Level 3
Level 3

Hey guys,

   

I'm trying to implement a project that connects the BLE through a secured pairing method instead of an open connection. The Cypress examples in the 100 projects in 100 days seem to not use Key pass Authentication when it comes to the Android Implementations. Has anyone managed to do something with key pass authentication with the BLE and an Android Application?

   

Thanks!

0 Likes
9 Replies
Anonymous
Not applicable

Here is the Cypress example that does what you are looking for on a BLE-level; I imagine it would be the same for the android app, but with the android app running one side of the connection.

   

http://www.cypress.com/blog/100-projects-100-days/project-015-bonding

0 Likes
ChNi_2249236
Level 3
Level 3

The only problem is I don't know how to initiate the key pass exchange between android and the BLE Device

0 Likes
Anonymous
Not applicable

CyBle_GapAuthReq(connHandle.bdHandle, &cyBle_authInfo); Should work for initiating the key pass exchange on the cypress-chip side of the connection. I imagine android has something similar; Here is a related stack exchange post: http://stackoverflow.com/questions/17168263/how-to-pair-bluetooth-device-programmatically-android

0 Likes
ChNi_2249236
Level 3
Level 3

Do you call CyBle_GapAuthReq(connHandle.bdHandle, &cyBle_authInfo) while advertising or once a connection has occured? Cause if it's after you're already connected it kind of seems pointless. How does one enable a passkey for the BLE in the settings?

0 Likes
Anonymous
Not applicable

You call it after connecting to the device. Since you can set the services and characteristics to be authentication or encryption protected, it is actually useful as a means of "privilege levels". If you set everything to authentication/encryption protected, then it won't allow any access until you pair/bond.

   

This example should demonstrate the process: http://www.cypress.com/blog/100-projects-100-days/project-015-bonding

   

It doesn't connect it to an "Android App", but since Bluetooth is a standard, they should be interfaceable. Under the BLE component there is a setting for security under the Gap settings (iirc).

0 Likes
ChNi_2249236
Level 3
Level 3

Thank you e.pratt, After  turning on the proper security settings in the GAP Settings as you stated

   

-> Security Mode: Mode 1

   

-> Security Level: Authenticated Pairing with Encryption

   

->I/O Capabilities: Display

   

->Bonding Requirement: Bonding

   

->Encryption Key Size (bytes) -> 16

   

 

   

On the android side you have to initiate a pairing (not the same as connecting). Everything should be taken care of afterwards.

0 Likes
Anonymous
Not applicable

Does that mean it was successful? 🙂

   

The cyblegapauthreq() should initiate the pairing when called (and successful).

0 Likes

Yeah, it was successful, I can connect using an android device with a keypass prompt. I've also tried reading directly from the device and it would not work unless pairing was successful. I didn't manually have to call "cyblegapauthreq()". I'm guessing it's being called somewhere in the exchange between the BLE devices.

0 Likes
Anonymous
Not applicable

Yeah; Most likely the android app is doing a bonding procedure when it does the pairing as well. Glad you got it working though! The cyblegapauthreq() is more for if you want to initiate the process from the cypress-chip side of the connection, if the android app starts the pairing/bonding process, then the cypress chip just needs to accept/verify the process is successful.

0 Likes