PROVIDER-STOREMGMT(7SSL)

✨ NAME ✨

provider-storemgmt β€” the OSSL_STORE library <-> provider functions πŸ’«

bestie, this is the PROVIDER-STOREMGMT(7SSL) page, and it's literally the spec for how a provider talks to the STORE side of OpenSSL. buckle up πŸŽ€


🌸 SYNOPSIS 🌸

#include <openssl/core_dispatch.h>

/*
 * None of these are actual functions, but are displayed like this for
 * the function signatures for functions that are offered as function
 * pointers in OSSL_DISPATCH arrays.
 */

void *OSSL_FUNC_store_open(void *provctx, const char *uri);
void *OSSL_FUNC_store_attach(void *provctx, OSSL_CORE_BIO *bio);
const OSSL_PARAM *store_settable_ctx_params(void *provctx);
int OSSL_FUNC_store_set_ctx_params(void *loaderctx, const OSSL_PARAM[]);
int OSSL_FUNC_store_load(void *loaderctx,
                         OSSL_CALLBACK *object_cb, void *object_cbarg,
                         OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg);
int OSSL_FUNC_store_eof(void *loaderctx);
int OSSL_FUNC_store_close(void *loaderctx);

int OSSL_FUNC_store_export_object
    (void *loaderctx, const void *objref, size_t objref_sz,
     OSSL_CALLBACK *export_cb, void *export_cbarg);
void *OSSL_FUNC_store_open_ex(void *provctx, const char *uri,
                              const OSSL_PARAM params[],
                              OSSL_PASSPHRASE_CALLBACK *pw_cb,
                              void *pw_cbarg);

int OSSL_FUNC_store_delete(void *provctx, const char *uri,
                   const OSSL_PARAM params[],
                   OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg);

πŸ’… DESCRIPTION πŸ’…

so the STORE operation is the provider side of the ossl_store(7) API. that's the vibe. 🫢

its main character energy job? load all sorts of objects from a container that's indicated by a URI. then it hands those objects to the OpenSSL library in provider-native object abstraction form (peep provider-object(7) for that). after that, the OpenSSL library is the one responsible for passing that abstraction along to whatever suitable provided functions want it. teamwork, fr fr ✨

examples of functions the OpenSSL library can pass the abstraction to include:

  • OSSL_FUNC_keymgmt_load() (see provider-keymgmt(7))
  • OSSL_FUNC_store_export_object() β€” which exports the object in parameterized form

ngl, all the "functions" mentioned here are actually passed as function pointers between libcrypto and the provider, inside OSSL_DISPATCH(3) arrays, via OSSL_ALGORITHM(3) arrays that come back out of the provider's provider_query_operation() function (see "Provider Functions" in provider-base(7)). iykyk πŸ”₯

every single one of these "functions" also has:

  • a function type definition named OSSL_FUNC_{name}_fn
  • a lil helper function that grabs the function pointer out of an OSSL_DISPATCH(3) element, named OSSL_get_{name}

for example, the "function" OSSL_FUNC_store_attach() has exactly these:

typedef void *(OSSL_FUNC_store_attach_fn)(void *provctx,
                                          OSSL_CORE_BIO * bio);
static ossl_inline OSSL_FUNC_store_attach_fn
    OSSL_FUNC_store_attach(const OSSL_DISPATCH *opf);

and OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), like this:

OSSL_FUNC_store_open                 OSSL_FUNC_STORE_OPEN
OSSL_FUNC_store_attach               OSSL_FUNC_STORE_ATTACH
OSSL_FUNC_store_settable_ctx_params  OSSL_FUNC_STORE_SETTABLE_CTX_PARAMS
OSSL_FUNC_store_set_ctx_params       OSSL_FUNC_STORE_SET_CTX_PARAMS
OSSL_FUNC_store_load                 OSSL_FUNC_STORE_LOAD
OSSL_FUNC_store_eof                  OSSL_FUNC_STORE_EOF
OSSL_FUNC_store_close                OSSL_FUNC_STORE_CLOSE
OSSL_FUNC_store_export_object        OSSL_FUNC_STORE_EXPORT_OBJECT
OSSL_FUNC_store_delete               OSSL_FUNC_STORE_DELETE
OSSL_FUNC_store_open_ex              OSSL_FUNC_STORE_OPEN_EX

