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