1 .\" $OpenBSD: d2i_ECPKParameters.3,v 1.11 2018/03/23 00:09:11 schwarze Exp $
2 .\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400
4 .\" This file is a derived work.
5 .\" The changes are covered by the following Copyright and license:
7 .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
9 .\" Permission to use, copy, modify, and distribute this software for any
10 .\" purpose with or without fee is hereby granted, provided that the above
11 .\" copyright notice and this permission notice appear in all copies.
13 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 .\" The original file was written by Matt Caswell <matt@openssl.org>.
22 .\" Copyright (c) 2013, 2015 The OpenSSL Project. All rights reserved.
24 .\" Redistribution and use in source and binary forms, with or without
25 .\" modification, are permitted provided that the following conditions
28 .\" 1. Redistributions of source code must retain the above copyright
29 .\" notice, this list of conditions and the following disclaimer.
31 .\" 2. Redistributions in binary form must reproduce the above copyright
32 .\" notice, this list of conditions and the following disclaimer in
33 .\" the documentation and/or other materials provided with the
36 .\" 3. All advertising materials mentioning features or use of this
37 .\" software must display the following acknowledgment:
38 .\" "This product includes software developed by the OpenSSL Project
39 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
41 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42 .\" endorse or promote products derived from this software without
43 .\" prior written permission. For written permission, please contact
44 .\" openssl-core@openssl.org.
46 .\" 5. Products derived from this software may not be called "OpenSSL"
47 .\" nor may "OpenSSL" appear in their names without prior written
48 .\" permission of the OpenSSL Project.
50 .\" 6. Redistributions of any form whatsoever must retain the following
52 .\" "This product includes software developed by the OpenSSL Project
53 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
55 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
59 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
68 .Dd $Mdocdate: March 23 2018 $
69 .Dt D2I_ECPKPARAMETERS 3
72 .Nm d2i_ECPKParameters ,
73 .Nm i2d_ECPKParameters ,
74 .Nm d2i_ECPKParameters_bio ,
75 .Nm i2d_ECPKParameters_bio ,
76 .Nm d2i_ECPKParameters_fp ,
77 .Nm i2d_ECPKParameters_fp ,
78 .Nm d2i_ECParameters ,
79 .Nm i2d_ECParameters ,
80 .Nm ECParameters_dup ,
81 .Nm d2i_ECPrivateKey ,
82 .Nm i2d_ECPrivateKey ,
83 .Nm d2i_ECPrivateKey_bio ,
84 .Nm i2d_ECPrivateKey_bio ,
85 .Nm d2i_ECPrivateKey_fp ,
86 .Nm i2d_ECPrivateKey_fp ,
89 .Nm ECPKParameters_print ,
90 .Nm ECPKParameters_print_fp ,
91 .Nm ECParameters_print ,
92 .Nm ECParameters_print_fp ,
95 .Nm d2i_EC_PUBKEY_bio ,
96 .Nm i2d_EC_PUBKEY_bio ,
97 .Nm d2i_EC_PUBKEY_fp ,
99 .Nd decode and encode ASN.1 representations of elliptic curve entities
103 .Fo d2i_ECPKParameters
104 .Fa "EC_GROUP **val_out"
105 .Fa "const unsigned char **des_in"
109 .Fo i2d_ECPKParameters
110 .Fa "const EC_GROUP *val_in"
111 .Fa "unsigned char **des_out"
114 .Fo d2i_ECPKParameters_bio
116 .Fa "EC_GROUP **val_out"
119 .Fo i2d_ECPKParameters_bio
121 .Fa "EC_GROUP *val_in"
124 .Fo d2i_ECPKParameters_fp
126 .Fa "EC_GROUP **val_out"
129 .Fo i2d_ECPKParameters_fp
131 .Fa "EC_GROUP *val_in"
135 .Fa "EC_KEY **val_out"
136 .Fa "const unsigned char **des_in"
142 .Fa "unsigned char **des_out"
150 .Fa "EC_KEY **val_out"
151 .Fa "const unsigned char **des_in"
157 .Fa "unsigned char **des_out"
160 .Fo d2i_ECPrivateKey_bio
162 .Fa "EC_KEY **val_out"
165 .Fo i2d_ECPrivateKey_bio
170 .Fo d2i_ECPrivateKey_fp
172 .Fa "EC_KEY **val_out"
175 .Fo i2d_ECPrivateKey_fp
181 .Fa "EC_KEY **val_out"
182 .Fa "const unsigned char **des_in"
188 .Fa "unsigned char **des_out"
191 .Fo ECPKParameters_print
193 .Fa "const EC_GROUP *val_in"
197 .Fo ECPKParameters_print_fp
199 .Fa "const EC_GROUP *val_in"
203 .Fo ECParameters_print
205 .Fa "const EC_KEY *val_in"
208 .Fo ECParameters_print_fp
210 .Fa "const EC_KEY *val_in"
215 .Fa "EC_KEY **val_out"
216 .Fa "const unsigned char **des_in"
222 .Fa "unsigned char **des_out"
225 .Fo d2i_EC_PUBKEY_bio
227 .Fa "EC_KEY **val_out"
230 .Fo i2d_EC_PUBKEY_bio
237 .Fa "EC_KEY **val_out"
245 These functions decode and encode elliptic curve keys and parameters.
246 For details about the semantics, examples, caveats, and bugs, see
247 .Xr ASN1_item_d2i 3 .
249 .Fn d2i_ECPKParameters
251 .Fn i2d_ECPKParameters
252 decode and encode the parameters of an elliptic curve.
253 .Fn d2i_ECPKParameters_bio ,
254 .Fn i2d_ECPKParameters_bio ,
255 .Fn d2i_ECPKParameters_fp ,
257 .Fn i2d_ECPKParameters_fp
258 are similar except that they decode or encode using a
263 These four functions are currently implemented as macros.
266 does the same parsing as
267 .Fn d2i_ECPKParameters
268 but saves the result in the
275 produces the same output as
276 .Fn i2d_ECPKParameters
283 allocates and initializes an empty
285 object and copies the EC parameters from
290 .Fn d2i_ECParameters .
291 If a private or public key or any flags are present in
298 decode and encode an EC private key using an ASN.1
300 structure defined in RFC 5915 section 3 and used for the privateKey
303 structure defined in RFC 5208 section 5, see
304 .Xr PKCS8_PRIV_KEY_INFO_new 3 .
305 .Fn d2i_ECPrivateKey_bio ,
306 .Fn i2d_ECPrivateKey_bio ,
307 .Fn d2i_ECPrivateKey_fp ,
309 .Fn i2d_ECPrivateKey_fp
310 are similar except that they decode or encode using a
319 decode and encode an EC public key.
321 .Xr ASN1_item_d2i 3 ,
327 .Po Pf * Fa val_out Pc Ns -> Ns Fa group
331 .Fn ECPKParameters_print
333 .Fn ECPKParameters_print_fp
334 print human-readable output of the public parameters of the
340 The output lines are indented by
344 .Fn ECParameters_print
346 .Fn ECParameters_print_fp
347 print the parameter components of
357 decode and encode an EC public key using an ASN.1
358 .Vt SubjectPublicKeyInfo
359 structure defined in RFC 5280 section 4.1 and documented in
360 .Xr X509_PUBKEY_new 3 .
361 .Fn d2i_EC_PUBKEY_bio ,
362 .Fn i2d_EC_PUBKEY_bio ,
363 .Fn d2i_EC_PUBKEY_fp ,
366 are similar except that they decode or encode using a
372 .Fn d2i_ECPKParameters ,
373 .Fn d2i_ECPKParameters_bio ,
375 .Fn d2i_ECPKParameters_fp
382 .Fn d2i_ECParameters ,
383 .Fn ECParameters_dup ,
384 .Fn d2i_ECPrivateKey ,
385 .Fn d2i_ECPrivateKey_bio ,
386 .Fn d2i_ECPrivateKey_fp ,
387 .Fn o2i_ECPublicKey ,
389 .Fn d2i_EC_PUBKEY_bio ,
398 .Fn i2d_ECPKParameters ,
399 .Fn i2d_ECParameters ,
400 .Fn i2d_ECPrivateKey ,
401 .Fn i2o_ECPublicKey ,
404 return the number of bytes successfully encoded or a negative value if
407 .Fn i2d_ECPKParameters_bio ,
408 .Fn i2d_ECPKParameters_fp ,
409 .Fn i2d_ECPrivateKey_bio ,
410 .Fn i2d_ECPrivateKey_fp ,
411 .Fn ECPKParameters_print ,
412 .Fn ECPKParameters_print_fp ,
413 .Fn ECParameters_print ,
414 .Fn ECParameters_print_fp ,
415 .Fn i2d_EC_PUBKEY_bio ,
418 return 1 for success or 0 if an error occurs.
420 .Xr ASN1_item_d2i 3 ,
421 .Xr EC_GROUP_copy 3 ,
424 .Xr EVP_PKEY_set1_EC_KEY 3 ,
425 .Xr PEM_write_ECPrivateKey 3 ,
426 .Xr PKCS8_PRIV_KEY_INFO_new 3 ,
427 .Xr X509_PUBKEY_new 3
429 RFC 5915: Elliptic Curve Private Key Structure
431 RFC 5208: Public-Key Cryptography Standards (PKCS) #8:
432 Private-Key Information Syntax Specification
434 RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
435 Certificate Revocation List (CRL) Profile,
436 section 4.1: Basic Certificate Fields
438 .Fn d2i_ECPKParameters ,
439 .Fn i2d_ECPKParameters ,
440 .Fn d2i_ECPKParameters_bio ,
441 .Fn i2d_ECPKParameters_bio ,
442 .Fn d2i_ECPKParameters_fP ,
443 .Fn i2d_ECPKParameters_fp ,
444 .Fn d2i_ECParameters ,
445 .Fn i2d_ECParameters ,
446 .Fn ECParameters_dup ,
447 .Fn d2i_ECPrivateKey ,
448 .Fn i2d_ECPrivateKey ,
449 .Fn d2i_ECPrivateKey_bio ,
450 .Fn i2d_ECPrivateKey_bio ,
451 .Fn d2i_ECPrivateKey_fp ,
452 .Fn i2d_ECPrivateKey_fp ,
453 .Fn o2i_ECPublicKey ,
454 .Fn i2o_ECPublicKey ,
455 .Fn ECPKParameters_print ,
456 .Fn ECPKParameters_print_fp ,
457 .Fn ECParameters_print ,
458 .Fn ECParameters_print_fp ,
461 .Fn d2i_EC_PUBKEY_bio ,
462 .Fn i2d_EC_PUBKEY_bio ,
463 .Fn d2i_EC_PUBKEY_fp ,
466 first appeared in OpenSSL 0.9.8 and have been available since