X509AT_ADD1_ATTR(3) Library Functions Manual X509AT_ADD1_ATTR(3)
NAME
X509at_add1_attr, X509at_add1_attr_by_OBJ, X509at_add1_attr_by_NID, X509at_add1_attr_by_txt, X509at_delete_attr — change an array of X.501 Attribute objects
SYNOPSIS
#include <openssl/x509.h>
STACK_OF(X509_ATTRIBUTE) *
X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **pattrs, X509_ATTRIBUTE *attr);
STACK_OF(X509_ATTRIBUTE) *
X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **pattrs, const ASN1_OBJECT *obj, int type, const unsigned char *data, int len);
STACK_OF(X509_ATTRIBUTE) *
X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **pattrs, int nid, int type, const unsigned char *data, int len);
STACK_OF(X509_ATTRIBUTE) *
X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **pattrs, const char *name, int type, const unsigned char *data, int len);
X509_ATTRIBUTE *
X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *attrs, int index);
DESCRIPTION
X509at_add1_attr() appends a deep copy of attr to the end of **pattrs. If *pattrs is NULL, a new array is allocated, and in case of success, a pointer to it is assigned to *pattrs.
X509at_add1_attr_by_OBJ(), X509at_add1_attr_by_NID(), and X509at_add1_attr_by_txt() create a new X.501 Attribute object using X509_ATTRIBUTE_create_by_OBJ(3), X509_ATTRIBUTE_create_by_NID(3), or X509_ATTRIBUTE_create_by_txt(3), respectively, and append it to **pattrs using X509at_add1_attr().
X509at_delete_attr() deletes the element with the zero-based index from the array *attrs.
RETURN VALUES
X509at_add1_attr(), X509at_add1_attr_by_OBJ(), X509at_add1_attr_by_NID(), and X509at_add1_attr_by_txt() return a pointer to the modified or new array or NULL if the pattrs argument is NULL or if creating or copying the X.501 Attribute object or memory allocation fails.
X509at_delete_attr() returns the deleted element or NULL if attrs is NULL or if the requested index is negative or greater than or equal to the number of objects in *attrs.
SEE ALSO
EVP_PKEY_add1_attr(3), OBJ_nid2obj(3), PKCS8_pkey_add1_attr_by_NID(3), STACK_OF(3), X509_ATTRIBUTE_create_by_OBJ(3), X509_ATTRIBUTE_new(3), X509_REQ_add1_attr(3), X509at_get_attr(3)
HISTORY
These functions first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7. GNU October 26, 2021 X509AT_ADD1_ATTR(3)