OSSL_STORE_OPEN(3SSL)
πΈ OSSL_STORE_OPEN π
okay bestie, this is the OpenSSL manual page for OSSL_STORE_OPEN(3SSL) β the one about the types and functions you use to read objects from a URI. yes it's a lot of functions. no you're not going to memorize them in one sitting. we got this π
β¨ NAME β¨
Here's the whole cast, in one big glow-up list:
OSSL_STORE_CTXOSSL_STORE_post_process_info_fnOSSL_STORE_openOSSL_STORE_open_exOSSL_STORE_ctrlOSSL_STORE_loadOSSL_STORE_eofOSSL_STORE_deleteOSSL_STORE_errorOSSL_STORE_close
and collectively they're the types and functions to read objects from a URI. that's the whole vibe π¦
π SYNOPSIS π
first, the include, obviously:
#include <openssl/store.h>
the context type, our main character:
typedef struct ossl_store_ctx_st OSSL_STORE_CTX;
the callback typedef β this is the one that gets to yeet values back:
typedef OSSL_STORE_INFO *(*OSSL_STORE_post_process_info_fn)(OSSL_STORE_INFO *,
void *);
and now the functions themselves, verbatim so you can copy-paste with zero fear:
OSSL_STORE_CTX *OSSL_STORE_open(const char *uri, const UI_METHOD *ui_method,
void *ui_data,
OSSL_STORE_post_process_info_fn post_process,
void *post_process_data);
OSSL_STORE_CTX *
OSSL_STORE_open_ex(const char *uri, OSSL_LIB_CTX *libctx, const char *propq,
const UI_METHOD *ui_method, void *ui_data,
const OSSL_PARAM params[],
OSSL_STORE_post_process_info_fn post_process,
void *post_process_data);
OSSL_STORE_INFO *OSSL_STORE_load(OSSL_STORE_CTX *ctx);
int OSSL_STORE_eof(OSSL_STORE_CTX *ctx);
int OSSL_STORE_delete(const char *uri, OSSL_LIB_CTX *libctx, const char *propq,
const UI_METHOD *ui_method, void *ui_data,
const OSSL_PARAM params[]);
int OSSL_STORE_error(OSSL_STORE_CTX *ctx);
int OSSL_STORE_close(OSSL_STORE_CTX *ctx);
π¨ deprecated alert π¨ the function below has been deprecated since OpenSSL 3.0, and you can hide it entirely by definingOPENSSL_API_COMPATwith a suitable version value. checkopenssl_user_macros(7)for the deets.
int OSSL_STORE_ctrl(OSSL_STORE_CTX *ctx, int cmd, ... /* args */);
π DESCRIPTION π
so basically: these functions help your application fetch supported objects β and if you want the tea on which objects count as supported, go look at "SUPPORTED OBJECTS" in OSSL_STORE_INFO(3) β from a given URI.
the general method, step by step, is giving very much a routine:
- "open" the URI using
OSSL_STORE_open() - read each available and supported object using
OSSL_STORE_load(), and keep going as long asOSSL_STORE_eof()hasn't been reached - finish it off with
OSSL_STORE_close()
the retrieved information gets stored in an OSSL_STORE_INFO, which is described in more detail in OSSL_STORE_INFO(3). β¨
π Types
OSSL_STORE_CTX is a context variable π¦ β it holds all the internal information so that OSSL_STORE_open(), OSSL_STORE_open_ex(), OSSL_STORE_load(), OSSL_STORE_eof() and OSSL_STORE_close() can work together. it's the group chat all of them share, essentially.
π¦ Functions
OSSL_STORE_open_ex() takes a uri or path uri, a password UI method ui_method with associated data ui_data, and a post processing callback post_process with associated data post_process_data, plus a library context libctx with an associated property query propq. it opens a channel to the data located at the URI and returns an OSSL_STORE_CTX with all the necessary internal information. the ui_method and ui_data you gave get reused by every function that uses OSSL_STORE_CTX when interaction is needed β like when something needs a password π. the auxiliary OSSL_PARAM(3) parameters in params can be set to further modify the store operation. and the post_process and post_process_data you gave get reused by OSSL_STORE_load() to manipulate or drop the value that's about to be returned. the post_process function drops values by returning NULL, which makes OSSL_STORE_load() start its whole process over again and load the next object β and it keeps doing that until post_process returns something that is not NULL, or the end of data is reached, as indicated by OSSL_STORE_eof().
OSSL_STORE_open() is similar to OSSL_STORE_open_ex() but uses NULL for the params, the library context libctx and property query propq. lowkey the simpler sibling π
OSSL_STORE_ctrl() takes an OSSL_STORE_CTX, and a command number cmd, plus more arguments that are not specified here. the available loader specific command numbers, and the arguments each one takes, depend on the loader that's being used β and they're documented together with that loader. so, y'know, read that loader's page, not this one.
there are also global controls available:
OSSL_STORE_C_USE_SECMEMβ controls whether the loader should attempt to use secure memory for any allocatedOSSL_STORE_INFOand its contents. this control expects one argument: a pointer to anintthat is expected to have the value1(yes) or0(no). any other value is an error. π«
OSSL_STORE_load() takes an OSSL_STORE_CTX and tries to load the next available object, returning it wrapped with OSSL_STORE_INFO.
OSSL_STORE_delete() deletes the object identified by uri. bye bye π
OSSL_STORE_eof() takes an OSSL_STORE_CTX and checks if we've reached the end of data.
OSSL_STORE_error() takes an OSSL_STORE_CTX and checks if an error occurred in the last OSSL_STORE_load() call. heads up though: it may still be meaningful to try and load more objects, unless OSSL_STORE_eof() shows that the end of data has been reached. iykyk π
OSSL_STORE_close() takes an OSSL_STORE_CTX, closes the channel that was opened by OSSL_STORE_open(), and frees all the other information that was stored in the OSSL_STORE_CTX β as well as the OSSL_STORE_CTX itself. if ctx is NULL it does nothing. iconic, no notes. π
π NOTES π
a string without a scheme prefix β that is, a non-URI string β is implicitly interpreted as using the file: scheme. surprise, bestie, it was a file the whole time π
there are some tools you can use together with OSSL_STORE_open() to figure out whether a failure was caused by an unparsable URI, or whether it's a different error (like memory allocation failures). and here's the trick: if the URI was parsable but the scheme is unregistered, the top error will have the reason "OSSL_STORE_R_UNREGISTERED_SCHEME". write that down π
these functions make no direct assumption regarding the pass phrase received from the password callback. the loaders may make assumptions, though. for example, the file: scheme loader inherits the assumptions made by OpenSSL functionality that handles the different file types β this is mostly relevant for PKCS#12 objects. see passphrase-encoding(7) for further information.
π RETURN VALUES π
OSSL_STORE_open()returns a pointer to anOSSL_STORE_CTXon success, orNULLon failure.OSSL_STORE_load()returns a pointer to anOSSL_STORE_INFOon success, orNULLon error or when the end of data is reached. useOSSL_STORE_error()andOSSL_STORE_eof()to determine the meaning of a returnedNULLβ don't just guess, bestie.OSSL_STORE_eof()returns1if the end of data has been reached or an error occurred,0otherwise.OSSL_STORE_error()returns1if an error occurred in anOSSL_STORE_load()call, otherwise0.OSSL_STORE_delete(),OSSL_STORE_ctrl()andOSSL_STORE_close()return1on success, or0on failure.
π SEE ALSO π
go read these next, they're the friend group:
π§ HISTORY π§
the lore, in order:
OSSL_STORE_delete()was added in OpenSSL 3.2.OSSL_STORE_open_ex()was added in OpenSSL 3.0.OSSL_STORE_CTX,OSSL_STORE_post_process_info_fn(),OSSL_STORE_open(),OSSL_STORE_ctrl(),OSSL_STORE_load(),OSSL_STORE_eof()andOSSL_STORE_close()were added in OpenSSL 1.1.1.- Handling of the
NULLctx argument forOSSL_STORE_close()was introduced in OpenSSL 1.1.1h. OSSL_STORE_ctrl()andOSSL_STORE_vctrl()were deprecated in OpenSSL 3.0.
π COPYRIGHT π
Copyright 2016-2023 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 of the License 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 version 4.0.3, dated 2026-09-29 β go forth and OSSL_STORE_open() responsibly, mwah ππΈβ¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms