OSSL_STORE_INFO(3SSL)

πŸ“¦
version 4.0.3 Β· 2 versions
, in ubuntu stonking

πŸ’– NAME πŸ’–

okay so bestie, gather round, because this page is about one truly iconic little squad: OSSL_STORE_INFO and all its besties. Collectively they are the Functions to manipulate OSSL_STORE_INFO objects. That's it, that's the job. No cap. πŸ’…

The whole friend group, in exact name order:

OSSL_STORE_INFO, OSSL_STORE_INFO_get_type, OSSL_STORE_INFO_get0_NAME,
OSSL_STORE_INFO_get0_NAME_description, OSSL_STORE_INFO_get0_PARAMS,
OSSL_STORE_INFO_get0_PUBKEY, OSSL_STORE_INFO_get0_PKEY,
OSSL_STORE_INFO_get0_CERT, OSSL_STORE_INFO_get0_CRL,
OSSL_STORE_INFO_get0_SKEY, OSSL_STORE_INFO_get1_NAME,
OSSL_STORE_INFO_get1_NAME_description, OSSL_STORE_INFO_get1_PARAMS,
OSSL_STORE_INFO_get1_PUBKEY, OSSL_STORE_INFO_get1_PKEY,
OSSL_STORE_INFO_get1_CERT, OSSL_STORE_INFO_get1_CRL,
OSSL_STORE_INFO_get1_SKEY, OSSL_STORE_INFO_type_string,
OSSL_STORE_INFO_free, OSSL_STORE_INFO_new_NAME,
OSSL_STORE_INFO_set0_NAME_description, OSSL_STORE_INFO_new_PARAMS,
OSSL_STORE_INFO_new_PUBKEY, OSSL_STORE_INFO_new_PKEY,
OSSL_STORE_INFO_new_CERT, OSSL_STORE_INFO_new_CRL, OSSL_STORE_INFO_new,
OSSL_STORE_INFO_new_SKEY, OSSL_STORE_INFO_get0_data

✨ SYNOPSIS ✨

the receipts, verbatim, do not touch:

#include <openssl/store.h>

typedef struct ossl_store_info_st OSSL_STORE_INFO;

int OSSL_STORE_INFO_get_type(const OSSL_STORE_INFO *store_info);
const char *OSSL_STORE_INFO_get0_NAME(const OSSL_STORE_INFO *store_info);
char *OSSL_STORE_INFO_get1_NAME(const OSSL_STORE_INFO *store_info);
const char *OSSL_STORE_INFO_get0_NAME_description(const OSSL_STORE_INFO
                                                  *store_info);
char *OSSL_STORE_INFO_get1_NAME_description(const OSSL_STORE_INFO *store_info);
EVP_PKEY *OSSL_STORE_INFO_get0_PARAMS(const OSSL_STORE_INFO *store_info);
EVP_PKEY *OSSL_STORE_INFO_get1_PARAMS(const OSSL_STORE_INFO *store_info);
EVP_PKEY *OSSL_STORE_INFO_get0_PUBKEY(const OSSL_STORE_INFO *info);
EVP_PKEY *OSSL_STORE_INFO_get1_PUBKEY(const OSSL_STORE_INFO *info);
EVP_PKEY *OSSL_STORE_INFO_get0_PKEY(const OSSL_STORE_INFO *store_info);
EVP_PKEY *OSSL_STORE_INFO_get1_PKEY(const OSSL_STORE_INFO *store_info);
X509 *OSSL_STORE_INFO_get0_CERT(const OSSL_STORE_INFO *store_info);
X509 *OSSL_STORE_INFO_get1_CERT(const OSSL_STORE_INFO *store_info);
X509_CRL *OSSL_STORE_INFO_get0_CRL(const OSSL_STORE_INFO *store_info);
X509_CRL *OSSL_STORE_INFO_get1_CRL(const OSSL_STORE_INFO *store_info);
EVP_SKEY *OSSL_STORE_INFO_get0_SKEY(const OSSL_STORE_INFO *store_info);
EVP_SKEY *OSSL_STORE_INFO_get1_SKEY(const OSSL_STORE_INFO *store_info);

const char *OSSL_STORE_INFO_type_string(int type);

void OSSL_STORE_INFO_free(OSSL_STORE_INFO *store_info);

