typedef gchar*(* VortexTlsCertificateFileLocator)(VortexConnection *connection, gchar *serverName)

Handler definition for those function allowing to locate the certificate file to be used while enabling TLS support.

Once an TLS negotiation is started two files are required to enable TLS ciphering: 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. Once finished, the 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

  • Doing previous practices 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.

connection The connection where the TLS negotiation was received.
serverName An optional value requesting to as the server serverName. This value is supposed to be used to select the right certificate file.
This handler is used by:

A newly allocated value containing the path to the certificate file.