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