Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
bilalkhan #1
Member since Oct 2016 · 81 posts · Location: Pakistan
Group memberships: Members
Show profile · Link to this post
Subject: until the TLS hand shake has not done, server send the data in plain text.
wait until tls complete handshake, i have written the below code, as we know that xmpp is async, it does not wait, during tls handshake the client send username and password, server send the sasl stream, until tls handshake is not complete it sends the data through simple socket.

In short until the TLS hand shake has not done, server send the data in plain text. Solution should i wait here until isTLSAuthenticated ?? or agsxmpp provide any solution for this??

  1. //here is my code.
  2. if (!IsTLSAuthenticated && StartTLSSupport)
  3. {
  4.     SendStreamFeatures(StreamFeatures.SSL);
  5. }
  6.  
  7. else if (!IsAuthenticated)
  8. {
  9.     SendStreamFeatures(StreamFeatures.Sasl);
  10. }
  11. else if (!IsBinded && IsAuthenticated)
  12. {
  13.     SendStreamFeatures(StreamFeatures.Bind);
  14. }
This post was edited 2 times, last on 2016-12-28, 12:22 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The server guides the client with the offered stream features.
When you want to enforce TLS then just don't send any SASL stream features until the connection is secured with TLS. And add the required tag to your TLS stream feature.

  1. <stream:features>
  2.    <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
  3.       <required/>
  4.    </starttls>
  5. </stream:features>
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: agsXMPP RSS