OpenBSD manual page server

Manual Page Search Parameters

X509AT_GET_ATTR(3) Library Functions Manual X509AT_GET_ATTR(3)

X509at_get_attr, X509at_get_attr_count, X509at_get_attr_by_OBJ, X509at_get_attr_by_NID, X509at_get0_data_by_OBJX.501 Attribute array read accessors

#include <openssl/x509.h>

X509_ATTRIBUTE *
X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *attrs, int index);

int
X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *attrs);

int
X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *attrs, const ASN1_OBJECT *obj, int start_after);

int
X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *attrs, int nid, int start_after);

void *
X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *attrs, const ASN1_OBJECT *obj, int start_after, int type);

These functions retrieve information from the attrs array of X.501 Attribute objects. They all fail if attrs is a NULL pointer.

() returns the array element at the zero-based index. It fails if the index is negative or greater than or equal to the number of objects in the array.

() returns the number of objects currently stored in the array.

The three remaining functions search the array starting after the index start_after. They fail if no matching object is found. () also fails if the data is not of the requested type.

Additionally, the start_after argument of () is interpreted in a special way. If start_after is -2 or smaller, X509at_get0_data_by_OBJ() also fails if attrs contains more than one matching object. If start_after is -3 or smaller, it also fails unless the matching object contains exactly one value.

X509at_get_attr() returns an internal pointer or NULL on failure.

X509at_get_attr_count() returns the number of array elements or -1 on failure.

X509at_get_attr_by_OBJ() and X509at_get_attr_by_NID() return the index of the first object in the array that has an index greater than start_after and a type matching obj or nid, respectively, or -1 on failure. In addition, X509at_get_attr_by_NID() returns -2 if OBJ_nid2obj(3) fails on the requested nid.

X509at_get0_data_by_OBJ() returns an internal pointer to the data contained in the value of the first object that has an index greater than start_after and a type matching obj, or NULL on failure.

EVP_PKEY_get_attr(3), OBJ_nid2obj(3), PKCS8_pkey_get0_attrs(3), STACK_OF(3), X509_ATTRIBUTE_get0_data(3), X509_ATTRIBUTE_new(3), X509_REQ_get_attr(3), X509at_add1_attr(3)

X509at_get_attr(), X509at_get_attr_count(), X509at_get_attr_by_OBJ(), and X509at_get_attr_by_NID() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.

X509at_get0_data_by_OBJ() first appeared in OpenSSL 0.9.8h and has been available since OpenBSD 4.5.

March 28, 2022 OpenBSD-7.2