Move manpages to man[1357] structure.
[openssl.git] / doc / man3 / SSL_CTX_set_ct_validation_callback.pod
1 =pod
2
3 =head1 NAME
4
5 SSL_enable_ct, SSL_CTX_enable_ct, SSL_disable_ct, SSL_CTX_disable_ct,
6 SSL_set_ct_validation_callback, SSL_CTX_set_ct_validation_callback,
7 SSL_ct_is_enabled, SSL_CTX_ct_is_enabled -
8 control Certificate Transparency policy
9
10 =head1 SYNOPSIS
11
12  #include <openssl/ssl.h>
13
14  int SSL_enable_ct(SSL *s, int validation_mode);
15  int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode);
16  int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback,
17                                     void *arg);
18  int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx,
19                                         ssl_ct_validation_cb callback,
20                                         void *arg);
21  void SSL_disable_ct(SSL *s);
22  void SSL_CTX_disable_ct(SSL_CTX *ctx);
23  int SSL_ct_is_enabled(const SSL *s);
24  int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx);
25
26 =head1 DESCRIPTION
27
28 SSL_enable_ct() and SSL_CTX_enable_ct() enable the processing of signed
29 certificate timestamps (SCTs) either for a given SSL connection or for all
30 connections that share the given SSL context, respectively.
31 This is accomplished by setting a built-in CT validation callback.
32 The behaviour of the callback is determined by the B<validation_mode> argument,
33 which can be either of B<SSL_CT_VALIDATION_PERMISSIVE> or
34 B<SSL_CT_VALIDATION_STRICT> as described below.
35
36 If B<validation_mode> is equal to B<SSL_CT_VALIDATION_STRICT>, then in a full
37 TLS handshake with the verification mode set to B<SSL_VERIFY_PEER>, if the peer
38 presents no valid SCTs the handshake will be aborted.
39 If the verification mode is B<SSL_VERIFY_NONE>, the handshake will continue
40 despite lack of valid SCTs.
41 However, in that case if the verification status before the built-in callback
42 was B<X509_V_OK> it will be set to B<X509_V_ERR_NO_VALID_SCTS> after the
43 callback.
44 Applications can call L<SSL_get_verify_result(3)> to check the status at
45 handshake completion, even after session resumption since the verification
46 status is part of the saved session state.
47 See L<SSL_set_verify(3)>, <SSL_get_verify_result(3)>, L<SSL_session_reused(3)>.
48
49 If B<validation_mode> is equal to B<SSL_CT_VALIDATION_PERMISSIVE>, then the
50 handshake continues, and the verification status is not modified, regardless of
51 the validation status of any SCTs.
52 The application can still inspect the validation status of the SCTs at
53 handshake completion.
54 Note that with session resumption there will not be any SCTs presented during
55 the handshake.
56 Therefore, in applications that delay SCT policy enforcement until after
57 handshake completion, such delayed SCT checks should only be performed when the
58 session is not resumed.
59
60 SSL_set_ct_validation_callback() and SSL_CTX_set_ct_validation_callback()
61 register a custom callback that may implement a different policy than either of
62 the above.
63 This callback can examine the peer's SCTs and determine whether they are
64 sufficient to allow the connection to continue.
65 The TLS handshake is aborted if the verification mode is not B<SSL_VERIFY_NONE>
66 and the callback returns a non-positive result.
67
68 An arbitrary callback context argument, B<arg>, can be passed in when setting
69 the callback.
70 This will be passed to the callback whenever it is invoked.
71 Ownership of this context remains with the caller.
72
73 If no callback is set, SCTs will not be requested and Certificate Transparency
74 validation will not occur.
75
76 No callback will be invoked when the peer presents no certificate, e.g. by
77 employing an anonymous (aNULL) ciphersuite.
78 In that case the handshake continues as it would had no callback been
79 requested.
80 Callbacks are also not invoked when the peer certificate chain is invalid or
81 validated via DANE-TA(2) or DANE-EE(3) TLSA records which use a private X.509
82 PKI, or no X.509 PKI at all, respectively.
83 Clients that require SCTs are expected to not have enabled any aNULL ciphers
84 nor to have specified server verification via DANE-TA(2) or DANE-EE(3) TLSA
85 records.
86
87 SSL_disable_ct() and SSL_CTX_disable_ct() turn off CT processing, whether
88 enabled via the built-in or the custom callbacks, by setting a NULL callback.
89 These may be implemented as macros.
90
91 SSL_ct_is_enabled() and SSL_CTX_ct_is_enabled() return 1 if CT processing is
92 enabled via either SSL_enable_ct() or a non-null custom callback, and 0
93 otherwise.
94
95 =head1 NOTES
96
97 When SCT processing is enabled, OCSP stapling will be enabled. This is because
98 one possible source of SCTs is the OCSP response from a server.
99
100 =head1 RESTRICTIONS
101
102 Certificate Transparency validation cannot be enabled and so a callback cannot
103 be set if a custom client extension handler has been registered to handle SCT
104 extensions (B<TLSEXT_TYPE_signed_certificate_timestamp>).
105
106 =head1 RETURN VALUES
107
108 SSL_enable_ct(), SSL_CTX_enable_ct(), SSL_CTX_set_ct_validation_callback() and
109 SSL_set_ct_validation_callback() return 1 if the B<callback> is successfully
110 set.
111 They return 0 if an error occurs, e.g. a custom client extension handler has
112 been setup to handle SCTs.
113
114 SSL_disable_ct() and SSL_CTX_disable_ct() do not return a result.
115
116 SSL_CTX_ct_is_enabled() and SSL_ct_is_enabled() return a 1 if a non-null CT
117 validation callback is set, or 0 if no callback (or equivalently a NULL
118 callback) is set.
119
120 =head1 SEE ALSO
121
122 L<ssl(3)>,
123 <SSL_get_verify_result(3)>,
124 L<SSL_session_reused(3)>,
125 L<SSL_set_verify(3)>,
126 L<SSL_CTX_set_verify(3)>,
127 L<ssl_ct_validation_cb(3)>
128
129 =head1 COPYRIGHT
130
131 Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
132
133 Licensed under the OpenSSL license (the "License").  You may not use
134 this file except in compliance with the License.  You can obtain a copy
135 in the file LICENSE in the source distribution or at
136 L<https://www.openssl.org/source/license.html>.
137
138 =cut