SSL_CTX_SET_...ION_CALLBACK(3ossl)
π SSL_CTX_SET_...ION_CALLBACK(3ossl) π
okay so bestie, welcome to the OpenSSL manual, page SSL_CTX_SET_...ION_CALLBACK(3ossl) β¨ this one is all about Certificate Transparency policy and honestly it's giving "trust but verify" main character energy. no cap, it's lowkey important.
πΈ NAME πΈ
ssl_ct_validation_cb, SSL_enable_ct, SSL_CTX_enable_ct, SSL_disable_ct, SSL_CTX_disable_ct, SSL_set_ct_validation_callback, SSL_CTX_set_ct_validation_callback, SSL_ct_is_enabled, SSL_CTX_ct_is_enabled β these cuties control Certificate Transparency policy π
β¨ SYNOPSIS β¨
#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 π¦
so like, SSL_enable_ct() and SSL_CTX_enable_ct() turn on the processing of signed certificate timestamps β SCTs, iykyk β either for one specific SSL connection or for every connection that shares the given SSL context, respectively. the way they do it is by setting a built-in CT validation callback π
and what that callback actually does depends on the validation_mode argument, which can be either SSL_CT_VALIDATION_PERMISSIVE or SSL_CT_VALIDATION_STRICT, both explained right below bestie.
if validation_mode is SSL_CT_VALIDATION_STRICT π¨ then in a full TLS handshake with the verification mode set to SSL_VERIFY_PEER, if the peer presents 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 β except plot twist π if the verification status before the built-in callback was X509_V_OK, it will be 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 finishes, even after session resumption, because the verification status is part of the saved session state π«Ά see SSL_set_verify(3), SSL_get_verify_result(3), and SSL_session_reused(3).
if validation_mode is SSL_CT_VALIDATION_PERMISSIVE π then the handshake just continues and the verification status is not modified, no matter what the SCTs are doing. the application can still peek at the validation status of the SCTs at handshake completion. heads up though β with session resumption there won't be any SCTs presented during the handshake at all. so if your app delays SCT policy enforcement until after handshake completion, those delayed SCT checks should only run when the session is not resumed. fr fr.
SSL_set_ct_validation_callback() and SSL_CTX_set_ct_validation_callback() register a custom callback that can implement a whole different policy than either of the two above. this callback gets to examine the peer's SCTs and decide whether they're sufficient 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 you set the callback. it gets passed to the callback every single time it's invoked. ownership of this context stays with the caller, so that's your responsibility bestie π
if no callback is set, SCTs won't be requested and Certificate Transparency validation won't happen at all. simple as that β¨
no callback gets invoked when the peer presents no certificate, like when it's using an anonymous (aNULL) cipher suite. in that case the handshake continues just like it would have 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 which 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 π§
SSL_disable_ct() and SSL_CTX_disable_ct() turn CT processing off β whether it was enabled via the built-in or the custom callbacks β by setting a NULL callback. these may be implemented as macros, so don't be weird about it π
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.
π NOTES π
when SCT processing is enabled, OCSP stapling will be enabled too. this is because one possible source of SCTs is the OCSP response from a server π
the time returned by SSL_SESSION_get_time_ex() is used to evaluate whether any presented SCTs have timestamps that are in the future (and therefore invalid) β°
π§ RESTRICTIONS π§
Certificate Transparency validation cannot be enabled, and a callback cannot be set, if a custom client extension handler has been registered to handle SCT extensions (TLSEXT_TYPE_signed_certificate_timestamp). that's the rule, no exceptions πΈ
π«Ά 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.
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, we ate and left no crumbs π
this was OpenSSL version 3.5.9, dated 2026-09-29, from the SSL_CTX_SET_...ION_CALLBACK(3ossl) manual β go forth and validate those SCTs, you got this ππβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms