gpt4 book ai didi

ssl - 与 Mosquitto Broker 的安全 SSL 连接

转载 作者:太空宇宙 更新时间:2023-11-03 13:37:38 33 4
gpt4 key购买 nike

我正在尝试与 Windows 上的 Mosquitto MQTT Broker 建立 SSL 连接。 http://mosquitto.org/man/mosquitto-tls-7.html 是我用来创建证书和 key 的 url:

CA: ca.key ca.crt

Server: server.key server.crt

Client: client.key client .crt

然后我编辑了 mosquitto.conf

cafile TestSSL/ca.crt
certfile TestSSL/server.crt
keyfile TestSSL/server.key
require_certificate true
use_identity_as_username true

启动 MQTT Mosquitto Broker 之后:

C:\Program Files (x86)\mosquitto>mosquitto.exe -c mosquitto.conf -p 8883 -v
1451296913: mosquitto version 1.4.5 (build date 09/11/2015 14:34:52.97) starting

1451296913: Config loaded from mosquitto.conf.
1451296913: Opening ipv6 listen socket on port 8883.
1451296913: Opening ipv4 listen socket on port 8883.

尝试订阅 Broker:

mosquitto_sub.exe --cafile TestSSL/ca.crt --cert TestSSL/server.crt --key TestSSL/client.key -h 192.168.0.6 -p 8883 -t "TestSSL" -i "TestSSL_1234567890" -d -v

我在 Broker 看到以下错误

1451297037: OpenSSL Error: error:140780E5:SSL routines:ssl23_read:ssl
handshake failure 1451297037: Socket error on client <unknown>,
disconnecting.

最佳答案

你应该使用带有 mosquitto_pub 的 client.crt 而不是 server.crt

mosquitto_sub.exe --cafile TestSSL/ca.crt --cert TestSSL/client.crt
--key TestSSL/client.key -h 192.168.0.6 -p 8883 -t "TestSSL" -i "TestSSL_1234567890" -d -v

关于ssl - 与 Mosquitto Broker 的安全 SSL 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34491799/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com