X509_STORE_set_verify_cb_func.pod 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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> and
  126. the issuer is not yet in the chain contained in <ctx>, where the exceptional
  127. case that B<x> is self-issued and ctx->chain has just one element is allowed.
  128. This function must return 0 on failure (among others if B<x> hasn't
  129. been issued with B<issuer>) and 1 on success.
  130. I<If no function to get the issuer is provided, the internal default
  131. function will be used instead.>
  132. X509_STORE_set_check_revocation() sets the revocation checking
  133. function.
  134. Its purpose is to look through the final chain and check the
  135. revocation status for each certificate.
  136. It must return 0 on failure and 1 on success.
  137. I<If no function to get the issuer is provided, the internal default
  138. function will be used instead.>
  139. X509_STORE_set_get_crl() sets the function to get the crl for a given
  140. certificate B<x>.
  141. When found, the crl must be assigned to B<*crl>.
  142. This function must return 0 on failure and 1 on success.
  143. I<If no function to get the issuer is provided, the internal default
  144. function will be used instead.>
  145. X509_STORE_set_check_crl() sets the function to check the validity of
  146. the given B<crl>.
  147. This function 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. X509_STORE_set_cert_crl() sets the function to check the revocation
  151. status of the given certificate B<x> against the given B<crl>.
  152. This function must return 0 on failure and 1 on success.
  153. I<If no function to get the issuer is provided, the internal default
  154. function will be used instead.>
  155. X509_STORE_set_check_policy() sets the function to check the policies
  156. of all the certificates in the final chain..
  157. This function must return 0 on failure and 1 on success.
  158. I<If no function to get the issuer is provided, the internal default
  159. function will be used instead.>
  160. X509_STORE_set_lookup_certs() and X509_STORE_set_lookup_crls() set the
  161. functions to look up all the certs or all the CRLs that match the
  162. given name B<nm>.
  163. These functions return NULL on failure and a pointer to a stack of
  164. certificates (B<X509>) or to a stack of CRLs (B<X509_CRL>) on
  165. success.
  166. I<If no function to get the issuer is provided, the internal default
  167. function will be used instead.>
  168. X509_STORE_set_cleanup() sets the final cleanup function, which is
  169. called when the context (B<X509_STORE_CTX>) is being torn down.
  170. This function doesn't return any value.
  171. I<If no function to get the issuer is provided, the internal default
  172. function will be used instead.>
  173. X509_STORE_get_verify_cb(), X509_STORE_CTX_get_verify(),
  174. X509_STORE_get_get_issuer(), X509_STORE_get_check_issued(),
  175. X509_STORE_get_check_revocation(), X509_STORE_get_get_crl(),
  176. X509_STORE_get_check_crl(), X509_STORE_set_verify(),
  177. X509_STORE_set_get_issuer(), X509_STORE_get_cert_crl(),
  178. X509_STORE_get_check_policy(), X509_STORE_get_lookup_certs(),
  179. X509_STORE_get_lookup_crls() and X509_STORE_get_cleanup() all return
  180. the function pointer assigned with X509_STORE_set_check_issued(),
  181. X509_STORE_set_check_revocation(), X509_STORE_set_get_crl(),
  182. X509_STORE_set_check_crl(), X509_STORE_set_cert_crl(),
  183. X509_STORE_set_check_policy(), X509_STORE_set_lookup_certs(),
  184. X509_STORE_set_lookup_crls() and X509_STORE_set_cleanup(), or NULL if
  185. no assignment has been made.
  186. X509_STORE_set_verify_cb_func(), X509_STORE_set_verify_func() and
  187. X509_STORE_set_lookup_crls_cb() are aliases for
  188. X509_STORE_set_verify_cb(), X509_STORE_set_verify() and
  189. X509_STORE_set_lookup_crls, available as macros for backward
  190. compatibility.
  191. =head1 NOTES
  192. All the callbacks from a B<X509_STORE> are inherited by the
  193. corresponding B<X509_STORE_CTX> structure when it is initialized.
  194. See L<X509_STORE_CTX_set_verify_cb(3)> for further details.
  195. =head1 BUGS
  196. The macro version of this function was the only one available before
  197. OpenSSL 1.0.0.
  198. =head1 RETURN VALUES
  199. The X509_STORE_set_*() functions do not return a value.
  200. The X509_STORE_get_*() functions return a pointer of the appropriate
  201. function type.
  202. =head1 SEE ALSO
  203. L<X509_STORE_CTX_set_verify_cb(3)>, L<X509_STORE_CTX_get0_chain(3)>,
  204. L<X509_STORE_CTX_verify_cb(3)>, L<X509_STORE_CTX_verify_fn(3)>,
  205. L<CMS_verify(3)>
  206. =head1 HISTORY
  207. The X509_STORE_set_verify_cb() function was added in OpenSSL 1.0.0.
  208. The functions
  209. X509_STORE_set_verify_cb(), X509_STORE_get_verify_cb(),
  210. X509_STORE_set_verify(), X509_STORE_CTX_get_verify(),
  211. X509_STORE_set_get_issuer(), X509_STORE_get_get_issuer(),
  212. X509_STORE_set_check_issued(), X509_STORE_get_check_issued(),
  213. X509_STORE_set_check_revocation(), X509_STORE_get_check_revocation(),
  214. X509_STORE_set_get_crl(), X509_STORE_get_get_crl(),
  215. X509_STORE_set_check_crl(), X509_STORE_get_check_crl(),
  216. X509_STORE_set_cert_crl(), X509_STORE_get_cert_crl(),
  217. X509_STORE_set_check_policy(), X509_STORE_get_check_policy(),
  218. X509_STORE_set_lookup_certs(), X509_STORE_get_lookup_certs(),
  219. X509_STORE_set_lookup_crls(), X509_STORE_get_lookup_crls(),
  220. X509_STORE_set_cleanup() and X509_STORE_get_cleanup()
  221. were added in OpenSSL 1.1.0.
  222. =head1 COPYRIGHT
  223. Copyright 2009-2020 The OpenSSL Project Authors. All Rights Reserved.
  224. Licensed under the Apache License 2.0 (the "License"). You may not use
  225. this file except in compliance with the License. You can obtain a copy
  226. in the file LICENSE in the source distribution or at
  227. L<https://www.openssl.org/source/license.html>.
  228. =cut