0

I'm trying to find how I can allow only for specific host to be trusted in Apache HttpClient java. I connect to the server using Apache HttpClient via https. The server has self-signed certificates, hence I keep getting the following error :

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 Read more: https://javarevisited.blogspot.com/2016/12/javaxnetsslsslhandshakeexception-pkix-path-building-failed-certificate-not-found.html#ixzz6avX9hNiJ.

I know that we can skip certification verification for all hosts (we can trust all hosts and certifications), but my question is how can we disable certification or trust only for single specific host I want? I need to it all programatically.

minotna
  • 167
  • 7
  • Does this answer your question? [Using a custom truststore in java as well as the default one](https://stackoverflow.com/questions/24555890/using-a-custom-truststore-in-java-as-well-as-the-default-one) – Jerry Chin Oct 15 '20 at 08:56
  • Partially, I don't to work with self-signed certificates from the server. I don't want to load them to the JVM and truststore. I would find the way to do it just programatically. – minotna Oct 15 '20 at 09:10

0 Answers0