SSL_CTX_config.pod 2.2 KB

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