Hex Artifact Content

Artifact bfc80d27e9171de8b1eee0eab545c6a499833d40c295d764737412cbb4cb9537:


0000: 5b 63 6f 6d 6d 65 6e 74 20 7b 2d 2a 2d 20 74 63  [comment {-*- tc
0010: 6c 20 2d 2a 2d 20 64 6f 63 74 6f 6f 6c 73 20 6d  l -*- doctools m
0020: 61 6e 70 61 67 65 7d 5d 0a 5b 63 6f 6d 6d 65 6e  anpage}].[commen
0030: 74 20 7b 54 6f 20 63 6f 6e 76 65 72 74 20 74 68  t {To convert th
0040: 69 73 20 74 6f 20 61 6e 6f 74 68 65 72 20 64 6f  is to another do
0050: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 6d  cumentation form
0060: 61 74 20 75 73 65 20 74 68 65 20 64 74 70 6c 69  at use the dtpli
0070: 74 65 0a 20 20 20 20 20 20 20 20 20 20 73 63 72  te.          scr
0080: 69 70 74 20 66 72 6f 6d 20 74 63 6c 6c 69 62 3a  ipt from tcllib:
0090: 20 64 74 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e   dtplite -o tls.
00a0: 6e 20 6e 72 6f 66 66 20 74 6c 73 2e 6d 61 6e 0a  n nroff tls.man.
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 74                dt
00d0: 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e 68 74 6d  plite -o tls.htm
00e0: 6c 20 68 74 6d 6c 20 74 6c 73 2e 6d 61 6e 0a 7d  l html tls.man.}
00f0: 5d 0a 5b 6d 61 6e 70 61 67 65 5f 62 65 67 69 6e  ].[manpage_begin
0100: 20 74 6c 73 20 6e 20 32 2e 30 2e 31 5d 0a 5b 63   tls n 2.0.1].[c
0110: 61 74 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f  ategory tls].[co
0120: 70 79 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61  pyright {1999 Ma
0130: 74 74 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70  tt Newman}].[cop
0140: 79 72 69 67 68 74 20 7b 32 30 30 34 20 53 74 61  yright {2004 Sta
0150: 72 66 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a  rfish Systems}].
0160: 5b 63 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34  [copyright {2024
0170: 20 42 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d   Brian O'Hagan}]
0180: 0a 5b 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49  .[keywords tls I
0190: 2f 4f 20 22 49 50 20 41 64 64 72 65 73 73 22 20  /O "IP Address" 
01a0: 4f 70 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20  OpenSSL SSL TCP 
01b0: 54 4c 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75  TLS "asynchronou
01c0: 73 20 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74  s I/O" bind cert
01d0: 69 66 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20  ificate channel 
01e0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61  connection "doma
01f0: 69 6e 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68  in name" host "h
0200: 74 74 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61  ttps" "network a
0210: 64 64 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20  ddress" network 
0220: 73 6f 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b  socket TclTLS].[
0230: 6d 6f 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53  moddesc {Tcl TLS
0240: 20 65 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65   extension}].[se
0250: 65 5f 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b  e_also http sock
0260: 65 74 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f  et [uri https://
0270: 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f  www.openssl.org/
0280: 20 4f 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c   OpenSSL]].[titl
0290: 65 64 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74  edesc {binding t
02a0: 6f 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69  o the OpenSSL li
02b0: 62 72 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70  brary for encryp
02c0: 74 65 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49  ted socket and I
02d0: 2f 4f 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75  /O channel commu
02e0: 6e 69 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71  nications}].[req
02f0: 75 69 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b  uire Tcl 8.5-].[
0300: 72 65 71 75 69 72 65 20 74 6c 73 20 32 2e 30 2e  require tls 2.0.
0310: 31 5d 0a 5b 64 65 73 63 72 69 70 74 69 6f 6e 5d  1].[description]
0320: 0a 0a 54 68 69 73 20 65 78 74 65 6e 73 69 6f 6e  ..This extension
0330: 20 70 72 6f 76 69 64 65 73 20 54 43 4c 20 73 63   provides TCL sc
0340: 72 69 70 74 20 61 63 63 65 73 73 20 74 6f 20 53  ript access to S
0350: 65 63 75 72 65 20 53 6f 63 6b 65 74 20 4c 61 79  ecure Socket Lay
0360: 65 72 20 28 53 53 4c 29 0a 63 6f 6d 6d 75 6e 69  er (SSL).communi
0370: 63 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 74 68  cations using th
0380: 65 20 54 72 61 6e 73 70 6f 72 74 20 4c 61 79 65  e Transport Laye
0390: 72 20 53 65 63 75 72 69 74 79 20 28 54 4c 53 29  r Security (TLS)
03a0: 20 70 72 6f 74 6f 63 6f 6c 2e 20 49 74 20 70 72   protocol. It pr
03b0: 6f 76 69 64 65 73 20 61 0a 67 65 6e 65 72 69 63  ovides a.generic
03c0: 20 62 69 6e 64 69 6e 67 20 74 6f 20 5b 75 72 69   binding to [uri
03d0: 20 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 6f 70   "https://www.op
03e0: 65 6e 73 73 6c 2e 6f 72 67 2f 22 20 4f 70 65 6e  enssl.org/" Open
03f0: 53 53 4c 5d 2c 20 75 74 69 6c 69 7a 69 6e 67 20  SSL], utilizing 
0400: 74 68 65 0a 5b 73 79 73 63 6d 64 20 54 63 6c 5f  the.[syscmd Tcl_
0410: 53 74 61 63 6b 43 68 61 6e 6e 65 6c 5d 20 41 50  StackChannel] AP
0420: 49 20 69 6e 20 54 43 4c 20 38 2e 34 20 6f 72 20  I in TCL 8.4 or 
0430: 6c 61 74 65 72 2e 20 54 68 65 73 65 20 73 6f 63  later. These soc
0440: 6b 65 74 73 20 62 65 68 61 76 65 20 65 78 61 63  kets behave exac
0450: 74 6c 79 0a 74 68 65 20 73 61 6d 65 20 61 73 20  tly.the same as 
0460: 63 68 61 6e 6e 65 6c 73 20 63 72 65 61 74 65 64  channels created
0470: 20 75 73 69 6e 67 20 74 68 65 20 62 75 69 6c 74   using the built
0480: 2d 69 6e 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b  -in [syscmd sock
0490: 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 62 75 74  et] command, but
04a0: 0a 70 72 6f 76 69 64 65 20 61 64 64 69 74 69 6f  .provide additio
04b0: 6e 61 6c 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20  nal options for 
04c0: 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20 74 68 65 20  controlling the 
04d0: 53 53 4c 2f 54 4c 53 20 73 65 73 73 69 6f 6e 2e  SSL/TLS session.
04e0: 0a 0a 5b 73 65 63 74 69 6f 6e 20 43 6f 6d 70 61  ..[section Compa
04f0: 74 69 62 69 6c 69 74 79 5d 0a 54 68 69 73 20 65  tibility].This e
0500: 78 74 65 6e 73 69 6f 6e 20 69 73 20 63 6f 6d 70  xtension is comp
0510: 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65 6e  atible with Open
0520: 53 53 4c 20 31 2e 31 2e 31 20 6f 72 20 6c 61 74  SSL 1.1.1 or lat
0530: 65 72 20 69 6e 63 6c 75 64 69 6e 67 20 74 68 65  er including the
0540: 20 33 2e 78 20 61 6e 64 20 34 2e 30 0a 72 65 6c   3.x and 4.0.rel
0550: 65 61 73 65 73 2e 20 49 74 20 72 65 71 75 69 72  eases. It requir
0560: 65 73 20 54 63 6c 20 76 65 72 73 69 6f 6e 20 38  es Tcl version 8
0570: 2e 35 20 6f 72 20 6c 61 74 65 72 20 61 6e 64 20  .5 or later and 
0580: 77 69 6c 6c 20 77 6f 72 6b 20 77 69 74 68 20 54  will work with T
0590: 63 6c 20 39 2e 30 2e 0a 0a 5b 73 65 63 74 69 6f  cl 9.0...[sectio
05a0: 6e 20 43 6f 6d 6d 61 6e 64 73 5d 0a 0a 54 68 65  n Commands]..The
05b0: 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20 74   following are t
05c0: 68 65 20 63 6f 6d 6d 61 6e 64 73 20 70 72 6f 76  he commands prov
05d0: 69 64 65 64 20 62 79 20 74 68 65 20 54 63 4c 54  ided by the TcLT
05e0: 4c 53 20 70 61 63 6b 61 67 65 2e 20 53 65 65 0a  LS package. See.
05f0: 5b 73 65 63 74 72 65 66 20 45 78 61 6d 70 6c 65  [sectref Example
0600: 73 5d 20 66 6f 72 20 65 78 61 6d 70 6c 65 20 75  s] for example u
0610: 73 61 67 65 20 61 6e 64 20 74 68 65 20 5b 66 69  sage and the [fi
0620: 6c 65 20 64 65 6d 6f 73 5d 20 64 69 72 65 63 74  le demos] direct
0630: 6f 72 79 20 66 6f 72 0a 6d 6f 72 65 20 65 78 61  ory for.more exa
0640: 6d 70 6c 65 20 75 73 61 67 65 2e 0a 0a 5b 6c 69  mple usage...[li
0650: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
0660: 69 6f 6e 73 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  ions]..[call [cm
0670: 64 20 74 6c 73 3a 3a 69 6e 69 74 5d 20 5b 6f 70  d tls::init] [op
0680: 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d  t [arg -option]]
0690: 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75 65   [opt [arg value
06a0: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f  ]] [opt [arg "-o
06b0: 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22  ption value ..."
06c0: 5d 5d 5d 0a 0a 4f 70 74 69 6f 6e 61 6c 20 66 75  ]]]..Optional fu
06d0: 6e 63 74 69 6f 6e 20 74 6f 20 73 65 74 20 74 68  nction to set th
06e0: 65 20 64 65 66 61 75 6c 74 20 6f 70 74 69 6f 6e  e default option
06f0: 73 20 75 73 65 64 20 62 79 20 5b 63 6d 64 20 74  s used by [cmd t
0700: 6c 73 3a 3a 73 6f 63 6b 65 74 5d 2e 20 49 66 20  ls::socket]. If 
0710: 79 6f 75 0a 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  you.call [cmd tl
0720: 73 3a 3a 69 6d 70 6f 72 74 5d 20 64 69 72 65 63  s::import] direc
0730: 74 6c 79 2c 20 74 68 65 20 76 61 6c 75 65 73 20  tly, the values 
0740: 73 65 74 20 62 79 20 74 68 69 73 20 63 6f 6d 6d  set by this comm
0750: 61 6e 64 20 68 61 76 65 20 6e 6f 20 65 66 66 65  and have no effe
0760: 63 74 2e 0a 54 68 69 73 20 63 6f 6d 6d 61 6e 64  ct..This command
0770: 20 73 75 70 70 6f 72 74 73 20 61 6c 6c 20 6f 66   supports all of
0780: 20 74 68 65 20 73 61 6d 65 20 6f 70 74 69 6f 6e   the same option
0790: 73 20 61 73 20 74 68 65 20 5b 63 6d 64 20 74 6c  s as the [cmd tl
07a0: 73 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61  s::socket] comma
07b0: 6e 64 2c 0a 74 68 6f 75 67 68 20 79 6f 75 20 73  nd,.though you s
07c0: 68 6f 75 6c 64 20 6c 69 6d 69 74 20 79 6f 75 72  hould limit your
07d0: 20 6f 70 74 69 6f 6e 73 20 74 6f 20 6f 6e 6c 79   options to only
07e0: 20 74 68 65 20 54 4c 53 20 72 65 6c 61 74 65 64   the TLS related
07f0: 20 6f 6e 65 73 2e 0a 0a 5b 63 61 6c 6c 20 5b 63   ones...[call [c
0800: 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20  md tls::socket] 
0810: 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f  [opt [arg -optio
0820: 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61  n]] [opt [arg va
0830: 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  lue]] [opt [arg 
0840: 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e  "-option value .
0850: 2e 2e 22 5d 5d 20 5b 61 72 67 20 68 6f 73 74 5d  .."]] [arg host]
0860: 20 5b 61 72 67 20 70 6f 72 74 5d 5d 0a 0a 54 68   [arg port]]..Th
0870: 69 73 20 69 73 20 61 20 68 65 6c 70 65 72 20 66  is is a helper f
0880: 75 6e 63 74 69 6f 6e 20 74 68 61 74 20 75 74 69  unction that uti
0890: 6c 69 7a 65 73 20 74 68 65 20 75 6e 64 65 72 6c  lizes the underl
08a0: 79 69 6e 67 20 63 6f 6d 6d 61 6e 64 73 20 5b 73  ying commands [s
08b0: 79 73 63 6d 64 20 73 6f 63 6b 65 74 5d 0a 61 6e  yscmd socket].an
08c0: 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f  d [cmd tls::impo
08d0: 72 74 5d 20 74 6f 20 63 72 65 61 74 65 20 74 68  rt] to create th
08e0: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 20 49 74  e connection. It
08f0: 20 62 65 68 61 76 65 73 20 74 68 65 20 73 61 6d   behaves the sam
0900: 65 20 61 73 20 74 68 65 0a 6e 61 74 69 76 65 20  e as the.native 
0910: 54 43 4c 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b  TCL [syscmd sock
0920: 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 62 75 74  et] command, but
0930: 20 61 6c 73 6f 20 73 75 70 70 6f 72 74 73 20 74   also supports t
0940: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70  he [cmd tls::imp
0950: 6f 72 74 5d 0a 63 6f 6d 6d 61 6e 64 20 6f 70 74  ort].command opt
0960: 69 6f 6e 73 20 77 69 74 68 20 6f 6e 65 20 61 64  ions with one ad
0970: 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 2e  ditional option.
0980: 20 49 74 20 72 65 74 75 72 6e 73 20 74 68 65 20   It returns the 
0990: 63 68 61 6e 6e 65 6c 20 68 61 6e 64 6c 65 20 69  channel handle i
09a0: 64 0a 66 6f 72 20 74 68 65 20 6e 65 77 20 73 6f  d.for the new so
09b0: 63 6b 65 74 2e 20 41 64 64 69 74 69 6f 6e 61 6c  cket. Additional
09c0: 20 6f 70 74 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b   options are:..[
09d0: 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f  list_begin optio
09e0: 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61  ns]..[opt_def -a
09f0: 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 20 5b 61  utoservername [a
0a00: 72 67 20 62 6f 6f 6c 5d 5d 0a 49 66 20 5b 63 6f  rg bool]].If [co
0a10: 6e 73 74 20 74 72 75 65 5d 2c 20 61 75 74 6f 6d  nst true], autom
0a20: 61 74 69 63 61 6c 6c 79 20 73 65 74 20 74 68 65  atically set the
0a30: 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72 76 65 72   [option -server
0a40: 6e 61 6d 65 5d 20 61 72 67 75 6d 65 6e 74 20 74  name] argument t
0a50: 6f 20 74 68 65 0a 5b 65 6d 70 68 20 68 6f 73 74  o the.[emph host
0a60: 5d 20 61 72 67 75 6d 65 6e 74 2e 20 50 72 69 6f  ] argument. Prio
0a70: 72 20 74 6f 20 54 63 6c 54 4c 53 20 32 2e 30 2c  r to TclTLS 2.0,
0a80: 20 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   the default is 
0a90: 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 53  [const false]..S
0aa0: 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c  tarting in TclTL
0ab0: 53 20 32 2e 30 2c 20 74 68 65 20 64 65 66 61 75  S 2.0, the defau
0ac0: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75  lt is [const tru
0ad0: 65 5d 20 75 6e 6c 65 73 73 20 5b 6f 70 74 69 6f  e] unless [optio
0ae0: 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65 5d 0a 69  n -servername].i
0af0: 73 20 61 6c 73 6f 20 73 70 65 63 69 66 69 65 64  s also specified
0b00: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
0b10: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73  call [cmd tls::s
0b20: 6f 63 6b 65 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d  ocket] [option -
0b30: 73 65 72 76 65 72 5d 20 5b 61 72 67 20 63 6f 6d  server] [arg com
0b40: 6d 61 6e 64 5d 20 5b 6f 70 74 20 5b 61 72 67 20  mand] [opt [arg 
0b50: 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b  -option]] [opt [
0b60: 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74  arg value]] [opt
0b70: 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76   [arg "-option v
0b80: 61 6c 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67  alue ..."]] [arg
0b90: 20 70 6f 72 74 5d 5d 0a 0a 53 61 6d 65 20 61 73   port]]..Same as
0ba0: 20 70 72 65 76 69 6f 75 73 20 63 6f 6d 6d 61 6e   previous comman
0bb0: 64 2c 20 62 75 74 20 69 6e 73 74 65 61 64 20 63  d, but instead c
0bc0: 72 65 61 74 65 73 20 61 20 73 65 72 76 65 72 20  reates a server 
0bd0: 73 6f 63 6b 65 74 20 66 6f 72 20 63 6c 69 65 6e  socket for clien
0be0: 74 73 20 74 6f 0a 63 6f 6e 6e 65 63 74 20 74 6f  ts to.connect to
0bf0: 20 6a 75 73 74 20 6c 69 6b 65 20 74 68 65 20 54   just like the T
0c00: 63 6c 20 5b 73 79 73 63 6d 64 20 22 73 6f 63 6b  cl [syscmd "sock
0c10: 65 74 20 2d 73 65 72 76 65 72 22 5d 20 63 6f 6d  et -server"] com
0c20: 6d 61 6e 64 2e 20 49 74 20 72 65 74 75 72 6e 73  mand. It returns
0c30: 20 74 68 65 0a 63 68 61 6e 6e 65 6c 20 68 61 6e   the.channel han
0c40: 64 6c 65 20 69 64 20 66 6f 72 20 74 68 65 20 6e  dle id for the n
0c50: 65 77 20 73 6f 63 6b 65 74 2e 0a 0a 5b 63 61 6c  ew socket...[cal
0c60: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f  l [cmd tls::impo
0c70: 72 74 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c  rt] [arg channel
0c80: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74  ] [opt [arg -opt
0c90: 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  ion]] [opt [arg 
0ca0: 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72  value]] [opt [ar
0cb0: 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65  g "-option value
0cc0: 20 2e 2e 2e 22 5d 5d 5d 0a 0a 5b 63 61 6c 6c 20   ..."]]]..[call 
0cd0: 5b 63 6d 64 20 74 6c 73 3a 3a 73 74 61 72 74 74  [cmd tls::startt
0ce0: 6c 73 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c  ls] [arg channel
0cf0: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74  ] [opt [arg -opt
0d00: 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  ion]] [opt [arg 
0d10: 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72  value]] [opt [ar
0d20: 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65  g "-option value
0d30: 20 2e 2e 2e 22 5d 5d 5d 0a 0a 53 74 61 72 74 20   ..."]]]..Start 
0d40: 54 4c 53 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f  TLS encryption o
0d50: 6e 20 54 43 4c 20 63 68 61 6e 6e 65 6c 20 5b 61  n TCL channel [a
0d60: 72 67 20 63 68 61 6e 6e 65 6c 5d 20 76 69 61 20  rg channel] via 
0d70: 61 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65  a stacked channe
0d80: 6c 2e 20 49 74 0a 6e 65 65 64 20 6e 6f 74 20 62  l. It.need not b
0d90: 65 20 61 20 73 6f 63 6b 65 74 2c 20 62 75 74 20  e a socket, but 
0da0: 6d 75 73 74 20 70 72 6f 76 69 64 65 20 62 69 2d  must provide bi-
0db0: 64 69 72 65 63 74 69 6f 6e 61 6c 20 66 6c 6f 77  directional flow
0dc0: 2e 20 41 6c 73 6f 20 73 65 74 73 20 73 65 73 73  . Also sets sess
0dd0: 69 6f 6e 0a 70 61 72 61 6d 65 74 65 72 73 20 66  ion.parameters f
0de0: 6f 72 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65  or SSL handshake
0df0: 2e 20 56 61 6c 69 64 20 6f 70 74 69 6f 6e 73 20  . Valid options 
0e00: 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  are:..[list_begi
0e10: 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74  n options]..[opt
0e20: 5f 64 65 66 20 2d 61 6c 70 6e 20 5b 61 72 67 20  _def -alpn [arg 
0e30: 6c 69 73 74 5d 5d 0a 4c 69 73 74 20 6f 66 20 70  list]].List of p
0e40: 72 6f 74 6f 63 6f 6c 73 20 74 6f 20 6f 66 66 65  rotocols to offe
0e50: 72 20 64 75 72 69 6e 67 20 41 70 70 6c 69 63 61  r during Applica
0e60: 74 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f  tion-Layer Proto
0e70: 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e 0a  col Negotiation.
0e80: 28 41 4c 50 4e 29 2e 20 46 6f 72 20 65 78 61 6d  (ALPN). For exam
0e90: 70 6c 65 3a 20 5b 63 6f 6e 73 74 20 68 32 5d 20  ple: [const h2] 
0ea0: 61 6e 64 20 5b 63 6f 6e 73 74 20 68 74 74 70 2f  and [const http/
0eb0: 31 2e 31 5d 2c 20 62 75 74 20 6e 6f 74 20 5b 63  1.1], but not [c
0ec0: 6f 6e 73 74 20 68 33 5d 20 6f 72 0a 5b 63 6f 6e  onst h3] or.[con
0ed0: 73 74 20 71 75 69 63 5d 2e 20 54 68 69 73 20 6f  st quic]. This o
0ee0: 70 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72  ption is new for
0ef0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f   TclTLS 1.8...[o
0f00: 70 74 5f 64 65 66 20 2d 63 61 64 69 72 20 5b 61  pt_def -cadir [a
0f10: 72 67 20 64 69 72 65 63 74 6f 72 79 5d 5d 0a 53  rg directory]].S
0f20: 70 65 63 69 66 69 65 73 20 74 68 65 20 64 69 72  pecifies the dir
0f30: 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 68 65  ectory where the
0f40: 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74   Certificate Aut
0f50: 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72 74  hority (CA) cert
0f60: 69 66 69 63 61 74 65 73 20 61 72 65 0a 73 74 6f  ificates are.sto
0f70: 72 65 64 2e 20 54 68 65 20 64 65 66 61 75 6c 74  red. The default
0f80: 20 69 73 20 70 6c 61 74 66 6f 72 6d 20 73 70 65   is platform spe
0f90: 63 69 66 69 63 20 61 6e 64 20 63 61 6e 20 62 65  cific and can be
0fa0: 20 73 65 74 20 61 74 20 63 6f 6d 70 69 6c 65 20   set at compile 
0fb0: 74 69 6d 65 2e 20 54 68 65 0a 64 65 66 61 75 6c  time. The.defaul
0fc0: 74 20 6c 6f 63 61 74 69 6f 6e 20 63 61 6e 20 62  t location can b
0fd0: 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20  e overridden by 
0fe0: 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52  the [var SSL_CER
0ff0: 54 5f 44 49 52 5d 20 65 6e 76 69 72 6f 6e 6d 65  T_DIR] environme
1000: 6e 74 0a 76 61 72 69 61 62 6c 65 2e 20 53 65 65  nt.variable. See
1010: 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69   [sectref "Certi
1020: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f  ficate Validatio
1030: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74  n"] for more det
1040: 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  ails...[opt_def 
1050: 2d 63 61 66 69 6c 65 20 5b 61 72 67 20 66 69 6c  -cafile [arg fil
1060: 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65  ename]].Specifie
1070: 73 20 74 68 65 20 66 69 6c 65 20 77 69 74 68 20  s the file with 
1080: 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20  the Certificate 
1090: 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 20 63  Authority (CA) c
10a0: 65 72 74 69 66 69 63 61 74 65 73 20 74 6f 20 75  ertificates to u
10b0: 73 65 20 69 6e 0a 5b 63 6f 6e 73 74 20 50 45 4d  se in.[const PEM
10c0: 5d 20 66 69 6c 65 20 66 6f 72 6d 61 74 2e 20 54  ] file format. T
10d0: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 66  he default is [f
10e0: 69 6c 65 20 63 65 72 74 2e 70 65 6d 5d 2c 20 69  ile cert.pem], i
10f0: 6e 20 74 68 65 20 4f 70 65 6e 53 53 4c 0a 64 69  n the OpenSSL.di
1100: 72 65 63 74 6f 72 79 2e 20 54 68 65 20 64 65 66  rectory. The def
1110: 61 75 6c 74 20 66 69 6c 65 20 63 61 6e 20 62 65  ault file can be
1120: 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74   overridden by t
1130: 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54  he [var SSL_CERT
1140: 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65  _FILE] environme
1150: 6e 74 0a 76 61 72 69 61 62 6c 65 2e 20 53 65 65  nt.variable. See
1160: 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69   [sectref "Certi
1170: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f  ficate Validatio
1180: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74  n"] for more det
1190: 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  ails...[opt_def 
11a0: 2d 63 61 73 74 6f 72 65 20 5b 61 72 67 20 55 52  -castore [arg UR
11b0: 49 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  I]].Specifies th
11c0: 65 20 55 6e 69 66 6f 72 6d 20 52 65 73 6f 75 72  e Uniform Resour
11d0: 63 65 20 49 64 65 6e 74 69 66 69 65 72 20 28 55  ce Identifier (U
11e0: 52 49 29 20 66 6f 72 20 74 68 65 20 43 65 72 74  RI) for the Cert
11f0: 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74  ificate Authorit
1200: 79 0a 28 43 41 29 20 73 74 6f 72 65 2c 20 77 68  y.(CA) store, wh
1210: 69 63 68 20 6d 61 79 20 62 65 20 61 20 73 69 6e  ich may be a sin
1220: 67 6c 65 20 63 6f 6e 74 61 69 6e 65 72 20 6f 72  gle container or
1230: 20 61 20 63 61 74 61 6c 6f 67 20 6f 66 20 63 6f   a catalog of co
1240: 6e 74 61 69 6e 65 72 73 2e 0a 53 74 61 72 74 69  ntainers..Starti
1250: 6e 67 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20  ng with OpenSSL 
1260: 33 2e 32 20 6f 6e 20 4d 53 20 57 69 6e 64 6f 77  3.2 on MS Window
1270: 73 2c 20 73 65 74 20 74 6f 20 22 5b 63 6f 6e 73  s, set to "[cons
1280: 74 20 22 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77  t "org.openssl.w
1290: 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f  instore://"]".to
12a0: 20 75 73 65 20 74 68 65 20 62 75 69 6c 74 2d 69   use the built-i
12b0: 6e 20 4d 53 20 57 69 6e 64 6f 77 73 20 43 65 72  n MS Windows Cer
12c0: 74 69 66 69 63 61 74 65 20 53 74 6f 72 65 2e 0a  tificate Store..
12d0: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65  See [sectref "Ce
12e0: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
12f0: 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20  tion"] for more 
1300: 64 65 74 61 69 6c 73 2e 0a 54 68 69 73 20 6f 70  details..This op
1310: 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20  tion is new for 
1320: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70  TclTLS 1.8...[op
1330: 74 5f 64 65 66 20 2d 63 65 72 74 66 69 6c 65 20  t_def -certfile 
1340: 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a  [arg filename]].
1350: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 6e 61  Specifies the na
1360: 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65 20 77  me of the file w
1370: 69 74 68 20 74 68 65 20 63 65 72 74 69 66 69 63  ith the certific
1380: 61 74 65 20 74 6f 20 75 73 65 20 69 6e 20 50 45  ate to use in PE
1390: 4d 20 66 6f 72 6d 61 74 0a 61 73 20 74 68 65 20  M format.as the 
13a0: 6c 6f 63 61 6c 20 28 63 6c 69 65 6e 74 20 6f 72  local (client or
13b0: 20 73 65 72 76 65 72 29 20 63 65 72 74 69 66 69   server) certifi
13c0: 63 61 74 65 2e 20 49 74 20 61 6c 73 6f 20 63 6f  cate. It also co
13d0: 6e 74 61 69 6e 73 20 74 68 65 20 70 75 62 6c 69  ntains the publi
13e0: 63 20 6b 65 79 2e 0a 0a 5b 6f 70 74 5f 64 65 66  c key...[opt_def
13f0: 20 2d 63 65 72 74 20 5b 61 72 67 20 73 74 72 69   -cert [arg stri
1400: 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  ng]].Specifies t
1410: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 74  he certificate t
1420: 6f 20 75 73 65 20 61 73 20 61 20 44 45 52 20 65  o use as a DER e
1430: 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20 28 58  ncoded string (X
1440: 2e 35 30 39 20 44 45 52 29 2e 0a 0a 5b 6f 70 74  .509 DER)...[opt
1450: 5f 64 65 66 20 2d 63 69 70 68 65 72 20 5b 61 72  _def -cipher [ar
1460: 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69  g string]].Speci
1470: 66 69 65 73 20 74 68 65 20 6c 69 73 74 20 6f 66  fies the list of
1480: 20 63 69 70 68 65 72 73 20 74 6f 20 75 73 65 20   ciphers to use 
1490: 66 6f 72 20 54 4c 53 20 31 2e 32 20 61 6e 64 20  for TLS 1.2 and 
14a0: 65 61 72 6c 69 65 72 20 63 6f 6e 6e 65 63 74 69  earlier connecti
14b0: 6f 6e 73 2e 0a 53 74 72 69 6e 67 20 69 73 20 61  ons..String is a
14c0: 20 63 6f 6c 6f 6e 20 22 5b 63 6f 6e 73 74 20 3a   colon "[const :
14d0: 5d 22 20 73 65 70 61 72 61 74 65 64 20 6c 69 73  ]" separated lis
14e0: 74 20 6f 66 20 63 69 70 68 65 72 73 2e 0a 43 69  t of ciphers..Ci
14f0: 70 68 65 72 73 20 63 61 6e 20 62 65 20 63 6f 6d  phers can be com
1500: 62 69 6e 65 64 20 75 73 69 6e 67 20 74 68 65 20  bined using the 
1510: 22 5b 63 6f 6e 73 74 20 2b 5d 22 20 63 68 61 72  "[const +]" char
1520: 61 63 74 65 72 2e 0a 50 72 65 66 69 78 65 73 20  acter..Prefixes 
1530: 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 70  can be used to p
1540: 65 72 6d 61 6e 65 6e 74 6c 79 20 72 65 6d 6f 76  ermanently remov
1550: 65 20 22 5b 63 6f 6e 73 74 20 21 5d 22 2c 20 64  e "[const !]", d
1560: 65 6c 65 74 65 20 22 5b 63 6f 6e 73 74 20 2d 5d  elete "[const -]
1570: 22 2c 20 6f 72 0a 6d 6f 76 65 20 74 6f 20 74 68  ", or.move to th
1580: 65 20 65 6e 64 20 22 5b 63 6f 6e 73 74 20 2b 5d  e end "[const +]
1590: 22 20 61 20 73 70 65 63 69 66 69 65 64 20 63 69  " a specified ci
15a0: 70 68 65 72 2e 0a 4b 65 79 77 6f 72 64 73 20 5b  pher..Keywords [
15b0: 63 6f 6e 73 74 20 40 53 54 52 45 4e 47 54 48 5d  const @STRENGTH]
15c0: 20 28 73 6f 72 74 20 62 79 20 61 6c 67 6f 72 69   (sort by algori
15d0: 74 68 6d 20 6b 65 79 20 6c 65 6e 67 74 68 29 2c  thm key length),
15e0: 0a 5b 63 6f 6e 73 74 20 40 53 45 43 4c 45 56 45  .[const @SECLEVE
15f0: 4c 3d 5d 5b 65 6d 70 68 20 6e 5d 20 28 73 65 74  L=][emph n] (set
1600: 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20   security level 
1610: 74 6f 20 6e 29 2c 20 61 6e 64 0a 5b 63 6f 6e 73  to n), and.[cons
1620: 74 20 44 45 46 41 55 4c 54 5d 20 28 75 73 65 20  t DEFAULT] (use 
1630: 64 65 66 61 75 6c 74 20 63 69 70 68 65 72 20 6c  default cipher l
1640: 69 73 74 2c 20 61 74 20 73 74 61 72 74 20 6f 6e  ist, at start on
1650: 6c 79 29 20 63 61 6e 20 61 6c 73 6f 20 62 65 20  ly) can also be 
1660: 73 70 65 63 69 66 69 65 64 2e 0a 53 65 65 20 74  specified..See t
1670: 68 65 20 5b 75 72 69 20 22 68 74 74 70 73 3a 2f  he [uri "https:/
1680: 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72  /docs.openssl.or
1690: 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f 6f 70  g/master/man1/op
16a0: 65 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f 23 6f  enssl-ciphers/#o
16b0: 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53 4c 5d  ptions" OpenSSL]
16c0: 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66  .documentation f
16d0: 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74  or the full list
16e0: 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75 65 73   of valid values
16f0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 69 70  ...[opt_def -cip
1700: 68 65 72 73 75 69 74 65 73 20 5b 61 72 67 20 73  hersuites [arg s
1710: 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65  tring]].Specifie
1720: 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 63 69  s the list of ci
1730: 70 68 65 72 20 73 75 69 74 65 73 20 74 6f 20 75  pher suites to u
1740: 73 65 20 66 6f 72 20 54 4c 53 20 31 2e 33 20 61  se for TLS 1.3 a
1750: 73 20 61 20 63 6f 6c 6f 6e 0a 22 5b 63 6f 6e 73  s a colon."[cons
1760: 74 20 3a 5d 22 20 73 65 70 61 72 61 74 65 64 20  t :]" separated 
1770: 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72 20 73  list of cipher s
1780: 75 69 74 65 20 6e 61 6d 65 73 2e 20 53 65 65 20  uite names. See 
1790: 74 68 65 0a 5b 75 72 69 20 22 68 74 74 70 73 3a  the.[uri "https:
17a0: 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f  //docs.openssl.o
17b0: 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f 6f  rg/master/man1/o
17c0: 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f 23  penssl-ciphers/#
17d0: 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53 4c  options" OpenSSL
17e0: 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20  ].documentation 
17f0: 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c 69 73  for the full lis
1800: 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75 65  t of valid value
1810: 73 2e 0a 54 68 69 73 20 6f 70 74 69 6f 6e 20 69  s..This option i
1820: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
1830: 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20   1.8...[opt_def 
1840: 2d 63 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61  -command [arg ca
1850: 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69  llback]].Specifi
1860: 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20  es the callback 
1870: 63 6f 6d 6d 61 6e 64 20 74 6f 20 62 65 20 69 6e  command to be in
1880: 76 6f 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c  voked at several
1890: 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74   points during t
18a0: 68 65 0a 68 61 6e 64 73 68 61 6b 65 20 74 6f 20  he.handshake to 
18b0: 70 61 73 73 20 65 72 72 6f 72 73 2c 20 74 72 61  pass errors, tra
18c0: 63 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e  cing information
18d0: 2c 20 61 6e 64 20 70 72 6f 74 6f 63 6f 6c 20 6d  , and protocol m
18e0: 65 73 73 61 67 65 73 2e 0a 53 65 65 20 5b 73 65  essages..See [se
18f0: 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20  ctref "Callback 
1900: 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f  Options"] for mo
1910: 72 65 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64  re info...[opt_d
1920: 65 66 20 2d 64 68 70 61 72 61 6d 73 20 5b 61 72  ef -dhparams [ar
1930: 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65  g filename]].Spe
1940: 63 69 66 69 65 73 20 74 68 65 20 44 69 66 66 69  cifies the Diffi
1950: 65 2d 48 65 6c 6c 6d 61 6e 20 28 44 48 29 20 70  e-Hellman (DH) p
1960: 61 72 61 6d 65 74 65 72 73 20 66 69 6c 65 2e 0a  arameters file..
1970: 0a 5b 6f 70 74 5f 64 65 66 20 2d 6b 65 79 66 69  .[opt_def -keyfi
1980: 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65  le [arg filename
1990: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
19a0: 20 70 72 69 76 61 74 65 20 6b 65 79 20 66 69 6c   private key fil
19b0: 65 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69  e. The default i
19c0: 73 20 74 6f 20 75 73 65 20 74 68 65 20 66 69 6c  s to use the fil
19d0: 65 0a 73 70 65 63 69 66 69 65 64 20 62 79 20 74  e.specified by t
19e0: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74  he [option -cert
19f0: 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b  file] option...[
1a00: 6f 70 74 5f 64 65 66 20 2d 6b 65 79 20 5b 61 72  opt_def -key [ar
1a10: 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69  g string]].Speci
1a20: 66 69 65 73 20 74 68 65 20 70 72 69 76 61 74 65  fies the private
1a30: 20 6b 65 79 20 74 6f 20 75 73 65 20 61 73 20 61   key to use as a
1a40: 20 44 45 52 20 65 6e 63 6f 64 65 64 20 73 74 72   DER encoded str
1a50: 69 6e 67 20 28 50 4b 43 53 23 31 20 44 45 52 29  ing (PKCS#1 DER)
1a60: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 6d 6f 64  ...[opt_def -mod
1a70: 65 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  el [arg channel]
1a80: 5d 0a 46 6f 72 63 65 20 74 68 69 73 20 63 68 61  ].Force this cha
1a90: 6e 6e 65 6c 20 74 6f 20 73 68 61 72 65 20 74 68  nnel to share th
1aa0: 65 20 73 61 6d 65 20 5b 74 65 72 6d 20 53 53 4c  e same [term SSL
1ab0: 5f 43 54 58 5d 20 73 74 72 75 63 74 75 72 65 20  _CTX] structure 
1ac0: 61 73 20 74 68 65 0a 73 70 65 63 69 66 69 65 64  as the.specified
1ad0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2c 20   [arg channel], 
1ae0: 61 6e 64 20 74 68 65 72 65 66 6f 72 65 20 73 68  and therefore sh
1af0: 61 72 65 20 63 6f 6e 66 69 67 2c 20 63 61 6c 6c  are config, call
1b00: 62 61 63 6b 73 2c 20 65 74 63 2e 0a 0a 5b 6f 70  backs, etc...[op
1b10: 74 5f 64 65 66 20 2d 70 61 73 73 77 6f 72 64 20  t_def -password 
1b20: 5b 61 72 67 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a  [arg callback]].
1b30: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 63 61  Specifies the ca
1b40: 6c 6c 62 61 63 6b 20 63 6f 6d 6d 61 6e 64 20 74  llback command t
1b50: 6f 20 69 6e 76 6f 6b 65 20 77 68 65 6e 20 4f 70  o invoke when Op
1b60: 65 6e 53 53 4c 20 6e 65 65 64 73 20 74 6f 20 6f  enSSL needs to o
1b70: 62 74 61 69 6e 20 61 0a 70 61 73 73 77 6f 72 64  btain a.password
1b80: 2e 20 54 68 69 73 20 69 73 20 74 79 70 69 63 61  . This is typica
1b90: 6c 6c 79 20 75 73 65 64 20 74 6f 20 75 6e 6c 6f  lly used to unlo
1ba0: 63 6b 20 74 68 65 20 70 72 69 76 61 74 65 20 6b  ck the private k
1bb0: 65 79 20 6f 66 20 61 20 63 65 72 74 69 66 69 63  ey of a certific
1bc0: 61 74 65 2e 0a 54 68 65 20 63 61 6c 6c 62 61 63  ate..The callbac
1bd0: 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20  k should return 
1be0: 61 20 70 61 73 73 77 6f 72 64 20 73 74 72 69 6e  a password strin
1bf0: 67 2e 20 54 68 69 73 20 6f 70 74 69 6f 6e 20 68  g. This option h
1c00: 61 73 20 63 68 61 6e 67 65 64 20 66 6f 72 0a 54  as changed for.T
1c10: 63 6c 54 4c 53 20 31 2e 38 2e 20 53 65 65 20 5b  clTLS 1.8. See [
1c20: 73 65 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63  sectref "Callbac
1c30: 6b 20 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20  k Options"] for 
1c40: 6d 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74  more info...[opt
1c50: 5f 64 65 66 20 2d 70 6f 73 74 5f 68 61 6e 64 73  _def -post_hands
1c60: 68 61 6b 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d  hake [arg bool]]
1c70: 0a 41 6c 6c 6f 77 20 70 6f 73 74 2d 68 61 6e 64  .Allow post-hand
1c80: 73 68 61 6b 65 20 73 65 73 73 69 6f 6e 20 74 69  shake session ti
1c90: 63 6b 65 74 20 75 70 64 61 74 65 73 2e 20 54 68  cket updates. Th
1ca0: 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77  is option is new
1cb0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
1cc0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75  ..[opt_def -requ
1cd0: 65 73 74 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a  est [arg bool]].
1ce0: 52 65 71 75 65 73 74 20 61 20 63 65 72 74 69 66  Request a certif
1cf0: 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70  icate from the p
1d00: 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53  eer during the S
1d10: 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 54 68  SL handshake. Th
1d20: 69 73 20 69 73 20 6e 65 65 64 65 64 0a 74 6f 20  is is needed.to 
1d30: 64 6f 20 43 65 72 74 69 66 69 63 61 74 65 20 56  do Certificate V
1d40: 61 6c 69 64 61 74 69 6f 6e 2e 20 53 74 61 72 74  alidation. Start
1d50: 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e  ing in TclTLS 1.
1d60: 38 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20 69  8, the default i
1d70: 73 0a 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20 66  s.[const true] f
1d80: 6f 72 20 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63  or client connec
1d90: 74 69 6f 6e 73 2e 20 53 74 61 72 74 69 6e 67 20  tions. Starting 
1da0: 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 69  in TclTLS 2.0, i
1db0: 66 20 73 65 74 20 74 6f 0a 5b 63 6f 6e 73 74 20  f set to.[const 
1dc0: 66 61 6c 73 65 5d 20 61 6e 64 20 5b 6f 70 74 69  false] and [opti
1dd0: 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 69 73 20  on -require] is 
1de0: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2c 20 74 68  [const true], th
1df0: 65 6e 20 74 68 69 73 20 77 69 6c 6c 20 62 65 0a  en this will be.
1e00: 6f 76 65 72 72 69 64 64 65 6e 20 74 6f 20 5b 63  overridden to [c
1e10: 6f 6e 73 74 20 74 72 75 65 5d 2e 0a 53 65 65 20  onst true]..See 
1e20: 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69 66  [sectref "Certif
1e30: 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e  icate Validation
1e40: 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61  "] for more deta
1e50: 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ils...[opt_def -
1e60: 72 65 71 75 69 72 65 20 5b 61 72 67 20 62 6f 6f  require [arg boo
1e70: 6c 5d 5d 0a 52 65 71 75 69 72 65 20 61 20 76 61  l]].Require a va
1e80: 6c 69 64 20 63 65 72 74 69 66 69 63 61 74 65 20  lid certificate 
1e90: 66 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64 75  from the peer du
1ea0: 72 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61 6e  ring the SSL han
1eb0: 64 73 68 61 6b 65 2e 20 49 66 20 74 68 69 73 20  dshake. If this 
1ec0: 69 73 0a 73 65 74 20 74 6f 20 74 72 75 65 2c 20  is.set to true, 
1ed0: 74 68 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d 72 65  then [option -re
1ee0: 71 75 65 73 74 5d 20 6d 75 73 74 20 61 6c 73 6f  quest] must also
1ef0: 20 62 65 20 73 65 74 20 74 6f 20 74 72 75 65 20   be set to true 
1f00: 61 6e 64 20 61 20 65 69 74 68 65 72 0a 5b 6f 70  and a either.[op
1f10: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f  tion -cadir], [o
1f20: 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20  ption -cafile], 
1f30: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65  [option -castore
1f40: 5d 2c 20 6f 72 20 61 20 70 6c 61 74 66 6f 72 6d  ], or a platform
1f50: 20 64 65 66 61 75 6c 74 0a 6d 75 73 74 20 62 65   default.must be
1f60: 20 70 72 6f 76 69 64 65 64 20 69 6e 20 6f 72 64   provided in ord
1f70: 65 72 20 74 6f 20 76 61 6c 69 64 61 74 65 20 61  er to validate a
1f80: 67 61 69 6e 73 74 2e 20 54 68 65 20 64 65 66 61  gainst. The defa
1f90: 75 6c 74 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e  ult in TclTLS 1.
1fa0: 38 20 61 6e 64 0a 65 61 72 6c 69 65 72 20 76 65  8 and.earlier ve
1fb0: 72 73 69 6f 6e 73 20 69 73 20 5b 63 6f 6e 73 74  rsions is [const
1fc0: 20 66 61 6c 73 65 5d 20 73 69 6e 63 65 20 6e 6f   false] since no
1fd0: 74 20 61 6c 6c 20 70 6c 61 74 66 6f 72 6d 73 20  t all platforms 
1fe0: 68 61 76 65 20 63 65 72 74 69 66 69 63 61 74 65  have certificate
1ff0: 73 20 74 6f 0a 76 61 6c 69 64 61 74 65 20 61 67  s to.validate ag
2000: 61 69 6e 73 74 20 69 6e 20 61 20 66 6f 72 6d 20  ainst in a form 
2010: 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68 20  compatible with 
2020: 4f 70 65 6e 53 53 4c 2e 20 53 74 61 72 74 69 6e  OpenSSL. Startin
2030: 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c  g in TclTLS 2.0,
2040: 0a 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 20  .the default is 
2050: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20 66 6f 72  [const true] for
2060: 20 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69   client connecti
2070: 6f 6e 73 2e 0a 53 65 65 20 5b 73 65 63 74 72 65  ons..See [sectre
2080: 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56  f "Certificate V
2090: 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20  alidation"] for 
20a0: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b  more details...[
20b0: 6f 70 74 5f 64 65 66 20 2d 73 65 63 75 72 69 74  opt_def -securit
20c0: 79 5f 6c 65 76 65 6c 20 5b 61 72 67 20 69 6e 74  y_level [arg int
20d0: 65 67 65 72 5d 5d 0a 53 70 65 63 69 66 69 65 73  eger]].Specifies
20e0: 20 74 68 65 20 73 65 63 75 72 69 74 79 20 6c 65   the security le
20f0: 76 65 6c 20 28 76 61 6c 75 65 20 66 72 6f 6d 20  vel (value from 
2100: 30 20 74 6f 20 35 29 2e 20 54 68 65 20 73 65 63  0 to 5). The sec
2110: 75 72 69 74 79 20 6c 65 76 65 6c 20 61 66 66 65  urity level affe
2120: 63 74 73 0a 74 68 65 20 61 6c 6c 6f 77 65 64 20  cts.the allowed 
2130: 63 69 70 68 65 72 20 73 75 69 74 65 20 65 6e 63  cipher suite enc
2140: 72 79 70 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68  ryption algorith
2150: 6d 73 2c 20 73 75 70 70 6f 72 74 65 64 20 45 43  ms, supported EC
2160: 43 20 63 75 72 76 65 73 2c 0a 73 75 70 70 6f 72  C curves,.suppor
2170: 74 65 64 20 73 69 67 6e 61 74 75 72 65 20 61 6c  ted signature al
2180: 67 6f 72 69 74 68 6d 73 2c 20 44 48 20 70 61 72  gorithms, DH par
2190: 61 6d 65 74 65 72 20 73 69 7a 65 73 2c 20 63 65  ameter sizes, ce
21a0: 72 74 69 66 69 63 61 74 65 20 6b 65 79 20 73 69  rtificate key si
21b0: 7a 65 73 0a 61 6e 64 20 73 69 67 6e 61 74 75 72  zes.and signatur
21c0: 65 20 61 6c 67 6f 72 69 74 68 6d 73 2e 20 54 68  e algorithms. Th
21d0: 65 20 64 65 66 61 75 6c 74 20 69 73 20 31 20 70  e default is 1 p
21e0: 72 69 6f 72 20 74 6f 20 4f 70 65 6e 53 53 4c 20  rior to OpenSSL 
21f0: 33 2e 32 20 61 6e 64 20 32 0a 74 68 65 72 65 61  3.2 and 2.therea
2200: 66 74 65 72 2e 20 4c 65 76 65 6c 20 33 20 61 6e  fter. Level 3 an
2210: 64 20 68 69 67 68 65 72 20 64 69 73 61 62 6c 65  d higher disable
2220: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 73 65 73   support for ses
2230: 73 69 6f 6e 20 74 69 63 6b 65 74 73 20 61 6e 64  sion tickets and
2240: 0a 6f 6e 6c 79 20 61 63 63 65 70 74 20 63 69 70  .only accept cip
2250: 68 65 72 20 73 75 69 74 65 73 20 74 68 61 74 20  her suites that 
2260: 70 72 6f 76 69 64 65 20 66 6f 72 77 61 72 64 20  provide forward 
2270: 73 65 63 72 65 63 79 2e 0a 54 68 69 73 20 6f 70  secrecy..This op
2280: 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20  tion is new for 
2290: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70  TclTLS 1.8...[op
22a0: 74 5f 64 65 66 20 2d 73 65 72 76 65 72 20 5b 61  t_def -server [a
22b0: 72 67 20 62 6f 6f 6c 5d 5d 0a 53 70 65 63 69 66  rg bool]].Specif
22c0: 69 65 73 20 77 68 65 74 68 65 72 20 74 6f 20 61  ies whether to a
22d0: 63 74 20 61 73 20 61 20 73 65 72 76 65 72 20 61  ct as a server a
22e0: 6e 64 20 72 65 73 70 6f 6e 64 20 77 69 74 68 20  nd respond with 
22f0: 61 20 73 65 72 76 65 72 20 68 61 6e 64 73 68 61  a server handsha
2300: 6b 65 20 77 68 65 6e 20 61 0a 63 6c 69 65 6e 74  ke when a.client
2310: 20 63 6f 6e 6e 65 63 74 73 20 61 6e 64 20 70 72   connects and pr
2320: 6f 76 69 64 65 73 20 61 20 63 6c 69 65 6e 74 20  ovides a client 
2330: 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 65 20 64  handshake. The d
2340: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74  efault is [const
2350: 20 66 61 6c 73 65 5d 2e 0a 0a 5b 6f 70 74 5f 64   false]...[opt_d
2360: 65 66 20 2d 73 65 72 76 65 72 6e 61 6d 65 20 5b  ef -servername [
2370: 61 72 67 20 68 6f 73 74 6e 61 6d 65 5d 5d 0a 53  arg hostname]].S
2380: 70 65 63 69 66 79 20 74 68 65 20 70 65 65 72 27  pecify the peer'
2390: 73 20 68 6f 73 74 6e 61 6d 65 2e 20 54 68 69 73  s hostname. This
23a0: 20 69 73 20 75 73 65 64 20 74 6f 20 73 65 74 20   is used to set 
23b0: 74 68 65 20 54 4c 53 20 53 65 72 76 65 72 20 4e  the TLS Server N
23c0: 61 6d 65 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28  ame Indication.(
23d0: 53 4e 49 29 20 65 78 74 65 6e 73 69 6f 6e 2e 20  SNI) extension. 
23e0: 53 65 74 20 74 68 69 73 20 74 6f 20 74 68 65 20  Set this to the 
23f0: 65 78 70 65 63 74 65 64 20 73 65 72 76 65 72 6e  expected servern
2400: 61 6d 65 20 69 6e 20 74 68 65 20 73 65 72 76 65  ame in the serve
2410: 72 27 73 20 63 65 72 74 69 66 69 63 61 74 65 0a  r's certificate.
2420: 6f 72 20 6f 6e 65 20 6f 66 20 74 68 65 20 53 75  or one of the Su
2430: 62 6a 65 63 74 20 41 6c 74 65 72 6e 61 74 65 20  bject Alternate 
2440: 4e 61 6d 65 73 20 28 53 41 4e 29 2e 20 53 74 61  Names (SAN). Sta
2450: 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20  rting in TclTLS 
2460: 32 2e 30 2c 20 74 68 69 73 20 77 69 6c 6c 0a 64  2.0, this will.d
2470: 65 66 61 75 6c 74 20 74 6f 20 74 68 65 20 68 6f  efault to the ho
2480: 73 74 20 66 72 6f 6d 20 74 68 65 20 5b 63 6d 64  st from the [cmd
2490: 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f   tls::socket] co
24a0: 6d 6d 61 6e 64 2e 0a 0a 5b 6f 70 74 5f 64 65 66  mmand...[opt_def
24b0: 20 2d 73 65 73 73 69 6f 6e 5f 69 64 20 5b 61 72   -session_id [ar
24c0: 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d  g binary_string]
24d0: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
24e0: 73 65 73 73 69 6f 6e 20 69 64 20 74 6f 20 72 65  session id to re
24f0: 73 75 6d 65 20 61 20 73 65 73 73 69 6f 6e 2e 20  sume a session. 
2500: 4e 6f 74 20 73 75 70 70 6f 72 74 65 64 20 79 65  Not supported ye
2510: 74 2e 0a 54 68 69 73 20 6f 70 74 69 6f 6e 20 69  t..This option i
2520: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
2530: 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20   1.8...[opt_def 
2540: 2d 73 73 6c 32 20 5b 61 72 67 20 62 6f 6f 6c 5d  -ssl2 [arg bool]
2550: 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20  ].Enable use of 
2560: 53 53 4c 20 76 32 2e 54 68 65 20 64 65 66 61 75  SSL v2.The defau
2570: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c  lt is [const fal
2580: 73 65 5d 2e 0a 4f 70 65 6e 53 53 4c 20 31 2e 31  se]..OpenSSL 1.1
2590: 2b 20 6e 6f 20 6c 6f 6e 67 65 72 20 73 75 70 70  + no longer supp
25a0: 6f 72 74 73 20 53 53 4c 20 76 32 2c 20 73 6f 20  orts SSL v2, so 
25b0: 74 68 69 73 20 6d 61 79 20 6e 6f 74 20 68 61 76  this may not hav
25c0: 65 20 61 6e 79 20 65 66 66 65 63 74 2e 0a 53 65  e any effect..Se
25d0: 65 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a  e the [cmd tls::
25e0: 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61  protocols] comma
25f0: 6e 64 20 66 6f 72 20 73 75 70 70 6f 72 74 65 64  nd for supported
2600: 20 70 72 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70   protocols...[op
2610: 74 5f 64 65 66 20 2d 73 73 6c 33 20 5b 61 72 67  t_def -ssl3 [arg
2620: 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75   bool]].Enable u
2630: 73 65 20 6f 66 20 53 53 4c 20 76 33 2e 20 54 68  se of SSL v3. Th
2640: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
2650: 6e 73 74 20 66 61 6c 73 65 5d 2e 20 53 74 61 72  nst false]. Star
2660: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 31  ting in TclTLS 1
2670: 2e 38 2c 0a 75 73 65 20 6f 66 20 53 53 4c 20 76  .8,.use of SSL v
2680: 33 20 69 66 20 6f 6e 6c 79 20 61 76 61 69 6c 61  3 if only availa
2690: 62 6c 65 20 76 69 61 20 61 20 63 6f 6d 70 69 6c  ble via a compil
26a0: 65 20 74 69 6d 65 20 6f 70 74 69 6f 6e 2e 0a 4f  e time option..O
26b0: 70 65 6e 53 53 4c 20 34 2e 30 2b 20 6e 6f 20 6c  penSSL 4.0+ no l
26c0: 6f 6e 67 65 72 20 73 75 70 70 6f 72 74 73 20 53  onger supports S
26d0: 53 4c 20 76 33 2c 20 73 6f 20 74 68 69 73 20 6d  SL v3, so this m
26e0: 61 79 20 6e 6f 74 20 68 61 76 65 20 61 6e 79 20  ay not have any 
26f0: 65 66 66 65 63 74 2e 0a 53 65 65 20 74 68 65 20  effect..See the 
2700: 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63  [cmd tls::protoc
2710: 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f 72  ols] command for
2720: 20 73 75 70 70 6f 72 74 65 64 20 70 72 6f 74 6f   supported proto
2730: 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  cols...[opt_def 
2740: 2d 74 6c 73 31 20 5b 61 72 67 20 62 6f 6f 6c 5d  -tls1 [arg bool]
2750: 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20  ].Enable use of 
2760: 54 4c 53 20 76 31 2e 20 53 74 61 72 74 69 6e 67  TLS v1. Starting
2770: 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20   in TclTLS 2.0, 
2780: 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  the default is [
2790: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 4e 6f  const false]..No
27a0: 74 65 3a 20 54 4c 53 20 31 2e 30 20 6e 65 65 64  te: TLS 1.0 need
27b0: 73 20 53 48 41 31 20 74 6f 20 6f 70 65 72 61 74  s SHA1 to operat
27c0: 65 2c 20 77 68 69 63 68 20 69 73 20 6f 6e 6c 79  e, which is only
27d0: 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 73 65   available in se
27e0: 63 75 72 69 74 79 20 6c 65 76 65 6c 0a 30 20 66  curity level.0 f
27f0: 6f 72 20 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b  or Open SSL 3.0+
2800: 2e 20 53 65 65 20 74 68 65 20 5b 6f 70 74 69 6f  . See the [optio
2810: 6e 20 2d 73 65 63 75 72 69 74 79 5f 6c 65 76 65  n -security_leve
2820: 6c 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74  l] option...[opt
2830: 5f 64 65 66 20 2d 74 6c 73 31 2e 31 20 5b 61 72  _def -tls1.1 [ar
2840: 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20  g bool]].Enable 
2850: 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 31 2e  use of TLS v1.1.
2860: 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c   Starting in Tcl
2870: 54 4c 53 20 32 2e 30 2c 20 74 68 65 20 64 65 66  TLS 2.0, the def
2880: 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66  ault is [const f
2890: 61 6c 73 65 5d 2e 0a 4e 6f 74 65 3a 20 54 4c 53  alse]..Note: TLS
28a0: 20 31 2e 31 20 6e 65 65 64 73 20 53 48 41 31 20   1.1 needs SHA1 
28b0: 74 6f 20 6f 70 65 72 61 74 65 2c 20 77 68 69 63  to operate, whic
28c0: 68 20 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61  h is only availa
28d0: 62 6c 65 20 69 6e 20 73 65 63 75 72 69 74 79 20  ble in security 
28e0: 6c 65 76 65 6c 0a 30 20 66 6f 72 20 4f 70 65 6e  level.0 for Open
28f0: 20 53 53 4c 20 33 2e 30 2b 2e 20 53 65 65 20 74   SSL 3.0+. See t
2900: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 63 75  he [option -secu
2910: 72 69 74 79 5f 6c 65 76 65 6c 5d 20 6f 70 74 69  rity_level] opti
2920: 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74  on...[opt_def -t
2930: 6c 73 31 2e 32 20 5b 61 72 67 20 62 6f 6f 6c 5d  ls1.2 [arg bool]
2940: 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20  ].Enable use of 
2950: 54 4c 53 20 76 31 2e 32 2e 20 54 68 65 20 64 65  TLS v1.2. The de
2960: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
2970: 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66  true]...[opt_def
2980: 20 2d 74 6c 73 31 2e 33 20 5b 61 72 67 20 62 6f   -tls1.3 [arg bo
2990: 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20  ol]].Enable use 
29a0: 6f 66 20 54 4c 53 20 76 31 2e 33 2e 20 54 68 65  of TLS v1.3. The
29b0: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
29c0: 73 74 20 74 72 75 65 5d 2e 20 54 68 69 73 20 69  st true]. This i
29d0: 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65  s only available
29e0: 0a 73 74 61 72 74 69 6e 67 20 77 69 74 68 20 4f  .starting with O
29f0: 70 65 6e 53 53 4c 20 31 2e 31 2e 31 20 61 6e 64  penSSL 1.1.1 and
2a00: 20 54 63 6c 54 4c 53 20 31 2e 37 2e 0a 0a 5b 6f   TclTLS 1.7...[o
2a10: 70 74 5f 64 65 66 20 2d 76 61 6c 69 64 61 74 65  pt_def -validate
2a20: 63 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c  command [arg cal
2a30: 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65  lback]].Specifie
2a40: 73 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63  s the callback c
2a50: 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65  ommand to invoke
2a60: 20 74 6f 20 76 61 6c 69 64 61 74 65 20 74 68 65   to validate the
2a70: 20 70 65 65 72 20 63 65 72 74 69 66 69 63 61 74   peer certificat
2a80: 65 73 0a 61 6e 64 20 6f 74 68 65 72 20 63 6f 6e  es.and other con
2a90: 66 69 67 20 69 6e 66 6f 20 64 75 72 69 6e 67 20  fig info during 
2aa0: 74 68 65 20 70 72 6f 74 6f 63 6f 6c 20 6e 65 67  the protocol neg
2ab0: 6f 74 69 61 74 69 6f 6e 20 70 68 61 73 65 2e 20  otiation phase. 
2ac0: 54 68 69 73 20 63 61 6e 20 62 65 20 75 73 65 64  This can be used
2ad0: 0a 62 79 20 54 43 4c 20 73 63 72 69 70 74 73 20  .by TCL scripts 
2ae0: 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 69 72  to perform their
2af0: 20 6f 77 6e 20 43 65 72 74 69 66 69 63 61 74 65   own Certificate
2b00: 20 56 61 6c 69 64 61 74 69 6f 6e 20 74 6f 20 73   Validation to s
2b10: 75 70 70 6c 65 6d 65 6e 74 20 74 68 65 0a 64 65  upplement the.de
2b20: 66 61 75 6c 74 20 76 61 6c 69 64 61 74 69 6f 6e  fault validation
2b30: 20 70 72 6f 76 69 64 65 64 20 62 79 20 4f 70 65   provided by Ope
2b40: 6e 53 53 4c 2e 20 54 68 65 20 73 63 72 69 70 74  nSSL. The script
2b50: 20 6d 75 73 74 20 72 65 74 75 72 6e 20 61 20 62   must return a b
2b60: 6f 6f 6c 65 61 6e 20 74 72 75 65 0a 74 6f 20 63  oolean true.to c
2b70: 6f 6e 74 69 6e 75 65 20 74 68 65 20 6e 65 67 6f  ontinue the nego
2b80: 74 69 61 74 69 6f 6e 2e 20 53 65 65 20 5b 73 65  tiation. See [se
2b90: 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20  ctref "Callback 
2ba0: 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f  Options"] for mo
2bb0: 72 65 20 69 6e 66 6f 2e 0a 54 68 69 73 20 6f 70  re info..This op
2bc0: 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20  tion is new for 
2bd0: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69  TclTLS 1.8...[li
2be0: 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b  st_end]..[call [
2bf0: 63 6d 64 20 74 6c 73 3a 3a 68 61 6e 64 73 68 61  cmd tls::handsha
2c00: 6b 65 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c  ke] [arg channel
2c10: 5d 5d 0a 0a 46 6f 72 63 65 73 20 74 68 65 20 54  ]]..Forces the T
2c20: 4c 53 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20 68  LS negotiation h
2c30: 61 6e 64 73 68 61 6b 65 20 74 6f 20 74 61 6b 65  andshake to take
2c40: 20 70 6c 61 63 65 20 69 6d 6d 65 64 69 61 74 65   place immediate
2c50: 6c 79 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20  ly, and returns 
2c60: 30 0a 69 66 20 68 61 6e 64 73 68 61 6b 65 20 69  0.if handshake i
2c70: 73 20 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72  s still in progr
2c80: 65 73 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e  ess (non-blockin
2c90: 67 29 2c 20 6f 72 20 31 20 69 66 20 74 68 65 20  g), or 1 if the 
2ca0: 68 61 6e 64 73 68 61 6b 65 20 77 61 73 0a 73 75  handshake was.su
2cb0: 63 63 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65  ccessful. If the
2cc0: 20 68 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65   handshake faile
2cd0: 64 2c 20 61 6e 20 65 72 72 6f 72 20 77 69 6c 6c  d, an error will
2ce0: 20 62 65 20 72 65 74 75 72 6e 65 64 2e 0a 0a 5b   be returned...[
2cf0: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73  call [cmd tls::s
2d00: 68 75 74 64 6f 77 6e 5d 20 5b 61 72 67 20 63 68  hutdown] [arg ch
2d10: 61 6e 6e 65 6c 5d 5d 0a 0a 5b 63 61 6c 6c 20 5b  annel]]..[call [
2d20: 63 6d 64 20 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72  cmd tls::unimpor
2d30: 74 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  t] [arg channel]
2d40: 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ]..[call [cmd tl
2d50: 73 3a 3a 75 6e 73 74 61 63 6b 5d 20 5b 61 72 67  s::unstack] [arg
2d60: 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 54 68 69 73   channel]]..This
2d70: 20 74 65 72 6d 69 6e 61 74 65 73 20 74 68 65 20   terminates the 
2d80: 53 53 4c 2f 54 4c 53 20 73 65 73 73 69 6f 6e 20  SSL/TLS session 
2d90: 62 79 20 73 65 6e 64 69 6e 67 20 74 68 65 20 22  by sending the "
2da0: 63 6c 6f 73 65 5f 6e 6f 74 69 66 79 22 20 6d 65  close_notify" me
2db0: 73 73 61 67 65 20 61 6e 64 0a 72 65 6d 6f 76 65  ssage and.remove
2dc0: 73 20 74 68 65 20 74 6f 70 20 6c 65 76 65 6c 20  s the top level 
2dd0: 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 20  stacked channel 
2de0: 66 72 6f 6d 20 5b 61 72 67 20 63 68 61 6e 6e 65  from [arg channe
2df0: 6c 5d 2c 20 62 75 74 20 69 74 20 64 6f 65 73 20  l], but it does 
2e00: 6e 6f 74 20 63 6c 6f 73 65 0a 74 68 65 20 73 6f  not close.the so
2e10: 63 6b 65 74 2e 20 49 74 20 69 73 20 74 68 65 20  cket. It is the 
2e20: 63 6f 6d 70 6c 69 6d 65 6e 74 20 74 6f 20 5b 63  compliment to [c
2e30: 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20  md tls::import] 
2e40: 62 79 20 65 6e 64 69 6e 67 20 65 6e 63 72 79 70  by ending encryp
2e50: 74 69 6f 6e 20 6f 66 0a 61 20 54 43 4c 20 63 68  tion of.a TCL ch
2e60: 61 6e 6e 65 6c 2e 20 41 6e 20 65 72 72 6f 72 20  annel. An error 
2e70: 69 73 20 74 68 72 6f 77 6e 20 69 66 20 54 4c 53  is thrown if TLS
2e80: 20 69 73 20 6e 6f 74 20 74 68 65 20 74 6f 70 20   is not the top 
2e90: 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 20  stacked channel 
2ea0: 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  type...[call [cm
2eb0: 64 20 74 6c 73 3a 3a 73 74 61 74 75 73 5d 20 5b  d tls::status] [
2ec0: 6f 70 74 20 5b 6f 70 74 69 6f 6e 20 2d 6c 6f 63  opt [option -loc
2ed0: 61 6c 5d 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65  al]] [arg channe
2ee0: 6c 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68 65  l]]..Returns the
2ef0: 20 63 75 72 72 65 6e 74 20 73 74 61 74 75 73 20   current status 
2f00: 6f 66 20 61 6e 20 53 53 4c 20 63 68 61 6e 6e 65  of an SSL channe
2f10: 6c 2e 20 54 68 65 20 72 65 73 75 6c 74 20 69 73  l. The result is
2f20: 20 61 20 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76   a list of key-v
2f30: 61 6c 75 65 0a 70 61 69 72 73 20 64 65 73 63 72  alue.pairs descr
2f40: 69 62 69 6e 67 20 74 68 65 20 53 53 4c 2c 20 63  ibing the SSL, c
2f50: 65 72 74 69 66 69 63 61 74 65 2c 20 61 6e 64 20  ertificate, and 
2f60: 63 65 72 74 69 66 69 63 61 74 65 20 76 65 72 69  certificate veri
2f70: 66 69 63 61 74 69 6f 6e 20 73 74 61 74 75 73 2e  fication status.
2f80: 20 49 66 0a 74 68 65 20 53 53 4c 20 68 61 6e 64   If.the SSL hand
2f90: 73 68 61 6b 65 20 68 61 73 20 6e 6f 74 20 79 65  shake has not ye
2fa0: 74 20 63 6f 6d 70 6c 65 74 65 64 2c 20 61 6e 20  t completed, an 
2fb0: 65 6d 70 74 79 20 6c 69 73 74 20 69 73 20 72 65  empty list is re
2fc0: 74 75 72 6e 65 64 2e 20 49 66 20 74 68 65 0a 5b  turned. If the.[
2fd0: 6f 70 74 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 20 6f  option -local] o
2fe0: 70 74 69 6f 6e 20 69 73 20 73 70 65 63 69 66 69  ption is specifi
2ff0: 65 64 2c 20 74 68 65 6e 20 74 68 65 20 6c 6f 63  ed, then the loc
3000: 61 6c 20 63 65 72 74 69 66 69 63 61 74 65 20 69  al certificate i
3010: 73 20 75 73 65 64 2e 0a 52 65 74 75 72 6e 65 64  s used..Returned
3020: 20 76 61 6c 75 65 73 20 69 6e 63 6c 75 64 65 3a   values include:
3030: 0a 0a 5b 70 61 72 61 5d 0a 0a 53 53 4c 20 53 74  ..[para]..SSL St
3040: 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  atus..[list_begi
3050: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a  n definitions]..
3060: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d  [def "[var alpn]
3070: 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22   [arg protocol]"
3080: 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73  ].The protocol s
3090: 65 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70  elected after Ap
30a0: 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20  plication-Layer 
30b0: 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61  Protocol Negotia
30c0: 74 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a 54 68 69  tion (ALPN)..Thi
30d0: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
30e0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
30f0: 5b 64 65 66 20 22 5b 76 61 72 20 63 69 70 68 65  [def "[var ciphe
3100: 72 5d 20 5b 61 72 67 20 63 69 70 68 65 72 5d 22  r] [arg cipher]"
3110: 5d 0a 54 68 65 20 63 75 72 72 65 6e 74 20 63 69  ].The current ci
3120: 70 68 65 72 20 69 6e 20 75 73 65 20 66 6f 72 20  pher in use for 
3130: 74 68 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64  the session...[d
3140: 65 66 20 22 5b 76 61 72 20 70 65 65 72 6e 61 6d  ef "[var peernam
3150: 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a  e] [arg name]"].
3160: 54 68 65 20 70 65 65 72 6e 61 6d 65 20 66 72 6f  The peername fro
3170: 6d 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  m the certificat
3180: 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  e..This value is
3190: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
31a0: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
31b0: 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72 67 20   protocol] [arg 
31c0: 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 70  version]"].The p
31d0: 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 20  rotocol version 
31e0: 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 6f 6e  used for the con
31f0: 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c 20 53  nection: SSL2, S
3200: 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53 31 2e  SL3, TLS1, TLS1.
3210: 31 2c 20 54 4c 53 31 2e 32 2c 0a 54 4c 53 31 2e  1, TLS1.2,.TLS1.
3220: 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 20 54  3, or unknown. T
3230: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3240: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3250: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 62 69  ..[def "[var sbi
3260: 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 54 68  ts] [arg n]"].Th
3270: 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 69 74 73  e number of bits
3280: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 73 65   used for the se
3290: 73 73 69 6f 6e 20 6b 65 79 2e 0a 0a 5b 64 65 66  ssion key...[def
32a0: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65   "[var signature
32b0: 48 61 73 68 41 6c 67 6f 72 69 74 68 6d 5d 20 5b  HashAlgorithm] [
32c0: 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d  arg algorithm]"]
32d0: 0a 54 68 65 20 73 69 67 6e 61 74 75 72 65 20 68  .The signature h
32e0: 61 73 68 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 54  ash algorithm..T
32f0: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3300: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3310: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67  ..[def "[var sig
3320: 6e 61 74 75 72 65 54 79 70 65 5d 20 5b 61 72 67  natureType] [arg
3330: 20 74 79 70 65 5d 22 5d 0a 54 68 65 20 73 69 67   type]"].The sig
3340: 6e 61 74 75 72 65 20 74 79 70 65 20 76 61 6c 75  nature type valu
3350: 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  e..This value is
3360: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
3370: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
3380: 20 76 65 72 69 66 79 44 65 70 74 68 5d 20 5b 61   verifyDepth] [a
3390: 72 67 20 6e 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20  rg n]"].Maximum 
33a0: 64 65 70 74 68 20 66 6f 72 20 74 68 65 20 63 65  depth for the ce
33b0: 72 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 20  rtificate chain 
33c0: 76 65 72 69 66 69 63 61 74 69 6f 6e 2e 20 44 65  verification. De
33d0: 66 61 75 6c 74 20 69 73 20 2d 31 2c 20 74 6f 20  fault is -1, to 
33e0: 63 68 65 63 6b 20 61 6c 6c 2e 0a 54 68 69 73 20  check all..This 
33f0: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3400: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
3410: 65 66 20 22 5b 76 61 72 20 76 65 72 69 66 79 4d  ef "[var verifyM
3420: 6f 64 65 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22  ode] [arg list]"
3430: 5d 0a 4c 69 73 74 20 6f 66 20 63 65 72 74 69 66  ].List of certif
3440: 69 63 61 74 65 20 76 65 72 69 66 69 63 61 74 69  icate verificati
3450: 6f 6e 20 6d 6f 64 65 73 2e 0a 54 68 69 73 20 76  on modes..This v
3460: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20  alue is new for 
3470: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65  TclTLS 1.8...[de
3480: 66 20 22 5b 76 61 72 20 76 65 72 69 66 79 52 65  f "[var verifyRe
3490: 73 75 6c 74 5d 20 5b 61 72 67 20 72 65 73 75 6c  sult] [arg resul
34a0: 74 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74 65  t]"].Certificate
34b0: 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 72 65   verification re
34c0: 73 75 6c 74 2e 0a 54 68 69 73 20 76 61 6c 75 65  sult..This value
34d0: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
34e0: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
34f0: 76 61 72 20 63 61 5f 6e 61 6d 65 73 5d 20 5b 61  var ca_names] [a
3500: 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20  rg list]"].List 
3510: 6f 66 20 74 68 65 20 43 65 72 74 69 66 69 63 61  of the Certifica
3520: 74 65 20 41 75 74 68 6f 72 69 74 69 65 73 20 75  te Authorities u
3530: 73 65 64 20 74 6f 20 63 72 65 61 74 65 20 74 68  sed to create th
3540: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54  e certificate..T
3550: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3560: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3570: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43 65  ..[list_end]..Ce
3580: 72 74 69 66 69 63 61 74 65 20 53 74 61 74 75 73  rtificate Status
3590: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
35a0: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
35b0: 20 22 5b 76 61 72 20 61 6c 6c 5d 20 5b 61 72 67   "[var all] [arg
35c0: 20 73 74 72 69 6e 67 5d 22 5d 0a 44 75 6d 70 20   string]"].Dump 
35d0: 6f 66 20 61 6c 6c 20 63 65 72 74 69 66 69 63 61  of all certifica
35e0: 74 65 20 69 6e 66 6f 2e 0a 54 68 69 73 20 76 61  te info..This va
35f0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3600: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3610: 20 22 5b 76 61 72 20 76 65 72 73 69 6f 6e 5d 20   "[var version] 
3620: 5b 61 72 67 20 76 61 6c 75 65 5d 22 5d 0a 54 68  [arg value]"].Th
3630: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 76 65  e certificate ve
3640: 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76  rsion...[def "[v
3650: 61 72 20 73 65 72 69 61 6c 4e 75 6d 62 65 72 5d  ar serialNumber]
3660: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3670: 54 68 65 20 73 65 72 69 61 6c 20 6e 75 6d 62 65  The serial numbe
3680: 72 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  r of the certifi
3690: 63 61 74 65 20 61 73 20 61 20 68 65 78 20 73 74  cate as a hex st
36a0: 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65  ring..This value
36b0: 20 77 61 73 20 63 68 61 6e 67 65 64 20 66 72 6f   was changed fro
36c0: 6d 20 73 65 72 69 61 6c 20 69 6e 20 54 63 6c 54  m serial in TclT
36d0: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
36e0: 76 61 72 20 73 69 67 6e 61 74 75 72 65 5d 20 5b  var signature] [
36f0: 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d  arg algorithm]"]
3700: 0a 43 69 70 68 65 72 20 61 6c 67 6f 72 69 74 68  .Cipher algorith
3710: 6d 20 75 73 65 64 20 66 6f 72 20 63 65 72 74 69  m used for certi
3720: 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65  ficate signature
3730: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
3740: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
3750: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
3760: 69 73 73 75 65 72 5d 20 5b 61 72 67 20 73 74 72  issuer] [arg str
3770: 69 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73 74 69  ing]"].The disti
3780: 6e 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44  nguished name (D
3790: 4e 29 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  N) of the certif
37a0: 69 63 61 74 65 20 69 73 73 75 65 72 2e 0a 0a 5b  icate issuer...[
37b0: 64 65 66 20 22 5b 76 61 72 20 6e 6f 74 42 65 66  def "[var notBef
37c0: 6f 72 65 5d 20 5b 61 72 67 20 64 61 74 65 5d 22  ore] [arg date]"
37d0: 5d 0a 54 68 65 20 62 65 67 69 6e 6e 69 6e 67 20  ].The beginning 
37e0: 64 61 74 65 20 6f 66 20 74 68 65 20 63 65 72 74  date of the cert
37f0: 69 66 69 63 61 74 65 20 76 61 6c 69 64 69 74 79  ificate validity
3800: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6e 6f  ...[def "[var no
3810: 74 41 66 74 65 72 5d 20 5b 61 72 67 20 64 61 74  tAfter] [arg dat
3820: 65 5d 22 5d 0a 54 68 65 20 65 78 70 69 72 61 74  e]"].The expirat
3830: 69 6f 6e 20 64 61 74 65 20 6f 66 20 74 68 65 20  ion date of the 
3840: 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c 69  certificate vali
3850: 64 69 74 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  dity...[def "[va
3860: 72 20 73 75 62 6a 65 63 74 5d 20 5b 61 72 67 20  r subject] [arg 
3870: 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20 64 69  string]"].The di
3880: 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d 65  stinguished name
3890: 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65 72   (DN) of the cer
38a0: 74 69 66 69 63 61 74 65 20 73 75 62 6a 65 63 74  tificate subject
38b0: 2e 20 46 69 65 6c 64 73 20 69 6e 63 6c 75 64 65  . Fields include
38c0: 3a 20 43 6f 6d 6d 6f 6e 0a 4e 61 6d 65 20 28 43  : Common.Name (C
38d0: 4e 29 2c 20 4f 72 67 61 6e 69 7a 61 74 69 6f 6e  N), Organization
38e0: 20 28 4f 29 2c 20 4c 6f 63 61 6c 69 74 79 20 6f   (O), Locality o
38f0: 72 20 43 69 74 79 20 28 4c 29 2c 20 53 74 61 74  r City (L), Stat
3900: 65 20 6f 72 20 50 72 6f 76 69 6e 63 65 20 28 53  e or Province (S
3910: 29 2c 20 61 6e 64 0a 43 6f 75 6e 74 72 79 20 4e  ), and.Country N
3920: 61 6d 65 20 28 43 29 2e 0a 0a 5b 64 65 66 20 22  ame (C)...[def "
3930: 5b 76 61 72 20 69 73 73 75 65 72 55 6e 69 71 75  [var issuerUniqu
3940: 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  eID] [arg string
3950: 5d 22 5d 0a 54 68 65 20 69 73 73 75 65 72 20 75  ]"].The issuer u
3960: 6e 69 71 75 65 20 69 64 2e 0a 54 68 69 73 20 76  nique id..This v
3970: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20  alue is new for 
3980: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65  TclTLS 1.8...[de
3990: 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74 55  f "[var subjectU
39a0: 6e 69 71 75 65 49 44 5d 20 5b 61 72 67 20 73 74  niqueID] [arg st
39b0: 72 69 6e 67 5d 22 5d 0a 54 68 65 20 73 75 62 6a  ring]"].The subj
39c0: 65 63 74 20 75 6e 69 71 75 65 20 69 64 2e 0a 54  ect unique id..T
39d0: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
39e0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
39f0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6e 75 6d  ..[def "[var num
3a00: 5f 65 78 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72  _extensions] [ar
3a10: 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65 72 20 6f 66  g n]"].Number of
3a20: 20 63 65 72 74 69 66 69 63 61 74 65 20 65 78 74   certificate ext
3a30: 65 6e 73 69 6f 6e 73 2e 0a 54 68 69 73 20 76 61  ensions..This va
3a40: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3a50: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3a60: 20 22 5b 76 61 72 20 65 78 74 65 6e 73 69 6f 6e   "[var extension
3a70: 73 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a  s] [arg list]"].
3a80: 4c 69 73 74 20 6f 66 20 63 65 72 74 69 66 69 63  List of certific
3a90: 61 74 65 20 65 78 74 65 6e 73 69 6f 6e 20 6e 61  ate extension na
3aa0: 6d 65 73 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  mes..This value 
3ab0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3ac0: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3ad0: 61 72 20 61 75 74 68 6f 72 69 74 79 4b 65 79 49  ar authorityKeyI
3ae0: 64 65 6e 74 69 66 69 65 72 5d 20 5b 61 72 67 20  dentifier] [arg 
3af0: 73 74 72 69 6e 67 5d 22 5d 0a 41 75 74 68 6f 72  string]"].Author
3b00: 69 74 79 20 4b 65 79 20 49 64 65 6e 74 69 66 69  ity Key Identifi
3b10: 65 72 20 28 41 4b 49 29 20 6f 66 20 74 68 65 20  er (AKI) of the 
3b20: 49 73 73 75 69 6e 67 20 43 41 20 63 65 72 74 69  Issuing CA certi
3b30: 66 69 63 61 74 65 20 74 68 61 74 20 73 69 67 6e  ficate that sign
3b40: 65 64 20 74 68 65 0a 53 53 4c 20 63 65 72 74 69  ed the.SSL certi
3b50: 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78 20  ficate as a hex 
3b60: 73 74 72 69 6e 67 2e 20 54 68 69 73 20 76 61 6c  string. This val
3b70: 75 65 20 6d 61 74 63 68 65 73 20 74 68 65 20 53  ue matches the S
3b80: 4b 49 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a  KI value of the.
3b90: 49 6e 74 65 72 6d 65 64 69 61 74 65 20 43 41 20  Intermediate CA 
3ba0: 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69  certificate..Thi
3bb0: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3bc0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3bd0: 5b 64 65 66 20 22 5b 76 61 72 20 73 75 62 6a 65  [def "[var subje
3be0: 63 74 4b 65 79 49 64 65 6e 74 69 66 69 65 72 5d  ctKeyIdentifier]
3bf0: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3c00: 53 75 62 6a 65 63 74 20 4b 65 79 20 49 64 65 6e  Subject Key Iden
3c10: 74 69 66 69 65 72 20 28 53 4b 49 29 20 68 61 73  tifier (SKI) has
3c20: 68 20 6f 66 20 74 68 65 20 70 75 62 6c 69 63 20  h of the public 
3c30: 6b 65 79 20 69 6e 73 69 64 65 20 74 68 65 20 63  key inside the c
3c40: 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61 0a  ertificate as a.
3c50: 68 65 78 20 73 74 72 69 6e 67 2e 20 55 73 65 64  hex string. Used
3c60: 20 74 6f 20 69 64 65 6e 74 69 66 79 20 63 65 72   to identify cer
3c70: 74 69 66 69 63 61 74 65 73 20 74 68 61 74 20 63  tificates that c
3c80: 6f 6e 74 61 69 6e 20 61 20 70 61 72 74 69 63 75  ontain a particu
3c90: 6c 61 72 20 70 75 62 6c 69 63 20 6b 65 79 2e 0a  lar public key..
3ca0: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
3cb0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
3cc0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 75  ...[def "[var su
3cd0: 62 6a 65 63 74 41 6c 74 4e 61 6d 65 5d 20 5b 61  bjectAltName] [a
3ce0: 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20  rg list]"].List 
3cf0: 6f 66 20 61 6c 6c 20 6f 66 20 74 68 65 20 53 75  of all of the Su
3d00: 62 6a 65 63 74 20 41 6c 74 65 72 6e 61 74 69 76  bject Alternativ
3d10: 65 20 4e 61 6d 65 73 20 28 53 41 4e 29 20 69 6e  e Names (SAN) in
3d20: 63 6c 75 64 69 6e 67 20 64 6f 6d 61 69 6e 20 6e  cluding domain n
3d30: 61 6d 65 73 2c 20 73 75 62 0a 64 6f 6d 61 69 6e  ames, sub.domain
3d40: 73 2c 20 61 6e 64 20 49 50 20 61 64 64 72 65 73  s, and IP addres
3d50: 73 65 73 20 74 68 61 74 20 61 72 65 20 73 65 63  ses that are sec
3d60: 75 72 65 64 20 62 79 20 74 68 65 20 63 65 72 74  ured by the cert
3d70: 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61  ificate..This va
3d80: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3d90: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3da0: 20 22 5b 76 61 72 20 6f 63 73 70 5d 20 5b 61 72   "[var ocsp] [ar
3db0: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f  g list]"].List o
3dc0: 66 20 61 6c 6c 20 4f 6e 6c 69 6e 65 20 43 65 72  f all Online Cer
3dd0: 74 69 66 69 63 61 74 65 20 53 74 61 74 75 73 20  tificate Status 
3de0: 50 72 6f 74 6f 63 6f 6c 20 28 4f 43 53 50 29 20  Protocol (OCSP) 
3df0: 55 52 4c 73 20 74 68 61 74 20 63 61 6e 20 62 65  URLs that can be
3e00: 20 75 73 65 64 20 74 6f 0a 63 68 65 63 6b 20 74   used to.check t
3e10: 68 65 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74  he validity of t
3e20: 68 69 73 20 63 65 72 74 69 66 69 63 61 74 65 2e  his certificate.
3e30: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3e40: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3e50: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  8...[def "[var c
3e60: 65 72 74 69 66 69 63 61 74 65 5d 20 5b 61 72 67  ertificate] [arg
3e70: 20 63 65 72 74 5d 22 5d 0a 54 68 65 20 50 45 4d   cert]"].The PEM
3e80: 20 65 6e 63 6f 64 65 64 20 63 65 72 74 69 66 69   encoded certifi
3e90: 63 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  cate...[def "[va
3ea0: 72 20 73 69 67 6e 61 74 75 72 65 41 6c 67 6f 72  r signatureAlgor
3eb0: 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72  ithm] [arg algor
3ec0: 69 74 68 6d 5d 22 5d 0a 43 69 70 68 65 72 20 61  ithm]"].Cipher a
3ed0: 6c 67 6f 72 69 74 68 6d 20 75 73 65 64 20 66 6f  lgorithm used fo
3ee0: 72 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  r the certificat
3ef0: 65 20 73 69 67 6e 61 74 75 72 65 2e 0a 54 68 69  e signature..Thi
3f00: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3f10: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3f20: 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61  [def "[var signa
3f30: 74 75 72 65 56 61 6c 75 65 5d 20 5b 61 72 67 20  tureValue] [arg 
3f40: 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66  string]"].Certif
3f50: 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20  icate signature 
3f60: 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e  as a hex string.
3f70: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3f80: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3f90: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  8...[def "[var s
3fa0: 69 67 6e 61 74 75 72 65 44 69 67 65 73 74 5d 20  ignatureDigest] 
3fb0: 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a  [arg version]"].
3fc0: 43 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e  Certificate sign
3fd0: 69 6e 67 20 64 69 67 65 73 74 20 61 73 20 61 20  ing digest as a 
3fe0: 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68 69 73  hex string..This
3ff0: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
4000: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
4010: 64 65 66 20 22 5b 76 61 72 20 70 75 62 6c 69 63  def "[var public
4020: 4b 65 79 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61  KeyAlgorithm] [a
4030: 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a  rg algorithm]"].
4040: 43 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e  Certificate sign
4050: 61 74 75 72 65 20 70 75 62 6c 69 63 20 6b 65 79  ature public key
4060: 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 54 68 69 73   algorithm..This
4070: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
4080: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
4090: 64 65 66 20 22 5b 76 61 72 20 70 75 62 6c 69 63  def "[var public
40a0: 4b 65 79 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  Key] [arg string
40b0: 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74 65 20  ]"].Certificate 
40c0: 73 69 67 6e 61 74 75 72 65 20 70 75 62 6c 69 63  signature public
40d0: 20 6b 65 79 20 61 73 20 61 20 68 65 78 20 73 74   key as a hex st
40e0: 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65  ring..This value
40f0: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
4100: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
4110: 76 61 72 20 62 69 74 73 5d 20 5b 61 72 67 20 6e  var bits] [arg n
4120: 5d 22 5d 0a 4e 75 6d 62 65 72 20 6f 66 20 62 69  ]"].Number of bi
4130: 74 73 20 75 73 65 64 20 66 6f 72 20 63 65 72 74  ts used for cert
4140: 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72  ificate signatur
4150: 65 20 6b 65 79 2e 0a 54 68 69 73 20 76 61 6c 75  e key..This valu
4160: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
4170: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
4180: 5b 76 61 72 20 73 65 6c 66 5f 73 69 67 6e 65 64  [var self_signed
4190: 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22  ] [arg boolean]"
41a0: 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 63 65  ].Whether the ce
41b0: 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74  rtificate signat
41c0: 75 72 65 20 69 73 20 73 65 6c 66 20 73 69 67 6e  ure is self sign
41d0: 65 64 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  ed..This value i
41e0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
41f0: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   1.8...[def "[va
4200: 72 20 73 68 61 31 5f 68 61 73 68 5d 20 5b 61 72  r sha1_hash] [ar
4210: 67 20 68 61 73 68 5d 22 5d 0a 54 68 65 20 53 48  g hash]"].The SH
4220: 41 31 20 68 61 73 68 20 6f 66 20 74 68 65 20 63  A1 hash of the c
4230: 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61 20  ertificate as a 
4240: 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68 69 73  hex string..This
4250: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
4260: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
4270: 64 65 66 20 22 5b 76 61 72 20 73 68 61 32 35 36  def "[var sha256
4280: 5f 68 61 73 68 5d 20 5b 61 72 67 20 68 61 73 68  _hash] [arg hash
4290: 5d 22 5d 0a 54 68 65 20 53 48 41 32 35 36 20 68  ]"].The SHA256 h
42a0: 61 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 69  ash of the certi
42b0: 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78 20  ficate as a hex 
42c0: 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c  string..This val
42d0: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
42e0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74  lTLS 1.8...[list
42f0: 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  _end]..[call [cm
4300: 64 20 74 6c 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f  d tls::connectio
4310: 6e 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  n] [arg channel]
4320: 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 20 63  ]..Returns the c
4330: 75 72 72 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f  urrent connectio
4340: 6e 20 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53  n status of an S
4350: 53 4c 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20  SL channel. The 
4360: 72 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73 74  result is a list
4370: 0a 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61  .of key-value pa
4380: 69 72 73 20 64 65 73 63 72 69 62 69 6e 67 20 74  irs describing t
4390: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 54  he connection..T
43a0: 68 69 73 20 63 6f 6d 6d 61 6e 64 20 69 73 20 6e  his command is n
43b0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
43c0: 38 2e 20 52 65 74 75 72 6e 65 64 20 76 61 6c 75  8. Returned valu
43d0: 65 73 20 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61  es include:..[pa
43e0: 72 61 5d 0a 0a 53 53 4c 20 53 74 61 74 75 73 0a  ra]..SSL Status.
43f0: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66  .[list_begin def
4400: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20  initions]..[def 
4410: 22 5b 76 61 72 20 73 74 61 74 65 5d 20 5b 61 72  "[var state] [ar
4420: 67 20 73 74 61 74 65 5d 22 5d 0a 53 74 61 74 65  g state]"].State
4430: 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 69   of the connecti
4440: 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  on...[def "[var 
4450: 73 65 72 76 65 72 6e 61 6d 65 5d 20 5b 61 72 67  servername] [arg
4460: 20 6e 61 6d 65 5d 22 5d 0a 54 68 65 20 6e 61 6d   name]"].The nam
4470: 65 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74  e of the connect
4480: 65 64 20 74 6f 20 73 65 72 76 65 72 2e 0a 0a 5b  ed to server...[
4490: 64 65 66 20 22 5b 76 61 72 20 70 72 6f 74 6f 63  def "[var protoc
44a0: 6f 6c 5d 20 5b 61 72 67 20 76 65 72 73 69 6f 6e  ol] [arg version
44b0: 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c  ]"].The protocol
44c0: 20 76 65 72 73 69 6f 6e 20 75 73 65 64 20 66 6f   version used fo
44d0: 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  r the connection
44e0: 3a 20 53 53 4c 32 2c 20 53 53 4c 33 2c 20 54 4c  : SSL2, SSL3, TL
44f0: 53 31 2c 20 54 4c 53 31 2e 31 2c 20 54 4c 53 31  S1, TLS1.1, TLS1
4500: 2e 32 2c 20 54 4c 53 31 2e 33 2c 20 6f 72 20 75  .2, TLS1.3, or u
4510: 6e 6b 6e 6f 77 6e 2e 0a 0a 5b 64 65 66 20 22 5b  nknown...[def "[
4520: 76 61 72 20 72 65 6e 65 67 6f 74 69 61 74 69 6f  var renegotiatio
4530: 6e 5f 61 6c 6c 6f 77 65 64 5d 20 5b 61 72 67 20  n_allowed] [arg 
4540: 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68  boolean]"].Wheth
4550: 65 72 20 70 72 6f 74 6f 63 6f 6c 20 72 65 6e 65  er protocol rene
4560: 67 6f 74 69 61 74 69 6f 6e 20 69 73 20 73 75 70  gotiation is sup
4570: 70 6f 72 74 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a  ported or not...
4580: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 63 75 72  [def "[var secur
4590: 69 74 79 5f 6c 65 76 65 6c 5d 20 5b 61 72 67 20  ity_level] [arg 
45a0: 6c 65 76 65 6c 5d 22 5d 0a 54 68 65 20 73 65 63  level]"].The sec
45b0: 75 72 69 74 79 20 6c 65 76 65 6c 20 75 73 65 64  urity level used
45c0: 20 66 6f 72 20 73 65 6c 65 63 74 69 6f 6e 20 6f   for selection o
45d0: 66 20 63 69 70 68 65 72 73 2c 20 6b 65 79 20 73  f ciphers, key s
45e0: 69 7a 65 2c 20 65 74 63 2e 0a 0a 5b 64 65 66 20  ize, etc...[def 
45f0: 22 5b 76 61 72 20 73 65 73 73 69 6f 6e 5f 72 65  "[var session_re
4600: 75 73 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65  used] [arg boole
4610: 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68  an]"].Whether th
4620: 65 20 73 65 73 73 69 6f 6e 20 68 61 73 20 62 65  e session has be
4630: 65 6e 20 72 65 75 73 65 64 20 6f 72 20 6e 6f 74  en reused or not
4640: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73  ...[def "[var is
4650: 5f 73 65 72 76 65 72 5d 20 5b 61 72 67 20 62 6f  _server] [arg bo
4660: 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72  olean]"].Whether
4670: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20   the connection 
4680: 69 73 20 63 6f 6e 66 69 67 75 72 65 64 20 61 73  is configured as
4690: 20 61 20 73 65 72 76 65 72 20 28 31 29 20 6f 72   a server (1) or
46a0: 20 63 6c 69 65 6e 74 20 28 30 29 2e 0a 0a 5b 64   client (0)...[d
46b0: 65 66 20 22 5b 76 61 72 20 63 6f 6d 70 72 65 73  ef "[var compres
46c0: 73 69 6f 6e 5d 20 5b 61 72 67 20 6d 6f 64 65 5d  sion] [arg mode]
46d0: 22 5d 0a 43 6f 6d 70 72 65 73 73 69 6f 6e 20 6d  "].Compression m
46e0: 65 74 68 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b 76  ethod...[def "[v
46f0: 61 72 20 65 78 70 61 6e 73 69 6f 6e 5d 20 5b 61  ar expansion] [a
4700: 72 67 20 6d 6f 64 65 5d 22 5d 0a 45 78 70 61 6e  rg mode]"].Expan
4710: 73 69 6f 6e 20 6d 65 74 68 6f 64 2e 0a 0a 5b 64  sion method...[d
4720: 65 66 20 22 5b 76 61 72 20 63 61 4c 69 73 74 5d  ef "[var caList]
4730: 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69   [arg list]"].Li
4740: 73 74 20 6f 66 20 43 65 72 74 69 66 69 63 61 74  st of Certificat
4750: 65 20 41 75 74 68 6f 72 69 74 69 65 73 20 28 43  e Authorities (C
4760: 41 29 20 66 6f 72 20 58 2e 35 30 39 20 63 65 72  A) for X.509 cer
4770: 74 69 66 69 63 61 74 65 2e 0a 0a 5b 6c 69 73 74  tificate...[list
4780: 5f 65 6e 64 5d 0a 0a 43 69 70 68 65 72 20 49 6e  _end]..Cipher In
4790: 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  fo..[list_begin 
47a0: 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64  definitions]..[d
47b0: 65 66 20 22 5b 76 61 72 20 63 69 70 68 65 72 5d  ef "[var cipher]
47c0: 20 5b 61 72 67 20 63 69 70 68 65 72 5d 22 5d 0a   [arg cipher]"].
47d0: 54 68 65 20 63 75 72 72 65 6e 74 20 63 69 70 68  The current ciph
47e0: 65 72 20 69 6e 20 75 73 65 20 66 6f 72 20 74 68  er in use for th
47f0: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b  e connection...[
4800: 64 65 66 20 22 5b 76 61 72 20 73 74 61 6e 64 61  def "[var standa
4810: 72 64 5f 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61  rd_name] [arg na
4820: 6d 65 5d 22 5d 0a 54 68 65 20 73 74 61 6e 64 61  me]"].The standa
4830: 72 64 20 52 46 43 20 6e 61 6d 65 20 6f 66 20 63  rd RFC name of c
4840: 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  ipher...[def "[v
4850: 61 72 20 61 6c 67 6f 72 69 74 68 6d 5f 62 69 74  ar algorithm_bit
4860: 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65  s] [arg n]"].The
4870: 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 6f 63 65   number of proce
4880: 73 73 65 64 20 62 69 74 73 20 75 73 65 64 20 66  ssed bits used f
4890: 6f 72 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66  or cipher...[def
48a0: 20 22 5b 76 61 72 20 73 65 63 72 65 74 5f 62 69   "[var secret_bi
48b0: 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 54 68  ts] [arg n]"].Th
48c0: 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 65 63 72  e number of secr
48d0: 65 74 20 62 69 74 73 20 75 73 65 64 20 66 6f 72  et bits used for
48e0: 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22   cipher...[def "
48f0: 5b 76 61 72 20 6d 69 6e 5f 76 65 72 73 69 6f 6e  [var min_version
4900: 5d 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22  ] [arg version]"
4910: 5d 0a 54 68 65 20 6d 69 6e 69 6d 75 6d 20 70 72  ].The minimum pr
4920: 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 20 66  otocol version f
4930: 6f 72 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66  or cipher...[def
4940: 20 22 5b 76 61 72 20 63 69 70 68 65 72 5f 69 73   "[var cipher_is
4950: 5f 61 65 61 64 5d 20 5b 61 72 67 20 62 6f 6f 6c  _aead] [arg bool
4960: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74  ean]"].Whether t
4970: 68 65 20 63 69 70 68 65 72 20 69 73 20 41 75 74  he cipher is Aut
4980: 68 65 6e 74 69 63 61 74 65 64 20 45 6e 63 72 79  henticated Encry
4990: 70 74 69 6f 6e 20 77 69 74 68 20 41 73 73 6f 63  ption with Assoc
49a0: 69 61 74 65 64 20 44 61 74 61 20 28 41 45 41 44  iated Data (AEAD
49b0: 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  )...[def "[var c
49c0: 69 70 68 65 72 5f 69 64 5d 20 5b 61 72 67 20 69  ipher_id] [arg i
49d0: 64 5d 22 5d 0a 54 68 65 20 4f 70 65 6e 53 53 4c  d]"].The OpenSSL
49e0: 20 63 69 70 68 65 72 20 69 64 2e 0a 0a 5b 64 65   cipher id...[de
49f0: 66 20 22 5b 76 61 72 20 64 65 73 63 72 69 70 74  f "[var descript
4a00: 69 6f 6e 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  ion] [arg string
4a10: 5d 22 5d 0a 41 20 74 65 78 74 20 64 65 73 63 72  ]"].A text descr
4a20: 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 69  iption of the ci
4a30: 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  pher...[def "[va
4a40: 72 20 68 61 6e 64 73 68 61 6b 65 5f 64 69 67 65  r handshake_dige
4a50: 73 74 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e  st] [arg boolean
4a60: 5d 22 5d 0a 44 69 67 65 73 74 20 75 73 65 64 20  ]"].Digest used 
4a70: 64 75 72 69 6e 67 20 68 61 6e 64 73 68 61 6b 65  during handshake
4a80: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 53  ...[list_end]..S
4a90: 65 73 73 69 6f 6e 20 49 6e 66 6f 0a 0a 5b 6c 69  ession Info..[li
4aa0: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
4ab0: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61  ions]..[def "[va
4ac0: 72 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70 72 6f  r alpn] [arg pro
4ad0: 74 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70 72 6f  tocol]"].The pro
4ae0: 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20 61  tocol selected a
4af0: 66 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f 6e  fter Application
4b00: 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20  -Layer Protocol 
4b10: 4e 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50  Negotiation (ALP
4b20: 4e 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  N)...[def "[var 
4b30: 72 65 73 75 6d 61 62 6c 65 5d 20 5b 61 72 67 20  resumable] [arg 
4b40: 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68  boolean]"].Wheth
4b50: 65 72 20 74 68 65 20 73 65 73 73 69 6f 6e 20 63  er the session c
4b60: 61 6e 20 62 65 20 72 65 73 75 6d 65 64 20 6f 72  an be resumed or
4b70: 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   not...[def "[va
4b80: 72 20 73 74 61 72 74 5f 74 69 6d 65 5d 20 5b 61  r start_time] [a
4b90: 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 54 69  rg seconds]"].Ti
4ba0: 6d 65 20 73 69 6e 63 65 20 73 65 73 73 69 6f 6e  me since session
4bb0: 20 73 74 61 72 74 65 64 20 69 6e 20 73 65 63 6f   started in seco
4bc0: 6e 64 73 20 73 69 6e 63 65 20 65 70 6f 63 68 2e  nds since epoch.
4bd0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 74 69 6d  ..[def "[var tim
4be0: 65 6f 75 74 5d 20 5b 61 72 67 20 73 65 63 6f 6e  eout] [arg secon
4bf0: 64 73 5d 22 5d 0a 4d 61 78 20 64 75 72 61 74 69  ds]"].Max durati
4c00: 6f 6e 20 6f 66 20 73 65 73 73 69 6f 6e 20 69 6e  on of session in
4c10: 20 73 65 63 6f 6e 64 73 20 62 65 66 6f 72 65 20   seconds before 
4c20: 74 69 6d 65 2d 6f 75 74 2e 0a 0a 5b 64 65 66 20  time-out...[def 
4c30: 22 5b 76 61 72 20 6c 69 66 65 74 69 6d 65 5d 20  "[var lifetime] 
4c40: 5b 61 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a  [arg seconds]"].
4c50: 53 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 6c  Session ticket l
4c60: 69 66 65 74 69 6d 65 20 68 69 6e 74 20 69 6e 20  ifetime hint in 
4c70: 73 65 63 6f 6e 64 73 2e 0a 0a 5b 64 65 66 20 22  seconds...[def "
4c80: 5b 76 61 72 20 73 65 73 73 69 6f 6e 5f 69 64 5d  [var session_id]
4c90: 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72   [arg binary_str
4ca0: 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65  ing]"].Unique se
4cb0: 73 73 69 6f 6e 20 69 64 20 66 6f 72 20 75 73 65  ssion id for use
4cc0: 20 69 6e 20 72 65 73 75 6d 69 6e 67 20 74 68 65   in resuming the
4cd0: 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20   session...[def 
4ce0: 22 5b 76 61 72 20 73 65 73 73 69 6f 6e 5f 74 69  "[var session_ti
4cf0: 63 6b 65 74 5d 20 5b 61 72 67 20 62 69 6e 61 72  cket] [arg binar
4d00: 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e 69 71  y_string]"].Uniq
4d10: 75 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65  ue session ticke
4d20: 74 20 66 6f 72 20 75 73 65 20 69 6e 20 72 65 73  t for use in res
4d30: 75 6d 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f  uming the sessio
4d40: 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 74  n...[def "[var t
4d50: 69 63 6b 65 74 5f 61 70 70 5f 64 61 74 61 5d 20  icket_app_data] 
4d60: 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69  [arg binary_stri
4d70: 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73  ng]"].Unique ses
4d80: 73 69 6f 6e 20 74 69 63 6b 65 74 20 61 70 70 6c  sion ticket appl
4d90: 69 63 61 74 69 6f 6e 20 64 61 74 61 2e 0a 0a 5b  ication data...[
4da0: 64 65 66 20 22 5b 76 61 72 20 6d 61 73 74 65 72  def "[var master
4db0: 5f 6b 65 79 5d 20 5b 61 72 67 20 62 69 6e 61 72  _key] [arg binar
4dc0: 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e 69 71  y_string]"].Uniq
4dd0: 75 65 20 73 65 73 73 69 6f 6e 20 6d 61 73 74 65  ue session maste
4de0: 72 20 6b 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76  r key...[def "[v
4df0: 61 72 20 73 65 73 73 69 6f 6e 5f 63 61 63 68 65  ar session_cache
4e00: 5f 6d 6f 64 65 5d 20 5b 61 72 67 20 6d 6f 64 65  _mode] [arg mode
4e10: 5d 22 5d 0a 53 65 72 76 65 72 20 63 61 63 68 65  ]"].Server cache
4e20: 20 6d 6f 64 65 20 28 63 6c 69 65 6e 74 2c 20 73   mode (client, s
4e30: 65 72 76 65 72 2c 20 6f 72 20 62 6f 74 68 29 2e  erver, or both).
4e40: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63  ..[list_end]..[c
4e50: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 69  all [cmd tls::ci
4e60: 70 68 65 72 73 5d 20 5b 6f 70 74 20 5b 61 72 67  phers] [opt [arg
4e70: 20 70 72 6f 74 6f 63 6f 6c 5d 5d 20 5b 6f 70 74   protocol]] [opt
4e80: 20 5b 61 72 67 20 76 65 72 62 6f 73 65 5d 5d 20   [arg verbose]] 
4e90: 5b 6f 70 74 20 5b 61 72 67 20 73 75 70 70 6f 72  [opt [arg suppor
4ea0: 74 65 64 5d 5d 5d 0a 0a 57 69 74 68 6f 75 74 20  ted]]]..Without 
4eb0: 61 6e 79 20 6f 70 74 69 6f 6e 73 2c 20 69 74 20  any options, it 
4ec0: 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20 6f  returns a list o
4ed0: 66 20 61 6c 6c 20 73 79 6d 6d 65 74 72 69 63 20  f all symmetric 
4ee0: 63 69 70 68 65 72 73 20 66 6f 72 20 75 73 65 20  ciphers for use 
4ef0: 77 69 74 68 20 74 68 65 0a 5b 61 72 67 20 2d 63  with the.[arg -c
4f00: 69 70 68 65 72 5d 20 6f 70 74 69 6f 6e 2e 20 57  ipher] option. W
4f10: 69 74 68 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  ith [arg protoco
4f20: 6c 5d 2c 20 6f 6e 6c 79 20 74 68 65 20 63 69 70  l], only the cip
4f30: 68 65 72 73 20 73 75 70 70 6f 72 74 65 64 20 66  hers supported f
4f40: 6f 72 20 74 68 61 74 0a 70 72 6f 74 6f 63 6f 6c  or that.protocol
4f50: 20 61 72 65 20 72 65 74 75 72 6e 65 64 2e 20 53   are returned. S
4f60: 65 65 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a  ee the [cmd tls:
4f70: 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d  :protocols] comm
4f80: 61 6e 64 20 66 6f 72 20 74 68 65 20 73 75 70 70  and for the supp
4f90: 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f 6c 73 2e  orted.protocols.
4fa0: 20 49 66 20 5b 61 72 67 20 76 65 72 62 6f 73 65   If [arg verbose
4fb0: 5d 20 69 73 20 73 70 65 63 69 66 69 65 64 20 61  ] is specified a
4fc0: 73 20 74 72 75 65 20 74 68 65 6e 20 61 20 76 65  s true then a ve
4fd0: 72 62 6f 73 65 2c 20 68 75 6d 61 6e 20 72 65 61  rbose, human rea
4fe0: 64 61 62 6c 65 0a 6c 69 73 74 20 69 73 20 72 65  dable.list is re
4ff0: 74 75 72 6e 65 64 20 77 69 74 68 20 61 64 64 69  turned with addi
5000: 74 69 6f 6e 61 6c 20 69 6e 66 6f 72 6d 61 74 69  tional informati
5010: 6f 6e 20 6f 6e 20 74 68 65 20 63 69 70 68 65 72  on on the cipher
5020: 2e 20 49 66 20 5b 61 72 67 20 73 75 70 70 6f 72  . If [arg suppor
5030: 74 65 64 5d 0a 69 73 20 73 70 65 63 69 66 69 65  ted].is specifie
5040: 64 20 61 73 20 74 72 75 65 2c 20 74 68 65 6e 20  d as true, then 
5050: 6f 6e 6c 79 20 74 68 65 20 63 69 70 68 65 72 73  only the ciphers
5060: 20 73 75 70 70 6f 72 74 65 64 20 66 6f 72 20 70   supported for p
5070: 72 6f 74 6f 63 6f 6c 20 77 69 6c 6c 20 62 65 20  rotocol will be 
5080: 6c 69 73 74 65 64 2e 0a 54 68 65 20 5b 61 72 67  listed..The [arg
5090: 20 73 75 70 70 6f 72 74 65 64 5d 20 61 72 67 20   supported] arg 
50a0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
50b0: 53 20 31 2e 38 2e 0a 0a 5b 63 61 6c 6c 20 5b 63  S 1.8...[call [c
50c0: 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c  md tls::protocol
50d0: 73 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 61 20 6c  s]]..Returns a l
50e0: 69 73 74 20 6f 66 20 74 68 65 20 73 75 70 70 6f  ist of the suppo
50f0: 72 74 65 64 20 53 53 4c 2f 54 4c 53 20 70 72 6f  rted SSL/TLS pro
5100: 74 6f 63 6f 6c 73 2e 20 56 61 6c 69 64 20 76 61  tocols. Valid va
5110: 6c 75 65 73 20 61 72 65 3a 0a 5b 63 6f 6e 73 74  lues are:.[const
5120: 20 73 73 6c 32 5d 2c 20 5b 63 6f 6e 73 74 20 73   ssl2], [const s
5130: 73 6c 33 5d 2c 20 5b 63 6f 6e 73 74 20 74 6c 73  sl3], [const tls
5140: 31 5d 2c 20 5b 63 6f 6e 73 74 20 74 6c 73 31 2e  1], [const tls1.
5150: 31 5d 2c 20 5b 63 6f 6e 73 74 20 74 6c 73 31 2e  1], [const tls1.
5160: 32 5d 2c 20 61 6e 64 0a 5b 63 6f 6e 73 74 20 74  2], and.[const t
5170: 6c 73 31 2e 33 5d 2e 20 45 78 61 63 74 20 6c 69  ls1.3]. Exact li
5180: 73 74 20 64 65 70 65 6e 64 73 20 6f 6e 20 4f 70  st depends on Op
5190: 65 6e 53 53 4c 20 76 65 72 73 69 6f 6e 20 61 6e  enSSL version an
51a0: 64 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 20 66  d compile time f
51b0: 6c 61 67 73 2e 0a 54 68 69 73 20 63 6f 6d 6d 61  lags..This comma
51c0: 6e 64 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  nd is new for Tc
51d0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 63 61 6c 6c  lTLS 1.8...[call
51e0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 65 72 73 69   [cmd tls::versi
51f0: 6f 6e 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68  on]]..Returns th
5200: 65 20 4f 70 65 6e 53 53 4c 20 76 65 72 73 69 6f  e OpenSSL versio
5210: 6e 20 73 74 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74  n string...[list
5220: 5f 65 6e 64 5d 0a 0a 0a 5b 73 65 63 74 69 6f 6e  _end]...[section
5230: 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61   "Certificate Va
5240: 6c 69 64 61 74 69 6f 6e 22 5d 0a 0a 5b 73 75 62  lidation"]..[sub
5250: 73 65 63 74 69 6f 6e 20 22 50 4b 49 20 61 6e 64  section "PKI and
5260: 20 43 65 72 74 69 66 69 63 61 74 65 73 22 5d 0a   Certificates"].
5270: 0a 55 73 69 6e 67 20 74 68 65 20 50 75 62 6c 69  .Using the Publi
5280: 63 20 4b 65 79 20 49 6e 66 72 61 73 74 72 75 63  c Key Infrastruc
5290: 74 75 72 65 20 28 50 4b 49 29 2c 20 65 61 63 68  ture (PKI), each
52a0: 20 75 73 65 72 20 63 72 65 61 74 65 73 20 61 20   user creates a 
52b0: 70 72 69 76 61 74 65 20 6b 65 79 20 74 68 61 74  private key that
52c0: 0a 6f 6e 6c 79 20 74 68 65 79 20 6b 6e 6f 77 20  .only they know 
52d0: 61 62 6f 75 74 20 61 6e 64 20 61 20 70 75 62 6c  about and a publ
52e0: 69 63 20 6b 65 79 20 74 68 65 79 20 63 61 6e 20  ic key they can 
52f0: 65 78 63 68 61 6e 67 65 20 77 69 74 68 20 6f 74  exchange with ot
5300: 68 65 72 73 20 66 6f 72 20 75 73 65 20 69 6e 0a  hers for use in.
5310: 65 6e 63 72 79 70 74 69 6e 67 20 61 6e 64 20 64  encrypting and d
5320: 65 63 72 79 70 74 69 6e 67 20 64 61 74 61 2e 20  ecrypting data. 
5330: 54 68 65 20 70 72 6f 63 65 73 73 20 69 73 20 74  The process is t
5340: 68 65 20 73 65 6e 64 65 72 20 65 6e 63 72 79 70  he sender encryp
5350: 74 73 20 74 68 65 69 72 20 64 61 74 61 0a 75 73  ts their data.us
5360: 69 6e 67 20 74 68 65 69 72 20 70 72 69 76 61 74  ing their privat
5370: 65 20 6b 65 79 20 61 6e 64 20 74 68 65 20 72 65  e key and the re
5380: 63 65 69 76 65 72 27 73 20 70 75 62 6c 69 63 20  ceiver's public 
5390: 6b 65 79 2e 20 54 68 65 20 64 61 74 61 20 69 73  key. The data is
53a0: 20 74 68 65 6e 20 73 65 6e 74 0a 74 6f 20 74 68   then sent.to th
53b0: 65 20 72 65 63 65 69 76 65 72 2e 20 49 6e 20 61  e receiver. In a
53c0: 20 73 69 6d 69 6c 61 72 20 6d 61 6e 6e 65 72 2c   similar manner,
53d0: 20 74 68 65 20 72 65 63 65 69 76 65 72 20 75 73   the receiver us
53e0: 65 73 20 74 68 65 69 72 20 70 72 69 76 61 74 65  es their private
53f0: 20 6b 65 79 20 61 6e 64 0a 74 68 65 20 73 65 6e   key and.the sen
5400: 64 65 72 27 73 20 70 75 62 6c 69 63 20 6b 65 79  der's public key
5410: 20 74 6f 20 64 65 63 72 79 70 74 20 74 68 65 20   to decrypt the 
5420: 64 61 74 61 2e 20 54 68 69 73 20 70 72 6f 76 69  data. This provi
5430: 64 65 73 20 64 61 74 61 20 69 6e 74 65 67 72 69  des data integri
5440: 74 79 2c 20 74 6f 0a 65 6e 73 75 72 65 20 74 68  ty, to.ensure th
5450: 65 20 64 61 74 61 20 63 61 6e 27 74 20 62 65 20  e data can't be 
5460: 76 69 65 77 65 64 20 6f 72 20 61 6c 74 65 72 65  viewed or altere
5470: 64 20 64 75 72 69 6e 67 20 74 72 61 6e 73 70 6f  d during transpo
5480: 72 74 2e 20 53 65 65 20 74 68 65 0a 5b 6f 70 74  rt. See the.[opt
5490: 69 6f 6e 20 2d 6b 65 79 5d 20 61 6e 64 20 5b 6f  ion -key] and [o
54a0: 70 74 69 6f 6e 20 2d 6b 65 79 66 69 6c 65 5d 20  ption -keyfile] 
54b0: 6f 70 74 69 6f 6e 73 20 66 6f 72 20 68 6f 77 20  options for how 
54c0: 74 6f 20 73 70 65 63 69 66 79 20 74 68 65 20 70  to specify the p
54d0: 72 69 76 61 74 65 20 6b 65 79 2e 0a 41 6c 73 6f  rivate key..Also
54e0: 20 73 65 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e   see the [option
54f0: 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74 69   -password] opti
5500: 6f 6e 20 66 6f 72 20 68 6f 77 20 74 6f 20 70 72  on for how to pr
5510: 6f 76 69 64 65 20 74 68 65 20 70 61 73 73 77 6f  ovide the passwo
5520: 72 64 2e 0a 5b 70 61 72 61 5d 0a 49 6e 20 6f 72  rd..[para].In or
5530: 64 65 72 20 74 6f 20 70 72 6f 76 69 64 65 20 61  der to provide a
5540: 75 74 68 65 6e 74 69 63 61 74 69 6f 6e 2c 20 69  uthentication, i
5550: 2e 65 2e 20 65 6e 73 75 72 69 6e 67 20 73 6f 6d  .e. ensuring som
5560: 65 6f 6e 65 20 69 73 20 77 68 6f 20 74 68 65 79  eone is who they
5570: 20 73 61 79 20 74 68 65 79 0a 61 72 65 2c 20 74   say they.are, t
5580: 68 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 6e  he public key an
5590: 64 20 75 73 65 72 20 69 64 65 6e 74 69 66 69 63  d user identific
55a0: 61 74 69 6f 6e 20 69 6e 66 6f 20 69 73 20 73 74  ation info is st
55b0: 6f 72 65 64 20 69 6e 20 61 20 58 2e 35 30 39 0a  ored in a X.509.
55c0: 63 65 72 74 69 66 69 63 61 74 65 20 61 6e 64 20  certificate and 
55d0: 74 68 61 74 20 63 65 72 74 69 66 69 63 61 74 65  that certificate
55e0: 20 69 73 20 61 75 74 68 65 6e 74 69 63 61 74 65   is authenticate
55f0: 64 20 28 69 2e 65 2e 20 73 69 67 6e 65 64 29 20  d (i.e. signed) 
5600: 62 79 20 61 20 43 65 72 74 69 66 69 63 61 74 65  by a Certificate
5610: 0a 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 2e  .Authority (CA).
5620: 20 55 73 65 72 73 20 63 61 6e 20 74 68 65 6e 20   Users can then 
5630: 65 78 63 68 61 6e 67 65 20 74 68 65 73 65 20 63  exchange these c
5640: 65 72 74 69 66 69 63 61 74 65 73 20 64 75 72 69  ertificates duri
5650: 6e 67 20 74 68 65 20 54 4c 53 0a 69 6e 69 74 69  ng the TLS.initi
5660: 61 6c 69 7a 61 74 69 6f 6e 20 70 72 6f 63 65 73  alization proces
5670: 73 20 61 6e 64 20 63 68 65 63 6b 20 74 68 65 6d  s and check them
5680: 20 61 67 61 69 6e 73 74 20 74 68 65 20 72 6f 6f   against the roo
5690: 74 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65  t CA certificate
56a0: 73 20 74 6f 20 65 6e 73 75 72 65 0a 74 68 65 79  s to ensure.they
56b0: 20 61 72 65 20 76 61 6c 69 64 2e 20 54 68 69 73   are valid. This
56c0: 20 69 73 20 68 61 6e 64 6c 65 64 20 62 79 20 4f   is handled by O
56d0: 70 65 6e 53 53 4c 20 76 69 61 20 74 68 65 20 5b  penSSL via the [
56e0: 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d  option -request]
56f0: 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 72 65   and.[option -re
5700: 71 75 69 72 65 5d 20 6f 70 74 69 6f 6e 73 2e 20  quire] options. 
5710: 53 65 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  See the [option 
5720: 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e  -cadir], [option
5730: 20 2d 63 61 64 69 72 5d 2c 20 61 6e 64 0a 5b 6f   -cadir], and.[o
5740: 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20  ption -castore] 
5750: 6f 70 74 69 6f 6e 73 20 66 6f 72 20 68 6f 77 20  options for how 
5760: 74 6f 20 73 70 65 63 69 66 79 20 77 68 65 72 65  to specify where
5770: 20 74 6f 20 66 69 6e 64 20 74 68 65 20 43 41 20   to find the CA 
5780: 63 65 72 74 69 66 69 63 61 74 65 73 2e 0a 4f 70  certificates..Op
5790: 74 69 6f 6e 61 6c 6c 79 2c 20 69 6e 20 61 20 66  tionally, in a f
57a0: 75 74 75 72 65 20 72 65 6c 65 61 73 65 2c 20 74  uture release, t
57b0: 68 65 79 20 63 61 6e 20 61 6c 73 6f 20 62 65 20  hey can also be 
57c0: 63 68 65 63 6b 65 64 20 61 67 61 69 6e 73 74 20  checked against 
57d0: 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 0a  the Certificate.
57e0: 52 65 76 6f 63 61 74 69 6f 6e 20 4c 69 73 74 20  Revocation List 
57f0: 28 43 52 4c 29 20 6f 66 20 72 65 76 6f 6b 65 64  (CRL) of revoked
5800: 20 63 65 72 74 69 66 69 63 61 74 65 73 2e 20 43   certificates. C
5810: 65 72 74 69 66 69 63 61 74 65 73 20 63 61 6e 20  ertificates can 
5820: 61 6c 73 6f 20 62 65 0a 73 65 6c 66 2d 73 69 67  also be.self-sig
5830: 6e 65 64 2c 20 62 75 74 20 74 68 65 79 20 61 72  ned, but they ar
5840: 65 20 62 79 20 64 65 66 61 75 6c 74 20 6e 6f 74  e by default not
5850: 20 74 72 75 73 74 65 64 20 75 6e 6c 65 73 73 20   trusted unless 
5860: 79 6f 75 20 61 64 64 20 74 68 65 6d 20 74 6f 20  you add them to 
5870: 79 6f 75 72 0a 63 65 72 74 69 66 69 63 61 74 65  your.certificate
5880: 20 73 74 6f 72 65 2e 0a 5b 70 61 72 61 5d 0a 54   store..[para].T
5890: 79 70 69 63 61 6c 6c 79 20 77 68 65 6e 20 76 69  ypically when vi
58a0: 73 69 74 69 6e 67 20 77 65 62 20 73 69 74 65 73  siting web sites
58b0: 2c 20 6f 6e 6c 79 20 74 68 65 20 63 6c 69 65 6e  , only the clien
58c0: 74 20 6e 65 65 64 73 20 74 6f 20 63 68 65 63 6b  t needs to check
58d0: 20 74 68 65 20 73 65 72 76 65 72 27 73 0a 63 65   the server's.ce
58e0: 72 74 69 66 69 63 61 74 65 20 74 6f 20 65 6e 73  rtificate to ens
58f0: 75 72 65 20 69 74 20 69 73 20 76 61 6c 69 64 2e  ure it is valid.
5900: 20 54 68 65 20 73 65 72 76 65 72 20 64 6f 65 73   The server does
5910: 6e 27 74 20 6e 65 65 64 20 74 6f 20 63 68 65 63  n't need to chec
5920: 6b 20 74 68 65 20 63 6c 69 65 6e 74 0a 63 65 72  k the client.cer
5930: 74 69 66 69 63 61 74 65 20 75 6e 6c 65 73 73 20  tificate unless 
5940: 79 6f 75 20 6e 65 65 64 20 74 6f 20 61 75 74 68  you need to auth
5950: 65 6e 74 69 63 61 74 65 20 77 69 74 68 20 74 68  enticate with th
5960: 65 6d 20 74 6f 20 6c 6f 67 69 6e 2c 20 65 74 63  em to login, etc
5970: 2e 20 53 65 65 20 74 68 65 0a 5b 6f 70 74 69 6f  . See the.[optio
5980: 6e 20 2d 63 65 72 74 5d 20 61 6e 64 20 5b 6f 70  n -cert] and [op
5990: 74 69 6f 6e 20 2d 63 65 72 74 66 69 6c 65 5d 20  tion -certfile] 
59a0: 6f 70 74 69 6f 6e 73 20 69 66 20 79 6f 75 20 6e  options if you n
59b0: 65 65 64 20 74 6f 20 70 72 6f 76 69 64 65 20 61  eed to provide a
59c0: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 0a   certificate....
59d0: 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 53 75 6d  [subsection "Sum
59e0: 6d 61 72 79 20 6f 66 20 63 6f 6d 6d 61 6e 64 20  mary of command 
59f0: 6c 69 6e 65 20 6f 70 74 69 6f 6e 73 22 5d 0a 0a  line options"]..
5a00: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6f 70  The following op
5a10: 74 69 6f 6e 73 20 61 72 65 20 75 73 65 64 20 66  tions are used f
5a20: 6f 72 20 70 65 65 72 20 63 65 72 74 69 66 69 63  or peer certific
5a30: 61 74 65 20 76 61 6c 69 64 61 74 69 6f 6e 3a 0a  ate validation:.
5a40: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74  .[list_begin opt
5a50: 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20  ions]..[opt_def 
5a60: 2d 63 61 64 69 72 20 5b 61 72 67 20 64 69 72 65  -cadir [arg dire
5a70: 63 74 6f 72 79 5d 5d 0a 53 70 65 63 69 66 69 65  ctory]].Specifie
5a80: 73 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20  s the directory 
5a90: 77 68 65 72 65 20 74 68 65 20 43 65 72 74 69 66  where the Certif
5aa0: 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20  icate Authority 
5ab0: 28 43 41 29 20 63 65 72 74 69 66 69 63 61 74 65  (CA) certificate
5ac0: 73 20 61 72 65 0a 73 74 6f 72 65 64 2e 20 54 68  s are.stored. Th
5ad0: 65 20 64 65 66 61 75 6c 74 20 69 73 20 70 6c 61  e default is pla
5ae0: 74 66 6f 72 6d 20 73 70 65 63 69 66 69 63 2c 20  tform specific, 
5af0: 62 75 74 20 69 73 20 75 73 75 61 6c 6c 79 20 5b  but is usually [
5b00: 66 69 6c 65 20 2f 65 74 63 2f 73 73 6c 2f 63 65  file /etc/ssl/ce
5b10: 72 74 73 5d 20 6f 6e 0a 4c 69 6e 75 78 2f 55 6e  rts] on.Linux/Un
5b20: 69 78 20 73 79 73 74 65 6d 73 2e 20 54 68 65 20  ix systems. The 
5b30: 64 65 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e  default location
5b40: 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64   can be overridd
5b50: 65 6e 20 62 79 20 74 68 65 0a 5b 76 61 72 20 53  en by the.[var S
5b60: 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20 65 6e 76  SL_CERT_DIR] env
5b70: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c  ironment variabl
5b80: 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61  e...[opt_def -ca
5b90: 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61  file [arg filena
5ba0: 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  me]].Specifies t
5bb0: 68 65 20 66 69 6c 65 20 77 69 74 68 20 74 68 65  he file with the
5bc0: 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74   Certificate Aut
5bd0: 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72 74  hority (CA) cert
5be0: 69 66 69 63 61 74 65 73 20 74 6f 20 75 73 65 20  ificates to use 
5bf0: 69 6e 0a 5b 63 6f 6e 73 74 20 50 45 4d 5d 20 66  in.[const PEM] f
5c00: 69 6c 65 20 66 6f 72 6d 61 74 2e 20 54 68 65 20  ile format. The 
5c10: 64 65 66 61 75 6c 74 20 69 73 20 5b 66 69 6c 65  default is [file
5c20: 20 63 65 72 74 2e 70 65 6d 5d 2c 20 69 6e 20 74   cert.pem], in t
5c30: 68 65 20 4f 70 65 6e 53 53 4c 0a 64 69 72 65 63  he OpenSSL.direc
5c40: 74 6f 72 79 2e 20 4f 6e 20 4c 69 6e 75 78 2f 55  tory. On Linux/U
5c50: 6e 69 78 20 73 79 73 74 65 6d 73 2c 20 74 68 69  nix systems, thi
5c60: 73 20 69 73 20 75 73 75 61 6c 6c 79 20 5b 66 69  s is usually [fi
5c70: 6c 65 20 2f 65 74 63 2f 73 73 6c 2f 63 61 2d 62  le /etc/ssl/ca-b
5c80: 75 6e 64 6c 65 2e 70 65 6d 5d 2e 0a 54 68 65 20  undle.pem]..The 
5c90: 64 65 66 61 75 6c 74 20 66 69 6c 65 20 63 61 6e  default file can
5ca0: 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62   be overridden b
5cb0: 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43  y the [var SSL_C
5cc0: 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f  ERT_FILE] enviro
5cd0: 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e 0a  nment.variable..
5ce0: 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 73 74 6f  .[opt_def -casto
5cf0: 72 65 20 5b 61 72 67 20 55 52 49 5d 5d 0a 53 70  re [arg URI]].Sp
5d00: 65 63 69 66 69 65 73 20 74 68 65 20 55 6e 69 66  ecifies the Unif
5d10: 6f 72 6d 20 52 65 73 6f 75 72 63 65 20 49 64 65  orm Resource Ide
5d20: 6e 74 69 66 69 65 72 20 28 55 52 49 29 20 66 6f  ntifier (URI) fo
5d30: 72 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  r the Certificat
5d40: 65 20 41 75 74 68 6f 72 69 74 79 0a 28 43 41 29  e Authority.(CA)
5d50: 20 73 74 6f 72 65 2c 20 77 68 69 63 68 20 6d 61   store, which ma
5d60: 79 20 62 65 20 61 20 73 69 6e 67 6c 65 20 63 6f  y be a single co
5d70: 6e 74 61 69 6e 65 72 20 6f 72 20 61 20 63 61 74  ntainer or a cat
5d80: 61 6c 6f 67 20 6f 66 20 63 6f 6e 74 61 69 6e 65  alog of containe
5d90: 72 73 2e 0a 53 74 61 72 74 69 6e 67 20 77 69 74  rs..Starting wit
5da0: 68 20 4f 70 65 6e 53 53 4c 20 33 2e 32 20 6f 6e  h OpenSSL 3.2 on
5db0: 20 4d 53 20 57 69 6e 64 6f 77 73 2c 20 73 65 74   MS Windows, set
5dc0: 20 74 6f 20 22 5b 63 6f 6e 73 74 20 22 6f 72 67   to "[const "org
5dd0: 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 74 6f 72  .openssl.winstor
5de0: 65 3a 2f 2f 22 5d 22 0a 74 6f 20 75 73 65 20 74  e://"]".to use t
5df0: 68 65 20 62 75 69 6c 74 2d 69 6e 20 4d 53 20 57  he built-in MS W
5e00: 69 6e 64 6f 77 73 20 43 65 72 74 69 66 69 63 61  indows Certifica
5e10: 74 65 20 53 74 6f 72 65 2e 20 53 74 61 72 74 69  te Store. Starti
5e20: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30  ng in TclTLS 2.0
5e30: 2c 20 74 68 69 73 0a 69 73 20 74 68 65 20 64 65  , this.is the de
5e40: 66 61 75 6c 74 20 69 66 20 5b 6f 70 74 69 6f 6e  fault if [option
5e50: 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f   -cadir], [optio
5e60: 6e 20 2d 63 61 64 69 72 5d 2c 20 61 6e 64 20 5b  n -cadir], and [
5e70: 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d  option -castore]
5e80: 20 61 72 65 0a 6e 6f 74 20 73 70 65 63 69 66 69   are.not specifi
5e90: 65 64 2e 20 54 68 69 73 20 73 74 6f 72 65 20 6f  ed. This store o
5ea0: 6e 6c 79 20 73 75 70 70 6f 72 74 73 20 72 6f 6f  nly supports roo
5eb0: 74 20 63 65 72 74 69 66 69 63 61 74 65 20 73 74  t certificate st
5ec0: 6f 72 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  ores...[opt_def 
5ed0: 2d 72 65 71 75 65 73 74 20 5b 61 72 67 20 62 6f  -request [arg bo
5ee0: 6f 6c 5d 5d 0a 52 65 71 75 65 73 74 20 61 20 63  ol]].Request a c
5ef0: 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20  ertificate from 
5f00: 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67 20  the peer during 
5f10: 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b  the SSL handshak
5f20: 65 2e 20 54 68 69 73 20 69 73 20 6e 65 65 64 65  e. This is neede
5f30: 64 0a 74 6f 20 64 6f 20 43 65 72 74 69 66 69 63  d.to do Certific
5f40: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 2e 20  ate Validation. 
5f50: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54  Starting in TclT
5f60: 4c 53 20 31 2e 38 2c 20 74 68 65 20 64 65 66 61  LS 1.8, the defa
5f70: 75 6c 74 20 69 73 0a 5b 63 6f 6e 73 74 20 74 72  ult is.[const tr
5f80: 75 65 5d 20 66 6f 72 20 63 6c 69 65 6e 74 20 63  ue] for client c
5f90: 6f 6e 6e 65 63 74 69 6f 6e 73 2e 20 53 74 61 72  onnections. Star
5fa0: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ting in TclTLS 2
5fb0: 2e 30 2c 20 69 66 20 73 65 74 20 74 6f 0a 5b 63  .0, if set to.[c
5fc0: 6f 6e 73 74 20 66 61 6c 73 65 5d 20 61 6e 64 20  onst false] and 
5fd0: 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 72 65  [option -require
5fe0: 5d 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65  ] is [const true
5ff0: 5d 2c 20 74 68 65 6e 20 74 68 69 73 20 77 69 6c  ], then this wil
6000: 6c 20 62 65 0a 6f 76 65 72 72 69 64 64 65 6e 20  l be.overridden 
6010: 74 6f 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e  to [const true].
6020: 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 74 68   In addition, th
6030: 65 20 63 6c 69 65 6e 74 20 63 61 6e 20 6d 61 6e  e client can man
6040: 75 61 6c 6c 79 20 69 6e 73 70 65 63 74 20 61 6e  ually inspect an
6050: 64 0a 61 63 63 65 70 74 20 6f 72 20 72 65 6a 65  d.accept or reje
6060: 63 74 20 65 61 63 68 20 63 65 72 74 69 66 69 63  ct each certific
6070: 61 74 65 20 75 73 69 6e 67 20 74 68 65 20 5b 6f  ate using the [o
6080: 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63  ption -validatec
6090: 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 2e 0a  ommand] option..
60a0: 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 69  .[opt_def -requi
60b0: 72 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52  re [arg bool]].R
60c0: 65 71 75 69 72 65 20 61 20 76 61 6c 69 64 20 63  equire a valid c
60d0: 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20  ertificate from 
60e0: 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67 20  the peer during 
60f0: 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b  the SSL handshak
6100: 65 2e 20 49 66 20 74 68 69 73 20 69 73 0a 73 65  e. If this is.se
6110: 74 20 74 6f 20 74 72 75 65 2c 20 74 68 65 6e 20  t to true, then 
6120: 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65 73 74  [option -request
6130: 5d 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 20 73  ] must also be s
6140: 65 74 20 74 6f 20 74 72 75 65 20 61 6e 64 20 61  et to true and a
6150: 20 65 69 74 68 65 72 0a 5b 6f 70 74 69 6f 6e 20   either.[option 
6160: 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e  -cadir], [option
6170: 20 2d 63 61 66 69 6c 65 5d 2c 20 5b 6f 70 74 69   -cafile], [opti
6180: 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 2c 20 6f 72  on -castore], or
6190: 20 61 20 70 6c 61 74 66 6f 72 6d 20 64 65 66 61   a platform defa
61a0: 75 6c 74 0a 6d 75 73 74 20 62 65 20 70 72 6f 76  ult.must be prov
61b0: 69 64 65 64 20 69 6e 20 6f 72 64 65 72 20 74 6f  ided in order to
61c0: 20 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e 73   validate agains
61d0: 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69  t. The default i
61e0: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61 6e 64  n TclTLS 1.8 and
61f0: 0a 65 61 72 6c 69 65 72 20 76 65 72 73 69 6f 6e  .earlier version
6200: 73 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73  s is [const fals
6210: 65 5d 20 73 69 6e 63 65 20 6e 6f 74 20 61 6c 6c  e] since not all
6220: 20 70 6c 61 74 66 6f 72 6d 73 20 68 61 76 65 20   platforms have 
6230: 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f 0a  certificates to.
6240: 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74  validate against
6250: 20 69 6e 20 61 20 66 6f 72 6d 20 63 6f 6d 70 61   in a form compa
6260: 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65 6e 53  tible with OpenS
6270: 53 4c 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20  SL. Starting in 
6280: 54 63 6c 54 4c 53 20 32 2e 30 2c 0a 74 68 65 20  TclTLS 2.0,.the 
6290: 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73  default is [cons
62a0: 74 20 74 72 75 65 5d 20 66 6f 72 20 63 6c 69 65  t true] for clie
62b0: 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 2e 0a  nt connections..
62c0: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75  .[list_end]..[su
62d0: 62 73 65 63 74 69 6f 6e 20 22 57 68 65 6e 20 61  bsection "When a
62e0: 72 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20  re command line 
62f0: 6f 70 74 69 6f 6e 73 20 6e 65 65 64 65 64 3f 22  options needed?"
6300: 5d 0a 0a 49 6e 20 54 63 6c 54 4c 53 20 31 2e 38  ]..In TclTLS 1.8
6310: 20 61 6e 64 20 65 61 72 6c 69 65 72 20 76 65 72   and earlier ver
6320: 73 69 6f 6e 73 2c 20 63 65 72 74 69 66 69 63 61  sions, certifica
6330: 74 65 20 76 61 6c 69 64 61 74 69 6f 6e 20 69 73  te validation is
6340: 0a 5b 65 6d 70 68 20 4e 4f 54 5d 20 65 6e 61 62  .[emph NOT] enab
6350: 6c 65 64 20 62 79 20 64 65 66 61 75 6c 74 2e 20  led by default. 
6360: 54 68 69 73 20 6c 69 6d 69 74 61 74 69 6f 6e 20  This limitation 
6370: 69 73 20 64 75 65 20 74 6f 20 74 68 65 20 6c 61  is due to the la
6380: 63 6b 20 6f 66 20 61 20 63 6f 6d 6d 6f 6e 0a 63  ck of a common.c
6390: 72 6f 73 73 20 70 6c 61 74 66 6f 72 6d 20 64 61  ross platform da
63a0: 74 61 62 61 73 65 20 6f 66 20 43 65 72 74 69 66  tabase of Certif
63b0: 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20  icate Authority 
63c0: 28 43 41 29 20 70 72 6f 76 69 64 65 64 20 63 65  (CA) provided ce
63d0: 72 74 69 66 69 63 61 74 65 73 20 74 6f 0a 76 61  rtificates to.va
63e0: 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20  lidate against. 
63f0: 4d 61 6e 79 20 4c 69 6e 75 78 20 73 79 73 74 65  Many Linux syste
6400: 6d 73 20 6e 61 74 69 76 65 6c 79 20 73 75 70 70  ms natively supp
6410: 6f 72 74 20 4f 70 65 6e 53 53 4c 20 61 6e 64 20  ort OpenSSL and 
6420: 74 68 75 73 20 68 61 76 65 0a 74 68 65 73 65 20  thus have.these 
6430: 63 65 72 74 69 66 69 63 61 74 65 73 20 69 6e 73  certificates ins
6440: 74 61 6c 6c 65 64 20 61 73 20 70 61 72 74 20 6f  talled as part o
6450: 66 20 74 68 65 20 4f 53 2c 20 62 75 74 20 4d 61  f the OS, but Ma
6460: 63 4f 53 20 61 6e 64 20 4d 53 20 57 69 6e 64 6f  cOS and MS Windo
6470: 77 73 20 64 6f 20 6e 6f 74 2e 0a 53 74 61 72 69  ws do not..Stari
6480: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30  ng in TclTLS 2.0
6490: 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20 66 6f  , the default fo
64a0: 72 20 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74  r client connect
64b0: 69 6f 6e 73 20 68 61 73 20 62 65 65 6e 20 63 68  ions has been ch
64c0: 61 6e 67 65 64 20 74 6f 0a 72 65 71 75 69 72 65  anged to.require
64d0: 20 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c   certificate val
64e0: 69 64 61 74 69 6f 6e 20 62 79 20 64 65 66 61 75  idation by defau
64f0: 6c 74 2e 20 49 6e 20 6f 72 64 65 72 20 74 6f 20  lt. In order to 
6500: 75 73 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  use the [option 
6510: 2d 72 65 71 75 69 72 65 5d 0a 6f 70 74 69 6f 6e  -require].option
6520: 2c 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f 6c  , one of the fol
6530: 6c 6f 77 69 6e 67 20 6d 75 73 74 20 62 65 20 74  lowing must be t
6540: 72 75 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  rue:..[list_begi
6550: 6e 20 69 74 65 6d 69 7a 65 64 5d 0a 0a 5b 69 74  n itemized]..[it
6560: 65 6d 5d 0a 4f 6e 20 4c 69 6e 75 78 20 61 6e 64  em].On Linux and
6570: 20 55 6e 69 78 20 73 79 73 74 65 6d 73 20 77 69   Unix systems wi
6580: 74 68 20 4f 70 65 6e 53 53 4c 20 61 6c 72 65 61  th OpenSSL alrea
6590: 64 79 20 69 6e 73 74 61 6c 6c 65 64 20 6f 72 20  dy installed or 
65a0: 69 66 20 74 68 65 20 43 41 0a 63 65 72 74 69 66  if the CA.certif
65b0: 69 63 61 74 65 73 20 61 72 65 20 61 76 61 69 6c  icates are avail
65c0: 61 62 6c 65 20 69 6e 20 50 45 4d 20 66 6f 72 6d  able in PEM form
65d0: 61 74 2c 20 61 6e 64 20 69 66 20 74 68 65 79 20  at, and if they 
65e0: 61 72 65 20 73 74 6f 72 65 64 20 69 6e 20 74 68  are stored in th
65f0: 65 0a 73 74 61 6e 64 61 72 64 20 6c 6f 63 61 74  e.standard locat
6600: 69 6f 6e 73 2c 20 6f 72 20 69 66 20 74 68 65 20  ions, or if the 
6610: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49  [var SSL_CERT_DI
6620: 52 5d 20 6f 72 20 5b 76 61 72 20 53 53 4c 5f 43  R] or [var SSL_C
6630: 45 52 54 5f 46 49 4c 45 5d 0a 65 6e 76 69 72 6f  ERT_FILE].enviro
6640: 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20  nment variables 
6650: 61 72 65 20 73 65 74 2c 20 74 68 65 6e 20 5b 6f  are set, then [o
6660: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b  ption -cadir], [
6670: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a  option -cadir],.
6680: 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73  and [option -cas
6690: 74 6f 72 65 5d 20 61 72 65 6e 27 74 20 6e 65 65  tore] aren't nee
66a0: 64 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20  ded...[item].If 
66b0: 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69  OpenSSL is not i
66c0: 6e 73 74 61 6c 6c 65 64 20 69 6e 20 74 68 65 20  nstalled in the 
66d0: 64 65 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e  default location
66e0: 2c 20 6f 72 20 77 68 65 6e 20 75 73 69 6e 67 20  , or when using 
66f0: 4d 61 63 20 4f 53 0a 6f 72 20 4d 53 20 57 69 6e  Mac OS.or MS Win
6700: 64 6f 77 73 20 61 6e 64 20 4f 70 65 6e 53 53 4c  dows and OpenSSL
6710: 20 69 73 20 69 6e 73 74 61 6c 6c 65 64 2c 20 74   is installed, t
6720: 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54  he [var SSL_CERT
6730: 5f 44 49 52 5d 20 61 6e 64 2f 6f 72 0a 5b 76 61  _DIR] and/or.[va
6740: 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d  r SSL_CERT_FILE]
6750: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72   environment var
6760: 69 61 62 6c 65 73 20 6f 72 20 74 68 65 20 6f 6e  iables or the on
6770: 65 20 6f 66 20 74 68 65 20 5b 6f 70 74 69 6f 6e  e of the [option
6780: 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f   -cadir],.[optio
6790: 6e 20 2d 63 61 64 69 72 5d 2c 20 6f 72 20 5b 6f  n -cadir], or [o
67a0: 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20  ption -castore] 
67b0: 6f 70 74 69 6f 6e 73 20 6d 75 73 74 20 62 65 20  options must be 
67c0: 64 65 66 69 6e 65 64 2e 0a 0a 5b 69 74 65 6d 5d  defined...[item]
67d0: 0a 4f 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c 20  .On MS Windows, 
67e0: 73 74 61 72 74 69 6e 67 20 69 6e 20 4f 70 65 6e  starting in Open
67f0: 53 53 4c 20 33 2e 32 2c 20 69 74 20 69 73 20 6e  SSL 3.2, it is n
6800: 6f 77 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 61  ow possible to a
6810: 63 63 65 73 73 20 74 68 65 0a 62 75 69 6c 74 2d  ccess the.built-
6820: 69 6e 20 57 69 6e 64 6f 77 73 20 43 65 72 74 69  in Windows Certi
6830: 66 69 63 61 74 65 20 53 74 6f 72 65 20 66 72 6f  ficate Store fro
6840: 6d 20 4f 70 65 6e 53 53 4c 2e 20 54 68 69 73 20  m OpenSSL. This 
6850: 63 61 6e 20 62 65 20 75 74 69 6c 69 7a 65 64 20  can be utilized 
6860: 62 79 0a 73 65 74 74 69 6e 67 20 74 68 65 20 5b  by.setting the [
6870: 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d  option -castore]
6880: 20 6f 70 74 69 6f 6e 20 74 6f 20 22 5b 63 6f 6e   option to "[con
6890: 73 74 20 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77  st org.openssl.w
68a0: 69 6e 73 74 6f 72 65 3a 2f 2f 5d 22 2e 0a 49 6e  instore://]"..In
68b0: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69   TclTLS 2.0, thi
68c0: 73 20 69 73 20 74 68 65 20 64 65 66 61 75 6c 74  s is the default
68d0: 20 76 61 6c 75 65 20 69 66 20 5b 6f 70 74 69 6f   value if [optio
68e0: 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f 70 74 69  n -cadir],.[opti
68f0: 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61 6e 64 20  on -cadir], and 
6900: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65  [option -castore
6910: 5d 20 61 72 65 20 6e 6f 74 20 73 70 65 63 69 66  ] are not specif
6920: 69 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20  ied...[item].If 
6930: 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69  OpenSSL is not i
6940: 6e 73 74 61 6c 6c 65 64 20 6f 72 20 74 68 65 20  nstalled or the 
6950: 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73 20  CA certificates 
6960: 61 72 65 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c  are not availabl
6970: 65 20 69 6e 20 50 45 4d 0a 66 6f 72 6d 61 74 2c  e in PEM.format,
6980: 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69 63   the CA certific
6990: 61 74 65 73 20 6d 75 73 74 20 62 65 20 64 6f 77  ates must be dow
69a0: 6e 6c 6f 61 64 65 64 20 61 6e 64 20 69 6e 73 74  nloaded and inst
69b0: 61 6c 6c 65 64 20 77 69 74 68 20 74 68 65 20 75  alled with the u
69c0: 73 65 72 0a 73 6f 66 74 77 61 72 65 2e 20 54 68  ser.software. Th
69d0: 65 20 43 55 52 4c 20 74 65 61 6d 20 6d 61 6b 65  e CURL team make
69e0: 73 20 74 68 65 6d 20 61 76 61 69 6c 61 62 6c 65  s them available
69f0: 20 61 74 0a 5b 75 72 69 20 22 68 74 74 70 73 3a   at.[uri "https:
6a00: 2f 2f 63 75 72 6c 2e 73 65 2f 64 6f 63 73 2f 63  //curl.se/docs/c
6a10: 61 65 78 74 72 61 63 74 2e 68 74 6d 6c 22 20 22  aextract.html" "
6a20: 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73 20  CA certificates 
6a30: 65 78 74 72 61 63 74 65 64 0a 66 72 6f 6d 20 4d  extracted.from M
6a40: 6f 7a 69 6c 6c 61 22 5d 20 69 6e 20 74 68 65 20  ozilla"] in the 
6a50: 5b 66 69 6c 65 20 63 61 63 65 72 74 2e 70 65 6d  [file cacert.pem
6a60: 5d 20 66 69 6c 65 2e 20 59 6f 75 20 6d 75 73 74  ] file. You must
6a70: 20 74 68 65 6e 20 65 69 74 68 65 72 20 73 65 74   then either set
6a80: 20 74 68 65 0a 5b 76 61 72 20 53 53 4c 5f 43 45   the.[var SSL_CE
6a90: 52 54 5f 44 49 52 5d 20 61 6e 64 2f 6f 72 20 5b  RT_DIR] and/or [
6aa0: 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c  var SSL_CERT_FIL
6ab0: 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76  E] environment v
6ac0: 61 72 69 61 62 6c 65 73 20 6f 72 20 74 68 65 0a  ariables or the.
6ad0: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 20  [option -cadir] 
6ae0: 6f 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69  or [option -cafi
6af0: 6c 65 5d 20 6f 70 74 69 6f 6e 73 20 74 6f 20 74  le] options to t
6b00: 68 65 20 43 41 20 63 65 72 74 20 66 69 6c 65 27  he CA cert file'
6b10: 73 20 69 6e 73 74 61 6c 6c 0a 6c 6f 63 61 74 69  s install.locati
6b20: 6f 6e 2e 20 49 74 20 69 73 20 79 6f 75 72 20 72  on. It is your r
6b30: 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 20 74 6f  esponsibility to
6b40: 20 6b 65 65 70 20 74 68 69 73 20 66 69 6c 65 20   keep this file 
6b50: 75 70 20 74 6f 20 64 61 74 65 2e 0a 0a 5b 6c 69  up to date...[li
6b60: 73 74 5f 65 6e 64 5d 0a 0a 5b 73 65 63 74 69 6f  st_end]..[sectio
6b70: 6e 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74 69  n "Callback Opti
6b80: 6f 6e 73 22 5d 0a 0a 41 73 20 70 72 65 76 69 6f  ons"]..As previo
6b90: 75 73 6c 79 20 64 65 73 63 72 69 62 65 64 2c 20  usly described, 
6ba0: 65 61 63 68 20 63 68 61 6e 6e 65 6c 20 63 61 6e  each channel can
6bb0: 20 62 65 20 67 69 76 65 6e 20 74 68 65 69 72 20   be given their 
6bc0: 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 73 0a 74 6f  own callbacks.to
6bd0: 20 68 61 6e 64 6c 65 20 69 6e 74 65 72 6d 65 64   handle intermed
6be0: 69 61 74 65 20 70 72 6f 63 65 73 73 69 6e 67 20  iate processing 
6bf0: 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c  by the OpenSSL l
6c00: 69 62 72 61 72 79 2c 20 75 73 69 6e 67 20 74 68  ibrary, using th
6c10: 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61  e.[option -comma
6c20: 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 70 61  nd], [option -pa
6c30: 73 73 77 6f 72 64 5d 2c 20 61 6e 64 20 5b 6f 70  ssword], and [op
6c40: 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63  tion -validate_c
6c50: 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 73 0a  ommand] options.
6c60: 70 61 73 73 65 64 20 74 6f 20 65 69 74 68 65 72  passed to either
6c70: 20 6f 66 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f   of [cmd tls::so
6c80: 63 6b 65 74 5d 20 6f 72 20 5b 63 6d 64 20 74 6c  cket] or [cmd tl
6c90: 73 3a 3a 69 6d 70 6f 72 74 5d 2e 0a 55 6e 6c 69  s::import]..Unli
6ca0: 6b 65 20 70 72 65 76 69 6f 75 73 20 76 65 72 73  ke previous vers
6cb0: 69 6f 6e 73 20 6f 66 20 54 63 6c 54 4c 53 2c 20  ions of TclTLS, 
6cc0: 6f 6e 6c 79 20 69 66 20 74 68 65 20 63 61 6c 6c  only if the call
6cd0: 62 61 63 6b 20 67 65 6e 65 72 61 74 65 73 20 61  back generates a
6ce0: 6e 20 65 72 72 6f 72 2c 0a 77 69 6c 6c 20 74 68  n error,.will th
6cf0: 65 20 5b 73 79 73 63 6d 64 20 62 67 65 72 72 6f  e [syscmd bgerro
6d00: 72 5d 20 63 6f 6d 6d 61 6e 64 20 62 65 20 69 6e  r] command be in
6d10: 76 6f 6b 65 64 20 77 69 74 68 20 74 68 65 20 65  voked with the e
6d20: 72 72 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e  rror information
6d30: 2e 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22  ...[subsection "
6d40: 56 61 6c 75 65 73 20 66 6f 72 20 43 6f 6d 6d 61  Values for Comma
6d50: 6e 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54  nd Callback"]..T
6d60: 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20  he callback for 
6d70: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d  the [option -com
6d80: 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20  mand] option is 
6d90: 69 6e 76 6f 6b 65 64 20 61 74 20 73 65 76 65 72  invoked at sever
6da0: 61 6c 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67  al points during
6db0: 20 74 68 65 0a 4f 70 65 6e 53 53 4c 20 68 61 6e   the.OpenSSL han
6dc0: 64 73 68 61 6b 65 20 61 6e 64 20 64 75 72 69 6e  dshake and durin
6dd0: 67 20 72 6f 75 74 69 6e 65 20 6f 70 65 72 61 74  g routine operat
6de0: 69 6f 6e 73 2e 20 53 65 65 20 62 65 6c 6f 77 20  ions. See below 
6df0: 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c 65  for the possible
6e00: 0a 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73 65  .arguments passe
6e10: 64 20 74 6f 20 74 68 65 20 63 61 6c 6c 62 61 63  d to the callbac
6e20: 6b 20 73 63 72 69 70 74 2e 20 56 61 6c 75 65 73  k script. Values
6e30: 20 72 65 74 75 72 6e 65 64 20 66 72 6f 6d 20 74   returned from t
6e40: 68 65 20 63 61 6c 6c 62 61 63 6b 20 61 72 65 0a  he callback are.
6e50: 69 67 6e 6f 72 65 64 2e 0a 0a 5b 6c 69 73 74 5f  ignored...[list_
6e60: 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a  begin options]..
6e70: 5b 6f 70 74 5f 64 65 66 20 65 72 72 6f 72 20 5b  [opt_def error [
6e80: 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 6d  arg "channelId m
6e90: 65 73 73 61 67 65 22 5d 5d 0a 54 68 69 73 20 66  essage"]].This f
6ea0: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20  orm of callback 
6eb0: 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 65  is invoked whene
6ec0: 76 65 72 20 61 6e 20 65 72 72 6f 72 20 6f 63 63  ver an error occ
6ed0: 75 72 73 20 64 75 72 69 6e 67 20 74 68 65 20 69  urs during the i
6ee0: 6e 69 74 69 61 6c 0a 63 6f 6e 6e 65 63 74 69 6f  nitial.connectio
6ef0: 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20 6f 72  n, handshake, or
6f00: 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f 6e 73 2e   I/O operations.
6f10: 20 54 68 65 20 5b 61 72 67 20 6d 65 73 73 61 67   The [arg messag
6f20: 65 5d 20 61 72 67 75 6d 65 6e 74 20 63 61 6e 20  e] argument can 
6f30: 62 65 0a 66 72 6f 6d 20 74 68 65 20 54 63 6c 5f  be.from the Tcl_
6f40: 45 72 72 6e 6f 4d 73 67 2c 20 4f 70 65 6e 53 53  ErrnoMsg, OpenSS
6f50: 4c 20 66 75 6e 63 74 69 6f 6e 20 5b 66 75 6e 20  L function [fun 
6f60: 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72 72 6f 72  ERR_reason_error
6f70: 5f 73 74 72 69 6e 67 28 29 5d 2c 0a 6f 72 20 61  _string()],.or a
6f80: 20 63 75 73 74 6f 6d 20 6d 65 73 73 61 67 65 2e   custom message.
6f90: 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69   This callback i
6fa0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
6fb0: 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20   1.8...[opt_def 
6fc0: 69 6e 66 6f 20 5b 61 72 67 20 22 63 68 61 6e 6e  info [arg "chann
6fd0: 65 6c 49 64 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72  elId major minor
6fe0: 20 6d 65 73 73 61 67 65 20 74 79 70 65 22 5d 5d   message type"]]
6ff0: 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61  .This form of ca
7000: 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65  llback is invoke
7010: 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c  d by the OpenSSL
7020: 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53   function.[fun S
7030: 53 4c 5f 73 65 74 5f 69 6e 66 6f 5f 63 61 6c 6c  SL_set_info_call
7040: 62 61 63 6b 28 29 5d 20 64 75 72 69 6e 67 20 74  back()] during t
7050: 68 65 20 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65  he initial conne
7060: 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e 64 73 68  ction and handsh
7070: 61 6b 65 0a 6f 70 65 72 61 74 69 6f 6e 73 2e 20  ake.operations. 
7080: 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72  The arguments ar
7090: 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  e:..[list_begin 
70a0: 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64  definitions]..[d
70b0: 65 66 20 5b 61 72 67 20 6d 61 6a 6f 72 5d 5d 0a  ef [arg major]].
70c0: 4d 61 6a 6f 72 20 63 61 74 65 67 6f 72 79 20 66  Major category f
70d0: 6f 72 20 65 72 72 6f 72 2e 20 56 61 6c 69 64 20  or error. Valid 
70e0: 65 6e 75 6d 73 20 61 72 65 3a 20 5b 63 6f 6e 73  enums are: [cons
70f0: 74 20 68 61 6e 64 73 68 61 6b 65 5d 2c 20 5b 63  t handshake], [c
7100: 6f 6e 73 74 20 61 6c 65 72 74 5d 2c 0a 5b 63 6f  onst alert],.[co
7110: 6e 73 74 20 63 6f 6e 6e 65 63 74 5d 2c 20 5b 63  nst connect], [c
7120: 6f 6e 73 74 20 61 63 63 65 70 74 5d 2e 0a 0a 5b  onst accept]...[
7130: 64 65 66 20 5b 61 72 67 20 6d 69 6e 6f 72 5d 5d  def [arg minor]]
7140: 0a 4d 69 6e 6f 72 20 63 61 74 65 67 6f 72 79 20  .Minor category 
7150: 66 6f 72 20 65 72 72 6f 72 2e 20 56 61 6c 69 64  for error. Valid
7160: 20 65 6e 75 6d 73 20 61 72 65 3a 20 5b 63 6f 6e   enums are: [con
7170: 73 74 20 73 74 61 72 74 5d 2c 20 5b 63 6f 6e 73  st start], [cons
7180: 74 20 64 6f 6e 65 5d 2c 20 5b 63 6f 6e 73 74 20  t done], [const 
7190: 72 65 61 64 5d 2c 0a 5b 63 6f 6e 73 74 20 77 72  read],.[const wr
71a0: 69 74 65 5d 2c 20 5b 63 6f 6e 73 74 20 6c 6f 6f  ite], [const loo
71b0: 70 5d 2c 20 5b 63 6f 6e 73 74 20 65 78 69 74 5d  p], [const exit]
71c0: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 65 73  ...[def [arg mes
71d0: 73 61 67 65 5d 5d 0a 44 65 73 63 72 69 70 74 69  sage]].Descripti
71e0: 76 65 20 6d 65 73 73 61 67 65 20 73 74 72 69 6e  ve message strin
71f0: 67 20 77 68 69 63 68 20 6d 61 79 20 62 65 20 67  g which may be g
7200: 65 6e 65 72 61 74 65 64 20 65 69 74 68 65 72 20  enerated either 
7210: 62 79 0a 5b 66 75 6e 20 53 53 4c 5f 73 74 61 74  by.[fun SSL_stat
7220: 65 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d  e_string_long()]
7230: 20 6f 72 20 5b 66 75 6e 20 53 53 4c 5f 61 6c 65   or [fun SSL_ale
7240: 72 74 5f 64 65 73 63 5f 73 74 72 69 6e 67 5f 6c  rt_desc_string_l
7250: 6f 6e 67 28 29 5d 2c 0a 64 65 70 65 6e 64 69 6e  ong()],.dependin
7260: 67 20 6f 6e 20 74 68 65 20 63 6f 6e 74 65 78 74  g on the context
7270: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 74 79 70  ...[def [arg typ
7280: 65 5d 5d 0a 46 6f 72 20 61 6c 65 72 74 73 2c 20  e]].For alerts, 
7290: 74 68 65 20 70 6f 73 73 69 62 6c 65 20 76 61 6c  the possible val
72a0: 75 65 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20  ues are: [const 
72b0: 77 61 72 6e 69 6e 67 5d 2c 0a 5b 63 6f 6e 73 74  warning],.[const
72c0: 20 66 61 74 61 6c 5d 2c 20 61 6e 64 20 5b 63 6f   fatal], and [co
72d0: 6e 73 74 20 75 6e 6b 6e 6f 77 6e 5d 2e 20 46 6f  nst unknown]. Fo
72e0: 72 20 6f 74 68 65 72 73 2c 20 5b 63 6f 6e 73 74  r others, [const
72f0: 20 69 6e 66 6f 5d 20 69 73 20 75 73 65 64 2e 0a   info] is used..
7300: 54 68 69 73 20 61 72 67 75 6d 65 6e 74 20 69 73  This argument is
7310: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
7320: 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  1.8...[list_end]
7330: 0a 0a 5b 6f 70 74 5f 64 65 66 20 6d 65 73 73 61  ..[opt_def messa
7340: 67 65 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c  ge [arg "channel
7350: 49 64 20 64 69 72 65 63 74 69 6f 6e 20 76 65 72  Id direction ver
7360: 73 69 6f 6e 20 63 6f 6e 74 65 6e 74 5f 74 79 70  sion content_typ
7370: 65 20 6d 65 73 73 61 67 65 22 5d 5d 0a 54 68 69  e message"]].Thi
7380: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61  s form of callba
7390: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79  ck is invoked by
73a0: 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e   the OpenSSL fun
73b0: 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73  ction.[fun SSL_s
73c0: 65 74 5f 6d 73 67 5f 63 61 6c 6c 62 61 63 6b 28  et_msg_callback(
73d0: 29 5d 20 77 68 65 6e 65 76 65 72 20 61 20 6d 65  )] whenever a me
73e0: 73 73 61 67 65 20 69 73 20 73 65 6e 74 20 6f 72  ssage is sent or
73f0: 20 72 65 63 65 69 76 65 64 20 64 75 72 69 6e 67   received during
7400: 20 74 68 65 0a 69 6e 69 74 69 61 6c 20 63 6f 6e   the.initial con
7410: 6e 65 63 74 69 6f 6e 2c 20 68 61 6e 64 73 68 61  nection, handsha
7420: 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f 70 65 72 61  ke, or I/O opera
7430: 74 69 6f 6e 73 2e 20 49 74 20 69 73 20 6f 6e 6c  tions. It is onl
7440: 79 20 61 76 61 69 6c 61 62 6c 65 20 77 68 65 6e  y available when
7450: 0a 4f 70 65 6e 53 53 4c 20 69 73 20 63 6f 6d 70  .OpenSSL is comp
7460: 6c 69 65 64 20 77 69 74 68 20 74 68 65 20 5b 63  lied with the [c
7470: 6f 6e 73 74 20 65 6e 61 62 6c 65 2d 73 73 6c 2d  onst enable-ssl-
7480: 74 72 61 63 65 5d 20 6f 70 74 69 6f 6e 2e 20 54  trace] option. T
7490: 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 0a  his callback is.
74a0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
74b0: 2e 38 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74  .8. The argument
74c0: 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65  s are:..[list_be
74d0: 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d  gin definitions]
74e0: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 64 69 72 65  ..[def [arg dire
74f0: 63 74 69 6f 6e 5d 5d 0a 44 69 72 65 63 74 69 6f  ction]].Directio
7500: 6e 20 69 73 20 65 69 74 68 65 72 20 5b 63 6f 6e  n is either [con
7510: 73 74 20 53 65 6e 74 5d 20 6f 72 20 5b 63 6f 6e  st Sent] or [con
7520: 73 74 20 52 65 63 65 69 76 65 64 5d 2e 0a 0a 5b  st Received]...[
7530: 64 65 66 20 5b 61 72 67 20 76 65 72 73 69 6f 6e  def [arg version
7540: 5d 5d 0a 56 65 72 73 69 6f 6e 20 69 73 20 74 68  ]].Version is th
7550: 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69  e protocol versi
7560: 6f 6e 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63  on...[def [arg c
7570: 6f 6e 74 65 6e 74 5f 74 79 70 65 5d 5d 0a 43 6f  ontent_type]].Co
7580: 6e 74 65 6e 74 20 74 79 70 65 20 69 73 20 74 68  ntent type is th
7590: 65 20 6d 65 73 73 61 67 65 20 63 6f 6e 74 65 6e  e message conten
75a0: 74 20 74 79 70 65 2e 0a 0a 5b 64 65 66 20 5b 61  t type...[def [a
75b0: 72 67 20 6d 65 73 73 61 67 65 5d 5d 0a 4d 65 73  rg message]].Mes
75c0: 73 61 67 65 20 69 73 20 6d 6f 72 65 20 69 6e 66  sage is more inf
75d0: 6f 20 66 72 6f 6d 20 74 68 65 20 5b 63 6f 6e 73  o from the [cons
75e0: 74 20 53 53 4c 5f 74 72 61 63 65 5d 20 41 50 49  t SSL_trace] API
75f0: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
7600: 6f 70 74 5f 64 65 66 20 73 65 73 73 69 6f 6e 20  opt_def session 
7610: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20  [arg "channelId 
7620: 73 65 73 73 69 6f 6e 5f 69 64 20 73 65 73 73 69  session_id sessi
7630: 6f 6e 5f 74 69 63 6b 65 74 20 6c 69 66 65 74 69  on_ticket lifeti
7640: 6d 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20  me"]].This form 
7650: 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69  of callback is i
7660: 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70  nvoked by the Op
7670: 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b  enSSL function.[
7680: 66 75 6e 20 53 53 4c 5f 43 54 58 5f 73 65 73 73  fun SSL_CTX_sess
7690: 5f 73 65 74 5f 6e 65 77 5f 63 62 28 29 5d 20 77  _set_new_cb()] w
76a0: 68 65 6e 65 76 65 72 20 61 20 6e 65 77 20 73 65  henever a new se
76b0: 73 73 69 6f 6e 20 69 64 20 69 73 20 73 65 6e 74  ssion id is sent
76c0: 20 62 79 20 74 68 65 0a 73 65 72 76 65 72 20 64   by the.server d
76d0: 75 72 69 6e 67 20 74 68 65 20 69 6e 69 74 69 61  uring the initia
76e0: 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61 6e 64  l connection and
76f0: 20 68 61 6e 64 73 68 61 6b 65 20 61 6e 64 20 61   handshake and a
7700: 6c 73 6f 20 64 75 72 69 6e 67 20 74 68 65 20 73  lso during the s
7710: 65 73 73 69 6f 6e 0a 69 66 20 74 68 65 20 5b 6f  ession.if the [o
7720: 70 74 69 6f 6e 20 2d 70 6f 73 74 5f 68 61 6e 64  ption -post_hand
7730: 73 68 61 6b 65 5d 20 6f 70 74 69 6f 6e 20 69 73  shake] option is
7740: 20 73 65 74 20 74 6f 20 74 72 75 65 2e 20 54 68   set to true. Th
7750: 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e  is callback is n
7760: 65 77 20 66 6f 72 0a 54 63 6c 54 4c 53 20 31 2e  ew for.TclTLS 1.
7770: 38 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73  8. The arguments
7780: 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67   are:..[list_beg
7790: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
77a0: 0a 5b 64 65 66 20 5b 61 72 67 20 73 65 73 73 69  .[def [arg sessi
77b0: 6f 6e 5f 69 64 5d 5d 0a 53 65 73 73 69 6f 6e 20  on_id]].Session 
77c0: 49 64 20 69 73 20 74 68 65 20 63 75 72 72 65 6e  Id is the curren
77d0: 74 20 73 65 73 73 69 6f 6e 20 69 64 65 6e 74 69  t session identi
77e0: 66 69 65 72 0a 0a 5b 64 65 66 20 5b 61 72 67 20  fier..[def [arg 
77f0: 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 5d  session_ticket]]
7800: 0a 54 69 63 6b 65 74 20 69 73 20 74 68 65 20 73  .Ticket is the s
7810: 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 69 6e  ession ticket in
7820: 66 6f 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6c 69  fo..[def [arg li
7830: 66 65 74 69 6d 65 5d 5d 0a 4c 69 66 65 74 69 6d  fetime]].Lifetim
7840: 65 20 69 73 20 74 68 65 20 74 69 63 6b 65 74 20  e is the ticket 
7850: 6c 69 66 65 74 69 6d 65 20 69 6e 20 73 65 63 6f  lifetime in seco
7860: 6e 64 73 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  nds...[list_end]
7870: 0a 0a 5b 6f 70 74 5f 64 65 66 20 76 65 72 69 66  ..[opt_def verif
7880: 79 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49  y [arg "channelI
7890: 64 20 64 65 70 74 68 20 63 65 72 74 20 73 74 61  d depth cert sta
78a0: 74 75 73 20 65 72 72 6f 72 22 5d 5d 0a 54 68 69  tus error"]].Thi
78b0: 73 20 63 61 6c 6c 62 61 63 6b 20 77 61 73 20 6d  s callback was m
78c0: 6f 76 65 64 20 74 6f 20 5b 6f 70 74 69 6f 6e 20  oved to [option 
78d0: 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64  -validatecommand
78e0: 5d 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e  ] in TclTLS 1.8.
78f0: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73  ..[list_end]..[s
7900: 75 62 73 65 63 74 69 6f 6e 20 22 56 61 6c 75 65  ubsection "Value
7910: 73 20 66 6f 72 20 50 61 73 73 77 6f 72 64 20 43  s for Password C
7920: 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63  allback"]..The c
7930: 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20  allback for the 
7940: 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72  [option -passwor
7950: 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76  d] option is inv
7960: 6f 6b 65 64 20 62 79 20 54 63 6c 54 4c 53 20 77  oked by TclTLS w
7970: 68 65 6e 65 76 65 72 20 4f 70 65 6e 53 53 4c 20  henever OpenSSL 
7980: 6e 65 65 64 73 0a 74 6f 20 6f 62 74 61 69 6e 20  needs.to obtain 
7990: 61 20 70 61 73 73 77 6f 72 64 2e 20 53 65 65 20  a password. See 
79a0: 62 65 6c 6f 77 20 66 6f 72 20 74 68 65 20 70 6f  below for the po
79b0: 73 73 69 62 6c 65 20 61 72 67 75 6d 65 6e 74 73  ssible arguments
79c0: 20 70 61 73 73 65 64 20 74 6f 20 74 68 65 0a 63   passed to the.c
79d0: 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 2e 20  allback script. 
79e0: 54 68 65 20 75 73 65 72 20 70 72 6f 76 69 64 65  The user provide
79f0: 64 20 70 61 73 73 77 6f 72 64 20 69 73 20 65 78  d password is ex
7a00: 70 65 63 74 65 64 20 74 6f 20 62 65 20 72 65 74  pected to be ret
7a10: 75 72 6e 65 64 20 62 79 20 74 68 65 0a 63 61 6c  urned by the.cal
7a20: 6c 62 61 63 6b 2e 0a 0a 5b 6c 69 73 74 5f 62 65  lback...[list_be
7a30: 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f  gin options]..[o
7a40: 70 74 5f 64 65 66 20 70 61 73 73 77 6f 72 64 20  pt_def password 
7a50: 5b 61 72 67 20 22 72 77 66 6c 61 67 20 73 69 7a  [arg "rwflag siz
7a60: 65 22 5d 5d 0a 49 6e 76 6f 6b 65 64 20 77 68 65  e"]].Invoked whe
7a70: 6e 20 6c 6f 61 64 69 6e 67 20 6f 72 20 73 74 6f  n loading or sto
7a80: 72 69 6e 67 20 61 6e 20 65 6e 63 72 79 70 74 65  ring an encrypte
7a90: 64 20 50 45 4d 20 63 65 72 74 69 66 69 63 61 74  d PEM certificat
7aa0: 65 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73  e. The arguments
7ab0: 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67   are:..[list_beg
7ac0: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
7ad0: 0a 5b 64 65 66 20 5b 61 72 67 20 72 77 66 6c 61  .[def [arg rwfla
7ae0: 67 5d 5d 0a 54 68 65 20 72 65 61 64 2f 77 72 69  g]].The read/wri
7af0: 74 65 20 66 6c 61 67 20 69 73 20 30 20 66 6f 72  te flag is 0 for
7b00: 20 72 65 61 64 69 6e 67 2f 64 65 63 72 79 70 74   reading/decrypt
7b10: 69 6f 6e 20 6f 72 20 31 20 66 6f 72 20 77 72 69  ion or 1 for wri
7b20: 74 69 6e 67 2f 65 6e 63 72 79 70 74 69 6f 6e 2e  ting/encryption.
7b30: 0a 54 68 65 20 6c 61 74 74 65 72 20 63 61 6e 20  .The latter can 
7b40: 62 65 20 75 73 65 64 20 74 6f 20 64 65 74 65 72  be used to deter
7b50: 6d 69 6e 65 20 77 68 65 6e 20 74 6f 20 70 72 6f  mine when to pro
7b60: 6d 70 74 20 74 68 65 20 75 73 65 72 20 74 6f 20  mpt the user to 
7b70: 63 6f 6e 66 69 72 6d 2e 0a 54 68 69 73 20 61 72  confirm..This ar
7b80: 67 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 66 6f  gument is new fo
7b90: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
7ba0: 64 65 66 20 5b 61 72 67 20 73 69 7a 65 5d 5d 0a  def [arg size]].
7bb0: 54 68 65 20 73 69 7a 65 20 69 73 20 74 68 65 20  The size is the 
7bc0: 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74 68 20 6f  maximum length o
7bd0: 66 20 74 68 65 20 70 61 73 73 77 6f 72 64 20 69  f the password i
7be0: 6e 20 62 79 74 65 73 2e 0a 54 68 69 73 20 61 72  n bytes..This ar
7bf0: 67 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 66 6f  gument is new fo
7c00: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
7c10: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74  list_end]..[list
7c20: 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69  _end]..[subsecti
7c30: 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 20 56  on "Values for V
7c40: 61 6c 69 64 61 74 65 20 43 6f 6d 6d 61 6e 64 20  alidate Command 
7c50: 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20  Callback"]..The 
7c60: 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65  callback for the
7c70: 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61   [option -valida
7c80: 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f  tecommand] optio
7c90: 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20 64 75 72  n is invoked dur
7ca0: 69 6e 67 20 74 68 65 20 68 61 6e 64 73 68 61 6b  ing the handshak
7cb0: 65 0a 70 72 6f 63 65 73 73 20 69 6e 20 6f 72 64  e.process in ord
7cc0: 65 72 20 66 6f 72 20 74 68 65 20 61 70 70 6c 69  er for the appli
7cd0: 63 61 74 69 6f 6e 20 74 6f 20 76 61 6c 69 64 61  cation to valida
7ce0: 74 65 20 74 68 65 20 70 72 6f 76 69 64 65 64 20  te the provided 
7cf0: 76 61 6c 75 65 28 73 29 2e 20 53 65 65 0a 62 65  value(s). See.be
7d00: 6c 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73  low for the poss
7d10: 69 62 6c 65 20 61 72 67 75 6d 65 6e 74 73 20 70  ible arguments p
7d20: 61 73 73 65 64 20 74 6f 20 74 68 65 20 63 61 6c  assed to the cal
7d30: 6c 62 61 63 6b 20 73 63 72 69 70 74 2e 20 49 66  lback script. If
7d40: 20 6e 6f 74 0a 73 70 65 63 69 66 69 65 64 2c 20   not.specified, 
7d50: 4f 70 65 6e 53 53 4c 20 77 69 6c 6c 20 61 63 63  OpenSSL will acc
7d60: 65 70 74 20 61 6c 6c 20 76 61 6c 69 64 20 63 65  ept all valid ce
7d70: 72 74 69 66 69 63 61 74 65 73 20 61 6e 64 20 65  rtificates and e
7d80: 78 74 65 6e 73 69 6f 6e 73 2e 20 54 6f 20 72 65  xtensions. To re
7d90: 6a 65 63 74 0a 74 68 65 20 76 61 6c 75 65 20 61  ject.the value a
7da0: 6e 64 20 61 62 6f 72 74 20 74 68 65 20 63 6f 6e  nd abort the con
7db0: 6e 65 63 74 69 6f 6e 2c 20 74 68 65 20 63 61 6c  nection, the cal
7dc0: 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65 74  lback should ret
7dd0: 75 72 6e 20 30 2e 20 54 6f 20 61 63 63 65 70 74  urn 0. To accept
7de0: 20 74 68 65 0a 76 61 6c 75 65 20 61 6e 64 20 63   the.value and c
7df0: 6f 6e 74 69 6e 75 65 20 74 68 65 20 63 6f 6e 6e  ontinue the conn
7e00: 65 63 74 69 6f 6e 2c 20 69 74 20 73 68 6f 75 6c  ection, it shoul
7e10: 64 20 72 65 74 75 72 6e 20 31 2e 20 54 6f 20 72  d return 1. To r
7e20: 65 6a 65 63 74 20 74 68 65 20 76 61 6c 75 65 2c  eject the value,
7e30: 20 62 75 74 0a 63 6f 6e 74 69 6e 75 65 20 74 68   but.continue th
7e40: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 74  e connection, it
7e50: 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 32   should return 2
7e60: 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20  . This callback 
7e70: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
7e80: 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 62 65  S 1.8...[list_be
7e90: 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f  gin options]..[o
7ea0: 70 74 5f 64 65 66 20 61 6c 70 6e 20 5b 61 72 67  pt_def alpn [arg
7eb0: 20 22 63 68 61 6e 6e 65 6c 49 64 20 70 72 6f 74   "channelId prot
7ec0: 6f 63 6f 6c 20 6d 61 74 63 68 22 5d 5d 0a 46 6f  ocol match"]].Fo
7ed0: 72 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 20  r servers, this 
7ee0: 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b  form of callback
7ef0: 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e   is invoked when
7f00: 20 74 68 65 20 63 6c 69 65 6e 74 20 41 4c 50 4e   the client ALPN
7f10: 20 65 78 74 65 6e 73 69 6f 6e 20 69 73 0a 72 65   extension is.re
7f20: 63 65 69 76 65 64 2e 20 49 66 20 5b 61 72 67 20  ceived. If [arg 
7f30: 6d 61 74 63 68 5d 20 69 73 20 74 72 75 65 2c 20  match] is true, 
7f40: 74 68 65 6e 20 5b 61 72 67 20 70 72 6f 74 6f 63  then [arg protoc
7f50: 6f 6c 5d 20 69 73 20 74 68 65 20 66 69 72 73 74  ol] is the first
7f60: 0a 5b 6f 70 74 69 6f 6e 20 2d 61 6c 70 6e 5d 20  .[option -alpn] 
7f70: 70 72 6f 74 6f 63 6f 6c 20 6f 70 74 69 6f 6e 20  protocol option 
7f80: 69 6e 20 63 6f 6d 6d 6f 6e 20 74 6f 20 62 6f 74  in common to bot
7f90: 68 20 74 68 65 20 63 6c 69 65 6e 74 20 61 6e 64  h the client and
7fa0: 20 73 65 72 76 65 72 2e 0a 49 66 20 6e 6f 74 2c   server..If not,
7fb0: 20 74 68 65 20 66 69 72 73 74 20 63 6c 69 65 6e   the first clien
7fc0: 74 20 73 70 65 63 69 66 69 65 64 20 70 72 6f 74  t specified prot
7fd0: 6f 63 6f 6c 20 69 73 20 75 73 65 64 2e 20 54 68  ocol is used. Th
7fe0: 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 63  is callback is c
7ff0: 61 6c 6c 65 64 0a 61 66 74 65 72 20 74 68 65 20  alled.after the 
8000: 48 65 6c 6c 6f 20 61 6e 64 20 53 4e 49 20 63 61  Hello and SNI ca
8010: 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64  llbacks...[opt_d
8020: 65 66 20 68 65 6c 6c 6f 20 5b 61 72 67 20 22 63  ef hello [arg "c
8030: 68 61 6e 6e 65 6c 49 64 20 73 65 72 76 65 72 6e  hannelId servern
8040: 61 6d 65 20 73 65 73 73 69 6f 6e 5f 69 64 22 5d  ame session_id"]
8050: 5d 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74  ].For servers, t
8060: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
8070: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20  back is invoked 
8080: 64 75 72 69 6e 67 20 63 6c 69 65 6e 74 20 68 65  during client he
8090: 6c 6c 6f 20 6d 65 73 73 61 67 65 0a 70 72 6f 63  llo message.proc
80a0: 65 73 73 69 6e 67 2e 20 54 68 65 20 70 75 72 70  essing. The purp
80b0: 6f 73 65 20 69 73 20 73 6f 20 74 68 65 20 73 65  ose is so the se
80c0: 72 76 65 72 20 63 61 6e 20 73 65 6c 65 63 74 20  rver can select 
80d0: 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20  the appropriate 
80e0: 63 65 72 74 69 66 69 63 61 74 65 0a 74 6f 20 70  certificate.to p
80f0: 72 65 73 65 6e 74 20 74 6f 20 74 68 65 20 63 6c  resent to the cl
8100: 69 65 6e 74 2c 20 61 6e 64 20 74 6f 20 6d 61 6b  ient, and to mak
8110: 65 20 6f 74 68 65 72 20 63 6f 6e 66 69 67 75 72  e other configur
8120: 61 74 69 6f 6e 20 61 64 6a 75 73 74 6d 65 6e 74  ation adjustment
8130: 73 20 72 65 6c 65 76 61 6e 74 0a 74 6f 20 74 68  s relevant.to th
8140: 61 74 20 73 65 72 76 65 72 20 6e 61 6d 65 20 61  at server name a
8150: 6e 64 20 69 74 73 20 63 6f 6e 66 69 67 75 72 61  nd its configura
8160: 74 69 6f 6e 2e 20 49 74 20 69 73 20 63 61 6c 6c  tion. It is call
8170: 65 64 20 62 65 66 6f 72 65 20 74 68 65 20 53 4e  ed before the SN
8180: 49 20 61 6e 64 20 41 4c 50 4e 0a 63 61 6c 6c 62  I and ALPN.callb
8190: 61 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  acks...[opt_def 
81a0: 73 6e 69 20 5b 61 72 67 20 22 63 68 61 6e 6e 65  sni [arg "channe
81b0: 6c 49 64 20 73 65 72 76 65 72 6e 61 6d 65 22 5d  lId servername"]
81c0: 5d 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74  ].For servers, t
81d0: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
81e0: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20  back is invoked 
81f0: 77 68 65 6e 20 74 68 65 20 53 65 72 76 65 72 20  when the Server 
8200: 4e 61 6d 65 20 49 6e 64 69 63 61 74 69 6f 6e 0a  Name Indication.
8210: 28 53 4e 49 29 20 65 78 74 65 6e 73 69 6f 6e 20  (SNI) extension 
8220: 69 73 20 72 65 63 65 69 76 65 64 2e 20 54 68 65  is received. The
8230: 20 5b 61 72 67 20 73 65 72 76 65 72 6e 61 6d 65   [arg servername
8240: 5d 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68  ] argument is th
8250: 65 20 63 6c 69 65 6e 74 0a 70 72 6f 76 69 64 65  e client.provide
8260: 64 20 73 65 72 76 65 72 20 6e 61 6d 65 20 73 70  d server name sp
8270: 65 63 69 66 69 65 64 20 69 6e 20 74 68 65 20 5b  ecified in the [
8280: 6f 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61  option -serverna
8290: 6d 65 5d 20 6f 70 74 69 6f 6e 2e 20 54 68 65 0a  me] option. The.
82a0: 70 75 72 70 6f 73 65 20 69 73 20 73 6f 20 77 68  purpose is so wh
82b0: 65 6e 20 61 20 73 65 72 76 65 72 20 73 75 70 70  en a server supp
82c0: 6f 72 74 73 20 6d 75 6c 74 69 70 6c 65 20 6e 61  orts multiple na
82d0: 6d 65 73 2c 20 74 68 65 20 72 69 67 68 74 20 63  mes, the right c
82e0: 65 72 74 69 66 69 63 61 74 65 0a 63 61 6e 20 62  ertificate.can b
82f0: 65 20 75 73 65 64 2e 20 49 74 20 69 73 20 63 61  e used. It is ca
8300: 6c 6c 65 64 20 61 66 74 65 72 20 74 68 65 20 48  lled after the H
8310: 65 6c 6c 6f 20 63 61 6c 6c 62 61 63 6b 20 62 75  ello callback bu
8320: 74 20 62 65 66 6f 72 65 20 74 68 65 20 41 4c 50  t before the ALP
8330: 4e 0a 63 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6f 70  N.callback...[op
8340: 74 5f 64 65 66 20 76 65 72 69 66 79 20 5b 61 72  t_def verify [ar
8350: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 65 70  g "channelId dep
8360: 74 68 20 63 65 72 74 20 73 74 61 74 75 73 20 65  th cert status e
8370: 72 72 6f 72 22 5d 5d 0a 54 68 69 73 20 66 6f 72  rror"]].This for
8380: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73  m of callback is
8390: 20 69 6e 76 6f 6b 65 64 20 62 79 20 4f 70 65 6e   invoked by Open
83a0: 53 53 4c 20 77 68 65 6e 20 61 20 6e 65 77 20 63  SSL when a new c
83b0: 65 72 74 69 66 69 63 61 74 65 20 69 73 20 72 65  ertificate is re
83c0: 63 65 69 76 65 64 0a 66 72 6f 6d 20 74 68 65 20  ceived.from the 
83d0: 70 65 65 72 2e 20 49 74 20 61 6c 6c 6f 77 73 20  peer. It allows 
83e0: 74 68 65 20 63 6c 69 65 6e 74 20 74 6f 20 63 68  the client to ch
83f0: 65 63 6b 20 74 68 65 20 63 65 72 74 69 66 69 63  eck the certific
8400: 61 74 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e  ate verification
8410: 0a 72 65 73 75 6c 74 73 20 61 6e 64 20 63 68 6f  .results and cho
8420: 6f 73 65 20 77 68 65 74 68 65 72 20 74 6f 20 63  ose whether to c
8430: 6f 6e 74 69 6e 75 65 20 6f 72 20 6e 6f 74 2e 20  ontinue or not. 
8440: 49 74 20 69 73 20 63 61 6c 6c 65 64 20 66 6f 72  It is called for
8450: 20 65 61 63 68 0a 63 65 72 74 69 66 69 63 61 74   each.certificat
8460: 65 20 69 6e 20 74 68 65 20 63 65 72 74 69 66 69  e in the certifi
8470: 63 61 74 65 20 63 68 61 69 6e 2e 20 54 68 69 73  cate chain. This
8480: 20 63 61 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f   callback was mo
8490: 76 65 64 20 66 72 6f 6d 0a 5b 6f 70 74 69 6f 6e  ved from.[option
84a0: 20 2d 63 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54 63   -command] in Tc
84b0: 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65 20 61 72  lTLS 1.8. The ar
84c0: 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c  guments are:..[l
84d0: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
84e0: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72  tions]..[def [ar
84f0: 67 20 64 65 70 74 68 5d 5d 0a 54 68 65 20 64 65  g depth]].The de
8500: 70 74 68 20 69 73 20 74 68 65 20 69 6e 74 65 67  pth is the integ
8510: 65 72 20 64 65 70 74 68 20 6f 66 20 74 68 65 20  er depth of the 
8520: 63 65 72 74 69 66 69 63 61 74 65 20 69 6e 20 74  certificate in t
8530: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 63  he certificate c
8540: 68 61 69 6e 2c 0a 77 68 65 72 65 20 30 20 69 73  hain,.where 0 is
8550: 20 74 68 65 20 70 65 65 72 20 63 65 72 74 69 66   the peer certif
8560: 69 63 61 74 65 20 61 6e 64 20 68 69 67 68 65 72  icate and higher
8570: 20 76 61 6c 75 65 73 20 67 6f 69 6e 67 20 75 70   values going up
8580: 20 74 6f 20 74 68 65 20 43 65 72 74 69 66 69 63   to the Certific
8590: 61 74 65 0a 41 75 74 68 6f 72 69 74 79 20 28 43  ate.Authority (C
85a0: 41 29 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63  A)...[def [arg c
85b0: 65 72 74 5d 5d 0a 54 68 65 20 63 65 72 74 20 61  ert]].The cert a
85c0: 72 67 75 6d 65 6e 74 20 69 73 20 61 20 6c 69 73  rgument is a lis
85d0: 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70  t of key-value p
85e0: 61 69 72 73 20 73 69 6d 69 6c 61 72 20 74 6f 20  airs similar to 
85f0: 74 68 6f 73 65 20 72 65 74 75 72 6e 65 64 20 62  those returned b
8600: 79 0a 5b 63 6d 64 20 74 6c 73 3a 3a 73 74 61 74  y.[cmd tls::stat
8610: 75 73 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20  us]...[def [arg 
8620: 73 74 61 74 75 73 5d 5d 0a 54 68 65 20 73 74 61  status]].The sta
8630: 74 75 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20  tus argument is 
8640: 74 68 65 20 62 6f 6f 6c 65 61 6e 20 76 61 6c 69  the boolean vali
8650: 64 69 74 79 20 6f 66 20 74 68 65 20 63 75 72 72  dity of the curr
8660: 65 6e 74 20 63 65 72 74 69 66 69 63 61 74 65 20  ent certificate 
8670: 77 68 65 72 65 20 30 0a 69 73 20 69 6e 76 61 6c  where 0.is inval
8680: 69 64 20 61 6e 64 20 31 20 69 73 20 76 61 6c 69  id and 1 is vali
8690: 64 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 65 72  d...[def [arg er
86a0: 72 6f 72 5d 5d 0a 54 68 65 20 65 72 72 6f 72 20  ror]].The error 
86b0: 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20  argument is the 
86c0: 65 72 72 6f 72 20 6d 65 73 73 61 67 65 2c 20 69  error message, i
86d0: 66 20 61 6e 79 2c 20 67 65 6e 65 72 61 74 65 64  f any, generated
86e0: 20 62 79 0a 5b 66 75 6e 20 58 35 30 39 5f 53 54   by.[fun X509_ST
86f0: 4f 52 45 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f  ORE_CTX_get_erro
8700: 72 28 29 5d 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  r()]...[list_end
8710: 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 52  ]..[list_end]..R
8720: 65 66 65 72 65 6e 63 65 20 69 6d 70 6c 65 6d 65  eference impleme
8730: 6e 74 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 73  ntations of thes
8740: 65 20 63 61 6c 6c 62 61 63 6b 73 20 61 72 65 20  e callbacks are 
8750: 70 72 6f 76 69 64 65 64 20 69 6e 20 5b 66 69 6c  provided in [fil
8760: 65 20 74 6c 73 2e 74 63 6c 5d 0a 61 73 20 5b 63  e tls.tcl].as [c
8770: 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b  md tls::callback
8780: 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73  ], [cmd tls::pas
8790: 73 77 6f 72 64 5d 2c 20 61 6e 64 20 5b 63 6d 64  sword], and [cmd
87a0: 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63   tls::validate_c
87b0: 6f 6d 6d 61 6e 64 5d 0a 72 65 73 70 65 63 74 69  ommand].respecti
87c0: 76 65 6c 79 2e 20 4e 6f 74 65 20 74 68 61 74 20  vely. Note that 
87d0: 74 68 65 73 65 20 61 72 65 20 6f 6e 6c 79 20 5b  these are only [
87e0: 65 6d 70 68 20 73 61 6d 70 6c 65 5d 20 69 6d 70  emph sample] imp
87f0: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 20 49 6e  lementations. In
8800: 20 61 20 6d 6f 72 65 0a 72 65 61 6c 69 73 74 69   a more.realisti
8810: 63 20 64 65 70 6c 6f 79 6d 65 6e 74 20 79 6f 75  c deployment you
8820: 20 77 6f 75 6c 64 20 73 70 65 63 69 66 79 20 79   would specify y
8830: 6f 75 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b  our own callback
8840: 20 73 63 72 69 70 74 73 20 6f 6e 20 65 61 63 68   scripts on each
8850: 20 54 4c 53 0a 63 68 61 6e 6e 65 6c 20 75 73 69   TLS.channel usi
8860: 6e 67 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  ng the [option -
8870: 63 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f  command], [optio
8880: 6e 20 2d 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e  n -password], an
8890: 64 0a 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64  d.[option -valid
88a0: 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74  ate_command] opt
88b0: 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54  ions...[para]..T
88c0: 68 65 20 64 65 66 61 75 6c 74 20 62 65 68 61 76  he default behav
88d0: 69 6f 72 20 77 68 65 6e 20 74 68 65 20 5b 6f 70  ior when the [op
88e0: 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 61  tion -command] a
88f0: 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69  nd [option -vali
8900: 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 6f 70  date_command].op
8910: 74 69 6f 6e 73 20 61 72 65 20 6e 6f 74 20 73 70  tions are not sp
8920: 65 63 69 66 69 65 64 2c 20 69 73 20 66 6f 72 20  ecified, is for 
8930: 54 63 6c 54 4c 53 20 74 6f 20 70 72 6f 63 65 73  TclTLS to proces
8940: 73 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64  s the associated
8950: 20 6c 69 62 72 61 72 79 0a 63 61 6c 6c 62 61 63   library.callbac
8960: 6b 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2e 20 54  ks internally. T
8970: 68 65 20 64 65 66 61 75 6c 74 20 62 65 68 61 76  he default behav
8980: 69 6f 72 20 77 68 65 6e 20 74 68 65 20 5b 6f 70  ior when the [op
8990: 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20  tion -password] 
89a0: 6f 70 74 69 6f 6e 0a 69 73 20 6e 6f 74 20 73 70  option.is not sp
89b0: 65 63 69 66 69 65 64 20 69 73 20 66 6f 72 20 54  ecified is for T
89c0: 63 6c 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73  clTLS to process
89d0: 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 20   the associated 
89e0: 6c 69 62 72 61 72 79 20 63 61 6c 6c 62 61 63 6b  library callback
89f0: 73 20 62 79 0a 61 74 74 65 6d 70 74 69 6e 67 20  s by.attempting 
8a00: 74 6f 20 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73  to call [cmd tls
8a10: 3a 3a 70 61 73 73 77 6f 72 64 5d 2e 20 54 68 65  ::password]. The
8a20: 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77   difference betw
8a30: 65 65 6e 20 74 68 65 73 65 20 74 77 6f 0a 62 65  een these two.be
8a40: 68 61 76 69 6f 72 73 20 69 73 20 61 20 63 6f 6e  haviors is a con
8a50: 73 65 71 75 65 6e 63 65 20 6f 66 20 6d 61 69 6e  sequence of main
8a60: 74 61 69 6e 69 6e 67 20 63 6f 6d 70 61 74 69 62  taining compatib
8a70: 69 6c 69 74 79 20 77 69 74 68 20 65 61 72 6c 69  ility with earli
8a80: 65 72 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f  er.implementatio
8a90: 6e 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d  ns...[para]..[em
8aa0: 70 68 20 22 54 68 65 20 75 73 65 20 6f 66 20 74  ph "The use of t
8ab0: 68 65 20 72 65 66 65 72 65 6e 63 65 20 63 61 6c  he reference cal
8ac0: 6c 62 61 63 6b 73 20 5b 63 6d 64 20 74 6c 73 3a  lbacks [cmd tls:
8ad0: 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64  :callback], [cmd
8ae0: 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c   tls::password],
8af0: 0a 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 76  .and [cmd tls::v
8b00: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
8b10: 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e   is not recommen
8b20: 64 65 64 2e 20 54 68 65 79 20 6d 61 79 20 62 65  ded. They may be
8b30: 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75   removed from fu
8b40: 74 75 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d  ture releases."]
8b50: 0a 0a 5b 73 65 63 74 69 6f 6e 20 44 65 62 75 67  ..[section Debug
8b60: 5d 0a 0a 46 6f 72 20 6d 6f 73 74 20 64 65 62 75  ]..For most debu
8b70: 67 67 69 6e 67 20 6e 65 65 64 73 2c 20 74 68 65  gging needs, the
8b80: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 6c 6c 62 61   [option -callba
8b90: 63 6b 5d 20 6f 70 74 69 6f 6e 20 63 61 6e 20 62  ck] option can b
8ba0: 65 20 75 73 65 64 20 74 6f 20 70 72 6f 76 69 64  e used to provid
8bb0: 65 0a 73 75 66 66 69 63 69 65 6e 74 20 69 6e 73  e.sufficient ins
8bc0: 69 67 68 74 20 61 6e 64 20 69 6e 66 6f 72 6d 61  ight and informa
8bd0: 74 69 6f 6e 20 6f 6e 20 74 68 65 20 54 4c 53 20  tion on the TLS 
8be0: 68 61 6e 64 73 68 61 6b 65 20 61 6e 64 20 70 72  handshake and pr
8bf0: 6f 67 72 65 73 73 2e 20 49 66 0a 66 75 72 74 68  ogress. If.furth
8c00: 65 72 20 74 72 6f 75 62 6c 65 73 68 6f 6f 74 69  er troubleshooti
8c10: 6e 67 20 69 6e 73 69 67 68 74 20 69 73 20 6e 65  ng insight is ne
8c20: 65 64 65 64 2c 20 74 68 65 20 63 6f 6d 70 69 6c  eded, the compil
8c30: 65 20 74 69 6d 65 20 6f 70 74 69 6f 6e 0a 5b 6f  e time option.[o
8c40: 70 74 69 6f 6e 20 2d 2d 65 6e 61 62 6c 65 2d 64  ption --enable-d
8c50: 65 62 75 67 5d 20 63 61 6e 20 62 65 20 75 73 65  ebug] can be use
8c60: 64 20 74 6f 20 67 65 74 20 64 65 74 61 69 6c 65  d to get detaile
8c70: 64 20 65 78 65 63 75 74 69 6f 6e 20 66 6c 6f 77  d execution flow
8c80: 20 73 74 61 74 75 73 2e 0a 0a 5b 70 61 72 61 5d   status...[para]
8c90: 0a 0a 54 4c 53 20 6b 65 79 20 6c 6f 67 67 69 6e  ..TLS key loggin
8ca0: 67 20 63 61 6e 20 62 65 20 65 6e 61 62 6c 65 64  g can be enabled
8cb0: 20 62 79 20 73 65 74 74 69 6e 67 20 74 68 65 20   by setting the 
8cc0: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69  environment vari
8cd0: 61 62 6c 65 0a 5b 76 61 72 20 53 53 4c 4b 45 59  able.[var SSLKEY
8ce0: 4c 4f 47 46 49 4c 45 5d 20 74 6f 20 74 68 65 20  LOGFILE] to the 
8cf0: 6e 61 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65  name of the file
8d00: 20 74 6f 20 6c 6f 67 20 74 6f 2e 20 54 68 65 6e   to log to. Then
8d10: 20 77 68 65 6e 65 76 65 72 20 54 4c 53 20 6b 65   whenever TLS ke
8d20: 79 0a 6d 61 74 65 72 69 61 6c 20 69 73 20 67 65  y.material is ge
8d30: 6e 65 72 61 74 65 64 20 6f 72 20 72 65 63 65 69  nerated or recei
8d40: 76 65 64 20 69 74 20 77 69 6c 6c 20 62 65 20 6c  ved it will be l
8d50: 6f 67 67 65 64 20 74 6f 20 74 68 65 20 66 69 6c  ogged to the fil
8d60: 65 2e 20 54 68 69 73 20 69 73 20 75 73 65 66 75  e. This is usefu
8d70: 6c 0a 66 6f 72 20 6c 6f 67 67 69 6e 67 20 6b 65  l.for logging ke
8d80: 79 20 64 61 74 61 20 66 6f 72 20 6e 65 74 77 6f  y data for netwo
8d90: 72 6b 20 6c 6f 67 67 69 6e 67 20 74 6f 6f 6c 73  rk logging tools
8da0: 20 74 6f 20 75 73 65 20 74 6f 20 64 65 63 72 79   to use to decry
8db0: 70 74 20 74 68 65 20 64 61 74 61 2e 0a 0a 5b 70  pt the data...[p
8dc0: 61 72 61 5d 0a 0a 54 68 65 20 5b 76 61 72 20 74  ara]..The [var t
8dd0: 6c 73 3a 3a 64 65 62 75 67 5d 20 76 61 72 69 61  ls::debug] varia
8de0: 62 6c 65 20 70 72 6f 76 69 64 65 73 20 73 6f 6d  ble provides som
8df0: 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 63 6f 6e  e additional con
8e00: 74 72 6f 6c 20 6f 76 65 72 20 74 68 65 0a 64 65  trol over the.de
8e10: 62 75 67 20 6c 6f 67 67 69 6e 67 20 69 6e 20 74  bug logging in t
8e20: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c  he [cmd tls::cal
8e30: 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73  lback], [cmd tls
8e40: 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64  ::password], and
8e50: 0a 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64  .[cmd tls::valid
8e60: 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 64 65 66  ate_command] def
8e70: 61 75 6c 74 20 68 61 6e 64 6c 65 72 73 20 69 6e  ault handlers in
8e80: 20 5b 66 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 2e   [file tls.tcl].
8e90: 0a 54 68 65 20 64 65 66 61 75 6c 74 20 76 61 6c  .The default val
8ea0: 75 65 20 69 73 20 30 20 77 69 74 68 20 68 69 67  ue is 0 with hig
8eb0: 68 65 72 20 76 61 6c 75 65 73 20 70 72 6f 64 75  her values produ
8ec0: 63 69 6e 67 20 6d 6f 72 65 20 64 69 61 67 6e 6f  cing more diagno
8ed0: 73 74 69 63 20 6f 75 74 70 75 74 2c 0a 61 6e 64  stic output,.and
8ee0: 20 77 69 6c 6c 20 61 6c 73 6f 20 66 6f 72 63 65   will also force
8ef0: 20 74 68 65 20 76 65 72 69 66 79 20 6d 65 74 68   the verify meth
8f00: 6f 64 20 69 6e 20 5b 63 6d 64 20 74 6c 73 3a 3a  od in [cmd tls::
8f10: 63 61 6c 6c 62 61 63 6b 5d 20 74 6f 20 61 63 63  callback] to acc
8f20: 65 70 74 20 74 68 65 0a 63 65 72 74 69 66 69 63  ept the.certific
8f30: 61 74 65 2c 20 65 76 65 6e 20 69 66 20 69 74 20  ate, even if it 
8f40: 69 73 20 69 6e 76 61 6c 69 64 20 77 68 65 6e 20  is invalid when 
8f50: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c  the [option -val
8f60: 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 0a 6f 70  idatecommand].op
8f70: 74 69 6f 6e 20 69 73 20 73 65 74 20 74 6f 20 5b  tion is set to [
8f80: 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74  cmd tls::validat
8f90: 65 5f 63 6f 6d 6d 61 6e 64 5d 2e 0a 0a 5b 70 61  e_command]...[pa
8fa0: 72 61 5d 0a 0a 5b 65 6d 70 68 20 22 54 68 65 20  ra]..[emph "The 
8fb0: 75 73 65 20 6f 66 20 74 68 65 20 76 61 72 69 61  use of the varia
8fc0: 62 6c 65 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65  ble [var tls::de
8fd0: 62 75 67 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f  bug] is not reco
8fe0: 6d 6d 65 6e 64 65 64 2e 0a 49 74 20 6d 61 79 20  mmended..It may 
8ff0: 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20  be removed from 
9000: 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 73 2e  future releases.
9010: 22 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 45 78  "]..[section "Ex
9020: 61 6d 70 6c 65 73 22 5d 0a 0a 54 68 65 20 66 6f  amples"]..The fo
9030: 6c 6c 6f 77 69 6e 67 20 61 72 65 20 65 78 61 6d  llowing are exam
9040: 70 6c 65 20 73 63 72 69 70 74 73 20 74 6f 20 64  ple scripts to d
9050: 6f 77 6e 6c 6f 61 64 20 61 20 77 65 62 70 61 67  ownload a webpag
9060: 65 20 61 6e 64 20 66 69 6c 65 20 75 73 69 6e 67  e and file using
9070: 20 74 68 65 0a 68 74 74 70 20 70 61 63 6b 61 67   the.http packag
9080: 65 2e 20 53 65 65 20 5b 73 65 63 74 72 65 66 20  e. See [sectref 
9090: 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c  "Certificate Val
90a0: 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 77 68  idation"] for wh
90b0: 65 6e 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d  en the.[option -
90c0: 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20  cadir], [option 
90d0: 2d 63 61 66 69 6c 65 5d 2c 20 61 6e 64 20 5b 6f  -cafile], and [o
90e0: 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20  ption -castore] 
90f0: 6f 70 74 69 6f 6e 73 20 61 72 65 20 61 6c 73 6f  options are also
9100: 0a 6e 65 65 64 65 64 2e 20 53 65 65 20 74 68 65  .needed. See the
9110: 20 5b 66 69 6c 65 20 64 65 6d 6f 73 5d 20 64 69   [file demos] di
9120: 72 65 63 74 6f 72 79 20 66 6f 72 20 6d 6f 72 65  rectory for more
9130: 20 65 78 61 6d 70 6c 65 20 73 63 72 69 70 74 73   example scripts
9140: 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 45 78 61 6d 70  ...[para]..Examp
9150: 6c 65 20 23 31 3a 20 44 6f 77 6e 6c 6f 61 64 20  le #1: Download 
9160: 61 20 77 65 62 20 70 61 67 65 0a 0a 5b 65 78 61  a web page..[exa
9170: 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20  mple {..package 
9180: 72 65 71 75 69 72 65 20 68 74 74 70 0a 70 61 63  require http.pac
9190: 6b 61 67 65 20 72 65 71 75 69 72 65 20 74 6c 73  kage require tls
91a0: 0a 0a 73 65 74 20 75 72 6c 20 22 68 74 74 70 73  ..set url "https
91b0: 3a 2f 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a  ://www.tcl.tk/".
91c0: 68 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20 68  http::register h
91d0: 74 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20 3a  ttps 443 [list :
91e0: 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75  :tls::socket -au
91f0: 74 6f 73 65 72 76 65 72 6e 61 6d 65 20 31 20 2d  toservername 1 -
9200: 72 65 71 75 69 72 65 20 31 5d 0a 0a 23 20 47 65  require 1]..# Ge
9210: 74 20 55 52 4c 0a 73 65 74 20 74 6f 6b 65 6e 20  t URL.set token 
9220: 5b 68 74 74 70 3a 3a 67 65 74 75 72 6c 20 24 75  [http::geturl $u
9230: 72 6c 5d 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72  rl]..# Check for
9240: 20 65 72 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70   error.if {[http
9250: 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d  ::status $token]
9260: 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20   ne "ok"} {.    
9270: 70 75 74 73 20 5b 66 6f 72 6d 61 74 20 22 45 72  puts [format "Er
9280: 72 6f 72 20 25 73 22 20 5b 68 74 74 70 3a 3a 73  ror %s" [http::s
9290: 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d  tatus $token]].}
92a0: 0a 0a 23 20 53 61 76 65 20 77 65 62 20 70 61 67  ..# Save web pag
92b0: 65 20 74 6f 20 66 69 6c 65 0a 73 65 74 20 63 68  e to file.set ch
92c0: 20 5b 6f 70 65 6e 20 65 78 61 6d 70 6c 65 2e 68   [open example.h
92d0: 74 6d 6c 20 77 62 5d 0a 70 75 74 73 20 24 63 68  tml wb].puts $ch
92e0: 20 5b 68 74 74 70 3a 3a 64 61 74 61 20 24 74 6f   [http::data $to
92f0: 6b 65 6e 5d 0a 63 6c 6f 73 65 20 24 63 68 0a 0a  ken].close $ch..
9300: 23 20 43 6c 65 61 6e 75 70 0a 3a 3a 68 74 74 70  # Cleanup.::http
9310: 3a 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e  ::cleanup $token
9320: 0a 7d 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 32 3a  .}]..Example #2:
9330: 20 44 6f 77 6e 6c 6f 61 64 20 61 20 66 69 6c 65   Download a file
9340: 0a 0a 5b 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61  ..[example {..pa
9350: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 68 74  ckage require ht
9360: 74 70 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69  tp.package requi
9370: 72 65 20 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20  re tls..set url 
9380: 22 68 74 74 70 73 3a 2f 2f 77 69 6b 69 2e 74 63  "https://wiki.tc
9390: 6c 2d 6c 61 6e 67 2e 6f 72 67 2f 73 69 74 65 6d  l-lang.org/sitem
93a0: 61 70 2e 78 6d 6c 22 0a 68 74 74 70 3a 3a 72 65  ap.xml".http::re
93b0: 67 69 73 74 65 72 20 68 74 74 70 73 20 34 34 33  gister https 443
93c0: 20 5b 6c 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f   [list ::tls::so
93d0: 63 6b 65 74 20 2d 61 75 74 6f 73 65 72 76 65 72  cket -autoserver
93e0: 6e 61 6d 65 20 31 20 2d 72 65 71 75 69 72 65 20  name 1 -require 
93f0: 31 5d 0a 0a 23 20 4f 70 65 6e 20 6f 75 74 70 75  1]..# Open outpu
9400: 74 20 66 69 6c 65 0a 73 65 74 20 66 69 6c 65 6e  t file.set filen
9410: 61 6d 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 24  ame [file tail $
9420: 75 72 6c 5d 0a 73 65 74 20 63 68 20 5b 6f 70 65  url].set ch [ope
9430: 6e 20 24 66 69 6c 65 6e 61 6d 65 20 77 62 5d 0a  n $filename wb].
9440: 0a 23 20 47 65 74 20 66 69 6c 65 0a 73 65 74 20  .# Get file.set 
9450: 74 6f 6b 65 6e 20 5b 3a 3a 68 74 74 70 3a 3a 67  token [::http::g
9460: 65 74 75 72 6c 20 24 75 72 6c 20 2d 62 6c 6f 63  eturl $url -bloc
9470: 6b 73 69 7a 65 20 36 35 35 33 36 20 2d 63 68 61  ksize 65536 -cha
9480: 6e 6e 65 6c 20 24 63 68 5d 0a 0a 23 20 43 68 65  nnel $ch]..# Che
9490: 63 6b 20 66 6f 72 20 65 72 72 6f 72 0a 69 66 20  ck for error.if 
94a0: 7b 5b 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24  {[http::status $
94b0: 74 6f 6b 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20  token] ne "ok"} 
94c0: 7b 0a 20 20 20 20 70 75 74 73 20 5b 66 6f 72 6d  {.    puts [form
94d0: 61 74 20 22 45 72 72 6f 72 20 25 73 22 20 5b 68  at "Error %s" [h
94e0: 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b  ttp::status $tok
94f0: 65 6e 5d 5d 0a 7d 0a 0a 23 20 43 6c 65 61 6e 75  en]].}..# Cleanu
9500: 70 0a 63 6c 6f 73 65 20 24 63 68 0a 3a 3a 68 74  p.close $ch.::ht
9510: 74 70 3a 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b  tp::cleanup $tok
9520: 65 6e 0a 7d 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20  en.}]..[section 
9530: 22 53 70 65 63 69 61 6c 20 43 6f 6e 73 69 64 65  "Special Conside
9540: 72 61 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 63  rations"]..The c
9550: 61 70 61 62 69 6c 69 74 69 65 73 20 6f 66 20 74  apabilities of t
9560: 68 69 73 20 70 61 63 6b 61 67 65 20 63 61 6e 20  his package can 
9570: 76 61 72 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20  vary enormously 
9580: 62 61 73 65 64 20 75 70 6f 6e 20 68 6f 77 20 74  based upon how t
9590: 68 65 0a 6c 69 6e 6b 65 64 20 74 6f 20 4f 70 65  he.linked to Ope
95a0: 6e 53 53 4c 20 6c 69 62 72 61 72 79 20 77 61 73  nSSL library was
95b0: 20 63 6f 6e 66 69 67 75 72 65 64 20 61 6e 64 20   configured and 
95c0: 62 75 69 6c 74 2e 20 4e 65 77 20 76 65 72 73 69  built. New versi
95d0: 6f 6e 73 20 6d 61 79 20 6f 62 73 6f 6c 65 74 65  ons may obsolete
95e0: 0a 6f 6c 64 65 72 20 70 72 6f 74 6f 63 6f 6c 20  .older protocol 
95f0: 76 65 72 73 69 6f 6e 73 2c 20 61 64 64 20 6f 72  versions, add or
9600: 20 72 65 6d 6f 76 65 20 63 69 70 68 65 72 73 2c   remove ciphers,
9610: 20 63 68 61 6e 67 65 20 64 65 66 61 75 6c 74 20   change default 
9620: 76 61 6c 75 65 73 2c 20 65 74 63 2e 0a 55 73 65  values, etc..Use
9630: 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70   the [cmd tls::p
9640: 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e  rotocols] comman
9650: 64 20 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20  d to obtain the 
9660: 73 75 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63  supported.protoc
9670: 6f 6c 20 76 65 72 73 69 6f 6e 73 2e 0a 0a 5b 73  ol versions...[s
9680: 65 63 74 69 6f 6e 20 22 45 72 72 6f 72 20 4d 65  ection "Error Me
9690: 73 73 61 67 65 73 22 5d 0a 0a 53 6f 6d 65 20 4f  ssages"]..Some O
96a0: 70 73 6e 53 53 6c 20 65 72 72 6f 72 20 6d 65 73  psnSSl error mes
96b0: 73 61 67 65 73 20 68 61 76 65 20 63 72 79 70 74  sages have crypt
96c0: 69 63 20 6d 65 61 6e 69 6e 67 73 2e 20 54 68 69  ic meanings. Thi
96d0: 73 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20 6d  s is a list of m
96e0: 65 73 73 61 67 65 73 0a 61 6c 6f 6e 67 20 77 69  essages.along wi
96f0: 74 68 20 74 68 65 69 72 20 74 72 75 65 20 6d 65  th their true me
9700: 61 6e 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f 62 65  aning...[list_be
9710: 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d  gin definitions]
9720: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 22 68 61 6e  ..[def [arg "han
9730: 64 73 68 61 6b 65 20 66 61 69 6c 65 64 3a 20 63  dshake failed: c
9740: 65 72 74 69 66 69 63 61 74 65 20 76 65 72 69 66  ertificate verif
9750: 79 20 66 61 69 6c 65 64 20 64 75 65 20 74 6f 20  y failed due to 
9760: 5c 22 75 6e 61 62 6c 65 20 74 6f 20 67 65 74 20  \"unable to get 
9770: 6c 6f 63 61 6c 20 69 73 73 75 65 72 20 63 65 72  local issuer cer
9780: 74 69 66 69 63 61 74 65 5c 22 22 5d 5d 0a 54 68  tificate\""]].Th
9790: 65 20 63 65 72 74 69 66 69 63 61 74 65 73 20 69  e certificates i
97a0: 6e 20 74 68 65 20 43 41 20 66 69 6c 65 20 6f 72  n the CA file or
97b0: 20 63 65 72 74 69 66 69 63 61 74 65 20 73 74 6f   certificate sto
97c0: 72 65 20 65 69 74 68 65 72 20 64 6f 20 6e 6f 74  re either do not
97d0: 20 68 61 76 65 20 6f 6e 65 20 6f 72 0a 6d 6f 72   have one or.mor
97e0: 65 20 69 73 73 75 65 72 73 20 6f 66 20 74 68 65  e issuers of the
97f0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 79 6f   certificates yo
9800: 75 20 61 72 65 20 76 61 6c 69 64 61 74 69 6e 67  u are validating
9810: 20 6f 72 20 74 68 65 79 20 68 61 76 65 20 65 78   or they have ex
9820: 70 69 72 65 64 2e 0a 55 73 75 61 6c 6c 79 20 74  pired..Usually t
9830: 68 69 73 20 6d 65 61 6e 73 20 79 6f 75 20 6e 65  his means you ne
9840: 65 64 20 61 6e 20 75 70 64 61 74 65 64 20 43 41  ed an updated CA
9850: 63 65 72 74 20 66 69 6c 65 2e 0a 0a 5b 64 65 66  cert file...[def
9860: 20 5b 61 72 67 20 22 70 61 63 6b 65 74 20 6c 65   [arg "packet le
9870: 6e 67 74 68 20 74 6f 6f 20 6c 6f 6e 67 22 5d 5d  ngth too long"]]
9880: 0a 43 6c 69 65 6e 74 20 68 61 73 20 74 72 69 65  .Client has trie
9890: 64 20 74 6f 20 63 6f 6e 6e 65 63 74 20 74 6f 20  d to connect to 
98a0: 61 20 48 54 54 50 20 73 65 72 76 65 72 20 6f 6e  a HTTP server on
98b0: 20 74 68 65 20 70 6c 61 69 6e 2d 74 65 78 74 20   the plain-text 
98c0: 70 6f 72 74 20 69 6e 73 74 65 61 64 20 6f 66 0a  port instead of.
98d0: 74 68 65 20 53 53 4c 2f 54 4c 53 20 70 6f 72 74  the SSL/TLS port
98e0: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 22 75 6e  ...[def [arg "un
98f0: 65 78 70 65 63 74 65 64 20 65 6f 66 20 77 68 69  expected eof whi
9900: 6c 65 20 72 65 61 64 69 6e 67 22 5d 5d 0a 54 68  le reading"]].Th
9910: 65 20 70 65 65 72 20 68 61 73 20 63 6c 6f 73 65  e peer has close
9920: 64 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  d the connection
9930: 20 77 69 74 68 6f 75 74 20 73 65 6e 64 69 6e 67   without sending
9940: 20 74 68 65 20 22 63 6c 6f 73 65 20 6e 6f 74 69   the "close noti
9950: 66 79 22 20 73 68 75 74 64 6f 77 6e 0a 61 6c 65  fy" shutdown.ale
9960: 72 74 2e 20 53 6f 6d 65 20 73 65 72 76 65 72 73  rt. Some servers
9970: 20 77 69 6c 6c 20 74 65 72 6d 69 6e 61 74 65 20   will terminate 
9980: 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61  the connection a
9990: 66 74 65 72 20 74 68 65 20 66 69 6c 65 20 6f 72  fter the file or
99a0: 20 77 65 62 70 61 67 65 20 68 61 73 0a 62 65 65   webpage has.bee
99b0: 6e 20 73 65 6e 74 20 77 69 74 68 6f 75 74 20 73  n sent without s
99c0: 65 6e 64 69 6e 67 20 74 68 65 20 22 63 6c 6f 73  ending the "clos
99d0: 65 20 6e 6f 74 69 66 79 22 20 6d 65 73 73 61 67  e notify" messag
99e0: 65 2e 20 49 6e 20 74 68 69 73 20 63 61 73 65 2c  e. In this case,
99f0: 20 69 74 20 73 68 6f 75 6c 64 0a 6e 6f 74 20 72   it should.not r
9a00: 65 73 75 6c 74 20 69 6e 20 61 20 6c 6f 73 73 20  esult in a loss 
9a10: 6f 66 20 64 61 74 61 2e 0a 0a 5b 64 65 66 20 5b  of data...[def [
9a20: 61 72 67 20 22 77 72 6f 6e 67 20 76 65 72 73 69  arg "wrong versi
9a30: 6f 6e 20 6e 75 6d 62 65 72 22 5d 5d 0a 43 6c 69  on number"]].Cli
9a40: 65 6e 74 20 68 61 73 20 74 72 69 65 64 20 74 6f  ent has tried to
9a50: 20 63 6f 6e 6e 65 63 74 20 74 6f 20 61 20 6e 6f   connect to a no
9a60: 6e 2d 48 54 54 50 20 73 65 72 76 65 72 20 6f 6e  n-HTTP server on
9a70: 20 61 20 6e 6f 6e 2d 54 4c 53 20 28 69 2e 65 2e   a non-TLS (i.e.
9a80: 20 70 6c 61 69 6e 20 74 65 78 74 29 20 70 6f 72   plain text) por
9a90: 74 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a  t...[list_end]..
9aa0: 5b 6d 61 6e 70 61 67 65 5f 65 6e 64 5d 0a        [manpage_end].