Hex Artifact Content

Artifact 37ce4f22b405e6cfc8e911d8b50adf0c4277f3350aeea923549672ee7046ee15:


0000: 5b 63 6f 6d 6d 65 6e 74 20 7b 2d 2a 2d 20 74 63  [comment {-*- tc
0010: 6c 20 2d 2a 2d 20 64 6f 63 74 6f 6f 6c 73 20 6d  l -*- doctools m
0020: 61 6e 70 61 67 65 7d 5d 0a 5b 63 6f 6d 6d 65 6e  anpage}].[commen
0030: 74 20 7b 54 6f 20 63 6f 6e 76 65 72 74 20 74 68  t {To convert th
0040: 69 73 20 74 6f 20 61 6e 6f 74 68 65 72 20 64 6f  is to another do
0050: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 6d  cumentation form
0060: 61 74 20 75 73 65 20 74 68 65 20 64 74 70 6c 69  at use the dtpli
0070: 74 65 0a 20 20 20 20 20 20 20 20 20 20 73 63 72  te.          scr
0080: 69 70 74 20 66 72 6f 6d 20 74 63 6c 6c 69 62 3a  ipt from tcllib:
0090: 20 64 74 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e   dtplite -o tls.
00a0: 6e 20 6e 72 6f 66 66 20 74 6c 73 2e 6d 61 6e 0a  n nroff tls.man.
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 74                dt
00d0: 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e 68 74 6d  plite -o tls.htm
00e0: 6c 20 68 74 6d 6c 20 74 6c 73 2e 6d 61 6e 0a 7d  l html tls.man.}
00f0: 5d 0a 5b 6d 61 6e 70 61 67 65 5f 62 65 67 69 6e  ].[manpage_begin
0100: 20 74 6c 73 20 6e 20 32 2e 30 62 31 5d 0a 5b 63   tls n 2.0b1].[c
0110: 61 74 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f  ategory tls].[co
0120: 70 79 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61  pyright {1999 Ma
0130: 74 74 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70  tt Newman}].[cop
0140: 79 72 69 67 68 74 20 7b 32 30 30 34 20 53 74 61  yright {2004 Sta
0150: 72 66 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a  rfish Systems}].
0160: 5b 63 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34  [copyright {2024
0170: 20 42 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d   Brian O'Hagan}]
0180: 0a 5b 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49  .[keywords tls I
0190: 2f 4f 20 22 49 50 20 41 64 64 72 65 73 73 22 20  /O "IP Address" 
01a0: 4f 70 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20  OpenSSL SSL TCP 
01b0: 54 4c 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75  TLS "asynchronou
01c0: 73 20 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74  s I/O" bind cert
01d0: 69 66 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20  ificate channel 
01e0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61  connection "doma
01f0: 69 6e 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68  in name" host "h
0200: 74 74 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61  ttps" "network a
0210: 64 64 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20  ddress" network 
0220: 73 6f 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b  socket TclTLS].[
0230: 6d 6f 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53  moddesc {Tcl TLS
0240: 20 65 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65   extension}].[se
0250: 65 5f 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b  e_also http sock
0260: 65 74 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f  et [uri https://
0270: 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f  www.openssl.org/
0280: 20 4f 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c   OpenSSL]].[titl
0290: 65 64 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74  edesc {binding t
02a0: 6f 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69  o the OpenSSL li
02b0: 62 72 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70  brary for encryp
02c0: 74 65 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49  ted socket and I
02d0: 2f 4f 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75  /O channel commu
02e0: 6e 69 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71  nications}].[req
02f0: 75 69 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b  uire Tcl 8.5-].[
0300: 72 65 71 75 69 72 65 20 74 6c 73 20 32 2e 30 62  require tls 2.0b
0310: 31 5d 0a 5b 64 65 73 63 72 69 70 74 69 6f 6e 5d  1].[description]
0320: 0a 0a 54 68 69 73 20 65 78 74 65 6e 73 69 6f 6e  ..This extension
0330: 20 70 72 6f 76 69 64 65 73 20 54 43 4c 20 73 63   provides TCL sc
0340: 72 69 70 74 20 61 63 63 65 73 73 20 74 6f 20 73  ript access to s
0350: 65 63 75 72 65 20 73 6f 63 6b 65 74 20 63 6f 6d  ecure socket com
0360: 6d 75 6e 69 63 61 74 69 6f 6e 73 0a 75 73 69 6e  munications.usin
0370: 67 20 74 68 65 20 54 72 61 6e 73 70 6f 72 74 20  g the Transport 
0380: 4c 61 79 65 72 20 53 65 63 75 72 69 74 79 20 28  Layer Security (
0390: 54 4c 53 29 20 70 72 6f 74 6f 63 6f 6c 2e 20 49  TLS) protocol. I
03a0: 74 20 70 72 6f 76 69 64 65 73 20 61 20 67 65 6e  t provides a gen
03b0: 65 72 69 63 0a 62 69 6e 64 69 6e 67 20 74 6f 20  eric.binding to 
03c0: 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 77 77  [uri "https://ww
03d0: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 20  w.openssl.org/" 
03e0: 4f 70 65 6e 53 53 4c 5d 2c 20 75 74 69 6c 69 7a  OpenSSL], utiliz
03f0: 69 6e 67 20 74 68 65 0a 5b 73 79 73 63 6d 64 20  ing the.[syscmd 
0400: 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e 65 6c  Tcl_StackChannel
0410: 5d 20 41 50 49 20 69 6e 20 54 43 4c 20 38 2e 34  ] API in TCL 8.4
0420: 20 61 6e 64 20 68 69 67 68 65 72 2e 0a 54 68 65   and higher..The
0430: 73 65 20 73 6f 63 6b 65 74 73 20 62 65 68 61 76  se sockets behav
0440: 65 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 61  e exactly the sa
0450: 6d 65 20 61 73 20 63 68 61 6e 6e 65 6c 73 20 63  me as channels c
0460: 72 65 61 74 65 64 20 75 73 69 6e 67 20 74 68 65  reated using the
0470: 20 62 75 69 6c 74 2d 69 6e 0a 5b 73 79 73 63 6d   built-in.[syscm
0480: 64 20 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e  d socket] comman
0490: 64 2c 20 62 75 74 20 70 72 6f 76 69 64 65 20 61  d, but provide a
04a0: 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e  dditional option
04b0: 73 20 66 6f 72 20 63 6f 6e 74 72 6f 6c 6c 69 6e  s for controllin
04c0: 67 0a 74 68 65 20 53 53 4c 2f 54 4c 53 20 73 65  g.the SSL/TLS se
04d0: 73 73 69 6f 6e 2e 0a 0a 5b 73 65 63 74 69 6f 6e  ssion...[section
04e0: 20 43 6f 6d 70 61 74 69 62 69 6c 69 74 79 5d 0a   Compatibility].
04f0: 54 68 69 73 20 65 78 74 65 6e 73 69 6f 6e 20 69  This extension i
0500: 73 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74  s compatible wit
0510: 68 20 4f 70 65 6e 53 53 4c 20 31 2e 31 2e 31 20  h OpenSSL 1.1.1 
0520: 6f 72 20 6c 61 74 65 72 2e 20 49 74 20 72 65 71  or later. It req
0530: 75 69 72 65 73 20 54 63 6c 0a 76 65 72 73 69 6f  uires Tcl.versio
0540: 6e 20 38 2e 35 20 6f 72 20 6c 61 74 65 72 20 61  n 8.5 or later a
0550: 6e 64 20 77 69 6c 6c 20 77 6f 72 6b 20 77 69 74  nd will work wit
0560: 68 20 54 63 6c 20 39 2e 30 2e 0a 0a 5b 73 65 63  h Tcl 9.0...[sec
0570: 74 69 6f 6e 20 43 6f 6d 6d 61 6e 64 73 5d 0a 0a  tion Commands]..
0580: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 72  The following ar
0590: 65 20 74 68 65 20 63 6f 6d 6d 61 6e 64 73 20 70  e the commands p
05a0: 72 6f 76 69 64 65 64 20 62 79 20 74 68 65 20 54  rovided by the T
05b0: 63 4c 54 4c 53 20 70 61 63 6b 61 67 65 2e 20 53  cLTLS package. S
05c0: 65 65 20 74 68 65 0a 5b 73 65 63 74 72 65 66 20  ee the.[sectref 
05d0: 45 78 61 6d 70 6c 65 73 5d 20 66 6f 72 20 65 78  Examples] for ex
05e0: 61 6d 70 6c 65 20 75 73 61 67 65 20 61 6e 64 20  ample usage and 
05f0: 74 68 65 20 5b 66 69 6c 65 20 64 65 6d 6f 73 5d  the [file demos]
0600: 20 64 69 72 65 63 74 6f 72 79 20 66 6f 72 0a 6d   directory for.m
0610: 6f 72 65 20 65 78 61 6d 70 6c 65 20 75 73 61 67  ore example usag
0620: 65 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  e...[list_begin 
0630: 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 63  definitions]..[c
0640: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6e  all [cmd tls::in
0650: 69 74 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f  it] [opt [arg -o
0660: 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72  ption]] [opt [ar
0670: 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b  g value]] [opt [
0680: 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c  arg "-option val
0690: 75 65 20 2e 2e 2e 22 5d 5d 5d 0a 0a 4f 70 74 69  ue ..."]]]..Opti
06a0: 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 20 74 6f  onal function to
06b0: 20 73 65 74 20 74 68 65 20 64 65 66 61 75 6c 74   set the default
06c0: 20 6f 70 74 69 6f 6e 73 20 75 73 65 64 20 62 79   options used by
06d0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65   [cmd tls::socke
06e0: 74 5d 2e 20 49 66 20 79 6f 75 0a 63 61 6c 6c 20  t]. If you.call 
06f0: 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74  [cmd tls::import
0700: 5d 20 64 69 72 65 63 74 6c 79 2c 20 74 68 65 20  ] directly, the 
0710: 76 61 6c 75 65 73 20 73 65 74 20 62 79 20 74 68  values set by th
0720: 69 73 20 63 6f 6d 6d 61 6e 64 20 68 61 76 65 20  is command have 
0730: 6e 6f 20 65 66 66 65 63 74 2e 0a 54 68 69 73 20  no effect..This 
0740: 63 6f 6d 6d 61 6e 64 20 73 75 70 70 6f 72 74 73  command supports
0750: 20 61 6c 6c 20 6f 66 20 74 68 65 20 73 61 6d 65   all of the same
0760: 20 6f 70 74 69 6f 6e 73 20 61 73 20 74 68 65 20   options as the 
0770: 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74  [cmd tls::socket
0780: 5d 20 63 6f 6d 6d 61 6e 64 2c 0a 74 68 6f 75 67  ] command,.thoug
0790: 68 20 79 6f 75 20 73 68 6f 75 6c 64 20 6c 69 6d  h you should lim
07a0: 69 74 20 79 6f 75 72 20 6f 70 74 69 6f 6e 73 20  it your options 
07b0: 74 6f 20 6f 6e 6c 79 20 54 4c 53 20 72 65 6c 61  to only TLS rela
07c0: 74 65 64 20 6f 6e 65 73 2e 0a 0a 5b 63 61 6c 6c  ted ones...[call
07d0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65   [cmd tls::socke
07e0: 74 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70  t] [opt [arg -op
07f0: 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67  tion]] [opt [arg
0800: 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61   value]] [opt [a
0810: 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75  rg "-option valu
0820: 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 68 6f  e ..."]] [arg ho
0830: 73 74 5d 20 5b 61 72 67 20 70 6f 72 74 5d 5d 0a  st] [arg port]].
0840: 0a 54 68 69 73 20 69 73 20 61 20 68 65 6c 70 65  .This is a helpe
0850: 72 20 66 75 6e 63 74 69 6f 6e 20 74 68 61 74 20  r function that 
0860: 75 74 69 6c 69 7a 65 73 20 74 68 65 20 75 6e 64  utilizes the und
0870: 65 72 6c 79 69 6e 67 20 63 6f 6d 6d 61 6e 64 73  erlying commands
0880: 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65 74 5d   [syscmd socket]
0890: 0a 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 69  .and [cmd tls::i
08a0: 6d 70 6f 72 74 5d 20 74 6f 20 63 72 65 61 74 65  mport] to create
08b0: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e   the connection.
08c0: 20 49 74 20 62 65 68 61 76 65 73 20 74 68 65 20   It behaves the 
08d0: 73 61 6d 65 20 61 73 20 74 68 65 0a 6e 61 74 69  same as the.nati
08e0: 76 65 20 54 43 4c 20 5b 73 79 73 63 6d 64 20 73  ve TCL [syscmd s
08f0: 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20  ocket] command, 
0900: 62 75 74 20 61 6c 73 6f 20 73 75 70 70 6f 72 74  but also support
0910: 73 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 69  s the [cmd tls:i
0920: 6d 70 6f 72 74 5d 0a 63 6f 6d 6d 61 6e 64 20 6f  mport].command o
0930: 70 74 69 6f 6e 73 20 77 69 74 68 20 6f 6e 65 20  ptions with one 
0940: 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f  additional optio
0950: 6e 2e 20 49 74 20 72 65 74 75 72 6e 73 20 74 68  n. It returns th
0960: 65 20 63 68 61 6e 6e 65 6c 20 68 61 6e 64 6c 65  e channel handle
0970: 20 69 64 0a 66 6f 72 20 74 68 65 20 6e 65 77 20   id.for the new 
0980: 73 6f 63 6b 65 74 2e 0a 0a 5b 6c 69 73 74 5f 62  socket...[list_b
0990: 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b  egin options]..[
09a0: 6f 70 74 5f 64 65 66 20 2d 61 75 74 6f 73 65 72  opt_def -autoser
09b0: 76 65 72 6e 61 6d 65 20 5b 61 72 67 20 62 6f 6f  vername [arg boo
09c0: 6c 5d 5d 0a 49 66 20 5b 63 6f 6e 73 74 20 74 72  l]].If [const tr
09d0: 75 65 5d 2c 20 61 75 74 6f 6d 61 74 69 63 61 6c  ue], automatical
09e0: 6c 79 20 73 65 74 20 74 68 65 20 5b 6f 70 74 69  ly set the [opti
09f0: 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65 5d 20  on -servername] 
0a00: 61 72 67 75 6d 65 6e 74 20 74 6f 20 74 68 65 0a  argument to the.
0a10: 5b 65 6d 70 68 20 68 6f 73 74 5d 20 61 72 67 75  [emph host] argu
0a20: 6d 65 6e 74 2e 20 50 72 69 6f 72 20 74 6f 20 54  ment. Prior to T
0a30: 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65 20 64  clTLS 2.0, the d
0a40: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74  efault is [const
0a50: 20 66 61 6c 73 65 5d 2e 0a 53 74 61 72 74 69 6e   false]..Startin
0a60: 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c  g in TclTLS 2.0,
0a70: 20 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   the default is 
0a80: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20 75 6e 6c  [const true] unl
0a90: 65 73 73 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72  ess [option -ser
0aa0: 76 65 72 6e 61 6d 65 5d 0a 69 73 20 61 6c 73 6f  vername].is also
0ab0: 20 73 70 65 63 69 66 69 65 64 2e 0a 0a 5b 6c 69   specified...[li
0ac0: 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b  st_end]..[call [
0ad0: 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d  cmd tls::socket]
0ae0: 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72 76 65 72   [option -server
0af0: 5d 20 5b 61 72 67 20 63 6f 6d 6d 61 6e 64 5d 20  ] [arg command] 
0b00: 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f  [opt [arg -optio
0b10: 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61  n]] [opt [arg va
0b20: 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  lue]] [opt [arg 
0b30: 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e  "-option value .
0b40: 2e 2e 22 5d 5d 20 5b 61 72 67 20 70 6f 72 74 5d  .."]] [arg port]
0b50: 5d 0a 0a 53 61 6d 65 20 61 73 20 70 72 65 76 69  ]..Same as previ
0b60: 6f 75 73 2c 20 62 75 74 20 69 6e 73 74 65 61 64  ous, but instead
0b70: 20 63 72 65 61 74 65 73 20 61 20 73 65 72 76 65   creates a serve
0b80: 72 20 73 6f 63 6b 65 74 20 66 6f 72 20 63 6c 69  r socket for cli
0b90: 65 6e 74 73 20 74 6f 20 63 6f 6e 6e 65 63 74 20  ents to connect 
0ba0: 74 6f 0a 6a 75 73 74 20 6c 69 6b 65 20 74 68 65  to.just like the
0bb0: 20 54 63 6c 20 5b 73 79 73 63 6d 64 20 22 73 6f   Tcl [syscmd "so
0bc0: 63 6b 65 74 20 2d 73 65 72 76 65 72 22 5d 20 63  cket -server"] c
0bd0: 6f 6d 6d 61 6e 64 2e 20 49 74 20 72 65 74 75 72  ommand. It retur
0be0: 6e 73 20 74 68 65 20 63 68 61 6e 6e 65 6c 0a 68  ns the channel.h
0bf0: 61 6e 64 6c 65 20 69 64 20 66 6f 72 20 74 68 65  andle id for the
0c00: 20 6e 65 77 20 73 6f 63 6b 65 74 2e 0a 0a 5b 63   new socket...[c
0c10: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d  all [cmd tls::im
0c20: 70 6f 72 74 5d 20 5b 61 72 67 20 63 68 61 6e 6e  port] [arg chann
0c30: 65 6c 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f  el] [opt [arg -o
0c40: 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72  ption]] [opt [ar
0c50: 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b  g value]] [opt [
0c60: 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c  arg "-option val
0c70: 75 65 20 2e 2e 2e 22 5d 5d 5d 0a 0a 53 74 61 72  ue ..."]]]..Star
0c80: 74 20 54 4c 53 20 65 6e 63 72 79 70 74 69 6f 6e  t TLS encryption
0c90: 20 6f 6e 20 54 43 4c 20 63 68 61 6e 6e 65 6c 20   on TCL channel 
0ca0: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20 76 69  [arg channel] vi
0cb0: 61 20 61 20 73 74 61 63 6b 65 64 20 63 68 61 6e  a a stacked chan
0cc0: 6e 65 6c 2e 20 49 74 0a 6e 65 65 64 20 6e 6f 74  nel. It.need not
0cd0: 20 62 65 20 61 20 73 6f 63 6b 65 74 2c 20 62 75   be a socket, bu
0ce0: 74 20 6d 75 73 74 20 70 72 6f 76 69 64 65 20 62  t must provide b
0cf0: 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c 20 66 6c  i-directional fl
0d00: 6f 77 2e 20 41 6c 73 6f 20 73 65 74 73 20 73 65  ow. Also sets se
0d10: 73 73 69 6f 6e 0a 70 61 72 61 6d 65 74 65 72 73  ssion.parameters
0d20: 20 66 6f 72 20 53 53 4c 20 68 61 6e 64 73 68 61   for SSL handsha
0d30: 6b 65 2e 20 56 61 6c 69 64 20 6f 70 74 69 6f 6e  ke. Valid option
0d40: 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65  s are:..[list_be
0d50: 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f  gin options]..[o
0d60: 70 74 5f 64 65 66 20 2d 61 6c 70 6e 20 5b 61 72  pt_def -alpn [ar
0d70: 67 20 6c 69 73 74 5d 5d 0a 4c 69 73 74 20 6f 66  g list]].List of
0d80: 20 70 72 6f 74 6f 63 6f 6c 73 20 74 6f 20 6f 66   protocols to of
0d90: 66 65 72 20 64 75 72 69 6e 67 20 41 70 70 6c 69  fer during Appli
0da0: 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f  cation-Layer Pro
0db0: 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f  tocol Negotiatio
0dc0: 6e 0a 28 41 4c 50 4e 29 2e 20 46 6f 72 20 65 78  n.(ALPN). For ex
0dd0: 61 6d 70 6c 65 3a 20 5b 63 6f 6e 73 74 20 68 32  ample: [const h2
0de0: 5d 20 61 6e 64 20 5b 63 6f 6e 73 74 20 68 74 74  ] and [const htt
0df0: 70 2f 31 2e 31 5d 2c 20 62 75 74 20 6e 6f 74 20  p/1.1], but not 
0e00: 5b 63 6f 6e 73 74 20 68 33 5d 20 6f 72 0a 5b 63  [const h3] or.[c
0e10: 6f 6e 73 74 20 71 75 69 63 5d 2e 20 54 68 69 73  onst quic]. This
0e20: 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77 20 66   option is new f
0e30: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
0e40: 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64 69 72 20  [opt_def -cadir 
0e50: 5b 61 72 67 20 64 69 72 65 63 74 6f 72 79 5d 5d  [arg directory]]
0e60: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 64  .Specifies the d
0e70: 69 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74  irectory where t
0e80: 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41  he Certificate A
0e90: 75 74 68 6f 72 69 74 79 20 28 43 41 29 20 63 65  uthority (CA) ce
0ea0: 72 74 69 66 69 63 61 74 65 73 20 61 72 65 0a 73  rtificates are.s
0eb0: 74 6f 72 65 64 2e 20 54 68 65 20 64 65 66 61 75  tored. The defau
0ec0: 6c 74 20 69 73 20 70 6c 61 74 66 6f 72 6d 20 73  lt is platform s
0ed0: 70 65 63 69 66 69 63 20 61 6e 64 20 63 61 6e 20  pecific and can 
0ee0: 62 65 20 73 65 74 20 61 74 20 63 6f 6d 70 69 6c  be set at compil
0ef0: 65 20 74 69 6d 65 2e 20 54 68 65 0a 64 65 66 61  e time. The.defa
0f00: 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63 61 6e  ult location can
0f10: 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62   be overridden b
0f20: 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43  y the [var SSL_C
0f30: 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72 6f 6e  ERT_DIR] environ
0f40: 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e 20 53  ment.variable. S
0f50: 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65 72  ee [sectref "Cer
0f60: 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74  tificate Validat
0f70: 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64  ion"] for more d
0f80: 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65  etails...[opt_de
0f90: 66 20 2d 63 61 66 69 6c 65 20 5b 61 72 67 20 66  f -cafile [arg f
0fa0: 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66  ilename]].Specif
0fb0: 69 65 73 20 74 68 65 20 66 69 6c 65 20 77 69 74  ies the file wit
0fc0: 68 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  h the Certificat
0fd0: 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e Authority (CA)
0fe0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f   certificates to
0ff0: 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73 74 20 50   use in.[const P
1000: 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d 61 74 2e  EM] file format.
1010: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
1020: 5b 66 69 6c 65 20 63 65 72 74 2e 70 65 6d 5d 2c  [file cert.pem],
1030: 20 69 6e 20 74 68 65 20 4f 70 65 6e 53 53 4c 0a   in the OpenSSL.
1040: 64 69 72 65 63 74 6f 72 79 2e 20 54 68 65 20 64  directory. The d
1050: 65 66 61 75 6c 74 20 66 69 6c 65 20 63 61 6e 20  efault file can 
1060: 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79  be overridden by
1070: 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45   the [var SSL_CE
1080: 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e  RT_FILE] environ
1090: 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e 20 53  ment.variable. S
10a0: 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65 72  ee [sectref "Cer
10b0: 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74  tificate Validat
10c0: 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64  ion"] for more d
10d0: 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65  etails...[opt_de
10e0: 66 20 2d 63 61 73 74 6f 72 65 20 5b 61 72 67 20  f -castore [arg 
10f0: 55 52 49 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  URI]].Specifies 
1100: 74 68 65 20 55 6e 69 66 6f 72 6d 20 52 65 73 6f  the Uniform Reso
1110: 75 72 63 65 20 49 64 65 6e 74 69 66 69 65 72 20  urce Identifier 
1120: 28 55 52 49 29 20 66 6f 72 20 74 68 65 20 43 65  (URI) for the Ce
1130: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
1140: 69 74 79 0a 28 43 41 29 20 73 74 6f 72 65 2c 20  ity.(CA) store, 
1150: 77 68 69 63 68 20 6d 61 79 20 62 65 20 61 20 73  which may be a s
1160: 69 6e 67 6c 65 20 63 6f 6e 74 61 69 6e 65 72 20  ingle container 
1170: 6f 72 20 61 20 63 61 74 61 6c 6f 67 20 6f 66 20  or a catalog of 
1180: 63 6f 6e 74 61 69 6e 65 72 73 2e 0a 53 74 61 72  containers..Star
1190: 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e 53 53  ting with OpenSS
11a0: 4c 20 33 2e 32 20 6f 6e 20 4d 53 20 57 69 6e 64  L 3.2 on MS Wind
11b0: 6f 77 73 2c 20 73 65 74 20 74 6f 20 22 5b 63 6f  ows, set to "[co
11c0: 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e 73 73 6c  nst "org.openssl
11d0: 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a  .winstore://"]".
11e0: 74 6f 20 75 73 65 20 74 68 65 20 62 75 69 6c 74  to use the built
11f0: 2d 69 6e 20 4d 53 20 57 69 6e 64 6f 77 73 20 43  -in MS Windows C
1200: 65 72 74 69 66 69 63 61 74 65 20 53 74 6f 72 65  ertificate Store
1210: 2e 0a 53 65 65 20 5b 73 65 63 74 72 65 66 20 22  ..See [sectref "
1220: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
1230: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72  dation"] for mor
1240: 65 20 64 65 74 61 69 6c 73 2e 0a 54 68 69 73 20  e details..This 
1250: 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f  option is new fo
1260: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
1270: 6f 70 74 5f 64 65 66 20 2d 63 65 72 74 66 69 6c  opt_def -certfil
1280: 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d  e [arg filename]
1290: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
12a0: 6e 61 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65  name of the file
12b0: 20 77 69 74 68 20 74 68 65 20 63 65 72 74 69 66   with the certif
12c0: 69 63 61 74 65 20 74 6f 20 75 73 65 20 69 6e 20  icate to use in 
12d0: 50 45 4d 20 66 6f 72 6d 61 74 0a 61 73 20 74 68  PEM format.as th
12e0: 65 20 6c 6f 63 61 6c 20 28 63 6c 69 65 6e 74 20  e local (client 
12f0: 6f 72 20 73 65 72 76 65 72 29 20 63 65 72 74 69  or server) certi
1300: 66 69 63 61 74 65 2e 20 49 74 20 61 6c 73 6f 20  ficate. It also 
1310: 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 70 75 62  contains the pub
1320: 6c 69 63 20 6b 65 79 2e 0a 0a 5b 6f 70 74 5f 64  lic key...[opt_d
1330: 65 66 20 2d 63 65 72 74 20 5b 61 72 67 20 73 74  ef -cert [arg st
1340: 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73  ring]].Specifies
1350: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
1360: 20 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52   to use as a DER
1370: 20 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20   encoded string 
1380: 28 58 2e 35 30 39 20 44 45 52 29 2e 0a 0a 5b 6f  (X.509 DER)...[o
1390: 70 74 5f 64 65 66 20 2d 63 69 70 68 65 72 20 5b  pt_def -cipher [
13a0: 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65  arg string]].Spe
13b0: 63 69 66 69 65 73 20 74 68 65 20 6c 69 73 74 20  cifies the list 
13c0: 6f 66 20 63 69 70 68 65 72 73 20 74 6f 20 75 73  of ciphers to us
13d0: 65 20 66 6f 72 20 54 4c 53 20 31 2e 32 20 61 6e  e for TLS 1.2 an
13e0: 64 20 65 61 72 6c 69 65 72 20 63 6f 6e 6e 65 63  d earlier connec
13f0: 74 69 6f 6e 73 2e 0a 53 74 72 69 6e 67 20 69 73  tions..String is
1400: 20 61 20 63 6f 6c 6f 6e 20 22 5b 63 6f 6e 73 74   a colon "[const
1410: 20 3a 5d 22 20 73 65 70 61 72 61 74 65 64 20 6c   :]" separated l
1420: 69 73 74 20 6f 66 20 63 69 70 68 65 72 73 2e 0a  ist of ciphers..
1430: 43 69 70 68 65 72 73 20 63 61 6e 20 62 65 20 63  Ciphers can be c
1440: 6f 6d 62 69 6e 65 64 20 75 73 69 6e 67 20 74 68  ombined using th
1450: 65 20 22 5b 63 6f 6e 73 74 20 2b 5d 22 20 63 68  e "[const +]" ch
1460: 61 72 61 63 74 65 72 2e 0a 50 72 65 66 69 78 65  aracter..Prefixe
1470: 73 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f  s can be used to
1480: 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20 72 65 6d   permanently rem
1490: 6f 76 65 20 22 5b 63 6f 6e 73 74 20 21 5d 22 2c  ove "[const !]",
14a0: 20 64 65 6c 65 74 65 20 22 5b 63 6f 6e 73 74 20   delete "[const 
14b0: 2d 5d 22 2c 20 6f 72 0a 6d 6f 76 65 20 74 6f 20  -]", or.move to 
14c0: 74 68 65 20 65 6e 64 20 22 5b 63 6f 6e 73 74 20  the end "[const 
14d0: 2b 5d 22 20 61 20 73 70 65 63 69 66 69 65 64 20  +]" a specified 
14e0: 63 69 70 68 65 72 2e 0a 4b 65 79 77 6f 72 64 73  cipher..Keywords
14f0: 20 5b 63 6f 6e 73 74 20 40 53 54 52 45 4e 47 54   [const @STRENGT
1500: 48 5d 20 28 73 6f 72 74 20 62 79 20 61 6c 67 6f  H] (sort by algo
1510: 72 69 74 68 6d 20 6b 65 79 20 6c 65 6e 67 74 68  rithm key length
1520: 29 2c 0a 5b 63 6f 6e 73 74 20 40 53 45 43 4c 45  ),.[const @SECLE
1530: 56 45 4c 3d 5d 5b 65 6d 70 68 20 6e 5d 20 28 73  VEL=][emph n] (s
1540: 65 74 20 73 65 63 75 72 69 74 79 20 6c 65 76 65  et security leve
1550: 6c 20 74 6f 20 6e 29 2c 20 61 6e 64 0a 5b 63 6f  l to n), and.[co
1560: 6e 73 74 20 44 45 46 41 55 4c 54 5d 20 28 75 73  nst DEFAULT] (us
1570: 65 20 64 65 66 61 75 6c 74 20 63 69 70 68 65 72  e default cipher
1580: 20 6c 69 73 74 2c 20 61 74 20 73 74 61 72 74 20   list, at start 
1590: 6f 6e 6c 79 29 20 63 61 6e 20 61 6c 73 6f 20 62  only) can also b
15a0: 65 20 73 70 65 63 69 66 69 65 64 2e 0a 53 65 65  e specified..See
15b0: 20 74 68 65 20 5b 75 72 69 20 22 68 74 74 70 73   the [uri "https
15c0: 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e  ://docs.openssl.
15d0: 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f  org/master/man1/
15e0: 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f  openssl-ciphers/
15f0: 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53  #options" OpenSS
1600: 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e  L].documentation
1610: 20 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c 69   for the full li
1620: 73 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75  st of valid valu
1630: 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  es...[opt_def -c
1640: 69 70 68 65 72 73 75 69 74 65 73 20 5b 61 72 67  iphersuites [arg
1650: 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66   string]].Specif
1660: 69 65 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20  ies the list of 
1670: 63 69 70 68 65 72 20 73 75 69 74 65 73 20 74 6f  cipher suites to
1680: 20 75 73 65 20 66 6f 72 20 54 4c 53 20 31 2e 33   use for TLS 1.3
1690: 20 61 73 20 61 20 63 6f 6c 6f 6e 0a 22 5b 63 6f   as a colon."[co
16a0: 6e 73 74 20 3a 5d 22 20 73 65 70 61 72 61 74 65  nst :]" separate
16b0: 64 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72  d list of cipher
16c0: 20 73 75 69 74 65 20 6e 61 6d 65 73 2e 20 53 65   suite names. Se
16d0: 65 20 74 68 65 0a 5b 75 72 69 20 22 68 74 74 70  e the.[uri "http
16e0: 73 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c  s://docs.openssl
16f0: 2e 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31  .org/master/man1
1700: 2f 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73  /openssl-ciphers
1710: 2f 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53  /#options" OpenS
1720: 53 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f  SL].documentatio
1730: 6e 20 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c  n for the full l
1740: 69 73 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c  ist of valid val
1750: 75 65 73 2e 0a 54 68 69 73 20 6f 70 74 69 6f 6e  ues..This option
1760: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
1770: 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65  LS 1.8...[opt_de
1780: 66 20 2d 63 6f 6d 6d 61 6e 64 20 5b 61 72 67 20  f -command [arg 
1790: 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69  callback]].Speci
17a0: 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63  fies the callbac
17b0: 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 62 65 20  k command to be 
17c0: 69 6e 76 6f 6b 65 64 20 61 74 20 73 65 76 65 72  invoked at sever
17d0: 61 6c 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67  al points during
17e0: 20 74 68 65 0a 68 61 6e 64 73 68 61 6b 65 20 74   the.handshake t
17f0: 6f 20 70 61 73 73 20 65 72 72 6f 72 73 2c 20 74  o pass errors, t
1800: 72 61 63 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69  racing informati
1810: 6f 6e 2c 20 61 6e 64 20 70 72 6f 74 6f 63 6f 6c  on, and protocol
1820: 20 6d 65 73 73 61 67 65 73 2e 0a 53 65 65 20 5b   messages..See [
1830: 73 65 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63  sectref "Callbac
1840: 6b 20 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20  k Options"] for 
1850: 6d 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74  more info...[opt
1860: 5f 64 65 66 20 2d 64 68 70 61 72 61 6d 73 20 5b  _def -dhparams [
1870: 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53  arg filename]].S
1880: 70 65 63 69 66 69 65 73 20 74 68 65 20 44 69 66  pecifies the Dif
1890: 66 69 65 2d 48 65 6c 6c 6d 61 6e 20 28 44 48 29  fie-Hellman (DH)
18a0: 20 70 61 72 61 6d 65 74 65 72 73 20 66 69 6c 65   parameters file
18b0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 6b 65 79  ...[opt_def -key
18c0: 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61  file [arg filena
18d0: 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  me]].Specifies t
18e0: 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 66  he private key f
18f0: 69 6c 65 2e 20 54 68 65 20 64 65 66 61 75 6c 74  ile. The default
1900: 20 69 73 20 74 6f 20 75 73 65 20 74 68 65 20 66   is to use the f
1910: 69 6c 65 0a 73 70 65 63 69 66 69 65 64 20 62 79  ile.specified by
1920: 20 74 68 65 20 5b 61 72 67 20 2d 63 65 72 74 66   the [arg -certf
1930: 69 6c 65 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f  ile] option...[o
1940: 70 74 5f 64 65 66 20 2d 6b 65 79 20 5b 61 72 67  pt_def -key [arg
1950: 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66   string]].Specif
1960: 69 65 73 20 74 68 65 20 70 72 69 76 61 74 65 20  ies the private 
1970: 6b 65 79 20 74 6f 20 75 73 65 20 61 73 20 61 20  key to use as a 
1980: 44 45 52 20 65 6e 63 6f 64 65 64 20 73 74 72 69  DER encoded stri
1990: 6e 67 20 28 50 4b 43 53 23 31 20 44 45 52 29 2e  ng (PKCS#1 DER).
19a0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 6d 6f 64 65  ..[opt_def -mode
19b0: 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d  l [arg channel]]
19c0: 0a 46 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e  .Force this chan
19d0: 6e 65 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65  nel to share the
19e0: 20 73 61 6d 65 20 5b 74 65 72 6d 20 53 53 4c 5f   same [term SSL_
19f0: 43 54 58 5d 20 73 74 72 75 63 74 75 72 65 20 61  CTX] structure a
1a00: 73 20 74 68 65 0a 73 70 65 63 69 66 69 65 64 20  s the.specified 
1a10: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2c 20 61  [arg channel], a
1a20: 6e 64 20 74 68 65 72 65 66 6f 72 65 20 73 68 61  nd therefore sha
1a30: 72 65 20 63 6f 6e 66 69 67 2c 20 63 61 6c 6c 62  re config, callb
1a40: 61 63 6b 73 2c 20 65 74 63 2e 0a 0a 5b 6f 70 74  acks, etc...[opt
1a50: 5f 64 65 66 20 2d 70 61 73 73 77 6f 72 64 20 5b  _def -password [
1a60: 61 72 67 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53  arg callback]].S
1a70: 70 65 63 69 66 69 65 73 20 74 68 65 20 63 61 6c  pecifies the cal
1a80: 6c 62 61 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f  lback command to
1a90: 20 69 6e 76 6f 6b 65 20 77 68 65 6e 20 4f 70 65   invoke when Ope
1aa0: 6e 53 53 4c 20 6e 65 65 64 73 20 74 6f 20 6f 62  nSSL needs to ob
1ab0: 74 61 69 6e 20 61 0a 70 61 73 73 77 6f 72 64 2e  tain a.password.
1ac0: 20 54 68 69 73 20 69 73 20 74 79 70 69 63 61 6c   This is typical
1ad0: 6c 79 20 75 73 65 64 20 74 6f 20 75 6e 6c 6f 63  ly used to unloc
1ae0: 6b 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65  k the private ke
1af0: 79 20 6f 66 20 61 20 63 65 72 74 69 66 69 63 61  y of a certifica
1b00: 74 65 2e 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b  te..The callback
1b10: 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61   should return a
1b20: 20 70 61 73 73 77 6f 72 64 20 73 74 72 69 6e 67   password string
1b30: 2e 20 54 68 69 73 20 6f 70 74 69 6f 6e 20 68 61  . This option ha
1b40: 73 20 63 68 61 6e 67 65 64 20 66 6f 72 0a 54 63  s changed for.Tc
1b50: 6c 54 4c 53 20 31 2e 38 2e 20 53 65 65 20 5b 73  lTLS 1.8. See [s
1b60: 65 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b  ectref "Callback
1b70: 20 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d   Options"] for m
1b80: 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f  ore info...[opt_
1b90: 64 65 66 20 2d 70 6f 73 74 5f 68 61 6e 64 73 68  def -post_handsh
1ba0: 61 6b 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a  ake [arg bool]].
1bb0: 41 6c 6c 6f 77 20 70 6f 73 74 2d 68 61 6e 64 73  Allow post-hands
1bc0: 68 61 6b 65 20 73 65 73 73 69 6f 6e 20 74 69 63  hake session tic
1bd0: 6b 65 74 20 75 70 64 61 74 65 73 2e 20 54 68 69  ket updates. Thi
1be0: 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77 20  s option is new 
1bf0: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
1c00: 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 65  .[opt_def -reque
1c10: 73 74 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52  st [arg bool]].R
1c20: 65 71 75 65 73 74 20 61 20 63 65 72 74 69 66 69  equest a certifi
1c30: 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65  cate from the pe
1c40: 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53  er during the SS
1c50: 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 69  L handshake. Thi
1c60: 73 20 69 73 20 6e 65 65 64 65 64 0a 74 6f 20 64  s is needed.to d
1c70: 6f 20 43 65 72 74 69 66 69 63 61 74 65 20 56 61  o Certificate Va
1c80: 6c 69 64 61 74 69 6f 6e 2e 20 53 74 61 72 74 69  lidation. Starti
1c90: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38  ng in TclTLS 1.8
1ca0: 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20 69 73  , the default is
1cb0: 0a 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 53  .[const true]. S
1cc0: 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c  tarting in TclTL
1cd0: 53 20 32 2e 30 2c 20 49 66 20 73 65 74 20 74 6f  S 2.0, If set to
1ce0: 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20 61   [const false] a
1cf0: 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75  nd.[option -requ
1d00: 69 72 65 5d 20 69 73 20 5b 63 6f 6e 73 74 20 74  ire] is [const t
1d10: 72 75 65 5d 2c 20 74 68 65 6e 20 74 68 69 73 20  rue], then this 
1d20: 77 69 6c 6c 20 62 65 20 6f 76 65 72 72 69 64 64  will be overridd
1d30: 65 6e 20 74 6f 20 5b 63 6f 6e 73 74 20 74 72 75  en to [const tru
1d40: 65 5d 2e 0a 53 65 65 20 5b 73 65 63 74 72 65 66  e]..See [sectref
1d50: 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61   "Certificate Va
1d60: 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d  lidation"] for m
1d70: 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f  ore details...[o
1d80: 70 74 5f 64 65 66 20 2d 72 65 71 75 69 72 65 20  pt_def -require 
1d90: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75  [arg bool]].Requ
1da0: 69 72 65 20 61 20 76 61 6c 69 64 20 63 65 72 74  ire a valid cert
1db0: 69 66 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65  ificate from the
1dc0: 20 70 65 65 72 20 64 75 72 69 6e 67 20 74 68 65   peer during the
1dd0: 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20   SSL handshake. 
1de0: 49 66 20 74 68 69 73 20 69 73 0a 73 65 74 20 74  If this is.set t
1df0: 6f 20 74 72 75 65 2c 20 74 68 65 6e 20 5b 6f 70  o true, then [op
1e00: 74 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 6d  tion -request] m
1e10: 75 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74 20  ust also be set 
1e20: 74 6f 20 74 72 75 65 20 61 6e 64 20 61 20 65 69  to true and a ei
1e30: 74 68 65 72 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61  ther.[option -ca
1e40: 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63  dir], [option -c
1e50: 61 66 69 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20  afile], [option 
1e60: 2d 63 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20  -castore], or a 
1e70: 70 6c 61 74 66 6f 72 6d 20 64 65 66 61 75 6c 74  platform default
1e80: 0a 6d 75 73 74 20 62 65 20 70 72 6f 76 69 64 65  .must be provide
1e90: 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 76 61  d in order to va
1ea0: 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20  lidate against. 
1eb0: 54 68 65 20 64 65 66 61 75 6c 74 20 69 6e 20 54  The default in T
1ec0: 63 6c 54 4c 53 20 31 2e 38 20 61 6e 64 0a 65 61  clTLS 1.8 and.ea
1ed0: 72 6c 69 65 72 20 76 65 72 73 69 6f 6e 73 20 69  rlier versions i
1ee0: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20  s [const false] 
1ef0: 73 69 6e 63 65 20 6e 6f 74 20 61 6c 6c 20 70 6c  since not all pl
1f00: 61 74 66 6f 72 6d 73 20 68 61 76 65 20 63 65 72  atforms have cer
1f10: 74 69 66 69 63 61 74 65 73 20 74 6f 0a 76 61 6c  tificates to.val
1f20: 69 64 61 74 65 20 61 67 61 69 6e 73 74 20 69 6e  idate against in
1f30: 20 61 20 66 6f 72 6d 20 63 6f 6d 70 61 74 69 62   a form compatib
1f40: 6c 65 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 2e  le with OpenSSL.
1f50: 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c   Starting in Tcl
1f60: 54 4c 53 20 32 2e 30 2c 0a 74 68 65 20 64 65 66  TLS 2.0,.the def
1f70: 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74  ault is [const t
1f80: 72 75 65 5d 2e 0a 53 65 65 20 5b 73 65 63 74 72  rue]..See [sectr
1f90: 65 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20  ef "Certificate 
1fa0: 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72  Validation"] for
1fb0: 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a   more details...
1fc0: 5b 6f 70 74 5f 64 65 66 20 2d 73 65 63 75 72 69  [opt_def -securi
1fd0: 74 79 5f 6c 65 76 65 6c 20 5b 61 72 67 20 69 6e  ty_level [arg in
1fe0: 74 65 67 65 72 5d 5d 0a 53 70 65 63 69 66 69 65  teger]].Specifie
1ff0: 73 20 74 68 65 20 73 65 63 75 72 69 74 79 20 6c  s the security l
2000: 65 76 65 6c 20 28 76 61 6c 75 65 20 66 72 6f 6d  evel (value from
2010: 20 30 20 74 6f 20 35 29 2e 20 54 68 65 20 73 65   0 to 5). The se
2020: 63 75 72 69 74 79 20 6c 65 76 65 6c 20 61 66 66  curity level aff
2030: 65 63 74 73 0a 74 68 65 20 61 6c 6c 6f 77 65 64  ects.the allowed
2040: 20 63 69 70 68 65 72 20 73 75 69 74 65 20 65 6e   cipher suite en
2050: 63 72 79 70 74 69 6f 6e 20 61 6c 67 6f 72 69 74  cryption algorit
2060: 68 6d 73 2c 20 73 75 70 70 6f 72 74 65 64 20 45  hms, supported E
2070: 43 43 20 63 75 72 76 65 73 2c 0a 73 75 70 70 6f  CC curves,.suppo
2080: 72 74 65 64 20 73 69 67 6e 61 74 75 72 65 20 61  rted signature a
2090: 6c 67 6f 72 69 74 68 6d 73 2c 20 44 48 20 70 61  lgorithms, DH pa
20a0: 72 61 6d 65 74 65 72 20 73 69 7a 65 73 2c 20 63  rameter sizes, c
20b0: 65 72 74 69 66 69 63 61 74 65 20 6b 65 79 20 73  ertificate key s
20c0: 69 7a 65 73 0a 61 6e 64 20 73 69 67 6e 61 74 75  izes.and signatu
20d0: 72 65 20 61 6c 67 6f 72 69 74 68 6d 73 2e 20 54  re algorithms. T
20e0: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 31 20  he default is 1 
20f0: 70 72 69 6f 72 20 74 6f 20 4f 70 65 6e 53 53 4c  prior to OpenSSL
2100: 20 33 2e 32 20 61 6e 64 20 32 0a 74 68 65 72 65   3.2 and 2.there
2110: 61 66 74 65 72 2e 20 4c 65 76 65 6c 20 33 20 61  after. Level 3 a
2120: 6e 64 20 68 69 67 68 65 72 20 64 69 73 61 62 6c  nd higher disabl
2130: 65 20 73 75 70 70 6f 72 74 20 66 6f 72 20 73 65  e support for se
2140: 73 73 69 6f 6e 20 74 69 63 6b 65 74 73 20 61 6e  ssion tickets an
2150: 64 0a 6f 6e 6c 79 20 61 63 63 65 70 74 20 63 69  d.only accept ci
2160: 70 68 65 72 20 73 75 69 74 65 73 20 74 68 61 74  pher suites that
2170: 20 70 72 6f 76 69 64 65 20 66 6f 72 77 61 72 64   provide forward
2180: 20 73 65 63 72 65 63 79 2e 0a 54 68 69 73 20 6f   secrecy..This o
2190: 70 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72  ption is new for
21a0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f   TclTLS 1.8...[o
21b0: 70 74 5f 64 65 66 20 2d 73 65 72 76 65 72 20 5b  pt_def -server [
21c0: 61 72 67 20 62 6f 6f 6c 5d 5d 0a 53 70 65 63 69  arg bool]].Speci
21d0: 66 69 65 73 20 77 68 65 74 68 65 72 20 74 6f 20  fies whether to 
21e0: 61 63 74 20 61 73 20 61 20 73 65 72 76 65 72 20  act as a server 
21f0: 61 6e 64 20 72 65 73 70 6f 6e 64 20 77 69 74 68  and respond with
2200: 20 61 20 73 65 72 76 65 72 20 68 61 6e 64 73 68   a server handsh
2210: 61 6b 65 20 77 68 65 6e 20 61 0a 63 6c 69 65 6e  ake when a.clien
2220: 74 20 63 6f 6e 6e 65 63 74 73 20 61 6e 64 20 70  t connects and p
2230: 72 6f 76 69 64 65 73 20 61 20 63 6c 69 65 6e 74  rovides a client
2240: 20 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 65 20   handshake. The 
2250: 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73  default is [cons
2260: 74 20 66 61 6c 73 65 5d 2e 0a 0a 5b 6f 70 74 5f  t false]...[opt_
2270: 64 65 66 20 2d 73 65 72 76 65 72 6e 61 6d 65 20  def -servername 
2280: 5b 61 72 67 20 68 6f 73 74 6e 61 6d 65 5d 5d 0a  [arg hostname]].
2290: 53 70 65 63 69 66 79 20 74 68 65 20 70 65 65 72  Specify the peer
22a0: 27 73 20 68 6f 73 74 6e 61 6d 65 2e 20 54 68 69  's hostname. Thi
22b0: 73 20 69 73 20 75 73 65 64 20 74 6f 20 73 65 74  s is used to set
22c0: 20 74 68 65 20 54 4c 53 20 53 65 72 76 65 72 20   the TLS Server 
22d0: 4e 61 6d 65 20 49 6e 64 69 63 61 74 69 6f 6e 0a  Name Indication.
22e0: 28 53 4e 49 29 20 65 78 74 65 6e 73 69 6f 6e 2e  (SNI) extension.
22f0: 20 53 65 74 20 74 68 69 73 20 74 6f 20 74 68 65   Set this to the
2300: 20 65 78 70 65 63 74 65 64 20 73 65 72 76 65 72   expected server
2310: 6e 61 6d 65 20 69 6e 20 74 68 65 20 73 65 72 76  name in the serv
2320: 65 72 27 73 20 63 65 72 74 69 66 69 63 61 74 65  er's certificate
2330: 0a 6f 72 20 6f 6e 65 20 6f 66 20 74 68 65 20 53  .or one of the S
2340: 75 62 6a 65 63 74 20 41 6c 74 65 72 6e 61 74 65  ubject Alternate
2350: 20 4e 61 6d 65 73 20 28 53 41 4e 29 2e 20 53 74   Names (SAN). St
2360: 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53  arting in TclTLS
2370: 20 32 2e 30 2c 20 74 68 69 73 20 77 69 6c 6c 0a   2.0, this will.
2380: 64 65 66 61 75 6c 74 20 74 6f 20 74 68 65 20 68  default to the h
2390: 6f 73 74 20 66 6f 72 20 74 68 65 20 5b 63 6d 64  ost for the [cmd
23a0: 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f   tls::socket] co
23b0: 6d 6d 61 6e 64 2e 0a 0a 5b 6f 70 74 5f 64 65 66  mmand...[opt_def
23c0: 20 2d 73 65 73 73 69 6f 6e 5f 69 64 20 5b 61 72   -session_id [ar
23d0: 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d  g binary_string]
23e0: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
23f0: 73 65 73 73 69 6f 6e 20 69 64 20 74 6f 20 72 65  session id to re
2400: 73 75 6d 65 20 61 20 73 65 73 73 69 6f 6e 2e 20  sume a session. 
2410: 4e 6f 74 20 73 75 70 70 6f 72 74 65 64 20 79 65  Not supported ye
2420: 74 2e 0a 54 68 69 73 20 6f 70 74 69 6f 6e 20 69  t..This option i
2430: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
2440: 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20   1.8...[opt_def 
2450: 2d 73 73 6c 32 20 5b 61 72 67 20 62 6f 6f 6c 5d  -ssl2 [arg bool]
2460: 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20  ].Enable use of 
2470: 53 53 4c 20 76 32 2e 54 68 65 20 64 65 66 61 75  SSL v2.The defau
2480: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c  lt is [const fal
2490: 73 65 5d 2e 0a 4f 70 65 6e 53 53 4c 20 31 2e 31  se]..OpenSSL 1.1
24a0: 2b 20 6e 6f 20 6c 6f 6e 67 65 72 20 73 75 70 70  + no longer supp
24b0: 6f 72 74 73 20 53 53 4c 20 76 32 2c 20 73 6f 20  orts SSL v2, so 
24c0: 74 68 69 73 20 6d 61 79 20 6e 6f 74 20 68 61 76  this may not hav
24d0: 65 20 61 6e 79 20 65 66 66 65 63 74 2e 0a 53 65  e any effect..Se
24e0: 65 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a  e the [cmd tls::
24f0: 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61  protocols] comma
2500: 6e 64 20 66 6f 72 20 73 75 70 70 6f 72 74 65 64  nd for supported
2510: 20 70 72 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70   protocols...[op
2520: 74 5f 64 65 66 20 2d 73 73 6c 33 20 5b 61 72 67  t_def -ssl3 [arg
2530: 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75   bool]].Enable u
2540: 73 65 20 6f 66 20 53 53 4c 20 76 33 2e 20 54 68  se of SSL v3. Th
2550: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
2560: 6e 73 74 20 66 61 6c 73 65 5d 2e 20 53 74 61 72  nst false]. Star
2570: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 31  ting in TclTLS 1
2580: 2e 38 2c 0a 75 73 65 20 6f 66 20 53 53 4c 20 76  .8,.use of SSL v
2590: 33 20 69 66 20 6f 6e 6c 79 20 61 76 61 69 6c 61  3 if only availa
25a0: 62 6c 65 20 76 69 61 20 61 20 63 6f 6d 70 69 6c  ble via a compil
25b0: 65 20 74 69 6d 65 20 6f 70 74 69 6f 6e 2e 0a 53  e time option..S
25c0: 65 65 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a  ee the [cmd tls:
25d0: 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d  :protocols] comm
25e0: 61 6e 64 20 66 6f 72 20 73 75 70 70 6f 72 74 65  and for supporte
25f0: 64 20 70 72 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f  d protocols...[o
2600: 70 74 5f 64 65 66 20 2d 74 6c 73 31 20 5b 61 72  pt_def -tls1 [ar
2610: 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20  g bool]].Enable 
2620: 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 20 53  use of TLS v1. S
2630: 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c  tarting in TclTL
2640: 53 20 32 2e 30 2c 20 74 68 65 20 64 65 66 61 75  S 2.0, the defau
2650: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c  lt is [const fal
2660: 73 65 5d 2e 0a 4e 6f 74 65 3a 20 54 4c 53 20 31  se]..Note: TLS 1
2670: 2e 30 20 6e 65 65 64 73 20 53 48 41 31 20 74 6f  .0 needs SHA1 to
2680: 20 6f 70 65 72 61 74 65 2c 20 77 68 69 63 68 20   operate, which 
2690: 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c  is only availabl
26a0: 65 20 69 6e 20 73 65 63 75 72 69 74 79 20 6c 65  e in security le
26b0: 76 65 6c 0a 30 20 66 6f 72 20 4f 70 65 6e 20 53  vel.0 for Open S
26c0: 53 4c 20 33 2e 30 2b 2e 20 53 65 65 20 74 68 65  SL 3.0+. See the
26d0: 20 5b 61 72 67 20 2d 73 65 63 75 72 69 74 79 5f   [arg -security_
26e0: 6c 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e 0a 0a  level] option...
26f0: 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 2e 31  [opt_def -tls1.1
2700: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61   [arg bool]].Ena
2710: 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76  ble use of TLS v
2720: 31 2e 31 2e 20 53 74 61 72 74 69 6e 67 20 69 6e  1.1. Starting in
2730: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65   TclTLS 2.0, the
2740: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
2750: 73 74 20 66 61 6c 73 65 5d 2e 0a 4e 6f 74 65 3a  st false]..Note:
2760: 20 54 4c 53 20 31 2e 31 20 6e 65 65 64 73 20 53   TLS 1.1 needs S
2770: 48 41 31 20 74 6f 20 6f 70 65 72 61 74 65 2c 20  HA1 to operate, 
2780: 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 61 76  which is only av
2790: 61 69 6c 61 62 6c 65 20 69 6e 20 73 65 63 75 72  ailable in secur
27a0: 69 74 79 20 6c 65 76 65 6c 0a 30 20 66 6f 72 20  ity level.0 for 
27b0: 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 20 53  Open SSL 3.0+. S
27c0: 65 65 20 74 68 65 20 5b 61 72 67 20 2d 73 65 63  ee the [arg -sec
27d0: 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 6f 70 74  urity_level] opt
27e0: 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ion...[opt_def -
27f0: 74 6c 73 31 2e 32 20 5b 61 72 67 20 62 6f 6f 6c  tls1.2 [arg bool
2800: 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66  ]].Enable use of
2810: 20 54 4c 53 20 76 31 2e 32 2e 20 54 68 65 20 64   TLS v1.2. The d
2820: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74  efault is [const
2830: 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65   true]...[opt_de
2840: 66 20 2d 74 6c 73 31 2e 33 20 5b 61 72 67 20 62  f -tls1.3 [arg b
2850: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
2860: 20 6f 66 20 54 4c 53 20 76 31 2e 33 2e 20 54 68   of TLS v1.3. Th
2870: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
2880: 6e 73 74 20 74 72 75 65 5d 2e 20 54 68 69 73 20  nst true]. This 
2890: 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c  is only availabl
28a0: 65 0a 73 74 61 72 74 69 6e 67 20 77 69 74 68 20  e.starting with 
28b0: 4f 70 65 6e 53 53 4c 20 31 2e 31 2e 31 20 61 6e  OpenSSL 1.1.1 an
28c0: 64 20 54 63 6c 54 4c 53 20 31 2e 37 2e 0a 0a 5b  d TclTLS 1.7...[
28d0: 6f 70 74 5f 64 65 66 20 2d 76 61 6c 69 64 61 74  opt_def -validat
28e0: 65 63 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61  ecommand [arg ca
28f0: 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69  llback]].Specifi
2900: 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20  es the callback 
2910: 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e 76 6f 6b  command to invok
2920: 65 20 74 6f 20 76 61 6c 69 64 61 74 65 20 74 68  e to validate th
2930: 65 20 70 65 65 72 20 63 65 72 74 69 66 69 63 61  e peer certifica
2940: 74 65 73 0a 61 6e 64 20 6f 74 68 65 72 20 63 6f  tes.and other co
2950: 6e 66 69 67 20 69 6e 66 6f 20 64 75 72 69 6e 67  nfig info during
2960: 20 74 68 65 20 70 72 6f 74 6f 63 6f 6c 20 6e 65   the protocol ne
2970: 67 6f 74 69 61 74 69 6f 6e 20 70 68 61 73 65 2e  gotiation phase.
2980: 20 54 68 69 73 20 63 61 6e 20 62 65 20 75 73 65   This can be use
2990: 64 0a 62 79 20 54 43 4c 20 73 63 72 69 70 74 73  d.by TCL scripts
29a0: 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 69   to perform thei
29b0: 72 20 6f 77 6e 20 43 65 72 74 69 66 69 63 61 74  r own Certificat
29c0: 65 20 56 61 6c 69 64 61 74 69 6f 6e 20 74 6f 20  e Validation to 
29d0: 73 75 70 70 6c 65 6d 65 6e 74 20 74 68 65 0a 64  supplement the.d
29e0: 65 66 61 75 6c 74 20 76 61 6c 69 64 61 74 69 6f  efault validatio
29f0: 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 4f 70  n provided by Op
2a00: 65 6e 53 53 4c 2e 20 54 68 65 20 73 63 72 69 70  enSSL. The scrip
2a10: 74 20 6d 75 73 74 20 72 65 74 75 72 6e 20 61 20  t must return a 
2a20: 62 6f 6f 6c 65 61 6e 20 74 72 75 65 0a 74 6f 20  boolean true.to 
2a30: 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 6e 65 67  continue the neg
2a40: 6f 74 69 61 74 69 6f 6e 2e 20 53 65 65 20 5b 73  otiation. See [s
2a50: 65 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b  ectref "Callback
2a60: 20 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d   Options"] for m
2a70: 6f 72 65 20 69 6e 66 6f 2e 0a 54 68 69 73 20 6f  ore info..This o
2a80: 70 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72  ption is new for
2a90: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c   TclTLS 1.8...[l
2aa0: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20  ist_end]..[call 
2ab0: 5b 63 6d 64 20 74 6c 73 3a 3a 75 6e 69 6d 70 6f  [cmd tls::unimpo
2ac0: 72 74 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c  rt] [arg channel
2ad0: 5d 5d 0a 0a 43 6f 6d 70 6c 69 6d 65 6e 74 20 74  ]]..Compliment t
2ae0: 6f 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f  o [cmd tls::impo
2af0: 72 74 5d 2e 20 55 73 65 64 20 74 6f 20 72 65 6d  rt]. Used to rem
2b00: 6f 76 65 20 74 68 65 20 74 6f 70 20 6c 65 76 65  ove the top leve
2b10: 6c 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65  l stacked channe
2b20: 6c 0a 66 72 6f 6d 20 5b 61 72 67 20 63 68 61 6e  l.from [arg chan
2b30: 6e 65 6c 5d 2e 20 54 68 69 73 20 75 6e 73 74 61  nel]. This unsta
2b40: 63 6b 73 20 74 68 65 20 65 6e 63 72 79 70 74 69  cks the encrypti
2b50: 6f 6e 20 6f 66 20 61 20 72 65 67 75 6c 61 72 20  on of a regular 
2b60: 54 43 4c 20 63 68 61 6e 6e 65 6c 2e 20 41 6e 0a  TCL channel. An.
2b70: 65 72 72 6f 72 20 69 73 20 74 68 72 6f 77 6e 20  error is thrown 
2b80: 69 66 20 54 4c 53 20 69 73 20 6e 6f 74 20 74 68  if TLS is not th
2b90: 65 20 74 6f 70 20 73 74 61 63 6b 65 64 20 63 68  e top stacked ch
2ba0: 61 6e 6e 65 6c 20 74 79 70 65 2e 0a 0a 5b 63 61  annel type...[ca
2bb0: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 68 61 6e  ll [cmd tls::han
2bc0: 64 73 68 61 6b 65 5d 20 5b 61 72 67 20 63 68 61  dshake] [arg cha
2bd0: 6e 6e 65 6c 5d 5d 0a 0a 46 6f 72 63 65 73 20 74  nnel]]..Forces t
2be0: 68 65 20 54 4c 53 20 6e 65 67 6f 74 69 61 74 69  he TLS negotiati
2bf0: 6f 6e 20 68 61 6e 64 73 68 61 6b 65 20 74 6f 20  on handshake to 
2c00: 74 61 6b 65 20 70 6c 61 63 65 20 69 6d 6d 65 64  take place immed
2c10: 69 61 74 65 6c 79 2c 20 61 6e 64 20 72 65 74 75  iately, and retu
2c20: 72 6e 73 20 30 0a 69 66 20 68 61 6e 64 73 68 61  rns 0.if handsha
2c30: 6b 65 20 69 73 20 73 74 69 6c 6c 20 69 6e 20 70  ke is still in p
2c40: 72 6f 67 72 65 73 73 20 28 6e 6f 6e 2d 62 6c 6f  rogress (non-blo
2c50: 63 6b 69 6e 67 29 2c 20 6f 72 20 31 20 69 66 20  cking), or 1 if 
2c60: 74 68 65 20 68 61 6e 64 73 68 61 6b 65 20 77 61  the handshake wa
2c70: 73 0a 73 75 63 63 65 73 73 66 75 6c 2e 20 49 66  s.successful. If
2c80: 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65 20 66   the handshake f
2c90: 61 69 6c 65 64 2c 20 61 6e 20 65 72 72 6f 72 20  ailed, an error 
2ca0: 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e 65 64  will be returned
2cb0: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ...[call [cmd tl
2cc0: 73 3a 3a 73 74 61 74 75 73 5d 20 5b 6f 70 74 20  s::status] [opt 
2cd0: 5b 6f 70 74 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 5d  [option -local]]
2ce0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a   [arg channel]].
2cf0: 0a 52 65 74 75 72 6e 73 20 74 68 65 20 63 75 72  .Returns the cur
2d00: 72 65 6e 74 20 73 74 61 74 75 73 20 6f 66 20 61  rent status of a
2d10: 6e 20 53 53 4c 20 63 68 61 6e 6e 65 6c 2e 20 54  n SSL channel. T
2d20: 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 20 6c  he result is a l
2d30: 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65  ist of key-value
2d40: 0a 70 61 69 72 73 20 64 65 73 63 72 69 62 69 6e  .pairs describin
2d50: 67 20 74 68 65 20 53 53 4c 2c 20 63 65 72 74 69  g the SSL, certi
2d60: 66 69 63 61 74 65 2c 20 61 6e 64 20 63 65 72 74  ficate, and cert
2d70: 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63 61  ificate verifica
2d80: 74 69 6f 6e 20 73 74 61 74 75 73 2e 20 49 66 0a  tion status. If.
2d90: 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b  the SSL handshak
2da0: 65 20 68 61 73 20 6e 6f 74 20 79 65 74 20 63 6f  e has not yet co
2db0: 6d 70 6c 65 74 65 64 2c 20 61 6e 20 65 6d 70 74  mpleted, an empt
2dc0: 79 20 6c 69 73 74 20 69 73 20 72 65 74 75 72 6e  y list is return
2dd0: 65 64 2e 20 49 66 20 74 68 65 0a 5b 6f 70 74 69  ed. If the.[opti
2de0: 6f 6e 20 2d 6c 6f 63 61 6c 5d 20 6f 70 74 69 6f  on -local] optio
2df0: 6e 20 69 73 20 73 70 65 63 69 66 69 65 64 2c 20  n is specified, 
2e00: 74 68 65 6e 20 74 68 65 20 6c 6f 63 61 6c 20 63  then the local c
2e10: 65 72 74 69 66 69 63 61 74 65 20 69 73 20 75 73  ertificate is us
2e20: 65 64 2e 20 52 65 74 75 72 6e 65 64 0a 76 61 6c  ed. Returned.val
2e30: 75 65 73 20 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70  ues include:..[p
2e40: 61 72 61 5d 0a 0a 53 53 4c 20 53 74 61 74 75 73  ara]..SSL Status
2e50: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
2e60: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
2e70: 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20 5b 61 72   "[var alpn] [ar
2e80: 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 68  g protocol]"].Th
2e90: 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65 6c 65 63  e protocol selec
2ea0: 74 65 64 20 61 66 74 65 72 20 41 70 70 6c 69 63  ted after Applic
2eb0: 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f 74  ation-Layer Prot
2ec0: 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e  ocol Negotiation
2ed0: 20 28 41 4c 50 4e 29 2e 0a 54 68 69 73 20 76 61   (ALPN)..This va
2ee0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
2ef0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
2f00: 20 22 5b 76 61 72 20 63 69 70 68 65 72 5d 20 5b   "[var cipher] [
2f10: 61 72 67 20 63 69 70 68 65 72 5d 22 5d 0a 54 68  arg cipher]"].Th
2f20: 65 20 63 75 72 72 65 6e 74 20 63 69 70 68 65 72  e current cipher
2f30: 20 69 6e 20 75 73 65 20 66 6f 72 20 74 68 65 20   in use for the 
2f40: 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22  session...[def "
2f50: 5b 76 61 72 20 70 65 65 72 6e 61 6d 65 5d 20 5b  [var peername] [
2f60: 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 65 20  arg name]"].The 
2f70: 70 65 65 72 6e 61 6d 65 20 66 72 6f 6d 20 74 68  peername from th
2f80: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54  e certificate..T
2f90: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
2fa0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
2fb0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 72 6f  ..[def "[var pro
2fc0: 74 6f 63 6f 6c 5d 20 5b 61 72 67 20 76 65 72 73  tocol] [arg vers
2fd0: 69 6f 6e 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f  ion]"].The proto
2fe0: 63 6f 6c 20 76 65 72 73 69 6f 6e 20 75 73 65 64  col version used
2ff0: 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 74   for the connect
3000: 69 6f 6e 3a 20 53 53 4c 32 2c 20 53 53 4c 33 2c  ion: SSL2, SSL3,
3010: 20 54 4c 53 31 2c 20 54 4c 53 31 2e 31 2c 20 54   TLS1, TLS1.1, T
3020: 4c 53 31 2e 32 2c 0a 54 4c 53 31 2e 33 2c 20 6f  LS1.2,.TLS1.3, o
3030: 72 20 75 6e 6b 6e 6f 77 6e 2e 20 54 68 69 73 20  r unknown. This 
3040: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3050: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
3060: 65 66 20 22 5b 76 61 72 20 73 62 69 74 73 5d 20  ef "[var sbits] 
3070: 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75  [arg n]"].The nu
3080: 6d 62 65 72 20 6f 66 20 62 69 74 73 20 75 73 65  mber of bits use
3090: 64 20 66 6f 72 20 74 68 65 20 73 65 73 73 69 6f  d for the sessio
30a0: 6e 20 6b 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76  n key...[def "[v
30b0: 61 72 20 73 69 67 6e 61 74 75 72 65 48 61 73 68  ar signatureHash
30c0: 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20  Algorithm] [arg 
30d0: 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 54 68 65  algorithm]"].The
30e0: 20 73 69 67 6e 61 74 75 72 65 20 68 61 73 68 20   signature hash 
30f0: 61 6c 67 6f 72 69 74 68 6d 2e 0a 54 68 69 73 20  algorithm..This 
3100: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3110: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
3120: 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75  ef "[var signatu
3130: 72 65 54 79 70 65 5d 20 5b 61 72 67 20 74 79 70  reType] [arg typ
3140: 65 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61 74 75  e]"].The signatu
3150: 72 65 20 74 79 70 65 20 76 61 6c 75 65 2e 0a 54  re type value..T
3160: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3170: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3180: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72  ..[def "[var ver
3190: 69 66 79 44 65 70 74 68 5d 20 5b 61 72 67 20 6e  ifyDepth] [arg n
31a0: 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20 64 65 70 74  ]"].Maximum dept
31b0: 68 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 66  h for the certif
31c0: 69 63 61 74 65 20 63 68 61 69 6e 20 76 65 72 69  icate chain veri
31d0: 66 69 63 61 74 69 6f 6e 2e 20 44 65 66 61 75 6c  fication. Defaul
31e0: 74 20 69 73 20 2d 31 2c 20 74 6f 20 63 68 65 63  t is -1, to chec
31f0: 6b 20 61 6c 6c 2e 0a 54 68 69 73 20 76 61 6c 75  k all..This valu
3200: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3210: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3220: 5b 76 61 72 20 76 65 72 69 66 79 4d 6f 64 65 5d  [var verifyMode]
3230: 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69   [arg list]"].Li
3240: 73 74 20 6f 66 20 63 65 72 74 69 66 69 63 61 74  st of certificat
3250: 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 6d  e verification m
3260: 6f 64 65 73 2e 0a 54 68 69 73 20 76 61 6c 75 65  odes..This value
3270: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
3280: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
3290: 76 61 72 20 76 65 72 69 66 79 52 65 73 75 6c 74  var verifyResult
32a0: 5d 20 5b 61 72 67 20 72 65 73 75 6c 74 5d 22 5d  ] [arg result]"]
32b0: 0a 43 65 72 74 69 66 69 63 61 74 65 20 76 65 72  .Certificate ver
32c0: 69 66 69 63 61 74 69 6f 6e 20 72 65 73 75 6c 74  ification result
32d0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
32e0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
32f0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
3300: 63 61 5f 6e 61 6d 65 73 5d 20 5b 61 72 67 20 6c  ca_names] [arg l
3310: 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 74  ist]"].List of t
3320: 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41  he Certificate A
3330: 75 74 68 6f 72 69 74 69 65 73 20 75 73 65 64 20  uthorities used 
3340: 74 6f 20 63 72 65 61 74 65 20 74 68 65 20 63 65  to create the ce
3350: 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20  rtificate..This 
3360: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3370: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c   TclTLS 1.8...[l
3380: 69 73 74 5f 65 6e 64 5d 0a 0a 43 65 72 74 69 66  ist_end]..Certif
3390: 69 63 61 74 65 20 53 74 61 74 75 73 0a 0a 5b 6c  icate Status..[l
33a0: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
33b0: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76  tions]..[def "[v
33c0: 61 72 20 61 6c 6c 5d 20 5b 61 72 67 20 73 74 72  ar all] [arg str
33d0: 69 6e 67 5d 22 5d 0a 44 75 6d 70 20 6f 66 20 61  ing]"].Dump of a
33e0: 6c 6c 20 63 65 72 74 69 66 69 63 61 74 65 20 69  ll certificate i
33f0: 6e 66 6f 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  nfo..This value 
3400: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3410: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3420: 61 72 20 76 65 72 73 69 6f 6e 5d 20 5b 61 72 67  ar version] [arg
3430: 20 76 61 6c 75 65 5d 22 5d 0a 54 68 65 20 63 65   value]"].The ce
3440: 72 74 69 66 69 63 61 74 65 20 76 65 72 73 69 6f  rtificate versio
3450: 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  n...[def "[var s
3460: 65 72 69 61 6c 4e 75 6d 62 65 72 5d 20 5b 61 72  erialNumber] [ar
3470: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20  g string]"].The 
3480: 73 65 72 69 61 6c 20 6e 75 6d 62 65 72 20 6f 66  serial number of
3490: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
34a0: 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67   as a hex string
34b0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 77 61 73  ..This value was
34c0: 20 63 68 61 6e 67 65 64 20 66 72 6f 6d 20 73 65   changed from se
34d0: 72 69 61 6c 20 69 6e 20 54 63 6c 54 4c 53 20 31  rial in TclTLS 1
34e0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
34f0: 73 69 67 6e 61 74 75 72 65 5d 20 5b 61 72 67 20  signature] [arg 
3500: 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 69 70  algorithm]"].Cip
3510: 68 65 72 20 61 6c 67 6f 72 69 74 68 6d 20 75 73  her algorithm us
3520: 65 64 20 66 6f 72 20 63 65 72 74 69 66 69 63 61  ed for certifica
3530: 74 65 20 73 69 67 6e 61 74 75 72 65 2e 0a 54 68  te signature..Th
3540: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
3550: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
3560: 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73 73 75  .[def "[var issu
3570: 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  er] [arg string]
3580: 22 5d 0a 54 68 65 20 64 69 73 74 69 6e 67 75 69  "].The distingui
3590: 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f  shed name (DN) o
35a0: 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  f the certificat
35b0: 65 20 69 73 73 75 65 72 2e 0a 0a 5b 64 65 66 20  e issuer...[def 
35c0: 22 5b 76 61 72 20 6e 6f 74 42 65 66 6f 72 65 5d  "[var notBefore]
35d0: 20 5b 61 72 67 20 64 61 74 65 5d 22 5d 0a 54 68   [arg date]"].Th
35e0: 65 20 62 65 67 69 6e 6e 69 6e 67 20 64 61 74 65  e beginning date
35f0: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
3600: 61 74 65 20 76 61 6c 69 64 69 74 79 2e 0a 0a 5b  ate validity...[
3610: 64 65 66 20 22 5b 76 61 72 20 6e 6f 74 41 66 74  def "[var notAft
3620: 65 72 5d 20 5b 61 72 67 20 64 61 74 65 5d 22 5d  er] [arg date]"]
3630: 0a 54 68 65 20 65 78 70 69 72 61 74 69 6f 6e 20  .The expiration 
3640: 64 61 74 65 20 6f 66 20 74 68 65 20 63 65 72 74  date of the cert
3650: 69 66 69 63 61 74 65 20 76 61 6c 69 64 69 74 79  ificate validity
3660: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 75  ...[def "[var su
3670: 62 6a 65 63 74 5d 20 5b 61 72 67 20 73 74 72 69  bject] [arg stri
3680: 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73 74 69 6e  ng]"].The distin
3690: 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e  guished name (DN
36a0: 29 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  ) of the certifi
36b0: 63 61 74 65 20 73 75 62 6a 65 63 74 2e 20 46 69  cate subject. Fi
36c0: 65 6c 64 73 20 69 6e 63 6c 75 64 65 3a 20 43 6f  elds include: Co
36d0: 6d 6d 6f 6e 0a 4e 61 6d 65 20 28 43 4e 29 2c 20  mmon.Name (CN), 
36e0: 4f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 28 4f 29  Organization (O)
36f0: 2c 20 4c 6f 63 61 6c 69 74 79 20 6f 72 20 43 69  , Locality or Ci
3700: 74 79 20 28 4c 29 2c 20 53 74 61 74 65 20 6f 72  ty (L), State or
3710: 20 50 72 6f 76 69 6e 63 65 20 28 53 29 2c 20 61   Province (S), a
3720: 6e 64 0a 43 6f 75 6e 74 72 79 20 4e 61 6d 65 20  nd.Country Name 
3730: 28 43 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  (C)...[def "[var
3740: 20 69 73 73 75 65 72 55 6e 69 71 75 65 49 44 5d   issuerUniqueID]
3750: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3760: 54 68 65 20 69 73 73 75 65 72 20 75 6e 69 71 75  The issuer uniqu
3770: 65 20 69 64 2e 0a 54 68 69 73 20 76 61 6c 75 65  e id..This value
3780: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
3790: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b  LS 1.8...[def "[
37a0: 76 61 72 20 73 75 62 6a 65 63 74 55 6e 69 71 75  var subjectUniqu
37b0: 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  eID] [arg string
37c0: 5d 22 5d 0a 54 68 65 20 73 75 62 6a 65 63 74 20  ]"].The subject 
37d0: 75 6e 69 71 75 65 20 69 64 2e 0a 54 68 69 73 20  unique id..This 
37e0: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
37f0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
3800: 65 66 20 22 5b 76 61 72 20 6e 75 6d 5f 65 78 74  ef "[var num_ext
3810: 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6e 5d  ensions] [arg n]
3820: 22 5d 0a 4e 75 6d 62 65 72 20 6f 66 20 63 65 72  "].Number of cer
3830: 74 69 66 69 63 61 74 65 20 65 78 74 65 6e 73 69  tificate extensi
3840: 6f 6e 73 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ons..This value 
3850: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3860: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3870: 61 72 20 65 78 74 65 6e 73 69 6f 6e 73 5d 20 5b  ar extensions] [
3880: 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74  arg list]"].List
3890: 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 20   of certificate 
38a0: 65 78 74 65 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e  extension names.
38b0: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
38c0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
38d0: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  8...[def "[var a
38e0: 75 74 68 6f 72 69 74 79 4b 65 79 49 64 65 6e 74  uthorityKeyIdent
38f0: 69 66 69 65 72 5d 20 5b 61 72 67 20 73 74 72 69  ifier] [arg stri
3900: 6e 67 5d 22 5d 0a 41 75 74 68 6f 72 69 74 79 20  ng]"].Authority 
3910: 4b 65 79 20 49 64 65 6e 74 69 66 69 65 72 20 28  Key Identifier (
3920: 41 4b 49 29 20 6f 66 20 74 68 65 20 49 73 73 75  AKI) of the Issu
3930: 69 6e 67 20 43 41 20 63 65 72 74 69 66 69 63 61  ing CA certifica
3940: 74 65 20 74 68 61 74 20 73 69 67 6e 65 64 20 74  te that signed t
3950: 68 65 0a 53 53 4c 20 63 65 72 74 69 66 69 63 61  he.SSL certifica
3960: 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72 69  te as a hex stri
3970: 6e 67 2e 20 54 68 69 73 20 76 61 6c 75 65 20 6d  ng. This value m
3980: 61 74 63 68 65 73 20 74 68 65 20 53 4b 49 20 76  atches the SKI v
3990: 61 6c 75 65 20 6f 66 20 74 68 65 0a 49 6e 74 65  alue of the.Inte
39a0: 72 6d 65 64 69 61 74 65 20 43 41 20 63 65 72 74  rmediate CA cert
39b0: 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61  ificate..This va
39c0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
39d0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
39e0: 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74 4b 65   "[var subjectKe
39f0: 79 49 64 65 6e 74 69 66 69 65 72 5d 20 5b 61 72  yIdentifier] [ar
3a00: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 53 75 62 6a  g string]"].Subj
3a10: 65 63 74 20 4b 65 79 20 49 64 65 6e 74 69 66 69  ect Key Identifi
3a20: 65 72 20 28 53 4b 49 29 20 68 61 73 68 20 6f 66  er (SKI) hash of
3a30: 20 74 68 65 20 70 75 62 6c 69 63 20 6b 65 79 20   the public key 
3a40: 69 6e 73 69 64 65 20 74 68 65 20 63 65 72 74 69  inside the certi
3a50: 66 69 63 61 74 65 20 61 73 20 61 0a 68 65 78 20  ficate as a.hex 
3a60: 73 74 72 69 6e 67 2e 20 55 73 65 64 20 74 6f 20  string. Used to 
3a70: 69 64 65 6e 74 69 66 79 20 63 65 72 74 69 66 69  identify certifi
3a80: 63 61 74 65 73 20 74 68 61 74 20 63 6f 6e 74 61  cates that conta
3a90: 69 6e 20 61 20 70 61 72 74 69 63 75 6c 61 72 20  in a particular 
3aa0: 70 75 62 6c 69 63 20 6b 65 79 2e 0a 54 68 69 73  public key..This
3ab0: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
3ac0: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
3ad0: 64 65 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63  def "[var subjec
3ae0: 74 41 6c 74 4e 61 6d 65 5d 20 5b 61 72 67 20 6c  tAltName] [arg l
3af0: 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 61  ist]"].List of a
3b00: 6c 6c 20 6f 66 20 74 68 65 20 53 75 62 6a 65 63  ll of the Subjec
3b10: 74 20 41 6c 74 65 72 6e 61 74 69 76 65 20 4e 61  t Alternative Na
3b20: 6d 65 73 20 28 53 41 4e 29 20 69 6e 63 6c 75 64  mes (SAN) includ
3b30: 69 6e 67 20 64 6f 6d 61 69 6e 20 6e 61 6d 65 73  ing domain names
3b40: 2c 20 73 75 62 0a 64 6f 6d 61 69 6e 73 2c 20 61  , sub.domains, a
3b50: 6e 64 20 49 50 20 61 64 64 72 65 73 73 65 73 20  nd IP addresses 
3b60: 74 68 61 74 20 61 72 65 20 73 65 63 75 72 65 64  that are secured
3b70: 20 62 79 20 74 68 65 20 63 65 72 74 69 66 69 63   by the certific
3b80: 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ate..This value 
3b90: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3ba0: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3bb0: 61 72 20 6f 63 73 70 5d 20 5b 61 72 67 20 6c 69  ar ocsp] [arg li
3bc0: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 61 6c  st]"].List of al
3bd0: 6c 20 4f 6e 6c 69 6e 65 20 43 65 72 74 69 66 69  l Online Certifi
3be0: 63 61 74 65 20 53 74 61 74 75 73 20 50 72 6f 74  cate Status Prot
3bf0: 6f 63 6f 6c 20 28 4f 43 53 50 29 20 55 52 4c 73  ocol (OCSP) URLs
3c00: 20 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 65   that can be use
3c10: 64 20 74 6f 0a 63 68 65 63 6b 20 74 68 65 20 76  d to.check the v
3c20: 61 6c 69 64 69 74 79 20 6f 66 20 74 68 69 73 20  alidity of this 
3c30: 63 65 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69  certificate..Thi
3c40: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3c50: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3c60: 5b 64 65 66 20 22 5b 76 61 72 20 63 65 72 74 69  [def "[var certi
3c70: 66 69 63 61 74 65 5d 20 5b 61 72 67 20 63 65 72  ficate] [arg cer
3c80: 74 5d 22 5d 0a 54 68 65 20 50 45 4d 20 65 6e 63  t]"].The PEM enc
3c90: 6f 64 65 64 20 63 65 72 74 69 66 69 63 61 74 65  oded certificate
3ca0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69  ...[def "[var si
3cb0: 67 6e 61 74 75 72 65 41 6c 67 6f 72 69 74 68 6d  gnatureAlgorithm
3cc0: 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68 6d  ] [arg algorithm
3cd0: 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c 67 6f 72  ]"].Cipher algor
3ce0: 69 74 68 6d 20 75 73 65 64 20 66 6f 72 20 74 68  ithm used for th
3cf0: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 73 69  e certificate si
3d00: 67 6e 61 74 75 72 65 2e 0a 54 68 69 73 20 76 61  gnature..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 73 69 67 6e 61 74 75 72 65   "[var signature
3d40: 56 61 6c 75 65 5d 20 5b 61 72 67 20 73 74 72 69  Value] [arg stri
3d50: 6e 67 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74  ng]"].Certificat
3d60: 65 20 73 69 67 6e 61 74 75 72 65 20 61 73 20 61  e signature as a
3d70: 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68 69   hex string..Thi
3d80: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3d90: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3da0: 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61  [def "[var signa
3db0: 74 75 72 65 44 69 67 65 73 74 5d 20 5b 61 72 67  tureDigest] [arg
3dc0: 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 43 65 72 74   version]"].Cert
3dd0: 69 66 69 63 61 74 65 20 73 69 67 6e 69 6e 67 20  ificate signing 
3de0: 64 69 67 65 73 74 20 61 73 20 61 20 68 65 78 20  digest as a hex 
3df0: 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c  string..This val
3e00: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
3e10: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
3e20: 22 5b 76 61 72 20 70 75 62 6c 69 63 4b 65 79 41  "[var publicKeyA
3e30: 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20 61  lgorithm] [arg a
3e40: 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 65 72 74  lgorithm]"].Cert
3e50: 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72  ificate signatur
3e60: 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 6c 67  e public key alg
3e70: 6f 72 69 74 68 6d 2e 0a 54 68 69 73 20 76 61 6c  orithm..This val
3e80: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
3e90: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
3ea0: 22 5b 76 61 72 20 70 75 62 6c 69 63 4b 65 79 5d  "[var publicKey]
3eb0: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3ec0: 43 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e  Certificate sign
3ed0: 61 74 75 72 65 20 70 75 62 6c 69 63 20 6b 65 79  ature public key
3ee0: 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67   as a hex string
3ef0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
3f00: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
3f10: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
3f20: 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a  bits] [arg n]"].
3f30: 4e 75 6d 62 65 72 20 6f 66 20 62 69 74 73 20 75  Number of bits u
3f40: 73 65 64 20 66 6f 72 20 63 65 72 74 69 66 69 63  sed for certific
3f50: 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 6b 65  ate signature ke
3f60: 79 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  y..This value is
3f70: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
3f80: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
3f90: 20 73 65 6c 66 5f 73 69 67 6e 65 64 5d 20 5b 61   self_signed] [a
3fa0: 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68  rg boolean]"].Wh
3fb0: 65 74 68 65 72 20 74 68 65 20 63 65 72 74 69 66  ether the certif
3fc0: 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20  icate signature 
3fd0: 69 73 20 73 65 6c 66 20 73 69 67 6e 65 64 2e 0a  is self signed..
3fe0: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
3ff0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
4000: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 68  ...[def "[var sh
4010: 61 31 5f 68 61 73 68 5d 20 5b 61 72 67 20 68 61  a1_hash] [arg ha
4020: 73 68 5d 22 5d 0a 54 68 65 20 53 48 41 31 20 68  sh]"].The SHA1 h
4030: 61 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 69  ash of the certi
4040: 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78 20  ficate as a hex 
4050: 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61 6c  string..This val
4060: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
4070: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
4080: 22 5b 76 61 72 20 73 68 61 32 35 36 5f 68 61 73  "[var sha256_has
4090: 68 5d 20 5b 61 72 67 20 68 61 73 68 5d 22 5d 0a  h] [arg hash]"].
40a0: 54 68 65 20 53 48 41 32 35 36 20 68 61 73 68 20  The SHA256 hash 
40b0: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61  of the certifica
40c0: 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72 69  te as a hex stri
40d0: 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  ng..This value i
40e0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
40f0: 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64   1.8...[list_end
4100: 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ]..[call [cmd tl
4110: 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5d 20 5b  s::connection] [
4120: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52  arg channel]]..R
4130: 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65  eturns the curre
4140: 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74  nt connection st
4150: 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20 63  atus of an SSL c
4160: 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73 75  hannel. The resu
4170: 6c 74 20 69 73 20 61 20 6c 69 73 74 0a 6f 66 20  lt is a list.of 
4180: 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73 20  key-value pairs 
4190: 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 63  describing the c
41a0: 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 54 68 69 73 20  onnection..This 
41b0: 63 6f 6d 6d 61 6e 64 20 69 73 20 6e 65 77 20 66  command is new f
41c0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 52  or TclTLS 1.8. R
41d0: 65 74 75 72 6e 65 64 20 76 61 6c 75 65 73 20 69  eturned values i
41e0: 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a  nclude:..[para].
41f0: 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69  .SSL Status..[li
4200: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
4210: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61  ions]..[def "[va
4220: 72 20 73 74 61 74 65 5d 20 5b 61 72 67 20 73 74  r state] [arg st
4230: 61 74 65 5d 22 5d 0a 53 74 61 74 65 20 6f 66 20  ate]"].State of 
4240: 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a  the connection..
4250: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 72 76  .[def "[var serv
4260: 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d  ername] [arg nam
4270: 65 5d 22 5d 0a 54 68 65 20 6e 61 6d 65 20 6f 66  e]"].The name of
4280: 20 74 68 65 20 63 6f 6e 6e 65 63 74 65 64 20 74   the connected t
4290: 6f 20 73 65 72 76 65 72 2e 0a 0a 5b 64 65 66 20  o server...[def 
42a0: 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20  "[var protocol] 
42b0: 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a  [arg version]"].
42c0: 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72  The protocol ver
42d0: 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 68  sion used for th
42e0: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53  e connection: SS
42f0: 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20  L2, SSL3, TLS1, 
4300: 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20  TLS1.1, TLS1.2, 
4310: 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f  TLS1.3, or unkno
4320: 77 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  wn...[def "[var 
4330: 72 65 6e 65 67 6f 74 69 61 74 69 6f 6e 5f 61 6c  renegotiation_al
4340: 6c 6f 77 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c  lowed] [arg bool
4350: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 70  ean]"].Whether p
4360: 72 6f 74 6f 63 6f 6c 20 72 65 6e 65 67 6f 74 69  rotocol renegoti
4370: 61 74 69 6f 6e 20 69 73 20 73 75 70 70 6f 72 74  ation is support
4380: 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66  ed or not...[def
4390: 20 22 5b 76 61 72 20 73 65 63 75 72 69 74 79 5f   "[var security_
43a0: 6c 65 76 65 6c 5d 20 5b 61 72 67 20 6c 65 76 65  level] [arg leve
43b0: 6c 5d 22 5d 0a 54 68 65 20 73 65 63 75 72 69 74  l]"].The securit
43c0: 79 20 6c 65 76 65 6c 20 75 73 65 64 20 66 6f 72  y level used for
43d0: 20 73 65 6c 65 63 74 69 6f 6e 20 6f 66 20 63 69   selection of ci
43e0: 70 68 65 72 73 2c 20 6b 65 79 20 73 69 7a 65 2c  phers, key size,
43f0: 20 65 74 63 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   etc...[def "[va
4400: 72 20 73 65 73 73 69 6f 6e 5f 72 65 75 73 65 64  r session_reused
4410: 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22  ] [arg boolean]"
4420: 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 73 65  ].Whether the se
4430: 73 73 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 72  ssion has been r
4440: 65 75 73 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b  eused or not...[
4450: 64 65 66 20 22 5b 76 61 72 20 69 73 5f 73 65 72  def "[var is_ser
4460: 76 65 72 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61  ver] [arg boolea
4470: 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65  n]"].Whether the
4480: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 69 73 20 63   connection is c
4490: 6f 6e 66 69 67 75 72 65 64 20 61 73 20 61 20 73  onfigured as a s
44a0: 65 72 76 65 72 20 28 31 29 20 6f 72 20 63 6c 69  erver (1) or cli
44b0: 65 6e 74 20 28 30 29 2e 0a 0a 5b 64 65 66 20 22  ent (0)...[def "
44c0: 5b 76 61 72 20 63 6f 6d 70 72 65 73 73 69 6f 6e  [var compression
44d0: 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 43  ] [arg mode]"].C
44e0: 6f 6d 70 72 65 73 73 69 6f 6e 20 6d 65 74 68 6f  ompression metho
44f0: 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65  d...[def "[var e
4500: 78 70 61 6e 73 69 6f 6e 5d 20 5b 61 72 67 20 6d  xpansion] [arg m
4510: 6f 64 65 5d 22 5d 0a 45 78 70 61 6e 73 69 6f 6e  ode]"].Expansion
4520: 20 6d 65 74 68 6f 64 2e 0a 0a 5b 64 65 66 20 22   method...[def "
4530: 5b 76 61 72 20 63 61 4c 69 73 74 5d 20 5b 61 72  [var caList] [ar
4540: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f  g list]"].List o
4550: 66 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  f Certificate Au
4560: 74 68 6f 72 69 74 69 65 73 20 28 43 41 29 20 66  thorities (CA) f
4570: 6f 72 20 58 2e 35 30 39 20 63 65 72 74 69 66 69  or X.509 certifi
4580: 63 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  cate...[list_end
4590: 5d 0a 0a 43 69 70 68 65 72 20 49 6e 66 6f 0a 0a  ]..Cipher Info..
45a0: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
45b0: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22  nitions]..[def "
45c0: 5b 76 61 72 20 63 69 70 68 65 72 5d 20 5b 61 72  [var cipher] [ar
45d0: 67 20 63 69 70 68 65 72 5d 22 5d 0a 54 68 65 20  g cipher]"].The 
45e0: 63 75 72 72 65 6e 74 20 63 69 70 68 65 72 20 69  current cipher i
45f0: 6e 20 75 73 65 20 66 6f 72 20 74 68 65 20 63 6f  n use for the co
4600: 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20  nnection...[def 
4610: 22 5b 76 61 72 20 73 74 61 6e 64 61 72 64 5f 6e  "[var standard_n
4620: 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22  ame] [arg name]"
4630: 5d 0a 54 68 65 20 73 74 61 6e 64 61 72 64 20 52  ].The standard R
4640: 46 43 20 6e 61 6d 65 20 6f 66 20 63 69 70 68 65  FC name of ciphe
4650: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  r...[def "[var a
4660: 6c 67 6f 72 69 74 68 6d 5f 62 69 74 73 5d 20 5b  lgorithm_bits] [
4670: 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d  arg n]"].The num
4680: 62 65 72 20 6f 66 20 70 72 6f 63 65 73 73 65 64  ber of processed
4690: 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 63   bits used for c
46a0: 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  ipher...[def "[v
46b0: 61 72 20 73 65 63 72 65 74 5f 62 69 74 73 5d 20  ar secret_bits] 
46c0: 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75  [arg n]"].The nu
46d0: 6d 62 65 72 20 6f 66 20 73 65 63 72 65 74 20 62  mber of secret b
46e0: 69 74 73 20 75 73 65 64 20 66 6f 72 20 63 69 70  its used for cip
46f0: 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  her...[def "[var
4700: 20 6d 69 6e 5f 76 65 72 73 69 6f 6e 5d 20 5b 61   min_version] [a
4710: 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68  rg version]"].Th
4720: 65 20 6d 69 6e 69 6d 75 6d 20 70 72 6f 74 6f 63  e minimum protoc
4730: 6f 6c 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 63  ol version for c
4740: 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  ipher...[def "[v
4750: 61 72 20 63 69 70 68 65 72 5f 69 73 5f 61 65 61  ar cipher_is_aea
4760: 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  d] [arg boolean]
4770: 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 63  "].Whether the c
4780: 69 70 68 65 72 20 69 73 20 41 75 74 68 65 6e 74  ipher is Authent
4790: 69 63 61 74 65 64 20 45 6e 63 72 79 70 74 69 6f  icated Encryptio
47a0: 6e 20 77 69 74 68 20 41 73 73 6f 63 69 61 74 65  n with Associate
47b0: 64 20 44 61 74 61 20 28 41 45 41 44 29 2e 0a 0a  d Data (AEAD)...
47c0: 5b 64 65 66 20 22 5b 76 61 72 20 63 69 70 68 65  [def "[var ciphe
47d0: 72 5f 69 64 5d 20 5b 61 72 67 20 69 64 5d 22 5d  r_id] [arg id]"]
47e0: 0a 54 68 65 20 4f 70 65 6e 53 53 4c 20 63 69 70  .The OpenSSL cip
47f0: 68 65 72 20 69 64 2e 0a 0a 5b 64 65 66 20 22 5b  her id...[def "[
4800: 76 61 72 20 64 65 73 63 72 69 70 74 69 6f 6e 5d  var description]
4810: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
4820: 41 20 74 65 78 74 20 64 65 73 63 72 69 70 74 69  A text descripti
4830: 6f 6e 20 6f 66 20 74 68 65 20 63 69 70 68 65 72  on of the cipher
4840: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 68 61  ...[def "[var ha
4850: 6e 64 73 68 61 6b 65 5f 64 69 67 65 73 74 5d 20  ndshake_digest] 
4860: 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a  [arg boolean]"].
4870: 44 69 67 65 73 74 20 75 73 65 64 20 64 75 72 69  Digest used duri
4880: 6e 67 20 68 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b  ng handshake...[
4890: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 53 65 73 73 69  list_end]..Sessi
48a0: 6f 6e 20 49 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62  on Info..[list_b
48b0: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73  egin definitions
48c0: 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c  ]..[def "[var al
48d0: 70 6e 5d 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  pn] [arg protoco
48e0: 6c 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f  l]"].The protoco
48f0: 6c 20 73 65 6c 65 63 74 65 64 20 61 66 74 65 72  l selected after
4900: 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79   Application-Lay
4910: 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f  er Protocol Nego
4920: 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a  tiation (ALPN)..
4930: 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 73 75  .[def "[var resu
4940: 6d 61 62 6c 65 5d 20 5b 61 72 67 20 62 6f 6f 6c  mable] [arg bool
4950: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74  ean]"].Whether t
4960: 68 65 20 73 65 73 73 69 6f 6e 20 63 61 6e 20 62  he session can b
4970: 65 20 72 65 73 75 6d 65 64 20 6f 72 20 6e 6f 74  e resumed or not
4980: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74  ...[def "[var st
4990: 61 72 74 5f 74 69 6d 65 5d 20 5b 61 72 67 20 73  art_time] [arg s
49a0: 65 63 6f 6e 64 73 5d 22 5d 0a 54 69 6d 65 20 73  econds]"].Time s
49b0: 69 6e 63 65 20 73 65 73 73 69 6f 6e 20 73 74 61  ince session sta
49c0: 72 74 65 64 20 69 6e 20 73 65 63 6f 6e 64 73 20  rted in seconds 
49d0: 73 69 6e 63 65 20 65 70 6f 63 68 2e 0a 0a 5b 64  since epoch...[d
49e0: 65 66 20 22 5b 76 61 72 20 74 69 6d 65 6f 75 74  ef "[var timeout
49f0: 5d 20 5b 61 72 67 20 73 65 63 6f 6e 64 73 5d 22  ] [arg seconds]"
4a00: 5d 0a 4d 61 78 20 64 75 72 61 74 69 6f 6e 20 6f  ].Max duration o
4a10: 66 20 73 65 73 73 69 6f 6e 20 69 6e 20 73 65 63  f session in sec
4a20: 6f 6e 64 73 20 62 65 66 6f 72 65 20 74 69 6d 65  onds before time
4a30: 2d 6f 75 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  -out...[def "[va
4a40: 72 20 6c 69 66 65 74 69 6d 65 5d 20 5b 61 72 67  r lifetime] [arg
4a50: 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 53 65 73 73   seconds]"].Sess
4a60: 69 6f 6e 20 74 69 63 6b 65 74 20 6c 69 66 65 74  ion ticket lifet
4a70: 69 6d 65 20 68 69 6e 74 20 69 6e 20 73 65 63 6f  ime hint in seco
4a80: 6e 64 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  nds...[def "[var
4a90: 20 73 65 73 73 69 6f 6e 5f 69 64 5d 20 5b 61 72   session_id] [ar
4aa0: 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d  g binary_string]
4ab0: 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f  "].Unique sessio
4ac0: 6e 20 69 64 20 66 6f 72 20 75 73 65 20 69 6e 20  n id for use in 
4ad0: 72 65 73 75 6d 69 6e 67 20 74 68 65 20 73 65 73  resuming the ses
4ae0: 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  sion...[def "[va
4af0: 72 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74  r session_ticket
4b00: 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74  ] [arg binary_st
4b10: 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73  ring]"].Unique s
4b20: 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 66 6f  ession ticket fo
4b30: 72 20 75 73 65 20 69 6e 20 72 65 73 75 6d 69 6e  r use in resumin
4b40: 67 20 74 68 65 20 73 65 73 73 69 6f 6e 2e 0a 0a  g the session...
4b50: 5b 64 65 66 20 22 5b 76 61 72 20 74 69 63 6b 65  [def "[var ticke
4b60: 74 5f 61 70 70 5f 64 61 74 61 5d 20 5b 61 72 67  t_app_data] [arg
4b70: 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22   binary_string]"
4b80: 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e  ].Unique session
4b90: 20 74 69 63 6b 65 74 20 61 70 70 6c 69 63 61 74   ticket applicat
4ba0: 69 6f 6e 20 64 61 74 61 2e 0a 0a 5b 64 65 66 20  ion data...[def 
4bb0: 22 5b 76 61 72 20 6d 61 73 74 65 72 5f 6b 65 79  "[var master_key
4bc0: 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74  ] [arg binary_st
4bd0: 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73  ring]"].Unique s
4be0: 65 73 73 69 6f 6e 20 6d 61 73 74 65 72 20 6b 65  ession master ke
4bf0: 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  y...[def "[var s
4c00: 65 73 73 69 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64  ession_cache_mod
4c10: 65 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a  e] [arg mode]"].
4c20: 53 65 72 76 65 72 20 63 61 63 68 65 20 6d 6f 64  Server cache mod
4c30: 65 20 28 63 6c 69 65 6e 74 2c 20 73 65 72 76 65  e (client, serve
4c40: 72 2c 20 6f 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c  r, or both)...[l
4c50: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20  ist_end]..[call 
4c60: 5b 63 6d 64 20 74 6c 73 3a 3a 63 69 70 68 65 72  [cmd tls::cipher
4c70: 73 5d 20 5b 6f 70 74 20 5b 61 72 67 20 70 72 6f  s] [opt [arg pro
4c80: 74 6f 63 6f 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72  tocol]] [opt [ar
4c90: 67 20 76 65 72 62 6f 73 65 5d 5d 20 5b 6f 70 74  g verbose]] [opt
4ca0: 20 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 5d   [arg supported]
4cb0: 5d 5d 0a 0a 57 69 74 68 6f 75 74 20 61 6e 79 20  ]]..Without any 
4cc0: 6f 70 74 69 6f 6e 73 2c 20 69 74 20 72 65 74 75  options, it retu
4cd0: 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 61 6c  rns a list of al
4ce0: 6c 20 73 79 6d 6d 65 74 72 69 63 20 63 69 70 68  l symmetric ciph
4cf0: 65 72 73 20 66 6f 72 20 75 73 65 20 77 69 74 68  ers for use with
4d00: 20 74 68 65 0a 5b 61 72 67 20 2d 63 69 70 68 65   the.[arg -ciphe
4d10: 72 5d 20 6f 70 74 69 6f 6e 2e 20 57 69 74 68 20  r] option. With 
4d20: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 2c 20  [arg protocol], 
4d30: 6f 6e 6c 79 20 74 68 65 20 63 69 70 68 65 72 73  only the ciphers
4d40: 20 73 75 70 70 6f 72 74 65 64 20 66 6f 72 20 74   supported for t
4d50: 68 61 74 0a 70 72 6f 74 6f 63 6f 6c 20 61 72 65  hat.protocol are
4d60: 20 72 65 74 75 72 6e 65 64 2e 20 53 65 65 20 74   returned. See t
4d70: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f  he [cmd tls::pro
4d80: 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20  tocols] command 
4d90: 66 6f 72 20 74 68 65 20 73 75 70 70 6f 72 74 65  for the supporte
4da0: 64 0a 70 72 6f 74 6f 63 6f 6c 73 2e 20 49 66 20  d.protocols. If 
4db0: 5b 61 72 67 20 76 65 72 62 6f 73 65 5d 20 69 73  [arg verbose] is
4dc0: 20 73 70 65 63 69 66 69 65 64 20 61 73 20 74 72   specified as tr
4dd0: 75 65 20 74 68 65 6e 20 61 20 76 65 72 62 6f 73  ue then a verbos
4de0: 65 2c 20 68 75 6d 61 6e 20 72 65 61 64 61 62 6c  e, human readabl
4df0: 65 0a 6c 69 73 74 20 69 73 20 72 65 74 75 72 6e  e.list is return
4e00: 65 64 20 77 69 74 68 20 61 64 64 69 74 69 6f 6e  ed with addition
4e10: 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f  al information o
4e20: 6e 20 74 68 65 20 63 69 70 68 65 72 2e 20 49 66  n the cipher. If
4e30: 20 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 5d   [arg supported]
4e40: 0a 69 73 20 73 70 65 63 69 66 69 65 64 20 61 73  .is specified as
4e50: 20 74 72 75 65 2c 20 74 68 65 6e 20 6f 6e 6c 79   true, then only
4e60: 20 74 68 65 20 63 69 70 68 65 72 73 20 73 75 70   the ciphers sup
4e70: 70 6f 72 74 65 64 20 66 6f 72 20 70 72 6f 74 6f  ported for proto
4e80: 63 6f 6c 20 77 69 6c 6c 20 62 65 20 6c 69 73 74  col will be list
4e90: 65 64 2e 0a 54 68 65 20 5b 61 72 67 20 73 75 70  ed..The [arg sup
4ea0: 70 6f 72 74 65 64 5d 20 61 72 67 20 69 73 20 6e  ported] arg is n
4eb0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
4ec0: 38 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  8...[call [cmd t
4ed0: 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 5d 0a  ls::protocols]].
4ee0: 0a 52 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20  .Returns a list 
4ef0: 6f 66 20 74 68 65 20 73 75 70 70 6f 72 74 65 64  of the supported
4f00: 20 53 53 4c 2f 54 4c 53 20 70 72 6f 74 6f 63 6f   SSL/TLS protoco
4f10: 6c 73 2e 20 56 61 6c 69 64 20 76 61 6c 75 65 73  ls. Valid values
4f20: 20 61 72 65 3a 0a 5b 63 6f 6e 73 74 20 73 73 6c   are:.[const ssl
4f30: 32 5d 2c 20 5b 63 6f 6e 73 74 20 73 73 6c 33 5d  2], [const ssl3]
4f40: 2c 20 5b 63 6f 6e 73 74 20 74 6c 73 31 5d 2c 20  , [const tls1], 
4f50: 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 31 5d 2c 20  [const tls1.1], 
4f60: 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 32 5d 2c 20  [const tls1.2], 
4f70: 61 6e 64 0a 5b 63 6f 6e 73 74 20 74 6c 73 31 2e  and.[const tls1.
4f80: 33 5d 2e 20 45 78 61 63 74 20 6c 69 73 74 20 64  3]. Exact list d
4f90: 65 70 65 6e 64 73 20 6f 6e 20 4f 70 65 6e 53 53  epends on OpenSS
4fa0: 4c 20 76 65 72 73 69 6f 6e 20 61 6e 64 20 63 6f  L version and co
4fb0: 6d 70 69 6c 65 20 74 69 6d 65 20 66 6c 61 67 73  mpile time flags
4fc0: 2e 0a 54 68 69 73 20 63 6f 6d 6d 61 6e 64 20 69  ..This command i
4fd0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
4fe0: 20 31 2e 38 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d   1.8...[call [cm
4ff0: 64 20 74 6c 73 3a 3a 76 65 72 73 69 6f 6e 5d 5d  d tls::version]]
5000: 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 20 4f 70  ..Returns the Op
5010: 65 6e 53 53 4c 20 76 65 72 73 69 6f 6e 20 73 74  enSSL version st
5020: 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  ring...[list_end
5030: 5d 0a 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43 65  ]...[section "Ce
5040: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
5050: 74 69 6f 6e 22 5d 0a 0a 5b 73 75 62 73 65 63 74  tion"]..[subsect
5060: 69 6f 6e 20 22 50 4b 49 20 61 6e 64 20 43 65 72  ion "PKI and Cer
5070: 74 69 66 69 63 61 74 65 73 22 5d 0a 0a 55 73 69  tificates"]..Usi
5080: 6e 67 20 74 68 65 20 50 75 62 6c 69 63 20 4b 65  ng the Public Ke
5090: 79 20 49 6e 66 72 61 73 74 72 75 63 74 75 72 65  y Infrastructure
50a0: 20 28 50 4b 49 29 2c 20 65 61 63 68 20 75 73 65   (PKI), each use
50b0: 72 20 63 72 65 61 74 65 73 20 61 20 70 72 69 76  r creates a priv
50c0: 61 74 65 20 6b 65 79 20 74 68 61 74 0a 6f 6e 6c  ate key that.onl
50d0: 79 20 74 68 65 79 20 6b 6e 6f 77 20 61 62 6f 75  y they know abou
50e0: 74 20 61 6e 64 20 61 20 70 75 62 6c 69 63 20 6b  t and a public k
50f0: 65 79 20 74 68 65 79 20 63 61 6e 20 65 78 63 68  ey they can exch
5100: 61 6e 67 65 20 77 69 74 68 20 6f 74 68 65 72 73  ange with others
5110: 20 66 6f 72 20 75 73 65 20 69 6e 0a 65 6e 63 72   for use in.encr
5120: 79 70 74 69 6e 67 20 61 6e 64 20 64 65 63 72 79  ypting and decry
5130: 70 74 69 6e 67 20 64 61 74 61 2e 20 54 68 65 20  pting data. The 
5140: 70 72 6f 63 65 73 73 20 69 73 20 74 68 65 20 73  process is the s
5150: 65 6e 64 65 72 20 65 6e 63 72 79 70 74 73 20 74  ender encrypts t
5160: 68 65 69 72 20 64 61 74 61 0a 75 73 69 6e 67 20  heir data.using 
5170: 74 68 65 69 72 20 70 72 69 76 61 74 65 20 6b 65  their private ke
5180: 79 20 61 6e 64 20 74 68 65 20 72 65 63 65 69 76  y and the receiv
5190: 65 72 27 73 20 70 75 62 6c 69 63 20 6b 65 79 2e  er's public key.
51a0: 20 54 68 65 20 64 61 74 61 20 69 73 20 74 68 65   The data is the
51b0: 6e 20 73 65 6e 74 0a 74 6f 20 74 68 65 20 72 65  n sent.to the re
51c0: 63 65 69 76 65 72 2e 20 49 6e 20 61 20 73 69 6d  ceiver. In a sim
51d0: 69 6c 61 72 20 6d 61 6e 6e 65 72 2c 20 74 68 65  ilar manner, the
51e0: 20 72 65 63 65 69 76 65 72 20 75 73 65 73 20 74   receiver uses t
51f0: 68 65 69 72 20 70 72 69 76 61 74 65 20 6b 65 79  heir private key
5200: 20 61 6e 64 0a 74 68 65 20 73 65 6e 64 65 72 27   and.the sender'
5210: 73 20 70 75 62 6c 69 63 20 6b 65 79 20 74 6f 20  s public key to 
5220: 64 65 63 72 79 70 74 20 74 68 65 20 64 61 74 61  decrypt the data
5230: 2e 20 54 68 69 73 20 70 72 6f 76 69 64 65 73 20  . This provides 
5240: 64 61 74 61 20 69 6e 74 65 67 72 69 74 79 2c 20  data integrity, 
5250: 74 6f 0a 65 6e 73 75 72 65 20 74 68 65 20 64 61  to.ensure the da
5260: 74 61 20 63 61 6e 27 74 20 62 65 20 76 69 65 77  ta can't be view
5270: 65 64 20 6f 72 20 61 6c 74 65 72 65 64 20 64 75  ed or altered du
5280: 72 69 6e 67 20 74 72 61 6e 73 70 6f 72 74 2e 20  ring transport. 
5290: 53 65 65 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20  See the.[option 
52a0: 2d 6b 65 79 5d 20 61 6e 64 20 5b 6f 70 74 69 6f  -key] and [optio
52b0: 6e 20 2d 6b 65 79 66 69 6c 65 5d 20 6f 70 74 69  n -keyfile] opti
52c0: 6f 6e 73 20 66 6f 72 20 68 6f 77 20 74 6f 20 73  ons for how to s
52d0: 70 65 63 69 66 79 20 74 68 65 20 70 72 69 76 61  pecify the priva
52e0: 74 65 20 6b 65 79 2e 0a 41 6c 73 6f 20 73 65 65  te key..Also see
52f0: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 61   the [option -pa
5300: 73 73 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 20 66  ssword] option f
5310: 6f 72 20 68 6f 77 20 74 6f 20 70 72 6f 76 69 64  or how to provid
5320: 65 20 74 68 65 20 70 61 73 73 77 6f 72 64 2e 0a  e the password..
5330: 5b 70 61 72 61 5d 0a 49 6e 20 6f 72 64 65 72 20  [para].In order 
5340: 74 6f 20 70 72 6f 76 69 64 65 20 61 75 74 68 65  to provide authe
5350: 6e 74 69 63 61 74 69 6f 6e 2c 20 69 2e 65 2e 20  ntication, i.e. 
5360: 65 6e 73 75 72 69 6e 67 20 73 6f 6d 65 6f 6e 65  ensuring someone
5370: 20 69 73 20 77 68 6f 20 74 68 65 79 20 73 61 79   is who they say
5380: 20 74 68 65 79 0a 61 72 65 2c 20 74 68 65 20 70   they.are, the p
5390: 75 62 6c 69 63 20 6b 65 79 20 61 6e 64 20 75 73  ublic key and us
53a0: 65 72 20 69 64 65 6e 74 69 66 69 63 61 74 69 6f  er identificatio
53b0: 6e 20 69 6e 66 6f 20 69 73 20 73 74 6f 72 65 64  n info is stored
53c0: 20 69 6e 20 61 20 58 2e 35 30 39 0a 63 65 72 74   in a X.509.cert
53d0: 69 66 69 63 61 74 65 20 61 6e 64 20 74 68 61 74  ificate and that
53e0: 20 63 65 72 74 69 66 69 63 61 74 65 20 69 73 20   certificate is 
53f0: 61 75 74 68 65 6e 74 69 63 61 74 65 64 20 28 69  authenticated (i
5400: 2e 65 2e 20 73 69 67 6e 65 64 29 20 62 79 20 61  .e. signed) by a
5410: 20 43 65 72 74 69 66 69 63 61 74 65 0a 41 75 74   Certificate.Aut
5420: 68 6f 72 69 74 79 20 28 43 41 29 2e 20 55 73 65  hority (CA). Use
5430: 72 73 20 63 61 6e 20 74 68 65 6e 20 65 78 63 68  rs can then exch
5440: 61 6e 67 65 20 74 68 65 73 65 20 63 65 72 74 69  ange these certi
5450: 66 69 63 61 74 65 73 20 64 75 72 69 6e 67 20 74  ficates during t
5460: 68 65 20 54 4c 53 0a 69 6e 69 74 69 61 6c 69 7a  he TLS.initializ
5470: 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 61 6e  ation process an
5480: 64 20 63 68 65 63 6b 20 74 68 65 6d 20 61 67 61  d check them aga
5490: 69 6e 73 74 20 74 68 65 20 72 6f 6f 74 20 43 41  inst the root CA
54a0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f   certificates to
54b0: 20 65 6e 73 75 72 65 0a 74 68 65 79 20 61 72 65   ensure.they are
54c0: 20 76 61 6c 69 64 2e 20 54 68 69 73 20 69 73 20   valid. This is 
54d0: 68 61 6e 64 6c 65 64 20 62 79 20 4f 70 65 6e 53  handled by OpenS
54e0: 53 4c 20 76 69 61 20 74 68 65 20 5b 6f 70 74 69  SL via the [opti
54f0: 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 61 6e 64  on -request] and
5500: 0a 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 72  .[option -requir
5510: 65 5d 20 6f 70 74 69 6f 6e 73 2e 20 53 65 65 20  e] options. See 
5520: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  the [option -cad
5530: 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  ir], [option -ca
5540: 64 69 72 5d 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f  dir], and.[optio
5550: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69  n -castore] opti
5560: 6f 6e 73 20 66 6f 72 20 68 6f 77 20 74 70 20 73  ons for how tp s
5570: 70 65 63 69 66 79 20 77 68 65 72 65 20 74 6f 20  pecify where to 
5580: 66 69 6e 64 20 74 68 65 20 43 41 20 63 65 72 74  find the CA cert
5590: 69 66 69 63 61 74 65 73 2e 0a 4f 70 74 69 6f 6e  ificates..Option
55a0: 61 6c 6c 79 2c 20 69 6e 20 61 20 66 75 74 75 72  ally, in a futur
55b0: 65 20 72 65 6c 65 61 73 65 2c 20 74 68 65 79 20  e release, they 
55c0: 63 61 6e 20 61 6c 73 6f 20 62 65 20 63 68 65 63  can also be chec
55d0: 6b 65 64 20 61 67 61 69 6e 73 74 20 74 68 65 20  ked against the 
55e0: 43 65 72 74 69 66 69 63 61 74 65 0a 52 65 76 6f  Certificate.Revo
55f0: 63 61 74 69 6f 6e 20 4c 69 73 74 20 28 43 52 4c  cation List (CRL
5600: 29 20 6f 66 20 72 65 76 6f 6b 65 64 20 63 65 72  ) of revoked cer
5610: 74 69 66 69 63 61 74 65 73 2e 20 43 65 72 74 69  tificates. Certi
5620: 66 69 63 61 74 65 73 20 63 61 6e 20 61 6c 73 6f  ficates can also
5630: 20 62 65 0a 73 65 6c 66 2d 73 69 67 6e 65 64 2c   be.self-signed,
5640: 20 62 75 74 20 74 68 65 79 20 61 72 65 20 62 79   but they are by
5650: 20 64 65 66 61 75 6c 74 20 6e 6f 74 20 74 72 75   default not tru
5660: 73 74 65 64 20 75 6e 6c 65 73 73 20 79 6f 75 20  sted unless you 
5670: 61 64 64 20 74 68 65 6d 20 74 6f 20 79 6f 75 72  add them to your
5680: 0a 63 65 72 74 69 66 69 63 61 74 65 20 73 74 6f  .certificate sto
5690: 72 65 2e 0a 5b 70 61 72 61 5d 0a 54 79 70 69 63  re..[para].Typic
56a0: 61 6c 6c 79 20 77 68 65 6e 20 76 69 73 69 74 69  ally when visiti
56b0: 6e 67 20 77 65 62 20 73 69 74 65 73 2c 20 6f 6e  ng web sites, on
56c0: 6c 79 20 74 68 65 20 63 6c 69 65 6e 74 20 6e 65  ly the client ne
56d0: 65 64 73 20 74 6f 20 63 68 65 63 6b 20 74 68 65  eds to check the
56e0: 20 73 65 72 76 65 72 27 73 0a 63 65 72 74 69 66   server's.certif
56f0: 69 63 61 74 65 20 74 6f 20 65 6e 73 75 72 65 20  icate to ensure 
5700: 69 74 20 69 73 20 76 61 6c 69 64 2e 20 54 68 65  it is valid. The
5710: 20 73 65 72 76 65 72 20 64 6f 65 73 6e 27 74 20   server doesn't 
5720: 6e 65 65 64 20 74 6f 20 63 68 65 63 6b 20 74 68  need to check th
5730: 65 20 63 6c 69 65 6e 74 0a 63 65 72 74 69 66 69  e client.certifi
5740: 63 61 74 65 20 75 6e 6c 65 73 73 20 79 6f 75 20  cate unless you 
5750: 6e 65 65 64 20 74 6f 20 61 75 74 68 65 6e 74 69  need to authenti
5760: 63 61 74 65 20 77 69 74 68 20 74 68 65 6d 20 74  cate with them t
5770: 6f 20 6c 6f 67 69 6e 2c 20 65 74 63 2e 20 53 65  o login, etc. Se
5780: 65 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63  e the.[option -c
5790: 65 72 74 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e  ert] and [option
57a0: 20 2d 63 65 72 74 66 69 6c 65 5d 20 6f 70 74 69   -certfile] opti
57b0: 6f 6e 73 20 69 66 20 79 6f 75 20 6e 65 65 64 20  ons if you need 
57c0: 74 6f 20 70 72 6f 76 69 64 65 20 61 20 63 65 72  to provide a cer
57d0: 74 69 66 69 63 61 74 65 2e 0a 0a 0a 5b 73 75 62  tificate....[sub
57e0: 73 65 63 74 69 6f 6e 20 22 53 75 6d 6d 61 72 79  section "Summary
57f0: 20 6f 66 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65   of command line
5800: 20 6f 70 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 20   options"]..The 
5810: 66 6f 6c 6c 6f 77 69 6e 67 20 6f 70 74 69 6f 6e  following option
5820: 73 20 61 72 65 20 75 73 65 64 20 66 6f 72 20 70  s are used for p
5830: 65 65 72 20 63 65 72 74 69 66 69 63 61 74 65 20  eer certificate 
5840: 76 61 6c 69 64 61 74 69 6f 6e 3a 0a 0a 5b 6c 69  validation:..[li
5850: 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73  st_begin options
5860: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64  ]..[opt_def -cad
5870: 69 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72  ir [arg director
5880: 79 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  y]].Specifies th
5890: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72  e directory wher
58a0: 65 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  e the Certificat
58b0: 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e Authority (CA)
58c0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72   certificates ar
58d0: 65 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65  e.stored. The de
58e0: 66 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72  fault is platfor
58f0: 6d 20 73 70 65 63 69 66 69 63 2c 20 62 75 74 20  m specific, but 
5900: 69 73 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65  is usually [file
5910: 20 2f 65 74 63 2f 73 73 6c 2f 63 65 72 74 73 5d   /etc/ssl/certs]
5920: 20 6f 6e 0a 4c 69 6e 75 78 2f 55 6e 69 78 20 73   on.Linux/Unix s
5930: 79 73 74 65 6d 73 2e 20 54 68 65 20 64 65 66 61  ystems. The defa
5940: 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63 61 6e  ult location can
5950: 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62   be overridden b
5960: 79 20 74 68 65 0a 5b 76 61 72 20 53 53 4c 5f 43  y the.[var SSL_C
5970: 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72 6f 6e  ERT_DIR] environ
5980: 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 2e 0a 0a  ment variable...
5990: 5b 6f 70 74 5f 64 65 66 20 2d 63 61 66 69 6c 65  [opt_def -cafile
59a0: 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d   [arg filename]]
59b0: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 66  .Specifies the f
59c0: 69 6c 65 20 77 69 74 68 20 74 68 65 20 43 65 72  ile with the Cer
59d0: 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69  tificate Authori
59e0: 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69 63  ty (CA) certific
59f0: 61 74 65 73 20 74 6f 20 75 73 65 20 69 6e 0a 5b  ates to use in.[
5a00: 63 6f 6e 73 74 20 50 45 4d 5d 20 66 69 6c 65 20  const PEM] file 
5a10: 66 6f 72 6d 61 74 2e 20 54 68 65 20 64 65 66 61  format. The defa
5a20: 75 6c 74 20 69 73 20 5b 66 69 6c 65 20 63 65 72  ult is [file cer
5a30: 74 2e 70 65 6d 5d 2c 20 69 6e 20 74 68 65 20 4f  t.pem], in the O
5a40: 70 65 6e 53 53 4c 0a 64 69 72 65 63 74 6f 72 79  penSSL.directory
5a50: 2e 20 4f 6e 20 4c 69 6e 75 78 2f 55 6e 69 78 20  . On Linux/Unix 
5a60: 73 79 73 74 65 6d 73 2c 20 74 68 69 73 20 69 73  systems, this is
5a70: 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20 2f   usually [file /
5a80: 65 74 63 2f 73 73 6c 2f 63 61 2d 62 75 6e 64 6c  etc/ssl/ca-bundl
5a90: 65 2e 70 65 6d 5d 2e 0a 54 68 65 20 64 65 66 61  e.pem]..The defa
5aa0: 75 6c 74 20 66 69 6c 65 20 63 61 6e 20 62 65 20  ult file can be 
5ab0: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68  overridden by th
5ac0: 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  e [var SSL_CERT_
5ad0: 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e  FILE] environmen
5ae0: 74 0a 76 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70  t.variable...[op
5af0: 74 5f 64 65 66 20 2d 63 61 73 74 6f 72 65 20 5b  t_def -castore [
5b00: 61 72 67 20 55 52 49 5d 5d 0a 53 70 65 63 69 66  arg URI]].Specif
5b10: 69 65 73 20 74 68 65 20 55 6e 69 66 6f 72 6d 20  ies the Uniform 
5b20: 52 65 73 6f 75 72 63 65 20 49 64 65 6e 74 69 66  Resource Identif
5b30: 69 65 72 20 28 55 52 49 29 20 66 6f 72 20 74 68  ier (URI) for th
5b40: 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  e Certificate Au
5b50: 74 68 6f 72 69 74 79 0a 28 43 41 29 20 73 74 6f  thority.(CA) sto
5b60: 72 65 2c 20 77 68 69 63 68 20 6d 61 79 20 62 65  re, which may be
5b70: 20 61 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61 69   a single contai
5b80: 6e 65 72 20 6f 72 20 61 20 63 61 74 61 6c 6f 67  ner or a catalog
5b90: 20 6f 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e 0a   of containers..
5ba0: 53 74 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70  Starting with Op
5bb0: 65 6e 53 53 4c 20 33 2e 32 20 6f 6e 20 4d 53 20  enSSL 3.2 on MS 
5bc0: 57 69 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20  Windows, set to 
5bd0: 22 5b 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65  "[const "org.ope
5be0: 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f  nssl.winstore://
5bf0: 22 5d 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62  "]".to use the b
5c00: 75 69 6c 74 2d 69 6e 20 4d 53 20 57 69 6e 64 6f  uilt-in MS Windo
5c10: 77 73 20 43 65 72 74 69 66 69 63 61 74 65 20 53  ws Certificate S
5c20: 74 6f 72 65 2e 20 53 74 61 72 74 69 6e 67 20 69  tore. Starting i
5c30: 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68  n TclTLS 2.0, th
5c40: 69 73 0a 69 73 20 74 68 65 20 64 65 66 61 75 6c  is.is the defaul
5c50: 74 20 69 66 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  t if [option -ca
5c60: 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63  dir], [option -c
5c70: 61 64 69 72 5d 2c 20 61 6e 64 20 5b 6f 70 74 69  adir], and [opti
5c80: 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 61 72 65  on -castore] are
5c90: 0a 6e 6f 74 20 73 70 65 63 69 66 69 65 64 2e 20  .not specified. 
5ca0: 54 68 69 73 20 73 74 6f 72 65 20 6f 6e 6c 79 20  This store only 
5cb0: 73 75 70 70 6f 72 74 73 20 72 6f 6f 74 20 63 65  supports root ce
5cc0: 72 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 73  rtificate stores
5cd0: 2e 20 53 65 65 0a 5b 73 65 63 74 72 65 66 20 22  . See.[sectref "
5ce0: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
5cf0: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72  dation"] for mor
5d00: 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74  e details...[opt
5d10: 5f 64 65 66 20 2d 72 65 71 75 65 73 74 20 5b 61  _def -request [a
5d20: 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 65 73  rg bool]].Reques
5d30: 74 20 61 20 63 65 72 74 69 66 69 63 61 74 65 20  t a certificate 
5d40: 66 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64 75  from the peer du
5d50: 72 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61 6e  ring the SSL han
5d60: 64 73 68 61 6b 65 2e 20 54 68 69 73 20 69 73 20  dshake. This is 
5d70: 6e 65 65 64 65 64 0a 74 6f 20 64 6f 20 43 65 72  needed.to do Cer
5d80: 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74  tificate Validat
5d90: 69 6f 6e 2e 20 53 74 61 72 74 69 6e 67 20 69 6e  ion. Starting in
5da0: 20 54 63 6c 54 4c 53 20 31 2e 38 2c 20 74 68 65   TclTLS 1.8, the
5db0: 20 64 65 66 61 75 6c 74 20 69 73 0a 5b 63 6f 6e   default is.[con
5dc0: 73 74 20 74 72 75 65 5d 2e 20 53 74 61 72 74 69  st true]. Starti
5dd0: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30  ng in TclTLS 2.0
5de0: 2c 20 49 66 20 73 65 74 20 74 6f 20 5b 63 6f 6e  , If set to [con
5df0: 73 74 20 66 61 6c 73 65 5d 20 61 6e 64 0a 5b 6f  st false] and.[o
5e00: 70 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20  ption -require] 
5e10: 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2c  is [const true],
5e20: 20 74 68 65 6e 20 74 68 69 73 20 77 69 6c 6c 20   then this will 
5e30: 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 74 6f  be overridden to
5e40: 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 0a 49   [const true]..I
5e50: 6e 20 61 64 64 69 74 69 6f 6e 2c 20 74 68 65 20  n addition, the 
5e60: 63 6c 69 65 6e 74 20 63 61 6e 20 6d 61 6e 75 61  client can manua
5e70: 6c 6c 79 20 69 6e 73 70 65 63 74 20 61 6e 64 20  lly inspect and 
5e80: 61 63 63 65 70 74 20 6f 72 20 72 65 6a 65 63 74  accept or reject
5e90: 0a 65 61 63 68 20 63 65 72 74 69 66 69 63 61 74  .each certificat
5ea0: 65 20 75 73 69 6e 67 20 74 68 65 20 5b 61 72 67  e using the [arg
5eb0: 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e   -validatecomman
5ec0: 64 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74  d] option...[opt
5ed0: 5f 64 65 66 20 2d 72 65 71 75 69 72 65 20 5b 61  _def -require [a
5ee0: 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 69 72  rg bool]].Requir
5ef0: 65 20 61 20 76 61 6c 69 64 20 63 65 72 74 69 66  e a valid certif
5f00: 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70  icate from the p
5f10: 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53  eer during the S
5f20: 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66  SL handshake. If
5f30: 20 74 68 69 73 20 69 73 0a 73 65 74 20 74 6f 20   this is.set to 
5f40: 74 72 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74 69  true, then [opti
5f50: 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 6d 75 73  on -request] mus
5f60: 74 20 61 6c 73 6f 20 62 65 20 73 65 74 20 74 6f  t also be set to
5f70: 20 74 72 75 65 20 61 6e 64 20 61 20 65 69 74 68   true and a eith
5f80: 65 72 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  er.[option -cadi
5f90: 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66  r], [option -caf
5fa0: 69 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63  ile], [option -c
5fb0: 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70 6c  astore], or a pl
5fc0: 61 74 66 6f 72 6d 20 64 65 66 61 75 6c 74 0a 6d  atform default.m
5fd0: 75 73 74 20 62 65 20 70 72 6f 76 69 64 65 64 20  ust be provided 
5fe0: 69 6e 20 6f 72 64 65 72 20 74 6f 20 76 61 6c 69  in order to vali
5ff0: 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20 54 68  date against. Th
6000: 65 20 64 65 66 61 75 6c 74 20 69 6e 20 54 63 6c  e default in Tcl
6010: 54 4c 53 20 31 2e 38 20 61 6e 64 0a 65 61 72 6c  TLS 1.8 and.earl
6020: 69 65 72 20 76 65 72 73 69 6f 6e 73 20 69 73 20  ier versions is 
6030: 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69  [const false] si
6040: 6e 63 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61 74  nce not all plat
6050: 66 6f 72 6d 73 20 68 61 76 65 20 63 65 72 74 69  forms have certi
6060: 66 69 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64  ficates to.valid
6070: 61 74 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61  ate against in a
6080: 20 66 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65   form compatible
6090: 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 2e 20 53   with OpenSSL. S
60a0: 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c  tarting in TclTL
60b0: 53 20 32 2e 30 2c 0a 74 68 65 20 64 65 66 61 75  S 2.0,.the defau
60c0: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75  lt is [const tru
60d0: 65 5d 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  e]...[list_end].
60e0: 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 57 68  .[subsection "Wh
60f0: 65 6e 20 61 72 65 20 63 6f 6d 6d 61 6e 64 20 6c  en are command l
6100: 69 6e 65 20 6f 70 74 69 6f 6e 73 20 6e 65 65 64  ine options need
6110: 65 64 3f 22 5d 0a 0a 49 6e 20 54 63 6c 54 4c 53  ed?"]..In TclTLS
6120: 20 31 2e 38 20 61 6e 64 20 65 61 72 6c 69 65 72   1.8 and earlier
6130: 20 76 65 72 73 69 6f 6e 73 2c 20 63 65 72 74 69   versions, certi
6140: 66 69 63 61 74 65 20 76 61 6c 69 64 61 74 69 6f  ficate validatio
6150: 6e 20 69 73 0a 5b 65 6d 70 68 20 4e 4f 54 5d 20  n is.[emph NOT] 
6160: 65 6e 61 62 6c 65 64 20 62 79 20 64 65 66 61 75  enabled by defau
6170: 6c 74 2e 20 54 68 69 73 20 6c 69 6d 69 74 61 74  lt. This limitat
6180: 69 6f 6e 20 69 73 20 64 75 65 20 74 6f 20 74 68  ion is due to th
6190: 65 20 6c 61 63 6b 20 6f 66 20 61 20 63 6f 6d 6d  e lack of a comm
61a0: 6f 6e 0a 63 72 6f 73 73 20 70 6c 61 74 66 6f 72  on.cross platfor
61b0: 6d 20 64 61 74 61 62 61 73 65 20 6f 66 20 43 65  m database of Ce
61c0: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
61d0: 69 74 79 20 28 43 41 29 20 70 72 6f 76 69 64 65  ity (CA) provide
61e0: 64 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74  d certificates t
61f0: 6f 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e  o.validate again
6200: 73 74 2e 20 4d 61 6e 79 20 4c 69 6e 75 78 20 73  st. Many Linux s
6210: 79 73 74 65 6d 73 20 6e 61 74 69 76 65 6c 79 20  ystems natively 
6220: 73 75 70 70 6f 72 74 20 4f 70 65 6e 53 53 4c 20  support OpenSSL 
6230: 61 6e 64 20 74 68 75 73 20 68 61 76 65 0a 74 68  and thus have.th
6240: 65 73 65 20 63 65 72 74 69 66 69 63 61 74 65 73  ese certificates
6250: 20 69 6e 73 74 61 6c 6c 65 64 20 61 73 20 70 61   installed as pa
6260: 72 74 20 6f 66 20 74 68 65 20 4f 53 2c 20 62 75  rt of the OS, bu
6270: 74 20 4d 61 63 4f 53 20 61 6e 64 20 4d 53 20 57  t MacOS and MS W
6280: 69 6e 64 6f 77 73 20 64 6f 20 6e 6f 74 2e 0a 53  indows do not..S
6290: 74 61 72 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53  taring in TclTLS
62a0: 20 32 2e 30 2c 20 74 68 69 73 20 68 61 73 20 62   2.0, this has b
62b0: 65 65 6e 20 63 68 61 6e 67 65 64 20 74 6f 20 72  een changed to r
62c0: 65 71 75 69 72 65 20 63 65 72 74 69 66 69 63 61  equire certifica
62d0: 74 65 20 76 61 6c 69 64 61 74 69 6f 6e 0a 62 79  te validation.by
62e0: 20 64 65 66 61 75 6c 74 2e 20 49 6e 20 6f 72 64   default. In ord
62f0: 65 72 20 74 6f 20 75 73 65 20 74 68 65 20 5b 6f  er to use the [o
6300: 70 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20  ption -require] 
6310: 6f 70 74 69 6f 6e 2c 20 6f 6e 65 20 6f 66 20 74  option, one of t
6320: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 6d 75 73  he following.mus
6330: 74 20 62 65 20 74 72 75 65 3a 0a 0a 5b 6c 69 73  t be true:..[lis
6340: 74 5f 62 65 67 69 6e 20 69 74 65 6d 69 7a 65 64  t_begin itemized
6350: 5d 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20 4c 69 6e  ]..[item].On Lin
6360: 75 78 20 61 6e 64 20 55 6e 69 78 20 73 79 73 74  ux and Unix syst
6370: 65 6d 73 20 77 69 74 68 20 4f 70 65 6e 53 53 4c  ems with OpenSSL
6380: 20 61 6c 72 65 61 64 79 20 69 6e 73 74 61 6c 6c   already install
6390: 65 64 20 6f 72 20 69 66 20 74 68 65 20 43 41 0a  ed or if the CA.
63a0: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65  certificates are
63b0: 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 50 45   available in PE
63c0: 4d 20 66 6f 72 6d 61 74 2c 20 61 6e 64 20 69 66  M format, and if
63d0: 20 74 68 65 79 20 61 72 65 20 73 74 6f 72 65 64   they are stored
63e0: 20 69 6e 20 74 68 65 0a 73 74 61 6e 64 61 72 64   in the.standard
63f0: 20 6c 6f 63 61 74 69 6f 6e 73 2c 20 6f 72 20 69   locations, or i
6400: 66 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43  f the [var SSL_C
6410: 45 52 54 5f 44 49 52 5d 20 6f 72 20 5b 76 61 72  ERT_DIR] or [var
6420: 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 0a   SSL_CERT_FILE].
6430: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69  environment vari
6440: 61 62 6c 65 73 20 61 72 65 20 73 65 74 2c 20 74  ables are set, t
6450: 68 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  hen [option -cad
6460: 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  ir], [option -ca
6470: 64 69 72 5d 2c 0a 61 6e 64 20 5b 6f 70 74 69 6f  dir],.and [optio
6480: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 61 72 65 6e  n -castore] aren
6490: 27 74 20 6e 65 65 64 65 64 2e 0a 0a 5b 69 74 65  't needed...[ite
64a0: 6d 5d 0a 49 66 20 4f 70 65 6e 53 53 4c 20 69 73  m].If OpenSSL is
64b0: 20 6e 6f 74 20 69 6e 73 74 61 6c 6c 65 64 20 69   not installed i
64c0: 6e 20 74 68 65 20 64 65 66 61 75 6c 74 20 6c 6f  n the default lo
64d0: 63 61 74 69 6f 6e 2c 20 6f 72 20 77 68 65 6e 20  cation, or when 
64e0: 75 73 69 6e 67 20 4d 61 63 20 4f 53 0a 6f 72 20  using Mac OS.or 
64f0: 4d 53 20 57 69 6e 64 6f 77 73 20 61 6e 64 20 4f  MS Windows and O
6500: 70 65 6e 53 53 4c 20 69 73 20 69 6e 73 74 61 6c  penSSL is instal
6510: 6c 65 64 2c 20 74 68 65 20 5b 76 61 72 20 53 53  led, the [var SS
6520: 4c 5f 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f  L_CERT_DIR] and/
6530: 6f 72 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54  or.[var SSL_CERT
6540: 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65  _FILE] environme
6550: 6e 74 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20  nt variables or 
6560: 74 68 65 20 6f 6e 65 20 6f 66 20 74 68 65 20 5b  the one of the [
6570: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a  option -cadir],.
6580: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c  [option -cadir],
6590: 20 6f 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73   or [option -cas
65a0: 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20 6d 75  tore] options mu
65b0: 73 74 20 62 65 20 64 65 66 69 6e 65 64 2e 0a 0a  st be defined...
65c0: 5b 69 74 65 6d 5d 0a 4f 6e 20 4d 53 20 57 69 6e  [item].On MS Win
65d0: 64 6f 77 73 2c 20 73 74 61 72 74 69 6e 67 20 69  dows, starting i
65e0: 6e 20 4f 70 65 6e 53 53 4c 20 33 2e 32 2c 20 69  n OpenSSL 3.2, i
65f0: 74 20 69 73 20 6e 6f 77 20 70 6f 73 73 69 62 6c  t is now possibl
6600: 65 20 74 6f 20 61 63 63 65 73 73 20 74 68 65 0a  e to access the.
6610: 62 75 69 6c 74 2d 69 6e 20 57 69 6e 64 6f 77 73  built-in Windows
6620: 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74 6f   Certificate Sto
6630: 72 65 20 66 72 6f 6d 20 4f 70 65 6e 53 53 4c 2e  re from OpenSSL.
6640: 20 54 68 69 73 20 63 61 6e 20 75 74 69 6c 69 7a   This can utiliz
6650: 65 64 20 62 79 0a 73 65 74 74 69 6e 67 20 74 68  ed by.setting th
6660: 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  e [option -casto
6670: 72 65 5d 20 6f 70 74 69 6f 6e 20 74 6f 20 22 5b  re] option to "[
6680: 63 6f 6e 73 74 20 6f 72 67 2e 6f 70 65 6e 73 73  const org.openss
6690: 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 5d 22 2e  l.winstore://]".
66a0: 0a 49 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20  .In TclTLS 2.0, 
66b0: 74 68 69 73 20 69 73 20 74 68 65 20 64 65 66 61  this is the defa
66c0: 75 6c 74 20 76 61 6c 75 65 20 69 66 20 5b 6f 70  ult value if [op
66d0: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f  tion -cadir],.[o
66e0: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61  ption -cadir], a
66f0: 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74  nd [option -cast
6700: 6f 72 65 5d 20 61 72 65 20 6e 6f 74 20 73 70 65  ore] are not spe
6710: 63 69 66 69 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a  cified...[item].
6720: 49 66 20 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f  If OpenSSL is no
6730: 74 20 69 6e 73 74 61 6c 6c 65 64 20 6f 72 20 74  t installed or t
6740: 68 65 20 43 41 20 63 65 72 74 69 66 69 63 61 74  he CA certificat
6750: 65 73 20 61 72 65 20 6e 6f 74 20 61 76 61 69 6c  es are not avail
6760: 61 62 6c 65 20 69 6e 20 50 45 4d 0a 66 6f 72 6d  able in PEM.form
6770: 61 74 2c 20 74 68 65 20 43 41 20 63 65 72 74 69  at, the CA certi
6780: 66 69 63 61 74 65 73 20 6d 75 73 74 20 62 65 20  ficates must be 
6790: 64 6f 77 6e 6c 6f 61 64 65 64 20 61 6e 64 20 69  downloaded and i
67a0: 6e 73 74 61 6c 6c 65 64 20 77 69 74 68 20 74 68  nstalled with th
67b0: 65 20 75 73 65 72 0a 73 6f 66 74 77 61 72 65 2e  e user.software.
67c0: 20 54 68 65 20 43 55 52 4c 20 74 65 61 6d 20 6d   The CURL team m
67d0: 61 6b 65 73 20 74 68 65 6d 20 61 76 61 69 6c 61  akes them availa
67e0: 62 6c 65 20 61 74 0a 5b 75 72 69 20 22 68 74 74  ble at.[uri "htt
67f0: 70 73 3a 2f 2f 63 75 72 6c 2e 73 65 2f 64 6f 63  ps://curl.se/doc
6800: 73 2f 63 61 65 78 74 72 61 63 74 2e 68 74 6d 6c  s/caextract.html
6810: 22 20 22 43 41 20 63 65 72 74 69 66 69 63 61 74  " "CA certificat
6820: 65 73 20 65 78 74 72 61 63 74 65 64 0a 66 72 6f  es extracted.fro
6830: 6d 20 4d 6f 7a 69 6c 6c 61 22 5d 20 69 6e 20 74  m Mozilla"] in t
6840: 68 65 20 5b 66 69 6c 65 20 63 61 63 65 72 74 2e  he [file cacert.
6850: 70 65 6d 5d 20 66 69 6c 65 2e 20 59 6f 75 20 6d  pem] file. You m
6860: 75 73 74 20 74 68 65 6e 20 65 69 74 68 65 72 20  ust then either 
6870: 73 65 74 20 74 68 65 0a 5b 76 61 72 20 53 53 4c  set the.[var SSL
6880: 5f 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f 6f  _CERT_DIR] and/o
6890: 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  r [var SSL_CERT_
68a0: 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e  FILE] environmen
68b0: 74 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20 74  t variables or t
68c0: 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  he.[option -cadi
68d0: 72 5d 20 6f 72 20 5b 6f 70 74 69 6f 6e 20 2d 63  r] or [option -c
68e0: 61 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20 74  afile] options t
68f0: 6f 20 74 68 65 20 43 41 20 63 65 72 74 20 66 69  o the CA cert fi
6900: 6c 65 27 73 20 69 6e 73 74 61 6c 6c 0a 6c 6f 63  le's install.loc
6910: 61 74 69 6f 6e 2e 20 49 74 20 69 73 20 79 6f 75  ation. It is you
6920: 72 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79  r responsibility
6930: 20 74 6f 20 6b 65 65 70 20 74 68 69 73 20 66 69   to keep this fi
6940: 6c 65 20 75 70 20 74 6f 20 64 61 74 65 2e 0a 0a  le up to date...
6950: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 65 63  [list_end]..[sec
6960: 74 69 6f 6e 20 22 43 61 6c 6c 62 61 63 6b 20 4f  tion "Callback O
6970: 70 74 69 6f 6e 73 22 5d 0a 0a 41 73 20 70 72 65  ptions"]..As pre
6980: 76 69 6f 75 73 6c 79 20 64 65 73 63 72 69 62 65  viously describe
6990: 64 2c 20 65 61 63 68 20 63 68 61 6e 6e 65 6c 20  d, each channel 
69a0: 63 61 6e 20 62 65 20 67 69 76 65 6e 20 74 68 65  can be given the
69b0: 69 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 73  ir own callbacks
69c0: 0a 74 6f 20 68 61 6e 64 6c 65 20 69 6e 74 65 72  .to handle inter
69d0: 6d 65 64 69 61 74 65 20 70 72 6f 63 65 73 73 69  mediate processi
69e0: 6e 67 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53  ng by the OpenSS
69f0: 4c 20 6c 69 62 72 61 72 79 2c 20 75 73 69 6e 67  L library, using
6a00: 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f   the.[option -co
6a10: 6d 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20  mmand], [option 
6a20: 2d 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 20  -password], and 
6a30: 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74  [option -validat
6a40: 65 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f  e_command] optio
6a50: 6e 73 0a 70 61 73 73 65 64 20 74 6f 20 65 69 74  ns.passed to eit
6a60: 68 65 72 20 6f 66 20 5b 63 6d 64 20 74 6c 73 3a  her of [cmd tls:
6a70: 3a 73 6f 63 6b 65 74 5d 20 6f 72 20 5b 63 6d 64  :socket] or [cmd
6a80: 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e 0a 55   tls::import]..U
6a90: 6e 6c 69 6b 65 20 70 72 65 76 69 6f 75 73 20 76  nlike previous v
6aa0: 65 72 73 69 6f 6e 73 20 6f 66 20 54 63 6c 54 4c  ersions of TclTL
6ab0: 53 2c 20 6f 6e 6c 79 20 69 66 20 74 68 65 20 63  S, only if the c
6ac0: 61 6c 6c 62 61 63 6b 20 67 65 6e 65 72 61 74 65  allback generate
6ad0: 73 20 61 6e 20 65 72 72 6f 72 2c 0a 77 69 6c 6c  s an error,.will
6ae0: 20 74 68 65 20 5b 73 79 73 63 6d 64 20 62 67 65   the [syscmd bge
6af0: 72 72 6f 72 5d 20 63 6f 6d 6d 61 6e 64 20 62 65  rror] command be
6b00: 20 69 6e 76 6f 6b 65 64 20 77 69 74 68 20 74 68   invoked with th
6b10: 65 20 65 72 72 6f 72 20 69 6e 66 6f 72 6d 61 74  e error informat
6b20: 69 6f 6e 2e 0a 0a 5b 73 75 62 73 65 63 74 69 6f  ion...[subsectio
6b30: 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 20 43 6f  n "Values for Co
6b40: 6d 6d 61 6e 64 20 43 61 6c 6c 62 61 63 6b 22 5d  mmand Callback"]
6b50: 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 66  ..The callback f
6b60: 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  or the [option -
6b70: 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 20  command] option 
6b80: 69 73 20 69 6e 76 6f 6b 65 64 20 61 74 20 73 65  is invoked at se
6b90: 76 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75 72  veral points dur
6ba0: 69 6e 67 20 74 68 65 0a 4f 70 65 6e 53 53 4c 20  ing the.OpenSSL 
6bb0: 68 61 6e 64 73 68 61 6b 65 20 61 6e 64 20 64 75  handshake and du
6bc0: 72 69 6e 67 20 72 6f 75 74 69 6e 65 20 6f 70 65  ring routine ope
6bd0: 72 61 74 69 6f 6e 73 2e 20 53 65 65 20 62 65 6c  rations. See bel
6be0: 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69  ow for the possi
6bf0: 62 6c 65 0a 61 72 67 75 6d 65 6e 74 73 20 70 61  ble.arguments pa
6c00: 73 73 65 64 20 74 6f 20 74 68 65 20 63 61 6c 6c  ssed to the call
6c10: 62 61 63 6b 20 73 63 72 69 70 74 2e 20 56 61 6c  back script. Val
6c20: 75 65 73 20 72 65 74 75 72 6e 65 64 20 66 72 6f  ues returned fro
6c30: 6d 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 61  m the callback a
6c40: 72 65 0a 69 67 6e 6f 72 65 64 2e 0a 0a 5b 6c 69  re.ignored...[li
6c50: 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73  st_begin options
6c60: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 65 72 72 6f  ]..[opt_def erro
6c70: 72 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49  r [arg "channelI
6c80: 64 20 6d 65 73 73 61 67 65 22 5d 5d 0a 54 68 69  d message"]].Thi
6c90: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61  s form of callba
6ca0: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68  ck is invoked wh
6cb0: 65 6e 65 76 65 72 20 61 6e 20 65 72 72 6f 72 20  enever an error 
6cc0: 6f 63 63 75 72 73 20 64 75 72 69 6e 67 20 74 68  occurs during th
6cd0: 65 20 69 6e 69 74 69 61 6c 0a 63 6f 6e 6e 65 63  e initial.connec
6ce0: 74 69 6f 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c  tion, handshake,
6cf0: 20 6f 72 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f   or I/O operatio
6d00: 6e 73 2e 20 54 68 65 20 5b 61 72 67 20 6d 65 73  ns. The [arg mes
6d10: 73 61 67 65 5d 20 61 72 67 75 6d 65 6e 74 20 63  sage] argument c
6d20: 61 6e 20 62 65 0a 66 72 6f 6d 20 74 68 65 20 54  an be.from the T
6d30: 63 6c 5f 45 72 72 6e 6f 4d 73 67 2c 20 4f 70 65  cl_ErrnoMsg, Ope
6d40: 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 20 5b 66  nSSL function [f
6d50: 75 6e 20 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72  un ERR_reason_er
6d60: 72 6f 72 5f 73 74 72 69 6e 67 28 29 5d 2c 0a 6f  ror_string()],.o
6d70: 72 20 61 20 63 75 73 74 6f 6d 20 6d 65 73 73 61  r a custom messa
6d80: 67 65 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63  ge. This callbac
6d90: 6b 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  k is new for Tcl
6da0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64  TLS 1.8...[opt_d
6db0: 65 66 20 69 6e 66 6f 20 5b 61 72 67 20 22 63 68  ef info [arg "ch
6dc0: 61 6e 6e 65 6c 49 64 20 6d 61 6a 6f 72 20 6d 69  annelId major mi
6dd0: 6e 6f 72 20 6d 65 73 73 61 67 65 20 74 79 70 65  nor message type
6de0: 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66  "]].This form of
6df0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
6e00: 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e  oked by the Open
6e10: 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75  SSL function.[fu
6e20: 6e 20 53 53 4c 5f 73 65 74 5f 69 6e 66 6f 5f 63  n SSL_set_info_c
6e30: 61 6c 6c 62 61 63 6b 28 29 5d 20 64 75 72 69 6e  allback()] durin
6e40: 67 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63 6f  g the initial co
6e50: 6e 6e 65 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e  nnection and han
6e60: 64 73 68 61 6b 65 0a 6f 70 65 72 61 74 69 6f 6e  dshake.operation
6e70: 73 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73  s. The arguments
6e80: 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67   are:..[list_beg
6e90: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
6ea0: 0a 5b 64 65 66 20 5b 61 72 67 20 6d 61 6a 6f 72  .[def [arg major
6eb0: 5d 5d 0a 4d 61 6a 6f 72 20 63 61 74 65 67 6f 72  ]].Major categor
6ec0: 79 20 66 6f 72 20 65 72 72 6f 72 2e 20 56 61 6c  y for error. Val
6ed0: 69 64 20 65 6e 75 6d 73 20 61 72 65 3a 20 5b 63  id enums are: [c
6ee0: 6f 6e 73 74 20 68 61 6e 64 73 68 61 6b 65 5d 2c  onst handshake],
6ef0: 20 5b 63 6f 6e 73 74 20 61 6c 65 72 74 5d 2c 0a   [const alert],.
6f00: 5b 63 6f 6e 73 74 20 63 6f 6e 6e 65 63 74 5d 2c  [const connect],
6f10: 20 5b 63 6f 6e 73 74 20 61 63 63 65 70 74 5d 2e   [const accept].
6f20: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 69 6e 6f  ..[def [arg mino
6f30: 72 5d 5d 0a 4d 69 6e 6f 72 20 63 61 74 65 67 6f  r]].Minor catego
6f40: 72 79 20 66 6f 72 20 65 72 72 6f 72 2e 20 56 61  ry for error. Va
6f50: 6c 69 64 20 65 6e 75 6d 73 20 61 72 65 3a 20 5b  lid enums are: [
6f60: 63 6f 6e 73 74 20 73 74 61 72 74 5d 2c 20 5b 63  const start], [c
6f70: 6f 6e 73 74 20 64 6f 6e 65 5d 2c 20 5b 63 6f 6e  onst done], [con
6f80: 73 74 20 72 65 61 64 5d 2c 0a 5b 63 6f 6e 73 74  st read],.[const
6f90: 20 77 72 69 74 65 5d 2c 20 5b 63 6f 6e 73 74 20   write], [const 
6fa0: 6c 6f 6f 70 5d 2c 20 5b 63 6f 6e 73 74 20 65 78  loop], [const ex
6fb0: 69 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20  it]...[def [arg 
6fc0: 6d 65 73 73 61 67 65 5d 5d 0a 44 65 73 63 72 69  message]].Descri
6fd0: 70 74 69 76 65 20 6d 65 73 73 61 67 65 20 73 74  ptive message st
6fe0: 72 69 6e 67 20 77 68 69 63 68 20 6d 61 79 20 62  ring which may b
6ff0: 65 20 67 65 6e 65 72 61 74 65 64 20 65 69 74 68  e generated eith
7000: 65 72 20 62 79 0a 5b 66 75 6e 20 53 53 4c 5f 73  er by.[fun SSL_s
7010: 74 61 74 65 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67  tate_string_long
7020: 28 29 5d 20 6f 72 20 5b 66 75 6e 20 53 53 4c 5f  ()] or [fun SSL_
7030: 61 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69 6e  alert_desc_strin
7040: 67 5f 6c 6f 6e 67 28 29 5d 2c 0a 64 65 70 65 6e  g_long()],.depen
7050: 64 69 6e 67 20 6f 6e 20 74 68 65 20 63 6f 6e 74  ding on the cont
7060: 65 78 74 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20  ext...[def [arg 
7070: 74 79 70 65 5d 5d 0a 46 6f 72 20 61 6c 65 72 74  type]].For alert
7080: 73 2c 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20  s, the possible 
7090: 76 61 6c 75 65 73 20 61 72 65 3a 20 5b 63 6f 6e  values are: [con
70a0: 73 74 20 77 61 72 6e 69 6e 67 5d 2c 0a 5b 63 6f  st warning],.[co
70b0: 6e 73 74 20 66 61 74 61 6c 5d 2c 20 61 6e 64 20  nst fatal], and 
70c0: 5b 63 6f 6e 73 74 20 75 6e 6b 6e 6f 77 6e 5d 2e  [const unknown].
70d0: 20 46 6f 72 20 6f 74 68 65 72 73 2c 20 5b 63 6f   For others, [co
70e0: 6e 73 74 20 69 6e 66 6f 5d 20 69 73 20 75 73 65  nst info] is use
70f0: 64 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74  d..This argument
7100: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
7110: 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65  LS 1.8...[list_e
7120: 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 6d 65  nd]..[opt_def me
7130: 73 73 61 67 65 20 5b 61 72 67 20 22 63 68 61 6e  ssage [arg "chan
7140: 6e 65 6c 49 64 20 64 69 72 65 63 74 69 6f 6e 20  nelId direction 
7150: 76 65 72 73 69 6f 6e 20 63 6f 6e 74 65 6e 74 5f  version content_
7160: 74 79 70 65 20 6d 65 73 73 61 67 65 22 5d 5d 0a  type message"]].
7170: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
7180: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
7190: 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20   by the OpenSSL 
71a0: 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53  function.[fun SS
71b0: 4c 5f 73 65 74 5f 6d 73 67 5f 63 61 6c 6c 62 61  L_set_msg_callba
71c0: 63 6b 28 29 5d 20 77 68 65 6e 65 76 65 72 20 61  ck()] whenever a
71d0: 20 6d 65 73 73 61 67 65 20 69 73 20 73 65 6e 74   message is sent
71e0: 20 6f 72 20 72 65 63 65 69 76 65 64 20 64 75 72   or received dur
71f0: 69 6e 67 20 74 68 65 0a 69 6e 69 74 69 61 6c 20  ing the.initial 
7200: 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68 61 6e 64  connection, hand
7210: 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f 70  shake, or I/O op
7220: 65 72 61 74 69 6f 6e 73 2e 20 49 74 20 69 73 20  erations. It is 
7230: 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 77  only available w
7240: 68 65 6e 0a 4f 70 65 6e 53 53 4c 20 69 73 20 63  hen.OpenSSL is c
7250: 6f 6d 70 6c 69 65 64 20 77 69 74 68 20 74 68 65  omplied with the
7260: 20 5b 63 6f 6e 73 74 20 65 6e 61 62 6c 65 2d 73   [const enable-s
7270: 73 6c 2d 74 72 61 63 65 5d 20 6f 70 74 69 6f 6e  sl-trace] option
7280: 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20  . This callback 
7290: 69 73 0a 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is.new for TclTL
72a0: 53 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d  S 1.8. The argum
72b0: 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74  ents are:..[list
72c0: 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f  _begin definitio
72d0: 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 64  ns]..[def [arg d
72e0: 69 72 65 63 74 69 6f 6e 5d 5d 0a 44 69 72 65 63  irection]].Direc
72f0: 74 69 6f 6e 20 69 73 20 65 69 74 68 65 72 20 5b  tion is either [
7300: 63 6f 6e 73 74 20 53 65 6e 74 5d 20 6f 72 20 5b  const Sent] or [
7310: 63 6f 6e 73 74 20 52 65 63 65 69 76 65 64 5d 2e  const Received].
7320: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 76 65 72 73  ..[def [arg vers
7330: 69 6f 6e 5d 5d 0a 56 65 72 73 69 6f 6e 20 69 73  ion]].Version is
7340: 20 74 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65   the protocol ve
7350: 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 5b 61 72  rsion...[def [ar
7360: 67 20 63 6f 6e 74 65 6e 74 5f 74 79 70 65 5d 5d  g content_type]]
7370: 0a 43 6f 6e 74 65 6e 74 20 74 79 70 65 20 69 73  .Content type is
7380: 20 74 68 65 20 6d 65 73 73 61 67 65 20 63 6f 6e   the message con
7390: 74 65 6e 74 20 74 79 70 65 2e 0a 0a 5b 64 65 66  tent type...[def
73a0: 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 5d 0a   [arg message]].
73b0: 4d 65 73 73 61 67 65 20 69 73 20 6d 6f 72 65 20  Message is more 
73c0: 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65 20 5b 63  info from the [c
73d0: 6f 6e 73 74 20 53 53 4c 5f 74 72 61 63 65 5d 20  onst SSL_trace] 
73e0: 41 50 49 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  API...[list_end]
73f0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 73 65 73 73 69  ..[opt_def sessi
7400: 6f 6e 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c  on [arg "channel
7410: 49 64 20 73 65 73 73 69 6f 6e 5f 69 64 20 73 65  Id session_id se
7420: 73 73 69 6f 6e 5f 74 69 63 6b 65 74 20 6c 69 66  ssion_ticket lif
7430: 65 74 69 6d 65 22 5d 5d 0a 54 68 69 73 20 66 6f  etime"]].This fo
7440: 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69  rm of callback i
7450: 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65  s invoked by the
7460: 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f   OpenSSL functio
7470: 6e 0a 5b 66 75 6e 20 53 53 4c 5f 43 54 58 5f 73  n.[fun SSL_CTX_s
7480: 65 73 73 5f 73 65 74 5f 6e 65 77 5f 63 62 28 29  ess_set_new_cb()
7490: 5d 20 77 68 65 6e 65 76 65 72 20 61 20 6e 65 77  ] whenever a new
74a0: 20 73 65 73 73 69 6f 6e 20 69 64 20 69 73 20 73   session id is s
74b0: 65 6e 74 20 62 79 20 74 68 65 0a 73 65 72 76 65  ent by the.serve
74c0: 72 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69  r during the ini
74d0: 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20  tial connection 
74e0: 61 6e 64 20 68 61 6e 64 73 68 61 6b 65 20 61 6e  and handshake an
74f0: 64 20 61 6c 73 6f 20 64 75 72 69 6e 67 20 74 68  d also during th
7500: 65 20 73 65 73 73 69 6f 6e 0a 69 66 20 74 68 65  e session.if the
7510: 20 5b 6f 70 74 69 6f 6e 20 2d 70 6f 73 74 5f 68   [option -post_h
7520: 61 6e 64 73 68 61 6b 65 5d 20 6f 70 74 69 6f 6e  andshake] option
7530: 20 69 73 20 73 65 74 20 74 6f 20 74 72 75 65 2e   is set to true.
7540: 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69   This callback i
7550: 73 20 6e 65 77 20 66 6f 72 0a 54 63 6c 54 4c 53  s new for.TclTLS
7560: 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d 65   1.8. The argume
7570: 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f  nts are:..[list_
7580: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
7590: 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 65  s]..[def [arg se
75a0: 73 73 69 6f 6e 5f 69 64 5d 5d 0a 53 65 73 73 69  ssion_id]].Sessi
75b0: 6f 6e 20 49 64 20 69 73 20 74 68 65 20 63 75 72  on Id is the cur
75c0: 72 65 6e 74 20 73 65 73 73 69 6f 6e 20 69 64 65  rent session ide
75d0: 6e 74 69 66 69 65 72 0a 0a 5b 64 65 66 20 5b 61  ntifier..[def [a
75e0: 72 67 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65  rg session_ticke
75f0: 74 5d 5d 0a 54 69 63 6b 65 74 20 69 73 20 74 68  t]].Ticket is th
7600: 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74  e session ticket
7610: 20 69 6e 66 6f 0a 0a 5b 64 65 66 20 5b 61 72 67   info..[def [arg
7620: 20 6c 69 66 65 74 69 6d 65 5d 5d 0a 4c 69 66 65   lifetime]].Life
7630: 74 69 6d 65 20 69 73 20 74 68 65 20 74 69 63 6b  time is the tick
7640: 65 74 20 6c 69 66 65 74 69 6d 65 20 69 6e 20 73  et lifetime in s
7650: 65 63 6f 6e 64 73 2e 0a 0a 5b 6c 69 73 74 5f 65  econds...[list_e
7660: 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 76 65  nd]..[opt_def ve
7670: 72 69 66 79 20 5b 61 72 67 20 22 63 68 61 6e 6e  rify [arg "chann
7680: 65 6c 49 64 20 64 65 70 74 68 20 63 65 72 74 20  elId depth cert 
7690: 73 74 61 74 75 73 20 65 72 72 6f 72 22 5d 5d 0a  status error"]].
76a0: 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 61  This callback wa
76b0: 73 20 6d 6f 76 65 64 20 74 6f 20 5b 6f 70 74 69  s moved to [opti
76c0: 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d  on -validatecomm
76d0: 61 6e 64 5d 20 69 6e 20 54 63 6c 54 4c 53 20 31  and] in TclTLS 1
76e0: 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  .8...[list_end].
76f0: 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56 61  .[subsection "Va
7700: 6c 75 65 73 20 66 6f 72 20 50 61 73 73 77 6f 72  lues for Passwor
7710: 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68  d Callback"]..Th
7720: 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74  e callback for t
7730: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73  he [option -pass
7740: 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20  word] option is 
7750: 69 6e 76 6f 6b 65 64 20 62 79 20 54 63 6c 54 4c  invoked by TclTL
7760: 53 20 77 68 65 6e 65 76 65 72 20 4f 70 65 6e 53  S whenever OpenS
7770: 53 4c 20 6e 65 65 64 73 0a 74 6f 20 6f 62 74 61  SL needs.to obta
7780: 69 6e 20 61 20 70 61 73 73 77 6f 72 64 2e 20 53  in a password. S
7790: 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 74 68 65  ee below for the
77a0: 20 70 6f 73 73 69 62 6c 65 20 61 72 67 75 6d 65   possible argume
77b0: 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20 74 68  nts passed to th
77c0: 65 0a 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70  e.callback scrip
77d0: 74 2e 20 54 68 65 20 75 73 65 72 20 70 72 6f 76  t. The user prov
77e0: 69 64 65 64 20 70 61 73 73 77 6f 72 64 20 69 73  ided password is
77f0: 20 65 78 70 65 63 74 65 64 20 74 6f 20 62 65 20   expected to be 
7800: 72 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 0a  returned by the.
7810: 63 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6c 69 73 74  callback...[list
7820: 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a  _begin options].
7830: 0a 5b 6f 70 74 5f 64 65 66 20 70 61 73 73 77 6f  .[opt_def passwo
7840: 72 64 20 5b 61 72 67 20 22 72 77 66 6c 61 67 20  rd [arg "rwflag 
7850: 73 69 7a 65 22 5d 5d 0a 49 6e 76 6f 6b 65 64 20  size"]].Invoked 
7860: 77 68 65 6e 20 6c 6f 61 64 69 6e 67 20 6f 72 20  when loading or 
7870: 73 74 6f 72 69 6e 67 20 61 6e 20 65 6e 63 72 79  storing an encry
7880: 70 74 65 64 20 50 45 4d 20 63 65 72 74 69 66 69  pted PEM certifi
7890: 63 61 74 65 2e 20 54 68 65 20 61 72 67 75 6d 65  cate. The argume
78a0: 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f  nts are:..[list_
78b0: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
78c0: 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 72 77  s]..[def [arg rw
78d0: 66 6c 61 67 5d 5d 0a 54 68 65 20 72 65 61 64 2f  flag]].The read/
78e0: 77 72 69 74 65 20 66 6c 61 67 20 69 73 20 30 20  write flag is 0 
78f0: 66 6f 72 20 72 65 61 64 69 6e 67 2f 64 65 63 72  for reading/decr
7900: 79 70 74 69 6f 6e 20 6f 72 20 31 20 66 6f 72 20  yption or 1 for 
7910: 77 72 69 74 69 6e 67 2f 65 6e 63 72 79 70 74 69  writing/encrypti
7920: 6f 6e 2e 0a 54 68 65 20 6c 61 74 74 65 72 20 63  on..The latter c
7930: 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 64 65  an be used to de
7940: 74 65 72 6d 69 6e 65 20 77 68 65 6e 20 74 6f 20  termine when to 
7950: 70 72 6f 6d 70 74 20 74 68 65 20 75 73 65 72 20  prompt the user 
7960: 74 6f 20 63 6f 6e 66 69 72 6d 2e 0a 54 68 69 73  to confirm..This
7970: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77   argument is new
7980: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
7990: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 69 7a 65  ..[def [arg size
79a0: 5d 5d 0a 54 68 65 20 73 69 7a 65 20 69 73 20 74  ]].The size is t
79b0: 68 65 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74  he maximum lengt
79c0: 68 20 6f 66 20 74 68 65 20 70 61 73 73 77 6f 72  h of the passwor
79d0: 64 20 69 6e 20 62 79 74 65 73 2e 0a 54 68 69 73  d in bytes..This
79e0: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77   argument is new
79f0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
7a00: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6c  ..[list_end]..[l
7a10: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65  ist_end]..[subse
7a20: 63 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f  ction "Values fo
7a30: 72 20 56 61 6c 69 64 61 74 65 20 43 6f 6d 6d 61  r Validate Comma
7a40: 6e 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54  nd Callback"]..T
7a50: 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20  he callback for 
7a60: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c  the [option -val
7a70: 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70  idatecommand] op
7a80: 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20  tion is invoked 
7a90: 64 75 72 69 6e 67 20 74 68 65 20 68 61 6e 64 73  during the hands
7aa0: 68 61 6b 65 0a 70 72 6f 63 65 73 73 20 69 6e 20  hake.process in 
7ab0: 6f 72 64 65 72 20 66 6f 72 20 74 68 65 20 61 70  order for the ap
7ac0: 70 6c 69 63 61 74 69 6f 6e 20 74 6f 20 76 61 6c  plication to val
7ad0: 69 64 61 74 65 20 74 68 65 20 70 72 6f 76 69 64  idate the provid
7ae0: 65 64 20 76 61 6c 75 65 28 73 29 2e 20 53 65 65  ed value(s). See
7af0: 0a 62 65 6c 6f 77 20 66 6f 72 20 74 68 65 20 70  .below for the p
7b00: 6f 73 73 69 62 6c 65 20 61 72 67 75 6d 65 6e 74  ossible argument
7b10: 73 20 70 61 73 73 65 64 20 74 6f 20 74 68 65 20  s passed to the 
7b20: 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 2e  callback script.
7b30: 20 49 66 20 6e 6f 74 0a 73 70 65 63 69 66 69 65   If not.specifie
7b40: 64 2c 20 4f 70 65 6e 53 53 4c 20 77 69 6c 6c 20  d, OpenSSL will 
7b50: 61 63 63 65 70 74 20 61 6c 6c 20 76 61 6c 69 64  accept all valid
7b60: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61 6e   certificates an
7b70: 64 20 65 78 74 65 6e 73 69 6f 6e 73 2e 20 54 6f  d extensions. To
7b80: 20 72 65 6a 65 63 74 0a 74 68 65 20 76 61 6c 75   reject.the valu
7b90: 65 20 61 6e 64 20 61 62 6f 72 74 20 74 68 65 20  e and abort the 
7ba0: 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 74 68 65 20  connection, the 
7bb0: 63 61 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20  callback should 
7bc0: 72 65 74 75 72 6e 20 30 2e 20 54 6f 20 61 63 63  return 0. To acc
7bd0: 65 70 74 20 74 68 65 0a 76 61 6c 75 65 20 61 6e  ept the.value an
7be0: 64 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 63  d continue the c
7bf0: 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 74 20 73 68  onnection, it sh
7c00: 6f 75 6c 64 20 72 65 74 75 72 6e 20 31 2e 20 54  ould return 1. T
7c10: 6f 20 72 65 6a 65 63 74 20 74 68 65 20 76 61 6c  o reject the val
7c20: 75 65 2c 20 62 75 74 0a 63 6f 6e 74 69 6e 75 65  ue, but.continue
7c30: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c   the connection,
7c40: 20 69 74 20 73 68 6f 75 6c 64 20 72 65 74 75 72   it should retur
7c50: 6e 20 32 2e 20 54 68 69 73 20 63 61 6c 6c 62 61  n 2. This callba
7c60: 63 6b 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ck is new for Tc
7c70: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74  lTLS 1.8...[list
7c80: 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a  _begin options].
7c90: 0a 5b 6f 70 74 5f 64 65 66 20 61 6c 70 6e 20 5b  .[opt_def alpn [
7ca0: 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 70  arg "channelId p
7cb0: 72 6f 74 6f 63 6f 6c 20 6d 61 74 63 68 22 5d 5d  rotocol match"]]
7cc0: 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68  .For servers, th
7cd0: 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62  is form of callb
7ce0: 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77  ack is invoked w
7cf0: 68 65 6e 20 74 68 65 20 63 6c 69 65 6e 74 20 41  hen the client A
7d00: 4c 50 4e 20 65 78 74 65 6e 73 69 6f 6e 20 69 73  LPN extension is
7d10: 0a 72 65 63 65 69 76 65 64 2e 20 49 66 20 5b 61  .received. If [a
7d20: 72 67 20 6d 61 74 63 68 5d 20 69 73 20 74 72 75  rg match] is tru
7d30: 65 2c 20 74 68 65 6e 20 5b 61 72 67 20 70 72 6f  e, then [arg pro
7d40: 74 6f 63 6f 6c 5d 20 69 73 20 74 68 65 20 66 69  tocol] is the fi
7d50: 72 73 74 0a 5b 6f 70 74 69 6f 6e 20 2d 61 6c 70  rst.[option -alp
7d60: 6e 5d 20 70 72 6f 74 6f 63 6f 6c 20 6f 70 74 69  n] protocol opti
7d70: 6f 6e 20 69 6e 20 63 6f 6d 6d 6f 6e 20 74 6f 20  on in common to 
7d80: 62 6f 74 68 20 74 68 65 20 63 6c 69 65 6e 74 20  both the client 
7d90: 61 6e 64 20 73 65 72 76 65 72 2e 0a 49 66 20 6e  and server..If n
7da0: 6f 74 2c 20 74 68 65 20 66 69 72 73 74 20 63 6c  ot, the first cl
7db0: 69 65 6e 74 20 73 70 65 63 69 66 69 65 64 20 70  ient specified p
7dc0: 72 6f 74 6f 63 6f 6c 20 69 73 20 75 73 65 64 2e  rotocol is used.
7dd0: 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69   This callback i
7de0: 73 20 63 61 6c 6c 65 64 0a 61 66 74 65 72 20 74  s called.after t
7df0: 68 65 20 48 65 6c 6c 6f 20 61 6e 64 20 41 4c 50  he Hello and ALP
7e00: 4e 20 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f  N callbacks...[o
7e10: 70 74 5f 64 65 66 20 68 65 6c 6c 6f 20 5b 61 72  pt_def hello [ar
7e20: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 72  g "channelId ser
7e30: 76 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f 72 20 73  vername"]].For s
7e40: 65 72 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72  ervers, this for
7e50: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73  m of callback is
7e60: 20 69 6e 76 6f 6b 65 64 20 64 75 72 69 6e 67 20   invoked during 
7e70: 63 6c 69 65 6e 74 20 68 65 6c 6c 6f 20 6d 65 73  client hello mes
7e80: 73 61 67 65 0a 70 72 6f 63 65 73 73 69 6e 67 2e  sage.processing.
7e90: 20 54 68 65 20 70 75 72 70 6f 73 65 20 69 73 20   The purpose is 
7ea0: 73 6f 20 74 68 65 20 73 65 72 76 65 72 20 63 61  so the server ca
7eb0: 6e 20 73 65 6c 65 63 74 20 74 68 65 20 61 70 70  n select the app
7ec0: 72 6f 70 72 69 61 74 65 20 63 65 72 74 69 66 69  ropriate certifi
7ed0: 63 61 74 65 0a 74 6f 20 70 72 65 73 65 6e 74 20  cate.to present 
7ee0: 74 6f 20 74 68 65 20 63 6c 69 65 6e 74 2c 20 61  to the client, a
7ef0: 6e 64 20 74 6f 20 6d 61 6b 65 20 6f 74 68 65 72  nd to make other
7f00: 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 61   configuration a
7f10: 64 6a 75 73 74 6d 65 6e 74 73 20 72 65 6c 65 76  djustments relev
7f20: 61 6e 74 0a 74 6f 20 74 68 61 74 20 73 65 72 76  ant.to that serv
7f30: 65 72 20 6e 61 6d 65 20 61 6e 64 20 69 74 73 20  er name and its 
7f40: 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e 2e 20 49  configuration. I
7f50: 74 20 69 73 20 63 61 6c 6c 65 64 20 62 65 66 6f  t is called befo
7f60: 72 65 20 74 68 65 20 53 4e 49 20 61 6e 64 20 41  re the SNI and A
7f70: 4c 50 4e 0a 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a  LPN.callbacks...
7f80: 5b 6f 70 74 5f 64 65 66 20 73 6e 69 20 5b 61 72  [opt_def sni [ar
7f90: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 72  g "channelId ser
7fa0: 76 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f 72 20 73  vername"]].For s
7fb0: 65 72 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72  ervers, this for
7fc0: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73  m of callback is
7fd0: 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 74 68   invoked when th
7fe0: 65 20 53 65 72 76 65 72 20 4e 61 6d 65 20 49 6e  e Server Name In
7ff0: 64 69 63 61 74 69 6f 6e 0a 28 53 4e 49 29 20 65  dication.(SNI) e
8000: 78 74 65 6e 73 69 6f 6e 20 69 73 20 72 65 63 65  xtension is rece
8010: 69 76 65 64 2e 20 54 68 65 20 5b 61 72 67 20 73  ived. The [arg s
8020: 65 72 76 65 72 6e 61 6d 65 5d 20 61 72 67 75 6d  ervername] argum
8030: 65 6e 74 20 69 73 20 74 68 65 20 63 6c 69 65 6e  ent is the clien
8040: 74 0a 70 72 6f 76 69 64 65 64 20 73 65 72 76 65  t.provided serve
8050: 72 20 6e 61 6d 65 20 73 70 65 63 69 66 69 65 64  r name specified
8060: 20 69 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20   in the [option 
8070: 2d 73 65 72 76 65 72 6e 61 6d 65 3c 2f 62 3e 5d  -servername</b>]
8080: 20 6f 70 74 69 6f 6e 2e 20 54 68 65 0a 70 75 72   option. The.pur
8090: 70 6f 73 65 20 69 73 20 73 6f 20 77 68 65 6e 20  pose is so when 
80a0: 61 20 73 65 72 76 65 72 20 73 75 70 70 6f 72 74  a server support
80b0: 73 20 6d 75 6c 74 69 70 6c 65 20 6e 61 6d 65 73  s multiple names
80c0: 2c 20 74 68 65 20 72 69 67 68 74 20 63 65 72 74  , the right cert
80d0: 69 66 69 63 61 74 65 0a 63 61 6e 20 62 65 20 75  ificate.can be u
80e0: 73 65 64 2e 20 49 74 20 69 73 20 63 61 6c 6c 65  sed. It is calle
80f0: 64 20 61 66 74 65 72 20 74 68 65 20 68 65 6c 6c  d after the hell
8100: 6f 20 63 61 6c 6c 62 61 63 6b 20 62 75 74 20 62  o callback but b
8110: 65 66 6f 72 65 20 74 68 65 20 41 4c 50 4e 0a 63  efore the ALPN.c
8120: 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6f 70 74 5f 64  allback...[opt_d
8130: 65 66 20 76 65 72 69 66 79 20 5b 61 72 67 20 22  ef verify [arg "
8140: 63 68 61 6e 6e 65 6c 49 64 20 64 65 70 74 68 20  channelId depth 
8150: 63 65 72 74 20 73 74 61 74 75 73 20 65 72 72 6f  cert status erro
8160: 72 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f  r"]].This form o
8170: 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e  f callback is in
8180: 76 6f 6b 65 64 20 62 79 20 4f 70 65 6e 53 53 4c  voked by OpenSSL
8190: 20 77 68 65 6e 20 61 20 6e 65 77 20 63 65 72 74   when a new cert
81a0: 69 66 69 63 61 74 65 20 69 73 20 72 65 63 65 69  ificate is recei
81b0: 76 65 64 0a 66 72 6f 6d 20 74 68 65 20 70 65 65  ved.from the pee
81c0: 72 2e 20 49 74 20 61 6c 6c 6f 77 73 20 74 68 65  r. It allows the
81d0: 20 63 6c 69 65 6e 74 20 74 6f 20 63 68 65 63 6b   client to check
81e0: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
81f0: 20 76 65 72 69 66 69 63 61 74 69 6f 6e 0a 72 65   verification.re
8200: 73 75 6c 74 73 20 61 6e 64 20 63 68 6f 6f 73 65  sults and choose
8210: 20 77 68 65 74 68 65 72 20 74 6f 20 63 6f 6e 74   whether to cont
8220: 69 6e 75 65 20 6f 72 20 6e 6f 74 2e 20 49 74 20  inue or not. It 
8230: 69 73 20 63 61 6c 6c 65 64 20 66 6f 72 20 65 61  is called for ea
8240: 63 68 0a 63 65 72 74 69 66 69 63 61 74 65 20 69  ch.certificate i
8250: 6e 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  n the certificat
8260: 65 20 63 68 61 69 6e 2e 20 54 68 69 73 20 63 61  e chain. This ca
8270: 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65 64  llback was moved
8280: 20 66 72 6f 6d 0a 5b 6f 70 74 69 6f 6e 20 2d 63   from.[option -c
8290: 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54 63 6c 54 4c  ommand] in TclTL
82a0: 53 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75 6d  S 1.8. The argum
82b0: 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74  ents are:..[list
82c0: 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f  _begin definitio
82d0: 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 64  ns]..[def [arg d
82e0: 65 70 74 68 5d 5d 0a 54 68 65 20 64 65 70 74 68  epth]].The depth
82f0: 20 69 73 20 74 68 65 20 69 6e 74 65 67 65 72 20   is the integer 
8300: 64 65 70 74 68 20 6f 66 20 74 68 65 20 63 65 72  depth of the cer
8310: 74 69 66 69 63 61 74 65 20 69 6e 20 74 68 65 20  tificate in the 
8320: 63 65 72 74 69 66 69 63 61 74 65 20 63 68 61 69  certificate chai
8330: 6e 2c 0a 77 68 65 72 65 20 30 20 69 73 20 74 68  n,.where 0 is th
8340: 65 20 70 65 65 72 20 63 65 72 74 69 66 69 63 61  e peer certifica
8350: 74 65 20 61 6e 64 20 68 69 67 68 65 72 20 76 61  te and higher va
8360: 6c 75 65 73 20 67 6f 69 6e 67 20 75 70 20 74 6f  lues going up to
8370: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65   the Certificate
8380: 0a 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 2e  .Authority (CA).
8390: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63 65 72 74  ..[def [arg cert
83a0: 5d 5d 0a 54 68 65 20 63 65 72 74 20 61 72 67 75  ]].The cert argu
83b0: 6d 65 6e 74 20 69 73 20 61 20 6c 69 73 74 20 6f  ment is a list o
83c0: 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72  f key-value pair
83d0: 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68 6f  s similar to tho
83e0: 73 65 20 72 65 74 75 72 6e 65 64 20 62 79 0a 5b  se returned by.[
83f0: 63 6d 64 20 74 6c 73 3a 3a 73 74 61 74 75 73 5d  cmd tls::status]
8400: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 74 61  ...[def [arg sta
8410: 74 75 73 5d 5d 0a 54 68 65 20 73 74 61 74 75 73  tus]].The status
8420: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65   argument is the
8430: 20 62 6f 6f 6c 65 61 6e 20 76 61 6c 69 64 69 74   boolean validit
8440: 79 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e 74  y of the current
8450: 20 63 65 72 74 69 66 69 63 61 74 65 20 77 68 65   certificate whe
8460: 72 65 20 30 0a 69 73 20 69 6e 76 61 6c 69 64 20  re 0.is invalid 
8470: 61 6e 64 20 31 20 69 73 20 76 61 6c 69 64 2e 0a  and 1 is valid..
8480: 0a 5b 64 65 66 20 5b 61 72 67 20 65 72 72 6f 72  .[def [arg error
8490: 5d 5d 0a 54 68 65 20 65 72 72 6f 72 20 61 72 67  ]].The error arg
84a0: 75 6d 65 6e 74 20 69 73 20 74 68 65 20 65 72 72  ument is the err
84b0: 6f 72 20 6d 65 73 73 61 67 65 2c 20 69 66 20 61  or message, if a
84c0: 6e 79 2c 20 67 65 6e 65 72 61 74 65 64 20 62 79  ny, generated by
84d0: 0a 5b 66 75 6e 20 58 35 30 39 5f 53 54 4f 52 45  .[fun X509_STORE
84e0: 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28 29  _CTX_get_error()
84f0: 5d 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a  ]...[list_end]..
8500: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 52 65 66 65  [list_end]..Refe
8510: 72 65 6e 63 65 20 69 6d 70 6c 65 6d 65 6e 74 61  rence implementa
8520: 74 69 6f 6e 73 20 6f 66 20 74 68 65 73 65 20 63  tions of these c
8530: 61 6c 6c 62 61 63 6b 73 20 61 72 65 20 70 72 6f  allbacks are pro
8540: 76 69 64 65 64 20 69 6e 20 5b 66 69 6c 65 20 74  vided in [file t
8550: 6c 73 2e 74 63 6c 5d 0a 61 73 20 5b 63 6d 64 20  ls.tcl].as [cmd 
8560: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20  tls::callback], 
8570: 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f  [cmd tls::passwo
8580: 72 64 5d 2c 20 61 6e 64 20 5b 63 6d 64 20 74 6c  rd], and [cmd tl
8590: 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d  s::validate_comm
85a0: 61 6e 64 5d 0a 72 65 73 70 65 63 74 69 76 65 6c  and].respectivel
85b0: 79 2e 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65  y. Note that the
85c0: 73 65 20 61 72 65 20 6f 6e 6c 79 20 5b 65 6d 70  se are only [emp
85d0: 68 20 73 61 6d 70 6c 65 5d 20 69 6d 70 6c 65 6d  h sample] implem
85e0: 65 6e 74 61 74 69 6f 6e 73 2e 20 49 6e 20 61 20  entations. In a 
85f0: 6d 6f 72 65 0a 72 65 61 6c 69 73 74 69 63 20 64  more.realistic d
8600: 65 70 6c 6f 79 6d 65 6e 74 20 79 6f 75 20 77 6f  eployment you wo
8610: 75 6c 64 20 73 70 65 63 69 66 79 20 79 6f 75 72  uld specify your
8620: 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 20 73 63   own callback sc
8630: 72 69 70 74 73 20 6f 6e 20 65 61 63 68 20 54 4c  ripts on each TL
8640: 53 0a 63 68 61 6e 6e 65 6c 20 75 73 69 6e 67 20  S.channel using 
8650: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d  the [option -com
8660: 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d  mand], [option -
8670: 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b  password], and.[
8680: 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65  option -validate
8690: 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e  _command] option
86a0: 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68 65 20  s...[para]..The 
86b0: 64 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72  default behavior
86c0: 20 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f   when the [optio
86d0: 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 61 6e 64 20  n -command] and 
86e0: 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74  [option -validat
86f0: 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f  e_command].optio
8700: 6e 73 20 61 72 65 20 6e 6f 74 20 73 70 65 63 69  ns are not speci
8710: 66 69 65 64 2c 20 69 73 20 66 6f 72 20 54 63 6c  fied, is for Tcl
8720: 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74  TLS to process t
8730: 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69  he associated li
8740: 62 72 61 72 79 0a 63 61 6c 6c 62 61 63 6b 73 20  brary.callbacks 
8750: 69 6e 74 65 72 6e 61 6c 6c 79 2e 20 54 68 65 20  internally. The 
8760: 64 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72  default behavior
8770: 20 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f   when the [optio
8780: 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74  n -password] opt
8790: 69 6f 6e 0a 69 73 20 6e 6f 74 20 73 70 65 63 69  ion.is not speci
87a0: 66 69 65 64 20 69 73 20 66 6f 72 20 54 63 6c 54  fied is for TclT
87b0: 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68  LS to process th
87c0: 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69 62  e associated lib
87d0: 72 61 72 79 20 63 61 6c 6c 62 61 63 6b 73 20 62  rary callbacks b
87e0: 79 0a 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20  y.attempting to 
87f0: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70  call [cmd tls::p
8800: 61 73 73 77 6f 72 64 5d 2e 20 54 68 65 20 64 69  assword]. The di
8810: 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e  fference between
8820: 20 74 68 65 73 65 20 74 77 6f 0a 62 65 68 61 76   these two.behav
8830: 69 6f 72 73 20 69 73 20 61 20 63 6f 6e 73 65 71  iors is a conseq
8840: 75 65 6e 63 65 20 6f 66 20 6d 61 69 6e 74 61 69  uence of maintai
8850: 6e 69 6e 67 20 63 6f 6d 70 61 74 69 62 69 6c 69  ning compatibili
8860: 74 79 20 77 69 74 68 20 65 61 72 6c 69 65 72 0a  ty with earlier.
8870: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e  implementations.
8880: 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70 68 20  ..[para]..[emph 
8890: 22 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20  "The use of the 
88a0: 72 65 66 65 72 65 6e 63 65 20 63 61 6c 6c 62 61  reference callba
88b0: 63 6b 73 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61  cks [cmd tls::ca
88c0: 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c  llback], [cmd tl
88d0: 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 0a 61 6e  s::password],.an
88e0: 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69  d [cmd tls::vali
88f0: 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 69 73  date_command] is
8900: 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64   not recommended
8910: 2e 20 54 68 65 79 20 6d 61 79 20 62 65 20 72 65  . They may be re
8920: 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75 74 75 72  moved from futur
8930: 65 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b  e releases."]..[
8940: 73 65 63 74 69 6f 6e 20 44 65 62 75 67 5d 0a 0a  section Debug]..
8950: 46 6f 72 20 6d 6f 73 74 20 64 65 62 75 67 67 69  For most debuggi
8960: 6e 67 20 6e 65 65 64 73 2c 20 74 68 65 20 5b 6f  ng needs, the [o
8970: 70 74 69 6f 6e 20 2d 63 61 6c 6c 62 61 63 6b 5d  ption -callback]
8980: 20 6f 70 74 69 6f 6e 20 63 61 6e 20 62 65 20 75   option can be u
8990: 73 65 64 20 74 6f 20 70 72 6f 76 69 64 65 0a 73  sed to provide.s
89a0: 75 66 66 69 63 69 65 6e 74 20 69 6e 73 69 67 68  ufficient insigh
89b0: 74 20 61 6e 64 20 69 6e 66 6f 72 6d 61 74 69 6f  t and informatio
89c0: 6e 20 6f 6e 20 74 68 65 20 54 4c 53 20 68 61 6e  n on the TLS han
89d0: 64 73 68 61 6b 65 20 61 6e 64 20 70 72 6f 67 72  dshake and progr
89e0: 65 73 73 2e 20 49 66 0a 66 75 72 74 68 65 72 20  ess. If.further 
89f0: 74 72 6f 75 62 6c 65 73 68 6f 6f 74 69 6e 67 20  troubleshooting 
8a00: 69 6e 73 69 67 68 74 20 69 73 20 6e 65 65 64 65  insight is neede
8a10: 64 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 20 74  d, the compile t
8a20: 69 6d 65 20 6f 70 74 69 6f 6e 0a 5b 6f 70 74 69  ime option.[opti
8a30: 6f 6e 20 2d 2d 65 6e 61 62 6c 65 2d 64 65 62 75  on --enable-debu
8a40: 67 5d 20 63 61 6e 20 62 65 20 75 73 65 64 20 74  g] can be used t
8a50: 6f 20 67 65 74 20 64 65 74 61 69 6c 65 64 20 65  o get detailed e
8a60: 78 65 63 75 74 69 6f 6e 20 66 6c 6f 77 20 73 74  xecution flow st
8a70: 61 74 75 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54  atus...[para]..T
8a80: 4c 53 20 6b 65 79 20 6c 6f 67 67 69 6e 67 20 63  LS key logging c
8a90: 61 6e 20 62 65 20 65 6e 61 62 6c 65 64 20 62 79  an be enabled by
8aa0: 20 73 65 74 74 69 6e 67 20 74 68 65 20 65 6e 76   setting the env
8ab0: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c  ironment variabl
8ac0: 65 0a 5b 76 61 72 20 53 53 4c 4b 45 59 4c 4f 47  e.[var SSLKEYLOG
8ad0: 46 49 4c 45 5d 20 74 6f 20 74 68 65 20 6e 61 6d  FILE] to the nam
8ae0: 65 20 6f 66 20 74 68 65 20 66 69 6c 65 20 74 6f  e of the file to
8af0: 20 6c 6f 67 20 74 6f 2e 20 54 68 65 6e 20 77 68   log to. Then wh
8b00: 65 6e 65 76 65 72 20 54 4c 53 20 6b 65 79 0a 6d  enever TLS key.m
8b10: 61 74 65 72 69 61 6c 20 69 73 20 67 65 6e 65 72  aterial is gener
8b20: 61 74 65 64 20 6f 72 20 72 65 63 65 69 76 65 64  ated or received
8b30: 20 69 74 20 77 69 6c 6c 20 62 65 20 6c 6f 67 67   it will be logg
8b40: 65 64 20 74 6f 20 74 68 65 20 66 69 6c 65 2e 20  ed to the file. 
8b50: 54 68 69 73 20 69 73 20 75 73 65 66 75 6c 0a 66  This is useful.f
8b60: 6f 72 20 6c 6f 67 67 69 6e 67 20 6b 65 79 20 64  or logging key d
8b70: 61 74 61 20 66 6f 72 20 6e 65 74 77 6f 72 6b 20  ata for network 
8b80: 6c 6f 67 67 69 6e 67 20 74 6f 6f 6c 73 20 74 6f  logging tools to
8b90: 20 75 73 65 20 74 6f 20 64 65 63 72 79 70 74 20   use to decrypt 
8ba0: 74 68 65 20 64 61 74 61 2e 0a 0a 5b 70 61 72 61  the data...[para
8bb0: 5d 0a 0a 54 68 65 20 5b 76 61 72 20 74 6c 73 3a  ]..The [var tls:
8bc0: 3a 64 65 62 75 67 5d 20 76 61 72 69 61 62 6c 65  :debug] variable
8bd0: 20 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61   provides some a
8be0: 64 64 69 74 69 6f 6e 61 6c 20 63 6f 6e 74 72 6f  dditional contro
8bf0: 6c 20 6f 76 65 72 20 74 68 65 0a 64 65 62 75 67  l over the.debug
8c00: 20 6c 6f 67 67 69 6e 67 20 69 6e 20 74 68 65 20   logging in the 
8c10: 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61  [cmd tls::callba
8c20: 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70  ck], [cmd tls::p
8c30: 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b 63  assword], and.[c
8c40: 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65  md tls::validate
8c50: 5f 63 6f 6d 6d 61 6e 64 5d 20 64 65 66 61 75 6c  _command] defaul
8c60: 74 20 68 61 6e 64 6c 65 72 73 20 69 6e 20 5b 66  t handlers in [f
8c70: 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 2e 0a 54 68  ile tls.tcl]..Th
8c80: 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20  e default value 
8c90: 69 73 20 30 20 77 69 74 68 20 68 69 67 68 65 72  is 0 with higher
8ca0: 20 76 61 6c 75 65 73 20 70 72 6f 64 75 63 69 6e   values producin
8cb0: 67 20 6d 6f 72 65 20 64 69 61 67 6e 6f 73 74 69  g more diagnosti
8cc0: 63 20 6f 75 74 70 75 74 2c 0a 61 6e 64 20 77 69  c output,.and wi
8cd0: 6c 6c 20 61 6c 73 6f 20 66 6f 72 63 65 20 74 68  ll also force th
8ce0: 65 20 76 65 72 69 66 79 20 6d 65 74 68 6f 64 20  e verify method 
8cf0: 69 6e 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c  in [cmd tls::cal
8d00: 6c 62 61 63 6b 5d 20 74 6f 20 61 63 63 65 70 74  lback] to accept
8d10: 20 74 68 65 0a 63 65 72 74 69 66 69 63 61 74 65   the.certificate
8d20: 2c 20 65 76 65 6e 20 69 66 20 69 74 20 69 73 20  , even if it is 
8d30: 69 6e 76 61 6c 69 64 20 77 68 65 6e 20 74 68 65  invalid when the
8d40: 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61   [option -valida
8d50: 74 65 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f  tecommand].optio
8d60: 6e 20 69 73 20 73 65 74 20 74 6f 20 5b 63 6d 64  n is set to [cmd
8d70: 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63   tls::validate_c
8d80: 6f 6d 6d 61 6e 64 5d 2e 0a 0a 5b 70 61 72 61 5d  ommand]...[para]
8d90: 0a 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65  ..[emph "The use
8da0: 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65   of the variable
8db0: 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62 75 67   [var tls::debug
8dc0: 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65  ] is not recomme
8dd0: 6e 64 65 64 2e 0a 49 74 20 6d 61 79 20 62 65 20  nded..It may be 
8de0: 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75 74  removed from fut
8df0: 75 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a  ure releases."].
8e00: 0a 5b 73 65 63 74 69 6f 6e 20 22 45 78 61 6d 70  .[section "Examp
8e10: 6c 65 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f  les"]..The follo
8e20: 77 69 6e 67 20 61 72 65 20 65 78 61 6d 70 6c 65  wing are example
8e30: 20 73 63 72 69 70 74 73 20 74 6f 20 64 6f 77 6e   scripts to down
8e40: 6c 6f 61 64 20 61 20 77 65 62 70 61 67 65 20 61  load a webpage a
8e50: 6e 64 20 66 69 6c 65 20 75 73 69 6e 67 20 74 68  nd file using th
8e60: 65 0a 68 74 74 70 20 70 61 63 6b 61 67 65 2e 20  e.http package. 
8e70: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65  See [sectref "Ce
8e80: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
8e90: 74 69 6f 6e 22 5d 20 66 6f 72 20 77 68 65 6e 20  tion"] for when 
8ea0: 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  the.[option -cad
8eb0: 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  ir], [option -ca
8ec0: 66 69 6c 65 5d 2c 20 61 6e 64 20 5b 6f 70 74 69  file], and [opti
8ed0: 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74  on -castore] opt
8ee0: 69 6f 6e 73 20 61 72 65 20 61 6c 73 6f 0a 6e 65  ions are also.ne
8ef0: 65 64 65 64 2e 20 53 65 65 20 74 68 65 20 5b 66  eded. See the [f
8f00: 69 6c 65 20 64 65 6d 6f 73 5d 20 64 69 72 65 63  ile demos] direc
8f10: 74 6f 72 79 20 66 6f 72 20 6d 6f 72 65 20 65 78  tory for more ex
8f20: 61 6d 70 6c 65 20 73 63 72 69 70 74 73 2e 0a 0a  ample scripts...
8f30: 5b 70 61 72 61 5d 0a 0a 45 78 61 6d 70 6c 65 20  [para]..Example 
8f40: 23 31 3a 20 44 6f 77 6e 6c 6f 61 64 20 61 20 77  #1: Download a w
8f50: 65 62 20 70 61 67 65 0a 0a 5b 65 78 61 6d 70 6c  eb page..[exampl
8f60: 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65 71  e {..package req
8f70: 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67  uire http.packag
8f80: 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 73  e require tls..s
8f90: 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f 2f  et url "https://
8fa0: 77 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a 68 74 74  www.tcl.tk/".htt
8fb0: 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74 70  p::register http
8fc0: 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c  s 443 [list ::tl
8fd0: 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73  s::socket -autos
8fe0: 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 72 65 71  ervername 1 -req
8ff0: 75 69 72 65 20 31 5d 0a 0a 23 20 47 65 74 20 55  uire 1]..# Get U
9000: 52 4c 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 68 74  RL.set token [ht
9010: 74 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c 5d  tp::geturl $url]
9020: 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20 65 72  ..# Check for er
9030: 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a 3a 73  ror.if {[http::s
9040: 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e 65  tatus $token] ne
9050: 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75 74   "ok"} {.    put
9060: 73 20 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f 72  s [format "Error
9070: 20 25 73 22 20 5b 68 74 74 70 3a 3a 73 74 61 74   %s" [http::stat
9080: 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23  us $token]].}..#
9090: 20 53 61 76 65 20 77 65 62 20 70 61 67 65 20 74   Save web page t
90a0: 6f 20 66 69 6c 65 0a 73 65 74 20 63 68 20 5b 6f  o file.set ch [o
90b0: 70 65 6e 20 65 78 61 6d 70 6c 65 2e 68 74 6d 6c  pen example.html
90c0: 20 77 62 5d 0a 70 75 74 73 20 24 63 68 20 5b 68   wb].puts $ch [h
90d0: 74 74 70 3a 3a 64 61 74 61 20 24 74 6f 6b 65 6e  ttp::data $token
90e0: 5d 0a 63 6c 6f 73 65 20 24 63 68 0a 0a 23 20 43  ].close $ch..# C
90f0: 6c 65 61 6e 75 70 0a 3a 3a 68 74 74 70 3a 3a 63  leanup.::http::c
9100: 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d  leanup $token.}]
9110: 0a 0a 45 78 61 6d 70 6c 65 20 23 32 3a 20 44 6f  ..Example #2: Do
9120: 77 6e 6c 6f 61 64 20 61 20 66 69 6c 65 0a 0a 5b  wnload a file..[
9130: 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b 61  example {..packa
9140: 67 65 20 72 65 71 75 69 72 65 20 68 74 74 70 0a  ge require http.
9150: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
9160: 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 68 74  tls..set url "ht
9170: 74 70 73 3a 2f 2f 77 69 6b 69 2e 74 63 6c 2d 6c  tps://wiki.tcl-l
9180: 61 6e 67 2e 6f 72 67 2f 73 69 74 65 6d 61 70 2e  ang.org/sitemap.
9190: 78 6d 6c 22 0a 68 74 74 70 3a 3a 72 65 67 69 73  xml".http::regis
91a0: 74 65 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c  ter https 443 [l
91b0: 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65  ist ::tls::socke
91c0: 74 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d  t -autoservernam
91d0: 65 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d 0a  e 1 -require 1].
91e0: 0a 23 20 4f 70 65 6e 20 6f 75 74 70 75 74 20 66  .# Open output f
91f0: 69 6c 65 0a 73 65 74 20 66 69 6c 65 6e 61 6d 65  ile.set filename
9200: 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 75 72 6c   [file tail $url
9210: 5d 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20 24  ].set ch [open $
9220: 66 69 6c 65 6e 61 6d 65 20 77 62 5d 0a 0a 23 20  filename wb]..# 
9230: 47 65 74 20 66 69 6c 65 0a 73 65 74 20 74 6f 6b  Get file.set tok
9240: 65 6e 20 5b 3a 3a 68 74 74 70 3a 3a 67 65 74 75  en [::http::getu
9250: 72 6c 20 24 75 72 6c 20 2d 62 6c 6f 63 6b 73 69  rl $url -blocksi
9260: 7a 65 20 36 35 35 33 36 20 2d 63 68 61 6e 6e 65  ze 65536 -channe
9270: 6c 20 24 63 68 5d 0a 0a 23 20 43 68 65 63 6b 20  l $ch]..# Check 
9280: 66 6f 72 20 65 72 72 6f 72 0a 69 66 20 7b 5b 68  for error.if {[h
9290: 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b  ttp::status $tok
92a0: 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20  en] ne "ok"} {. 
92b0: 20 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 74 20     puts [format 
92c0: 22 45 72 72 6f 72 20 25 73 22 20 5b 68 74 74 70  "Error %s" [http
92d0: 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d  ::status $token]
92e0: 5d 0a 7d 0a 0a 23 20 43 6c 65 61 6e 75 70 0a 63  ].}..# Cleanup.c
92f0: 6c 6f 73 65 20 24 63 68 0a 3a 3a 68 74 74 70 3a  lose $ch.::http:
9300: 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a  :cleanup $token.
9310: 7d 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 53 70  }]..[section "Sp
9320: 65 63 69 61 6c 20 43 6f 6e 73 69 64 65 72 61 74  ecial Considerat
9330: 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 63 61 70 61  ions"]..The capa
9340: 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69 73  bilities of this
9350: 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61 72   package can var
9360: 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61 73  y enormously bas
9370: 65 64 20 75 70 6f 6e 20 68 6f 77 20 74 68 65 0a  ed upon how the.
9380: 6c 69 6e 6b 65 64 20 74 6f 20 4f 70 65 6e 53 53  linked to OpenSS
9390: 4c 20 6c 69 62 72 61 72 79 20 77 61 73 20 63 6f  L library was co
93a0: 6e 66 69 67 75 72 65 64 20 61 6e 64 20 62 75 69  nfigured and bui
93b0: 6c 74 2e 20 4e 65 77 20 76 65 72 73 69 6f 6e 73  lt. New versions
93c0: 20 6d 61 79 20 6f 62 73 6f 6c 65 74 65 0a 6f 6c   may obsolete.ol
93d0: 64 65 72 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72  der protocol ver
93e0: 73 69 6f 6e 73 2c 20 61 64 64 20 6f 72 20 72 65  sions, add or re
93f0: 6d 6f 76 65 20 63 69 70 68 65 72 73 2c 20 63 68  move ciphers, ch
9400: 61 6e 67 65 20 64 65 66 61 75 6c 74 20 76 61 6c  ange default val
9410: 75 65 73 2c 20 65 74 63 2e 0a 55 73 65 20 74 68  ues, etc..Use th
9420: 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74  e [cmd tls::prot
9430: 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 73 20  ocols] commands 
9440: 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 73 75  to obtain the su
9450: 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f 6c  pported.protocol
9460: 20 76 65 72 73 69 6f 6e 73 2e 0a 0a 5b 6d 61 6e   versions...[man
9470: 70 61 67 65 5f 65 6e 64 5d 0a                    page_end].