This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

peer manager and iPhone encryption key

I'm testing pairing and bonding with an iPhone running iOS 9.3.1 and nRF52832. I'm running into trouble when reconnecting to a previously paired device.

The first time I pair and enable encryption, everything works perfectly. The next time I connect to the iPhone, peer manager immediately gives me a PM_EVT_CONN_SEC_FAILED event every time with reason PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING.

calling pm_conn_secure(periph_conn.periph_conn_hand, true); has no effect as well as pm_conn_secure(periph_conn.periph_conn_hand, false);

either one will return NRF_SUCCESS but the link never re-pairs or encrypts. This is is serious problem for ANCS since the application is blocked from that service over an unencrypted link.

The only way to get the link to encrypt is to forget the device in the bluetooth settings and then reconnect to it. But again, this only works once. So even though the iphone will always auto-connect to the device, the peer manager always sends the PM_EVT_CONN_SEC_FAILED event.

my security parameters are as follows:

sec_param.bond           = 1;
sec_param.mitm           = 0;
sec_param.io_caps        = BLE_GAP_IO_CAPS_NONE;
sec_param.oob            = 0;
sec_param.min_key_size   = 7;
sec_param.max_key_size   = 16;
sec_param.kdist_own.enc  = 1;
sec_param.kdist_own.id   = 1;
sec_param.kdist_peer.enc = 1;
sec_param.kdist_peer.id  = 1;

I have not seen this behavior on Android 5+.

This project is built with

S132 v2.0.0

nRF52832

nRF5 SDK v11.0.0

Release date: Week 10, 2016

Eclipse Mars GCC 5 2016q1

Related