SSL_get_ciphers.pod 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. =pod
  2. =head1 NAME
  3. SSL_get1_supported_ciphers, SSL_get_client_ciphers,
  4. SSL_get_ciphers, SSL_CTX_get_ciphers,
  5. SSL_bytes_to_cipher_list, SSL_get_cipher_list
  6. - get list of available SSL_CIPHERs
  7. =head1 SYNOPSIS
  8. #include <openssl/ssl.h>
  9. STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);
  10. STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx);
  11. STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s);
  12. STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *ssl);
  13. int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len,
  14. int isv2format, STACK_OF(SSL_CIPHER) **sk,
  15. STACK_OF(SSL_CIPHER) **scsvs);
  16. const char *SSL_get_cipher_list(const SSL *ssl, int priority);
  17. =head1 DESCRIPTION
  18. SSL_get_ciphers() returns the stack of available SSL_CIPHERs for B<ssl>,
  19. sorted by preference. If B<ssl> is NULL or no ciphers are available, NULL
  20. is returned.
  21. SSL_CTX_get_ciphers() returns the stack of available SSL_CIPHERs for B<ctx>.
  22. SSL_get1_supported_ciphers() returns the stack of enabled SSL_CIPHERs for
  23. B<ssl> as would be sent in a ClientHello (that is, sorted by preference).
  24. The list depends on settings like the cipher list, the supported protocol
  25. versions, the security level, and the enabled signature algorithms.
  26. SRP and PSK ciphers are only enabled if the appropriate callbacks or settings
  27. have been applied.
  28. The list of ciphers that would be sent in a ClientHello can differ from
  29. the list of ciphers that would be acceptable when acting as a server.
  30. For example, additional ciphers may be usable by a server if there is
  31. a gap in the list of supported protocols, and some ciphers may not be
  32. usable by a server if there is not a suitable certificate configured.
  33. If B<ssl> is NULL or no ciphers are available, NULL is returned.
  34. SSL_get_client_ciphers() returns the stack of available SSL_CIPHERs matching the
  35. list received from the client on B<ssl>. If B<ssl> is NULL, no ciphers are
  36. available, or B<ssl> is not operating in server mode, NULL is returned.
  37. SSL_bytes_to_cipher_list() treats the supplied B<len> octets in B<bytes>
  38. as a wire-protocol cipher suite specification (in the three-octet-per-cipher
  39. SSLv2 wire format if B<isv2format> is nonzero; otherwise the two-octet
  40. SSLv3/TLS wire format), and parses the cipher suites supported by the library
  41. into the returned stacks of SSL_CIPHER objects sk and Signalling Cipher-Suite
  42. Values scsvs. Unsupported cipher suites are ignored. Returns 1 on success
  43. and 0 on failure.
  44. SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER
  45. listed for B<ssl> with B<priority>. If B<ssl> is NULL, no ciphers are
  46. available, or there are less ciphers than B<priority> available, NULL
  47. is returned.
  48. =head1 NOTES
  49. The details of the ciphers obtained by SSL_get_ciphers(), SSL_CTX_get_ciphers()
  50. SSL_get1_supported_ciphers() and SSL_get_client_ciphers() can be obtained using
  51. the L<SSL_CIPHER_get_name(3)> family of functions.
  52. Call SSL_get_cipher_list() with B<priority> starting from 0 to obtain the
  53. sorted list of available ciphers, until NULL is returned.
  54. Note: SSL_get_ciphers(), SSL_CTX_get_ciphers() and SSL_get_client_ciphers()
  55. return a pointer to an internal cipher stack, which will be freed later on when
  56. the SSL or SSL_SESSION object is freed. Therefore, the calling code B<MUST NOT>
  57. free the return value itself.
  58. The stack returned by SSL_get1_supported_ciphers() should be freed using
  59. sk_SSL_CIPHER_free().
  60. The stacks returned by SSL_bytes_to_cipher_list() should be freed using
  61. sk_SSL_CIPHER_free().
  62. =head1 RETURN VALUES
  63. See DESCRIPTION
  64. =head1 SEE ALSO
  65. L<ssl(7)>, L<SSL_CTX_set_cipher_list(3)>,
  66. L<SSL_CIPHER_get_name(3)>
  67. =head1 COPYRIGHT
  68. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  69. Licensed under the OpenSSL license (the "License"). You may not use
  70. this file except in compliance with the License. You can obtain a copy
  71. in the file LICENSE in the source distribution or at
  72. L<https://www.openssl.org/source/license.html>.
  73. =cut