NNG_TLS_OPTIONS(5)
π NNG_TLS_OPTIONS(5) β the NNG Reference Manual, but make it TLS π
okay so bestie, this is page NNG_TLS_OPTIONS(5) from the NNG Reference Manual, and it's all about the TLS-specific options. buckle up, it's giving secure-transport realness π₯
β¨ NAME β¨
nng_tls_options β TLS-specific options π¦
β¨ SYNOPSIS β¨
#include <nng/nng.h>
#define NNG_OPT_TLS_AUTH_MODE "tls-authmode"
#define NNG_OPT_TLS_CA_FILE "tls-ca-file"
#define NNG_OPT_TLS_CERT_KEY_FILE "tls-cert-key-file"
#define NNG_OPT_TLS_CONFIG "tls-config"
#define NNG_OPT_TLS_SERVER_NAME "tls-server-name"
#define NNG_OPT_TLS_VERIFIED "tls-verified"
#define NNG_OPT_TLS_PEER_CN "tls-peer-cn"
#define NNG_OPT_TLS_PEER_ALT_NAMES "tls-peer-alt-names"
like, all of those are real and you copy them exactly fr fr π
β¨ DESCRIPTION β¨
so this page is the master doc for all the standard options you can set or get on objects that are using TLS. no cap.
small but important: always use the option names by their symbolic definitions, not the raw strings. iykyk. the #defines are the whole point.
in the list below, each option comes with its name and the data type of the underlying value, because the type is not optional information β you need it to call the getter/setter right π€
some of these options are only meaningful or supported in certain contexts, or have other access restrictions. the original tries its best to note those restrictions inside each option's description, so read the whole thing, don't skim π«Ά
πΈ TLS Options πΈ
Note π Options for configuring TLS are deprecated and may not be present in a future release. These options areNNG_OPT_TLS_AUTH_MODE,NNG_OPT_TLS_CA_FILE,NNG_OPT_TLS_CERT_KEY_FILE, andNNG_OPT_TLS_SERVER_NAME. Applications should switch to using theNNG_OPT_TLS_CONFIGoption and working withnng_tls_configobjects. like, they're on their way out, bestie. don't build your whole personality on them π
NNG_OPT_TLS_AUTH_MODEβ(int). Write-only option used to configure the authentication mode used. Seenng_tls_config_auth_mode()for more details. πNNG_OPT_TLS_CA_FILEβ(string). Write-only option naming a file containing certificates to use for peer validation. Seenng_tls_config_ca_file()for more information. πNNG_OPT_TLS_CERT_KEY_FILEβ(string). Write-only option naming a file containing the local certificate and associated private key. The private key used must be unencrypted. Seenng_tls_config_own_cert()for more information. π
ok the unencrypted-key thing is not a vibe you can negotiate around β that's just the requirement, periodt.
NNG_OPT_TLS_CONFIGβ(nng_tls_config *). This option references the underlying TLS configuration object. A hold is placed on the underlying configuration object before returning it. π
Note π The caller should release the hold with nng_tls_config_free() when it no longer needs the TLS configuration object. not me forgetting to free it and leaking the whole holdβ¦ don't be that girl π
NNG_OPT_TLS_SERVER_NAMEβ(string). This write-only option is used to specify the name of the server. When used with a dialer, this potentially configures SNI (server name indication, which is used as a hint by a multihosting server to choose the appropriate certificate to provide) and also is used to validate the name presented in the server's x509 certificate. πNNG_OPT_TLS_VERIFIEDβ(bool). This read-only option indicates whether the remote peer has been properly verified using TLS authentication. May return incorrect results if peer authentication is disabled. βNNG_OPT_TLS_PEER_CNβ(string). This read-only option returns the common name of the peer certificate. May return incorrect results if peer authentication is disabled. πͺͺNNG_OPT_TLS_PEER_ALT_NAMESβ(string). This read-only option returns string list with the subject alternative names of the peer certificate. May return incorrect results if peer authentication is disabled. π
lowkey important: those last three all carry the same caveat βNNG_OPT_TLS_VERIFIED,NNG_OPT_TLS_PEER_CN, andNNG_OPT_TLS_PEER_ALT_NAMESmay all return incorrect results if peer authentication is disabled. it's giving "trust me bro" energy and you should not trust it π
π§ Inherited Options π§
generally, these option values are also available for TLS objects, when appropriate for the context:
NNG_OPT_LOCADDRNNG_OPT_REMADDRNNG_OPT_TCP_KEEPALIVENNG_OPT_TCP_NODELAY
like they're not TLS-exclusive, they just show up to the party when the context allows π
β¨ SEE ALSO β¨
nng_options(5) nng_tcp_options(5) nng_tls_config(5), nng(7)
go read those too, they're all part of the same friend group π«Ά
and that's the whole page, bestie!! slayed π
β¨ this was the NNG_TLS_OPTIONS(5) page from the NNG Reference Manual, dated 2026-06-30 πΈ go forth and configure your TLS responsibly, and remember: symbolic names, unencrypted keys only where it says so, and always free your holds ππ
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms