Hex Artifact Content

Artifact 80320c1989bf2751ca16a3a5f39498bd164847ea3a4e2c768d63500015669024:


0000: 5b 63 6f 6d 6d 65 6e 74 20 7b 2d 2a 2d 20 74 63  [comment {-*- tc
0010: 6c 20 2d 2a 2d 20 64 6f 63 74 6f 6f 6c 73 20 6d  l -*- doctools m
0020: 61 6e 70 61 67 65 7d 5d 0a 5b 63 6f 6d 6d 65 6e  anpage}].[commen
0030: 74 20 7b 54 6f 20 63 6f 6e 76 65 72 74 20 74 68  t {To convert th
0040: 69 73 20 74 6f 20 61 6e 6f 74 68 65 72 20 64 6f  is to another do
0050: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 6d  cumentation form
0060: 61 74 20 75 73 65 20 74 68 65 20 64 74 70 6c 69  at use the dtpli
0070: 74 65 0a 20 20 20 20 20 20 20 20 20 20 73 63 72  te.          scr
0080: 69 70 74 20 66 72 6f 6d 20 74 63 6c 6c 69 62 3a  ipt from tcllib:
0090: 20 64 74 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e   dtplite -o tls.
00a0: 6e 20 6e 72 6f 66 66 20 74 6c 73 2e 6d 61 6e 0a  n nroff tls.man.
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 74                dt
00d0: 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e 68 74 6d  plite -o tls.htm
00e0: 6c 20 68 74 6d 6c 20 74 6c 73 2e 6d 61 6e 0a 7d  l html tls.man.}
00f0: 5d 0a 5b 6d 61 6e 70 61 67 65 5f 62 65 67 69 6e  ].[manpage_begin
0100: 20 74 6c 73 20 6e 20 32 2e 30 62 31 5d 0a 5b 63   tls n 2.0b1].[c
0110: 61 74 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f  ategory tls].[co
0120: 70 79 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61  pyright {1999 Ma
0130: 74 74 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70  tt Newman}].[cop
0140: 79 72 69 67 68 74 20 7b 32 30 30 34 20 53 74 61  yright {2004 Sta
0150: 72 66 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a  rfish Systems}].
0160: 5b 63 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34  [copyright {2024
0170: 20 42 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d   Brian O'Hagan}]
0180: 0a 5b 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49  .[keywords tls I
0190: 2f 4f 20 22 49 50 20 41 64 64 72 65 73 73 22 20  /O "IP Address" 
01a0: 4f 70 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20  OpenSSL SSL TCP 
01b0: 54 4c 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75  TLS "asynchronou
01c0: 73 20 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74  s I/O" bind cert
01d0: 69 66 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20  ificate channel 
01e0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61  connection "doma
01f0: 69 6e 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68  in name" host "h
0200: 74 74 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61  ttps" "network a
0210: 64 64 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20  ddress" network 
0220: 73 6f 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b  socket TclTLS].[
0230: 6d 6f 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53  moddesc {Tcl TLS
0240: 20 65 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65   extension}].[se
0250: 65 5f 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b  e_also http sock
0260: 65 74 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f  et [uri https://
0270: 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f  www.openssl.org/
0280: 20 4f 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c   OpenSSL]].[titl
0290: 65 64 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74  edesc {binding t
02a0: 6f 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69  o the OpenSSL li
02b0: 62 72 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70  brary for encryp
02c0: 74 65 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49  ted socket and I
02d0: 2f 4f 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75  /O channel commu
02e0: 6e 69 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71  nications}].[req
02f0: 75 69 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b  uire Tcl 8.5-].[
0300: 72 65 71 75 69 72 65 20 74 6c 73 20 32 2e 30 62  require tls 2.0b
0310: 31 5d 0a 5b 64 65 73 63 72 69 70 74 69 6f 6e 5d  1].[description]
0320: 0a 0a 54 68 69 73 20 65 78 74 65 6e 73 69 6f 6e  ..This extension
0330: 20 70 72 6f 76 69 64 65 73 20 54 43 4c 20 73 63   provides TCL sc
0340: 72 69 70 74 20 61 63 63 65 73 73 20 74 6f 20 73  ript access to s
0350: 65 63 75 72 65 20 73 6f 63 6b 65 74 20 63 6f 6d  ecure socket com
0360: 6d 75 6e 69 63 61 74 69 6f 6e 73 0a 75 73 69 6e  munications.usin
0370: 67 20 74 68 65 20 54 72 61 6e 73 70 6f 72 74 20  g the Transport 
0380: 4c 61 79 65 72 20 53 65 63 75 72 69 74 79 20 28  Layer Security (
0390: 54 4c 53 29 20 70 72 6f 74 6f 63 6f 6c 2e 20 49  TLS) protocol. I
03a0: 74 20 70 72 6f 76 69 64 65 73 20 61 20 67 65 6e  t provides a gen
03b0: 65 72 69 63 0a 62 69 6e 64 69 6e 67 20 74 6f 20  eric.binding to 
03c0: 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 77 77  [uri "https://ww
03d0: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 20  w.openssl.org/" 
03e0: 4f 70 65 6e 53 53 4c 5d 2c 20 75 74 69 6c 69 7a  OpenSSL], utiliz
03f0: 69 6e 67 20 74 68 65 0a 5b 73 79 73 63 6d 64 20  ing the.[syscmd 
0400: 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e 65 6c  Tcl_StackChannel
0410: 5d 20 41 50 49 20 69 6e 20 54 43 4c 20 38 2e 34  ] API in TCL 8.4
0420: 20 61 6e 64 20 68 69 67 68 65 72 2e 0a 54 68 65   and higher..The
0430: 73 65 20 73 6f 63 6b 65 74 73 20 62 65 68 61 76  se sockets behav
0440: 65 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 61  e exactly the sa
0450: 6d 65 20 61 73 20 63 68 61 6e 6e 65 6c 73 20 63  me as channels c
0460: 72 65 61 74 65 64 20 75 73 69 6e 67 20 74 68 65  reated using the
0470: 20 62 75 69 6c 74 2d 69 6e 0a 5b 73 79 73 63 6d   built-in.[syscm
0480: 64 20 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e  d socket] comman
0490: 64 2c 20 61 6c 6f 6e 67 20 77 69 74 68 20 61 64  d, along with ad
04a0: 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 73  ditional options
04b0: 20 66 6f 72 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67   for controlling
04c0: 0a 74 68 65 20 53 53 4c 2f 54 4c 53 20 73 65 73  .the SSL/TLS ses
04d0: 73 69 6f 6e 2e 0a 0a 5b 73 65 63 74 69 6f 6e 20  sion...[section 
04e0: 43 6f 6d 6d 61 6e 64 73 5d 0a 0a 54 79 70 69 63  Commands]..Typic
04f0: 61 6c 6c 79 20 6f 6e 65 20 77 6f 75 6c 64 20 75  ally one would u
0500: 73 65 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a  se the [cmd tls:
0510: 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64  :socket] command
0520: 20 74 6f 20 63 72 65 61 74 65 20 61 20 6e 65 77   to create a new
0530: 20 65 6e 63 72 79 70 74 65 64 0a 54 43 50 20 73   encrypted.TCP s
0540: 6f 63 6b 65 74 2e 20 49 74 20 69 73 20 63 6f 6d  ocket. It is com
0550: 70 61 74 69 62 6c 65 20 77 69 74 68 20 74 68 65  patible with the
0560: 20 6e 61 74 69 76 65 20 54 43 4c 20 5b 73 79 73   native TCL [sys
0570: 63 6d 64 20 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f  cmd ::socket] co
0580: 6d 6d 61 6e 64 2e 0a 41 6c 74 65 72 6e 61 74 69  mmand..Alternati
0590: 76 65 6c 79 20 66 6f 72 20 61 6e 20 65 78 69 73  vely for an exis
05a0: 74 69 6e 67 20 54 43 50 20 73 6f 63 6b 65 74 2c  ting TCP socket,
05b0: 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 69   the [cmd tls::i
05c0: 6d 70 6f 72 74 5d 20 63 6f 6d 6d 61 6e 64 20 63  mport] command c
05d0: 61 6e 20 62 65 0a 75 73 65 64 20 74 6f 20 73 74  an be.used to st
05e0: 61 72 74 20 54 4c 53 20 6f 6e 20 74 68 65 20 63  art TLS on the c
05f0: 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 6c 69 73  onnection...[lis
0600: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
0610: 6f 6e 73 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  ons]..[call [cmd
0620: 20 74 6c 73 3a 3a 69 6e 69 74 5d 20 5b 6f 70 74   tls::init] [opt
0630: 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20   [arg -option]] 
0640: 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75 65 5d  [opt [arg value]
0650: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70  ] [opt [arg "-op
0660: 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d  tion value ..."]
0670: 5d 5d 0a 0a 4f 70 74 69 6f 6e 61 6c 20 66 75 6e  ]]..Optional fun
0680: 63 74 69 6f 6e 20 74 6f 20 73 65 74 20 74 68 65  ction to set the
0690: 20 64 65 66 61 75 6c 74 20 6f 70 74 69 6f 6e 73   default options
06a0: 20 75 73 65 64 20 62 79 20 5b 63 6d 64 20 74 6c   used by [cmd tl
06b0: 73 3a 3a 73 6f 63 6b 65 74 5d 2e 20 49 66 20 79  s::socket]. If y
06c0: 6f 75 0a 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73  ou.call [cmd tls
06d0: 3a 3a 69 6d 70 6f 72 74 5d 20 64 69 72 65 63 74  ::import] direct
06e0: 6c 79 2c 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64  ly, this command
06f0: 20 68 61 73 20 6e 6f 20 65 66 66 65 63 74 2e 20   has no effect. 
0700: 54 68 69 73 20 63 6f 6d 6d 61 6e 64 0a 73 75 70  This command.sup
0710: 70 6f 72 74 73 20 61 6c 6c 20 6f 66 20 74 68 65  ports all of the
0720: 20 73 61 6d 65 20 6f 70 74 69 6f 6e 73 20 61 73   same options as
0730: 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 73   the [cmd tls::s
0740: 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20  ocket] command, 
0750: 74 68 6f 75 67 68 20 79 6f 75 0a 73 68 6f 75 6c  though you.shoul
0760: 64 20 6c 69 6d 69 74 20 79 6f 75 72 20 6f 70 74  d limit your opt
0770: 69 6f 6e 73 20 74 6f 20 6f 6e 6c 79 20 54 4c 53  ions to only TLS
0780: 20 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 0a 0a   related ones...
0790: 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a  [call [cmd tls::
07a0: 73 6f 63 6b 65 74 5d 20 5b 6f 70 74 20 5b 61 72  socket] [opt [ar
07b0: 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74  g -option]] [opt
07c0: 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f   [arg value]] [o
07d0: 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e  pt [arg "-option
07e0: 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61   value ..."]] [a
07f0: 72 67 20 68 6f 73 74 5d 20 5b 61 72 67 20 70 6f  rg host] [arg po
0800: 72 74 5d 5d 0a 0a 54 68 69 73 20 69 73 20 61 20  rt]]..This is a 
0810: 68 65 6c 70 65 72 20 66 75 6e 63 74 69 6f 6e 20  helper function 
0820: 74 68 61 74 20 75 74 69 6c 69 7a 65 73 20 74 68  that utilizes th
0830: 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 63 6f 6d  e underlying com
0840: 6d 61 6e 64 73 20 5b 73 79 73 63 6d 64 20 73 6f  mands [syscmd so
0850: 63 6b 65 74 5d 0a 61 6e 64 20 5b 63 6d 64 20 74  cket].and [cmd t
0860: 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20 74 6f 20 63  ls::import] to c
0870: 72 65 61 74 65 20 74 68 65 20 63 6f 6e 6e 65 63  reate the connec
0880: 74 69 6f 6e 2e 20 49 74 20 62 65 68 61 76 65 73  tion. It behaves
0890: 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65   the same as the
08a0: 0a 6e 61 74 69 76 65 20 54 43 4c 20 5b 73 79 73  .native TCL [sys
08b0: 63 6d 64 20 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d  cmd socket] comm
08c0: 61 6e 64 2c 20 62 75 74 20 61 6c 73 6f 20 73 75  and, but also su
08d0: 70 70 6f 72 74 73 20 74 68 65 20 5b 63 6d 64 20  pports the [cmd 
08e0: 74 6c 73 3a 69 6d 70 6f 72 74 5d 0a 63 6f 6d 6d  tls:import].comm
08f0: 61 6e 64 20 6f 70 74 69 6f 6e 73 20 77 69 74 68  and options with
0900: 20 6f 6e 65 20 61 64 64 69 74 69 6f 6e 61 6c 20   one additional 
0910: 6f 70 74 69 6f 6e 2e 20 49 74 20 72 65 74 75 72  option. It retur
0920: 6e 73 20 74 68 65 20 63 68 61 6e 6e 65 6c 20 68  ns the channel h
0930: 61 6e 64 6c 65 20 69 64 0a 66 6f 72 20 74 68 65  andle id.for the
0940: 20 6e 65 77 20 73 6f 63 6b 65 74 2e 0a 0a 5b 6c   new socket...[l
0950: 69 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e  ist_begin option
0960: 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 75  s]..[opt_def -au
0970: 74 6f 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72  toservername [ar
0980: 67 20 62 6f 6f 6c 5d 5d 0a 49 66 20 5b 63 6f 6e  g bool]].If [con
0990: 73 74 20 74 72 75 65 5d 2c 20 61 75 74 6f 6d 61  st true], automa
09a0: 74 69 63 61 6c 6c 79 20 73 65 74 20 74 68 65 20  tically set the 
09b0: 5b 6f 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e  [option -servern
09c0: 61 6d 65 5d 20 61 72 67 75 6d 65 6e 74 20 74 6f  ame] argument to
09d0: 20 74 68 65 0a 5b 65 6d 70 68 20 68 6f 73 74 5d   the.[emph host]
09e0: 20 61 72 67 75 6d 65 6e 74 2e 20 50 72 69 6f 72   argument. Prior
09f0: 20 74 6f 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20   to TclTLS 2.0, 
0a00: 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  the default is [
0a10: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 53 74  const false]..St
0a20: 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53  arting in TclTLS
0a30: 20 32 2e 30 2c 20 74 68 65 20 64 65 66 61 75 6c   2.0, the defaul
0a40: 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65  t is [const true
0a50: 5d 20 75 6e 6c 65 73 73 20 5b 6f 70 74 69 6f 6e  ] unless [option
0a60: 20 2d 73 65 72 76 65 72 6e 61 6d 65 5d 0a 69 73   -servername].is
0a70: 20 61 6c 73 6f 20 73 70 65 63 69 66 69 65 64 2e   also specified.
0a80: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63  ..[list_end]..[c
0a90: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f  all [cmd tls::so
0aa0: 63 6b 65 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d 73  cket] [option -s
0ab0: 65 72 76 65 72 5d 20 5b 61 72 67 20 63 6f 6d 6d  erver] [arg comm
0ac0: 61 6e 64 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d  and] [opt [arg -
0ad0: 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61  option]] [opt [a
0ae0: 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20  rg value]] [opt 
0af0: 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61  [arg "-option va
0b00: 6c 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20  lue ..."]] [arg 
0b10: 70 6f 72 74 5d 5d 0a 0a 53 61 6d 65 20 61 73 20  port]]..Same as 
0b20: 70 72 65 76 69 6f 75 73 2c 20 62 75 74 20 69 6e  previous, but in
0b30: 73 74 65 61 64 20 63 72 65 61 74 65 73 20 61 20  stead creates a 
0b40: 73 65 72 76 65 72 20 73 6f 63 6b 65 74 20 66 6f  server socket fo
0b50: 72 20 63 6c 69 65 6e 74 73 20 74 6f 20 63 6f 6e  r clients to con
0b60: 6e 65 63 74 20 74 6f 0a 6a 75 73 74 20 6c 69 6b  nect to.just lik
0b70: 65 20 74 68 65 20 54 63 6c 20 5b 73 79 73 63 6d  e the Tcl [syscm
0b80: 64 20 22 73 6f 63 6b 65 74 20 2d 73 65 72 76 65  d "socket -serve
0b90: 72 22 5d 20 63 6f 6d 6d 61 6e 64 2e 20 49 74 20  r"] command. It 
0ba0: 72 65 74 75 72 6e 73 20 74 68 65 20 63 68 61 6e  returns the chan
0bb0: 6e 65 6c 0a 68 61 6e 64 6c 65 20 69 64 20 66 6f  nel.handle id fo
0bc0: 72 20 74 68 65 20 6e 65 77 20 73 6f 63 6b 65 74  r the new socket
0bd0: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ...[call [cmd tl
0be0: 73 3a 3a 69 6d 70 6f 72 74 5d 20 5b 61 72 67 20  s::import] [arg 
0bf0: 63 68 61 6e 6e 65 6c 5d 20 5b 6f 70 74 20 5b 61  channel] [opt [a
0c00: 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70  rg -option]] [op
0c10: 74 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b  t [arg value]] [
0c20: 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f  opt [arg "-optio
0c30: 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d 0a  n value ..."]]].
0c40: 0a 53 74 61 72 74 20 54 4c 53 20 65 6e 63 72 79  .Start TLS encry
0c50: 70 74 69 6f 6e 20 6f 6e 20 54 43 4c 20 63 68 61  ption on TCL cha
0c60: 6e 6e 65 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65  nnel [arg channe
0c70: 6c 5d 20 76 69 61 20 61 20 73 74 61 63 6b 65 64  l] via a stacked
0c80: 20 63 68 61 6e 6e 65 6c 2e 20 49 74 0a 6e 65 65   channel. It.nee
0c90: 64 20 6e 6f 74 20 62 65 20 61 20 73 6f 63 6b 65  d not be a socke
0ca0: 74 2c 20 62 75 74 20 6d 75 73 74 20 70 72 6f 76  t, but must prov
0cb0: 69 64 65 20 62 69 2d 64 69 72 65 63 74 69 6f 6e  ide bi-direction
0cc0: 61 6c 20 66 6c 6f 77 2e 20 41 6c 73 6f 20 73 65  al flow. Also se
0cd0: 74 73 20 73 65 73 73 69 6f 6e 0a 70 61 72 61 6d  ts session.param
0ce0: 65 74 65 72 73 20 66 6f 72 20 53 53 4c 20 68 61  eters for SSL ha
0cf0: 6e 64 73 68 61 6b 65 2e 20 56 61 6c 69 64 20 6f  ndshake. Valid o
0d00: 70 74 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b 6c 69  ptions are:..[li
0d10: 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73  st_begin options
0d20: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 6c 70  ]..[opt_def -alp
0d30: 6e 20 5b 61 72 67 20 6c 69 73 74 5d 5d 0a 4c 69  n [arg list]].Li
0d40: 73 74 20 6f 66 20 70 72 6f 74 6f 63 6f 6c 73 20  st of protocols 
0d50: 74 6f 20 6f 66 66 65 72 20 64 75 72 69 6e 67 20  to offer during 
0d60: 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65  Application-Laye
0d70: 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74  r Protocol Negot
0d80: 69 61 74 69 6f 6e 0a 28 41 4c 50 4e 29 2e 20 46  iation.(ALPN). F
0d90: 6f 72 20 65 78 61 6d 70 6c 65 3a 20 5b 63 6f 6e  or example: [con
0da0: 73 74 20 68 32 5d 20 61 6e 64 20 5b 63 6f 6e 73  st h2] and [cons
0db0: 74 20 68 74 74 70 2f 31 2e 31 5d 2c 20 62 75 74  t http/1.1], but
0dc0: 20 6e 6f 74 20 5b 63 6f 6e 73 74 20 68 33 5d 20   not [const h3] 
0dd0: 6f 72 0a 5b 63 6f 6e 73 74 20 71 75 69 63 5d 2e  or.[const quic].
0de0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64 69  ..[opt_def -cadi
0df0: 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72 79  r [arg directory
0e00: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
0e10: 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 65   directory where
0e20: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65   the Certificate
0e30: 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 20   Authority (CA) 
0e40: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65  certificates are
0e50: 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65 66  .stored. The def
0e60: 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72 6d  ault is platform
0e70: 20 73 70 65 63 69 66 69 63 20 61 6e 64 20 63 61   specific and ca
0e80: 6e 20 62 65 20 73 65 74 20 61 74 20 63 6f 6d 70  n be set at comp
0e90: 69 6c 65 20 74 69 6d 65 2e 20 54 68 65 0a 64 65  ile time. The.de
0ea0: 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63  fault location c
0eb0: 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e  an be overridden
0ec0: 20 62 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c   by the [var SSL
0ed0: 5f 43 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72  _CERT_DIR] envir
0ee0: 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e  onment.variable.
0ef0: 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43   See [sectref "C
0f00: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
0f10: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65  ation"] for more
0f20: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f   details...[opt_
0f30: 64 65 66 20 2d 63 61 66 69 6c 65 20 5b 61 72 67  def -cafile [arg
0f40: 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63   filename]].Spec
0f50: 69 66 69 65 73 20 74 68 65 20 66 69 6c 65 20 77  ifies the file w
0f60: 69 74 68 20 74 68 65 20 43 65 72 74 69 66 69 63  ith the Certific
0f70: 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28 43  ate Authority (C
0f80: 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73 20  A) certificates 
0f90: 74 6f 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73 74  to use in.[const
0fa0: 20 50 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d 61   PEM] file forma
0fb0: 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69  t. The default i
0fc0: 73 20 5b 66 69 6c 65 20 63 65 72 74 2e 70 65 6d  s [file cert.pem
0fd0: 5d 2c 20 69 6e 20 74 68 65 20 4f 70 65 6e 53 53  ], in the OpenSS
0fe0: 4c 0a 64 69 72 65 63 74 6f 72 79 2e 20 54 68 65  L.directory. The
0ff0: 20 64 65 66 61 75 6c 74 20 66 69 6c 65 20 63 61   default file ca
1000: 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20  n be overridden 
1010: 62 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f  by the [var SSL_
1020: 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72  CERT_FILE] envir
1030: 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e  onment.variable.
1040: 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43   See [sectref "C
1050: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
1060: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65  ation"] for more
1070: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f   details...[opt_
1080: 64 65 66 20 2d 63 61 73 74 6f 72 65 20 5b 61 72  def -castore [ar
1090: 67 20 55 52 49 5d 5d 0a 53 70 65 63 69 66 69 65  g URI]].Specifie
10a0: 73 20 74 68 65 20 55 6e 69 66 6f 72 6d 20 52 65  s the Uniform Re
10b0: 73 6f 75 72 63 65 20 49 64 65 6e 74 69 66 69 65  source Identifie
10c0: 72 20 28 55 52 49 29 20 66 6f 72 20 74 68 65 20  r (URI) for the 
10d0: 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68  Certificate Auth
10e0: 6f 72 69 74 79 0a 28 43 41 29 20 73 74 6f 72 65  ority.(CA) store
10f0: 2c 20 77 68 69 63 68 20 6d 61 79 20 62 65 20 61  , which may be a
1100: 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61 69 6e 65   single containe
1110: 72 20 6f 72 20 61 20 63 61 74 61 6c 6f 67 20 6f  r or a catalog o
1120: 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e 0a 53 74  f containers..St
1130: 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e  arting with Open
1140: 53 53 4c 20 33 2e 32 20 6f 6e 20 4d 53 20 57 69  SSL 3.2 on MS Wi
1150: 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20 22 5b  ndows, set to "[
1160: 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e 73  const "org.opens
1170: 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d  sl.winstore://"]
1180: 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62 75 69  ".to use the bui
1190: 6c 74 2d 69 6e 20 4d 53 20 57 69 6e 64 6f 77 73  lt-in MS Windows
11a0: 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74 6f   Certificate Sto
11b0: 72 65 2e 20 53 65 65 0a 5b 73 65 63 74 72 65 66  re. See.[sectref
11c0: 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61   "Certificate Va
11d0: 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d  lidation"] for m
11e0: 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f  ore details...[o
11f0: 70 74 5f 64 65 66 20 2d 63 65 72 74 66 69 6c 65  pt_def -certfile
1200: 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d   [arg filename]]
1210: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 6e  .Specifies the n
1220: 61 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65 20  ame of the file 
1230: 77 69 74 68 20 74 68 65 20 63 65 72 74 69 66 69  with the certifi
1240: 63 61 74 65 20 74 6f 20 75 73 65 20 69 6e 20 50  cate to use in P
1250: 45 4d 20 66 6f 72 6d 61 74 0a 61 73 20 74 68 65  EM format.as the
1260: 20 6c 6f 63 61 6c 20 28 63 6c 69 65 6e 74 20 6f   local (client o
1270: 72 20 73 65 72 76 65 72 29 20 63 65 72 74 69 66  r server) certif
1280: 69 63 61 74 65 2e 20 49 74 20 61 6c 73 6f 20 63  icate. It also c
1290: 6f 6e 74 61 69 6e 73 20 74 68 65 20 70 75 62 6c  ontains the publ
12a0: 69 63 20 6b 65 79 2e 0a 0a 5b 6f 70 74 5f 64 65  ic key...[opt_de
12b0: 66 20 2d 63 65 72 74 20 5b 61 72 67 20 73 74 72  f -cert [arg str
12c0: 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ing]].Specifies 
12d0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
12e0: 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52 20  to use as a DER 
12f0: 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20 28  encoded string (
1300: 58 2e 35 30 39 20 44 45 52 29 2e 0a 0a 5b 6f 70  X.509 DER)...[op
1310: 74 5f 64 65 66 20 2d 63 69 70 68 65 72 20 5b 61  t_def -cipher [a
1320: 72 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63  rg string]].Spec
1330: 69 66 69 65 73 20 74 68 65 20 6c 69 73 74 20 6f  ifies the list o
1340: 66 20 63 69 70 68 65 72 73 20 74 6f 20 75 73 65  f ciphers to use
1350: 20 66 6f 72 20 54 4c 53 20 31 2e 32 20 61 6e 64   for TLS 1.2 and
1360: 20 65 61 72 6c 69 65 72 20 63 6f 6e 6e 65 63 74   earlier connect
1370: 69 6f 6e 73 2e 0a 53 74 72 69 6e 67 20 69 73 20  ions..String is 
1380: 61 20 63 6f 6c 6f 6e 20 22 5b 63 6f 6e 73 74 20  a colon "[const 
1390: 3a 5d 22 20 73 65 70 61 72 61 74 65 64 20 6c 69  :]" separated li
13a0: 73 74 20 6f 66 20 63 69 70 68 65 72 73 2e 0a 43  st of ciphers..C
13b0: 69 70 68 65 72 73 20 63 61 6e 20 62 65 20 63 6f  iphers can be co
13c0: 6d 62 69 6e 65 64 20 75 73 69 6e 67 20 74 68 65  mbined using the
13d0: 20 22 5b 63 6f 6e 73 74 20 2b 5d 22 20 63 68 61   "[const +]" cha
13e0: 72 61 63 74 65 72 2e 0a 50 72 65 66 69 78 65 73  racter..Prefixes
13f0: 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20   can be used to 
1400: 70 65 72 6d 61 6e 65 6e 74 6c 79 20 72 65 6d 6f  permanently remo
1410: 76 65 20 22 5b 63 6f 6e 73 74 20 21 5d 22 2c 20  ve "[const !]", 
1420: 64 65 6c 65 74 65 20 22 5b 63 6f 6e 73 74 20 2d  delete "[const -
1430: 5d 22 2c 20 6f 72 0a 6d 6f 76 65 20 74 6f 20 74  ]", or.move to t
1440: 68 65 20 65 6e 64 20 22 5b 63 6f 6e 73 74 20 2b  he end "[const +
1450: 5d 22 20 61 20 73 70 65 63 69 66 69 65 64 20 63  ]" a specified c
1460: 69 70 68 65 72 2e 0a 4b 65 79 77 6f 72 64 73 20  ipher..Keywords 
1470: 5b 63 6f 6e 73 74 20 40 53 54 52 45 4e 47 54 48  [const @STRENGTH
1480: 5d 20 28 73 6f 72 74 20 62 79 20 61 6c 67 6f 72  ] (sort by algor
1490: 69 74 68 6d 20 6b 65 79 20 6c 65 6e 67 74 68 29  ithm key length)
14a0: 2c 0a 5b 63 6f 6e 73 74 20 40 53 45 43 4c 45 56  ,.[const @SECLEV
14b0: 45 4c 3d 5d 5b 65 6d 70 68 20 6e 5d 20 28 73 65  EL=][emph n] (se
14c0: 74 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c  t security level
14d0: 20 74 6f 20 6e 29 2c 20 61 6e 64 0a 5b 63 6f 6e   to n), and.[con
14e0: 73 74 20 44 45 46 41 55 4c 54 5d 20 28 75 73 65  st DEFAULT] (use
14f0: 20 64 65 66 61 75 6c 74 20 63 69 70 68 65 72 20   default cipher 
1500: 6c 69 73 74 2c 20 61 74 20 73 74 61 72 74 20 6f  list, at start o
1510: 6e 6c 79 29 20 63 61 6e 20 61 6c 73 6f 20 62 65  nly) can also be
1520: 20 73 70 65 63 69 66 69 65 64 2e 0a 53 65 65 20   specified..See 
1530: 74 68 65 20 5b 75 72 69 20 22 68 74 74 70 73 3a  the [uri "https:
1540: 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f  //docs.openssl.o
1550: 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f 6f  rg/master/man1/o
1560: 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f 23  penssl-ciphers/#
1570: 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53 4c  options" OpenSSL
1580: 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20  ].documentation 
1590: 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c 69 73  for the full lis
15a0: 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75 65  t of valid value
15b0: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 69  s...[opt_def -ci
15c0: 70 68 65 72 73 75 69 74 65 73 20 5b 61 72 67 20  phersuites [arg 
15d0: 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69  string]].Specifi
15e0: 65 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 63  es the list of c
15f0: 69 70 68 65 72 20 73 75 69 74 65 73 20 74 6f 20  ipher suites to 
1600: 75 73 65 20 66 6f 72 20 54 4c 53 20 31 2e 33 20  use for TLS 1.3 
1610: 61 73 20 61 20 63 6f 6c 6f 6e 0a 22 5b 63 6f 6e  as a colon."[con
1620: 73 74 20 3a 5d 22 20 73 65 70 61 72 61 74 65 64  st :]" separated
1630: 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72 20   list of cipher 
1640: 73 75 69 74 65 20 6e 61 6d 65 73 2e 20 53 65 65  suite names. See
1650: 20 74 68 65 0a 5b 75 72 69 20 22 68 74 74 70 73   the.[uri "https
1660: 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e  ://docs.openssl.
1670: 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f  org/master/man1/
1680: 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f  openssl-ciphers/
1690: 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53  #options" OpenSS
16a0: 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e  L].documentation
16b0: 20 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c 69   for the full li
16c0: 73 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75  st of valid valu
16d0: 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  es...[opt_def -c
16e0: 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c  ommand [arg call
16f0: 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73  back]].Specifies
1700: 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f   the callback co
1710: 6d 6d 61 6e 64 20 74 6f 20 62 65 20 69 6e 76 6f  mmand to be invo
1720: 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70  ked at several p
1730: 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65  oints during the
1740: 0a 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 70 61  .handshake to pa
1750: 73 73 20 65 72 72 6f 72 73 2c 20 74 72 61 63 69  ss errors, traci
1760: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20  ng information, 
1770: 61 6e 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 65 73  and protocol mes
1780: 73 61 67 65 73 2e 0a 53 65 65 20 5b 73 65 63 74  sages..See [sect
1790: 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70  ref "Callback Op
17a0: 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65  tions"] for more
17b0: 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66   info...[opt_def
17c0: 20 2d 64 68 70 61 72 61 6d 73 20 5b 61 72 67 20   -dhparams [arg 
17d0: 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69  filename]].Speci
17e0: 66 69 65 73 20 74 68 65 20 44 69 66 66 69 65 2d  fies the Diffie-
17f0: 48 65 6c 6c 6d 61 6e 20 28 44 48 29 20 70 61 72  Hellman (DH) par
1800: 61 6d 65 74 65 72 73 20 66 69 6c 65 2e 0a 0a 5b  ameters file...[
1810: 6f 70 74 5f 64 65 66 20 2d 6b 65 79 66 69 6c 65  opt_def -keyfile
1820: 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d   [arg filename]]
1830: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 70  .Specifies the p
1840: 72 69 76 61 74 65 20 6b 65 79 20 66 69 6c 65 2e  rivate key file.
1850: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
1860: 74 6f 20 75 73 65 20 74 68 65 20 66 69 6c 65 0a  to use the file.
1870: 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65  specified by the
1880: 20 5b 61 72 67 20 2d 63 65 72 74 66 69 6c 65 5d   [arg -certfile]
1890: 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64   option...[opt_d
18a0: 65 66 20 2d 6b 65 79 20 5b 61 72 67 20 73 74 72  ef -key [arg str
18b0: 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ing]].Specifies 
18c0: 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20  the private key 
18d0: 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52 20  to use as a DER 
18e0: 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20 28  encoded string (
18f0: 50 4b 43 53 23 31 20 44 45 52 29 2e 0a 0a 5b 6f  PKCS#1 DER)...[o
1900: 70 74 5f 64 65 66 20 2d 6d 6f 64 65 6c 20 5b 61  pt_def -model [a
1910: 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 46 6f 72  rg channel]].For
1920: 63 65 20 74 68 69 73 20 63 68 61 6e 6e 65 6c 20  ce this channel 
1930: 74 6f 20 73 68 61 72 65 20 74 68 65 20 73 61 6d  to share the sam
1940: 65 20 5b 74 65 72 6d 20 53 53 4c 5f 43 54 58 5d  e [term SSL_CTX]
1950: 20 73 74 72 75 63 74 75 72 65 20 61 73 20 74 68   structure as th
1960: 65 0a 73 70 65 63 69 66 69 65 64 20 5b 61 72 67  e.specified [arg
1970: 20 63 68 61 6e 6e 65 6c 5d 2c 20 61 6e 64 20 74   channel], and t
1980: 68 65 72 65 66 6f 72 65 20 73 68 61 72 65 20 63  herefore share c
1990: 6f 6e 66 69 67 2c 20 63 61 6c 6c 62 61 63 6b 73  onfig, callbacks
19a0: 2c 20 65 74 63 2e 0a 0a 5b 6f 70 74 5f 64 65 66  , etc...[opt_def
19b0: 20 2d 70 61 73 73 77 6f 72 64 20 5b 61 72 67 20   -password [arg 
19c0: 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69  callback]].Speci
19d0: 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63  fies the callbac
19e0: 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e 76  k command to inv
19f0: 6f 6b 65 20 77 68 65 6e 20 4f 70 65 6e 53 53 4c  oke when OpenSSL
1a00: 20 6e 65 65 64 73 20 74 6f 20 6f 62 74 61 69 6e   needs to obtain
1a10: 20 61 0a 70 61 73 73 77 6f 72 64 2e 20 54 68 69   a.password. Thi
1a20: 73 20 69 73 20 74 79 70 69 63 61 6c 6c 79 20 75  s is typically u
1a30: 73 65 64 20 74 6f 20 75 6e 6c 6f 63 6b 20 74 68  sed to unlock th
1a40: 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 6f 66  e private key of
1a50: 20 61 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a   a certificate..
1a60: 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 68 6f  The callback sho
1a70: 75 6c 64 20 72 65 74 75 72 6e 20 61 20 70 61 73  uld return a pas
1a80: 73 77 6f 72 64 20 73 74 72 69 6e 67 2e 20 53 65  sword string. Se
1a90: 65 20 5b 73 65 63 74 72 65 66 20 22 43 61 6c 6c  e [sectref "Call
1aa0: 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d 0a 66  back Options"].f
1ab0: 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b  or more info...[
1ac0: 6f 70 74 5f 64 65 66 20 2d 70 6f 73 74 5f 68 61  opt_def -post_ha
1ad0: 6e 64 73 68 61 6b 65 20 5b 61 72 67 20 62 6f 6f  ndshake [arg boo
1ae0: 6c 5d 5d 0a 41 6c 6c 6f 77 20 70 6f 73 74 2d 68  l]].Allow post-h
1af0: 61 6e 64 73 68 61 6b 65 20 73 65 73 73 69 6f 6e  andshake session
1b00: 20 74 69 63 6b 65 74 20 75 70 64 61 74 65 73 2e   ticket updates.
1b10: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75  ..[opt_def -requ
1b20: 65 73 74 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a  est [arg bool]].
1b30: 52 65 71 75 65 73 74 20 61 20 63 65 72 74 69 66  Request a certif
1b40: 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70  icate from the p
1b50: 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53  eer during the S
1b60: 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 54 68  SL handshake. Th
1b70: 69 73 20 69 73 20 6e 65 65 64 65 64 0a 74 6f 20  is is needed.to 
1b80: 64 6f 20 43 65 72 74 69 66 69 63 61 74 65 20 56  do Certificate V
1b90: 61 6c 69 64 61 74 69 6f 6e 2e 20 53 74 61 72 74  alidation. Start
1ba0: 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e  ing in TclTLS 1.
1bb0: 38 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20 69  8, the default i
1bc0: 73 0a 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 0a  s.[const true]..
1bd0: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65  See [sectref "Ce
1be0: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
1bf0: 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20  tion"] for more 
1c00: 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64  details...[opt_d
1c10: 65 66 20 2d 72 65 71 75 69 72 65 20 5b 61 72 67  ef -require [arg
1c20: 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 69 72 65 20   bool]].Require 
1c30: 61 20 76 61 6c 69 64 20 63 65 72 74 69 66 69 63  a valid certific
1c40: 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65  ate from the pee
1c50: 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c  r during the SSL
1c60: 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20 74   handshake. If t
1c70: 68 69 73 20 69 73 0a 73 65 74 20 74 6f 20 74 72  his is.set to tr
1c80: 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f 6e  ue, then [option
1c90: 20 2d 72 65 71 75 65 73 74 5d 20 6d 75 73 74 20   -request] must 
1ca0: 61 6c 73 6f 20 62 65 20 73 65 74 20 74 6f 20 74  also be set to t
1cb0: 72 75 65 20 61 6e 64 20 61 20 65 69 74 68 65 72  rue and a either
1cc0: 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d  .[option -cadir]
1cd0: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c  , [option -cafil
1ce0: 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73  e], [option -cas
1cf0: 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70 6c 61 74  tore], or a plat
1d00: 66 6f 72 6d 20 64 65 66 61 75 6c 74 0a 6d 75 73  form default.mus
1d10: 74 20 62 65 20 70 72 6f 76 69 64 65 64 20 69 6e  t be provided in
1d20: 20 6f 72 64 65 72 20 74 6f 20 76 61 6c 69 64 61   order to valida
1d30: 74 65 20 61 67 61 69 6e 73 74 2e 20 54 68 65 20  te against. The 
1d40: 64 65 66 61 75 6c 74 20 69 6e 20 54 63 6c 54 4c  default in TclTL
1d50: 53 20 31 2e 38 20 61 6e 64 0a 65 61 72 6c 69 65  S 1.8 and.earlie
1d60: 72 20 76 65 72 73 69 6f 6e 73 20 69 73 20 5b 63  r versions is [c
1d70: 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e 63  onst false] sinc
1d80: 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61 74 66 6f  e not all platfo
1d90: 72 6d 73 20 68 61 76 65 20 63 65 72 74 69 66 69  rms have certifi
1da0: 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 61 74  cates to.validat
1db0: 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20 66  e against in a f
1dc0: 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20 77  orm compatible w
1dd0: 69 74 68 20 4f 70 65 6e 53 53 4c 2e 0a 53 65 65  ith OpenSSL..See
1de0: 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69   [sectref "Certi
1df0: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f  ficate Validatio
1e00: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74  n"] for more det
1e10: 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  ails...[opt_def 
1e20: 2d 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 20  -security_level 
1e30: 5b 61 72 67 20 69 6e 74 65 67 65 72 5d 5d 0a 53  [arg integer]].S
1e40: 70 65 63 69 66 69 65 73 20 74 68 65 20 73 65 63  pecifies the sec
1e50: 75 72 69 74 79 20 6c 65 76 65 6c 20 28 76 61 6c  urity level (val
1e60: 75 65 20 66 72 6f 6d 20 30 20 74 6f 20 35 29 2e  ue from 0 to 5).
1e70: 20 54 68 65 20 73 65 63 75 72 69 74 79 20 6c 65   The security le
1e80: 76 65 6c 20 61 66 66 65 63 74 73 0a 74 68 65 20  vel affects.the 
1e90: 61 6c 6c 6f 77 65 64 20 63 69 70 68 65 72 20 73  allowed cipher s
1ea0: 75 69 74 65 20 65 6e 63 72 79 70 74 69 6f 6e 20  uite encryption 
1eb0: 61 6c 67 6f 72 69 74 68 6d 73 2c 20 73 75 70 70  algorithms, supp
1ec0: 6f 72 74 65 64 20 45 43 43 20 63 75 72 76 65 73  orted ECC curves
1ed0: 2c 0a 73 75 70 70 6f 72 74 65 64 20 73 69 67 6e  ,.supported sign
1ee0: 61 74 75 72 65 20 61 6c 67 6f 72 69 74 68 6d 73  ature algorithms
1ef0: 2c 20 44 48 20 70 61 72 61 6d 65 74 65 72 20 73  , DH parameter s
1f00: 69 7a 65 73 2c 20 63 65 72 74 69 66 69 63 61 74  izes, certificat
1f10: 65 20 6b 65 79 20 73 69 7a 65 73 0a 61 6e 64 20  e key sizes.and 
1f20: 73 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72 69  signature algori
1f30: 74 68 6d 73 2e 20 54 68 65 20 64 65 66 61 75 6c  thms. The defaul
1f40: 74 20 69 73 20 31 20 70 72 69 6f 72 20 74 6f 20  t is 1 prior to 
1f50: 4f 70 65 6e 53 53 4c 20 33 2e 32 20 61 6e 64 20  OpenSSL 3.2 and 
1f60: 32 0a 74 68 65 72 65 61 66 74 65 72 2e 20 4c 65  2.thereafter. Le
1f70: 76 65 6c 20 33 20 61 6e 64 20 68 69 67 68 65 72  vel 3 and higher
1f80: 20 64 69 73 61 62 6c 65 20 73 75 70 70 6f 72 74   disable support
1f90: 20 66 6f 72 20 73 65 73 73 69 6f 6e 20 74 69 63   for session tic
1fa0: 6b 65 74 73 20 61 6e 64 0a 6f 6e 6c 79 20 61 63  kets and.only ac
1fb0: 63 65 70 74 20 63 69 70 68 65 72 20 73 75 69 74  cept cipher suit
1fc0: 65 73 20 74 68 61 74 20 70 72 6f 76 69 64 65 20  es that provide 
1fd0: 66 6f 72 77 61 72 64 20 73 65 63 72 65 63 79 2e  forward secrecy.
1fe0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 72 76  ..[opt_def -serv
1ff0: 65 72 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 53  er [arg bool]].S
2000: 70 65 63 69 66 69 65 73 20 77 68 65 74 68 65 72  pecifies whether
2010: 20 74 6f 20 61 63 74 20 61 73 20 61 20 73 65 72   to act as a ser
2020: 76 65 72 20 61 6e 64 20 72 65 73 70 6f 6e 64 20  ver and respond 
2030: 77 69 74 68 20 61 20 73 65 72 76 65 72 20 68 61  with a server ha
2040: 6e 64 73 68 61 6b 65 20 77 68 65 6e 20 61 0a 63  ndshake when a.c
2050: 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 73 20 61  lient connects a
2060: 6e 64 20 70 72 6f 76 69 64 65 73 20 61 20 63 6c  nd provides a cl
2070: 69 65 6e 74 20 68 61 6e 64 73 68 61 6b 65 2e 20  ient handshake. 
2080: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  The default is [
2090: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 0a 5b  const false]...[
20a0: 6f 70 74 5f 64 65 66 20 2d 73 65 72 76 65 72 6e  opt_def -servern
20b0: 61 6d 65 20 5b 61 72 67 20 68 6f 73 74 6e 61 6d  ame [arg hostnam
20c0: 65 5d 5d 0a 53 70 65 63 69 66 79 20 74 68 65 20  e]].Specify the 
20d0: 70 65 65 72 27 73 20 68 6f 73 74 6e 61 6d 65 2e  peer's hostname.
20e0: 20 54 68 69 73 20 69 73 20 75 73 65 64 20 74 6f   This is used to
20f0: 20 73 65 74 20 74 68 65 20 54 4c 53 20 53 65 72   set the TLS Ser
2100: 76 65 72 20 4e 61 6d 65 20 49 6e 64 69 63 61 74  ver Name Indicat
2110: 69 6f 6e 0a 28 53 4e 49 29 20 65 78 74 65 6e 73  ion.(SNI) extens
2120: 69 6f 6e 2e 20 53 65 74 20 74 68 69 73 20 74 6f  ion. Set this to
2130: 20 74 68 65 20 65 78 70 65 63 74 65 64 20 73 65   the expected se
2140: 72 76 65 72 6e 61 6d 65 20 69 6e 20 74 68 65 20  rvername in the 
2150: 73 65 72 76 65 72 27 73 20 63 65 72 74 69 66 69  server's certifi
2160: 63 61 74 65 0a 6f 72 20 6f 6e 65 20 6f 66 20 74  cate.or one of t
2170: 68 65 20 53 75 62 6a 65 63 74 20 41 6c 74 65 72  he Subject Alter
2180: 6e 61 74 65 20 4e 61 6d 65 73 20 28 53 41 4e 29  nate Names (SAN)
2190: 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63  . Starting in Tc
21a0: 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69 73 20 77  lTLS 2.0, this w
21b0: 69 6c 6c 0a 64 65 66 61 75 6c 74 20 74 6f 20 74  ill.default to t
21c0: 68 65 20 68 6f 73 74 20 66 6f 72 20 74 68 65 20  he host for the 
21d0: 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74  [cmd tls::socket
21e0: 5d 20 63 6f 6d 6d 61 6e 64 2e 0a 0a 5b 6f 70 74  ] command...[opt
21f0: 5f 64 65 66 20 2d 73 65 73 73 69 6f 6e 5f 69 64  _def -session_id
2200: 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72   [arg binary_str
2210: 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ing]].Specifies 
2220: 74 68 65 20 73 65 73 73 69 6f 6e 20 69 64 20 74  the session id t
2230: 6f 20 72 65 73 75 6d 65 20 61 20 73 65 73 73 69  o resume a sessi
2240: 6f 6e 2e 20 4e 6f 74 20 73 75 70 70 6f 72 74 65  on. Not supporte
2250: 64 20 79 65 74 2e 0a 0a 5b 6f 70 74 5f 64 65 66  d yet...[opt_def
2260: 20 2d 73 73 6c 32 20 5b 61 72 67 20 62 6f 6f 6c   -ssl2 [arg bool
2270: 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66  ]].Enable use of
2280: 20 53 53 4c 20 76 32 2e 20 54 68 65 20 64 65 66   SSL v2. The def
2290: 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66  ault is [const f
22a0: 61 6c 73 65 5d 2e 20 4e 6f 74 65 3a 20 52 65 63  alse]. Note: Rec
22b0: 65 6e 74 20 76 65 72 73 69 6f 6e 73 20 6f 66 0a  ent versions of.
22c0: 4f 70 65 6e 53 53 4c 20 6e 6f 20 6c 6f 6e 67 65  OpenSSL no longe
22d0: 72 20 73 75 70 70 6f 72 74 20 53 53 4c 76 32 2c  r support SSLv2,
22e0: 20 73 6f 20 74 68 69 73 20 6d 61 79 20 6e 6f 74   so this may not
22f0: 20 68 61 76 65 20 61 6e 79 20 65 66 66 65 63 74   have any effect
2300: 2e 20 53 65 65 20 74 68 65 0a 5b 63 6d 64 20 74  . See the.[cmd t
2310: 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63  ls::protocols] c
2320: 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70 70 6f  ommand for suppo
2330: 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73 2e 0a  rted protocols..
2340: 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73 6c 33 20  .[opt_def -ssl3 
2350: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62  [arg bool]].Enab
2360: 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20 76 33  le use of SSL v3
2370: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
2380: 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 20   [const false]. 
2390: 4e 6f 74 65 3a 20 52 65 63 65 6e 74 20 76 65 72  Note: Recent ver
23a0: 73 69 6f 6e 73 0a 6f 66 20 4f 70 65 6e 53 53 4c  sions.of OpenSSL
23b0: 20 6d 61 79 20 68 61 76 65 20 74 68 69 73 20 64   may have this d
23c0: 69 73 61 62 6c 65 64 20 61 74 20 63 6f 6d 70 69  isabled at compi
23d0: 6c 65 20 74 69 6d 65 2c 20 73 6f 20 74 68 69 73  le time, so this
23e0: 20 6d 61 79 20 6e 6f 74 20 68 61 76 65 20 61 6e   may not have an
23f0: 79 0a 65 66 66 65 63 74 2e 20 53 65 65 20 74 68  y.effect. See th
2400: 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74  e [cmd tls::prot
2410: 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66  ocols] command f
2420: 6f 72 20 73 75 70 70 6f 72 74 65 64 20 70 72 6f  or supported pro
2430: 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65  tocols...[opt_de
2440: 66 20 2d 74 6c 73 31 20 5b 61 72 67 20 62 6f 6f  f -tls1 [arg boo
2450: 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f  l]].Enable use o
2460: 66 20 54 4c 53 20 76 31 2e 20 54 68 65 20 64 65  f TLS v1. The de
2470: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
2480: 74 72 75 65 5d 2e 20 4e 6f 74 65 3a 20 54 4c 53  true]. Note: TLS
2490: 20 31 2e 30 20 6e 65 65 64 73 0a 53 48 41 31 20   1.0 needs.SHA1 
24a0: 74 6f 20 6f 70 65 72 61 74 65 2c 20 77 68 69 63  to operate, whic
24b0: 68 20 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61  h is only availa
24c0: 62 6c 65 20 69 6e 20 73 65 63 75 72 69 74 79 20  ble in security 
24d0: 6c 65 76 65 6c 20 30 20 66 6f 72 20 4f 70 65 6e  level 0 for Open
24e0: 20 53 53 4c 20 33 2e 30 2b 2e 0a 53 65 65 20 74   SSL 3.0+..See t
24f0: 68 65 20 5b 61 72 67 20 2d 73 65 63 75 72 69 74  he [arg -securit
2500: 79 5f 6c 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e  y_level] option.
2510: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31  ..[opt_def -tls1
2520: 2e 31 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45  .1 [arg bool]].E
2530: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53  nable use of TLS
2540: 20 76 31 2e 31 2e 20 54 68 65 20 64 65 66 61 75   v1.1. The defau
2550: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75  lt is [const tru
2560: 65 5d 2e 20 4e 6f 74 65 3a 20 54 4c 53 20 31 2e  e]. Note: TLS 1.
2570: 31 20 6e 65 65 64 73 0a 53 48 41 31 20 74 6f 20  1 needs.SHA1 to 
2580: 6f 70 65 72 61 74 65 2c 20 77 68 69 63 68 20 69  operate, which i
2590: 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65  s only available
25a0: 20 69 6e 20 73 65 63 75 72 69 74 79 20 6c 65 76   in security lev
25b0: 65 6c 20 30 20 66 6f 72 20 4f 70 65 6e 20 53 53  el 0 for Open SS
25c0: 4c 20 33 2e 30 2b 2e 0a 53 65 65 20 74 68 65 20  L 3.0+..See the 
25d0: 5b 61 72 67 20 2d 73 65 63 75 72 69 74 79 5f 6c  [arg -security_l
25e0: 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b  evel] option...[
25f0: 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 2e 32 20  opt_def -tls1.2 
2600: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62  [arg bool]].Enab
2610: 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31  le use of TLS v1
2620: 2e 32 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  .2. The default 
2630: 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e  is [const true].
2640: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31  ..[opt_def -tls1
2650: 2e 33 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45  .3 [arg bool]].E
2660: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53  nable use of TLS
2670: 20 76 31 2e 33 2e 20 54 68 65 20 64 65 66 61 75   v1.3. The defau
2680: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75  lt is [const tru
2690: 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 76  e]...[opt_def -v
26a0: 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 20 5b  alidatecommand [
26b0: 61 72 67 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53  arg callback]].S
26c0: 70 65 63 69 66 69 65 73 20 74 68 65 20 63 61 6c  pecifies the cal
26d0: 6c 62 61 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f  lback command to
26e0: 20 69 6e 76 6f 6b 65 20 74 6f 20 76 61 6c 69 64   invoke to valid
26f0: 61 74 65 20 74 68 65 20 70 65 65 72 20 63 65 72  ate the peer cer
2700: 74 69 66 69 63 61 74 65 73 0a 61 6e 64 20 6f 74  tificates.and ot
2710: 68 65 72 20 63 6f 6e 66 69 67 20 69 6e 66 6f 20  her config info 
2720: 64 75 72 69 6e 67 20 74 68 65 20 70 72 6f 74 6f  during the proto
2730: 63 6f 6c 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20  col negotiation 
2740: 70 68 61 73 65 2e 20 54 68 69 73 20 63 61 6e 20  phase. This can 
2750: 62 65 20 75 73 65 64 0a 62 79 20 54 43 4c 20 73  be used.by TCL s
2760: 63 72 69 70 74 73 20 74 6f 20 70 65 72 66 6f 72  cripts to perfor
2770: 6d 20 74 68 65 69 72 20 6f 77 6e 20 43 65 72 74  m their own Cert
2780: 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69  ificate Validati
2790: 6f 6e 20 74 6f 20 73 75 70 70 6c 65 6d 65 6e 74  on to supplement
27a0: 20 74 68 65 0a 64 65 66 61 75 6c 74 20 76 61 6c   the.default val
27b0: 69 64 61 74 69 6f 6e 20 70 72 6f 76 69 64 65 64  idation provided
27c0: 20 62 79 20 4f 70 65 6e 53 53 4c 2e 20 54 68 65   by OpenSSL. The
27d0: 20 73 63 72 69 70 74 20 6d 75 73 74 20 72 65 74   script must ret
27e0: 75 72 6e 20 61 20 62 6f 6f 6c 65 61 6e 20 74 72  urn a boolean tr
27f0: 75 65 0a 74 6f 20 63 6f 6e 74 69 6e 75 65 20 74  ue.to continue t
2800: 68 65 20 6e 65 67 6f 74 69 61 74 69 6f 6e 2e 20  he negotiation. 
2810: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 61  See [sectref "Ca
2820: 6c 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d  llback Options"]
2830: 20 66 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 2e 0a   for more info..
2840: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61  .[list_end]..[ca
2850: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 75 6e 69  ll [cmd tls::uni
2860: 6d 70 6f 72 74 5d 20 5b 61 72 67 20 63 68 61 6e  mport] [arg chan
2870: 6e 65 6c 5d 5d 0a 0a 43 6f 6d 70 6c 69 6d 65 6e  nel]]..Complimen
2880: 74 20 74 6f 20 5b 63 6d 64 20 74 6c 73 3a 3a 69  t to [cmd tls::i
2890: 6d 70 6f 72 74 5d 2e 20 55 73 65 64 20 74 6f 20  mport]. Used to 
28a0: 72 65 6d 6f 76 65 20 74 68 65 20 74 6f 70 20 6c  remove the top l
28b0: 65 76 65 6c 20 73 74 61 63 6b 65 64 20 63 68 61  evel stacked cha
28c0: 6e 6e 65 6c 0a 66 72 6f 6d 20 5b 61 72 67 20 63  nnel.from [arg c
28d0: 68 61 6e 6e 65 6c 5d 2e 20 54 68 69 73 20 75 6e  hannel]. This un
28e0: 73 74 61 63 6b 73 20 74 68 65 20 65 6e 63 72 79  stacks the encry
28f0: 70 74 69 6f 6e 20 6f 66 20 61 20 72 65 67 75 6c  ption of a regul
2900: 61 72 20 54 43 4c 20 63 68 61 6e 6e 65 6c 2e 20  ar TCL channel. 
2910: 41 6e 0a 65 72 72 6f 72 20 69 73 20 74 68 72 6f  An.error is thro
2920: 77 6e 20 69 66 20 54 4c 53 20 69 73 20 6e 6f 74  wn if TLS is not
2930: 20 74 68 65 20 74 6f 70 20 73 74 61 63 6b 65 64   the top stacked
2940: 20 63 68 61 6e 6e 65 6c 20 74 79 70 65 2e 0a 0a   channel type...
2950: 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a  [call [cmd tls::
2960: 68 61 6e 64 73 68 61 6b 65 5d 20 5b 61 72 67 20  handshake] [arg 
2970: 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 46 6f 72 63 65  channel]]..Force
2980: 73 20 74 68 65 20 54 4c 53 20 6e 65 67 6f 74 69  s the TLS negoti
2990: 61 74 69 6f 6e 20 68 61 6e 64 73 68 61 6b 65 20  ation handshake 
29a0: 74 6f 20 74 61 6b 65 20 70 6c 61 63 65 20 69 6d  to take place im
29b0: 6d 65 64 69 61 74 65 6c 79 2c 20 61 6e 64 20 72  mediately, and r
29c0: 65 74 75 72 6e 73 20 30 0a 69 66 20 68 61 6e 64  eturns 0.if hand
29d0: 73 68 61 6b 65 20 69 73 20 73 74 69 6c 6c 20 69  shake is still i
29e0: 6e 20 70 72 6f 67 72 65 73 73 20 28 6e 6f 6e 2d  n progress (non-
29f0: 62 6c 6f 63 6b 69 6e 67 29 2c 20 6f 72 20 31 20  blocking), or 1 
2a00: 69 66 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65  if the handshake
2a10: 20 77 61 73 0a 73 75 63 63 65 73 73 66 75 6c 2e   was.successful.
2a20: 20 49 66 20 74 68 65 20 68 61 6e 64 73 68 61 6b   If the handshak
2a30: 65 20 66 61 69 6c 65 64 2c 20 61 6e 20 65 72 72  e failed, an err
2a40: 6f 72 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72  or will be retur
2a50: 6e 65 64 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  ned...[call [cmd
2a60: 20 74 6c 73 3a 3a 73 74 61 74 75 73 5d 20 5b 6f   tls::status] [o
2a70: 70 74 20 5b 6f 70 74 69 6f 6e 20 2d 6c 6f 63 61  pt [option -loca
2a80: 6c 5d 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c  l]] [arg channel
2a90: 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 20  ]]..Returns the 
2aa0: 63 75 72 72 65 6e 74 20 73 74 61 74 75 73 20 6f  current status o
2ab0: 66 20 61 6e 20 53 53 4c 20 63 68 61 6e 6e 65 6c  f an SSL channel
2ac0: 2e 20 54 68 65 20 72 65 73 75 6c 74 20 69 73 20  . The result is 
2ad0: 61 20 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61  a list of key-va
2ae0: 6c 75 65 0a 70 61 69 72 73 20 64 65 73 63 72 69  lue.pairs descri
2af0: 62 69 6e 67 20 74 68 65 20 53 53 4c 2c 20 63 65  bing the SSL, ce
2b00: 72 74 69 66 69 63 61 74 65 2c 20 61 6e 64 20 63  rtificate, and c
2b10: 65 72 74 69 66 69 63 61 74 65 20 76 65 72 69 66  ertificate verif
2b20: 69 63 61 74 69 6f 6e 20 73 74 61 74 75 73 2e 20  ication status. 
2b30: 49 66 0a 74 68 65 20 53 53 4c 20 68 61 6e 64 73  If.the SSL hands
2b40: 68 61 6b 65 20 68 61 73 20 6e 6f 74 20 79 65 74  hake has not yet
2b50: 20 63 6f 6d 70 6c 65 74 65 64 2c 20 61 6e 20 65   completed, an e
2b60: 6d 70 74 79 20 6c 69 73 74 20 69 73 20 72 65 74  mpty list is ret
2b70: 75 72 6e 65 64 2e 20 49 66 20 74 68 65 0a 5b 6f  urned. If the.[o
2b80: 70 74 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 20 6f 70  ption -local] op
2b90: 74 69 6f 6e 20 69 73 20 73 70 65 63 69 66 69 65  tion is specifie
2ba0: 64 2c 20 74 68 65 6e 20 74 68 65 20 6c 6f 63 61  d, then the loca
2bb0: 6c 20 63 65 72 74 69 66 69 63 61 74 65 20 69 73  l certificate is
2bc0: 20 75 73 65 64 2e 20 52 65 74 75 72 6e 65 64 0a   used. Returned.
2bd0: 76 61 6c 75 65 73 20 69 6e 63 6c 75 64 65 3a 0a  values include:.
2be0: 0a 5b 70 61 72 61 5d 0a 0a 53 53 4c 20 53 74 61  .[para]..SSL Sta
2bf0: 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  tus..[list_begin
2c00: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b   definitions]..[
2c10: 64 65 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20  def "[var alpn] 
2c20: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d  [arg protocol]"]
2c30: 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65  .The protocol se
2c40: 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70 70  lected after App
2c50: 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50  lication-Layer P
2c60: 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74  rotocol Negotiat
2c70: 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a 0a 5b 64 65  ion (ALPN)...[de
2c80: 66 20 22 5b 76 61 72 20 63 69 70 68 65 72 5d 20  f "[var cipher] 
2c90: 5b 61 72 67 20 63 69 70 68 65 72 5d 22 5d 0a 54  [arg cipher]"].T
2ca0: 68 65 20 63 75 72 72 65 6e 74 20 63 69 70 68 65  he current ciphe
2cb0: 72 20 69 6e 20 75 73 65 20 66 6f 72 20 74 68 65  r in use for the
2cc0: 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20   session...[def 
2cd0: 22 5b 76 61 72 20 70 65 65 72 6e 61 6d 65 5d 20  "[var peername] 
2ce0: 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 65  [arg name]"].The
2cf0: 20 70 65 65 72 6e 61 6d 65 20 66 72 6f 6d 20 74   peername from t
2d00: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a  he certificate..
2d10: 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 72 6f 74  .[def "[var prot
2d20: 6f 63 6f 6c 5d 20 5b 61 72 67 20 76 65 72 73 69  ocol] [arg versi
2d30: 6f 6e 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63  on]"].The protoc
2d40: 6f 6c 20 76 65 72 73 69 6f 6e 20 75 73 65 64 20  ol version used 
2d50: 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69  for the connecti
2d60: 6f 6e 3a 20 53 53 4c 32 2c 20 53 53 4c 33 2c 20  on: SSL2, SSL3, 
2d70: 54 4c 53 31 2c 20 54 4c 53 31 2e 31 2c 20 54 4c  TLS1, TLS1.1, TL
2d80: 53 31 2e 32 2c 20 54 4c 53 31 2e 33 2c 20 6f 72  S1.2, TLS1.3, or
2d90: 20 75 6e 6b 6e 6f 77 6e 2e 0a 0a 5b 64 65 66 20   unknown...[def 
2da0: 22 5b 76 61 72 20 73 62 69 74 73 5d 20 5b 61 72  "[var sbits] [ar
2db0: 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65  g n]"].The numbe
2dc0: 72 20 6f 66 20 62 69 74 73 20 75 73 65 64 20 66  r of bits used f
2dd0: 6f 72 20 74 68 65 20 73 65 73 73 69 6f 6e 20 6b  or the session k
2de0: 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ey...[def "[var 
2df0: 73 69 67 6e 61 74 75 72 65 48 61 73 68 41 6c 67  signatureHashAlg
2e00: 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67  orithm] [arg alg
2e10: 6f 72 69 74 68 6d 5d 22 5d 0a 54 68 65 20 73 69  orithm]"].The si
2e20: 67 6e 61 74 75 72 65 20 68 61 73 68 20 61 6c 67  gnature hash alg
2e30: 6f 72 69 74 68 6d 2e 0a 0a 5b 64 65 66 20 22 5b  orithm...[def "[
2e40: 76 61 72 20 73 69 67 6e 61 74 75 72 65 54 79 70  var signatureTyp
2e50: 65 5d 20 5b 61 72 67 20 74 79 70 65 5d 22 5d 0a  e] [arg type]"].
2e60: 54 68 65 20 73 69 67 6e 61 74 75 72 65 20 74 79  The signature ty
2e70: 70 65 20 76 61 6c 75 65 2e 0a 0a 5b 64 65 66 20  pe value...[def 
2e80: 22 5b 76 61 72 20 76 65 72 69 66 79 44 65 70 74  "[var verifyDept
2e90: 68 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4d 61 78  h] [arg n]"].Max
2ea0: 69 6d 75 6d 20 64 65 70 74 68 20 66 6f 72 20 74  imum depth for t
2eb0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 63  he certificate c
2ec0: 68 61 69 6e 20 76 65 72 69 66 69 63 61 74 69 6f  hain verificatio
2ed0: 6e 2e 20 44 65 66 61 75 6c 74 20 69 73 20 2d 31  n. Default is -1
2ee0: 2c 20 74 6f 20 63 68 65 63 6b 20 61 6c 6c 2e 0a  , to check all..
2ef0: 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72 69  .[def "[var veri
2f00: 66 79 4d 6f 64 65 5d 20 5b 61 72 67 20 6c 69 73  fyMode] [arg lis
2f10: 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 63 65 72  t]"].List of cer
2f20: 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63  tificate verific
2f30: 61 74 69 6f 6e 20 6d 6f 64 65 73 2e 0a 0a 5b 64  ation modes...[d
2f40: 65 66 20 22 5b 76 61 72 20 76 65 72 69 66 79 52  ef "[var verifyR
2f50: 65 73 75 6c 74 5d 20 5b 61 72 67 20 72 65 73 75  esult] [arg resu
2f60: 6c 74 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74  lt]"].Certificat
2f70: 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 72  e verification r
2f80: 65 73 75 6c 74 2e 0a 0a 5b 64 65 66 20 22 5b 76  esult...[def "[v
2f90: 61 72 20 63 61 5f 6e 61 6d 65 73 5d 20 5b 61 72  ar ca_names] [ar
2fa0: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f  g list]"].List o
2fb0: 66 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  f the Certificat
2fc0: 65 20 41 75 74 68 6f 72 69 74 69 65 73 20 75 73  e Authorities us
2fd0: 65 64 20 74 6f 20 63 72 65 61 74 65 20 74 68 65  ed to create the
2fe0: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b   certificate...[
2ff0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43 65 72 74 69  list_end]..Certi
3000: 66 69 63 61 74 65 20 53 74 61 74 75 73 0a 0a 5b  ficate Status..[
3010: 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e  list_begin defin
3020: 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b  itions]..[def "[
3030: 76 61 72 20 61 6c 6c 5d 20 5b 61 72 67 20 73 74  var all] [arg st
3040: 72 69 6e 67 5d 22 5d 0a 44 75 6d 70 20 6f 66 20  ring]"].Dump of 
3050: 61 6c 6c 20 63 65 72 74 69 66 69 63 61 74 65 20  all certificate 
3060: 69 6e 66 6f 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  info...[def "[va
3070: 72 20 76 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20  r version] [arg 
3080: 76 61 6c 75 65 5d 22 5d 0a 54 68 65 20 63 65 72  value]"].The cer
3090: 74 69 66 69 63 61 74 65 20 76 65 72 73 69 6f 6e  tificate version
30a0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
30b0: 72 69 61 6c 4e 75 6d 62 65 72 5d 20 5b 61 72 67  rialNumber] [arg
30c0: 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20 73   string]"].The s
30d0: 65 72 69 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20  erial number of 
30e0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
30f0: 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e  as a hex string.
3100: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67  ..[def "[var sig
3110: 6e 61 74 75 72 65 5d 20 5b 61 72 67 20 61 6c 67  nature] [arg alg
3120: 6f 72 69 74 68 6d 5d 22 5d 0a 43 69 70 68 65 72  orithm]"].Cipher
3130: 20 61 6c 67 6f 72 69 74 68 6d 20 75 73 65 64 20   algorithm used 
3140: 66 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 20  for certificate 
3150: 73 69 67 6e 61 74 75 72 65 2e 0a 0a 5b 64 65 66  signature...[def
3160: 20 22 5b 76 61 72 20 69 73 73 75 65 72 5d 20 5b   "[var issuer] [
3170: 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68  arg string]"].Th
3180: 65 20 64 69 73 74 69 6e 67 75 69 73 68 65 64 20  e distinguished 
3190: 6e 61 6d 65 20 28 44 4e 29 20 6f 66 20 74 68 65  name (DN) of the
31a0: 20 63 65 72 74 69 66 69 63 61 74 65 20 69 73 73   certificate iss
31b0: 75 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  uer...[def "[var
31c0: 20 6e 6f 74 42 65 66 6f 72 65 5d 20 5b 61 72 67   notBefore] [arg
31d0: 20 64 61 74 65 5d 22 5d 0a 54 68 65 20 62 65 67   date]"].The beg
31e0: 69 6e 6e 69 6e 67 20 64 61 74 65 20 6f 66 20 74  inning date of t
31f0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 76  he certificate v
3200: 61 6c 69 64 69 74 79 2e 0a 0a 5b 64 65 66 20 22  alidity...[def "
3210: 5b 76 61 72 20 6e 6f 74 41 66 74 65 72 5d 20 5b  [var notAfter] [
3220: 61 72 67 20 64 61 74 65 5d 22 5d 0a 54 68 65 20  arg date]"].The 
3230: 65 78 70 69 72 61 74 69 6f 6e 20 64 61 74 65 20  expiration date 
3240: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61  of the certifica
3250: 74 65 20 76 61 6c 69 64 69 74 79 2e 0a 0a 5b 64  te validity...[d
3260: 65 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74  ef "[var subject
3270: 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d  ] [arg string]"]
3280: 0a 54 68 65 20 64 69 73 74 69 6e 67 75 69 73 68  .The distinguish
3290: 65 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66 20  ed name (DN) of 
32a0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
32b0: 73 75 62 6a 65 63 74 2e 20 46 69 65 6c 64 73 20  subject. Fields 
32c0: 69 6e 63 6c 75 64 65 3a 20 43 6f 6d 6d 6f 6e 0a  include: Common.
32d0: 4e 61 6d 65 20 28 43 4e 29 2c 20 4f 72 67 61 6e  Name (CN), Organ
32e0: 69 7a 61 74 69 6f 6e 20 28 4f 29 2c 20 4c 6f 63  ization (O), Loc
32f0: 61 6c 69 74 79 20 6f 72 20 43 69 74 79 20 28 4c  ality or City (L
3300: 29 2c 20 53 74 61 74 65 20 6f 72 20 50 72 6f 76  ), State or Prov
3310: 69 6e 63 65 20 28 53 29 2c 20 61 6e 64 0a 43 6f  ince (S), and.Co
3320: 75 6e 74 72 79 20 4e 61 6d 65 20 28 43 29 2e 0a  untry Name (C)..
3330: 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73 73 75  .[def "[var issu
3340: 65 72 55 6e 69 71 75 65 49 44 5d 20 5b 61 72 67  erUniqueID] [arg
3350: 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20 69   string]"].The i
3360: 73 73 75 65 72 20 75 6e 69 71 75 65 20 69 64 2e  ssuer unique id.
3370: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 75 62  ..[def "[var sub
3380: 6a 65 63 74 55 6e 69 71 75 65 49 44 5d 20 5b 61  jectUniqueID] [a
3390: 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65  rg string]"].The
33a0: 20 73 75 62 6a 65 63 74 20 75 6e 69 71 75 65 20   subject unique 
33b0: 69 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  id...[def "[var 
33c0: 6e 75 6d 5f 65 78 74 65 6e 73 69 6f 6e 73 5d 20  num_extensions] 
33d0: 5b 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65 72  [arg n]"].Number
33e0: 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 20   of certificate 
33f0: 65 78 74 65 6e 73 69 6f 6e 73 2e 0a 0a 5b 64 65  extensions...[de
3400: 66 20 22 5b 76 61 72 20 65 78 74 65 6e 73 69 6f  f "[var extensio
3410: 6e 73 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d  ns] [arg list]"]
3420: 0a 4c 69 73 74 20 6f 66 20 63 65 72 74 69 66 69  .List of certifi
3430: 63 61 74 65 20 65 78 74 65 6e 73 69 6f 6e 20 6e  cate extension n
3440: 61 6d 65 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  ames...[def "[va
3450: 72 20 61 75 74 68 6f 72 69 74 79 4b 65 79 49 64  r authorityKeyId
3460: 65 6e 74 69 66 69 65 72 5d 20 5b 61 72 67 20 73  entifier] [arg s
3470: 74 72 69 6e 67 5d 22 5d 0a 41 75 74 68 6f 72 69  tring]"].Authori
3480: 74 79 20 4b 65 79 20 49 64 65 6e 74 69 66 69 65  ty Key Identifie
3490: 72 20 28 41 4b 49 29 20 6f 66 20 74 68 65 20 49  r (AKI) of the I
34a0: 73 73 75 69 6e 67 20 43 41 20 63 65 72 74 69 66  ssuing CA certif
34b0: 69 63 61 74 65 20 74 68 61 74 20 73 69 67 6e 65  icate that signe
34c0: 64 20 74 68 65 0a 53 53 4c 20 63 65 72 74 69 66  d the.SSL certif
34d0: 69 63 61 74 65 20 61 73 20 61 20 68 65 78 20 73  icate as a hex s
34e0: 74 72 69 6e 67 2e 20 54 68 69 73 20 76 61 6c 75  tring. This valu
34f0: 65 20 6d 61 74 63 68 65 73 20 74 68 65 20 53 4b  e matches the SK
3500: 49 20 76 61 6c 75 65 20 6f 66 20 74 68 65 0a 49  I value of the.I
3510: 6e 74 65 72 6d 65 64 69 61 74 65 20 43 41 20 63  ntermediate CA c
3520: 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65  ertificate...[de
3530: 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74 4b  f "[var subjectK
3540: 65 79 49 64 65 6e 74 69 66 69 65 72 5d 20 5b 61  eyIdentifier] [a
3550: 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 53 75 62  rg string]"].Sub
3560: 6a 65 63 74 20 4b 65 79 20 49 64 65 6e 74 69 66  ject Key Identif
3570: 69 65 72 20 28 53 4b 49 29 20 68 61 73 68 20 6f  ier (SKI) hash o
3580: 66 20 74 68 65 20 70 75 62 6c 69 63 20 6b 65 79  f the public key
3590: 20 69 6e 73 69 64 65 20 74 68 65 20 63 65 72 74   inside the cert
35a0: 69 66 69 63 61 74 65 20 61 73 20 61 0a 68 65 78  ificate as a.hex
35b0: 20 73 74 72 69 6e 67 2e 20 55 73 65 64 20 74 6f   string. Used to
35c0: 20 69 64 65 6e 74 69 66 79 20 63 65 72 74 69 66   identify certif
35d0: 69 63 61 74 65 73 20 74 68 61 74 20 63 6f 6e 74  icates that cont
35e0: 61 69 6e 20 61 20 70 61 72 74 69 63 75 6c 61 72  ain a particular
35f0: 20 70 75 62 6c 69 63 20 6b 65 79 2e 0a 0a 5b 64   public key...[d
3600: 65 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74  ef "[var subject
3610: 41 6c 74 4e 61 6d 65 5d 20 5b 61 72 67 20 6c 69  AltName] [arg li
3620: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 61 6c  st]"].List of al
3630: 6c 20 6f 66 20 74 68 65 20 53 75 62 6a 65 63 74  l of the Subject
3640: 20 41 6c 74 65 72 6e 61 74 69 76 65 20 4e 61 6d   Alternative Nam
3650: 65 73 20 28 53 41 4e 29 20 69 6e 63 6c 75 64 69  es (SAN) includi
3660: 6e 67 20 64 6f 6d 61 69 6e 20 6e 61 6d 65 73 2c  ng domain names,
3670: 20 73 75 62 0a 64 6f 6d 61 69 6e 73 2c 20 61 6e   sub.domains, an
3680: 64 20 49 50 20 61 64 64 72 65 73 73 65 73 20 74  d IP addresses t
3690: 68 61 74 20 61 72 65 20 73 65 63 75 72 65 64 20  hat are secured 
36a0: 62 79 20 74 68 65 20 63 65 72 74 69 66 69 63 61  by the certifica
36b0: 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  te...[def "[var 
36c0: 6f 63 73 70 5d 20 5b 61 72 67 20 6c 69 73 74 5d  ocsp] [arg list]
36d0: 22 5d 0a 4c 69 73 74 20 6f 66 20 61 6c 6c 20 4f  "].List of all O
36e0: 6e 6c 69 6e 65 20 43 65 72 74 69 66 69 63 61 74  nline Certificat
36f0: 65 20 53 74 61 74 75 73 20 50 72 6f 74 6f 63 6f  e Status Protoco
3700: 6c 20 28 4f 43 53 50 29 20 55 52 4c 73 20 74 68  l (OCSP) URLs th
3710: 61 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74  at can be used t
3720: 6f 0a 63 68 65 63 6b 20 74 68 65 20 76 61 6c 69  o.check the vali
3730: 64 69 74 79 20 6f 66 20 74 68 69 73 20 63 65 72  dity of this cer
3740: 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20  tificate...[def 
3750: 22 5b 76 61 72 20 63 65 72 74 69 66 69 63 61 74  "[var certificat
3760: 65 5d 20 5b 61 72 67 20 63 65 72 74 5d 22 5d 0a  e] [arg cert]"].
3770: 54 68 65 20 50 45 4d 20 65 6e 63 6f 64 65 64 20  The PEM encoded 
3780: 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64  certificate...[d
3790: 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75  ef "[var signatu
37a0: 72 65 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72  reAlgorithm] [ar
37b0: 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43  g algorithm]"].C
37c0: 69 70 68 65 72 20 61 6c 67 6f 72 69 74 68 6d 20  ipher algorithm 
37d0: 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 65 72  used for the cer
37e0: 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75  tificate signatu
37f0: 72 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  re...[def "[var 
3800: 73 69 67 6e 61 74 75 72 65 56 61 6c 75 65 5d 20  signatureValue] 
3810: 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 43  [arg string]"].C
3820: 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61  ertificate signa
3830: 74 75 72 65 20 61 73 20 61 20 68 65 78 20 73 74  ture as a hex st
3840: 72 69 6e 67 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  ring...[def "[va
3850: 72 20 73 69 67 6e 61 74 75 72 65 44 69 67 65 73  r signatureDiges
3860: 74 5d 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d  t] [arg version]
3870: 22 5d 0a 43 65 72 74 69 66 69 63 61 74 65 20 73  "].Certificate s
3880: 69 67 6e 69 6e 67 20 64 69 67 65 73 74 20 61 73  igning digest as
3890: 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a   a hex string...
38a0: 5b 64 65 66 20 22 5b 76 61 72 20 70 75 62 6c 69  [def "[var publi
38b0: 63 4b 65 79 41 6c 67 6f 72 69 74 68 6d 5d 20 5b  cKeyAlgorithm] [
38c0: 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d  arg algorithm]"]
38d0: 0a 43 65 72 74 69 66 69 63 61 74 65 20 73 69 67  .Certificate sig
38e0: 6e 61 74 75 72 65 20 70 75 62 6c 69 63 20 6b 65  nature public ke
38f0: 79 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 0a 5b 64  y algorithm...[d
3900: 65 66 20 22 5b 76 61 72 20 70 75 62 6c 69 63 4b  ef "[var publicK
3910: 65 79 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  ey] [arg string]
3920: 22 5d 0a 43 65 72 74 69 66 69 63 61 74 65 20 73  "].Certificate s
3930: 69 67 6e 61 74 75 72 65 20 70 75 62 6c 69 63 20  ignature public 
3940: 6b 65 79 20 61 73 20 61 20 68 65 78 20 73 74 72  key as a hex str
3950: 69 6e 67 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ing...[def "[var
3960: 20 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d   bits] [arg n]"]
3970: 0a 4e 75 6d 62 65 72 20 6f 66 20 62 69 74 73 20  .Number of bits 
3980: 75 73 65 64 20 66 6f 72 20 63 65 72 74 69 66 69  used for certifi
3990: 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 6b  cate signature k
39a0: 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ey...[def "[var 
39b0: 73 65 6c 66 5f 73 69 67 6e 65 64 5d 20 5b 61 72  self_signed] [ar
39c0: 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65  g boolean]"].Whe
39d0: 74 68 65 72 20 74 68 65 20 63 65 72 74 69 66 69  ther the certifi
39e0: 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 69  cate signature i
39f0: 73 20 73 65 6c 66 20 73 69 67 6e 65 64 2e 0a 0a  s self signed...
3a00: 5b 64 65 66 20 22 5b 76 61 72 20 73 68 61 31 5f  [def "[var sha1_
3a10: 68 61 73 68 5d 20 5b 61 72 67 20 68 61 73 68 5d  hash] [arg hash]
3a20: 22 5d 0a 54 68 65 20 53 48 41 31 20 68 61 73 68  "].The SHA1 hash
3a30: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
3a40: 61 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72  ate as a hex str
3a50: 69 6e 67 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ing...[def "[var
3a60: 20 73 68 61 32 35 36 5f 68 61 73 68 5d 20 5b 61   sha256_hash] [a
3a70: 72 67 20 68 61 73 68 5d 22 5d 0a 54 68 65 20 53  rg hash]"].The S
3a80: 48 41 32 35 36 20 68 61 73 68 20 6f 66 20 74 68  HA256 hash of th
3a90: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73  e certificate as
3aa0: 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a   a hex string...
3ab0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c  [list_end]..[cal
3ac0: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 6f 6e 6e  l [cmd tls::conn
3ad0: 65 63 74 69 6f 6e 5d 20 5b 61 72 67 20 63 68 61  ection] [arg cha
3ae0: 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72 6e 73 20  nnel]]..Returns 
3af0: 74 68 65 20 63 75 72 72 65 6e 74 20 63 6f 6e 6e  the current conn
3b00: 65 63 74 69 6f 6e 20 73 74 61 74 75 73 20 6f 66  ection status of
3b10: 20 61 6e 20 53 53 4c 20 63 68 61 6e 6e 65 6c 2e   an SSL channel.
3b20: 20 54 68 65 20 72 65 73 75 6c 74 20 69 73 20 61   The result is a
3b30: 20 6c 69 73 74 0a 6f 66 20 6b 65 79 2d 76 61 6c   list.of key-val
3b40: 75 65 20 70 61 69 72 73 20 64 65 73 63 72 69 62  ue pairs describ
3b50: 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65 63 74 69  ing the connecti
3b60: 6f 6e 2e 20 52 65 74 75 72 6e 65 64 20 76 61 6c  on. Returned val
3b70: 75 65 73 20 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70  ues include:..[p
3b80: 61 72 61 5d 0a 0a 53 53 4c 20 53 74 61 74 75 73  ara]..SSL Status
3b90: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
3ba0: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
3bb0: 20 22 5b 76 61 72 20 73 74 61 74 65 5d 20 5b 61   "[var state] [a
3bc0: 72 67 20 73 74 61 74 65 5d 22 5d 0a 53 74 61 74  rg state]"].Stat
3bd0: 65 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63 74  e of the connect
3be0: 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ion...[def "[var
3bf0: 20 73 65 72 76 65 72 6e 61 6d 65 5d 20 5b 61 72   servername] [ar
3c00: 67 20 6e 61 6d 65 5d 22 5d 0a 54 68 65 20 6e 61  g name]"].The na
3c10: 6d 65 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65 63  me of the connec
3c20: 74 65 64 20 74 6f 20 73 65 72 76 65 72 2e 0a 0a  ted to server...
3c30: 5b 64 65 66 20 22 5b 76 61 72 20 70 72 6f 74 6f  [def "[var proto
3c40: 63 6f 6c 5d 20 5b 61 72 67 20 76 65 72 73 69 6f  col] [arg versio
3c50: 6e 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f  n]"].The protoco
3c60: 6c 20 76 65 72 73 69 6f 6e 20 75 73 65 64 20 66  l version used f
3c70: 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f  or the connectio
3c80: 6e 3a 20 53 53 4c 32 2c 20 53 53 4c 33 2c 20 54  n: SSL2, SSL3, T
3c90: 4c 53 31 2c 20 54 4c 53 31 2e 31 2c 20 54 4c 53  LS1, TLS1.1, TLS
3ca0: 31 2e 32 2c 20 54 4c 53 31 2e 33 2c 20 6f 72 20  1.2, TLS1.3, or 
3cb0: 75 6e 6b 6e 6f 77 6e 2e 0a 0a 5b 64 65 66 20 22  unknown...[def "
3cc0: 5b 76 61 72 20 72 65 6e 65 67 6f 74 69 61 74 69  [var renegotiati
3cd0: 6f 6e 5f 61 6c 6c 6f 77 65 64 5d 20 5b 61 72 67  on_allowed] [arg
3ce0: 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74   boolean]"].Whet
3cf0: 68 65 72 20 70 72 6f 74 6f 63 6f 6c 20 72 65 6e  her protocol ren
3d00: 65 67 6f 74 69 61 74 69 6f 6e 20 69 73 20 73 75  egotiation is su
3d10: 70 70 6f 72 74 65 64 20 6f 72 20 6e 6f 74 2e 0a  pported or not..
3d20: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 63 75  .[def "[var secu
3d30: 72 69 74 79 5f 6c 65 76 65 6c 5d 20 5b 61 72 67  rity_level] [arg
3d40: 20 6c 65 76 65 6c 5d 22 5d 0a 54 68 65 20 73 65   level]"].The se
3d50: 63 75 72 69 74 79 20 6c 65 76 65 6c 20 75 73 65  curity level use
3d60: 64 20 66 6f 72 20 73 65 6c 65 63 74 69 6f 6e 20  d for selection 
3d70: 6f 66 20 63 69 70 68 65 72 73 2c 20 6b 65 79 20  of ciphers, key 
3d80: 73 69 7a 65 2c 20 65 74 63 2e 0a 0a 5b 64 65 66  size, etc...[def
3d90: 20 22 5b 76 61 72 20 73 65 73 73 69 6f 6e 5f 72   "[var session_r
3da0: 65 75 73 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c  eused] [arg bool
3db0: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74  ean]"].Whether t
3dc0: 68 65 20 73 65 73 73 69 6f 6e 20 68 61 73 20 62  he session has b
3dd0: 65 65 6e 20 72 65 75 73 65 64 20 6f 72 20 6e 6f  een reused or no
3de0: 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 69  t...[def "[var i
3df0: 73 5f 73 65 72 76 65 72 5d 20 5b 61 72 67 20 62  s_server] [arg b
3e00: 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65  oolean]"].Whethe
3e10: 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  r the connection
3e20: 20 69 73 20 63 6f 6e 66 69 67 75 72 65 64 20 61   is configured a
3e30: 73 20 61 20 73 65 72 76 65 72 20 28 31 29 20 6f  s a server (1) o
3e40: 72 20 63 6c 69 65 6e 74 20 28 30 29 2e 0a 0a 5b  r client (0)...[
3e50: 64 65 66 20 22 5b 76 61 72 20 63 6f 6d 70 72 65  def "[var compre
3e60: 73 73 69 6f 6e 5d 20 5b 61 72 67 20 6d 6f 64 65  ssion] [arg mode
3e70: 5d 22 5d 0a 43 6f 6d 70 72 65 73 73 69 6f 6e 20  ]"].Compression 
3e80: 6d 65 74 68 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b  method...[def "[
3e90: 76 61 72 20 65 78 70 61 6e 73 69 6f 6e 5d 20 5b  var expansion] [
3ea0: 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 45 78 70 61  arg mode]"].Expa
3eb0: 6e 73 69 6f 6e 20 6d 65 74 68 6f 64 2e 0a 0a 5b  nsion method...[
3ec0: 64 65 66 20 22 5b 76 61 72 20 63 61 4c 69 73 74  def "[var caList
3ed0: 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c  ] [arg list]"].L
3ee0: 69 73 74 20 6f 66 20 43 65 72 74 69 66 69 63 61  ist of Certifica
3ef0: 74 65 20 41 75 74 68 6f 72 69 74 69 65 73 20 28  te Authorities (
3f00: 43 41 29 20 66 6f 72 20 58 2e 35 30 39 20 63 65  CA) for X.509 ce
3f10: 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b 6c 69 73  rtificate...[lis
3f20: 74 5f 65 6e 64 5d 0a 0a 43 69 70 68 65 72 20 49  t_end]..Cipher I
3f30: 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  nfo..[list_begin
3f40: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b   definitions]..[
3f50: 64 65 66 20 22 5b 76 61 72 20 63 69 70 68 65 72  def "[var cipher
3f60: 5d 20 5b 61 72 67 20 63 69 70 68 65 72 5d 22 5d  ] [arg cipher]"]
3f70: 0a 54 68 65 20 63 75 72 72 65 6e 74 20 63 69 70  .The current cip
3f80: 68 65 72 20 69 6e 20 75 73 65 20 66 6f 72 20 74  her in use for t
3f90: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a  he connection...
3fa0: 5b 64 65 66 20 22 5b 76 61 72 20 73 74 61 6e 64  [def "[var stand
3fb0: 61 72 64 5f 6e 61 6d 65 5d 20 5b 61 72 67 20 6e  ard_name] [arg n
3fc0: 61 6d 65 5d 22 5d 0a 54 68 65 20 73 74 61 6e 64  ame]"].The stand
3fd0: 61 72 64 20 52 46 43 20 6e 61 6d 65 20 6f 66 20  ard RFC name of 
3fe0: 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b  cipher...[def "[
3ff0: 76 61 72 20 61 6c 67 6f 72 69 74 68 6d 5f 62 69  var algorithm_bi
4000: 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 54 68  ts] [arg n]"].Th
4010: 65 20 6e 75 6d 62 65 72 20 6f 66 20 70 72 6f 63  e number of proc
4020: 65 73 73 65 64 20 62 69 74 73 20 75 73 65 64 20  essed bits used 
4030: 66 6f 72 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65  for cipher...[de
4040: 66 20 22 5b 76 61 72 20 73 65 63 72 65 74 5f 62  f "[var secret_b
4050: 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 54  its] [arg n]"].T
4060: 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 65 63  he number of sec
4070: 72 65 74 20 62 69 74 73 20 75 73 65 64 20 66 6f  ret bits used fo
4080: 72 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20  r cipher...[def 
4090: 22 5b 76 61 72 20 6d 69 6e 5f 76 65 72 73 69 6f  "[var min_versio
40a0: 6e 5d 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d  n] [arg version]
40b0: 22 5d 0a 54 68 65 20 6d 69 6e 69 6d 75 6d 20 70  "].The minimum p
40c0: 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 20  rotocol version 
40d0: 66 6f 72 20 63 69 70 68 65 72 2e 0a 0a 5b 64 65  for cipher...[de
40e0: 66 20 22 5b 76 61 72 20 63 69 70 68 65 72 5f 69  f "[var cipher_i
40f0: 73 5f 61 65 61 64 5d 20 5b 61 72 67 20 62 6f 6f  s_aead] [arg boo
4100: 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20  lean]"].Whether 
4110: 74 68 65 20 63 69 70 68 65 72 20 69 73 20 41 75  the cipher is Au
4120: 74 68 65 6e 74 69 63 61 74 65 64 20 45 6e 63 72  thenticated Encr
4130: 79 70 74 69 6f 6e 20 77 69 74 68 20 41 73 73 6f  yption with Asso
4140: 63 69 61 74 65 64 20 44 61 74 61 20 28 41 45 41  ciated Data (AEA
4150: 44 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  D)...[def "[var 
4160: 63 69 70 68 65 72 5f 69 64 5d 20 5b 61 72 67 20  cipher_id] [arg 
4170: 69 64 5d 22 5d 0a 54 68 65 20 4f 70 65 6e 53 53  id]"].The OpenSS
4180: 4c 20 63 69 70 68 65 72 20 69 64 2e 0a 0a 5b 64  L cipher id...[d
4190: 65 66 20 22 5b 76 61 72 20 64 65 73 63 72 69 70  ef "[var descrip
41a0: 74 69 6f 6e 5d 20 5b 61 72 67 20 73 74 72 69 6e  tion] [arg strin
41b0: 67 5d 22 5d 0a 41 20 74 65 78 74 20 64 65 73 63  g]"].A text desc
41c0: 72 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 63  ription of the c
41d0: 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  ipher...[def "[v
41e0: 61 72 20 68 61 6e 64 73 68 61 6b 65 5f 64 69 67  ar handshake_dig
41f0: 65 73 74 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61  est] [arg boolea
4200: 6e 5d 22 5d 0a 44 69 67 65 73 74 20 75 73 65 64  n]"].Digest used
4210: 20 64 75 72 69 6e 67 20 68 61 6e 64 73 68 61 6b   during handshak
4220: 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a  e...[list_end]..
4230: 53 65 73 73 69 6f 6e 20 49 6e 66 6f 0a 0a 5b 6c  Session Info..[l
4240: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
4250: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76  tions]..[def "[v
4260: 61 72 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70 72  ar alpn] [arg pr
4270: 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70 72  otocol]"].The pr
4280: 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20  otocol selected 
4290: 61 66 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f  after Applicatio
42a0: 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c  n-Layer Protocol
42b0: 20 4e 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c   Negotiation (AL
42c0: 50 4e 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  PN)...[def "[var
42d0: 20 72 65 73 75 6d 61 62 6c 65 5d 20 5b 61 72 67   resumable] [arg
42e0: 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74   boolean]"].Whet
42f0: 68 65 72 20 74 68 65 20 73 65 73 73 69 6f 6e 20  her the session 
4300: 63 61 6e 20 62 65 20 72 65 73 75 6d 65 64 20 6f  can be resumed o
4310: 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b 76  r not...[def "[v
4320: 61 72 20 73 74 61 72 74 5f 74 69 6d 65 5d 20 5b  ar start_time] [
4330: 61 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 54  arg seconds]"].T
4340: 69 6d 65 20 73 69 6e 63 65 20 73 65 73 73 69 6f  ime since sessio
4350: 6e 20 73 74 61 72 74 65 64 20 69 6e 20 73 65 63  n started in sec
4360: 6f 6e 64 73 20 73 69 6e 63 65 20 65 70 6f 63 68  onds since epoch
4370: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 74 69  ...[def "[var ti
4380: 6d 65 6f 75 74 5d 20 5b 61 72 67 20 73 65 63 6f  meout] [arg seco
4390: 6e 64 73 5d 22 5d 0a 4d 61 78 20 64 75 72 61 74  nds]"].Max durat
43a0: 69 6f 6e 20 6f 66 20 73 65 73 73 69 6f 6e 20 69  ion of session i
43b0: 6e 20 73 65 63 6f 6e 64 73 20 62 65 66 6f 72 65  n seconds before
43c0: 20 74 69 6d 65 2d 6f 75 74 2e 0a 0a 5b 64 65 66   time-out...[def
43d0: 20 22 5b 76 61 72 20 6c 69 66 65 74 69 6d 65 5d   "[var lifetime]
43e0: 20 5b 61 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d   [arg seconds]"]
43f0: 0a 53 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20  .Session ticket 
4400: 6c 69 66 65 74 69 6d 65 20 68 69 6e 74 20 69 6e  lifetime hint in
4410: 20 73 65 63 6f 6e 64 73 2e 0a 0a 5b 64 65 66 20   seconds...[def 
4420: 22 5b 76 61 72 20 73 65 73 73 69 6f 6e 5f 69 64  "[var session_id
4430: 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74  ] [arg binary_st
4440: 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73  ring]"].Unique s
4450: 65 73 73 69 6f 6e 20 69 64 20 66 6f 72 20 75 73  ession id for us
4460: 65 20 69 6e 20 72 65 73 75 6d 69 6e 67 20 74 68  e in resuming th
4470: 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66  e session...[def
4480: 20 22 5b 76 61 72 20 73 65 73 73 69 6f 6e 5f 74   "[var session_t
4490: 69 63 6b 65 74 5d 20 5b 61 72 67 20 62 69 6e 61  icket] [arg bina
44a0: 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e 69  ry_string]"].Uni
44b0: 71 75 65 20 73 65 73 73 69 6f 6e 20 74 69 63 6b  que session tick
44c0: 65 74 20 66 6f 72 20 75 73 65 20 69 6e 20 72 65  et for use in re
44d0: 73 75 6d 69 6e 67 20 74 68 65 20 73 65 73 73 69  suming the sessi
44e0: 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  on...[def "[var 
44f0: 74 69 63 6b 65 74 5f 61 70 70 5f 64 61 74 61 5d  ticket_app_data]
4500: 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72   [arg binary_str
4510: 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65  ing]"].Unique se
4520: 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 61 70 70  ssion ticket app
4530: 6c 69 63 61 74 69 6f 6e 20 64 61 74 61 2e 0a 0a  lication data...
4540: 5b 64 65 66 20 22 5b 76 61 72 20 6d 61 73 74 65  [def "[var maste
4550: 72 5f 6b 65 79 5d 20 5b 61 72 67 20 62 69 6e 61  r_key] [arg bina
4560: 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e 69  ry_string]"].Uni
4570: 71 75 65 20 73 65 73 73 69 6f 6e 20 6d 61 73 74  que session mast
4580: 65 72 20 6b 65 79 2e 0a 0a 5b 64 65 66 20 22 5b  er key...[def "[
4590: 76 61 72 20 73 65 73 73 69 6f 6e 5f 63 61 63 68  var session_cach
45a0: 65 5f 6d 6f 64 65 5d 20 5b 61 72 67 20 6d 6f 64  e_mode] [arg mod
45b0: 65 5d 22 5d 0a 53 65 72 76 65 72 20 63 61 63 68  e]"].Server cach
45c0: 65 20 6d 6f 64 65 20 28 63 6c 69 65 6e 74 2c 20  e mode (client, 
45d0: 73 65 72 76 65 72 2c 20 6f 72 20 62 6f 74 68 29  server, or both)
45e0: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
45f0: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 63  call [cmd tls::c
4600: 69 70 68 65 72 73 5d 20 5b 6f 70 74 20 5b 61 72  iphers] [opt [ar
4610: 67 20 70 72 6f 74 6f 63 6f 6c 5d 5d 20 5b 6f 70  g protocol]] [op
4620: 74 20 5b 61 72 67 20 76 65 72 62 6f 73 65 5d 5d  t [arg verbose]]
4630: 20 5b 6f 70 74 20 5b 61 72 67 20 73 75 70 70 6f   [opt [arg suppo
4640: 72 74 65 64 5d 5d 5d 0a 0a 57 69 74 68 6f 75 74  rted]]]..Without
4650: 20 61 6e 79 20 61 72 67 73 2c 20 72 65 74 75 72   any args, retur
4660: 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 61 6c 6c  ns a list of all
4670: 20 73 79 6d 6d 65 74 72 69 63 20 63 69 70 68 65   symmetric ciphe
4680: 72 73 20 66 6f 72 20 75 73 65 20 77 69 74 68 20  rs for use with 
4690: 74 68 65 0a 5b 61 72 67 20 2d 63 69 70 68 65 72  the.[arg -cipher
46a0: 5d 20 6f 70 74 69 6f 6e 2e 20 57 69 74 68 20 5b  ] option. With [
46b0: 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 2c 20 6f  arg protocol], o
46c0: 6e 6c 79 20 74 68 65 20 63 69 70 68 65 72 73 20  nly the ciphers 
46d0: 73 75 70 70 6f 72 74 65 64 20 66 6f 72 20 74 68  supported for th
46e0: 61 74 0a 70 72 6f 74 6f 63 6f 6c 20 61 72 65 20  at.protocol are 
46f0: 72 65 74 75 72 6e 65 64 2e 20 53 65 65 20 74 68  returned. See th
4700: 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74  e [cmd tls::prot
4710: 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66  ocols] command f
4720: 6f 72 20 74 68 65 20 73 75 70 70 6f 72 74 65 64  or the supported
4730: 0a 70 72 6f 74 6f 63 6f 6c 73 2e 20 49 66 20 5b  .protocols. If [
4740: 61 72 67 20 76 65 72 62 6f 73 65 5d 20 69 73 20  arg verbose] is 
4750: 73 70 65 63 69 66 69 65 64 20 61 73 20 74 72 75  specified as tru
4760: 65 20 74 68 65 6e 20 61 20 76 65 72 62 6f 73 65  e then a verbose
4770: 2c 20 68 75 6d 61 6e 20 72 65 61 64 61 62 6c 65  , human readable
4780: 0a 6c 69 73 74 20 69 73 20 72 65 74 75 72 6e 65  .list is returne
4790: 64 20 77 69 74 68 20 61 64 64 69 74 69 6f 6e 61  d with additiona
47a0: 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e  l information on
47b0: 20 74 68 65 20 63 69 70 68 65 72 2e 20 49 66 20   the cipher. If 
47c0: 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 5d 0a  [arg supported].
47d0: 69 73 20 73 70 65 63 69 66 69 65 64 20 61 73 20  is specified as 
47e0: 74 72 75 65 2c 20 74 68 65 6e 20 6f 6e 6c 79 20  true, then only 
47f0: 74 68 65 20 63 69 70 68 65 72 73 20 73 75 70 70  the ciphers supp
4800: 6f 72 74 65 64 20 66 6f 72 20 70 72 6f 74 6f 63  orted for protoc
4810: 6f 6c 20 77 69 6c 6c 20 62 65 20 6c 69 73 74 65  ol will be liste
4820: 64 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  d...[call [cmd t
4830: 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 5d 0a  ls::protocols]].
4840: 0a 52 65 74 75 72 6e 73 20 61 20 6c 69 73 74 20  .Returns a list 
4850: 6f 66 20 74 68 65 20 73 75 70 70 6f 72 74 65 64  of the supported
4860: 20 53 53 4c 2f 54 4c 53 20 70 72 6f 74 6f 63 6f   SSL/TLS protoco
4870: 6c 73 2e 20 56 61 6c 69 64 20 76 61 6c 75 65 73  ls. Valid values
4880: 20 61 72 65 3a 0a 5b 63 6f 6e 73 74 20 73 73 6c   are:.[const ssl
4890: 32 5d 2c 20 5b 63 6f 6e 73 74 20 73 73 6c 33 5d  2], [const ssl3]
48a0: 2c 20 5b 63 6f 6e 73 74 20 74 6c 73 31 5d 2c 20  , [const tls1], 
48b0: 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 31 5d 2c 20  [const tls1.1], 
48c0: 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 32 5d 2c 20  [const tls1.2], 
48d0: 61 6e 64 0a 5b 63 6f 6e 73 74 20 74 6c 73 31 2e  and.[const tls1.
48e0: 33 5d 2e 20 45 78 61 63 74 20 6c 69 73 74 20 64  3]. Exact list d
48f0: 65 70 65 6e 64 73 20 6f 6e 20 4f 70 65 6e 53 53  epends on OpenSS
4900: 4c 20 76 65 72 73 69 6f 6e 20 61 6e 64 20 63 6f  L version and co
4910: 6d 70 69 6c 65 20 74 69 6d 65 20 66 6c 61 67 73  mpile time flags
4920: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ...[call [cmd tl
4930: 73 3a 3a 76 65 72 73 69 6f 6e 5d 5d 0a 0a 52 65  s::version]]..Re
4940: 74 75 72 6e 73 20 74 68 65 20 4f 70 65 6e 53 53  turns the OpenSS
4950: 4c 20 76 65 72 73 69 6f 6e 20 73 74 72 69 6e 67  L version string
4960: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 0a  ...[list_end]...
4970: 5b 73 65 63 74 69 6f 6e 20 22 43 65 72 74 69 66  [section "Certif
4980: 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e  icate Validation
4990: 22 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20  "]..[subsection 
49a0: 22 50 4b 49 20 61 6e 64 20 43 65 72 74 69 66 69  "PKI and Certifi
49b0: 63 61 74 65 73 22 5d 0a 0a 55 73 69 6e 67 20 74  cates"]..Using t
49c0: 68 65 20 50 75 62 6c 69 63 20 4b 65 79 20 49 6e  he Public Key In
49d0: 66 72 61 73 74 72 75 63 74 75 72 65 20 28 50 4b  frastructure (PK
49e0: 49 29 2c 20 65 61 63 68 20 75 73 65 72 20 63 72  I), each user cr
49f0: 65 61 74 65 73 20 61 20 70 72 69 76 61 74 65 20  eates a private 
4a00: 6b 65 79 20 74 68 61 74 0a 6f 6e 6c 79 20 74 68  key that.only th
4a10: 65 79 20 6b 6e 6f 77 20 61 62 6f 75 74 20 61 6e  ey know about an
4a20: 64 20 61 20 70 75 62 6c 69 63 20 6b 65 79 20 74  d a public key t
4a30: 68 65 79 20 63 61 6e 20 65 78 63 68 61 6e 67 65  hey can exchange
4a40: 20 77 69 74 68 20 6f 74 68 65 72 73 20 66 6f 72   with others for
4a50: 20 75 73 65 20 69 6e 0a 65 6e 63 72 79 70 74 69   use in.encrypti
4a60: 6e 67 20 61 6e 64 20 64 65 63 72 79 70 74 69 6e  ng and decryptin
4a70: 67 20 64 61 74 61 2e 20 54 68 65 20 70 72 6f 63  g data. The proc
4a80: 65 73 73 20 69 73 20 74 68 65 20 73 65 6e 64 65  ess is the sende
4a90: 72 20 65 6e 63 72 79 70 74 73 20 74 68 65 69 72  r encrypts their
4aa0: 20 64 61 74 61 0a 75 73 69 6e 67 20 74 68 65 69   data.using thei
4ab0: 72 20 70 72 69 76 61 74 65 20 6b 65 79 20 61 6e  r private key an
4ac0: 64 20 74 68 65 20 72 65 63 65 69 76 65 72 27 73  d the receiver's
4ad0: 20 70 75 62 6c 69 63 20 6b 65 79 2e 20 54 68 65   public key. The
4ae0: 20 64 61 74 61 20 69 73 20 74 68 65 6e 20 73 65   data is then se
4af0: 6e 74 0a 74 6f 20 74 68 65 20 72 65 63 65 69 76  nt.to the receiv
4b00: 65 72 2e 20 49 6e 20 61 20 73 69 6d 69 6c 61 72  er. In a similar
4b10: 20 6d 61 6e 6e 65 72 2c 20 74 68 65 20 72 65 63   manner, the rec
4b20: 65 69 76 65 72 20 75 73 65 73 20 74 68 65 69 72  eiver uses their
4b30: 20 70 72 69 76 61 74 65 20 6b 65 79 20 61 6e 64   private key and
4b40: 0a 74 68 65 20 73 65 6e 64 65 72 27 73 20 70 75  .the sender's pu
4b50: 62 6c 69 63 20 6b 65 79 20 74 6f 20 64 65 63 72  blic key to decr
4b60: 79 70 74 20 74 68 65 20 64 61 74 61 2e 20 54 68  ypt the data. Th
4b70: 69 73 20 70 72 6f 76 69 64 65 73 20 64 61 74 61  is provides data
4b80: 20 69 6e 74 65 67 72 69 74 79 2c 20 74 6f 0a 65   integrity, to.e
4b90: 6e 73 75 72 65 20 74 68 65 20 64 61 74 61 20 63  nsure the data c
4ba0: 61 6e 27 74 20 62 65 20 76 69 65 77 65 64 20 6f  an't be viewed o
4bb0: 72 20 61 6c 74 65 72 65 64 20 64 75 72 69 6e 67  r altered during
4bc0: 20 74 72 61 6e 73 70 6f 72 74 2e 20 53 65 65 20   transport. See 
4bd0: 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79  the.[option -key
4be0: 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 6b  ] and [option -k
4bf0: 65 79 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20  eyfile] options 
4c00: 66 6f 72 20 68 6f 77 20 74 6f 20 73 70 65 63 69  for how to speci
4c10: 66 79 20 74 68 65 20 70 72 69 76 61 74 65 20 6b  fy the private k
4c20: 65 79 2e 0a 41 6c 73 6f 20 73 65 65 20 74 68 65  ey..Also see the
4c30: 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f   [option -passwo
4c40: 72 64 5d 20 6f 70 74 69 6f 6e 20 66 6f 72 20 68  rd] option for h
4c50: 6f 77 20 74 6f 20 70 72 6f 76 69 64 65 20 74 68  ow to provide th
4c60: 65 20 70 61 73 73 77 6f 72 64 2e 0a 5b 70 61 72  e password..[par
4c70: 61 5d 0a 49 6e 20 6f 72 64 65 72 20 74 6f 20 70  a].In order to p
4c80: 72 6f 76 69 64 65 20 61 75 74 68 65 6e 74 69 63  rovide authentic
4c90: 61 74 69 6f 6e 2c 20 69 2e 65 2e 20 65 6e 73 75  ation, i.e. ensu
4ca0: 72 69 6e 67 20 73 6f 6d 65 6f 6e 65 20 69 73 20  ring someone is 
4cb0: 77 68 6f 20 74 68 65 79 20 73 61 79 20 74 68 65  who they say the
4cc0: 79 0a 61 72 65 2c 20 74 68 65 20 70 75 62 6c 69  y.are, the publi
4cd0: 63 20 6b 65 79 20 61 6e 64 20 75 73 65 72 20 69  c key and user i
4ce0: 64 65 6e 74 69 66 69 63 61 74 69 6f 6e 20 69 6e  dentification in
4cf0: 66 6f 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20  fo is stored in 
4d00: 61 20 58 2e 35 30 39 0a 63 65 72 74 69 66 69 63  a X.509.certific
4d10: 61 74 65 20 61 6e 64 20 74 68 61 74 20 63 65 72  ate and that cer
4d20: 74 69 66 69 63 61 74 65 20 69 73 20 61 75 74 68  tificate is auth
4d30: 65 6e 74 69 63 61 74 65 64 20 28 69 2e 65 2e 20  enticated (i.e. 
4d40: 73 69 67 6e 65 64 29 20 62 79 20 61 20 43 65 72  signed) by a Cer
4d50: 74 69 66 69 63 61 74 65 0a 41 75 74 68 6f 72 69  tificate.Authori
4d60: 74 79 20 28 43 41 29 2e 20 55 73 65 72 73 20 63  ty (CA). Users c
4d70: 61 6e 20 74 68 65 6e 20 65 78 63 68 61 6e 67 65  an then exchange
4d80: 20 74 68 65 73 65 20 63 65 72 74 69 66 69 63 61   these certifica
4d90: 74 65 73 20 64 75 72 69 6e 67 20 74 68 65 20 54  tes during the T
4da0: 4c 53 0a 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f  LS.initializatio
4db0: 6e 20 70 72 6f 63 65 73 73 20 61 6e 64 20 63 68  n process and ch
4dc0: 65 63 6b 20 74 68 65 6d 20 61 67 61 69 6e 73 74  eck them against
4dd0: 20 74 68 65 20 72 6f 6f 74 20 43 41 20 63 65 72   the root CA cer
4de0: 74 69 66 69 63 61 74 65 73 20 74 6f 20 65 6e 73  tificates to ens
4df0: 75 72 65 0a 74 68 65 79 20 61 72 65 20 76 61 6c  ure.they are val
4e00: 69 64 2e 20 54 68 69 73 20 69 73 20 68 61 6e 64  id. This is hand
4e10: 6c 65 64 20 62 79 20 4f 70 65 6e 53 53 4c 20 76  led by OpenSSL v
4e20: 69 61 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  ia the [option -
4e30: 72 65 71 75 65 73 74 5d 20 61 6e 64 0a 5b 6f 70  request] and.[op
4e40: 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 6f  tion -require] o
4e50: 70 74 69 6f 6e 73 2e 20 53 65 65 20 74 68 65 20  ptions. See the 
4e60: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c  [option -cadir],
4e70: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d   [option -cadir]
4e80: 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 63  , and.[option -c
4e90: 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20  astore] options 
4ea0: 66 6f 72 20 68 6f 77 20 74 70 20 73 70 65 63 69  for how tp speci
4eb0: 66 79 20 77 68 65 72 65 20 74 6f 20 66 69 6e 64  fy where to find
4ec0: 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69 63   the CA certific
4ed0: 61 74 65 73 2e 0a 4f 70 74 69 6f 6e 61 6c 6c 79  ates..Optionally
4ee0: 2c 20 69 6e 20 61 20 66 75 74 75 72 65 20 72 65  , in a future re
4ef0: 6c 65 61 73 65 2c 20 74 68 65 79 20 63 61 6e 20  lease, they can 
4f00: 61 6c 73 6f 20 62 65 20 63 68 65 63 6b 65 64 20  also be checked 
4f10: 61 67 61 69 6e 73 74 20 74 68 65 20 43 65 72 74  against the Cert
4f20: 69 66 69 63 61 74 65 0a 52 65 76 6f 63 61 74 69  ificate.Revocati
4f30: 6f 6e 20 4c 69 73 74 20 28 43 52 4c 29 20 6f 66  on List (CRL) of
4f40: 20 72 65 76 6f 6b 65 64 20 63 65 72 74 69 66 69   revoked certifi
4f50: 63 61 74 65 73 2e 20 43 65 72 74 69 66 69 63 61  cates. Certifica
4f60: 74 65 73 20 63 61 6e 20 61 6c 73 6f 20 62 65 0a  tes can also be.
4f70: 73 65 6c 66 2d 73 69 67 6e 65 64 2c 20 62 75 74  self-signed, but
4f80: 20 74 68 65 79 20 61 72 65 20 62 79 20 64 65 66   they are by def
4f90: 61 75 6c 74 20 6e 6f 74 20 74 72 75 73 74 65 64  ault not trusted
4fa0: 20 75 6e 6c 65 73 73 20 79 6f 75 20 61 64 64 20   unless you add 
4fb0: 74 68 65 6d 20 74 6f 20 79 6f 75 72 0a 63 65 72  them to your.cer
4fc0: 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 2e 0a  tificate store..
4fd0: 5b 70 61 72 61 5d 0a 54 79 70 69 63 61 6c 6c 79  [para].Typically
4fe0: 20 77 68 65 6e 20 76 69 73 69 74 69 6e 67 20 77   when visiting w
4ff0: 65 62 20 73 69 74 65 73 2c 20 6f 6e 6c 79 20 74  eb sites, only t
5000: 68 65 20 63 6c 69 65 6e 74 20 6e 65 65 64 73 20  he client needs 
5010: 74 6f 20 63 68 65 63 6b 20 74 68 65 20 73 65 72  to check the ser
5020: 76 65 72 27 73 0a 63 65 72 74 69 66 69 63 61 74  ver's.certificat
5030: 65 20 74 6f 20 65 6e 73 75 72 65 20 69 74 20 69  e to ensure it i
5040: 73 20 76 61 6c 69 64 2e 20 54 68 65 20 73 65 72  s valid. The ser
5050: 76 65 72 20 64 6f 65 73 6e 27 74 20 6e 65 65 64  ver doesn't need
5060: 20 74 6f 20 63 68 65 63 6b 20 74 68 65 20 63 6c   to check the cl
5070: 69 65 6e 74 0a 63 65 72 74 69 66 69 63 61 74 65  ient.certificate
5080: 20 75 6e 6c 65 73 73 20 79 6f 75 20 6e 65 65 64   unless you need
5090: 20 74 6f 20 61 75 74 68 65 6e 74 69 63 61 74 65   to authenticate
50a0: 20 77 69 74 68 20 74 68 65 6d 20 74 6f 20 6c 6f   with them to lo
50b0: 67 69 6e 2c 20 65 74 63 2e 20 53 65 65 20 74 68  gin, etc. See th
50c0: 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74 5d  e.[option -cert]
50d0: 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 65   and [option -ce
50e0: 72 74 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20  rtfile] options 
50f0: 69 66 20 79 6f 75 20 6e 65 65 64 20 74 6f 20 70  if you need to p
5100: 72 6f 76 69 64 65 20 61 20 63 65 72 74 69 66 69  rovide a certifi
5110: 63 61 74 65 2e 0a 0a 0a 5b 73 75 62 73 65 63 74  cate....[subsect
5120: 69 6f 6e 20 22 53 75 6d 6d 61 72 79 20 6f 66 20  ion "Summary of 
5130: 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 6f 70 74  command line opt
5140: 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c  ions"]..The foll
5150: 6f 77 69 6e 67 20 6f 70 74 69 6f 6e 73 20 61 72  owing options ar
5160: 65 20 75 73 65 64 20 66 6f 72 20 70 65 65 72 20  e used for peer 
5170: 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c 69  certificate vali
5180: 64 61 74 69 6f 6e 3a 0a 0a 5b 6c 69 73 74 5f 62  dation:..[list_b
5190: 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b  egin options]..[
51a0: 6f 70 74 5f 64 65 66 20 2d 63 61 64 69 72 20 5b  opt_def -cadir [
51b0: 61 72 67 20 64 69 72 65 63 74 6f 72 79 5d 5d 0a  arg directory]].
51c0: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 64 69  Specifies the di
51d0: 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 68  rectory where th
51e0: 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  e Certificate Au
51f0: 74 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72  thority (CA) cer
5200: 74 69 66 69 63 61 74 65 73 20 61 72 65 0a 73 74  tificates are.st
5210: 6f 72 65 64 2e 20 54 68 65 20 64 65 66 61 75 6c  ored. The defaul
5220: 74 20 69 73 20 70 6c 61 74 66 6f 72 6d 20 73 70  t is platform sp
5230: 65 63 69 66 69 63 2c 20 62 75 74 20 69 73 20 75  ecific, but is u
5240: 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20 22 2f 65  sually [file "/e
5250: 74 63 2f 73 73 6c 2f 63 65 72 74 73 22 5d 20 6f  tc/ssl/certs"] o
5260: 6e 0a 4c 69 6e 75 78 2f 55 6e 69 78 20 73 79 73  n.Linux/Unix sys
5270: 74 65 6d 73 2e 20 54 68 65 20 64 65 66 61 75 6c  tems. The defaul
5280: 74 20 6c 6f 63 61 74 69 6f 6e 20 63 61 6e 20 62  t location can b
5290: 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20  e overridden by 
52a0: 74 68 65 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52  the.[var SSL_CER
52b0: 54 5f 44 49 52 5d 20 65 6e 76 69 72 6f 6e 6d 65  T_DIR] environme
52c0: 6e 74 20 76 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f  nt variable...[o
52d0: 70 74 5f 64 65 66 20 2d 63 61 66 69 6c 65 20 5b  pt_def -cafile [
52e0: 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53  arg filename]].S
52f0: 70 65 63 69 66 69 65 73 20 74 68 65 20 66 69 6c  pecifies the fil
5300: 65 20 77 69 74 68 20 74 68 65 20 43 65 72 74 69  e with the Certi
5310: 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 79  ficate Authority
5320: 20 28 43 41 29 20 63 65 72 74 69 66 69 63 61 74   (CA) certificat
5330: 65 73 20 74 6f 20 75 73 65 20 69 6e 0a 5b 63 6f  es to use in.[co
5340: 6e 73 74 20 50 45 4d 5d 20 66 69 6c 65 20 66 6f  nst PEM] file fo
5350: 72 6d 61 74 2e 20 54 68 65 20 64 65 66 61 75 6c  rmat. The defaul
5360: 74 20 69 73 20 5b 66 69 6c 65 20 63 65 72 74 2e  t is [file cert.
5370: 70 65 6d 5d 2c 20 69 6e 20 74 68 65 20 4f 70 65  pem], in the Ope
5380: 6e 53 53 4c 0a 64 69 72 65 63 74 6f 72 79 2e 20  nSSL.directory. 
5390: 4f 6e 20 4c 69 6e 75 78 2f 55 6e 69 78 20 73 79  On Linux/Unix sy
53a0: 73 74 65 6d 73 2c 20 74 68 69 73 20 69 73 20 75  stems, this is u
53b0: 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20 2f 65 74  sually [file /et
53c0: 63 2f 73 73 6c 2f 63 61 2d 62 75 6e 64 6c 65 2e  c/ssl/ca-bundle.
53d0: 70 65 6d 5d 2e 0a 54 68 65 20 64 65 66 61 75 6c  pem]..The defaul
53e0: 74 20 66 69 6c 65 20 63 61 6e 20 62 65 20 6f 76  t file can be ov
53f0: 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 20  erridden by the 
5400: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49  [var SSL_CERT_FI
5410: 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a  LE] environment.
5420: 76 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74 5f  variable...[opt_
5430: 64 65 66 20 2d 63 61 73 74 6f 72 65 20 5b 61 72  def -castore [ar
5440: 67 20 55 52 49 5d 5d 0a 53 70 65 63 69 66 69 65  g URI]].Specifie
5450: 73 20 74 68 65 20 55 6e 69 66 6f 72 6d 20 52 65  s the Uniform Re
5460: 73 6f 75 72 63 65 20 49 64 65 6e 74 69 66 69 65  source Identifie
5470: 72 20 28 55 52 49 29 20 66 6f 72 20 74 68 65 20  r (URI) for the 
5480: 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68  Certificate Auth
5490: 6f 72 69 74 79 0a 28 43 41 29 20 73 74 6f 72 65  ority.(CA) store
54a0: 2c 20 77 68 69 63 68 20 6d 61 79 20 62 65 20 61  , which may be a
54b0: 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61 69 6e 65   single containe
54c0: 72 20 6f 72 20 61 20 63 61 74 61 6c 6f 67 20 6f  r or a catalog o
54d0: 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e 0a 53 74  f containers..St
54e0: 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e  arting with Open
54f0: 53 53 4c 20 33 2e 32 20 6f 6e 20 4d 53 20 57 69  SSL 3.2 on MS Wi
5500: 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20 22 5b  ndows, set to "[
5510: 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e 73  const "org.opens
5520: 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d  sl.winstore://"]
5530: 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62 75 69  ".to use the bui
5540: 6c 74 2d 69 6e 20 4d 53 20 57 69 6e 64 6f 77 73  lt-in MS Windows
5550: 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74 6f   Certificate Sto
5560: 72 65 2e 0a 54 68 69 73 20 73 74 6f 72 65 20 6f  re..This store o
5570: 6e 6c 79 20 73 75 70 70 6f 72 74 73 20 72 6f 6f  nly supports roo
5580: 74 20 63 65 72 74 69 66 69 63 61 74 65 20 73 74  t certificate st
5590: 6f 72 65 73 2e 20 53 65 65 0a 5b 73 65 63 74 72  ores. See.[sectr
55a0: 65 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20  ef "Certificate 
55b0: 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72  Validation"] for
55c0: 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a   more details...
55d0: 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 65 73  [opt_def -reques
55e0: 74 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65  t [arg bool]].Re
55f0: 71 75 65 73 74 20 61 20 63 65 72 74 69 66 69 63  quest a certific
5600: 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65  ate from the pee
5610: 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c  r during the SSL
5620: 20 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 69 73   handshake. This
5630: 20 69 73 20 6e 65 65 64 65 64 0a 74 6f 20 64 6f   is needed.to do
5640: 20 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c   Certificate Val
5650: 69 64 61 74 69 6f 6e 2e 20 53 74 61 72 74 69 6e  idation. Startin
5660: 67 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c  g in TclTLS 1.8,
5670: 20 74 68 65 20 64 65 66 61 75 6c 74 20 69 73 0a   the default is.
5680: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 49 6e  [const true]. In
5690: 20 61 64 64 69 74 69 6f 6e 2c 20 74 68 65 20 63   addition, the c
56a0: 6c 69 65 6e 74 20 63 61 6e 20 6d 61 6e 75 61 6c  lient can manual
56b0: 6c 79 20 69 6e 73 70 65 63 74 20 61 6e 64 20 61  ly inspect and a
56c0: 63 63 65 70 74 20 6f 72 20 72 65 6a 65 63 74 0a  ccept or reject.
56d0: 65 61 63 68 20 63 65 72 74 69 66 69 63 61 74 65  each certificate
56e0: 20 75 73 69 6e 67 20 74 68 65 20 5b 61 72 67 20   using the [arg 
56f0: 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64  -validatecommand
5700: 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f  ] option...[opt_
5710: 64 65 66 20 2d 72 65 71 75 69 72 65 20 5b 61 72  def -require [ar
5720: 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 69 72 65  g bool]].Require
5730: 20 61 20 76 61 6c 69 64 20 63 65 72 74 69 66 69   a valid certifi
5740: 63 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65  cate from the pe
5750: 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53  er during the SS
5760: 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20  L handshake. If 
5770: 74 68 69 73 20 69 73 0a 73 65 74 20 74 6f 20 74  this is.set to t
5780: 72 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f  rue, then [optio
5790: 6e 20 2d 72 65 71 75 65 73 74 5d 20 6d 75 73 74  n -request] must
57a0: 20 61 6c 73 6f 20 62 65 20 73 65 74 20 74 6f 20   also be set to 
57b0: 74 72 75 65 20 61 6e 64 20 61 20 65 69 74 68 65  true and a eithe
57c0: 72 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72  r.[option -cadir
57d0: 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69  ], [option -cafi
57e0: 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61  le], [option -ca
57f0: 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70 6c 61  store], or a pla
5800: 74 66 6f 72 6d 20 64 65 66 61 75 6c 74 0a 6d 75  tform default.mu
5810: 73 74 20 62 65 20 70 72 6f 76 69 64 65 64 20 69  st be provided i
5820: 6e 20 6f 72 64 65 72 20 74 6f 20 76 61 6c 69 64  n order to valid
5830: 61 74 65 20 61 67 61 69 6e 73 74 2e 20 54 68 65  ate against. The
5840: 20 64 65 66 61 75 6c 74 20 69 6e 20 54 63 6c 54   default in TclT
5850: 4c 53 20 31 2e 38 20 61 6e 64 0a 65 61 72 6c 69  LS 1.8 and.earli
5860: 65 72 20 76 65 72 73 69 6f 6e 73 20 69 73 20 5b  er versions is [
5870: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e  const false] sin
5880: 63 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61 74 66  ce not all platf
5890: 6f 72 6d 73 20 68 61 76 65 20 63 65 72 74 69 66  orms have certif
58a0: 69 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 61  icates to.valida
58b0: 74 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20  te against in a 
58c0: 66 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20  form compatible 
58d0: 77 69 74 68 20 4f 70 65 6e 53 53 4c 2e 0a 0a 5b  with OpenSSL...[
58e0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73  list_end]..[subs
58f0: 65 63 74 69 6f 6e 20 22 57 68 65 6e 20 61 72 65  ection "When are
5900: 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 6f 70   command line op
5910: 74 69 6f 6e 73 20 6e 65 65 64 65 64 3f 22 5d 0a  tions needed?"].
5920: 0a 49 6e 20 54 63 6c 54 4c 53 20 31 2e 38 20 61  .In TclTLS 1.8 a
5930: 6e 64 20 65 61 72 6c 69 65 72 20 76 65 72 73 69  nd earlier versi
5940: 6f 6e 73 2c 20 63 65 72 74 69 66 69 63 61 74 65  ons, certificate
5950: 20 76 61 6c 69 64 61 74 69 6f 6e 20 69 73 0a 5b   validation is.[
5960: 65 6d 70 68 20 4e 4f 54 5d 20 65 6e 61 62 6c 65  emph NOT] enable
5970: 64 20 62 79 20 64 65 66 61 75 6c 74 2e 20 54 68  d by default. Th
5980: 69 73 20 6c 69 6d 69 74 61 74 69 6f 6e 20 69 73  is limitation is
5990: 20 64 75 65 20 74 6f 20 74 68 65 20 6c 61 63 6b   due to the lack
59a0: 20 6f 66 20 61 20 63 6f 6d 6d 6f 6e 0a 63 72 6f   of a common.cro
59b0: 73 73 20 70 6c 61 74 66 6f 72 6d 20 64 61 74 61  ss platform data
59c0: 62 61 73 65 20 6f 66 20 43 65 72 74 69 66 69 63  base of Certific
59d0: 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28 43  ate Authority (C
59e0: 41 29 20 70 72 6f 76 69 64 65 64 20 63 65 72 74  A) provided cert
59f0: 69 66 69 63 61 74 65 73 20 74 6f 0a 76 61 6c 69  ificates to.vali
5a00: 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20 4d 61  date against. Ma
5a10: 6e 79 20 4c 69 6e 75 78 20 73 79 73 74 65 6d 73  ny Linux systems
5a20: 20 6e 61 74 69 76 65 6c 79 20 73 75 70 70 6f 72   natively suppor
5a30: 74 20 4f 70 65 6e 53 53 4c 20 61 6e 64 20 74 68  t OpenSSL and th
5a40: 75 73 20 68 61 76 65 0a 74 68 65 73 65 20 63 65  us have.these ce
5a50: 72 74 69 66 69 63 61 74 65 73 20 69 6e 73 74 61  rtificates insta
5a60: 6c 6c 65 64 20 61 73 20 70 61 72 74 20 6f 66 20  lled as part of 
5a70: 74 68 65 20 4f 53 2c 20 62 75 74 20 4d 61 63 4f  the OS, but MacO
5a80: 53 20 61 6e 64 20 4d 53 20 57 69 6e 64 6f 77 73  S and MS Windows
5a90: 20 64 6f 20 6e 6f 74 2e 0a 49 6e 20 6f 72 64 65   do not..In orde
5aa0: 72 20 74 6f 20 75 73 65 20 74 68 65 20 5b 6f 70  r to use the [op
5ab0: 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 6f  tion -require] o
5ac0: 70 74 69 6f 6e 2c 20 6f 6e 65 20 6f 66 20 74 68  ption, one of th
5ad0: 65 20 66 6f 6c 6c 6f 77 69 6e 67 0a 6d 75 73 74  e following.must
5ae0: 20 62 65 20 74 72 75 65 3a 0a 0a 5b 6c 69 73 74   be true:..[list
5af0: 5f 62 65 67 69 6e 20 69 74 65 6d 69 7a 65 64 5d  _begin itemized]
5b00: 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20 4c 69 6e 75  ..[item].On Linu
5b10: 78 20 61 6e 64 20 55 6e 69 78 20 73 79 73 74 65  x and Unix syste
5b20: 6d 73 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20  ms with OpenSSL 
5b30: 61 6c 72 65 61 64 79 20 69 6e 73 74 61 6c 6c 65  already installe
5b40: 64 20 6f 72 20 69 66 20 74 68 65 20 43 41 0a 63  d or if the CA.c
5b50: 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65 20  ertificates are 
5b60: 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 50 45 4d  available in PEM
5b70: 20 66 6f 72 6d 61 74 2c 20 61 6e 64 20 69 66 20   format, and if 
5b80: 74 68 65 79 20 61 72 65 20 73 74 6f 72 65 64 20  they are stored 
5b90: 69 6e 20 74 68 65 0a 73 74 61 6e 64 61 72 64 20  in the.standard 
5ba0: 6c 6f 63 61 74 69 6f 6e 73 2c 20 6f 72 20 69 66  locations, or if
5bb0: 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45   the [var SSL_CE
5bc0: 52 54 5f 44 49 52 5d 20 6f 72 20 5b 76 61 72 20  RT_DIR] or [var 
5bd0: 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 0a 65  SSL_CERT_FILE].e
5be0: 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61  nvironment varia
5bf0: 62 6c 65 73 20 61 72 65 20 73 65 74 2c 20 74 68  bles are set, th
5c00: 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  en [option -cadi
5c10: 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  r], [option -cad
5c20: 69 72 5d 2c 0a 61 6e 64 20 5b 6f 70 74 69 6f 6e  ir],.and [option
5c30: 20 2d 63 61 73 74 6f 72 65 5d 20 61 72 65 6e 27   -castore] aren'
5c40: 74 20 6e 65 65 64 65 64 2e 0a 0a 5b 69 74 65 6d  t needed...[item
5c50: 5d 0a 49 66 20 4f 70 65 6e 53 53 4c 20 69 73 20  ].If OpenSSL is 
5c60: 6e 6f 74 20 69 6e 73 74 61 6c 6c 65 64 20 69 6e  not installed in
5c70: 20 74 68 65 20 64 65 66 61 75 6c 74 20 6c 6f 63   the default loc
5c80: 61 74 69 6f 6e 2c 20 6f 72 20 77 68 65 6e 20 75  ation, or when u
5c90: 73 69 6e 67 20 4d 61 63 20 4f 53 0a 6f 72 20 4d  sing Mac OS.or M
5ca0: 53 20 57 69 6e 64 6f 77 73 20 61 6e 64 20 4f 70  S Windows and Op
5cb0: 65 6e 53 53 4c 20 69 73 20 69 6e 73 74 61 6c 6c  enSSL is install
5cc0: 65 64 2c 20 74 68 65 20 5b 76 61 72 20 53 53 4c  ed, the [var SSL
5cd0: 5f 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f 6f  _CERT_DIR] and/o
5ce0: 72 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  r.[var SSL_CERT_
5cf0: 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e  FILE] environmen
5d00: 74 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20 74  t variables or t
5d10: 68 65 20 6f 6e 65 20 6f 66 20 74 68 65 20 5b 6f  he one of the [o
5d20: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b  ption -cadir],.[
5d30: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20  option -cadir], 
5d40: 6f 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74  or [option -cast
5d50: 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20 6d 75 73  ore] options mus
5d60: 74 20 62 65 20 64 65 66 69 6e 65 64 2e 0a 0a 5b  t be defined...[
5d70: 69 74 65 6d 5d 0a 4f 6e 20 4d 53 20 57 69 6e 64  item].On MS Wind
5d80: 6f 77 73 2c 20 73 74 61 72 74 69 6e 67 20 69 6e  ows, starting in
5d90: 20 4f 70 65 6e 53 53 4c 20 33 2e 32 2c 20 69 74   OpenSSL 3.2, it
5da0: 20 69 73 20 6e 6f 77 20 70 6f 73 73 69 62 6c 65   is now possible
5db0: 20 74 6f 20 61 63 63 65 73 73 20 74 68 65 0a 62   to access the.b
5dc0: 75 69 6c 74 2d 69 6e 20 57 69 6e 64 6f 77 73 20  uilt-in Windows 
5dd0: 43 65 72 74 69 66 69 63 61 74 65 20 53 74 6f 72  Certificate Stor
5de0: 65 20 66 72 6f 6d 20 4f 70 65 6e 53 53 4c 2e 20  e from OpenSSL. 
5df0: 54 68 69 73 20 63 61 6e 20 75 74 69 6c 69 7a 65  This can utilize
5e00: 64 20 62 79 0a 73 65 74 74 69 6e 67 20 74 68 65  d by.setting the
5e10: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72   [option -castor
5e20: 65 5d 20 6f 70 74 69 6f 6e 20 74 6f 20 22 5b 63  e] option to "[c
5e30: 6f 6e 73 74 20 6f 72 67 2e 6f 70 65 6e 73 73 6c  onst org.openssl
5e40: 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 5d 22 2e 0a  .winstore://]"..
5e50: 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65 6e 53  .[item].If OpenS
5e60: 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74 61 6c  SL is not instal
5e70: 6c 65 64 20 6f 72 20 74 68 65 20 43 41 20 63 65  led or the CA ce
5e80: 72 74 69 66 69 63 61 74 65 73 20 61 72 65 20 6e  rtificates are n
5e90: 6f 74 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20  ot available in 
5ea0: 50 45 4d 0a 66 6f 72 6d 61 74 2c 20 74 68 65 20  PEM.format, the 
5eb0: 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73 20  CA certificates 
5ec0: 6d 75 73 74 20 62 65 20 64 6f 77 6e 6c 6f 61 64  must be download
5ed0: 65 64 20 61 6e 64 20 69 6e 73 74 61 6c 6c 65 64  ed and installed
5ee0: 20 77 69 74 68 20 74 68 65 20 75 73 65 72 0a 73   with the user.s
5ef0: 6f 66 74 77 61 72 65 2e 20 54 68 65 20 43 55 52  oftware. The CUR
5f00: 4c 20 74 65 61 6d 20 6d 61 6b 65 73 20 74 68 65  L team makes the
5f10: 6d 20 61 76 61 69 6c 61 62 6c 65 20 61 74 0a 5b  m available at.[
5f20: 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 63 75 72  uri "https://cur
5f30: 6c 2e 73 65 2f 64 6f 63 73 2f 63 61 65 78 74 72  l.se/docs/caextr
5f40: 61 63 74 2e 68 74 6d 6c 22 20 22 43 41 20 63 65  act.html" "CA ce
5f50: 72 74 69 66 69 63 61 74 65 73 20 65 78 74 72 61  rtificates extra
5f60: 63 74 65 64 0a 66 72 6f 6d 20 4d 6f 7a 69 6c 6c  cted.from Mozill
5f70: 61 22 5d 20 69 6e 20 74 68 65 20 5b 66 69 6c 65  a"] in the [file
5f80: 20 63 61 63 65 72 74 2e 70 65 6d 5d 20 66 69 6c   cacert.pem] fil
5f90: 65 2e 20 59 6f 75 20 6d 75 73 74 20 74 68 65 6e  e. You must then
5fa0: 20 65 69 74 68 65 72 20 73 65 74 20 74 68 65 0a   either set the.
5fb0: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49  [var SSL_CERT_DI
5fc0: 52 5d 20 61 6e 64 2f 6f 72 20 5b 76 61 72 20 53  R] and/or [var S
5fd0: 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e  SL_CERT_FILE] en
5fe0: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62  vironment variab
5ff0: 6c 65 73 20 6f 72 20 74 68 65 0a 5b 6f 70 74 69  les or the.[opti
6000: 6f 6e 20 2d 63 61 64 69 72 5d 20 6f 72 20 5b 6f  on -cadir] or [o
6010: 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 20 6f  ption -cafile] o
6020: 70 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 43 41  ptions to the CA
6030: 20 63 65 72 74 20 66 69 6c 65 27 73 20 69 6e 73   cert file's ins
6040: 74 61 6c 6c 0a 6c 6f 63 61 74 69 6f 6e 2e 20 49  tall.location. I
6050: 74 20 69 73 20 79 6f 75 72 20 72 65 73 70 6f 6e  t is your respon
6060: 73 69 62 69 6c 69 74 79 20 74 6f 20 6b 65 65 70  sibility to keep
6070: 20 74 68 69 73 20 66 69 6c 65 20 75 70 20 74 6f   this file up to
6080: 20 64 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e   date...[list_en
6090: 64 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43 61  d]..[section "Ca
60a0: 6c 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d  llback Options"]
60b0: 0a 0a 41 73 20 70 72 65 76 69 6f 75 73 6c 79 20  ..As previously 
60c0: 64 65 73 63 72 69 62 65 64 2c 20 65 61 63 68 20  described, each 
60d0: 63 68 61 6e 6e 65 6c 20 63 61 6e 20 62 65 20 67  channel can be g
60e0: 69 76 65 6e 20 74 68 65 69 72 20 6f 77 6e 20 63  iven their own c
60f0: 61 6c 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e 64  allbacks.to hand
6100: 6c 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20  le intermediate 
6110: 70 72 6f 63 65 73 73 69 6e 67 20 62 79 20 74 68  processing by th
6120: 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72  e OpenSSL librar
6130: 79 2c 20 75 73 69 6e 67 20 74 68 65 0a 5b 6f 70  y, using the.[op
6140: 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20  tion -command], 
6150: 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72  [option -passwor
6160: 64 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20  d], and [option 
6170: 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e  -validate_comman
6180: 64 5d 20 6f 70 74 69 6f 6e 73 0a 70 61 73 73 65  d] options.passe
6190: 64 20 74 6f 20 65 69 74 68 65 72 20 6f 66 20 5b  d to either of [
61a0: 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d  cmd tls::socket]
61b0: 20 6f 72 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d   or [cmd tls::im
61c0: 70 6f 72 74 5d 2e 0a 55 6e 6c 69 6b 65 20 70 72  port]..Unlike pr
61d0: 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 73 20  evious versions 
61e0: 6f 66 20 54 63 6c 54 4c 53 2c 20 6f 6e 6c 79 20  of TclTLS, only 
61f0: 69 66 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20  if the callback 
6200: 67 65 6e 65 72 61 74 65 73 20 61 6e 20 65 72 72  generates an err
6210: 6f 72 2c 0a 77 69 6c 6c 20 74 68 65 20 5b 73 79  or,.will the [sy
6220: 73 63 6d 64 20 62 67 65 72 72 6f 72 5d 20 63 6f  scmd bgerror] co
6230: 6d 6d 61 6e 64 20 62 65 20 69 6e 76 6f 6b 65 64  mmand be invoked
6240: 20 77 69 74 68 20 74 68 65 20 65 72 72 6f 72 20   with the error 
6250: 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 5b 73  information...[s
6260: 75 62 73 65 63 74 69 6f 6e 20 22 56 61 6c 75 65  ubsection "Value
6270: 73 20 66 6f 72 20 43 6f 6d 6d 61 6e 64 20 43 61  s for Command Ca
6280: 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61  llback"]..The ca
6290: 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b  llback for the [
62a0: 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d  option -command]
62b0: 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b   option is invok
62c0: 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f  ed at several po
62d0: 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a  ints during the.
62e0: 4f 70 65 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b  OpenSSL handshak
62f0: 65 20 61 6e 64 20 64 75 72 69 6e 67 20 72 6f 75  e and during rou
6300: 74 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e  tine operations.
6310: 20 53 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 74   See below for t
6320: 68 65 20 70 6f 73 73 69 62 6c 65 0a 61 72 67 75  he possible.argu
6330: 6d 65 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20  ments passed to 
6340: 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 63 72  the callback scr
6350: 69 70 74 2e 20 56 61 6c 75 65 73 20 72 65 74 75  ipt. Values retu
6360: 72 6e 65 64 20 66 72 6f 6d 20 74 68 65 20 63 61  rned from the ca
6370: 6c 6c 62 61 63 6b 20 61 72 65 0a 69 67 6e 6f 72  llback are.ignor
6380: 65 64 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  ed...[list_begin
6390: 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f   options]..[opt_
63a0: 64 65 66 20 65 72 72 6f 72 20 5b 61 72 67 20 22  def error [arg "
63b0: 63 68 61 6e 6e 65 6c 49 64 20 6d 65 73 73 61 67  channelId messag
63c0: 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f  e"]].This form o
63d0: 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e  f callback is in
63e0: 76 6f 6b 65 64 20 77 68 65 6e 65 76 65 72 20 61  voked whenever a
63f0: 6e 20 65 72 72 6f 72 20 6f 63 63 75 72 73 20 64  n error occurs d
6400: 75 72 69 6e 67 20 74 68 65 20 69 6e 69 74 69 61  uring the initia
6410: 6c 0a 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68 61  l.connection, ha
6420: 6e 64 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f 20  ndshake, or I/O 
6430: 6f 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 20  operations. The 
6440: 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 20 61 72  [arg message] ar
6450: 67 75 6d 65 6e 74 20 63 61 6e 20 62 65 0a 66 72  gument can be.fr
6460: 6f 6d 20 74 68 65 20 54 63 6c 5f 45 72 72 6e 6f  om the Tcl_Errno
6470: 4d 73 67 2c 20 4f 70 65 6e 53 53 4c 20 66 75 6e  Msg, OpenSSL fun
6480: 63 74 69 6f 6e 20 5b 66 75 6e 20 45 52 52 5f 72  ction [fun ERR_r
6490: 65 61 73 6f 6e 5f 65 72 72 6f 72 5f 73 74 72 69  eason_error_stri
64a0: 6e 67 28 29 5d 2c 0a 6f 72 20 61 20 63 75 73 74  ng()],.or a cust
64b0: 6f 6d 20 6d 65 73 73 61 67 65 2e 20 54 68 69 73  om message. This
64c0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77   callback is new
64d0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
64e0: 0a 0a 5b 6f 70 74 5f 64 65 66 20 69 6e 66 6f 20  ..[opt_def info 
64f0: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20  [arg "channelId 
6500: 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65 73 73  major minor mess
6510: 61 67 65 20 74 79 70 65 22 5d 5d 0a 54 68 69 73  age type"]].This
6520: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63   form of callbac
6530: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20  k is invoked by 
6540: 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63  the OpenSSL func
6550: 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73 65  tion.[fun SSL_se
6560: 74 5f 69 6e 66 6f 5f 63 61 6c 6c 62 61 63 6b 28  t_info_callback(
6570: 29 5d 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e  )] during the in
6580: 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e  itial connection
6590: 20 61 6e 64 20 68 61 6e 64 73 68 61 6b 65 0a 6f   and handshake.o
65a0: 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 20 61  perations. The a
65b0: 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b  rguments are:..[
65c0: 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e  list_begin defin
65d0: 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61  itions]..[def [a
65e0: 72 67 20 6d 61 6a 6f 72 5d 5d 0a 4d 61 6a 6f 72  rg major]].Major
65f0: 20 63 61 74 65 67 6f 72 79 20 66 6f 72 20 65 72   category for er
6600: 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d 73  ror. Valid enums
6610: 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 68 61 6e   are: [const han
6620: 64 73 68 61 6b 65 5d 2c 20 5b 63 6f 6e 73 74 20  dshake], [const 
6630: 61 6c 65 72 74 5d 2c 0a 5b 63 6f 6e 73 74 20 63  alert],.[const c
6640: 6f 6e 6e 65 63 74 5d 2c 20 5b 63 6f 6e 73 74 20  onnect], [const 
6650: 61 63 63 65 70 74 5d 2e 0a 0a 5b 64 65 66 20 5b  accept]...[def [
6660: 61 72 67 20 6d 69 6e 6f 72 5d 5d 0a 4d 69 6e 6f  arg minor]].Mino
6670: 72 20 63 61 74 65 67 6f 72 79 20 66 6f 72 20 65  r category for e
6680: 72 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d  rror. Valid enum
6690: 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 73 74  s are: [const st
66a0: 61 72 74 5d 2c 20 5b 63 6f 6e 73 74 20 64 6f 6e  art], [const don
66b0: 65 5d 2c 20 5b 63 6f 6e 73 74 20 72 65 61 64 5d  e], [const read]
66c0: 2c 0a 5b 63 6f 6e 73 74 20 77 72 69 74 65 5d 2c  ,.[const write],
66d0: 20 5b 63 6f 6e 73 74 20 6c 6f 6f 70 5d 2c 20 5b   [const loop], [
66e0: 63 6f 6e 73 74 20 65 78 69 74 5d 2e 0a 0a 5b 64  const exit]...[d
66f0: 65 66 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d  ef [arg message]
6700: 5d 0a 44 65 73 63 72 69 70 74 69 76 65 20 6d 65  ].Descriptive me
6710: 73 73 61 67 65 20 73 74 72 69 6e 67 20 77 68 69  ssage string whi
6720: 63 68 20 6d 61 79 20 62 65 20 67 65 6e 65 72 61  ch may be genera
6730: 74 65 64 20 65 69 74 68 65 72 20 62 79 0a 5b 66  ted either by.[f
6740: 75 6e 20 53 53 4c 5f 73 74 61 74 65 5f 73 74 72  un SSL_state_str
6750: 69 6e 67 5f 6c 6f 6e 67 28 29 5d 20 6f 72 20 5b  ing_long()] or [
6760: 66 75 6e 20 53 53 4c 5f 61 6c 65 72 74 5f 64 65  fun SSL_alert_de
6770: 73 63 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 29  sc_string_long()
6780: 5d 2c 0a 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20  ],.depending on 
6790: 74 68 65 20 63 6f 6e 74 65 78 74 2e 0a 0a 5b 64  the context...[d
67a0: 65 66 20 5b 61 72 67 20 74 79 70 65 5d 5d 0a 46  ef [arg type]].F
67b0: 6f 72 20 61 6c 65 72 74 73 2c 20 74 68 65 20 70  or alerts, the p
67c0: 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 20 61  ossible values a
67d0: 72 65 3a 20 5b 63 6f 6e 73 74 20 77 61 72 6e 69  re: [const warni
67e0: 6e 67 5d 2c 0a 5b 63 6f 6e 73 74 20 66 61 74 61  ng],.[const fata
67f0: 6c 5d 2c 20 61 6e 64 20 5b 63 6f 6e 73 74 20 75  l], and [const u
6800: 6e 6b 6e 6f 77 6e 5d 2e 20 46 6f 72 20 6f 74 68  nknown]. For oth
6810: 65 72 73 2c 20 5b 63 6f 6e 73 74 20 69 6e 66 6f  ers, [const info
6820: 5d 20 69 73 20 75 73 65 64 2e 0a 54 68 69 73 20  ] is used..This 
6830: 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77 20  argument is new 
6840: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
6850: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70  .[list_end]..[op
6860: 74 5f 64 65 66 20 6d 65 73 73 61 67 65 20 5b 61  t_def message [a
6870: 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 69  rg "channelId di
6880: 72 65 63 74 69 6f 6e 20 76 65 72 73 69 6f 6e 20  rection version 
6890: 63 6f 6e 74 65 6e 74 5f 74 79 70 65 20 6d 65 73  content_type mes
68a0: 73 61 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72  sage"]].This for
68b0: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73  m of callback is
68c0: 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20   invoked by the 
68d0: 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e  OpenSSL function
68e0: 0a 5b 66 75 6e 20 53 53 4c 5f 73 65 74 5f 6d 73  .[fun SSL_set_ms
68f0: 67 5f 63 61 6c 6c 62 61 63 6b 28 29 5d 20 77 68  g_callback()] wh
6900: 65 6e 65 76 65 72 20 61 20 6d 65 73 73 61 67 65  enever a message
6910: 20 69 73 20 73 65 6e 74 20 6f 72 20 72 65 63 65   is sent or rece
6920: 69 76 65 64 20 64 75 72 69 6e 67 20 74 68 65 0a  ived during the.
6930: 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69  initial connecti
6940: 6f 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20 6f  on, handshake, o
6950: 72 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f 6e 73  r I/O operations
6960: 2e 20 49 74 20 69 73 20 6f 6e 6c 79 20 61 76 61  . It is only ava
6970: 69 6c 61 62 6c 65 20 77 68 65 6e 0a 4f 70 65 6e  ilable when.Open
6980: 53 53 4c 20 69 73 20 63 6f 6d 70 6c 69 65 64 20  SSL is complied 
6990: 77 69 74 68 20 74 68 65 20 5b 63 6f 6e 73 74 20  with the [const 
69a0: 65 6e 61 62 6c 65 2d 73 73 6c 2d 74 72 61 63 65  enable-ssl-trace
69b0: 5d 20 6f 70 74 69 6f 6e 2e 20 54 68 69 73 20 63  ] option. This c
69c0: 61 6c 6c 62 61 63 6b 20 69 73 0a 6e 65 77 20 66  allback is.new f
69d0: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54  or TclTLS 1.8. T
69e0: 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65  he arguments are
69f0: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64  :..[list_begin d
6a00: 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65  efinitions]..[de
6a10: 66 20 5b 61 72 67 20 64 69 72 65 63 74 69 6f 6e  f [arg direction
6a20: 5d 5d 0a 44 69 72 65 63 74 69 6f 6e 20 69 73 20  ]].Direction is 
6a30: 65 69 74 68 65 72 20 5b 63 6f 6e 73 74 20 53 65  either [const Se
6a40: 6e 74 5d 20 6f 72 20 5b 63 6f 6e 73 74 20 52 65  nt] or [const Re
6a50: 63 65 69 76 65 64 5d 2e 0a 0a 5b 64 65 66 20 5b  ceived]...[def [
6a60: 61 72 67 20 76 65 72 73 69 6f 6e 5d 5d 0a 56 65  arg version]].Ve
6a70: 72 73 69 6f 6e 20 69 73 20 74 68 65 20 70 72 6f  rsion is the pro
6a80: 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 2e 0a 0a  tocol version...
6a90: 5b 64 65 66 20 5b 61 72 67 20 63 6f 6e 74 65 6e  [def [arg conten
6aa0: 74 5f 74 79 70 65 5d 5d 0a 43 6f 6e 74 65 6e 74  t_type]].Content
6ab0: 20 74 79 70 65 20 69 73 20 74 68 65 20 6d 65 73   type is the mes
6ac0: 73 61 67 65 20 63 6f 6e 74 65 6e 74 20 74 79 70  sage content typ
6ad0: 65 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 65  e...[def [arg me
6ae0: 73 73 61 67 65 5d 5d 0a 4d 65 73 73 61 67 65 20  ssage]].Message 
6af0: 69 73 20 6d 6f 72 65 20 69 6e 66 6f 20 66 72 6f  is more info fro
6b00: 6d 20 74 68 65 20 5b 63 6f 6e 73 74 20 53 53 4c  m the [const SSL
6b10: 5f 74 72 61 63 65 5d 20 41 50 49 2e 0a 0a 5b 6c  _trace] API...[l
6b20: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f 64  ist_end]..[opt_d
6b30: 65 66 20 73 65 73 73 69 6f 6e 20 5b 61 72 67 20  ef session [arg 
6b40: 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 73 73 69  "channelId sessi
6b50: 6f 6e 5f 69 64 20 73 65 73 73 69 6f 6e 5f 74 69  on_id session_ti
6b60: 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 22 5d 5d  cket lifetime"]]
6b70: 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61  .This form of ca
6b80: 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65  llback is invoke
6b90: 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c  d by the OpenSSL
6ba0: 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53   function.[fun S
6bb0: 53 4c 5f 43 54 58 5f 73 65 73 73 5f 73 65 74 5f  SL_CTX_sess_set_
6bc0: 6e 65 77 5f 63 62 28 29 5d 20 77 68 65 6e 65 76  new_cb()] whenev
6bd0: 65 72 20 61 20 6e 65 77 20 73 65 73 73 69 6f 6e  er a new session
6be0: 20 69 64 20 69 73 20 73 65 6e 74 20 62 79 20 74   id is sent by t
6bf0: 68 65 0a 73 65 72 76 65 72 20 64 75 72 69 6e 67  he.server during
6c00: 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63 6f 6e   the initial con
6c10: 6e 65 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e 64  nection and hand
6c20: 73 68 61 6b 65 20 61 6e 64 20 61 6c 73 6f 20 64  shake and also d
6c30: 75 72 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f  uring the sessio
6c40: 6e 0a 69 66 20 74 68 65 20 5b 6f 70 74 69 6f 6e  n.if the [option
6c50: 20 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b 65   -post_handshake
6c60: 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 20  ] option is set 
6c70: 74 6f 20 74 72 75 65 2e 20 54 68 69 73 20 63 61  to true. This ca
6c80: 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20 66 6f  llback is new fo
6c90: 72 0a 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68  r.TclTLS 1.8. Th
6ca0: 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a  e arguments are:
6cb0: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
6cc0: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
6cd0: 20 5b 61 72 67 20 73 65 73 73 69 6f 6e 5f 69 64   [arg session_id
6ce0: 5d 5d 0a 53 65 73 73 69 6f 6e 20 49 64 20 69 73  ]].Session Id is
6cf0: 20 74 68 65 20 63 75 72 72 65 6e 74 20 73 65 73   the current ses
6d00: 73 69 6f 6e 20 69 64 65 6e 74 69 66 69 65 72 0a  sion identifier.
6d10: 0a 5b 64 65 66 20 5b 61 72 67 20 73 65 73 73 69  .[def [arg sessi
6d20: 6f 6e 5f 74 69 63 6b 65 74 5d 5d 0a 54 69 63 6b  on_ticket]].Tick
6d30: 65 74 20 69 73 20 74 68 65 20 73 65 73 73 69 6f  et is the sessio
6d40: 6e 20 74 69 63 6b 65 74 20 69 6e 66 6f 0a 0a 5b  n ticket info..[
6d50: 64 65 66 20 5b 61 72 67 20 6c 69 66 65 74 69 6d  def [arg lifetim
6d60: 65 5d 5d 0a 4c 69 66 65 74 69 6d 65 20 69 73 20  e]].Lifetime is 
6d70: 74 68 65 20 74 69 63 6b 65 74 20 6c 69 66 65 74  the ticket lifet
6d80: 69 6d 65 20 69 6e 20 73 65 63 6f 6e 64 73 2e 0a  ime in seconds..
6d90: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70  .[list_end]..[op
6da0: 74 5f 64 65 66 20 76 65 72 69 66 79 20 5b 61 72  t_def verify [ar
6db0: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 65 70  g "channelId dep
6dc0: 74 68 20 63 65 72 74 20 73 74 61 74 75 73 20 65  th cert status e
6dd0: 72 72 6f 72 22 5d 5d 0a 54 68 69 73 20 63 61 6c  rror"]].This cal
6de0: 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65 64 20  lback was moved 
6df0: 74 6f 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69  to [option -vali
6e00: 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 69 6e 20  datecommand] in 
6e10: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69  TclTLS 1.8...[li
6e20: 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63  st_end]..[subsec
6e30: 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f 72  tion "Values for
6e40: 20 50 61 73 73 77 6f 72 64 20 43 61 6c 6c 62 61   Password Callba
6e50: 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61  ck"]..The callba
6e60: 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 74 69  ck for the [opti
6e70: 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70  on -password] op
6e80: 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20  tion is invoked 
6e90: 62 79 20 54 63 6c 54 4c 53 20 77 68 65 6e 65 76  by TclTLS whenev
6ea0: 65 72 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73  er OpenSSL needs
6eb0: 0a 74 6f 20 6f 62 74 61 69 6e 20 61 20 70 61 73  .to obtain a pas
6ec0: 73 77 6f 72 64 2e 20 53 65 65 20 62 65 6c 6f 77  sword. See below
6ed0: 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c   for the possibl
6ee0: 65 20 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73  e arguments pass
6ef0: 65 64 20 74 6f 20 74 68 65 0a 63 61 6c 6c 62 61  ed to the.callba
6f00: 63 6b 20 73 63 72 69 70 74 2e 20 54 68 65 20 75  ck script. The u
6f10: 73 65 72 20 70 72 6f 76 69 64 65 64 20 70 61 73  ser provided pas
6f20: 73 77 6f 72 64 20 69 73 20 65 78 70 65 63 74 65  sword is expecte
6f30: 64 20 74 6f 20 62 65 20 72 65 74 75 72 6e 65 64  d to be returned
6f40: 20 62 79 20 74 68 65 0a 63 61 6c 6c 62 61 63 6b   by the.callback
6f50: 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f  ...[list_begin o
6f60: 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65  ptions]..[opt_de
6f70: 66 20 70 61 73 73 77 6f 72 64 20 5b 61 72 67 20  f password [arg 
6f80: 22 72 77 66 6c 61 67 20 73 69 7a 65 22 5d 5d 0a  "rwflag size"]].
6f90: 49 6e 76 6f 6b 65 64 20 77 68 65 6e 20 6c 6f 61  Invoked when loa
6fa0: 64 69 6e 67 20 6f 72 20 73 74 6f 72 69 6e 67 20  ding or storing 
6fb0: 61 6e 20 65 6e 63 72 79 70 74 65 64 20 50 45 4d  an encrypted PEM
6fc0: 20 63 65 72 74 69 66 69 63 61 74 65 2e 20 54 68   certificate. Th
6fd0: 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a  e arguments are:
6fe0: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
6ff0: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
7000: 20 5b 61 72 67 20 72 77 66 6c 61 67 5d 5d 0a 54   [arg rwflag]].T
7010: 68 65 20 72 65 61 64 2f 77 72 69 74 65 20 66 6c  he read/write fl
7020: 61 67 20 69 73 20 30 20 66 6f 72 20 72 65 61 64  ag is 0 for read
7030: 69 6e 67 2f 64 65 63 72 79 70 74 69 6f 6e 20 6f  ing/decryption o
7040: 72 20 31 20 66 6f 72 20 77 72 69 74 69 6e 67 2f  r 1 for writing/
7050: 65 6e 63 72 79 70 74 69 6f 6e 2e 0a 54 68 65 20  encryption..The 
7060: 6c 61 74 74 65 72 20 63 61 6e 20 62 65 20 75 73  latter can be us
7070: 65 64 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20  ed to determine 
7080: 77 68 65 6e 20 74 6f 20 70 72 6f 6d 70 74 20 74  when to prompt t
7090: 68 65 20 75 73 65 72 20 74 6f 20 63 6f 6e 66 69  he user to confi
70a0: 72 6d 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e  rm..This argumen
70b0: 74 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  t is new for Tcl
70c0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 5b  TLS 1.8...[def [
70d0: 61 72 67 20 73 69 7a 65 5d 5d 0a 54 68 65 20 73  arg size]].The s
70e0: 69 7a 65 20 69 73 20 74 68 65 20 6d 61 78 69 6d  ize is the maxim
70f0: 75 6d 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65  um length of the
7100: 20 70 61 73 73 77 6f 72 64 20 69 6e 20 62 79 74   password in byt
7110: 65 73 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e  es..This argumen
7120: 74 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  t is new for Tcl
7130: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f  TLS 1.8...[list_
7140: 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  end]..[list_end]
7150: 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56  ..[subsection "V
7160: 61 6c 75 65 73 20 66 6f 72 20 56 61 6c 69 64 61  alues for Valida
7170: 74 65 20 43 6f 6d 6d 61 6e 64 20 43 61 6c 6c 62  te Command Callb
7180: 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62  ack"]..The callb
7190: 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 74  ack for the [opt
71a0: 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d  ion -validatecom
71b0: 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20  mand] option is 
71c0: 69 6e 76 6f 6b 65 64 20 64 75 72 69 6e 67 20 74  invoked during t
71d0: 68 65 20 68 61 6e 64 73 68 61 6b 65 0a 70 72 6f  he handshake.pro
71e0: 63 65 73 73 20 69 6e 20 6f 72 64 65 72 20 66 6f  cess in order fo
71f0: 72 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f  r the applicatio
7200: 6e 20 74 6f 20 76 61 6c 69 64 61 74 65 20 74 68  n to validate th
7210: 65 20 70 72 6f 76 69 64 65 64 20 76 61 6c 75 65  e provided value
7220: 28 73 29 2e 20 53 65 65 0a 62 65 6c 6f 77 20 66  (s). See.below f
7230: 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20  or the possible 
7240: 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73 65 64  arguments passed
7250: 20 74 6f 20 74 68 65 20 63 61 6c 6c 62 61 63 6b   to the callback
7260: 20 73 63 72 69 70 74 2e 20 49 66 20 6e 6f 74 0a   script. If not.
7270: 73 70 65 63 69 66 69 65 64 2c 20 4f 70 65 6e 53  specified, OpenS
7280: 53 4c 20 77 69 6c 6c 20 61 63 63 65 70 74 20 61  SL will accept a
7290: 6c 6c 20 76 61 6c 69 64 20 63 65 72 74 69 66 69  ll valid certifi
72a0: 63 61 74 65 73 20 61 6e 64 20 65 78 74 65 6e 73  cates and extens
72b0: 69 6f 6e 73 2e 20 54 6f 20 72 65 6a 65 63 74 0a  ions. To reject.
72c0: 74 68 65 20 76 61 6c 75 65 20 61 6e 64 20 61 62  the value and ab
72d0: 6f 72 74 20 74 68 65 20 63 6f 6e 6e 65 63 74 69  ort the connecti
72e0: 6f 6e 2c 20 74 68 65 20 63 61 6c 6c 62 61 63 6b  on, the callback
72f0: 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 30   should return 0
7300: 2e 20 54 6f 20 61 63 63 65 70 74 20 74 68 65 0a  . To accept the.
7310: 76 61 6c 75 65 20 61 6e 64 20 63 6f 6e 74 69 6e  value and contin
7320: 75 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f  ue the connectio
7330: 6e 2c 20 69 74 20 73 68 6f 75 6c 64 20 72 65 74  n, it should ret
7340: 75 72 6e 20 31 2e 20 54 6f 20 72 65 6a 65 63 74  urn 1. To reject
7350: 20 74 68 65 20 76 61 6c 75 65 2c 20 62 75 74 0a   the value, but.
7360: 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 63 6f 6e  continue the con
7370: 6e 65 63 74 69 6f 6e 2c 20 69 74 20 73 68 6f 75  nection, it shou
7380: 6c 64 20 72 65 74 75 72 6e 20 32 2e 20 54 68 69  ld return 2. Thi
7390: 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65  s callback is ne
73a0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
73b0: 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f  ...[list_begin o
73c0: 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65  ptions]..[opt_de
73d0: 66 20 61 6c 70 6e 20 5b 61 72 67 20 22 63 68 61  f alpn [arg "cha
73e0: 6e 6e 65 6c 49 64 20 70 72 6f 74 6f 63 6f 6c 20  nnelId protocol 
73f0: 6d 61 74 63 68 22 5d 5d 0a 46 6f 72 20 73 65 72  match"]].For ser
7400: 76 65 72 73 2c 20 74 68 69 73 20 66 6f 72 6d 20  vers, this form 
7410: 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69  of callback is i
7420: 6e 76 6f 6b 65 64 20 77 68 65 6e 20 74 68 65 20  nvoked when the 
7430: 63 6c 69 65 6e 74 20 41 4c 50 4e 20 65 78 74 65  client ALPN exte
7440: 6e 73 69 6f 6e 20 69 73 0a 72 65 63 65 69 76 65  nsion is.receive
7450: 64 2e 20 49 66 20 5b 61 72 67 20 6d 61 74 63 68  d. If [arg match
7460: 5d 20 69 73 20 74 72 75 65 2c 20 74 68 65 6e 20  ] is true, then 
7470: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 20 69  [arg protocol] i
7480: 73 20 74 68 65 20 66 69 72 73 74 0a 5b 6f 70 74  s the first.[opt
7490: 69 6f 6e 20 2d 61 6c 70 6e 5d 20 70 72 6f 74 6f  ion -alpn] proto
74a0: 63 6f 6c 20 6f 70 74 69 6f 6e 20 69 6e 20 63 6f  col option in co
74b0: 6d 6d 6f 6e 20 74 6f 20 62 6f 74 68 20 74 68 65  mmon to both the
74c0: 20 63 6c 69 65 6e 74 20 61 6e 64 20 73 65 72 76   client and serv
74d0: 65 72 2e 0a 49 66 20 6e 6f 74 2c 20 74 68 65 20  er..If not, the 
74e0: 66 69 72 73 74 20 63 6c 69 65 6e 74 20 73 70 65  first client spe
74f0: 63 69 66 69 65 64 20 70 72 6f 74 6f 63 6f 6c 20  cified protocol 
7500: 69 73 20 75 73 65 64 2e 20 54 68 69 73 20 63 61  is used. This ca
7510: 6c 6c 62 61 63 6b 20 69 73 20 63 61 6c 6c 65 64  llback is called
7520: 0a 61 66 74 65 72 20 74 68 65 20 48 65 6c 6c 6f  .after the Hello
7530: 20 61 6e 64 20 41 4c 50 4e 20 63 61 6c 6c 62 61   and ALPN callba
7540: 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 68  cks...[opt_def h
7550: 65 6c 6c 6f 20 5b 61 72 67 20 22 63 68 61 6e 6e  ello [arg "chann
7560: 65 6c 49 64 20 73 65 72 76 65 72 6e 61 6d 65 22  elId servername"
7570: 5d 5d 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20  ]].For servers, 
7580: 74 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  this form of cal
7590: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
75a0: 20 64 75 72 69 6e 67 20 63 6c 69 65 6e 74 20 68   during client h
75b0: 65 6c 6c 6f 20 6d 65 73 73 61 67 65 0a 70 72 6f  ello message.pro
75c0: 63 65 73 73 69 6e 67 2e 20 54 68 65 20 70 75 72  cessing. The pur
75d0: 70 6f 73 65 20 69 73 20 73 6f 20 74 68 65 20 73  pose is so the s
75e0: 65 72 76 65 72 20 63 61 6e 20 73 65 6c 65 63 74  erver can select
75f0: 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65   the appropriate
7600: 20 63 65 72 74 69 66 69 63 61 74 65 0a 74 6f 20   certificate.to 
7610: 70 72 65 73 65 6e 74 20 74 6f 20 74 68 65 20 63  present to the c
7620: 6c 69 65 6e 74 2c 20 61 6e 64 20 74 6f 20 6d 61  lient, and to ma
7630: 6b 65 20 6f 74 68 65 72 20 63 6f 6e 66 69 67 75  ke other configu
7640: 72 61 74 69 6f 6e 20 61 64 6a 75 73 74 6d 65 6e  ration adjustmen
7650: 74 73 20 72 65 6c 65 76 61 6e 74 0a 74 6f 20 74  ts relevant.to t
7660: 68 61 74 20 73 65 72 76 65 72 20 6e 61 6d 65 20  hat server name 
7670: 61 6e 64 20 69 74 73 20 63 6f 6e 66 69 67 75 72  and its configur
7680: 61 74 69 6f 6e 2e 20 49 74 20 69 73 20 63 61 6c  ation. It is cal
7690: 6c 65 64 20 62 65 66 6f 72 65 20 74 68 65 20 53  led before the S
76a0: 4e 49 20 61 6e 64 20 41 4c 50 4e 0a 63 61 6c 6c  NI and ALPN.call
76b0: 62 61 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66  backs...[opt_def
76c0: 20 73 6e 69 20 5b 61 72 67 20 22 63 68 61 6e 6e   sni [arg "chann
76d0: 65 6c 49 64 20 73 65 72 76 65 72 6e 61 6d 65 22  elId servername"
76e0: 5d 5d 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20  ]].For servers, 
76f0: 74 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  this form of cal
7700: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
7710: 20 77 68 65 6e 20 74 68 65 20 53 65 72 76 65 72   when the Server
7720: 20 4e 61 6d 65 20 49 6e 64 69 63 61 74 69 6f 6e   Name Indication
7730: 0a 28 53 4e 49 29 20 65 78 74 65 6e 73 69 6f 6e  .(SNI) extension
7740: 20 69 73 20 72 65 63 65 69 76 65 64 2e 20 54 68   is received. Th
7750: 65 20 5b 61 72 67 20 73 65 72 76 65 72 6e 61 6d  e [arg servernam
7760: 65 5d 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74  e] argument is t
7770: 68 65 20 63 6c 69 65 6e 74 0a 70 72 6f 76 69 64  he client.provid
7780: 65 64 20 73 65 72 76 65 72 20 6e 61 6d 65 20 73  ed server name s
7790: 70 65 63 69 66 69 65 64 20 69 6e 20 74 68 65 20  pecified in the 
77a0: 5b 6f 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e  [option -servern
77b0: 61 6d 65 3c 2f 62 3e 5d 20 6f 70 74 69 6f 6e 2e  ame</b>] option.
77c0: 20 54 68 65 0a 70 75 72 70 6f 73 65 20 69 73 20   The.purpose is 
77d0: 73 6f 20 77 68 65 6e 20 61 20 73 65 72 76 65 72  so when a server
77e0: 20 73 75 70 70 6f 72 74 73 20 6d 75 6c 74 69 70   supports multip
77f0: 6c 65 20 6e 61 6d 65 73 2c 20 74 68 65 20 72 69  le names, the ri
7800: 67 68 74 20 63 65 72 74 69 66 69 63 61 74 65 0a  ght certificate.
7810: 63 61 6e 20 62 65 20 75 73 65 64 2e 20 49 74 20  can be used. It 
7820: 69 73 20 63 61 6c 6c 65 64 20 61 66 74 65 72 20  is called after 
7830: 74 68 65 20 68 65 6c 6c 6f 20 63 61 6c 6c 62 61  the hello callba
7840: 63 6b 20 62 75 74 20 62 65 66 6f 72 65 20 74 68  ck but before th
7850: 65 20 41 4c 50 4e 0a 63 61 6c 6c 62 61 63 6b 2e  e ALPN.callback.
7860: 0a 0a 5b 6f 70 74 5f 64 65 66 20 76 65 72 69 66  ..[opt_def verif
7870: 79 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49  y [arg "channelI
7880: 64 20 64 65 70 74 68 20 63 65 72 74 20 73 74 61  d depth cert sta
7890: 74 75 73 20 65 72 72 6f 72 22 5d 5d 0a 54 68 69  tus error"]].Thi
78a0: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61  s form of callba
78b0: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79  ck is invoked by
78c0: 20 4f 70 65 6e 53 53 4c 20 77 68 65 6e 20 61 20   OpenSSL when a 
78d0: 6e 65 77 20 63 65 72 74 69 66 69 63 61 74 65 20  new certificate 
78e0: 69 73 20 72 65 63 65 69 76 65 64 0a 66 72 6f 6d  is received.from
78f0: 20 74 68 65 20 70 65 65 72 2e 20 49 74 20 61 6c   the peer. It al
7900: 6c 6f 77 73 20 74 68 65 20 63 6c 69 65 6e 74 20  lows the client 
7910: 74 6f 20 63 68 65 63 6b 20 74 68 65 20 63 65 72  to check the cer
7920: 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63  tificate verific
7930: 61 74 69 6f 6e 0a 72 65 73 75 6c 74 73 20 61 6e  ation.results an
7940: 64 20 63 68 6f 6f 73 65 20 77 68 65 74 68 65 72  d choose whether
7950: 20 74 6f 20 63 6f 6e 74 69 6e 75 65 20 6f 72 20   to continue or 
7960: 6e 6f 74 2e 20 49 74 20 69 73 20 63 61 6c 6c 65  not. It is calle
7970: 64 20 66 6f 72 20 65 61 63 68 0a 63 65 72 74 69  d for each.certi
7980: 66 69 63 61 74 65 20 69 6e 20 74 68 65 20 63 65  ficate in the ce
7990: 72 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 2e  rtificate chain.
79a0: 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77   This callback w
79b0: 61 73 20 6d 6f 76 65 64 20 66 72 6f 6d 0a 5b 6f  as moved from.[o
79c0: 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20  ption -command] 
79d0: 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54  in TclTLS 1.8. T
79e0: 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65  he arguments are
79f0: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64  :..[list_begin d
7a00: 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65  efinitions]..[de
7a10: 66 20 5b 61 72 67 20 64 65 70 74 68 5d 5d 0a 54  f [arg depth]].T
7a20: 68 65 20 64 65 70 74 68 20 69 73 20 74 68 65 20  he depth is the 
7a30: 69 6e 74 65 67 65 72 20 64 65 70 74 68 20 6f 66  integer depth of
7a40: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
7a50: 20 69 6e 20 74 68 65 20 63 65 72 74 69 66 69 63   in the certific
7a60: 61 74 65 20 63 68 61 69 6e 2c 0a 77 68 65 72 65  ate chain,.where
7a70: 20 30 20 69 73 20 74 68 65 20 70 65 65 72 20 63   0 is the peer c
7a80: 65 72 74 69 66 69 63 61 74 65 20 61 6e 64 20 68  ertificate and h
7a90: 69 67 68 65 72 20 76 61 6c 75 65 73 20 67 6f 69  igher values goi
7aa0: 6e 67 20 75 70 20 74 6f 20 74 68 65 20 43 65 72  ng up to the Cer
7ab0: 74 69 66 69 63 61 74 65 0a 41 75 74 68 6f 72 69  tificate.Authori
7ac0: 74 79 20 28 43 41 29 2e 0a 0a 5b 64 65 66 20 5b  ty (CA)...[def [
7ad0: 61 72 67 20 63 65 72 74 5d 5d 0a 54 68 65 20 63  arg cert]].The c
7ae0: 65 72 74 20 61 72 67 75 6d 65 6e 74 20 69 73 20  ert argument is 
7af0: 61 20 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61  a list of key-va
7b00: 6c 75 65 20 70 61 69 72 73 20 73 69 6d 69 6c 61  lue pairs simila
7b10: 72 20 74 6f 20 74 68 6f 73 65 20 72 65 74 75 72  r to those retur
7b20: 6e 65 64 20 62 79 0a 5b 63 6d 64 20 74 6c 73 3a  ned by.[cmd tls:
7b30: 3a 73 74 61 74 75 73 5d 2e 0a 0a 5b 64 65 66 20  :status]...[def 
7b40: 5b 61 72 67 20 73 74 61 74 75 73 5d 5d 0a 54 68  [arg status]].Th
7b50: 65 20 73 74 61 74 75 73 20 61 72 67 75 6d 65 6e  e status argumen
7b60: 74 20 69 73 20 74 68 65 20 62 6f 6f 6c 65 61 6e  t is the boolean
7b70: 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 65   validity of the
7b80: 20 63 75 72 72 65 6e 74 20 63 65 72 74 69 66 69   current certifi
7b90: 63 61 74 65 20 77 68 65 72 65 20 30 0a 69 73 20  cate where 0.is 
7ba0: 69 6e 76 61 6c 69 64 20 61 6e 64 20 31 20 69 73  invalid and 1 is
7bb0: 20 76 61 6c 69 64 2e 0a 0a 5b 64 65 66 20 5b 61   valid...[def [a
7bc0: 72 67 20 65 72 72 6f 72 5d 5d 0a 54 68 65 20 65  rg error]].The e
7bd0: 72 72 6f 72 20 61 72 67 75 6d 65 6e 74 20 69 73  rror argument is
7be0: 20 74 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61   the error messa
7bf0: 67 65 2c 20 69 66 20 61 6e 79 2c 20 67 65 6e 65  ge, if any, gene
7c00: 72 61 74 65 64 20 62 79 0a 5b 66 75 6e 20 58 35  rated by.[fun X5
7c10: 30 39 5f 53 54 4f 52 45 5f 43 54 58 5f 67 65 74  09_STORE_CTX_get
7c20: 5f 65 72 72 6f 72 28 29 5d 2e 0a 0a 5b 6c 69 73  _error()]...[lis
7c30: 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e  t_end]..[list_en
7c40: 64 5d 0a 0a 52 65 66 65 72 65 6e 63 65 20 69 6d  d]..Reference im
7c50: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66  plementations of
7c60: 20 74 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73   these callbacks
7c70: 20 61 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e   are provided in
7c80: 20 5b 66 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 0a   [file tls.tcl].
7c90: 61 73 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c  as [cmd tls::cal
7ca0: 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73  lback], [cmd tls
7cb0: 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64  ::password], and
7cc0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64   [cmd tls::valid
7cd0: 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 72 65 73  ate_command].res
7ce0: 70 65 63 74 69 76 65 6c 79 2e 20 4e 6f 74 65 20  pectively. Note 
7cf0: 74 68 61 74 20 74 68 65 73 65 20 61 72 65 20 6f  that these are o
7d00: 6e 6c 79 20 5b 65 6d 70 68 20 73 61 6d 70 6c 65  nly [emph sample
7d10: 5d 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e  ] implementation
7d20: 73 2e 20 49 6e 20 61 20 6d 6f 72 65 0a 72 65 61  s. In a more.rea
7d30: 6c 69 73 74 69 63 20 64 65 70 6c 6f 79 6d 65 6e  listic deploymen
7d40: 74 20 79 6f 75 20 77 6f 75 6c 64 20 73 70 65 63  t you would spec
7d50: 69 66 79 20 79 6f 75 72 20 6f 77 6e 20 63 61 6c  ify your own cal
7d60: 6c 62 61 63 6b 20 73 63 72 69 70 74 73 20 6f 6e  lback scripts on
7d70: 20 65 61 63 68 20 54 4c 53 0a 63 68 61 6e 6e 65   each TLS.channe
7d80: 6c 20 75 73 69 6e 67 20 74 68 65 20 5b 6f 70 74  l using the [opt
7d90: 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20 5b  ion -command], [
7da0: 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64  option -password
7db0: 5d 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d  ], and.[option -
7dc0: 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64  validate_command
7dd0: 5d 20 6f 70 74 69 6f 6e 73 2e 0a 0a 5b 70 61 72  ] options...[par
7de0: 61 5d 0a 0a 54 68 65 20 64 65 66 61 75 6c 74 20  a]..The default 
7df0: 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68  behavior when th
7e00: 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61  e [option -comma
7e10: 6e 64 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20  nd] and [option 
7e20: 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e  -validate_comman
7e30: 64 5d 0a 6f 70 74 69 6f 6e 73 20 61 72 65 20 6e  d].options are n
7e40: 6f 74 20 73 70 65 63 69 66 69 65 64 2c 20 69 73  ot specified, is
7e50: 20 66 6f 72 20 54 63 6c 54 4c 53 20 74 6f 20 70   for TclTLS to p
7e60: 72 6f 63 65 73 73 20 74 68 65 20 61 73 73 6f 63  rocess the assoc
7e70: 69 61 74 65 64 20 6c 69 62 72 61 72 79 0a 63 61  iated library.ca
7e80: 6c 6c 62 61 63 6b 73 20 69 6e 74 65 72 6e 61 6c  llbacks internal
7e90: 6c 79 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  ly. The default 
7ea0: 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68  behavior when th
7eb0: 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77  e [option -passw
7ec0: 6f 72 64 5d 20 6f 70 74 69 6f 6e 0a 69 73 20 6e  ord] option.is n
7ed0: 6f 74 20 73 70 65 63 69 66 69 65 64 20 69 73 20  ot specified is 
7ee0: 66 6f 72 20 54 63 6c 54 4c 53 20 74 6f 20 70 72  for TclTLS to pr
7ef0: 6f 63 65 73 73 20 74 68 65 20 61 73 73 6f 63 69  ocess the associ
7f00: 61 74 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c  ated library cal
7f10: 6c 62 61 63 6b 73 20 62 79 0a 61 74 74 65 6d 70  lbacks by.attemp
7f20: 74 69 6e 67 20 74 6f 20 63 61 6c 6c 20 5b 63 6d  ting to call [cm
7f30: 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d  d tls::password]
7f40: 2e 20 54 68 65 20 64 69 66 66 65 72 65 6e 63 65  . The difference
7f50: 20 62 65 74 77 65 65 6e 20 74 68 65 73 65 20 74   between these t
7f60: 77 6f 0a 62 65 68 61 76 69 6f 72 73 20 69 73 20  wo.behaviors is 
7f70: 61 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66  a consequence of
7f80: 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 63 6f 6d   maintaining com
7f90: 70 61 74 69 62 69 6c 69 74 79 20 77 69 74 68 20  patibility with 
7fa0: 65 61 72 6c 69 65 72 0a 69 6d 70 6c 65 6d 65 6e  earlier.implemen
7fb0: 74 61 74 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61 5d  tations...[para]
7fc0: 0a 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65  ..[emph "The use
7fd0: 20 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e 63   of the referenc
7fe0: 65 20 63 61 6c 6c 62 61 63 6b 73 20 5b 63 6d 64  e callbacks [cmd
7ff0: 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c   tls::callback],
8000: 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77   [cmd tls::passw
8010: 6f 72 64 5d 2c 0a 61 6e 64 20 5b 63 6d 64 20 74  ord],.and [cmd t
8020: 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d  ls::validate_com
8030: 6d 61 6e 64 5d 20 69 73 20 6e 6f 74 20 72 65 63  mand] is not rec
8040: 6f 6d 6d 65 6e 64 65 64 2e 20 54 68 65 79 20 6d  ommended. They m
8050: 61 79 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72  ay be removed fr
8060: 6f 6d 20 66 75 74 75 72 65 20 72 65 6c 65 61 73  om future releas
8070: 65 73 2e 22 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20  es."]..[section 
8080: 44 65 62 75 67 5d 0a 0a 46 6f 72 20 6d 6f 73 74  Debug]..For most
8090: 20 64 65 62 75 67 67 69 6e 67 20 6e 65 65 64 73   debugging needs
80a0: 2c 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63  , the [option -c
80b0: 61 6c 6c 62 61 63 6b 5d 20 6f 70 74 69 6f 6e 20  allback] option 
80c0: 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 70  can be used to p
80d0: 72 6f 76 69 64 65 0a 73 75 66 66 69 63 69 65 6e  rovide.sufficien
80e0: 74 20 69 6e 73 69 67 68 74 20 61 6e 64 20 69 6e  t insight and in
80f0: 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65  formation on the
8100: 20 54 4c 53 20 68 61 6e 64 73 68 61 6b 65 20 61   TLS handshake a
8110: 6e 64 20 70 72 6f 67 72 65 73 73 2e 20 49 66 0a  nd progress. If.
8120: 66 75 72 74 68 65 72 20 74 72 6f 75 62 6c 65 73  further troubles
8130: 68 6f 6f 74 69 6e 67 20 69 6e 73 69 67 68 74 20  hooting insight 
8140: 69 73 20 6e 65 65 64 65 64 2c 20 74 68 65 20 63  is needed, the c
8150: 6f 6d 70 69 6c 65 20 74 69 6d 65 20 6f 70 74 69  ompile time opti
8160: 6f 6e 0a 5b 6f 70 74 69 6f 6e 20 2d 2d 65 6e 61  on.[option --ena
8170: 62 6c 65 2d 64 65 62 75 67 5d 20 63 61 6e 20 62  ble-debug] can b
8180: 65 20 75 73 65 64 20 74 6f 20 67 65 74 20 64 65  e used to get de
8190: 74 61 69 6c 65 64 20 65 78 65 63 75 74 69 6f 6e  tailed execution
81a0: 20 66 6c 6f 77 20 73 74 61 74 75 73 2e 0a 0a 5b   flow status...[
81b0: 70 61 72 61 5d 0a 0a 54 4c 53 20 6b 65 79 20 6c  para]..TLS key l
81c0: 6f 67 67 69 6e 67 20 63 61 6e 20 62 65 20 65 6e  ogging can be en
81d0: 61 62 6c 65 64 20 62 79 20 73 65 74 74 69 6e 67  abled by setting
81e0: 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74   the environment
81f0: 20 76 61 72 69 61 62 6c 65 0a 5b 76 61 72 20 53   variable.[var S
8200: 53 4c 4b 45 59 4c 4f 47 46 49 4c 45 5d 20 74 6f  SLKEYLOGFILE] to
8210: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65   the name of the
8220: 20 66 69 6c 65 20 74 6f 20 6c 6f 67 20 74 6f 2e   file to log to.
8230: 20 54 68 65 6e 20 77 68 65 6e 65 76 65 72 20 54   Then whenever T
8240: 4c 53 20 6b 65 79 0a 6d 61 74 65 72 69 61 6c 20  LS key.material 
8250: 69 73 20 67 65 6e 65 72 61 74 65 64 20 6f 72 20  is generated or 
8260: 72 65 63 65 69 76 65 64 20 69 74 20 77 69 6c 6c  received it will
8270: 20 62 65 20 6c 6f 67 67 65 64 20 74 6f 20 74 68   be logged to th
8280: 65 20 66 69 6c 65 2e 20 54 68 69 73 20 69 73 20  e file. This is 
8290: 75 73 65 66 75 6c 0a 66 6f 72 20 6c 6f 67 67 69  useful.for loggi
82a0: 6e 67 20 6b 65 79 20 64 61 74 61 20 66 6f 72 20  ng key data for 
82b0: 6e 65 74 77 6f 72 6b 20 6c 6f 67 67 69 6e 67 20  network logging 
82c0: 74 6f 6f 6c 73 20 74 6f 20 75 73 65 20 74 6f 20  tools to use to 
82d0: 64 65 63 72 79 70 74 20 74 68 65 20 64 61 74 61  decrypt the data
82e0: 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68 65 20 5b  ...[para]..The [
82f0: 76 61 72 20 74 6c 73 3a 3a 64 65 62 75 67 5d 20  var tls::debug] 
8300: 76 61 72 69 61 62 6c 65 20 70 72 6f 76 69 64 65  variable provide
8310: 73 20 73 6f 6d 65 20 61 64 64 69 74 69 6f 6e 61  s some additiona
8320: 6c 20 63 6f 6e 74 72 6f 6c 20 6f 76 65 72 20 74  l control over t
8330: 68 65 0a 64 65 62 75 67 20 6c 6f 67 67 69 6e 67  he.debug logging
8340: 20 69 6e 20 74 68 65 20 5b 63 6d 64 20 74 6c 73   in the [cmd tls
8350: 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d  ::callback], [cm
8360: 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d  d tls::password]
8370: 2c 20 61 6e 64 0a 5b 63 6d 64 20 74 6c 73 3a 3a  , and.[cmd tls::
8380: 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64  validate_command
8390: 5d 20 64 65 66 61 75 6c 74 20 68 61 6e 64 6c 65  ] default handle
83a0: 72 73 20 69 6e 20 5b 66 69 6c 65 20 74 6c 73 2e  rs in [file tls.
83b0: 74 63 6c 5d 2e 0a 54 68 65 20 64 65 66 61 75 6c  tcl]..The defaul
83c0: 74 20 76 61 6c 75 65 20 69 73 20 30 20 77 69 74  t value is 0 wit
83d0: 68 20 68 69 67 68 65 72 20 76 61 6c 75 65 73 20  h higher values 
83e0: 70 72 6f 64 75 63 69 6e 67 20 6d 6f 72 65 20 64  producing more d
83f0: 69 61 67 6e 6f 73 74 69 63 20 6f 75 74 70 75 74  iagnostic output
8400: 2c 0a 61 6e 64 20 77 69 6c 6c 20 61 6c 73 6f 20  ,.and will also 
8410: 66 6f 72 63 65 20 74 68 65 20 76 65 72 69 66 79  force the verify
8420: 20 6d 65 74 68 6f 64 20 69 6e 20 5b 63 6d 64 20   method in [cmd 
8430: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 20 74  tls::callback] t
8440: 6f 20 61 63 63 65 70 74 20 74 68 65 0a 63 65 72  o accept the.cer
8450: 74 69 66 69 63 61 74 65 2c 20 65 76 65 6e 20 69  tificate, even i
8460: 66 20 69 74 20 69 73 20 69 6e 76 61 6c 69 64 20  f it is invalid 
8470: 77 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e  when the [option
8480: 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e   -validatecomman
8490: 64 5d 0a 6f 70 74 69 6f 6e 20 69 73 20 73 65 74  d].option is set
84a0: 20 74 6f 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61   to [cmd tls::va
84b0: 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 2e  lidate_command].
84c0: 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70 68 20  ..[para]..[emph 
84d0: 22 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20  "The use of the 
84e0: 76 61 72 69 61 62 6c 65 20 5b 76 61 72 20 74 6c  variable [var tl
84f0: 73 3a 3a 64 65 62 75 67 5d 20 69 73 20 6e 6f 74  s::debug] is not
8500: 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49 74   recommended..It
8510: 20 6d 61 79 20 62 65 20 72 65 6d 6f 76 65 64 20   may be removed 
8520: 66 72 6f 6d 20 66 75 74 75 72 65 20 72 65 6c 65  from future rele
8530: 61 73 65 73 2e 22 5d 0a 0a 5b 73 65 63 74 69 6f  ases."]..[sectio
8540: 6e 20 22 48 54 54 50 20 50 61 63 6b 61 67 65 20  n "HTTP Package 
8550: 45 78 61 6d 70 6c 65 73 22 5d 0a 0a 54 68 65 20  Examples"]..The 
8560: 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20 65 78  following are ex
8570: 61 6d 70 6c 65 20 73 63 72 69 70 74 73 20 74 6f  ample scripts to
8580: 20 64 6f 77 6e 6c 6f 61 64 20 61 20 77 65 62 70   download a webp
8590: 61 67 65 20 61 6e 64 20 66 69 6c 65 20 75 73 69  age and file usi
85a0: 6e 67 20 74 68 65 0a 68 74 74 70 20 70 61 63 6b  ng the.http pack
85b0: 61 67 65 2e 20 53 65 65 20 5b 73 65 63 74 72 65  age. See [sectre
85c0: 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56  f "Certificate V
85d0: 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20  alidation"] for 
85e0: 77 68 65 74 68 65 72 20 74 68 65 0a 5b 6f 70 74  whether the.[opt
85f0: 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70  ion -cadir], [op
8600: 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 61  tion -cafile], a
8610: 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74  nd [option -cast
8620: 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20 61 72 65  ore] options are
8630: 20 61 6c 73 6f 0a 6e 65 65 64 65 64 2e 20 53 65   also.needed. Se
8640: 65 20 74 68 65 20 64 65 6d 6f 73 20 64 69 72 65  e the demos dire
8650: 63 74 6f 72 79 20 66 6f 72 20 6d 6f 72 65 20 65  ctory for more e
8660: 78 61 6d 70 6c 65 20 73 63 72 69 70 74 73 2e 0a  xample scripts..
8670: 0a 5b 70 61 72 61 5d 0a 0a 45 78 61 6d 70 6c 65  .[para]..Example
8680: 20 23 31 3a 20 44 6f 77 6e 6c 6f 61 64 20 61 20   #1: Download a 
8690: 77 65 62 20 70 61 67 65 0a 0a 5b 65 78 61 6d 70  web page..[examp
86a0: 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65  le {..package re
86b0: 71 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61  quire http.packa
86c0: 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a  ge require tls..
86d0: 73 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f  set url "https:/
86e0: 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a 68 74  /www.tcl.tk/".ht
86f0: 74 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74  tp::register htt
8700: 70 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74  ps 443 [list ::t
8710: 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f  ls::socket -auto
8720: 73 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 72 65  servername 1 -re
8730: 71 75 69 72 65 20 31 5d 0a 0a 23 20 47 65 74 20  quire 1]..# Get 
8740: 55 52 4c 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 68  URL.set token [h
8750: 74 74 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c  ttp::geturl $url
8760: 5d 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20 65  ]..# Check for e
8770: 72 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a 3a  rror.if {[http::
8780: 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e  status $token] n
8790: 65 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75  e "ok"} {.    pu
87a0: 74 73 20 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f  ts [format "Erro
87b0: 72 20 25 73 22 20 5b 68 74 74 70 3a 3a 73 74 61  r %s" [http::sta
87c0: 74 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a  tus $token]].}..
87d0: 23 20 53 61 76 65 20 77 65 62 20 70 61 67 65 20  # Save web page 
87e0: 74 6f 20 66 69 6c 65 0a 73 65 74 20 63 68 20 5b  to file.set ch [
87f0: 6f 70 65 6e 20 65 78 61 6d 70 6c 65 2e 68 74 6d  open example.htm
8800: 6c 20 77 62 5d 0a 70 75 74 73 20 24 63 68 20 5b  l wb].puts $ch [
8810: 68 74 74 70 3a 3a 64 61 74 61 20 24 74 6f 6b 65  http::data $toke
8820: 6e 5d 0a 63 6c 6f 73 65 20 24 63 68 0a 0a 23 20  n].close $ch..# 
8830: 43 6c 65 61 6e 75 70 0a 3a 3a 68 74 74 70 3a 3a  Cleanup.::http::
8840: 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d  cleanup $token.}
8850: 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 32 3a 20 44  ]..Example #2: D
8860: 6f 77 6e 6c 6f 61 64 20 61 20 66 69 6c 65 0a 0a  ownload a file..
8870: 5b 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b  [example {..pack
8880: 61 67 65 20 72 65 71 75 69 72 65 20 68 74 74 70  age require http
8890: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
88a0: 20 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 68   tls..set url "h
88b0: 74 74 70 73 3a 2f 2f 77 69 6b 69 2e 74 63 6c 2d  ttps://wiki.tcl-
88c0: 6c 61 6e 67 2e 6f 72 67 2f 73 69 74 65 6d 61 70  lang.org/sitemap
88d0: 2e 78 6d 6c 22 0a 68 74 74 70 3a 3a 72 65 67 69  .xml".http::regi
88e0: 73 74 65 72 20 68 74 74 70 73 20 34 34 33 20 5b  ster https 443 [
88f0: 6c 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b  list ::tls::sock
8900: 65 74 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61  et -autoserverna
8910: 6d 65 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d  me 1 -require 1]
8920: 0a 0a 23 20 4f 70 65 6e 20 6f 75 74 70 75 74 20  ..# Open output 
8930: 66 69 6c 65 0a 73 65 74 20 66 69 6c 65 6e 61 6d  file.set filenam
8940: 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 75 72  e [file tail $ur
8950: 6c 5d 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20  l].set ch [open 
8960: 24 66 69 6c 65 6e 61 6d 65 20 77 62 5d 0a 0a 23  $filename wb]..#
8970: 20 47 65 74 20 66 69 6c 65 0a 73 65 74 20 74 6f   Get file.set to
8980: 6b 65 6e 20 5b 3a 3a 68 74 74 70 3a 3a 67 65 74  ken [::http::get
8990: 75 72 6c 20 24 75 72 6c 20 2d 62 6c 6f 63 6b 73  url $url -blocks
89a0: 69 7a 65 20 36 35 35 33 36 20 2d 63 68 61 6e 6e  ize 65536 -chann
89b0: 65 6c 20 24 63 68 5d 0a 0a 23 20 43 68 65 63 6b  el $ch]..# Check
89c0: 20 66 6f 72 20 65 72 72 6f 72 0a 69 66 20 7b 5b   for error.if {[
89d0: 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f  http::status $to
89e0: 6b 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a  ken] ne "ok"} {.
89f0: 20 20 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 74      puts [format
8a00: 20 22 45 72 72 6f 72 20 25 73 22 20 5b 68 74 74   "Error %s" [htt
8a10: 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e  p::status $token
8a20: 5d 5d 0a 7d 0a 0a 23 20 43 6c 65 61 6e 75 70 0a  ]].}..# Cleanup.
8a30: 63 6c 6f 73 65 20 24 63 68 0a 3a 3a 68 74 74 70  close $ch.::http
8a40: 3a 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e  ::cleanup $token
8a50: 0a 7d 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 53  .}]..[section "S
8a60: 70 65 63 69 61 6c 20 43 6f 6e 73 69 64 65 72 61  pecial Considera
8a70: 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 63 61 70  tions"]..The cap
8a80: 61 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69  abilities of thi
8a90: 73 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61  s package can va
8aa0: 72 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61  ry enormously ba
8ab0: 73 65 64 20 75 70 6f 6e 20 68 6f 77 20 74 68 65  sed upon how the
8ac0: 0a 6c 69 6e 6b 65 64 20 74 6f 20 4f 70 65 6e 53  .linked to OpenS
8ad0: 53 4c 20 6c 69 62 72 61 72 79 20 77 61 73 20 63  SL library was c
8ae0: 6f 6e 66 69 67 75 72 65 64 20 61 6e 64 20 62 75  onfigured and bu
8af0: 69 6c 74 2e 20 4e 65 77 20 76 65 72 73 69 6f 6e  ilt. New version
8b00: 73 20 6d 61 79 20 6f 62 73 6f 6c 65 74 65 0a 6f  s may obsolete.o
8b10: 6c 64 65 72 20 70 72 6f 74 6f 63 6f 6c 20 76 65  lder protocol ve
8b20: 72 73 69 6f 6e 73 2c 20 61 64 64 20 6f 72 20 72  rsions, add or r
8b30: 65 6d 6f 76 65 20 63 69 70 68 65 72 73 2c 20 63  emove ciphers, c
8b40: 68 61 6e 67 65 20 64 65 66 61 75 6c 74 20 76 61  hange default va
8b50: 6c 75 65 73 2c 20 65 74 63 2e 0a 55 73 65 20 74  lues, etc..Use t
8b60: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f  he [cmd tls::pro
8b70: 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 73  tocols] commands
8b80: 20 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 73   to obtain the s
8b90: 75 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f  upported.protoco
8ba0: 6c 20 76 65 72 73 69 6f 6e 73 2e 0a 0a 5b 6d 61  l versions...[ma
8bb0: 6e 70 61 67 65 5f 65 6e 64 5d 0a                 npage_end].