EVP_PKEY_SET_TYPE(3ossl)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ’… 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, if pkey is NULL, these functions will still return the same return values as if it wasn't. iconic behavior honestly πŸ’€
  • EVP_PKEY_set_type() β€” initialises pkey to contain an internal legacy key. when it does this, it finds a EVP_PKEY_ASN1_METHOD(3) corresponding to type, and associates pkey with the findings πŸŽ€ and it is an error if no EVP_PKEY_ASN1_METHOD(3) could be found for type.
  • EVP_PKEY_set_type_str() β€” also initialises pkey to contain an internal legacy key. when it does this, it finds a EVP_PKEY_ASN1_METHOD(3) corresponding to str that has then length len, and associates pkey with the findings 🌈 and it is an error if no EVP_PKEY_ASN1_METHOD(3) could be found for type.

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() β€” initialises pkey to contain an internal provider side key 🧚 when it does this, it associates pkey with keymgmt. for keys initialised like this, the numeric type retrieved with EVP_PKEY_get_id(3) will always be EVP_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 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