EVP_PKEY_ASN1_GET_COUNT(3ossl)
π NAME π
okay so bestie, meet the girlies that let you peek at all the public key ASN.1 methods: EVP_PKEY_asn1_find, EVP_PKEY_asn1_find_str, EVP_PKEY_asn1_get_count, EVP_PKEY_asn1_get0, and EVP_PKEY_asn1_get0_info. literally the whole squad for enumerating public key ASN.1 methods. this is all part of OpenSSL, the 3ossl manual era, and yes we are going to go through every single one of them, no skips π
β¨ 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);
like. look at that include. #include <openssl/evp.h>. slay. copy it exactly, she does not appreciate typos π
π¦ DESCRIPTION π¦
EVP_PKEY_asn1_count() hands you a count of how many public key ASN.1 methods are out there. and bestie, it's not just the standard ones β anything the application added counts too. the whole roster. π
EVP_PKEY_asn1_get0() gives you back the public key ASN.1 method at position idx. and listen, idx has to be between zero and EVP_PKEY_asn1_get_count() - 1. stay in your lane, bestie, or it's giving out-of-range energy.
EVP_PKEY_asn1_find() goes looking for the EVP_PKEY_ASN1_METHOD with NID type. and here's the plot twist: if pe isn't NULL, it will look up an engine implementing an EVP_PKEY_ASN1_METHOD for that NID type and return that instead, and it also sets *pe to point at the engine that implements it. main character engine behavior, honestly.
EVP_PKEY_asn1_find_str() is the same vibe but it looks up the EVP_PKEY_ASN1_METHOD by the PEM type string str. and just like EVP_PKEY_asn1_find(), if pe isn't NULL, it will look up an engine implementing an 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 energy, different lookup key. π
EVP_PKEY_asn1_get0_info() spills the tea on the public key ASN.1 method *ameth: it returns the public key ID, the base public key ID (both of those are NIDs, fyi), any flags, the method description, and the PEM type string associated with it.
okay so real talk, important:EVP_PKEY_asn1_count(),EVP_PKEY_asn1_get0(),EVP_PKEY_asn1_find()andEVP_PKEY_asn1_find_str()are not thread safe. the way that this is fine is if every singleEVP_PKEY_ASN1_METHODobject gets added before the application gets threaded. do that and using them is safe, periodt. seeEVP_PKEY_asn1_add0(3). π«Ά
πΈ RETURN VALUES πΈ
EVP_PKEY_asn1_count()returns the number of available public key methods. iconic.EVP_PKEY_asn1_get0()returns a public key method, orNULLifidxis out of range. πEVP_PKEY_asn1_get0_info()returns0on failure,1on success. no cap.
π SEE ALSO π
go read those too bestie, iykyk π§
π 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, bestie!! π this was OpenSSL 3.5.9, dated 2026-09-29, and it's the EVP_PKEY_ASN1_GET_COUNT(3ossl) manual β obsessed with her fr fr. stay safe, stay thread-aware, mwah πβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms