NNG_TLS_CONFIG_OWN_CERT(3tls)
π nng_tls_config_own_cert π
okay bestie, this is a page from the NNG Reference Manual, and it's about giving your TLS setup its very own β¨identityβ¨ β like, a certificate that says this is me and a secret key that proves it. let's get into it π«Ά
πΈ NAME πΈ
nng_tls_config_own_cert β configure own certificate and key π
β¨ SYNOPSIS β¨
#include <nng/nng.h>
#include <nng/supplemental/tls/tls.h>
int nng_tls_config_own_cert(nng_tls_config *cfg, const char *cert,
const char *key, const char *pass);
π¦ DESCRIPTION π¦
so like, the nng_tls_config_own_cert() function is the one that sets up a certificate cert that identifies the local side of a TLS connection being used with cfg. and obviously it needs the matching private or secret key key, because a cert with no key is giving nothing, honestly.
the certificate can be a chain β leaf signer first, root at the very end, in that order, no cap. and here's the cute part: the self-signed certificate at the end can be omitted π« (the client should already have it, and literally will have to have it in order to validate this certificate anyway).
the key can be encrypted with a password, and if it is, you drop that password in pass. if the key is not encrypted, supply NULL for pass. that's it, that's the whole vibe check.
on servers, you can call this function multiple times for the same configuration β which is lowkey so useful for specifying different parameters to be used for different cryptographic algorithms. slay π
now, important: the certificate in cert and the key in key must be NUL (\0) terminated C strings containing PEM-formatted material (per [RFC 7468](https://tools.ietf.org/html/rfc7468)). no half-finished strings, bestie, we need the terminator.
β οΈ rude reminder: those strings gotta be NUL (\0) terminated and PEM formatted. if they're not, this is not going to go how you want it to go. π
π RETURN VALUES π
this function returns 0 when everything is iconic and working, and non-zero otherwise. that's the rule. periodt.
π ERRORS π
NNG_ENOMEMβ insufficient memory is available. the machine said "no thoughts, head empty" πNNG_EBUSYβ the configurationcfgis already in use, and cannot be modified. it's busy, it's booked, it's not taking changes rn πNNG_EINVALβ an invalidcertorkeywas supplied. something in there was not giving what it needed to give π
π₯ SEE ALSO π₯
and that's the whole page, bestie π this was NNG_TLS_CONFIG_OWN_CERT(3tls), from the NNG Reference Manual, dated 2026-06-30. go forth and certify yourself, you main character πβ¨π§
π¦ 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