1= nng_tls_config_ca_file(3tls) 2// 3// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> 4// Copyright 2018 Capitar IT Group BV <info@capitar.com> 5// 6// This document is supplied under the terms of the MIT License, a 7// copy of which should be located in the distribution where this 8// file was obtained (LICENSE.txt). A copy of the license may also be 9// found online at https://opensource.org/licenses/MIT. 10// 11 12== NAME 13 14nng_tls_config_ca_file - load certificate authority from file 15 16== SYNOPSIS 17 18[source, c] 19---- 20#include <nng/nng.h> 21#include <nng/supplemental/tls/tls.h> 22 23int nng_tls_config_ca_file(nng_tls_config *cfg, const char *path); 24---- 25 26== DESCRIPTION 27 28The `nng_tls_config_ca_file()` function configures the ((certificate authority)) 29certificate chain and optional revocation list by loading the certificates 30(and revocation list if present) from a single named file. 31The file must at least one X.509 certificate in 32https://tools.ietf.org/html/rfc7468[PEM] 33format, and may contain multiple such certificates, as well as zero or 34more PEM CRL objects. 35This information is used to validate certificates 36that are presented by peers, when using the configuration _cfg_. 37 38NOTE: Certificates *must* be configured when using the authentication mode 39`NNG_TLS_AUTH_MODE_REQUIRED`. 40 41TIP: This function may be called multiple times, to add additional chains 42to a configuration, without affecting those added previously. 43 44== RETURN VALUES 45 46This function returns 0 on success, and non-zero otherwise. 47 48== ERRORS 49 50[horizontal] 51`NNG_ENOMEM`:: Insufficient memory is available. 52`NNG_EBUSY`:: The configuration _cfg_ is already in use, and cannot be modified. 53`NNG_EINVAL`:: The contents of _path_ are invalid or do not contain a valid PEM certificate. 54`NNG_ENOENT`:: The file _path_ does not exist. 55`NNG_EPERM`:: The file _path_ is not readable. 56 57== SEE ALSO 58 59[.text-left] 60xref:nng_strerror.3.adoc[nng_strerror(3)], 61xref:nng_tls_config_alloc.3tls.adoc[nng_tls_config_alloc(3tls)], 62xref:nng_tls_config_auth_mode.3tls.adoc[nng_tls_config_auth_mode(3tls)], 63xref:nng_tls_config_ca_chain.3tls.adoc[nng_tls_config_ca_chain(3tls)], 64xref:nng.7.adoc[nng(7)] 65