'\" t .\" Title: nng_tls_config_own_cert .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.23 .\" Date: 2025-02-02 .\" Manual: NNG Reference Manual .\" Source: \ \& .\" Language: English .\" .TH "NNG_TLS_CONFIG_OWN_CERT" "3tls" "2025-02-02" "\ \&" "NNG Reference Manual" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAME" nng_tls_config_own_cert \- configure own certificate and key .SH "SYNOPSIS" .sp .if n .RS 4 .nf .fam C #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); .fam .fi .if n .RE .SH "DESCRIPTION" .sp The \f(CRnng_tls_config_own_cert()\fP function configures a certificate \fIcert\fP identifying the local side of a TLS connection used with \fIcfg\fP, along with an associated private or secret key \fIkey\fP. 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). .sp The \fIkey\fP may be encrypted with a password, in which can be supplied in \fIpass\fP. The value \f(CRNULL\fP should be supplied for \fIpass\fP if the key is not encrypted. .sp 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. .sp The certificate located in \fIcert\fP and \fIkey\fP must be NUL (\f(CR\(rs0\fP) terminated C strings containing .URL "https://tools.ietf.org/html/rfc7468" "PEM" "" formatted material. .SH "RETURN VALUES" .sp This function returns 0 on success, and non\-zero otherwise. .SH "ERRORS" .sp \f(CRNNG_ENOMEM\fP .RS 4 Insufficient memory is available. .RE .sp \f(CRNNG_EBUSY\fP .RS 4 The configuration \fIcfg\fP is already in use, and cannot be modified. .RE .sp \f(CRNNG_EINVAL\fP .RS 4 An invalid \fIcert\fP or \fIkey\fP was supplied. .RE .SH "SEE ALSO" .sp nng_strerror(3), nng_tls_config_alloc(3tls), nng_tls_config_cert_key_file(3tls), nng(7)