libressl-d2i_ASN1_SEQUENCE_ANY(3)

libressl-d2i_ASN1_SEQUENCE_ANY3

Decode and encode asn.1 sequences and sets

Usage

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

Overview

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.

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.

From libressl 4.4.0-1 in Arch Linux 2026-11-07. Parsed by carta from the page's mdoc source.