【问题标题】:"No trusted certificate found" on Spring Integration SSL ConnectionSpring Integration SSL Connection 上的“未找到受信任的证书”
【发布时间】:2021-01-21 15:28:26
【问题描述】:

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

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

在此之后,我在我的项目中使用了 keystore 和 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

我该如何解决这个问题?

【问题讨论】:

    标签: java spring spring-integration


    【解决方案1】:

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

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

    参见 this test case 及其 cmets。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-17
      • 2011-04-14
      • 2013-03-14
      • 1970-01-01
      • 2018-10-15
      • 1970-01-01
      • 2016-11-05
      • 1970-01-01
      相关资源
      最近更新 更多