EVP_PKEY_SET_TYPE(3SSL)
π EVP_PKEY_SET_TYPE π
okay bestie, so this is the OpenSSL page for EVP_PKEY_set_type, EVP_PKEY_set_type_str, and EVP_PKEY_set_type_by_keymgmt β aka the little squad of functions that straight up change the EVP_PKEY type of a key. like, full glow-up, new identity, bye bye old everything. π
β¨ NAME β¨
EVP_PKEY_set_type, EVP_PKEY_set_type_str, EVP_PKEY_set_type_by_keymgmt β functions to change the EVP_PKEY type.
πΈ 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 π¦
ok so all three of these behave the same in one big way: they clear all the previous key data and methods from pkey, and reset it so it's the type of key given by whichever different argument you pass in. clean slate, factory reset, new era. β¨
and a lil detail that matters: if pkey is NULL, these functions will still return the same return values as if it wasn't. so like, they don't panic, they just vibe and give you the same answer. π«Ά
EVP_PKEY_set_type()β initialisespkeyto contain an internal legacy key. it is an error if no legacy implementations could be found fortype. π¨EVP_PKEY_set_type_str()β initialisespkeyto contain an internal legacy key. it is an error if no legacy implementation could be found fortype. π¨- for both
EVP_PKEY_set_type()andEVP_PKEY_set_type_str(),pkeygets a numeric type, which you can retrieve withEVP_PKEY_get_id(3). this numeric type is taken from the internal legacy implementation that was found, and it's equal to or closely related totypewhen you usedEVP_PKEY_set_type(), or related tostrwhen you usedEVP_PKEY_set_type_str(). it's giving "the number comes from whichever legacy impl showed up". π« EVP_PKEY_set_type_by_keymgmt()β initialisespkeyto contain an internal provider side key. when it does that, it associatespkeywithkeymgmt. and here's the tea: for keys initialised this way, the numeric type you get back fromEVP_PKEY_get_id(3)will always beEVP_PKEY_NONE. every single time. no cap. π
π RETURN VALUES π
all the functions described here return 1 if successful, or 0 on error. that's it, that's the whole system. βοΈ
π SEE ALSO π
EVP_PKEY_assign(3)EVP_PKEY_get_id(3)EVP_PKEY_get0_RSA(3)EVP_PKEY_copy_parameters(3)EVP_KEYMGMT(3)
π COPYRIGHT π
Copyright 2020-2026 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!! π₯³ this was page EVP_PKEY_SET_TYPE(3SSL) from OpenSSL 4.0.3, dated 2026-09-29 β go forth and set those types, you absolute icon ππ¦β¨
π¦ 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