EVP_KEYMGMT(3SSL)

πŸ’– EVP_KEYMGMT πŸ’–

okay bestie come CLOSE. this is EVP_KEYMGMT, live from the OpenSSL manual pages, and she's the key management method object of your dreams. multiple functions, one whole squad: EVP_KEYMGMT, 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. all of them are EVP key management routines. the whole girlband. let's go πŸ’…


✨ SYNOPSIS ✨

#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 🌸

EVP_KEYMGMT is a method object that represents key management implementations for different cryptographic algorithms. iconic behavior. this method object provides functionality to have providers import key material from the outside, and also to export key material to the outside (the way she moves between the group chat and the real world, honestly). most of this functionality can only be used internally and has no public interface β€” the object is simply passed into other functions when needed. yeah she's lowkey backstage crew with main character energy πŸŽ€

  • EVP_KEYMGMT_fetch() β€” hunts for an algorithm inside the provider that's been loaded into the OSSL_LIB_CTX given by ctx, that has the name given by algorithm and the properties given by properties. it's giving "looking for that one specific girl in the crowd".
  • EVP_KEYMGMT_up_ref() β€” increments the reference count for the given EVP_KEYMGMT keymgmt. more friends, more refs, no cap ✨
  • EVP_KEYMGMT_free() β€” decrements the reference count for the given EVP_KEYMGMT keymgmt, and when that count hits zero, frees it. and if the argument is NULL? nothing is done. she simply does not perceive it. πŸ™ˆ
  • EVP_KEYMGMT_get0_provider() β€” returns the provider that has this particular implementation. who's her provider? everybody wants to know πŸ’…
  • EVP_KEYMGMT_is_a() β€” checks if keymgmt is an implementation of an algorithm that's identifiable with name. vibe check on the algorithm name, basically.
  • EVP_KEYMGMT_get0_name() β€” returns the algorithm name from the provided implementation for the given keymgmt. heads up bestie: the keymgmt may have multiple synonyms associated with it, and in that case the first name from the algorithm definition is returned. also ownership of the returned string is retained by the keymgmt object and should NOT be freed by the caller β€” do not touch, do not free(), she is not yours to release 🫢
  • EVP_KEYMGMT_names_do_all() β€” traverses all names for the keymgmt, and calls fn with each name and data. a whole hallway walk-through of every alias she goes by.
  • EVP_KEYMGMT_get0_description() β€” returns a description of the keymgmt, meant for display and human consumption. the description is at the discretion of the keymgmt implementation β€” so it's her own words, her own bios, and honestly slay.
  • EVP_KEYMGMT_do_all_provided() β€” traverses all key keymgmt implementations by all activated providers in the library context libctx, and for each of the implementations, calls fn with the implementation method and data as arguments. every single one, no skips. periodt.
  • EVP_KEYMGMT_gettable_params() and EVP_KEYMGMT_settable_params() β€” return a constant OSSL_PARAM(3) array that describes the names and types of key parameters that can be retrieved or set. and EVP_KEYMGMT_gettable_params() is the one used by EVP_PKEY_gettable_params(3). 🌈
  • EVP_KEYMGMT_gen_gettable_params() and EVP_KEYMGMT_gen_settable_params() β€” return a constant OSSL_PARAM(3) array describing the names and types of key generation parameters that can be retrieved or set via EVP_PKEY_CTX_get_params(3) or EVP_PKEY_CTX_set_params(3) respectively. get-vibes and set-vibes, matched set πŸ’–

⭐ NOTES ⭐

EVP_KEYMGMT_fetch() may be called implicitly by other fetching functions, using the same library context and properties. any other API that uses keys will typically do this. so like… you might not even be the one calling her, and she still shows up. she's always there. 😭


πŸ‘‘ RETURN VALUES πŸ‘‘

  • EVP_KEYMGMT_fetch() returns a pointer to the key management implementation represented by an EVP_KEYMGMT object, or NULL on error.
  • EVP_KEYMGMT_up_ref() returns 1 on success, or 0 on error.
  • EVP_KEYMGMT_names_do_all() returns 1 if the callback was called for all names. a return value of 0 means that the callback was not called for any names πŸ’€
  • EVP_KEYMGMT_free() doesn't return any value. she simply leaves, no goodbyes, no return type. nothing. void. ghosted fr fr.
  • EVP_KEYMGMT_get0_provider() returns a pointer to a provider object, or NULL on error.
  • EVP_KEYMGMT_is_a() returns 1 if keymgmt was identifiable, otherwise 0. βœ… or ❌, no in-between.
  • EVP_KEYMGMT_get0_name() returns the algorithm name, or NULL on error.
  • EVP_KEYMGMT_get0_description() returns a pointer to a description, or NULL if there isn't one.
  • EVP_KEYMGMT_gettable_params(), EVP_KEYMGMT_settable_params(), EVP_KEYMGMT_gen_gettable_params() and EVP_KEYMGMT_gen_settable_params() return a constant OSSL_PARAM(3) array or NULL on error.

πŸ¦‹ SEE ALSO πŸ¦‹

EVP_MD_fetch(3), OSSL_LIB_CTX(3)

go read those next bestie, it's giving required reading ✨


πŸŽ€ HISTORY πŸŽ€

the function EVP_KEYMGMT_gen_gettable_params() was added in OpenSSL 3.4.0. all other functions described here were added in OpenSSL 3.0. so yeah, the gen one is the baby of the family, born late but still iconic πŸ’œ


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>.


and that's the whole page, bestie!! no cap, every single flag, pointer, return value and caveat is right there where you left it, we did not lose a single detail πŸ’–

OpenSSL 4.0.3 β€” dated 2026-09-29 β€” EVP_KEYMGMT(3SSL) πŸŽ€βœ¨πŸ¦‹πŸ’…πŸ§šπŸŒΈπŸ“πŸŒˆβ­πŸ‘‘πŸ’€πŸ«ΆπŸ™ˆπŸ’œπŸ”₯

πŸ“¦ where this page comes from