#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);
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.
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
PEM formatted material.
This function returns 0 on success, and non-zero otherwise.
Insufficient memory is available.
The configuration cfg is already in use, and cannot be modified.
An invalid cert or key was supplied.