paho-mqtt-cpp
MQTT C++ Client for POSIX and Windows
Loading...
Searching...
No Matches
Public Types | Public Member Functions
mqtt::ssl_options_builder Class Reference

#include <ssl_options.h>

Public Types

using self = ssl_options_builder
 

Public Member Functions

 ssl_options_builder ()
 
auto trust_store (const string &store) -> self &
 
auto key_store (const string &store) -> self &
 
auto private_key (const string &key) -> self &
 
auto private_keypassword (const string &passwd) -> self &
 
auto enabled_cipher_suites (const string &suites) -> self &
 
auto enable_server_cert_auth (bool on) -> self &
 
auto ssl_version (int ver) -> self &
 
auto verify (bool on=true) -> self &
 
auto ca_path (const string &path) -> self &
 
auto error_handler (ssl_options::error_handler cb) -> self &
 
auto psk_handler (ssl_options::psk_handler cb) -> self &
 
auto alpn_protos (const std::vector< string > &protos) -> self &
 
ssl_options finalize ()
 

Detailed Description

Class to build the SSL options for connections.

Member Typedef Documentation

◆ self

This class

Constructor & Destructor Documentation

◆ ssl_options_builder()

mqtt::ssl_options_builder::ssl_options_builder ( )
inline

Default constructor.

Member Function Documentation

◆ trust_store()

auto mqtt::ssl_options_builder::trust_store ( const string & store) -> self&
inline

Sets the file containing the public digital certificates trusted by the client.

Parameters
storeThe file in PEM format containing the public digital certificates trusted by the client.

◆ key_store()

auto mqtt::ssl_options_builder::key_store ( const string & store) -> self&
inline

Sets the file containing the public certificate chain of the client.

Parameters
storeThe file in PEM format containing the public certificate chain of the client. It may also include the client's private key.

◆ private_key()

auto mqtt::ssl_options_builder::private_key ( const string & key) -> self&
inline

Sets the file containing the client's private key.

Parameters
keyIf not included in the sslKeyStore, this is the file in PEM format containing the client's private key.

◆ private_keypassword()

auto mqtt::ssl_options_builder::private_keypassword ( const string & passwd) -> self&
inline

Sets the password to load the client's privateKey if encrypted.

Parameters
passwdThe password to load the privateKey if encrypted.

◆ enabled_cipher_suites()

auto mqtt::ssl_options_builder::enabled_cipher_suites ( const string & suites) -> self&
inline

Sets the list of cipher suites that the client will present to the server during the SSL handshake.

Parameters
suitesThe list of cipher suites that the client will present to the server during the SSL handshake. For a full explanation of the cipher list format, please see the OpenSSL on-line documentation: http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT If this setting is omitted, its default value will be "ALL", that is, all the cipher suites -excluding those offering no encryption- will be considered. This setting can be used to set an SSL anonymous connection (empty string value, for instance).

◆ enable_server_cert_auth()

auto mqtt::ssl_options_builder::enable_server_cert_auth ( bool on) -> self&
inline

Enables or disables verification of the server certificate.

Parameters
onenable/disable verification of the server certificate

◆ ssl_version()

auto mqtt::ssl_options_builder::ssl_version ( int ver) -> self&
inline

Set the SSL/TLS version to use.

Parameters
verThe desired SSL/TLS version. Specify one of:
  • MQTT_SSL_VERSION_DEFAULT (0)
  • MQTT_SSL_VERSION_TLS_1_0 (1)
  • MQTT_SSL_VERSION_TLS_1_1 (2)
  • MQTT_SSL_VERSION_TLS_1_2 (3)

◆ verify()

auto mqtt::ssl_options_builder::verify ( bool on = true) -> self&
inline

Sets whether it should carry out post-connect checks, including that a certificate matches the given host name.

Parameters
onWhether it should carry out post-connect checks.

◆ ca_path()

auto mqtt::ssl_options_builder::ca_path ( const string & path) -> self&
inline

Sets the path to a directory containing CA certificates in PEM format.

Parameters
pathPath to a directory containing CA certificates in PEM format.

◆ error_handler()

auto mqtt::ssl_options_builder::error_handler ( ssl_options::error_handler cb) -> self&
inline

Registers an error callback handler.

Parameters
cbThe callback to receive error messages.

◆ psk_handler()

auto mqtt::ssl_options_builder::psk_handler ( ssl_options::psk_handler cb) -> self&
inline

Registers a callback handler to set the TLS-PSK options. See: OpenSSL SSL_CTX_set_psk_client_callback()

Parameters
cbThe callback.

◆ alpn_protos()

auto mqtt::ssl_options_builder::alpn_protos ( const std::vector< string > & protos) -> self&
inline

Sets the list of supported ALPN protocols.

Parameters
protosThe list of ALPN protocols to be negotiated.

◆ finalize()

ssl_options mqtt::ssl_options_builder::finalize ( )
inline

Finish building the options and return them.

Returns
The option struct as built.

The documentation for this class was generated from the following file: