SSL_load_client_CA_file.pod 2.5 KB

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