PROVIDER-SKEYMGMT(7ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’– PROVIDER-SKEYMGMT(7ossl) πŸ’–

okay bestie, so this is a page straight out of the OpenSSL manuals (the 7ossl girlies know) and it's all about provider-skeymgmt, aka the SKEYMGMT library <-> provider functions. no cap, it's a niche one but it's lowkey iconic. let's get into it 🫢


✨ NAME ✨

provider-skeymgmt β€” the SKEYMGMT library <-> provider functions πŸ’…


🌸 SYNOPSIS 🌸

#include <openssl/core_dispatch.h>

/*
 * None of these are actual functions, but are displayed like this for
 * the function signatures for functions that are offered as function
 * pointers in OSSL_DISPATCH arrays.
 */

/* Key object destruction */
void OSSL_FUNC_skeymgmt_free(void *keydata);

/* Key object import and export functions */
void *OSSL_FUNC_skeymgmt_import(void *provctx, int selection,
                                const OSSL_PARAM params[]);
int OSSL_FUNC_skeymgmt_export(void *keydata, int selection,
                              OSSL_CALLBACK *param_cb, void *cbarg);
void *OSSL_FUNC_skeymgmt_generate(void *provctx,
                                  const OSSL_PARAM params[]);
const OSSL_PARAM *OSSL_FUNC_skeymgmt_gen_settable_params(void *provctx);
const OSSL_PARAM *OSSL_FUNC_skeymgmt_imp_settable_params(void *provctx);
const char *OSSL_FUNC_skeymgmt_get_key_id(void *keydata);

like, before you panic β€” the comment is literally telling you these aren't real functions, they're just showing you the signatures of function pointers that live in OSSL_DISPATCH arrays. chill, it's giving documentation cosplay ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so the SKEYMGMT operation doesn't really have much public visibility in the OpenSSL libraries β€” it's more of an internal main-character situation that's designed to work with operations that use opaque symmetric key objects. iykyk πŸ”₯

here's the tea: the SKEYMGMT operation shares knowledge with the operations it works with, which means the SKEYMGMT and the algorithms that use it have to belong to the same provider. and don't worry β€” the OpenSSL libraries will make sure that they do. she's got it handled πŸ’…

the primary responsibility of the SKEYMGMT operation is to hold the provider side key data for the OpenSSL library EVP_SKEY structure. that's her job, that's her whole thing.

all the "functions" mentioned here get passed as function pointers between libcrypto and the provider in OSSL_DISPATCH(3) arrays via OSSL_ALGORITHM(3) arrays β€” and those arrays are returned by the provider's provider_query_operation() function (peep "Provider Functions" in provider-base(7) if you wanna go deeper).

every single one of these "functions" has a corresponding function type definition named OSSL_FUNC_{name}_fn, plus a helper function to grab the function pointer out of an OSSL_DISPATCH(3) element named OSSL_FUNC_{name}. cute, right? πŸŽ€

OSSL_DISPATCH(3) arrays are indexed by numbers that are provided as macros in openssl-core_dispatch.h(7), and the mapping is literally this:

OSSL_FUNC_skeymgmt_free                 OSSL_FUNC_SKEYMGMT_FREE

OSSL_FUNC_skeymgmt_import               OSSL_FUNC_SKEYMGMT_IMPORT
OSSL_FUNC_skeymgmt_export               OSSL_FUNC_SKEYMGMT_EXPORT

OSSL_FUNC_skeymgmt_generate             OSSL_FUNC_SKEYMGMT_GENERATE

OSSL_FUNC_skeymgmt_get_key_id           OSSL_FUNC_SKEYMGMT_GET_KEY_ID
OSSL_FUNC_skeymgmt_imp_settable_params  OSSL_FUNC_SKEYMGMT_IMP_SETTABLE_PARAMS
OSSL_FUNC_skeymgmt_gen_settable_params  OSSL_FUNC_SKEYMGMT_GEN_SETTABLE_PARAMS

and fun fact: the SKEYMGMT management is inspired by KEYMGMT but is simpler. she's the chill younger sister, periodt πŸ’œ

πŸ”‘ Key Objects

a key object is a collection of data for a symmetric key, and it's represented as keydata in this manual. yes, that's the nickname. we're on a first-name basis.

the exact contents of a key object are defined by the provider, and it's assumed that different operations in one and the same provider use the exact same structure to represent this collection of data. so like, a key object that's been created using the SKEYMGMT interface can be passed as-is to other algorithms from the same provider operations β€” for example OSSL_FUNC_mac_init_opaque() (check provider-mac(7) if you're curious 🌸).

with the export SKEYMGMT function, you can select a specific subset of data to handle, governed by the bits in a selection indicator. the bits are:

  • OSSL_SKEYMGMT_SELECT_SECRET_KEY β€” indicating that the secret key raw bytes in a key object should be included.
  • OSSL_SKEYMGMT_SELECT_PARAMETERS β€” indicating that the parameters in a key object should be included.

and combined selector bits are also defined for easier use, because why not treat yourself:

  • OSSL_SKEYMGMT_SELECT_ALL β€” indicating that everything in a key object should be included. the whole buffet, bestie πŸ“

the exact interpretation of those bits, or how they combine, is left to each function where you can specify a selector. so like, don't @ me β€” it's function-dependent.

πŸ’€ Destructing Function

OSSL_FUNC_skeymgmt_free() should free the passed keydata. that's it, that's the whole job. respectful.

🧚 Key Object Import and Export Functions

  • OSSL_FUNC_skeymgmt_import() β€” should import data into keydata with values taken from the OSSL_PARAM(3) array params. it allocates the keydata object itself (there is no separate allocation function β€” she does it all in one go, main character energy).
  • OSSL_FUNC_skeymgmt_imp_settable_params() β€” returns a list of parameters that can be provided to the OSSL_FUNC_skeymgmt_import() function. a little menu of options πŸ’…
  • OSSL_FUNC_skeymgmt_export() β€” should extract values indicated by selection from keydata, create an OSSL_PARAM(3) array with them, and call param_cb with that array as well as the given cbarg. heads up though: the passed OSSL_PARAM(3) array is transient and is freed upon the return from param_cb. so don't go holding onto it, bestie 😭

🌈 Key Object Generation Functions

  • OSSL_FUNC_skeymgmt_generate() β€” creates a new key according to the values taken from the OSSL_PARAM(3) array params. it allocates the keydata object. brand new key, fresh out the box ✨
  • OSSL_FUNC_skeymgmt_gen_settable_params() β€” returns a list of parameters that can be provided to the OSSL_FUNC_skeymgmt_generate() function.

⭐ Key Object Information functions

OSSL_FUNC_skeymgmt_get_key_id() returns a NUL-terminated string identifying the particular key. the returned string will be freed by a call to EVP_SKEY_free(), so callers need to copy it themselves if they want to preserve the value past the key lifetime. so like. copy it or lose it, babes πŸ™ˆ

the purpose of this function is providing a printable string that can help users access the specific key. the content of this string is provider-specific β€” so every provider gets to do her own thing with it, cute.

πŸŽ€ Common Import and Export Parameters

see OSSL_PARAM(3) for further details on the parameters structure.

common information parameters currently recognised by built-in skeymgmt algorithms are as follows:

  • "raw-bytes" (SKEY_PARAM_RAW_BYTES) <octet string> β€” the value represents symmetric key as a byte array.
  • "key-length" (SKEY_PARAM_KEY_LENGTH) <integer> β€” the value is the byte length of the given key.

πŸ‘‘ RETURN VALUES πŸ‘‘

  • OSSL_FUNC_skeymgmt_import() and OSSL_FUNC_skeymgmt_generate() return a pointer to an allocated object on success and NULL on error.
  • OSSL_FUNC_skeymgmt_export() returns 1 for success or 0 on error.
  • OSSL_FUNC_skeymgmt_get_key_id() returns a pointer to a 0-terminated string or NULL.
  • OSSL_FUNC_skeymgmt_gen_settable_params() and OSSL_FUNC_skeymgmt_imp_settable_params() return references to an array of OSSL_PARAM which can be NULL if there are no settable parameters. (empty menu, tragic, but valid πŸ’€)

πŸ”₯ SEE ALSO πŸ”₯

provider(7), EVP_SKEY(3), EVP_KEYMGMT(3) β€” go read those next, bestie, they're literally right there 🫢


🌸 HISTORY 🌸

the SKEYMGMT interface was introduced in OpenSSL 3.5. she's new here but she's already slaying πŸ’…


Copyright 2024-2025 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>.


aaand that's the whole page, bestie!! πŸŽ€ no skipping, no summarizing, every single detail intact and looking cute. this was OpenSSL 3.5.6, dated 2026-04-07, filed under PROVIDER-SKEYMGMT(7ossl) β€” mwah, go forth and slay your providers πŸ’œβœ¨πŸ§š

πŸ“¦ where this page comes from