LIBRESSL-SSL_CTX_SET_CLIENT_CA_LIST(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… SSL_CTX_SET_CLIENT_CA_LIST(3) β€” the set-client-CA-list bestie era ✨

okay so this is one of those libssl / libcrypto man pages (manual name: SSL_CTX_SET_CLIENT_CA_LI(3), yes the title got cut off, we don't talk about it πŸ’€) and it's all about the list of CAs a server sends to a client when it's like "hey babe, show me your certificate".


🌸 NAME 🌸

SSL_CTX_set_client_CA_list, SSL_set_client_CA_list, SSL_CTX_add_client_CA, SSL_add_client_CA β€” set the list of CAs sent to the client when requesting a client certificate ✨


πŸŽ€ SYNOPSIS πŸŽ€

library β€œlibssl” libcrypto
#include <openssl/ssl.h>
void
SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *list);

void
SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *list);

int
SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *cacert);

int
SSL_add_client_CA(SSL *ssl, X509 *cacert);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, fr fr 🍡

  • SSL_CTX_set_client_CA_list() sets the list of CAs sent to the client when requesting a client certificate for ctx. like, the whole context's vibe check list πŸ’…
  • SSL_set_client_CA_list() sets the list of CAs sent to the client when requesting a client certificate for the chosen ssl, overriding the setting valid for ssl's SSL_CTX object. main character energy β€” it does NOT care what the context said ✨
  • SSL_CTX_add_client_CA() adds the CA name extracted from cacert to the list of CAs sent to the client when requesting a client certificate for ctx πŸŽ€
  • SSL_add_client_CA() adds the CA name extracted from cacert to the list of CAs sent to the client when requesting a client certificate for the chosen ssl, overriding the setting valid for ssl's SSL_CTX object πŸ¦‹

when a TLS/SSL server requests a client certificate (see SSL_CTX_set_verify()), it sends a list of CAs for which it will accept certificates to the client. iykyk 🌈

πŸ‘‘ not me reminding you: this list must explicitly be set using SSL_CTX_set_client_CA_list() for ctx and SSL_set_client_CA_list() for the specific ssl. the list specified overrides the previous setting. and the CAs listed do not become trusted (the list only contains the names, not the complete certificates) β€” use SSL_CTX_load_verify_locations(3) to additionally load them for verification. no cap, that part matters 😭

if the list of acceptable CAs is compiled in a file, the SSL_load_client_CA_file(3) function can be used to help importing the necessary data. obsessed with a convenience function 🫢

SSL_CTX_add_client_CA() and SSL_add_client_CA() can be used to add additional items to the list of client CAs. if no list was specified before using SSL_CTX_set_client_CA_list() or SSL_set_client_CA_list(), a new client CA list for ctx or ssl (as appropriate) is opened πŸ“‚βœ¨

these functions are only useful for TLS/SSL servers πŸ’œ


⭐ RETURN VALUES ⭐

SSL_CTX_add_client_CA() and SSL_add_client_CA() have the following return values:

  • 0 β€” a failure while manipulating the STACK_OF(X509_NAME) object occurred, or the X509_NAME could not be extracted from cacert. check the error stack to find out the reason πŸ™ˆ
  • 1 β€” the operation succeeded πŸŽ‰

πŸ”₯ EXAMPLES πŸ”₯

scan all certificates in CAfile and list them as acceptable CAs:

SSL_CTX_set_client_CA_list(ctx, SSL_load_client_CA_file(CAfile));

one line, ate, periodt πŸ’…


🌈 SEE ALSO 🌈

ssl(3), SSL_CTX_load_verify_locations(3), SSL_get_client_CA_list(3), SSL_load_client_CA_file(3), X509_NAME_new(3)


πŸ’– HISTORY πŸ’–

SSL_CTX_set_client_CA_list(), SSL_set_client_CA_list(), SSL_CTX_add_client_CA(), and SSL_add_client_CA() first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4 πŸ‘‘


okay that's the whole page bestie, go set your CA lists πŸ’œ β€” this icon was brought to you by Debian, dated June 8, 2025, answering to the name SSL_CTX_SET_CLIENT_CA_LIST(3) πŸŽ€βœ¨

πŸ“¦ where this page comes from