Right. 1
So now that we've understood the content of the IP frame, we can try a little demonstration. 2
For this I will use an ABP end-device with the following configuration device address, Network session 3
key and Application Session key. 4
This gateway is in the gateway coverage so it will receive all packet from the device. 5
And finally, this device is also registered on the Network Server. 6
For this demonstration I will once again use TTNv2 and as usual, I've got one tab for my gateway 7
console and one tab for my device like data. 8
Let's start. My device transmits a message 9
representing a temperature. 10
And once this packet is transmitted and my gateway as the modulated signal, an IP frame is received 11
on the network server. 12
It appears here in both my gateway and my device live data. I stop the log so we won't be disturbed by 13
any other frames. 14
Now I'm going to analyze this frame. 15
If I want more information, I just have to click on it. 16
Then I copy paste it on my presentation for the sake of clarity. 17
We can see here that JSON text message transmitted by the gateway. 18
What do we have? 19
There are two parts. 20
First, the PHYpayload. 21
It's often called the RAW payload. 22
This is the content of the LoRa frame. 23
Somewhere in this payload there is my frame payload. 24
So my encrypted user data. 25
In this case, my temperature. 26
But in this payload, there is also many other fields which are not encrypted, like the dev address, 27
for example. 28
And secondly, there is the radio frequency transmission information. 29
Here we have an SF7 transmission with 125 kilohertz bandwidth, four over five coding rate, RSSI, 30
SNR and so on. 31
In this demonstration, I will focus on the PHY payload or the raw payload. 32
So I copy it and I will try to decode it thanks to a web application available on the Internet. 33
I copy the payload given any 64 base format. 34
If you don't know what the 64 base representation is and why, it's a nice way to represent data, then 35
you can refer to our LoRaWAN book for Beginners available on our website. 36
You will find a chapter dedicated on this point with many examples. 37
Right. 38
So what I give to the code is this message in 64 base form. 39
Let's check what the decoder returns. 40
First, it returns the message in a decimal format. 41
Then there are several section for each part of the frame. 42
The payload, as we saw in the previous video, consists of Mac header, a mac payload and a message 43
and a Message Integrity Control field for authentication. 44
The MAC payload itself also consists of another header called frame header, a frame port and a frame 45
payload. 46
And finally, the frame header is the device address, a field called frame control. 47
The frame counter and some options. 48
What we need to understand here is that most of the information given in this frame are not encrypted. 49
It's the case of the message integrity control the frame port and the device address starting with oh 50
0x2601. 51
Let's check this value on the console. 52
Yes, that's it. 53
The device address also starts with 2601. 54
And there is also the frame counter zero because it was the first frame. 55
Yes, that's it. 56
The decoder exposes the same information. 57
Zero for the frame content. 58
The frame is an unconfirmed data up, which means that this frame comes from the device and doesn't ask 59
for acknowledgement. 60
What is surprising is that the gateway managed to get the frame payload that represent my temperature. 61
Is it really my temperature? 62
No, it's not exactly that. 63
It's just a number that's been decoded, but it's still encrypted. 64
The real temperature value that was transmitted by my device and received in my application should be 65
two. 66
Can I find this value with my decoder? 67
Because right now the frame payload value is the wrong one. 68
And by the way, I don't even know if this frame has been authenticated. 69
Okay, So you know that if I want the authentication and encryption, I need the session keys : Network 70
session key and Application session key. 71
I just pick up the ones I had saved in my presentation, and I decode the frame one more time. 72
This time I have additional information. 73
First, information is about the message and quality control that decoder provides to message integrity 74
control. 75
The one transmitted by the device and the one calculated at the reception for the authentication. 76
To be successful, both value must be the same. 77
And that's the case here. 78
The second information is about the encryption of the frame payload. 79
I've received 2D, but it was encrypted and just under there is the decrypted value 02. 80
Excellent. 81
That's the one we expected. 82
And what happens if I change the keys? 83
Let's try. 84
By changing only one digit of the network session key. 85
This one, for example. 86
Then the message integrity control becomes invalid and this frame would have never reached the application 87
server. 88
Now if I reset the network station key with the right value, but I modify the application session key. 89
Then this time the frame is authenticated. 90
But the frame payload is decrypted at 7A, whereas it's supposed to be 02. 91
This value is not the correct one. 92
Okay. 93
So if we need to remember one important thing from this chapter is that the gateway only takes the 94
LoRA packet, demodulated and send it to the LoRaWAN server. The gateway doesn't need an anyway, it can't 95
check the authenticity of the frame. 96
And of course it can decrypt the message needs.