4.3.3 If a data frame contains a data payload, the frmpayload must be encrypted before the mic is calculated.
The encryption mechanism is based on the algorithm referred to by IEEE 802.15.4/2006 Annex b[ieee802154], using an AES key of length 128bits.
By default, the LoRaWAN layer is the data encryption/decryption for all fport. If the application layer is convenient, you can also decrypt the data in addition to FPort 0 in the upper level of the LoRaWAN layer. As for which fport to the level beyond the LoRaWAN layer for encryption and decryption, the server and the node will need to make additional communication decisions (see part 19th).
4.3.3.1 LoRaWAN Encryption
-------------------------------------
| FPort | K |
-------------------------------------
| 0 | Nwkskey |
-------------------------------------
| 1..255 | Appskey |
-------------------------------------
Lora Protocol Encryption