SSL_CTX_use_serverinfo.pod 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_use_serverinfo_ex,
  4. SSL_CTX_use_serverinfo,
  5. SSL_CTX_use_serverinfo_file
  6. - use serverinfo extension
  7. =head1 SYNOPSIS
  8. #include <openssl/ssl.h>
  9. int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version,
  10. const unsigned char *serverinfo,
  11. size_t serverinfo_length);
  12. int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,
  13. size_t serverinfo_length);
  14. int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file);
  15. =head1 DESCRIPTION
  16. These functions load "serverinfo" TLS extensions into the SSL_CTX. A
  17. "serverinfo" extension is returned in response to an empty ClientHello
  18. Extension.
  19. SSL_CTX_use_serverinfo_ex() loads one or more serverinfo extensions from
  20. a byte array into B<ctx>. The B<version> parameter specifies the format of the
  21. byte array provided in B<*serverinfo> which is of length B<serverinfo_length>.
  22. If B<version> is B<SSL_SERVERINFOV2> then the extensions in the array must
  23. consist of a 4-byte context, a 2-byte Extension Type, a 2-byte length, and then
  24. length bytes of extension_data. The context and type values have the same
  25. meaning as for L<SSL_CTX_add_custom_ext(3)>. If serverinfo is being loaded for
  26. extensions to be added to a Certificate message, then the extension will only
  27. be added for the first certificate in the message (which is always the
  28. end-entity certificate).
  29. If B<version> is B<SSL_SERVERINFOV1> then the extensions in the array must
  30. consist of a 2-byte Extension Type, a 2-byte length, and then length bytes of
  31. extension_data. The type value has the same meaning as for
  32. L<SSL_CTX_add_custom_ext(3)>. The following default context value will be used
  33. in this case:
  34. SSL_EXT_TLS1_2_AND_BELOW_ONLY | SSL_EXT_CLIENT_HELLO
  35. | SSL_EXT_TLS1_2_SERVER_HELLO | SSL_EXT_IGNORE_ON_RESUMPTION
  36. SSL_CTX_use_serverinfo() does the same thing as SSL_CTX_use_serverinfo_ex()
  37. except that there is no B<version> parameter so a default version of
  38. SSL_SERVERINFOV1 is used instead.
  39. SSL_CTX_use_serverinfo_file() loads one or more serverinfo extensions from
  40. B<file> into B<ctx>. The extensions must be in PEM format. Each extension
  41. must be in a format as described above for SSL_CTX_use_serverinfo_ex(). Each
  42. PEM extension name must begin with the phrase "BEGIN SERVERINFOV2 FOR " for
  43. SSL_SERVERINFOV2 data or "BEGIN SERVERINFO FOR " for SSL_SERVERINFOV1 data.
  44. If more than one certificate (RSA/DSA) is installed using
  45. SSL_CTX_use_certificate(), the serverinfo extension will be loaded into the
  46. last certificate installed. If e.g. the last item was a RSA certificate, the
  47. loaded serverinfo extension data will be loaded for that certificate. To
  48. use the serverinfo extension for multiple certificates,
  49. SSL_CTX_use_serverinfo() needs to be called multiple times, once B<after>
  50. each time a certificate is loaded via a call to SSL_CTX_use_certificate().
  51. =head1 RETURN VALUES
  52. On success, the functions return 1.
  53. On failure, the functions return 0. Check out the error stack to find out
  54. the reason.
  55. =head1 SEE ALSO
  56. L<ssl(7)>
  57. =head1 COPYRIGHT
  58. Copyright 2013-2017 The OpenSSL Project Authors. All Rights Reserved.
  59. Licensed under the Apache License 2.0 (the "License"). You may not use
  60. this file except in compliance with the License. You can obtain a copy
  61. in the file LICENSE in the source distribution or at
  62. L<https://www.openssl.org/source/license.html>.
  63. =cut