SSL_CTX_SET_MAX_CERT_LIST(3ossl)
π SSL_CTX_SET_MAX_CERT_LIST(3ossl) β aka "how big is ur peer's cert chain allowed to be, bestie"
okay so listen π«Ά this page lives in the 3ossl manual section, and it's about the four little functions that put a cap on how much certificate-chain the peer is allowed to throw at you. Think of it as a bouncer at the club door: chain too long, you're not coming in β¨
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
long SSL_CTX_set_max_cert_list(SSL_CTX *ctx, long size);
long SSL_CTX_get_max_cert_list(SSL_CTX *ctx);
long SSL_set_max_cert_list(SSL *ssl, long size);
long SSL_get_max_cert_list(SSL *ctx);
(yes the last param is literally named ctx even though it's an SSL * β not me, not my problem, copying it exactly π)
π DESCRIPTION π
Four functions, two setters, two getters, one whole vibe.
SSL_CTX_set_max_cert_list()β sets the max size allowed for the peer's certificate chain, for allSSLobjects created fromctx, to besizebytes. Important detail bestie: theSSLobjects inherit whatever settingctxhad at the momentSSL_new(3)got called. So it's a snapshot-at-birth situation πSSL_CTX_get_max_cert_list()β just tells you the maximum size currently set onctx. nosy but harmless πSSL_set_max_cert_list()β sets the max size allowed for the peer's certificate chain forsslto besizebytes. And this one stays valid until a new value is set β it doesn't evaporate, it commits π₯SSL_get_max_cert_list()β returns the currently set maximum size forssl. that's it. that's the whole function π«Ά
π¦ NOTES π¦
So during the handshake, the peer can send a certificate chain. And here's the thing β the TLS/SSL standard does not give any maximum size for that chain. None. Zero cap. Wild, right? π
OpenSSL handles incoming data with a dynamically allocated buffer. But bestie, you cannot just let a buffer grow forever because a faulty or malicious peer is feeling chaotic β so a maximum size for the certificate chain gets set. Protection era π
The default value for the maximum certificate chain size is 100kB (30kB on the 16-bit DOS platform, cute little retro moment πΈ). And honestly that should be plenty for normal certificate chains: OpenSSL's default maximum chain length is 10 (peep SSL_CTX_set_verify(3)), and certificates without special extensions are typically 1-2kB each. math is mathing β¨
For special applications it might be necessary to extend the maximum certificate chain size you'll allow the peer to send β see for example the work on "Internet X.509 Public Key Infrastructure Proxy Certificate Profile" and "TLS Delegation Protocol" at http://www.ietf.org/ and http://www.globus.org/ π
Under normal conditions it should never be necessary to set a value smaller than the default β the buffer is handled dynamically and only uses the memory actually required by the data the peer sent. So like, don't shrink it for funsies, ok? π
And if the maximum certificate chain size allowed is exceeded? Handshake fails, hard, with an SSL_R_EXCESSIVE_MESSAGE_SIZE error. blocked. denied. removed from the premises π
π RETURN VALUES π
SSL_CTX_set_max_cert_list()andSSL_set_max_cert_list()β return the previously set value (not the new one, don't get it twisted π)SSL_CTX_get_max_cert_list()andSSL_get_max_cert_list()β return the currently set value β
π SEE ALSO π
π COPYRIGHT π
Copyright 2001-2020 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>.
k that's the whole page, go forth and cap ur cert chains responsibly π§π
version 3.5.6 Β· dated 2026-04-07 Β· manual SSL_CTX_SET_MAX_CERT_LIST(3ossl) β mwah, see u next manpage bestie π π
π¦ 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