5 X509_STORE_set_lookup_crls_cb,
6 X509_STORE_set_verify_func,
7 X509_STORE_get_cleanup,
8 X509_STORE_set_cleanup,
9 X509_STORE_get_lookup_crls,
10 X509_STORE_set_lookup_crls,
11 X509_STORE_get_lookup_certs,
12 X509_STORE_set_lookup_certs,
13 X509_STORE_get_check_policy,
14 X509_STORE_set_check_policy,
15 X509_STORE_get_cert_crl,
16 X509_STORE_set_cert_crl,
17 X509_STORE_get_check_crl,
18 X509_STORE_set_check_crl,
19 X509_STORE_get_get_crl,
20 X509_STORE_set_get_crl,
21 X509_STORE_get_check_revocation,
22 X509_STORE_set_check_revocation,
23 X509_STORE_get_check_issued,
24 X509_STORE_set_check_issued,
25 X509_STORE_CTX_get1_issuer,
26 X509_STORE_get_get_issuer,
27 X509_STORE_set_get_issuer,
28 X509_STORE_CTX_get_verify,
29 X509_STORE_set_verify,
30 X509_STORE_get_verify_cb,
31 X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb,
32 X509_STORE_CTX_cert_crl_fn, X509_STORE_CTX_check_crl_fn,
33 X509_STORE_CTX_check_issued_fn, X509_STORE_CTX_check_policy_fn,
34 X509_STORE_CTX_check_revocation_fn, X509_STORE_CTX_cleanup_fn,
35 X509_STORE_CTX_get_crl_fn, X509_STORE_CTX_get_issuer_fn,
36 X509_STORE_CTX_lookup_certs_fn, X509_STORE_CTX_lookup_crls_fn
37 - set verification callback
41 #include <openssl/x509_vfy.h>
43 typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer,
44 X509_STORE_CTX *ctx, X509 *x);
45 typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx,
46 X509 *x, X509 *issuer);
47 typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx);
48 typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx,
49 X509_CRL **crl, X509 *x);
50 typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl);
51 typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx,
52 X509_CRL *crl, X509 *x);
53 typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx);
54 typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx,
56 typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(const
59 typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx);
61 void X509_STORE_set_verify_cb(X509_STORE *xs,
62 X509_STORE_CTX_verify_cb verify_cb);
63 X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(const X509_STORE_CTX *ctx);
65 void X509_STORE_set_verify(X509_STORE *xs, X509_STORE_CTX_verify_fn verify);
66 X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(const X509_STORE_CTX *ctx);
68 int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
69 X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(const X509_STORE_CTX *ctx);
70 void X509_STORE_set_get_issuer(X509_STORE *xs,
71 X509_STORE_CTX_get_issuer_fn get_issuer);
73 void X509_STORE_set_check_issued(X509_STORE *xs,
74 X509_STORE_CTX_check_issued_fn check_issued);
75 X509_STORE_CTX_check_issued_fn
76 X509_STORE_get_check_issued(const X509_STORE_CTX *ctx);
78 void X509_STORE_set_check_revocation(X509_STORE *xs,
79 X509_STORE_CTX_check_revocation_fn check_revocation);
80 X509_STORE_CTX_check_revocation_fn
81 X509_STORE_get_check_revocation(const X509_STORE_CTX *ctx);
83 void X509_STORE_set_get_crl(X509_STORE *xs,
84 X509_STORE_CTX_get_crl_fn get_crl);
85 X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(const X509_STORE_CTX *ctx);
87 void X509_STORE_set_check_crl(X509_STORE *xs,
88 X509_STORE_CTX_check_crl_fn check_crl);
89 X509_STORE_CTX_check_crl_fn
90 X509_STORE_get_check_crl(const X509_STORE_CTX *ctx);
92 void X509_STORE_set_cert_crl(X509_STORE *xs,
93 X509_STORE_CTX_cert_crl_fn cert_crl);
94 X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(const X509_STORE_CTX *ctx);
96 void X509_STORE_set_check_policy(X509_STORE *xs,
97 X509_STORE_CTX_check_policy_fn check_policy);
98 X509_STORE_CTX_check_policy_fn
99 X509_STORE_get_check_policy(const X509_STORE_CTX *ctx);
101 void X509_STORE_set_lookup_certs(X509_STORE *xs,
102 X509_STORE_CTX_lookup_certs_fn lookup_certs);
103 X509_STORE_CTX_lookup_certs_fn
104 X509_STORE_get_lookup_certs(const X509_STORE_CTX *ctx);
106 void X509_STORE_set_lookup_crls(X509_STORE *xs,
107 X509_STORE_CTX_lookup_crls_fn lookup_crls);
108 X509_STORE_CTX_lookup_crls_fn
109 X509_STORE_get_lookup_crls(const X509_STORE_CTX *ctx);
111 void X509_STORE_set_cleanup(X509_STORE *xs,
112 X509_STORE_CTX_cleanup_fn cleanup);
113 X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(const X509_STORE_CTX *ctx);
116 void X509_STORE_set_verify_cb_func(X509_STORE *st,
117 X509_STORE_CTX_verify_cb verify_cb);
118 void X509_STORE_set_verify_func(X509_STORE *xs,
119 X509_STORE_CTX_verify_fn verify);
120 void X509_STORE_set_lookup_crls_cb(X509_STORE *xs,
121 X509_STORE_CTX_lookup_crls_fn lookup_crls);
125 X509_STORE_set_verify_cb() sets the verification callback of I<xs> to
126 I<verify_cb> overwriting the previous callback.
127 The callback assigned with this function becomes a default for the one
128 that can be assigned directly to the corresponding B<X509_STORE_CTX>,
129 please see L<X509_STORE_CTX_set_verify_cb(3)> for further information.
131 X509_STORE_set_verify() sets the final chain verification function for
133 Its purpose is to go through the chain of certificates and check that
134 all signatures are valid and that the current time is within the
135 limits of each certificate's first and last validity time.
136 The final chain verification functions must return 0 on failure and 1
138 I<If no chain verification function is provided, the internal default
139 function will be used instead.>
141 X509_STORE_CTX_get1_issuer() tries to find a certificate from the I<store>
142 component of I<ctx> that has a subject name matching the issuer name of I<x>
143 and is accepted by the I<check_issued> function in I<ctx>.
144 On success it assigns to I<*issuer> the first match that has a suitable validity
145 period or otherwise has the latest expiration date of all matching certificates.
146 If the function returns 1 the caller is responsible for freeing I<*issuer>.
147 Note that this search does not support backtracking.
149 X509_STORE_set_get_issuer() sets the function I<get_issuer> that is used
150 to get the "best" candidate issuer certificate of the given certificate I<x>.
151 When such a certificate is found, I<get_issuer> must up-ref and assign it
152 to I<*issuer> and then return 1.
153 Otherwise I<get_issuer> must return 0 if not found and -1 (or 0) on failure.
154 If X509_STORE_set_get_issuer() is not used or I<get_issuer> is NULL
155 then X509_STORE_CTX_get1_issuer() is used as the default implementation.
157 X509_STORE_set_check_issued() sets the function to check that a given
158 certificate I<x> is issued by the issuer certificate I<issuer>.
159 This function must return 0 on failure (among others if I<x> hasn't
160 been issued with I<issuer>) and 1 on success.
161 I<If no function to get the issuer is provided, the internal default
162 function will be used instead.>
164 X509_STORE_set_check_revocation() sets the revocation checking
166 Its purpose is to look through the final chain and check the
167 revocation status for each certificate.
168 It must return 0 on failure and 1 on success.
169 I<If no function to get the issuer is provided, the internal default
170 function will be used instead.>
172 X509_STORE_set_get_crl() sets the function to get the crl for a given
174 When found, the crl must be assigned to I<*crl>.
175 This function must return 0 on failure and 1 on success.
176 I<If no function to get the issuer is provided, the internal default
177 function will be used instead.>
179 X509_STORE_set_check_crl() sets the function to check the validity of
181 This function must return 0 on failure and 1 on success.
182 I<If no function to get the issuer is provided, the internal default
183 function will be used instead.>
185 X509_STORE_set_cert_crl() sets the function to check the revocation
186 status of the given certificate I<x> against the given I<crl>.
187 This function must return 0 on failure and 1 on success.
188 I<If no function to get the issuer is provided, the internal default
189 function will be used instead.>
191 X509_STORE_set_check_policy() sets the function to check the policies
192 of all the certificates in the final chain..
193 This function must return 0 on failure and 1 on success.
194 I<If no function to get the issuer is provided, the internal default
195 function will be used instead.>
197 X509_STORE_set_lookup_certs() and X509_STORE_set_lookup_crls() set the
198 functions to look up all the certs or all the CRLs that match the
200 These functions return NULL on failure and a pointer to a stack of
201 certificates (B<X509>) or to a stack of CRLs (B<X509_CRL>) on
203 I<If no function to get the issuer is provided, the internal default
204 function will be used instead.>
206 X509_STORE_set_cleanup() sets the final cleanup function, which is
207 called when the context (B<X509_STORE_CTX>) is being torn down.
208 This function doesn't return any value.
209 I<If no function to get the issuer is provided, the internal default
210 function will be used instead.>
212 X509_STORE_get_verify_cb(), X509_STORE_CTX_get_verify(),
213 X509_STORE_get_get_issuer(), X509_STORE_get_check_issued(),
214 X509_STORE_get_check_revocation(), X509_STORE_get_get_crl(),
215 X509_STORE_get_check_crl(), X509_STORE_set_verify(),
216 X509_STORE_set_get_issuer(), X509_STORE_get_cert_crl(),
217 X509_STORE_get_check_policy(), X509_STORE_get_lookup_certs(),
218 X509_STORE_get_lookup_crls() and X509_STORE_get_cleanup() all return
219 the function pointer assigned with X509_STORE_set_check_issued(),
220 X509_STORE_set_check_revocation(), X509_STORE_set_get_crl(),
221 X509_STORE_set_check_crl(), X509_STORE_set_cert_crl(),
222 X509_STORE_set_check_policy(), X509_STORE_set_lookup_certs(),
223 X509_STORE_set_lookup_crls() and X509_STORE_set_cleanup(), or NULL if
224 no assignment has been made.
226 X509_STORE_set_verify_cb_func(), X509_STORE_set_verify_func() and
227 X509_STORE_set_lookup_crls_cb() are aliases for
228 X509_STORE_set_verify_cb(), X509_STORE_set_verify() and
229 X509_STORE_set_lookup_crls, available as macros for backward
234 All the callbacks from a B<X509_STORE> are inherited by the
235 corresponding B<X509_STORE_CTX> structure when it is initialized.
236 See L<X509_STORE_CTX_set_verify_cb(3)> for further details.
240 The macro version of this function was the only one available before
245 The X509_STORE_set_*() functions do not return a value.
247 The X509_STORE_get_*() functions return a pointer of the appropriate
250 X509_STORE_CTX_get1_issuer() returns
251 1 if a suitable certificate is found, 0 if not found, -1 on other error.
255 L<X509_STORE_CTX_set_verify_cb(3)>, L<X509_STORE_CTX_get0_chain(3)>,
256 L<X509_STORE_CTX_verify_cb(3)>, L<X509_STORE_CTX_verify_fn(3)>,
261 The X509_STORE_set_verify_cb() function was added in OpenSSL 1.0.0.
264 X509_STORE_set_verify_cb(), X509_STORE_get_verify_cb(),
265 X509_STORE_set_verify(), X509_STORE_CTX_get_verify(),
266 X509_STORE_set_get_issuer(), X509_STORE_get_get_issuer(),
267 X509_STORE_set_check_issued(), X509_STORE_get_check_issued(),
268 X509_STORE_set_check_revocation(), X509_STORE_get_check_revocation(),
269 X509_STORE_set_get_crl(), X509_STORE_get_get_crl(),
270 X509_STORE_set_check_crl(), X509_STORE_get_check_crl(),
271 X509_STORE_set_cert_crl(), X509_STORE_get_cert_crl(),
272 X509_STORE_set_check_policy(), X509_STORE_get_check_policy(),
273 X509_STORE_set_lookup_certs(), X509_STORE_get_lookup_certs(),
274 X509_STORE_set_lookup_crls(), X509_STORE_get_lookup_crls(),
275 X509_STORE_set_cleanup() and X509_STORE_get_cleanup()
276 were added in OpenSSL 1.1.0.
280 Copyright 2009-2021 The OpenSSL Project Authors. All Rights Reserved.
282 Licensed under the Apache License 2.0 (the "License"). You may not use
283 this file except in compliance with the License. You can obtain a copy
284 in the file LICENSE in the source distribution or at
285 L<https://www.openssl.org/source/license.html>.