How to handle TLS certificate using Smack XMPP library in java?

In the integration tests in Apache Vysper, we use something like: ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration("localhost", 5222); connectionConfiguration. SetSecurityMode(ConnectionConfiguration.SecurityMode. Required); connectionConfiguration.

SetSASLAuthenticationEnabled(true); connectionConfiguration. SetKeystorePath("src/main/resources/bogus_mina_tls. Cert"); connectionConfiguration.

SetTruststorePath("src/main/resources/bogus_mina_tls. Cert"); connectionConfiguration. SetTruststorePassword("boguspw") See for example: https://svn.apache.Org/repos/asf/mina/vysper/trunk/server/core-inttest/src/test/java/org/apache/vysper/xmpp/modules/extension/xep0199_xmppping/AbstractIntegrationTestCase.java.

In the integration tests in Apache Vysper, we use something like: ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration("localhost", 5222); connectionConfiguration. SetSecurityMode(ConnectionConfiguration.SecurityMode. Required); connectionConfiguration.

SetSASLAuthenticationEnabled(true); connectionConfiguration. SetKeystorePath("src/main/resources/bogus_mina_tls. Cert"); connectionConfiguration.

SetTruststorePath("src/main/resources/bogus_mina_tls. Cert"); connectionConfiguration. SetTruststorePassword("boguspw"); See for example: https://svn.apache.Org/repos/asf/mina/vysper/trunk/server/core-inttest/src/test/java/org/apache/vysper/xmpp/modules/extension/xep0199_xmppping/AbstractIntegrationTestCase.java.

Thanks. You example helps me because it doesn't crush my xmpp client any more, but what I'm looking for is a similar way as pidgin has in handle this type of situations. For example: if(certificate is valid){ do something }else{ show alert with accept decline } – Doua Beri Apr 19 at 22:55.

I think you are looking for config. SetSelfSignedCertificateEnabled(true).

Thanks for your answer but now I receive the following error: could not process incoming stanza from the xmpp server. Do you know what that means? – Doua Beri Apr 19 at 8:14.

I've just started to play a little with XMPP in java, both server and client side. The problem is that this is not a correct/valid certificate. If I test my server using pidgin an alert window pops up and tells me the certificate is invalid and a button in case I want to add an exception for this.

What I want is to do the same thing with the Smack api, but I don't know how. So here it is. What do I need to do to accept or decline invalid certificates?

Thanks for your help.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions