TransportSecurity

class TransportSecurity : public std::enable_shared_from_this<TransportSecurity>

Public Functions

void setCertificate(const std::string &cert, const std::string &key, const std::string &passphrase = "")

load x509 certificate from file with (optional encrypted) key from file used to encrypt the connection

Parameters:
  • cert – path to certificate file

  • key – path to certificate private key file

  • passphrase – passphrase to decrypt the certificate private key

Throws:

std::invalid_argument – if loading the certificate, the key or decrypting the key fails

void setCACertificate(const std::string &cert)

load x509 certificate of trusted authority from file

Parameters:

cert – path to certificate file

Throws:

std::invalid_argument – if loading the certificate fails

void addAllowedRemoteCertificate(const std::string &cert)

add a trusted communication partners x509 certificate from file

Parameters:

cert – path to certificate file

Throws:

std::invalid_argument – if loading the certificate fails

void setVersion(TLSConfigVersion min = TLS_VERSION_NOT_SELECTED, TLSConfigVersion max = TLS_VERSION_NOT_SELECTED)

set the supported min and/or max TLS version

Parameters:
  • min – minimum required TLS version for communication

  • max – maximum allowed TLS version for communication