Standard preamble:
========================================================================
..
.... Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.
If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.
Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================
Title "EVP_PKEY_ASN1_METHOD 3"
way too many mistakes in technical documents.
There are two places where the \s-1EVP_PKEY_ASN1_METHOD\s0 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 using \fBEVP_PKEY_asn1_add0\|(3).
.Vb 5 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); .Ve
The pub_decode() and pub_encode() methods are called to decode / encode X509_PUBKEY \s-1ASN.1\s0 parameters to / from pk. They \s-1MUST\s0 return 0 on error, 1 on success. They're called by X509_PUBKEY_get0\|(3) and X509_PUBKEY_set\|(3).
The pub_cmp() method is called when two public keys are to be compared. It \s-1MUST\s0 return 1 when the keys are equal, 0 otherwise. It's called by EVP_PKEY_cmp\|(3).
The pub_print() method is called to print a public key in humanly readable text to out, indented indent spaces. It \s-1MUST\s0 return 0 on error, 1 on success. It's called by EVP_PKEY_print_public\|(3).
.Vb 4 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); .Ve
The priv_decode() and priv_encode() methods are called to decode / encode \s-1PKCS8_PRIV_KEY_INFO\s0 form private key to / from pk. They \s-1MUST\s0 return 0 on error, 1 on success. They're called by \s-1EVP_PKCS82PKEY\s0\|(3) and \s-1EVP_PKEY2PKCS8\s0\|(3).
The priv_print() method is called to print a private key in humanly readable text to out, indented indent spaces. It \s-1MUST\s0 return 0 on error, 1 on success. It's called by EVP_PKEY_print_private\|(3).
.Vb 3 int (*pkey_size) (const EVP_PKEY *pk); int (*pkey_bits) (const EVP_PKEY *pk); int (*pkey_security_bits) (const EVP_PKEY *pk); .Ve
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).
.Vb 8 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); .Ve
The param_decode() and param_encode() methods are called to decode / encode \s-1DER\s0 formatted parameters to / from pk. They \s-1MUST\s0 return 0 on error, 1 on success. They're called by PEM_read_bio_Parameters\|(3) and the file: \s-1OSSL_STORE_LOADER\s0\|(3).
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 \s-1MUST\s0 return 0 on error, 1 on success. It's called by EVP_PKEY_copy_parameters\|(3).
The param_cmp() method compares the parameters of keys a and b. It \s-1MUST\s0 return 1 when the keys are equal, 0 when not equal, or a negative number on error. It's called by EVP_PKEY_cmp_parameters\|(3).
The param_print() method prints the private key parameters in humanly readable text to out, indented indent spaces. It \s-1MUST\s0 return 0 on error, 1 on success. It's called by EVP_PKEY_print_params\|(3).
.Vb 3 int (*sig_print) (BIO *out, const X509_ALGOR *sigalg, const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx); .Ve
The sig_print() method prints a signature in humanly readable text to \fBout, indented indent spaces. \fBsigalg 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 \s-1MUST\s0 return 0 on error, 1 on success. It's called by X509_signature_print\|(3).
.Vb 1 void (*pkey_free) (EVP_PKEY *pkey); .Ve
The pkey_free() method helps freeing the internals of pkey. It's called by EVP_PKEY_free\|(3), EVP_PKEY_set_type\|(3), \fBEVP_PKEY_set_type_str\|(3), and EVP_PKEY_assign\|(3).
.Vb 1 int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2); .Ve
The pkey_ctrl() method adds extra algorithm specific control. It's called by EVP_PKEY_get_default_digest_nid\|(3), \fBEVP_PKEY_set1_tls_encodedpoint\|(3), \fBEVP_PKEY_get1_tls_encodedpoint\|(3), PKCS7_SIGNER_INFO_set\|(3), \fBPKCS7_RECIP_INFO_set\|(3), ...
.Vb 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); .Ve
The old_priv_decode() and old_priv_encode() methods decode / encode they private key pkey from / to a \s-1DER\s0 formatted array. These are exclusively used to help decoding / encoding older (pre PKCS#8) \s-1PEM\s0 formatted encrypted private keys. \fBold_priv_decode() \s-1MUST\s0 return 0 on error, 1 on success. \fBold_priv_encode() \s-1MUST\s0 the return same kind of values as \fBi2d_PrivateKey(). They're called by d2i_PrivateKey\|(3) and i2d_PrivateKey\|(3).
.Vb 5 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); .Ve
The item_sign() and item_verify() methods make it possible to have algorithm specific signatures and verification of them.
\fBitem_sign() \s-1MUST\s0 return one of:
\fBitem_verify() \s-1MUST\s0 return one of:
\fBitem_verify() and item_sign() are called by ASN1_item_verify\|(3) and \fBASN1_item_sign\|(3), and by extension, X509_verify\|(3), \fBX509_REQ_verify\|(3), X509_sign\|(3), X509_REQ_sign\|(3), ...
.Vb 2 int (*siginf_set) (X509_SIG_INFO *siginf, const X509_ALGOR *alg, const ASN1_STRING *sig); .Ve
The siginf_set() method is used to set custom X509_SIG_INFO parameters. It \s-1MUST\s0 return 0 on error, or 1 on success. It's called as part of X509_check_purpose\|(3), X509_check_ca\|(3) and X509_check_issued\|(3).
.Vb 3 int (*pkey_check) (const EVP_PKEY *pk); int (*pkey_public_check) (const EVP_PKEY *pk); int (*pkey_param_check) (const EVP_PKEY *pk); .Ve
The pkey_check(), pkey_public_check() and pkey_param_check() methods are used to check the validity of pk for key-pair, public component and parameters, respectively. They \s-1MUST\s0 return 0 for an invalid key, or 1 for a valid key. They are called by EVP_PKEY_check\|(3), EVP_PKEY_public_check\|(3) and \fBEVP_PKEY_param_check\|(3) respectively.
.Vb 2 int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len); int (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len); .Ve
The set_priv_key() and set_pub_key() methods are used to set the raw private and public key data for an \s-1EVP_PKEY.\s0 They \s-1MUST\s0 return 0 on error, or 1 on success. They are called by EVP_PKEY_new_raw_private_key\|(3), and \fBEVP_PKEY_new_raw_public_key\|(3) respectively.
.Vb 1 ASN1_PKEY_SIGPARAM_NULL .Ve
If \s-1ASN1_PKEY_SIGPARAM_NULL\s0 is set, then 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.
\fBEVP_PKEY_asn1_copy() copies an \s-1EVP_PKEY_ASN1_METHOD\s0 object from \fBsrc to dst. This function is not thread safe, it's recommended to only use this when initializing the application.
\fBEVP_PKEY_asn1_free() frees an existing \s-1EVP_PKEY_ASN1_METHOD\s0 pointed by ameth.
\fBEVP_PKEY_asn1_add0() adds ameth to the user defined stack of methods unless another \s-1EVP_PKEY_ASN1_METHOD\s0 with the same \s-1NID\s0 is already there. This function is not thread safe, it's recommended to only use this when initializing the application.
\fBEVP_PKEY_asn1_add_alias() creates an alias with the \s-1NID\s0 to for the \fB\s-1EVP_PKEY_ASN1_METHOD\s0 with \s-1NID\s0 from unless another \fB\s-1EVP_PKEY_ASN1_METHOD\s0 with the same \s-1NID\s0 is already added. This function is not thread safe, it's recommended to only use this when initializing the application.
\fBEVP_PKEY_asn1_set_public(), EVP_PKEY_asn1_set_private(), \fBEVP_PKEY_asn1_set_param(), EVP_PKEY_asn1_set_free(), \fBEVP_PKEY_asn1_set_ctrl(), EVP_PKEY_asn1_set_item(), \fBEVP_PKEY_asn1_set_siginf(), EVP_PKEY_asn1_set_check(), \fBEVP_PKEY_asn1_set_public_check(), EVP_PKEY_asn1_set_param_check(), \fBEVP_PKEY_asn1_set_security_bits(), EVP_PKEY_asn1_set_set_priv_key(), \fBEVP_PKEY_asn1_set_set_pub_key(), EVP_PKEY_asn1_set_get_priv_key() and \fBEVP_PKEY_asn1_set_get_pub_key() set the diverse methods of the given \fB\s-1EVP_PKEY_ASN1_METHOD\s0 object.
\fBEVP_PKEY_get0_asn1() finds the \s-1EVP_PKEY_ASN1_METHOD\s0 associated with the key pkey.
\fBEVP_PKEY_asn1_add0() and EVP_PKEY_asn1_add_alias() return 0 on error, or 1 on success.
\fBEVP_PKEY_get0_asn1() returns \s-1NULL\s0 on error, or a pointer to a constant \fB\s-1EVP_PKEY_ASN1_METHOD\s0 object otherwise.
Licensed under the OpenSSL license (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.