I already read this post. But I only understand about how does handshake work, the problem is I don't know how TLS work with another protocol like SIP. I'm confusing about two points:

  1. TLS keep communicating with TLS's header and the payload is whole another protocol package (example SIP package).
  2. Or they will communicate with another protocol header with the payload is encrypted by the key of TLS?

It's very similar to how we use TLS with websites. Just like we have clear-text http on (TCP/port 80) and http over TLS, also referred to as https running on (TCP/port 443) we do something very similar with SIP. SIP uses (TCP/port 5060) for cleartext and SIPS uses (TCP port 5061) for SIP over TLS.

That said to answer your question in a little more detail the two servers would externally be seen to just have a TLS connection with a client connecting to a server on (TCP port 5061) and inside of that "encrypted communication tunnel of sorts" the SIP traffic is sent from one system to another.

Useful references:



  • Your answer looks like point 2 right? – Mr2uang Mar 24 '16 at 19:42
  • It's something like this: SIP on top of TLS on top of TCP on top of IP. – Trey Blalock Mar 24 '16 at 23:35
  • That means SIP's payload is encrypted by TLS right? because I want to make an application about SIPS so I need to understand how TLS work – Mr2uang Mar 25 '16 at 3:35
  • Yes, all of SIP's payload will be encrypted by TLS. If you haven't already done so download a copy of WireShark wireshark.org and examine some SIP and SIPS traffic side by side. You will learn a LOT from the process. – Trey Blalock Mar 25 '16 at 5:38

TLS is a wrapper around the application protocol. In the case of OpenSSL, after configuring the connection, you use SSL_read and SSL_write instead of normal read/write calls; these take care of wrapping/unwrapping the application protocol in SSL/TLS for you.

  • So your answer is the point 1 right? – Mr2uang Mar 24 '16 at 19:57
  • +1 this answers the question. It's like putting something that's already inside a box inside another box, but this box has a lock on it. – user7933 Mar 25 '16 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.