Hex Artifact Content

Artifact 3886359307bba0356e809998ea5189c0d1e40500e9f0b2682709117ed2ad494b:


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 6f 72 20 6c 61 74 65 72 2e 0a 54 68 65 73 65   or later..These
0430: 20 73 6f 63 6b 65 74 73 20 62 65 68 61 76 65 20   sockets behave 
0440: 65 78 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65  exactly the same
0450: 20 61 73 20 63 68 61 6e 6e 65 6c 73 20 63 72 65   as channels cre
0460: 61 74 65 64 20 75 73 69 6e 67 20 74 68 65 20 62  ated using the b
0470: 75 69 6c 74 2d 69 6e 0a 5b 73 79 73 63 6d 64 20  uilt-in.[syscmd 
0480: 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c  socket] command,
0490: 20 62 75 74 20 70 72 6f 76 69 64 65 20 61 64 64   but provide add
04a0: 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 73 20  itional options 
04b0: 66 6f 72 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 0a  for controlling.
04c0: 74 68 65 20 53 53 4c 2f 54 4c 53 20 73 65 73 73  the SSL/TLS sess
04d0: 69 6f 6e 2e 0a 0a 5b 73 65 63 74 69 6f 6e 20 43  ion...[section C
04e0: 6f 6d 70 61 74 69 62 69 6c 69 74 79 5d 0a 54 68  ompatibility].Th
04f0: 69 73 20 65 78 74 65 6e 73 69 6f 6e 20 69 73 20  is extension is 
0500: 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68 20  compatible with 
0510: 4f 70 65 6e 53 53 4c 20 31 2e 31 2e 31 20 6f 72  OpenSSL 1.1.1 or
0520: 20 6c 61 74 65 72 2e 20 49 74 20 72 65 71 75 69   later. It requi
0530: 72 65 73 20 54 63 6c 0a 76 65 72 73 69 6f 6e 20  res Tcl.version 
0540: 38 2e 35 20 6f 72 20 6c 61 74 65 72 20 61 6e 64  8.5 or later and
0550: 20 77 69 6c 6c 20 77 6f 72 6b 20 77 69 74 68 20   will work with 
0560: 54 63 6c 20 39 2e 30 2e 0a 0a 5b 73 65 63 74 69  Tcl 9.0...[secti
0570: 6f 6e 20 43 6f 6d 6d 61 6e 64 73 5d 0a 0a 54 68  on Commands]..Th
0580: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20  e following are 
0590: 74 68 65 20 63 6f 6d 6d 61 6e 64 73 20 70 72 6f  the commands pro
05a0: 76 69 64 65 64 20 62 79 20 74 68 65 20 54 63 4c  vided by the TcL
05b0: 54 4c 53 20 70 61 63 6b 61 67 65 2e 20 53 65 65  TLS package. See
05c0: 20 74 68 65 0a 5b 73 65 63 74 72 65 66 20 45 78   the.[sectref Ex
05d0: 61 6d 70 6c 65 73 5d 20 66 6f 72 20 65 78 61 6d  amples] for exam
05e0: 70 6c 65 20 75 73 61 67 65 20 61 6e 64 20 74 68  ple usage and th
05f0: 65 20 5b 66 69 6c 65 20 64 65 6d 6f 73 5d 20 64  e [file demos] d
0600: 69 72 65 63 74 6f 72 79 20 66 6f 72 0a 6d 6f 72  irectory for.mor
0610: 65 20 65 78 61 6d 70 6c 65 20 75 73 61 67 65 2e  e example usage.
0620: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
0630: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 63 61 6c  finitions]..[cal
0640: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6e 69 74  l [cmd tls::init
0650: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74  ] [opt [arg -opt
0660: 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  ion]] [opt [arg 
0670: 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72  value]] [opt [ar
0680: 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65  g "-option value
0690: 20 2e 2e 2e 22 5d 5d 5d 0a 0a 4f 70 74 69 6f 6e   ..."]]]..Option
06a0: 61 6c 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 73  al function to s
06b0: 65 74 20 74 68 65 20 64 65 66 61 75 6c 74 20 6f  et the default o
06c0: 70 74 69 6f 6e 73 20 75 73 65 64 20 62 79 20 5b  ptions used by [
06d0: 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d  cmd tls::socket]
06e0: 2e 20 49 66 20 79 6f 75 0a 63 61 6c 6c 20 5b 63  . If you.call [c
06f0: 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20  md tls::import] 
0700: 64 69 72 65 63 74 6c 79 2c 20 74 68 65 20 76 61  directly, the va
0710: 6c 75 65 73 20 73 65 74 20 62 79 20 74 68 69 73  lues set by this
0720: 20 63 6f 6d 6d 61 6e 64 20 68 61 76 65 20 6e 6f   command have no
0730: 20 65 66 66 65 63 74 2e 0a 54 68 69 73 20 63 6f   effect..This co
0740: 6d 6d 61 6e 64 20 73 75 70 70 6f 72 74 73 20 61  mmand supports a
0750: 6c 6c 20 6f 66 20 74 68 65 20 73 61 6d 65 20 6f  ll of the same o
0760: 70 74 69 6f 6e 73 20 61 73 20 74 68 65 20 5b 63  ptions as the [c
0770: 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20  md tls::socket] 
0780: 63 6f 6d 6d 61 6e 64 2c 0a 74 68 6f 75 67 68 20  command,.though 
0790: 79 6f 75 20 73 68 6f 75 6c 64 20 6c 69 6d 69 74  you should limit
07a0: 20 79 6f 75 72 20 6f 70 74 69 6f 6e 73 20 74 6f   your options to
07b0: 20 6f 6e 6c 79 20 74 68 65 20 54 4c 53 20 72 65   only the TLS re
07c0: 6c 61 74 65 64 20 6f 6e 65 73 2e 0a 0a 5b 63 61  lated ones...[ca
07d0: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63  ll [cmd tls::soc
07e0: 6b 65 74 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d  ket] [opt [arg -
07f0: 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61  option]] [opt [a
0800: 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20  rg value]] [opt 
0810: 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61  [arg "-option va
0820: 6c 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20  lue ..."]] [arg 
0830: 68 6f 73 74 5d 20 5b 61 72 67 20 70 6f 72 74 5d  host] [arg port]
0840: 5d 0a 0a 54 68 69 73 20 69 73 20 61 20 68 65 6c  ]..This is a hel
0850: 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 74 68 61  per function tha
0860: 74 20 75 74 69 6c 69 7a 65 73 20 74 68 65 20 75  t utilizes the u
0870: 6e 64 65 72 6c 79 69 6e 67 20 63 6f 6d 6d 61 6e  nderlying comman
0880: 64 73 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65  ds [syscmd socke
0890: 74 5d 0a 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a  t].and [cmd tls:
08a0: 3a 69 6d 70 6f 72 74 5d 20 74 6f 20 63 72 65 61  :import] to crea
08b0: 74 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f  te the connectio
08c0: 6e 2e 20 49 74 20 62 65 68 61 76 65 73 20 74 68  n. It behaves th
08d0: 65 20 73 61 6d 65 20 61 73 20 74 68 65 0a 6e 61  e same as the.na
08e0: 74 69 76 65 20 54 43 4c 20 5b 73 79 73 63 6d 64  tive TCL [syscmd
08f0: 20 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64   socket] command
0900: 2c 20 62 75 74 20 61 6c 73 6f 20 73 75 70 70 6f  , but also suppo
0910: 72 74 73 20 74 68 65 20 5b 63 6d 64 20 74 6c 73  rts the [cmd tls
0920: 3a 3a 69 6d 70 6f 72 74 5d 0a 63 6f 6d 6d 61 6e  ::import].comman
0930: 64 20 6f 70 74 69 6f 6e 73 20 77 69 74 68 20 6f  d options with o
0940: 6e 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70  ne additional op
0950: 74 69 6f 6e 2e 20 49 74 20 72 65 74 75 72 6e 73  tion. It returns
0960: 20 74 68 65 20 63 68 61 6e 6e 65 6c 20 68 61 6e   the channel han
0970: 64 6c 65 20 69 64 0a 66 6f 72 20 74 68 65 20 6e  dle id.for the n
0980: 65 77 20 73 6f 63 6b 65 74 2e 0a 0a 5b 6c 69 73  ew socket...[lis
0990: 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d  t_begin options]
09a0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 75 74 6f  ..[opt_def -auto
09b0: 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 20  servername [arg 
09c0: 62 6f 6f 6c 5d 5d 0a 49 66 20 5b 63 6f 6e 73 74  bool]].If [const
09d0: 20 74 72 75 65 5d 2c 20 61 75 74 6f 6d 61 74 69   true], automati
09e0: 63 61 6c 6c 79 20 73 65 74 20 74 68 65 20 5b 6f  cally set the [o
09f0: 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d  ption -servernam
0a00: 65 5d 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74  e] argument to t
0a10: 68 65 0a 5b 65 6d 70 68 20 68 6f 73 74 5d 20 61  he.[emph host] a
0a20: 72 67 75 6d 65 6e 74 2e 20 50 72 69 6f 72 20 74  rgument. Prior t
0a30: 6f 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68  o TclTLS 2.0, th
0a40: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
0a50: 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 53 74 61 72  nst false]..Star
0a60: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ting in TclTLS 2
0a70: 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20  .0, the default 
0a80: 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 20  is [const true] 
0a90: 75 6e 6c 65 73 73 20 5b 6f 70 74 69 6f 6e 20 2d  unless [option -
0aa0: 73 65 72 76 65 72 6e 61 6d 65 5d 0a 69 73 20 61  servername].is a
0ab0: 6c 73 6f 20 73 70 65 63 69 66 69 65 64 2e 0a 0a  lso specified...
0ac0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c  [list_end]..[cal
0ad0: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b  l [cmd tls::sock
0ae0: 65 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72  et] [option -ser
0af0: 76 65 72 5d 20 5b 61 72 67 20 63 6f 6d 6d 61 6e  ver] [arg comman
0b00: 64 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70  d] [opt [arg -op
0b10: 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67  tion]] [opt [arg
0b20: 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61   value]] [opt [a
0b30: 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75  rg "-option valu
0b40: 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 70 6f  e ..."]] [arg po
0b50: 72 74 5d 5d 0a 0a 53 61 6d 65 20 61 73 20 70 72  rt]]..Same as pr
0b60: 65 76 69 6f 75 73 2c 20 62 75 74 20 69 6e 73 74  evious, but inst
0b70: 65 61 64 20 63 72 65 61 74 65 73 20 61 20 73 65  ead creates a se
0b80: 72 76 65 72 20 73 6f 63 6b 65 74 20 66 6f 72 20  rver socket for 
0b90: 63 6c 69 65 6e 74 73 20 74 6f 20 63 6f 6e 6e 65  clients to conne
0ba0: 63 74 20 74 6f 0a 6a 75 73 74 20 6c 69 6b 65 20  ct to.just like 
0bb0: 74 68 65 20 54 63 6c 20 5b 73 79 73 63 6d 64 20  the Tcl [syscmd 
0bc0: 22 73 6f 63 6b 65 74 20 2d 73 65 72 76 65 72 22  "socket -server"
0bd0: 5d 20 63 6f 6d 6d 61 6e 64 2e 20 49 74 20 72 65  ] command. It re
0be0: 74 75 72 6e 73 20 74 68 65 20 63 68 61 6e 6e 65  turns the channe
0bf0: 6c 0a 68 61 6e 64 6c 65 20 69 64 20 66 6f 72 20  l.handle id for 
0c00: 74 68 65 20 6e 65 77 20 73 6f 63 6b 65 74 2e 0a  the new socket..
0c10: 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a  .[call [cmd tls:
0c20: 3a 69 6d 70 6f 72 74 5d 20 5b 61 72 67 20 63 68  :import] [arg ch
0c30: 61 6e 6e 65 6c 5d 20 5b 6f 70 74 20 5b 61 72 67  annel] [opt [arg
0c40: 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20   -option]] [opt 
0c50: 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70  [arg value]] [op
0c60: 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20  t [arg "-option 
0c70: 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d 0a 0a 53  value ..."]]]..S
0c80: 74 61 72 74 20 54 4c 53 20 65 6e 63 72 79 70 74  tart TLS encrypt
0c90: 69 6f 6e 20 6f 6e 20 54 43 4c 20 63 68 61 6e 6e  ion on TCL chann
0ca0: 65 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  el [arg channel]
0cb0: 20 76 69 61 20 61 20 73 74 61 63 6b 65 64 20 63   via a stacked c
0cc0: 68 61 6e 6e 65 6c 2e 20 49 74 0a 6e 65 65 64 20  hannel. It.need 
0cd0: 6e 6f 74 20 62 65 20 61 20 73 6f 63 6b 65 74 2c  not be a socket,
0ce0: 20 62 75 74 20 6d 75 73 74 20 70 72 6f 76 69 64   but must provid
0cf0: 65 20 62 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c  e bi-directional
0d00: 20 66 6c 6f 77 2e 20 41 6c 73 6f 20 73 65 74 73   flow. Also sets
0d10: 20 73 65 73 73 69 6f 6e 0a 70 61 72 61 6d 65 74   session.paramet
0d20: 65 72 73 20 66 6f 72 20 53 53 4c 20 68 61 6e 64  ers for SSL hand
0d30: 73 68 61 6b 65 2e 20 56 61 6c 69 64 20 6f 70 74  shake. Valid opt
0d40: 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74  ions are:..[list
0d50: 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a  _begin options].
0d60: 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 6c 70 6e 20  .[opt_def -alpn 
0d70: 5b 61 72 67 20 6c 69 73 74 5d 5d 0a 4c 69 73 74  [arg list]].List
0d80: 20 6f 66 20 70 72 6f 74 6f 63 6f 6c 73 20 74 6f   of protocols to
0d90: 20 6f 66 66 65 72 20 64 75 72 69 6e 67 20 41 70   offer during Ap
0da0: 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20  plication-Layer 
0db0: 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61  Protocol Negotia
0dc0: 74 69 6f 6e 0a 28 41 4c 50 4e 29 2e 20 46 6f 72  tion.(ALPN). For
0dd0: 20 65 78 61 6d 70 6c 65 3a 20 5b 63 6f 6e 73 74   example: [const
0de0: 20 68 32 5d 20 61 6e 64 20 5b 63 6f 6e 73 74 20   h2] and [const 
0df0: 68 74 74 70 2f 31 2e 31 5d 2c 20 62 75 74 20 6e  http/1.1], but n
0e00: 6f 74 20 5b 63 6f 6e 73 74 20 68 33 5d 20 6f 72  ot [const h3] or
0e10: 0a 5b 63 6f 6e 73 74 20 71 75 69 63 5d 2e 20 54  .[const quic]. T
0e20: 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65  his option is ne
0e30: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
0e40: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64  ...[opt_def -cad
0e50: 69 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72  ir [arg director
0e60: 79 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  y]].Specifies th
0e70: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72  e directory wher
0e80: 65 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  e the Certificat
0e90: 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e Authority (CA)
0ea0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72   certificates ar
0eb0: 65 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65  e.stored. The de
0ec0: 66 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72  fault is platfor
0ed0: 6d 20 73 70 65 63 69 66 69 63 20 61 6e 64 20 63  m specific and c
0ee0: 61 6e 20 62 65 20 73 65 74 20 61 74 20 63 6f 6d  an be set at com
0ef0: 70 69 6c 65 20 74 69 6d 65 2e 20 54 68 65 0a 64  pile time. The.d
0f00: 65 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20  efault location 
0f10: 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65  can be overridde
0f20: 6e 20 62 79 20 74 68 65 20 5b 76 61 72 20 53 53  n by the [var SS
0f30: 4c 5f 43 45 52 54 5f 44 49 52 5d 20 65 6e 76 69  L_CERT_DIR] envi
0f40: 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65  ronment.variable
0f50: 2e 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22  . See [sectref "
0f60: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
0f70: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72  dation"] for mor
0f80: 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74  e details...[opt
0f90: 5f 64 65 66 20 2d 63 61 66 69 6c 65 20 5b 61 72  _def -cafile [ar
0fa0: 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65  g filename]].Spe
0fb0: 63 69 66 69 65 73 20 74 68 65 20 66 69 6c 65 20  cifies the file 
0fc0: 77 69 74 68 20 74 68 65 20 43 65 72 74 69 66 69  with the Certifi
0fd0: 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28  cate Authority (
0fe0: 43 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73  CA) certificates
0ff0: 20 74 6f 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73   to use in.[cons
1000: 74 20 50 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d  t PEM] file form
1010: 61 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  at. The default 
1020: 69 73 20 5b 66 69 6c 65 20 63 65 72 74 2e 70 65  is [file cert.pe
1030: 6d 5d 2c 20 69 6e 20 74 68 65 20 4f 70 65 6e 53  m], in the OpenS
1040: 53 4c 0a 64 69 72 65 63 74 6f 72 79 2e 20 54 68  SL.directory. Th
1050: 65 20 64 65 66 61 75 6c 74 20 66 69 6c 65 20 63  e default file c
1060: 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e  an be overridden
1070: 20 62 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c   by the [var SSL
1080: 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69  _CERT_FILE] envi
1090: 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65  ronment.variable
10a0: 2e 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22  . See [sectref "
10b0: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
10c0: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72  dation"] for mor
10d0: 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74  e details...[opt
10e0: 5f 64 65 66 20 2d 63 61 73 74 6f 72 65 20 5b 61  _def -castore [a
10f0: 72 67 20 55 52 49 5d 5d 0a 53 70 65 63 69 66 69  rg URI]].Specifi
1100: 65 73 20 74 68 65 20 55 6e 69 66 6f 72 6d 20 52  es the Uniform R
1110: 65 73 6f 75 72 63 65 20 49 64 65 6e 74 69 66 69  esource Identifi
1120: 65 72 20 28 55 52 49 29 20 66 6f 72 20 74 68 65  er (URI) for the
1130: 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74   Certificate Aut
1140: 68 6f 72 69 74 79 0a 28 43 41 29 20 73 74 6f 72  hority.(CA) stor
1150: 65 2c 20 77 68 69 63 68 20 6d 61 79 20 62 65 20  e, which may be 
1160: 61 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61 69 6e  a single contain
1170: 65 72 20 6f 72 20 61 20 63 61 74 61 6c 6f 67 20  er or a catalog 
1180: 6f 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e 0a 53  of containers..S
1190: 74 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65  tarting with Ope
11a0: 6e 53 53 4c 20 33 2e 32 20 6f 6e 20 4d 53 20 57  nSSL 3.2 on MS W
11b0: 69 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20 22  indows, set to "
11c0: 5b 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e  [const "org.open
11d0: 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22  ssl.winstore://"
11e0: 5d 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62 75  ]".to use the bu
11f0: 69 6c 74 2d 69 6e 20 4d 53 20 57 69 6e 64 6f 77  ilt-in MS Window
1200: 73 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74  s Certificate St
1210: 6f 72 65 2e 0a 53 65 65 20 5b 73 65 63 74 72 65  ore..See [sectre
1220: 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56  f "Certificate V
1230: 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20  alidation"] for 
1240: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 54 68  more details..Th
1250: 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65 77  is option is new
1260: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
1270: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 65 72 74  ..[opt_def -cert
1280: 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61  file [arg filena
1290: 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  me]].Specifies t
12a0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 66  he name of the f
12b0: 69 6c 65 20 77 69 74 68 20 74 68 65 20 63 65 72  ile with the cer
12c0: 74 69 66 69 63 61 74 65 20 74 6f 20 75 73 65 20  tificate to use 
12d0: 69 6e 20 50 45 4d 20 66 6f 72 6d 61 74 0a 61 73  in PEM format.as
12e0: 20 74 68 65 20 6c 6f 63 61 6c 20 28 63 6c 69 65   the local (clie
12f0: 6e 74 20 6f 72 20 73 65 72 76 65 72 29 20 63 65  nt or server) ce
1300: 72 74 69 66 69 63 61 74 65 2e 20 49 74 20 61 6c  rtificate. It al
1310: 73 6f 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20  so contains the 
1320: 70 75 62 6c 69 63 20 6b 65 79 2e 0a 0a 5b 6f 70  public key...[op
1330: 74 5f 64 65 66 20 2d 63 65 72 74 20 5b 61 72 67  t_def -cert [arg
1340: 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66   string]].Specif
1350: 69 65 73 20 74 68 65 20 63 65 72 74 69 66 69 63  ies the certific
1360: 61 74 65 20 74 6f 20 75 73 65 20 61 73 20 61 20  ate to use as a 
1370: 44 45 52 20 65 6e 63 6f 64 65 64 20 73 74 72 69  DER encoded stri
1380: 6e 67 20 28 58 2e 35 30 39 20 44 45 52 29 2e 0a  ng (X.509 DER)..
1390: 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 69 70 68 65  .[opt_def -ciphe
13a0: 72 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a  r [arg string]].
13b0: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 6c 69  Specifies the li
13c0: 73 74 20 6f 66 20 63 69 70 68 65 72 73 20 74 6f  st of ciphers to
13d0: 20 75 73 65 20 66 6f 72 20 54 4c 53 20 31 2e 32   use for TLS 1.2
13e0: 20 61 6e 64 20 65 61 72 6c 69 65 72 20 63 6f 6e   and earlier con
13f0: 6e 65 63 74 69 6f 6e 73 2e 0a 53 74 72 69 6e 67  nections..String
1400: 20 69 73 20 61 20 63 6f 6c 6f 6e 20 22 5b 63 6f   is a colon "[co
1410: 6e 73 74 20 3a 5d 22 20 73 65 70 61 72 61 74 65  nst :]" separate
1420: 64 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72  d list of cipher
1430: 73 2e 0a 43 69 70 68 65 72 73 20 63 61 6e 20 62  s..Ciphers can b
1440: 65 20 63 6f 6d 62 69 6e 65 64 20 75 73 69 6e 67  e combined using
1450: 20 74 68 65 20 22 5b 63 6f 6e 73 74 20 2b 5d 22   the "[const +]"
1460: 20 63 68 61 72 61 63 74 65 72 2e 0a 50 72 65 66   character..Pref
1470: 69 78 65 73 20 63 61 6e 20 62 65 20 75 73 65 64  ixes can be used
1480: 20 74 6f 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20   to permanently 
1490: 72 65 6d 6f 76 65 20 22 5b 63 6f 6e 73 74 20 21  remove "[const !
14a0: 5d 22 2c 20 64 65 6c 65 74 65 20 22 5b 63 6f 6e  ]", delete "[con
14b0: 73 74 20 2d 5d 22 2c 20 6f 72 0a 6d 6f 76 65 20  st -]", or.move 
14c0: 74 6f 20 74 68 65 20 65 6e 64 20 22 5b 63 6f 6e  to the end "[con
14d0: 73 74 20 2b 5d 22 20 61 20 73 70 65 63 69 66 69  st +]" a specifi
14e0: 65 64 20 63 69 70 68 65 72 2e 0a 4b 65 79 77 6f  ed cipher..Keywo
14f0: 72 64 73 20 5b 63 6f 6e 73 74 20 40 53 54 52 45  rds [const @STRE
1500: 4e 47 54 48 5d 20 28 73 6f 72 74 20 62 79 20 61  NGTH] (sort by a
1510: 6c 67 6f 72 69 74 68 6d 20 6b 65 79 20 6c 65 6e  lgorithm key len
1520: 67 74 68 29 2c 0a 5b 63 6f 6e 73 74 20 40 53 45  gth),.[const @SE
1530: 43 4c 45 56 45 4c 3d 5d 5b 65 6d 70 68 20 6e 5d  CLEVEL=][emph n]
1540: 20 28 73 65 74 20 73 65 63 75 72 69 74 79 20 6c   (set security l
1550: 65 76 65 6c 20 74 6f 20 6e 29 2c 20 61 6e 64 0a  evel to n), and.
1560: 5b 63 6f 6e 73 74 20 44 45 46 41 55 4c 54 5d 20  [const DEFAULT] 
1570: 28 75 73 65 20 64 65 66 61 75 6c 74 20 63 69 70  (use default cip
1580: 68 65 72 20 6c 69 73 74 2c 20 61 74 20 73 74 61  her list, at sta
1590: 72 74 20 6f 6e 6c 79 29 20 63 61 6e 20 61 6c 73  rt only) can als
15a0: 6f 20 62 65 20 73 70 65 63 69 66 69 65 64 2e 0a  o be specified..
15b0: 53 65 65 20 74 68 65 20 5b 75 72 69 20 22 68 74  See the [uri "ht
15c0: 74 70 73 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73  tps://docs.opens
15d0: 73 6c 2e 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61  sl.org/master/ma
15e0: 6e 31 2f 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65  n1/openssl-ciphe
15f0: 72 73 2f 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65  rs/#options" Ope
1600: 6e 53 53 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74  nSSL].documentat
1610: 69 6f 6e 20 66 6f 72 20 74 68 65 20 66 75 6c 6c  ion for the full
1620: 20 6c 69 73 74 20 6f 66 20 76 61 6c 69 64 20 76   list of valid v
1630: 61 6c 75 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66  alues...[opt_def
1640: 20 2d 63 69 70 68 65 72 73 75 69 74 65 73 20 5b   -ciphersuites [
1650: 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65  arg string]].Spe
1660: 63 69 66 69 65 73 20 74 68 65 20 6c 69 73 74 20  cifies the list 
1670: 6f 66 20 63 69 70 68 65 72 20 73 75 69 74 65 73  of cipher suites
1680: 20 74 6f 20 75 73 65 20 66 6f 72 20 54 4c 53 20   to use for TLS 
1690: 31 2e 33 20 61 73 20 61 20 63 6f 6c 6f 6e 0a 22  1.3 as a colon."
16a0: 5b 63 6f 6e 73 74 20 3a 5d 22 20 73 65 70 61 72  [const :]" separ
16b0: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 63 69 70  ated list of cip
16c0: 68 65 72 20 73 75 69 74 65 20 6e 61 6d 65 73 2e  her suite names.
16d0: 20 53 65 65 20 74 68 65 0a 5b 75 72 69 20 22 68   See the.[uri "h
16e0: 74 74 70 73 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e  ttps://docs.open
16f0: 73 73 6c 2e 6f 72 67 2f 6d 61 73 74 65 72 2f 6d  ssl.org/master/m
1700: 61 6e 31 2f 6f 70 65 6e 73 73 6c 2d 63 69 70 68  an1/openssl-ciph
1710: 65 72 73 2f 23 6f 70 74 69 6f 6e 73 22 20 4f 70  ers/#options" Op
1720: 65 6e 53 53 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61  enSSL].documenta
1730: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 66 75 6c  tion for the ful
1740: 6c 20 6c 69 73 74 20 6f 66 20 76 61 6c 69 64 20  l list of valid 
1750: 76 61 6c 75 65 73 2e 0a 54 68 69 73 20 6f 70 74  values..This opt
1760: 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54  ion is new for T
1770: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74  clTLS 1.8...[opt
1780: 5f 64 65 66 20 2d 63 6f 6d 6d 61 6e 64 20 5b 61  _def -command [a
1790: 72 67 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70  rg callback]].Sp
17a0: 65 63 69 66 69 65 73 20 74 68 65 20 63 61 6c 6c  ecifies the call
17b0: 62 61 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20  back command to 
17c0: 62 65 20 69 6e 76 6f 6b 65 64 20 61 74 20 73 65  be invoked at se
17d0: 76 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75 72  veral points dur
17e0: 69 6e 67 20 74 68 65 0a 68 61 6e 64 73 68 61 6b  ing the.handshak
17f0: 65 20 74 6f 20 70 61 73 73 20 65 72 72 6f 72 73  e to pass errors
1800: 2c 20 74 72 61 63 69 6e 67 20 69 6e 66 6f 72 6d  , tracing inform
1810: 61 74 69 6f 6e 2c 20 61 6e 64 20 70 72 6f 74 6f  ation, and proto
1820: 63 6f 6c 20 6d 65 73 73 61 67 65 73 2e 0a 53 65  col messages..Se
1830: 65 20 5b 73 65 63 74 72 65 66 20 22 43 61 6c 6c  e [sectref "Call
1840: 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d 20 66  back Options"] f
1850: 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b  or more info...[
1860: 6f 70 74 5f 64 65 66 20 2d 64 68 70 61 72 61 6d  opt_def -dhparam
1870: 73 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d  s [arg filename]
1880: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
1890: 44 69 66 66 69 65 2d 48 65 6c 6c 6d 61 6e 20 28  Diffie-Hellman (
18a0: 44 48 29 20 70 61 72 61 6d 65 74 65 72 73 20 66  DH) parameters f
18b0: 69 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ile...[opt_def -
18c0: 6b 65 79 66 69 6c 65 20 5b 61 72 67 20 66 69 6c  keyfile [arg fil
18d0: 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65  ename]].Specifie
18e0: 73 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65  s the private ke
18f0: 79 20 66 69 6c 65 2e 20 54 68 65 20 64 65 66 61  y file. The defa
1900: 75 6c 74 20 69 73 20 74 6f 20 75 73 65 20 74 68  ult is to use th
1910: 65 20 66 69 6c 65 0a 73 70 65 63 69 66 69 65 64  e file.specified
1920: 20 62 79 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20   by the [option 
1930: 2d 63 65 72 74 66 69 6c 65 5d 20 6f 70 74 69 6f  -certfile] optio
1940: 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 6b 65  n...[opt_def -ke
1950: 79 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a  y [arg string]].
1960: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 70 72  Specifies the pr
1970: 69 76 61 74 65 20 6b 65 79 20 74 6f 20 75 73 65  ivate key to use
1980: 20 61 73 20 61 20 44 45 52 20 65 6e 63 6f 64 65   as a DER encode
1990: 64 20 73 74 72 69 6e 67 20 28 50 4b 43 53 23 31  d string (PKCS#1
19a0: 20 44 45 52 29 2e 0a 0a 5b 6f 70 74 5f 64 65 66   DER)...[opt_def
19b0: 20 2d 6d 6f 64 65 6c 20 5b 61 72 67 20 63 68 61   -model [arg cha
19c0: 6e 6e 65 6c 5d 5d 0a 46 6f 72 63 65 20 74 68 69  nnel]].Force thi
19d0: 73 20 63 68 61 6e 6e 65 6c 20 74 6f 20 73 68 61  s channel to sha
19e0: 72 65 20 74 68 65 20 73 61 6d 65 20 5b 74 65 72  re the same [ter
19f0: 6d 20 53 53 4c 5f 43 54 58 5d 20 73 74 72 75 63  m SSL_CTX] struc
1a00: 74 75 72 65 20 61 73 20 74 68 65 0a 73 70 65 63  ture as the.spec
1a10: 69 66 69 65 64 20 5b 61 72 67 20 63 68 61 6e 6e  ified [arg chann
1a20: 65 6c 5d 2c 20 61 6e 64 20 74 68 65 72 65 66 6f  el], and therefo
1a30: 72 65 20 73 68 61 72 65 20 63 6f 6e 66 69 67 2c  re share config,
1a40: 20 63 61 6c 6c 62 61 63 6b 73 2c 20 65 74 63 2e   callbacks, etc.
1a50: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 70 61 73 73  ..[opt_def -pass
1a60: 77 6f 72 64 20 5b 61 72 67 20 63 61 6c 6c 62 61  word [arg callba
1a70: 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  ck]].Specifies t
1a80: 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d  he callback comm
1a90: 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20 77 68  and to invoke wh
1aa0: 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73  en OpenSSL needs
1ab0: 20 74 6f 20 6f 62 74 61 69 6e 20 61 0a 70 61 73   to obtain a.pas
1ac0: 73 77 6f 72 64 2e 20 54 68 69 73 20 69 73 20 74  sword. This is t
1ad0: 79 70 69 63 61 6c 6c 79 20 75 73 65 64 20 74 6f  ypically used to
1ae0: 20 75 6e 6c 6f 63 6b 20 74 68 65 20 70 72 69 76   unlock the priv
1af0: 61 74 65 20 6b 65 79 20 6f 66 20 61 20 63 65 72  ate key of a cer
1b00: 74 69 66 69 63 61 74 65 2e 0a 54 68 65 20 63 61  tificate..The ca
1b10: 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65  llback should re
1b20: 74 75 72 6e 20 61 20 70 61 73 73 77 6f 72 64 20  turn a password 
1b30: 73 74 72 69 6e 67 2e 20 54 68 69 73 20 6f 70 74  string. This opt
1b40: 69 6f 6e 20 68 61 73 20 63 68 61 6e 67 65 64 20  ion has changed 
1b50: 66 6f 72 0a 54 63 6c 54 4c 53 20 31 2e 38 2e 20  for.TclTLS 1.8. 
1b60: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 61  See [sectref "Ca
1b70: 6c 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d  llback Options"]
1b80: 20 66 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 0a   for more info..
1b90: 0a 5b 6f 70 74 5f 64 65 66 20 2d 70 6f 73 74 5f  .[opt_def -post_
1ba0: 68 61 6e 64 73 68 61 6b 65 20 5b 61 72 67 20 62  handshake [arg b
1bb0: 6f 6f 6c 5d 5d 0a 41 6c 6c 6f 77 20 70 6f 73 74  ool]].Allow post
1bc0: 2d 68 61 6e 64 73 68 61 6b 65 20 73 65 73 73 69  -handshake sessi
1bd0: 6f 6e 20 74 69 63 6b 65 74 20 75 70 64 61 74 65  on ticket update
1be0: 73 2e 20 54 68 69 73 20 6f 70 74 69 6f 6e 20 69  s. This option i
1bf0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
1c00: 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20   1.8...[opt_def 
1c10: 2d 72 65 71 75 65 73 74 20 5b 61 72 67 20 62 6f  -request [arg bo
1c20: 6f 6c 5d 5d 0a 52 65 71 75 65 73 74 20 61 20 63  ol]].Request a c
1c30: 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20  ertificate from 
1c40: 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67 20  the peer during 
1c50: 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b  the SSL handshak
1c60: 65 2e 20 54 68 69 73 20 69 73 20 6e 65 65 64 65  e. This is neede
1c70: 64 0a 74 6f 20 64 6f 20 43 65 72 74 69 66 69 63  d.to do Certific
1c80: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 2e 20  ate Validation. 
1c90: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54  Starting in TclT
1ca0: 4c 53 20 31 2e 38 2c 20 74 68 65 20 64 65 66 61  LS 1.8, the defa
1cb0: 75 6c 74 20 69 73 0a 5b 63 6f 6e 73 74 20 74 72  ult is.[const tr
1cc0: 75 65 5d 2e 20 53 74 61 72 74 69 6e 67 20 69 6e  ue]. Starting in
1cd0: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 69 66 20   TclTLS 2.0, if 
1ce0: 73 65 74 20 74 6f 20 5b 63 6f 6e 73 74 20 66 61  set to [const fa
1cf0: 6c 73 65 5d 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e  lse] and.[option
1d00: 20 2d 72 65 71 75 69 72 65 5d 20 69 73 20 5b 63   -require] is [c
1d10: 6f 6e 73 74 20 74 72 75 65 5d 2c 20 74 68 65 6e  onst true], then
1d20: 20 74 68 69 73 20 77 69 6c 6c 20 62 65 20 6f 76   this will be ov
1d30: 65 72 72 69 64 64 65 6e 20 74 6f 20 5b 63 6f 6e  erridden to [con
1d40: 73 74 20 74 72 75 65 5d 2e 0a 53 65 65 20 5b 73  st true]..See [s
1d50: 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69 63  ectref "Certific
1d60: 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d  ate Validation"]
1d70: 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c   for more detail
1d80: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65  s...[opt_def -re
1d90: 71 75 69 72 65 20 5b 61 72 67 20 62 6f 6f 6c 5d  quire [arg bool]
1da0: 5d 0a 52 65 71 75 69 72 65 20 61 20 76 61 6c 69  ].Require a vali
1db0: 64 20 63 65 72 74 69 66 69 63 61 74 65 20 66 72  d certificate fr
1dc0: 6f 6d 20 74 68 65 20 70 65 65 72 20 64 75 72 69  om the peer duri
1dd0: 6e 67 20 74 68 65 20 53 53 4c 20 68 61 6e 64 73  ng the SSL hands
1de0: 68 61 6b 65 2e 20 49 66 20 74 68 69 73 20 69 73  hake. If this is
1df0: 0a 73 65 74 20 74 6f 20 74 72 75 65 2c 20 74 68  .set to true, th
1e00: 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75  en [option -requ
1e10: 65 73 74 5d 20 6d 75 73 74 20 61 6c 73 6f 20 62  est] must also b
1e20: 65 20 73 65 74 20 74 6f 20 74 72 75 65 20 61 6e  e set to true an
1e30: 64 20 61 20 65 69 74 68 65 72 0a 5b 6f 70 74 69  d a either.[opti
1e40: 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74  on -cadir], [opt
1e50: 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 5b 6f  ion -cafile], [o
1e60: 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 2c  ption -castore],
1e70: 20 6f 72 20 61 20 70 6c 61 74 66 6f 72 6d 20 64   or a platform d
1e80: 65 66 61 75 6c 74 0a 6d 75 73 74 20 62 65 20 70  efault.must be p
1e90: 72 6f 76 69 64 65 64 20 69 6e 20 6f 72 64 65 72  rovided in order
1ea0: 20 74 6f 20 76 61 6c 69 64 61 74 65 20 61 67 61   to validate aga
1eb0: 69 6e 73 74 2e 20 54 68 65 20 64 65 66 61 75 6c  inst. The defaul
1ec0: 74 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20  t in TclTLS 1.8 
1ed0: 61 6e 64 0a 65 61 72 6c 69 65 72 20 76 65 72 73  and.earlier vers
1ee0: 69 6f 6e 73 20 69 73 20 5b 63 6f 6e 73 74 20 66  ions is [const f
1ef0: 61 6c 73 65 5d 20 73 69 6e 63 65 20 6e 6f 74 20  alse] since not 
1f00: 61 6c 6c 20 70 6c 61 74 66 6f 72 6d 73 20 68 61  all platforms ha
1f10: 76 65 20 63 65 72 74 69 66 69 63 61 74 65 73 20  ve certificates 
1f20: 74 6f 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69  to.validate agai
1f30: 6e 73 74 20 69 6e 20 61 20 66 6f 72 6d 20 63 6f  nst in a form co
1f40: 6d 70 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70  mpatible with Op
1f50: 65 6e 53 53 4c 2e 20 53 74 61 72 74 69 6e 67 20  enSSL. Starting 
1f60: 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 0a 74  in TclTLS 2.0,.t
1f70: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63  he default is [c
1f80: 6f 6e 73 74 20 74 72 75 65 5d 2e 0a 53 65 65 20  onst true]..See 
1f90: 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69 66  [sectref "Certif
1fa0: 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e  icate Validation
1fb0: 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61  "] for more deta
1fc0: 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ils...[opt_def -
1fd0: 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 20 5b  security_level [
1fe0: 61 72 67 20 69 6e 74 65 67 65 72 5d 5d 0a 53 70  arg integer]].Sp
1ff0: 65 63 69 66 69 65 73 20 74 68 65 20 73 65 63 75  ecifies the secu
2000: 72 69 74 79 20 6c 65 76 65 6c 20 28 76 61 6c 75  rity level (valu
2010: 65 20 66 72 6f 6d 20 30 20 74 6f 20 35 29 2e 20  e from 0 to 5). 
2020: 54 68 65 20 73 65 63 75 72 69 74 79 20 6c 65 76  The security lev
2030: 65 6c 20 61 66 66 65 63 74 73 0a 74 68 65 20 61  el affects.the a
2040: 6c 6c 6f 77 65 64 20 63 69 70 68 65 72 20 73 75  llowed cipher su
2050: 69 74 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 61  ite encryption a
2060: 6c 67 6f 72 69 74 68 6d 73 2c 20 73 75 70 70 6f  lgorithms, suppo
2070: 72 74 65 64 20 45 43 43 20 63 75 72 76 65 73 2c  rted ECC curves,
2080: 0a 73 75 70 70 6f 72 74 65 64 20 73 69 67 6e 61  .supported signa
2090: 74 75 72 65 20 61 6c 67 6f 72 69 74 68 6d 73 2c  ture algorithms,
20a0: 20 44 48 20 70 61 72 61 6d 65 74 65 72 20 73 69   DH parameter si
20b0: 7a 65 73 2c 20 63 65 72 74 69 66 69 63 61 74 65  zes, certificate
20c0: 20 6b 65 79 20 73 69 7a 65 73 0a 61 6e 64 20 73   key sizes.and s
20d0: 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72 69 74  ignature algorit
20e0: 68 6d 73 2e 20 54 68 65 20 64 65 66 61 75 6c 74  hms. The default
20f0: 20 69 73 20 31 20 70 72 69 6f 72 20 74 6f 20 4f   is 1 prior to O
2100: 70 65 6e 53 53 4c 20 33 2e 32 20 61 6e 64 20 32  penSSL 3.2 and 2
2110: 0a 74 68 65 72 65 61 66 74 65 72 2e 20 4c 65 76  .thereafter. Lev
2120: 65 6c 20 33 20 61 6e 64 20 68 69 67 68 65 72 20  el 3 and higher 
2130: 64 69 73 61 62 6c 65 20 73 75 70 70 6f 72 74 20  disable support 
2140: 66 6f 72 20 73 65 73 73 69 6f 6e 20 74 69 63 6b  for session tick
2150: 65 74 73 20 61 6e 64 0a 6f 6e 6c 79 20 61 63 63  ets and.only acc
2160: 65 70 74 20 63 69 70 68 65 72 20 73 75 69 74 65  ept cipher suite
2170: 73 20 74 68 61 74 20 70 72 6f 76 69 64 65 20 66  s that provide f
2180: 6f 72 77 61 72 64 20 73 65 63 72 65 63 79 2e 0a  orward secrecy..
2190: 54 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e  This option is n
21a0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
21b0: 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65  8...[opt_def -se
21c0: 72 76 65 72 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d  rver [arg bool]]
21d0: 0a 53 70 65 63 69 66 69 65 73 20 77 68 65 74 68  .Specifies wheth
21e0: 65 72 20 74 6f 20 61 63 74 20 61 73 20 61 20 73  er to act as a s
21f0: 65 72 76 65 72 20 61 6e 64 20 72 65 73 70 6f 6e  erver and respon
2200: 64 20 77 69 74 68 20 61 20 73 65 72 76 65 72 20  d with a server 
2210: 68 61 6e 64 73 68 61 6b 65 20 77 68 65 6e 20 61  handshake when a
2220: 0a 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 73  .client connects
2230: 20 61 6e 64 20 70 72 6f 76 69 64 65 73 20 61 20   and provides a 
2240: 63 6c 69 65 6e 74 20 68 61 6e 64 73 68 61 6b 65  client handshake
2250: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
2260: 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 0a   [const false]..
2270: 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 72 76 65  .[opt_def -serve
2280: 72 6e 61 6d 65 20 5b 61 72 67 20 68 6f 73 74 6e  rname [arg hostn
2290: 61 6d 65 5d 5d 0a 53 70 65 63 69 66 79 20 74 68  ame]].Specify th
22a0: 65 20 70 65 65 72 27 73 20 68 6f 73 74 6e 61 6d  e peer's hostnam
22b0: 65 2e 20 54 68 69 73 20 69 73 20 75 73 65 64 20  e. This is used 
22c0: 74 6f 20 73 65 74 20 74 68 65 20 54 4c 53 20 53  to set the TLS S
22d0: 65 72 76 65 72 20 4e 61 6d 65 20 49 6e 64 69 63  erver Name Indic
22e0: 61 74 69 6f 6e 0a 28 53 4e 49 29 20 65 78 74 65  ation.(SNI) exte
22f0: 6e 73 69 6f 6e 2e 20 53 65 74 20 74 68 69 73 20  nsion. Set this 
2300: 74 6f 20 74 68 65 20 65 78 70 65 63 74 65 64 20  to the expected 
2310: 73 65 72 76 65 72 6e 61 6d 65 20 69 6e 20 74 68  servername in th
2320: 65 20 73 65 72 76 65 72 27 73 20 63 65 72 74 69  e server's certi
2330: 66 69 63 61 74 65 0a 6f 72 20 6f 6e 65 20 6f 66  ficate.or one of
2340: 20 74 68 65 20 53 75 62 6a 65 63 74 20 41 6c 74   the Subject Alt
2350: 65 72 6e 61 74 65 20 4e 61 6d 65 73 20 28 53 41  ernate Names (SA
2360: 4e 29 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20  N). Starting in 
2370: 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69 73  TclTLS 2.0, this
2380: 20 77 69 6c 6c 0a 64 65 66 61 75 6c 74 20 74 6f   will.default to
2390: 20 74 68 65 20 68 6f 73 74 20 66 6f 72 20 74 68   the host for th
23a0: 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b  e [cmd tls::sock
23b0: 65 74 5d 20 63 6f 6d 6d 61 6e 64 2e 0a 0a 5b 6f  et] command...[o
23c0: 70 74 5f 64 65 66 20 2d 73 65 73 73 69 6f 6e 5f  pt_def -session_
23d0: 69 64 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73  id [arg binary_s
23e0: 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65  tring]].Specifie
23f0: 73 20 74 68 65 20 73 65 73 73 69 6f 6e 20 69 64  s the session id
2400: 20 74 6f 20 72 65 73 75 6d 65 20 61 20 73 65 73   to resume a ses
2410: 73 69 6f 6e 2e 20 4e 6f 74 20 73 75 70 70 6f 72  sion. Not suppor
2420: 74 65 64 20 79 65 74 2e 0a 54 68 69 73 20 6f 70  ted yet..This op
2430: 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20  tion is new for 
2440: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70  TclTLS 1.8...[op
2450: 74 5f 64 65 66 20 2d 73 73 6c 32 20 5b 61 72 67  t_def -ssl2 [arg
2460: 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75   bool]].Enable u
2470: 73 65 20 6f 66 20 53 53 4c 20 76 32 2e 54 68 65  se of SSL v2.The
2480: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
2490: 73 74 20 66 61 6c 73 65 5d 2e 0a 4f 70 65 6e 53  st false]..OpenS
24a0: 53 4c 20 31 2e 31 2b 20 6e 6f 20 6c 6f 6e 67 65  SL 1.1+ no longe
24b0: 72 20 73 75 70 70 6f 72 74 73 20 53 53 4c 20 76  r supports SSL v
24c0: 32 2c 20 73 6f 20 74 68 69 73 20 6d 61 79 20 6e  2, so this may n
24d0: 6f 74 20 68 61 76 65 20 61 6e 79 20 65 66 66 65  ot have any effe
24e0: 63 74 2e 0a 53 65 65 20 74 68 65 20 5b 63 6d 64  ct..See the [cmd
24f0: 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d   tls::protocols]
2500: 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70   command for sup
2510: 70 6f 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73  ported protocols
2520: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73 6c  ...[opt_def -ssl
2530: 33 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e  3 [arg bool]].En
2540: 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20  able use of SSL 
2550: 76 33 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  v3. The default 
2560: 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d  is [const false]
2570: 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63  . Starting in Tc
2580: 6c 54 4c 53 20 31 2e 38 2c 0a 75 73 65 20 6f 66  lTLS 1.8,.use of
2590: 20 53 53 4c 20 76 33 20 69 66 20 6f 6e 6c 79 20   SSL v3 if only 
25a0: 61 76 61 69 6c 61 62 6c 65 20 76 69 61 20 61 20  available via a 
25b0: 63 6f 6d 70 69 6c 65 20 74 69 6d 65 20 6f 70 74  compile time opt
25c0: 69 6f 6e 2e 0a 53 65 65 20 74 68 65 20 5b 63 6d  ion..See the [cm
25d0: 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73  d tls::protocols
25e0: 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75  ] command for su
25f0: 70 70 6f 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c  pported protocol
2600: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c  s...[opt_def -tl
2610: 73 31 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45  s1 [arg bool]].E
2620: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53  nable use of TLS
2630: 20 76 31 2e 20 53 74 61 72 74 69 6e 67 20 69 6e   v1. Starting in
2640: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65   TclTLS 2.0, the
2650: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
2660: 73 74 20 66 61 6c 73 65 5d 2e 0a 4e 6f 74 65 3a  st false]..Note:
2670: 20 54 4c 53 20 31 2e 30 20 6e 65 65 64 73 20 53   TLS 1.0 needs S
2680: 48 41 31 20 74 6f 20 6f 70 65 72 61 74 65 2c 20  HA1 to operate, 
2690: 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 61 76  which is only av
26a0: 61 69 6c 61 62 6c 65 20 69 6e 20 73 65 63 75 72  ailable in secur
26b0: 69 74 79 20 6c 65 76 65 6c 0a 30 20 66 6f 72 20  ity level.0 for 
26c0: 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 20 53  Open SSL 3.0+. S
26d0: 65 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  ee the [option -
26e0: 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20  security_level] 
26f0: 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65  option...[opt_de
2700: 66 20 2d 74 6c 73 31 2e 31 20 5b 61 72 67 20 62  f -tls1.1 [arg b
2710: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
2720: 20 6f 66 20 54 4c 53 20 76 31 2e 31 2e 20 53 74   of TLS v1.1. St
2730: 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53  arting in TclTLS
2740: 20 32 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c   2.0, the defaul
2750: 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73  t is [const fals
2760: 65 5d 2e 0a 4e 6f 74 65 3a 20 54 4c 53 20 31 2e  e]..Note: TLS 1.
2770: 31 20 6e 65 65 64 73 20 53 48 41 31 20 74 6f 20  1 needs SHA1 to 
2780: 6f 70 65 72 61 74 65 2c 20 77 68 69 63 68 20 69  operate, which i
2790: 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65  s only available
27a0: 20 69 6e 20 73 65 63 75 72 69 74 79 20 6c 65 76   in security lev
27b0: 65 6c 0a 30 20 66 6f 72 20 4f 70 65 6e 20 53 53  el.0 for Open SS
27c0: 4c 20 33 2e 30 2b 2e 20 53 65 65 20 74 68 65 20  L 3.0+. See the 
27d0: 5b 6f 70 74 69 6f 6e 20 2d 73 65 63 75 72 69 74  [option -securit
27e0: 79 5f 6c 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e  y_level] option.
27f0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31  ..[opt_def -tls1
2800: 2e 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45  .2 [arg bool]].E
2810: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53  nable use of TLS
2820: 20 76 31 2e 32 2e 20 54 68 65 20 64 65 66 61 75   v1.2. The defau
2830: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75  lt is [const tru
2840: 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74  e]...[opt_def -t
2850: 6c 73 31 2e 33 20 5b 61 72 67 20 62 6f 6f 6c 5d  ls1.3 [arg bool]
2860: 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20  ].Enable use of 
2870: 54 4c 53 20 76 31 2e 33 2e 20 54 68 65 20 64 65  TLS v1.3. The de
2880: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
2890: 74 72 75 65 5d 2e 20 54 68 69 73 20 69 73 20 6f  true]. This is o
28a0: 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 0a 73 74  nly available.st
28b0: 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e  arting with Open
28c0: 53 53 4c 20 31 2e 31 2e 31 20 61 6e 64 20 54 63  SSL 1.1.1 and Tc
28d0: 6c 54 4c 53 20 31 2e 37 2e 0a 0a 5b 6f 70 74 5f  lTLS 1.7...[opt_
28e0: 64 65 66 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d  def -validatecom
28f0: 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62 61  mand [arg callba
2900: 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  ck]].Specifies t
2910: 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d  he callback comm
2920: 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20 74 6f  and to invoke to
2930: 20 76 61 6c 69 64 61 74 65 20 74 68 65 20 70 65   validate the pe
2940: 65 72 20 63 65 72 74 69 66 69 63 61 74 65 73 0a  er certificates.
2950: 61 6e 64 20 6f 74 68 65 72 20 63 6f 6e 66 69 67  and other config
2960: 20 69 6e 66 6f 20 64 75 72 69 6e 67 20 74 68 65   info during the
2970: 20 70 72 6f 74 6f 63 6f 6c 20 6e 65 67 6f 74 69   protocol negoti
2980: 61 74 69 6f 6e 20 70 68 61 73 65 2e 20 54 68 69  ation phase. Thi
2990: 73 20 63 61 6e 20 62 65 20 75 73 65 64 0a 62 79  s can be used.by
29a0: 20 54 43 4c 20 73 63 72 69 70 74 73 20 74 6f 20   TCL scripts to 
29b0: 70 65 72 66 6f 72 6d 20 74 68 65 69 72 20 6f 77  perform their ow
29c0: 6e 20 43 65 72 74 69 66 69 63 61 74 65 20 56 61  n Certificate Va
29d0: 6c 69 64 61 74 69 6f 6e 20 74 6f 20 73 75 70 70  lidation to supp
29e0: 6c 65 6d 65 6e 74 20 74 68 65 0a 64 65 66 61 75  lement the.defau
29f0: 6c 74 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72  lt validation pr
2a00: 6f 76 69 64 65 64 20 62 79 20 4f 70 65 6e 53 53  ovided by OpenSS
2a10: 4c 2e 20 54 68 65 20 73 63 72 69 70 74 20 6d 75  L. The script mu
2a20: 73 74 20 72 65 74 75 72 6e 20 61 20 62 6f 6f 6c  st return a bool
2a30: 65 61 6e 20 74 72 75 65 0a 74 6f 20 63 6f 6e 74  ean true.to cont
2a40: 69 6e 75 65 20 74 68 65 20 6e 65 67 6f 74 69 61  inue the negotia
2a50: 74 69 6f 6e 2e 20 53 65 65 20 5b 73 65 63 74 72  tion. See [sectr
2a60: 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74  ef "Callback Opt
2a70: 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20  ions"] for more 
2a80: 69 6e 66 6f 2e 0a 54 68 69 73 20 6f 70 74 69 6f  info..This optio
2a90: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  n is new for Tcl
2aa0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f  TLS 1.8...[list_
2ab0: 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  end]..[call [cmd
2ac0: 20 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d 20   tls::unimport] 
2ad0: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a  [arg channel]]..
2ae0: 43 6f 6d 70 6c 69 6d 65 6e 74 20 74 6f 20 5b 63  Compliment to [c
2af0: 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e  md tls::import].
2b00: 20 55 73 65 64 20 74 6f 20 72 65 6d 6f 76 65 20   Used to remove 
2b10: 74 68 65 20 74 6f 70 20 6c 65 76 65 6c 20 73 74  the top level st
2b20: 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 0a 66 72  acked channel.fr
2b30: 6f 6d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  om [arg channel]
2b40: 2e 20 54 68 69 73 20 75 6e 73 74 61 63 6b 73 20  . This unstacks 
2b50: 74 68 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f  the encryption o
2b60: 66 20 61 20 72 65 67 75 6c 61 72 20 54 43 4c 20  f a regular TCL 
2b70: 63 68 61 6e 6e 65 6c 2e 20 41 6e 0a 65 72 72 6f  channel. An.erro
2b80: 72 20 69 73 20 74 68 72 6f 77 6e 20 69 66 20 54  r is thrown if T
2b90: 4c 53 20 69 73 20 6e 6f 74 20 74 68 65 20 74 6f  LS is not the to
2ba0: 70 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65  p stacked channe
2bb0: 6c 20 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c 20 5b  l type...[call [
2bc0: 63 6d 64 20 74 6c 73 3a 3a 68 61 6e 64 73 68 61  cmd tls::handsha
2bd0: 6b 65 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c  ke] [arg channel
2be0: 5d 5d 0a 0a 46 6f 72 63 65 73 20 74 68 65 20 54  ]]..Forces the T
2bf0: 4c 53 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20 68  LS negotiation h
2c00: 61 6e 64 73 68 61 6b 65 20 74 6f 20 74 61 6b 65  andshake to take
2c10: 20 70 6c 61 63 65 20 69 6d 6d 65 64 69 61 74 65   place immediate
2c20: 6c 79 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20  ly, and returns 
2c30: 30 0a 69 66 20 68 61 6e 64 73 68 61 6b 65 20 69  0.if handshake i
2c40: 73 20 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72  s still in progr
2c50: 65 73 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e  ess (non-blockin
2c60: 67 29 2c 20 6f 72 20 31 20 69 66 20 74 68 65 20  g), or 1 if the 
2c70: 68 61 6e 64 73 68 61 6b 65 20 77 61 73 0a 73 75  handshake was.su
2c80: 63 63 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65  ccessful. If the
2c90: 20 68 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65   handshake faile
2ca0: 64 2c 20 61 6e 20 65 72 72 6f 72 20 77 69 6c 6c  d, an error will
2cb0: 20 62 65 20 72 65 74 75 72 6e 65 64 2e 0a 0a 5b   be returned...[
2cc0: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73  call [cmd tls::s
2cd0: 74 61 74 75 73 5d 20 5b 6f 70 74 20 5b 6f 70 74  tatus] [opt [opt
2ce0: 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 5d 20 5b 61 72  ion -local]] [ar
2cf0: 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74  g channel]]..Ret
2d00: 75 72 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74  urns the current
2d10: 20 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53   status of an SS
2d20: 4c 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72  L channel. The r
2d30: 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73 74 20  esult is a list 
2d40: 6f 66 20 6b 65 79 2d 76 61 6c 75 65 0a 70 61 69  of key-value.pai
2d50: 72 73 20 64 65 73 63 72 69 62 69 6e 67 20 74 68  rs describing th
2d60: 65 20 53 53 4c 2c 20 63 65 72 74 69 66 69 63 61  e SSL, certifica
2d70: 74 65 2c 20 61 6e 64 20 63 65 72 74 69 66 69 63  te, and certific
2d80: 61 74 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e  ate verification
2d90: 20 73 74 61 74 75 73 2e 20 49 66 0a 74 68 65 20   status. If.the 
2da0: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 20 68 61  SSL handshake ha
2db0: 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65  s not yet comple
2dc0: 74 65 64 2c 20 61 6e 20 65 6d 70 74 79 20 6c 69  ted, an empty li
2dd0: 73 74 20 69 73 20 72 65 74 75 72 6e 65 64 2e 20  st is returned. 
2de0: 49 66 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d  If the.[option -
2df0: 6c 6f 63 61 6c 5d 20 6f 70 74 69 6f 6e 20 69 73  local] option is
2e00: 20 73 70 65 63 69 66 69 65 64 2c 20 74 68 65 6e   specified, then
2e10: 20 74 68 65 20 6c 6f 63 61 6c 20 63 65 72 74 69   the local certi
2e20: 66 69 63 61 74 65 20 69 73 20 75 73 65 64 2e 20  ficate is used. 
2e30: 52 65 74 75 72 6e 65 64 0a 76 61 6c 75 65 73 20  Returned.values 
2e40: 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d  include:..[para]
2e50: 0a 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c  ..SSL Status..[l
2e60: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
2e70: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76  tions]..[def "[v
2e80: 61 72 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70 72  ar alpn] [arg pr
2e90: 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70 72  otocol]"].The pr
2ea0: 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20  otocol selected 
2eb0: 61 66 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f  after Applicatio
2ec0: 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c  n-Layer Protocol
2ed0: 20 4e 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c   Negotiation (AL
2ee0: 50 4e 29 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  PN)..This value 
2ef0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
2f00: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
2f10: 61 72 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20  ar cipher] [arg 
2f20: 63 69 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75  cipher]"].The cu
2f30: 72 72 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20  rrent cipher in 
2f40: 75 73 65 20 66 6f 72 20 74 68 65 20 73 65 73 73  use for the sess
2f50: 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ion...[def "[var
2f60: 20 70 65 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20   peername] [arg 
2f70: 6e 61 6d 65 5d 22 5d 0a 54 68 65 20 70 65 65 72  name]"].The peer
2f80: 6e 61 6d 65 20 66 72 6f 6d 20 74 68 65 20 63 65  name from the ce
2f90: 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20  rtificate..This 
2fa0: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
2fb0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
2fc0: 65 66 20 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f  ef "[var protoco
2fd0: 6c 5d 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d  l] [arg version]
2fe0: 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20  "].The protocol 
2ff0: 76 65 72 73 69 6f 6e 20 75 73 65 64 20 66 6f 72  version used for
3000: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a   the connection:
3010: 20 53 53 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53   SSL2, SSL3, TLS
3020: 31 2c 20 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e  1, TLS1.1, TLS1.
3030: 32 2c 0a 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e  2,.TLS1.3, or un
3040: 6b 6e 6f 77 6e 2e 20 54 68 69 73 20 76 61 6c 75  known. This valu
3050: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3060: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3070: 5b 76 61 72 20 73 62 69 74 73 5d 20 5b 61 72 67  [var sbits] [arg
3080: 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72   n]"].The number
3090: 20 6f 66 20 62 69 74 73 20 75 73 65 64 20 66 6f   of bits used fo
30a0: 72 20 74 68 65 20 73 65 73 73 69 6f 6e 20 6b 65  r the session ke
30b0: 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  y...[def "[var s
30c0: 69 67 6e 61 74 75 72 65 48 61 73 68 41 6c 67 6f  ignatureHashAlgo
30d0: 72 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f  rithm] [arg algo
30e0: 72 69 74 68 6d 5d 22 5d 0a 54 68 65 20 73 69 67  rithm]"].The sig
30f0: 6e 61 74 75 72 65 20 68 61 73 68 20 61 6c 67 6f  nature hash algo
3100: 72 69 74 68 6d 2e 0a 54 68 69 73 20 76 61 6c 75  rithm..This valu
3110: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3120: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3130: 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65 54 79  [var signatureTy
3140: 70 65 5d 20 5b 61 72 67 20 74 79 70 65 5d 22 5d  pe] [arg type]"]
3150: 0a 54 68 65 20 73 69 67 6e 61 74 75 72 65 20 74  .The signature t
3160: 79 70 65 20 76 61 6c 75 65 2e 0a 54 68 69 73 20  ype value..This 
3170: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
3180: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
3190: 65 66 20 22 5b 76 61 72 20 76 65 72 69 66 79 44  ef "[var verifyD
31a0: 65 70 74 68 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a  epth] [arg n]"].
31b0: 4d 61 78 69 6d 75 6d 20 64 65 70 74 68 20 66 6f  Maximum depth fo
31c0: 72 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  r the certificat
31d0: 65 20 63 68 61 69 6e 20 76 65 72 69 66 69 63 61  e chain verifica
31e0: 74 69 6f 6e 2e 20 44 65 66 61 75 6c 74 20 69 73  tion. Default is
31f0: 20 2d 31 2c 20 74 6f 20 63 68 65 63 6b 20 61 6c   -1, to check al
3200: 6c 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  l..This value is
3210: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
3220: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
3230: 20 76 65 72 69 66 79 4d 6f 64 65 5d 20 5b 61 72   verifyMode] [ar
3240: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f  g list]"].List o
3250: 66 20 63 65 72 74 69 66 69 63 61 74 65 20 76 65  f certificate ve
3260: 72 69 66 69 63 61 74 69 6f 6e 20 6d 6f 64 65 73  rification modes
3270: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
3280: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
3290: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
32a0: 76 65 72 69 66 79 52 65 73 75 6c 74 5d 20 5b 61  verifyResult] [a
32b0: 72 67 20 72 65 73 75 6c 74 5d 22 5d 0a 43 65 72  rg result]"].Cer
32c0: 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63  tificate verific
32d0: 61 74 69 6f 6e 20 72 65 73 75 6c 74 2e 0a 54 68  ation result..Th
32e0: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
32f0: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
3300: 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 61 5f 6e  .[def "[var ca_n
3310: 61 6d 65 73 5d 20 5b 61 72 67 20 6c 69 73 74 5d  ames] [arg list]
3320: 22 5d 0a 4c 69 73 74 20 6f 66 20 74 68 65 20 43  "].List of the C
3330: 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f  ertificate Autho
3340: 72 69 74 69 65 73 20 75 73 65 64 20 74 6f 20 63  rities used to c
3350: 72 65 61 74 65 20 74 68 65 20 63 65 72 74 69 66  reate the certif
3360: 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75  icate..This valu
3370: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3380: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f  TLS 1.8...[list_
3390: 65 6e 64 5d 0a 0a 43 65 72 74 69 66 69 63 61 74  end]..Certificat
33a0: 65 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f  e Status..[list_
33b0: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
33c0: 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  s]..[def "[var a
33d0: 6c 6c 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  ll] [arg string]
33e0: 22 5d 0a 44 75 6d 70 20 6f 66 20 61 6c 6c 20 63  "].Dump of all c
33f0: 65 72 74 69 66 69 63 61 74 65 20 69 6e 66 6f 2e  ertificate info.
3400: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3410: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3420: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76  8...[def "[var v
3430: 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20 76 61 6c  ersion] [arg val
3440: 75 65 5d 22 5d 0a 54 68 65 20 63 65 72 74 69 66  ue]"].The certif
3450: 69 63 61 74 65 20 76 65 72 73 69 6f 6e 2e 0a 0a  icate version...
3460: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 72 69 61  [def "[var seria
3470: 6c 4e 75 6d 62 65 72 5d 20 5b 61 72 67 20 73 74  lNumber] [arg st
3480: 72 69 6e 67 5d 22 5d 0a 54 68 65 20 73 65 72 69  ring]"].The seri
3490: 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 74 68 65  al number of the
34a0: 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73 20   certificate as 
34b0: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68  a hex string..Th
34c0: 69 73 20 76 61 6c 75 65 20 77 61 73 20 63 68 61  is value was cha
34d0: 6e 67 65 64 20 66 72 6f 6d 20 73 65 72 69 61 6c  nged from serial
34e0: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a   in TclTLS 1.8..
34f0: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e  .[def "[var sign
3500: 61 74 75 72 65 5d 20 5b 61 72 67 20 61 6c 67 6f  ature] [arg algo
3510: 72 69 74 68 6d 5d 22 5d 0a 43 69 70 68 65 72 20  rithm]"].Cipher 
3520: 61 6c 67 6f 72 69 74 68 6d 20 75 73 65 64 20 66  algorithm used f
3530: 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 20 73  or certificate s
3540: 69 67 6e 61 74 75 72 65 2e 0a 54 68 69 73 20 76  ignature..This v
3550: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20  alue is new for 
3560: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65  TclTLS 1.8...[de
3570: 66 20 22 5b 76 61 72 20 69 73 73 75 65 72 5d 20  f "[var issuer] 
3580: 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54  [arg string]"].T
3590: 68 65 20 64 69 73 74 69 6e 67 75 69 73 68 65 64  he distinguished
35a0: 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66 20 74 68   name (DN) of th
35b0: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 69 73  e certificate is
35c0: 73 75 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  suer...[def "[va
35d0: 72 20 6e 6f 74 42 65 66 6f 72 65 5d 20 5b 61 72  r notBefore] [ar
35e0: 67 20 64 61 74 65 5d 22 5d 0a 54 68 65 20 62 65  g date]"].The be
35f0: 67 69 6e 6e 69 6e 67 20 64 61 74 65 20 6f 66 20  ginning date of 
3600: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
3610: 76 61 6c 69 64 69 74 79 2e 0a 0a 5b 64 65 66 20  validity...[def 
3620: 22 5b 76 61 72 20 6e 6f 74 41 66 74 65 72 5d 20  "[var notAfter] 
3630: 5b 61 72 67 20 64 61 74 65 5d 22 5d 0a 54 68 65  [arg date]"].The
3640: 20 65 78 70 69 72 61 74 69 6f 6e 20 64 61 74 65   expiration date
3650: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
3660: 61 74 65 20 76 61 6c 69 64 69 74 79 2e 0a 0a 5b  ate validity...[
3670: 64 65 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63  def "[var subjec
3680: 74 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  t] [arg string]"
3690: 5d 0a 54 68 65 20 64 69 73 74 69 6e 67 75 69 73  ].The distinguis
36a0: 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66  hed name (DN) of
36b0: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
36c0: 20 73 75 62 6a 65 63 74 2e 20 46 69 65 6c 64 73   subject. Fields
36d0: 20 69 6e 63 6c 75 64 65 3a 20 43 6f 6d 6d 6f 6e   include: Common
36e0: 0a 4e 61 6d 65 20 28 43 4e 29 2c 20 4f 72 67 61  .Name (CN), Orga
36f0: 6e 69 7a 61 74 69 6f 6e 20 28 4f 29 2c 20 4c 6f  nization (O), Lo
3700: 63 61 6c 69 74 79 20 6f 72 20 43 69 74 79 20 28  cality or City (
3710: 4c 29 2c 20 53 74 61 74 65 20 6f 72 20 50 72 6f  L), State or Pro
3720: 76 69 6e 63 65 20 28 53 29 2c 20 61 6e 64 0a 43  vince (S), and.C
3730: 6f 75 6e 74 72 79 20 4e 61 6d 65 20 28 43 29 2e  ountry Name (C).
3740: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73 73  ..[def "[var iss
3750: 75 65 72 55 6e 69 71 75 65 49 44 5d 20 5b 61 72  uerUniqueID] [ar
3760: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20  g string]"].The 
3770: 69 73 73 75 65 72 20 75 6e 69 71 75 65 20 69 64  issuer unique id
3780: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
3790: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
37a0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
37b0: 73 75 62 6a 65 63 74 55 6e 69 71 75 65 49 44 5d  subjectUniqueID]
37c0: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
37d0: 54 68 65 20 73 75 62 6a 65 63 74 20 75 6e 69 71  The subject uniq
37e0: 75 65 20 69 64 2e 0a 54 68 69 73 20 76 61 6c 75  ue id..This valu
37f0: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3800: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3810: 5b 76 61 72 20 6e 75 6d 5f 65 78 74 65 6e 73 69  [var num_extensi
3820: 6f 6e 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4e  ons] [arg n]"].N
3830: 75 6d 62 65 72 20 6f 66 20 63 65 72 74 69 66 69  umber of certifi
3840: 63 61 74 65 20 65 78 74 65 6e 73 69 6f 6e 73 2e  cate extensions.
3850: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3860: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3870: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65  8...[def "[var e
3880: 78 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20  xtensions] [arg 
3890: 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20  list]"].List of 
38a0: 63 65 72 74 69 66 69 63 61 74 65 20 65 78 74 65  certificate exte
38b0: 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e 0a 54 68 69  nsion names..Thi
38c0: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
38d0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
38e0: 5b 64 65 66 20 22 5b 76 61 72 20 61 75 74 68 6f  [def "[var autho
38f0: 72 69 74 79 4b 65 79 49 64 65 6e 74 69 66 69 65  rityKeyIdentifie
3900: 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  r] [arg string]"
3910: 5d 0a 41 75 74 68 6f 72 69 74 79 20 4b 65 79 20  ].Authority Key 
3920: 49 64 65 6e 74 69 66 69 65 72 20 28 41 4b 49 29  Identifier (AKI)
3930: 20 6f 66 20 74 68 65 20 49 73 73 75 69 6e 67 20   of the Issuing 
3940: 43 41 20 63 65 72 74 69 66 69 63 61 74 65 20 74  CA certificate t
3950: 68 61 74 20 73 69 67 6e 65 64 20 74 68 65 0a 53  hat signed the.S
3960: 53 4c 20 63 65 72 74 69 66 69 63 61 74 65 20 61  SL certificate a
3970: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 20  s a hex string. 
3980: 54 68 69 73 20 76 61 6c 75 65 20 6d 61 74 63 68  This value match
3990: 65 73 20 74 68 65 20 53 4b 49 20 76 61 6c 75 65  es the SKI value
39a0: 20 6f 66 20 74 68 65 0a 49 6e 74 65 72 6d 65 64   of the.Intermed
39b0: 69 61 74 65 20 43 41 20 63 65 72 74 69 66 69 63  iate CA certific
39c0: 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ate..This value 
39d0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
39e0: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
39f0: 61 72 20 73 75 62 6a 65 63 74 4b 65 79 49 64 65  ar subjectKeyIde
3a00: 6e 74 69 66 69 65 72 5d 20 5b 61 72 67 20 73 74  ntifier] [arg st
3a10: 72 69 6e 67 5d 22 5d 0a 53 75 62 6a 65 63 74 20  ring]"].Subject 
3a20: 4b 65 79 20 49 64 65 6e 74 69 66 69 65 72 20 28  Key Identifier (
3a30: 53 4b 49 29 20 68 61 73 68 20 6f 66 20 74 68 65  SKI) hash of the
3a40: 20 70 75 62 6c 69 63 20 6b 65 79 20 69 6e 73 69   public key insi
3a50: 64 65 20 74 68 65 20 63 65 72 74 69 66 69 63 61  de the certifica
3a60: 74 65 20 61 73 20 61 0a 68 65 78 20 73 74 72 69  te as a.hex stri
3a70: 6e 67 2e 20 55 73 65 64 20 74 6f 20 69 64 65 6e  ng. Used to iden
3a80: 74 69 66 79 20 63 65 72 74 69 66 69 63 61 74 65  tify certificate
3a90: 73 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 20 61  s that contain a
3aa0: 20 70 61 72 74 69 63 75 6c 61 72 20 70 75 62 6c   particular publ
3ab0: 69 63 20 6b 65 79 2e 0a 54 68 69 73 20 76 61 6c  ic key..This val
3ac0: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
3ad0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
3ae0: 22 5b 76 61 72 20 73 75 62 6a 65 63 74 41 6c 74  "[var subjectAlt
3af0: 4e 61 6d 65 5d 20 5b 61 72 67 20 6c 69 73 74 5d  Name] [arg list]
3b00: 22 5d 0a 4c 69 73 74 20 6f 66 20 61 6c 6c 20 6f  "].List of all o
3b10: 66 20 74 68 65 20 53 75 62 6a 65 63 74 20 41 6c  f the Subject Al
3b20: 74 65 72 6e 61 74 69 76 65 20 4e 61 6d 65 73 20  ternative Names 
3b30: 28 53 41 4e 29 20 69 6e 63 6c 75 64 69 6e 67 20  (SAN) including 
3b40: 64 6f 6d 61 69 6e 20 6e 61 6d 65 73 2c 20 73 75  domain names, su
3b50: 62 0a 64 6f 6d 61 69 6e 73 2c 20 61 6e 64 20 49  b.domains, and I
3b60: 50 20 61 64 64 72 65 73 73 65 73 20 74 68 61 74  P addresses that
3b70: 20 61 72 65 20 73 65 63 75 72 65 64 20 62 79 20   are secured by 
3b80: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 2e  the certificate.
3b90: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3ba0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3bb0: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6f  8...[def "[var o
3bc0: 63 73 70 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22  csp] [arg list]"
3bd0: 5d 0a 4c 69 73 74 20 6f 66 20 61 6c 6c 20 4f 6e  ].List of all On
3be0: 6c 69 6e 65 20 43 65 72 74 69 66 69 63 61 74 65  line Certificate
3bf0: 20 53 74 61 74 75 73 20 50 72 6f 74 6f 63 6f 6c   Status Protocol
3c00: 20 28 4f 43 53 50 29 20 55 52 4c 73 20 74 68 61   (OCSP) URLs tha
3c10: 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f  t can be used to
3c20: 0a 63 68 65 63 6b 20 74 68 65 20 76 61 6c 69 64  .check the valid
3c30: 69 74 79 20 6f 66 20 74 68 69 73 20 63 65 72 74  ity of this cert
3c40: 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61  ificate..This va
3c50: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3c60: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3c70: 20 22 5b 76 61 72 20 63 65 72 74 69 66 69 63 61   "[var certifica
3c80: 74 65 5d 20 5b 61 72 67 20 63 65 72 74 5d 22 5d  te] [arg cert]"]
3c90: 0a 54 68 65 20 50 45 4d 20 65 6e 63 6f 64 65 64  .The PEM encoded
3ca0: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b   certificate...[
3cb0: 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74  def "[var signat
3cc0: 75 72 65 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61  ureAlgorithm] [a
3cd0: 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a  rg algorithm]"].
3ce0: 43 69 70 68 65 72 20 61 6c 67 6f 72 69 74 68 6d  Cipher algorithm
3cf0: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 65   used for the ce
3d00: 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74  rtificate signat
3d10: 75 72 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ure..This value 
3d20: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3d30: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3d40: 61 72 20 73 69 67 6e 61 74 75 72 65 56 61 6c 75  ar signatureValu
3d50: 65 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  e] [arg string]"
3d60: 5d 0a 43 65 72 74 69 66 69 63 61 74 65 20 73 69  ].Certificate si
3d70: 67 6e 61 74 75 72 65 20 61 73 20 61 20 68 65 78  gnature as a hex
3d80: 20 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61   string..This va
3d90: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3da0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3db0: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65   "[var signature
3dc0: 44 69 67 65 73 74 5d 20 5b 61 72 67 20 76 65 72  Digest] [arg ver
3dd0: 73 69 6f 6e 5d 22 5d 0a 43 65 72 74 69 66 69 63  sion]"].Certific
3de0: 61 74 65 20 73 69 67 6e 69 6e 67 20 64 69 67 65  ate signing dige
3df0: 73 74 20 61 73 20 61 20 68 65 78 20 73 74 72 69  st as a hex stri
3e00: 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  ng..This value i
3e10: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
3e20: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   1.8...[def "[va
3e30: 72 20 70 75 62 6c 69 63 4b 65 79 41 6c 67 6f 72  r publicKeyAlgor
3e40: 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72  ithm] [arg algor
3e50: 69 74 68 6d 5d 22 5d 0a 43 65 72 74 69 66 69 63  ithm]"].Certific
3e60: 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 70 75  ate signature pu
3e70: 62 6c 69 63 20 6b 65 79 20 61 6c 67 6f 72 69 74  blic key algorit
3e80: 68 6d 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  hm..This value i
3e90: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
3ea0: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   1.8...[def "[va
3eb0: 72 20 70 75 62 6c 69 63 4b 65 79 5d 20 5b 61 72  r publicKey] [ar
3ec0: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74  g string]"].Cert
3ed0: 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72  ificate signatur
3ee0: 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 73 20  e public key as 
3ef0: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68  a hex string..Th
3f00: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
3f10: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
3f20: 0a 5b 64 65 66 20 22 5b 76 61 72 20 62 69 74 73  .[def "[var bits
3f30: 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62  ] [arg n]"].Numb
3f40: 65 72 20 6f 66 20 62 69 74 73 20 75 73 65 64 20  er of bits used 
3f50: 66 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 20  for certificate 
3f60: 73 69 67 6e 61 74 75 72 65 20 6b 65 79 2e 0a 54  signature key..T
3f70: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3f80: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3f90: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 6c  ..[def "[var sel
3fa0: 66 5f 73 69 67 6e 65 64 5d 20 5b 61 72 67 20 62  f_signed] [arg b
3fb0: 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65  oolean]"].Whethe
3fc0: 72 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  r the certificat
3fd0: 65 20 73 69 67 6e 61 74 75 72 65 20 69 73 20 73  e signature is s
3fe0: 65 6c 66 20 73 69 67 6e 65 64 2e 0a 54 68 69 73  elf signed..This
3ff0: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
4000: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
4010: 64 65 66 20 22 5b 76 61 72 20 73 68 61 31 5f 68  def "[var sha1_h
4020: 61 73 68 5d 20 5b 61 72 67 20 68 61 73 68 5d 22  ash] [arg hash]"
4030: 5d 0a 54 68 65 20 53 48 41 31 20 68 61 73 68 20  ].The SHA1 hash 
4040: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61  of the certifica
4050: 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72 69  te as a hex stri
4060: 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  ng..This value i
4070: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
4080: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   1.8...[def "[va
4090: 72 20 73 68 61 32 35 36 5f 68 61 73 68 5d 20 5b  r sha256_hash] [
40a0: 61 72 67 20 68 61 73 68 5d 22 5d 0a 54 68 65 20  arg hash]"].The 
40b0: 53 48 41 32 35 36 20 68 61 73 68 20 6f 66 20 74  SHA256 hash of t
40c0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61  he certificate a
40d0: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a  s a hex string..
40e0: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
40f0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
4100: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
4110: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 63  call [cmd tls::c
4120: 6f 6e 6e 65 63 74 69 6f 6e 5d 20 5b 61 72 67 20  onnection] [arg 
4130: 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72  channel]]..Retur
4140: 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 63  ns the current c
4150: 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 61 74 75 73  onnection status
4160: 20 6f 66 20 61 6e 20 53 53 4c 20 63 68 61 6e 6e   of an SSL chann
4170: 65 6c 2e 20 54 68 65 20 72 65 73 75 6c 74 20 69  el. The result i
4180: 73 20 61 20 6c 69 73 74 0a 6f 66 20 6b 65 79 2d  s a list.of key-
4190: 76 61 6c 75 65 20 70 61 69 72 73 20 64 65 73 63  value pairs desc
41a0: 72 69 62 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65  ribing the conne
41b0: 63 74 69 6f 6e 2e 0a 54 68 69 73 20 63 6f 6d 6d  ction..This comm
41c0: 61 6e 64 20 69 73 20 6e 65 77 20 66 6f 72 20 54  and is new for T
41d0: 63 6c 54 4c 53 20 31 2e 38 2e 20 52 65 74 75 72  clTLS 1.8. Retur
41e0: 6e 65 64 20 76 61 6c 75 65 73 20 69 6e 63 6c 75  ned values inclu
41f0: 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a 53 53 4c  de:..[para]..SSL
4200: 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62   Status..[list_b
4210: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73  egin definitions
4220: 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74  ]..[def "[var st
4230: 61 74 65 5d 20 5b 61 72 67 20 73 74 61 74 65 5d  ate] [arg state]
4240: 22 5d 0a 53 74 61 74 65 20 6f 66 20 74 68 65 20  "].State of the 
4250: 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65  connection...[de
4260: 66 20 22 5b 76 61 72 20 73 65 72 76 65 72 6e 61  f "[var serverna
4270: 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d  me] [arg name]"]
4280: 0a 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65  .The name of the
4290: 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 73 65   connected to se
42a0: 72 76 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  rver...[def "[va
42b0: 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72 67  r protocol] [arg
42c0: 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20   version]"].The 
42d0: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e  protocol version
42e0: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 6f   used for the co
42f0: 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c 20  nnection: SSL2, 
4300: 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53 31  SSL3, TLS1, TLS1
4310: 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53 31  .1, TLS1.2, TLS1
4320: 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 0a  .3, or unknown..
4330: 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 6e 65  .[def "[var rene
4340: 67 6f 74 69 61 74 69 6f 6e 5f 61 6c 6c 6f 77 65  gotiation_allowe
4350: 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  d] [arg boolean]
4360: 22 5d 0a 57 68 65 74 68 65 72 20 70 72 6f 74 6f  "].Whether proto
4370: 63 6f 6c 20 72 65 6e 65 67 6f 74 69 61 74 69 6f  col renegotiatio
4380: 6e 20 69 73 20 73 75 70 70 6f 72 74 65 64 20 6f  n is supported o
4390: 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b 76  r not...[def "[v
43a0: 61 72 20 73 65 63 75 72 69 74 79 5f 6c 65 76 65  ar security_leve
43b0: 6c 5d 20 5b 61 72 67 20 6c 65 76 65 6c 5d 22 5d  l] [arg level]"]
43c0: 0a 54 68 65 20 73 65 63 75 72 69 74 79 20 6c 65  .The security le
43d0: 76 65 6c 20 75 73 65 64 20 66 6f 72 20 73 65 6c  vel used for sel
43e0: 65 63 74 69 6f 6e 20 6f 66 20 63 69 70 68 65 72  ection of cipher
43f0: 73 2c 20 6b 65 79 20 73 69 7a 65 2c 20 65 74 63  s, key size, etc
4400: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
4410: 73 73 69 6f 6e 5f 72 65 75 73 65 64 5d 20 5b 61  ssion_reused] [a
4420: 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68  rg boolean]"].Wh
4430: 65 74 68 65 72 20 74 68 65 20 73 65 73 73 69 6f  ether the sessio
4440: 6e 20 68 61 73 20 62 65 65 6e 20 72 65 75 73 65  n has been reuse
4450: 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20  d or not...[def 
4460: 22 5b 76 61 72 20 69 73 5f 73 65 72 76 65 72 5d  "[var is_server]
4470: 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d   [arg boolean]"]
4480: 0a 57 68 65 74 68 65 72 20 74 68 65 20 63 6f 6e  .Whether the con
4490: 6e 65 63 74 69 6f 6e 20 69 73 20 63 6f 6e 66 69  nection is confi
44a0: 67 75 72 65 64 20 61 73 20 61 20 73 65 72 76 65  gured as a serve
44b0: 72 20 28 31 29 20 6f 72 20 63 6c 69 65 6e 74 20  r (1) or client 
44c0: 28 30 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  (0)...[def "[var
44d0: 20 63 6f 6d 70 72 65 73 73 69 6f 6e 5d 20 5b 61   compression] [a
44e0: 72 67 20 6d 6f 64 65 5d 22 5d 0a 43 6f 6d 70 72  rg mode]"].Compr
44f0: 65 73 73 69 6f 6e 20 6d 65 74 68 6f 64 2e 0a 0a  ession method...
4500: 5b 64 65 66 20 22 5b 76 61 72 20 65 78 70 61 6e  [def "[var expan
4510: 73 69 6f 6e 5d 20 5b 61 72 67 20 6d 6f 64 65 5d  sion] [arg mode]
4520: 22 5d 0a 45 78 70 61 6e 73 69 6f 6e 20 6d 65 74  "].Expansion met
4530: 68 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  hod...[def "[var
4540: 20 63 61 4c 69 73 74 5d 20 5b 61 72 67 20 6c 69   caList] [arg li
4550: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 43 65  st]"].List of Ce
4560: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
4570: 69 74 69 65 73 20 28 43 41 29 20 66 6f 72 20 58  ities (CA) for X
4580: 2e 35 30 39 20 63 65 72 74 69 66 69 63 61 74 65  .509 certificate
4590: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43  ...[list_end]..C
45a0: 69 70 68 65 72 20 49 6e 66 6f 0a 0a 5b 6c 69 73  ipher Info..[lis
45b0: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
45c0: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ons]..[def "[var
45d0: 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69   cipher] [arg ci
45e0: 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72  pher]"].The curr
45f0: 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75 73  ent cipher in us
4600: 65 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63  e for the connec
4610: 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  tion...[def "[va
4620: 72 20 73 74 61 6e 64 61 72 64 5f 6e 61 6d 65 5d  r standard_name]
4630: 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68   [arg name]"].Th
4640: 65 20 73 74 61 6e 64 61 72 64 20 52 46 43 20 6e  e standard RFC n
4650: 61 6d 65 20 6f 66 20 63 69 70 68 65 72 2e 0a 0a  ame of cipher...
4660: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 67 6f 72  [def "[var algor
4670: 69 74 68 6d 5f 62 69 74 73 5d 20 5b 61 72 67 20  ithm_bits] [arg 
4680: 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20  n]"].The number 
4690: 6f 66 20 70 72 6f 63 65 73 73 65 64 20 62 69 74  of processed bit
46a0: 73 20 75 73 65 64 20 66 6f 72 20 63 69 70 68 65  s used for ciphe
46b0: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  r...[def "[var s
46c0: 65 63 72 65 74 5f 62 69 74 73 5d 20 5b 61 72 67  ecret_bits] [arg
46d0: 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72   n]"].The number
46e0: 20 6f 66 20 73 65 63 72 65 74 20 62 69 74 73 20   of secret bits 
46f0: 75 73 65 64 20 66 6f 72 20 63 69 70 68 65 72 2e  used for cipher.
4700: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6d 69 6e  ..[def "[var min
4710: 5f 76 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20 76  _version] [arg v
4720: 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 6d 69  ersion]"].The mi
4730: 6e 69 6d 75 6d 20 70 72 6f 74 6f 63 6f 6c 20 76  nimum protocol v
4740: 65 72 73 69 6f 6e 20 66 6f 72 20 63 69 70 68 65  ersion for ciphe
4750: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  r...[def "[var c
4760: 69 70 68 65 72 5f 69 73 5f 61 65 61 64 5d 20 5b  ipher_is_aead] [
4770: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57  arg boolean]"].W
4780: 68 65 74 68 65 72 20 74 68 65 20 63 69 70 68 65  hether the ciphe
4790: 72 20 69 73 20 41 75 74 68 65 6e 74 69 63 61 74  r is Authenticat
47a0: 65 64 20 45 6e 63 72 79 70 74 69 6f 6e 20 77 69  ed Encryption wi
47b0: 74 68 20 41 73 73 6f 63 69 61 74 65 64 20 44 61  th Associated Da
47c0: 74 61 20 28 41 45 41 44 29 2e 0a 0a 5b 64 65 66  ta (AEAD)...[def
47d0: 20 22 5b 76 61 72 20 63 69 70 68 65 72 5f 69 64   "[var cipher_id
47e0: 5d 20 5b 61 72 67 20 69 64 5d 22 5d 0a 54 68 65  ] [arg id]"].The
47f0: 20 4f 70 65 6e 53 53 4c 20 63 69 70 68 65 72 20   OpenSSL cipher 
4800: 69 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  id...[def "[var 
4810: 64 65 73 63 72 69 70 74 69 6f 6e 5d 20 5b 61 72  description] [ar
4820: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 41 20 74 65  g string]"].A te
4830: 78 74 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f  xt description o
4840: 66 20 74 68 65 20 63 69 70 68 65 72 2e 0a 0a 5b  f the cipher...[
4850: 64 65 66 20 22 5b 76 61 72 20 68 61 6e 64 73 68  def "[var handsh
4860: 61 6b 65 5f 64 69 67 65 73 74 5d 20 5b 61 72 67  ake_digest] [arg
4870: 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 44 69 67 65   boolean]"].Dige
4880: 73 74 20 75 73 65 64 20 64 75 72 69 6e 67 20 68  st used during h
4890: 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b 6c 69 73 74  andshake...[list
48a0: 5f 65 6e 64 5d 0a 0a 53 65 73 73 69 6f 6e 20 49  _end]..Session I
48b0: 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  nfo..[list_begin
48c0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b   definitions]..[
48d0: 64 65 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20  def "[var alpn] 
48e0: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d  [arg protocol]"]
48f0: 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65  .The protocol se
4900: 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70 70  lected after App
4910: 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50  lication-Layer P
4920: 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74  rotocol Negotiat
4930: 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a 0a 5b 64 65  ion (ALPN)...[de
4940: 66 20 22 5b 76 61 72 20 72 65 73 75 6d 61 62 6c  f "[var resumabl
4950: 65 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  e] [arg boolean]
4960: 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 73  "].Whether the s
4970: 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 72 65  ession can be re
4980: 73 75 6d 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b  sumed or not...[
4990: 64 65 66 20 22 5b 76 61 72 20 73 74 61 72 74 5f  def "[var start_
49a0: 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63 6f 6e  time] [arg secon
49b0: 64 73 5d 22 5d 0a 54 69 6d 65 20 73 69 6e 63 65  ds]"].Time since
49c0: 20 73 65 73 73 69 6f 6e 20 73 74 61 72 74 65 64   session started
49d0: 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e 63   in seconds sinc
49e0: 65 20 65 70 6f 63 68 2e 0a 0a 5b 64 65 66 20 22  e epoch...[def "
49f0: 5b 76 61 72 20 74 69 6d 65 6f 75 74 5d 20 5b 61  [var timeout] [a
4a00: 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 4d 61  rg seconds]"].Ma
4a10: 78 20 64 75 72 61 74 69 6f 6e 20 6f 66 20 73 65  x duration of se
4a20: 73 73 69 6f 6e 20 69 6e 20 73 65 63 6f 6e 64 73  ssion in seconds
4a30: 20 62 65 66 6f 72 65 20 74 69 6d 65 2d 6f 75 74   before time-out
4a40: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6c 69  ...[def "[var li
4a50: 66 65 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63  fetime] [arg sec
4a60: 6f 6e 64 73 5d 22 5d 0a 53 65 73 73 69 6f 6e 20  onds]"].Session 
4a70: 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 20  ticket lifetime 
4a80: 68 69 6e 74 20 69 6e 20 73 65 63 6f 6e 64 73 2e  hint in seconds.
4a90: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73  ..[def "[var ses
4aa0: 73 69 6f 6e 5f 69 64 5d 20 5b 61 72 67 20 62 69  sion_id] [arg bi
4ab0: 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55  nary_string]"].U
4ac0: 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20 69 64  nique session id
4ad0: 20 66 6f 72 20 75 73 65 20 69 6e 20 72 65 73 75   for use in resu
4ae0: 6d 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e  ming the session
4af0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
4b00: 73 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 20 5b 61  ssion_ticket] [a
4b10: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67  rg binary_string
4b20: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69  ]"].Unique sessi
4b30: 6f 6e 20 74 69 63 6b 65 74 20 66 6f 72 20 75 73  on ticket for us
4b40: 65 20 69 6e 20 72 65 73 75 6d 69 6e 67 20 74 68  e in resuming th
4b50: 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66  e session...[def
4b60: 20 22 5b 76 61 72 20 74 69 63 6b 65 74 5f 61 70   "[var ticket_ap
4b70: 70 5f 64 61 74 61 5d 20 5b 61 72 67 20 62 69 6e  p_data] [arg bin
4b80: 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e  ary_string]"].Un
4b90: 69 71 75 65 20 73 65 73 73 69 6f 6e 20 74 69 63  ique session tic
4ba0: 6b 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 20  ket application 
4bb0: 64 61 74 61 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  data...[def "[va
4bc0: 72 20 6d 61 73 74 65 72 5f 6b 65 79 5d 20 5b 61  r master_key] [a
4bd0: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67  rg binary_string
4be0: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69  ]"].Unique sessi
4bf0: 6f 6e 20 6d 61 73 74 65 72 20 6b 65 79 2e 0a 0a  on master key...
4c00: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 73 69  [def "[var sessi
4c10: 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64 65 5d 20 5b  on_cache_mode] [
4c20: 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 53 65 72 76  arg mode]"].Serv
4c30: 65 72 20 63 61 63 68 65 20 6d 6f 64 65 20 28 63  er cache mode (c
4c40: 6c 69 65 6e 74 2c 20 73 65 72 76 65 72 2c 20 6f  lient, server, o
4c50: 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c 69 73 74 5f  r both)...[list_
4c60: 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  end]..[call [cmd
4c70: 20 74 6c 73 3a 3a 63 69 70 68 65 72 73 5d 20 5b   tls::ciphers] [
4c80: 6f 70 74 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  opt [arg protoco
4c90: 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 65  l]] [opt [arg ve
4ca0: 72 62 6f 73 65 5d 5d 20 5b 6f 70 74 20 5b 61 72  rbose]] [opt [ar
4cb0: 67 20 73 75 70 70 6f 72 74 65 64 5d 5d 5d 0a 0a  g supported]]]..
4cc0: 57 69 74 68 6f 75 74 20 61 6e 79 20 6f 70 74 69  Without any opti
4cd0: 6f 6e 73 2c 20 69 74 20 72 65 74 75 72 6e 73 20  ons, it returns 
4ce0: 61 20 6c 69 73 74 20 6f 66 20 61 6c 6c 20 73 79  a list of all sy
4cf0: 6d 6d 65 74 72 69 63 20 63 69 70 68 65 72 73 20  mmetric ciphers 
4d00: 66 6f 72 20 75 73 65 20 77 69 74 68 20 74 68 65  for use with the
4d10: 0a 5b 61 72 67 20 2d 63 69 70 68 65 72 5d 20 6f  .[arg -cipher] o
4d20: 70 74 69 6f 6e 2e 20 57 69 74 68 20 5b 61 72 67  ption. With [arg
4d30: 20 70 72 6f 74 6f 63 6f 6c 5d 2c 20 6f 6e 6c 79   protocol], only
4d40: 20 74 68 65 20 63 69 70 68 65 72 73 20 73 75 70   the ciphers sup
4d50: 70 6f 72 74 65 64 20 66 6f 72 20 74 68 61 74 0a  ported for that.
4d60: 70 72 6f 74 6f 63 6f 6c 20 61 72 65 20 72 65 74  protocol are ret
4d70: 75 72 6e 65 64 2e 20 53 65 65 20 74 68 65 20 5b  urned. See the [
4d80: 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f  cmd tls::protoco
4d90: 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20  ls] command for 
4da0: 74 68 65 20 73 75 70 70 6f 72 74 65 64 0a 70 72  the supported.pr
4db0: 6f 74 6f 63 6f 6c 73 2e 20 49 66 20 5b 61 72 67  otocols. If [arg
4dc0: 20 76 65 72 62 6f 73 65 5d 20 69 73 20 73 70 65   verbose] is spe
4dd0: 63 69 66 69 65 64 20 61 73 20 74 72 75 65 20 74  cified as true t
4de0: 68 65 6e 20 61 20 76 65 72 62 6f 73 65 2c 20 68  hen a verbose, h
4df0: 75 6d 61 6e 20 72 65 61 64 61 62 6c 65 0a 6c 69  uman readable.li
4e00: 73 74 20 69 73 20 72 65 74 75 72 6e 65 64 20 77  st is returned w
4e10: 69 74 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 69  ith additional i
4e20: 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68  nformation on th
4e30: 65 20 63 69 70 68 65 72 2e 20 49 66 20 5b 61 72  e cipher. If [ar
4e40: 67 20 73 75 70 70 6f 72 74 65 64 5d 0a 69 73 20  g supported].is 
4e50: 73 70 65 63 69 66 69 65 64 20 61 73 20 74 72 75  specified as tru
4e60: 65 2c 20 74 68 65 6e 20 6f 6e 6c 79 20 74 68 65  e, then only the
4e70: 20 63 69 70 68 65 72 73 20 73 75 70 70 6f 72 74   ciphers support
4e80: 65 64 20 66 6f 72 20 70 72 6f 74 6f 63 6f 6c 20  ed for protocol 
4e90: 77 69 6c 6c 20 62 65 20 6c 69 73 74 65 64 2e 0a  will be listed..
4ea0: 54 68 65 20 5b 61 72 67 20 73 75 70 70 6f 72 74  The [arg support
4eb0: 65 64 5d 20 61 72 67 20 69 73 20 6e 65 77 20 66  ed] arg is new f
4ec0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
4ed0: 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a  [call [cmd tls::
4ee0: 70 72 6f 74 6f 63 6f 6c 73 5d 5d 0a 0a 52 65 74  protocols]]..Ret
4ef0: 75 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74  urns a list of t
4f00: 68 65 20 73 75 70 70 6f 72 74 65 64 20 53 53 4c  he supported SSL
4f10: 2f 54 4c 53 20 70 72 6f 74 6f 63 6f 6c 73 2e 20  /TLS protocols. 
4f20: 56 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65  Valid values are
4f30: 3a 0a 5b 63 6f 6e 73 74 20 73 73 6c 32 5d 2c 20  :.[const ssl2], 
4f40: 5b 63 6f 6e 73 74 20 73 73 6c 33 5d 2c 20 5b 63  [const ssl3], [c
4f50: 6f 6e 73 74 20 74 6c 73 31 5d 2c 20 5b 63 6f 6e  onst tls1], [con
4f60: 73 74 20 74 6c 73 31 2e 31 5d 2c 20 5b 63 6f 6e  st tls1.1], [con
4f70: 73 74 20 74 6c 73 31 2e 32 5d 2c 20 61 6e 64 0a  st tls1.2], and.
4f80: 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 33 5d 2e 20  [const tls1.3]. 
4f90: 45 78 61 63 74 20 6c 69 73 74 20 64 65 70 65 6e  Exact list depen
4fa0: 64 73 20 6f 6e 20 4f 70 65 6e 53 53 4c 20 76 65  ds on OpenSSL ve
4fb0: 72 73 69 6f 6e 20 61 6e 64 20 63 6f 6d 70 69 6c  rsion and compil
4fc0: 65 20 74 69 6d 65 20 66 6c 61 67 73 2e 0a 54 68  e time flags..Th
4fd0: 69 73 20 63 6f 6d 6d 61 6e 64 20 69 73 20 6e 65  is command is ne
4fe0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
4ff0: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ...[call [cmd tl
5000: 73 3a 3a 76 65 72 73 69 6f 6e 5d 5d 0a 0a 52 65  s::version]]..Re
5010: 74 75 72 6e 73 20 74 68 65 20 4f 70 65 6e 53 53  turns the OpenSS
5020: 4c 20 76 65 72 73 69 6f 6e 20 73 74 72 69 6e 67  L version string
5030: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 0a  ...[list_end]...
5040: 5b 73 65 63 74 69 6f 6e 20 22 43 65 72 74 69 66  [section "Certif
5050: 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e  icate Validation
5060: 22 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20  "]..[subsection 
5070: 22 50 4b 49 20 61 6e 64 20 43 65 72 74 69 66 69  "PKI and Certifi
5080: 63 61 74 65 73 22 5d 0a 0a 55 73 69 6e 67 20 74  cates"]..Using t
5090: 68 65 20 50 75 62 6c 69 63 20 4b 65 79 20 49 6e  he Public Key In
50a0: 66 72 61 73 74 72 75 63 74 75 72 65 20 28 50 4b  frastructure (PK
50b0: 49 29 2c 20 65 61 63 68 20 75 73 65 72 20 63 72  I), each user cr
50c0: 65 61 74 65 73 20 61 20 70 72 69 76 61 74 65 20  eates a private 
50d0: 6b 65 79 20 74 68 61 74 0a 6f 6e 6c 79 20 74 68  key that.only th
50e0: 65 79 20 6b 6e 6f 77 20 61 62 6f 75 74 20 61 6e  ey know about an
50f0: 64 20 61 20 70 75 62 6c 69 63 20 6b 65 79 20 74  d a public key t
5100: 68 65 79 20 63 61 6e 20 65 78 63 68 61 6e 67 65  hey can exchange
5110: 20 77 69 74 68 20 6f 74 68 65 72 73 20 66 6f 72   with others for
5120: 20 75 73 65 20 69 6e 0a 65 6e 63 72 79 70 74 69   use in.encrypti
5130: 6e 67 20 61 6e 64 20 64 65 63 72 79 70 74 69 6e  ng and decryptin
5140: 67 20 64 61 74 61 2e 20 54 68 65 20 70 72 6f 63  g data. The proc
5150: 65 73 73 20 69 73 20 74 68 65 20 73 65 6e 64 65  ess is the sende
5160: 72 20 65 6e 63 72 79 70 74 73 20 74 68 65 69 72  r encrypts their
5170: 20 64 61 74 61 0a 75 73 69 6e 67 20 74 68 65 69   data.using thei
5180: 72 20 70 72 69 76 61 74 65 20 6b 65 79 20 61 6e  r private key an
5190: 64 20 74 68 65 20 72 65 63 65 69 76 65 72 27 73  d the receiver's
51a0: 20 70 75 62 6c 69 63 20 6b 65 79 2e 20 54 68 65   public key. The
51b0: 20 64 61 74 61 20 69 73 20 74 68 65 6e 20 73 65   data is then se
51c0: 6e 74 0a 74 6f 20 74 68 65 20 72 65 63 65 69 76  nt.to the receiv
51d0: 65 72 2e 20 49 6e 20 61 20 73 69 6d 69 6c 61 72  er. In a similar
51e0: 20 6d 61 6e 6e 65 72 2c 20 74 68 65 20 72 65 63   manner, the rec
51f0: 65 69 76 65 72 20 75 73 65 73 20 74 68 65 69 72  eiver uses their
5200: 20 70 72 69 76 61 74 65 20 6b 65 79 20 61 6e 64   private key and
5210: 0a 74 68 65 20 73 65 6e 64 65 72 27 73 20 70 75  .the sender's pu
5220: 62 6c 69 63 20 6b 65 79 20 74 6f 20 64 65 63 72  blic key to decr
5230: 79 70 74 20 74 68 65 20 64 61 74 61 2e 20 54 68  ypt the data. Th
5240: 69 73 20 70 72 6f 76 69 64 65 73 20 64 61 74 61  is provides data
5250: 20 69 6e 74 65 67 72 69 74 79 2c 20 74 6f 0a 65   integrity, to.e
5260: 6e 73 75 72 65 20 74 68 65 20 64 61 74 61 20 63  nsure the data c
5270: 61 6e 27 74 20 62 65 20 76 69 65 77 65 64 20 6f  an't be viewed o
5280: 72 20 61 6c 74 65 72 65 64 20 64 75 72 69 6e 67  r altered during
5290: 20 74 72 61 6e 73 70 6f 72 74 2e 20 53 65 65 20   transport. See 
52a0: 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79  the.[option -key
52b0: 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 6b  ] and [option -k
52c0: 65 79 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20  eyfile] options 
52d0: 66 6f 72 20 68 6f 77 20 74 6f 20 73 70 65 63 69  for how to speci
52e0: 66 79 20 74 68 65 20 70 72 69 76 61 74 65 20 6b  fy the private k
52f0: 65 79 2e 0a 41 6c 73 6f 20 73 65 65 20 74 68 65  ey..Also see the
5300: 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f   [option -passwo
5310: 72 64 5d 20 6f 70 74 69 6f 6e 20 66 6f 72 20 68  rd] option for h
5320: 6f 77 20 74 6f 20 70 72 6f 76 69 64 65 20 74 68  ow to provide th
5330: 65 20 70 61 73 73 77 6f 72 64 2e 0a 5b 70 61 72  e password..[par
5340: 61 5d 0a 49 6e 20 6f 72 64 65 72 20 74 6f 20 70  a].In order to p
5350: 72 6f 76 69 64 65 20 61 75 74 68 65 6e 74 69 63  rovide authentic
5360: 61 74 69 6f 6e 2c 20 69 2e 65 2e 20 65 6e 73 75  ation, i.e. ensu
5370: 72 69 6e 67 20 73 6f 6d 65 6f 6e 65 20 69 73 20  ring someone is 
5380: 77 68 6f 20 74 68 65 79 20 73 61 79 20 74 68 65  who they say the
5390: 79 0a 61 72 65 2c 20 74 68 65 20 70 75 62 6c 69  y.are, the publi
53a0: 63 20 6b 65 79 20 61 6e 64 20 75 73 65 72 20 69  c key and user i
53b0: 64 65 6e 74 69 66 69 63 61 74 69 6f 6e 20 69 6e  dentification in
53c0: 66 6f 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20  fo is stored in 
53d0: 61 20 58 2e 35 30 39 0a 63 65 72 74 69 66 69 63  a X.509.certific
53e0: 61 74 65 20 61 6e 64 20 74 68 61 74 20 63 65 72  ate and that cer
53f0: 74 69 66 69 63 61 74 65 20 69 73 20 61 75 74 68  tificate is auth
5400: 65 6e 74 69 63 61 74 65 64 20 28 69 2e 65 2e 20  enticated (i.e. 
5410: 73 69 67 6e 65 64 29 20 62 79 20 61 20 43 65 72  signed) by a Cer
5420: 74 69 66 69 63 61 74 65 0a 41 75 74 68 6f 72 69  tificate.Authori
5430: 74 79 20 28 43 41 29 2e 20 55 73 65 72 73 20 63  ty (CA). Users c
5440: 61 6e 20 74 68 65 6e 20 65 78 63 68 61 6e 67 65  an then exchange
5450: 20 74 68 65 73 65 20 63 65 72 74 69 66 69 63 61   these certifica
5460: 74 65 73 20 64 75 72 69 6e 67 20 74 68 65 20 54  tes during the T
5470: 4c 53 0a 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f  LS.initializatio
5480: 6e 20 70 72 6f 63 65 73 73 20 61 6e 64 20 63 68  n process and ch
5490: 65 63 6b 20 74 68 65 6d 20 61 67 61 69 6e 73 74  eck them against
54a0: 20 74 68 65 20 72 6f 6f 74 20 43 41 20 63 65 72   the root CA cer
54b0: 74 69 66 69 63 61 74 65 73 20 74 6f 20 65 6e 73  tificates to ens
54c0: 75 72 65 0a 74 68 65 79 20 61 72 65 20 76 61 6c  ure.they are val
54d0: 69 64 2e 20 54 68 69 73 20 69 73 20 68 61 6e 64  id. This is hand
54e0: 6c 65 64 20 62 79 20 4f 70 65 6e 53 53 4c 20 76  led by OpenSSL v
54f0: 69 61 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  ia the [option -
5500: 72 65 71 75 65 73 74 5d 20 61 6e 64 0a 5b 6f 70  request] and.[op
5510: 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 6f  tion -require] o
5520: 70 74 69 6f 6e 73 2e 20 53 65 65 20 74 68 65 20  ptions. See the 
5530: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c  [option -cadir],
5540: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d   [option -cadir]
5550: 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 63  , and.[option -c
5560: 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20  astore] options 
5570: 66 6f 72 20 68 6f 77 20 74 6f 20 73 70 65 63 69  for how to speci
5580: 66 79 20 77 68 65 72 65 20 74 6f 20 66 69 6e 64  fy where to find
5590: 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69 63   the CA certific
55a0: 61 74 65 73 2e 0a 4f 70 74 69 6f 6e 61 6c 6c 79  ates..Optionally
55b0: 2c 20 69 6e 20 61 20 66 75 74 75 72 65 20 72 65  , in a future re
55c0: 6c 65 61 73 65 2c 20 74 68 65 79 20 63 61 6e 20  lease, they can 
55d0: 61 6c 73 6f 20 62 65 20 63 68 65 63 6b 65 64 20  also be checked 
55e0: 61 67 61 69 6e 73 74 20 74 68 65 20 43 65 72 74  against the Cert
55f0: 69 66 69 63 61 74 65 0a 52 65 76 6f 63 61 74 69  ificate.Revocati
5600: 6f 6e 20 4c 69 73 74 20 28 43 52 4c 29 20 6f 66  on List (CRL) of
5610: 20 72 65 76 6f 6b 65 64 20 63 65 72 74 69 66 69   revoked certifi
5620: 63 61 74 65 73 2e 20 43 65 72 74 69 66 69 63 61  cates. Certifica
5630: 74 65 73 20 63 61 6e 20 61 6c 73 6f 20 62 65 0a  tes can also be.
5640: 73 65 6c 66 2d 73 69 67 6e 65 64 2c 20 62 75 74  self-signed, but
5650: 20 74 68 65 79 20 61 72 65 20 62 79 20 64 65 66   they are by def
5660: 61 75 6c 74 20 6e 6f 74 20 74 72 75 73 74 65 64  ault not trusted
5670: 20 75 6e 6c 65 73 73 20 79 6f 75 20 61 64 64 20   unless you add 
5680: 74 68 65 6d 20 74 6f 20 79 6f 75 72 0a 63 65 72  them to your.cer
5690: 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 2e 0a  tificate store..
56a0: 5b 70 61 72 61 5d 0a 54 79 70 69 63 61 6c 6c 79  [para].Typically
56b0: 20 77 68 65 6e 20 76 69 73 69 74 69 6e 67 20 77   when visiting w
56c0: 65 62 20 73 69 74 65 73 2c 20 6f 6e 6c 79 20 74  eb sites, only t
56d0: 68 65 20 63 6c 69 65 6e 74 20 6e 65 65 64 73 20  he client needs 
56e0: 74 6f 20 63 68 65 63 6b 20 74 68 65 20 73 65 72  to check the ser
56f0: 76 65 72 27 73 0a 63 65 72 74 69 66 69 63 61 74  ver's.certificat
5700: 65 20 74 6f 20 65 6e 73 75 72 65 20 69 74 20 69  e to ensure it i
5710: 73 20 76 61 6c 69 64 2e 20 54 68 65 20 73 65 72  s valid. The ser
5720: 76 65 72 20 64 6f 65 73 6e 27 74 20 6e 65 65 64  ver doesn't need
5730: 20 74 6f 20 63 68 65 63 6b 20 74 68 65 20 63 6c   to check the cl
5740: 69 65 6e 74 0a 63 65 72 74 69 66 69 63 61 74 65  ient.certificate
5750: 20 75 6e 6c 65 73 73 20 79 6f 75 20 6e 65 65 64   unless you need
5760: 20 74 6f 20 61 75 74 68 65 6e 74 69 63 61 74 65   to authenticate
5770: 20 77 69 74 68 20 74 68 65 6d 20 74 6f 20 6c 6f   with them to lo
5780: 67 69 6e 2c 20 65 74 63 2e 20 53 65 65 20 74 68  gin, etc. See th
5790: 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74 5d  e.[option -cert]
57a0: 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 65   and [option -ce
57b0: 72 74 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20  rtfile] options 
57c0: 69 66 20 79 6f 75 20 6e 65 65 64 20 74 6f 20 70  if you need to p
57d0: 72 6f 76 69 64 65 20 61 20 63 65 72 74 69 66 69  rovide a certifi
57e0: 63 61 74 65 2e 0a 0a 0a 5b 73 75 62 73 65 63 74  cate....[subsect
57f0: 69 6f 6e 20 22 53 75 6d 6d 61 72 79 20 6f 66 20  ion "Summary of 
5800: 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 6f 70 74  command line opt
5810: 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c  ions"]..The foll
5820: 6f 77 69 6e 67 20 6f 70 74 69 6f 6e 73 20 61 72  owing options ar
5830: 65 20 75 73 65 64 20 66 6f 72 20 70 65 65 72 20  e used for peer 
5840: 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c 69  certificate vali
5850: 64 61 74 69 6f 6e 3a 0a 0a 5b 6c 69 73 74 5f 62  dation:..[list_b
5860: 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b  egin options]..[
5870: 6f 70 74 5f 64 65 66 20 2d 63 61 64 69 72 20 5b  opt_def -cadir [
5880: 61 72 67 20 64 69 72 65 63 74 6f 72 79 5d 5d 0a  arg directory]].
5890: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 64 69  Specifies the di
58a0: 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 68  rectory where th
58b0: 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  e Certificate Au
58c0: 74 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72  thority (CA) cer
58d0: 74 69 66 69 63 61 74 65 73 20 61 72 65 0a 73 74  tificates are.st
58e0: 6f 72 65 64 2e 20 54 68 65 20 64 65 66 61 75 6c  ored. The defaul
58f0: 74 20 69 73 20 70 6c 61 74 66 6f 72 6d 20 73 70  t is platform sp
5900: 65 63 69 66 69 63 2c 20 62 75 74 20 69 73 20 75  ecific, but is u
5910: 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20 2f 65 74  sually [file /et
5920: 63 2f 73 73 6c 2f 63 65 72 74 73 5d 20 6f 6e 0a  c/ssl/certs] on.
5930: 4c 69 6e 75 78 2f 55 6e 69 78 20 73 79 73 74 65  Linux/Unix syste
5940: 6d 73 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  ms. The default 
5950: 6c 6f 63 61 74 69 6f 6e 20 63 61 6e 20 62 65 20  location can be 
5960: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68  overridden by th
5970: 65 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  e.[var SSL_CERT_
5980: 44 49 52 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74  DIR] environment
5990: 20 76 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74   variable...[opt
59a0: 5f 64 65 66 20 2d 63 61 66 69 6c 65 20 5b 61 72  _def -cafile [ar
59b0: 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65  g filename]].Spe
59c0: 63 69 66 69 65 73 20 74 68 65 20 66 69 6c 65 20  cifies the file 
59d0: 77 69 74 68 20 74 68 65 20 43 65 72 74 69 66 69  with the Certifi
59e0: 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28  cate Authority (
59f0: 43 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73  CA) certificates
5a00: 20 74 6f 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73   to use in.[cons
5a10: 74 20 50 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d  t PEM] file form
5a20: 61 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  at. The default 
5a30: 69 73 20 5b 66 69 6c 65 20 63 65 72 74 2e 70 65  is [file cert.pe
5a40: 6d 5d 2c 20 69 6e 20 74 68 65 20 4f 70 65 6e 53  m], in the OpenS
5a50: 53 4c 0a 64 69 72 65 63 74 6f 72 79 2e 20 4f 6e  SL.directory. On
5a60: 20 4c 69 6e 75 78 2f 55 6e 69 78 20 73 79 73 74   Linux/Unix syst
5a70: 65 6d 73 2c 20 74 68 69 73 20 69 73 20 75 73 75  ems, this is usu
5a80: 61 6c 6c 79 20 5b 66 69 6c 65 20 2f 65 74 63 2f  ally [file /etc/
5a90: 73 73 6c 2f 63 61 2d 62 75 6e 64 6c 65 2e 70 65  ssl/ca-bundle.pe
5aa0: 6d 5d 2e 0a 54 68 65 20 64 65 66 61 75 6c 74 20  m]..The default 
5ab0: 66 69 6c 65 20 63 61 6e 20 62 65 20 6f 76 65 72  file can be over
5ac0: 72 69 64 64 65 6e 20 62 79 20 74 68 65 20 5b 76  ridden by the [v
5ad0: 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45  ar SSL_CERT_FILE
5ae0: 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 76 61  ] environment.va
5af0: 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65  riable...[opt_de
5b00: 66 20 2d 63 61 73 74 6f 72 65 20 5b 61 72 67 20  f -castore [arg 
5b10: 55 52 49 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  URI]].Specifies 
5b20: 74 68 65 20 55 6e 69 66 6f 72 6d 20 52 65 73 6f  the Uniform Reso
5b30: 75 72 63 65 20 49 64 65 6e 74 69 66 69 65 72 20  urce Identifier 
5b40: 28 55 52 49 29 20 66 6f 72 20 74 68 65 20 43 65  (URI) for the Ce
5b50: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
5b60: 69 74 79 0a 28 43 41 29 20 73 74 6f 72 65 2c 20  ity.(CA) store, 
5b70: 77 68 69 63 68 20 6d 61 79 20 62 65 20 61 20 73  which may be a s
5b80: 69 6e 67 6c 65 20 63 6f 6e 74 61 69 6e 65 72 20  ingle container 
5b90: 6f 72 20 61 20 63 61 74 61 6c 6f 67 20 6f 66 20  or a catalog of 
5ba0: 63 6f 6e 74 61 69 6e 65 72 73 2e 0a 53 74 61 72  containers..Star
5bb0: 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e 53 53  ting with OpenSS
5bc0: 4c 20 33 2e 32 20 6f 6e 20 4d 53 20 57 69 6e 64  L 3.2 on MS Wind
5bd0: 6f 77 73 2c 20 73 65 74 20 74 6f 20 22 5b 63 6f  ows, set to "[co
5be0: 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e 73 73 6c  nst "org.openssl
5bf0: 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a  .winstore://"]".
5c00: 74 6f 20 75 73 65 20 74 68 65 20 62 75 69 6c 74  to use the built
5c10: 2d 69 6e 20 4d 53 20 57 69 6e 64 6f 77 73 20 43  -in MS Windows C
5c20: 65 72 74 69 66 69 63 61 74 65 20 53 74 6f 72 65  ertificate Store
5c30: 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63  . Starting in Tc
5c40: 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69 73 0a 69  lTLS 2.0, this.i
5c50: 73 20 74 68 65 20 64 65 66 61 75 6c 74 20 69 66  s the default if
5c60: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d   [option -cadir]
5c70: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72  , [option -cadir
5c80: 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d  ], and [option -
5c90: 63 61 73 74 6f 72 65 5d 20 61 72 65 0a 6e 6f 74  castore] are.not
5ca0: 20 73 70 65 63 69 66 69 65 64 2e 20 54 68 69 73   specified. This
5cb0: 20 73 74 6f 72 65 20 6f 6e 6c 79 20 73 75 70 70   store only supp
5cc0: 6f 72 74 73 20 72 6f 6f 74 20 63 65 72 74 69 66  orts root certif
5cd0: 69 63 61 74 65 20 73 74 6f 72 65 73 2e 0a 0a 5b  icate stores...[
5ce0: 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 65 73 74  opt_def -request
5cf0: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71   [arg bool]].Req
5d00: 75 65 73 74 20 61 20 63 65 72 74 69 66 69 63 61  uest a certifica
5d10: 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65 72  te from the peer
5d20: 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c 20   during the SSL 
5d30: 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 69 73 20  handshake. This 
5d40: 69 73 20 6e 65 65 64 65 64 0a 74 6f 20 64 6f 20  is needed.to do 
5d50: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
5d60: 64 61 74 69 6f 6e 2e 20 53 74 61 72 74 69 6e 67  dation. Starting
5d70: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c 20   in TclTLS 1.8, 
5d80: 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 0a 5b  the default is.[
5d90: 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 53 74 61  const true]. Sta
5da0: 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20  rting in TclTLS 
5db0: 32 2e 30 2c 20 69 66 20 73 65 74 20 74 6f 20 5b  2.0, if set to [
5dc0: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20 61 6e 64  const false] and
5dd0: 0a 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 72  .[option -requir
5de0: 65 5d 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75  e] is [const tru
5df0: 65 5d 2c 20 74 68 65 6e 20 74 68 69 73 20 77 69  e], then this wi
5e00: 6c 6c 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e  ll be overridden
5e10: 20 74 6f 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d   to [const true]
5e20: 2e 0a 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 74  ..In addition, t
5e30: 68 65 20 63 6c 69 65 6e 74 20 63 61 6e 20 6d 61  he client can ma
5e40: 6e 75 61 6c 6c 79 20 69 6e 73 70 65 63 74 20 61  nually inspect a
5e50: 6e 64 20 61 63 63 65 70 74 20 6f 72 20 72 65 6a  nd accept or rej
5e60: 65 63 74 0a 65 61 63 68 20 63 65 72 74 69 66 69  ect.each certifi
5e70: 63 61 74 65 20 75 73 69 6e 67 20 74 68 65 20 5b  cate using the [
5e80: 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65  option -validate
5e90: 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 2e  command] option.
5ea0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75  ..[opt_def -requ
5eb0: 69 72 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a  ire [arg bool]].
5ec0: 52 65 71 75 69 72 65 20 61 20 76 61 6c 69 64 20  Require a valid 
5ed0: 63 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d  certificate from
5ee0: 20 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67   the peer during
5ef0: 20 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61   the SSL handsha
5f00: 6b 65 2e 20 49 66 20 74 68 69 73 20 69 73 0a 73  ke. If this is.s
5f10: 65 74 20 74 6f 20 74 72 75 65 2c 20 74 68 65 6e  et to true, then
5f20: 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65 73   [option -reques
5f30: 74 5d 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 20  t] must also be 
5f40: 73 65 74 20 74 6f 20 74 72 75 65 20 61 6e 64 20  set to true and 
5f50: 61 20 65 69 74 68 65 72 0a 5b 6f 70 74 69 6f 6e  a either.[option
5f60: 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f   -cadir], [optio
5f70: 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 5b 6f 70 74  n -cafile], [opt
5f80: 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 2c 20 6f  ion -castore], o
5f90: 72 20 61 20 70 6c 61 74 66 6f 72 6d 20 64 65 66  r a platform def
5fa0: 61 75 6c 74 0a 6d 75 73 74 20 62 65 20 70 72 6f  ault.must be pro
5fb0: 76 69 64 65 64 20 69 6e 20 6f 72 64 65 72 20 74  vided in order t
5fc0: 6f 20 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e  o validate again
5fd0: 73 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  st. The default 
5fe0: 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61 6e  in TclTLS 1.8 an
5ff0: 64 0a 65 61 72 6c 69 65 72 20 76 65 72 73 69 6f  d.earlier versio
6000: 6e 73 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c  ns is [const fal
6010: 73 65 5d 20 73 69 6e 63 65 20 6e 6f 74 20 61 6c  se] since not al
6020: 6c 20 70 6c 61 74 66 6f 72 6d 73 20 68 61 76 65  l platforms have
6030: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f   certificates to
6040: 0a 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e 73  .validate agains
6050: 74 20 69 6e 20 61 20 66 6f 72 6d 20 63 6f 6d 70  t in a form comp
6060: 61 74 69 62 6c 65 20 77 69 74 68 20 4f 70 65 6e  atible with Open
6070: 53 53 4c 2e 20 53 74 61 72 74 69 6e 67 20 69 6e  SSL. Starting in
6080: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 0a 74 68 65   TclTLS 2.0,.the
6090: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
60a0: 73 74 20 74 72 75 65 5d 2e 0a 0a 5b 6c 69 73 74  st true]...[list
60b0: 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69  _end]..[subsecti
60c0: 6f 6e 20 22 57 68 65 6e 20 61 72 65 20 63 6f 6d  on "When are com
60d0: 6d 61 6e 64 20 6c 69 6e 65 20 6f 70 74 69 6f 6e  mand line option
60e0: 73 20 6e 65 65 64 65 64 3f 22 5d 0a 0a 49 6e 20  s needed?"]..In 
60f0: 54 63 6c 54 4c 53 20 31 2e 38 20 61 6e 64 20 65  TclTLS 1.8 and e
6100: 61 72 6c 69 65 72 20 76 65 72 73 69 6f 6e 73 2c  arlier versions,
6110: 20 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c   certificate val
6120: 69 64 61 74 69 6f 6e 20 69 73 0a 5b 65 6d 70 68  idation is.[emph
6130: 20 4e 4f 54 5d 20 65 6e 61 62 6c 65 64 20 62 79   NOT] enabled by
6140: 20 64 65 66 61 75 6c 74 2e 20 54 68 69 73 20 6c   default. This l
6150: 69 6d 69 74 61 74 69 6f 6e 20 69 73 20 64 75 65  imitation is due
6160: 20 74 6f 20 74 68 65 20 6c 61 63 6b 20 6f 66 20   to the lack of 
6170: 61 20 63 6f 6d 6d 6f 6e 0a 63 72 6f 73 73 20 70  a common.cross p
6180: 6c 61 74 66 6f 72 6d 20 64 61 74 61 62 61 73 65  latform database
6190: 20 6f 66 20 43 65 72 74 69 66 69 63 61 74 65 20   of Certificate 
61a0: 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 20 70  Authority (CA) p
61b0: 72 6f 76 69 64 65 64 20 63 65 72 74 69 66 69 63  rovided certific
61c0: 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 61 74 65  ates to.validate
61d0: 20 61 67 61 69 6e 73 74 2e 20 4d 61 6e 79 20 4c   against. Many L
61e0: 69 6e 75 78 20 73 79 73 74 65 6d 73 20 6e 61 74  inux systems nat
61f0: 69 76 65 6c 79 20 73 75 70 70 6f 72 74 20 4f 70  ively support Op
6200: 65 6e 53 53 4c 20 61 6e 64 20 74 68 75 73 20 68  enSSL and thus h
6210: 61 76 65 0a 74 68 65 73 65 20 63 65 72 74 69 66  ave.these certif
6220: 69 63 61 74 65 73 20 69 6e 73 74 61 6c 6c 65 64  icates installed
6230: 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20   as part of the 
6240: 4f 53 2c 20 62 75 74 20 4d 61 63 4f 53 20 61 6e  OS, but MacOS an
6250: 64 20 4d 53 20 57 69 6e 64 6f 77 73 20 64 6f 20  d MS Windows do 
6260: 6e 6f 74 2e 0a 53 74 61 72 69 6e 67 20 69 6e 20  not..Staring in 
6270: 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69 73  TclTLS 2.0, this
6280: 20 68 61 73 20 62 65 65 6e 20 63 68 61 6e 67 65   has been change
6290: 64 20 74 6f 20 72 65 71 75 69 72 65 20 63 65 72  d to require cer
62a0: 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 61 74  tificate validat
62b0: 69 6f 6e 0a 62 79 20 64 65 66 61 75 6c 74 2e 20  ion.by default. 
62c0: 49 6e 20 6f 72 64 65 72 20 74 6f 20 75 73 65 20  In order to use 
62d0: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71  the [option -req
62e0: 75 69 72 65 5d 20 6f 70 74 69 6f 6e 2c 20 6f 6e  uire] option, on
62f0: 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69  e of the followi
6300: 6e 67 0a 6d 75 73 74 20 62 65 20 74 72 75 65 3a  ng.must be true:
6310: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 69 74  ..[list_begin it
6320: 65 6d 69 7a 65 64 5d 0a 0a 5b 69 74 65 6d 5d 0a  emized]..[item].
6330: 4f 6e 20 4c 69 6e 75 78 20 61 6e 64 20 55 6e 69  On Linux and Uni
6340: 78 20 73 79 73 74 65 6d 73 20 77 69 74 68 20 4f  x systems with O
6350: 70 65 6e 53 53 4c 20 61 6c 72 65 61 64 79 20 69  penSSL already i
6360: 6e 73 74 61 6c 6c 65 64 20 6f 72 20 69 66 20 74  nstalled or if t
6370: 68 65 20 43 41 0a 63 65 72 74 69 66 69 63 61 74  he CA.certificat
6380: 65 73 20 61 72 65 20 61 76 61 69 6c 61 62 6c 65  es are available
6390: 20 69 6e 20 50 45 4d 20 66 6f 72 6d 61 74 2c 20   in PEM format, 
63a0: 61 6e 64 20 69 66 20 74 68 65 79 20 61 72 65 20  and if they are 
63b0: 73 74 6f 72 65 64 20 69 6e 20 74 68 65 0a 73 74  stored in the.st
63c0: 61 6e 64 61 72 64 20 6c 6f 63 61 74 69 6f 6e 73  andard locations
63d0: 2c 20 6f 72 20 69 66 20 74 68 65 20 5b 76 61 72  , or if the [var
63e0: 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20 6f   SSL_CERT_DIR] o
63f0: 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  r [var SSL_CERT_
6400: 46 49 4c 45 5d 0a 65 6e 76 69 72 6f 6e 6d 65 6e  FILE].environmen
6410: 74 20 76 61 72 69 61 62 6c 65 73 20 61 72 65 20  t variables are 
6420: 73 65 74 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f  set, then [optio
6430: 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69  n -cadir], [opti
6440: 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 61 6e 64 20  on -cadir],.and 
6450: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65  [option -castore
6460: 5d 20 61 72 65 6e 27 74 20 6e 65 65 64 65 64 2e  ] aren't needed.
6470: 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65 6e  ..[item].If Open
6480: 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74 61  SSL is not insta
6490: 6c 6c 65 64 20 69 6e 20 74 68 65 20 64 65 66 61  lled in the defa
64a0: 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 2c 20 6f 72  ult location, or
64b0: 20 77 68 65 6e 20 75 73 69 6e 67 20 4d 61 63 20   when using Mac 
64c0: 4f 53 0a 6f 72 20 4d 53 20 57 69 6e 64 6f 77 73  OS.or MS Windows
64d0: 20 61 6e 64 20 4f 70 65 6e 53 53 4c 20 69 73 20   and OpenSSL is 
64e0: 69 6e 73 74 61 6c 6c 65 64 2c 20 74 68 65 20 5b  installed, the [
64f0: 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52  var SSL_CERT_DIR
6500: 5d 20 61 6e 64 2f 6f 72 0a 5b 76 61 72 20 53 53  ] and/or.[var SS
6510: 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76  L_CERT_FILE] env
6520: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c  ironment variabl
6530: 65 73 20 6f 72 20 74 68 65 20 6f 6e 65 20 6f 66  es or the one of
6540: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61   the [option -ca
6550: 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d 63  dir],.[option -c
6560: 61 64 69 72 5d 2c 20 6f 72 20 5b 6f 70 74 69 6f  adir], or [optio
6570: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69  n -castore] opti
6580: 6f 6e 73 20 6d 75 73 74 20 62 65 20 64 65 66 69  ons must be defi
6590: 6e 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20  ned...[item].On 
65a0: 4d 53 20 57 69 6e 64 6f 77 73 2c 20 73 74 61 72  MS Windows, star
65b0: 74 69 6e 67 20 69 6e 20 4f 70 65 6e 53 53 4c 20  ting in OpenSSL 
65c0: 33 2e 32 2c 20 69 74 20 69 73 20 6e 6f 77 20 70  3.2, it is now p
65d0: 6f 73 73 69 62 6c 65 20 74 6f 20 61 63 63 65 73  ossible to acces
65e0: 73 20 74 68 65 0a 62 75 69 6c 74 2d 69 6e 20 57  s the.built-in W
65f0: 69 6e 64 6f 77 73 20 43 65 72 74 69 66 69 63 61  indows Certifica
6600: 74 65 20 53 74 6f 72 65 20 66 72 6f 6d 20 4f 70  te Store from Op
6610: 65 6e 53 53 4c 2e 20 54 68 69 73 20 63 61 6e 20  enSSL. This can 
6620: 75 74 69 6c 69 7a 65 64 20 62 79 0a 73 65 74 74  utilized by.sett
6630: 69 6e 67 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  ing the [option 
6640: 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e  -castore] option
6650: 20 74 6f 20 22 5b 63 6f 6e 73 74 20 6f 72 67 2e   to "[const org.
6660: 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65  openssl.winstore
6670: 3a 2f 2f 5d 22 2e 0a 49 6e 20 54 63 6c 54 4c 53  ://]"..In TclTLS
6680: 20 32 2e 30 2c 20 74 68 69 73 20 69 73 20 74 68   2.0, this is th
6690: 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 20  e default value 
66a0: 69 66 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  if [option -cadi
66b0: 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  r],.[option -cad
66c0: 69 72 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e  ir], and [option
66d0: 20 2d 63 61 73 74 6f 72 65 5d 20 61 72 65 20 6e   -castore] are n
66e0: 6f 74 20 73 70 65 63 69 66 69 65 64 2e 0a 0a 5b  ot specified...[
66f0: 69 74 65 6d 5d 0a 49 66 20 4f 70 65 6e 53 53 4c  item].If OpenSSL
6700: 20 69 73 20 6e 6f 74 20 69 6e 73 74 61 6c 6c 65   is not installe
6710: 64 20 6f 72 20 74 68 65 20 43 41 20 63 65 72 74  d or the CA cert
6720: 69 66 69 63 61 74 65 73 20 61 72 65 20 6e 6f 74  ificates are not
6730: 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 50 45   available in PE
6740: 4d 0a 66 6f 72 6d 61 74 2c 20 74 68 65 20 43 41  M.format, the CA
6750: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 6d 75   certificates mu
6760: 73 74 20 62 65 20 64 6f 77 6e 6c 6f 61 64 65 64  st be downloaded
6770: 20 61 6e 64 20 69 6e 73 74 61 6c 6c 65 64 20 77   and installed w
6780: 69 74 68 20 74 68 65 20 75 73 65 72 0a 73 6f 66  ith the user.sof
6790: 74 77 61 72 65 2e 20 54 68 65 20 43 55 52 4c 20  tware. The CURL 
67a0: 74 65 61 6d 20 6d 61 6b 65 73 20 74 68 65 6d 20  team makes them 
67b0: 61 76 61 69 6c 61 62 6c 65 20 61 74 0a 5b 75 72  available at.[ur
67c0: 69 20 22 68 74 74 70 73 3a 2f 2f 63 75 72 6c 2e  i "https://curl.
67d0: 73 65 2f 64 6f 63 73 2f 63 61 65 78 74 72 61 63  se/docs/caextrac
67e0: 74 2e 68 74 6d 6c 22 20 22 43 41 20 63 65 72 74  t.html" "CA cert
67f0: 69 66 69 63 61 74 65 73 20 65 78 74 72 61 63 74  ificates extract
6800: 65 64 0a 66 72 6f 6d 20 4d 6f 7a 69 6c 6c 61 22  ed.from Mozilla"
6810: 5d 20 69 6e 20 74 68 65 20 5b 66 69 6c 65 20 63  ] in the [file c
6820: 61 63 65 72 74 2e 70 65 6d 5d 20 66 69 6c 65 2e  acert.pem] file.
6830: 20 59 6f 75 20 6d 75 73 74 20 74 68 65 6e 20 65   You must then e
6840: 69 74 68 65 72 20 73 65 74 20 74 68 65 0a 5b 76  ither set the.[v
6850: 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d  ar SSL_CERT_DIR]
6860: 20 61 6e 64 2f 6f 72 20 5b 76 61 72 20 53 53 4c   and/or [var SSL
6870: 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69  _CERT_FILE] envi
6880: 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65  ronment variable
6890: 73 20 6f 72 20 74 68 65 0a 5b 6f 70 74 69 6f 6e  s or the.[option
68a0: 20 2d 63 61 64 69 72 5d 20 6f 72 20 5b 6f 70 74   -cadir] or [opt
68b0: 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 20 6f 70 74  ion -cafile] opt
68c0: 69 6f 6e 73 20 74 6f 20 74 68 65 20 43 41 20 63  ions to the CA c
68d0: 65 72 74 20 66 69 6c 65 27 73 20 69 6e 73 74 61  ert file's insta
68e0: 6c 6c 0a 6c 6f 63 61 74 69 6f 6e 2e 20 49 74 20  ll.location. It 
68f0: 69 73 20 79 6f 75 72 20 72 65 73 70 6f 6e 73 69  is your responsi
6900: 62 69 6c 69 74 79 20 74 6f 20 6b 65 65 70 20 74  bility to keep t
6910: 68 69 73 20 66 69 6c 65 20 75 70 20 74 6f 20 64  his file up to d
6920: 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  ate...[list_end]
6930: 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43 61 6c 6c  ..[section "Call
6940: 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d 0a 0a  back Options"]..
6950: 41 73 20 70 72 65 76 69 6f 75 73 6c 79 20 64 65  As previously de
6960: 73 63 72 69 62 65 64 2c 20 65 61 63 68 20 63 68  scribed, each ch
6970: 61 6e 6e 65 6c 20 63 61 6e 20 62 65 20 67 69 76  annel can be giv
6980: 65 6e 20 74 68 65 69 72 20 6f 77 6e 20 63 61 6c  en their own cal
6990: 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e 64 6c 65  lbacks.to handle
69a0: 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20 70 72   intermediate pr
69b0: 6f 63 65 73 73 69 6e 67 20 62 79 20 74 68 65 20  ocessing by the 
69c0: 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 2c  OpenSSL library,
69d0: 20 75 73 69 6e 67 20 74 68 65 0a 5b 6f 70 74 69   using the.[opti
69e0: 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f  on -command], [o
69f0: 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d  ption -password]
6a00: 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 76  , and [option -v
6a10: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
6a20: 20 6f 70 74 69 6f 6e 73 0a 70 61 73 73 65 64 20   options.passed 
6a30: 74 6f 20 65 69 74 68 65 72 20 6f 66 20 5b 63 6d  to either of [cm
6a40: 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 6f  d tls::socket] o
6a50: 72 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f  r [cmd tls::impo
6a60: 72 74 5d 2e 0a 55 6e 6c 69 6b 65 20 70 72 65 76  rt]..Unlike prev
6a70: 69 6f 75 73 20 76 65 72 73 69 6f 6e 73 20 6f 66  ious versions of
6a80: 20 54 63 6c 54 4c 53 2c 20 6f 6e 6c 79 20 69 66   TclTLS, only if
6a90: 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 67 65   the callback ge
6aa0: 6e 65 72 61 74 65 73 20 61 6e 20 65 72 72 6f 72  nerates an error
6ab0: 2c 0a 77 69 6c 6c 20 74 68 65 20 5b 73 79 73 63  ,.will the [sysc
6ac0: 6d 64 20 62 67 65 72 72 6f 72 5d 20 63 6f 6d 6d  md bgerror] comm
6ad0: 61 6e 64 20 62 65 20 69 6e 76 6f 6b 65 64 20 77  and be invoked w
6ae0: 69 74 68 20 74 68 65 20 65 72 72 6f 72 20 69 6e  ith the error in
6af0: 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 5b 73 75 62  formation...[sub
6b00: 73 65 63 74 69 6f 6e 20 22 56 61 6c 75 65 73 20  section "Values 
6b10: 66 6f 72 20 43 6f 6d 6d 61 6e 64 20 43 61 6c 6c  for Command Call
6b20: 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c  back"]..The call
6b30: 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70  back for the [op
6b40: 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 6f  tion -command] o
6b50: 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64  ption is invoked
6b60: 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f 69 6e   at several poin
6b70: 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a 4f 70  ts during the.Op
6b80: 65 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 20  enSSL handshake 
6b90: 61 6e 64 20 64 75 72 69 6e 67 20 72 6f 75 74 69  and during routi
6ba0: 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 53  ne operations. S
6bb0: 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 74 68 65  ee below for the
6bc0: 20 70 6f 73 73 69 62 6c 65 0a 61 72 67 75 6d 65   possible.argume
6bd0: 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20 74 68  nts passed to th
6be0: 65 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70  e callback scrip
6bf0: 74 2e 20 56 61 6c 75 65 73 20 72 65 74 75 72 6e  t. Values return
6c00: 65 64 20 66 72 6f 6d 20 74 68 65 20 63 61 6c 6c  ed from the call
6c10: 62 61 63 6b 20 61 72 65 0a 69 67 6e 6f 72 65 64  back are.ignored
6c20: 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f  ...[list_begin o
6c30: 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65  ptions]..[opt_de
6c40: 66 20 65 72 72 6f 72 20 5b 61 72 67 20 22 63 68  f error [arg "ch
6c50: 61 6e 6e 65 6c 49 64 20 6d 65 73 73 61 67 65 22  annelId message"
6c60: 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20  ]].This form of 
6c70: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f  callback is invo
6c80: 6b 65 64 20 77 68 65 6e 65 76 65 72 20 61 6e 20  ked whenever an 
6c90: 65 72 72 6f 72 20 6f 63 63 75 72 73 20 64 75 72  error occurs dur
6ca0: 69 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c 0a  ing the initial.
6cb0: 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68 61 6e 64  connection, hand
6cc0: 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f 70  shake, or I/O op
6cd0: 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 20 5b 61  erations. The [a
6ce0: 72 67 20 6d 65 73 73 61 67 65 5d 20 61 72 67 75  rg message] argu
6cf0: 6d 65 6e 74 20 63 61 6e 20 62 65 0a 66 72 6f 6d  ment can be.from
6d00: 20 74 68 65 20 54 63 6c 5f 45 72 72 6e 6f 4d 73   the Tcl_ErrnoMs
6d10: 67 2c 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74  g, OpenSSL funct
6d20: 69 6f 6e 20 5b 66 75 6e 20 45 52 52 5f 72 65 61  ion [fun ERR_rea
6d30: 73 6f 6e 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67  son_error_string
6d40: 28 29 5d 2c 0a 6f 72 20 61 20 63 75 73 74 6f 6d  ()],.or a custom
6d50: 20 6d 65 73 73 61 67 65 2e 20 54 68 69 73 20 63   message. This c
6d60: 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20 66  allback is new f
6d70: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
6d80: 5b 6f 70 74 5f 64 65 66 20 69 6e 66 6f 20 5b 61  [opt_def info [a
6d90: 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 6d 61  rg "channelId ma
6da0: 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65 73 73 61 67  jor minor messag
6db0: 65 20 74 79 70 65 22 5d 5d 0a 54 68 69 73 20 66  e type"]].This f
6dc0: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20  orm of callback 
6dd0: 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68  is invoked by th
6de0: 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69  e OpenSSL functi
6df0: 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73 65 74 5f  on.[fun SSL_set_
6e00: 69 6e 66 6f 5f 63 61 6c 6c 62 61 63 6b 28 29 5d  info_callback()]
6e10: 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69 74   during the init
6e20: 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61  ial connection a
6e30: 6e 64 20 68 61 6e 64 73 68 61 6b 65 0a 6f 70 65  nd handshake.ope
6e40: 72 61 74 69 6f 6e 73 2e 20 54 68 65 20 61 72 67  rations. The arg
6e50: 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69  uments are:..[li
6e60: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
6e70: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67  ions]..[def [arg
6e80: 20 6d 61 6a 6f 72 5d 5d 0a 4d 61 6a 6f 72 20 63   major]].Major c
6e90: 61 74 65 67 6f 72 79 20 66 6f 72 20 65 72 72 6f  ategory for erro
6ea0: 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d 73 20 61  r. Valid enums a
6eb0: 72 65 3a 20 5b 63 6f 6e 73 74 20 68 61 6e 64 73  re: [const hands
6ec0: 68 61 6b 65 5d 2c 20 5b 63 6f 6e 73 74 20 61 6c  hake], [const al
6ed0: 65 72 74 5d 2c 0a 5b 63 6f 6e 73 74 20 63 6f 6e  ert],.[const con
6ee0: 6e 65 63 74 5d 2c 20 5b 63 6f 6e 73 74 20 61 63  nect], [const ac
6ef0: 63 65 70 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72  cept]...[def [ar
6f00: 67 20 6d 69 6e 6f 72 5d 5d 0a 4d 69 6e 6f 72 20  g minor]].Minor 
6f10: 63 61 74 65 67 6f 72 79 20 66 6f 72 20 65 72 72  category for err
6f20: 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d 73 20  or. Valid enums 
6f30: 61 72 65 3a 20 5b 63 6f 6e 73 74 20 73 74 61 72  are: [const star
6f40: 74 5d 2c 20 5b 63 6f 6e 73 74 20 64 6f 6e 65 5d  t], [const done]
6f50: 2c 20 5b 63 6f 6e 73 74 20 72 65 61 64 5d 2c 0a  , [const read],.
6f60: 5b 63 6f 6e 73 74 20 77 72 69 74 65 5d 2c 20 5b  [const write], [
6f70: 63 6f 6e 73 74 20 6c 6f 6f 70 5d 2c 20 5b 63 6f  const loop], [co
6f80: 6e 73 74 20 65 78 69 74 5d 2e 0a 0a 5b 64 65 66  nst exit]...[def
6f90: 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 5d 0a   [arg message]].
6fa0: 44 65 73 63 72 69 70 74 69 76 65 20 6d 65 73 73  Descriptive mess
6fb0: 61 67 65 20 73 74 72 69 6e 67 20 77 68 69 63 68  age string which
6fc0: 20 6d 61 79 20 62 65 20 67 65 6e 65 72 61 74 65   may be generate
6fd0: 64 20 65 69 74 68 65 72 20 62 79 0a 5b 66 75 6e  d either by.[fun
6fe0: 20 53 53 4c 5f 73 74 61 74 65 5f 73 74 72 69 6e   SSL_state_strin
6ff0: 67 5f 6c 6f 6e 67 28 29 5d 20 6f 72 20 5b 66 75  g_long()] or [fu
7000: 6e 20 53 53 4c 5f 61 6c 65 72 74 5f 64 65 73 63  n SSL_alert_desc
7010: 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d 2c  _string_long()],
7020: 0a 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68  .depending on th
7030: 65 20 63 6f 6e 74 65 78 74 2e 0a 0a 5b 64 65 66  e context...[def
7040: 20 5b 61 72 67 20 74 79 70 65 5d 5d 0a 46 6f 72   [arg type]].For
7050: 20 61 6c 65 72 74 73 2c 20 74 68 65 20 70 6f 73   alerts, the pos
7060: 73 69 62 6c 65 20 76 61 6c 75 65 73 20 61 72 65  sible values are
7070: 3a 20 5b 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67  : [const warning
7080: 5d 2c 0a 5b 63 6f 6e 73 74 20 66 61 74 61 6c 5d  ],.[const fatal]
7090: 2c 20 61 6e 64 20 5b 63 6f 6e 73 74 20 75 6e 6b  , and [const unk
70a0: 6e 6f 77 6e 5d 2e 20 46 6f 72 20 6f 74 68 65 72  nown]. For other
70b0: 73 2c 20 5b 63 6f 6e 73 74 20 69 6e 66 6f 5d 20  s, [const info] 
70c0: 69 73 20 75 73 65 64 2e 0a 54 68 69 73 20 61 72  is used..This ar
70d0: 67 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 66 6f  gument is new fo
70e0: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
70f0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f  list_end]..[opt_
7100: 64 65 66 20 6d 65 73 73 61 67 65 20 5b 61 72 67  def message [arg
7110: 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 69 72 65   "channelId dire
7120: 63 74 69 6f 6e 20 76 65 72 73 69 6f 6e 20 63 6f  ction version co
7130: 6e 74 65 6e 74 5f 74 79 70 65 20 6d 65 73 73 61  ntent_type messa
7140: 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20  ge"]].This form 
7150: 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69  of callback is i
7160: 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70  nvoked by the Op
7170: 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b  enSSL function.[
7180: 66 75 6e 20 53 53 4c 5f 73 65 74 5f 6d 73 67 5f  fun SSL_set_msg_
7190: 63 61 6c 6c 62 61 63 6b 28 29 5d 20 77 68 65 6e  callback()] when
71a0: 65 76 65 72 20 61 20 6d 65 73 73 61 67 65 20 69  ever a message i
71b0: 73 20 73 65 6e 74 20 6f 72 20 72 65 63 65 69 76  s sent or receiv
71c0: 65 64 20 64 75 72 69 6e 67 20 74 68 65 0a 69 6e  ed during the.in
71d0: 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e  itial connection
71e0: 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20 6f 72 20  , handshake, or 
71f0: 49 2f 4f 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20  I/O operations. 
7200: 49 74 20 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c  It is only avail
7210: 61 62 6c 65 20 77 68 65 6e 0a 4f 70 65 6e 53 53  able when.OpenSS
7220: 4c 20 69 73 20 63 6f 6d 70 6c 69 65 64 20 77 69  L is complied wi
7230: 74 68 20 74 68 65 20 5b 63 6f 6e 73 74 20 65 6e  th the [const en
7240: 61 62 6c 65 2d 73 73 6c 2d 74 72 61 63 65 5d 20  able-ssl-trace] 
7250: 6f 70 74 69 6f 6e 2e 20 54 68 69 73 20 63 61 6c  option. This cal
7260: 6c 62 61 63 6b 20 69 73 0a 6e 65 77 20 66 6f 72  lback is.new for
7270: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65   TclTLS 1.8. The
7280: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a   arguments are:.
7290: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66  .[list_begin def
72a0: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20  initions]..[def 
72b0: 5b 61 72 67 20 64 69 72 65 63 74 69 6f 6e 5d 5d  [arg direction]]
72c0: 0a 44 69 72 65 63 74 69 6f 6e 20 69 73 20 65 69  .Direction is ei
72d0: 74 68 65 72 20 5b 63 6f 6e 73 74 20 53 65 6e 74  ther [const Sent
72e0: 5d 20 6f 72 20 5b 63 6f 6e 73 74 20 52 65 63 65  ] or [const Rece
72f0: 69 76 65 64 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72  ived]...[def [ar
7300: 67 20 76 65 72 73 69 6f 6e 5d 5d 0a 56 65 72 73  g version]].Vers
7310: 69 6f 6e 20 69 73 20 74 68 65 20 70 72 6f 74 6f  ion is the proto
7320: 63 6f 6c 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64  col version...[d
7330: 65 66 20 5b 61 72 67 20 63 6f 6e 74 65 6e 74 5f  ef [arg content_
7340: 74 79 70 65 5d 5d 0a 43 6f 6e 74 65 6e 74 20 74  type]].Content t
7350: 79 70 65 20 69 73 20 74 68 65 20 6d 65 73 73 61  ype is the messa
7360: 67 65 20 63 6f 6e 74 65 6e 74 20 74 79 70 65 2e  ge content type.
7370: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 65 73 73  ..[def [arg mess
7380: 61 67 65 5d 5d 0a 4d 65 73 73 61 67 65 20 69 73  age]].Message is
7390: 20 6d 6f 72 65 20 69 6e 66 6f 20 66 72 6f 6d 20   more info from 
73a0: 74 68 65 20 5b 63 6f 6e 73 74 20 53 53 4c 5f 74  the [const SSL_t
73b0: 72 61 63 65 5d 20 41 50 49 2e 0a 0a 5b 6c 69 73  race] API...[lis
73c0: 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66  t_end]..[opt_def
73d0: 20 73 65 73 73 69 6f 6e 20 5b 61 72 67 20 22 63   session [arg "c
73e0: 68 61 6e 6e 65 6c 49 64 20 73 65 73 73 69 6f 6e  hannelId session
73f0: 5f 69 64 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b  _id session_tick
7400: 65 74 20 6c 69 66 65 74 69 6d 65 22 5d 5d 0a 54  et lifetime"]].T
7410: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
7420: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20  back is invoked 
7430: 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66  by the OpenSSL f
7440: 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c  unction.[fun SSL
7450: 5f 43 54 58 5f 73 65 73 73 5f 73 65 74 5f 6e 65  _CTX_sess_set_ne
7460: 77 5f 63 62 28 29 5d 20 77 68 65 6e 65 76 65 72  w_cb()] whenever
7470: 20 61 20 6e 65 77 20 73 65 73 73 69 6f 6e 20 69   a new session i
7480: 64 20 69 73 20 73 65 6e 74 20 62 79 20 74 68 65  d is sent by the
7490: 0a 73 65 72 76 65 72 20 64 75 72 69 6e 67 20 74  .server during t
74a0: 68 65 20 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65  he initial conne
74b0: 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e 64 73 68  ction and handsh
74c0: 61 6b 65 20 61 6e 64 20 61 6c 73 6f 20 64 75 72  ake and also dur
74d0: 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e 0a  ing the session.
74e0: 69 66 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  if the [option -
74f0: 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b 65 5d 20  post_handshake] 
7500: 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 20 74 6f  option is set to
7510: 20 74 72 75 65 2e 20 54 68 69 73 20 63 61 6c 6c   true. This call
7520: 62 61 63 6b 20 69 73 20 6e 65 77 20 66 6f 72 0a  back is new for.
7530: 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65 20  TclTLS 1.8. The 
7540: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a  arguments are:..
7550: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
7560: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b  nitions]..[def [
7570: 61 72 67 20 73 65 73 73 69 6f 6e 5f 69 64 5d 5d  arg session_id]]
7580: 0a 53 65 73 73 69 6f 6e 20 49 64 20 69 73 20 74  .Session Id is t
7590: 68 65 20 63 75 72 72 65 6e 74 20 73 65 73 73 69  he current sessi
75a0: 6f 6e 20 69 64 65 6e 74 69 66 69 65 72 0a 0a 5b  on identifier..[
75b0: 64 65 66 20 5b 61 72 67 20 73 65 73 73 69 6f 6e  def [arg session
75c0: 5f 74 69 63 6b 65 74 5d 5d 0a 54 69 63 6b 65 74  _ticket]].Ticket
75d0: 20 69 73 20 74 68 65 20 73 65 73 73 69 6f 6e 20   is the session 
75e0: 74 69 63 6b 65 74 20 69 6e 66 6f 0a 0a 5b 64 65  ticket info..[de
75f0: 66 20 5b 61 72 67 20 6c 69 66 65 74 69 6d 65 5d  f [arg lifetime]
7600: 5d 0a 4c 69 66 65 74 69 6d 65 20 69 73 20 74 68  ].Lifetime is th
7610: 65 20 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d  e ticket lifetim
7620: 65 20 69 6e 20 73 65 63 6f 6e 64 73 2e 0a 0a 5b  e in seconds...[
7630: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f  list_end]..[opt_
7640: 64 65 66 20 76 65 72 69 66 79 20 5b 61 72 67 20  def verify [arg 
7650: 22 63 68 61 6e 6e 65 6c 49 64 20 64 65 70 74 68  "channelId depth
7660: 20 63 65 72 74 20 73 74 61 74 75 73 20 65 72 72   cert status err
7670: 6f 72 22 5d 5d 0a 54 68 69 73 20 63 61 6c 6c 62  or"]].This callb
7680: 61 63 6b 20 77 61 73 20 6d 6f 76 65 64 20 74 6f  ack was moved to
7690: 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61   [option -valida
76a0: 74 65 63 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54 63  tecommand] in Tc
76b0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74  lTLS 1.8...[list
76c0: 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69  _end]..[subsecti
76d0: 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 20 50  on "Values for P
76e0: 61 73 73 77 6f 72 64 20 43 61 6c 6c 62 61 63 6b  assword Callback
76f0: 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b  "]..The callback
7700: 20 66 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f 6e   for the [option
7710: 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74 69   -password] opti
7720: 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79  on is invoked by
7730: 20 54 63 6c 54 4c 53 20 77 68 65 6e 65 76 65 72   TclTLS whenever
7740: 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73 0a 74   OpenSSL needs.t
7750: 6f 20 6f 62 74 61 69 6e 20 61 20 70 61 73 73 77  o obtain a passw
7760: 6f 72 64 2e 20 53 65 65 20 62 65 6c 6f 77 20 66  ord. See below f
7770: 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20  or the possible 
7780: 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73 65 64  arguments passed
7790: 20 74 6f 20 74 68 65 0a 63 61 6c 6c 62 61 63 6b   to the.callback
77a0: 20 73 63 72 69 70 74 2e 20 54 68 65 20 75 73 65   script. The use
77b0: 72 20 70 72 6f 76 69 64 65 64 20 70 61 73 73 77  r provided passw
77c0: 6f 72 64 20 69 73 20 65 78 70 65 63 74 65 64 20  ord is expected 
77d0: 74 6f 20 62 65 20 72 65 74 75 72 6e 65 64 20 62  to be returned b
77e0: 79 20 74 68 65 0a 63 61 6c 6c 62 61 63 6b 2e 0a  y the.callback..
77f0: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74  .[list_begin opt
7800: 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20  ions]..[opt_def 
7810: 70 61 73 73 77 6f 72 64 20 5b 61 72 67 20 22 72  password [arg "r
7820: 77 66 6c 61 67 20 73 69 7a 65 22 5d 5d 0a 49 6e  wflag size"]].In
7830: 76 6f 6b 65 64 20 77 68 65 6e 20 6c 6f 61 64 69  voked when loadi
7840: 6e 67 20 6f 72 20 73 74 6f 72 69 6e 67 20 61 6e  ng or storing an
7850: 20 65 6e 63 72 79 70 74 65 64 20 50 45 4d 20 63   encrypted PEM c
7860: 65 72 74 69 66 69 63 61 74 65 2e 20 54 68 65 20  ertificate. The 
7870: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a  arguments are:..
7880: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
7890: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b  nitions]..[def [
78a0: 61 72 67 20 72 77 66 6c 61 67 5d 5d 0a 54 68 65  arg rwflag]].The
78b0: 20 72 65 61 64 2f 77 72 69 74 65 20 66 6c 61 67   read/write flag
78c0: 20 69 73 20 30 20 66 6f 72 20 72 65 61 64 69 6e   is 0 for readin
78d0: 67 2f 64 65 63 72 79 70 74 69 6f 6e 20 6f 72 20  g/decryption or 
78e0: 31 20 66 6f 72 20 77 72 69 74 69 6e 67 2f 65 6e  1 for writing/en
78f0: 63 72 79 70 74 69 6f 6e 2e 0a 54 68 65 20 6c 61  cryption..The la
7900: 74 74 65 72 20 63 61 6e 20 62 65 20 75 73 65 64  tter can be used
7910: 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68   to determine wh
7920: 65 6e 20 74 6f 20 70 72 6f 6d 70 74 20 74 68 65  en to prompt the
7930: 20 75 73 65 72 20 74 6f 20 63 6f 6e 66 69 72 6d   user to confirm
7940: 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74 20  ..This argument 
7950: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
7960: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 5b 61 72  S 1.8...[def [ar
7970: 67 20 73 69 7a 65 5d 5d 0a 54 68 65 20 73 69 7a  g size]].The siz
7980: 65 20 69 73 20 74 68 65 20 6d 61 78 69 6d 75 6d  e is the maximum
7990: 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 70   length of the p
79a0: 61 73 73 77 6f 72 64 20 69 6e 20 62 79 74 65 73  assword in bytes
79b0: 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74 20  ..This argument 
79c0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
79d0: 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e  S 1.8...[list_en
79e0: 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a  d]..[list_end]..
79f0: 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56 61 6c  [subsection "Val
7a00: 75 65 73 20 66 6f 72 20 56 61 6c 69 64 61 74 65  ues for Validate
7a10: 20 43 6f 6d 6d 61 6e 64 20 43 61 6c 6c 62 61 63   Command Callbac
7a20: 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63  k"]..The callbac
7a30: 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f  k for the [optio
7a40: 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61  n -validatecomma
7a50: 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e  nd] option is in
7a60: 76 6f 6b 65 64 20 64 75 72 69 6e 67 20 74 68 65  voked during the
7a70: 20 68 61 6e 64 73 68 61 6b 65 0a 70 72 6f 63 65   handshake.proce
7a80: 73 73 20 69 6e 20 6f 72 64 65 72 20 66 6f 72 20  ss in order for 
7a90: 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20  the application 
7aa0: 74 6f 20 76 61 6c 69 64 61 74 65 20 74 68 65 20  to validate the 
7ab0: 70 72 6f 76 69 64 65 64 20 76 61 6c 75 65 28 73  provided value(s
7ac0: 29 2e 20 53 65 65 0a 62 65 6c 6f 77 20 66 6f 72  ). See.below for
7ad0: 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20 61 72   the possible ar
7ae0: 67 75 6d 65 6e 74 73 20 70 61 73 73 65 64 20 74  guments passed t
7af0: 6f 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73  o the callback s
7b00: 63 72 69 70 74 2e 20 49 66 20 6e 6f 74 0a 73 70  cript. If not.sp
7b10: 65 63 69 66 69 65 64 2c 20 4f 70 65 6e 53 53 4c  ecified, OpenSSL
7b20: 20 77 69 6c 6c 20 61 63 63 65 70 74 20 61 6c 6c   will accept all
7b30: 20 76 61 6c 69 64 20 63 65 72 74 69 66 69 63 61   valid certifica
7b40: 74 65 73 20 61 6e 64 20 65 78 74 65 6e 73 69 6f  tes and extensio
7b50: 6e 73 2e 20 54 6f 20 72 65 6a 65 63 74 0a 74 68  ns. To reject.th
7b60: 65 20 76 61 6c 75 65 20 61 6e 64 20 61 62 6f 72  e value and abor
7b70: 74 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  t the connection
7b80: 2c 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73  , the callback s
7b90: 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 30 2e 20  hould return 0. 
7ba0: 54 6f 20 61 63 63 65 70 74 20 74 68 65 0a 76 61  To accept the.va
7bb0: 6c 75 65 20 61 6e 64 20 63 6f 6e 74 69 6e 75 65  lue and continue
7bc0: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c   the connection,
7bd0: 20 69 74 20 73 68 6f 75 6c 64 20 72 65 74 75 72   it should retur
7be0: 6e 20 31 2e 20 54 6f 20 72 65 6a 65 63 74 20 74  n 1. To reject t
7bf0: 68 65 20 76 61 6c 75 65 2c 20 62 75 74 0a 63 6f  he value, but.co
7c00: 6e 74 69 6e 75 65 20 74 68 65 20 63 6f 6e 6e 65  ntinue the conne
7c10: 63 74 69 6f 6e 2c 20 69 74 20 73 68 6f 75 6c 64  ction, it should
7c20: 20 72 65 74 75 72 6e 20 32 2e 20 54 68 69 73 20   return 2. This 
7c30: 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20  callback is new 
7c40: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
7c50: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74  .[list_begin opt
7c60: 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20  ions]..[opt_def 
7c70: 61 6c 70 6e 20 5b 61 72 67 20 22 63 68 61 6e 6e  alpn [arg "chann
7c80: 65 6c 49 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 61  elId protocol ma
7c90: 74 63 68 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65  tch"]].For serve
7ca0: 72 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f 66  rs, this form of
7cb0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
7cc0: 6f 6b 65 64 20 77 68 65 6e 20 74 68 65 20 63 6c  oked when the cl
7cd0: 69 65 6e 74 20 41 4c 50 4e 20 65 78 74 65 6e 73  ient ALPN extens
7ce0: 69 6f 6e 20 69 73 0a 72 65 63 65 69 76 65 64 2e  ion is.received.
7cf0: 20 49 66 20 5b 61 72 67 20 6d 61 74 63 68 5d 20   If [arg match] 
7d00: 69 73 20 74 72 75 65 2c 20 74 68 65 6e 20 5b 61  is true, then [a
7d10: 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 20 69 73 20  rg protocol] is 
7d20: 74 68 65 20 66 69 72 73 74 0a 5b 6f 70 74 69 6f  the first.[optio
7d30: 6e 20 2d 61 6c 70 6e 5d 20 70 72 6f 74 6f 63 6f  n -alpn] protoco
7d40: 6c 20 6f 70 74 69 6f 6e 20 69 6e 20 63 6f 6d 6d  l option in comm
7d50: 6f 6e 20 74 6f 20 62 6f 74 68 20 74 68 65 20 63  on to both the c
7d60: 6c 69 65 6e 74 20 61 6e 64 20 73 65 72 76 65 72  lient and server
7d70: 2e 0a 49 66 20 6e 6f 74 2c 20 74 68 65 20 66 69  ..If not, the fi
7d80: 72 73 74 20 63 6c 69 65 6e 74 20 73 70 65 63 69  rst client speci
7d90: 66 69 65 64 20 70 72 6f 74 6f 63 6f 6c 20 69 73  fied protocol is
7da0: 20 75 73 65 64 2e 20 54 68 69 73 20 63 61 6c 6c   used. This call
7db0: 62 61 63 6b 20 69 73 20 63 61 6c 6c 65 64 0a 61  back is called.a
7dc0: 66 74 65 72 20 74 68 65 20 48 65 6c 6c 6f 20 61  fter the Hello a
7dd0: 6e 64 20 53 4e 49 20 63 61 6c 6c 62 61 63 6b 73  nd SNI callbacks
7de0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 68 65 6c 6c  ...[opt_def hell
7df0: 6f 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49  o [arg "channelI
7e00: 64 20 73 65 72 76 65 72 6e 61 6d 65 22 5d 5d 0a  d servername"]].
7e10: 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68 69  For servers, thi
7e20: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61  s form of callba
7e30: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 64 75  ck is invoked du
7e40: 72 69 6e 67 20 63 6c 69 65 6e 74 20 68 65 6c 6c  ring client hell
7e50: 6f 20 6d 65 73 73 61 67 65 0a 70 72 6f 63 65 73  o message.proces
7e60: 73 69 6e 67 2e 20 54 68 65 20 70 75 72 70 6f 73  sing. The purpos
7e70: 65 20 69 73 20 73 6f 20 74 68 65 20 73 65 72 76  e is so the serv
7e80: 65 72 20 63 61 6e 20 73 65 6c 65 63 74 20 74 68  er can select th
7e90: 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 63 65  e appropriate ce
7ea0: 72 74 69 66 69 63 61 74 65 0a 74 6f 20 70 72 65  rtificate.to pre
7eb0: 73 65 6e 74 20 74 6f 20 74 68 65 20 63 6c 69 65  sent to the clie
7ec0: 6e 74 2c 20 61 6e 64 20 74 6f 20 6d 61 6b 65 20  nt, and to make 
7ed0: 6f 74 68 65 72 20 63 6f 6e 66 69 67 75 72 61 74  other configurat
7ee0: 69 6f 6e 20 61 64 6a 75 73 74 6d 65 6e 74 73 20  ion adjustments 
7ef0: 72 65 6c 65 76 61 6e 74 0a 74 6f 20 74 68 61 74  relevant.to that
7f00: 20 73 65 72 76 65 72 20 6e 61 6d 65 20 61 6e 64   server name and
7f10: 20 69 74 73 20 63 6f 6e 66 69 67 75 72 61 74 69   its configurati
7f20: 6f 6e 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64  on. It is called
7f30: 20 62 65 66 6f 72 65 20 74 68 65 20 53 4e 49 20   before the SNI 
7f40: 61 6e 64 20 41 4c 50 4e 0a 63 61 6c 6c 62 61 63  and ALPN.callbac
7f50: 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 73 6e  ks...[opt_def sn
7f60: 69 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49  i [arg "channelI
7f70: 64 20 73 65 72 76 65 72 6e 61 6d 65 22 5d 5d 0a  d servername"]].
7f80: 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68 69  For servers, thi
7f90: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61  s form of callba
7fa0: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68  ck is invoked wh
7fb0: 65 6e 20 74 68 65 20 53 65 72 76 65 72 20 4e 61  en the Server Na
7fc0: 6d 65 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53  me Indication.(S
7fd0: 4e 49 29 20 65 78 74 65 6e 73 69 6f 6e 20 69 73  NI) extension is
7fe0: 20 72 65 63 65 69 76 65 64 2e 20 54 68 65 20 5b   received. The [
7ff0: 61 72 67 20 73 65 72 76 65 72 6e 61 6d 65 5d 20  arg servername] 
8000: 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20  argument is the 
8010: 63 6c 69 65 6e 74 0a 70 72 6f 76 69 64 65 64 20  client.provided 
8020: 73 65 72 76 65 72 20 6e 61 6d 65 20 73 70 65 63  server name spec
8030: 69 66 69 65 64 20 69 6e 20 74 68 65 20 5b 6f 70  ified in the [op
8040: 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65  tion -servername
8050: 5d 20 6f 70 74 69 6f 6e 2e 20 54 68 65 0a 70 75  ] option. The.pu
8060: 72 70 6f 73 65 20 69 73 20 73 6f 20 77 68 65 6e  rpose is so when
8070: 20 61 20 73 65 72 76 65 72 20 73 75 70 70 6f 72   a server suppor
8080: 74 73 20 6d 75 6c 74 69 70 6c 65 20 6e 61 6d 65  ts multiple name
8090: 73 2c 20 74 68 65 20 72 69 67 68 74 20 63 65 72  s, the right cer
80a0: 74 69 66 69 63 61 74 65 0a 63 61 6e 20 62 65 20  tificate.can be 
80b0: 75 73 65 64 2e 20 49 74 20 69 73 20 63 61 6c 6c  used. It is call
80c0: 65 64 20 61 66 74 65 72 20 74 68 65 20 48 65 6c  ed after the Hel
80d0: 6c 6f 20 63 61 6c 6c 62 61 63 6b 20 62 75 74 20  lo callback but 
80e0: 62 65 66 6f 72 65 20 74 68 65 20 41 4c 50 4e 0a  before the ALPN.
80f0: 63 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6f 70 74 5f  callback...[opt_
8100: 64 65 66 20 76 65 72 69 66 79 20 5b 61 72 67 20  def verify [arg 
8110: 22 63 68 61 6e 6e 65 6c 49 64 20 64 65 70 74 68  "channelId depth
8120: 20 63 65 72 74 20 73 74 61 74 75 73 20 65 72 72   cert status err
8130: 6f 72 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20  or"]].This form 
8140: 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69  of callback is i
8150: 6e 76 6f 6b 65 64 20 62 79 20 4f 70 65 6e 53 53  nvoked by OpenSS
8160: 4c 20 77 68 65 6e 20 61 20 6e 65 77 20 63 65 72  L when a new cer
8170: 74 69 66 69 63 61 74 65 20 69 73 20 72 65 63 65  tificate is rece
8180: 69 76 65 64 0a 66 72 6f 6d 20 74 68 65 20 70 65  ived.from the pe
8190: 65 72 2e 20 49 74 20 61 6c 6c 6f 77 73 20 74 68  er. It allows th
81a0: 65 20 63 6c 69 65 6e 74 20 74 6f 20 63 68 65 63  e client to chec
81b0: 6b 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  k the certificat
81c0: 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 0a 72  e verification.r
81d0: 65 73 75 6c 74 73 20 61 6e 64 20 63 68 6f 6f 73  esults and choos
81e0: 65 20 77 68 65 74 68 65 72 20 74 6f 20 63 6f 6e  e whether to con
81f0: 74 69 6e 75 65 20 6f 72 20 6e 6f 74 2e 20 49 74  tinue or not. It
8200: 20 69 73 20 63 61 6c 6c 65 64 20 66 6f 72 20 65   is called for e
8210: 61 63 68 0a 63 65 72 74 69 66 69 63 61 74 65 20  ach.certificate 
8220: 69 6e 20 74 68 65 20 63 65 72 74 69 66 69 63 61  in the certifica
8230: 74 65 20 63 68 61 69 6e 2e 20 54 68 69 73 20 63  te chain. This c
8240: 61 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65  allback was move
8250: 64 20 66 72 6f 6d 0a 5b 6f 70 74 69 6f 6e 20 2d  d from.[option -
8260: 63 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54 63 6c 54  command] in TclT
8270: 4c 53 20 31 2e 38 2e 20 54 68 65 20 61 72 67 75  LS 1.8. The argu
8280: 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73  ments are:..[lis
8290: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
82a0: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20  ons]..[def [arg 
82b0: 64 65 70 74 68 5d 5d 0a 54 68 65 20 64 65 70 74  depth]].The dept
82c0: 68 20 69 73 20 74 68 65 20 69 6e 74 65 67 65 72  h is the integer
82d0: 20 64 65 70 74 68 20 6f 66 20 74 68 65 20 63 65   depth of the ce
82e0: 72 74 69 66 69 63 61 74 65 20 69 6e 20 74 68 65  rtificate in the
82f0: 20 63 65 72 74 69 66 69 63 61 74 65 20 63 68 61   certificate cha
8300: 69 6e 2c 0a 77 68 65 72 65 20 30 20 69 73 20 74  in,.where 0 is t
8310: 68 65 20 70 65 65 72 20 63 65 72 74 69 66 69 63  he peer certific
8320: 61 74 65 20 61 6e 64 20 68 69 67 68 65 72 20 76  ate and higher v
8330: 61 6c 75 65 73 20 67 6f 69 6e 67 20 75 70 20 74  alues going up t
8340: 6f 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  o the Certificat
8350: 65 0a 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e.Authority (CA)
8360: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63 65 72  ...[def [arg cer
8370: 74 5d 5d 0a 54 68 65 20 63 65 72 74 20 61 72 67  t]].The cert arg
8380: 75 6d 65 6e 74 20 69 73 20 61 20 6c 69 73 74 20  ument is a list 
8390: 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69  of key-value pai
83a0: 72 73 20 73 69 6d 69 6c 61 72 20 74 6f 20 74 68  rs similar to th
83b0: 6f 73 65 20 72 65 74 75 72 6e 65 64 20 62 79 0a  ose returned by.
83c0: 5b 63 6d 64 20 74 6c 73 3a 3a 73 74 61 74 75 73  [cmd tls::status
83d0: 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 74  ]...[def [arg st
83e0: 61 74 75 73 5d 5d 0a 54 68 65 20 73 74 61 74 75  atus]].The statu
83f0: 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68  s argument is th
8400: 65 20 62 6f 6f 6c 65 61 6e 20 76 61 6c 69 64 69  e boolean validi
8410: 74 79 20 6f 66 20 74 68 65 20 63 75 72 72 65 6e  ty of the curren
8420: 74 20 63 65 72 74 69 66 69 63 61 74 65 20 77 68  t certificate wh
8430: 65 72 65 20 30 0a 69 73 20 69 6e 76 61 6c 69 64  ere 0.is invalid
8440: 20 61 6e 64 20 31 20 69 73 20 76 61 6c 69 64 2e   and 1 is valid.
8450: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 65 72 72 6f  ..[def [arg erro
8460: 72 5d 5d 0a 54 68 65 20 65 72 72 6f 72 20 61 72  r]].The error ar
8470: 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20 65 72  gument is the er
8480: 72 6f 72 20 6d 65 73 73 61 67 65 2c 20 69 66 20  ror message, if 
8490: 61 6e 79 2c 20 67 65 6e 65 72 61 74 65 64 20 62  any, generated b
84a0: 79 0a 5b 66 75 6e 20 58 35 30 39 5f 53 54 4f 52  y.[fun X509_STOR
84b0: 45 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28  E_CTX_get_error(
84c0: 29 5d 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  )]...[list_end].
84d0: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 52 65 66  .[list_end]..Ref
84e0: 65 72 65 6e 63 65 20 69 6d 70 6c 65 6d 65 6e 74  erence implement
84f0: 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 73 65 20  ations of these 
8500: 63 61 6c 6c 62 61 63 6b 73 20 61 72 65 20 70 72  callbacks are pr
8510: 6f 76 69 64 65 64 20 69 6e 20 5b 66 69 6c 65 20  ovided in [file 
8520: 74 6c 73 2e 74 63 6c 5d 0a 61 73 20 5b 63 6d 64  tls.tcl].as [cmd
8530: 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c   tls::callback],
8540: 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77   [cmd tls::passw
8550: 6f 72 64 5d 2c 20 61 6e 64 20 5b 63 6d 64 20 74  ord], and [cmd t
8560: 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d  ls::validate_com
8570: 6d 61 6e 64 5d 0a 72 65 73 70 65 63 74 69 76 65  mand].respective
8580: 6c 79 2e 20 4e 6f 74 65 20 74 68 61 74 20 74 68  ly. Note that th
8590: 65 73 65 20 61 72 65 20 6f 6e 6c 79 20 5b 65 6d  ese are only [em
85a0: 70 68 20 73 61 6d 70 6c 65 5d 20 69 6d 70 6c 65  ph sample] imple
85b0: 6d 65 6e 74 61 74 69 6f 6e 73 2e 20 49 6e 20 61  mentations. In a
85c0: 20 6d 6f 72 65 0a 72 65 61 6c 69 73 74 69 63 20   more.realistic 
85d0: 64 65 70 6c 6f 79 6d 65 6e 74 20 79 6f 75 20 77  deployment you w
85e0: 6f 75 6c 64 20 73 70 65 63 69 66 79 20 79 6f 75  ould specify you
85f0: 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 20 73  r own callback s
8600: 63 72 69 70 74 73 20 6f 6e 20 65 61 63 68 20 54  cripts on each T
8610: 4c 53 0a 63 68 61 6e 6e 65 6c 20 75 73 69 6e 67  LS.channel using
8620: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f   the [option -co
8630: 6d 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20  mmand], [option 
8640: 2d 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a  -password], and.
8650: 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74  [option -validat
8660: 65 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f  e_command] optio
8670: 6e 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68 65  ns...[para]..The
8680: 20 64 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f   default behavio
8690: 72 20 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69  r when the [opti
86a0: 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 61 6e 64  on -command] and
86b0: 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61   [option -valida
86c0: 74 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69  te_command].opti
86d0: 6f 6e 73 20 61 72 65 20 6e 6f 74 20 73 70 65 63  ons are not spec
86e0: 69 66 69 65 64 2c 20 69 73 20 66 6f 72 20 54 63  ified, is for Tc
86f0: 6c 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20  lTLS to process 
8700: 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c  the associated l
8710: 69 62 72 61 72 79 0a 63 61 6c 6c 62 61 63 6b 73  ibrary.callbacks
8720: 20 69 6e 74 65 72 6e 61 6c 6c 79 2e 20 54 68 65   internally. The
8730: 20 64 65 66 61 75 6c 74 20 62 65 68 61 76 69 6f   default behavio
8740: 72 20 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69  r when the [opti
8750: 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70  on -password] op
8760: 74 69 6f 6e 0a 69 73 20 6e 6f 74 20 73 70 65 63  tion.is not spec
8770: 69 66 69 65 64 20 69 73 20 66 6f 72 20 54 63 6c  ified is for Tcl
8780: 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74  TLS to process t
8790: 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69  he associated li
87a0: 62 72 61 72 79 20 63 61 6c 6c 62 61 63 6b 73 20  brary callbacks 
87b0: 62 79 0a 61 74 74 65 6d 70 74 69 6e 67 20 74 6f  by.attempting to
87c0: 20 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a   call [cmd tls::
87d0: 70 61 73 73 77 6f 72 64 5d 2e 20 54 68 65 20 64  password]. The d
87e0: 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65  ifference betwee
87f0: 6e 20 74 68 65 73 65 20 74 77 6f 0a 62 65 68 61  n these two.beha
8800: 76 69 6f 72 73 20 69 73 20 61 20 63 6f 6e 73 65  viors is a conse
8810: 71 75 65 6e 63 65 20 6f 66 20 6d 61 69 6e 74 61  quence of mainta
8820: 69 6e 69 6e 67 20 63 6f 6d 70 61 74 69 62 69 6c  ining compatibil
8830: 69 74 79 20 77 69 74 68 20 65 61 72 6c 69 65 72  ity with earlier
8840: 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73  .implementations
8850: 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70 68  ...[para]..[emph
8860: 20 22 54 68 65 20 75 73 65 20 6f 66 20 74 68 65   "The use of the
8870: 20 72 65 66 65 72 65 6e 63 65 20 63 61 6c 6c 62   reference callb
8880: 61 63 6b 73 20 5b 63 6d 64 20 74 6c 73 3a 3a 63  acks [cmd tls::c
8890: 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74  allback], [cmd t
88a0: 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 0a 61  ls::password],.a
88b0: 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c  nd [cmd tls::val
88c0: 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 69  idate_command] i
88d0: 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65  s not recommende
88e0: 64 2e 20 54 68 65 79 20 6d 61 79 20 62 65 20 72  d. They may be r
88f0: 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75 74 75  emoved from futu
8900: 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a 0a  re releases."]..
8910: 5b 73 65 63 74 69 6f 6e 20 44 65 62 75 67 5d 0a  [section Debug].
8920: 0a 46 6f 72 20 6d 6f 73 74 20 64 65 62 75 67 67  .For most debugg
8930: 69 6e 67 20 6e 65 65 64 73 2c 20 74 68 65 20 5b  ing needs, the [
8940: 6f 70 74 69 6f 6e 20 2d 63 61 6c 6c 62 61 63 6b  option -callback
8950: 5d 20 6f 70 74 69 6f 6e 20 63 61 6e 20 62 65 20  ] option can be 
8960: 75 73 65 64 20 74 6f 20 70 72 6f 76 69 64 65 0a  used to provide.
8970: 73 75 66 66 69 63 69 65 6e 74 20 69 6e 73 69 67  sufficient insig
8980: 68 74 20 61 6e 64 20 69 6e 66 6f 72 6d 61 74 69  ht and informati
8990: 6f 6e 20 6f 6e 20 74 68 65 20 54 4c 53 20 68 61  on on the TLS ha
89a0: 6e 64 73 68 61 6b 65 20 61 6e 64 20 70 72 6f 67  ndshake and prog
89b0: 72 65 73 73 2e 20 49 66 0a 66 75 72 74 68 65 72  ress. If.further
89c0: 20 74 72 6f 75 62 6c 65 73 68 6f 6f 74 69 6e 67   troubleshooting
89d0: 20 69 6e 73 69 67 68 74 20 69 73 20 6e 65 65 64   insight is need
89e0: 65 64 2c 20 74 68 65 20 63 6f 6d 70 69 6c 65 20  ed, the compile 
89f0: 74 69 6d 65 20 6f 70 74 69 6f 6e 0a 5b 6f 70 74  time option.[opt
8a00: 69 6f 6e 20 2d 2d 65 6e 61 62 6c 65 2d 64 65 62  ion --enable-deb
8a10: 75 67 5d 20 63 61 6e 20 62 65 20 75 73 65 64 20  ug] can be used 
8a20: 74 6f 20 67 65 74 20 64 65 74 61 69 6c 65 64 20  to get detailed 
8a30: 65 78 65 63 75 74 69 6f 6e 20 66 6c 6f 77 20 73  execution flow s
8a40: 74 61 74 75 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a  tatus...[para]..
8a50: 54 4c 53 20 6b 65 79 20 6c 6f 67 67 69 6e 67 20  TLS key logging 
8a60: 63 61 6e 20 62 65 20 65 6e 61 62 6c 65 64 20 62  can be enabled b
8a70: 79 20 73 65 74 74 69 6e 67 20 74 68 65 20 65 6e  y setting the en
8a80: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62  vironment variab
8a90: 6c 65 0a 5b 76 61 72 20 53 53 4c 4b 45 59 4c 4f  le.[var SSLKEYLO
8aa0: 47 46 49 4c 45 5d 20 74 6f 20 74 68 65 20 6e 61  GFILE] to the na
8ab0: 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65 20 74  me of the file t
8ac0: 6f 20 6c 6f 67 20 74 6f 2e 20 54 68 65 6e 20 77  o log to. Then w
8ad0: 68 65 6e 65 76 65 72 20 54 4c 53 20 6b 65 79 0a  henever TLS key.
8ae0: 6d 61 74 65 72 69 61 6c 20 69 73 20 67 65 6e 65  material is gene
8af0: 72 61 74 65 64 20 6f 72 20 72 65 63 65 69 76 65  rated or receive
8b00: 64 20 69 74 20 77 69 6c 6c 20 62 65 20 6c 6f 67  d it will be log
8b10: 67 65 64 20 74 6f 20 74 68 65 20 66 69 6c 65 2e  ged to the file.
8b20: 20 54 68 69 73 20 69 73 20 75 73 65 66 75 6c 0a   This is useful.
8b30: 66 6f 72 20 6c 6f 67 67 69 6e 67 20 6b 65 79 20  for logging key 
8b40: 64 61 74 61 20 66 6f 72 20 6e 65 74 77 6f 72 6b  data for network
8b50: 20 6c 6f 67 67 69 6e 67 20 74 6f 6f 6c 73 20 74   logging tools t
8b60: 6f 20 75 73 65 20 74 6f 20 64 65 63 72 79 70 74  o use to decrypt
8b70: 20 74 68 65 20 64 61 74 61 2e 0a 0a 5b 70 61 72   the data...[par
8b80: 61 5d 0a 0a 54 68 65 20 5b 76 61 72 20 74 6c 73  a]..The [var tls
8b90: 3a 3a 64 65 62 75 67 5d 20 76 61 72 69 61 62 6c  ::debug] variabl
8ba0: 65 20 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20  e provides some 
8bb0: 61 64 64 69 74 69 6f 6e 61 6c 20 63 6f 6e 74 72  additional contr
8bc0: 6f 6c 20 6f 76 65 72 20 74 68 65 0a 64 65 62 75  ol over the.debu
8bd0: 67 20 6c 6f 67 67 69 6e 67 20 69 6e 20 74 68 65  g logging in the
8be0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62   [cmd tls::callb
8bf0: 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a  ack], [cmd tls::
8c00: 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b  password], and.[
8c10: 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74  cmd tls::validat
8c20: 65 5f 63 6f 6d 6d 61 6e 64 5d 20 64 65 66 61 75  e_command] defau
8c30: 6c 74 20 68 61 6e 64 6c 65 72 73 20 69 6e 20 5b  lt handlers in [
8c40: 66 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 2e 0a 54  file tls.tcl]..T
8c50: 68 65 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65  he default value
8c60: 20 69 73 20 30 20 77 69 74 68 20 68 69 67 68 65   is 0 with highe
8c70: 72 20 76 61 6c 75 65 73 20 70 72 6f 64 75 63 69  r values produci
8c80: 6e 67 20 6d 6f 72 65 20 64 69 61 67 6e 6f 73 74  ng more diagnost
8c90: 69 63 20 6f 75 74 70 75 74 2c 0a 61 6e 64 20 77  ic output,.and w
8ca0: 69 6c 6c 20 61 6c 73 6f 20 66 6f 72 63 65 20 74  ill also force t
8cb0: 68 65 20 76 65 72 69 66 79 20 6d 65 74 68 6f 64  he verify method
8cc0: 20 69 6e 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61   in [cmd tls::ca
8cd0: 6c 6c 62 61 63 6b 5d 20 74 6f 20 61 63 63 65 70  llback] to accep
8ce0: 74 20 74 68 65 0a 63 65 72 74 69 66 69 63 61 74  t the.certificat
8cf0: 65 2c 20 65 76 65 6e 20 69 66 20 69 74 20 69 73  e, even if it is
8d00: 20 69 6e 76 61 6c 69 64 20 77 68 65 6e 20 74 68   invalid when th
8d10: 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64  e [option -valid
8d20: 61 74 65 63 6f 6d 6d 61 6e 64 5d 0a 6f 70 74 69  atecommand].opti
8d30: 6f 6e 20 69 73 20 73 65 74 20 74 6f 20 5b 63 6d  on is set to [cm
8d40: 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f  d tls::validate_
8d50: 63 6f 6d 6d 61 6e 64 5d 2e 0a 0a 5b 70 61 72 61  command]...[para
8d60: 5d 0a 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73  ]..[emph "The us
8d70: 65 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c  e of the variabl
8d80: 65 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62 75  e [var tls::debu
8d90: 67 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d  g] is not recomm
8da0: 65 6e 64 65 64 2e 0a 49 74 20 6d 61 79 20 62 65  ended..It may be
8db0: 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75   removed from fu
8dc0: 74 75 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d  ture releases."]
8dd0: 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 45 78 61 6d  ..[section "Exam
8de0: 70 6c 65 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c  ples"]..The foll
8df0: 6f 77 69 6e 67 20 61 72 65 20 65 78 61 6d 70 6c  owing are exampl
8e00: 65 20 73 63 72 69 70 74 73 20 74 6f 20 64 6f 77  e scripts to dow
8e10: 6e 6c 6f 61 64 20 61 20 77 65 62 70 61 67 65 20  nload a webpage 
8e20: 61 6e 64 20 66 69 6c 65 20 75 73 69 6e 67 20 74  and file using t
8e30: 68 65 0a 68 74 74 70 20 70 61 63 6b 61 67 65 2e  he.http package.
8e40: 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43   See [sectref "C
8e50: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
8e60: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 77 68 65 6e  ation"] for when
8e70: 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61   the.[option -ca
8e80: 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63  dir], [option -c
8e90: 61 66 69 6c 65 5d 2c 20 61 6e 64 20 5b 6f 70 74  afile], and [opt
8ea0: 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70  ion -castore] op
8eb0: 74 69 6f 6e 73 20 61 72 65 20 61 6c 73 6f 0a 6e  tions are also.n
8ec0: 65 65 64 65 64 2e 20 53 65 65 20 74 68 65 20 5b  eeded. See the [
8ed0: 66 69 6c 65 20 64 65 6d 6f 73 5d 20 64 69 72 65  file demos] dire
8ee0: 63 74 6f 72 79 20 66 6f 72 20 6d 6f 72 65 20 65  ctory for more e
8ef0: 78 61 6d 70 6c 65 20 73 63 72 69 70 74 73 2e 0a  xample scripts..
8f00: 0a 5b 70 61 72 61 5d 0a 0a 45 78 61 6d 70 6c 65  .[para]..Example
8f10: 20 23 31 3a 20 44 6f 77 6e 6c 6f 61 64 20 61 20   #1: Download a 
8f20: 77 65 62 20 70 61 67 65 0a 0a 5b 65 78 61 6d 70  web page..[examp
8f30: 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65  le {..package re
8f40: 71 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61  quire http.packa
8f50: 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a  ge require tls..
8f60: 73 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f  set url "https:/
8f70: 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a 68 74  /www.tcl.tk/".ht
8f80: 74 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74  tp::register htt
8f90: 70 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74  ps 443 [list ::t
8fa0: 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f  ls::socket -auto
8fb0: 73 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 72 65  servername 1 -re
8fc0: 71 75 69 72 65 20 31 5d 0a 0a 23 20 47 65 74 20  quire 1]..# Get 
8fd0: 55 52 4c 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 68  URL.set token [h
8fe0: 74 74 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c  ttp::geturl $url
8ff0: 5d 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20 65  ]..# Check for e
9000: 72 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a 3a  rror.if {[http::
9010: 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e  status $token] n
9020: 65 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75  e "ok"} {.    pu
9030: 74 73 20 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f  ts [format "Erro
9040: 72 20 25 73 22 20 5b 68 74 74 70 3a 3a 73 74 61  r %s" [http::sta
9050: 74 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a  tus $token]].}..
9060: 23 20 53 61 76 65 20 77 65 62 20 70 61 67 65 20  # Save web page 
9070: 74 6f 20 66 69 6c 65 0a 73 65 74 20 63 68 20 5b  to file.set ch [
9080: 6f 70 65 6e 20 65 78 61 6d 70 6c 65 2e 68 74 6d  open example.htm
9090: 6c 20 77 62 5d 0a 70 75 74 73 20 24 63 68 20 5b  l wb].puts $ch [
90a0: 68 74 74 70 3a 3a 64 61 74 61 20 24 74 6f 6b 65  http::data $toke
90b0: 6e 5d 0a 63 6c 6f 73 65 20 24 63 68 0a 0a 23 20  n].close $ch..# 
90c0: 43 6c 65 61 6e 75 70 0a 3a 3a 68 74 74 70 3a 3a  Cleanup.::http::
90d0: 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d  cleanup $token.}
90e0: 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 32 3a 20 44  ]..Example #2: D
90f0: 6f 77 6e 6c 6f 61 64 20 61 20 66 69 6c 65 0a 0a  ownload a file..
9100: 5b 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b  [example {..pack
9110: 61 67 65 20 72 65 71 75 69 72 65 20 68 74 74 70  age require http
9120: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
9130: 20 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 68   tls..set url "h
9140: 74 74 70 73 3a 2f 2f 77 69 6b 69 2e 74 63 6c 2d  ttps://wiki.tcl-
9150: 6c 61 6e 67 2e 6f 72 67 2f 73 69 74 65 6d 61 70  lang.org/sitemap
9160: 2e 78 6d 6c 22 0a 68 74 74 70 3a 3a 72 65 67 69  .xml".http::regi
9170: 73 74 65 72 20 68 74 74 70 73 20 34 34 33 20 5b  ster https 443 [
9180: 6c 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b  list ::tls::sock
9190: 65 74 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61  et -autoserverna
91a0: 6d 65 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d  me 1 -require 1]
91b0: 0a 0a 23 20 4f 70 65 6e 20 6f 75 74 70 75 74 20  ..# Open output 
91c0: 66 69 6c 65 0a 73 65 74 20 66 69 6c 65 6e 61 6d  file.set filenam
91d0: 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 75 72  e [file tail $ur
91e0: 6c 5d 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20  l].set ch [open 
91f0: 24 66 69 6c 65 6e 61 6d 65 20 77 62 5d 0a 0a 23  $filename wb]..#
9200: 20 47 65 74 20 66 69 6c 65 0a 73 65 74 20 74 6f   Get file.set to
9210: 6b 65 6e 20 5b 3a 3a 68 74 74 70 3a 3a 67 65 74  ken [::http::get
9220: 75 72 6c 20 24 75 72 6c 20 2d 62 6c 6f 63 6b 73  url $url -blocks
9230: 69 7a 65 20 36 35 35 33 36 20 2d 63 68 61 6e 6e  ize 65536 -chann
9240: 65 6c 20 24 63 68 5d 0a 0a 23 20 43 68 65 63 6b  el $ch]..# Check
9250: 20 66 6f 72 20 65 72 72 6f 72 0a 69 66 20 7b 5b   for error.if {[
9260: 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f  http::status $to
9270: 6b 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a  ken] ne "ok"} {.
9280: 20 20 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 74      puts [format
9290: 20 22 45 72 72 6f 72 20 25 73 22 20 5b 68 74 74   "Error %s" [htt
92a0: 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e  p::status $token
92b0: 5d 5d 0a 7d 0a 0a 23 20 43 6c 65 61 6e 75 70 0a  ]].}..# Cleanup.
92c0: 63 6c 6f 73 65 20 24 63 68 0a 3a 3a 68 74 74 70  close $ch.::http
92d0: 3a 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e  ::cleanup $token
92e0: 0a 7d 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 53  .}]..[section "S
92f0: 70 65 63 69 61 6c 20 43 6f 6e 73 69 64 65 72 61  pecial Considera
9300: 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 63 61 70  tions"]..The cap
9310: 61 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69  abilities of thi
9320: 73 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61  s package can va
9330: 72 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61  ry enormously ba
9340: 73 65 64 20 75 70 6f 6e 20 68 6f 77 20 74 68 65  sed upon how the
9350: 0a 6c 69 6e 6b 65 64 20 74 6f 20 4f 70 65 6e 53  .linked to OpenS
9360: 53 4c 20 6c 69 62 72 61 72 79 20 77 61 73 20 63  SL library was c
9370: 6f 6e 66 69 67 75 72 65 64 20 61 6e 64 20 62 75  onfigured and bu
9380: 69 6c 74 2e 20 4e 65 77 20 76 65 72 73 69 6f 6e  ilt. New version
9390: 73 20 6d 61 79 20 6f 62 73 6f 6c 65 74 65 0a 6f  s may obsolete.o
93a0: 6c 64 65 72 20 70 72 6f 74 6f 63 6f 6c 20 76 65  lder protocol ve
93b0: 72 73 69 6f 6e 73 2c 20 61 64 64 20 6f 72 20 72  rsions, add or r
93c0: 65 6d 6f 76 65 20 63 69 70 68 65 72 73 2c 20 63  emove ciphers, c
93d0: 68 61 6e 67 65 20 64 65 66 61 75 6c 74 20 76 61  hange default va
93e0: 6c 75 65 73 2c 20 65 74 63 2e 0a 55 73 65 20 74  lues, etc..Use t
93f0: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f  he [cmd tls::pro
9400: 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20  tocols] command 
9410: 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 73 75  to obtain the su
9420: 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f 6c  pported.protocol
9430: 20 76 65 72 73 69 6f 6e 73 2e 0a 0a 5b 6d 61 6e   versions...[man
9440: 70 61 67 65 5f 65 6e 64 5d 0a                    page_end].