Comments (6)
Another attempt with a new packet also gave the same error.
This is the packet 40 CE 18 01 26 80 00 00 01 6D BD C3 85 C1 2A A8 AF 90 A5 A8 82 96 3E DE 61 CB 5F C4
and my keys are: NwkSKey 4C28FD6ADA8A16A71EF854888B838BD8
AppSKey BEAFAB474374A9CD1EC524E7CBF0C25A
from lora-packet.
Can you be a bit more specific on where/how you're getting this error? Are you manipulating actual buffers, and not plain hex strings?
> const lora_packet = require("lora-packet");
undefined
> const packet = lora_packet.fromWire(Buffer.from("40CE180126800000016DBDC385C12AA8AF90A5A882963EDE61CB5FC4","hex"))
undefined
> packet.MIC
<Buffer 61 cb 5f c4>
> const NwkSKey = Buffer.from("4C28FD6ADA8A16A71EF854888B838BD8", "hex")
undefined
> lora_packet.verifyMIC(packet, NwkSKey)
true
$ lora-packet-decode --nwkkey 4C28FD6ADA8A16A71EF854888B838BD8 --appkey BEAFAB474374A9CD1EC524E7CBF0C25A --hex 40CE180126800000016DBDC385C12AA8AF90A5A882963EDE61CB5FC4
decoding from Hex: 40CE180126800000016DBDC385C12AA8AF90A5A882963EDE61CB5FC4
Decoded packet
--------------
Message Type = Data
PHYPayload = 40CE180126800000016DBDC385C12AA8AF90A5A882963EDE61CB5FC4
( PHYPayload = MHDR[1] | MACPayload[..] | MIC[4] )
MHDR = 40
MACPayload = CE180126800000016DBDC385C12AA8AF90A5A882963EDE
MIC = 61CB5FC4 (OK)
( MACPayload = FHDR | FPort | FRMPayload )
FHDR = CE180126800000
FPort = 01
FRMPayload = 6DBDC385C12AA8AF90A5A882963EDE
Plaintext = 0102025802880808D5FFD17D00208A ('...X.......}. .')
( FHDR = DevAddr[4] | FCtrl[1] | FCnt[2] | FOpts[0..15] )
DevAddr = 260118CE (Big Endian)
FCtrl = 80
FCnt = 0000 (Big Endian)
FOpts =
Message Type = Unconfirmed Data Up
Direction = up
FCnt = 0
FCtrl.ACK = false
FCtrl.ADR = true
from lora-packet.
from lora-packet.
I also used the online decoder with your packet with no problem at all prior to posting my previous comment. Have you tried just removing the blanks in the hex string?
from lora-packet.
from lora-packet.
Hi @tony1tf,
glad that's sorted (and thank you to @kartben for the help!)
About the online decoder: I don't maintain this, it just uses lora-packet.
Anthony
from lora-packet.
Related Issues (20)
- Browser support HOT 1
- How to use the library with TypeScript ESM? HOT 1
- .toString() function giving "Attempt to access memory outside buffer bounds" on Join Accept messages HOT 2
- incorrect decoding of Rejoin Request (type 1)
- bogus test for Rejoin Request fromWire
- missing toString output for ReJoinRequest
- Command Line frame decoding ... HOT 2
- Decoding 1.1 LoRaWAN payload HOT 2
- unable to decode payload: FRMPayload is empty HOT 1
- Online decoder using wrong Session Key HOT 3
- Where to find Nwskey and Appskey HOT 1
- Lora Join accept giving error in Crypt JS
- Typescript and support for modern Node.js API HOT 4
- New parsed field HOT 2
- After FCNT crosses 65535, MIC Matched, but decryption of data is wrong HOT 3
- LoRa packets from YoLink sensors
- Buffer Deprecation Warning HOT 1
- npm issue HOT 1
- command not found HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lora-packet.