SSL_CTX_set_cipher_list.pod 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set_cipher_list,
  4. SSL_set_cipher_list,
  5. SSL_CTX_set_ciphersuites,
  6. SSL_set_ciphersuites
  7. - choose list of available SSL_CIPHERs
  8. =head1 SYNOPSIS
  9. #include <openssl/ssl.h>
  10. int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
  11. int SSL_set_cipher_list(SSL *ssl, const char *str);
  12. int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str);
  13. int SSL_set_ciphersuites(SSL *s, const char *str);
  14. =head1 DESCRIPTION
  15. SSL_CTX_set_cipher_list() sets the list of available ciphers (TLSv1.2 and below)
  16. for B<ctx> using the control string B<str>. The format of the string is described
  17. in L<ciphers(1)>. The list of ciphers is inherited by all
  18. B<ssl> objects created from B<ctx>. This function does not impact TLSv1.3
  19. ciphersuites. Use SSL_CTX_set_ciphersuites() to configure those.
  20. SSL_set_cipher_list() sets the list of ciphers (TLSv1.2 and below) only for
  21. B<ssl>.
  22. SSL_CTX_set_ciphersuites() is used to configure the available TLSv1.3
  23. ciphersuites for B<ctx>. This is a simple colon (":") separated list of TLSv1.3
  24. ciphersuite names in order of perference. Valid TLSv1.3 ciphersuite names are:
  25. =over 4
  26. =item TLS_AES_128_GCM_SHA256
  27. =item TLS_AES_256_GCM_SHA384
  28. =item TLS_CHACHA20_POLY1305_SHA256
  29. =item TLS_AES_128_CCM_SHA256
  30. =item TLS_AES_128_CCM_8_SHA256
  31. =back
  32. An empty list is permissible. The default value for the this setting is:
  33. "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256"
  34. SSL_set_ciphersuites() is the same as SSL_CTX_set_ciphersuites() except it
  35. configures the ciphersuites for B<ssl>.
  36. =head1 NOTES
  37. The control string B<str> for SSL_CTX_set_cipher_list() and
  38. SSL_set_cipher_list() should be universally usable and not depend
  39. on details of the library configuration (ciphers compiled in). Thus no
  40. syntax checking takes place. Items that are not recognized, because the
  41. corresponding ciphers are not compiled in or because they are mistyped,
  42. are simply ignored. Failure is only flagged if no ciphers could be collected
  43. at all.
  44. It should be noted, that inclusion of a cipher to be used into the list is
  45. a necessary condition. On the client side, the inclusion into the list is
  46. also sufficient unless the security level excludes it. On the server side,
  47. additional restrictions apply. All ciphers have additional requirements.
  48. ADH ciphers don't need a certificate, but DH-parameters must have been set.
  49. All other ciphers need a corresponding certificate and key.
  50. A RSA cipher can only be chosen, when a RSA certificate is available.
  51. RSA ciphers using DHE need a certificate and key and additional DH-parameters
  52. (see L<SSL_CTX_set_tmp_dh_callback(3)>).
  53. A DSA cipher can only be chosen, when a DSA certificate is available.
  54. DSA ciphers always use DH key exchange and therefore need DH-parameters
  55. (see L<SSL_CTX_set_tmp_dh_callback(3)>).
  56. When these conditions are not met for any cipher in the list (e.g. a
  57. client only supports export RSA ciphers with an asymmetric key length
  58. of 512 bits and the server is not configured to use temporary RSA
  59. keys), the "no shared cipher" (SSL_R_NO_SHARED_CIPHER) error is generated
  60. and the handshake will fail.
  61. =head1 RETURN VALUES
  62. SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher
  63. could be selected and 0 on complete failure.
  64. SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() return 1 if the requested
  65. ciphersuite list was configured, and 0 otherwise.
  66. =head1 SEE ALSO
  67. L<ssl(7)>, L<SSL_get_ciphers(3)>,
  68. L<SSL_CTX_use_certificate(3)>,
  69. L<SSL_CTX_set_tmp_dh_callback(3)>,
  70. L<ciphers(1)>
  71. =head1 COPYRIGHT
  72. Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
  73. Licensed under the Apache License 2.0 (the "License"). You may not use
  74. this file except in compliance with the License. You can obtain a copy
  75. in the file LICENSE in the source distribution or at
  76. L<https://www.openssl.org/source/license.html>.
  77. =cut