Add SSL_CTX_set1_cert_store()
[openssl.git] / doc / man3 / X509_STORE_set_verify_cb_func.pod
1 =pod
2
3 =head1 NAME
4
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_get_get_issuer,
26 X509_STORE_set_get_issuer,
27 X509_STORE_CTX_get_verify,
28 X509_STORE_set_verify,
29 X509_STORE_get_verify_cb,
30 X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb
31 - set verification callback
32
33 =head1 SYNOPSIS
34
35  #include <openssl/x509_vfy.h>
36
37  typedef int (*X509_STORE_CTX_verify_cb)(int ok, X509_STORE_CTX *ctx);
38  typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *ctx);
39  typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer,
40                                              X509_STORE_CTX *ctx, X509 *x);
41  typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx,
42                                                X509 *x, X509 *issuer);
43  typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx);
44  typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx,
45                                           X509_CRL **crl, X509 *x);
46  typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl);
47  typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx,
48                                            X509_CRL *crl, X509 *x);
49  typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx);
50  typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx,
51                                                            X509_NAME *nm);
52  typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx,
53                                                               X509_NAME *nm);
54  typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx);
55
56  void X509_STORE_set_verify_cb(X509_STORE *ctx,
57                                X509_STORE_CTX_verify_cb verify_cb);
58  X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE_CTX *ctx);
59
60  void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify);
61  X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx);
62
63  void X509_STORE_set_get_issuer(X509_STORE *ctx,
64                                 X509_STORE_CTX_get_issuer_fn get_issuer);
65  X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE_CTX *ctx);
66
67  void X509_STORE_set_check_issued(X509_STORE *ctx,
68                                   X509_STORE_CTX_check_issued_fn check_issued);
69  X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE_CTX *ctx);
70
71  void X509_STORE_set_check_revocation(X509_STORE *ctx,
72                                       X509_STORE_CTX_check_revocation_fn check_revocation);
73  X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE_CTX *ctx);
74
75  void X509_STORE_set_get_crl(X509_STORE *ctx,
76                              X509_STORE_CTX_get_crl_fn get_crl);
77  X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE_CTX *ctx);
78
79  void X509_STORE_set_check_crl(X509_STORE *ctx,
80                                X509_STORE_CTX_check_crl_fn check_crl);
81  X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE_CTX *ctx);
82
83  void X509_STORE_set_cert_crl(X509_STORE *ctx,
84                               X509_STORE_CTX_cert_crl_fn cert_crl);
85  X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE_CTX *ctx);
86
87  void X509_STORE_set_check_policy(X509_STORE *ctx,
88                                   X509_STORE_CTX_check_policy_fn check_policy);
89  X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE_CTX *ctx);
90
91  void X509_STORE_set_lookup_certs(X509_STORE *ctx,
92                                   X509_STORE_CTX_lookup_certs_fn lookup_certs);
93  X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE_CTX *ctx);
94
95  void X509_STORE_set_lookup_crls(X509_STORE *ctx,
96                                  X509_STORE_CTX_lookup_crls_fn lookup_crls);
97  X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE_CTX *ctx);
98
99  void X509_STORE_set_cleanup(X509_STORE *ctx,
100                              X509_STORE_CTX_cleanup_fn cleanup);
101  X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE_CTX *ctx);
102
103  /* Aliases */
104  void X509_STORE_set_verify_cb_func(X509_STORE *st,
105                                     X509_STORE_CTX_verify_cb verify_cb);
106  void X509_STORE_set_verify_func(X509_STORE *ctx,
107                                  X509_STORE_CTX_verify_fn verify);
108  void X509_STORE_set_lookup_crls_cb(X509_STORE *ctx,
109                                     X509_STORE_CTX_lookup_crls_fn lookup_crls);
110
111 =head1 DESCRIPTION
112
113 X509_STORE_set_verify_cb() sets the verification callback of B<ctx> to
114 B<verify_cb> overwriting the previous callback.
115 The callback assigned with this function becomes a default for the one
116 that can be assigned directly to the corresponding B<X509_STORE_CTX>,
117 please see L<X509_STORE_CTX_set_verify_cb(3)> for further information.
118
119 X509_STORE_set_verify() sets the final chain verification function for
120 B<ctx> to B<verify>.
121 Its purpose is to go through the chain of certificates and check that
122 all signatures are valid and that the current time is within the
123 limits of each certificate's first and last validity time.
124 The final chain verification functions must return 0 on failure and 1
125 on success.
126 I<If no chain verification function is provided, the internal default
127 function will be used instead.>
128
129 X509_STORE_set_get_issuer() sets the function to get the issuer
130 certificate that verifies the given certificate B<x>.
131 When found, the issuer certificate must be assigned to B<*issuer>.
132 This function must return 0 on failure and 1 on success.
133 I<If no function to get the issuer is provided, the internal default
134 function will be used instead.>
135
136 X509_STORE_set_check_issued() sets the function to check that a given
137 certificate B<x> is issued with the issuer certificate B<issuer>.
138 This function must return 0 on failure (among others if B<x> hasn't
139 been issued with B<issuer>) and 1 on success.
140 I<If no function to get the issuer is provided, the internal default
141 function will be used instead.>
142
143 X509_STORE_set_check_revocation() sets the revocation checking
144 function.
145 Its purpose is to look through the final chain and check the
146 revocation status for each certificate.
147 It must return 0 on failure and 1 on success.
148 I<If no function to get the issuer is provided, the internal default
149 function will be used instead.>
150
151 X509_STORE_set_get_crl() sets the function to get the crl for a given
152 certificate B<x>.
153 When found, the crl must be assigned to B<*crl>.
154 This function must return 0 on failure and 1 on success.
155 I<If no function to get the issuer is provided, the internal default
156 function will be used instead.>
157
158 X509_STORE_set_check_crl() sets the function to check the validity of
159 the given B<crl>.
160 This function must return 0 on failure and 1 on success.
161 I<If no function to get the issuer is provided, the internal default
162 function will be used instead.>
163
164 X509_STORE_set_cert_crl() sets the function to check the revocation
165 status of the given certificate B<x> against the given B<crl>.
166 This function must return 0 on failure and 1 on success.
167 I<If no function to get the issuer is provided, the internal default
168 function will be used instead.>
169
170 X509_STORE_set_check_policy() sets the function to check the policies
171 of all the certificates in the final chain..
172 This function must return 0 on failure and 1 on success.
173 I<If no function to get the issuer is provided, the internal default
174 function will be used instead.>
175
176 X509_STORE_set_lookup_certs() and X509_STORE_set_lookup_crls() set the
177 functions to look up all the certs or all the CRLs that match the
178 given name B<nm>.
179 These functions return NULL on failure and a pointer to a stack of
180 certificates (B<X509>) or to a stack of CRLs (B<X509_CRL>) on
181 success.
182 I<If no function to get the issuer is provided, the internal default
183 function will be used instead.>
184
185 X509_STORE_set_cleanup() sets the final cleanup function, which is
186 called when the context (B<X509_STORE_CTX>) is being torn down.
187 This function doesn't return any value.
188 I<If no function to get the issuer is provided, the internal default
189 function will be used instead.>
190
191 X509_STORE_get_verify_cb(), X509_STORE_CTX_get_verify(),
192 X509_STORE_get_get_issuer(), X509_STORE_get_check_issued(),
193 X509_STORE_get_check_revocation(), X509_STORE_get_get_crl(),
194 X509_STORE_get_check_crl(), X509_STORE_set_verify(),
195 X509_STORE_set_get_issuer(), X509_STORE_get_cert_crl(),
196 X509_STORE_get_check_policy(), X509_STORE_get_lookup_certs(),
197 X509_STORE_get_lookup_crls() and X509_STORE_get_cleanup() all return
198 the function pointer assigned with X509_STORE_set_check_issued(),
199 X509_STORE_set_check_revocation(), X509_STORE_set_get_crl(),
200 X509_STORE_set_check_crl(), X509_STORE_set_cert_crl(),
201 X509_STORE_set_check_policy(), X509_STORE_set_lookup_certs(),
202 X509_STORE_set_lookup_crls() and X509_STORE_set_cleanup(), or NULL if
203 no assignment has been made.
204
205 X509_STORE_set_verify_cb_func(), X509_STORE_set_verify_func() and
206 X509_STORE_set_lookup_crls_cb() are aliases for
207 X509_STORE_set_verify_cb(), X509_STORE_set_verify() and
208 X509_STORE_set_lookup_crls, available as macros for backward
209 compatibility.
210
211 =head1 NOTES
212
213 All the callbacks from a B<X509_STORE> are inherited by the
214 corresponding B<X509_STORE_CTX> structure when it is initialized.
215 See L<X509_STORE_CTX_set_verify_cb(3)> for further details.
216
217 =head1 BUGS
218
219 The macro version of this function was the only one available before
220 OpenSSL 1.0.0.
221
222 =head1 RETURN VALUES
223
224 The X509_STORE_set_*() functions do not return a value.
225
226 The X509_STORE_get_*() functions return a pointer of the appropriate
227 function type.
228
229 =head1 SEE ALSO
230
231 L<X509_STORE_CTX_set_verify_cb(3)>, L<X509_STORE_CTX_get0_chain(3)>,
232 L<CMS_verify(3)>
233
234 =head1 HISTORY
235
236 X509_STORE_set_verify_cb() was added to OpenSSL 1.0.0.
237
238 X509_STORE_set_verify_cb(), X509_STORE_get_verify_cb(),
239 X509_STORE_set_verify(), X509_STORE_CTX_get_verify(),
240 X509_STORE_set_get_issuer(), X509_STORE_get_get_issuer(),
241 X509_STORE_set_check_issued(), X509_STORE_get_check_issued(),
242 X509_STORE_set_check_revocation(), X509_STORE_get_check_revocation(),
243 X509_STORE_set_get_crl(), X509_STORE_get_get_crl(),
244 X509_STORE_set_check_crl(), X509_STORE_get_check_crl(),
245 X509_STORE_set_cert_crl(), X509_STORE_get_cert_crl(),
246 X509_STORE_set_check_policy(), X509_STORE_get_check_policy(),
247 X509_STORE_set_lookup_certs(), X509_STORE_get_lookup_certs(),
248 X509_STORE_set_lookup_crls(), X509_STORE_get_lookup_crls(),
249 X509_STORE_set_cleanup() and X509_STORE_get_cleanup() were added in
250 OpenSSL 1.1.0.
251
252 =head1 COPYRIGHT
253
254 Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
255
256 Licensed under the OpenSSL license (the "License").  You may not use
257 this file except in compliance with the License.  You can obtain a copy
258 in the file LICENSE in the source distribution or at
259 L<https://www.openssl.org/source/license.html>.
260
261 =cut