EVP_PKEY_ASN1_GET_COUNT(3ossl)
π EVP_PKEY_ASN1_GET_COUNT β the OpenSSL 3ossl era β¨
okay bestie, listen. this is a whole family of functions that live in <openssl/evp.h> and they're all about enumerating public key ASN.1 methods β like, going through the whole roster of them. think of it as scraping the group chat member list instead of just DMing one person, iykyk π«Ά
β¨ SYNOPSIS β¨
#include <openssl/evp.h>
int EVP_PKEY_asn1_get_count(void);
const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);
const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);
const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
const char *str, int len);
int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id,
int *ppkey_flags, const char **pinfo,
const char **ppem_str,
const EVP_PKEY_ASN1_METHOD *ameth);
π¦ DESCRIPTION π¦
okay so first up, EVP_PKEY_asn1_count() hands you a count of how many public key ASN.1 methods are available β and yes, that includes the standard ones plus anything your application went and added itself. iconic, honestly πΈ
EVP_PKEY_asn1_get0() returns the public key ASN.1 method at index idx. and the vibes check here is strict: the value of idx must be between zero and EVP_PKEY_asn1_get_count() - 1. out-of-bounds is not the moment, bestie π
EVP_PKEY_asn1_find() looks up the EVP_PKEY_ASN1_METHOD with NID type. but here's the plot twist: if pe isn't NULL, then it will look up an engine implementing a EVP_PKEY_ASN1_METHOD for the NID type and return that instead β and also set *pe to point at the engine that implements it. main character engine energy, fr fr π
EVP_PKEY_asn1_find_str() looks up the EVP_PKEY_ASN1_METHOD with PEM type string str. and just like EVP_PKEY_asn1_find(), if pe isn't NULL, then it will look up an engine implementing a EVP_PKEY_ASN1_METHOD for the NID type and return that instead, and also set *pe to point at the engine that implements it.
EVP_PKEY_asn1_get0_info() gives you the public key ID, the base public key ID (both NIDs, yes), any flags, the method description, and the PEM type string β all of it associated with the public key ASN.1 method *ameth. it's giving full info dump and we love that for us πβ¨
okay now the important warning bit, don't scroll past this π¨ EVP_PKEY_asn1_count(), EVP_PKEY_asn1_get0(), EVP_PKEY_asn1_find() and EVP_PKEY_asn1_find_str() are not thread safe. but β and this is the safe part β as long as all EVP_PKEY_ASN1_METHOD objects are added before the application gets threaded, using them is safe. so: add first, thread later, periodt. see EVP_PKEY_asn1_add0(3) for that.
lowkey note: the page literally writes EVP_PKEY_asn1_count() in the description and return values, so we're keeping it exactly like that β no editing the source material, that's the rule π
π RETURN VALUES π
EVP_PKEY_asn1_count()β returns the number of available public key methods.EVP_PKEY_asn1_get0()β returns a public key method, orNULLif idx is out of range. (so like, check before you vibe check it π)EVP_PKEY_asn1_get0_info()β returns0on failure,1on success. classic binary slay.
π₯ SEE ALSO π₯
EVP_PKEY_asn1_new(3), EVP_PKEY_asn1_add0(3)
go read your siblings, bestie, they're part of the lore π§
π COPYRIGHT π
Copyright 2017 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, no cap. written up in the OpenSSL 3.5.0 era, dated 2026-09-25 β go forth and enumerate responsibly, bestie ππ¦π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms