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