5 SSL_CTX_config, SSL_config - configure SSL_CTX or SSL structure
9 #include <openssl/ssl.h>
11 int SSL_CTX_config(SSL_CTX *ctx, const char *name);
12 int SSL_config(SSL *s, const char *name);
16 The functions SSL_CTX_config() and SSL_config() configure an B<SSL_CTX> or
17 B<SSL> structure using the configuration B<name>.
19 By calling SSL_CTX_config() or SSL_config() an application can perform many
20 complex tasks based on the contents of the configuration file: greatly
21 simplifying application configuration code. A degree of future proofing
22 can also be achieved: an application can support configuration features
23 in newer versions of OpenSSL automatically.
25 A configuration file must have been previously loaded, for example using
26 CONF_modules_load_file(). See L<config(5)> for details of the configuration
31 SSL_CTX_config() and SSL_config() return 1 for success or 0 if an error
36 If the file "config.cnf" contains the following:
41 # list of configuration modules
46 server = server_section
49 RSA.Certificate = server-rsa.pem
50 ECDSA.Certificate = server-ecdsa.pem
53 An application could call:
55 if (CONF_modules_load_file("config.cnf", "testapp", 0) <= 0) {
56 fprintf(stderr, "Error processing config file\n");
60 ctx = SSL_CTX_new(TLS_server_method());
62 if (SSL_CTX_config(ctx, "server") == 0) {
63 fprintf(stderr, "Error configuring server.\n");
67 In this example two certificates and the cipher list are configured without
68 the need for any additional application code.
75 L<CONF_modules_load_file(3)>
79 The SSL_CTX_config() and SSL_config() functions were added in OpenSSL 1.1.0.
83 Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
85 Licensed under the Apache License 2.0 (the "License"). You may not use
86 this file except in compliance with the License. You can obtain a copy
87 in the file LICENSE in the source distribution or at
88 L<https://www.openssl.org/source/license.html>.