EVP_PKEY_CTX_GET0_PKEY(3SSL)
π EVP_PKEY_CTX_GET0_PKEY π
okay bestie so you're in the OpenSSL 3SSL manual, section 3, and today's hyperfixation is EVP_PKEY_CTX_get0_pkey and EVP_PKEY_CTX_get0_peerkey β the two lil functions for peeking at the EVP_PKEY that's vibing inside your EVP_PKEY_CTX. they're getters. they literally just look. no cap. π
β¨ 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);
πΈ DESCRIPTION πΈ
EVP_PKEY_CTX_get0_pkey() is how you go get the EVP_PKEY that's attached to a given EVP_PKEY_CTX ctx. and like, which EVP_PKEY is it? it's the one you used to make that EVP_PKEY_CTX in the first place, using either EVP_PKEY_CTX_new(3) or EVP_PKEY_CTX_new_from_pkey(3). so it's giving "the origin story key". π±
EVP_PKEY_CTX_get0_peerkey() is the other one β it grabs the peer EVP_PKEY attached to the given EVP_PKEY_CTX ctx. and the peer key it hands you is the one that got set with either EVP_PKEY_derive_set_peer(3) or EVP_PKEY_derive_set_peer_ex(3). it's giving "the plus-one key". π«Ά
π 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.
β οΈ bestie listen. the returnedEVP_PKEYobjects are owned by theEVP_PKEY_CTX. so do not go freeing them yourself, okay?? that's not your key tofree. let the ctx handle it. π
these functions do not touch the EVP_PKEY reference count. they are merely getter functions, and they should be treated as such. that's it. that's the whole personality. it's giving "look, don't touch". periodt. π
π 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>.
<div align="center">β¨ Version 4.0.3 β dated 2026-09-29 β and that's the EVP_PKEY_CTX_GET0_PKEY(3SSL) page, bestie π go forth and getter responsibly π¦π</div>
okay love u bye, drink water, and remember: getters don't own anything, that's the whole lesson πβ
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms