MQTTClient_SSLOptions(3)
π MQTTClient_SSLOptions(3) π
okay bestie, gather round, because this one is from the Library Functions Manual and it's literally the blueprint for making your MQTT client talk TLS without getting clowned on. this is the MQTTClient_SSLOptions page, and yes it is as iconic as it sounds. π
β¨ NAME β¨
MQTTClient_SSLOptions β the struct that holds all your SSL/TLS settings, no cap
β¨ SYNOPSIS β¨
#include <MQTTClient.h>
πΈ Data Fields πΈ
char struct_id [4]int struct_versionconst char * trustStoreconst char * keyStoreconst char * privateKeyconst char * privateKeyPasswordconst char * enabledCipherSuitesint enableServerCertAuthint sslVersionint verifyconst char * CApathint(* ssl_error_cb )(const char *str, size_t len, void *u)void * ssl_error_contextunsigned int(* ssl_psk_cb )(const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len, void *u)void * ssl_psk_contextint disableDefaultTrustStoreconst unsigned char * protosunsigned int protos_len
π Detailed Description π
so MQTTClient_sslProperties is the whole vibe-check list of settings you need to establish an SSL/TLS connection using the OpenSSL library. it covers these three scenarios, and they are not the same energy:
- Server authentication π β your client needs the digital certificate of the server. it lives in a store containing trusted material (also known as a "trust store", cute name honestly).
- Mutual authentication π€ β both client and server get authenticated during the SSL handshake. so on top of the server's digital certificate sitting in a trust store, the client also needs its own digital certificate, plus the private key used to sign its digital certificate, all stored in a "key store".
- Anonymous connection π β neither client nor server gets authenticated, and no credentials are needed to establish an SSL connection. note that this scenario is not fully secure, because it is subject to man-in-the-middle attacks. like, it's giving exposed. be careful.
π¦ Field Documentation π¦
π char struct_id[4]
the eyecatcher for this structure. it must be MQTS. that's it, that's the whole job, it's the little name tag so the struct knows who it is.
π int struct_version
the version number of this structure. it must be 0, 1, 2, 3, 4 or 5. and here's the breakdown of what each one is missing:
0means nosslVersion1means noverify,CApath2means nossl_error_context,ssl_error_cb3means nossl_psk_cb,ssl_psk_context,disableDefaultTrustStore4means noprotos,protos_len
π const char* trustStore
the file in PEM format containing the public digital certificates trusted by the client. this is your trust store, your ride-or-die list of who's allowed in. π«Ά
π const char* keyStore
the file in PEM format containing the public certificate chain of the client. it may also include the client's private key, which is lowkey convenient but do keep track of it.
π const char* privateKey
if it's not included in the sslKeyStore, this setting points to the file in PEM format containing the client's private key. it's giving "you left it at home so here's the address". π
π const char* privateKeyPassword
the password to load the client's privateKey if it's encrypted. yes bestie, secrets get locked up sometimes.
π const char* enabledCipherSuites
the 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 (the "aNULL" string value, for instance).
π int enableServerCertAuth
True/False option to enable verification of the server certificate. like a bouncer checking IDs at the door. π
π int sslVersion
the SSL/TLS version to use. 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)
only used if struct_version is >= 1. β
π int verify
whether to carry out post-connect checks, including that a certificate matches the given host name. exists only if struct_version >= 2.
π const char* CApath
from the OpenSSL documentation: if CApath is not NULL, it points to a directory containing CA certificates in PEM format. exists only if struct_version >= 2.
π int(* ssl_error_cb) (const char *str, size_t len, void *u)
callback function for the OpenSSL error handler ERR_print_errors_cb. exists only if struct_version >= 3. β¨
π void* ssl_error_context
application-specific context for the OpenSSL error handler ERR_print_errors_cb. exists only if struct_version >= 3.
π unsigned int(* ssl_psk_cb) (const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len, void *u)
callback function for setting TLS-PSK options. the parameters correspond to that of SSL_CTX_set_psk_client_callback, except for u, which is the pointer ssl_psk_context. exists only if struct_version >= 4. π«
π void* ssl_psk_context
application-specific context for ssl_psk_cb. exists only if struct_version >= 4.
π int disableDefaultTrustStore
don't load the default SSL CA. should be used together with PSK to make sure regular servers with a certificate in place are not accepted. exists only if struct_version >= 4. π«
π const unsigned char* protos
the protocol-lists must be in wire-format, which is defined as a vector of non-empty, 8-bit length-prefixed, byte strings. the length-prefix byte is not included in the length. each string is limited to 255 bytes. a byte-string length of 0 is invalid. a truncated byte-string is invalid. check the documentation for SSL_CTX_set_alpn_protos. exists only if struct_version >= 5. π (yes, all of that. read it twice.)
π unsigned int protos_len
the length of the vector protos vector. exists only if struct_version >= 5.
π Author π
generated automatically by Doxygen for Paho MQTT C Client Library from the source code. shoutout to the robot that wrote this, it ate and left no crumbs. π€π
and that's the whole page bestie!! go forth and TLS responsibly π§πΈ
okay bye, this was Paho MQTT C Client Library, dated Tue Jun 2 2026 00:00:00, and it remains MQTTClient_SSLOptions(3) forever and ever, periodt. πβ¨π
π¦ where this page comes from
- fedora 44: paho-c-devel 1.3.16-1.fc44 Β· BSD-3-Clause AND EPL-2.0
- fedora 44: paho-c-devel 1.3.16-1.fc44 Β· BSD-3-Clause AND EPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms