xref: /freebsd/secure/lib/libcrypto/man/man3/X509_LOOKUP.3 (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "X509_LOOKUP 3"
X509_LOOKUP 3 "2022-07-05" "1.1.1q" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
X509_LOOKUP, X509_LOOKUP_TYPE, X509_LOOKUP_new, X509_LOOKUP_free, X509_LOOKUP_init, X509_LOOKUP_shutdown, X509_LOOKUP_set_method_data, X509_LOOKUP_get_method_data, X509_LOOKUP_ctrl, X509_LOOKUP_load_file, X509_LOOKUP_add_dir, X509_LOOKUP_get_store, X509_LOOKUP_by_subject, X509_LOOKUP_by_issuer_serial, X509_LOOKUP_by_fingerprint, X509_LOOKUP_by_alias \- OpenSSL certificate lookup mechanisms
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/x509_vfy.h> \& typedef x509_lookup_st X509_LOOKUP; \& typedef enum X509_LOOKUP_TYPE; \& X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method); int X509_LOOKUP_init(X509_LOOKUP *ctx); int X509_LOOKUP_shutdown(X509_LOOKUP *ctx); void X509_LOOKUP_free(X509_LOOKUP *ctx); \& int X509_LOOKUP_set_method_data(X509_LOOKUP *ctx, void *data); void *X509_LOOKUP_get_method_data(const X509_LOOKUP *ctx); \& int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret); int X509_LOOKUP_load_file(X509_LOOKUP *ctx, char *name, long type); int X509_LOOKUP_add_dir(X509_LOOKUP *ctx, char *name, long type); \& X509_STORE *X509_LOOKUP_get_store(const X509_LOOKUP *ctx); \& int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, X509_NAME *name, X509_OBJECT *ret); int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, X509_NAME *name, ASN1_INTEGER *serial, X509_OBJECT *ret); int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const unsigned char *bytes, int len, X509_OBJECT *ret); int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type, const char *str, int len, X509_OBJECT *ret); .Ve
"DESCRIPTION"
Header "DESCRIPTION" The X509_LOOKUP structure holds the information needed to look up certificates and CRLs according to an associated X509_LOOKUP_METHOD\|(3). Multiple X509_LOOKUP instances can be added to an X509_STORE\|(3) to enable lookup in that store.

\fBX509_LOOKUP_new() creates a new X509_LOOKUP using the given lookup \fImethod. It can also be created by calling X509_STORE_add_lookup\|(3), which will associate an X509_STORE with the lookup mechanism.

\fBX509_LOOKUP_init() initializes the internal state and resources as needed by the given X509_LOOKUP to do its work.

\fBX509_LOOKUP_shutdown() tears down the internal state and resources of the given X509_LOOKUP.

\fBX509_LOOKUP_free() destructs the given X509_LOOKUP.

\fBX509_LOOKUP_set_method_data() associates a pointer to application data to the given X509_LOOKUP.

\fBX509_LOOKUP_get_method_data() retrieves a pointer to application data from the given X509_LOOKUP.

\fBX509_LOOKUP_ctrl() is used to set or get additional data to or from an \fBX509_LOOKUP structure or its associated X509_LOOKUP_METHOD\|(3). The arguments of the control command are passed via argc and argl, its return value via *ret. The meaning of the arguments depends on the cmd number of the control command. In general, this function is not called directly, but wrapped by a macro call, see below. The control cmds known to OpenSSL are discussed in more depth in \*(L"Control Commands\*(R".

\fBX509_LOOKUP_load_file() passes a filename to be loaded immediately into the associated X509_STORE. \fItype indicates what type of object is expected. This can only be used with a lookup using the implementation \fBX509_LOOKUP_file\|(3).

\fBX509_LOOKUP_add_dir() passes a directory specification from which certificates and CRLs are loaded on demand into the associated \fBX509_STORE. \fItype indicates what type of object is expected. This can only be used with a lookup using the implementation \fBX509_LOOKUP_hash_dir\|(3).

\fBX509_LOOKUP_load_file(), X509_LOOKUP_add_dir(), \fBX509_LOOKUP_add_store(), and X509_LOOKUP_load_store() are implemented as macros that use X509_LOOKUP_ctrl().

\fBX509_LOOKUP_by_subject(), X509_LOOKUP_by_issuer_serial(), \fBX509_LOOKUP_by_fingerprint(), and X509_LOOKUP_by_alias() look up certificates and CRLs in the X509_STORE\|(3) associated with the \fBX509_LOOKUP using different criteria, where the looked up object is stored in ret. Some of the underlying X509_LOOKUP_METHODs will also cache objects matching the criteria in the associated X509_STORE, which makes it possible to handle cases where the criteria have more than one hit.

"File Types"
Subsection "File Types" \fBX509_LOOKUP_load_file() and X509_LOOKUP_add_dir() take a type, which can be one of the following:
"X509_FILETYPE_PEM" 4
Item "X509_FILETYPE_PEM" The file or files that are loaded are expected to be in \s-1PEM\s0 format.
"X509_FILETYPE_ASN1" 4
Item "X509_FILETYPE_ASN1" The file or files that are loaded are expected to be in raw \s-1DER\s0 format.
"X509_FILETYPE_DEFAULT" 4
Item "X509_FILETYPE_DEFAULT" The default certificate file or directory is used. In this case, \fIname is ignored.
"Control Commands"
Subsection "Control Commands" The X509_LOOKUP_METHODs built into OpenSSL recognise the following \fBX509_LOOKUP_ctrl() cmds:
"X509_L_FILE_LOAD" 4
Item "X509_L_FILE_LOAD" This is the command that X509_LOOKUP_load_file() uses. The filename is passed in argc, and the type in argl.
"X509_L_ADD_DIR" 4
Item "X509_L_ADD_DIR" This is the command that X509_LOOKUP_add_dir() uses. The directory specification is passed in argc, and the type in \fIargl.
"X509_L_ADD_STORE" 4
Item "X509_L_ADD_STORE" This is the command that X509_LOOKUP_add_store() uses. The \s-1URI\s0 is passed in argc.
"X509_L_LOAD_STORE" 4
Item "X509_L_LOAD_STORE" This is the command that X509_LOOKUP_load_store() uses. The \s-1URI\s0 is passed in argc.
"RETURN VALUES"
Header "RETURN VALUES" \fBX509_LOOKUP_new() returns an X509_LOOKUP pointer when successful, or \s-1NULL\s0 on error.

\fBX509_LOOKUP_init() and X509_LOOKUP_shutdown() return 1 on success, or 0 on error.

\fBX509_LOOKUP_ctrl() returns -1 if the X509_LOOKUP doesn't have an associated X509_LOOKUP_METHOD, or 1 if the doesn't have a control function. Otherwise, it returns what the control function in the \fBX509_LOOKUP_METHOD returns, which is usually 1 on success and 0 in error. Xref "509_LOOKUP_METHOD"

\fBX509_LOOKUP_get_store() returns an X509_STORE pointer if there is one, otherwise \s-1NULL.\s0

\fBX509_LOOKUP_by_subject(), X509_LOOKUP_by_issuer_serial(), \fBX509_LOOKUP_by_fingerprint(), and X509_LOOKUP_by_alias() all return 0 if there is no X509_LOOKUP_METHOD or that method doesn't implement the corresponding function. Otherwise, it returns what the corresponding function in the \fBX509_LOOKUP_METHOD returns, which is usually 1 on success and 0 in error.

"SEE ALSO"
Header "SEE ALSO" \fBX509_LOOKUP_METHOD\|(3), X509_STORE\|(3)
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.