SSL_CTX_config.pod 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. =head1 NOTES
  12. By calling SSL_CTX_config() or SSL_config() an application can perform many
  13. complex tasks based on the contents of the configuration file: greatly
  14. simplifying application configuration code. A degree of future proofing
  15. can also be achieved: an application can support configuration features
  16. in newer versions of OpenSSL automatically.
  17. A configuration file must have been previously loaded, for example using
  18. CONF_modules_load_file(). See L<config(5)> for details of the configuration
  19. file syntax.
  20. =head1 RETURN VALUES
  21. SSL_CTX_config() and SSL_config() return 1 for success or 0 if an error
  22. occurred.
  23. =head1 EXAMPLE
  24. If the file "config.cnf" contains the following:
  25. testapp = test_sect
  26. [test_sect]
  27. # list of configuration modules
  28. ssl_conf = ssl_sect
  29. [ssl_sect]
  30. server = server_section
  31. [server_section]
  32. RSA.Certificate = server-rsa.pem
  33. ECDSA.Certificate = server-ecdsa.pem
  34. Ciphers = ALL:!RC4
  35. An application could call:
  36. if (CONF_modules_load_file("config.cnf", "testapp", 0) <= 0) {
  37. fprintf(stderr, "Error processing config file\n");
  38. goto err;
  39. }
  40. ctx = SSL_CTX_new(TLS_server_method());
  41. if (SSL_CTX_config(ctx, "server") == 0) {
  42. fprintf(stderr, "Error configuring server.\n");
  43. goto err;
  44. }
  45. In this example two certificates and the cipher list are configured without
  46. the need for any additional application code.
  47. =head1 SEE ALSO
  48. L<config(5)>,
  49. L<SSL_CONF_cmd(3)>,
  50. L<CONF_modules_load_file(3)>
  51. =head1 HISTORY
  52. SSL_CTX_config() and SSL_config() were first added to OpenSSL 1.1.0
  53. =head1 COPYRIGHT
  54. Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
  55. Licensed under the OpenSSL license (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