Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
EVP_PKEY_ASN1_NEW(3) | Library Functions Manual | EVP_PKEY_ASN1_NEW(3) |
NAME
EVP_PKEY_asn1_new
,
EVP_PKEY_asn1_copy
,
EVP_PKEY_asn1_free
,
EVP_PKEY_asn1_add0
,
EVP_PKEY_asn1_add_alias
,
EVP_PKEY_asn1_set_public
,
EVP_PKEY_asn1_set_private
,
EVP_PKEY_asn1_set_param
,
EVP_PKEY_asn1_set_free
,
EVP_PKEY_asn1_set_ctrl
—
manipulating and registering an EVP_PKEY_ASN1_METHOD
structure
SYNOPSIS
#include
<openssl/evp.h>
EVP_PKEY_ASN1_METHOD *
EVP_PKEY_asn1_new
(int
id, int flags,
const char *pem_str,
const char *info);
void
EVP_PKEY_asn1_copy
(EVP_PKEY_ASN1_METHOD
*dst, const EVP_PKEY_ASN1_METHOD *src);
void
EVP_PKEY_asn1_free
(EVP_PKEY_ASN1_METHOD
*ameth);
int
EVP_PKEY_asn1_add0
(const
EVP_PKEY_ASN1_METHOD *ameth);
int
EVP_PKEY_asn1_add_alias
(int
to, int from);
void
EVP_PKEY_asn1_set_public
(EVP_PKEY_ASN1_METHOD
*ameth, int (*pub_decode)(EVP_PKEY *pk,
X509_PUBKEY *pub), int
(*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk),
int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY
*b), int (*pub_print)(BIO *out, const
EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx),
int (*pkey_size)(const EVP_PKEY *pk),
int (*pkey_bits)(const EVP_PKEY *pk));
void
EVP_PKEY_asn1_set_private
(EVP_PKEY_ASN1_METHOD
*ameth, int (*priv_decode)(EVP_PKEY *pk,
const PKCS8_PRIV_KEY_INFO *p8inf), int
(*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk),
int (*priv_print)(BIO *out, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx));
void
EVP_PKEY_asn1_set_param
(EVP_PKEY_ASN1_METHOD
*ameth, int (*param_decode)(EVP_PKEY *pkey,
const unsigned char **pder, int derlen), int
(*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),
int (*param_missing)(const EVP_PKEY *pk),
int (*param_copy)(EVP_PKEY *to, const EVP_PKEY
*from), int (*param_cmp)(const EVP_PKEY *a,
const EVP_PKEY *b), int (*param_print)(BIO
*out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx));
void
EVP_PKEY_asn1_set_free
(EVP_PKEY_ASN1_METHOD
*ameth, void (*pkey_free)(EVP_PKEY
*pkey));
void
EVP_PKEY_asn1_set_ctrl
(EVP_PKEY_ASN1_METHOD
*ameth, int (*pkey_ctrl)(EVP_PKEY *pkey, int
op, long arg1, void *arg2));
DESCRIPTION
EVP_PKEY_ASN1_METHOD is a structure which holds a set of ASN.1 conversion, printing and information methods for a specific public key algorithm. There are two places where the EVP_PKEY_ASN1_METHOD objects are stored: one is a built-in array representing the standard methods for different algorithms, and the other one is a stack of user-defined application-specific methods, which can be manipulated by usingEVP_PKEY_asn1_add0
().
Methods
The methods are the underlying implementations of a particular public key algorithm present by the EVP_PKEY object.int(*pub_decode)
(EVP_PKEY *pk, X509_PUBKEY *pub) int(*pub_encode)
(X509_PUBKEY *pub, const EVP_PKEY *pk)
int (*pub_cmp)
(const EVP_PKEY *a, const EVP_PKEY *b)
int
Print a public key in humanly readable text to
out, indented
indent spaces. This method must return 0 on
error and 1 on success. It is called by
EVP_PKEY_print_public(3).
(*pub_print)
(BIO
*out, const EVP_PKEY *pkey,
int indent,
ASN1_PCTX *pctx);int(*priv_decode)
(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf) int(*priv_encode)
(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk)
int
Print a private key in humanly readable text to
out, indented
indent spaces. This method must return 0 on
error and 1 on success. It is called by
EVP_PKEY_print_private(3).
(*priv_print)
(BIO
*out, const EVP_PKEY *pkey,
int indent,
ASN1_PCTX *pctx);
int (*pkey_size)
(const EVP_PKEY *pk)
int (*pkey_bits)
(const EVP_PKEY *pk)
int
int
Decode and encode DER formatted parameters to and from
pk. These methods must return 0 on error and
1 on success. They are called by
(*param_decode)
(EVP_PKEY
*pkey, const unsigned char **pder,
int derlen);
(*param_encode)
(const
EVP_PKEY *pkey, unsigned char
**pder);PEM_read_bio_Parameters
().
int (*param_missing)
(const EVP_PKEY *pk)
int (*param_copy)
(EVP_PKEY *to, const EVP_PKEY *from)
int (*param_cmp)
(const EVP_PKEY *a, const EVP_PKEY *b)
int
Print the private key parameters in humanly readable text to
out, indented
indent spaces. This method must return 0 on
error and 1 on success. It is called by
EVP_PKEY_print_params(3).
(*param_print)
(BIO
*out, const EVP_PKEY *pkey,
int indent,
ASN1_PCTX *pctx);
void (*pkey_free)
(EVP_PKEY *pkey)
EVP_PKEY_set_type_str
(), and
EVP_PKEY_assign(3).
int
Add extra algorithm specific control. This method is called by
EVP_PKEY_get_default_digest_nid(3),
(*pkey_ctrl)
(EVP_PKEY
*pkey, int op,
long arg1, void
*arg2);PKCS7_SIGNER_INFO_set
(),
PKCS7_RECIP_INFO_set
(), and other
functions.
Functions
EVP_PKEY_asn1_new
() creates and returns a new
EVP_PKEY_ASN1_METHOD object, and associates
the given id,
flags,
pem_str and
info. id is
a NID, pem_str is the PEM type string,
info is a descriptive string. If
ASN1_PKEY_SIGPARAM_NULL
is set in
flags, the signature algorithm parameters are
given the type V_ASN1_NULL
by default,
otherwise they will be given the type
V_ASN1_UNDEF
(i.e. the parameter is
omitted). See
X509_ALGOR_set0(3)
for more information.
EVP_PKEY_asn1_copy
() copies an
EVP_PKEY_ASN1_METHOD object from
src to dst.
This function is not thread safe, it is recommended to only use this when
initializing the application.
EVP_PKEY_asn1_free
() frees an existing
EVP_PKEY_ASN1_METHOD pointed by
ameth.
EVP_PKEY_asn1_add0
() adds
ameth to the user defined stack of methods
unless another EVP_PKEY_ASN1_METHOD with the
same NID is already there. This function is not thread safe, it is recommended
to only use this when initializing the application.
EVP_PKEY_asn1_add_alias
() creates an alias
with the NID to for the
EVP_PKEY_ASN1_METHOD with NID
from unless another
EVP_PKEY_ASN1_METHOD with the same NID is
already added. This function is not thread safe, it's recommended to only use
this when initializing the application.
EVP_PKEY_asn1_set_public
(),
EVP_PKEY_asn1_set_private
(),
EVP_PKEY_asn1_set_param
(),
EVP_PKEY_asn1_set_free
(), and
EVP_PKEY_asn1_set_ctrl
() set the diverse
methods of the given EVP_PKEY_ASN1_METHOD
object.
RETURN VALUES
EVP_PKEY_asn1_new
() returns a pointer to an
EVP_PKEY_ASN1_METHOD object or
NULL
on error.
EVP_PKEY_asn1_add0
() and
EVP_PKEY_asn1_add_alias
() return 0 on error
or 1 on success.
SEE ALSO
EVP_PKEY_asn1_get_count(3), EVP_PKEY_new(3), X509_PUBKEY_new(3)HISTORY
These functions first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.November 6, 2021 | Debian |