Hex Artifact Content

Artifact 8bcbc022a3647f417654c0bf20bcf87e7c34171fbda6cac57e2d547898e36875:


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 5d 0a 5b 63 61 74   tls n 2.0].[cat
0110: 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f 70 79  egory tls].[copy
0120: 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61 74 74  right {1999 Matt
0130: 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70 79 72   Newman}].[copyr
0140: 69 67 68 74 20 7b 32 30 30 34 20 53 74 61 72 66  ight {2004 Starf
0150: 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a 5b 63  ish Systems}].[c
0160: 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34 20 42  opyright {2024 B
0170: 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d 0a 5b  rian O'Hagan}].[
0180: 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49 2f 4f  keywords tls I/O
0190: 20 22 49 50 20 41 64 64 72 65 73 73 22 20 4f 70   "IP Address" Op
01a0: 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20 54 4c  enSSL SSL TCP TL
01b0: 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75 73 20  S "asynchronous 
01c0: 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74 69 66  I/O" bind certif
01d0: 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20 63 6f  icate channel co
01e0: 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61 69 6e  nnection "domain
01f0: 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68 74 74   name" host "htt
0200: 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61 64 64  ps" "network add
0210: 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20 73 6f  ress" network so
0220: 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b 6d 6f  cket TclTLS].[mo
0230: 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53 20 65  ddesc {Tcl TLS e
0240: 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65 65 5f  xtension}].[see_
0250: 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b 65 74  also http socket
0260: 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f 77 77   [uri https://ww
0270: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 20 4f  w.openssl.org/ O
0280: 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c 65 64  penSSL]].[titled
0290: 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74 6f 20  esc {binding to 
02a0: 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72  the OpenSSL libr
02b0: 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70 74 65  ary for encrypte
02c0: 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49 2f 4f  d socket and I/O
02d0: 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75 6e 69   channel communi
02e0: 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71 75 69  cations}].[requi
02f0: 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b 72 65  re Tcl 8.5-].[re
0300: 71 75 69 72 65 20 74 6c 73 20 32 2e 30 5d 0a 5b  quire tls 2.0].[
0310: 64 65 73 63 72 69 70 74 69 6f 6e 5d 0a 0a 54 68  description]..Th
0320: 69 73 20 65 78 74 65 6e 73 69 6f 6e 20 70 72 6f  is extension pro
0330: 76 69 64 65 73 20 54 43 4c 20 73 63 72 69 70 74  vides TCL script
0340: 20 61 63 63 65 73 73 20 74 6f 20 53 65 63 75 72   access to Secur
0350: 65 20 53 6f 63 6b 65 74 20 4c 61 79 65 72 20 28  e Socket Layer (
0360: 53 53 4c 29 0a 63 6f 6d 6d 75 6e 69 63 61 74 69  SSL).communicati
0370: 6f 6e 73 20 75 73 69 6e 67 20 74 68 65 20 54 72  ons using the Tr
0380: 61 6e 73 70 6f 72 74 20 4c 61 79 65 72 20 53 65  ansport Layer Se
0390: 63 75 72 69 74 79 20 28 54 4c 53 29 20 70 72 6f  curity (TLS) pro
03a0: 74 6f 63 6f 6c 2e 20 49 74 20 70 72 6f 76 69 64  tocol. It provid
03b0: 65 73 20 61 0a 67 65 6e 65 72 69 63 20 62 69 6e  es a.generic bin
03c0: 64 69 6e 67 20 74 6f 20 5b 75 72 69 20 22 68 74  ding to [uri "ht
03d0: 74 70 73 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73 73  tps://www.openss
03e0: 6c 2e 6f 72 67 2f 22 20 4f 70 65 6e 53 53 4c 5d  l.org/" OpenSSL]
03f0: 2c 20 75 74 69 6c 69 7a 69 6e 67 20 74 68 65 0a  , utilizing the.
0400: 5b 73 79 73 63 6d 64 20 54 63 6c 5f 53 74 61 63  [syscmd Tcl_Stac
0410: 6b 43 68 61 6e 6e 65 6c 5d 20 41 50 49 20 69 6e  kChannel] API in
0420: 20 54 43 4c 20 38 2e 34 20 6f 72 20 6c 61 74 65   TCL 8.4 or late
0430: 72 2e 20 54 68 65 73 65 20 73 6f 63 6b 65 74 73  r. These sockets
0440: 20 62 65 68 61 76 65 20 65 78 61 63 74 6c 79 0a   behave exactly.
0450: 74 68 65 20 73 61 6d 65 20 61 73 20 63 68 61 6e  the same as chan
0460: 6e 65 6c 73 20 63 72 65 61 74 65 64 20 75 73 69  nels created usi
0470: 6e 67 20 74 68 65 20 62 75 69 6c 74 2d 69 6e 20  ng the built-in 
0480: 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65 74 5d 20  [syscmd socket] 
0490: 63 6f 6d 6d 61 6e 64 2c 20 62 75 74 0a 70 72 6f  command, but.pro
04a0: 76 69 64 65 20 61 64 64 69 74 69 6f 6e 61 6c 20  vide additional 
04b0: 6f 70 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6e 74  options for cont
04c0: 72 6f 6c 6c 69 6e 67 20 74 68 65 20 53 53 4c 2f  rolling the SSL/
04d0: 54 4c 53 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 73  TLS session...[s
04e0: 65 63 74 69 6f 6e 20 43 6f 6d 70 61 74 69 62 69  ection Compatibi
04f0: 6c 69 74 79 5d 0a 54 68 69 73 20 65 78 74 65 6e  lity].This exten
0500: 73 69 6f 6e 20 69 73 20 63 6f 6d 70 61 74 69 62  sion is compatib
0510: 6c 65 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20  le with OpenSSL 
0520: 31 2e 31 2e 31 20 6f 72 20 6c 61 74 65 72 20 69  1.1.1 or later i
0530: 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 33 2e 78  ncluding the 3.x
0540: 20 61 6e 64 20 34 2e 30 0a 72 65 6c 65 61 73 65   and 4.0.release
0550: 73 2e 20 49 74 20 72 65 71 75 69 72 65 73 20 54  s. It requires T
0560: 63 6c 20 76 65 72 73 69 6f 6e 20 38 2e 35 20 6f  cl version 8.5 o
0570: 72 20 6c 61 74 65 72 20 61 6e 64 20 77 69 6c 6c  r later and will
0580: 20 77 6f 72 6b 20 77 69 74 68 20 54 63 6c 20 39   work with Tcl 9
0590: 2e 30 2e 0a 0a 5b 73 65 63 74 69 6f 6e 20 43 6f  .0...[section Co
05a0: 6d 6d 61 6e 64 73 5d 0a 0a 54 68 65 20 66 6f 6c  mmands]..The fol
05b0: 6c 6f 77 69 6e 67 20 61 72 65 20 74 68 65 20 63  lowing are the c
05c0: 6f 6d 6d 61 6e 64 73 20 70 72 6f 76 69 64 65 64  ommands provided
05d0: 20 62 79 20 74 68 65 20 54 63 4c 54 4c 53 20 70   by the TcLTLS p
05e0: 61 63 6b 61 67 65 2e 20 53 65 65 0a 5b 73 65 63  ackage. See.[sec
05f0: 74 72 65 66 20 45 78 61 6d 70 6c 65 73 5d 20 66  tref Examples] f
0600: 6f 72 20 65 78 61 6d 70 6c 65 20 75 73 61 67 65  or example usage
0610: 20 61 6e 64 20 74 68 65 20 5b 66 69 6c 65 20 64   and the [file d
0620: 65 6d 6f 73 5d 20 64 69 72 65 63 74 6f 72 79 20  emos] directory 
0630: 66 6f 72 0a 6d 6f 72 65 20 65 78 61 6d 70 6c 65  for.more example
0640: 20 75 73 61 67 65 2e 0a 0a 5b 6c 69 73 74 5f 62   usage...[list_b
0650: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73  egin definitions
0660: 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ]..[call [cmd tl
0670: 73 3a 3a 69 6e 69 74 5d 20 5b 6f 70 74 20 5b 61  s::init] [opt [a
0680: 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70  rg -option]] [op
0690: 74 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b  t [arg value]] [
06a0: 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f  opt [arg "-optio
06b0: 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d 0a  n value ..."]]].
06c0: 0a 4f 70 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69  .Optional functi
06d0: 6f 6e 20 74 6f 20 73 65 74 20 74 68 65 20 64 65  on to set the de
06e0: 66 61 75 6c 74 20 6f 70 74 69 6f 6e 73 20 75 73  fault options us
06f0: 65 64 20 62 79 20 5b 63 6d 64 20 74 6c 73 3a 3a  ed by [cmd tls::
0700: 73 6f 63 6b 65 74 5d 2e 20 49 66 20 79 6f 75 0a  socket]. If you.
0710: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 69  call [cmd tls::i
0720: 6d 70 6f 72 74 5d 20 64 69 72 65 63 74 6c 79 2c  mport] directly,
0730: 20 74 68 65 20 76 61 6c 75 65 73 20 73 65 74 20   the values set 
0740: 62 79 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 20  by this command 
0750: 68 61 76 65 20 6e 6f 20 65 66 66 65 63 74 2e 0a  have no effect..
0760: 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 73 75 70  This command sup
0770: 70 6f 72 74 73 20 61 6c 6c 20 6f 66 20 74 68 65  ports all of the
0780: 20 73 61 6d 65 20 6f 70 74 69 6f 6e 73 20 61 73   same options as
0790: 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 73   the [cmd tls::s
07a0: 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 0a  ocket] command,.
07b0: 74 68 6f 75 67 68 20 79 6f 75 20 73 68 6f 75 6c  though you shoul
07c0: 64 20 6c 69 6d 69 74 20 79 6f 75 72 20 6f 70 74  d limit your opt
07d0: 69 6f 6e 73 20 74 6f 20 6f 6e 6c 79 20 74 68 65  ions to only the
07e0: 20 54 4c 53 20 72 65 6c 61 74 65 64 20 6f 6e 65   TLS related one
07f0: 73 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  s...[call [cmd t
0800: 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 5b 6f 70 74  ls::socket] [opt
0810: 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20   [arg -option]] 
0820: 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75 65 5d  [opt [arg value]
0830: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70  ] [opt [arg "-op
0840: 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d  tion value ..."]
0850: 5d 20 5b 61 72 67 20 68 6f 73 74 5d 20 5b 61 72  ] [arg host] [ar
0860: 67 20 70 6f 72 74 5d 5d 0a 0a 54 68 69 73 20 69  g port]]..This i
0870: 73 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63 74  s a helper funct
0880: 69 6f 6e 20 74 68 61 74 20 75 74 69 6c 69 7a 65  ion that utilize
0890: 73 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67  s the underlying
08a0: 20 63 6f 6d 6d 61 6e 64 73 20 5b 73 79 73 63 6d   commands [syscm
08b0: 64 20 73 6f 63 6b 65 74 5d 0a 61 6e 64 20 5b 63  d socket].and [c
08c0: 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20  md tls::import] 
08d0: 74 6f 20 63 72 65 61 74 65 20 74 68 65 20 63 6f  to create the co
08e0: 6e 6e 65 63 74 69 6f 6e 2e 20 49 74 20 62 65 68  nnection. It beh
08f0: 61 76 65 73 20 74 68 65 20 73 61 6d 65 20 61 73  aves the same as
0900: 20 74 68 65 0a 6e 61 74 69 76 65 20 54 43 4c 20   the.native TCL 
0910: 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65 74 5d 20  [syscmd socket] 
0920: 63 6f 6d 6d 61 6e 64 2c 20 62 75 74 20 61 6c 73  command, but als
0930: 6f 20 73 75 70 70 6f 72 74 73 20 74 68 65 20 5b  o supports the [
0940: 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d  cmd tls::import]
0950: 0a 63 6f 6d 6d 61 6e 64 20 6f 70 74 69 6f 6e 73  .command options
0960: 20 77 69 74 68 20 6f 6e 65 20 61 64 64 69 74 69   with one additi
0970: 6f 6e 61 6c 20 6f 70 74 69 6f 6e 2e 20 49 74 20  onal option. It 
0980: 72 65 74 75 72 6e 73 20 74 68 65 20 63 68 61 6e  returns the chan
0990: 6e 65 6c 20 68 61 6e 64 6c 65 20 69 64 0a 66 6f  nel handle id.fo
09a0: 72 20 74 68 65 20 6e 65 77 20 73 6f 63 6b 65 74  r the new socket
09b0: 2e 20 41 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74  . Additional opt
09c0: 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74  ions are:..[list
09d0: 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a  _begin options].
09e0: 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 75 74 6f 73  .[opt_def -autos
09f0: 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 20 62  ervername [arg b
0a00: 6f 6f 6c 5d 5d 0a 49 66 20 5b 63 6f 6e 73 74 20  ool]].If [const 
0a10: 74 72 75 65 5d 2c 20 61 75 74 6f 6d 61 74 69 63  true], automatic
0a20: 61 6c 6c 79 20 73 65 74 20 74 68 65 20 5b 6f 70  ally set the [op
0a30: 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65  tion -servername
0a40: 5d 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74 68  ] argument to th
0a50: 65 0a 5b 65 6d 70 68 20 68 6f 73 74 5d 20 61 72  e.[emph host] ar
0a60: 67 75 6d 65 6e 74 2e 20 50 72 69 6f 72 20 74 6f  gument. Prior to
0a70: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65   TclTLS 2.0, the
0a80: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
0a90: 73 74 20 66 61 6c 73 65 5d 2e 0a 53 74 61 72 74  st false]..Start
0aa0: 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e  ing in TclTLS 2.
0ab0: 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20 69  0, the default i
0ac0: 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20 75  s [const true] u
0ad0: 6e 6c 65 73 73 20 5b 6f 70 74 69 6f 6e 20 2d 73  nless [option -s
0ae0: 65 72 76 65 72 6e 61 6d 65 5d 0a 69 73 20 61 6c  ervername].is al
0af0: 73 6f 20 73 70 65 63 69 66 69 65 64 2e 0a 0a 5b  so specified...[
0b00: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c  list_end]..[call
0b10: 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65   [cmd tls::socke
0b20: 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72 76  t] [option -serv
0b30: 65 72 5d 20 5b 61 72 67 20 63 6f 6d 6d 61 6e 64  er] [arg command
0b40: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74  ] [opt [arg -opt
0b50: 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  ion]] [opt [arg 
0b60: 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72  value]] [opt [ar
0b70: 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65  g "-option value
0b80: 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 70 6f 72   ..."]] [arg por
0b90: 74 5d 5d 0a 0a 53 61 6d 65 20 61 73 20 70 72 65  t]]..Same as pre
0ba0: 76 69 6f 75 73 20 63 6f 6d 6d 61 6e 64 2c 20 62  vious command, b
0bb0: 75 74 20 69 6e 73 74 65 61 64 20 63 72 65 61 74  ut instead creat
0bc0: 65 73 20 61 20 73 65 72 76 65 72 20 73 6f 63 6b  es a server sock
0bd0: 65 74 20 66 6f 72 20 63 6c 69 65 6e 74 73 20 74  et for clients t
0be0: 6f 0a 63 6f 6e 6e 65 63 74 20 74 6f 20 6a 75 73  o.connect to jus
0bf0: 74 20 6c 69 6b 65 20 74 68 65 20 54 63 6c 20 5b  t like the Tcl [
0c00: 73 79 73 63 6d 64 20 22 73 6f 63 6b 65 74 20 2d  syscmd "socket -
0c10: 73 65 72 76 65 72 22 5d 20 63 6f 6d 6d 61 6e 64  server"] command
0c20: 2e 20 49 74 20 72 65 74 75 72 6e 73 20 74 68 65  . It returns the
0c30: 0a 63 68 61 6e 6e 65 6c 20 68 61 6e 64 6c 65 20  .channel handle 
0c40: 69 64 20 66 6f 72 20 74 68 65 20 6e 65 77 20 73  id for the new s
0c50: 6f 63 6b 65 74 2e 0a 0a 5b 63 61 6c 6c 20 5b 63  ocket...[call [c
0c60: 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20  md tls::import] 
0c70: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20 5b 6f  [arg channel] [o
0c80: 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d  pt [arg -option]
0c90: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75  ] [opt [arg valu
0ca0: 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d  e]] [opt [arg "-
0cb0: 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e  option value ...
0cc0: 22 5d 5d 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  "]]]..[call [cmd
0cd0: 20 74 6c 73 3a 3a 73 74 61 72 74 74 6c 73 5d 20   tls::starttls] 
0ce0: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20 5b 6f  [arg channel] [o
0cf0: 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d  pt [arg -option]
0d00: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75  ] [opt [arg valu
0d10: 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d  e]] [opt [arg "-
0d20: 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e  option value ...
0d30: 22 5d 5d 5d 0a 0a 53 74 61 72 74 20 54 4c 53 20  "]]]..Start TLS 
0d40: 65 6e 63 72 79 70 74 69 6f 6e 20 6f 6e 20 54 43  encryption on TC
0d50: 4c 20 63 68 61 6e 6e 65 6c 20 5b 61 72 67 20 63  L channel [arg c
0d60: 68 61 6e 6e 65 6c 5d 20 76 69 61 20 61 20 73 74  hannel] via a st
0d70: 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 2e 20 49  acked channel. I
0d80: 74 0a 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 20  t.need not be a 
0d90: 73 6f 63 6b 65 74 2c 20 62 75 74 20 6d 75 73 74  socket, but must
0da0: 20 70 72 6f 76 69 64 65 20 62 69 2d 64 69 72 65   provide bi-dire
0db0: 63 74 69 6f 6e 61 6c 20 66 6c 6f 77 2e 20 41 6c  ctional flow. Al
0dc0: 73 6f 20 73 65 74 73 20 73 65 73 73 69 6f 6e 0a  so sets session.
0dd0: 70 61 72 61 6d 65 74 65 72 73 20 66 6f 72 20 53  parameters for S
0de0: 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 56 61  SL handshake. Va
0df0: 6c 69 64 20 6f 70 74 69 6f 6e 73 20 61 72 65 3a  lid options are:
0e00: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70  ..[list_begin op
0e10: 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66  tions]..[opt_def
0e20: 20 2d 61 6c 70 6e 20 5b 61 72 67 20 6c 69 73 74   -alpn [arg list
0e30: 5d 5d 0a 4c 69 73 74 20 6f 66 20 70 72 6f 74 6f  ]].List of proto
0e40: 63 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20 64 75  cols to offer du
0e50: 72 69 6e 67 20 41 70 70 6c 69 63 61 74 69 6f 6e  ring Application
0e60: 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20  -Layer Protocol 
0e70: 4e 65 67 6f 74 69 61 74 69 6f 6e 0a 28 41 4c 50  Negotiation.(ALP
0e80: 4e 29 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 3a  N). For example:
0e90: 20 5b 63 6f 6e 73 74 20 68 32 5d 20 61 6e 64 20   [const h2] and 
0ea0: 5b 63 6f 6e 73 74 20 68 74 74 70 2f 31 2e 31 5d  [const http/1.1]
0eb0: 2c 20 62 75 74 20 6e 6f 74 20 5b 63 6f 6e 73 74  , but not [const
0ec0: 20 68 33 5d 20 6f 72 0a 5b 63 6f 6e 73 74 20 71   h3] or.[const q
0ed0: 75 69 63 5d 2e 20 54 68 69 73 20 6f 70 74 69 6f  uic]. This optio
0ee0: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  n is new for Tcl
0ef0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64  TLS 1.8...[opt_d
0f00: 65 66 20 2d 63 61 64 69 72 20 5b 61 72 67 20 64  ef -cadir [arg d
0f10: 69 72 65 63 74 6f 72 79 5d 5d 0a 53 70 65 63 69  irectory]].Speci
0f20: 66 69 65 73 20 74 68 65 20 64 69 72 65 63 74 6f  fies the directo
0f30: 72 79 20 77 68 65 72 65 20 74 68 65 20 43 65 72  ry where the Cer
0f40: 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69  tificate Authori
0f50: 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69 63  ty (CA) certific
0f60: 61 74 65 73 20 61 72 65 0a 73 74 6f 72 65 64 2e  ates are.stored.
0f70: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
0f80: 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66 69  platform specifi
0f90: 63 20 61 6e 64 20 63 61 6e 20 62 65 20 73 65 74  c and can be set
0fa0: 20 61 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65   at compile time
0fb0: 2e 20 54 68 65 0a 64 65 66 61 75 6c 74 20 6c 6f  . The.default lo
0fc0: 63 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 6f 76  cation can be ov
0fd0: 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 20  erridden by the 
0fe0: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49  [var SSL_CERT_DI
0ff0: 52 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 76  R] environment.v
1000: 61 72 69 61 62 6c 65 2e 20 53 65 65 20 5b 73 65  ariable. See [se
1010: 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63 61  ctref "Certifica
1020: 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20  te Validation"] 
1030: 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73  for more details
1040: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 66  ...[opt_def -caf
1050: 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d  ile [arg filenam
1060: 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  e]].Specifies th
1070: 65 20 66 69 6c 65 20 77 69 74 68 20 74 68 65 20  e file with the 
1080: 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68  Certificate Auth
1090: 6f 72 69 74 79 20 28 43 41 29 20 63 65 72 74 69  ority (CA) certi
10a0: 66 69 63 61 74 65 73 20 74 6f 20 75 73 65 20 69  ficates to use i
10b0: 6e 0a 5b 63 6f 6e 73 74 20 50 45 4d 5d 20 66 69  n.[const PEM] fi
10c0: 6c 65 20 66 6f 72 6d 61 74 2e 20 54 68 65 20 64  le format. The d
10d0: 65 66 61 75 6c 74 20 69 73 20 5b 66 69 6c 65 20  efault is [file 
10e0: 63 65 72 74 2e 70 65 6d 5d 2c 20 69 6e 20 74 68  cert.pem], in th
10f0: 65 20 4f 70 65 6e 53 53 4c 0a 64 69 72 65 63 74  e OpenSSL.direct
1100: 6f 72 79 2e 20 54 68 65 20 64 65 66 61 75 6c 74  ory. The default
1110: 20 66 69 6c 65 20 63 61 6e 20 62 65 20 6f 76 65   file can be ove
1120: 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 20 5b  rridden by the [
1130: 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c  var SSL_CERT_FIL
1140: 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 76  E] environment.v
1150: 61 72 69 61 62 6c 65 2e 20 53 65 65 20 5b 73 65  ariable. See [se
1160: 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63 61  ctref "Certifica
1170: 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20  te Validation"] 
1180: 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73  for more details
1190: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 73  ...[opt_def -cas
11a0: 74 6f 72 65 20 5b 61 72 67 20 55 52 49 5d 5d 0a  tore [arg URI]].
11b0: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 55 6e  Specifies the Un
11c0: 69 66 6f 72 6d 20 52 65 73 6f 75 72 63 65 20 49  iform Resource I
11d0: 64 65 6e 74 69 66 69 65 72 20 28 55 52 49 29 20  dentifier (URI) 
11e0: 66 6f 72 20 74 68 65 20 43 65 72 74 69 66 69 63  for the Certific
11f0: 61 74 65 20 41 75 74 68 6f 72 69 74 79 0a 28 43  ate Authority.(C
1200: 41 29 20 73 74 6f 72 65 2c 20 77 68 69 63 68 20  A) store, which 
1210: 6d 61 79 20 62 65 20 61 20 73 69 6e 67 6c 65 20  may be a single 
1220: 63 6f 6e 74 61 69 6e 65 72 20 6f 72 20 61 20 63  container or a c
1230: 61 74 61 6c 6f 67 20 6f 66 20 63 6f 6e 74 61 69  atalog of contai
1240: 6e 65 72 73 2e 0a 53 74 61 72 74 69 6e 67 20 77  ners..Starting w
1250: 69 74 68 20 4f 70 65 6e 53 53 4c 20 33 2e 32 20  ith OpenSSL 3.2 
1260: 6f 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c 20 73  on MS Windows, s
1270: 65 74 20 74 6f 20 22 5b 63 6f 6e 73 74 20 22 6f  et to "[const "o
1280: 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 74  rg.openssl.winst
1290: 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f 20 75 73 65  ore://"]".to use
12a0: 20 74 68 65 20 62 75 69 6c 74 2d 69 6e 20 4d 53   the built-in MS
12b0: 20 57 69 6e 64 6f 77 73 20 43 65 72 74 69 66 69   Windows Certifi
12c0: 63 61 74 65 20 53 74 6f 72 65 2e 0a 53 65 65 20  cate Store..See 
12d0: 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69 66  [sectref "Certif
12e0: 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e  icate Validation
12f0: 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61  "] for more deta
1300: 69 6c 73 2e 0a 54 68 69 73 20 6f 70 74 69 6f 6e  ils..This option
1310: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
1320: 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65  LS 1.8...[opt_de
1330: 66 20 2d 63 65 72 74 66 69 6c 65 20 5b 61 72 67  f -certfile [arg
1340: 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63   filename]].Spec
1350: 69 66 69 65 73 20 74 68 65 20 6e 61 6d 65 20 6f  ifies the name o
1360: 66 20 74 68 65 20 66 69 6c 65 20 77 69 74 68 20  f the file with 
1370: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
1380: 74 6f 20 75 73 65 20 69 6e 20 50 45 4d 20 66 6f  to use in PEM fo
1390: 72 6d 61 74 0a 61 73 20 74 68 65 20 6c 6f 63 61  rmat.as the loca
13a0: 6c 20 28 63 6c 69 65 6e 74 20 6f 72 20 73 65 72  l (client or ser
13b0: 76 65 72 29 20 63 65 72 74 69 66 69 63 61 74 65  ver) certificate
13c0: 2e 20 49 74 20 61 6c 73 6f 20 63 6f 6e 74 61 69  . It also contai
13d0: 6e 73 20 74 68 65 20 70 75 62 6c 69 63 20 6b 65  ns the public ke
13e0: 79 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 65  y...[opt_def -ce
13f0: 72 74 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 5d  rt [arg string]]
1400: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 63  .Specifies the c
1410: 65 72 74 69 66 69 63 61 74 65 20 74 6f 20 75 73  ertificate to us
1420: 65 20 61 73 20 61 20 44 45 52 20 65 6e 63 6f 64  e as a DER encod
1430: 65 64 20 73 74 72 69 6e 67 20 28 58 2e 35 30 39  ed string (X.509
1440: 20 44 45 52 29 2e 0a 0a 5b 6f 70 74 5f 64 65 66   DER)...[opt_def
1450: 20 2d 63 69 70 68 65 72 20 5b 61 72 67 20 73 74   -cipher [arg st
1460: 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73  ring]].Specifies
1470: 20 74 68 65 20 6c 69 73 74 20 6f 66 20 63 69 70   the list of cip
1480: 68 65 72 73 20 74 6f 20 75 73 65 20 66 6f 72 20  hers to use for 
1490: 54 4c 53 20 31 2e 32 20 61 6e 64 20 65 61 72 6c  TLS 1.2 and earl
14a0: 69 65 72 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 2e  ier connections.
14b0: 0a 53 74 72 69 6e 67 20 69 73 20 61 20 63 6f 6c  .String is a col
14c0: 6f 6e 20 22 5b 63 6f 6e 73 74 20 3a 5d 22 20 73  on "[const :]" s
14d0: 65 70 61 72 61 74 65 64 20 6c 69 73 74 20 6f 66  eparated list of
14e0: 20 63 69 70 68 65 72 73 2e 0a 43 69 70 68 65 72   ciphers..Cipher
14f0: 73 20 63 61 6e 20 62 65 20 63 6f 6d 62 69 6e 65  s can be combine
1500: 64 20 75 73 69 6e 67 20 74 68 65 20 22 5b 63 6f  d using the "[co
1510: 6e 73 74 20 2b 5d 22 20 63 68 61 72 61 63 74 65  nst +]" characte
1520: 72 2e 0a 50 72 65 66 69 78 65 73 20 63 61 6e 20  r..Prefixes can 
1530: 62 65 20 75 73 65 64 20 74 6f 20 70 65 72 6d 61  be used to perma
1540: 6e 65 6e 74 6c 79 20 72 65 6d 6f 76 65 20 22 5b  nently remove "[
1550: 63 6f 6e 73 74 20 21 5d 22 2c 20 64 65 6c 65 74  const !]", delet
1560: 65 20 22 5b 63 6f 6e 73 74 20 2d 5d 22 2c 20 6f  e "[const -]", o
1570: 72 0a 6d 6f 76 65 20 74 6f 20 74 68 65 20 65 6e  r.move to the en
1580: 64 20 22 5b 63 6f 6e 73 74 20 2b 5d 22 20 61 20  d "[const +]" a 
1590: 73 70 65 63 69 66 69 65 64 20 63 69 70 68 65 72  specified cipher
15a0: 2e 0a 4b 65 79 77 6f 72 64 73 20 5b 63 6f 6e 73  ..Keywords [cons
15b0: 74 20 40 53 54 52 45 4e 47 54 48 5d 20 28 73 6f  t @STRENGTH] (so
15c0: 72 74 20 62 79 20 61 6c 67 6f 72 69 74 68 6d 20  rt by algorithm 
15d0: 6b 65 79 20 6c 65 6e 67 74 68 29 2c 0a 5b 63 6f  key length),.[co
15e0: 6e 73 74 20 40 53 45 43 4c 45 56 45 4c 3d 5d 5b  nst @SECLEVEL=][
15f0: 65 6d 70 68 20 6e 5d 20 28 73 65 74 20 73 65 63  emph n] (set sec
1600: 75 72 69 74 79 20 6c 65 76 65 6c 20 74 6f 20 6e  urity level to n
1610: 29 2c 20 61 6e 64 0a 5b 63 6f 6e 73 74 20 44 45  ), and.[const DE
1620: 46 41 55 4c 54 5d 20 28 75 73 65 20 64 65 66 61  FAULT] (use defa
1630: 75 6c 74 20 63 69 70 68 65 72 20 6c 69 73 74 2c  ult cipher list,
1640: 20 61 74 20 73 74 61 72 74 20 6f 6e 6c 79 29 20   at start only) 
1650: 63 61 6e 20 61 6c 73 6f 20 62 65 20 73 70 65 63  can also be spec
1660: 69 66 69 65 64 2e 0a 53 65 65 20 74 68 65 20 5b  ified..See the [
1670: 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 64 6f 63  uri "https://doc
1680: 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 6d 61  s.openssl.org/ma
1690: 73 74 65 72 2f 6d 61 6e 31 2f 6f 70 65 6e 73 73  ster/man1/openss
16a0: 6c 2d 63 69 70 68 65 72 73 2f 23 6f 70 74 69 6f  l-ciphers/#optio
16b0: 6e 73 22 20 4f 70 65 6e 53 53 4c 5d 0a 64 6f 63  ns" OpenSSL].doc
16c0: 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 74  umentation for t
16d0: 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 6f 66 20  he full list of 
16e0: 76 61 6c 69 64 20 76 61 6c 75 65 73 2e 0a 0a 5b  valid values...[
16f0: 6f 70 74 5f 64 65 66 20 2d 63 69 70 68 65 72 73  opt_def -ciphers
1700: 75 69 74 65 73 20 5b 61 72 67 20 73 74 72 69 6e  uites [arg strin
1710: 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  g]].Specifies th
1720: 65 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72  e list of cipher
1730: 20 73 75 69 74 65 73 20 74 6f 20 75 73 65 20 66   suites to use f
1740: 6f 72 20 54 4c 53 20 31 2e 33 20 61 73 20 61 20  or TLS 1.3 as a 
1750: 63 6f 6c 6f 6e 0a 22 5b 63 6f 6e 73 74 20 3a 5d  colon."[const :]
1760: 22 20 73 65 70 61 72 61 74 65 64 20 6c 69 73 74  " separated list
1770: 20 6f 66 20 63 69 70 68 65 72 20 73 75 69 74 65   of cipher suite
1780: 20 6e 61 6d 65 73 2e 20 53 65 65 20 74 68 65 0a   names. See the.
1790: 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 64 6f  [uri "https://do
17a0: 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 6d  cs.openssl.org/m
17b0: 61 73 74 65 72 2f 6d 61 6e 31 2f 6f 70 65 6e 73  aster/man1/opens
17c0: 73 6c 2d 63 69 70 68 65 72 73 2f 23 6f 70 74 69  sl-ciphers/#opti
17d0: 6f 6e 73 22 20 4f 70 65 6e 53 53 4c 5d 0a 64 6f  ons" OpenSSL].do
17e0: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20  cumentation for 
17f0: 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 6f 66  the full list of
1800: 20 76 61 6c 69 64 20 76 61 6c 75 65 73 2e 0a 54   valid values..T
1810: 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65  his option is ne
1820: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
1830: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 6f 6d  ...[opt_def -com
1840: 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62 61  mand [arg callba
1850: 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  ck]].Specifies t
1860: 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d  he callback comm
1870: 61 6e 64 20 74 6f 20 62 65 20 69 6e 76 6f 6b 65  and to be invoke
1880: 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f 69  d at several poi
1890: 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a 68  nts during the.h
18a0: 61 6e 64 73 68 61 6b 65 20 74 6f 20 70 61 73 73  andshake to pass
18b0: 20 65 72 72 6f 72 73 2c 20 74 72 61 63 69 6e 67   errors, tracing
18c0: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20 61 6e   information, an
18d0: 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 65 73 73 61  d protocol messa
18e0: 67 65 73 2e 0a 53 65 65 20 5b 73 65 63 74 72 65  ges..See [sectre
18f0: 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74 69  f "Callback Opti
1900: 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20 69  ons"] for more i
1910: 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  nfo...[opt_def -
1920: 64 68 70 61 72 61 6d 73 20 5b 61 72 67 20 66 69  dhparams [arg fi
1930: 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66 69  lename]].Specifi
1940: 65 73 20 74 68 65 20 44 69 66 66 69 65 2d 48 65  es the Diffie-He
1950: 6c 6c 6d 61 6e 20 28 44 48 29 20 70 61 72 61 6d  llman (DH) param
1960: 65 74 65 72 73 20 66 69 6c 65 2e 0a 0a 5b 6f 70  eters file...[op
1970: 74 5f 64 65 66 20 2d 6b 65 79 66 69 6c 65 20 5b  t_def -keyfile [
1980: 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53  arg filename]].S
1990: 70 65 63 69 66 69 65 73 20 74 68 65 20 70 72 69  pecifies the pri
19a0: 76 61 74 65 20 6b 65 79 20 66 69 6c 65 2e 20 54  vate key file. T
19b0: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 74 6f  he default is to
19c0: 20 75 73 65 20 74 68 65 20 66 69 6c 65 0a 73 70   use the file.sp
19d0: 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20 5b  ecified by the [
19e0: 6f 70 74 69 6f 6e 20 2d 63 65 72 74 66 69 6c 65  option -certfile
19f0: 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f  ] option...[opt_
1a00: 64 65 66 20 2d 6b 65 79 20 5b 61 72 67 20 73 74  def -key [arg st
1a10: 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73  ring]].Specifies
1a20: 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79   the private key
1a30: 20 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52   to use as a DER
1a40: 20 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20   encoded string 
1a50: 28 50 4b 43 53 23 31 20 44 45 52 29 2e 0a 0a 5b  (PKCS#1 DER)...[
1a60: 6f 70 74 5f 64 65 66 20 2d 6d 6f 64 65 6c 20 5b  opt_def -model [
1a70: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 46 6f  arg channel]].Fo
1a80: 72 63 65 20 74 68 69 73 20 63 68 61 6e 6e 65 6c  rce this channel
1a90: 20 74 6f 20 73 68 61 72 65 20 74 68 65 20 73 61   to share the sa
1aa0: 6d 65 20 5b 74 65 72 6d 20 53 53 4c 5f 43 54 58  me [term SSL_CTX
1ab0: 5d 20 73 74 72 75 63 74 75 72 65 20 61 73 20 74  ] structure as t
1ac0: 68 65 0a 73 70 65 63 69 66 69 65 64 20 5b 61 72  he.specified [ar
1ad0: 67 20 63 68 61 6e 6e 65 6c 5d 2c 20 61 6e 64 20  g channel], and 
1ae0: 74 68 65 72 65 66 6f 72 65 20 73 68 61 72 65 20  therefore share 
1af0: 63 6f 6e 66 69 67 2c 20 63 61 6c 6c 62 61 63 6b  config, callback
1b00: 73 2c 20 65 74 63 2e 0a 0a 5b 6f 70 74 5f 64 65  s, etc...[opt_de
1b10: 66 20 2d 70 61 73 73 77 6f 72 64 20 5b 61 72 67  f -password [arg
1b20: 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63   callback]].Spec
1b30: 69 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62 61  ifies the callba
1b40: 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e  ck command to in
1b50: 76 6f 6b 65 20 77 68 65 6e 20 4f 70 65 6e 53 53  voke when OpenSS
1b60: 4c 20 6e 65 65 64 73 20 74 6f 20 6f 62 74 61 69  L needs to obtai
1b70: 6e 20 61 0a 70 61 73 73 77 6f 72 64 2e 20 54 68  n a.password. Th
1b80: 69 73 20 69 73 20 74 79 70 69 63 61 6c 6c 79 20  is is typically 
1b90: 75 73 65 64 20 74 6f 20 75 6e 6c 6f 63 6b 20 74  used to unlock t
1ba0: 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 6f  he private key o
1bb0: 66 20 61 20 63 65 72 74 69 66 69 63 61 74 65 2e  f a certificate.
1bc0: 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 68  .The callback sh
1bd0: 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 70 61  ould return a pa
1be0: 73 73 77 6f 72 64 20 73 74 72 69 6e 67 2e 20 54  ssword string. T
1bf0: 68 69 73 20 6f 70 74 69 6f 6e 20 68 61 73 20 63  his option has c
1c00: 68 61 6e 67 65 64 20 66 6f 72 0a 54 63 6c 54 4c  hanged for.TclTL
1c10: 53 20 31 2e 38 2e 20 53 65 65 20 5b 73 65 63 74  S 1.8. See [sect
1c20: 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70  ref "Callback Op
1c30: 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65  tions"] for more
1c40: 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66   info...[opt_def
1c50: 20 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b 65   -post_handshake
1c60: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 41 6c 6c   [arg bool]].All
1c70: 6f 77 20 70 6f 73 74 2d 68 61 6e 64 73 68 61 6b  ow post-handshak
1c80: 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74  e session ticket
1c90: 20 75 70 64 61 74 65 73 2e 20 54 68 69 73 20 6f   updates. This o
1ca0: 70 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72  ption is new for
1cb0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f   TclTLS 1.8...[o
1cc0: 70 74 5f 64 65 66 20 2d 72 65 71 75 65 73 74 20  pt_def -request 
1cd0: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75  [arg bool]].Requ
1ce0: 65 73 74 20 61 20 63 65 72 74 69 66 69 63 61 74  est a certificat
1cf0: 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65 72 20  e from the peer 
1d00: 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c 20 68  during the SSL h
1d10: 61 6e 64 73 68 61 6b 65 2e 20 54 68 69 73 20 69  andshake. This i
1d20: 73 20 6e 65 65 64 65 64 0a 74 6f 20 64 6f 20 43  s needed.to do C
1d30: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
1d40: 61 74 69 6f 6e 2e 20 53 74 61 72 74 69 6e 67 20  ation. Starting 
1d50: 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c 20 74  in TclTLS 1.8, t
1d60: 68 65 20 64 65 66 61 75 6c 74 20 69 73 0a 5b 63  he default is.[c
1d70: 6f 6e 73 74 20 74 72 75 65 5d 20 66 6f 72 20 63  onst true] for c
1d80: 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e  lient connection
1d90: 73 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54  s. Starting in T
1da0: 63 6c 54 4c 53 20 32 2e 30 2c 20 69 66 20 73 65  clTLS 2.0, if se
1db0: 74 20 74 6f 0a 5b 63 6f 6e 73 74 20 66 61 6c 73  t to.[const fals
1dc0: 65 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d  e] and [option -
1dd0: 72 65 71 75 69 72 65 5d 20 69 73 20 5b 63 6f 6e  require] is [con
1de0: 73 74 20 74 72 75 65 5d 2c 20 74 68 65 6e 20 74  st true], then t
1df0: 68 69 73 20 77 69 6c 6c 20 62 65 0a 6f 76 65 72  his will be.over
1e00: 72 69 64 64 65 6e 20 74 6f 20 5b 63 6f 6e 73 74  ridden to [const
1e10: 20 74 72 75 65 5d 2e 0a 53 65 65 20 5b 73 65 63   true]..See [sec
1e20: 74 72 65 66 20 22 43 65 72 74 69 66 69 63 61 74  tref "Certificat
1e30: 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66  e Validation"] f
1e40: 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e  or more details.
1e50: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75  ..[opt_def -requ
1e60: 69 72 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a  ire [arg bool]].
1e70: 52 65 71 75 69 72 65 20 61 20 76 61 6c 69 64 20  Require a valid 
1e80: 63 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d  certificate from
1e90: 20 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67   the peer during
1ea0: 20 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61   the SSL handsha
1eb0: 6b 65 2e 20 49 66 20 74 68 69 73 20 69 73 0a 73  ke. If this is.s
1ec0: 65 74 20 74 6f 20 74 72 75 65 2c 20 74 68 65 6e  et to true, then
1ed0: 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65 73   [option -reques
1ee0: 74 5d 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 20  t] must also be 
1ef0: 73 65 74 20 74 6f 20 74 72 75 65 20 61 6e 64 20  set to true and 
1f00: 61 20 65 69 74 68 65 72 0a 5b 6f 70 74 69 6f 6e  a either.[option
1f10: 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f   -cadir], [optio
1f20: 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 5b 6f 70 74  n -cafile], [opt
1f30: 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 2c 20 6f  ion -castore], o
1f40: 72 20 61 20 70 6c 61 74 66 6f 72 6d 20 64 65 66  r a platform def
1f50: 61 75 6c 74 0a 6d 75 73 74 20 62 65 20 70 72 6f  ault.must be pro
1f60: 76 69 64 65 64 20 69 6e 20 6f 72 64 65 72 20 74  vided in order t
1f70: 6f 20 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e  o validate again
1f80: 73 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  st. The default 
1f90: 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61 6e  in TclTLS 1.8 an
1fa0: 64 0a 65 61 72 6c 69 65 72 20 76 65 72 73 69 6f  d.earlier versio
1fb0: 6e 73 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c  ns is [const fal
1fc0: 73 65 5d 20 73 69 6e 63 65 20 6e 6f 74 20 61 6c  se] since not al
1fd0: 6c 20 70 6c 61 74 66 6f 72 6d 73 20 68 61 76 65  l platforms have
1fe0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f   certificates to
1ff0: 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e 73  .validate agains
2000: 74 20 69 6e 20 61 20 66 6f 72 6d 20 63 6f 6d 70  t in a form comp
2010: 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65 6e  atible with Open
2020: 53 53 4c 2e 20 53 74 61 72 74 69 6e 67 20 69 6e  SSL. Starting in
2030: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 0a 74 68 65   TclTLS 2.0,.the
2040: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
2050: 73 74 20 74 72 75 65 5d 20 66 6f 72 20 63 6c 69  st true] for cli
2060: 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 73 2e  ent connections.
2070: 0a 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43  .See [sectref "C
2080: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
2090: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65  ation"] for more
20a0: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f   details...[opt_
20b0: 64 65 66 20 2d 73 65 63 75 72 69 74 79 5f 6c 65  def -security_le
20c0: 76 65 6c 20 5b 61 72 67 20 69 6e 74 65 67 65 72  vel [arg integer
20d0: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
20e0: 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20   security level 
20f0: 28 76 61 6c 75 65 20 66 72 6f 6d 20 30 20 74 6f  (value from 0 to
2100: 20 35 29 2e 20 54 68 65 20 73 65 63 75 72 69 74   5). The securit
2110: 79 20 6c 65 76 65 6c 20 61 66 66 65 63 74 73 0a  y level affects.
2120: 74 68 65 20 61 6c 6c 6f 77 65 64 20 63 69 70 68  the allowed ciph
2130: 65 72 20 73 75 69 74 65 20 65 6e 63 72 79 70 74  er suite encrypt
2140: 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 73 2c 20  ion algorithms, 
2150: 73 75 70 70 6f 72 74 65 64 20 45 43 43 20 63 75  supported ECC cu
2160: 72 76 65 73 2c 0a 73 75 70 70 6f 72 74 65 64 20  rves,.supported 
2170: 73 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72 69  signature algori
2180: 74 68 6d 73 2c 20 44 48 20 70 61 72 61 6d 65 74  thms, DH paramet
2190: 65 72 20 73 69 7a 65 73 2c 20 63 65 72 74 69 66  er sizes, certif
21a0: 69 63 61 74 65 20 6b 65 79 20 73 69 7a 65 73 0a  icate key sizes.
21b0: 61 6e 64 20 73 69 67 6e 61 74 75 72 65 20 61 6c  and signature al
21c0: 67 6f 72 69 74 68 6d 73 2e 20 54 68 65 20 64 65  gorithms. The de
21d0: 66 61 75 6c 74 20 69 73 20 31 20 70 72 69 6f 72  fault is 1 prior
21e0: 20 74 6f 20 4f 70 65 6e 53 53 4c 20 33 2e 32 20   to OpenSSL 3.2 
21f0: 61 6e 64 20 32 0a 74 68 65 72 65 61 66 74 65 72  and 2.thereafter
2200: 2e 20 4c 65 76 65 6c 20 33 20 61 6e 64 20 68 69  . Level 3 and hi
2210: 67 68 65 72 20 64 69 73 61 62 6c 65 20 73 75 70  gher disable sup
2220: 70 6f 72 74 20 66 6f 72 20 73 65 73 73 69 6f 6e  port for session
2230: 20 74 69 63 6b 65 74 73 20 61 6e 64 0a 6f 6e 6c   tickets and.onl
2240: 79 20 61 63 63 65 70 74 20 63 69 70 68 65 72 20  y accept cipher 
2250: 73 75 69 74 65 73 20 74 68 61 74 20 70 72 6f 76  suites that prov
2260: 69 64 65 20 66 6f 72 77 61 72 64 20 73 65 63 72  ide forward secr
2270: 65 63 79 2e 0a 54 68 69 73 20 6f 70 74 69 6f 6e  ecy..This option
2280: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
2290: 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65  LS 1.8...[opt_de
22a0: 66 20 2d 73 65 72 76 65 72 20 5b 61 72 67 20 62  f -server [arg b
22b0: 6f 6f 6c 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ool]].Specifies 
22c0: 77 68 65 74 68 65 72 20 74 6f 20 61 63 74 20 61  whether to act a
22d0: 73 20 61 20 73 65 72 76 65 72 20 61 6e 64 20 72  s a server and r
22e0: 65 73 70 6f 6e 64 20 77 69 74 68 20 61 20 73 65  espond with a se
22f0: 72 76 65 72 20 68 61 6e 64 73 68 61 6b 65 20 77  rver handshake w
2300: 68 65 6e 20 61 0a 63 6c 69 65 6e 74 20 63 6f 6e  hen a.client con
2310: 6e 65 63 74 73 20 61 6e 64 20 70 72 6f 76 69 64  nects and provid
2320: 65 73 20 61 20 63 6c 69 65 6e 74 20 68 61 6e 64  es a client hand
2330: 73 68 61 6b 65 2e 20 54 68 65 20 64 65 66 61 75  shake. The defau
2340: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c  lt is [const fal
2350: 73 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  se]...[opt_def -
2360: 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 20  servername [arg 
2370: 68 6f 73 74 6e 61 6d 65 5d 5d 0a 53 70 65 63 69  hostname]].Speci
2380: 66 79 20 74 68 65 20 70 65 65 72 27 73 20 68 6f  fy the peer's ho
2390: 73 74 6e 61 6d 65 2e 20 54 68 69 73 20 69 73 20  stname. This is 
23a0: 75 73 65 64 20 74 6f 20 73 65 74 20 74 68 65 20  used to set the 
23b0: 54 4c 53 20 53 65 72 76 65 72 20 4e 61 6d 65 20  TLS Server Name 
23c0: 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53 4e 49 29  Indication.(SNI)
23d0: 20 65 78 74 65 6e 73 69 6f 6e 2e 20 53 65 74 20   extension. Set 
23e0: 74 68 69 73 20 74 6f 20 74 68 65 20 65 78 70 65  this to the expe
23f0: 63 74 65 64 20 73 65 72 76 65 72 6e 61 6d 65 20  cted servername 
2400: 69 6e 20 74 68 65 20 73 65 72 76 65 72 27 73 20  in the server's 
2410: 63 65 72 74 69 66 69 63 61 74 65 0a 6f 72 20 6f  certificate.or o
2420: 6e 65 20 6f 66 20 74 68 65 20 53 75 62 6a 65 63  ne of the Subjec
2430: 74 20 41 6c 74 65 72 6e 61 74 65 20 4e 61 6d 65  t Alternate Name
2440: 73 20 28 53 41 4e 29 2e 20 53 74 61 72 74 69 6e  s (SAN). Startin
2450: 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c  g in TclTLS 2.0,
2460: 20 74 68 69 73 20 77 69 6c 6c 0a 64 65 66 61 75   this will.defau
2470: 6c 74 20 74 6f 20 74 68 65 20 68 6f 73 74 20 66  lt to the host f
2480: 72 6f 6d 20 74 68 65 20 5b 63 6d 64 20 74 6c 73  rom the [cmd tls
2490: 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e  ::socket] comman
24a0: 64 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65  d...[opt_def -se
24b0: 73 73 69 6f 6e 5f 69 64 20 5b 61 72 67 20 62 69  ssion_id [arg bi
24c0: 6e 61 72 79 5f 73 74 72 69 6e 67 5d 5d 0a 53 70  nary_string]].Sp
24d0: 65 63 69 66 69 65 73 20 74 68 65 20 73 65 73 73  ecifies the sess
24e0: 69 6f 6e 20 69 64 20 74 6f 20 72 65 73 75 6d 65  ion id to resume
24f0: 20 61 20 73 65 73 73 69 6f 6e 2e 20 4e 6f 74 20   a session. Not 
2500: 73 75 70 70 6f 72 74 65 64 20 79 65 74 2e 0a 54  supported yet..T
2510: 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65  his option is ne
2520: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
2530: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73 6c  ...[opt_def -ssl
2540: 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e  2 [arg bool]].En
2550: 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20  able use of SSL 
2560: 76 32 2e 54 68 65 20 64 65 66 61 75 6c 74 20 69  v2.The default i
2570: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e  s [const false].
2580: 0a 4f 70 65 6e 53 53 4c 20 31 2e 31 2b 20 6e 6f  .OpenSSL 1.1+ no
2590: 20 6c 6f 6e 67 65 72 20 73 75 70 70 6f 72 74 73   longer supports
25a0: 20 53 53 4c 20 76 32 2c 20 73 6f 20 74 68 69 73   SSL v2, so this
25b0: 20 6d 61 79 20 6e 6f 74 20 68 61 76 65 20 61 6e   may not have an
25c0: 79 20 65 66 66 65 63 74 2e 0a 53 65 65 20 74 68  y effect..See th
25d0: 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74  e [cmd tls::prot
25e0: 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66  ocols] command f
25f0: 6f 72 20 73 75 70 70 6f 72 74 65 64 20 70 72 6f  or supported pro
2600: 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65  tocols...[opt_de
2610: 66 20 2d 73 73 6c 33 20 5b 61 72 67 20 62 6f 6f  f -ssl3 [arg boo
2620: 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f  l]].Enable use o
2630: 66 20 53 53 4c 20 76 33 2e 20 54 68 65 20 64 65  f SSL v3. The de
2640: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
2650: 66 61 6c 73 65 5d 2e 20 53 74 61 72 74 69 6e 67  false]. Starting
2660: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c 0a   in TclTLS 1.8,.
2670: 75 73 65 20 6f 66 20 53 53 4c 20 76 33 20 69 66  use of SSL v3 if
2680: 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20   only available 
2690: 76 69 61 20 61 20 63 6f 6d 70 69 6c 65 20 74 69  via a compile ti
26a0: 6d 65 20 6f 70 74 69 6f 6e 2e 0a 4f 70 65 6e 53  me option..OpenS
26b0: 53 4c 20 34 2e 30 2b 20 6e 6f 20 6c 6f 6e 67 65  SL 4.0+ no longe
26c0: 72 20 73 75 70 70 6f 72 74 73 20 53 53 4c 20 76  r supports SSL v
26d0: 33 2c 20 73 6f 20 74 68 69 73 20 6d 61 79 20 6e  3, so this may n
26e0: 6f 74 20 68 61 76 65 20 61 6e 79 20 65 66 66 65  ot have any effe
26f0: 63 74 2e 0a 53 65 65 20 74 68 65 20 5b 63 6d 64  ct..See the [cmd
2700: 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d   tls::protocols]
2710: 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70   command for sup
2720: 70 6f 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73  ported protocols
2730: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73  ...[opt_def -tls
2740: 31 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e  1 [arg bool]].En
2750: 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20  able use of TLS 
2760: 76 31 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20  v1. Starting in 
2770: 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65 20  TclTLS 2.0, the 
2780: 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73  default is [cons
2790: 74 20 66 61 6c 73 65 5d 2e 0a 4e 6f 74 65 3a 20  t false]..Note: 
27a0: 54 4c 53 20 31 2e 30 20 6e 65 65 64 73 20 53 48  TLS 1.0 needs SH
27b0: 41 31 20 74 6f 20 6f 70 65 72 61 74 65 2c 20 77  A1 to operate, w
27c0: 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 61 76 61  hich is only ava
27d0: 69 6c 61 62 6c 65 20 69 6e 20 73 65 63 75 72 69  ilable in securi
27e0: 74 79 20 6c 65 76 65 6c 0a 30 20 66 6f 72 20 4f  ty level.0 for O
27f0: 70 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 20 53 65  pen SSL 3.0+. Se
2800: 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 73  e the [option -s
2810: 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 6f  ecurity_level] o
2820: 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66  ption...[opt_def
2830: 20 2d 74 6c 73 31 2e 31 20 5b 61 72 67 20 62 6f   -tls1.1 [arg bo
2840: 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20  ol]].Enable use 
2850: 6f 66 20 54 4c 53 20 76 31 2e 31 2e 20 53 74 61  of TLS v1.1. Sta
2860: 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20  rting in TclTLS 
2870: 32 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74  2.0, the default
2880: 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65   is [const false
2890: 5d 2e 0a 4e 6f 74 65 3a 20 54 4c 53 20 31 2e 31  ]..Note: TLS 1.1
28a0: 20 6e 65 65 64 73 20 53 48 41 31 20 74 6f 20 6f   needs SHA1 to o
28b0: 70 65 72 61 74 65 2c 20 77 68 69 63 68 20 69 73  perate, which is
28c0: 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20   only available 
28d0: 69 6e 20 73 65 63 75 72 69 74 79 20 6c 65 76 65  in security leve
28e0: 6c 0a 30 20 66 6f 72 20 4f 70 65 6e 20 53 53 4c  l.0 for Open SSL
28f0: 20 33 2e 30 2b 2e 20 53 65 65 20 74 68 65 20 5b   3.0+. See the [
2900: 6f 70 74 69 6f 6e 20 2d 73 65 63 75 72 69 74 79  option -security
2910: 5f 6c 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e 0a  _level] option..
2920: 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 2e  .[opt_def -tls1.
2930: 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e  2 [arg bool]].En
2940: 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20  able use of TLS 
2950: 76 31 2e 32 2e 20 54 68 65 20 64 65 66 61 75 6c  v1.2. The defaul
2960: 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65  t is [const true
2970: 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c  ]...[opt_def -tl
2980: 73 31 2e 33 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d  s1.3 [arg bool]]
2990: 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54  .Enable use of T
29a0: 4c 53 20 76 31 2e 33 2e 20 54 68 65 20 64 65 66  LS v1.3. The def
29b0: 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74  ault is [const t
29c0: 72 75 65 5d 2e 20 54 68 69 73 20 69 73 20 6f 6e  rue]. This is on
29d0: 6c 79 20 61 76 61 69 6c 61 62 6c 65 0a 73 74 61  ly available.sta
29e0: 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e 53  rting with OpenS
29f0: 53 4c 20 31 2e 31 2e 31 20 61 6e 64 20 54 63 6c  SL 1.1.1 and Tcl
2a00: 54 4c 53 20 31 2e 37 2e 0a 0a 5b 6f 70 74 5f 64  TLS 1.7...[opt_d
2a10: 65 66 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d  ef -validatecomm
2a20: 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62 61 63  and [arg callbac
2a30: 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  k]].Specifies th
2a40: 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d 61  e callback comma
2a50: 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20 74 6f 20  nd to invoke to 
2a60: 76 61 6c 69 64 61 74 65 20 74 68 65 20 70 65 65  validate the pee
2a70: 72 20 63 65 72 74 69 66 69 63 61 74 65 73 0a 61  r certificates.a
2a80: 6e 64 20 6f 74 68 65 72 20 63 6f 6e 66 69 67 20  nd other config 
2a90: 69 6e 66 6f 20 64 75 72 69 6e 67 20 74 68 65 20  info during the 
2aa0: 70 72 6f 74 6f 63 6f 6c 20 6e 65 67 6f 74 69 61  protocol negotia
2ab0: 74 69 6f 6e 20 70 68 61 73 65 2e 20 54 68 69 73  tion phase. This
2ac0: 20 63 61 6e 20 62 65 20 75 73 65 64 0a 62 79 20   can be used.by 
2ad0: 54 43 4c 20 73 63 72 69 70 74 73 20 74 6f 20 70  TCL scripts to p
2ae0: 65 72 66 6f 72 6d 20 74 68 65 69 72 20 6f 77 6e  erform their own
2af0: 20 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c   Certificate Val
2b00: 69 64 61 74 69 6f 6e 20 74 6f 20 73 75 70 70 6c  idation to suppl
2b10: 65 6d 65 6e 74 20 74 68 65 0a 64 65 66 61 75 6c  ement the.defaul
2b20: 74 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72 6f  t validation pro
2b30: 76 69 64 65 64 20 62 79 20 4f 70 65 6e 53 53 4c  vided by OpenSSL
2b40: 2e 20 54 68 65 20 73 63 72 69 70 74 20 6d 75 73  . The script mus
2b50: 74 20 72 65 74 75 72 6e 20 61 20 62 6f 6f 6c 65  t return a boole
2b60: 61 6e 20 74 72 75 65 0a 74 6f 20 63 6f 6e 74 69  an true.to conti
2b70: 6e 75 65 20 74 68 65 20 6e 65 67 6f 74 69 61 74  nue the negotiat
2b80: 69 6f 6e 2e 20 53 65 65 20 5b 73 65 63 74 72 65  ion. See [sectre
2b90: 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74 69  f "Callback Opti
2ba0: 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20 69  ons"] for more i
2bb0: 6e 66 6f 2e 0a 54 68 69 73 20 6f 70 74 69 6f 6e  nfo..This option
2bc0: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
2bd0: 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65  LS 1.8...[list_e
2be0: 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20  nd]..[call [cmd 
2bf0: 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 5d 20  tls::handshake] 
2c00: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a  [arg channel]]..
2c10: 46 6f 72 63 65 73 20 74 68 65 20 54 4c 53 20 6e  Forces the TLS n
2c20: 65 67 6f 74 69 61 74 69 6f 6e 20 68 61 6e 64 73  egotiation hands
2c30: 68 61 6b 65 20 74 6f 20 74 61 6b 65 20 70 6c 61  hake to take pla
2c40: 63 65 20 69 6d 6d 65 64 69 61 74 65 6c 79 2c 20  ce immediately, 
2c50: 61 6e 64 20 72 65 74 75 72 6e 73 20 30 0a 69 66  and returns 0.if
2c60: 20 68 61 6e 64 73 68 61 6b 65 20 69 73 20 73 74   handshake is st
2c70: 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65 73 73 20  ill in progress 
2c80: 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 29 2c 20  (non-blocking), 
2c90: 6f 72 20 31 20 69 66 20 74 68 65 20 68 61 6e 64  or 1 if the hand
2ca0: 73 68 61 6b 65 20 77 61 73 0a 73 75 63 63 65 73  shake was.succes
2cb0: 73 66 75 6c 2e 20 49 66 20 74 68 65 20 68 61 6e  sful. If the han
2cc0: 64 73 68 61 6b 65 20 66 61 69 6c 65 64 2c 20 61  dshake failed, a
2cd0: 6e 20 65 72 72 6f 72 20 77 69 6c 6c 20 62 65 20  n error will be 
2ce0: 72 65 74 75 72 6e 65 64 2e 0a 0a 5b 63 61 6c 6c  returned...[call
2cf0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 68 75 74 64   [cmd tls::shutd
2d00: 6f 77 6e 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65  own] [arg channe
2d10: 6c 5d 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20  l]]..[call [cmd 
2d20: 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d 20 5b  tls::unimport] [
2d30: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 5b  arg channel]]..[
2d40: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 75  call [cmd tls::u
2d50: 6e 73 74 61 63 6b 5d 20 5b 61 72 67 20 63 68 61  nstack] [arg cha
2d60: 6e 6e 65 6c 5d 5d 0a 0a 54 68 69 73 20 74 65 72  nnel]]..This ter
2d70: 6d 69 6e 61 74 65 73 20 74 68 65 20 53 53 4c 2f  minates the SSL/
2d80: 54 4c 53 20 73 65 73 73 69 6f 6e 20 62 79 20 73  TLS session by s
2d90: 65 6e 64 69 6e 67 20 74 68 65 20 22 63 6c 6f 73  ending the "clos
2da0: 65 5f 6e 6f 74 69 66 79 22 20 6d 65 73 73 61 67  e_notify" messag
2db0: 65 20 61 6e 64 0a 72 65 6d 6f 76 65 73 20 74 68  e and.removes th
2dc0: 65 20 74 6f 70 20 6c 65 76 65 6c 20 73 74 61 63  e top level stac
2dd0: 6b 65 64 20 63 68 61 6e 6e 65 6c 20 66 72 6f 6d  ked channel from
2de0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2c 20   [arg channel], 
2df0: 62 75 74 20 69 74 20 64 6f 65 73 20 6e 6f 74 20  but it does not 
2e00: 63 6c 6f 73 65 0a 74 68 65 20 73 6f 63 6b 65 74  close.the socket
2e10: 2e 20 49 74 20 69 73 20 74 68 65 20 63 6f 6d 70  . It is the comp
2e20: 6c 69 6d 65 6e 74 20 74 6f 20 5b 63 6d 64 20 74  liment to [cmd t
2e30: 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20 62 79 20 65  ls::import] by e
2e40: 6e 64 69 6e 67 20 65 6e 63 72 79 70 74 69 6f 6e  nding encryption
2e50: 20 6f 66 0a 61 20 54 43 4c 20 63 68 61 6e 6e 65   of.a TCL channe
2e60: 6c 2e 20 41 6e 20 65 72 72 6f 72 20 69 73 20 74  l. An error is t
2e70: 68 72 6f 77 6e 20 69 66 20 54 4c 53 20 69 73 20  hrown if TLS is 
2e80: 6e 6f 74 20 74 68 65 20 74 6f 70 20 73 74 61 63  not the top stac
2e90: 6b 65 64 20 63 68 61 6e 6e 65 6c 20 74 79 70 65  ked channel type
2ea0: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ...[call [cmd tl
2eb0: 73 3a 3a 73 74 61 74 75 73 5d 20 5b 6f 70 74 20  s::status] [opt 
2ec0: 5b 6f 70 74 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 5d  [option -local]]
2ed0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a   [arg channel]].
2ee0: 0a 52 65 74 75 72 6e 73 20 74 68 65 20 63 75 72  .Returns the cur
2ef0: 72 65 6e 74 20 73 74 61 74 75 73 20 6f 66 20 61  rent status of a
2f00: 6e 20 53 53 4c 20 63 68 61 6e 6e 65 6c 2e 20 54  n SSL channel. T
2f10: 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 20 6c  he result is a l
2f20: 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65  ist of key-value
2f30: 0a 70 61 69 72 73 20 64 65 73 63 72 69 62 69 6e  .pairs describin
2f40: 67 20 74 68 65 20 53 53 4c 2c 20 63 65 72 74 69  g the SSL, certi
2f50: 66 69 63 61 74 65 2c 20 61 6e 64 20 63 65 72 74  ficate, and cert
2f60: 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63 61  ificate verifica
2f70: 74 69 6f 6e 20 73 74 61 74 75 73 2e 20 49 66 0a  tion status. If.
2f80: 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b  the SSL handshak
2f90: 65 20 68 61 73 20 6e 6f 74 20 79 65 74 20 63 6f  e has not yet co
2fa0: 6d 70 6c 65 74 65 64 2c 20 61 6e 20 65 6d 70 74  mpleted, an empt
2fb0: 79 20 6c 69 73 74 20 69 73 20 72 65 74 75 72 6e  y list is return
2fc0: 65 64 2e 20 49 66 20 74 68 65 0a 5b 6f 70 74 69  ed. If the.[opti
2fd0: 6f 6e 20 2d 6c 6f 63 61 6c 5d 20 6f 70 74 69 6f  on -local] optio
2fe0: 6e 20 69 73 20 73 70 65 63 69 66 69 65 64 2c 20  n is specified, 
2ff0: 74 68 65 6e 20 74 68 65 20 6c 6f 63 61 6c 20 63  then the local c
3000: 65 72 74 69 66 69 63 61 74 65 20 69 73 20 75 73  ertificate is us
3010: 65 64 2e 0a 52 65 74 75 72 6e 65 64 20 76 61 6c  ed..Returned val
3020: 75 65 73 20 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70  ues include:..[p
3030: 61 72 61 5d 0a 0a 53 53 4c 20 53 74 61 74 75 73  ara]..SSL Status
3040: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
3050: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
3060: 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20 5b 61 72   "[var alpn] [ar
3070: 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 68  g protocol]"].Th
3080: 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65 6c 65 63  e protocol selec
3090: 74 65 64 20 61 66 74 65 72 20 41 70 70 6c 69 63  ted after Applic
30a0: 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f 74  ation-Layer Prot
30b0: 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e  ocol Negotiation
30c0: 20 28 41 4c 50 4e 29 2e 0a 54 68 69 73 20 76 61   (ALPN)..This va
30d0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
30e0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
30f0: 20 22 5b 76 61 72 20 63 69 70 68 65 72 5d 20 5b   "[var cipher] [
3100: 61 72 67 20 63 69 70 68 65 72 5d 22 5d 0a 54 68  arg cipher]"].Th
3110: 65 20 63 75 72 72 65 6e 74 20 63 69 70 68 65 72  e current cipher
3120: 20 69 6e 20 75 73 65 20 66 6f 72 20 74 68 65 20   in use for the 
3130: 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22  session...[def "
3140: 5b 76 61 72 20 70 65 65 72 6e 61 6d 65 5d 20 5b  [var peername] [
3150: 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 65 20  arg name]"].The 
3160: 70 65 65 72 6e 61 6d 65 20 66 72 6f 6d 20 74 68  peername from th
3170: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54  e certificate..T
3180: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3190: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
31a0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 72 6f  ..[def "[var pro
31b0: 74 6f 63 6f 6c 5d 20 5b 61 72 67 20 76 65 72 73  tocol] [arg vers
31c0: 69 6f 6e 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f  ion]"].The proto
31d0: 63 6f 6c 20 76 65 72 73 69 6f 6e 20 75 73 65 64  col version used
31e0: 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 74   for the connect
31f0: 69 6f 6e 3a 20 53 53 4c 32 2c 20 53 53 4c 33 2c  ion: SSL2, SSL3,
3200: 20 54 4c 53 31 2c 20 54 4c 53 31 2e 31 2c 20 54   TLS1, TLS1.1, T
3210: 4c 53 31 2e 32 2c 0a 54 4c 53 31 2e 33 2c 20 6f  LS1.2,.TLS1.3, o
3220: 72 20 75 6e 6b 6e 6f 77 6e 2e 20 54 68 69 73 20  r unknown. This 
3230: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3240: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
3250: 65 66 20 22 5b 76 61 72 20 73 62 69 74 73 5d 20  ef "[var sbits] 
3260: 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75  [arg n]"].The nu
3270: 6d 62 65 72 20 6f 66 20 62 69 74 73 20 75 73 65  mber of bits use
3280: 64 20 66 6f 72 20 74 68 65 20 73 65 73 73 69 6f  d for the sessio
3290: 6e 20 6b 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76  n key...[def "[v
32a0: 61 72 20 73 69 67 6e 61 74 75 72 65 48 61 73 68  ar signatureHash
32b0: 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20  Algorithm] [arg 
32c0: 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 54 68 65  algorithm]"].The
32d0: 20 73 69 67 6e 61 74 75 72 65 20 68 61 73 68 20   signature hash 
32e0: 61 6c 67 6f 72 69 74 68 6d 2e 0a 54 68 69 73 20  algorithm..This 
32f0: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3300: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
3310: 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75  ef "[var signatu
3320: 72 65 54 79 70 65 5d 20 5b 61 72 67 20 74 79 70  reType] [arg typ
3330: 65 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61 74 75  e]"].The signatu
3340: 72 65 20 74 79 70 65 20 76 61 6c 75 65 2e 0a 54  re type value..T
3350: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3360: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3370: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72  ..[def "[var ver
3380: 69 66 79 44 65 70 74 68 5d 20 5b 61 72 67 20 6e  ifyDepth] [arg n
3390: 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20 64 65 70 74  ]"].Maximum dept
33a0: 68 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 66  h for the certif
33b0: 69 63 61 74 65 20 63 68 61 69 6e 20 76 65 72 69  icate chain veri
33c0: 66 69 63 61 74 69 6f 6e 2e 20 44 65 66 61 75 6c  fication. Defaul
33d0: 74 20 69 73 20 2d 31 2c 20 74 6f 20 63 68 65 63  t is -1, to chec
33e0: 6b 20 61 6c 6c 2e 0a 54 68 69 73 20 76 61 6c 75  k all..This valu
33f0: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3400: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3410: 5b 76 61 72 20 76 65 72 69 66 79 4d 6f 64 65 5d  [var verifyMode]
3420: 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69   [arg list]"].Li
3430: 73 74 20 6f 66 20 63 65 72 74 69 66 69 63 61 74  st of certificat
3440: 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 6d  e verification m
3450: 6f 64 65 73 2e 0a 54 68 69 73 20 76 61 6c 75 65  odes..This value
3460: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
3470: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
3480: 76 61 72 20 76 65 72 69 66 79 52 65 73 75 6c 74  var verifyResult
3490: 5d 20 5b 61 72 67 20 72 65 73 75 6c 74 5d 22 5d  ] [arg result]"]
34a0: 0a 43 65 72 74 69 66 69 63 61 74 65 20 76 65 72  .Certificate ver
34b0: 69 66 69 63 61 74 69 6f 6e 20 72 65 73 75 6c 74  ification result
34c0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
34d0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
34e0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
34f0: 63 61 5f 6e 61 6d 65 73 5d 20 5b 61 72 67 20 6c  ca_names] [arg l
3500: 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 74  ist]"].List of t
3510: 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41  he Certificate A
3520: 75 74 68 6f 72 69 74 69 65 73 20 75 73 65 64 20  uthorities used 
3530: 74 6f 20 63 72 65 61 74 65 20 74 68 65 20 63 65  to create the ce
3540: 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20  rtificate..This 
3550: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3560: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c   TclTLS 1.8...[l
3570: 69 73 74 5f 65 6e 64 5d 0a 0a 43 65 72 74 69 66  ist_end]..Certif
3580: 69 63 61 74 65 20 53 74 61 74 75 73 0a 0a 5b 6c  icate Status..[l
3590: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
35a0: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76  tions]..[def "[v
35b0: 61 72 20 61 6c 6c 5d 20 5b 61 72 67 20 73 74 72  ar all] [arg str
35c0: 69 6e 67 5d 22 5d 0a 44 75 6d 70 20 6f 66 20 61  ing]"].Dump of a
35d0: 6c 6c 20 63 65 72 74 69 66 69 63 61 74 65 20 69  ll certificate i
35e0: 6e 66 6f 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  nfo..This value 
35f0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3600: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3610: 61 72 20 76 65 72 73 69 6f 6e 5d 20 5b 61 72 67  ar version] [arg
3620: 20 76 61 6c 75 65 5d 22 5d 0a 54 68 65 20 63 65   value]"].The ce
3630: 72 74 69 66 69 63 61 74 65 20 76 65 72 73 69 6f  rtificate versio
3640: 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  n...[def "[var s
3650: 65 72 69 61 6c 4e 75 6d 62 65 72 5d 20 5b 61 72  erialNumber] [ar
3660: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20  g string]"].The 
3670: 73 65 72 69 61 6c 20 6e 75 6d 62 65 72 20 6f 66  serial number of
3680: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
3690: 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67   as a hex string
36a0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 77 61 73  ..This value was
36b0: 20 63 68 61 6e 67 65 64 20 66 72 6f 6d 20 73 65   changed from se
36c0: 72 69 61 6c 20 69 6e 20 54 63 6c 54 4c 53 20 31  rial in TclTLS 1
36d0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
36e0: 73 69 67 6e 61 74 75 72 65 5d 20 5b 61 72 67 20  signature] [arg 
36f0: 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 69 70  algorithm]"].Cip
3700: 68 65 72 20 61 6c 67 6f 72 69 74 68 6d 20 75 73  her algorithm us
3710: 65 64 20 66 6f 72 20 63 65 72 74 69 66 69 63 61  ed for certifica
3720: 74 65 20 73 69 67 6e 61 74 75 72 65 2e 0a 54 68  te signature..Th
3730: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
3740: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
3750: 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73 73 75  .[def "[var issu
3760: 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  er] [arg string]
3770: 22 5d 0a 54 68 65 20 64 69 73 74 69 6e 67 75 69  "].The distingui
3780: 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f  shed name (DN) o
3790: 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  f the certificat
37a0: 65 20 69 73 73 75 65 72 2e 0a 0a 5b 64 65 66 20  e issuer...[def 
37b0: 22 5b 76 61 72 20 6e 6f 74 42 65 66 6f 72 65 5d  "[var notBefore]
37c0: 20 5b 61 72 67 20 64 61 74 65 5d 22 5d 0a 54 68   [arg date]"].Th
37d0: 65 20 62 65 67 69 6e 6e 69 6e 67 20 64 61 74 65  e beginning date
37e0: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
37f0: 61 74 65 20 76 61 6c 69 64 69 74 79 2e 0a 0a 5b  ate validity...[
3800: 64 65 66 20 22 5b 76 61 72 20 6e 6f 74 41 66 74  def "[var notAft
3810: 65 72 5d 20 5b 61 72 67 20 64 61 74 65 5d 22 5d  er] [arg date]"]
3820: 0a 54 68 65 20 65 78 70 69 72 61 74 69 6f 6e 20  .The expiration 
3830: 64 61 74 65 20 6f 66 20 74 68 65 20 63 65 72 74  date of the cert
3840: 69 66 69 63 61 74 65 20 76 61 6c 69 64 69 74 79  ificate validity
3850: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 75  ...[def "[var su
3860: 62 6a 65 63 74 5d 20 5b 61 72 67 20 73 74 72 69  bject] [arg stri
3870: 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73 74 69 6e  ng]"].The distin
3880: 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e  guished name (DN
3890: 29 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  ) of the certifi
38a0: 63 61 74 65 20 73 75 62 6a 65 63 74 2e 20 46 69  cate subject. Fi
38b0: 65 6c 64 73 20 69 6e 63 6c 75 64 65 3a 20 43 6f  elds include: Co
38c0: 6d 6d 6f 6e 0a 4e 61 6d 65 20 28 43 4e 29 2c 20  mmon.Name (CN), 
38d0: 4f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 28 4f 29  Organization (O)
38e0: 2c 20 4c 6f 63 61 6c 69 74 79 20 6f 72 20 43 69  , Locality or Ci
38f0: 74 79 20 28 4c 29 2c 20 53 74 61 74 65 20 6f 72  ty (L), State or
3900: 20 50 72 6f 76 69 6e 63 65 20 28 53 29 2c 20 61   Province (S), a
3910: 6e 64 0a 43 6f 75 6e 74 72 79 20 4e 61 6d 65 20  nd.Country Name 
3920: 28 43 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  (C)...[def "[var
3930: 20 69 73 73 75 65 72 55 6e 69 71 75 65 49 44 5d   issuerUniqueID]
3940: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3950: 54 68 65 20 69 73 73 75 65 72 20 75 6e 69 71 75  The issuer uniqu
3960: 65 20 69 64 2e 0a 54 68 69 73 20 76 61 6c 75 65  e id..This value
3970: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
3980: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
3990: 76 61 72 20 73 75 62 6a 65 63 74 55 6e 69 71 75  var subjectUniqu
39a0: 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  eID] [arg string
39b0: 5d 22 5d 0a 54 68 65 20 73 75 62 6a 65 63 74 20  ]"].The subject 
39c0: 75 6e 69 71 75 65 20 69 64 2e 0a 54 68 69 73 20  unique id..This 
39d0: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
39e0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
39f0: 65 66 20 22 5b 76 61 72 20 6e 75 6d 5f 65 78 74  ef "[var num_ext
3a00: 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6e 5d  ensions] [arg n]
3a10: 22 5d 0a 4e 75 6d 62 65 72 20 6f 66 20 63 65 72  "].Number of cer
3a20: 74 69 66 69 63 61 74 65 20 65 78 74 65 6e 73 69  tificate extensi
3a30: 6f 6e 73 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ons..This value 
3a40: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3a50: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3a60: 61 72 20 65 78 74 65 6e 73 69 6f 6e 73 5d 20 5b  ar extensions] [
3a70: 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74  arg list]"].List
3a80: 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 20   of certificate 
3a90: 65 78 74 65 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e  extension names.
3aa0: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3ab0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3ac0: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  8...[def "[var a
3ad0: 75 74 68 6f 72 69 74 79 4b 65 79 49 64 65 6e 74  uthorityKeyIdent
3ae0: 69 66 69 65 72 5d 20 5b 61 72 67 20 73 74 72 69  ifier] [arg stri
3af0: 6e 67 5d 22 5d 0a 41 75 74 68 6f 72 69 74 79 20  ng]"].Authority 
3b00: 4b 65 79 20 49 64 65 6e 74 69 66 69 65 72 20 28  Key Identifier (
3b10: 41 4b 49 29 20 6f 66 20 74 68 65 20 49 73 73 75  AKI) of the Issu
3b20: 69 6e 67 20 43 41 20 63 65 72 74 69 66 69 63 61  ing CA certifica
3b30: 74 65 20 74 68 61 74 20 73 69 67 6e 65 64 20 74  te that signed t
3b40: 68 65 0a 53 53 4c 20 63 65 72 74 69 66 69 63 61  he.SSL certifica
3b50: 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72 69  te as a hex stri
3b60: 6e 67 2e 20 54 68 69 73 20 76 61 6c 75 65 20 6d  ng. This value m
3b70: 61 74 63 68 65 73 20 74 68 65 20 53 4b 49 20 76  atches the SKI v
3b80: 61 6c 75 65 20 6f 66 20 74 68 65 0a 49 6e 74 65  alue of the.Inte
3b90: 72 6d 65 64 69 61 74 65 20 43 41 20 63 65 72 74  rmediate CA cert
3ba0: 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61  ificate..This va
3bb0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3bc0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3bd0: 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74 4b 65   "[var subjectKe
3be0: 79 49 64 65 6e 74 69 66 69 65 72 5d 20 5b 61 72  yIdentifier] [ar
3bf0: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 53 75 62 6a  g string]"].Subj
3c00: 65 63 74 20 4b 65 79 20 49 64 65 6e 74 69 66 69  ect Key Identifi
3c10: 65 72 20 28 53 4b 49 29 20 68 61 73 68 20 6f 66  er (SKI) hash of
3c20: 20 74 68 65 20 70 75 62 6c 69 63 20 6b 65 79 20   the public key 
3c30: 69 6e 73 69 64 65 20 74 68 65 20 63 65 72 74 69  inside the certi
3c40: 66 69 63 61 74 65 20 61 73 20 61 0a 68 65 78 20  ficate as a.hex 
3c50: 73 74 72 69 6e 67 2e 20 55 73 65 64 20 74 6f 20  string. Used to 
3c60: 69 64 65 6e 74 69 66 79 20 63 65 72 74 69 66 69  identify certifi
3c70: 63 61 74 65 73 20 74 68 61 74 20 63 6f 6e 74 61  cates that conta
3c80: 69 6e 20 61 20 70 61 72 74 69 63 75 6c 61 72 20  in a particular 
3c90: 70 75 62 6c 69 63 20 6b 65 79 2e 0a 54 68 69 73  public key..This
3ca0: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
3cb0: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
3cc0: 64 65 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63  def "[var subjec
3cd0: 74 41 6c 74 4e 61 6d 65 5d 20 5b 61 72 67 20 6c  tAltName] [arg l
3ce0: 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 61  ist]"].List of a
3cf0: 6c 6c 20 6f 66 20 74 68 65 20 53 75 62 6a 65 63  ll of the Subjec
3d00: 74 20 41 6c 74 65 72 6e 61 74 69 76 65 20 4e 61  t Alternative Na
3d10: 6d 65 73 20 28 53 41 4e 29 20 69 6e 63 6c 75 64  mes (SAN) includ
3d20: 69 6e 67 20 64 6f 6d 61 69 6e 20 6e 61 6d 65 73  ing domain names
3d30: 2c 20 73 75 62 0a 64 6f 6d 61 69 6e 73 2c 20 61  , sub.domains, a
3d40: 6e 64 20 49 50 20 61 64 64 72 65 73 73 65 73 20  nd IP addresses 
3d50: 74 68 61 74 20 61 72 65 20 73 65 63 75 72 65 64  that are secured
3d60: 20 62 79 20 74 68 65 20 63 65 72 74 69 66 69 63   by the certific
3d70: 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ate..This value 
3d80: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3d90: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3da0: 61 72 20 6f 63 73 70 5d 20 5b 61 72 67 20 6c 69  ar ocsp] [arg li
3db0: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 61 6c  st]"].List of al
3dc0: 6c 20 4f 6e 6c 69 6e 65 20 43 65 72 74 69 66 69  l Online Certifi
3dd0: 63 61 74 65 20 53 74 61 74 75 73 20 50 72 6f 74  cate Status Prot
3de0: 6f 63 6f 6c 20 28 4f 43 53 50 29 20 55 52 4c 73  ocol (OCSP) URLs
3df0: 20 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65   that can be use
3e00: 64 20 74 6f 0a 63 68 65 63 6b 20 74 68 65 20 76  d to.check the v
3e10: 61 6c 69 64 69 74 79 20 6f 66 20 74 68 69 73 20  alidity of this 
3e20: 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69  certificate..Thi
3e30: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3e40: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3e50: 5b 64 65 66 20 22 5b 76 61 72 20 63 65 72 74 69  [def "[var certi
3e60: 66 69 63 61 74 65 5d 20 5b 61 72 67 20 63 65 72  ficate] [arg cer
3e70: 74 5d 22 5d 0a 54 68 65 20 50 45 4d 20 65 6e 63  t]"].The PEM enc
3e80: 6f 64 65 64 20 63 65 72 74 69 66 69 63 61 74 65  oded certificate
3e90: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69  ...[def "[var si
3ea0: 67 6e 61 74 75 72 65 41 6c 67 6f 72 69 74 68 6d  gnatureAlgorithm
3eb0: 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68 6d  ] [arg algorithm
3ec0: 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c 67 6f 72  ]"].Cipher algor
3ed0: 69 74 68 6d 20 75 73 65 64 20 66 6f 72 20 74 68  ithm used for th
3ee0: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 73 69  e certificate si
3ef0: 67 6e 61 74 75 72 65 2e 0a 54 68 69 73 20 76 61  gnature..This va
3f00: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3f10: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3f20: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65   "[var signature
3f30: 56 61 6c 75 65 5d 20 5b 61 72 67 20 73 74 72 69  Value] [arg stri
3f40: 6e 67 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74  ng]"].Certificat
3f50: 65 20 73 69 67 6e 61 74 75 72 65 20 61 73 20 61  e signature as a
3f60: 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68 69   hex string..Thi
3f70: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3f80: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3f90: 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61  [def "[var signa
3fa0: 74 75 72 65 44 69 67 65 73 74 5d 20 5b 61 72 67  tureDigest] [arg
3fb0: 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 43 65 72 74   version]"].Cert
3fc0: 69 66 69 63 61 74 65 20 73 69 67 6e 69 6e 67 20  ificate signing 
3fd0: 64 69 67 65 73 74 20 61 73 20 61 20 68 65 78 20  digest as a hex 
3fe0: 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c  string..This val
3ff0: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
4000: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
4010: 22 5b 76 61 72 20 70 75 62 6c 69 63 4b 65 79 41  "[var publicKeyA
4020: 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20 61  lgorithm] [arg a
4030: 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 65 72 74  lgorithm]"].Cert
4040: 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72  ificate signatur
4050: 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 6c 67  e public key alg
4060: 6f 72 69 74 68 6d 2e 0a 54 68 69 73 20 76 61 6c  orithm..This val
4070: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
4080: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
4090: 22 5b 76 61 72 20 70 75 62 6c 69 63 4b 65 79 5d  "[var publicKey]
40a0: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
40b0: 43 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e  Certificate sign
40c0: 61 74 75 72 65 20 70 75 62 6c 69 63 20 6b 65 79  ature public key
40d0: 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67   as a hex string
40e0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
40f0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
4100: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
4110: 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a  bits] [arg n]"].
4120: 4e 75 6d 62 65 72 20 6f 66 20 62 69 74 73 20 75  Number of bits u
4130: 73 65 64 20 66 6f 72 20 63 65 72 74 69 66 69 63  sed for certific
4140: 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 6b 65  ate signature ke
4150: 79 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  y..This value is
4160: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
4170: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
4180: 20 73 65 6c 66 5f 73 69 67 6e 65 64 5d 20 5b 61   self_signed] [a
4190: 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68  rg boolean]"].Wh
41a0: 65 74 68 65 72 20 74 68 65 20 63 65 72 74 69 66  ether the certif
41b0: 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20  icate signature 
41c0: 69 73 20 73 65 6c 66 20 73 69 67 6e 65 64 2e 0a  is self signed..
41d0: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
41e0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
41f0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 68  ...[def "[var sh
4200: 61 31 5f 68 61 73 68 5d 20 5b 61 72 67 20 68 61  a1_hash] [arg ha
4210: 73 68 5d 22 5d 0a 54 68 65 20 53 48 41 31 20 68  sh]"].The SHA1 h
4220: 61 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 69  ash of the certi
4230: 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78 20  ficate as a hex 
4240: 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c  string..This val
4250: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
4260: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
4270: 22 5b 76 61 72 20 73 68 61 32 35 36 5f 68 61 73  "[var sha256_has
4280: 68 5d 20 5b 61 72 67 20 68 61 73 68 5d 22 5d 0a  h] [arg hash]"].
4290: 54 68 65 20 53 48 41 32 35 36 20 68 61 73 68 20  The SHA256 hash 
42a0: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61  of the certifica
42b0: 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72 69  te as a hex stri
42c0: 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  ng..This value i
42d0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
42e0: 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64   1.8...[list_end
42f0: 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ]..[call [cmd tl
4300: 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5d 20 5b  s::connection] [
4310: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52  arg channel]]..R
4320: 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65  eturns the curre
4330: 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74  nt connection st
4340: 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20 63  atus of an SSL c
4350: 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73 75  hannel. The resu
4360: 6c 74 20 69 73 20 61 20 6c 69 73 74 0a 6f 66 20  lt is a list.of 
4370: 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73 20  key-value pairs 
4380: 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 63  describing the c
4390: 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 54 68 69 73 20  onnection..This 
43a0: 63 6f 6d 6d 61 6e 64 20 69 73 20 6e 65 77 20 66  command is new f
43b0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 52  or TclTLS 1.8. R
43c0: 65 74 75 72 6e 65 64 20 76 61 6c 75 65 73 20 69  eturned values i
43d0: 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a  nclude:..[para].
43e0: 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69  .SSL Status..[li
43f0: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
4400: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61  ions]..[def "[va
4410: 72 20 73 74 61 74 65 5d 20 5b 61 72 67 20 73 74  r state] [arg st
4420: 61 74 65 5d 22 5d 0a 53 74 61 74 65 20 6f 66 20  ate]"].State of 
4430: 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a  the connection..
4440: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 72 76  .[def "[var serv
4450: 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d  ername] [arg nam
4460: 65 5d 22 5d 0a 54 68 65 20 6e 61 6d 65 20 6f 66  e]"].The name of
4470: 20 74 68 65 20 63 6f 6e 6e 65 63 74 65 64 20 74   the connected t
4480: 6f 20 73 65 72 76 65 72 2e 0a 0a 5b 64 65 66 20  o server...[def 
4490: 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20  "[var protocol] 
44a0: 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a  [arg version]"].
44b0: 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72  The protocol ver
44c0: 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 68  sion used for th
44d0: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53  e connection: SS
44e0: 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20  L2, SSL3, TLS1, 
44f0: 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20  TLS1.1, TLS1.2, 
4500: 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f  TLS1.3, or unkno
4510: 77 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  wn...[def "[var 
4520: 72 65 6e 65 67 6f 74 69 61 74 69 6f 6e 5f 61 6c  renegotiation_al
4530: 6c 6f 77 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c  lowed] [arg bool
4540: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 70  ean]"].Whether p
4550: 72 6f 74 6f 63 6f 6c 20 72 65 6e 65 67 6f 74 69  rotocol renegoti
4560: 61 74 69 6f 6e 20 69 73 20 73 75 70 70 6f 72 74  ation is support
4570: 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66  ed or not...[def
4580: 20 22 5b 76 61 72 20 73 65 63 75 72 69 74 79 5f   "[var security_
4590: 6c 65 76 65 6c 5d 20 5b 61 72 67 20 6c 65 76 65  level] [arg leve
45a0: 6c 5d 22 5d 0a 54 68 65 20 73 65 63 75 72 69 74  l]"].The securit
45b0: 79 20 6c 65 76 65 6c 20 75 73 65 64 20 66 6f 72  y level used for
45c0: 20 73 65 6c 65 63 74 69 6f 6e 20 6f 66 20 63 69   selection of ci
45d0: 70 68 65 72 73 2c 20 6b 65 79 20 73 69 7a 65 2c  phers, key size,
45e0: 20 65 74 63 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   etc...[def "[va
45f0: 72 20 73 65 73 73 69 6f 6e 5f 72 65 75 73 65 64  r session_reused
4600: 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22  ] [arg boolean]"
4610: 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 73 65  ].Whether the se
4620: 73 73 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 72  ssion has been r
4630: 65 75 73 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b  eused or not...[
4640: 64 65 66 20 22 5b 76 61 72 20 69 73 5f 73 65 72  def "[var is_ser
4650: 76 65 72 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61  ver] [arg boolea
4660: 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65  n]"].Whether the
4670: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 69 73 20 63   connection is c
4680: 6f 6e 66 69 67 75 72 65 64 20 61 73 20 61 20 73  onfigured as a s
4690: 65 72 76 65 72 20 28 31 29 20 6f 72 20 63 6c 69  erver (1) or cli
46a0: 65 6e 74 20 28 30 29 2e 0a 0a 5b 64 65 66 20 22  ent (0)...[def "
46b0: 5b 76 61 72 20 63 6f 6d 70 72 65 73 73 69 6f 6e  [var compression
46c0: 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 43  ] [arg mode]"].C
46d0: 6f 6d 70 72 65 73 73 69 6f 6e 20 6d 65 74 68 6f  ompression metho
46e0: 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65  d...[def "[var e
46f0: 78 70 61 6e 73 69 6f 6e 5d 20 5b 61 72 67 20 6d  xpansion] [arg m
4700: 6f 64 65 5d 22 5d 0a 45 78 70 61 6e 73 69 6f 6e  ode]"].Expansion
4710: 20 6d 65 74 68 6f 64 2e 0a 0a 5b 64 65 66 20 22   method...[def "
4720: 5b 76 61 72 20 63 61 4c 69 73 74 5d 20 5b 61 72  [var caList] [ar
4730: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f  g list]"].List o
4740: 66 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  f Certificate Au
4750: 74 68 6f 72 69 74 69 65 73 20 28 43 41 29 20 66  thorities (CA) f
4760: 6f 72 20 58 2e 35 30 39 20 63 65 72 74 69 66 69  or X.509 certifi
4770: 63 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  cate...[list_end
4780: 5d 0a 0a 43 69 70 68 65 72 20 49 6e 66 6f 0a 0a  ]..Cipher Info..
4790: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
47a0: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22  nitions]..[def "
47b0: 5b 76 61 72 20 63 69 70 68 65 72 5d 20 5b 61 72  [var cipher] [ar
47c0: 67 20 63 69 70 68 65 72 5d 22 5d 0a 54 68 65 20  g cipher]"].The 
47d0: 63 75 72 72 65 6e 74 20 63 69 70 68 65 72 20 69  current cipher i
47e0: 6e 20 75 73 65 20 66 6f 72 20 74 68 65 20 63 6f  n use for the co
47f0: 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20  nnection...[def 
4800: 22 5b 76 61 72 20 73 74 61 6e 64 61 72 64 5f 6e  "[var standard_n
4810: 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22  ame] [arg name]"
4820: 5d 0a 54 68 65 20 73 74 61 6e 64 61 72 64 20 52  ].The standard R
4830: 46 43 20 6e 61 6d 65 20 6f 66 20 63 69 70 68 65  FC name of ciphe
4840: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  r...[def "[var a
4850: 6c 67 6f 72 69 74 68 6d 5f 62 69 74 73 5d 20 5b  lgorithm_bits] [
4860: 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d  arg n]"].The num
4870: 62 65 72 20 6f 66 20 70 72 6f 63 65 73 73 65 64  ber of processed
4880: 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 63   bits used for c
4890: 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  ipher...[def "[v
48a0: 61 72 20 73 65 63 72 65 74 5f 62 69 74 73 5d 20  ar secret_bits] 
48b0: 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75  [arg n]"].The nu
48c0: 6d 62 65 72 20 6f 66 20 73 65 63 72 65 74 20 62  mber of secret b
48d0: 69 74 73 20 75 73 65 64 20 66 6f 72 20 63 69 70  its used for cip
48e0: 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  her...[def "[var
48f0: 20 6d 69 6e 5f 76 65 72 73 69 6f 6e 5d 20 5b 61   min_version] [a
4900: 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68  rg version]"].Th
4910: 65 20 6d 69 6e 69 6d 75 6d 20 70 72 6f 74 6f 63  e minimum protoc
4920: 6f 6c 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 63  ol version for c
4930: 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  ipher...[def "[v
4940: 61 72 20 63 69 70 68 65 72 5f 69 73 5f 61 65 61  ar cipher_is_aea
4950: 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  d] [arg boolean]
4960: 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 63  "].Whether the c
4970: 69 70 68 65 72 20 69 73 20 41 75 74 68 65 6e 74  ipher is Authent
4980: 69 63 61 74 65 64 20 45 6e 63 72 79 70 74 69 6f  icated Encryptio
4990: 6e 20 77 69 74 68 20 41 73 73 6f 63 69 61 74 65  n with Associate
49a0: 64 20 44 61 74 61 20 28 41 45 41 44 29 2e 0a 0a  d Data (AEAD)...
49b0: 5b 64 65 66 20 22 5b 76 61 72 20 63 69 70 68 65  [def "[var ciphe
49c0: 72 5f 69 64 5d 20 5b 61 72 67 20 69 64 5d 22 5d  r_id] [arg id]"]
49d0: 0a 54 68 65 20 4f 70 65 6e 53 53 4c 20 63 69 70  .The OpenSSL cip
49e0: 68 65 72 20 69 64 2e 0a 0a 5b 64 65 66 20 22 5b  her id...[def "[
49f0: 76 61 72 20 64 65 73 63 72 69 70 74 69 6f 6e 5d  var description]
4a00: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
4a10: 41 20 74 65 78 74 20 64 65 73 63 72 69 70 74 69  A text descripti
4a20: 6f 6e 20 6f 66 20 74 68 65 20 63 69 70 68 65 72  on of the cipher
4a30: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 68 61  ...[def "[var ha
4a40: 6e 64 73 68 61 6b 65 5f 64 69 67 65 73 74 5d 20  ndshake_digest] 
4a50: 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a  [arg boolean]"].
4a60: 44 69 67 65 73 74 20 75 73 65 64 20 64 75 72 69  Digest used duri
4a70: 6e 67 20 68 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b  ng handshake...[
4a80: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 53 65 73 73 69  list_end]..Sessi
4a90: 6f 6e 20 49 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62  on Info..[list_b
4aa0: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73  egin definitions
4ab0: 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c  ]..[def "[var al
4ac0: 70 6e 5d 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  pn] [arg protoco
4ad0: 6c 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f  l]"].The protoco
4ae0: 6c 20 73 65 6c 65 63 74 65 64 20 61 66 74 65 72  l selected after
4af0: 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79   Application-Lay
4b00: 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f  er Protocol Nego
4b10: 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a  tiation (ALPN)..
4b20: 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 73 75  .[def "[var resu
4b30: 6d 61 62 6c 65 5d 20 5b 61 72 67 20 62 6f 6f 6c  mable] [arg bool
4b40: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74  ean]"].Whether t
4b50: 68 65 20 73 65 73 73 69 6f 6e 20 63 61 6e 20 62  he session can b
4b60: 65 20 72 65 73 75 6d 65 64 20 6f 72 20 6e 6f 74  e resumed or not
4b70: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74  ...[def "[var st
4b80: 61 72 74 5f 74 69 6d 65 5d 20 5b 61 72 67 20 73  art_time] [arg s
4b90: 65 63 6f 6e 64 73 5d 22 5d 0a 54 69 6d 65 20 73  econds]"].Time s
4ba0: 69 6e 63 65 20 73 65 73 73 69 6f 6e 20 73 74 61  ince session sta
4bb0: 72 74 65 64 20 69 6e 20 73 65 63 6f 6e 64 73 20  rted in seconds 
4bc0: 73 69 6e 63 65 20 65 70 6f 63 68 2e 0a 0a 5b 64  since epoch...[d
4bd0: 65 66 20 22 5b 76 61 72 20 74 69 6d 65 6f 75 74  ef "[var timeout
4be0: 5d 20 5b 61 72 67 20 73 65 63 6f 6e 64 73 5d 22  ] [arg seconds]"
4bf0: 5d 0a 4d 61 78 20 64 75 72 61 74 69 6f 6e 20 6f  ].Max duration o
4c00: 66 20 73 65 73 73 69 6f 6e 20 69 6e 20 73 65 63  f session in sec
4c10: 6f 6e 64 73 20 62 65 66 6f 72 65 20 74 69 6d 65  onds before time
4c20: 2d 6f 75 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  -out...[def "[va
4c30: 72 20 6c 69 66 65 74 69 6d 65 5d 20 5b 61 72 67  r lifetime] [arg
4c40: 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 53 65 73 73   seconds]"].Sess
4c50: 69 6f 6e 20 74 69 63 6b 65 74 20 6c 69 66 65 74  ion ticket lifet
4c60: 69 6d 65 20 68 69 6e 74 20 69 6e 20 73 65 63 6f  ime hint in seco
4c70: 6e 64 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  nds...[def "[var
4c80: 20 73 65 73 73 69 6f 6e 5f 69 64 5d 20 5b 61 72   session_id] [ar
4c90: 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d  g binary_string]
4ca0: 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f  "].Unique sessio
4cb0: 6e 20 69 64 20 66 6f 72 20 75 73 65 20 69 6e 20  n id for use in 
4cc0: 72 65 73 75 6d 69 6e 67 20 74 68 65 20 73 65 73  resuming the ses
4cd0: 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  sion...[def "[va
4ce0: 72 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74  r session_ticket
4cf0: 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74  ] [arg binary_st
4d00: 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73  ring]"].Unique s
4d10: 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 66 6f  ession ticket fo
4d20: 72 20 75 73 65 20 69 6e 20 72 65 73 75 6d 69 6e  r use in resumin
4d30: 67 20 74 68 65 20 73 65 73 73 69 6f 6e 2e 0a 0a  g the session...
4d40: 5b 64 65 66 20 22 5b 76 61 72 20 74 69 63 6b 65  [def "[var ticke
4d50: 74 5f 61 70 70 5f 64 61 74 61 5d 20 5b 61 72 67  t_app_data] [arg
4d60: 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22   binary_string]"
4d70: 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e  ].Unique session
4d80: 20 74 69 63 6b 65 74 20 61 70 70 6c 69 63 61 74   ticket applicat
4d90: 69 6f 6e 20 64 61 74 61 2e 0a 0a 5b 64 65 66 20  ion data...[def 
4da0: 22 5b 76 61 72 20 6d 61 73 74 65 72 5f 6b 65 79  "[var master_key
4db0: 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74  ] [arg binary_st
4dc0: 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73  ring]"].Unique s
4dd0: 65 73 73 69 6f 6e 20 6d 61 73 74 65 72 20 6b 65  ession master ke
4de0: 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  y...[def "[var s
4df0: 65 73 73 69 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64  ession_cache_mod
4e00: 65 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a  e] [arg mode]"].
4e10: 53 65 72 76 65 72 20 63 61 63 68 65 20 6d 6f 64  Server cache mod
4e20: 65 20 28 63 6c 69 65 6e 74 2c 20 73 65 72 76 65  e (client, serve
4e30: 72 2c 20 6f 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c  r, or both)...[l
4e40: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20  ist_end]..[call 
4e50: 5b 63 6d 64 20 74 6c 73 3a 3a 63 69 70 68 65 72  [cmd tls::cipher
4e60: 73 5d 20 5b 6f 70 74 20 5b 61 72 67 20 70 72 6f  s] [opt [arg pro
4e70: 74 6f 63 6f 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72  tocol]] [opt [ar
4e80: 67 20 76 65 72 62 6f 73 65 5d 5d 20 5b 6f 70 74  g verbose]] [opt
4e90: 20 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 5d   [arg supported]
4ea0: 5d 5d 0a 0a 57 69 74 68 6f 75 74 20 61 6e 79 20  ]]..Without any 
4eb0: 6f 70 74 69 6f 6e 73 2c 20 69 74 20 72 65 74 75  options, it retu
4ec0: 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 61 6c  rns a list of al
4ed0: 6c 20 73 79 6d 6d 65 74 72 69 63 20 63 69 70 68  l symmetric ciph
4ee0: 65 72 73 20 66 6f 72 20 75 73 65 20 77 69 74 68  ers for use with
4ef0: 20 74 68 65 0a 5b 61 72 67 20 2d 63 69 70 68 65   the.[arg -ciphe
4f00: 72 5d 20 6f 70 74 69 6f 6e 2e 20 57 69 74 68 20  r] option. With 
4f10: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 2c 20  [arg protocol], 
4f20: 6f 6e 6c 79 20 74 68 65 20 63 69 70 68 65 72 73  only the ciphers
4f30: 20 73 75 70 70 6f 72 74 65 64 20 66 6f 72 20 74   supported for t
4f40: 68 61 74 0a 70 72 6f 74 6f 63 6f 6c 20 61 72 65  hat.protocol are
4f50: 20 72 65 74 75 72 6e 65 64 2e 20 53 65 65 20 74   returned. See t
4f60: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f  he [cmd tls::pro
4f70: 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20  tocols] command 
4f80: 66 6f 72 20 74 68 65 20 73 75 70 70 6f 72 74 65  for the supporte
4f90: 64 0a 70 72 6f 74 6f 63 6f 6c 73 2e 20 49 66 20  d.protocols. If 
4fa0: 5b 61 72 67 20 76 65 72 62 6f 73 65 5d 20 69 73  [arg verbose] is
4fb0: 20 73 70 65 63 69 66 69 65 64 20 61 73 20 74 72   specified as tr
4fc0: 75 65 20 74 68 65 6e 20 61 20 76 65 72 62 6f 73  ue then a verbos
4fd0: 65 2c 20 68 75 6d 61 6e 20 72 65 61 64 61 62 6c  e, human readabl
4fe0: 65 0a 6c 69 73 74 20 69 73 20 72 65 74 75 72 6e  e.list is return
4ff0: 65 64 20 77 69 74 68 20 61 64 64 69 74 69 6f 6e  ed with addition
5000: 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f  al information o
5010: 6e 20 74 68 65 20 63 69 70 68 65 72 2e 20 49 66  n the cipher. If
5020: 20 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 5d   [arg supported]
5030: 0a 69 73 20 73 70 65 63 69 66 69 65 64 20 61 73  .is specified as
5040: 20 74 72 75 65 2c 20 74 68 65 6e 20 6f 6e 6c 79   true, then only
5050: 20 74 68 65 20 63 69 70 68 65 72 73 20 73 75 70   the ciphers sup
5060: 70 6f 72 74 65 64 20 66 6f 72 20 70 72 6f 74 6f  ported for proto
5070: 63 6f 6c 20 77 69 6c 6c 20 62 65 20 6c 69 73 74  col will be list
5080: 65 64 2e 0a 54 68 65 20 5b 61 72 67 20 73 75 70  ed..The [arg sup
5090: 70 6f 72 74 65 64 5d 20 61 72 67 20 69 73 20 6e  ported] arg is n
50a0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
50b0: 38 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  8...[call [cmd t
50c0: 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 5d 0a  ls::protocols]].
50d0: 0a 52 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20  .Returns a list 
50e0: 6f 66 20 74 68 65 20 73 75 70 70 6f 72 74 65 64  of the supported
50f0: 20 53 53 4c 2f 54 4c 53 20 70 72 6f 74 6f 63 6f   SSL/TLS protoco
5100: 6c 73 2e 20 56 61 6c 69 64 20 76 61 6c 75 65 73  ls. Valid values
5110: 20 61 72 65 3a 0a 5b 63 6f 6e 73 74 20 73 73 6c   are:.[const ssl
5120: 32 5d 2c 20 5b 63 6f 6e 73 74 20 73 73 6c 33 5d  2], [const ssl3]
5130: 2c 20 5b 63 6f 6e 73 74 20 74 6c 73 31 5d 2c 20  , [const tls1], 
5140: 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 31 5d 2c 20  [const tls1.1], 
5150: 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 32 5d 2c 20  [const tls1.2], 
5160: 61 6e 64 0a 5b 63 6f 6e 73 74 20 74 6c 73 31 2e  and.[const tls1.
5170: 33 5d 2e 20 45 78 61 63 74 20 6c 69 73 74 20 64  3]. Exact list d
5180: 65 70 65 6e 64 73 20 6f 6e 20 4f 70 65 6e 53 53  epends on OpenSS
5190: 4c 20 76 65 72 73 69 6f 6e 20 61 6e 64 20 63 6f  L version and co
51a0: 6d 70 69 6c 65 20 74 69 6d 65 20 66 6c 61 67 73  mpile time flags
51b0: 2e 0a 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 69  ..This command i
51c0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
51d0: 20 31 2e 38 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d   1.8...[call [cm
51e0: 64 20 74 6c 73 3a 3a 76 65 72 73 69 6f 6e 5d 5d  d tls::version]]
51f0: 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 20 4f 70  ..Returns the Op
5200: 65 6e 53 53 4c 20 76 65 72 73 69 6f 6e 20 73 74  enSSL version st
5210: 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  ring...[list_end
5220: 5d 0a 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43 65  ]...[section "Ce
5230: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
5240: 74 69 6f 6e 22 5d 0a 0a 5b 73 75 62 73 65 63 74  tion"]..[subsect
5250: 69 6f 6e 20 22 50 4b 49 20 61 6e 64 20 43 65 72  ion "PKI and Cer
5260: 74 69 66 69 63 61 74 65 73 22 5d 0a 0a 55 73 69  tificates"]..Usi
5270: 6e 67 20 74 68 65 20 50 75 62 6c 69 63 20 4b 65  ng the Public Ke
5280: 79 20 49 6e 66 72 61 73 74 72 75 63 74 75 72 65  y Infrastructure
5290: 20 28 50 4b 49 29 2c 20 65 61 63 68 20 75 73 65   (PKI), each use
52a0: 72 20 63 72 65 61 74 65 73 20 61 20 70 72 69 76  r creates a priv
52b0: 61 74 65 20 6b 65 79 20 74 68 61 74 0a 6f 6e 6c  ate key that.onl
52c0: 79 20 74 68 65 79 20 6b 6e 6f 77 20 61 62 6f 75  y they know abou
52d0: 74 20 61 6e 64 20 61 20 70 75 62 6c 69 63 20 6b  t and a public k
52e0: 65 79 20 74 68 65 79 20 63 61 6e 20 65 78 63 68  ey they can exch
52f0: 61 6e 67 65 20 77 69 74 68 20 6f 74 68 65 72 73  ange with others
5300: 20 66 6f 72 20 75 73 65 20 69 6e 0a 65 6e 63 72   for use in.encr
5310: 79 70 74 69 6e 67 20 61 6e 64 20 64 65 63 72 79  ypting and decry
5320: 70 74 69 6e 67 20 64 61 74 61 2e 20 54 68 65 20  pting data. The 
5330: 70 72 6f 63 65 73 73 20 69 73 20 74 68 65 20 73  process is the s
5340: 65 6e 64 65 72 20 65 6e 63 72 79 70 74 73 20 74  ender encrypts t
5350: 68 65 69 72 20 64 61 74 61 0a 75 73 69 6e 67 20  heir data.using 
5360: 74 68 65 69 72 20 70 72 69 76 61 74 65 20 6b 65  their private ke
5370: 79 20 61 6e 64 20 74 68 65 20 72 65 63 65 69 76  y and the receiv
5380: 65 72 27 73 20 70 75 62 6c 69 63 20 6b 65 79 2e  er's public key.
5390: 20 54 68 65 20 64 61 74 61 20 69 73 20 74 68 65   The data is the
53a0: 6e 20 73 65 6e 74 0a 74 6f 20 74 68 65 20 72 65  n sent.to the re
53b0: 63 65 69 76 65 72 2e 20 49 6e 20 61 20 73 69 6d  ceiver. In a sim
53c0: 69 6c 61 72 20 6d 61 6e 6e 65 72 2c 20 74 68 65  ilar manner, the
53d0: 20 72 65 63 65 69 76 65 72 20 75 73 65 73 20 74   receiver uses t
53e0: 68 65 69 72 20 70 72 69 76 61 74 65 20 6b 65 79  heir private key
53f0: 20 61 6e 64 0a 74 68 65 20 73 65 6e 64 65 72 27   and.the sender'
5400: 73 20 70 75 62 6c 69 63 20 6b 65 79 20 74 6f 20  s public key to 
5410: 64 65 63 72 79 70 74 20 74 68 65 20 64 61 74 61  decrypt the data
5420: 2e 20 54 68 69 73 20 70 72 6f 76 69 64 65 73 20  . This provides 
5430: 64 61 74 61 20 69 6e 74 65 67 72 69 74 79 2c 20  data integrity, 
5440: 74 6f 0a 65 6e 73 75 72 65 20 74 68 65 20 64 61  to.ensure the da
5450: 74 61 20 63 61 6e 27 74 20 62 65 20 76 69 65 77  ta can't be view
5460: 65 64 20 6f 72 20 61 6c 74 65 72 65 64 20 64 75  ed or altered du
5470: 72 69 6e 67 20 74 72 61 6e 73 70 6f 72 74 2e 20  ring transport. 
5480: 53 65 65 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20  See the.[option 
5490: 2d 6b 65 79 5d 20 61 6e 64 20 5b 6f 70 74 69 6f  -key] and [optio
54a0: 6e 20 2d 6b 65 79 66 69 6c 65 5d 20 6f 70 74 69  n -keyfile] opti
54b0: 6f 6e 73 20 66 6f 72 20 68 6f 77 20 74 6f 20 73  ons for how to s
54c0: 70 65 63 69 66 79 20 74 68 65 20 70 72 69 76 61  pecify the priva
54d0: 74 65 20 6b 65 79 2e 0a 41 6c 73 6f 20 73 65 65  te key..Also see
54e0: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 61   the [option -pa
54f0: 73 73 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 20 66  ssword] option f
5500: 6f 72 20 68 6f 77 20 74 6f 20 70 72 6f 76 69 64  or how to provid
5510: 65 20 74 68 65 20 70 61 73 73 77 6f 72 64 2e 0a  e the password..
5520: 5b 70 61 72 61 5d 0a 49 6e 20 6f 72 64 65 72 20  [para].In order 
5530: 74 6f 20 70 72 6f 76 69 64 65 20 61 75 74 68 65  to provide authe
5540: 6e 74 69 63 61 74 69 6f 6e 2c 20 69 2e 65 2e 20  ntication, i.e. 
5550: 65 6e 73 75 72 69 6e 67 20 73 6f 6d 65 6f 6e 65  ensuring someone
5560: 20 69 73 20 77 68 6f 20 74 68 65 79 20 73 61 79   is who they say
5570: 20 74 68 65 79 0a 61 72 65 2c 20 74 68 65 20 70   they.are, the p
5580: 75 62 6c 69 63 20 6b 65 79 20 61 6e 64 20 75 73  ublic key and us
5590: 65 72 20 69 64 65 6e 74 69 66 69 63 61 74 69 6f  er identificatio
55a0: 6e 20 69 6e 66 6f 20 69 73 20 73 74 6f 72 65 64  n info is stored
55b0: 20 69 6e 20 61 20 58 2e 35 30 39 0a 63 65 72 74   in a X.509.cert
55c0: 69 66 69 63 61 74 65 20 61 6e 64 20 74 68 61 74  ificate and that
55d0: 20 63 65 72 74 69 66 69 63 61 74 65 20 69 73 20   certificate is 
55e0: 61 75 74 68 65 6e 74 69 63 61 74 65 64 20 28 69  authenticated (i
55f0: 2e 65 2e 20 73 69 67 6e 65 64 29 20 62 79 20 61  .e. signed) by a
5600: 20 43 65 72 74 69 66 69 63 61 74 65 0a 41 75 74   Certificate.Aut
5610: 68 6f 72 69 74 79 20 28 43 41 29 2e 20 55 73 65  hority (CA). Use
5620: 72 73 20 63 61 6e 20 74 68 65 6e 20 65 78 63 68  rs can then exch
5630: 61 6e 67 65 20 74 68 65 73 65 20 63 65 72 74 69  ange these certi
5640: 66 69 63 61 74 65 73 20 64 75 72 69 6e 67 20 74  ficates during t
5650: 68 65 20 54 4c 53 0a 69 6e 69 74 69 61 6c 69 7a  he TLS.initializ
5660: 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 61 6e  ation process an
5670: 64 20 63 68 65 63 6b 20 74 68 65 6d 20 61 67 61  d check them aga
5680: 69 6e 73 74 20 74 68 65 20 72 6f 6f 74 20 43 41  inst the root CA
5690: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f   certificates to
56a0: 20 65 6e 73 75 72 65 0a 74 68 65 79 20 61 72 65   ensure.they are
56b0: 20 76 61 6c 69 64 2e 20 54 68 69 73 20 69 73 20   valid. This is 
56c0: 68 61 6e 64 6c 65 64 20 62 79 20 4f 70 65 6e 53  handled by OpenS
56d0: 53 4c 20 76 69 61 20 74 68 65 20 5b 6f 70 74 69  SL via the [opti
56e0: 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 61 6e 64  on -request] and
56f0: 0a 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 72  .[option -requir
5700: 65 5d 20 6f 70 74 69 6f 6e 73 2e 20 53 65 65 20  e] options. See 
5710: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  the [option -cad
5720: 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  ir], [option -ca
5730: 64 69 72 5d 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f  dir], and.[optio
5740: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69  n -castore] opti
5750: 6f 6e 73 20 66 6f 72 20 68 6f 77 20 74 6f 20 73  ons for how to s
5760: 70 65 63 69 66 79 20 77 68 65 72 65 20 74 6f 20  pecify where to 
5770: 66 69 6e 64 20 74 68 65 20 43 41 20 63 65 72 74  find the CA cert
5780: 69 66 69 63 61 74 65 73 2e 0a 4f 70 74 69 6f 6e  ificates..Option
5790: 61 6c 6c 79 2c 20 69 6e 20 61 20 66 75 74 75 72  ally, in a futur
57a0: 65 20 72 65 6c 65 61 73 65 2c 20 74 68 65 79 20  e release, they 
57b0: 63 61 6e 20 61 6c 73 6f 20 62 65 20 63 68 65 63  can also be chec
57c0: 6b 65 64 20 61 67 61 69 6e 73 74 20 74 68 65 20  ked against the 
57d0: 43 65 72 74 69 66 69 63 61 74 65 0a 52 65 76 6f  Certificate.Revo
57e0: 63 61 74 69 6f 6e 20 4c 69 73 74 20 28 43 52 4c  cation List (CRL
57f0: 29 20 6f 66 20 72 65 76 6f 6b 65 64 20 63 65 72  ) of revoked cer
5800: 74 69 66 69 63 61 74 65 73 2e 20 43 65 72 74 69  tificates. Certi
5810: 66 69 63 61 74 65 73 20 63 61 6e 20 61 6c 73 6f  ficates can also
5820: 20 62 65 0a 73 65 6c 66 2d 73 69 67 6e 65 64 2c   be.self-signed,
5830: 20 62 75 74 20 74 68 65 79 20 61 72 65 20 62 79   but they are by
5840: 20 64 65 66 61 75 6c 74 20 6e 6f 74 20 74 72 75   default not tru
5850: 73 74 65 64 20 75 6e 6c 65 73 73 20 79 6f 75 20  sted unless you 
5860: 61 64 64 20 74 68 65 6d 20 74 6f 20 79 6f 75 72  add them to your
5870: 0a 63 65 72 74 69 66 69 63 61 74 65 20 73 74 6f  .certificate sto
5880: 72 65 2e 0a 5b 70 61 72 61 5d 0a 54 79 70 69 63  re..[para].Typic
5890: 61 6c 6c 79 20 77 68 65 6e 20 76 69 73 69 74 69  ally when visiti
58a0: 6e 67 20 77 65 62 20 73 69 74 65 73 2c 20 6f 6e  ng web sites, on
58b0: 6c 79 20 74 68 65 20 63 6c 69 65 6e 74 20 6e 65  ly the client ne
58c0: 65 64 73 20 74 6f 20 63 68 65 63 6b 20 74 68 65  eds to check the
58d0: 20 73 65 72 76 65 72 27 73 0a 63 65 72 74 69 66   server's.certif
58e0: 69 63 61 74 65 20 74 6f 20 65 6e 73 75 72 65 20  icate to ensure 
58f0: 69 74 20 69 73 20 76 61 6c 69 64 2e 20 54 68 65  it is valid. The
5900: 20 73 65 72 76 65 72 20 64 6f 65 73 6e 27 74 20   server doesn't 
5910: 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68  need to check th
5920: 65 20 63 6c 69 65 6e 74 0a 63 65 72 74 69 66 69  e client.certifi
5930: 63 61 74 65 20 75 6e 6c 65 73 73 20 79 6f 75 20  cate unless you 
5940: 6e 65 65 64 20 74 6f 20 61 75 74 68 65 6e 74 69  need to authenti
5950: 63 61 74 65 20 77 69 74 68 20 74 68 65 6d 20 74  cate with them t
5960: 6f 20 6c 6f 67 69 6e 2c 20 65 74 63 2e 20 53 65  o login, etc. Se
5970: 65 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63  e the.[option -c
5980: 65 72 74 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e  ert] and [option
5990: 20 2d 63 65 72 74 66 69 6c 65 5d 20 6f 70 74 69   -certfile] opti
59a0: 6f 6e 73 20 69 66 20 79 6f 75 20 6e 65 65 64 20  ons if you need 
59b0: 74 6f 20 70 72 6f 76 69 64 65 20 61 20 63 65 72  to provide a cer
59c0: 74 69 66 69 63 61 74 65 2e 0a 0a 0a 5b 73 75 62  tificate....[sub
59d0: 73 65 63 74 69 6f 6e 20 22 53 75 6d 6d 61 72 79  section "Summary
59e0: 20 6f 66 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65   of command line
59f0: 20 6f 70 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 20   options"]..The 
5a00: 66 6f 6c 6c 6f 77 69 6e 67 20 6f 70 74 69 6f 6e  following option
5a10: 73 20 61 72 65 20 75 73 65 64 20 66 6f 72 20 70  s are used for p
5a20: 65 65 72 20 63 65 72 74 69 66 69 63 61 74 65 20  eer certificate 
5a30: 76 61 6c 69 64 61 74 69 6f 6e 3a 0a 0a 5b 6c 69  validation:..[li
5a40: 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73  st_begin options
5a50: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64  ]..[opt_def -cad
5a60: 69 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72  ir [arg director
5a70: 79 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  y]].Specifies th
5a80: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72  e directory wher
5a90: 65 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  e the Certificat
5aa0: 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e Authority (CA)
5ab0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72   certificates ar
5ac0: 65 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65  e.stored. The de
5ad0: 66 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72  fault is platfor
5ae0: 6d 20 73 70 65 63 69 66 69 63 2c 20 62 75 74 20  m specific, but 
5af0: 69 73 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65  is usually [file
5b00: 20 2f 65 74 63 2f 73 73 6c 2f 63 65 72 74 73 5d   /etc/ssl/certs]
5b10: 20 6f 6e 0a 4c 69 6e 75 78 2f 55 6e 69 78 20 73   on.Linux/Unix s
5b20: 79 73 74 65 6d 73 2e 20 54 68 65 20 64 65 66 61  ystems. The defa
5b30: 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63 61 6e  ult location can
5b40: 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62   be overridden b
5b50: 79 20 74 68 65 0a 5b 76 61 72 20 53 53 4c 5f 43  y the.[var SSL_C
5b60: 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72 6f 6e  ERT_DIR] environ
5b70: 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 2e 0a 0a  ment variable...
5b80: 5b 6f 70 74 5f 64 65 66 20 2d 63 61 66 69 6c 65  [opt_def -cafile
5b90: 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d   [arg filename]]
5ba0: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 66  .Specifies the f
5bb0: 69 6c 65 20 77 69 74 68 20 74 68 65 20 43 65 72  ile with the Cer
5bc0: 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69  tificate Authori
5bd0: 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69 63  ty (CA) certific
5be0: 61 74 65 73 20 74 6f 20 75 73 65 20 69 6e 0a 5b  ates to use in.[
5bf0: 63 6f 6e 73 74 20 50 45 4d 5d 20 66 69 6c 65 20  const PEM] file 
5c00: 66 6f 72 6d 61 74 2e 20 54 68 65 20 64 65 66 61  format. The defa
5c10: 75 6c 74 20 69 73 20 5b 66 69 6c 65 20 63 65 72  ult is [file cer
5c20: 74 2e 70 65 6d 5d 2c 20 69 6e 20 74 68 65 20 4f  t.pem], in the O
5c30: 70 65 6e 53 53 4c 0a 64 69 72 65 63 74 6f 72 79  penSSL.directory
5c40: 2e 20 4f 6e 20 4c 69 6e 75 78 2f 55 6e 69 78 20  . On Linux/Unix 
5c50: 73 79 73 74 65 6d 73 2c 20 74 68 69 73 20 69 73  systems, this is
5c60: 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20 2f   usually [file /
5c70: 65 74 63 2f 73 73 6c 2f 63 61 2d 62 75 6e 64 6c  etc/ssl/ca-bundl
5c80: 65 2e 70 65 6d 5d 2e 0a 54 68 65 20 64 65 66 61  e.pem]..The defa
5c90: 75 6c 74 20 66 69 6c 65 20 63 61 6e 20 62 65 20  ult file can be 
5ca0: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68  overridden by th
5cb0: 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  e [var SSL_CERT_
5cc0: 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e  FILE] environmen
5cd0: 74 0a 76 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70  t.variable...[op
5ce0: 74 5f 64 65 66 20 2d 63 61 73 74 6f 72 65 20 5b  t_def -castore [
5cf0: 61 72 67 20 55 52 49 5d 5d 0a 53 70 65 63 69 66  arg URI]].Specif
5d00: 69 65 73 20 74 68 65 20 55 6e 69 66 6f 72 6d 20  ies the Uniform 
5d10: 52 65 73 6f 75 72 63 65 20 49 64 65 6e 74 69 66  Resource Identif
5d20: 69 65 72 20 28 55 52 49 29 20 66 6f 72 20 74 68  ier (URI) for th
5d30: 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  e Certificate Au
5d40: 74 68 6f 72 69 74 79 0a 28 43 41 29 20 73 74 6f  thority.(CA) sto
5d50: 72 65 2c 20 77 68 69 63 68 20 6d 61 79 20 62 65  re, which may be
5d60: 20 61 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61 69   a single contai
5d70: 6e 65 72 20 6f 72 20 61 20 63 61 74 61 6c 6f 67  ner or a catalog
5d80: 20 6f 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e 0a   of containers..
5d90: 53 74 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70  Starting with Op
5da0: 65 6e 53 53 4c 20 33 2e 32 20 6f 6e 20 4d 53 20  enSSL 3.2 on MS 
5db0: 57 69 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20  Windows, set to 
5dc0: 22 5b 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65  "[const "org.ope
5dd0: 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f  nssl.winstore://
5de0: 22 5d 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62  "]".to use the b
5df0: 75 69 6c 74 2d 69 6e 20 4d 53 20 57 69 6e 64 6f  uilt-in MS Windo
5e00: 77 73 20 43 65 72 74 69 66 69 63 61 74 65 20 53  ws Certificate S
5e10: 74 6f 72 65 2e 20 53 74 61 72 74 69 6e 67 20 69  tore. Starting i
5e20: 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68  n TclTLS 2.0, th
5e30: 69 73 0a 69 73 20 74 68 65 20 64 65 66 61 75 6c  is.is the defaul
5e40: 74 20 69 66 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  t if [option -ca
5e50: 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63  dir], [option -c
5e60: 61 64 69 72 5d 2c 20 61 6e 64 20 5b 6f 70 74 69  adir], and [opti
5e70: 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 61 72 65  on -castore] are
5e80: 0a 6e 6f 74 20 73 70 65 63 69 66 69 65 64 2e 20  .not specified. 
5e90: 54 68 69 73 20 73 74 6f 72 65 20 6f 6e 6c 79 20  This store only 
5ea0: 73 75 70 70 6f 72 74 73 20 72 6f 6f 74 20 63 65  supports root ce
5eb0: 72 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 73  rtificate stores
5ec0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71  ...[opt_def -req
5ed0: 75 65 73 74 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d  uest [arg bool]]
5ee0: 0a 52 65 71 75 65 73 74 20 61 20 63 65 72 74 69  .Request a certi
5ef0: 66 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20  ficate from the 
5f00: 70 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 20  peer during the 
5f10: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 54  SSL handshake. T
5f20: 68 69 73 20 69 73 20 6e 65 65 64 65 64 0a 74 6f  his is needed.to
5f30: 20 64 6f 20 43 65 72 74 69 66 69 63 61 74 65 20   do Certificate 
5f40: 56 61 6c 69 64 61 74 69 6f 6e 2e 20 53 74 61 72  Validation. Star
5f50: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 31  ting in TclTLS 1
5f60: 2e 38 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20  .8, the default 
5f70: 69 73 0a 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20  is.[const true] 
5f80: 66 6f 72 20 63 6c 69 65 6e 74 20 63 6f 6e 6e 65  for client conne
5f90: 63 74 69 6f 6e 73 2e 20 53 74 61 72 74 69 6e 67  ctions. Starting
5fa0: 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20   in TclTLS 2.0, 
5fb0: 69 66 20 73 65 74 20 74 6f 0a 5b 63 6f 6e 73 74  if set to.[const
5fc0: 20 66 61 6c 73 65 5d 20 61 6e 64 20 5b 6f 70 74   false] and [opt
5fd0: 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 69 73  ion -require] is
5fe0: 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2c 20 74   [const true], t
5ff0: 68 65 6e 20 74 68 69 73 20 77 69 6c 6c 20 62 65  hen this will be
6000: 0a 6f 76 65 72 72 69 64 64 65 6e 20 74 6f 20 5b  .overridden to [
6010: 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 49 6e 20  const true]. In 
6020: 61 64 64 69 74 69 6f 6e 2c 20 74 68 65 20 63 6c  addition, the cl
6030: 69 65 6e 74 20 63 61 6e 20 6d 61 6e 75 61 6c 6c  ient can manuall
6040: 79 20 69 6e 73 70 65 63 74 20 61 6e 64 0a 61 63  y inspect and.ac
6050: 63 65 70 74 20 6f 72 20 72 65 6a 65 63 74 20 65  cept or reject e
6060: 61 63 68 20 63 65 72 74 69 66 69 63 61 74 65 20  ach certificate 
6070: 75 73 69 6e 67 20 74 68 65 20 5b 6f 70 74 69 6f  using the [optio
6080: 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61  n -validatecomma
6090: 6e 64 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70  nd] option...[op
60a0: 74 5f 64 65 66 20 2d 72 65 71 75 69 72 65 20 5b  t_def -require [
60b0: 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 69  arg bool]].Requi
60c0: 72 65 20 61 20 76 61 6c 69 64 20 63 65 72 74 69  re a valid certi
60d0: 66 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20  ficate from the 
60e0: 70 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 20  peer during the 
60f0: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 49  SSL handshake. I
6100: 66 20 74 68 69 73 20 69 73 0a 73 65 74 20 74 6f  f this is.set to
6110: 20 74 72 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74   true, then [opt
6120: 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 6d 75  ion -request] mu
6130: 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74 20 74  st also be set t
6140: 6f 20 74 72 75 65 20 61 6e 64 20 61 20 65 69 74  o true and a eit
6150: 68 65 72 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  her.[option -cad
6160: 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  ir], [option -ca
6170: 66 69 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d  file], [option -
6180: 63 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70  castore], or a p
6190: 6c 61 74 66 6f 72 6d 20 64 65 66 61 75 6c 74 0a  latform default.
61a0: 6d 75 73 74 20 62 65 20 70 72 6f 76 69 64 65 64  must be provided
61b0: 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 76 61 6c   in order to val
61c0: 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20 54  idate against. T
61d0: 68 65 20 64 65 66 61 75 6c 74 20 69 6e 20 54 63  he default in Tc
61e0: 6c 54 4c 53 20 31 2e 38 20 61 6e 64 0a 65 61 72  lTLS 1.8 and.ear
61f0: 6c 69 65 72 20 76 65 72 73 69 6f 6e 73 20 69 73  lier versions is
6200: 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73   [const false] s
6210: 69 6e 63 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61  ince not all pla
6220: 74 66 6f 72 6d 73 20 68 61 76 65 20 63 65 72 74  tforms have cert
6230: 69 66 69 63 61 74 65 73 20 74 6f 0a 76 61 6c 69  ificates to.vali
6240: 64 61 74 65 20 61 67 61 69 6e 73 74 20 69 6e 20  date against in 
6250: 61 20 66 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c  a form compatibl
6260: 65 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 2e 20  e with OpenSSL. 
6270: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54  Starting in TclT
6280: 4c 53 20 32 2e 30 2c 0a 74 68 65 20 64 65 66 61  LS 2.0,.the defa
6290: 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72  ult is [const tr
62a0: 75 65 5d 20 66 6f 72 20 63 6c 69 65 6e 74 20 63  ue] for client c
62b0: 6f 6e 6e 65 63 74 69 6f 6e 73 2e 0a 0a 5b 6c 69  onnections...[li
62c0: 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63  st_end]..[subsec
62d0: 74 69 6f 6e 20 22 57 68 65 6e 20 61 72 65 20 63  tion "When are c
62e0: 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 6f 70 74 69  ommand line opti
62f0: 6f 6e 73 20 6e 65 65 64 65 64 3f 22 5d 0a 0a 49  ons needed?"]..I
6300: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61 6e 64  n TclTLS 1.8 and
6310: 20 65 61 72 6c 69 65 72 20 76 65 72 73 69 6f 6e   earlier version
6320: 73 2c 20 63 65 72 74 69 66 69 63 61 74 65 20 76  s, certificate v
6330: 61 6c 69 64 61 74 69 6f 6e 20 69 73 0a 5b 65 6d  alidation is.[em
6340: 70 68 20 4e 4f 54 5d 20 65 6e 61 62 6c 65 64 20  ph NOT] enabled 
6350: 62 79 20 64 65 66 61 75 6c 74 2e 20 54 68 69 73  by default. This
6360: 20 6c 69 6d 69 74 61 74 69 6f 6e 20 69 73 20 64   limitation is d
6370: 75 65 20 74 6f 20 74 68 65 20 6c 61 63 6b 20 6f  ue to the lack o
6380: 66 20 61 20 63 6f 6d 6d 6f 6e 0a 63 72 6f 73 73  f a common.cross
6390: 20 70 6c 61 74 66 6f 72 6d 20 64 61 74 61 62 61   platform databa
63a0: 73 65 20 6f 66 20 43 65 72 74 69 66 69 63 61 74  se of Certificat
63b0: 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e Authority (CA)
63c0: 20 70 72 6f 76 69 64 65 64 20 63 65 72 74 69 66   provided certif
63d0: 69 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 61  icates to.valida
63e0: 74 65 20 61 67 61 69 6e 73 74 2e 20 4d 61 6e 79  te against. Many
63f0: 20 4c 69 6e 75 78 20 73 79 73 74 65 6d 73 20 6e   Linux systems n
6400: 61 74 69 76 65 6c 79 20 73 75 70 70 6f 72 74 20  atively support 
6410: 4f 70 65 6e 53 53 4c 20 61 6e 64 20 74 68 75 73  OpenSSL and thus
6420: 20 68 61 76 65 0a 74 68 65 73 65 20 63 65 72 74   have.these cert
6430: 69 66 69 63 61 74 65 73 20 69 6e 73 74 61 6c 6c  ificates install
6440: 65 64 20 61 73 20 70 61 72 74 20 6f 66 20 74 68  ed as part of th
6450: 65 20 4f 53 2c 20 62 75 74 20 4d 61 63 4f 53 20  e OS, but MacOS 
6460: 61 6e 64 20 4d 53 20 57 69 6e 64 6f 77 73 20 64  and MS Windows d
6470: 6f 20 6e 6f 74 2e 0a 53 74 61 72 69 6e 67 20 69  o not..Staring i
6480: 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68  n TclTLS 2.0, th
6490: 65 20 64 65 66 61 75 6c 74 20 66 6f 72 20 63 6c  e default for cl
64a0: 69 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 73  ient connections
64b0: 20 68 61 73 20 62 65 65 6e 20 63 68 61 6e 67 65   has been change
64c0: 64 20 74 6f 0a 72 65 71 75 69 72 65 20 63 65 72  d to.require cer
64d0: 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 61 74  tificate validat
64e0: 69 6f 6e 20 62 79 20 64 65 66 61 75 6c 74 2e 20  ion by default. 
64f0: 49 6e 20 6f 72 64 65 72 20 74 6f 20 75 73 65 20  In order to use 
6500: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71  the [option -req
6510: 75 69 72 65 5d 0a 6f 70 74 69 6f 6e 2c 20 6f 6e  uire].option, on
6520: 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69  e of the followi
6530: 6e 67 20 6d 75 73 74 20 62 65 20 74 72 75 65 3a  ng must be true:
6540: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 69 74  ..[list_begin it
6550: 65 6d 69 7a 65 64 5d 0a 0a 5b 69 74 65 6d 5d 0a  emized]..[item].
6560: 4f 6e 20 4c 69 6e 75 78 20 61 6e 64 20 55 6e 69  On Linux and Uni
6570: 78 20 73 79 73 74 65 6d 73 20 77 69 74 68 20 4f  x systems with O
6580: 70 65 6e 53 53 4c 20 61 6c 72 65 61 64 79 20 69  penSSL already i
6590: 6e 73 74 61 6c 6c 65 64 20 6f 72 20 69 66 20 74  nstalled or if t
65a0: 68 65 20 43 41 0a 63 65 72 74 69 66 69 63 61 74  he CA.certificat
65b0: 65 73 20 61 72 65 20 61 76 61 69 6c 61 62 6c 65  es are available
65c0: 20 69 6e 20 50 45 4d 20 66 6f 72 6d 61 74 2c 20   in PEM format, 
65d0: 61 6e 64 20 69 66 20 74 68 65 79 20 61 72 65 20  and if they are 
65e0: 73 74 6f 72 65 64 20 69 6e 20 74 68 65 0a 73 74  stored in the.st
65f0: 61 6e 64 61 72 64 20 6c 6f 63 61 74 69 6f 6e 73  andard locations
6600: 2c 20 6f 72 20 69 66 20 74 68 65 20 5b 76 61 72  , or if the [var
6610: 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20 6f   SSL_CERT_DIR] o
6620: 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  r [var SSL_CERT_
6630: 46 49 4c 45 5d 0a 65 6e 76 69 72 6f 6e 6d 65 6e  FILE].environmen
6640: 74 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20  t variables are 
6650: 73 65 74 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f  set, then [optio
6660: 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69  n -cadir], [opti
6670: 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 61 6e 64 20  on -cadir],.and 
6680: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65  [option -castore
6690: 5d 20 61 72 65 6e 27 74 20 6e 65 65 64 65 64 2e  ] aren't needed.
66a0: 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65 6e  ..[item].If Open
66b0: 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74 61  SSL is not insta
66c0: 6c 6c 65 64 20 69 6e 20 74 68 65 20 64 65 66 61  lled in the defa
66d0: 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 2c 20 6f 72  ult location, or
66e0: 20 77 68 65 6e 20 75 73 69 6e 67 20 4d 61 63 20   when using Mac 
66f0: 4f 53 0a 6f 72 20 4d 53 20 57 69 6e 64 6f 77 73  OS.or MS Windows
6700: 20 61 6e 64 20 4f 70 65 6e 53 53 4c 20 69 73 20   and OpenSSL is 
6710: 69 6e 73 74 61 6c 6c 65 64 2c 20 74 68 65 20 5b  installed, the [
6720: 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52  var SSL_CERT_DIR
6730: 5d 20 61 6e 64 2f 6f 72 0a 5b 76 61 72 20 53 53  ] and/or.[var SS
6740: 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76  L_CERT_FILE] env
6750: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c  ironment variabl
6760: 65 73 20 6f 72 20 74 68 65 20 6f 6e 65 20 6f 66  es or the one of
6770: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61   the [option -ca
6780: 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d 63  dir],.[option -c
6790: 61 64 69 72 5d 2c 20 6f 72 20 5b 6f 70 74 69 6f  adir], or [optio
67a0: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69  n -castore] opti
67b0: 6f 6e 73 20 6d 75 73 74 20 62 65 20 64 65 66 69  ons must be defi
67c0: 6e 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20  ned...[item].On 
67d0: 4d 53 20 57 69 6e 64 6f 77 73 2c 20 73 74 61 72  MS Windows, star
67e0: 74 69 6e 67 20 69 6e 20 4f 70 65 6e 53 53 4c 20  ting in OpenSSL 
67f0: 33 2e 32 2c 20 69 74 20 69 73 20 6e 6f 77 20 70  3.2, it is now p
6800: 6f 73 73 69 62 6c 65 20 74 6f 20 61 63 63 65 73  ossible to acces
6810: 73 20 74 68 65 0a 62 75 69 6c 74 2d 69 6e 20 57  s the.built-in W
6820: 69 6e 64 6f 77 73 20 43 65 72 74 69 66 69 63 61  indows Certifica
6830: 74 65 20 53 74 6f 72 65 20 66 72 6f 6d 20 4f 70  te Store from Op
6840: 65 6e 53 53 4c 2e 20 54 68 69 73 20 63 61 6e 20  enSSL. This can 
6850: 62 65 20 75 74 69 6c 69 7a 65 64 20 62 79 0a 73  be utilized by.s
6860: 65 74 74 69 6e 67 20 74 68 65 20 5b 6f 70 74 69  etting the [opti
6870: 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74  on -castore] opt
6880: 69 6f 6e 20 74 6f 20 22 5b 63 6f 6e 73 74 20 6f  ion to "[const o
6890: 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 74  rg.openssl.winst
68a0: 6f 72 65 3a 2f 2f 5d 22 2e 0a 49 6e 20 54 63 6c  ore://]"..In Tcl
68b0: 54 4c 53 20 32 2e 30 2c 20 74 68 69 73 20 69 73  TLS 2.0, this is
68c0: 20 74 68 65 20 64 65 66 61 75 6c 74 20 76 61 6c   the default val
68d0: 75 65 20 69 66 20 5b 6f 70 74 69 6f 6e 20 2d 63  ue if [option -c
68e0: 61 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d  adir],.[option -
68f0: 63 61 64 69 72 5d 2c 20 61 6e 64 20 5b 6f 70 74  cadir], and [opt
6900: 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 61 72  ion -castore] ar
6910: 65 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64 2e  e not specified.
6920: 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65 6e  ..[item].If Open
6930: 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74 61  SSL is not insta
6940: 6c 6c 65 64 20 6f 72 20 74 68 65 20 43 41 20 63  lled or the CA c
6950: 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65 20  ertificates are 
6960: 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65 20 69 6e  not available in
6970: 20 50 45 4d 0a 66 6f 72 6d 61 74 2c 20 74 68 65   PEM.format, the
6980: 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73   CA certificates
6990: 20 6d 75 73 74 20 62 65 20 64 6f 77 6e 6c 6f 61   must be downloa
69a0: 64 65 64 20 61 6e 64 20 69 6e 73 74 61 6c 6c 65  ded and installe
69b0: 64 20 77 69 74 68 20 74 68 65 20 75 73 65 72 0a  d with the user.
69c0: 73 6f 66 74 77 61 72 65 2e 20 54 68 65 20 43 55  software. The CU
69d0: 52 4c 20 74 65 61 6d 20 6d 61 6b 65 73 20 74 68  RL team makes th
69e0: 65 6d 20 61 76 61 69 6c 61 62 6c 65 20 61 74 0a  em available at.
69f0: 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 63 75  [uri "https://cu
6a00: 72 6c 2e 73 65 2f 64 6f 63 73 2f 63 61 65 78 74  rl.se/docs/caext
6a10: 72 61 63 74 2e 68 74 6d 6c 22 20 22 43 41 20 63  ract.html" "CA c
6a20: 65 72 74 69 66 69 63 61 74 65 73 20 65 78 74 72  ertificates extr
6a30: 61 63 74 65 64 0a 66 72 6f 6d 20 4d 6f 7a 69 6c  acted.from Mozil
6a40: 6c 61 22 5d 20 69 6e 20 74 68 65 20 5b 66 69 6c  la"] in the [fil
6a50: 65 20 63 61 63 65 72 74 2e 70 65 6d 5d 20 66 69  e cacert.pem] fi
6a60: 6c 65 2e 20 59 6f 75 20 6d 75 73 74 20 74 68 65  le. You must the
6a70: 6e 20 65 69 74 68 65 72 20 73 65 74 20 74 68 65  n either set the
6a80: 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44  .[var SSL_CERT_D
6a90: 49 52 5d 20 61 6e 64 2f 6f 72 20 5b 76 61 72 20  IR] and/or [var 
6aa0: 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65  SSL_CERT_FILE] e
6ab0: 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61  nvironment varia
6ac0: 62 6c 65 73 20 6f 72 20 74 68 65 0a 5b 6f 70 74  bles or the.[opt
6ad0: 69 6f 6e 20 2d 63 61 64 69 72 5d 20 6f 72 20 5b  ion -cadir] or [
6ae0: 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 20  option -cafile] 
6af0: 6f 70 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 43  options to the C
6b00: 41 20 63 65 72 74 20 66 69 6c 65 27 73 20 69 6e  A cert file's in
6b10: 73 74 61 6c 6c 0a 6c 6f 63 61 74 69 6f 6e 2e 20  stall.location. 
6b20: 49 74 20 69 73 20 79 6f 75 72 20 72 65 73 70 6f  It is your respo
6b30: 6e 73 69 62 69 6c 69 74 79 20 74 6f 20 6b 65 65  nsibility to kee
6b40: 70 20 74 68 69 73 20 66 69 6c 65 20 75 70 20 74  p this file up t
6b50: 6f 20 64 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65  o date...[list_e
6b60: 6e 64 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43  nd]..[section "C
6b70: 61 6c 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22  allback Options"
6b80: 5d 0a 0a 41 73 20 70 72 65 76 69 6f 75 73 6c 79  ]..As previously
6b90: 20 64 65 73 63 72 69 62 65 64 2c 20 65 61 63 68   described, each
6ba0: 20 63 68 61 6e 6e 65 6c 20 63 61 6e 20 62 65 20   channel can be 
6bb0: 67 69 76 65 6e 20 74 68 65 69 72 20 6f 77 6e 20  given their own 
6bc0: 63 61 6c 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e  callbacks.to han
6bd0: 64 6c 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65  dle intermediate
6be0: 20 70 72 6f 63 65 73 73 69 6e 67 20 62 79 20 74   processing by t
6bf0: 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61  he OpenSSL libra
6c00: 72 79 2c 20 75 73 69 6e 67 20 74 68 65 0a 5b 6f  ry, using the.[o
6c10: 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c  ption -command],
6c20: 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f   [option -passwo
6c30: 72 64 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e  rd], and [option
6c40: 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61   -validate_comma
6c50: 6e 64 5d 20 6f 70 74 69 6f 6e 73 0a 70 61 73 73  nd] options.pass
6c60: 65 64 20 74 6f 20 65 69 74 68 65 72 20 6f 66 20  ed to either of 
6c70: 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74  [cmd tls::socket
6c80: 5d 20 6f 72 20 5b 63 6d 64 20 74 6c 73 3a 3a 69  ] or [cmd tls::i
6c90: 6d 70 6f 72 74 5d 2e 0a 55 6e 6c 69 6b 65 20 70  mport]..Unlike p
6ca0: 72 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 73  revious versions
6cb0: 20 6f 66 20 54 63 6c 54 4c 53 2c 20 6f 6e 6c 79   of TclTLS, only
6cc0: 20 69 66 20 74 68 65 20 63 61 6c 6c 62 61 63 6b   if the callback
6cd0: 20 67 65 6e 65 72 61 74 65 73 20 61 6e 20 65 72   generates an er
6ce0: 72 6f 72 2c 0a 77 69 6c 6c 20 74 68 65 20 5b 73  ror,.will the [s
6cf0: 79 73 63 6d 64 20 62 67 65 72 72 6f 72 5d 20 63  yscmd bgerror] c
6d00: 6f 6d 6d 61 6e 64 20 62 65 20 69 6e 76 6f 6b 65  ommand be invoke
6d10: 64 20 77 69 74 68 20 74 68 65 20 65 72 72 6f 72  d with the error
6d20: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 5b   information...[
6d30: 73 75 62 73 65 63 74 69 6f 6e 20 22 56 61 6c 75  subsection "Valu
6d40: 65 73 20 66 6f 72 20 43 6f 6d 6d 61 6e 64 20 43  es for Command C
6d50: 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63  allback"]..The c
6d60: 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20  allback for the 
6d70: 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64  [option -command
6d80: 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f  ] option is invo
6d90: 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70  ked at several p
6da0: 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65  oints during the
6db0: 0a 4f 70 65 6e 53 53 4c 20 68 61 6e 64 73 68 61  .OpenSSL handsha
6dc0: 6b 65 20 61 6e 64 20 64 75 72 69 6e 67 20 72 6f  ke and during ro
6dd0: 75 74 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73  utine operations
6de0: 2e 20 53 65 65 20 62 65 6c 6f 77 20 66 6f 72 20  . See below for 
6df0: 74 68 65 20 70 6f 73 73 69 62 6c 65 0a 61 72 67  the possible.arg
6e00: 75 6d 65 6e 74 73 20 70 61 73 73 65 64 20 74 6f  uments passed to
6e10: 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 63   the callback sc
6e20: 72 69 70 74 2e 20 56 61 6c 75 65 73 20 72 65 74  ript. Values ret
6e30: 75 72 6e 65 64 20 66 72 6f 6d 20 74 68 65 20 63  urned from the c
6e40: 61 6c 6c 62 61 63 6b 20 61 72 65 0a 69 67 6e 6f  allback are.igno
6e50: 72 65 64 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  red...[list_begi
6e60: 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74  n options]..[opt
6e70: 5f 64 65 66 20 65 72 72 6f 72 20 5b 61 72 67 20  _def error [arg 
6e80: 22 63 68 61 6e 6e 65 6c 49 64 20 6d 65 73 73 61  "channelId messa
6e90: 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20  ge"]].This form 
6ea0: 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69  of callback is i
6eb0: 6e 76 6f 6b 65 64 20 77 68 65 6e 65 76 65 72 20  nvoked whenever 
6ec0: 61 6e 20 65 72 72 6f 72 20 6f 63 63 75 72 73 20  an error occurs 
6ed0: 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69 74 69  during the initi
6ee0: 61 6c 0a 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68  al.connection, h
6ef0: 61 6e 64 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f  andshake, or I/O
6f00: 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 65   operations. The
6f10: 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 20 61   [arg message] a
6f20: 72 67 75 6d 65 6e 74 20 63 61 6e 20 62 65 0a 66  rgument can be.f
6f30: 72 6f 6d 20 74 68 65 20 54 63 6c 5f 45 72 72 6e  rom the Tcl_Errn
6f40: 6f 4d 73 67 2c 20 4f 70 65 6e 53 53 4c 20 66 75  oMsg, OpenSSL fu
6f50: 6e 63 74 69 6f 6e 20 5b 66 75 6e 20 45 52 52 5f  nction [fun ERR_
6f60: 72 65 61 73 6f 6e 5f 65 72 72 6f 72 5f 73 74 72  reason_error_str
6f70: 69 6e 67 28 29 5d 2c 0a 6f 72 20 61 20 63 75 73  ing()],.or a cus
6f80: 74 6f 6d 20 6d 65 73 73 61 67 65 2e 20 54 68 69  tom message. Thi
6f90: 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65  s callback is ne
6fa0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
6fb0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 69 6e 66 6f  ...[opt_def info
6fc0: 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64   [arg "channelId
6fd0: 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65 73   major minor mes
6fe0: 73 61 67 65 20 74 79 70 65 22 5d 5d 0a 54 68 69  sage type"]].Thi
6ff0: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61  s form of callba
7000: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79  ck is invoked by
7010: 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e   the OpenSSL fun
7020: 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73  ction.[fun SSL_s
7030: 65 74 5f 69 6e 66 6f 5f 63 61 6c 6c 62 61 63 6b  et_info_callback
7040: 28 29 5d 20 64 75 72 69 6e 67 20 74 68 65 20 69  ()] during the i
7050: 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f  nitial connectio
7060: 6e 20 61 6e 64 20 68 61 6e 64 73 68 61 6b 65 0a  n and handshake.
7070: 6f 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 20  operations. The 
7080: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a  arguments are:..
7090: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
70a0: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b  nitions]..[def [
70b0: 61 72 67 20 6d 61 6a 6f 72 5d 5d 0a 4d 61 6a 6f  arg major]].Majo
70c0: 72 20 63 61 74 65 67 6f 72 79 20 66 6f 72 20 65  r category for e
70d0: 72 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d  rror. Valid enum
70e0: 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 68 61  s are: [const ha
70f0: 6e 64 73 68 61 6b 65 5d 2c 20 5b 63 6f 6e 73 74  ndshake], [const
7100: 20 61 6c 65 72 74 5d 2c 0a 5b 63 6f 6e 73 74 20   alert],.[const 
7110: 63 6f 6e 6e 65 63 74 5d 2c 20 5b 63 6f 6e 73 74  connect], [const
7120: 20 61 63 63 65 70 74 5d 2e 0a 0a 5b 64 65 66 20   accept]...[def 
7130: 5b 61 72 67 20 6d 69 6e 6f 72 5d 5d 0a 4d 69 6e  [arg minor]].Min
7140: 6f 72 20 63 61 74 65 67 6f 72 79 20 66 6f 72 20  or category for 
7150: 65 72 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75  error. Valid enu
7160: 6d 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 73  ms are: [const s
7170: 74 61 72 74 5d 2c 20 5b 63 6f 6e 73 74 20 64 6f  tart], [const do
7180: 6e 65 5d 2c 20 5b 63 6f 6e 73 74 20 72 65 61 64  ne], [const read
7190: 5d 2c 0a 5b 63 6f 6e 73 74 20 77 72 69 74 65 5d  ],.[const write]
71a0: 2c 20 5b 63 6f 6e 73 74 20 6c 6f 6f 70 5d 2c 20  , [const loop], 
71b0: 5b 63 6f 6e 73 74 20 65 78 69 74 5d 2e 0a 0a 5b  [const exit]...[
71c0: 64 65 66 20 5b 61 72 67 20 6d 65 73 73 61 67 65  def [arg message
71d0: 5d 5d 0a 44 65 73 63 72 69 70 74 69 76 65 20 6d  ]].Descriptive m
71e0: 65 73 73 61 67 65 20 73 74 72 69 6e 67 20 77 68  essage string wh
71f0: 69 63 68 20 6d 61 79 20 62 65 20 67 65 6e 65 72  ich may be gener
7200: 61 74 65 64 20 65 69 74 68 65 72 20 62 79 0a 5b  ated either by.[
7210: 66 75 6e 20 53 53 4c 5f 73 74 61 74 65 5f 73 74  fun SSL_state_st
7220: 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d 20 6f 72 20  ring_long()] or 
7230: 5b 66 75 6e 20 53 53 4c 5f 61 6c 65 72 74 5f 64  [fun SSL_alert_d
7240: 65 73 63 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28  esc_string_long(
7250: 29 5d 2c 0a 64 65 70 65 6e 64 69 6e 67 20 6f 6e  )],.depending on
7260: 20 74 68 65 20 63 6f 6e 74 65 78 74 2e 0a 0a 5b   the context...[
7270: 64 65 66 20 5b 61 72 67 20 74 79 70 65 5d 5d 0a  def [arg type]].
7280: 46 6f 72 20 61 6c 65 72 74 73 2c 20 74 68 65 20  For alerts, the 
7290: 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 20  possible values 
72a0: 61 72 65 3a 20 5b 63 6f 6e 73 74 20 77 61 72 6e  are: [const warn
72b0: 69 6e 67 5d 2c 0a 5b 63 6f 6e 73 74 20 66 61 74  ing],.[const fat
72c0: 61 6c 5d 2c 20 61 6e 64 20 5b 63 6f 6e 73 74 20  al], and [const 
72d0: 75 6e 6b 6e 6f 77 6e 5d 2e 20 46 6f 72 20 6f 74  unknown]. For ot
72e0: 68 65 72 73 2c 20 5b 63 6f 6e 73 74 20 69 6e 66  hers, [const inf
72f0: 6f 5d 20 69 73 20 75 73 65 64 2e 0a 54 68 69 73  o] is used..This
7300: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77   argument is new
7310: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
7320: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f  ..[list_end]..[o
7330: 70 74 5f 64 65 66 20 6d 65 73 73 61 67 65 20 5b  pt_def message [
7340: 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64  arg "channelId d
7350: 69 72 65 63 74 69 6f 6e 20 76 65 72 73 69 6f 6e  irection version
7360: 20 63 6f 6e 74 65 6e 74 5f 74 79 70 65 20 6d 65   content_type me
7370: 73 73 61 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f  ssage"]].This fo
7380: 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69  rm of callback i
7390: 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65  s invoked by the
73a0: 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f   OpenSSL functio
73b0: 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73 65 74 5f 6d  n.[fun SSL_set_m
73c0: 73 67 5f 63 61 6c 6c 62 61 63 6b 28 29 5d 20 77  sg_callback()] w
73d0: 68 65 6e 65 76 65 72 20 61 20 6d 65 73 73 61 67  henever a messag
73e0: 65 20 69 73 20 73 65 6e 74 20 6f 72 20 72 65 63  e is sent or rec
73f0: 65 69 76 65 64 20 64 75 72 69 6e 67 20 74 68 65  eived during the
7400: 0a 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74  .initial connect
7410: 69 6f 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20  ion, handshake, 
7420: 6f 72 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f 6e  or I/O operation
7430: 73 2e 20 49 74 20 69 73 20 6f 6e 6c 79 20 61 76  s. It is only av
7440: 61 69 6c 61 62 6c 65 20 77 68 65 6e 0a 4f 70 65  ailable when.Ope
7450: 6e 53 53 4c 20 69 73 20 63 6f 6d 70 6c 69 65 64  nSSL is complied
7460: 20 77 69 74 68 20 74 68 65 20 5b 63 6f 6e 73 74   with the [const
7470: 20 65 6e 61 62 6c 65 2d 73 73 6c 2d 74 72 61 63   enable-ssl-trac
7480: 65 5d 20 6f 70 74 69 6f 6e 2e 20 54 68 69 73 20  e] option. This 
7490: 63 61 6c 6c 62 61 63 6b 20 69 73 0a 6e 65 77 20  callback is.new 
74a0: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20  for TclTLS 1.8. 
74b0: 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72  The arguments ar
74c0: 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  e:..[list_begin 
74d0: 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64  definitions]..[d
74e0: 65 66 20 5b 61 72 67 20 64 69 72 65 63 74 69 6f  ef [arg directio
74f0: 6e 5d 5d 0a 44 69 72 65 63 74 69 6f 6e 20 69 73  n]].Direction is
7500: 20 65 69 74 68 65 72 20 5b 63 6f 6e 73 74 20 53   either [const S
7510: 65 6e 74 5d 20 6f 72 20 5b 63 6f 6e 73 74 20 52  ent] or [const R
7520: 65 63 65 69 76 65 64 5d 2e 0a 0a 5b 64 65 66 20  eceived]...[def 
7530: 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 5d 0a 56  [arg version]].V
7540: 65 72 73 69 6f 6e 20 69 73 20 74 68 65 20 70 72  ersion is the pr
7550: 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 2e 0a  otocol version..
7560: 0a 5b 64 65 66 20 5b 61 72 67 20 63 6f 6e 74 65  .[def [arg conte
7570: 6e 74 5f 74 79 70 65 5d 5d 0a 43 6f 6e 74 65 6e  nt_type]].Conten
7580: 74 20 74 79 70 65 20 69 73 20 74 68 65 20 6d 65  t type is the me
7590: 73 73 61 67 65 20 63 6f 6e 74 65 6e 74 20 74 79  ssage content ty
75a0: 70 65 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d  pe...[def [arg m
75b0: 65 73 73 61 67 65 5d 5d 0a 4d 65 73 73 61 67 65  essage]].Message
75c0: 20 69 73 20 6d 6f 72 65 20 69 6e 66 6f 20 66 72   is more info fr
75d0: 6f 6d 20 74 68 65 20 5b 63 6f 6e 73 74 20 53 53  om the [const SS
75e0: 4c 5f 74 72 61 63 65 5d 20 41 50 49 2e 0a 0a 5b  L_trace] API...[
75f0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f  list_end]..[opt_
7600: 64 65 66 20 73 65 73 73 69 6f 6e 20 5b 61 72 67  def session [arg
7610: 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 73 73   "channelId sess
7620: 69 6f 6e 5f 69 64 20 73 65 73 73 69 6f 6e 5f 74  ion_id session_t
7630: 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 22 5d  icket lifetime"]
7640: 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63  ].This form of c
7650: 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b  allback is invok
7660: 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53  ed by the OpenSS
7670: 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20  L function.[fun 
7680: 53 53 4c 5f 43 54 58 5f 73 65 73 73 5f 73 65 74  SSL_CTX_sess_set
7690: 5f 6e 65 77 5f 63 62 28 29 5d 20 77 68 65 6e 65  _new_cb()] whene
76a0: 76 65 72 20 61 20 6e 65 77 20 73 65 73 73 69 6f  ver a new sessio
76b0: 6e 20 69 64 20 69 73 20 73 65 6e 74 20 62 79 20  n id is sent by 
76c0: 74 68 65 0a 73 65 72 76 65 72 20 64 75 72 69 6e  the.server durin
76d0: 67 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63 6f  g the initial co
76e0: 6e 6e 65 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e  nnection and han
76f0: 64 73 68 61 6b 65 20 61 6e 64 20 61 6c 73 6f 20  dshake and also 
7700: 64 75 72 69 6e 67 20 74 68 65 20 73 65 73 73 69  during the sessi
7710: 6f 6e 0a 69 66 20 74 68 65 20 5b 6f 70 74 69 6f  on.if the [optio
7720: 6e 20 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b  n -post_handshak
7730: 65 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73 65 74  e] option is set
7740: 20 74 6f 20 74 72 75 65 2e 20 54 68 69 73 20 63   to true. This c
7750: 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20 66  allback is new f
7760: 6f 72 0a 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54  or.TclTLS 1.8. T
7770: 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65  he arguments are
7780: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64  :..[list_begin d
7790: 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65  efinitions]..[de
77a0: 66 20 5b 61 72 67 20 73 65 73 73 69 6f 6e 5f 69  f [arg session_i
77b0: 64 5d 5d 0a 53 65 73 73 69 6f 6e 20 49 64 20 69  d]].Session Id i
77c0: 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 73 65  s the current se
77d0: 73 73 69 6f 6e 20 69 64 65 6e 74 69 66 69 65 72  ssion identifier
77e0: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 65 73 73  ..[def [arg sess
77f0: 69 6f 6e 5f 74 69 63 6b 65 74 5d 5d 0a 54 69 63  ion_ticket]].Tic
7800: 6b 65 74 20 69 73 20 74 68 65 20 73 65 73 73 69  ket is the sessi
7810: 6f 6e 20 74 69 63 6b 65 74 20 69 6e 66 6f 0a 0a  on ticket info..
7820: 5b 64 65 66 20 5b 61 72 67 20 6c 69 66 65 74 69  [def [arg lifeti
7830: 6d 65 5d 5d 0a 4c 69 66 65 74 69 6d 65 20 69 73  me]].Lifetime is
7840: 20 74 68 65 20 74 69 63 6b 65 74 20 6c 69 66 65   the ticket life
7850: 74 69 6d 65 20 69 6e 20 73 65 63 6f 6e 64 73 2e  time in seconds.
7860: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f  ..[list_end]..[o
7870: 70 74 5f 64 65 66 20 76 65 72 69 66 79 20 5b 61  pt_def verify [a
7880: 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 65  rg "channelId de
7890: 70 74 68 20 63 65 72 74 20 73 74 61 74 75 73 20  pth cert status 
78a0: 65 72 72 6f 72 22 5d 5d 0a 54 68 69 73 20 63 61  error"]].This ca
78b0: 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65 64  llback was moved
78c0: 20 74 6f 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c   to [option -val
78d0: 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 69 6e  idatecommand] in
78e0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c   TclTLS 1.8...[l
78f0: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65  ist_end]..[subse
7900: 63 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f  ction "Values fo
7910: 72 20 50 61 73 73 77 6f 72 64 20 43 61 6c 6c 62  r Password Callb
7920: 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62  ack"]..The callb
7930: 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 74  ack for the [opt
7940: 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f  ion -password] o
7950: 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64  ption is invoked
7960: 20 62 79 20 54 63 6c 54 4c 53 20 77 68 65 6e 65   by TclTLS whene
7970: 76 65 72 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64  ver OpenSSL need
7980: 73 0a 74 6f 20 6f 62 74 61 69 6e 20 61 20 70 61  s.to obtain a pa
7990: 73 73 77 6f 72 64 2e 20 53 65 65 20 62 65 6c 6f  ssword. See belo
79a0: 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62  w for the possib
79b0: 6c 65 20 61 72 67 75 6d 65 6e 74 73 20 70 61 73  le arguments pas
79c0: 73 65 64 20 74 6f 20 74 68 65 0a 63 61 6c 6c 62  sed to the.callb
79d0: 61 63 6b 20 73 63 72 69 70 74 2e 20 54 68 65 20  ack script. The 
79e0: 75 73 65 72 20 70 72 6f 76 69 64 65 64 20 70 61  user provided pa
79f0: 73 73 77 6f 72 64 20 69 73 20 65 78 70 65 63 74  ssword is expect
7a00: 65 64 20 74 6f 20 62 65 20 72 65 74 75 72 6e 65  ed to be returne
7a10: 64 20 62 79 20 74 68 65 0a 63 61 6c 6c 62 61 63  d by the.callbac
7a20: 6b 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  k...[list_begin 
7a30: 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64  options]..[opt_d
7a40: 65 66 20 70 61 73 73 77 6f 72 64 20 5b 61 72 67  ef password [arg
7a50: 20 22 72 77 66 6c 61 67 20 73 69 7a 65 22 5d 5d   "rwflag size"]]
7a60: 0a 49 6e 76 6f 6b 65 64 20 77 68 65 6e 20 6c 6f  .Invoked when lo
7a70: 61 64 69 6e 67 20 6f 72 20 73 74 6f 72 69 6e 67  ading or storing
7a80: 20 61 6e 20 65 6e 63 72 79 70 74 65 64 20 50 45   an encrypted PE
7a90: 4d 20 63 65 72 74 69 66 69 63 61 74 65 2e 20 54  M certificate. T
7aa0: 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65  he arguments are
7ab0: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64  :..[list_begin d
7ac0: 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65  efinitions]..[de
7ad0: 66 20 5b 61 72 67 20 72 77 66 6c 61 67 5d 5d 0a  f [arg rwflag]].
7ae0: 54 68 65 20 72 65 61 64 2f 77 72 69 74 65 20 66  The read/write f
7af0: 6c 61 67 20 69 73 20 30 20 66 6f 72 20 72 65 61  lag is 0 for rea
7b00: 64 69 6e 67 2f 64 65 63 72 79 70 74 69 6f 6e 20  ding/decryption 
7b10: 6f 72 20 31 20 66 6f 72 20 77 72 69 74 69 6e 67  or 1 for writing
7b20: 2f 65 6e 63 72 79 70 74 69 6f 6e 2e 0a 54 68 65  /encryption..The
7b30: 20 6c 61 74 74 65 72 20 63 61 6e 20 62 65 20 75   latter can be u
7b40: 73 65 64 20 74 6f 20 64 65 74 65 72 6d 69 6e 65  sed to determine
7b50: 20 77 68 65 6e 20 74 6f 20 70 72 6f 6d 70 74 20   when to prompt 
7b60: 74 68 65 20 75 73 65 72 20 74 6f 20 63 6f 6e 66  the user to conf
7b70: 69 72 6d 2e 0a 54 68 69 73 20 61 72 67 75 6d 65  irm..This argume
7b80: 6e 74 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  nt is new for Tc
7b90: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
7ba0: 5b 61 72 67 20 73 69 7a 65 5d 5d 0a 54 68 65 20  [arg size]].The 
7bb0: 73 69 7a 65 20 69 73 20 74 68 65 20 6d 61 78 69  size is the maxi
7bc0: 6d 75 6d 20 6c 65 6e 67 74 68 20 6f 66 20 74 68  mum length of th
7bd0: 65 20 70 61 73 73 77 6f 72 64 20 69 6e 20 62 79  e password in by
7be0: 74 65 73 2e 0a 54 68 69 73 20 61 72 67 75 6d 65  tes..This argume
7bf0: 6e 74 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  nt is new for Tc
7c00: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74  lTLS 1.8...[list
7c10: 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64  _end]..[list_end
7c20: 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22  ]..[subsection "
7c30: 56 61 6c 75 65 73 20 66 6f 72 20 56 61 6c 69 64  Values for Valid
7c40: 61 74 65 20 43 6f 6d 6d 61 6e 64 20 43 61 6c 6c  ate Command Call
7c50: 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c  back"]..The call
7c60: 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70  back for the [op
7c70: 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f  tion -validateco
7c80: 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 73  mmand] option is
7c90: 20 69 6e 76 6f 6b 65 64 20 64 75 72 69 6e 67 20   invoked during 
7ca0: 74 68 65 20 68 61 6e 64 73 68 61 6b 65 0a 70 72  the handshake.pr
7cb0: 6f 63 65 73 73 20 69 6e 20 6f 72 64 65 72 20 66  ocess in order f
7cc0: 6f 72 20 74 68 65 20 61 70 70 6c 69 63 61 74 69  or the applicati
7cd0: 6f 6e 20 74 6f 20 76 61 6c 69 64 61 74 65 20 74  on to validate t
7ce0: 68 65 20 70 72 6f 76 69 64 65 64 20 76 61 6c 75  he provided valu
7cf0: 65 28 73 29 2e 20 53 65 65 0a 62 65 6c 6f 77 20  e(s). See.below 
7d00: 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c 65  for the possible
7d10: 20 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73 65   arguments passe
7d20: 64 20 74 6f 20 74 68 65 20 63 61 6c 6c 62 61 63  d to the callbac
7d30: 6b 20 73 63 72 69 70 74 2e 20 49 66 20 6e 6f 74  k script. If not
7d40: 0a 73 70 65 63 69 66 69 65 64 2c 20 4f 70 65 6e  .specified, Open
7d50: 53 53 4c 20 77 69 6c 6c 20 61 63 63 65 70 74 20  SSL will accept 
7d60: 61 6c 6c 20 76 61 6c 69 64 20 63 65 72 74 69 66  all valid certif
7d70: 69 63 61 74 65 73 20 61 6e 64 20 65 78 74 65 6e  icates and exten
7d80: 73 69 6f 6e 73 2e 20 54 6f 20 72 65 6a 65 63 74  sions. To reject
7d90: 0a 74 68 65 20 76 61 6c 75 65 20 61 6e 64 20 61  .the value and a
7da0: 62 6f 72 74 20 74 68 65 20 63 6f 6e 6e 65 63 74  bort the connect
7db0: 69 6f 6e 2c 20 74 68 65 20 63 61 6c 6c 62 61 63  ion, the callbac
7dc0: 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20  k should return 
7dd0: 30 2e 20 54 6f 20 61 63 63 65 70 74 20 74 68 65  0. To accept the
7de0: 0a 76 61 6c 75 65 20 61 6e 64 20 63 6f 6e 74 69  .value and conti
7df0: 6e 75 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69  nue the connecti
7e00: 6f 6e 2c 20 69 74 20 73 68 6f 75 6c 64 20 72 65  on, it should re
7e10: 74 75 72 6e 20 31 2e 20 54 6f 20 72 65 6a 65 63  turn 1. To rejec
7e20: 74 20 74 68 65 20 76 61 6c 75 65 2c 20 62 75 74  t the value, but
7e30: 0a 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 63 6f  .continue the co
7e40: 6e 6e 65 63 74 69 6f 6e 2c 20 69 74 20 73 68 6f  nnection, it sho
7e50: 75 6c 64 20 72 65 74 75 72 6e 20 32 2e 20 54 68  uld return 2. Th
7e60: 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e  is callback is n
7e70: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
7e80: 38 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  8...[list_begin 
7e90: 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64  options]..[opt_d
7ea0: 65 66 20 61 6c 70 6e 20 5b 61 72 67 20 22 63 68  ef alpn [arg "ch
7eb0: 61 6e 6e 65 6c 49 64 20 70 72 6f 74 6f 63 6f 6c  annelId protocol
7ec0: 20 6d 61 74 63 68 22 5d 5d 0a 46 6f 72 20 73 65   match"]].For se
7ed0: 72 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72 6d  rvers, this form
7ee0: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20   of callback is 
7ef0: 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 74 68 65  invoked when the
7f00: 20 63 6c 69 65 6e 74 20 41 4c 50 4e 20 65 78 74   client ALPN ext
7f10: 65 6e 73 69 6f 6e 20 69 73 0a 72 65 63 65 69 76  ension is.receiv
7f20: 65 64 2e 20 49 66 20 5b 61 72 67 20 6d 61 74 63  ed. If [arg matc
7f30: 68 5d 20 69 73 20 74 72 75 65 2c 20 74 68 65 6e  h] is true, then
7f40: 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 20   [arg protocol] 
7f50: 69 73 20 74 68 65 20 66 69 72 73 74 0a 5b 6f 70  is the first.[op
7f60: 74 69 6f 6e 20 2d 61 6c 70 6e 5d 20 70 72 6f 74  tion -alpn] prot
7f70: 6f 63 6f 6c 20 6f 70 74 69 6f 6e 20 69 6e 20 63  ocol option in c
7f80: 6f 6d 6d 6f 6e 20 74 6f 20 62 6f 74 68 20 74 68  ommon to both th
7f90: 65 20 63 6c 69 65 6e 74 20 61 6e 64 20 73 65 72  e client and ser
7fa0: 76 65 72 2e 0a 49 66 20 6e 6f 74 2c 20 74 68 65  ver..If not, the
7fb0: 20 66 69 72 73 74 20 63 6c 69 65 6e 74 20 73 70   first client sp
7fc0: 65 63 69 66 69 65 64 20 70 72 6f 74 6f 63 6f 6c  ecified protocol
7fd0: 20 69 73 20 75 73 65 64 2e 20 54 68 69 73 20 63   is used. This c
7fe0: 61 6c 6c 62 61 63 6b 20 69 73 20 63 61 6c 6c 65  allback is calle
7ff0: 64 0a 61 66 74 65 72 20 74 68 65 20 48 65 6c 6c  d.after the Hell
8000: 6f 20 61 6e 64 20 53 4e 49 20 63 61 6c 6c 62 61  o and SNI callba
8010: 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 68  cks...[opt_def h
8020: 65 6c 6c 6f 20 5b 61 72 67 20 22 63 68 61 6e 6e  ello [arg "chann
8030: 65 6c 49 64 20 73 65 72 76 65 72 6e 61 6d 65 20  elId servername 
8040: 73 65 73 73 69 6f 6e 5f 69 64 22 5d 5d 0a 46 6f  session_id"]].Fo
8050: 72 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 20  r servers, this 
8060: 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b  form of callback
8070: 20 69 73 20 69 6e 76 6f 6b 65 64 20 64 75 72 69   is invoked duri
8080: 6e 67 20 63 6c 69 65 6e 74 20 68 65 6c 6c 6f 20  ng client hello 
8090: 6d 65 73 73 61 67 65 0a 70 72 6f 63 65 73 73 69  message.processi
80a0: 6e 67 2e 20 54 68 65 20 70 75 72 70 6f 73 65 20  ng. The purpose 
80b0: 69 73 20 73 6f 20 74 68 65 20 73 65 72 76 65 72  is so the server
80c0: 20 63 61 6e 20 73 65 6c 65 63 74 20 74 68 65 20   can select the 
80d0: 61 70 70 72 6f 70 72 69 61 74 65 20 63 65 72 74  appropriate cert
80e0: 69 66 69 63 61 74 65 0a 74 6f 20 70 72 65 73 65  ificate.to prese
80f0: 6e 74 20 74 6f 20 74 68 65 20 63 6c 69 65 6e 74  nt to the client
8100: 2c 20 61 6e 64 20 74 6f 20 6d 61 6b 65 20 6f 74  , and to make ot
8110: 68 65 72 20 63 6f 6e 66 69 67 75 72 61 74 69 6f  her configuratio
8120: 6e 20 61 64 6a 75 73 74 6d 65 6e 74 73 20 72 65  n adjustments re
8130: 6c 65 76 61 6e 74 0a 74 6f 20 74 68 61 74 20 73  levant.to that s
8140: 65 72 76 65 72 20 6e 61 6d 65 20 61 6e 64 20 69  erver name and i
8150: 74 73 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e  ts configuration
8160: 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64 20 62  . It is called b
8170: 65 66 6f 72 65 20 74 68 65 20 53 4e 49 20 61 6e  efore the SNI an
8180: 64 20 41 4c 50 4e 0a 63 61 6c 6c 62 61 63 6b 73  d ALPN.callbacks
8190: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 73 6e 69 20  ...[opt_def sni 
81a0: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20  [arg "channelId 
81b0: 73 65 72 76 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f  servername"]].Fo
81c0: 72 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 20  r servers, this 
81d0: 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b  form of callback
81e0: 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e   is invoked when
81f0: 20 74 68 65 20 53 65 72 76 65 72 20 4e 61 6d 65   the Server Name
8200: 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53 4e 49   Indication.(SNI
8210: 29 20 65 78 74 65 6e 73 69 6f 6e 20 69 73 20 72  ) extension is r
8220: 65 63 65 69 76 65 64 2e 20 54 68 65 20 5b 61 72  eceived. The [ar
8230: 67 20 73 65 72 76 65 72 6e 61 6d 65 5d 20 61 72  g servername] ar
8240: 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20 63 6c  gument is the cl
8250: 69 65 6e 74 0a 70 72 6f 76 69 64 65 64 20 73 65  ient.provided se
8260: 72 76 65 72 20 6e 61 6d 65 20 73 70 65 63 69 66  rver name specif
8270: 69 65 64 20 69 6e 20 74 68 65 20 5b 6f 70 74 69  ied in the [opti
8280: 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65 5d 20  on -servername] 
8290: 6f 70 74 69 6f 6e 2e 20 54 68 65 0a 70 75 72 70  option. The.purp
82a0: 6f 73 65 20 69 73 20 73 6f 20 77 68 65 6e 20 61  ose is so when a
82b0: 20 73 65 72 76 65 72 20 73 75 70 70 6f 72 74 73   server supports
82c0: 20 6d 75 6c 74 69 70 6c 65 20 6e 61 6d 65 73 2c   multiple names,
82d0: 20 74 68 65 20 72 69 67 68 74 20 63 65 72 74 69   the right certi
82e0: 66 69 63 61 74 65 0a 63 61 6e 20 62 65 20 75 73  ficate.can be us
82f0: 65 64 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64  ed. It is called
8300: 20 61 66 74 65 72 20 74 68 65 20 48 65 6c 6c 6f   after the Hello
8310: 20 63 61 6c 6c 62 61 63 6b 20 62 75 74 20 62 65   callback but be
8320: 66 6f 72 65 20 74 68 65 20 41 4c 50 4e 0a 63 61  fore the ALPN.ca
8330: 6c 6c 62 61 63 6b 2e 0a 0a 5b 6f 70 74 5f 64 65  llback...[opt_de
8340: 66 20 76 65 72 69 66 79 20 5b 61 72 67 20 22 63  f verify [arg "c
8350: 68 61 6e 6e 65 6c 49 64 20 64 65 70 74 68 20 63  hannelId depth c
8360: 65 72 74 20 73 74 61 74 75 73 20 65 72 72 6f 72  ert status error
8370: 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66  "]].This form of
8380: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
8390: 6f 6b 65 64 20 62 79 20 4f 70 65 6e 53 53 4c 20  oked by OpenSSL 
83a0: 77 68 65 6e 20 61 20 6e 65 77 20 63 65 72 74 69  when a new certi
83b0: 66 69 63 61 74 65 20 69 73 20 72 65 63 65 69 76  ficate is receiv
83c0: 65 64 0a 66 72 6f 6d 20 74 68 65 20 70 65 65 72  ed.from the peer
83d0: 2e 20 49 74 20 61 6c 6c 6f 77 73 20 74 68 65 20  . It allows the 
83e0: 63 6c 69 65 6e 74 20 74 6f 20 63 68 65 63 6b 20  client to check 
83f0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
8400: 76 65 72 69 66 69 63 61 74 69 6f 6e 0a 72 65 73  verification.res
8410: 75 6c 74 73 20 61 6e 64 20 63 68 6f 6f 73 65 20  ults and choose 
8420: 77 68 65 74 68 65 72 20 74 6f 20 63 6f 6e 74 69  whether to conti
8430: 6e 75 65 20 6f 72 20 6e 6f 74 2e 20 49 74 20 69  nue or not. It i
8440: 73 20 63 61 6c 6c 65 64 20 66 6f 72 20 65 61 63  s called for eac
8450: 68 0a 63 65 72 74 69 66 69 63 61 74 65 20 69 6e  h.certificate in
8460: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
8470: 20 63 68 61 69 6e 2e 20 54 68 69 73 20 63 61 6c   chain. This cal
8480: 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65 64 20  lback was moved 
8490: 66 72 6f 6d 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f  from.[option -co
84a0: 6d 6d 61 6e 64 5d 20 69 6e 20 54 63 6c 54 4c 53  mmand] in TclTLS
84b0: 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d 65   1.8. The argume
84c0: 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f  nts are:..[list_
84d0: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
84e0: 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 64 65  s]..[def [arg de
84f0: 70 74 68 5d 5d 0a 54 68 65 20 64 65 70 74 68 20  pth]].The depth 
8500: 69 73 20 74 68 65 20 69 6e 74 65 67 65 72 20 64  is the integer d
8510: 65 70 74 68 20 6f 66 20 74 68 65 20 63 65 72 74  epth of the cert
8520: 69 66 69 63 61 74 65 20 69 6e 20 74 68 65 20 63  ificate in the c
8530: 65 72 74 69 66 69 63 61 74 65 20 63 68 61 69 6e  ertificate chain
8540: 2c 0a 77 68 65 72 65 20 30 20 69 73 20 74 68 65  ,.where 0 is the
8550: 20 70 65 65 72 20 63 65 72 74 69 66 69 63 61 74   peer certificat
8560: 65 20 61 6e 64 20 68 69 67 68 65 72 20 76 61 6c  e and higher val
8570: 75 65 73 20 67 6f 69 6e 67 20 75 70 20 74 6f 20  ues going up to 
8580: 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 0a  the Certificate.
8590: 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 2e 0a  Authority (CA)..
85a0: 0a 5b 64 65 66 20 5b 61 72 67 20 63 65 72 74 5d  .[def [arg cert]
85b0: 5d 0a 54 68 65 20 63 65 72 74 20 61 72 67 75 6d  ].The cert argum
85c0: 65 6e 74 20 69 73 20 61 20 6c 69 73 74 20 6f 66  ent is a list of
85d0: 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73   key-value pairs
85e0: 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 6f 73   similar to thos
85f0: 65 20 72 65 74 75 72 6e 65 64 20 62 79 0a 5b 63  e returned by.[c
8600: 6d 64 20 74 6c 73 3a 3a 73 74 61 74 75 73 5d 2e  md tls::status].
8610: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 74 61 74  ..[def [arg stat
8620: 75 73 5d 5d 0a 54 68 65 20 73 74 61 74 75 73 20  us]].The status 
8630: 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20  argument is the 
8640: 62 6f 6f 6c 65 61 6e 20 76 61 6c 69 64 69 74 79  boolean validity
8650: 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e 74 20   of the current 
8660: 63 65 72 74 69 66 69 63 61 74 65 20 77 68 65 72  certificate wher
8670: 65 20 30 0a 69 73 20 69 6e 76 61 6c 69 64 20 61  e 0.is invalid a
8680: 6e 64 20 31 20 69 73 20 76 61 6c 69 64 2e 0a 0a  nd 1 is valid...
8690: 5b 64 65 66 20 5b 61 72 67 20 65 72 72 6f 72 5d  [def [arg error]
86a0: 5d 0a 54 68 65 20 65 72 72 6f 72 20 61 72 67 75  ].The error argu
86b0: 6d 65 6e 74 20 69 73 20 74 68 65 20 65 72 72 6f  ment is the erro
86c0: 72 20 6d 65 73 73 61 67 65 2c 20 69 66 20 61 6e  r message, if an
86d0: 79 2c 20 67 65 6e 65 72 61 74 65 64 20 62 79 0a  y, generated by.
86e0: 5b 66 75 6e 20 58 35 30 39 5f 53 54 4f 52 45 5f  [fun X509_STORE_
86f0: 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28 29 5d  CTX_get_error()]
8700: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
8710: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 52 65 66 65 72  list_end]..Refer
8720: 65 6e 63 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74  ence implementat
8730: 69 6f 6e 73 20 6f 66 20 74 68 65 73 65 20 63 61  ions of these ca
8740: 6c 6c 62 61 63 6b 73 20 61 72 65 20 70 72 6f 76  llbacks are prov
8750: 69 64 65 64 20 69 6e 20 5b 66 69 6c 65 20 74 6c  ided in [file tl
8760: 73 2e 74 63 6c 5d 0a 61 73 20 5b 63 6d 64 20 74  s.tcl].as [cmd t
8770: 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b  ls::callback], [
8780: 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72  cmd tls::passwor
8790: 64 5d 2c 20 61 6e 64 20 5b 63 6d 64 20 74 6c 73  d], and [cmd tls
87a0: 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61  ::validate_comma
87b0: 6e 64 5d 0a 72 65 73 70 65 63 74 69 76 65 6c 79  nd].respectively
87c0: 2e 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 73  . Note that thes
87d0: 65 20 61 72 65 20 6f 6e 6c 79 20 5b 65 6d 70 68  e are only [emph
87e0: 20 73 61 6d 70 6c 65 5d 20 69 6d 70 6c 65 6d 65   sample] impleme
87f0: 6e 74 61 74 69 6f 6e 73 2e 20 49 6e 20 61 20 6d  ntations. In a m
8800: 6f 72 65 0a 72 65 61 6c 69 73 74 69 63 20 64 65  ore.realistic de
8810: 70 6c 6f 79 6d 65 6e 74 20 79 6f 75 20 77 6f 75  ployment you wou
8820: 6c 64 20 73 70 65 63 69 66 79 20 79 6f 75 72 20  ld specify your 
8830: 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 20 73 63 72  own callback scr
8840: 69 70 74 73 20 6f 6e 20 65 61 63 68 20 54 4c 53  ipts on each TLS
8850: 0a 63 68 61 6e 6e 65 6c 20 75 73 69 6e 67 20 74  .channel using t
8860: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d  he [option -comm
8870: 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 70  and], [option -p
8880: 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b 6f  assword], and.[o
8890: 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f  ption -validate_
88a0: 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 73  command] options
88b0: 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68 65 20 64  ...[para]..The d
88c0: 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72 20  efault behavior 
88d0: 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e  when the [option
88e0: 20 2d 63 6f 6d 6d 61 6e 64 5d 20 61 6e 64 20 5b   -command] and [
88f0: 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65  option -validate
8900: 5f 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e  _command].option
8910: 73 20 61 72 65 20 6e 6f 74 20 73 70 65 63 69 66  s are not specif
8920: 69 65 64 2c 20 69 73 20 66 6f 72 20 54 63 6c 54  ied, is for TclT
8930: 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68  LS to process th
8940: 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69 62  e associated lib
8950: 72 61 72 79 0a 63 61 6c 6c 62 61 63 6b 73 20 69  rary.callbacks i
8960: 6e 74 65 72 6e 61 6c 6c 79 2e 20 54 68 65 20 64  nternally. The d
8970: 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72 20  efault behavior 
8980: 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e  when the [option
8990: 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74 69   -password] opti
89a0: 6f 6e 0a 69 73 20 6e 6f 74 20 73 70 65 63 69 66  on.is not specif
89b0: 69 65 64 20 69 73 20 66 6f 72 20 54 63 6c 54 4c  ied is for TclTL
89c0: 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 65  S to process the
89d0: 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69 62 72   associated libr
89e0: 61 72 79 20 63 61 6c 6c 62 61 63 6b 73 20 62 79  ary callbacks by
89f0: 0a 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63  .attempting to c
8a00: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61  all [cmd tls::pa
8a10: 73 73 77 6f 72 64 5d 2e 20 54 68 65 20 64 69 66  ssword]. The dif
8a20: 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20  ference between 
8a30: 74 68 65 73 65 20 74 77 6f 0a 62 65 68 61 76 69  these two.behavi
8a40: 6f 72 73 20 69 73 20 61 20 63 6f 6e 73 65 71 75  ors is a consequ
8a50: 65 6e 63 65 20 6f 66 20 6d 61 69 6e 74 61 69 6e  ence of maintain
8a60: 69 6e 67 20 63 6f 6d 70 61 74 69 62 69 6c 69 74  ing compatibilit
8a70: 79 20 77 69 74 68 20 65 61 72 6c 69 65 72 0a 69  y with earlier.i
8a80: 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a  mplementations..
8a90: 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70 68 20 22  .[para]..[emph "
8aa0: 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 72  The use of the r
8ab0: 65 66 65 72 65 6e 63 65 20 63 61 6c 6c 62 61 63  eference callbac
8ac0: 6b 73 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c  ks [cmd tls::cal
8ad0: 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73  lback], [cmd tls
8ae0: 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 0a 61 6e 64  ::password],.and
8af0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64   [cmd tls::valid
8b00: 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 69 73 20  ate_command] is 
8b10: 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e  not recommended.
8b20: 20 54 68 65 79 20 6d 61 79 20 62 65 20 72 65 6d   They may be rem
8b30: 6f 76 65 64 20 66 72 6f 6d 20 66 75 74 75 72 65  oved from future
8b40: 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b 73   releases."]..[s
8b50: 65 63 74 69 6f 6e 20 44 65 62 75 67 5d 0a 0a 46  ection Debug]..F
8b60: 6f 72 20 6d 6f 73 74 20 64 65 62 75 67 67 69 6e  or most debuggin
8b70: 67 20 6e 65 65 64 73 2c 20 74 68 65 20 5b 6f 70  g needs, the [op
8b80: 74 69 6f 6e 20 2d 63 61 6c 6c 62 61 63 6b 5d 20  tion -callback] 
8b90: 6f 70 74 69 6f 6e 20 63 61 6e 20 62 65 20 75 73  option can be us
8ba0: 65 64 20 74 6f 20 70 72 6f 76 69 64 65 0a 73 75  ed to provide.su
8bb0: 66 66 69 63 69 65 6e 74 20 69 6e 73 69 67 68 74  fficient insight
8bc0: 20 61 6e 64 20 69 6e 66 6f 72 6d 61 74 69 6f 6e   and information
8bd0: 20 6f 6e 20 74 68 65 20 54 4c 53 20 68 61 6e 64   on the TLS hand
8be0: 73 68 61 6b 65 20 61 6e 64 20 70 72 6f 67 72 65  shake and progre
8bf0: 73 73 2e 20 49 66 0a 66 75 72 74 68 65 72 20 74  ss. If.further t
8c00: 72 6f 75 62 6c 65 73 68 6f 6f 74 69 6e 67 20 69  roubleshooting i
8c10: 6e 73 69 67 68 74 20 69 73 20 6e 65 65 64 65 64  nsight is needed
8c20: 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 20 74 69  , the compile ti
8c30: 6d 65 20 6f 70 74 69 6f 6e 0a 5b 6f 70 74 69 6f  me option.[optio
8c40: 6e 20 2d 2d 65 6e 61 62 6c 65 2d 64 65 62 75 67  n --enable-debug
8c50: 5d 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f  ] can be used to
8c60: 20 67 65 74 20 64 65 74 61 69 6c 65 64 20 65 78   get detailed ex
8c70: 65 63 75 74 69 6f 6e 20 66 6c 6f 77 20 73 74 61  ecution flow sta
8c80: 74 75 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 4c  tus...[para]..TL
8c90: 53 20 6b 65 79 20 6c 6f 67 67 69 6e 67 20 63 61  S key logging ca
8ca0: 6e 20 62 65 20 65 6e 61 62 6c 65 64 20 62 79 20  n be enabled by 
8cb0: 73 65 74 74 69 6e 67 20 74 68 65 20 65 6e 76 69  setting the envi
8cc0: 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65  ronment variable
8cd0: 0a 5b 76 61 72 20 53 53 4c 4b 45 59 4c 4f 47 46  .[var SSLKEYLOGF
8ce0: 49 4c 45 5d 20 74 6f 20 74 68 65 20 6e 61 6d 65  ILE] to the name
8cf0: 20 6f 66 20 74 68 65 20 66 69 6c 65 20 74 6f 20   of the file to 
8d00: 6c 6f 67 20 74 6f 2e 20 54 68 65 6e 20 77 68 65  log to. Then whe
8d10: 6e 65 76 65 72 20 54 4c 53 20 6b 65 79 0a 6d 61  never TLS key.ma
8d20: 74 65 72 69 61 6c 20 69 73 20 67 65 6e 65 72 61  terial is genera
8d30: 74 65 64 20 6f 72 20 72 65 63 65 69 76 65 64 20  ted or received 
8d40: 69 74 20 77 69 6c 6c 20 62 65 20 6c 6f 67 67 65  it will be logge
8d50: 64 20 74 6f 20 74 68 65 20 66 69 6c 65 2e 20 54  d to the file. T
8d60: 68 69 73 20 69 73 20 75 73 65 66 75 6c 0a 66 6f  his is useful.fo
8d70: 72 20 6c 6f 67 67 69 6e 67 20 6b 65 79 20 64 61  r logging key da
8d80: 74 61 20 66 6f 72 20 6e 65 74 77 6f 72 6b 20 6c  ta for network l
8d90: 6f 67 67 69 6e 67 20 74 6f 6f 6c 73 20 74 6f 20  ogging tools to 
8da0: 75 73 65 20 74 6f 20 64 65 63 72 79 70 74 20 74  use to decrypt t
8db0: 68 65 20 64 61 74 61 2e 0a 0a 5b 70 61 72 61 5d  he data...[para]
8dc0: 0a 0a 54 68 65 20 5b 76 61 72 20 74 6c 73 3a 3a  ..The [var tls::
8dd0: 64 65 62 75 67 5d 20 76 61 72 69 61 62 6c 65 20  debug] variable 
8de0: 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61 64  provides some ad
8df0: 64 69 74 69 6f 6e 61 6c 20 63 6f 6e 74 72 6f 6c  ditional control
8e00: 20 6f 76 65 72 20 74 68 65 0a 64 65 62 75 67 20   over the.debug 
8e10: 6c 6f 67 67 69 6e 67 20 69 6e 20 74 68 65 20 5b  logging in the [
8e20: 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63  cmd tls::callbac
8e30: 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61  k], [cmd tls::pa
8e40: 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b 63 6d  ssword], and.[cm
8e50: 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f  d tls::validate_
8e60: 63 6f 6d 6d 61 6e 64 5d 20 64 65 66 61 75 6c 74  command] default
8e70: 20 68 61 6e 64 6c 65 72 73 20 69 6e 20 5b 66 69   handlers in [fi
8e80: 6c 65 20 74 6c 73 2e 74 63 6c 5d 2e 0a 54 68 65  le tls.tcl]..The
8e90: 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20 69   default value i
8ea0: 73 20 30 20 77 69 74 68 20 68 69 67 68 65 72 20  s 0 with higher 
8eb0: 76 61 6c 75 65 73 20 70 72 6f 64 75 63 69 6e 67  values producing
8ec0: 20 6d 6f 72 65 20 64 69 61 67 6e 6f 73 74 69 63   more diagnostic
8ed0: 20 6f 75 74 70 75 74 2c 0a 61 6e 64 20 77 69 6c   output,.and wil
8ee0: 6c 20 61 6c 73 6f 20 66 6f 72 63 65 20 74 68 65  l also force the
8ef0: 20 76 65 72 69 66 79 20 6d 65 74 68 6f 64 20 69   verify method i
8f00: 6e 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c  n [cmd tls::call
8f10: 62 61 63 6b 5d 20 74 6f 20 61 63 63 65 70 74 20  back] to accept 
8f20: 74 68 65 0a 63 65 72 74 69 66 69 63 61 74 65 2c  the.certificate,
8f30: 20 65 76 65 6e 20 69 66 20 69 74 20 69 73 20 69   even if it is i
8f40: 6e 76 61 6c 69 64 20 77 68 65 6e 20 74 68 65 20  nvalid when the 
8f50: 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74  [option -validat
8f60: 65 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e  ecommand].option
8f70: 20 69 73 20 73 65 74 20 74 6f 20 5b 63 6d 64 20   is set to [cmd 
8f80: 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f  tls::validate_co
8f90: 6d 6d 61 6e 64 5d 2e 0a 0a 5b 70 61 72 61 5d 0a  mmand]...[para].
8fa0: 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65 20  .[emph "The use 
8fb0: 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20  of the variable 
8fc0: 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62 75 67 5d  [var tls::debug]
8fd0: 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e   is not recommen
8fe0: 64 65 64 2e 0a 49 74 20 6d 61 79 20 62 65 20 72  ded..It may be r
8ff0: 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75 74 75  emoved from futu
9000: 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a 0a  re releases."]..
9010: 5b 73 65 63 74 69 6f 6e 20 22 45 78 61 6d 70 6c  [section "Exampl
9020: 65 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77  es"]..The follow
9030: 69 6e 67 20 61 72 65 20 65 78 61 6d 70 6c 65 20  ing are example 
9040: 73 63 72 69 70 74 73 20 74 6f 20 64 6f 77 6e 6c  scripts to downl
9050: 6f 61 64 20 61 20 77 65 62 70 61 67 65 20 61 6e  oad a webpage an
9060: 64 20 66 69 6c 65 20 75 73 69 6e 67 20 74 68 65  d file using the
9070: 0a 68 74 74 70 20 70 61 63 6b 61 67 65 2e 20 53  .http package. S
9080: 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65 72  ee [sectref "Cer
9090: 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74  tificate Validat
90a0: 69 6f 6e 22 5d 20 66 6f 72 20 77 68 65 6e 20 74  ion"] for when t
90b0: 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  he.[option -cadi
90c0: 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66  r], [option -caf
90d0: 69 6c 65 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f  ile], and [optio
90e0: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69  n -castore] opti
90f0: 6f 6e 73 20 61 72 65 20 61 6c 73 6f 0a 6e 65 65  ons are also.nee
9100: 64 65 64 2e 20 53 65 65 20 74 68 65 20 5b 66 69  ded. See the [fi
9110: 6c 65 20 64 65 6d 6f 73 5d 20 64 69 72 65 63 74  le demos] direct
9120: 6f 72 79 20 66 6f 72 20 6d 6f 72 65 20 65 78 61  ory for more exa
9130: 6d 70 6c 65 20 73 63 72 69 70 74 73 2e 0a 0a 5b  mple scripts...[
9140: 70 61 72 61 5d 0a 0a 45 78 61 6d 70 6c 65 20 23  para]..Example #
9150: 31 3a 20 44 6f 77 6e 6c 6f 61 64 20 61 20 77 65  1: Download a we
9160: 62 20 70 61 67 65 0a 0a 5b 65 78 61 6d 70 6c 65  b page..[example
9170: 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75   {..package requ
9180: 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67 65  ire http.package
9190: 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 73 65   require tls..se
91a0: 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f 2f 77  t url "https://w
91b0: 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a 68 74 74 70  ww.tcl.tk/".http
91c0: 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74 70 73  ::register https
91d0: 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c 73   443 [list ::tls
91e0: 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73 65  ::socket -autose
91f0: 72 76 65 72 6e 61 6d 65 20 31 20 2d 72 65 71 75  rvername 1 -requ
9200: 69 72 65 20 31 5d 0a 0a 23 20 47 65 74 20 55 52  ire 1]..# Get UR
9210: 4c 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 68 74 74  L.set token [htt
9220: 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c 5d 0a  p::geturl $url].
9230: 0a 23 20 43 68 65 63 6b 20 66 6f 72 20 65 72 72  .# Check for err
9240: 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a 3a 73 74  or.if {[http::st
9250: 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e 65 20  atus $token] ne 
9260: 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75 74 73  "ok"} {.    puts
9270: 20 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f 72 20   [format "Error 
9280: 25 73 22 20 5b 68 74 74 70 3a 3a 73 74 61 74 75  %s" [http::statu
9290: 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23 20  s $token]].}..# 
92a0: 53 61 76 65 20 77 65 62 20 70 61 67 65 20 74 6f  Save web page to
92b0: 20 66 69 6c 65 0a 73 65 74 20 63 68 20 5b 6f 70   file.set ch [op
92c0: 65 6e 20 65 78 61 6d 70 6c 65 2e 68 74 6d 6c 20  en example.html 
92d0: 77 62 5d 0a 70 75 74 73 20 24 63 68 20 5b 68 74  wb].puts $ch [ht
92e0: 74 70 3a 3a 64 61 74 61 20 24 74 6f 6b 65 6e 5d  tp::data $token]
92f0: 0a 63 6c 6f 73 65 20 24 63 68 0a 0a 23 20 43 6c  .close $ch..# Cl
9300: 65 61 6e 75 70 0a 3a 3a 68 74 74 70 3a 3a 63 6c  eanup.::http::cl
9310: 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a  eanup $token.}].
9320: 0a 45 78 61 6d 70 6c 65 20 23 32 3a 20 44 6f 77  .Example #2: Dow
9330: 6e 6c 6f 61 64 20 61 20 66 69 6c 65 0a 0a 5b 65  nload a file..[e
9340: 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b 61 67  xample {..packag
9350: 65 20 72 65 71 75 69 72 65 20 68 74 74 70 0a 70  e require http.p
9360: 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 74  ackage require t
9370: 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 68 74 74  ls..set url "htt
9380: 70 73 3a 2f 2f 77 69 6b 69 2e 74 63 6c 2d 6c 61  ps://wiki.tcl-la
9390: 6e 67 2e 6f 72 67 2f 73 69 74 65 6d 61 70 2e 78  ng.org/sitemap.x
93a0: 6d 6c 22 0a 68 74 74 70 3a 3a 72 65 67 69 73 74  ml".http::regist
93b0: 65 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c 69  er https 443 [li
93c0: 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74  st ::tls::socket
93d0: 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d 65   -autoservername
93e0: 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d 0a 0a   1 -require 1]..
93f0: 23 20 4f 70 65 6e 20 6f 75 74 70 75 74 20 66 69  # Open output fi
9400: 6c 65 0a 73 65 74 20 66 69 6c 65 6e 61 6d 65 20  le.set filename 
9410: 5b 66 69 6c 65 20 74 61 69 6c 20 24 75 72 6c 5d  [file tail $url]
9420: 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20 24 66  .set ch [open $f
9430: 69 6c 65 6e 61 6d 65 20 77 62 5d 0a 0a 23 20 47  ilename wb]..# G
9440: 65 74 20 66 69 6c 65 0a 73 65 74 20 74 6f 6b 65  et file.set toke
9450: 6e 20 5b 3a 3a 68 74 74 70 3a 3a 67 65 74 75 72  n [::http::getur
9460: 6c 20 24 75 72 6c 20 2d 62 6c 6f 63 6b 73 69 7a  l $url -blocksiz
9470: 65 20 36 35 35 33 36 20 2d 63 68 61 6e 6e 65 6c  e 65536 -channel
9480: 20 24 63 68 5d 0a 0a 23 20 43 68 65 63 6b 20 66   $ch]..# Check f
9490: 6f 72 20 65 72 72 6f 72 0a 69 66 20 7b 5b 68 74  or error.if {[ht
94a0: 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65  tp::status $toke
94b0: 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20 20  n] ne "ok"} {.  
94c0: 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 74 20 22    puts [format "
94d0: 45 72 72 6f 72 20 25 73 22 20 5b 68 74 74 70 3a  Error %s" [http:
94e0: 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 5d  :status $token]]
94f0: 0a 7d 0a 0a 23 20 43 6c 65 61 6e 75 70 0a 63 6c  .}..# Cleanup.cl
9500: 6f 73 65 20 24 63 68 0a 3a 3a 68 74 74 70 3a 3a  ose $ch.::http::
9510: 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d  cleanup $token.}
9520: 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 53 70 65  ]..[section "Spe
9530: 63 69 61 6c 20 43 6f 6e 73 69 64 65 72 61 74 69  cial Considerati
9540: 6f 6e 73 22 5d 0a 0a 54 68 65 20 63 61 70 61 62  ons"]..The capab
9550: 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69 73 20  ilities of this 
9560: 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61 72 79  package can vary
9570: 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61 73 65   enormously base
9580: 64 20 75 70 6f 6e 20 68 6f 77 20 74 68 65 0a 6c  d upon how the.l
9590: 69 6e 6b 65 64 20 74 6f 20 4f 70 65 6e 53 53 4c  inked to OpenSSL
95a0: 20 6c 69 62 72 61 72 79 20 77 61 73 20 63 6f 6e   library was con
95b0: 66 69 67 75 72 65 64 20 61 6e 64 20 62 75 69 6c  figured and buil
95c0: 74 2e 20 4e 65 77 20 76 65 72 73 69 6f 6e 73 20  t. New versions 
95d0: 6d 61 79 20 6f 62 73 6f 6c 65 74 65 0a 6f 6c 64  may obsolete.old
95e0: 65 72 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73  er protocol vers
95f0: 69 6f 6e 73 2c 20 61 64 64 20 6f 72 20 72 65 6d  ions, add or rem
9600: 6f 76 65 20 63 69 70 68 65 72 73 2c 20 63 68 61  ove ciphers, cha
9610: 6e 67 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75  nge default valu
9620: 65 73 2c 20 65 74 63 2e 0a 55 73 65 20 74 68 65  es, etc..Use the
9630: 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f   [cmd tls::proto
9640: 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 74 6f  cols] command to
9650: 20 6f 62 74 61 69 6e 20 74 68 65 20 73 75 70 70   obtain the supp
9660: 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f 6c 20 76  orted.protocol v
9670: 65 72 73 69 6f 6e 73 2e 0a 0a 5b 73 65 63 74 69  ersions...[secti
9680: 6f 6e 20 22 45 72 72 6f 72 20 4d 65 73 73 61 67  on "Error Messag
9690: 65 73 22 5d 0a 0a 53 6f 6d 65 20 4f 70 73 6e 53  es"]..Some OpsnS
96a0: 53 6c 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65  Sl error message
96b0: 73 20 68 61 76 65 20 63 72 79 70 74 69 63 20 6d  s have cryptic m
96c0: 65 61 6e 69 6e 67 73 2e 20 54 68 69 73 20 69 73  eanings. This is
96d0: 20 61 20 6c 69 73 74 20 6f 66 20 6d 65 73 73 61   a list of messa
96e0: 67 65 73 0a 61 6c 6f 6e 67 20 77 69 74 68 20 74  ges.along with t
96f0: 68 65 69 72 20 74 72 75 65 20 6d 65 61 6e 69 6e  heir true meanin
9700: 67 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  g...[list_begin 
9710: 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64  definitions]..[d
9720: 65 66 20 5b 61 72 67 20 22 68 61 6e 64 73 68 61  ef [arg "handsha
9730: 6b 65 20 66 61 69 6c 65 64 3a 20 63 65 72 74 69  ke failed: certi
9740: 66 69 63 61 74 65 20 76 65 72 69 66 79 20 66 61  ficate verify fa
9750: 69 6c 65 64 20 64 75 65 20 74 6f 20 5c 22 75 6e  iled due to \"un
9760: 61 62 6c 65 20 74 6f 20 67 65 74 20 6c 6f 63 61  able to get loca
9770: 6c 20 69 73 73 75 65 72 20 63 65 72 74 69 66 69  l issuer certifi
9780: 63 61 74 65 5c 22 22 5d 5d 0a 54 68 65 20 63 65  cate\""]].The ce
9790: 72 74 69 66 69 63 61 74 65 73 20 69 6e 20 74 68  rtificates in th
97a0: 65 20 43 41 20 66 69 6c 65 20 6f 72 20 63 65 72  e CA file or cer
97b0: 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 20 65  tificate store e
97c0: 69 74 68 65 72 20 64 6f 20 6e 6f 74 20 68 61 76  ither do not hav
97d0: 65 20 6f 6e 65 20 6f 72 0a 6d 6f 72 65 20 69 73  e one or.more is
97e0: 73 75 65 72 73 20 6f 66 20 74 68 65 20 63 65 72  suers of the cer
97f0: 74 69 66 69 63 61 74 65 73 20 79 6f 75 20 61 72  tificates you ar
9800: 65 20 76 61 6c 69 64 61 74 69 6e 67 20 6f 72 20  e validating or 
9810: 74 68 65 79 20 68 61 76 65 20 65 78 70 69 72 65  they have expire
9820: 64 2e 0a 55 73 75 61 6c 6c 79 20 74 68 69 73 20  d..Usually this 
9830: 6d 65 61 6e 73 20 79 6f 75 20 6e 65 65 64 20 61  means you need a
9840: 6e 20 75 70 64 61 74 65 64 20 43 41 63 65 72 74  n updated CAcert
9850: 20 66 69 6c 65 2e 0a 0a 5b 64 65 66 20 5b 61 72   file...[def [ar
9860: 67 20 22 70 61 63 6b 65 74 20 6c 65 6e 67 74 68  g "packet length
9870: 20 74 6f 6f 20 6c 6f 6e 67 22 5d 5d 0a 43 6c 69   too long"]].Cli
9880: 65 6e 74 20 68 61 73 20 74 72 69 65 64 20 74 6f  ent has tried to
9890: 20 63 6f 6e 6e 65 63 74 20 74 6f 20 61 20 48 54   connect to a HT
98a0: 54 50 20 73 65 72 76 65 72 20 6f 6e 20 74 68 65  TP server on the
98b0: 20 70 6c 61 69 6e 2d 74 65 78 74 20 70 6f 72 74   plain-text port
98c0: 20 69 6e 73 74 65 61 64 20 6f 66 0a 74 68 65 20   instead of.the 
98d0: 53 53 4c 2f 54 4c 53 20 70 6f 72 74 2e 0a 0a 5b  SSL/TLS port...[
98e0: 64 65 66 20 5b 61 72 67 20 22 75 6e 65 78 70 65  def [arg "unexpe
98f0: 63 74 65 64 20 65 6f 66 20 77 68 69 6c 65 20 72  cted eof while r
9900: 65 61 64 69 6e 67 22 5d 5d 0a 54 68 65 20 70 65  eading"]].The pe
9910: 65 72 20 68 61 73 20 63 6c 6f 73 65 64 20 74 68  er has closed th
9920: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 77 69 74  e connection wit
9930: 68 6f 75 74 20 73 65 6e 64 69 6e 67 20 74 68 65  hout sending the
9940: 20 22 63 6c 6f 73 65 20 6e 6f 74 69 66 79 22 20   "close notify" 
9950: 73 68 75 74 64 6f 77 6e 0a 61 6c 65 72 74 2e 20  shutdown.alert. 
9960: 53 6f 6d 65 20 73 65 72 76 65 72 73 20 77 69 6c  Some servers wil
9970: 6c 20 74 65 72 6d 69 6e 61 74 65 20 74 68 65 20  l terminate the 
9980: 63 6f 6e 6e 65 63 74 69 6f 6e 20 61 66 74 65 72  connection after
9990: 20 74 68 65 20 66 69 6c 65 20 6f 72 20 77 65 62   the file or web
99a0: 70 61 67 65 20 68 61 73 0a 62 65 65 6e 20 73 65  page has.been se
99b0: 6e 74 20 77 69 74 68 6f 75 74 20 73 65 6e 64 69  nt without sendi
99c0: 6e 67 20 74 68 65 20 22 63 6c 6f 73 65 20 6e 6f  ng the "close no
99d0: 74 69 66 79 22 20 6d 65 73 73 61 67 65 2e 20 49  tify" message. I
99e0: 6e 20 74 68 69 73 20 63 61 73 65 2c 20 69 74 20  n this case, it 
99f0: 73 68 6f 75 6c 64 0a 6e 6f 74 20 72 65 73 75 6c  should.not resul
9a00: 74 20 69 6e 20 61 20 6c 6f 73 73 20 6f 66 20 64  t in a loss of d
9a10: 61 74 61 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20  ata...[def [arg 
9a20: 22 77 72 6f 6e 67 20 76 65 72 73 69 6f 6e 20 6e  "wrong version n
9a30: 75 6d 62 65 72 22 5d 5d 0a 43 6c 69 65 6e 74 20  umber"]].Client 
9a40: 68 61 73 20 74 72 69 65 64 20 74 6f 20 63 6f 6e  has tried to con
9a50: 6e 65 63 74 20 74 6f 20 61 20 6e 6f 6e 2d 48 54  nect to a non-HT
9a60: 54 50 20 73 65 72 76 65 72 20 6f 6e 20 61 20 6e  TP server on a n
9a70: 6f 6e 2d 54 4c 53 20 28 69 2e 65 2e 20 70 6c 61  on-TLS (i.e. pla
9a80: 69 6e 20 74 65 78 74 29 20 70 6f 72 74 2e 0a 0a  in text) port...
9a90: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6d 61 6e  [list_end]..[man
9aa0: 70 61 67 65 5f 65 6e 64 5d 0a                    page_end].