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

# libressl-X509\_ATTRIBUTE\_get0\_object(3)

X.501 Attribute read accessors

## NAME

**X509\_ATTRIBUTE\_get0\_object**, **X509\_ATTRIBUTE\_count**, **X509\_ATTRIBUTE\_get0\_type**, **X509\_ATTRIBUTE\_get0\_data** – X.501 Attribute read accessors

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

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

*ASN1\_OBJECT* *\**\

**X509\_ATTRIBUTE\_get0\_object**(*X509\_ATTRIBUTE \*attr*);

*int*\

**X509\_ATTRIBUTE\_count**(*const X509\_ATTRIBUTE \*attr*);

*ASN1\_TYPE* *\**\

**X509\_ATTRIBUTE\_get0\_type**(*X509\_ATTRIBUTE \*attr*, *int index*);

*void* *\**\

**X509\_ATTRIBUTE\_get0\_data**(*X509\_ATTRIBUTE \*attr*, *int index*, *int type*, *void \*data*);

## DESCRIPTION

These functions provide read access to the X.501 Attribute object *attr*.

For **X509\_ATTRIBUTE\_get0\_data**(), the *type* argument usually is one of the V\_ASN1\_\* constants defined in ⟨openssl/asn1.h⟩. For example, if a return value of the type *ASN1\_OCTET\_STRING* is expected, pass V\_ASN1\_OCTET\_STRING as the *type* argument. The *data* argument is ignored; passing NULL is recommended.

## RETURN VALUES

**X509\_ATTRIBUTE\_get0\_object**() returns an internal pointer to the type of *attr* or NULL if *attr* is NULL or if its type is not set.

**X509\_ATTRIBUTE\_count**() returns the number of values stored in *attr* or 0 if no value or values are set.

**X509\_ATTRIBUTE\_get0\_type**() returns an internal pointer to the ASN.1 ANY object representing the value with the given zero-based *index* or NULL if *attr* is NULL, if the *index* is larger than or equal to the number of values stored in *attr*, or if no value or values are set.

**X509\_ATTRIBUTE\_get0\_data**() returns an internal pointer to the data contained in the value with the given zero-based *index* or NULL if *attr* is NULL, if the *index* is larger than or equal to the number of values stored in *attr*, if no value or values are set, or if the ASN.1 ANY object representing the value with the given *index* is not of the requested *type*.

## SEE ALSO

ASN1\_OBJECT\_new(3), ASN1\_TYPE\_new(3), OPENSSL\_sk\_new(3), X509\_ATTRIBUTE\_new(3), X509\_ATTRIBUTE\_set1\_object(3)

## HISTORY

These functions first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.
