1NCONF_NEW_EX(3ossl) OpenSSL NCONF_NEW_EX(3ossl)
2
3
4
6 NCONF_new_ex, NCONF_new, NCONF_free, NCONF_default, NCONF_load,
7 NCONF_get0_libctx, NCONF_get_section, NCONF_get_section_names -
8 functionality to Load and parse configuration files manually
9
11 #include <openssl/conf.h>
12
13 typedef struct {
14 char *section;
15 char *name;
16 char *value;
17 } CONF_VALUE;
18
19 CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth);
20 CONF *NCONF_new(CONF_METHOD *meth);
21 void NCONF_free(CONF *conf);
22 CONF_METHOD *NCONF_default(void);
23 int NCONF_load(CONF *conf, const char *file, long *eline);
24 OSSL_LIB_CTX *NCONF_get0_libctx(const CONF *conf);
25
26 STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *name);
27 STACK_OF(OPENSSL_CSTRING) *NCONF_get_section_names(const CONF *conf);
28
30 NCONF_new_ex() creates a new CONF object in heap memory and assigns to
31 it a context libctx that can be used during loading. If the method
32 table meth is set to NULL then the default value of NCONF_default() is
33 used.
34
35 NCONF_new() is similar to NCONF_new_ex() but sets the libctx to NULL.
36
37 NCONF_free() frees the data associated with conf and then frees the
38 conf object.
39
40 NCONF_load() parses the file named filename and adds the values found
41 to conf. If an error occurs file and eline list the file and line that
42 the load failed on if they are not NULL.
43
44 NCONF_default() gets the default method table for processing a
45 configuration file.
46
47 NCONF_get0_libctx() gets the library context associated with the conf
48 parameter.
49
50 NCONF_get_section_names() gets the names of the sections associated
51 with the conf as STACK_OF(OPENSSL_CSTRING) strings. The individual
52 strings are associated with the conf and will be invalid after conf is
53 freed. The returned stack must be freed with sk_OPENSSL_CSTRING_free().
54
55 NCONF_get_section() gets the config values associated with the conf
56 from the config section name as STACK_OF(CONF_VALUE) structures. The
57 returned stack is associated with the conf and will be invalid after
58 conf is freed. It must not be freed by the caller.
59
61 NCONF_load() returns 1 on success or 0 on error.
62
63 NCONF_new_ex() and NCONF_new() return a newly created CONF object or
64 NULL if an error occurs.
65
67 CONF_modules_load_file(3),
68
70 NCONF_new_ex(), NCONF_get0_libctx(), and NCONF_get_section_names() were
71 added in OpenSSL 3.0.
72
74 Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
75
76 Licensed under the Apache License 2.0 (the "License"). You may not use
77 this file except in compliance with the License. You can obtain a copy
78 in the file LICENSE in the source distribution or at
79 <https://www.openssl.org/source/license.html>.
80
81
82
833.1.1 2023-08-31 NCONF_NEW_EX(3ossl)