SSL_CTX_SET_...ION_CALLBACK(3ossl)
π SSL_CTX_SET_...ION_CALLBACK (3ossl) β the OpenSSL girly pops in
Okay bestie, buckle up, because this is the 3ossl manual page for the whole Certificate Transparency validation callback situation, and honestly? It's giving "security policy but make it fashion." π
β¨ 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 β all of these together control your Certificate Transparency policy. Periodt.
πΈ 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 π¦
okay so first up: SSL_enable_ct() and SSL_CTX_enable_ct() turn on processing of signed certificate timestamps (SCTs) β that's either for one specific SSL connection, or for every connection sharing that SSL_CTX context. Respectively. π«
How do they do it? By setting a built-in CT validation callback, obviously. And the behaviour of that callback is decided by the validation_mode argument, which can be either SSL_CT_VALIDATION_PERMISSIVE or SSL_CT_VALIDATION_STRICT, as described right below. π
π₯ strict mode energy
If validation_mode is SSL_CT_VALIDATION_STRICT, then in a full TLS handshake where the verification mode is SSL_VERIFY_PEER, and the peer shows up with no valid SCTs β the handshake gets aborted. Bye. π
But if the verification mode is SSL_VERIFY_NONE, the handshake keeps going anyway, even with no valid SCTs. Lowkey wild, but here's the catch: in that case, if the verification status before the built-in callback was X509_V_OK, it gets set to X509_V_ERR_NO_VALID_SCTS after the callback. π
Good news though β apps can call SSL_get_verify_result(3) to check the status when the handshake completes, and that works even after session resumption, because the verification status is part of the saved session state. Slay. See SSL_set_verify(3), SSL_get_verify_result(3), and SSL_session_reused(3).
π permissive mode energy
If validation_mode is SSL_CT_VALIDATION_PERMISSIVE, the handshake just continues and the verification status is not modified, no matter what the SCTs say. Your app can still peek at the SCT validation status once the handshake finishes. π
Heads up bestie: with session resumption there won't be any SCTs presented during the handshake. So if your app delays SCT policy enforcement until after the handshake completes, those delayed SCT checks should only happen when the session is not resumed. No cap.
π custom callback era
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 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 you set the callback. It gets handed to the callback every single time it's invoked. Ownership of this context stays with the caller β not me, not you, the caller. π«Ά
If no callback is set, SCTs won't be requested and Certificate Transparency validation justβ¦ won't happen. π
π when no callback runs
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 exactly as it would have if no callback had been requested.
Callbacks also don't get invoked 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 not to have specified server verification via DANE-TA(2) or DANE-EE(3) TLSA records. That's the vibe check.
β¨ turning it off + checking
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. Fun fact: these may be implemented as macros. π
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. Why? Because one possible source of SCTs is the OCSP response from a server. It's giving "two birds, one iconic stone." π¦
The time returned by SSL_SESSION_get_time_ex() is what gets used to evaluate whether any presented SCTs have timestamps that are in the future (and therefore invalid). Future SCTs? Not on our watch. π₯
π RESTRICTIONS π
Certificate Transparency validation cannot be enabled β and therefore 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 line. Cross it and it's not happening. π
ββοΈ
π 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 setup to handle SCTs.
SSL_disable_ct() and SSL_CTX_disable_ct() do not return a result. They're above that. π
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>.
okay that's the whole page bestie, go forth and validate some timestamps π§π
mwah π β this was version 3.5.6, dated 2026-04-07, straight from that SSL_CTX_SET_...ION_CALLBACK(3ossl) manual page. iykyk π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms