1X509_STORE_ADD_CERT(3)              OpenSSL             X509_STORE_ADD_CERT(3)
2
3
4

NAME

6       X509_STORE_add_cert, X509_STORE_add_crl, X509_STORE_set_depth,
7       X509_STORE_set_flags, X509_STORE_set_purpose, X509_STORE_set_trust,
8       X509_STORE_load_locations, X509_STORE_set_default_paths - X509_STORE
9       manipulation
10

SYNOPSIS

12        #include <openssl/x509_vfy.h>
13
14        int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
15        int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
16        int X509_STORE_set_depth(X509_STORE *store, int depth);
17        int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
18        int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
19        int X509_STORE_set_trust(X509_STORE *ctx, int trust);
20
21        int X509_STORE_load_locations(X509_STORE *ctx,
22                                      const char *file, const char *dir);
23        int X509_STORE_set_default_paths(X509_STORE *ctx);
24

DESCRIPTION

26       The X509_STORE structure is intended to be a consolidated mechanism for
27       holding information about X.509 certificates and CRLs, and constructing
28       and validating chains of certificates terminating in trusted roots.  It
29       admits multiple lookup mechanisms and efficient scaling performance
30       with large numbers of certificates, and a great deal of flexibility in
31       how validation and policy checks are performed.
32
33       X509_STORE_new(3) creates an empty X509_STORE structure, which contains
34       no information about trusted certificates or where such certificates
35       are located on disk, and is generally not usable.  Normally, trusted
36       certificates will be added to the X509_STORE to prepare it for use, via
37       mechanisms such as X509_STORE_add_lookup() and X509_LOOKUP_file(), or
38       PEM_read_bio_X509_AUX() and X509_STORE_add_cert().  CRLs can also be
39       added, and many behaviors configured as desired.
40
41       Once the X509_STORE is suitably configured, X509_STORE_CTX_new() is
42       used to instantiate a single-use X509_STORE_CTX for each chain-building
43       and verification operation.  That process includes providing the end-
44       entity certificate to be verified and an additional set of untrusted
45       certificates that may be used in chain-building.  As such, it is
46       expected that the certificates included in the X509_STORE are
47       certificates that represent trusted entities such as root certificate
48       authorities (CAs).  OpenSSL represents these trusted certificates
49       internally as X509 objects with an associated X509_CERT_AUX, as are
50       produced by PEM_read_bio_X509_AUX() and similar routines that refer to
51       X509_AUX.  The public interfaces that operate on such trusted
52       certificates still operate on pointers to X509 objects, though.
53
54       X509_STORE_add_cert() and X509_STORE_add_crl() add the respective
55       object to the X509_STORE's local storage.  Untrusted objects should not
56       be added in this way.  The added object's reference count is
57       incremented by one, hence the caller retains ownership of the object
58       and needs to free it when it is no longer needed.
59
60       X509_STORE_set_depth(), X509_STORE_set_flags(),
61       X509_STORE_set_purpose(), X509_STORE_set_trust(), and
62       X509_STORE_set1_param() set the default values for the corresponding
63       values used in certificate chain validation.  Their behavior is
64       documented in the corresponding X509_VERIFY_PARAM manual pages, e.g.,
65       X509_VERIFY_PARAM_set_depth(3).
66
67       X509_STORE_load_locations() loads trusted certificate(s) into an
68       X509_STORE from a given file and/or directory path.  It is permitted to
69       specify just a file, just a directory, or both paths.  The certificates
70       in the directory must be in hashed form, as documented in
71       X509_LOOKUP_hash_dir(3).
72
73       X509_STORE_set_default_paths() is somewhat misnamed, in that it does
74       not set what default paths should be used for loading certificates.
75       Instead, it loads certificates into the X509_STORE from the hardcoded
76       default paths.
77

RETURN VALUES

79       X509_STORE_add_cert(), X509_STORE_add_crl(), X509_STORE_set_depth(),
80       X509_STORE_set_flags(), X509_STORE_set_purpose(),
81       X509_STORE_set_trust(), X509_STORE_load_locations(), and
82       X509_STORE_set_default_paths() return 1 on success or 0 on failure.
83

SEE ALSO

85       X509_LOOKUP_hash_dir(3).  X509_VERIFY_PARAM_set_depth(3).
86       X509_STORE_new(3), X509_STORE_get0_param(3)
87
89       Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
90
91       Licensed under the OpenSSL license (the "License").  You may not use
92       this file except in compliance with the License.  You can obtain a copy
93       in the file LICENSE in the source distribution or at
94       <https://www.openssl.org/source/license.html>.
95
96
97
981.1.1d                            2019-10-03            X509_STORE_ADD_CERT(3)
Impressum