D2I_ECPKPARAMETERS(3)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

✨ NAME ✨

okay so welcome to the D2I_ECPKPARAMETERS(3) page from the Library Functions Manual β€” this is the group chat for decoding and encoding ASN.1 representations of elliptic curve entities πŸ’…. The whole squad is: 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 β€” 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 **der_in,
    long length);

int
i2d_ECPKParameters(const EC_GROUP *val_in, unsigned char **der_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 **der_in,
    long length);

int
i2d_ECParameters(EC_KEY *val_in, unsigned char **der_out);

EC_KEY *
ECParameters_dup(EC_KEY *val_in);

EC_KEY *
d2i_ECPrivateKey(EC_KEY **val_out, const unsigned char **der_in,
    long length);

int
i2d_ECPrivateKey(EC_KEY *val_in, unsigned char **der_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 **der_in,
    long length);

int
i2o_ECPublicKey(const EC_KEY *val_in, unsigned char **der_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 **der_in,
    long length);

int
i2d_EC_PUBKEY(EC_KEY *val_in, unsigned char **der_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 πŸ’–

bestie, these functions decode and encode elliptic curve keys and parameters. For the full semantics, examples, caveats, and bugs, go read ASN1_item_d2i(3) β€” that's the lore drop.

  • d2i_ECPKParameters() and i2d_ECPKParameters() decode and encode the parameters of an elliptic curve. The bio/fp versions 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 β€” yes, macros, not full functions, periodt.
  • 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. Not copied, bestie β€” those stay behind πŸ™ˆ.
  • 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). The bio/fp versions 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. Non-NULL is the vibe check here.
  • 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). The bio/fp versions 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 πŸ”

okay so the receipts:

  • 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 πŸ‘€

go get the whole friend group:

πŸ“œ 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 πŸ•°οΈ

okay so the timeline, keeping every single name exactly as written (yes, including d2i_ECPKParameters_fP() with that capital P β€” not me editing it, that's literally the page):

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.


okay bestie, that's the whole page πŸ’–. The footer at the very bottom says Debian and October 24, 2024, so that's the source/version and date energy β€” byeee πŸ‘‹βœ¨

πŸ“¦ where this page comes from