EVP_PKEY_todata(3ssl)

EVP_PKEY_todata3ssl

Functions to return keys as an array of key parameters

Usage

 #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);

Overview

The functions described here are used to extract EVP_PKEY key values as an array of OSSL_PARAM(3).

EVP_PKEY_todata() extracts values from a key pkey using the selection. selection is described in "Selections" in EVP_PKEY_fromdata(3). OSSL_PARAM_free(3) should be used to free the returned parameters in *params.

EVP_PKEY_export() is 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. Note that the OSSL_PARAM(3) array that is passed to the callback is not persistent after the callback returns. The user must preserve the items of interest, or use EVP_PKEY_todata() if persistence is required.

Notes

These functions only work with key management methods coming from a provider. This is the mirror function to EVP_PKEY_fromdata(3).

LMS support is disabled by default at compile-time. To enable, specify the enable-lms build configuration option.

Return values

EVP_PKEY_todata() and EVP_PKEY_export() return 1 for success and 0 for failure.

Releases

3 releases since Debian 12 (Bookworm); the text changed 2 times.

  1. 12
  2. 13
  3. Arch

History

These functions were added in OpenSSL 3.0.

Support for ML-DSA, ML-KEM and SLH-DSA was added in OpenSSL 3.5.

Support for LMS was added in OpenSSL 3.6.

From openssl 3.6.5-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.