Hex Artifact Content

Artifact 5b97bc6e094dc1b3f1ef91406522c5d7e5875b9bdb82ec8ce1eff3753f12d6f8:


0000: 5b 63 6f 6d 6d 65 6e 74 20 7b 2d 2a 2d 20 74 63  [comment {-*- tc
0010: 6c 20 2d 2a 2d 20 64 6f 63 74 6f 6f 6c 73 20 6d  l -*- doctools m
0020: 61 6e 70 61 67 65 7d 5d 0a 5b 63 6f 6d 6d 65 6e  anpage}].[commen
0030: 74 20 7b 54 6f 20 63 6f 6e 76 65 72 74 20 74 68  t {To convert th
0040: 69 73 20 74 6f 20 61 6e 6f 74 68 65 72 20 64 6f  is to another do
0050: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 6d  cumentation form
0060: 61 74 20 75 73 65 20 74 68 65 20 64 74 70 6c 69  at use the dtpli
0070: 74 65 0a 20 20 20 20 20 20 20 20 20 20 73 63 72  te.          scr
0080: 69 70 74 20 66 72 6f 6d 20 74 63 6c 6c 69 62 3a  ipt from tcllib:
0090: 20 64 74 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e   dtplite -o tls.
00a0: 6e 20 6e 72 6f 66 66 20 74 6c 73 2e 6d 61 6e 0a  n nroff tls.man.
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 74                dt
00d0: 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e 68 74 6d  plite -o tls.htm
00e0: 6c 20 68 74 6d 6c 20 74 6c 73 2e 6d 61 6e 0a 7d  l html tls.man.}
00f0: 5d 0a 5b 6d 61 6e 70 61 67 65 5f 62 65 67 69 6e  ].[manpage_begin
0100: 20 74 6c 73 20 6e 20 32 2e 30 62 32 5d 0a 5b 63   tls n 2.0b2].[c
0110: 61 74 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f  ategory tls].[co
0120: 70 79 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61  pyright {1999 Ma
0130: 74 74 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70  tt Newman}].[cop
0140: 79 72 69 67 68 74 20 7b 32 30 30 34 20 53 74 61  yright {2004 Sta
0150: 72 66 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a  rfish Systems}].
0160: 5b 63 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34  [copyright {2024
0170: 20 42 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d   Brian O'Hagan}]
0180: 0a 5b 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49  .[keywords tls I
0190: 2f 4f 20 22 49 50 20 41 64 64 72 65 73 73 22 20  /O "IP Address" 
01a0: 4f 70 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20  OpenSSL SSL TCP 
01b0: 54 4c 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75  TLS "asynchronou
01c0: 73 20 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74  s I/O" bind cert
01d0: 69 66 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20  ificate channel 
01e0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61  connection "doma
01f0: 69 6e 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68  in name" host "h
0200: 74 74 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61  ttps" "network a
0210: 64 64 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20  ddress" network 
0220: 73 6f 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b  socket TclTLS].[
0230: 6d 6f 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53  moddesc {Tcl TLS
0240: 20 65 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65   extension}].[se
0250: 65 5f 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b  e_also http sock
0260: 65 74 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f  et [uri https://
0270: 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f  www.openssl.org/
0280: 20 4f 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c   OpenSSL]].[titl
0290: 65 64 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74  edesc {binding t
02a0: 6f 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69  o the OpenSSL li
02b0: 62 72 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70  brary for encryp
02c0: 74 65 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49  ted socket and I
02d0: 2f 4f 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75  /O channel commu
02e0: 6e 69 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71  nications}].[req
02f0: 75 69 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b  uire Tcl 8.5-].[
0300: 72 65 71 75 69 72 65 20 74 6c 73 20 32 2e 30 62  require tls 2.0b
0310: 32 5d 0a 5b 64 65 73 63 72 69 70 74 69 6f 6e 5d  2].[description]
0320: 0a 0a 54 68 69 73 20 65 78 74 65 6e 73 69 6f 6e  ..This extension
0330: 20 70 72 6f 76 69 64 65 73 20 54 43 4c 20 73 63   provides TCL sc
0340: 72 69 70 74 20 61 63 63 65 73 73 20 74 6f 20 53  ript access to S
0350: 65 63 75 72 65 20 53 6f 63 6b 65 74 20 4c 61 79  ecure Socket Lay
0360: 65 72 20 28 53 53 4c 29 0a 63 6f 6d 6d 75 6e 69  er (SSL).communi
0370: 63 61 74 69 6f 6e 73 20 75 73 69 6e 67 20 74 68  cations using th
0380: 65 20 54 72 61 6e 73 70 6f 72 74 20 4c 61 79 65  e Transport Laye
0390: 72 20 53 65 63 75 72 69 74 79 20 28 54 4c 53 29  r Security (TLS)
03a0: 20 70 72 6f 74 6f 63 6f 6c 2e 20 49 74 20 70 72   protocol. It pr
03b0: 6f 76 69 64 65 73 20 61 0a 67 65 6e 65 72 69 63  ovides a.generic
03c0: 20 62 69 6e 64 69 6e 67 20 74 6f 20 5b 75 72 69   binding to [uri
03d0: 20 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 6f 70   "https://www.op
03e0: 65 6e 73 73 6c 2e 6f 72 67 2f 22 20 4f 70 65 6e  enssl.org/" Open
03f0: 53 53 4c 5d 2c 20 75 74 69 6c 69 7a 69 6e 67 20  SSL], utilizing 
0400: 74 68 65 0a 5b 73 79 73 63 6d 64 20 54 63 6c 5f  the.[syscmd Tcl_
0410: 53 74 61 63 6b 43 68 61 6e 6e 65 6c 5d 20 41 50  StackChannel] AP
0420: 49 20 69 6e 20 54 43 4c 20 38 2e 34 20 6f 72 20  I in TCL 8.4 or 
0430: 6c 61 74 65 72 2e 20 54 68 65 73 65 20 73 6f 63  later. These soc
0440: 6b 65 74 73 20 62 65 68 61 76 65 20 65 78 61 63  kets behave exac
0450: 74 6c 79 0a 74 68 65 20 73 61 6d 65 20 61 73 20  tly.the same as 
0460: 63 68 61 6e 6e 65 6c 73 20 63 72 65 61 74 65 64  channels created
0470: 20 75 73 69 6e 67 20 74 68 65 20 62 75 69 6c 74   using the built
0480: 2d 69 6e 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b  -in [syscmd sock
0490: 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 62 75 74  et] command, but
04a0: 0a 70 72 6f 76 69 64 65 20 61 64 64 69 74 69 6f  .provide additio
04b0: 6e 61 6c 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20  nal options for 
04c0: 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20 74 68 65 20  controlling the 
04d0: 53 53 4c 2f 54 4c 53 20 73 65 73 73 69 6f 6e 2e  SSL/TLS session.
04e0: 0a 0a 5b 73 65 63 74 69 6f 6e 20 43 6f 6d 70 61  ..[section Compa
04f0: 74 69 62 69 6c 69 74 79 5d 0a 54 68 69 73 20 65  tibility].This e
0500: 78 74 65 6e 73 69 6f 6e 20 69 73 20 63 6f 6d 70  xtension is comp
0510: 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65 6e  atible with Open
0520: 53 53 4c 20 31 2e 31 2e 31 20 6f 72 20 6c 61 74  SSL 1.1.1 or lat
0530: 65 72 2e 20 49 74 20 72 65 71 75 69 72 65 73 20  er. It requires 
0540: 54 63 6c 0a 76 65 72 73 69 6f 6e 20 38 2e 35 20  Tcl.version 8.5 
0550: 6f 72 20 6c 61 74 65 72 20 61 6e 64 20 77 69 6c  or later and wil
0560: 6c 20 77 6f 72 6b 20 77 69 74 68 20 54 63 6c 20  l work with Tcl 
0570: 39 2e 30 2e 0a 0a 5b 73 65 63 74 69 6f 6e 20 43  9.0...[section C
0580: 6f 6d 6d 61 6e 64 73 5d 0a 0a 54 68 65 20 66 6f  ommands]..The fo
0590: 6c 6c 6f 77 69 6e 67 20 61 72 65 20 74 68 65 20  llowing are the 
05a0: 63 6f 6d 6d 61 6e 64 73 20 70 72 6f 76 69 64 65  commands provide
05b0: 64 20 62 79 20 74 68 65 20 54 63 4c 54 4c 53 20  d by the TcLTLS 
05c0: 70 61 63 6b 61 67 65 2e 20 53 65 65 0a 5b 73 65  package. See.[se
05d0: 63 74 72 65 66 20 45 78 61 6d 70 6c 65 73 5d 20  ctref Examples] 
05e0: 66 6f 72 20 65 78 61 6d 70 6c 65 20 75 73 61 67  for example usag
05f0: 65 20 61 6e 64 20 74 68 65 20 5b 66 69 6c 65 20  e and the [file 
0600: 64 65 6d 6f 73 5d 20 64 69 72 65 63 74 6f 72 79  demos] directory
0610: 20 66 6f 72 0a 6d 6f 72 65 20 65 78 61 6d 70 6c   for.more exampl
0620: 65 20 75 73 61 67 65 2e 0a 0a 5b 6c 69 73 74 5f  e usage...[list_
0630: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
0640: 73 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  s]..[call [cmd t
0650: 6c 73 3a 3a 69 6e 69 74 5d 20 5b 6f 70 74 20 5b  ls::init] [opt [
0660: 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f  arg -option]] [o
0670: 70 74 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20  pt [arg value]] 
0680: 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69  [opt [arg "-opti
0690: 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d  on value ..."]]]
06a0: 0a 0a 4f 70 74 69 6f 6e 61 6c 20 66 75 6e 63 74  ..Optional funct
06b0: 69 6f 6e 20 74 6f 20 73 65 74 20 74 68 65 20 64  ion to set the d
06c0: 65 66 61 75 6c 74 20 6f 70 74 69 6f 6e 73 20 75  efault options u
06d0: 73 65 64 20 62 79 20 5b 63 6d 64 20 74 6c 73 3a  sed by [cmd tls:
06e0: 3a 73 6f 63 6b 65 74 5d 2e 20 49 66 20 79 6f 75  :socket]. If you
06f0: 0a 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a  .call [cmd tls::
0700: 69 6d 70 6f 72 74 5d 20 64 69 72 65 63 74 6c 79  import] directly
0710: 2c 20 74 68 65 20 76 61 6c 75 65 73 20 73 65 74  , the values set
0720: 20 62 79 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64   by this command
0730: 20 68 61 76 65 20 6e 6f 20 65 66 66 65 63 74 2e   have no effect.
0740: 0a 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 73 75  .This command su
0750: 70 70 6f 72 74 73 20 61 6c 6c 20 6f 66 20 74 68  pports all of th
0760: 65 20 73 61 6d 65 20 6f 70 74 69 6f 6e 73 20 61  e same options a
0770: 73 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a  s the [cmd tls::
0780: 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c  socket] command,
0790: 0a 74 68 6f 75 67 68 20 79 6f 75 20 73 68 6f 75  .though you shou
07a0: 6c 64 20 6c 69 6d 69 74 20 79 6f 75 72 20 6f 70  ld limit your op
07b0: 74 69 6f 6e 73 20 74 6f 20 6f 6e 6c 79 20 74 68  tions to only th
07c0: 65 20 54 4c 53 20 72 65 6c 61 74 65 64 20 6f 6e  e TLS related on
07d0: 65 73 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20  es...[call [cmd 
07e0: 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 5b 6f 70  tls::socket] [op
07f0: 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d  t [arg -option]]
0800: 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75 65   [opt [arg value
0810: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f  ]] [opt [arg "-o
0820: 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22  ption value ..."
0830: 5d 5d 20 5b 61 72 67 20 68 6f 73 74 5d 20 5b 61  ]] [arg host] [a
0840: 72 67 20 70 6f 72 74 5d 5d 0a 0a 54 68 69 73 20  rg port]]..This 
0850: 69 73 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63  is a helper func
0860: 74 69 6f 6e 20 74 68 61 74 20 75 74 69 6c 69 7a  tion that utiliz
0870: 65 73 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e  es the underlyin
0880: 67 20 63 6f 6d 6d 61 6e 64 73 20 5b 73 79 73 63  g commands [sysc
0890: 6d 64 20 73 6f 63 6b 65 74 5d 0a 61 6e 64 20 5b  md socket].and [
08a0: 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d  cmd tls::import]
08b0: 20 74 6f 20 63 72 65 61 74 65 20 74 68 65 20 63   to create the c
08c0: 6f 6e 6e 65 63 74 69 6f 6e 2e 20 49 74 20 62 65  onnection. It be
08d0: 68 61 76 65 73 20 74 68 65 20 73 61 6d 65 20 61  haves the same a
08e0: 73 20 74 68 65 0a 6e 61 74 69 76 65 20 54 43 4c  s the.native TCL
08f0: 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65 74 5d   [syscmd socket]
0900: 20 63 6f 6d 6d 61 6e 64 2c 20 62 75 74 20 61 6c   command, but al
0910: 73 6f 20 73 75 70 70 6f 72 74 73 20 74 68 65 20  so supports the 
0920: 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74  [cmd tls::import
0930: 5d 0a 63 6f 6d 6d 61 6e 64 20 6f 70 74 69 6f 6e  ].command option
0940: 73 20 77 69 74 68 20 6f 6e 65 20 61 64 64 69 74  s with one addit
0950: 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 2e 20 49 74  ional option. It
0960: 20 72 65 74 75 72 6e 73 20 74 68 65 20 63 68 61   returns the cha
0970: 6e 6e 65 6c 20 68 61 6e 64 6c 65 20 69 64 0a 66  nnel handle id.f
0980: 6f 72 20 74 68 65 20 6e 65 77 20 73 6f 63 6b 65  or the new socke
0990: 74 2e 20 41 64 64 69 74 69 6f 6e 61 6c 20 6f 70  t. Additional op
09a0: 74 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b 6c 69 73  tions are:..[lis
09b0: 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d  t_begin options]
09c0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 75 74 6f  ..[opt_def -auto
09d0: 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 20  servername [arg 
09e0: 62 6f 6f 6c 5d 5d 0a 49 66 20 5b 63 6f 6e 73 74  bool]].If [const
09f0: 20 74 72 75 65 5d 2c 20 61 75 74 6f 6d 61 74 69   true], automati
0a00: 63 61 6c 6c 79 20 73 65 74 20 74 68 65 20 5b 6f  cally set the [o
0a10: 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d  ption -servernam
0a20: 65 5d 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74  e] argument to t
0a30: 68 65 0a 5b 65 6d 70 68 20 68 6f 73 74 5d 20 61  he.[emph host] a
0a40: 72 67 75 6d 65 6e 74 2e 20 50 72 69 6f 72 20 74  rgument. Prior t
0a50: 6f 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68  o TclTLS 2.0, th
0a60: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
0a70: 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 53 74 61 72  nst false]..Star
0a80: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ting in TclTLS 2
0a90: 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20  .0, the default 
0aa0: 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20  is [const true] 
0ab0: 75 6e 6c 65 73 73 20 5b 6f 70 74 69 6f 6e 20 2d  unless [option -
0ac0: 73 65 72 76 65 72 6e 61 6d 65 5d 0a 69 73 20 61  servername].is a
0ad0: 6c 73 6f 20 73 70 65 63 69 66 69 65 64 2e 0a 0a  lso specified...
0ae0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c  [list_end]..[cal
0af0: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b  l [cmd tls::sock
0b00: 65 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72  et] [option -ser
0b10: 76 65 72 5d 20 5b 61 72 67 20 63 6f 6d 6d 61 6e  ver] [arg comman
0b20: 64 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70  d] [opt [arg -op
0b30: 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67  tion]] [opt [arg
0b40: 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61   value]] [opt [a
0b50: 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75  rg "-option valu
0b60: 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 70 6f  e ..."]] [arg po
0b70: 72 74 5d 5d 0a 0a 53 61 6d 65 20 61 73 20 70 72  rt]]..Same as pr
0b80: 65 76 69 6f 75 73 20 63 6f 6d 6d 61 6e 64 2c 20  evious command, 
0b90: 62 75 74 20 69 6e 73 74 65 61 64 20 63 72 65 61  but instead crea
0ba0: 74 65 73 20 61 20 73 65 72 76 65 72 20 73 6f 63  tes a server soc
0bb0: 6b 65 74 20 66 6f 72 20 63 6c 69 65 6e 74 73 20  ket for clients 
0bc0: 74 6f 0a 63 6f 6e 6e 65 63 74 20 74 6f 20 6a 75  to.connect to ju
0bd0: 73 74 20 6c 69 6b 65 20 74 68 65 20 54 63 6c 20  st like the Tcl 
0be0: 5b 73 79 73 63 6d 64 20 22 73 6f 63 6b 65 74 20  [syscmd "socket 
0bf0: 2d 73 65 72 76 65 72 22 5d 20 63 6f 6d 6d 61 6e  -server"] comman
0c00: 64 2e 20 49 74 20 72 65 74 75 72 6e 73 20 74 68  d. It returns th
0c10: 65 0a 63 68 61 6e 6e 65 6c 20 68 61 6e 64 6c 65  e.channel handle
0c20: 20 69 64 20 66 6f 72 20 74 68 65 20 6e 65 77 20   id for the new 
0c30: 73 6f 63 6b 65 74 2e 0a 0a 5b 63 61 6c 6c 20 5b  socket...[call [
0c40: 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d  cmd tls::import]
0c50: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20 5b   [arg channel] [
0c60: 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e  opt [arg -option
0c70: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c  ]] [opt [arg val
0c80: 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22  ue]] [opt [arg "
0c90: 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e  -option value ..
0ca0: 2e 22 5d 5d 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  ."]]]..[call [cm
0cb0: 64 20 74 6c 73 3a 3a 73 74 61 72 74 74 6c 73 5d  d tls::starttls]
0cc0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20 5b   [arg channel] [
0cd0: 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e  opt [arg -option
0ce0: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c  ]] [opt [arg val
0cf0: 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22  ue]] [opt [arg "
0d00: 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e  -option value ..
0d10: 2e 22 5d 5d 5d 0a 0a 53 74 61 72 74 20 54 4c 53  ."]]]..Start TLS
0d20: 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f 6e 20 54   encryption on T
0d30: 43 4c 20 63 68 61 6e 6e 65 6c 20 5b 61 72 67 20  CL channel [arg 
0d40: 63 68 61 6e 6e 65 6c 5d 20 76 69 61 20 61 20 73  channel] via a s
0d50: 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 2e 20  tacked channel. 
0d60: 49 74 0a 6e 65 65 64 20 6e 6f 74 20 62 65 20 61  It.need not be a
0d70: 20 73 6f 63 6b 65 74 2c 20 62 75 74 20 6d 75 73   socket, but mus
0d80: 74 20 70 72 6f 76 69 64 65 20 62 69 2d 64 69 72  t provide bi-dir
0d90: 65 63 74 69 6f 6e 61 6c 20 66 6c 6f 77 2e 20 41  ectional flow. A
0da0: 6c 73 6f 20 73 65 74 73 20 73 65 73 73 69 6f 6e  lso sets session
0db0: 0a 70 61 72 61 6d 65 74 65 72 73 20 66 6f 72 20  .parameters for 
0dc0: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 56  SSL handshake. V
0dd0: 61 6c 69 64 20 6f 70 74 69 6f 6e 73 20 61 72 65  alid options are
0de0: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f  :..[list_begin o
0df0: 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65  ptions]..[opt_de
0e00: 66 20 2d 61 6c 70 6e 20 5b 61 72 67 20 6c 69 73  f -alpn [arg lis
0e10: 74 5d 5d 0a 4c 69 73 74 20 6f 66 20 70 72 6f 74  t]].List of prot
0e20: 6f 63 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20 64  ocols to offer d
0e30: 75 72 69 6e 67 20 41 70 70 6c 69 63 61 74 69 6f  uring Applicatio
0e40: 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c  n-Layer Protocol
0e50: 20 4e 65 67 6f 74 69 61 74 69 6f 6e 0a 28 41 4c   Negotiation.(AL
0e60: 50 4e 29 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65  PN). For example
0e70: 3a 20 5b 63 6f 6e 73 74 20 68 32 5d 20 61 6e 64  : [const h2] and
0e80: 20 5b 63 6f 6e 73 74 20 68 74 74 70 2f 31 2e 31   [const http/1.1
0e90: 5d 2c 20 62 75 74 20 6e 6f 74 20 5b 63 6f 6e 73  ], but not [cons
0ea0: 74 20 68 33 5d 20 6f 72 0a 5b 63 6f 6e 73 74 20  t h3] or.[const 
0eb0: 71 75 69 63 5d 2e 20 54 68 69 73 20 6f 70 74 69  quic]. This opti
0ec0: 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  on is new for Tc
0ed0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f  lTLS 1.8...[opt_
0ee0: 64 65 66 20 2d 63 61 64 69 72 20 5b 61 72 67 20  def -cadir [arg 
0ef0: 64 69 72 65 63 74 6f 72 79 5d 5d 0a 53 70 65 63  directory]].Spec
0f00: 69 66 69 65 73 20 74 68 65 20 64 69 72 65 63 74  ifies the direct
0f10: 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 43 65  ory where the Ce
0f20: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
0f30: 69 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69  ity (CA) certifi
0f40: 63 61 74 65 73 20 61 72 65 0a 73 74 6f 72 65 64  cates are.stored
0f50: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
0f60: 20 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66   platform specif
0f70: 69 63 20 61 6e 64 20 63 61 6e 20 62 65 20 73 65  ic and can be se
0f80: 74 20 61 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d  t at compile tim
0f90: 65 2e 20 54 68 65 0a 64 65 66 61 75 6c 74 20 6c  e. The.default l
0fa0: 6f 63 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 6f  ocation can be o
0fb0: 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65  verridden by the
0fc0: 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44   [var SSL_CERT_D
0fd0: 49 52 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a  IR] environment.
0fe0: 76 61 72 69 61 62 6c 65 2e 20 53 65 65 20 5b 73  variable. See [s
0ff0: 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63  ectref "Certific
1000: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d  ate Validation"]
1010: 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c   for more detail
1020: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61  s...[opt_def -ca
1030: 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61  file [arg filena
1040: 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  me]].Specifies t
1050: 68 65 20 66 69 6c 65 20 77 69 74 68 20 74 68 65  he file with the
1060: 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74   Certificate Aut
1070: 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72 74  hority (CA) cert
1080: 69 66 69 63 61 74 65 73 20 74 6f 20 75 73 65 20  ificates to use 
1090: 69 6e 0a 5b 63 6f 6e 73 74 20 50 45 4d 5d 20 66  in.[const PEM] f
10a0: 69 6c 65 20 66 6f 72 6d 61 74 2e 20 54 68 65 20  ile format. The 
10b0: 64 65 66 61 75 6c 74 20 69 73 20 5b 66 69 6c 65  default is [file
10c0: 20 63 65 72 74 2e 70 65 6d 5d 2c 20 69 6e 20 74   cert.pem], in t
10d0: 68 65 20 4f 70 65 6e 53 53 4c 0a 64 69 72 65 63  he OpenSSL.direc
10e0: 74 6f 72 79 2e 20 54 68 65 20 64 65 66 61 75 6c  tory. The defaul
10f0: 74 20 66 69 6c 65 20 63 61 6e 20 62 65 20 6f 76  t file can be ov
1100: 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 20  erridden by the 
1110: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49  [var SSL_CERT_FI
1120: 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a  LE] environment.
1130: 76 61 72 69 61 62 6c 65 2e 20 53 65 65 20 5b 73  variable. See [s
1140: 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63  ectref "Certific
1150: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d  ate Validation"]
1160: 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c   for more detail
1170: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61  s...[opt_def -ca
1180: 73 74 6f 72 65 20 5b 61 72 67 20 55 52 49 5d 5d  store [arg URI]]
1190: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 55  .Specifies the U
11a0: 6e 69 66 6f 72 6d 20 52 65 73 6f 75 72 63 65 20  niform Resource 
11b0: 49 64 65 6e 74 69 66 69 65 72 20 28 55 52 49 29  Identifier (URI)
11c0: 20 66 6f 72 20 74 68 65 20 43 65 72 74 69 66 69   for the Certifi
11d0: 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 0a 28  cate Authority.(
11e0: 43 41 29 20 73 74 6f 72 65 2c 20 77 68 69 63 68  CA) store, which
11f0: 20 6d 61 79 20 62 65 20 61 20 73 69 6e 67 6c 65   may be a single
1200: 20 63 6f 6e 74 61 69 6e 65 72 20 6f 72 20 61 20   container or a 
1210: 63 61 74 61 6c 6f 67 20 6f 66 20 63 6f 6e 74 61  catalog of conta
1220: 69 6e 65 72 73 2e 0a 53 74 61 72 74 69 6e 67 20  iners..Starting 
1230: 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 33 2e 32  with OpenSSL 3.2
1240: 20 6f 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c 20   on MS Windows, 
1250: 73 65 74 20 74 6f 20 22 5b 63 6f 6e 73 74 20 22  set to "[const "
1260: 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e 73  org.openssl.wins
1270: 74 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f 20 75 73  tore://"]".to us
1280: 65 20 74 68 65 20 62 75 69 6c 74 2d 69 6e 20 4d  e the built-in M
1290: 53 20 57 69 6e 64 6f 77 73 20 43 65 72 74 69 66  S Windows Certif
12a0: 69 63 61 74 65 20 53 74 6f 72 65 2e 0a 53 65 65  icate Store..See
12b0: 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69   [sectref "Certi
12c0: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f  ficate Validatio
12d0: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74  n"] for more det
12e0: 61 69 6c 73 2e 0a 54 68 69 73 20 6f 70 74 69 6f  ails..This optio
12f0: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  n is new for Tcl
1300: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64  TLS 1.8...[opt_d
1310: 65 66 20 2d 63 65 72 74 66 69 6c 65 20 5b 61 72  ef -certfile [ar
1320: 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65  g filename]].Spe
1330: 63 69 66 69 65 73 20 74 68 65 20 6e 61 6d 65 20  cifies the name 
1340: 6f 66 20 74 68 65 20 66 69 6c 65 20 77 69 74 68  of the file with
1350: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
1360: 20 74 6f 20 75 73 65 20 69 6e 20 50 45 4d 20 66   to use in PEM f
1370: 6f 72 6d 61 74 0a 61 73 20 74 68 65 20 6c 6f 63  ormat.as the loc
1380: 61 6c 20 28 63 6c 69 65 6e 74 20 6f 72 20 73 65  al (client or se
1390: 72 76 65 72 29 20 63 65 72 74 69 66 69 63 61 74  rver) certificat
13a0: 65 2e 20 49 74 20 61 6c 73 6f 20 63 6f 6e 74 61  e. It also conta
13b0: 69 6e 73 20 74 68 65 20 70 75 62 6c 69 63 20 6b  ins the public k
13c0: 65 79 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  ey...[opt_def -c
13d0: 65 72 74 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  ert [arg string]
13e0: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
13f0: 63 65 72 74 69 66 69 63 61 74 65 20 74 6f 20 75  certificate to u
1400: 73 65 20 61 73 20 61 20 44 45 52 20 65 6e 63 6f  se as a DER enco
1410: 64 65 64 20 73 74 72 69 6e 67 20 28 58 2e 35 30  ded string (X.50
1420: 39 20 44 45 52 29 2e 0a 0a 5b 6f 70 74 5f 64 65  9 DER)...[opt_de
1430: 66 20 2d 63 69 70 68 65 72 20 5b 61 72 67 20 73  f -cipher [arg s
1440: 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65  tring]].Specifie
1450: 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 63 69  s the list of ci
1460: 70 68 65 72 73 20 74 6f 20 75 73 65 20 66 6f 72  phers to use for
1470: 20 54 4c 53 20 31 2e 32 20 61 6e 64 20 65 61 72   TLS 1.2 and ear
1480: 6c 69 65 72 20 63 6f 6e 6e 65 63 74 69 6f 6e 73  lier connections
1490: 2e 0a 53 74 72 69 6e 67 20 69 73 20 61 20 63 6f  ..String is a co
14a0: 6c 6f 6e 20 22 5b 63 6f 6e 73 74 20 3a 5d 22 20  lon "[const :]" 
14b0: 73 65 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f  separated list o
14c0: 66 20 63 69 70 68 65 72 73 2e 0a 43 69 70 68 65  f ciphers..Ciphe
14d0: 72 73 20 63 61 6e 20 62 65 20 63 6f 6d 62 69 6e  rs can be combin
14e0: 65 64 20 75 73 69 6e 67 20 74 68 65 20 22 5b 63  ed using the "[c
14f0: 6f 6e 73 74 20 2b 5d 22 20 63 68 61 72 61 63 74  onst +]" charact
1500: 65 72 2e 0a 50 72 65 66 69 78 65 73 20 63 61 6e  er..Prefixes can
1510: 20 62 65 20 75 73 65 64 20 74 6f 20 70 65 72 6d   be used to perm
1520: 61 6e 65 6e 74 6c 79 20 72 65 6d 6f 76 65 20 22  anently remove "
1530: 5b 63 6f 6e 73 74 20 21 5d 22 2c 20 64 65 6c 65  [const !]", dele
1540: 74 65 20 22 5b 63 6f 6e 73 74 20 2d 5d 22 2c 20  te "[const -]", 
1550: 6f 72 0a 6d 6f 76 65 20 74 6f 20 74 68 65 20 65  or.move to the e
1560: 6e 64 20 22 5b 63 6f 6e 73 74 20 2b 5d 22 20 61  nd "[const +]" a
1570: 20 73 70 65 63 69 66 69 65 64 20 63 69 70 68 65   specified ciphe
1580: 72 2e 0a 4b 65 79 77 6f 72 64 73 20 5b 63 6f 6e  r..Keywords [con
1590: 73 74 20 40 53 54 52 45 4e 47 54 48 5d 20 28 73  st @STRENGTH] (s
15a0: 6f 72 74 20 62 79 20 61 6c 67 6f 72 69 74 68 6d  ort by algorithm
15b0: 20 6b 65 79 20 6c 65 6e 67 74 68 29 2c 0a 5b 63   key length),.[c
15c0: 6f 6e 73 74 20 40 53 45 43 4c 45 56 45 4c 3d 5d  onst @SECLEVEL=]
15d0: 5b 65 6d 70 68 20 6e 5d 20 28 73 65 74 20 73 65  [emph n] (set se
15e0: 63 75 72 69 74 79 20 6c 65 76 65 6c 20 74 6f 20  curity level to 
15f0: 6e 29 2c 20 61 6e 64 0a 5b 63 6f 6e 73 74 20 44  n), and.[const D
1600: 45 46 41 55 4c 54 5d 20 28 75 73 65 20 64 65 66  EFAULT] (use def
1610: 61 75 6c 74 20 63 69 70 68 65 72 20 6c 69 73 74  ault cipher list
1620: 2c 20 61 74 20 73 74 61 72 74 20 6f 6e 6c 79 29  , at start only)
1630: 20 63 61 6e 20 61 6c 73 6f 20 62 65 20 73 70 65   can also be spe
1640: 63 69 66 69 65 64 2e 0a 53 65 65 20 74 68 65 20  cified..See the 
1650: 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 64 6f  [uri "https://do
1660: 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 6d  cs.openssl.org/m
1670: 61 73 74 65 72 2f 6d 61 6e 31 2f 6f 70 65 6e 73  aster/man1/opens
1680: 73 6c 2d 63 69 70 68 65 72 73 2f 23 6f 70 74 69  sl-ciphers/#opti
1690: 6f 6e 73 22 20 4f 70 65 6e 53 53 4c 5d 0a 64 6f  ons" OpenSSL].do
16a0: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20  cumentation for 
16b0: 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 6f 66  the full list of
16c0: 20 76 61 6c 69 64 20 76 61 6c 75 65 73 2e 0a 0a   valid values...
16d0: 5b 6f 70 74 5f 64 65 66 20 2d 63 69 70 68 65 72  [opt_def -cipher
16e0: 73 75 69 74 65 73 20 5b 61 72 67 20 73 74 72 69  suites [arg stri
16f0: 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  ng]].Specifies t
1700: 68 65 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65  he list of ciphe
1710: 72 20 73 75 69 74 65 73 20 74 6f 20 75 73 65 20  r suites to use 
1720: 66 6f 72 20 54 4c 53 20 31 2e 33 20 61 73 20 61  for TLS 1.3 as a
1730: 20 63 6f 6c 6f 6e 0a 22 5b 63 6f 6e 73 74 20 3a   colon."[const :
1740: 5d 22 20 73 65 70 61 72 61 74 65 64 20 6c 69 73  ]" separated lis
1750: 74 20 6f 66 20 63 69 70 68 65 72 20 73 75 69 74  t of cipher suit
1760: 65 20 6e 61 6d 65 73 2e 20 53 65 65 20 74 68 65  e names. See the
1770: 0a 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 64  .[uri "https://d
1780: 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f  ocs.openssl.org/
1790: 6d 61 73 74 65 72 2f 6d 61 6e 31 2f 6f 70 65 6e  master/man1/open
17a0: 73 73 6c 2d 63 69 70 68 65 72 73 2f 23 6f 70 74  ssl-ciphers/#opt
17b0: 69 6f 6e 73 22 20 4f 70 65 6e 53 53 4c 5d 0a 64  ions" OpenSSL].d
17c0: 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72  ocumentation for
17d0: 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 6f   the full list o
17e0: 66 20 76 61 6c 69 64 20 76 61 6c 75 65 73 2e 0a  f valid values..
17f0: 54 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e  This option is n
1800: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
1810: 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 6f  8...[opt_def -co
1820: 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62  mmand [arg callb
1830: 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ack]].Specifies 
1840: 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d  the callback com
1850: 6d 61 6e 64 20 74 6f 20 62 65 20 69 6e 76 6f 6b  mand to be invok
1860: 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f  ed at several po
1870: 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a  ints during the.
1880: 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 70 61 73  handshake to pas
1890: 73 20 65 72 72 6f 72 73 2c 20 74 72 61 63 69 6e  s errors, tracin
18a0: 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20 61  g information, a
18b0: 6e 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 65 73 73  nd protocol mess
18c0: 61 67 65 73 2e 0a 53 65 65 20 5b 73 65 63 74 72  ages..See [sectr
18d0: 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74  ef "Callback Opt
18e0: 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20  ions"] for more 
18f0: 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  info...[opt_def 
1900: 2d 64 68 70 61 72 61 6d 73 20 5b 61 72 67 20 66  -dhparams [arg f
1910: 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66  ilename]].Specif
1920: 69 65 73 20 74 68 65 20 44 69 66 66 69 65 2d 48  ies the Diffie-H
1930: 65 6c 6c 6d 61 6e 20 28 44 48 29 20 70 61 72 61  ellman (DH) para
1940: 6d 65 74 65 72 73 20 66 69 6c 65 2e 0a 0a 5b 6f  meters file...[o
1950: 70 74 5f 64 65 66 20 2d 6b 65 79 66 69 6c 65 20  pt_def -keyfile 
1960: 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a  [arg filename]].
1970: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 70 72  Specifies the pr
1980: 69 76 61 74 65 20 6b 65 79 20 66 69 6c 65 2e 20  ivate key file. 
1990: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 74  The default is t
19a0: 6f 20 75 73 65 20 74 68 65 20 66 69 6c 65 0a 73  o use the file.s
19b0: 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20  pecified by the 
19c0: 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74 66 69 6c  [option -certfil
19d0: 65 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74  e] option...[opt
19e0: 5f 64 65 66 20 2d 6b 65 79 20 5b 61 72 67 20 73  _def -key [arg s
19f0: 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65  tring]].Specifie
1a00: 73 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65  s the private ke
1a10: 79 20 74 6f 20 75 73 65 20 61 73 20 61 20 44 45  y to use as a DE
1a20: 52 20 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67  R encoded string
1a30: 20 28 50 4b 43 53 23 31 20 44 45 52 29 2e 0a 0a   (PKCS#1 DER)...
1a40: 5b 6f 70 74 5f 64 65 66 20 2d 6d 6f 64 65 6c 20  [opt_def -model 
1a50: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 46  [arg channel]].F
1a60: 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e 6e 65  orce this channe
1a70: 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65 20 73  l to share the s
1a80: 61 6d 65 20 5b 74 65 72 6d 20 53 53 4c 5f 43 54  ame [term SSL_CT
1a90: 58 5d 20 73 74 72 75 63 74 75 72 65 20 61 73 20  X] structure as 
1aa0: 74 68 65 0a 73 70 65 63 69 66 69 65 64 20 5b 61  the.specified [a
1ab0: 72 67 20 63 68 61 6e 6e 65 6c 5d 2c 20 61 6e 64  rg channel], and
1ac0: 20 74 68 65 72 65 66 6f 72 65 20 73 68 61 72 65   therefore share
1ad0: 20 63 6f 6e 66 69 67 2c 20 63 61 6c 6c 62 61 63   config, callbac
1ae0: 6b 73 2c 20 65 74 63 2e 0a 0a 5b 6f 70 74 5f 64  ks, etc...[opt_d
1af0: 65 66 20 2d 70 61 73 73 77 6f 72 64 20 5b 61 72  ef -password [ar
1b00: 67 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65  g callback]].Spe
1b10: 63 69 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62  cifies the callb
1b20: 61 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 69  ack command to i
1b30: 6e 76 6f 6b 65 20 77 68 65 6e 20 4f 70 65 6e 53  nvoke when OpenS
1b40: 53 4c 20 6e 65 65 64 73 20 74 6f 20 6f 62 74 61  SL needs to obta
1b50: 69 6e 20 61 0a 70 61 73 73 77 6f 72 64 2e 20 54  in a.password. T
1b60: 68 69 73 20 69 73 20 74 79 70 69 63 61 6c 6c 79  his is typically
1b70: 20 75 73 65 64 20 74 6f 20 75 6e 6c 6f 63 6b 20   used to unlock 
1b80: 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20  the private key 
1b90: 6f 66 20 61 20 63 65 72 74 69 66 69 63 61 74 65  of a certificate
1ba0: 2e 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 73  ..The callback s
1bb0: 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 70  hould return a p
1bc0: 61 73 73 77 6f 72 64 20 73 74 72 69 6e 67 2e 20  assword string. 
1bd0: 54 68 69 73 20 6f 70 74 69 6f 6e 20 68 61 73 20  This option has 
1be0: 63 68 61 6e 67 65 64 20 66 6f 72 0a 54 63 6c 54  changed for.TclT
1bf0: 4c 53 20 31 2e 38 2e 20 53 65 65 20 5b 73 65 63  LS 1.8. See [sec
1c00: 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f  tref "Callback O
1c10: 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72  ptions"] for mor
1c20: 65 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65  e info...[opt_de
1c30: 66 20 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b  f -post_handshak
1c40: 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 41 6c  e [arg bool]].Al
1c50: 6c 6f 77 20 70 6f 73 74 2d 68 61 6e 64 73 68 61  low post-handsha
1c60: 6b 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65  ke session ticke
1c70: 74 20 75 70 64 61 74 65 73 2e 20 54 68 69 73 20  t updates. This 
1c80: 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f  option is new fo
1c90: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
1ca0: 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 65 73 74  opt_def -request
1cb0: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71   [arg bool]].Req
1cc0: 75 65 73 74 20 61 20 63 65 72 74 69 66 69 63 61  uest a certifica
1cd0: 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65 72  te from the peer
1ce0: 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c 20   during the SSL 
1cf0: 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 69 73 20  handshake. This 
1d00: 69 73 20 6e 65 65 64 65 64 0a 74 6f 20 64 6f 20  is needed.to do 
1d10: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
1d20: 64 61 74 69 6f 6e 2e 20 53 74 61 72 74 69 6e 67  dation. Starting
1d30: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c 20   in TclTLS 1.8, 
1d40: 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 0a 5b  the default is.[
1d50: 63 6f 6e 73 74 20 74 72 75 65 5d 20 66 6f 72 20  const true] for 
1d60: 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f  client connectio
1d70: 6e 73 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20  ns. Starting in 
1d80: 54 63 6c 54 4c 53 20 32 2e 30 2c 20 69 66 20 73  TclTLS 2.0, if s
1d90: 65 74 20 74 6f 0a 5b 63 6f 6e 73 74 20 66 61 6c  et to.[const fal
1da0: 73 65 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20  se] and [option 
1db0: 2d 72 65 71 75 69 72 65 5d 20 69 73 20 5b 63 6f  -require] is [co
1dc0: 6e 73 74 20 74 72 75 65 5d 2c 20 74 68 65 6e 20  nst true], then 
1dd0: 74 68 69 73 20 77 69 6c 6c 20 62 65 0a 6f 76 65  this will be.ove
1de0: 72 72 69 64 64 65 6e 20 74 6f 20 5b 63 6f 6e 73  rridden to [cons
1df0: 74 20 74 72 75 65 5d 2e 0a 53 65 65 20 5b 73 65  t true]..See [se
1e00: 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63 61  ctref "Certifica
1e10: 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20  te Validation"] 
1e20: 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73  for more details
1e30: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71  ...[opt_def -req
1e40: 75 69 72 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d  uire [arg bool]]
1e50: 0a 52 65 71 75 69 72 65 20 61 20 76 61 6c 69 64  .Require a valid
1e60: 20 63 65 72 74 69 66 69 63 61 74 65 20 66 72 6f   certificate fro
1e70: 6d 20 74 68 65 20 70 65 65 72 20 64 75 72 69 6e  m the peer durin
1e80: 67 20 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68  g the SSL handsh
1e90: 61 6b 65 2e 20 49 66 20 74 68 69 73 20 69 73 0a  ake. If this is.
1ea0: 73 65 74 20 74 6f 20 74 72 75 65 2c 20 74 68 65  set to true, the
1eb0: 6e 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65  n [option -reque
1ec0: 73 74 5d 20 6d 75 73 74 20 61 6c 73 6f 20 62 65  st] must also be
1ed0: 20 73 65 74 20 74 6f 20 74 72 75 65 20 61 6e 64   set to true and
1ee0: 20 61 20 65 69 74 68 65 72 0a 5b 6f 70 74 69 6f   a either.[optio
1ef0: 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69  n -cadir], [opti
1f00: 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 5b 6f 70  on -cafile], [op
1f10: 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 2c 20  tion -castore], 
1f20: 6f 72 20 61 20 70 6c 61 74 66 6f 72 6d 20 64 65  or a platform de
1f30: 66 61 75 6c 74 0a 6d 75 73 74 20 62 65 20 70 72  fault.must be pr
1f40: 6f 76 69 64 65 64 20 69 6e 20 6f 72 64 65 72 20  ovided in order 
1f50: 74 6f 20 76 61 6c 69 64 61 74 65 20 61 67 61 69  to validate agai
1f60: 6e 73 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74  nst. The default
1f70: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61   in TclTLS 1.8 a
1f80: 6e 64 0a 65 61 72 6c 69 65 72 20 76 65 72 73 69  nd.earlier versi
1f90: 6f 6e 73 20 69 73 20 5b 63 6f 6e 73 74 20 66 61  ons is [const fa
1fa0: 6c 73 65 5d 20 73 69 6e 63 65 20 6e 6f 74 20 61  lse] since not a
1fb0: 6c 6c 20 70 6c 61 74 66 6f 72 6d 73 20 68 61 76  ll platforms hav
1fc0: 65 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74  e certificates t
1fd0: 6f 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e  o.validate again
1fe0: 73 74 20 69 6e 20 61 20 66 6f 72 6d 20 63 6f 6d  st in a form com
1ff0: 70 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65  patible with Ope
2000: 6e 53 53 4c 2e 20 53 74 61 72 74 69 6e 67 20 69  nSSL. Starting i
2010: 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 0a 74 68  n TclTLS 2.0,.th
2020: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
2030: 6e 73 74 20 74 72 75 65 5d 20 66 6f 72 20 63 6c  nst true] for cl
2040: 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 73  ient connections
2050: 2e 0a 53 65 65 20 5b 73 65 63 74 72 65 66 20 22  ..See [sectref "
2060: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
2070: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72  dation"] for mor
2080: 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74  e details...[opt
2090: 5f 64 65 66 20 2d 73 65 63 75 72 69 74 79 5f 6c  _def -security_l
20a0: 65 76 65 6c 20 5b 61 72 67 20 69 6e 74 65 67 65  evel [arg intege
20b0: 72 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  r]].Specifies th
20c0: 65 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c  e security level
20d0: 20 28 76 61 6c 75 65 20 66 72 6f 6d 20 30 20 74   (value from 0 t
20e0: 6f 20 35 29 2e 20 54 68 65 20 73 65 63 75 72 69  o 5). The securi
20f0: 74 79 20 6c 65 76 65 6c 20 61 66 66 65 63 74 73  ty level affects
2100: 0a 74 68 65 20 61 6c 6c 6f 77 65 64 20 63 69 70  .the allowed cip
2110: 68 65 72 20 73 75 69 74 65 20 65 6e 63 72 79 70  her suite encryp
2120: 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 73 2c  tion algorithms,
2130: 20 73 75 70 70 6f 72 74 65 64 20 45 43 43 20 63   supported ECC c
2140: 75 72 76 65 73 2c 0a 73 75 70 70 6f 72 74 65 64  urves,.supported
2150: 20 73 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72   signature algor
2160: 69 74 68 6d 73 2c 20 44 48 20 70 61 72 61 6d 65  ithms, DH parame
2170: 74 65 72 20 73 69 7a 65 73 2c 20 63 65 72 74 69  ter sizes, certi
2180: 66 69 63 61 74 65 20 6b 65 79 20 73 69 7a 65 73  ficate key sizes
2190: 0a 61 6e 64 20 73 69 67 6e 61 74 75 72 65 20 61  .and signature a
21a0: 6c 67 6f 72 69 74 68 6d 73 2e 20 54 68 65 20 64  lgorithms. The d
21b0: 65 66 61 75 6c 74 20 69 73 20 31 20 70 72 69 6f  efault is 1 prio
21c0: 72 20 74 6f 20 4f 70 65 6e 53 53 4c 20 33 2e 32  r to OpenSSL 3.2
21d0: 20 61 6e 64 20 32 0a 74 68 65 72 65 61 66 74 65   and 2.thereafte
21e0: 72 2e 20 4c 65 76 65 6c 20 33 20 61 6e 64 20 68  r. Level 3 and h
21f0: 69 67 68 65 72 20 64 69 73 61 62 6c 65 20 73 75  igher disable su
2200: 70 70 6f 72 74 20 66 6f 72 20 73 65 73 73 69 6f  pport for sessio
2210: 6e 20 74 69 63 6b 65 74 73 20 61 6e 64 0a 6f 6e  n tickets and.on
2220: 6c 79 20 61 63 63 65 70 74 20 63 69 70 68 65 72  ly accept cipher
2230: 20 73 75 69 74 65 73 20 74 68 61 74 20 70 72 6f   suites that pro
2240: 76 69 64 65 20 66 6f 72 77 61 72 64 20 73 65 63  vide forward sec
2250: 72 65 63 79 2e 0a 54 68 69 73 20 6f 70 74 69 6f  recy..This optio
2260: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  n is new for Tcl
2270: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64  TLS 1.8...[opt_d
2280: 65 66 20 2d 73 65 72 76 65 72 20 5b 61 72 67 20  ef -server [arg 
2290: 62 6f 6f 6c 5d 5d 0a 53 70 65 63 69 66 69 65 73  bool]].Specifies
22a0: 20 77 68 65 74 68 65 72 20 74 6f 20 61 63 74 20   whether to act 
22b0: 61 73 20 61 20 73 65 72 76 65 72 20 61 6e 64 20  as a server and 
22c0: 72 65 73 70 6f 6e 64 20 77 69 74 68 20 61 20 73  respond with a s
22d0: 65 72 76 65 72 20 68 61 6e 64 73 68 61 6b 65 20  erver handshake 
22e0: 77 68 65 6e 20 61 0a 63 6c 69 65 6e 74 20 63 6f  when a.client co
22f0: 6e 6e 65 63 74 73 20 61 6e 64 20 70 72 6f 76 69  nnects and provi
2300: 64 65 73 20 61 20 63 6c 69 65 6e 74 20 68 61 6e  des a client han
2310: 64 73 68 61 6b 65 2e 20 54 68 65 20 64 65 66 61  dshake. The defa
2320: 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61  ult is [const fa
2330: 6c 73 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  lse]...[opt_def 
2340: 2d 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67  -servername [arg
2350: 20 68 6f 73 74 6e 61 6d 65 5d 5d 0a 53 70 65 63   hostname]].Spec
2360: 69 66 79 20 74 68 65 20 70 65 65 72 27 73 20 68  ify the peer's h
2370: 6f 73 74 6e 61 6d 65 2e 20 54 68 69 73 20 69 73  ostname. This is
2380: 20 75 73 65 64 20 74 6f 20 73 65 74 20 74 68 65   used to set the
2390: 20 54 4c 53 20 53 65 72 76 65 72 20 4e 61 6d 65   TLS Server Name
23a0: 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53 4e 49   Indication.(SNI
23b0: 29 20 65 78 74 65 6e 73 69 6f 6e 2e 20 53 65 74  ) extension. Set
23c0: 20 74 68 69 73 20 74 6f 20 74 68 65 20 65 78 70   this to the exp
23d0: 65 63 74 65 64 20 73 65 72 76 65 72 6e 61 6d 65  ected servername
23e0: 20 69 6e 20 74 68 65 20 73 65 72 76 65 72 27 73   in the server's
23f0: 20 63 65 72 74 69 66 69 63 61 74 65 0a 6f 72 20   certificate.or 
2400: 6f 6e 65 20 6f 66 20 74 68 65 20 53 75 62 6a 65  one of the Subje
2410: 63 74 20 41 6c 74 65 72 6e 61 74 65 20 4e 61 6d  ct Alternate Nam
2420: 65 73 20 28 53 41 4e 29 2e 20 53 74 61 72 74 69  es (SAN). Starti
2430: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30  ng in TclTLS 2.0
2440: 2c 20 74 68 69 73 20 77 69 6c 6c 0a 64 65 66 61  , this will.defa
2450: 75 6c 74 20 74 6f 20 74 68 65 20 68 6f 73 74 20  ult to the host 
2460: 66 72 6f 6d 20 74 68 65 20 5b 63 6d 64 20 74 6c  from the [cmd tl
2470: 73 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61  s::socket] comma
2480: 6e 64 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73  nd...[opt_def -s
2490: 65 73 73 69 6f 6e 5f 69 64 20 5b 61 72 67 20 62  ession_id [arg b
24a0: 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 5d 0a 53  inary_string]].S
24b0: 70 65 63 69 66 69 65 73 20 74 68 65 20 73 65 73  pecifies the ses
24c0: 73 69 6f 6e 20 69 64 20 74 6f 20 72 65 73 75 6d  sion id to resum
24d0: 65 20 61 20 73 65 73 73 69 6f 6e 2e 20 4e 6f 74  e a session. Not
24e0: 20 73 75 70 70 6f 72 74 65 64 20 79 65 74 2e 0a   supported yet..
24f0: 54 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e  This option is n
2500: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
2510: 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73  8...[opt_def -ss
2520: 6c 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45  l2 [arg bool]].E
2530: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c  nable use of SSL
2540: 20 76 32 2e 54 68 65 20 64 65 66 61 75 6c 74 20   v2.The default 
2550: 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d  is [const false]
2560: 2e 0a 4f 70 65 6e 53 53 4c 20 31 2e 31 2b 20 6e  ..OpenSSL 1.1+ n
2570: 6f 20 6c 6f 6e 67 65 72 20 73 75 70 70 6f 72 74  o longer support
2580: 73 20 53 53 4c 20 76 32 2c 20 73 6f 20 74 68 69  s SSL v2, so thi
2590: 73 20 6d 61 79 20 6e 6f 74 20 68 61 76 65 20 61  s may not have a
25a0: 6e 79 20 65 66 66 65 63 74 2e 0a 53 65 65 20 74  ny effect..See t
25b0: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f  he [cmd tls::pro
25c0: 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20  tocols] command 
25d0: 66 6f 72 20 73 75 70 70 6f 72 74 65 64 20 70 72  for supported pr
25e0: 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f 64  otocols...[opt_d
25f0: 65 66 20 2d 73 73 6c 33 20 5b 61 72 67 20 62 6f  ef -ssl3 [arg bo
2600: 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20  ol]].Enable use 
2610: 6f 66 20 53 53 4c 20 76 33 2e 20 54 68 65 20 64  of SSL v3. The d
2620: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74  efault is [const
2630: 20 66 61 6c 73 65 5d 2e 20 53 74 61 72 74 69 6e   false]. Startin
2640: 67 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c  g in TclTLS 1.8,
2650: 0a 75 73 65 20 6f 66 20 53 53 4c 20 76 33 20 69  .use of SSL v3 i
2660: 66 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65  f only available
2670: 20 76 69 61 20 61 20 63 6f 6d 70 69 6c 65 20 74   via a compile t
2680: 69 6d 65 20 6f 70 74 69 6f 6e 2e 0a 53 65 65 20  ime option..See 
2690: 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72  the [cmd tls::pr
26a0: 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64  otocols] command
26b0: 20 66 6f 72 20 73 75 70 70 6f 72 74 65 64 20 70   for supported p
26c0: 72 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f  rotocols...[opt_
26d0: 64 65 66 20 2d 74 6c 73 31 20 5b 61 72 67 20 62  def -tls1 [arg b
26e0: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
26f0: 20 6f 66 20 54 4c 53 20 76 31 2e 20 53 74 61 72   of TLS v1. Star
2700: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ting in TclTLS 2
2710: 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20  .0, the default 
2720: 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d  is [const false]
2730: 2e 0a 4e 6f 74 65 3a 20 54 4c 53 20 31 2e 30 20  ..Note: TLS 1.0 
2740: 6e 65 65 64 73 20 53 48 41 31 20 74 6f 20 6f 70  needs SHA1 to op
2750: 65 72 61 74 65 2c 20 77 68 69 63 68 20 69 73 20  erate, which is 
2760: 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 69  only available i
2770: 6e 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c  n security level
2780: 0a 30 20 66 6f 72 20 4f 70 65 6e 20 53 53 4c 20  .0 for Open SSL 
2790: 33 2e 30 2b 2e 20 53 65 65 20 74 68 65 20 5b 6f  3.0+. See the [o
27a0: 70 74 69 6f 6e 20 2d 73 65 63 75 72 69 74 79 5f  ption -security_
27b0: 6c 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e 0a 0a  level] option...
27c0: 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 2e 31  [opt_def -tls1.1
27d0: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61   [arg bool]].Ena
27e0: 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76  ble use of TLS v
27f0: 31 2e 31 2e 20 53 74 61 72 74 69 6e 67 20 69 6e  1.1. Starting in
2800: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65   TclTLS 2.0, the
2810: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
2820: 73 74 20 66 61 6c 73 65 5d 2e 0a 4e 6f 74 65 3a  st false]..Note:
2830: 20 54 4c 53 20 31 2e 31 20 6e 65 65 64 73 20 53   TLS 1.1 needs S
2840: 48 41 31 20 74 6f 20 6f 70 65 72 61 74 65 2c 20  HA1 to operate, 
2850: 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 61 76  which is only av
2860: 61 69 6c 61 62 6c 65 20 69 6e 20 73 65 63 75 72  ailable in secur
2870: 69 74 79 20 6c 65 76 65 6c 0a 30 20 66 6f 72 20  ity level.0 for 
2880: 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 20 53  Open SSL 3.0+. S
2890: 65 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  ee the [option -
28a0: 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20  security_level] 
28b0: 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65  option...[opt_de
28c0: 66 20 2d 74 6c 73 31 2e 32 20 5b 61 72 67 20 62  f -tls1.2 [arg b
28d0: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
28e0: 20 6f 66 20 54 4c 53 20 76 31 2e 32 2e 20 54 68   of TLS v1.2. Th
28f0: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
2900: 6e 73 74 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74  nst true]...[opt
2910: 5f 64 65 66 20 2d 74 6c 73 31 2e 33 20 5b 61 72  _def -tls1.3 [ar
2920: 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20  g bool]].Enable 
2930: 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 33 2e  use of TLS v1.3.
2940: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
2950: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 54 68  [const true]. Th
2960: 69 73 20 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c  is is only avail
2970: 61 62 6c 65 0a 73 74 61 72 74 69 6e 67 20 77 69  able.starting wi
2980: 74 68 20 4f 70 65 6e 53 53 4c 20 31 2e 31 2e 31  th OpenSSL 1.1.1
2990: 20 61 6e 64 20 54 63 6c 54 4c 53 20 31 2e 37 2e   and TclTLS 1.7.
29a0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 76 61 6c 69  ..[opt_def -vali
29b0: 64 61 74 65 63 6f 6d 6d 61 6e 64 20 5b 61 72 67  datecommand [arg
29c0: 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63   callback]].Spec
29d0: 69 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62 61  ifies the callba
29e0: 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e  ck command to in
29f0: 76 6f 6b 65 20 74 6f 20 76 61 6c 69 64 61 74 65  voke to validate
2a00: 20 74 68 65 20 70 65 65 72 20 63 65 72 74 69 66   the peer certif
2a10: 69 63 61 74 65 73 0a 61 6e 64 20 6f 74 68 65 72  icates.and other
2a20: 20 63 6f 6e 66 69 67 20 69 6e 66 6f 20 64 75 72   config info dur
2a30: 69 6e 67 20 74 68 65 20 70 72 6f 74 6f 63 6f 6c  ing the protocol
2a40: 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20 70 68 61   negotiation pha
2a50: 73 65 2e 20 54 68 69 73 20 63 61 6e 20 62 65 20  se. This can be 
2a60: 75 73 65 64 0a 62 79 20 54 43 4c 20 73 63 72 69  used.by TCL scri
2a70: 70 74 73 20 74 6f 20 70 65 72 66 6f 72 6d 20 74  pts to perform t
2a80: 68 65 69 72 20 6f 77 6e 20 43 65 72 74 69 66 69  heir own Certifi
2a90: 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 20  cate Validation 
2aa0: 74 6f 20 73 75 70 70 6c 65 6d 65 6e 74 20 74 68  to supplement th
2ab0: 65 0a 64 65 66 61 75 6c 74 20 76 61 6c 69 64 61  e.default valida
2ac0: 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79  tion provided by
2ad0: 20 4f 70 65 6e 53 53 4c 2e 20 54 68 65 20 73 63   OpenSSL. The sc
2ae0: 72 69 70 74 20 6d 75 73 74 20 72 65 74 75 72 6e  ript must return
2af0: 20 61 20 62 6f 6f 6c 65 61 6e 20 74 72 75 65 0a   a boolean true.
2b00: 74 6f 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20  to continue the 
2b10: 6e 65 67 6f 74 69 61 74 69 6f 6e 2e 20 53 65 65  negotiation. See
2b20: 20 5b 73 65 63 74 72 65 66 20 22 43 61 6c 6c 62   [sectref "Callb
2b30: 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d 20 66 6f  ack Options"] fo
2b40: 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 0a 54 68 69  r more info..Thi
2b50: 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77 20  s option is new 
2b60: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
2b70: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61  .[list_end]..[ca
2b80: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 68 61 6e  ll [cmd tls::han
2b90: 64 73 68 61 6b 65 5d 20 5b 61 72 67 20 63 68 61  dshake] [arg cha
2ba0: 6e 6e 65 6c 5d 5d 0a 0a 46 6f 72 63 65 73 20 74  nnel]]..Forces t
2bb0: 68 65 20 54 4c 53 20 6e 65 67 6f 74 69 61 74 69  he TLS negotiati
2bc0: 6f 6e 20 68 61 6e 64 73 68 61 6b 65 20 74 6f 20  on handshake to 
2bd0: 74 61 6b 65 20 70 6c 61 63 65 20 69 6d 6d 65 64  take place immed
2be0: 69 61 74 65 6c 79 2c 20 61 6e 64 20 72 65 74 75  iately, and retu
2bf0: 72 6e 73 20 30 0a 69 66 20 68 61 6e 64 73 68 61  rns 0.if handsha
2c00: 6b 65 20 69 73 20 73 74 69 6c 6c 20 69 6e 20 70  ke is still in p
2c10: 72 6f 67 72 65 73 73 20 28 6e 6f 6e 2d 62 6c 6f  rogress (non-blo
2c20: 63 6b 69 6e 67 29 2c 20 6f 72 20 31 20 69 66 20  cking), or 1 if 
2c30: 74 68 65 20 68 61 6e 64 73 68 61 6b 65 20 77 61  the handshake wa
2c40: 73 0a 73 75 63 63 65 73 73 66 75 6c 2e 20 49 66  s.successful. If
2c50: 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65 20 66   the handshake f
2c60: 61 69 6c 65 64 2c 20 61 6e 20 65 72 72 6f 72 20  ailed, an error 
2c70: 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e 65 64  will be returned
2c80: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ...[call [cmd tl
2c90: 73 3a 3a 73 68 75 74 64 6f 77 6e 5d 20 5b 61 72  s::shutdown] [ar
2ca0: 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 5b 63 61  g channel]]..[ca
2cb0: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 75 6e 69  ll [cmd tls::uni
2cc0: 6d 70 6f 72 74 5d 20 5b 61 72 67 20 63 68 61 6e  mport] [arg chan
2cd0: 6e 65 6c 5d 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  nel]]..[call [cm
2ce0: 64 20 74 6c 73 3a 3a 75 6e 73 74 61 63 6b 5d 20  d tls::unstack] 
2cf0: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a  [arg channel]]..
2d00: 54 68 69 73 20 74 65 72 6d 69 6e 61 74 65 73 20  This terminates 
2d10: 74 68 65 20 53 53 4c 2f 54 4c 53 20 73 65 73 73  the SSL/TLS sess
2d20: 69 6f 6e 20 62 79 20 73 65 6e 64 69 6e 67 20 74  ion by sending t
2d30: 68 65 20 22 63 6c 6f 73 65 5f 6e 6f 74 69 66 79  he "close_notify
2d40: 22 20 6d 65 73 73 61 67 65 20 61 6e 64 0a 72 65  " message and.re
2d50: 6d 6f 76 65 73 20 74 68 65 20 74 6f 70 20 6c 65  moves the top le
2d60: 76 65 6c 20 73 74 61 63 6b 65 64 20 63 68 61 6e  vel stacked chan
2d70: 6e 65 6c 20 66 72 6f 6d 20 5b 61 72 67 20 63 68  nel from [arg ch
2d80: 61 6e 6e 65 6c 5d 2c 20 62 75 74 20 69 74 20 64  annel], but it d
2d90: 6f 65 73 20 6e 6f 74 20 63 6c 6f 73 65 0a 74 68  oes not close.th
2da0: 65 20 73 6f 63 6b 65 74 2e 20 49 74 20 69 73 20  e socket. It is 
2db0: 74 68 65 20 63 6f 6d 70 6c 69 6d 65 6e 74 20 74  the compliment t
2dc0: 6f 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f  o [cmd tls::impo
2dd0: 72 74 5d 20 62 79 20 65 6e 64 69 6e 67 20 65 6e  rt] by ending en
2de0: 63 72 79 70 74 69 6f 6e 20 6f 66 0a 61 20 54 43  cryption of.a TC
2df0: 4c 20 63 68 61 6e 6e 65 6c 2e 20 41 6e 20 65 72  L channel. An er
2e00: 72 6f 72 20 69 73 20 74 68 72 6f 77 6e 20 69 66  ror is thrown if
2e10: 20 54 4c 53 20 69 73 20 6e 6f 74 20 74 68 65 20   TLS is not the 
2e20: 74 6f 70 20 73 74 61 63 6b 65 64 20 63 68 61 6e  top stacked chan
2e30: 6e 65 6c 20 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c  nel type...[call
2e40: 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 74 61 74 75   [cmd tls::statu
2e50: 73 5d 20 5b 6f 70 74 20 5b 6f 70 74 69 6f 6e 20  s] [opt [option 
2e60: 2d 6c 6f 63 61 6c 5d 5d 20 5b 61 72 67 20 63 68  -local]] [arg ch
2e70: 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72 6e 73  annel]]..Returns
2e80: 20 74 68 65 20 63 75 72 72 65 6e 74 20 73 74 61   the current sta
2e90: 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20 63 68  tus of an SSL ch
2ea0: 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73 75 6c  annel. The resul
2eb0: 74 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20 6b  t is a list of k
2ec0: 65 79 2d 76 61 6c 75 65 0a 70 61 69 72 73 20 64  ey-value.pairs d
2ed0: 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 53 53  escribing the SS
2ee0: 4c 2c 20 63 65 72 74 69 66 69 63 61 74 65 2c 20  L, certificate, 
2ef0: 61 6e 64 20 63 65 72 74 69 66 69 63 61 74 65 20  and certificate 
2f00: 76 65 72 69 66 69 63 61 74 69 6f 6e 20 73 74 61  verification sta
2f10: 74 75 73 2e 20 49 66 0a 74 68 65 20 53 53 4c 20  tus. If.the SSL 
2f20: 68 61 6e 64 73 68 61 6b 65 20 68 61 73 20 6e 6f  handshake has no
2f30: 74 20 79 65 74 20 63 6f 6d 70 6c 65 74 65 64 2c  t yet completed,
2f40: 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 74 20 69   an empty list i
2f50: 73 20 72 65 74 75 72 6e 65 64 2e 20 49 66 20 74  s returned. If t
2f60: 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6c 6f 63 61  he.[option -loca
2f70: 6c 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73 70 65  l] option is spe
2f80: 63 69 66 69 65 64 2c 20 74 68 65 6e 20 74 68 65  cified, then the
2f90: 20 6c 6f 63 61 6c 20 63 65 72 74 69 66 69 63 61   local certifica
2fa0: 74 65 20 69 73 20 75 73 65 64 2e 0a 52 65 74 75  te is used..Retu
2fb0: 72 6e 65 64 20 76 61 6c 75 65 73 20 69 6e 63 6c  rned values incl
2fc0: 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a 53 53  ude:..[para]..SS
2fd0: 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f  L Status..[list_
2fe0: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
2ff0: 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  s]..[def "[var a
3000: 6c 70 6e 5d 20 5b 61 72 67 20 70 72 6f 74 6f 63  lpn] [arg protoc
3010: 6f 6c 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63  ol]"].The protoc
3020: 6f 6c 20 73 65 6c 65 63 74 65 64 20 61 66 74 65  ol selected afte
3030: 72 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61  r Application-La
3040: 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67  yer Protocol Neg
3050: 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29 2e  otiation (ALPN).
3060: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3070: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3080: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  8...[def "[var c
3090: 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69 70 68  ipher] [arg ciph
30a0: 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72 65 6e  er]"].The curren
30b0: 74 20 63 69 70 68 65 72 20 69 6e 20 75 73 65 20  t cipher in use 
30c0: 66 6f 72 20 74 68 65 20 73 65 73 73 69 6f 6e 2e  for the session.
30d0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 65 65  ..[def "[var pee
30e0: 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65  rname] [arg name
30f0: 5d 22 5d 0a 54 68 65 20 70 65 65 72 6e 61 6d 65  ]"].The peername
3100: 20 66 72 6f 6d 20 74 68 65 20 63 65 72 74 69 66   from the certif
3110: 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75  icate..This valu
3120: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3130: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3140: 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b  [var protocol] [
3150: 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54  arg version]"].T
3160: 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73  he protocol vers
3170: 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 68 65  ion used for the
3180: 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c   connection: SSL
3190: 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54  2, SSL3, TLS1, T
31a0: 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 0a 54  LS1.1, TLS1.2,.T
31b0: 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77  LS1.3, or unknow
31c0: 6e 2e 20 54 68 69 73 20 76 61 6c 75 65 20 69 73  n. This value is
31d0: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
31e0: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
31f0: 20 73 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22   sbits] [arg n]"
3200: 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20  ].The number of 
3210: 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 74 68  bits used for th
3220: 65 20 73 65 73 73 69 6f 6e 20 6b 65 79 2e 0a 0a  e session key...
3230: 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61  [def "[var signa
3240: 74 75 72 65 48 61 73 68 41 6c 67 6f 72 69 74 68  tureHashAlgorith
3250: 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68  m] [arg algorith
3260: 6d 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61 74 75  m]"].The signatu
3270: 72 65 20 68 61 73 68 20 61 6c 67 6f 72 69 74 68  re hash algorith
3280: 6d 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  m..This value is
3290: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
32a0: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
32b0: 20 73 69 67 6e 61 74 75 72 65 54 79 70 65 5d 20   signatureType] 
32c0: 5b 61 72 67 20 74 79 70 65 5d 22 5d 0a 54 68 65  [arg type]"].The
32d0: 20 73 69 67 6e 61 74 75 72 65 20 74 79 70 65 20   signature type 
32e0: 76 61 6c 75 65 2e 0a 54 68 69 73 20 76 61 6c 75  value..This valu
32f0: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3300: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3310: 5b 76 61 72 20 76 65 72 69 66 79 44 65 70 74 68  [var verifyDepth
3320: 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4d 61 78 69  ] [arg n]"].Maxi
3330: 6d 75 6d 20 64 65 70 74 68 20 66 6f 72 20 74 68  mum depth for th
3340: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 63 68  e certificate ch
3350: 61 69 6e 20 76 65 72 69 66 69 63 61 74 69 6f 6e  ain verification
3360: 2e 20 44 65 66 61 75 6c 74 20 69 73 20 2d 31 2c  . Default is -1,
3370: 20 74 6f 20 63 68 65 63 6b 20 61 6c 6c 2e 0a 54   to check all..T
3380: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3390: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
33a0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72  ..[def "[var ver
33b0: 69 66 79 4d 6f 64 65 5d 20 5b 61 72 67 20 6c 69  ifyMode] [arg li
33c0: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 63 65  st]"].List of ce
33d0: 72 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69  rtificate verifi
33e0: 63 61 74 69 6f 6e 20 6d 6f 64 65 73 2e 0a 54 68  cation modes..Th
33f0: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
3400: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
3410: 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72 69  .[def "[var veri
3420: 66 79 52 65 73 75 6c 74 5d 20 5b 61 72 67 20 72  fyResult] [arg r
3430: 65 73 75 6c 74 5d 22 5d 0a 43 65 72 74 69 66 69  esult]"].Certifi
3440: 63 61 74 65 20 76 65 72 69 66 69 63 61 74 69 6f  cate verificatio
3450: 6e 20 72 65 73 75 6c 74 2e 0a 54 68 69 73 20 76  n result..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 63 61 5f 6e 61 6d 65 73  f "[var ca_names
3490: 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c  ] [arg list]"].L
34a0: 69 73 74 20 6f 66 20 74 68 65 20 43 65 72 74 69  ist of the Certi
34b0: 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 69  ficate Authoriti
34c0: 65 73 20 75 73 65 64 20 74 6f 20 63 72 65 61 74  es used to creat
34d0: 65 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  e the certificat
34e0: 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  e..This value is
34f0: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
3500: 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  1.8...[list_end]
3510: 0a 0a 43 65 72 74 69 66 69 63 61 74 65 20 53 74  ..Certificate St
3520: 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  atus..[list_begi
3530: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a  n definitions]..
3540: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 6c 5d 20  [def "[var all] 
3550: 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 44  [arg string]"].D
3560: 75 6d 70 20 6f 66 20 61 6c 6c 20 63 65 72 74 69  ump of all certi
3570: 66 69 63 61 74 65 20 69 6e 66 6f 2e 0a 54 68 69  ficate info..Thi
3580: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3590: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
35a0: 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72 73 69  [def "[var versi
35b0: 6f 6e 5d 20 5b 61 72 67 20 76 61 6c 75 65 5d 22  on] [arg value]"
35c0: 5d 0a 54 68 65 20 63 65 72 74 69 66 69 63 61 74  ].The certificat
35d0: 65 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66  e version...[def
35e0: 20 22 5b 76 61 72 20 73 65 72 69 61 6c 4e 75 6d   "[var serialNum
35f0: 62 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  ber] [arg string
3600: 5d 22 5d 0a 54 68 65 20 73 65 72 69 61 6c 20 6e  ]"].The serial n
3610: 75 6d 62 65 72 20 6f 66 20 74 68 65 20 63 65 72  umber of the cer
3620: 74 69 66 69 63 61 74 65 20 61 73 20 61 20 68 65  tificate as a he
3630: 78 20 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76  x string..This v
3640: 61 6c 75 65 20 77 61 73 20 63 68 61 6e 67 65 64  alue was changed
3650: 20 66 72 6f 6d 20 73 65 72 69 61 6c 20 69 6e 20   from serial in 
3660: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65  TclTLS 1.8...[de
3670: 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72  f "[var signatur
3680: 65 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68  e] [arg algorith
3690: 6d 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c 67 6f  m]"].Cipher algo
36a0: 72 69 74 68 6d 20 75 73 65 64 20 66 6f 72 20 63  rithm used for c
36b0: 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61  ertificate signa
36c0: 74 75 72 65 2e 0a 54 68 69 73 20 76 61 6c 75 65  ture..This value
36d0: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
36e0: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
36f0: 76 61 72 20 69 73 73 75 65 72 5d 20 5b 61 72 67  var issuer] [arg
3700: 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20 64   string]"].The d
3710: 69 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d  istinguished nam
3720: 65 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65  e (DN) of the ce
3730: 72 74 69 66 69 63 61 74 65 20 69 73 73 75 65 72  rtificate issuer
3740: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6e 6f  ...[def "[var no
3750: 74 42 65 66 6f 72 65 5d 20 5b 61 72 67 20 64 61  tBefore] [arg da
3760: 74 65 5d 22 5d 0a 54 68 65 20 62 65 67 69 6e 6e  te]"].The beginn
3770: 69 6e 67 20 64 61 74 65 20 6f 66 20 74 68 65 20  ing date of the 
3780: 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c 69  certificate vali
3790: 64 69 74 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  dity...[def "[va
37a0: 72 20 6e 6f 74 41 66 74 65 72 5d 20 5b 61 72 67  r notAfter] [arg
37b0: 20 64 61 74 65 5d 22 5d 0a 54 68 65 20 65 78 70   date]"].The exp
37c0: 69 72 61 74 69 6f 6e 20 64 61 74 65 20 6f 66 20  iration date of 
37d0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
37e0: 76 61 6c 69 64 69 74 79 2e 0a 0a 5b 64 65 66 20  validity...[def 
37f0: 22 5b 76 61 72 20 73 75 62 6a 65 63 74 5d 20 5b  "[var subject] [
3800: 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68  arg string]"].Th
3810: 65 20 64 69 73 74 69 6e 67 75 69 73 68 65 64 20  e distinguished 
3820: 6e 61 6d 65 20 28 44 4e 29 20 6f 66 20 74 68 65  name (DN) of the
3830: 20 63 65 72 74 69 66 69 63 61 74 65 20 73 75 62   certificate sub
3840: 6a 65 63 74 2e 20 46 69 65 6c 64 73 20 69 6e 63  ject. Fields inc
3850: 6c 75 64 65 3a 20 43 6f 6d 6d 6f 6e 0a 4e 61 6d  lude: Common.Nam
3860: 65 20 28 43 4e 29 2c 20 4f 72 67 61 6e 69 7a 61  e (CN), Organiza
3870: 74 69 6f 6e 20 28 4f 29 2c 20 4c 6f 63 61 6c 69  tion (O), Locali
3880: 74 79 20 6f 72 20 43 69 74 79 20 28 4c 29 2c 20  ty or City (L), 
3890: 53 74 61 74 65 20 6f 72 20 50 72 6f 76 69 6e 63  State or Provinc
38a0: 65 20 28 53 29 2c 20 61 6e 64 0a 43 6f 75 6e 74  e (S), and.Count
38b0: 72 79 20 4e 61 6d 65 20 28 43 29 2e 0a 0a 5b 64  ry Name (C)...[d
38c0: 65 66 20 22 5b 76 61 72 20 69 73 73 75 65 72 55  ef "[var issuerU
38d0: 6e 69 71 75 65 49 44 5d 20 5b 61 72 67 20 73 74  niqueID] [arg st
38e0: 72 69 6e 67 5d 22 5d 0a 54 68 65 20 69 73 73 75  ring]"].The issu
38f0: 65 72 20 75 6e 69 71 75 65 20 69 64 2e 0a 54 68  er unique id..Th
3900: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
3910: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
3920: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 75 62 6a  .[def "[var subj
3930: 65 63 74 55 6e 69 71 75 65 49 44 5d 20 5b 61 72  ectUniqueID] [ar
3940: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20  g string]"].The 
3950: 73 75 62 6a 65 63 74 20 75 6e 69 71 75 65 20 69  subject unique i
3960: 64 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  d..This value is
3970: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
3980: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
3990: 20 6e 75 6d 5f 65 78 74 65 6e 73 69 6f 6e 73 5d   num_extensions]
39a0: 20 5b 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65   [arg n]"].Numbe
39b0: 72 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65  r of certificate
39c0: 20 65 78 74 65 6e 73 69 6f 6e 73 2e 0a 54 68 69   extensions..Thi
39d0: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
39e0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
39f0: 5b 64 65 66 20 22 5b 76 61 72 20 65 78 74 65 6e  [def "[var exten
3a00: 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6c 69 73 74  sions] [arg list
3a10: 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 63 65 72 74  ]"].List of cert
3a20: 69 66 69 63 61 74 65 20 65 78 74 65 6e 73 69 6f  ificate extensio
3a30: 6e 20 6e 61 6d 65 73 2e 0a 54 68 69 73 20 76 61  n names..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 61 75 74 68 6f 72 69 74 79   "[var authority
3a70: 4b 65 79 49 64 65 6e 74 69 66 69 65 72 5d 20 5b  KeyIdentifier] [
3a80: 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 41 75  arg string]"].Au
3a90: 74 68 6f 72 69 74 79 20 4b 65 79 20 49 64 65 6e  thority Key Iden
3aa0: 74 69 66 69 65 72 20 28 41 4b 49 29 20 6f 66 20  tifier (AKI) of 
3ab0: 74 68 65 20 49 73 73 75 69 6e 67 20 43 41 20 63  the Issuing CA c
3ac0: 65 72 74 69 66 69 63 61 74 65 20 74 68 61 74 20  ertificate that 
3ad0: 73 69 67 6e 65 64 20 74 68 65 0a 53 53 4c 20 63  signed the.SSL c
3ae0: 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61 20  ertificate as a 
3af0: 68 65 78 20 73 74 72 69 6e 67 2e 20 54 68 69 73  hex string. This
3b00: 20 76 61 6c 75 65 20 6d 61 74 63 68 65 73 20 74   value matches t
3b10: 68 65 20 53 4b 49 20 76 61 6c 75 65 20 6f 66 20  he SKI value of 
3b20: 74 68 65 0a 49 6e 74 65 72 6d 65 64 69 61 74 65  the.Intermediate
3b30: 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65 2e   CA certificate.
3b40: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3b50: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3b60: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  8...[def "[var s
3b70: 75 62 6a 65 63 74 4b 65 79 49 64 65 6e 74 69 66  ubjectKeyIdentif
3b80: 69 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  ier] [arg string
3b90: 5d 22 5d 0a 53 75 62 6a 65 63 74 20 4b 65 79 20  ]"].Subject Key 
3ba0: 49 64 65 6e 74 69 66 69 65 72 20 28 53 4b 49 29  Identifier (SKI)
3bb0: 20 68 61 73 68 20 6f 66 20 74 68 65 20 70 75 62   hash of the pub
3bc0: 6c 69 63 20 6b 65 79 20 69 6e 73 69 64 65 20 74  lic key inside t
3bd0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61  he certificate a
3be0: 73 20 61 0a 68 65 78 20 73 74 72 69 6e 67 2e 20  s a.hex string. 
3bf0: 55 73 65 64 20 74 6f 20 69 64 65 6e 74 69 66 79  Used to identify
3c00: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 68   certificates th
3c10: 61 74 20 63 6f 6e 74 61 69 6e 20 61 20 70 61 72  at contain a par
3c20: 74 69 63 75 6c 61 72 20 70 75 62 6c 69 63 20 6b  ticular public k
3c30: 65 79 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  ey..This value i
3c40: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
3c50: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   1.8...[def "[va
3c60: 72 20 73 75 62 6a 65 63 74 41 6c 74 4e 61 6d 65  r subjectAltName
3c70: 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c  ] [arg list]"].L
3c80: 69 73 74 20 6f 66 20 61 6c 6c 20 6f 66 20 74 68  ist of all of th
3c90: 65 20 53 75 62 6a 65 63 74 20 41 6c 74 65 72 6e  e Subject Altern
3ca0: 61 74 69 76 65 20 4e 61 6d 65 73 20 28 53 41 4e  ative Names (SAN
3cb0: 29 20 69 6e 63 6c 75 64 69 6e 67 20 64 6f 6d 61  ) including doma
3cc0: 69 6e 20 6e 61 6d 65 73 2c 20 73 75 62 0a 64 6f  in names, sub.do
3cd0: 6d 61 69 6e 73 2c 20 61 6e 64 20 49 50 20 61 64  mains, and IP ad
3ce0: 64 72 65 73 73 65 73 20 74 68 61 74 20 61 72 65  dresses that are
3cf0: 20 73 65 63 75 72 65 64 20 62 79 20 74 68 65 20   secured by the 
3d00: 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69  certificate..Thi
3d10: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3d20: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3d30: 5b 64 65 66 20 22 5b 76 61 72 20 6f 63 73 70 5d  [def "[var ocsp]
3d40: 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69   [arg list]"].Li
3d50: 73 74 20 6f 66 20 61 6c 6c 20 4f 6e 6c 69 6e 65  st of all Online
3d60: 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74 61   Certificate Sta
3d70: 74 75 73 20 50 72 6f 74 6f 63 6f 6c 20 28 4f 43  tus Protocol (OC
3d80: 53 50 29 20 55 52 4c 73 20 74 68 61 74 20 63 61  SP) URLs that ca
3d90: 6e 20 62 65 20 75 73 65 64 20 74 6f 0a 63 68 65  n be used to.che
3da0: 63 6b 20 74 68 65 20 76 61 6c 69 64 69 74 79 20  ck the validity 
3db0: 6f 66 20 74 68 69 73 20 63 65 72 74 69 66 69 63  of this certific
3dc0: 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ate..This value 
3dd0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3de0: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3df0: 61 72 20 63 65 72 74 69 66 69 63 61 74 65 5d 20  ar certificate] 
3e00: 5b 61 72 67 20 63 65 72 74 5d 22 5d 0a 54 68 65  [arg cert]"].The
3e10: 20 50 45 4d 20 65 6e 63 6f 64 65 64 20 63 65 72   PEM encoded cer
3e20: 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20  tificate...[def 
3e30: 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65 41  "[var signatureA
3e40: 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20 61  lgorithm] [arg a
3e50: 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 69 70 68  lgorithm]"].Ciph
3e60: 65 72 20 61 6c 67 6f 72 69 74 68 6d 20 75 73 65  er algorithm use
3e70: 64 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 66  d for the certif
3e80: 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 2e  icate signature.
3e90: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3ea0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3eb0: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  8...[def "[var s
3ec0: 69 67 6e 61 74 75 72 65 56 61 6c 75 65 5d 20 5b  ignatureValue] [
3ed0: 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 43 65  arg string]"].Ce
3ee0: 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74  rtificate signat
3ef0: 75 72 65 20 61 73 20 61 20 68 65 78 20 73 74 72  ure as a hex str
3f00: 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ing..This value 
3f10: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3f20: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3f30: 61 72 20 73 69 67 6e 61 74 75 72 65 44 69 67 65  ar signatureDige
3f40: 73 74 5d 20 5b 61 72 67 20 76 65 72 73 69 6f 6e  st] [arg version
3f50: 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74 65 20  ]"].Certificate 
3f60: 73 69 67 6e 69 6e 67 20 64 69 67 65 73 74 20 61  signing digest a
3f70: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a  s a hex string..
3f80: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
3f90: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
3fa0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 75  ...[def "[var pu
3fb0: 62 6c 69 63 4b 65 79 41 6c 67 6f 72 69 74 68 6d  blicKeyAlgorithm
3fc0: 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68 6d  ] [arg algorithm
3fd0: 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74 65 20  ]"].Certificate 
3fe0: 73 69 67 6e 61 74 75 72 65 20 70 75 62 6c 69 63  signature public
3ff0: 20 6b 65 79 20 61 6c 67 6f 72 69 74 68 6d 2e 0a   key algorithm..
4000: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
4010: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
4020: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 75  ...[def "[var pu
4030: 62 6c 69 63 4b 65 79 5d 20 5b 61 72 67 20 73 74  blicKey] [arg st
4040: 72 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66 69 63  ring]"].Certific
4050: 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 70 75  ate signature pu
4060: 62 6c 69 63 20 6b 65 79 20 61 73 20 61 20 68 65  blic key as a he
4070: 78 20 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76  x string..This v
4080: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20  alue is new for 
4090: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65  TclTLS 1.8...[de
40a0: 66 20 22 5b 76 61 72 20 62 69 74 73 5d 20 5b 61  f "[var bits] [a
40b0: 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65 72 20 6f  rg n]"].Number o
40c0: 66 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20  f bits used for 
40d0: 63 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e  certificate sign
40e0: 61 74 75 72 65 20 6b 65 79 2e 0a 54 68 69 73 20  ature key..This 
40f0: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
4100: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
4110: 65 66 20 22 5b 76 61 72 20 73 65 6c 66 5f 73 69  ef "[var self_si
4120: 67 6e 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65  gned] [arg boole
4130: 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68  an]"].Whether th
4140: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 73 69  e certificate si
4150: 67 6e 61 74 75 72 65 20 69 73 20 73 65 6c 66 20  gnature is self 
4160: 73 69 67 6e 65 64 2e 0a 54 68 69 73 20 76 61 6c  signed..This val
4170: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
4180: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
4190: 22 5b 76 61 72 20 73 68 61 31 5f 68 61 73 68 5d  "[var sha1_hash]
41a0: 20 5b 61 72 67 20 68 61 73 68 5d 22 5d 0a 54 68   [arg hash]"].Th
41b0: 65 20 53 48 41 31 20 68 61 73 68 20 6f 66 20 74  e SHA1 hash of t
41c0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61  he certificate a
41d0: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a  s a hex string..
41e0: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
41f0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
4200: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 68  ...[def "[var sh
4210: 61 32 35 36 5f 68 61 73 68 5d 20 5b 61 72 67 20  a256_hash] [arg 
4220: 68 61 73 68 5d 22 5d 0a 54 68 65 20 53 48 41 32  hash]"].The SHA2
4230: 35 36 20 68 61 73 68 20 6f 66 20 74 68 65 20 63  56 hash of the c
4240: 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61 20  ertificate as a 
4250: 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68 69 73  hex string..This
4260: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
4270: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
4280: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c  list_end]..[call
4290: 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 6f 6e 6e 65   [cmd tls::conne
42a0: 63 74 69 6f 6e 5d 20 5b 61 72 67 20 63 68 61 6e  ction] [arg chan
42b0: 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 74  nel]]..Returns t
42c0: 68 65 20 63 75 72 72 65 6e 74 20 63 6f 6e 6e 65  he current conne
42d0: 63 74 69 6f 6e 20 73 74 61 74 75 73 20 6f 66 20  ction status of 
42e0: 61 6e 20 53 53 4c 20 63 68 61 6e 6e 65 6c 2e 20  an SSL channel. 
42f0: 54 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 20  The result is a 
4300: 6c 69 73 74 0a 6f 66 20 6b 65 79 2d 76 61 6c 75  list.of key-valu
4310: 65 20 70 61 69 72 73 20 64 65 73 63 72 69 62 69  e pairs describi
4320: 6e 67 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f  ng the connectio
4330: 6e 2e 0a 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20  n..This command 
4340: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
4350: 53 20 31 2e 38 2e 20 52 65 74 75 72 6e 65 64 20  S 1.8. Returned 
4360: 76 61 6c 75 65 73 20 69 6e 63 6c 75 64 65 3a 0a  values include:.
4370: 0a 5b 70 61 72 61 5d 0a 0a 53 53 4c 20 53 74 61  .[para]..SSL Sta
4380: 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  tus..[list_begin
4390: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b   definitions]..[
43a0: 64 65 66 20 22 5b 76 61 72 20 73 74 61 74 65 5d  def "[var state]
43b0: 20 5b 61 72 67 20 73 74 61 74 65 5d 22 5d 0a 53   [arg state]"].S
43c0: 74 61 74 65 20 6f 66 20 74 68 65 20 63 6f 6e 6e  tate of the conn
43d0: 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b  ection...[def "[
43e0: 76 61 72 20 73 65 72 76 65 72 6e 61 6d 65 5d 20  var servername] 
43f0: 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 65  [arg name]"].The
4400: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 6f 6e   name of the con
4410: 6e 65 63 74 65 64 20 74 6f 20 73 65 72 76 65 72  nected to server
4420: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 72  ...[def "[var pr
4430: 6f 74 6f 63 6f 6c 5d 20 5b 61 72 67 20 76 65 72  otocol] [arg ver
4440: 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 70 72 6f 74  sion]"].The prot
4450: 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 20 75 73 65  ocol version use
4460: 64 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63  d for the connec
4470: 74 69 6f 6e 3a 20 53 53 4c 32 2c 20 53 53 4c 33  tion: SSL2, SSL3
4480: 2c 20 54 4c 53 31 2c 20 54 4c 53 31 2e 31 2c 20  , TLS1, TLS1.1, 
4490: 54 4c 53 31 2e 32 2c 20 54 4c 53 31 2e 33 2c 20  TLS1.2, TLS1.3, 
44a0: 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 0a 0a 5b 64 65  or unknown...[de
44b0: 66 20 22 5b 76 61 72 20 72 65 6e 65 67 6f 74 69  f "[var renegoti
44c0: 61 74 69 6f 6e 5f 61 6c 6c 6f 77 65 64 5d 20 5b  ation_allowed] [
44d0: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57  arg boolean]"].W
44e0: 68 65 74 68 65 72 20 70 72 6f 74 6f 63 6f 6c 20  hether protocol 
44f0: 72 65 6e 65 67 6f 74 69 61 74 69 6f 6e 20 69 73  renegotiation is
4500: 20 73 75 70 70 6f 72 74 65 64 20 6f 72 20 6e 6f   supported or no
4510: 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  t...[def "[var s
4520: 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 5b  ecurity_level] [
4530: 61 72 67 20 6c 65 76 65 6c 5d 22 5d 0a 54 68 65  arg level]"].The
4540: 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20   security level 
4550: 75 73 65 64 20 66 6f 72 20 73 65 6c 65 63 74 69  used for selecti
4560: 6f 6e 20 6f 66 20 63 69 70 68 65 72 73 2c 20 6b  on of ciphers, k
4570: 65 79 20 73 69 7a 65 2c 20 65 74 63 2e 0a 0a 5b  ey size, etc...[
4580: 64 65 66 20 22 5b 76 61 72 20 73 65 73 73 69 6f  def "[var sessio
4590: 6e 5f 72 65 75 73 65 64 5d 20 5b 61 72 67 20 62  n_reused] [arg b
45a0: 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65  oolean]"].Whethe
45b0: 72 20 74 68 65 20 73 65 73 73 69 6f 6e 20 68 61  r the session ha
45c0: 73 20 62 65 65 6e 20 72 65 75 73 65 64 20 6f 72  s been reused or
45d0: 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   not...[def "[va
45e0: 72 20 69 73 5f 73 65 72 76 65 72 5d 20 5b 61 72  r is_server] [ar
45f0: 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65  g boolean]"].Whe
4600: 74 68 65 72 20 74 68 65 20 63 6f 6e 6e 65 63 74  ther the connect
4610: 69 6f 6e 20 69 73 20 63 6f 6e 66 69 67 75 72 65  ion is configure
4620: 64 20 61 73 20 61 20 73 65 72 76 65 72 20 28 31  d as a server (1
4630: 29 20 6f 72 20 63 6c 69 65 6e 74 20 28 30 29 2e  ) or client (0).
4640: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 6f 6d  ..[def "[var com
4650: 70 72 65 73 73 69 6f 6e 5d 20 5b 61 72 67 20 6d  pression] [arg m
4660: 6f 64 65 5d 22 5d 0a 43 6f 6d 70 72 65 73 73 69  ode]"].Compressi
4670: 6f 6e 20 6d 65 74 68 6f 64 2e 0a 0a 5b 64 65 66  on method...[def
4680: 20 22 5b 76 61 72 20 65 78 70 61 6e 73 69 6f 6e   "[var expansion
4690: 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 45  ] [arg mode]"].E
46a0: 78 70 61 6e 73 69 6f 6e 20 6d 65 74 68 6f 64 2e  xpansion method.
46b0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 61 4c  ..[def "[var caL
46c0: 69 73 74 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22  ist] [arg list]"
46d0: 5d 0a 4c 69 73 74 20 6f 66 20 43 65 72 74 69 66  ].List of Certif
46e0: 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 69 65  icate Authoritie
46f0: 73 20 28 43 41 29 20 66 6f 72 20 58 2e 35 30 39  s (CA) for X.509
4700: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b   certificate...[
4710: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43 69 70 68 65  list_end]..Ciphe
4720: 72 20 49 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65  r Info..[list_be
4730: 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d  gin definitions]
4740: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 69 70  ..[def "[var cip
4750: 68 65 72 5d 20 5b 61 72 67 20 63 69 70 68 65 72  her] [arg cipher
4760: 5d 22 5d 0a 54 68 65 20 63 75 72 72 65 6e 74 20  ]"].The current 
4770: 63 69 70 68 65 72 20 69 6e 20 75 73 65 20 66 6f  cipher in use fo
4780: 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  r the connection
4790: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74  ...[def "[var st
47a0: 61 6e 64 61 72 64 5f 6e 61 6d 65 5d 20 5b 61 72  andard_name] [ar
47b0: 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 65 20 73 74  g name]"].The st
47c0: 61 6e 64 61 72 64 20 52 46 43 20 6e 61 6d 65 20  andard RFC name 
47d0: 6f 66 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66  of cipher...[def
47e0: 20 22 5b 76 61 72 20 61 6c 67 6f 72 69 74 68 6d   "[var algorithm
47f0: 5f 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d  _bits] [arg n]"]
4800: 0a 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 70  .The number of p
4810: 72 6f 63 65 73 73 65 64 20 62 69 74 73 20 75 73  rocessed bits us
4820: 65 64 20 66 6f 72 20 63 69 70 68 65 72 2e 0a 0a  ed for cipher...
4830: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 63 72 65  [def "[var secre
4840: 74 5f 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22  t_bits] [arg n]"
4850: 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20  ].The number of 
4860: 73 65 63 72 65 74 20 62 69 74 73 20 75 73 65 64  secret bits used
4870: 20 66 6f 72 20 63 69 70 68 65 72 2e 0a 0a 5b 64   for cipher...[d
4880: 65 66 20 22 5b 76 61 72 20 6d 69 6e 5f 76 65 72  ef "[var min_ver
4890: 73 69 6f 6e 5d 20 5b 61 72 67 20 76 65 72 73 69  sion] [arg versi
48a0: 6f 6e 5d 22 5d 0a 54 68 65 20 6d 69 6e 69 6d 75  on]"].The minimu
48b0: 6d 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69  m protocol versi
48c0: 6f 6e 20 66 6f 72 20 63 69 70 68 65 72 2e 0a 0a  on for cipher...
48d0: 5b 64 65 66 20 22 5b 76 61 72 20 63 69 70 68 65  [def "[var ciphe
48e0: 72 5f 69 73 5f 61 65 61 64 5d 20 5b 61 72 67 20  r_is_aead] [arg 
48f0: 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68  boolean]"].Wheth
4900: 65 72 20 74 68 65 20 63 69 70 68 65 72 20 69 73  er the cipher is
4910: 20 41 75 74 68 65 6e 74 69 63 61 74 65 64 20 45   Authenticated E
4920: 6e 63 72 79 70 74 69 6f 6e 20 77 69 74 68 20 41  ncryption with A
4930: 73 73 6f 63 69 61 74 65 64 20 44 61 74 61 20 28  ssociated Data (
4940: 41 45 41 44 29 2e 0a 0a 5b 64 65 66 20 22 5b 76  AEAD)...[def "[v
4950: 61 72 20 63 69 70 68 65 72 5f 69 64 5d 20 5b 61  ar cipher_id] [a
4960: 72 67 20 69 64 5d 22 5d 0a 54 68 65 20 4f 70 65  rg id]"].The Ope
4970: 6e 53 53 4c 20 63 69 70 68 65 72 20 69 64 2e 0a  nSSL cipher id..
4980: 0a 5b 64 65 66 20 22 5b 76 61 72 20 64 65 73 63  .[def "[var desc
4990: 72 69 70 74 69 6f 6e 5d 20 5b 61 72 67 20 73 74  ription] [arg st
49a0: 72 69 6e 67 5d 22 5d 0a 41 20 74 65 78 74 20 64  ring]"].A text d
49b0: 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 74 68  escription of th
49c0: 65 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20  e cipher...[def 
49d0: 22 5b 76 61 72 20 68 61 6e 64 73 68 61 6b 65 5f  "[var handshake_
49e0: 64 69 67 65 73 74 5d 20 5b 61 72 67 20 62 6f 6f  digest] [arg boo
49f0: 6c 65 61 6e 5d 22 5d 0a 44 69 67 65 73 74 20 75  lean]"].Digest u
4a00: 73 65 64 20 64 75 72 69 6e 67 20 68 61 6e 64 73  sed during hands
4a10: 68 61 6b 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  hake...[list_end
4a20: 5d 0a 0a 53 65 73 73 69 6f 6e 20 49 6e 66 6f 0a  ]..Session Info.
4a30: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66  .[list_begin def
4a40: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20  initions]..[def 
4a50: 22 5b 76 61 72 20 61 6c 70 6e 5d 20 5b 61 72 67  "[var alpn] [arg
4a60: 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 68 65   protocol]"].The
4a70: 20 70 72 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74   protocol select
4a80: 65 64 20 61 66 74 65 72 20 41 70 70 6c 69 63 61  ed after Applica
4a90: 74 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f  tion-Layer Proto
4aa0: 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e 20  col Negotiation 
4ab0: 28 41 4c 50 4e 29 2e 0a 0a 5b 64 65 66 20 22 5b  (ALPN)...[def "[
4ac0: 76 61 72 20 72 65 73 75 6d 61 62 6c 65 5d 20 5b  var resumable] [
4ad0: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57  arg boolean]"].W
4ae0: 68 65 74 68 65 72 20 74 68 65 20 73 65 73 73 69  hether the sessi
4af0: 6f 6e 20 63 61 6e 20 62 65 20 72 65 73 75 6d 65  on can be resume
4b00: 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20  d or not...[def 
4b10: 22 5b 76 61 72 20 73 74 61 72 74 5f 74 69 6d 65  "[var start_time
4b20: 5d 20 5b 61 72 67 20 73 65 63 6f 6e 64 73 5d 22  ] [arg seconds]"
4b30: 5d 0a 54 69 6d 65 20 73 69 6e 63 65 20 73 65 73  ].Time since ses
4b40: 73 69 6f 6e 20 73 74 61 72 74 65 64 20 69 6e 20  sion started in 
4b50: 73 65 63 6f 6e 64 73 20 73 69 6e 63 65 20 65 70  seconds since ep
4b60: 6f 63 68 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  och...[def "[var
4b70: 20 74 69 6d 65 6f 75 74 5d 20 5b 61 72 67 20 73   timeout] [arg s
4b80: 65 63 6f 6e 64 73 5d 22 5d 0a 4d 61 78 20 64 75  econds]"].Max du
4b90: 72 61 74 69 6f 6e 20 6f 66 20 73 65 73 73 69 6f  ration of sessio
4ba0: 6e 20 69 6e 20 73 65 63 6f 6e 64 73 20 62 65 66  n in seconds bef
4bb0: 6f 72 65 20 74 69 6d 65 2d 6f 75 74 2e 0a 0a 5b  ore time-out...[
4bc0: 64 65 66 20 22 5b 76 61 72 20 6c 69 66 65 74 69  def "[var lifeti
4bd0: 6d 65 5d 20 5b 61 72 67 20 73 65 63 6f 6e 64 73  me] [arg seconds
4be0: 5d 22 5d 0a 53 65 73 73 69 6f 6e 20 74 69 63 6b  ]"].Session tick
4bf0: 65 74 20 6c 69 66 65 74 69 6d 65 20 68 69 6e 74  et lifetime hint
4c00: 20 69 6e 20 73 65 63 6f 6e 64 73 2e 0a 0a 5b 64   in seconds...[d
4c10: 65 66 20 22 5b 76 61 72 20 73 65 73 73 69 6f 6e  ef "[var session
4c20: 5f 69 64 5d 20 5b 61 72 67 20 62 69 6e 61 72 79  _id] [arg binary
4c30: 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75  _string]"].Uniqu
4c40: 65 20 73 65 73 73 69 6f 6e 20 69 64 20 66 6f 72  e session id for
4c50: 20 75 73 65 20 69 6e 20 72 65 73 75 6d 69 6e 67   use in resuming
4c60: 20 74 68 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b   the session...[
4c70: 64 65 66 20 22 5b 76 61 72 20 73 65 73 73 69 6f  def "[var sessio
4c80: 6e 5f 74 69 63 6b 65 74 5d 20 5b 61 72 67 20 62  n_ticket] [arg b
4c90: 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a  inary_string]"].
4ca0: 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20 74  Unique session t
4cb0: 69 63 6b 65 74 20 66 6f 72 20 75 73 65 20 69 6e  icket for use in
4cc0: 20 72 65 73 75 6d 69 6e 67 20 74 68 65 20 73 65   resuming the se
4cd0: 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76  ssion...[def "[v
4ce0: 61 72 20 74 69 63 6b 65 74 5f 61 70 70 5f 64 61  ar ticket_app_da
4cf0: 74 61 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f  ta] [arg binary_
4d00: 73 74 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65  string]"].Unique
4d10: 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20   session ticket 
4d20: 61 70 70 6c 69 63 61 74 69 6f 6e 20 64 61 74 61  application data
4d30: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6d 61  ...[def "[var ma
4d40: 73 74 65 72 5f 6b 65 79 5d 20 5b 61 72 67 20 62  ster_key] [arg b
4d50: 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a  inary_string]"].
4d60: 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20 6d  Unique session m
4d70: 61 73 74 65 72 20 6b 65 79 2e 0a 0a 5b 64 65 66  aster key...[def
4d80: 20 22 5b 76 61 72 20 73 65 73 73 69 6f 6e 5f 63   "[var session_c
4d90: 61 63 68 65 5f 6d 6f 64 65 5d 20 5b 61 72 67 20  ache_mode] [arg 
4da0: 6d 6f 64 65 5d 22 5d 0a 53 65 72 76 65 72 20 63  mode]"].Server c
4db0: 61 63 68 65 20 6d 6f 64 65 20 28 63 6c 69 65 6e  ache mode (clien
4dc0: 74 2c 20 73 65 72 76 65 72 2c 20 6f 72 20 62 6f  t, server, or bo
4dd0: 74 68 29 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  th)...[list_end]
4de0: 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73  ..[call [cmd tls
4df0: 3a 3a 63 69 70 68 65 72 73 5d 20 5b 6f 70 74 20  ::ciphers] [opt 
4e00: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 5d 20  [arg protocol]] 
4e10: 5b 6f 70 74 20 5b 61 72 67 20 76 65 72 62 6f 73  [opt [arg verbos
4e20: 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 73 75  e]] [opt [arg su
4e30: 70 70 6f 72 74 65 64 5d 5d 5d 0a 0a 57 69 74 68  pported]]]..With
4e40: 6f 75 74 20 61 6e 79 20 6f 70 74 69 6f 6e 73 2c  out any options,
4e50: 20 69 74 20 72 65 74 75 72 6e 73 20 61 20 6c 69   it returns a li
4e60: 73 74 20 6f 66 20 61 6c 6c 20 73 79 6d 6d 65 74  st of all symmet
4e70: 72 69 63 20 63 69 70 68 65 72 73 20 66 6f 72 20  ric ciphers for 
4e80: 75 73 65 20 77 69 74 68 20 74 68 65 0a 5b 61 72  use with the.[ar
4e90: 67 20 2d 63 69 70 68 65 72 5d 20 6f 70 74 69 6f  g -cipher] optio
4ea0: 6e 2e 20 57 69 74 68 20 5b 61 72 67 20 70 72 6f  n. With [arg pro
4eb0: 74 6f 63 6f 6c 5d 2c 20 6f 6e 6c 79 20 74 68 65  tocol], only the
4ec0: 20 63 69 70 68 65 72 73 20 73 75 70 70 6f 72 74   ciphers support
4ed0: 65 64 20 66 6f 72 20 74 68 61 74 0a 70 72 6f 74  ed for that.prot
4ee0: 6f 63 6f 6c 20 61 72 65 20 72 65 74 75 72 6e 65  ocol are returne
4ef0: 64 2e 20 53 65 65 20 74 68 65 20 5b 63 6d 64 20  d. See the [cmd 
4f00: 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20  tls::protocols] 
4f10: 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 74 68 65 20  command for the 
4f20: 73 75 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63  supported.protoc
4f30: 6f 6c 73 2e 20 49 66 20 5b 61 72 67 20 76 65 72  ols. If [arg ver
4f40: 62 6f 73 65 5d 20 69 73 20 73 70 65 63 69 66 69  bose] is specifi
4f50: 65 64 20 61 73 20 74 72 75 65 20 74 68 65 6e 20  ed as true then 
4f60: 61 20 76 65 72 62 6f 73 65 2c 20 68 75 6d 61 6e  a verbose, human
4f70: 20 72 65 61 64 61 62 6c 65 0a 6c 69 73 74 20 69   readable.list i
4f80: 73 20 72 65 74 75 72 6e 65 64 20 77 69 74 68 20  s returned with 
4f90: 61 64 64 69 74 69 6f 6e 61 6c 20 69 6e 66 6f 72  additional infor
4fa0: 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 63 69  mation on the ci
4fb0: 70 68 65 72 2e 20 49 66 20 5b 61 72 67 20 73 75  pher. If [arg su
4fc0: 70 70 6f 72 74 65 64 5d 0a 69 73 20 73 70 65 63  pported].is spec
4fd0: 69 66 69 65 64 20 61 73 20 74 72 75 65 2c 20 74  ified as true, t
4fe0: 68 65 6e 20 6f 6e 6c 79 20 74 68 65 20 63 69 70  hen only the cip
4ff0: 68 65 72 73 20 73 75 70 70 6f 72 74 65 64 20 66  hers supported f
5000: 6f 72 20 70 72 6f 74 6f 63 6f 6c 20 77 69 6c 6c  or protocol will
5010: 20 62 65 20 6c 69 73 74 65 64 2e 0a 54 68 65 20   be listed..The 
5020: 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 5d 20  [arg supported] 
5030: 61 72 67 20 69 73 20 6e 65 77 20 66 6f 72 20 54  arg is new for T
5040: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 63 61 6c  clTLS 1.8...[cal
5050: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74  l [cmd tls::prot
5060: 6f 63 6f 6c 73 5d 5d 0a 0a 52 65 74 75 72 6e 73  ocols]]..Returns
5070: 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 73   a list of the s
5080: 75 70 70 6f 72 74 65 64 20 53 53 4c 2f 54 4c 53  upported SSL/TLS
5090: 20 70 72 6f 74 6f 63 6f 6c 73 2e 20 56 61 6c 69   protocols. Vali
50a0: 64 20 76 61 6c 75 65 73 20 61 72 65 3a 0a 5b 63  d values are:.[c
50b0: 6f 6e 73 74 20 73 73 6c 32 5d 2c 20 5b 63 6f 6e  onst ssl2], [con
50c0: 73 74 20 73 73 6c 33 5d 2c 20 5b 63 6f 6e 73 74  st ssl3], [const
50d0: 20 74 6c 73 31 5d 2c 20 5b 63 6f 6e 73 74 20 74   tls1], [const t
50e0: 6c 73 31 2e 31 5d 2c 20 5b 63 6f 6e 73 74 20 74  ls1.1], [const t
50f0: 6c 73 31 2e 32 5d 2c 20 61 6e 64 0a 5b 63 6f 6e  ls1.2], and.[con
5100: 73 74 20 74 6c 73 31 2e 33 5d 2e 20 45 78 61 63  st tls1.3]. Exac
5110: 74 20 6c 69 73 74 20 64 65 70 65 6e 64 73 20 6f  t list depends o
5120: 6e 20 4f 70 65 6e 53 53 4c 20 76 65 72 73 69 6f  n OpenSSL versio
5130: 6e 20 61 6e 64 20 63 6f 6d 70 69 6c 65 20 74 69  n and compile ti
5140: 6d 65 20 66 6c 61 67 73 2e 0a 54 68 69 73 20 63  me flags..This c
5150: 6f 6d 6d 61 6e 64 20 69 73 20 6e 65 77 20 66 6f  ommand is new fo
5160: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
5170: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 76  call [cmd tls::v
5180: 65 72 73 69 6f 6e 5d 5d 0a 0a 52 65 74 75 72 6e  ersion]]..Return
5190: 73 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 76 65  s the OpenSSL ve
51a0: 72 73 69 6f 6e 20 73 74 72 69 6e 67 2e 0a 0a 5b  rsion string...[
51b0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 0a 5b 73 65 63  list_end]...[sec
51c0: 74 69 6f 6e 20 22 43 65 72 74 69 66 69 63 61 74  tion "Certificat
51d0: 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 0a 0a  e Validation"]..
51e0: 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 50 4b 49  [subsection "PKI
51f0: 20 61 6e 64 20 43 65 72 74 69 66 69 63 61 74 65   and Certificate
5200: 73 22 5d 0a 0a 55 73 69 6e 67 20 74 68 65 20 50  s"]..Using the P
5210: 75 62 6c 69 63 20 4b 65 79 20 49 6e 66 72 61 73  ublic Key Infras
5220: 74 72 75 63 74 75 72 65 20 28 50 4b 49 29 2c 20  tructure (PKI), 
5230: 65 61 63 68 20 75 73 65 72 20 63 72 65 61 74 65  each user create
5240: 73 20 61 20 70 72 69 76 61 74 65 20 6b 65 79 20  s a private key 
5250: 74 68 61 74 0a 6f 6e 6c 79 20 74 68 65 79 20 6b  that.only they k
5260: 6e 6f 77 20 61 62 6f 75 74 20 61 6e 64 20 61 20  now about and a 
5270: 70 75 62 6c 69 63 20 6b 65 79 20 74 68 65 79 20  public key they 
5280: 63 61 6e 20 65 78 63 68 61 6e 67 65 20 77 69 74  can exchange wit
5290: 68 20 6f 74 68 65 72 73 20 66 6f 72 20 75 73 65  h others for use
52a0: 20 69 6e 0a 65 6e 63 72 79 70 74 69 6e 67 20 61   in.encrypting a
52b0: 6e 64 20 64 65 63 72 79 70 74 69 6e 67 20 64 61  nd decrypting da
52c0: 74 61 2e 20 54 68 65 20 70 72 6f 63 65 73 73 20  ta. The process 
52d0: 69 73 20 74 68 65 20 73 65 6e 64 65 72 20 65 6e  is the sender en
52e0: 63 72 79 70 74 73 20 74 68 65 69 72 20 64 61 74  crypts their dat
52f0: 61 0a 75 73 69 6e 67 20 74 68 65 69 72 20 70 72  a.using their pr
5300: 69 76 61 74 65 20 6b 65 79 20 61 6e 64 20 74 68  ivate key and th
5310: 65 20 72 65 63 65 69 76 65 72 27 73 20 70 75 62  e receiver's pub
5320: 6c 69 63 20 6b 65 79 2e 20 54 68 65 20 64 61 74  lic key. The dat
5330: 61 20 69 73 20 74 68 65 6e 20 73 65 6e 74 0a 74  a is then sent.t
5340: 6f 20 74 68 65 20 72 65 63 65 69 76 65 72 2e 20  o the receiver. 
5350: 49 6e 20 61 20 73 69 6d 69 6c 61 72 20 6d 61 6e  In a similar man
5360: 6e 65 72 2c 20 74 68 65 20 72 65 63 65 69 76 65  ner, the receive
5370: 72 20 75 73 65 73 20 74 68 65 69 72 20 70 72 69  r uses their pri
5380: 76 61 74 65 20 6b 65 79 20 61 6e 64 0a 74 68 65  vate key and.the
5390: 20 73 65 6e 64 65 72 27 73 20 70 75 62 6c 69 63   sender's public
53a0: 20 6b 65 79 20 74 6f 20 64 65 63 72 79 70 74 20   key to decrypt 
53b0: 74 68 65 20 64 61 74 61 2e 20 54 68 69 73 20 70  the data. This p
53c0: 72 6f 76 69 64 65 73 20 64 61 74 61 20 69 6e 74  rovides data int
53d0: 65 67 72 69 74 79 2c 20 74 6f 0a 65 6e 73 75 72  egrity, to.ensur
53e0: 65 20 74 68 65 20 64 61 74 61 20 63 61 6e 27 74  e the data can't
53f0: 20 62 65 20 76 69 65 77 65 64 20 6f 72 20 61 6c   be viewed or al
5400: 74 65 72 65 64 20 64 75 72 69 6e 67 20 74 72 61  tered during tra
5410: 6e 73 70 6f 72 74 2e 20 53 65 65 20 74 68 65 0a  nsport. See the.
5420: 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79 5d 20 61 6e  [option -key] an
5430: 64 20 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79 66 69  d [option -keyfi
5440: 6c 65 5d 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20  le] options for 
5450: 68 6f 77 20 74 6f 20 73 70 65 63 69 66 79 20 74  how to specify t
5460: 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 2e 0a  he private key..
5470: 41 6c 73 6f 20 73 65 65 20 74 68 65 20 5b 6f 70  Also see the [op
5480: 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20  tion -password] 
5490: 6f 70 74 69 6f 6e 20 66 6f 72 20 68 6f 77 20 74  option for how t
54a0: 6f 20 70 72 6f 76 69 64 65 20 74 68 65 20 70 61  o provide the pa
54b0: 73 73 77 6f 72 64 2e 0a 5b 70 61 72 61 5d 0a 49  ssword..[para].I
54c0: 6e 20 6f 72 64 65 72 20 74 6f 20 70 72 6f 76 69  n order to provi
54d0: 64 65 20 61 75 74 68 65 6e 74 69 63 61 74 69 6f  de authenticatio
54e0: 6e 2c 20 69 2e 65 2e 20 65 6e 73 75 72 69 6e 67  n, i.e. ensuring
54f0: 20 73 6f 6d 65 6f 6e 65 20 69 73 20 77 68 6f 20   someone is who 
5500: 74 68 65 79 20 73 61 79 20 74 68 65 79 0a 61 72  they say they.ar
5510: 65 2c 20 74 68 65 20 70 75 62 6c 69 63 20 6b 65  e, the public ke
5520: 79 20 61 6e 64 20 75 73 65 72 20 69 64 65 6e 74  y and user ident
5530: 69 66 69 63 61 74 69 6f 6e 20 69 6e 66 6f 20 69  ification info i
5540: 73 20 73 74 6f 72 65 64 20 69 6e 20 61 20 58 2e  s stored in a X.
5550: 35 30 39 0a 63 65 72 74 69 66 69 63 61 74 65 20  509.certificate 
5560: 61 6e 64 20 74 68 61 74 20 63 65 72 74 69 66 69  and that certifi
5570: 63 61 74 65 20 69 73 20 61 75 74 68 65 6e 74 69  cate is authenti
5580: 63 61 74 65 64 20 28 69 2e 65 2e 20 73 69 67 6e  cated (i.e. sign
5590: 65 64 29 20 62 79 20 61 20 43 65 72 74 69 66 69  ed) by a Certifi
55a0: 63 61 74 65 0a 41 75 74 68 6f 72 69 74 79 20 28  cate.Authority (
55b0: 43 41 29 2e 20 55 73 65 72 73 20 63 61 6e 20 74  CA). Users can t
55c0: 68 65 6e 20 65 78 63 68 61 6e 67 65 20 74 68 65  hen exchange the
55d0: 73 65 20 63 65 72 74 69 66 69 63 61 74 65 73 20  se certificates 
55e0: 64 75 72 69 6e 67 20 74 68 65 20 54 4c 53 0a 69  during the TLS.i
55f0: 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 20 70 72  nitialization pr
5600: 6f 63 65 73 73 20 61 6e 64 20 63 68 65 63 6b 20  ocess and check 
5610: 74 68 65 6d 20 61 67 61 69 6e 73 74 20 74 68 65  them against the
5620: 20 72 6f 6f 74 20 43 41 20 63 65 72 74 69 66 69   root CA certifi
5630: 63 61 74 65 73 20 74 6f 20 65 6e 73 75 72 65 0a  cates to ensure.
5640: 74 68 65 79 20 61 72 65 20 76 61 6c 69 64 2e 20  they are valid. 
5650: 54 68 69 73 20 69 73 20 68 61 6e 64 6c 65 64 20  This is handled 
5660: 62 79 20 4f 70 65 6e 53 53 4c 20 76 69 61 20 74  by OpenSSL via t
5670: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75  he [option -requ
5680: 65 73 74 5d 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e  est] and.[option
5690: 20 2d 72 65 71 75 69 72 65 5d 20 6f 70 74 69 6f   -require] optio
56a0: 6e 73 2e 20 53 65 65 20 74 68 65 20 5b 6f 70 74  ns. See the [opt
56b0: 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70  ion -cadir], [op
56c0: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61 6e  tion -cadir], an
56d0: 64 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  d.[option -casto
56e0: 72 65 5d 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20  re] options for 
56f0: 68 6f 77 20 74 6f 20 73 70 65 63 69 66 79 20 77  how to specify w
5700: 68 65 72 65 20 74 6f 20 66 69 6e 64 20 74 68 65  here to find the
5710: 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73   CA certificates
5720: 2e 0a 4f 70 74 69 6f 6e 61 6c 6c 79 2c 20 69 6e  ..Optionally, in
5730: 20 61 20 66 75 74 75 72 65 20 72 65 6c 65 61 73   a future releas
5740: 65 2c 20 74 68 65 79 20 63 61 6e 20 61 6c 73 6f  e, they can also
5750: 20 62 65 20 63 68 65 63 6b 65 64 20 61 67 61 69   be checked agai
5760: 6e 73 74 20 74 68 65 20 43 65 72 74 69 66 69 63  nst the Certific
5770: 61 74 65 0a 52 65 76 6f 63 61 74 69 6f 6e 20 4c  ate.Revocation L
5780: 69 73 74 20 28 43 52 4c 29 20 6f 66 20 72 65 76  ist (CRL) of rev
5790: 6f 6b 65 64 20 63 65 72 74 69 66 69 63 61 74 65  oked certificate
57a0: 73 2e 20 43 65 72 74 69 66 69 63 61 74 65 73 20  s. Certificates 
57b0: 63 61 6e 20 61 6c 73 6f 20 62 65 0a 73 65 6c 66  can also be.self
57c0: 2d 73 69 67 6e 65 64 2c 20 62 75 74 20 74 68 65  -signed, but the
57d0: 79 20 61 72 65 20 62 79 20 64 65 66 61 75 6c 74  y are by default
57e0: 20 6e 6f 74 20 74 72 75 73 74 65 64 20 75 6e 6c   not trusted unl
57f0: 65 73 73 20 79 6f 75 20 61 64 64 20 74 68 65 6d  ess you add them
5800: 20 74 6f 20 79 6f 75 72 0a 63 65 72 74 69 66 69   to your.certifi
5810: 63 61 74 65 20 73 74 6f 72 65 2e 0a 5b 70 61 72  cate store..[par
5820: 61 5d 0a 54 79 70 69 63 61 6c 6c 79 20 77 68 65  a].Typically whe
5830: 6e 20 76 69 73 69 74 69 6e 67 20 77 65 62 20 73  n visiting web s
5840: 69 74 65 73 2c 20 6f 6e 6c 79 20 74 68 65 20 63  ites, only the c
5850: 6c 69 65 6e 74 20 6e 65 65 64 73 20 74 6f 20 63  lient needs to c
5860: 68 65 63 6b 20 74 68 65 20 73 65 72 76 65 72 27  heck the server'
5870: 73 0a 63 65 72 74 69 66 69 63 61 74 65 20 74 6f  s.certificate to
5880: 20 65 6e 73 75 72 65 20 69 74 20 69 73 20 76 61   ensure it is va
5890: 6c 69 64 2e 20 54 68 65 20 73 65 72 76 65 72 20  lid. The server 
58a0: 64 6f 65 73 6e 27 74 20 6e 65 65 64 20 74 6f 20  doesn't need to 
58b0: 63 68 65 63 6b 20 74 68 65 20 63 6c 69 65 6e 74  check the client
58c0: 0a 63 65 72 74 69 66 69 63 61 74 65 20 75 6e 6c  .certificate unl
58d0: 65 73 73 20 79 6f 75 20 6e 65 65 64 20 74 6f 20  ess you need to 
58e0: 61 75 74 68 65 6e 74 69 63 61 74 65 20 77 69 74  authenticate wit
58f0: 68 20 74 68 65 6d 20 74 6f 20 6c 6f 67 69 6e 2c  h them to login,
5900: 20 65 74 63 2e 20 53 65 65 20 74 68 65 0a 5b 6f   etc. See the.[o
5910: 70 74 69 6f 6e 20 2d 63 65 72 74 5d 20 61 6e 64  ption -cert] and
5920: 20 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74 66 69   [option -certfi
5930: 6c 65 5d 20 6f 70 74 69 6f 6e 73 20 69 66 20 79  le] options if y
5940: 6f 75 20 6e 65 65 64 20 74 6f 20 70 72 6f 76 69  ou need to provi
5950: 64 65 20 61 20 63 65 72 74 69 66 69 63 61 74 65  de a certificate
5960: 2e 0a 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20  ....[subsection 
5970: 22 53 75 6d 6d 61 72 79 20 6f 66 20 63 6f 6d 6d  "Summary of comm
5980: 61 6e 64 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 73  and line options
5990: 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e  "]..The followin
59a0: 67 20 6f 70 74 69 6f 6e 73 20 61 72 65 20 75 73  g options are us
59b0: 65 64 20 66 6f 72 20 70 65 65 72 20 63 65 72 74  ed for peer cert
59c0: 69 66 69 63 61 74 65 20 76 61 6c 69 64 61 74 69  ificate validati
59d0: 6f 6e 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  on:..[list_begin
59e0: 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f   options]..[opt_
59f0: 64 65 66 20 2d 63 61 64 69 72 20 5b 61 72 67 20  def -cadir [arg 
5a00: 64 69 72 65 63 74 6f 72 79 5d 5d 0a 53 70 65 63  directory]].Spec
5a10: 69 66 69 65 73 20 74 68 65 20 64 69 72 65 63 74  ifies the direct
5a20: 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 43 65  ory where the Ce
5a30: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
5a40: 69 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69  ity (CA) certifi
5a50: 63 61 74 65 73 20 61 72 65 0a 73 74 6f 72 65 64  cates are.stored
5a60: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
5a70: 20 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66   platform specif
5a80: 69 63 2c 20 62 75 74 20 69 73 20 75 73 75 61 6c  ic, but is usual
5a90: 6c 79 20 5b 66 69 6c 65 20 2f 65 74 63 2f 73 73  ly [file /etc/ss
5aa0: 6c 2f 63 65 72 74 73 5d 20 6f 6e 0a 4c 69 6e 75  l/certs] on.Linu
5ab0: 78 2f 55 6e 69 78 20 73 79 73 74 65 6d 73 2e 20  x/Unix systems. 
5ac0: 54 68 65 20 64 65 66 61 75 6c 74 20 6c 6f 63 61  The default loca
5ad0: 74 69 6f 6e 20 63 61 6e 20 62 65 20 6f 76 65 72  tion can be over
5ae0: 72 69 64 64 65 6e 20 62 79 20 74 68 65 0a 5b 76  ridden by the.[v
5af0: 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d  ar SSL_CERT_DIR]
5b00: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72   environment var
5b10: 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66  iable...[opt_def
5b20: 20 2d 63 61 66 69 6c 65 20 5b 61 72 67 20 66 69   -cafile [arg fi
5b30: 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66 69  lename]].Specifi
5b40: 65 73 20 74 68 65 20 66 69 6c 65 20 77 69 74 68  es the file with
5b50: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65   the Certificate
5b60: 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 20   Authority (CA) 
5b70: 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f 20  certificates to 
5b80: 75 73 65 20 69 6e 0a 5b 63 6f 6e 73 74 20 50 45  use in.[const PE
5b90: 4d 5d 20 66 69 6c 65 20 66 6f 72 6d 61 74 2e 20  M] file format. 
5ba0: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  The default is [
5bb0: 66 69 6c 65 20 63 65 72 74 2e 70 65 6d 5d 2c 20  file cert.pem], 
5bc0: 69 6e 20 74 68 65 20 4f 70 65 6e 53 53 4c 0a 64  in the OpenSSL.d
5bd0: 69 72 65 63 74 6f 72 79 2e 20 4f 6e 20 4c 69 6e  irectory. On Lin
5be0: 75 78 2f 55 6e 69 78 20 73 79 73 74 65 6d 73 2c  ux/Unix systems,
5bf0: 20 74 68 69 73 20 69 73 20 75 73 75 61 6c 6c 79   this is usually
5c00: 20 5b 66 69 6c 65 20 2f 65 74 63 2f 73 73 6c 2f   [file /etc/ssl/
5c10: 63 61 2d 62 75 6e 64 6c 65 2e 70 65 6d 5d 2e 0a  ca-bundle.pem]..
5c20: 54 68 65 20 64 65 66 61 75 6c 74 20 66 69 6c 65  The default file
5c30: 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64   can be overridd
5c40: 65 6e 20 62 79 20 74 68 65 20 5b 76 61 72 20 53  en by the [var S
5c50: 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e  SL_CERT_FILE] en
5c60: 76 69 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62  vironment.variab
5c70: 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  le...[opt_def -c
5c80: 61 73 74 6f 72 65 20 5b 61 72 67 20 55 52 49 5d  astore [arg URI]
5c90: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
5ca0: 55 6e 69 66 6f 72 6d 20 52 65 73 6f 75 72 63 65  Uniform Resource
5cb0: 20 49 64 65 6e 74 69 66 69 65 72 20 28 55 52 49   Identifier (URI
5cc0: 29 20 66 6f 72 20 74 68 65 20 43 65 72 74 69 66  ) for the Certif
5cd0: 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 0a  icate Authority.
5ce0: 28 43 41 29 20 73 74 6f 72 65 2c 20 77 68 69 63  (CA) store, whic
5cf0: 68 20 6d 61 79 20 62 65 20 61 20 73 69 6e 67 6c  h may be a singl
5d00: 65 20 63 6f 6e 74 61 69 6e 65 72 20 6f 72 20 61  e container or a
5d10: 20 63 61 74 61 6c 6f 67 20 6f 66 20 63 6f 6e 74   catalog of cont
5d20: 61 69 6e 65 72 73 2e 0a 53 74 61 72 74 69 6e 67  ainers..Starting
5d30: 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 33 2e   with OpenSSL 3.
5d40: 32 20 6f 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c  2 on MS Windows,
5d50: 20 73 65 74 20 74 6f 20 22 5b 63 6f 6e 73 74 20   set to "[const 
5d60: 22 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e  "org.openssl.win
5d70: 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f 20 75  store://"]".to u
5d80: 73 65 20 74 68 65 20 62 75 69 6c 74 2d 69 6e 20  se the built-in 
5d90: 4d 53 20 57 69 6e 64 6f 77 73 20 43 65 72 74 69  MS Windows Certi
5da0: 66 69 63 61 74 65 20 53 74 6f 72 65 2e 20 53 74  ficate Store. St
5db0: 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53  arting in TclTLS
5dc0: 20 32 2e 30 2c 20 74 68 69 73 0a 69 73 20 74 68   2.0, this.is th
5dd0: 65 20 64 65 66 61 75 6c 74 20 69 66 20 5b 6f 70  e default if [op
5de0: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f  tion -cadir], [o
5df0: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61  ption -cadir], a
5e00: 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74  nd [option -cast
5e10: 6f 72 65 5d 20 61 72 65 0a 6e 6f 74 20 73 70 65  ore] are.not spe
5e20: 63 69 66 69 65 64 2e 20 54 68 69 73 20 73 74 6f  cified. This sto
5e30: 72 65 20 6f 6e 6c 79 20 73 75 70 70 6f 72 74 73  re only supports
5e40: 20 72 6f 6f 74 20 63 65 72 74 69 66 69 63 61 74   root certificat
5e50: 65 20 73 74 6f 72 65 73 2e 0a 0a 5b 6f 70 74 5f  e stores...[opt_
5e60: 64 65 66 20 2d 72 65 71 75 65 73 74 20 5b 61 72  def -request [ar
5e70: 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 65 73 74  g bool]].Request
5e80: 20 61 20 63 65 72 74 69 66 69 63 61 74 65 20 66   a certificate f
5e90: 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64 75 72  rom the peer dur
5ea0: 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61 6e 64  ing the SSL hand
5eb0: 73 68 61 6b 65 2e 20 54 68 69 73 20 69 73 20 6e  shake. This is n
5ec0: 65 65 64 65 64 0a 74 6f 20 64 6f 20 43 65 72 74  eeded.to do Cert
5ed0: 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69  ificate Validati
5ee0: 6f 6e 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20  on. Starting in 
5ef0: 54 63 6c 54 4c 53 20 31 2e 38 2c 20 74 68 65 20  TclTLS 1.8, the 
5f00: 64 65 66 61 75 6c 74 20 69 73 0a 5b 63 6f 6e 73  default is.[cons
5f10: 74 20 74 72 75 65 5d 20 66 6f 72 20 63 6c 69 65  t true] for clie
5f20: 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 2e 20  nt connections. 
5f30: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54  Starting in TclT
5f40: 4c 53 20 32 2e 30 2c 20 69 66 20 73 65 74 20 74  LS 2.0, if set t
5f50: 6f 0a 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20  o.[const false] 
5f60: 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71  and [option -req
5f70: 75 69 72 65 5d 20 69 73 20 5b 63 6f 6e 73 74 20  uire] is [const 
5f80: 74 72 75 65 5d 2c 20 74 68 65 6e 20 74 68 69 73  true], then this
5f90: 20 77 69 6c 6c 20 62 65 0a 6f 76 65 72 72 69 64   will be.overrid
5fa0: 64 65 6e 20 74 6f 20 5b 63 6f 6e 73 74 20 74 72  den to [const tr
5fb0: 75 65 5d 2e 20 49 6e 20 61 64 64 69 74 69 6f 6e  ue]. In addition
5fc0: 2c 20 74 68 65 20 63 6c 69 65 6e 74 20 63 61 6e  , the client can
5fd0: 20 6d 61 6e 75 61 6c 6c 79 20 69 6e 73 70 65 63   manually inspec
5fe0: 74 20 61 6e 64 0a 61 63 63 65 70 74 20 6f 72 20  t and.accept or 
5ff0: 72 65 6a 65 63 74 20 65 61 63 68 20 63 65 72 74  reject each cert
6000: 69 66 69 63 61 74 65 20 75 73 69 6e 67 20 74 68  ificate using th
6010: 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64  e [option -valid
6020: 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69  atecommand] opti
6030: 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72  on...[opt_def -r
6040: 65 71 75 69 72 65 20 5b 61 72 67 20 62 6f 6f 6c  equire [arg bool
6050: 5d 5d 0a 52 65 71 75 69 72 65 20 61 20 76 61 6c  ]].Require a val
6060: 69 64 20 63 65 72 74 69 66 69 63 61 74 65 20 66  id certificate f
6070: 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64 75 72  rom the peer dur
6080: 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61 6e 64  ing the SSL hand
6090: 73 68 61 6b 65 2e 20 49 66 20 74 68 69 73 20 69  shake. If this i
60a0: 73 0a 73 65 74 20 74 6f 20 74 72 75 65 2c 20 74  s.set to true, t
60b0: 68 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71  hen [option -req
60c0: 75 65 73 74 5d 20 6d 75 73 74 20 61 6c 73 6f 20  uest] must also 
60d0: 62 65 20 73 65 74 20 74 6f 20 74 72 75 65 20 61  be set to true a
60e0: 6e 64 20 61 20 65 69 74 68 65 72 0a 5b 6f 70 74  nd a either.[opt
60f0: 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70  ion -cadir], [op
6100: 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 5b  tion -cafile], [
6110: 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d  option -castore]
6120: 2c 20 6f 72 20 61 20 70 6c 61 74 66 6f 72 6d 20  , or a platform 
6130: 64 65 66 61 75 6c 74 0a 6d 75 73 74 20 62 65 20  default.must be 
6140: 70 72 6f 76 69 64 65 64 20 69 6e 20 6f 72 64 65  provided in orde
6150: 72 20 74 6f 20 76 61 6c 69 64 61 74 65 20 61 67  r to validate ag
6160: 61 69 6e 73 74 2e 20 54 68 65 20 64 65 66 61 75  ainst. The defau
6170: 6c 74 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38  lt in TclTLS 1.8
6180: 20 61 6e 64 0a 65 61 72 6c 69 65 72 20 76 65 72   and.earlier ver
6190: 73 69 6f 6e 73 20 69 73 20 5b 63 6f 6e 73 74 20  sions is [const 
61a0: 66 61 6c 73 65 5d 20 73 69 6e 63 65 20 6e 6f 74  false] since not
61b0: 20 61 6c 6c 20 70 6c 61 74 66 6f 72 6d 73 20 68   all platforms h
61c0: 61 76 65 20 63 65 72 74 69 66 69 63 61 74 65 73  ave certificates
61d0: 20 74 6f 0a 76 61 6c 69 64 61 74 65 20 61 67 61   to.validate aga
61e0: 69 6e 73 74 20 69 6e 20 61 20 66 6f 72 6d 20 63  inst in a form c
61f0: 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68 20 4f  ompatible with O
6200: 70 65 6e 53 53 4c 2e 20 53 74 61 72 74 69 6e 67  penSSL. Starting
6210: 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 0a   in TclTLS 2.0,.
6220: 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  the default is [
6230: 63 6f 6e 73 74 20 74 72 75 65 5d 20 66 6f 72 20  const true] for 
6240: 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f  client connectio
6250: 6e 73 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  ns...[list_end].
6260: 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 57 68  .[subsection "Wh
6270: 65 6e 20 61 72 65 20 63 6f 6d 6d 61 6e 64 20 6c  en are command l
6280: 69 6e 65 20 6f 70 74 69 6f 6e 73 20 6e 65 65 64  ine options need
6290: 65 64 3f 22 5d 0a 0a 49 6e 20 54 63 6c 54 4c 53  ed?"]..In TclTLS
62a0: 20 31 2e 38 20 61 6e 64 20 65 61 72 6c 69 65 72   1.8 and earlier
62b0: 20 76 65 72 73 69 6f 6e 73 2c 20 63 65 72 74 69   versions, certi
62c0: 66 69 63 61 74 65 20 76 61 6c 69 64 61 74 69 6f  ficate validatio
62d0: 6e 20 69 73 0a 5b 65 6d 70 68 20 4e 4f 54 5d 20  n is.[emph NOT] 
62e0: 65 6e 61 62 6c 65 64 20 62 79 20 64 65 66 61 75  enabled by defau
62f0: 6c 74 2e 20 54 68 69 73 20 6c 69 6d 69 74 61 74  lt. This limitat
6300: 69 6f 6e 20 69 73 20 64 75 65 20 74 6f 20 74 68  ion is due to th
6310: 65 20 6c 61 63 6b 20 6f 66 20 61 20 63 6f 6d 6d  e lack of a comm
6320: 6f 6e 0a 63 72 6f 73 73 20 70 6c 61 74 66 6f 72  on.cross platfor
6330: 6d 20 64 61 74 61 62 61 73 65 20 6f 66 20 43 65  m database of Ce
6340: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
6350: 69 74 79 20 28 43 41 29 20 70 72 6f 76 69 64 65  ity (CA) provide
6360: 64 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74  d certificates t
6370: 6f 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e  o.validate again
6380: 73 74 2e 20 4d 61 6e 79 20 4c 69 6e 75 78 20 73  st. Many Linux s
6390: 79 73 74 65 6d 73 20 6e 61 74 69 76 65 6c 79 20  ystems natively 
63a0: 73 75 70 70 6f 72 74 20 4f 70 65 6e 53 53 4c 20  support OpenSSL 
63b0: 61 6e 64 20 74 68 75 73 20 68 61 76 65 0a 74 68  and thus have.th
63c0: 65 73 65 20 63 65 72 74 69 66 69 63 61 74 65 73  ese certificates
63d0: 20 69 6e 73 74 61 6c 6c 65 64 20 61 73 20 70 61   installed as pa
63e0: 72 74 20 6f 66 20 74 68 65 20 4f 53 2c 20 62 75  rt of the OS, bu
63f0: 74 20 4d 61 63 4f 53 20 61 6e 64 20 4d 53 20 57  t MacOS and MS W
6400: 69 6e 64 6f 77 73 20 64 6f 20 6e 6f 74 2e 0a 53  indows do not..S
6410: 74 61 72 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53  taring in TclTLS
6420: 20 32 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c   2.0, the defaul
6430: 74 20 66 6f 72 20 63 6c 69 65 6e 74 20 63 6f 6e  t for client con
6440: 6e 65 63 74 69 6f 6e 73 20 68 61 73 20 62 65 65  nections has bee
6450: 6e 20 63 68 61 6e 67 65 64 20 74 6f 0a 72 65 71  n changed to.req
6460: 75 69 72 65 20 63 65 72 74 69 66 69 63 61 74 65  uire certificate
6470: 20 76 61 6c 69 64 61 74 69 6f 6e 20 62 79 20 64   validation by d
6480: 65 66 61 75 6c 74 2e 20 49 6e 20 6f 72 64 65 72  efault. In order
6490: 20 74 6f 20 75 73 65 20 74 68 65 20 5b 6f 70 74   to use the [opt
64a0: 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 0a 6f 70  ion -require].op
64b0: 74 69 6f 6e 2c 20 6f 6e 65 20 6f 66 20 74 68 65  tion, one of the
64c0: 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d 75 73 74 20   following must 
64d0: 62 65 20 74 72 75 65 3a 0a 0a 5b 6c 69 73 74 5f  be true:..[list_
64e0: 62 65 67 69 6e 20 69 74 65 6d 69 7a 65 64 5d 0a  begin itemized].
64f0: 0a 5b 69 74 65 6d 5d 0a 4f 6e 20 4c 69 6e 75 78  .[item].On Linux
6500: 20 61 6e 64 20 55 6e 69 78 20 73 79 73 74 65 6d   and Unix system
6510: 73 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 61  s with OpenSSL a
6520: 6c 72 65 61 64 79 20 69 6e 73 74 61 6c 6c 65 64  lready installed
6530: 20 6f 72 20 69 66 20 74 68 65 20 43 41 0a 63 65   or if the CA.ce
6540: 72 74 69 66 69 63 61 74 65 73 20 61 72 65 20 61  rtificates are a
6550: 76 61 69 6c 61 62 6c 65 20 69 6e 20 50 45 4d 20  vailable in PEM 
6560: 66 6f 72 6d 61 74 2c 20 61 6e 64 20 69 66 20 74  format, and if t
6570: 68 65 79 20 61 72 65 20 73 74 6f 72 65 64 20 69  hey are stored i
6580: 6e 20 74 68 65 0a 73 74 61 6e 64 61 72 64 20 6c  n the.standard l
6590: 6f 63 61 74 69 6f 6e 73 2c 20 6f 72 20 69 66 20  ocations, or if 
65a0: 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52  the [var SSL_CER
65b0: 54 5f 44 49 52 5d 20 6f 72 20 5b 76 61 72 20 53  T_DIR] or [var S
65c0: 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 0a 65 6e  SL_CERT_FILE].en
65d0: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62  vironment variab
65e0: 6c 65 73 20 61 72 65 20 73 65 74 2c 20 74 68 65  les are set, the
65f0: 6e 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72  n [option -cadir
6600: 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  ], [option -cadi
6610: 72 5d 2c 0a 61 6e 64 20 5b 6f 70 74 69 6f 6e 20  r],.and [option 
6620: 2d 63 61 73 74 6f 72 65 5d 20 61 72 65 6e 27 74  -castore] aren't
6630: 20 6e 65 65 64 65 64 2e 0a 0a 5b 69 74 65 6d 5d   needed...[item]
6640: 0a 49 66 20 4f 70 65 6e 53 53 4c 20 69 73 20 6e  .If OpenSSL is n
6650: 6f 74 20 69 6e 73 74 61 6c 6c 65 64 20 69 6e 20  ot installed in 
6660: 74 68 65 20 64 65 66 61 75 6c 74 20 6c 6f 63 61  the default loca
6670: 74 69 6f 6e 2c 20 6f 72 20 77 68 65 6e 20 75 73  tion, or when us
6680: 69 6e 67 20 4d 61 63 20 4f 53 0a 6f 72 20 4d 53  ing Mac OS.or MS
6690: 20 57 69 6e 64 6f 77 73 20 61 6e 64 20 4f 70 65   Windows and Ope
66a0: 6e 53 53 4c 20 69 73 20 69 6e 73 74 61 6c 6c 65  nSSL is installe
66b0: 64 2c 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f  d, the [var SSL_
66c0: 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f 6f 72  CERT_DIR] and/or
66d0: 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46  .[var SSL_CERT_F
66e0: 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74  ILE] environment
66f0: 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20 74 68   variables or th
6700: 65 20 6f 6e 65 20 6f 66 20 74 68 65 20 5b 6f 70  e one of the [op
6710: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f  tion -cadir],.[o
6720: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 6f  ption -cadir], o
6730: 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  r [option -casto
6740: 72 65 5d 20 6f 70 74 69 6f 6e 73 20 6d 75 73 74  re] options must
6750: 20 62 65 20 64 65 66 69 6e 65 64 2e 0a 0a 5b 69   be defined...[i
6760: 74 65 6d 5d 0a 4f 6e 20 4d 53 20 57 69 6e 64 6f  tem].On MS Windo
6770: 77 73 2c 20 73 74 61 72 74 69 6e 67 20 69 6e 20  ws, starting in 
6780: 4f 70 65 6e 53 53 4c 20 33 2e 32 2c 20 69 74 20  OpenSSL 3.2, it 
6790: 69 73 20 6e 6f 77 20 70 6f 73 73 69 62 6c 65 20  is now possible 
67a0: 74 6f 20 61 63 63 65 73 73 20 74 68 65 0a 62 75  to access the.bu
67b0: 69 6c 74 2d 69 6e 20 57 69 6e 64 6f 77 73 20 43  ilt-in Windows C
67c0: 65 72 74 69 66 69 63 61 74 65 20 53 74 6f 72 65  ertificate Store
67d0: 20 66 72 6f 6d 20 4f 70 65 6e 53 53 4c 2e 20 54   from OpenSSL. T
67e0: 68 69 73 20 63 61 6e 20 62 65 20 75 74 69 6c 69  his can be utili
67f0: 7a 65 64 20 62 79 0a 73 65 74 74 69 6e 67 20 74  zed by.setting t
6800: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74  he [option -cast
6810: 6f 72 65 5d 20 6f 70 74 69 6f 6e 20 74 6f 20 22  ore] option to "
6820: 5b 63 6f 6e 73 74 20 6f 72 67 2e 6f 70 65 6e 73  [const org.opens
6830: 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 5d 22  sl.winstore://]"
6840: 2e 0a 49 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c  ..In TclTLS 2.0,
6850: 20 74 68 69 73 20 69 73 20 74 68 65 20 64 65 66   this is the def
6860: 61 75 6c 74 20 76 61 6c 75 65 20 69 66 20 5b 6f  ault value if [o
6870: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b  ption -cadir],.[
6880: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20  option -cadir], 
6890: 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73  and [option -cas
68a0: 74 6f 72 65 5d 20 61 72 65 20 6e 6f 74 20 73 70  tore] are not sp
68b0: 65 63 69 66 69 65 64 2e 0a 0a 5b 69 74 65 6d 5d  ecified...[item]
68c0: 0a 49 66 20 4f 70 65 6e 53 53 4c 20 69 73 20 6e  .If OpenSSL is n
68d0: 6f 74 20 69 6e 73 74 61 6c 6c 65 64 20 6f 72 20  ot installed or 
68e0: 74 68 65 20 43 41 20 63 65 72 74 69 66 69 63 61  the CA certifica
68f0: 74 65 73 20 61 72 65 20 6e 6f 74 20 61 76 61 69  tes are not avai
6900: 6c 61 62 6c 65 20 69 6e 20 50 45 4d 0a 66 6f 72  lable in PEM.for
6910: 6d 61 74 2c 20 74 68 65 20 43 41 20 63 65 72 74  mat, the CA cert
6920: 69 66 69 63 61 74 65 73 20 6d 75 73 74 20 62 65  ificates must be
6930: 20 64 6f 77 6e 6c 6f 61 64 65 64 20 61 6e 64 20   downloaded and 
6940: 69 6e 73 74 61 6c 6c 65 64 20 77 69 74 68 20 74  installed with t
6950: 68 65 20 75 73 65 72 0a 73 6f 66 74 77 61 72 65  he user.software
6960: 2e 20 54 68 65 20 43 55 52 4c 20 74 65 61 6d 20  . The CURL team 
6970: 6d 61 6b 65 73 20 74 68 65 6d 20 61 76 61 69 6c  makes them avail
6980: 61 62 6c 65 20 61 74 0a 5b 75 72 69 20 22 68 74  able at.[uri "ht
6990: 74 70 73 3a 2f 2f 63 75 72 6c 2e 73 65 2f 64 6f  tps://curl.se/do
69a0: 63 73 2f 63 61 65 78 74 72 61 63 74 2e 68 74 6d  cs/caextract.htm
69b0: 6c 22 20 22 43 41 20 63 65 72 74 69 66 69 63 61  l" "CA certifica
69c0: 74 65 73 20 65 78 74 72 61 63 74 65 64 0a 66 72  tes extracted.fr
69d0: 6f 6d 20 4d 6f 7a 69 6c 6c 61 22 5d 20 69 6e 20  om Mozilla"] in 
69e0: 74 68 65 20 5b 66 69 6c 65 20 63 61 63 65 72 74  the [file cacert
69f0: 2e 70 65 6d 5d 20 66 69 6c 65 2e 20 59 6f 75 20  .pem] file. You 
6a00: 6d 75 73 74 20 74 68 65 6e 20 65 69 74 68 65 72  must then either
6a10: 20 73 65 74 20 74 68 65 0a 5b 76 61 72 20 53 53   set the.[var SS
6a20: 4c 5f 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f  L_CERT_DIR] and/
6a30: 6f 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54  or [var SSL_CERT
6a40: 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65  _FILE] environme
6a50: 6e 74 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20  nt variables or 
6a60: 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  the.[option -cad
6a70: 69 72 5d 20 6f 72 20 5b 6f 70 74 69 6f 6e 20 2d  ir] or [option -
6a80: 63 61 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20  cafile] options 
6a90: 74 6f 20 74 68 65 20 43 41 20 63 65 72 74 20 66  to the CA cert f
6aa0: 69 6c 65 27 73 20 69 6e 73 74 61 6c 6c 0a 6c 6f  ile's install.lo
6ab0: 63 61 74 69 6f 6e 2e 20 49 74 20 69 73 20 79 6f  cation. It is yo
6ac0: 75 72 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74  ur responsibilit
6ad0: 79 20 74 6f 20 6b 65 65 70 20 74 68 69 73 20 66  y to keep this f
6ae0: 69 6c 65 20 75 70 20 74 6f 20 64 61 74 65 2e 0a  ile up to date..
6af0: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 65  .[list_end]..[se
6b00: 63 74 69 6f 6e 20 22 43 61 6c 6c 62 61 63 6b 20  ction "Callback 
6b10: 4f 70 74 69 6f 6e 73 22 5d 0a 0a 41 73 20 70 72  Options"]..As pr
6b20: 65 76 69 6f 75 73 6c 79 20 64 65 73 63 72 69 62  eviously describ
6b30: 65 64 2c 20 65 61 63 68 20 63 68 61 6e 6e 65 6c  ed, each channel
6b40: 20 63 61 6e 20 62 65 20 67 69 76 65 6e 20 74 68   can be given th
6b50: 65 69 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b  eir own callback
6b60: 73 0a 74 6f 20 68 61 6e 64 6c 65 20 69 6e 74 65  s.to handle inte
6b70: 72 6d 65 64 69 61 74 65 20 70 72 6f 63 65 73 73  rmediate process
6b80: 69 6e 67 20 62 79 20 74 68 65 20 4f 70 65 6e 53  ing by the OpenS
6b90: 53 4c 20 6c 69 62 72 61 72 79 2c 20 75 73 69 6e  SL library, usin
6ba0: 67 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63  g the.[option -c
6bb0: 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e  ommand], [option
6bc0: 20 2d 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64   -password], and
6bd0: 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61   [option -valida
6be0: 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69  te_command] opti
6bf0: 6f 6e 73 0a 70 61 73 73 65 64 20 74 6f 20 65 69  ons.passed to ei
6c00: 74 68 65 72 20 6f 66 20 5b 63 6d 64 20 74 6c 73  ther of [cmd tls
6c10: 3a 3a 73 6f 63 6b 65 74 5d 20 6f 72 20 5b 63 6d  ::socket] or [cm
6c20: 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e 0a  d tls::import]..
6c30: 55 6e 6c 69 6b 65 20 70 72 65 76 69 6f 75 73 20  Unlike previous 
6c40: 76 65 72 73 69 6f 6e 73 20 6f 66 20 54 63 6c 54  versions of TclT
6c50: 4c 53 2c 20 6f 6e 6c 79 20 69 66 20 74 68 65 20  LS, only if the 
6c60: 63 61 6c 6c 62 61 63 6b 20 67 65 6e 65 72 61 74  callback generat
6c70: 65 73 20 61 6e 20 65 72 72 6f 72 2c 0a 77 69 6c  es an error,.wil
6c80: 6c 20 74 68 65 20 5b 73 79 73 63 6d 64 20 62 67  l the [syscmd bg
6c90: 65 72 72 6f 72 5d 20 63 6f 6d 6d 61 6e 64 20 62  error] command b
6ca0: 65 20 69 6e 76 6f 6b 65 64 20 77 69 74 68 20 74  e invoked with t
6cb0: 68 65 20 65 72 72 6f 72 20 69 6e 66 6f 72 6d 61  he error informa
6cc0: 74 69 6f 6e 2e 0a 0a 5b 73 75 62 73 65 63 74 69  tion...[subsecti
6cd0: 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 20 43  on "Values for C
6ce0: 6f 6d 6d 61 6e 64 20 43 61 6c 6c 62 61 63 6b 22  ommand Callback"
6cf0: 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20  ]..The callback 
6d00: 66 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  for the [option 
6d10: 2d 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e  -command] option
6d20: 20 69 73 20 69 6e 76 6f 6b 65 64 20 61 74 20 73   is invoked at s
6d30: 65 76 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75  everal points du
6d40: 72 69 6e 67 20 74 68 65 0a 4f 70 65 6e 53 53 4c  ring the.OpenSSL
6d50: 20 68 61 6e 64 73 68 61 6b 65 20 61 6e 64 20 64   handshake and d
6d60: 75 72 69 6e 67 20 72 6f 75 74 69 6e 65 20 6f 70  uring routine op
6d70: 65 72 61 74 69 6f 6e 73 2e 20 53 65 65 20 62 65  erations. See be
6d80: 6c 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73  low for the poss
6d90: 69 62 6c 65 0a 61 72 67 75 6d 65 6e 74 73 20 70  ible.arguments p
6da0: 61 73 73 65 64 20 74 6f 20 74 68 65 20 63 61 6c  assed to the cal
6db0: 6c 62 61 63 6b 20 73 63 72 69 70 74 2e 20 56 61  lback script. Va
6dc0: 6c 75 65 73 20 72 65 74 75 72 6e 65 64 20 66 72  lues returned fr
6dd0: 6f 6d 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20  om the callback 
6de0: 61 72 65 0a 69 67 6e 6f 72 65 64 2e 0a 0a 5b 6c  are.ignored...[l
6df0: 69 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e  ist_begin option
6e00: 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 65 72 72  s]..[opt_def err
6e10: 6f 72 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c  or [arg "channel
6e20: 49 64 20 6d 65 73 73 61 67 65 22 5d 5d 0a 54 68  Id message"]].Th
6e30: 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62  is form of callb
6e40: 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77  ack is invoked w
6e50: 68 65 6e 65 76 65 72 20 61 6e 20 65 72 72 6f 72  henever an error
6e60: 20 6f 63 63 75 72 73 20 64 75 72 69 6e 67 20 74   occurs during t
6e70: 68 65 20 69 6e 69 74 69 61 6c 0a 63 6f 6e 6e 65  he initial.conne
6e80: 63 74 69 6f 6e 2c 20 68 61 6e 64 73 68 61 6b 65  ction, handshake
6e90: 2c 20 6f 72 20 49 2f 4f 20 6f 70 65 72 61 74 69  , or I/O operati
6ea0: 6f 6e 73 2e 20 54 68 65 20 5b 61 72 67 20 6d 65  ons. The [arg me
6eb0: 73 73 61 67 65 5d 20 61 72 67 75 6d 65 6e 74 20  ssage] argument 
6ec0: 63 61 6e 20 62 65 0a 66 72 6f 6d 20 74 68 65 20  can be.from the 
6ed0: 54 63 6c 5f 45 72 72 6e 6f 4d 73 67 2c 20 4f 70  Tcl_ErrnoMsg, Op
6ee0: 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 20 5b  enSSL function [
6ef0: 66 75 6e 20 45 52 52 5f 72 65 61 73 6f 6e 5f 65  fun ERR_reason_e
6f00: 72 72 6f 72 5f 73 74 72 69 6e 67 28 29 5d 2c 0a  rror_string()],.
6f10: 6f 72 20 61 20 63 75 73 74 6f 6d 20 6d 65 73 73  or a custom mess
6f20: 61 67 65 2e 20 54 68 69 73 20 63 61 6c 6c 62 61  age. This callba
6f30: 63 6b 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ck is new for Tc
6f40: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f  lTLS 1.8...[opt_
6f50: 64 65 66 20 69 6e 66 6f 20 5b 61 72 67 20 22 63  def info [arg "c
6f60: 68 61 6e 6e 65 6c 49 64 20 6d 61 6a 6f 72 20 6d  hannelId major m
6f70: 69 6e 6f 72 20 6d 65 73 73 61 67 65 20 74 79 70  inor message typ
6f80: 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f  e"]].This form o
6f90: 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e  f callback is in
6fa0: 76 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65  voked by the Ope
6fb0: 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66  nSSL function.[f
6fc0: 75 6e 20 53 53 4c 5f 73 65 74 5f 69 6e 66 6f 5f  un SSL_set_info_
6fd0: 63 61 6c 6c 62 61 63 6b 28 29 5d 20 64 75 72 69  callback()] duri
6fe0: 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63  ng the initial c
6ff0: 6f 6e 6e 65 63 74 69 6f 6e 20 61 6e 64 20 68 61  onnection and ha
7000: 6e 64 73 68 61 6b 65 0a 6f 70 65 72 61 74 69 6f  ndshake.operatio
7010: 6e 73 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74  ns. The argument
7020: 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65  s are:..[list_be
7030: 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d  gin definitions]
7040: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 61 6a 6f  ..[def [arg majo
7050: 72 5d 5d 0a 4d 61 6a 6f 72 20 63 61 74 65 67 6f  r]].Major catego
7060: 72 79 20 66 6f 72 20 65 72 72 6f 72 2e 20 56 61  ry for error. Va
7070: 6c 69 64 20 65 6e 75 6d 73 20 61 72 65 3a 20 5b  lid enums are: [
7080: 63 6f 6e 73 74 20 68 61 6e 64 73 68 61 6b 65 5d  const handshake]
7090: 2c 20 5b 63 6f 6e 73 74 20 61 6c 65 72 74 5d 2c  , [const alert],
70a0: 0a 5b 63 6f 6e 73 74 20 63 6f 6e 6e 65 63 74 5d  .[const connect]
70b0: 2c 20 5b 63 6f 6e 73 74 20 61 63 63 65 70 74 5d  , [const accept]
70c0: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 69 6e  ...[def [arg min
70d0: 6f 72 5d 5d 0a 4d 69 6e 6f 72 20 63 61 74 65 67  or]].Minor categ
70e0: 6f 72 79 20 66 6f 72 20 65 72 72 6f 72 2e 20 56  ory for error. V
70f0: 61 6c 69 64 20 65 6e 75 6d 73 20 61 72 65 3a 20  alid enums are: 
7100: 5b 63 6f 6e 73 74 20 73 74 61 72 74 5d 2c 20 5b  [const start], [
7110: 63 6f 6e 73 74 20 64 6f 6e 65 5d 2c 20 5b 63 6f  const done], [co
7120: 6e 73 74 20 72 65 61 64 5d 2c 0a 5b 63 6f 6e 73  nst read],.[cons
7130: 74 20 77 72 69 74 65 5d 2c 20 5b 63 6f 6e 73 74  t write], [const
7140: 20 6c 6f 6f 70 5d 2c 20 5b 63 6f 6e 73 74 20 65   loop], [const e
7150: 78 69 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67  xit]...[def [arg
7160: 20 6d 65 73 73 61 67 65 5d 5d 0a 44 65 73 63 72   message]].Descr
7170: 69 70 74 69 76 65 20 6d 65 73 73 61 67 65 20 73  iptive message s
7180: 74 72 69 6e 67 20 77 68 69 63 68 20 6d 61 79 20  tring which may 
7190: 62 65 20 67 65 6e 65 72 61 74 65 64 20 65 69 74  be generated eit
71a0: 68 65 72 20 62 79 0a 5b 66 75 6e 20 53 53 4c 5f  her by.[fun SSL_
71b0: 73 74 61 74 65 5f 73 74 72 69 6e 67 5f 6c 6f 6e  state_string_lon
71c0: 67 28 29 5d 20 6f 72 20 5b 66 75 6e 20 53 53 4c  g()] or [fun SSL
71d0: 5f 61 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69  _alert_desc_stri
71e0: 6e 67 5f 6c 6f 6e 67 28 29 5d 2c 0a 64 65 70 65  ng_long()],.depe
71f0: 6e 64 69 6e 67 20 6f 6e 20 74 68 65 20 63 6f 6e  nding on the con
7200: 74 65 78 74 2e 0a 0a 5b 64 65 66 20 5b 61 72 67  text...[def [arg
7210: 20 74 79 70 65 5d 5d 0a 46 6f 72 20 61 6c 65 72   type]].For aler
7220: 74 73 2c 20 74 68 65 20 70 6f 73 73 69 62 6c 65  ts, the possible
7230: 20 76 61 6c 75 65 73 20 61 72 65 3a 20 5b 63 6f   values are: [co
7240: 6e 73 74 20 77 61 72 6e 69 6e 67 5d 2c 0a 5b 63  nst warning],.[c
7250: 6f 6e 73 74 20 66 61 74 61 6c 5d 2c 20 61 6e 64  onst fatal], and
7260: 20 5b 63 6f 6e 73 74 20 75 6e 6b 6e 6f 77 6e 5d   [const unknown]
7270: 2e 20 46 6f 72 20 6f 74 68 65 72 73 2c 20 5b 63  . For others, [c
7280: 6f 6e 73 74 20 69 6e 66 6f 5d 20 69 73 20 75 73  onst info] is us
7290: 65 64 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e  ed..This argumen
72a0: 74 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  t is new for Tcl
72b0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f  TLS 1.8...[list_
72c0: 65 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 6d  end]..[opt_def m
72d0: 65 73 73 61 67 65 20 5b 61 72 67 20 22 63 68 61  essage [arg "cha
72e0: 6e 6e 65 6c 49 64 20 64 69 72 65 63 74 69 6f 6e  nnelId direction
72f0: 20 76 65 72 73 69 6f 6e 20 63 6f 6e 74 65 6e 74   version content
7300: 5f 74 79 70 65 20 6d 65 73 73 61 67 65 22 5d 5d  _type message"]]
7310: 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61  .This form of ca
7320: 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65  llback is invoke
7330: 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c  d by the OpenSSL
7340: 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53   function.[fun S
7350: 53 4c 5f 73 65 74 5f 6d 73 67 5f 63 61 6c 6c 62  SL_set_msg_callb
7360: 61 63 6b 28 29 5d 20 77 68 65 6e 65 76 65 72 20  ack()] whenever 
7370: 61 20 6d 65 73 73 61 67 65 20 69 73 20 73 65 6e  a message is sen
7380: 74 20 6f 72 20 72 65 63 65 69 76 65 64 20 64 75  t or received du
7390: 72 69 6e 67 20 74 68 65 0a 69 6e 69 74 69 61 6c  ring the.initial
73a0: 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68 61 6e   connection, han
73b0: 64 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f  dshake, or I/O o
73c0: 70 65 72 61 74 69 6f 6e 73 2e 20 49 74 20 69 73  perations. It is
73d0: 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20   only available 
73e0: 77 68 65 6e 0a 4f 70 65 6e 53 53 4c 20 69 73 20  when.OpenSSL is 
73f0: 63 6f 6d 70 6c 69 65 64 20 77 69 74 68 20 74 68  complied with th
7400: 65 20 5b 63 6f 6e 73 74 20 65 6e 61 62 6c 65 2d  e [const enable-
7410: 73 73 6c 2d 74 72 61 63 65 5d 20 6f 70 74 69 6f  ssl-trace] optio
7420: 6e 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b  n. This callback
7430: 20 69 73 0a 6e 65 77 20 66 6f 72 20 54 63 6c 54   is.new for TclT
7440: 4c 53 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75  LS 1.8. The argu
7450: 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73  ments are:..[lis
7460: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
7470: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20  ons]..[def [arg 
7480: 64 69 72 65 63 74 69 6f 6e 5d 5d 0a 44 69 72 65  direction]].Dire
7490: 63 74 69 6f 6e 20 69 73 20 65 69 74 68 65 72 20  ction is either 
74a0: 5b 63 6f 6e 73 74 20 53 65 6e 74 5d 20 6f 72 20  [const Sent] or 
74b0: 5b 63 6f 6e 73 74 20 52 65 63 65 69 76 65 64 5d  [const Received]
74c0: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 76 65 72  ...[def [arg ver
74d0: 73 69 6f 6e 5d 5d 0a 56 65 72 73 69 6f 6e 20 69  sion]].Version i
74e0: 73 20 74 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76  s the protocol v
74f0: 65 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 5b 61  ersion...[def [a
7500: 72 67 20 63 6f 6e 74 65 6e 74 5f 74 79 70 65 5d  rg content_type]
7510: 5d 0a 43 6f 6e 74 65 6e 74 20 74 79 70 65 20 69  ].Content type i
7520: 73 20 74 68 65 20 6d 65 73 73 61 67 65 20 63 6f  s the message co
7530: 6e 74 65 6e 74 20 74 79 70 65 2e 0a 0a 5b 64 65  ntent type...[de
7540: 66 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 5d  f [arg message]]
7550: 0a 4d 65 73 73 61 67 65 20 69 73 20 6d 6f 72 65  .Message is more
7560: 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 5b   info from the [
7570: 63 6f 6e 73 74 20 53 53 4c 5f 74 72 61 63 65 5d  const SSL_trace]
7580: 20 41 50 49 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64   API...[list_end
7590: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 73 65 73 73  ]..[opt_def sess
75a0: 69 6f 6e 20 5b 61 72 67 20 22 63 68 61 6e 6e 65  ion [arg "channe
75b0: 6c 49 64 20 73 65 73 73 69 6f 6e 5f 69 64 20 73  lId session_id s
75c0: 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74 20 6c 69  ession_ticket li
75d0: 66 65 74 69 6d 65 22 5d 5d 0a 54 68 69 73 20 66  fetime"]].This f
75e0: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20  orm of callback 
75f0: 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68  is invoked by th
7600: 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69  e OpenSSL functi
7610: 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 43 54 58 5f  on.[fun SSL_CTX_
7620: 73 65 73 73 5f 73 65 74 5f 6e 65 77 5f 63 62 28  sess_set_new_cb(
7630: 29 5d 20 77 68 65 6e 65 76 65 72 20 61 20 6e 65  )] whenever a ne
7640: 77 20 73 65 73 73 69 6f 6e 20 69 64 20 69 73 20  w session id is 
7650: 73 65 6e 74 20 62 79 20 74 68 65 0a 73 65 72 76  sent by the.serv
7660: 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e  er during the in
7670: 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e  itial connection
7680: 20 61 6e 64 20 68 61 6e 64 73 68 61 6b 65 20 61   and handshake a
7690: 6e 64 20 61 6c 73 6f 20 64 75 72 69 6e 67 20 74  nd also during t
76a0: 68 65 20 73 65 73 73 69 6f 6e 0a 69 66 20 74 68  he session.if th
76b0: 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 6f 73 74 5f  e [option -post_
76c0: 68 61 6e 64 73 68 61 6b 65 5d 20 6f 70 74 69 6f  handshake] optio
76d0: 6e 20 69 73 20 73 65 74 20 74 6f 20 74 72 75 65  n is set to true
76e0: 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20  . This callback 
76f0: 69 73 20 6e 65 77 20 66 6f 72 0a 54 63 6c 54 4c  is new for.TclTL
7700: 53 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d  S 1.8. The argum
7710: 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74  ents are:..[list
7720: 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f  _begin definitio
7730: 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73  ns]..[def [arg s
7740: 65 73 73 69 6f 6e 5f 69 64 5d 5d 0a 53 65 73 73  ession_id]].Sess
7750: 69 6f 6e 20 49 64 20 69 73 20 74 68 65 20 63 75  ion Id is the cu
7760: 72 72 65 6e 74 20 73 65 73 73 69 6f 6e 20 69 64  rrent session id
7770: 65 6e 74 69 66 69 65 72 0a 0a 5b 64 65 66 20 5b  entifier..[def [
7780: 61 72 67 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b  arg session_tick
7790: 65 74 5d 5d 0a 54 69 63 6b 65 74 20 69 73 20 74  et]].Ticket is t
77a0: 68 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65  he session ticke
77b0: 74 20 69 6e 66 6f 0a 0a 5b 64 65 66 20 5b 61 72  t info..[def [ar
77c0: 67 20 6c 69 66 65 74 69 6d 65 5d 5d 0a 4c 69 66  g lifetime]].Lif
77d0: 65 74 69 6d 65 20 69 73 20 74 68 65 20 74 69 63  etime is the tic
77e0: 6b 65 74 20 6c 69 66 65 74 69 6d 65 20 69 6e 20  ket lifetime in 
77f0: 73 65 63 6f 6e 64 73 2e 0a 0a 5b 6c 69 73 74 5f  seconds...[list_
7800: 65 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 76  end]..[opt_def v
7810: 65 72 69 66 79 20 5b 61 72 67 20 22 63 68 61 6e  erify [arg "chan
7820: 6e 65 6c 49 64 20 64 65 70 74 68 20 63 65 72 74  nelId depth cert
7830: 20 73 74 61 74 75 73 20 65 72 72 6f 72 22 5d 5d   status error"]]
7840: 0a 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77  .This callback w
7850: 61 73 20 6d 6f 76 65 64 20 74 6f 20 5b 6f 70 74  as moved to [opt
7860: 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d  ion -validatecom
7870: 6d 61 6e 64 5d 20 69 6e 20 54 63 6c 54 4c 53 20  mand] in TclTLS 
7880: 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  1.8...[list_end]
7890: 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56  ..[subsection "V
78a0: 61 6c 75 65 73 20 66 6f 72 20 50 61 73 73 77 6f  alues for Passwo
78b0: 72 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54  rd Callback"]..T
78c0: 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20  he callback for 
78d0: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73  the [option -pas
78e0: 73 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 20 69 73  sword] option is
78f0: 20 69 6e 76 6f 6b 65 64 20 62 79 20 54 63 6c 54   invoked by TclT
7900: 4c 53 20 77 68 65 6e 65 76 65 72 20 4f 70 65 6e  LS whenever Open
7910: 53 53 4c 20 6e 65 65 64 73 0a 74 6f 20 6f 62 74  SSL needs.to obt
7920: 61 69 6e 20 61 20 70 61 73 73 77 6f 72 64 2e 20  ain a password. 
7930: 53 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 74 68  See below for th
7940: 65 20 70 6f 73 73 69 62 6c 65 20 61 72 67 75 6d  e possible argum
7950: 65 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20 74  ents passed to t
7960: 68 65 0a 63 61 6c 6c 62 61 63 6b 20 73 63 72 69  he.callback scri
7970: 70 74 2e 20 54 68 65 20 75 73 65 72 20 70 72 6f  pt. The user pro
7980: 76 69 64 65 64 20 70 61 73 73 77 6f 72 64 20 69  vided password i
7990: 73 20 65 78 70 65 63 74 65 64 20 74 6f 20 62 65  s expected to be
79a0: 20 72 65 74 75 72 6e 65 64 20 62 79 20 74 68 65   returned by the
79b0: 0a 63 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6c 69 73  .callback...[lis
79c0: 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d  t_begin options]
79d0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 70 61 73 73 77  ..[opt_def passw
79e0: 6f 72 64 20 5b 61 72 67 20 22 72 77 66 6c 61 67  ord [arg "rwflag
79f0: 20 73 69 7a 65 22 5d 5d 0a 49 6e 76 6f 6b 65 64   size"]].Invoked
7a00: 20 77 68 65 6e 20 6c 6f 61 64 69 6e 67 20 6f 72   when loading or
7a10: 20 73 74 6f 72 69 6e 67 20 61 6e 20 65 6e 63 72   storing an encr
7a20: 79 70 74 65 64 20 50 45 4d 20 63 65 72 74 69 66  ypted PEM certif
7a30: 69 63 61 74 65 2e 20 54 68 65 20 61 72 67 75 6d  icate. The argum
7a40: 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74  ents are:..[list
7a50: 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f  _begin definitio
7a60: 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 72  ns]..[def [arg r
7a70: 77 66 6c 61 67 5d 5d 0a 54 68 65 20 72 65 61 64  wflag]].The read
7a80: 2f 77 72 69 74 65 20 66 6c 61 67 20 69 73 20 30  /write flag is 0
7a90: 20 66 6f 72 20 72 65 61 64 69 6e 67 2f 64 65 63   for reading/dec
7aa0: 72 79 70 74 69 6f 6e 20 6f 72 20 31 20 66 6f 72  ryption or 1 for
7ab0: 20 77 72 69 74 69 6e 67 2f 65 6e 63 72 79 70 74   writing/encrypt
7ac0: 69 6f 6e 2e 0a 54 68 65 20 6c 61 74 74 65 72 20  ion..The latter 
7ad0: 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 64  can be used to d
7ae0: 65 74 65 72 6d 69 6e 65 20 77 68 65 6e 20 74 6f  etermine when to
7af0: 20 70 72 6f 6d 70 74 20 74 68 65 20 75 73 65 72   prompt the user
7b00: 20 74 6f 20 63 6f 6e 66 69 72 6d 2e 0a 54 68 69   to confirm..Thi
7b10: 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65  s argument is ne
7b20: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
7b30: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 69 7a  ...[def [arg siz
7b40: 65 5d 5d 0a 54 68 65 20 73 69 7a 65 20 69 73 20  e]].The size is 
7b50: 74 68 65 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67  the maximum leng
7b60: 74 68 20 6f 66 20 74 68 65 20 70 61 73 73 77 6f  th of the passwo
7b70: 72 64 20 69 6e 20 62 79 74 65 73 2e 0a 54 68 69  rd in bytes..Thi
7b80: 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65  s argument is ne
7b90: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
7ba0: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
7bb0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73  list_end]..[subs
7bc0: 65 63 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66  ection "Values f
7bd0: 6f 72 20 56 61 6c 69 64 61 74 65 20 43 6f 6d 6d  or Validate Comm
7be0: 61 6e 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a  and Callback"]..
7bf0: 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72  The callback for
7c00: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61   the [option -va
7c10: 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f  lidatecommand] o
7c20: 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64  ption is invoked
7c30: 20 64 75 72 69 6e 67 20 74 68 65 20 68 61 6e 64   during the hand
7c40: 73 68 61 6b 65 0a 70 72 6f 63 65 73 73 20 69 6e  shake.process in
7c50: 20 6f 72 64 65 72 20 66 6f 72 20 74 68 65 20 61   order for the a
7c60: 70 70 6c 69 63 61 74 69 6f 6e 20 74 6f 20 76 61  pplication to va
7c70: 6c 69 64 61 74 65 20 74 68 65 20 70 72 6f 76 69  lidate the provi
7c80: 64 65 64 20 76 61 6c 75 65 28 73 29 2e 20 53 65  ded value(s). Se
7c90: 65 0a 62 65 6c 6f 77 20 66 6f 72 20 74 68 65 20  e.below for the 
7ca0: 70 6f 73 73 69 62 6c 65 20 61 72 67 75 6d 65 6e  possible argumen
7cb0: 74 73 20 70 61 73 73 65 64 20 74 6f 20 74 68 65  ts passed to the
7cc0: 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74   callback script
7cd0: 2e 20 49 66 20 6e 6f 74 0a 73 70 65 63 69 66 69  . If not.specifi
7ce0: 65 64 2c 20 4f 70 65 6e 53 53 4c 20 77 69 6c 6c  ed, OpenSSL will
7cf0: 20 61 63 63 65 70 74 20 61 6c 6c 20 76 61 6c 69   accept all vali
7d00: 64 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61  d certificates a
7d10: 6e 64 20 65 78 74 65 6e 73 69 6f 6e 73 2e 20 54  nd extensions. T
7d20: 6f 20 72 65 6a 65 63 74 0a 74 68 65 20 76 61 6c  o reject.the val
7d30: 75 65 20 61 6e 64 20 61 62 6f 72 74 20 74 68 65  ue and abort the
7d40: 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 74 68 65   connection, the
7d50: 20 63 61 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64   callback should
7d60: 20 72 65 74 75 72 6e 20 30 2e 20 54 6f 20 61 63   return 0. To ac
7d70: 63 65 70 74 20 74 68 65 0a 76 61 6c 75 65 20 61  cept the.value a
7d80: 6e 64 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20  nd continue the 
7d90: 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 74 20 73  connection, it s
7da0: 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 31 2e 20  hould return 1. 
7db0: 54 6f 20 72 65 6a 65 63 74 20 74 68 65 20 76 61  To reject the va
7dc0: 6c 75 65 2c 20 62 75 74 0a 63 6f 6e 74 69 6e 75  lue, but.continu
7dd0: 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  e the connection
7de0: 2c 20 69 74 20 73 68 6f 75 6c 64 20 72 65 74 75  , it should retu
7df0: 72 6e 20 32 2e 20 54 68 69 73 20 63 61 6c 6c 62  rn 2. This callb
7e00: 61 63 6b 20 69 73 20 6e 65 77 20 66 6f 72 20 54  ack is new for T
7e10: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73  clTLS 1.8...[lis
7e20: 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d  t_begin options]
7e30: 0a 0a 5b 6f 70 74 5f 64 65 66 20 61 6c 70 6e 20  ..[opt_def alpn 
7e40: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20  [arg "channelId 
7e50: 70 72 6f 74 6f 63 6f 6c 20 6d 61 74 63 68 22 5d  protocol match"]
7e60: 5d 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74  ].For servers, t
7e70: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
7e80: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20  back is invoked 
7e90: 77 68 65 6e 20 74 68 65 20 63 6c 69 65 6e 74 20  when the client 
7ea0: 41 4c 50 4e 20 65 78 74 65 6e 73 69 6f 6e 20 69  ALPN extension i
7eb0: 73 0a 72 65 63 65 69 76 65 64 2e 20 49 66 20 5b  s.received. If [
7ec0: 61 72 67 20 6d 61 74 63 68 5d 20 69 73 20 74 72  arg match] is tr
7ed0: 75 65 2c 20 74 68 65 6e 20 5b 61 72 67 20 70 72  ue, then [arg pr
7ee0: 6f 74 6f 63 6f 6c 5d 20 69 73 20 74 68 65 20 66  otocol] is the f
7ef0: 69 72 73 74 0a 5b 6f 70 74 69 6f 6e 20 2d 61 6c  irst.[option -al
7f00: 70 6e 5d 20 70 72 6f 74 6f 63 6f 6c 20 6f 70 74  pn] protocol opt
7f10: 69 6f 6e 20 69 6e 20 63 6f 6d 6d 6f 6e 20 74 6f  ion in common to
7f20: 20 62 6f 74 68 20 74 68 65 20 63 6c 69 65 6e 74   both the client
7f30: 20 61 6e 64 20 73 65 72 76 65 72 2e 0a 49 66 20   and server..If 
7f40: 6e 6f 74 2c 20 74 68 65 20 66 69 72 73 74 20 63  not, the first c
7f50: 6c 69 65 6e 74 20 73 70 65 63 69 66 69 65 64 20  lient specified 
7f60: 70 72 6f 74 6f 63 6f 6c 20 69 73 20 75 73 65 64  protocol is used
7f70: 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20  . This callback 
7f80: 69 73 20 63 61 6c 6c 65 64 0a 61 66 74 65 72 20  is called.after 
7f90: 74 68 65 20 48 65 6c 6c 6f 20 61 6e 64 20 53 4e  the Hello and SN
7fa0: 49 20 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f  I callbacks...[o
7fb0: 70 74 5f 64 65 66 20 68 65 6c 6c 6f 20 5b 61 72  pt_def hello [ar
7fc0: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 72  g "channelId ser
7fd0: 76 65 72 6e 61 6d 65 20 73 65 73 73 69 6f 6e 5f  vername session_
7fe0: 69 64 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65 72  id"]].For server
7ff0: 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f 66 20  s, this form of 
8000: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f  callback is invo
8010: 6b 65 64 20 64 75 72 69 6e 67 20 63 6c 69 65 6e  ked during clien
8020: 74 20 68 65 6c 6c 6f 20 6d 65 73 73 61 67 65 0a  t hello message.
8030: 70 72 6f 63 65 73 73 69 6e 67 2e 20 54 68 65 20  processing. The 
8040: 70 75 72 70 6f 73 65 20 69 73 20 73 6f 20 74 68  purpose is so th
8050: 65 20 73 65 72 76 65 72 20 63 61 6e 20 73 65 6c  e server can sel
8060: 65 63 74 20 74 68 65 20 61 70 70 72 6f 70 72 69  ect the appropri
8070: 61 74 65 20 63 65 72 74 69 66 69 63 61 74 65 0a  ate certificate.
8080: 74 6f 20 70 72 65 73 65 6e 74 20 74 6f 20 74 68  to present to th
8090: 65 20 63 6c 69 65 6e 74 2c 20 61 6e 64 20 74 6f  e client, and to
80a0: 20 6d 61 6b 65 20 6f 74 68 65 72 20 63 6f 6e 66   make other conf
80b0: 69 67 75 72 61 74 69 6f 6e 20 61 64 6a 75 73 74  iguration adjust
80c0: 6d 65 6e 74 73 20 72 65 6c 65 76 61 6e 74 0a 74  ments relevant.t
80d0: 6f 20 74 68 61 74 20 73 65 72 76 65 72 20 6e 61  o that server na
80e0: 6d 65 20 61 6e 64 20 69 74 73 20 63 6f 6e 66 69  me and its confi
80f0: 67 75 72 61 74 69 6f 6e 2e 20 49 74 20 69 73 20  guration. It is 
8100: 63 61 6c 6c 65 64 20 62 65 66 6f 72 65 20 74 68  called before th
8110: 65 20 53 4e 49 20 61 6e 64 20 41 4c 50 4e 0a 63  e SNI and ALPN.c
8120: 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f 70 74 5f  allbacks...[opt_
8130: 64 65 66 20 73 6e 69 20 5b 61 72 67 20 22 63 68  def sni [arg "ch
8140: 61 6e 6e 65 6c 49 64 20 73 65 72 76 65 72 6e 61  annelId serverna
8150: 6d 65 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65 72  me"]].For server
8160: 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f 66 20  s, this form of 
8170: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f  callback is invo
8180: 6b 65 64 20 77 68 65 6e 20 74 68 65 20 53 65 72  ked when the Ser
8190: 76 65 72 20 4e 61 6d 65 20 49 6e 64 69 63 61 74  ver Name Indicat
81a0: 69 6f 6e 0a 28 53 4e 49 29 20 65 78 74 65 6e 73  ion.(SNI) extens
81b0: 69 6f 6e 20 69 73 20 72 65 63 65 69 76 65 64 2e  ion is received.
81c0: 20 54 68 65 20 5b 61 72 67 20 73 65 72 76 65 72   The [arg server
81d0: 6e 61 6d 65 5d 20 61 72 67 75 6d 65 6e 74 20 69  name] argument i
81e0: 73 20 74 68 65 20 63 6c 69 65 6e 74 0a 70 72 6f  s the client.pro
81f0: 76 69 64 65 64 20 73 65 72 76 65 72 20 6e 61 6d  vided server nam
8200: 65 20 73 70 65 63 69 66 69 65 64 20 69 6e 20 74  e specified in t
8210: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72 76  he [option -serv
8220: 65 72 6e 61 6d 65 5d 20 6f 70 74 69 6f 6e 2e 20  ername] option. 
8230: 54 68 65 0a 70 75 72 70 6f 73 65 20 69 73 20 73  The.purpose is s
8240: 6f 20 77 68 65 6e 20 61 20 73 65 72 76 65 72 20  o when a server 
8250: 73 75 70 70 6f 72 74 73 20 6d 75 6c 74 69 70 6c  supports multipl
8260: 65 20 6e 61 6d 65 73 2c 20 74 68 65 20 72 69 67  e names, the rig
8270: 68 74 20 63 65 72 74 69 66 69 63 61 74 65 0a 63  ht certificate.c
8280: 61 6e 20 62 65 20 75 73 65 64 2e 20 49 74 20 69  an be used. It i
8290: 73 20 63 61 6c 6c 65 64 20 61 66 74 65 72 20 74  s called after t
82a0: 68 65 20 48 65 6c 6c 6f 20 63 61 6c 6c 62 61 63  he Hello callbac
82b0: 6b 20 62 75 74 20 62 65 66 6f 72 65 20 74 68 65  k but before the
82c0: 20 41 4c 50 4e 0a 63 61 6c 6c 62 61 63 6b 2e 0a   ALPN.callback..
82d0: 0a 5b 6f 70 74 5f 64 65 66 20 76 65 72 69 66 79  .[opt_def verify
82e0: 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64   [arg "channelId
82f0: 20 64 65 70 74 68 20 63 65 72 74 20 73 74 61 74   depth cert stat
8300: 75 73 20 65 72 72 6f 72 22 5d 5d 0a 54 68 69 73  us error"]].This
8310: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63   form of callbac
8320: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20  k is invoked by 
8330: 4f 70 65 6e 53 53 4c 20 77 68 65 6e 20 61 20 6e  OpenSSL when a n
8340: 65 77 20 63 65 72 74 69 66 69 63 61 74 65 20 69  ew certificate i
8350: 73 20 72 65 63 65 69 76 65 64 0a 66 72 6f 6d 20  s received.from 
8360: 74 68 65 20 70 65 65 72 2e 20 49 74 20 61 6c 6c  the peer. It all
8370: 6f 77 73 20 74 68 65 20 63 6c 69 65 6e 74 20 74  ows the client t
8380: 6f 20 63 68 65 63 6b 20 74 68 65 20 63 65 72 74  o check the cert
8390: 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63 61  ificate verifica
83a0: 74 69 6f 6e 0a 72 65 73 75 6c 74 73 20 61 6e 64  tion.results and
83b0: 20 63 68 6f 6f 73 65 20 77 68 65 74 68 65 72 20   choose whether 
83c0: 74 6f 20 63 6f 6e 74 69 6e 75 65 20 6f 72 20 6e  to continue or n
83d0: 6f 74 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64  ot. It is called
83e0: 20 66 6f 72 20 65 61 63 68 0a 63 65 72 74 69 66   for each.certif
83f0: 69 63 61 74 65 20 69 6e 20 74 68 65 20 63 65 72  icate in the cer
8400: 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 2e 20  tificate chain. 
8410: 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 61  This callback wa
8420: 73 20 6d 6f 76 65 64 20 66 72 6f 6d 0a 5b 6f 70  s moved from.[op
8430: 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 69  tion -command] i
8440: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68  n TclTLS 1.8. Th
8450: 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a  e arguments are:
8460: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
8470: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
8480: 20 5b 61 72 67 20 64 65 70 74 68 5d 5d 0a 54 68   [arg depth]].Th
8490: 65 20 64 65 70 74 68 20 69 73 20 74 68 65 20 69  e depth is the i
84a0: 6e 74 65 67 65 72 20 64 65 70 74 68 20 6f 66 20  nteger depth of 
84b0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
84c0: 69 6e 20 74 68 65 20 63 65 72 74 69 66 69 63 61  in the certifica
84d0: 74 65 20 63 68 61 69 6e 2c 0a 77 68 65 72 65 20  te chain,.where 
84e0: 30 20 69 73 20 74 68 65 20 70 65 65 72 20 63 65  0 is the peer ce
84f0: 72 74 69 66 69 63 61 74 65 20 61 6e 64 20 68 69  rtificate and hi
8500: 67 68 65 72 20 76 61 6c 75 65 73 20 67 6f 69 6e  gher values goin
8510: 67 20 75 70 20 74 6f 20 74 68 65 20 43 65 72 74  g up to the Cert
8520: 69 66 69 63 61 74 65 0a 41 75 74 68 6f 72 69 74  ificate.Authorit
8530: 79 20 28 43 41 29 2e 0a 0a 5b 64 65 66 20 5b 61  y (CA)...[def [a
8540: 72 67 20 63 65 72 74 5d 5d 0a 54 68 65 20 63 65  rg cert]].The ce
8550: 72 74 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61  rt argument is a
8560: 20 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c   list of key-val
8570: 75 65 20 70 61 69 72 73 20 73 69 6d 69 6c 61 72  ue pairs similar
8580: 20 74 6f 20 74 68 6f 73 65 20 72 65 74 75 72 6e   to those return
8590: 65 64 20 62 79 0a 5b 63 6d 64 20 74 6c 73 3a 3a  ed by.[cmd tls::
85a0: 73 74 61 74 75 73 5d 2e 0a 0a 5b 64 65 66 20 5b  status]...[def [
85b0: 61 72 67 20 73 74 61 74 75 73 5d 5d 0a 54 68 65  arg status]].The
85c0: 20 73 74 61 74 75 73 20 61 72 67 75 6d 65 6e 74   status argument
85d0: 20 69 73 20 74 68 65 20 62 6f 6f 6c 65 61 6e 20   is the boolean 
85e0: 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 65 20  validity of the 
85f0: 63 75 72 72 65 6e 74 20 63 65 72 74 69 66 69 63  current certific
8600: 61 74 65 20 77 68 65 72 65 20 30 0a 69 73 20 69  ate where 0.is i
8610: 6e 76 61 6c 69 64 20 61 6e 64 20 31 20 69 73 20  nvalid and 1 is 
8620: 76 61 6c 69 64 2e 0a 0a 5b 64 65 66 20 5b 61 72  valid...[def [ar
8630: 67 20 65 72 72 6f 72 5d 5d 0a 54 68 65 20 65 72  g error]].The er
8640: 72 6f 72 20 61 72 67 75 6d 65 6e 74 20 69 73 20  ror argument is 
8650: 74 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67  the error messag
8660: 65 2c 20 69 66 20 61 6e 79 2c 20 67 65 6e 65 72  e, if any, gener
8670: 61 74 65 64 20 62 79 0a 5b 66 75 6e 20 58 35 30  ated by.[fun X50
8680: 39 5f 53 54 4f 52 45 5f 43 54 58 5f 67 65 74 5f  9_STORE_CTX_get_
8690: 65 72 72 6f 72 28 29 5d 2e 0a 0a 5b 6c 69 73 74  error()]...[list
86a0: 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64  _end]..[list_end
86b0: 5d 0a 0a 52 65 66 65 72 65 6e 63 65 20 69 6d 70  ]..Reference imp
86c0: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20  lementations of 
86d0: 74 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73 20  these callbacks 
86e0: 61 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e 20  are provided in 
86f0: 5b 66 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 0a 61  [file tls.tcl].a
8700: 73 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c  s [cmd tls::call
8710: 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a  back], [cmd tls:
8720: 3a 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 20  :password], and 
8730: 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61  [cmd tls::valida
8740: 74 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 72 65 73 70  te_command].resp
8750: 65 63 74 69 76 65 6c 79 2e 20 4e 6f 74 65 20 74  ectively. Note t
8760: 68 61 74 20 74 68 65 73 65 20 61 72 65 20 6f 6e  hat these are on
8770: 6c 79 20 5b 65 6d 70 68 20 73 61 6d 70 6c 65 5d  ly [emph sample]
8780: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73   implementations
8790: 2e 20 49 6e 20 61 20 6d 6f 72 65 0a 72 65 61 6c  . In a more.real
87a0: 69 73 74 69 63 20 64 65 70 6c 6f 79 6d 65 6e 74  istic deployment
87b0: 20 79 6f 75 20 77 6f 75 6c 64 20 73 70 65 63 69   you would speci
87c0: 66 79 20 79 6f 75 72 20 6f 77 6e 20 63 61 6c 6c  fy your own call
87d0: 62 61 63 6b 20 73 63 72 69 70 74 73 20 6f 6e 20  back scripts on 
87e0: 65 61 63 68 20 54 4c 53 0a 63 68 61 6e 6e 65 6c  each TLS.channel
87f0: 20 75 73 69 6e 67 20 74 68 65 20 5b 6f 70 74 69   using the [opti
8800: 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f  on -command], [o
8810: 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d  ption -password]
8820: 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 76  , and.[option -v
8830: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
8840: 20 6f 70 74 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61   options...[para
8850: 5d 0a 0a 54 68 65 20 64 65 66 61 75 6c 74 20 62  ]..The default b
8860: 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65  ehavior when the
8870: 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e   [option -comman
8880: 64 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d  d] and [option -
8890: 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64  validate_command
88a0: 5d 0a 6f 70 74 69 6f 6e 73 20 61 72 65 20 6e 6f  ].options are no
88b0: 74 20 73 70 65 63 69 66 69 65 64 2c 20 69 73 20  t specified, is 
88c0: 66 6f 72 20 54 63 6c 54 4c 53 20 74 6f 20 70 72  for TclTLS to pr
88d0: 6f 63 65 73 73 20 74 68 65 20 61 73 73 6f 63 69  ocess the associ
88e0: 61 74 65 64 20 6c 69 62 72 61 72 79 0a 63 61 6c  ated library.cal
88f0: 6c 62 61 63 6b 73 20 69 6e 74 65 72 6e 61 6c 6c  lbacks internall
8900: 79 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 62  y. The default b
8910: 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65  ehavior when the
8920: 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f   [option -passwo
8930: 72 64 5d 20 6f 70 74 69 6f 6e 0a 69 73 20 6e 6f  rd] option.is no
8940: 74 20 73 70 65 63 69 66 69 65 64 20 69 73 20 66  t specified is f
8950: 6f 72 20 54 63 6c 54 4c 53 20 74 6f 20 70 72 6f  or TclTLS to pro
8960: 63 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61  cess the associa
8970: 74 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c  ted library call
8980: 62 61 63 6b 73 20 62 79 0a 61 74 74 65 6d 70 74  backs by.attempt
8990: 69 6e 67 20 74 6f 20 63 61 6c 6c 20 5b 63 6d 64  ing to call [cmd
89a0: 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2e   tls::password].
89b0: 20 54 68 65 20 64 69 66 66 65 72 65 6e 63 65 20   The difference 
89c0: 62 65 74 77 65 65 6e 20 74 68 65 73 65 20 74 77  between these tw
89d0: 6f 0a 62 65 68 61 76 69 6f 72 73 20 69 73 20 61  o.behaviors is a
89e0: 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66 20   consequence of 
89f0: 6d 61 69 6e 74 61 69 6e 69 6e 67 20 63 6f 6d 70  maintaining comp
8a00: 61 74 69 62 69 6c 69 74 79 20 77 69 74 68 20 65  atibility with e
8a10: 61 72 6c 69 65 72 0a 69 6d 70 6c 65 6d 65 6e 74  arlier.implement
8a20: 61 74 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61 5d 0a  ations...[para].
8a30: 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65 20  .[emph "The use 
8a40: 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e 63 65  of the reference
8a50: 20 63 61 6c 6c 62 61 63 6b 73 20 5b 63 6d 64 20   callbacks [cmd 
8a60: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20  tls::callback], 
8a70: 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f  [cmd tls::passwo
8a80: 72 64 5d 2c 0a 61 6e 64 20 5b 63 6d 64 20 74 6c  rd],.and [cmd tl
8a90: 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d  s::validate_comm
8aa0: 61 6e 64 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f  and] is not reco
8ab0: 6d 6d 65 6e 64 65 64 2e 20 54 68 65 79 20 6d 61  mmended. They ma
8ac0: 79 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f  y be removed fro
8ad0: 6d 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65  m future release
8ae0: 73 2e 22 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 44  s."]..[section D
8af0: 65 62 75 67 5d 0a 0a 46 6f 72 20 6d 6f 73 74 20  ebug]..For most 
8b00: 64 65 62 75 67 67 69 6e 67 20 6e 65 65 64 73 2c  debugging needs,
8b10: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61   the [option -ca
8b20: 6c 6c 62 61 63 6b 5d 20 6f 70 74 69 6f 6e 20 63  llback] option c
8b30: 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 70 72  an be used to pr
8b40: 6f 76 69 64 65 0a 73 75 66 66 69 63 69 65 6e 74  ovide.sufficient
8b50: 20 69 6e 73 69 67 68 74 20 61 6e 64 20 69 6e 66   insight and inf
8b60: 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20  ormation on the 
8b70: 54 4c 53 20 68 61 6e 64 73 68 61 6b 65 20 61 6e  TLS handshake an
8b80: 64 20 70 72 6f 67 72 65 73 73 2e 20 49 66 0a 66  d progress. If.f
8b90: 75 72 74 68 65 72 20 74 72 6f 75 62 6c 65 73 68  urther troublesh
8ba0: 6f 6f 74 69 6e 67 20 69 6e 73 69 67 68 74 20 69  ooting insight i
8bb0: 73 20 6e 65 65 64 65 64 2c 20 74 68 65 20 63 6f  s needed, the co
8bc0: 6d 70 69 6c 65 20 74 69 6d 65 20 6f 70 74 69 6f  mpile time optio
8bd0: 6e 0a 5b 6f 70 74 69 6f 6e 20 2d 2d 65 6e 61 62  n.[option --enab
8be0: 6c 65 2d 64 65 62 75 67 5d 20 63 61 6e 20 62 65  le-debug] can be
8bf0: 20 75 73 65 64 20 74 6f 20 67 65 74 20 64 65 74   used to get det
8c00: 61 69 6c 65 64 20 65 78 65 63 75 74 69 6f 6e 20  ailed execution 
8c10: 66 6c 6f 77 20 73 74 61 74 75 73 2e 0a 0a 5b 70  flow status...[p
8c20: 61 72 61 5d 0a 0a 54 4c 53 20 6b 65 79 20 6c 6f  ara]..TLS key lo
8c30: 67 67 69 6e 67 20 63 61 6e 20 62 65 20 65 6e 61  gging can be ena
8c40: 62 6c 65 64 20 62 79 20 73 65 74 74 69 6e 67 20  bled by setting 
8c50: 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20  the environment 
8c60: 76 61 72 69 61 62 6c 65 0a 5b 76 61 72 20 53 53  variable.[var SS
8c70: 4c 4b 45 59 4c 4f 47 46 49 4c 45 5d 20 74 6f 20  LKEYLOGFILE] to 
8c80: 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20  the name of the 
8c90: 66 69 6c 65 20 74 6f 20 6c 6f 67 20 74 6f 2e 20  file to log to. 
8ca0: 54 68 65 6e 20 77 68 65 6e 65 76 65 72 20 54 4c  Then whenever TL
8cb0: 53 20 6b 65 79 0a 6d 61 74 65 72 69 61 6c 20 69  S key.material i
8cc0: 73 20 67 65 6e 65 72 61 74 65 64 20 6f 72 20 72  s generated or r
8cd0: 65 63 65 69 76 65 64 20 69 74 20 77 69 6c 6c 20  eceived it will 
8ce0: 62 65 20 6c 6f 67 67 65 64 20 74 6f 20 74 68 65  be logged to the
8cf0: 20 66 69 6c 65 2e 20 54 68 69 73 20 69 73 20 75   file. This is u
8d00: 73 65 66 75 6c 0a 66 6f 72 20 6c 6f 67 67 69 6e  seful.for loggin
8d10: 67 20 6b 65 79 20 64 61 74 61 20 66 6f 72 20 6e  g key data for n
8d20: 65 74 77 6f 72 6b 20 6c 6f 67 67 69 6e 67 20 74  etwork logging t
8d30: 6f 6f 6c 73 20 74 6f 20 75 73 65 20 74 6f 20 64  ools to use to d
8d40: 65 63 72 79 70 74 20 74 68 65 20 64 61 74 61 2e  ecrypt the data.
8d50: 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68 65 20 5b 76  ..[para]..The [v
8d60: 61 72 20 74 6c 73 3a 3a 64 65 62 75 67 5d 20 76  ar tls::debug] v
8d70: 61 72 69 61 62 6c 65 20 70 72 6f 76 69 64 65 73  ariable provides
8d80: 20 73 6f 6d 65 20 61 64 64 69 74 69 6f 6e 61 6c   some additional
8d90: 20 63 6f 6e 74 72 6f 6c 20 6f 76 65 72 20 74 68   control over th
8da0: 65 0a 64 65 62 75 67 20 6c 6f 67 67 69 6e 67 20  e.debug logging 
8db0: 69 6e 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a  in the [cmd tls:
8dc0: 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64  :callback], [cmd
8dd0: 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c   tls::password],
8de0: 20 61 6e 64 0a 5b 63 6d 64 20 74 6c 73 3a 3a 76   and.[cmd tls::v
8df0: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
8e00: 20 64 65 66 61 75 6c 74 20 68 61 6e 64 6c 65 72   default handler
8e10: 73 20 69 6e 20 5b 66 69 6c 65 20 74 6c 73 2e 74  s in [file tls.t
8e20: 63 6c 5d 2e 0a 54 68 65 20 64 65 66 61 75 6c 74  cl]..The default
8e30: 20 76 61 6c 75 65 20 69 73 20 30 20 77 69 74 68   value is 0 with
8e40: 20 68 69 67 68 65 72 20 76 61 6c 75 65 73 20 70   higher values p
8e50: 72 6f 64 75 63 69 6e 67 20 6d 6f 72 65 20 64 69  roducing more di
8e60: 61 67 6e 6f 73 74 69 63 20 6f 75 74 70 75 74 2c  agnostic output,
8e70: 0a 61 6e 64 20 77 69 6c 6c 20 61 6c 73 6f 20 66  .and will also f
8e80: 6f 72 63 65 20 74 68 65 20 76 65 72 69 66 79 20  orce the verify 
8e90: 6d 65 74 68 6f 64 20 69 6e 20 5b 63 6d 64 20 74  method in [cmd t
8ea0: 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 20 74 6f  ls::callback] to
8eb0: 20 61 63 63 65 70 74 20 74 68 65 0a 63 65 72 74   accept the.cert
8ec0: 69 66 69 63 61 74 65 2c 20 65 76 65 6e 20 69 66  ificate, even if
8ed0: 20 69 74 20 69 73 20 69 6e 76 61 6c 69 64 20 77   it is invalid w
8ee0: 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  hen the [option 
8ef0: 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64  -validatecommand
8f00: 5d 0a 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 20  ].option is set 
8f10: 74 6f 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c  to [cmd tls::val
8f20: 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 2e 0a  idate_command]..
8f30: 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70 68 20 22  .[para]..[emph "
8f40: 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 76  The use of the v
8f50: 61 72 69 61 62 6c 65 20 5b 76 61 72 20 74 6c 73  ariable [var tls
8f60: 3a 3a 64 65 62 75 67 5d 20 69 73 20 6e 6f 74 20  ::debug] is not 
8f70: 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49 74 20  recommended..It 
8f80: 6d 61 79 20 62 65 20 72 65 6d 6f 76 65 64 20 66  may be removed f
8f90: 72 6f 6d 20 66 75 74 75 72 65 20 72 65 6c 65 61  rom future relea
8fa0: 73 65 73 2e 22 5d 0a 0a 5b 73 65 63 74 69 6f 6e  ses."]..[section
8fb0: 20 22 45 78 61 6d 70 6c 65 73 22 5d 0a 0a 54 68   "Examples"]..Th
8fc0: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20  e following are 
8fd0: 65 78 61 6d 70 6c 65 20 73 63 72 69 70 74 73 20  example scripts 
8fe0: 74 6f 20 64 6f 77 6e 6c 6f 61 64 20 61 20 77 65  to download a we
8ff0: 62 70 61 67 65 20 61 6e 64 20 66 69 6c 65 20 75  bpage and file u
9000: 73 69 6e 67 20 74 68 65 0a 68 74 74 70 20 70 61  sing the.http pa
9010: 63 6b 61 67 65 2e 20 53 65 65 20 5b 73 65 63 74  ckage. See [sect
9020: 72 65 66 20 22 43 65 72 74 69 66 69 63 61 74 65  ref "Certificate
9030: 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f   Validation"] fo
9040: 72 20 77 68 65 6e 20 74 68 65 0a 5b 6f 70 74 69  r when the.[opti
9050: 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74  on -cadir], [opt
9060: 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 61 6e  ion -cafile], an
9070: 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  d [option -casto
9080: 72 65 5d 20 6f 70 74 69 6f 6e 73 20 61 72 65 20  re] options are 
9090: 61 6c 73 6f 0a 6e 65 65 64 65 64 2e 20 53 65 65  also.needed. See
90a0: 20 74 68 65 20 5b 66 69 6c 65 20 64 65 6d 6f 73   the [file demos
90b0: 5d 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 20  ] directory for 
90c0: 6d 6f 72 65 20 65 78 61 6d 70 6c 65 20 73 63 72  more example scr
90d0: 69 70 74 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 45  ipts...[para]..E
90e0: 78 61 6d 70 6c 65 20 23 31 3a 20 44 6f 77 6e 6c  xample #1: Downl
90f0: 6f 61 64 20 61 20 77 65 62 20 70 61 67 65 0a 0a  oad a web page..
9100: 5b 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b  [example {..pack
9110: 61 67 65 20 72 65 71 75 69 72 65 20 68 74 74 70  age require http
9120: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
9130: 20 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 68   tls..set url "h
9140: 74 74 70 73 3a 2f 2f 77 77 77 2e 74 63 6c 2e 74  ttps://www.tcl.t
9150: 6b 2f 22 0a 68 74 74 70 3a 3a 72 65 67 69 73 74  k/".http::regist
9160: 65 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c 69  er https 443 [li
9170: 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74  st ::tls::socket
9180: 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d 65   -autoservername
9190: 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d 0a 0a   1 -require 1]..
91a0: 23 20 47 65 74 20 55 52 4c 0a 73 65 74 20 74 6f  # Get URL.set to
91b0: 6b 65 6e 20 5b 68 74 74 70 3a 3a 67 65 74 75 72  ken [http::getur
91c0: 6c 20 24 75 72 6c 5d 0a 0a 23 20 43 68 65 63 6b  l $url]..# Check
91d0: 20 66 6f 72 20 65 72 72 6f 72 0a 69 66 20 7b 5b   for error.if {[
91e0: 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f  http::status $to
91f0: 6b 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a  ken] ne "ok"} {.
9200: 20 20 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 74      puts [format
9210: 20 22 45 72 72 6f 72 20 25 73 22 20 5b 68 74 74   "Error %s" [htt
9220: 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e  p::status $token
9230: 5d 5d 0a 7d 0a 0a 23 20 53 61 76 65 20 77 65 62  ]].}..# Save web
9240: 20 70 61 67 65 20 74 6f 20 66 69 6c 65 0a 73 65   page to file.se
9250: 74 20 63 68 20 5b 6f 70 65 6e 20 65 78 61 6d 70  t ch [open examp
9260: 6c 65 2e 68 74 6d 6c 20 77 62 5d 0a 70 75 74 73  le.html wb].puts
9270: 20 24 63 68 20 5b 68 74 74 70 3a 3a 64 61 74 61   $ch [http::data
9280: 20 24 74 6f 6b 65 6e 5d 0a 63 6c 6f 73 65 20 24   $token].close $
9290: 63 68 0a 0a 23 20 43 6c 65 61 6e 75 70 0a 3a 3a  ch..# Cleanup.::
92a0: 68 74 74 70 3a 3a 63 6c 65 61 6e 75 70 20 24 74  http::cleanup $t
92b0: 6f 6b 65 6e 0a 7d 5d 0a 0a 45 78 61 6d 70 6c 65  oken.}]..Example
92c0: 20 23 32 3a 20 44 6f 77 6e 6c 6f 61 64 20 61 20   #2: Download a 
92d0: 66 69 6c 65 0a 0a 5b 65 78 61 6d 70 6c 65 20 7b  file..[example {
92e0: 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  ..package requir
92f0: 65 20 68 74 74 70 0a 70 61 63 6b 61 67 65 20 72  e http.package r
9300: 65 71 75 69 72 65 20 74 6c 73 0a 0a 73 65 74 20  equire tls..set 
9310: 75 72 6c 20 22 68 74 74 70 73 3a 2f 2f 77 69 6b  url "https://wik
9320: 69 2e 74 63 6c 2d 6c 61 6e 67 2e 6f 72 67 2f 73  i.tcl-lang.org/s
9330: 69 74 65 6d 61 70 2e 78 6d 6c 22 0a 68 74 74 70  itemap.xml".http
9340: 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74 70 73  ::register https
9350: 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c 73   443 [list ::tls
9360: 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73 65  ::socket -autose
9370: 72 76 65 72 6e 61 6d 65 20 31 20 2d 72 65 71 75  rvername 1 -requ
9380: 69 72 65 20 31 5d 0a 0a 23 20 4f 70 65 6e 20 6f  ire 1]..# Open o
9390: 75 74 70 75 74 20 66 69 6c 65 0a 73 65 74 20 66  utput file.set f
93a0: 69 6c 65 6e 61 6d 65 20 5b 66 69 6c 65 20 74 61  ilename [file ta
93b0: 69 6c 20 24 75 72 6c 5d 0a 73 65 74 20 63 68 20  il $url].set ch 
93c0: 5b 6f 70 65 6e 20 24 66 69 6c 65 6e 61 6d 65 20  [open $filename 
93d0: 77 62 5d 0a 0a 23 20 47 65 74 20 66 69 6c 65 0a  wb]..# Get file.
93e0: 73 65 74 20 74 6f 6b 65 6e 20 5b 3a 3a 68 74 74  set token [::htt
93f0: 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c 20 2d  p::geturl $url -
9400: 62 6c 6f 63 6b 73 69 7a 65 20 36 35 35 33 36 20  blocksize 65536 
9410: 2d 63 68 61 6e 6e 65 6c 20 24 63 68 5d 0a 0a 23  -channel $ch]..#
9420: 20 43 68 65 63 6b 20 66 6f 72 20 65 72 72 6f 72   Check for error
9430: 0a 69 66 20 7b 5b 68 74 74 70 3a 3a 73 74 61 74  .if {[http::stat
9440: 75 73 20 24 74 6f 6b 65 6e 5d 20 6e 65 20 22 6f  us $token] ne "o
9450: 6b 22 7d 20 7b 0a 20 20 20 20 70 75 74 73 20 5b  k"} {.    puts [
9460: 66 6f 72 6d 61 74 20 22 45 72 72 6f 72 20 25 73  format "Error %s
9470: 22 20 5b 68 74 74 70 3a 3a 73 74 61 74 75 73 20  " [http::status 
9480: 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23 20 43 6c  $token]].}..# Cl
9490: 65 61 6e 75 70 0a 63 6c 6f 73 65 20 24 63 68 0a  eanup.close $ch.
94a0: 3a 3a 68 74 74 70 3a 3a 63 6c 65 61 6e 75 70 20  ::http::cleanup 
94b0: 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 5b 73 65 63 74  $token.}]..[sect
94c0: 69 6f 6e 20 22 53 70 65 63 69 61 6c 20 43 6f 6e  ion "Special Con
94d0: 73 69 64 65 72 61 74 69 6f 6e 73 22 5d 0a 0a 54  siderations"]..T
94e0: 68 65 20 63 61 70 61 62 69 6c 69 74 69 65 73 20  he capabilities 
94f0: 6f 66 20 74 68 69 73 20 70 61 63 6b 61 67 65 20  of this package 
9500: 63 61 6e 20 76 61 72 79 20 65 6e 6f 72 6d 6f 75  can vary enormou
9510: 73 6c 79 20 62 61 73 65 64 20 75 70 6f 6e 20 68  sly based upon h
9520: 6f 77 20 74 68 65 0a 6c 69 6e 6b 65 64 20 74 6f  ow the.linked to
9530: 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79   OpenSSL library
9540: 20 77 61 73 20 63 6f 6e 66 69 67 75 72 65 64 20   was configured 
9550: 61 6e 64 20 62 75 69 6c 74 2e 20 4e 65 77 20 76  and built. New v
9560: 65 72 73 69 6f 6e 73 20 6d 61 79 20 6f 62 73 6f  ersions may obso
9570: 6c 65 74 65 0a 6f 6c 64 65 72 20 70 72 6f 74 6f  lete.older proto
9580: 63 6f 6c 20 76 65 72 73 69 6f 6e 73 2c 20 61 64  col versions, ad
9590: 64 20 6f 72 20 72 65 6d 6f 76 65 20 63 69 70 68  d or remove ciph
95a0: 65 72 73 2c 20 63 68 61 6e 67 65 20 64 65 66 61  ers, change defa
95b0: 75 6c 74 20 76 61 6c 75 65 73 2c 20 65 74 63 2e  ult values, etc.
95c0: 0a 55 73 65 20 74 68 65 20 5b 63 6d 64 20 74 6c  .Use the [cmd tl
95d0: 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f  s::protocols] co
95e0: 6d 6d 61 6e 64 20 74 6f 20 6f 62 74 61 69 6e 20  mmand to obtain 
95f0: 74 68 65 20 73 75 70 70 6f 72 74 65 64 0a 70 72  the supported.pr
9600: 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 73 2e  otocol versions.
9610: 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 45 72 72 6f  ..[section "Erro
9620: 72 20 4d 65 73 73 61 67 65 73 22 5d 0a 0a 53 6f  r Messages"]..So
9630: 6d 65 20 4f 70 73 6e 53 53 6c 20 65 72 72 6f 72  me OpsnSSl error
9640: 20 6d 65 73 73 61 67 65 73 20 68 61 76 65 20 63   messages have c
9650: 72 79 70 74 69 63 20 6d 65 61 6e 69 6e 67 73 2e  ryptic meanings.
9660: 20 54 68 69 73 20 69 73 20 61 20 6c 69 73 74 20   This is a list 
9670: 6f 66 20 6d 65 73 73 61 67 65 73 0a 61 6c 6f 6e  of messages.alon
9680: 67 20 77 69 74 68 20 74 68 65 69 72 20 74 72 75  g with their tru
9690: 65 20 6d 65 61 6e 69 6e 67 2e 0a 0a 5b 6c 69 73  e meaning...[lis
96a0: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
96b0: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20  ons]..[def [arg 
96c0: 22 70 61 63 6b 65 74 20 6c 65 6e 67 74 68 20 74  "packet length t
96d0: 6f 6f 20 6c 6f 6e 67 22 5d 5d 0a 43 6c 69 65 6e  oo long"]].Clien
96e0: 74 20 68 61 73 20 74 72 69 65 64 20 74 6f 20 63  t has tried to c
96f0: 6f 6e 6e 65 63 74 20 74 6f 20 61 20 48 54 54 50  onnect to a HTTP
9700: 20 73 65 72 76 65 72 20 6f 6e 20 74 68 65 20 70   server on the p
9710: 6c 61 69 6e 2d 74 65 78 74 20 70 6f 72 74 20 69  lain-text port i
9720: 6e 73 74 65 61 64 20 6f 66 20 74 68 65 20 53 53  nstead of the SS
9730: 4c 2f 54 4c 53 20 70 6f 72 74 2e 0a 0a 5b 64 65  L/TLS port...[de
9740: 66 20 5b 61 72 67 20 22 75 6e 65 78 70 65 63 74  f [arg "unexpect
9750: 65 64 20 65 6f 66 20 77 68 69 6c 65 20 72 65 61  ed eof while rea
9760: 64 69 6e 67 22 5d 5d 0a 50 65 65 72 20 68 61 73  ding"]].Peer has
9770: 20 63 6c 6f 73 65 64 20 74 68 65 20 63 6f 6e 6e   closed the conn
9780: 65 63 74 69 6f 6e 20 77 69 74 68 6f 75 74 20 73  ection without s
9790: 65 6e 64 69 6e 67 20 74 68 65 20 22 63 6c 6f 73  ending the "clos
97a0: 65 20 6e 6f 74 69 66 79 22 20 73 68 75 74 64 6f  e notify" shutdo
97b0: 77 6e 20 61 6c 65 72 74 2e 0a 0a 5b 64 65 66 20  wn alert...[def 
97c0: 5b 61 72 67 20 22 77 72 6f 6e 67 20 76 65 72 73  [arg "wrong vers
97d0: 69 6f 6e 20 6e 75 6d 62 65 72 22 5d 5d 0a 43 6c  ion number"]].Cl
97e0: 69 65 6e 74 20 68 61 73 20 74 72 69 65 64 20 74  ient has tried t
97f0: 6f 20 63 6f 6e 6e 65 63 74 20 74 6f 20 61 20 6e  o connect to a n
9800: 6f 6e 2d 48 54 54 50 20 73 65 72 76 65 72 20 6f  on-HTTP server o
9810: 6e 20 61 20 6e 6f 6e 2d 54 4c 53 20 28 69 2e 65  n a non-TLS (i.e
9820: 2e 20 70 6c 61 69 6e 20 74 65 78 74 29 20 70 6f  . plain text) po
9830: 72 74 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  rt...[list_end].
9840: 0a 5b 6d 61 6e 70 61 67 65 5f 65 6e 64 5d 0a     .[manpage_end].