Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
Sheshagiri #1
Member since Jan 2017 · 13 posts · Location: India
Group memberships: Members
Show profile · Link to this post
Subject: Error connecting to xmpp server for SSL
Hi,
I am implementing SSL xmpp connection.  we use openfire as xmpp server.  I am using below code for verifying the certificate.

  1. xmpp.OnValidateCertificate += delegate(object o, CertificateEventArgs e) {
  2.           //logger.Info(e);
  3.           logger.Info("On Validate Certificate");
  4.           e.AcceptCertificate = ValidateServerCertficate(o, e.Certificate, e.Chain, e.SslPolicyErrors);
  5.         };
  6.  
  7. private  bool ValidateServerCertficate(
  8.         object sender,
  9.         X509Certificate cert,
  10.         X509Chain chain,
  11.         SslPolicyErrors sslPolicyErrors) {
  12.           bool retrunValue = false;
  13.           System.Diagnostics.Debugger.Launch();
  14.           logger.Debug("Certificate Issuer " + cert.Issuer.ToString());
  15.           logger.Debug("Certificate Expiry " + cert.GetExpirationDateString());
  16.           logger.Debug("Certificate Public Key " + cert.GetPublicKeyString());
  17.  
  18.           retrunValue = (sslPolicyErrors == System.Net.Security.SslPolicyErrors.None);
  19.       //    return acceptAllCertificate;
  20.           return retrunValue;
  21.     }

When I use selfsigned certificate the communication to server is happening.  But when I use CA certified certificate I am getting below error

2017-10-26 14:15:15,828 [17] ERROR MessageBroadCast.Logger - Error in connection
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted
   --- End of inner exception stack trace ---
   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at Matrix.Net.ClientSocket.DoStartSecurityLayer(SslProtocols protocol)

Please help me to identify what is the mistake I am doing when we use the CA certified certificate.

I have used steps mentioned in below link to import the certificate in openfire http://download.igniterealtime.org/openfire/docs/latest/do…

Thanks in advance
This post was edited on 2017-10-28, 11:10 by Alex.
Avatar
Sheshagiri #2
Member since Jan 2017 · 13 posts · Location: India
Group memberships: Members
Show profile · Link to this post
Below is Send and Receive XML

  1. Send XML
  2. <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
  3. xmlns="jabber:client" to="devserver.com" version="1.0" >
  4.  
  5. Receive XML :
  6. <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="devserver.com" id="2jg3zzl9uz" xml:lang="en" version="1.0" >
  7. 2017-10-26 14:53:32,079 [16] DEBUG MessageBroadCast.Logger - Receive XML : <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  8.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  9.     <required />
  10.  </starttls>
  11.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  12.     <mechanism>PLAIN</mechanism>
  13.  </mechanisms>
  14. </stream:features>
  15.  
  16. Send XML <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  17.  
  18. Receive XML : <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
  19.  
  20. Send XML : </stream:stream>

After this it goes to error handler
This post was edited on 2017-10-28, 11:11 by Alex.
Avatar
Alex #3
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This exception bubbles up from System.Net.Security inside of the. NET framework.
I assume something is wrong with you certificate or CA.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: MatriX RSS