---
name: "libressl-d2i_X509_EXTENSION"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-d2i_X509_EXTENSION"
---

# libressl-d2i\_X509\_EXTENSION(3)

decode and encode X.509 Extensions

## NAME

**d2i\_X509\_EXTENSION**, **i2d\_X509\_EXTENSION**, **d2i\_X509\_EXTENSIONS**, **i2d\_X509\_EXTENSIONS** – decode and encode X.509 Extensions

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/x509.h\>**

*X509\_EXTENSION* *\**\

**d2i\_X509\_EXTENSION**(*X509\_EXTENSION \*\*val\_out*, *const unsigned char \*\*der\_in*, *long length*);

*int*\

**i2d\_X509\_EXTENSION**(*X509\_EXTENSION \*val\_in*, *unsigned char \*\*der\_out*);

*X509\_EXTENSIONS* *\**\

**d2i\_X509\_EXTENSIONS**(*X509\_EXTENSIONS \*\*val\_out*, *const unsigned char \*\*der\_in*, *long length*);

*int*\

**i2d\_X509\_EXTENSIONS**(*X509\_EXTENSIONS \*val\_in*, *unsigned char \*\*der\_out*);

## DESCRIPTION

**d2i\_X509\_EXTENSION**() and **i2d\_X509\_EXTENSION**() decode and encode an ASN.1 *Extension* structure defined in RFC 5280 section 4.1.

**d2i\_X509\_EXTENSIONS**() and **i2d\_X509\_EXTENSIONS**() decode and encode an ASN.1 *Extensions* structure defined in RFC 5280 section 4.1, which is a SEQUENCE OF *Extension*.

## RETURN VALUES

**d2i\_X509\_EXTENSION**() and **d2i\_X509\_EXTENSIONS**() return an *X509\_EXTENSION* or *X509\_EXTENSIONS* object, respectively, or NULL if an error occurs.

**i2d\_X509\_EXTENSION**() and **i2d\_X509\_EXTENSIONS**() return the number of bytes successfully encoded or a negative value if an error occurs.

## SEE ALSO

ASN1\_item\_d2i(3), X509\_EXTENSION\_new(3), X509V3\_get\_d2i(3), X509v3\_get\_ext\_by\_NID(3)

## STANDARDS

RFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile

## HISTORY

**d2i\_X509\_EXTENSION**() and **i2d\_X509\_EXTENSION**() first appeared in SSLeay 0.6.2 and have been available since OpenBSD 2.4.

**d2i\_X509\_EXTENSIONS**() and **i2d\_X509\_EXTENSIONS**() first appeared in OpenSSL 0.9.8h and have been available since OpenBSD 4.5.
