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