SSL_load_client_CA_file.pod 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. =pod
  2. =head1 NAME
  3. SSL_load_client_CA_file_ex, 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_ex(const char *file,
  11. OSSL_LIB_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_ex() 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 I<propq> are used when fetching algorithms from providers.
  24. SSL_load_client_CA_file() is similar to SSL_load_client_CA_file_ex()
  25. but uses NULL for the library context I<libctx> and property query I<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 for SSL_load_client_CA_file_ex(), and
  42. SSL_load_client_CA_file():
  43. =over 4
  44. =item NULL
  45. The operation failed, check out the error stack for the reason.
  46. =item Pointer to STACK_OF(X509_NAME)
  47. Pointer to the subject names of the successfully read certificates.
  48. =back
  49. The following return values can occur for SSL_add_file_cert_subjects_to_stack(),
  50. SSL_add_dir_cert_subjects_to_stack(), and SSL_add_store_cert_subjects_to_stack():
  51. =over 4
  52. =item 0 (Failure)
  53. The operation failed.
  54. =item 1 (Success)
  55. The operation succeeded.
  56. =back
  57. =head1 EXAMPLES
  58. Load names of CAs from file and use it as a client CA list:
  59. SSL_CTX *ctx;
  60. STACK_OF(X509_NAME) *cert_names;
  61. ...
  62. cert_names = SSL_load_client_CA_file("/path/to/CAfile.pem");
  63. if (cert_names != NULL)
  64. SSL_CTX_set_client_CA_list(ctx, cert_names);
  65. else
  66. /* error */
  67. ...
  68. =head1 SEE ALSO
  69. L<ssl(7)>,
  70. L<ossl_store(7)>,
  71. L<SSL_CTX_set_client_CA_list(3)>
  72. =head1 HISTORY
  73. SSL_load_client_CA_file_ex() and SSL_add_store_cert_subjects_to_stack()
  74. were added in OpenSSL 3.0.
  75. =head1 COPYRIGHT
  76. Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved.
  77. Licensed under the Apache License 2.0 (the "License"). You may not use
  78. this file except in compliance with the License. You can obtain a copy
  79. in the file LICENSE in the source distribution or at
  80. L<https://www.openssl.org/source/license.html>.
  81. =cut