简体   繁体   中英

“No trusted certificate found” on Spring Integration SSL Connection

I have a project that uses Spring Integration for TCP connections.

  • I produced a.keystore file with keytool -genkey -v -keystore command.
  • I produced a.cert file using above keystore with keytool -export command.
  • I produced a trustStore file using above cert with keytool -import command.

After this I used keystore and truststore files in my project like this:

<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"
                               .../>

When I send a request with this config, I'm getting

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

How can I solve this problem?

Run with -Djavax.net.debug=all to debug TLS/SSL problems.

Have you imported the server's cert into the trust store?

See this test case and its comments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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