EVP_PKEY_SET_TYPE(3ossl)
π EVP_PKEY_SET_TYPE π
okay so this is the OpenSSL manual page for EVP_PKEY_set_type, EVP_PKEY_set_type_str, and EVP_PKEY_set_type_by_keymgmt β yes that's a mouthful, no you don't have to say it out loud, bestie π«Ά
β¨ NAME β¨
EVP_PKEY_set_type, EVP_PKEY_set_type_str, EVP_PKEY_set_type_by_keymgmt β functions to change the EVP_PKEY type, literally that's their whole job π«
πΈ SYNOPSIS πΈ
#include <openssl/evp.h>
int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
int EVP_PKEY_set_type_by_keymgmt(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt);
π¦ DESCRIPTION π¦
okay so all three of these functions are lowkey the same vibe in one big way: they clear all the previous key data and methods from pkey, and reset it to be the type of key given by the different arguments. like, fresh start, new you, main character energy β¨
and bestie, ifpkeyisNULL, these functions will still return the same return values as if it wasn't. iconic behavior honestly π
EVP_PKEY_set_type()β initialisespkeyto contain an internal legacy key. when it does this, it finds aEVP_PKEY_ASN1_METHOD(3)corresponding totype, and associatespkeywith the findings π and it is an error if noEVP_PKEY_ASN1_METHOD(3)could be found fortype.EVP_PKEY_set_type_str()β also initialisespkeyto contain an internal legacy key. when it does this, it finds aEVP_PKEY_ASN1_METHOD(3)corresponding tostrthat has then lengthlen, and associatespkeywith the findings π and it is an error if noEVP_PKEY_ASN1_METHOD(3)could be found fortype.
for both EVP_PKEY_set_type() and EVP_PKEY_set_type_str(), pkey gets a numeric type, which can be retrieved with EVP_PKEY_get_id(3) π this numeric type is taken from the EVP_PKEY_ASN1_METHOD(3) that was found, and is equal to or closely related to type in the case of EVP_PKEY_set_type(), or related to str in the case of EVP_PKEY_set_type_str().
EVP_PKEY_set_type_by_keymgmt()β initialisespkeyto contain an internal provider side key π§ when it does this, it associatespkeywithkeymgmt. for keys initialised like this, the numeric type retrieved withEVP_PKEY_get_id(3)will always beEVP_PKEY_NONE. not sometimes. always. periodt π
β RETURN VALUES β
all functions described here return 1 if successful, or 0 on error. that's it, that's the whole section, slay π
π₯ SEE ALSO π₯
EVP_PKEY_assign(3), EVP_PKEY_get_id(3), EVP_PKEY_get0_RSA(3), EVP_PKEY_copy_parameters(3), EVP_PKEY_ASN1_METHOD(3), EVP_KEYMGMT(3) β go read those too, iykyk π
π COPYRIGHT π
Copyright 2020-2021 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, no cap π«Ά this was version 3.5.6, dated 2026-04-07, filed under EVP_PKEY_SET_TYPE(3ossl) β go forth and set some types, you've got this πβ¨πΈ
π¦ 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