Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
NAME
X509_PURPOSE_set, X509_PURPOSE_get_by_id, X509_PURPOSE_add, X509_PURPOSE_get_count, X509_PURPOSE_cleanup, X509_PURPOSE_get0, X509_PURPOSE_get_by_sname, X509_PURPOSE_get_id, X509_PURPOSE_get0_name, X509_PURPOSE_get0_sname, X509_PURPOSE_get_trust — purpose objects, indices, and identifiersSYNOPSIS
#include <openssl/x509v3.h>X509_PURPOSE_set(int *id_out, int id_in);
X509_PURPOSE_get_by_id(int identifier);
X509_PURPOSE_add(int identifier, int trust, int flags, int (*check_purpose)(const X509_PURPOSE *, const X509 *, int), const char *name, const char *sname, void *usr_data);
X509_PURPOSE_get_count(void);
X509_PURPOSE_cleanup(void);
X509_PURPOSE_get0(int index);
X509_PURPOSE_get_by_sname(const char *sname);
X509_PURPOSE_get_id(const X509_PURPOSE *object);
X509_PURPOSE_get0_name(const X509_PURPOSE *object);
X509_PURPOSE_get0_sname(const X509_PURPOSE *object);
X509_PURPOSE_get_trust(const X509_PURPOSE *object);
DESCRIPTION
The purposes that an X.509 certificate is intended to be used for can be identified in three equivalent ways:- By purpose identifiers, which are positive integer constants. Standard purpose identifiers lie in the range from X509_PURPOSE_MIN to X509_PURPOSE_MAX, inclusive, and are listed in the X509_check_purpose(3) manual page. User defined purpose identifiers are larger than X509_PURPOSE_MAX.
- By purpose indices, which are non-negative integer constants but differ from the purpose identifiers for the same purpose. Standard purpose indices are smaller than X509_PURPOSE_MAX. User defined purpose indices are larger than or equal to X509_PURPOSE_MAX.
- By purpose objects of the type X509_PURPOSE. Standard purpose objects are available in static storage. User defined purpose objects can be created with X509_PURPOSE_add().
Using purpose identifiers
X509_PURPOSE_set() validates the purpose identifier id_in. If it is valid, it is copied to *id_out. Otherwise, *id_out remains unchanged.Using purpose indices
X509_PURPOSE_get0() converts the purpose index to a pointer to the corresponding purpose object. To find the corresponding purpose identifier, pass the result to X509_PURPOSE_get_id().Using purpose objects
X509_PURPOSE_get_id() converts a pointer to a purpose object to the corresponding purpose identifier. To find the corresponding purpose index, pass the result to X509_PURPOSE_get_by_id().RETURN VALUES
X509_PURPOSE_set() returns 1 if id_in is valid or 0 otherwise.ERRORS
The following diagnostics can be retrieved with ERR_get_error(3), ERR_GET_REASON(3), and ERR_reason_error_string(3):- X509V3_R_INVALID_PURPOSE “invalid purpose”
- X509_PURPOSE_set() was called with an invalid id_in argument.
- X509V3_R_INVALID_NULL_ARGUMENT “invalid null argument”
- X509_PURPOSE_add() was called with a name or sname argument of NULL.
- ERR_R_MALLOC_FAILURE “malloc failure”
- X509_PURPOSE_add() failed to allocate memory.