OSSL_STORE_INFO *OSSL_STORE_INFO_new_NAME(char *name);
int OSSL_STORE_INFO_set0_NAME_description(OSSL_STORE_INFO *info, char *desc);
OSSL_STORE_INFO *OSSL_STORE_INFO_new_PARAMS(DSA *dsa_params);
OSSL_STORE_INFO *OSSL_STORE_INFO_new_PUBKEY(EVP_PKEY *pubkey);
OSSL_STORE_INFO *OSSL_STORE_INFO_new_PKEY(EVP_PKEY *pkey);
OSSL_STORE_INFO *OSSL_STORE_INFO_new_CERT(X509 *x509);
OSSL_STORE_INFO *OSSL_STORE_INFO_new_CRL(X509_CRL *crl);
OSSL_STORE_INFO *OSSL_STORE_INFO_new_SKEY(EVP_SKEY *skey);

OSSL_STORE_INFO *OSSL_STORE_INFO_new(int type, void *data);
void *OSSL_STORE_INFO_get0_data(int type, const OSSL_STORE_INFO *info);

πŸ¦‹ DESCRIPTION πŸ¦‹

So what are these functions for, you ask? Two whole vibes, bestie:

  • Applications use them to pull the supported objects back out of OSSL_STORE_INFO objects.
  • Scheme specific loaders use them to create OSSL_STORE_INFO holders in the first place.

πŸŽ€ Types πŸŽ€

OSSL_STORE_INFO is an opaque type, and it's just an intermediary holder for the objects that got retrieved by OSSL_STORE_load() and similar functions. It's giving very much "I'm just holding this for a friend". 🫢

You can pull a supported OpenSSL type object out with one of the STORE_INFO_get0_<TYPE>() functions, where <TYPE> can be NAME, PARAMS, PKEY, CERT, or CRL.

⚠️ lifetime check, bestie!! the object you extract this way lives exactly as long as the OSSL_STORE_INFO it was extracted from. So please do not free the latter too early. that's a whole tragedy waiting to happen. 😭

Alternatively, STORE_INFO_get1_<TYPE>() extracts a duplicate (or the same object with its reference count increased), which means you can use it after the containing OSSL_STORE_INFO has been freed. The tradeoff? The object returned by STORE_INFO_get1_<TYPE>() must be freed separately by the caller. You wanted it, you own it. πŸ’…

Wanna know which types are even supported? Scroll to "SUPPORTED OBJECTS", babes. ⭐

