SSL_CTX_SET_CERT_STORE(3)
π SSL_CTX_SET_CERT_STORE(3) β bestie edition β¨
okay so this is the libssl / libcrypto manual page for SSL_CTX_set_cert_store, SSL_CTX_set1_cert_store, and SSL_CTX_get_cert_store. it's giving "certificate verification storage manipulation" and honestly? iconic. let's get into it π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
void
SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store);
void
SSL_CTX_set1_cert_store(SSL_CTX *ctx, X509_STORE *store);
X509_STORE *
SSL_CTX_get_cert_store(const SSL_CTX *ctx);
like, yes bestie, these are the three functions we're talking about. no cap. π«Ά
β¨ DESCRIPTION β¨
so here's the tea β:
SSL_CTX_set_cert_store()β sets the verification storage ofctxtostore, or replaces it withstore. and if anotherX509_STOREobject is currently set inctx, it will be freed. like, bye bestie, you're being replaced π.SSL_CTX_set1_cert_store()β also sets the verification storage ofctxto or replaces it withstore. but this one increments the store's reference count instead of freeing the old one. so it's the polite version, lowkey. π§SSL_CTX_get_cert_store()β returns a pointer to the current certificate verification storage. it's giving "what's in your bag" energy π.
now, for the actual vibe check: in order to verify the certificates presented by the peer, trusted CA certificates must be accessed. these CA certificates are made available via lookup methods, handled inside the X509_STORE. and from the X509_STORE, the X509_STORE_CTX used when verifying certificates is created. it's a whole ecosystem, fr fr π.
typically the trusted certificate store is handled indirectly via using SSL_CTX_load_verify_locations(3). but using SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions, it is possible to manipulate the X509_STORE object beyond the SSL_CTX_load_verify_locations(3) call. so you can go off-script bestie, it's allowed π
.
currently no detailed documentation on how to use theX509_STOREobject is available. not all members of theX509_STOREare used when the verification takes place. so will, for example, theverify_callback()be overridden with theverify_callback()set via theSSL_CTX_set_verify(3)family of functions. this document must therefore be updated when documentation about theX509_STOREobject and its handling becomes available. like, it's a known gap, we're working on it, periodt. π
π¦ RETURN VALUES π¦
SSL_CTX_get_cert_store()returns the current setting. that's it. that's the whole return value. slay. β¨
π₯ SEE ALSO π₯
go read these if you want the full lore, iykyk π
π HISTORY π
SSL_CTX_set_cert_store()andSSL_CTX_get_cert_store()first appeared in SSLeay 0.8.1 and have been available since OpenBSD 2.4. like, ancient. retro. we love a legacy icon π.SSL_CTX_set1_cert_store()first appeared in OpenSSL 1.1.1 and has been available since OpenBSD 7.6. newer but already iconic in its own right π.
okay that's the whole page bestie! huge thank you to the Debian crew for keeping this updated β this manual page is dated June 8, 2025 and it's giving "current and fresh" energy. stay slaying, stay verifying those certs, and remember: always check your X509_STORE πβ¨π
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2001, 2002, 2005 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms