I'm getting an exception when trying to connect to a site:
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
I've read that I would need to add the public key of the site to the cacerts
file. Or I've seen solutions where they completely turn off this security feature.
Is it possible to add that one public key to the trusted keys from code?
edit: I would like to connect to this site from this application only, there is no need to add it globally for other Java programs. This would be a client application that should not really modify the host environment.