You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Kavita Kumbharkar <ka...@gmail.com> on 2022/11/07 18:52:55 UTC

REST apache camel SSL not working with config

Hi Team,
I am facing one issue while executing apache camel Rest api with mutual tls.

I tried using the SSL properties listed below, but it didn't work.
*-Djavax.net.ssl.keyStore=<JKS_FILE_PATH>
-Djavax.net.ssl.keyStorePassword=<PASSWORD> -Dhttps.protocols=TLSv1.2*
 Got the error:

"PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested
target","ErrorSeverity":"HIGH","ErrorType":"APPLICATION","MoreInfo":"","ExceptionDetailMessage":"PKIX
path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested
target","ExceptionStackTrace":"javax.net.ssl.SSLHandshakeException:
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target\n\tat
java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)\n\tat
java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:353)\n\tat
java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:296)\n\tat
java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:291)\n\tat
java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:654)\n\tat
java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:473)\n\tat
java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume


But with the following code, am able to establish an SSL connection with
the endsystem.



* Endpoint setupSSLConext(CamelContext camelContext) throws Exception {
   KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource(jksfilePath);        ksp.setPassword(* *jks_password*



























*);       KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyStore(ksp);        kmp.setKeyPassword(jks_password);
 SSLContextParameters scp = new SSLContextParameters();
scp.setKeyManagers(kmp);                SSLContextClientParameters scsp =
new SSLContextClientParameters();        scp.setClientParameters(scsp);
   HttpComponent httpComponent = camelContext.getComponent("https4",
HttpComponent.class);        httpComponent.setSslContextParameters(scp);
    return httpComponent.createEndpoint(endpoint);    } public void
configure() throws Exception {        Endpoint httpsEndpoint =
setupSSLConext(getContext()); .. ... ... from("direct:route1")
.to(httpsEndpoint) ... ... ... .end() }*

Could you kindly explain why it isn't working with the aforementioned
properties?
If there is a way to configure it or pass it on the command line, that
would be very helpful.

Thank you!