πŸ¦‹ Functions πŸ¦‹

  • OSSL_FUNC_store_open() β€” should create a provider side context stuffed with data based on the input uri. and the implementation is entirely responsible for interpreting that URI. no takebacks πŸ’…
  • OSSL_FUNC_store_attach() β€” should create a provider side context with the core BIO bio attached. it's an alternative to using a URI to find storage, and it's what supports OSSL_STORE_attach(3).
  • OSSL_FUNC_store_settable_ctx_params() β€” should return a constant array of descriptor OSSL_PARAM(3), covering the parameters that OSSL_FUNC_store_set_ctx_params() can handle.
  • OSSL_FUNC_store_set_ctx_params() β€” should set additional parameters, like what kind of data to expect, search criteria, and so on (more on those below in "Load Parameters" πŸ‘€). whether unrecognised parameters are an error or just simply ignored is at the implementation's discretion. and passing NULL for params should return true, periodt.
  • OSSL_FUNC_store_load() β€” loads the next object from the URI opened by OSSL_FUNC_store_open(), creates an object abstraction for it (see provider-object(7)), and calls object_cb with it along with object_cbarg. then object_cb interprets that object abstraction and does what it can to wrap it or decode it into an OpenSSL structure. and if a passphrase needs to be prompted to unlock an object, pw_cb should be called. πŸ”‘
  • OSSL_FUNC_store_eof() β€” indicates if the end of the set of objects from the URI has been reached. once that happens, there's genuinely no point trying to do any more loading, bestie.
  • OSSL_FUNC_store_close() β€” frees the provider side context ctx. bye bye πŸ‘‹

okay so when a provider-native object is created by a store manager, it would be unsuitable for direct use with a foreign provider. the export function lets you export the object to that foreign provider β€” but only if the foreign provider supports the type of the object and provides an import function. no support, no export, that's the rule πŸ’€

  • OSSL_FUNC_store_export_object() β€” should export the object of size objref_sz referenced by objref as an OSSL_PARAM(3) array, and pass that to the export_cb as well as the given export_cbarg.
  • OSSL_FUNC_store_delete() β€” deletes the object identified by the uri. again, the implementation is entirely responsible for interpreting the URI. and if a passphrase needs to be prompted to remove an object, pw_cb should be called.
  • OSSL_FUNC_store_open_ex() β€” an extended variant of OSSL_FUNC_store_open(). if the provider does not implement this function, the code internally falls back to using the original OSSL_FUNC_store_open(). this variant additionally accepts an OSSL_PARAM(3) object and a pw_cb callback, which can be used to request a passphrase in cases where the whole store needs to be unlocked before performing any load operation at all. πŸ”“

πŸ“ Load Parameters πŸ“

  • "expect" (OSSL_STORE_PARAM_EXPECT) <integer> β€” a lil hint about what type of data the OpenSSL library expects to get. it's only useful for optimization, because the library will check that the object types match the expectation too. the number you can pass through this parameter lives in <openssl/store.h>, with macros whose names start with "OSSL_STORE_INFO_". those are described further in "SUPPORTED OBJECTS" in OSSL_STORE_INFO(3).
  • "subject" (OSSL_STORE_PARAM_SUBJECT) <octet string> β€” says the caller wants to search for an object with the given subject associated. this can be used to select specific certificates by subject. the contents of the octet string is expected to be in DER form.
  • "issuer" (OSSL_STORE_PARAM_ISSUER) <octet string> β€” says the caller wants to search for an object with the given issuer associated. this can be used to select specific certificates by issuer. the contents of the octet string is expected to be in DER form.
  • "serial" (OSSL_STORE_PARAM_SERIAL) <integer> β€” says the caller wants to search for an object with the given serial number associated.
  • "digest" (OSSL_STORE_PARAM_DIGEST) <UTF8 string> and "fingerprint" (OSSL_STORE_PARAM_FINGERPRINT) <octet string> β€” says the caller wants to search for an object with the given fingerprint, computed with the given digest.
  • "alias" (OSSL_STORE_PARAM_ALIAS) <UTF8 string> β€” says the caller wants to search for an object with the given alias (some people call it a "friendly name").
  • "properties" (OSSL_STORE_PARAM_PROPERTIES) <utf8 string> β€” property string to use when querying for algorithms such as the OSSL_DECODER decoder implementations.
  • "input-type" (OSSL_STORE_PARAM_INPUT_TYPE) <utf8 string> β€” type of the input format, used as a hint when decoding the objects in the store.

and yes, several of these search criteria can be combined! for example, to search for a certificate by issuer+serial, both the "issuer" and the "serial" parameters will be given. slay πŸŽ€


πŸ‘€ SEE ALSO πŸ‘€

provider(7)


πŸ“œ HISTORY πŸ“œ

the STORE interface was introduced in OpenSSL 3.0.

the OSSL_FUNC_store_delete() callback was added in OpenSSL 3.2. glow up ✨


Copyright 2020-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 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 PROVIDER-STOREMGMT(7SSL) as it appears in version 4.0.3, dated 2026-09-29. go forth and implement ur store manager, u got this πŸ‘‘πŸŒΈ

πŸ“¦ where this page comes from