]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/SSL_load_client_CA_file.pod
Expand the XTS documentation
[thirdparty/openssl.git] / doc / man3 / SSL_load_client_CA_file.pod
CommitLineData
356c06c7
RL
1=pod
2
3=head1 NAME
4
ee669781
RL
5SSL_load_client_CA_file,
6SSL_add_file_cert_subjects_to_stack,
7SSL_add_dir_cert_subjects_to_stack,
8SSL_add_store_cert_subjects_to_stack
9- load certificate names
356c06c7
RL
10
11=head1 SYNOPSIS
12
13 #include <openssl/ssl.h>
14
15 STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
16
ee669781
RL
17 int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
18 const char *file)
19 int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
20 const char *dir)
21 int SSL_add_store_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
22 const char *store)
23
356c06c7
RL
24=head1 DESCRIPTION
25
ee669781 26SSL_load_client_CA_file() reads certificates from I<file> and returns
356c06c7
RL
27a STACK_OF(X509_NAME) with the subject names found.
28
ee669781
RL
29SSL_add_file_cert_subjects_to_stack() reads certificates from I<file>,
30and adds their subject name to the already existing I<stack>.
31
32SSL_add_dir_cert_subjects_to_stack() reads certificates from every
33file in the directory I<dir>, and adds their subject name to the
34already existing I<stack>.
35
36SSL_add_store_cert_subjects_to_stack() loads certificates from the
37I<store> URI, and adds their subject name to the already existing
38I<stack>.
39
356c06c7
RL
40=head1 NOTES
41
42SSL_load_client_CA_file() reads a file of PEM formatted certificates and
43extracts the X509_NAMES of the certificates found. While the name suggests
44the specific usage as support function for
9b86974e 45L<SSL_CTX_set_client_CA_list(3)>,
356c06c7
RL
46it is not limited to CA certificates.
47
356c06c7
RL
48=head1 RETURN VALUES
49
50The following return values can occur:
51
52=over 4
53
54=item NULL
55
56The operation failed, check out the error stack for the reason.
57
58=item Pointer to STACK_OF(X509_NAME)
59
60Pointer to the subject names of the successfully read certificates.
61
62=back
63
4564e77a
PY
64=head1 EXAMPLES
65
66Load names of CAs from file and use it as a client CA list:
67
68 SSL_CTX *ctx;
69 STACK_OF(X509_NAME) *cert_names;
70
71 ...
72 cert_names = SSL_load_client_CA_file("/path/to/CAfile.pem");
73 if (cert_names != NULL)
74 SSL_CTX_set_client_CA_list(ctx, cert_names);
75 else
76 /* error */
77 ...
78
356c06c7
RL
79=head1 SEE ALSO
80
b97fdb57 81L<ssl(7)>,
ee669781 82L<ossl_store(7)>,
9b86974e 83L<SSL_CTX_set_client_CA_list(3)>
356c06c7 84
ee669781
RL
85=head1 HISTORY
86
87SSL_add_store_cert_subjects_to_stack() was added in OpenSSL 3.0.
88
e2f92610
RS
89=head1 COPYRIGHT
90
ee669781 91Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 92
4746f25a 93Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
94this file except in compliance with the License. You can obtain a copy
95in the file LICENSE in the source distribution or at
96L<https://www.openssl.org/source/license.html>.
97
98=cut