1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | SSL_CTX_config, SSL_config - configure SSL_CTX or SSL structure
|
---|
6 |
|
---|
7 | =head1 SYNOPSIS
|
---|
8 |
|
---|
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 |
|
---|
14 | =head1 DESCRIPTION
|
---|
15 |
|
---|
16 | The functions SSL_CTX_config() and SSL_config() configure an B<SSL_CTX> or
|
---|
17 | B<SSL> structure using the configuration B<name>.
|
---|
18 |
|
---|
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.
|
---|
24 |
|
---|
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
|
---|
27 | file syntax.
|
---|
28 |
|
---|
29 | =head1 RETURN VALUES
|
---|
30 |
|
---|
31 | SSL_CTX_config() and SSL_config() return 1 for success or 0 if an error
|
---|
32 | occurred.
|
---|
33 |
|
---|
34 | =head1 EXAMPLES
|
---|
35 |
|
---|
36 | If the file "config.cnf" contains the following:
|
---|
37 |
|
---|
38 | testapp = test_sect
|
---|
39 |
|
---|
40 | [test_sect]
|
---|
41 | # list of configuration modules
|
---|
42 |
|
---|
43 | ssl_conf = ssl_sect
|
---|
44 |
|
---|
45 | [ssl_sect]
|
---|
46 | server = server_section
|
---|
47 |
|
---|
48 | [server_section]
|
---|
49 | RSA.Certificate = server-rsa.pem
|
---|
50 | ECDSA.Certificate = server-ecdsa.pem
|
---|
51 | Ciphers = ALL:!RC4
|
---|
52 |
|
---|
53 | An application could call:
|
---|
54 |
|
---|
55 | if (CONF_modules_load_file("config.cnf", "testapp", 0) <= 0) {
|
---|
56 | fprintf(stderr, "Error processing config file\n");
|
---|
57 | goto err;
|
---|
58 | }
|
---|
59 |
|
---|
60 | ctx = SSL_CTX_new(TLS_server_method());
|
---|
61 |
|
---|
62 | if (SSL_CTX_config(ctx, "server") == 0) {
|
---|
63 | fprintf(stderr, "Error configuring server.\n");
|
---|
64 | goto err;
|
---|
65 | }
|
---|
66 |
|
---|
67 | In this example two certificates and the cipher list are configured without
|
---|
68 | the need for any additional application code.
|
---|
69 |
|
---|
70 | =head1 SEE ALSO
|
---|
71 |
|
---|
72 | L<ssl(7)>,
|
---|
73 | L<config(5)>,
|
---|
74 | L<SSL_CONF_cmd(3)>,
|
---|
75 | L<CONF_modules_load_file(3)>
|
---|
76 |
|
---|
77 | =head1 HISTORY
|
---|
78 |
|
---|
79 | The SSL_CTX_config() and SSL_config() functions were added in OpenSSL 1.1.0.
|
---|
80 |
|
---|
81 | =head1 COPYRIGHT
|
---|
82 |
|
---|
83 | Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
|
---|
84 |
|
---|
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>.
|
---|
89 |
|
---|
90 | =cut
|
---|