-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use ssl in umqtt.simple v1.4.0 #828
Comments
the procedure is intuitively simple. To initialize an SSL context, employ the following code:
If your requirement involves utilizing SSL certificates that are not self-signed, you can direct the context to verify the certificate's location with: Following this configuration, incorporate the SSL context as a parameter when establishing your client connection. This can be achieved as shown below:
|
modified from https://docs.emqx.com/en/cloud/latest/connect_to_deployments/esp32_with_micropython.html#connect-with-ssl-tls with open("ca.crt", "rb") as f:
cadata = f.read()
ssl_params = dict()
ssl_params["cert_reqs"] = ssl.CERT_REQUIRED
ssl_params["cadata"] = cadata
ssl_params["server_hostname"] = SERVER
sslctx = ssl.SSLContext(ssl_params)
client = MQTTClient(CLIENT_ID, SERVER, PORT, USERNAME, PASSWORD, ssl=sslctx)
client.connect() |
HI, I test your code, but the REPL tell me the ssl 'module' object has no attribute 'CERT_NONE'. |
HI, when I run code
|
Build from the latest source code. |
Is there a demo to show how to use ssl in umqtt.simple v1.4.0
The text was updated successfully, but these errors were encountered: