Yes, the devices are encrypting the payload AES-128-CBC with a aesKey for each device before sending, then the lorawan packet is encrypted AES-128-CTR as usal.
Chirpstack does its job and return the payload on field “data” that is stil encrypted.
For example, this is a “data” value returned
+jRQhpCTu/b9EfVJ8fiCSpamRkKVrTYJOUapbIoNrSqdw7R08UQklVa/i+I/9MIuAAAA
base64decoded to (hexstring)
fa 34 50 86 90 93 bb f6 fd 11 f5 49 f1 f8 82 4a 96 a6 46 42 95 ad 36 09 39 46 a9 6c 8a 0d ad 2a 9d c3 b4 74 f1 44 24 95 56 bf 8b e2 3f f4 c2 2e 00 00 00
for this device the aesKey is 8B36B98FD649199BDC1827A320CF8483 and after AES-128-CBC decrypt I obtain (hexstring)
01 77 83 25 68 10 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 01 00 00 10 40 02 00 00 d4 00 06 00 00 00 00 00 00 00 00 00
it’s the payload I can really decode
01 version
77832568 timestamp
10 status
0a000000 volume at 01:00
00000000000000 deltaVolumes at 02:00 03:00 04:00 05:00
00000000000000 deltaVolumes at 06:00 07:00 08:00 09:00
00000040010000 deltaVolumes at 10:00 11:00 12:00 13:00
1040020000d400 deltaVolumes at 14:00 15:00 16:00 17:00
06000000000000 deltaVolumes at 18:00 19:00 20:00 21:00
000000 deltaVolumes at 22:00
I’ve written nodJS script to decrypt/decode the payload and I obtain this
{
data: {
frameVersion: 1,
currentDateTime: ‘2025-05-15T06:02:31.000Z’,
statusCode: 16,
status: ‘Empty spool; negative flow; leakage; burst; freeze’,
baseVolume: 10,
deltaVolumes: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 16, 9, 0, 53, 6, 0, 0, 0, 0, 0, 0 ],
volume: 114
}
}
So … I don’t know if there are other devices in the world that encrypt their payload but it
[FEATURE REQUEST ON]
*it would be cool (and not difficult to implement) to have a standard variables in device configuration like *
- encryptionCipher : [none, aes-128-cbc, aes-128-ecb, aes-128-ctr, aes-256… ]*
- encryptionNonce : [hex-string or base64]*
- encryptionKey : [hex-value or base64]*
to receive the payload already decrypted, just to be simply decoded
[FEATURE REQUEST OFF]
So, back to my own problem.
You sated that :
- I cannot use extenral libraries
- there are no exported crypto functions (also this feature would be cool, just a crypto object instanced and available to decodeUplink() function)
- all the decrypt/decode job must be done inside the decodeUplink() function in pure javascript
So, if I want to see a decoded object and the real metrics inside ChirpStack I have to rewrite aes function in pure javascript inside the decodeUplink() function … isn’t it?
Ok … not very comfortable, but neither impossible.
I’m back in the afternoon and tell you how it went.
Meanwhile , if anyone (developers? where are you?) has other info or advice or something … please do not esitate.