EVP_PKEY_CTX_get0_pkey(3ssl)

EVP_PKEY_CTX_get0_pkey3ssl

Functions for accessing the evp_pkey associated with an evp_pkey_ctx

Usage

 #include <openssl/evp.h>
 EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);
 EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);

Overview

EVP_PKEY_CTX_get0_pkey() is used to access the EVP_PKEY associated with the given EVP_PKEY_CTX ctx. The EVP_PKEY obtained is the one used for creating the EVP_PKEY_CTX using either EVP_PKEY_CTX_new(3) or EVP_PKEY_CTX_new_from_pkey(3).

EVP_PKEY_CTX_get0_peerkey() is used to access the peer EVP_PKEY associated with the given EVP_PKEY_CTX ctx. The peer EVP_PKEY obtained is the one set using either EVP_PKEY_derive_set_peer(3) or EVP_PKEY_derive_set_peer_ex(3).

Return values

EVP_PKEY_CTX_get0_pkey() returns the EVP_PKEY associated with the EVP_PKEY_CTX or NULL if it is not set.

EVP_PKEY_CTX_get0_peerkey() returns the peer EVP_PKEY associated with the EVP_PKEY_CTX or NULL if it is not set.

The returned EVP_PKEY objects are owned by the EVP_PKEY_CTX, and therefore should not explicitly be freed by the caller.

These functions do not affect the EVP_PKEY reference count. They merely act as getter functions, and should be treated as such.

Releases

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

  1. 12
  2. 13
  3. Arch

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