[英]Python 3.6 SSL: CERTIFICATE_VERIFY_FAILED
I'm using the following code to connect with labeeb-iot broker. 我正在使用以下代码与labeeb-iot代理连接。
import paho.mqtt.client as mqtt
import ssl
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
client.subscribe("/focus/temp/SEnsor1/Model1/Temperature/data")
def on_message(client, userdata, msg):
print(msg.payload.decode())
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.tls_set("/etc/ssl/certs/ca-certificates.crt", certfile=None, keyfile=None, cert_reqs=ssl.CERT_REQUIRED,tls_version=ssl.PROTOCOL_TLSv1_2, ciphers=None)
client.tls_insecure_set(False)
client.connect("mea.labeeb-iot.com",8883,60)
client.loop_forever()
after the execution of the following code the result is : 执行以下代码后,结果为:
The certificate on the broker expired on the 26th May this year. 经纪人证书于今年5月26日到期。
You can verify this with the following command: 您可以使用以下命令对此进行验证:
openssl s_client -verify 2 -connect mea.labeeb-iot.com:8883 -CAfile /etc/ssl/certs/ca-certificates.crt
Which will print something like: 它将打印如下内容:
depth=0 C = QA, ST = Qatar, L = Doha, O = Qatar Mobility Innovations Center (QMIC), CN = *.labeeb-iot.com notAfter=May 26 12:24:38 2017 GMT verify return:1
深度= 0 C = QA,ST =卡塔尔,L =多哈,O =卡塔尔移动创新中心(QMIC),CN = * .labeeb-iot.com notAfter = May 26 26:24:38 2017 GMT验证回报:1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.