<?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>Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28505/bluetooth-mesh-key-generetion-and-handling</link><description>The Bluetooth Mesh Light Switch example shows how to work with keys for a Mesh Network.
But I have some questions about who generate the keys and what they are used for. 
 The example provisioner uses these keys: 
 dsm_handle_t m_netkey_handle;
dsm_handle_t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Dec 2017 14:08:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28505/bluetooth-mesh-key-generetion-and-handling" /><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112809?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2017 14:08:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1774876a-267d-4033-a3c5-383d3f3a75eb</guid><dc:creator>S&amp;#248;renHN</dc:creator><description>&lt;p&gt;After working more with this and reading the other answer, I think i understand it this better and write this for others who would like a better understanding.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Network Keys:&lt;/strong&gt;
Network keys is generated and distributed by the provisioner, the main network key is shared by all nodes in the network and the config client and server uses this subnetwork to communicate.&lt;/p&gt;
&lt;p&gt;The netkey_index is used for avoiding sending the whole network key every time a model should use a subnetwork. Instead the network key is sent once and when the key is to be used again later, it is just referenced by its index.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Application Key:&lt;/strong&gt;
The application key is used the same way as the network.
It is just used by another layer in the bluetooth mesh stack.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Device Keys:&lt;/strong&gt;
The device key is a specific key for each device.
It is used by the config_client for configuring a device.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Server Handles:&lt;/strong&gt;
The server handles is maybe no given the best name in the example as they reefer to the element in which the light server models exist.
I have renamed them to element_handle in my own project for clarity.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Group Handle:&lt;/strong&gt;
The group handle reefers to the group address for all the light servers in the example.&lt;/p&gt;
&lt;p&gt;For being able to use a group address, the config_client should first tell the model to listen for messages to this group address, also known as adding the model to a group.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112808?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 15:23:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82e2eca7-10e3-4118-8aec-23a6dd8b09e6</guid><dc:creator>S&amp;#248;renHN</dc:creator><description>&lt;p&gt;Hi Bjørn, thank you for you answers.
I think I finally have figured out how the group address work.
I thought the node was somehow added to the group.
But it is more like the group being added to a node by being sent the group ID.&lt;/p&gt;
&lt;p&gt;I do still not completely understand how the subnetworks work, but I will look the dsm source code and see if i can figure it out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112807?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 12:41:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6f6589d-28d7-452b-a862-1a477054eb4b</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Hi SørenHN. Sorry for the delayed response. I hope my updated answer answers all of your questions. Let me know if something doesn&amp;#39;t make sense.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112806?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 10:36:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cce1e8f6-38ce-466f-a062-117dd6fc7ceb</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;I am pretty sure subnetworks are connected to the network (see &lt;a href="https://www.bluetooth.com/what-is-bluetooth-technology/how-it-works/le-mesh/mesh-glossary#subnet"&gt;Bluetooth Mesh Glossary&lt;/a&gt;, search for subnet). The definition posted there is: &amp;quot;Networks may contain one or more subnets&amp;quot;. Therefore, the subnetwork must be a part of the bigger main mesh network.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112805?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 09:45:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6a447c7-c35f-44b1-8877-47336f1e341f</guid><dc:creator>S&amp;#248;renHN</dc:creator><description>&lt;p&gt;Yes, i think it makes sense.&lt;/p&gt;
&lt;p&gt;The thing I don&amp;#39;t understand about subnetworks is, are a subnetwork somehow connected to the network or are a subnetwork just another network, which the node also is a part of?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112804?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 11:41:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f84f8682-07b5-41a9-8293-172c8543404e</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;The definition of subnet is: &amp;quot;Networks may contain one or more subnets. Subnets are intended to allow secure isolation of different areas such as, for example, individual rooms in a hotel. A Node is a member of a subnet by virtue of it possessing the subnet&amp;#39;s Network Key. A Node may belong to one or more subnets by possessing one or more subnet NetKeys.&amp;quot; (&lt;a href="https://www.bluetooth.com/what-is-bluetooth-technology/how-it-works/le-mesh/mesh-glossary#subnet"&gt;see this link here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;From my understanding a network is made up of multiple subnetworks. I believe a node can be a part of one or multiple subnetworks. For example, take the hotel room example (i.e. the node). The whole network is the entire hotel, while a subnetwork could be the second floor of the hotel. Another subnetwork could be the first two floors of the hotel. Therefore, a hotel room on the second floor is a part of two different subnetworks. Does that make sense?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112803?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 10:35:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b21e4dc-306b-4246-862d-02236ec5c2c6</guid><dc:creator>S&amp;#248;renHN</dc:creator><description>&lt;p&gt;Yes, that makes sense. But how is subnet related to the network then?
Or is it more about a node being part of more than one network, one of them being the overall network and one being a subnetwork?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112802?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 10:06:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fc45f26-3475-4563-b6e7-dcde11278c99</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;I believe you can use the &lt;code&gt;dsm_subnet_add()&lt;/code&gt; function to add the overall network to the DSM bit by bit (or subnet by subnet). I guess you could use this function to add a subnetwork to a very small mesh network for example. Thereby, the whole network will be added to the dsm. Does that make sense?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112801?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 09:28:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7c3036b-b110-4495-a5f5-a6454d181cb9</guid><dc:creator>S&amp;#248;renHN</dc:creator><description>&lt;p&gt;Hi Bjørn.
If &lt;code&gt;dsm_subnet_add()&lt;/code&gt; does not add the overall network to the DSM, then how is it done?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bluetooth Mesh key generetion and handling?</title><link>https://devzone.nordicsemi.com/thread/112800?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 15:18:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d60b655-888e-47d0-b6fc-d77d5ac626e9</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Hi SørenHN,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Network Key Question:&lt;/strong&gt; the dsm_subnet_add() function is used for &amp;quot;adding a subnetwork &amp;amp; associated network key indexes to device state storage&amp;quot; (&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.meshsdk.v0.9.1/group__DEVICE__STATE__MANAGER__NET__KEYS.html#ga61af630d4c79dd095dd77d10e9b42e4b"&gt;see link&lt;/a&gt;). So I don&amp;#39;t think it adds the overall mesh network to the device state manager, but instead adds the subnetwork to device state manager.&lt;/p&gt;
&lt;p&gt;And yes, the network key is generated by the provisioner &amp;amp; distributed to the provisionee that is being provisioned to the mesh network (&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v0.9.1%2Fmd_doc_getting_started_provisioning.html"&gt;see link&lt;/a&gt; &amp;amp; &lt;a href="https://blog.bluetooth.com/management-of-devices-bluetooth-mesh-network"&gt;this link, section: Adding A New Device To The Network&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Application Key Question:&lt;/strong&gt; The application key is used to generate &amp;amp; store application security material used for the mesh Rx &amp;amp; Tx. It secures communication at the access layer &amp;amp; is shared with every node in the mesh application network. It is up to the provisioner to generate &amp;amp; distribute the application keys (&lt;a href="https://www.bluetooth.com/what-is-bluetooth-technology/how-it-works/le-mesh/mesh-glossary#security_keys"&gt;see link&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Device Keys Question:&lt;/strong&gt; The device itself generates a device key, which is then shared only with the provisioner (&lt;a href="https://www.bluetooth.com/what-is-bluetooth-technology/how-it-works/le-mesh/mesh-faq"&gt;see link, search for device key&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; I previously said that the provisioner generates the device key, but this is incorrect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Server Handle Question:&lt;/strong&gt; Each element is a handle ID of the address of the server in the dsm address database. The server handles are added using &lt;code&gt;dsm_address_publish_add()&lt;/code&gt; inside the &lt;code&gt;provisioner_prov_complete_cb()&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Group Handle Question:&lt;/strong&gt; The group handle is the handle id of the group address (OXCAFE) , which is the address which states that you send a packet when you press button 4 to turn on all of the light switch servers. You said correctly that it is acquired using &lt;code&gt;dsm_address_publish_add()&lt;/code&gt; inside the &lt;code&gt;access_setup()&lt;/code&gt; function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>