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