d992117ffca28f0c36fcdf0e81ada1c33067ddb7
[openssl.git] / doc / ssl.pod
1
2 =pod
3
4 =head1 NAME
5
6 SSL - OpenSSL SSL/TLS library
7
8 =head1 SYNOPSIS
9
10 =head1 DESCRIPTION
11
12 The OpenSSL B<ssl> library implements the Secure Sockets Layer (SSL v2/v3) and
13 Transport Layer Security (TLS v1) protocols. It provides a rich API which is
14 documented here.
15
16 =head1 HEADERS
17
18 Currently the OpenSSL B<ssl> library provides the following C header files
19 containing the prototypes for the data structures and and functions:
20
21 =over 4
22
23 =item B<ssl.h>
24
25 That's the common header file for the SSL/TLS API.  Include it into your
26 program to make the API of the B<ssl> library available. It internally
27 includes both more private SSL headers and headers from the B<crypto> library.
28
29 =back
30
31 =head1 STRUCTURES
32
33 Currently the OpenSSL B<ssl> library functions deal with the following data
34 structures:
35
36 =over 4
37
38 =item B<SSL_CTX> (SSL Context)
39
40 =item B<SSL> (SSL Connection)
41
42 That's the SSL/TLS structure which is created by
43 a server or client per established connection. 
44
45 =item B<SSL_METHOD> (SSL Method)
46
47 =item B<SSL_CIPHER> (SSL Cipher)
48
49 =item B<SSL_SESSION> (SSL Session)
50
51 =back
52
53 =head1 FUNCTIONS
54
55 Currently the OpenSSL B<ssl> library exports 214 API functions.
56 They are documented in the following:
57
58 =over 4
59
60 =item char *B<SSL_CIPHER_description>(SSL_CIPHER *cipher, char *buf, int len);
61
62 =item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *c, int *alg_bits);
63
64 =item char *B<SSL_CIPHER_get_name>(SSL_CIPHER *c);
65
66 =item char *B<SSL_CIPHER_get_version>(SSL_CIPHER *c);
67
68 =item int B<SSL_CTX_add_client_CA>(SSL_CTX *ctx, X509 *x);
69
70 =item long B<SSL_CTX_add_extra_chain_cert>(SSL_CTX *ctx, X509 *x509);
71
72 =item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c);
73
74 =item int B<SSL_CTX_check_private_key>(SSL_CTX *ctx);
75
76 =item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg);
77
78 =item void B<SSL_CTX_flush_sessions>(SSL_CTX *s, long t);
79
80 =item void B<SSL_CTX_free>(SSL_CTX *a);
81
82 =item char *B<SSL_CTX_get_app_data>(SSL_CTX *ctx);
83
84 =item X509_STORE *B<SSL_CTX_get_cert_store>(SSL_CTX *ctx);
85
86 =item STACK *B<SSL_CTX_get_client_CA_list>(SSL_CTX *ctx);
87
88 =item int (*B<SSL_CTX_get_client_cert_cb>(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
89
90 =item char *B<SSL_CTX_get_ex_data>(SSL_CTX *s, int idx);
91
92 =item int B<SSL_CTX_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
93
94 =item void (*B<SSL_CTX_get_info_callback>(SSL_CTX *ctx))(SSL *ssl, int cb, int ret);
95
96 =item int B<SSL_CTX_get_quiet_shutdown>(SSL_CTX *ctx);
97
98 =item int B<SSL_CTX_get_session_cache_mode>(SSL_CTX *ctx);
99
100 =item long B<SSL_CTX_get_timeout>(SSL_CTX *ctx);
101
102 =item int (*B<SSL_CTX_get_verify_callback>(SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx);
103
104 =item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx);
105
106 =item int B<SSL_CTX_load_verify_locations>(SSL_CTX *ctx, char *CAfile, char *CApath);
107
108 =item long B<SSL_CTX_need_tmp_RSA>(SSL_CTX *ctx);
109
110 =item SSL_CTX *B<SSL_CTX_new>(SSL_METHOD *meth);
111
112 =item int B<SSL_CTX_remove_session>(SSL_CTX *ctx, SSL_SESSION *c);
113
114 =item int B<SSL_CTX_sess_accept>(SSL_CTX *ctx);
115
116 =item int B<SSL_CTX_sess_accept_good>(SSL_CTX *ctx);
117
118 =item int B<SSL_CTX_sess_accept_renegotiate>(SSL_CTX *ctx);
119
120 =item int B<SSL_CTX_sess_cache_full>(SSL_CTX *ctx);
121
122 =item int B<SSL_CTX_sess_cb_hits>(SSL_CTX *ctx);
123
124 =item int B<SSL_CTX_sess_connect>(SSL_CTX *ctx);
125
126 =item int B<SSL_CTX_sess_connect_good>(SSL_CTX *ctx);
127
128 =item int B<SSL_CTX_sess_connect_renegotiate>(SSL_CTX *ctx);
129
130 =item int B<SSL_CTX_sess_get_cache_size>(SSL_CTX *ctx);
131
132 =item SSL_SESSION *(*B<SSL_CTX_sess_get_get_cb>(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy);
133
134 =item int (*B<SSL_CTX_sess_get_new_cb>(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess);
135
136 =item void (*B<SSL_CTX_sess_get_remove_cb>(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess);
137
138 =item int B<SSL_CTX_sess_hits>(SSL_CTX *ctx);
139
140 =item int B<SSL_CTX_sess_misses>(SSL_CTX *ctx);
141
142 =item int B<SSL_CTX_sess_number>(SSL_CTX *ctx);
143
144 =item void B<SSL_CTX_sess_set_cache_size>(SSL_CTX *ctx,t);
145
146 =item void B<SSL_CTX_sess_set_get_cb>(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy));
147
148 =item void B<SSL_CTX_sess_set_new_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess));
149
150 =item void B<SSL_CTX_sess_set_remove_cb>(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess));
151
152 =item int B<SSL_CTX_sess_timeouts>(SSL_CTX *ctx);
153
154 =item LHASH *B<SSL_CTX_sessions>(SSL_CTX *ctx);
155
156 =item void B<SSL_CTX_set_app_data>(SSL_CTX *ctx, void *arg);
157
158 =item void B<SSL_CTX_set_cert_store>(SSL_CTX *ctx, X509_STORE *cs);
159
160 =item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb)(SSL_CTX *), char *arg)
161
162 =item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str);
163
164 =item void B<SSL_CTX_set_client_CA_list>(SSL_CTX *ctx, STACK *list);
165
166 =item void B<SSL_CTX_set_client_cert_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));
167
168 =item void B<SSL_CTX_set_default_passwd_cb>(SSL_CTX *ctx, int (*cb);(void))
169
170 =item void B<SSL_CTX_set_default_read_ahead>(SSL_CTX *ctx, int m);
171
172 =item int B<SSL_CTX_set_default_verify_paths>(SSL_CTX *ctx);
173
174 =item int B<SSL_CTX_set_ex_data>(SSL_CTX *s, int idx, char *arg);
175
176 =item void B<SSL_CTX_set_info_callback>(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret));
177
178 =item void B<SSL_CTX_set_options>(SSL_CTX *ctx, unsigned long op);
179
180 =item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode);
181
182 =item void B<SSL_CTX_set_session_cache_mode>(SSL_CTX *ctx, int mode);
183
184 =item int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, SSL_METHOD *meth);
185
186 =item void B<SSL_CTX_set_timeout>(SSL_CTX *ctx, long t);
187
188 =item long B<SSL_CTX_set_tmp_dh>(SSL_CTX* ctx, DH *dh);
189
190 =item long B<SSL_CTX_set_tmp_dh_callback>(SSL_CTX *ctx, DH *(*cb)(void));
191
192 =item long B<SSL_CTX_set_tmp_rsa>(SSL_CTX *ctx, RSA *rsa);
193
194 =item long B<SSL_CTX_set_tmp_rsa_callback>(SSL_CTX *ctx, RSA *(*cb)(void));
195
196 =item void B<SSL_CTX_set_verify>(SSL_CTX *ctx, int mode, int (*cb);(void))
197
198 =item int B<SSL_CTX_use_PrivateKey>(SSL_CTX *ctx, EVP_PKEY *pkey);
199
200 =item int B<SSL_CTX_use_PrivateKey_ASN1>(int type, SSL_CTX *ctx, unsigned char *d, long len);
201
202 =item int B<SSL_CTX_use_PrivateKey_file>(SSL_CTX *ctx, char *file, int type);
203
204 =item int B<SSL_CTX_use_RSAPrivateKey>(SSL_CTX *ctx, RSA *rsa);
205
206 =item int B<SSL_CTX_use_RSAPrivateKey_ASN1>(SSL_CTX *ctx, unsigned char *d, long len);
207
208 =item int B<SSL_CTX_use_RSAPrivateKey_file>(SSL_CTX *ctx, char *file, int type);
209
210 =item int B<SSL_CTX_use_certificate>(SSL_CTX *ctx, X509 *x);
211
212 =item int B<SSL_CTX_use_certificate_ASN1>(SSL_CTX *ctx, int len, unsigned char *d);
213
214 =item int B<SSL_CTX_use_certificate_file>(SSL_CTX *ctx, char *file, int type);
215
216 =item int B<SSL_SESSION_cmp>(SSL_SESSION *a, SSL_SESSION *b);
217
218 =item void B<SSL_SESSION_free>(SSL_SESSION *ss);
219
220 =item char *B<SSL_SESSION_get_app_data>(SSL_SESSION *s);
221
222 =item char *B<SSL_SESSION_get_ex_data>(SSL_SESSION *s, int idx);
223
224 =item int B<SSL_SESSION_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
225
226 =item long B<SSL_SESSION_get_time>(SSL_SESSION *s);
227
228 =item long B<SSL_SESSION_get_timeout>(SSL_SESSION *s);
229
230 =item unsigned long B<SSL_SESSION_hash>(SSL_SESSION *a);
231
232 =item SSL_SESSION *B<SSL_SESSION_new>(void);
233
234 =item int B<SSL_SESSION_print>(BIO *bp, SSL_SESSION *x);
235
236 =item int B<SSL_SESSION_print_fp>(FILE *fp, SSL_SESSION *x);
237
238 =item void B<SSL_SESSION_set_app_data>(SSL_SESSION *s, char *a);
239
240 =item int B<SSL_SESSION_set_ex_data>(SSL_SESSION *s, int idx, char *arg);
241
242 =item long B<SSL_SESSION_set_time>(SSL_SESSION *s, long t);
243
244 =item long B<SSL_SESSION_set_timeout>(SSL_SESSION *s, long t);
245
246 =item int B<SSL_accept>(SSL *ssl);
247
248 =item int B<SSL_add_client_CA>(SSL *ssl, X509 *x);
249
250 =item char *B<SSL_alert_desc_string>(int value);
251
252 =item char *B<SSL_alert_desc_string_long>(int value);
253
254 =item char *B<SSL_alert_type_string>(int value);
255
256 =item char *B<SSL_alert_type_string_long>(int value);
257
258 =item int B<SSL_check_private_key>(SSL *ssl);
259
260 =item void B<SSL_clear>(SSL *ssl);
261
262 =item long B<SSL_clear_num_renegotiations>(SSL *ssl);
263
264 =item int B<SSL_connect>(SSL *ssl);
265
266 =item void B<SSL_copy_session_id>(SSL *t, SSL *f);
267
268 =item long B<SSL_ctrl>(SSL *ssl, int cmd, long larg, char *parg);
269
270 =item int B<SSL_do_handshake>(SSL *ssl);
271
272 =item SSL *B<SSL_dup>(SSL *ssl);
273
274 =item STACK *B<SSL_dup_CA_list>(STACK *sk);
275
276 =item void B<SSL_free>(SSL *ssl);
277
278 =item SSL_CTX *B<SSL_get_SSL_CTX>(SSL *ssl);
279
280 =item char *B<SSL_get_app_data>(SSL *ssl);
281
282 =item X509 *B<SSL_get_certificate>(SSL *ssl);
283
284 =item SSL_CIPHER *B<SSL_get_cipher>(SSL *ssl);
285
286 =item int B<SSL_get_cipher_bits>(SSL *ssl, int *alg_bits);
287
288 =item char *B<SSL_get_cipher_list>(SSL *ssl, int n);
289
290 =item char *B<SSL_get_cipher_name>(SSL *ssl);
291
292 =item char *B<SSL_get_cipher_version>(SSL *ssl);
293
294 =item STACK *B<SSL_get_ciphers>(SSL *ssl);
295
296 =item STACK *B<SSL_get_client_CA_list>(SSL *ssl);
297
298 =item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *ssl);
299
300 =item long B<SSL_get_default_timeout>(SSL *ssl);
301
302 =item int B<SSL_get_error>(SSL *ssl, int i);
303
304 =item char *B<SSL_get_ex_data>(SSL *ssl, int idx);
305
306 =item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void);
307
308 =item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
309
310 =item int B<SSL_get_fd>(SSL *ssl);
311
312 =item void (*B<SSL_get_info_callback>(SSL *ssl);)(void)
313
314 =item STACK *B<SSL_get_peer_cert_chain>(SSL *ssl);
315
316 =item X509 *B<SSL_get_peer_certificate>(SSL *ssl);
317
318 =item EVP_PKEY *B<SSL_get_privatekey>(SSL *ssl);
319
320 =item int B<SSL_get_quiet_shutdown>(SSL *ssl);
321
322 =item BIO *B<SSL_get_rbio>(SSL *ssl);
323
324 =item int B<SSL_get_read_ahead>(SSL *ssl);
325
326 =item SSL_SESSION *B<SSL_get_session>(SSL *ssl);
327
328 =item char *B<SSL_get_shared_ciphers>(SSL *ssl, char *buf, int len);
329
330 =item int B<SSL_get_shutdown>(SSL *ssl);
331
332 =item SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl);
333
334 =item int B<SSL_get_state>(SSL *ssl);
335
336 =item long B<SSL_get_time>(SSL *ssl);
337
338 =item long B<SSL_get_timeout>(SSL *ssl);
339
340 =item int (*B<SSL_get_verify_callback>(SSL *ssl);)(void)
341
342 =item int B<SSL_get_verify_mode>(SSL *ssl);
343
344 =item long B<SSL_get_verify_result>(SSL *ssl);
345
346 =item char *B<SSL_get_version>(SSL *ssl);
347
348 =item BIO *B<SSL_get_wbio>(SSL *ssl);
349
350 =item int B<SSL_in_accept_init>(SSL *ssl);
351
352 =item int B<SSL_in_before>(SSL *ssl);
353
354 =item int B<SSL_in_connect_init>(SSL *ssl);
355
356 =item int B<SSL_in_init>(SSL *ssl);
357
358 =item int B<SSL_is_init_finished>(SSL *ssl);
359
360 =item STACK *B<SSL_load_client_CA_file>(char *file);
361
362 =item void B<SSL_load_error_strings>(void);
363
364 =item SSL *B<SSL_new>(SSL_CTX *ctx);
365
366 =item long B<SSL_num_renegotiations>(SSL *ssl);
367
368 =item int B<SSL_peek>(SSL *ssl, char *buf, int num);
369
370 =item int B<SSL_pending>(SSL *ssl);
371
372 =item int B<SSL_read>(SSL *ssl, char *buf, int num);
373
374 =item int B<SSL_renegotiate>(SSL *ssl);
375
376 =item char *B<SSL_rstate_string>(SSL *ssl);
377
378 =item char *B<SSL_rstate_string_long>(SSL *ssl);
379
380 =item long B<SSL_session_reused>(SSL *ssl);
381
382 =item void B<SSL_set_accept_state>(SSL *ssl);
383
384 =item void B<SSL_set_app_data>(SSL *ssl, char *arg);
385
386 =item void B<SSL_set_bio>(SSL *ssl, BIO *rbio, BIO *wbio);
387
388 =item int B<SSL_set_cipher_list>(SSL *ssl, char *str);
389
390 =item void B<SSL_set_client_CA_list>(SSL *ssl, STACK *list);
391
392 =item void B<SSL_set_connect_state>(SSL *ssl);
393
394 =item int B<SSL_set_ex_data>(SSL *ssl, int idx, char *arg);
395
396 =item int B<SSL_set_fd>(SSL *ssl, int fd);
397
398 =item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void))
399
400 =item void B<SSL_set_options>(SSL *ssl, unsigned long op);
401
402 =item void B<SSL_set_quiet_shutdown>(SSL *ssl, int mode);
403
404 =item void B<SSL_set_read_ahead>(SSL *ssl, int yes);
405
406 =item int B<SSL_set_rfd>(SSL *ssl, int fd);
407
408 =item int B<SSL_set_session>(SSL *ssl, SSL_SESSION *session);
409
410 =item void B<SSL_set_shutdown>(SSL *ssl, int mode);
411
412 =item int B<SSL_set_ssl_method>(SSL *ssl, SSL_METHOD *meth);
413
414 =item void B<SSL_set_time>(SSL *ssl, long t);
415
416 =item void B<SSL_set_timeout>(SSL *ssl, long t);
417
418 =item void B<SSL_set_verify>(SSL *ssl, int mode, int (*callback);(void))
419
420 =item void B<SSL_set_verify_result>(SSL *ssl, long arg);
421
422 =item int B<SSL_set_wfd>(SSL *ssl, int fd);
423
424 =item int B<SSL_shutdown>(SSL *ssl);
425
426 =item int B<SSL_state>(SSL *ssl);
427
428 =item char *B<SSL_state_string>(SSL *ssl);
429
430 =item char *B<SSL_state_string_long>(SSL *ssl);
431
432 =item long B<SSL_total_renegotiations>(SSL *ssl);
433
434 =item int B<SSL_use_PrivateKey>(SSL *ssl, EVP_PKEY *pkey);
435
436 =item int B<SSL_use_PrivateKey_ASN1>(int type, SSL *ssl, unsigned char *d, long len);
437
438 =item int B<SSL_use_PrivateKey_file>(SSL *ssl, char *file, int type);
439
440 =item int B<SSL_use_RSAPrivateKey>(SSL *ssl, RSA *rsa);
441
442 =item int B<SSL_use_RSAPrivateKey_ASN1>(SSL *ssl, unsigned char *d, long len);
443
444 =item int B<SSL_use_RSAPrivateKey_file>(SSL *ssl, char *file, int type);
445
446 =item int B<SSL_use_certificate>(SSL *ssl, X509 *x);
447
448 =item int B<SSL_use_certificate_ASN1>(SSL *ssl, int len, unsigned char *d);
449
450 =item int B<SSL_use_certificate_file>(SSL *ssl, char *file, int type);
451
452 =item int B<SSL_version>(SSL *ssl);
453
454 =item int B<SSL_want>(SSL *ssl);
455
456 =item int B<SSL_want_nothing>(SSL *ssl);
457
458 =item int B<SSL_want_read>(SSL *ssl);
459
460 =item int B<SSL_want_write>(SSL *ssl);
461
462 =item int B<SSL_want_x509_lookup>(s);
463
464 =item int B<SSL_write>(SSL *ssl, char *buf, int num);
465
466 =item SSL_METHOD *B<SSLv2_client_method>(void);
467
468 =item SSL_METHOD *B<SSLv2_method>(void);
469
470 =item SSL_METHOD *B<SSLv2_server_method>(void);
471
472 =item SSL_METHOD *B<SSLv3_client_method>(void);
473
474 =item SSL_METHOD *B<SSLv3_method>(void);
475
476 =item SSL_METHOD *B<SSLv3_server_method>(void);
477
478 =item SSL_METHOD *B<TLSv1_client_method>(void);
479
480 =item SSL_METHOD *B<TLSv1_method>(void);
481
482 =item SSL_METHOD *B<TLSv1_server_method>(void);
483
484 =back
485
486 =head1 SEE ALSO
487
488 openssl(1), crypto(3)
489
490 =head1 HISTORY
491
492 The ssl(3) document appeared in OpenSSL 0.9.2
493
494 =cut
495