Java – smack 4 throws “sslhandshakeexception: validatorexception: suncertpathbuilderexception” on the connection

For the integration test of my XMPP stack, I set up a vysper server (0.7) on localhost

Question:

Caused by: javax.net.ssl.SSLHandshakeException:
    sun.security.validator.ValidatorException: PKIX path building Failed:
    sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Since the smack 4 API has changed a lot, the examples found so far can no longer be used Has anyone tried before?

Solution

Sslhandashkeexception tells us that the SSL / TLS handshake failed because a validatorexception tells us "PKIX path construction failed", because suncertpathbuilderexception is thrown, because the Java API "cannot find a valid certificate path" requires the target "

The Java API (that is, this is not done by smack) cannot use the active sslcontext to build a valid certificate chain for server SSL / TLS certificates This is why this exception is thrown You need to provide a valid certificate (but defined by the sslcontext you are currently using) or tell smack to use the sslcontext (connectionconfiguration. Setcustomsslcontext (sslcontext)) that accepts the current server certificate

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>