X509_STORE_LOAD_MEM(3ssl)
π NAME π
Welcome to the X509_STORE_LOAD_LOCATION(3) page from the Library Functions Manual, bestie π. The main characters are X509_STORE_load_locations, X509_STORE_set_default_paths, X509_STORE_load_mem, and X509_STORE_add_lookup β configure files and directories used by a certificate store. Periodt.
β¨ SYNOPSIS β¨
#include <openssl/x509_vfy.h>
int
X509_STORE_load_locations(X509_STORE *store, const char *file,
const char *dirs);
int
X509_STORE_set_default_paths(X509_STORE *store);
int
X509_STORE_load_mem(X509_STORE *store, void *buffer, int length);
X509_LOOKUP *
X509_STORE_add_lookup(X509_STORE *store,
const X509_LOOKUP_METHOD *method);
πΈ DESCRIPTION πΈ
Okay so hereβs the vibe check on each function π:
X509_STORE_load_locations()β tells the store to use the PEM file and all the PEM files in the directories contained in the colon-separated listdirsfor looking up certificates, in addition to files and directories that are already configured. The certificates in the directories must be in hashed form, as documented inX509_LOOKUP_hash_dir(3). Directories already in use are not added again. IfNULLis passed forfileordirs, no new file or no new directories are added, respectively. No cap.X509_STORE_load_locations()is identical toSSL_CTX_load_verify_locations(3)except that it operates directly on anX509_STOREobject, rather than on the store used by an SSL context. See that manual page for more information.X509_STORE_set_default_paths()β similar, except it tells the store to use the default PEM file and directory (as documented in βFILESβ) in addition to what is already configured. It ignores errors that occur while trying to load the file or to add the directory, but it may still fail for other reasons, for example when out of memory while trying to allocate the requiredX509_LOOKUPobjects.X509_STORE_set_default_paths()is identical toSSL_CTX_set_default_verify_paths(3)except that it operates directly on anX509_STOREobject, rather than on the store used by an SSL context. See that manual page for more information.
The above functions are wrappers around X509_LOOKUP_load_file(3) and X509_LOOKUP_add_dir(3). Slay.
X509_STORE_load_mem()β tells the store to use the certificates contained in the memory buffer of the given length for certificate lookup. It is a wrapper aroundX509_LOOKUP_add_mem(3). Memory-buffer realness π .X509_STORE_add_lookup()β checks whether the store already contains anX509_LOOKUPobject using the givenmethod; if it does, the existing object is returned and no other action occurs. Otherwise, a newX509_LOOKUPobject is allocated, added, and returned. This function is used internally by all the functions listed above.
π₯ RETURN VALUES π₯
X509_STORE_load_locations()β returns1if all files and directories specified were successfully added. It returns0for failure. That can happen if adding the file failed, if adding any of the directories failed, or if both arguments wereNULL.X509_STORE_set_default_paths()β returns0for some error conditions and1otherwise, not just for success, but also for various cases of failure. Iykyk.X509_STORE_load_mem()β returns1for success or0for failure. In particular, parse errors or lack of memory can cause failure.X509_STORE_add_lookup()β returns the existing or new lookup object orNULLon failure. This is an internal pointer that must not be freed. With LibreSSL, the only reason for failure is lack of memory.
π¦ FILES π¦
/etc/ssl/cert.pemβ default PEM file forX509_STORE_set_default_paths()/etc/ssl/certs/β default directory forX509_STORE_set_default_paths()
π SEE ALSO π
SSL_CTX_load_verify_locations(3)X509_load_cert_file(3)X509_LOOKUP_hash_dir(3)X509_LOOKUP_new(3)X509_STORE_new(3)X509_STORE_set1_param(3)X509_STORE_set_verify_cb(3)
β HISTORY β
X509_STORE_load_locations(),X509_STORE_set_default_paths(), andX509_STORE_add_lookup()first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4.X509_STORE_load_mem()first appeared in OpenBSD 5.7.
π BUGS π
Bestie, warning: by the time that adding a directory is found to have failed, the file and some other directories may already have been successfully loaded, so these functions may change the state of the store even when they fail. Not the clean rollback fantasy π.
Also: X509_STORE_set_default_paths() clears the error queue, deleting even error information that was already present when it was called. Thatβs giving chaotic cleanup energy, fr fr.
This page is Debian-flavored, dated September 2, 2024 β thatβs the cute lil source/version + date sign-off, bestie πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms