OSSL_STORE_SEARCH(3ossl)
π OSSL_STORE_SEARCH β the 3ossl manual, but make it make sense
okay so bestie, buckle up π this is the OpenSSL page for OSSL_STORE_SEARCH and friends β literally the type and functions you use to create OSSL_STORE search criteria. it's giving "how do i find my stuff without only using the URI" energy and honestly? iconic.
β¨ SYNOPSIS β¨
#include <openssl/store.h>
typedef struct ossl_store_search_st OSSL_STORE_SEARCH;
OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_name(X509_NAME *name);
OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_issuer_serial(X509_NAME *name,
const ASN1_INTEGER
*serial);
OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_key_fingerprint(const EVP_MD *digest,
const unsigned char
*bytes, int len);
OSSL_STORE_SEARCH *OSSL_STORE_SEARCH_by_alias(const char *alias);
void OSSL_STORE_SEARCH_free(OSSL_STORE_SEARCH *search);
int OSSL_STORE_SEARCH_get_type(const OSSL_STORE_SEARCH *criterion);
X509_NAME *OSSL_STORE_SEARCH_get0_name(OSSL_STORE_SEARCH *criterion);
const ASN1_INTEGER *OSSL_STORE_SEARCH_get0_serial(const OSSL_STORE_SEARCH
*criterion);
const unsigned char *OSSL_STORE_SEARCH_get0_bytes(const OSSL_STORE_SEARCH
*criterion, size_t *length);
const char *OSSL_STORE_SEARCH_get0_string(const OSSL_STORE_SEARCH *criterion);
const EVP_MD *OSSL_STORE_SEARCH_get0_digest(const OSSL_STORE_SEARCH
*criterion);
πΈ DESCRIPTION πΈ
so these functions exist to hand over search criteria β like, ways to hunt down specific objects through names other than just the URI you already gave to OSSL_STORE_open(). highkey useful if your app got handed a URI and now wants to add extra search criteria in a uniform, supported way. no cap, that's the whole vibe. π¦
π§ Types
OSSL_STORE_SEARCH is an opaque type that holds the constructed search criterion, and you can pass it to an OSSL_STORE context with OSSL_STORE_find().
bestie listen π the calling application owns the allocation of anOSSL_STORE_SEARCHat all times, so please be careful and do not deallocate it beforeOSSL_STORE_close()has been called for theOSSL_STOREcontext you gave it to. that's a whole mess you don't want.
π Application Functions
OSSL_STORE_SEARCH_by_name(),OSSL_STORE_SEARCH_by_issuer_serial(),OSSL_STORE_SEARCH_by_key_fingerprint(), andOSSL_STORE_SEARCH_by_alias()create anOSSL_STORE_SEARCHfrom, respectively: a subject name, an issuer name + serial number pair, a key fingerprint, and an alias (like a friendly name, cute right?).OSSL_STORE_SEARCH_free()frees theOSSL_STORE_SEARCH. if the argument isNULL, nothing happens β it literally just vibes. π
β οΈ important detail, don't skip: the parameters you provide are not copied, only referred to in a criterion. so they must have at least the same life time as the created OSSL_STORE_SEARCH. periodt.
π Loader Functions
OSSL_STORE_SEARCH_get_type() returns the criterion type for the given OSSL_STORE_SEARCH.
OSSL_STORE_SEARCH_get0_name(), OSSL_STORE_SEARCH_get0_serial(), OSSL_STORE_SEARCH_get0_bytes(), OSSL_STORE_SEARCH_get0_string(), and OSSL_STORE_SEARCH_get0_digest() retrieve different data from an OSSL_STORE_SEARCH, as available for each type. for the deets, peek at "SUPPORTED CRITERION TYPES" below π
π₯ SUPPORTED CRITERION TYPES π₯
currently supported criterion types are:
π OSSL_STORE_SEARCH_BY_NAME
search by exact match of subject name. the subject name itself is an X509_NAME pointer. you create this with OSSL_STORE_SEARCH_by_name(), and grab the actual subject name back with OSSL_STORE_SEARCH_get0_name().
π OSSL_STORE_SEARCH_BY_ISSUER_SERIAL
search by exact match of both issuer name and serial number. the issuer name is an X509_NAME pointer and the serial number is an ASN1_INTEGER pointer. created with OSSL_STORE_SEARCH_by_issuer_serial(), and you retrieve the actual issuer name and serial number with OSSL_STORE_SEARCH_get0_name() and OSSL_STORE_SEARCH_get0_serial().
π OSSL_STORE_SEARCH_BY_KEY_FINGERPRINT
search by exact match of key fingerprint. the key fingerprint itself is a string of bytes plus its length, plus the algorithm used to compute it. the digest can be left unspecified (NULL), and in that case the loader has to decide on a default digest and compare fingerprints accordingly. created with OSSL_STORE_SEARCH_by_key_fingerprint(); retrieve the actual fingerprint and its length with OSSL_STORE_SEARCH_get0_bytes(). the digest comes back via OSSL_STORE_SEARCH_get0_digest().
π OSSL_STORE_SEARCH_BY_ALIAS
search by match of an alias of some kind. the alias is a simple C string. created with OSSL_STORE_SEARCH_by_alias(), and the actual alias comes back with OSSL_STORE_SEARCH_get0_string().
π RETURN VALUES π
OSSL_STORE_SEARCH_by_name(),OSSL_STORE_SEARCH_by_issuer_serial(),OSSL_STORE_SEARCH_by_key_fingerprint(), andOSSL_STORE_SEARCH_by_alias()return anOSSL_STORE_SEARCHpointer on success, orNULLon failure. πOSSL_STORE_SEARCH_get_type()returns the criterion type of the givenOSSL_STORE_SEARCH. there is no error value β slay, one less thing to check.OSSL_STORE_SEARCH_get0_name()returns anX509_NAMEpointer on success, orNULLwhen the givenOSSL_STORE_SEARCHwas of a different type.OSSL_STORE_SEARCH_get0_serial()returns anASN1_INTEGERpointer on success, orNULLwhen the givenOSSL_STORE_SEARCHwas of a different type.OSSL_STORE_SEARCH_get0_bytes()returns aconst unsigned charpointer and sets*lengthto the string's length on success, orNULLwhen the givenOSSL_STORE_SEARCHwas of a different type.OSSL_STORE_SEARCH_get0_string()returns aconst charpointer on success, orNULLwhen the givenOSSL_STORE_SEARCHwas of a different type.OSSL_STORE_SEARCH_get0_digest()returns aconst EVP_MDpointer.NULLis a valid value here and means the store loader default will be used when applicable. not a bug, it's a feature π
π SEE ALSO π
ossl_store(7), OSSL_STORE_supports_search(3), OSSL_STORE_find(3)
π°οΈ HISTORY π°οΈ
OSSL_STORE_SEARCH, OSSL_STORE_SEARCH_by_name(), OSSL_STORE_SEARCH_by_issuer_serial(), OSSL_STORE_SEARCH_by_key_fingerprint(), OSSL_STORE_SEARCH_by_alias(), OSSL_STORE_SEARCH_free(), OSSL_STORE_SEARCH_get_type(), OSSL_STORE_SEARCH_get0_name(), OSSL_STORE_SEARCH_get0_serial(), OSSL_STORE_SEARCH_get0_bytes(), and OSSL_STORE_SEARCH_get0_string() were added in OpenSSL 1.1.1. vintage but still eating β¨
π COPYRIGHT π
Copyright 2018-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>.
okay that's the whole page bestie, you're officially an OSSL_STORE_SEARCH girlie now π«Ά go find your objects. this was OpenSSL 3.5.0, dated 2026-09-25, and that's the OSSL_STORE_SEARCH(3ossl) tea βπ
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms