EVP_PKEY_asn1_set_ctrl (3)
Leading comments
Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) Standard preamble: ========================================================================
NAME
EVP_PKEY_ASN1_METHOD, 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, EVP_PKEY_asn1_set_item, EVP_PKEY_asn1_set_security_bits, EVP_PKEY_get0_asn1 - manipulating and registering EVP_PKEY_ASN1_METHOD structureSYNOPSIS
#include <openssl/evp.h> typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; 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)); void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey), int (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig)); void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, int (*pkey_security_bits) (const EVP_PKEY *pk)); const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey);
DESCRIPTION
There are two places where the
Methods
The methods are the underlying implementations of a particular public key algorithm present by the
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);
The pub_decode() and pub_encode() methods are called to decode / encode X509_PUBKEY
The pub_cmp() method is called when two public keys are to be compared. It
The pub_print() method is called to print a public key in humanly readable text to out, indented indent spaces. It
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);
The priv_decode() and priv_encode() methods are called to decode / encode
The priv_print() method is called to print a private key in humanly readable text to out, indented indent spaces. It
int (*pkey_size) (const EVP_PKEY *pk); int (*pkey_bits) (const EVP_PKEY *pk); int (*pkey_security_bits) (const EVP_PKEY *pk);
The pkey_size() method returns the key size in bytes. It's called by EVP_PKEY_size(3).
The pkey_bits() method returns the key size in bits. It's called by EVP_PKEY_bits(3).
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);
The param_decode() and param_encode() methods are called to decode / encode
The param_missing() method returns 0 if a key parameter is missing, otherwise 1. It's called by EVP_PKEY_missing_parameters(3).
The param_copy() method copies key parameters from from to to. It
The param_cmp() method compares the parameters of keys a and b. It
The param_print() method prints the private key parameters in humanly readable text to out, indented indent spaces. It
int (*sig_print) (BIO *out, const X509_ALGOR *sigalg, const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx);
The sig_print() method prints a signature in humanly readable text to out, indented indent spaces. sigalg contains the exact signature algorithm. If the signature in sig doesn't correspond to what this method expects, X509_signature_dump() must be used as a last resort. It
void (*pkey_free) (EVP_PKEY *pkey);
The pkey_free() method helps freeing the internals of pkey. It's called by EVP_PKEY_free(3), EVP_PKEY_set_type(3), EVP_PKEY_set_type_str(3), and EVP_PKEY_assign(3).
int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2);
The pkey_ctrl() method adds extra algorithm specific control. It's called by EVP_PKEY_get_default_digest_nid(3), EVP_PKEY_set1_tls_encodedpoint(3), EVP_PKEY_get1_tls_encodedpoint(3), PKCS7_SIGNER_INFO_set(3), PKCS7_RECIP_INFO_set(3), ...
int (*old_priv_decode) (EVP_PKEY *pkey, const unsigned char **pder, int derlen); int (*old_priv_encode) (const EVP_PKEY *pkey, unsigned char **pder);
The old_priv_decode() and old_priv_encode() methods decode / encode they private key pkey from / to a
int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey); int (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig);
The item_sign() and item_verify() methods make it possible to have algorithm specific signatures and verification of them.
item_sign()
- <=0
- error
- 1
- item_sign() did everything, OpenSSL internals just needs to pass the signature length back.
- 2
- item_sign() did nothing, OpenSSL internal standard routines are expected to continue with the default signature production.
- 3
- item_sign() set the algorithm identifier algor1 and algor2, OpenSSL internals should just sign using those algorithms.
item_verify()
- <=0
- error
- 1
- item_sign() did everything, OpenSSL internals just needs to pass the signature length back.
- 2
- item_sign() did nothing, OpenSSL internal standard routines are expected to continue with the default signature production.
item_verify() and item_sign() are called by ASN1_item_verify(3) and ASN1_item_sign(3), and by extension, X509_verify(3), X509_REQ_verify(3), X509_sign(3), X509_REQ_sign(3), ...
Functions
EVP_PKEY_asn1_new() creates and returns a new
ASN1_PKEY_SIGPARAM_NULL
If
EVP_PKEY_asn1_copy() copies an
EVP_PKEY_asn1_free() frees an existing
EVP_PKEY_asn1_add0() adds ameth to the user defined stack of methods unless another
EVP_PKEY_asn1_add_alias() creates an alias with the
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(), EVP_PKEY_asn1_set_item(), and EVP_PKEY_asn1_set_security_bits() set the diverse methods of the given
EVP_PKEY_get0_asn1() finds the
RETURN VALUES
EVP_PKEY_asn1_new() returnsEVP_PKEY_asn1_add0() and EVP_PKEY_asn1_add_alias() return 0 on error, or 1 on success.
EVP_PKEY_get0_asn1() returns
COPYRIGHT
Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.Licensed under the OpenSSL license (the ``License''). You may not use this file except in compliance with the License. You can obtain a copy in the file