]>
Commit | Line | Data |
---|---|---|
913592d2 DSH |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
bb9ad09e | 5 | SSL_CTX_config, SSL_config - configure SSL_CTX or SSL structure |
913592d2 DSH |
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 | =head1 NOTES | |
20 | ||
21 | By calling SSL_CTX_config() or SSL_config() an application can perform many | |
22 | complex tasks based on the contents of the configuration file: greatly | |
23 | simplifying application configuration code. A degree of future proofing | |
24 | can also be achieved: an application can support configuration features | |
25 | in newer versions of OpenSSL automatically. | |
26 | ||
27 | A configuration file must have been previously loaded, for example using | |
b97fdb57 | 28 | CONF_modules_load_file(). See L<config(5)> for details of the configuration |
913592d2 DSH |
29 | file syntax. |
30 | ||
31 | =head1 RETURN VALUES | |
32 | ||
33 | SSL_CTX_config() and SSL_config() return 1 for success or 0 if an error | |
34 | occurred. | |
35 | ||
36 | =head1 EXAMPLE | |
37 | ||
38 | If the file "config.cnf" contains the following: | |
39 | ||
40 | testapp = test_sect | |
41 | ||
42 | [test_sect] | |
27b138e9 JS |
43 | # list of configuration modules |
44 | ||
913592d2 DSH |
45 | ssl_conf = ssl_sect |
46 | ||
47 | [ssl_sect] | |
913592d2 DSH |
48 | server = server_section |
49 | ||
50 | [server_section] | |
913592d2 DSH |
51 | RSA.Certificate = server-rsa.pem |
52 | ECDSA.Certificate = server-ecdsa.pem | |
53 | Ciphers = ALL:!RC4 | |
54 | ||
55 | An application could call: | |
56 | ||
57 | if (CONF_modules_load_file("config.cnf", "testapp", 0) <= 0) { | |
2947af32 BB |
58 | fprintf(stderr, "Error processing config file\n"); |
59 | goto err; | |
913592d2 DSH |
60 | } |
61 | ||
62 | ctx = SSL_CTX_new(TLS_server_method()); | |
63 | ||
64 | if (SSL_CTX_config(ctx, "server") == 0) { | |
65 | fprintf(stderr, "Error configuring server.\n"); | |
66 | goto err; | |
67 | } | |
68 | ||
69 | In this example two certificates and the cipher list are configured without | |
70 | the need for any additional application code. | |
71 | ||
72 | =head1 SEE ALSO | |
73 | ||
b97fdb57 | 74 | L<config(5)>, |
913592d2 DSH |
75 | L<SSL_CONF_cmd(3)>, |
76 | L<CONF_modules_load_file(3)> | |
77 | ||
78 | =head1 HISTORY | |
79 | ||
fc5ecadd | 80 | The SSL_CTX_config() and SSL_config() functions were added in OpenSSL 1.1.0. |
913592d2 | 81 | |
e2f92610 RS |
82 | =head1 COPYRIGHT |
83 | ||
84 | Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. | |
85 | ||
4746f25a | 86 | Licensed under the Apache License 2.0 (the "License"). You may not use |
e2f92610 RS |
87 | this file except in compliance with the License. You can obtain a copy |
88 | in the file LICENSE in the source distribution or at | |
89 | L<https://www.openssl.org/source/license.html>. | |
90 | ||
91 | =cut |