---
name: "libressl-d2i_X509_ATTRIBUTE"
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_ATTRIBUTE"
---

# libressl-d2i\_X509\_ATTRIBUTE(3)

decode and encode generic X.501 Attribute

## NAME

**d2i\_X509\_ATTRIBUTE**, **i2d\_X509\_ATTRIBUTE** – decode and encode generic X.501 Attribute

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*X509\_ATTRIBUTE* *\**\

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

*int*\

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

## DESCRIPTION

**d2i\_X509\_ATTRIBUTE**() and **i2d\_X509\_ATTRIBUTE**() decode and encode a generic ASN.1 *Attribute* structure defined in X.501 section 8.2. For details about the semantics, examples, caveats, and bugs, see ASN1\_item\_d2i(3).

## RETURN VALUES

**d2i\_X509\_ATTRIBUTE**() returns an *X509\_ATTRIBUTE* object or NULL if an error occurs.

**i2d\_X509\_ATTRIBUTE**() returns the number of bytes successfully encoded or a negative value if an error occurs.

## SEE ALSO

ASN1\_item\_d2i(3), d2i\_PKCS12(3), d2i\_PKCS8\_PRIV\_KEY\_INFO(3), d2i\_X509\_EXTENSION(3), d2i\_X509\_REQ(3), X509\_ATTRIBUTE\_new(3)

## STANDARDS

ITU-T Recommendation X.501, also known as ISO/IEC 9594-2: Information Technology  Open Systems Interconnection  The Directory: Models, section 8.2: Overall structure

## HISTORY

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