anthonykirby / lora-packet

LoRa radio packet decoder
MIT License
261 stars 83 forks source link

After FCNT crosses 65535, MIC Matched, but decryption of data is wrong #57

Closed mightChamp closed 3 years ago

mightChamp commented 3 years ago

Till 65535, decryption of data is perfect, but after rollover, MIC packet matched, but decryption goes wrong, I think it is due to not taking fcnt as 32bit after rollover (i.e. if after rollover value of FCNT is 10, then 65545, value of FCNT should take for decryption.

Thank You

anthonykirby commented 3 years ago

Hi @mightChamp only the lower bytes are sent on the wire - the application needs to keep track of & supply the upper bytes. There's an optional parameter (FCntMSBytes) in the API for validateMIC/calculateMIC etc to do this.

Are you setting FCntMSBytes?

If you did set FCntMSBytes and it still doesn't work then I can happily fix the code, but (as I explain in the docs) I need some example data to be able to do this.

anthonykirby commented 3 years ago

@mightChamp could you confirm whether using FCntMSBytes fixes your problem? Is it OK to close this issue?

mightChamp commented 3 years ago

Sorry for late response it solve my problem. Thank you