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() β€” initialises pkey to contain an internal legacy key. it is an error if no legacy implementations could be found for type. 🚨
  • EVP_PKEY_set_type_str() β€” initialises pkey to contain an internal legacy key. it is an error if no legacy implementation could be found for type. 🚨
  • for both EVP_PKEY_set_type() and EVP_PKEY_set_type_str(), pkey gets a numeric type, which you can retrieve with EVP_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 to type when you used EVP_PKEY_set_type(), or related to str when you used EVP_PKEY_set_type_str(). it's giving "the number comes from whichever legacy impl showed up". πŸ’«
  • EVP_PKEY_set_type_by_keymgmt() β€” initialises pkey to contain an internal provider side key. when it does that, it associates pkey with keymgmt. and here's the tea: for keys initialised this way, the numeric type you get back from EVP_PKEY_get_id(3) will always be EVP_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 πŸ‘€


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