diff options
Diffstat (limited to 'src/lib/libtls/man/tls_load_file.3')
-rw-r--r-- | src/lib/libtls/man/tls_load_file.3 | 197 |
1 files changed, 197 insertions, 0 deletions
diff --git a/src/lib/libtls/man/tls_load_file.3 b/src/lib/libtls/man/tls_load_file.3 new file mode 100644 index 0000000000..2b2f01a8a9 --- /dev/null +++ b/src/lib/libtls/man/tls_load_file.3 | |||
@@ -0,0 +1,197 @@ | |||
1 | .\" $OpenBSD: tls_load_file.3,v 1.1 2017/01/25 23:53:18 schwarze Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: January 25 2017 $ | ||
18 | .Dt TLS_LOAD_FILE 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm tls_load_file , | ||
22 | .Nm tls_config_set_ca_file , | ||
23 | .Nm tls_config_set_ca_path , | ||
24 | .Nm tls_config_set_ca_mem , | ||
25 | .Nm tls_config_set_cert_file , | ||
26 | .Nm tls_config_set_cert_mem , | ||
27 | .Nm tls_config_set_key_file , | ||
28 | .Nm tls_config_set_key_mem , | ||
29 | .Nm tls_config_set_keypair_file , | ||
30 | .Nm tls_config_set_keypair_mem , | ||
31 | .Nm tls_config_add_keypair_file , | ||
32 | .Nm tls_config_add_keypair_mem , | ||
33 | .Nm tls_config_clear_keys , | ||
34 | .Nm tls_config_set_verify_depth , | ||
35 | .Nm tls_config_verify_client , | ||
36 | .Nm tls_config_verify_client_optional | ||
37 | .Nd TLS certificate and key configuration | ||
38 | .Sh SYNOPSIS | ||
39 | .In tls.h | ||
40 | .Ft uint8_t * | ||
41 | .Fo tls_load_file | ||
42 | .Fa "const char *file" | ||
43 | .Fa "size_t *len" | ||
44 | .Fa "char *password" | ||
45 | .Fc | ||
46 | .Ft int | ||
47 | .Fo tls_config_set_ca_file | ||
48 | .Fa "struct tls_config *config" | ||
49 | .Fa "const char *ca_file" | ||
50 | .Fc | ||
51 | .Ft int | ||
52 | .Fo tls_config_set_ca_path | ||
53 | .Fa "struct tls_config *config" | ||
54 | .Fa "const char *ca_path" | ||
55 | .Fc | ||
56 | .Ft int | ||
57 | .Fo tls_config_set_ca_mem | ||
58 | .Fa "struct tls_config *config" | ||
59 | .Fa "const uint8_t *cert" | ||
60 | .Fa "size_t len" | ||
61 | .Fc | ||
62 | .Ft int | ||
63 | .Fo tls_config_set_cert_file | ||
64 | .Fa "struct tls_config *config" | ||
65 | .Fa "const char *cert_file" | ||
66 | .Fc | ||
67 | .Ft int | ||
68 | .Fo tls_config_set_cert_mem | ||
69 | .Fa "struct tls_config *config" | ||
70 | .Fa "const uint8_t *cert" | ||
71 | .Fa "size_t len" | ||
72 | .Fc | ||
73 | .Ft int | ||
74 | .Fo tls_config_set_key_file | ||
75 | .Fa "struct tls_config *config" | ||
76 | .Fa "const char *key_file" | ||
77 | .Fc | ||
78 | .Ft int | ||
79 | .Fo tls_config_set_key_mem | ||
80 | .Fa "struct tls_config *config" | ||
81 | .Fa "const uint8_t *key" | ||
82 | .Fa "size_t len" | ||
83 | .Fc | ||
84 | .Ft int | ||
85 | .Fo tls_config_set_keypair_file | ||
86 | .Fa "struct tls_config *config" | ||
87 | .Fa "const char *cert_file" | ||
88 | .Fa "const char *key_file" | ||
89 | .Fc | ||
90 | .Ft int | ||
91 | .Fo tls_config_set_keypair_mem | ||
92 | .Fa "struct tls_config *config" | ||
93 | .Fa "const uint8_t *cert" | ||
94 | .Fa "size_t cert_len" | ||
95 | .Fa "const uint8_t *key" | ||
96 | .Fa "size_t key_len" | ||
97 | .Fc | ||
98 | .Ft int | ||
99 | .Fo tls_config_add_keypair_file | ||
100 | .Fa "struct tls_config *config" | ||
101 | .Fa "const char *cert_file" | ||
102 | .Fa "const char *key_file" | ||
103 | .Fc | ||
104 | .Ft int | ||
105 | .Fo tls_config_add_keypair_mem | ||
106 | .Fa "struct tls_config *config" | ||
107 | .Fa "const uint8_t *cert" | ||
108 | .Fa "size_t cert_len" | ||
109 | .Fa "const uint8_t *key" | ||
110 | .Fa "size_t key_len" | ||
111 | .Fc | ||
112 | .Ft void | ||
113 | .Fn tls_config_clear_keys "struct tls_config *config" | ||
114 | .Ft int | ||
115 | .Fo tls_config_set_verify_depth | ||
116 | .Fa "struct tls_config *config" | ||
117 | .Fa "int verify_depth" | ||
118 | .Fc | ||
119 | .Ft void | ||
120 | .Fn tls_config_verify_client "struct tls_config *config" | ||
121 | .Ft void | ||
122 | .Fn tls_config_verify_client_optional "struct tls_config *config" | ||
123 | .Sh DESCRIPTION | ||
124 | .Fn tls_load_file | ||
125 | loads a certificate or key from disk into memory to be loaded with | ||
126 | .Fn tls_config_set_ca_mem , | ||
127 | .Fn tls_config_set_cert_mem | ||
128 | or | ||
129 | .Fn tls_config_set_key_mem . | ||
130 | A private key will be decrypted if the optional | ||
131 | .Ar password | ||
132 | argument is specified. | ||
133 | .Pp | ||
134 | .Fn tls_config_set_ca_file | ||
135 | sets the filename used to load a file | ||
136 | containing the root certificates. | ||
137 | .Pp | ||
138 | .Fn tls_config_set_ca_path | ||
139 | sets the path (directory) which should be searched for root | ||
140 | certificates. | ||
141 | .Pp | ||
142 | .Fn tls_config_set_ca_mem | ||
143 | sets the root certificates directly from memory. | ||
144 | .Pp | ||
145 | .Fn tls_config_set_cert_file | ||
146 | sets file from which the public certificate will be read. | ||
147 | .Pp | ||
148 | .Fn tls_config_set_cert_mem | ||
149 | sets the public certificate directly from memory. | ||
150 | .Pp | ||
151 | .Fn tls_config_set_key_file | ||
152 | sets the file from which the private key will be read. | ||
153 | .Pp | ||
154 | .Fn tls_config_set_key_mem | ||
155 | directly sets the private key from memory. | ||
156 | .Pp | ||
157 | .Fn tls_config_set_keypair_file | ||
158 | sets the files from which the public certificate and private key will be read. | ||
159 | .Pp | ||
160 | .Fn tls_config_set_keypair_mem | ||
161 | directly sets the public certificate and private key from memory. | ||
162 | .Pp | ||
163 | .Fn tls_config_add_keypair_file | ||
164 | adds an additional public certificate and private key from the specified files, | ||
165 | used as an alternative certificate for Server Name Indication (server only). | ||
166 | .Pp | ||
167 | .Fn tls_config_add_keypair_mem | ||
168 | adds an additional public certificate and private key from memory, | ||
169 | used as an alternative certificate for Server Name Indication (server only). | ||
170 | .Pp | ||
171 | .Fn tls_config_clear_keys | ||
172 | clears any secret keys from memory. | ||
173 | .Pp | ||
174 | .Fn tls_config_set_verify_depth | ||
175 | limits the number of intermediate certificates that will be followed during | ||
176 | certificate validation. | ||
177 | .Pp | ||
178 | .Fn tls_config_verify_client | ||
179 | enables client certificate verification, requiring the client to send | ||
180 | a certificate (server only). | ||
181 | .Pp | ||
182 | .Fn tls_config_verify_client_optional | ||
183 | enables client certificate verification, without requiring the client | ||
184 | to send a certificate (server only). | ||
185 | .Sh RETURN VALUES | ||
186 | .Fn tls_load_file | ||
187 | returns | ||
188 | .Dv NULL | ||
189 | on error or an out of memory condition. | ||
190 | .Pp | ||
191 | The other functions return 0 on success or -1 on error. | ||
192 | .Sh SEE ALSO | ||
193 | .Xr tls_config_ocsp_require_stapling 3 , | ||
194 | .Xr tls_config_set_protocols 3 , | ||
195 | .Xr tls_config_set_session_id 3 , | ||
196 | .Xr tls_configure 3 , | ||
197 | .Xr tls_init 3 | ||