---
name: "EC_KEY_get_enc_flags"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/EC_KEY_get_enc_flags"
---

# EC\_KEY\_get\_enc\_flags(3ssl)

Get and set flags for encoding EC\_KEY structures

## NAME

EC\_KEY\_get\_enc\_flags, EC\_KEY\_set\_enc\_flags - Get and set flags for encoding EC\_KEY structures

## 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);
```

## DESCRIPTION

The format of the external representation of the public key written by **i2d\_ECPrivateKey()** (such as whether it is stored in a compressed form or not) is described by the point\_conversion\_form. See **EC\_GROUP\_copy**(3) for a description of point\_conversion\_form.

When reading a private key encoded without an associated public key (e.g. if EC\_PKEY\_NO\_PUBKEY has been used - see below), then **d2i\_ECPrivateKey()** generates the missing public key automatically. Private keys encoded without parameters (e.g. if EC\_PKEY\_NO\_PARAMETERS has been used - see below) cannot be loaded using **d2i\_ECPrivateKey()**.

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 and EC\_PKEY\_NO\_PUBKEY.  These flags define the behaviour of how the  **key** is converted into ASN1 in a call to **i2d\_ECPrivateKey()**. 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.

## RETURN VALUES

**EC\_KEY\_get\_enc\_flags()** returns the value of the current encoding flags for the EC\_KEY.

## SEE ALSO

[**crypto**(7)](/crypto/7.md), **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)

## 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\>.
