D2I_ASN1_SEQUENCE_ANY(3) | Library Functions Manual | D2I_ASN1_SEQUENCE_ANY(3)

# 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

library “libcrypto”
`#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.

June 8, 2025 | Debian