Document

LoRaWAN® Specification v1.0.3

Issue link: https://read.uberflip.com/i/1428383

Contents of this Issue

Navigation

Page 20 of 71

LoRaWAN 1.0.3 Specification ©2018 LoRa™ Alliance Page 21 of 72 The authors reserve the right to change specifications without notice. FPort K 0 NwkSKey 1..255 AppSKey Table 4: FPort list 581 The fields encrypted are: 582 pld = FRMPayload 583 For each data message, the algorithm defines a sequence of Blocks A i for i = 1..k with k = 584 ceil(len(pld) / 16): 585 Size (bytes) 1 4 1 4 4 1 1 A i 0x01 4 x 0x00 Dir DevAddr FCntUp or FCntDown 0x00 i The direction field (Dir) is 0 for uplink frames and 1 for downlink frames. 586 The blocks A i are encrypted to get a sequence S of blocks S i : 587 588 S i = aes128_encrypt(K, A i ) for i = 1..k 589 S = S 1 | S 2 | .. | S k 590 Encryption and decryption of the payload is done by truncating 591 592 (pld | pad 16 ) xor S 593 to the first len(pld) octets. 594 4.4 Message Integrity Code (MIC) 595 The message integrity code (MIC) is calculated over all the fields in the message. 596 597 msg = MHDR | FHDR | FPort | FRMPayload 598 whereby len(msg) denotes the length of the message in octets. 599 The MIC is calculated as follows [RFC4493]: 600 601 cmac = aes128_cmac(NwkSKey, B 0 | msg) 602 MIC = cmac[0..3] 603 604 whereby the block B 0 is defined as follows: 605 Size (bytes) 1 4 1 4 4 1 1 B 0 0x49 4 x 0x00 Dir DevAddr FCntUp or FCntDown 0x00 len(msg) 606 The direction field (Dir) is 0 for uplink frames and 1 for downlink frames. 607

Articles in this issue

view archives of Document - LoRaWAN® Specification v1.0.3