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 32 2e 30 2e 31 5d 0a 5b 63 tls n 2.0.1].[c
0110: 61 74 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f ategory tls].[co
0120: 70 79 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61 pyright {1999 Ma
0130: 74 74 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70 tt Newman}].[cop
0140: 79 72 69 67 68 74 20 7b 32 30 30 34 20 53 74 61 yright {2004 Sta
0150: 72 66 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a rfish Systems}].
0160: 5b 63 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34 [copyright {2024
0170: 20 42 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d Brian O'Hagan}]
0180: 0a 5b 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49 .[keywords tls I
0190: 2f 4f 20 22 49 50 20 41 64 64 72 65 73 73 22 20 /O "IP Address"
01a0: 4f 70 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20 OpenSSL SSL TCP
01b0: 54 4c 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75 TLS "asynchronou
01c0: 73 20 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74 s I/O" bind cert
01d0: 69 66 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20 ificate channel
01e0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61 connection "doma
01f0: 69 6e 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68 in name" host "h
0200: 74 74 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61 ttps" "network a
0210: 64 64 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20 ddress" network
0220: 73 6f 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b socket TclTLS].[
0230: 6d 6f 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53 moddesc {Tcl TLS
0240: 20 65 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65 extension}].[se
0250: 65 5f 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b e_also http sock
0260: 65 74 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f et [uri https://
0270: 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f www.openssl.org/
0280: 20 4f 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c OpenSSL]].[titl
0290: 65 64 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74 edesc {binding t
02a0: 6f 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69 o the OpenSSL li
02b0: 62 72 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70 brary for encryp
02c0: 74 65 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49 ted socket and I
02d0: 2f 4f 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75 /O channel commu
02e0: 6e 69 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71 nications}].[req
02f0: 75 69 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b uire Tcl 8.5-].[
0300: 72 65 71 75 69 72 65 20 74 6c 73 20 32 2e 30 2e require tls 2.0.
0310: 31 5d 0a 5b 64 65 73 63 72 69 70 74 69 6f 6e 5d 1].[description]
0320: 0a 0a 54 68 69 73 20 65 78 74 65 6e 73 69 6f 6e ..This extension
0330: 20 70 72 6f 76 69 64 65 73 20 54 43 4c 20 73 63 provides TCL sc
0340: 72 69 70 74 20 61 63 63 65 73 73 20 74 6f 20 53 ript access to S
0350: 65 63 75 72 65 20 53 6f 63 6b 65 74 20 4c 61 79 ecure Socket Lay
0360: 65 72 20 28 53 53 4c 29 0a 63 6f 6d 6d 75 6e 69 er (SSL).communi
0370: 63 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 74 68 cations using th
0380: 65 20 54 72 61 6e 73 70 6f 72 74 20 4c 61 79 65 e Transport Laye
0390: 72 20 53 65 63 75 72 69 74 79 20 28 54 4c 53 29 r Security (TLS)
03a0: 20 70 72 6f 74 6f 63 6f 6c 2e 20 49 74 20 70 72 protocol. It pr
03b0: 6f 76 69 64 65 73 20 61 0a 67 65 6e 65 72 69 63 ovides a.generic
03c0: 20 62 69 6e 64 69 6e 67 20 74 6f 20 5b 75 72 69 binding to [uri
03d0: 20 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 6f 70 "https://www.op
03e0: 65 6e 73 73 6c 2e 6f 72 67 2f 22 20 4f 70 65 6e enssl.org/" Open
03f0: 53 53 4c 5d 2c 20 75 74 69 6c 69 7a 69 6e 67 20 SSL], utilizing
0400: 74 68 65 0a 5b 73 79 73 63 6d 64 20 54 63 6c 5f the.[syscmd Tcl_
0410: 53 74 61 63 6b 43 68 61 6e 6e 65 6c 5d 20 41 50 StackChannel] AP
0420: 49 20 69 6e 20 54 43 4c 20 38 2e 34 20 6f 72 20 I in TCL 8.4 or
0430: 6c 61 74 65 72 2e 20 54 68 65 73 65 20 73 6f 63 later. These soc
0440: 6b 65 74 73 20 62 65 68 61 76 65 20 65 78 61 63 kets behave exac
0450: 74 6c 79 0a 74 68 65 20 73 61 6d 65 20 61 73 20 tly.the same as
0460: 63 68 61 6e 6e 65 6c 73 20 63 72 65 61 74 65 64 channels created
0470: 20 75 73 69 6e 67 20 74 68 65 20 62 75 69 6c 74 using the built
0480: 2d 69 6e 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b -in [syscmd sock
0490: 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 62 75 74 et] command, but
04a0: 0a 70 72 6f 76 69 64 65 20 61 64 64 69 74 69 6f .provide additio
04b0: 6e 61 6c 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 nal options for
04c0: 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20 74 68 65 20 controlling the
04d0: 53 53 4c 2f 54 4c 53 20 73 65 73 73 69 6f 6e 2e SSL/TLS session.
04e0: 0a 0a 5b 73 65 63 74 69 6f 6e 20 43 6f 6d 70 61 ..[section Compa
04f0: 74 69 62 69 6c 69 74 79 5d 0a 54 68 69 73 20 65 tibility].This e
0500: 78 74 65 6e 73 69 6f 6e 20 69 73 20 63 6f 6d 70 xtension is comp
0510: 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65 6e atible with Open
0520: 53 53 4c 20 31 2e 31 2e 31 20 6f 72 20 6c 61 74 SSL 1.1.1 or lat
0530: 65 72 2e 20 49 74 20 72 65 71 75 69 72 65 73 20 er. It requires
0540: 54 63 6c 0a 76 65 72 73 69 6f 6e 20 38 2e 35 20 Tcl.version 8.5
0550: 6f 72 20 6c 61 74 65 72 20 61 6e 64 20 77 69 6c or later and wil
0560: 6c 20 77 6f 72 6b 20 77 69 74 68 20 54 63 6c 20 l work with Tcl
0570: 39 2e 30 2e 0a 0a 5b 73 65 63 74 69 6f 6e 20 43 9.0...[section C
0580: 6f 6d 6d 61 6e 64 73 5d 0a 0a 54 68 65 20 66 6f ommands]..The fo
0590: 6c 6c 6f 77 69 6e 67 20 61 72 65 20 74 68 65 20 llowing are the
05a0: 63 6f 6d 6d 61 6e 64 73 20 70 72 6f 76 69 64 65 commands provide
05b0: 64 20 62 79 20 74 68 65 20 54 63 4c 54 4c 53 20 d by the TcLTLS
05c0: 70 61 63 6b 61 67 65 2e 20 53 65 65 0a 5b 73 65 package. See.[se
05d0: 63 74 72 65 66 20 45 78 61 6d 70 6c 65 73 5d 20 ctref Examples]
05e0: 66 6f 72 20 65 78 61 6d 70 6c 65 20 75 73 61 67 for example usag
05f0: 65 20 61 6e 64 20 74 68 65 20 5b 66 69 6c 65 20 e and the [file
0600: 64 65 6d 6f 73 5d 20 64 69 72 65 63 74 6f 72 79 demos] directory
0610: 20 66 6f 72 0a 6d 6f 72 65 20 65 78 61 6d 70 6c for.more exampl
0620: 65 20 75 73 61 67 65 2e 0a 0a 5b 6c 69 73 74 5f e usage...[list_
0630: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e begin definition
0640: 73 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 s]..[call [cmd t
0650: 6c 73 3a 3a 69 6e 69 74 5d 20 5b 6f 70 74 20 5b ls::init] [opt [
0660: 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f arg -option]] [o
0670: 70 74 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 pt [arg value]]
0680: 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 [opt [arg "-opti
0690: 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d on value ..."]]]
06a0: 0a 0a 4f 70 74 69 6f 6e 61 6c 20 66 75 6e 63 74 ..Optional funct
06b0: 69 6f 6e 20 74 6f 20 73 65 74 20 74 68 65 20 64 ion to set the d
06c0: 65 66 61 75 6c 74 20 6f 70 74 69 6f 6e 73 20 75 efault options u
06d0: 73 65 64 20 62 79 20 5b 63 6d 64 20 74 6c 73 3a sed by [cmd tls:
06e0: 3a 73 6f 63 6b 65 74 5d 2e 20 49 66 20 79 6f 75 :socket]. If you
06f0: 0a 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a .call [cmd tls::
0700: 69 6d 70 6f 72 74 5d 20 64 69 72 65 63 74 6c 79 import] directly
0710: 2c 20 74 68 65 20 76 61 6c 75 65 73 20 73 65 74 , the values set
0720: 20 62 79 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 by this command
0730: 20 68 61 76 65 20 6e 6f 20 65 66 66 65 63 74 2e have no effect.
0740: 0a 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 73 75 .This command su
0750: 70 70 6f 72 74 73 20 61 6c 6c 20 6f 66 20 74 68 pports all of th
0760: 65 20 73 61 6d 65 20 6f 70 74 69 6f 6e 73 20 61 e same options a
0770: 73 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a s the [cmd tls::
0780: 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c socket] command,
0790: 0a 74 68 6f 75 67 68 20 79 6f 75 20 73 68 6f 75 .though you shou
07a0: 6c 64 20 6c 69 6d 69 74 20 79 6f 75 72 20 6f 70 ld limit your op
07b0: 74 69 6f 6e 73 20 74 6f 20 6f 6e 6c 79 20 74 68 tions to only th
07c0: 65 20 54 4c 53 20 72 65 6c 61 74 65 64 20 6f 6e e TLS related on
07d0: 65 73 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 es...[call [cmd
07e0: 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 5b 6f 70 tls::socket] [op
07f0: 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d t [arg -option]]
0800: 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75 65 [opt [arg value
0810: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f ]] [opt [arg "-o
0820: 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 ption value ..."
0830: 5d 5d 20 5b 61 72 67 20 68 6f 73 74 5d 20 5b 61 ]] [arg host] [a
0840: 72 67 20 70 6f 72 74 5d 5d 0a 0a 54 68 69 73 20 rg port]]..This
0850: 69 73 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63 is a helper func
0860: 74 69 6f 6e 20 74 68 61 74 20 75 74 69 6c 69 7a tion that utiliz
0870: 65 73 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e es the underlyin
0880: 67 20 63 6f 6d 6d 61 6e 64 73 20 5b 73 79 73 63 g commands [sysc
0890: 6d 64 20 73 6f 63 6b 65 74 5d 0a 61 6e 64 20 5b md socket].and [
08a0: 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d cmd tls::import]
08b0: 20 74 6f 20 63 72 65 61 74 65 20 74 68 65 20 63 to create the c
08c0: 6f 6e 6e 65 63 74 69 6f 6e 2e 20 49 74 20 62 65 onnection. It be
08d0: 68 61 76 65 73 20 74 68 65 20 73 61 6d 65 20 61 haves the same a
08e0: 73 20 74 68 65 0a 6e 61 74 69 76 65 20 54 43 4c s the.native TCL
08f0: 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65 74 5d [syscmd socket]
0900: 20 63 6f 6d 6d 61 6e 64 2c 20 62 75 74 20 61 6c command, but al
0910: 73 6f 20 73 75 70 70 6f 72 74 73 20 74 68 65 20 so supports the
0920: 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 [cmd tls::import
0930: 5d 0a 63 6f 6d 6d 61 6e 64 20 6f 70 74 69 6f 6e ].command option
0940: 73 20 77 69 74 68 20 6f 6e 65 20 61 64 64 69 74 s with one addit
0950: 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 2e 20 49 74 ional option. It
0960: 20 72 65 74 75 72 6e 73 20 74 68 65 20 63 68 61 returns the cha
0970: 6e 6e 65 6c 20 68 61 6e 64 6c 65 20 69 64 0a 66 nnel handle id.f
0980: 6f 72 20 74 68 65 20 6e 65 77 20 73 6f 63 6b 65 or the new socke
0990: 74 2e 20 41 64 64 69 74 69 6f 6e 61 6c 20 6f 70 t. Additional op
09a0: 74 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 tions are:..[lis
09b0: 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d t_begin options]
09c0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 75 74 6f ..[opt_def -auto
09d0: 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 20 servername [arg
09e0: 62 6f 6f 6c 5d 5d 0a 49 66 20 5b 63 6f 6e 73 74 bool]].If [const
09f0: 20 74 72 75 65 5d 2c 20 61 75 74 6f 6d 61 74 69 true], automati
0a00: 63 61 6c 6c 79 20 73 65 74 20 74 68 65 20 5b 6f cally set the [o
0a10: 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d ption -servernam
0a20: 65 5d 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74 e] argument to t
0a30: 68 65 0a 5b 65 6d 70 68 20 68 6f 73 74 5d 20 61 he.[emph host] a
0a40: 72 67 75 6d 65 6e 74 2e 20 50 72 69 6f 72 20 74 rgument. Prior t
0a50: 6f 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 o TclTLS 2.0, th
0a60: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f e default is [co
0a70: 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 53 74 61 72 nst false]..Star
0a80: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 ting in TclTLS 2
0a90: 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20 .0, the default
0aa0: 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20 is [const true]
0ab0: 75 6e 6c 65 73 73 20 5b 6f 70 74 69 6f 6e 20 2d unless [option -
0ac0: 73 65 72 76 65 72 6e 61 6d 65 5d 0a 69 73 20 61 servername].is a
0ad0: 6c 73 6f 20 73 70 65 63 69 66 69 65 64 2e 0a 0a lso specified...
0ae0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c [list_end]..[cal
0af0: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b l [cmd tls::sock
0b00: 65 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72 et] [option -ser
0b10: 76 65 72 5d 20 5b 61 72 67 20 63 6f 6d 6d 61 6e ver] [arg comman
0b20: 64 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 d] [opt [arg -op
0b30: 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 tion]] [opt [arg
0b40: 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 value]] [opt [a
0b50: 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 rg "-option valu
0b60: 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 70 6f e ..."]] [arg po
0b70: 72 74 5d 5d 0a 0a 53 61 6d 65 20 61 73 20 70 72 rt]]..Same as pr
0b80: 65 76 69 6f 75 73 20 63 6f 6d 6d 61 6e 64 2c 20 evious command,
0b90: 62 75 74 20 69 6e 73 74 65 61 64 20 63 72 65 61 but instead crea
0ba0: 74 65 73 20 61 20 73 65 72 76 65 72 20 73 6f 63 tes a server soc
0bb0: 6b 65 74 20 66 6f 72 20 63 6c 69 65 6e 74 73 20 ket for clients
0bc0: 74 6f 0a 63 6f 6e 6e 65 63 74 20 74 6f 20 6a 75 to.connect to ju
0bd0: 73 74 20 6c 69 6b 65 20 74 68 65 20 54 63 6c 20 st like the Tcl
0be0: 5b 73 79 73 63 6d 64 20 22 73 6f 63 6b 65 74 20 [syscmd "socket
0bf0: 2d 73 65 72 76 65 72 22 5d 20 63 6f 6d 6d 61 6e -server"] comman
0c00: 64 2e 20 49 74 20 72 65 74 75 72 6e 73 20 74 68 d. It returns th
0c10: 65 0a 63 68 61 6e 6e 65 6c 20 68 61 6e 64 6c 65 e.channel handle
0c20: 20 69 64 20 66 6f 72 20 74 68 65 20 6e 65 77 20 id for the new
0c30: 73 6f 63 6b 65 74 2e 0a 0a 5b 63 61 6c 6c 20 5b socket...[call [
0c40: 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d cmd tls::import]
0c50: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20 5b [arg channel] [
0c60: 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e opt [arg -option
0c70: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c ]] [opt [arg val
0c80: 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 ue]] [opt [arg "
0c90: 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e -option value ..
0ca0: 2e 22 5d 5d 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d ."]]]..[call [cm
0cb0: 64 20 74 6c 73 3a 3a 73 74 61 72 74 74 6c 73 5d d tls::starttls]
0cc0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20 5b [arg channel] [
0cd0: 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e opt [arg -option
0ce0: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c ]] [opt [arg val
0cf0: 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 ue]] [opt [arg "
0d00: 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e -option value ..
0d10: 2e 22 5d 5d 5d 0a 0a 53 74 61 72 74 20 54 4c 53 ."]]]..Start TLS
0d20: 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f 6e 20 54 encryption on T
0d30: 43 4c 20 63 68 61 6e 6e 65 6c 20 5b 61 72 67 20 CL channel [arg
0d40: 63 68 61 6e 6e 65 6c 5d 20 76 69 61 20 61 20 73 channel] via a s
0d50: 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 2e 20 tacked channel.
0d60: 49 74 0a 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 It.need not be a
0d70: 20 73 6f 63 6b 65 74 2c 20 62 75 74 20 6d 75 73 socket, but mus
0d80: 74 20 70 72 6f 76 69 64 65 20 62 69 2d 64 69 72 t provide bi-dir
0d90: 65 63 74 69 6f 6e 61 6c 20 66 6c 6f 77 2e 20 41 ectional flow. A
0da0: 6c 73 6f 20 73 65 74 73 20 73 65 73 73 69 6f 6e lso sets session
0db0: 0a 70 61 72 61 6d 65 74 65 72 73 20 66 6f 72 20 .parameters for
0dc0: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 56 SSL handshake. V
0dd0: 61 6c 69 64 20 6f 70 74 69 6f 6e 73 20 61 72 65 alid options are
0de0: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f :..[list_begin o
0df0: 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 ptions]..[opt_de
0e00: 66 20 2d 61 6c 70 6e 20 5b 61 72 67 20 6c 69 73 f -alpn [arg lis
0e10: 74 5d 5d 0a 4c 69 73 74 20 6f 66 20 70 72 6f 74 t]].List of prot
0e20: 6f 63 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20 64 ocols to offer d
0e30: 75 72 69 6e 67 20 41 70 70 6c 69 63 61 74 69 6f uring Applicatio
0e40: 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c n-Layer Protocol
0e50: 20 4e 65 67 6f 74 69 61 74 69 6f 6e 0a 28 41 4c Negotiation.(AL
0e60: 50 4e 29 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 PN). For example
0e70: 3a 20 5b 63 6f 6e 73 74 20 68 32 5d 20 61 6e 64 : [const h2] and
0e80: 20 5b 63 6f 6e 73 74 20 68 74 74 70 2f 31 2e 31 [const http/1.1
0e90: 5d 2c 20 62 75 74 20 6e 6f 74 20 5b 63 6f 6e 73 ], but not [cons
0ea0: 74 20 68 33 5d 20 6f 72 0a 5b 63 6f 6e 73 74 20 t h3] or.[const
0eb0: 71 75 69 63 5d 2e 20 54 68 69 73 20 6f 70 74 69 quic]. This opti
0ec0: 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 on is new for Tc
0ed0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f lTLS 1.8...[opt_
0ee0: 64 65 66 20 2d 63 61 64 69 72 20 5b 61 72 67 20 def -cadir [arg
0ef0: 64 69 72 65 63 74 6f 72 79 5d 5d 0a 53 70 65 63 directory]].Spec
0f00: 69 66 69 65 73 20 74 68 65 20 64 69 72 65 63 74 ifies the direct
0f10: 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 43 65 ory where the Ce
0f20: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 rtificate Author
0f30: 69 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69 ity (CA) certifi
0f40: 63 61 74 65 73 20 61 72 65 0a 73 74 6f 72 65 64 cates are.stored
0f50: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 . The default is
0f60: 20 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66 platform specif
0f70: 69 63 20 61 6e 64 20 63 61 6e 20 62 65 20 73 65 ic and can be se
0f80: 74 20 61 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d t at compile tim
0f90: 65 2e 20 54 68 65 0a 64 65 66 61 75 6c 74 20 6c e. The.default l
0fa0: 6f 63 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 6f ocation can be o
0fb0: 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 verridden by the
0fc0: 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 [var SSL_CERT_D
0fd0: 49 52 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a IR] environment.
0fe0: 76 61 72 69 61 62 6c 65 2e 20 53 65 65 20 5b 73 variable. See [s
0ff0: 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63 ectref "Certific
1000: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d ate Validation"]
1010: 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c for more detail
1020: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 s...[opt_def -ca
1030: 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 file [arg filena
1040: 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 me]].Specifies t
1050: 68 65 20 66 69 6c 65 20 77 69 74 68 20 74 68 65 he file with the
1060: 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74 Certificate Aut
1070: 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72 74 hority (CA) cert
1080: 69 66 69 63 61 74 65 73 20 74 6f 20 75 73 65 20 ificates to use
1090: 69 6e 0a 5b 63 6f 6e 73 74 20 50 45 4d 5d 20 66 in.[const PEM] f
10a0: 69 6c 65 20 66 6f 72 6d 61 74 2e 20 54 68 65 20 ile format. The
10b0: 64 65 66 61 75 6c 74 20 69 73 20 5b 66 69 6c 65 default is [file
10c0: 20 63 65 72 74 2e 70 65 6d 5d 2c 20 69 6e 20 74 cert.pem], in t
10d0: 68 65 20 4f 70 65 6e 53 53 4c 0a 64 69 72 65 63 he OpenSSL.direc
10e0: 74 6f 72 79 2e 20 54 68 65 20 64 65 66 61 75 6c tory. The defaul
10f0: 74 20 66 69 6c 65 20 63 61 6e 20 62 65 20 6f 76 t file can be ov
1100: 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 20 erridden by the
1110: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 [var SSL_CERT_FI
1120: 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a LE] environment.
1130: 76 61 72 69 61 62 6c 65 2e 20 53 65 65 20 5b 73 variable. See [s
1140: 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63 ectref "Certific
1150: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d ate Validation"]
1160: 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c for more detail
1170: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 s...[opt_def -ca
1180: 73 74 6f 72 65 20 5b 61 72 67 20 55 52 49 5d 5d store [arg URI]]
1190: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 55 .Specifies the U
11a0: 6e 69 66 6f 72 6d 20 52 65 73 6f 75 72 63 65 20 niform Resource
11b0: 49 64 65 6e 74 69 66 69 65 72 20 28 55 52 49 29 Identifier (URI)
11c0: 20 66 6f 72 20 74 68 65 20 43 65 72 74 69 66 69 for the Certifi
11d0: 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 0a 28 cate Authority.(
11e0: 43 41 29 20 73 74 6f 72 65 2c 20 77 68 69 63 68 CA) store, which
11f0: 20 6d 61 79 20 62 65 20 61 20 73 69 6e 67 6c 65 may be a single
1200: 20 63 6f 6e 74 61 69 6e 65 72 20 6f 72 20 61 20 container or a
1210: 63 61 74 61 6c 6f 67 20 6f 66 20 63 6f 6e 74 61 catalog of conta
1220: 69 6e 65 72 73 2e 0a 53 74 61 72 74 69 6e 67 20 iners..Starting
1230: 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 33 2e 32 with OpenSSL 3.2
1240: 20 6f 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c 20 on MS Windows,
1250: 73 65 74 20 74 6f 20 22 5b 63 6f 6e 73 74 20 22 set to "[const "
1260: 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 org.openssl.wins
1270: 74 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f 20 75 73 tore://"]".to us
1280: 65 20 74 68 65 20 62 75 69 6c 74 2d 69 6e 20 4d e the built-in M
1290: 53 20 57 69 6e 64 6f 77 73 20 43 65 72 74 69 66 S Windows Certif
12a0: 69 63 61 74 65 20 53 74 6f 72 65 2e 0a 53 65 65 icate Store..See
12b0: 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69 [sectref "Certi
12c0: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f ficate Validatio
12d0: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 n"] for more det
12e0: 61 69 6c 73 2e 0a 54 68 69 73 20 6f 70 74 69 6f ails..This optio
12f0: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c n is new for Tcl
1300: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 TLS 1.8...[opt_d
1310: 65 66 20 2d 63 65 72 74 66 69 6c 65 20 5b 61 72 ef -certfile [ar
1320: 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 g filename]].Spe
1330: 63 69 66 69 65 73 20 74 68 65 20 6e 61 6d 65 20 cifies the name
1340: 6f 66 20 74 68 65 20 66 69 6c 65 20 77 69 74 68 of the file with
1350: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 the certificate
1360: 20 74 6f 20 75 73 65 20 69 6e 20 50 45 4d 20 66 to use in PEM f
1370: 6f 72 6d 61 74 0a 61 73 20 74 68 65 20 6c 6f 63 ormat.as the loc
1380: 61 6c 20 28 63 6c 69 65 6e 74 20 6f 72 20 73 65 al (client or se
1390: 72 76 65 72 29 20 63 65 72 74 69 66 69 63 61 74 rver) certificat
13a0: 65 2e 20 49 74 20 61 6c 73 6f 20 63 6f 6e 74 61 e. It also conta
13b0: 69 6e 73 20 74 68 65 20 70 75 62 6c 69 63 20 6b ins the public k
13c0: 65 79 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 ey...[opt_def -c
13d0: 65 72 74 20 5b 61 72 67 20 73 74 72 69 6e 67 5d ert [arg string]
13e0: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 ].Specifies the
13f0: 63 65 72 74 69 66 69 63 61 74 65 20 74 6f 20 75 certificate to u
1400: 73 65 20 61 73 20 61 20 44 45 52 20 65 6e 63 6f se as a DER enco
1410: 64 65 64 20 73 74 72 69 6e 67 20 28 58 2e 35 30 ded string (X.50
1420: 39 20 44 45 52 29 2e 0a 0a 5b 6f 70 74 5f 64 65 9 DER)...[opt_de
1430: 66 20 2d 63 69 70 68 65 72 20 5b 61 72 67 20 73 f -cipher [arg s
1440: 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 tring]].Specifie
1450: 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 63 69 s the list of ci
1460: 70 68 65 72 73 20 74 6f 20 75 73 65 20 66 6f 72 phers to use for
1470: 20 54 4c 53 20 31 2e 32 20 61 6e 64 20 65 61 72 TLS 1.2 and ear
1480: 6c 69 65 72 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 lier connections
1490: 2e 0a 53 74 72 69 6e 67 20 69 73 20 61 20 63 6f ..String is a co
14a0: 6c 6f 6e 20 22 5b 63 6f 6e 73 74 20 3a 5d 22 20 lon "[const :]"
14b0: 73 65 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f separated list o
14c0: 66 20 63 69 70 68 65 72 73 2e 0a 43 69 70 68 65 f ciphers..Ciphe
14d0: 72 73 20 63 61 6e 20 62 65 20 63 6f 6d 62 69 6e rs can be combin
14e0: 65 64 20 75 73 69 6e 67 20 74 68 65 20 22 5b 63 ed using the "[c
14f0: 6f 6e 73 74 20 2b 5d 22 20 63 68 61 72 61 63 74 onst +]" charact
1500: 65 72 2e 0a 50 72 65 66 69 78 65 73 20 63 61 6e er..Prefixes can
1510: 20 62 65 20 75 73 65 64 20 74 6f 20 70 65 72 6d be used to perm
1520: 61 6e 65 6e 74 6c 79 20 72 65 6d 6f 76 65 20 22 anently remove "
1530: 5b 63 6f 6e 73 74 20 21 5d 22 2c 20 64 65 6c 65 [const !]", dele
1540: 74 65 20 22 5b 63 6f 6e 73 74 20 2d 5d 22 2c 20 te "[const -]",
1550: 6f 72 0a 6d 6f 76 65 20 74 6f 20 74 68 65 20 65 or.move to the e
1560: 6e 64 20 22 5b 63 6f 6e 73 74 20 2b 5d 22 20 61 nd "[const +]" a
1570: 20 73 70 65 63 69 66 69 65 64 20 63 69 70 68 65 specified ciphe
1580: 72 2e 0a 4b 65 79 77 6f 72 64 73 20 5b 63 6f 6e r..Keywords [con
1590: 73 74 20 40 53 54 52 45 4e 47 54 48 5d 20 28 73 st @STRENGTH] (s
15a0: 6f 72 74 20 62 79 20 61 6c 67 6f 72 69 74 68 6d ort by algorithm
15b0: 20 6b 65 79 20 6c 65 6e 67 74 68 29 2c 0a 5b 63 key length),.[c
15c0: 6f 6e 73 74 20 40 53 45 43 4c 45 56 45 4c 3d 5d onst @SECLEVEL=]
15d0: 5b 65 6d 70 68 20 6e 5d 20 28 73 65 74 20 73 65 [emph n] (set se
15e0: 63 75 72 69 74 79 20 6c 65 76 65 6c 20 74 6f 20 curity level to
15f0: 6e 29 2c 20 61 6e 64 0a 5b 63 6f 6e 73 74 20 44 n), and.[const D
1600: 45 46 41 55 4c 54 5d 20 28 75 73 65 20 64 65 66 EFAULT] (use def
1610: 61 75 6c 74 20 63 69 70 68 65 72 20 6c 69 73 74 ault cipher list
1620: 2c 20 61 74 20 73 74 61 72 74 20 6f 6e 6c 79 29 , at start only)
1630: 20 63 61 6e 20 61 6c 73 6f 20 62 65 20 73 70 65 can also be spe
1640: 63 69 66 69 65 64 2e 0a 53 65 65 20 74 68 65 20 cified..See the
1650: 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 64 6f [uri "https://do
1660: 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 6d cs.openssl.org/m
1670: 61 73 74 65 72 2f 6d 61 6e 31 2f 6f 70 65 6e 73 aster/man1/opens
1680: 73 6c 2d 63 69 70 68 65 72 73 2f 23 6f 70 74 69 sl-ciphers/#opti
1690: 6f 6e 73 22 20 4f 70 65 6e 53 53 4c 5d 0a 64 6f ons" OpenSSL].do
16a0: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 cumentation for
16b0: 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 6f 66 the full list of
16c0: 20 76 61 6c 69 64 20 76 61 6c 75 65 73 2e 0a 0a valid values...
16d0: 5b 6f 70 74 5f 64 65 66 20 2d 63 69 70 68 65 72 [opt_def -cipher
16e0: 73 75 69 74 65 73 20 5b 61 72 67 20 73 74 72 69 suites [arg stri
16f0: 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 ng]].Specifies t
1700: 68 65 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 he list of ciphe
1710: 72 20 73 75 69 74 65 73 20 74 6f 20 75 73 65 20 r suites to use
1720: 66 6f 72 20 54 4c 53 20 31 2e 33 20 61 73 20 61 for TLS 1.3 as a
1730: 20 63 6f 6c 6f 6e 0a 22 5b 63 6f 6e 73 74 20 3a colon."[const :
1740: 5d 22 20 73 65 70 61 72 61 74 65 64 20 6c 69 73 ]" separated lis
1750: 74 20 6f 66 20 63 69 70 68 65 72 20 73 75 69 74 t of cipher suit
1760: 65 20 6e 61 6d 65 73 2e 20 53 65 65 20 74 68 65 e names. See the
1770: 0a 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 64 .[uri "https://d
1780: 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f ocs.openssl.org/
1790: 6d 61 73 74 65 72 2f 6d 61 6e 31 2f 6f 70 65 6e master/man1/open
17a0: 73 73 6c 2d 63 69 70 68 65 72 73 2f 23 6f 70 74 ssl-ciphers/#opt
17b0: 69 6f 6e 73 22 20 4f 70 65 6e 53 53 4c 5d 0a 64 ions" OpenSSL].d
17c0: 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 ocumentation for
17d0: 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 6f the full list o
17e0: 66 20 76 61 6c 69 64 20 76 61 6c 75 65 73 2e 0a f valid values..
17f0: 54 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e This option is n
1800: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e ew for TclTLS 1.
1810: 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 6f 8...[opt_def -co
1820: 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62 mmand [arg callb
1830: 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 ack]].Specifies
1840: 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d the callback com
1850: 6d 61 6e 64 20 74 6f 20 62 65 20 69 6e 76 6f 6b mand to be invok
1860: 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f ed at several po
1870: 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a ints during the.
1880: 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 70 61 73 handshake to pas
1890: 73 20 65 72 72 6f 72 73 2c 20 74 72 61 63 69 6e s errors, tracin
18a0: 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20 61 g information, a
18b0: 6e 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 65 73 73 nd protocol mess
18c0: 61 67 65 73 2e 0a 53 65 65 20 5b 73 65 63 74 72 ages..See [sectr
18d0: 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74 ef "Callback Opt
18e0: 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20 ions"] for more
18f0: 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 info...[opt_def
1900: 2d 64 68 70 61 72 61 6d 73 20 5b 61 72 67 20 66 -dhparams [arg f
1910: 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66 ilename]].Specif
1920: 69 65 73 20 74 68 65 20 44 69 66 66 69 65 2d 48 ies the Diffie-H
1930: 65 6c 6c 6d 61 6e 20 28 44 48 29 20 70 61 72 61 ellman (DH) para
1940: 6d 65 74 65 72 73 20 66 69 6c 65 2e 0a 0a 5b 6f meters file...[o
1950: 70 74 5f 64 65 66 20 2d 6b 65 79 66 69 6c 65 20 pt_def -keyfile
1960: 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a [arg filename]].
1970: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 70 72 Specifies the pr
1980: 69 76 61 74 65 20 6b 65 79 20 66 69 6c 65 2e 20 ivate key file.
1990: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 74 The default is t
19a0: 6f 20 75 73 65 20 74 68 65 20 66 69 6c 65 0a 73 o use the file.s
19b0: 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20 pecified by the
19c0: 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74 66 69 6c [option -certfil
19d0: 65 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 e] option...[opt
19e0: 5f 64 65 66 20 2d 6b 65 79 20 5b 61 72 67 20 73 _def -key [arg s
19f0: 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 tring]].Specifie
1a00: 73 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 s the private ke
1a10: 79 20 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 y to use as a DE
1a20: 52 20 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 R encoded string
1a30: 20 28 50 4b 43 53 23 31 20 44 45 52 29 2e 0a 0a (PKCS#1 DER)...
1a40: 5b 6f 70 74 5f 64 65 66 20 2d 6d 6f 64 65 6c 20 [opt_def -model
1a50: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 46 [arg channel]].F
1a60: 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e 6e 65 orce this channe
1a70: 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65 20 73 l to share the s
1a80: 61 6d 65 20 5b 74 65 72 6d 20 53 53 4c 5f 43 54 ame [term SSL_CT
1a90: 58 5d 20 73 74 72 75 63 74 75 72 65 20 61 73 20 X] structure as
1aa0: 74 68 65 0a 73 70 65 63 69 66 69 65 64 20 5b 61 the.specified [a
1ab0: 72 67 20 63 68 61 6e 6e 65 6c 5d 2c 20 61 6e 64 rg channel], and
1ac0: 20 74 68 65 72 65 66 6f 72 65 20 73 68 61 72 65 therefore share
1ad0: 20 63 6f 6e 66 69 67 2c 20 63 61 6c 6c 62 61 63 config, callbac
1ae0: 6b 73 2c 20 65 74 63 2e 0a 0a 5b 6f 70 74 5f 64 ks, etc...[opt_d
1af0: 65 66 20 2d 70 61 73 73 77 6f 72 64 20 5b 61 72 ef -password [ar
1b00: 67 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 g callback]].Spe
1b10: 63 69 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62 cifies the callb
1b20: 61 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 ack command to i
1b30: 6e 76 6f 6b 65 20 77 68 65 6e 20 4f 70 65 6e 53 nvoke when OpenS
1b40: 53 4c 20 6e 65 65 64 73 20 74 6f 20 6f 62 74 61 SL needs to obta
1b50: 69 6e 20 61 0a 70 61 73 73 77 6f 72 64 2e 20 54 in a.password. T
1b60: 68 69 73 20 69 73 20 74 79 70 69 63 61 6c 6c 79 his is typically
1b70: 20 75 73 65 64 20 74 6f 20 75 6e 6c 6f 63 6b 20 used to unlock
1b80: 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 the private key
1b90: 6f 66 20 61 20 63 65 72 74 69 66 69 63 61 74 65 of a certificate
1ba0: 2e 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 ..The callback s
1bb0: 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 70 hould return a p
1bc0: 61 73 73 77 6f 72 64 20 73 74 72 69 6e 67 2e 20 assword string.
1bd0: 54 68 69 73 20 6f 70 74 69 6f 6e 20 68 61 73 20 This option has
1be0: 63 68 61 6e 67 65 64 20 66 6f 72 0a 54 63 6c 54 changed for.TclT
1bf0: 4c 53 20 31 2e 38 2e 20 53 65 65 20 5b 73 65 63 LS 1.8. See [sec
1c00: 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f tref "Callback O
1c10: 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 ptions"] for mor
1c20: 65 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 e info...[opt_de
1c30: 66 20 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b f -post_handshak
1c40: 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 41 6c e [arg bool]].Al
1c50: 6c 6f 77 20 70 6f 73 74 2d 68 61 6e 64 73 68 61 low post-handsha
1c60: 6b 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 ke session ticke
1c70: 74 20 75 70 64 61 74 65 73 2e 20 54 68 69 73 20 t updates. This
1c80: 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f option is new fo
1c90: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b r TclTLS 1.8...[
1ca0: 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 65 73 74 opt_def -request
1cb0: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 [arg bool]].Req
1cc0: 75 65 73 74 20 61 20 63 65 72 74 69 66 69 63 61 uest a certifica
1cd0: 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65 72 te from the peer
1ce0: 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c 20 during the SSL
1cf0: 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 69 73 20 handshake. This
1d00: 69 73 20 6e 65 65 64 65 64 0a 74 6f 20 64 6f 20 is needed.to do
1d10: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 Certificate Vali
1d20: 64 61 74 69 6f 6e 2e 20 53 74 61 72 74 69 6e 67 dation. Starting
1d30: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c 20 in TclTLS 1.8,
1d40: 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 0a 5b the default is.[
1d50: 63 6f 6e 73 74 20 74 72 75 65 5d 20 66 6f 72 20 const true] for
1d60: 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f client connectio
1d70: 6e 73 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 ns. Starting in
1d80: 54 63 6c 54 4c 53 20 32 2e 30 2c 20 69 66 20 73 TclTLS 2.0, if s
1d90: 65 74 20 74 6f 0a 5b 63 6f 6e 73 74 20 66 61 6c et to.[const fal
1da0: 73 65 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 se] and [option
1db0: 2d 72 65 71 75 69 72 65 5d 20 69 73 20 5b 63 6f -require] is [co
1dc0: 6e 73 74 20 74 72 75 65 5d 2c 20 74 68 65 6e 20 nst true], then
1dd0: 74 68 69 73 20 77 69 6c 6c 20 62 65 0a 6f 76 65 this will be.ove
1de0: 72 72 69 64 64 65 6e 20 74 6f 20 5b 63 6f 6e 73 rridden to [cons
1df0: 74 20 74 72 75 65 5d 2e 0a 53 65 65 20 5b 73 65 t true]..See [se
1e00: 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63 61 ctref "Certifica
1e10: 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 te Validation"]
1e20: 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 for more details
1e30: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 ...[opt_def -req
1e40: 75 69 72 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d uire [arg bool]]
1e50: 0a 52 65 71 75 69 72 65 20 61 20 76 61 6c 69 64 .Require a valid
1e60: 20 63 65 72 74 69 66 69 63 61 74 65 20 66 72 6f certificate fro
1e70: 6d 20 74 68 65 20 70 65 65 72 20 64 75 72 69 6e m the peer durin
1e80: 67 20 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 g the SSL handsh
1e90: 61 6b 65 2e 20 49 66 20 74 68 69 73 20 69 73 0a ake. If this is.
1ea0: 73 65 74 20 74 6f 20 74 72 75 65 2c 20 74 68 65 set to true, the
1eb0: 6e 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65 n [option -reque
1ec0: 73 74 5d 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 st] must also be
1ed0: 20 73 65 74 20 74 6f 20 74 72 75 65 20 61 6e 64 set to true and
1ee0: 20 61 20 65 69 74 68 65 72 0a 5b 6f 70 74 69 6f a either.[optio
1ef0: 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 n -cadir], [opti
1f00: 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 5b 6f 70 on -cafile], [op
1f10: 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 2c 20 tion -castore],
1f20: 6f 72 20 61 20 70 6c 61 74 66 6f 72 6d 20 64 65 or a platform de
1f30: 66 61 75 6c 74 0a 6d 75 73 74 20 62 65 20 70 72 fault.must be pr
1f40: 6f 76 69 64 65 64 20 69 6e 20 6f 72 64 65 72 20 ovided in order
1f50: 74 6f 20 76 61 6c 69 64 61 74 65 20 61 67 61 69 to validate agai
1f60: 6e 73 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 nst. The default
1f70: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61 in TclTLS 1.8 a
1f80: 6e 64 0a 65 61 72 6c 69 65 72 20 76 65 72 73 69 nd.earlier versi
1f90: 6f 6e 73 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 ons is [const fa
1fa0: 6c 73 65 5d 20 73 69 6e 63 65 20 6e 6f 74 20 61 lse] since not a
1fb0: 6c 6c 20 70 6c 61 74 66 6f 72 6d 73 20 68 61 76 ll platforms hav
1fc0: 65 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 e certificates t
1fd0: 6f 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e o.validate again
1fe0: 73 74 20 69 6e 20 61 20 66 6f 72 6d 20 63 6f 6d st in a form com
1ff0: 70 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65 patible with Ope
2000: 6e 53 53 4c 2e 20 53 74 61 72 74 69 6e 67 20 69 nSSL. Starting i
2010: 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 0a 74 68 n TclTLS 2.0,.th
2020: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f e default is [co
2030: 6e 73 74 20 74 72 75 65 5d 20 66 6f 72 20 63 6c nst true] for cl
2040: 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 ient connections
2050: 2e 0a 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 ..See [sectref "
2060: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 Certificate Vali
2070: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 dation"] for mor
2080: 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 e details...[opt
2090: 5f 64 65 66 20 2d 73 65 63 75 72 69 74 79 5f 6c _def -security_l
20a0: 65 76 65 6c 20 5b 61 72 67 20 69 6e 74 65 67 65 evel [arg intege
20b0: 72 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 r]].Specifies th
20c0: 65 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c e security level
20d0: 20 28 76 61 6c 75 65 20 66 72 6f 6d 20 30 20 74 (value from 0 t
20e0: 6f 20 35 29 2e 20 54 68 65 20 73 65 63 75 72 69 o 5). The securi
20f0: 74 79 20 6c 65 76 65 6c 20 61 66 66 65 63 74 73 ty level affects
2100: 0a 74 68 65 20 61 6c 6c 6f 77 65 64 20 63 69 70 .the allowed cip
2110: 68 65 72 20 73 75 69 74 65 20 65 6e 63 72 79 70 her suite encryp
2120: 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 73 2c tion algorithms,
2130: 20 73 75 70 70 6f 72 74 65 64 20 45 43 43 20 63 supported ECC c
2140: 75 72 76 65 73 2c 0a 73 75 70 70 6f 72 74 65 64 urves,.supported
2150: 20 73 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72 signature algor
2160: 69 74 68 6d 73 2c 20 44 48 20 70 61 72 61 6d 65 ithms, DH parame
2170: 74 65 72 20 73 69 7a 65 73 2c 20 63 65 72 74 69 ter sizes, certi
2180: 66 69 63 61 74 65 20 6b 65 79 20 73 69 7a 65 73 ficate key sizes
2190: 0a 61 6e 64 20 73 69 67 6e 61 74 75 72 65 20 61 .and signature a
21a0: 6c 67 6f 72 69 74 68 6d 73 2e 20 54 68 65 20 64 lgorithms. The d
21b0: 65 66 61 75 6c 74 20 69 73 20 31 20 70 72 69 6f efault is 1 prio
21c0: 72 20 74 6f 20 4f 70 65 6e 53 53 4c 20 33 2e 32 r to OpenSSL 3.2
21d0: 20 61 6e 64 20 32 0a 74 68 65 72 65 61 66 74 65 and 2.thereafte
21e0: 72 2e 20 4c 65 76 65 6c 20 33 20 61 6e 64 20 68 r. Level 3 and h
21f0: 69 67 68 65 72 20 64 69 73 61 62 6c 65 20 73 75 igher disable su
2200: 70 70 6f 72 74 20 66 6f 72 20 73 65 73 73 69 6f pport for sessio
2210: 6e 20 74 69 63 6b 65 74 73 20 61 6e 64 0a 6f 6e n tickets and.on
2220: 6c 79 20 61 63 63 65 70 74 20 63 69 70 68 65 72 ly accept cipher
2230: 20 73 75 69 74 65 73 20 74 68 61 74 20 70 72 6f suites that pro
2240: 76 69 64 65 20 66 6f 72 77 61 72 64 20 73 65 63 vide forward sec
2250: 72 65 63 79 2e 0a 54 68 69 73 20 6f 70 74 69 6f recy..This optio
2260: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c n is new for Tcl
2270: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 TLS 1.8...[opt_d
2280: 65 66 20 2d 73 65 72 76 65 72 20 5b 61 72 67 20 ef -server [arg
2290: 62 6f 6f 6c 5d 5d 0a 53 70 65 63 69 66 69 65 73 bool]].Specifies
22a0: 20 77 68 65 74 68 65 72 20 74 6f 20 61 63 74 20 whether to act
22b0: 61 73 20 61 20 73 65 72 76 65 72 20 61 6e 64 20 as a server and
22c0: 72 65 73 70 6f 6e 64 20 77 69 74 68 20 61 20 73 respond with a s
22d0: 65 72 76 65 72 20 68 61 6e 64 73 68 61 6b 65 20 erver handshake
22e0: 77 68 65 6e 20 61 0a 63 6c 69 65 6e 74 20 63 6f when a.client co
22f0: 6e 6e 65 63 74 73 20 61 6e 64 20 70 72 6f 76 69 nnects and provi
2300: 64 65 73 20 61 20 63 6c 69 65 6e 74 20 68 61 6e des a client han
2310: 64 73 68 61 6b 65 2e 20 54 68 65 20 64 65 66 61 dshake. The defa
2320: 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 ult is [const fa
2330: 6c 73 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 lse]...[opt_def
2340: 2d 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 -servername [arg
2350: 20 68 6f 73 74 6e 61 6d 65 5d 5d 0a 53 70 65 63 hostname]].Spec
2360: 69 66 79 20 74 68 65 20 70 65 65 72 27 73 20 68 ify the peer's h
2370: 6f 73 74 6e 61 6d 65 2e 20 54 68 69 73 20 69 73 ostname. This is
2380: 20 75 73 65 64 20 74 6f 20 73 65 74 20 74 68 65 used to set the
2390: 20 54 4c 53 20 53 65 72 76 65 72 20 4e 61 6d 65 TLS Server Name
23a0: 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53 4e 49 Indication.(SNI
23b0: 29 20 65 78 74 65 6e 73 69 6f 6e 2e 20 53 65 74 ) extension. Set
23c0: 20 74 68 69 73 20 74 6f 20 74 68 65 20 65 78 70 this to the exp
23d0: 65 63 74 65 64 20 73 65 72 76 65 72 6e 61 6d 65 ected servername
23e0: 20 69 6e 20 74 68 65 20 73 65 72 76 65 72 27 73 in the server's
23f0: 20 63 65 72 74 69 66 69 63 61 74 65 0a 6f 72 20 certificate.or
2400: 6f 6e 65 20 6f 66 20 74 68 65 20 53 75 62 6a 65 one of the Subje
2410: 63 74 20 41 6c 74 65 72 6e 61 74 65 20 4e 61 6d ct Alternate Nam
2420: 65 73 20 28 53 41 4e 29 2e 20 53 74 61 72 74 69 es (SAN). Starti
2430: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 ng in TclTLS 2.0
2440: 2c 20 74 68 69 73 20 77 69 6c 6c 0a 64 65 66 61 , this will.defa
2450: 75 6c 74 20 74 6f 20 74 68 65 20 68 6f 73 74 20 ult to the host
2460: 66 72 6f 6d 20 74 68 65 20 5b 63 6d 64 20 74 6c from the [cmd tl
2470: 73 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 s::socket] comma
2480: 6e 64 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 nd...[opt_def -s
2490: 65 73 73 69 6f 6e 5f 69 64 20 5b 61 72 67 20 62 ession_id [arg b
24a0: 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 5d 0a 53 inary_string]].S
24b0: 70 65 63 69 66 69 65 73 20 74 68 65 20 73 65 73 pecifies the ses
24c0: 73 69 6f 6e 20 69 64 20 74 6f 20 72 65 73 75 6d sion id to resum
24d0: 65 20 61 20 73 65 73 73 69 6f 6e 2e 20 4e 6f 74 e a session. Not
24e0: 20 73 75 70 70 6f 72 74 65 64 20 79 65 74 2e 0a supported yet..
24f0: 54 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e This option is n
2500: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e ew for TclTLS 1.
2510: 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73 8...[opt_def -ss
2520: 6c 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 l2 [arg bool]].E
2530: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c nable use of SSL
2540: 20 76 32 2e 54 68 65 20 64 65 66 61 75 6c 74 20 v2.The default
2550: 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d is [const false]
2560: 2e 0a 4f 70 65 6e 53 53 4c 20 31 2e 31 2b 20 6e ..OpenSSL 1.1+ n
2570: 6f 20 6c 6f 6e 67 65 72 20 73 75 70 70 6f 72 74 o longer support
2580: 73 20 53 53 4c 20 76 32 2c 20 73 6f 20 74 68 69 s SSL v2, so thi
2590: 73 20 6d 61 79 20 6e 6f 74 20 68 61 76 65 20 61 s may not have a
25a0: 6e 79 20 65 66 66 65 63 74 2e 0a 53 65 65 20 74 ny effect..See t
25b0: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f he [cmd tls::pro
25c0: 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 tocols] command
25d0: 66 6f 72 20 73 75 70 70 6f 72 74 65 64 20 70 72 for supported pr
25e0: 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 otocols...[opt_d
25f0: 65 66 20 2d 73 73 6c 33 20 5b 61 72 67 20 62 6f ef -ssl3 [arg bo
2600: 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 ol]].Enable use
2610: 6f 66 20 53 53 4c 20 76 33 2e 20 54 68 65 20 64 of SSL v3. The d
2620: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 efault is [const
2630: 20 66 61 6c 73 65 5d 2e 20 53 74 61 72 74 69 6e false]. Startin
2640: 67 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c g in TclTLS 1.8,
2650: 0a 75 73 65 20 6f 66 20 53 53 4c 20 76 33 20 69 .use of SSL v3 i
2660: 66 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 f only available
2670: 20 76 69 61 20 61 20 63 6f 6d 70 69 6c 65 20 74 via a compile t
2680: 69 6d 65 20 6f 70 74 69 6f 6e 2e 0a 4f 70 65 6e ime option..Open
2690: 53 53 4c 20 34 2e 30 2b 20 6e 6f 20 6c 6f 6e 67 SSL 4.0+ no long
26a0: 65 72 20 73 75 70 70 6f 72 74 73 20 53 53 4c 20 er supports SSL
26b0: 76 33 2c 20 73 6f 20 74 68 69 73 20 6d 61 79 20 v3, so this may
26c0: 6e 6f 74 20 68 61 76 65 20 61 6e 79 20 65 66 66 not have any eff
26d0: 65 63 74 2e 0a 53 65 65 20 74 68 65 20 5b 63 6d ect..See the [cm
26e0: 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 d tls::protocols
26f0: 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75 ] command for su
2700: 70 70 6f 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c pported protocol
2710: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c s...[opt_def -tl
2720: 73 31 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 s1 [arg bool]].E
2730: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 nable use of TLS
2740: 20 76 31 2e 20 53 74 61 72 74 69 6e 67 20 69 6e v1. Starting in
2750: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65 TclTLS 2.0, the
2760: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e default is [con
2770: 73 74 20 66 61 6c 73 65 5d 2e 0a 4e 6f 74 65 3a st false]..Note:
2780: 20 54 4c 53 20 31 2e 30 20 6e 65 65 64 73 20 53 TLS 1.0 needs S
2790: 48 41 31 20 74 6f 20 6f 70 65 72 61 74 65 2c 20 HA1 to operate,
27a0: 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 61 76 which is only av
27b0: 61 69 6c 61 62 6c 65 20 69 6e 20 73 65 63 75 72 ailable in secur
27c0: 69 74 79 20 6c 65 76 65 6c 0a 30 20 66 6f 72 20 ity level.0 for
27d0: 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 20 53 Open SSL 3.0+. S
27e0: 65 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d ee the [option -
27f0: 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 security_level]
2800: 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 option...[opt_de
2810: 66 20 2d 74 6c 73 31 2e 31 20 5b 61 72 67 20 62 f -tls1.1 [arg b
2820: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 ool]].Enable use
2830: 20 6f 66 20 54 4c 53 20 76 31 2e 31 2e 20 53 74 of TLS v1.1. St
2840: 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 arting in TclTLS
2850: 20 32 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c 2.0, the defaul
2860: 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 t is [const fals
2870: 65 5d 2e 0a 4e 6f 74 65 3a 20 54 4c 53 20 31 2e e]..Note: TLS 1.
2880: 31 20 6e 65 65 64 73 20 53 48 41 31 20 74 6f 20 1 needs SHA1 to
2890: 6f 70 65 72 61 74 65 2c 20 77 68 69 63 68 20 69 operate, which i
28a0: 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 s only available
28b0: 20 69 6e 20 73 65 63 75 72 69 74 79 20 6c 65 76 in security lev
28c0: 65 6c 0a 30 20 66 6f 72 20 4f 70 65 6e 20 53 53 el.0 for Open SS
28d0: 4c 20 33 2e 30 2b 2e 20 53 65 65 20 74 68 65 20 L 3.0+. See the
28e0: 5b 6f 70 74 69 6f 6e 20 2d 73 65 63 75 72 69 74 [option -securit
28f0: 79 5f 6c 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e y_level] option.
2900: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 ..[opt_def -tls1
2910: 2e 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 .2 [arg bool]].E
2920: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 nable use of TLS
2930: 20 76 31 2e 32 2e 20 54 68 65 20 64 65 66 61 75 v1.2. The defau
2940: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 lt is [const tru
2950: 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 e]...[opt_def -t
2960: 6c 73 31 2e 33 20 5b 61 72 67 20 62 6f 6f 6c 5d ls1.3 [arg bool]
2970: 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 ].Enable use of
2980: 54 4c 53 20 76 31 2e 33 2e 20 54 68 65 20 64 65 TLS v1.3. The de
2990: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 fault is [const
29a0: 74 72 75 65 5d 2e 20 54 68 69 73 20 69 73 20 6f true]. This is o
29b0: 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 0a 73 74 nly available.st
29c0: 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e arting with Open
29d0: 53 53 4c 20 31 2e 31 2e 31 20 61 6e 64 20 54 63 SSL 1.1.1 and Tc
29e0: 6c 54 4c 53 20 31 2e 37 2e 0a 0a 5b 6f 70 74 5f lTLS 1.7...[opt_
29f0: 64 65 66 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d def -validatecom
2a00: 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62 61 mand [arg callba
2a10: 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 ck]].Specifies t
2a20: 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d he callback comm
2a30: 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20 74 6f and to invoke to
2a40: 20 76 61 6c 69 64 61 74 65 20 74 68 65 20 70 65 validate the pe
2a50: 65 72 20 63 65 72 74 69 66 69 63 61 74 65 73 0a er certificates.
2a60: 61 6e 64 20 6f 74 68 65 72 20 63 6f 6e 66 69 67 and other config
2a70: 20 69 6e 66 6f 20 64 75 72 69 6e 67 20 74 68 65 info during the
2a80: 20 70 72 6f 74 6f 63 6f 6c 20 6e 65 67 6f 74 69 protocol negoti
2a90: 61 74 69 6f 6e 20 70 68 61 73 65 2e 20 54 68 69 ation phase. Thi
2aa0: 73 20 63 61 6e 20 62 65 20 75 73 65 64 0a 62 79 s can be used.by
2ab0: 20 54 43 4c 20 73 63 72 69 70 74 73 20 74 6f 20 TCL scripts to
2ac0: 70 65 72 66 6f 72 6d 20 74 68 65 69 72 20 6f 77 perform their ow
2ad0: 6e 20 43 65 72 74 69 66 69 63 61 74 65 20 56 61 n Certificate Va
2ae0: 6c 69 64 61 74 69 6f 6e 20 74 6f 20 73 75 70 70 lidation to supp
2af0: 6c 65 6d 65 6e 74 20 74 68 65 0a 64 65 66 61 75 lement the.defau
2b00: 6c 74 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72 lt validation pr
2b10: 6f 76 69 64 65 64 20 62 79 20 4f 70 65 6e 53 53 ovided by OpenSS
2b20: 4c 2e 20 54 68 65 20 73 63 72 69 70 74 20 6d 75 L. The script mu
2b30: 73 74 20 72 65 74 75 72 6e 20 61 20 62 6f 6f 6c st return a bool
2b40: 65 61 6e 20 74 72 75 65 0a 74 6f 20 63 6f 6e 74 ean true.to cont
2b50: 69 6e 75 65 20 74 68 65 20 6e 65 67 6f 74 69 61 inue the negotia
2b60: 74 69 6f 6e 2e 20 53 65 65 20 5b 73 65 63 74 72 tion. See [sectr
2b70: 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74 ef "Callback Opt
2b80: 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20 ions"] for more
2b90: 69 6e 66 6f 2e 0a 54 68 69 73 20 6f 70 74 69 6f info..This optio
2ba0: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c n is new for Tcl
2bb0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f TLS 1.8...[list_
2bc0: 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 end]..[call [cmd
2bd0: 20 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 5d tls::handshake]
2be0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a [arg channel]].
2bf0: 0a 46 6f 72 63 65 73 20 74 68 65 20 54 4c 53 20 .Forces the TLS
2c00: 6e 65 67 6f 74 69 61 74 69 6f 6e 20 68 61 6e 64 negotiation hand
2c10: 73 68 61 6b 65 20 74 6f 20 74 61 6b 65 20 70 6c shake to take pl
2c20: 61 63 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 2c ace immediately,
2c30: 20 61 6e 64 20 72 65 74 75 72 6e 73 20 30 0a 69 and returns 0.i
2c40: 66 20 68 61 6e 64 73 68 61 6b 65 20 69 73 20 73 f handshake is s
2c50: 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65 73 73 till in progress
2c60: 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 29 2c (non-blocking),
2c70: 20 6f 72 20 31 20 69 66 20 74 68 65 20 68 61 6e or 1 if the han
2c80: 64 73 68 61 6b 65 20 77 61 73 0a 73 75 63 63 65 dshake was.succe
2c90: 73 73 66 75 6c 2e 20 49 66 20 74 68 65 20 68 61 ssful. If the ha
2ca0: 6e 64 73 68 61 6b 65 20 66 61 69 6c 65 64 2c 20 ndshake failed,
2cb0: 61 6e 20 65 72 72 6f 72 20 77 69 6c 6c 20 62 65 an error will be
2cc0: 20 72 65 74 75 72 6e 65 64 2e 0a 0a 5b 63 61 6c returned...[cal
2cd0: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 68 75 74 l [cmd tls::shut
2ce0: 64 6f 77 6e 5d 20 5b 61 72 67 20 63 68 61 6e 6e down] [arg chann
2cf0: 65 6c 5d 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 el]]..[call [cmd
2d00: 20 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d 20 tls::unimport]
2d10: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a [arg channel]]..
2d20: 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a [call [cmd tls::
2d30: 75 6e 73 74 61 63 6b 5d 20 5b 61 72 67 20 63 68 unstack] [arg ch
2d40: 61 6e 6e 65 6c 5d 5d 0a 0a 54 68 69 73 20 74 65 annel]]..This te
2d50: 72 6d 69 6e 61 74 65 73 20 74 68 65 20 53 53 4c rminates the SSL
2d60: 2f 54 4c 53 20 73 65 73 73 69 6f 6e 20 62 79 20 /TLS session by
2d70: 73 65 6e 64 69 6e 67 20 74 68 65 20 22 63 6c 6f sending the "clo
2d80: 73 65 5f 6e 6f 74 69 66 79 22 20 6d 65 73 73 61 se_notify" messa
2d90: 67 65 20 61 6e 64 0a 72 65 6d 6f 76 65 73 20 74 ge and.removes t
2da0: 68 65 20 74 6f 70 20 6c 65 76 65 6c 20 73 74 61 he top level sta
2db0: 63 6b 65 64 20 63 68 61 6e 6e 65 6c 20 66 72 6f cked channel fro
2dc0: 6d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2c m [arg channel],
2dd0: 20 62 75 74 20 69 74 20 64 6f 65 73 20 6e 6f 74 but it does not
2de0: 20 63 6c 6f 73 65 0a 74 68 65 20 73 6f 63 6b 65 close.the socke
2df0: 74 2e 20 49 74 20 69 73 20 74 68 65 20 63 6f 6d t. It is the com
2e00: 70 6c 69 6d 65 6e 74 20 74 6f 20 5b 63 6d 64 20 pliment to [cmd
2e10: 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20 62 79 20 tls::import] by
2e20: 65 6e 64 69 6e 67 20 65 6e 63 72 79 70 74 69 6f ending encryptio
2e30: 6e 20 6f 66 0a 61 20 54 43 4c 20 63 68 61 6e 6e n of.a TCL chann
2e40: 65 6c 2e 20 41 6e 20 65 72 72 6f 72 20 69 73 20 el. An error is
2e50: 74 68 72 6f 77 6e 20 69 66 20 54 4c 53 20 69 73 thrown if TLS is
2e60: 20 6e 6f 74 20 74 68 65 20 74 6f 70 20 73 74 61 not the top sta
2e70: 63 6b 65 64 20 63 68 61 6e 6e 65 6c 20 74 79 70 cked channel typ
2e80: 65 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 e...[call [cmd t
2e90: 6c 73 3a 3a 73 74 61 74 75 73 5d 20 5b 6f 70 74 ls::status] [opt
2ea0: 20 5b 6f 70 74 69 6f 6e 20 2d 6c 6f 63 61 6c 5d [option -local]
2eb0: 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d ] [arg channel]]
2ec0: 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 20 63 75 ..Returns the cu
2ed0: 72 72 65 6e 74 20 73 74 61 74 75 73 20 6f 66 20 rrent status of
2ee0: 61 6e 20 53 53 4c 20 63 68 61 6e 6e 65 6c 2e 20 an SSL channel.
2ef0: 54 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 20 The result is a
2f00: 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 list of key-valu
2f10: 65 0a 70 61 69 72 73 20 64 65 73 63 72 69 62 69 e.pairs describi
2f20: 6e 67 20 74 68 65 20 53 53 4c 2c 20 63 65 72 74 ng the SSL, cert
2f30: 69 66 69 63 61 74 65 2c 20 61 6e 64 20 63 65 72 ificate, and cer
2f40: 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63 tificate verific
2f50: 61 74 69 6f 6e 20 73 74 61 74 75 73 2e 20 49 66 ation status. If
2f60: 0a 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 .the SSL handsha
2f70: 6b 65 20 68 61 73 20 6e 6f 74 20 79 65 74 20 63 ke has not yet c
2f80: 6f 6d 70 6c 65 74 65 64 2c 20 61 6e 20 65 6d 70 ompleted, an emp
2f90: 74 79 20 6c 69 73 74 20 69 73 20 72 65 74 75 72 ty list is retur
2fa0: 6e 65 64 2e 20 49 66 20 74 68 65 0a 5b 6f 70 74 ned. If the.[opt
2fb0: 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 20 6f 70 74 69 ion -local] opti
2fc0: 6f 6e 20 69 73 20 73 70 65 63 69 66 69 65 64 2c on is specified,
2fd0: 20 74 68 65 6e 20 74 68 65 20 6c 6f 63 61 6c 20 then the local
2fe0: 63 65 72 74 69 66 69 63 61 74 65 20 69 73 20 75 certificate is u
2ff0: 73 65 64 2e 0a 52 65 74 75 72 6e 65 64 20 76 61 sed..Returned va
3000: 6c 75 65 73 20 69 6e 63 6c 75 64 65 3a 0a 0a 5b lues include:..[
3010: 70 61 72 61 5d 0a 0a 53 53 4c 20 53 74 61 74 75 para]..SSL Statu
3020: 73 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 s..[list_begin d
3030: 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 efinitions]..[de
3040: 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20 5b 61 f "[var alpn] [a
3050: 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 rg protocol]"].T
3060: 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65 6c 65 he protocol sele
3070: 63 74 65 64 20 61 66 74 65 72 20 41 70 70 6c 69 cted after Appli
3080: 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f cation-Layer Pro
3090: 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f tocol Negotiatio
30a0: 6e 20 28 41 4c 50 4e 29 2e 0a 54 68 69 73 20 76 n (ALPN)..This v
30b0: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 alue is new for
30c0: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 TclTLS 1.8...[de
30d0: 66 20 22 5b 76 61 72 20 63 69 70 68 65 72 5d 20 f "[var cipher]
30e0: 5b 61 72 67 20 63 69 70 68 65 72 5d 22 5d 0a 54 [arg cipher]"].T
30f0: 68 65 20 63 75 72 72 65 6e 74 20 63 69 70 68 65 he current ciphe
3100: 72 20 69 6e 20 75 73 65 20 66 6f 72 20 74 68 65 r in use for the
3110: 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 session...[def
3120: 22 5b 76 61 72 20 70 65 65 72 6e 61 6d 65 5d 20 "[var peername]
3130: 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 65 [arg name]"].The
3140: 20 70 65 65 72 6e 61 6d 65 20 66 72 6f 6d 20 74 peername from t
3150: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a he certificate..
3160: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 This value is ne
3170: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 w for TclTLS 1.8
3180: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 72 ...[def "[var pr
3190: 6f 74 6f 63 6f 6c 5d 20 5b 61 72 67 20 76 65 72 otocol] [arg ver
31a0: 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 70 72 6f 74 sion]"].The prot
31b0: 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 20 75 73 65 ocol version use
31c0: 64 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 d for the connec
31d0: 74 69 6f 6e 3a 20 53 53 4c 32 2c 20 53 53 4c 33 tion: SSL2, SSL3
31e0: 2c 20 54 4c 53 31 2c 20 54 4c 53 31 2e 31 2c 20 , TLS1, TLS1.1,
31f0: 54 4c 53 31 2e 32 2c 0a 54 4c 53 31 2e 33 2c 20 TLS1.2,.TLS1.3,
3200: 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 20 54 68 69 73 or unknown. This
3210: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f value is new fo
3220: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b r TclTLS 1.8...[
3230: 64 65 66 20 22 5b 76 61 72 20 73 62 69 74 73 5d def "[var sbits]
3240: 20 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e [arg n]"].The n
3250: 75 6d 62 65 72 20 6f 66 20 62 69 74 73 20 75 73 umber of bits us
3260: 65 64 20 66 6f 72 20 74 68 65 20 73 65 73 73 69 ed for the sessi
3270: 6f 6e 20 6b 65 79 2e 0a 0a 5b 64 65 66 20 22 5b on key...[def "[
3280: 76 61 72 20 73 69 67 6e 61 74 75 72 65 48 61 73 var signatureHas
3290: 68 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 hAlgorithm] [arg
32a0: 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 54 68 algorithm]"].Th
32b0: 65 20 73 69 67 6e 61 74 75 72 65 20 68 61 73 68 e signature hash
32c0: 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 54 68 69 73 algorithm..This
32d0: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f value is new fo
32e0: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b r TclTLS 1.8...[
32f0: 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 def "[var signat
3300: 75 72 65 54 79 70 65 5d 20 5b 61 72 67 20 74 79 ureType] [arg ty
3310: 70 65 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61 74 pe]"].The signat
3320: 75 72 65 20 74 79 70 65 20 76 61 6c 75 65 2e 0a ure type value..
3330: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 This value is ne
3340: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 w for TclTLS 1.8
3350: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 ...[def "[var ve
3360: 72 69 66 79 44 65 70 74 68 5d 20 5b 61 72 67 20 rifyDepth] [arg
3370: 6e 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20 64 65 70 n]"].Maximum dep
3380: 74 68 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 th for the certi
3390: 66 69 63 61 74 65 20 63 68 61 69 6e 20 76 65 72 ficate chain ver
33a0: 69 66 69 63 61 74 69 6f 6e 2e 20 44 65 66 61 75 ification. Defau
33b0: 6c 74 20 69 73 20 2d 31 2c 20 74 6f 20 63 68 65 lt is -1, to che
33c0: 63 6b 20 61 6c 6c 2e 0a 54 68 69 73 20 76 61 6c ck all..This val
33d0: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 ue is new for Tc
33e0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 lTLS 1.8...[def
33f0: 22 5b 76 61 72 20 76 65 72 69 66 79 4d 6f 64 65 "[var verifyMode
3400: 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c ] [arg list]"].L
3410: 69 73 74 20 6f 66 20 63 65 72 74 69 66 69 63 61 ist of certifica
3420: 74 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 te verification
3430: 6d 6f 64 65 73 2e 0a 54 68 69 73 20 76 61 6c 75 modes..This valu
3440: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c e is new for Tcl
3450: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 TLS 1.8...[def "
3460: 5b 76 61 72 20 76 65 72 69 66 79 52 65 73 75 6c [var verifyResul
3470: 74 5d 20 5b 61 72 67 20 72 65 73 75 6c 74 5d 22 t] [arg result]"
3480: 5d 0a 43 65 72 74 69 66 69 63 61 74 65 20 76 65 ].Certificate ve
3490: 72 69 66 69 63 61 74 69 6f 6e 20 72 65 73 75 6c rification resul
34a0: 74 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 t..This value is
34b0: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 new for TclTLS
34c0: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 1.8...[def "[var
34d0: 20 63 61 5f 6e 61 6d 65 73 5d 20 5b 61 72 67 20 ca_names] [arg
34e0: 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 list]"].List of
34f0: 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20 the Certificate
3500: 41 75 74 68 6f 72 69 74 69 65 73 20 75 73 65 64 Authorities used
3510: 20 74 6f 20 63 72 65 61 74 65 20 74 68 65 20 63 to create the c
3520: 65 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69 73 ertificate..This
3530: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f value is new fo
3540: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b r TclTLS 1.8...[
3550: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43 65 72 74 69 list_end]..Certi
3560: 66 69 63 61 74 65 20 53 74 61 74 75 73 0a 0a 5b ficate Status..[
3570: 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e list_begin defin
3580: 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b itions]..[def "[
3590: 76 61 72 20 61 6c 6c 5d 20 5b 61 72 67 20 73 74 var all] [arg st
35a0: 72 69 6e 67 5d 22 5d 0a 44 75 6d 70 20 6f 66 20 ring]"].Dump of
35b0: 61 6c 6c 20 63 65 72 74 69 66 69 63 61 74 65 20 all certificate
35c0: 69 6e 66 6f 2e 0a 54 68 69 73 20 76 61 6c 75 65 info..This value
35d0: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 is new for TclT
35e0: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b LS 1.8...[def "[
35f0: 76 61 72 20 76 65 72 73 69 6f 6e 5d 20 5b 61 72 var version] [ar
3600: 67 20 76 61 6c 75 65 5d 22 5d 0a 54 68 65 20 63 g value]"].The c
3610: 65 72 74 69 66 69 63 61 74 65 20 76 65 72 73 69 ertificate versi
3620: 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 on...[def "[var
3630: 73 65 72 69 61 6c 4e 75 6d 62 65 72 5d 20 5b 61 serialNumber] [a
3640: 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 rg string]"].The
3650: 20 73 65 72 69 61 6c 20 6e 75 6d 62 65 72 20 6f serial number o
3660: 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 f the certificat
3670: 65 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e e as a hex strin
3680: 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 77 61 g..This value wa
3690: 73 20 63 68 61 6e 67 65 64 20 66 72 6f 6d 20 73 s changed from s
36a0: 65 72 69 61 6c 20 69 6e 20 54 63 6c 54 4c 53 20 erial in TclTLS
36b0: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 1.8...[def "[var
36c0: 20 73 69 67 6e 61 74 75 72 65 5d 20 5b 61 72 67 signature] [arg
36d0: 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 69 algorithm]"].Ci
36e0: 70 68 65 72 20 61 6c 67 6f 72 69 74 68 6d 20 75 pher algorithm u
36f0: 73 65 64 20 66 6f 72 20 63 65 72 74 69 66 69 63 sed for certific
3700: 61 74 65 20 73 69 67 6e 61 74 75 72 65 2e 0a 54 ate signature..T
3710: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 his value is new
3720: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e for TclTLS 1.8.
3730: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73 73 ..[def "[var iss
3740: 75 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 uer] [arg string
3750: 5d 22 5d 0a 54 68 65 20 64 69 73 74 69 6e 67 75 ]"].The distingu
3760: 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 20 ished name (DN)
3770: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61 of the certifica
3780: 74 65 20 69 73 73 75 65 72 2e 0a 0a 5b 64 65 66 te issuer...[def
3790: 20 22 5b 76 61 72 20 6e 6f 74 42 65 66 6f 72 65 "[var notBefore
37a0: 5d 20 5b 61 72 67 20 64 61 74 65 5d 22 5d 0a 54 ] [arg date]"].T
37b0: 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 64 61 74 he beginning dat
37c0: 65 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 e of the certifi
37d0: 63 61 74 65 20 76 61 6c 69 64 69 74 79 2e 0a 0a cate validity...
37e0: 5b 64 65 66 20 22 5b 76 61 72 20 6e 6f 74 41 66 [def "[var notAf
37f0: 74 65 72 5d 20 5b 61 72 67 20 64 61 74 65 5d 22 ter] [arg date]"
3800: 5d 0a 54 68 65 20 65 78 70 69 72 61 74 69 6f 6e ].The expiration
3810: 20 64 61 74 65 20 6f 66 20 74 68 65 20 63 65 72 date of the cer
3820: 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 69 74 tificate validit
3830: 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 y...[def "[var s
3840: 75 62 6a 65 63 74 5d 20 5b 61 72 67 20 73 74 72 ubject] [arg str
3850: 69 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73 74 69 ing]"].The disti
3860: 6e 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 nguished name (D
3870: 4e 29 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 N) of the certif
3880: 69 63 61 74 65 20 73 75 62 6a 65 63 74 2e 20 46 icate subject. F
3890: 69 65 6c 64 73 20 69 6e 63 6c 75 64 65 3a 20 43 ields include: C
38a0: 6f 6d 6d 6f 6e 0a 4e 61 6d 65 20 28 43 4e 29 2c ommon.Name (CN),
38b0: 20 4f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 28 4f Organization (O
38c0: 29 2c 20 4c 6f 63 61 6c 69 74 79 20 6f 72 20 43 ), Locality or C
38d0: 69 74 79 20 28 4c 29 2c 20 53 74 61 74 65 20 6f ity (L), State o
38e0: 72 20 50 72 6f 76 69 6e 63 65 20 28 53 29 2c 20 r Province (S),
38f0: 61 6e 64 0a 43 6f 75 6e 74 72 79 20 4e 61 6d 65 and.Country Name
3900: 20 28 43 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 (C)...[def "[va
3910: 72 20 69 73 73 75 65 72 55 6e 69 71 75 65 49 44 r issuerUniqueID
3920: 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d ] [arg string]"]
3930: 0a 54 68 65 20 69 73 73 75 65 72 20 75 6e 69 71 .The issuer uniq
3940: 75 65 20 69 64 2e 0a 54 68 69 73 20 76 61 6c 75 ue id..This valu
3950: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c e is new for Tcl
3960: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 TLS 1.8...[def "
3970: 5b 76 61 72 20 73 75 62 6a 65 63 74 55 6e 69 71 [var subjectUniq
3980: 75 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e ueID] [arg strin
3990: 67 5d 22 5d 0a 54 68 65 20 73 75 62 6a 65 63 74 g]"].The subject
39a0: 20 75 6e 69 71 75 65 20 69 64 2e 0a 54 68 69 73 unique id..This
39b0: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f value is new fo
39c0: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b r TclTLS 1.8...[
39d0: 64 65 66 20 22 5b 76 61 72 20 6e 75 6d 5f 65 78 def "[var num_ex
39e0: 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6e tensions] [arg n
39f0: 5d 22 5d 0a 4e 75 6d 62 65 72 20 6f 66 20 63 65 ]"].Number of ce
3a00: 72 74 69 66 69 63 61 74 65 20 65 78 74 65 6e 73 rtificate extens
3a10: 69 6f 6e 73 2e 0a 54 68 69 73 20 76 61 6c 75 65 ions..This value
3a20: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 is new for TclT
3a30: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b LS 1.8...[def "[
3a40: 76 61 72 20 65 78 74 65 6e 73 69 6f 6e 73 5d 20 var extensions]
3a50: 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 [arg list]"].Lis
3a60: 74 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 t of certificate
3a70: 20 65 78 74 65 6e 73 69 6f 6e 20 6e 61 6d 65 73 extension names
3a80: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 ..This value is
3a90: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 new for TclTLS 1
3aa0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 .8...[def "[var
3ab0: 61 75 74 68 6f 72 69 74 79 4b 65 79 49 64 65 6e authorityKeyIden
3ac0: 74 69 66 69 65 72 5d 20 5b 61 72 67 20 73 74 72 tifier] [arg str
3ad0: 69 6e 67 5d 22 5d 0a 41 75 74 68 6f 72 69 74 79 ing]"].Authority
3ae0: 20 4b 65 79 20 49 64 65 6e 74 69 66 69 65 72 20 Key Identifier
3af0: 28 41 4b 49 29 20 6f 66 20 74 68 65 20 49 73 73 (AKI) of the Iss
3b00: 75 69 6e 67 20 43 41 20 63 65 72 74 69 66 69 63 uing CA certific
3b10: 61 74 65 20 74 68 61 74 20 73 69 67 6e 65 64 20 ate that signed
3b20: 74 68 65 0a 53 53 4c 20 63 65 72 74 69 66 69 63 the.SSL certific
3b30: 61 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72 ate as a hex str
3b40: 69 6e 67 2e 20 54 68 69 73 20 76 61 6c 75 65 20 ing. This value
3b50: 6d 61 74 63 68 65 73 20 74 68 65 20 53 4b 49 20 matches the SKI
3b60: 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 49 6e 74 value of the.Int
3b70: 65 72 6d 65 64 69 61 74 65 20 43 41 20 63 65 72 ermediate CA cer
3b80: 74 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20 76 tificate..This v
3b90: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 alue is new for
3ba0: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 TclTLS 1.8...[de
3bb0: 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74 4b f "[var subjectK
3bc0: 65 79 49 64 65 6e 74 69 66 69 65 72 5d 20 5b 61 eyIdentifier] [a
3bd0: 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 53 75 62 rg string]"].Sub
3be0: 6a 65 63 74 20 4b 65 79 20 49 64 65 6e 74 69 66 ject Key Identif
3bf0: 69 65 72 20 28 53 4b 49 29 20 68 61 73 68 20 6f ier (SKI) hash o
3c00: 66 20 74 68 65 20 70 75 62 6c 69 63 20 6b 65 79 f the public key
3c10: 20 69 6e 73 69 64 65 20 74 68 65 20 63 65 72 74 inside the cert
3c20: 69 66 69 63 61 74 65 20 61 73 20 61 0a 68 65 78 ificate as a.hex
3c30: 20 73 74 72 69 6e 67 2e 20 55 73 65 64 20 74 6f string. Used to
3c40: 20 69 64 65 6e 74 69 66 79 20 63 65 72 74 69 66 identify certif
3c50: 69 63 61 74 65 73 20 74 68 61 74 20 63 6f 6e 74 icates that cont
3c60: 61 69 6e 20 61 20 70 61 72 74 69 63 75 6c 61 72 ain a particular
3c70: 20 70 75 62 6c 69 63 20 6b 65 79 2e 0a 54 68 69 public key..Thi
3c80: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 s value is new f
3c90: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a or TclTLS 1.8...
3ca0: 5b 64 65 66 20 22 5b 76 61 72 20 73 75 62 6a 65 [def "[var subje
3cb0: 63 74 41 6c 74 4e 61 6d 65 5d 20 5b 61 72 67 20 ctAltName] [arg
3cc0: 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 list]"].List of
3cd0: 61 6c 6c 20 6f 66 20 74 68 65 20 53 75 62 6a 65 all of the Subje
3ce0: 63 74 20 41 6c 74 65 72 6e 61 74 69 76 65 20 4e ct Alternative N
3cf0: 61 6d 65 73 20 28 53 41 4e 29 20 69 6e 63 6c 75 ames (SAN) inclu
3d00: 64 69 6e 67 20 64 6f 6d 61 69 6e 20 6e 61 6d 65 ding domain name
3d10: 73 2c 20 73 75 62 0a 64 6f 6d 61 69 6e 73 2c 20 s, sub.domains,
3d20: 61 6e 64 20 49 50 20 61 64 64 72 65 73 73 65 73 and IP addresses
3d30: 20 74 68 61 74 20 61 72 65 20 73 65 63 75 72 65 that are secure
3d40: 64 20 62 79 20 74 68 65 20 63 65 72 74 69 66 69 d by the certifi
3d50: 63 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 cate..This value
3d60: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 is new for TclT
3d70: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b LS 1.8...[def "[
3d80: 76 61 72 20 6f 63 73 70 5d 20 5b 61 72 67 20 6c var ocsp] [arg l
3d90: 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 61 ist]"].List of a
3da0: 6c 6c 20 4f 6e 6c 69 6e 65 20 43 65 72 74 69 66 ll Online Certif
3db0: 69 63 61 74 65 20 53 74 61 74 75 73 20 50 72 6f icate Status Pro
3dc0: 74 6f 63 6f 6c 20 28 4f 43 53 50 29 20 55 52 4c tocol (OCSP) URL
3dd0: 73 20 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 s that can be us
3de0: 65 64 20 74 6f 0a 63 68 65 63 6b 20 74 68 65 20 ed to.check the
3df0: 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 69 73 validity of this
3e00: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54 68 certificate..Th
3e10: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 is value is new
3e20: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a for TclTLS 1.8..
3e30: 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 65 72 74 .[def "[var cert
3e40: 69 66 69 63 61 74 65 5d 20 5b 61 72 67 20 63 65 ificate] [arg ce
3e50: 72 74 5d 22 5d 0a 54 68 65 20 50 45 4d 20 65 6e rt]"].The PEM en
3e60: 63 6f 64 65 64 20 63 65 72 74 69 66 69 63 61 74 coded certificat
3e70: 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 e...[def "[var s
3e80: 69 67 6e 61 74 75 72 65 41 6c 67 6f 72 69 74 68 ignatureAlgorith
3e90: 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68 m] [arg algorith
3ea0: 6d 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c 67 6f m]"].Cipher algo
3eb0: 72 69 74 68 6d 20 75 73 65 64 20 66 6f 72 20 74 rithm used for t
3ec0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 73 he certificate s
3ed0: 69 67 6e 61 74 75 72 65 2e 0a 54 68 69 73 20 76 ignature..This v
3ee0: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 alue is new for
3ef0: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 TclTLS 1.8...[de
3f00: 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 f "[var signatur
3f10: 65 56 61 6c 75 65 5d 20 5b 61 72 67 20 73 74 72 eValue] [arg str
3f20: 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 ing]"].Certifica
3f30: 74 65 20 73 69 67 6e 61 74 75 72 65 20 61 73 20 te signature as
3f40: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68 a hex string..Th
3f50: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 is value is new
3f60: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a for TclTLS 1.8..
3f70: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e .[def "[var sign
3f80: 61 74 75 72 65 44 69 67 65 73 74 5d 20 5b 61 72 atureDigest] [ar
3f90: 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 43 65 72 g version]"].Cer
3fa0: 74 69 66 69 63 61 74 65 20 73 69 67 6e 69 6e 67 tificate signing
3fb0: 20 64 69 67 65 73 74 20 61 73 20 61 20 68 65 78 digest as a hex
3fc0: 20 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 string..This va
3fd0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 lue is new for T
3fe0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 clTLS 1.8...[def
3ff0: 20 22 5b 76 61 72 20 70 75 62 6c 69 63 4b 65 79 "[var publicKey
4000: 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20 Algorithm] [arg
4010: 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 65 72 algorithm]"].Cer
4020: 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 tificate signatu
4030: 72 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 6c re public key al
4040: 67 6f 72 69 74 68 6d 2e 0a 54 68 69 73 20 76 61 gorithm..This va
4050: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 lue is new for T
4060: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 clTLS 1.8...[def
4070: 20 22 5b 76 61 72 20 70 75 62 6c 69 63 4b 65 79 "[var publicKey
4080: 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d ] [arg string]"]
4090: 0a 43 65 72 74 69 66 69 63 61 74 65 20 73 69 67 .Certificate sig
40a0: 6e 61 74 75 72 65 20 70 75 62 6c 69 63 20 6b 65 nature public ke
40b0: 79 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e y as a hex strin
40c0: 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 g..This value is
40d0: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 new for TclTLS
40e0: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 1.8...[def "[var
40f0: 20 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d bits] [arg n]"]
4100: 0a 4e 75 6d 62 65 72 20 6f 66 20 62 69 74 73 20 .Number of bits
4110: 75 73 65 64 20 66 6f 72 20 63 65 72 74 69 66 69 used for certifi
4120: 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 6b cate signature k
4130: 65 79 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 ey..This value i
4140: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 s new for TclTLS
4150: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 1.8...[def "[va
4160: 72 20 73 65 6c 66 5f 73 69 67 6e 65 64 5d 20 5b r self_signed] [
4170: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 arg boolean]"].W
4180: 68 65 74 68 65 72 20 74 68 65 20 63 65 72 74 69 hether the certi
4190: 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 ficate signature
41a0: 20 69 73 20 73 65 6c 66 20 73 69 67 6e 65 64 2e is self signed.
41b0: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e .This value is n
41c0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e ew for TclTLS 1.
41d0: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 8...[def "[var s
41e0: 68 61 31 5f 68 61 73 68 5d 20 5b 61 72 67 20 68 ha1_hash] [arg h
41f0: 61 73 68 5d 22 5d 0a 54 68 65 20 53 48 41 31 20 ash]"].The SHA1
4200: 68 61 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 hash of the cert
4210: 69 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78 ificate as a hex
4220: 20 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 string..This va
4230: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 lue is new for T
4240: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 clTLS 1.8...[def
4250: 20 22 5b 76 61 72 20 73 68 61 32 35 36 5f 68 61 "[var sha256_ha
4260: 73 68 5d 20 5b 61 72 67 20 68 61 73 68 5d 22 5d sh] [arg hash]"]
4270: 0a 54 68 65 20 53 48 41 32 35 36 20 68 61 73 68 .The SHA256 hash
4280: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 of the certific
4290: 61 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72 ate as a hex str
42a0: 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 ing..This value
42b0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c is new for TclTL
42c0: 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e S 1.8...[list_en
42d0: 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 d]..[call [cmd t
42e0: 6c 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5d 20 ls::connection]
42f0: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a [arg channel]]..
4300: 52 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 Returns the curr
4310: 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 ent connection s
4320: 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20 tatus of an SSL
4330: 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73 channel. The res
4340: 75 6c 74 20 69 73 20 61 20 6c 69 73 74 0a 6f 66 ult is a list.of
4350: 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73 key-value pairs
4360: 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 describing the
4370: 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 54 68 69 73 connection..This
4380: 20 63 6f 6d 6d 61 6e 64 20 69 73 20 6e 65 77 20 command is new
4390: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 for TclTLS 1.8.
43a0: 52 65 74 75 72 6e 65 64 20 76 61 6c 75 65 73 20 Returned values
43b0: 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d include:..[para]
43c0: 0a 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c ..SSL Status..[l
43d0: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 ist_begin defini
43e0: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 tions]..[def "[v
43f0: 61 72 20 73 74 61 74 65 5d 20 5b 61 72 67 20 73 ar state] [arg s
4400: 74 61 74 65 5d 22 5d 0a 53 74 61 74 65 20 6f 66 tate]"].State of
4410: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e the connection.
4420: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 72 ..[def "[var ser
4430: 76 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 vername] [arg na
4440: 6d 65 5d 22 5d 0a 54 68 65 20 6e 61 6d 65 20 6f me]"].The name o
4450: 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 65 64 20 f the connected
4460: 74 6f 20 73 65 72 76 65 72 2e 0a 0a 5b 64 65 66 to server...[def
4470: 20 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d "[var protocol]
4480: 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d [arg version]"]
4490: 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 .The protocol ve
44a0: 72 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 rsion used for t
44b0: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 he connection: S
44c0: 53 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c SL2, SSL3, TLS1,
44d0: 20 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c TLS1.1, TLS1.2,
44e0: 20 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e TLS1.3, or unkn
44f0: 6f 77 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 own...[def "[var
4500: 20 72 65 6e 65 67 6f 74 69 61 74 69 6f 6e 5f 61 renegotiation_a
4510: 6c 6c 6f 77 65 64 5d 20 5b 61 72 67 20 62 6f 6f llowed] [arg boo
4520: 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 lean]"].Whether
4530: 70 72 6f 74 6f 63 6f 6c 20 72 65 6e 65 67 6f 74 protocol renegot
4540: 69 61 74 69 6f 6e 20 69 73 20 73 75 70 70 6f 72 iation is suppor
4550: 74 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 ted or not...[de
4560: 66 20 22 5b 76 61 72 20 73 65 63 75 72 69 74 79 f "[var security
4570: 5f 6c 65 76 65 6c 5d 20 5b 61 72 67 20 6c 65 76 _level] [arg lev
4580: 65 6c 5d 22 5d 0a 54 68 65 20 73 65 63 75 72 69 el]"].The securi
4590: 74 79 20 6c 65 76 65 6c 20 75 73 65 64 20 66 6f ty level used fo
45a0: 72 20 73 65 6c 65 63 74 69 6f 6e 20 6f 66 20 63 r selection of c
45b0: 69 70 68 65 72 73 2c 20 6b 65 79 20 73 69 7a 65 iphers, key size
45c0: 2c 20 65 74 63 2e 0a 0a 5b 64 65 66 20 22 5b 76 , etc...[def "[v
45d0: 61 72 20 73 65 73 73 69 6f 6e 5f 72 65 75 73 65 ar session_reuse
45e0: 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d d] [arg boolean]
45f0: 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 73 "].Whether the s
4600: 65 73 73 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 ession has been
4610: 72 65 75 73 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a reused or not...
4620: 5b 64 65 66 20 22 5b 76 61 72 20 69 73 5f 73 65 [def "[var is_se
4630: 72 76 65 72 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 rver] [arg boole
4640: 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 an]"].Whether th
4650: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 69 73 20 e connection is
4660: 63 6f 6e 66 69 67 75 72 65 64 20 61 73 20 61 20 configured as a
4670: 73 65 72 76 65 72 20 28 31 29 20 6f 72 20 63 6c server (1) or cl
4680: 69 65 6e 74 20 28 30 29 2e 0a 0a 5b 64 65 66 20 ient (0)...[def
4690: 22 5b 76 61 72 20 63 6f 6d 70 72 65 73 73 69 6f "[var compressio
46a0: 6e 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a n] [arg mode]"].
46b0: 43 6f 6d 70 72 65 73 73 69 6f 6e 20 6d 65 74 68 Compression meth
46c0: 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 od...[def "[var
46d0: 65 78 70 61 6e 73 69 6f 6e 5d 20 5b 61 72 67 20 expansion] [arg
46e0: 6d 6f 64 65 5d 22 5d 0a 45 78 70 61 6e 73 69 6f mode]"].Expansio
46f0: 6e 20 6d 65 74 68 6f 64 2e 0a 0a 5b 64 65 66 20 n method...[def
4700: 22 5b 76 61 72 20 63 61 4c 69 73 74 5d 20 5b 61 "[var caList] [a
4710: 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 rg list]"].List
4720: 6f 66 20 43 65 72 74 69 66 69 63 61 74 65 20 41 of Certificate A
4730: 75 74 68 6f 72 69 74 69 65 73 20 28 43 41 29 20 uthorities (CA)
4740: 66 6f 72 20 58 2e 35 30 39 20 63 65 72 74 69 66 for X.509 certif
4750: 69 63 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e icate...[list_en
4760: 64 5d 0a 0a 43 69 70 68 65 72 20 49 6e 66 6f 0a d]..Cipher Info.
4770: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 .[list_begin def
4780: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 initions]..[def
4790: 22 5b 76 61 72 20 63 69 70 68 65 72 5d 20 5b 61 "[var cipher] [a
47a0: 72 67 20 63 69 70 68 65 72 5d 22 5d 0a 54 68 65 rg cipher]"].The
47b0: 20 63 75 72 72 65 6e 74 20 63 69 70 68 65 72 20 current cipher
47c0: 69 6e 20 75 73 65 20 66 6f 72 20 74 68 65 20 63 in use for the c
47d0: 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65 66 onnection...[def
47e0: 20 22 5b 76 61 72 20 73 74 61 6e 64 61 72 64 5f "[var standard_
47f0: 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d name] [arg name]
4800: 22 5d 0a 54 68 65 20 73 74 61 6e 64 61 72 64 20 "].The standard
4810: 52 46 43 20 6e 61 6d 65 20 6f 66 20 63 69 70 68 RFC name of ciph
4820: 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 er...[def "[var
4830: 61 6c 67 6f 72 69 74 68 6d 5f 62 69 74 73 5d 20 algorithm_bits]
4840: 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 [arg n]"].The nu
4850: 6d 62 65 72 20 6f 66 20 70 72 6f 63 65 73 73 65 mber of processe
4860: 64 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 d bits used for
4870: 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b cipher...[def "[
4880: 76 61 72 20 73 65 63 72 65 74 5f 62 69 74 73 5d var secret_bits]
4890: 20 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e [arg n]"].The n
48a0: 75 6d 62 65 72 20 6f 66 20 73 65 63 72 65 74 20 umber of secret
48b0: 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 63 69 bits used for ci
48c0: 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 pher...[def "[va
48d0: 72 20 6d 69 6e 5f 76 65 72 73 69 6f 6e 5d 20 5b r min_version] [
48e0: 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 arg version]"].T
48f0: 68 65 20 6d 69 6e 69 6d 75 6d 20 70 72 6f 74 6f he minimum proto
4900: 63 6f 6c 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 col version for
4910: 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b cipher...[def "[
4920: 76 61 72 20 63 69 70 68 65 72 5f 69 73 5f 61 65 var cipher_is_ae
4930: 61 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e ad] [arg boolean
4940: 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 ]"].Whether the
4950: 63 69 70 68 65 72 20 69 73 20 41 75 74 68 65 6e cipher is Authen
4960: 74 69 63 61 74 65 64 20 45 6e 63 72 79 70 74 69 ticated Encrypti
4970: 6f 6e 20 77 69 74 68 20 41 73 73 6f 63 69 61 74 on with Associat
4980: 65 64 20 44 61 74 61 20 28 41 45 41 44 29 2e 0a ed Data (AEAD)..
4990: 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 69 70 68 .[def "[var ciph
49a0: 65 72 5f 69 64 5d 20 5b 61 72 67 20 69 64 5d 22 er_id] [arg id]"
49b0: 5d 0a 54 68 65 20 4f 70 65 6e 53 53 4c 20 63 69 ].The OpenSSL ci
49c0: 70 68 65 72 20 69 64 2e 0a 0a 5b 64 65 66 20 22 pher id...[def "
49d0: 5b 76 61 72 20 64 65 73 63 72 69 70 74 69 6f 6e [var description
49e0: 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d ] [arg string]"]
49f0: 0a 41 20 74 65 78 74 20 64 65 73 63 72 69 70 74 .A text descript
4a00: 69 6f 6e 20 6f 66 20 74 68 65 20 63 69 70 68 65 ion of the ciphe
4a10: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 68 r...[def "[var h
4a20: 61 6e 64 73 68 61 6b 65 5f 64 69 67 65 73 74 5d andshake_digest]
4a30: 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d [arg boolean]"]
4a40: 0a 44 69 67 65 73 74 20 75 73 65 64 20 64 75 72 .Digest used dur
4a50: 69 6e 67 20 68 61 6e 64 73 68 61 6b 65 2e 0a 0a ing handshake...
4a60: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 53 65 73 73 [list_end]..Sess
4a70: 69 6f 6e 20 49 6e 66 6f 0a 0a 5b 6c 69 73 74 5f ion Info..[list_
4a80: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e begin definition
4a90: 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 s]..[def "[var a
4aa0: 6c 70 6e 5d 20 5b 61 72 67 20 70 72 6f 74 6f 63 lpn] [arg protoc
4ab0: 6f 6c 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 ol]"].The protoc
4ac0: 6f 6c 20 73 65 6c 65 63 74 65 64 20 61 66 74 65 ol selected afte
4ad0: 72 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 r Application-La
4ae0: 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 yer Protocol Neg
4af0: 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29 2e otiation (ALPN).
4b00: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 73 ..[def "[var res
4b10: 75 6d 61 62 6c 65 5d 20 5b 61 72 67 20 62 6f 6f umable] [arg boo
4b20: 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 lean]"].Whether
4b30: 74 68 65 20 73 65 73 73 69 6f 6e 20 63 61 6e 20 the session can
4b40: 62 65 20 72 65 73 75 6d 65 64 20 6f 72 20 6e 6f be resumed or no
4b50: 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 t...[def "[var s
4b60: 74 61 72 74 5f 74 69 6d 65 5d 20 5b 61 72 67 20 tart_time] [arg
4b70: 73 65 63 6f 6e 64 73 5d 22 5d 0a 54 69 6d 65 20 seconds]"].Time
4b80: 73 69 6e 63 65 20 73 65 73 73 69 6f 6e 20 73 74 since session st
4b90: 61 72 74 65 64 20 69 6e 20 73 65 63 6f 6e 64 73 arted in seconds
4ba0: 20 73 69 6e 63 65 20 65 70 6f 63 68 2e 0a 0a 5b since epoch...[
4bb0: 64 65 66 20 22 5b 76 61 72 20 74 69 6d 65 6f 75 def "[var timeou
4bc0: 74 5d 20 5b 61 72 67 20 73 65 63 6f 6e 64 73 5d t] [arg seconds]
4bd0: 22 5d 0a 4d 61 78 20 64 75 72 61 74 69 6f 6e 20 "].Max duration
4be0: 6f 66 20 73 65 73 73 69 6f 6e 20 69 6e 20 73 65 of session in se
4bf0: 63 6f 6e 64 73 20 62 65 66 6f 72 65 20 74 69 6d conds before tim
4c00: 65 2d 6f 75 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 e-out...[def "[v
4c10: 61 72 20 6c 69 66 65 74 69 6d 65 5d 20 5b 61 72 ar lifetime] [ar
4c20: 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 53 65 73 g seconds]"].Ses
4c30: 73 69 6f 6e 20 74 69 63 6b 65 74 20 6c 69 66 65 sion ticket life
4c40: 74 69 6d 65 20 68 69 6e 74 20 69 6e 20 73 65 63 time hint in sec
4c50: 6f 6e 64 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 onds...[def "[va
4c60: 72 20 73 65 73 73 69 6f 6e 5f 69 64 5d 20 5b 61 r session_id] [a
4c70: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 rg binary_string
4c80: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 ]"].Unique sessi
4c90: 6f 6e 20 69 64 20 66 6f 72 20 75 73 65 20 69 6e on id for use in
4ca0: 20 72 65 73 75 6d 69 6e 67 20 74 68 65 20 73 65 resuming the se
4cb0: 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 ssion...[def "[v
4cc0: 61 72 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65 ar session_ticke
4cd0: 74 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 t] [arg binary_s
4ce0: 74 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 tring]"].Unique
4cf0: 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 66 session ticket f
4d00: 6f 72 20 75 73 65 20 69 6e 20 72 65 73 75 6d 69 or use in resumi
4d10: 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e 2e 0a ng the session..
4d20: 0a 5b 64 65 66 20 22 5b 76 61 72 20 74 69 63 6b .[def "[var tick
4d30: 65 74 5f 61 70 70 5f 64 61 74 61 5d 20 5b 61 72 et_app_data] [ar
4d40: 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d g binary_string]
4d50: 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f "].Unique sessio
4d60: 6e 20 74 69 63 6b 65 74 20 61 70 70 6c 69 63 61 n ticket applica
4d70: 74 69 6f 6e 20 64 61 74 61 2e 0a 0a 5b 64 65 66 tion data...[def
4d80: 20 22 5b 76 61 72 20 6d 61 73 74 65 72 5f 6b 65 "[var master_ke
4d90: 79 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 y] [arg binary_s
4da0: 74 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 tring]"].Unique
4db0: 73 65 73 73 69 6f 6e 20 6d 61 73 74 65 72 20 6b session master k
4dc0: 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 ey...[def "[var
4dd0: 73 65 73 73 69 6f 6e 5f 63 61 63 68 65 5f 6d 6f session_cache_mo
4de0: 64 65 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d de] [arg mode]"]
4df0: 0a 53 65 72 76 65 72 20 63 61 63 68 65 20 6d 6f .Server cache mo
4e00: 64 65 20 28 63 6c 69 65 6e 74 2c 20 73 65 72 76 de (client, serv
4e10: 65 72 2c 20 6f 72 20 62 6f 74 68 29 2e 0a 0a 5b er, or both)...[
4e20: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c list_end]..[call
4e30: 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 69 70 68 65 [cmd tls::ciphe
4e40: 72 73 5d 20 5b 6f 70 74 20 5b 61 72 67 20 70 72 rs] [opt [arg pr
4e50: 6f 74 6f 63 6f 6c 5d 5d 20 5b 6f 70 74 20 5b 61 otocol]] [opt [a
4e60: 72 67 20 76 65 72 62 6f 73 65 5d 5d 20 5b 6f 70 rg verbose]] [op
4e70: 74 20 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 t [arg supported
4e80: 5d 5d 5d 0a 0a 57 69 74 68 6f 75 74 20 61 6e 79 ]]]..Without any
4e90: 20 6f 70 74 69 6f 6e 73 2c 20 69 74 20 72 65 74 options, it ret
4ea0: 75 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 61 urns a list of a
4eb0: 6c 6c 20 73 79 6d 6d 65 74 72 69 63 20 63 69 70 ll symmetric cip
4ec0: 68 65 72 73 20 66 6f 72 20 75 73 65 20 77 69 74 hers for use wit
4ed0: 68 20 74 68 65 0a 5b 61 72 67 20 2d 63 69 70 68 h the.[arg -ciph
4ee0: 65 72 5d 20 6f 70 74 69 6f 6e 2e 20 57 69 74 68 er] option. With
4ef0: 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 2c [arg protocol],
4f00: 20 6f 6e 6c 79 20 74 68 65 20 63 69 70 68 65 72 only the cipher
4f10: 73 20 73 75 70 70 6f 72 74 65 64 20 66 6f 72 20 s supported for
4f20: 74 68 61 74 0a 70 72 6f 74 6f 63 6f 6c 20 61 72 that.protocol ar
4f30: 65 20 72 65 74 75 72 6e 65 64 2e 20 53 65 65 20 e returned. See
4f40: 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 the [cmd tls::pr
4f50: 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 otocols] command
4f60: 20 66 6f 72 20 74 68 65 20 73 75 70 70 6f 72 74 for the support
4f70: 65 64 0a 70 72 6f 74 6f 63 6f 6c 73 2e 20 49 66 ed.protocols. If
4f80: 20 5b 61 72 67 20 76 65 72 62 6f 73 65 5d 20 69 [arg verbose] i
4f90: 73 20 73 70 65 63 69 66 69 65 64 20 61 73 20 74 s specified as t
4fa0: 72 75 65 20 74 68 65 6e 20 61 20 76 65 72 62 6f rue then a verbo
4fb0: 73 65 2c 20 68 75 6d 61 6e 20 72 65 61 64 61 62 se, human readab
4fc0: 6c 65 0a 6c 69 73 74 20 69 73 20 72 65 74 75 72 le.list is retur
4fd0: 6e 65 64 20 77 69 74 68 20 61 64 64 69 74 69 6f ned with additio
4fe0: 6e 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 nal information
4ff0: 6f 6e 20 74 68 65 20 63 69 70 68 65 72 2e 20 49 on the cipher. I
5000: 66 20 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 f [arg supported
5010: 5d 0a 69 73 20 73 70 65 63 69 66 69 65 64 20 61 ].is specified a
5020: 73 20 74 72 75 65 2c 20 74 68 65 6e 20 6f 6e 6c s true, then onl
5030: 79 20 74 68 65 20 63 69 70 68 65 72 73 20 73 75 y the ciphers su
5040: 70 70 6f 72 74 65 64 20 66 6f 72 20 70 72 6f 74 pported for prot
5050: 6f 63 6f 6c 20 77 69 6c 6c 20 62 65 20 6c 69 73 ocol will be lis
5060: 74 65 64 2e 0a 54 68 65 20 5b 61 72 67 20 73 75 ted..The [arg su
5070: 70 70 6f 72 74 65 64 5d 20 61 72 67 20 69 73 20 pported] arg is
5080: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 new for TclTLS 1
5090: 2e 38 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 .8...[call [cmd
50a0: 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 5d tls::protocols]]
50b0: 0a 0a 52 65 74 75 72 6e 73 20 61 20 6c 69 73 74 ..Returns a list
50c0: 20 6f 66 20 74 68 65 20 73 75 70 70 6f 72 74 65 of the supporte
50d0: 64 20 53 53 4c 2f 54 4c 53 20 70 72 6f 74 6f 63 d SSL/TLS protoc
50e0: 6f 6c 73 2e 20 56 61 6c 69 64 20 76 61 6c 75 65 ols. Valid value
50f0: 73 20 61 72 65 3a 0a 5b 63 6f 6e 73 74 20 73 73 s are:.[const ss
5100: 6c 32 5d 2c 20 5b 63 6f 6e 73 74 20 73 73 6c 33 l2], [const ssl3
5110: 5d 2c 20 5b 63 6f 6e 73 74 20 74 6c 73 31 5d 2c ], [const tls1],
5120: 20 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 31 5d 2c [const tls1.1],
5130: 20 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 32 5d 2c [const tls1.2],
5140: 20 61 6e 64 0a 5b 63 6f 6e 73 74 20 74 6c 73 31 and.[const tls1
5150: 2e 33 5d 2e 20 45 78 61 63 74 20 6c 69 73 74 20 .3]. Exact list
5160: 64 65 70 65 6e 64 73 20 6f 6e 20 4f 70 65 6e 53 depends on OpenS
5170: 53 4c 20 76 65 72 73 69 6f 6e 20 61 6e 64 20 63 SL version and c
5180: 6f 6d 70 69 6c 65 20 74 69 6d 65 20 66 6c 61 67 ompile time flag
5190: 73 2e 0a 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 s..This command
51a0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c is new for TclTL
51b0: 53 20 31 2e 38 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 S 1.8...[call [c
51c0: 6d 64 20 74 6c 73 3a 3a 76 65 72 73 69 6f 6e 5d md tls::version]
51d0: 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 20 4f ]..Returns the O
51e0: 70 65 6e 53 53 4c 20 76 65 72 73 69 6f 6e 20 73 penSSL version s
51f0: 74 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f 65 6e tring...[list_en
5200: 64 5d 0a 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43 d]...[section "C
5210: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 ertificate Valid
5220: 61 74 69 6f 6e 22 5d 0a 0a 5b 73 75 62 73 65 63 ation"]..[subsec
5230: 74 69 6f 6e 20 22 50 4b 49 20 61 6e 64 20 43 65 tion "PKI and Ce
5240: 72 74 69 66 69 63 61 74 65 73 22 5d 0a 0a 55 73 rtificates"]..Us
5250: 69 6e 67 20 74 68 65 20 50 75 62 6c 69 63 20 4b ing the Public K
5260: 65 79 20 49 6e 66 72 61 73 74 72 75 63 74 75 72 ey Infrastructur
5270: 65 20 28 50 4b 49 29 2c 20 65 61 63 68 20 75 73 e (PKI), each us
5280: 65 72 20 63 72 65 61 74 65 73 20 61 20 70 72 69 er creates a pri
5290: 76 61 74 65 20 6b 65 79 20 74 68 61 74 0a 6f 6e vate key that.on
52a0: 6c 79 20 74 68 65 79 20 6b 6e 6f 77 20 61 62 6f ly they know abo
52b0: 75 74 20 61 6e 64 20 61 20 70 75 62 6c 69 63 20 ut and a public
52c0: 6b 65 79 20 74 68 65 79 20 63 61 6e 20 65 78 63 key they can exc
52d0: 68 61 6e 67 65 20 77 69 74 68 20 6f 74 68 65 72 hange with other
52e0: 73 20 66 6f 72 20 75 73 65 20 69 6e 0a 65 6e 63 s for use in.enc
52f0: 72 79 70 74 69 6e 67 20 61 6e 64 20 64 65 63 72 rypting and decr
5300: 79 70 74 69 6e 67 20 64 61 74 61 2e 20 54 68 65 ypting data. The
5310: 20 70 72 6f 63 65 73 73 20 69 73 20 74 68 65 20 process is the
5320: 73 65 6e 64 65 72 20 65 6e 63 72 79 70 74 73 20 sender encrypts
5330: 74 68 65 69 72 20 64 61 74 61 0a 75 73 69 6e 67 their data.using
5340: 20 74 68 65 69 72 20 70 72 69 76 61 74 65 20 6b their private k
5350: 65 79 20 61 6e 64 20 74 68 65 20 72 65 63 65 69 ey and the recei
5360: 76 65 72 27 73 20 70 75 62 6c 69 63 20 6b 65 79 ver's public key
5370: 2e 20 54 68 65 20 64 61 74 61 20 69 73 20 74 68 . The data is th
5380: 65 6e 20 73 65 6e 74 0a 74 6f 20 74 68 65 20 72 en sent.to the r
5390: 65 63 65 69 76 65 72 2e 20 49 6e 20 61 20 73 69 eceiver. In a si
53a0: 6d 69 6c 61 72 20 6d 61 6e 6e 65 72 2c 20 74 68 milar manner, th
53b0: 65 20 72 65 63 65 69 76 65 72 20 75 73 65 73 20 e receiver uses
53c0: 74 68 65 69 72 20 70 72 69 76 61 74 65 20 6b 65 their private ke
53d0: 79 20 61 6e 64 0a 74 68 65 20 73 65 6e 64 65 72 y and.the sender
53e0: 27 73 20 70 75 62 6c 69 63 20 6b 65 79 20 74 6f 's public key to
53f0: 20 64 65 63 72 79 70 74 20 74 68 65 20 64 61 74 decrypt the dat
5400: 61 2e 20 54 68 69 73 20 70 72 6f 76 69 64 65 73 a. This provides
5410: 20 64 61 74 61 20 69 6e 74 65 67 72 69 74 79 2c data integrity,
5420: 20 74 6f 0a 65 6e 73 75 72 65 20 74 68 65 20 64 to.ensure the d
5430: 61 74 61 20 63 61 6e 27 74 20 62 65 20 76 69 65 ata can't be vie
5440: 77 65 64 20 6f 72 20 61 6c 74 65 72 65 64 20 64 wed or altered d
5450: 75 72 69 6e 67 20 74 72 61 6e 73 70 6f 72 74 2e uring transport.
5460: 20 53 65 65 20 74 68 65 0a 5b 6f 70 74 69 6f 6e See the.[option
5470: 20 2d 6b 65 79 5d 20 61 6e 64 20 5b 6f 70 74 69 -key] and [opti
5480: 6f 6e 20 2d 6b 65 79 66 69 6c 65 5d 20 6f 70 74 on -keyfile] opt
5490: 69 6f 6e 73 20 66 6f 72 20 68 6f 77 20 74 6f 20 ions for how to
54a0: 73 70 65 63 69 66 79 20 74 68 65 20 70 72 69 76 specify the priv
54b0: 61 74 65 20 6b 65 79 2e 0a 41 6c 73 6f 20 73 65 ate key..Also se
54c0: 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 e the [option -p
54d0: 61 73 73 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 20 assword] option
54e0: 66 6f 72 20 68 6f 77 20 74 6f 20 70 72 6f 76 69 for how to provi
54f0: 64 65 20 74 68 65 20 70 61 73 73 77 6f 72 64 2e de the password.
5500: 0a 5b 70 61 72 61 5d 0a 49 6e 20 6f 72 64 65 72 .[para].In order
5510: 20 74 6f 20 70 72 6f 76 69 64 65 20 61 75 74 68 to provide auth
5520: 65 6e 74 69 63 61 74 69 6f 6e 2c 20 69 2e 65 2e entication, i.e.
5530: 20 65 6e 73 75 72 69 6e 67 20 73 6f 6d 65 6f 6e ensuring someon
5540: 65 20 69 73 20 77 68 6f 20 74 68 65 79 20 73 61 e is who they sa
5550: 79 20 74 68 65 79 0a 61 72 65 2c 20 74 68 65 20 y they.are, the
5560: 70 75 62 6c 69 63 20 6b 65 79 20 61 6e 64 20 75 public key and u
5570: 73 65 72 20 69 64 65 6e 74 69 66 69 63 61 74 69 ser identificati
5580: 6f 6e 20 69 6e 66 6f 20 69 73 20 73 74 6f 72 65 on info is store
5590: 64 20 69 6e 20 61 20 58 2e 35 30 39 0a 63 65 72 d in a X.509.cer
55a0: 74 69 66 69 63 61 74 65 20 61 6e 64 20 74 68 61 tificate and tha
55b0: 74 20 63 65 72 74 69 66 69 63 61 74 65 20 69 73 t certificate is
55c0: 20 61 75 74 68 65 6e 74 69 63 61 74 65 64 20 28 authenticated (
55d0: 69 2e 65 2e 20 73 69 67 6e 65 64 29 20 62 79 20 i.e. signed) by
55e0: 61 20 43 65 72 74 69 66 69 63 61 74 65 0a 41 75 a Certificate.Au
55f0: 74 68 6f 72 69 74 79 20 28 43 41 29 2e 20 55 73 thority (CA). Us
5600: 65 72 73 20 63 61 6e 20 74 68 65 6e 20 65 78 63 ers can then exc
5610: 68 61 6e 67 65 20 74 68 65 73 65 20 63 65 72 74 hange these cert
5620: 69 66 69 63 61 74 65 73 20 64 75 72 69 6e 67 20 ificates during
5630: 74 68 65 20 54 4c 53 0a 69 6e 69 74 69 61 6c 69 the TLS.initiali
5640: 7a 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 61 zation process a
5650: 6e 64 20 63 68 65 63 6b 20 74 68 65 6d 20 61 67 nd check them ag
5660: 61 69 6e 73 74 20 74 68 65 20 72 6f 6f 74 20 43 ainst the root C
5670: 41 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 A certificates t
5680: 6f 20 65 6e 73 75 72 65 0a 74 68 65 79 20 61 72 o ensure.they ar
5690: 65 20 76 61 6c 69 64 2e 20 54 68 69 73 20 69 73 e valid. This is
56a0: 20 68 61 6e 64 6c 65 64 20 62 79 20 4f 70 65 6e handled by Open
56b0: 53 53 4c 20 76 69 61 20 74 68 65 20 5b 6f 70 74 SSL via the [opt
56c0: 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 61 6e ion -request] an
56d0: 64 0a 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 d.[option -requi
56e0: 72 65 5d 20 6f 70 74 69 6f 6e 73 2e 20 53 65 65 re] options. See
56f0: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 the [option -ca
5700: 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 dir], [option -c
5710: 61 64 69 72 5d 2c 20 61 6e 64 0a 5b 6f 70 74 69 adir], and.[opti
5720: 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 on -castore] opt
5730: 69 6f 6e 73 20 66 6f 72 20 68 6f 77 20 74 6f 20 ions for how to
5740: 73 70 65 63 69 66 79 20 77 68 65 72 65 20 74 6f specify where to
5750: 20 66 69 6e 64 20 74 68 65 20 43 41 20 63 65 72 find the CA cer
5760: 74 69 66 69 63 61 74 65 73 2e 0a 4f 70 74 69 6f tificates..Optio
5770: 6e 61 6c 6c 79 2c 20 69 6e 20 61 20 66 75 74 75 nally, in a futu
5780: 72 65 20 72 65 6c 65 61 73 65 2c 20 74 68 65 79 re release, they
5790: 20 63 61 6e 20 61 6c 73 6f 20 62 65 20 63 68 65 can also be che
57a0: 63 6b 65 64 20 61 67 61 69 6e 73 74 20 74 68 65 cked against the
57b0: 20 43 65 72 74 69 66 69 63 61 74 65 0a 52 65 76 Certificate.Rev
57c0: 6f 63 61 74 69 6f 6e 20 4c 69 73 74 20 28 43 52 ocation List (CR
57d0: 4c 29 20 6f 66 20 72 65 76 6f 6b 65 64 20 63 65 L) of revoked ce
57e0: 72 74 69 66 69 63 61 74 65 73 2e 20 43 65 72 74 rtificates. Cert
57f0: 69 66 69 63 61 74 65 73 20 63 61 6e 20 61 6c 73 ificates can als
5800: 6f 20 62 65 0a 73 65 6c 66 2d 73 69 67 6e 65 64 o be.self-signed
5810: 2c 20 62 75 74 20 74 68 65 79 20 61 72 65 20 62 , but they are b
5820: 79 20 64 65 66 61 75 6c 74 20 6e 6f 74 20 74 72 y default not tr
5830: 75 73 74 65 64 20 75 6e 6c 65 73 73 20 79 6f 75 usted unless you
5840: 20 61 64 64 20 74 68 65 6d 20 74 6f 20 79 6f 75 add them to you
5850: 72 0a 63 65 72 74 69 66 69 63 61 74 65 20 73 74 r.certificate st
5860: 6f 72 65 2e 0a 5b 70 61 72 61 5d 0a 54 79 70 69 ore..[para].Typi
5870: 63 61 6c 6c 79 20 77 68 65 6e 20 76 69 73 69 74 cally when visit
5880: 69 6e 67 20 77 65 62 20 73 69 74 65 73 2c 20 6f ing web sites, o
5890: 6e 6c 79 20 74 68 65 20 63 6c 69 65 6e 74 20 6e nly the client n
58a0: 65 65 64 73 20 74 6f 20 63 68 65 63 6b 20 74 68 eeds to check th
58b0: 65 20 73 65 72 76 65 72 27 73 0a 63 65 72 74 69 e server's.certi
58c0: 66 69 63 61 74 65 20 74 6f 20 65 6e 73 75 72 65 ficate to ensure
58d0: 20 69 74 20 69 73 20 76 61 6c 69 64 2e 20 54 68 it is valid. Th
58e0: 65 20 73 65 72 76 65 72 20 64 6f 65 73 6e 27 74 e server doesn't
58f0: 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74 need to check t
5900: 68 65 20 63 6c 69 65 6e 74 0a 63 65 72 74 69 66 he client.certif
5910: 69 63 61 74 65 20 75 6e 6c 65 73 73 20 79 6f 75 icate unless you
5920: 20 6e 65 65 64 20 74 6f 20 61 75 74 68 65 6e 74 need to authent
5930: 69 63 61 74 65 20 77 69 74 68 20 74 68 65 6d 20 icate with them
5940: 74 6f 20 6c 6f 67 69 6e 2c 20 65 74 63 2e 20 53 to login, etc. S
5950: 65 65 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d ee the.[option -
5960: 63 65 72 74 5d 20 61 6e 64 20 5b 6f 70 74 69 6f cert] and [optio
5970: 6e 20 2d 63 65 72 74 66 69 6c 65 5d 20 6f 70 74 n -certfile] opt
5980: 69 6f 6e 73 20 69 66 20 79 6f 75 20 6e 65 65 64 ions if you need
5990: 20 74 6f 20 70 72 6f 76 69 64 65 20 61 20 63 65 to provide a ce
59a0: 72 74 69 66 69 63 61 74 65 2e 0a 0a 0a 5b 73 75 rtificate....[su
59b0: 62 73 65 63 74 69 6f 6e 20 22 53 75 6d 6d 61 72 bsection "Summar
59c0: 79 20 6f 66 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e y of command lin
59d0: 65 20 6f 70 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 e options"]..The
59e0: 20 66 6f 6c 6c 6f 77 69 6e 67 20 6f 70 74 69 6f following optio
59f0: 6e 73 20 61 72 65 20 75 73 65 64 20 66 6f 72 20 ns are used for
5a00: 70 65 65 72 20 63 65 72 74 69 66 69 63 61 74 65 peer certificate
5a10: 20 76 61 6c 69 64 61 74 69 6f 6e 3a 0a 0a 5b 6c validation:..[l
5a20: 69 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e ist_begin option
5a30: 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 s]..[opt_def -ca
5a40: 64 69 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f dir [arg directo
5a50: 72 79 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 ry]].Specifies t
5a60: 68 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 he directory whe
5a70: 72 65 20 74 68 65 20 43 65 72 74 69 66 69 63 61 re the Certifica
5a80: 74 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 te Authority (CA
5a90: 29 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61 ) certificates a
5aa0: 72 65 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 re.stored. The d
5ab0: 65 66 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f efault is platfo
5ac0: 72 6d 20 73 70 65 63 69 66 69 63 2c 20 62 75 74 rm specific, but
5ad0: 20 69 73 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c is usually [fil
5ae0: 65 20 2f 65 74 63 2f 73 73 6c 2f 63 65 72 74 73 e /etc/ssl/certs
5af0: 5d 20 6f 6e 0a 4c 69 6e 75 78 2f 55 6e 69 78 20 ] on.Linux/Unix
5b00: 73 79 73 74 65 6d 73 2e 20 54 68 65 20 64 65 66 systems. The def
5b10: 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63 61 ault location ca
5b20: 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 n be overridden
5b30: 62 79 20 74 68 65 0a 5b 76 61 72 20 53 53 4c 5f by the.[var SSL_
5b40: 43 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72 6f CERT_DIR] enviro
5b50: 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 2e 0a nment variable..
5b60: 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 66 69 6c .[opt_def -cafil
5b70: 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d e [arg filename]
5b80: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 ].Specifies the
5b90: 66 69 6c 65 20 77 69 74 68 20 74 68 65 20 43 65 file with the Ce
5ba0: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 rtificate Author
5bb0: 69 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69 ity (CA) certifi
5bc0: 63 61 74 65 73 20 74 6f 20 75 73 65 20 69 6e 0a cates to use in.
5bd0: 5b 63 6f 6e 73 74 20 50 45 4d 5d 20 66 69 6c 65 [const PEM] file
5be0: 20 66 6f 72 6d 61 74 2e 20 54 68 65 20 64 65 66 format. The def
5bf0: 61 75 6c 74 20 69 73 20 5b 66 69 6c 65 20 63 65 ault is [file ce
5c00: 72 74 2e 70 65 6d 5d 2c 20 69 6e 20 74 68 65 20 rt.pem], in the
5c10: 4f 70 65 6e 53 53 4c 0a 64 69 72 65 63 74 6f 72 OpenSSL.director
5c20: 79 2e 20 4f 6e 20 4c 69 6e 75 78 2f 55 6e 69 78 y. On Linux/Unix
5c30: 20 73 79 73 74 65 6d 73 2c 20 74 68 69 73 20 69 systems, this i
5c40: 73 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20 s usually [file
5c50: 2f 65 74 63 2f 73 73 6c 2f 63 61 2d 62 75 6e 64 /etc/ssl/ca-bund
5c60: 6c 65 2e 70 65 6d 5d 2e 0a 54 68 65 20 64 65 66 le.pem]..The def
5c70: 61 75 6c 74 20 66 69 6c 65 20 63 61 6e 20 62 65 ault file can be
5c80: 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 overridden by t
5c90: 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 he [var SSL_CERT
5ca0: 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 _FILE] environme
5cb0: 6e 74 0a 76 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f nt.variable...[o
5cc0: 70 74 5f 64 65 66 20 2d 63 61 73 74 6f 72 65 20 pt_def -castore
5cd0: 5b 61 72 67 20 55 52 49 5d 5d 0a 53 70 65 63 69 [arg URI]].Speci
5ce0: 66 69 65 73 20 74 68 65 20 55 6e 69 66 6f 72 6d fies the Uniform
5cf0: 20 52 65 73 6f 75 72 63 65 20 49 64 65 6e 74 69 Resource Identi
5d00: 66 69 65 72 20 28 55 52 49 29 20 66 6f 72 20 74 fier (URI) for t
5d10: 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41 he Certificate A
5d20: 75 74 68 6f 72 69 74 79 0a 28 43 41 29 20 73 74 uthority.(CA) st
5d30: 6f 72 65 2c 20 77 68 69 63 68 20 6d 61 79 20 62 ore, which may b
5d40: 65 20 61 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61 e a single conta
5d50: 69 6e 65 72 20 6f 72 20 61 20 63 61 74 61 6c 6f iner or a catalo
5d60: 67 20 6f 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e g of containers.
5d70: 0a 53 74 61 72 74 69 6e 67 20 77 69 74 68 20 4f .Starting with O
5d80: 70 65 6e 53 53 4c 20 33 2e 32 20 6f 6e 20 4d 53 penSSL 3.2 on MS
5d90: 20 57 69 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f Windows, set to
5da0: 20 22 5b 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 "[const "org.op
5db0: 65 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f enssl.winstore:/
5dc0: 2f 22 5d 22 0a 74 6f 20 75 73 65 20 74 68 65 20 /"]".to use the
5dd0: 62 75 69 6c 74 2d 69 6e 20 4d 53 20 57 69 6e 64 built-in MS Wind
5de0: 6f 77 73 20 43 65 72 74 69 66 69 63 61 74 65 20 ows Certificate
5df0: 53 74 6f 72 65 2e 20 53 74 61 72 74 69 6e 67 20 Store. Starting
5e00: 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 in TclTLS 2.0, t
5e10: 68 69 73 0a 69 73 20 74 68 65 20 64 65 66 61 75 his.is the defau
5e20: 6c 74 20 69 66 20 5b 6f 70 74 69 6f 6e 20 2d 63 lt if [option -c
5e30: 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d adir], [option -
5e40: 63 61 64 69 72 5d 2c 20 61 6e 64 20 5b 6f 70 74 cadir], and [opt
5e50: 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 61 72 ion -castore] ar
5e60: 65 0a 6e 6f 74 20 73 70 65 63 69 66 69 65 64 2e e.not specified.
5e70: 20 54 68 69 73 20 73 74 6f 72 65 20 6f 6e 6c 79 This store only
5e80: 20 73 75 70 70 6f 72 74 73 20 72 6f 6f 74 20 63 supports root c
5e90: 65 72 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 ertificate store
5ea0: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 s...[opt_def -re
5eb0: 71 75 65 73 74 20 5b 61 72 67 20 62 6f 6f 6c 5d quest [arg bool]
5ec0: 5d 0a 52 65 71 75 65 73 74 20 61 20 63 65 72 74 ].Request a cert
5ed0: 69 66 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65 ificate from the
5ee0: 20 70 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 peer during the
5ef0: 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 SSL handshake.
5f00: 54 68 69 73 20 69 73 20 6e 65 65 64 65 64 0a 74 This is needed.t
5f10: 6f 20 64 6f 20 43 65 72 74 69 66 69 63 61 74 65 o do Certificate
5f20: 20 56 61 6c 69 64 61 74 69 6f 6e 2e 20 53 74 61 Validation. Sta
5f30: 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 rting in TclTLS
5f40: 31 2e 38 2c 20 74 68 65 20 64 65 66 61 75 6c 74 1.8, the default
5f50: 20 69 73 0a 5b 63 6f 6e 73 74 20 74 72 75 65 5d is.[const true]
5f60: 20 66 6f 72 20 63 6c 69 65 6e 74 20 63 6f 6e 6e for client conn
5f70: 65 63 74 69 6f 6e 73 2e 20 53 74 61 72 74 69 6e ections. Startin
5f80: 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c g in TclTLS 2.0,
5f90: 20 69 66 20 73 65 74 20 74 6f 0a 5b 63 6f 6e 73 if set to.[cons
5fa0: 74 20 66 61 6c 73 65 5d 20 61 6e 64 20 5b 6f 70 t false] and [op
5fb0: 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 69 tion -require] i
5fc0: 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2c 20 s [const true],
5fd0: 74 68 65 6e 20 74 68 69 73 20 77 69 6c 6c 20 62 then this will b
5fe0: 65 0a 6f 76 65 72 72 69 64 64 65 6e 20 74 6f 20 e.overridden to
5ff0: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 49 6e [const true]. In
6000: 20 61 64 64 69 74 69 6f 6e 2c 20 74 68 65 20 63 addition, the c
6010: 6c 69 65 6e 74 20 63 61 6e 20 6d 61 6e 75 61 6c lient can manual
6020: 6c 79 20 69 6e 73 70 65 63 74 20 61 6e 64 0a 61 ly inspect and.a
6030: 63 63 65 70 74 20 6f 72 20 72 65 6a 65 63 74 20 ccept or reject
6040: 65 61 63 68 20 63 65 72 74 69 66 69 63 61 74 65 each certificate
6050: 20 75 73 69 6e 67 20 74 68 65 20 5b 6f 70 74 69 using the [opti
6060: 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d on -validatecomm
6070: 61 6e 64 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f and] option...[o
6080: 70 74 5f 64 65 66 20 2d 72 65 71 75 69 72 65 20 pt_def -require
6090: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 [arg bool]].Requ
60a0: 69 72 65 20 61 20 76 61 6c 69 64 20 63 65 72 74 ire a valid cert
60b0: 69 66 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65 ificate from the
60c0: 20 70 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 peer during the
60d0: 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 SSL handshake.
60e0: 49 66 20 74 68 69 73 20 69 73 0a 73 65 74 20 74 If this is.set t
60f0: 6f 20 74 72 75 65 2c 20 74 68 65 6e 20 5b 6f 70 o true, then [op
6100: 74 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 6d tion -request] m
6110: 75 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74 20 ust also be set
6120: 74 6f 20 74 72 75 65 20 61 6e 64 20 61 20 65 69 to true and a ei
6130: 74 68 65 72 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 ther.[option -ca
6140: 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 dir], [option -c
6150: 61 66 69 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 afile], [option
6160: 2d 63 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20 -castore], or a
6170: 70 6c 61 74 66 6f 72 6d 20 64 65 66 61 75 6c 74 platform default
6180: 0a 6d 75 73 74 20 62 65 20 70 72 6f 76 69 64 65 .must be provide
6190: 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 76 61 d in order to va
61a0: 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20 lidate against.
61b0: 54 68 65 20 64 65 66 61 75 6c 74 20 69 6e 20 54 The default in T
61c0: 63 6c 54 4c 53 20 31 2e 38 20 61 6e 64 0a 65 61 clTLS 1.8 and.ea
61d0: 72 6c 69 65 72 20 76 65 72 73 69 6f 6e 73 20 69 rlier versions i
61e0: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20 s [const false]
61f0: 73 69 6e 63 65 20 6e 6f 74 20 61 6c 6c 20 70 6c since not all pl
6200: 61 74 66 6f 72 6d 73 20 68 61 76 65 20 63 65 72 atforms have cer
6210: 74 69 66 69 63 61 74 65 73 20 74 6f 0a 76 61 6c tificates to.val
6220: 69 64 61 74 65 20 61 67 61 69 6e 73 74 20 69 6e idate against in
6230: 20 61 20 66 6f 72 6d 20 63 6f 6d 70 61 74 69 62 a form compatib
6240: 6c 65 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 2e le with OpenSSL.
6250: 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c Starting in Tcl
6260: 54 4c 53 20 32 2e 30 2c 0a 74 68 65 20 64 65 66 TLS 2.0,.the def
6270: 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 ault is [const t
6280: 72 75 65 5d 20 66 6f 72 20 63 6c 69 65 6e 74 20 rue] for client
6290: 63 6f 6e 6e 65 63 74 69 6f 6e 73 2e 0a 0a 5b 6c connections...[l
62a0: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 ist_end]..[subse
62b0: 63 74 69 6f 6e 20 22 57 68 65 6e 20 61 72 65 20 ction "When are
62c0: 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 6f 70 74 command line opt
62d0: 69 6f 6e 73 20 6e 65 65 64 65 64 3f 22 5d 0a 0a ions needed?"]..
62e0: 49 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61 6e In TclTLS 1.8 an
62f0: 64 20 65 61 72 6c 69 65 72 20 76 65 72 73 69 6f d earlier versio
6300: 6e 73 2c 20 63 65 72 74 69 66 69 63 61 74 65 20 ns, certificate
6310: 76 61 6c 69 64 61 74 69 6f 6e 20 69 73 0a 5b 65 validation is.[e
6320: 6d 70 68 20 4e 4f 54 5d 20 65 6e 61 62 6c 65 64 mph NOT] enabled
6330: 20 62 79 20 64 65 66 61 75 6c 74 2e 20 54 68 69 by default. Thi
6340: 73 20 6c 69 6d 69 74 61 74 69 6f 6e 20 69 73 20 s limitation is
6350: 64 75 65 20 74 6f 20 74 68 65 20 6c 61 63 6b 20 due to the lack
6360: 6f 66 20 61 20 63 6f 6d 6d 6f 6e 0a 63 72 6f 73 of a common.cros
6370: 73 20 70 6c 61 74 66 6f 72 6d 20 64 61 74 61 62 s platform datab
6380: 61 73 65 20 6f 66 20 43 65 72 74 69 66 69 63 61 ase of Certifica
6390: 74 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 te Authority (CA
63a0: 29 20 70 72 6f 76 69 64 65 64 20 63 65 72 74 69 ) provided certi
63b0: 66 69 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 ficates to.valid
63c0: 61 74 65 20 61 67 61 69 6e 73 74 2e 20 4d 61 6e ate against. Man
63d0: 79 20 4c 69 6e 75 78 20 73 79 73 74 65 6d 73 20 y Linux systems
63e0: 6e 61 74 69 76 65 6c 79 20 73 75 70 70 6f 72 74 natively support
63f0: 20 4f 70 65 6e 53 53 4c 20 61 6e 64 20 74 68 75 OpenSSL and thu
6400: 73 20 68 61 76 65 0a 74 68 65 73 65 20 63 65 72 s have.these cer
6410: 74 69 66 69 63 61 74 65 73 20 69 6e 73 74 61 6c tificates instal
6420: 6c 65 64 20 61 73 20 70 61 72 74 20 6f 66 20 74 led as part of t
6430: 68 65 20 4f 53 2c 20 62 75 74 20 4d 61 63 4f 53 he OS, but MacOS
6440: 20 61 6e 64 20 4d 53 20 57 69 6e 64 6f 77 73 20 and MS Windows
6450: 64 6f 20 6e 6f 74 2e 0a 53 74 61 72 69 6e 67 20 do not..Staring
6460: 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 in TclTLS 2.0, t
6470: 68 65 20 64 65 66 61 75 6c 74 20 66 6f 72 20 63 he default for c
6480: 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e lient connection
6490: 73 20 68 61 73 20 62 65 65 6e 20 63 68 61 6e 67 s has been chang
64a0: 65 64 20 74 6f 0a 72 65 71 75 69 72 65 20 63 65 ed to.require ce
64b0: 72 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 61 rtificate valida
64c0: 74 69 6f 6e 20 62 79 20 64 65 66 61 75 6c 74 2e tion by default.
64d0: 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 75 73 65 In order to use
64e0: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 the [option -re
64f0: 71 75 69 72 65 5d 0a 6f 70 74 69 6f 6e 2c 20 6f quire].option, o
6500: 6e 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 ne of the follow
6510: 69 6e 67 20 6d 75 73 74 20 62 65 20 74 72 75 65 ing must be true
6520: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 69 :..[list_begin i
6530: 74 65 6d 69 7a 65 64 5d 0a 0a 5b 69 74 65 6d 5d temized]..[item]
6540: 0a 4f 6e 20 4c 69 6e 75 78 20 61 6e 64 20 55 6e .On Linux and Un
6550: 69 78 20 73 79 73 74 65 6d 73 20 77 69 74 68 20 ix systems with
6560: 4f 70 65 6e 53 53 4c 20 61 6c 72 65 61 64 79 20 OpenSSL already
6570: 69 6e 73 74 61 6c 6c 65 64 20 6f 72 20 69 66 20 installed or if
6580: 74 68 65 20 43 41 0a 63 65 72 74 69 66 69 63 61 the CA.certifica
6590: 74 65 73 20 61 72 65 20 61 76 61 69 6c 61 62 6c tes are availabl
65a0: 65 20 69 6e 20 50 45 4d 20 66 6f 72 6d 61 74 2c e in PEM format,
65b0: 20 61 6e 64 20 69 66 20 74 68 65 79 20 61 72 65 and if they are
65c0: 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 0a 73 stored in the.s
65d0: 74 61 6e 64 61 72 64 20 6c 6f 63 61 74 69 6f 6e tandard location
65e0: 73 2c 20 6f 72 20 69 66 20 74 68 65 20 5b 76 61 s, or if the [va
65f0: 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20 r SSL_CERT_DIR]
6600: 6f 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 or [var SSL_CERT
6610: 5f 46 49 4c 45 5d 0a 65 6e 76 69 72 6f 6e 6d 65 _FILE].environme
6620: 6e 74 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 nt variables are
6630: 20 73 65 74 2c 20 74 68 65 6e 20 5b 6f 70 74 69 set, then [opti
6640: 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 on -cadir], [opt
6650: 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 61 6e 64 ion -cadir],.and
6660: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 [option -castor
6670: 65 5d 20 61 72 65 6e 27 74 20 6e 65 65 64 65 64 e] aren't needed
6680: 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65 ...[item].If Ope
6690: 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74 nSSL is not inst
66a0: 61 6c 6c 65 64 20 69 6e 20 74 68 65 20 64 65 66 alled in the def
66b0: 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 2c 20 6f ault location, o
66c0: 72 20 77 68 65 6e 20 75 73 69 6e 67 20 4d 61 63 r when using Mac
66d0: 20 4f 53 0a 6f 72 20 4d 53 20 57 69 6e 64 6f 77 OS.or MS Window
66e0: 73 20 61 6e 64 20 4f 70 65 6e 53 53 4c 20 69 73 s and OpenSSL is
66f0: 20 69 6e 73 74 61 6c 6c 65 64 2c 20 74 68 65 20 installed, the
6700: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 [var SSL_CERT_DI
6710: 52 5d 20 61 6e 64 2f 6f 72 0a 5b 76 61 72 20 53 R] and/or.[var S
6720: 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e SL_CERT_FILE] en
6730: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 vironment variab
6740: 6c 65 73 20 6f 72 20 74 68 65 20 6f 6e 65 20 6f les or the one o
6750: 66 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 f the [option -c
6760: 61 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d adir],.[option -
6770: 63 61 64 69 72 5d 2c 20 6f 72 20 5b 6f 70 74 69 cadir], or [opti
6780: 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 on -castore] opt
6790: 69 6f 6e 73 20 6d 75 73 74 20 62 65 20 64 65 66 ions must be def
67a0: 69 6e 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e ined...[item].On
67b0: 20 4d 53 20 57 69 6e 64 6f 77 73 2c 20 73 74 61 MS Windows, sta
67c0: 72 74 69 6e 67 20 69 6e 20 4f 70 65 6e 53 53 4c rting in OpenSSL
67d0: 20 33 2e 32 2c 20 69 74 20 69 73 20 6e 6f 77 20 3.2, it is now
67e0: 70 6f 73 73 69 62 6c 65 20 74 6f 20 61 63 63 65 possible to acce
67f0: 73 73 20 74 68 65 0a 62 75 69 6c 74 2d 69 6e 20 ss the.built-in
6800: 57 69 6e 64 6f 77 73 20 43 65 72 74 69 66 69 63 Windows Certific
6810: 61 74 65 20 53 74 6f 72 65 20 66 72 6f 6d 20 4f ate Store from O
6820: 70 65 6e 53 53 4c 2e 20 54 68 69 73 20 63 61 6e penSSL. This can
6830: 20 62 65 20 75 74 69 6c 69 7a 65 64 20 62 79 0a be utilized by.
6840: 73 65 74 74 69 6e 67 20 74 68 65 20 5b 6f 70 74 setting the [opt
6850: 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 ion -castore] op
6860: 74 69 6f 6e 20 74 6f 20 22 5b 63 6f 6e 73 74 20 tion to "[const
6870: 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 org.openssl.wins
6880: 74 6f 72 65 3a 2f 2f 5d 22 2e 0a 49 6e 20 54 63 tore://]"..In Tc
6890: 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69 73 20 69 lTLS 2.0, this i
68a0: 73 20 74 68 65 20 64 65 66 61 75 6c 74 20 76 61 s the default va
68b0: 6c 75 65 20 69 66 20 5b 6f 70 74 69 6f 6e 20 2d lue if [option -
68c0: 63 61 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 cadir],.[option
68d0: 2d 63 61 64 69 72 5d 2c 20 61 6e 64 20 5b 6f 70 -cadir], and [op
68e0: 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 61 tion -castore] a
68f0: 72 65 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64 re not specified
6900: 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65 ...[item].If Ope
6910: 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74 nSSL is not inst
6920: 61 6c 6c 65 64 20 6f 72 20 74 68 65 20 43 41 20 alled or the CA
6930: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65 certificates are
6940: 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 20 69 not available i
6950: 6e 20 50 45 4d 0a 66 6f 72 6d 61 74 2c 20 74 68 n PEM.format, th
6960: 65 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65 e CA certificate
6970: 73 20 6d 75 73 74 20 62 65 20 64 6f 77 6e 6c 6f s must be downlo
6980: 61 64 65 64 20 61 6e 64 20 69 6e 73 74 61 6c 6c aded and install
6990: 65 64 20 77 69 74 68 20 74 68 65 20 75 73 65 72 ed with the user
69a0: 0a 73 6f 66 74 77 61 72 65 2e 20 54 68 65 20 43 .software. The C
69b0: 55 52 4c 20 74 65 61 6d 20 6d 61 6b 65 73 20 74 URL team makes t
69c0: 68 65 6d 20 61 76 61 69 6c 61 62 6c 65 20 61 74 hem available at
69d0: 0a 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 63 .[uri "https://c
69e0: 75 72 6c 2e 73 65 2f 64 6f 63 73 2f 63 61 65 78 url.se/docs/caex
69f0: 74 72 61 63 74 2e 68 74 6d 6c 22 20 22 43 41 20 tract.html" "CA
6a00: 63 65 72 74 69 66 69 63 61 74 65 73 20 65 78 74 certificates ext
6a10: 72 61 63 74 65 64 0a 66 72 6f 6d 20 4d 6f 7a 69 racted.from Mozi
6a20: 6c 6c 61 22 5d 20 69 6e 20 74 68 65 20 5b 66 69 lla"] in the [fi
6a30: 6c 65 20 63 61 63 65 72 74 2e 70 65 6d 5d 20 66 le cacert.pem] f
6a40: 69 6c 65 2e 20 59 6f 75 20 6d 75 73 74 20 74 68 ile. You must th
6a50: 65 6e 20 65 69 74 68 65 72 20 73 65 74 20 74 68 en either set th
6a60: 65 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f e.[var SSL_CERT_
6a70: 44 49 52 5d 20 61 6e 64 2f 6f 72 20 5b 76 61 72 DIR] and/or [var
6a80: 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 SSL_CERT_FILE]
6a90: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 environment vari
6aa0: 61 62 6c 65 73 20 6f 72 20 74 68 65 0a 5b 6f 70 ables or the.[op
6ab0: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 20 6f 72 20 tion -cadir] or
6ac0: 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d [option -cafile]
6ad0: 20 6f 70 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 options to the
6ae0: 43 41 20 63 65 72 74 20 66 69 6c 65 27 73 20 69 CA cert file's i
6af0: 6e 73 74 61 6c 6c 0a 6c 6f 63 61 74 69 6f 6e 2e nstall.location.
6b00: 20 49 74 20 69 73 20 79 6f 75 72 20 72 65 73 70 It is your resp
6b10: 6f 6e 73 69 62 69 6c 69 74 79 20 74 6f 20 6b 65 onsibility to ke
6b20: 65 70 20 74 68 69 73 20 66 69 6c 65 20 75 70 20 ep this file up
6b30: 74 6f 20 64 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f to date...[list_
6b40: 65 6e 64 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 end]..[section "
6b50: 43 61 6c 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73 Callback Options
6b60: 22 5d 0a 0a 41 73 20 70 72 65 76 69 6f 75 73 6c "]..As previousl
6b70: 79 20 64 65 73 63 72 69 62 65 64 2c 20 65 61 63 y described, eac
6b80: 68 20 63 68 61 6e 6e 65 6c 20 63 61 6e 20 62 65 h channel can be
6b90: 20 67 69 76 65 6e 20 74 68 65 69 72 20 6f 77 6e given their own
6ba0: 20 63 61 6c 6c 62 61 63 6b 73 0a 74 6f 20 68 61 callbacks.to ha
6bb0: 6e 64 6c 65 20 69 6e 74 65 72 6d 65 64 69 61 74 ndle intermediat
6bc0: 65 20 70 72 6f 63 65 73 73 69 6e 67 20 62 79 20 e processing by
6bd0: 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 the OpenSSL libr
6be0: 61 72 79 2c 20 75 73 69 6e 67 20 74 68 65 0a 5b ary, using the.[
6bf0: 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d option -command]
6c00: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 , [option -passw
6c10: 6f 72 64 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f ord], and [optio
6c20: 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d n -validate_comm
6c30: 61 6e 64 5d 20 6f 70 74 69 6f 6e 73 0a 70 61 73 and] options.pas
6c40: 73 65 64 20 74 6f 20 65 69 74 68 65 72 20 6f 66 sed to either of
6c50: 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 [cmd tls::socke
6c60: 74 5d 20 6f 72 20 5b 63 6d 64 20 74 6c 73 3a 3a t] or [cmd tls::
6c70: 69 6d 70 6f 72 74 5d 2e 0a 55 6e 6c 69 6b 65 20 import]..Unlike
6c80: 70 72 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e previous version
6c90: 73 20 6f 66 20 54 63 6c 54 4c 53 2c 20 6f 6e 6c s of TclTLS, onl
6ca0: 79 20 69 66 20 74 68 65 20 63 61 6c 6c 62 61 63 y if the callbac
6cb0: 6b 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 65 k generates an e
6cc0: 72 72 6f 72 2c 0a 77 69 6c 6c 20 74 68 65 20 5b rror,.will the [
6cd0: 73 79 73 63 6d 64 20 62 67 65 72 72 6f 72 5d 20 syscmd bgerror]
6ce0: 63 6f 6d 6d 61 6e 64 20 62 65 20 69 6e 76 6f 6b command be invok
6cf0: 65 64 20 77 69 74 68 20 74 68 65 20 65 72 72 6f ed with the erro
6d00: 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a r information...
6d10: 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56 61 6c [subsection "Val
6d20: 75 65 73 20 66 6f 72 20 43 6f 6d 6d 61 6e 64 20 ues for Command
6d30: 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 Callback"]..The
6d40: 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 callback for the
6d50: 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e [option -comman
6d60: 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 d] option is inv
6d70: 6f 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 oked at several
6d80: 70 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 points during th
6d90: 65 0a 4f 70 65 6e 53 53 4c 20 68 61 6e 64 73 68 e.OpenSSL handsh
6da0: 61 6b 65 20 61 6e 64 20 64 75 72 69 6e 67 20 72 ake and during r
6db0: 6f 75 74 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e outine operation
6dc0: 73 2e 20 53 65 65 20 62 65 6c 6f 77 20 66 6f 72 s. See below for
6dd0: 20 74 68 65 20 70 6f 73 73 69 62 6c 65 0a 61 72 the possible.ar
6de0: 67 75 6d 65 6e 74 73 20 70 61 73 73 65 64 20 74 guments passed t
6df0: 6f 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 o the callback s
6e00: 63 72 69 70 74 2e 20 56 61 6c 75 65 73 20 72 65 cript. Values re
6e10: 74 75 72 6e 65 64 20 66 72 6f 6d 20 74 68 65 20 turned from the
6e20: 63 61 6c 6c 62 61 63 6b 20 61 72 65 0a 69 67 6e callback are.ign
6e30: 6f 72 65 64 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 ored...[list_beg
6e40: 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 in options]..[op
6e50: 74 5f 64 65 66 20 65 72 72 6f 72 20 5b 61 72 67 t_def error [arg
6e60: 20 22 63 68 61 6e 6e 65 6c 49 64 20 6d 65 73 73 "channelId mess
6e70: 61 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d age"]].This form
6e80: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 of callback is
6e90: 69 6e 76 6f 6b 65 64 20 77 68 65 6e 65 76 65 72 invoked whenever
6ea0: 20 61 6e 20 65 72 72 6f 72 20 6f 63 63 75 72 73 an error occurs
6eb0: 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69 74 during the init
6ec0: 69 61 6c 0a 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 ial.connection,
6ed0: 68 61 6e 64 73 68 61 6b 65 2c 20 6f 72 20 49 2f handshake, or I/
6ee0: 4f 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 O operations. Th
6ef0: 65 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 20 e [arg message]
6f00: 61 72 67 75 6d 65 6e 74 20 63 61 6e 20 62 65 0a argument can be.
6f10: 66 72 6f 6d 20 74 68 65 20 54 63 6c 5f 45 72 72 from the Tcl_Err
6f20: 6e 6f 4d 73 67 2c 20 4f 70 65 6e 53 53 4c 20 66 noMsg, OpenSSL f
6f30: 75 6e 63 74 69 6f 6e 20 5b 66 75 6e 20 45 52 52 unction [fun ERR
6f40: 5f 72 65 61 73 6f 6e 5f 65 72 72 6f 72 5f 73 74 _reason_error_st
6f50: 72 69 6e 67 28 29 5d 2c 0a 6f 72 20 61 20 63 75 ring()],.or a cu
6f60: 73 74 6f 6d 20 6d 65 73 73 61 67 65 2e 20 54 68 stom message. Th
6f70: 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e is callback is n
6f80: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e ew for TclTLS 1.
6f90: 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 69 6e 66 8...[opt_def inf
6fa0: 6f 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 o [arg "channelI
6fb0: 64 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65 d major minor me
6fc0: 73 73 61 67 65 20 74 79 70 65 22 5d 5d 0a 54 68 ssage type"]].Th
6fd0: 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 is form of callb
6fe0: 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 ack is invoked b
6ff0: 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 y the OpenSSL fu
7000: 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f nction.[fun SSL_
7010: 73 65 74 5f 69 6e 66 6f 5f 63 61 6c 6c 62 61 63 set_info_callbac
7020: 6b 28 29 5d 20 64 75 72 69 6e 67 20 74 68 65 20 k()] during the
7030: 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 initial connecti
7040: 6f 6e 20 61 6e 64 20 68 61 6e 64 73 68 61 6b 65 on and handshake
7050: 0a 6f 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 .operations. The
7060: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a arguments are:.
7070: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 .[list_begin def
7080: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 initions]..[def
7090: 5b 61 72 67 20 6d 61 6a 6f 72 5d 5d 0a 4d 61 6a [arg major]].Maj
70a0: 6f 72 20 63 61 74 65 67 6f 72 79 20 66 6f 72 20 or category for
70b0: 65 72 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 error. Valid enu
70c0: 6d 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 68 ms are: [const h
70d0: 61 6e 64 73 68 61 6b 65 5d 2c 20 5b 63 6f 6e 73 andshake], [cons
70e0: 74 20 61 6c 65 72 74 5d 2c 0a 5b 63 6f 6e 73 74 t alert],.[const
70f0: 20 63 6f 6e 6e 65 63 74 5d 2c 20 5b 63 6f 6e 73 connect], [cons
7100: 74 20 61 63 63 65 70 74 5d 2e 0a 0a 5b 64 65 66 t accept]...[def
7110: 20 5b 61 72 67 20 6d 69 6e 6f 72 5d 5d 0a 4d 69 [arg minor]].Mi
7120: 6e 6f 72 20 63 61 74 65 67 6f 72 79 20 66 6f 72 nor category for
7130: 20 65 72 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e error. Valid en
7140: 75 6d 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 ums are: [const
7150: 73 74 61 72 74 5d 2c 20 5b 63 6f 6e 73 74 20 64 start], [const d
7160: 6f 6e 65 5d 2c 20 5b 63 6f 6e 73 74 20 72 65 61 one], [const rea
7170: 64 5d 2c 0a 5b 63 6f 6e 73 74 20 77 72 69 74 65 d],.[const write
7180: 5d 2c 20 5b 63 6f 6e 73 74 20 6c 6f 6f 70 5d 2c ], [const loop],
7190: 20 5b 63 6f 6e 73 74 20 65 78 69 74 5d 2e 0a 0a [const exit]...
71a0: 5b 64 65 66 20 5b 61 72 67 20 6d 65 73 73 61 67 [def [arg messag
71b0: 65 5d 5d 0a 44 65 73 63 72 69 70 74 69 76 65 20 e]].Descriptive
71c0: 6d 65 73 73 61 67 65 20 73 74 72 69 6e 67 20 77 message string w
71d0: 68 69 63 68 20 6d 61 79 20 62 65 20 67 65 6e 65 hich may be gene
71e0: 72 61 74 65 64 20 65 69 74 68 65 72 20 62 79 0a rated either by.
71f0: 5b 66 75 6e 20 53 53 4c 5f 73 74 61 74 65 5f 73 [fun SSL_state_s
7200: 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d 20 6f 72 tring_long()] or
7210: 20 5b 66 75 6e 20 53 53 4c 5f 61 6c 65 72 74 5f [fun SSL_alert_
7220: 64 65 73 63 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 desc_string_long
7230: 28 29 5d 2c 0a 64 65 70 65 6e 64 69 6e 67 20 6f ()],.depending o
7240: 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 2e 0a 0a n the context...
7250: 5b 64 65 66 20 5b 61 72 67 20 74 79 70 65 5d 5d [def [arg type]]
7260: 0a 46 6f 72 20 61 6c 65 72 74 73 2c 20 74 68 65 .For alerts, the
7270: 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 possible values
7280: 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 77 61 72 are: [const war
7290: 6e 69 6e 67 5d 2c 0a 5b 63 6f 6e 73 74 20 66 61 ning],.[const fa
72a0: 74 61 6c 5d 2c 20 61 6e 64 20 5b 63 6f 6e 73 74 tal], and [const
72b0: 20 75 6e 6b 6e 6f 77 6e 5d 2e 20 46 6f 72 20 6f unknown]. For o
72c0: 74 68 65 72 73 2c 20 5b 63 6f 6e 73 74 20 69 6e thers, [const in
72d0: 66 6f 5d 20 69 73 20 75 73 65 64 2e 0a 54 68 69 fo] is used..Thi
72e0: 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 s argument is ne
72f0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 w for TclTLS 1.8
7300: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b ...[list_end]..[
7310: 6f 70 74 5f 64 65 66 20 6d 65 73 73 61 67 65 20 opt_def message
7320: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 [arg "channelId
7330: 64 69 72 65 63 74 69 6f 6e 20 76 65 72 73 69 6f direction versio
7340: 6e 20 63 6f 6e 74 65 6e 74 5f 74 79 70 65 20 6d n content_type m
7350: 65 73 73 61 67 65 22 5d 5d 0a 54 68 69 73 20 66 essage"]].This f
7360: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 orm of callback
7370: 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 is invoked by th
7380: 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 e OpenSSL functi
7390: 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73 65 74 5f on.[fun SSL_set_
73a0: 6d 73 67 5f 63 61 6c 6c 62 61 63 6b 28 29 5d 20 msg_callback()]
73b0: 77 68 65 6e 65 76 65 72 20 61 20 6d 65 73 73 61 whenever a messa
73c0: 67 65 20 69 73 20 73 65 6e 74 20 6f 72 20 72 65 ge is sent or re
73d0: 63 65 69 76 65 64 20 64 75 72 69 6e 67 20 74 68 ceived during th
73e0: 65 0a 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63 e.initial connec
73f0: 74 69 6f 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c tion, handshake,
7400: 20 6f 72 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f or I/O operatio
7410: 6e 73 2e 20 49 74 20 69 73 20 6f 6e 6c 79 20 61 ns. It is only a
7420: 76 61 69 6c 61 62 6c 65 20 77 68 65 6e 0a 4f 70 vailable when.Op
7430: 65 6e 53 53 4c 20 69 73 20 63 6f 6d 70 6c 69 65 enSSL is complie
7440: 64 20 77 69 74 68 20 74 68 65 20 5b 63 6f 6e 73 d with the [cons
7450: 74 20 65 6e 61 62 6c 65 2d 73 73 6c 2d 74 72 61 t enable-ssl-tra
7460: 63 65 5d 20 6f 70 74 69 6f 6e 2e 20 54 68 69 73 ce] option. This
7470: 20 63 61 6c 6c 62 61 63 6b 20 69 73 0a 6e 65 77 callback is.new
7480: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e for TclTLS 1.8.
7490: 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 The arguments a
74a0: 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e re:..[list_begin
74b0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b definitions]..[
74c0: 64 65 66 20 5b 61 72 67 20 64 69 72 65 63 74 69 def [arg directi
74d0: 6f 6e 5d 5d 0a 44 69 72 65 63 74 69 6f 6e 20 69 on]].Direction i
74e0: 73 20 65 69 74 68 65 72 20 5b 63 6f 6e 73 74 20 s either [const
74f0: 53 65 6e 74 5d 20 6f 72 20 5b 63 6f 6e 73 74 20 Sent] or [const
7500: 52 65 63 65 69 76 65 64 5d 2e 0a 0a 5b 64 65 66 Received]...[def
7510: 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 5d 0a [arg version]].
7520: 56 65 72 73 69 6f 6e 20 69 73 20 74 68 65 20 70 Version is the p
7530: 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 2e rotocol version.
7540: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63 6f 6e 74 ..[def [arg cont
7550: 65 6e 74 5f 74 79 70 65 5d 5d 0a 43 6f 6e 74 65 ent_type]].Conte
7560: 6e 74 20 74 79 70 65 20 69 73 20 74 68 65 20 6d nt type is the m
7570: 65 73 73 61 67 65 20 63 6f 6e 74 65 6e 74 20 74 essage content t
7580: 79 70 65 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 ype...[def [arg
7590: 6d 65 73 73 61 67 65 5d 5d 0a 4d 65 73 73 61 67 message]].Messag
75a0: 65 20 69 73 20 6d 6f 72 65 20 69 6e 66 6f 20 66 e is more info f
75b0: 72 6f 6d 20 74 68 65 20 5b 63 6f 6e 73 74 20 53 rom the [const S
75c0: 53 4c 5f 74 72 61 63 65 5d 20 41 50 49 2e 0a 0a SL_trace] API...
75d0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 [list_end]..[opt
75e0: 5f 64 65 66 20 73 65 73 73 69 6f 6e 20 5b 61 72 _def session [ar
75f0: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 73 g "channelId ses
7600: 73 69 6f 6e 5f 69 64 20 73 65 73 73 69 6f 6e 5f sion_id session_
7610: 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 22 ticket lifetime"
7620: 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 ]].This form of
7630: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f callback is invo
7640: 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53 ked by the OpenS
7650: 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e SL function.[fun
7660: 20 53 53 4c 5f 43 54 58 5f 73 65 73 73 5f 73 65 SSL_CTX_sess_se
7670: 74 5f 6e 65 77 5f 63 62 28 29 5d 20 77 68 65 6e t_new_cb()] when
7680: 65 76 65 72 20 61 20 6e 65 77 20 73 65 73 73 69 ever a new sessi
7690: 6f 6e 20 69 64 20 69 73 20 73 65 6e 74 20 62 79 on id is sent by
76a0: 20 74 68 65 0a 73 65 72 76 65 72 20 64 75 72 69 the.server duri
76b0: 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63 ng the initial c
76c0: 6f 6e 6e 65 63 74 69 6f 6e 20 61 6e 64 20 68 61 onnection and ha
76d0: 6e 64 73 68 61 6b 65 20 61 6e 64 20 61 6c 73 6f ndshake and also
76e0: 20 64 75 72 69 6e 67 20 74 68 65 20 73 65 73 73 during the sess
76f0: 69 6f 6e 0a 69 66 20 74 68 65 20 5b 6f 70 74 69 ion.if the [opti
7700: 6f 6e 20 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61 on -post_handsha
7710: 6b 65 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73 65 ke] option is se
7720: 74 20 74 6f 20 74 72 75 65 2e 20 54 68 69 73 20 t to true. This
7730: 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20 callback is new
7740: 66 6f 72 0a 54 63 6c 54 4c 53 20 31 2e 38 2e 20 for.TclTLS 1.8.
7750: 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 The arguments ar
7760: 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 e:..[list_begin
7770: 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 definitions]..[d
7780: 65 66 20 5b 61 72 67 20 73 65 73 73 69 6f 6e 5f ef [arg session_
7790: 69 64 5d 5d 0a 53 65 73 73 69 6f 6e 20 49 64 20 id]].Session Id
77a0: 69 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 73 is the current s
77b0: 65 73 73 69 6f 6e 20 69 64 65 6e 74 69 66 69 65 ession identifie
77c0: 72 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 65 73 r..[def [arg ses
77d0: 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 5d 0a 54 69 sion_ticket]].Ti
77e0: 63 6b 65 74 20 69 73 20 74 68 65 20 73 65 73 73 cket is the sess
77f0: 69 6f 6e 20 74 69 63 6b 65 74 20 69 6e 66 6f 0a ion ticket info.
7800: 0a 5b 64 65 66 20 5b 61 72 67 20 6c 69 66 65 74 .[def [arg lifet
7810: 69 6d 65 5d 5d 0a 4c 69 66 65 74 69 6d 65 20 69 ime]].Lifetime i
7820: 73 20 74 68 65 20 74 69 63 6b 65 74 20 6c 69 66 s the ticket lif
7830: 65 74 69 6d 65 20 69 6e 20 73 65 63 6f 6e 64 73 etime in seconds
7840: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b ...[list_end]..[
7850: 6f 70 74 5f 64 65 66 20 76 65 72 69 66 79 20 5b opt_def verify [
7860: 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 arg "channelId d
7870: 65 70 74 68 20 63 65 72 74 20 73 74 61 74 75 73 epth cert status
7880: 20 65 72 72 6f 72 22 5d 5d 0a 54 68 69 73 20 63 error"]].This c
7890: 61 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65 allback was move
78a0: 64 20 74 6f 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 d to [option -va
78b0: 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 69 lidatecommand] i
78c0: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b n TclTLS 1.8...[
78d0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 list_end]..[subs
78e0: 65 63 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66 ection "Values f
78f0: 6f 72 20 50 61 73 73 77 6f 72 64 20 43 61 6c 6c or Password Call
7900: 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c back"]..The call
7910: 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 back for the [op
7920: 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 tion -password]
7930: 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 option is invoke
7940: 64 20 62 79 20 54 63 6c 54 4c 53 20 77 68 65 6e d by TclTLS when
7950: 65 76 65 72 20 4f 70 65 6e 53 53 4c 20 6e 65 65 ever OpenSSL nee
7960: 64 73 0a 74 6f 20 6f 62 74 61 69 6e 20 61 20 70 ds.to obtain a p
7970: 61 73 73 77 6f 72 64 2e 20 53 65 65 20 62 65 6c assword. See bel
7980: 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69 ow for the possi
7990: 62 6c 65 20 61 72 67 75 6d 65 6e 74 73 20 70 61 ble arguments pa
79a0: 73 73 65 64 20 74 6f 20 74 68 65 0a 63 61 6c 6c ssed to the.call
79b0: 62 61 63 6b 20 73 63 72 69 70 74 2e 20 54 68 65 back script. The
79c0: 20 75 73 65 72 20 70 72 6f 76 69 64 65 64 20 70 user provided p
79d0: 61 73 73 77 6f 72 64 20 69 73 20 65 78 70 65 63 assword is expec
79e0: 74 65 64 20 74 6f 20 62 65 20 72 65 74 75 72 6e ted to be return
79f0: 65 64 20 62 79 20 74 68 65 0a 63 61 6c 6c 62 61 ed by the.callba
7a00: 63 6b 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e ck...[list_begin
7a10: 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f options]..[opt_
7a20: 64 65 66 20 70 61 73 73 77 6f 72 64 20 5b 61 72 def password [ar
7a30: 67 20 22 72 77 66 6c 61 67 20 73 69 7a 65 22 5d g "rwflag size"]
7a40: 5d 0a 49 6e 76 6f 6b 65 64 20 77 68 65 6e 20 6c ].Invoked when l
7a50: 6f 61 64 69 6e 67 20 6f 72 20 73 74 6f 72 69 6e oading or storin
7a60: 67 20 61 6e 20 65 6e 63 72 79 70 74 65 64 20 50 g an encrypted P
7a70: 45 4d 20 63 65 72 74 69 66 69 63 61 74 65 2e 20 EM certificate.
7a80: 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 The arguments ar
7a90: 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 e:..[list_begin
7aa0: 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 definitions]..[d
7ab0: 65 66 20 5b 61 72 67 20 72 77 66 6c 61 67 5d 5d ef [arg rwflag]]
7ac0: 0a 54 68 65 20 72 65 61 64 2f 77 72 69 74 65 20 .The read/write
7ad0: 66 6c 61 67 20 69 73 20 30 20 66 6f 72 20 72 65 flag is 0 for re
7ae0: 61 64 69 6e 67 2f 64 65 63 72 79 70 74 69 6f 6e ading/decryption
7af0: 20 6f 72 20 31 20 66 6f 72 20 77 72 69 74 69 6e or 1 for writin
7b00: 67 2f 65 6e 63 72 79 70 74 69 6f 6e 2e 0a 54 68 g/encryption..Th
7b10: 65 20 6c 61 74 74 65 72 20 63 61 6e 20 62 65 20 e latter can be
7b20: 75 73 65 64 20 74 6f 20 64 65 74 65 72 6d 69 6e used to determin
7b30: 65 20 77 68 65 6e 20 74 6f 20 70 72 6f 6d 70 74 e when to prompt
7b40: 20 74 68 65 20 75 73 65 72 20 74 6f 20 63 6f 6e the user to con
7b50: 66 69 72 6d 2e 0a 54 68 69 73 20 61 72 67 75 6d firm..This argum
7b60: 65 6e 74 20 69 73 20 6e 65 77 20 66 6f 72 20 54 ent is new for T
7b70: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 clTLS 1.8...[def
7b80: 20 5b 61 72 67 20 73 69 7a 65 5d 5d 0a 54 68 65 [arg size]].The
7b90: 20 73 69 7a 65 20 69 73 20 74 68 65 20 6d 61 78 size is the max
7ba0: 69 6d 75 6d 20 6c 65 6e 67 74 68 20 6f 66 20 74 imum length of t
7bb0: 68 65 20 70 61 73 73 77 6f 72 64 20 69 6e 20 62 he password in b
7bc0: 79 74 65 73 2e 0a 54 68 69 73 20 61 72 67 75 6d ytes..This argum
7bd0: 65 6e 74 20 69 73 20 6e 65 77 20 66 6f 72 20 54 ent is new for T
7be0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 clTLS 1.8...[lis
7bf0: 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e t_end]..[list_en
7c00: 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 d]..[subsection
7c10: 22 56 61 6c 75 65 73 20 66 6f 72 20 56 61 6c 69 "Values for Vali
7c20: 64 61 74 65 20 43 6f 6d 6d 61 6e 64 20 43 61 6c date Command Cal
7c30: 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c lback"]..The cal
7c40: 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f lback for the [o
7c50: 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 ption -validatec
7c60: 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 ommand] option i
7c70: 73 20 69 6e 76 6f 6b 65 64 20 64 75 72 69 6e 67 s invoked during
7c80: 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65 0a 70 the handshake.p
7c90: 72 6f 63 65 73 73 20 69 6e 20 6f 72 64 65 72 20 rocess in order
7ca0: 66 6f 72 20 74 68 65 20 61 70 70 6c 69 63 61 74 for the applicat
7cb0: 69 6f 6e 20 74 6f 20 76 61 6c 69 64 61 74 65 20 ion to validate
7cc0: 74 68 65 20 70 72 6f 76 69 64 65 64 20 76 61 6c the provided val
7cd0: 75 65 28 73 29 2e 20 53 65 65 0a 62 65 6c 6f 77 ue(s). See.below
7ce0: 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c for the possibl
7cf0: 65 20 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73 e arguments pass
7d00: 65 64 20 74 6f 20 74 68 65 20 63 61 6c 6c 62 61 ed to the callba
7d10: 63 6b 20 73 63 72 69 70 74 2e 20 49 66 20 6e 6f ck script. If no
7d20: 74 0a 73 70 65 63 69 66 69 65 64 2c 20 4f 70 65 t.specified, Ope
7d30: 6e 53 53 4c 20 77 69 6c 6c 20 61 63 63 65 70 74 nSSL will accept
7d40: 20 61 6c 6c 20 76 61 6c 69 64 20 63 65 72 74 69 all valid certi
7d50: 66 69 63 61 74 65 73 20 61 6e 64 20 65 78 74 65 ficates and exte
7d60: 6e 73 69 6f 6e 73 2e 20 54 6f 20 72 65 6a 65 63 nsions. To rejec
7d70: 74 0a 74 68 65 20 76 61 6c 75 65 20 61 6e 64 20 t.the value and
7d80: 61 62 6f 72 74 20 74 68 65 20 63 6f 6e 6e 65 63 abort the connec
7d90: 74 69 6f 6e 2c 20 74 68 65 20 63 61 6c 6c 62 61 tion, the callba
7da0: 63 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e ck should return
7db0: 20 30 2e 20 54 6f 20 61 63 63 65 70 74 20 74 68 0. To accept th
7dc0: 65 0a 76 61 6c 75 65 20 61 6e 64 20 63 6f 6e 74 e.value and cont
7dd0: 69 6e 75 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 inue the connect
7de0: 69 6f 6e 2c 20 69 74 20 73 68 6f 75 6c 64 20 72 ion, it should r
7df0: 65 74 75 72 6e 20 31 2e 20 54 6f 20 72 65 6a 65 eturn 1. To reje
7e00: 63 74 20 74 68 65 20 76 61 6c 75 65 2c 20 62 75 ct the value, bu
7e10: 74 0a 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 63 t.continue the c
7e20: 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 74 20 73 68 onnection, it sh
7e30: 6f 75 6c 64 20 72 65 74 75 72 6e 20 32 2e 20 54 ould return 2. T
7e40: 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 his callback is
7e50: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 new for TclTLS 1
7e60: 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e .8...[list_begin
7e70: 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f options]..[opt_
7e80: 64 65 66 20 61 6c 70 6e 20 5b 61 72 67 20 22 63 def alpn [arg "c
7e90: 68 61 6e 6e 65 6c 49 64 20 70 72 6f 74 6f 63 6f hannelId protoco
7ea0: 6c 20 6d 61 74 63 68 22 5d 5d 0a 46 6f 72 20 73 l match"]].For s
7eb0: 65 72 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72 ervers, this for
7ec0: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 m of callback is
7ed0: 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 74 68 invoked when th
7ee0: 65 20 63 6c 69 65 6e 74 20 41 4c 50 4e 20 65 78 e client ALPN ex
7ef0: 74 65 6e 73 69 6f 6e 20 69 73 0a 72 65 63 65 69 tension is.recei
7f00: 76 65 64 2e 20 49 66 20 5b 61 72 67 20 6d 61 74 ved. If [arg mat
7f10: 63 68 5d 20 69 73 20 74 72 75 65 2c 20 74 68 65 ch] is true, the
7f20: 6e 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d n [arg protocol]
7f30: 20 69 73 20 74 68 65 20 66 69 72 73 74 0a 5b 6f is the first.[o
7f40: 70 74 69 6f 6e 20 2d 61 6c 70 6e 5d 20 70 72 6f ption -alpn] pro
7f50: 74 6f 63 6f 6c 20 6f 70 74 69 6f 6e 20 69 6e 20 tocol option in
7f60: 63 6f 6d 6d 6f 6e 20 74 6f 20 62 6f 74 68 20 74 common to both t
7f70: 68 65 20 63 6c 69 65 6e 74 20 61 6e 64 20 73 65 he client and se
7f80: 72 76 65 72 2e 0a 49 66 20 6e 6f 74 2c 20 74 68 rver..If not, th
7f90: 65 20 66 69 72 73 74 20 63 6c 69 65 6e 74 20 73 e first client s
7fa0: 70 65 63 69 66 69 65 64 20 70 72 6f 74 6f 63 6f pecified protoco
7fb0: 6c 20 69 73 20 75 73 65 64 2e 20 54 68 69 73 20 l is used. This
7fc0: 63 61 6c 6c 62 61 63 6b 20 69 73 20 63 61 6c 6c callback is call
7fd0: 65 64 0a 61 66 74 65 72 20 74 68 65 20 48 65 6c ed.after the Hel
7fe0: 6c 6f 20 61 6e 64 20 53 4e 49 20 63 61 6c 6c 62 lo and SNI callb
7ff0: 61 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 acks...[opt_def
8000: 68 65 6c 6c 6f 20 5b 61 72 67 20 22 63 68 61 6e hello [arg "chan
8010: 6e 65 6c 49 64 20 73 65 72 76 65 72 6e 61 6d 65 nelId servername
8020: 20 73 65 73 73 69 6f 6e 5f 69 64 22 5d 5d 0a 46 session_id"]].F
8030: 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 or servers, this
8040: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 form of callbac
8050: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 64 75 72 k is invoked dur
8060: 69 6e 67 20 63 6c 69 65 6e 74 20 68 65 6c 6c 6f ing client hello
8070: 20 6d 65 73 73 61 67 65 0a 70 72 6f 63 65 73 73 message.process
8080: 69 6e 67 2e 20 54 68 65 20 70 75 72 70 6f 73 65 ing. The purpose
8090: 20 69 73 20 73 6f 20 74 68 65 20 73 65 72 76 65 is so the serve
80a0: 72 20 63 61 6e 20 73 65 6c 65 63 74 20 74 68 65 r can select the
80b0: 20 61 70 70 72 6f 70 72 69 61 74 65 20 63 65 72 appropriate cer
80c0: 74 69 66 69 63 61 74 65 0a 74 6f 20 70 72 65 73 tificate.to pres
80d0: 65 6e 74 20 74 6f 20 74 68 65 20 63 6c 69 65 6e ent to the clien
80e0: 74 2c 20 61 6e 64 20 74 6f 20 6d 61 6b 65 20 6f t, and to make o
80f0: 74 68 65 72 20 63 6f 6e 66 69 67 75 72 61 74 69 ther configurati
8100: 6f 6e 20 61 64 6a 75 73 74 6d 65 6e 74 73 20 72 on adjustments r
8110: 65 6c 65 76 61 6e 74 0a 74 6f 20 74 68 61 74 20 elevant.to that
8120: 73 65 72 76 65 72 20 6e 61 6d 65 20 61 6e 64 20 server name and
8130: 69 74 73 20 63 6f 6e 66 69 67 75 72 61 74 69 6f its configuratio
8140: 6e 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64 20 n. It is called
8150: 62 65 66 6f 72 65 20 74 68 65 20 53 4e 49 20 61 before the SNI a
8160: 6e 64 20 41 4c 50 4e 0a 63 61 6c 6c 62 61 63 6b nd ALPN.callback
8170: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 73 6e 69 s...[opt_def sni
8180: 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 [arg "channelId
8190: 20 73 65 72 76 65 72 6e 61 6d 65 22 5d 5d 0a 46 servername"]].F
81a0: 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 or servers, this
81b0: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 form of callbac
81c0: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 k is invoked whe
81d0: 6e 20 74 68 65 20 53 65 72 76 65 72 20 4e 61 6d n the Server Nam
81e0: 65 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53 4e e Indication.(SN
81f0: 49 29 20 65 78 74 65 6e 73 69 6f 6e 20 69 73 20 I) extension is
8200: 72 65 63 65 69 76 65 64 2e 20 54 68 65 20 5b 61 received. The [a
8210: 72 67 20 73 65 72 76 65 72 6e 61 6d 65 5d 20 61 rg servername] a
8220: 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20 63 rgument is the c
8230: 6c 69 65 6e 74 0a 70 72 6f 76 69 64 65 64 20 73 lient.provided s
8240: 65 72 76 65 72 20 6e 61 6d 65 20 73 70 65 63 69 erver name speci
8250: 66 69 65 64 20 69 6e 20 74 68 65 20 5b 6f 70 74 fied in the [opt
8260: 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65 5d ion -servername]
8270: 20 6f 70 74 69 6f 6e 2e 20 54 68 65 0a 70 75 72 option. The.pur
8280: 70 6f 73 65 20 69 73 20 73 6f 20 77 68 65 6e 20 pose is so when
8290: 61 20 73 65 72 76 65 72 20 73 75 70 70 6f 72 74 a server support
82a0: 73 20 6d 75 6c 74 69 70 6c 65 20 6e 61 6d 65 73 s multiple names
82b0: 2c 20 74 68 65 20 72 69 67 68 74 20 63 65 72 74 , the right cert
82c0: 69 66 69 63 61 74 65 0a 63 61 6e 20 62 65 20 75 ificate.can be u
82d0: 73 65 64 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 sed. It is calle
82e0: 64 20 61 66 74 65 72 20 74 68 65 20 48 65 6c 6c d after the Hell
82f0: 6f 20 63 61 6c 6c 62 61 63 6b 20 62 75 74 20 62 o callback but b
8300: 65 66 6f 72 65 20 74 68 65 20 41 4c 50 4e 0a 63 efore the ALPN.c
8310: 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6f 70 74 5f 64 allback...[opt_d
8320: 65 66 20 76 65 72 69 66 79 20 5b 61 72 67 20 22 ef verify [arg "
8330: 63 68 61 6e 6e 65 6c 49 64 20 64 65 70 74 68 20 channelId depth
8340: 63 65 72 74 20 73 74 61 74 75 73 20 65 72 72 6f cert status erro
8350: 72 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f r"]].This form o
8360: 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e f callback is in
8370: 76 6f 6b 65 64 20 62 79 20 4f 70 65 6e 53 53 4c voked by OpenSSL
8380: 20 77 68 65 6e 20 61 20 6e 65 77 20 63 65 72 74 when a new cert
8390: 69 66 69 63 61 74 65 20 69 73 20 72 65 63 65 69 ificate is recei
83a0: 76 65 64 0a 66 72 6f 6d 20 74 68 65 20 70 65 65 ved.from the pee
83b0: 72 2e 20 49 74 20 61 6c 6c 6f 77 73 20 74 68 65 r. It allows the
83c0: 20 63 6c 69 65 6e 74 20 74 6f 20 63 68 65 63 6b client to check
83d0: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 the certificate
83e0: 20 76 65 72 69 66 69 63 61 74 69 6f 6e 0a 72 65 verification.re
83f0: 73 75 6c 74 73 20 61 6e 64 20 63 68 6f 6f 73 65 sults and choose
8400: 20 77 68 65 74 68 65 72 20 74 6f 20 63 6f 6e 74 whether to cont
8410: 69 6e 75 65 20 6f 72 20 6e 6f 74 2e 20 49 74 20 inue or not. It
8420: 69 73 20 63 61 6c 6c 65 64 20 66 6f 72 20 65 61 is called for ea
8430: 63 68 0a 63 65 72 74 69 66 69 63 61 74 65 20 69 ch.certificate i
8440: 6e 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 n the certificat
8450: 65 20 63 68 61 69 6e 2e 20 54 68 69 73 20 63 61 e chain. This ca
8460: 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65 64 llback was moved
8470: 20 66 72 6f 6d 0a 5b 6f 70 74 69 6f 6e 20 2d 63 from.[option -c
8480: 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54 63 6c 54 4c ommand] in TclTL
8490: 53 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d S 1.8. The argum
84a0: 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 ents are:..[list
84b0: 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f _begin definitio
84c0: 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 64 ns]..[def [arg d
84d0: 65 70 74 68 5d 5d 0a 54 68 65 20 64 65 70 74 68 epth]].The depth
84e0: 20 69 73 20 74 68 65 20 69 6e 74 65 67 65 72 20 is the integer
84f0: 64 65 70 74 68 20 6f 66 20 74 68 65 20 63 65 72 depth of the cer
8500: 74 69 66 69 63 61 74 65 20 69 6e 20 74 68 65 20 tificate in the
8510: 63 65 72 74 69 66 69 63 61 74 65 20 63 68 61 69 certificate chai
8520: 6e 2c 0a 77 68 65 72 65 20 30 20 69 73 20 74 68 n,.where 0 is th
8530: 65 20 70 65 65 72 20 63 65 72 74 69 66 69 63 61 e peer certifica
8540: 74 65 20 61 6e 64 20 68 69 67 68 65 72 20 76 61 te and higher va
8550: 6c 75 65 73 20 67 6f 69 6e 67 20 75 70 20 74 6f lues going up to
8560: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 the Certificate
8570: 0a 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 2e .Authority (CA).
8580: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63 65 72 74 ..[def [arg cert
8590: 5d 5d 0a 54 68 65 20 63 65 72 74 20 61 72 67 75 ]].The cert argu
85a0: 6d 65 6e 74 20 69 73 20 61 20 6c 69 73 74 20 6f ment is a list o
85b0: 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 f key-value pair
85c0: 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 6f s similar to tho
85d0: 73 65 20 72 65 74 75 72 6e 65 64 20 62 79 0a 5b se returned by.[
85e0: 63 6d 64 20 74 6c 73 3a 3a 73 74 61 74 75 73 5d cmd tls::status]
85f0: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 74 61 ...[def [arg sta
8600: 74 75 73 5d 5d 0a 54 68 65 20 73 74 61 74 75 73 tus]].The status
8610: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65 argument is the
8620: 20 62 6f 6f 6c 65 61 6e 20 76 61 6c 69 64 69 74 boolean validit
8630: 79 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e 74 y of the current
8640: 20 63 65 72 74 69 66 69 63 61 74 65 20 77 68 65 certificate whe
8650: 72 65 20 30 0a 69 73 20 69 6e 76 61 6c 69 64 20 re 0.is invalid
8660: 61 6e 64 20 31 20 69 73 20 76 61 6c 69 64 2e 0a and 1 is valid..
8670: 0a 5b 64 65 66 20 5b 61 72 67 20 65 72 72 6f 72 .[def [arg error
8680: 5d 5d 0a 54 68 65 20 65 72 72 6f 72 20 61 72 67 ]].The error arg
8690: 75 6d 65 6e 74 20 69 73 20 74 68 65 20 65 72 72 ument is the err
86a0: 6f 72 20 6d 65 73 73 61 67 65 2c 20 69 66 20 61 or message, if a
86b0: 6e 79 2c 20 67 65 6e 65 72 61 74 65 64 20 62 79 ny, generated by
86c0: 0a 5b 66 75 6e 20 58 35 30 39 5f 53 54 4f 52 45 .[fun X509_STORE
86d0: 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28 29 _CTX_get_error()
86e0: 5d 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a ]...[list_end]..
86f0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 52 65 66 65 [list_end]..Refe
8700: 72 65 6e 63 65 20 69 6d 70 6c 65 6d 65 6e 74 61 rence implementa
8710: 74 69 6f 6e 73 20 6f 66 20 74 68 65 73 65 20 63 tions of these c
8720: 61 6c 6c 62 61 63 6b 73 20 61 72 65 20 70 72 6f allbacks are pro
8730: 76 69 64 65 64 20 69 6e 20 5b 66 69 6c 65 20 74 vided in [file t
8740: 6c 73 2e 74 63 6c 5d 0a 61 73 20 5b 63 6d 64 20 ls.tcl].as [cmd
8750: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 tls::callback],
8760: 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f [cmd tls::passwo
8770: 72 64 5d 2c 20 61 6e 64 20 5b 63 6d 64 20 74 6c rd], and [cmd tl
8780: 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d s::validate_comm
8790: 61 6e 64 5d 0a 72 65 73 70 65 63 74 69 76 65 6c and].respectivel
87a0: 79 2e 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 y. Note that the
87b0: 73 65 20 61 72 65 20 6f 6e 6c 79 20 5b 65 6d 70 se are only [emp
87c0: 68 20 73 61 6d 70 6c 65 5d 20 69 6d 70 6c 65 6d h sample] implem
87d0: 65 6e 74 61 74 69 6f 6e 73 2e 20 49 6e 20 61 20 entations. In a
87e0: 6d 6f 72 65 0a 72 65 61 6c 69 73 74 69 63 20 64 more.realistic d
87f0: 65 70 6c 6f 79 6d 65 6e 74 20 79 6f 75 20 77 6f eployment you wo
8800: 75 6c 64 20 73 70 65 63 69 66 79 20 79 6f 75 72 uld specify your
8810: 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 20 73 63 own callback sc
8820: 72 69 70 74 73 20 6f 6e 20 65 61 63 68 20 54 4c ripts on each TL
8830: 53 0a 63 68 61 6e 6e 65 6c 20 75 73 69 6e 67 20 S.channel using
8840: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d the [option -com
8850: 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d mand], [option -
8860: 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b password], and.[
8870: 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 option -validate
8880: 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e _command] option
8890: 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68 65 20 s...[para]..The
88a0: 64 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72 default behavior
88b0: 20 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f when the [optio
88c0: 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 61 6e 64 20 n -command] and
88d0: 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 [option -validat
88e0: 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f e_command].optio
88f0: 6e 73 20 61 72 65 20 6e 6f 74 20 73 70 65 63 69 ns are not speci
8900: 66 69 65 64 2c 20 69 73 20 66 6f 72 20 54 63 6c fied, is for Tcl
8910: 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74 TLS to process t
8920: 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69 he associated li
8930: 62 72 61 72 79 0a 63 61 6c 6c 62 61 63 6b 73 20 brary.callbacks
8940: 69 6e 74 65 72 6e 61 6c 6c 79 2e 20 54 68 65 20 internally. The
8950: 64 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72 default behavior
8960: 20 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f when the [optio
8970: 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74 n -password] opt
8980: 69 6f 6e 0a 69 73 20 6e 6f 74 20 73 70 65 63 69 ion.is not speci
8990: 66 69 65 64 20 69 73 20 66 6f 72 20 54 63 6c 54 fied is for TclT
89a0: 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 LS to process th
89b0: 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69 62 e associated lib
89c0: 72 61 72 79 20 63 61 6c 6c 62 61 63 6b 73 20 62 rary callbacks b
89d0: 79 0a 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 y.attempting to
89e0: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 call [cmd tls::p
89f0: 61 73 73 77 6f 72 64 5d 2e 20 54 68 65 20 64 69 assword]. The di
8a00: 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e fference between
8a10: 20 74 68 65 73 65 20 74 77 6f 0a 62 65 68 61 76 these two.behav
8a20: 69 6f 72 73 20 69 73 20 61 20 63 6f 6e 73 65 71 iors is a conseq
8a30: 75 65 6e 63 65 20 6f 66 20 6d 61 69 6e 74 61 69 uence of maintai
8a40: 6e 69 6e 67 20 63 6f 6d 70 61 74 69 62 69 6c 69 ning compatibili
8a50: 74 79 20 77 69 74 68 20 65 61 72 6c 69 65 72 0a ty with earlier.
8a60: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e implementations.
8a70: 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70 68 20 ..[para]..[emph
8a80: 22 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 "The use of the
8a90: 72 65 66 65 72 65 6e 63 65 20 63 61 6c 6c 62 61 reference callba
8aa0: 63 6b 73 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 cks [cmd tls::ca
8ab0: 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c llback], [cmd tl
8ac0: 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 0a 61 6e s::password],.an
8ad0: 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 d [cmd tls::vali
8ae0: 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 69 73 date_command] is
8af0: 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64 not recommended
8b00: 2e 20 54 68 65 79 20 6d 61 79 20 62 65 20 72 65 . They may be re
8b10: 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75 74 75 72 moved from futur
8b20: 65 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b e releases."]..[
8b30: 73 65 63 74 69 6f 6e 20 44 65 62 75 67 5d 0a 0a section Debug]..
8b40: 46 6f 72 20 6d 6f 73 74 20 64 65 62 75 67 67 69 For most debuggi
8b50: 6e 67 20 6e 65 65 64 73 2c 20 74 68 65 20 5b 6f ng needs, the [o
8b60: 70 74 69 6f 6e 20 2d 63 61 6c 6c 62 61 63 6b 5d ption -callback]
8b70: 20 6f 70 74 69 6f 6e 20 63 61 6e 20 62 65 20 75 option can be u
8b80: 73 65 64 20 74 6f 20 70 72 6f 76 69 64 65 0a 73 sed to provide.s
8b90: 75 66 66 69 63 69 65 6e 74 20 69 6e 73 69 67 68 ufficient insigh
8ba0: 74 20 61 6e 64 20 69 6e 66 6f 72 6d 61 74 69 6f t and informatio
8bb0: 6e 20 6f 6e 20 74 68 65 20 54 4c 53 20 68 61 6e n on the TLS han
8bc0: 64 73 68 61 6b 65 20 61 6e 64 20 70 72 6f 67 72 dshake and progr
8bd0: 65 73 73 2e 20 49 66 0a 66 75 72 74 68 65 72 20 ess. If.further
8be0: 74 72 6f 75 62 6c 65 73 68 6f 6f 74 69 6e 67 20 troubleshooting
8bf0: 69 6e 73 69 67 68 74 20 69 73 20 6e 65 65 64 65 insight is neede
8c00: 64 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 20 74 d, the compile t
8c10: 69 6d 65 20 6f 70 74 69 6f 6e 0a 5b 6f 70 74 69 ime option.[opti
8c20: 6f 6e 20 2d 2d 65 6e 61 62 6c 65 2d 64 65 62 75 on --enable-debu
8c30: 67 5d 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 g] can be used t
8c40: 6f 20 67 65 74 20 64 65 74 61 69 6c 65 64 20 65 o get detailed e
8c50: 78 65 63 75 74 69 6f 6e 20 66 6c 6f 77 20 73 74 xecution flow st
8c60: 61 74 75 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 atus...[para]..T
8c70: 4c 53 20 6b 65 79 20 6c 6f 67 67 69 6e 67 20 63 LS key logging c
8c80: 61 6e 20 62 65 20 65 6e 61 62 6c 65 64 20 62 79 an be enabled by
8c90: 20 73 65 74 74 69 6e 67 20 74 68 65 20 65 6e 76 setting the env
8ca0: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c ironment variabl
8cb0: 65 0a 5b 76 61 72 20 53 53 4c 4b 45 59 4c 4f 47 e.[var SSLKEYLOG
8cc0: 46 49 4c 45 5d 20 74 6f 20 74 68 65 20 6e 61 6d FILE] to the nam
8cd0: 65 20 6f 66 20 74 68 65 20 66 69 6c 65 20 74 6f e of the file to
8ce0: 20 6c 6f 67 20 74 6f 2e 20 54 68 65 6e 20 77 68 log to. Then wh
8cf0: 65 6e 65 76 65 72 20 54 4c 53 20 6b 65 79 0a 6d enever TLS key.m
8d00: 61 74 65 72 69 61 6c 20 69 73 20 67 65 6e 65 72 aterial is gener
8d10: 61 74 65 64 20 6f 72 20 72 65 63 65 69 76 65 64 ated or received
8d20: 20 69 74 20 77 69 6c 6c 20 62 65 20 6c 6f 67 67 it will be logg
8d30: 65 64 20 74 6f 20 74 68 65 20 66 69 6c 65 2e 20 ed to the file.
8d40: 54 68 69 73 20 69 73 20 75 73 65 66 75 6c 0a 66 This is useful.f
8d50: 6f 72 20 6c 6f 67 67 69 6e 67 20 6b 65 79 20 64 or logging key d
8d60: 61 74 61 20 66 6f 72 20 6e 65 74 77 6f 72 6b 20 ata for network
8d70: 6c 6f 67 67 69 6e 67 20 74 6f 6f 6c 73 20 74 6f logging tools to
8d80: 20 75 73 65 20 74 6f 20 64 65 63 72 79 70 74 20 use to decrypt
8d90: 74 68 65 20 64 61 74 61 2e 0a 0a 5b 70 61 72 61 the data...[para
8da0: 5d 0a 0a 54 68 65 20 5b 76 61 72 20 74 6c 73 3a ]..The [var tls:
8db0: 3a 64 65 62 75 67 5d 20 76 61 72 69 61 62 6c 65 :debug] variable
8dc0: 20 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61 provides some a
8dd0: 64 64 69 74 69 6f 6e 61 6c 20 63 6f 6e 74 72 6f dditional contro
8de0: 6c 20 6f 76 65 72 20 74 68 65 0a 64 65 62 75 67 l over the.debug
8df0: 20 6c 6f 67 67 69 6e 67 20 69 6e 20 74 68 65 20 logging in the
8e00: 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 [cmd tls::callba
8e10: 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 ck], [cmd tls::p
8e20: 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b 63 assword], and.[c
8e30: 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 md tls::validate
8e40: 5f 63 6f 6d 6d 61 6e 64 5d 20 64 65 66 61 75 6c _command] defaul
8e50: 74 20 68 61 6e 64 6c 65 72 73 20 69 6e 20 5b 66 t handlers in [f
8e60: 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 2e 0a 54 68 ile tls.tcl]..Th
8e70: 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20 e default value
8e80: 69 73 20 30 20 77 69 74 68 20 68 69 67 68 65 72 is 0 with higher
8e90: 20 76 61 6c 75 65 73 20 70 72 6f 64 75 63 69 6e values producin
8ea0: 67 20 6d 6f 72 65 20 64 69 61 67 6e 6f 73 74 69 g more diagnosti
8eb0: 63 20 6f 75 74 70 75 74 2c 0a 61 6e 64 20 77 69 c output,.and wi
8ec0: 6c 6c 20 61 6c 73 6f 20 66 6f 72 63 65 20 74 68 ll also force th
8ed0: 65 20 76 65 72 69 66 79 20 6d 65 74 68 6f 64 20 e verify method
8ee0: 69 6e 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c in [cmd tls::cal
8ef0: 6c 62 61 63 6b 5d 20 74 6f 20 61 63 63 65 70 74 lback] to accept
8f00: 20 74 68 65 0a 63 65 72 74 69 66 69 63 61 74 65 the.certificate
8f10: 2c 20 65 76 65 6e 20 69 66 20 69 74 20 69 73 20 , even if it is
8f20: 69 6e 76 61 6c 69 64 20 77 68 65 6e 20 74 68 65 invalid when the
8f30: 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 [option -valida
8f40: 74 65 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f tecommand].optio
8f50: 6e 20 69 73 20 73 65 74 20 74 6f 20 5b 63 6d 64 n is set to [cmd
8f60: 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 tls::validate_c
8f70: 6f 6d 6d 61 6e 64 5d 2e 0a 0a 5b 70 61 72 61 5d ommand]...[para]
8f80: 0a 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65 ..[emph "The use
8f90: 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 of the variable
8fa0: 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62 75 67 [var tls::debug
8fb0: 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 ] is not recomme
8fc0: 6e 64 65 64 2e 0a 49 74 20 6d 61 79 20 62 65 20 nded..It may be
8fd0: 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75 74 removed from fut
8fe0: 75 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a ure releases."].
8ff0: 0a 5b 73 65 63 74 69 6f 6e 20 22 45 78 61 6d 70 .[section "Examp
9000: 6c 65 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f les"]..The follo
9010: 77 69 6e 67 20 61 72 65 20 65 78 61 6d 70 6c 65 wing are example
9020: 20 73 63 72 69 70 74 73 20 74 6f 20 64 6f 77 6e scripts to down
9030: 6c 6f 61 64 20 61 20 77 65 62 70 61 67 65 20 61 load a webpage a
9040: 6e 64 20 66 69 6c 65 20 75 73 69 6e 67 20 74 68 nd file using th
9050: 65 0a 68 74 74 70 20 70 61 63 6b 61 67 65 2e 20 e.http package.
9060: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65 See [sectref "Ce
9070: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 rtificate Valida
9080: 74 69 6f 6e 22 5d 20 66 6f 72 20 77 68 65 6e 20 tion"] for when
9090: 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 the.[option -cad
90a0: 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 ir], [option -ca
90b0: 66 69 6c 65 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 file], and [opti
90c0: 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 on -castore] opt
90d0: 69 6f 6e 73 20 61 72 65 20 61 6c 73 6f 0a 6e 65 ions are also.ne
90e0: 65 64 65 64 2e 20 53 65 65 20 74 68 65 20 5b 66 eded. See the [f
90f0: 69 6c 65 20 64 65 6d 6f 73 5d 20 64 69 72 65 63 ile demos] direc
9100: 74 6f 72 79 20 66 6f 72 20 6d 6f 72 65 20 65 78 tory for more ex
9110: 61 6d 70 6c 65 20 73 63 72 69 70 74 73 2e 0a 0a ample scripts...
9120: 5b 70 61 72 61 5d 0a 0a 45 78 61 6d 70 6c 65 20 [para]..Example
9130: 23 31 3a 20 44 6f 77 6e 6c 6f 61 64 20 61 20 77 #1: Download a w
9140: 65 62 20 70 61 67 65 0a 0a 5b 65 78 61 6d 70 6c eb page..[exampl
9150: 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 e {..package req
9160: 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67 uire http.packag
9170: 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 73 e require tls..s
9180: 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f 2f et url "https://
9190: 77 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a 68 74 74 www.tcl.tk/".htt
91a0: 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74 70 p::register http
91b0: 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c s 443 [list ::tl
91c0: 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73 s::socket -autos
91d0: 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 72 65 71 ervername 1 -req
91e0: 75 69 72 65 20 31 5d 0a 0a 23 20 47 65 74 20 55 uire 1]..# Get U
91f0: 52 4c 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 68 74 RL.set token [ht
9200: 74 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c 5d tp::geturl $url]
9210: 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20 65 72 ..# Check for er
9220: 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a 3a 73 ror.if {[http::s
9230: 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e 65 tatus $token] ne
9240: 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75 74 "ok"} {. put
9250: 73 20 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f 72 s [format "Error
9260: 20 25 73 22 20 5b 68 74 74 70 3a 3a 73 74 61 74 %s" [http::stat
9270: 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23 us $token]].}..#
9280: 20 53 61 76 65 20 77 65 62 20 70 61 67 65 20 74 Save web page t
9290: 6f 20 66 69 6c 65 0a 73 65 74 20 63 68 20 5b 6f o file.set ch [o
92a0: 70 65 6e 20 65 78 61 6d 70 6c 65 2e 68 74 6d 6c pen example.html
92b0: 20 77 62 5d 0a 70 75 74 73 20 24 63 68 20 5b 68 wb].puts $ch [h
92c0: 74 74 70 3a 3a 64 61 74 61 20 24 74 6f 6b 65 6e ttp::data $token
92d0: 5d 0a 63 6c 6f 73 65 20 24 63 68 0a 0a 23 20 43 ].close $ch..# C
92e0: 6c 65 61 6e 75 70 0a 3a 3a 68 74 74 70 3a 3a 63 leanup.::http::c
92f0: 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d leanup $token.}]
9300: 0a 0a 45 78 61 6d 70 6c 65 20 23 32 3a 20 44 6f ..Example #2: Do
9310: 77 6e 6c 6f 61 64 20 61 20 66 69 6c 65 0a 0a 5b wnload a file..[
9320: 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b 61 example {..packa
9330: 67 65 20 72 65 71 75 69 72 65 20 68 74 74 70 0a ge require http.
9340: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 package require
9350: 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 68 74 tls..set url "ht
9360: 74 70 73 3a 2f 2f 77 69 6b 69 2e 74 63 6c 2d 6c tps://wiki.tcl-l
9370: 61 6e 67 2e 6f 72 67 2f 73 69 74 65 6d 61 70 2e ang.org/sitemap.
9380: 78 6d 6c 22 0a 68 74 74 70 3a 3a 72 65 67 69 73 xml".http::regis
9390: 74 65 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c ter https 443 [l
93a0: 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 ist ::tls::socke
93b0: 74 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d t -autoservernam
93c0: 65 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d 0a e 1 -require 1].
93d0: 0a 23 20 4f 70 65 6e 20 6f 75 74 70 75 74 20 66 .# Open output f
93e0: 69 6c 65 0a 73 65 74 20 66 69 6c 65 6e 61 6d 65 ile.set filename
93f0: 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 75 72 6c [file tail $url
9400: 5d 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20 24 ].set ch [open $
9410: 66 69 6c 65 6e 61 6d 65 20 77 62 5d 0a 0a 23 20 filename wb]..#
9420: 47 65 74 20 66 69 6c 65 0a 73 65 74 20 74 6f 6b Get file.set tok
9430: 65 6e 20 5b 3a 3a 68 74 74 70 3a 3a 67 65 74 75 en [::http::getu
9440: 72 6c 20 24 75 72 6c 20 2d 62 6c 6f 63 6b 73 69 rl $url -blocksi
9450: 7a 65 20 36 35 35 33 36 20 2d 63 68 61 6e 6e 65 ze 65536 -channe
9460: 6c 20 24 63 68 5d 0a 0a 23 20 43 68 65 63 6b 20 l $ch]..# Check
9470: 66 6f 72 20 65 72 72 6f 72 0a 69 66 20 7b 5b 68 for error.if {[h
9480: 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b ttp::status $tok
9490: 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20 en] ne "ok"} {.
94a0: 20 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 74 20 puts [format
94b0: 22 45 72 72 6f 72 20 25 73 22 20 5b 68 74 74 70 "Error %s" [http
94c0: 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d ::status $token]
94d0: 5d 0a 7d 0a 0a 23 20 43 6c 65 61 6e 75 70 0a 63 ].}..# Cleanup.c
94e0: 6c 6f 73 65 20 24 63 68 0a 3a 3a 68 74 74 70 3a lose $ch.::http:
94f0: 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a :cleanup $token.
9500: 7d 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 53 70 }]..[section "Sp
9510: 65 63 69 61 6c 20 43 6f 6e 73 69 64 65 72 61 74 ecial Considerat
9520: 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 63 61 70 61 ions"]..The capa
9530: 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69 73 bilities of this
9540: 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61 72 package can var
9550: 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61 73 y enormously bas
9560: 65 64 20 75 70 6f 6e 20 68 6f 77 20 74 68 65 0a ed upon how the.
9570: 6c 69 6e 6b 65 64 20 74 6f 20 4f 70 65 6e 53 53 linked to OpenSS
9580: 4c 20 6c 69 62 72 61 72 79 20 77 61 73 20 63 6f L library was co
9590: 6e 66 69 67 75 72 65 64 20 61 6e 64 20 62 75 69 nfigured and bui
95a0: 6c 74 2e 20 4e 65 77 20 76 65 72 73 69 6f 6e 73 lt. New versions
95b0: 20 6d 61 79 20 6f 62 73 6f 6c 65 74 65 0a 6f 6c may obsolete.ol
95c0: 64 65 72 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 der protocol ver
95d0: 73 69 6f 6e 73 2c 20 61 64 64 20 6f 72 20 72 65 sions, add or re
95e0: 6d 6f 76 65 20 63 69 70 68 65 72 73 2c 20 63 68 move ciphers, ch
95f0: 61 6e 67 65 20 64 65 66 61 75 6c 74 20 76 61 6c ange default val
9600: 75 65 73 2c 20 65 74 63 2e 0a 55 73 65 20 74 68 ues, etc..Use th
9610: 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 e [cmd tls::prot
9620: 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 74 ocols] command t
9630: 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 73 75 70 o obtain the sup
9640: 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f 6c 20 ported.protocol
9650: 76 65 72 73 69 6f 6e 73 2e 0a 0a 5b 73 65 63 74 versions...[sect
9660: 69 6f 6e 20 22 45 72 72 6f 72 20 4d 65 73 73 61 ion "Error Messa
9670: 67 65 73 22 5d 0a 0a 53 6f 6d 65 20 4f 70 73 6e ges"]..Some Opsn
9680: 53 53 6c 20 65 72 72 6f 72 20 6d 65 73 73 61 67 SSl error messag
9690: 65 73 20 68 61 76 65 20 63 72 79 70 74 69 63 20 es have cryptic
96a0: 6d 65 61 6e 69 6e 67 73 2e 20 54 68 69 73 20 69 meanings. This i
96b0: 73 20 61 20 6c 69 73 74 20 6f 66 20 6d 65 73 73 s a list of mess
96c0: 61 67 65 73 0a 61 6c 6f 6e 67 20 77 69 74 68 20 ages.along with
96d0: 74 68 65 69 72 20 74 72 75 65 20 6d 65 61 6e 69 their true meani
96e0: 6e 67 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e ng...[list_begin
96f0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b definitions]..[
9700: 64 65 66 20 5b 61 72 67 20 22 68 61 6e 64 73 68 def [arg "handsh
9710: 61 6b 65 20 66 61 69 6c 65 64 3a 20 63 65 72 74 ake failed: cert
9720: 69 66 69 63 61 74 65 20 76 65 72 69 66 79 20 66 ificate verify f
9730: 61 69 6c 65 64 20 64 75 65 20 74 6f 20 5c 22 75 ailed due to \"u
9740: 6e 61 62 6c 65 20 74 6f 20 67 65 74 20 6c 6f 63 nable to get loc
9750: 61 6c 20 69 73 73 75 65 72 20 63 65 72 74 69 66 al issuer certif
9760: 69 63 61 74 65 5c 22 22 5d 5d 0a 54 68 65 20 63 icate\""]].The c
9770: 65 72 74 69 66 69 63 61 74 65 73 20 69 6e 20 74 ertificates in t
9780: 68 65 20 43 41 20 66 69 6c 65 20 6f 72 20 63 65 he CA file or ce
9790: 72 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 20 rtificate store
97a0: 65 69 74 68 65 72 20 64 6f 20 6e 6f 74 20 68 61 either do not ha
97b0: 76 65 20 6f 6e 65 20 6f 72 0a 6d 6f 72 65 20 69 ve one or.more i
97c0: 73 73 75 65 72 73 20 6f 66 20 74 68 65 20 63 65 ssuers of the ce
97d0: 72 74 69 66 69 63 61 74 65 73 20 79 6f 75 20 61 rtificates you a
97e0: 72 65 20 76 61 6c 69 64 61 74 69 6e 67 20 6f 72 re validating or
97f0: 20 74 68 65 79 20 68 61 76 65 20 65 78 70 69 72 they have expir
9800: 65 64 2e 0a 55 73 75 61 6c 6c 79 20 74 68 69 73 ed..Usually this
9810: 20 6d 65 61 6e 73 20 79 6f 75 20 6e 65 65 64 20 means you need
9820: 61 6e 20 75 70 64 61 74 65 64 20 43 41 63 65 72 an updated CAcer
9830: 74 20 66 69 6c 65 2e 0a 0a 5b 64 65 66 20 5b 61 t file...[def [a
9840: 72 67 20 22 70 61 63 6b 65 74 20 6c 65 6e 67 74 rg "packet lengt
9850: 68 20 74 6f 6f 20 6c 6f 6e 67 22 5d 5d 0a 43 6c h too long"]].Cl
9860: 69 65 6e 74 20 68 61 73 20 74 72 69 65 64 20 74 ient has tried t
9870: 6f 20 63 6f 6e 6e 65 63 74 20 74 6f 20 61 20 48 o connect to a H
9880: 54 54 50 20 73 65 72 76 65 72 20 6f 6e 20 74 68 TTP server on th
9890: 65 20 70 6c 61 69 6e 2d 74 65 78 74 20 70 6f 72 e plain-text por
98a0: 74 20 69 6e 73 74 65 61 64 20 6f 66 0a 74 68 65 t instead of.the
98b0: 20 53 53 4c 2f 54 4c 53 20 70 6f 72 74 2e 0a 0a SSL/TLS port...
98c0: 5b 64 65 66 20 5b 61 72 67 20 22 75 6e 65 78 70 [def [arg "unexp
98d0: 65 63 74 65 64 20 65 6f 66 20 77 68 69 6c 65 20 ected eof while
98e0: 72 65 61 64 69 6e 67 22 5d 5d 0a 54 68 65 20 70 reading"]].The p
98f0: 65 65 72 20 68 61 73 20 63 6c 6f 73 65 64 20 74 eer has closed t
9900: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 77 69 he connection wi
9910: 74 68 6f 75 74 20 73 65 6e 64 69 6e 67 20 74 68 thout sending th
9920: 65 20 22 63 6c 6f 73 65 20 6e 6f 74 69 66 79 22 e "close notify"
9930: 20 73 68 75 74 64 6f 77 6e 0a 61 6c 65 72 74 2e shutdown.alert.
9940: 20 53 6f 6d 65 20 73 65 72 76 65 72 73 20 77 69 Some servers wi
9950: 6c 6c 20 74 65 72 6d 69 6e 61 74 65 20 74 68 65 ll terminate the
9960: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61 66 74 65 connection afte
9970: 72 20 74 68 65 20 66 69 6c 65 20 6f 72 20 77 65 r the file or we
9980: 62 70 61 67 65 20 68 61 73 0a 62 65 65 6e 20 73 bpage has.been s
9990: 65 6e 74 20 77 69 74 68 6f 75 74 20 73 65 6e 64 ent without send
99a0: 69 6e 67 20 74 68 65 20 22 63 6c 6f 73 65 20 6e ing the "close n
99b0: 6f 74 69 66 79 22 20 6d 65 73 73 61 67 65 2e 20 otify" message.
99c0: 49 6e 20 74 68 69 73 20 63 61 73 65 2c 20 69 74 In this case, it
99d0: 20 73 68 6f 75 6c 64 0a 6e 6f 74 20 72 65 73 75 should.not resu
99e0: 6c 74 20 69 6e 20 61 20 6c 6f 73 73 20 6f 66 20 lt in a loss of
99f0: 64 61 74 61 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 data...[def [arg
9a00: 20 22 77 72 6f 6e 67 20 76 65 72 73 69 6f 6e 20 "wrong version
9a10: 6e 75 6d 62 65 72 22 5d 5d 0a 43 6c 69 65 6e 74 number"]].Client
9a20: 20 68 61 73 20 74 72 69 65 64 20 74 6f 20 63 6f has tried to co
9a30: 6e 6e 65 63 74 20 74 6f 20 61 20 6e 6f 6e 2d 48 nnect to a non-H
9a40: 54 54 50 20 73 65 72 76 65 72 20 6f 6e 20 61 20 TTP server on a
9a50: 6e 6f 6e 2d 54 4c 53 20 28 69 2e 65 2e 20 70 6c non-TLS (i.e. pl
9a60: 61 69 6e 20 74 65 78 74 29 20 70 6f 72 74 2e 0a ain text) port..
9a70: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6d 61 .[list_end]..[ma
9a80: 6e 70 61 67 65 5f 65 6e 64 5d 0a npage_end].