0000: 5b 63 6f 6d 6d 65 6e 74 20 7b 2d 2a 2d 20 74 63 [comment {-*- tc
0010: 6c 20 2d 2a 2d 20 64 6f 63 74 6f 6f 6c 73 20 6d l -*- doctools m
0020: 61 6e 70 61 67 65 7d 5d 0a 5b 63 6f 6d 6d 65 6e anpage}].[commen
0030: 74 20 7b 54 6f 20 63 6f 6e 76 65 72 74 20 74 68 t {To convert th
0040: 69 73 20 74 6f 20 61 6e 6f 74 68 65 72 20 64 6f is to another do
0050: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 6d cumentation form
0060: 61 74 20 75 73 65 20 74 68 65 20 64 74 70 6c 69 at use the dtpli
0070: 74 65 0a 20 20 20 20 20 20 20 20 20 20 73 63 72 te. scr
0080: 69 70 74 20 66 72 6f 6d 20 74 63 6c 6c 69 62 3a ipt from tcllib:
0090: 20 64 74 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e dtplite -o tls.
00a0: 6e 20 6e 72 6f 66 66 20 74 6c 73 2e 6d 61 6e 0a n nroff tls.man.
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 74 dt
00d0: 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e 68 74 6d plite -o tls.htm
00e0: 6c 20 68 74 6d 6c 20 74 6c 73 2e 6d 61 6e 0a 7d l html tls.man.}
00f0: 5d 0a 5b 6d 61 6e 70 61 67 65 5f 62 65 67 69 6e ].[manpage_begin
0100: 20 74 6c 73 20 6e 20 31 2e 38 5d 0a 5b 63 61 74 tls n 1.8].[cat
0110: 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f 70 79 egory tls].[copy
0120: 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61 74 74 right {1999 Matt
0130: 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70 79 72 Newman}].[copyr
0140: 69 67 68 74 20 7b 32 30 30 34 20 53 74 61 72 66 ight {2004 Starf
0150: 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a 5b 63 ish Systems}].[c
0160: 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34 20 42 opyright {2024 B
0170: 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d 0a 5b rian O'Hagan}].[
0180: 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49 2f 4f keywords tls I/O
0190: 20 22 49 50 20 41 64 64 72 65 73 73 22 20 4f 70 "IP Address" Op
01a0: 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20 54 4c enSSL SSL TCP TL
01b0: 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75 73 20 S "asynchronous
01c0: 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74 69 66 I/O" bind certif
01d0: 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20 63 6f icate channel co
01e0: 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61 69 6e nnection "domain
01f0: 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68 74 74 name" host "htt
0200: 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61 64 64 ps" "network add
0210: 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20 73 6f ress" network so
0220: 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b 6d 6f cket TclTLS].[mo
0230: 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53 20 65 ddesc {Tcl TLS e
0240: 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65 65 5f xtension}].[see_
0250: 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b 65 74 also http socket
0260: 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f 77 77 [uri https://ww
0270: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 20 4f w.openssl.org/ O
0280: 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c 65 64 penSSL]].[titled
0290: 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74 6f 20 esc {binding to
02a0: 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 the OpenSSL libr
02b0: 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70 74 65 ary for encrypte
02c0: 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49 2f 4f d socket and I/O
02d0: 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75 6e 69 channel communi
02e0: 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71 75 69 cations}].[requi
02f0: 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b 72 65 re Tcl 8.5-].[re
0300: 71 75 69 72 65 20 74 6c 73 20 31 2e 38 5d 0a 5b quire tls 1.8].[
0310: 64 65 73 63 72 69 70 74 69 6f 6e 5d 0a 0a 54 68 description]..Th
0320: 69 73 20 65 78 74 65 6e 73 69 6f 6e 20 70 72 6f is extension pro
0330: 76 69 64 65 73 20 54 43 4c 20 73 63 72 69 70 74 vides TCL script
0340: 20 61 63 63 65 73 73 20 74 6f 20 73 65 63 75 72 access to secur
0350: 65 20 73 6f 63 6b 65 74 20 63 6f 6d 6d 75 6e 69 e socket communi
0360: 63 61 74 69 6f 6e 73 0a 75 73 69 6e 67 20 74 68 cations.using th
0370: 65 20 54 72 61 6e 73 70 6f 72 74 20 4c 61 79 65 e Transport Laye
0380: 72 20 53 65 63 75 72 69 74 79 20 28 54 4c 53 29 r Security (TLS)
0390: 20 70 72 6f 74 6f 63 6f 6c 2e 20 49 74 20 70 72 protocol. It pr
03a0: 6f 76 69 64 65 73 20 61 20 67 65 6e 65 72 69 63 ovides a generic
03b0: 0a 62 69 6e 64 69 6e 67 20 74 6f 20 5b 75 72 69 .binding to [uri
03c0: 20 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 6f 70 "https://www.op
03d0: 65 6e 73 73 6c 2e 6f 72 67 2f 22 20 4f 70 65 6e enssl.org/" Open
03e0: 53 53 4c 5d 2c 20 75 74 69 6c 69 7a 69 6e 67 20 SSL], utilizing
03f0: 74 68 65 0a 5b 73 79 73 63 6d 64 20 54 63 6c 5f the.[syscmd Tcl_
0400: 53 74 61 63 6b 43 68 61 6e 6e 65 6c 5d 20 41 50 StackChannel] AP
0410: 49 20 69 6e 20 54 43 4c 20 38 2e 34 20 61 6e 64 I in TCL 8.4 and
0420: 20 68 69 67 68 65 72 2e 0a 54 68 65 73 65 20 73 higher..These s
0430: 6f 63 6b 65 74 73 20 62 65 68 61 76 65 20 65 78 ockets behave ex
0440: 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 61 actly the same a
0450: 73 20 63 68 61 6e 6e 65 6c 73 20 63 72 65 61 74 s channels creat
0460: 65 64 20 75 73 69 6e 67 20 74 68 65 20 62 75 69 ed using the bui
0470: 6c 74 2d 69 6e 0a 5b 73 79 73 63 6d 64 20 73 6f lt-in.[syscmd so
0480: 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 61 cket] command, a
0490: 6c 6f 6e 67 20 77 69 74 68 20 61 64 64 69 74 69 long with additi
04a0: 6f 6e 61 6c 20 6f 70 74 69 6f 6e 73 20 66 6f 72 onal options for
04b0: 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 0a 74 68 65 controlling.the
04c0: 20 53 53 4c 2f 54 4c 53 20 73 65 73 73 69 6f 6e SSL/TLS session
04d0: 2e 0a 0a 5b 73 65 63 74 69 6f 6e 20 43 6f 6d 6d ...[section Comm
04e0: 61 6e 64 73 5d 0a 0a 54 79 70 69 63 61 6c 6c 79 ands]..Typically
04f0: 20 6f 6e 65 20 77 6f 75 6c 64 20 75 73 65 20 74 one would use t
0500: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 he [cmd tls::soc
0510: 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 ket] command to
0520: 63 72 65 61 74 65 20 61 20 6e 65 77 20 65 6e 63 create a new enc
0530: 72 79 70 74 65 64 0a 54 43 50 20 73 6f 63 6b 65 rypted.TCP socke
0540: 74 2e 20 49 74 20 69 73 20 63 6f 6d 70 61 74 69 t. It is compati
0550: 62 6c 65 20 77 69 74 68 20 74 68 65 20 6e 61 74 ble with the nat
0560: 69 76 65 20 54 43 4c 20 5b 73 79 73 63 6d 64 20 ive TCL [syscmd
0570: 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e ::socket] comman
0580: 64 2e 0a 41 6c 74 65 72 6e 61 74 69 76 65 6c 79 d..Alternatively
0590: 20 66 6f 72 20 61 6e 20 65 78 69 73 74 69 6e 67 for an existing
05a0: 20 54 43 50 20 73 6f 63 6b 65 74 2c 20 74 68 65 TCP socket, the
05b0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 [cmd tls::impor
05c0: 74 5d 20 63 6f 6d 6d 61 6e 64 20 63 61 6e 20 62 t] command can b
05d0: 65 0a 75 73 65 64 20 74 6f 20 73 74 61 72 74 20 e.used to start
05e0: 54 4c 53 20 6f 6e 20 74 68 65 20 63 6f 6e 6e 65 TLS on the conne
05f0: 63 74 69 6f 6e 2e 0a 0a 5b 6c 69 73 74 5f 62 65 ction...[list_be
0600: 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d gin definitions]
0610: 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 ..[call [cmd tls
0620: 3a 3a 69 6e 69 74 5d 20 5b 6f 70 74 20 5b 61 72 ::init] [opt [ar
0630: 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 g -option]] [opt
0640: 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f [arg value]] [o
0650: 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e pt [arg "-option
0660: 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d 0a 0a value ..."]]]..
0670: 4f 70 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f Optional functio
0680: 6e 20 74 6f 20 73 65 74 20 74 68 65 20 64 65 66 n to set the def
0690: 61 75 6c 74 20 6f 70 74 69 6f 6e 73 20 75 73 65 ault options use
06a0: 64 20 62 79 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 d by [cmd tls::s
06b0: 6f 63 6b 65 74 5d 2e 20 49 66 20 79 6f 75 0a 63 ocket]. If you.c
06c0: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d all [cmd tls::im
06d0: 70 6f 72 74 5d 20 64 69 72 65 63 74 6c 79 2c 20 port] directly,
06e0: 74 68 69 73 20 63 6f 6d 6d 61 6e 64 20 68 61 73 this command has
06f0: 20 6e 6f 20 65 66 66 65 63 74 2e 20 54 68 69 73 no effect. This
0700: 20 63 6f 6d 6d 61 6e 64 0a 73 75 70 70 6f 72 74 command.support
0710: 73 20 61 6c 6c 20 6f 66 20 74 68 65 20 73 61 6d s all of the sam
0720: 65 20 6f 70 74 69 6f 6e 73 20 61 73 20 74 68 65 e options as the
0730: 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 [cmd tls::socke
0740: 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 74 68 6f 75 t] command, thou
0750: 67 68 20 79 6f 75 0a 73 68 6f 75 6c 64 20 6c 69 gh you.should li
0760: 6d 69 74 20 79 6f 75 72 20 6f 70 74 69 6f 6e 73 mit your options
0770: 20 74 6f 20 6f 6e 6c 79 20 54 4c 53 20 72 65 6c to only TLS rel
0780: 61 74 65 64 20 6f 6e 65 73 2e 0a 0a 5b 63 61 6c ated ones...[cal
0790: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b l [cmd tls::sock
07a0: 65 74 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f et] [opt [arg -o
07b0: 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 ption]] [opt [ar
07c0: 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b g value]] [opt [
07d0: 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c arg "-option val
07e0: 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 68 ue ..."]] [arg h
07f0: 6f 73 74 5d 20 5b 61 72 67 20 70 6f 72 74 5d 5d ost] [arg port]]
0800: 0a 0a 54 68 69 73 20 69 73 20 61 20 68 65 6c 70 ..This is a help
0810: 65 72 20 66 75 6e 63 74 69 6f 6e 20 74 68 61 74 er function that
0820: 20 75 74 69 6c 69 7a 65 73 20 74 68 65 20 75 6e utilizes the un
0830: 64 65 72 6c 79 69 6e 67 20 63 6f 6d 6d 61 6e 64 derlying command
0840: 73 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65 74 s [syscmd socket
0850: 5d 0a 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a ].and [cmd tls::
0860: 69 6d 70 6f 72 74 5d 20 74 6f 20 63 72 65 61 74 import] to creat
0870: 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e e the connection
0880: 2e 20 49 74 20 62 65 68 61 76 65 73 20 74 68 65 . It behaves the
0890: 20 73 61 6d 65 20 61 73 20 74 68 65 0a 6e 61 74 same as the.nat
08a0: 69 76 65 20 54 43 4c 20 5b 73 79 73 63 6d 64 20 ive TCL [syscmd
08b0: 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c socket] command,
08c0: 20 62 75 74 20 61 6c 73 6f 20 73 75 70 70 6f 72 but also suppor
08d0: 74 73 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a ts the [cmd tls:
08e0: 69 6d 70 6f 72 74 5d 0a 63 6f 6d 6d 61 6e 64 20 import].command
08f0: 6f 70 74 69 6f 6e 73 20 77 69 74 68 20 6f 6e 65 options with one
0900: 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69 additional opti
0910: 6f 6e 2e 20 49 74 20 72 65 74 75 72 6e 73 20 74 on. It returns t
0920: 68 65 20 63 68 61 6e 6e 65 6c 20 68 61 6e 64 6c he channel handl
0930: 65 20 69 64 0a 66 6f 72 20 74 68 65 20 6e 65 77 e id.for the new
0940: 20 73 6f 63 6b 65 74 2e 0a 0a 5b 6c 69 73 74 5f socket...[list_
0950: 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a begin options]..
0960: 5b 6f 70 74 5f 64 65 66 20 2d 61 75 74 6f 73 65 [opt_def -autose
0970: 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 20 62 6f rvername [arg bo
0980: 6f 6c 5d 5d 0a 49 66 20 5b 63 6f 6e 73 74 20 74 ol]].If [const t
0990: 72 75 65 5d 2c 20 61 75 74 6f 6d 61 74 69 63 61 rue], automatica
09a0: 6c 6c 79 20 73 65 74 20 74 68 65 20 5b 6f 70 74 lly set the [opt
09b0: 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65 5d ion -servername]
09c0: 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74 68 65 argument to the
09d0: 0a 5b 65 6d 70 68 20 68 6f 73 74 5d 20 61 72 67 .[emph host] arg
09e0: 75 6d 65 6e 74 2e 20 44 65 66 61 75 6c 74 20 69 ument. Default i
09f0: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e s [const false].
0a00: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 ..[list_end]..[c
0a10: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f all [cmd tls::so
0a20: 63 6b 65 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d 73 cket] [option -s
0a30: 65 72 76 65 72 5d 20 5b 61 72 67 20 63 6f 6d 6d erver] [arg comm
0a40: 61 6e 64 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d and] [opt [arg -
0a50: 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 option]] [opt [a
0a60: 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 rg value]] [opt
0a70: 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 [arg "-option va
0a80: 6c 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 lue ..."]] [arg
0a90: 70 6f 72 74 5d 5d 0a 0a 53 61 6d 65 20 61 73 20 port]]..Same as
0aa0: 70 72 65 76 69 6f 75 73 2c 20 62 75 74 20 69 6e previous, but in
0ab0: 73 74 65 61 64 20 63 72 65 61 74 65 73 20 61 20 stead creates a
0ac0: 73 65 72 76 65 72 20 73 6f 63 6b 65 74 20 66 6f server socket fo
0ad0: 72 20 63 6c 69 65 6e 74 73 20 74 6f 20 63 6f 6e r clients to con
0ae0: 6e 65 63 74 20 74 6f 0a 6a 75 73 74 20 6c 69 6b nect to.just lik
0af0: 65 20 74 68 65 20 54 63 6c 20 5b 73 79 73 63 6d e the Tcl [syscm
0b00: 64 20 22 73 6f 63 6b 65 74 20 2d 73 65 72 76 65 d "socket -serve
0b10: 72 22 5d 20 63 6f 6d 6d 61 6e 64 2e 20 49 74 20 r"] command. It
0b20: 72 65 74 75 72 6e 73 20 74 68 65 20 63 68 61 6e returns the chan
0b30: 6e 65 6c 0a 68 61 6e 64 6c 65 20 69 64 20 66 6f nel.handle id fo
0b40: 72 20 74 68 65 20 6e 65 77 20 73 6f 63 6b 65 74 r the new socket
0b50: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c ...[call [cmd tl
0b60: 73 3a 3a 69 6d 70 6f 72 74 5d 20 5b 61 72 67 20 s::import] [arg
0b70: 63 68 61 6e 6e 65 6c 5d 20 5b 6f 70 74 20 5b 61 channel] [opt [a
0b80: 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 rg -option]] [op
0b90: 74 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b t [arg value]] [
0ba0: 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f opt [arg "-optio
0bb0: 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d 0a n value ..."]]].
0bc0: 0a 53 74 61 72 74 20 54 4c 53 20 65 6e 63 72 79 .Start TLS encry
0bd0: 70 74 69 6f 6e 20 6f 6e 20 54 43 4c 20 63 68 61 ption on TCL cha
0be0: 6e 6e 65 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65 nnel [arg channe
0bf0: 6c 5d 20 76 69 61 20 61 20 73 74 61 63 6b 65 64 l] via a stacked
0c00: 20 63 68 61 6e 6e 65 6c 2e 20 49 74 0a 6e 65 65 channel. It.nee
0c10: 64 20 6e 6f 74 20 62 65 20 61 20 73 6f 63 6b 65 d not be a socke
0c20: 74 2c 20 62 75 74 20 6d 75 73 74 20 70 72 6f 76 t, but must prov
0c30: 69 64 65 20 62 69 2d 64 69 72 65 63 74 69 6f 6e ide bi-direction
0c40: 61 6c 20 66 6c 6f 77 2e 20 41 6c 73 6f 20 73 65 al flow. Also se
0c50: 74 73 20 73 65 73 73 69 6f 6e 0a 70 61 72 61 6d ts session.param
0c60: 65 74 65 72 73 20 66 6f 72 20 53 53 4c 20 68 61 eters for SSL ha
0c70: 6e 64 73 68 61 6b 65 2e 20 56 61 6c 69 64 20 6f ndshake. Valid o
0c80: 70 74 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b 6c 69 ptions are:..[li
0c90: 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 st_begin options
0ca0: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 6c 70 ]..[opt_def -alp
0cb0: 6e 20 5b 61 72 67 20 6c 69 73 74 5d 5d 0a 4c 69 n [arg list]].Li
0cc0: 73 74 20 6f 66 20 70 72 6f 74 6f 63 6f 6c 73 20 st of protocols
0cd0: 74 6f 20 6f 66 66 65 72 20 64 75 72 69 6e 67 20 to offer during
0ce0: 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 Application-Laye
0cf0: 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 r Protocol Negot
0d00: 69 61 74 69 6f 6e 0a 28 41 4c 50 4e 29 2e 20 46 iation.(ALPN). F
0d10: 6f 72 20 65 78 61 6d 70 6c 65 3a 20 5b 63 6f 6e or example: [con
0d20: 73 74 20 68 32 5d 20 61 6e 64 20 5b 63 6f 6e 73 st h2] and [cons
0d30: 74 20 68 74 74 70 2f 31 2e 31 5d 2c 20 62 75 74 t http/1.1], but
0d40: 20 6e 6f 74 20 5b 63 6f 6e 73 74 20 68 33 5d 20 not [const h3]
0d50: 6f 72 0a 5b 63 6f 6e 73 74 20 71 75 69 63 5d 2e or.[const quic].
0d60: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64 69 ..[opt_def -cadi
0d70: 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72 79 r [arg directory
0d80: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 ]].Specifies the
0d90: 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 directory where
0da0: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 the Certificate
0db0: 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 20 Authority (CA)
0dc0: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65 certificates are
0dd0: 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65 66 .stored. The def
0de0: 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72 6d ault is platform
0df0: 20 73 70 65 63 69 66 69 63 20 61 6e 64 20 63 61 specific and ca
0e00: 6e 20 62 65 20 73 65 74 20 61 74 20 63 6f 6d 70 n be set at comp
0e10: 69 6c 65 20 74 69 6d 65 2e 20 54 68 65 0a 64 65 ile time. The.de
0e20: 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63 fault location c
0e30: 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e an be overridden
0e40: 20 62 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c by the [var SSL
0e50: 5f 43 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72 _CERT_DIR] envir
0e60: 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e onment.variable.
0e70: 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 See [sectref "C
0e80: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 ertificate Valid
0e90: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 ation"] for more
0ea0: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f details...[opt_
0eb0: 64 65 66 20 2d 63 61 66 69 6c 65 20 5b 61 72 67 def -cafile [arg
0ec0: 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 filename]].Spec
0ed0: 69 66 69 65 73 20 74 68 65 20 66 69 6c 65 20 77 ifies the file w
0ee0: 69 74 68 20 74 68 65 20 43 65 72 74 69 66 69 63 ith the Certific
0ef0: 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 ate Authority (C
0f00: 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73 20 A) certificates
0f10: 74 6f 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73 74 to use in.[const
0f20: 20 50 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d 61 PEM] file forma
0f30: 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 t. The default i
0f40: 73 20 5b 66 69 6c 65 20 63 65 72 74 2e 70 65 6d s [file cert.pem
0f50: 5d 2c 20 69 6e 20 74 68 65 20 4f 70 65 6e 53 53 ], in the OpenSS
0f60: 4c 0a 64 69 72 65 63 74 6f 72 79 2e 20 54 68 65 L.directory. The
0f70: 20 64 65 66 61 75 6c 74 20 66 69 6c 65 20 63 61 default file ca
0f80: 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 n be overridden
0f90: 62 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f by the [var SSL_
0fa0: 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72 CERT_FILE] envir
0fb0: 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e onment.variable.
0fc0: 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 See [sectref "C
0fd0: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 ertificate Valid
0fe0: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 ation"] for more
0ff0: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f details...[opt_
1000: 64 65 66 20 2d 63 61 73 74 6f 72 65 20 5b 61 72 def -castore [ar
1010: 67 20 55 52 49 5d 5d 0a 53 70 65 63 69 66 69 65 g URI]].Specifie
1020: 73 20 74 68 65 20 55 6e 69 66 6f 72 6d 20 52 65 s the Uniform Re
1030: 73 6f 75 72 63 65 20 49 64 65 6e 74 69 66 69 65 source Identifie
1040: 72 20 28 55 52 49 29 20 66 6f 72 20 74 68 65 20 r (URI) for the
1050: 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68 Certificate Auth
1060: 6f 72 69 74 79 0a 28 43 41 29 20 73 74 6f 72 65 ority.(CA) store
1070: 2c 20 77 68 69 63 68 20 6d 61 79 20 62 65 20 61 , which may be a
1080: 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61 69 6e 65 single containe
1090: 72 20 6f 72 20 61 20 63 61 74 61 6c 6f 67 20 6f r or a catalog o
10a0: 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e 0a 53 74 f containers..St
10b0: 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e arting with Open
10c0: 53 53 4c 20 33 2e 32 20 6f 6e 20 4d 53 20 57 69 SSL 3.2 on MS Wi
10d0: 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20 22 5b ndows, set to "[
10e0: 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e 73 const "org.opens
10f0: 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d sl.winstore://"]
1100: 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62 75 69 ".to use the bui
1110: 6c 74 2d 69 6e 20 4d 53 20 57 69 6e 64 6f 77 73 lt-in MS Windows
1120: 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74 6f Certificate Sto
1130: 72 65 2e 20 53 65 65 0a 5b 73 65 63 74 72 65 66 re. See.[sectref
1140: 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61 "Certificate Va
1150: 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d lidation"] for m
1160: 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f ore details...[o
1170: 70 74 5f 64 65 66 20 2d 63 65 72 74 66 69 6c 65 pt_def -certfile
1180: 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d [arg filename]]
1190: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 6e .Specifies the n
11a0: 61 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65 20 ame of the file
11b0: 77 69 74 68 20 74 68 65 20 63 65 72 74 69 66 69 with the certifi
11c0: 63 61 74 65 20 74 6f 20 75 73 65 20 69 6e 20 50 cate to use in P
11d0: 45 4d 20 66 6f 72 6d 61 74 0a 61 73 20 74 68 65 EM format.as the
11e0: 20 6c 6f 63 61 6c 20 28 63 6c 69 65 6e 74 20 6f local (client o
11f0: 72 20 73 65 72 76 65 72 29 20 63 65 72 74 69 66 r server) certif
1200: 69 63 61 74 65 2e 20 49 74 20 61 6c 73 6f 20 63 icate. It also c
1210: 6f 6e 74 61 69 6e 73 20 74 68 65 20 70 75 62 6c ontains the publ
1220: 69 63 20 6b 65 79 2e 0a 0a 5b 6f 70 74 5f 64 65 ic key...[opt_de
1230: 66 20 2d 63 65 72 74 20 5b 61 72 67 20 73 74 72 f -cert [arg str
1240: 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 ing]].Specifies
1250: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 the certificate
1260: 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52 20 to use as a DER
1270: 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20 28 encoded string (
1280: 58 2e 35 30 39 20 44 45 52 29 2e 0a 0a 5b 6f 70 X.509 DER)...[op
1290: 74 5f 64 65 66 20 2d 63 69 70 68 65 72 20 5b 61 t_def -cipher [a
12a0: 72 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 rg string]].Spec
12b0: 69 66 69 65 73 20 74 68 65 20 6c 69 73 74 20 6f ifies the list o
12c0: 66 20 63 69 70 68 65 72 73 20 74 6f 20 75 73 65 f ciphers to use
12d0: 20 66 6f 72 20 54 4c 53 20 31 2e 32 20 61 6e 64 for TLS 1.2 and
12e0: 20 65 61 72 6c 69 65 72 20 63 6f 6e 6e 65 63 74 earlier connect
12f0: 69 6f 6e 73 2e 0a 53 74 72 69 6e 67 20 69 73 20 ions..String is
1300: 61 20 63 6f 6c 6f 6e 20 22 5b 63 6f 6e 73 74 20 a colon "[const
1310: 3a 5d 22 20 73 65 70 61 72 61 74 65 64 20 6c 69 :]" separated li
1320: 73 74 20 6f 66 20 63 69 70 68 65 72 73 2e 0a 43 st of ciphers..C
1330: 69 70 68 65 72 73 20 63 61 6e 20 62 65 20 63 6f iphers can be co
1340: 6d 62 69 6e 65 64 20 75 73 69 6e 67 20 74 68 65 mbined using the
1350: 20 22 5b 63 6f 6e 73 74 20 2b 5d 22 20 63 68 61 "[const +]" cha
1360: 72 61 63 74 65 72 2e 0a 50 72 65 66 69 78 65 73 racter..Prefixes
1370: 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 can be used to
1380: 70 65 72 6d 61 6e 65 6e 74 6c 79 20 72 65 6d 6f permanently remo
1390: 76 65 20 22 5b 63 6f 6e 73 74 20 21 5d 22 2c 20 ve "[const !]",
13a0: 64 65 6c 65 74 65 20 22 5b 63 6f 6e 73 74 20 2d delete "[const -
13b0: 5d 22 2c 20 6f 72 0a 6d 6f 76 65 20 74 6f 20 74 ]", or.move to t
13c0: 68 65 20 65 6e 64 20 22 5b 63 6f 6e 73 74 20 2b he end "[const +
13d0: 5d 22 20 61 20 73 70 65 63 69 66 69 65 64 20 63 ]" a specified c
13e0: 69 70 68 65 72 2e 0a 4b 65 79 77 6f 72 64 73 20 ipher..Keywords
13f0: 5b 63 6f 6e 73 74 20 40 53 54 52 45 4e 47 54 48 [const @STRENGTH
1400: 5d 20 28 73 6f 72 74 20 62 79 20 61 6c 67 6f 72 ] (sort by algor
1410: 69 74 68 6d 20 6b 65 79 20 6c 65 6e 67 74 68 29 ithm key length)
1420: 2c 0a 5b 63 6f 6e 73 74 20 40 53 45 43 4c 45 56 ,.[const @SECLEV
1430: 45 4c 3d 5d 5b 65 6d 70 68 20 6e 5d 20 28 73 65 EL=][emph n] (se
1440: 74 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c t security level
1450: 20 74 6f 20 6e 29 2c 20 61 6e 64 0a 5b 63 6f 6e to n), and.[con
1460: 73 74 20 44 45 46 41 55 4c 54 5d 20 28 75 73 65 st DEFAULT] (use
1470: 20 64 65 66 61 75 6c 74 20 63 69 70 68 65 72 20 default cipher
1480: 6c 69 73 74 2c 20 61 74 20 73 74 61 72 74 20 6f list, at start o
1490: 6e 6c 79 29 20 63 61 6e 20 61 6c 73 6f 20 62 65 nly) can also be
14a0: 20 73 70 65 63 69 66 69 65 64 2e 0a 53 65 65 20 specified..See
14b0: 74 68 65 20 5b 75 72 69 20 22 68 74 74 70 73 3a the [uri "https:
14c0: 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f //docs.openssl.o
14d0: 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f 6f rg/master/man1/o
14e0: 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f 23 penssl-ciphers/#
14f0: 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53 4c options" OpenSSL
1500: 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 ].documentation
1510: 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 for the full lis
1520: 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75 65 t of valid value
1530: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 69 s...[opt_def -ci
1540: 70 68 65 72 73 75 69 74 65 73 20 5b 61 72 67 20 phersuites [arg
1550: 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 string]].Specifi
1560: 65 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 63 es the list of c
1570: 69 70 68 65 72 20 73 75 69 74 65 73 20 74 6f 20 ipher suites to
1580: 75 73 65 20 66 6f 72 20 54 4c 53 20 31 2e 33 20 use for TLS 1.3
1590: 61 73 20 61 20 63 6f 6c 6f 6e 0a 22 5b 63 6f 6e as a colon."[con
15a0: 73 74 20 3a 5d 22 20 73 65 70 61 72 61 74 65 64 st :]" separated
15b0: 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72 20 list of cipher
15c0: 73 75 69 74 65 20 6e 61 6d 65 73 2e 20 53 65 65 suite names. See
15d0: 20 74 68 65 0a 5b 75 72 69 20 22 68 74 74 70 73 the.[uri "https
15e0: 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e ://docs.openssl.
15f0: 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f org/master/man1/
1600: 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f openssl-ciphers/
1610: 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53 #options" OpenSS
1620: 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e L].documentation
1630: 20 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c 69 for the full li
1640: 73 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75 st of valid valu
1650: 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 es...[opt_def -c
1660: 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c ommand [arg call
1670: 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 back]].Specifies
1680: 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f the callback co
1690: 6d 6d 61 6e 64 20 74 6f 20 62 65 20 69 6e 76 6f mmand to be invo
16a0: 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 ked at several p
16b0: 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 oints during the
16c0: 0a 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 70 61 .handshake to pa
16d0: 73 73 20 65 72 72 6f 72 73 2c 20 74 72 61 63 69 ss errors, traci
16e0: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20 ng information,
16f0: 61 6e 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 65 73 and protocol mes
1700: 73 61 67 65 73 2e 0a 53 65 65 20 5b 73 65 63 74 sages..See [sect
1710: 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 ref "Callback Op
1720: 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 tions"] for more
1730: 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66 info...[opt_def
1740: 20 2d 64 68 70 61 72 61 6d 73 20 5b 61 72 67 20 -dhparams [arg
1750: 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 filename]].Speci
1760: 66 69 65 73 20 74 68 65 20 44 69 66 66 69 65 2d fies the Diffie-
1770: 48 65 6c 6c 6d 61 6e 20 28 44 48 29 20 70 61 72 Hellman (DH) par
1780: 61 6d 65 74 65 72 73 20 66 69 6c 65 2e 0a 0a 5b ameters file...[
1790: 6f 70 74 5f 64 65 66 20 2d 6b 65 79 66 69 6c 65 opt_def -keyfile
17a0: 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d [arg filename]]
17b0: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 70 .Specifies the p
17c0: 72 69 76 61 74 65 20 6b 65 79 20 66 69 6c 65 2e rivate key file.
17d0: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 The default is
17e0: 74 6f 20 75 73 65 20 74 68 65 20 66 69 6c 65 0a to use the file.
17f0: 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 specified by the
1800: 20 5b 61 72 67 20 2d 63 65 72 74 66 69 6c 65 5d [arg -certfile]
1810: 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 option...[opt_d
1820: 65 66 20 2d 6b 65 79 20 5b 61 72 67 20 73 74 72 ef -key [arg str
1830: 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 ing]].Specifies
1840: 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 the private key
1850: 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52 20 to use as a DER
1860: 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20 28 encoded string (
1870: 50 4b 43 53 23 31 20 44 45 52 29 2e 0a 0a 5b 6f PKCS#1 DER)...[o
1880: 70 74 5f 64 65 66 20 2d 6d 6f 64 65 6c 20 5b 61 pt_def -model [a
1890: 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 46 6f 72 rg channel]].For
18a0: 63 65 20 74 68 69 73 20 63 68 61 6e 6e 65 6c 20 ce this channel
18b0: 74 6f 20 73 68 61 72 65 20 74 68 65 20 73 61 6d to share the sam
18c0: 65 20 5b 74 65 72 6d 20 53 53 4c 5f 43 54 58 5d e [term SSL_CTX]
18d0: 20 73 74 72 75 63 74 75 72 65 20 61 73 20 74 68 structure as th
18e0: 65 0a 73 70 65 63 69 66 69 65 64 20 5b 61 72 67 e.specified [arg
18f0: 20 63 68 61 6e 6e 65 6c 5d 2c 20 61 6e 64 20 74 channel], and t
1900: 68 65 72 65 66 6f 72 65 20 73 68 61 72 65 20 63 herefore share c
1910: 6f 6e 66 69 67 2c 20 63 61 6c 6c 62 61 63 6b 73 onfig, callbacks
1920: 2c 20 65 74 63 2e 0a 0a 5b 6f 70 74 5f 64 65 66 , etc...[opt_def
1930: 20 2d 70 61 73 73 77 6f 72 64 20 5b 61 72 67 20 -password [arg
1940: 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69 callback]].Speci
1950: 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63 fies the callbac
1960: 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e 76 k command to inv
1970: 6f 6b 65 20 77 68 65 6e 20 4f 70 65 6e 53 53 4c oke when OpenSSL
1980: 20 6e 65 65 64 73 20 74 6f 20 6f 62 74 61 69 6e needs to obtain
1990: 20 61 0a 70 61 73 73 77 6f 72 64 2e 20 54 68 69 a.password. Thi
19a0: 73 20 69 73 20 74 79 70 69 63 61 6c 6c 79 20 75 s is typically u
19b0: 73 65 64 20 74 6f 20 75 6e 6c 6f 63 6b 20 74 68 sed to unlock th
19c0: 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 6f 66 e private key of
19d0: 20 61 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a a certificate..
19e0: 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 68 6f The callback sho
19f0: 75 6c 64 20 72 65 74 75 72 6e 20 61 20 70 61 73 uld return a pas
1a00: 73 77 6f 72 64 20 73 74 72 69 6e 67 2e 20 53 65 sword string. Se
1a10: 65 20 5b 73 65 63 74 72 65 66 20 22 43 61 6c 6c e [sectref "Call
1a20: 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d 0a 66 back Options"].f
1a30: 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b or more info...[
1a40: 6f 70 74 5f 64 65 66 20 2d 70 6f 73 74 5f 68 61 opt_def -post_ha
1a50: 6e 64 73 68 61 6b 65 20 5b 61 72 67 20 62 6f 6f ndshake [arg boo
1a60: 6c 5d 5d 0a 41 6c 6c 6f 77 20 70 6f 73 74 2d 68 l]].Allow post-h
1a70: 61 6e 64 73 68 61 6b 65 20 73 65 73 73 69 6f 6e andshake session
1a80: 20 74 69 63 6b 65 74 20 75 70 64 61 74 65 73 2e ticket updates.
1a90: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 ..[opt_def -requ
1aa0: 65 73 74 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a est [arg bool]].
1ab0: 52 65 71 75 65 73 74 20 61 20 63 65 72 74 69 66 Request a certif
1ac0: 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 icate from the p
1ad0: 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 eer during the S
1ae0: 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 SL handshake. Th
1af0: 69 73 20 69 73 20 6e 65 65 64 65 64 0a 74 6f 20 is is needed.to
1b00: 64 6f 20 43 65 72 74 69 66 69 63 61 74 65 20 56 do Certificate V
1b10: 61 6c 69 64 61 74 69 6f 6e 2e 20 53 74 61 72 74 alidation. Start
1b20: 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e ing in TclTLS 1.
1b30: 38 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20 69 8, the default i
1b40: 73 0a 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 0a s.[const true]..
1b50: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65 See [sectref "Ce
1b60: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 rtificate Valida
1b70: 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 tion"] for more
1b80: 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 details...[opt_d
1b90: 65 66 20 2d 72 65 71 75 69 72 65 20 5b 61 72 67 ef -require [arg
1ba0: 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 69 72 65 20 bool]].Require
1bb0: 61 20 76 61 6c 69 64 20 63 65 72 74 69 66 69 63 a valid certific
1bc0: 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65 ate from the pee
1bd0: 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c r during the SSL
1be0: 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20 74 handshake. If t
1bf0: 68 69 73 20 69 73 0a 73 65 74 20 74 6f 20 74 72 his is.set to tr
1c00: 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f 6e ue, then [option
1c10: 20 2d 72 65 71 75 65 73 74 5d 20 6d 75 73 74 20 -request] must
1c20: 61 6c 73 6f 20 62 65 20 73 65 74 20 74 6f 20 74 also be set to t
1c30: 72 75 65 20 61 6e 64 20 61 20 65 69 74 68 65 72 rue and a either
1c40: 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d .[option -cadir]
1c50: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c , [option -cafil
1c60: 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 e], [option -cas
1c70: 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70 6c 61 74 tore], or a plat
1c80: 66 6f 72 6d 20 64 65 66 61 75 6c 74 0a 6d 75 73 form default.mus
1c90: 74 20 62 65 20 70 72 6f 76 69 64 65 64 20 69 6e t be provided in
1ca0: 20 6f 72 64 65 72 20 74 6f 20 76 61 6c 69 64 61 order to valida
1cb0: 74 65 20 61 67 61 69 6e 73 74 2e 20 54 68 65 20 te against. The
1cc0: 64 65 66 61 75 6c 74 20 69 6e 20 54 63 6c 54 4c default in TclTL
1cd0: 53 20 31 2e 38 20 61 6e 64 0a 65 61 72 6c 69 65 S 1.8 and.earlie
1ce0: 72 20 76 65 72 73 69 6f 6e 73 20 69 73 20 5b 63 r versions is [c
1cf0: 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e 63 onst false] sinc
1d00: 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61 74 66 6f e not all platfo
1d10: 72 6d 73 20 68 61 76 65 20 63 65 72 74 69 66 69 rms have certifi
1d20: 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 61 74 cates to.validat
1d30: 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20 66 e against in a f
1d40: 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 orm compatible w
1d50: 69 74 68 20 4f 70 65 6e 53 53 4c 2e 0a 53 65 65 ith OpenSSL..See
1d60: 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69 [sectref "Certi
1d70: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f ficate Validatio
1d80: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 n"] for more det
1d90: 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 ails...[opt_def
1da0: 2d 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 20 -security_level
1db0: 5b 61 72 67 20 69 6e 74 65 67 65 72 5d 5d 0a 53 [arg integer]].S
1dc0: 70 65 63 69 66 69 65 73 20 74 68 65 20 73 65 63 pecifies the sec
1dd0: 75 72 69 74 79 20 6c 65 76 65 6c 20 28 76 61 6c urity level (val
1de0: 75 65 20 66 72 6f 6d 20 30 20 74 6f 20 35 29 2e ue from 0 to 5).
1df0: 20 54 68 65 20 73 65 63 75 72 69 74 79 20 6c 65 The security le
1e00: 76 65 6c 20 61 66 66 65 63 74 73 0a 74 68 65 20 vel affects.the
1e10: 61 6c 6c 6f 77 65 64 20 63 69 70 68 65 72 20 73 allowed cipher s
1e20: 75 69 74 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 uite encryption
1e30: 61 6c 67 6f 72 69 74 68 6d 73 2c 20 73 75 70 70 algorithms, supp
1e40: 6f 72 74 65 64 20 45 43 43 20 63 75 72 76 65 73 orted ECC curves
1e50: 2c 0a 73 75 70 70 6f 72 74 65 64 20 73 69 67 6e ,.supported sign
1e60: 61 74 75 72 65 20 61 6c 67 6f 72 69 74 68 6d 73 ature algorithms
1e70: 2c 20 44 48 20 70 61 72 61 6d 65 74 65 72 20 73 , DH parameter s
1e80: 69 7a 65 73 2c 20 63 65 72 74 69 66 69 63 61 74 izes, certificat
1e90: 65 20 6b 65 79 20 73 69 7a 65 73 0a 61 6e 64 20 e key sizes.and
1ea0: 73 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72 69 signature algori
1eb0: 74 68 6d 73 2e 20 54 68 65 20 64 65 66 61 75 6c thms. The defaul
1ec0: 74 20 69 73 20 31 20 70 72 69 6f 72 20 74 6f 20 t is 1 prior to
1ed0: 4f 70 65 6e 53 53 4c 20 33 2e 32 20 61 6e 64 20 OpenSSL 3.2 and
1ee0: 32 0a 74 68 65 72 65 61 66 74 65 72 2e 20 4c 65 2.thereafter. Le
1ef0: 76 65 6c 20 33 20 61 6e 64 20 68 69 67 68 65 72 vel 3 and higher
1f00: 20 64 69 73 61 62 6c 65 20 73 75 70 70 6f 72 74 disable support
1f10: 20 66 6f 72 20 73 65 73 73 69 6f 6e 20 74 69 63 for session tic
1f20: 6b 65 74 73 20 61 6e 64 0a 6f 6e 6c 79 20 61 63 kets and.only ac
1f30: 63 65 70 74 20 63 69 70 68 65 72 20 73 75 69 74 cept cipher suit
1f40: 65 73 20 74 68 61 74 20 70 72 6f 76 69 64 65 20 es that provide
1f50: 66 6f 72 77 61 72 64 20 73 65 63 72 65 63 79 2e forward secrecy.
1f60: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 72 76 ..[opt_def -serv
1f70: 65 72 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 53 er [arg bool]].S
1f80: 70 65 63 69 66 69 65 73 20 77 68 65 74 68 65 72 pecifies whether
1f90: 20 74 6f 20 61 63 74 20 61 73 20 61 20 73 65 72 to act as a ser
1fa0: 76 65 72 20 61 6e 64 20 72 65 73 70 6f 6e 64 20 ver and respond
1fb0: 77 69 74 68 20 61 20 73 65 72 76 65 72 20 68 61 with a server ha
1fc0: 6e 64 73 68 61 6b 65 20 77 68 65 6e 20 61 0a 63 ndshake when a.c
1fd0: 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 73 20 61 lient connects a
1fe0: 6e 64 20 70 72 6f 76 69 64 65 73 20 61 20 63 6c nd provides a cl
1ff0: 69 65 6e 74 20 68 61 6e 64 73 68 61 6b 65 2e 20 ient handshake.
2000: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b The default is [
2010: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 0a 5b const false]...[
2020: 6f 70 74 5f 64 65 66 20 2d 73 65 72 76 65 72 6e opt_def -servern
2030: 61 6d 65 20 5b 61 72 67 20 68 6f 73 74 6e 61 6d ame [arg hostnam
2040: 65 5d 5d 0a 53 70 65 63 69 66 79 20 74 68 65 20 e]].Specify the
2050: 70 65 65 72 27 73 20 68 6f 73 74 6e 61 6d 65 2e peer's hostname.
2060: 20 54 68 69 73 20 69 73 20 75 73 65 64 20 74 6f This is used to
2070: 20 73 65 74 20 74 68 65 20 54 4c 53 20 53 65 72 set the TLS Ser
2080: 76 65 72 20 4e 61 6d 65 0a 49 6e 64 69 63 61 74 ver Name.Indicat
2090: 69 6f 6e 20 28 53 4e 49 29 20 65 78 74 65 6e 73 ion (SNI) extens
20a0: 69 6f 6e 2e 20 53 65 74 20 74 68 69 73 20 74 6f ion. Set this to
20b0: 20 74 68 65 20 65 78 70 65 63 74 65 64 20 73 65 the expected se
20c0: 72 76 65 72 6e 61 6d 65 20 69 6e 20 74 68 65 0a rvername in the.
20d0: 73 65 72 76 65 72 27 73 20 63 65 72 74 69 66 69 server's certifi
20e0: 63 61 74 65 20 6f 72 20 6f 6e 65 20 6f 66 20 74 cate or one of t
20f0: 68 65 20 53 75 62 6a 65 63 74 20 41 6c 74 65 72 he Subject Alter
2100: 6e 61 74 65 20 4e 61 6d 65 73 20 28 53 41 4e 29 nate Names (SAN)
2110: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 73 ...[opt_def -ses
2120: 73 69 6f 6e 5f 69 64 20 5b 61 72 67 20 62 69 6e sion_id [arg bin
2130: 61 72 79 5f 73 74 72 69 6e 67 5d 5d 0a 53 70 65 ary_string]].Spe
2140: 63 69 66 69 65 73 20 74 68 65 20 73 65 73 73 69 cifies the sessi
2150: 6f 6e 20 69 64 20 74 6f 20 72 65 73 75 6d 65 20 on id to resume
2160: 61 20 73 65 73 73 69 6f 6e 2e 20 4e 6f 74 20 73 a session. Not s
2170: 75 70 70 6f 72 74 65 64 20 79 65 74 2e 0a 0a 5b upported yet...[
2180: 6f 70 74 5f 64 65 66 20 2d 73 73 6c 32 20 5b 61 opt_def -ssl2 [a
2190: 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 rg bool]].Enable
21a0: 20 75 73 65 20 6f 66 20 53 53 4c 20 76 32 2e 20 use of SSL v2.
21b0: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b The default is [
21c0: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 20 4e 6f const false]. No
21d0: 74 65 3a 20 52 65 63 65 6e 74 20 76 65 72 73 69 te: Recent versi
21e0: 6f 6e 73 20 6f 66 0a 4f 70 65 6e 53 53 4c 20 6e ons of.OpenSSL n
21f0: 6f 20 6c 6f 6e 67 65 72 20 73 75 70 70 6f 72 74 o longer support
2200: 20 53 53 4c 76 32 2c 20 73 6f 20 74 68 69 73 20 SSLv2, so this
2210: 6d 61 79 20 6e 6f 74 20 68 61 76 65 20 61 6e 79 may not have any
2220: 20 65 66 66 65 63 74 2e 20 53 65 65 20 74 68 65 effect. See the
2230: 0a 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f .[cmd tls::proto
2240: 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f cols] command fo
2250: 72 20 73 75 70 70 6f 72 74 65 64 20 70 72 6f 74 r supported prot
2260: 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 ocols...[opt_def
2270: 20 2d 73 73 6c 33 20 5b 61 72 67 20 62 6f 6f 6c -ssl3 [arg bool
2280: 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 ]].Enable use of
2290: 20 53 53 4c 20 76 33 2e 20 54 68 65 20 64 65 66 SSL v3. The def
22a0: 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 ault is [const f
22b0: 61 6c 73 65 5d 2e 20 4e 6f 74 65 3a 20 52 65 63 alse]. Note: Rec
22c0: 65 6e 74 20 76 65 72 73 69 6f 6e 73 0a 6f 66 20 ent versions.of
22d0: 4f 70 65 6e 53 53 4c 20 6d 61 79 20 68 61 76 65 OpenSSL may have
22e0: 20 74 68 69 73 20 64 69 73 61 62 6c 65 64 20 61 this disabled a
22f0: 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 2c 20 t compile time,
2300: 73 6f 20 74 68 69 73 20 6d 61 79 20 6e 6f 74 20 so this may not
2310: 68 61 76 65 20 61 6e 79 0a 65 66 66 65 63 74 2e have any.effect.
2320: 20 53 65 65 20 74 68 65 20 5b 63 6d 64 20 74 6c See the [cmd tl
2330: 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f s::protocols] co
2340: 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70 70 6f 72 mmand for suppor
2350: 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73 2e 0a 0a ted protocols...
2360: 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 20 5b [opt_def -tls1 [
2370: 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c arg bool]].Enabl
2380: 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e e use of TLS v1.
2390: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 The default is
23a0: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 4e 6f [const true]. No
23b0: 74 65 3a 20 54 4c 53 20 31 2e 30 20 6e 65 65 64 te: TLS 1.0 need
23c0: 73 0a 53 48 41 31 20 74 6f 20 6f 70 65 72 61 74 s.SHA1 to operat
23d0: 65 2c 20 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 e, which is only
23e0: 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 73 65 available in se
23f0: 63 75 72 69 74 79 20 6c 65 76 65 6c 20 30 20 66 curity level 0 f
2400: 6f 72 20 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b or Open SSL 3.0+
2410: 2e 0a 53 65 65 20 74 68 65 20 5b 61 72 67 20 2d ..See the [arg -
2420: 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 security_level]
2430: 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 option...[opt_de
2440: 66 20 2d 74 6c 73 31 2e 31 20 5b 61 72 67 20 62 f -tls1.1 [arg b
2450: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 ool]].Enable use
2460: 20 6f 66 20 54 4c 53 20 76 31 2e 31 2e 20 54 68 of TLS v1.1. Th
2470: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f e default is [co
2480: 6e 73 74 20 74 72 75 65 5d 2e 20 4e 6f 74 65 3a nst true]. Note:
2490: 20 54 4c 53 20 31 2e 31 20 6e 65 65 64 73 0a 53 TLS 1.1 needs.S
24a0: 48 41 31 20 74 6f 20 6f 70 65 72 61 74 65 2c 20 HA1 to operate,
24b0: 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 61 76 which is only av
24c0: 61 69 6c 61 62 6c 65 20 69 6e 20 73 65 63 75 72 ailable in secur
24d0: 69 74 79 20 6c 65 76 65 6c 20 30 20 66 6f 72 20 ity level 0 for
24e0: 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 0a 53 Open SSL 3.0+..S
24f0: 65 65 20 74 68 65 20 5b 61 72 67 20 2d 73 65 63 ee the [arg -sec
2500: 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 6f 70 74 urity_level] opt
2510: 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d ion...[opt_def -
2520: 74 6c 73 31 2e 32 20 5b 61 72 67 20 62 6f 6f 6c tls1.2 [arg bool
2530: 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 ]].Enable use of
2540: 20 54 4c 53 20 76 31 2e 32 2e 20 54 68 65 20 64 TLS v1.2. The d
2550: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 efault is [const
2560: 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 true]...[opt_de
2570: 66 20 2d 74 6c 73 31 2e 33 20 5b 61 72 67 20 62 f -tls1.3 [arg b
2580: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 ool]].Enable use
2590: 20 6f 66 20 54 4c 53 20 76 31 2e 33 2e 20 54 68 of TLS v1.3. Th
25a0: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f e default is [co
25b0: 6e 73 74 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74 nst true]...[opt
25c0: 5f 64 65 66 20 2d 76 61 6c 69 64 61 74 65 63 6f _def -validateco
25d0: 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62 mmand [arg callb
25e0: 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 ack]].Specifies
25f0: 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d the callback com
2600: 6d 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20 74 mand to invoke t
2610: 6f 20 76 61 6c 69 64 61 74 65 20 74 68 65 20 70 o validate the p
2620: 65 65 72 20 63 65 72 74 69 66 69 63 61 74 65 73 eer certificates
2630: 0a 61 6e 64 20 6f 74 68 65 72 20 63 6f 6e 66 69 .and other confi
2640: 67 20 69 6e 66 6f 20 64 75 72 69 6e 67 20 74 68 g info during th
2650: 65 20 70 72 6f 74 6f 63 6f 6c 20 6e 65 67 6f 74 e protocol negot
2660: 69 61 74 69 6f 6e 20 70 68 61 73 65 2e 20 54 68 iation phase. Th
2670: 69 73 20 63 61 6e 20 62 65 20 75 73 65 64 0a 62 is can be used.b
2680: 79 20 54 43 4c 20 73 63 72 69 70 74 73 20 74 6f y TCL scripts to
2690: 20 70 65 72 66 6f 72 6d 20 74 68 65 69 72 20 6f perform their o
26a0: 77 6e 20 43 65 72 74 69 66 69 63 61 74 65 20 56 wn Certificate V
26b0: 61 6c 69 64 61 74 69 6f 6e 20 74 6f 20 73 75 70 alidation to sup
26c0: 70 6c 65 6d 65 6e 74 20 74 68 65 0a 64 65 66 61 plement the.defa
26d0: 75 6c 74 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 ult validation p
26e0: 72 6f 76 69 64 65 64 20 62 79 20 4f 70 65 6e 53 rovided by OpenS
26f0: 53 4c 2e 20 54 68 65 20 73 63 72 69 70 74 20 6d SL. The script m
2700: 75 73 74 20 72 65 74 75 72 6e 20 61 20 62 6f 6f ust return a boo
2710: 6c 65 61 6e 20 74 72 75 65 0a 74 6f 20 63 6f 6e lean true.to con
2720: 74 69 6e 75 65 20 74 68 65 20 6e 65 67 6f 74 69 tinue the negoti
2730: 61 74 69 6f 6e 2e 20 53 65 65 20 5b 73 65 63 74 ation. See [sect
2740: 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 ref "Callback Op
2750: 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 tions"] for more
2760: 20 69 6e 66 6f 2e 0a 0a 5b 6c 69 73 74 5f 65 6e info...[list_en
2770: 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 d]..[call [cmd t
2780: 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d 20 5b 61 ls::unimport] [a
2790: 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 43 6f rg channel]]..Co
27a0: 6d 70 6c 69 6d 65 6e 74 20 74 6f 20 5b 63 6d 64 mpliment to [cmd
27b0: 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e 20 55 tls::import]. U
27c0: 73 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 74 68 sed to remove th
27d0: 65 20 74 6f 70 20 6c 65 76 65 6c 20 73 74 61 63 e top level stac
27e0: 6b 65 64 20 63 68 61 6e 6e 65 6c 0a 66 72 6f 6d ked channel.from
27f0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2e 20 [arg channel].
2800: 54 68 69 73 20 75 6e 73 74 61 63 6b 73 20 74 68 This unstacks th
2810: 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f 66 20 e encryption of
2820: 61 20 72 65 67 75 6c 61 72 20 54 43 4c 20 63 68 a regular TCL ch
2830: 61 6e 6e 65 6c 2e 20 41 6e 0a 65 72 72 6f 72 20 annel. An.error
2840: 69 73 20 74 68 72 6f 77 6e 20 69 66 20 54 4c 53 is thrown if TLS
2850: 20 69 73 20 6e 6f 74 20 74 68 65 20 74 6f 70 20 is not the top
2860: 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 20 stacked channel
2870: 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d type...[call [cm
2880: 64 20 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 d tls::handshake
2890: 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d ] [arg channel]]
28a0: 0a 0a 46 6f 72 63 65 73 20 74 68 65 20 54 4c 53 ..Forces the TLS
28b0: 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20 68 61 6e negotiation han
28c0: 64 73 68 61 6b 65 20 74 6f 20 74 61 6b 65 20 70 dshake to take p
28d0: 6c 61 63 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 lace immediately
28e0: 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 30 0a , and returns 0.
28f0: 69 66 20 68 61 6e 64 73 68 61 6b 65 20 69 73 20 if handshake is
2900: 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65 73 still in progres
2910: 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 29 s (non-blocking)
2920: 2c 20 6f 72 20 31 20 69 66 20 74 68 65 20 68 61 , or 1 if the ha
2930: 6e 64 73 68 61 6b 65 20 77 61 73 0a 73 75 63 63 ndshake was.succ
2940: 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65 20 68 essful. If the h
2950: 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65 64 2c andshake failed,
2960: 20 61 6e 20 65 72 72 6f 72 20 77 69 6c 6c 20 62 an error will b
2970: 65 20 72 65 74 75 72 6e 65 64 2e 0a 0a 5b 63 61 e returned...[ca
2980: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 74 61 ll [cmd tls::sta
2990: 74 75 73 5d 20 5b 6f 70 74 20 5b 6f 70 74 69 6f tus] [opt [optio
29a0: 6e 20 2d 6c 6f 63 61 6c 5d 5d 20 5b 61 72 67 20 n -local]] [arg
29b0: 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72 channel]]..Retur
29c0: 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 73 ns the current s
29d0: 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20 tatus of an SSL
29e0: 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73 channel. The res
29f0: 75 6c 74 20 69 73 20 61 20 6c 69 73 74 20 6f 66 ult is a list of
2a00: 20 6b 65 79 2d 76 61 6c 75 65 0a 70 61 69 72 73 key-value.pairs
2a10: 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 describing the
2a20: 53 53 4c 2c 20 63 65 72 74 69 66 69 63 61 74 65 SSL, certificate
2a30: 2c 20 61 6e 64 20 63 65 72 74 69 66 69 63 61 74 , and certificat
2a40: 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 73 e verification s
2a50: 74 61 74 75 73 2e 20 49 66 0a 74 68 65 20 53 53 tatus. If.the SS
2a60: 4c 20 68 61 6e 64 73 68 61 6b 65 20 68 61 73 20 L handshake has
2a70: 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65 74 65 not yet complete
2a80: 64 2c 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 74 d, an empty list
2a90: 20 69 73 20 72 65 74 75 72 6e 65 64 2e 20 49 66 is returned. If
2aa0: 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6c 6f the.[option -lo
2ab0: 63 61 6c 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73 cal] option is s
2ac0: 70 65 63 69 66 69 65 64 2c 20 74 68 65 6e 20 74 pecified, then t
2ad0: 68 65 20 6c 6f 63 61 6c 20 63 65 72 74 69 66 69 he local certifi
2ae0: 63 61 74 65 20 69 73 20 75 73 65 64 2e 20 52 65 cate is used. Re
2af0: 74 75 72 6e 65 64 0a 76 61 6c 75 65 73 20 69 6e turned.values in
2b00: 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a clude:..[para]..
2b10: 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 SSL Status..[lis
2b20: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 t_begin definiti
2b30: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 ons]..[def "[var
2b40: 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70 72 6f 74 alpn] [arg prot
2b50: 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70 72 6f 74 ocol]"].The prot
2b60: 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20 61 66 ocol selected af
2b70: 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d ter Application-
2b80: 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e Layer Protocol N
2b90: 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e egotiation (ALPN
2ba0: 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 )...[def "[var c
2bb0: 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69 70 68 ipher] [arg ciph
2bc0: 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72 65 6e er]"].The curren
2bd0: 74 20 63 69 70 68 65 72 20 69 6e 20 75 73 65 20 t cipher in use
2be0: 66 6f 72 20 74 68 65 20 73 65 73 73 69 6f 6e 2e for the session.
2bf0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 65 65 ..[def "[var pee
2c00: 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 rname] [arg name
2c10: 5d 22 5d 0a 54 68 65 20 70 65 65 72 6e 61 6d 65 ]"].The peername
2c20: 20 66 72 6f 6d 20 74 68 65 20 63 65 72 74 69 66 from the certif
2c30: 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 icate...[def "[v
2c40: 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72 ar protocol] [ar
2c50: 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 g version]"].The
2c60: 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f protocol versio
2c70: 6e 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 n used for the c
2c80: 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c onnection: SSL2,
2c90: 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53 SSL3, TLS1, TLS
2ca0: 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53 1.1, TLS1.2, TLS
2cb0: 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 1.3, or unknown.
2cc0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 62 69 ..[def "[var sbi
2cd0: 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 ts] [arg n]"].Th
2ce0: 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 69 74 73 e number of bits
2cf0: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 73 65 used for the se
2d00: 73 73 69 6f 6e 20 6b 65 79 2e 0a 0a 5b 64 65 66 ssion key...[def
2d10: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65 "[var signature
2d20: 48 61 73 68 41 6c 67 6f 72 69 74 68 6d 5d 20 5b HashAlgorithm] [
2d30: 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d arg algorithm]"]
2d40: 0a 54 68 65 20 73 69 67 6e 61 74 75 72 65 20 68 .The signature h
2d50: 61 73 68 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 0a ash algorithm...
2d60: 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 [def "[var signa
2d70: 74 75 72 65 54 79 70 65 5d 20 5b 61 72 67 20 74 tureType] [arg t
2d80: 79 70 65 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61 ype]"].The signa
2d90: 74 75 72 65 20 74 79 70 65 20 76 61 6c 75 65 2e ture type value.
2da0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72 ..[def "[var ver
2db0: 69 66 79 44 65 70 74 68 5d 20 5b 61 72 67 20 6e ifyDepth] [arg n
2dc0: 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20 64 65 70 74 ]"].Maximum dept
2dd0: 68 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 66 h for the certif
2de0: 69 63 61 74 65 20 63 68 61 69 6e 20 76 65 72 69 icate chain veri
2df0: 66 69 63 61 74 69 6f 6e 2e 20 44 65 66 61 75 6c fication. Defaul
2e00: 74 20 69 73 20 2d 31 2c 20 74 6f 20 63 68 65 63 t is -1, to chec
2e10: 6b 20 61 6c 6c 2e 0a 0a 5b 64 65 66 20 22 5b 76 k all...[def "[v
2e20: 61 72 20 76 65 72 69 66 79 4d 6f 64 65 5d 20 5b ar verifyMode] [
2e30: 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 arg list]"].List
2e40: 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 20 of certificate
2e50: 76 65 72 69 66 69 63 61 74 69 6f 6e 20 6d 6f 64 verification mod
2e60: 65 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 es...[def "[var
2e70: 76 65 72 69 66 79 52 65 73 75 6c 74 5d 20 5b 61 verifyResult] [a
2e80: 72 67 20 72 65 73 75 6c 74 5d 22 5d 0a 43 65 72 rg result]"].Cer
2e90: 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63 tificate verific
2ea0: 61 74 69 6f 6e 20 72 65 73 75 6c 74 2e 0a 0a 5b ation result...[
2eb0: 64 65 66 20 22 5b 76 61 72 20 63 61 5f 6e 61 6d def "[var ca_nam
2ec0: 65 73 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d es] [arg list]"]
2ed0: 0a 4c 69 73 74 20 6f 66 20 74 68 65 20 43 65 72 .List of the Cer
2ee0: 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 tificate Authori
2ef0: 74 69 65 73 20 75 73 65 64 20 74 6f 20 63 72 65 ties used to cre
2f00: 61 74 65 20 74 68 65 20 63 65 72 74 69 66 69 63 ate the certific
2f10: 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d ate...[list_end]
2f20: 0a 0a 43 65 72 74 69 66 69 63 61 74 65 20 53 74 ..Certificate St
2f30: 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 atus..[list_begi
2f40: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a n definitions]..
2f50: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 6c 5d 20 [def "[var all]
2f60: 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 44 [arg string]"].D
2f70: 75 6d 70 20 6f 66 20 61 6c 6c 20 63 65 72 74 69 ump of all certi
2f80: 66 69 63 61 74 65 20 69 6e 66 6f 2e 0a 0a 5b 64 ficate info...[d
2f90: 65 66 20 22 5b 76 61 72 20 76 65 72 73 69 6f 6e ef "[var version
2fa0: 5d 20 5b 61 72 67 20 76 61 6c 75 65 5d 22 5d 0a ] [arg value]"].
2fb0: 54 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 The certificate
2fc0: 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 version...[def "
2fd0: 5b 76 61 72 20 73 65 72 69 61 6c 4e 75 6d 62 65 [var serialNumbe
2fe0: 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 r] [arg string]"
2ff0: 5d 0a 54 68 65 20 73 65 72 69 61 6c 20 6e 75 6d ].The serial num
3000: 62 65 72 20 6f 66 20 74 68 65 20 63 65 72 74 69 ber of the certi
3010: 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78 20 ficate as a hex
3020: 73 74 72 69 6e 67 2e 0a 0a 5b 64 65 66 20 22 5b string...[def "[
3030: 76 61 72 20 73 69 67 6e 61 74 75 72 65 5d 20 5b var signature] [
3040: 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d arg algorithm]"]
3050: 0a 43 69 70 68 65 72 20 61 6c 67 6f 72 69 74 68 .Cipher algorith
3060: 6d 20 75 73 65 64 20 66 6f 72 20 63 65 72 74 69 m used for certi
3070: 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 ficate signature
3080: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73 ...[def "[var is
3090: 73 75 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e suer] [arg strin
30a0: 67 5d 22 5d 0a 54 68 65 20 64 69 73 74 69 6e 67 g]"].The disting
30b0: 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 uished name (DN)
30c0: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 of the certific
30d0: 61 74 65 20 69 73 73 75 65 72 2e 0a 0a 5b 64 65 ate issuer...[de
30e0: 66 20 22 5b 76 61 72 20 6e 6f 74 42 65 66 6f 72 f "[var notBefor
30f0: 65 5d 20 5b 61 72 67 20 64 61 74 65 5d 22 5d 0a e] [arg date]"].
3100: 54 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 64 61 The beginning da
3110: 74 65 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 te of the certif
3120: 69 63 61 74 65 20 76 61 6c 69 64 69 74 79 2e 0a icate validity..
3130: 0a 5b 64 65 66 20 22 5b 76 61 72 20 6e 6f 74 41 .[def "[var notA
3140: 66 74 65 72 5d 20 5b 61 72 67 20 64 61 74 65 5d fter] [arg date]
3150: 22 5d 0a 54 68 65 20 65 78 70 69 72 61 74 69 6f "].The expiratio
3160: 6e 20 64 61 74 65 20 6f 66 20 74 68 65 20 63 65 n date of the ce
3170: 72 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 69 rtificate validi
3180: 74 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 ty...[def "[var
3190: 73 75 62 6a 65 63 74 5d 20 5b 61 72 67 20 73 74 subject] [arg st
31a0: 72 69 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73 74 ring]"].The dist
31b0: 69 6e 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28 inguished name (
31c0: 44 4e 29 20 6f 66 20 74 68 65 20 63 65 72 74 69 DN) of the certi
31d0: 66 69 63 61 74 65 20 73 75 62 6a 65 63 74 2e 20 ficate subject.
31e0: 46 69 65 6c 64 73 20 69 6e 63 6c 75 64 65 3a 20 Fields include:
31f0: 43 6f 6d 6d 6f 6e 0a 4e 61 6d 65 20 28 43 4e 29 Common.Name (CN)
3200: 2c 20 4f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 28 , Organization (
3210: 4f 29 2c 20 4c 6f 63 61 6c 69 74 79 20 6f 72 20 O), Locality or
3220: 43 69 74 79 20 28 4c 29 2c 20 53 74 61 74 65 20 City (L), State
3230: 6f 72 20 50 72 6f 76 69 6e 63 65 20 28 53 29 2c or Province (S),
3240: 20 61 6e 64 0a 43 6f 75 6e 74 72 79 20 4e 61 6d and.Country Nam
3250: 65 20 28 43 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 e (C)...[def "[v
3260: 61 72 20 69 73 73 75 65 72 55 6e 69 71 75 65 49 ar issuerUniqueI
3270: 44 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 D] [arg string]"
3280: 5d 0a 54 68 65 20 69 73 73 75 65 72 20 75 6e 69 ].The issuer uni
3290: 71 75 65 20 69 64 2e 0a 0a 5b 64 65 66 20 22 5b que id...[def "[
32a0: 76 61 72 20 73 75 62 6a 65 63 74 55 6e 69 71 75 var subjectUniqu
32b0: 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 eID] [arg string
32c0: 5d 22 5d 0a 54 68 65 20 73 75 62 6a 65 63 74 20 ]"].The subject
32d0: 75 6e 69 71 75 65 20 69 64 2e 0a 0a 5b 64 65 66 unique id...[def
32e0: 20 22 5b 76 61 72 20 6e 75 6d 5f 65 78 74 65 6e "[var num_exten
32f0: 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6e 5d 22 5d sions] [arg n]"]
3300: 0a 4e 75 6d 62 65 72 20 6f 66 20 63 65 72 74 69 .Number of certi
3310: 66 69 63 61 74 65 20 65 78 74 65 6e 73 69 6f 6e ficate extension
3320: 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65 s...[def "[var e
3330: 78 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20 xtensions] [arg
3340: 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 list]"].List of
3350: 63 65 72 74 69 66 69 63 61 74 65 20 65 78 74 65 certificate exte
3360: 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e 0a 0a 5b 64 nsion names...[d
3370: 65 66 20 22 5b 76 61 72 20 61 75 74 68 6f 72 69 ef "[var authori
3380: 74 79 4b 65 79 49 64 65 6e 74 69 66 69 65 72 5d tyKeyIdentifier]
3390: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a [arg string]"].
33a0: 41 75 74 68 6f 72 69 74 79 20 4b 65 79 20 49 64 Authority Key Id
33b0: 65 6e 74 69 66 69 65 72 20 28 41 4b 49 29 20 6f entifier (AKI) o
33c0: 66 20 74 68 65 20 49 73 73 75 69 6e 67 20 43 41 f the Issuing CA
33d0: 20 63 65 72 74 69 66 69 63 61 74 65 20 74 68 61 certificate tha
33e0: 74 20 73 69 67 6e 65 64 20 74 68 65 0a 53 53 4c t signed the.SSL
33f0: 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73 20 certificate as
3400: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 20 54 68 a hex string. Th
3410: 69 73 20 76 61 6c 75 65 20 6d 61 74 63 68 65 73 is value matches
3420: 20 74 68 65 20 53 4b 49 20 76 61 6c 75 65 20 6f the SKI value o
3430: 66 20 74 68 65 0a 49 6e 74 65 72 6d 65 64 69 61 f the.Intermedia
3440: 74 65 20 43 41 20 63 65 72 74 69 66 69 63 61 74 te CA certificat
3450: 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 e...[def "[var s
3460: 75 62 6a 65 63 74 4b 65 79 49 64 65 6e 74 69 66 ubjectKeyIdentif
3470: 69 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 ier] [arg string
3480: 5d 22 5d 0a 53 75 62 6a 65 63 74 20 4b 65 79 20 ]"].Subject Key
3490: 49 64 65 6e 74 69 66 69 65 72 20 28 53 4b 49 29 Identifier (SKI)
34a0: 20 68 61 73 68 20 6f 66 20 74 68 65 20 70 75 62 hash of the pub
34b0: 6c 69 63 20 6b 65 79 20 69 6e 73 69 64 65 20 74 lic key inside t
34c0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61 he certificate a
34d0: 73 20 61 0a 68 65 78 20 73 74 72 69 6e 67 2e 20 s a.hex string.
34e0: 55 73 65 64 20 74 6f 20 69 64 65 6e 74 69 66 79 Used to identify
34f0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 68 certificates th
3500: 61 74 20 63 6f 6e 74 61 69 6e 20 61 20 70 61 72 at contain a par
3510: 74 69 63 75 6c 61 72 20 70 75 62 6c 69 63 20 6b ticular public k
3520: 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 ey...[def "[var
3530: 73 75 62 6a 65 63 74 41 6c 74 4e 61 6d 65 5d 20 subjectAltName]
3540: 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 [arg list]"].Lis
3550: 74 20 6f 66 20 61 6c 6c 20 6f 66 20 74 68 65 20 t of all of the
3560: 53 75 62 6a 65 63 74 20 41 6c 74 65 72 6e 61 74 Subject Alternat
3570: 69 76 65 20 4e 61 6d 65 73 20 28 53 41 4e 29 20 ive Names (SAN)
3580: 69 6e 63 6c 75 64 69 6e 67 20 64 6f 6d 61 69 6e including domain
3590: 20 6e 61 6d 65 73 2c 20 73 75 62 0a 64 6f 6d 61 names, sub.doma
35a0: 69 6e 73 2c 20 61 6e 64 20 49 50 20 61 64 64 72 ins, and IP addr
35b0: 65 73 73 65 73 20 74 68 61 74 20 61 72 65 20 73 esses that are s
35c0: 65 63 75 72 65 64 20 62 79 20 74 68 65 20 63 65 ecured by the ce
35d0: 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65 66 rtificate...[def
35e0: 20 22 5b 76 61 72 20 6f 63 73 70 5d 20 5b 61 72 "[var ocsp] [ar
35f0: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f g list]"].List o
3600: 66 20 61 6c 6c 20 4f 6e 6c 69 6e 65 20 43 65 72 f all Online Cer
3610: 74 69 66 69 63 61 74 65 20 53 74 61 74 75 73 20 tificate Status
3620: 50 72 6f 74 6f 63 6f 6c 20 28 4f 43 53 50 29 20 Protocol (OCSP)
3630: 55 52 4c 73 20 74 68 61 74 20 63 61 6e 20 62 65 URLs that can be
3640: 20 75 73 65 64 20 74 6f 0a 63 68 65 63 6b 20 74 used to.check t
3650: 68 65 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74 he validity of t
3660: 68 69 73 20 63 65 72 74 69 66 69 63 61 74 65 2e his certificate.
3670: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 65 72 ..[def "[var cer
3680: 74 69 66 69 63 61 74 65 5d 20 5b 61 72 67 20 63 tificate] [arg c
3690: 65 72 74 5d 22 5d 0a 54 68 65 20 50 45 4d 20 65 ert]"].The PEM e
36a0: 6e 63 6f 64 65 64 20 63 65 72 74 69 66 69 63 61 ncoded certifica
36b0: 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 te...[def "[var
36c0: 73 69 67 6e 61 74 75 72 65 41 6c 67 6f 72 69 74 signatureAlgorit
36d0: 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 hm] [arg algorit
36e0: 68 6d 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c 67 hm]"].Cipher alg
36f0: 6f 72 69 74 68 6d 20 75 73 65 64 20 66 6f 72 20 orithm used for
3700: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 the certificate
3710: 73 69 67 6e 61 74 75 72 65 2e 0a 0a 5b 64 65 66 signature...[def
3720: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65 "[var signature
3730: 56 61 6c 75 65 5d 20 5b 61 72 67 20 73 74 72 69 Value] [arg stri
3740: 6e 67 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74 ng]"].Certificat
3750: 65 20 73 69 67 6e 61 74 75 72 65 20 61 73 20 61 e signature as a
3760: 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 hex string...[d
3770: 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 ef "[var signatu
3780: 72 65 44 69 67 65 73 74 5d 20 5b 61 72 67 20 76 reDigest] [arg v
3790: 65 72 73 69 6f 6e 5d 22 5d 0a 43 65 72 74 69 66 ersion]"].Certif
37a0: 69 63 61 74 65 20 73 69 67 6e 69 6e 67 20 64 69 icate signing di
37b0: 67 65 73 74 20 61 73 20 61 20 68 65 78 20 73 74 gest as a hex st
37c0: 72 69 6e 67 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 ring...[def "[va
37d0: 72 20 70 75 62 6c 69 63 4b 65 79 41 6c 67 6f 72 r publicKeyAlgor
37e0: 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 ithm] [arg algor
37f0: 69 74 68 6d 5d 22 5d 0a 43 65 72 74 69 66 69 63 ithm]"].Certific
3800: 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 70 75 ate signature pu
3810: 62 6c 69 63 20 6b 65 79 20 61 6c 67 6f 72 69 74 blic key algorit
3820: 68 6d 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 hm...[def "[var
3830: 70 75 62 6c 69 63 4b 65 79 5d 20 5b 61 72 67 20 publicKey] [arg
3840: 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66 string]"].Certif
3850: 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 icate signature
3860: 70 75 62 6c 69 63 20 6b 65 79 20 61 73 20 61 20 public key as a
3870: 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65 hex string...[de
3880: 66 20 22 5b 76 61 72 20 62 69 74 73 5d 20 5b 61 f "[var bits] [a
3890: 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65 72 20 6f rg n]"].Number o
38a0: 66 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 f bits used for
38b0: 63 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e certificate sign
38c0: 61 74 75 72 65 20 6b 65 79 2e 0a 0a 5b 64 65 66 ature key...[def
38d0: 20 22 5b 76 61 72 20 73 65 6c 66 5f 73 69 67 6e "[var self_sign
38e0: 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e ed] [arg boolean
38f0: 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 ]"].Whether the
3900: 63 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e certificate sign
3910: 61 74 75 72 65 20 69 73 20 73 65 6c 66 20 73 69 ature is self si
3920: 67 6e 65 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 gned...[def "[va
3930: 72 20 73 68 61 31 5f 68 61 73 68 5d 20 5b 61 72 r sha1_hash] [ar
3940: 67 20 68 61 73 68 5d 22 5d 0a 54 68 65 20 53 48 g hash]"].The SH
3950: 41 31 20 68 61 73 68 20 6f 66 20 74 68 65 20 63 A1 hash of the c
3960: 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61 20 ertificate as a
3970: 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65 hex string...[de
3980: 66 20 22 5b 76 61 72 20 73 68 61 32 35 36 5f 68 f "[var sha256_h
3990: 61 73 68 5d 20 5b 61 72 67 20 68 61 73 68 5d 22 ash] [arg hash]"
39a0: 5d 0a 54 68 65 20 53 48 41 32 35 36 20 68 61 73 ].The SHA256 has
39b0: 68 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 h of the certifi
39c0: 63 61 74 65 20 61 73 20 61 20 68 65 78 20 73 74 cate as a hex st
39d0: 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 ring...[list_end
39e0: 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c ]..[call [cmd tl
39f0: 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5d 20 5b s::connection] [
3a00: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 arg channel]]..R
3a10: 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65 eturns the curre
3a20: 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 nt connection st
3a30: 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20 63 atus of an SSL c
3a40: 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73 75 hannel. The resu
3a50: 6c 74 20 69 73 20 61 20 6c 69 73 74 0a 6f 66 20 lt is a list.of
3a60: 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73 20 key-value pairs
3a70: 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 63 describing the c
3a80: 6f 6e 6e 65 63 74 69 6f 6e 2e 20 52 65 74 75 72 onnection. Retur
3a90: 6e 65 64 20 76 61 6c 75 65 73 20 69 6e 63 6c 75 ned values inclu
3aa0: 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a 53 53 4c de:..[para]..SSL
3ab0: 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 Status..[list_b
3ac0: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 egin definitions
3ad0: 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74 ]..[def "[var st
3ae0: 61 74 65 5d 20 5b 61 72 67 20 73 74 61 74 65 5d ate] [arg state]
3af0: 22 5d 0a 53 74 61 74 65 20 6f 66 20 74 68 65 20 "].State of the
3b00: 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65 connection...[de
3b10: 66 20 22 5b 76 61 72 20 73 65 72 76 65 72 6e 61 f "[var serverna
3b20: 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d me] [arg name]"]
3b30: 0a 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 .The name of the
3b40: 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 73 65 connected to se
3b50: 72 76 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 rver...[def "[va
3b60: 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72 67 r protocol] [arg
3b70: 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 version]"].The
3b80: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e protocol version
3b90: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 6f used for the co
3ba0: 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c 20 nnection: SSL2,
3bb0: 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53 31 SSL3, TLS1, TLS1
3bc0: 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53 31 .1, TLS1.2, TLS1
3bd0: 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 0a .3, or unknown..
3be0: 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 6e 65 .[def "[var rene
3bf0: 67 6f 74 69 61 74 69 6f 6e 5f 61 6c 6c 6f 77 65 gotiation_allowe
3c00: 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d d] [arg boolean]
3c10: 22 5d 0a 57 68 65 74 68 65 72 20 70 72 6f 74 6f "].Whether proto
3c20: 63 6f 6c 20 72 65 6e 65 67 6f 74 69 61 74 69 6f col renegotiatio
3c30: 6e 20 69 73 20 73 75 70 70 6f 72 74 65 64 20 6f n is supported o
3c40: 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 r not...[def "[v
3c50: 61 72 20 73 65 63 75 72 69 74 79 5f 6c 65 76 65 ar security_leve
3c60: 6c 5d 20 5b 61 72 67 20 6c 65 76 65 6c 5d 22 5d l] [arg level]"]
3c70: 0a 54 68 65 20 73 65 63 75 72 69 74 79 20 6c 65 .The security le
3c80: 76 65 6c 20 75 73 65 64 20 66 6f 72 20 73 65 6c vel used for sel
3c90: 65 63 74 69 6f 6e 20 6f 66 20 63 69 70 68 65 72 ection of cipher
3ca0: 73 2c 20 6b 65 79 20 73 69 7a 65 2c 20 65 74 63 s, key size, etc
3cb0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 ...[def "[var se
3cc0: 73 73 69 6f 6e 5f 72 65 75 73 65 64 5d 20 5b 61 ssion_reused] [a
3cd0: 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 rg boolean]"].Wh
3ce0: 65 74 68 65 72 20 74 68 65 20 73 65 73 73 69 6f ether the sessio
3cf0: 6e 20 68 61 73 20 62 65 65 6e 20 72 65 75 73 65 n has been reuse
3d00: 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 d or not...[def
3d10: 22 5b 76 61 72 20 69 73 5f 73 65 72 76 65 72 5d "[var is_server]
3d20: 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d [arg boolean]"]
3d30: 0a 57 68 65 74 68 65 72 20 74 68 65 20 63 6f 6e .Whether the con
3d40: 6e 65 63 74 69 6f 6e 20 69 73 20 63 6f 6e 66 69 nection is confi
3d50: 67 75 72 65 64 20 61 73 20 61 20 73 65 72 76 65 gured as a serve
3d60: 72 20 28 31 29 20 6f 72 20 63 6c 69 65 6e 74 20 r (1) or client
3d70: 28 30 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 (0)...[def "[var
3d80: 20 63 6f 6d 70 72 65 73 73 69 6f 6e 5d 20 5b 61 compression] [a
3d90: 72 67 20 6d 6f 64 65 5d 22 5d 0a 43 6f 6d 70 72 rg mode]"].Compr
3da0: 65 73 73 69 6f 6e 20 6d 65 74 68 6f 64 2e 0a 0a ession method...
3db0: 5b 64 65 66 20 22 5b 76 61 72 20 65 78 70 61 6e [def "[var expan
3dc0: 73 69 6f 6e 5d 20 5b 61 72 67 20 6d 6f 64 65 5d sion] [arg mode]
3dd0: 22 5d 0a 45 78 70 61 6e 73 69 6f 6e 20 6d 65 74 "].Expansion met
3de0: 68 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 hod...[def "[var
3df0: 20 63 61 4c 69 73 74 5d 20 5b 61 72 67 20 6c 69 caList] [arg li
3e00: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 43 65 st]"].List of Ce
3e10: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 rtificate Author
3e20: 69 74 69 65 73 20 28 43 41 29 20 66 6f 72 20 58 ities (CA) for X
3e30: 2e 35 30 39 20 63 65 72 74 69 66 69 63 61 74 65 .509 certificate
3e40: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43 ...[list_end]..C
3e50: 69 70 68 65 72 20 49 6e 66 6f 0a 0a 5b 6c 69 73 ipher Info..[lis
3e60: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 t_begin definiti
3e70: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 ons]..[def "[var
3e80: 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69 cipher] [arg ci
3e90: 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72 pher]"].The curr
3ea0: 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75 73 ent cipher in us
3eb0: 65 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 e for the connec
3ec0: 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 tion...[def "[va
3ed0: 72 20 73 74 61 6e 64 61 72 64 5f 6e 61 6d 65 5d r standard_name]
3ee0: 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 [arg name]"].Th
3ef0: 65 20 73 74 61 6e 64 61 72 64 20 52 46 43 20 6e e standard RFC n
3f00: 61 6d 65 20 6f 66 20 63 69 70 68 65 72 2e 0a 0a ame of cipher...
3f10: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 67 6f 72 [def "[var algor
3f20: 69 74 68 6d 5f 62 69 74 73 5d 20 5b 61 72 67 20 ithm_bits] [arg
3f30: 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20 n]"].The number
3f40: 6f 66 20 70 72 6f 63 65 73 73 65 64 20 62 69 74 of processed bit
3f50: 73 20 75 73 65 64 20 66 6f 72 20 63 69 70 68 65 s used for ciphe
3f60: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 r...[def "[var s
3f70: 65 63 72 65 74 5f 62 69 74 73 5d 20 5b 61 72 67 ecret_bits] [arg
3f80: 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72 n]"].The number
3f90: 20 6f 66 20 73 65 63 72 65 74 20 62 69 74 73 20 of secret bits
3fa0: 75 73 65 64 20 66 6f 72 20 63 69 70 68 65 72 2e used for cipher.
3fb0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6d 69 6e ..[def "[var min
3fc0: 5f 76 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20 76 _version] [arg v
3fd0: 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 6d 69 ersion]"].The mi
3fe0: 6e 69 6d 75 6d 20 70 72 6f 74 6f 63 6f 6c 20 76 nimum protocol v
3ff0: 65 72 73 69 6f 6e 20 66 6f 72 20 63 69 70 68 65 ersion for ciphe
4000: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 r...[def "[var c
4010: 69 70 68 65 72 5f 69 73 5f 61 65 61 64 5d 20 5b ipher_is_aead] [
4020: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 arg boolean]"].W
4030: 68 65 74 68 65 72 20 74 68 65 20 63 69 70 68 65 hether the ciphe
4040: 72 20 69 73 20 41 75 74 68 65 6e 74 69 63 61 74 r is Authenticat
4050: 65 64 20 45 6e 63 72 79 70 74 69 6f 6e 20 77 69 ed Encryption wi
4060: 74 68 20 41 73 73 6f 63 69 61 74 65 64 20 44 61 th Associated Da
4070: 74 61 20 28 41 45 41 44 29 2e 0a 0a 5b 64 65 66 ta (AEAD)...[def
4080: 20 22 5b 76 61 72 20 63 69 70 68 65 72 5f 69 64 "[var cipher_id
4090: 5d 20 5b 61 72 67 20 69 64 5d 22 5d 0a 54 68 65 ] [arg id]"].The
40a0: 20 4f 70 65 6e 53 53 4c 20 63 69 70 68 65 72 20 OpenSSL cipher
40b0: 69 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 id...[def "[var
40c0: 64 65 73 63 72 69 70 74 69 6f 6e 5d 20 5b 61 72 description] [ar
40d0: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 41 20 74 65 g string]"].A te
40e0: 78 74 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f xt description o
40f0: 66 20 74 68 65 20 63 69 70 68 65 72 2e 0a 0a 5b f the cipher...[
4100: 64 65 66 20 22 5b 76 61 72 20 68 61 6e 64 73 68 def "[var handsh
4110: 61 6b 65 5f 64 69 67 65 73 74 5d 20 5b 61 72 67 ake_digest] [arg
4120: 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 44 69 67 65 boolean]"].Dige
4130: 73 74 20 75 73 65 64 20 64 75 72 69 6e 67 20 68 st used during h
4140: 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b 6c 69 73 74 andshake...[list
4150: 5f 65 6e 64 5d 0a 0a 53 65 73 73 69 6f 6e 20 49 _end]..Session I
4160: 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e nfo..[list_begin
4170: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b definitions]..[
4180: 64 65 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20 def "[var alpn]
4190: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d [arg protocol]"]
41a0: 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65 .The protocol se
41b0: 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70 70 lected after App
41c0: 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50 lication-Layer P
41d0: 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 rotocol Negotiat
41e0: 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a 0a 5b 64 65 ion (ALPN)...[de
41f0: 66 20 22 5b 76 61 72 20 72 65 73 75 6d 61 62 6c f "[var resumabl
4200: 65 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d e] [arg boolean]
4210: 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 73 "].Whether the s
4220: 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 72 65 ession can be re
4230: 73 75 6d 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b sumed or not...[
4240: 64 65 66 20 22 5b 76 61 72 20 73 74 61 72 74 5f def "[var start_
4250: 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63 6f 6e time] [arg secon
4260: 64 73 5d 22 5d 0a 54 69 6d 65 20 73 69 6e 63 65 ds]"].Time since
4270: 20 73 65 73 73 69 6f 6e 20 73 74 61 72 74 65 64 session started
4280: 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e 63 in seconds sinc
4290: 65 20 65 70 6f 63 68 2e 0a 0a 5b 64 65 66 20 22 e epoch...[def "
42a0: 5b 76 61 72 20 74 69 6d 65 6f 75 74 5d 20 5b 61 [var timeout] [a
42b0: 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 4d 61 rg seconds]"].Ma
42c0: 78 20 64 75 72 61 74 69 6f 6e 20 6f 66 20 73 65 x duration of se
42d0: 73 73 69 6f 6e 20 69 6e 20 73 65 63 6f 6e 64 73 ssion in seconds
42e0: 20 62 65 66 6f 72 65 20 74 69 6d 65 2d 6f 75 74 before time-out
42f0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6c 69 ...[def "[var li
4300: 66 65 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63 fetime] [arg sec
4310: 6f 6e 64 73 5d 22 5d 0a 53 65 73 73 69 6f 6e 20 onds]"].Session
4320: 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 20 ticket lifetime
4330: 68 69 6e 74 20 69 6e 20 73 65 63 6f 6e 64 73 2e hint in seconds.
4340: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 ..[def "[var ses
4350: 73 69 6f 6e 5f 69 64 5d 20 5b 61 72 67 20 62 69 sion_id] [arg bi
4360: 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 nary_string]"].U
4370: 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20 69 64 nique session id
4380: 20 66 6f 72 20 75 73 65 20 69 6e 20 72 65 73 75 for use in resu
4390: 6d 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e ming the session
43a0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 ...[def "[var se
43b0: 73 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 20 5b 61 ssion_ticket] [a
43c0: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 rg binary_string
43d0: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 ]"].Unique sessi
43e0: 6f 6e 20 74 69 63 6b 65 74 20 66 6f 72 20 75 73 on ticket for us
43f0: 65 20 69 6e 20 72 65 73 75 6d 69 6e 67 20 74 68 e in resuming th
4400: 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 e session...[def
4410: 20 22 5b 76 61 72 20 74 69 63 6b 65 74 5f 61 70 "[var ticket_ap
4420: 70 5f 64 61 74 61 5d 20 5b 61 72 67 20 62 69 6e p_data] [arg bin
4430: 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e ary_string]"].Un
4440: 69 71 75 65 20 73 65 73 73 69 6f 6e 20 74 69 63 ique session tic
4450: 6b 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 ket application
4460: 64 61 74 61 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 data...[def "[va
4470: 72 20 6d 61 73 74 65 72 5f 6b 65 79 5d 20 5b 61 r master_key] [a
4480: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 rg binary_string
4490: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 ]"].Unique sessi
44a0: 6f 6e 20 6d 61 73 74 65 72 20 6b 65 79 2e 0a 0a on master key...
44b0: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 73 69 [def "[var sessi
44c0: 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64 65 5d 20 5b on_cache_mode] [
44d0: 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 53 65 72 76 arg mode]"].Serv
44e0: 65 72 20 63 61 63 68 65 20 6d 6f 64 65 20 28 63 er cache mode (c
44f0: 6c 69 65 6e 74 2c 20 73 65 72 76 65 72 2c 20 6f lient, server, o
4500: 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c 69 73 74 5f r both)...[list_
4510: 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 end]..[call [cmd
4520: 20 74 6c 73 3a 3a 63 69 70 68 65 72 73 5d 20 5b tls::ciphers] [
4530: 6f 70 74 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f opt [arg protoco
4540: 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 65 l]] [opt [arg ve
4550: 72 62 6f 73 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 rbose]] [opt [ar
4560: 67 20 73 75 70 70 6f 72 74 65 64 5d 5d 5d 0a 0a g supported]]]..
4570: 57 69 74 68 6f 75 74 20 61 6e 79 20 61 72 67 73 Without any args
4580: 2c 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 , returns a list
4590: 20 6f 66 20 61 6c 6c 20 73 79 6d 6d 65 74 72 69 of all symmetri
45a0: 63 20 63 69 70 68 65 72 73 20 66 6f 72 20 75 73 c ciphers for us
45b0: 65 20 77 69 74 68 20 74 68 65 0a 5b 61 72 67 20 e with the.[arg
45c0: 2d 63 69 70 68 65 72 5d 20 6f 70 74 69 6f 6e 2e -cipher] option.
45d0: 20 57 69 74 68 20 5b 61 72 67 20 70 72 6f 74 6f With [arg proto
45e0: 63 6f 6c 5d 2c 20 6f 6e 6c 79 20 74 68 65 20 63 col], only the c
45f0: 69 70 68 65 72 73 20 73 75 70 70 6f 72 74 65 64 iphers supported
4600: 20 66 6f 72 20 74 68 61 74 0a 70 72 6f 74 6f 63 for that.protoc
4610: 6f 6c 20 61 72 65 20 72 65 74 75 72 6e 65 64 2e ol are returned.
4620: 20 53 65 65 20 74 68 65 20 5b 63 6d 64 20 74 6c See the [cmd tl
4630: 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f s::protocols] co
4640: 6d 6d 61 6e 64 20 66 6f 72 20 74 68 65 20 73 75 mmand for the su
4650: 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f 6c pported.protocol
4660: 73 2e 20 49 66 20 5b 61 72 67 20 76 65 72 62 6f s. If [arg verbo
4670: 73 65 5d 20 69 73 20 73 70 65 63 69 66 69 65 64 se] is specified
4680: 20 61 73 20 74 72 75 65 20 74 68 65 6e 20 61 20 as true then a
4690: 76 65 72 62 6f 73 65 2c 20 68 75 6d 61 6e 20 72 verbose, human r
46a0: 65 61 64 61 62 6c 65 0a 6c 69 73 74 20 69 73 20 eadable.list is
46b0: 72 65 74 75 72 6e 65 64 20 77 69 74 68 20 61 64 returned with ad
46c0: 64 69 74 69 6f 6e 61 6c 20 69 6e 66 6f 72 6d 61 ditional informa
46d0: 74 69 6f 6e 20 6f 6e 20 74 68 65 20 63 69 70 68 tion on the ciph
46e0: 65 72 2e 20 49 66 20 5b 61 72 67 20 73 75 70 70 er. If [arg supp
46f0: 6f 72 74 65 64 5d 0a 69 73 20 73 70 65 63 69 66 orted].is specif
4700: 69 65 64 20 61 73 20 74 72 75 65 2c 20 74 68 65 ied as true, the
4710: 6e 20 6f 6e 6c 79 20 74 68 65 20 63 69 70 68 65 n only the ciphe
4720: 72 73 20 73 75 70 70 6f 72 74 65 64 20 66 6f 72 rs supported for
4730: 20 70 72 6f 74 6f 63 6f 6c 20 77 69 6c 6c 20 62 protocol will b
4740: 65 20 6c 69 73 74 65 64 2e 0a 0a 5b 63 61 6c 6c e listed...[call
4750: 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f [cmd tls::proto
4760: 63 6f 6c 73 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 cols]]..Returns
4770: 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 73 75 a list of the su
4780: 70 70 6f 72 74 65 64 20 53 53 4c 2f 54 4c 53 20 pported SSL/TLS
4790: 70 72 6f 74 6f 63 6f 6c 73 2e 20 56 61 6c 69 64 protocols. Valid
47a0: 20 76 61 6c 75 65 73 20 61 72 65 3a 0a 5b 63 6f values are:.[co
47b0: 6e 73 74 20 73 73 6c 32 5d 2c 20 5b 63 6f 6e 73 nst ssl2], [cons
47c0: 74 20 73 73 6c 33 5d 2c 20 5b 63 6f 6e 73 74 20 t ssl3], [const
47d0: 74 6c 73 31 5d 2c 20 5b 63 6f 6e 73 74 20 74 6c tls1], [const tl
47e0: 73 31 2e 31 5d 2c 20 5b 63 6f 6e 73 74 20 74 6c s1.1], [const tl
47f0: 73 31 2e 32 5d 2c 20 61 6e 64 0a 5b 63 6f 6e 73 s1.2], and.[cons
4800: 74 20 74 6c 73 31 2e 33 5d 2e 20 45 78 61 63 74 t tls1.3]. Exact
4810: 20 6c 69 73 74 20 64 65 70 65 6e 64 73 20 6f 6e list depends on
4820: 20 4f 70 65 6e 53 53 4c 20 76 65 72 73 69 6f 6e OpenSSL version
4830: 20 61 6e 64 20 63 6f 6d 70 69 6c 65 20 74 69 6d and compile tim
4840: 65 20 66 6c 61 67 73 2e 0a 0a 5b 63 61 6c 6c 20 e flags...[call
4850: 5b 63 6d 64 20 74 6c 73 3a 3a 76 65 72 73 69 6f [cmd tls::versio
4860: 6e 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 n]]..Returns the
4870: 20 4f 70 65 6e 53 53 4c 20 76 65 72 73 69 6f 6e OpenSSL version
4880: 20 73 74 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f string...[list_
4890: 65 6e 64 5d 0a 0a 0a 5b 73 65 63 74 69 6f 6e 20 end]...[section
48a0: 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c "Certificate Val
48b0: 69 64 61 74 69 6f 6e 22 5d 0a 0a 5b 73 75 62 73 idation"]..[subs
48c0: 65 63 74 69 6f 6e 20 22 50 4b 49 20 61 6e 64 20 ection "PKI and
48d0: 43 65 72 74 69 66 69 63 61 74 65 73 22 5d 0a 0a Certificates"]..
48e0: 55 73 69 6e 67 20 74 68 65 20 50 75 62 6c 69 63 Using the Public
48f0: 20 4b 65 79 20 49 6e 66 72 61 73 74 72 75 63 74 Key Infrastruct
4900: 75 72 65 20 28 50 4b 49 29 2c 20 65 61 63 68 20 ure (PKI), each
4910: 75 73 65 72 20 63 72 65 61 74 65 73 20 61 20 70 user creates a p
4920: 72 69 76 61 74 65 20 6b 65 79 20 74 68 61 74 0a rivate key that.
4930: 6f 6e 6c 79 20 74 68 65 79 20 6b 6e 6f 77 20 61 only they know a
4940: 62 6f 75 74 20 61 6e 64 20 61 20 70 75 62 6c 69 bout and a publi
4950: 63 20 6b 65 79 20 74 68 65 79 20 63 61 6e 20 65 c key they can e
4960: 78 63 68 61 6e 67 65 20 77 69 74 68 20 6f 74 68 xchange with oth
4970: 65 72 73 20 66 6f 72 20 75 73 65 20 69 6e 0a 65 ers for use in.e
4980: 6e 63 72 79 70 74 69 6e 67 20 61 6e 64 20 64 65 ncrypting and de
4990: 63 72 79 70 74 69 6e 67 20 64 61 74 61 2e 20 54 crypting data. T
49a0: 68 65 20 70 72 6f 63 65 73 73 20 69 73 20 74 68 he process is th
49b0: 65 20 73 65 6e 64 65 72 20 65 6e 63 72 79 70 74 e sender encrypt
49c0: 73 20 74 68 65 69 72 20 64 61 74 61 0a 75 73 69 s their data.usi
49d0: 6e 67 20 74 68 65 69 72 20 70 72 69 76 61 74 65 ng their private
49e0: 20 6b 65 79 20 61 6e 64 20 74 68 65 20 72 65 63 key and the rec
49f0: 65 69 76 65 72 27 73 20 70 75 62 6c 69 63 20 6b eiver's public k
4a00: 65 79 2e 20 54 68 65 20 64 61 74 61 20 69 73 20 ey. The data is
4a10: 74 68 65 6e 20 73 65 6e 74 0a 74 6f 20 74 68 65 then sent.to the
4a20: 20 72 65 63 65 69 76 65 72 2e 20 49 6e 20 61 20 receiver. In a
4a30: 73 69 6d 69 6c 61 72 20 6d 61 6e 6e 65 72 2c 20 similar manner,
4a40: 74 68 65 20 72 65 63 65 69 76 65 72 20 75 73 65 the receiver use
4a50: 73 20 74 68 65 69 72 20 70 72 69 76 61 74 65 20 s their private
4a60: 6b 65 79 20 61 6e 64 0a 74 68 65 20 73 65 6e 64 key and.the send
4a70: 65 72 27 73 20 70 75 62 6c 69 63 20 6b 65 79 20 er's public key
4a80: 74 6f 20 64 65 63 72 79 70 74 20 74 68 65 20 64 to decrypt the d
4a90: 61 74 61 2e 20 54 68 69 73 20 70 72 6f 76 69 64 ata. This provid
4aa0: 65 73 20 64 61 74 61 20 69 6e 74 65 67 72 69 74 es data integrit
4ab0: 79 2c 20 74 6f 0a 65 6e 73 75 72 65 20 74 68 65 y, to.ensure the
4ac0: 20 64 61 74 61 20 63 61 6e 27 74 20 62 65 20 76 data can't be v
4ad0: 69 65 77 65 64 20 6f 72 20 61 6c 74 65 72 65 64 iewed or altered
4ae0: 20 64 75 72 69 6e 67 20 74 72 61 6e 73 70 6f 72 during transpor
4af0: 74 2e 20 53 65 65 20 74 68 65 0a 5b 6f 70 74 69 t. See the.[opti
4b00: 6f 6e 20 2d 6b 65 79 5d 20 61 6e 64 20 5b 6f 70 on -key] and [op
4b10: 74 69 6f 6e 20 2d 6b 65 79 66 69 6c 65 5d 20 6f tion -keyfile] o
4b20: 70 74 69 6f 6e 73 20 66 6f 72 20 68 6f 77 20 74 ptions for how t
4b30: 6f 20 73 70 65 63 69 66 79 20 74 68 65 20 70 72 o specify the pr
4b40: 69 76 61 74 65 20 6b 65 79 2e 0a 41 6c 73 6f 20 ivate key..Also
4b50: 73 65 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 see the [option
4b60: 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74 69 6f -password] optio
4b70: 6e 20 66 6f 72 20 68 6f 77 20 74 6f 20 70 72 6f n for how to pro
4b80: 76 69 64 65 20 74 68 65 20 70 61 73 73 77 6f 72 vide the passwor
4b90: 64 2e 0a 5b 70 61 72 61 5d 0a 49 6e 20 6f 72 64 d..[para].In ord
4ba0: 65 72 20 74 6f 20 70 72 6f 76 69 64 65 20 61 75 er to provide au
4bb0: 74 68 65 6e 74 69 63 61 74 69 6f 6e 2c 20 69 2e thentication, i.
4bc0: 65 2e 20 65 6e 73 75 72 69 6e 67 20 73 6f 6d 65 e. ensuring some
4bd0: 6f 6e 65 20 69 73 20 77 68 6f 20 74 68 65 79 20 one is who they
4be0: 73 61 79 20 74 68 65 79 0a 61 72 65 2c 20 74 68 say they.are, th
4bf0: 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 6e 64 e public key and
4c00: 20 75 73 65 72 20 69 64 65 6e 74 69 66 69 63 61 user identifica
4c10: 74 69 6f 6e 20 69 6e 66 6f 20 69 73 20 73 74 6f tion info is sto
4c20: 72 65 64 20 69 6e 20 61 20 58 2e 35 30 39 0a 63 red in a X.509.c
4c30: 65 72 74 69 66 69 63 61 74 65 20 61 6e 64 20 74 ertificate and t
4c40: 68 61 74 20 63 65 72 74 69 66 69 63 61 74 65 20 hat certificate
4c50: 69 73 20 61 75 74 68 65 6e 74 69 63 61 74 65 64 is authenticated
4c60: 20 28 69 2e 65 2e 20 73 69 67 6e 65 64 29 20 62 (i.e. signed) b
4c70: 79 20 61 20 43 65 72 74 69 66 69 63 61 74 65 0a y a Certificate.
4c80: 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 2e 20 Authority (CA).
4c90: 55 73 65 72 73 20 63 61 6e 20 74 68 65 6e 20 65 Users can then e
4ca0: 78 63 68 61 6e 67 65 20 74 68 65 73 65 20 63 65 xchange these ce
4cb0: 72 74 69 66 69 63 61 74 65 73 20 64 75 72 69 6e rtificates durin
4cc0: 67 20 74 68 65 20 54 4c 53 0a 69 6e 69 74 69 61 g the TLS.initia
4cd0: 6c 69 7a 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 lization process
4ce0: 20 61 6e 64 20 63 68 65 63 6b 20 74 68 65 6d 20 and check them
4cf0: 61 67 61 69 6e 73 74 20 74 68 65 20 72 6f 6f 74 against the root
4d00: 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73 CA certificates
4d10: 20 74 6f 20 65 6e 73 75 72 65 0a 74 68 65 79 20 to ensure.they
4d20: 61 72 65 20 76 61 6c 69 64 2e 20 54 68 69 73 20 are valid. This
4d30: 69 73 20 68 61 6e 64 6c 65 64 20 62 79 20 4f 70 is handled by Op
4d40: 65 6e 53 53 4c 20 76 69 61 20 74 68 65 20 5b 6f enSSL via the [o
4d50: 70 74 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 ption -request]
4d60: 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 and.[option -req
4d70: 75 69 72 65 5d 20 6f 70 74 69 6f 6e 73 2e 20 53 uire] options. S
4d80: 65 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d ee the [option -
4d90: 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 cadir], [option
4da0: 2d 63 61 64 69 72 5d 2c 20 61 6e 64 0a 5b 6f 70 -cadir], and.[op
4db0: 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f tion -castore] o
4dc0: 70 74 69 6f 6e 73 20 66 6f 72 20 68 6f 77 20 74 ptions for how t
4dd0: 70 20 73 70 65 63 69 66 79 20 77 68 65 72 65 20 p specify where
4de0: 74 6f 20 66 69 6e 64 20 74 68 65 20 43 41 20 63 to find the CA c
4df0: 65 72 74 69 66 69 63 61 74 65 73 2e 0a 4f 70 74 ertificates..Opt
4e00: 69 6f 6e 61 6c 6c 79 2c 20 69 6e 20 61 20 66 75 ionally, in a fu
4e10: 74 75 72 65 20 72 65 6c 65 61 73 65 2c 20 74 68 ture release, th
4e20: 65 79 20 63 61 6e 20 61 6c 73 6f 20 62 65 20 63 ey can also be c
4e30: 68 65 63 6b 65 64 20 61 67 61 69 6e 73 74 20 74 hecked against t
4e40: 68 65 20 43 65 72 74 69 66 69 63 61 74 65 0a 52 he Certificate.R
4e50: 65 76 6f 63 61 74 69 6f 6e 20 4c 69 73 74 20 28 evocation List (
4e60: 43 52 4c 29 20 6f 66 20 72 65 76 6f 6b 65 64 20 CRL) of revoked
4e70: 63 65 72 74 69 66 69 63 61 74 65 73 2e 20 43 65 certificates. Ce
4e80: 72 74 69 66 69 63 61 74 65 73 20 63 61 6e 20 61 rtificates can a
4e90: 6c 73 6f 20 62 65 0a 73 65 6c 66 2d 73 69 67 6e lso be.self-sign
4ea0: 65 64 2c 20 62 75 74 20 74 68 65 79 20 61 72 65 ed, but they are
4eb0: 20 62 79 20 64 65 66 61 75 6c 74 20 6e 6f 74 20 by default not
4ec0: 74 72 75 73 74 65 64 20 75 6e 6c 65 73 73 20 79 trusted unless y
4ed0: 6f 75 20 61 64 64 20 74 68 65 6d 20 74 6f 20 79 ou add them to y
4ee0: 6f 75 72 0a 63 65 72 74 69 66 69 63 61 74 65 20 our.certificate
4ef0: 73 74 6f 72 65 2e 0a 5b 70 61 72 61 5d 0a 54 79 store..[para].Ty
4f00: 70 69 63 61 6c 6c 79 20 77 68 65 6e 20 76 69 73 pically when vis
4f10: 69 74 69 6e 67 20 77 65 62 20 73 69 74 65 73 2c iting web sites,
4f20: 20 6f 6e 6c 79 20 74 68 65 20 63 6c 69 65 6e 74 only the client
4f30: 20 6e 65 65 64 73 20 74 6f 20 63 68 65 63 6b 20 needs to check
4f40: 74 68 65 20 73 65 72 76 65 72 27 73 0a 63 65 72 the server's.cer
4f50: 74 69 66 69 63 61 74 65 20 74 6f 20 65 6e 73 75 tificate to ensu
4f60: 72 65 20 69 74 20 69 73 20 76 61 6c 69 64 2e 20 re it is valid.
4f70: 54 68 65 20 73 65 72 76 65 72 20 64 6f 65 73 6e The server doesn
4f80: 27 74 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 't need to check
4f90: 20 74 68 65 20 63 6c 69 65 6e 74 0a 63 65 72 74 the client.cert
4fa0: 69 66 69 63 61 74 65 20 75 6e 6c 65 73 73 20 79 ificate unless y
4fb0: 6f 75 20 6e 65 65 64 20 74 6f 20 61 75 74 68 65 ou need to authe
4fc0: 6e 74 69 63 61 74 65 20 77 69 74 68 20 74 68 65 nticate with the
4fd0: 6d 20 74 6f 20 6c 6f 67 69 6e 2c 20 65 74 63 2e m to login, etc.
4fe0: 20 53 65 65 20 74 68 65 0a 5b 6f 70 74 69 6f 6e See the.[option
4ff0: 20 2d 63 65 72 74 5d 20 61 6e 64 20 5b 6f 70 74 -cert] and [opt
5000: 69 6f 6e 20 2d 63 65 72 74 66 69 6c 65 5d 20 6f ion -certfile] o
5010: 70 74 69 6f 6e 73 20 69 66 20 79 6f 75 20 6e 65 ptions if you ne
5020: 65 64 20 74 6f 20 70 72 6f 76 69 64 65 20 61 20 ed to provide a
5030: 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 0a 5b certificate....[
5040: 73 75 62 73 65 63 74 69 6f 6e 20 22 53 75 6d 6d subsection "Summ
5050: 61 72 79 20 6f 66 20 63 6f 6d 6d 61 6e 64 20 6c ary of command l
5060: 69 6e 65 20 6f 70 74 69 6f 6e 73 22 5d 0a 0a 54 ine options"]..T
5070: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6f 70 74 he following opt
5080: 69 6f 6e 73 20 61 72 65 20 75 73 65 64 20 66 6f ions are used fo
5090: 72 20 70 65 65 72 20 63 65 72 74 69 66 69 63 61 r peer certifica
50a0: 74 65 20 76 61 6c 69 64 61 74 69 6f 6e 3a 0a 0a te validation:..
50b0: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 [list_begin opti
50c0: 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d ons]..[opt_def -
50d0: 63 61 64 69 72 20 5b 61 72 67 20 64 69 72 65 63 cadir [arg direc
50e0: 74 6f 72 79 5d 5d 0a 53 70 65 63 69 66 69 65 73 tory]].Specifies
50f0: 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 77 the directory w
5100: 68 65 72 65 20 74 68 65 20 43 65 72 74 69 66 69 here the Certifi
5110: 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28 cate Authority (
5120: 43 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73 CA) certificates
5130: 20 61 72 65 0a 73 74 6f 72 65 64 2e 20 54 68 65 are.stored. The
5140: 20 64 65 66 61 75 6c 74 20 69 73 20 70 6c 61 74 default is plat
5150: 66 6f 72 6d 20 73 70 65 63 69 66 69 63 2c 20 62 form specific, b
5160: 75 74 20 69 73 20 75 73 75 61 6c 6c 79 20 5b 66 ut is usually [f
5170: 69 6c 65 20 22 2f 65 74 63 2f 73 73 6c 2f 63 65 ile "/etc/ssl/ce
5180: 72 74 73 22 5d 20 6f 6e 0a 4c 69 6e 75 78 2f 55 rts"] on.Linux/U
5190: 6e 69 78 20 73 79 73 74 65 6d 73 2e 20 54 68 65 nix systems. The
51a0: 20 64 65 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f default locatio
51b0: 6e 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64 n can be overrid
51c0: 64 65 6e 20 62 79 20 74 68 65 0a 5b 76 61 72 20 den by the.[var
51d0: 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20 65 6e SSL_CERT_DIR] en
51e0: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 vironment variab
51f0: 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 le...[opt_def -c
5200: 61 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e afile [arg filen
5210: 61 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 ame]].Specifies
5220: 74 68 65 20 66 69 6c 65 20 77 69 74 68 20 74 68 the file with th
5230: 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 e Certificate Au
5240: 74 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72 thority (CA) cer
5250: 74 69 66 69 63 61 74 65 73 20 74 6f 20 75 73 65 tificates to use
5260: 20 69 6e 0a 5b 63 6f 6e 73 74 20 50 45 4d 5d 20 in.[const PEM]
5270: 66 69 6c 65 20 66 6f 72 6d 61 74 2e 20 54 68 65 file format. The
5280: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 66 69 6c default is [fil
5290: 65 20 63 65 72 74 2e 70 65 6d 5d 2c 20 69 6e 20 e cert.pem], in
52a0: 74 68 65 20 4f 70 65 6e 53 53 4c 0a 64 69 72 65 the OpenSSL.dire
52b0: 63 74 6f 72 79 2e 20 4f 6e 20 4c 69 6e 75 78 2f ctory. On Linux/
52c0: 55 6e 69 78 20 73 79 73 74 65 6d 73 2c 20 74 68 Unix systems, th
52d0: 69 73 20 69 73 20 75 73 75 61 6c 6c 79 20 5b 66 is is usually [f
52e0: 69 6c 65 20 2f 65 74 63 2f 73 73 6c 2f 63 61 2d ile /etc/ssl/ca-
52f0: 62 75 6e 64 6c 65 2e 70 65 6d 5d 2e 0a 54 68 65 bundle.pem]..The
5300: 20 64 65 66 61 75 6c 74 20 66 69 6c 65 20 63 61 default file ca
5310: 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 n be overridden
5320: 62 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f by the [var SSL_
5330: 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72 CERT_FILE] envir
5340: 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e onment.variable.
5350: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 73 74 ..[opt_def -cast
5360: 6f 72 65 20 5b 61 72 67 20 55 52 49 5d 5d 0a 53 ore [arg URI]].S
5370: 70 65 63 69 66 69 65 73 20 74 68 65 20 55 6e 69 pecifies the Uni
5380: 66 6f 72 6d 20 52 65 73 6f 75 72 63 65 20 49 64 form Resource Id
5390: 65 6e 74 69 66 69 65 72 20 28 55 52 49 29 20 66 entifier (URI) f
53a0: 6f 72 20 74 68 65 20 43 65 72 74 69 66 69 63 61 or the Certifica
53b0: 74 65 20 41 75 74 68 6f 72 69 74 79 0a 28 43 41 te Authority.(CA
53c0: 29 20 73 74 6f 72 65 2c 20 77 68 69 63 68 20 6d ) store, which m
53d0: 61 79 20 62 65 20 61 20 73 69 6e 67 6c 65 20 63 ay be a single c
53e0: 6f 6e 74 61 69 6e 65 72 20 6f 72 20 61 20 63 61 ontainer or a ca
53f0: 74 61 6c 6f 67 20 6f 66 20 63 6f 6e 74 61 69 6e talog of contain
5400: 65 72 73 2e 0a 53 74 61 72 74 69 6e 67 20 77 69 ers..Starting wi
5410: 74 68 20 4f 70 65 6e 53 53 4c 20 33 2e 32 20 6f th OpenSSL 3.2 o
5420: 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c 20 73 65 n MS Windows, se
5430: 74 20 74 6f 20 22 5b 63 6f 6e 73 74 20 22 6f 72 t to "[const "or
5440: 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 74 6f g.openssl.winsto
5450: 72 65 3a 2f 2f 22 5d 22 0a 74 6f 20 75 73 65 20 re://"]".to use
5460: 74 68 65 20 62 75 69 6c 74 2d 69 6e 20 4d 53 20 the built-in MS
5470: 57 69 6e 64 6f 77 73 20 43 65 72 74 69 66 69 63 Windows Certific
5480: 61 74 65 20 53 74 6f 72 65 2e 0a 54 68 69 73 20 ate Store..This
5490: 73 74 6f 72 65 20 6f 6e 6c 79 20 73 75 70 70 6f store only suppo
54a0: 72 74 73 20 72 6f 6f 74 20 63 65 72 74 69 66 69 rts root certifi
54b0: 63 61 74 65 20 73 74 6f 72 65 73 2e 20 53 65 65 cate stores. See
54c0: 0a 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69 .[sectref "Certi
54d0: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f ficate Validatio
54e0: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 n"] for more det
54f0: 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 ails...[opt_def
5500: 2d 72 65 71 75 65 73 74 20 5b 61 72 67 20 62 6f -request [arg bo
5510: 6f 6c 5d 5d 0a 52 65 71 75 65 73 74 20 61 20 63 ol]].Request a c
5520: 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 ertificate from
5530: 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67 20 the peer during
5540: 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b the SSL handshak
5550: 65 2e 20 54 68 69 73 20 69 73 20 6e 65 65 64 65 e. This is neede
5560: 64 0a 74 6f 20 64 6f 20 43 65 72 74 69 66 69 63 d.to do Certific
5570: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 2e 20 ate Validation.
5580: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 Starting in TclT
5590: 4c 53 20 31 2e 38 2c 20 74 68 65 20 64 65 66 61 LS 1.8, the defa
55a0: 75 6c 74 20 69 73 0a 5b 63 6f 6e 73 74 20 74 72 ult is.[const tr
55b0: 75 65 5d 2e 20 49 6e 20 61 64 64 69 74 69 6f 6e ue]. In addition
55c0: 2c 20 74 68 65 20 63 6c 69 65 6e 74 20 63 61 6e , the client can
55d0: 20 6d 61 6e 75 61 6c 6c 79 20 69 6e 73 70 65 63 manually inspec
55e0: 74 20 61 6e 64 20 61 63 63 65 70 74 20 6f 72 20 t and accept or
55f0: 72 65 6a 65 63 74 0a 65 61 63 68 20 63 65 72 74 reject.each cert
5600: 69 66 69 63 61 74 65 20 75 73 69 6e 67 20 74 68 ificate using th
5610: 65 20 5b 61 72 67 20 2d 76 61 6c 69 64 61 74 65 e [arg -validate
5620: 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 2e command] option.
5630: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 ..[opt_def -requ
5640: 69 72 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a ire [arg bool]].
5650: 52 65 71 75 69 72 65 20 61 20 76 61 6c 69 64 20 Require a valid
5660: 63 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d certificate from
5670: 20 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67 the peer during
5680: 20 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 the SSL handsha
5690: 6b 65 2e 20 49 66 20 74 68 69 73 20 69 73 0a 73 ke. If this is.s
56a0: 65 74 20 74 6f 20 74 72 75 65 2c 20 74 68 65 6e et to true, then
56b0: 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65 73 [option -reques
56c0: 74 5d 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 20 t] must also be
56d0: 73 65 74 20 74 6f 20 74 72 75 65 20 61 6e 64 20 set to true and
56e0: 61 20 65 69 74 68 65 72 0a 5b 6f 70 74 69 6f 6e a either.[option
56f0: 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f -cadir], [optio
5700: 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 5b 6f 70 74 n -cafile], [opt
5710: 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 2c 20 6f ion -castore], o
5720: 72 20 61 20 70 6c 61 74 66 6f 72 6d 20 64 65 66 r a platform def
5730: 61 75 6c 74 0a 6d 75 73 74 20 62 65 20 70 72 6f ault.must be pro
5740: 76 69 64 65 64 20 69 6e 20 6f 72 64 65 72 20 74 vided in order t
5750: 6f 20 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e o validate again
5760: 73 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 st. The default
5770: 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61 6e in TclTLS 1.8 an
5780: 64 0a 65 61 72 6c 69 65 72 20 76 65 72 73 69 6f d.earlier versio
5790: 6e 73 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c ns is [const fal
57a0: 73 65 5d 20 73 69 6e 63 65 20 6e 6f 74 20 61 6c se] since not al
57b0: 6c 20 70 6c 61 74 66 6f 72 6d 73 20 68 61 76 65 l platforms have
57c0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f certificates to
57d0: 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e 73 .validate agains
57e0: 74 20 69 6e 20 61 20 66 6f 72 6d 20 63 6f 6d 70 t in a form comp
57f0: 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65 6e atible with Open
5800: 53 53 4c 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d SSL...[list_end]
5810: 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 57 ..[subsection "W
5820: 68 65 6e 20 61 72 65 20 63 6f 6d 6d 61 6e 64 20 hen are command
5830: 6c 69 6e 65 20 6f 70 74 69 6f 6e 73 20 6e 65 65 line options nee
5840: 64 65 64 3f 22 5d 0a 0a 49 6e 20 54 63 6c 54 4c ded?"]..In TclTL
5850: 53 20 31 2e 38 20 61 6e 64 20 65 61 72 6c 69 65 S 1.8 and earlie
5860: 72 20 76 65 72 73 69 6f 6e 73 2c 20 63 65 72 74 r versions, cert
5870: 69 66 69 63 61 74 65 20 76 61 6c 69 64 61 74 69 ificate validati
5880: 6f 6e 20 69 73 0a 5b 65 6d 70 68 20 4e 4f 54 5d on is.[emph NOT]
5890: 20 65 6e 61 62 6c 65 64 20 62 79 20 64 65 66 61 enabled by defa
58a0: 75 6c 74 2e 20 54 68 69 73 20 6c 69 6d 69 74 61 ult. This limita
58b0: 74 69 6f 6e 20 69 73 20 64 75 65 20 74 6f 20 74 tion is due to t
58c0: 68 65 20 6c 61 63 6b 20 6f 66 20 61 20 63 6f 6d he lack of a com
58d0: 6d 6f 6e 0a 63 72 6f 73 73 20 70 6c 61 74 66 6f mon.cross platfo
58e0: 72 6d 20 64 61 74 61 62 61 73 65 20 6f 66 20 43 rm database of C
58f0: 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f ertificate Autho
5900: 72 69 74 79 20 28 43 41 29 20 70 72 6f 76 69 64 rity (CA) provid
5910: 65 64 20 63 65 72 74 69 66 69 63 61 74 65 73 20 ed certificates
5920: 74 6f 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69 to.validate agai
5930: 6e 73 74 2e 20 4d 61 6e 79 20 4c 69 6e 75 78 20 nst. Many Linux
5940: 73 79 73 74 65 6d 73 20 6e 61 74 69 76 65 6c 79 systems natively
5950: 20 73 75 70 70 6f 72 74 20 4f 70 65 6e 53 53 4c support OpenSSL
5960: 20 61 6e 64 20 74 68 75 73 20 68 61 76 65 0a 74 and thus have.t
5970: 68 65 73 65 20 63 65 72 74 69 66 69 63 61 74 65 hese certificate
5980: 73 20 69 6e 73 74 61 6c 6c 65 64 20 61 73 20 70 s installed as p
5990: 61 72 74 20 6f 66 20 74 68 65 20 4f 53 2c 20 62 art of the OS, b
59a0: 75 74 20 4d 61 63 4f 53 20 61 6e 64 20 4d 53 20 ut MacOS and MS
59b0: 57 69 6e 64 6f 77 73 20 64 6f 20 6e 6f 74 2e 0a Windows do not..
59c0: 49 6e 20 6f 72 64 65 72 20 74 6f 20 75 73 65 20 In order to use
59d0: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 the [option -req
59e0: 75 69 72 65 5d 20 6f 70 74 69 6f 6e 2c 20 6f 6e uire] option, on
59f0: 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 e of the followi
5a00: 6e 67 0a 6d 75 73 74 20 62 65 20 74 72 75 65 3a ng.must be true:
5a10: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 69 74 ..[list_begin it
5a20: 65 6d 69 7a 65 64 5d 0a 0a 5b 69 74 65 6d 5d 0a emized]..[item].
5a30: 4f 6e 20 4c 69 6e 75 78 20 61 6e 64 20 55 6e 69 On Linux and Uni
5a40: 78 20 73 79 73 74 65 6d 73 20 77 69 74 68 20 4f x systems with O
5a50: 70 65 6e 53 53 4c 20 61 6c 72 65 61 64 79 20 69 penSSL already i
5a60: 6e 73 74 61 6c 6c 65 64 20 6f 72 20 69 66 20 74 nstalled or if t
5a70: 68 65 20 43 41 0a 63 65 72 74 69 66 69 63 61 74 he CA.certificat
5a80: 65 73 20 61 72 65 20 61 76 61 69 6c 61 62 6c 65 es are available
5a90: 20 69 6e 20 50 45 4d 20 66 6f 72 6d 61 74 2c 20 in PEM format,
5aa0: 61 6e 64 20 69 66 20 74 68 65 79 20 61 72 65 20 and if they are
5ab0: 73 74 6f 72 65 64 20 69 6e 20 74 68 65 0a 73 74 stored in the.st
5ac0: 61 6e 64 61 72 64 20 6c 6f 63 61 74 69 6f 6e 73 andard locations
5ad0: 2c 20 6f 72 20 69 66 20 74 68 65 20 5b 76 61 72 , or if the [var
5ae0: 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20 6f SSL_CERT_DIR] o
5af0: 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f r [var SSL_CERT_
5b00: 46 49 4c 45 5d 0a 65 6e 76 69 72 6f 6e 6d 65 6e FILE].environmen
5b10: 74 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20 t variables are
5b20: 73 65 74 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f set, then [optio
5b30: 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 n -cadir], [opti
5b40: 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 61 6e 64 20 on -cadir],.and
5b50: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 [option -castore
5b60: 5d 20 61 72 65 6e 27 74 20 6e 65 65 64 65 64 2e ] aren't needed.
5b70: 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65 6e ..[item].If Open
5b80: 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74 61 SSL is not insta
5b90: 6c 6c 65 64 20 69 6e 20 74 68 65 20 64 65 66 61 lled in the defa
5ba0: 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 2c 20 6f 72 ult location, or
5bb0: 20 77 68 65 6e 20 75 73 69 6e 67 20 4d 61 63 20 when using Mac
5bc0: 4f 53 0a 6f 72 20 4d 53 20 57 69 6e 64 6f 77 73 OS.or MS Windows
5bd0: 20 61 6e 64 20 4f 70 65 6e 53 53 4c 20 69 73 20 and OpenSSL is
5be0: 69 6e 73 74 61 6c 6c 65 64 2c 20 74 68 65 20 5b installed, the [
5bf0: 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 var SSL_CERT_DIR
5c00: 5d 20 61 6e 64 2f 6f 72 0a 5b 76 61 72 20 53 53 ] and/or.[var SS
5c10: 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 L_CERT_FILE] env
5c20: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c ironment variabl
5c30: 65 73 20 6f 72 20 74 68 65 20 6f 6e 65 20 6f 66 es or the one of
5c40: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 the [option -ca
5c50: 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d 63 dir],.[option -c
5c60: 61 64 69 72 5d 2c 20 6f 72 20 5b 6f 70 74 69 6f adir], or [optio
5c70: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69 n -castore] opti
5c80: 6f 6e 73 20 6d 75 73 74 20 62 65 20 64 65 66 69 ons must be defi
5c90: 6e 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20 ned...[item].On
5ca0: 4d 53 20 57 69 6e 64 6f 77 73 2c 20 73 74 61 72 MS Windows, star
5cb0: 74 69 6e 67 20 69 6e 20 4f 70 65 6e 53 53 4c 20 ting in OpenSSL
5cc0: 33 2e 32 2c 20 69 74 20 69 73 20 6e 6f 77 20 70 3.2, it is now p
5cd0: 6f 73 73 69 62 6c 65 20 74 6f 20 61 63 63 65 73 ossible to acces
5ce0: 73 20 74 68 65 0a 62 75 69 6c 74 2d 69 6e 20 57 s the.built-in W
5cf0: 69 6e 64 6f 77 73 20 43 65 72 74 69 66 69 63 61 indows Certifica
5d00: 74 65 20 53 74 6f 72 65 20 66 72 6f 6d 20 4f 70 te Store from Op
5d10: 65 6e 53 53 4c 2e 20 54 68 69 73 20 63 61 6e 20 enSSL. This can
5d20: 75 74 69 6c 69 7a 65 64 20 62 79 0a 73 65 74 74 utilized by.sett
5d30: 69 6e 67 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 ing the [option
5d40: 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e -castore] option
5d50: 20 74 6f 20 22 5b 63 6f 6e 73 74 20 6f 72 67 2e to "[const org.
5d60: 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65 openssl.winstore
5d70: 3a 2f 2f 5d 22 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 ://]"...[item].I
5d80: 66 20 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f 74 f OpenSSL is not
5d90: 20 69 6e 73 74 61 6c 6c 65 64 20 6f 72 20 74 68 installed or th
5da0: 65 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65 e CA certificate
5db0: 73 20 61 72 65 20 6e 6f 74 20 61 76 61 69 6c 61 s are not availa
5dc0: 62 6c 65 20 69 6e 20 50 45 4d 0a 66 6f 72 6d 61 ble in PEM.forma
5dd0: 74 2c 20 74 68 65 20 43 41 20 63 65 72 74 69 66 t, the CA certif
5de0: 69 63 61 74 65 73 20 6d 75 73 74 20 62 65 20 64 icates must be d
5df0: 6f 77 6e 6c 6f 61 64 65 64 20 61 6e 64 20 69 6e ownloaded and in
5e00: 73 74 61 6c 6c 65 64 20 77 69 74 68 20 74 68 65 stalled with the
5e10: 20 75 73 65 72 0a 73 6f 66 74 77 61 72 65 2e 20 user.software.
5e20: 54 68 65 20 43 55 52 4c 20 74 65 61 6d 20 6d 61 The CURL team ma
5e30: 6b 65 73 20 74 68 65 6d 20 61 76 61 69 6c 61 62 kes them availab
5e40: 6c 65 20 61 74 0a 5b 75 72 69 20 22 68 74 74 70 le at.[uri "http
5e50: 73 3a 2f 2f 63 75 72 6c 2e 73 65 2f 64 6f 63 73 s://curl.se/docs
5e60: 2f 63 61 65 78 74 72 61 63 74 2e 68 74 6d 6c 22 /caextract.html"
5e70: 20 22 43 41 20 63 65 72 74 69 66 69 63 61 74 65 "CA certificate
5e80: 73 20 65 78 74 72 61 63 74 65 64 0a 66 72 6f 6d s extracted.from
5e90: 20 4d 6f 7a 69 6c 6c 61 22 5d 20 69 6e 20 74 68 Mozilla"] in th
5ea0: 65 20 5b 66 69 6c 65 20 63 61 63 65 72 74 2e 70 e [file cacert.p
5eb0: 65 6d 5d 20 66 69 6c 65 2e 20 59 6f 75 20 6d 75 em] file. You mu
5ec0: 73 74 20 74 68 65 6e 20 65 69 74 68 65 72 20 73 st then either s
5ed0: 65 74 20 74 68 65 0a 5b 76 61 72 20 53 53 4c 5f et the.[var SSL_
5ee0: 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f 6f 72 CERT_DIR] and/or
5ef0: 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 [var SSL_CERT_F
5f00: 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 ILE] environment
5f10: 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20 74 68 variables or th
5f20: 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 e.[option -cadir
5f30: 5d 20 6f 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 ] or [option -ca
5f40: 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20 74 6f file] options to
5f50: 20 74 68 65 20 43 41 20 63 65 72 74 20 66 69 6c the CA cert fil
5f60: 65 27 73 20 69 6e 73 74 61 6c 6c 0a 6c 6f 63 61 e's install.loca
5f70: 74 69 6f 6e 2e 20 49 74 20 69 73 20 79 6f 75 72 tion. It is your
5f80: 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 20 responsibility
5f90: 74 6f 20 6b 65 65 70 20 74 68 69 73 20 66 69 6c to keep this fil
5fa0: 65 20 75 70 20 74 6f 20 64 61 74 65 2e 0a 0a 5b e up to date...[
5fb0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 65 63 74 list_end]..[sect
5fc0: 69 6f 6e 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 ion "Callback Op
5fd0: 74 69 6f 6e 73 22 5d 0a 0a 41 73 20 70 72 65 76 tions"]..As prev
5fe0: 69 6f 75 73 6c 79 20 64 65 73 63 72 69 62 65 64 iously described
5ff0: 2c 20 65 61 63 68 20 63 68 61 6e 6e 65 6c 20 63 , each channel c
6000: 61 6e 20 62 65 20 67 69 76 65 6e 20 74 68 65 69 an be given thei
6010: 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 73 0a r own callbacks.
6020: 74 6f 20 68 61 6e 64 6c 65 20 69 6e 74 65 72 6d to handle interm
6030: 65 64 69 61 74 65 20 70 72 6f 63 65 73 73 69 6e ediate processin
6040: 67 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c g by the OpenSSL
6050: 20 6c 69 62 72 61 72 79 2c 20 75 73 69 6e 67 20 library, using
6060: 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d the.[option -com
6070: 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d mand], [option -
6080: 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 20 5b password], and [
6090: 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 option -validate
60a0: 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e _command] option
60b0: 73 0a 70 61 73 73 65 64 20 74 6f 20 65 69 74 68 s.passed to eith
60c0: 65 72 20 6f 66 20 5b 63 6d 64 20 74 6c 73 3a 3a er of [cmd tls::
60d0: 73 6f 63 6b 65 74 5d 20 6f 72 20 5b 63 6d 64 20 socket] or [cmd
60e0: 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e 0a 55 6e tls::import]..Un
60f0: 6c 69 6b 65 20 70 72 65 76 69 6f 75 73 20 76 65 like previous ve
6100: 72 73 69 6f 6e 73 20 6f 66 20 54 63 6c 54 4c 53 rsions of TclTLS
6110: 2c 20 6f 6e 6c 79 20 69 66 20 74 68 65 20 63 61 , only if the ca
6120: 6c 6c 62 61 63 6b 20 67 65 6e 65 72 61 74 65 73 llback generates
6130: 20 61 6e 20 65 72 72 6f 72 2c 0a 77 69 6c 6c 20 an error,.will
6140: 74 68 65 20 5b 73 79 73 63 6d 64 20 62 67 65 72 the [syscmd bger
6150: 72 6f 72 5d 20 63 6f 6d 6d 61 6e 64 20 62 65 20 ror] command be
6160: 69 6e 76 6f 6b 65 64 20 77 69 74 68 20 74 68 65 invoked with the
6170: 20 65 72 72 6f 72 20 69 6e 66 6f 72 6d 61 74 69 error informati
6180: 6f 6e 2e 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e on...[subsection
6190: 20 22 56 61 6c 75 65 73 20 66 6f 72 20 43 6f 6d "Values for Com
61a0: 6d 61 6e 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a mand Callback"].
61b0: 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f .The callback fo
61c0: 72 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 r the [option -c
61d0: 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 ommand] option i
61e0: 73 20 69 6e 76 6f 6b 65 64 20 61 74 20 73 65 76 s invoked at sev
61f0: 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75 72 69 eral points duri
6200: 6e 67 20 74 68 65 0a 4f 70 65 6e 53 53 4c 20 68 ng the.OpenSSL h
6210: 61 6e 64 73 68 61 6b 65 20 61 6e 64 20 64 75 72 andshake and dur
6220: 69 6e 67 20 72 6f 75 74 69 6e 65 20 6f 70 65 72 ing routine oper
6230: 61 74 69 6f 6e 73 2e 20 53 65 65 20 62 65 6c 6f ations. See belo
6240: 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62 w for the possib
6250: 6c 65 0a 61 72 67 75 6d 65 6e 74 73 20 70 61 73 le.arguments pas
6260: 73 65 64 20 74 6f 20 74 68 65 20 63 61 6c 6c 62 sed to the callb
6270: 61 63 6b 20 73 63 72 69 70 74 2e 20 56 61 6c 75 ack script. Valu
6280: 65 73 20 72 65 74 75 72 6e 65 64 20 66 72 6f 6d es returned from
6290: 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 61 72 the callback ar
62a0: 65 0a 69 67 6e 6f 72 65 64 2e 0a 0a 5b 6c 69 73 e.ignored...[lis
62b0: 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d t_begin options]
62c0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 65 72 72 6f 72 ..[opt_def error
62d0: 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 [arg "channelId
62e0: 20 6d 65 73 73 61 67 65 22 5d 5d 0a 54 68 69 73 message"]].This
62f0: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 form of callbac
6300: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 k is invoked whe
6310: 6e 65 76 65 72 20 61 6e 20 65 72 72 6f 72 20 6f never an error o
6320: 63 63 75 72 73 20 64 75 72 69 6e 67 20 74 68 65 ccurs during the
6330: 20 69 6e 69 74 69 61 6c 0a 63 6f 6e 6e 65 63 74 initial.connect
6340: 69 6f 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20 ion, handshake,
6350: 6f 72 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f 6e or I/O operation
6360: 73 2e 20 54 68 65 20 5b 61 72 67 20 6d 65 73 73 s. The [arg mess
6370: 61 67 65 5d 20 61 72 67 75 6d 65 6e 74 20 63 61 age] argument ca
6380: 6e 20 62 65 0a 66 72 6f 6d 20 74 68 65 20 54 63 n be.from the Tc
6390: 6c 5f 45 72 72 6e 6f 4d 73 67 2c 20 4f 70 65 6e l_ErrnoMsg, Open
63a0: 53 53 4c 20 66 75 6e 63 74 69 6f 6e 20 5b 66 75 SSL function [fu
63b0: 6e 20 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72 72 n ERR_reason_err
63c0: 6f 72 5f 73 74 72 69 6e 67 28 29 5d 2c 0a 6f 72 or_string()],.or
63d0: 20 61 20 63 75 73 74 6f 6d 20 6d 65 73 73 61 67 a custom messag
63e0: 65 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b e. This callback
63f0: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 is new for TclT
6400: 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 LS 1.8...[opt_de
6410: 66 20 69 6e 66 6f 20 5b 61 72 67 20 22 63 68 61 f info [arg "cha
6420: 6e 6e 65 6c 49 64 20 6d 61 6a 6f 72 20 6d 69 6e nnelId major min
6430: 6f 72 20 6d 65 73 73 61 67 65 20 74 79 70 65 22 or message type"
6440: 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 ]].This form of
6450: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f callback is invo
6460: 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53 ked by the OpenS
6470: 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e SL function.[fun
6480: 20 53 53 4c 5f 73 65 74 5f 69 6e 66 6f 5f 63 61 SSL_set_info_ca
6490: 6c 6c 62 61 63 6b 28 29 5d 20 64 75 72 69 6e 67 llback()] during
64a0: 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63 6f 6e the initial con
64b0: 6e 65 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e 64 nection and hand
64c0: 73 68 61 6b 65 0a 6f 70 65 72 61 74 69 6f 6e 73 shake.operations
64d0: 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 . The arguments
64e0: 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 are:..[list_begi
64f0: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a n definitions]..
6500: 5b 64 65 66 20 5b 61 72 67 20 6d 61 6a 6f 72 5d [def [arg major]
6510: 5d 0a 4d 61 6a 6f 72 20 63 61 74 65 67 6f 72 79 ].Major category
6520: 20 66 6f 72 20 65 72 72 6f 72 2e 20 56 61 6c 69 for error. Vali
6530: 64 20 65 6e 75 6d 73 20 61 72 65 3a 20 5b 63 6f d enums are: [co
6540: 6e 73 74 20 68 61 6e 64 73 68 61 6b 65 5d 2c 20 nst handshake],
6550: 5b 63 6f 6e 73 74 20 61 6c 65 72 74 5d 2c 0a 5b [const alert],.[
6560: 63 6f 6e 73 74 20 63 6f 6e 6e 65 63 74 5d 2c 20 const connect],
6570: 5b 63 6f 6e 73 74 20 61 63 63 65 70 74 5d 2e 0a [const accept]..
6580: 0a 5b 64 65 66 20 5b 61 72 67 20 6d 69 6e 6f 72 .[def [arg minor
6590: 5d 5d 0a 4d 69 6e 6f 72 20 63 61 74 65 67 6f 72 ]].Minor categor
65a0: 79 20 66 6f 72 20 65 72 72 6f 72 2e 20 56 61 6c y for error. Val
65b0: 69 64 20 65 6e 75 6d 73 20 61 72 65 3a 20 5b 63 id enums are: [c
65c0: 6f 6e 73 74 20 73 74 61 72 74 5d 2c 20 5b 63 6f onst start], [co
65d0: 6e 73 74 20 64 6f 6e 65 5d 2c 20 5b 63 6f 6e 73 nst done], [cons
65e0: 74 20 72 65 61 64 5d 2c 0a 5b 63 6f 6e 73 74 20 t read],.[const
65f0: 77 72 69 74 65 5d 2c 20 5b 63 6f 6e 73 74 20 6c write], [const l
6600: 6f 6f 70 5d 2c 20 5b 63 6f 6e 73 74 20 65 78 69 oop], [const exi
6610: 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d t]...[def [arg m
6620: 65 73 73 61 67 65 5d 5d 0a 44 65 73 63 72 69 70 essage]].Descrip
6630: 74 69 76 65 20 6d 65 73 73 61 67 65 20 73 74 72 tive message str
6640: 69 6e 67 20 77 68 69 63 68 20 6d 61 79 20 62 65 ing which may be
6650: 20 67 65 6e 65 72 61 74 65 64 20 65 69 74 68 65 generated eithe
6660: 72 20 62 79 0a 5b 66 75 6e 20 53 53 4c 5f 73 74 r by.[fun SSL_st
6670: 61 74 65 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 ate_string_long(
6680: 29 5d 20 6f 72 20 5b 66 75 6e 20 53 53 4c 5f 61 )] or [fun SSL_a
6690: 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69 6e 67 lert_desc_string
66a0: 5f 6c 6f 6e 67 28 29 5d 2c 0a 64 65 70 65 6e 64 _long()],.depend
66b0: 69 6e 67 20 6f 6e 20 74 68 65 20 63 6f 6e 74 65 ing on the conte
66c0: 78 74 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 74 xt...[def [arg t
66d0: 79 70 65 5d 5d 0a 46 6f 72 20 61 6c 65 72 74 73 ype]].For alerts
66e0: 2c 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20 76 , the possible v
66f0: 61 6c 75 65 73 20 61 72 65 3a 20 5b 63 6f 6e 73 alues are: [cons
6700: 74 20 77 61 72 6e 69 6e 67 5d 2c 0a 5b 63 6f 6e t warning],.[con
6710: 73 74 20 66 61 74 61 6c 5d 2c 20 61 6e 64 20 5b st fatal], and [
6720: 63 6f 6e 73 74 20 75 6e 6b 6e 6f 77 6e 5d 2e 20 const unknown].
6730: 46 6f 72 20 6f 74 68 65 72 73 2c 20 5b 63 6f 6e For others, [con
6740: 73 74 20 69 6e 66 6f 5d 20 69 73 20 75 73 65 64 st info] is used
6750: 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74 20 ..This argument
6760: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c is new for TclTL
6770: 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e S 1.8...[list_en
6780: 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 6d 65 73 d]..[opt_def mes
6790: 73 61 67 65 20 5b 61 72 67 20 22 63 68 61 6e 6e sage [arg "chann
67a0: 65 6c 49 64 20 64 69 72 65 63 74 69 6f 6e 20 76 elId direction v
67b0: 65 72 73 69 6f 6e 20 63 6f 6e 74 65 6e 74 5f 74 ersion content_t
67c0: 79 70 65 20 6d 65 73 73 61 67 65 22 5d 5d 0a 54 ype message"]].T
67d0: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c his form of call
67e0: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 back is invoked
67f0: 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 by the OpenSSL f
6800: 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c unction.[fun SSL
6810: 5f 73 65 74 5f 6d 73 67 5f 63 61 6c 6c 62 61 63 _set_msg_callbac
6820: 6b 28 29 5d 20 77 68 65 6e 65 76 65 72 20 61 20 k()] whenever a
6830: 6d 65 73 73 61 67 65 20 69 73 20 73 65 6e 74 20 message is sent
6840: 6f 72 20 72 65 63 65 69 76 65 64 20 64 75 72 69 or received duri
6850: 6e 67 20 74 68 65 0a 69 6e 69 74 69 61 6c 20 63 ng the.initial c
6860: 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68 61 6e 64 73 onnection, hands
6870: 68 61 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f 70 65 hake, or I/O ope
6880: 72 61 74 69 6f 6e 73 2e 20 49 74 20 69 73 20 6f rations. It is o
6890: 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 77 68 nly available wh
68a0: 65 6e 0a 4f 70 65 6e 53 53 4c 20 69 73 20 63 6f en.OpenSSL is co
68b0: 6d 70 6c 69 65 64 20 77 69 74 68 20 74 68 65 20 mplied with the
68c0: 5b 63 6f 6e 73 74 20 65 6e 61 62 6c 65 2d 73 73 [const enable-ss
68d0: 6c 2d 74 72 61 63 65 5d 20 6f 70 74 69 6f 6e 2e l-trace] option.
68e0: 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 This callback i
68f0: 73 0a 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 s.new for TclTLS
6900: 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d 65 1.8. The argume
6910: 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f nts are:..[list_
6920: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e begin definition
6930: 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 64 69 s]..[def [arg di
6940: 72 65 63 74 69 6f 6e 5d 5d 0a 44 69 72 65 63 74 rection]].Direct
6950: 69 6f 6e 20 69 73 20 65 69 74 68 65 72 20 5b 63 ion is either [c
6960: 6f 6e 73 74 20 53 65 6e 74 5d 20 6f 72 20 5b 63 onst Sent] or [c
6970: 6f 6e 73 74 20 52 65 63 65 69 76 65 64 5d 2e 0a onst Received]..
6980: 0a 5b 64 65 66 20 5b 61 72 67 20 76 65 72 73 69 .[def [arg versi
6990: 6f 6e 5d 5d 0a 56 65 72 73 69 6f 6e 20 69 73 20 on]].Version is
69a0: 74 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 the protocol ver
69b0: 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 sion...[def [arg
69c0: 20 63 6f 6e 74 65 6e 74 5f 74 79 70 65 5d 5d 0a content_type]].
69d0: 43 6f 6e 74 65 6e 74 20 74 79 70 65 20 69 73 20 Content type is
69e0: 74 68 65 20 6d 65 73 73 61 67 65 20 63 6f 6e 74 the message cont
69f0: 65 6e 74 20 74 79 70 65 2e 0a 0a 5b 64 65 66 20 ent type...[def
6a00: 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 5d 0a 4d [arg message]].M
6a10: 65 73 73 61 67 65 20 69 73 20 6d 6f 72 65 20 69 essage is more i
6a20: 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 5b 63 6f nfo from the [co
6a30: 6e 73 74 20 53 53 4c 5f 74 72 61 63 65 5d 20 41 nst SSL_trace] A
6a40: 50 49 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a PI...[list_end].
6a50: 0a 5b 6f 70 74 5f 64 65 66 20 73 65 73 73 69 6f .[opt_def sessio
6a60: 6e 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 n [arg "channelI
6a70: 64 20 73 65 73 73 69 6f 6e 5f 69 64 20 73 65 73 d session_id ses
6a80: 73 69 6f 6e 5f 74 69 63 6b 65 74 20 6c 69 66 65 sion_ticket life
6a90: 74 69 6d 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 time"]].This for
6aa0: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 m of callback is
6ab0: 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20 invoked by the
6ac0: 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e OpenSSL function
6ad0: 0a 5b 66 75 6e 20 53 53 4c 5f 43 54 58 5f 73 65 .[fun SSL_CTX_se
6ae0: 73 73 5f 73 65 74 5f 6e 65 77 5f 63 62 28 29 5d ss_set_new_cb()]
6af0: 20 77 68 65 6e 65 76 65 72 20 61 20 6e 65 77 20 whenever a new
6b00: 73 65 73 73 69 6f 6e 20 69 64 20 69 73 20 73 65 session id is se
6b10: 6e 74 20 62 79 20 74 68 65 0a 73 65 72 76 65 72 nt by the.server
6b20: 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69 74 during the init
6b30: 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61 ial connection a
6b40: 6e 64 20 68 61 6e 64 73 68 61 6b 65 20 61 6e 64 nd handshake and
6b50: 20 61 6c 73 6f 20 64 75 72 69 6e 67 20 74 68 65 also during the
6b60: 20 73 65 73 73 69 6f 6e 0a 69 66 20 74 68 65 20 session.if the
6b70: 5b 6f 70 74 69 6f 6e 20 2d 70 6f 73 74 5f 68 61 [option -post_ha
6b80: 6e 64 73 68 61 6b 65 5d 20 6f 70 74 69 6f 6e 20 ndshake] option
6b90: 69 73 20 73 65 74 20 74 6f 20 74 72 75 65 2e 20 is set to true.
6ba0: 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 This callback is
6bb0: 20 6e 65 77 20 66 6f 72 0a 54 63 6c 54 4c 53 20 new for.TclTLS
6bc0: 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 1.8. The argumen
6bd0: 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 ts are:..[list_b
6be0: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 egin definitions
6bf0: 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 65 73 ]..[def [arg ses
6c00: 73 69 6f 6e 5f 69 64 5d 5d 0a 53 65 73 73 69 6f sion_id]].Sessio
6c10: 6e 20 49 64 20 69 73 20 74 68 65 20 63 75 72 72 n Id is the curr
6c20: 65 6e 74 20 73 65 73 73 69 6f 6e 20 69 64 65 6e ent session iden
6c30: 74 69 66 69 65 72 0a 0a 5b 64 65 66 20 5b 61 72 tifier..[def [ar
6c40: 67 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74 g session_ticket
6c50: 5d 5d 0a 54 69 63 6b 65 74 20 69 73 20 74 68 65 ]].Ticket is the
6c60: 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 session ticket
6c70: 69 6e 66 6f 0a 0a 5b 64 65 66 20 5b 61 72 67 20 info..[def [arg
6c80: 6c 69 66 65 74 69 6d 65 5d 5d 0a 4c 69 66 65 74 lifetime]].Lifet
6c90: 69 6d 65 20 69 73 20 74 68 65 20 74 69 63 6b 65 ime is the ticke
6ca0: 74 20 6c 69 66 65 74 69 6d 65 20 69 6e 20 73 65 t lifetime in se
6cb0: 63 6f 6e 64 73 2e 0a 0a 5b 6c 69 73 74 5f 65 6e conds...[list_en
6cc0: 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 76 65 72 d]..[opt_def ver
6cd0: 69 66 79 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 ify [arg "channe
6ce0: 6c 49 64 20 64 65 70 74 68 20 63 65 72 74 20 73 lId depth cert s
6cf0: 74 61 74 75 73 20 65 72 72 6f 72 22 5d 5d 0a 54 tatus error"]].T
6d00: 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 61 73 his callback was
6d10: 20 6d 6f 76 65 64 20 74 6f 20 5b 6f 70 74 69 6f moved to [optio
6d20: 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 n -validatecomma
6d30: 6e 64 5d 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e nd] in TclTLS 1.
6d40: 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 8...[list_end]..
6d50: 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56 61 6c [subsection "Val
6d60: 75 65 73 20 66 6f 72 20 50 61 73 73 77 6f 72 64 ues for Password
6d70: 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 Callback"]..The
6d80: 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 callback for th
6d90: 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 e [option -passw
6da0: 6f 72 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69 ord] option is i
6db0: 6e 76 6f 6b 65 64 20 62 79 20 54 63 6c 54 4c 53 nvoked by TclTLS
6dc0: 20 77 68 65 6e 65 76 65 72 20 4f 70 65 6e 53 53 whenever OpenSS
6dd0: 4c 20 6e 65 65 64 73 0a 74 6f 20 6f 62 74 61 69 L needs.to obtai
6de0: 6e 20 61 20 70 61 73 73 77 6f 72 64 2e 20 53 65 n a password. Se
6df0: 65 20 62 65 6c 6f 77 20 66 6f 72 20 74 68 65 20 e below for the
6e00: 70 6f 73 73 69 62 6c 65 20 61 72 67 75 6d 65 6e possible argumen
6e10: 74 73 20 70 61 73 73 65 64 20 74 6f 20 74 68 65 ts passed to the
6e20: 0a 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 .callback script
6e30: 2e 20 54 68 65 20 75 73 65 72 20 70 72 6f 76 69 . The user provi
6e40: 64 65 64 20 70 61 73 73 77 6f 72 64 20 69 73 20 ded password is
6e50: 65 78 70 65 63 74 65 64 20 74 6f 20 62 65 20 72 expected to be r
6e60: 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 0a 63 eturned by the.c
6e70: 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6c 69 73 74 5f allback...[list_
6e80: 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a begin options]..
6e90: 5b 6f 70 74 5f 64 65 66 20 70 61 73 73 77 6f 72 [opt_def passwor
6ea0: 64 20 5b 61 72 67 20 22 72 77 66 6c 61 67 20 73 d [arg "rwflag s
6eb0: 69 7a 65 22 5d 5d 0a 49 6e 76 6f 6b 65 64 20 77 ize"]].Invoked w
6ec0: 68 65 6e 20 6c 6f 61 64 69 6e 67 20 6f 72 20 73 hen loading or s
6ed0: 74 6f 72 69 6e 67 20 61 6e 20 65 6e 63 72 79 70 toring an encryp
6ee0: 74 65 64 20 50 45 4d 20 63 65 72 74 69 66 69 63 ted PEM certific
6ef0: 61 74 65 2e 20 54 68 65 20 61 72 67 75 6d 65 6e ate. The argumen
6f00: 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 ts are:..[list_b
6f10: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 egin definitions
6f20: 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 72 77 66 ]..[def [arg rwf
6f30: 6c 61 67 5d 5d 0a 54 68 65 20 72 65 61 64 2f 77 lag]].The read/w
6f40: 72 69 74 65 20 66 6c 61 67 20 69 73 20 30 20 66 rite flag is 0 f
6f50: 6f 72 20 72 65 61 64 69 6e 67 2f 64 65 63 72 79 or reading/decry
6f60: 70 74 69 6f 6e 20 6f 72 20 31 20 66 6f 72 20 77 ption or 1 for w
6f70: 72 69 74 69 6e 67 2f 65 6e 63 72 79 70 74 69 6f riting/encryptio
6f80: 6e 2e 0a 54 68 65 20 6c 61 74 74 65 72 20 63 61 n..The latter ca
6f90: 6e 20 62 65 20 75 73 65 64 20 74 6f 20 64 65 74 n be used to det
6fa0: 65 72 6d 69 6e 65 20 77 68 65 6e 20 74 6f 20 70 ermine when to p
6fb0: 72 6f 6d 70 74 20 74 68 65 20 75 73 65 72 20 74 rompt the user t
6fc0: 6f 20 63 6f 6e 66 69 72 6d 2e 0a 54 68 69 73 20 o confirm..This
6fd0: 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 argument is new
6fe0: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a for TclTLS 1.8..
6ff0: 0a 5b 64 65 66 20 5b 61 72 67 20 73 69 7a 65 5d .[def [arg size]
7000: 5d 0a 54 68 65 20 73 69 7a 65 20 69 73 20 74 68 ].The size is th
7010: 65 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74 68 e maximum length
7020: 20 6f 66 20 74 68 65 20 70 61 73 73 77 6f 72 64 of the password
7030: 20 69 6e 20 62 79 74 65 73 2e 0a 54 68 69 73 20 in bytes..This
7040: 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 argument is new
7050: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a for TclTLS 1.8..
7060: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 .[list_end]..[li
7070: 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 st_end]..[subsec
7080: 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 tion "Values for
7090: 20 56 61 6c 69 64 61 74 65 20 43 6f 6d 6d 61 6e Validate Comman
70a0: 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 d Callback"]..Th
70b0: 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74 e callback for t
70c0: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 he [option -vali
70d0: 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 datecommand] opt
70e0: 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20 64 ion is invoked d
70f0: 75 72 69 6e 67 20 74 68 65 20 68 61 6e 64 73 68 uring the handsh
7100: 61 6b 65 0a 70 72 6f 63 65 73 73 20 69 6e 20 6f ake.process in o
7110: 72 64 65 72 20 66 6f 72 20 74 68 65 20 61 70 70 rder for the app
7120: 6c 69 63 61 74 69 6f 6e 20 74 6f 20 76 61 6c 69 lication to vali
7130: 64 61 74 65 20 74 68 65 20 70 72 6f 76 69 64 65 date the provide
7140: 64 20 76 61 6c 75 65 28 73 29 2e 20 53 65 65 0a d value(s). See.
7150: 62 65 6c 6f 77 20 66 6f 72 20 74 68 65 20 70 6f below for the po
7160: 73 73 69 62 6c 65 20 61 72 67 75 6d 65 6e 74 73 ssible arguments
7170: 20 70 61 73 73 65 64 20 74 6f 20 74 68 65 20 63 passed to the c
7180: 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 2e 20 allback script.
7190: 49 66 20 6e 6f 74 0a 73 70 65 63 69 66 69 65 64 If not.specified
71a0: 2c 20 4f 70 65 6e 53 53 4c 20 77 69 6c 6c 20 61 , OpenSSL will a
71b0: 63 63 65 70 74 20 61 6c 6c 20 76 61 6c 69 64 20 ccept all valid
71c0: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 6e 64 certificates and
71d0: 20 65 78 74 65 6e 73 69 6f 6e 73 2e 20 54 6f 20 extensions. To
71e0: 72 65 6a 65 63 74 0a 74 68 65 20 76 61 6c 75 65 reject.the value
71f0: 20 61 6e 64 20 61 62 6f 72 74 20 74 68 65 20 63 and abort the c
7200: 6f 6e 6e 65 63 74 69 6f 6e 2c 20 74 68 65 20 63 onnection, the c
7210: 61 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 allback should r
7220: 65 74 75 72 6e 20 30 2e 20 54 6f 20 61 63 63 65 eturn 0. To acce
7230: 70 74 20 74 68 65 0a 76 61 6c 75 65 20 61 6e 64 pt the.value and
7240: 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 63 6f continue the co
7250: 6e 6e 65 63 74 69 6f 6e 2c 20 69 74 20 73 68 6f nnection, it sho
7260: 75 6c 64 20 72 65 74 75 72 6e 20 31 2e 20 54 6f uld return 1. To
7270: 20 72 65 6a 65 63 74 20 74 68 65 20 76 61 6c 75 reject the valu
7280: 65 2c 20 62 75 74 0a 63 6f 6e 74 69 6e 75 65 20 e, but.continue
7290: 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 the connection,
72a0: 69 74 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e it should return
72b0: 20 32 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63 2. This callbac
72c0: 6b 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c k is new for Tcl
72d0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f TLS 1.8...[list_
72e0: 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a begin options]..
72f0: 5b 6f 70 74 5f 64 65 66 20 61 6c 70 6e 20 5b 61 [opt_def alpn [a
7300: 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 70 72 rg "channelId pr
7310: 6f 74 6f 63 6f 6c 20 6d 61 74 63 68 22 5d 5d 0a otocol match"]].
7320: 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68 69 For servers, thi
7330: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 s form of callba
7340: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 ck is invoked wh
7350: 65 6e 20 74 68 65 20 63 6c 69 65 6e 74 20 41 4c en the client AL
7360: 50 4e 20 65 78 74 65 6e 73 69 6f 6e 20 69 73 0a PN extension is.
7370: 72 65 63 65 69 76 65 64 2e 20 49 66 20 5b 61 72 received. If [ar
7380: 67 20 6d 61 74 63 68 5d 20 69 73 20 74 72 75 65 g match] is true
7390: 2c 20 74 68 65 6e 20 5b 61 72 67 20 70 72 6f 74 , then [arg prot
73a0: 6f 63 6f 6c 5d 20 69 73 20 74 68 65 20 66 69 72 ocol] is the fir
73b0: 73 74 0a 5b 6f 70 74 69 6f 6e 20 2d 61 6c 70 6e st.[option -alpn
73c0: 5d 20 70 72 6f 74 6f 63 6f 6c 20 6f 70 74 69 6f ] protocol optio
73d0: 6e 20 69 6e 20 63 6f 6d 6d 6f 6e 20 74 6f 20 62 n in common to b
73e0: 6f 74 68 20 74 68 65 20 63 6c 69 65 6e 74 20 61 oth the client a
73f0: 6e 64 20 73 65 72 76 65 72 2e 0a 49 66 20 6e 6f nd server..If no
7400: 74 2c 20 74 68 65 20 66 69 72 73 74 20 63 6c 69 t, the first cli
7410: 65 6e 74 20 73 70 65 63 69 66 69 65 64 20 70 72 ent specified pr
7420: 6f 74 6f 63 6f 6c 20 69 73 20 75 73 65 64 2e 20 otocol is used.
7430: 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 This callback is
7440: 20 63 61 6c 6c 65 64 0a 61 66 74 65 72 20 74 68 called.after th
7450: 65 20 48 65 6c 6c 6f 20 61 6e 64 20 41 4c 50 4e e Hello and ALPN
7460: 20 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f 70 callbacks...[op
7470: 74 5f 64 65 66 20 68 65 6c 6c 6f 20 5b 61 72 67 t_def hello [arg
7480: 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 72 76 "channelId serv
7490: 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f 72 20 73 65 ername"]].For se
74a0: 72 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72 6d rvers, this form
74b0: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 of callback is
74c0: 69 6e 76 6f 6b 65 64 20 64 75 72 69 6e 67 20 63 invoked during c
74d0: 6c 69 65 6e 74 20 68 65 6c 6c 6f 20 6d 65 73 73 lient hello mess
74e0: 61 67 65 0a 70 72 6f 63 65 73 73 69 6e 67 2e 20 age.processing.
74f0: 54 68 65 20 70 75 72 70 6f 73 65 20 69 73 20 73 The purpose is s
7500: 6f 20 74 68 65 20 73 65 72 76 65 72 20 63 61 6e o the server can
7510: 20 73 65 6c 65 63 74 20 74 68 65 20 61 70 70 72 select the appr
7520: 6f 70 72 69 61 74 65 20 63 65 72 74 69 66 69 63 opriate certific
7530: 61 74 65 0a 74 6f 20 70 72 65 73 65 6e 74 20 74 ate.to present t
7540: 6f 20 74 68 65 20 63 6c 69 65 6e 74 2c 20 61 6e o the client, an
7550: 64 20 74 6f 20 6d 61 6b 65 20 6f 74 68 65 72 20 d to make other
7560: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 61 64 configuration ad
7570: 6a 75 73 74 6d 65 6e 74 73 20 72 65 6c 65 76 61 justments releva
7580: 6e 74 0a 74 6f 20 74 68 61 74 20 73 65 72 76 65 nt.to that serve
7590: 72 20 6e 61 6d 65 20 61 6e 64 20 69 74 73 20 63 r name and its c
75a0: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 20 49 74 onfiguration. It
75b0: 20 69 73 20 63 61 6c 6c 65 64 20 62 65 66 6f 72 is called befor
75c0: 65 20 74 68 65 20 53 4e 49 20 61 6e 64 20 41 4c e the SNI and AL
75d0: 50 4e 0a 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b PN.callbacks...[
75e0: 6f 70 74 5f 64 65 66 20 73 6e 69 20 5b 61 72 67 opt_def sni [arg
75f0: 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 72 76 "channelId serv
7600: 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f 72 20 73 65 ername"]].For se
7610: 72 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72 6d rvers, this form
7620: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 of callback is
7630: 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 74 68 65 invoked when the
7640: 20 53 65 72 76 65 72 20 4e 61 6d 65 20 49 6e 64 Server Name Ind
7650: 69 63 61 74 69 6f 6e 0a 28 53 4e 49 29 20 65 78 ication.(SNI) ex
7660: 74 65 6e 73 69 6f 6e 20 69 73 20 72 65 63 65 69 tension is recei
7670: 76 65 64 2e 20 54 68 65 20 5b 61 72 67 20 73 65 ved. The [arg se
7680: 72 76 65 72 6e 61 6d 65 5d 20 61 72 67 75 6d 65 rvername] argume
7690: 6e 74 20 69 73 20 74 68 65 20 63 6c 69 65 6e 74 nt is the client
76a0: 0a 70 72 6f 76 69 64 65 64 20 73 65 72 76 65 72 .provided server
76b0: 20 6e 61 6d 65 20 73 70 65 63 69 66 69 65 64 20 name specified
76c0: 69 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d in the [option -
76d0: 73 65 72 76 65 72 6e 61 6d 65 3c 2f 62 3e 5d 20 servername</b>]
76e0: 6f 70 74 69 6f 6e 2e 20 54 68 65 0a 70 75 72 70 option. The.purp
76f0: 6f 73 65 20 69 73 20 73 6f 20 77 68 65 6e 20 61 ose is so when a
7700: 20 73 65 72 76 65 72 20 73 75 70 70 6f 72 74 73 server supports
7710: 20 6d 75 6c 74 69 70 6c 65 20 6e 61 6d 65 73 2c multiple names,
7720: 20 74 68 65 20 72 69 67 68 74 20 63 65 72 74 69 the right certi
7730: 66 69 63 61 74 65 0a 63 61 6e 20 62 65 20 75 73 ficate.can be us
7740: 65 64 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64 ed. It is called
7750: 20 61 66 74 65 72 20 74 68 65 20 68 65 6c 6c 6f after the hello
7760: 20 63 61 6c 6c 62 61 63 6b 20 62 75 74 20 62 65 callback but be
7770: 66 6f 72 65 20 74 68 65 20 41 4c 50 4e 0a 63 61 fore the ALPN.ca
7780: 6c 6c 62 61 63 6b 2e 0a 0a 5b 6f 70 74 5f 64 65 llback...[opt_de
7790: 66 20 76 65 72 69 66 79 20 5b 61 72 67 20 22 63 f verify [arg "c
77a0: 68 61 6e 6e 65 6c 49 64 20 64 65 70 74 68 20 63 hannelId depth c
77b0: 65 72 74 20 73 74 61 74 75 73 20 65 72 72 6f 72 ert status error
77c0: 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 "]].This form of
77d0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 callback is inv
77e0: 6f 6b 65 64 20 62 79 20 4f 70 65 6e 53 53 4c 20 oked by OpenSSL
77f0: 77 68 65 6e 20 61 20 6e 65 77 20 63 65 72 74 69 when a new certi
7800: 66 69 63 61 74 65 20 69 73 20 72 65 63 65 69 76 ficate is receiv
7810: 65 64 0a 66 72 6f 6d 20 74 68 65 20 70 65 65 72 ed.from the peer
7820: 2e 20 49 74 20 61 6c 6c 6f 77 73 20 74 68 65 20 . It allows the
7830: 63 6c 69 65 6e 74 20 74 6f 20 63 68 65 63 6b 20 client to check
7840: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 the certificate
7850: 76 65 72 69 66 69 63 61 74 69 6f 6e 0a 72 65 73 verification.res
7860: 75 6c 74 73 20 61 6e 64 20 63 68 6f 6f 73 65 20 ults and choose
7870: 77 68 65 74 68 65 72 20 74 6f 20 63 6f 6e 74 69 whether to conti
7880: 6e 75 65 20 6f 72 20 6e 6f 74 2e 20 49 74 20 69 nue or not. It i
7890: 73 20 63 61 6c 6c 65 64 20 66 6f 72 20 65 61 63 s called for eac
78a0: 68 0a 63 65 72 74 69 66 69 63 61 74 65 20 69 6e h.certificate in
78b0: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 the certificate
78c0: 20 63 68 61 69 6e 2e 20 54 68 69 73 20 63 61 6c chain. This cal
78d0: 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65 64 20 lback was moved
78e0: 66 72 6f 6d 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f from.[option -co
78f0: 6d 6d 61 6e 64 5d 20 69 6e 20 54 63 6c 54 4c 53 mmand] in TclTLS
7900: 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d 65 1.8. The argume
7910: 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f nts are:..[list_
7920: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e begin definition
7930: 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 64 65 s]..[def [arg de
7940: 70 74 68 5d 5d 0a 54 68 65 20 64 65 70 74 68 20 pth]].The depth
7950: 69 73 20 74 68 65 20 69 6e 74 65 67 65 72 20 64 is the integer d
7960: 65 70 74 68 20 6f 66 20 74 68 65 20 63 65 72 74 epth of the cert
7970: 69 66 69 63 61 74 65 20 69 6e 20 74 68 65 20 63 ificate in the c
7980: 65 72 74 69 66 69 63 61 74 65 20 63 68 61 69 6e ertificate chain
7990: 2c 0a 77 68 65 72 65 20 30 20 69 73 20 74 68 65 ,.where 0 is the
79a0: 20 70 65 65 72 20 63 65 72 74 69 66 69 63 61 74 peer certificat
79b0: 65 20 61 6e 64 20 68 69 67 68 65 72 20 76 61 6c e and higher val
79c0: 75 65 73 20 67 6f 69 6e 67 20 75 70 20 74 6f 20 ues going up to
79d0: 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 0a the Certificate.
79e0: 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 2e 0a Authority (CA)..
79f0: 0a 5b 64 65 66 20 5b 61 72 67 20 63 65 72 74 5d .[def [arg cert]
7a00: 5d 0a 54 68 65 20 63 65 72 74 20 61 72 67 75 6d ].The cert argum
7a10: 65 6e 74 20 69 73 20 61 20 6c 69 73 74 20 6f 66 ent is a list of
7a20: 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73 key-value pairs
7a30: 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 6f 73 similar to thos
7a40: 65 20 72 65 74 75 72 6e 65 64 20 62 79 0a 5b 63 e returned by.[c
7a50: 6d 64 20 74 6c 73 3a 3a 73 74 61 74 75 73 5d 2e md tls::status].
7a60: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 74 61 74 ..[def [arg stat
7a70: 75 73 5d 5d 0a 54 68 65 20 73 74 61 74 75 73 20 us]].The status
7a80: 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20 argument is the
7a90: 62 6f 6f 6c 65 61 6e 20 76 61 6c 69 64 69 74 79 boolean validity
7aa0: 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e 74 20 of the current
7ab0: 63 65 72 74 69 66 69 63 61 74 65 20 77 68 65 72 certificate wher
7ac0: 65 20 30 0a 69 73 20 69 6e 76 61 6c 69 64 20 61 e 0.is invalid a
7ad0: 6e 64 20 31 20 69 73 20 76 61 6c 69 64 2e 0a 0a nd 1 is valid...
7ae0: 5b 64 65 66 20 5b 61 72 67 20 65 72 72 6f 72 5d [def [arg error]
7af0: 5d 0a 54 68 65 20 65 72 72 6f 72 20 61 72 67 75 ].The error argu
7b00: 6d 65 6e 74 20 69 73 20 74 68 65 20 65 72 72 6f ment is the erro
7b10: 72 20 6d 65 73 73 61 67 65 2c 20 69 66 20 61 6e r message, if an
7b20: 79 2c 20 67 65 6e 65 72 61 74 65 64 20 62 79 0a y, generated by.
7b30: 5b 66 75 6e 20 58 35 30 39 5f 53 54 4f 52 45 5f [fun X509_STORE_
7b40: 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28 29 5d CTX_get_error()]
7b50: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b ...[list_end]..[
7b60: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 52 65 66 65 72 list_end]..Refer
7b70: 65 6e 63 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 ence implementat
7b80: 69 6f 6e 73 20 6f 66 20 74 68 65 73 65 20 63 61 ions of these ca
7b90: 6c 6c 62 61 63 6b 73 20 61 72 65 20 70 72 6f 76 llbacks are prov
7ba0: 69 64 65 64 20 69 6e 20 5b 66 69 6c 65 20 74 6c ided in [file tl
7bb0: 73 2e 74 63 6c 5d 0a 61 73 20 5b 63 6d 64 20 74 s.tcl].as [cmd t
7bc0: 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b ls::callback], [
7bd0: 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 cmd tls::passwor
7be0: 64 5d 2c 20 61 6e 64 20 5b 63 6d 64 20 74 6c 73 d], and [cmd tls
7bf0: 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 ::validate_comma
7c00: 6e 64 5d 0a 72 65 73 70 65 63 74 69 76 65 6c 79 nd].respectively
7c10: 2e 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 73 . Note that thes
7c20: 65 20 61 72 65 20 6f 6e 6c 79 20 5b 65 6d 70 68 e are only [emph
7c30: 20 73 61 6d 70 6c 65 5d 20 69 6d 70 6c 65 6d 65 sample] impleme
7c40: 6e 74 61 74 69 6f 6e 73 2e 20 49 6e 20 61 20 6d ntations. In a m
7c50: 6f 72 65 0a 72 65 61 6c 69 73 74 69 63 20 64 65 ore.realistic de
7c60: 70 6c 6f 79 6d 65 6e 74 20 79 6f 75 20 77 6f 75 ployment you wou
7c70: 6c 64 20 73 70 65 63 69 66 79 20 79 6f 75 72 20 ld specify your
7c80: 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 own callback scr
7c90: 69 70 74 73 20 6f 6e 20 65 61 63 68 20 54 4c 53 ipts on each TLS
7ca0: 0a 63 68 61 6e 6e 65 6c 20 75 73 69 6e 67 20 74 .channel using t
7cb0: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d he [option -comm
7cc0: 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 70 and], [option -p
7cd0: 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b 6f assword], and.[o
7ce0: 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f ption -validate_
7cf0: 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 73 command] options
7d00: 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68 65 20 64 ...[para]..The d
7d10: 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72 20 efault behavior
7d20: 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e when the [option
7d30: 20 2d 63 6f 6d 6d 61 6e 64 5d 20 61 6e 64 20 5b -command] and [
7d40: 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 option -validate
7d50: 5f 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e _command].option
7d60: 73 20 61 72 65 20 6e 6f 74 20 73 70 65 63 69 66 s are not specif
7d70: 69 65 64 2c 20 69 73 20 66 6f 72 20 54 63 6c 54 ied, is for TclT
7d80: 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 LS to process th
7d90: 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69 62 e associated lib
7da0: 72 61 72 79 0a 63 61 6c 6c 62 61 63 6b 73 20 69 rary.callbacks i
7db0: 6e 74 65 72 6e 61 6c 6c 79 2e 20 54 68 65 20 64 nternally. The d
7dc0: 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72 20 efault behavior
7dd0: 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e when the [option
7de0: 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74 69 -password] opti
7df0: 6f 6e 0a 69 73 20 6e 6f 74 20 73 70 65 63 69 66 on.is not specif
7e00: 69 65 64 20 69 73 20 66 6f 72 20 54 63 6c 54 4c ied is for TclTL
7e10: 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 65 S to process the
7e20: 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69 62 72 associated libr
7e30: 61 72 79 20 63 61 6c 6c 62 61 63 6b 73 20 62 79 ary callbacks by
7e40: 0a 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 .attempting to c
7e50: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 all [cmd tls::pa
7e60: 73 73 77 6f 72 64 5d 2e 20 54 68 65 20 64 69 66 ssword]. The dif
7e70: 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 ference between
7e80: 74 68 65 73 65 20 74 77 6f 0a 62 65 68 61 76 69 these two.behavi
7e90: 6f 72 73 20 69 73 20 61 20 63 6f 6e 73 65 71 75 ors is a consequ
7ea0: 65 6e 63 65 20 6f 66 20 6d 61 69 6e 74 61 69 6e ence of maintain
7eb0: 69 6e 67 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 ing compatibilit
7ec0: 79 20 77 69 74 68 20 65 61 72 6c 69 65 72 0a 69 y with earlier.i
7ed0: 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a mplementations..
7ee0: 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70 68 20 22 .[para]..[emph "
7ef0: 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 72 The use of the r
7f00: 65 66 65 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 eference callbac
7f10: 6b 73 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c ks [cmd tls::cal
7f20: 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 lback], [cmd tls
7f30: 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 0a 61 6e 64 ::password],.and
7f40: 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 [cmd tls::valid
7f50: 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 69 73 20 ate_command] is
7f60: 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e not recommended.
7f70: 20 54 68 65 79 20 6d 61 79 20 62 65 20 72 65 6d They may be rem
7f80: 6f 76 65 64 20 66 72 6f 6d 20 66 75 74 75 72 65 oved from future
7f90: 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b 73 releases."]..[s
7fa0: 65 63 74 69 6f 6e 20 44 65 62 75 67 5d 0a 0a 46 ection Debug]..F
7fb0: 6f 72 20 6d 6f 73 74 20 64 65 62 75 67 67 69 6e or most debuggin
7fc0: 67 20 6e 65 65 64 73 2c 20 74 68 65 20 5b 6f 70 g needs, the [op
7fd0: 74 69 6f 6e 20 2d 63 61 6c 6c 62 61 63 6b 5d 20 tion -callback]
7fe0: 6f 70 74 69 6f 6e 20 63 61 6e 20 62 65 20 75 73 option can be us
7ff0: 65 64 20 74 6f 20 70 72 6f 76 69 64 65 0a 73 75 ed to provide.su
8000: 66 66 69 63 69 65 6e 74 20 69 6e 73 69 67 68 74 fficient insight
8010: 20 61 6e 64 20 69 6e 66 6f 72 6d 61 74 69 6f 6e and information
8020: 20 6f 6e 20 74 68 65 20 54 4c 53 20 68 61 6e 64 on the TLS hand
8030: 73 68 61 6b 65 20 61 6e 64 20 70 72 6f 67 72 65 shake and progre
8040: 73 73 2e 20 49 66 0a 66 75 72 74 68 65 72 20 74 ss. If.further t
8050: 72 6f 75 62 6c 65 73 68 6f 6f 74 69 6e 67 20 69 roubleshooting i
8060: 6e 73 69 67 68 74 20 69 73 20 6e 65 65 64 65 64 nsight is needed
8070: 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 20 74 69 , the compile ti
8080: 6d 65 20 6f 70 74 69 6f 6e 0a 5b 6f 70 74 69 6f me option.[optio
8090: 6e 20 2d 2d 65 6e 61 62 6c 65 2d 64 65 62 75 67 n --enable-debug
80a0: 5d 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f ] can be used to
80b0: 20 67 65 74 20 64 65 74 61 69 6c 65 64 20 65 78 get detailed ex
80c0: 65 63 75 74 69 6f 6e 20 66 6c 6f 77 20 73 74 61 ecution flow sta
80d0: 74 75 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 4c tus...[para]..TL
80e0: 53 20 6b 65 79 20 6c 6f 67 67 69 6e 67 20 63 61 S key logging ca
80f0: 6e 20 62 65 20 65 6e 61 62 6c 65 64 20 62 79 20 n be enabled by
8100: 73 65 74 74 69 6e 67 20 74 68 65 20 65 6e 76 69 setting the envi
8110: 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 ronment variable
8120: 0a 5b 76 61 72 20 53 53 4c 4b 45 59 4c 4f 47 46 .[var SSLKEYLOGF
8130: 49 4c 45 5d 20 74 6f 20 74 68 65 20 6e 61 6d 65 ILE] to the name
8140: 20 6f 66 20 74 68 65 20 66 69 6c 65 20 74 6f 20 of the file to
8150: 6c 6f 67 20 74 6f 2e 20 54 68 65 6e 20 77 68 65 log to. Then whe
8160: 6e 65 76 65 72 20 54 4c 53 20 6b 65 79 0a 6d 61 never TLS key.ma
8170: 74 65 72 69 61 6c 20 69 73 20 67 65 6e 65 72 61 terial is genera
8180: 74 65 64 20 6f 72 20 72 65 63 65 69 76 65 64 20 ted or received
8190: 69 74 20 77 69 6c 6c 20 62 65 20 6c 6f 67 67 65 it will be logge
81a0: 64 20 74 6f 20 74 68 65 20 66 69 6c 65 2e 20 54 d to the file. T
81b0: 68 69 73 20 69 73 20 75 73 65 66 75 6c 0a 66 6f his is useful.fo
81c0: 72 20 6c 6f 67 67 69 6e 67 20 6b 65 79 20 64 61 r logging key da
81d0: 74 61 20 66 6f 72 20 6e 65 74 77 6f 72 6b 20 6c ta for network l
81e0: 6f 67 67 69 6e 67 20 74 6f 6f 6c 73 20 74 6f 20 ogging tools to
81f0: 75 73 65 20 74 6f 20 64 65 63 72 79 70 74 20 74 use to decrypt t
8200: 68 65 20 64 61 74 61 2e 0a 0a 5b 70 61 72 61 5d he data...[para]
8210: 0a 0a 54 68 65 20 5b 76 61 72 20 74 6c 73 3a 3a ..The [var tls::
8220: 64 65 62 75 67 5d 20 76 61 72 69 61 62 6c 65 20 debug] variable
8230: 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61 64 provides some ad
8240: 64 69 74 69 6f 6e 61 6c 20 63 6f 6e 74 72 6f 6c ditional control
8250: 20 6f 76 65 72 20 74 68 65 0a 64 65 62 75 67 20 over the.debug
8260: 6c 6f 67 67 69 6e 67 20 69 6e 20 74 68 65 20 5b logging in the [
8270: 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 cmd tls::callbac
8280: 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 k], [cmd tls::pa
8290: 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b 63 6d ssword], and.[cm
82a0: 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f d tls::validate_
82b0: 63 6f 6d 6d 61 6e 64 5d 20 64 65 66 61 75 6c 74 command] default
82c0: 20 68 61 6e 64 6c 65 72 73 20 69 6e 20 5b 66 69 handlers in [fi
82d0: 6c 65 20 74 6c 73 2e 74 63 6c 5d 2e 0a 54 68 65 le tls.tcl]..The
82e0: 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20 69 default value i
82f0: 73 20 30 20 77 69 74 68 20 68 69 67 68 65 72 20 s 0 with higher
8300: 76 61 6c 75 65 73 20 70 72 6f 64 75 63 69 6e 67 values producing
8310: 20 6d 6f 72 65 20 64 69 61 67 6e 6f 73 74 69 63 more diagnostic
8320: 20 6f 75 74 70 75 74 2c 0a 61 6e 64 20 77 69 6c output,.and wil
8330: 6c 20 61 6c 73 6f 20 66 6f 72 63 65 20 74 68 65 l also force the
8340: 20 76 65 72 69 66 79 20 6d 65 74 68 6f 64 20 69 verify method i
8350: 6e 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c n [cmd tls::call
8360: 62 61 63 6b 5d 20 74 6f 20 61 63 63 65 70 74 20 back] to accept
8370: 74 68 65 0a 63 65 72 74 69 66 69 63 61 74 65 2c the.certificate,
8380: 20 65 76 65 6e 20 69 66 20 69 74 20 69 73 20 69 even if it is i
8390: 6e 76 61 6c 69 64 20 77 68 65 6e 20 74 68 65 20 nvalid when the
83a0: 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 [option -validat
83b0: 65 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e ecommand].option
83c0: 20 69 73 20 73 65 74 20 74 6f 20 5b 63 6d 64 20 is set to [cmd
83d0: 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f tls::validate_co
83e0: 6d 6d 61 6e 64 5d 2e 0a 0a 5b 70 61 72 61 5d 0a mmand]...[para].
83f0: 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65 20 .[emph "The use
8400: 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 of the variable
8410: 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62 75 67 5d [var tls::debug]
8420: 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e is not recommen
8430: 64 65 64 2e 0a 49 74 20 6d 61 79 20 62 65 20 72 ded..It may be r
8440: 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75 74 75 emoved from futu
8450: 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a 0a re releases."]..
8460: 5b 73 65 63 74 69 6f 6e 20 22 48 54 54 50 20 50 [section "HTTP P
8470: 61 63 6b 61 67 65 20 45 78 61 6d 70 6c 65 73 22 ackage Examples"
8480: 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 ]..The following
8490: 20 61 72 65 20 65 78 61 6d 70 6c 65 20 73 63 72 are example scr
84a0: 69 70 74 73 20 74 6f 20 64 6f 77 6e 6c 6f 61 64 ipts to download
84b0: 20 61 20 77 65 62 70 61 67 65 20 61 6e 64 20 66 a webpage and f
84c0: 69 6c 65 20 75 73 69 6e 67 20 74 68 65 0a 68 74 ile using the.ht
84d0: 74 70 20 70 61 63 6b 61 67 65 2e 20 53 65 65 20 tp package. See
84e0: 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69 66 [sectref "Certif
84f0: 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e icate Validation
8500: 22 5d 20 66 6f 72 20 77 68 65 74 68 65 72 20 74 "] for whether t
8510: 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 he.[option -cadi
8520: 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 r], [option -caf
8530: 69 6c 65 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f ile], and [optio
8540: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69 n -castore] opti
8550: 6f 6e 73 20 61 72 65 20 61 6c 73 6f 0a 6e 65 65 ons are also.nee
8560: 64 65 64 2e 20 53 65 65 20 74 68 65 20 64 65 6d ded. See the dem
8570: 6f 73 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 os directory for
8580: 20 6d 6f 72 65 20 65 78 61 6d 70 6c 65 20 73 63 more example sc
8590: 72 69 70 74 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a ripts...[para]..
85a0: 45 78 61 6d 70 6c 65 20 23 31 3a 20 44 6f 77 6e Example #1: Down
85b0: 6c 6f 61 64 20 61 20 77 65 62 20 70 61 67 65 0a load a web page.
85c0: 0a 5b 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 .[example {..pac
85d0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 68 74 74 kage require htt
85e0: 70 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 p.package requir
85f0: 65 20 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 e tls..set url "
8600: 68 74 74 70 73 3a 2f 2f 77 77 77 2e 74 63 6c 2e https://www.tcl.
8610: 74 6b 2f 22 0a 68 74 74 70 3a 3a 72 65 67 69 73 tk/".http::regis
8620: 74 65 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c ter https 443 [l
8630: 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 ist ::tls::socke
8640: 74 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d t -autoservernam
8650: 65 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d 0a e 1 -require 1].
8660: 0a 23 20 47 65 74 20 55 52 4c 0a 73 65 74 20 74 .# Get URL.set t
8670: 6f 6b 65 6e 20 5b 68 74 74 70 3a 3a 67 65 74 75 oken [http::getu
8680: 72 6c 20 24 75 72 6c 5d 0a 0a 23 20 43 68 65 63 rl $url]..# Chec
8690: 6b 20 66 6f 72 20 65 72 72 6f 72 0a 69 66 20 7b k for error.if {
86a0: 5b 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 [http::status $t
86b0: 6f 6b 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b oken] ne "ok"} {
86c0: 0a 20 20 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 . puts [forma
86d0: 74 20 22 45 72 72 6f 72 20 25 73 22 20 5b 68 74 t "Error %s" [ht
86e0: 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 tp::status $toke
86f0: 6e 5d 5d 0a 7d 0a 0a 23 20 53 61 76 65 20 77 65 n]].}..# Save we
8700: 62 20 70 61 67 65 20 74 6f 20 66 69 6c 65 0a 73 b page to file.s
8710: 65 74 20 63 68 20 5b 6f 70 65 6e 20 65 78 61 6d et ch [open exam
8720: 70 6c 65 2e 68 74 6d 6c 20 77 62 5d 0a 70 75 74 ple.html wb].put
8730: 73 20 24 63 68 20 5b 68 74 74 70 3a 3a 64 61 74 s $ch [http::dat
8740: 61 20 24 74 6f 6b 65 6e 5d 0a 63 6c 6f 73 65 20 a $token].close
8750: 24 63 68 0a 0a 23 20 43 6c 65 61 6e 75 70 0a 3a $ch..# Cleanup.:
8760: 3a 68 74 74 70 3a 3a 63 6c 65 61 6e 75 70 20 24 :http::cleanup $
8770: 74 6f 6b 65 6e 0a 7d 5d 0a 0a 45 78 61 6d 70 6c token.}]..Exampl
8780: 65 20 23 32 3a 20 44 6f 77 6e 6c 6f 61 64 20 61 e #2: Download a
8790: 20 66 69 6c 65 0a 0a 5b 65 78 61 6d 70 6c 65 20 file..[example
87a0: 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 {..package requi
87b0: 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67 65 20 re http.package
87c0: 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 73 65 74 require tls..set
87d0: 20 75 72 6c 20 22 68 74 74 70 73 3a 2f 2f 77 69 url "https://wi
87e0: 6b 69 2e 74 63 6c 2d 6c 61 6e 67 2e 6f 72 67 2f ki.tcl-lang.org/
87f0: 73 69 74 65 6d 61 70 2e 78 6d 6c 22 0a 68 74 74 sitemap.xml".htt
8800: 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74 70 p::register http
8810: 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c s 443 [list ::tl
8820: 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73 s::socket -autos
8830: 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 72 65 71 ervername 1 -req
8840: 75 69 72 65 20 31 5d 0a 0a 23 20 4f 70 65 6e 20 uire 1]..# Open
8850: 6f 75 74 70 75 74 20 66 69 6c 65 0a 73 65 74 20 output file.set
8860: 66 69 6c 65 6e 61 6d 65 20 5b 66 69 6c 65 20 74 filename [file t
8870: 61 69 6c 20 24 75 72 6c 5d 0a 73 65 74 20 63 68 ail $url].set ch
8880: 20 5b 6f 70 65 6e 20 24 66 69 6c 65 6e 61 6d 65 [open $filename
8890: 20 77 62 5d 0a 0a 23 20 47 65 74 20 66 69 6c 65 wb]..# Get file
88a0: 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 3a 3a 68 74 .set token [::ht
88b0: 74 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c 20 tp::geturl $url
88c0: 2d 62 6c 6f 63 6b 73 69 7a 65 20 36 35 35 33 36 -blocksize 65536
88d0: 20 2d 63 68 61 6e 6e 65 6c 20 24 63 68 5d 0a 0a -channel $ch]..
88e0: 23 20 43 68 65 63 6b 20 66 6f 72 20 65 72 72 6f # Check for erro
88f0: 72 0a 69 66 20 7b 5b 68 74 74 70 3a 3a 73 74 61 r.if {[http::sta
8900: 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e 65 20 22 tus $token] ne "
8910: 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75 74 73 20 ok"} {. puts
8920: 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f 72 20 25 [format "Error %
8930: 73 22 20 5b 68 74 74 70 3a 3a 73 74 61 74 75 73 s" [http::status
8940: 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23 20 43 $token]].}..# C
8950: 6c 65 61 6e 75 70 0a 63 6c 6f 73 65 20 24 63 68 leanup.close $ch
8960: 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65 61 6e 75 70 .::http::cleanup
8970: 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 5b 73 65 63 $token.}]..[sec
8980: 74 69 6f 6e 20 22 53 70 65 63 69 61 6c 20 43 6f tion "Special Co
8990: 6e 73 69 64 65 72 61 74 69 6f 6e 73 22 5d 0a 0a nsiderations"]..
89a0: 54 68 65 20 63 61 70 61 62 69 6c 69 74 69 65 73 The capabilities
89b0: 20 6f 66 20 74 68 69 73 20 70 61 63 6b 61 67 65 of this package
89c0: 20 63 61 6e 20 76 61 72 79 20 65 6e 6f 72 6d 6f can vary enormo
89d0: 75 73 6c 79 20 62 61 73 65 64 20 75 70 6f 6e 20 usly based upon
89e0: 68 6f 77 20 74 68 65 0a 6c 69 6e 6b 65 64 20 74 how the.linked t
89f0: 6f 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 o OpenSSL librar
8a00: 79 20 77 61 73 20 63 6f 6e 66 69 67 75 72 65 64 y was configured
8a10: 20 61 6e 64 20 62 75 69 6c 74 2e 20 4e 65 77 20 and built. New
8a20: 76 65 72 73 69 6f 6e 73 20 6d 61 79 20 6f 62 73 versions may obs
8a30: 6f 6c 65 74 65 0a 6f 6c 64 65 72 20 70 72 6f 74 olete.older prot
8a40: 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 73 2c 20 61 ocol versions, a
8a50: 64 64 20 6f 72 20 72 65 6d 6f 76 65 20 63 69 70 dd or remove cip
8a60: 68 65 72 73 2c 20 63 68 61 6e 67 65 20 64 65 66 hers, change def
8a70: 61 75 6c 74 20 76 61 6c 75 65 73 2c 20 65 74 63 ault values, etc
8a80: 2e 0a 55 73 65 20 74 68 65 20 5b 63 6d 64 20 74 ..Use the [cmd t
8a90: 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 ls::protocols] c
8aa0: 6f 6d 6d 61 6e 64 73 20 74 6f 20 6f 62 74 61 69 ommands to obtai
8ab0: 6e 20 74 68 65 20 73 75 70 70 6f 72 74 65 64 0a n the supported.
8ac0: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e protocol version
8ad0: 73 2e 0a 0a 5b 6d 61 6e 70 61 67 65 5f 65 6e 64 s...[manpage_end
8ae0: 5d 0a ].