EC_KEY_GET_ENC_FLAGS(3ossl)
π 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. ifEC_PKEY_NO_PARAMETERShas been used, see below) cannot be loaded usingd2i_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_PARAMETERSEC_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_PARAMETERSis set, then the public parameters for the curve are not encoded along with the private key π - if
EC_PKEY_NO_PUBKEYis 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:
crypto(7)EC_GROUP_new(3)EC_GROUP_copy(3)EC_POINT_new(3)EC_POINT_add(3)EC_GFp_simple_method(3)d2i_ECPKParameters(3)d2i_ECPrivateKey(3)
no cap, EC_GROUP_copy(3) is the main character here, go say hi π¦
π COPYRIGHT π
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
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms