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