连接到AWS IOT MQTT

huangapple go评论70阅读模式
英文:

Connect to AWS IOT MQTT

问题

尝试使用MQTT Explorer客户端连接到AWS IoT MQTT服务器,但连接失败。

我已经在连接设置中设置了来自AWS的证书和密钥文件:

服务器证书(CA)- AmazonRootCA1.pem
客户端证书- 6de1c9d4f67f738f68bb989250cc80f96ed28b3f617de402d317a0e28552aaaf-certificate.pem.crt
客户端密钥- 6de1c9d4f67f738f68bb989250cc80f96ed28b3f617de402d317a0e28552aaaf-public.pem.key
未使用的- 6de1c9d4f67f738f68bb989250cc80f96ed28b3f617de402d317a0e28552aaaf-private.pem.key

其他设置:

协议mqtt
主机:a3cnel9blokaaa-ats.iot.us-east-1.amazonaws.com
端口:8883
加密:tls
验证证书:true

可能出了什么问题?

英文:

Trying to connect to AWS IOT MQTT server with MQTT explorer client. Client is trying to connect, but fails.

I have certificate and key files from AWS that I set in connection settings:

Server certificate (CA) - AmazonRootCA1.pem
Client certificate - 6de1c9d4f67f738f68bb989250cc80f96ed28b3f617de402d317a0e28552aaaf-certificate.pem.crt
Client key - 6de1c9d4f67f738f68bb989250cc80f96ed28b3f617de402d317a0e28552aaaf-public.pem.key 
Not used - 6de1c9d4f67f738f68bb989250cc80f96ed28b3f617de402d317a0e28552aaaf-private.pem.key

Other settings:

Protocol mqtt
host : a3cnel9blokaaa-ats.iot.us-east-1.amazonaws.com
port : 8883
encryption: tls
validate certificate : true

What might be wrong?

答案1

得分: 1

正如@Brits在评论中指出的,当使用证书来识别客户端时,您需要使用私钥来签署请求,而不是公钥。

这是因为在公钥/私钥加密中,公钥是您向世界分发的(因此是公开的),所以其他人可以验证只有您拥有私钥的访问权限。

英文:

As @Brits pointed out in the comments, when using Certificates to identify a client you need to make use of the private key to sign the request, not the public key.

This is because with public/private key crytography the public key is what you distribute to the world (hence public) so everybody else can verify that you (and only you) have access to the private key.

huangapple
  • 本文由 发表于 2023年6月8日 23:49:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76433636.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定