X509_REQ_ADD1_ATTR(3)

NAME
X509_REQ_add1_attr, X509_REQ_add1_attr_by_OBJ, X509_REQ_add1_attr_by_NID, X509_REQ_add1_attr_by_txt, X509_REQ_delete_attr, X509_REQ_get_attr, X509_REQ_get_attr_count, X509_REQ_get_attr_by_OBJ, X509_REQ_get_attr_by_NID - X.501 Attributes of PKCS#10 certification requests

SYNOPSIS
libcrypto
#include <openssl/x509.h>
int
X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);
int
X509_REQ_add1_attr_by_OBJ(X509_REQ *req, const ASN1_OBJECT *obj, int type, const unsigned char *data, int len);
int
X509_REQ_add1_attr_by_NID(X509_REQ *req, int nid, int type, const unsigned char *data, int len);
int
X509_REQ_add1_attr_by_txt(X509_REQ *req, const char *name, int type, const unsigned char *data, int len);
X509_ATTRIBUTE *
X509_REQ_delete_attr(X509_REQ *req, int index);
X509_ATTRIBUTE *
X509_REQ_get_attr(const X509_REQ *req, int index);
int
X509_REQ_get_attr_count(const X509_REQ *req);
int
X509_REQ_get_attr_by_OBJ(const X509_REQ *req, const ASN1_OBJECT *obj, int start_after);
int
X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int start_after);

DESCRIPTION
These functions support associating an array of X.501 Attributes with a PKCS#10 certification request.

X509_REQ_add1_attr() appends a deep copy of the attr, allocating a new array if necessary.

X509_REQ_add1_attr_by_OBJ(), X509_REQ_add1_attr_by_NID(), and X509_REQ_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, allocating a new array if necessary.

X509_REQ_delete_attr() deletes the attribute with the zero-based index.

X509_REQ_get_attr() returns the attribute with the zero-based index.

X509_REQ_get_attr_count() returns the number of attributes currently associated with req.

X509_REQ_get_attr_by_OBJ() and X509_REQ_get_attr_by_NID() search for an attribute of the type obj or nid.

RETURN VALUES
X509_REQ_add1_attr(), X509_REQ_add1_attr_by_OBJ(), X509_REQ_add1_attr_by_NID(), and X509_REQ_add1_attr_by_txt() return 1 for success or 0 for failure.

X509_REQ_delete_attr() and X509_REQ_get_attr() return the deleted or requested attribute or NULL if the requested index is negative or greater than or equal to the current number of attributes associated with req.

X509_REQ_get_attr_count() returns the current number of attributes.

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

SEE ALSO
OBJ_nid2obj(3), X509_ATTRIBUTE_create_by_OBJ(3), X509_ATTRIBUTE_new(3), X509_REQ_new(3)

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