SSL_CTX_SET1...Y_CERT_STORE(3ossl)

πŸ’– SSL_CTX_SET1...Y_CERT_STORE πŸ’–

okay bestie so this is the OpenSSL manual page for all the SSL_CTX_set0_verify_cert_store, SSL_CTX_set1_verify_cert_store, SSL_CTX_set0_chain_cert_store, SSL_CTX_set1_chain_cert_store, SSL_set0_verify_cert_store, SSL_set1_verify_cert_store, SSL_set0_chain_cert_store, SSL_set1_chain_cert_store, SSL_CTX_get0_verify_cert_store, SSL_CTX_get0_chain_cert_store, SSL_get0_verify_cert_store, and SSL_get0_chain_cert_store girlies. it's giving "set certificate verification or chain store" and honestly? iconic. 🌸


✨ NAME ✨

the whole friend group, assembled:

  • SSL_CTX_set0_verify_cert_store, SSL_CTX_set1_verify_cert_store
  • SSL_CTX_set0_chain_cert_store, SSL_CTX_set1_chain_cert_store
  • SSL_set0_verify_cert_store, SSL_set1_verify_cert_store
  • SSL_set0_chain_cert_store, SSL_set1_chain_cert_store
  • SSL_CTX_get0_verify_cert_store, SSL_CTX_get0_chain_cert_store
  • SSL_get0_verify_cert_store, SSL_get0_chain_cert_store

β€” set certificate verification or chain store 🫢


✨ SYNOPSIS ✨

#include <openssl/ssl.h>

int SSL_CTX_set0_verify_cert_store(SSL_CTX *ctx, X509_STORE *st);
int SSL_CTX_set1_verify_cert_store(SSL_CTX *ctx, X509_STORE *st);
int SSL_CTX_set0_chain_cert_store(SSL_CTX *ctx, X509_STORE *st);
int SSL_CTX_set1_chain_cert_store(SSL_CTX *ctx, X509_STORE *st);
int SSL_CTX_get0_verify_cert_store(SSL_CTX *ctx, X509_STORE **st);
int SSL_CTX_get0_chain_cert_store(SSL_CTX *ctx, X509_STORE **st);

int SSL_set0_verify_cert_store(SSL *ctx, X509_STORE *st);
int SSL_set1_verify_cert_store(SSL *ctx, X509_STORE *st);
int SSL_set0_chain_cert_store(SSL *ctx, X509_STORE *st);
int SSL_set1_chain_cert_store(SSL *ctx, X509_STORE *st);
int SSL_get0_verify_cert_store(SSL *ctx, X509_STORE **st);
int SSL_get0_chain_cert_store(SSL *ctx, X509_STORE **st);

twelve whole functions. the way that this family keeps growing, fr fr. πŸ’…


✨ DESCRIPTION ✨

so like, SSL_CTX_set0_verify_cert_store() and SSL_CTX_set1_verify_cert_store() set the certificate store used for certificate verification to st. that's the whole vibe.

and SSL_CTX_set0_chain_cert_store() and SSL_CTX_set1_chain_cert_store() set the certificate store used for certificate chain building to st. slay.

then SSL_set0_verify_cert_store(), SSL_set1_verify_cert_store(), SSL_set0_chain_cert_store() and SSL_set1_chain_cert_store() are literally the same thing except they apply to the SSL structure ssl. same energy, different target. πŸ’–

and for the girlies who just wanna look, SSL_CTX_get0_verify_chain_store(), SSL_get0_verify_chain_store(), SSL_CTX_get0_chain_cert_store() and SSL_get0_chain_cert_store() retrieve the objects previously set via the above calls. a pointer to the object (or NULL if no such object has been set) is written to *st. no cap. πŸ¦‹

πŸ’€ BIG ONE, do not skip this: all these functions are implemented as macros. those containing a 1 increment the reference count of the supplied store so it must be freed at some point after the operation. those containing a 0 do not increment reference counts and the supplied store MUST NOT be freed after the operation.

like, 1 = you own a share of it now, clean up after yourself. 0 = you're just borrowing it, hands off. that's the difference and it matters so much. 😭


🌈 NOTES 🌈

the store pointers associated with an SSL_CTX structure are copied to any SSL structures when SSL_new() is called. so as a result, SSL structures will not be affected if the parent SSL_CTX store pointer is set to a new value. it's giving independent queen energy. πŸ‘‘

the verification store is used to verify the certificate chain sent by the peer: that is, an SSL/TLS client will use the verification store to verify the server's certificate chain and an SSL/TLS server will use it to verify any client certificate chain. mutual checking, mutual respect. 🫢

the chain store is used to build the certificate chain. details of the chain building and checking process are described in "Certification Path Building" in openssl-verification-options(1) and "Certification Path Validation" in openssl-verification-options(1). go read those if you want the deep lore, iykyk. πŸ“š

if the mode SSL_MODE_NO_AUTO_CHAIN is set or a certificate chain is configured already (for example using the functions such as SSL_CTX_add1_chain_cert(3) or SSL_CTX_add_extra_chain_cert(3)) then automatic chain building is disabled. βœ‹

if the mode SSL_MODE_NO_AUTO_CHAIN is set then automatic chain building is disabled. (yes bestie it says it again. the manpage is being dramatic for emphasis. noted. πŸ’…)

if the chain or the verification store is not set then the store associated with the parent SSL_CTX is used instead, to retain compatibility with previous versions of OpenSSL. legacy support era. πŸŽ€


✨ RETURN VALUES ✨

all these functions return 1 for success and 0 for failure. that's it. that's the whole range. binary queen. ⭐


🌸 SEE ALSO 🌸


πŸ¦‹ HISTORY πŸ¦‹

these functions were added in OpenSSL 1.0.2. vintage but still thriving. ✨


Copyright 2013-2022 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!! πŸŽ€ this was OpenSSL version 3.5.9, dated 2026-09-29, manual page SSL_CTX_SET1...Y_CERT_STORE(3ossl). go forth and manage your cert stores responsibly, mwah πŸ’–πŸŒΈβœ¨

πŸ“¦ where this page comes from