X509_ATTRIBUTE_GET0_OBJECT(3) | Library Functions Manual | X509_ATTRIBUTE_GET0_OBJECT(3)

# NAME

`X509_ATTRIBUTE_get0_object`, `X509_ATTRIBUTE_count`, `X509_ATTRIBUTE_get0_type`, `X509_ATTRIBUTE_get0_data` — X.501 Attribute read accessors

# SYNOPSIS

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

June 8, 2025 | Debian