Import the first cut for manual pages.
[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 143 API functions.
56 They are documented in the following:
57
58 =over 4
59
60 =item [MACRO] B<SSL_ADH>(SSL_kEDH|SSL_aNULL);
61
62 =item [MACRO] B<SSL_CB_ACCEPT_EXIT>(SSL_ST_ACCEPT|SSL_CB_EXIT);
63
64 =item [MACRO] B<SSL_CB_ACCEPT_LOOP>(SSL_ST_ACCEPT|SSL_CB_LOOP);
65
66 =item [MACRO] B<SSL_CB_CONNECT_EXIT>(SSL_ST_CONNECT|SSL_CB_EXIT);
67
68 =item [MACRO] B<SSL_CB_CONNECT_LOOP>(SSL_ST_CONNECT|SSL_CB_LOOP);
69
70 =item [MACRO] B<SSL_CB_READ_ALERT>(SSL_CB_ALERT|SSL_CB_READ);
71
72 =item [MACRO] B<SSL_CB_WRITE_ALERT>(SSL_CB_ALERT|SSL_CB_WRITE);
73
74 =item char *B<SSL_CIPHER_description>(SSL_CIPHER *cipher, char *buf, int len);
75
76 =item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *c, int *alg_bits);
77
78 =item char *B<SSL_CIPHER_get_name>(SSL_CIPHER *c);
79
80 =item char *B<SSL_CIPHER_get_version>(SSL_CIPHER *c);
81
82 =item int B<SSL_CTX_add_client_CA>(SSL_CTX *ctx, X509 *x);
83
84 =item [MACRO] B<SSL_CTX_add_extra_chain_cert>(ctx,x509);
85
86 =item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c);
87
88 =item int B<SSL_CTX_check_private_key>(SSL_CTX *ctx);
89
90 =item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg);
91
92 =item void B<SSL_CTX_flush_sessions>(SSL_CTX *s, long t);
93
94 =item void B<SSL_CTX_free>(SSL_CTX *a);
95
96 =item [MACRO] B<SSL_CTX_get_app_data>(ctx);
97
98 =item [MACRO] B<SSL_CTX_get_cert_store>(ctx);
99
100 =item STACK *B<SSL_CTX_get_client_CA_list>(SSL_CTX *ctx);
101
102 =item [MACRO] B<SSL_CTX_get_client_cert_cb>(ctx);
103
104 =item char *B<SSL_CTX_get_ex_data>(SSL_CTX *s, int idx);
105
106 =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))
107
108 =item [MACRO] B<SSL_CTX_get_info_callback>(ctx);
109
110 =item int B<SSL_CTX_get_quiet_shutdown>(SSL_CTX *ctx);
111
112 =item [MACRO] B<SSL_CTX_get_session_cache_mode>(ctx);
113
114 =item [MACRO] B<SSL_CTX_get_timeout>(ctx);
115
116 =item int (*B<SSL_CTX_get_verify_callback>(SSL_CTX *ctx);)(void)
117
118 =item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx);
119
120 =item int B<SSL_CTX_load_verify_locations>(SSL_CTX *ctx, char *CAfile, char *CApath);
121
122 =item [MACRO] B<SSL_CTX_need_tmp_RSA>(ctx);
123
124 =item SSL_CTX *B<SSL_CTX_new>(SSL_METHOD *meth);
125
126 =item int B<SSL_CTX_remove_session>(SSL_CTX *ctx, SSL_SESSION *c);
127
128 =item [MACRO] B<SSL_CTX_sess_accept>(ctx);
129
130 =item [MACRO] B<SSL_CTX_sess_accept_good>(ctx);
131
132 =item [MACRO] B<SSL_CTX_sess_accept_renegotiate>(ctx);
133
134 =item [MACRO] B<SSL_CTX_sess_cache_full>(ctx);
135
136 =item [MACRO] B<SSL_CTX_sess_cb_hits>(ctx);
137
138 =item [MACRO] B<SSL_CTX_sess_connect>(ctx);
139
140 =item [MACRO] B<SSL_CTX_sess_connect_good>(ctx);
141
142 =item [MACRO] B<SSL_CTX_sess_connect_renegotiate>(ctx);
143
144 =item [MACRO] B<SSL_CTX_sess_get_cache_size>(ctx);
145
146 =item [MACRO] B<SSL_CTX_sess_get_get_cb>(ctx);
147
148 =item [MACRO] B<SSL_CTX_sess_get_new_cb>(ctx);
149
150 =item [MACRO] B<SSL_CTX_sess_get_remove_cb>(ctx);
151
152 =item [MACRO] B<SSL_CTX_sess_hits>(ctx);
153
154 =item [MACRO] B<SSL_CTX_sess_misses>(ctx);
155
156 =item [MACRO] B<SSL_CTX_sess_number>(ctx);
157
158 =item [MACRO] B<SSL_CTX_sess_set_cache_size>(ctx,t);
159
160 =item [MACRO] B<SSL_CTX_sess_set_get_cb>(ctx,cb);
161
162 =item [MACRO] B<SSL_CTX_sess_set_new_cb>(ctx,cb);
163
164 =item [MACRO] B<SSL_CTX_sess_set_remove_cb>(ctx,cb);
165
166 =item [MACRO] B<SSL_CTX_sess_timeouts>(ctx);
167
168 =item [MACRO] B<SSL_CTX_sessions>(ctx);
169
170 =item [MACRO] B<SSL_CTX_set_app_data>(ctx,arg);
171
172 =item [MACRO] B<SSL_CTX_set_cert_store>(ctx,cs);
173
174 =item [MACRO] B<SSL_CTX_set_cert_verify_callback>(a,b,c);
175
176 =item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb);(void), char *arg)
177
178 =item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str);
179
180 =item void B<SSL_CTX_set_client_CA_list>(SSL_CTX *ctx, STACK *list);
181
182 =item [MACRO] B<SSL_CTX_set_client_cert_cb>(ctx,cb);
183
184 =item void B<SSL_CTX_set_default_passwd_cb>(SSL_CTX *ctx, int (*cb);(void))
185
186 =item [MACRO] B<SSL_CTX_set_default_read_ahead>(ctx,m);
187
188 =item [MACRO] B<SSL_CTX_set_default_verify>(a,b,c);
189
190 =item int B<SSL_CTX_set_default_verify_paths>(SSL_CTX *ctx);
191
192 =item int B<SSL_CTX_set_ex_data>(SSL_CTX *s, int idx, char *arg);
193
194 =item [MACRO] B<SSL_CTX_set_info_callback>(ctx,cb);
195
196 =item [MACRO] B<SSL_CTX_set_options>(ctx,op);
197
198 =item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode);
199
200 =item [MACRO] B<SSL_CTX_set_session_cache_mode>(ctx,m);
201
202 =item int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, SSL_METHOD *meth);
203
204 =item [MACRO] B<SSL_CTX_set_timeout>(ctx,t);
205
206 =item [MACRO] B<SSL_CTX_set_tmp_dh>(ctx,dh);
207
208 =item [MACRO] B<SSL_CTX_set_tmp_dh_callback>(ctx,dh);
209
210 =item [MACRO] B<SSL_CTX_set_tmp_rsa>(ctx,rsa);
211
212 =item [MACRO] B<SSL_CTX_set_tmp_rsa_callback>(ctx,cb);
213
214 =item void B<SSL_CTX_set_verify>(SSL_CTX *ctx, int mode, int (*cb);(void))
215
216 =item int B<SSL_CTX_use_PrivateKey>(SSL_CTX *ctx, EVP_PKEY *pkey);
217
218 =item int B<SSL_CTX_use_PrivateKey_ASN1>(int type, SSL_CTX *ctx, unsigned char *d, long len);
219
220 =item int B<SSL_CTX_use_PrivateKey_file>(SSL_CTX *ctx, char *file, int type);
221
222 =item int B<SSL_CTX_use_RSAPrivateKey>(SSL_CTX *ctx, RSA *rsa);
223
224 =item int B<SSL_CTX_use_RSAPrivateKey_ASN1>(SSL_CTX *ctx, unsigned char *d, long len);
225
226 =item int B<SSL_CTX_use_RSAPrivateKey_file>(SSL_CTX *ctx, char *file, int type);
227
228 =item int B<SSL_CTX_use_certificate>(SSL_CTX *ctx, X509 *x);
229
230 =item int B<SSL_CTX_use_certificate_ASN1>(SSL_CTX *ctx, int len, unsigned char *d);
231
232 =item int B<SSL_CTX_use_certificate_file>(SSL_CTX *ctx, char *file, int type);
233
234 =item [MACRO] B<SSL_DH>(SSL_kDHr|SSL_kDHd|SSL_kEDH);
235
236 =item [MACRO] B<SSL_EDH>(SSL_kEDH|(SSL_AUTH_MASK^SSL_aNULL);
237
238 =item [MACRO] B<SSL_FZA>(SSL_aFZA|SSL_kFZA|SSL_eFZA);
239
240 =item [MACRO] B<SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES>(512/8);
241
242 =item [MACRO] B<SSL_NULL>(SSL_eNULL);
243
244 =item [MACRO] B<SSL_RSA>(SSL_kRSA|SSL_aRSA);
245
246 =item [MACRO] B<SSL_SESSION_CACHE_MAX_SIZE_DEFAULT>(1024*20);
247
248 =item int B<SSL_SESSION_cmp>(SSL_SESSION *a, SSL_SESSION *b);
249
250 =item void B<SSL_SESSION_free>(SSL_SESSION *ss);
251
252 =item [MACRO] B<SSL_SESSION_get_app_data>(s);
253
254 =item char *B<SSL_SESSION_get_ex_data>(SSL_SESSION *s, int idx);
255
256 =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))
257
258 =item long B<SSL_SESSION_get_time>(SSL_SESSION *s);
259
260 =item long B<SSL_SESSION_get_timeout>(SSL_SESSION *s);
261
262 =item unsigned long B<SSL_SESSION_hash>(SSL_SESSION *a);
263
264 =item SSL_SESSION *B<SSL_SESSION_new>(void);
265
266 =item int B<SSL_SESSION_print>(BIO *bp, SSL_SESSION *x);
267
268 =item int B<SSL_SESSION_print_fp>(FILE *fp, SSL_SESSION *x);
269
270 =item [MACRO] B<SSL_SESSION_set_app_data>(s,a);
271
272 =item int B<SSL_SESSION_set_ex_data>(SSL_SESSION *s, int idx, char *arg);
273
274 =item long B<SSL_SESSION_set_time>(SSL_SESSION *s, long t);
275
276 =item long B<SSL_SESSION_set_timeout>(SSL_SESSION *s, long t);
277
278 =item [MACRO] B<SSL_SESS_CACHE_BOTH>(SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER);
279
280 =item [MACRO] B<SSL_SHA>(SSL_SHA1);
281
282 =item [MACRO] B<SSL_ST_INIT>(SSL_ST_CONNECT|SSL_ST_ACCEPT);
283
284 =item [MACRO] B<SSL_ST_RENEGOTIATE>(0x04|SSL_ST_INIT);
285
286 =item int B<SSL_accept>(SSL *s);
287
288 =item int B<SSL_add_client_CA>(SSL *ssl, X509 *x);
289
290 =item [MACRO] B<SSL_add_session>(a,b);
291
292 =item char *B<SSL_alert_desc_string>(int value);
293
294 =item char *B<SSL_alert_desc_string_long>(int value);
295
296 =item char *B<SSL_alert_type_string>(int value);
297
298 =item char *B<SSL_alert_type_string_long>(int value);
299
300 =item int B<SSL_check_private_key>(SSL *ssl);
301
302 =item void B<SSL_clear>(SSL *s);
303
304 =item [MACRO] B<SSL_clear_num_renegotiations>(ssl);
305
306 =item int B<SSL_connect>(SSL *s);
307
308 =item void B<SSL_copy_session_id>(SSL *t, SSL *f);
309
310 =item long B<SSL_ctrl>(SSL *s, int cmd, long larg, char *parg);
311
312 =item int B<SSL_do_handshake>(SSL *s);
313
314 =item SSL *B<SSL_dup>(SSL *s);
315
316 =item STACK *B<SSL_dup_CA_list>(STACK *sk);
317
318 =item [MACRO] B<SSL_flush_sessions>(a,b);
319
320 =item void B<SSL_free>(SSL *s);
321
322 =item SSL_CTX *B<SSL_get_SSL_CTX>(SSL *ssl);
323
324 =item [MACRO] B<SSL_get_app_data>(s);
325
326 =item X509 *B<SSL_get_certificate>(SSL *s);
327
328 =item [MACRO] B<SSL_get_cipher>(s);
329
330 =item [MACRO] B<SSL_get_cipher_bits>(s,np);
331
332 =item char *B<SSL_get_cipher_list>(SSL *s, int n);
333
334 =item [MACRO] B<SSL_get_cipher_name>(s);
335
336 =item [MACRO] B<SSL_get_cipher_version>(s);
337
338 =item STACK *B<SSL_get_ciphers>(SSL *s);
339
340 =item STACK *B<SSL_get_client_CA_list>(SSL *s);
341
342 =item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *s);
343
344 =item long B<SSL_get_default_timeout>(SSL *s);
345
346 =item int B<SSL_get_error>(SSL *s, int i);
347
348 =item char *B<SSL_get_ex_data>(SSL *s, int idx);
349
350 =item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void);
351
352 =item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
353
354 =item int B<SSL_get_fd>(SSL *s);
355
356 =item void (*B<SSL_get_info_callback>(SSL *ssl);)(void)
357
358 =item STACK *B<SSL_get_peer_cert_chain>(SSL *s);
359
360 =item X509 *B<SSL_get_peer_certificate>(SSL *s);
361
362 =item EVP_PKEY *B<SSL_get_privatekey>(SSL *s);
363
364 =item int B<SSL_get_quiet_shutdown>(SSL *s);
365
366 =item BIO *B<SSL_get_rbio>(SSL *s);
367
368 =item int B<SSL_get_read_ahead>(SSL *s);
369
370 =item SSL_SESSION *B<SSL_get_session>(SSL *ssl);
371
372 =item char *B<SSL_get_shared_ciphers>(SSL *s, char *buf, int len);
373
374 =item int B<SSL_get_shutdown>(SSL *s);
375
376 =item SSL_METHOD *B<SSL_get_ssl_method>(SSL *s);
377
378 =item [MACRO] B<SSL_get_state>(a);
379
380 =item [MACRO] B<SSL_get_time>(a);
381
382 =item [MACRO] B<SSL_get_timeout>(a);
383
384 =item int (*B<SSL_get_verify_callback>(SSL *s);)(void)
385
386 =item int B<SSL_get_verify_mode>(SSL *s);
387
388 =item long B<SSL_get_verify_result>(SSL *ssl);
389
390 =item char *B<SSL_get_version>(SSL *s);
391
392 =item BIO *B<SSL_get_wbio>(SSL *s);
393
394 =item [MACRO] B<SSL_in_accept_init>(a);
395
396 =item [MACRO] B<SSL_in_before>(a);
397
398 =item [MACRO] B<SSL_in_connect_init>(a);
399
400 =item [MACRO] B<SSL_in_init>(a);
401
402 =item [MACRO] B<SSL_is_init_finished>(a);
403
404 =item STACK *B<SSL_load_client_CA_file>(char *file);
405
406 =item void B<SSL_load_error_strings>(void);
407
408 =item SSL *B<SSL_new>(SSL_CTX *ctx);
409
410 =item [MACRO] B<SSL_num_renegotiations>(ssl);
411
412 =item int B<SSL_peek>(SSL *s, char *buf, int num);
413
414 =item int B<SSL_pending>(SSL *s);
415
416 =item int B<SSL_read>(SSL *s, char *buf, int num);
417
418 =item [MACRO] B<SSL_remove_session>(a,b);
419
420 =item int B<SSL_renegotiate>(SSL *s);
421
422 =item char *B<SSL_rstate_string>(SSL *s);
423
424 =item char *B<SSL_rstate_string_long>(SSL *s);
425
426 =item [MACRO] B<SSL_session_reused>(ssl);
427
428 =item void B<SSL_set_accept_state>(SSL *s);
429
430 =item [MACRO] B<SSL_set_app_data>(s,arg);
431
432 =item void B<SSL_set_bio>(SSL *s, BIO *rbio, BIO *wbio);
433
434 =item int B<SSL_set_cipher_list>(SSL *s, char *str);
435
436 =item void B<SSL_set_client_CA_list>(SSL *s, STACK *list);
437
438 =item void B<SSL_set_connect_state>(SSL *s);
439
440 =item int B<SSL_set_ex_data>(SSL *s, int idx, char *arg);
441
442 =item int B<SSL_set_fd>(SSL *s, int fd);
443
444 =item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void))
445
446 =item [MACRO] B<SSL_set_options>(ssl,op);
447
448 =item [MACRO] B<SSL_set_pref_cipher>(c,n);
449
450 =item void B<SSL_set_quiet_shutdown>(SSL *s, int mode);
451
452 =item void B<SSL_set_read_ahead>(SSL *s, int yes);
453
454 =item int B<SSL_set_rfd>(SSL *s, int fd);
455
456 =item int B<SSL_set_session>(SSL *s, SSL_SESSION *session);
457
458 =item void B<SSL_set_shutdown>(SSL *s, int mode);
459
460 =item int B<SSL_set_ssl_method>(SSL *s, SSL_METHOD *meth);
461
462 =item [MACRO] B<SSL_set_time>(a,b);
463
464 =item [MACRO] B<SSL_set_timeout>(a,b);
465
466 =item void B<SSL_set_verify>(SSL *s, int mode, int (*callback);(void))
467
468 =item void B<SSL_set_verify_result>(SSL *ssl, long arg);
469
470 =item int B<SSL_set_wfd>(SSL *s, int fd);
471
472 =item int B<SSL_shutdown>(SSL *s);
473
474 =item int B<SSL_state>(SSL *ssl);
475
476 =item char *B<SSL_state_string>(SSL *s);
477
478 =item char *B<SSL_state_string_long>(SSL *s);
479
480 =item [MACRO] B<SSL_total_renegotiations>(ssl);
481
482 =item int B<SSL_use_PrivateKey>(SSL *ssl, EVP_PKEY *pkey);
483
484 =item int B<SSL_use_PrivateKey_ASN1>(int type, SSL *ssl, unsigned char *d, long len);
485
486 =item int B<SSL_use_PrivateKey_file>(SSL *ssl, char *file, int type);
487
488 =item int B<SSL_use_RSAPrivateKey>(SSL *ssl, RSA *rsa);
489
490 =item int B<SSL_use_RSAPrivateKey_ASN1>(SSL *ssl, unsigned char *d, long len);
491
492 =item int B<SSL_use_RSAPrivateKey_file>(SSL *ssl, char *file, int type);
493
494 =item int B<SSL_use_certificate>(SSL *ssl, X509 *x);
495
496 =item int B<SSL_use_certificate_ASN1>(SSL *ssl, int len, unsigned char *d);
497
498 =item int B<SSL_use_certificate_file>(SSL *ssl, char *file, int type);
499
500 =item int B<SSL_version>(SSL *s);
501
502 =item [MACRO] B<SSL_want>(s);
503
504 =item [MACRO] B<SSL_want_nothing>(s);
505
506 =item [MACRO] B<SSL_want_read>(s);
507
508 =item [MACRO] B<SSL_want_write>(s);
509
510 =item [MACRO] B<SSL_want_x509_lookup>(s);
511
512 =item int B<SSL_write>(SSL *s, char *buf, int num);
513
514 =item SSL_METHOD *B<SSLv2_client_method>(void);
515
516 =item SSL_METHOD *B<SSLv2_method>(void);
517
518 =item SSL_METHOD *B<SSLv2_server_method>(void);
519
520 =item SSL_METHOD *B<SSLv3_client_method>(void);
521
522 =item SSL_METHOD *B<SSLv3_method>(void);
523
524 =item SSL_METHOD *B<SSLv3_server_method>(void);
525
526 =item SSL_METHOD *B<TLSv1_client_method>(void);
527
528 =item SSL_METHOD *B<TLSv1_method>(void);
529
530 =item SSL_METHOD *B<TLSv1_server_method>(void);
531
532 =back
533
534 =head1 SEE ALSO
535
536 openssl(1), crypto(3)
537
538 =head1 AUTHORS
539
540 Ralf S. Engelschall
541
542 =cut
543