X509_STORE_set_verify_cb_func.pod 11 KB

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