繁体   English   中英

Spring 集成 SSL 连接上的“未找到受信任的证书”

[英]“No trusted certificate found” on Spring Integration SSL Connection

我有一个项目使用 Spring 集成进行 TCP 连接。

  • 我使用 keytool -genkey -v -keystore 命令生成了一个 .keystore 文件。
  • 我使用上面的密钥库和 keytool -export 命令生成了一个 .cert 文件。
  • 我使用上面的证书和 keytool -import 命令生成了一个 trustStore 文件。

在此之后,我在我的项目中使用了密钥库和信任库文件,如下所示:

<bean id="sslContextSupport" class="org.springframework.integration.ip.tcp.connection.DefaultTcpSSLContextSupport">
    <constructor-arg value="file:C:\Program Files\Java\jdk-11.0.6\bin\produced.keystore"/>
    <constructor-arg value="file:C:\Program Files\Java\jdk-11.0.6\bin\producedTrustStore"/>
    <constructor-arg value="TEST1234"/>
    <constructor-arg value="TEST1234"/>
</bean>
<int-ip:tcp-connection-factory ...
                               ssl-context-support="sslContextSupport"
                               .../>

当我使用此配置发送请求时,我得到

SSLHandshakeException:sun.security.validator.ValidatorException: No trusted certificate found:No trusted certificate found

我怎么解决这个问题?

使用-Djavax.net.debug=all运行以调试 TLS/SSL 问题。

您是否已将服务器的证书导入到信任库中?

请参阅此测试用例及其评论。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM