Re: BLE security/encryption/passkey authentication

2018-07-10 Thread Andrzej Kaczmarek
FYI: seems like it works fine if you enter passkey with leading zeroes in Android (e.g. "001234" instead of "1234"). Not sure why it works like this as passkey is handled as integer value during pairing process, but Android is apparently full of surprises ;-) Best, Andrzej On Mon, Jul 9, 2018 at

Re: BLE security/encryption/passkey authentication

2018-07-10 Thread Andrzej Kaczmarek
Hi, There is no such method to protect services from being discovered, but this is "by design" as per Bluetooth Core spec [1]. As you said, you can just protect access on characteristic level by combining BLE_GATT_CHR_F_XXX_ENC (requires encryption, allows unauthenticated key) and

Re: BLE security/encryption/passkey authentication

2018-07-10 Thread Amr Bekhit
I've experimented some more. If I declare a characteristic with the BLE_GATT_CHR_F_XXX_ENC flags, then accessing that characteristic prompts me for a pin code, and if I connect from a previously bonded profile, then no pin is requested (as expected). So this seems to work fine, in that I can pin

Re: BLE security/encryption/passkey authentication

2018-07-10 Thread Amr Bekhit
Hi Andrzej, Thank you - that does indeed work. I have another question. Bonding now works (i.e. using the nRF52 Connect app on Android, I connect to the advertising end device and then bond with it to save the credentials), however I would also like to configure the end device so that it

Re: BLE security/encryption/passkey authentication

2018-07-09 Thread Amr Bekhit
Hi Andrzej, Below is my GAP event callback function and the console output when I attempt to bond with my device (I'm using the Nordic nRF Connect app on my phone to interact with the device): static int bleprph_gap_event(struct ble_gap_event *event, void *arg) { int rc = 0;

Re: BLE security/encryption/passkey authentication

2018-07-09 Thread Andrzej Kaczmarek
Hi, On Mon, Jul 9, 2018 at 10:49 AM Amr Bekhit wrote: > > I've been playing around further. After including the > @apache-mynewt-nimble/nimble/host/store/config package, when > attempting to bond via my phone I now get request for a passkey (I've > configured the bluetooth device to indicate

Re: BLE security/encryption/passkey authentication

2018-07-09 Thread Amr Bekhit
I've been playing around further. After including the @apache-mynewt-nimble/nimble/host/store/config package, when attempting to bond via my phone I now get request for a passkey (I've configured the bluetooth device to indicate that it has a display only). I'm trying to figure out how to tell the