<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Resolving private resolvable addresses</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12083/resolving-private-resolvable-addresses</link><description>Is there a way to resolve a private resolvable address on connection? I have all the bonding information, IRKs etc, from everything which I&amp;#39;m bonded with, I&amp;#39;d like to work out at connection time who&amp;#39;s connected to me. With public addresses it&amp;#39;s easy,</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Feb 2016 13:15:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12083/resolving-private-resolvable-addresses" /><item><title>RE: Resolving private resolvable addresses</title><link>https://devzone.nordicsemi.com/thread/45725?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2016 13:15:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30a71563-cd87-43eb-867d-c018de36e494</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;perfect - if I&amp;#39;d read the spec properly and realized it was AES-128 I might have gotten further with it myself. I can work with those, thanks very much.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Resolving private resolvable addresses</title><link>https://devzone.nordicsemi.com/thread/45724?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2016 12:29:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32a5f29e-d3f9-44c6-b389-5a13dd61358f</guid><dc:creator>P&amp;#229;l H&amp;#229;land</dc:creator><description>&lt;p&gt;Hi RK&lt;/p&gt;
&lt;p&gt;You can try to use some of the functions attached to match a resolvable random address if you already have the IRK. But you would have to iterate over multiple IRK&amp;#39;s. The AAR is as you mentioned not accessible when the SD is enabled.&lt;/p&gt;
&lt;p&gt;Here is some functions related to IRK.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void generate_address_checksum(uint8_t * p_random, uint8_t * p_checksum, uint8_t * p_irk_array)
{
  nrf_ecb_hal_data_t encryption_data = {0};
  uint32_t errcode;
  uint8_t i;

  /* Reverse the array as the ECB expect it in big endian format */
  for (i=0; i&amp;lt;sizeof(encryption_data.key); i++)
  {
    encryption_data.key[i] = p_irk_array[sizeof(encryption_data.key)-1-i];
    if (i &amp;lt; 3)
    {
      encryption_data.cleartext[15-i] = p_random[i];
    }
  }

  errcode = sd_ecb_block_encrypt(&amp;amp;encryption_data);
  if(errcode)
  {
    ASSERT(false);
  }
  
  for (i=0; i&amp;lt;3; i++)
  {
    p_checksum[i] = encryption_data.ciphertext[15-i];
  }
}

bool match_random_address(ble_gap_addr_t address, uint8_t * p_irk_array)
{
  ble_gap_addr_t tmp_addr;

  if (address.addr_type != BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE)
  {
    return false;
  }

  memcpy(&amp;amp;tmp_addr.addr[3], &amp;amp;address.addr[3], 3);

  generate_address_checksum(&amp;amp;tmp_addr.addr[3], &amp;amp;tmp_addr.addr[0], p_irk_array);
  return (memcmp(address.addr, tmp_addr.addr, sizeof(address.addr)) == 0);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Keep in mind that I have not validated the code with the latest softdevice.&lt;/p&gt;
&lt;p&gt;BR
Pål&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>