gpt4 book ai didi

c++ - Arduino ESP8266HTTPClient : Handshake failure (SSL error 40)

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

我遇到了 ESP8266HTTPClient 和 SSL 的问题。

#include <ESP8266HTTPClient.h>

const char* url= "https://someUrl.com";
const char* fingerPrint= "SO ME SH A1 FI NG ER PR IN T";

HTTPClient http;
http.begin(url, fingerPrint);
http.GET();

执行此操作时,我在调试日志中收到以下内容:

状态:发送 Client Hello (1)
警报:握手失败
错误:SSL 错误 40
警报:意外消息
错误:SSL 错误 40
警报:关闭通知
[HTTP-Client] 无法连接到 someUrl.com:443

我试着检查 grc 上的指纹并得到以下响应:

The SSL/TLS security certificate obtained from the remote server was invalid. The trouble was severe enough that we were unable to obtain the certificate's common name and/or fingerprint. There is a server answering on the HTTPS port 443 of the IP address associated with the domain name you supplied (shown above). But the server may be answering HTTPS as if it was HTTP and returning a web page rather than a proper SSL/TLS setup handshake. (We have encountered this behavior.)

这让我相信主机上的 SSL 配置有问题。但是用我的浏览器(试过 IE、Edge 和 FireFox)访问 url 时证书没有问题。

根据 this comment to an issue on github只有两个受支持的密码套件:

  • TLS_RSA_WITH_AES_128_CBC_SHA 和
  • TLS_RSA_WITH_AES_256_CBC_SHA

主机支持以下密码套件:

  • TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
  • TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

有没有机会在 ESP8266 上向该主机执行 HTTPS 请求?也许是另一个 HttpClient 库?

最佳答案

不幸的是,Arduino ESP8266 不适用,因为无论您使用什么 HTTP 客户端库,它都使用 axTLS。他们根本不支持它。

然而,不久前 Espressif 的 SDK 切换到了 mbedTLS,并且 mbedTLS Supported Cipher Suites表明它包括对这些密码的支持。然而,使用 Arduino SDK 编写的代码在很大程度上与 Espressif SDK 不兼容。

关于c++ - Arduino ESP8266HTTPClient : Handshake failure (SSL error 40),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49878604/

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