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
#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 **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
EVP_PKEY_asn1_get_count
()
returns the number of public key ASN.1 methods available. It includes
standard methods and any methods added by the application.
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 pe is not
NULL
, it first looks for an engine implementing a
method for the NID type. If one is found,
*pe is set to that engine and the method from that
engine is returned instead.
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) 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 pe is
not NULL
, methods from engines are preferred.
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
() orEVP_PKEY_asn1_find_str
(). It is either an alias built into the library, or it was created with EVP_PKEY_asn1_add_alias(3). ASN1_PKEY_DYNAMIC
- This ameth object is marked as dynamically allocated. If this flag is set, EVP_PKEY_asn1_free(3) can free ameth; otherwise, EVP_PKEY_asn1_free(3) has no effect on it.
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 defaultV_ASN1_UNDEF
when encoding the ASN.1 AlgorithmIdentifier objects with X509_ALGOR_set0(3). In particular, this is used forEVP_PKEY_RSA
.
EVP_PKEY_asn1_get_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).
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
HISTORY
These functions first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.