SSL_load_client_CA_file.pod 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. =pod
  2. =head1 NAME
  3. SSL_load_client_CA_file_with_libctx, SSL_load_client_CA_file,
  4. SSL_add_file_cert_subjects_to_stack,
  5. SSL_add_dir_cert_subjects_to_stack,
  6. SSL_add_store_cert_subjects_to_stack
  7. - load certificate names
  8. =head1 SYNOPSIS
  9. #include <openssl/ssl.h>
  10. STACK_OF(X509_NAME) *SSL_load_client_CA_file_with_libctx(const char *file,
  11. OPENSSL_CTX *libctx,
  12. const char *propq);
  13. STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
  14. int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
  15. const char *file);
  16. int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
  17. const char *dir);
  18. int SSL_add_store_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
  19. const char *store);
  20. =head1 DESCRIPTION
  21. SSL_load_client_CA_file_with_libctx() reads certificates from I<file> and returns
  22. a STACK_OF(X509_NAME) with the subject names found. The library context I<libctx>
  23. and property query <propq> are used when fetching algorithms from providers.
  24. SSL_load_client_CA_file() is similar to SSL_load_client_CA_file_with_libctx()
  25. but uses NULL for the library context I<libctx> and property query <propq>.
  26. SSL_add_file_cert_subjects_to_stack() reads certificates from I<file>,
  27. and adds their subject name to the already existing I<stack>.
  28. SSL_add_dir_cert_subjects_to_stack() reads certificates from every
  29. file in the directory I<dir>, and adds their subject name to the
  30. already existing I<stack>.
  31. SSL_add_store_cert_subjects_to_stack() loads certificates from the
  32. I<store> URI, and adds their subject name to the already existing
  33. I<stack>.
  34. =head1 NOTES
  35. SSL_load_client_CA_file() reads a file of PEM formatted certificates and
  36. extracts the X509_NAMES of the certificates found. While the name suggests
  37. the specific usage as support function for
  38. L<SSL_CTX_set_client_CA_list(3)>,
  39. it is not limited to CA certificates.
  40. =head1 RETURN VALUES
  41. The following return values can occur:
  42. =over 4
  43. =item NULL
  44. The operation failed, check out the error stack for the reason.
  45. =item Pointer to STACK_OF(X509_NAME)
  46. Pointer to the subject names of the successfully read certificates.
  47. =back
  48. =head1 EXAMPLES
  49. Load names of CAs from file and use it as a client CA list:
  50. SSL_CTX *ctx;
  51. STACK_OF(X509_NAME) *cert_names;
  52. ...
  53. cert_names = SSL_load_client_CA_file("/path/to/CAfile.pem");
  54. if (cert_names != NULL)
  55. SSL_CTX_set_client_CA_list(ctx, cert_names);
  56. else
  57. /* error */
  58. ...
  59. =head1 SEE ALSO
  60. L<ssl(7)>,
  61. L<ossl_store(7)>,
  62. L<SSL_CTX_set_client_CA_list(3)>
  63. =head1 HISTORY
  64. SSL_load_client_CA_file_with_libctx() and SSL_add_store_cert_subjects_to_stack()
  65. were added in OpenSSL 3.0.
  66. =head1 COPYRIGHT
  67. Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
  68. Licensed under the Apache License 2.0 (the "License"). You may not use
  69. this file except in compliance with the License. You can obtain a copy
  70. in the file LICENSE in the source distribution or at
  71. L<https://www.openssl.org/source/license.html>.
  72. =cut