Hex Artifact Content

Artifact aa62c6927320f4d8bb87d640d69517f15be42cbf841daa075b1d655d44a62bb0:


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 62 31 5d 0a 5b 63   tls n 2.0b1].[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 62  require tls 2.0b
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 73  ript access to s
0350: 65 63 75 72 65 20 73 6f 63 6b 65 74 20 63 6f 6d  ecure socket com
0360: 6d 75 6e 69 63 61 74 69 6f 6e 73 0a 75 73 69 6e  munications.usin
0370: 67 20 74 68 65 20 54 72 61 6e 73 70 6f 72 74 20  g the Transport 
0380: 4c 61 79 65 72 20 53 65 63 75 72 69 74 79 20 28  Layer Security (
0390: 54 4c 53 29 20 70 72 6f 74 6f 63 6f 6c 2e 20 49  TLS) protocol. I
03a0: 74 20 70 72 6f 76 69 64 65 73 20 61 20 67 65 6e  t provides a gen
03b0: 65 72 69 63 0a 62 69 6e 64 69 6e 67 20 74 6f 20  eric.binding to 
03c0: 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 77 77  [uri "https://ww
03d0: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 20  w.openssl.org/" 
03e0: 4f 70 65 6e 53 53 4c 5d 2c 20 75 74 69 6c 69 7a  OpenSSL], utiliz
03f0: 69 6e 67 20 74 68 65 0a 5b 73 79 73 63 6d 64 20  ing the.[syscmd 
0400: 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e 65 6c  Tcl_StackChannel
0410: 5d 20 41 50 49 20 69 6e 20 54 43 4c 20 38 2e 34  ] API in TCL 8.4
0420: 20 6f 72 20 6c 61 74 65 72 2e 0a 54 68 65 73 65   or later..These
0430: 20 73 6f 63 6b 65 74 73 20 62 65 68 61 76 65 20   sockets behave 
0440: 65 78 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65  exactly the same
0450: 20 61 73 20 63 68 61 6e 6e 65 6c 73 20 63 72 65   as channels cre
0460: 61 74 65 64 20 75 73 69 6e 67 20 74 68 65 20 62  ated using the b
0470: 75 69 6c 74 2d 69 6e 0a 5b 73 79 73 63 6d 64 20  uilt-in.[syscmd 
0480: 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c  socket] command,
0490: 20 62 75 74 20 70 72 6f 76 69 64 65 20 61 64 64   but provide add
04a0: 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 73 20  itional options 
04b0: 66 6f 72 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 0a  for controlling.
04c0: 74 68 65 20 53 53 4c 2f 54 4c 53 20 73 65 73 73  the SSL/TLS sess
04d0: 69 6f 6e 2e 0a 0a 5b 73 65 63 74 69 6f 6e 20 43  ion...[section C
04e0: 6f 6d 70 61 74 69 62 69 6c 69 74 79 5d 0a 54 68  ompatibility].Th
04f0: 69 73 20 65 78 74 65 6e 73 69 6f 6e 20 69 73 20  is extension is 
0500: 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68 20  compatible with 
0510: 4f 70 65 6e 53 53 4c 20 31 2e 31 2e 31 20 6f 72  OpenSSL 1.1.1 or
0520: 20 6c 61 74 65 72 2e 20 49 74 20 72 65 71 75 69   later. It requi
0530: 72 65 73 20 54 63 6c 0a 76 65 72 73 69 6f 6e 20  res Tcl.version 
0540: 38 2e 35 20 6f 72 20 6c 61 74 65 72 20 61 6e 64  8.5 or later and
0550: 20 77 69 6c 6c 20 77 6f 72 6b 20 77 69 74 68 20   will work with 
0560: 54 63 6c 20 39 2e 30 2e 0a 0a 5b 73 65 63 74 69  Tcl 9.0...[secti
0570: 6f 6e 20 43 6f 6d 6d 61 6e 64 73 5d 0a 0a 54 68  on Commands]..Th
0580: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20  e following are 
0590: 74 68 65 20 63 6f 6d 6d 61 6e 64 73 20 70 72 6f  the commands pro
05a0: 76 69 64 65 64 20 62 79 20 74 68 65 20 54 63 4c  vided by the TcL
05b0: 54 4c 53 20 70 61 63 6b 61 67 65 2e 20 53 65 65  TLS package. See
05c0: 20 74 68 65 0a 5b 73 65 63 74 72 65 66 20 45 78   the.[sectref Ex
05d0: 61 6d 70 6c 65 73 5d 20 66 6f 72 20 65 78 61 6d  amples] for exam
05e0: 70 6c 65 20 75 73 61 67 65 20 61 6e 64 20 74 68  ple usage and th
05f0: 65 20 5b 66 69 6c 65 20 64 65 6d 6f 73 5d 20 64  e [file demos] d
0600: 69 72 65 63 74 6f 72 79 20 66 6f 72 0a 6d 6f 72  irectory for.mor
0610: 65 20 65 78 61 6d 70 6c 65 20 75 73 61 67 65 2e  e example usage.
0620: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
0630: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 63 61 6c  finitions]..[cal
0640: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6e 69 74  l [cmd tls::init
0650: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74  ] [opt [arg -opt
0660: 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  ion]] [opt [arg 
0670: 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72  value]] [opt [ar
0680: 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65  g "-option value
0690: 20 2e 2e 2e 22 5d 5d 5d 0a 0a 4f 70 74 69 6f 6e   ..."]]]..Option
06a0: 61 6c 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 73  al function to s
06b0: 65 74 20 74 68 65 20 64 65 66 61 75 6c 74 20 6f  et the default o
06c0: 70 74 69 6f 6e 73 20 75 73 65 64 20 62 79 20 5b  ptions used by [
06d0: 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d  cmd tls::socket]
06e0: 2e 20 49 66 20 79 6f 75 0a 63 61 6c 6c 20 5b 63  . If you.call [c
06f0: 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20  md tls::import] 
0700: 64 69 72 65 63 74 6c 79 2c 20 74 68 65 20 76 61  directly, the va
0710: 6c 75 65 73 20 73 65 74 20 62 79 20 74 68 69 73  lues set by this
0720: 20 63 6f 6d 6d 61 6e 64 20 68 61 76 65 20 6e 6f   command have no
0730: 20 65 66 66 65 63 74 2e 0a 54 68 69 73 20 63 6f   effect..This co
0740: 6d 6d 61 6e 64 20 73 75 70 70 6f 72 74 73 20 61  mmand supports a
0750: 6c 6c 20 6f 66 20 74 68 65 20 73 61 6d 65 20 6f  ll of the same o
0760: 70 74 69 6f 6e 73 20 61 73 20 74 68 65 20 5b 63  ptions as the [c
0770: 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20  md tls::socket] 
0780: 63 6f 6d 6d 61 6e 64 2c 0a 74 68 6f 75 67 68 20  command,.though 
0790: 79 6f 75 20 73 68 6f 75 6c 64 20 6c 69 6d 69 74  you should limit
07a0: 20 79 6f 75 72 20 6f 70 74 69 6f 6e 73 20 74 6f   your options to
07b0: 20 6f 6e 6c 79 20 74 68 65 20 54 4c 53 20 72 65   only the TLS re
07c0: 6c 61 74 65 64 20 6f 6e 65 73 2e 0a 0a 5b 63 61  lated ones...[ca
07d0: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63  ll [cmd tls::soc
07e0: 6b 65 74 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d  ket] [opt [arg -
07f0: 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61  option]] [opt [a
0800: 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20  rg value]] [opt 
0810: 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61  [arg "-option va
0820: 6c 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20  lue ..."]] [arg 
0830: 68 6f 73 74 5d 20 5b 61 72 67 20 70 6f 72 74 5d  host] [arg port]
0840: 5d 0a 0a 54 68 69 73 20 69 73 20 61 20 68 65 6c  ]..This is a hel
0850: 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 74 68 61  per function tha
0860: 74 20 75 74 69 6c 69 7a 65 73 20 74 68 65 20 75  t utilizes the u
0870: 6e 64 65 72 6c 79 69 6e 67 20 63 6f 6d 6d 61 6e  nderlying comman
0880: 64 73 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65  ds [syscmd socke
0890: 74 5d 0a 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a  t].and [cmd tls:
08a0: 3a 69 6d 70 6f 72 74 5d 20 74 6f 20 63 72 65 61  :import] to crea
08b0: 74 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f  te the connectio
08c0: 6e 2e 20 49 74 20 62 65 68 61 76 65 73 20 74 68  n. It behaves th
08d0: 65 20 73 61 6d 65 20 61 73 20 74 68 65 0a 6e 61  e same as the.na
08e0: 74 69 76 65 20 54 43 4c 20 5b 73 79 73 63 6d 64  tive TCL [syscmd
08f0: 20 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64   socket] command
0900: 2c 20 62 75 74 20 61 6c 73 6f 20 73 75 70 70 6f  , but also suppo
0910: 72 74 73 20 74 68 65 20 5b 63 6d 64 20 74 6c 73  rts the [cmd tls
0920: 3a 3a 69 6d 70 6f 72 74 5d 0a 63 6f 6d 6d 61 6e  ::import].comman
0930: 64 20 6f 70 74 69 6f 6e 73 20 77 69 74 68 20 6f  d options with o
0940: 6e 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70  ne additional op
0950: 74 69 6f 6e 2e 20 49 74 20 72 65 74 75 72 6e 73  tion. It returns
0960: 20 74 68 65 20 63 68 61 6e 6e 65 6c 20 68 61 6e   the channel han
0970: 64 6c 65 20 69 64 0a 66 6f 72 20 74 68 65 20 6e  dle id.for the n
0980: 65 77 20 73 6f 63 6b 65 74 2e 0a 0a 5b 6c 69 73  ew socket...[lis
0990: 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d  t_begin options]
09a0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 75 74 6f  ..[opt_def -auto
09b0: 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 20  servername [arg 
09c0: 62 6f 6f 6c 5d 5d 0a 49 66 20 5b 63 6f 6e 73 74  bool]].If [const
09d0: 20 74 72 75 65 5d 2c 20 61 75 74 6f 6d 61 74 69   true], automati
09e0: 63 61 6c 6c 79 20 73 65 74 20 74 68 65 20 5b 6f  cally set the [o
09f0: 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d  ption -servernam
0a00: 65 5d 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74  e] argument to t
0a10: 68 65 0a 5b 65 6d 70 68 20 68 6f 73 74 5d 20 61  he.[emph host] a
0a20: 72 67 75 6d 65 6e 74 2e 20 50 72 69 6f 72 20 74  rgument. Prior t
0a30: 6f 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68  o TclTLS 2.0, th
0a40: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
0a50: 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 53 74 61 72  nst false]..Star
0a60: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ting in TclTLS 2
0a70: 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20  .0, the default 
0a80: 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20  is [const true] 
0a90: 75 6e 6c 65 73 73 20 5b 6f 70 74 69 6f 6e 20 2d  unless [option -
0aa0: 73 65 72 76 65 72 6e 61 6d 65 5d 0a 69 73 20 61  servername].is a
0ab0: 6c 73 6f 20 73 70 65 63 69 66 69 65 64 2e 0a 0a  lso specified...
0ac0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c  [list_end]..[cal
0ad0: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b  l [cmd tls::sock
0ae0: 65 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72  et] [option -ser
0af0: 76 65 72 5d 20 5b 61 72 67 20 63 6f 6d 6d 61 6e  ver] [arg comman
0b00: 64 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70  d] [opt [arg -op
0b10: 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67  tion]] [opt [arg
0b20: 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61   value]] [opt [a
0b30: 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75  rg "-option valu
0b40: 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 70 6f  e ..."]] [arg po
0b50: 72 74 5d 5d 0a 0a 53 61 6d 65 20 61 73 20 70 72  rt]]..Same as pr
0b60: 65 76 69 6f 75 73 2c 20 62 75 74 20 69 6e 73 74  evious, but inst
0b70: 65 61 64 20 63 72 65 61 74 65 73 20 61 20 73 65  ead creates a se
0b80: 72 76 65 72 20 73 6f 63 6b 65 74 20 66 6f 72 20  rver socket for 
0b90: 63 6c 69 65 6e 74 73 20 74 6f 20 63 6f 6e 6e 65  clients to conne
0ba0: 63 74 20 74 6f 0a 6a 75 73 74 20 6c 69 6b 65 20  ct to.just like 
0bb0: 74 68 65 20 54 63 6c 20 5b 73 79 73 63 6d 64 20  the Tcl [syscmd 
0bc0: 22 73 6f 63 6b 65 74 20 2d 73 65 72 76 65 72 22  "socket -server"
0bd0: 5d 20 63 6f 6d 6d 61 6e 64 2e 20 49 74 20 72 65  ] command. It re
0be0: 74 75 72 6e 73 20 74 68 65 20 63 68 61 6e 6e 65  turns the channe
0bf0: 6c 0a 68 61 6e 64 6c 65 20 69 64 20 66 6f 72 20  l.handle id for 
0c00: 74 68 65 20 6e 65 77 20 73 6f 63 6b 65 74 2e 0a  the new socket..
0c10: 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a  .[call [cmd tls:
0c20: 3a 69 6d 70 6f 72 74 5d 20 5b 61 72 67 20 63 68  :import] [arg ch
0c30: 61 6e 6e 65 6c 5d 20 5b 6f 70 74 20 5b 61 72 67  annel] [opt [arg
0c40: 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20   -option]] [opt 
0c50: 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70  [arg value]] [op
0c60: 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20  t [arg "-option 
0c70: 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d 0a 0a 53  value ..."]]]..S
0c80: 74 61 72 74 20 54 4c 53 20 65 6e 63 72 79 70 74  tart TLS encrypt
0c90: 69 6f 6e 20 6f 6e 20 54 43 4c 20 63 68 61 6e 6e  ion on TCL chann
0ca0: 65 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  el [arg channel]
0cb0: 20 76 69 61 20 61 20 73 74 61 63 6b 65 64 20 63   via a stacked c
0cc0: 68 61 6e 6e 65 6c 2e 20 49 74 0a 6e 65 65 64 20  hannel. It.need 
0cd0: 6e 6f 74 20 62 65 20 61 20 73 6f 63 6b 65 74 2c  not be a socket,
0ce0: 20 62 75 74 20 6d 75 73 74 20 70 72 6f 76 69 64   but must provid
0cf0: 65 20 62 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c  e bi-directional
0d00: 20 66 6c 6f 77 2e 20 41 6c 73 6f 20 73 65 74 73   flow. Also sets
0d10: 20 73 65 73 73 69 6f 6e 0a 70 61 72 61 6d 65 74   session.paramet
0d20: 65 72 73 20 66 6f 72 20 53 53 4c 20 68 61 6e 64  ers for SSL hand
0d30: 73 68 61 6b 65 2e 20 56 61 6c 69 64 20 6f 70 74  shake. Valid opt
0d40: 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74  ions are:..[list
0d50: 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a  _begin options].
0d60: 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 6c 70 6e 20  .[opt_def -alpn 
0d70: 5b 61 72 67 20 6c 69 73 74 5d 5d 0a 4c 69 73 74  [arg list]].List
0d80: 20 6f 66 20 70 72 6f 74 6f 63 6f 6c 73 20 74 6f   of protocols to
0d90: 20 6f 66 66 65 72 20 64 75 72 69 6e 67 20 41 70   offer during Ap
0da0: 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20  plication-Layer 
0db0: 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61  Protocol Negotia
0dc0: 74 69 6f 6e 0a 28 41 4c 50 4e 29 2e 20 46 6f 72  tion.(ALPN). For
0dd0: 20 65 78 61 6d 70 6c 65 3a 20 5b 63 6f 6e 73 74   example: [const
0de0: 20 68 32 5d 20 61 6e 64 20 5b 63 6f 6e 73 74 20   h2] and [const 
0df0: 68 74 74 70 2f 31 2e 31 5d 2c 20 62 75 74 20 6e  http/1.1], but n
0e00: 6f 74 20 5b 63 6f 6e 73 74 20 68 33 5d 20 6f 72  ot [const h3] or
0e10: 0a 5b 63 6f 6e 73 74 20 71 75 69 63 5d 2e 20 54  .[const quic]. T
0e20: 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65  his option is ne
0e30: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
0e40: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64  ...[opt_def -cad
0e50: 69 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72  ir [arg director
0e60: 79 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  y]].Specifies th
0e70: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72  e directory wher
0e80: 65 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  e the Certificat
0e90: 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e Authority (CA)
0ea0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72   certificates ar
0eb0: 65 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65  e.stored. The de
0ec0: 66 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72  fault is platfor
0ed0: 6d 20 73 70 65 63 69 66 69 63 20 61 6e 64 20 63  m specific and c
0ee0: 61 6e 20 62 65 20 73 65 74 20 61 74 20 63 6f 6d  an be set at com
0ef0: 70 69 6c 65 20 74 69 6d 65 2e 20 54 68 65 0a 64  pile time. The.d
0f00: 65 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20  efault location 
0f10: 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65  can be overridde
0f20: 6e 20 62 79 20 74 68 65 20 5b 76 61 72 20 53 53  n by the [var SS
0f30: 4c 5f 43 45 52 54 5f 44 49 52 5d 20 65 6e 76 69  L_CERT_DIR] envi
0f40: 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65  ronment.variable
0f50: 2e 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22  . See [sectref "
0f60: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
0f70: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72  dation"] for mor
0f80: 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74  e details...[opt
0f90: 5f 64 65 66 20 2d 63 61 66 69 6c 65 20 5b 61 72  _def -cafile [ar
0fa0: 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65  g filename]].Spe
0fb0: 63 69 66 69 65 73 20 74 68 65 20 66 69 6c 65 20  cifies the file 
0fc0: 77 69 74 68 20 74 68 65 20 43 65 72 74 69 66 69  with the Certifi
0fd0: 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28  cate Authority (
0fe0: 43 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73  CA) certificates
0ff0: 20 74 6f 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73   to use in.[cons
1000: 74 20 50 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d  t PEM] file form
1010: 61 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  at. The default 
1020: 69 73 20 5b 66 69 6c 65 20 63 65 72 74 2e 70 65  is [file cert.pe
1030: 6d 5d 2c 20 69 6e 20 74 68 65 20 4f 70 65 6e 53  m], in the OpenS
1040: 53 4c 0a 64 69 72 65 63 74 6f 72 79 2e 20 54 68  SL.directory. Th
1050: 65 20 64 65 66 61 75 6c 74 20 66 69 6c 65 20 63  e default file c
1060: 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e  an be overridden
1070: 20 62 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c   by the [var SSL
1080: 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69  _CERT_FILE] envi
1090: 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65  ronment.variable
10a0: 2e 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22  . See [sectref "
10b0: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
10c0: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72  dation"] for mor
10d0: 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74  e details...[opt
10e0: 5f 64 65 66 20 2d 63 61 73 74 6f 72 65 20 5b 61  _def -castore [a
10f0: 72 67 20 55 52 49 5d 5d 0a 53 70 65 63 69 66 69  rg URI]].Specifi
1100: 65 73 20 74 68 65 20 55 6e 69 66 6f 72 6d 20 52  es the Uniform R
1110: 65 73 6f 75 72 63 65 20 49 64 65 6e 74 69 66 69  esource Identifi
1120: 65 72 20 28 55 52 49 29 20 66 6f 72 20 74 68 65  er (URI) for the
1130: 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74   Certificate Aut
1140: 68 6f 72 69 74 79 0a 28 43 41 29 20 73 74 6f 72  hority.(CA) stor
1150: 65 2c 20 77 68 69 63 68 20 6d 61 79 20 62 65 20  e, which may be 
1160: 61 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61 69 6e  a single contain
1170: 65 72 20 6f 72 20 61 20 63 61 74 61 6c 6f 67 20  er or a catalog 
1180: 6f 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e 0a 53  of containers..S
1190: 74 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65  tarting with Ope
11a0: 6e 53 53 4c 20 33 2e 32 20 6f 6e 20 4d 53 20 57  nSSL 3.2 on MS W
11b0: 69 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20 22  indows, set to "
11c0: 5b 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e  [const "org.open
11d0: 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22  ssl.winstore://"
11e0: 5d 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62 75  ]".to use the bu
11f0: 69 6c 74 2d 69 6e 20 4d 53 20 57 69 6e 64 6f 77  ilt-in MS Window
1200: 73 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74  s Certificate St
1210: 6f 72 65 2e 0a 53 65 65 20 5b 73 65 63 74 72 65  ore..See [sectre
1220: 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56  f "Certificate V
1230: 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20  alidation"] for 
1240: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 54 68  more details..Th
1250: 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77  is option is new
1260: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
1270: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 65 72 74  ..[opt_def -cert
1280: 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61  file [arg filena
1290: 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  me]].Specifies t
12a0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 66  he name of the f
12b0: 69 6c 65 20 77 69 74 68 20 74 68 65 20 63 65 72  ile with the cer
12c0: 74 69 66 69 63 61 74 65 20 74 6f 20 75 73 65 20  tificate to use 
12d0: 69 6e 20 50 45 4d 20 66 6f 72 6d 61 74 0a 61 73  in PEM format.as
12e0: 20 74 68 65 20 6c 6f 63 61 6c 20 28 63 6c 69 65   the local (clie
12f0: 6e 74 20 6f 72 20 73 65 72 76 65 72 29 20 63 65  nt or server) ce
1300: 72 74 69 66 69 63 61 74 65 2e 20 49 74 20 61 6c  rtificate. It al
1310: 73 6f 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20  so contains the 
1320: 70 75 62 6c 69 63 20 6b 65 79 2e 0a 0a 5b 6f 70  public key...[op
1330: 74 5f 64 65 66 20 2d 63 65 72 74 20 5b 61 72 67  t_def -cert [arg
1340: 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66   string]].Specif
1350: 69 65 73 20 74 68 65 20 63 65 72 74 69 66 69 63  ies the certific
1360: 61 74 65 20 74 6f 20 75 73 65 20 61 73 20 61 20  ate to use as a 
1370: 44 45 52 20 65 6e 63 6f 64 65 64 20 73 74 72 69  DER encoded stri
1380: 6e 67 20 28 58 2e 35 30 39 20 44 45 52 29 2e 0a  ng (X.509 DER)..
1390: 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 69 70 68 65  .[opt_def -ciphe
13a0: 72 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a  r [arg string]].
13b0: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 6c 69  Specifies the li
13c0: 73 74 20 6f 66 20 63 69 70 68 65 72 73 20 74 6f  st of ciphers to
13d0: 20 75 73 65 20 66 6f 72 20 54 4c 53 20 31 2e 32   use for TLS 1.2
13e0: 20 61 6e 64 20 65 61 72 6c 69 65 72 20 63 6f 6e   and earlier con
13f0: 6e 65 63 74 69 6f 6e 73 2e 0a 53 74 72 69 6e 67  nections..String
1400: 20 69 73 20 61 20 63 6f 6c 6f 6e 20 22 5b 63 6f   is a colon "[co
1410: 6e 73 74 20 3a 5d 22 20 73 65 70 61 72 61 74 65  nst :]" separate
1420: 64 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72  d list of cipher
1430: 73 2e 0a 43 69 70 68 65 72 73 20 63 61 6e 20 62  s..Ciphers can b
1440: 65 20 63 6f 6d 62 69 6e 65 64 20 75 73 69 6e 67  e combined using
1450: 20 74 68 65 20 22 5b 63 6f 6e 73 74 20 2b 5d 22   the "[const +]"
1460: 20 63 68 61 72 61 63 74 65 72 2e 0a 50 72 65 66   character..Pref
1470: 69 78 65 73 20 63 61 6e 20 62 65 20 75 73 65 64  ixes can be used
1480: 20 74 6f 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20   to permanently 
1490: 72 65 6d 6f 76 65 20 22 5b 63 6f 6e 73 74 20 21  remove "[const !
14a0: 5d 22 2c 20 64 65 6c 65 74 65 20 22 5b 63 6f 6e  ]", delete "[con
14b0: 73 74 20 2d 5d 22 2c 20 6f 72 0a 6d 6f 76 65 20  st -]", or.move 
14c0: 74 6f 20 74 68 65 20 65 6e 64 20 22 5b 63 6f 6e  to the end "[con
14d0: 73 74 20 2b 5d 22 20 61 20 73 70 65 63 69 66 69  st +]" a specifi
14e0: 65 64 20 63 69 70 68 65 72 2e 0a 4b 65 79 77 6f  ed cipher..Keywo
14f0: 72 64 73 20 5b 63 6f 6e 73 74 20 40 53 54 52 45  rds [const @STRE
1500: 4e 47 54 48 5d 20 28 73 6f 72 74 20 62 79 20 61  NGTH] (sort by a
1510: 6c 67 6f 72 69 74 68 6d 20 6b 65 79 20 6c 65 6e  lgorithm key len
1520: 67 74 68 29 2c 0a 5b 63 6f 6e 73 74 20 40 53 45  gth),.[const @SE
1530: 43 4c 45 56 45 4c 3d 5d 5b 65 6d 70 68 20 6e 5d  CLEVEL=][emph n]
1540: 20 28 73 65 74 20 73 65 63 75 72 69 74 79 20 6c   (set security l
1550: 65 76 65 6c 20 74 6f 20 6e 29 2c 20 61 6e 64 0a  evel to n), and.
1560: 5b 63 6f 6e 73 74 20 44 45 46 41 55 4c 54 5d 20  [const DEFAULT] 
1570: 28 75 73 65 20 64 65 66 61 75 6c 74 20 63 69 70  (use default cip
1580: 68 65 72 20 6c 69 73 74 2c 20 61 74 20 73 74 61  her list, at sta
1590: 72 74 20 6f 6e 6c 79 29 20 63 61 6e 20 61 6c 73  rt only) can als
15a0: 6f 20 62 65 20 73 70 65 63 69 66 69 65 64 2e 0a  o be specified..
15b0: 53 65 65 20 74 68 65 20 5b 75 72 69 20 22 68 74  See the [uri "ht
15c0: 74 70 73 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73  tps://docs.opens
15d0: 73 6c 2e 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61  sl.org/master/ma
15e0: 6e 31 2f 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65  n1/openssl-ciphe
15f0: 72 73 2f 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65  rs/#options" Ope
1600: 6e 53 53 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74  nSSL].documentat
1610: 69 6f 6e 20 66 6f 72 20 74 68 65 20 66 75 6c 6c  ion for the full
1620: 20 6c 69 73 74 20 6f 66 20 76 61 6c 69 64 20 76   list of valid v
1630: 61 6c 75 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66  alues...[opt_def
1640: 20 2d 63 69 70 68 65 72 73 75 69 74 65 73 20 5b   -ciphersuites [
1650: 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65  arg string]].Spe
1660: 63 69 66 69 65 73 20 74 68 65 20 6c 69 73 74 20  cifies the list 
1670: 6f 66 20 63 69 70 68 65 72 20 73 75 69 74 65 73  of cipher suites
1680: 20 74 6f 20 75 73 65 20 66 6f 72 20 54 4c 53 20   to use for TLS 
1690: 31 2e 33 20 61 73 20 61 20 63 6f 6c 6f 6e 0a 22  1.3 as a colon."
16a0: 5b 63 6f 6e 73 74 20 3a 5d 22 20 73 65 70 61 72  [const :]" separ
16b0: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 63 69 70  ated list of cip
16c0: 68 65 72 20 73 75 69 74 65 20 6e 61 6d 65 73 2e  her suite names.
16d0: 20 53 65 65 20 74 68 65 0a 5b 75 72 69 20 22 68   See the.[uri "h
16e0: 74 74 70 73 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e  ttps://docs.open
16f0: 73 73 6c 2e 6f 72 67 2f 6d 61 73 74 65 72 2f 6d  ssl.org/master/m
1700: 61 6e 31 2f 6f 70 65 6e 73 73 6c 2d 63 69 70 68  an1/openssl-ciph
1710: 65 72 73 2f 23 6f 70 74 69 6f 6e 73 22 20 4f 70  ers/#options" Op
1720: 65 6e 53 53 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61  enSSL].documenta
1730: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 66 75 6c  tion for the ful
1740: 6c 20 6c 69 73 74 20 6f 66 20 76 61 6c 69 64 20  l list of valid 
1750: 76 61 6c 75 65 73 2e 0a 54 68 69 73 20 6f 70 74  values..This opt
1760: 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54  ion is new for T
1770: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74  clTLS 1.8...[opt
1780: 5f 64 65 66 20 2d 63 6f 6d 6d 61 6e 64 20 5b 61  _def -command [a
1790: 72 67 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70  rg callback]].Sp
17a0: 65 63 69 66 69 65 73 20 74 68 65 20 63 61 6c 6c  ecifies the call
17b0: 62 61 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20  back command to 
17c0: 62 65 20 69 6e 76 6f 6b 65 64 20 61 74 20 73 65  be invoked at se
17d0: 76 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75 72  veral points dur
17e0: 69 6e 67 20 74 68 65 0a 68 61 6e 64 73 68 61 6b  ing the.handshak
17f0: 65 20 74 6f 20 70 61 73 73 20 65 72 72 6f 72 73  e to pass errors
1800: 2c 20 74 72 61 63 69 6e 67 20 69 6e 66 6f 72 6d  , tracing inform
1810: 61 74 69 6f 6e 2c 20 61 6e 64 20 70 72 6f 74 6f  ation, and proto
1820: 63 6f 6c 20 6d 65 73 73 61 67 65 73 2e 0a 53 65  col messages..Se
1830: 65 20 5b 73 65 63 74 72 65 66 20 22 43 61 6c 6c  e [sectref "Call
1840: 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d 20 66  back Options"] f
1850: 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b  or more info...[
1860: 6f 70 74 5f 64 65 66 20 2d 64 68 70 61 72 61 6d  opt_def -dhparam
1870: 73 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d  s [arg filename]
1880: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
1890: 44 69 66 66 69 65 2d 48 65 6c 6c 6d 61 6e 20 28  Diffie-Hellman (
18a0: 44 48 29 20 70 61 72 61 6d 65 74 65 72 73 20 66  DH) parameters f
18b0: 69 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ile...[opt_def -
18c0: 6b 65 79 66 69 6c 65 20 5b 61 72 67 20 66 69 6c  keyfile [arg fil
18d0: 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65  ename]].Specifie
18e0: 73 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65  s the private ke
18f0: 79 20 66 69 6c 65 2e 20 54 68 65 20 64 65 66 61  y file. The defa
1900: 75 6c 74 20 69 73 20 74 6f 20 75 73 65 20 74 68  ult is to use th
1910: 65 20 66 69 6c 65 0a 73 70 65 63 69 66 69 65 64  e file.specified
1920: 20 62 79 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20   by the [option 
1930: 2d 63 65 72 74 66 69 6c 65 5d 20 6f 70 74 69 6f  -certfile] optio
1940: 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 6b 65  n...[opt_def -ke
1950: 79 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a  y [arg string]].
1960: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 70 72  Specifies the pr
1970: 69 76 61 74 65 20 6b 65 79 20 74 6f 20 75 73 65  ivate key to use
1980: 20 61 73 20 61 20 44 45 52 20 65 6e 63 6f 64 65   as a DER encode
1990: 64 20 73 74 72 69 6e 67 20 28 50 4b 43 53 23 31  d string (PKCS#1
19a0: 20 44 45 52 29 2e 0a 0a 5b 6f 70 74 5f 64 65 66   DER)...[opt_def
19b0: 20 2d 6d 6f 64 65 6c 20 5b 61 72 67 20 63 68 61   -model [arg cha
19c0: 6e 6e 65 6c 5d 5d 0a 46 6f 72 63 65 20 74 68 69  nnel]].Force thi
19d0: 73 20 63 68 61 6e 6e 65 6c 20 74 6f 20 73 68 61  s channel to sha
19e0: 72 65 20 74 68 65 20 73 61 6d 65 20 5b 74 65 72  re the same [ter
19f0: 6d 20 53 53 4c 5f 43 54 58 5d 20 73 74 72 75 63  m SSL_CTX] struc
1a00: 74 75 72 65 20 61 73 20 74 68 65 0a 73 70 65 63  ture as the.spec
1a10: 69 66 69 65 64 20 5b 61 72 67 20 63 68 61 6e 6e  ified [arg chann
1a20: 65 6c 5d 2c 20 61 6e 64 20 74 68 65 72 65 66 6f  el], and therefo
1a30: 72 65 20 73 68 61 72 65 20 63 6f 6e 66 69 67 2c  re share config,
1a40: 20 63 61 6c 6c 62 61 63 6b 73 2c 20 65 74 63 2e   callbacks, etc.
1a50: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 70 61 73 73  ..[opt_def -pass
1a60: 77 6f 72 64 20 5b 61 72 67 20 63 61 6c 6c 62 61  word [arg callba
1a70: 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  ck]].Specifies t
1a80: 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d  he callback comm
1a90: 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20 77 68  and to invoke wh
1aa0: 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73  en OpenSSL needs
1ab0: 20 74 6f 20 6f 62 74 61 69 6e 20 61 0a 70 61 73   to obtain a.pas
1ac0: 73 77 6f 72 64 2e 20 54 68 69 73 20 69 73 20 74  sword. This is t
1ad0: 79 70 69 63 61 6c 6c 79 20 75 73 65 64 20 74 6f  ypically used to
1ae0: 20 75 6e 6c 6f 63 6b 20 74 68 65 20 70 72 69 76   unlock the priv
1af0: 61 74 65 20 6b 65 79 20 6f 66 20 61 20 63 65 72  ate key of a cer
1b00: 74 69 66 69 63 61 74 65 2e 0a 54 68 65 20 63 61  tificate..The ca
1b10: 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65  llback should re
1b20: 74 75 72 6e 20 61 20 70 61 73 73 77 6f 72 64 20  turn a password 
1b30: 73 74 72 69 6e 67 2e 20 54 68 69 73 20 6f 70 74  string. This opt
1b40: 69 6f 6e 20 68 61 73 20 63 68 61 6e 67 65 64 20  ion has changed 
1b50: 66 6f 72 0a 54 63 6c 54 4c 53 20 31 2e 38 2e 20  for.TclTLS 1.8. 
1b60: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 61  See [sectref "Ca
1b70: 6c 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d  llback Options"]
1b80: 20 66 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 0a   for more info..
1b90: 0a 5b 6f 70 74 5f 64 65 66 20 2d 70 6f 73 74 5f  .[opt_def -post_
1ba0: 68 61 6e 64 73 68 61 6b 65 20 5b 61 72 67 20 62  handshake [arg b
1bb0: 6f 6f 6c 5d 5d 0a 41 6c 6c 6f 77 20 70 6f 73 74  ool]].Allow post
1bc0: 2d 68 61 6e 64 73 68 61 6b 65 20 73 65 73 73 69  -handshake sessi
1bd0: 6f 6e 20 74 69 63 6b 65 74 20 75 70 64 61 74 65  on ticket update
1be0: 73 2e 20 54 68 69 73 20 6f 70 74 69 6f 6e 20 69  s. This option i
1bf0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
1c00: 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20   1.8...[opt_def 
1c10: 2d 72 65 71 75 65 73 74 20 5b 61 72 67 20 62 6f  -request [arg bo
1c20: 6f 6c 5d 5d 0a 52 65 71 75 65 73 74 20 61 20 63  ol]].Request a c
1c30: 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20  ertificate from 
1c40: 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67 20  the peer during 
1c50: 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b  the SSL handshak
1c60: 65 2e 20 54 68 69 73 20 69 73 20 6e 65 65 64 65  e. This is neede
1c70: 64 0a 74 6f 20 64 6f 20 43 65 72 74 69 66 69 63  d.to do Certific
1c80: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 2e 20  ate Validation. 
1c90: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54  Starting in TclT
1ca0: 4c 53 20 31 2e 38 2c 20 74 68 65 20 64 65 66 61  LS 1.8, the defa
1cb0: 75 6c 74 20 69 73 0a 5b 63 6f 6e 73 74 20 74 72  ult is.[const tr
1cc0: 75 65 5d 20 66 6f 72 20 63 6c 69 65 6e 74 20 63  ue] for client c
1cd0: 6f 6e 6e 65 63 74 69 6f 6e 73 2e 20 53 74 61 72  onnections. Star
1ce0: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ting in TclTLS 2
1cf0: 2e 30 2c 20 69 66 20 73 65 74 20 74 6f 0a 5b 63  .0, if set to.[c
1d00: 6f 6e 73 74 20 66 61 6c 73 65 5d 20 61 6e 64 20  onst false] and 
1d10: 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 72 65  [option -require
1d20: 5d 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65  ] is [const true
1d30: 5d 2c 20 74 68 65 6e 20 74 68 69 73 20 77 69 6c  ], then this wil
1d40: 6c 20 62 65 0a 6f 76 65 72 72 69 64 64 65 6e 20  l be.overridden 
1d50: 74 6f 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e  to [const true].
1d60: 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43   See [sectref "C
1d70: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
1d80: 61 74 69 6f 6e 22 5d 20 66 6f 72 0a 6d 6f 72 65  ation"] for.more
1d90: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f   details...[opt_
1da0: 64 65 66 20 2d 72 65 71 75 69 72 65 20 5b 61 72  def -require [ar
1db0: 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 69 72 65  g bool]].Require
1dc0: 20 61 20 76 61 6c 69 64 20 63 65 72 74 69 66 69   a valid certifi
1dd0: 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65  cate from the pe
1de0: 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53  er during the SS
1df0: 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20  L handshake. If 
1e00: 74 68 69 73 20 69 73 0a 73 65 74 20 74 6f 20 74  this is.set to t
1e10: 72 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f  rue, then [optio
1e20: 6e 20 2d 72 65 71 75 65 73 74 5d 20 6d 75 73 74  n -request] must
1e30: 20 61 6c 73 6f 20 62 65 20 73 65 74 20 74 6f 20   also be set to 
1e40: 74 72 75 65 20 61 6e 64 20 61 20 65 69 74 68 65  true and a eithe
1e50: 72 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72  r.[option -cadir
1e60: 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69  ], [option -cafi
1e70: 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  le], [option -ca
1e80: 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70 6c 61  store], or a pla
1e90: 74 66 6f 72 6d 20 64 65 66 61 75 6c 74 0a 6d 75  tform default.mu
1ea0: 73 74 20 62 65 20 70 72 6f 76 69 64 65 64 20 69  st be provided i
1eb0: 6e 20 6f 72 64 65 72 20 74 6f 20 76 61 6c 69 64  n order to valid
1ec0: 61 74 65 20 61 67 61 69 6e 73 74 2e 20 54 68 65  ate against. The
1ed0: 20 64 65 66 61 75 6c 74 20 69 6e 20 54 63 6c 54   default in TclT
1ee0: 4c 53 20 31 2e 38 20 61 6e 64 0a 65 61 72 6c 69  LS 1.8 and.earli
1ef0: 65 72 20 76 65 72 73 69 6f 6e 73 20 69 73 20 5b  er versions is [
1f00: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e  const false] sin
1f10: 63 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61 74 66  ce not all platf
1f20: 6f 72 6d 73 20 68 61 76 65 20 63 65 72 74 69 66  orms have certif
1f30: 69 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 61  icates to.valida
1f40: 74 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20  te against in a 
1f50: 66 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20  form compatible 
1f60: 77 69 74 68 20 4f 70 65 6e 53 53 4c 2e 20 53 74  with OpenSSL. St
1f70: 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53  arting in TclTLS
1f80: 20 32 2e 30 2c 0a 74 68 65 20 64 65 66 61 75 6c   2.0,.the defaul
1f90: 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65  t is [const true
1fa0: 5d 20 66 6f 72 20 63 6c 69 65 6e 74 20 63 6f 6e  ] for client con
1fb0: 6e 65 63 74 69 6f 6e 73 2e 0a 53 65 65 20 5b 73  nections..See [s
1fc0: 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63  ectref "Certific
1fd0: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d  ate Validation"]
1fe0: 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c   for more detail
1ff0: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65  s...[opt_def -se
2000: 63 75 72 69 74 79 5f 6c 65 76 65 6c 20 5b 61 72  curity_level [ar
2010: 67 20 69 6e 74 65 67 65 72 5d 5d 0a 53 70 65 63  g integer]].Spec
2020: 69 66 69 65 73 20 74 68 65 20 73 65 63 75 72 69  ifies the securi
2030: 74 79 20 6c 65 76 65 6c 20 28 76 61 6c 75 65 20  ty level (value 
2040: 66 72 6f 6d 20 30 20 74 6f 20 35 29 2e 20 54 68  from 0 to 5). Th
2050: 65 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c  e security level
2060: 20 61 66 66 65 63 74 73 0a 74 68 65 20 61 6c 6c   affects.the all
2070: 6f 77 65 64 20 63 69 70 68 65 72 20 73 75 69 74  owed cipher suit
2080: 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 61 6c 67  e encryption alg
2090: 6f 72 69 74 68 6d 73 2c 20 73 75 70 70 6f 72 74  orithms, support
20a0: 65 64 20 45 43 43 20 63 75 72 76 65 73 2c 0a 73  ed ECC curves,.s
20b0: 75 70 70 6f 72 74 65 64 20 73 69 67 6e 61 74 75  upported signatu
20c0: 72 65 20 61 6c 67 6f 72 69 74 68 6d 73 2c 20 44  re algorithms, D
20d0: 48 20 70 61 72 61 6d 65 74 65 72 20 73 69 7a 65  H parameter size
20e0: 73 2c 20 63 65 72 74 69 66 69 63 61 74 65 20 6b  s, certificate k
20f0: 65 79 20 73 69 7a 65 73 0a 61 6e 64 20 73 69 67  ey sizes.and sig
2100: 6e 61 74 75 72 65 20 61 6c 67 6f 72 69 74 68 6d  nature algorithm
2110: 73 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69  s. The default i
2120: 73 20 31 20 70 72 69 6f 72 20 74 6f 20 4f 70 65  s 1 prior to Ope
2130: 6e 53 53 4c 20 33 2e 32 20 61 6e 64 20 32 0a 74  nSSL 3.2 and 2.t
2140: 68 65 72 65 61 66 74 65 72 2e 20 4c 65 76 65 6c  hereafter. Level
2150: 20 33 20 61 6e 64 20 68 69 67 68 65 72 20 64 69   3 and higher di
2160: 73 61 62 6c 65 20 73 75 70 70 6f 72 74 20 66 6f  sable support fo
2170: 72 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74  r session ticket
2180: 73 20 61 6e 64 0a 6f 6e 6c 79 20 61 63 63 65 70  s and.only accep
2190: 74 20 63 69 70 68 65 72 20 73 75 69 74 65 73 20  t cipher suites 
21a0: 74 68 61 74 20 70 72 6f 76 69 64 65 20 66 6f 72  that provide for
21b0: 77 61 72 64 20 73 65 63 72 65 63 79 2e 0a 54 68  ward secrecy..Th
21c0: 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77  is option is new
21d0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
21e0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 72 76  ..[opt_def -serv
21f0: 65 72 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 53  er [arg bool]].S
2200: 70 65 63 69 66 69 65 73 20 77 68 65 74 68 65 72  pecifies whether
2210: 20 74 6f 20 61 63 74 20 61 73 20 61 20 73 65 72   to act as a ser
2220: 76 65 72 20 61 6e 64 20 72 65 73 70 6f 6e 64 20  ver and respond 
2230: 77 69 74 68 20 61 20 73 65 72 76 65 72 20 68 61  with a server ha
2240: 6e 64 73 68 61 6b 65 20 77 68 65 6e 20 61 0a 63  ndshake when a.c
2250: 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 73 20 61  lient connects a
2260: 6e 64 20 70 72 6f 76 69 64 65 73 20 61 20 63 6c  nd provides a cl
2270: 69 65 6e 74 20 68 61 6e 64 73 68 61 6b 65 2e 20  ient handshake. 
2280: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  The default is [
2290: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 0a 5b  const false]...[
22a0: 6f 70 74 5f 64 65 66 20 2d 73 65 72 76 65 72 6e  opt_def -servern
22b0: 61 6d 65 20 5b 61 72 67 20 68 6f 73 74 6e 61 6d  ame [arg hostnam
22c0: 65 5d 5d 0a 53 70 65 63 69 66 79 20 74 68 65 20  e]].Specify the 
22d0: 70 65 65 72 27 73 20 68 6f 73 74 6e 61 6d 65 2e  peer's hostname.
22e0: 20 54 68 69 73 20 69 73 20 75 73 65 64 20 74 6f   This is used to
22f0: 20 73 65 74 20 74 68 65 20 54 4c 53 20 53 65 72   set the TLS Ser
2300: 76 65 72 20 4e 61 6d 65 20 49 6e 64 69 63 61 74  ver Name Indicat
2310: 69 6f 6e 0a 28 53 4e 49 29 20 65 78 74 65 6e 73  ion.(SNI) extens
2320: 69 6f 6e 2e 20 53 65 74 20 74 68 69 73 20 74 6f  ion. Set this to
2330: 20 74 68 65 20 65 78 70 65 63 74 65 64 20 73 65   the expected se
2340: 72 76 65 72 6e 61 6d 65 20 69 6e 20 74 68 65 20  rvername in the 
2350: 73 65 72 76 65 72 27 73 20 63 65 72 74 69 66 69  server's certifi
2360: 63 61 74 65 0a 6f 72 20 6f 6e 65 20 6f 66 20 74  cate.or one of t
2370: 68 65 20 53 75 62 6a 65 63 74 20 41 6c 74 65 72  he Subject Alter
2380: 6e 61 74 65 20 4e 61 6d 65 73 20 28 53 41 4e 29  nate Names (SAN)
2390: 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63  . Starting in Tc
23a0: 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69 73 20 77  lTLS 2.0, this w
23b0: 69 6c 6c 0a 64 65 66 61 75 6c 74 20 74 6f 20 74  ill.default to t
23c0: 68 65 20 68 6f 73 74 20 66 6f 72 20 74 68 65 20  he host for the 
23d0: 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74  [cmd tls::socket
23e0: 5d 20 63 6f 6d 6d 61 6e 64 2e 0a 0a 5b 6f 70 74  ] command...[opt
23f0: 5f 64 65 66 20 2d 73 65 73 73 69 6f 6e 5f 69 64  _def -session_id
2400: 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72   [arg binary_str
2410: 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ing]].Specifies 
2420: 74 68 65 20 73 65 73 73 69 6f 6e 20 69 64 20 74  the session id t
2430: 6f 20 72 65 73 75 6d 65 20 61 20 73 65 73 73 69  o resume a sessi
2440: 6f 6e 2e 20 4e 6f 74 20 73 75 70 70 6f 72 74 65  on. Not supporte
2450: 64 20 79 65 74 2e 0a 54 68 69 73 20 6f 70 74 69  d yet..This opti
2460: 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  on is new for Tc
2470: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f  lTLS 1.8...[opt_
2480: 64 65 66 20 2d 73 73 6c 32 20 5b 61 72 67 20 62  def -ssl2 [arg b
2490: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
24a0: 20 6f 66 20 53 53 4c 20 76 32 2e 54 68 65 20 64   of SSL v2.The d
24b0: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74  efault is [const
24c0: 20 66 61 6c 73 65 5d 2e 0a 4f 70 65 6e 53 53 4c   false]..OpenSSL
24d0: 20 31 2e 31 2b 20 6e 6f 20 6c 6f 6e 67 65 72 20   1.1+ no longer 
24e0: 73 75 70 70 6f 72 74 73 20 53 53 4c 20 76 32 2c  supports SSL v2,
24f0: 20 73 6f 20 74 68 69 73 20 6d 61 79 20 6e 6f 74   so this may not
2500: 20 68 61 76 65 20 61 6e 79 20 65 66 66 65 63 74   have any effect
2510: 2e 0a 53 65 65 20 74 68 65 20 5b 63 6d 64 20 74  ..See the [cmd t
2520: 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63  ls::protocols] c
2530: 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70 70 6f  ommand for suppo
2540: 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73 2e 0a  rted protocols..
2550: 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73 6c 33 20  .[opt_def -ssl3 
2560: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62  [arg bool]].Enab
2570: 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20 76 33  le use of SSL v3
2580: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
2590: 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 20   [const false]. 
25a0: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54  Starting in TclT
25b0: 4c 53 20 31 2e 38 2c 0a 75 73 65 20 6f 66 20 53  LS 1.8,.use of S
25c0: 53 4c 20 76 33 20 69 66 20 6f 6e 6c 79 20 61 76  SL v3 if only av
25d0: 61 69 6c 61 62 6c 65 20 76 69 61 20 61 20 63 6f  ailable via a co
25e0: 6d 70 69 6c 65 20 74 69 6d 65 20 6f 70 74 69 6f  mpile time optio
25f0: 6e 2e 0a 53 65 65 20 74 68 65 20 5b 63 6d 64 20  n..See the [cmd 
2600: 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20  tls::protocols] 
2610: 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70 70  command for supp
2620: 6f 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73 2e  orted protocols.
2630: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31  ..[opt_def -tls1
2640: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61   [arg bool]].Ena
2650: 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76  ble use of TLS v
2660: 31 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54  1. Starting in T
2670: 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65 20 64  clTLS 2.0, the d
2680: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74  efault is [const
2690: 20 66 61 6c 73 65 5d 2e 0a 4e 6f 74 65 3a 20 54   false]..Note: T
26a0: 4c 53 20 31 2e 30 20 6e 65 65 64 73 20 53 48 41  LS 1.0 needs SHA
26b0: 31 20 74 6f 20 6f 70 65 72 61 74 65 2c 20 77 68  1 to operate, wh
26c0: 69 63 68 20 69 73 20 6f 6e 6c 79 20 61 76 61 69  ich is only avai
26d0: 6c 61 62 6c 65 20 69 6e 20 73 65 63 75 72 69 74  lable in securit
26e0: 79 20 6c 65 76 65 6c 0a 30 20 66 6f 72 20 4f 70  y level.0 for Op
26f0: 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 20 53 65 65  en SSL 3.0+. See
2700: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 73 65   the [option -se
2710: 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 6f 70  curity_level] op
2720: 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  tion...[opt_def 
2730: 2d 74 6c 73 31 2e 31 20 5b 61 72 67 20 62 6f 6f  -tls1.1 [arg boo
2740: 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f  l]].Enable use o
2750: 66 20 54 4c 53 20 76 31 2e 31 2e 20 53 74 61 72  f TLS v1.1. Star
2760: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ting in TclTLS 2
2770: 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20  .0, the default 
2780: 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d  is [const false]
2790: 2e 0a 4e 6f 74 65 3a 20 54 4c 53 20 31 2e 31 20  ..Note: TLS 1.1 
27a0: 6e 65 65 64 73 20 53 48 41 31 20 74 6f 20 6f 70  needs SHA1 to op
27b0: 65 72 61 74 65 2c 20 77 68 69 63 68 20 69 73 20  erate, which is 
27c0: 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 69  only available i
27d0: 6e 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c  n security level
27e0: 0a 30 20 66 6f 72 20 4f 70 65 6e 20 53 53 4c 20  .0 for Open SSL 
27f0: 33 2e 30 2b 2e 20 53 65 65 20 74 68 65 20 5b 6f  3.0+. See the [o
2800: 70 74 69 6f 6e 20 2d 73 65 63 75 72 69 74 79 5f  ption -security_
2810: 6c 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e 0a 0a  level] option...
2820: 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 2e 32  [opt_def -tls1.2
2830: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61   [arg bool]].Ena
2840: 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76  ble use of TLS v
2850: 31 2e 32 2e 20 54 68 65 20 64 65 66 61 75 6c 74  1.2. The default
2860: 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d   is [const true]
2870: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73  ...[opt_def -tls
2880: 31 2e 33 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a  1.3 [arg bool]].
2890: 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c  Enable use of TL
28a0: 53 20 76 31 2e 33 2e 20 54 68 65 20 64 65 66 61  S v1.3. The defa
28b0: 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72  ult is [const tr
28c0: 75 65 5d 2e 20 54 68 69 73 20 69 73 20 6f 6e 6c  ue]. This is onl
28d0: 79 20 61 76 61 69 6c 61 62 6c 65 0a 73 74 61 72  y available.star
28e0: 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e 53 53  ting with OpenSS
28f0: 4c 20 31 2e 31 2e 31 20 61 6e 64 20 54 63 6c 54  L 1.1.1 and TclT
2900: 4c 53 20 31 2e 37 2e 0a 0a 5b 6f 70 74 5f 64 65  LS 1.7...[opt_de
2910: 66 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61  f -validatecomma
2920: 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62 61 63 6b  nd [arg callback
2930: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
2940: 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d 61 6e   callback comman
2950: 64 20 74 6f 20 69 6e 76 6f 6b 65 20 74 6f 20 76  d to invoke to v
2960: 61 6c 69 64 61 74 65 20 74 68 65 20 70 65 65 72  alidate the peer
2970: 20 63 65 72 74 69 66 69 63 61 74 65 73 0a 61 6e   certificates.an
2980: 64 20 6f 74 68 65 72 20 63 6f 6e 66 69 67 20 69  d other config i
2990: 6e 66 6f 20 64 75 72 69 6e 67 20 74 68 65 20 70  nfo during the p
29a0: 72 6f 74 6f 63 6f 6c 20 6e 65 67 6f 74 69 61 74  rotocol negotiat
29b0: 69 6f 6e 20 70 68 61 73 65 2e 20 54 68 69 73 20  ion phase. This 
29c0: 63 61 6e 20 62 65 20 75 73 65 64 0a 62 79 20 54  can be used.by T
29d0: 43 4c 20 73 63 72 69 70 74 73 20 74 6f 20 70 65  CL scripts to pe
29e0: 72 66 6f 72 6d 20 74 68 65 69 72 20 6f 77 6e 20  rform their own 
29f0: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
2a00: 64 61 74 69 6f 6e 20 74 6f 20 73 75 70 70 6c 65  dation to supple
2a10: 6d 65 6e 74 20 74 68 65 0a 64 65 66 61 75 6c 74  ment the.default
2a20: 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72 6f 76   validation prov
2a30: 69 64 65 64 20 62 79 20 4f 70 65 6e 53 53 4c 2e  ided by OpenSSL.
2a40: 20 54 68 65 20 73 63 72 69 70 74 20 6d 75 73 74   The script must
2a50: 20 72 65 74 75 72 6e 20 61 20 62 6f 6f 6c 65 61   return a boolea
2a60: 6e 20 74 72 75 65 0a 74 6f 20 63 6f 6e 74 69 6e  n true.to contin
2a70: 75 65 20 74 68 65 20 6e 65 67 6f 74 69 61 74 69  ue the negotiati
2a80: 6f 6e 2e 20 53 65 65 20 5b 73 65 63 74 72 65 66  on. See [sectref
2a90: 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74 69 6f   "Callback Optio
2aa0: 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20 69 6e  ns"] for more in
2ab0: 66 6f 2e 0a 54 68 69 73 20 6f 70 74 69 6f 6e 20  fo..This option 
2ac0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
2ad0: 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e  S 1.8...[list_en
2ae0: 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  d]..[call [cmd t
2af0: 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d 20 5b 61  ls::unimport] [a
2b00: 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 43 6f  rg channel]]..Co
2b10: 6d 70 6c 69 6d 65 6e 74 20 74 6f 20 5b 63 6d 64  mpliment to [cmd
2b20: 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e 20 55   tls::import]. U
2b30: 73 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 74 68  sed to remove th
2b40: 65 20 74 6f 70 20 6c 65 76 65 6c 20 73 74 61 63  e top level stac
2b50: 6b 65 64 20 63 68 61 6e 6e 65 6c 0a 66 72 6f 6d  ked channel.from
2b60: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2e 20   [arg channel]. 
2b70: 54 68 69 73 20 75 6e 73 74 61 63 6b 73 20 74 68  This unstacks th
2b80: 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f 66 20  e encryption of 
2b90: 61 20 72 65 67 75 6c 61 72 20 54 43 4c 20 63 68  a regular TCL ch
2ba0: 61 6e 6e 65 6c 2e 20 41 6e 0a 65 72 72 6f 72 20  annel. An.error 
2bb0: 69 73 20 74 68 72 6f 77 6e 20 69 66 20 54 4c 53  is thrown if TLS
2bc0: 20 69 73 20 6e 6f 74 20 74 68 65 20 74 6f 70 20   is not the top 
2bd0: 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 20  stacked channel 
2be0: 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  type...[call [cm
2bf0: 64 20 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65  d tls::handshake
2c00: 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d  ] [arg channel]]
2c10: 0a 0a 46 6f 72 63 65 73 20 74 68 65 20 54 4c 53  ..Forces the TLS
2c20: 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20 68 61 6e   negotiation han
2c30: 64 73 68 61 6b 65 20 74 6f 20 74 61 6b 65 20 70  dshake to take p
2c40: 6c 61 63 65 20 69 6d 6d 65 64 69 61 74 65 6c 79  lace immediately
2c50: 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 30 0a  , and returns 0.
2c60: 69 66 20 68 61 6e 64 73 68 61 6b 65 20 69 73 20  if handshake is 
2c70: 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65 73  still in progres
2c80: 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 29  s (non-blocking)
2c90: 2c 20 6f 72 20 31 20 69 66 20 74 68 65 20 68 61  , or 1 if the ha
2ca0: 6e 64 73 68 61 6b 65 20 77 61 73 0a 73 75 63 63  ndshake was.succ
2cb0: 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65 20 68  essful. If the h
2cc0: 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65 64 2c  andshake failed,
2cd0: 20 61 6e 20 65 72 72 6f 72 20 77 69 6c 6c 20 62   an error will b
2ce0: 65 20 72 65 74 75 72 6e 65 64 2e 0a 0a 5b 63 61  e returned...[ca
2cf0: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 74 61  ll [cmd tls::sta
2d00: 74 75 73 5d 20 5b 6f 70 74 20 5b 6f 70 74 69 6f  tus] [opt [optio
2d10: 6e 20 2d 6c 6f 63 61 6c 5d 5d 20 5b 61 72 67 20  n -local]] [arg 
2d20: 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72  channel]]..Retur
2d30: 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 73  ns the current s
2d40: 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20  tatus of an SSL 
2d50: 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73  channel. The res
2d60: 75 6c 74 20 69 73 20 61 20 6c 69 73 74 20 6f 66  ult is a list of
2d70: 20 6b 65 79 2d 76 61 6c 75 65 0a 70 61 69 72 73   key-value.pairs
2d80: 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20   describing the 
2d90: 53 53 4c 2c 20 63 65 72 74 69 66 69 63 61 74 65  SSL, certificate
2da0: 2c 20 61 6e 64 20 63 65 72 74 69 66 69 63 61 74  , and certificat
2db0: 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 73  e verification s
2dc0: 74 61 74 75 73 2e 20 49 66 0a 74 68 65 20 53 53  tatus. If.the SS
2dd0: 4c 20 68 61 6e 64 73 68 61 6b 65 20 68 61 73 20  L handshake has 
2de0: 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65 74 65  not yet complete
2df0: 64 2c 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 74  d, an empty list
2e00: 20 69 73 20 72 65 74 75 72 6e 65 64 2e 20 49 66   is returned. If
2e10: 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6c 6f   the.[option -lo
2e20: 63 61 6c 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73  cal] option is s
2e30: 70 65 63 69 66 69 65 64 2c 20 74 68 65 6e 20 74  pecified, then t
2e40: 68 65 20 6c 6f 63 61 6c 20 63 65 72 74 69 66 69  he local certifi
2e50: 63 61 74 65 20 69 73 20 75 73 65 64 2e 20 52 65  cate is used. Re
2e60: 74 75 72 6e 65 64 0a 76 61 6c 75 65 73 20 69 6e  turned.values in
2e70: 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a  clude:..[para]..
2e80: 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73  SSL Status..[lis
2e90: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
2ea0: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ons]..[def "[var
2eb0: 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70 72 6f 74   alpn] [arg prot
2ec0: 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70 72 6f 74  ocol]"].The prot
2ed0: 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20 61 66  ocol selected af
2ee0: 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d  ter Application-
2ef0: 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e  Layer Protocol N
2f00: 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e  egotiation (ALPN
2f10: 29 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  )..This value is
2f20: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
2f30: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
2f40: 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69   cipher] [arg ci
2f50: 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72  pher]"].The curr
2f60: 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75 73  ent cipher in us
2f70: 65 20 66 6f 72 20 74 68 65 20 73 65 73 73 69 6f  e for the sessio
2f80: 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70  n...[def "[var p
2f90: 65 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61  eername] [arg na
2fa0: 6d 65 5d 22 5d 0a 54 68 65 20 70 65 65 72 6e 61  me]"].The peerna
2fb0: 6d 65 20 66 72 6f 6d 20 74 68 65 20 63 65 72 74  me from the cert
2fc0: 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61  ificate..This va
2fd0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
2fe0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
2ff0: 20 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d   "[var protocol]
3000: 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d   [arg version]"]
3010: 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65  .The protocol ve
3020: 72 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74  rsion used for t
3030: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53  he connection: S
3040: 53 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c  SL2, SSL3, TLS1,
3050: 20 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c   TLS1.1, TLS1.2,
3060: 0a 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e  .TLS1.3, or unkn
3070: 6f 77 6e 2e 20 54 68 69 73 20 76 61 6c 75 65 20  own. This value 
3080: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3090: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
30a0: 61 72 20 73 62 69 74 73 5d 20 5b 61 72 67 20 6e  ar sbits] [arg n
30b0: 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20 6f  ]"].The number o
30c0: 66 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20  f bits used for 
30d0: 74 68 65 20 73 65 73 73 69 6f 6e 20 6b 65 79 2e  the session key.
30e0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67  ..[def "[var sig
30f0: 6e 61 74 75 72 65 48 61 73 68 41 6c 67 6f 72 69  natureHashAlgori
3100: 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69  thm] [arg algori
3110: 74 68 6d 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61  thm]"].The signa
3120: 74 75 72 65 20 68 61 73 68 20 61 6c 67 6f 72 69  ture hash algori
3130: 74 68 6d 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  thm..This value 
3140: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3150: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3160: 61 72 20 73 69 67 6e 61 74 75 72 65 54 79 70 65  ar signatureType
3170: 5d 20 5b 61 72 67 20 74 79 70 65 5d 22 5d 0a 54  ] [arg type]"].T
3180: 68 65 20 73 69 67 6e 61 74 75 72 65 20 74 79 70  he signature typ
3190: 65 20 76 61 6c 75 65 2e 0a 54 68 69 73 20 76 61  e value..This va
31a0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
31b0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
31c0: 20 22 5b 76 61 72 20 76 65 72 69 66 79 44 65 70   "[var verifyDep
31d0: 74 68 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4d 61  th] [arg n]"].Ma
31e0: 78 69 6d 75 6d 20 64 65 70 74 68 20 66 6f 72 20  ximum depth for 
31f0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
3200: 63 68 61 69 6e 20 76 65 72 69 66 69 63 61 74 69  chain verificati
3210: 6f 6e 2e 20 44 65 66 61 75 6c 74 20 69 73 20 2d  on. Default is -
3220: 31 2c 20 74 6f 20 63 68 65 63 6b 20 61 6c 6c 2e  1, to check all.
3230: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3240: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3250: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76  8...[def "[var v
3260: 65 72 69 66 79 4d 6f 64 65 5d 20 5b 61 72 67 20  erifyMode] [arg 
3270: 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20  list]"].List of 
3280: 63 65 72 74 69 66 69 63 61 74 65 20 76 65 72 69  certificate veri
3290: 66 69 63 61 74 69 6f 6e 20 6d 6f 64 65 73 2e 0a  fication modes..
32a0: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
32b0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
32c0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65  ...[def "[var ve
32d0: 72 69 66 79 52 65 73 75 6c 74 5d 20 5b 61 72 67  rifyResult] [arg
32e0: 20 72 65 73 75 6c 74 5d 22 5d 0a 43 65 72 74 69   result]"].Certi
32f0: 66 69 63 61 74 65 20 76 65 72 69 66 69 63 61 74  ficate verificat
3300: 69 6f 6e 20 72 65 73 75 6c 74 2e 0a 54 68 69 73  ion result..This
3310: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
3320: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
3330: 64 65 66 20 22 5b 76 61 72 20 63 61 5f 6e 61 6d  def "[var ca_nam
3340: 65 73 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d  es] [arg list]"]
3350: 0a 4c 69 73 74 20 6f 66 20 74 68 65 20 43 65 72  .List of the Cer
3360: 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69  tificate Authori
3370: 74 69 65 73 20 75 73 65 64 20 74 6f 20 63 72 65  ties used to cre
3380: 61 74 65 20 74 68 65 20 63 65 72 74 69 66 69 63  ate the certific
3390: 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ate..This value 
33a0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
33b0: 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e  S 1.8...[list_en
33c0: 64 5d 0a 0a 43 65 72 74 69 66 69 63 61 74 65 20  d]..Certificate 
33d0: 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65  Status..[list_be
33e0: 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d  gin definitions]
33f0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 6c  ..[def "[var all
3400: 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d  ] [arg string]"]
3410: 0a 44 75 6d 70 20 6f 66 20 61 6c 6c 20 63 65 72  .Dump of all cer
3420: 74 69 66 69 63 61 74 65 20 69 6e 66 6f 2e 0a 54  tificate info..T
3430: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3440: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3450: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72  ..[def "[var ver
3460: 73 69 6f 6e 5d 20 5b 61 72 67 20 76 61 6c 75 65  sion] [arg value
3470: 5d 22 5d 0a 54 68 65 20 63 65 72 74 69 66 69 63  ]"].The certific
3480: 61 74 65 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64  ate version...[d
3490: 65 66 20 22 5b 76 61 72 20 73 65 72 69 61 6c 4e  ef "[var serialN
34a0: 75 6d 62 65 72 5d 20 5b 61 72 67 20 73 74 72 69  umber] [arg stri
34b0: 6e 67 5d 22 5d 0a 54 68 65 20 73 65 72 69 61 6c  ng]"].The serial
34c0: 20 6e 75 6d 62 65 72 20 6f 66 20 74 68 65 20 63   number of the c
34d0: 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61 20  ertificate as a 
34e0: 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68 69 73  hex string..This
34f0: 20 76 61 6c 75 65 20 77 61 73 20 63 68 61 6e 67   value was chang
3500: 65 64 20 66 72 6f 6d 20 73 65 72 69 61 6c 20 69  ed from serial i
3510: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  n TclTLS 1.8...[
3520: 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74  def "[var signat
3530: 75 72 65 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69  ure] [arg algori
3540: 74 68 6d 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c  thm]"].Cipher al
3550: 67 6f 72 69 74 68 6d 20 75 73 65 64 20 66 6f 72  gorithm used for
3560: 20 63 65 72 74 69 66 69 63 61 74 65 20 73 69 67   certificate sig
3570: 6e 61 74 75 72 65 2e 0a 54 68 69 73 20 76 61 6c  nature..This val
3580: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
3590: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
35a0: 22 5b 76 61 72 20 69 73 73 75 65 72 5d 20 5b 61  "[var issuer] [a
35b0: 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65  rg string]"].The
35c0: 20 64 69 73 74 69 6e 67 75 69 73 68 65 64 20 6e   distinguished n
35d0: 61 6d 65 20 28 44 4e 29 20 6f 66 20 74 68 65 20  ame (DN) of the 
35e0: 63 65 72 74 69 66 69 63 61 74 65 20 69 73 73 75  certificate issu
35f0: 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  er...[def "[var 
3600: 6e 6f 74 42 65 66 6f 72 65 5d 20 5b 61 72 67 20  notBefore] [arg 
3610: 64 61 74 65 5d 22 5d 0a 54 68 65 20 62 65 67 69  date]"].The begi
3620: 6e 6e 69 6e 67 20 64 61 74 65 20 6f 66 20 74 68  nning date of th
3630: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 76 61  e certificate va
3640: 6c 69 64 69 74 79 2e 0a 0a 5b 64 65 66 20 22 5b  lidity...[def "[
3650: 76 61 72 20 6e 6f 74 41 66 74 65 72 5d 20 5b 61  var notAfter] [a
3660: 72 67 20 64 61 74 65 5d 22 5d 0a 54 68 65 20 65  rg date]"].The e
3670: 78 70 69 72 61 74 69 6f 6e 20 64 61 74 65 20 6f  xpiration date o
3680: 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  f the certificat
3690: 65 20 76 61 6c 69 64 69 74 79 2e 0a 0a 5b 64 65  e validity...[de
36a0: 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74 5d  f "[var subject]
36b0: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
36c0: 54 68 65 20 64 69 73 74 69 6e 67 75 69 73 68 65  The distinguishe
36d0: 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66 20 74  d name (DN) of t
36e0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 73  he certificate s
36f0: 75 62 6a 65 63 74 2e 20 46 69 65 6c 64 73 20 69  ubject. Fields i
3700: 6e 63 6c 75 64 65 3a 20 43 6f 6d 6d 6f 6e 0a 4e  nclude: Common.N
3710: 61 6d 65 20 28 43 4e 29 2c 20 4f 72 67 61 6e 69  ame (CN), Organi
3720: 7a 61 74 69 6f 6e 20 28 4f 29 2c 20 4c 6f 63 61  zation (O), Loca
3730: 6c 69 74 79 20 6f 72 20 43 69 74 79 20 28 4c 29  lity or City (L)
3740: 2c 20 53 74 61 74 65 20 6f 72 20 50 72 6f 76 69  , State or Provi
3750: 6e 63 65 20 28 53 29 2c 20 61 6e 64 0a 43 6f 75  nce (S), and.Cou
3760: 6e 74 72 79 20 4e 61 6d 65 20 28 43 29 2e 0a 0a  ntry Name (C)...
3770: 5b 64 65 66 20 22 5b 76 61 72 20 69 73 73 75 65  [def "[var issue
3780: 72 55 6e 69 71 75 65 49 44 5d 20 5b 61 72 67 20  rUniqueID] [arg 
3790: 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20 69 73  string]"].The is
37a0: 73 75 65 72 20 75 6e 69 71 75 65 20 69 64 2e 0a  suer unique id..
37b0: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
37c0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
37d0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 75  ...[def "[var su
37e0: 62 6a 65 63 74 55 6e 69 71 75 65 49 44 5d 20 5b  bjectUniqueID] [
37f0: 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68  arg string]"].Th
3800: 65 20 73 75 62 6a 65 63 74 20 75 6e 69 71 75 65  e subject unique
3810: 20 69 64 2e 0a 54 68 69 73 20 76 61 6c 75 65 20   id..This value 
3820: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3830: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3840: 61 72 20 6e 75 6d 5f 65 78 74 65 6e 73 69 6f 6e  ar num_extension
3850: 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d  s] [arg n]"].Num
3860: 62 65 72 20 6f 66 20 63 65 72 74 69 66 69 63 61  ber of certifica
3870: 74 65 20 65 78 74 65 6e 73 69 6f 6e 73 2e 0a 54  te extensions..T
3880: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3890: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
38a0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65 78 74  ..[def "[var ext
38b0: 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6c 69  ensions] [arg li
38c0: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 63 65  st]"].List of ce
38d0: 72 74 69 66 69 63 61 74 65 20 65 78 74 65 6e 73  rtificate extens
38e0: 69 6f 6e 20 6e 61 6d 65 73 2e 0a 54 68 69 73 20  ion names..This 
38f0: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3900: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
3910: 65 66 20 22 5b 76 61 72 20 61 75 74 68 6f 72 69  ef "[var authori
3920: 74 79 4b 65 79 49 64 65 6e 74 69 66 69 65 72 5d  tyKeyIdentifier]
3930: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3940: 41 75 74 68 6f 72 69 74 79 20 4b 65 79 20 49 64  Authority Key Id
3950: 65 6e 74 69 66 69 65 72 20 28 41 4b 49 29 20 6f  entifier (AKI) o
3960: 66 20 74 68 65 20 49 73 73 75 69 6e 67 20 43 41  f the Issuing CA
3970: 20 63 65 72 74 69 66 69 63 61 74 65 20 74 68 61   certificate tha
3980: 74 20 73 69 67 6e 65 64 20 74 68 65 0a 53 53 4c  t signed the.SSL
3990: 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73 20   certificate as 
39a0: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 20 54 68  a hex string. Th
39b0: 69 73 20 76 61 6c 75 65 20 6d 61 74 63 68 65 73  is value matches
39c0: 20 74 68 65 20 53 4b 49 20 76 61 6c 75 65 20 6f   the SKI value o
39d0: 66 20 74 68 65 0a 49 6e 74 65 72 6d 65 64 69 61  f the.Intermedia
39e0: 74 65 20 43 41 20 63 65 72 74 69 66 69 63 61 74  te CA certificat
39f0: 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  e..This value is
3a00: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
3a10: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
3a20: 20 73 75 62 6a 65 63 74 4b 65 79 49 64 65 6e 74   subjectKeyIdent
3a30: 69 66 69 65 72 5d 20 5b 61 72 67 20 73 74 72 69  ifier] [arg stri
3a40: 6e 67 5d 22 5d 0a 53 75 62 6a 65 63 74 20 4b 65  ng]"].Subject Ke
3a50: 79 20 49 64 65 6e 74 69 66 69 65 72 20 28 53 4b  y Identifier (SK
3a60: 49 29 20 68 61 73 68 20 6f 66 20 74 68 65 20 70  I) hash of the p
3a70: 75 62 6c 69 63 20 6b 65 79 20 69 6e 73 69 64 65  ublic key inside
3a80: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
3a90: 20 61 73 20 61 0a 68 65 78 20 73 74 72 69 6e 67   as a.hex string
3aa0: 2e 20 55 73 65 64 20 74 6f 20 69 64 65 6e 74 69  . Used to identi
3ab0: 66 79 20 63 65 72 74 69 66 69 63 61 74 65 73 20  fy certificates 
3ac0: 74 68 61 74 20 63 6f 6e 74 61 69 6e 20 61 20 70  that contain a p
3ad0: 61 72 74 69 63 75 6c 61 72 20 70 75 62 6c 69 63  articular public
3ae0: 20 6b 65 79 2e 0a 54 68 69 73 20 76 61 6c 75 65   key..This value
3af0: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
3b00: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
3b10: 76 61 72 20 73 75 62 6a 65 63 74 41 6c 74 4e 61  var subjectAltNa
3b20: 6d 65 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d  me] [arg list]"]
3b30: 0a 4c 69 73 74 20 6f 66 20 61 6c 6c 20 6f 66 20  .List of all of 
3b40: 74 68 65 20 53 75 62 6a 65 63 74 20 41 6c 74 65  the Subject Alte
3b50: 72 6e 61 74 69 76 65 20 4e 61 6d 65 73 20 28 53  rnative Names (S
3b60: 41 4e 29 20 69 6e 63 6c 75 64 69 6e 67 20 64 6f  AN) including do
3b70: 6d 61 69 6e 20 6e 61 6d 65 73 2c 20 73 75 62 0a  main names, sub.
3b80: 64 6f 6d 61 69 6e 73 2c 20 61 6e 64 20 49 50 20  domains, and IP 
3b90: 61 64 64 72 65 73 73 65 73 20 74 68 61 74 20 61  addresses that a
3ba0: 72 65 20 73 65 63 75 72 65 64 20 62 79 20 74 68  re secured by th
3bb0: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54  e certificate..T
3bc0: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3bd0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3be0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6f 63 73  ..[def "[var ocs
3bf0: 70 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a  p] [arg list]"].
3c00: 4c 69 73 74 20 6f 66 20 61 6c 6c 20 4f 6e 6c 69  List of all Onli
3c10: 6e 65 20 43 65 72 74 69 66 69 63 61 74 65 20 53  ne Certificate S
3c20: 74 61 74 75 73 20 50 72 6f 74 6f 63 6f 6c 20 28  tatus Protocol (
3c30: 4f 43 53 50 29 20 55 52 4c 73 20 74 68 61 74 20  OCSP) URLs that 
3c40: 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 0a 63  can be used to.c
3c50: 68 65 63 6b 20 74 68 65 20 76 61 6c 69 64 69 74  heck the validit
3c60: 79 20 6f 66 20 74 68 69 73 20 63 65 72 74 69 66  y of this certif
3c70: 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75  icate..This valu
3c80: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3c90: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3ca0: 5b 76 61 72 20 63 65 72 74 69 66 69 63 61 74 65  [var certificate
3cb0: 5d 20 5b 61 72 67 20 63 65 72 74 5d 22 5d 0a 54  ] [arg cert]"].T
3cc0: 68 65 20 50 45 4d 20 65 6e 63 6f 64 65 64 20 63  he PEM encoded c
3cd0: 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65  ertificate...[de
3ce0: 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72  f "[var signatur
3cf0: 65 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67  eAlgorithm] [arg
3d00: 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 69   algorithm]"].Ci
3d10: 70 68 65 72 20 61 6c 67 6f 72 69 74 68 6d 20 75  pher algorithm u
3d20: 73 65 64 20 66 6f 72 20 74 68 65 20 63 65 72 74  sed for the cert
3d30: 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72  ificate signatur
3d40: 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  e..This value is
3d50: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
3d60: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
3d70: 20 73 69 67 6e 61 74 75 72 65 56 61 6c 75 65 5d   signatureValue]
3d80: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3d90: 43 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e  Certificate sign
3da0: 61 74 75 72 65 20 61 73 20 61 20 68 65 78 20 73  ature as a hex s
3db0: 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75  tring..This valu
3dc0: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3dd0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3de0: 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65 44 69  [var signatureDi
3df0: 67 65 73 74 5d 20 5b 61 72 67 20 76 65 72 73 69  gest] [arg versi
3e00: 6f 6e 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74  on]"].Certificat
3e10: 65 20 73 69 67 6e 69 6e 67 20 64 69 67 65 73 74  e signing digest
3e20: 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67   as a hex string
3e30: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
3e40: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
3e50: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
3e60: 70 75 62 6c 69 63 4b 65 79 41 6c 67 6f 72 69 74  publicKeyAlgorit
3e70: 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74  hm] [arg algorit
3e80: 68 6d 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74  hm]"].Certificat
3e90: 65 20 73 69 67 6e 61 74 75 72 65 20 70 75 62 6c  e signature publ
3ea0: 69 63 20 6b 65 79 20 61 6c 67 6f 72 69 74 68 6d  ic key algorithm
3eb0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
3ec0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
3ed0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
3ee0: 70 75 62 6c 69 63 4b 65 79 5d 20 5b 61 72 67 20  publicKey] [arg 
3ef0: 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66  string]"].Certif
3f00: 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20  icate signature 
3f10: 70 75 62 6c 69 63 20 6b 65 79 20 61 73 20 61 20  public key as a 
3f20: 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68 69 73  hex string..This
3f30: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
3f40: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
3f50: 64 65 66 20 22 5b 76 61 72 20 62 69 74 73 5d 20  def "[var bits] 
3f60: 5b 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65 72  [arg n]"].Number
3f70: 20 6f 66 20 62 69 74 73 20 75 73 65 64 20 66 6f   of bits used fo
3f80: 72 20 63 65 72 74 69 66 69 63 61 74 65 20 73 69  r certificate si
3f90: 67 6e 61 74 75 72 65 20 6b 65 79 2e 0a 54 68 69  gnature key..Thi
3fa0: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3fb0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3fc0: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 6c 66 5f  [def "[var self_
3fd0: 73 69 67 6e 65 64 5d 20 5b 61 72 67 20 62 6f 6f  signed] [arg boo
3fe0: 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20  lean]"].Whether 
3ff0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
4000: 73 69 67 6e 61 74 75 72 65 20 69 73 20 73 65 6c  signature is sel
4010: 66 20 73 69 67 6e 65 64 2e 0a 54 68 69 73 20 76  f signed..This v
4020: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20  alue is new for 
4030: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65  TclTLS 1.8...[de
4040: 66 20 22 5b 76 61 72 20 73 68 61 31 5f 68 61 73  f "[var sha1_has
4050: 68 5d 20 5b 61 72 67 20 68 61 73 68 5d 22 5d 0a  h] [arg hash]"].
4060: 54 68 65 20 53 48 41 31 20 68 61 73 68 20 6f 66  The SHA1 hash of
4070: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
4080: 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67   as a hex string
4090: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
40a0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
40b0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
40c0: 73 68 61 32 35 36 5f 68 61 73 68 5d 20 5b 61 72  sha256_hash] [ar
40d0: 67 20 68 61 73 68 5d 22 5d 0a 54 68 65 20 53 48  g hash]"].The SH
40e0: 41 32 35 36 20 68 61 73 68 20 6f 66 20 74 68 65  A256 hash of the
40f0: 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73 20   certificate as 
4100: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68  a hex string..Th
4110: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
4120: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
4130: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61  .[list_end]..[ca
4140: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 6f 6e  ll [cmd tls::con
4150: 6e 65 63 74 69 6f 6e 5d 20 5b 61 72 67 20 63 68  nection] [arg ch
4160: 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72 6e 73  annel]]..Returns
4170: 20 74 68 65 20 63 75 72 72 65 6e 74 20 63 6f 6e   the current con
4180: 6e 65 63 74 69 6f 6e 20 73 74 61 74 75 73 20 6f  nection status o
4190: 66 20 61 6e 20 53 53 4c 20 63 68 61 6e 6e 65 6c  f an SSL channel
41a0: 2e 20 54 68 65 20 72 65 73 75 6c 74 20 69 73 20  . The result is 
41b0: 61 20 6c 69 73 74 0a 6f 66 20 6b 65 79 2d 76 61  a list.of key-va
41c0: 6c 75 65 20 70 61 69 72 73 20 64 65 73 63 72 69  lue pairs descri
41d0: 62 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65 63 74  bing the connect
41e0: 69 6f 6e 2e 0a 54 68 69 73 20 63 6f 6d 6d 61 6e  ion..This comman
41f0: 64 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  d is new for Tcl
4200: 54 4c 53 20 31 2e 38 2e 20 52 65 74 75 72 6e 65  TLS 1.8. Returne
4210: 64 20 76 61 6c 75 65 73 20 69 6e 63 6c 75 64 65  d values include
4220: 3a 0a 0a 5b 70 61 72 61 5d 0a 0a 53 53 4c 20 53  :..[para]..SSL S
4230: 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65 67  tatus..[list_beg
4240: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
4250: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74 61 74  .[def "[var stat
4260: 65 5d 20 5b 61 72 67 20 73 74 61 74 65 5d 22 5d  e] [arg state]"]
4270: 0a 53 74 61 74 65 20 6f 66 20 74 68 65 20 63 6f  .State of the co
4280: 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20  nnection...[def 
4290: 22 5b 76 61 72 20 73 65 72 76 65 72 6e 61 6d 65  "[var servername
42a0: 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54  ] [arg name]"].T
42b0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63  he name of the c
42c0: 6f 6e 6e 65 63 74 65 64 20 74 6f 20 73 65 72 76  onnected to serv
42d0: 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  er...[def "[var 
42e0: 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72 67 20 76  protocol] [arg v
42f0: 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 70 72  ersion]"].The pr
4300: 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 20 75  otocol version u
4310: 73 65 64 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e  sed for the conn
4320: 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c 20 53 53  ection: SSL2, SS
4330: 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53 31 2e 31  L3, TLS1, TLS1.1
4340: 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53 31 2e 33  , TLS1.2, TLS1.3
4350: 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 0a 0a 5b  , or unknown...[
4360: 64 65 66 20 22 5b 76 61 72 20 72 65 6e 65 67 6f  def "[var renego
4370: 74 69 61 74 69 6f 6e 5f 61 6c 6c 6f 77 65 64 5d  tiation_allowed]
4380: 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d   [arg boolean]"]
4390: 0a 57 68 65 74 68 65 72 20 70 72 6f 74 6f 63 6f  .Whether protoco
43a0: 6c 20 72 65 6e 65 67 6f 74 69 61 74 69 6f 6e 20  l renegotiation 
43b0: 69 73 20 73 75 70 70 6f 72 74 65 64 20 6f 72 20  is supported or 
43c0: 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  not...[def "[var
43d0: 20 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d   security_level]
43e0: 20 5b 61 72 67 20 6c 65 76 65 6c 5d 22 5d 0a 54   [arg level]"].T
43f0: 68 65 20 73 65 63 75 72 69 74 79 20 6c 65 76 65  he security leve
4400: 6c 20 75 73 65 64 20 66 6f 72 20 73 65 6c 65 63  l used for selec
4410: 74 69 6f 6e 20 6f 66 20 63 69 70 68 65 72 73 2c  tion of ciphers,
4420: 20 6b 65 79 20 73 69 7a 65 2c 20 65 74 63 2e 0a   key size, etc..
4430: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 73  .[def "[var sess
4440: 69 6f 6e 5f 72 65 75 73 65 64 5d 20 5b 61 72 67  ion_reused] [arg
4450: 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74   boolean]"].Whet
4460: 68 65 72 20 74 68 65 20 73 65 73 73 69 6f 6e 20  her the session 
4470: 68 61 73 20 62 65 65 6e 20 72 65 75 73 65 64 20  has been reused 
4480: 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b  or not...[def "[
4490: 76 61 72 20 69 73 5f 73 65 72 76 65 72 5d 20 5b  var is_server] [
44a0: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57  arg boolean]"].W
44b0: 68 65 74 68 65 72 20 74 68 65 20 63 6f 6e 6e 65  hether the conne
44c0: 63 74 69 6f 6e 20 69 73 20 63 6f 6e 66 69 67 75  ction is configu
44d0: 72 65 64 20 61 73 20 61 20 73 65 72 76 65 72 20  red as a server 
44e0: 28 31 29 20 6f 72 20 63 6c 69 65 6e 74 20 28 30  (1) or client (0
44f0: 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  )...[def "[var c
4500: 6f 6d 70 72 65 73 73 69 6f 6e 5d 20 5b 61 72 67  ompression] [arg
4510: 20 6d 6f 64 65 5d 22 5d 0a 43 6f 6d 70 72 65 73   mode]"].Compres
4520: 73 69 6f 6e 20 6d 65 74 68 6f 64 2e 0a 0a 5b 64  sion method...[d
4530: 65 66 20 22 5b 76 61 72 20 65 78 70 61 6e 73 69  ef "[var expansi
4540: 6f 6e 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d  on] [arg mode]"]
4550: 0a 45 78 70 61 6e 73 69 6f 6e 20 6d 65 74 68 6f  .Expansion metho
4560: 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  d...[def "[var c
4570: 61 4c 69 73 74 5d 20 5b 61 72 67 20 6c 69 73 74  aList] [arg list
4580: 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 43 65 72 74  ]"].List of Cert
4590: 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74  ificate Authorit
45a0: 69 65 73 20 28 43 41 29 20 66 6f 72 20 58 2e 35  ies (CA) for X.5
45b0: 30 39 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a  09 certificate..
45c0: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43 69 70  .[list_end]..Cip
45d0: 68 65 72 20 49 6e 66 6f 0a 0a 5b 6c 69 73 74 5f  her Info..[list_
45e0: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
45f0: 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  s]..[def "[var c
4600: 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69 70 68  ipher] [arg ciph
4610: 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72 65 6e  er]"].The curren
4620: 74 20 63 69 70 68 65 72 20 69 6e 20 75 73 65 20  t cipher in use 
4630: 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69  for the connecti
4640: 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  on...[def "[var 
4650: 73 74 61 6e 64 61 72 64 5f 6e 61 6d 65 5d 20 5b  standard_name] [
4660: 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 65 20  arg name]"].The 
4670: 73 74 61 6e 64 61 72 64 20 52 46 43 20 6e 61 6d  standard RFC nam
4680: 65 20 6f 66 20 63 69 70 68 65 72 2e 0a 0a 5b 64  e of cipher...[d
4690: 65 66 20 22 5b 76 61 72 20 61 6c 67 6f 72 69 74  ef "[var algorit
46a0: 68 6d 5f 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d  hm_bits] [arg n]
46b0: 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20 6f 66  "].The number of
46c0: 20 70 72 6f 63 65 73 73 65 64 20 62 69 74 73 20   processed bits 
46d0: 75 73 65 64 20 66 6f 72 20 63 69 70 68 65 72 2e  used for cipher.
46e0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 63  ..[def "[var sec
46f0: 72 65 74 5f 62 69 74 73 5d 20 5b 61 72 67 20 6e  ret_bits] [arg n
4700: 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20 6f  ]"].The number o
4710: 66 20 73 65 63 72 65 74 20 62 69 74 73 20 75 73  f secret bits us
4720: 65 64 20 66 6f 72 20 63 69 70 68 65 72 2e 0a 0a  ed for cipher...
4730: 5b 64 65 66 20 22 5b 76 61 72 20 6d 69 6e 5f 76  [def "[var min_v
4740: 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20 76 65 72  ersion] [arg ver
4750: 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 6d 69 6e 69  sion]"].The mini
4760: 6d 75 6d 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72  mum protocol ver
4770: 73 69 6f 6e 20 66 6f 72 20 63 69 70 68 65 72 2e  sion for cipher.
4780: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 69 70  ..[def "[var cip
4790: 68 65 72 5f 69 73 5f 61 65 61 64 5d 20 5b 61 72  her_is_aead] [ar
47a0: 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65  g boolean]"].Whe
47b0: 74 68 65 72 20 74 68 65 20 63 69 70 68 65 72 20  ther the cipher 
47c0: 69 73 20 41 75 74 68 65 6e 74 69 63 61 74 65 64  is Authenticated
47d0: 20 45 6e 63 72 79 70 74 69 6f 6e 20 77 69 74 68   Encryption with
47e0: 20 41 73 73 6f 63 69 61 74 65 64 20 44 61 74 61   Associated Data
47f0: 20 28 41 45 41 44 29 2e 0a 0a 5b 64 65 66 20 22   (AEAD)...[def "
4800: 5b 76 61 72 20 63 69 70 68 65 72 5f 69 64 5d 20  [var cipher_id] 
4810: 5b 61 72 67 20 69 64 5d 22 5d 0a 54 68 65 20 4f  [arg id]"].The O
4820: 70 65 6e 53 53 4c 20 63 69 70 68 65 72 20 69 64  penSSL cipher id
4830: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 64 65  ...[def "[var de
4840: 73 63 72 69 70 74 69 6f 6e 5d 20 5b 61 72 67 20  scription] [arg 
4850: 73 74 72 69 6e 67 5d 22 5d 0a 41 20 74 65 78 74  string]"].A text
4860: 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20   description of 
4870: 74 68 65 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65  the cipher...[de
4880: 66 20 22 5b 76 61 72 20 68 61 6e 64 73 68 61 6b  f "[var handshak
4890: 65 5f 64 69 67 65 73 74 5d 20 5b 61 72 67 20 62  e_digest] [arg b
48a0: 6f 6f 6c 65 61 6e 5d 22 5d 0a 44 69 67 65 73 74  oolean]"].Digest
48b0: 20 75 73 65 64 20 64 75 72 69 6e 67 20 68 61 6e   used during han
48c0: 64 73 68 61 6b 65 2e 0a 0a 5b 6c 69 73 74 5f 65  dshake...[list_e
48d0: 6e 64 5d 0a 0a 53 65 73 73 69 6f 6e 20 49 6e 66  nd]..Session Inf
48e0: 6f 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64  o..[list_begin d
48f0: 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65  efinitions]..[de
4900: 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20 5b 61  f "[var alpn] [a
4910: 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d 0a 54  rg protocol]"].T
4920: 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65 6c 65  he protocol sele
4930: 63 74 65 64 20 61 66 74 65 72 20 41 70 70 6c 69  cted after Appli
4940: 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f  cation-Layer Pro
4950: 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f  tocol Negotiatio
4960: 6e 20 28 41 4c 50 4e 29 2e 0a 0a 5b 64 65 66 20  n (ALPN)...[def 
4970: 22 5b 76 61 72 20 72 65 73 75 6d 61 62 6c 65 5d  "[var resumable]
4980: 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d   [arg boolean]"]
4990: 0a 57 68 65 74 68 65 72 20 74 68 65 20 73 65 73  .Whether the ses
49a0: 73 69 6f 6e 20 63 61 6e 20 62 65 20 72 65 73 75  sion can be resu
49b0: 6d 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65  med or not...[de
49c0: 66 20 22 5b 76 61 72 20 73 74 61 72 74 5f 74 69  f "[var start_ti
49d0: 6d 65 5d 20 5b 61 72 67 20 73 65 63 6f 6e 64 73  me] [arg seconds
49e0: 5d 22 5d 0a 54 69 6d 65 20 73 69 6e 63 65 20 73  ]"].Time since s
49f0: 65 73 73 69 6f 6e 20 73 74 61 72 74 65 64 20 69  ession started i
4a00: 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e 63 65 20  n seconds since 
4a10: 65 70 6f 63 68 2e 0a 0a 5b 64 65 66 20 22 5b 76  epoch...[def "[v
4a20: 61 72 20 74 69 6d 65 6f 75 74 5d 20 5b 61 72 67  ar timeout] [arg
4a30: 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 4d 61 78 20   seconds]"].Max 
4a40: 64 75 72 61 74 69 6f 6e 20 6f 66 20 73 65 73 73  duration of sess
4a50: 69 6f 6e 20 69 6e 20 73 65 63 6f 6e 64 73 20 62  ion in seconds b
4a60: 65 66 6f 72 65 20 74 69 6d 65 2d 6f 75 74 2e 0a  efore time-out..
4a70: 0a 5b 64 65 66 20 22 5b 76 61 72 20 6c 69 66 65  .[def "[var life
4a80: 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63 6f 6e  time] [arg secon
4a90: 64 73 5d 22 5d 0a 53 65 73 73 69 6f 6e 20 74 69  ds]"].Session ti
4aa0: 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 20 68 69  cket lifetime hi
4ab0: 6e 74 20 69 6e 20 73 65 63 6f 6e 64 73 2e 0a 0a  nt in seconds...
4ac0: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 73 69  [def "[var sessi
4ad0: 6f 6e 5f 69 64 5d 20 5b 61 72 67 20 62 69 6e 61  on_id] [arg bina
4ae0: 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e 69  ry_string]"].Uni
4af0: 71 75 65 20 73 65 73 73 69 6f 6e 20 69 64 20 66  que session id f
4b00: 6f 72 20 75 73 65 20 69 6e 20 72 65 73 75 6d 69  or use in resumi
4b10: 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e 2e 0a  ng the session..
4b20: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 73  .[def "[var sess
4b30: 69 6f 6e 5f 74 69 63 6b 65 74 5d 20 5b 61 72 67  ion_ticket] [arg
4b40: 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22   binary_string]"
4b50: 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e  ].Unique session
4b60: 20 74 69 63 6b 65 74 20 66 6f 72 20 75 73 65 20   ticket for use 
4b70: 69 6e 20 72 65 73 75 6d 69 6e 67 20 74 68 65 20  in resuming the 
4b80: 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22  session...[def "
4b90: 5b 76 61 72 20 74 69 63 6b 65 74 5f 61 70 70 5f  [var ticket_app_
4ba0: 64 61 74 61 5d 20 5b 61 72 67 20 62 69 6e 61 72  data] [arg binar
4bb0: 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e 69 71  y_string]"].Uniq
4bc0: 75 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65  ue session ticke
4bd0: 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 61  t application da
4be0: 74 61 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ta...[def "[var 
4bf0: 6d 61 73 74 65 72 5f 6b 65 79 5d 20 5b 61 72 67  master_key] [arg
4c00: 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22   binary_string]"
4c10: 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e  ].Unique session
4c20: 20 6d 61 73 74 65 72 20 6b 65 79 2e 0a 0a 5b 64   master key...[d
4c30: 65 66 20 22 5b 76 61 72 20 73 65 73 73 69 6f 6e  ef "[var session
4c40: 5f 63 61 63 68 65 5f 6d 6f 64 65 5d 20 5b 61 72  _cache_mode] [ar
4c50: 67 20 6d 6f 64 65 5d 22 5d 0a 53 65 72 76 65 72  g mode]"].Server
4c60: 20 63 61 63 68 65 20 6d 6f 64 65 20 28 63 6c 69   cache mode (cli
4c70: 65 6e 74 2c 20 73 65 72 76 65 72 2c 20 6f 72 20  ent, server, or 
4c80: 62 6f 74 68 29 2e 0a 0a 5b 6c 69 73 74 5f 65 6e  both)...[list_en
4c90: 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  d]..[call [cmd t
4ca0: 6c 73 3a 3a 63 69 70 68 65 72 73 5d 20 5b 6f 70  ls::ciphers] [op
4cb0: 74 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d  t [arg protocol]
4cc0: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 65 72 62  ] [opt [arg verb
4cd0: 6f 73 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  ose]] [opt [arg 
4ce0: 73 75 70 70 6f 72 74 65 64 5d 5d 5d 0a 0a 57 69  supported]]]..Wi
4cf0: 74 68 6f 75 74 20 61 6e 79 20 6f 70 74 69 6f 6e  thout any option
4d00: 73 2c 20 69 74 20 72 65 74 75 72 6e 73 20 61 20  s, it returns a 
4d10: 6c 69 73 74 20 6f 66 20 61 6c 6c 20 73 79 6d 6d  list of all symm
4d20: 65 74 72 69 63 20 63 69 70 68 65 72 73 20 66 6f  etric ciphers fo
4d30: 72 20 75 73 65 20 77 69 74 68 20 74 68 65 0a 5b  r use with the.[
4d40: 61 72 67 20 2d 63 69 70 68 65 72 5d 20 6f 70 74  arg -cipher] opt
4d50: 69 6f 6e 2e 20 57 69 74 68 20 5b 61 72 67 20 70  ion. With [arg p
4d60: 72 6f 74 6f 63 6f 6c 5d 2c 20 6f 6e 6c 79 20 74  rotocol], only t
4d70: 68 65 20 63 69 70 68 65 72 73 20 73 75 70 70 6f  he ciphers suppo
4d80: 72 74 65 64 20 66 6f 72 20 74 68 61 74 0a 70 72  rted for that.pr
4d90: 6f 74 6f 63 6f 6c 20 61 72 65 20 72 65 74 75 72  otocol are retur
4da0: 6e 65 64 2e 20 53 65 65 20 74 68 65 20 5b 63 6d  ned. See the [cm
4db0: 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73  d tls::protocols
4dc0: 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 74 68  ] command for th
4dd0: 65 20 73 75 70 70 6f 72 74 65 64 0a 70 72 6f 74  e supported.prot
4de0: 6f 63 6f 6c 73 2e 20 49 66 20 5b 61 72 67 20 76  ocols. If [arg v
4df0: 65 72 62 6f 73 65 5d 20 69 73 20 73 70 65 63 69  erbose] is speci
4e00: 66 69 65 64 20 61 73 20 74 72 75 65 20 74 68 65  fied as true the
4e10: 6e 20 61 20 76 65 72 62 6f 73 65 2c 20 68 75 6d  n a verbose, hum
4e20: 61 6e 20 72 65 61 64 61 62 6c 65 0a 6c 69 73 74  an readable.list
4e30: 20 69 73 20 72 65 74 75 72 6e 65 64 20 77 69 74   is returned wit
4e40: 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 69 6e 66  h additional inf
4e50: 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20  ormation on the 
4e60: 63 69 70 68 65 72 2e 20 49 66 20 5b 61 72 67 20  cipher. If [arg 
4e70: 73 75 70 70 6f 72 74 65 64 5d 0a 69 73 20 73 70  supported].is sp
4e80: 65 63 69 66 69 65 64 20 61 73 20 74 72 75 65 2c  ecified as true,
4e90: 20 74 68 65 6e 20 6f 6e 6c 79 20 74 68 65 20 63   then only the c
4ea0: 69 70 68 65 72 73 20 73 75 70 70 6f 72 74 65 64  iphers supported
4eb0: 20 66 6f 72 20 70 72 6f 74 6f 63 6f 6c 20 77 69   for protocol wi
4ec0: 6c 6c 20 62 65 20 6c 69 73 74 65 64 2e 0a 54 68  ll be listed..Th
4ed0: 65 20 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64  e [arg supported
4ee0: 5d 20 61 72 67 20 69 73 20 6e 65 77 20 66 6f 72  ] arg is new for
4ef0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 63   TclTLS 1.8...[c
4f00: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72  all [cmd tls::pr
4f10: 6f 74 6f 63 6f 6c 73 5d 5d 0a 0a 52 65 74 75 72  otocols]]..Retur
4f20: 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65  ns a list of the
4f30: 20 73 75 70 70 6f 72 74 65 64 20 53 53 4c 2f 54   supported SSL/T
4f40: 4c 53 20 70 72 6f 74 6f 63 6f 6c 73 2e 20 56 61  LS protocols. Va
4f50: 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65 3a 0a  lid values are:.
4f60: 5b 63 6f 6e 73 74 20 73 73 6c 32 5d 2c 20 5b 63  [const ssl2], [c
4f70: 6f 6e 73 74 20 73 73 6c 33 5d 2c 20 5b 63 6f 6e  onst ssl3], [con
4f80: 73 74 20 74 6c 73 31 5d 2c 20 5b 63 6f 6e 73 74  st tls1], [const
4f90: 20 74 6c 73 31 2e 31 5d 2c 20 5b 63 6f 6e 73 74   tls1.1], [const
4fa0: 20 74 6c 73 31 2e 32 5d 2c 20 61 6e 64 0a 5b 63   tls1.2], and.[c
4fb0: 6f 6e 73 74 20 74 6c 73 31 2e 33 5d 2e 20 45 78  onst tls1.3]. Ex
4fc0: 61 63 74 20 6c 69 73 74 20 64 65 70 65 6e 64 73  act list depends
4fd0: 20 6f 6e 20 4f 70 65 6e 53 53 4c 20 76 65 72 73   on OpenSSL vers
4fe0: 69 6f 6e 20 61 6e 64 20 63 6f 6d 70 69 6c 65 20  ion and compile 
4ff0: 74 69 6d 65 20 66 6c 61 67 73 2e 0a 54 68 69 73  time flags..This
5000: 20 63 6f 6d 6d 61 6e 64 20 69 73 20 6e 65 77 20   command is new 
5010: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
5020: 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a  .[call [cmd tls:
5030: 3a 76 65 72 73 69 6f 6e 5d 5d 0a 0a 52 65 74 75  :version]]..Retu
5040: 72 6e 73 20 74 68 65 20 4f 70 65 6e 53 53 4c 20  rns the OpenSSL 
5050: 76 65 72 73 69 6f 6e 20 73 74 72 69 6e 67 2e 0a  version string..
5060: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 0a 5b 73  .[list_end]...[s
5070: 65 63 74 69 6f 6e 20 22 43 65 72 74 69 66 69 63  ection "Certific
5080: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d  ate Validation"]
5090: 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 50  ..[subsection "P
50a0: 4b 49 20 61 6e 64 20 43 65 72 74 69 66 69 63 61  KI and Certifica
50b0: 74 65 73 22 5d 0a 0a 55 73 69 6e 67 20 74 68 65  tes"]..Using the
50c0: 20 50 75 62 6c 69 63 20 4b 65 79 20 49 6e 66 72   Public Key Infr
50d0: 61 73 74 72 75 63 74 75 72 65 20 28 50 4b 49 29  astructure (PKI)
50e0: 2c 20 65 61 63 68 20 75 73 65 72 20 63 72 65 61  , each user crea
50f0: 74 65 73 20 61 20 70 72 69 76 61 74 65 20 6b 65  tes a private ke
5100: 79 20 74 68 61 74 0a 6f 6e 6c 79 20 74 68 65 79  y that.only they
5110: 20 6b 6e 6f 77 20 61 62 6f 75 74 20 61 6e 64 20   know about and 
5120: 61 20 70 75 62 6c 69 63 20 6b 65 79 20 74 68 65  a public key the
5130: 79 20 63 61 6e 20 65 78 63 68 61 6e 67 65 20 77  y can exchange w
5140: 69 74 68 20 6f 74 68 65 72 73 20 66 6f 72 20 75  ith others for u
5150: 73 65 20 69 6e 0a 65 6e 63 72 79 70 74 69 6e 67  se in.encrypting
5160: 20 61 6e 64 20 64 65 63 72 79 70 74 69 6e 67 20   and decrypting 
5170: 64 61 74 61 2e 20 54 68 65 20 70 72 6f 63 65 73  data. The proces
5180: 73 20 69 73 20 74 68 65 20 73 65 6e 64 65 72 20  s is the sender 
5190: 65 6e 63 72 79 70 74 73 20 74 68 65 69 72 20 64  encrypts their d
51a0: 61 74 61 0a 75 73 69 6e 67 20 74 68 65 69 72 20  ata.using their 
51b0: 70 72 69 76 61 74 65 20 6b 65 79 20 61 6e 64 20  private key and 
51c0: 74 68 65 20 72 65 63 65 69 76 65 72 27 73 20 70  the receiver's p
51d0: 75 62 6c 69 63 20 6b 65 79 2e 20 54 68 65 20 64  ublic key. The d
51e0: 61 74 61 20 69 73 20 74 68 65 6e 20 73 65 6e 74  ata is then sent
51f0: 0a 74 6f 20 74 68 65 20 72 65 63 65 69 76 65 72  .to the receiver
5200: 2e 20 49 6e 20 61 20 73 69 6d 69 6c 61 72 20 6d  . In a similar m
5210: 61 6e 6e 65 72 2c 20 74 68 65 20 72 65 63 65 69  anner, the recei
5220: 76 65 72 20 75 73 65 73 20 74 68 65 69 72 20 70  ver uses their p
5230: 72 69 76 61 74 65 20 6b 65 79 20 61 6e 64 0a 74  rivate key and.t
5240: 68 65 20 73 65 6e 64 65 72 27 73 20 70 75 62 6c  he sender's publ
5250: 69 63 20 6b 65 79 20 74 6f 20 64 65 63 72 79 70  ic key to decryp
5260: 74 20 74 68 65 20 64 61 74 61 2e 20 54 68 69 73  t the data. This
5270: 20 70 72 6f 76 69 64 65 73 20 64 61 74 61 20 69   provides data i
5280: 6e 74 65 67 72 69 74 79 2c 20 74 6f 0a 65 6e 73  ntegrity, to.ens
5290: 75 72 65 20 74 68 65 20 64 61 74 61 20 63 61 6e  ure the data can
52a0: 27 74 20 62 65 20 76 69 65 77 65 64 20 6f 72 20  't be viewed or 
52b0: 61 6c 74 65 72 65 64 20 64 75 72 69 6e 67 20 74  altered during t
52c0: 72 61 6e 73 70 6f 72 74 2e 20 53 65 65 20 74 68  ransport. See th
52d0: 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79 5d 20  e.[option -key] 
52e0: 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79  and [option -key
52f0: 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20 66 6f  file] options fo
5300: 72 20 68 6f 77 20 74 6f 20 73 70 65 63 69 66 79  r how to specify
5310: 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79   the private key
5320: 2e 0a 41 6c 73 6f 20 73 65 65 20 74 68 65 20 5b  ..Also see the [
5330: 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64  option -password
5340: 5d 20 6f 70 74 69 6f 6e 20 66 6f 72 20 68 6f 77  ] option for how
5350: 20 74 6f 20 70 72 6f 76 69 64 65 20 74 68 65 20   to provide the 
5360: 70 61 73 73 77 6f 72 64 2e 0a 5b 70 61 72 61 5d  password..[para]
5370: 0a 49 6e 20 6f 72 64 65 72 20 74 6f 20 70 72 6f  .In order to pro
5380: 76 69 64 65 20 61 75 74 68 65 6e 74 69 63 61 74  vide authenticat
5390: 69 6f 6e 2c 20 69 2e 65 2e 20 65 6e 73 75 72 69  ion, i.e. ensuri
53a0: 6e 67 20 73 6f 6d 65 6f 6e 65 20 69 73 20 77 68  ng someone is wh
53b0: 6f 20 74 68 65 79 20 73 61 79 20 74 68 65 79 0a  o they say they.
53c0: 61 72 65 2c 20 74 68 65 20 70 75 62 6c 69 63 20  are, the public 
53d0: 6b 65 79 20 61 6e 64 20 75 73 65 72 20 69 64 65  key and user ide
53e0: 6e 74 69 66 69 63 61 74 69 6f 6e 20 69 6e 66 6f  ntification info
53f0: 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20 61 20   is stored in a 
5400: 58 2e 35 30 39 0a 63 65 72 74 69 66 69 63 61 74  X.509.certificat
5410: 65 20 61 6e 64 20 74 68 61 74 20 63 65 72 74 69  e and that certi
5420: 66 69 63 61 74 65 20 69 73 20 61 75 74 68 65 6e  ficate is authen
5430: 74 69 63 61 74 65 64 20 28 69 2e 65 2e 20 73 69  ticated (i.e. si
5440: 67 6e 65 64 29 20 62 79 20 61 20 43 65 72 74 69  gned) by a Certi
5450: 66 69 63 61 74 65 0a 41 75 74 68 6f 72 69 74 79  ficate.Authority
5460: 20 28 43 41 29 2e 20 55 73 65 72 73 20 63 61 6e   (CA). Users can
5470: 20 74 68 65 6e 20 65 78 63 68 61 6e 67 65 20 74   then exchange t
5480: 68 65 73 65 20 63 65 72 74 69 66 69 63 61 74 65  hese certificate
5490: 73 20 64 75 72 69 6e 67 20 74 68 65 20 54 4c 53  s during the TLS
54a0: 0a 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 20  .initialization 
54b0: 70 72 6f 63 65 73 73 20 61 6e 64 20 63 68 65 63  process and chec
54c0: 6b 20 74 68 65 6d 20 61 67 61 69 6e 73 74 20 74  k them against t
54d0: 68 65 20 72 6f 6f 74 20 43 41 20 63 65 72 74 69  he root CA certi
54e0: 66 69 63 61 74 65 73 20 74 6f 20 65 6e 73 75 72  ficates to ensur
54f0: 65 0a 74 68 65 79 20 61 72 65 20 76 61 6c 69 64  e.they are valid
5500: 2e 20 54 68 69 73 20 69 73 20 68 61 6e 64 6c 65  . This is handle
5510: 64 20 62 79 20 4f 70 65 6e 53 53 4c 20 76 69 61  d by OpenSSL via
5520: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 72 65   the [option -re
5530: 71 75 65 73 74 5d 20 61 6e 64 0a 5b 6f 70 74 69  quest] and.[opti
5540: 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 6f 70 74  on -require] opt
5550: 69 6f 6e 73 2e 20 53 65 65 20 74 68 65 20 5b 6f  ions. See the [o
5560: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b  ption -cadir], [
5570: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20  option -cadir], 
5580: 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 73  and.[option -cas
5590: 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20 66 6f  tore] options fo
55a0: 72 20 68 6f 77 20 74 6f 20 73 70 65 63 69 66 79  r how to specify
55b0: 20 77 68 65 72 65 20 74 6f 20 66 69 6e 64 20 74   where to find t
55c0: 68 65 20 43 41 20 63 65 72 74 69 66 69 63 61 74  he CA certificat
55d0: 65 73 2e 0a 4f 70 74 69 6f 6e 61 6c 6c 79 2c 20  es..Optionally, 
55e0: 69 6e 20 61 20 66 75 74 75 72 65 20 72 65 6c 65  in a future rele
55f0: 61 73 65 2c 20 74 68 65 79 20 63 61 6e 20 61 6c  ase, they can al
5600: 73 6f 20 62 65 20 63 68 65 63 6b 65 64 20 61 67  so be checked ag
5610: 61 69 6e 73 74 20 74 68 65 20 43 65 72 74 69 66  ainst the Certif
5620: 69 63 61 74 65 0a 52 65 76 6f 63 61 74 69 6f 6e  icate.Revocation
5630: 20 4c 69 73 74 20 28 43 52 4c 29 20 6f 66 20 72   List (CRL) of r
5640: 65 76 6f 6b 65 64 20 63 65 72 74 69 66 69 63 61  evoked certifica
5650: 74 65 73 2e 20 43 65 72 74 69 66 69 63 61 74 65  tes. Certificate
5660: 73 20 63 61 6e 20 61 6c 73 6f 20 62 65 0a 73 65  s can also be.se
5670: 6c 66 2d 73 69 67 6e 65 64 2c 20 62 75 74 20 74  lf-signed, but t
5680: 68 65 79 20 61 72 65 20 62 79 20 64 65 66 61 75  hey are by defau
5690: 6c 74 20 6e 6f 74 20 74 72 75 73 74 65 64 20 75  lt not trusted u
56a0: 6e 6c 65 73 73 20 79 6f 75 20 61 64 64 20 74 68  nless you add th
56b0: 65 6d 20 74 6f 20 79 6f 75 72 0a 63 65 72 74 69  em to your.certi
56c0: 66 69 63 61 74 65 20 73 74 6f 72 65 2e 0a 5b 70  ficate store..[p
56d0: 61 72 61 5d 0a 54 79 70 69 63 61 6c 6c 79 20 77  ara].Typically w
56e0: 68 65 6e 20 76 69 73 69 74 69 6e 67 20 77 65 62  hen visiting web
56f0: 20 73 69 74 65 73 2c 20 6f 6e 6c 79 20 74 68 65   sites, only the
5700: 20 63 6c 69 65 6e 74 20 6e 65 65 64 73 20 74 6f   client needs to
5710: 20 63 68 65 63 6b 20 74 68 65 20 73 65 72 76 65   check the serve
5720: 72 27 73 0a 63 65 72 74 69 66 69 63 61 74 65 20  r's.certificate 
5730: 74 6f 20 65 6e 73 75 72 65 20 69 74 20 69 73 20  to ensure it is 
5740: 76 61 6c 69 64 2e 20 54 68 65 20 73 65 72 76 65  valid. The serve
5750: 72 20 64 6f 65 73 6e 27 74 20 6e 65 65 64 20 74  r doesn't need t
5760: 6f 20 63 68 65 63 6b 20 74 68 65 20 63 6c 69 65  o check the clie
5770: 6e 74 0a 63 65 72 74 69 66 69 63 61 74 65 20 75  nt.certificate u
5780: 6e 6c 65 73 73 20 79 6f 75 20 6e 65 65 64 20 74  nless you need t
5790: 6f 20 61 75 74 68 65 6e 74 69 63 61 74 65 20 77  o authenticate w
57a0: 69 74 68 20 74 68 65 6d 20 74 6f 20 6c 6f 67 69  ith them to logi
57b0: 6e 2c 20 65 74 63 2e 20 53 65 65 20 74 68 65 0a  n, etc. See the.
57c0: 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74 5d 20 61  [option -cert] a
57d0: 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74  nd [option -cert
57e0: 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20 69 66  file] options if
57f0: 20 79 6f 75 20 6e 65 65 64 20 74 6f 20 70 72 6f   you need to pro
5800: 76 69 64 65 20 61 20 63 65 72 74 69 66 69 63 61  vide a certifica
5810: 74 65 2e 0a 0a 0a 5b 73 75 62 73 65 63 74 69 6f  te....[subsectio
5820: 6e 20 22 53 75 6d 6d 61 72 79 20 6f 66 20 63 6f  n "Summary of co
5830: 6d 6d 61 6e 64 20 6c 69 6e 65 20 6f 70 74 69 6f  mmand line optio
5840: 6e 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77  ns"]..The follow
5850: 69 6e 67 20 6f 70 74 69 6f 6e 73 20 61 72 65 20  ing options are 
5860: 75 73 65 64 20 66 6f 72 20 70 65 65 72 20 63 65  used for peer ce
5870: 72 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 61  rtificate valida
5880: 74 69 6f 6e 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67  tion:..[list_beg
5890: 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70  in options]..[op
58a0: 74 5f 64 65 66 20 2d 63 61 64 69 72 20 5b 61 72  t_def -cadir [ar
58b0: 67 20 64 69 72 65 63 74 6f 72 79 5d 5d 0a 53 70  g directory]].Sp
58c0: 65 63 69 66 69 65 73 20 74 68 65 20 64 69 72 65  ecifies the dire
58d0: 63 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 20  ctory where the 
58e0: 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68  Certificate Auth
58f0: 6f 72 69 74 79 20 28 43 41 29 20 63 65 72 74 69  ority (CA) certi
5900: 66 69 63 61 74 65 73 20 61 72 65 0a 73 74 6f 72  ficates are.stor
5910: 65 64 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  ed. The default 
5920: 69 73 20 70 6c 61 74 66 6f 72 6d 20 73 70 65 63  is platform spec
5930: 69 66 69 63 2c 20 62 75 74 20 69 73 20 75 73 75  ific, but is usu
5940: 61 6c 6c 79 20 5b 66 69 6c 65 20 2f 65 74 63 2f  ally [file /etc/
5950: 73 73 6c 2f 63 65 72 74 73 5d 20 6f 6e 0a 4c 69  ssl/certs] on.Li
5960: 6e 75 78 2f 55 6e 69 78 20 73 79 73 74 65 6d 73  nux/Unix systems
5970: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 6c 6f  . The default lo
5980: 63 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 6f 76  cation can be ov
5990: 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 0a  erridden by the.
59a0: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49  [var SSL_CERT_DI
59b0: 52 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76  R] environment v
59c0: 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74 5f 64  ariable...[opt_d
59d0: 65 66 20 2d 63 61 66 69 6c 65 20 5b 61 72 67 20  ef -cafile [arg 
59e0: 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69  filename]].Speci
59f0: 66 69 65 73 20 74 68 65 20 66 69 6c 65 20 77 69  fies the file wi
5a00: 74 68 20 74 68 65 20 43 65 72 74 69 66 69 63 61  th the Certifica
5a10: 74 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41  te Authority (CA
5a20: 29 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74  ) certificates t
5a30: 6f 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73 74 20  o use in.[const 
5a40: 50 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d 61 74  PEM] file format
5a50: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
5a60: 20 5b 66 69 6c 65 20 63 65 72 74 2e 70 65 6d 5d   [file cert.pem]
5a70: 2c 20 69 6e 20 74 68 65 20 4f 70 65 6e 53 53 4c  , in the OpenSSL
5a80: 0a 64 69 72 65 63 74 6f 72 79 2e 20 4f 6e 20 4c  .directory. On L
5a90: 69 6e 75 78 2f 55 6e 69 78 20 73 79 73 74 65 6d  inux/Unix system
5aa0: 73 2c 20 74 68 69 73 20 69 73 20 75 73 75 61 6c  s, this is usual
5ab0: 6c 79 20 5b 66 69 6c 65 20 2f 65 74 63 2f 73 73  ly [file /etc/ss
5ac0: 6c 2f 63 61 2d 62 75 6e 64 6c 65 2e 70 65 6d 5d  l/ca-bundle.pem]
5ad0: 2e 0a 54 68 65 20 64 65 66 61 75 6c 74 20 66 69  ..The default fi
5ae0: 6c 65 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69  le can be overri
5af0: 64 64 65 6e 20 62 79 20 74 68 65 20 5b 76 61 72  dden by the [var
5b00: 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20   SSL_CERT_FILE] 
5b10: 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 76 61 72 69  environment.vari
5b20: 61 62 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  able...[opt_def 
5b30: 2d 63 61 73 74 6f 72 65 20 5b 61 72 67 20 55 52  -castore [arg UR
5b40: 49 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  I]].Specifies th
5b50: 65 20 55 6e 69 66 6f 72 6d 20 52 65 73 6f 75 72  e Uniform Resour
5b60: 63 65 20 49 64 65 6e 74 69 66 69 65 72 20 28 55  ce Identifier (U
5b70: 52 49 29 20 66 6f 72 20 74 68 65 20 43 65 72 74  RI) for the Cert
5b80: 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74  ificate Authorit
5b90: 79 0a 28 43 41 29 20 73 74 6f 72 65 2c 20 77 68  y.(CA) store, wh
5ba0: 69 63 68 20 6d 61 79 20 62 65 20 61 20 73 69 6e  ich may be a sin
5bb0: 67 6c 65 20 63 6f 6e 74 61 69 6e 65 72 20 6f 72  gle container or
5bc0: 20 61 20 63 61 74 61 6c 6f 67 20 6f 66 20 63 6f   a catalog of co
5bd0: 6e 74 61 69 6e 65 72 73 2e 0a 53 74 61 72 74 69  ntainers..Starti
5be0: 6e 67 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20  ng with OpenSSL 
5bf0: 33 2e 32 20 6f 6e 20 4d 53 20 57 69 6e 64 6f 77  3.2 on MS Window
5c00: 73 2c 20 73 65 74 20 74 6f 20 22 5b 63 6f 6e 73  s, set to "[cons
5c10: 74 20 22 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77  t "org.openssl.w
5c20: 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f  instore://"]".to
5c30: 20 75 73 65 20 74 68 65 20 62 75 69 6c 74 2d 69   use the built-i
5c40: 6e 20 4d 53 20 57 69 6e 64 6f 77 73 20 43 65 72  n MS Windows Cer
5c50: 74 69 66 69 63 61 74 65 20 53 74 6f 72 65 2e 20  tificate Store. 
5c60: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54  Starting in TclT
5c70: 4c 53 20 32 2e 30 2c 20 74 68 69 73 0a 69 73 20  LS 2.0, this.is 
5c80: 74 68 65 20 64 65 66 61 75 6c 74 20 69 66 20 5b  the default if [
5c90: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20  option -cadir], 
5ca0: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c  [option -cadir],
5cb0: 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61   and [option -ca
5cc0: 73 74 6f 72 65 5d 20 61 72 65 0a 6e 6f 74 20 73  store] are.not s
5cd0: 70 65 63 69 66 69 65 64 2e 20 54 68 69 73 20 73  pecified. This s
5ce0: 74 6f 72 65 20 6f 6e 6c 79 20 73 75 70 70 6f 72  tore only suppor
5cf0: 74 73 20 72 6f 6f 74 20 63 65 72 74 69 66 69 63  ts root certific
5d00: 61 74 65 20 73 74 6f 72 65 73 2e 0a 0a 5b 6f 70  ate stores...[op
5d10: 74 5f 64 65 66 20 2d 72 65 71 75 65 73 74 20 5b  t_def -request [
5d20: 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 65  arg bool]].Reque
5d30: 73 74 20 61 20 63 65 72 74 69 66 69 63 61 74 65  st a certificate
5d40: 20 66 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64   from the peer d
5d50: 75 72 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61  uring the SSL ha
5d60: 6e 64 73 68 61 6b 65 2e 20 54 68 69 73 20 69 73  ndshake. This is
5d70: 20 6e 65 65 64 65 64 0a 74 6f 20 64 6f 20 43 65   needed.to do Ce
5d80: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
5d90: 74 69 6f 6e 2e 20 53 74 61 72 74 69 6e 67 20 69  tion. Starting i
5da0: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c 20 74 68  n TclTLS 1.8, th
5db0: 65 20 64 65 66 61 75 6c 74 20 69 73 0a 5b 63 6f  e default is.[co
5dc0: 6e 73 74 20 74 72 75 65 5d 20 66 6f 72 20 63 6c  nst true] for cl
5dd0: 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 73  ient connections
5de0: 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63  . Starting in Tc
5df0: 6c 54 4c 53 20 32 2e 30 2c 20 69 66 20 73 65 74  lTLS 2.0, if set
5e00: 20 74 6f 0a 5b 63 6f 6e 73 74 20 66 61 6c 73 65   to.[const false
5e10: 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 72  ] and [option -r
5e20: 65 71 75 69 72 65 5d 20 69 73 20 5b 63 6f 6e 73  equire] is [cons
5e30: 74 20 74 72 75 65 5d 2c 20 74 68 65 6e 20 74 68  t true], then th
5e40: 69 73 20 77 69 6c 6c 20 62 65 0a 6f 76 65 72 72  is will be.overr
5e50: 69 64 64 65 6e 20 74 6f 20 5b 63 6f 6e 73 74 20  idden to [const 
5e60: 74 72 75 65 5d 2e 20 49 6e 20 61 64 64 69 74 69  true]. In additi
5e70: 6f 6e 2c 20 74 68 65 20 63 6c 69 65 6e 74 20 63  on, the client c
5e80: 61 6e 20 6d 61 6e 75 61 6c 6c 79 20 69 6e 73 70  an manually insp
5e90: 65 63 74 20 61 6e 64 0a 61 63 63 65 70 74 20 6f  ect and.accept o
5ea0: 72 20 72 65 6a 65 63 74 20 65 61 63 68 20 63 65  r reject each ce
5eb0: 72 74 69 66 69 63 61 74 65 20 75 73 69 6e 67 20  rtificate using 
5ec0: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c  the [option -val
5ed0: 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70  idatecommand] op
5ee0: 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  tion...[opt_def 
5ef0: 2d 72 65 71 75 69 72 65 20 5b 61 72 67 20 62 6f  -require [arg bo
5f00: 6f 6c 5d 5d 0a 52 65 71 75 69 72 65 20 61 20 76  ol]].Require a v
5f10: 61 6c 69 64 20 63 65 72 74 69 66 69 63 61 74 65  alid certificate
5f20: 20 66 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64   from the peer d
5f30: 75 72 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61  uring the SSL ha
5f40: 6e 64 73 68 61 6b 65 2e 20 49 66 20 74 68 69 73  ndshake. If this
5f50: 20 69 73 0a 73 65 74 20 74 6f 20 74 72 75 65 2c   is.set to true,
5f60: 20 74 68 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d 72   then [option -r
5f70: 65 71 75 65 73 74 5d 20 6d 75 73 74 20 61 6c 73  equest] must als
5f80: 6f 20 62 65 20 73 65 74 20 74 6f 20 74 72 75 65  o be set to true
5f90: 20 61 6e 64 20 61 20 65 69 74 68 65 72 0a 5b 6f   and a either.[o
5fa0: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b  ption -cadir], [
5fb0: 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c  option -cafile],
5fc0: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72   [option -castor
5fd0: 65 5d 2c 20 6f 72 20 61 20 70 6c 61 74 66 6f 72  e], or a platfor
5fe0: 6d 20 64 65 66 61 75 6c 74 0a 6d 75 73 74 20 62  m default.must b
5ff0: 65 20 70 72 6f 76 69 64 65 64 20 69 6e 20 6f 72  e provided in or
6000: 64 65 72 20 74 6f 20 76 61 6c 69 64 61 74 65 20  der to validate 
6010: 61 67 61 69 6e 73 74 2e 20 54 68 65 20 64 65 66  against. The def
6020: 61 75 6c 74 20 69 6e 20 54 63 6c 54 4c 53 20 31  ault in TclTLS 1
6030: 2e 38 20 61 6e 64 0a 65 61 72 6c 69 65 72 20 76  .8 and.earlier v
6040: 65 72 73 69 6f 6e 73 20 69 73 20 5b 63 6f 6e 73  ersions is [cons
6050: 74 20 66 61 6c 73 65 5d 20 73 69 6e 63 65 20 6e  t false] since n
6060: 6f 74 20 61 6c 6c 20 70 6c 61 74 66 6f 72 6d 73  ot all platforms
6070: 20 68 61 76 65 20 63 65 72 74 69 66 69 63 61 74   have certificat
6080: 65 73 20 74 6f 0a 76 61 6c 69 64 61 74 65 20 61  es to.validate a
6090: 67 61 69 6e 73 74 20 69 6e 20 61 20 66 6f 72 6d  gainst in a form
60a0: 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68   compatible with
60b0: 20 4f 70 65 6e 53 53 4c 2e 20 53 74 61 72 74 69   OpenSSL. Starti
60c0: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30  ng in TclTLS 2.0
60d0: 2c 0a 74 68 65 20 64 65 66 61 75 6c 74 20 69 73  ,.the default is
60e0: 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20 66 6f   [const true] fo
60f0: 72 20 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74  r client connect
6100: 69 6f 6e 73 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  ions...[list_end
6110: 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22  ]..[subsection "
6120: 57 68 65 6e 20 61 72 65 20 63 6f 6d 6d 61 6e 64  When are command
6130: 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 73 20 6e 65   line options ne
6140: 65 64 65 64 3f 22 5d 0a 0a 49 6e 20 54 63 6c 54  eded?"]..In TclT
6150: 4c 53 20 31 2e 38 20 61 6e 64 20 65 61 72 6c 69  LS 1.8 and earli
6160: 65 72 20 76 65 72 73 69 6f 6e 73 2c 20 63 65 72  er versions, cer
6170: 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 61 74  tificate validat
6180: 69 6f 6e 20 69 73 0a 5b 65 6d 70 68 20 4e 4f 54  ion is.[emph NOT
6190: 5d 20 65 6e 61 62 6c 65 64 20 62 79 20 64 65 66  ] enabled by def
61a0: 61 75 6c 74 2e 20 54 68 69 73 20 6c 69 6d 69 74  ault. This limit
61b0: 61 74 69 6f 6e 20 69 73 20 64 75 65 20 74 6f 20  ation is due to 
61c0: 74 68 65 20 6c 61 63 6b 20 6f 66 20 61 20 63 6f  the lack of a co
61d0: 6d 6d 6f 6e 0a 63 72 6f 73 73 20 70 6c 61 74 66  mmon.cross platf
61e0: 6f 72 6d 20 64 61 74 61 62 61 73 65 20 6f 66 20  orm database of 
61f0: 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68  Certificate Auth
6200: 6f 72 69 74 79 20 28 43 41 29 20 70 72 6f 76 69  ority (CA) provi
6210: 64 65 64 20 63 65 72 74 69 66 69 63 61 74 65 73  ded certificates
6220: 20 74 6f 0a 76 61 6c 69 64 61 74 65 20 61 67 61   to.validate aga
6230: 69 6e 73 74 2e 20 4d 61 6e 79 20 4c 69 6e 75 78  inst. Many Linux
6240: 20 73 79 73 74 65 6d 73 20 6e 61 74 69 76 65 6c   systems nativel
6250: 79 20 73 75 70 70 6f 72 74 20 4f 70 65 6e 53 53  y support OpenSS
6260: 4c 20 61 6e 64 20 74 68 75 73 20 68 61 76 65 0a  L and thus have.
6270: 74 68 65 73 65 20 63 65 72 74 69 66 69 63 61 74  these certificat
6280: 65 73 20 69 6e 73 74 61 6c 6c 65 64 20 61 73 20  es installed as 
6290: 70 61 72 74 20 6f 66 20 74 68 65 20 4f 53 2c 20  part of the OS, 
62a0: 62 75 74 20 4d 61 63 4f 53 20 61 6e 64 20 4d 53  but MacOS and MS
62b0: 20 57 69 6e 64 6f 77 73 20 64 6f 20 6e 6f 74 2e   Windows do not.
62c0: 0a 53 74 61 72 69 6e 67 20 69 6e 20 54 63 6c 54  .Staring in TclT
62d0: 4c 53 20 32 2e 30 2c 20 74 68 65 20 64 65 66 61  LS 2.0, the defa
62e0: 75 6c 74 20 66 6f 72 20 63 6c 69 65 6e 74 20 63  ult for client c
62f0: 6f 6e 6e 65 63 74 69 6f 6e 73 20 68 61 73 20 62  onnections has b
6300: 65 65 6e 20 63 68 61 6e 67 65 64 20 74 6f 0a 72  een changed to.r
6310: 65 71 75 69 72 65 20 63 65 72 74 69 66 69 63 61  equire certifica
6320: 74 65 20 76 61 6c 69 64 61 74 69 6f 6e 20 62 79  te validation by
6330: 20 64 65 66 61 75 6c 74 2e 20 49 6e 20 6f 72 64   default. In ord
6340: 65 72 20 74 6f 20 75 73 65 20 74 68 65 20 5b 6f  er to use the [o
6350: 70 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 0a  ption -require].
6360: 6f 70 74 69 6f 6e 2c 20 6f 6e 65 20 6f 66 20 74  option, one of t
6370: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d 75 73  he following mus
6380: 74 20 62 65 20 74 72 75 65 3a 0a 0a 5b 6c 69 73  t be true:..[lis
6390: 74 5f 62 65 67 69 6e 20 69 74 65 6d 69 7a 65 64  t_begin itemized
63a0: 5d 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20 4c 69 6e  ]..[item].On Lin
63b0: 75 78 20 61 6e 64 20 55 6e 69 78 20 73 79 73 74  ux and Unix syst
63c0: 65 6d 73 20 77 69 74 68 20 4f 70 65 6e 53 53 4c  ems with OpenSSL
63d0: 20 61 6c 72 65 61 64 79 20 69 6e 73 74 61 6c 6c   already install
63e0: 65 64 20 6f 72 20 69 66 20 74 68 65 20 43 41 0a  ed or if the CA.
63f0: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65  certificates are
6400: 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 50 45   available in PE
6410: 4d 20 66 6f 72 6d 61 74 2c 20 61 6e 64 20 69 66  M format, and if
6420: 20 74 68 65 79 20 61 72 65 20 73 74 6f 72 65 64   they are stored
6430: 20 69 6e 20 74 68 65 0a 73 74 61 6e 64 61 72 64   in the.standard
6440: 20 6c 6f 63 61 74 69 6f 6e 73 2c 20 6f 72 20 69   locations, or i
6450: 66 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43  f the [var SSL_C
6460: 45 52 54 5f 44 49 52 5d 20 6f 72 20 5b 76 61 72  ERT_DIR] or [var
6470: 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 0a   SSL_CERT_FILE].
6480: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69  environment vari
6490: 61 62 6c 65 73 20 61 72 65 20 73 65 74 2c 20 74  ables are set, t
64a0: 68 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  hen [option -cad
64b0: 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  ir], [option -ca
64c0: 64 69 72 5d 2c 0a 61 6e 64 20 5b 6f 70 74 69 6f  dir],.and [optio
64d0: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 61 72 65 6e  n -castore] aren
64e0: 27 74 20 6e 65 65 64 65 64 2e 0a 0a 5b 69 74 65  't needed...[ite
64f0: 6d 5d 0a 49 66 20 4f 70 65 6e 53 53 4c 20 69 73  m].If OpenSSL is
6500: 20 6e 6f 74 20 69 6e 73 74 61 6c 6c 65 64 20 69   not installed i
6510: 6e 20 74 68 65 20 64 65 66 61 75 6c 74 20 6c 6f  n the default lo
6520: 63 61 74 69 6f 6e 2c 20 6f 72 20 77 68 65 6e 20  cation, or when 
6530: 75 73 69 6e 67 20 4d 61 63 20 4f 53 0a 6f 72 20  using Mac OS.or 
6540: 4d 53 20 57 69 6e 64 6f 77 73 20 61 6e 64 20 4f  MS Windows and O
6550: 70 65 6e 53 53 4c 20 69 73 20 69 6e 73 74 61 6c  penSSL is instal
6560: 6c 65 64 2c 20 74 68 65 20 5b 76 61 72 20 53 53  led, the [var SS
6570: 4c 5f 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f  L_CERT_DIR] and/
6580: 6f 72 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54  or.[var SSL_CERT
6590: 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65  _FILE] environme
65a0: 6e 74 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20  nt variables or 
65b0: 74 68 65 20 6f 6e 65 20 6f 66 20 74 68 65 20 5b  the one of the [
65c0: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a  option -cadir],.
65d0: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c  [option -cadir],
65e0: 20 6f 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73   or [option -cas
65f0: 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20 6d 75  tore] options mu
6600: 73 74 20 62 65 20 64 65 66 69 6e 65 64 2e 0a 0a  st be defined...
6610: 5b 69 74 65 6d 5d 0a 4f 6e 20 4d 53 20 57 69 6e  [item].On MS Win
6620: 64 6f 77 73 2c 20 73 74 61 72 74 69 6e 67 20 69  dows, starting i
6630: 6e 20 4f 70 65 6e 53 53 4c 20 33 2e 32 2c 20 69  n OpenSSL 3.2, i
6640: 74 20 69 73 20 6e 6f 77 20 70 6f 73 73 69 62 6c  t is now possibl
6650: 65 20 74 6f 20 61 63 63 65 73 73 20 74 68 65 0a  e to access the.
6660: 62 75 69 6c 74 2d 69 6e 20 57 69 6e 64 6f 77 73  built-in Windows
6670: 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74 6f   Certificate Sto
6680: 72 65 20 66 72 6f 6d 20 4f 70 65 6e 53 53 4c 2e  re from OpenSSL.
6690: 20 54 68 69 73 20 63 61 6e 20 75 74 69 6c 69 7a   This can utiliz
66a0: 65 64 20 62 79 0a 73 65 74 74 69 6e 67 20 74 68  ed by.setting th
66b0: 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  e [option -casto
66c0: 72 65 5d 20 6f 70 74 69 6f 6e 20 74 6f 20 22 5b  re] option to "[
66d0: 63 6f 6e 73 74 20 6f 72 67 2e 6f 70 65 6e 73 73  const org.openss
66e0: 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 5d 22 2e  l.winstore://]".
66f0: 0a 49 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20  .In TclTLS 2.0, 
6700: 74 68 69 73 20 69 73 20 74 68 65 20 64 65 66 61  this is the defa
6710: 75 6c 74 20 76 61 6c 75 65 20 69 66 20 5b 6f 70  ult value if [op
6720: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f  tion -cadir],.[o
6730: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61  ption -cadir], a
6740: 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74  nd [option -cast
6750: 6f 72 65 5d 20 61 72 65 20 6e 6f 74 20 73 70 65  ore] are not spe
6760: 63 69 66 69 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a  cified...[item].
6770: 49 66 20 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f  If OpenSSL is no
6780: 74 20 69 6e 73 74 61 6c 6c 65 64 20 6f 72 20 74  t installed or t
6790: 68 65 20 43 41 20 63 65 72 74 69 66 69 63 61 74  he CA certificat
67a0: 65 73 20 61 72 65 20 6e 6f 74 20 61 76 61 69 6c  es are not avail
67b0: 61 62 6c 65 20 69 6e 20 50 45 4d 0a 66 6f 72 6d  able in PEM.form
67c0: 61 74 2c 20 74 68 65 20 43 41 20 63 65 72 74 69  at, the CA certi
67d0: 66 69 63 61 74 65 73 20 6d 75 73 74 20 62 65 20  ficates must be 
67e0: 64 6f 77 6e 6c 6f 61 64 65 64 20 61 6e 64 20 69  downloaded and i
67f0: 6e 73 74 61 6c 6c 65 64 20 77 69 74 68 20 74 68  nstalled with th
6800: 65 20 75 73 65 72 0a 73 6f 66 74 77 61 72 65 2e  e user.software.
6810: 20 54 68 65 20 43 55 52 4c 20 74 65 61 6d 20 6d   The CURL team m
6820: 61 6b 65 73 20 74 68 65 6d 20 61 76 61 69 6c 61  akes them availa
6830: 62 6c 65 20 61 74 0a 5b 75 72 69 20 22 68 74 74  ble at.[uri "htt
6840: 70 73 3a 2f 2f 63 75 72 6c 2e 73 65 2f 64 6f 63  ps://curl.se/doc
6850: 73 2f 63 61 65 78 74 72 61 63 74 2e 68 74 6d 6c  s/caextract.html
6860: 22 20 22 43 41 20 63 65 72 74 69 66 69 63 61 74  " "CA certificat
6870: 65 73 20 65 78 74 72 61 63 74 65 64 0a 66 72 6f  es extracted.fro
6880: 6d 20 4d 6f 7a 69 6c 6c 61 22 5d 20 69 6e 20 74  m Mozilla"] in t
6890: 68 65 20 5b 66 69 6c 65 20 63 61 63 65 72 74 2e  he [file cacert.
68a0: 70 65 6d 5d 20 66 69 6c 65 2e 20 59 6f 75 20 6d  pem] file. You m
68b0: 75 73 74 20 74 68 65 6e 20 65 69 74 68 65 72 20  ust then either 
68c0: 73 65 74 20 74 68 65 0a 5b 76 61 72 20 53 53 4c  set the.[var SSL
68d0: 5f 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f 6f  _CERT_DIR] and/o
68e0: 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  r [var SSL_CERT_
68f0: 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e  FILE] environmen
6900: 74 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20 74  t variables or t
6910: 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  he.[option -cadi
6920: 72 5d 20 6f 72 20 5b 6f 70 74 69 6f 6e 20 2d 63  r] or [option -c
6930: 61 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20 74  afile] options t
6940: 6f 20 74 68 65 20 43 41 20 63 65 72 74 20 66 69  o the CA cert fi
6950: 6c 65 27 73 20 69 6e 73 74 61 6c 6c 0a 6c 6f 63  le's install.loc
6960: 61 74 69 6f 6e 2e 20 49 74 20 69 73 20 79 6f 75  ation. It is you
6970: 72 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79  r responsibility
6980: 20 74 6f 20 6b 65 65 70 20 74 68 69 73 20 66 69   to keep this fi
6990: 6c 65 20 75 70 20 74 6f 20 64 61 74 65 2e 0a 0a  le up to date...
69a0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 65 63  [list_end]..[sec
69b0: 74 69 6f 6e 20 22 43 61 6c 6c 62 61 63 6b 20 4f  tion "Callback O
69c0: 70 74 69 6f 6e 73 22 5d 0a 0a 41 73 20 70 72 65  ptions"]..As pre
69d0: 76 69 6f 75 73 6c 79 20 64 65 73 63 72 69 62 65  viously describe
69e0: 64 2c 20 65 61 63 68 20 63 68 61 6e 6e 65 6c 20  d, each channel 
69f0: 63 61 6e 20 62 65 20 67 69 76 65 6e 20 74 68 65  can be given the
6a00: 69 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 73  ir own callbacks
6a10: 0a 74 6f 20 68 61 6e 64 6c 65 20 69 6e 74 65 72  .to handle inter
6a20: 6d 65 64 69 61 74 65 20 70 72 6f 63 65 73 73 69  mediate processi
6a30: 6e 67 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53  ng by the OpenSS
6a40: 4c 20 6c 69 62 72 61 72 79 2c 20 75 73 69 6e 67  L library, using
6a50: 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f   the.[option -co
6a60: 6d 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20  mmand], [option 
6a70: 2d 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 20  -password], and 
6a80: 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74  [option -validat
6a90: 65 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f  e_command] optio
6aa0: 6e 73 0a 70 61 73 73 65 64 20 74 6f 20 65 69 74  ns.passed to eit
6ab0: 68 65 72 20 6f 66 20 5b 63 6d 64 20 74 6c 73 3a  her of [cmd tls:
6ac0: 3a 73 6f 63 6b 65 74 5d 20 6f 72 20 5b 63 6d 64  :socket] or [cmd
6ad0: 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e 0a 55   tls::import]..U
6ae0: 6e 6c 69 6b 65 20 70 72 65 76 69 6f 75 73 20 76  nlike previous v
6af0: 65 72 73 69 6f 6e 73 20 6f 66 20 54 63 6c 54 4c  ersions of TclTL
6b00: 53 2c 20 6f 6e 6c 79 20 69 66 20 74 68 65 20 63  S, only if the c
6b10: 61 6c 6c 62 61 63 6b 20 67 65 6e 65 72 61 74 65  allback generate
6b20: 73 20 61 6e 20 65 72 72 6f 72 2c 0a 77 69 6c 6c  s an error,.will
6b30: 20 74 68 65 20 5b 73 79 73 63 6d 64 20 62 67 65   the [syscmd bge
6b40: 72 72 6f 72 5d 20 63 6f 6d 6d 61 6e 64 20 62 65  rror] command be
6b50: 20 69 6e 76 6f 6b 65 64 20 77 69 74 68 20 74 68   invoked with th
6b60: 65 20 65 72 72 6f 72 20 69 6e 66 6f 72 6d 61 74  e error informat
6b70: 69 6f 6e 2e 0a 0a 5b 73 75 62 73 65 63 74 69 6f  ion...[subsectio
6b80: 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 20 43 6f  n "Values for Co
6b90: 6d 6d 61 6e 64 20 43 61 6c 6c 62 61 63 6b 22 5d  mmand Callback"]
6ba0: 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 66  ..The callback f
6bb0: 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  or the [option -
6bc0: 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 20  command] option 
6bd0: 69 73 20 69 6e 76 6f 6b 65 64 20 61 74 20 73 65  is invoked at se
6be0: 76 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75 72  veral points dur
6bf0: 69 6e 67 20 74 68 65 0a 4f 70 65 6e 53 53 4c 20  ing the.OpenSSL 
6c00: 68 61 6e 64 73 68 61 6b 65 20 61 6e 64 20 64 75  handshake and du
6c10: 72 69 6e 67 20 72 6f 75 74 69 6e 65 20 6f 70 65  ring routine ope
6c20: 72 61 74 69 6f 6e 73 2e 20 53 65 65 20 62 65 6c  rations. See bel
6c30: 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69  ow for the possi
6c40: 62 6c 65 0a 61 72 67 75 6d 65 6e 74 73 20 70 61  ble.arguments pa
6c50: 73 73 65 64 20 74 6f 20 74 68 65 20 63 61 6c 6c  ssed to the call
6c60: 62 61 63 6b 20 73 63 72 69 70 74 2e 20 56 61 6c  back script. Val
6c70: 75 65 73 20 72 65 74 75 72 6e 65 64 20 66 72 6f  ues returned fro
6c80: 6d 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 61  m the callback a
6c90: 72 65 0a 69 67 6e 6f 72 65 64 2e 0a 0a 5b 6c 69  re.ignored...[li
6ca0: 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73  st_begin options
6cb0: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 65 72 72 6f  ]..[opt_def erro
6cc0: 72 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49  r [arg "channelI
6cd0: 64 20 6d 65 73 73 61 67 65 22 5d 5d 0a 54 68 69  d message"]].Thi
6ce0: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61  s form of callba
6cf0: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68  ck is invoked wh
6d00: 65 6e 65 76 65 72 20 61 6e 20 65 72 72 6f 72 20  enever an error 
6d10: 6f 63 63 75 72 73 20 64 75 72 69 6e 67 20 74 68  occurs during th
6d20: 65 20 69 6e 69 74 69 61 6c 0a 63 6f 6e 6e 65 63  e initial.connec
6d30: 74 69 6f 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c  tion, handshake,
6d40: 20 6f 72 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f   or I/O operatio
6d50: 6e 73 2e 20 54 68 65 20 5b 61 72 67 20 6d 65 73  ns. The [arg mes
6d60: 73 61 67 65 5d 20 61 72 67 75 6d 65 6e 74 20 63  sage] argument c
6d70: 61 6e 20 62 65 0a 66 72 6f 6d 20 74 68 65 20 54  an be.from the T
6d80: 63 6c 5f 45 72 72 6e 6f 4d 73 67 2c 20 4f 70 65  cl_ErrnoMsg, Ope
6d90: 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 20 5b 66  nSSL function [f
6da0: 75 6e 20 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72  un ERR_reason_er
6db0: 72 6f 72 5f 73 74 72 69 6e 67 28 29 5d 2c 0a 6f  ror_string()],.o
6dc0: 72 20 61 20 63 75 73 74 6f 6d 20 6d 65 73 73 61  r a custom messa
6dd0: 67 65 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63  ge. This callbac
6de0: 6b 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  k is new for Tcl
6df0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64  TLS 1.8...[opt_d
6e00: 65 66 20 69 6e 66 6f 20 5b 61 72 67 20 22 63 68  ef info [arg "ch
6e10: 61 6e 6e 65 6c 49 64 20 6d 61 6a 6f 72 20 6d 69  annelId major mi
6e20: 6e 6f 72 20 6d 65 73 73 61 67 65 20 74 79 70 65  nor message type
6e30: 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66  "]].This form of
6e40: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
6e50: 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e  oked by the Open
6e60: 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75  SSL function.[fu
6e70: 6e 20 53 53 4c 5f 73 65 74 5f 69 6e 66 6f 5f 63  n SSL_set_info_c
6e80: 61 6c 6c 62 61 63 6b 28 29 5d 20 64 75 72 69 6e  allback()] durin
6e90: 67 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63 6f  g the initial co
6ea0: 6e 6e 65 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e  nnection and han
6eb0: 64 73 68 61 6b 65 0a 6f 70 65 72 61 74 69 6f 6e  dshake.operation
6ec0: 73 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73  s. The arguments
6ed0: 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67   are:..[list_beg
6ee0: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
6ef0: 0a 5b 64 65 66 20 5b 61 72 67 20 6d 61 6a 6f 72  .[def [arg major
6f00: 5d 5d 0a 4d 61 6a 6f 72 20 63 61 74 65 67 6f 72  ]].Major categor
6f10: 79 20 66 6f 72 20 65 72 72 6f 72 2e 20 56 61 6c  y for error. Val
6f20: 69 64 20 65 6e 75 6d 73 20 61 72 65 3a 20 5b 63  id enums are: [c
6f30: 6f 6e 73 74 20 68 61 6e 64 73 68 61 6b 65 5d 2c  onst handshake],
6f40: 20 5b 63 6f 6e 73 74 20 61 6c 65 72 74 5d 2c 0a   [const alert],.
6f50: 5b 63 6f 6e 73 74 20 63 6f 6e 6e 65 63 74 5d 2c  [const connect],
6f60: 20 5b 63 6f 6e 73 74 20 61 63 63 65 70 74 5d 2e   [const accept].
6f70: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 69 6e 6f  ..[def [arg mino
6f80: 72 5d 5d 0a 4d 69 6e 6f 72 20 63 61 74 65 67 6f  r]].Minor catego
6f90: 72 79 20 66 6f 72 20 65 72 72 6f 72 2e 20 56 61  ry for error. Va
6fa0: 6c 69 64 20 65 6e 75 6d 73 20 61 72 65 3a 20 5b  lid enums are: [
6fb0: 63 6f 6e 73 74 20 73 74 61 72 74 5d 2c 20 5b 63  const start], [c
6fc0: 6f 6e 73 74 20 64 6f 6e 65 5d 2c 20 5b 63 6f 6e  onst done], [con
6fd0: 73 74 20 72 65 61 64 5d 2c 0a 5b 63 6f 6e 73 74  st read],.[const
6fe0: 20 77 72 69 74 65 5d 2c 20 5b 63 6f 6e 73 74 20   write], [const 
6ff0: 6c 6f 6f 70 5d 2c 20 5b 63 6f 6e 73 74 20 65 78  loop], [const ex
7000: 69 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20  it]...[def [arg 
7010: 6d 65 73 73 61 67 65 5d 5d 0a 44 65 73 63 72 69  message]].Descri
7020: 70 74 69 76 65 20 6d 65 73 73 61 67 65 20 73 74  ptive message st
7030: 72 69 6e 67 20 77 68 69 63 68 20 6d 61 79 20 62  ring which may b
7040: 65 20 67 65 6e 65 72 61 74 65 64 20 65 69 74 68  e generated eith
7050: 65 72 20 62 79 0a 5b 66 75 6e 20 53 53 4c 5f 73  er by.[fun SSL_s
7060: 74 61 74 65 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67  tate_string_long
7070: 28 29 5d 20 6f 72 20 5b 66 75 6e 20 53 53 4c 5f  ()] or [fun SSL_
7080: 61 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69 6e  alert_desc_strin
7090: 67 5f 6c 6f 6e 67 28 29 5d 2c 0a 64 65 70 65 6e  g_long()],.depen
70a0: 64 69 6e 67 20 6f 6e 20 74 68 65 20 63 6f 6e 74  ding on the cont
70b0: 65 78 74 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20  ext...[def [arg 
70c0: 74 79 70 65 5d 5d 0a 46 6f 72 20 61 6c 65 72 74  type]].For alert
70d0: 73 2c 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20  s, the possible 
70e0: 76 61 6c 75 65 73 20 61 72 65 3a 20 5b 63 6f 6e  values are: [con
70f0: 73 74 20 77 61 72 6e 69 6e 67 5d 2c 0a 5b 63 6f  st warning],.[co
7100: 6e 73 74 20 66 61 74 61 6c 5d 2c 20 61 6e 64 20  nst fatal], and 
7110: 5b 63 6f 6e 73 74 20 75 6e 6b 6e 6f 77 6e 5d 2e  [const unknown].
7120: 20 46 6f 72 20 6f 74 68 65 72 73 2c 20 5b 63 6f   For others, [co
7130: 6e 73 74 20 69 6e 66 6f 5d 20 69 73 20 75 73 65  nst info] is use
7140: 64 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74  d..This argument
7150: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
7160: 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65  LS 1.8...[list_e
7170: 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 6d 65  nd]..[opt_def me
7180: 73 73 61 67 65 20 5b 61 72 67 20 22 63 68 61 6e  ssage [arg "chan
7190: 6e 65 6c 49 64 20 64 69 72 65 63 74 69 6f 6e 20  nelId direction 
71a0: 76 65 72 73 69 6f 6e 20 63 6f 6e 74 65 6e 74 5f  version content_
71b0: 74 79 70 65 20 6d 65 73 73 61 67 65 22 5d 5d 0a  type message"]].
71c0: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
71d0: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
71e0: 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20   by the OpenSSL 
71f0: 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53  function.[fun SS
7200: 4c 5f 73 65 74 5f 6d 73 67 5f 63 61 6c 6c 62 61  L_set_msg_callba
7210: 63 6b 28 29 5d 20 77 68 65 6e 65 76 65 72 20 61  ck()] whenever a
7220: 20 6d 65 73 73 61 67 65 20 69 73 20 73 65 6e 74   message is sent
7230: 20 6f 72 20 72 65 63 65 69 76 65 64 20 64 75 72   or received dur
7240: 69 6e 67 20 74 68 65 0a 69 6e 69 74 69 61 6c 20  ing the.initial 
7250: 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68 61 6e 64  connection, hand
7260: 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f 70  shake, or I/O op
7270: 65 72 61 74 69 6f 6e 73 2e 20 49 74 20 69 73 20  erations. It is 
7280: 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 77  only available w
7290: 68 65 6e 0a 4f 70 65 6e 53 53 4c 20 69 73 20 63  hen.OpenSSL is c
72a0: 6f 6d 70 6c 69 65 64 20 77 69 74 68 20 74 68 65  omplied with the
72b0: 20 5b 63 6f 6e 73 74 20 65 6e 61 62 6c 65 2d 73   [const enable-s
72c0: 73 6c 2d 74 72 61 63 65 5d 20 6f 70 74 69 6f 6e  sl-trace] option
72d0: 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20  . This callback 
72e0: 69 73 0a 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is.new for TclTL
72f0: 53 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d  S 1.8. The argum
7300: 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74  ents are:..[list
7310: 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f  _begin definitio
7320: 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 64  ns]..[def [arg d
7330: 69 72 65 63 74 69 6f 6e 5d 5d 0a 44 69 72 65 63  irection]].Direc
7340: 74 69 6f 6e 20 69 73 20 65 69 74 68 65 72 20 5b  tion is either [
7350: 63 6f 6e 73 74 20 53 65 6e 74 5d 20 6f 72 20 5b  const Sent] or [
7360: 63 6f 6e 73 74 20 52 65 63 65 69 76 65 64 5d 2e  const Received].
7370: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 76 65 72 73  ..[def [arg vers
7380: 69 6f 6e 5d 5d 0a 56 65 72 73 69 6f 6e 20 69 73  ion]].Version is
7390: 20 74 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65   the protocol ve
73a0: 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 5b 61 72  rsion...[def [ar
73b0: 67 20 63 6f 6e 74 65 6e 74 5f 74 79 70 65 5d 5d  g content_type]]
73c0: 0a 43 6f 6e 74 65 6e 74 20 74 79 70 65 20 69 73  .Content type is
73d0: 20 74 68 65 20 6d 65 73 73 61 67 65 20 63 6f 6e   the message con
73e0: 74 65 6e 74 20 74 79 70 65 2e 0a 0a 5b 64 65 66  tent type...[def
73f0: 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 5d 0a   [arg message]].
7400: 4d 65 73 73 61 67 65 20 69 73 20 6d 6f 72 65 20  Message is more 
7410: 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 5b 63  info from the [c
7420: 6f 6e 73 74 20 53 53 4c 5f 74 72 61 63 65 5d 20  onst SSL_trace] 
7430: 41 50 49 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  API...[list_end]
7440: 0a 0a 5b 6f 70 74 5f 64 65 66 20 73 65 73 73 69  ..[opt_def sessi
7450: 6f 6e 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c  on [arg "channel
7460: 49 64 20 73 65 73 73 69 6f 6e 5f 69 64 20 73 65  Id session_id se
7470: 73 73 69 6f 6e 5f 74 69 63 6b 65 74 20 6c 69 66  ssion_ticket lif
7480: 65 74 69 6d 65 22 5d 5d 0a 54 68 69 73 20 66 6f  etime"]].This fo
7490: 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69  rm of callback i
74a0: 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65  s invoked by the
74b0: 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f   OpenSSL functio
74c0: 6e 0a 5b 66 75 6e 20 53 53 4c 5f 43 54 58 5f 73  n.[fun SSL_CTX_s
74d0: 65 73 73 5f 73 65 74 5f 6e 65 77 5f 63 62 28 29  ess_set_new_cb()
74e0: 5d 20 77 68 65 6e 65 76 65 72 20 61 20 6e 65 77  ] whenever a new
74f0: 20 73 65 73 73 69 6f 6e 20 69 64 20 69 73 20 73   session id is s
7500: 65 6e 74 20 62 79 20 74 68 65 0a 73 65 72 76 65  ent by the.serve
7510: 72 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69  r during the ini
7520: 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20  tial connection 
7530: 61 6e 64 20 68 61 6e 64 73 68 61 6b 65 20 61 6e  and handshake an
7540: 64 20 61 6c 73 6f 20 64 75 72 69 6e 67 20 74 68  d also during th
7550: 65 20 73 65 73 73 69 6f 6e 0a 69 66 20 74 68 65  e session.if the
7560: 20 5b 6f 70 74 69 6f 6e 20 2d 70 6f 73 74 5f 68   [option -post_h
7570: 61 6e 64 73 68 61 6b 65 5d 20 6f 70 74 69 6f 6e  andshake] option
7580: 20 69 73 20 73 65 74 20 74 6f 20 74 72 75 65 2e   is set to true.
7590: 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69   This callback i
75a0: 73 20 6e 65 77 20 66 6f 72 0a 54 63 6c 54 4c 53  s new for.TclTLS
75b0: 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d 65   1.8. The argume
75c0: 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f  nts are:..[list_
75d0: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
75e0: 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 65  s]..[def [arg se
75f0: 73 73 69 6f 6e 5f 69 64 5d 5d 0a 53 65 73 73 69  ssion_id]].Sessi
7600: 6f 6e 20 49 64 20 69 73 20 74 68 65 20 63 75 72  on Id is the cur
7610: 72 65 6e 74 20 73 65 73 73 69 6f 6e 20 69 64 65  rent session ide
7620: 6e 74 69 66 69 65 72 0a 0a 5b 64 65 66 20 5b 61  ntifier..[def [a
7630: 72 67 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65  rg session_ticke
7640: 74 5d 5d 0a 54 69 63 6b 65 74 20 69 73 20 74 68  t]].Ticket is th
7650: 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74  e session ticket
7660: 20 69 6e 66 6f 0a 0a 5b 64 65 66 20 5b 61 72 67   info..[def [arg
7670: 20 6c 69 66 65 74 69 6d 65 5d 5d 0a 4c 69 66 65   lifetime]].Life
7680: 74 69 6d 65 20 69 73 20 74 68 65 20 74 69 63 6b  time is the tick
7690: 65 74 20 6c 69 66 65 74 69 6d 65 20 69 6e 20 73  et lifetime in s
76a0: 65 63 6f 6e 64 73 2e 0a 0a 5b 6c 69 73 74 5f 65  econds...[list_e
76b0: 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 76 65  nd]..[opt_def ve
76c0: 72 69 66 79 20 5b 61 72 67 20 22 63 68 61 6e 6e  rify [arg "chann
76d0: 65 6c 49 64 20 64 65 70 74 68 20 63 65 72 74 20  elId depth cert 
76e0: 73 74 61 74 75 73 20 65 72 72 6f 72 22 5d 5d 0a  status error"]].
76f0: 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 61  This callback wa
7700: 73 20 6d 6f 76 65 64 20 74 6f 20 5b 6f 70 74 69  s moved to [opti
7710: 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d  on -validatecomm
7720: 61 6e 64 5d 20 69 6e 20 54 63 6c 54 4c 53 20 31  and] in TclTLS 1
7730: 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  .8...[list_end].
7740: 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56 61  .[subsection "Va
7750: 6c 75 65 73 20 66 6f 72 20 50 61 73 73 77 6f 72  lues for Passwor
7760: 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68  d Callback"]..Th
7770: 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74  e callback for t
7780: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73  he [option -pass
7790: 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20  word] option is 
77a0: 69 6e 76 6f 6b 65 64 20 62 79 20 54 63 6c 54 4c  invoked by TclTL
77b0: 53 20 77 68 65 6e 65 76 65 72 20 4f 70 65 6e 53  S whenever OpenS
77c0: 53 4c 20 6e 65 65 64 73 0a 74 6f 20 6f 62 74 61  SL needs.to obta
77d0: 69 6e 20 61 20 70 61 73 73 77 6f 72 64 2e 20 53  in a password. S
77e0: 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 74 68 65  ee below for the
77f0: 20 70 6f 73 73 69 62 6c 65 20 61 72 67 75 6d 65   possible argume
7800: 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20 74 68  nts passed to th
7810: 65 0a 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70  e.callback scrip
7820: 74 2e 20 54 68 65 20 75 73 65 72 20 70 72 6f 76  t. The user prov
7830: 69 64 65 64 20 70 61 73 73 77 6f 72 64 20 69 73  ided password is
7840: 20 65 78 70 65 63 74 65 64 20 74 6f 20 62 65 20   expected to be 
7850: 72 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 0a  returned by the.
7860: 63 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6c 69 73 74  callback...[list
7870: 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a  _begin options].
7880: 0a 5b 6f 70 74 5f 64 65 66 20 70 61 73 73 77 6f  .[opt_def passwo
7890: 72 64 20 5b 61 72 67 20 22 72 77 66 6c 61 67 20  rd [arg "rwflag 
78a0: 73 69 7a 65 22 5d 5d 0a 49 6e 76 6f 6b 65 64 20  size"]].Invoked 
78b0: 77 68 65 6e 20 6c 6f 61 64 69 6e 67 20 6f 72 20  when loading or 
78c0: 73 74 6f 72 69 6e 67 20 61 6e 20 65 6e 63 72 79  storing an encry
78d0: 70 74 65 64 20 50 45 4d 20 63 65 72 74 69 66 69  pted PEM certifi
78e0: 63 61 74 65 2e 20 54 68 65 20 61 72 67 75 6d 65  cate. The argume
78f0: 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f  nts are:..[list_
7900: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
7910: 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 72 77  s]..[def [arg rw
7920: 66 6c 61 67 5d 5d 0a 54 68 65 20 72 65 61 64 2f  flag]].The read/
7930: 77 72 69 74 65 20 66 6c 61 67 20 69 73 20 30 20  write flag is 0 
7940: 66 6f 72 20 72 65 61 64 69 6e 67 2f 64 65 63 72  for reading/decr
7950: 79 70 74 69 6f 6e 20 6f 72 20 31 20 66 6f 72 20  yption or 1 for 
7960: 77 72 69 74 69 6e 67 2f 65 6e 63 72 79 70 74 69  writing/encrypti
7970: 6f 6e 2e 0a 54 68 65 20 6c 61 74 74 65 72 20 63  on..The latter c
7980: 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 64 65  an be used to de
7990: 74 65 72 6d 69 6e 65 20 77 68 65 6e 20 74 6f 20  termine when to 
79a0: 70 72 6f 6d 70 74 20 74 68 65 20 75 73 65 72 20  prompt the user 
79b0: 74 6f 20 63 6f 6e 66 69 72 6d 2e 0a 54 68 69 73  to confirm..This
79c0: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77   argument is new
79d0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
79e0: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 69 7a 65  ..[def [arg size
79f0: 5d 5d 0a 54 68 65 20 73 69 7a 65 20 69 73 20 74  ]].The size is t
7a00: 68 65 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74  he maximum lengt
7a10: 68 20 6f 66 20 74 68 65 20 70 61 73 73 77 6f 72  h of the passwor
7a20: 64 20 69 6e 20 62 79 74 65 73 2e 0a 54 68 69 73  d in bytes..This
7a30: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77   argument is new
7a40: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
7a50: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6c  ..[list_end]..[l
7a60: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65  ist_end]..[subse
7a70: 63 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f  ction "Values fo
7a80: 72 20 56 61 6c 69 64 61 74 65 20 43 6f 6d 6d 61  r Validate Comma
7a90: 6e 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54  nd Callback"]..T
7aa0: 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20  he callback for 
7ab0: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c  the [option -val
7ac0: 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70  idatecommand] op
7ad0: 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20  tion is invoked 
7ae0: 64 75 72 69 6e 67 20 74 68 65 20 68 61 6e 64 73  during the hands
7af0: 68 61 6b 65 0a 70 72 6f 63 65 73 73 20 69 6e 20  hake.process in 
7b00: 6f 72 64 65 72 20 66 6f 72 20 74 68 65 20 61 70  order for the ap
7b10: 70 6c 69 63 61 74 69 6f 6e 20 74 6f 20 76 61 6c  plication to val
7b20: 69 64 61 74 65 20 74 68 65 20 70 72 6f 76 69 64  idate the provid
7b30: 65 64 20 76 61 6c 75 65 28 73 29 2e 20 53 65 65  ed value(s). See
7b40: 0a 62 65 6c 6f 77 20 66 6f 72 20 74 68 65 20 70  .below for the p
7b50: 6f 73 73 69 62 6c 65 20 61 72 67 75 6d 65 6e 74  ossible argument
7b60: 73 20 70 61 73 73 65 64 20 74 6f 20 74 68 65 20  s passed to the 
7b70: 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 2e  callback script.
7b80: 20 49 66 20 6e 6f 74 0a 73 70 65 63 69 66 69 65   If not.specifie
7b90: 64 2c 20 4f 70 65 6e 53 53 4c 20 77 69 6c 6c 20  d, OpenSSL will 
7ba0: 61 63 63 65 70 74 20 61 6c 6c 20 76 61 6c 69 64  accept all valid
7bb0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61 6e   certificates an
7bc0: 64 20 65 78 74 65 6e 73 69 6f 6e 73 2e 20 54 6f  d extensions. To
7bd0: 20 72 65 6a 65 63 74 0a 74 68 65 20 76 61 6c 75   reject.the valu
7be0: 65 20 61 6e 64 20 61 62 6f 72 74 20 74 68 65 20  e and abort the 
7bf0: 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 74 68 65 20  connection, the 
7c00: 63 61 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20  callback should 
7c10: 72 65 74 75 72 6e 20 30 2e 20 54 6f 20 61 63 63  return 0. To acc
7c20: 65 70 74 20 74 68 65 0a 76 61 6c 75 65 20 61 6e  ept the.value an
7c30: 64 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 63  d continue the c
7c40: 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 74 20 73 68  onnection, it sh
7c50: 6f 75 6c 64 20 72 65 74 75 72 6e 20 31 2e 20 54  ould return 1. T
7c60: 6f 20 72 65 6a 65 63 74 20 74 68 65 20 76 61 6c  o reject the val
7c70: 75 65 2c 20 62 75 74 0a 63 6f 6e 74 69 6e 75 65  ue, but.continue
7c80: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c   the connection,
7c90: 20 69 74 20 73 68 6f 75 6c 64 20 72 65 74 75 72   it should retur
7ca0: 6e 20 32 2e 20 54 68 69 73 20 63 61 6c 6c 62 61  n 2. This callba
7cb0: 63 6b 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ck is new for Tc
7cc0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74  lTLS 1.8...[list
7cd0: 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a  _begin options].
7ce0: 0a 5b 6f 70 74 5f 64 65 66 20 61 6c 70 6e 20 5b  .[opt_def alpn [
7cf0: 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 70  arg "channelId p
7d00: 72 6f 74 6f 63 6f 6c 20 6d 61 74 63 68 22 5d 5d  rotocol match"]]
7d10: 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68  .For servers, th
7d20: 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62  is form of callb
7d30: 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77  ack is invoked w
7d40: 68 65 6e 20 74 68 65 20 63 6c 69 65 6e 74 20 41  hen the client A
7d50: 4c 50 4e 20 65 78 74 65 6e 73 69 6f 6e 20 69 73  LPN extension is
7d60: 0a 72 65 63 65 69 76 65 64 2e 20 49 66 20 5b 61  .received. If [a
7d70: 72 67 20 6d 61 74 63 68 5d 20 69 73 20 74 72 75  rg match] is tru
7d80: 65 2c 20 74 68 65 6e 20 5b 61 72 67 20 70 72 6f  e, then [arg pro
7d90: 74 6f 63 6f 6c 5d 20 69 73 20 74 68 65 20 66 69  tocol] is the fi
7da0: 72 73 74 0a 5b 6f 70 74 69 6f 6e 20 2d 61 6c 70  rst.[option -alp
7db0: 6e 5d 20 70 72 6f 74 6f 63 6f 6c 20 6f 70 74 69  n] protocol opti
7dc0: 6f 6e 20 69 6e 20 63 6f 6d 6d 6f 6e 20 74 6f 20  on in common to 
7dd0: 62 6f 74 68 20 74 68 65 20 63 6c 69 65 6e 74 20  both the client 
7de0: 61 6e 64 20 73 65 72 76 65 72 2e 0a 49 66 20 6e  and server..If n
7df0: 6f 74 2c 20 74 68 65 20 66 69 72 73 74 20 63 6c  ot, the first cl
7e00: 69 65 6e 74 20 73 70 65 63 69 66 69 65 64 20 70  ient specified p
7e10: 72 6f 74 6f 63 6f 6c 20 69 73 20 75 73 65 64 2e  rotocol is used.
7e20: 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69   This callback i
7e30: 73 20 63 61 6c 6c 65 64 0a 61 66 74 65 72 20 74  s called.after t
7e40: 68 65 20 48 65 6c 6c 6f 20 61 6e 64 20 53 4e 49  he Hello and SNI
7e50: 20 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f 70   callbacks...[op
7e60: 74 5f 64 65 66 20 68 65 6c 6c 6f 20 5b 61 72 67  t_def hello [arg
7e70: 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 72 76   "channelId serv
7e80: 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f 72 20 73 65  ername"]].For se
7e90: 72 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72 6d  rvers, this form
7ea0: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20   of callback is 
7eb0: 69 6e 76 6f 6b 65 64 20 64 75 72 69 6e 67 20 63  invoked during c
7ec0: 6c 69 65 6e 74 20 68 65 6c 6c 6f 20 6d 65 73 73  lient hello mess
7ed0: 61 67 65 0a 70 72 6f 63 65 73 73 69 6e 67 2e 20  age.processing. 
7ee0: 54 68 65 20 70 75 72 70 6f 73 65 20 69 73 20 73  The purpose is s
7ef0: 6f 20 74 68 65 20 73 65 72 76 65 72 20 63 61 6e  o the server can
7f00: 20 73 65 6c 65 63 74 20 74 68 65 20 61 70 70 72   select the appr
7f10: 6f 70 72 69 61 74 65 20 63 65 72 74 69 66 69 63  opriate certific
7f20: 61 74 65 0a 74 6f 20 70 72 65 73 65 6e 74 20 74  ate.to present t
7f30: 6f 20 74 68 65 20 63 6c 69 65 6e 74 2c 20 61 6e  o the client, an
7f40: 64 20 74 6f 20 6d 61 6b 65 20 6f 74 68 65 72 20  d to make other 
7f50: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 61 64  configuration ad
7f60: 6a 75 73 74 6d 65 6e 74 73 20 72 65 6c 65 76 61  justments releva
7f70: 6e 74 0a 74 6f 20 74 68 61 74 20 73 65 72 76 65  nt.to that serve
7f80: 72 20 6e 61 6d 65 20 61 6e 64 20 69 74 73 20 63  r name and its c
7f90: 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 20 49 74  onfiguration. It
7fa0: 20 69 73 20 63 61 6c 6c 65 64 20 62 65 66 6f 72   is called befor
7fb0: 65 20 74 68 65 20 53 4e 49 20 61 6e 64 20 41 4c  e the SNI and AL
7fc0: 50 4e 0a 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b  PN.callbacks...[
7fd0: 6f 70 74 5f 64 65 66 20 73 6e 69 20 5b 61 72 67  opt_def sni [arg
7fe0: 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 72 76   "channelId serv
7ff0: 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f 72 20 73 65  ername"]].For se
8000: 72 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72 6d  rvers, this form
8010: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20   of callback is 
8020: 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 74 68 65  invoked when the
8030: 20 53 65 72 76 65 72 20 4e 61 6d 65 20 49 6e 64   Server Name Ind
8040: 69 63 61 74 69 6f 6e 0a 28 53 4e 49 29 20 65 78  ication.(SNI) ex
8050: 74 65 6e 73 69 6f 6e 20 69 73 20 72 65 63 65 69  tension is recei
8060: 76 65 64 2e 20 54 68 65 20 5b 61 72 67 20 73 65  ved. The [arg se
8070: 72 76 65 72 6e 61 6d 65 5d 20 61 72 67 75 6d 65  rvername] argume
8080: 6e 74 20 69 73 20 74 68 65 20 63 6c 69 65 6e 74  nt is the client
8090: 0a 70 72 6f 76 69 64 65 64 20 73 65 72 76 65 72  .provided server
80a0: 20 6e 61 6d 65 20 73 70 65 63 69 66 69 65 64 20   name specified 
80b0: 69 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  in the [option -
80c0: 73 65 72 76 65 72 6e 61 6d 65 5d 20 6f 70 74 69  servername] opti
80d0: 6f 6e 2e 20 54 68 65 0a 70 75 72 70 6f 73 65 20  on. The.purpose 
80e0: 69 73 20 73 6f 20 77 68 65 6e 20 61 20 73 65 72  is so when a ser
80f0: 76 65 72 20 73 75 70 70 6f 72 74 73 20 6d 75 6c  ver supports mul
8100: 74 69 70 6c 65 20 6e 61 6d 65 73 2c 20 74 68 65  tiple names, the
8110: 20 72 69 67 68 74 20 63 65 72 74 69 66 69 63 61   right certifica
8120: 74 65 0a 63 61 6e 20 62 65 20 75 73 65 64 2e 20  te.can be used. 
8130: 49 74 20 69 73 20 63 61 6c 6c 65 64 20 61 66 74  It is called aft
8140: 65 72 20 74 68 65 20 48 65 6c 6c 6f 20 63 61 6c  er the Hello cal
8150: 6c 62 61 63 6b 20 62 75 74 20 62 65 66 6f 72 65  lback but before
8160: 20 74 68 65 20 41 4c 50 4e 0a 63 61 6c 6c 62 61   the ALPN.callba
8170: 63 6b 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 76 65  ck...[opt_def ve
8180: 72 69 66 79 20 5b 61 72 67 20 22 63 68 61 6e 6e  rify [arg "chann
8190: 65 6c 49 64 20 64 65 70 74 68 20 63 65 72 74 20  elId depth cert 
81a0: 73 74 61 74 75 73 20 65 72 72 6f 72 22 5d 5d 0a  status error"]].
81b0: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
81c0: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
81d0: 20 62 79 20 4f 70 65 6e 53 53 4c 20 77 68 65 6e   by OpenSSL when
81e0: 20 61 20 6e 65 77 20 63 65 72 74 69 66 69 63 61   a new certifica
81f0: 74 65 20 69 73 20 72 65 63 65 69 76 65 64 0a 66  te is received.f
8200: 72 6f 6d 20 74 68 65 20 70 65 65 72 2e 20 49 74  rom the peer. It
8210: 20 61 6c 6c 6f 77 73 20 74 68 65 20 63 6c 69 65   allows the clie
8220: 6e 74 20 74 6f 20 63 68 65 63 6b 20 74 68 65 20  nt to check the 
8230: 63 65 72 74 69 66 69 63 61 74 65 20 76 65 72 69  certificate veri
8240: 66 69 63 61 74 69 6f 6e 0a 72 65 73 75 6c 74 73  fication.results
8250: 20 61 6e 64 20 63 68 6f 6f 73 65 20 77 68 65 74   and choose whet
8260: 68 65 72 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20  her to continue 
8270: 6f 72 20 6e 6f 74 2e 20 49 74 20 69 73 20 63 61  or not. It is ca
8280: 6c 6c 65 64 20 66 6f 72 20 65 61 63 68 0a 63 65  lled for each.ce
8290: 72 74 69 66 69 63 61 74 65 20 69 6e 20 74 68 65  rtificate in the
82a0: 20 63 65 72 74 69 66 69 63 61 74 65 20 63 68 61   certificate cha
82b0: 69 6e 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63  in. This callbac
82c0: 6b 20 77 61 73 20 6d 6f 76 65 64 20 66 72 6f 6d  k was moved from
82d0: 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e  .[option -comman
82e0: 64 5d 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38  d] in TclTLS 1.8
82f0: 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20  . The arguments 
8300: 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  are:..[list_begi
8310: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a  n definitions]..
8320: 5b 64 65 66 20 5b 61 72 67 20 64 65 70 74 68 5d  [def [arg depth]
8330: 5d 0a 54 68 65 20 64 65 70 74 68 20 69 73 20 74  ].The depth is t
8340: 68 65 20 69 6e 74 65 67 65 72 20 64 65 70 74 68  he integer depth
8350: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
8360: 61 74 65 20 69 6e 20 74 68 65 20 63 65 72 74 69  ate in the certi
8370: 66 69 63 61 74 65 20 63 68 61 69 6e 2c 0a 77 68  ficate chain,.wh
8380: 65 72 65 20 30 20 69 73 20 74 68 65 20 70 65 65  ere 0 is the pee
8390: 72 20 63 65 72 74 69 66 69 63 61 74 65 20 61 6e  r certificate an
83a0: 64 20 68 69 67 68 65 72 20 76 61 6c 75 65 73 20  d higher values 
83b0: 67 6f 69 6e 67 20 75 70 20 74 6f 20 74 68 65 20  going up to the 
83c0: 43 65 72 74 69 66 69 63 61 74 65 0a 41 75 74 68  Certificate.Auth
83d0: 6f 72 69 74 79 20 28 43 41 29 2e 0a 0a 5b 64 65  ority (CA)...[de
83e0: 66 20 5b 61 72 67 20 63 65 72 74 5d 5d 0a 54 68  f [arg cert]].Th
83f0: 65 20 63 65 72 74 20 61 72 67 75 6d 65 6e 74 20  e cert argument 
8400: 69 73 20 61 20 6c 69 73 74 20 6f 66 20 6b 65 79  is a list of key
8410: 2d 76 61 6c 75 65 20 70 61 69 72 73 20 73 69 6d  -value pairs sim
8420: 69 6c 61 72 20 74 6f 20 74 68 6f 73 65 20 72 65  ilar to those re
8430: 74 75 72 6e 65 64 20 62 79 0a 5b 63 6d 64 20 74  turned by.[cmd t
8440: 6c 73 3a 3a 73 74 61 74 75 73 5d 2e 0a 0a 5b 64  ls::status]...[d
8450: 65 66 20 5b 61 72 67 20 73 74 61 74 75 73 5d 5d  ef [arg status]]
8460: 0a 54 68 65 20 73 74 61 74 75 73 20 61 72 67 75  .The status argu
8470: 6d 65 6e 74 20 69 73 20 74 68 65 20 62 6f 6f 6c  ment is the bool
8480: 65 61 6e 20 76 61 6c 69 64 69 74 79 20 6f 66 20  ean validity of 
8490: 74 68 65 20 63 75 72 72 65 6e 74 20 63 65 72 74  the current cert
84a0: 69 66 69 63 61 74 65 20 77 68 65 72 65 20 30 0a  ificate where 0.
84b0: 69 73 20 69 6e 76 61 6c 69 64 20 61 6e 64 20 31  is invalid and 1
84c0: 20 69 73 20 76 61 6c 69 64 2e 0a 0a 5b 64 65 66   is valid...[def
84d0: 20 5b 61 72 67 20 65 72 72 6f 72 5d 5d 0a 54 68   [arg error]].Th
84e0: 65 20 65 72 72 6f 72 20 61 72 67 75 6d 65 6e 74  e error argument
84f0: 20 69 73 20 74 68 65 20 65 72 72 6f 72 20 6d 65   is the error me
8500: 73 73 61 67 65 2c 20 69 66 20 61 6e 79 2c 20 67  ssage, if any, g
8510: 65 6e 65 72 61 74 65 64 20 62 79 0a 5b 66 75 6e  enerated by.[fun
8520: 20 58 35 30 39 5f 53 54 4f 52 45 5f 43 54 58 5f   X509_STORE_CTX_
8530: 67 65 74 5f 65 72 72 6f 72 28 29 5d 2e 0a 0a 5b  get_error()]...[
8540: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74  list_end]..[list
8550: 5f 65 6e 64 5d 0a 0a 52 65 66 65 72 65 6e 63 65  _end]..Reference
8560: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73   implementations
8570: 20 6f 66 20 74 68 65 73 65 20 63 61 6c 6c 62 61   of these callba
8580: 63 6b 73 20 61 72 65 20 70 72 6f 76 69 64 65 64  cks are provided
8590: 20 69 6e 20 5b 66 69 6c 65 20 74 6c 73 2e 74 63   in [file tls.tc
85a0: 6c 5d 0a 61 73 20 5b 63 6d 64 20 74 6c 73 3a 3a  l].as [cmd tls::
85b0: 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20  callback], [cmd 
85c0: 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 20  tls::password], 
85d0: 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61  and [cmd tls::va
85e0: 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 0a  lidate_command].
85f0: 72 65 73 70 65 63 74 69 76 65 6c 79 2e 20 4e 6f  respectively. No
8600: 74 65 20 74 68 61 74 20 74 68 65 73 65 20 61 72  te that these ar
8610: 65 20 6f 6e 6c 79 20 5b 65 6d 70 68 20 73 61 6d  e only [emph sam
8620: 70 6c 65 5d 20 69 6d 70 6c 65 6d 65 6e 74 61 74  ple] implementat
8630: 69 6f 6e 73 2e 20 49 6e 20 61 20 6d 6f 72 65 0a  ions. In a more.
8640: 72 65 61 6c 69 73 74 69 63 20 64 65 70 6c 6f 79  realistic deploy
8650: 6d 65 6e 74 20 79 6f 75 20 77 6f 75 6c 64 20 73  ment you would s
8660: 70 65 63 69 66 79 20 79 6f 75 72 20 6f 77 6e 20  pecify your own 
8670: 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 73  callback scripts
8680: 20 6f 6e 20 65 61 63 68 20 54 4c 53 0a 63 68 61   on each TLS.cha
8690: 6e 6e 65 6c 20 75 73 69 6e 67 20 74 68 65 20 5b  nnel using the [
86a0: 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d  option -command]
86b0: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77  , [option -passw
86c0: 6f 72 64 5d 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f  ord], and.[optio
86d0: 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d  n -validate_comm
86e0: 61 6e 64 5d 20 6f 70 74 69 6f 6e 73 2e 0a 0a 5b  and] options...[
86f0: 70 61 72 61 5d 0a 0a 54 68 65 20 64 65 66 61 75  para]..The defau
8700: 6c 74 20 62 65 68 61 76 69 6f 72 20 77 68 65 6e  lt behavior when
8710: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f   the [option -co
8720: 6d 6d 61 6e 64 5d 20 61 6e 64 20 5b 6f 70 74 69  mmand] and [opti
8730: 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d  on -validate_com
8740: 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e 73 20 61 72  mand].options ar
8750: 65 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64 2c  e not specified,
8760: 20 69 73 20 66 6f 72 20 54 63 6c 54 4c 53 20 74   is for TclTLS t
8770: 6f 20 70 72 6f 63 65 73 73 20 74 68 65 20 61 73  o process the as
8780: 73 6f 63 69 61 74 65 64 20 6c 69 62 72 61 72 79  sociated library
8790: 0a 63 61 6c 6c 62 61 63 6b 73 20 69 6e 74 65 72  .callbacks inter
87a0: 6e 61 6c 6c 79 2e 20 54 68 65 20 64 65 66 61 75  nally. The defau
87b0: 6c 74 20 62 65 68 61 76 69 6f 72 20 77 68 65 6e  lt behavior when
87c0: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 61   the [option -pa
87d0: 73 73 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 0a 69  ssword] option.i
87e0: 73 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64 20  s not specified 
87f0: 69 73 20 66 6f 72 20 54 63 6c 54 4c 53 20 74 6f  is for TclTLS to
8800: 20 70 72 6f 63 65 73 73 20 74 68 65 20 61 73 73   process the ass
8810: 6f 63 69 61 74 65 64 20 6c 69 62 72 61 72 79 20  ociated library 
8820: 63 61 6c 6c 62 61 63 6b 73 20 62 79 0a 61 74 74  callbacks by.att
8830: 65 6d 70 74 69 6e 67 20 74 6f 20 63 61 6c 6c 20  empting to call 
8840: 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f  [cmd tls::passwo
8850: 72 64 5d 2e 20 54 68 65 20 64 69 66 66 65 72 65  rd]. The differe
8860: 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65 73  nce between thes
8870: 65 20 74 77 6f 0a 62 65 68 61 76 69 6f 72 73 20  e two.behaviors 
8880: 69 73 20 61 20 63 6f 6e 73 65 71 75 65 6e 63 65  is a consequence
8890: 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20   of maintaining 
88a0: 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 77 69  compatibility wi
88b0: 74 68 20 65 61 72 6c 69 65 72 0a 69 6d 70 6c 65  th earlier.imple
88c0: 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a 0a 5b 70 61  mentations...[pa
88d0: 72 61 5d 0a 0a 5b 65 6d 70 68 20 22 54 68 65 20  ra]..[emph "The 
88e0: 75 73 65 20 6f 66 20 74 68 65 20 72 65 66 65 72  use of the refer
88f0: 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73 20 5b  ence callbacks [
8900: 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63  cmd tls::callbac
8910: 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61  k], [cmd tls::pa
8920: 73 73 77 6f 72 64 5d 2c 0a 61 6e 64 20 5b 63 6d  ssword],.and [cm
8930: 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f  d tls::validate_
8940: 63 6f 6d 6d 61 6e 64 5d 20 69 73 20 6e 6f 74 20  command] is not 
8950: 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 20 54 68 65  recommended. The
8960: 79 20 6d 61 79 20 62 65 20 72 65 6d 6f 76 65 64  y may be removed
8970: 20 66 72 6f 6d 20 66 75 74 75 72 65 20 72 65 6c   from future rel
8980: 65 61 73 65 73 2e 22 5d 0a 0a 5b 73 65 63 74 69  eases."]..[secti
8990: 6f 6e 20 44 65 62 75 67 5d 0a 0a 46 6f 72 20 6d  on Debug]..For m
89a0: 6f 73 74 20 64 65 62 75 67 67 69 6e 67 20 6e 65  ost debugging ne
89b0: 65 64 73 2c 20 74 68 65 20 5b 6f 70 74 69 6f 6e  eds, the [option
89c0: 20 2d 63 61 6c 6c 62 61 63 6b 5d 20 6f 70 74 69   -callback] opti
89d0: 6f 6e 20 63 61 6e 20 62 65 20 75 73 65 64 20 74  on can be used t
89e0: 6f 20 70 72 6f 76 69 64 65 0a 73 75 66 66 69 63  o provide.suffic
89f0: 69 65 6e 74 20 69 6e 73 69 67 68 74 20 61 6e 64  ient insight and
8a00: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20   information on 
8a10: 74 68 65 20 54 4c 53 20 68 61 6e 64 73 68 61 6b  the TLS handshak
8a20: 65 20 61 6e 64 20 70 72 6f 67 72 65 73 73 2e 20  e and progress. 
8a30: 49 66 0a 66 75 72 74 68 65 72 20 74 72 6f 75 62  If.further troub
8a40: 6c 65 73 68 6f 6f 74 69 6e 67 20 69 6e 73 69 67  leshooting insig
8a50: 68 74 20 69 73 20 6e 65 65 64 65 64 2c 20 74 68  ht is needed, th
8a60: 65 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 20 6f  e compile time o
8a70: 70 74 69 6f 6e 0a 5b 6f 70 74 69 6f 6e 20 2d 2d  ption.[option --
8a80: 65 6e 61 62 6c 65 2d 64 65 62 75 67 5d 20 63 61  enable-debug] ca
8a90: 6e 20 62 65 20 75 73 65 64 20 74 6f 20 67 65 74  n be used to get
8aa0: 20 64 65 74 61 69 6c 65 64 20 65 78 65 63 75 74   detailed execut
8ab0: 69 6f 6e 20 66 6c 6f 77 20 73 74 61 74 75 73 2e  ion flow status.
8ac0: 0a 0a 5b 70 61 72 61 5d 0a 0a 54 4c 53 20 6b 65  ..[para]..TLS ke
8ad0: 79 20 6c 6f 67 67 69 6e 67 20 63 61 6e 20 62 65  y logging can be
8ae0: 20 65 6e 61 62 6c 65 64 20 62 79 20 73 65 74 74   enabled by sett
8af0: 69 6e 67 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d  ing the environm
8b00: 65 6e 74 20 76 61 72 69 61 62 6c 65 0a 5b 76 61  ent variable.[va
8b10: 72 20 53 53 4c 4b 45 59 4c 4f 47 46 49 4c 45 5d  r SSLKEYLOGFILE]
8b20: 20 74 6f 20 74 68 65 20 6e 61 6d 65 20 6f 66 20   to the name of 
8b30: 74 68 65 20 66 69 6c 65 20 74 6f 20 6c 6f 67 20  the file to log 
8b40: 74 6f 2e 20 54 68 65 6e 20 77 68 65 6e 65 76 65  to. Then wheneve
8b50: 72 20 54 4c 53 20 6b 65 79 0a 6d 61 74 65 72 69  r TLS key.materi
8b60: 61 6c 20 69 73 20 67 65 6e 65 72 61 74 65 64 20  al is generated 
8b70: 6f 72 20 72 65 63 65 69 76 65 64 20 69 74 20 77  or received it w
8b80: 69 6c 6c 20 62 65 20 6c 6f 67 67 65 64 20 74 6f  ill be logged to
8b90: 20 74 68 65 20 66 69 6c 65 2e 20 54 68 69 73 20   the file. This 
8ba0: 69 73 20 75 73 65 66 75 6c 0a 66 6f 72 20 6c 6f  is useful.for lo
8bb0: 67 67 69 6e 67 20 6b 65 79 20 64 61 74 61 20 66  gging key data f
8bc0: 6f 72 20 6e 65 74 77 6f 72 6b 20 6c 6f 67 67 69  or network loggi
8bd0: 6e 67 20 74 6f 6f 6c 73 20 74 6f 20 75 73 65 20  ng tools to use 
8be0: 74 6f 20 64 65 63 72 79 70 74 20 74 68 65 20 64  to decrypt the d
8bf0: 61 74 61 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68  ata...[para]..Th
8c00: 65 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62 75  e [var tls::debu
8c10: 67 5d 20 76 61 72 69 61 62 6c 65 20 70 72 6f 76  g] variable prov
8c20: 69 64 65 73 20 73 6f 6d 65 20 61 64 64 69 74 69  ides some additi
8c30: 6f 6e 61 6c 20 63 6f 6e 74 72 6f 6c 20 6f 76 65  onal control ove
8c40: 72 20 74 68 65 0a 64 65 62 75 67 20 6c 6f 67 67  r the.debug logg
8c50: 69 6e 67 20 69 6e 20 74 68 65 20 5b 63 6d 64 20  ing in the [cmd 
8c60: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20  tls::callback], 
8c70: 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f  [cmd tls::passwo
8c80: 72 64 5d 2c 20 61 6e 64 0a 5b 63 6d 64 20 74 6c  rd], and.[cmd tl
8c90: 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d  s::validate_comm
8ca0: 61 6e 64 5d 20 64 65 66 61 75 6c 74 20 68 61 6e  and] default han
8cb0: 64 6c 65 72 73 20 69 6e 20 5b 66 69 6c 65 20 74  dlers in [file t
8cc0: 6c 73 2e 74 63 6c 5d 2e 0a 54 68 65 20 64 65 66  ls.tcl]..The def
8cd0: 61 75 6c 74 20 76 61 6c 75 65 20 69 73 20 30 20  ault value is 0 
8ce0: 77 69 74 68 20 68 69 67 68 65 72 20 76 61 6c 75  with higher valu
8cf0: 65 73 20 70 72 6f 64 75 63 69 6e 67 20 6d 6f 72  es producing mor
8d00: 65 20 64 69 61 67 6e 6f 73 74 69 63 20 6f 75 74  e diagnostic out
8d10: 70 75 74 2c 0a 61 6e 64 20 77 69 6c 6c 20 61 6c  put,.and will al
8d20: 73 6f 20 66 6f 72 63 65 20 74 68 65 20 76 65 72  so force the ver
8d30: 69 66 79 20 6d 65 74 68 6f 64 20 69 6e 20 5b 63  ify method in [c
8d40: 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b  md tls::callback
8d50: 5d 20 74 6f 20 61 63 63 65 70 74 20 74 68 65 0a  ] to accept the.
8d60: 63 65 72 74 69 66 69 63 61 74 65 2c 20 65 76 65  certificate, eve
8d70: 6e 20 69 66 20 69 74 20 69 73 20 69 6e 76 61 6c  n if it is inval
8d80: 69 64 20 77 68 65 6e 20 74 68 65 20 5b 6f 70 74  id when the [opt
8d90: 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d  ion -validatecom
8da0: 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e 20 69 73 20  mand].option is 
8db0: 73 65 74 20 74 6f 20 5b 63 6d 64 20 74 6c 73 3a  set to [cmd tls:
8dc0: 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e  :validate_comman
8dd0: 64 5d 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d  d]...[para]..[em
8de0: 70 68 20 22 54 68 65 20 75 73 65 20 6f 66 20 74  ph "The use of t
8df0: 68 65 20 76 61 72 69 61 62 6c 65 20 5b 76 61 72  he variable [var
8e00: 20 74 6c 73 3a 3a 64 65 62 75 67 5d 20 69 73 20   tls::debug] is 
8e10: 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e  not recommended.
8e20: 0a 49 74 20 6d 61 79 20 62 65 20 72 65 6d 6f 76  .It may be remov
8e30: 65 64 20 66 72 6f 6d 20 66 75 74 75 72 65 20 72  ed from future r
8e40: 65 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b 73 65 63  eleases."]..[sec
8e50: 74 69 6f 6e 20 22 45 78 61 6d 70 6c 65 73 22 5d  tion "Examples"]
8e60: 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20  ..The following 
8e70: 61 72 65 20 65 78 61 6d 70 6c 65 20 73 63 72 69  are example scri
8e80: 70 74 73 20 74 6f 20 64 6f 77 6e 6c 6f 61 64 20  pts to download 
8e90: 61 20 77 65 62 70 61 67 65 20 61 6e 64 20 66 69  a webpage and fi
8ea0: 6c 65 20 75 73 69 6e 67 20 74 68 65 0a 68 74 74  le using the.htt
8eb0: 70 20 70 61 63 6b 61 67 65 2e 20 53 65 65 20 5b  p package. See [
8ec0: 73 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69  sectref "Certifi
8ed0: 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22  cate Validation"
8ee0: 5d 20 66 6f 72 20 77 68 65 6e 20 74 68 65 0a 5b  ] for when the.[
8ef0: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20  option -cadir], 
8f00: 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d  [option -cafile]
8f10: 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63  , and [option -c
8f20: 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20  astore] options 
8f30: 61 72 65 20 61 6c 73 6f 0a 6e 65 65 64 65 64 2e  are also.needed.
8f40: 20 53 65 65 20 74 68 65 20 5b 66 69 6c 65 20 64   See the [file d
8f50: 65 6d 6f 73 5d 20 64 69 72 65 63 74 6f 72 79 20  emos] directory 
8f60: 66 6f 72 20 6d 6f 72 65 20 65 78 61 6d 70 6c 65  for more example
8f70: 20 73 63 72 69 70 74 73 2e 0a 0a 5b 70 61 72 61   scripts...[para
8f80: 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 31 3a 20 44  ]..Example #1: D
8f90: 6f 77 6e 6c 6f 61 64 20 61 20 77 65 62 20 70 61  ownload a web pa
8fa0: 67 65 0a 0a 5b 65 78 61 6d 70 6c 65 20 7b 0a 0a  ge..[example {..
8fb0: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
8fc0: 68 74 74 70 0a 70 61 63 6b 61 67 65 20 72 65 71  http.package req
8fd0: 75 69 72 65 20 74 6c 73 0a 0a 73 65 74 20 75 72  uire tls..set ur
8fe0: 6c 20 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 74  l "https://www.t
8ff0: 63 6c 2e 74 6b 2f 22 0a 68 74 74 70 3a 3a 72 65  cl.tk/".http::re
9000: 67 69 73 74 65 72 20 68 74 74 70 73 20 34 34 33  gister https 443
9010: 20 5b 6c 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f   [list ::tls::so
9020: 63 6b 65 74 20 2d 61 75 74 6f 73 65 72 76 65 72  cket -autoserver
9030: 6e 61 6d 65 20 31 20 2d 72 65 71 75 69 72 65 20  name 1 -require 
9040: 31 5d 0a 0a 23 20 47 65 74 20 55 52 4c 0a 73 65  1]..# Get URL.se
9050: 74 20 74 6f 6b 65 6e 20 5b 68 74 74 70 3a 3a 67  t token [http::g
9060: 65 74 75 72 6c 20 24 75 72 6c 5d 0a 0a 23 20 43  eturl $url]..# C
9070: 68 65 63 6b 20 66 6f 72 20 65 72 72 6f 72 0a 69  heck for error.i
9080: 66 20 7b 5b 68 74 74 70 3a 3a 73 74 61 74 75 73  f {[http::status
9090: 20 24 74 6f 6b 65 6e 5d 20 6e 65 20 22 6f 6b 22   $token] ne "ok"
90a0: 7d 20 7b 0a 20 20 20 20 70 75 74 73 20 5b 66 6f  } {.    puts [fo
90b0: 72 6d 61 74 20 22 45 72 72 6f 72 20 25 73 22 20  rmat "Error %s" 
90c0: 5b 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74  [http::status $t
90d0: 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23 20 53 61 76 65  oken]].}..# Save
90e0: 20 77 65 62 20 70 61 67 65 20 74 6f 20 66 69 6c   web page to fil
90f0: 65 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20 65  e.set ch [open e
9100: 78 61 6d 70 6c 65 2e 68 74 6d 6c 20 77 62 5d 0a  xample.html wb].
9110: 70 75 74 73 20 24 63 68 20 5b 68 74 74 70 3a 3a  puts $ch [http::
9120: 64 61 74 61 20 24 74 6f 6b 65 6e 5d 0a 63 6c 6f  data $token].clo
9130: 73 65 20 24 63 68 0a 0a 23 20 43 6c 65 61 6e 75  se $ch..# Cleanu
9140: 70 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65 61 6e 75  p.::http::cleanu
9150: 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 45 78 61  p $token.}]..Exa
9160: 6d 70 6c 65 20 23 32 3a 20 44 6f 77 6e 6c 6f 61  mple #2: Downloa
9170: 64 20 61 20 66 69 6c 65 0a 0a 5b 65 78 61 6d 70  d a file..[examp
9180: 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65  le {..package re
9190: 71 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61  quire http.packa
91a0: 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a  ge require tls..
91b0: 73 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f  set url "https:/
91c0: 2f 77 69 6b 69 2e 74 63 6c 2d 6c 61 6e 67 2e 6f  /wiki.tcl-lang.o
91d0: 72 67 2f 73 69 74 65 6d 61 70 2e 78 6d 6c 22 0a  rg/sitemap.xml".
91e0: 68 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20 68  http::register h
91f0: 74 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20 3a  ttps 443 [list :
9200: 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75  :tls::socket -au
9210: 74 6f 73 65 72 76 65 72 6e 61 6d 65 20 31 20 2d  toservername 1 -
9220: 72 65 71 75 69 72 65 20 31 5d 0a 0a 23 20 4f 70  require 1]..# Op
9230: 65 6e 20 6f 75 74 70 75 74 20 66 69 6c 65 0a 73  en output file.s
9240: 65 74 20 66 69 6c 65 6e 61 6d 65 20 5b 66 69 6c  et filename [fil
9250: 65 20 74 61 69 6c 20 24 75 72 6c 5d 0a 73 65 74  e tail $url].set
9260: 20 63 68 20 5b 6f 70 65 6e 20 24 66 69 6c 65 6e   ch [open $filen
9270: 61 6d 65 20 77 62 5d 0a 0a 23 20 47 65 74 20 66  ame wb]..# Get f
9280: 69 6c 65 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 3a  ile.set token [:
9290: 3a 68 74 74 70 3a 3a 67 65 74 75 72 6c 20 24 75  :http::geturl $u
92a0: 72 6c 20 2d 62 6c 6f 63 6b 73 69 7a 65 20 36 35  rl -blocksize 65
92b0: 35 33 36 20 2d 63 68 61 6e 6e 65 6c 20 24 63 68  536 -channel $ch
92c0: 5d 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20 65  ]..# Check for e
92d0: 72 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a 3a  rror.if {[http::
92e0: 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e  status $token] n
92f0: 65 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75  e "ok"} {.    pu
9300: 74 73 20 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f  ts [format "Erro
9310: 72 20 25 73 22 20 5b 68 74 74 70 3a 3a 73 74 61  r %s" [http::sta
9320: 74 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a  tus $token]].}..
9330: 23 20 43 6c 65 61 6e 75 70 0a 63 6c 6f 73 65 20  # Cleanup.close 
9340: 24 63 68 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65 61  $ch.::http::clea
9350: 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 5b  nup $token.}]..[
9360: 73 65 63 74 69 6f 6e 20 22 53 70 65 63 69 61 6c  section "Special
9370: 20 43 6f 6e 73 69 64 65 72 61 74 69 6f 6e 73 22   Considerations"
9380: 5d 0a 0a 54 68 65 20 63 61 70 61 62 69 6c 69 74  ]..The capabilit
9390: 69 65 73 20 6f 66 20 74 68 69 73 20 70 61 63 6b  ies of this pack
93a0: 61 67 65 20 63 61 6e 20 76 61 72 79 20 65 6e 6f  age can vary eno
93b0: 72 6d 6f 75 73 6c 79 20 62 61 73 65 64 20 75 70  rmously based up
93c0: 6f 6e 20 68 6f 77 20 74 68 65 0a 6c 69 6e 6b 65  on how the.linke
93d0: 64 20 74 6f 20 4f 70 65 6e 53 53 4c 20 6c 69 62  d to OpenSSL lib
93e0: 72 61 72 79 20 77 61 73 20 63 6f 6e 66 69 67 75  rary was configu
93f0: 72 65 64 20 61 6e 64 20 62 75 69 6c 74 2e 20 4e  red and built. N
9400: 65 77 20 76 65 72 73 69 6f 6e 73 20 6d 61 79 20  ew versions may 
9410: 6f 62 73 6f 6c 65 74 65 0a 6f 6c 64 65 72 20 70  obsolete.older p
9420: 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 73  rotocol versions
9430: 2c 20 61 64 64 20 6f 72 20 72 65 6d 6f 76 65 20  , add or remove 
9440: 63 69 70 68 65 72 73 2c 20 63 68 61 6e 67 65 20  ciphers, change 
9450: 64 65 66 61 75 6c 74 20 76 61 6c 75 65 73 2c 20  default values, 
9460: 65 74 63 2e 0a 55 73 65 20 74 68 65 20 5b 63 6d  etc..Use the [cm
9470: 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73  d tls::protocols
9480: 5d 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 6f 62 74  ] command to obt
9490: 61 69 6e 20 74 68 65 20 73 75 70 70 6f 72 74 65  ain the supporte
94a0: 64 0a 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69  d.protocol versi
94b0: 6f 6e 73 2e 0a 0a 5b 6d 61 6e 70 61 67 65 5f 65  ons...[manpage_e
94c0: 6e 64 5d 0a                                      nd].