Page 1 of 1

MQTT client with TLS/SSL on CC3200

Posted: Thu Aug 25, 2016 4:31 pm
by danielm
I am trying to connect my CC3200 MicroPython host to "test.mosquitto.org", port 8883 with server certificate verification.

Code: Select all

c = MQTTClient(client_id = "umqtt_client", server = "test.mosquitto.org", port = 8883, ssl = True, ssl_params={"cert_reqs":ssl.CERT_REQUIRED, "ca_certs":"/flash/cert/ca.pem"})
c.connect()
I always get empty response from the socket and it causes an error:
b''
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/flash/lib/umqtt.py", line 66, in connect
IndexError: index out of range

Please find attached archive with CA certificate in .crt, .der and .pem format.
I tried to flash all of them as "/cert/ca.pem", behaviour is always the same.
According to this thread DER format should be used: http://forum.micropython.org/viewtopic.php?f=11&t=1089

I also tested these certificates with MQTT.fx (protocol set to TLSv1) - all of them worked ok.

Re: MQTT client with TLS/SSL on CC3200

Posted: Tue Aug 30, 2016 8:56 am
by ubiq_01
Hello Daniel,

can you provide a little more info on how to reproduce your setup / test? What code / libs (available at github?) are you using for the MQTT + TLS part?

Any chance to also do MQTT over Websockets (with TLS)? Also a reference to websockets + TLS with the CC3200 / WiPy / ESP8266 would be great! Based on a working example for such a transport I could most probably put the MQTT code on top.

best regards
Ralf

Re: MQTT client with TLS/SSL on CC3200

Posted: Tue Aug 30, 2016 4:29 pm
by danielm
Hi Ralf,

I used official MQTT client developed within ESP8266 MP port Kickstarter campaign:
http://forum.micropython.org/viewtopic.php?f=16&t=2023
https://github.com/micropython/micropyt ... qtt.simple

...and built-in ussl module:
http://micropython.org/resources/docs/e ... /ussl.html

I believe that the client could run over Websockets if there would be any module which would expose websocket as a regular socket. Anyway I don't see any reason to use Websockets transport in case of embedded platform.

Let us know what are your test results if you are about to test this client.

Daniel

Re: MQTT client with TLS/SSL on CC3200

Posted: Fri Mar 04, 2022 9:57 am
by teltonique21
Do you mind posting the source code for connecting to the broker and the format of the certificates used? I find a lot of rumor regarding MQTT and TLS with Micropython but very little useful and working examples.
Thank you