SSL_CTX_SET_MAX_CERT_LIST(3ossl)
π SSL_CTX_SET_MAX_CERT_LIST β bestie, let's talk cert chain size limits
okay so this is the 3ossl manual page, aka the OpenSSL corner of the universe where you get to tell the library exactly how much certificate chain you're willing to sit through. no cap, it's more fun than it sounds. π
β¨ NAME β¨
SSL_CTX_set_max_cert_list, SSL_CTX_get_max_cert_list, SSL_set_max_cert_list, SSL_get_max_cert_list β literally just here to manipulate the allowed size for the peer's certificate chain. that's the whole vibe. π
β¨ 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 one says SSL *ctx β that's how the manpage has it, so that's how we're keeping it, character for character, i don't make the rules π«Ά)
β¨ DESCRIPTION β¨
So here's the tea. β
SSL_CTX_set_max_cert_list()β sets the maximum size allowed for the peer's certificate chain, for all SSL objects created fromctx, to be <size> bytes. and the way inheritance works? those SSL objects inherit whatever setting was valid forctxat the exact momentSSL_new(3)gets called. timing is everything, bestie. β°SSL_CTX_get_max_cert_list()β returns the maximum size that's currently set forctx. the little detective. πSSL_set_max_cert_list()β sets the maximum size allowed for the peer's certificate chain forsslto be <size> bytes. and this setting stays valid until a new value is set. it's loyal like that. πSSL_get_max_cert_list()β returns the currently set maximum size forssl. iconic, no notes. π
πΈ NOTES πΈ
okay so during the handshake process, the peer may send a certificate chain. and here's the thing β the TLS/SSL standard does not give any maximum size for the certificate chain. none. zero. it's giving "figure it out yourself." π
so what does OpenSSL do? the library handles incoming data with a dynamically allocated buffer. and to prevent that buffer from growing without bounds because of data received from a faulty or malicious peer, a maximum size for the certificate chain is set. protection era. π‘οΈ
The default value for the maximum certificate chain size is 100kB (30kB on the 16-bit DOS platform β yes, that platform, we stan a legacy icon π«‘). This should be sufficient for usual certificate chains. like, context: OpenSSL's default maximum chain length is 10 (see SSL_CTX_set_verify(3)), and certificates without special extensions have a typical size of 1-2kB. so 100kB is genuinely plenty, fr fr.
For special applications it can be necessary to extend the maximum certificate chain size allowed to be sent by the peer β see e.g. 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/. niche but valid. π
Under normal conditions it should never be necessary to set a value smaller than the default, as the buffer is handled dynamically and only uses the memory actually required by the data sent by the peer. so like, don't micro-manage it, it's already doing the work. β¨
β οΈ and if the maximum certificate chain size allowed is exceeded? the handshake will fail with an SSL_R_EXCESSIVE_MESSAGE_SIZE error. no vibes, no handshake, just error. π
β¨ RETURN VALUES β¨
SSL_CTX_set_max_cert_list()andSSL_set_max_cert_list()return the previously set value. so you get the receipts of what it used to be. π§ΎSSL_CTX_get_max_cert_list()andSSL_get_max_cert_list()return the currently set value. present tense, bestie. π
π¦ 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.
and that's the whole page, bestie π«Ά mwah π β this was OpenSSL 3.5.0, dated 2026-09-25, signing off from the SSL_CTX_SET_MAX_CERT_LIST(3ossl) page. go set some reasonable cert chain limits, ily, bye! πβ¨
π¦ 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