MQTT client with TLS/SSL on CC3200

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
danielm
Posts: 167
Joined: Mon Oct 05, 2015 12:24 pm

MQTT client with TLS/SSL on CC3200

Post by danielm » Thu Aug 25, 2016 4:31 pm

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.
Attachments
cert.zip
(2.36 KiB) Downloaded 24750 times

ubiq_01
Posts: 26
Joined: Mon Feb 08, 2016 1:45 pm
Location: Dresden, Germany

Re: MQTT client with TLS/SSL on CC3200

Post by ubiq_01 » Tue Aug 30, 2016 8:56 am

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

danielm
Posts: 167
Joined: Mon Oct 05, 2015 12:24 pm

Re: MQTT client with TLS/SSL on CC3200

Post by danielm » Tue Aug 30, 2016 4:29 pm

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

teltonique21
Posts: 11
Joined: Fri Mar 04, 2022 9:47 am

Re: MQTT client with TLS/SSL on CC3200

Post by teltonique21 » Fri Mar 04, 2022 9:57 am

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

Post Reply