typedef char*(* VortexTlsCertificateFileLocator)(VortexConnection *connection, const char *serverName)

Handler definition for those functions that allows to locate the certificate file to be used while enabling TLS support.

Once a TLS negotiation is started at least two files are required to enable TLS cyphering: the certificate and the private key. Two handlers are used by the Vortex Library to allow user app level to configure file locations for both files.

This handler is used to configure location for the certificate file. The function will receive the connection where the TLS is being request to be activated and the serverName value which hold a optional host name value requesting to act as the server configured by this value.

The function must return a path to the certificate using a dynamically allocated value or the certificate content itself. Once finished, Vortex Library will unref it.

The function should return a basename file avoiding full path file names. This is because the Vortex Library will use vortex_support_find_data_file function to locate the file provided. That function is configured to lookup on the configured search path provided by vortex_support_add_search_path or vortex_support_add_search_path_ref.

As a consequence:

  • If all certificate files are located at /etc/repository/certificates and the serverName.cert is to be used DO NOT return on this function /etc/repository/certificates/serverName.cert
  • Instead, configure /etc/repository/certificates at vortex_support_add_search_path and return servername.cert.
  • Doing previous practice will allow your code to be as platform/directory-structure independent as possible. The same function works on every installation, the only question to be configured are the search paths to lookup.
Parameters
connectionThe connection where the TLS negotiation was received.
serverNameAn optional value requesting to act as the server serverName. This value is supposed to be used to select the right certificate file (according to the common value stored on it).

This handler is used by:

Returns
A newly allocated value containing the path to the certificate file or the certificate content to be used.