ZigBee 3.0理论教程-通用-1-11:安全加密-应用子层(APS)安全

源码文档软件硬件技术交流技术支持入口文末
【所有相关 IDESDK例程源码均可从群文件 免费获取免安装解压即用

 

持续更新中,欢迎关注!

 


一、总览

在APS层用来加密的密钥被称为Link key。在ZigBee网络中,虽然APS层和网络层都有加密,但是绝大部分通信都只是在网络层的加密。
一般来说,只有在传输Network Key的时候需要在应用层被加密,并且这仅在Trust Center和新设备之间发生。因此,在这种情况下,我们也将其称为Trust Center Link key。

新设备和Trust Center之间必须要在组网之前就使用哪一个Link Key达成共识,所以新设备和Trust Center之间是不需要一个Link Key的传输过程的。

网络中的设备可以使用相同的Link key或不同的Link key,只要新设备和Trust Center之间达成共识即可。

一般来说有四种Link Key,但是我们以前两种为主。后两种目前可能用得很少了,这里仅作简要描述,不做深入探讨。

二、四种类型的Link Key

2.1 Default Global Trust Center Link Key

又被称为the well-known link key,其内容如下:

Default global Trust Center link key (0:15) = 0x5a 0x69 0x67 0x42 0x65 0x65 0x41 0x6c 0x6c 0x69 0x61 0x6e 0x63 0x65 0x30 0x39

其实就是字符串“ ZigBeeAlliance09 ”。这个是在ZigBee 3.0之前就一直在广泛使用的一个相同的默认的密钥,如今得以保留主要是为了保持向后的兼容性。

所有的ZigBee设备都会有这个Default Global Trust Center Link Key。如果没有指定其他的link key的话,Default Global Trust Center Link Key就是设备在入网过程中第一个被尝试使用的密钥。

如果希望能保证和其他的ZigBee 3.0的设备之间互联互通的话,这个密钥时不能改变的。

2.2 Install Code Derived Preconfigured Link Key

在这里插入图片描述

Install Code并不是一个Key,而是一个Key的输入。Install Code是16字节多项式+ 2字节CRC,再通过固定的算法,计算可以得出Link Key。这种Link Key的传输是由人工来完成的,Install Code的实际应用场景如下图所示:

在这里插入图片描述

  • 首先,在产品生产的时候,由厂家在产线随机生成一个Install Code;
  • 然后将这个Install Code烧录到产品里面;
  • 然后把这个Install Code和Eui64打到标签上面,贴在这个产品表面;
  • 在安装的时候,安装人员利用手持设备的扫描功能,从产品标签上扫描获取Install Code和Eui64;
  • 将获取到的Install Code和Eui64告诉Trust Center(一般是协调器);
  • 然后在Trust Center上通过这个Install Code得到Link Ley,让Trust Center知道IEEE地址为Eui64的这个新设备必须使用这个Link Key进行组网;
  • 待入网的新设备这边,从flash中读取出预先烧录的Install Code,然后使用相同的算法得出Link key。

待入网的新设备这边计算得出的Link Key应与Trust Center端的派生Link Key相同。这样,即使消息已加密,他们也可以在应用程序层进行通信。接下来就开始组网的过程了。

An Install Code is a sequence of 16 bytes followed by 2 bytes of CRC. A complete 18 bytes sequence is needed to generate a unique TCLK. The usage of install codes defined in Z3.0 was added to allow a generalized out-of-band key delivery method for network commissioning. It works as follows:

  1. TC gets the install code and the 64-bit IEEE address of the device that will use this install code to join, via any user interface (serial, display and switches, etc.). The install code must be physically provided with the joining device.
  2. TC validates the CRC of the install code introduced. If this is valid then a TCLK entry is added into the TC with the derived key and the address of the corresponding device.
  3. The joining device is instructed to use its install code to generate the corresponding TCLK.
  4. The network is open by any means.
  5. The joining device performs association and the Trust Center delivers the network key encrypted in APS layer with the install code derived key.
  6. After this, the joining device must perform the update of its TCLK as BDB specification requires.

For further details on how to generate the install codes, see the Base Device Specification [7]. This is supported only by R21 or later revisions, so to allow backwards compatibility the application must have a way to attempt joining networks without the usage of Install Codes.

2.3 Distributed Security Global Link Key

在Distributed Security Network中,没有Trust Center,每个Router都可以分发 network key。

由Router父节点向新入网设备分发的network key,在APS层是使用Distributed Security Global Link Key进行加密的。

如果希望能保证和其他的ZigBee 3.0的设备之间互联互通的话,这个密钥时不能改变的。

Distributed Security Global Link Key (0:15) = 0xd0 0xd1 0xd2 0xd3 0xd4 0xd5 0xd6 0xd7 0xd8 0xd9 0xda 0xdb 0xdc 0xdd 0xde 0xdf

2.4 Touchlink Preconfigured Link Key

如果新设备是要通过touchlink的方式进行组网的话,就需要使用Touchlink Preconfigured Link Key。

Touchlink Preconfigured Link Key (0:15) = 0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7 0xc8 0xc9 0xca 0xcb 0xcc 0xcd 0xce 0xcf

(注:任何相关问题,欢迎在文末技术交流QQ群中交流讨论。)


在这里插入图片描述

 

持续更新中,欢迎关注!

 

【所有相关 IDESDK例程源码均可从群文件 免费获取免安装解压即用
源码文档软件硬件技术交流技术支持入口文末

在这里插入图片描述

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

拿破仑940911

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值