EVP_PKEY_CTX_GET0_PKEY(3ossl)
π EVP_PKEY_CTX_GET0_PKEY π
okay so this is a page from the OpenSSL manual, bestie β specifically the 3ossl corner of it β and it's about the two lil getter functions that let you peek at the EVP_PKEY hanging out inside an EVP_PKEY_CTX. no cap, that's the whole vibe.
β¨ NAME β¨
EVP_PKEY_CTX_get0_pkey, EVP_PKEY_CTX_get0_peerkey β functions for accessing the EVP_PKEY associated with an EVP_PKEY_CTX
π SYNOPSIS π
#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);
like, that's it. two one-liners. we love a concise icon. π
π¦ DESCRIPTION π¦
EVP_PKEY_CTX_get0_pkey()
EVP_PKEY_CTX_get0_pkey() is used to access the EVP_PKEY associated with the given EVP_PKEY_CTX ctx.
and the EVP_PKEY you get back? it's the exact one that was used for creating the EVP_PKEY_CTX, via either EVP_PKEY_CTX_new(3) or EVP_PKEY_CTX_new_from_pkey(3). so it's not a copy, not a lookalike, it's the key. main character energy, truly. π
EVP_PKEY_CTX_get0_peerkey()
EVP_PKEY_CTX_get0_peerkey() is used to access the peer EVP_PKEY associated with the given EVP_PKEY_CTX ctx.
and the peer EVP_PKEY you obtain is the one that was set using either EVP_PKEY_derive_set_peer(3) or EVP_PKEY_derive_set_peer_ex(3). iykyk β the peer key is the other person in the convo, and you can only see them if somebody actually set them. π«Ά
π RETURN VALUES π
EVP_PKEY_CTX_get0_pkey()β returns theEVP_PKEYassociated with theEVP_PKEY_CTX, orNULLif it is not set.EVP_PKEY_CTX_get0_peerkey()β returns the peerEVP_PKEYassociated with theEVP_PKEY_CTX, orNULLif it is not set.
β οΈ okay important one, bestie β the returnedEVP_PKEYobjects are owned by theEVP_PKEY_CTX, and therefore should not explicitly be freed by the caller. not me watching you try toEVP_PKEY_free()something you don't own π put it down. it's not yours. it never was. π
also, these functions do not affect the EVP_PKEY reference count. they merely act as getter functions, and should be treated as such. the way that they're just... getters. no side effects. no refcount shenanigans. respectfully iconic. β¨
π SEE ALSO π
EVP_PKEY_CTX_new(3)EVP_PKEY_CTX_new_from_pkey(3)EVP_PKEY_derive_set_peer(3)EVP_PKEY_derive_set_peer_ex(3)
π COPYRIGHT π
Copyright 2022-2023 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>.
okay that's the whole page, periodt. π
and for the cute sign-off: this is OpenSSL 3.5.6, dated 2026-04-07, filed under EVP_PKEY_CTX_GET0_PKEY(3ossl) β go be a getter, not a freezer. π§ββοΈπ
π¦ 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