Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
Yasu #1
Member since Sep 2011 · 22 posts
Group memberships: Members, Premium
Show profile · Link to this post
Subject: secure BOSH connection
I tried to connect to OpenFire by using your sample code:MiniClient. (MatriX 1.4.0.1 .NET version)
To connect with XMPP over BOSH, I changed code like this.

<source code changed>
this.xmppClient.Transport = Matrix.Net.Transport.BOSH;
this.xmppClient.Uri = new System.Uri("http://localhost:7070/http-bind/");

This is successed!

But, https is no reply from server.

<source code changed>
this.xmppClient.Uri = new System.Uri("https://localhost:7443/http-bind/");

How to  connect with XMPP over BOSH by https?

Regards,
Yasu
-----XML logs----------------------------------------------------------------------------------------------------------
[https : failed log]

SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="myserver" version="1.0" >
SEND: </stream:stream>


[http : success log]

SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="myserver" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="myserver" version="1.0" id="937d504a" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>DIGEST-MD5</mechanism>
    <mechanism>PLAIN</mechanism>
    <mechanism>ANONYMOUS</mechanism>
    <mechanism>CRAM-MD5</mechanism>
  </mechanisms>
  <compression xmlns="http://jabber.org/features/compress">
    <method>zlib</method>
  </compression>
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
</stream:features>
SEND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09InpyZmcwMjE2ODAiLG5vbmNlPSJZc0haMjhJVVA0akx0c1NCYXBjb2QvdDR2MFFxMWFwZ2t5ZUQxejlqIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImFkbWluIixyZWFsbT0ienJmZzAyMTY4MCIsbm9uY2U9IllzSFoyOElVUDRqTHRzU0JhcGNvZC90NHYwUXExYXBna3llRDF6OWoiLGNub25jZT0iODcxZGE5YjU5ODgxZmQxZDNlOTc0YzdhZmNiYWYyZjg2MzYyMGI3ZjNkNjUwZDViYjU1ODEwMTZjMDBmMDU4YiIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC96cmZnMDIxNjgwIixjaGFyc2V0PXV0Zi04LHJlc3BvbnNlPTU4ZDUyYzIwZWY3ODI1ZWFlZjdlNTVmM2Q5OTkwNGQx</response>
RECV: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cnNwYXV0aD0yY2M3NTE2YTQwMzFlZjgxZjU3NWU2YzgyNWFlMDdlMA==</success>
.....
Avatar
Alex #2
Member since Feb 2003 · 4311 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
for HTTPS you need a valid SSL certificate on your server, or trust the certificate your server provides in the windows certificate store. Otherwise .NET cancels the requests.

For testing you can also accept all certificates with a ServerCertificateValidationCallback

  1. ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertficate;
  2.  
  3. private static bool ValidateServerCertficate(
  4.         object sender,
  5.         X509Certificate cert,
  6.         X509Chain chain,
  7.         SslPolicyErrors sslPolicyErrors)
  8. {
  9.    
  10.     return true;   
  11. }

Alex
Avatar
Yasu #3
Member since Sep 2011 · 22 posts
Group memberships: Members, Premium
Show profile · Link to this post
It worked!
Thanks a lot, 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