1SSL_CTX_CONFIG(3) OpenSSL SSL_CTX_CONFIG(3)
2
3
4
6 SSL_CTX_config, SSL_config - configure SSL_CTX or SSL structure
7
9 #include <openssl/ssl.h>
10
11 int SSL_CTX_config(SSL_CTX *ctx, const char *name);
12 int SSL_config(SSL *s, const char *name);
13
15 The functions SSL_CTX_config() and SSL_config() configure an SSL_CTX or
16 SSL structure using the configuration name.
17
19 By calling SSL_CTX_config() or SSL_config() an application can perform
20 many complex tasks based on the contents of the configuration file:
21 greatly simplifying application configuration code. A degree of future
22 proofing can also be achieved: an application can support configuration
23 features in newer versions of OpenSSL automatically.
24
25 A configuration file must have been previously loaded, for example
26 using CONF_modules_load_file(). See config(5) for details of the
27 configuration file syntax.
28
30 SSL_CTX_config() and SSL_config() return 1 for success or 0 if an error
31 occurred.
32
34 If the file "config.cnf" contains the following:
35
36 testapp = test_sect
37
38 [test_sect]
39 # list of configuration modules
40
41 ssl_conf = ssl_sect
42
43 [ssl_sect]
44 server = server_section
45
46 [server_section]
47 RSA.Certificate = server-rsa.pem
48 ECDSA.Certificate = server-ecdsa.pem
49 Ciphers = ALL:!RC4
50
51 An application could call:
52
53 if (CONF_modules_load_file("config.cnf", "testapp", 0) <= 0) {
54 fprintf(stderr, "Error processing config file\n");
55 goto err;
56 }
57
58 ctx = SSL_CTX_new(TLS_server_method());
59
60 if (SSL_CTX_config(ctx, "server") == 0) {
61 fprintf(stderr, "Error configuring server.\n");
62 goto err;
63 }
64
65 In this example two certificates and the cipher list are configured
66 without the need for any additional application code.
67
69 config(5), SSL_CONF_cmd(3), CONF_modules_load_file(3)
70
72 The SSL_CTX_config() and SSL_config() functions were added in OpenSSL
73 1.1.0.
74
76 Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved.
77
78 Licensed under the OpenSSL license (the "License"). You may not use
79 this file except in compliance with the License. You can obtain a copy
80 in the file LICENSE in the source distribution or at
81 <https://www.openssl.org/source/license.html>.
82
83
84
851.1.1i 2021-07-22 SSL_CTX_CONFIG(3)