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