wiki:TLS

Version 10 (modified by nanang, 13 years ago) (diff)

TLS mutual authentication

Configuring PJSIP with TLS

Requirements

The TLS support in PJSIP requires OpenSSL development kit (headers and libs) to be installed. Please see Getting Started page for more info.

Update (for PJSIP 1.5 onwards):

TLS support on Symbian is implemented natively using CSecureSocket, hence it doesn't require OpenSSL development kit. Please see TLS_on_Symbian for the detailed information.

Build PJSIP with TLS Support

Add this in config_site.h:

#define PJSIP_HAS_TLS_TRANSPORT 1

And rebuild PJSIP.

Update (for PJSIP 1.5 onward):

SIP TLS transport is implemented based on the new PJLIB secure socket abstraction, and its availability is based on PJ_HAS_SSL_SOCK macro value. For autoconf build system, the value is automatically detected based on OpenSSL availability. For other platforms, please declare this in your config_site.h:

#define PJ_HAS_SSL_SOCK 1

The PJSIP_HAS_TLS_TRANSPORT default value will be set to PJ_HAS_SSL_SOCK setting.

Running pjsua as TLS Server

  1. You will need specify a TLS certificate, represented by three PEM files:
    1. The root certificate
    2. The server certificate
    3. The private key
  2. Run pjsua:
    $ ./pjsua --use-tls --tls-ca-file root.pem --tls-cert-file server-cert.pem --tls-privkey-file privkey.pem
    
    
  3. To see more TLS options, run ./pjsua --help.

Running pjsua as TLS Client

To make call to SERVER using TLS:

$ ./pjsua --use-tls <sip:SERVER;transport=tls>

To see more TLS options, run ./pjsua --help.

Enable TLS mutual authentication

Basically, it is done by two ways certificate verification, so both sides must provide TLS certificate (as described in Running pjsua as TLS Server above) and enable verification:

  • as TLS server: append pjsua option --tls-verify-client,
  • as TLS client: append pjsua option --tls-verify-server.

To see about TLS in library level, check the TLS docs in the links section below.