---
name: "libressl-EVP_PKEY_asn1_get_count"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-EVP_PKEY_asn1_get_count"
---

# libressl-EVP\_PKEY\_asn1\_get\_count(3)

enumerate public key ASN.1 methods

## NAME

**EVP\_PKEY\_asn1\_get\_count**, **EVP\_PKEY\_asn1\_get0**, **EVP\_PKEY\_get0\_asn1**, **EVP\_PKEY\_asn1\_find**, **EVP\_PKEY\_asn1\_find\_str**, **EVP\_PKEY\_asn1\_get0\_info** – enumerate public key ASN.1 methods

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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\_get0\_asn1**(*const EVP\_PKEY \*pkey*);

*const* *EVP\_PKEY\_ASN1\_METHOD* *\**\

**EVP\_PKEY\_asn1\_find**(*ENGINE \*\*engine*, *int type*);

*const* *EVP\_PKEY\_ASN1\_METHOD* *\**\

**EVP\_PKEY\_asn1\_find\_str**(*ENGINE \*\*engine*, *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

**EVP\_PKEY\_asn1\_get\_count**() returns the number of public key ASN.1 methods available.

**EVP\_PKEY\_asn1\_get0**() returns the public key ASN.1 method *idx*. The value of *idx* must be in the range from zero to **EVP\_PKEY\_asn1\_get\_count**() - 1.

**EVP\_PKEY\_asn1\_find**() looks up the method with NID *type*, which can be any of the values that EVP\_PKEY\_base\_id(3) and EVP\_PKEY\_id(3) may return. If *engine* is not NULL, \**engine* is set to NULL.

**EVP\_PKEY\_asn1\_find\_str**() looks up the method with the PEM type string given by the first *len* bytes of *str*. If *len* is -1, the [strlen(3)](/strlen/3.md) of *str* is used instead. The PEM type strings supported by default are listed in the EVP\_PKEY\_base\_id(3) manual page. Just like **EVP\_PKEY\_asn1\_find**(), if *engine* is not NULL, \**engine* is set to NULL.

**EVP\_PKEY\_asn1\_get0\_info**() retrieves the public key ID as returned by EVP\_PKEY\_id(3), the base public key ID as returned by EVP\_PKEY\_base\_id(3) (both NIDs), any flags, and internal pointers owned by *ameth* pointing to its method description string and its PEM type string.

The following flags bits can occur, OR'ed together in \**ppkey\_flags*:

- ASN1\_PKEY\_ALIAS

  This *ameth* object serves as an alias for another *EVP\_PKEY\_ASN1\_METHOD* object and will never be returned from **EVP\_PKEY\_asn1\_find**() or **EVP\_PKEY\_asn1\_find\_str**().

- ASN1\_PKEY\_DYNAMIC

  This flag is unused. It could formerly be used to mark an *ameth* object as dynamically allocated.

- ASN1\_PKEY\_SIGPARAM\_NULL

  If the signing *ctx* uses an *EVP\_PKEY* private key associated with this *ameth*, instruct ASN1\_item\_sign\_ctx(3) to use a parameter type of V\_ASN1\_NULL instead of the default V\_ASN1\_UNDEF when encoding the ASN.1 *AlgorithmIdentifier* objects with X509\_ALGOR\_set0(3). In particular, this is used for EVP\_PKEY\_RSA.

## RETURN VALUES

**EVP\_PKEY\_asn1\_get\_count**() returns the number of available public key methods.

**EVP\_PKEY\_asn1\_get0**() returns a public key method or NULL if *idx* is out of range.

**EVP\_PKEY\_get0\_asn1**() returns the public key method used by *pkey*.

**EVP\_PKEY\_asn1\_find**() and **EVP\_PKEY\_asn1\_find\_str**() return a matching public key method or NULL if no match is found.

**EVP\_PKEY\_asn1\_get0\_info**() returns 1 on success or 0 on failure.

## SEE ALSO

EVP\_PKEY\_base\_id(3), EVP\_PKEY\_new(3)

## HISTORY

These functions first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.
