1
0

SSL_CTX_set_cert_store.pod 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. =pod
  2. =head1 NAME
  3. SSL_CTX_set_cert_store, SSL_CTX_set1_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate verification storage
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store);
  7. void SSL_CTX_set1_cert_store(SSL_CTX *ctx, X509_STORE *store);
  8. X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx);
  9. =head1 DESCRIPTION
  10. SSL_CTX_set_cert_store() sets/replaces the certificate verification storage
  11. of B<ctx> to/with B<store>. If another X509_STORE object is currently
  12. set in B<ctx>, it will be X509_STORE_free()ed. SSL_CTX_set_cert_store() will
  13. take ownership of the B<store>, i.e., the call C<X509_STORE_free(store)> is no
  14. longer needed.
  15. SSL_CTX_set1_cert_store() sets/replaces the certificate verification storage
  16. of B<ctx> to/with B<store>. The B<store>'s reference count is incremented.
  17. If another X509_STORE object is currently set in B<ctx>, it will be X509_STORE_free()ed.
  18. SSL_CTX_get_cert_store() returns a pointer to the current certificate
  19. verification storage.
  20. =head1 NOTES
  21. In order to verify the certificates presented by the peer, trusted CA
  22. certificates must be accessed. These CA certificates are made available
  23. via lookup methods, handled inside the X509_STORE. From the X509_STORE
  24. the X509_STORE_CTX used when verifying certificates is created.
  25. Typically the trusted certificate store is handled indirectly via using
  26. L<SSL_CTX_load_verify_locations(3)>.
  27. Using the SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions
  28. it is possible to manipulate the X509_STORE object beyond the
  29. L<SSL_CTX_load_verify_locations(3)>
  30. call.
  31. Currently no detailed documentation on how to use the X509_STORE
  32. object is available. Not all members of the X509_STORE are used when
  33. the verification takes place. So will e.g. the verify_callback() be
  34. overridden with the verify_callback() set via the
  35. L<SSL_CTX_set_verify(3)> family of functions.
  36. This document must therefore be updated when documentation about the
  37. X509_STORE object and its handling becomes available.
  38. SSL_CTX_set_cert_store() does not increment the B<store>'s reference
  39. count, so it should not be used to assign an X509_STORE that is owned
  40. by another SSL_CTX.
  41. To share X509_STOREs between two SSL_CTXs, use SSL_CTX_get_cert_store()
  42. to get the X509_STORE from the first SSL_CTX, and then use
  43. SSL_CTX_set1_cert_store() to assign to the second SSL_CTX and
  44. increment the reference count of the X509_STORE.
  45. =head1 RESTRICTIONS
  46. The X509_STORE structure used by an SSL_CTX is used for verifying peer
  47. certificates and building certificate chains, it is also shared by
  48. every child SSL structure. Applications wanting finer control can use
  49. functions such as SSL_CTX_set1_verify_cert_store() instead.
  50. =head1 RETURN VALUES
  51. SSL_CTX_set_cert_store() does not return diagnostic output.
  52. SSL_CTX_set1_cert_store() does not return diagnostic output.
  53. SSL_CTX_get_cert_store() returns the current setting.
  54. =head1 SEE ALSO
  55. L<ssl(7)>,
  56. L<SSL_CTX_load_verify_locations(3)>,
  57. L<SSL_CTX_set_verify(3)>
  58. =head1 COPYRIGHT
  59. Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved.
  60. Licensed under the Apache License 2.0 (the "License"). You may not use
  61. this file except in compliance with the License. You can obtain a copy
  62. in the file LICENSE in the source distribution or at
  63. L<https://www.openssl.org/source/license.html>.
  64. =cut