NAME
d2i_ECPKParameters
,
i2d_ECPKParameters
,
d2i_ECPKParameters_bio
,
i2d_ECPKParameters_bio
,
d2i_ECPKParameters_fp
,
i2d_ECPKParameters_fp
,
d2i_ECParameters
,
i2d_ECParameters
,
ECParameters_dup
,
d2i_ECPrivateKey
,
i2d_ECPrivateKey
,
d2i_ECPrivateKey_bio
,
i2d_ECPrivateKey_bio
,
d2i_ECPrivateKey_fp
,
i2d_ECPrivateKey_fp
,
o2i_ECPublicKey
,
i2o_ECPublicKey
,
ECPKParameters_print
,
ECPKParameters_print_fp
,
ECParameters_print
,
ECParameters_print_fp
,
d2i_EC_PUBKEY
,
i2d_EC_PUBKEY
,
d2i_EC_PUBKEY_bio
,
i2d_EC_PUBKEY_bio
,
d2i_EC_PUBKEY_fp
,
i2d_EC_PUBKEY_fp
—
decode and encode ASN.1 representations
of elliptic curve entities
SYNOPSIS
#include
<openssl/ec.h>
EC_GROUP *
d2i_ECPKParameters
(EC_GROUP
**val_out, const unsigned char **des_in,
long length);
int
i2d_ECPKParameters
(const EC_GROUP
*val_in, unsigned char **des_out);
EC_GROUP *
d2i_ECPKParameters_bio
(BIO
*in_bio, EC_GROUP **val_out);
int
i2d_ECPKParameters_bio
(BIO
*out_bio, EC_GROUP *val_in);
EC_GROUP *
d2i_ECPKParameters_fp
(FILE
*in_fp, EC_GROUP **val_out);
int
i2d_ECPKParameters_fp
(FILE
*out_fp, EC_GROUP *val_in);
EC_KEY *
d2i_ECParameters
(EC_KEY
**val_out, const unsigned char **des_in,
long length);
int
i2d_ECParameters
(EC_KEY *val_in,
unsigned char **des_out);
EC_KEY *
ECParameters_dup
(EC_KEY
*val_in);
EC_KEY *
d2i_ECPrivateKey
(EC_KEY
**val_out, const unsigned char **des_in,
long length);
int
i2d_ECPrivateKey
(EC_KEY *val_in,
unsigned char **des_out);
EC_KEY *
d2i_ECPrivateKey_bio
(BIO
*in_bio, EC_KEY **val_out);
int
i2d_ECPrivateKey_bio
(BIO
*out_bio, EC_KEY *val_in);
EC_KEY *
d2i_ECPrivateKey_fp
(FILE *in_fp,
EC_KEY **val_out);
int
i2d_ECPrivateKey_fp
(FILE
*out_fp, EC_KEY *val_in);
EC_KEY *
o2i_ECPublicKey
(EC_KEY
**val_out, const unsigned char **des_in,
long length);
int
i2o_ECPublicKey
(const EC_KEY
*val_in, unsigned char **des_out);
int
ECPKParameters_print
(BIO
*out_bio, const EC_GROUP *val_in,
int indent);
int
ECPKParameters_print_fp
(FILE
*out_fp, const EC_GROUP *val_in,
int indent);
int
ECParameters_print
(BIO *out_bio,
const EC_KEY *val_in);
int
ECParameters_print_fp
(FILE
*out_fp, const EC_KEY *val_in);
#include
<openssl/x509.h>
EC_KEY *
d2i_EC_PUBKEY
(EC_KEY **val_out,
const unsigned char **des_in, long
length);
int
i2d_EC_PUBKEY
(EC_KEY *val_in,
unsigned char **des_out);
EC_KEY *
d2i_EC_PUBKEY_bio
(BIO *in_bio,
EC_KEY **val_out);
int
i2d_EC_PUBKEY_bio
(BIO *out_bio,
EC_KEY *val_in);
EC_KEY *
d2i_EC_PUBKEY_fp
(FILE *in_fp,
EC_KEY **val_out);
int
i2d_EC_PUBKEY_fp
(FILE *out_fp,
EC_KEY *val_in);
DESCRIPTION
These functions decode and encode elliptic curve keys and parameters. For details about the semantics, examples, caveats, and bugs, see ASN1_item_d2i(3).d2i_ECPKParameters
()
and
i2d_ECPKParameters
()
decode and encode the parameters of an elliptic curve.
d2i_ECPKParameters_bio
(),
i2d_ECPKParameters_bio
(),
d2i_ECPKParameters_fp
(),
and
i2d_ECPKParameters_fp
()
are similar except that they decode or encode using a
BIO or FILE pointer. These four
functions are currently implemented as macros.
d2i_ECParameters
()
does the same parsing as d2i_ECPKParameters
() but
saves the result in the group field of an
EC_KEY structure.
i2d_ECParameters
()
produces the same output as
i2d_ECPKParameters
()
but uses val_in->group for input instead of
val_in.
ECParameters_dup
()
allocates and initializes an empty EC_KEY object and
copies the EC parameters from val_in to it by calling
i2d_ECParameters
() and
d2i_ECParameters
(). If a private or public key or
any flags are present in val_in, they are not
copied.
d2i_ECPrivateKey
()
and
i2d_ECPrivateKey
()
decode and encode an EC private key using an ASN.1
ECPrivateKey structure defined in RFC 5915 section 3
and used for the privateKey field of the ASN.1
PrivateKeyInfo structure defined in RFC 5208 section
5, see
PKCS8_PRIV_KEY_INFO_new(3).
d2i_ECPrivateKey_bio
(),
i2d_ECPrivateKey_bio
(),
d2i_ECPrivateKey_fp
(),
and
i2d_ECPrivateKey_fp
()
are similar except that they decode or encode using a
BIO or FILE pointer.
o2i_ECPublicKey
()
and
i2o_ECPublicKey
()
decode and encode an EC public key. In contrast to
ASN1_item_d2i(3), o2i_ECPublicKey
() requires
val_out, *val_out, and
(*val_out)->group to be
non-NULL
.
ECPKParameters_print
()
and
ECPKParameters_print_fp
()
print human-readable output of the public parameters of the
EC_GROUP to out_bio or
out_fp. The output lines are indented by
indent spaces.
ECParameters_print
()
and
ECParameters_print_fp
()
print the parameter components of val_in to
out_bio or out_fp.
d2i_EC_PUBKEY
()
and
i2d_EC_PUBKEY
()
decode and encode an EC public key using an ASN.1
SubjectPublicKeyInfo structure defined in RFC 5280
section 4.1 and documented in
X509_PUBKEY_new(3).
d2i_EC_PUBKEY_bio
(),
i2d_EC_PUBKEY_bio
(),
d2i_EC_PUBKEY_fp
(),
and
i2d_EC_PUBKEY_fp
()
are similar except that they decode or encode using a
BIO or FILE pointer.
RETURN VALUES
d2i_ECPKParameters
(),
d2i_ECPKParameters_bio
(), and
d2i_ECPKParameters_fp
() return a valid
EC_GROUP structure or NULL
if
an error occurs.
d2i_ECParameters
(),
ECParameters_dup
(),
d2i_ECPrivateKey
(),
d2i_ECPrivateKey_bio
(),
d2i_ECPrivateKey_fp
(),
o2i_ECPublicKey
(),
d2i_EC_PUBKEY
(),
d2i_EC_PUBKEY_bio
(), and
d2i_EC_PUBKEY_fp
() return a valid
EC_KEY structure or NULL
if an
error occurs.
i2d_ECPKParameters
(),
i2d_ECParameters
(),
i2d_ECPrivateKey
(),
i2o_ECPublicKey
(), and
i2d_EC_PUBKEY
() return the number of bytes
successfully encoded or a negative value if an error occurs.
i2d_ECPKParameters_bio
(),
i2d_ECPKParameters_fp
(),
i2d_ECPrivateKey_bio
(),
i2d_ECPrivateKey_fp
(),
ECPKParameters_print
(),
ECPKParameters_print_fp
(),
ECParameters_print
(),
ECParameters_print_fp
(),
i2d_EC_PUBKEY_bio
(), and
i2d_EC_PUBKEY_fp
() return 1 for success or 0 if an
error occurs.
SEE ALSO
ASN1_item_d2i(3), EC_GROUP_copy(3), EC_GROUP_new(3), EC_KEY_new(3), EVP_PKEY_set1_EC_KEY(3), PEM_write_ECPrivateKey(3), PKCS8_PRIV_KEY_INFO_new(3), X509_PUBKEY_new(3)
STANDARDS
RFC 5915: Elliptic Curve Private Key Structure
RFC 5208: Public-Key Cryptography Standards (PKCS) #8: Private-Key Information Syntax Specification
RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile, section 4.1: Basic Certificate Fields
HISTORY
d2i_ECPKParameters
(),
i2d_ECPKParameters
(),
d2i_ECPKParameters_bio
(),
i2d_ECPKParameters_bio
(),
d2i_ECPKParameters_fP
(),
i2d_ECPKParameters_fp
(),
d2i_ECParameters
(),
i2d_ECParameters
(),
ECParameters_dup
(),
d2i_ECPrivateKey
(),
i2d_ECPrivateKey
(),
d2i_ECPrivateKey_bio
(),
i2d_ECPrivateKey_bio
(),
d2i_ECPrivateKey_fp
(),
i2d_ECPrivateKey_fp
(),
o2i_ECPublicKey
(),
i2o_ECPublicKey
(),
ECPKParameters_print
(),
ECPKParameters_print_fp
(),
ECParameters_print
(),
ECParameters_print_fp
(),
d2i_EC_PUBKEY
(),
i2d_EC_PUBKEY
(),
d2i_EC_PUBKEY_bio
(),
i2d_EC_PUBKEY_bio
(),
d2i_EC_PUBKEY_fp
(), and
i2d_EC_PUBKEY_fp
() first appeared in OpenSSL 0.9.8
and have been available since OpenBSD 4.5.