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

How to acquire Mesh keys API

I would like to use a Bluetooth protocol analyzer for sniffing traffic in my Mesh network. I need to input the devkey(s), netkey, and appkey to the protocol analyzer software so it can decode the mesh messages. What is the best way to acquire the keys being used by a mesh node? Is there an API in the mesh SDK that will allow me to read the desired keys so I can log and capture them? I am using Mesh SDK 1.0. 

  • The call dsm_net_secmat_from_keyindex_get() returns a structure that has two keys in it (encryption and privacy). According to bluetooth.com

    "All nodes in a Bluetooth mesh network possess one or more Network Keys (NetKey), each corresponding to a subnet which may be the primary subnet. It’s possession of a network key which makes a node a member of the network. Network Encryption Keys and Privacy Keys are derived directly from the NetKey."

    We are using the Sodera Frontline which looks like it wants the root netkey in its INI file. Is there a way to get the root net key that the Network Encryption Keys and Privacy Keys are derived from?

    Is the derivation of the Network Encryption Keys and Privacy Keys standardized where anyone with the root netkey will always be able to derive the same Network Encryption Keys and Privacy Keys?

  • There is no API for the root key, so if you need that one you will have to add that functionality yourself.

    Yes, derivation of the keys is deterministic. All encryption functions are described in chapter 3.8.2 Security toolbox of the Bluetooth Mesh specification, and the keys are described in details in chapter 3.8.6 Keys.

    The encryption functions are part of internal mesh APIs which are not documented on Infocenter, but the source is part of the mesh SDK. (You find them in mesh/core/include/enc.h and mesh/core/src/enc.c.)

  • Thanks Dash... It would be interesting to get your initial take on the product if you ever get the time. We attended a webinar on its features a few months ago when it was a work-in-progress just so we could gauge how it went about decoding mesh messages etc.

Related