samedi 18 juin 2016

PKIX path build error: Not sure I'm creating keystore correctly

I'm 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 at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) at sun.security.ssl.Handshaker.processLoop(Unknown Source) at sun.security.ssl.Handshaker.process_record(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at com.towerdata.api.personalization.TowerDataApi.getJsonResponse(TowerDataApi.java:246) at com.towerdata.api.personalization.TowerDataApi.queryByEmail(TowerDataApi.java:101) at EmailActivityMetricsRequestor.requestTowerData(EmailActivityMetricsRequestor.java:57) at EmailActivityMetricsRequestor.Requestor(EmailActivityMetricsRequestor.java:44) at Main.main(Main.java:21) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(Unknown Source) at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) at sun.security.validator.Validator.validate(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ... 17 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source) at java.security.cert.CertPathBuilder.build(Unknown Source) ... 23 more

I have done the following:

  • I updated to JRE8 thinking that the CA might be old
  • Changed JRE8 to my build path in eclipse. The first time I did this, it fixed my issues and I was able to make HTTP requests until I closed out of eclipse. Got the same error again after that.
  • Downloaded their root cert through google chrome and tried adding it to the keystore by doing the below command (using windows, ran cmd.exe in admin mode)
  • I also tried running Eclipse in Admin mode

When I get the details on the websites security that I'm making requests to, 3 certs come up. The rootca, an intermediate, and a 3rd. Do I need all of those certs to make a valid keystore? If so how do I do that. I used the following code below to make a keystore for the rootca but that hasn't fixed my issues.

.keytool -import -trustcacerts -keystore cacerts -storepass changeit -noprompt -alias alex -file C:UsersAlex.cauthenDocumentsCA1.cer

Aucun commentaire:

Enregistrer un commentaire