table of contents
NNG_TLS_CONFIG_OWN_CERT(3tls) | NNG Reference Manual | NNG_TLS_CONFIG_OWN_CERT(3tls) |
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¶
The nng_tls_config_own_cert() function configures a certificate cert identifying the local side of a TLS connection used with cfg, along with an associated private or secret key key. The certificate may be a chain, with the leaf signer first and the root at the end. The self-signed certificate at the end can be omitted. (The client should already have it, and will have to in order to validate this certificate anyway).
The key may be encrypted with a password, in which can be supplied in pass. The value NULL should be supplied for pass if the key is not encrypted.
On servers, it is possible to call this function multiple times for the same configuration. This can be useful for specifying different parameters to be used for different cryptographic algorithms.
The certificate located in cert and key must be NUL (\0) terminated C strings containing PEM <https://tools.ietf.org/html/rfc7468> formatted material.
RETURN VALUES¶
This function returns 0 on success, and non-zero otherwise.
ERRORS¶
NNG_ENOMEM
NNG_EBUSY
NNG_EINVAL
SEE ALSO¶
nng_strerror(3), nng_tls_config_alloc(3tls), nng_tls_config_cert_key_file(3tls), nng(7)
2024-10-11 |