Hex Artifact Content

Artifact 6dfc0dcf342c52c1b28ddf3a37b66bce58f30852f8c01b3fab5e19d7e44aeff2:


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