| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "EVP_PKEY_ASN1_METHOD 3SSL" |
| 58 |
.TH EVP_PKEY_ASN1_METHOD 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
EVP_PKEY_ASN1_METHOD, |
| 65 |
EVP_PKEY_asn1_new, |
| 66 |
EVP_PKEY_asn1_copy, |
| 67 |
EVP_PKEY_asn1_free, |
| 68 |
EVP_PKEY_asn1_add0, |
| 69 |
EVP_PKEY_asn1_add_alias, |
| 70 |
EVP_PKEY_asn1_set_public, |
| 71 |
EVP_PKEY_asn1_set_private, |
| 72 |
EVP_PKEY_asn1_set_param, |
| 73 |
EVP_PKEY_asn1_set_free, |
| 74 |
EVP_PKEY_asn1_set_ctrl, |
| 75 |
EVP_PKEY_asn1_set_item, |
| 76 |
EVP_PKEY_asn1_set_siginf, |
| 77 |
EVP_PKEY_asn1_set_check, |
| 78 |
EVP_PKEY_asn1_set_public_check, |
| 79 |
EVP_PKEY_asn1_set_param_check, |
| 80 |
EVP_PKEY_asn1_set_security_bits, |
| 81 |
EVP_PKEY_asn1_set_set_priv_key, |
| 82 |
EVP_PKEY_asn1_set_set_pub_key, |
| 83 |
EVP_PKEY_asn1_set_get_priv_key, |
| 84 |
EVP_PKEY_asn1_set_get_pub_key, |
| 85 |
EVP_PKEY_get0_asn1 |
| 86 |
\&\- manipulating and registering EVP_PKEY_ASN1_METHOD structure |
| 87 |
.SH SYNOPSIS |
| 88 |
.IX Header "SYNOPSIS" |
| 89 |
The following functions have been deprecated since OpenSSL 3.6, and can be |
| 90 |
hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value, |
| 91 |
see \fBopenssl_user_macros\fR\|(7); use the provider API instead. |
| 92 |
.PP |
| 93 |
.Vb 1 |
| 94 |
\& #include <openssl/evp.h> |
| 95 |
\& |
| 96 |
\& typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD; |
| 97 |
\& |
| 98 |
\& EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, |
| 99 |
\& const char *pem_str, |
| 100 |
\& const char *info); |
| 101 |
\& void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, |
| 102 |
\& const EVP_PKEY_ASN1_METHOD *src); |
| 103 |
\& void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth); |
| 104 |
\& int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); |
| 105 |
\& int EVP_PKEY_asn1_add_alias(int to, int from); |
| 106 |
\& |
| 107 |
\& void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, |
| 108 |
\& int (*pub_decode) (EVP_PKEY *pk, |
| 109 |
\& const X509_PUBKEY *pub), |
| 110 |
\& int (*pub_encode) (X509_PUBKEY *pub, |
| 111 |
\& const EVP_PKEY *pk), |
| 112 |
\& int (*pub_cmp) (const EVP_PKEY *a, |
| 113 |
\& const EVP_PKEY *b), |
| 114 |
\& int (*pub_print) (BIO *out, |
| 115 |
\& const EVP_PKEY *pkey, |
| 116 |
\& int indent, ASN1_PCTX *pctx), |
| 117 |
\& int (*pkey_size) (const EVP_PKEY *pk), |
| 118 |
\& int (*pkey_bits) (const EVP_PKEY *pk)); |
| 119 |
\& void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, |
| 120 |
\& int (*priv_decode) (EVP_PKEY *pk, |
| 121 |
\& const PKCS8_PRIV_KEY_INFO |
| 122 |
\& *p8inf), |
| 123 |
\& int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, |
| 124 |
\& const EVP_PKEY *pk), |
| 125 |
\& int (*priv_print) (BIO *out, |
| 126 |
\& const EVP_PKEY *pkey, |
| 127 |
\& int indent, |
| 128 |
\& ASN1_PCTX *pctx)); |
| 129 |
\& void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, |
| 130 |
\& int (*param_decode) (EVP_PKEY *pkey, |
| 131 |
\& const unsigned char **pder, |
| 132 |
\& int derlen), |
| 133 |
\& int (*param_encode) (const EVP_PKEY *pkey, |
| 134 |
\& unsigned char **pder), |
| 135 |
\& int (*param_missing) (const EVP_PKEY *pk), |
| 136 |
\& int (*param_copy) (EVP_PKEY *to, |
| 137 |
\& const EVP_PKEY *from), |
| 138 |
\& int (*param_cmp) (const EVP_PKEY *a, |
| 139 |
\& const EVP_PKEY *b), |
| 140 |
\& int (*param_print) (BIO *out, |
| 141 |
\& const EVP_PKEY *pkey, |
| 142 |
\& int indent, |
| 143 |
\& ASN1_PCTX *pctx)); |
| 144 |
\& |
| 145 |
\& void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, |
| 146 |
\& void (*pkey_free) (EVP_PKEY *pkey)); |
| 147 |
\& void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, |
| 148 |
\& int (*pkey_ctrl) (EVP_PKEY *pkey, int op, |
| 149 |
\& long arg1, void *arg2)); |
| 150 |
\& void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, |
| 151 |
\& int (*item_verify) (EVP_MD_CTX *ctx, |
| 152 |
\& const ASN1_ITEM *it, |
| 153 |
\& void *asn, |
| 154 |
\& X509_ALGOR *a, |
| 155 |
\& ASN1_BIT_STRING *sig, |
| 156 |
\& EVP_PKEY *pkey), |
| 157 |
\& int (*item_sign) (EVP_MD_CTX *ctx, |
| 158 |
\& const ASN1_ITEM *it, |
| 159 |
\& void *asn, |
| 160 |
\& X509_ALGOR *alg1, |
| 161 |
\& X509_ALGOR *alg2, |
| 162 |
\& ASN1_BIT_STRING *sig)); |
| 163 |
\& |
| 164 |
\& void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, |
| 165 |
\& int (*siginf_set) (X509_SIG_INFO *siginf, |
| 166 |
\& const X509_ALGOR *alg, |
| 167 |
\& const ASN1_STRING *sig)); |
| 168 |
\& |
| 169 |
\& void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, |
| 170 |
\& int (*pkey_check) (const EVP_PKEY *pk)); |
| 171 |
\& |
| 172 |
\& void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, |
| 173 |
\& int (*pkey_pub_check) (const EVP_PKEY *pk)); |
| 174 |
\& |
| 175 |
\& void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, |
| 176 |
\& int (*pkey_param_check) (const EVP_PKEY *pk)); |
| 177 |
\& |
| 178 |
\& void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, |
| 179 |
\& int (*pkey_security_bits) (const EVP_PKEY |
| 180 |
\& *pk)); |
| 181 |
\& |
| 182 |
\& void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, |
| 183 |
\& int (*set_priv_key) (EVP_PKEY *pk, |
| 184 |
\& const unsigned char |
| 185 |
\& *priv, |
| 186 |
\& size_t len)); |
| 187 |
\& |
| 188 |
\& void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, |
| 189 |
\& int (*set_pub_key) (EVP_PKEY *pk, |
| 190 |
\& const unsigned char *pub, |
| 191 |
\& size_t len)); |
| 192 |
\& |
| 193 |
\& void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, |
| 194 |
\& int (*get_priv_key) (const EVP_PKEY *pk, |
| 195 |
\& unsigned char *priv, |
| 196 |
\& size_t *len)); |
| 197 |
\& |
| 198 |
\& void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, |
| 199 |
\& int (*get_pub_key) (const EVP_PKEY *pk, |
| 200 |
\& unsigned char *pub, |
| 201 |
\& size_t *len)); |
| 202 |
\& |
| 203 |
\& const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey); |
| 204 |
.Ve |
| 205 |
.SH DESCRIPTION |
| 206 |
.IX Header "DESCRIPTION" |
| 207 |
\&\fBEVP_PKEY_ASN1_METHOD\fR is a structure which holds a set of ASN.1 |
| 208 |
conversion, printing and information methods for a specific public key |
| 209 |
algorithm. |
| 210 |
.PP |
| 211 |
There are two places where the \fBEVP_PKEY_ASN1_METHOD\fR objects are |
| 212 |
stored: one is a built-in array representing the standard methods for |
| 213 |
different algorithms, and the other one is a stack of user-defined |
| 214 |
application-specific methods, which can be manipulated by using |
| 215 |
\&\fBEVP_PKEY_asn1_add0\fR\|(3). |
| 216 |
.SS Methods |
| 217 |
.IX Subsection "Methods" |
| 218 |
The methods are the underlying implementations of a particular public |
| 219 |
key algorithm present by the \fBEVP_PKEY\fR object. |
| 220 |
.PP |
| 221 |
.Vb 5 |
| 222 |
\& int (*pub_decode) (EVP_PKEY *pk, const X509_PUBKEY *pub); |
| 223 |
\& int (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk); |
| 224 |
\& int (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b); |
| 225 |
\& int (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent, |
| 226 |
\& ASN1_PCTX *pctx); |
| 227 |
.Ve |
| 228 |
.PP |
| 229 |
The \fBpub_decode()\fR and \fBpub_encode()\fR methods are called to decode / |
| 230 |
encode \fBX509_PUBKEY\fR ASN.1 parameters to / from \fBpk\fR. |
| 231 |
They MUST return 0 on error, 1 on success. |
| 232 |
They're called by \fBX509_PUBKEY_get0\fR\|(3) and \fBX509_PUBKEY_set\fR\|(3). |
| 233 |
.PP |
| 234 |
The \fBpub_cmp()\fR method is called when two public keys are to be |
| 235 |
compared. |
| 236 |
It MUST return 1 when the keys are equal, 0 otherwise. |
| 237 |
It's called by \fBEVP_PKEY_eq\fR\|(3). |
| 238 |
.PP |
| 239 |
The \fBpub_print()\fR method is called to print a public key in humanly |
| 240 |
readable text to \fBout\fR, indented \fBindent\fR spaces. |
| 241 |
It MUST return 0 on error, 1 on success. |
| 242 |
It's called by \fBEVP_PKEY_print_public\fR\|(3). |
| 243 |
.PP |
| 244 |
.Vb 4 |
| 245 |
\& int (*priv_decode) (EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf); |
| 246 |
\& int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk); |
| 247 |
\& int (*priv_print) (BIO *out, const EVP_PKEY *pkey, int indent, |
| 248 |
\& ASN1_PCTX *pctx); |
| 249 |
.Ve |
| 250 |
.PP |
| 251 |
The \fBpriv_decode()\fR and \fBpriv_encode()\fR methods are called to decode / |
| 252 |
encode \fBPKCS8_PRIV_KEY_INFO\fR form private key to / from \fBpk\fR. |
| 253 |
They MUST return 0 on error, 1 on success. |
| 254 |
They're called by \fBEVP_PKCS82PKEY\fR\|(3) and \fBEVP_PKEY2PKCS8\fR\|(3). |
| 255 |
.PP |
| 256 |
The \fBpriv_print()\fR method is called to print a private key in humanly |
| 257 |
readable text to \fBout\fR, indented \fBindent\fR spaces. |
| 258 |
It MUST return 0 on error, 1 on success. |
| 259 |
It's called by \fBEVP_PKEY_print_private\fR\|(3). |
| 260 |
.PP |
| 261 |
.Vb 3 |
| 262 |
\& int (*pkey_size) (const EVP_PKEY *pk); |
| 263 |
\& int (*pkey_bits) (const EVP_PKEY *pk); |
| 264 |
\& int (*pkey_security_bits) (const EVP_PKEY *pk); |
| 265 |
.Ve |
| 266 |
.PP |
| 267 |
The \fBpkey_size()\fR method returns the key size in bytes. |
| 268 |
It's called by \fBEVP_PKEY_get_size\fR\|(3). |
| 269 |
.PP |
| 270 |
The \fBpkey_bits()\fR method returns the key size in bits. |
| 271 |
It's called by \fBEVP_PKEY_get_bits\fR\|(3). |
| 272 |
.PP |
| 273 |
.Vb 8 |
| 274 |
\& int (*param_decode) (EVP_PKEY *pkey, |
| 275 |
\& const unsigned char **pder, int derlen); |
| 276 |
\& int (*param_encode) (const EVP_PKEY *pkey, unsigned char **pder); |
| 277 |
\& int (*param_missing) (const EVP_PKEY *pk); |
| 278 |
\& int (*param_copy) (EVP_PKEY *to, const EVP_PKEY *from); |
| 279 |
\& int (*param_cmp) (const EVP_PKEY *a, const EVP_PKEY *b); |
| 280 |
\& int (*param_print) (BIO *out, const EVP_PKEY *pkey, int indent, |
| 281 |
\& ASN1_PCTX *pctx); |
| 282 |
.Ve |
| 283 |
.PP |
| 284 |
The \fBparam_decode()\fR and \fBparam_encode()\fR methods are called to decode / |
| 285 |
encode DER formatted parameters to / from \fBpk\fR. |
| 286 |
They MUST return 0 on error, 1 on success. |
| 287 |
They're called by \fBPEM_read_bio_Parameters\fR\|(3) and the \fBfile:\fR |
| 288 |
\&\fBOSSL_STORE_LOADER\fR\|(3). |
| 289 |
.PP |
| 290 |
The \fBparam_missing()\fR method returns 0 if a key parameter is missing, |
| 291 |
otherwise 1. |
| 292 |
It's called by \fBEVP_PKEY_missing_parameters\fR\|(3). |
| 293 |
.PP |
| 294 |
The \fBparam_copy()\fR method copies key parameters from \fBfrom\fR to \fBto\fR. |
| 295 |
It MUST return 0 on error, 1 on success. |
| 296 |
It's called by \fBEVP_PKEY_copy_parameters\fR\|(3). |
| 297 |
.PP |
| 298 |
The \fBparam_cmp()\fR method compares the parameters of keys \fBa\fR and \fBb\fR. |
| 299 |
It MUST return 1 when the keys are equal, 0 when not equal, or a |
| 300 |
negative number on error. |
| 301 |
It's called by \fBEVP_PKEY_parameters_eq\fR\|(3). |
| 302 |
.PP |
| 303 |
The \fBparam_print()\fR method prints the private key parameters in humanly |
| 304 |
readable text to \fBout\fR, indented \fBindent\fR spaces. |
| 305 |
It MUST return 0 on error, 1 on success. |
| 306 |
It's called by \fBEVP_PKEY_print_params\fR\|(3). |
| 307 |
.PP |
| 308 |
.Vb 3 |
| 309 |
\& int (*sig_print) (BIO *out, |
| 310 |
\& const X509_ALGOR *sigalg, const ASN1_STRING *sig, |
| 311 |
\& int indent, ASN1_PCTX *pctx); |
| 312 |
.Ve |
| 313 |
.PP |
| 314 |
The \fBsig_print()\fR method prints a signature in humanly readable text to |
| 315 |
\&\fBout\fR, indented \fBindent\fR spaces. |
| 316 |
\&\fBsigalg\fR contains the exact signature algorithm. |
| 317 |
If the signature in \fBsig\fR doesn't correspond to what this method |
| 318 |
expects, \fBX509_signature_dump()\fR must be used as a last resort. |
| 319 |
It MUST return 0 on error, 1 on success. |
| 320 |
It's called by \fBX509_signature_print\fR\|(3). |
| 321 |
.PP |
| 322 |
.Vb 1 |
| 323 |
\& void (*pkey_free) (EVP_PKEY *pkey); |
| 324 |
.Ve |
| 325 |
.PP |
| 326 |
The \fBpkey_free()\fR method helps freeing the internals of \fBpkey\fR. |
| 327 |
It's called by \fBEVP_PKEY_free\fR\|(3), \fBEVP_PKEY_set_type\fR\|(3), |
| 328 |
\&\fBEVP_PKEY_set_type_str\fR\|(3), and \fBEVP_PKEY_assign\fR\|(3). |
| 329 |
.PP |
| 330 |
.Vb 1 |
| 331 |
\& int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2); |
| 332 |
.Ve |
| 333 |
.PP |
| 334 |
The \fBpkey_ctrl()\fR method adds extra algorithm specific control. |
| 335 |
It's called by \fBEVP_PKEY_get_default_digest_nid\fR\|(3), |
| 336 |
\&\fBEVP_PKEY_set1_encoded_public_key\fR\|(3), |
| 337 |
\&\fBEVP_PKEY_get1_encoded_public_key\fR\|(3), \fBPKCS7_SIGNER_INFO_set\fR\|(3), |
| 338 |
\&\fBPKCS7_RECIP_INFO_set\fR\|(3), ... |
| 339 |
.PP |
| 340 |
.Vb 3 |
| 341 |
\& int (*old_priv_decode) (EVP_PKEY *pkey, |
| 342 |
\& const unsigned char **pder, int derlen); |
| 343 |
\& int (*old_priv_encode) (const EVP_PKEY *pkey, unsigned char **pder); |
| 344 |
.Ve |
| 345 |
.PP |
| 346 |
The \fBold_priv_decode()\fR and \fBold_priv_encode()\fR methods decode / encode |
| 347 |
they private key \fBpkey\fR from / to a DER formatted array. |
| 348 |
These are exclusively used to help decoding / encoding older (pre |
| 349 |
PKCS#8) PEM formatted encrypted private keys. |
| 350 |
\&\fBold_priv_decode()\fR MUST return 0 on error, 1 on success. |
| 351 |
\&\fBold_priv_encode()\fR MUST the return same kind of values as |
| 352 |
\&\fBi2d_PrivateKey()\fR. |
| 353 |
They're called by \fBd2i_PrivateKey\fR\|(3) and \fBi2d_PrivateKey\fR\|(3). |
| 354 |
.PP |
| 355 |
.Vb 5 |
| 356 |
\& int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, |
| 357 |
\& X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey); |
| 358 |
\& int (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, |
| 359 |
\& X509_ALGOR *alg1, X509_ALGOR *alg2, |
| 360 |
\& ASN1_BIT_STRING *sig); |
| 361 |
.Ve |
| 362 |
.PP |
| 363 |
The \fBitem_sign()\fR and \fBitem_verify()\fR methods make it possible to have |
| 364 |
algorithm specific signatures and verification of them. |
| 365 |
.PP |
| 366 |
\&\fBitem_sign()\fR MUST return one of: |
| 367 |
.IP <=0 4 |
| 368 |
.IX Item "<=0" |
| 369 |
error |
| 370 |
.IP 1 4 |
| 371 |
.IX Item "1" |
| 372 |
\&\fBitem_sign()\fR did everything, OpenSSL internals just needs to pass the |
| 373 |
signature length back. |
| 374 |
.IP 2 4 |
| 375 |
.IX Item "2" |
| 376 |
\&\fBitem_sign()\fR did nothing, OpenSSL internal standard routines are |
| 377 |
expected to continue with the default signature production. |
| 378 |
.IP 3 4 |
| 379 |
.IX Item "3" |
| 380 |
\&\fBitem_sign()\fR set the algorithm identifier \fBalgor1\fR and \fBalgor2\fR, |
| 381 |
OpenSSL internals should just sign using those algorithms. |
| 382 |
.PP |
| 383 |
\&\fBitem_verify()\fR MUST return one of: |
| 384 |
.IP <=0 4 |
| 385 |
.IX Item "<=0" |
| 386 |
error |
| 387 |
.IP 1 4 |
| 388 |
.IX Item "1" |
| 389 |
\&\fBitem_sign()\fR did everything, OpenSSL internals just needs to pass the |
| 390 |
signature length back. |
| 391 |
.IP 2 4 |
| 392 |
.IX Item "2" |
| 393 |
\&\fBitem_sign()\fR did nothing, OpenSSL internal standard routines are |
| 394 |
expected to continue with the default signature production. |
| 395 |
.PP |
| 396 |
\&\fBitem_verify()\fR and \fBitem_sign()\fR are called by \fBASN1_item_verify\fR\|(3) and |
| 397 |
\&\fBASN1_item_sign\fR\|(3), and by extension, \fBX509_verify\fR\|(3), |
| 398 |
\&\fBX509_REQ_verify\fR\|(3), \fBX509_sign\fR\|(3), \fBX509_REQ_sign\fR\|(3), ... |
| 399 |
.PP |
| 400 |
.Vb 2 |
| 401 |
\& int (*siginf_set) (X509_SIG_INFO *siginf, const X509_ALGOR *alg, |
| 402 |
\& const ASN1_STRING *sig); |
| 403 |
.Ve |
| 404 |
.PP |
| 405 |
The \fBsiginf_set()\fR method is used to set custom \fBX509_SIG_INFO\fR |
| 406 |
parameters. |
| 407 |
It MUST return 0 on error, or 1 on success. |
| 408 |
It's called as part of \fBX509_check_purpose\fR\|(3), \fBX509_check_ca\fR\|(3) |
| 409 |
and \fBX509_check_issued\fR\|(3). |
| 410 |
.PP |
| 411 |
.Vb 3 |
| 412 |
\& int (*pkey_check) (const EVP_PKEY *pk); |
| 413 |
\& int (*pkey_public_check) (const EVP_PKEY *pk); |
| 414 |
\& int (*pkey_param_check) (const EVP_PKEY *pk); |
| 415 |
.Ve |
| 416 |
.PP |
| 417 |
The \fBpkey_check()\fR, \fBpkey_public_check()\fR and \fBpkey_param_check()\fR methods are used |
| 418 |
to check the validity of \fBpk\fR for key-pair, public component and parameters, |
| 419 |
respectively. |
| 420 |
They MUST return 0 for an invalid key, or 1 for a valid key. |
| 421 |
They are called by \fBEVP_PKEY_check\fR\|(3), \fBEVP_PKEY_public_check\fR\|(3) and |
| 422 |
\&\fBEVP_PKEY_param_check\fR\|(3) respectively. |
| 423 |
.PP |
| 424 |
.Vb 2 |
| 425 |
\& int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len); |
| 426 |
\& int (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len); |
| 427 |
.Ve |
| 428 |
.PP |
| 429 |
The \fBset_priv_key()\fR and \fBset_pub_key()\fR methods are used to set the raw private and |
| 430 |
public key data for an EVP_PKEY. They MUST return 0 on error, or 1 on success. |
| 431 |
They are called by \fBEVP_PKEY_new_raw_private_key\fR\|(3), and |
| 432 |
\&\fBEVP_PKEY_new_raw_public_key\fR\|(3) respectively. |
| 433 |
.PP |
| 434 |
.Vb 2 |
| 435 |
\& size_t (*dirty) (const EVP_PKEY *pk); |
| 436 |
\& void *(*export_to) (const EVP_PKEY *pk, EVP_KEYMGMT *keymgmt); |
| 437 |
.Ve |
| 438 |
.PP |
| 439 |
\&\fBdirty_cnt()\fR returns the internal key's dirty count. |
| 440 |
This can be used to synchronise different copies of the same keys. |
| 441 |
.PP |
| 442 |
The \fBexport_to()\fR method exports the key material from the given key to |
| 443 |
a provider, through the \fBEVP_KEYMGMT\fR\|(3) interface, if that provider |
| 444 |
supports importing key material. |
| 445 |
.SS Functions |
| 446 |
.IX Subsection "Functions" |
| 447 |
\&\fBEVP_PKEY_asn1_new()\fR creates and returns a new \fBEVP_PKEY_ASN1_METHOD\fR |
| 448 |
object, and associates the given \fBid\fR, \fBflags\fR, \fBpem_str\fR and |
| 449 |
\&\fBinfo\fR. |
| 450 |
\&\fBid\fR is a NID, \fBpem_str\fR is the PEM type string, \fBinfo\fR is a |
| 451 |
descriptive string. |
| 452 |
The following \fBflags\fR are supported: |
| 453 |
.PP |
| 454 |
.Vb 1 |
| 455 |
\& ASN1_PKEY_SIGPARAM_NULL |
| 456 |
.Ve |
| 457 |
.PP |
| 458 |
If \fBASN1_PKEY_SIGPARAM_NULL\fR is set, then the signature algorithm |
| 459 |
parameters are given the type \fBV_ASN1_NULL\fR by default, otherwise |
| 460 |
they will be given the type \fBV_ASN1_UNDEF\fR (i.e. the parameter is |
| 461 |
omitted). |
| 462 |
See \fBX509_ALGOR_set0\fR\|(3) for more information. |
| 463 |
.PP |
| 464 |
\&\fBEVP_PKEY_asn1_copy()\fR copies an \fBEVP_PKEY_ASN1_METHOD\fR object from |
| 465 |
\&\fBsrc\fR to \fBdst\fR. |
| 466 |
This function is not thread safe, it's recommended to only use this |
| 467 |
when initializing the application. |
| 468 |
.PP |
| 469 |
\&\fBEVP_PKEY_asn1_free()\fR frees an existing \fBEVP_PKEY_ASN1_METHOD\fR pointed |
| 470 |
by \fBameth\fR. If the argument is NULL, nothing is done. |
| 471 |
.PP |
| 472 |
\&\fBEVP_PKEY_asn1_add0()\fR adds \fBameth\fR to the user defined stack of |
| 473 |
methods unless another \fBEVP_PKEY_ASN1_METHOD\fR with the same NID is |
| 474 |
already there. |
| 475 |
This function is not thread safe, it's recommended to only use this |
| 476 |
when initializing the application. |
| 477 |
.PP |
| 478 |
\&\fBEVP_PKEY_asn1_add_alias()\fR creates an alias with the NID \fBto\fR for the |
| 479 |
\&\fBEVP_PKEY_ASN1_METHOD\fR with NID \fBfrom\fR unless another |
| 480 |
\&\fBEVP_PKEY_ASN1_METHOD\fR with the same NID is already added. |
| 481 |
This function is not thread safe, it's recommended to only use this |
| 482 |
when initializing the application. |
| 483 |
.PP |
| 484 |
\&\fBEVP_PKEY_asn1_set_public()\fR, \fBEVP_PKEY_asn1_set_private()\fR, |
| 485 |
\&\fBEVP_PKEY_asn1_set_param()\fR, \fBEVP_PKEY_asn1_set_free()\fR, |
| 486 |
\&\fBEVP_PKEY_asn1_set_ctrl()\fR, \fBEVP_PKEY_asn1_set_item()\fR, |
| 487 |
\&\fBEVP_PKEY_asn1_set_siginf()\fR, \fBEVP_PKEY_asn1_set_check()\fR, |
| 488 |
\&\fBEVP_PKEY_asn1_set_public_check()\fR, \fBEVP_PKEY_asn1_set_param_check()\fR, |
| 489 |
\&\fBEVP_PKEY_asn1_set_security_bits()\fR, \fBEVP_PKEY_asn1_set_set_priv_key()\fR, |
| 490 |
\&\fBEVP_PKEY_asn1_set_set_pub_key()\fR, \fBEVP_PKEY_asn1_set_get_priv_key()\fR and |
| 491 |
\&\fBEVP_PKEY_asn1_set_get_pub_key()\fR set the diverse methods of the given |
| 492 |
\&\fBEVP_PKEY_ASN1_METHOD\fR object. |
| 493 |
.PP |
| 494 |
\&\fBEVP_PKEY_get0_asn1()\fR finds the \fBEVP_PKEY_ASN1_METHOD\fR associated |
| 495 |
with the key \fBpkey\fR. |
| 496 |
.SH "RETURN VALUES" |
| 497 |
.IX Header "RETURN VALUES" |
| 498 |
\&\fBEVP_PKEY_asn1_new()\fR returns NULL on error, or a pointer to an |
| 499 |
\&\fBEVP_PKEY_ASN1_METHOD\fR object otherwise. |
| 500 |
.PP |
| 501 |
\&\fBEVP_PKEY_asn1_add0()\fR and \fBEVP_PKEY_asn1_add_alias()\fR return 0 on error, |
| 502 |
or 1 on success. |
| 503 |
.PP |
| 504 |
\&\fBEVP_PKEY_get0_asn1()\fR returns NULL on error, or a pointer to a constant |
| 505 |
\&\fBEVP_PKEY_ASN1_METHOD\fR object otherwise. |
| 506 |
.SH HISTORY |
| 507 |
.IX Header "HISTORY" |
| 508 |
The signature of the \fIpub_decode\fR functional argument of |
| 509 |
\&\fBEVP_PKEY_asn1_set_public()\fR has changed in OpenSSL 3.0 so its \fIpub\fR |
| 510 |
parameter is now constified. |
| 511 |
.PP |
| 512 |
All of these functions were deprecated in OpenSSL 3.6. |
| 513 |
.SH COPYRIGHT |
| 514 |
.IX Header "COPYRIGHT" |
| 515 |
Copyright 2017\-2025 The OpenSSL Project Authors. All Rights Reserved. |
| 516 |
.PP |
| 517 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 518 |
this file except in compliance with the License. You can obtain a copy |
| 519 |
in the file LICENSE in the source distribution or at |
| 520 |
<https://www.openssl.org/source/license.html>. |