EVP_PKEY_IS_A(3SSL)
β¨ EVP_PKEY_IS_A β¨
okay bestie, buckle up π this is the OpenSSL man page for the 3SSL section β the key type + capabilities girlies. if you've ever been like "wait, what even IS this key and can it sign stuff?"β¦ yeah. this page is for you. π«Ά
πΈ NAME πΈ
EVP_PKEY_is_a, EVP_PKEY_can_sign, EVP_PKEY_type_names_do_all, EVP_PKEY_get0_type_name, EVP_PKEY_get0_description, EVP_PKEY_get0_provider β literally the key type and capabilities functions. they tell you what a key is, what it's called, and what it can do. that's the whole vibe. β¨
π SYNOPSIS π
#include <openssl/evp.h>
int EVP_PKEY_is_a(const EVP_PKEY *pkey, const char *name);
int EVP_PKEY_can_sign(const EVP_PKEY *pkey);
int EVP_PKEY_type_names_do_all(const EVP_PKEY *pkey,
void (*fn)(const char *name, void *data),
void *data);
const char *EVP_PKEY_get0_type_name(const EVP_PKEY *key);
const char *EVP_PKEY_get0_description(const EVP_PKEY *key);
const OSSL_PROVIDER *EVP_PKEY_get0_provider(const EVP_PKEY *key);
π DESCRIPTION π
EVP_PKEY_is_a()β does a lil vibe check: is the key type of pkey actually name? yes or no, no elaboration. πEVP_PKEY_can_sign()β checks if the functionality for the key type of pkey supports signing. and that's it. no other check is done β like, it does NOT check whether pkey actually contains a private key. so don't get cocky. πEVP_PKEY_type_names_do_all()β traverses every single name for pkey's key type and calls fn with each name and data. fr fr, an RSAEVP_PKEYmay be named both"RSA"and"rsaEncryption"β it's giving multitudes. the order of the names depends on the provider implementation that holds the key, so don't come for me about ordering. πEVP_PKEY_get0_type_name()β returns the first key type name that's found for the given pkey. heads up bestie: pkey may have multiple synonyms associated with it, and in that case it depends on the provider implementation that holds the key which one gets returned. also, ownership of the returned string is retained by the pkey object β do NOT free it yourself, that's not your business, that's not your string. π«EVP_PKEY_get0_description()β returns a description of the type ofEVP_PKEY, meant for display and human consumption. the description is at the discretion of the key type implementation, so it's whatever the provider decided to say. π¬EVP_PKEY_get0_provider()β returns the provider of theEVP_PKEY'sEVP_KEYMGMT(3). that's the whole job. β¨
π RETURN VALUES π
EVP_PKEY_is_a()β returns1if pkey has the key type name, otherwise0.EVP_PKEY_can_sign()β returns1if the pkey key type functionality supports signing, otherwise0.EVP_PKEY_get0_type_name()β returns the name that is found, orNULLon error.EVP_PKEY_get0_description()β returns the description if found, orNULLif not.EVP_PKEY_get0_provider()β returns the provider if found, orNULLif not.EVP_PKEY_type_names_do_all()β returns1if the callback was called for all names. a return value of0means the callback was not called for any names. π
π¦ EXAMPLES π¦
β EVP_PKEY_is_a() β
the loaded providers and what key types they support will ultimately determine what name is possible to use with EVP_PKEY_is_a(). what we DO know: the default provider supports RSA, DH, DSA and EC keys, so we can use this as a crude example:
#include <openssl/evp.h>
...
/* |pkey| is an EVP_PKEY* */
if (EVP_PKEY_is_a(pkey, "RSA")) {
BIGNUM *modulus = NULL;
if (EVP_PKEY_get_bn_param(pkey, "n", &modulus))
/* do whatever with the modulus */
BN_free(modulus);
}
β EVP_PKEY_can_sign() β
#include <openssl/evp.h>
...
/* |pkey| is an EVP_PKEY* */
if (!EVP_PKEY_can_sign(pkey)) {
fprintf(stderr, "Not a signing key!");
exit(1);
}
/* Sign something... */
likeβ¦ if it can't sign, we're out. bye. π
π HISTORY π
the functions described here were added in OpenSSL 3.0. so yeah, they're not ancient, they're just iconic. π
π 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>.
π okay that's the whole page bestie!! go forth and check those key types, you absolute main character. no cap, you ate. π β¨
mwah π β this was OpenSSL 4.0.3, dated 2026-09-29, from the EVP_PKEY_IS_A(3SSL) manual page. periodt. π
π¦ 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