EVP_PKEY_TODATA(3ossl)
π EVP_PKEY_TODATA π
okay so bestie, this is the 3ossl manual page for EVP_PKEY_todata and EVP_PKEY_export β the two functions that hand you your key's values as a whole array of OSSL_PARAM(3). literally key-to-data pipeline, no cap β¨
πΈ NAME πΈ
EVP_PKEY_todata, EVP_PKEY_export β functions to return keys as an array of key parameters π
π¦ SYNOPSIS π¦
#include <openssl/evp.h>
int EVP_PKEY_todata(const EVP_PKEY *pkey, int selection, OSSL_PARAM **params);
int EVP_PKEY_export(const EVP_PKEY *pkey, int selection,
OSSL_CALLBACK *export_cb, void *export_cbarg);
she's giving "short and powerful" π
β¨ DESCRIPTION β¨
so the functions described here are used to extract EVP_PKEY key values as an array of OSSL_PARAM(3). that's the whole vibe. you got a key, you want the raw deets inside it, this is the girlies that do that π«Ά
EVP_PKEY_todata()β extracts values from a keypkeyusing theselection.selectionis described in "Selections" inEVP_PKEY_fromdata(3)(go read it, iykyk). and listen π:OSSL_PARAM_free(3)should be used to free the returned parameters in*params. that's your job, she's not gonna do it for you, so don't leave her hanging.EVP_PKEY_export()β similar toEVP_PKEY_todata()but uses a callbackexport_cbthat gets passed the value ofexport_cbarg. seeopenssl-core.h(7)for more information about the callback. π§
β οΈ okay this part is important bestie, do not skip it: note that theOSSL_PARAM(3)array that is passed to the callback is not persistent after the callback returns. like, she leaves the party and takes the data with her π the user must preserve the items of interest, or useEVP_PKEY_todata()if persistence is required. periodt.
π NOTES π
these functions only work with key management methods coming from a provider. no providers, no party, sorry not sorry π
also, this is the mirror function to EVP_PKEY_fromdata(3). like, fromdata builds the key and todata unpacks it β they're literally each other's main character energy π
π RETURN VALUES π
EVP_PKEY_todata()andEVP_PKEY_export()return1for success and0for failure.
that's it. 1 slays, 0 does not. π₯
π SEE ALSO π
OSSL_PARAM(3), openssl-core.h(7), EVP_PKEY_fromdata(3), EVP_PKEY-RSA(7), EVP_PKEY-EC(7), EVP_PKEY-DSA(7), EVP_PKEY-ED25519(7) EVP_PKEY-ED448(7), EVP_PKEY-DH(7), EVP_PKEY-X25519(7), EVP_PKEY-X448(7), EVP_PKEY-ML-DSA(7), EVP_PKEY-ML-KEM(7), EVP_PKEY-SLH-DSA(7).
(the whole friend group, honestly π)
π HISTORY π
- these functions were added in OpenSSL
3.0. - support for
ML-DSA,ML-KEMandSLH-DSAwas added in OpenSSL3.5.
glow-up timeline, fr fr β
π COPYRIGHT π
Copyright 2021-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>.
and that's the whole page bestie! πΈ this cutie was brought to you by the 3.5.6 release, dated 2026-04-07, answering to the name EVP_PKEY_TODATA(3ossl) β mwah, go forth and free your params π
π«Ά
π¦ 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