]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/EVP_PKEY_ASN1_METHOD.3
MFC: r340703
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / EVP_PKEY_ASN1_METHOD.3
1 .\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
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 .if !\nF .nr F 0
58 .if \nF>0 \{\
59 .    de IX
60 .    tm Index:\\$1\t\\n%\t"\\$2"
61 ..
62 .    if !\nF==2 \{\
63 .        nr % 0
64 .        nr F 2
65 .    \}
66 .\}
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "EVP_PKEY_ASN1_METHOD 3"
132 .TH EVP_PKEY_ASN1_METHOD 3 "2018-11-20" "1.1.1a" "OpenSSL"
133 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
134 .\" way too many mistakes in technical documents.
135 .if n .ad l
136 .nh
137 .SH "NAME"
138 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
139 .SH "SYNOPSIS"
140 .IX Header "SYNOPSIS"
141 .Vb 1
142 \& #include <openssl/evp.h>
143 \&
144 \& typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;
145 \&
146 \& EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags,
147 \&                                         const char *pem_str,
148 \&                                         const char *info);
149 \& void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,
150 \&                         const EVP_PKEY_ASN1_METHOD *src);
151 \& void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);
152 \& int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);
153 \& int EVP_PKEY_asn1_add_alias(int to, int from);
154 \&
155 \& void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
156 \&                               int (*pub_decode) (EVP_PKEY *pk,
157 \&                                                  X509_PUBKEY *pub),
158 \&                               int (*pub_encode) (X509_PUBKEY *pub,
159 \&                                                  const EVP_PKEY *pk),
160 \&                               int (*pub_cmp) (const EVP_PKEY *a,
161 \&                                               const EVP_PKEY *b),
162 \&                               int (*pub_print) (BIO *out,
163 \&                                                 const EVP_PKEY *pkey,
164 \&                                                 int indent, ASN1_PCTX *pctx),
165 \&                               int (*pkey_size) (const EVP_PKEY *pk),
166 \&                               int (*pkey_bits) (const EVP_PKEY *pk));
167 \& void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
168 \&                                int (*priv_decode) (EVP_PKEY *pk,
169 \&                                                    const PKCS8_PRIV_KEY_INFO
170 \&                                                    *p8inf),
171 \&                                int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8,
172 \&                                                    const EVP_PKEY *pk),
173 \&                                int (*priv_print) (BIO *out,
174 \&                                                   const EVP_PKEY *pkey,
175 \&                                                   int indent,
176 \&                                                   ASN1_PCTX *pctx));
177 \& void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
178 \&                              int (*param_decode) (EVP_PKEY *pkey,
179 \&                                                   const unsigned char **pder,
180 \&                                                   int derlen),
181 \&                              int (*param_encode) (const EVP_PKEY *pkey,
182 \&                                                   unsigned char **pder),
183 \&                              int (*param_missing) (const EVP_PKEY *pk),
184 \&                              int (*param_copy) (EVP_PKEY *to,
185 \&                                                 const EVP_PKEY *from),
186 \&                              int (*param_cmp) (const EVP_PKEY *a,
187 \&                                                const EVP_PKEY *b),
188 \&                              int (*param_print) (BIO *out,
189 \&                                                  const EVP_PKEY *pkey,
190 \&                                                  int indent,
191 \&                                                  ASN1_PCTX *pctx));
192 \&
193 \& void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
194 \&                             void (*pkey_free) (EVP_PKEY *pkey));
195 \& void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
196 \&                             int (*pkey_ctrl) (EVP_PKEY *pkey, int op,
197 \&                                               long arg1, void *arg2));
198 \& void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth,
199 \&                             int (*item_verify) (EVP_MD_CTX *ctx,
200 \&                                                 const ASN1_ITEM *it,
201 \&                                                 void *asn,
202 \&                                                 X509_ALGOR *a,
203 \&                                                 ASN1_BIT_STRING *sig,
204 \&                                                 EVP_PKEY *pkey),
205 \&                             int (*item_sign) (EVP_MD_CTX *ctx,
206 \&                                               const ASN1_ITEM *it,
207 \&                                               void *asn,
208 \&                                               X509_ALGOR *alg1,
209 \&                                               X509_ALGOR *alg2,
210 \&                                               ASN1_BIT_STRING *sig));
211 \&
212 \& void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth,
213 \&                               int (*siginf_set) (X509_SIG_INFO *siginf,
214 \&                                                  const X509_ALGOR *alg,
215 \&                                                  const ASN1_STRING *sig));
216 \&
217 \& void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth,
218 \&                              int (*pkey_check) (const EVP_PKEY *pk));
219 \&
220 \& void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth,
221 \&                                     int (*pkey_pub_check) (const EVP_PKEY *pk));
222 \&
223 \& void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth,
224 \&                                    int (*pkey_param_check) (const EVP_PKEY *pk));
225 \&
226 \& void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth,
227 \&                                      int (*pkey_security_bits) (const EVP_PKEY
228 \&                                                                 *pk));
229 \&
230 \& void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth,
231 \&                                     int (*set_priv_key) (EVP_PKEY *pk,
232 \&                                                          const unsigned char
233 \&                                                             *priv,
234 \&                                                          size_t len));
235 \&
236 \& void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth,
237 \&                                    int (*set_pub_key) (EVP_PKEY *pk,
238 \&                                                        const unsigned char *pub,
239 \&                                                        size_t len));
240 \&
241 \& void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth,
242 \&                                     int (*get_priv_key) (const EVP_PKEY *pk,
243 \&                                                          unsigned char *priv,
244 \&                                                          size_t *len));
245 \&
246 \& void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth,
247 \&                                    int (*get_pub_key) (const EVP_PKEY *pk,
248 \&                                                        unsigned char *pub,
249 \&                                                        size_t *len));
250 \&
251 \& const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey);
252 .Ve
253 .SH "DESCRIPTION"
254 .IX Header "DESCRIPTION"
255 \&\fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR is a structure which holds a set of \s-1ASN.1\s0
256 conversion, printing and information methods for a specific public key
257 algorithm.
258 .PP
259 There are two places where the \fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR objects are
260 stored: one is a built-in array representing the standard methods for
261 different algorithms, and the other one is a stack of user-defined
262 application-specific methods, which can be manipulated by using
263 \&\fIEVP_PKEY_asn1_add0\fR\|(3).
264 .SS "Methods"
265 .IX Subsection "Methods"
266 The methods are the underlying implementations of a particular public
267 key algorithm present by the \fB\s-1EVP_PKEY\s0\fR object.
268 .PP
269 .Vb 5
270 \& int (*pub_decode) (EVP_PKEY *pk, X509_PUBKEY *pub);
271 \& int (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk);
272 \& int (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);
273 \& int (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent,
274 \&                   ASN1_PCTX *pctx);
275 .Ve
276 .PP
277 The \fIpub_decode()\fR and \fIpub_encode()\fR methods are called to decode /
278 encode \fBX509_PUBKEY\fR \s-1ASN.1\s0 parameters to / from \fBpk\fR.
279 They \s-1MUST\s0 return 0 on error, 1 on success.
280 They're called by \fIX509_PUBKEY_get0\fR\|(3) and \fIX509_PUBKEY_set\fR\|(3).
281 .PP
282 The \fIpub_cmp()\fR method is called when two public keys are to be
283 compared.
284 It \s-1MUST\s0 return 1 when the keys are equal, 0 otherwise.
285 It's called by \fIEVP_PKEY_cmp\fR\|(3).
286 .PP
287 The \fIpub_print()\fR method is called to print a public key in humanly
288 readable text to \fBout\fR, indented \fBindent\fR spaces.
289 It \s-1MUST\s0 return 0 on error, 1 on success.
290 It's called by \fIEVP_PKEY_print_public\fR\|(3).
291 .PP
292 .Vb 4
293 \& int (*priv_decode) (EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);
294 \& int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
295 \& int (*priv_print) (BIO *out, const EVP_PKEY *pkey, int indent,
296 \&                    ASN1_PCTX *pctx);
297 .Ve
298 .PP
299 The \fIpriv_decode()\fR and \fIpriv_encode()\fR methods are called to decode /
300 encode \fB\s-1PKCS8_PRIV_KEY_INFO\s0\fR form private key to / from \fBpk\fR.
301 They \s-1MUST\s0 return 0 on error, 1 on success.
302 They're called by \s-1\fIEVP_PKCS82PKEY\s0\fR\|(3) and \s-1\fIEVP_PKEY2PKCS8\s0\fR\|(3).
303 .PP
304 The \fIpriv_print()\fR method is called to print a private key in humanly
305 readable text to \fBout\fR, indented \fBindent\fR spaces.
306 It \s-1MUST\s0 return 0 on error, 1 on success.
307 It's called by \fIEVP_PKEY_print_private\fR\|(3).
308 .PP
309 .Vb 3
310 \& int (*pkey_size) (const EVP_PKEY *pk);
311 \& int (*pkey_bits) (const EVP_PKEY *pk);
312 \& int (*pkey_security_bits) (const EVP_PKEY *pk);
313 .Ve
314 .PP
315 The \fIpkey_size()\fR method returns the key size in bytes.
316 It's called by \fIEVP_PKEY_size\fR\|(3).
317 .PP
318 The \fIpkey_bits()\fR method returns the key size in bits.
319 It's called by \fIEVP_PKEY_bits\fR\|(3).
320 .PP
321 .Vb 8
322 \& int (*param_decode) (EVP_PKEY *pkey,
323 \&                      const unsigned char **pder, int derlen);
324 \& int (*param_encode) (const EVP_PKEY *pkey, unsigned char **pder);
325 \& int (*param_missing) (const EVP_PKEY *pk);
326 \& int (*param_copy) (EVP_PKEY *to, const EVP_PKEY *from);
327 \& int (*param_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);
328 \& int (*param_print) (BIO *out, const EVP_PKEY *pkey, int indent,
329 \&                     ASN1_PCTX *pctx);
330 .Ve
331 .PP
332 The \fIparam_decode()\fR and \fIparam_encode()\fR methods are called to decode /
333 encode \s-1DER\s0 formatted parameters to / from \fBpk\fR.
334 They \s-1MUST\s0 return 0 on error, 1 on success.
335 They're called by \fIPEM_read_bio_Parameters\fR\|(3) and the \fBfile:\fR
336 \&\s-1\fIOSSL_STORE_LOADER\s0\fR\|(3).
337 .PP
338 The \fIparam_missing()\fR method returns 0 if a key parameter is missing,
339 otherwise 1.
340 It's called by \fIEVP_PKEY_missing_parameters\fR\|(3).
341 .PP
342 The \fIparam_copy()\fR method copies key parameters from \fBfrom\fR to \fBto\fR.
343 It \s-1MUST\s0 return 0 on error, 1 on success.
344 It's called by \fIEVP_PKEY_copy_parameters\fR\|(3).
345 .PP
346 The \fIparam_cmp()\fR method compares the parameters of keys \fBa\fR and \fBb\fR.
347 It \s-1MUST\s0 return 1 when the keys are equal, 0 when not equal, or a
348 negative number on error.
349 It's called by \fIEVP_PKEY_cmp_parameters\fR\|(3).
350 .PP
351 The \fIparam_print()\fR method prints the private key parameters in humanly
352 readable text to \fBout\fR, indented \fBindent\fR spaces.
353 It \s-1MUST\s0 return 0 on error, 1 on success.
354 It's called by \fIEVP_PKEY_print_params\fR\|(3).
355 .PP
356 .Vb 3
357 \& int (*sig_print) (BIO *out,
358 \&                   const X509_ALGOR *sigalg, const ASN1_STRING *sig,
359 \&                   int indent, ASN1_PCTX *pctx);
360 .Ve
361 .PP
362 The \fIsig_print()\fR method prints a signature in humanly readable text to
363 \&\fBout\fR, indented \fBindent\fR spaces.
364 \&\fBsigalg\fR contains the exact signature algorithm.
365 If the signature in \fBsig\fR doesn't correspond to what this method
366 expects, \fIX509_signature_dump()\fR must be used as a last resort.
367 It \s-1MUST\s0 return 0 on error, 1 on success.
368 It's called by \fIX509_signature_print\fR\|(3).
369 .PP
370 .Vb 1
371 \& void (*pkey_free) (EVP_PKEY *pkey);
372 .Ve
373 .PP
374 The \fIpkey_free()\fR method helps freeing the internals of \fBpkey\fR.
375 It's called by \fIEVP_PKEY_free\fR\|(3), \fIEVP_PKEY_set_type\fR\|(3),
376 \&\fIEVP_PKEY_set_type_str\fR\|(3), and \fIEVP_PKEY_assign\fR\|(3).
377 .PP
378 .Vb 1
379 \& int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2);
380 .Ve
381 .PP
382 The \fIpkey_ctrl()\fR method adds extra algorithm specific control.
383 It's called by \fIEVP_PKEY_get_default_digest_nid\fR\|(3),
384 \&\fIEVP_PKEY_set1_tls_encodedpoint\fR\|(3),
385 \&\fIEVP_PKEY_get1_tls_encodedpoint\fR\|(3), \fIPKCS7_SIGNER_INFO_set\fR\|(3),
386 \&\fIPKCS7_RECIP_INFO_set\fR\|(3), ...
387 .PP
388 .Vb 3
389 \& int (*old_priv_decode) (EVP_PKEY *pkey,
390 \&                         const unsigned char **pder, int derlen);
391 \& int (*old_priv_encode) (const EVP_PKEY *pkey, unsigned char **pder);
392 .Ve
393 .PP
394 The \fIold_priv_decode()\fR and \fIold_priv_encode()\fR methods decode / encode
395 they private key \fBpkey\fR from / to a \s-1DER\s0 formatted array.
396 These are exclusively used to help decoding / encoding older (pre
397 PKCS#8) \s-1PEM\s0 formatted encrypted private keys.
398 \&\fIold_priv_decode()\fR \s-1MUST\s0 return 0 on error, 1 on success.
399 \&\fIold_priv_encode()\fR \s-1MUST\s0 the return same kind of values as
400 \&\fIi2d_PrivateKey()\fR.
401 They're called by \fId2i_PrivateKey\fR\|(3) and \fIi2d_PrivateKey\fR\|(3).
402 .PP
403 .Vb 5
404 \& int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
405 \&                     X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);
406 \& int (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
407 \&                   X509_ALGOR *alg1, X509_ALGOR *alg2,
408 \&                   ASN1_BIT_STRING *sig);
409 .Ve
410 .PP
411 The \fIitem_sign()\fR and  \fIitem_verify()\fR methods make it possible to have
412 algorithm specific signatures and verification of them.
413 .PP
414 \&\fIitem_sign()\fR \s-1MUST\s0 return one of:
415 .IP "<=0" 4
416 .IX Item "<=0"
417 error
418 .IP "1" 4
419 .IX Item "1"
420 \&\fIitem_sign()\fR did everything, OpenSSL internals just needs to pass the
421 signature length back.
422 .IP "2" 4
423 .IX Item "2"
424 \&\fIitem_sign()\fR did nothing, OpenSSL internal standard routines are
425 expected to continue with the default signature production.
426 .IP "3" 4
427 .IX Item "3"
428 \&\fIitem_sign()\fR set the algorithm identifier \fBalgor1\fR and \fBalgor2\fR,
429 OpenSSL internals should just sign using those algorithms.
430 .PP
431 \&\fIitem_verify()\fR \s-1MUST\s0 return one of:
432 .IP "<=0" 4
433 .IX Item "<=0"
434 error
435 .IP "1" 4
436 .IX Item "1"
437 \&\fIitem_sign()\fR did everything, OpenSSL internals just needs to pass the
438 signature length back.
439 .IP "2" 4
440 .IX Item "2"
441 \&\fIitem_sign()\fR did nothing, OpenSSL internal standard routines are
442 expected to continue with the default signature production.
443 .PP
444 \&\fIitem_verify()\fR and \fIitem_sign()\fR are called by \fIASN1_item_verify\fR\|(3) and
445 \&\fIASN1_item_sign\fR\|(3), and by extension, \fIX509_verify\fR\|(3),
446 \&\fIX509_REQ_verify\fR\|(3), \fIX509_sign\fR\|(3), \fIX509_REQ_sign\fR\|(3), ...
447 .PP
448 .Vb 2
449 \& int (*siginf_set) (X509_SIG_INFO *siginf, const X509_ALGOR *alg,
450 \&                    const ASN1_STRING *sig);
451 .Ve
452 .PP
453 The \fIsiginf_set()\fR method is used to set custom \fBX509_SIG_INFO\fR
454 parameters.
455 It \s-1MUST\s0 return 0 on error, or 1 on success.
456 It's called as part of \fIX509_check_purpose\fR\|(3), \fIX509_check_ca\fR\|(3)
457 and \fIX509_check_issued\fR\|(3).
458 .PP
459 .Vb 3
460 \& int (*pkey_check) (const EVP_PKEY *pk);
461 \& int (*pkey_public_check) (const EVP_PKEY *pk);
462 \& int (*pkey_param_check) (const EVP_PKEY *pk);
463 .Ve
464 .PP
465 The \fIpkey_check()\fR, \fIpkey_public_check()\fR and \fIpkey_param_check()\fR methods are used
466 to check the validity of \fBpk\fR for key-pair, public component and parameters,
467 respectively.
468 They \s-1MUST\s0 return 0 for an invalid key, or 1 for a valid key.
469 They are called by \fIEVP_PKEY_check\fR\|(3), \fIEVP_PKEY_public_check\fR\|(3) and
470 \&\fIEVP_PKEY_param_check\fR\|(3) respectively.
471 .PP
472 .Vb 2
473 \& int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len);
474 \& int (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len);
475 .Ve
476 .PP
477 The \fIset_priv_key()\fR and \fIset_pub_key()\fR methods are used to set the raw private and
478 public key data for an \s-1EVP_PKEY.\s0 They \s-1MUST\s0 return 0 on error, or 1 on success.
479 They are called by \fIEVP_PKEY_new_raw_private_key\fR\|(3), and
480 \&\fIEVP_PKEY_new_raw_public_key\fR\|(3) respectively.
481 .SS "Functions"
482 .IX Subsection "Functions"
483 \&\fIEVP_PKEY_asn1_new()\fR creates and returns a new \fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR
484 object, and associates the given \fBid\fR, \fBflags\fR, \fBpem_str\fR and
485 \&\fBinfo\fR.
486 \&\fBid\fR is a \s-1NID,\s0 \fBpem_str\fR is the \s-1PEM\s0 type string, \fBinfo\fR is a
487 descriptive string.
488 The following \fBflags\fR are supported:
489 .PP
490 .Vb 1
491 \& ASN1_PKEY_SIGPARAM_NULL
492 .Ve
493 .PP
494 If \fB\s-1ASN1_PKEY_SIGPARAM_NULL\s0\fR is set, then the signature algorithm
495 parameters are given the type \fBV_ASN1_NULL\fR by default, otherwise
496 they will be given the type \fBV_ASN1_UNDEF\fR (i.e. the parameter is
497 omitted).
498 See \fIX509_ALGOR_set0\fR\|(3) for more information.
499 .PP
500 \&\fIEVP_PKEY_asn1_copy()\fR copies an \fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR object from
501 \&\fBsrc\fR to \fBdst\fR.
502 This function is not thread safe, it's recommended to only use this
503 when initializing the application.
504 .PP
505 \&\fIEVP_PKEY_asn1_free()\fR frees an existing \fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR pointed
506 by \fBameth\fR.
507 .PP
508 \&\fIEVP_PKEY_asn1_add0()\fR adds \fBameth\fR to the user defined stack of
509 methods unless another \fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR with the same \s-1NID\s0 is
510 already there.
511 This function is not thread safe, it's recommended to only use this
512 when initializing the application.
513 .PP
514 \&\fIEVP_PKEY_asn1_add_alias()\fR creates an alias with the \s-1NID\s0 \fBto\fR for the
515 \&\fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR with \s-1NID\s0 \fBfrom\fR unless another
516 \&\fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR with the same \s-1NID\s0 is already added.
517 This function is not thread safe, it's recommended to only use this
518 when initializing the application.
519 .PP
520 \&\fIEVP_PKEY_asn1_set_public()\fR, \fIEVP_PKEY_asn1_set_private()\fR,
521 \&\fIEVP_PKEY_asn1_set_param()\fR, \fIEVP_PKEY_asn1_set_free()\fR,
522 \&\fIEVP_PKEY_asn1_set_ctrl()\fR, \fIEVP_PKEY_asn1_set_item()\fR,
523 \&\fIEVP_PKEY_asn1_set_siginf()\fR, \fIEVP_PKEY_asn1_set_check()\fR,
524 \&\fIEVP_PKEY_asn1_set_public_check()\fR, \fIEVP_PKEY_asn1_set_param_check()\fR,
525 \&\fIEVP_PKEY_asn1_set_security_bits()\fR, \fIEVP_PKEY_asn1_set_set_priv_key()\fR,
526 \&\fIEVP_PKEY_asn1_set_set_pub_key()\fR, \fIEVP_PKEY_asn1_set_get_priv_key()\fR and
527 \&\fIEVP_PKEY_asn1_set_get_pub_key()\fR set the diverse methods of the given
528 \&\fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR object.
529 .PP
530 \&\fIEVP_PKEY_get0_asn1()\fR finds the \fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR associated
531 with the key \fBpkey\fR.
532 .SH "RETURN VALUES"
533 .IX Header "RETURN VALUES"
534 \&\fIEVP_PKEY_asn1_new()\fR returns \s-1NULL\s0 on error, or a pointer to an
535 \&\fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR object otherwise.
536 .PP
537 \&\fIEVP_PKEY_asn1_add0()\fR and \fIEVP_PKEY_asn1_add_alias()\fR return 0 on error,
538 or 1 on success.
539 .PP
540 \&\fIEVP_PKEY_get0_asn1()\fR returns \s-1NULL\s0 on error, or a pointer to a constant
541 \&\fB\s-1EVP_PKEY_ASN1_METHOD\s0\fR object otherwise.
542 .SH "COPYRIGHT"
543 .IX Header "COPYRIGHT"
544 Copyright 2017\-2018 The OpenSSL Project Authors. All Rights Reserved.
545 .PP
546 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
547 this file except in compliance with the License.  You can obtain a copy
548 in the file \s-1LICENSE\s0 in the source distribution or at
549 <https://www.openssl.org/source/license.html>.