Issue link: https://read.uberflip.com/i/1428386
LoRaWAN Specification ©2016 LoRa™ Alliance Page 32 of 91 The authors reserve the right to change specifications without notice. Note: This mechanism prevents replay attacks by sending previously 1 recorded join-request messages with the intention of disconnecting the 2 respective end-device from the network. 3 The message integrity code (MIC) value (see Chapter 4 for MAC message description) for a 4 join-request message is calculated as follows: 1 5 6 cmac = aes128_cmac(AppKey, MHDR | AppEUI | DevEUI | DevNonce) 7 MIC = cmac[0..3] 8 The join-request message is not encrypted. 9 The join-request message can be transmitted using any data rate and following a random 10 frequency hopping sequence across the specified join channels. It is recommended to use a 11 plurality of data rates. The intervals between transmissions of Join-Requests shall respect 12 the condition described in chapter 8. 13 6.2.5 Join-accept message 14 The network server will respond to the join-request message with a join-accept message if 15 the end-device is permitted to join a network. The join-accept message is sent like a normal 16 downlink but uses delays JOIN_ACCEPT_DELAY1 or JOIN_ACCEPT_DELAY2 (instead of 17 RECEIVE_DELAY1 and RECEIVE_DELAY2, respectively). The channel frequency and data 18 rate used for these two receive windows are identical to the one used for the RX1 and RX2 19 receive windows described in the "receive windows" section of the "Physical Layer" chapter 20 No response is given to the end-device if the join request is not accepted. 21 The join-accept message contains an application nonce (AppNonce) of 3 octets, a network 22 identifier (NetID), an end-device address (DevAddr), a delay between TX and RX 23 (RxDelay) and an optional list of channel frequencies (CFList) for the network the end- 24 device is joining. The CFList option is region specific and is defined in Section 7. 25 26 Size (bytes) 3 3 4 1 1 (16) Optional Join Accept AppNonce NetID DevAddr DLSettings RxDelay CFList The AppNonce is a random value or some form of unique ID provided by the network server 27 and used by the end-device to derive the two session keys NwkSKey and AppSKey as 28 follows: 2 29 NwkSKey = aes128_encrypt(AppKey, 0x01 | AppNonce | NetID | DevNonce | pad 16 ) 30 AppSKey = aes128_encrypt(AppKey, 0x02 | AppNonce | NetID | DevNonce | pad 16 ) 31 The MIC value for a join-accept message is calculated as follows: 3 32 cmac = aes128_cmac(AppKey, 33 MHDR | AppNonce | NetID | DevAddr | DLSettings | RxDelay | CFList) 34 MIC = cmac[0..3] 35 The join-accept message itself is encrypted with the AppKey as follows: 36 aes128_decrypt(AppKey, AppNonce | NetID | DevAddr | DLSettings | RxDelay | CFList | 37 MIC) 38 1 [RFC4493] 2 The pad 16 function appends zero octets so that the length of the data is a multiple of 16. 3 [RFC4493]
