MQTT Tests with Paho
What is Paho?
Paho is an Eclipse tool to connect to an MQTT broker. Further information on the tool can be found at the project page
A description on how to install paho can be found here
Preconditions
OpenSSL
To format the certificates, openssl is required.
Install TrustStore
To communicate with the agrirouter via MQTT two certificates are involved. The first certificate is the server certificate, the second certificate is the one that is client specific.
The server certificate is signed by a common public intermediate CA whose root CA is already present in most system and software trust stores.
Setup Endpoint in MQTT
Create Keystore
Onboarding an MQTT endpoint provides a certificate, an MQTT client id and two topics; see onboarding.
Alternatively, the connection can be setup using a router device.
The certificate received from onboarding process needs to be formatted to work with PAHO (PAHO only, not needed for most of the other clients):
-
Copy the whole certificate field, replace the "\n" with line breaks (\r+\n) and save it to a *.pem file
-
Call the following command from within the folder you stored the *.pem file:
openssl pkcs12 -export -in myCert.pem -inkey myCert.pem -out myCert.jks