AnsweredAssumed Answered

Smack & Android: SSLHandShakeException

Question asked by guilherme on Nov 18, 2015
Latest reply on Dec 21, 2015 by Stefan hennemann

I have installed my openfire server, and I have already tested using Spark, it works perfectly. I'm using an Amazon EC2 server.

 

Now, I'm trying to add the chat functionality to my app. I'm using Smack 4.1 with Android. I'm trying to open a connection with my server:

 

XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration

  .builder();

config.setSecurityMode(ConnectionConfiguration.SecurityMode.required);
config.setUsernameAndPassword(USERNAME, PASSWORD);
config.setServiceName(HOST);
config.setHost(HOST);
config.setPort(PORT);
config.setDebuggerEnabled(true);

 

Just to let you know I'm using the same information as above on Spark and it just works.

 

On other hand, I'm getting the following exception from Android Studio:

 

11-18 22:34:19.862 24113-24154/? E/MainActivity: org.jivesoftware.smack.SmackException: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

 

Does anyone know something about it? I've searched about this exception and I see is related to certificates. I'm not sure about the certificates on the openfire server.. I'm curious about the fact it works on Spar flawless, I think it might be something I need to do in my Android code.

Outcomes