Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
martinbach #1
Member since Mar 2009 · 60 posts
Group memberships: Members
Show profile · Link to this post
Subject: How to use ssl certificate in MatriX while connecting to the server (for e.g. Openfire)
Hi Alex,
I alway have (or mean to) disable ssl on server side to get connected to the xmpp server (e.g. Openfire).
What xmpp/MatriX specific (ssl certifiacte) I have to do in the connection process to get connected while ssl is enabled on server side.
Do you have some lines of code ?
Thank you.

( I'm feeling a bit lonely in the Matrix .net forum ;-(    )

Thanks,
Martin
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by martinbach:
I alway have (or mean to) disable ssl on server side to get connected to the xmpp server (e.g. Openfire).
What xmpp/MatriX specific (ssl certifiacte) I have to do in the connection process to get connected while ssl is enabled on server side.
Do you have some lines of code ?

there should be o problems with TLS.YOu can verify server certificates in the OnValidateCertificate callcack.
Here is a snipped from my current example code:
  1. private void xmppClient_OnValidateCertificate(object sender, CertificateEventArgs e)
  2. {
  3.     ValidateCertificate(e);
  4. }
  5.  
  6. private void ValidateCertificate(CertificateEventArgs e)
  7. {
  8.     DisplayEvent("OnValidateCertificate");
  9.    
  10.  
  11.     if (e.SslPolicyErrors == System.Net.Security.SslPolicyErrors.None)
  12.     {
  13.         e.AcceptCertificate = true;
  14.     }
  15.     else
  16.     {
  17.         X509Certificate2UI.DisplayCertificate(new X509Certificate2(e.Certificate));
  18.         if (MessageBox.Show("Accept Certificate", "Certificate", MessageBoxButtons.YesNo) == DialogResult.Yes)
  19.             e.AcceptCertificate = true;
  20.         else
  21.             e.AcceptCertificate = false;                
  22.     }
  23. }

Quote by martinbach:
( I'm feeling a bit lonely in the Matrix .net forum ;-(    )

this will hopefully change very soon, because I am working hard to finish release 1.0 for the public.

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: