EC_KEY_GET_ENC_FLAGS(3ossl)

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

πŸ’… EC_KEY_GET_ENC_FLAGS(3ossl) β€” the OpenSSL girlies are at it again

okay so bestie, this is EC_KEY_GET_ENC_FLAGS(3ossl), a real page out of the OpenSSL manual, and honestly? it's a whole little vibe about encoding flags for EC_KEY structures. get comfy πŸŽ€


✨ NAME ✨

EC_KEY_get_enc_flags, EC_KEY_set_enc_flags β€” literally just getting and setting the flags for encoding EC_KEY structures. that's it, that's the whole thing 🫢


🌸 SYNOPSIS 🌸

#include <openssl/ec.h>

unsigned int EC_KEY_get_enc_flags(const EC_KEY *key);
void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);

like, copy-paste it exactly, okay? no renaming, no "fixing" it, the compiler will simply not be your friend 😭


πŸ¦‹ DESCRIPTION πŸ¦‹

so the format of the external representation of the public key β€” the one written out by i2d_ECPrivateKey() β€” is described by the point_conversion_form. yes, that includes whether it gets stored in a compressed form or not. if you want the full tea on point_conversion_form, go read EC_GROUP_copy(3), she explains it ✨

when you're reading a private key that was encoded without an associated public key (like, for example, if EC_PKEY_NO_PUBKEY was used β€” see below, iykyk), then d2i_ECPrivateKey() will generate the missing public key automatically for you. so sweet of it πŸ’–

⚠️ but listen β€” private keys encoded without parameters (e.g. if EC_PKEY_NO_PARAMETERS has been used, see below) cannot be loaded using d2i_ECPrivateKey(). that's not a vibe. that's a hard no. πŸ’€

so the functions EC_KEY_get_enc_flags() and EC_KEY_set_enc_flags() get and set the value of the encoding flags for the key. there are two encoding flags currently defined:

  • EC_PKEY_NO_PARAMETERS
  • EC_PKEY_NO_PUBKEY

these flags define the behaviour of how the key is converted into ASN1 in a call to i2d_ECPrivateKey(). and like, to be specific:

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

iconic flag behaviour honestly, periodt 🧚


πŸ‘‘ RETURN VALUES πŸ‘‘

EC_KEY_get_enc_flags() returns the value of the current encoding flags for the EC_KEY. that's the whole return section, bestie, she's short and she knows it πŸ’…


🌈 SEE ALSO 🌈

go read these too, they're all part of the lore:

no cap, EC_GROUP_copy(3) is the main character here, go say hi πŸ¦‹


Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. don't be weird about the license, just read it, it's not that deep 😌


okay and like, tiny sign-off moment: this whole page comes from OpenSSL 3.5.0, dated 2026-09-25, and maaaybe go outside after this, or don't, i'm not your mom. either way you understood the flags so congrats bestie you ate πŸ”₯πŸ’œ

πŸ“¦ where this page comes from