🌸 Functions 🌸

  • OSSL_STORE_INFO_get_type() β€” hand it a OSSL_STORE_INFO, it hands you back the STORE type number of the object inside. Very "what are you, actually".
  • STORE_INFO_get_type_string() β€” hand it a STORE type number, it hands you back a short string describing it. Cute little name tag energy. ✨
  • OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(), OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PUBKEY(), OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), OSSL_STORE_INFO_get0_CRL(), OSSL_STORE_INFO_get0_SKEY() β€” all of these take a OSSL_STORE_INFO and return the object it holds if the OSSL_STORE_INFO type (as returned by OSSL_STORE_INFO_get_type()) matches the function. Doesn't match? You get NULL. no hard feelings.
  • OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(), OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PUBKEY(), OSSL_STORE_INFO_get1_PKEY(), OSSL_STORE_INFO_get1_CERT(), OSSL_STORE_INFO_get1_CRL(), OSSL_STORE_INFO_get1_SKEY() β€” same deal, they take a OSSL_STORE_INFO and return a duplicate of the object it holds if the type (again, as returned by OSSL_STORE_INFO_get_type()) matches. Otherwise NULL. πŸ’€
  • OSSL_STORE_INFO_free() β€” frees a OSSL_STORE_INFO and its contained type. If the argument is NULL, nothing happens at all. Not a single thing. Zero drama. 🧚
  • OSSL_STORE_INFO_new_NAME(), OSSL_STORE_INFO_new_PARAMS(), OSSL_STORE_INFO_new_PUBKEY(), OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT(), OSSL_STORE_INFO_new_CRL() and OSSL_STORE_INFO_new_SKEY() β€” these create a OSSL_STORE_INFO object to hold the given input object. And heads up: on success the input object is consumed. It's gone, girl, it belongs to the store now. πŸ‘‘
  • OSSL_STORE_INFO_set0_NAME_description() β€” bonus feature, only for OSSL_STORE_INFO_NAME objects: it adds an extra description. That description is meant to be human readable and should be used for information printout. (i.e. it's for the girlies reading logs, not for machines. πŸ’…)
  • OSSL_STORE_INFO_new() β€” creates a OSSL_STORE_INFO with an arbitrary type number and data structure. Now listen: it is the responsibility of the caller to define type numbers other than the ones defined by <openssl/store.h>, and to handle freeing the associated data structure on their own. And using type numbers that are defined by <openssl/store.h> may cause undefined behaviours, including crashes. 😭 yeah. crashing. be so serious about this one.
  • OSSL_STORE_INFO_get0_data() β€” returns the data pointer that was passed to OSSL_STORE_INFO_new() if the type matches the type number in info.

And a lil closing thought: OSSL_STORE_INFO_new() and OSSL_STORE_INFO_get0_data() may be useful for applications that define their own STORE data β€” but they must be used with care. πŸŽ€


🌈 SUPPORTED OBJECTS 🌈

Currently supported object types are:

  • OSSL_STORE_INFO_NAME β€” A name is exactly that, a name. It's like a name in a directory, but formatted as a complete URI. For example, the path in URI "file:/foo/bar/" could include a file named "cookie.pem", and in that case, the returned OSSL_STORE_INFO_NAME object would have the URI "file:/foo/bar/cookie.pem", which can be used by the application to get the objects in that file. This can be applied to all schemes that can somehow support a listing of object URIs.

For "file:" URIs that are used without the explicit scheme, the returned name will be the path of each object. So if "/foo/bar" was given and that path has the file "cookie.pem", the name "/foo/bar/cookie.pem" will be returned.

The returned URI is considered canonical and must be unique and permanent for the storage where the object (or collection of objects) resides. Each loader is responsible for ensuring that it only returns canonical URIs. However, it's possible that certain schemes allow an object (or collection thereof) to be reached with alternative URIs; just because one URI is canonical doesn't mean that other variants can't be used. ✨

At the discretion of the loader that was used to get these names, an extra description may be attached as well.

  • OSSL_STORE_INFO_PARAMS β€” Key parameters.
  • OSSL_STORE_INFO_PKEY β€” A keypair or just a private key (possibly with key parameters).
  • OSSL_STORE_INFO_PUBKEY β€” A public key (possibly with key parameters).
  • OSSL_STORE_INFO_CERT β€” An X.509 certificate.
  • OSSL_STORE_INFO_CRL β€” A X.509 certificate revocation list.
  • OSSL_STORE_INFO_SKEY β€” A symmetric key object.

πŸ’œ RETURN VALUES πŸ’œ

  • OSSL_STORE_INFO_get_type() β€” returns the STORE type number of the given OSSL_STORE_INFO. There is no error value. (iconic, honestly, no ambiguity.)
  • OSSL_STORE_INFO_get0_NAME(), OSSL_STORE_INFO_get0_NAME_description(), OSSL_STORE_INFO_get0_PARAMS(), OSSL_STORE_INFO_get0_PKEY(), OSSL_STORE_INFO_get0_CERT(), OSSL_STORE_INFO_get0_CRL() and OSSL_STORE_INFO_get0_SKEY() β€” all return a pointer to the OpenSSL object on success, NULL otherwise.
  • OSSL_STORE_INFO_get1_NAME(), OSSL_STORE_INFO_get1_NAME_description(), OSSL_STORE_INFO_get1_PARAMS(), OSSL_STORE_INFO_get1_PKEY(), OSSL_STORE_INFO_get1_CERT(), OSSL_STORE_INFO_get1_CRL() and OSSL_STORE_INFO_get1_SKEY() β€” all return a pointer to a duplicate of the OpenSSL object on success, NULL otherwise.
  • OSSL_STORE_INFO_type_string() β€” returns a string on success, or NULL on failure.
  • OSSL_STORE_INFO_new_NAME(), OSSL_STORE_INFO_new_PARAMS(), OSSL_STORE_INFO_new_PKEY(), OSSL_STORE_INFO_new_CERT(), OSSL_STORE_INFO_new_CRL() and OSSL_STORE_INFO_new_SKEY() β€” return a OSSL_STORE_INFO pointer on success, or NULL on failure.
  • OSSL_STORE_INFO_set0_NAME_description() β€” returns 1 on success, or 0 on failure.

⭐ SEE ALSO ⭐

besties, go read them, fr fr. πŸ¦‹


πŸŽ€ HISTORY πŸŽ€

  • The OSSL_STORE API was added in OpenSSL 1.1.1.
  • The OSSL_STORE_INFO_PUBKEY object type was added in OpenSSL 3.0.
  • OSSL_STORE_INFO_get0_SKEY(), OSSL_STORE_INFO_get1_SKEY() and OSSL_STORE_INFO_new_SKEY() were added in OpenSSL 4.0.

glow-up timeline, honestly. 🫢


Copyright 2016-2024 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 one shipped as version 4.0.3 dated 2026-09-29, filed under OSSL_STORE_INFO(3SSL) β€” now go forth and manipulate your store info objects responsibly, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from