2
votes

We are trying to connect to Tibco EMS using SSL (Java Client) with the following code

factory = new com.tibco.tibjms.TibjmsConnectionFactory(serverUrl);
connection = factory.createConnection(userName,password);

I receive this error:

Failed to connect via SSL to [ssl://host:8132]: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

How to specify certification path to requested target? I have C# client code with EMSSSL.SetTargetHostName("UAT_5653") but in java JMS dont know how to set

com.tibco.tibjms.TibjmsSSL.setExpectedHostName(ssl_hostname);
com.tibco.tibjms.TibjmsSSL.setIdentity(ssl_identity,ssl_key,ssl_password);
com.tibco.tibjms.TibjmsSSL.setVerifyHostName(false);
com.tibco.tibjms.TibjmsSSL.addTrustedCerts(cert);
1
the error is about cert path. What is in "cert" variable? it should be path to cert file like com.tibco.tibjms.TibjmsSSL.addTrustedCerts("c:\\server_cert.pem"); You may also need to add certificate to java keystore javarevisited.blogspot.com/2012/03/… - David Abragimov
thanks David, i disabled verification host by factory.setSSLEnableVerifyHost(false); factory.setSSLEnableVerifyHostName(false);,its give me make connection - Rudy
@Rudy disabling host verification means your SSL connection is not really secure. You can easily be victim of Man-In-The-Middle-attacks. - pascalre

1 Answers

0
votes

These parameters can be set in the factory object like:

TibjmsConnectionFactory factory = new com.tibco.tibjms.TibjmsConnectionFactory(serverUrl);
factory.setSSLExpectedHostName(ssl_expected_hostname);
factory.setSSLIdentity(ssl_identity,ssl_key,ssl_password);
factory.setSSLEnableVerifyHostName(false);
factory.setSSLTrustedCertificate(cert);
Connection connection = factory.createConnection(userName,password);

For more information you might take a look at the docs.