java - 使用从 ESP32 到 Spring Boot 安全 API 的预共享密钥
问题描述
我正在尝试将一些数据从 ESP32 设备发送到安全的 Spring Boot API。我正在尝试使用 Github WiFiClientPSK上提供的简单 WiFiClientPSK.ino 草图
它正在使用 client.setPreSharedKey(pskIdent, psKey); 设置预共享密钥
在服务器端,我已经设置了 Spring Boot 应用程序以接受 SSL 连接,并且我正在尝试在标头中获取 PSK。下面是代码
@RestController
public class WebController {
@RequestMapping(value="/", method = {RequestMethod.GET,RequestMethod.POST})
public String check(@RequestHeader HttpHeaders headers) {
System.out.println("Header = "+headers.toString());
return "";
}
}
这是 SSL 配置
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:springboot.p12
server.ssl.key-store-password=password
server.ssl.key-alias=springboot
server.port=8443
当我在 DEVKIT 中安装草图后尝试从 SPE32 建立连接时,我在串行监视器上收到此错误
11:58:59.169 -> Starting connection to server...
11:58:59.169 -> [V][WiFiClientSecure.cpp:146] connect(): start_ssl_client with PSK
11:58:59.169 -> [V][ssl_client.cpp:59] start_ssl_client(): Free internal heap before TLS 280500
11:58:59.169 -> [V][ssl_client.cpp:65] start_ssl_client(): Starting socket
11:58:59.342 -> [V][ssl_client.cpp:141] start_ssl_client(): Seeding the random number generator
11:58:59.342 -> [V][ssl_client.cpp:150] start_ssl_client(): Setting up the SSL/TLS structure...
11:58:59.342 -> [V][ssl_client.cpp:178] start_ssl_client(): Setting up PSK
11:58:59.377 -> [V][ssl_client.cpp:234] start_ssl_client(): Setting hostname for TLS session...
11:58:59.377 -> [V][ssl_client.cpp:249] start_ssl_client(): Performing the SSL/TLS handshake...
11:58:59.583 -> [E][ssl_client.cpp:36] _handle_error(): [start_ssl_client():253]: (-30336) SSL - No CA Chain is set, but required to operate
11:58:59.583 -> [E][WiFiClientSecure.cpp:153] connect(): start_ssl_client: -30336
11:58:59.583 -> [V][ssl_client.cpp:302] stop_ssl_socket(): Cleaning SSL connection.
11:58:59.583 -> Connection failed!
在 Spring Boot 应用程序上,我没有任何流量。有没有人这样做过或知道如何解决这个问题?
解决方案
推荐阅读
- semantic-ui - 语义 UI 可排序表排除列
- javascript - Vuex提交:JSON循环结构错误
- c++ - C ++如何以十进制(而不是十六进制)显示数组元素内存地址?
- sql-server - Tomcat8.0.45 在不同服务器上使用 Java 应用程序、SQL 服务器和 IIS 8.5
- java - 计算学生每次考试的平均分和评分
- c# - 更改文本框中的特定字符
- postgresql - 如何提升 PostgreSQL 全文搜索中的查询词?
- git - 在 VS Code 中自动将 Jira 问题编号添加到 git 提交消息中
- c# - Unity 2D 从精灵列表中更改精灵
- python - 使用 PySpark 进行高效的文本预处理(clean、tokenize、stopwords、stemming、filter)