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.
When I use selfsigned certificate the communication to server is happening. But when I use CA certified certificate I am getting below error
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
I am implementing SSL xmpp connection. we use openfire as xmpp server. I am using below code for verifying the certificate.
- xmpp.OnValidateCertificate += delegate(object o, CertificateEventArgs e) {
- //logger.Info(e);
- logger.Info("On Validate Certificate");
- e.AcceptCertificate = ValidateServerCertficate(o, e.Certificate, e.Chain, e.SslPolicyErrors);
- };
- private bool ValidateServerCertficate(
- object sender,
- X509Certificate cert,
- X509Chain chain,
- SslPolicyErrors sslPolicyErrors) {
- bool retrunValue = false;
- System.Diagnostics.Debugger.Launch();
- logger.Debug("Certificate Issuer " + cert.Issuer.ToString());
- logger.Debug("Certificate Expiry " + cert.GetExpirationDateString());
- logger.Debug("Certificate Public Key " + cert.GetPublicKeyString());
- retrunValue = (sslPolicyErrors == System.Net.Security.SslPolicyErrors.None);
- // return acceptAllCertificate;
- return retrunValue;
- }
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)
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