Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
NAME
X509_LOOKUP_new, X509_LOOKUP_free, X509_LOOKUP_ctrl, X509_LOOKUP_add_dir, X509_LOOKUP_load_file, X509_LOOKUP_add_mem, X509_LOOKUP_by_subject, X509_LOOKUP_init, X509_LOOKUP_shutdown, X509_LOOKUP_by_issuer_serial, X509_LOOKUP_by_fingerprint, X509_LOOKUP_by_alias, X509_get_default_cert_dir, X509_get_default_cert_file, X509_get_default_cert_dir_env, X509_get_default_cert_file_env — certificate lookup objectSYNOPSIS
#include <openssl/x509_vfy.h>X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
X509_LOOKUP_free(X509_LOOKUP *lookup);
X509_LOOKUP_ctrl(X509_LOOKUP *lookup, int command, const char *source, long type, char **ret);
X509_LOOKUP_add_dir(X509_LOOKUP *lookup, const char *source, long type);
X509_LOOKUP_load_file(X509_LOOKUP *lookup, const char *source, long type);
X509_LOOKUP_add_mem(X509_LOOKUP *lookup, const struct iovec *source, long type);
X509_LOOKUP_by_subject(X509_LOOKUP *lookup, X509_LOOKUP_TYPE type, X509_NAME *name, X509_OBJECT *object);
X509_LOOKUP_init(X509_LOOKUP *lookup);
X509_LOOKUP_shutdown(X509_LOOKUP *lookup);
X509_LOOKUP_by_issuer_serial(X509_LOOKUP *lookup, X509_LOOKUP_TYPE type, X509_NAME *name, ASN1_INTEGER *serial, X509_OBJECT *object);
X509_LOOKUP_by_fingerprint(X509_LOOKUP *lookup, X509_LOOKUP_TYPE type, const unsigned char *bytes, int length, X509_OBJECT *object);
X509_LOOKUP_by_alias(X509_LOOKUP *lookup, X509_LOOKUP_TYPE type, const char *string, int length, X509_OBJECT *object);
X509_get_default_cert_dir(void);
X509_get_default_cert_file(void);
X509_get_default_cert_dir_env(void);
X509_get_default_cert_file_env(void);
DESCRIPTION
X509_LOOKUP_new() allocates a new, empty X509_LOOKUP object and associates it with the method which is a static object returned from either X509_LOOKUP_hash_dir(3) or X509_LOOKUP_file(3) or X509_LOOKUP_mem(3).- X509_LOOKUP_hash_dir(3)
-
The command is required to be X509_L_ADD_DIR and the source argument is interpreted as a colon-separated, NUL-terminated list of directory names. These directories are added to an internal list of directories to search for certificate files of the given type.
- X509_LOOKUP_file(3)
-
The command is required to be X509_L_FILE_LOAD and the source argument is interpreted as a NUL-terminated file name. If the type is X509_FILETYPE_PEM, the file is read with BIO_new_file(3) and PEM_X509_INFO_read_bio(3) and the certificates and revocation lists found are added to the X509_STORE object associated with lookup using X509_STORE_add_cert(3) and X509_STORE_add_crl(3). If type is X509_FILETYPE_DEFAULT, the source argument is ignored and /etc/ssl/certs.pem and a type of X509_FILETYPE_PEM are used instead. If type is X509_FILETYPE_ASN1, the file is read with d2i_X509_bio(3) and the single certificate is added to the X509_STORE object associated with lookup using X509_STORE_add_cert(3).
- X509_LOOKUP_mem(3)
-
The command and type are required to be X509_L_MEM and X509_FILETYPE_PEM, respectively. The source argument is interpreted as a pointer to an iovec structure defined in <sys/uio.h>. The memory area described by that structure is read with BIO_new_mem_buf(3) and PEM_X509_INFO_read_bio(3) and the certificates and revocation lists found are added to the X509_STORE object associated with lookup using X509_STORE_add_cert(3) and X509_STORE_add_crl(3).
RETURN VALUES
X509_LOOKUP_new() returns the new object or NULL if memory allocation fails.ENVIRONMENT
For reasons of security and simplicity, LibreSSL ignores the environment variables SSL_CERT_DIR and SSL_CERT_FILE, but other library implementations may use their contents instead of the standard locations for trusted certificates, and a few third-party application programs also inspect these variables directly and may pass their values to X509_LOOKUP_add_dir() and X509_LOOKUP_load_file().FILES
- /etc/ssl/certs/
- default directory for storing trusted certificates
- /etc/ssl/certs.pem
- default file for storing trusted certificates
ERRORS
The following diagnostics can be retrieved with ERR_get_error(3), ERR_GET_REASON(3), and ERR_reason_error_string(3):- ERR_R_ASN1_LIB “ASN1 lib”
- d2i_X509_bio(3) failed in X509_LOOKUP_ctrl().
- X509_R_BAD_X509_FILETYPE “bad x509 filetype”
- X509_LOOKUP_ctrl() was called with an invalid type.
- ERR_R_BUF_LIB “BUF lib”
- Memory allocation failed in X509_LOOKUP_by_subject().
- X509_R_INVALID_DIRECTORY “invalid directory”
- The source argument of X509_LOOKUP_ctrl() with X509_L_ADD_DIR or X509_LOOKUP_add_dir() was NULL or an empty string.
- X509_R_LOADING_CERT_DIR “loading cert dir”
- X509_LOOKUP_ctrl() with X509_L_ADD_DIR or X509_LOOKUP_add_dir() was called with X509_FILETYPE_DEFAULT and adding the default directories failed. This error is added after and in addition to a more specific diagnostic.
- X509_R_LOADING_DEFAULTS “loading defaults”
- X509_LOOKUP_ctrl() with X509_L_FILE_LOAD or X509_LOOKUP_load_file() was called with X509_FILETYPE_DEFAULT and adding the certificates and revocation lists failed. This error is added after and in addition to a more specific diagnostic.
- ERR_R_MALLOC_FAILURE “malloc failure”
- Memory allocation failed in X509_LOOKUP_ctrl() or X509_LOOKUP_by_subject().
- ERR_R_PEM_LIB “PEM lib”
- PEM_X509_INFO_read_bio(3), PEM_read_bio_X509_AUX(3), or PEM_read_bio_X509_CRL(3) failed in X509_LOOKUP_ctrl().
- ERR_R_SYS_LIB “system lib”
- BIO_new(3), BIO_new_file(3), or BIO_read_filename(3) failed in X509_LOOKUP_ctrl().
- X509_R_WRONG_LOOKUP_TYPE “wrong lookup type”
- X509_LOOKUP_by_subject() was called with an invalid type.