D2I_ECPKPARAMETERS(3)
β¨ 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()andi2d_ECPKParameters()decode and encode the parameters of an elliptic curve. The bio/fp versionsd2i_ECPKParameters_bio(),i2d_ECPKParameters_bio(),d2i_ECPKParameters_fp(), andi2d_ECPKParameters_fp()are similar except that they decode or encode using aBIOorFILEpointer. These four functions are currently implemented as macros β yes, macros, not full functions, periodt.d2i_ECParameters()does the same parsing asd2i_ECPKParameters()but saves the result in thegroupfield of anEC_KEYstructure.i2d_ECParameters()produces the same output asi2d_ECPKParameters()but usesval_in->groupfor input instead ofval_in.ECParameters_dup()allocates and initializes an emptyEC_KEYobject and copies the EC parameters fromval_into it by callingi2d_ECParameters()andd2i_ECParameters(). If a private or public key or any flags are present inval_in, they are not copied. Not copied, bestie β those stay behind π.d2i_ECPrivateKey()andi2d_ECPrivateKey()decode and encode an EC private key using an ASN.1ECPrivateKeystructure defined in RFC 5915 section 3 and used for theprivateKeyfield of the ASN.1PrivateKeyInfostructure defined in RFC 5208 section 5, seePKCS8_PRIV_KEY_INFO_new(3). The bio/fp versionsd2i_ECPrivateKey_bio(),i2d_ECPrivateKey_bio(),d2i_ECPrivateKey_fp(), andi2d_ECPrivateKey_fp()are similar except that they decode or encode using aBIOorFILEpointer.o2i_ECPublicKey()andi2o_ECPublicKey()decode and encode an EC public key. In contrast toASN1_item_d2i(3),o2i_ECPublicKey()requiresval_out,*val_out, and(*val_out)->groupto be non-NULL. Non-NULLis the vibe check here.ECPKParameters_print()andECPKParameters_print_fp()print human-readable output of the public parameters of theEC_GROUPtoout_bioorout_fp. The output lines are indented byindentspaces.ECParameters_print()andECParameters_print_fp()print the parameter components ofval_intoout_bioorout_fp.d2i_EC_PUBKEY()andi2d_EC_PUBKEY()decode and encode an EC public key using an ASN.1SubjectPublicKeyInfostructure defined in RFC 5280 section 4.1 and documented inX509_PUBKEY_new(3). The bio/fp versionsd2i_EC_PUBKEY_bio(),i2d_EC_PUBKEY_bio(),d2i_EC_PUBKEY_fp(), andi2d_EC_PUBKEY_fp()are similar except that they decode or encode using aBIOorFILEpointer.
π RETURN VALUES π
okay so the receipts:
d2i_ECPKParameters(),d2i_ECPKParameters_bio(), andd2i_ECPKParameters_fp()return a validEC_GROUPstructure orNULLif an error occurs.d2i_ECParameters(),ECParameters_dup(),d2i_ECPrivateKey(),d2i_ECPrivateKey_bio(),d2i_ECPrivateKey_fp(),o2i_ECPublicKey(),d2i_EC_PUBKEY(),d2i_EC_PUBKEY_bio(), andd2i_EC_PUBKEY_fp()return a validEC_KEYstructure orNULLif an error occurs.i2d_ECPKParameters(),i2d_ECParameters(),i2d_ECPrivateKey(),i2o_ECPublicKey(), andi2d_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(), andi2d_EC_PUBKEY_fp()return1for success or0if an error occurs.
π SEE ALSO π
go get the whole friend group:
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 π°οΈ
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
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2013, 2015 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms