1X509_STORE_CTX_NEW(3)               OpenSSL              X509_STORE_CTX_NEW(3)
2
3
4

NAME

6       X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free,
7       X509_STORE_CTX_init, X509_STORE_CTX_set0_trusted_stack,
8       X509_STORE_CTX_set_cert, X509_STORE_CTX_set0_crls,
9       X509_STORE_CTX_get0_chain, X509_STORE_CTX_set0_verified_chain,
10       X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param,
11       X509_STORE_CTX_get0_untrusted, X509_STORE_CTX_set0_untrusted,
12       X509_STORE_CTX_get_num_untrusted, X509_STORE_CTX_set_default,
13       X509_STORE_CTX_set_verify, X509_STORE_CTX_verify_fn - X509_STORE_CTX
14       initialisation
15

SYNOPSIS

17        #include <openssl/x509_vfy.h>
18
19        X509_STORE_CTX *X509_STORE_CTX_new(void);
20        void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
21        void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
22
23        int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
24                                X509 *x509, STACK_OF(X509) *chain);
25
26        void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
27
28        void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x);
29        STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx);
30        void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *chain);
31        void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk);
32
33        X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
34        void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
35        int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
36
37        STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx);
38        void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
39
40        int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx);
41
42        typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *);
43        void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, X509_STORE_CTX_verify_fn verify);
44

DESCRIPTION

46       These functions initialise an X509_STORE_CTX structure for subsequent
47       use by X509_verify_cert().
48
49       X509_STORE_CTX_new() returns a newly initialised X509_STORE_CTX
50       structure.
51
52       X509_STORE_CTX_cleanup() internally cleans up an X509_STORE_CTX
53       structure.  The context can then be reused with an new call to
54       X509_STORE_CTX_init().
55
56       X509_STORE_CTX_free() completely frees up ctx. After this call ctx is
57       no longer valid.  If ctx is NULL nothing is done.
58
59       X509_STORE_CTX_init() sets up ctx for a subsequent verification
60       operation.  It must be called before each call to X509_verify_cert(),
61       i.e. a ctx is only good for one call to X509_verify_cert(); if you want
62       to verify a second certificate with the same ctx then you must call
63       X509_STORE_CTX_cleanup() and then X509_STORE_CTX_init() again before
64       the second call to X509_verify_cert(). The trusted certificate store is
65       set to store, the end entity certificate to be verified is set to x509
66       and a set of additional certificates (which will be untrusted but may
67       be used to build the chain) in chain. Any or all of the store, x509 and
68       chain parameters can be NULL.
69
70       X509_STORE_CTX_set0_trusted_stack() sets the set of trusted
71       certificates of ctx to sk. This is an alternative way of specifying
72       trusted certificates instead of using an X509_STORE.
73
74       X509_STORE_CTX_set_cert() sets the certificate to be verified in ctx to
75       x.
76
77       X509_STORE_CTX_set0_verified_chain() sets the validated chain used by
78       ctx to be chain.  Ownership of the chain is transferred to ctx and
79       should not be free'd by the caller.  X509_STORE_CTX_get0_chain()
80       returns a the internal pointer used by the ctx that contains the
81       validated chain.
82
83       X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate
84       verification to sk. These CRLs will only be used if CRL verification is
85       enabled in the associated X509_VERIFY_PARAM structure. This might be
86       used where additional "useful" CRLs are supplied as part of a protocol,
87       for example in a PKCS#7 structure.
88
89       X509_STORE_CTX_get0_param() retrieves an internal pointer to the
90       verification parameters associated with ctx.
91
92       X509_STORE_CTX_get0_untrusted() retrieves an internal pointer to the
93       stack of untrusted certificates associated with ctx.
94
95       X509_STORE_CTX_set0_untrusted() sets the internal point to the stack of
96       untrusted certificates associated with ctx to sk.
97
98       X509_STORE_CTX_set0_param() sets the internal verification parameter
99       pointer to param. After this call param should not be used.
100
101       X509_STORE_CTX_set_default() looks up and sets the default verification
102       method to name. This uses the function X509_VERIFY_PARAM_lookup() to
103       find an appropriate set of parameters from name.
104
105       X509_STORE_CTX_get_num_untrusted() returns the number of untrusted
106       certificates that were used in building the chain following a call to
107       X509_verify_cert().
108
109       X509_STORE_CTX_set_verify() provides the capability for overriding the
110       default verify function. This function is responsible for verifying
111       chain signatures and expiration times.
112
113       A verify function is defined as an X509_STORE_CTX_verify type which has
114       the following signature:
115
116        int (*verify)(X509_STORE_CTX *);
117
118       This function should receive the current X509_STORE_CTX as a parameter
119       and return 1 on success or 0 on failure.
120

NOTES

122       The certificates and CRLs in a store are used internally and should not
123       be freed up until after the associated X509_STORE_CTX is freed.
124

BUGS

126       The certificates and CRLs in a context are used internally and should
127       not be freed up until after the associated X509_STORE_CTX is freed.
128       Copies should be made or reference counts increased instead.
129

RETURN VALUES

131       X509_STORE_CTX_new() returns an newly allocates context or NULL is an
132       error occurred.
133
134       X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred.
135
136       X509_STORE_CTX_get0_param() returns a pointer to an X509_VERIFY_PARAM
137       structure or NULL if an error occurred.
138
139       X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(),
140       X509_STORE_CTX_set0_trusted_stack(), X509_STORE_CTX_set_cert(),
141       X509_STORE_CTX_set0_crls() and X509_STORE_CTX_set0_param() do not
142       return values.
143
144       X509_STORE_CTX_set_default() returns 1 for success or 0 if an error
145       occurred.
146
147       X509_STORE_CTX_get_num_untrusted() returns the number of untrusted
148       certificates used.
149

SEE ALSO

151       X509_verify_cert(3) X509_VERIFY_PARAM_set_flags(3)
152

HISTORY

154       The X509_STORE_CTX_set0_crls() function was added in OpenSSL 1.0.0.
155       The X509_STORE_CTX_get_num_untrusted() function was added in OpenSSL
156       1.1.0.
157
159       Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
160
161       Licensed under the OpenSSL license (the "License").  You may not use
162       this file except in compliance with the License.  You can obtain a copy
163       in the file LICENSE in the source distribution or at
164       <https://www.openssl.org/source/license.html>.
165
166
167
1681.1.1g                            2020-04-23             X509_STORE_CTX_NEW(3)
Impressum