Hex Artifact Content

Artifact 4bcf529b152eabc63328c6b23520816362bb3308580c263e61f0c4be0562692f:


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 20  s.[const true]. 
1bd0: 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54  Starting in TclT
1be0: 4c 53 20 32 2e 30 2c 20 49 66 20 73 65 74 20 74  LS 2.0, If set t
1bf0: 6f 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20  o [const false] 
1c00: 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 72 65 71  and.[option -req
1c10: 75 69 72 65 5d 20 69 73 20 5b 63 6f 6e 73 74 20  uire] is [const 
1c20: 74 72 75 65 5d 2c 20 74 68 65 6e 20 74 68 69 73  true], then this
1c30: 20 77 69 6c 6c 20 62 65 20 6f 76 65 72 72 69 64   will be overrid
1c40: 64 65 6e 20 74 6f 20 5b 63 6f 6e 73 74 20 74 72  den to [const tr
1c50: 75 65 5d 2e 0a 53 65 65 20 5b 73 65 63 74 72 65  ue]..See [sectre
1c60: 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56  f "Certificate V
1c70: 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20  alidation"] for 
1c80: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b  more details...[
1c90: 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 69 72 65  opt_def -require
1ca0: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71   [arg bool]].Req
1cb0: 75 69 72 65 20 61 20 76 61 6c 69 64 20 63 65 72  uire a valid cer
1cc0: 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 74 68  tificate from th
1cd0: 65 20 70 65 65 72 20 64 75 72 69 6e 67 20 74 68  e peer during th
1ce0: 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e  e SSL handshake.
1cf0: 20 49 66 20 74 68 69 73 20 69 73 0a 73 65 74 20   If this is.set 
1d00: 74 6f 20 74 72 75 65 2c 20 74 68 65 6e 20 5b 6f  to true, then [o
1d10: 70 74 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20  ption -request] 
1d20: 6d 75 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74  must also be set
1d30: 20 74 6f 20 74 72 75 65 20 61 6e 64 20 61 20 65   to true and a e
1d40: 69 74 68 65 72 0a 5b 6f 70 74 69 6f 6e 20 2d 63  ither.[option -c
1d50: 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d  adir], [option -
1d60: 63 61 66 69 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e  cafile], [option
1d70: 20 2d 63 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61   -castore], or a
1d80: 20 70 6c 61 74 66 6f 72 6d 20 64 65 66 61 75 6c   platform defaul
1d90: 74 0a 6d 75 73 74 20 62 65 20 70 72 6f 76 69 64  t.must be provid
1da0: 65 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 76  ed in order to v
1db0: 61 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e  alidate against.
1dc0: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 6e 20   The default in 
1dd0: 54 63 6c 54 4c 53 20 31 2e 38 20 61 6e 64 0a 65  TclTLS 1.8 and.e
1de0: 61 72 6c 69 65 72 20 76 65 72 73 69 6f 6e 73 20  arlier versions 
1df0: 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d  is [const false]
1e00: 20 73 69 6e 63 65 20 6e 6f 74 20 61 6c 6c 20 70   since not all p
1e10: 6c 61 74 66 6f 72 6d 73 20 68 61 76 65 20 63 65  latforms have ce
1e20: 72 74 69 66 69 63 61 74 65 73 20 74 6f 0a 76 61  rtificates to.va
1e30: 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74 20 69  lidate against i
1e40: 6e 20 61 20 66 6f 72 6d 20 63 6f 6d 70 61 74 69  n a form compati
1e50: 62 6c 65 20 77 69 74 68 20 4f 70 65 6e 53 53 4c  ble with OpenSSL
1e60: 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63  . Starting in Tc
1e70: 6c 54 4c 53 20 32 2e 30 2c 0a 74 68 65 20 64 65  lTLS 2.0,.the de
1e80: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
1e90: 74 72 75 65 5d 2e 0a 53 65 65 20 5b 73 65 63 74  true]..See [sect
1ea0: 72 65 66 20 22 43 65 72 74 69 66 69 63 61 74 65  ref "Certificate
1eb0: 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f   Validation"] fo
1ec0: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a  r more details..
1ed0: 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 63 75 72  .[opt_def -secur
1ee0: 69 74 79 5f 6c 65 76 65 6c 20 5b 61 72 67 20 69  ity_level [arg i
1ef0: 6e 74 65 67 65 72 5d 5d 0a 53 70 65 63 69 66 69  nteger]].Specifi
1f00: 65 73 20 74 68 65 20 73 65 63 75 72 69 74 79 20  es the security 
1f10: 6c 65 76 65 6c 20 28 76 61 6c 75 65 20 66 72 6f  level (value fro
1f20: 6d 20 30 20 74 6f 20 35 29 2e 20 54 68 65 20 73  m 0 to 5). The s
1f30: 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20 61 66  ecurity level af
1f40: 66 65 63 74 73 0a 74 68 65 20 61 6c 6c 6f 77 65  fects.the allowe
1f50: 64 20 63 69 70 68 65 72 20 73 75 69 74 65 20 65  d cipher suite e
1f60: 6e 63 72 79 70 74 69 6f 6e 20 61 6c 67 6f 72 69  ncryption algori
1f70: 74 68 6d 73 2c 20 73 75 70 70 6f 72 74 65 64 20  thms, supported 
1f80: 45 43 43 20 63 75 72 76 65 73 2c 0a 73 75 70 70  ECC curves,.supp
1f90: 6f 72 74 65 64 20 73 69 67 6e 61 74 75 72 65 20  orted signature 
1fa0: 61 6c 67 6f 72 69 74 68 6d 73 2c 20 44 48 20 70  algorithms, DH p
1fb0: 61 72 61 6d 65 74 65 72 20 73 69 7a 65 73 2c 20  arameter sizes, 
1fc0: 63 65 72 74 69 66 69 63 61 74 65 20 6b 65 79 20  certificate key 
1fd0: 73 69 7a 65 73 0a 61 6e 64 20 73 69 67 6e 61 74  sizes.and signat
1fe0: 75 72 65 20 61 6c 67 6f 72 69 74 68 6d 73 2e 20  ure algorithms. 
1ff0: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 31  The default is 1
2000: 20 70 72 69 6f 72 20 74 6f 20 4f 70 65 6e 53 53   prior to OpenSS
2010: 4c 20 33 2e 32 20 61 6e 64 20 32 0a 74 68 65 72  L 3.2 and 2.ther
2020: 65 61 66 74 65 72 2e 20 4c 65 76 65 6c 20 33 20  eafter. Level 3 
2030: 61 6e 64 20 68 69 67 68 65 72 20 64 69 73 61 62  and higher disab
2040: 6c 65 20 73 75 70 70 6f 72 74 20 66 6f 72 20 73  le support for s
2050: 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 73 20 61  ession tickets a
2060: 6e 64 0a 6f 6e 6c 79 20 61 63 63 65 70 74 20 63  nd.only accept c
2070: 69 70 68 65 72 20 73 75 69 74 65 73 20 74 68 61  ipher suites tha
2080: 74 20 70 72 6f 76 69 64 65 20 66 6f 72 77 61 72  t provide forwar
2090: 64 20 73 65 63 72 65 63 79 2e 0a 0a 5b 6f 70 74  d secrecy...[opt
20a0: 5f 64 65 66 20 2d 73 65 72 76 65 72 20 5b 61 72  _def -server [ar
20b0: 67 20 62 6f 6f 6c 5d 5d 0a 53 70 65 63 69 66 69  g bool]].Specifi
20c0: 65 73 20 77 68 65 74 68 65 72 20 74 6f 20 61 63  es whether to ac
20d0: 74 20 61 73 20 61 20 73 65 72 76 65 72 20 61 6e  t as a server an
20e0: 64 20 72 65 73 70 6f 6e 64 20 77 69 74 68 20 61  d respond with a
20f0: 20 73 65 72 76 65 72 20 68 61 6e 64 73 68 61 6b   server handshak
2100: 65 20 77 68 65 6e 20 61 0a 63 6c 69 65 6e 74 20  e when a.client 
2110: 63 6f 6e 6e 65 63 74 73 20 61 6e 64 20 70 72 6f  connects and pro
2120: 76 69 64 65 73 20 61 20 63 6c 69 65 6e 74 20 68  vides a client h
2130: 61 6e 64 73 68 61 6b 65 2e 20 54 68 65 20 64 65  andshake. The de
2140: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
2150: 66 61 6c 73 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65  false]...[opt_de
2160: 66 20 2d 73 65 72 76 65 72 6e 61 6d 65 20 5b 61  f -servername [a
2170: 72 67 20 68 6f 73 74 6e 61 6d 65 5d 5d 0a 53 70  rg hostname]].Sp
2180: 65 63 69 66 79 20 74 68 65 20 70 65 65 72 27 73  ecify the peer's
2190: 20 68 6f 73 74 6e 61 6d 65 2e 20 54 68 69 73 20   hostname. This 
21a0: 69 73 20 75 73 65 64 20 74 6f 20 73 65 74 20 74  is used to set t
21b0: 68 65 20 54 4c 53 20 53 65 72 76 65 72 20 4e 61  he TLS Server Na
21c0: 6d 65 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53  me Indication.(S
21d0: 4e 49 29 20 65 78 74 65 6e 73 69 6f 6e 2e 20 53  NI) extension. S
21e0: 65 74 20 74 68 69 73 20 74 6f 20 74 68 65 20 65  et this to the e
21f0: 78 70 65 63 74 65 64 20 73 65 72 76 65 72 6e 61  xpected serverna
2200: 6d 65 20 69 6e 20 74 68 65 20 73 65 72 76 65 72  me in the server
2210: 27 73 20 63 65 72 74 69 66 69 63 61 74 65 0a 6f  's certificate.o
2220: 72 20 6f 6e 65 20 6f 66 20 74 68 65 20 53 75 62  r one of the Sub
2230: 6a 65 63 74 20 41 6c 74 65 72 6e 61 74 65 20 4e  ject Alternate N
2240: 61 6d 65 73 20 28 53 41 4e 29 2e 20 53 74 61 72  ames (SAN). Star
2250: 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ting in TclTLS 2
2260: 2e 30 2c 20 74 68 69 73 20 77 69 6c 6c 0a 64 65  .0, this will.de
2270: 66 61 75 6c 74 20 74 6f 20 74 68 65 20 68 6f 73  fault to the hos
2280: 74 20 66 6f 72 20 74 68 65 20 5b 63 6d 64 20 74  t for the [cmd t
2290: 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d  ls::socket] comm
22a0: 61 6e 64 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  and...[opt_def -
22b0: 73 65 73 73 69 6f 6e 5f 69 64 20 5b 61 72 67 20  session_id [arg 
22c0: 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 5d 0a  binary_string]].
22d0: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 73 65  Specifies the se
22e0: 73 73 69 6f 6e 20 69 64 20 74 6f 20 72 65 73 75  ssion id to resu
22f0: 6d 65 20 61 20 73 65 73 73 69 6f 6e 2e 20 4e 6f  me a session. No
2300: 74 20 73 75 70 70 6f 72 74 65 64 20 79 65 74 2e  t supported yet.
2310: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73 6c 32  ..[opt_def -ssl2
2320: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61   [arg bool]].Ena
2330: 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20 76  ble use of SSL v
2340: 32 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69  2. The default i
2350: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e  s [const false].
2360: 20 4e 6f 74 65 3a 20 52 65 63 65 6e 74 20 76 65   Note: Recent ve
2370: 72 73 69 6f 6e 73 20 6f 66 0a 4f 70 65 6e 53 53  rsions of.OpenSS
2380: 4c 20 6e 6f 20 6c 6f 6e 67 65 72 20 73 75 70 70  L no longer supp
2390: 6f 72 74 20 53 53 4c 76 32 2c 20 73 6f 20 74 68  ort SSLv2, so th
23a0: 69 73 20 6d 61 79 20 6e 6f 74 20 68 61 76 65 20  is may not have 
23b0: 61 6e 79 20 65 66 66 65 63 74 2e 20 53 65 65 20  any effect. See 
23c0: 74 68 65 0a 5b 63 6d 64 20 74 6c 73 3a 3a 70 72  the.[cmd tls::pr
23d0: 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64  otocols] command
23e0: 20 66 6f 72 20 73 75 70 70 6f 72 74 65 64 20 70   for supported p
23f0: 72 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f  rotocols...[opt_
2400: 64 65 66 20 2d 73 73 6c 33 20 5b 61 72 67 20 62  def -ssl3 [arg b
2410: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
2420: 20 6f 66 20 53 53 4c 20 76 33 2e 20 54 68 65 20   of SSL v3. The 
2430: 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73  default is [cons
2440: 74 20 66 61 6c 73 65 5d 2e 20 4e 6f 74 65 3a 20  t false]. Note: 
2450: 52 65 63 65 6e 74 20 76 65 72 73 69 6f 6e 73 0a  Recent versions.
2460: 6f 66 20 4f 70 65 6e 53 53 4c 20 6d 61 79 20 68  of OpenSSL may h
2470: 61 76 65 20 74 68 69 73 20 64 69 73 61 62 6c 65  ave this disable
2480: 64 20 61 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d  d at compile tim
2490: 65 2c 20 73 6f 20 74 68 69 73 20 6d 61 79 20 6e  e, so this may n
24a0: 6f 74 20 68 61 76 65 20 61 6e 79 0a 65 66 66 65  ot have any.effe
24b0: 63 74 2e 20 53 65 65 20 74 68 65 20 5b 63 6d 64  ct. See the [cmd
24c0: 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d   tls::protocols]
24d0: 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70   command for sup
24e0: 70 6f 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73  ported protocols
24f0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73  ...[opt_def -tls
2500: 31 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e  1 [arg bool]].En
2510: 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20  able use of TLS 
2520: 76 31 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  v1. The default 
2530: 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e  is [const true].
2540: 20 4e 6f 74 65 3a 20 54 4c 53 20 31 2e 30 20 6e   Note: TLS 1.0 n
2550: 65 65 64 73 0a 53 48 41 31 20 74 6f 20 6f 70 65  eeds.SHA1 to ope
2560: 72 61 74 65 2c 20 77 68 69 63 68 20 69 73 20 6f  rate, which is o
2570: 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 69 6e  nly available in
2580: 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20   security level 
2590: 30 20 66 6f 72 20 4f 70 65 6e 20 53 53 4c 20 33  0 for Open SSL 3
25a0: 2e 30 2b 2e 0a 53 65 65 20 74 68 65 20 5b 61 72  .0+..See the [ar
25b0: 67 20 2d 73 65 63 75 72 69 74 79 5f 6c 65 76 65  g -security_leve
25c0: 6c 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74  l] option...[opt
25d0: 5f 64 65 66 20 2d 74 6c 73 31 2e 31 20 5b 61 72  _def -tls1.1 [ar
25e0: 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20  g bool]].Enable 
25f0: 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 31 2e  use of TLS v1.1.
2600: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
2610: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 4e 6f  [const true]. No
2620: 74 65 3a 20 54 4c 53 20 31 2e 31 20 6e 65 65 64  te: TLS 1.1 need
2630: 73 0a 53 48 41 31 20 74 6f 20 6f 70 65 72 61 74  s.SHA1 to operat
2640: 65 2c 20 77 68 69 63 68 20 69 73 20 6f 6e 6c 79  e, which is only
2650: 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 73 65   available in se
2660: 63 75 72 69 74 79 20 6c 65 76 65 6c 20 30 20 66  curity level 0 f
2670: 6f 72 20 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b  or Open SSL 3.0+
2680: 2e 0a 53 65 65 20 74 68 65 20 5b 61 72 67 20 2d  ..See the [arg -
2690: 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20  security_level] 
26a0: 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65  option...[opt_de
26b0: 66 20 2d 74 6c 73 31 2e 32 20 5b 61 72 67 20 62  f -tls1.2 [arg b
26c0: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
26d0: 20 6f 66 20 54 4c 53 20 76 31 2e 32 2e 20 54 68   of TLS v1.2. Th
26e0: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
26f0: 6e 73 74 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74  nst true]...[opt
2700: 5f 64 65 66 20 2d 74 6c 73 31 2e 33 20 5b 61 72  _def -tls1.3 [ar
2710: 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20  g bool]].Enable 
2720: 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 33 2e  use of TLS v1.3.
2730: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
2740: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 0a 0a 5b  [const true]...[
2750: 6f 70 74 5f 64 65 66 20 2d 76 61 6c 69 64 61 74  opt_def -validat
2760: 65 63 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61  ecommand [arg ca
2770: 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69  llback]].Specifi
2780: 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20  es the callback 
2790: 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e 76 6f 6b  command to invok
27a0: 65 20 74 6f 20 76 61 6c 69 64 61 74 65 20 74 68  e to validate th
27b0: 65 20 70 65 65 72 20 63 65 72 74 69 66 69 63 61  e peer certifica
27c0: 74 65 73 0a 61 6e 64 20 6f 74 68 65 72 20 63 6f  tes.and other co
27d0: 6e 66 69 67 20 69 6e 66 6f 20 64 75 72 69 6e 67  nfig info during
27e0: 20 74 68 65 20 70 72 6f 74 6f 63 6f 6c 20 6e 65   the protocol ne
27f0: 67 6f 74 69 61 74 69 6f 6e 20 70 68 61 73 65 2e  gotiation phase.
2800: 20 54 68 69 73 20 63 61 6e 20 62 65 20 75 73 65   This can be use
2810: 64 0a 62 79 20 54 43 4c 20 73 63 72 69 70 74 73  d.by TCL scripts
2820: 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 69   to perform thei
2830: 72 20 6f 77 6e 20 43 65 72 74 69 66 69 63 61 74  r own Certificat
2840: 65 20 56 61 6c 69 64 61 74 69 6f 6e 20 74 6f 20  e Validation to 
2850: 73 75 70 70 6c 65 6d 65 6e 74 20 74 68 65 0a 64  supplement the.d
2860: 65 66 61 75 6c 74 20 76 61 6c 69 64 61 74 69 6f  efault validatio
2870: 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 4f 70  n provided by Op
2880: 65 6e 53 53 4c 2e 20 54 68 65 20 73 63 72 69 70  enSSL. The scrip
2890: 74 20 6d 75 73 74 20 72 65 74 75 72 6e 20 61 20  t must return a 
28a0: 62 6f 6f 6c 65 61 6e 20 74 72 75 65 0a 74 6f 20  boolean true.to 
28b0: 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 6e 65 67  continue the neg
28c0: 6f 74 69 61 74 69 6f 6e 2e 20 53 65 65 20 5b 73  otiation. See [s
28d0: 65 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b  ectref "Callback
28e0: 20 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d   Options"] for m
28f0: 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b 6c 69 73 74  ore info...[list
2900: 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  _end]..[call [cm
2910: 64 20 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d  d tls::unimport]
2920: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a   [arg channel]].
2930: 0a 43 6f 6d 70 6c 69 6d 65 6e 74 20 74 6f 20 5b  .Compliment to [
2940: 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d  cmd tls::import]
2950: 2e 20 55 73 65 64 20 74 6f 20 72 65 6d 6f 76 65  . Used to remove
2960: 20 74 68 65 20 74 6f 70 20 6c 65 76 65 6c 20 73   the top level s
2970: 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 0a 66  tacked channel.f
2980: 72 6f 6d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c  rom [arg channel
2990: 5d 2e 20 54 68 69 73 20 75 6e 73 74 61 63 6b 73  ]. This unstacks
29a0: 20 74 68 65 20 65 6e 63 72 79 70 74 69 6f 6e 20   the encryption 
29b0: 6f 66 20 61 20 72 65 67 75 6c 61 72 20 54 43 4c  of a regular TCL
29c0: 20 63 68 61 6e 6e 65 6c 2e 20 41 6e 0a 65 72 72   channel. An.err
29d0: 6f 72 20 69 73 20 74 68 72 6f 77 6e 20 69 66 20  or is thrown if 
29e0: 54 4c 53 20 69 73 20 6e 6f 74 20 74 68 65 20 74  TLS is not the t
29f0: 6f 70 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e  op stacked chann
2a00: 65 6c 20 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c 20  el type...[call 
2a10: 5b 63 6d 64 20 74 6c 73 3a 3a 68 61 6e 64 73 68  [cmd tls::handsh
2a20: 61 6b 65 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65  ake] [arg channe
2a30: 6c 5d 5d 0a 0a 46 6f 72 63 65 73 20 74 68 65 20  l]]..Forces the 
2a40: 54 4c 53 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20  TLS negotiation 
2a50: 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 74 61 6b  handshake to tak
2a60: 65 20 70 6c 61 63 65 20 69 6d 6d 65 64 69 61 74  e place immediat
2a70: 65 6c 79 2c 20 61 6e 64 20 72 65 74 75 72 6e 73  ely, and returns
2a80: 20 30 0a 69 66 20 68 61 6e 64 73 68 61 6b 65 20   0.if handshake 
2a90: 69 73 20 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67  is still in prog
2aa0: 72 65 73 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69  ress (non-blocki
2ab0: 6e 67 29 2c 20 6f 72 20 31 20 69 66 20 74 68 65  ng), or 1 if the
2ac0: 20 68 61 6e 64 73 68 61 6b 65 20 77 61 73 0a 73   handshake was.s
2ad0: 75 63 63 65 73 73 66 75 6c 2e 20 49 66 20 74 68  uccessful. If th
2ae0: 65 20 68 61 6e 64 73 68 61 6b 65 20 66 61 69 6c  e handshake fail
2af0: 65 64 2c 20 61 6e 20 65 72 72 6f 72 20 77 69 6c  ed, an error wil
2b00: 6c 20 62 65 20 72 65 74 75 72 6e 65 64 2e 0a 0a  l be returned...
2b10: 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a  [call [cmd tls::
2b20: 73 74 61 74 75 73 5d 20 5b 6f 70 74 20 5b 6f 70  status] [opt [op
2b30: 74 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 5d 20 5b 61  tion -local]] [a
2b40: 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65  rg channel]]..Re
2b50: 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65 6e  turns the curren
2b60: 74 20 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53  t status of an S
2b70: 53 4c 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20  SL channel. The 
2b80: 72 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73 74  result is a list
2b90: 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 0a 70 61   of key-value.pa
2ba0: 69 72 73 20 64 65 73 63 72 69 62 69 6e 67 20 74  irs describing t
2bb0: 68 65 20 53 53 4c 2c 20 63 65 72 74 69 66 69 63  he SSL, certific
2bc0: 61 74 65 2c 20 61 6e 64 20 63 65 72 74 69 66 69  ate, and certifi
2bd0: 63 61 74 65 20 76 65 72 69 66 69 63 61 74 69 6f  cate verificatio
2be0: 6e 20 73 74 61 74 75 73 2e 20 49 66 0a 74 68 65  n status. If.the
2bf0: 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 20 68   SSL handshake h
2c00: 61 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c  as not yet compl
2c10: 65 74 65 64 2c 20 61 6e 20 65 6d 70 74 79 20 6c  eted, an empty l
2c20: 69 73 74 20 69 73 20 72 65 74 75 72 6e 65 64 2e  ist is returned.
2c30: 20 49 66 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20   If the.[option 
2c40: 2d 6c 6f 63 61 6c 5d 20 6f 70 74 69 6f 6e 20 69  -local] option i
2c50: 73 20 73 70 65 63 69 66 69 65 64 2c 20 74 68 65  s specified, the
2c60: 6e 20 74 68 65 20 6c 6f 63 61 6c 20 63 65 72 74  n the local cert
2c70: 69 66 69 63 61 74 65 20 69 73 20 75 73 65 64 2e  ificate is used.
2c80: 20 52 65 74 75 72 6e 65 64 0a 76 61 6c 75 65 73   Returned.values
2c90: 20 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61   include:..[para
2ca0: 5d 0a 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b  ]..SSL Status..[
2cb0: 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e  list_begin defin
2cc0: 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b  itions]..[def "[
2cd0: 76 61 72 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70  var alpn] [arg p
2ce0: 72 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70  rotocol]"].The p
2cf0: 72 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64  rotocol selected
2d00: 20 61 66 74 65 72 20 41 70 70 6c 69 63 61 74 69   after Applicati
2d10: 6f 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f  on-Layer Protoco
2d20: 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e 20 28 41  l Negotiation (A
2d30: 4c 50 4e 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  LPN)...[def "[va
2d40: 72 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20 63  r cipher] [arg c
2d50: 69 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75 72  ipher]"].The cur
2d60: 72 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75  rent cipher in u
2d70: 73 65 20 66 6f 72 20 74 68 65 20 73 65 73 73 69  se for the sessi
2d80: 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  on...[def "[var 
2d90: 70 65 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e  peername] [arg n
2da0: 61 6d 65 5d 22 5d 0a 54 68 65 20 70 65 65 72 6e  ame]"].The peern
2db0: 61 6d 65 20 66 72 6f 6d 20 74 68 65 20 63 65 72  ame from the cer
2dc0: 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20  tificate...[def 
2dd0: 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20  "[var protocol] 
2de0: 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a  [arg version]"].
2df0: 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72  The protocol ver
2e00: 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 68  sion used for th
2e10: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53  e connection: SS
2e20: 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20  L2, SSL3, TLS1, 
2e30: 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20  TLS1.1, TLS1.2, 
2e40: 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f  TLS1.3, or unkno
2e50: 77 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  wn...[def "[var 
2e60: 73 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d  sbits] [arg n]"]
2e70: 0a 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 62  .The number of b
2e80: 69 74 73 20 75 73 65 64 20 66 6f 72 20 74 68 65  its used for the
2e90: 20 73 65 73 73 69 6f 6e 20 6b 65 79 2e 0a 0a 5b   session key...[
2ea0: 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74  def "[var signat
2eb0: 75 72 65 48 61 73 68 41 6c 67 6f 72 69 74 68 6d  ureHashAlgorithm
2ec0: 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68 6d  ] [arg algorithm
2ed0: 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61 74 75 72  ]"].The signatur
2ee0: 65 20 68 61 73 68 20 61 6c 67 6f 72 69 74 68 6d  e hash algorithm
2ef0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69  ...[def "[var si
2f00: 67 6e 61 74 75 72 65 54 79 70 65 5d 20 5b 61 72  gnatureType] [ar
2f10: 67 20 74 79 70 65 5d 22 5d 0a 54 68 65 20 73 69  g type]"].The si
2f20: 67 6e 61 74 75 72 65 20 74 79 70 65 20 76 61 6c  gnature type val
2f30: 75 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ue...[def "[var 
2f40: 76 65 72 69 66 79 44 65 70 74 68 5d 20 5b 61 72  verifyDepth] [ar
2f50: 67 20 6e 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20 64  g n]"].Maximum d
2f60: 65 70 74 68 20 66 6f 72 20 74 68 65 20 63 65 72  epth for the cer
2f70: 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 20 76  tificate chain v
2f80: 65 72 69 66 69 63 61 74 69 6f 6e 2e 20 44 65 66  erification. Def
2f90: 61 75 6c 74 20 69 73 20 2d 31 2c 20 74 6f 20 63  ault is -1, to c
2fa0: 68 65 63 6b 20 61 6c 6c 2e 0a 0a 5b 64 65 66 20  heck all...[def 
2fb0: 22 5b 76 61 72 20 76 65 72 69 66 79 4d 6f 64 65  "[var verifyMode
2fc0: 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c  ] [arg list]"].L
2fd0: 69 73 74 20 6f 66 20 63 65 72 74 69 66 69 63 61  ist of certifica
2fe0: 74 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20  te verification 
2ff0: 6d 6f 64 65 73 2e 0a 0a 5b 64 65 66 20 22 5b 76  modes...[def "[v
3000: 61 72 20 76 65 72 69 66 79 52 65 73 75 6c 74 5d  ar verifyResult]
3010: 20 5b 61 72 67 20 72 65 73 75 6c 74 5d 22 5d 0a   [arg result]"].
3020: 43 65 72 74 69 66 69 63 61 74 65 20 76 65 72 69  Certificate veri
3030: 66 69 63 61 74 69 6f 6e 20 72 65 73 75 6c 74 2e  fication result.
3040: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 61 5f  ..[def "[var ca_
3050: 6e 61 6d 65 73 5d 20 5b 61 72 67 20 6c 69 73 74  names] [arg list
3060: 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 74 68 65 20  ]"].List of the 
3070: 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68  Certificate Auth
3080: 6f 72 69 74 69 65 73 20 75 73 65 64 20 74 6f 20  orities used to 
3090: 63 72 65 61 74 65 20 74 68 65 20 63 65 72 74 69  create the certi
30a0: 66 69 63 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65  ficate...[list_e
30b0: 6e 64 5d 0a 0a 43 65 72 74 69 66 69 63 61 74 65  nd]..Certificate
30c0: 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62   Status..[list_b
30d0: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73  egin definitions
30e0: 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c  ]..[def "[var al
30f0: 6c 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  l] [arg string]"
3100: 5d 0a 44 75 6d 70 20 6f 66 20 61 6c 6c 20 63 65  ].Dump of all ce
3110: 72 74 69 66 69 63 61 74 65 20 69 6e 66 6f 2e 0a  rtificate info..
3120: 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72 73  .[def "[var vers
3130: 69 6f 6e 5d 20 5b 61 72 67 20 76 61 6c 75 65 5d  ion] [arg value]
3140: 22 5d 0a 54 68 65 20 63 65 72 74 69 66 69 63 61  "].The certifica
3150: 74 65 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64 65  te version...[de
3160: 66 20 22 5b 76 61 72 20 73 65 72 69 61 6c 4e 75  f "[var serialNu
3170: 6d 62 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e  mber] [arg strin
3180: 67 5d 22 5d 0a 54 68 65 20 73 65 72 69 61 6c 20  g]"].The serial 
3190: 6e 75 6d 62 65 72 20 6f 66 20 74 68 65 20 63 65  number of the ce
31a0: 72 74 69 66 69 63 61 74 65 20 61 73 20 61 20 68  rtificate as a h
31b0: 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65 66  ex string...[def
31c0: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65   "[var signature
31d0: 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68 6d  ] [arg algorithm
31e0: 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c 67 6f 72  ]"].Cipher algor
31f0: 69 74 68 6d 20 75 73 65 64 20 66 6f 72 20 63 65  ithm used for ce
3200: 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74  rtificate signat
3210: 75 72 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ure...[def "[var
3220: 20 69 73 73 75 65 72 5d 20 5b 61 72 67 20 73 74   issuer] [arg st
3230: 72 69 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73 74  ring]"].The dist
3240: 69 6e 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28  inguished name (
3250: 44 4e 29 20 6f 66 20 74 68 65 20 63 65 72 74 69  DN) of the certi
3260: 66 69 63 61 74 65 20 69 73 73 75 65 72 2e 0a 0a  ficate issuer...
3270: 5b 64 65 66 20 22 5b 76 61 72 20 6e 6f 74 42 65  [def "[var notBe
3280: 66 6f 72 65 5d 20 5b 61 72 67 20 64 61 74 65 5d  fore] [arg date]
3290: 22 5d 0a 54 68 65 20 62 65 67 69 6e 6e 69 6e 67  "].The beginning
32a0: 20 64 61 74 65 20 6f 66 20 74 68 65 20 63 65 72   date of the cer
32b0: 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 69 74  tificate validit
32c0: 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6e  y...[def "[var n
32d0: 6f 74 41 66 74 65 72 5d 20 5b 61 72 67 20 64 61  otAfter] [arg da
32e0: 74 65 5d 22 5d 0a 54 68 65 20 65 78 70 69 72 61  te]"].The expira
32f0: 74 69 6f 6e 20 64 61 74 65 20 6f 66 20 74 68 65  tion date of the
3300: 20 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c   certificate val
3310: 69 64 69 74 79 2e 0a 0a 5b 64 65 66 20 22 5b 76  idity...[def "[v
3320: 61 72 20 73 75 62 6a 65 63 74 5d 20 5b 61 72 67  ar subject] [arg
3330: 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20 64   string]"].The d
3340: 69 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d  istinguished nam
3350: 65 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65  e (DN) of the ce
3360: 72 74 69 66 69 63 61 74 65 20 73 75 62 6a 65 63  rtificate subjec
3370: 74 2e 20 46 69 65 6c 64 73 20 69 6e 63 6c 75 64  t. Fields includ
3380: 65 3a 20 43 6f 6d 6d 6f 6e 0a 4e 61 6d 65 20 28  e: Common.Name (
3390: 43 4e 29 2c 20 4f 72 67 61 6e 69 7a 61 74 69 6f  CN), Organizatio
33a0: 6e 20 28 4f 29 2c 20 4c 6f 63 61 6c 69 74 79 20  n (O), Locality 
33b0: 6f 72 20 43 69 74 79 20 28 4c 29 2c 20 53 74 61  or City (L), Sta
33c0: 74 65 20 6f 72 20 50 72 6f 76 69 6e 63 65 20 28  te or Province (
33d0: 53 29 2c 20 61 6e 64 0a 43 6f 75 6e 74 72 79 20  S), and.Country 
33e0: 4e 61 6d 65 20 28 43 29 2e 0a 0a 5b 64 65 66 20  Name (C)...[def 
33f0: 22 5b 76 61 72 20 69 73 73 75 65 72 55 6e 69 71  "[var issuerUniq
3400: 75 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e  ueID] [arg strin
3410: 67 5d 22 5d 0a 54 68 65 20 69 73 73 75 65 72 20  g]"].The issuer 
3420: 75 6e 69 71 75 65 20 69 64 2e 0a 0a 5b 64 65 66  unique id...[def
3430: 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74 55 6e   "[var subjectUn
3440: 69 71 75 65 49 44 5d 20 5b 61 72 67 20 73 74 72  iqueID] [arg str
3450: 69 6e 67 5d 22 5d 0a 54 68 65 20 73 75 62 6a 65  ing]"].The subje
3460: 63 74 20 75 6e 69 71 75 65 20 69 64 2e 0a 0a 5b  ct unique id...[
3470: 64 65 66 20 22 5b 76 61 72 20 6e 75 6d 5f 65 78  def "[var num_ex
3480: 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6e  tensions] [arg n
3490: 5d 22 5d 0a 4e 75 6d 62 65 72 20 6f 66 20 63 65  ]"].Number of ce
34a0: 72 74 69 66 69 63 61 74 65 20 65 78 74 65 6e 73  rtificate extens
34b0: 69 6f 6e 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  ions...[def "[va
34c0: 72 20 65 78 74 65 6e 73 69 6f 6e 73 5d 20 5b 61  r extensions] [a
34d0: 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20  rg list]"].List 
34e0: 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 20 65  of certificate e
34f0: 78 74 65 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e 0a  xtension names..
3500: 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 75 74 68  .[def "[var auth
3510: 6f 72 69 74 79 4b 65 79 49 64 65 6e 74 69 66 69  orityKeyIdentifi
3520: 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  er] [arg string]
3530: 22 5d 0a 41 75 74 68 6f 72 69 74 79 20 4b 65 79  "].Authority Key
3540: 20 49 64 65 6e 74 69 66 69 65 72 20 28 41 4b 49   Identifier (AKI
3550: 29 20 6f 66 20 74 68 65 20 49 73 73 75 69 6e 67  ) of the Issuing
3560: 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65 20   CA certificate 
3570: 74 68 61 74 20 73 69 67 6e 65 64 20 74 68 65 0a  that signed the.
3580: 53 53 4c 20 63 65 72 74 69 66 69 63 61 74 65 20  SSL certificate 
3590: 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e  as a hex string.
35a0: 20 54 68 69 73 20 76 61 6c 75 65 20 6d 61 74 63   This value matc
35b0: 68 65 73 20 74 68 65 20 53 4b 49 20 76 61 6c 75  hes the SKI valu
35c0: 65 20 6f 66 20 74 68 65 0a 49 6e 74 65 72 6d 65  e of the.Interme
35d0: 64 69 61 74 65 20 43 41 20 63 65 72 74 69 66 69  diate CA certifi
35e0: 63 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  cate...[def "[va
35f0: 72 20 73 75 62 6a 65 63 74 4b 65 79 49 64 65 6e  r subjectKeyIden
3600: 74 69 66 69 65 72 5d 20 5b 61 72 67 20 73 74 72  tifier] [arg str
3610: 69 6e 67 5d 22 5d 0a 53 75 62 6a 65 63 74 20 4b  ing]"].Subject K
3620: 65 79 20 49 64 65 6e 74 69 66 69 65 72 20 28 53  ey Identifier (S
3630: 4b 49 29 20 68 61 73 68 20 6f 66 20 74 68 65 20  KI) hash of the 
3640: 70 75 62 6c 69 63 20 6b 65 79 20 69 6e 73 69 64  public key insid
3650: 65 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  e the certificat
3660: 65 20 61 73 20 61 0a 68 65 78 20 73 74 72 69 6e  e as a.hex strin
3670: 67 2e 20 55 73 65 64 20 74 6f 20 69 64 65 6e 74  g. Used to ident
3680: 69 66 79 20 63 65 72 74 69 66 69 63 61 74 65 73  ify certificates
3690: 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 20 61 20   that contain a 
36a0: 70 61 72 74 69 63 75 6c 61 72 20 70 75 62 6c 69  particular publi
36b0: 63 20 6b 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76  c key...[def "[v
36c0: 61 72 20 73 75 62 6a 65 63 74 41 6c 74 4e 61 6d  ar subjectAltNam
36d0: 65 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a  e] [arg list]"].
36e0: 4c 69 73 74 20 6f 66 20 61 6c 6c 20 6f 66 20 74  List of all of t
36f0: 68 65 20 53 75 62 6a 65 63 74 20 41 6c 74 65 72  he Subject Alter
3700: 6e 61 74 69 76 65 20 4e 61 6d 65 73 20 28 53 41  native Names (SA
3710: 4e 29 20 69 6e 63 6c 75 64 69 6e 67 20 64 6f 6d  N) including dom
3720: 61 69 6e 20 6e 61 6d 65 73 2c 20 73 75 62 0a 64  ain names, sub.d
3730: 6f 6d 61 69 6e 73 2c 20 61 6e 64 20 49 50 20 61  omains, and IP a
3740: 64 64 72 65 73 73 65 73 20 74 68 61 74 20 61 72  ddresses that ar
3750: 65 20 73 65 63 75 72 65 64 20 62 79 20 74 68 65  e secured by the
3760: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b   certificate...[
3770: 64 65 66 20 22 5b 76 61 72 20 6f 63 73 70 5d 20  def "[var ocsp] 
3780: 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73  [arg list]"].Lis
3790: 74 20 6f 66 20 61 6c 6c 20 4f 6e 6c 69 6e 65 20  t of all Online 
37a0: 43 65 72 74 69 66 69 63 61 74 65 20 53 74 61 74  Certificate Stat
37b0: 75 73 20 50 72 6f 74 6f 63 6f 6c 20 28 4f 43 53  us Protocol (OCS
37c0: 50 29 20 55 52 4c 73 20 74 68 61 74 20 63 61 6e  P) URLs that can
37d0: 20 62 65 20 75 73 65 64 20 74 6f 0a 63 68 65 63   be used to.chec
37e0: 6b 20 74 68 65 20 76 61 6c 69 64 69 74 79 20 6f  k the validity o
37f0: 66 20 74 68 69 73 20 63 65 72 74 69 66 69 63 61  f this certifica
3800: 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  te...[def "[var 
3810: 63 65 72 74 69 66 69 63 61 74 65 5d 20 5b 61 72  certificate] [ar
3820: 67 20 63 65 72 74 5d 22 5d 0a 54 68 65 20 50 45  g cert]"].The PE
3830: 4d 20 65 6e 63 6f 64 65 64 20 63 65 72 74 69 66  M encoded certif
3840: 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76  icate...[def "[v
3850: 61 72 20 73 69 67 6e 61 74 75 72 65 41 6c 67 6f  ar signatureAlgo
3860: 72 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f  rithm] [arg algo
3870: 72 69 74 68 6d 5d 22 5d 0a 43 69 70 68 65 72 20  rithm]"].Cipher 
3880: 61 6c 67 6f 72 69 74 68 6d 20 75 73 65 64 20 66  algorithm used f
3890: 6f 72 20 74 68 65 20 63 65 72 74 69 66 69 63 61  or the certifica
38a0: 74 65 20 73 69 67 6e 61 74 75 72 65 2e 0a 0a 5b  te signature...[
38b0: 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74  def "[var signat
38c0: 75 72 65 56 61 6c 75 65 5d 20 5b 61 72 67 20 73  ureValue] [arg s
38d0: 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66 69  tring]"].Certifi
38e0: 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 61  cate signature a
38f0: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a  s a hex string..
3900: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e  .[def "[var sign
3910: 61 74 75 72 65 44 69 67 65 73 74 5d 20 5b 61 72  atureDigest] [ar
3920: 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 43 65 72  g version]"].Cer
3930: 74 69 66 69 63 61 74 65 20 73 69 67 6e 69 6e 67  tificate signing
3940: 20 64 69 67 65 73 74 20 61 73 20 61 20 68 65 78   digest as a hex
3950: 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65 66 20 22   string...[def "
3960: 5b 76 61 72 20 70 75 62 6c 69 63 4b 65 79 41 6c  [var publicKeyAl
3970: 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c  gorithm] [arg al
3980: 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 65 72 74 69  gorithm]"].Certi
3990: 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65  ficate signature
39a0: 20 70 75 62 6c 69 63 20 6b 65 79 20 61 6c 67 6f   public key algo
39b0: 72 69 74 68 6d 2e 0a 0a 5b 64 65 66 20 22 5b 76  rithm...[def "[v
39c0: 61 72 20 70 75 62 6c 69 63 4b 65 79 5d 20 5b 61  ar publicKey] [a
39d0: 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72  rg string]"].Cer
39e0: 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75  tificate signatu
39f0: 72 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 73  re public key as
3a00: 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a   a hex string...
3a10: 5b 64 65 66 20 22 5b 76 61 72 20 62 69 74 73 5d  [def "[var bits]
3a20: 20 5b 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65   [arg n]"].Numbe
3a30: 72 20 6f 66 20 62 69 74 73 20 75 73 65 64 20 66  r of bits used f
3a40: 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 20 73  or certificate s
3a50: 69 67 6e 61 74 75 72 65 20 6b 65 79 2e 0a 0a 5b  ignature key...[
3a60: 64 65 66 20 22 5b 76 61 72 20 73 65 6c 66 5f 73  def "[var self_s
3a70: 69 67 6e 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c  igned] [arg bool
3a80: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74  ean]"].Whether t
3a90: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 73  he certificate s
3aa0: 69 67 6e 61 74 75 72 65 20 69 73 20 73 65 6c 66  ignature is self
3ab0: 20 73 69 67 6e 65 64 2e 0a 0a 5b 64 65 66 20 22   signed...[def "
3ac0: 5b 76 61 72 20 73 68 61 31 5f 68 61 73 68 5d 20  [var sha1_hash] 
3ad0: 5b 61 72 67 20 68 61 73 68 5d 22 5d 0a 54 68 65  [arg hash]"].The
3ae0: 20 53 48 41 31 20 68 61 73 68 20 6f 66 20 74 68   SHA1 hash of th
3af0: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73  e certificate as
3b00: 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a   a hex string...
3b10: 5b 64 65 66 20 22 5b 76 61 72 20 73 68 61 32 35  [def "[var sha25
3b20: 36 5f 68 61 73 68 5d 20 5b 61 72 67 20 68 61 73  6_hash] [arg has
3b30: 68 5d 22 5d 0a 54 68 65 20 53 48 41 32 35 36 20  h]"].The SHA256 
3b40: 68 61 73 68 20 6f 66 20 74 68 65 20 63 65 72 74  hash of the cert
3b50: 69 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78  ificate as a hex
3b60: 20 73 74 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f   string...[list_
3b70: 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  end]..[call [cmd
3b80: 20 74 6c 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e   tls::connection
3b90: 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d  ] [arg channel]]
3ba0: 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 20 63 75  ..Returns the cu
3bb0: 72 72 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e  rrent connection
3bc0: 20 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53   status of an SS
3bd0: 4c 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72  L channel. The r
3be0: 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73 74 0a  esult is a list.
3bf0: 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69  of key-value pai
3c00: 72 73 20 64 65 73 63 72 69 62 69 6e 67 20 74 68  rs describing th
3c10: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 20 52 65  e connection. Re
3c20: 74 75 72 6e 65 64 20 76 61 6c 75 65 73 20 69 6e  turned values in
3c30: 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a  clude:..[para]..
3c40: 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73  SSL Status..[lis
3c50: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
3c60: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ons]..[def "[var
3c70: 20 73 74 61 74 65 5d 20 5b 61 72 67 20 73 74 61   state] [arg sta
3c80: 74 65 5d 22 5d 0a 53 74 61 74 65 20 6f 66 20 74  te]"].State of t
3c90: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a  he connection...
3ca0: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 72 76 65  [def "[var serve
3cb0: 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65  rname] [arg name
3cc0: 5d 22 5d 0a 54 68 65 20 6e 61 6d 65 20 6f 66 20  ]"].The name of 
3cd0: 74 68 65 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f  the connected to
3ce0: 20 73 65 72 76 65 72 2e 0a 0a 5b 64 65 66 20 22   server...[def "
3cf0: 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b  [var protocol] [
3d00: 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54  arg version]"].T
3d10: 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73  he protocol vers
3d20: 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 68 65  ion used for the
3d30: 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c   connection: SSL
3d40: 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54  2, SSL3, TLS1, T
3d50: 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54  LS1.1, TLS1.2, T
3d60: 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77  LS1.3, or unknow
3d70: 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 72  n...[def "[var r
3d80: 65 6e 65 67 6f 74 69 61 74 69 6f 6e 5f 61 6c 6c  enegotiation_all
3d90: 6f 77 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65  owed] [arg boole
3da0: 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 70 72  an]"].Whether pr
3db0: 6f 74 6f 63 6f 6c 20 72 65 6e 65 67 6f 74 69 61  otocol renegotia
3dc0: 74 69 6f 6e 20 69 73 20 73 75 70 70 6f 72 74 65  tion is supporte
3dd0: 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20  d or not...[def 
3de0: 22 5b 76 61 72 20 73 65 63 75 72 69 74 79 5f 6c  "[var security_l
3df0: 65 76 65 6c 5d 20 5b 61 72 67 20 6c 65 76 65 6c  evel] [arg level
3e00: 5d 22 5d 0a 54 68 65 20 73 65 63 75 72 69 74 79  ]"].The security
3e10: 20 6c 65 76 65 6c 20 75 73 65 64 20 66 6f 72 20   level used for 
3e20: 73 65 6c 65 63 74 69 6f 6e 20 6f 66 20 63 69 70  selection of cip
3e30: 68 65 72 73 2c 20 6b 65 79 20 73 69 7a 65 2c 20  hers, key size, 
3e40: 65 74 63 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  etc...[def "[var
3e50: 20 73 65 73 73 69 6f 6e 5f 72 65 75 73 65 64 5d   session_reused]
3e60: 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d   [arg boolean]"]
3e70: 0a 57 68 65 74 68 65 72 20 74 68 65 20 73 65 73  .Whether the ses
3e80: 73 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 72 65  sion has been re
3e90: 75 73 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64  used or not...[d
3ea0: 65 66 20 22 5b 76 61 72 20 69 73 5f 73 65 72 76  ef "[var is_serv
3eb0: 65 72 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e  er] [arg boolean
3ec0: 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20  ]"].Whether the 
3ed0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 69 73 20 63 6f  connection is co
3ee0: 6e 66 69 67 75 72 65 64 20 61 73 20 61 20 73 65  nfigured as a se
3ef0: 72 76 65 72 20 28 31 29 20 6f 72 20 63 6c 69 65  rver (1) or clie
3f00: 6e 74 20 28 30 29 2e 0a 0a 5b 64 65 66 20 22 5b  nt (0)...[def "[
3f10: 76 61 72 20 63 6f 6d 70 72 65 73 73 69 6f 6e 5d  var compression]
3f20: 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 43 6f   [arg mode]"].Co
3f30: 6d 70 72 65 73 73 69 6f 6e 20 6d 65 74 68 6f 64  mpression method
3f40: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65 78  ...[def "[var ex
3f50: 70 61 6e 73 69 6f 6e 5d 20 5b 61 72 67 20 6d 6f  pansion] [arg mo
3f60: 64 65 5d 22 5d 0a 45 78 70 61 6e 73 69 6f 6e 20  de]"].Expansion 
3f70: 6d 65 74 68 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b  method...[def "[
3f80: 76 61 72 20 63 61 4c 69 73 74 5d 20 5b 61 72 67  var caList] [arg
3f90: 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66   list]"].List of
3fa0: 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74   Certificate Aut
3fb0: 68 6f 72 69 74 69 65 73 20 28 43 41 29 20 66 6f  horities (CA) fo
3fc0: 72 20 58 2e 35 30 39 20 63 65 72 74 69 66 69 63  r X.509 certific
3fd0: 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  ate...[list_end]
3fe0: 0a 0a 43 69 70 68 65 72 20 49 6e 66 6f 0a 0a 5b  ..Cipher Info..[
3ff0: 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e  list_begin defin
4000: 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b  itions]..[def "[
4010: 76 61 72 20 63 69 70 68 65 72 5d 20 5b 61 72 67  var cipher] [arg
4020: 20 63 69 70 68 65 72 5d 22 5d 0a 54 68 65 20 63   cipher]"].The c
4030: 75 72 72 65 6e 74 20 63 69 70 68 65 72 20 69 6e  urrent cipher in
4040: 20 75 73 65 20 66 6f 72 20 74 68 65 20 63 6f 6e   use for the con
4050: 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22  nection...[def "
4060: 5b 76 61 72 20 73 74 61 6e 64 61 72 64 5f 6e 61  [var standard_na
4070: 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d  me] [arg name]"]
4080: 0a 54 68 65 20 73 74 61 6e 64 61 72 64 20 52 46  .The standard RF
4090: 43 20 6e 61 6d 65 20 6f 66 20 63 69 70 68 65 72  C name of cipher
40a0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c  ...[def "[var al
40b0: 67 6f 72 69 74 68 6d 5f 62 69 74 73 5d 20 5b 61  gorithm_bits] [a
40c0: 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62  rg n]"].The numb
40d0: 65 72 20 6f 66 20 70 72 6f 63 65 73 73 65 64 20  er of processed 
40e0: 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 63 69  bits used for ci
40f0: 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  pher...[def "[va
4100: 72 20 73 65 63 72 65 74 5f 62 69 74 73 5d 20 5b  r secret_bits] [
4110: 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d  arg n]"].The num
4120: 62 65 72 20 6f 66 20 73 65 63 72 65 74 20 62 69  ber of secret bi
4130: 74 73 20 75 73 65 64 20 66 6f 72 20 63 69 70 68  ts used for ciph
4140: 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  er...[def "[var 
4150: 6d 69 6e 5f 76 65 72 73 69 6f 6e 5d 20 5b 61 72  min_version] [ar
4160: 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65  g version]"].The
4170: 20 6d 69 6e 69 6d 75 6d 20 70 72 6f 74 6f 63 6f   minimum protoco
4180: 6c 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 63 69  l version for ci
4190: 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  pher...[def "[va
41a0: 72 20 63 69 70 68 65 72 5f 69 73 5f 61 65 61 64  r cipher_is_aead
41b0: 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22  ] [arg boolean]"
41c0: 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 63 69  ].Whether the ci
41d0: 70 68 65 72 20 69 73 20 41 75 74 68 65 6e 74 69  pher is Authenti
41e0: 63 61 74 65 64 20 45 6e 63 72 79 70 74 69 6f 6e  cated Encryption
41f0: 20 77 69 74 68 20 41 73 73 6f 63 69 61 74 65 64   with Associated
4200: 20 44 61 74 61 20 28 41 45 41 44 29 2e 0a 0a 5b   Data (AEAD)...[
4210: 64 65 66 20 22 5b 76 61 72 20 63 69 70 68 65 72  def "[var cipher
4220: 5f 69 64 5d 20 5b 61 72 67 20 69 64 5d 22 5d 0a  _id] [arg id]"].
4230: 54 68 65 20 4f 70 65 6e 53 53 4c 20 63 69 70 68  The OpenSSL ciph
4240: 65 72 20 69 64 2e 0a 0a 5b 64 65 66 20 22 5b 76  er id...[def "[v
4250: 61 72 20 64 65 73 63 72 69 70 74 69 6f 6e 5d 20  ar description] 
4260: 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 41  [arg string]"].A
4270: 20 74 65 78 74 20 64 65 73 63 72 69 70 74 69 6f   text descriptio
4280: 6e 20 6f 66 20 74 68 65 20 63 69 70 68 65 72 2e  n of the cipher.
4290: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 68 61 6e  ..[def "[var han
42a0: 64 73 68 61 6b 65 5f 64 69 67 65 73 74 5d 20 5b  dshake_digest] [
42b0: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 44  arg boolean]"].D
42c0: 69 67 65 73 74 20 75 73 65 64 20 64 75 72 69 6e  igest used durin
42d0: 67 20 68 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b 6c  g handshake...[l
42e0: 69 73 74 5f 65 6e 64 5d 0a 0a 53 65 73 73 69 6f  ist_end]..Sessio
42f0: 6e 20 49 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65  n Info..[list_be
4300: 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d  gin definitions]
4310: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 70  ..[def "[var alp
4320: 6e 5d 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c  n] [arg protocol
4330: 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c  ]"].The protocol
4340: 20 73 65 6c 65 63 74 65 64 20 61 66 74 65 72 20   selected after 
4350: 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65  Application-Laye
4360: 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74  r Protocol Negot
4370: 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a 0a  iation (ALPN)...
4380: 5b 64 65 66 20 22 5b 76 61 72 20 72 65 73 75 6d  [def "[var resum
4390: 61 62 6c 65 5d 20 5b 61 72 67 20 62 6f 6f 6c 65  able] [arg boole
43a0: 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68  an]"].Whether th
43b0: 65 20 73 65 73 73 69 6f 6e 20 63 61 6e 20 62 65  e session can be
43c0: 20 72 65 73 75 6d 65 64 20 6f 72 20 6e 6f 74 2e   resumed or not.
43d0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74 61  ..[def "[var sta
43e0: 72 74 5f 74 69 6d 65 5d 20 5b 61 72 67 20 73 65  rt_time] [arg se
43f0: 63 6f 6e 64 73 5d 22 5d 0a 54 69 6d 65 20 73 69  conds]"].Time si
4400: 6e 63 65 20 73 65 73 73 69 6f 6e 20 73 74 61 72  nce session star
4410: 74 65 64 20 69 6e 20 73 65 63 6f 6e 64 73 20 73  ted in seconds s
4420: 69 6e 63 65 20 65 70 6f 63 68 2e 0a 0a 5b 64 65  ince epoch...[de
4430: 66 20 22 5b 76 61 72 20 74 69 6d 65 6f 75 74 5d  f "[var timeout]
4440: 20 5b 61 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d   [arg seconds]"]
4450: 0a 4d 61 78 20 64 75 72 61 74 69 6f 6e 20 6f 66  .Max duration of
4460: 20 73 65 73 73 69 6f 6e 20 69 6e 20 73 65 63 6f   session in seco
4470: 6e 64 73 20 62 65 66 6f 72 65 20 74 69 6d 65 2d  nds before time-
4480: 6f 75 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  out...[def "[var
4490: 20 6c 69 66 65 74 69 6d 65 5d 20 5b 61 72 67 20   lifetime] [arg 
44a0: 73 65 63 6f 6e 64 73 5d 22 5d 0a 53 65 73 73 69  seconds]"].Sessi
44b0: 6f 6e 20 74 69 63 6b 65 74 20 6c 69 66 65 74 69  on ticket lifeti
44c0: 6d 65 20 68 69 6e 74 20 69 6e 20 73 65 63 6f 6e  me hint in secon
44d0: 64 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ds...[def "[var 
44e0: 73 65 73 73 69 6f 6e 5f 69 64 5d 20 5b 61 72 67  session_id] [arg
44f0: 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22   binary_string]"
4500: 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e  ].Unique session
4510: 20 69 64 20 66 6f 72 20 75 73 65 20 69 6e 20 72   id for use in r
4520: 65 73 75 6d 69 6e 67 20 74 68 65 20 73 65 73 73  esuming the sess
4530: 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ion...[def "[var
4540: 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74 5d   session_ticket]
4550: 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72   [arg binary_str
4560: 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65  ing]"].Unique se
4570: 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 66 6f 72  ssion ticket for
4580: 20 75 73 65 20 69 6e 20 72 65 73 75 6d 69 6e 67   use in resuming
4590: 20 74 68 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b   the session...[
45a0: 64 65 66 20 22 5b 76 61 72 20 74 69 63 6b 65 74  def "[var ticket
45b0: 5f 61 70 70 5f 64 61 74 61 5d 20 5b 61 72 67 20  _app_data] [arg 
45c0: 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d  binary_string]"]
45d0: 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20  .Unique session 
45e0: 74 69 63 6b 65 74 20 61 70 70 6c 69 63 61 74 69  ticket applicati
45f0: 6f 6e 20 64 61 74 61 2e 0a 0a 5b 64 65 66 20 22  on data...[def "
4600: 5b 76 61 72 20 6d 61 73 74 65 72 5f 6b 65 79 5d  [var master_key]
4610: 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72   [arg binary_str
4620: 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65  ing]"].Unique se
4630: 73 73 69 6f 6e 20 6d 61 73 74 65 72 20 6b 65 79  ssion master key
4640: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
4650: 73 73 69 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64 65  ssion_cache_mode
4660: 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 53  ] [arg mode]"].S
4670: 65 72 76 65 72 20 63 61 63 68 65 20 6d 6f 64 65  erver cache mode
4680: 20 28 63 6c 69 65 6e 74 2c 20 73 65 72 76 65 72   (client, server
4690: 2c 20 6f 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c 69  , or both)...[li
46a0: 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b  st_end]..[call [
46b0: 63 6d 64 20 74 6c 73 3a 3a 63 69 70 68 65 72 73  cmd tls::ciphers
46c0: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 70 72 6f 74  ] [opt [arg prot
46d0: 6f 63 6f 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72 67  ocol]] [opt [arg
46e0: 20 76 65 72 62 6f 73 65 5d 5d 20 5b 6f 70 74 20   verbose]] [opt 
46f0: 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 5d 5d  [arg supported]]
4700: 5d 0a 0a 57 69 74 68 6f 75 74 20 61 6e 79 20 61  ]..Without any a
4710: 72 67 73 2c 20 72 65 74 75 72 6e 73 20 61 20 6c  rgs, returns a l
4720: 69 73 74 20 6f 66 20 61 6c 6c 20 73 79 6d 6d 65  ist of all symme
4730: 74 72 69 63 20 63 69 70 68 65 72 73 20 66 6f 72  tric ciphers for
4740: 20 75 73 65 20 77 69 74 68 20 74 68 65 0a 5b 61   use with the.[a
4750: 72 67 20 2d 63 69 70 68 65 72 5d 20 6f 70 74 69  rg -cipher] opti
4760: 6f 6e 2e 20 57 69 74 68 20 5b 61 72 67 20 70 72  on. With [arg pr
4770: 6f 74 6f 63 6f 6c 5d 2c 20 6f 6e 6c 79 20 74 68  otocol], only th
4780: 65 20 63 69 70 68 65 72 73 20 73 75 70 70 6f 72  e ciphers suppor
4790: 74 65 64 20 66 6f 72 20 74 68 61 74 0a 70 72 6f  ted for that.pro
47a0: 74 6f 63 6f 6c 20 61 72 65 20 72 65 74 75 72 6e  tocol are return
47b0: 65 64 2e 20 53 65 65 20 74 68 65 20 5b 63 6d 64  ed. See the [cmd
47c0: 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d   tls::protocols]
47d0: 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 74 68 65   command for the
47e0: 20 73 75 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f   supported.proto
47f0: 63 6f 6c 73 2e 20 49 66 20 5b 61 72 67 20 76 65  cols. If [arg ve
4800: 72 62 6f 73 65 5d 20 69 73 20 73 70 65 63 69 66  rbose] is specif
4810: 69 65 64 20 61 73 20 74 72 75 65 20 74 68 65 6e  ied as true then
4820: 20 61 20 76 65 72 62 6f 73 65 2c 20 68 75 6d 61   a verbose, huma
4830: 6e 20 72 65 61 64 61 62 6c 65 0a 6c 69 73 74 20  n readable.list 
4840: 69 73 20 72 65 74 75 72 6e 65 64 20 77 69 74 68  is returned with
4850: 20 61 64 64 69 74 69 6f 6e 61 6c 20 69 6e 66 6f   additional info
4860: 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 63  rmation on the c
4870: 69 70 68 65 72 2e 20 49 66 20 5b 61 72 67 20 73  ipher. If [arg s
4880: 75 70 70 6f 72 74 65 64 5d 0a 69 73 20 73 70 65  upported].is spe
4890: 63 69 66 69 65 64 20 61 73 20 74 72 75 65 2c 20  cified as true, 
48a0: 74 68 65 6e 20 6f 6e 6c 79 20 74 68 65 20 63 69  then only the ci
48b0: 70 68 65 72 73 20 73 75 70 70 6f 72 74 65 64 20  phers supported 
48c0: 66 6f 72 20 70 72 6f 74 6f 63 6f 6c 20 77 69 6c  for protocol wil
48d0: 6c 20 62 65 20 6c 69 73 74 65 64 2e 0a 0a 5b 63  l be listed...[c
48e0: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72  all [cmd tls::pr
48f0: 6f 74 6f 63 6f 6c 73 5d 5d 0a 0a 52 65 74 75 72  otocols]]..Retur
4900: 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65  ns a list of the
4910: 20 73 75 70 70 6f 72 74 65 64 20 53 53 4c 2f 54   supported SSL/T
4920: 4c 53 20 70 72 6f 74 6f 63 6f 6c 73 2e 20 56 61  LS protocols. Va
4930: 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65 3a 0a  lid values are:.
4940: 5b 63 6f 6e 73 74 20 73 73 6c 32 5d 2c 20 5b 63  [const ssl2], [c
4950: 6f 6e 73 74 20 73 73 6c 33 5d 2c 20 5b 63 6f 6e  onst ssl3], [con
4960: 73 74 20 74 6c 73 31 5d 2c 20 5b 63 6f 6e 73 74  st tls1], [const
4970: 20 74 6c 73 31 2e 31 5d 2c 20 5b 63 6f 6e 73 74   tls1.1], [const
4980: 20 74 6c 73 31 2e 32 5d 2c 20 61 6e 64 0a 5b 63   tls1.2], and.[c
4990: 6f 6e 73 74 20 74 6c 73 31 2e 33 5d 2e 20 45 78  onst tls1.3]. Ex
49a0: 61 63 74 20 6c 69 73 74 20 64 65 70 65 6e 64 73  act list depends
49b0: 20 6f 6e 20 4f 70 65 6e 53 53 4c 20 76 65 72 73   on OpenSSL vers
49c0: 69 6f 6e 20 61 6e 64 20 63 6f 6d 70 69 6c 65 20  ion and compile 
49d0: 74 69 6d 65 20 66 6c 61 67 73 2e 0a 0a 5b 63 61  time flags...[ca
49e0: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 65 72  ll [cmd tls::ver
49f0: 73 69 6f 6e 5d 5d 0a 0a 52 65 74 75 72 6e 73 20  sion]]..Returns 
4a00: 74 68 65 20 4f 70 65 6e 53 53 4c 20 76 65 72 73  the OpenSSL vers
4a10: 69 6f 6e 20 73 74 72 69 6e 67 2e 0a 0a 5b 6c 69  ion string...[li
4a20: 73 74 5f 65 6e 64 5d 0a 0a 0a 5b 73 65 63 74 69  st_end]...[secti
4a30: 6f 6e 20 22 43 65 72 74 69 66 69 63 61 74 65 20  on "Certificate 
4a40: 56 61 6c 69 64 61 74 69 6f 6e 22 5d 0a 0a 5b 73  Validation"]..[s
4a50: 75 62 73 65 63 74 69 6f 6e 20 22 50 4b 49 20 61  ubsection "PKI a
4a60: 6e 64 20 43 65 72 74 69 66 69 63 61 74 65 73 22  nd Certificates"
4a70: 5d 0a 0a 55 73 69 6e 67 20 74 68 65 20 50 75 62  ]..Using the Pub
4a80: 6c 69 63 20 4b 65 79 20 49 6e 66 72 61 73 74 72  lic Key Infrastr
4a90: 75 63 74 75 72 65 20 28 50 4b 49 29 2c 20 65 61  ucture (PKI), ea
4aa0: 63 68 20 75 73 65 72 20 63 72 65 61 74 65 73 20  ch user creates 
4ab0: 61 20 70 72 69 76 61 74 65 20 6b 65 79 20 74 68  a private key th
4ac0: 61 74 0a 6f 6e 6c 79 20 74 68 65 79 20 6b 6e 6f  at.only they kno
4ad0: 77 20 61 62 6f 75 74 20 61 6e 64 20 61 20 70 75  w about and a pu
4ae0: 62 6c 69 63 20 6b 65 79 20 74 68 65 79 20 63 61  blic key they ca
4af0: 6e 20 65 78 63 68 61 6e 67 65 20 77 69 74 68 20  n exchange with 
4b00: 6f 74 68 65 72 73 20 66 6f 72 20 75 73 65 20 69  others for use i
4b10: 6e 0a 65 6e 63 72 79 70 74 69 6e 67 20 61 6e 64  n.encrypting and
4b20: 20 64 65 63 72 79 70 74 69 6e 67 20 64 61 74 61   decrypting data
4b30: 2e 20 54 68 65 20 70 72 6f 63 65 73 73 20 69 73  . The process is
4b40: 20 74 68 65 20 73 65 6e 64 65 72 20 65 6e 63 72   the sender encr
4b50: 79 70 74 73 20 74 68 65 69 72 20 64 61 74 61 0a  ypts their data.
4b60: 75 73 69 6e 67 20 74 68 65 69 72 20 70 72 69 76  using their priv
4b70: 61 74 65 20 6b 65 79 20 61 6e 64 20 74 68 65 20  ate key and the 
4b80: 72 65 63 65 69 76 65 72 27 73 20 70 75 62 6c 69  receiver's publi
4b90: 63 20 6b 65 79 2e 20 54 68 65 20 64 61 74 61 20  c key. The data 
4ba0: 69 73 20 74 68 65 6e 20 73 65 6e 74 0a 74 6f 20  is then sent.to 
4bb0: 74 68 65 20 72 65 63 65 69 76 65 72 2e 20 49 6e  the receiver. In
4bc0: 20 61 20 73 69 6d 69 6c 61 72 20 6d 61 6e 6e 65   a similar manne
4bd0: 72 2c 20 74 68 65 20 72 65 63 65 69 76 65 72 20  r, the receiver 
4be0: 75 73 65 73 20 74 68 65 69 72 20 70 72 69 76 61  uses their priva
4bf0: 74 65 20 6b 65 79 20 61 6e 64 0a 74 68 65 20 73  te key and.the s
4c00: 65 6e 64 65 72 27 73 20 70 75 62 6c 69 63 20 6b  ender's public k
4c10: 65 79 20 74 6f 20 64 65 63 72 79 70 74 20 74 68  ey to decrypt th
4c20: 65 20 64 61 74 61 2e 20 54 68 69 73 20 70 72 6f  e data. This pro
4c30: 76 69 64 65 73 20 64 61 74 61 20 69 6e 74 65 67  vides data integ
4c40: 72 69 74 79 2c 20 74 6f 0a 65 6e 73 75 72 65 20  rity, to.ensure 
4c50: 74 68 65 20 64 61 74 61 20 63 61 6e 27 74 20 62  the data can't b
4c60: 65 20 76 69 65 77 65 64 20 6f 72 20 61 6c 74 65  e viewed or alte
4c70: 72 65 64 20 64 75 72 69 6e 67 20 74 72 61 6e 73  red during trans
4c80: 70 6f 72 74 2e 20 53 65 65 20 74 68 65 0a 5b 6f  port. See the.[o
4c90: 70 74 69 6f 6e 20 2d 6b 65 79 5d 20 61 6e 64 20  ption -key] and 
4ca0: 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79 66 69 6c 65  [option -keyfile
4cb0: 5d 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 68 6f  ] options for ho
4cc0: 77 20 74 6f 20 73 70 65 63 69 66 79 20 74 68 65  w to specify the
4cd0: 20 70 72 69 76 61 74 65 20 6b 65 79 2e 0a 41 6c   private key..Al
4ce0: 73 6f 20 73 65 65 20 74 68 65 20 5b 6f 70 74 69  so see the [opti
4cf0: 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70  on -password] op
4d00: 74 69 6f 6e 20 66 6f 72 20 68 6f 77 20 74 6f 20  tion for how to 
4d10: 70 72 6f 76 69 64 65 20 74 68 65 20 70 61 73 73  provide the pass
4d20: 77 6f 72 64 2e 0a 5b 70 61 72 61 5d 0a 49 6e 20  word..[para].In 
4d30: 6f 72 64 65 72 20 74 6f 20 70 72 6f 76 69 64 65  order to provide
4d40: 20 61 75 74 68 65 6e 74 69 63 61 74 69 6f 6e 2c   authentication,
4d50: 20 69 2e 65 2e 20 65 6e 73 75 72 69 6e 67 20 73   i.e. ensuring s
4d60: 6f 6d 65 6f 6e 65 20 69 73 20 77 68 6f 20 74 68  omeone is who th
4d70: 65 79 20 73 61 79 20 74 68 65 79 0a 61 72 65 2c  ey say they.are,
4d80: 20 74 68 65 20 70 75 62 6c 69 63 20 6b 65 79 20   the public key 
4d90: 61 6e 64 20 75 73 65 72 20 69 64 65 6e 74 69 66  and user identif
4da0: 69 63 61 74 69 6f 6e 20 69 6e 66 6f 20 69 73 20  ication info is 
4db0: 73 74 6f 72 65 64 20 69 6e 20 61 20 58 2e 35 30  stored in a X.50
4dc0: 39 0a 63 65 72 74 69 66 69 63 61 74 65 20 61 6e  9.certificate an
4dd0: 64 20 74 68 61 74 20 63 65 72 74 69 66 69 63 61  d that certifica
4de0: 74 65 20 69 73 20 61 75 74 68 65 6e 74 69 63 61  te is authentica
4df0: 74 65 64 20 28 69 2e 65 2e 20 73 69 67 6e 65 64  ted (i.e. signed
4e00: 29 20 62 79 20 61 20 43 65 72 74 69 66 69 63 61  ) by a Certifica
4e10: 74 65 0a 41 75 74 68 6f 72 69 74 79 20 28 43 41  te.Authority (CA
4e20: 29 2e 20 55 73 65 72 73 20 63 61 6e 20 74 68 65  ). Users can the
4e30: 6e 20 65 78 63 68 61 6e 67 65 20 74 68 65 73 65  n exchange these
4e40: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 64 75   certificates du
4e50: 72 69 6e 67 20 74 68 65 20 54 4c 53 0a 69 6e 69  ring the TLS.ini
4e60: 74 69 61 6c 69 7a 61 74 69 6f 6e 20 70 72 6f 63  tialization proc
4e70: 65 73 73 20 61 6e 64 20 63 68 65 63 6b 20 74 68  ess and check th
4e80: 65 6d 20 61 67 61 69 6e 73 74 20 74 68 65 20 72  em against the r
4e90: 6f 6f 74 20 43 41 20 63 65 72 74 69 66 69 63 61  oot CA certifica
4ea0: 74 65 73 20 74 6f 20 65 6e 73 75 72 65 0a 74 68  tes to ensure.th
4eb0: 65 79 20 61 72 65 20 76 61 6c 69 64 2e 20 54 68  ey are valid. Th
4ec0: 69 73 20 69 73 20 68 61 6e 64 6c 65 64 20 62 79  is is handled by
4ed0: 20 4f 70 65 6e 53 53 4c 20 76 69 61 20 74 68 65   OpenSSL via the
4ee0: 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65 73   [option -reques
4ef0: 74 5d 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d  t] and.[option -
4f00: 72 65 71 75 69 72 65 5d 20 6f 70 74 69 6f 6e 73  require] options
4f10: 2e 20 53 65 65 20 74 68 65 20 5b 6f 70 74 69 6f  . See the [optio
4f20: 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69  n -cadir], [opti
4f30: 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61 6e 64 0a  on -cadir], and.
4f40: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65  [option -castore
4f50: 5d 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 68 6f  ] options for ho
4f60: 77 20 74 70 20 73 70 65 63 69 66 79 20 77 68 65  w tp specify whe
4f70: 72 65 20 74 6f 20 66 69 6e 64 20 74 68 65 20 43  re to find the C
4f80: 41 20 63 65 72 74 69 66 69 63 61 74 65 73 2e 0a  A certificates..
4f90: 4f 70 74 69 6f 6e 61 6c 6c 79 2c 20 69 6e 20 61  Optionally, in a
4fa0: 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 2c   future release,
4fb0: 20 74 68 65 79 20 63 61 6e 20 61 6c 73 6f 20 62   they can also b
4fc0: 65 20 63 68 65 63 6b 65 64 20 61 67 61 69 6e 73  e checked agains
4fd0: 74 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  t the Certificat
4fe0: 65 0a 52 65 76 6f 63 61 74 69 6f 6e 20 4c 69 73  e.Revocation Lis
4ff0: 74 20 28 43 52 4c 29 20 6f 66 20 72 65 76 6f 6b  t (CRL) of revok
5000: 65 64 20 63 65 72 74 69 66 69 63 61 74 65 73 2e  ed certificates.
5010: 20 43 65 72 74 69 66 69 63 61 74 65 73 20 63 61   Certificates ca
5020: 6e 20 61 6c 73 6f 20 62 65 0a 73 65 6c 66 2d 73  n also be.self-s
5030: 69 67 6e 65 64 2c 20 62 75 74 20 74 68 65 79 20  igned, but they 
5040: 61 72 65 20 62 79 20 64 65 66 61 75 6c 74 20 6e  are by default n
5050: 6f 74 20 74 72 75 73 74 65 64 20 75 6e 6c 65 73  ot trusted unles
5060: 73 20 79 6f 75 20 61 64 64 20 74 68 65 6d 20 74  s you add them t
5070: 6f 20 79 6f 75 72 0a 63 65 72 74 69 66 69 63 61  o your.certifica
5080: 74 65 20 73 74 6f 72 65 2e 0a 5b 70 61 72 61 5d  te store..[para]
5090: 0a 54 79 70 69 63 61 6c 6c 79 20 77 68 65 6e 20  .Typically when 
50a0: 76 69 73 69 74 69 6e 67 20 77 65 62 20 73 69 74  visiting web sit
50b0: 65 73 2c 20 6f 6e 6c 79 20 74 68 65 20 63 6c 69  es, only the cli
50c0: 65 6e 74 20 6e 65 65 64 73 20 74 6f 20 63 68 65  ent needs to che
50d0: 63 6b 20 74 68 65 20 73 65 72 76 65 72 27 73 0a  ck the server's.
50e0: 63 65 72 74 69 66 69 63 61 74 65 20 74 6f 20 65  certificate to e
50f0: 6e 73 75 72 65 20 69 74 20 69 73 20 76 61 6c 69  nsure it is vali
5100: 64 2e 20 54 68 65 20 73 65 72 76 65 72 20 64 6f  d. The server do
5110: 65 73 6e 27 74 20 6e 65 65 64 20 74 6f 20 63 68  esn't need to ch
5120: 65 63 6b 20 74 68 65 20 63 6c 69 65 6e 74 0a 63  eck the client.c
5130: 65 72 74 69 66 69 63 61 74 65 20 75 6e 6c 65 73  ertificate unles
5140: 73 20 79 6f 75 20 6e 65 65 64 20 74 6f 20 61 75  s you need to au
5150: 74 68 65 6e 74 69 63 61 74 65 20 77 69 74 68 20  thenticate with 
5160: 74 68 65 6d 20 74 6f 20 6c 6f 67 69 6e 2c 20 65  them to login, e
5170: 74 63 2e 20 53 65 65 20 74 68 65 0a 5b 6f 70 74  tc. See the.[opt
5180: 69 6f 6e 20 2d 63 65 72 74 5d 20 61 6e 64 20 5b  ion -cert] and [
5190: 6f 70 74 69 6f 6e 20 2d 63 65 72 74 66 69 6c 65  option -certfile
51a0: 5d 20 6f 70 74 69 6f 6e 73 20 69 66 20 79 6f 75  ] options if you
51b0: 20 6e 65 65 64 20 74 6f 20 70 72 6f 76 69 64 65   need to provide
51c0: 20 61 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a   a certificate..
51d0: 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 53  ..[subsection "S
51e0: 75 6d 6d 61 72 79 20 6f 66 20 63 6f 6d 6d 61 6e  ummary of comman
51f0: 64 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 73 22 5d  d line options"]
5200: 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20  ..The following 
5210: 6f 70 74 69 6f 6e 73 20 61 72 65 20 75 73 65 64  options are used
5220: 20 66 6f 72 20 70 65 65 72 20 63 65 72 74 69 66   for peer certif
5230: 69 63 61 74 65 20 76 61 6c 69 64 61 74 69 6f 6e  icate validation
5240: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f  :..[list_begin o
5250: 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65  ptions]..[opt_de
5260: 66 20 2d 63 61 64 69 72 20 5b 61 72 67 20 64 69  f -cadir [arg di
5270: 72 65 63 74 6f 72 79 5d 5d 0a 53 70 65 63 69 66  rectory]].Specif
5280: 69 65 73 20 74 68 65 20 64 69 72 65 63 74 6f 72  ies the director
5290: 79 20 77 68 65 72 65 20 74 68 65 20 43 65 72 74  y where the Cert
52a0: 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74  ificate Authorit
52b0: 79 20 28 43 41 29 20 63 65 72 74 69 66 69 63 61  y (CA) certifica
52c0: 74 65 73 20 61 72 65 0a 73 74 6f 72 65 64 2e 20  tes are.stored. 
52d0: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 70  The default is p
52e0: 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66 69 63  latform specific
52f0: 2c 20 62 75 74 20 69 73 20 75 73 75 61 6c 6c 79  , but is usually
5300: 20 5b 66 69 6c 65 20 22 2f 65 74 63 2f 73 73 6c   [file "/etc/ssl
5310: 2f 63 65 72 74 73 22 5d 20 6f 6e 0a 4c 69 6e 75  /certs"] on.Linu
5320: 78 2f 55 6e 69 78 20 73 79 73 74 65 6d 73 2e 20  x/Unix systems. 
5330: 54 68 65 20 64 65 66 61 75 6c 74 20 6c 6f 63 61  The default loca
5340: 74 69 6f 6e 20 63 61 6e 20 62 65 20 6f 76 65 72  tion can be over
5350: 72 69 64 64 65 6e 20 62 79 20 74 68 65 0a 5b 76  ridden by the.[v
5360: 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d  ar SSL_CERT_DIR]
5370: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72   environment var
5380: 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66  iable...[opt_def
5390: 20 2d 63 61 66 69 6c 65 20 5b 61 72 67 20 66 69   -cafile [arg fi
53a0: 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66 69  lename]].Specifi
53b0: 65 73 20 74 68 65 20 66 69 6c 65 20 77 69 74 68  es the file with
53c0: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65   the Certificate
53d0: 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 20   Authority (CA) 
53e0: 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f 20  certificates to 
53f0: 75 73 65 20 69 6e 0a 5b 63 6f 6e 73 74 20 50 45  use in.[const PE
5400: 4d 5d 20 66 69 6c 65 20 66 6f 72 6d 61 74 2e 20  M] file format. 
5410: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  The default is [
5420: 66 69 6c 65 20 63 65 72 74 2e 70 65 6d 5d 2c 20  file cert.pem], 
5430: 69 6e 20 74 68 65 20 4f 70 65 6e 53 53 4c 0a 64  in the OpenSSL.d
5440: 69 72 65 63 74 6f 72 79 2e 20 4f 6e 20 4c 69 6e  irectory. On Lin
5450: 75 78 2f 55 6e 69 78 20 73 79 73 74 65 6d 73 2c  ux/Unix systems,
5460: 20 74 68 69 73 20 69 73 20 75 73 75 61 6c 6c 79   this is usually
5470: 20 5b 66 69 6c 65 20 2f 65 74 63 2f 73 73 6c 2f   [file /etc/ssl/
5480: 63 61 2d 62 75 6e 64 6c 65 2e 70 65 6d 5d 2e 0a  ca-bundle.pem]..
5490: 54 68 65 20 64 65 66 61 75 6c 74 20 66 69 6c 65  The default file
54a0: 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64   can be overridd
54b0: 65 6e 20 62 79 20 74 68 65 20 5b 76 61 72 20 53  en by the [var S
54c0: 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e  SL_CERT_FILE] en
54d0: 76 69 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62  vironment.variab
54e0: 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  le...[opt_def -c
54f0: 61 73 74 6f 72 65 20 5b 61 72 67 20 55 52 49 5d  astore [arg URI]
5500: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
5510: 55 6e 69 66 6f 72 6d 20 52 65 73 6f 75 72 63 65  Uniform Resource
5520: 20 49 64 65 6e 74 69 66 69 65 72 20 28 55 52 49   Identifier (URI
5530: 29 20 66 6f 72 20 74 68 65 20 43 65 72 74 69 66  ) for the Certif
5540: 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 0a  icate Authority.
5550: 28 43 41 29 20 73 74 6f 72 65 2c 20 77 68 69 63  (CA) store, whic
5560: 68 20 6d 61 79 20 62 65 20 61 20 73 69 6e 67 6c  h may be a singl
5570: 65 20 63 6f 6e 74 61 69 6e 65 72 20 6f 72 20 61  e container or a
5580: 20 63 61 74 61 6c 6f 67 20 6f 66 20 63 6f 6e 74   catalog of cont
5590: 61 69 6e 65 72 73 2e 0a 53 74 61 72 74 69 6e 67  ainers..Starting
55a0: 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 33 2e   with OpenSSL 3.
55b0: 32 20 6f 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c  2 on MS Windows,
55c0: 20 73 65 74 20 74 6f 20 22 5b 63 6f 6e 73 74 20   set to "[const 
55d0: 22 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e  "org.openssl.win
55e0: 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f 20 75  store://"]".to u
55f0: 73 65 20 74 68 65 20 62 75 69 6c 74 2d 69 6e 20  se the built-in 
5600: 4d 53 20 57 69 6e 64 6f 77 73 20 43 65 72 74 69  MS Windows Certi
5610: 66 69 63 61 74 65 20 53 74 6f 72 65 2e 0a 54 68  ficate Store..Th
5620: 69 73 20 73 74 6f 72 65 20 6f 6e 6c 79 20 73 75  is store only su
5630: 70 70 6f 72 74 73 20 72 6f 6f 74 20 63 65 72 74  pports root cert
5640: 69 66 69 63 61 74 65 20 73 74 6f 72 65 73 2e 20  ificate stores. 
5650: 53 65 65 0a 5b 73 65 63 74 72 65 66 20 22 43 65  See.[sectref "Ce
5660: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
5670: 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20  tion"] for more 
5680: 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64  details...[opt_d
5690: 65 66 20 2d 72 65 71 75 65 73 74 20 5b 61 72 67  ef -request [arg
56a0: 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 65 73 74 20   bool]].Request 
56b0: 61 20 63 65 72 74 69 66 69 63 61 74 65 20 66 72  a certificate fr
56c0: 6f 6d 20 74 68 65 20 70 65 65 72 20 64 75 72 69  om the peer duri
56d0: 6e 67 20 74 68 65 20 53 53 4c 20 68 61 6e 64 73  ng the SSL hands
56e0: 68 61 6b 65 2e 20 54 68 69 73 20 69 73 20 6e 65  hake. This is ne
56f0: 65 64 65 64 0a 74 6f 20 64 6f 20 43 65 72 74 69  eded.to do Certi
5700: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f  ficate Validatio
5710: 6e 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54  n. Starting in T
5720: 63 6c 54 4c 53 20 31 2e 38 2c 20 74 68 65 20 64  clTLS 1.8, the d
5730: 65 66 61 75 6c 74 20 69 73 0a 5b 63 6f 6e 73 74  efault is.[const
5740: 20 74 72 75 65 5d 2e 20 53 74 61 72 74 69 6e 67   true]. Starting
5750: 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20   in TclTLS 2.0, 
5760: 49 66 20 73 65 74 20 74 6f 20 5b 63 6f 6e 73 74  If set to [const
5770: 20 66 61 6c 73 65 5d 20 61 6e 64 0a 5b 6f 70 74   false] and.[opt
5780: 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 69 73  ion -require] is
5790: 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2c 20 74   [const true], t
57a0: 68 65 6e 20 74 68 69 73 20 77 69 6c 6c 20 62 65  hen this will be
57b0: 20 6f 76 65 72 72 69 64 64 65 6e 20 74 6f 20 5b   overridden to [
57c0: 63 6f 6e 73 74 20 74 72 75 65 5d 2e 0a 49 6e 20  const true]..In 
57d0: 61 64 64 69 74 69 6f 6e 2c 20 74 68 65 20 63 6c  addition, the cl
57e0: 69 65 6e 74 20 63 61 6e 20 6d 61 6e 75 61 6c 6c  ient can manuall
57f0: 79 20 69 6e 73 70 65 63 74 20 61 6e 64 20 61 63  y inspect and ac
5800: 63 65 70 74 20 6f 72 20 72 65 6a 65 63 74 0a 65  cept or reject.e
5810: 61 63 68 20 63 65 72 74 69 66 69 63 61 74 65 20  ach certificate 
5820: 75 73 69 6e 67 20 74 68 65 20 5b 61 72 67 20 2d  using the [arg -
5830: 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d  validatecommand]
5840: 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64   option...[opt_d
5850: 65 66 20 2d 72 65 71 75 69 72 65 20 5b 61 72 67  ef -require [arg
5860: 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 69 72 65 20   bool]].Require 
5870: 61 20 76 61 6c 69 64 20 63 65 72 74 69 66 69 63  a valid certific
5880: 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65  ate from the pee
5890: 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c  r during the SSL
58a0: 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20 74   handshake. If t
58b0: 68 69 73 20 69 73 0a 73 65 74 20 74 6f 20 74 72  his is.set to tr
58c0: 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f 6e  ue, then [option
58d0: 20 2d 72 65 71 75 65 73 74 5d 20 6d 75 73 74 20   -request] must 
58e0: 61 6c 73 6f 20 62 65 20 73 65 74 20 74 6f 20 74  also be set to t
58f0: 72 75 65 20 61 6e 64 20 61 20 65 69 74 68 65 72  rue and a either
5900: 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d  .[option -cadir]
5910: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c  , [option -cafil
5920: 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73  e], [option -cas
5930: 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70 6c 61 74  tore], or a plat
5940: 66 6f 72 6d 20 64 65 66 61 75 6c 74 0a 6d 75 73  form default.mus
5950: 74 20 62 65 20 70 72 6f 76 69 64 65 64 20 69 6e  t be provided in
5960: 20 6f 72 64 65 72 20 74 6f 20 76 61 6c 69 64 61   order to valida
5970: 74 65 20 61 67 61 69 6e 73 74 2e 20 54 68 65 20  te against. The 
5980: 64 65 66 61 75 6c 74 20 69 6e 20 54 63 6c 54 4c  default in TclTL
5990: 53 20 31 2e 38 20 61 6e 64 0a 65 61 72 6c 69 65  S 1.8 and.earlie
59a0: 72 20 76 65 72 73 69 6f 6e 73 20 69 73 20 5b 63  r versions is [c
59b0: 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e 63  onst false] sinc
59c0: 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61 74 66 6f  e not all platfo
59d0: 72 6d 73 20 68 61 76 65 20 63 65 72 74 69 66 69  rms have certifi
59e0: 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 61 74  cates to.validat
59f0: 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20 66  e against in a f
5a00: 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20 77  orm compatible w
5a10: 69 74 68 20 4f 70 65 6e 53 53 4c 2e 20 53 74 61  ith OpenSSL. Sta
5a20: 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20  rting in TclTLS 
5a30: 32 2e 30 2c 0a 74 68 65 20 64 65 66 61 75 6c 74  2.0,.the default
5a40: 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d   is [const true]
5a50: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
5a60: 73 75 62 73 65 63 74 69 6f 6e 20 22 57 68 65 6e  subsection "When
5a70: 20 61 72 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e   are command lin
5a80: 65 20 6f 70 74 69 6f 6e 73 20 6e 65 65 64 65 64  e options needed
5a90: 3f 22 5d 0a 0a 49 6e 20 54 63 6c 54 4c 53 20 31  ?"]..In TclTLS 1
5aa0: 2e 38 20 61 6e 64 20 65 61 72 6c 69 65 72 20 76  .8 and earlier v
5ab0: 65 72 73 69 6f 6e 73 2c 20 63 65 72 74 69 66 69  ersions, certifi
5ac0: 63 61 74 65 20 76 61 6c 69 64 61 74 69 6f 6e 20  cate validation 
5ad0: 69 73 0a 5b 65 6d 70 68 20 4e 4f 54 5d 20 65 6e  is.[emph NOT] en
5ae0: 61 62 6c 65 64 20 62 79 20 64 65 66 61 75 6c 74  abled by default
5af0: 2e 20 54 68 69 73 20 6c 69 6d 69 74 61 74 69 6f  . This limitatio
5b00: 6e 20 69 73 20 64 75 65 20 74 6f 20 74 68 65 20  n is due to the 
5b10: 6c 61 63 6b 20 6f 66 20 61 20 63 6f 6d 6d 6f 6e  lack of a common
5b20: 0a 63 72 6f 73 73 20 70 6c 61 74 66 6f 72 6d 20  .cross platform 
5b30: 64 61 74 61 62 61 73 65 20 6f 66 20 43 65 72 74  database of Cert
5b40: 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74  ificate Authorit
5b50: 79 20 28 43 41 29 20 70 72 6f 76 69 64 65 64 20  y (CA) provided 
5b60: 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f 0a  certificates to.
5b70: 76 61 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74  validate against
5b80: 2e 20 4d 61 6e 79 20 4c 69 6e 75 78 20 73 79 73  . Many Linux sys
5b90: 74 65 6d 73 20 6e 61 74 69 76 65 6c 79 20 73 75  tems natively su
5ba0: 70 70 6f 72 74 20 4f 70 65 6e 53 53 4c 20 61 6e  pport OpenSSL an
5bb0: 64 20 74 68 75 73 20 68 61 76 65 0a 74 68 65 73  d thus have.thes
5bc0: 65 20 63 65 72 74 69 66 69 63 61 74 65 73 20 69  e certificates i
5bd0: 6e 73 74 61 6c 6c 65 64 20 61 73 20 70 61 72 74  nstalled as part
5be0: 20 6f 66 20 74 68 65 20 4f 53 2c 20 62 75 74 20   of the OS, but 
5bf0: 4d 61 63 4f 53 20 61 6e 64 20 4d 53 20 57 69 6e  MacOS and MS Win
5c00: 64 6f 77 73 20 64 6f 20 6e 6f 74 2e 0a 53 74 61  dows do not..Sta
5c10: 72 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32  ring in TclTLS 2
5c20: 2e 30 2c 20 74 68 69 73 20 68 61 73 20 62 65 65  .0, this has bee
5c30: 6e 20 63 68 61 6e 67 65 64 20 74 6f 20 72 65 71  n changed to req
5c40: 75 69 72 65 20 63 65 72 74 69 66 69 63 61 74 65  uire certificate
5c50: 20 76 61 6c 69 64 61 74 69 6f 6e 0a 62 79 20 64   validation.by d
5c60: 65 66 61 75 6c 74 2e 20 49 6e 20 6f 72 64 65 72  efault. In order
5c70: 20 74 6f 20 75 73 65 20 74 68 65 20 5b 6f 70 74   to use the [opt
5c80: 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 6f 70  ion -require] op
5c90: 74 69 6f 6e 2c 20 6f 6e 65 20 6f 66 20 74 68 65  tion, one of the
5ca0: 20 66 6f 6c 6c 6f 77 69 6e 67 0a 6d 75 73 74 20   following.must 
5cb0: 62 65 20 74 72 75 65 3a 0a 0a 5b 6c 69 73 74 5f  be true:..[list_
5cc0: 62 65 67 69 6e 20 69 74 65 6d 69 7a 65 64 5d 0a  begin itemized].
5cd0: 0a 5b 69 74 65 6d 5d 0a 4f 6e 20 4c 69 6e 75 78  .[item].On Linux
5ce0: 20 61 6e 64 20 55 6e 69 78 20 73 79 73 74 65 6d   and Unix system
5cf0: 73 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 61  s with OpenSSL a
5d00: 6c 72 65 61 64 79 20 69 6e 73 74 61 6c 6c 65 64  lready installed
5d10: 20 6f 72 20 69 66 20 74 68 65 20 43 41 0a 63 65   or if the CA.ce
5d20: 72 74 69 66 69 63 61 74 65 73 20 61 72 65 20 61  rtificates are a
5d30: 76 61 69 6c 61 62 6c 65 20 69 6e 20 50 45 4d 20  vailable in PEM 
5d40: 66 6f 72 6d 61 74 2c 20 61 6e 64 20 69 66 20 74  format, and if t
5d50: 68 65 79 20 61 72 65 20 73 74 6f 72 65 64 20 69  hey are stored i
5d60: 6e 20 74 68 65 0a 73 74 61 6e 64 61 72 64 20 6c  n the.standard l
5d70: 6f 63 61 74 69 6f 6e 73 2c 20 6f 72 20 69 66 20  ocations, or if 
5d80: 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52  the [var SSL_CER
5d90: 54 5f 44 49 52 5d 20 6f 72 20 5b 76 61 72 20 53  T_DIR] or [var S
5da0: 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 0a 65 6e  SL_CERT_FILE].en
5db0: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62  vironment variab
5dc0: 6c 65 73 20 61 72 65 20 73 65 74 2c 20 74 68 65  les are set, the
5dd0: 6e 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72  n [option -cadir
5de0: 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  ], [option -cadi
5df0: 72 5d 2c 0a 61 6e 64 20 5b 6f 70 74 69 6f 6e 20  r],.and [option 
5e00: 2d 63 61 73 74 6f 72 65 5d 20 61 72 65 6e 27 74  -castore] aren't
5e10: 20 6e 65 65 64 65 64 2e 0a 0a 5b 69 74 65 6d 5d   needed...[item]
5e20: 0a 49 66 20 4f 70 65 6e 53 53 4c 20 69 73 20 6e  .If OpenSSL is n
5e30: 6f 74 20 69 6e 73 74 61 6c 6c 65 64 20 69 6e 20  ot installed in 
5e40: 74 68 65 20 64 65 66 61 75 6c 74 20 6c 6f 63 61  the default loca
5e50: 74 69 6f 6e 2c 20 6f 72 20 77 68 65 6e 20 75 73  tion, or when us
5e60: 69 6e 67 20 4d 61 63 20 4f 53 0a 6f 72 20 4d 53  ing Mac OS.or MS
5e70: 20 57 69 6e 64 6f 77 73 20 61 6e 64 20 4f 70 65   Windows and Ope
5e80: 6e 53 53 4c 20 69 73 20 69 6e 73 74 61 6c 6c 65  nSSL is installe
5e90: 64 2c 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f  d, the [var SSL_
5ea0: 43 45 52 54 5f 44 49 52 5d 20 61 6e 64 2f 6f 72  CERT_DIR] and/or
5eb0: 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46  .[var SSL_CERT_F
5ec0: 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74  ILE] environment
5ed0: 20 76 61 72 69 61 62 6c 65 73 20 6f 72 20 74 68   variables or th
5ee0: 65 20 6f 6e 65 20 6f 66 20 74 68 65 20 5b 6f 70  e one of the [op
5ef0: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f  tion -cadir],.[o
5f00: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 6f  ption -cadir], o
5f10: 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  r [option -casto
5f20: 72 65 5d 20 6f 70 74 69 6f 6e 73 20 6d 75 73 74  re] options must
5f30: 20 62 65 20 64 65 66 69 6e 65 64 2e 0a 0a 5b 69   be defined...[i
5f40: 74 65 6d 5d 0a 4f 6e 20 4d 53 20 57 69 6e 64 6f  tem].On MS Windo
5f50: 77 73 2c 20 73 74 61 72 74 69 6e 67 20 69 6e 20  ws, starting in 
5f60: 4f 70 65 6e 53 53 4c 20 33 2e 32 2c 20 69 74 20  OpenSSL 3.2, it 
5f70: 69 73 20 6e 6f 77 20 70 6f 73 73 69 62 6c 65 20  is now possible 
5f80: 74 6f 20 61 63 63 65 73 73 20 74 68 65 0a 62 75  to access the.bu
5f90: 69 6c 74 2d 69 6e 20 57 69 6e 64 6f 77 73 20 43  ilt-in Windows C
5fa0: 65 72 74 69 66 69 63 61 74 65 20 53 74 6f 72 65  ertificate Store
5fb0: 20 66 72 6f 6d 20 4f 70 65 6e 53 53 4c 2e 20 54   from OpenSSL. T
5fc0: 68 69 73 20 63 61 6e 20 75 74 69 6c 69 7a 65 64  his can utilized
5fd0: 20 62 79 0a 73 65 74 74 69 6e 67 20 74 68 65 20   by.setting the 
5fe0: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65  [option -castore
5ff0: 5d 20 6f 70 74 69 6f 6e 20 74 6f 20 22 5b 63 6f  ] option to "[co
6000: 6e 73 74 20 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e  nst org.openssl.
6010: 77 69 6e 73 74 6f 72 65 3a 2f 2f 5d 22 2e 0a 0a  winstore://]"...
6020: 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65 6e 53 53  [item].If OpenSS
6030: 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74 61 6c 6c  L is not install
6040: 65 64 20 6f 72 20 74 68 65 20 43 41 20 63 65 72  ed or the CA cer
6050: 74 69 66 69 63 61 74 65 73 20 61 72 65 20 6e 6f  tificates are no
6060: 74 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 50  t available in P
6070: 45 4d 0a 66 6f 72 6d 61 74 2c 20 74 68 65 20 43  EM.format, the C
6080: 41 20 63 65 72 74 69 66 69 63 61 74 65 73 20 6d  A certificates m
6090: 75 73 74 20 62 65 20 64 6f 77 6e 6c 6f 61 64 65  ust be downloade
60a0: 64 20 61 6e 64 20 69 6e 73 74 61 6c 6c 65 64 20  d and installed 
60b0: 77 69 74 68 20 74 68 65 20 75 73 65 72 0a 73 6f  with the user.so
60c0: 66 74 77 61 72 65 2e 20 54 68 65 20 43 55 52 4c  ftware. The CURL
60d0: 20 74 65 61 6d 20 6d 61 6b 65 73 20 74 68 65 6d   team makes them
60e0: 20 61 76 61 69 6c 61 62 6c 65 20 61 74 0a 5b 75   available at.[u
60f0: 72 69 20 22 68 74 74 70 73 3a 2f 2f 63 75 72 6c  ri "https://curl
6100: 2e 73 65 2f 64 6f 63 73 2f 63 61 65 78 74 72 61  .se/docs/caextra
6110: 63 74 2e 68 74 6d 6c 22 20 22 43 41 20 63 65 72  ct.html" "CA cer
6120: 74 69 66 69 63 61 74 65 73 20 65 78 74 72 61 63  tificates extrac
6130: 74 65 64 0a 66 72 6f 6d 20 4d 6f 7a 69 6c 6c 61  ted.from Mozilla
6140: 22 5d 20 69 6e 20 74 68 65 20 5b 66 69 6c 65 20  "] in the [file 
6150: 63 61 63 65 72 74 2e 70 65 6d 5d 20 66 69 6c 65  cacert.pem] file
6160: 2e 20 59 6f 75 20 6d 75 73 74 20 74 68 65 6e 20  . You must then 
6170: 65 69 74 68 65 72 20 73 65 74 20 74 68 65 0a 5b  either set the.[
6180: 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52  var SSL_CERT_DIR
6190: 5d 20 61 6e 64 2f 6f 72 20 5b 76 61 72 20 53 53  ] and/or [var SS
61a0: 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76  L_CERT_FILE] env
61b0: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c  ironment variabl
61c0: 65 73 20 6f 72 20 74 68 65 0a 5b 6f 70 74 69 6f  es or the.[optio
61d0: 6e 20 2d 63 61 64 69 72 5d 20 6f 72 20 5b 6f 70  n -cadir] or [op
61e0: 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 20 6f 70  tion -cafile] op
61f0: 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 43 41 20  tions to the CA 
6200: 63 65 72 74 20 66 69 6c 65 27 73 20 69 6e 73 74  cert file's inst
6210: 61 6c 6c 0a 6c 6f 63 61 74 69 6f 6e 2e 20 49 74  all.location. It
6220: 20 69 73 20 79 6f 75 72 20 72 65 73 70 6f 6e 73   is your respons
6230: 69 62 69 6c 69 74 79 20 74 6f 20 6b 65 65 70 20  ibility to keep 
6240: 74 68 69 73 20 66 69 6c 65 20 75 70 20 74 6f 20  this file up to 
6250: 64 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  date...[list_end
6260: 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43 61 6c  ]..[section "Cal
6270: 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d 0a  lback Options"].
6280: 0a 41 73 20 70 72 65 76 69 6f 75 73 6c 79 20 64  .As previously d
6290: 65 73 63 72 69 62 65 64 2c 20 65 61 63 68 20 63  escribed, each c
62a0: 68 61 6e 6e 65 6c 20 63 61 6e 20 62 65 20 67 69  hannel can be gi
62b0: 76 65 6e 20 74 68 65 69 72 20 6f 77 6e 20 63 61  ven their own ca
62c0: 6c 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e 64 6c  llbacks.to handl
62d0: 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20 70  e intermediate p
62e0: 72 6f 63 65 73 73 69 6e 67 20 62 79 20 74 68 65  rocessing by the
62f0: 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79   OpenSSL library
6300: 2c 20 75 73 69 6e 67 20 74 68 65 0a 5b 6f 70 74  , using the.[opt
6310: 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20 5b  ion -command], [
6320: 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64  option -password
6330: 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d  ], and [option -
6340: 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64  validate_command
6350: 5d 20 6f 70 74 69 6f 6e 73 0a 70 61 73 73 65 64  ] options.passed
6360: 20 74 6f 20 65 69 74 68 65 72 20 6f 66 20 5b 63   to either of [c
6370: 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20  md tls::socket] 
6380: 6f 72 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70  or [cmd tls::imp
6390: 6f 72 74 5d 2e 0a 55 6e 6c 69 6b 65 20 70 72 65  ort]..Unlike pre
63a0: 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 73 20 6f  vious versions o
63b0: 66 20 54 63 6c 54 4c 53 2c 20 6f 6e 6c 79 20 69  f TclTLS, only i
63c0: 66 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 67  f the callback g
63d0: 65 6e 65 72 61 74 65 73 20 61 6e 20 65 72 72 6f  enerates an erro
63e0: 72 2c 0a 77 69 6c 6c 20 74 68 65 20 5b 73 79 73  r,.will the [sys
63f0: 63 6d 64 20 62 67 65 72 72 6f 72 5d 20 63 6f 6d  cmd bgerror] com
6400: 6d 61 6e 64 20 62 65 20 69 6e 76 6f 6b 65 64 20  mand be invoked 
6410: 77 69 74 68 20 74 68 65 20 65 72 72 6f 72 20 69  with the error i
6420: 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 5b 73 75  nformation...[su
6430: 62 73 65 63 74 69 6f 6e 20 22 56 61 6c 75 65 73  bsection "Values
6440: 20 66 6f 72 20 43 6f 6d 6d 61 6e 64 20 43 61 6c   for Command Cal
6450: 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c  lback"]..The cal
6460: 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f  lback for the [o
6470: 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20  ption -command] 
6480: 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65  option is invoke
6490: 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f 69  d at several poi
64a0: 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a 4f  nts during the.O
64b0: 70 65 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b 65  penSSL handshake
64c0: 20 61 6e 64 20 64 75 72 69 6e 67 20 72 6f 75 74   and during rout
64d0: 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20  ine operations. 
64e0: 53 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 74 68  See below for th
64f0: 65 20 70 6f 73 73 69 62 6c 65 0a 61 72 67 75 6d  e possible.argum
6500: 65 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20 74  ents passed to t
6510: 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 69  he callback scri
6520: 70 74 2e 20 56 61 6c 75 65 73 20 72 65 74 75 72  pt. Values retur
6530: 6e 65 64 20 66 72 6f 6d 20 74 68 65 20 63 61 6c  ned from the cal
6540: 6c 62 61 63 6b 20 61 72 65 0a 69 67 6e 6f 72 65  lback are.ignore
6550: 64 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  d...[list_begin 
6560: 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64  options]..[opt_d
6570: 65 66 20 65 72 72 6f 72 20 5b 61 72 67 20 22 63  ef error [arg "c
6580: 68 61 6e 6e 65 6c 49 64 20 6d 65 73 73 61 67 65  hannelId message
6590: 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66  "]].This form of
65a0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
65b0: 6f 6b 65 64 20 77 68 65 6e 65 76 65 72 20 61 6e  oked whenever an
65c0: 20 65 72 72 6f 72 20 6f 63 63 75 72 73 20 64 75   error occurs du
65d0: 72 69 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c  ring the initial
65e0: 0a 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68 61 6e  .connection, han
65f0: 64 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f  dshake, or I/O o
6600: 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 20 5b  perations. The [
6610: 61 72 67 20 6d 65 73 73 61 67 65 5d 20 61 72 67  arg message] arg
6620: 75 6d 65 6e 74 20 63 61 6e 20 62 65 0a 66 72 6f  ument can be.fro
6630: 6d 20 74 68 65 20 54 63 6c 5f 45 72 72 6e 6f 4d  m the Tcl_ErrnoM
6640: 73 67 2c 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63  sg, OpenSSL func
6650: 74 69 6f 6e 20 5b 66 75 6e 20 45 52 52 5f 72 65  tion [fun ERR_re
6660: 61 73 6f 6e 5f 65 72 72 6f 72 5f 73 74 72 69 6e  ason_error_strin
6670: 67 28 29 5d 2c 0a 6f 72 20 61 20 63 75 73 74 6f  g()],.or a custo
6680: 6d 20 6d 65 73 73 61 67 65 2e 20 54 68 69 73 20  m message. This 
6690: 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20  callback is new 
66a0: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
66b0: 0a 5b 6f 70 74 5f 64 65 66 20 69 6e 66 6f 20 5b  .[opt_def info [
66c0: 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 6d  arg "channelId m
66d0: 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65 73 73 61  ajor minor messa
66e0: 67 65 20 74 79 70 65 22 5d 5d 0a 54 68 69 73 20  ge type"]].This 
66f0: 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b  form of callback
6700: 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74   is invoked by t
6710: 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74  he OpenSSL funct
6720: 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73 65 74  ion.[fun SSL_set
6730: 5f 69 6e 66 6f 5f 63 61 6c 6c 62 61 63 6b 28 29  _info_callback()
6740: 5d 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69  ] during the ini
6750: 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20  tial connection 
6760: 61 6e 64 20 68 61 6e 64 73 68 61 6b 65 0a 6f 70  and handshake.op
6770: 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 20 61 72  erations. The ar
6780: 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c  guments are:..[l
6790: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
67a0: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72  tions]..[def [ar
67b0: 67 20 6d 61 6a 6f 72 5d 5d 0a 4d 61 6a 6f 72 20  g major]].Major 
67c0: 63 61 74 65 67 6f 72 79 20 66 6f 72 20 65 72 72  category for err
67d0: 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d 73 20  or. Valid enums 
67e0: 61 72 65 3a 20 5b 63 6f 6e 73 74 20 68 61 6e 64  are: [const hand
67f0: 73 68 61 6b 65 5d 2c 20 5b 63 6f 6e 73 74 20 61  shake], [const a
6800: 6c 65 72 74 5d 2c 0a 5b 63 6f 6e 73 74 20 63 6f  lert],.[const co
6810: 6e 6e 65 63 74 5d 2c 20 5b 63 6f 6e 73 74 20 61  nnect], [const a
6820: 63 63 65 70 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61  ccept]...[def [a
6830: 72 67 20 6d 69 6e 6f 72 5d 5d 0a 4d 69 6e 6f 72  rg minor]].Minor
6840: 20 63 61 74 65 67 6f 72 79 20 66 6f 72 20 65 72   category for er
6850: 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d 73  ror. Valid enums
6860: 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 73 74 61   are: [const sta
6870: 72 74 5d 2c 20 5b 63 6f 6e 73 74 20 64 6f 6e 65  rt], [const done
6880: 5d 2c 20 5b 63 6f 6e 73 74 20 72 65 61 64 5d 2c  ], [const read],
6890: 0a 5b 63 6f 6e 73 74 20 77 72 69 74 65 5d 2c 20  .[const write], 
68a0: 5b 63 6f 6e 73 74 20 6c 6f 6f 70 5d 2c 20 5b 63  [const loop], [c
68b0: 6f 6e 73 74 20 65 78 69 74 5d 2e 0a 0a 5b 64 65  onst exit]...[de
68c0: 66 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 5d  f [arg message]]
68d0: 0a 44 65 73 63 72 69 70 74 69 76 65 20 6d 65 73  .Descriptive mes
68e0: 73 61 67 65 20 73 74 72 69 6e 67 20 77 68 69 63  sage string whic
68f0: 68 20 6d 61 79 20 62 65 20 67 65 6e 65 72 61 74  h may be generat
6900: 65 64 20 65 69 74 68 65 72 20 62 79 0a 5b 66 75  ed either by.[fu
6910: 6e 20 53 53 4c 5f 73 74 61 74 65 5f 73 74 72 69  n SSL_state_stri
6920: 6e 67 5f 6c 6f 6e 67 28 29 5d 20 6f 72 20 5b 66  ng_long()] or [f
6930: 75 6e 20 53 53 4c 5f 61 6c 65 72 74 5f 64 65 73  un SSL_alert_des
6940: 63 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d  c_string_long()]
6950: 2c 0a 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74  ,.depending on t
6960: 68 65 20 63 6f 6e 74 65 78 74 2e 0a 0a 5b 64 65  he context...[de
6970: 66 20 5b 61 72 67 20 74 79 70 65 5d 5d 0a 46 6f  f [arg type]].Fo
6980: 72 20 61 6c 65 72 74 73 2c 20 74 68 65 20 70 6f  r alerts, the po
6990: 73 73 69 62 6c 65 20 76 61 6c 75 65 73 20 61 72  ssible values ar
69a0: 65 3a 20 5b 63 6f 6e 73 74 20 77 61 72 6e 69 6e  e: [const warnin
69b0: 67 5d 2c 0a 5b 63 6f 6e 73 74 20 66 61 74 61 6c  g],.[const fatal
69c0: 5d 2c 20 61 6e 64 20 5b 63 6f 6e 73 74 20 75 6e  ], and [const un
69d0: 6b 6e 6f 77 6e 5d 2e 20 46 6f 72 20 6f 74 68 65  known]. For othe
69e0: 72 73 2c 20 5b 63 6f 6e 73 74 20 69 6e 66 6f 5d  rs, [const info]
69f0: 20 69 73 20 75 73 65 64 2e 0a 54 68 69 73 20 61   is used..This a
6a00: 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 66  rgument is new f
6a10: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
6a20: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74  [list_end]..[opt
6a30: 5f 64 65 66 20 6d 65 73 73 61 67 65 20 5b 61 72  _def message [ar
6a40: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 69 72  g "channelId dir
6a50: 65 63 74 69 6f 6e 20 76 65 72 73 69 6f 6e 20 63  ection version c
6a60: 6f 6e 74 65 6e 74 5f 74 79 70 65 20 6d 65 73 73  ontent_type mess
6a70: 61 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d  age"]].This form
6a80: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20   of callback is 
6a90: 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20 4f  invoked by the O
6aa0: 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a  penSSL function.
6ab0: 5b 66 75 6e 20 53 53 4c 5f 73 65 74 5f 6d 73 67  [fun SSL_set_msg
6ac0: 5f 63 61 6c 6c 62 61 63 6b 28 29 5d 20 77 68 65  _callback()] whe
6ad0: 6e 65 76 65 72 20 61 20 6d 65 73 73 61 67 65 20  never a message 
6ae0: 69 73 20 73 65 6e 74 20 6f 72 20 72 65 63 65 69  is sent or recei
6af0: 76 65 64 20 64 75 72 69 6e 67 20 74 68 65 0a 69  ved during the.i
6b00: 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f  nitial connectio
6b10: 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20 6f 72  n, handshake, or
6b20: 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f 6e 73 2e   I/O operations.
6b30: 20 49 74 20 69 73 20 6f 6e 6c 79 20 61 76 61 69   It is only avai
6b40: 6c 61 62 6c 65 20 77 68 65 6e 0a 4f 70 65 6e 53  lable when.OpenS
6b50: 53 4c 20 69 73 20 63 6f 6d 70 6c 69 65 64 20 77  SL is complied w
6b60: 69 74 68 20 74 68 65 20 5b 63 6f 6e 73 74 20 65  ith the [const e
6b70: 6e 61 62 6c 65 2d 73 73 6c 2d 74 72 61 63 65 5d  nable-ssl-trace]
6b80: 20 6f 70 74 69 6f 6e 2e 20 54 68 69 73 20 63 61   option. This ca
6b90: 6c 6c 62 61 63 6b 20 69 73 0a 6e 65 77 20 66 6f  llback is.new fo
6ba0: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68  r TclTLS 1.8. Th
6bb0: 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a  e arguments are:
6bc0: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
6bd0: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
6be0: 20 5b 61 72 67 20 64 69 72 65 63 74 69 6f 6e 5d   [arg direction]
6bf0: 5d 0a 44 69 72 65 63 74 69 6f 6e 20 69 73 20 65  ].Direction is e
6c00: 69 74 68 65 72 20 5b 63 6f 6e 73 74 20 53 65 6e  ither [const Sen
6c10: 74 5d 20 6f 72 20 5b 63 6f 6e 73 74 20 52 65 63  t] or [const Rec
6c20: 65 69 76 65 64 5d 2e 0a 0a 5b 64 65 66 20 5b 61  eived]...[def [a
6c30: 72 67 20 76 65 72 73 69 6f 6e 5d 5d 0a 56 65 72  rg version]].Ver
6c40: 73 69 6f 6e 20 69 73 20 74 68 65 20 70 72 6f 74  sion is the prot
6c50: 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b  ocol version...[
6c60: 64 65 66 20 5b 61 72 67 20 63 6f 6e 74 65 6e 74  def [arg content
6c70: 5f 74 79 70 65 5d 5d 0a 43 6f 6e 74 65 6e 74 20  _type]].Content 
6c80: 74 79 70 65 20 69 73 20 74 68 65 20 6d 65 73 73  type is the mess
6c90: 61 67 65 20 63 6f 6e 74 65 6e 74 20 74 79 70 65  age content type
6ca0: 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 65 73  ...[def [arg mes
6cb0: 73 61 67 65 5d 5d 0a 4d 65 73 73 61 67 65 20 69  sage]].Message i
6cc0: 73 20 6d 6f 72 65 20 69 6e 66 6f 20 66 72 6f 6d  s more info from
6cd0: 20 74 68 65 20 5b 63 6f 6e 73 74 20 53 53 4c 5f   the [const SSL_
6ce0: 74 72 61 63 65 5d 20 41 50 49 2e 0a 0a 5b 6c 69  trace] API...[li
6cf0: 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65  st_end]..[opt_de
6d00: 66 20 73 65 73 73 69 6f 6e 20 5b 61 72 67 20 22  f session [arg "
6d10: 63 68 61 6e 6e 65 6c 49 64 20 73 65 73 73 69 6f  channelId sessio
6d20: 6e 5f 69 64 20 73 65 73 73 69 6f 6e 5f 74 69 63  n_id session_tic
6d30: 6b 65 74 20 6c 69 66 65 74 69 6d 65 22 5d 5d 0a  ket lifetime"]].
6d40: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
6d50: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
6d60: 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20   by the OpenSSL 
6d70: 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53  function.[fun SS
6d80: 4c 5f 43 54 58 5f 73 65 73 73 5f 73 65 74 5f 6e  L_CTX_sess_set_n
6d90: 65 77 5f 63 62 28 29 5d 20 77 68 65 6e 65 76 65  ew_cb()] wheneve
6da0: 72 20 61 20 6e 65 77 20 73 65 73 73 69 6f 6e 20  r a new session 
6db0: 69 64 20 69 73 20 73 65 6e 74 20 62 79 20 74 68  id is sent by th
6dc0: 65 0a 73 65 72 76 65 72 20 64 75 72 69 6e 67 20  e.server during 
6dd0: 74 68 65 20 69 6e 69 74 69 61 6c 20 63 6f 6e 6e  the initial conn
6de0: 65 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e 64 73  ection and hands
6df0: 68 61 6b 65 20 61 6e 64 20 61 6c 73 6f 20 64 75  hake and also du
6e00: 72 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e  ring the session
6e10: 0a 69 66 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  .if the [option 
6e20: 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b 65 5d  -post_handshake]
6e30: 20 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 20 74   option is set t
6e40: 6f 20 74 72 75 65 2e 20 54 68 69 73 20 63 61 6c  o true. This cal
6e50: 6c 62 61 63 6b 20 69 73 20 6e 65 77 20 66 6f 72  lback is new for
6e60: 0a 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65  .TclTLS 1.8. The
6e70: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a   arguments are:.
6e80: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66  .[list_begin def
6e90: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20  initions]..[def 
6ea0: 5b 61 72 67 20 73 65 73 73 69 6f 6e 5f 69 64 5d  [arg session_id]
6eb0: 5d 0a 53 65 73 73 69 6f 6e 20 49 64 20 69 73 20  ].Session Id is 
6ec0: 74 68 65 20 63 75 72 72 65 6e 74 20 73 65 73 73  the current sess
6ed0: 69 6f 6e 20 69 64 65 6e 74 69 66 69 65 72 0a 0a  ion identifier..
6ee0: 5b 64 65 66 20 5b 61 72 67 20 73 65 73 73 69 6f  [def [arg sessio
6ef0: 6e 5f 74 69 63 6b 65 74 5d 5d 0a 54 69 63 6b 65  n_ticket]].Ticke
6f00: 74 20 69 73 20 74 68 65 20 73 65 73 73 69 6f 6e  t is the session
6f10: 20 74 69 63 6b 65 74 20 69 6e 66 6f 0a 0a 5b 64   ticket info..[d
6f20: 65 66 20 5b 61 72 67 20 6c 69 66 65 74 69 6d 65  ef [arg lifetime
6f30: 5d 5d 0a 4c 69 66 65 74 69 6d 65 20 69 73 20 74  ]].Lifetime is t
6f40: 68 65 20 74 69 63 6b 65 74 20 6c 69 66 65 74 69  he ticket lifeti
6f50: 6d 65 20 69 6e 20 73 65 63 6f 6e 64 73 2e 0a 0a  me in seconds...
6f60: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74  [list_end]..[opt
6f70: 5f 64 65 66 20 76 65 72 69 66 79 20 5b 61 72 67  _def verify [arg
6f80: 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 65 70 74   "channelId dept
6f90: 68 20 63 65 72 74 20 73 74 61 74 75 73 20 65 72  h cert status er
6fa0: 72 6f 72 22 5d 5d 0a 54 68 69 73 20 63 61 6c 6c  ror"]].This call
6fb0: 62 61 63 6b 20 77 61 73 20 6d 6f 76 65 64 20 74  back was moved t
6fc0: 6f 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64  o [option -valid
6fd0: 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54  atecommand] in T
6fe0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73  clTLS 1.8...[lis
6ff0: 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 74  t_end]..[subsect
7000: 69 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 20  ion "Values for 
7010: 50 61 73 73 77 6f 72 64 20 43 61 6c 6c 62 61 63  Password Callbac
7020: 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63  k"]..The callbac
7030: 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f  k for the [optio
7040: 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74  n -password] opt
7050: 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20 62  ion is invoked b
7060: 79 20 54 63 6c 54 4c 53 20 77 68 65 6e 65 76 65  y TclTLS wheneve
7070: 72 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73 0a  r OpenSSL needs.
7080: 74 6f 20 6f 62 74 61 69 6e 20 61 20 70 61 73 73  to obtain a pass
7090: 77 6f 72 64 2e 20 53 65 65 20 62 65 6c 6f 77 20  word. See below 
70a0: 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c 65  for the possible
70b0: 20 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73 65   arguments passe
70c0: 64 20 74 6f 20 74 68 65 0a 63 61 6c 6c 62 61 63  d to the.callbac
70d0: 6b 20 73 63 72 69 70 74 2e 20 54 68 65 20 75 73  k script. The us
70e0: 65 72 20 70 72 6f 76 69 64 65 64 20 70 61 73 73  er provided pass
70f0: 77 6f 72 64 20 69 73 20 65 78 70 65 63 74 65 64  word is expected
7100: 20 74 6f 20 62 65 20 72 65 74 75 72 6e 65 64 20   to be returned 
7110: 62 79 20 74 68 65 0a 63 61 6c 6c 62 61 63 6b 2e  by the.callback.
7120: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70  ..[list_begin op
7130: 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66  tions]..[opt_def
7140: 20 70 61 73 73 77 6f 72 64 20 5b 61 72 67 20 22   password [arg "
7150: 72 77 66 6c 61 67 20 73 69 7a 65 22 5d 5d 0a 49  rwflag size"]].I
7160: 6e 76 6f 6b 65 64 20 77 68 65 6e 20 6c 6f 61 64  nvoked when load
7170: 69 6e 67 20 6f 72 20 73 74 6f 72 69 6e 67 20 61  ing or storing a
7180: 6e 20 65 6e 63 72 79 70 74 65 64 20 50 45 4d 20  n encrypted PEM 
7190: 63 65 72 74 69 66 69 63 61 74 65 2e 20 54 68 65  certificate. The
71a0: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a   arguments are:.
71b0: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66  .[list_begin def
71c0: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20  initions]..[def 
71d0: 5b 61 72 67 20 72 77 66 6c 61 67 5d 5d 0a 54 68  [arg rwflag]].Th
71e0: 65 20 72 65 61 64 2f 77 72 69 74 65 20 66 6c 61  e read/write fla
71f0: 67 20 69 73 20 30 20 66 6f 72 20 72 65 61 64 69  g is 0 for readi
7200: 6e 67 2f 64 65 63 72 79 70 74 69 6f 6e 20 6f 72  ng/decryption or
7210: 20 31 20 66 6f 72 20 77 72 69 74 69 6e 67 2f 65   1 for writing/e
7220: 6e 63 72 79 70 74 69 6f 6e 2e 0a 54 68 65 20 6c  ncryption..The l
7230: 61 74 74 65 72 20 63 61 6e 20 62 65 20 75 73 65  atter can be use
7240: 64 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77  d to determine w
7250: 68 65 6e 20 74 6f 20 70 72 6f 6d 70 74 20 74 68  hen to prompt th
7260: 65 20 75 73 65 72 20 74 6f 20 63 6f 6e 66 69 72  e user to confir
7270: 6d 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74  m..This argument
7280: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
7290: 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 5b 61  LS 1.8...[def [a
72a0: 72 67 20 73 69 7a 65 5d 5d 0a 54 68 65 20 73 69  rg size]].The si
72b0: 7a 65 20 69 73 20 74 68 65 20 6d 61 78 69 6d 75  ze is the maximu
72c0: 6d 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20  m length of the 
72d0: 70 61 73 73 77 6f 72 64 20 69 6e 20 62 79 74 65  password in byte
72e0: 73 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74  s..This argument
72f0: 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54   is new for TclT
7300: 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65  LS 1.8...[list_e
7310: 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  nd]..[list_end].
7320: 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56 61  .[subsection "Va
7330: 6c 75 65 73 20 66 6f 72 20 56 61 6c 69 64 61 74  lues for Validat
7340: 65 20 43 6f 6d 6d 61 6e 64 20 43 61 6c 6c 62 61  e Command Callba
7350: 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61  ck"]..The callba
7360: 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 74 69  ck for the [opti
7370: 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d  on -validatecomm
7380: 61 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69  and] option is i
7390: 6e 76 6f 6b 65 64 20 64 75 72 69 6e 67 20 74 68  nvoked during th
73a0: 65 20 68 61 6e 64 73 68 61 6b 65 0a 70 72 6f 63  e handshake.proc
73b0: 65 73 73 20 69 6e 20 6f 72 64 65 72 20 66 6f 72  ess in order for
73c0: 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e   the application
73d0: 20 74 6f 20 76 61 6c 69 64 61 74 65 20 74 68 65   to validate the
73e0: 20 70 72 6f 76 69 64 65 64 20 76 61 6c 75 65 28   provided value(
73f0: 73 29 2e 20 53 65 65 0a 62 65 6c 6f 77 20 66 6f  s). See.below fo
7400: 72 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20 61  r the possible a
7410: 72 67 75 6d 65 6e 74 73 20 70 61 73 73 65 64 20  rguments passed 
7420: 74 6f 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20  to the callback 
7430: 73 63 72 69 70 74 2e 20 49 66 20 6e 6f 74 0a 73  script. If not.s
7440: 70 65 63 69 66 69 65 64 2c 20 4f 70 65 6e 53 53  pecified, OpenSS
7450: 4c 20 77 69 6c 6c 20 61 63 63 65 70 74 20 61 6c  L will accept al
7460: 6c 20 76 61 6c 69 64 20 63 65 72 74 69 66 69 63  l valid certific
7470: 61 74 65 73 20 61 6e 64 20 65 78 74 65 6e 73 69  ates and extensi
7480: 6f 6e 73 2e 20 54 6f 20 72 65 6a 65 63 74 0a 74  ons. To reject.t
7490: 68 65 20 76 61 6c 75 65 20 61 6e 64 20 61 62 6f  he value and abo
74a0: 72 74 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f  rt the connectio
74b0: 6e 2c 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20  n, the callback 
74c0: 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 30 2e  should return 0.
74d0: 20 54 6f 20 61 63 63 65 70 74 20 74 68 65 0a 76   To accept the.v
74e0: 61 6c 75 65 20 61 6e 64 20 63 6f 6e 74 69 6e 75  alue and continu
74f0: 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  e the connection
7500: 2c 20 69 74 20 73 68 6f 75 6c 64 20 72 65 74 75  , it should retu
7510: 72 6e 20 31 2e 20 54 6f 20 72 65 6a 65 63 74 20  rn 1. To reject 
7520: 74 68 65 20 76 61 6c 75 65 2c 20 62 75 74 0a 63  the value, but.c
7530: 6f 6e 74 69 6e 75 65 20 74 68 65 20 63 6f 6e 6e  ontinue the conn
7540: 65 63 74 69 6f 6e 2c 20 69 74 20 73 68 6f 75 6c  ection, it shoul
7550: 64 20 72 65 74 75 72 6e 20 32 2e 20 54 68 69 73  d return 2. This
7560: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77   callback is new
7570: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
7580: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70  ..[list_begin op
7590: 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66  tions]..[opt_def
75a0: 20 61 6c 70 6e 20 5b 61 72 67 20 22 63 68 61 6e   alpn [arg "chan
75b0: 6e 65 6c 49 64 20 70 72 6f 74 6f 63 6f 6c 20 6d  nelId protocol m
75c0: 61 74 63 68 22 5d 5d 0a 46 6f 72 20 73 65 72 76  atch"]].For serv
75d0: 65 72 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f  ers, this form o
75e0: 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e  f callback is in
75f0: 76 6f 6b 65 64 20 77 68 65 6e 20 74 68 65 20 63  voked when the c
7600: 6c 69 65 6e 74 20 41 4c 50 4e 20 65 78 74 65 6e  lient ALPN exten
7610: 73 69 6f 6e 20 69 73 0a 72 65 63 65 69 76 65 64  sion is.received
7620: 2e 20 49 66 20 5b 61 72 67 20 6d 61 74 63 68 5d  . If [arg match]
7630: 20 69 73 20 74 72 75 65 2c 20 74 68 65 6e 20 5b   is true, then [
7640: 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 20 69 73  arg protocol] is
7650: 20 74 68 65 20 66 69 72 73 74 0a 5b 6f 70 74 69   the first.[opti
7660: 6f 6e 20 2d 61 6c 70 6e 5d 20 70 72 6f 74 6f 63  on -alpn] protoc
7670: 6f 6c 20 6f 70 74 69 6f 6e 20 69 6e 20 63 6f 6d  ol option in com
7680: 6d 6f 6e 20 74 6f 20 62 6f 74 68 20 74 68 65 20  mon to both the 
7690: 63 6c 69 65 6e 74 20 61 6e 64 20 73 65 72 76 65  client and serve
76a0: 72 2e 0a 49 66 20 6e 6f 74 2c 20 74 68 65 20 66  r..If not, the f
76b0: 69 72 73 74 20 63 6c 69 65 6e 74 20 73 70 65 63  irst client spec
76c0: 69 66 69 65 64 20 70 72 6f 74 6f 63 6f 6c 20 69  ified protocol i
76d0: 73 20 75 73 65 64 2e 20 54 68 69 73 20 63 61 6c  s used. This cal
76e0: 6c 62 61 63 6b 20 69 73 20 63 61 6c 6c 65 64 0a  lback is called.
76f0: 61 66 74 65 72 20 74 68 65 20 48 65 6c 6c 6f 20  after the Hello 
7700: 61 6e 64 20 41 4c 50 4e 20 63 61 6c 6c 62 61 63  and ALPN callbac
7710: 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 68 65  ks...[opt_def he
7720: 6c 6c 6f 20 5b 61 72 67 20 22 63 68 61 6e 6e 65  llo [arg "channe
7730: 6c 49 64 20 73 65 72 76 65 72 6e 61 6d 65 22 5d  lId servername"]
7740: 5d 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74  ].For servers, t
7750: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
7760: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20  back is invoked 
7770: 64 75 72 69 6e 67 20 63 6c 69 65 6e 74 20 68 65  during client he
7780: 6c 6c 6f 20 6d 65 73 73 61 67 65 0a 70 72 6f 63  llo message.proc
7790: 65 73 73 69 6e 67 2e 20 54 68 65 20 70 75 72 70  essing. The purp
77a0: 6f 73 65 20 69 73 20 73 6f 20 74 68 65 20 73 65  ose is so the se
77b0: 72 76 65 72 20 63 61 6e 20 73 65 6c 65 63 74 20  rver can select 
77c0: 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20  the appropriate 
77d0: 63 65 72 74 69 66 69 63 61 74 65 0a 74 6f 20 70  certificate.to p
77e0: 72 65 73 65 6e 74 20 74 6f 20 74 68 65 20 63 6c  resent to the cl
77f0: 69 65 6e 74 2c 20 61 6e 64 20 74 6f 20 6d 61 6b  ient, and to mak
7800: 65 20 6f 74 68 65 72 20 63 6f 6e 66 69 67 75 72  e other configur
7810: 61 74 69 6f 6e 20 61 64 6a 75 73 74 6d 65 6e 74  ation adjustment
7820: 73 20 72 65 6c 65 76 61 6e 74 0a 74 6f 20 74 68  s relevant.to th
7830: 61 74 20 73 65 72 76 65 72 20 6e 61 6d 65 20 61  at server name a
7840: 6e 64 20 69 74 73 20 63 6f 6e 66 69 67 75 72 61  nd its configura
7850: 74 69 6f 6e 2e 20 49 74 20 69 73 20 63 61 6c 6c  tion. It is call
7860: 65 64 20 62 65 66 6f 72 65 20 74 68 65 20 53 4e  ed before the SN
7870: 49 20 61 6e 64 20 41 4c 50 4e 0a 63 61 6c 6c 62  I and ALPN.callb
7880: 61 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  acks...[opt_def 
7890: 73 6e 69 20 5b 61 72 67 20 22 63 68 61 6e 6e 65  sni [arg "channe
78a0: 6c 49 64 20 73 65 72 76 65 72 6e 61 6d 65 22 5d  lId servername"]
78b0: 5d 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74  ].For servers, t
78c0: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
78d0: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20  back is invoked 
78e0: 77 68 65 6e 20 74 68 65 20 53 65 72 76 65 72 20  when the Server 
78f0: 4e 61 6d 65 20 49 6e 64 69 63 61 74 69 6f 6e 0a  Name Indication.
7900: 28 53 4e 49 29 20 65 78 74 65 6e 73 69 6f 6e 20  (SNI) extension 
7910: 69 73 20 72 65 63 65 69 76 65 64 2e 20 54 68 65  is received. The
7920: 20 5b 61 72 67 20 73 65 72 76 65 72 6e 61 6d 65   [arg servername
7930: 5d 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68  ] argument is th
7940: 65 20 63 6c 69 65 6e 74 0a 70 72 6f 76 69 64 65  e client.provide
7950: 64 20 73 65 72 76 65 72 20 6e 61 6d 65 20 73 70  d server name sp
7960: 65 63 69 66 69 65 64 20 69 6e 20 74 68 65 20 5b  ecified in the [
7970: 6f 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61  option -serverna
7980: 6d 65 3c 2f 62 3e 5d 20 6f 70 74 69 6f 6e 2e 20  me</b>] option. 
7990: 54 68 65 0a 70 75 72 70 6f 73 65 20 69 73 20 73  The.purpose is s
79a0: 6f 20 77 68 65 6e 20 61 20 73 65 72 76 65 72 20  o when a server 
79b0: 73 75 70 70 6f 72 74 73 20 6d 75 6c 74 69 70 6c  supports multipl
79c0: 65 20 6e 61 6d 65 73 2c 20 74 68 65 20 72 69 67  e names, the rig
79d0: 68 74 20 63 65 72 74 69 66 69 63 61 74 65 0a 63  ht certificate.c
79e0: 61 6e 20 62 65 20 75 73 65 64 2e 20 49 74 20 69  an be used. It i
79f0: 73 20 63 61 6c 6c 65 64 20 61 66 74 65 72 20 74  s called after t
7a00: 68 65 20 68 65 6c 6c 6f 20 63 61 6c 6c 62 61 63  he hello callbac
7a10: 6b 20 62 75 74 20 62 65 66 6f 72 65 20 74 68 65  k but before the
7a20: 20 41 4c 50 4e 0a 63 61 6c 6c 62 61 63 6b 2e 0a   ALPN.callback..
7a30: 0a 5b 6f 70 74 5f 64 65 66 20 76 65 72 69 66 79  .[opt_def verify
7a40: 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64   [arg "channelId
7a50: 20 64 65 70 74 68 20 63 65 72 74 20 73 74 61 74   depth cert stat
7a60: 75 73 20 65 72 72 6f 72 22 5d 5d 0a 54 68 69 73  us error"]].This
7a70: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63   form of callbac
7a80: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20  k is invoked by 
7a90: 4f 70 65 6e 53 53 4c 20 77 68 65 6e 20 61 20 6e  OpenSSL when a n
7aa0: 65 77 20 63 65 72 74 69 66 69 63 61 74 65 20 69  ew certificate i
7ab0: 73 20 72 65 63 65 69 76 65 64 0a 66 72 6f 6d 20  s received.from 
7ac0: 74 68 65 20 70 65 65 72 2e 20 49 74 20 61 6c 6c  the peer. It all
7ad0: 6f 77 73 20 74 68 65 20 63 6c 69 65 6e 74 20 74  ows the client t
7ae0: 6f 20 63 68 65 63 6b 20 74 68 65 20 63 65 72 74  o check the cert
7af0: 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63 61  ificate verifica
7b00: 74 69 6f 6e 0a 72 65 73 75 6c 74 73 20 61 6e 64  tion.results and
7b10: 20 63 68 6f 6f 73 65 20 77 68 65 74 68 65 72 20   choose whether 
7b20: 74 6f 20 63 6f 6e 74 69 6e 75 65 20 6f 72 20 6e  to continue or n
7b30: 6f 74 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64  ot. It is called
7b40: 20 66 6f 72 20 65 61 63 68 0a 63 65 72 74 69 66   for each.certif
7b50: 69 63 61 74 65 20 69 6e 20 74 68 65 20 63 65 72  icate in the cer
7b60: 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 2e 20  tificate chain. 
7b70: 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 61  This callback wa
7b80: 73 20 6d 6f 76 65 64 20 66 72 6f 6d 0a 5b 6f 70  s moved from.[op
7b90: 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 69  tion -command] i
7ba0: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68  n TclTLS 1.8. Th
7bb0: 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a  e arguments are:
7bc0: 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65  ..[list_begin de
7bd0: 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66  finitions]..[def
7be0: 20 5b 61 72 67 20 64 65 70 74 68 5d 5d 0a 54 68   [arg depth]].Th
7bf0: 65 20 64 65 70 74 68 20 69 73 20 74 68 65 20 69  e depth is the i
7c00: 6e 74 65 67 65 72 20 64 65 70 74 68 20 6f 66 20  nteger depth of 
7c10: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
7c20: 69 6e 20 74 68 65 20 63 65 72 74 69 66 69 63 61  in the certifica
7c30: 74 65 20 63 68 61 69 6e 2c 0a 77 68 65 72 65 20  te chain,.where 
7c40: 30 20 69 73 20 74 68 65 20 70 65 65 72 20 63 65  0 is the peer ce
7c50: 72 74 69 66 69 63 61 74 65 20 61 6e 64 20 68 69  rtificate and hi
7c60: 67 68 65 72 20 76 61 6c 75 65 73 20 67 6f 69 6e  gher values goin
7c70: 67 20 75 70 20 74 6f 20 74 68 65 20 43 65 72 74  g up to the Cert
7c80: 69 66 69 63 61 74 65 0a 41 75 74 68 6f 72 69 74  ificate.Authorit
7c90: 79 20 28 43 41 29 2e 0a 0a 5b 64 65 66 20 5b 61  y (CA)...[def [a
7ca0: 72 67 20 63 65 72 74 5d 5d 0a 54 68 65 20 63 65  rg cert]].The ce
7cb0: 72 74 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61  rt argument is a
7cc0: 20 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c   list of key-val
7cd0: 75 65 20 70 61 69 72 73 20 73 69 6d 69 6c 61 72  ue pairs similar
7ce0: 20 74 6f 20 74 68 6f 73 65 20 72 65 74 75 72 6e   to those return
7cf0: 65 64 20 62 79 0a 5b 63 6d 64 20 74 6c 73 3a 3a  ed by.[cmd tls::
7d00: 73 74 61 74 75 73 5d 2e 0a 0a 5b 64 65 66 20 5b  status]...[def [
7d10: 61 72 67 20 73 74 61 74 75 73 5d 5d 0a 54 68 65  arg status]].The
7d20: 20 73 74 61 74 75 73 20 61 72 67 75 6d 65 6e 74   status argument
7d30: 20 69 73 20 74 68 65 20 62 6f 6f 6c 65 61 6e 20   is the boolean 
7d40: 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 65 20  validity of the 
7d50: 63 75 72 72 65 6e 74 20 63 65 72 74 69 66 69 63  current certific
7d60: 61 74 65 20 77 68 65 72 65 20 30 0a 69 73 20 69  ate where 0.is i
7d70: 6e 76 61 6c 69 64 20 61 6e 64 20 31 20 69 73 20  nvalid and 1 is 
7d80: 76 61 6c 69 64 2e 0a 0a 5b 64 65 66 20 5b 61 72  valid...[def [ar
7d90: 67 20 65 72 72 6f 72 5d 5d 0a 54 68 65 20 65 72  g error]].The er
7da0: 72 6f 72 20 61 72 67 75 6d 65 6e 74 20 69 73 20  ror argument is 
7db0: 74 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67  the error messag
7dc0: 65 2c 20 69 66 20 61 6e 79 2c 20 67 65 6e 65 72  e, if any, gener
7dd0: 61 74 65 64 20 62 79 0a 5b 66 75 6e 20 58 35 30  ated by.[fun X50
7de0: 39 5f 53 54 4f 52 45 5f 43 54 58 5f 67 65 74 5f  9_STORE_CTX_get_
7df0: 65 72 72 6f 72 28 29 5d 2e 0a 0a 5b 6c 69 73 74  error()]...[list
7e00: 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64  _end]..[list_end
7e10: 5d 0a 0a 52 65 66 65 72 65 6e 63 65 20 69 6d 70  ]..Reference imp
7e20: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20  lementations of 
7e30: 74 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73 20  these callbacks 
7e40: 61 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e 20  are provided in 
7e50: 5b 66 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 0a 61  [file tls.tcl].a
7e60: 73 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c  s [cmd tls::call
7e70: 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a  back], [cmd tls:
7e80: 3a 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 20  :password], and 
7e90: 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61  [cmd tls::valida
7ea0: 74 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 72 65 73 70  te_command].resp
7eb0: 65 63 74 69 76 65 6c 79 2e 20 4e 6f 74 65 20 74  ectively. Note t
7ec0: 68 61 74 20 74 68 65 73 65 20 61 72 65 20 6f 6e  hat these are on
7ed0: 6c 79 20 5b 65 6d 70 68 20 73 61 6d 70 6c 65 5d  ly [emph sample]
7ee0: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73   implementations
7ef0: 2e 20 49 6e 20 61 20 6d 6f 72 65 0a 72 65 61 6c  . In a more.real
7f00: 69 73 74 69 63 20 64 65 70 6c 6f 79 6d 65 6e 74  istic deployment
7f10: 20 79 6f 75 20 77 6f 75 6c 64 20 73 70 65 63 69   you would speci
7f20: 66 79 20 79 6f 75 72 20 6f 77 6e 20 63 61 6c 6c  fy your own call
7f30: 62 61 63 6b 20 73 63 72 69 70 74 73 20 6f 6e 20  back scripts on 
7f40: 65 61 63 68 20 54 4c 53 0a 63 68 61 6e 6e 65 6c  each TLS.channel
7f50: 20 75 73 69 6e 67 20 74 68 65 20 5b 6f 70 74 69   using the [opti
7f60: 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f  on -command], [o
7f70: 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d  ption -password]
7f80: 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 76  , and.[option -v
7f90: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
7fa0: 20 6f 70 74 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61   options...[para
7fb0: 5d 0a 0a 54 68 65 20 64 65 66 61 75 6c 74 20 62  ]..The default b
7fc0: 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65  ehavior when the
7fd0: 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e   [option -comman
7fe0: 64 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d  d] and [option -
7ff0: 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64  validate_command
8000: 5d 0a 6f 70 74 69 6f 6e 73 20 61 72 65 20 6e 6f  ].options are no
8010: 74 20 73 70 65 63 69 66 69 65 64 2c 20 69 73 20  t specified, is 
8020: 66 6f 72 20 54 63 6c 54 4c 53 20 74 6f 20 70 72  for TclTLS to pr
8030: 6f 63 65 73 73 20 74 68 65 20 61 73 73 6f 63 69  ocess the associ
8040: 61 74 65 64 20 6c 69 62 72 61 72 79 0a 63 61 6c  ated library.cal
8050: 6c 62 61 63 6b 73 20 69 6e 74 65 72 6e 61 6c 6c  lbacks internall
8060: 79 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 62  y. The default b
8070: 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65  ehavior when the
8080: 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f   [option -passwo
8090: 72 64 5d 20 6f 70 74 69 6f 6e 0a 69 73 20 6e 6f  rd] option.is no
80a0: 74 20 73 70 65 63 69 66 69 65 64 20 69 73 20 66  t specified is f
80b0: 6f 72 20 54 63 6c 54 4c 53 20 74 6f 20 70 72 6f  or TclTLS to pro
80c0: 63 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61  cess the associa
80d0: 74 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c  ted library call
80e0: 62 61 63 6b 73 20 62 79 0a 61 74 74 65 6d 70 74  backs by.attempt
80f0: 69 6e 67 20 74 6f 20 63 61 6c 6c 20 5b 63 6d 64  ing to call [cmd
8100: 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2e   tls::password].
8110: 20 54 68 65 20 64 69 66 66 65 72 65 6e 63 65 20   The difference 
8120: 62 65 74 77 65 65 6e 20 74 68 65 73 65 20 74 77  between these tw
8130: 6f 0a 62 65 68 61 76 69 6f 72 73 20 69 73 20 61  o.behaviors is a
8140: 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66 20   consequence of 
8150: 6d 61 69 6e 74 61 69 6e 69 6e 67 20 63 6f 6d 70  maintaining comp
8160: 61 74 69 62 69 6c 69 74 79 20 77 69 74 68 20 65  atibility with e
8170: 61 72 6c 69 65 72 0a 69 6d 70 6c 65 6d 65 6e 74  arlier.implement
8180: 61 74 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61 5d 0a  ations...[para].
8190: 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65 20  .[emph "The use 
81a0: 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e 63 65  of the reference
81b0: 20 63 61 6c 6c 62 61 63 6b 73 20 5b 63 6d 64 20   callbacks [cmd 
81c0: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20  tls::callback], 
81d0: 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f  [cmd tls::passwo
81e0: 72 64 5d 2c 0a 61 6e 64 20 5b 63 6d 64 20 74 6c  rd],.and [cmd tl
81f0: 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d  s::validate_comm
8200: 61 6e 64 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f  and] is not reco
8210: 6d 6d 65 6e 64 65 64 2e 20 54 68 65 79 20 6d 61  mmended. They ma
8220: 79 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f  y be removed fro
8230: 6d 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65  m future release
8240: 73 2e 22 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 44  s."]..[section D
8250: 65 62 75 67 5d 0a 0a 46 6f 72 20 6d 6f 73 74 20  ebug]..For most 
8260: 64 65 62 75 67 67 69 6e 67 20 6e 65 65 64 73 2c  debugging needs,
8270: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61   the [option -ca
8280: 6c 6c 62 61 63 6b 5d 20 6f 70 74 69 6f 6e 20 63  llback] option c
8290: 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 70 72  an be used to pr
82a0: 6f 76 69 64 65 0a 73 75 66 66 69 63 69 65 6e 74  ovide.sufficient
82b0: 20 69 6e 73 69 67 68 74 20 61 6e 64 20 69 6e 66   insight and inf
82c0: 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20  ormation on the 
82d0: 54 4c 53 20 68 61 6e 64 73 68 61 6b 65 20 61 6e  TLS handshake an
82e0: 64 20 70 72 6f 67 72 65 73 73 2e 20 49 66 0a 66  d progress. If.f
82f0: 75 72 74 68 65 72 20 74 72 6f 75 62 6c 65 73 68  urther troublesh
8300: 6f 6f 74 69 6e 67 20 69 6e 73 69 67 68 74 20 69  ooting insight i
8310: 73 20 6e 65 65 64 65 64 2c 20 74 68 65 20 63 6f  s needed, the co
8320: 6d 70 69 6c 65 20 74 69 6d 65 20 6f 70 74 69 6f  mpile time optio
8330: 6e 0a 5b 6f 70 74 69 6f 6e 20 2d 2d 65 6e 61 62  n.[option --enab
8340: 6c 65 2d 64 65 62 75 67 5d 20 63 61 6e 20 62 65  le-debug] can be
8350: 20 75 73 65 64 20 74 6f 20 67 65 74 20 64 65 74   used to get det
8360: 61 69 6c 65 64 20 65 78 65 63 75 74 69 6f 6e 20  ailed execution 
8370: 66 6c 6f 77 20 73 74 61 74 75 73 2e 0a 0a 5b 70  flow status...[p
8380: 61 72 61 5d 0a 0a 54 4c 53 20 6b 65 79 20 6c 6f  ara]..TLS key lo
8390: 67 67 69 6e 67 20 63 61 6e 20 62 65 20 65 6e 61  gging can be ena
83a0: 62 6c 65 64 20 62 79 20 73 65 74 74 69 6e 67 20  bled by setting 
83b0: 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20  the environment 
83c0: 76 61 72 69 61 62 6c 65 0a 5b 76 61 72 20 53 53  variable.[var SS
83d0: 4c 4b 45 59 4c 4f 47 46 49 4c 45 5d 20 74 6f 20  LKEYLOGFILE] to 
83e0: 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20  the name of the 
83f0: 66 69 6c 65 20 74 6f 20 6c 6f 67 20 74 6f 2e 20  file to log to. 
8400: 54 68 65 6e 20 77 68 65 6e 65 76 65 72 20 54 4c  Then whenever TL
8410: 53 20 6b 65 79 0a 6d 61 74 65 72 69 61 6c 20 69  S key.material i
8420: 73 20 67 65 6e 65 72 61 74 65 64 20 6f 72 20 72  s generated or r
8430: 65 63 65 69 76 65 64 20 69 74 20 77 69 6c 6c 20  eceived it will 
8440: 62 65 20 6c 6f 67 67 65 64 20 74 6f 20 74 68 65  be logged to the
8450: 20 66 69 6c 65 2e 20 54 68 69 73 20 69 73 20 75   file. This is u
8460: 73 65 66 75 6c 0a 66 6f 72 20 6c 6f 67 67 69 6e  seful.for loggin
8470: 67 20 6b 65 79 20 64 61 74 61 20 66 6f 72 20 6e  g key data for n
8480: 65 74 77 6f 72 6b 20 6c 6f 67 67 69 6e 67 20 74  etwork logging t
8490: 6f 6f 6c 73 20 74 6f 20 75 73 65 20 74 6f 20 64  ools to use to d
84a0: 65 63 72 79 70 74 20 74 68 65 20 64 61 74 61 2e  ecrypt the data.
84b0: 0a 0a 5b 70 61 72 61 5d 0a 0a 54 68 65 20 5b 76  ..[para]..The [v
84c0: 61 72 20 74 6c 73 3a 3a 64 65 62 75 67 5d 20 76  ar tls::debug] v
84d0: 61 72 69 61 62 6c 65 20 70 72 6f 76 69 64 65 73  ariable provides
84e0: 20 73 6f 6d 65 20 61 64 64 69 74 69 6f 6e 61 6c   some additional
84f0: 20 63 6f 6e 74 72 6f 6c 20 6f 76 65 72 20 74 68   control over th
8500: 65 0a 64 65 62 75 67 20 6c 6f 67 67 69 6e 67 20  e.debug logging 
8510: 69 6e 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a  in the [cmd tls:
8520: 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64  :callback], [cmd
8530: 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c   tls::password],
8540: 20 61 6e 64 0a 5b 63 6d 64 20 74 6c 73 3a 3a 76   and.[cmd tls::v
8550: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
8560: 20 64 65 66 61 75 6c 74 20 68 61 6e 64 6c 65 72   default handler
8570: 73 20 69 6e 20 5b 66 69 6c 65 20 74 6c 73 2e 74  s in [file tls.t
8580: 63 6c 5d 2e 0a 54 68 65 20 64 65 66 61 75 6c 74  cl]..The default
8590: 20 76 61 6c 75 65 20 69 73 20 30 20 77 69 74 68   value is 0 with
85a0: 20 68 69 67 68 65 72 20 76 61 6c 75 65 73 20 70   higher values p
85b0: 72 6f 64 75 63 69 6e 67 20 6d 6f 72 65 20 64 69  roducing more di
85c0: 61 67 6e 6f 73 74 69 63 20 6f 75 74 70 75 74 2c  agnostic output,
85d0: 0a 61 6e 64 20 77 69 6c 6c 20 61 6c 73 6f 20 66  .and will also f
85e0: 6f 72 63 65 20 74 68 65 20 76 65 72 69 66 79 20  orce the verify 
85f0: 6d 65 74 68 6f 64 20 69 6e 20 5b 63 6d 64 20 74  method in [cmd t
8600: 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 20 74 6f  ls::callback] to
8610: 20 61 63 63 65 70 74 20 74 68 65 0a 63 65 72 74   accept the.cert
8620: 69 66 69 63 61 74 65 2c 20 65 76 65 6e 20 69 66  ificate, even if
8630: 20 69 74 20 69 73 20 69 6e 76 61 6c 69 64 20 77   it is invalid w
8640: 68 65 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  hen the [option 
8650: 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64  -validatecommand
8660: 5d 0a 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 20  ].option is set 
8670: 74 6f 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c  to [cmd tls::val
8680: 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 2e 0a  idate_command]..
8690: 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70 68 20 22  .[para]..[emph "
86a0: 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 76  The use of the v
86b0: 61 72 69 61 62 6c 65 20 5b 76 61 72 20 74 6c 73  ariable [var tls
86c0: 3a 3a 64 65 62 75 67 5d 20 69 73 20 6e 6f 74 20  ::debug] is not 
86d0: 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49 74 20  recommended..It 
86e0: 6d 61 79 20 62 65 20 72 65 6d 6f 76 65 64 20 66  may be removed f
86f0: 72 6f 6d 20 66 75 74 75 72 65 20 72 65 6c 65 61  rom future relea
8700: 73 65 73 2e 22 5d 0a 0a 5b 73 65 63 74 69 6f 6e  ses."]..[section
8710: 20 22 48 54 54 50 20 50 61 63 6b 61 67 65 20 45   "HTTP Package E
8720: 78 61 6d 70 6c 65 73 22 5d 0a 0a 54 68 65 20 66  xamples"]..The f
8730: 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20 65 78 61  ollowing are exa
8740: 6d 70 6c 65 20 73 63 72 69 70 74 73 20 74 6f 20  mple scripts to 
8750: 64 6f 77 6e 6c 6f 61 64 20 61 20 77 65 62 70 61  download a webpa
8760: 67 65 20 61 6e 64 20 66 69 6c 65 20 75 73 69 6e  ge and file usin
8770: 67 20 74 68 65 0a 68 74 74 70 20 70 61 63 6b 61  g the.http packa
8780: 67 65 2e 20 53 65 65 20 5b 73 65 63 74 72 65 66  ge. See [sectref
8790: 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61   "Certificate Va
87a0: 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 77  lidation"] for w
87b0: 68 65 74 68 65 72 20 74 68 65 0a 5b 6f 70 74 69  hether the.[opti
87c0: 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74  on -cadir], [opt
87d0: 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20 61 6e  ion -cafile], an
87e0: 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  d [option -casto
87f0: 72 65 5d 20 6f 70 74 69 6f 6e 73 20 61 72 65 20  re] options are 
8800: 61 6c 73 6f 0a 6e 65 65 64 65 64 2e 20 53 65 65  also.needed. See
8810: 20 74 68 65 20 64 65 6d 6f 73 20 64 69 72 65 63   the demos direc
8820: 74 6f 72 79 20 66 6f 72 20 6d 6f 72 65 20 65 78  tory for more ex
8830: 61 6d 70 6c 65 20 73 63 72 69 70 74 73 2e 0a 0a  ample scripts...
8840: 5b 70 61 72 61 5d 0a 0a 45 78 61 6d 70 6c 65 20  [para]..Example 
8850: 23 31 3a 20 44 6f 77 6e 6c 6f 61 64 20 61 20 77  #1: Download a w
8860: 65 62 20 70 61 67 65 0a 0a 5b 65 78 61 6d 70 6c  eb page..[exampl
8870: 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65 71  e {..package req
8880: 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67  uire http.packag
8890: 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 73  e require tls..s
88a0: 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f 2f  et url "https://
88b0: 77 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a 68 74 74  www.tcl.tk/".htt
88c0: 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74 70  p::register http
88d0: 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c  s 443 [list ::tl
88e0: 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73  s::socket -autos
88f0: 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 72 65 71  ervername 1 -req
8900: 75 69 72 65 20 31 5d 0a 0a 23 20 47 65 74 20 55  uire 1]..# Get U
8910: 52 4c 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 68 74  RL.set token [ht
8920: 74 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c 5d  tp::geturl $url]
8930: 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20 65 72  ..# Check for er
8940: 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a 3a 73  ror.if {[http::s
8950: 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e 65  tatus $token] ne
8960: 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75 74   "ok"} {.    put
8970: 73 20 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f 72  s [format "Error
8980: 20 25 73 22 20 5b 68 74 74 70 3a 3a 73 74 61 74   %s" [http::stat
8990: 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23  us $token]].}..#
89a0: 20 53 61 76 65 20 77 65 62 20 70 61 67 65 20 74   Save web page t
89b0: 6f 20 66 69 6c 65 0a 73 65 74 20 63 68 20 5b 6f  o file.set ch [o
89c0: 70 65 6e 20 65 78 61 6d 70 6c 65 2e 68 74 6d 6c  pen example.html
89d0: 20 77 62 5d 0a 70 75 74 73 20 24 63 68 20 5b 68   wb].puts $ch [h
89e0: 74 74 70 3a 3a 64 61 74 61 20 24 74 6f 6b 65 6e  ttp::data $token
89f0: 5d 0a 63 6c 6f 73 65 20 24 63 68 0a 0a 23 20 43  ].close $ch..# C
8a00: 6c 65 61 6e 75 70 0a 3a 3a 68 74 74 70 3a 3a 63  leanup.::http::c
8a10: 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d  leanup $token.}]
8a20: 0a 0a 45 78 61 6d 70 6c 65 20 23 32 3a 20 44 6f  ..Example #2: Do
8a30: 77 6e 6c 6f 61 64 20 61 20 66 69 6c 65 0a 0a 5b  wnload a file..[
8a40: 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b 61  example {..packa
8a50: 67 65 20 72 65 71 75 69 72 65 20 68 74 74 70 0a  ge require http.
8a60: 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 20  package require 
8a70: 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 68 74  tls..set url "ht
8a80: 74 70 73 3a 2f 2f 77 69 6b 69 2e 74 63 6c 2d 6c  tps://wiki.tcl-l
8a90: 61 6e 67 2e 6f 72 67 2f 73 69 74 65 6d 61 70 2e  ang.org/sitemap.
8aa0: 78 6d 6c 22 0a 68 74 74 70 3a 3a 72 65 67 69 73  xml".http::regis
8ab0: 74 65 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c  ter https 443 [l
8ac0: 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65  ist ::tls::socke
8ad0: 74 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d  t -autoservernam
8ae0: 65 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d 0a  e 1 -require 1].
8af0: 0a 23 20 4f 70 65 6e 20 6f 75 74 70 75 74 20 66  .# Open output f
8b00: 69 6c 65 0a 73 65 74 20 66 69 6c 65 6e 61 6d 65  ile.set filename
8b10: 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 75 72 6c   [file tail $url
8b20: 5d 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20 24  ].set ch [open $
8b30: 66 69 6c 65 6e 61 6d 65 20 77 62 5d 0a 0a 23 20  filename wb]..# 
8b40: 47 65 74 20 66 69 6c 65 0a 73 65 74 20 74 6f 6b  Get file.set tok
8b50: 65 6e 20 5b 3a 3a 68 74 74 70 3a 3a 67 65 74 75  en [::http::getu
8b60: 72 6c 20 24 75 72 6c 20 2d 62 6c 6f 63 6b 73 69  rl $url -blocksi
8b70: 7a 65 20 36 35 35 33 36 20 2d 63 68 61 6e 6e 65  ze 65536 -channe
8b80: 6c 20 24 63 68 5d 0a 0a 23 20 43 68 65 63 6b 20  l $ch]..# Check 
8b90: 66 6f 72 20 65 72 72 6f 72 0a 69 66 20 7b 5b 68  for error.if {[h
8ba0: 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b  ttp::status $tok
8bb0: 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20  en] ne "ok"} {. 
8bc0: 20 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 74 20     puts [format 
8bd0: 22 45 72 72 6f 72 20 25 73 22 20 5b 68 74 74 70  "Error %s" [http
8be0: 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d  ::status $token]
8bf0: 5d 0a 7d 0a 0a 23 20 43 6c 65 61 6e 75 70 0a 63  ].}..# Cleanup.c
8c00: 6c 6f 73 65 20 24 63 68 0a 3a 3a 68 74 74 70 3a  lose $ch.::http:
8c10: 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a  :cleanup $token.
8c20: 7d 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 53 70  }]..[section "Sp
8c30: 65 63 69 61 6c 20 43 6f 6e 73 69 64 65 72 61 74  ecial Considerat
8c40: 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 63 61 70 61  ions"]..The capa
8c50: 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69 73  bilities of this
8c60: 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61 72   package can var
8c70: 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61 73  y enormously bas
8c80: 65 64 20 75 70 6f 6e 20 68 6f 77 20 74 68 65 0a  ed upon how the.
8c90: 6c 69 6e 6b 65 64 20 74 6f 20 4f 70 65 6e 53 53  linked to OpenSS
8ca0: 4c 20 6c 69 62 72 61 72 79 20 77 61 73 20 63 6f  L library was co
8cb0: 6e 66 69 67 75 72 65 64 20 61 6e 64 20 62 75 69  nfigured and bui
8cc0: 6c 74 2e 20 4e 65 77 20 76 65 72 73 69 6f 6e 73  lt. New versions
8cd0: 20 6d 61 79 20 6f 62 73 6f 6c 65 74 65 0a 6f 6c   may obsolete.ol
8ce0: 64 65 72 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72  der protocol ver
8cf0: 73 69 6f 6e 73 2c 20 61 64 64 20 6f 72 20 72 65  sions, add or re
8d00: 6d 6f 76 65 20 63 69 70 68 65 72 73 2c 20 63 68  move ciphers, ch
8d10: 61 6e 67 65 20 64 65 66 61 75 6c 74 20 76 61 6c  ange default val
8d20: 75 65 73 2c 20 65 74 63 2e 0a 55 73 65 20 74 68  ues, etc..Use th
8d30: 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74  e [cmd tls::prot
8d40: 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 73 20  ocols] commands 
8d50: 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 73 75  to obtain the su
8d60: 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f 6c  pported.protocol
8d70: 20 76 65 72 73 69 6f 6e 73 2e 0a 0a 5b 6d 61 6e   versions...[man
8d80: 70 61 67 65 5f 65 6e 64 5d 0a                    page_end].