SSL_CTX_SET_...ION_CALLBACK(3ossl)
π SSL_CTX_SET_...ION_CALLBACK(3ossl) π
okay bestie, so this is an OpenSSL manpage β that's the 3ossl bit in the title β and it's all about controlling your Certificate Transparency policy. CT for short. SCTs (signed certificate timestamps) for shorter. yes it's a lot of acronyms, no you're not dumb, keep reading π«Ά
Here's the whole squad of functions this page covers:
ssl_ct_validation_cbSSL_enable_ctSSL_CTX_enable_ctSSL_disable_ctSSL_CTX_disable_ctSSL_set_ct_validation_callbackSSL_CTX_set_ct_validation_callbackSSL_ct_is_enabledSSL_CTX_ct_is_enabled
β¨ SYNOPSIS β¨
like, here's the actual code, verbatim, no cap:
#include <openssl/ssl.h>
typedef int (*ssl_ct_validation_cb)(const CT_POLICY_EVAL_CTX *ctx,
const STACK_OF(SCT) *scts, void *arg);
int SSL_enable_ct(SSL *s, int validation_mode);
int SSL_CTX_enable_ct(SSL_CTX *ctx, int validation_mode);
int SSL_set_ct_validation_callback(SSL *s, ssl_ct_validation_cb callback,
void *arg);
int SSL_CTX_set_ct_validation_callback(SSL_CTX *ctx,
ssl_ct_validation_cb callback,
void *arg);
void SSL_disable_ct(SSL *s);
void SSL_CTX_disable_ct(SSL_CTX *ctx);
int SSL_ct_is_enabled(const SSL *s);
int SSL_CTX_ct_is_enabled(const SSL_CTX *ctx);
πΈ DESCRIPTION πΈ
turning it on π
SSL_enable_ct() and SSL_CTX_enable_ct() turn on the processing of signed certificate timestamps (SCTs) β either for one specific SSL connection, or for every connection sharing that SSL_CTX context respectively. how does it do it? by setting a built-in CT validation callback, that's how. and the whole vibe of that callback is decided by the validation_mode argument, which is either SSL_CT_VALIDATION_PERMISSIVE or SSL_CT_VALIDATION_STRICT, both explained right below π
STRICT mode π€
if validation_mode is SSL_CT_VALIDATION_STRICT, then in a full TLS handshake where verification mode is set to SSL_VERIFY_PEER, and the peer shows up with no valid SCTs β the handshake gets aborted. periodt. π
but if the verification mode is SSL_VERIFY_NONE, the handshake keeps going even without valid SCTs. however β and this is the sneaky part β if the verification status was X509_V_OK before the built-in callback ran, it gets set to X509_V_ERR_NO_VALID_SCTS after the callback. π
apps can call SSL_get_verify_result(3) to check the status once the handshake is done, even after a session resumption (bc the verification status is part of the saved session state, cute). also peep SSL_set_verify(3), SSL_get_verify_result(3), and SSL_session_reused(3).
PERMISSIVE mode π¦
if validation_mode is SSL_CT_VALIDATION_PERMISSIVE, the handshake just continues and the verification status is not modified, no matter what the SCTs' validation status is. your app can still go look at the validation status of the SCTs at handshake completion if it wants.
β οΈ heads up: with session resumption there will be no SCTs presented during the handshake. so if your app delays SCT policy enforcement until after the handshake finishes, those delayed SCT checks should only run when the session is not resumed. iykyk β¨
custom callbacks, for the main characters π
SSL_set_ct_validation_callback() and SSL_CTX_set_ct_validation_callback() register a custom callback that can implement a totally different policy than either of the two above. this callback gets to examine the peer's SCTs and decide whether they're good enough to let the connection continue. the TLS handshake is aborted if the verification mode is not SSL_VERIFY_NONE and the callback returns a non-positive result.
you can pass in an arbitrary callback data argument, arg, when setting the callback. it gets passed to the callback every single time it's invoked. ownership of this context stays with you, the caller β no takebacks, no stealing π«Ά
if no callback is set, SCTs won't be requested and Certificate Transparency validation won't happen at all. simple as that.
when the callback justβ¦ doesn't fire π ββοΈ
no callback will be invoked when the peer presents no certificate β like when an anonymous (aNULL) cipher suite is in play. in that case the handshake continues exactly as if no callback had been requested. callbacks also don't fire when the peer certificate chain is invalid, or when it's validated via DANE-TA(2) or DANE-EE(3) TLSA records β those use a private X.509 PKI, or no X.509 PKI at all, respectively.
clients that require SCTs are expected to not have enabled any aNULL ciphers, and to not have specified server verification via DANE-TA(2) or DANE-EE(3) TLSA records. that's the expectation, babe. π
turning it off π
SSL_disable_ct() and SSL_CTX_disable_ct() turn off CT processing β whether it was enabled via the built-in callbacks or the custom ones β by setting a NULL callback. also, these may be implemented as macros, so don't come for them.
SSL_ct_is_enabled() and SSL_CTX_ct_is_enabled() return 1 if CT processing is enabled via either SSL_enable_ct() or a non-null custom callback, and 0 otherwise. a little vibe check that returns an int β¨
π NOTES π
when SCT processing is enabled, OCSP stapling will be enabled too. why? because one possible source of SCTs is the OCSP response from a server. love a two-for-one π
the time returned by SSL_SESSION_get_time_ex() is what gets used to evaluate whether any presented SCTs have timestamps in the future (and are therefore invalid). future SCTs? not on our watch. β
π¦ RESTRICTIONS π¦
Certificate Transparency validation cannot be enabled β and so a callback cannot be set β if a custom client extension handler has already been registered to handle SCT extensions (TLSEXT_TYPE_signed_certificate_timestamp). pick one, bestie, you can't have both π
π₯ RETURN VALUES π₯
SSL_enable_ct(), SSL_CTX_enable_ct(), SSL_CTX_set_ct_validation_callback() and SSL_set_ct_validation_callback() return 1 if the callback is successfully set. they return 0 if an error occurs β e.g. a custom client extension handler has been set up to handle SCTs. π
SSL_disable_ct() and SSL_CTX_disable_ct() do not return a result. void. nothing. silence. π€
SSL_CTX_ct_is_enabled() and SSL_ct_is_enabled() return a 1 if a non-null CT validation callback is set, or 0 if no callback (or equivalently a NULL callback) is set.
π SEE ALSO π
ssl(7), SSL_get_verify_result(3), SSL_session_reused(3), SSL_set_verify(3), SSL_CTX_set_verify(3), SSL_SESSION_get_time(3)
π COPYRIGHT π
Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π§ this was OpenSSL 3.5.0, dated 2026-09-25 β go forth and validate those timestamps responsibly π β¨π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms