EVP_PKEY_TODATA(3ossl)

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

πŸ’… 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 key pkey using the selection. selection is described in "Selections" in EVP_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 to EVP_PKEY_todata() but uses a callback export_cb that gets passed the value of export_cbarg. see openssl-core.h(7) for more information about the callback. 🧚
⚠️ okay this part is important bestie, do not skip it: note that the OSSL_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 use EVP_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() and EVP_PKEY_export() return 1 for success and 0 for 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-KEM and SLH-DSA was added in OpenSSL 3.5.

glow-up timeline, fr fr ⭐


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