]>
Commit | Line | Data |
---|---|---|
93b83d06 MC |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
5 | i2d_ECPrivateKey, d2i_ECPrivate_key - Encode and decode functions for saving and | |
6 | reading EC_KEY structures | |
7 | ||
8 | =head1 SYNOPSIS | |
9 | ||
10 | #include <openssl/ec.h> | |
11 | ||
12 | EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len); | |
13 | int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out); | |
14 | ||
15 | unsigned int EC_KEY_get_enc_flags(const EC_KEY *key); | |
16 | void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); | |
17 | ||
18 | =head1 DESCRIPTION | |
19 | ||
20 | The ECPrivateKey encode and decode routines encode and parse an | |
21 | B<EC_KEY> structure into a binary format (ASN.1 DER) and back again. | |
22 | ||
23 | These functions are similar to the d2i_X509() functions, and you should refer to | |
9b86974e | 24 | that page for a detailed description (see L<d2i_X509(3)>). |
93b83d06 MC |
25 | |
26 | The format of the external representation of the public key written by | |
27 | i2d_ECPrivateKey (such as whether it is stored in a compressed form or not) is | |
9b86974e | 28 | described by the point_conversion_form. See L<EC_GROUP_copy(3)> |
93b83d06 MC |
29 | for a description of point_conversion_form. |
30 | ||
31 | When reading a private key encoded without an associated public key (e.g. if | |
32 | EC_PKEY_NO_PUBKEY has been used - see below), then d2i_ECPrivateKey generates | |
33 | the missing public key automatically. Private keys encoded without parameters | |
12e0ea30 MC |
34 | (e.g. if EC_PKEY_NO_PARAMETERS has been used - see below) cannot be loaded using |
35 | d2i_ECPrivateKey. | |
93b83d06 MC |
36 | |
37 | The functions EC_KEY_get_enc_flags and EC_KEY_set_enc_flags get and set the | |
38 | value of the encoding flags for the B<key>. There are two encoding flags | |
39 | currently defined - EC_PKEY_NO_PARAMETERS and EC_PKEY_NO_PUBKEY. These flags | |
40 | define the behaviour of how the B<key> is converted into ASN1 in a call to | |
41 | i2d_ECPrivateKey. If EC_PKEY_NO_PARAMETERS is set then the public parameters for | |
42 | the curve are not encoded along with the private key. If EC_PKEY_NO_PUBKEY is | |
43 | set then the public key is not encoded along with the private key. | |
44 | ||
45 | =head1 RETURN VALUES | |
46 | ||
47 | d2i_ECPrivateKey() returns a valid B<EC_KEY> structure or B<NULL> if an error | |
48 | occurs. The error code that can be obtained by | |
9b86974e | 49 | L<ERR_get_error(3)>. |
93b83d06 MC |
50 | |
51 | i2d_ECPrivateKey() returns the number of bytes successfully encoded or a | |
52 | negative value if an error occurs. The error code can be obtained by | |
9b86974e | 53 | L<ERR_get_error(3)>. |
93b83d06 MC |
54 | |
55 | EC_KEY_get_enc_flags returns the value of the current encoding flags for the | |
56 | EC_KEY. | |
57 | ||
58 | =head1 SEE ALSO | |
59 | ||
9b86974e RS |
60 | L<crypto(3)>, L<ec(3)>, L<EC_GROUP_new(3)>, |
61 | L<EC_GROUP_copy(3)>, L<EC_POINT_new(3)>, | |
62 | L<EC_POINT_add(3)>, | |
63 | L<EC_GFp_simple_method(3)>, | |
64 | L<d2i_ECPKParameters(3)>, | |
65 | L<d2i_ECPrivateKey(3)> | |
93b83d06 MC |
66 | |
67 | =cut |