EVP_SKEY(3ossl)
NAME π
Okay bestie, this is the EVP_SKEY(3ossl) page, and it's literally all about opaque symmetric key allocation and handling functions. The whole squad is: EVP_SKEY, EVP_SKEY_generate, EVP_SKEY_import, EVP_SKEY_import_raw_key, EVP_SKEY_up_ref, EVP_SKEY_export, EVP_SKEY_get0_raw_key, EVP_SKEY_get0_key_id, EVP_SKEY_get0_skeymgmt_name, EVP_SKEY_get0_provider_name, EVP_SKEY_free, EVP_SKEY_is_a, and EVP_SKEY_to_provider. Slay. π
SYNOPSIS β¨
#include <openssl/evp.h>
typedef evp_skey_st EVP_SKEY;
EVP_SKEY *EVP_SKEY_generate(OSSL_LIB_CTX *libctx, const char *skeymgmtname,
const char *propquery, const OSSL_PARAM *params);
EVP_SKEY *EVP_SKEY_import(OSSL_LIB_CTX *libctx, const char *skeymgmtname,
const char *propquery,
int selection, const OSSL_PARAM *params);
EVP_SKEY *EVP_SKEY_import_raw_key(OSSL_LIB_CTX *libctx, const char *skeymgmtname,
unsigned char *key, size_t len,
const char *propquery);
int EVP_SKEY_export(const EVP_SKEY *skey, int selection,
OSSL_CALLBACK *export_cb, void *export_cbarg);
int EVP_SKEY_get0_raw_key(const EVP_SKEY *skey, const unsigned char **key,
size_t *len);
const char *EVP_SKEY_get0_key_id(const EVP_SKEY *skey);
const char *EVP_SKEY_get0_skeymgmt_name(const EVP_SKEY *skey);
const char *EVP_SKEY_get0_provider_name(const EVP_SKEY *skey);
int EVP_SKEY_up_ref(EVP_SKEY *key);
void EVP_SKEY_free(EVP_SKEY *key);
int EVP_SKEY_is_a(const EVP_SKEY *skey, const char *name);
EVP_SKEY *EVP_SKEY_to_provider(EVP_SKEY *skey, OSSL_LIB_CTX *libctx,
OSSL_PROVIDER *prov, const char *propquery);
DESCRIPTION π¦
So, EVP_SKEY is a generic structure that holds symmetric keys as opaque objects. The keys themselves are often called the "internal key", and they're handled by providers using EVP_SKEYMGMT(3). Periodt.
Conceptually, an EVP_SKEY internal key may hold a symmetric key, and along with that, key parameters if the key type requires them. It's giving very organized little key container energy. π
EVP_SKEY_generate()β creates a newEVP_SKEYobject and initializes it according to theparamsargument. Fresh key, who dis. β¨EVP_SKEY_import()β allocates an emptyEVP_SKEYstructure which is used by OpenSSL to store symmetric keys, assigns theEVP_SKEYMGMTobject associated with the key, and initializes the object from theparamsargument. Very "come through, imported key" of it. πEVP_SKEY_import_raw_key()β a helper that creates anEVP_SKEYobject containing the raw byte representation of the symmetric keys from the bufferkeyhaving lengthlen. Theskeymgmtnamedefines the name of the targetEVP_SKEYMGMTfor the newly created key. Raw key bestie, no cap. π«ΆEVP_SKEY_export()β extracts values from a keyskeyusing theselection.selectionis described below. It uses a callbackexport_cbthat gets passed the value ofexport_cbarg. Seeopenssl-core.h(7)for more information about the callback. Note that theOSSL_PARAM(3)array that is passed to the callback is not persistent after the callback returns. Like, it does not stick around, bestie. πEVP_SKEY_get0_raw_key()β returns a pointer to a raw key bytes to the passed address and sets the keylen. The returned address is managed by the internal key management and shouldn't be freed explicitly. The operation can fail when the underlying key management doesn't support export of the secret key. Do not free it yourself, I'm begging. πEVP_SKEY_get0_key_id()β returns a NUL-terminated string providing some human-readable identifier of the key if provided by the underlying key management. The pointer becomes invalid after freeing theEVP_SKEYobject. So don't be using it after the key is gone, okay? πEVP_SKEY_get0_skeymgmt_name()andEVP_SKEY_get0_provider_name()β return the names of the associatedEVP_SKEYMGMTobject and its provider correspondingly. Name reveal, but make it cryptographic. πEVP_SKEY_up_ref()β increments the reference count ofkey. Ref count go brrr. π₯EVP_SKEY_free()β decrements the reference count ofkeyand, if the reference count is zero, frees it. IfkeyisNULL, nothing is done. Very chill about it too. πEVP_SKEY_is_a()β checks if the key type ofskeyisname. Identity check, but for keys. βEVP_SKEY_to_provider()β simplifies the task of importing a skey into a different provider identified byprov. IfprovisNULL, the default provider for the key type identified viaskeyis used. Provider glow-up, lowkey iconic. π
Selections π
The following constants can be used for selection:
OSSL_SKEYMGMT_SELECT_SECRET_KEYβ Only the raw key representation will be selected. Secret key only, bestie. πOSSL_SKEYMGMT_SELECT_PARAMETERSβ Only the key parameters will be selected. This includes optional key parameters. Parameter girlies, this is your moment. πΈOSSL_SKEYMGMT_SELECT_ALLβ All parameters will be selected. The whole menu, not just the appetizer. β¨
NOTES π§
The EVP_SKEY structure is used by various OpenSSL functions which require a general symmetric key without reference to any particular algorithm. It's the general-purpose bestie of symmetric keys. π¦
The EVP_SKEY_to_provider() function will fail and return NULL if the origin key skey cannot be exported from its provider. Like, if it can't leave the provider, it can't leave. Periodt. π
RETURN VALUES π
EVP_SKEY_generate(),EVP_SKEY_import()andEVP_SKEY_import_raw_key()return either the newly allocatedEVP_SKEYstructure orNULLif an error occurred. New key or no key, no in-between. πEVP_SKEY_get0_key_id()returns either a valid pointer orNULL. Simple as that. πEVP_SKEY_up_ref()returns1for success and0on failure. Ref count success slay. β¨EVP_SKEY_export()andEVP_SKEY_get0_raw_key()return1for success and0on failure. Honestly? Fair. πEVP_SKEY_get0_skeymgmt_name()andEVP_SKEY_get0_provider_name()return the names of the associatedEVP_SKEYMGMTobject and its provider correspondingly. Names, delivered. πEVP_SKEY_is_a()returns1ifskeyhas the key typename, otherwise0. Identity confirmed or denied. βEVP_SKEY_to_provider()returns a newEVP_SKEYsuitable for operations with theprovprovider orNULLin case of failure. Provider-ready key or absolutely nothing. π«Ά
SEE ALSO π
EVP_SKEYMGMT(3), provider(7), OSSL_PARAM(3)
HISTORY π°οΈ
The EVP_SKEY API and functions EVP_SKEY_export(), EVP_SKEY_free(), EVP_SKEY_get0_raw_key(), EVP_SKEY_import(), EVP_SKEY_import_raw_key(), EVP_SKEY_up_ref(), EVP_SKEY_generate(), EVP_SKEY_get0_key_id(), EVP_SKEY_get0_provider_name(), EVP_SKEY_get0_skeymgmt_name(), EVP_SKEY_is_a(), EVP_SKEY_to_provider() were introduced in OpenSSL 3.5. Historic. Iconic. New in 3.5. π
COPYRIGHT π
Copyright 2025-2026 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>. Legal bestie has entered the chat. π«Ά
And that's the whole vibe check, bestie: this page is from OpenSSL 3.5.6, dated 2026-04-07, and it's the EVP_SKEY(3ossl) manual page signing off. Stay opaque, stay symmetric, and don't free stuff you don't own. πβ¨π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms