| 92 | Creating A Secure Transport (TLS) |
| 93 | -------------------------------------------------- |
| 94 | To create a TLS transport, you can use the same method as above. You can further customize the TLS transport, such as setting the certificate file, or selecting the ciphers used, by modifying the field TransportConfig.tlsConfig. |
| 95 | |
| 96 | .. code-block:: c++ |
| 97 | |
| 98 | try { |
| 99 | TransportConfig tcfg; |
| 100 | tcfg.port = 5061; |
| 101 | // Optional, set CA/certificate/private key files. |
| 102 | // tcfg.tlsConfig.CaListFile = "ca.crt"; |
| 103 | // tcfg.tlsConfig.certFile = "cert.crt"; |
| 104 | // tcfg.tlsConfig.privKeyFile = "priv.key"; |
| 105 | // Optional, set ciphers. You can select a certain cipher/rearrange the order of ciphers here. |
| 106 | // tcfg.ciphers = ep->utilSslGetAvailableCiphers(); |
| 107 | TransportId tid = ep->transportCreate(PJSIP_TRANSPORT_TLS, tcfg); |
| 108 | } catch(Error& err) { |
| 109 | cout << "Transport creation error: " << err.info() << endl; |
| 110 | } |
| 111 | |
| 112 | |