I have this weird situation and I am unable to understand what could be the issue. I have a client certificate and private key, and trying to access their WSDL. I have added root certificate in ca certs, also have it in my custom truststore.jks. I was receiving PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
error which was resolved by adding root cert in jvm's cacerts.
I have create a JKS with client certificate and private key using Keytool to convert cert+key into PKCS12 format and then import the p12 to JKS.
But I am getting SSLHandshakeException
:
ERROR MESSAGE: Error connecting to web service.
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1763)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1006)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1190)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:657)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:108)
I verified the certificate and key is fine using openssl s_connect and passing cert and key as parameter. It connected fine.
Can someone please help me to reach a solution? I have enabled SSL debug in the java parameters of the application, but I am not getting any debug info, which could be logging issue with the application itself.