---
name: "libressl-d2i_ASN1_SEQUENCE_ANY"
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_ASN1_SEQUENCE_ANY"
---

# libressl-d2i\_ASN1\_SEQUENCE\_ANY(3)

decode and encode ASN.1 sequences and sets

## NAME

**d2i\_ASN1\_SEQUENCE\_ANY**, **i2d\_ASN1\_SEQUENCE\_ANY**, **d2i\_ASN1\_SET\_ANY**, **i2d\_ASN1\_SET\_ANY** – decode and encode ASN.1 sequences and sets

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*ASN1\_SEQUENCE\_ANY* *\**\

**d2i\_ASN1\_SEQUENCE\_ANY**(*ASN1\_SEQUENCE\_ANY \*\*val\_out*, *const unsigned char \*\*der\_in*, *long length*);

*int*\

**i2d\_ASN1\_SEQUENCE\_ANY**(*const ASN1\_SEQUENCE\_ANY \*val\_in*, *unsigned char \*\*der\_out*);

*ASN1\_SEQUENCE\_ANY* *\**\

**d2i\_ASN1\_SET\_ANY**(*ASN1\_SEQUENCE\_ANY \*\*val\_out*, *const unsigned char \*\*der\_in*, *long length*);

*int*\

**i2d\_ASN1\_SET\_ANY**(*const ASN1\_SEQUENCE\_ANY \*val\_in*, *unsigned char \*\*der\_out*);

## DESCRIPTION

These functions decode and encode ASN.1 sequences and sets, which are also represented by the V\_ASN1\_SEQUENCE and V\_ASN1\_SET type identifier constants, respectively. For details about the semantics, examples, caveats, and bugs, see ASN1\_item\_d2i(3).

The type *ASN1\_SEQUENCE\_ANY* is defined as *STACK\_OF(ASN1\_TYPE)*. Whether such an object represents a sequence or a set is not stored in the object itself but needs to be remembered separately.

Like for d2i\_ASN1\_TYPE(3) and i2d\_ASN1\_TYPE(3), the type of the individual values contained in the sequence or set is not specified when calling the functions. It might vary among the members, and it is stored together with each value in each *ASN1\_TYPE* object contained in the sequence or set.

## RETURN VALUES

**d2i\_ASN1\_SEQUENCE\_ANY**() returns an *ASN1\_SEQUENCE\_ANY* object or NULL if an error occurs.

**i2d\_ASN1\_SEQUENCE\_ANY**() returns the number of bytes written or a negative value if an error occurs.

## SEE ALSO

ASN1\_item\_d2i(3), ASN1\_TYPE\_new(3)

## HISTORY

**d2i\_ASN1\_SEQUENCE\_ANY**(), **i2d\_ASN1\_SEQUENCE\_ANY**(), **d2i\_ASN1\_SET\_ANY**(), and **i2d\_ASN1\_SET\_ANY**() first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.
