EVP_PKEY_ASN1_GET_COUNT(3SSL)

πŸ’… EVP_PKEY_ASN1_GET_COUNT(3SSL) β€” the OpenSSL manual page, bestie edition ✨

okay so this is the OpenSSL manual page for enumerating public key ASN.1 methods, and honestly? it's giving backstage-pass energy 🎟️ β€” you're literally getting the guest list of every public key method that's loaded up. let's get into it 🫢


🌸 NAME 🌸

EVP_PKEY_asn1_find, EVP_PKEY_asn1_find_str, EVP_PKEY_asn1_get_count, EVP_PKEY_asn1_get0, EVP_PKEY_asn1_get0_info β€” these five besties collectively enumerate public key ASN.1 methods πŸ’–


✨ 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 πŸ¦‹

πŸ’« the headcount era

EVP_PKEY_asn1_count() returns a count of the number of public key ASN.1 methods available β€” and yes, that includes the standard methods plus any methods your application went and added itself. main character behavior honestly πŸ‘‘

πŸ’« pick one by index

EVP_PKEY_asn1_get0() returns the public key ASN.1 method idx. and the rules are the rules: the value of idx must be between zero and EVP_PKEY_asn1_get_count() - 1. no vibes-based indexing, bestie 🚫

πŸ’« find by NID

EVP_PKEY_asn1_find() looks up the EVP_PKEY_ASN1_METHOD with NID type. 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. so like, it does a little extra credit lookup for you 🧚

πŸ’« find by PEM string

EVP_PKEY_asn1_find_str() looks up the EVP_PKEY_ASN1_METHOD with PEM type string str. 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. same deal, different search key πŸ’…

πŸ’« spill the info

EVP_PKEY_asn1_get0_info() returns the public key ID, base public key ID (both NIDs), any flags, the method description and PEM type string associated with the public key ASN.1 method *ameth. it's basically the whole info dump, no gatekeeping 🌈

⚠️ the thread-safety tea ⚠️

EVP_PKEY_asn1_count(), EVP_PKEY_asn1_get0(), EVP_PKEY_asn1_find() and EVP_PKEY_asn1_find_str() are not thread safe, but as long as all EVP_PKEY_ASN1_METHOD objects are added before the application gets threaded, using them is safe. see EVP_PKEY_asn1_add0(3).

no cap, read that caveat twice 😭 get all your objects added first, then go multithreaded β€” that's the whole vibe check.

πŸ”₯ RETURN VALUES πŸ”₯

  • EVP_PKEY_asn1_count() β€” returns the number of available public key methods. a whole number, that's it, slay πŸ’–
  • EVP_PKEY_asn1_get0() β€” returns a public key method, or NULL if idx is out of range. out of range = you get nothing, bestie πŸ’€
  • EVP_PKEY_asn1_get0_info() β€” returns 0 on failure, 1 on success.

πŸŽ€ SEE ALSO πŸŽ€


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 page, bestie πŸ“ this whole thing is from OpenSSL 3.5.7, dated 2026-06-09, and it's the EVP_PKEY_ASN1_GET_COUNT(3SSL) page β€” go forth and enumerate, periodt πŸ’œβœ¨

πŸ“¦ where this page comes from