Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Question about publishing to an MQTT broker using TLS

Hi Mark,

Did you call mosquitto_lib_init() first? This configures Openssl amongst other things.



On Jan 26, 2016 8:56 PM, "Mark Pilant" <lpilant@xxxxxxxxxx> wrote:

I'm doing some testing using mosquitto, and have run across a really strange situation.

On an Ubuntu system with Mosquitto 1.4.5 installed, I can run the following command to the broker without any problems:

mosquitto_pub --cafile ./rootCA.pem --cert ./cert.pem --key private-key.pem \
-h "" -p 8883 -q 0 -d \
-t "topic/test" \
-m "{\"msg\" : \"Goodbye, World\"}"

and the messages show up on the broker fine.

I've been trying to write a small test program doing the same thing (for inclusion in a larger test) and all of the "setup" (mosquitto, MQTT, TLS) appears to be getting sone correctly, but the connection never succeeds.

Looking at a network trace, it appears there is a client key exchange being done in the mosquitto_pub case, but not in my test code example.

I've looked through all my code (and the mosquitto_pub code) to see if I can spot what might be different. So far, I haven't seen anything. I would expect there might be something I'm not doing in the mosquitto TLS setup which would cause this to occur (as I would expect this handshake to occur at a pretty low level). Unfortunately, looking at the mosquitto_pub code and the mosquitto API documentation, I can't see anything which might be related.

So I'm wondering what I'm doing wrong? I expect it will be pretty simple; but I think I've been looking at the code too long :-)

- Mark

mosquitto-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top