SSL_CTX_SET_CERT_STORE(3)

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

πŸ’… 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 of ctx to store, or replaces it with store. and if another X509_STORE object is currently set in ctx, it will be freed. like, bye bestie, you're being replaced πŸ’€.
  • SSL_CTX_set1_cert_store() β€” also sets the verification storage of ctx to or replaces it with store. 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 the X509_STORE object is available. not all members of the X509_STORE are used when the verification takes place. so will, for example, the verify_callback() be overridden with the verify_callback() set via the SSL_CTX_set_verify(3) family of functions. this document must therefore be updated when documentation about the X509_STORE object 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() and SSL_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