File: //usr/local/openssl/man/man3/i2d_ECPrivateKey.3
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "d2i_ECPrivateKey 3"
.TH d2i_ECPrivateKey 3 2019-12-20 1.0.2u OpenSSL
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
i2d_ECPrivateKey, d2i_ECPrivate_key \- Encode and decode functions for saving and
reading EC_KEY structures
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 1
\& #include <openssl/ec.h>
\&
\& EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);
\& int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out);
\&
\& unsigned int EC_KEY_get_enc_flags(const EC_KEY *key);
\& void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
The ECPrivateKey encode and decode routines encode and parse an
\&\fBEC_KEY\fR structure into a binary format (ASN.1 DER) and back again.
.PP
These functions are similar to the \fBd2i_X509()\fR functions, and you should refer to
that page for a detailed description (see \fBd2i_X509\fR\|(3)).
.PP
The format of the external representation of the public key written by
i2d_ECPrivateKey (such as whether it is stored in a compressed form or not) is
described by the point_conversion_form. See \fBEC_GROUP_copy\fR\|(3)
for a description of point_conversion_form.
.PP
When reading a private key encoded without an associated public key (e.g. if
EC_PKEY_NO_PUBKEY has been used \- see below), then d2i_ECPrivateKey generates
the missing public key automatically. Private keys encoded without parameters
(e.g. if EC_PKEY_NO_PARAMETERS has been used \- see below) cannot be loaded using
d2i_ECPrivateKey.
.PP
The functions EC_KEY_get_enc_flags and EC_KEY_set_enc_flags get and set the
value of the encoding flags for the \fBkey\fR. There are two encoding flags
currently defined \- EC_PKEY_NO_PARAMETERS and EC_PKEY_NO_PUBKEY. These flags
define the behaviour of how the \fBkey\fR is converted into ASN1 in a call to
i2d_ECPrivateKey. If EC_PKEY_NO_PARAMETERS is set then the public parameters for
the curve are not encoded along with the private key. If EC_PKEY_NO_PUBKEY is
set then the public key is not encoded along with the private key.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
\&\fBd2i_ECPrivateKey()\fR returns a valid \fBEC_KEY\fR structure or \fBNULL\fR if an error
occurs. The error code that can be obtained by
\&\fBERR_get_error\fR\|(3).
.PP
\&\fBi2d_ECPrivateKey()\fR returns the number of bytes successfully encoded or a
negative value if an error occurs. The error code can be obtained by
\&\fBERR_get_error\fR\|(3).
.PP
EC_KEY_get_enc_flags returns the value of the current encoding flags for the
EC_KEY.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBcrypto\fR\|(3), \fBec\fR\|(3), \fBEC_GROUP_new\fR\|(3),
\&\fBEC_GROUP_copy\fR\|(3), \fBEC_POINT_new\fR\|(3),
\&\fBEC_POINT_add\fR\|(3),
\&\fBEC_GFp_simple_method\fR\|(3),
\&\fBd2i_ECPKParameters\fR\|(3),
\&\fBd2i_ECPrivateKey\fR\|(3)