AnsweredAssumed Answered

SSL/TLS not working with 4.1 Alpha7

Question asked by nsaoly on Dec 29, 2014
Latest reply on Dec 30, 2014 by nsaoly

Hello ,

 

 

my xmpp server is configured to accept secured as well as unsecured connections.

When with my smack 4.1 A7 i am using with

   gconfig.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

all works good

 

as soon as i configure it with SSL/TLS connection fails as i have self signed cert on the server.
So i am using  http://svn.igniterealtime.org/svn/repos/spark/trunk/src/java/org/jivesoftware/sp ark/util/DummySSLSocketFactory.java
to accept all the certificates.

for which i use

config.setSocketFactory(new DummySSLSocketFactory());

 

Whenever i add this line server returns

 

05:34:52.775 [debug] Send XML on stream = <<"<stream:error><xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'></xml-not-well-formed></stream:erro r>">>

 

And the client show error

Dec 30, 2014 11:34:34 AM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener

WARNING: Connection closed with error

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

    at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:671)

    at sun.security.ssl.InputRecord.read(InputRecord.java:504)

    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)

    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)

    at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:882)

    at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)

    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)

    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)

    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)

    at java.io.InputStreamReader.read(InputStreamReader.java:184)

    at java.io.BufferedReader.read1(BufferedReader.java:203)

    at java.io.BufferedReader.read(BufferedReader.java:279)

    at org.jivesoftware.smack.util.ObservableReader.read(ObservableReader.java:41)

    at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2879)

    at org.xmlpull.mxp1.MXParser.more(MXParser.java:2928)

    at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1366)

    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1351)

    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1061)

    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC onnection.java:1124)

    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPCon nection.java:904)

    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnecti on.java:923)

 

 

 

Thanks ,

Am i doing anything wrong here ?

Outcomes