Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » PUBLIC MQTT BROKER WITH SSL/TLS(HOW TO IMPLEMENT SSL/TLS CONNECTION WITH PUBLIC BROKER)
PUBLIC MQTT BROKER WITH SSL/TLS [message #1793951] Tue, 21 August 2018 04:53
muthu pavithran is currently offline muthu pavithranFriend
Messages: 1
Registered: August 2018
Junior Member
hi everyone I am working on IOT internet of thing and am using MQTT I developed own code for publishing and subscribing using python but I need to implement SSL/TLS connection in public broker example [url] https://iot.eclipse.org/ [url] iam using this broker please help me out

MY CODE

import time
import paho.mqtt.client as paho
import ssl
#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") #create client object client1.on_publish = on_publish #assign function to callback client1.connect(broker,port) #establish connection client1.publish("house/bulb1","on")
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)

HERE IS MY ERROR
connecting to broker
Traceback (most recent call last):
File "C:\Windows\system32\config\systemprofile\Desktop\attachments\publishTEST WITH LOG.py", line 14, in <module>
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)
>>>

[Updated on: Tue, 21 August 2018 06:45]

Report message to a moderator

Previous Topic:Cannot find JVM required for new installation.
Next Topic:How to deploy Eclipse plugin to a cross-platform jar file?
Goto Forum:
  


Current Time: Sat Sep 22 22:47:18 GMT 2018

Powered by FUDForum. Page generated in 0.03470 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top