EVP_KEYMGMT(3ossl)
π EVP_KEYMGMT β the key management glow-up (OpenSSL, EVP_KEYMGMT(3ossl)) π
okay bestie, sit down, hydrate, because we're talking about key management method objects and it's genuinely so much cooler than it sounds. this whole page is the manual for EVP_KEYMGMT and its little friend group: EVP_KEYMGMT_fetch, EVP_KEYMGMT_up_ref, EVP_KEYMGMT_free, EVP_KEYMGMT_get0_provider, EVP_KEYMGMT_is_a, EVP_KEYMGMT_get0_description, EVP_KEYMGMT_get0_name, EVP_KEYMGMT_do_all_provided, EVP_KEYMGMT_names_do_all, EVP_KEYMGMT_gettable_params, EVP_KEYMGMT_settable_params, EVP_KEYMGMT_gen_gettable_params, EVP_KEYMGMT_gen_settable_params β aka the EVP key management routines. let's go π¦
β¨ SYNOPSIS β¨
like, here's the whole cast list in code form, no notes:
#include <openssl/evp.h>
typedef struct evp_keymgmt_st EVP_KEYMGMT;
EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties);
int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt);
void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt);
const OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt);
int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name);
const char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt);
const char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt);
void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
void *arg);
int EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt,
void (*fn)(const char *name, void *data),
void *data);
const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt);
const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt);
const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt);
const OSSL_PARAM *EVP_KEYMGMT_gen_gettable_params(const EVP_KEYMGMT *keymgmt);
πΈ DESCRIPTION πΈ
okay so EVP_KEYMGMT is a method object that represents key management implementations for all the different cryptographic algorithms. think of it as the main character that lets providers import key material from the outside and also export key material to the outside. but here's the tea: most of this functionality is internal-only and has no public interface at all β this object basically just gets passed into other functions whenever they need it. it's giving backstage pass. π
EVP_KEYMGMT_fetch()β goes looking for an algorithm inside the provider that's been loaded into theOSSL_LIB_CTXyou passed asctx, matching the name inalgorithmand the properties inproperties. π΅οΈβοΈEVP_KEYMGMT_up_ref()β bumps the reference count on the givenEVP_KEYMGMTkeymgmt. up up up β¬οΈEVP_KEYMGMT_free()β drops the reference count on the givenEVP_KEYMGMTkeymgmt, and when that count hits zero, it frees it. and if the argument isNULL? nothing happens, no drama, no tears. πEVP_KEYMGMT_get0_provider()β hands you back the provider that owns this particular implementation. πEVP_KEYMGMT_is_a()β vibe checks whetherkeymgmtis an implementation of an algorithm that's identifiable withname.EVP_KEYMGMT_get0_name()β returns the algorithm name from the provided implementation for the givenkeymgmt. heads up though: akeymgmtcan have multiple synonyms attached to it, and in that case you get the first name from the algorithm definition. ownership of that returned string stays with thekeymgmtobject, so do NOT free it yourself, bestie, that's not your string. πEVP_KEYMGMT_names_do_all()β walks through every single name for thekeymgmtand callsfnwith eachnameanddata. it's giving roll call. πEVP_KEYMGMT_get0_description()β returns a description of thekeymgmt, meant for display and human consumption. what that description actually says is entirely at the discretion of thekeymgmtimplementation. β¨EVP_KEYMGMT_do_all_provided()β traverses all keykeymgmtimplementations across all activated providers in the library contextlibctx, and for each one it callsfnwith the implementation method anddataas arguments.EVP_KEYMGMT_gettable_params()andEVP_KEYMGMT_settable_params()β return a constantOSSL_PARAM(3)array describing the names and types of key parameters that can be retrieved or set. also,EVP_KEYMGMT_gettable_params()is the one used byEVP_PKEY_gettable_params(3). π«ΆEVP_KEYMGMT_gen_gettable_params()andEVP_KEYMGMT_gen_settable_params()β return a constantOSSL_PARAM(3)array describing the names and types of key generation parameters that can be retrieved or set viaEVP_PKEY_CTX_get_params(3)orEVP_PKEY_CTX_set_params(3)respectively. yes, respectively. we love a paired set. π
π NOTES π
EVP_KEYMGMT_fetch() might get called implicitly by other fetching functions, using the exact same library context and properties. honestly, any other API that touches keys will typically do this too. so if you're like "wait, who called fetch??" β it was the group chat, not you. π
π« RETURN VALUES π«
EVP_KEYMGMT_fetch()β returns a pointer to the key management implementation (as anEVP_KEYMGMTobject), orNULLon error.EVP_KEYMGMT_up_ref()β returns1on success, or0on error.EVP_KEYMGMT_names_do_all()β returns1if the callback was called for all names. a return value of0means the callback was not called for any names.EVP_KEYMGMT_free()β returns absolutely nothing. doesn't return any value. periodt. πEVP_KEYMGMT_get0_provider()β returns a pointer to a provider object, orNULLon error.EVP_KEYMGMT_is_a()β returns1ifkeymgmtwas identifiable, otherwise0.EVP_KEYMGMT_get0_name()β returns the algorithm name, orNULLon error.EVP_KEYMGMT_get0_description()β returns a pointer to a description, orNULLif there isn't one.EVP_KEYMGMT_gettable_params(),EVP_KEYMGMT_settable_params(),EVP_KEYMGMT_gen_gettable_params()andEVP_KEYMGMT_gen_settable_params()β return a constantOSSL_PARAM(3)array, orNULLon error. β¨
π¦ SEE ALSO π¦
EVP_MD_fetch(3), OSSL_LIB_CTX(3)
go read those next, iykyk. π
π HISTORY π
EVP_KEYMGMT_gen_gettable_params()was added in OpenSSL 3.4.0 β the new girl on the block. π- All other functions described here were added in OpenSSL 3.0 β the OGs.
π COPYRIGHT π
Copyright 2019-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, you ate it, no crumbs left π β this was EVP_KEYMGMT(3ossl) from OpenSSL 3.5.9, dated 2026-09-29. go forth and manage those keys, bestie, you're literally the main character πβ¨π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms