diff options
author | schwarze <> | 2016-11-05 15:32:20 +0000 |
---|---|---|
committer | schwarze <> | 2016-11-05 15:32:20 +0000 |
commit | 5af30545c000c195ca6e44f207da004e5780ddb5 (patch) | |
tree | 1672f1234352c29443fcacb44e22f1b20f174d99 /src/lib/libssl/doc/SSL_CTX_use_certificate.3 | |
parent | ba7c6bac5d2c870a4d1c1ce9f08db5e57c660625 (diff) | |
download | openbsd-5af30545c000c195ca6e44f207da004e5780ddb5.tar.gz openbsd-5af30545c000c195ca6e44f207da004e5780ddb5.tar.bz2 openbsd-5af30545c000c195ca6e44f207da004e5780ddb5.zip |
move manual pages from doc/ to man/ for consistency with other
libraries, in particular considering that there are unrelated
files in doc/; requested by jsing@ and beck@
Diffstat (limited to 'src/lib/libssl/doc/SSL_CTX_use_certificate.3')
-rw-r--r-- | src/lib/libssl/doc/SSL_CTX_use_certificate.3 | 336 |
1 files changed, 0 insertions, 336 deletions
diff --git a/src/lib/libssl/doc/SSL_CTX_use_certificate.3 b/src/lib/libssl/doc/SSL_CTX_use_certificate.3 deleted file mode 100644 index 6282c3b0d7..0000000000 --- a/src/lib/libssl/doc/SSL_CTX_use_certificate.3 +++ /dev/null | |||
@@ -1,336 +0,0 @@ | |||
1 | .\" | ||
2 | .\" $OpenBSD: SSL_CTX_use_certificate.3,v 1.3 2015/02/06 01:37:11 reyk Exp $ | ||
3 | .\" | ||
4 | .Dd $Mdocdate: February 6 2015 $ | ||
5 | .Dt SSL_CTX_USE_CERTIFICATE 3 | ||
6 | .Os | ||
7 | .Sh NAME | ||
8 | .Nm SSL_CTX_use_certificate , | ||
9 | .Nm SSL_CTX_use_certificate_ASN1 , | ||
10 | .Nm SSL_CTX_use_certificate_file , | ||
11 | .Nm SSL_use_certificate , | ||
12 | .Nm SSL_use_certificate_ASN1 , | ||
13 | .Nm SSL_use_certificate_file , | ||
14 | .Nm SSL_CTX_use_certificate_chain_file , | ||
15 | .Nm SSL_CTX_use_certificate_chain_mem , | ||
16 | .Nm SSL_CTX_use_PrivateKey , | ||
17 | .Nm SSL_CTX_use_PrivateKey_ASN1 , | ||
18 | .Nm SSL_CTX_use_PrivateKey_file , | ||
19 | .Nm SSL_CTX_use_RSAPrivateKey , | ||
20 | .Nm SSL_CTX_use_RSAPrivateKey_ASN1 , | ||
21 | .Nm SSL_CTX_use_RSAPrivateKey_file , | ||
22 | .Nm SSL_use_PrivateKey_file , | ||
23 | .Nm SSL_use_PrivateKey_ASN1 , | ||
24 | .Nm SSL_use_PrivateKey , | ||
25 | .Nm SSL_use_RSAPrivateKey , | ||
26 | .Nm SSL_use_RSAPrivateKey_ASN1 , | ||
27 | .Nm SSL_use_RSAPrivateKey_file , | ||
28 | .Nm SSL_CTX_check_private_key , | ||
29 | .Nm SSL_check_private_key | ||
30 | .Nd load certificate and key data | ||
31 | .Sh SYNOPSIS | ||
32 | .In openssl/ssl.h | ||
33 | .Ft int | ||
34 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" | ||
35 | .Ft int | ||
36 | .Fn SSL_CTX_use_certificate_ASN1 "SSL_CTX *ctx" "int len" "unsigned char *d" | ||
37 | .Ft int | ||
38 | .Fn SSL_CTX_use_certificate_file "SSL_CTX *ctx" "const char *file" "int type" | ||
39 | .Ft int | ||
40 | .Fn SSL_use_certificate "SSL *ssl" "X509 *x" | ||
41 | .Ft int | ||
42 | .Fn SSL_use_certificate_ASN1 "SSL *ssl" "unsigned char *d" "int len" | ||
43 | .Ft int | ||
44 | .Fn SSL_use_certificate_file "SSL *ssl" "const char *file" "int type" | ||
45 | .Ft int | ||
46 | .Fn SSL_CTX_use_certificate_chain_file "SSL_CTX *ctx" "const char *file" | ||
47 | .Ft int | ||
48 | .Fn SSL_CTX_use_certificate_chain_mem "SSL_CTX *ctx" "void *buf" "int len" | ||
49 | .Ft int | ||
50 | .Fn SSL_CTX_use_PrivateKey "SSL_CTX *ctx" "EVP_PKEY *pkey" | ||
51 | .Ft int | ||
52 | .Fo SSL_CTX_use_PrivateKey_ASN1 | ||
53 | .Fa "int pk" "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
54 | .Fc | ||
55 | .Ft int | ||
56 | .Fn SSL_CTX_use_PrivateKey_file "SSL_CTX *ctx" "const char *file" "int type" | ||
57 | .Ft int | ||
58 | .Fn SSL_CTX_use_RSAPrivateKey "SSL_CTX *ctx" "RSA *rsa" | ||
59 | .Ft int | ||
60 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
61 | .Ft int | ||
62 | .Fn SSL_CTX_use_RSAPrivateKey_file "SSL_CTX *ctx" "const char *file" "int type" | ||
63 | .Ft int | ||
64 | .Fn SSL_use_PrivateKey "SSL *ssl" "EVP_PKEY *pkey" | ||
65 | .Ft int | ||
66 | .Fn SSL_use_PrivateKey_ASN1 "int pk" "SSL *ssl" "unsigned char *d" "long len" | ||
67 | .Ft int | ||
68 | .Fn SSL_use_PrivateKey_file "SSL *ssl" "const char *file" "int type" | ||
69 | .Ft int | ||
70 | .Fn SSL_use_RSAPrivateKey "SSL *ssl" "RSA *rsa" | ||
71 | .Ft int | ||
72 | .Fn SSL_use_RSAPrivateKey_ASN1 "SSL *ssl" "unsigned char *d" "long len" | ||
73 | .Ft int | ||
74 | .Fn SSL_use_RSAPrivateKey_file "SSL *ssl" "const char *file" "int type" | ||
75 | .Ft int | ||
76 | .Fn SSL_CTX_check_private_key "const SSL_CTX *ctx" | ||
77 | .Ft int | ||
78 | .Fn SSL_check_private_key "const SSL *ssl" | ||
79 | .Sh DESCRIPTION | ||
80 | These functions load the certificates and private keys into the | ||
81 | .Vt SSL_CTX | ||
82 | or | ||
83 | .Vt SSL | ||
84 | object, respectively. | ||
85 | .Pp | ||
86 | The | ||
87 | .Fn SSL_CTX_* | ||
88 | class of functions loads the certificates and keys into the | ||
89 | .Vt SSL_CTX | ||
90 | object | ||
91 | .Fa ctx . | ||
92 | The information is passed to | ||
93 | .Vt SSL | ||
94 | objects | ||
95 | .Fa ssl | ||
96 | created from | ||
97 | .Fa ctx | ||
98 | with | ||
99 | .Xr SSL_new 3 | ||
100 | by copying, so that changes applied to | ||
101 | .Fa ctx | ||
102 | do not propagate to already existing | ||
103 | .Vt SSL | ||
104 | objects. | ||
105 | .Pp | ||
106 | The | ||
107 | .Fn SSL_* | ||
108 | class of functions only loads certificates and keys into a specific | ||
109 | .Vt SSL | ||
110 | object. | ||
111 | The specific information is kept when | ||
112 | .Xr SSL_clear 3 | ||
113 | is called for this | ||
114 | .Vt SSL | ||
115 | object. | ||
116 | .Pp | ||
117 | .Fn SSL_CTX_use_certificate | ||
118 | loads the certificate | ||
119 | .Fa x | ||
120 | into | ||
121 | .Fa ctx ; | ||
122 | .Fn SSL_use_certificate | ||
123 | loads | ||
124 | .Fa x | ||
125 | into | ||
126 | .Fa ssl . | ||
127 | The rest of the certificates needed to form the complete certificate chain can | ||
128 | be specified using the | ||
129 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
130 | function. | ||
131 | .Pp | ||
132 | .Fn SSL_CTX_use_certificate_ASN1 | ||
133 | loads the ASN1 encoded certificate from the memory location | ||
134 | .Fa d | ||
135 | (with length | ||
136 | .Fa len ) | ||
137 | into | ||
138 | .Fa ctx ; | ||
139 | .Fn SSL_use_certificate_ASN1 | ||
140 | loads the ASN1 encoded certificate into | ||
141 | .Fa ssl . | ||
142 | .Pp | ||
143 | .Fn SSL_CTX_use_certificate_file | ||
144 | loads the first certificate stored in | ||
145 | .Fa file | ||
146 | into | ||
147 | .Fa ctx . | ||
148 | The formatting | ||
149 | .Fa type | ||
150 | of the certificate must be specified from the known types | ||
151 | .Dv SSL_FILETYPE_PEM | ||
152 | and | ||
153 | .Dv SSL_FILETYPE_ASN1 . | ||
154 | .Fn SSL_use_certificate_file | ||
155 | loads the certificate from | ||
156 | .Fa file | ||
157 | into | ||
158 | .Fa ssl . | ||
159 | See the | ||
160 | .Sx NOTES | ||
161 | section on why | ||
162 | .Fn SSL_CTX_use_certificate_chain_file | ||
163 | should be preferred. | ||
164 | .Pp | ||
165 | The | ||
166 | .Fn SSL_CTX_use_certificate_chain* | ||
167 | functions load a certificate chain into | ||
168 | .Fa ctx . | ||
169 | The certificates must be in PEM format and must be sorted starting with the | ||
170 | subject's certificate (actual client or server certificate), | ||
171 | followed by intermediate CA certificates if applicable, | ||
172 | and ending at the highest level (root) CA. | ||
173 | There is no corresponding function working on a single | ||
174 | .Vt SSL | ||
175 | object. | ||
176 | .Pp | ||
177 | .Fn SSL_CTX_use_PrivateKey | ||
178 | adds | ||
179 | .Fa pkey | ||
180 | as private key to | ||
181 | .Fa ctx . | ||
182 | .Fn SSL_CTX_use_RSAPrivateKey | ||
183 | adds the private key | ||
184 | .Fa rsa | ||
185 | of type RSA to | ||
186 | .Fa ctx . | ||
187 | .Fn SSL_use_PrivateKey | ||
188 | adds | ||
189 | .Fa pkey | ||
190 | as private key to | ||
191 | .Fa ssl ; | ||
192 | .Fn SSL_use_RSAPrivateKey | ||
193 | adds | ||
194 | .Fa rsa | ||
195 | as private key of type RSA to | ||
196 | .Fa ssl . | ||
197 | If a certificate has already been set and the private does not belong to the | ||
198 | certificate, an error is returned. | ||
199 | To change a certificate private key pair, | ||
200 | the new certificate needs to be set with | ||
201 | .Fn SSL_use_certificate | ||
202 | or | ||
203 | .Fn SSL_CTX_use_certificate | ||
204 | before setting the private key with | ||
205 | .Fn SSL_CTX_use_PrivateKey | ||
206 | or | ||
207 | .Fn SSL_use_PrivateKey . | ||
208 | .Pp | ||
209 | .Fn SSL_CTX_use_PrivateKey_ASN1 | ||
210 | adds the private key of type | ||
211 | .Fa pk | ||
212 | stored at memory location | ||
213 | .Fa d | ||
214 | (length | ||
215 | .Fa len ) | ||
216 | to | ||
217 | .Fa ctx . | ||
218 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 | ||
219 | adds the private key of type RSA stored at memory location | ||
220 | .Fa d | ||
221 | (length | ||
222 | .Fa len ) | ||
223 | to | ||
224 | .Fa ctx . | ||
225 | .Fn SSL_use_PrivateKey_ASN1 | ||
226 | and | ||
227 | .Fn SSL_use_RSAPrivateKey_ASN1 | ||
228 | add the private key to | ||
229 | .Fa ssl . | ||
230 | .Pp | ||
231 | .Fn SSL_CTX_use_PrivateKey_file | ||
232 | adds the first private key found in | ||
233 | .Fa file | ||
234 | to | ||
235 | .Fa ctx . | ||
236 | The formatting | ||
237 | .Fa type | ||
238 | of the certificate must be specified from the known types | ||
239 | .Dv SSL_FILETYPE_PEM | ||
240 | and | ||
241 | .Dv SSL_FILETYPE_ASN1 . | ||
242 | .Fn SSL_CTX_use_RSAPrivateKey_file | ||
243 | adds the first private RSA key found in | ||
244 | .Fa file | ||
245 | to | ||
246 | .Fa ctx . | ||
247 | .Fn SSL_use_PrivateKey_file | ||
248 | adds the first private key found in | ||
249 | .Fa file | ||
250 | to | ||
251 | .Fa ssl ; | ||
252 | .Fn SSL_use_RSAPrivateKey_file | ||
253 | adds the first private RSA key found to | ||
254 | .Fa ssl . | ||
255 | .Pp | ||
256 | .Fn SSL_CTX_check_private_key | ||
257 | checks the consistency of a private key with the corresponding certificate | ||
258 | loaded into | ||
259 | .Fa ctx . | ||
260 | If more than one key/certificate pair (RSA/DSA) is installed, | ||
261 | the last item installed will be checked. | ||
262 | If, e.g., the last item was a RSA certificate or key, | ||
263 | the RSA key/certificate pair will be checked. | ||
264 | .Fn SSL_check_private_key | ||
265 | performs the same check for | ||
266 | .Fa ssl . | ||
267 | If no key/certificate was explicitly added for this | ||
268 | .Fa ssl , | ||
269 | the last item added into | ||
270 | .Fa ctx | ||
271 | will be checked. | ||
272 | .Sh NOTES | ||
273 | The internal certificate store of OpenSSL can hold two private key/certificate | ||
274 | pairs at a time: | ||
275 | one key/certificate of type RSA and one key/certificate of type DSA. | ||
276 | The certificate used depends on the cipher select, see also | ||
277 | .Xr SSL_CTX_set_cipher_list 3 . | ||
278 | .Pp | ||
279 | When reading certificates and private keys from file, files of type | ||
280 | .Dv SSL_FILETYPE_ASN1 | ||
281 | (also known as | ||
282 | .Em DER , | ||
283 | binary encoding) can only contain one certificate or private key; consequently, | ||
284 | .Fn SSL_CTX_use_certificate_chain_file | ||
285 | is only applicable to PEM formatting. | ||
286 | Files of type | ||
287 | .Dv SSL_FILETYPE_PEM | ||
288 | can contain more than one item. | ||
289 | .Pp | ||
290 | .Fn SSL_CTX_use_certificate_chain_file | ||
291 | adds the first certificate found in the file to the certificate store. | ||
292 | The other certificates are added to the store of chain certificates using | ||
293 | .Xr SSL_CTX_add_extra_chain_cert 3 . | ||
294 | There exists only one extra chain store, so that the same chain is appended | ||
295 | to both types of certificates, RSA and DSA! | ||
296 | If it is not intended to use both type of certificate at the same time, | ||
297 | it is recommended to use the | ||
298 | .Fn SSL_CTX_use_certificate_chain_file | ||
299 | instead of the | ||
300 | .Fn SSL_CTX_use_certificate_file | ||
301 | function in order to allow the use of complete certificate chains even when no | ||
302 | trusted CA storage is used or when the CA issuing the certificate shall not be | ||
303 | added to the trusted CA storage. | ||
304 | .Pp | ||
305 | If additional certificates are needed to complete the chain during the TLS | ||
306 | negotiation, CA certificates are additionally looked up in the locations of | ||
307 | trusted CA certificates (see | ||
308 | .Xr SSL_CTX_load_verify_locations 3 ) . | ||
309 | .Pp | ||
310 | The private keys loaded from file can be encrypted. | ||
311 | In order to successfully load encrypted keys, | ||
312 | a function returning the passphrase must have been supplied (see | ||
313 | .Xr SSL_CTX_set_default_passwd_cb 3 ) . | ||
314 | (Certificate files might be encrypted as well from the technical point of view, | ||
315 | it however does not make sense as the data in the certificate is considered | ||
316 | public anyway.) | ||
317 | .Sh RETURN VALUES | ||
318 | On success, the functions return 1. | ||
319 | Otherwise check out the error stack to find out the reason. | ||
320 | .Sh SEE ALSO | ||
321 | .Xr ssl 3 , | ||
322 | .Xr SSL_clear 3 , | ||
323 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
324 | .Xr SSL_CTX_load_verify_locations 3 , | ||
325 | .Xr SSL_CTX_set_cipher_list 3 , | ||
326 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
327 | .Xr SSL_CTX_set_default_passwd_cb 3 , | ||
328 | .Xr SSL_new 3 | ||
329 | .Sh HISTORY | ||
330 | Support for DER encoded private keys | ||
331 | .Pq Dv SSL_FILETYPE_ASN1 | ||
332 | in | ||
333 | .Fn SSL_CTX_use_PrivateKey_file | ||
334 | and | ||
335 | .Fn SSL_use_PrivateKey_file | ||
336 | was added in 0.9.8. | ||