nanomsg next generation NNG  
Home GitHub Documentation

This documentation is for version v1.0.0 of nng, but the latest released version is v1.7.3. see the documentation for v1.7.3 for the most up-to-date information.
nng_tls_config_own_cert(3)

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 formatted material.

RETURN VALUES

This function returns 0 on success, and non-zero otherwise.

ERRORS

NNG_ENOMEM

Insufficient memory is available.

NNG_EBUSY

The configuration cfg is already in use, and cannot be modified.

NNG_EINVAL

An invalid cert or key was supplied.

NNG Reference Manual vv1.0.0 © 2019 Staysail Systems, Inc, © 2018 Capitar IT Group BV
This document is supplied under the MIT License.
nanomsg™ and nng™ are trademarks of Garrett D'Amore.