esp32 umqtt ssl problem (ca_cert)

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
kobe
Posts: 2
Joined: Tue May 12, 2020 6:35 pm

esp32 umqtt ssl problem (ca_cert)

Post by kobe » Tue May 12, 2020 7:00 pm

Hello,

I successfully connected my esp32 to a local broker. Afther this connection I tried to add ssl for a secure connection. I got a ca_cert of my broker and tested this new secure connection. To connect the esp32 with ssl I only had to change one line of code:

Code: Select all

client = MQTTClient("kobe_client",SERVER, user = USERNAME, password = PASSWORD,port = 8883,ssl=True, ssl_params = {"cert_reqs":ussl.CERT_REQUIRED, "ca_certs":cert_data})
The problem is the ussl.CERT_REQUIRED. I get an error AttributeError: 'module' object has no attribute 'CERT_REQUIRED'. This is weird since I saw online that CERT_REQUIRED is an option of ussl. https://docs.micropython.org/en/latest/ ... /ussl.html

I know the problem is not in the broker or certificate since is got a successful encrypted connection using the ca_certificate with node-red. My micropython version is v1.2. If You want more information feel free to ask.

Can someone help me?

SpotlightKid
Posts: 404
Joined: Wed Apr 08, 2015 5:19 am

Re: esp32 umqtt ssl problem (ca_cert)

Post by SpotlightKid » Tue May 12, 2020 8:43 pm

Unfortunately, the documentation exhibits, uhm, some mismatch with reality:

https://github.com/micropython/micropython/issues/3646
https://github.com/micropython/micropyt ... tls.c#L367

kobe
Posts: 2
Joined: Tue May 12, 2020 6:35 pm

Re: esp32 umqtt ssl problem (ca_cert)

Post by kobe » Fri May 15, 2020 9:46 am

Thank you for the reply.


So the cert_required constant should not work on the esp8266 but should work on the esp32 but in reality it doesn't work on both?

This issue can't be solved by updating the micropython firmware on the esp32 or something similar (it looks weird to me they post wrong documentation)?

Post Reply