1=pod 2 3=head1 NAME 4 5EVP_KEYMGMT, 6EVP_KEYMGMT_fetch, 7EVP_KEYMGMT_up_ref, 8EVP_KEYMGMT_free, 9EVP_KEYMGMT_get0_provider, 10EVP_KEYMGMT_is_a, 11EVP_KEYMGMT_get0_description, 12EVP_KEYMGMT_get0_name, 13EVP_KEYMGMT_do_all_provided, 14EVP_KEYMGMT_names_do_all, 15EVP_KEYMGMT_gettable_params, 16EVP_KEYMGMT_settable_params, 17EVP_KEYMGMT_gen_gettable_params, 18EVP_KEYMGMT_gen_settable_params 19- EVP key management routines 20 21=head1 SYNOPSIS 22 23 #include <openssl/evp.h> 24 25 typedef struct evp_keymgmt_st EVP_KEYMGMT; 26 27 EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, 28 const char *properties); 29 int EVP_KEYMGMT_up_ref(EVP_KEYMGMT *keymgmt); 30 void EVP_KEYMGMT_free(EVP_KEYMGMT *keymgmt); 31 const OSSL_PROVIDER *EVP_KEYMGMT_get0_provider(const EVP_KEYMGMT *keymgmt); 32 int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name); 33 const char *EVP_KEYMGMT_get0_name(const EVP_KEYMGMT *keymgmt); 34 const char *EVP_KEYMGMT_get0_description(const EVP_KEYMGMT *keymgmt); 35 36 void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx, 37 void (*fn)(EVP_KEYMGMT *keymgmt, void *arg), 38 void *arg); 39 int EVP_KEYMGMT_names_do_all(const EVP_KEYMGMT *keymgmt, 40 void (*fn)(const char *name, void *data), 41 void *data); 42 const OSSL_PARAM *EVP_KEYMGMT_gettable_params(const EVP_KEYMGMT *keymgmt); 43 const OSSL_PARAM *EVP_KEYMGMT_settable_params(const EVP_KEYMGMT *keymgmt); 44 const OSSL_PARAM *EVP_KEYMGMT_gen_settable_params(const EVP_KEYMGMT *keymgmt); 45 const OSSL_PARAM *EVP_KEYMGMT_gen_gettable_params(const EVP_KEYMGMT *keymgmt); 46 47=head1 DESCRIPTION 48 49B<EVP_KEYMGMT> is a method object that represents key management 50implementations for different cryptographic algorithms. 51This method object provides functionality to have providers import key 52material from the outside, as well as export key material to the 53outside. 54Most of the functionality can only be used internally and has no 55public interface, this object is simply passed into other functions 56when needed. 57 58EVP_KEYMGMT_fetch() looks for an algorithm within the provider that 59has been loaded into the B<OSSL_LIB_CTX> given by I<ctx>, having the 60name given by I<algorithm> and the properties given by I<properties>. 61 62EVP_KEYMGMT_up_ref() increments the reference count for the given 63B<EVP_KEYMGMT> I<keymgmt>. 64 65EVP_KEYMGMT_free() decrements the reference count for the given 66B<EVP_KEYMGMT> I<keymgmt>, and when the count reaches zero, frees it. 67If the argument is NULL, nothing is done. 68 69EVP_KEYMGMT_get0_provider() returns the provider that has this particular 70implementation. 71 72EVP_KEYMGMT_is_a() checks if I<keymgmt> is an implementation of an 73algorithm that's identifiable with I<name>. 74 75EVP_KEYMGMT_get0_name() returns the algorithm name from the provided 76implementation for the given I<keymgmt>. Note that the I<keymgmt> may have 77multiple synonyms associated with it. In this case the first name from the 78algorithm definition is returned. Ownership of the returned string is 79retained by the I<keymgmt> object and should not be freed by the caller. 80 81EVP_KEYMGMT_names_do_all() traverses all names for the I<keymgmt>, and 82calls I<fn> with each name and I<data>. 83 84EVP_KEYMGMT_get0_description() returns a description of the I<keymgmt>, meant 85for display and human consumption. The description is at the discretion 86of the I<keymgmt> implementation. 87 88EVP_KEYMGMT_do_all_provided() traverses all key keymgmt implementations by 89all activated providers in the library context I<libctx>, and for each 90of the implementations, calls I<fn> with the implementation method and 91I<data> as arguments. 92 93EVP_KEYMGMT_gettable_params() and EVP_KEYMGMT_settable_params() return a 94constant L<OSSL_PARAM(3)> array that describes the names and types of key 95parameters that can be retrieved or set. 96EVP_KEYMGMT_gettable_params() is used by L<EVP_PKEY_gettable_params(3)>. 97 98EVP_KEYMGMT_gen_gettable_params() and EVP_KEYMGMT_gen_settable_params() return a 99constant L<OSSL_PARAM(3)> array that describes the names and types of key 100generation parameters that can be retrieved or set via 101L<EVP_PKEY_CTX_get_params(3)> or L<EVP_PKEY_CTX_set_params(3)> respectively. 102 103=head1 NOTES 104 105EVP_KEYMGMT_fetch() may be called implicitly by other fetching 106functions, using the same library context and properties. 107Any other API that uses keys will typically do this. 108 109=head1 RETURN VALUES 110 111EVP_KEYMGMT_fetch() returns a pointer to the key management 112implementation represented by an EVP_KEYMGMT object, or NULL on 113error. 114 115EVP_KEYMGMT_up_ref() returns 1 on success, or 0 on error. 116 117EVP_KEYMGMT_names_do_all() returns 1 if the callback was called for all 118names. A return value of 0 means that the callback was not called for any names. 119 120EVP_KEYMGMT_free() doesn't return any value. 121 122EVP_KEYMGMT_get0_provider() returns a pointer to a provider object, or NULL 123on error. 124 125EVP_KEYMGMT_is_a() returns 1 of I<keymgmt> was identifiable, 126otherwise 0. 127 128EVP_KEYMGMT_get0_name() returns the algorithm name, or NULL on error. 129 130EVP_KEYMGMT_get0_description() returns a pointer to a description, or NULL if 131there isn't one. 132 133EVP_KEYMGMT_gettable_params(), EVP_KEYMGMT_settable_params(), 134EVP_KEYMGMT_gen_gettable_params() and EVP_KEYMGMT_gen_settable_params() 135return a constant L<OSSL_PARAM(3)> array or NULL on error. 136 137=head1 SEE ALSO 138 139L<EVP_MD_fetch(3)>, L<OSSL_LIB_CTX(3)> 140 141=head1 HISTORY 142 143The function EVP_KEYMGMT_gen_gettable_params() was added in OpenSSL 3.4.0 144All other functions described here were added in OpenSSL 3.0. 145 146=head1 COPYRIGHT 147 148Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. 149 150Licensed under the Apache License 2.0 (the "License"). You may not use 151this file except in compliance with the License. You can obtain a copy 152in the file LICENSE in the source distribution or at 153L<https://www.openssl.org/source/license.html>. 154 155=cut 156