1=pod 2 3=head1 NAME 4 5ssl_ct_validation_cb, 6SSL_enable_ct, SSL_CTX_enable_ct, SSL_disable_ct, SSL_CTX_disable_ct, 7SSL_set_ct_validation_callback, SSL_CTX_set_ct_validation_callback, 8SSL_ct_is_enabled, SSL_CTX_ct_is_enabled - 9control Certificate Transparency policy 10 11=head1 SYNOPSIS 12 13 #include <openssl/ssl.h> 14 15 typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx, 16 const STACK_OF(SCT) *scts, void *arg); 17 18 int SSL_enable_ct(SSL *s, int validation_mode); 19 int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode); 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); 25 void SSL_disable_ct(SSL *s); 26 void SSL_CTX_disable_ct(SSL_CTX *ctx); 27 int SSL_ct_is_enabled(const SSL *s); 28 int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx); 29 30=head1 DESCRIPTION 31 32SSL_enable_ct() and SSL_CTX_enable_ct() enable the processing of signed 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 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 53If B<validation_mode> is equal to B<SSL_CT_VALIDATION_PERMISSIVE>, then the 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. 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 61handshake completion, such delayed SCT checks should only be performed when the 62session is not resumed. 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 72An arbitrary callback data argument, B<arg>, can be passed in when setting 73the callback. 74This will be passed to the callback whenever it is invoked. 75Ownership of this context remains with the caller. 76 77If no callback is set, SCTs will not be requested and Certificate Transparency 78validation will not occur. 79 80No callback will be invoked when the peer presents no certificate, e.g. by 81employing an anonymous (aNULL) cipher suite. 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 91SSL_disable_ct() and SSL_CTX_disable_ct() turn off CT processing, whether 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 96enabled via either SSL_enable_ct() or a non-null custom callback, and 0 97otherwise. 98 99=head1 NOTES 100 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. 103 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 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 115SSL_enable_ct(), SSL_CTX_enable_ct(), SSL_CTX_set_ct_validation_callback() and 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 121SSL_disable_ct() and SSL_CTX_disable_ct() do not return a result. 122 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. 126 127=head1 SEE ALSO 128 129L<ssl(7)>, 130<SSL_get_verify_result(3)>, 131L<SSL_session_reused(3)>, 132L<SSL_set_verify(3)>, 133L<SSL_CTX_set_verify(3)>, 134L<SSL_SESSION_get_time(3)> 135 136=head1 COPYRIGHT 137 138Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. 139 140Licensed under the Apache License 2.0 (the "License"). You may not use 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 146