Rust challenge 4/100 - LoRaWAN PHYPayload Join-Request Parsing
Table of content
What is this?
The rules of the game are explained in my original post.
4th Challenge
Challenge
Write a parser for LoRaWAN PHYPayload of lorawan spec. v1.1 Join-Request uplinks. New to this spec is that the keys are not sent with the join request as was the case for v1.0.x
Size (bytes) | 1 | 7..M | 4 |
---|---|---|---|
PHYPayload | MHDR | MACPayload | MIC |
Bit # | 7..5 | 4..2 | 1..0 |
---|---|---|---|
MHDRbits | MType | RFU | Major |
MType | meaning |
---|---|
000 | Join-request |
001 | Join-accept |
010 | Unconfirmed Data Up |
011 | Unconfirmed Data Down |
100 | Confirmed Data Up |
101 | Confirmed Data Down |
110 | Rejoin-request |
111 | Proprietary |
Size (bytes) | 8 | 8 | 2 |
---|---|---|---|
Join-request | JoinEUI | DevEUI | DevNonce |
MIC Calculation
Calculated according to RFC4493
cmacJoin = aes128_cmac(NwkKey, MHDR | JoinEUI | DevEUI | DevNonce)
MICJoin = cmac[0..3]
Solution
Checking the MIC was too much work, but the structure was parsed..
See source on github see running version on rust playground