hi I am working on IOT internet of things I am using paho MQTT I need to use SSL I wrote publish code using python I got an error in "certificate verify failed"
please help me thank in advance
MY PUBLISHING CODE
import time
import paho.mqtt.client as paho
import ssl
import certifi
#define callback
def on_message(client, userdata, message):
time.sleep(1)
print("received message =",str(message.payload.decode("utf-8")))
client= paho.Client("client-001")
client.on_message=on_message
print("connecting to broker ",)
client.tls_set("C:/Windows/system32/config/systemprofile/Desktop/attachments/server iot.crt", tls_version=ssl.PROTOCOL_TLSv1_2)
client.tls_insecure_set(True)
client.connect("iot.eclipse.org", 8883, 60)
def on_log(client, userdata, level, buf):
print("log: ",buf)#connect
client.loop_start() #start loop to process received messages
print("publishing ")
client.publish("$SYS/muthu","muthupavithran",)#publish
client.on_log=on_log
client.loop_forever()
#client.loop(100)
MY ERROR IS
connecting to broker
Traceback (most recent call last):
File "C:\Windows\system32\config\systemprofile\Desktop\attachments\publishTEST WITH LOG.py", line 14, in
client.connect("iot.eclipse.org", 8883, 60)
File "C:\Python34\lib\site-packages\paho\mqtt\client.py", line 768, in connect
return self.reconnect()
File "C:\Python34\lib\site-packages\paho\mqtt\client.py", line 927, in reconnect
sock.do_handshake()
File "C:\Python34\lib\ssl.py", line 810, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)
MY CERTIFICATE IS
OpenSSL> s_client -showcerts -connect iot.eclipse.org:8883
CONNECTED(00000108)
depth=1 C = US, O = Let's Encrypt, CN = Let's Encry