MQQT Server connection and decryption

Hello. I have successfully connected to mqtt.meshtastic.org but I cannot decrypt any of the messages I am recieving.
I am using base64_decord with the key of AQ== as per the web site and aes-256-ctr but nothing decodes.
Can someone please tell me what the key shoudl be, the aes type and anything else I should know. I am using PHP.
Many thanks.

1 Like

I am in a similar situation. I have my own mqtt server and successfully connected to it with a client and can see my node messages but they are all encrypted. I have the key but I am unclear on a method of decryption.

You can check this community project that decrypts them in Python.

Hi, first thing is the key is not actually “AQ==”

But rather:

key = “1PG7OiApB1nwvP+rz05pAQ==”

I wrote a basic terminal program for mqtt with decryption as an example

Changed this post.
I have it running but I have a question about the long lat.
Example I have just seen
latitude_i: -272431174
longitude_i: 1530976819
These are not long lat codes so is there something I am supposed to do with them to be able to plot them out on a map?
Thanks
Neil

You just need to add the decimal point.

Probably just need to divide by 10^7

  • Latitude: -27.2431174
  • Longitude: 153.0976819
1 Like

Ok Sure tried that but anything is possible at the moment with me.
One more question. In your code example which works, when you get a response of a long lat why is there no id to connect it to.
I see device metrics but no id, long lat but no id.
The user details have an ID.
So how do I link it all together?
Thanks

I think I may have it.
Neil

Try printing the message_packet after you finish decoding the packet.

You’ll get everything. Just will have some unformatted data.

data = mesh_pb2.Data()
data.ParseFromString(decrypted_bytes)
message_packet.decoded.CopyFrom(data)

print(message_packet)

1 Like

Hello. Thanks for all your help.
I have it all running now but the information does not seem a much as I would have expected.
Do I need to configure the following? I am listening on the LongFast channel.
root_topic = “msh/ANZ/2/c/” (I know realise that is Australia new zealand so what is worldwide or at least Europe)
to get more traffic? I want to get all the data but the current configuration seems to only have about 16 nodes (so far) or do I have to wait for a long time to get data?
I am receiving data all the time and assembling it correctly.
Thanks

Additional. I have found a list of others Initial Configuration | Meshtastic.
but when I use root_topic = “msh/EU_868” the result is nothing gets received. Is there more to the root topic?

See MQTT topics. There was a recent change in the firmware that included the region in the root topic after msh/, so it might be some nodes still use without region while others have it with region.

If you want to see where the activity is, I would recommend using MQTT explorer.

1 Like