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