Hex Artifact Content

Artifact 260c3c96cc75efe2f817c7786f2daa983cc4f1b1d0a0cd5475e0ed0246a6b1a4:


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 44 65 66 61 75   argument. Defau
09f0: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c  lt is [const fal
0a00: 73 65 5d 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  se]...[list_end]
0a10: 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73  ..[call [cmd tls
0a20: 3a 3a 73 6f 63 6b 65 74 5d 20 5b 6f 70 74 69 6f  ::socket] [optio
0a30: 6e 20 2d 73 65 72 76 65 72 5d 20 5b 61 72 67 20  n -server] [arg 
0a40: 63 6f 6d 6d 61 6e 64 5d 20 5b 6f 70 74 20 5b 61  command] [opt [a
0a50: 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70  rg -option]] [op
0a60: 74 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b  t [arg value]] [
0a70: 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f  opt [arg "-optio
0a80: 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 20 5b  n value ..."]] [
0a90: 61 72 67 20 70 6f 72 74 5d 5d 0a 0a 53 61 6d 65  arg port]]..Same
0aa0: 20 61 73 20 70 72 65 76 69 6f 75 73 2c 20 62 75   as previous, bu
0ab0: 74 20 69 6e 73 74 65 61 64 20 63 72 65 61 74 65  t instead create
0ac0: 73 20 61 20 73 65 72 76 65 72 20 73 6f 63 6b 65  s a server socke
0ad0: 74 20 66 6f 72 20 63 6c 69 65 6e 74 73 20 74 6f  t for clients to
0ae0: 20 63 6f 6e 6e 65 63 74 20 74 6f 0a 6a 75 73 74   connect to.just
0af0: 20 6c 69 6b 65 20 74 68 65 20 54 63 6c 20 5b 73   like the Tcl [s
0b00: 79 73 63 6d 64 20 22 73 6f 63 6b 65 74 20 2d 73  yscmd "socket -s
0b10: 65 72 76 65 72 22 5d 20 63 6f 6d 6d 61 6e 64 2e  erver"] command.
0b20: 20 49 74 20 72 65 74 75 72 6e 73 20 74 68 65 20   It returns the 
0b30: 63 68 61 6e 6e 65 6c 0a 68 61 6e 64 6c 65 20 69  channel.handle i
0b40: 64 20 66 6f 72 20 74 68 65 20 6e 65 77 20 73 6f  d for the new so
0b50: 63 6b 65 74 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  cket...[call [cm
0b60: 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20 5b  d tls::import] [
0b70: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20 5b 6f 70  arg channel] [op
0b80: 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d  t [arg -option]]
0b90: 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75 65   [opt [arg value
0ba0: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f  ]] [opt [arg "-o
0bb0: 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22  ption value ..."
0bc0: 5d 5d 5d 0a 0a 53 74 61 72 74 20 54 4c 53 20 65  ]]]..Start TLS e
0bd0: 6e 63 72 79 70 74 69 6f 6e 20 6f 6e 20 54 43 4c  ncryption on TCL
0be0: 20 63 68 61 6e 6e 65 6c 20 5b 61 72 67 20 63 68   channel [arg ch
0bf0: 61 6e 6e 65 6c 5d 20 76 69 61 20 61 20 73 74 61  annel] via a sta
0c00: 63 6b 65 64 20 63 68 61 6e 6e 65 6c 2e 20 49 74  cked channel. It
0c10: 0a 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 20 73  .need not be a s
0c20: 6f 63 6b 65 74 2c 20 62 75 74 20 6d 75 73 74 20  ocket, but must 
0c30: 70 72 6f 76 69 64 65 20 62 69 2d 64 69 72 65 63  provide bi-direc
0c40: 74 69 6f 6e 61 6c 20 66 6c 6f 77 2e 20 41 6c 73  tional flow. Als
0c50: 6f 20 73 65 74 73 20 73 65 73 73 69 6f 6e 0a 70  o sets session.p
0c60: 61 72 61 6d 65 74 65 72 73 20 66 6f 72 20 53 53  arameters for SS
0c70: 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 56 61 6c  L handshake. Val
0c80: 69 64 20 6f 70 74 69 6f 6e 73 20 61 72 65 3a 0a  id options are:.
0c90: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74  .[list_begin opt
0ca0: 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20  ions]..[opt_def 
0cb0: 2d 61 6c 70 6e 20 5b 61 72 67 20 6c 69 73 74 5d  -alpn [arg list]
0cc0: 5d 0a 4c 69 73 74 20 6f 66 20 70 72 6f 74 6f 63  ].List of protoc
0cd0: 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20 64 75 72  ols to offer dur
0ce0: 69 6e 67 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d  ing Application-
0cf0: 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e  Layer Protocol N
0d00: 65 67 6f 74 69 61 74 69 6f 6e 0a 28 41 4c 50 4e  egotiation.(ALPN
0d10: 29 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 3a 20  ). For example: 
0d20: 5b 63 6f 6e 73 74 20 68 32 5d 20 61 6e 64 20 5b  [const h2] and [
0d30: 63 6f 6e 73 74 20 68 74 74 70 2f 31 2e 31 5d 2c  const http/1.1],
0d40: 20 62 75 74 20 6e 6f 74 20 5b 63 6f 6e 73 74 20   but not [const 
0d50: 68 33 5d 20 6f 72 0a 5b 63 6f 6e 73 74 20 71 75  h3] or.[const qu
0d60: 69 63 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ic]...[opt_def -
0d70: 63 61 64 69 72 20 5b 61 72 67 20 64 69 72 65 63  cadir [arg direc
0d80: 74 6f 72 79 5d 5d 0a 53 70 65 63 69 66 69 65 73  tory]].Specifies
0d90: 20 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 77   the directory w
0da0: 68 65 72 65 20 74 68 65 20 43 65 72 74 69 66 69  here the Certifi
0db0: 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28  cate Authority (
0dc0: 43 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73  CA) certificates
0dd0: 20 61 72 65 0a 73 74 6f 72 65 64 2e 20 54 68 65   are.stored. The
0de0: 20 64 65 66 61 75 6c 74 20 69 73 20 70 6c 61 74   default is plat
0df0: 66 6f 72 6d 20 73 70 65 63 69 66 69 63 20 61 6e  form specific an
0e00: 64 20 63 61 6e 20 62 65 20 73 65 74 20 61 74 20  d can be set at 
0e10: 63 6f 6d 70 69 6c 65 20 74 69 6d 65 2e 20 54 68  compile time. Th
0e20: 65 0a 64 65 66 61 75 6c 74 20 6c 6f 63 61 74 69  e.default locati
0e30: 6f 6e 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69  on can be overri
0e40: 64 64 65 6e 20 62 79 20 74 68 65 20 5b 76 61 72  dden by the [var
0e50: 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20 65   SSL_CERT_DIR] e
0e60: 6e 76 69 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61  nvironment.varia
0e70: 62 6c 65 2e 20 53 65 65 20 5b 73 65 63 74 72 65  ble. See [sectre
0e80: 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56  f "Certificate V
0e90: 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20  alidation"] for 
0ea0: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b  more details...[
0eb0: 6f 70 74 5f 64 65 66 20 2d 63 61 66 69 6c 65 20  opt_def -cafile 
0ec0: 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a  [arg filename]].
0ed0: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 66 69  Specifies the fi
0ee0: 6c 65 20 77 69 74 68 20 74 68 65 20 43 65 72 74  le with the Cert
0ef0: 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74  ificate Authorit
0f00: 79 20 28 43 41 29 20 63 65 72 74 69 66 69 63 61  y (CA) certifica
0f10: 74 65 73 20 74 6f 20 75 73 65 20 69 6e 0a 5b 63  tes to use in.[c
0f20: 6f 6e 73 74 20 50 45 4d 5d 20 66 69 6c 65 20 66  onst PEM] file f
0f30: 6f 72 6d 61 74 2e 20 54 68 65 20 64 65 66 61 75  ormat. The defau
0f40: 6c 74 20 69 73 20 5b 66 69 6c 65 20 63 65 72 74  lt is [file cert
0f50: 2e 70 65 6d 5d 2c 20 69 6e 20 74 68 65 20 4f 70  .pem], in the Op
0f60: 65 6e 53 53 4c 0a 64 69 72 65 63 74 6f 72 79 2e  enSSL.directory.
0f70: 20 54 68 65 20 64 65 66 61 75 6c 74 20 66 69 6c   The default fil
0f80: 65 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64  e can be overrid
0f90: 64 65 6e 20 62 79 20 74 68 65 20 5b 76 61 72 20  den by the [var 
0fa0: 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65  SSL_CERT_FILE] e
0fb0: 6e 76 69 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61  nvironment.varia
0fc0: 62 6c 65 2e 20 53 65 65 20 5b 73 65 63 74 72 65  ble. See [sectre
0fd0: 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56  f "Certificate V
0fe0: 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20  alidation"] for 
0ff0: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b  more details...[
1000: 6f 70 74 5f 64 65 66 20 2d 63 61 73 74 6f 72 65  opt_def -castore
1010: 20 5b 61 72 67 20 55 52 49 5d 5d 0a 53 70 65 63   [arg URI]].Spec
1020: 69 66 69 65 73 20 74 68 65 20 55 6e 69 66 6f 72  ifies the Unifor
1030: 6d 20 52 65 73 6f 75 72 63 65 20 49 64 65 6e 74  m Resource Ident
1040: 69 66 69 65 72 20 28 55 52 49 29 20 66 6f 72 20  ifier (URI) for 
1050: 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20  the Certificate 
1060: 41 75 74 68 6f 72 69 74 79 0a 28 43 41 29 20 73  Authority.(CA) s
1070: 74 6f 72 65 2c 20 77 68 69 63 68 20 6d 61 79 20  tore, which may 
1080: 62 65 20 61 20 73 69 6e 67 6c 65 20 63 6f 6e 74  be a single cont
1090: 61 69 6e 65 72 20 6f 72 20 61 20 63 61 74 61 6c  ainer or a catal
10a0: 6f 67 20 6f 66 20 63 6f 6e 74 61 69 6e 65 72 73  og of containers
10b0: 2e 0a 53 74 61 72 74 69 6e 67 20 77 69 74 68 20  ..Starting with 
10c0: 4f 70 65 6e 53 53 4c 20 33 2e 32 20 6f 6e 20 4d  OpenSSL 3.2 on M
10d0: 53 20 57 69 6e 64 6f 77 73 2c 20 73 65 74 20 74  S Windows, set t
10e0: 6f 20 22 5b 63 6f 6e 73 74 20 22 6f 72 67 2e 6f  o "[const "org.o
10f0: 70 65 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a  penssl.winstore:
1100: 2f 2f 22 5d 22 0a 74 6f 20 75 73 65 20 74 68 65  //"]".to use the
1110: 20 62 75 69 6c 74 2d 69 6e 20 4d 53 20 57 69 6e   built-in MS Win
1120: 64 6f 77 73 20 43 65 72 74 69 66 69 63 61 74 65  dows Certificate
1130: 20 53 74 6f 72 65 2e 20 53 65 65 0a 5b 73 65 63   Store. See.[sec
1140: 74 72 65 66 20 22 43 65 72 74 69 66 69 63 61 74  tref "Certificat
1150: 65 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66  e Validation"] f
1160: 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e  or more details.
1170: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 65 72 74  ..[opt_def -cert
1180: 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61  file [arg filena
1190: 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  me]].Specifies t
11a0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 66  he name of the f
11b0: 69 6c 65 20 77 69 74 68 20 74 68 65 20 63 65 72  ile with the cer
11c0: 74 69 66 69 63 61 74 65 20 74 6f 20 75 73 65 20  tificate to use 
11d0: 69 6e 20 50 45 4d 20 66 6f 72 6d 61 74 0a 61 73  in PEM format.as
11e0: 20 74 68 65 20 6c 6f 63 61 6c 20 28 63 6c 69 65   the local (clie
11f0: 6e 74 20 6f 72 20 73 65 72 76 65 72 29 20 63 65  nt or server) ce
1200: 72 74 69 66 69 63 61 74 65 2e 20 49 74 20 61 6c  rtificate. It al
1210: 73 6f 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20  so contains the 
1220: 70 75 62 6c 69 63 20 6b 65 79 2e 0a 0a 5b 6f 70  public key...[op
1230: 74 5f 64 65 66 20 2d 63 65 72 74 20 5b 61 72 67  t_def -cert [arg
1240: 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66   string]].Specif
1250: 69 65 73 20 74 68 65 20 63 65 72 74 69 66 69 63  ies the certific
1260: 61 74 65 20 74 6f 20 75 73 65 20 61 73 20 61 20  ate to use as a 
1270: 44 45 52 20 65 6e 63 6f 64 65 64 20 73 74 72 69  DER encoded stri
1280: 6e 67 20 28 58 2e 35 30 39 20 44 45 52 29 2e 0a  ng (X.509 DER)..
1290: 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 69 70 68 65  .[opt_def -ciphe
12a0: 72 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a  r [arg string]].
12b0: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 6c 69  Specifies the li
12c0: 73 74 20 6f 66 20 63 69 70 68 65 72 73 20 74 6f  st of ciphers to
12d0: 20 75 73 65 20 66 6f 72 20 54 4c 53 20 31 2e 32   use for TLS 1.2
12e0: 20 61 6e 64 20 65 61 72 6c 69 65 72 20 63 6f 6e   and earlier con
12f0: 6e 65 63 74 69 6f 6e 73 2e 0a 53 74 72 69 6e 67  nections..String
1300: 20 69 73 20 61 20 63 6f 6c 6f 6e 20 22 5b 63 6f   is a colon "[co
1310: 6e 73 74 20 3a 5d 22 20 73 65 70 61 72 61 74 65  nst :]" separate
1320: 64 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72  d list of cipher
1330: 73 2e 0a 43 69 70 68 65 72 73 20 63 61 6e 20 62  s..Ciphers can b
1340: 65 20 63 6f 6d 62 69 6e 65 64 20 75 73 69 6e 67  e combined using
1350: 20 74 68 65 20 22 5b 63 6f 6e 73 74 20 2b 5d 22   the "[const +]"
1360: 20 63 68 61 72 61 63 74 65 72 2e 0a 50 72 65 66   character..Pref
1370: 69 78 65 73 20 63 61 6e 20 62 65 20 75 73 65 64  ixes can be used
1380: 20 74 6f 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20   to permanently 
1390: 72 65 6d 6f 76 65 20 22 5b 63 6f 6e 73 74 20 21  remove "[const !
13a0: 5d 22 2c 20 64 65 6c 65 74 65 20 22 5b 63 6f 6e  ]", delete "[con
13b0: 73 74 20 2d 5d 22 2c 20 6f 72 0a 6d 6f 76 65 20  st -]", or.move 
13c0: 74 6f 20 74 68 65 20 65 6e 64 20 22 5b 63 6f 6e  to the end "[con
13d0: 73 74 20 2b 5d 22 20 61 20 73 70 65 63 69 66 69  st +]" a specifi
13e0: 65 64 20 63 69 70 68 65 72 2e 0a 4b 65 79 77 6f  ed cipher..Keywo
13f0: 72 64 73 20 5b 63 6f 6e 73 74 20 40 53 54 52 45  rds [const @STRE
1400: 4e 47 54 48 5d 20 28 73 6f 72 74 20 62 79 20 61  NGTH] (sort by a
1410: 6c 67 6f 72 69 74 68 6d 20 6b 65 79 20 6c 65 6e  lgorithm key len
1420: 67 74 68 29 2c 0a 5b 63 6f 6e 73 74 20 40 53 45  gth),.[const @SE
1430: 43 4c 45 56 45 4c 3d 5d 5b 65 6d 70 68 20 6e 5d  CLEVEL=][emph n]
1440: 20 28 73 65 74 20 73 65 63 75 72 69 74 79 20 6c   (set security l
1450: 65 76 65 6c 20 74 6f 20 6e 29 2c 20 61 6e 64 0a  evel to n), and.
1460: 5b 63 6f 6e 73 74 20 44 45 46 41 55 4c 54 5d 20  [const DEFAULT] 
1470: 28 75 73 65 20 64 65 66 61 75 6c 74 20 63 69 70  (use default cip
1480: 68 65 72 20 6c 69 73 74 2c 20 61 74 20 73 74 61  her list, at sta
1490: 72 74 20 6f 6e 6c 79 29 20 63 61 6e 20 61 6c 73  rt only) can als
14a0: 6f 20 62 65 20 73 70 65 63 69 66 69 65 64 2e 0a  o be specified..
14b0: 53 65 65 20 74 68 65 20 5b 75 72 69 20 22 68 74  See the [uri "ht
14c0: 74 70 73 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73  tps://docs.opens
14d0: 73 6c 2e 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61  sl.org/master/ma
14e0: 6e 31 2f 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65  n1/openssl-ciphe
14f0: 72 73 2f 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65  rs/#options" Ope
1500: 6e 53 53 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74  nSSL].documentat
1510: 69 6f 6e 20 66 6f 72 20 74 68 65 20 66 75 6c 6c  ion for the full
1520: 20 6c 69 73 74 20 6f 66 20 76 61 6c 69 64 20 76   list of valid v
1530: 61 6c 75 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66  alues...[opt_def
1540: 20 2d 63 69 70 68 65 72 73 75 69 74 65 73 20 5b   -ciphersuites [
1550: 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65  arg string]].Spe
1560: 63 69 66 69 65 73 20 74 68 65 20 6c 69 73 74 20  cifies the list 
1570: 6f 66 20 63 69 70 68 65 72 20 73 75 69 74 65 73  of cipher suites
1580: 20 74 6f 20 75 73 65 20 66 6f 72 20 54 4c 53 20   to use for TLS 
1590: 31 2e 33 20 61 73 20 61 20 63 6f 6c 6f 6e 0a 22  1.3 as a colon."
15a0: 5b 63 6f 6e 73 74 20 3a 5d 22 20 73 65 70 61 72  [const :]" separ
15b0: 61 74 65 64 20 6c 69 73 74 20 6f 66 20 63 69 70  ated list of cip
15c0: 68 65 72 20 73 75 69 74 65 20 6e 61 6d 65 73 2e  her suite names.
15d0: 20 53 65 65 20 74 68 65 0a 5b 75 72 69 20 22 68   See the.[uri "h
15e0: 74 74 70 73 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e  ttps://docs.open
15f0: 73 73 6c 2e 6f 72 67 2f 6d 61 73 74 65 72 2f 6d  ssl.org/master/m
1600: 61 6e 31 2f 6f 70 65 6e 73 73 6c 2d 63 69 70 68  an1/openssl-ciph
1610: 65 72 73 2f 23 6f 70 74 69 6f 6e 73 22 20 4f 70  ers/#options" Op
1620: 65 6e 53 53 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61  enSSL].documenta
1630: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 66 75 6c  tion for the ful
1640: 6c 20 6c 69 73 74 20 6f 66 20 76 61 6c 69 64 20  l list of valid 
1650: 76 61 6c 75 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65  values...[opt_de
1660: 66 20 2d 63 6f 6d 6d 61 6e 64 20 5b 61 72 67 20  f -command [arg 
1670: 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69  callback]].Speci
1680: 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63  fies the callbac
1690: 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 62 65 20  k command to be 
16a0: 69 6e 76 6f 6b 65 64 20 61 74 20 73 65 76 65 72  invoked at sever
16b0: 61 6c 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67  al points during
16c0: 20 74 68 65 0a 68 61 6e 64 73 68 61 6b 65 20 74   the.handshake t
16d0: 6f 20 70 61 73 73 20 65 72 72 6f 72 73 2c 20 74  o pass errors, t
16e0: 72 61 63 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69  racing informati
16f0: 6f 6e 2c 20 61 6e 64 20 70 72 6f 74 6f 63 6f 6c  on, and protocol
1700: 20 6d 65 73 73 61 67 65 73 2e 0a 53 65 65 20 5b   messages..See [
1710: 73 65 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63  sectref "Callbac
1720: 6b 20 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20  k Options"] for 
1730: 6d 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74  more info...[opt
1740: 5f 64 65 66 20 2d 64 68 70 61 72 61 6d 73 20 5b  _def -dhparams [
1750: 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53  arg filename]].S
1760: 70 65 63 69 66 69 65 73 20 74 68 65 20 44 69 66  pecifies the Dif
1770: 66 69 65 2d 48 65 6c 6c 6d 61 6e 20 28 44 48 29  fie-Hellman (DH)
1780: 20 70 61 72 61 6d 65 74 65 72 73 20 66 69 6c 65   parameters file
1790: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 6b 65 79  ...[opt_def -key
17a0: 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61  file [arg filena
17b0: 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  me]].Specifies t
17c0: 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 66  he private key f
17d0: 69 6c 65 2e 20 54 68 65 20 64 65 66 61 75 6c 74  ile. The default
17e0: 20 69 73 20 74 6f 20 75 73 65 20 74 68 65 20 66   is to use the f
17f0: 69 6c 65 0a 73 70 65 63 69 66 69 65 64 20 62 79  ile.specified by
1800: 20 74 68 65 20 5b 61 72 67 20 2d 63 65 72 74 66   the [arg -certf
1810: 69 6c 65 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f  ile] option...[o
1820: 70 74 5f 64 65 66 20 2d 6b 65 79 20 5b 61 72 67  pt_def -key [arg
1830: 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66   string]].Specif
1840: 69 65 73 20 74 68 65 20 70 72 69 76 61 74 65 20  ies the private 
1850: 6b 65 79 20 74 6f 20 75 73 65 20 61 73 20 61 20  key to use as a 
1860: 44 45 52 20 65 6e 63 6f 64 65 64 20 73 74 72 69  DER encoded stri
1870: 6e 67 20 28 50 4b 43 53 23 31 20 44 45 52 29 2e  ng (PKCS#1 DER).
1880: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 6d 6f 64 65  ..[opt_def -mode
1890: 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d  l [arg channel]]
18a0: 0a 46 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e  .Force this chan
18b0: 6e 65 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65  nel to share the
18c0: 20 73 61 6d 65 20 5b 74 65 72 6d 20 53 53 4c 5f   same [term SSL_
18d0: 43 54 58 5d 20 73 74 72 75 63 74 75 72 65 20 61  CTX] structure a
18e0: 73 20 74 68 65 0a 73 70 65 63 69 66 69 65 64 20  s the.specified 
18f0: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2c 20 61  [arg channel], a
1900: 6e 64 20 74 68 65 72 65 66 6f 72 65 20 73 68 61  nd therefore sha
1910: 72 65 20 63 6f 6e 66 69 67 2c 20 63 61 6c 6c 62  re config, callb
1920: 61 63 6b 73 2c 20 65 74 63 2e 0a 0a 5b 6f 70 74  acks, etc...[opt
1930: 5f 64 65 66 20 2d 70 61 73 73 77 6f 72 64 20 5b  _def -password [
1940: 61 72 67 20 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53  arg callback]].S
1950: 70 65 63 69 66 69 65 73 20 74 68 65 20 63 61 6c  pecifies the cal
1960: 6c 62 61 63 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f  lback command to
1970: 20 69 6e 76 6f 6b 65 20 77 68 65 6e 20 4f 70 65   invoke when Ope
1980: 6e 53 53 4c 20 6e 65 65 64 73 20 74 6f 20 6f 62  nSSL needs to ob
1990: 74 61 69 6e 20 61 0a 70 61 73 73 77 6f 72 64 2e  tain a.password.
19a0: 20 54 68 69 73 20 69 73 20 74 79 70 69 63 61 6c   This is typical
19b0: 6c 79 20 75 73 65 64 20 74 6f 20 75 6e 6c 6f 63  ly used to unloc
19c0: 6b 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65  k the private ke
19d0: 79 20 6f 66 20 61 20 63 65 72 74 69 66 69 63 61  y of a certifica
19e0: 74 65 2e 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b  te..The callback
19f0: 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61   should return a
1a00: 20 70 61 73 73 77 6f 72 64 20 73 74 72 69 6e 67   password string
1a10: 2e 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22  . See [sectref "
1a20: 43 61 6c 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73  Callback Options
1a30: 22 5d 0a 66 6f 72 20 6d 6f 72 65 20 69 6e 66 6f  "].for more info
1a40: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 70 6f 73  ...[opt_def -pos
1a50: 74 5f 68 61 6e 64 73 68 61 6b 65 20 5b 61 72 67  t_handshake [arg
1a60: 20 62 6f 6f 6c 5d 5d 0a 41 6c 6c 6f 77 20 70 6f   bool]].Allow po
1a70: 73 74 2d 68 61 6e 64 73 68 61 6b 65 20 73 65 73  st-handshake ses
1a80: 73 69 6f 6e 20 74 69 63 6b 65 74 20 75 70 64 61  sion ticket upda
1a90: 74 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  tes...[opt_def -
1aa0: 72 65 71 75 65 73 74 20 5b 61 72 67 20 62 6f 6f  request [arg boo
1ab0: 6c 5d 5d 0a 52 65 71 75 65 73 74 20 61 20 63 65  l]].Request a ce
1ac0: 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 74  rtificate from t
1ad0: 68 65 20 70 65 65 72 20 64 75 72 69 6e 67 20 74  he peer during t
1ae0: 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65  he SSL handshake
1af0: 2e 20 54 68 69 73 20 69 73 20 6e 65 65 64 65 64  . This is needed
1b00: 0a 74 6f 20 64 6f 20 43 65 72 74 69 66 69 63 61  .to do Certifica
1b10: 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 2e 20 53  te Validation. S
1b20: 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c  tarting in TclTL
1b30: 53 20 31 2e 38 2c 20 74 68 65 20 64 65 66 61 75  S 1.8, the defau
1b40: 6c 74 20 69 73 0a 5b 63 6f 6e 73 74 20 74 72 75  lt is.[const tru
1b50: 65 5d 2e 0a 53 65 65 20 5b 73 65 63 74 72 65 66  e]..See [sectref
1b60: 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61   "Certificate Va
1b70: 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d  lidation"] for m
1b80: 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f  ore details...[o
1b90: 70 74 5f 64 65 66 20 2d 72 65 71 75 69 72 65 20  pt_def -require 
1ba0: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75  [arg bool]].Requ
1bb0: 69 72 65 20 61 20 76 61 6c 69 64 20 63 65 72 74  ire a valid cert
1bc0: 69 66 69 63 61 74 65 20 66 72 6f 6d 20 74 68 65  ificate from the
1bd0: 20 70 65 65 72 20 64 75 72 69 6e 67 20 74 68 65   peer during the
1be0: 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20   SSL handshake. 
1bf0: 49 66 20 74 68 69 73 20 69 73 0a 73 65 74 20 74  If this is.set t
1c00: 6f 20 74 72 75 65 2c 20 74 68 65 6e 20 5b 6f 70  o true, then [op
1c10: 74 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 6d  tion -request] m
1c20: 75 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74 20  ust also be set 
1c30: 74 6f 20 74 72 75 65 20 61 6e 64 20 61 20 65 69  to true and a ei
1c40: 74 68 65 72 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61  ther.[option -ca
1c50: 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63  dir], [option -c
1c60: 61 66 69 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20  afile], [option 
1c70: 2d 63 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20  -castore], or a 
1c80: 70 6c 61 74 66 6f 72 6d 20 64 65 66 61 75 6c 74  platform default
1c90: 0a 6d 75 73 74 20 62 65 20 70 72 6f 76 69 64 65  .must be provide
1ca0: 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 76 61  d in order to va
1cb0: 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20  lidate against. 
1cc0: 54 68 65 20 64 65 66 61 75 6c 74 20 69 6e 20 54  The default in T
1cd0: 63 6c 54 4c 53 20 31 2e 38 20 61 6e 64 0a 65 61  clTLS 1.8 and.ea
1ce0: 72 6c 69 65 72 20 76 65 72 73 69 6f 6e 73 20 69  rlier versions i
1cf0: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20  s [const false] 
1d00: 73 69 6e 63 65 20 6e 6f 74 20 61 6c 6c 20 70 6c  since not all pl
1d10: 61 74 66 6f 72 6d 73 20 68 61 76 65 20 63 65 72  atforms have cer
1d20: 74 69 66 69 63 61 74 65 73 20 74 6f 0a 76 61 6c  tificates to.val
1d30: 69 64 61 74 65 20 61 67 61 69 6e 73 74 20 69 6e  idate against in
1d40: 20 61 20 66 6f 72 6d 20 63 6f 6d 70 61 74 69 62   a form compatib
1d50: 6c 65 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 2e  le with OpenSSL.
1d60: 0a 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43  .See [sectref "C
1d70: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
1d80: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65  ation"] for more
1d90: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f   details...[opt_
1da0: 64 65 66 20 2d 73 65 63 75 72 69 74 79 5f 6c 65  def -security_le
1db0: 76 65 6c 20 5b 61 72 67 20 69 6e 74 65 67 65 72  vel [arg integer
1dc0: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
1dd0: 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20   security level 
1de0: 28 76 61 6c 75 65 20 66 72 6f 6d 20 30 20 74 6f  (value from 0 to
1df0: 20 35 29 2e 20 54 68 65 20 73 65 63 75 72 69 74   5). The securit
1e00: 79 20 6c 65 76 65 6c 20 61 66 66 65 63 74 73 0a  y level affects.
1e10: 74 68 65 20 61 6c 6c 6f 77 65 64 20 63 69 70 68  the allowed ciph
1e20: 65 72 20 73 75 69 74 65 20 65 6e 63 72 79 70 74  er suite encrypt
1e30: 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 73 2c 20  ion algorithms, 
1e40: 73 75 70 70 6f 72 74 65 64 20 45 43 43 20 63 75  supported ECC cu
1e50: 72 76 65 73 2c 0a 73 75 70 70 6f 72 74 65 64 20  rves,.supported 
1e60: 73 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72 69  signature algori
1e70: 74 68 6d 73 2c 20 44 48 20 70 61 72 61 6d 65 74  thms, DH paramet
1e80: 65 72 20 73 69 7a 65 73 2c 20 63 65 72 74 69 66  er sizes, certif
1e90: 69 63 61 74 65 20 6b 65 79 20 73 69 7a 65 73 0a  icate key sizes.
1ea0: 61 6e 64 20 73 69 67 6e 61 74 75 72 65 20 61 6c  and signature al
1eb0: 67 6f 72 69 74 68 6d 73 2e 20 54 68 65 20 64 65  gorithms. The de
1ec0: 66 61 75 6c 74 20 69 73 20 31 20 70 72 69 6f 72  fault is 1 prior
1ed0: 20 74 6f 20 4f 70 65 6e 53 53 4c 20 33 2e 32 20   to OpenSSL 3.2 
1ee0: 61 6e 64 20 32 0a 74 68 65 72 65 61 66 74 65 72  and 2.thereafter
1ef0: 2e 20 4c 65 76 65 6c 20 33 20 61 6e 64 20 68 69  . Level 3 and hi
1f00: 67 68 65 72 20 64 69 73 61 62 6c 65 20 73 75 70  gher disable sup
1f10: 70 6f 72 74 20 66 6f 72 20 73 65 73 73 69 6f 6e  port for session
1f20: 20 74 69 63 6b 65 74 73 20 61 6e 64 0a 6f 6e 6c   tickets and.onl
1f30: 79 20 61 63 63 65 70 74 20 63 69 70 68 65 72 20  y accept cipher 
1f40: 73 75 69 74 65 73 20 74 68 61 74 20 70 72 6f 76  suites that prov
1f50: 69 64 65 20 66 6f 72 77 61 72 64 20 73 65 63 72  ide forward secr
1f60: 65 63 79 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ecy...[opt_def -
1f70: 73 65 72 76 65 72 20 5b 61 72 67 20 62 6f 6f 6c  server [arg bool
1f80: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 77 68 65  ]].Specifies whe
1f90: 74 68 65 72 20 74 6f 20 61 63 74 20 61 73 20 61  ther to act as a
1fa0: 20 73 65 72 76 65 72 20 61 6e 64 20 72 65 73 70   server and resp
1fb0: 6f 6e 64 20 77 69 74 68 20 61 20 73 65 72 76 65  ond with a serve
1fc0: 72 20 68 61 6e 64 73 68 61 6b 65 20 77 68 65 6e  r handshake when
1fd0: 20 61 0a 63 6c 69 65 6e 74 20 63 6f 6e 6e 65 63   a.client connec
1fe0: 74 73 20 61 6e 64 20 70 72 6f 76 69 64 65 73 20  ts and provides 
1ff0: 61 20 63 6c 69 65 6e 74 20 68 61 6e 64 73 68 61  a client handsha
2000: 6b 65 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  ke. The default 
2010: 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d  is [const false]
2020: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 72  ...[opt_def -ser
2030: 76 65 72 6e 61 6d 65 20 5b 61 72 67 20 68 6f 73  vername [arg hos
2040: 74 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66 79 20  tname]].Specify 
2050: 74 68 65 20 70 65 65 72 27 73 20 68 6f 73 74 6e  the peer's hostn
2060: 61 6d 65 2e 20 54 68 69 73 20 69 73 20 75 73 65  ame. This is use
2070: 64 20 74 6f 20 73 65 74 20 74 68 65 20 54 4c 53  d to set the TLS
2080: 20 53 65 72 76 65 72 20 4e 61 6d 65 0a 49 6e 64   Server Name.Ind
2090: 69 63 61 74 69 6f 6e 20 28 53 4e 49 29 20 65 78  ication (SNI) ex
20a0: 74 65 6e 73 69 6f 6e 2e 20 53 65 74 20 74 68 69  tension. Set thi
20b0: 73 20 74 6f 20 74 68 65 20 65 78 70 65 63 74 65  s to the expecte
20c0: 64 20 73 65 72 76 65 72 6e 61 6d 65 20 69 6e 20  d servername in 
20d0: 74 68 65 0a 73 65 72 76 65 72 27 73 20 63 65 72  the.server's cer
20e0: 74 69 66 69 63 61 74 65 20 6f 72 20 6f 6e 65 20  tificate or one 
20f0: 6f 66 20 74 68 65 20 53 75 62 6a 65 63 74 20 41  of the Subject A
2100: 6c 74 65 72 6e 61 74 65 20 4e 61 6d 65 73 20 28  lternate Names (
2110: 53 41 4e 29 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  SAN)...[opt_def 
2120: 2d 73 65 73 73 69 6f 6e 5f 69 64 20 5b 61 72 67  -session_id [arg
2130: 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 5d   binary_string]]
2140: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 73  .Specifies the s
2150: 65 73 73 69 6f 6e 20 69 64 20 74 6f 20 72 65 73  ession id to res
2160: 75 6d 65 20 61 20 73 65 73 73 69 6f 6e 2e 20 4e  ume a session. N
2170: 6f 74 20 73 75 70 70 6f 72 74 65 64 20 79 65 74  ot supported yet
2180: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73 6c  ...[opt_def -ssl
2190: 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e  2 [arg bool]].En
21a0: 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20  able use of SSL 
21b0: 76 32 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  v2. The default 
21c0: 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d  is [const false]
21d0: 2e 20 4e 6f 74 65 3a 20 52 65 63 65 6e 74 20 76  . Note: Recent v
21e0: 65 72 73 69 6f 6e 73 20 6f 66 0a 4f 70 65 6e 53  ersions of.OpenS
21f0: 53 4c 20 6e 6f 20 6c 6f 6e 67 65 72 20 73 75 70  SL no longer sup
2200: 70 6f 72 74 20 53 53 4c 76 32 2c 20 73 6f 20 74  port SSLv2, so t
2210: 68 69 73 20 6d 61 79 20 6e 6f 74 20 68 61 76 65  his may not have
2220: 20 61 6e 79 20 65 66 66 65 63 74 2e 20 53 65 65   any effect. See
2230: 20 74 68 65 0a 5b 63 6d 64 20 74 6c 73 3a 3a 70   the.[cmd tls::p
2240: 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e  rotocols] comman
2250: 64 20 66 6f 72 20 73 75 70 70 6f 72 74 65 64 20  d for supported 
2260: 70 72 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74  protocols...[opt
2270: 5f 64 65 66 20 2d 73 73 6c 33 20 5b 61 72 67 20  _def -ssl3 [arg 
2280: 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73  bool]].Enable us
2290: 65 20 6f 66 20 53 53 4c 20 76 33 2e 20 54 68 65  e of SSL v3. The
22a0: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
22b0: 73 74 20 66 61 6c 73 65 5d 2e 20 4e 6f 74 65 3a  st false]. Note:
22c0: 20 52 65 63 65 6e 74 20 76 65 72 73 69 6f 6e 73   Recent versions
22d0: 0a 6f 66 20 4f 70 65 6e 53 53 4c 20 6d 61 79 20  .of OpenSSL may 
22e0: 68 61 76 65 20 74 68 69 73 20 64 69 73 61 62 6c  have this disabl
22f0: 65 64 20 61 74 20 63 6f 6d 70 69 6c 65 20 74 69  ed at compile ti
2300: 6d 65 2c 20 73 6f 20 74 68 69 73 20 6d 61 79 20  me, so this may 
2310: 6e 6f 74 20 68 61 76 65 20 61 6e 79 0a 65 66 66  not have any.eff
2320: 65 63 74 2e 20 53 65 65 20 74 68 65 20 5b 63 6d  ect. See the [cm
2330: 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73  d tls::protocols
2340: 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75  ] command for su
2350: 70 70 6f 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c  pported protocol
2360: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c  s...[opt_def -tl
2370: 73 31 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45  s1 [arg bool]].E
2380: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53  nable use of TLS
2390: 20 76 31 2e 20 54 68 65 20 64 65 66 61 75 6c 74   v1. The default
23a0: 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d   is [const true]
23b0: 2e 20 4e 6f 74 65 3a 20 54 4c 53 20 31 2e 30 20  . Note: TLS 1.0 
23c0: 6e 65 65 64 73 0a 53 48 41 31 20 74 6f 20 6f 70  needs.SHA1 to op
23d0: 65 72 61 74 65 2c 20 77 68 69 63 68 20 69 73 20  erate, which is 
23e0: 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 69  only available i
23f0: 6e 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c  n security level
2400: 20 30 20 66 6f 72 20 4f 70 65 6e 20 53 53 4c 20   0 for Open SSL 
2410: 33 2e 30 2b 2e 0a 53 65 65 20 74 68 65 20 5b 61  3.0+..See the [a
2420: 72 67 20 2d 73 65 63 75 72 69 74 79 5f 6c 65 76  rg -security_lev
2430: 65 6c 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70  el] option...[op
2440: 74 5f 64 65 66 20 2d 74 6c 73 31 2e 31 20 5b 61  t_def -tls1.1 [a
2450: 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65  rg bool]].Enable
2460: 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 31   use of TLS v1.1
2470: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
2480: 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 4e   [const true]. N
2490: 6f 74 65 3a 20 54 4c 53 20 31 2e 31 20 6e 65 65  ote: TLS 1.1 nee
24a0: 64 73 0a 53 48 41 31 20 74 6f 20 6f 70 65 72 61  ds.SHA1 to opera
24b0: 74 65 2c 20 77 68 69 63 68 20 69 73 20 6f 6e 6c  te, which is onl
24c0: 79 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 73  y available in s
24d0: 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20 30 20  ecurity level 0 
24e0: 66 6f 72 20 4f 70 65 6e 20 53 53 4c 20 33 2e 30  for Open SSL 3.0
24f0: 2b 2e 0a 53 65 65 20 74 68 65 20 5b 61 72 67 20  +..See the [arg 
2500: 2d 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d  -security_level]
2510: 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64   option...[opt_d
2520: 65 66 20 2d 74 6c 73 31 2e 32 20 5b 61 72 67 20  ef -tls1.2 [arg 
2530: 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73  bool]].Enable us
2540: 65 20 6f 66 20 54 4c 53 20 76 31 2e 32 2e 20 54  e of TLS v1.2. T
2550: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63  he default is [c
2560: 6f 6e 73 74 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70  onst true]...[op
2570: 74 5f 64 65 66 20 2d 74 6c 73 31 2e 33 20 5b 61  t_def -tls1.3 [a
2580: 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65  rg bool]].Enable
2590: 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 33   use of TLS v1.3
25a0: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
25b0: 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 0a 0a   [const true]...
25c0: 5b 6f 70 74 5f 64 65 66 20 2d 76 61 6c 69 64 61  [opt_def -valida
25d0: 74 65 63 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63  tecommand [arg c
25e0: 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66  allback]].Specif
25f0: 69 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63 6b  ies the callback
2600: 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e 76 6f   command to invo
2610: 6b 65 20 74 6f 20 76 61 6c 69 64 61 74 65 20 74  ke to validate t
2620: 68 65 20 70 65 65 72 20 63 65 72 74 69 66 69 63  he peer certific
2630: 61 74 65 73 0a 61 6e 64 20 6f 74 68 65 72 20 63  ates.and other c
2640: 6f 6e 66 69 67 20 69 6e 66 6f 20 64 75 72 69 6e  onfig info durin
2650: 67 20 74 68 65 20 70 72 6f 74 6f 63 6f 6c 20 6e  g the protocol n
2660: 65 67 6f 74 69 61 74 69 6f 6e 20 70 68 61 73 65  egotiation phase
2670: 2e 20 54 68 69 73 20 63 61 6e 20 62 65 20 75 73  . This can be us
2680: 65 64 0a 62 79 20 54 43 4c 20 73 63 72 69 70 74  ed.by TCL script
2690: 73 20 74 6f 20 70 65 72 66 6f 72 6d 20 74 68 65  s to perform the
26a0: 69 72 20 6f 77 6e 20 43 65 72 74 69 66 69 63 61  ir own Certifica
26b0: 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 20 74 6f  te Validation to
26c0: 20 73 75 70 70 6c 65 6d 65 6e 74 20 74 68 65 0a   supplement the.
26d0: 64 65 66 61 75 6c 74 20 76 61 6c 69 64 61 74 69  default validati
26e0: 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 4f  on provided by O
26f0: 70 65 6e 53 53 4c 2e 20 54 68 65 20 73 63 72 69  penSSL. The scri
2700: 70 74 20 6d 75 73 74 20 72 65 74 75 72 6e 20 61  pt must return a
2710: 20 62 6f 6f 6c 65 61 6e 20 74 72 75 65 0a 74 6f   boolean true.to
2720: 20 63 6f 6e 74 69 6e 75 65 20 74 68 65 20 6e 65   continue the ne
2730: 67 6f 74 69 61 74 69 6f 6e 2e 20 53 65 65 20 5b  gotiation. See [
2740: 73 65 63 74 72 65 66 20 22 43 61 6c 6c 62 61 63  sectref "Callbac
2750: 6b 20 4f 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20  k Options"] for 
2760: 6d 6f 72 65 20 69 6e 66 6f 2e 0a 0a 5b 6c 69 73  more info...[lis
2770: 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63  t_end]..[call [c
2780: 6d 64 20 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74  md tls::unimport
2790: 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d  ] [arg channel]]
27a0: 0a 0a 43 6f 6d 70 6c 69 6d 65 6e 74 20 74 6f 20  ..Compliment to 
27b0: 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74  [cmd tls::import
27c0: 5d 2e 20 55 73 65 64 20 74 6f 20 72 65 6d 6f 76  ]. Used to remov
27d0: 65 20 74 68 65 20 74 6f 70 20 6c 65 76 65 6c 20  e the top level 
27e0: 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 0a  stacked channel.
27f0: 66 72 6f 6d 20 5b 61 72 67 20 63 68 61 6e 6e 65  from [arg channe
2800: 6c 5d 2e 20 54 68 69 73 20 75 6e 73 74 61 63 6b  l]. This unstack
2810: 73 20 74 68 65 20 65 6e 63 72 79 70 74 69 6f 6e  s the encryption
2820: 20 6f 66 20 61 20 72 65 67 75 6c 61 72 20 54 43   of a regular TC
2830: 4c 20 63 68 61 6e 6e 65 6c 2e 20 41 6e 0a 65 72  L channel. An.er
2840: 72 6f 72 20 69 73 20 74 68 72 6f 77 6e 20 69 66  ror is thrown if
2850: 20 54 4c 53 20 69 73 20 6e 6f 74 20 74 68 65 20   TLS is not the 
2860: 74 6f 70 20 73 74 61 63 6b 65 64 20 63 68 61 6e  top stacked chan
2870: 6e 65 6c 20 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c  nel type...[call
2880: 20 5b 63 6d 64 20 74 6c 73 3a 3a 68 61 6e 64 73   [cmd tls::hands
2890: 68 61 6b 65 5d 20 5b 61 72 67 20 63 68 61 6e 6e  hake] [arg chann
28a0: 65 6c 5d 5d 0a 0a 46 6f 72 63 65 73 20 74 68 65  el]]..Forces the
28b0: 20 54 4c 53 20 6e 65 67 6f 74 69 61 74 69 6f 6e   TLS negotiation
28c0: 20 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 74 61   handshake to ta
28d0: 6b 65 20 70 6c 61 63 65 20 69 6d 6d 65 64 69 61  ke place immedia
28e0: 74 65 6c 79 2c 20 61 6e 64 20 72 65 74 75 72 6e  tely, and return
28f0: 73 20 30 0a 69 66 20 68 61 6e 64 73 68 61 6b 65  s 0.if handshake
2900: 20 69 73 20 73 74 69 6c 6c 20 69 6e 20 70 72 6f   is still in pro
2910: 67 72 65 73 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b  gress (non-block
2920: 69 6e 67 29 2c 20 6f 72 20 31 20 69 66 20 74 68  ing), or 1 if th
2930: 65 20 68 61 6e 64 73 68 61 6b 65 20 77 61 73 0a  e handshake was.
2940: 73 75 63 63 65 73 73 66 75 6c 2e 20 49 66 20 74  successful. If t
2950: 68 65 20 68 61 6e 64 73 68 61 6b 65 20 66 61 69  he handshake fai
2960: 6c 65 64 2c 20 61 6e 20 65 72 72 6f 72 20 77 69  led, an error wi
2970: 6c 6c 20 62 65 20 72 65 74 75 72 6e 65 64 2e 0a  ll be returned..
2980: 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a  .[call [cmd tls:
2990: 3a 73 74 61 74 75 73 5d 20 5b 6f 70 74 20 5b 6f  :status] [opt [o
29a0: 70 74 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 5d 20 5b  ption -local]] [
29b0: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52  arg channel]]..R
29c0: 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65  eturns the curre
29d0: 6e 74 20 73 74 61 74 75 73 20 6f 66 20 61 6e 20  nt status of an 
29e0: 53 53 4c 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65  SSL channel. The
29f0: 20 72 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73   result is a lis
2a00: 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 0a 70  t of key-value.p
2a10: 61 69 72 73 20 64 65 73 63 72 69 62 69 6e 67 20  airs describing 
2a20: 74 68 65 20 53 53 4c 2c 20 63 65 72 74 69 66 69  the SSL, certifi
2a30: 63 61 74 65 2c 20 61 6e 64 20 63 65 72 74 69 66  cate, and certif
2a40: 69 63 61 74 65 20 76 65 72 69 66 69 63 61 74 69  icate verificati
2a50: 6f 6e 20 73 74 61 74 75 73 2e 20 49 66 0a 74 68  on status. If.th
2a60: 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 20  e SSL handshake 
2a70: 68 61 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70  has not yet comp
2a80: 6c 65 74 65 64 2c 20 61 6e 20 65 6d 70 74 79 20  leted, an empty 
2a90: 6c 69 73 74 20 69 73 20 72 65 74 75 72 6e 65 64  list is returned
2aa0: 2e 20 49 66 20 74 68 65 0a 5b 6f 70 74 69 6f 6e  . If the.[option
2ab0: 20 2d 6c 6f 63 61 6c 5d 20 6f 70 74 69 6f 6e 20   -local] option 
2ac0: 69 73 20 73 70 65 63 69 66 69 65 64 2c 20 74 68  is specified, th
2ad0: 65 6e 20 74 68 65 20 6c 6f 63 61 6c 20 63 65 72  en the local cer
2ae0: 74 69 66 69 63 61 74 65 20 69 73 20 75 73 65 64  tificate is used
2af0: 2e 20 52 65 74 75 72 6e 65 64 0a 76 61 6c 75 65  . Returned.value
2b00: 73 20 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72  s include:..[par
2b10: 61 5d 0a 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a  a]..SSL Status..
2b20: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
2b30: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22  nitions]..[def "
2b40: 5b 76 61 72 20 61 6c 70 6e 5d 20 5b 61 72 67 20  [var alpn] [arg 
2b50: 70 72 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20  protocol]"].The 
2b60: 70 72 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65  protocol selecte
2b70: 64 20 61 66 74 65 72 20 41 70 70 6c 69 63 61 74  d after Applicat
2b80: 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63  ion-Layer Protoc
2b90: 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e 20 28  ol Negotiation (
2ba0: 41 4c 50 4e 29 2e 0a 0a 5b 64 65 66 20 22 5b 76  ALPN)...[def "[v
2bb0: 61 72 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20  ar cipher] [arg 
2bc0: 63 69 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75  cipher]"].The cu
2bd0: 72 72 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20  rrent cipher in 
2be0: 75 73 65 20 66 6f 72 20 74 68 65 20 73 65 73 73  use for the sess
2bf0: 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ion...[def "[var
2c00: 20 70 65 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20   peername] [arg 
2c10: 6e 61 6d 65 5d 22 5d 0a 54 68 65 20 70 65 65 72  name]"].The peer
2c20: 6e 61 6d 65 20 66 72 6f 6d 20 74 68 65 20 63 65  name from the ce
2c30: 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65 66  rtificate...[def
2c40: 20 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d   "[var protocol]
2c50: 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d   [arg version]"]
2c60: 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65  .The protocol ve
2c70: 72 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74  rsion used for t
2c80: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53  he connection: S
2c90: 53 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c  SL2, SSL3, TLS1,
2ca0: 20 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c   TLS1.1, TLS1.2,
2cb0: 20 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e   TLS1.3, or unkn
2cc0: 6f 77 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  own...[def "[var
2cd0: 20 73 62 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22   sbits] [arg n]"
2ce0: 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20  ].The number of 
2cf0: 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 74 68  bits used for th
2d00: 65 20 73 65 73 73 69 6f 6e 20 6b 65 79 2e 0a 0a  e session key...
2d10: 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61  [def "[var signa
2d20: 74 75 72 65 48 61 73 68 41 6c 67 6f 72 69 74 68  tureHashAlgorith
2d30: 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68  m] [arg algorith
2d40: 6d 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61 74 75  m]"].The signatu
2d50: 72 65 20 68 61 73 68 20 61 6c 67 6f 72 69 74 68  re hash algorith
2d60: 6d 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  m...[def "[var s
2d70: 69 67 6e 61 74 75 72 65 54 79 70 65 5d 20 5b 61  ignatureType] [a
2d80: 72 67 20 74 79 70 65 5d 22 5d 0a 54 68 65 20 73  rg type]"].The s
2d90: 69 67 6e 61 74 75 72 65 20 74 79 70 65 20 76 61  ignature type va
2da0: 6c 75 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  lue...[def "[var
2db0: 20 76 65 72 69 66 79 44 65 70 74 68 5d 20 5b 61   verifyDepth] [a
2dc0: 72 67 20 6e 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20  rg n]"].Maximum 
2dd0: 64 65 70 74 68 20 66 6f 72 20 74 68 65 20 63 65  depth for the ce
2de0: 72 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 20  rtificate chain 
2df0: 76 65 72 69 66 69 63 61 74 69 6f 6e 2e 20 44 65  verification. De
2e00: 66 61 75 6c 74 20 69 73 20 2d 31 2c 20 74 6f 20  fault is -1, to 
2e10: 63 68 65 63 6b 20 61 6c 6c 2e 0a 0a 5b 64 65 66  check all...[def
2e20: 20 22 5b 76 61 72 20 76 65 72 69 66 79 4d 6f 64   "[var verifyMod
2e30: 65 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a  e] [arg list]"].
2e40: 4c 69 73 74 20 6f 66 20 63 65 72 74 69 66 69 63  List of certific
2e50: 61 74 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e  ate verification
2e60: 20 6d 6f 64 65 73 2e 0a 0a 5b 64 65 66 20 22 5b   modes...[def "[
2e70: 76 61 72 20 76 65 72 69 66 79 52 65 73 75 6c 74  var verifyResult
2e80: 5d 20 5b 61 72 67 20 72 65 73 75 6c 74 5d 22 5d  ] [arg result]"]
2e90: 0a 43 65 72 74 69 66 69 63 61 74 65 20 76 65 72  .Certificate ver
2ea0: 69 66 69 63 61 74 69 6f 6e 20 72 65 73 75 6c 74  ification result
2eb0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 61  ...[def "[var ca
2ec0: 5f 6e 61 6d 65 73 5d 20 5b 61 72 67 20 6c 69 73  _names] [arg lis
2ed0: 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 74 68 65  t]"].List of the
2ee0: 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75 74   Certificate Aut
2ef0: 68 6f 72 69 74 69 65 73 20 75 73 65 64 20 74 6f  horities used to
2f00: 20 63 72 65 61 74 65 20 74 68 65 20 63 65 72 74   create the cert
2f10: 69 66 69 63 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f  ificate...[list_
2f20: 65 6e 64 5d 0a 0a 43 65 72 74 69 66 69 63 61 74  end]..Certificat
2f30: 65 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f  e Status..[list_
2f40: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
2f50: 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  s]..[def "[var a
2f60: 6c 6c 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  ll] [arg string]
2f70: 22 5d 0a 44 75 6d 70 20 6f 66 20 61 6c 6c 20 63  "].Dump of all c
2f80: 65 72 74 69 66 69 63 61 74 65 20 69 6e 66 6f 2e  ertificate info.
2f90: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72  ..[def "[var ver
2fa0: 73 69 6f 6e 5d 20 5b 61 72 67 20 76 61 6c 75 65  sion] [arg value
2fb0: 5d 22 5d 0a 54 68 65 20 63 65 72 74 69 66 69 63  ]"].The certific
2fc0: 61 74 65 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64  ate version...[d
2fd0: 65 66 20 22 5b 76 61 72 20 73 65 72 69 61 6c 4e  ef "[var serialN
2fe0: 75 6d 62 65 72 5d 20 5b 61 72 67 20 73 74 72 69  umber] [arg stri
2ff0: 6e 67 5d 22 5d 0a 54 68 65 20 73 65 72 69 61 6c  ng]"].The serial
3000: 20 6e 75 6d 62 65 72 20 6f 66 20 74 68 65 20 63   number of the c
3010: 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61 20  ertificate as a 
3020: 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65  hex string...[de
3030: 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72  f "[var signatur
3040: 65 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74 68  e] [arg algorith
3050: 6d 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c 67 6f  m]"].Cipher algo
3060: 72 69 74 68 6d 20 75 73 65 64 20 66 6f 72 20 63  rithm used for c
3070: 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61  ertificate signa
3080: 74 75 72 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  ture...[def "[va
3090: 72 20 69 73 73 75 65 72 5d 20 5b 61 72 67 20 73  r issuer] [arg s
30a0: 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73  tring]"].The dis
30b0: 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d 65 20  tinguished name 
30c0: 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65 72 74  (DN) of the cert
30d0: 69 66 69 63 61 74 65 20 69 73 73 75 65 72 2e 0a  ificate issuer..
30e0: 0a 5b 64 65 66 20 22 5b 76 61 72 20 6e 6f 74 42  .[def "[var notB
30f0: 65 66 6f 72 65 5d 20 5b 61 72 67 20 64 61 74 65  efore] [arg date
3100: 5d 22 5d 0a 54 68 65 20 62 65 67 69 6e 6e 69 6e  ]"].The beginnin
3110: 67 20 64 61 74 65 20 6f 66 20 74 68 65 20 63 65  g date of the ce
3120: 72 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 69  rtificate validi
3130: 74 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ty...[def "[var 
3140: 6e 6f 74 41 66 74 65 72 5d 20 5b 61 72 67 20 64  notAfter] [arg d
3150: 61 74 65 5d 22 5d 0a 54 68 65 20 65 78 70 69 72  ate]"].The expir
3160: 61 74 69 6f 6e 20 64 61 74 65 20 6f 66 20 74 68  ation date of th
3170: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 76 61  e certificate va
3180: 6c 69 64 69 74 79 2e 0a 0a 5b 64 65 66 20 22 5b  lidity...[def "[
3190: 76 61 72 20 73 75 62 6a 65 63 74 5d 20 5b 61 72  var subject] [ar
31a0: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20  g string]"].The 
31b0: 64 69 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61  distinguished na
31c0: 6d 65 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63  me (DN) of the c
31d0: 65 72 74 69 66 69 63 61 74 65 20 73 75 62 6a 65  ertificate subje
31e0: 63 74 2e 20 46 69 65 6c 64 73 20 69 6e 63 6c 75  ct. Fields inclu
31f0: 64 65 3a 20 43 6f 6d 6d 6f 6e 0a 4e 61 6d 65 20  de: Common.Name 
3200: 28 43 4e 29 2c 20 4f 72 67 61 6e 69 7a 61 74 69  (CN), Organizati
3210: 6f 6e 20 28 4f 29 2c 20 4c 6f 63 61 6c 69 74 79  on (O), Locality
3220: 20 6f 72 20 43 69 74 79 20 28 4c 29 2c 20 53 74   or City (L), St
3230: 61 74 65 20 6f 72 20 50 72 6f 76 69 6e 63 65 20  ate or Province 
3240: 28 53 29 2c 20 61 6e 64 0a 43 6f 75 6e 74 72 79  (S), and.Country
3250: 20 4e 61 6d 65 20 28 43 29 2e 0a 0a 5b 64 65 66   Name (C)...[def
3260: 20 22 5b 76 61 72 20 69 73 73 75 65 72 55 6e 69   "[var issuerUni
3270: 71 75 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69  queID] [arg stri
3280: 6e 67 5d 22 5d 0a 54 68 65 20 69 73 73 75 65 72  ng]"].The issuer
3290: 20 75 6e 69 71 75 65 20 69 64 2e 0a 0a 5b 64 65   unique id...[de
32a0: 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63 74 55  f "[var subjectU
32b0: 6e 69 71 75 65 49 44 5d 20 5b 61 72 67 20 73 74  niqueID] [arg st
32c0: 72 69 6e 67 5d 22 5d 0a 54 68 65 20 73 75 62 6a  ring]"].The subj
32d0: 65 63 74 20 75 6e 69 71 75 65 20 69 64 2e 0a 0a  ect unique id...
32e0: 5b 64 65 66 20 22 5b 76 61 72 20 6e 75 6d 5f 65  [def "[var num_e
32f0: 78 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20  xtensions] [arg 
3300: 6e 5d 22 5d 0a 4e 75 6d 62 65 72 20 6f 66 20 63  n]"].Number of c
3310: 65 72 74 69 66 69 63 61 74 65 20 65 78 74 65 6e  ertificate exten
3320: 73 69 6f 6e 73 2e 0a 0a 5b 64 65 66 20 22 5b 76  sions...[def "[v
3330: 61 72 20 65 78 74 65 6e 73 69 6f 6e 73 5d 20 5b  ar extensions] [
3340: 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74  arg list]"].List
3350: 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 20   of certificate 
3360: 65 78 74 65 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e  extension names.
3370: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 75 74  ..[def "[var aut
3380: 68 6f 72 69 74 79 4b 65 79 49 64 65 6e 74 69 66  horityKeyIdentif
3390: 69 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  ier] [arg string
33a0: 5d 22 5d 0a 41 75 74 68 6f 72 69 74 79 20 4b 65  ]"].Authority Ke
33b0: 79 20 49 64 65 6e 74 69 66 69 65 72 20 28 41 4b  y Identifier (AK
33c0: 49 29 20 6f 66 20 74 68 65 20 49 73 73 75 69 6e  I) of the Issuin
33d0: 67 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65  g CA certificate
33e0: 20 74 68 61 74 20 73 69 67 6e 65 64 20 74 68 65   that signed the
33f0: 0a 53 53 4c 20 63 65 72 74 69 66 69 63 61 74 65  .SSL certificate
3400: 20 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67   as a hex string
3410: 2e 20 54 68 69 73 20 76 61 6c 75 65 20 6d 61 74  . This value mat
3420: 63 68 65 73 20 74 68 65 20 53 4b 49 20 76 61 6c  ches the SKI val
3430: 75 65 20 6f 66 20 74 68 65 0a 49 6e 74 65 72 6d  ue of the.Interm
3440: 65 64 69 61 74 65 20 43 41 20 63 65 72 74 69 66  ediate CA certif
3450: 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76  icate...[def "[v
3460: 61 72 20 73 75 62 6a 65 63 74 4b 65 79 49 64 65  ar subjectKeyIde
3470: 6e 74 69 66 69 65 72 5d 20 5b 61 72 67 20 73 74  ntifier] [arg st
3480: 72 69 6e 67 5d 22 5d 0a 53 75 62 6a 65 63 74 20  ring]"].Subject 
3490: 4b 65 79 20 49 64 65 6e 74 69 66 69 65 72 20 28  Key Identifier (
34a0: 53 4b 49 29 20 68 61 73 68 20 6f 66 20 74 68 65  SKI) hash of the
34b0: 20 70 75 62 6c 69 63 20 6b 65 79 20 69 6e 73 69   public key insi
34c0: 64 65 20 74 68 65 20 63 65 72 74 69 66 69 63 61  de the certifica
34d0: 74 65 20 61 73 20 61 0a 68 65 78 20 73 74 72 69  te as a.hex stri
34e0: 6e 67 2e 20 55 73 65 64 20 74 6f 20 69 64 65 6e  ng. Used to iden
34f0: 74 69 66 79 20 63 65 72 74 69 66 69 63 61 74 65  tify certificate
3500: 73 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 20 61  s that contain a
3510: 20 70 61 72 74 69 63 75 6c 61 72 20 70 75 62 6c   particular publ
3520: 69 63 20 6b 65 79 2e 0a 0a 5b 64 65 66 20 22 5b  ic key...[def "[
3530: 76 61 72 20 73 75 62 6a 65 63 74 41 6c 74 4e 61  var subjectAltNa
3540: 6d 65 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d  me] [arg list]"]
3550: 0a 4c 69 73 74 20 6f 66 20 61 6c 6c 20 6f 66 20  .List of all of 
3560: 74 68 65 20 53 75 62 6a 65 63 74 20 41 6c 74 65  the Subject Alte
3570: 72 6e 61 74 69 76 65 20 4e 61 6d 65 73 20 28 53  rnative Names (S
3580: 41 4e 29 20 69 6e 63 6c 75 64 69 6e 67 20 64 6f  AN) including do
3590: 6d 61 69 6e 20 6e 61 6d 65 73 2c 20 73 75 62 0a  main names, sub.
35a0: 64 6f 6d 61 69 6e 73 2c 20 61 6e 64 20 49 50 20  domains, and IP 
35b0: 61 64 64 72 65 73 73 65 73 20 74 68 61 74 20 61  addresses that a
35c0: 72 65 20 73 65 63 75 72 65 64 20 62 79 20 74 68  re secured by th
35d0: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a  e certificate...
35e0: 5b 64 65 66 20 22 5b 76 61 72 20 6f 63 73 70 5d  [def "[var ocsp]
35f0: 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69   [arg list]"].Li
3600: 73 74 20 6f 66 20 61 6c 6c 20 4f 6e 6c 69 6e 65  st of all Online
3610: 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74 61   Certificate Sta
3620: 74 75 73 20 50 72 6f 74 6f 63 6f 6c 20 28 4f 43  tus Protocol (OC
3630: 53 50 29 20 55 52 4c 73 20 74 68 61 74 20 63 61  SP) URLs that ca
3640: 6e 20 62 65 20 75 73 65 64 20 74 6f 0a 63 68 65  n be used to.che
3650: 63 6b 20 74 68 65 20 76 61 6c 69 64 69 74 79 20  ck the validity 
3660: 6f 66 20 74 68 69 73 20 63 65 72 74 69 66 69 63  of this certific
3670: 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ate...[def "[var
3680: 20 63 65 72 74 69 66 69 63 61 74 65 5d 20 5b 61   certificate] [a
3690: 72 67 20 63 65 72 74 5d 22 5d 0a 54 68 65 20 50  rg cert]"].The P
36a0: 45 4d 20 65 6e 63 6f 64 65 64 20 63 65 72 74 69  EM encoded certi
36b0: 66 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b  ficate...[def "[
36c0: 76 61 72 20 73 69 67 6e 61 74 75 72 65 41 6c 67  var signatureAlg
36d0: 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67  orithm] [arg alg
36e0: 6f 72 69 74 68 6d 5d 22 5d 0a 43 69 70 68 65 72  orithm]"].Cipher
36f0: 20 61 6c 67 6f 72 69 74 68 6d 20 75 73 65 64 20   algorithm used 
3700: 66 6f 72 20 74 68 65 20 63 65 72 74 69 66 69 63  for the certific
3710: 61 74 65 20 73 69 67 6e 61 74 75 72 65 2e 0a 0a  ate signature...
3720: 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61  [def "[var signa
3730: 74 75 72 65 56 61 6c 75 65 5d 20 5b 61 72 67 20  tureValue] [arg 
3740: 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66  string]"].Certif
3750: 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20  icate signature 
3760: 61 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e  as a hex string.
3770: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67  ..[def "[var sig
3780: 6e 61 74 75 72 65 44 69 67 65 73 74 5d 20 5b 61  natureDigest] [a
3790: 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 43 65  rg version]"].Ce
37a0: 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 69 6e  rtificate signin
37b0: 67 20 64 69 67 65 73 74 20 61 73 20 61 20 68 65  g digest as a he
37c0: 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65 66 20  x string...[def 
37d0: 22 5b 76 61 72 20 70 75 62 6c 69 63 4b 65 79 41  "[var publicKeyA
37e0: 6c 67 6f 72 69 74 68 6d 5d 20 5b 61 72 67 20 61  lgorithm] [arg a
37f0: 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a 43 65 72 74  lgorithm]"].Cert
3800: 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72  ificate signatur
3810: 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 6c 67  e public key alg
3820: 6f 72 69 74 68 6d 2e 0a 0a 5b 64 65 66 20 22 5b  orithm...[def "[
3830: 76 61 72 20 70 75 62 6c 69 63 4b 65 79 5d 20 5b  var publicKey] [
3840: 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 43 65  arg string]"].Ce
3850: 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74  rtificate signat
3860: 75 72 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61  ure public key a
3870: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a  s a hex string..
3880: 0a 5b 64 65 66 20 22 5b 76 61 72 20 62 69 74 73  .[def "[var bits
3890: 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62  ] [arg n]"].Numb
38a0: 65 72 20 6f 66 20 62 69 74 73 20 75 73 65 64 20  er of bits used 
38b0: 66 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 20  for certificate 
38c0: 73 69 67 6e 61 74 75 72 65 20 6b 65 79 2e 0a 0a  signature key...
38d0: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 6c 66 5f  [def "[var self_
38e0: 73 69 67 6e 65 64 5d 20 5b 61 72 67 20 62 6f 6f  signed] [arg boo
38f0: 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20  lean]"].Whether 
3900: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
3910: 73 69 67 6e 61 74 75 72 65 20 69 73 20 73 65 6c  signature is sel
3920: 66 20 73 69 67 6e 65 64 2e 0a 0a 5b 64 65 66 20  f signed...[def 
3930: 22 5b 76 61 72 20 73 68 61 31 5f 68 61 73 68 5d  "[var sha1_hash]
3940: 20 5b 61 72 67 20 68 61 73 68 5d 22 5d 0a 54 68   [arg hash]"].Th
3950: 65 20 53 48 41 31 20 68 61 73 68 20 6f 66 20 74  e SHA1 hash of t
3960: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61  he certificate a
3970: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a  s a hex string..
3980: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 68 61 32  .[def "[var sha2
3990: 35 36 5f 68 61 73 68 5d 20 5b 61 72 67 20 68 61  56_hash] [arg ha
39a0: 73 68 5d 22 5d 0a 54 68 65 20 53 48 41 32 35 36  sh]"].The SHA256
39b0: 20 68 61 73 68 20 6f 66 20 74 68 65 20 63 65 72   hash of the cer
39c0: 74 69 66 69 63 61 74 65 20 61 73 20 61 20 68 65  tificate as a he
39d0: 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74  x string...[list
39e0: 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  _end]..[call [cm
39f0: 64 20 74 6c 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f  d tls::connectio
3a00: 6e 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  n] [arg channel]
3a10: 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68 65 20 63  ]..Returns the c
3a20: 75 72 72 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f  urrent connectio
3a30: 6e 20 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53  n status of an S
3a40: 53 4c 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20  SL channel. The 
3a50: 72 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73 74  result is a list
3a60: 0a 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61  .of key-value pa
3a70: 69 72 73 20 64 65 73 63 72 69 62 69 6e 67 20 74  irs describing t
3a80: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 20 52  he connection. R
3a90: 65 74 75 72 6e 65 64 20 76 61 6c 75 65 73 20 69  eturned values i
3aa0: 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a  nclude:..[para].
3ab0: 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69  .SSL Status..[li
3ac0: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
3ad0: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61  ions]..[def "[va
3ae0: 72 20 73 74 61 74 65 5d 20 5b 61 72 67 20 73 74  r state] [arg st
3af0: 61 74 65 5d 22 5d 0a 53 74 61 74 65 20 6f 66 20  ate]"].State of 
3b00: 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a  the connection..
3b10: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 72 76  .[def "[var serv
3b20: 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d  ername] [arg nam
3b30: 65 5d 22 5d 0a 54 68 65 20 6e 61 6d 65 20 6f 66  e]"].The name of
3b40: 20 74 68 65 20 63 6f 6e 6e 65 63 74 65 64 20 74   the connected t
3b50: 6f 20 73 65 72 76 65 72 2e 0a 0a 5b 64 65 66 20  o server...[def 
3b60: 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20  "[var protocol] 
3b70: 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a  [arg version]"].
3b80: 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72  The protocol ver
3b90: 73 69 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 68  sion used for th
3ba0: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53  e connection: SS
3bb0: 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20  L2, SSL3, TLS1, 
3bc0: 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20  TLS1.1, TLS1.2, 
3bd0: 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f  TLS1.3, or unkno
3be0: 77 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  wn...[def "[var 
3bf0: 72 65 6e 65 67 6f 74 69 61 74 69 6f 6e 5f 61 6c  renegotiation_al
3c00: 6c 6f 77 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c  lowed] [arg bool
3c10: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 70  ean]"].Whether p
3c20: 72 6f 74 6f 63 6f 6c 20 72 65 6e 65 67 6f 74 69  rotocol renegoti
3c30: 61 74 69 6f 6e 20 69 73 20 73 75 70 70 6f 72 74  ation is support
3c40: 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66  ed or not...[def
3c50: 20 22 5b 76 61 72 20 73 65 63 75 72 69 74 79 5f   "[var security_
3c60: 6c 65 76 65 6c 5d 20 5b 61 72 67 20 6c 65 76 65  level] [arg leve
3c70: 6c 5d 22 5d 0a 54 68 65 20 73 65 63 75 72 69 74  l]"].The securit
3c80: 79 20 6c 65 76 65 6c 20 75 73 65 64 20 66 6f 72  y level used for
3c90: 20 73 65 6c 65 63 74 69 6f 6e 20 6f 66 20 63 69   selection of ci
3ca0: 70 68 65 72 73 2c 20 6b 65 79 20 73 69 7a 65 2c  phers, key size,
3cb0: 20 65 74 63 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   etc...[def "[va
3cc0: 72 20 73 65 73 73 69 6f 6e 5f 72 65 75 73 65 64  r session_reused
3cd0: 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22  ] [arg boolean]"
3ce0: 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 73 65  ].Whether the se
3cf0: 73 73 69 6f 6e 20 68 61 73 20 62 65 65 6e 20 72  ssion has been r
3d00: 65 75 73 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b  eused or not...[
3d10: 64 65 66 20 22 5b 76 61 72 20 69 73 5f 73 65 72  def "[var is_ser
3d20: 76 65 72 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61  ver] [arg boolea
3d30: 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65  n]"].Whether the
3d40: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 69 73 20 63   connection is c
3d50: 6f 6e 66 69 67 75 72 65 64 20 61 73 20 61 20 73  onfigured as a s
3d60: 65 72 76 65 72 20 28 31 29 20 6f 72 20 63 6c 69  erver (1) or cli
3d70: 65 6e 74 20 28 30 29 2e 0a 0a 5b 64 65 66 20 22  ent (0)...[def "
3d80: 5b 76 61 72 20 63 6f 6d 70 72 65 73 73 69 6f 6e  [var compression
3d90: 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 43  ] [arg mode]"].C
3da0: 6f 6d 70 72 65 73 73 69 6f 6e 20 6d 65 74 68 6f  ompression metho
3db0: 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65  d...[def "[var e
3dc0: 78 70 61 6e 73 69 6f 6e 5d 20 5b 61 72 67 20 6d  xpansion] [arg m
3dd0: 6f 64 65 5d 22 5d 0a 45 78 70 61 6e 73 69 6f 6e  ode]"].Expansion
3de0: 20 6d 65 74 68 6f 64 2e 0a 0a 5b 64 65 66 20 22   method...[def "
3df0: 5b 76 61 72 20 63 61 4c 69 73 74 5d 20 5b 61 72  [var caList] [ar
3e00: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f  g list]"].List o
3e10: 66 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  f Certificate Au
3e20: 74 68 6f 72 69 74 69 65 73 20 28 43 41 29 20 66  thorities (CA) f
3e30: 6f 72 20 58 2e 35 30 39 20 63 65 72 74 69 66 69  or X.509 certifi
3e40: 63 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  cate...[list_end
3e50: 5d 0a 0a 43 69 70 68 65 72 20 49 6e 66 6f 0a 0a  ]..Cipher Info..
3e60: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
3e70: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22  nitions]..[def "
3e80: 5b 76 61 72 20 63 69 70 68 65 72 5d 20 5b 61 72  [var cipher] [ar
3e90: 67 20 63 69 70 68 65 72 5d 22 5d 0a 54 68 65 20  g cipher]"].The 
3ea0: 63 75 72 72 65 6e 74 20 63 69 70 68 65 72 20 69  current cipher i
3eb0: 6e 20 75 73 65 20 66 6f 72 20 74 68 65 20 63 6f  n use for the co
3ec0: 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20  nnection...[def 
3ed0: 22 5b 76 61 72 20 73 74 61 6e 64 61 72 64 5f 6e  "[var standard_n
3ee0: 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22  ame] [arg name]"
3ef0: 5d 0a 54 68 65 20 73 74 61 6e 64 61 72 64 20 52  ].The standard R
3f00: 46 43 20 6e 61 6d 65 20 6f 66 20 63 69 70 68 65  FC name of ciphe
3f10: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  r...[def "[var a
3f20: 6c 67 6f 72 69 74 68 6d 5f 62 69 74 73 5d 20 5b  lgorithm_bits] [
3f30: 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d  arg n]"].The num
3f40: 62 65 72 20 6f 66 20 70 72 6f 63 65 73 73 65 64  ber of processed
3f50: 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 63   bits used for c
3f60: 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  ipher...[def "[v
3f70: 61 72 20 73 65 63 72 65 74 5f 62 69 74 73 5d 20  ar secret_bits] 
3f80: 5b 61 72 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75  [arg n]"].The nu
3f90: 6d 62 65 72 20 6f 66 20 73 65 63 72 65 74 20 62  mber of secret b
3fa0: 69 74 73 20 75 73 65 64 20 66 6f 72 20 63 69 70  its used for cip
3fb0: 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  her...[def "[var
3fc0: 20 6d 69 6e 5f 76 65 72 73 69 6f 6e 5d 20 5b 61   min_version] [a
3fd0: 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68  rg version]"].Th
3fe0: 65 20 6d 69 6e 69 6d 75 6d 20 70 72 6f 74 6f 63  e minimum protoc
3ff0: 6f 6c 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 63  ol version for c
4000: 69 70 68 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  ipher...[def "[v
4010: 61 72 20 63 69 70 68 65 72 5f 69 73 5f 61 65 61  ar cipher_is_aea
4020: 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  d] [arg boolean]
4030: 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 63  "].Whether the c
4040: 69 70 68 65 72 20 69 73 20 41 75 74 68 65 6e 74  ipher is Authent
4050: 69 63 61 74 65 64 20 45 6e 63 72 79 70 74 69 6f  icated Encryptio
4060: 6e 20 77 69 74 68 20 41 73 73 6f 63 69 61 74 65  n with Associate
4070: 64 20 44 61 74 61 20 28 41 45 41 44 29 2e 0a 0a  d Data (AEAD)...
4080: 5b 64 65 66 20 22 5b 76 61 72 20 63 69 70 68 65  [def "[var ciphe
4090: 72 5f 69 64 5d 20 5b 61 72 67 20 69 64 5d 22 5d  r_id] [arg id]"]
40a0: 0a 54 68 65 20 4f 70 65 6e 53 53 4c 20 63 69 70  .The OpenSSL cip
40b0: 68 65 72 20 69 64 2e 0a 0a 5b 64 65 66 20 22 5b  her id...[def "[
40c0: 76 61 72 20 64 65 73 63 72 69 70 74 69 6f 6e 5d  var description]
40d0: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
40e0: 41 20 74 65 78 74 20 64 65 73 63 72 69 70 74 69  A text descripti
40f0: 6f 6e 20 6f 66 20 74 68 65 20 63 69 70 68 65 72  on of the cipher
4100: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 68 61  ...[def "[var ha
4110: 6e 64 73 68 61 6b 65 5f 64 69 67 65 73 74 5d 20  ndshake_digest] 
4120: 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a  [arg boolean]"].
4130: 44 69 67 65 73 74 20 75 73 65 64 20 64 75 72 69  Digest used duri
4140: 6e 67 20 68 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b  ng handshake...[
4150: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 53 65 73 73 69  list_end]..Sessi
4160: 6f 6e 20 49 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62  on Info..[list_b
4170: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73  egin definitions
4180: 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c  ]..[def "[var al
4190: 70 6e 5d 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  pn] [arg protoco
41a0: 6c 5d 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f  l]"].The protoco
41b0: 6c 20 73 65 6c 65 63 74 65 64 20 61 66 74 65 72  l selected after
41c0: 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79   Application-Lay
41d0: 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f  er Protocol Nego
41e0: 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a  tiation (ALPN)..
41f0: 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 73 75  .[def "[var resu
4200: 6d 61 62 6c 65 5d 20 5b 61 72 67 20 62 6f 6f 6c  mable] [arg bool
4210: 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74  ean]"].Whether t
4220: 68 65 20 73 65 73 73 69 6f 6e 20 63 61 6e 20 62  he session can b
4230: 65 20 72 65 73 75 6d 65 64 20 6f 72 20 6e 6f 74  e resumed or not
4240: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74  ...[def "[var st
4250: 61 72 74 5f 74 69 6d 65 5d 20 5b 61 72 67 20 73  art_time] [arg s
4260: 65 63 6f 6e 64 73 5d 22 5d 0a 54 69 6d 65 20 73  econds]"].Time s
4270: 69 6e 63 65 20 73 65 73 73 69 6f 6e 20 73 74 61  ince session sta
4280: 72 74 65 64 20 69 6e 20 73 65 63 6f 6e 64 73 20  rted in seconds 
4290: 73 69 6e 63 65 20 65 70 6f 63 68 2e 0a 0a 5b 64  since epoch...[d
42a0: 65 66 20 22 5b 76 61 72 20 74 69 6d 65 6f 75 74  ef "[var timeout
42b0: 5d 20 5b 61 72 67 20 73 65 63 6f 6e 64 73 5d 22  ] [arg seconds]"
42c0: 5d 0a 4d 61 78 20 64 75 72 61 74 69 6f 6e 20 6f  ].Max duration o
42d0: 66 20 73 65 73 73 69 6f 6e 20 69 6e 20 73 65 63  f session in sec
42e0: 6f 6e 64 73 20 62 65 66 6f 72 65 20 74 69 6d 65  onds before time
42f0: 2d 6f 75 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  -out...[def "[va
4300: 72 20 6c 69 66 65 74 69 6d 65 5d 20 5b 61 72 67  r lifetime] [arg
4310: 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 53 65 73 73   seconds]"].Sess
4320: 69 6f 6e 20 74 69 63 6b 65 74 20 6c 69 66 65 74  ion ticket lifet
4330: 69 6d 65 20 68 69 6e 74 20 69 6e 20 73 65 63 6f  ime hint in seco
4340: 6e 64 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  nds...[def "[var
4350: 20 73 65 73 73 69 6f 6e 5f 69 64 5d 20 5b 61 72   session_id] [ar
4360: 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d  g binary_string]
4370: 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f  "].Unique sessio
4380: 6e 20 69 64 20 66 6f 72 20 75 73 65 20 69 6e 20  n id for use in 
4390: 72 65 73 75 6d 69 6e 67 20 74 68 65 20 73 65 73  resuming the ses
43a0: 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  sion...[def "[va
43b0: 72 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74  r session_ticket
43c0: 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74  ] [arg binary_st
43d0: 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73  ring]"].Unique s
43e0: 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 66 6f  ession ticket fo
43f0: 72 20 75 73 65 20 69 6e 20 72 65 73 75 6d 69 6e  r use in resumin
4400: 67 20 74 68 65 20 73 65 73 73 69 6f 6e 2e 0a 0a  g the session...
4410: 5b 64 65 66 20 22 5b 76 61 72 20 74 69 63 6b 65  [def "[var ticke
4420: 74 5f 61 70 70 5f 64 61 74 61 5d 20 5b 61 72 67  t_app_data] [arg
4430: 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22   binary_string]"
4440: 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e  ].Unique session
4450: 20 74 69 63 6b 65 74 20 61 70 70 6c 69 63 61 74   ticket applicat
4460: 69 6f 6e 20 64 61 74 61 2e 0a 0a 5b 64 65 66 20  ion data...[def 
4470: 22 5b 76 61 72 20 6d 61 73 74 65 72 5f 6b 65 79  "[var master_key
4480: 5d 20 5b 61 72 67 20 62 69 6e 61 72 79 5f 73 74  ] [arg binary_st
4490: 72 69 6e 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73  ring]"].Unique s
44a0: 65 73 73 69 6f 6e 20 6d 61 73 74 65 72 20 6b 65  ession master ke
44b0: 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  y...[def "[var s
44c0: 65 73 73 69 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64  ession_cache_mod
44d0: 65 5d 20 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a  e] [arg mode]"].
44e0: 53 65 72 76 65 72 20 63 61 63 68 65 20 6d 6f 64  Server cache mod
44f0: 65 20 28 63 6c 69 65 6e 74 2c 20 73 65 72 76 65  e (client, serve
4500: 72 2c 20 6f 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c  r, or both)...[l
4510: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20  ist_end]..[call 
4520: 5b 63 6d 64 20 74 6c 73 3a 3a 63 69 70 68 65 72  [cmd tls::cipher
4530: 73 5d 20 5b 6f 70 74 20 5b 61 72 67 20 70 72 6f  s] [opt [arg pro
4540: 74 6f 63 6f 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72  tocol]] [opt [ar
4550: 67 20 76 65 72 62 6f 73 65 5d 5d 20 5b 6f 70 74  g verbose]] [opt
4560: 20 5b 61 72 67 20 73 75 70 70 6f 72 74 65 64 5d   [arg supported]
4570: 5d 5d 0a 0a 57 69 74 68 6f 75 74 20 61 6e 79 20  ]]..Without any 
4580: 61 72 67 73 2c 20 72 65 74 75 72 6e 73 20 61 20  args, returns a 
4590: 6c 69 73 74 20 6f 66 20 61 6c 6c 20 73 79 6d 6d  list of all symm
45a0: 65 74 72 69 63 20 63 69 70 68 65 72 73 20 66 6f  etric ciphers fo
45b0: 72 20 75 73 65 20 77 69 74 68 20 74 68 65 0a 5b  r use with the.[
45c0: 61 72 67 20 2d 63 69 70 68 65 72 5d 20 6f 70 74  arg -cipher] opt
45d0: 69 6f 6e 2e 20 57 69 74 68 20 5b 61 72 67 20 70  ion. With [arg p
45e0: 72 6f 74 6f 63 6f 6c 5d 2c 20 6f 6e 6c 79 20 74  rotocol], only t
45f0: 68 65 20 63 69 70 68 65 72 73 20 73 75 70 70 6f  he ciphers suppo
4600: 72 74 65 64 20 66 6f 72 20 74 68 61 74 0a 70 72  rted for that.pr
4610: 6f 74 6f 63 6f 6c 20 61 72 65 20 72 65 74 75 72  otocol are retur
4620: 6e 65 64 2e 20 53 65 65 20 74 68 65 20 5b 63 6d  ned. See the [cm
4630: 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73  d tls::protocols
4640: 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20 74 68  ] command for th
4650: 65 20 73 75 70 70 6f 72 74 65 64 0a 70 72 6f 74  e supported.prot
4660: 6f 63 6f 6c 73 2e 20 49 66 20 5b 61 72 67 20 76  ocols. If [arg v
4670: 65 72 62 6f 73 65 5d 20 69 73 20 73 70 65 63 69  erbose] is speci
4680: 66 69 65 64 20 61 73 20 74 72 75 65 20 74 68 65  fied as true the
4690: 6e 20 61 20 76 65 72 62 6f 73 65 2c 20 68 75 6d  n a verbose, hum
46a0: 61 6e 20 72 65 61 64 61 62 6c 65 0a 6c 69 73 74  an readable.list
46b0: 20 69 73 20 72 65 74 75 72 6e 65 64 20 77 69 74   is returned wit
46c0: 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 69 6e 66  h additional inf
46d0: 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20  ormation on the 
46e0: 63 69 70 68 65 72 2e 20 49 66 20 5b 61 72 67 20  cipher. If [arg 
46f0: 73 75 70 70 6f 72 74 65 64 5d 0a 69 73 20 73 70  supported].is sp
4700: 65 63 69 66 69 65 64 20 61 73 20 74 72 75 65 2c  ecified as true,
4710: 20 74 68 65 6e 20 6f 6e 6c 79 20 74 68 65 20 63   then only the c
4720: 69 70 68 65 72 73 20 73 75 70 70 6f 72 74 65 64  iphers supported
4730: 20 66 6f 72 20 70 72 6f 74 6f 63 6f 6c 20 77 69   for protocol wi
4740: 6c 6c 20 62 65 20 6c 69 73 74 65 64 2e 0a 0a 5b  ll be listed...[
4750: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70  call [cmd tls::p
4760: 72 6f 74 6f 63 6f 6c 73 5d 5d 0a 0a 52 65 74 75  rotocols]]..Retu
4770: 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74 68  rns a list of th
4780: 65 20 73 75 70 70 6f 72 74 65 64 20 53 53 4c 2f  e supported SSL/
4790: 54 4c 53 20 70 72 6f 74 6f 63 6f 6c 73 2e 20 56  TLS protocols. V
47a0: 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65 3a  alid values are:
47b0: 0a 5b 63 6f 6e 73 74 20 73 73 6c 32 5d 2c 20 5b  .[const ssl2], [
47c0: 63 6f 6e 73 74 20 73 73 6c 33 5d 2c 20 5b 63 6f  const ssl3], [co
47d0: 6e 73 74 20 74 6c 73 31 5d 2c 20 5b 63 6f 6e 73  nst tls1], [cons
47e0: 74 20 74 6c 73 31 2e 31 5d 2c 20 5b 63 6f 6e 73  t tls1.1], [cons
47f0: 74 20 74 6c 73 31 2e 32 5d 2c 20 61 6e 64 0a 5b  t tls1.2], and.[
4800: 63 6f 6e 73 74 20 74 6c 73 31 2e 33 5d 2e 20 45  const tls1.3]. E
4810: 78 61 63 74 20 6c 69 73 74 20 64 65 70 65 6e 64  xact list depend
4820: 73 20 6f 6e 20 4f 70 65 6e 53 53 4c 20 76 65 72  s on OpenSSL ver
4830: 73 69 6f 6e 20 61 6e 64 20 63 6f 6d 70 69 6c 65  sion and compile
4840: 20 74 69 6d 65 20 66 6c 61 67 73 2e 0a 0a 5b 63   time flags...[c
4850: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 65  all [cmd tls::ve
4860: 72 73 69 6f 6e 5d 5d 0a 0a 52 65 74 75 72 6e 73  rsion]]..Returns
4870: 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 76 65 72   the OpenSSL ver
4880: 73 69 6f 6e 20 73 74 72 69 6e 67 2e 0a 0a 5b 6c  sion string...[l
4890: 69 73 74 5f 65 6e 64 5d 0a 0a 0a 5b 73 65 63 74  ist_end]...[sect
48a0: 69 6f 6e 20 22 43 65 72 74 69 66 69 63 61 74 65  ion "Certificate
48b0: 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 0a 0a 5b   Validation"]..[
48c0: 73 75 62 73 65 63 74 69 6f 6e 20 22 50 4b 49 20  subsection "PKI 
48d0: 61 6e 64 20 43 65 72 74 69 66 69 63 61 74 65 73  and Certificates
48e0: 22 5d 0a 0a 55 73 69 6e 67 20 74 68 65 20 50 75  "]..Using the Pu
48f0: 62 6c 69 63 20 4b 65 79 20 49 6e 66 72 61 73 74  blic Key Infrast
4900: 72 75 63 74 75 72 65 20 28 50 4b 49 29 2c 20 65  ructure (PKI), e
4910: 61 63 68 20 75 73 65 72 20 63 72 65 61 74 65 73  ach user creates
4920: 20 61 20 70 72 69 76 61 74 65 20 6b 65 79 20 74   a private key t
4930: 68 61 74 0a 6f 6e 6c 79 20 74 68 65 79 20 6b 6e  hat.only they kn
4940: 6f 77 20 61 62 6f 75 74 20 61 6e 64 20 61 20 70  ow about and a p
4950: 75 62 6c 69 63 20 6b 65 79 20 74 68 65 79 20 63  ublic key they c
4960: 61 6e 20 65 78 63 68 61 6e 67 65 20 77 69 74 68  an exchange with
4970: 20 6f 74 68 65 72 73 20 66 6f 72 20 75 73 65 20   others for use 
4980: 69 6e 0a 65 6e 63 72 79 70 74 69 6e 67 20 61 6e  in.encrypting an
4990: 64 20 64 65 63 72 79 70 74 69 6e 67 20 64 61 74  d decrypting dat
49a0: 61 2e 20 54 68 65 20 70 72 6f 63 65 73 73 20 69  a. The process i
49b0: 73 20 74 68 65 20 73 65 6e 64 65 72 20 65 6e 63  s the sender enc
49c0: 72 79 70 74 73 20 74 68 65 69 72 20 64 61 74 61  rypts their data
49d0: 0a 75 73 69 6e 67 20 74 68 65 69 72 20 70 72 69  .using their pri
49e0: 76 61 74 65 20 6b 65 79 20 61 6e 64 20 74 68 65  vate key and the
49f0: 20 72 65 63 65 69 76 65 72 27 73 20 70 75 62 6c   receiver's publ
4a00: 69 63 20 6b 65 79 2e 20 54 68 65 20 64 61 74 61  ic key. The data
4a10: 20 69 73 20 74 68 65 6e 20 73 65 6e 74 0a 74 6f   is then sent.to
4a20: 20 74 68 65 20 72 65 63 65 69 76 65 72 2e 20 49   the receiver. I
4a30: 6e 20 61 20 73 69 6d 69 6c 61 72 20 6d 61 6e 6e  n a similar mann
4a40: 65 72 2c 20 74 68 65 20 72 65 63 65 69 76 65 72  er, the receiver
4a50: 20 75 73 65 73 20 74 68 65 69 72 20 70 72 69 76   uses their priv
4a60: 61 74 65 20 6b 65 79 20 61 6e 64 0a 74 68 65 20  ate key and.the 
4a70: 73 65 6e 64 65 72 27 73 20 70 75 62 6c 69 63 20  sender's public 
4a80: 6b 65 79 20 74 6f 20 64 65 63 72 79 70 74 20 74  key to decrypt t
4a90: 68 65 20 64 61 74 61 2e 20 54 68 69 73 20 70 72  he data. This pr
4aa0: 6f 76 69 64 65 73 20 64 61 74 61 20 69 6e 74 65  ovides data inte
4ab0: 67 72 69 74 79 2c 20 74 6f 0a 65 6e 73 75 72 65  grity, to.ensure
4ac0: 20 74 68 65 20 64 61 74 61 20 63 61 6e 27 74 20   the data can't 
4ad0: 62 65 20 76 69 65 77 65 64 20 6f 72 20 61 6c 74  be viewed or alt
4ae0: 65 72 65 64 20 64 75 72 69 6e 67 20 74 72 61 6e  ered during tran
4af0: 73 70 6f 72 74 2e 20 53 65 65 20 74 68 65 0a 5b  sport. See the.[
4b00: 6f 70 74 69 6f 6e 20 2d 6b 65 79 5d 20 61 6e 64  option -key] and
4b10: 20 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79 66 69 6c   [option -keyfil
4b20: 65 5d 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 68  e] options for h
4b30: 6f 77 20 74 6f 20 73 70 65 63 69 66 79 20 74 68  ow to specify th
4b40: 65 20 70 72 69 76 61 74 65 20 6b 65 79 2e 0a 41  e private key..A
4b50: 6c 73 6f 20 73 65 65 20 74 68 65 20 5b 6f 70 74  lso see the [opt
4b60: 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f  ion -password] o
4b70: 70 74 69 6f 6e 20 66 6f 72 20 68 6f 77 20 74 6f  ption for how to
4b80: 20 70 72 6f 76 69 64 65 20 74 68 65 20 70 61 73   provide the pas
4b90: 73 77 6f 72 64 2e 0a 5b 70 61 72 61 5d 0a 49 6e  sword..[para].In
4ba0: 20 6f 72 64 65 72 20 74 6f 20 70 72 6f 76 69 64   order to provid
4bb0: 65 20 61 75 74 68 65 6e 74 69 63 61 74 69 6f 6e  e authentication
4bc0: 2c 20 69 2e 65 2e 20 65 6e 73 75 72 69 6e 67 20  , i.e. ensuring 
4bd0: 73 6f 6d 65 6f 6e 65 20 69 73 20 77 68 6f 20 74  someone is who t
4be0: 68 65 79 20 73 61 79 20 74 68 65 79 0a 61 72 65  hey say they.are
4bf0: 2c 20 74 68 65 20 70 75 62 6c 69 63 20 6b 65 79  , the public key
4c00: 20 61 6e 64 20 75 73 65 72 20 69 64 65 6e 74 69   and user identi
4c10: 66 69 63 61 74 69 6f 6e 20 69 6e 66 6f 20 69 73  fication info is
4c20: 20 73 74 6f 72 65 64 20 69 6e 20 61 20 58 2e 35   stored in a X.5
4c30: 30 39 0a 63 65 72 74 69 66 69 63 61 74 65 20 61  09.certificate a
4c40: 6e 64 20 74 68 61 74 20 63 65 72 74 69 66 69 63  nd that certific
4c50: 61 74 65 20 69 73 20 61 75 74 68 65 6e 74 69 63  ate is authentic
4c60: 61 74 65 64 20 28 69 2e 65 2e 20 73 69 67 6e 65  ated (i.e. signe
4c70: 64 29 20 62 79 20 61 20 43 65 72 74 69 66 69 63  d) by a Certific
4c80: 61 74 65 0a 41 75 74 68 6f 72 69 74 79 20 28 43  ate.Authority (C
4c90: 41 29 2e 20 55 73 65 72 73 20 63 61 6e 20 74 68  A). Users can th
4ca0: 65 6e 20 65 78 63 68 61 6e 67 65 20 74 68 65 73  en exchange thes
4cb0: 65 20 63 65 72 74 69 66 69 63 61 74 65 73 20 64  e certificates d
4cc0: 75 72 69 6e 67 20 74 68 65 20 54 4c 53 0a 69 6e  uring the TLS.in
4cd0: 69 74 69 61 6c 69 7a 61 74 69 6f 6e 20 70 72 6f  itialization pro
4ce0: 63 65 73 73 20 61 6e 64 20 63 68 65 63 6b 20 74  cess and check t
4cf0: 68 65 6d 20 61 67 61 69 6e 73 74 20 74 68 65 20  hem against the 
4d00: 72 6f 6f 74 20 43 41 20 63 65 72 74 69 66 69 63  root CA certific
4d10: 61 74 65 73 20 74 6f 20 65 6e 73 75 72 65 0a 74  ates to ensure.t
4d20: 68 65 79 20 61 72 65 20 76 61 6c 69 64 2e 20 54  hey are valid. T
4d30: 68 69 73 20 69 73 20 68 61 6e 64 6c 65 64 20 62  his is handled b
4d40: 79 20 4f 70 65 6e 53 53 4c 20 76 69 61 20 74 68  y OpenSSL via th
4d50: 65 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 65  e [option -reque
4d60: 73 74 5d 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20  st] and.[option 
4d70: 2d 72 65 71 75 69 72 65 5d 20 6f 70 74 69 6f 6e  -require] option
4d80: 73 2e 20 53 65 65 20 74 68 65 20 5b 6f 70 74 69  s. See the [opti
4d90: 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f 70 74  on -cadir], [opt
4da0: 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61 6e 64  ion -cadir], and
4db0: 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72  .[option -castor
4dc0: 65 5d 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 68  e] options for h
4dd0: 6f 77 20 74 70 20 73 70 65 63 69 66 79 20 77 68  ow tp specify wh
4de0: 65 72 65 20 74 6f 20 66 69 6e 64 20 74 68 65 20  ere to find the 
4df0: 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73 2e  CA certificates.
4e00: 0a 4f 70 74 69 6f 6e 61 6c 6c 79 2c 20 69 6e 20  .Optionally, in 
4e10: 61 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65  a future release
4e20: 2c 20 74 68 65 79 20 63 61 6e 20 61 6c 73 6f 20  , they can also 
4e30: 62 65 20 63 68 65 63 6b 65 64 20 61 67 61 69 6e  be checked again
4e40: 73 74 20 74 68 65 20 43 65 72 74 69 66 69 63 61  st the Certifica
4e50: 74 65 0a 52 65 76 6f 63 61 74 69 6f 6e 20 4c 69  te.Revocation Li
4e60: 73 74 20 28 43 52 4c 29 20 6f 66 20 72 65 76 6f  st (CRL) of revo
4e70: 6b 65 64 20 63 65 72 74 69 66 69 63 61 74 65 73  ked certificates
4e80: 2e 20 43 65 72 74 69 66 69 63 61 74 65 73 20 63  . Certificates c
4e90: 61 6e 20 61 6c 73 6f 20 62 65 0a 73 65 6c 66 2d  an also be.self-
4ea0: 73 69 67 6e 65 64 2c 20 62 75 74 20 74 68 65 79  signed, but they
4eb0: 20 61 72 65 20 62 79 20 64 65 66 61 75 6c 74 20   are by default 
4ec0: 6e 6f 74 20 74 72 75 73 74 65 64 20 75 6e 6c 65  not trusted unle
4ed0: 73 73 20 79 6f 75 20 61 64 64 20 74 68 65 6d 20  ss you add them 
4ee0: 74 6f 20 79 6f 75 72 0a 63 65 72 74 69 66 69 63  to your.certific
4ef0: 61 74 65 20 73 74 6f 72 65 2e 0a 5b 70 61 72 61  ate store..[para
4f00: 5d 0a 54 79 70 69 63 61 6c 6c 79 20 77 68 65 6e  ].Typically when
4f10: 20 76 69 73 69 74 69 6e 67 20 77 65 62 20 73 69   visiting web si
4f20: 74 65 73 2c 20 6f 6e 6c 79 20 74 68 65 20 63 6c  tes, only the cl
4f30: 69 65 6e 74 20 6e 65 65 64 73 20 74 6f 20 63 68  ient needs to ch
4f40: 65 63 6b 20 74 68 65 20 73 65 72 76 65 72 27 73  eck the server's
4f50: 0a 63 65 72 74 69 66 69 63 61 74 65 20 74 6f 20  .certificate to 
4f60: 65 6e 73 75 72 65 20 69 74 20 69 73 20 76 61 6c  ensure it is val
4f70: 69 64 2e 20 54 68 65 20 73 65 72 76 65 72 20 64  id. The server d
4f80: 6f 65 73 6e 27 74 20 6e 65 65 64 20 74 6f 20 63  oesn't need to c
4f90: 68 65 63 6b 20 74 68 65 20 63 6c 69 65 6e 74 0a  heck the client.
4fa0: 63 65 72 74 69 66 69 63 61 74 65 20 75 6e 6c 65  certificate unle
4fb0: 73 73 20 79 6f 75 20 6e 65 65 64 20 74 6f 20 61  ss you need to a
4fc0: 75 74 68 65 6e 74 69 63 61 74 65 20 77 69 74 68  uthenticate with
4fd0: 20 74 68 65 6d 20 74 6f 20 6c 6f 67 69 6e 2c 20   them to login, 
4fe0: 65 74 63 2e 20 53 65 65 20 74 68 65 0a 5b 6f 70  etc. See the.[op
4ff0: 74 69 6f 6e 20 2d 63 65 72 74 5d 20 61 6e 64 20  tion -cert] and 
5000: 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74 66 69 6c  [option -certfil
5010: 65 5d 20 6f 70 74 69 6f 6e 73 20 69 66 20 79 6f  e] options if yo
5020: 75 20 6e 65 65 64 20 74 6f 20 70 72 6f 76 69 64  u need to provid
5030: 65 20 61 20 63 65 72 74 69 66 69 63 61 74 65 2e  e a certificate.
5040: 0a 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22  ...[subsection "
5050: 53 75 6d 6d 61 72 79 20 6f 66 20 63 6f 6d 6d 61  Summary of comma
5060: 6e 64 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 73 22  nd line options"
5070: 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67  ]..The following
5080: 20 6f 70 74 69 6f 6e 73 20 61 72 65 20 75 73 65   options are use
5090: 64 20 66 6f 72 20 70 65 65 72 20 63 65 72 74 69  d for peer certi
50a0: 66 69 63 61 74 65 20 76 61 6c 69 64 61 74 69 6f  ficate validatio
50b0: 6e 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  n:..[list_begin 
50c0: 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64  options]..[opt_d
50d0: 65 66 20 2d 63 61 64 69 72 20 5b 61 72 67 20 64  ef -cadir [arg d
50e0: 69 72 65 63 74 6f 72 79 5d 5d 0a 53 70 65 63 69  irectory]].Speci
50f0: 66 69 65 73 20 74 68 65 20 64 69 72 65 63 74 6f  fies the directo
5100: 72 79 20 77 68 65 72 65 20 74 68 65 20 43 65 72  ry where the Cer
5110: 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69  tificate Authori
5120: 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69 63  ty (CA) certific
5130: 61 74 65 73 20 61 72 65 0a 73 74 6f 72 65 64 2e  ates are.stored.
5140: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
5150: 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66 69  platform specifi
5160: 63 2c 20 62 75 74 20 69 73 20 75 73 75 61 6c 6c  c, but is usuall
5170: 79 20 5b 66 69 6c 65 20 22 2f 65 74 63 2f 73 73  y [file "/etc/ss
5180: 6c 2f 63 65 72 74 73 22 5d 20 6f 6e 0a 4c 69 6e  l/certs"] on.Lin
5190: 75 78 2f 55 6e 69 78 20 73 79 73 74 65 6d 73 2e  ux/Unix systems.
51a0: 20 54 68 65 20 64 65 66 61 75 6c 74 20 6c 6f 63   The default loc
51b0: 61 74 69 6f 6e 20 63 61 6e 20 62 65 20 6f 76 65  ation can be ove
51c0: 72 72 69 64 64 65 6e 20 62 79 20 74 68 65 0a 5b  rridden by the.[
51d0: 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52  var SSL_CERT_DIR
51e0: 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61  ] environment va
51f0: 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65  riable...[opt_de
5200: 66 20 2d 63 61 66 69 6c 65 20 5b 61 72 67 20 66  f -cafile [arg f
5210: 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69 66  ilename]].Specif
5220: 69 65 73 20 74 68 65 20 66 69 6c 65 20 77 69 74  ies the file wit
5230: 68 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  h the Certificat
5240: 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e Authority (CA)
5250: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 6f   certificates to
5260: 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73 74 20 50   use in.[const P
5270: 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d 61 74 2e  EM] file format.
5280: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
5290: 5b 66 69 6c 65 20 63 65 72 74 2e 70 65 6d 5d 2c  [file cert.pem],
52a0: 20 69 6e 20 74 68 65 20 4f 70 65 6e 53 53 4c 0a   in the OpenSSL.
52b0: 64 69 72 65 63 74 6f 72 79 2e 20 4f 6e 20 4c 69  directory. On Li
52c0: 6e 75 78 2f 55 6e 69 78 20 73 79 73 74 65 6d 73  nux/Unix systems
52d0: 2c 20 74 68 69 73 20 69 73 20 75 73 75 61 6c 6c  , this is usuall
52e0: 79 20 5b 66 69 6c 65 20 2f 65 74 63 2f 73 73 6c  y [file /etc/ssl
52f0: 2f 63 61 2d 62 75 6e 64 6c 65 2e 70 65 6d 5d 2e  /ca-bundle.pem].
5300: 0a 54 68 65 20 64 65 66 61 75 6c 74 20 66 69 6c  .The default fil
5310: 65 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64  e can be overrid
5320: 64 65 6e 20 62 79 20 74 68 65 20 5b 76 61 72 20  den by the [var 
5330: 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65  SSL_CERT_FILE] e
5340: 6e 76 69 72 6f 6e 6d 65 6e 74 0a 76 61 72 69 61  nvironment.varia
5350: 62 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ble...[opt_def -
5360: 63 61 73 74 6f 72 65 20 5b 61 72 67 20 55 52 49  castore [arg URI
5370: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
5380: 20 55 6e 69 66 6f 72 6d 20 52 65 73 6f 75 72 63   Uniform Resourc
5390: 65 20 49 64 65 6e 74 69 66 69 65 72 20 28 55 52  e Identifier (UR
53a0: 49 29 20 66 6f 72 20 74 68 65 20 43 65 72 74 69  I) for the Certi
53b0: 66 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 79  ficate Authority
53c0: 0a 28 43 41 29 20 73 74 6f 72 65 2c 20 77 68 69  .(CA) store, whi
53d0: 63 68 20 6d 61 79 20 62 65 20 61 20 73 69 6e 67  ch may be a sing
53e0: 6c 65 20 63 6f 6e 74 61 69 6e 65 72 20 6f 72 20  le container or 
53f0: 61 20 63 61 74 61 6c 6f 67 20 6f 66 20 63 6f 6e  a catalog of con
5400: 74 61 69 6e 65 72 73 2e 0a 53 74 61 72 74 69 6e  tainers..Startin
5410: 67 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 33  g with OpenSSL 3
5420: 2e 32 20 6f 6e 20 4d 53 20 57 69 6e 64 6f 77 73  .2 on MS Windows
5430: 2c 20 73 65 74 20 74 6f 20 22 5b 63 6f 6e 73 74  , set to "[const
5440: 20 22 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69   "org.openssl.wi
5450: 6e 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f 20  nstore://"]".to 
5460: 75 73 65 20 74 68 65 20 62 75 69 6c 74 2d 69 6e  use the built-in
5470: 20 4d 53 20 57 69 6e 64 6f 77 73 20 43 65 72 74   MS Windows Cert
5480: 69 66 69 63 61 74 65 20 53 74 6f 72 65 2e 0a 54  ificate Store..T
5490: 68 69 73 20 73 74 6f 72 65 20 6f 6e 6c 79 20 73  his store only s
54a0: 75 70 70 6f 72 74 73 20 72 6f 6f 74 20 63 65 72  upports root cer
54b0: 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 73 2e  tificate stores.
54c0: 20 53 65 65 0a 5b 73 65 63 74 72 65 66 20 22 43   See.[sectref "C
54d0: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
54e0: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65  ation"] for more
54f0: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f   details...[opt_
5500: 64 65 66 20 2d 72 65 71 75 65 73 74 20 5b 61 72  def -request [ar
5510: 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 65 73 74  g bool]].Request
5520: 20 61 20 63 65 72 74 69 66 69 63 61 74 65 20 66   a certificate f
5530: 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64 75 72  rom the peer dur
5540: 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61 6e 64  ing the SSL hand
5550: 73 68 61 6b 65 2e 20 54 68 69 73 20 69 73 20 6e  shake. This is n
5560: 65 65 64 65 64 0a 74 6f 20 64 6f 20 43 65 72 74  eeded.to do Cert
5570: 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69  ificate Validati
5580: 6f 6e 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20  on. Starting in 
5590: 54 63 6c 54 4c 53 20 31 2e 38 2c 20 74 68 65 20  TclTLS 1.8, the 
55a0: 64 65 66 61 75 6c 74 20 69 73 0a 5b 63 6f 6e 73  default is.[cons
55b0: 74 20 74 72 75 65 5d 2e 20 49 6e 20 61 64 64 69  t true]. In addi
55c0: 74 69 6f 6e 2c 20 74 68 65 20 63 6c 69 65 6e 74  tion, the client
55d0: 20 63 61 6e 20 6d 61 6e 75 61 6c 6c 79 20 69 6e   can manually in
55e0: 73 70 65 63 74 20 61 6e 64 20 61 63 63 65 70 74  spect and accept
55f0: 20 6f 72 20 72 65 6a 65 63 74 0a 65 61 63 68 20   or reject.each 
5600: 63 65 72 74 69 66 69 63 61 74 65 20 75 73 69 6e  certificate usin
5610: 67 20 74 68 65 20 5b 61 72 67 20 2d 76 61 6c 69  g the [arg -vali
5620: 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74  datecommand] opt
5630: 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ion...[opt_def -
5640: 72 65 71 75 69 72 65 20 5b 61 72 67 20 62 6f 6f  require [arg boo
5650: 6c 5d 5d 0a 52 65 71 75 69 72 65 20 61 20 76 61  l]].Require a va
5660: 6c 69 64 20 63 65 72 74 69 66 69 63 61 74 65 20  lid certificate 
5670: 66 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64 75  from the peer du
5680: 72 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61 6e  ring the SSL han
5690: 64 73 68 61 6b 65 2e 20 49 66 20 74 68 69 73 20  dshake. If this 
56a0: 69 73 0a 73 65 74 20 74 6f 20 74 72 75 65 2c 20  is.set to true, 
56b0: 74 68 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d 72 65  then [option -re
56c0: 71 75 65 73 74 5d 20 6d 75 73 74 20 61 6c 73 6f  quest] must also
56d0: 20 62 65 20 73 65 74 20 74 6f 20 74 72 75 65 20   be set to true 
56e0: 61 6e 64 20 61 20 65 69 74 68 65 72 0a 5b 6f 70  and a either.[op
56f0: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b 6f  tion -cadir], [o
5700: 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 2c 20  ption -cafile], 
5710: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65  [option -castore
5720: 5d 2c 20 6f 72 20 61 20 70 6c 61 74 66 6f 72 6d  ], or a platform
5730: 20 64 65 66 61 75 6c 74 0a 6d 75 73 74 20 62 65   default.must be
5740: 20 70 72 6f 76 69 64 65 64 20 69 6e 20 6f 72 64   provided in ord
5750: 65 72 20 74 6f 20 76 61 6c 69 64 61 74 65 20 61  er to validate a
5760: 67 61 69 6e 73 74 2e 20 54 68 65 20 64 65 66 61  gainst. The defa
5770: 75 6c 74 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e  ult in TclTLS 1.
5780: 38 20 61 6e 64 0a 65 61 72 6c 69 65 72 20 76 65  8 and.earlier ve
5790: 72 73 69 6f 6e 73 20 69 73 20 5b 63 6f 6e 73 74  rsions is [const
57a0: 20 66 61 6c 73 65 5d 20 73 69 6e 63 65 20 6e 6f   false] since no
57b0: 74 20 61 6c 6c 20 70 6c 61 74 66 6f 72 6d 73 20  t all platforms 
57c0: 68 61 76 65 20 63 65 72 74 69 66 69 63 61 74 65  have certificate
57d0: 73 20 74 6f 0a 76 61 6c 69 64 61 74 65 20 61 67  s to.validate ag
57e0: 61 69 6e 73 74 20 69 6e 20 61 20 66 6f 72 6d 20  ainst in a form 
57f0: 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68 20  compatible with 
5800: 4f 70 65 6e 53 53 4c 2e 0a 0a 5b 6c 69 73 74 5f  OpenSSL...[list_
5810: 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f  end]..[subsectio
5820: 6e 20 22 57 68 65 6e 20 61 72 65 20 63 6f 6d 6d  n "When are comm
5830: 61 6e 64 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 73  and line options
5840: 20 6e 65 65 64 65 64 3f 22 5d 0a 0a 49 6e 20 54   needed?"]..In T
5850: 63 6c 54 4c 53 20 31 2e 38 20 61 6e 64 20 65 61  clTLS 1.8 and ea
5860: 72 6c 69 65 72 20 76 65 72 73 69 6f 6e 73 2c 20  rlier versions, 
5870: 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c 69  certificate vali
5880: 64 61 74 69 6f 6e 20 69 73 0a 5b 65 6d 70 68 20  dation is.[emph 
5890: 4e 4f 54 5d 20 65 6e 61 62 6c 65 64 20 62 79 20  NOT] enabled by 
58a0: 64 65 66 61 75 6c 74 2e 20 54 68 69 73 20 6c 69  default. This li
58b0: 6d 69 74 61 74 69 6f 6e 20 69 73 20 64 75 65 20  mitation is due 
58c0: 74 6f 20 74 68 65 20 6c 61 63 6b 20 6f 66 20 61  to the lack of a
58d0: 20 63 6f 6d 6d 6f 6e 0a 63 72 6f 73 73 20 70 6c   common.cross pl
58e0: 61 74 66 6f 72 6d 20 64 61 74 61 62 61 73 65 20  atform database 
58f0: 6f 66 20 43 65 72 74 69 66 69 63 61 74 65 20 41  of Certificate A
5900: 75 74 68 6f 72 69 74 79 20 28 43 41 29 20 70 72  uthority (CA) pr
5910: 6f 76 69 64 65 64 20 63 65 72 74 69 66 69 63 61  ovided certifica
5920: 74 65 73 20 74 6f 0a 76 61 6c 69 64 61 74 65 20  tes to.validate 
5930: 61 67 61 69 6e 73 74 2e 20 4d 61 6e 79 20 4c 69  against. Many Li
5940: 6e 75 78 20 73 79 73 74 65 6d 73 20 6e 61 74 69  nux systems nati
5950: 76 65 6c 79 20 73 75 70 70 6f 72 74 20 4f 70 65  vely support Ope
5960: 6e 53 53 4c 20 61 6e 64 20 74 68 75 73 20 68 61  nSSL and thus ha
5970: 76 65 0a 74 68 65 73 65 20 63 65 72 74 69 66 69  ve.these certifi
5980: 63 61 74 65 73 20 69 6e 73 74 61 6c 6c 65 64 20  cates installed 
5990: 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 4f  as part of the O
59a0: 53 2c 20 62 75 74 20 4d 61 63 4f 53 20 61 6e 64  S, but MacOS and
59b0: 20 4d 53 20 57 69 6e 64 6f 77 73 20 64 6f 20 6e   MS Windows do n
59c0: 6f 74 2e 0a 49 6e 20 6f 72 64 65 72 20 74 6f 20  ot..In order to 
59d0: 75 73 65 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  use the [option 
59e0: 2d 72 65 71 75 69 72 65 5d 20 6f 70 74 69 6f 6e  -require] option
59f0: 2c 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f 6c  , one of the fol
5a00: 6c 6f 77 69 6e 67 0a 6d 75 73 74 20 62 65 20 74  lowing.must be t
5a10: 72 75 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  rue:..[list_begi
5a20: 6e 20 69 74 65 6d 69 7a 65 64 5d 0a 0a 5b 69 74  n itemized]..[it
5a30: 65 6d 5d 0a 4f 6e 20 4c 69 6e 75 78 20 61 6e 64  em].On Linux and
5a40: 20 55 6e 69 78 20 73 79 73 74 65 6d 73 20 77 69   Unix systems wi
5a50: 74 68 20 4f 70 65 6e 53 53 4c 20 61 6c 72 65 61  th OpenSSL alrea
5a60: 64 79 20 69 6e 73 74 61 6c 6c 65 64 20 6f 72 20  dy installed or 
5a70: 69 66 20 74 68 65 20 43 41 0a 63 65 72 74 69 66  if the CA.certif
5a80: 69 63 61 74 65 73 20 61 72 65 20 61 76 61 69 6c  icates are avail
5a90: 61 62 6c 65 20 69 6e 20 50 45 4d 20 66 6f 72 6d  able in PEM form
5aa0: 61 74 2c 20 61 6e 64 20 69 66 20 74 68 65 79 20  at, and if they 
5ab0: 61 72 65 20 73 74 6f 72 65 64 20 69 6e 20 74 68  are stored in th
5ac0: 65 0a 73 74 61 6e 64 61 72 64 20 6c 6f 63 61 74  e.standard locat
5ad0: 69 6f 6e 73 2c 20 6f 72 20 69 66 20 74 68 65 20  ions, or if the 
5ae0: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49  [var SSL_CERT_DI
5af0: 52 5d 20 6f 72 20 5b 76 61 72 20 53 53 4c 5f 43  R] or [var SSL_C
5b00: 45 52 54 5f 46 49 4c 45 5d 0a 65 6e 76 69 72 6f  ERT_FILE].enviro
5b10: 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20  nment variables 
5b20: 61 72 65 20 73 65 74 2c 20 74 68 65 6e 20 5b 6f  are set, then [o
5b30: 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 5b  ption -cadir], [
5b40: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a  option -cadir],.
5b50: 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73  and [option -cas
5b60: 74 6f 72 65 5d 20 61 72 65 6e 27 74 20 6e 65 65  tore] aren't nee
5b70: 64 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20  ded...[item].If 
5b80: 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69  OpenSSL is not i
5b90: 6e 73 74 61 6c 6c 65 64 20 69 6e 20 74 68 65 20  nstalled in the 
5ba0: 64 65 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e  default location
5bb0: 2c 20 6f 72 20 77 68 65 6e 20 75 73 69 6e 67 20  , or when using 
5bc0: 4d 61 63 20 4f 53 0a 6f 72 20 4d 53 20 57 69 6e  Mac OS.or MS Win
5bd0: 64 6f 77 73 20 61 6e 64 20 4f 70 65 6e 53 53 4c  dows and OpenSSL
5be0: 20 69 73 20 69 6e 73 74 61 6c 6c 65 64 2c 20 74   is installed, t
5bf0: 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54  he [var SSL_CERT
5c00: 5f 44 49 52 5d 20 61 6e 64 2f 6f 72 0a 5b 76 61  _DIR] and/or.[va
5c10: 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d  r SSL_CERT_FILE]
5c20: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72   environment var
5c30: 69 61 62 6c 65 73 20 6f 72 20 74 68 65 20 6f 6e  iables or the on
5c40: 65 20 6f 66 20 74 68 65 20 5b 6f 70 74 69 6f 6e  e of the [option
5c50: 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f   -cadir],.[optio
5c60: 6e 20 2d 63 61 64 69 72 5d 2c 20 6f 72 20 5b 6f  n -cadir], or [o
5c70: 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20  ption -castore] 
5c80: 6f 70 74 69 6f 6e 73 20 6d 75 73 74 20 62 65 20  options must be 
5c90: 64 65 66 69 6e 65 64 2e 0a 0a 5b 69 74 65 6d 5d  defined...[item]
5ca0: 0a 4f 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c 20  .On MS Windows, 
5cb0: 73 74 61 72 74 69 6e 67 20 69 6e 20 4f 70 65 6e  starting in Open
5cc0: 53 53 4c 20 33 2e 32 2c 20 69 74 20 69 73 20 6e  SSL 3.2, it is n
5cd0: 6f 77 20 70 6f 73 73 69 62 6c 65 20 74 6f 20 61  ow possible to a
5ce0: 63 63 65 73 73 20 74 68 65 0a 62 75 69 6c 74 2d  ccess the.built-
5cf0: 69 6e 20 57 69 6e 64 6f 77 73 20 43 65 72 74 69  in Windows Certi
5d00: 66 69 63 61 74 65 20 53 74 6f 72 65 20 66 72 6f  ficate Store fro
5d10: 6d 20 4f 70 65 6e 53 53 4c 2e 20 54 68 69 73 20  m OpenSSL. This 
5d20: 63 61 6e 20 75 74 69 6c 69 7a 65 64 20 62 79 0a  can utilized by.
5d30: 73 65 74 74 69 6e 67 20 74 68 65 20 5b 6f 70 74  setting the [opt
5d40: 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70  ion -castore] op
5d50: 74 69 6f 6e 20 74 6f 20 22 5b 63 6f 6e 73 74 20  tion to "[const 
5d60: 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e 73  org.openssl.wins
5d70: 74 6f 72 65 3a 2f 2f 5d 22 2e 0a 0a 5b 69 74 65  tore://]"...[ite
5d80: 6d 5d 0a 49 66 20 4f 70 65 6e 53 53 4c 20 69 73  m].If OpenSSL is
5d90: 20 6e 6f 74 20 69 6e 73 74 61 6c 6c 65 64 20 6f   not installed o
5da0: 72 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69  r the CA certifi
5db0: 63 61 74 65 73 20 61 72 65 20 6e 6f 74 20 61 76  cates are not av
5dc0: 61 69 6c 61 62 6c 65 20 69 6e 20 50 45 4d 0a 66  ailable in PEM.f
5dd0: 6f 72 6d 61 74 2c 20 74 68 65 20 43 41 20 63 65  ormat, the CA ce
5de0: 72 74 69 66 69 63 61 74 65 73 20 6d 75 73 74 20  rtificates must 
5df0: 62 65 20 64 6f 77 6e 6c 6f 61 64 65 64 20 61 6e  be downloaded an
5e00: 64 20 69 6e 73 74 61 6c 6c 65 64 20 77 69 74 68  d installed with
5e10: 20 74 68 65 20 75 73 65 72 0a 73 6f 66 74 77 61   the user.softwa
5e20: 72 65 2e 20 54 68 65 20 43 55 52 4c 20 74 65 61  re. The CURL tea
5e30: 6d 20 6d 61 6b 65 73 20 74 68 65 6d 20 61 76 61  m makes them ava
5e40: 69 6c 61 62 6c 65 20 61 74 0a 5b 75 72 69 20 22  ilable at.[uri "
5e50: 68 74 74 70 73 3a 2f 2f 63 75 72 6c 2e 73 65 2f  https://curl.se/
5e60: 64 6f 63 73 2f 63 61 65 78 74 72 61 63 74 2e 68  docs/caextract.h
5e70: 74 6d 6c 22 20 22 43 41 20 63 65 72 74 69 66 69  tml" "CA certifi
5e80: 63 61 74 65 73 20 65 78 74 72 61 63 74 65 64 0a  cates extracted.
5e90: 66 72 6f 6d 20 4d 6f 7a 69 6c 6c 61 22 5d 20 69  from Mozilla"] i
5ea0: 6e 20 74 68 65 20 5b 66 69 6c 65 20 63 61 63 65  n the [file cace
5eb0: 72 74 2e 70 65 6d 5d 20 66 69 6c 65 2e 20 59 6f  rt.pem] file. Yo
5ec0: 75 20 6d 75 73 74 20 74 68 65 6e 20 65 69 74 68  u must then eith
5ed0: 65 72 20 73 65 74 20 74 68 65 0a 5b 76 61 72 20  er set the.[var 
5ee0: 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20 61 6e  SSL_CERT_DIR] an
5ef0: 64 2f 6f 72 20 5b 76 61 72 20 53 53 4c 5f 43 45  d/or [var SSL_CE
5f00: 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e  RT_FILE] environ
5f10: 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20 6f  ment variables o
5f20: 72 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63  r the.[option -c
5f30: 61 64 69 72 5d 20 6f 72 20 5b 6f 70 74 69 6f 6e  adir] or [option
5f40: 20 2d 63 61 66 69 6c 65 5d 20 6f 70 74 69 6f 6e   -cafile] option
5f50: 73 20 74 6f 20 74 68 65 20 43 41 20 63 65 72 74  s to the CA cert
5f60: 20 66 69 6c 65 27 73 20 69 6e 73 74 61 6c 6c 0a   file's install.
5f70: 6c 6f 63 61 74 69 6f 6e 2e 20 49 74 20 69 73 20  location. It is 
5f80: 79 6f 75 72 20 72 65 73 70 6f 6e 73 69 62 69 6c  your responsibil
5f90: 69 74 79 20 74 6f 20 6b 65 65 70 20 74 68 69 73  ity to keep this
5fa0: 20 66 69 6c 65 20 75 70 20 74 6f 20 64 61 74 65   file up to date
5fb0: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
5fc0: 73 65 63 74 69 6f 6e 20 22 43 61 6c 6c 62 61 63  section "Callbac
5fd0: 6b 20 4f 70 74 69 6f 6e 73 22 5d 0a 0a 41 73 20  k Options"]..As 
5fe0: 70 72 65 76 69 6f 75 73 6c 79 20 64 65 73 63 72  previously descr
5ff0: 69 62 65 64 2c 20 65 61 63 68 20 63 68 61 6e 6e  ibed, each chann
6000: 65 6c 20 63 61 6e 20 62 65 20 67 69 76 65 6e 20  el can be given 
6010: 74 68 65 69 72 20 6f 77 6e 20 63 61 6c 6c 62 61  their own callba
6020: 63 6b 73 0a 74 6f 20 68 61 6e 64 6c 65 20 69 6e  cks.to handle in
6030: 74 65 72 6d 65 64 69 61 74 65 20 70 72 6f 63 65  termediate proce
6040: 73 73 69 6e 67 20 62 79 20 74 68 65 20 4f 70 65  ssing by the Ope
6050: 6e 53 53 4c 20 6c 69 62 72 61 72 79 2c 20 75 73  nSSL library, us
6060: 69 6e 67 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20  ing the.[option 
6070: 2d 63 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69  -command], [opti
6080: 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 2c 20 61  on -password], a
6090: 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69  nd [option -vali
60a0: 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70  date_command] op
60b0: 74 69 6f 6e 73 0a 70 61 73 73 65 64 20 74 6f 20  tions.passed to 
60c0: 65 69 74 68 65 72 20 6f 66 20 5b 63 6d 64 20 74  either of [cmd t
60d0: 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 6f 72 20 5b  ls::socket] or [
60e0: 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d  cmd tls::import]
60f0: 2e 0a 55 6e 6c 69 6b 65 20 70 72 65 76 69 6f 75  ..Unlike previou
6100: 73 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 54 63  s versions of Tc
6110: 6c 54 4c 53 2c 20 6f 6e 6c 79 20 69 66 20 74 68  lTLS, only if th
6120: 65 20 63 61 6c 6c 62 61 63 6b 20 67 65 6e 65 72  e callback gener
6130: 61 74 65 73 20 61 6e 20 65 72 72 6f 72 2c 0a 77  ates an error,.w
6140: 69 6c 6c 20 74 68 65 20 5b 73 79 73 63 6d 64 20  ill the [syscmd 
6150: 62 67 65 72 72 6f 72 5d 20 63 6f 6d 6d 61 6e 64  bgerror] command
6160: 20 62 65 20 69 6e 76 6f 6b 65 64 20 77 69 74 68   be invoked with
6170: 20 74 68 65 20 65 72 72 6f 72 20 69 6e 66 6f 72   the error infor
6180: 6d 61 74 69 6f 6e 2e 0a 0a 5b 73 75 62 73 65 63  mation...[subsec
6190: 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f 72  tion "Values for
61a0: 20 43 6f 6d 6d 61 6e 64 20 43 61 6c 6c 62 61 63   Command Callbac
61b0: 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63  k"]..The callbac
61c0: 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f  k for the [optio
61d0: 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69  n -command] opti
61e0: 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20 61 74  on is invoked at
61f0: 20 73 65 76 65 72 61 6c 20 70 6f 69 6e 74 73 20   several points 
6200: 64 75 72 69 6e 67 20 74 68 65 0a 4f 70 65 6e 53  during the.OpenS
6210: 53 4c 20 68 61 6e 64 73 68 61 6b 65 20 61 6e 64  SL handshake and
6220: 20 64 75 72 69 6e 67 20 72 6f 75 74 69 6e 65 20   during routine 
6230: 6f 70 65 72 61 74 69 6f 6e 73 2e 20 53 65 65 20  operations. See 
6240: 62 65 6c 6f 77 20 66 6f 72 20 74 68 65 20 70 6f  below for the po
6250: 73 73 69 62 6c 65 0a 61 72 67 75 6d 65 6e 74 73  ssible.arguments
6260: 20 70 61 73 73 65 64 20 74 6f 20 74 68 65 20 63   passed to the c
6270: 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 2e 20  allback script. 
6280: 56 61 6c 75 65 73 20 72 65 74 75 72 6e 65 64 20  Values returned 
6290: 66 72 6f 6d 20 74 68 65 20 63 61 6c 6c 62 61 63  from the callbac
62a0: 6b 20 61 72 65 0a 69 67 6e 6f 72 65 64 2e 0a 0a  k are.ignored...
62b0: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74 69  [list_begin opti
62c0: 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 65  ons]..[opt_def e
62d0: 72 72 6f 72 20 5b 61 72 67 20 22 63 68 61 6e 6e  rror [arg "chann
62e0: 65 6c 49 64 20 6d 65 73 73 61 67 65 22 5d 5d 0a  elId message"]].
62f0: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
6300: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
6310: 20 77 68 65 6e 65 76 65 72 20 61 6e 20 65 72 72   whenever an err
6320: 6f 72 20 6f 63 63 75 72 73 20 64 75 72 69 6e 67  or occurs during
6330: 20 74 68 65 20 69 6e 69 74 69 61 6c 0a 63 6f 6e   the initial.con
6340: 6e 65 63 74 69 6f 6e 2c 20 68 61 6e 64 73 68 61  nection, handsha
6350: 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f 70 65 72 61  ke, or I/O opera
6360: 74 69 6f 6e 73 2e 20 54 68 65 20 5b 61 72 67 20  tions. The [arg 
6370: 6d 65 73 73 61 67 65 5d 20 61 72 67 75 6d 65 6e  message] argumen
6380: 74 20 63 61 6e 20 62 65 0a 66 72 6f 6d 20 74 68  t can be.from th
6390: 65 20 54 63 6c 5f 45 72 72 6e 6f 4d 73 67 2c 20  e Tcl_ErrnoMsg, 
63a0: 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e  OpenSSL function
63b0: 20 5b 66 75 6e 20 45 52 52 5f 72 65 61 73 6f 6e   [fun ERR_reason
63c0: 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67 28 29 5d  _error_string()]
63d0: 2c 0a 6f 72 20 61 20 63 75 73 74 6f 6d 20 6d 65  ,.or a custom me
63e0: 73 73 61 67 65 2e 20 54 68 69 73 20 63 61 6c 6c  ssage. This call
63f0: 62 61 63 6b 20 69 73 20 6e 65 77 20 66 6f 72 20  back is new for 
6400: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70  TclTLS 1.8...[op
6410: 74 5f 64 65 66 20 69 6e 66 6f 20 5b 61 72 67 20  t_def info [arg 
6420: 22 63 68 61 6e 6e 65 6c 49 64 20 6d 61 6a 6f 72  "channelId major
6430: 20 6d 69 6e 6f 72 20 6d 65 73 73 61 67 65 20 74   minor message t
6440: 79 70 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d  ype"]].This form
6450: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20   of callback is 
6460: 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20 4f  invoked by the O
6470: 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a  penSSL function.
6480: 5b 66 75 6e 20 53 53 4c 5f 73 65 74 5f 69 6e 66  [fun SSL_set_inf
6490: 6f 5f 63 61 6c 6c 62 61 63 6b 28 29 5d 20 64 75  o_callback()] du
64a0: 72 69 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c  ring the initial
64b0: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61 6e 64 20   connection and 
64c0: 68 61 6e 64 73 68 61 6b 65 0a 6f 70 65 72 61 74  handshake.operat
64d0: 69 6f 6e 73 2e 20 54 68 65 20 61 72 67 75 6d 65  ions. The argume
64e0: 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f  nts are:..[list_
64f0: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
6500: 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 61  s]..[def [arg ma
6510: 6a 6f 72 5d 5d 0a 4d 61 6a 6f 72 20 63 61 74 65  jor]].Major cate
6520: 67 6f 72 79 20 66 6f 72 20 65 72 72 6f 72 2e 20  gory for error. 
6530: 56 61 6c 69 64 20 65 6e 75 6d 73 20 61 72 65 3a  Valid enums are:
6540: 20 5b 63 6f 6e 73 74 20 68 61 6e 64 73 68 61 6b   [const handshak
6550: 65 5d 2c 20 5b 63 6f 6e 73 74 20 61 6c 65 72 74  e], [const alert
6560: 5d 2c 0a 5b 63 6f 6e 73 74 20 63 6f 6e 6e 65 63  ],.[const connec
6570: 74 5d 2c 20 5b 63 6f 6e 73 74 20 61 63 63 65 70  t], [const accep
6580: 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d  t]...[def [arg m
6590: 69 6e 6f 72 5d 5d 0a 4d 69 6e 6f 72 20 63 61 74  inor]].Minor cat
65a0: 65 67 6f 72 79 20 66 6f 72 20 65 72 72 6f 72 2e  egory for error.
65b0: 20 56 61 6c 69 64 20 65 6e 75 6d 73 20 61 72 65   Valid enums are
65c0: 3a 20 5b 63 6f 6e 73 74 20 73 74 61 72 74 5d 2c  : [const start],
65d0: 20 5b 63 6f 6e 73 74 20 64 6f 6e 65 5d 2c 20 5b   [const done], [
65e0: 63 6f 6e 73 74 20 72 65 61 64 5d 2c 0a 5b 63 6f  const read],.[co
65f0: 6e 73 74 20 77 72 69 74 65 5d 2c 20 5b 63 6f 6e  nst write], [con
6600: 73 74 20 6c 6f 6f 70 5d 2c 20 5b 63 6f 6e 73 74  st loop], [const
6610: 20 65 78 69 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61   exit]...[def [a
6620: 72 67 20 6d 65 73 73 61 67 65 5d 5d 0a 44 65 73  rg message]].Des
6630: 63 72 69 70 74 69 76 65 20 6d 65 73 73 61 67 65  criptive message
6640: 20 73 74 72 69 6e 67 20 77 68 69 63 68 20 6d 61   string which ma
6650: 79 20 62 65 20 67 65 6e 65 72 61 74 65 64 20 65  y be generated e
6660: 69 74 68 65 72 20 62 79 0a 5b 66 75 6e 20 53 53  ither by.[fun SS
6670: 4c 5f 73 74 61 74 65 5f 73 74 72 69 6e 67 5f 6c  L_state_string_l
6680: 6f 6e 67 28 29 5d 20 6f 72 20 5b 66 75 6e 20 53  ong()] or [fun S
6690: 53 4c 5f 61 6c 65 72 74 5f 64 65 73 63 5f 73 74  SL_alert_desc_st
66a0: 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d 2c 0a 64 65  ring_long()],.de
66b0: 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68 65 20 63  pending on the c
66c0: 6f 6e 74 65 78 74 2e 0a 0a 5b 64 65 66 20 5b 61  ontext...[def [a
66d0: 72 67 20 74 79 70 65 5d 5d 0a 46 6f 72 20 61 6c  rg type]].For al
66e0: 65 72 74 73 2c 20 74 68 65 20 70 6f 73 73 69 62  erts, the possib
66f0: 6c 65 20 76 61 6c 75 65 73 20 61 72 65 3a 20 5b  le values are: [
6700: 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67 5d 2c 0a  const warning],.
6710: 5b 63 6f 6e 73 74 20 66 61 74 61 6c 5d 2c 20 61  [const fatal], a
6720: 6e 64 20 5b 63 6f 6e 73 74 20 75 6e 6b 6e 6f 77  nd [const unknow
6730: 6e 5d 2e 20 46 6f 72 20 6f 74 68 65 72 73 2c 20  n]. For others, 
6740: 5b 63 6f 6e 73 74 20 69 6e 66 6f 5d 20 69 73 20  [const info] is 
6750: 75 73 65 64 2e 0a 54 68 69 73 20 61 72 67 75 6d  used..This argum
6760: 65 6e 74 20 69 73 20 6e 65 77 20 66 6f 72 20 54  ent is new for T
6770: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73  clTLS 1.8...[lis
6780: 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66  t_end]..[opt_def
6790: 20 6d 65 73 73 61 67 65 20 5b 61 72 67 20 22 63   message [arg "c
67a0: 68 61 6e 6e 65 6c 49 64 20 64 69 72 65 63 74 69  hannelId directi
67b0: 6f 6e 20 76 65 72 73 69 6f 6e 20 63 6f 6e 74 65  on version conte
67c0: 6e 74 5f 74 79 70 65 20 6d 65 73 73 61 67 65 22  nt_type message"
67d0: 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20  ]].This form of 
67e0: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f  callback is invo
67f0: 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53  ked by the OpenS
6800: 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e  SL function.[fun
6810: 20 53 53 4c 5f 73 65 74 5f 6d 73 67 5f 63 61 6c   SSL_set_msg_cal
6820: 6c 62 61 63 6b 28 29 5d 20 77 68 65 6e 65 76 65  lback()] wheneve
6830: 72 20 61 20 6d 65 73 73 61 67 65 20 69 73 20 73  r a message is s
6840: 65 6e 74 20 6f 72 20 72 65 63 65 69 76 65 64 20  ent or received 
6850: 64 75 72 69 6e 67 20 74 68 65 0a 69 6e 69 74 69  during the.initi
6860: 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68  al connection, h
6870: 61 6e 64 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f  andshake, or I/O
6880: 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 49 74 20   operations. It 
6890: 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c  is only availabl
68a0: 65 20 77 68 65 6e 0a 4f 70 65 6e 53 53 4c 20 69  e when.OpenSSL i
68b0: 73 20 63 6f 6d 70 6c 69 65 64 20 77 69 74 68 20  s complied with 
68c0: 74 68 65 20 5b 63 6f 6e 73 74 20 65 6e 61 62 6c  the [const enabl
68d0: 65 2d 73 73 6c 2d 74 72 61 63 65 5d 20 6f 70 74  e-ssl-trace] opt
68e0: 69 6f 6e 2e 20 54 68 69 73 20 63 61 6c 6c 62 61  ion. This callba
68f0: 63 6b 20 69 73 0a 6e 65 77 20 66 6f 72 20 54 63  ck is.new for Tc
6900: 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65 20 61 72  lTLS 1.8. The ar
6910: 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c  guments are:..[l
6920: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
6930: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72  tions]..[def [ar
6940: 67 20 64 69 72 65 63 74 69 6f 6e 5d 5d 0a 44 69  g direction]].Di
6950: 72 65 63 74 69 6f 6e 20 69 73 20 65 69 74 68 65  rection is eithe
6960: 72 20 5b 63 6f 6e 73 74 20 53 65 6e 74 5d 20 6f  r [const Sent] o
6970: 72 20 5b 63 6f 6e 73 74 20 52 65 63 65 69 76 65  r [const Receive
6980: 64 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 76  d]...[def [arg v
6990: 65 72 73 69 6f 6e 5d 5d 0a 56 65 72 73 69 6f 6e  ersion]].Version
69a0: 20 69 73 20 74 68 65 20 70 72 6f 74 6f 63 6f 6c   is the protocol
69b0: 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20   version...[def 
69c0: 5b 61 72 67 20 63 6f 6e 74 65 6e 74 5f 74 79 70  [arg content_typ
69d0: 65 5d 5d 0a 43 6f 6e 74 65 6e 74 20 74 79 70 65  e]].Content type
69e0: 20 69 73 20 74 68 65 20 6d 65 73 73 61 67 65 20   is the message 
69f0: 63 6f 6e 74 65 6e 74 20 74 79 70 65 2e 0a 0a 5b  content type...[
6a00: 64 65 66 20 5b 61 72 67 20 6d 65 73 73 61 67 65  def [arg message
6a10: 5d 5d 0a 4d 65 73 73 61 67 65 20 69 73 20 6d 6f  ]].Message is mo
6a20: 72 65 20 69 6e 66 6f 20 66 72 6f 6d 20 74 68 65  re info from the
6a30: 20 5b 63 6f 6e 73 74 20 53 53 4c 5f 74 72 61 63   [const SSL_trac
6a40: 65 5d 20 41 50 49 2e 0a 0a 5b 6c 69 73 74 5f 65  e] API...[list_e
6a50: 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 73 65  nd]..[opt_def se
6a60: 73 73 69 6f 6e 20 5b 61 72 67 20 22 63 68 61 6e  ssion [arg "chan
6a70: 6e 65 6c 49 64 20 73 65 73 73 69 6f 6e 5f 69 64  nelId session_id
6a80: 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74 20   session_ticket 
6a90: 6c 69 66 65 74 69 6d 65 22 5d 5d 0a 54 68 69 73  lifetime"]].This
6aa0: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63   form of callbac
6ab0: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20  k is invoked by 
6ac0: 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63  the OpenSSL func
6ad0: 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 43 54  tion.[fun SSL_CT
6ae0: 58 5f 73 65 73 73 5f 73 65 74 5f 6e 65 77 5f 63  X_sess_set_new_c
6af0: 62 28 29 5d 20 77 68 65 6e 65 76 65 72 20 61 20  b()] whenever a 
6b00: 6e 65 77 20 73 65 73 73 69 6f 6e 20 69 64 20 69  new session id i
6b10: 73 20 73 65 6e 74 20 62 79 20 74 68 65 0a 73 65  s sent by the.se
6b20: 72 76 65 72 20 64 75 72 69 6e 67 20 74 68 65 20  rver during the 
6b30: 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69  initial connecti
6b40: 6f 6e 20 61 6e 64 20 68 61 6e 64 73 68 61 6b 65  on and handshake
6b50: 20 61 6e 64 20 61 6c 73 6f 20 64 75 72 69 6e 67   and also during
6b60: 20 74 68 65 20 73 65 73 73 69 6f 6e 0a 69 66 20   the session.if 
6b70: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70 6f 73  the [option -pos
6b80: 74 5f 68 61 6e 64 73 68 61 6b 65 5d 20 6f 70 74  t_handshake] opt
6b90: 69 6f 6e 20 69 73 20 73 65 74 20 74 6f 20 74 72  ion is set to tr
6ba0: 75 65 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63  ue. This callbac
6bb0: 6b 20 69 73 20 6e 65 77 20 66 6f 72 0a 54 63 6c  k is new for.Tcl
6bc0: 54 4c 53 20 31 2e 38 2e 20 54 68 65 20 61 72 67  TLS 1.8. The arg
6bd0: 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69  uments are:..[li
6be0: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
6bf0: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67  ions]..[def [arg
6c00: 20 73 65 73 73 69 6f 6e 5f 69 64 5d 5d 0a 53 65   session_id]].Se
6c10: 73 73 69 6f 6e 20 49 64 20 69 73 20 74 68 65 20  ssion Id is the 
6c20: 63 75 72 72 65 6e 74 20 73 65 73 73 69 6f 6e 20  current session 
6c30: 69 64 65 6e 74 69 66 69 65 72 0a 0a 5b 64 65 66  identifier..[def
6c40: 20 5b 61 72 67 20 73 65 73 73 69 6f 6e 5f 74 69   [arg session_ti
6c50: 63 6b 65 74 5d 5d 0a 54 69 63 6b 65 74 20 69 73  cket]].Ticket is
6c60: 20 74 68 65 20 73 65 73 73 69 6f 6e 20 74 69 63   the session tic
6c70: 6b 65 74 20 69 6e 66 6f 0a 0a 5b 64 65 66 20 5b  ket info..[def [
6c80: 61 72 67 20 6c 69 66 65 74 69 6d 65 5d 5d 0a 4c  arg lifetime]].L
6c90: 69 66 65 74 69 6d 65 20 69 73 20 74 68 65 20 74  ifetime is the t
6ca0: 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 20 69  icket lifetime i
6cb0: 6e 20 73 65 63 6f 6e 64 73 2e 0a 0a 5b 6c 69 73  n seconds...[lis
6cc0: 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66  t_end]..[opt_def
6cd0: 20 76 65 72 69 66 79 20 5b 61 72 67 20 22 63 68   verify [arg "ch
6ce0: 61 6e 6e 65 6c 49 64 20 64 65 70 74 68 20 63 65  annelId depth ce
6cf0: 72 74 20 73 74 61 74 75 73 20 65 72 72 6f 72 22  rt status error"
6d00: 5d 5d 0a 54 68 69 73 20 63 61 6c 6c 62 61 63 6b  ]].This callback
6d10: 20 77 61 73 20 6d 6f 76 65 64 20 74 6f 20 5b 6f   was moved to [o
6d20: 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63  ption -validatec
6d30: 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54 63 6c 54 4c  ommand] in TclTL
6d40: 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e  S 1.8...[list_en
6d50: 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20  d]..[subsection 
6d60: 22 56 61 6c 75 65 73 20 66 6f 72 20 50 61 73 73  "Values for Pass
6d70: 77 6f 72 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a  word Callback"].
6d80: 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f  .The callback fo
6d90: 72 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70  r the [option -p
6da0: 61 73 73 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 20  assword] option 
6db0: 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 54 63  is invoked by Tc
6dc0: 6c 54 4c 53 20 77 68 65 6e 65 76 65 72 20 4f 70  lTLS whenever Op
6dd0: 65 6e 53 53 4c 20 6e 65 65 64 73 0a 74 6f 20 6f  enSSL needs.to o
6de0: 62 74 61 69 6e 20 61 20 70 61 73 73 77 6f 72 64  btain a password
6df0: 2e 20 53 65 65 20 62 65 6c 6f 77 20 66 6f 72 20  . See below for 
6e00: 74 68 65 20 70 6f 73 73 69 62 6c 65 20 61 72 67  the possible arg
6e10: 75 6d 65 6e 74 73 20 70 61 73 73 65 64 20 74 6f  uments passed to
6e20: 20 74 68 65 0a 63 61 6c 6c 62 61 63 6b 20 73 63   the.callback sc
6e30: 72 69 70 74 2e 20 54 68 65 20 75 73 65 72 20 70  ript. The user p
6e40: 72 6f 76 69 64 65 64 20 70 61 73 73 77 6f 72 64  rovided password
6e50: 20 69 73 20 65 78 70 65 63 74 65 64 20 74 6f 20   is expected to 
6e60: 62 65 20 72 65 74 75 72 6e 65 64 20 62 79 20 74  be returned by t
6e70: 68 65 0a 63 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6c  he.callback...[l
6e80: 69 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e  ist_begin option
6e90: 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 70 61 73  s]..[opt_def pas
6ea0: 73 77 6f 72 64 20 5b 61 72 67 20 22 72 77 66 6c  sword [arg "rwfl
6eb0: 61 67 20 73 69 7a 65 22 5d 5d 0a 49 6e 76 6f 6b  ag size"]].Invok
6ec0: 65 64 20 77 68 65 6e 20 6c 6f 61 64 69 6e 67 20  ed when loading 
6ed0: 6f 72 20 73 74 6f 72 69 6e 67 20 61 6e 20 65 6e  or storing an en
6ee0: 63 72 79 70 74 65 64 20 50 45 4d 20 63 65 72 74  crypted PEM cert
6ef0: 69 66 69 63 61 74 65 2e 20 54 68 65 20 61 72 67  ificate. The arg
6f00: 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69  uments are:..[li
6f10: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
6f20: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67  ions]..[def [arg
6f30: 20 72 77 66 6c 61 67 5d 5d 0a 54 68 65 20 72 65   rwflag]].The re
6f40: 61 64 2f 77 72 69 74 65 20 66 6c 61 67 20 69 73  ad/write flag is
6f50: 20 30 20 66 6f 72 20 72 65 61 64 69 6e 67 2f 64   0 for reading/d
6f60: 65 63 72 79 70 74 69 6f 6e 20 6f 72 20 31 20 66  ecryption or 1 f
6f70: 6f 72 20 77 72 69 74 69 6e 67 2f 65 6e 63 72 79  or writing/encry
6f80: 70 74 69 6f 6e 2e 0a 54 68 65 20 6c 61 74 74 65  ption..The latte
6f90: 72 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f  r can be used to
6fa0: 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 6e 20   determine when 
6fb0: 74 6f 20 70 72 6f 6d 70 74 20 74 68 65 20 75 73  to prompt the us
6fc0: 65 72 20 74 6f 20 63 6f 6e 66 69 72 6d 2e 0a 54  er to confirm..T
6fd0: 68 69 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20  his argument is 
6fe0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
6ff0: 2e 38 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73  .8...[def [arg s
7000: 69 7a 65 5d 5d 0a 54 68 65 20 73 69 7a 65 20 69  ize]].The size i
7010: 73 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 6c 65  s the maximum le
7020: 6e 67 74 68 20 6f 66 20 74 68 65 20 70 61 73 73  ngth of the pass
7030: 77 6f 72 64 20 69 6e 20 62 79 74 65 73 2e 0a 54  word in bytes..T
7040: 68 69 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20  his argument is 
7050: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
7060: 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  .8...[list_end].
7070: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75  .[list_end]..[su
7080: 62 73 65 63 74 69 6f 6e 20 22 56 61 6c 75 65 73  bsection "Values
7090: 20 66 6f 72 20 56 61 6c 69 64 61 74 65 20 43 6f   for Validate Co
70a0: 6d 6d 61 6e 64 20 43 61 6c 6c 62 61 63 6b 22 5d  mmand Callback"]
70b0: 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 66  ..The callback f
70c0: 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  or the [option -
70d0: 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d  validatecommand]
70e0: 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b   option is invok
70f0: 65 64 20 64 75 72 69 6e 67 20 74 68 65 20 68 61  ed during the ha
7100: 6e 64 73 68 61 6b 65 0a 70 72 6f 63 65 73 73 20  ndshake.process 
7110: 69 6e 20 6f 72 64 65 72 20 66 6f 72 20 74 68 65  in order for the
7120: 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 74 6f 20   application to 
7130: 76 61 6c 69 64 61 74 65 20 74 68 65 20 70 72 6f  validate the pro
7140: 76 69 64 65 64 20 76 61 6c 75 65 28 73 29 2e 20  vided value(s). 
7150: 53 65 65 0a 62 65 6c 6f 77 20 66 6f 72 20 74 68  See.below for th
7160: 65 20 70 6f 73 73 69 62 6c 65 20 61 72 67 75 6d  e possible argum
7170: 65 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20 74  ents passed to t
7180: 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 69  he callback scri
7190: 70 74 2e 20 49 66 20 6e 6f 74 0a 73 70 65 63 69  pt. If not.speci
71a0: 66 69 65 64 2c 20 4f 70 65 6e 53 53 4c 20 77 69  fied, OpenSSL wi
71b0: 6c 6c 20 61 63 63 65 70 74 20 61 6c 6c 20 76 61  ll accept all va
71c0: 6c 69 64 20 63 65 72 74 69 66 69 63 61 74 65 73  lid certificates
71d0: 20 61 6e 64 20 65 78 74 65 6e 73 69 6f 6e 73 2e   and extensions.
71e0: 20 54 6f 20 72 65 6a 65 63 74 0a 74 68 65 20 76   To reject.the v
71f0: 61 6c 75 65 20 61 6e 64 20 61 62 6f 72 74 20 74  alue and abort t
7200: 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 74  he connection, t
7210: 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 68 6f 75  he callback shou
7220: 6c 64 20 72 65 74 75 72 6e 20 30 2e 20 54 6f 20  ld return 0. To 
7230: 61 63 63 65 70 74 20 74 68 65 0a 76 61 6c 75 65  accept the.value
7240: 20 61 6e 64 20 63 6f 6e 74 69 6e 75 65 20 74 68   and continue th
7250: 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 74  e connection, it
7260: 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 31   should return 1
7270: 2e 20 54 6f 20 72 65 6a 65 63 74 20 74 68 65 20  . To reject the 
7280: 76 61 6c 75 65 2c 20 62 75 74 0a 63 6f 6e 74 69  value, but.conti
7290: 6e 75 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69  nue the connecti
72a0: 6f 6e 2c 20 69 74 20 73 68 6f 75 6c 64 20 72 65  on, it should re
72b0: 74 75 72 6e 20 32 2e 20 54 68 69 73 20 63 61 6c  turn 2. This cal
72c0: 6c 62 61 63 6b 20 69 73 20 6e 65 77 20 66 6f 72  lback is new for
72d0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c   TclTLS 1.8...[l
72e0: 69 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e  ist_begin option
72f0: 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 61 6c 70  s]..[opt_def alp
7300: 6e 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49  n [arg "channelI
7310: 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 61 74 63 68  d protocol match
7320: 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65 72 73 2c  "]].For servers,
7330: 20 74 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61   this form of ca
7340: 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65  llback is invoke
7350: 64 20 77 68 65 6e 20 74 68 65 20 63 6c 69 65 6e  d when the clien
7360: 74 20 41 4c 50 4e 20 65 78 74 65 6e 73 69 6f 6e  t ALPN extension
7370: 20 69 73 0a 72 65 63 65 69 76 65 64 2e 20 49 66   is.received. If
7380: 20 5b 61 72 67 20 6d 61 74 63 68 5d 20 69 73 20   [arg match] is 
7390: 74 72 75 65 2c 20 74 68 65 6e 20 5b 61 72 67 20  true, then [arg 
73a0: 70 72 6f 74 6f 63 6f 6c 5d 20 69 73 20 74 68 65  protocol] is the
73b0: 20 66 69 72 73 74 0a 5b 6f 70 74 69 6f 6e 20 2d   first.[option -
73c0: 61 6c 70 6e 5d 20 70 72 6f 74 6f 63 6f 6c 20 6f  alpn] protocol o
73d0: 70 74 69 6f 6e 20 69 6e 20 63 6f 6d 6d 6f 6e 20  ption in common 
73e0: 74 6f 20 62 6f 74 68 20 74 68 65 20 63 6c 69 65  to both the clie
73f0: 6e 74 20 61 6e 64 20 73 65 72 76 65 72 2e 0a 49  nt and server..I
7400: 66 20 6e 6f 74 2c 20 74 68 65 20 66 69 72 73 74  f not, the first
7410: 20 63 6c 69 65 6e 74 20 73 70 65 63 69 66 69 65   client specifie
7420: 64 20 70 72 6f 74 6f 63 6f 6c 20 69 73 20 75 73  d protocol is us
7430: 65 64 2e 20 54 68 69 73 20 63 61 6c 6c 62 61 63  ed. This callbac
7440: 6b 20 69 73 20 63 61 6c 6c 65 64 0a 61 66 74 65  k is called.afte
7450: 72 20 74 68 65 20 48 65 6c 6c 6f 20 61 6e 64 20  r the Hello and 
7460: 41 4c 50 4e 20 63 61 6c 6c 62 61 63 6b 73 2e 0a  ALPN callbacks..
7470: 0a 5b 6f 70 74 5f 64 65 66 20 68 65 6c 6c 6f 20  .[opt_def hello 
7480: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20  [arg "channelId 
7490: 73 65 72 76 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f  servername"]].Fo
74a0: 72 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 20  r servers, this 
74b0: 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b  form of callback
74c0: 20 69 73 20 69 6e 76 6f 6b 65 64 20 64 75 72 69   is invoked duri
74d0: 6e 67 20 63 6c 69 65 6e 74 20 68 65 6c 6c 6f 20  ng client hello 
74e0: 6d 65 73 73 61 67 65 0a 70 72 6f 63 65 73 73 69  message.processi
74f0: 6e 67 2e 20 54 68 65 20 70 75 72 70 6f 73 65 20  ng. The purpose 
7500: 69 73 20 73 6f 20 74 68 65 20 73 65 72 76 65 72  is so the server
7510: 20 63 61 6e 20 73 65 6c 65 63 74 20 74 68 65 20   can select the 
7520: 61 70 70 72 6f 70 72 69 61 74 65 20 63 65 72 74  appropriate cert
7530: 69 66 69 63 61 74 65 0a 74 6f 20 70 72 65 73 65  ificate.to prese
7540: 6e 74 20 74 6f 20 74 68 65 20 63 6c 69 65 6e 74  nt to the client
7550: 2c 20 61 6e 64 20 74 6f 20 6d 61 6b 65 20 6f 74  , and to make ot
7560: 68 65 72 20 63 6f 6e 66 69 67 75 72 61 74 69 6f  her configuratio
7570: 6e 20 61 64 6a 75 73 74 6d 65 6e 74 73 20 72 65  n adjustments re
7580: 6c 65 76 61 6e 74 0a 74 6f 20 74 68 61 74 20 73  levant.to that s
7590: 65 72 76 65 72 20 6e 61 6d 65 20 61 6e 64 20 69  erver name and i
75a0: 74 73 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e  ts configuration
75b0: 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64 20 62  . It is called b
75c0: 65 66 6f 72 65 20 74 68 65 20 53 4e 49 20 61 6e  efore the SNI an
75d0: 64 20 41 4c 50 4e 0a 63 61 6c 6c 62 61 63 6b 73  d ALPN.callbacks
75e0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 73 6e 69 20  ...[opt_def sni 
75f0: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20  [arg "channelId 
7600: 73 65 72 76 65 72 6e 61 6d 65 22 5d 5d 0a 46 6f  servername"]].Fo
7610: 72 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 20  r servers, this 
7620: 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b  form of callback
7630: 20 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e   is invoked when
7640: 20 74 68 65 20 53 65 72 76 65 72 20 4e 61 6d 65   the Server Name
7650: 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53 4e 49   Indication.(SNI
7660: 29 20 65 78 74 65 6e 73 69 6f 6e 20 69 73 20 72  ) extension is r
7670: 65 63 65 69 76 65 64 2e 20 54 68 65 20 5b 61 72  eceived. The [ar
7680: 67 20 73 65 72 76 65 72 6e 61 6d 65 5d 20 61 72  g servername] ar
7690: 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20 63 6c  gument is the cl
76a0: 69 65 6e 74 0a 70 72 6f 76 69 64 65 64 20 73 65  ient.provided se
76b0: 72 76 65 72 20 6e 61 6d 65 20 73 70 65 63 69 66  rver name specif
76c0: 69 65 64 20 69 6e 20 74 68 65 20 5b 6f 70 74 69  ied in the [opti
76d0: 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65 3c 2f  on -servername</
76e0: 62 3e 5d 20 6f 70 74 69 6f 6e 2e 20 54 68 65 0a  b>] option. The.
76f0: 70 75 72 70 6f 73 65 20 69 73 20 73 6f 20 77 68  purpose is so wh
7700: 65 6e 20 61 20 73 65 72 76 65 72 20 73 75 70 70  en a server supp
7710: 6f 72 74 73 20 6d 75 6c 74 69 70 6c 65 20 6e 61  orts multiple na
7720: 6d 65 73 2c 20 74 68 65 20 72 69 67 68 74 20 63  mes, the right c
7730: 65 72 74 69 66 69 63 61 74 65 0a 63 61 6e 20 62  ertificate.can b
7740: 65 20 75 73 65 64 2e 20 49 74 20 69 73 20 63 61  e used. It is ca
7750: 6c 6c 65 64 20 61 66 74 65 72 20 74 68 65 20 68  lled after the h
7760: 65 6c 6c 6f 20 63 61 6c 6c 62 61 63 6b 20 62 75  ello callback bu
7770: 74 20 62 65 66 6f 72 65 20 74 68 65 20 41 4c 50  t before the ALP
7780: 4e 0a 63 61 6c 6c 62 61 63 6b 2e 0a 0a 5b 6f 70  N.callback...[op
7790: 74 5f 64 65 66 20 76 65 72 69 66 79 20 5b 61 72  t_def verify [ar
77a0: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 65 70  g "channelId dep
77b0: 74 68 20 63 65 72 74 20 73 74 61 74 75 73 20 65  th cert status e
77c0: 72 72 6f 72 22 5d 5d 0a 54 68 69 73 20 66 6f 72  rror"]].This for
77d0: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73  m of callback is
77e0: 20 69 6e 76 6f 6b 65 64 20 62 79 20 4f 70 65 6e   invoked by Open
77f0: 53 53 4c 20 77 68 65 6e 20 61 20 6e 65 77 20 63  SSL when a new c
7800: 65 72 74 69 66 69 63 61 74 65 20 69 73 20 72 65  ertificate is re
7810: 63 65 69 76 65 64 0a 66 72 6f 6d 20 74 68 65 20  ceived.from the 
7820: 70 65 65 72 2e 20 49 74 20 61 6c 6c 6f 77 73 20  peer. It allows 
7830: 74 68 65 20 63 6c 69 65 6e 74 20 74 6f 20 63 68  the client to ch
7840: 65 63 6b 20 74 68 65 20 63 65 72 74 69 66 69 63  eck the certific
7850: 61 74 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e  ate verification
7860: 0a 72 65 73 75 6c 74 73 20 61 6e 64 20 63 68 6f  .results and cho
7870: 6f 73 65 20 77 68 65 74 68 65 72 20 74 6f 20 63  ose whether to c
7880: 6f 6e 74 69 6e 75 65 20 6f 72 20 6e 6f 74 2e 20  ontinue or not. 
7890: 49 74 20 69 73 20 63 61 6c 6c 65 64 20 66 6f 72  It is called for
78a0: 20 65 61 63 68 0a 63 65 72 74 69 66 69 63 61 74   each.certificat
78b0: 65 20 69 6e 20 74 68 65 20 63 65 72 74 69 66 69  e in the certifi
78c0: 63 61 74 65 20 63 68 61 69 6e 2e 20 54 68 69 73  cate chain. This
78d0: 20 63 61 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f   callback was mo
78e0: 76 65 64 20 66 72 6f 6d 0a 5b 6f 70 74 69 6f 6e  ved from.[option
78f0: 20 2d 63 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54 63   -command] in Tc
7900: 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65 20 61 72  lTLS 1.8. The ar
7910: 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c  guments are:..[l
7920: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
7930: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72  tions]..[def [ar
7940: 67 20 64 65 70 74 68 5d 5d 0a 54 68 65 20 64 65  g depth]].The de
7950: 70 74 68 20 69 73 20 74 68 65 20 69 6e 74 65 67  pth is the integ
7960: 65 72 20 64 65 70 74 68 20 6f 66 20 74 68 65 20  er depth of the 
7970: 63 65 72 74 69 66 69 63 61 74 65 20 69 6e 20 74  certificate in t
7980: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 63  he certificate c
7990: 68 61 69 6e 2c 0a 77 68 65 72 65 20 30 20 69 73  hain,.where 0 is
79a0: 20 74 68 65 20 70 65 65 72 20 63 65 72 74 69 66   the peer certif
79b0: 69 63 61 74 65 20 61 6e 64 20 68 69 67 68 65 72  icate and higher
79c0: 20 76 61 6c 75 65 73 20 67 6f 69 6e 67 20 75 70   values going up
79d0: 20 74 6f 20 74 68 65 20 43 65 72 74 69 66 69 63   to the Certific
79e0: 61 74 65 0a 41 75 74 68 6f 72 69 74 79 20 28 43  ate.Authority (C
79f0: 41 29 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63  A)...[def [arg c
7a00: 65 72 74 5d 5d 0a 54 68 65 20 63 65 72 74 20 61  ert]].The cert a
7a10: 72 67 75 6d 65 6e 74 20 69 73 20 61 20 6c 69 73  rgument is a lis
7a20: 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70  t of key-value p
7a30: 61 69 72 73 20 73 69 6d 69 6c 61 72 20 74 6f 20  airs similar to 
7a40: 74 68 6f 73 65 20 72 65 74 75 72 6e 65 64 20 62  those returned b
7a50: 79 0a 5b 63 6d 64 20 74 6c 73 3a 3a 73 74 61 74  y.[cmd tls::stat
7a60: 75 73 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20  us]...[def [arg 
7a70: 73 74 61 74 75 73 5d 5d 0a 54 68 65 20 73 74 61  status]].The sta
7a80: 74 75 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20  tus argument is 
7a90: 74 68 65 20 62 6f 6f 6c 65 61 6e 20 76 61 6c 69  the boolean vali
7aa0: 64 69 74 79 20 6f 66 20 74 68 65 20 63 75 72 72  dity of the curr
7ab0: 65 6e 74 20 63 65 72 74 69 66 69 63 61 74 65 20  ent certificate 
7ac0: 77 68 65 72 65 20 30 0a 69 73 20 69 6e 76 61 6c  where 0.is inval
7ad0: 69 64 20 61 6e 64 20 31 20 69 73 20 76 61 6c 69  id and 1 is vali
7ae0: 64 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 65 72  d...[def [arg er
7af0: 72 6f 72 5d 5d 0a 54 68 65 20 65 72 72 6f 72 20  ror]].The error 
7b00: 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65 20  argument is the 
7b10: 65 72 72 6f 72 20 6d 65 73 73 61 67 65 2c 20 69  error message, i
7b20: 66 20 61 6e 79 2c 20 67 65 6e 65 72 61 74 65 64  f any, generated
7b30: 20 62 79 0a 5b 66 75 6e 20 58 35 30 39 5f 53 54   by.[fun X509_ST
7b40: 4f 52 45 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f  ORE_CTX_get_erro
7b50: 72 28 29 5d 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  r()]...[list_end
7b60: 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 52  ]..[list_end]..R
7b70: 65 66 65 72 65 6e 63 65 20 69 6d 70 6c 65 6d 65  eference impleme
7b80: 6e 74 61 74 69 6f 6e 73 20 6f 66 20 74 68 65 73  ntations of thes
7b90: 65 20 63 61 6c 6c 62 61 63 6b 73 20 61 72 65 20  e callbacks are 
7ba0: 70 72 6f 76 69 64 65 64 20 69 6e 20 5b 66 69 6c  provided in [fil
7bb0: 65 20 74 6c 73 2e 74 63 6c 5d 0a 61 73 20 5b 63  e tls.tcl].as [c
7bc0: 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b  md tls::callback
7bd0: 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73  ], [cmd tls::pas
7be0: 73 77 6f 72 64 5d 2c 20 61 6e 64 20 5b 63 6d 64  sword], and [cmd
7bf0: 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63   tls::validate_c
7c00: 6f 6d 6d 61 6e 64 5d 0a 72 65 73 70 65 63 74 69  ommand].respecti
7c10: 76 65 6c 79 2e 20 4e 6f 74 65 20 74 68 61 74 20  vely. Note that 
7c20: 74 68 65 73 65 20 61 72 65 20 6f 6e 6c 79 20 5b  these are only [
7c30: 65 6d 70 68 20 73 61 6d 70 6c 65 5d 20 69 6d 70  emph sample] imp
7c40: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 20 49 6e  lementations. In
7c50: 20 61 20 6d 6f 72 65 0a 72 65 61 6c 69 73 74 69   a more.realisti
7c60: 63 20 64 65 70 6c 6f 79 6d 65 6e 74 20 79 6f 75  c deployment you
7c70: 20 77 6f 75 6c 64 20 73 70 65 63 69 66 79 20 79   would specify y
7c80: 6f 75 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b  our own callback
7c90: 20 73 63 72 69 70 74 73 20 6f 6e 20 65 61 63 68   scripts on each
7ca0: 20 54 4c 53 0a 63 68 61 6e 6e 65 6c 20 75 73 69   TLS.channel usi
7cb0: 6e 67 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  ng the [option -
7cc0: 63 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f 70 74 69 6f  command], [optio
7cd0: 6e 20 2d 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e  n -password], an
7ce0: 64 0a 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64  d.[option -valid
7cf0: 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74  ate_command] opt
7d00: 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54  ions...[para]..T
7d10: 68 65 20 64 65 66 61 75 6c 74 20 62 65 68 61 76  he default behav
7d20: 69 6f 72 20 77 68 65 6e 20 74 68 65 20 5b 6f 70  ior when the [op
7d30: 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 61  tion -command] a
7d40: 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69  nd [option -vali
7d50: 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 6f 70  date_command].op
7d60: 74 69 6f 6e 73 20 61 72 65 20 6e 6f 74 20 73 70  tions are not sp
7d70: 65 63 69 66 69 65 64 2c 20 69 73 20 66 6f 72 20  ecified, is for 
7d80: 54 63 6c 54 4c 53 20 74 6f 20 70 72 6f 63 65 73  TclTLS to proces
7d90: 73 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64  s the associated
7da0: 20 6c 69 62 72 61 72 79 0a 63 61 6c 6c 62 61 63   library.callbac
7db0: 6b 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2e 20 54  ks internally. T
7dc0: 68 65 20 64 65 66 61 75 6c 74 20 62 65 68 61 76  he default behav
7dd0: 69 6f 72 20 77 68 65 6e 20 74 68 65 20 5b 6f 70  ior when the [op
7de0: 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20  tion -password] 
7df0: 6f 70 74 69 6f 6e 0a 69 73 20 6e 6f 74 20 73 70  option.is not sp
7e00: 65 63 69 66 69 65 64 20 69 73 20 66 6f 72 20 54  ecified is for T
7e10: 63 6c 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73  clTLS to process
7e20: 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 20   the associated 
7e30: 6c 69 62 72 61 72 79 20 63 61 6c 6c 62 61 63 6b  library callback
7e40: 73 20 62 79 0a 61 74 74 65 6d 70 74 69 6e 67 20  s by.attempting 
7e50: 74 6f 20 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73  to call [cmd tls
7e60: 3a 3a 70 61 73 73 77 6f 72 64 5d 2e 20 54 68 65  ::password]. The
7e70: 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77   difference betw
7e80: 65 65 6e 20 74 68 65 73 65 20 74 77 6f 0a 62 65  een these two.be
7e90: 68 61 76 69 6f 72 73 20 69 73 20 61 20 63 6f 6e  haviors is a con
7ea0: 73 65 71 75 65 6e 63 65 20 6f 66 20 6d 61 69 6e  sequence of main
7eb0: 74 61 69 6e 69 6e 67 20 63 6f 6d 70 61 74 69 62  taining compatib
7ec0: 69 6c 69 74 79 20 77 69 74 68 20 65 61 72 6c 69  ility with earli
7ed0: 65 72 0a 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f  er.implementatio
7ee0: 6e 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d  ns...[para]..[em
7ef0: 70 68 20 22 54 68 65 20 75 73 65 20 6f 66 20 74  ph "The use of t
7f00: 68 65 20 72 65 66 65 72 65 6e 63 65 20 63 61 6c  he reference cal
7f10: 6c 62 61 63 6b 73 20 5b 63 6d 64 20 74 6c 73 3a  lbacks [cmd tls:
7f20: 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64  :callback], [cmd
7f30: 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c   tls::password],
7f40: 0a 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 76  .and [cmd tls::v
7f50: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
7f60: 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e   is not recommen
7f70: 64 65 64 2e 20 54 68 65 79 20 6d 61 79 20 62 65  ded. They may be
7f80: 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75   removed from fu
7f90: 74 75 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d  ture releases."]
7fa0: 0a 0a 5b 73 65 63 74 69 6f 6e 20 44 65 62 75 67  ..[section Debug
7fb0: 5d 0a 0a 46 6f 72 20 6d 6f 73 74 20 64 65 62 75  ]..For most debu
7fc0: 67 67 69 6e 67 20 6e 65 65 64 73 2c 20 74 68 65  gging needs, the
7fd0: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 6c 6c 62 61   [option -callba
7fe0: 63 6b 5d 20 6f 70 74 69 6f 6e 20 63 61 6e 20 62  ck] option can b
7ff0: 65 20 75 73 65 64 20 74 6f 20 70 72 6f 76 69 64  e used to provid
8000: 65 0a 73 75 66 66 69 63 69 65 6e 74 20 69 6e 73  e.sufficient ins
8010: 69 67 68 74 20 61 6e 64 20 69 6e 66 6f 72 6d 61  ight and informa
8020: 74 69 6f 6e 20 6f 6e 20 74 68 65 20 54 4c 53 20  tion on the TLS 
8030: 68 61 6e 64 73 68 61 6b 65 20 61 6e 64 20 70 72  handshake and pr
8040: 6f 67 72 65 73 73 2e 20 49 66 0a 66 75 72 74 68  ogress. If.furth
8050: 65 72 20 74 72 6f 75 62 6c 65 73 68 6f 6f 74 69  er troubleshooti
8060: 6e 67 20 69 6e 73 69 67 68 74 20 69 73 20 6e 65  ng insight is ne
8070: 65 64 65 64 2c 20 74 68 65 20 63 6f 6d 70 69 6c  eded, the compil
8080: 65 20 74 69 6d 65 20 6f 70 74 69 6f 6e 0a 5b 6f  e time option.[o
8090: 70 74 69 6f 6e 20 2d 2d 65 6e 61 62 6c 65 2d 64  ption --enable-d
80a0: 65 62 75 67 5d 20 63 61 6e 20 62 65 20 75 73 65  ebug] can be use
80b0: 64 20 74 6f 20 67 65 74 20 64 65 74 61 69 6c 65  d to get detaile
80c0: 64 20 65 78 65 63 75 74 69 6f 6e 20 66 6c 6f 77  d execution flow
80d0: 20 73 74 61 74 75 73 2e 0a 0a 5b 70 61 72 61 5d   status...[para]
80e0: 0a 0a 54 4c 53 20 6b 65 79 20 6c 6f 67 67 69 6e  ..TLS key loggin
80f0: 67 20 63 61 6e 20 62 65 20 65 6e 61 62 6c 65 64  g can be enabled
8100: 20 62 79 20 73 65 74 74 69 6e 67 20 74 68 65 20   by setting the 
8110: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69  environment vari
8120: 61 62 6c 65 0a 5b 76 61 72 20 53 53 4c 4b 45 59  able.[var SSLKEY
8130: 4c 4f 47 46 49 4c 45 5d 20 74 6f 20 74 68 65 20  LOGFILE] to the 
8140: 6e 61 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65  name of the file
8150: 20 74 6f 20 6c 6f 67 20 74 6f 2e 20 54 68 65 6e   to log to. Then
8160: 20 77 68 65 6e 65 76 65 72 20 54 4c 53 20 6b 65   whenever TLS ke
8170: 79 0a 6d 61 74 65 72 69 61 6c 20 69 73 20 67 65  y.material is ge
8180: 6e 65 72 61 74 65 64 20 6f 72 20 72 65 63 65 69  nerated or recei
8190: 76 65 64 20 69 74 20 77 69 6c 6c 20 62 65 20 6c  ved it will be l
81a0: 6f 67 67 65 64 20 74 6f 20 74 68 65 20 66 69 6c  ogged to the fil
81b0: 65 2e 20 54 68 69 73 20 69 73 20 75 73 65 66 75  e. This is usefu
81c0: 6c 0a 66 6f 72 20 6c 6f 67 67 69 6e 67 20 6b 65  l.for logging ke
81d0: 79 20 64 61 74 61 20 66 6f 72 20 6e 65 74 77 6f  y data for netwo
81e0: 72 6b 20 6c 6f 67 67 69 6e 67 20 74 6f 6f 6c 73  rk logging tools
81f0: 20 74 6f 20 75 73 65 20 74 6f 20 64 65 63 72 79   to use to decry
8200: 70 74 20 74 68 65 20 64 61 74 61 2e 0a 0a 5b 70  pt the data...[p
8210: 61 72 61 5d 0a 0a 54 68 65 20 5b 76 61 72 20 74  ara]..The [var t
8220: 6c 73 3a 3a 64 65 62 75 67 5d 20 76 61 72 69 61  ls::debug] varia
8230: 62 6c 65 20 70 72 6f 76 69 64 65 73 20 73 6f 6d  ble provides som
8240: 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 63 6f 6e  e additional con
8250: 74 72 6f 6c 20 6f 76 65 72 20 74 68 65 0a 64 65  trol over the.de
8260: 62 75 67 20 6c 6f 67 67 69 6e 67 20 69 6e 20 74  bug logging in t
8270: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c  he [cmd tls::cal
8280: 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73  lback], [cmd tls
8290: 3a 3a 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64  ::password], and
82a0: 0a 5b 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64  .[cmd tls::valid
82b0: 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20 64 65 66  ate_command] def
82c0: 61 75 6c 74 20 68 61 6e 64 6c 65 72 73 20 69 6e  ault handlers in
82d0: 20 5b 66 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 2e   [file tls.tcl].
82e0: 0a 54 68 65 20 64 65 66 61 75 6c 74 20 76 61 6c  .The default val
82f0: 75 65 20 69 73 20 30 20 77 69 74 68 20 68 69 67  ue is 0 with hig
8300: 68 65 72 20 76 61 6c 75 65 73 20 70 72 6f 64 75  her values produ
8310: 63 69 6e 67 20 6d 6f 72 65 20 64 69 61 67 6e 6f  cing more diagno
8320: 73 74 69 63 20 6f 75 74 70 75 74 2c 0a 61 6e 64  stic output,.and
8330: 20 77 69 6c 6c 20 61 6c 73 6f 20 66 6f 72 63 65   will also force
8340: 20 74 68 65 20 76 65 72 69 66 79 20 6d 65 74 68   the verify meth
8350: 6f 64 20 69 6e 20 5b 63 6d 64 20 74 6c 73 3a 3a  od in [cmd tls::
8360: 63 61 6c 6c 62 61 63 6b 5d 20 74 6f 20 61 63 63  callback] to acc
8370: 65 70 74 20 74 68 65 0a 63 65 72 74 69 66 69 63  ept the.certific
8380: 61 74 65 2c 20 65 76 65 6e 20 69 66 20 69 74 20  ate, even if it 
8390: 69 73 20 69 6e 76 61 6c 69 64 20 77 68 65 6e 20  is invalid when 
83a0: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c  the [option -val
83b0: 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 0a 6f 70  idatecommand].op
83c0: 74 69 6f 6e 20 69 73 20 73 65 74 20 74 6f 20 5b  tion is set to [
83d0: 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74  cmd tls::validat
83e0: 65 5f 63 6f 6d 6d 61 6e 64 5d 2e 0a 0a 5b 70 61  e_command]...[pa
83f0: 72 61 5d 0a 0a 5b 65 6d 70 68 20 22 54 68 65 20  ra]..[emph "The 
8400: 75 73 65 20 6f 66 20 74 68 65 20 76 61 72 69 61  use of the varia
8410: 62 6c 65 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65  ble [var tls::de
8420: 62 75 67 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f  bug] is not reco
8430: 6d 6d 65 6e 64 65 64 2e 0a 49 74 20 6d 61 79 20  mmended..It may 
8440: 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20  be removed from 
8450: 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 73 2e  future releases.
8460: 22 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 48 54  "]..[section "HT
8470: 54 50 20 50 61 63 6b 61 67 65 20 45 78 61 6d 70  TP Package Examp
8480: 6c 65 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f  les"]..The follo
8490: 77 69 6e 67 20 61 72 65 20 65 78 61 6d 70 6c 65  wing are example
84a0: 20 73 63 72 69 70 74 73 20 74 6f 20 64 6f 77 6e   scripts to down
84b0: 6c 6f 61 64 20 61 20 77 65 62 70 61 67 65 20 61  load a webpage a
84c0: 6e 64 20 66 69 6c 65 20 75 73 69 6e 67 20 74 68  nd file using th
84d0: 65 0a 68 74 74 70 20 70 61 63 6b 61 67 65 2e 20  e.http package. 
84e0: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65  See [sectref "Ce
84f0: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
8500: 74 69 6f 6e 22 5d 20 66 6f 72 20 77 68 65 74 68  tion"] for wheth
8510: 65 72 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d  er the.[option -
8520: 63 61 64 69 72 5d 2c 20 5b 6f 70 74 69 6f 6e 20  cadir], [option 
8530: 2d 63 61 66 69 6c 65 5d 2c 20 61 6e 64 20 5b 6f  -cafile], and [o
8540: 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20  ption -castore] 
8550: 6f 70 74 69 6f 6e 73 20 61 72 65 20 61 6c 73 6f  options are also
8560: 0a 6e 65 65 64 65 64 2e 20 53 65 65 20 74 68 65  .needed. See the
8570: 20 64 65 6d 6f 73 20 64 69 72 65 63 74 6f 72 79   demos directory
8580: 20 66 6f 72 20 6d 6f 72 65 20 65 78 61 6d 70 6c   for more exampl
8590: 65 20 73 63 72 69 70 74 73 2e 0a 0a 5b 70 61 72  e scripts...[par
85a0: 61 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 31 3a 20  a]..Example #1: 
85b0: 44 6f 77 6e 6c 6f 61 64 20 61 20 77 65 62 20 70  Download a web p
85c0: 61 67 65 0a 0a 5b 65 78 61 6d 70 6c 65 20 7b 0a  age..[example {.
85d0: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
85e0: 20 68 74 74 70 0a 70 61 63 6b 61 67 65 20 72 65   http.package re
85f0: 71 75 69 72 65 20 74 6c 73 0a 0a 73 65 74 20 75  quire tls..set u
8600: 72 6c 20 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e  rl "https://www.
8610: 74 63 6c 2e 74 6b 2f 22 0a 68 74 74 70 3a 3a 72  tcl.tk/".http::r
8620: 65 67 69 73 74 65 72 20 68 74 74 70 73 20 34 34  egister https 44
8630: 33 20 5b 6c 69 73 74 20 3a 3a 74 6c 73 3a 3a 73  3 [list ::tls::s
8640: 6f 63 6b 65 74 20 2d 61 75 74 6f 73 65 72 76 65  ocket -autoserve
8650: 72 6e 61 6d 65 20 31 20 2d 72 65 71 75 69 72 65  rname 1 -require
8660: 20 31 5d 0a 0a 23 20 47 65 74 20 55 52 4c 0a 73   1]..# Get URL.s
8670: 65 74 20 74 6f 6b 65 6e 20 5b 68 74 74 70 3a 3a  et token [http::
8680: 67 65 74 75 72 6c 20 24 75 72 6c 5d 0a 0a 23 20  geturl $url]..# 
8690: 43 68 65 63 6b 20 66 6f 72 20 65 72 72 6f 72 0a  Check for error.
86a0: 69 66 20 7b 5b 68 74 74 70 3a 3a 73 74 61 74 75  if {[http::statu
86b0: 73 20 24 74 6f 6b 65 6e 5d 20 6e 65 20 22 6f 6b  s $token] ne "ok
86c0: 22 7d 20 7b 0a 20 20 20 20 70 75 74 73 20 5b 66  "} {.    puts [f
86d0: 6f 72 6d 61 74 20 22 45 72 72 6f 72 20 25 73 22  ormat "Error %s"
86e0: 20 5b 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24   [http::status $
86f0: 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23 20 53 61 76  token]].}..# Sav
8700: 65 20 77 65 62 20 70 61 67 65 20 74 6f 20 66 69  e web page to fi
8710: 6c 65 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20  le.set ch [open 
8720: 65 78 61 6d 70 6c 65 2e 68 74 6d 6c 20 77 62 5d  example.html wb]
8730: 0a 70 75 74 73 20 24 63 68 20 5b 68 74 74 70 3a  .puts $ch [http:
8740: 3a 64 61 74 61 20 24 74 6f 6b 65 6e 5d 0a 63 6c  :data $token].cl
8750: 6f 73 65 20 24 63 68 0a 0a 23 20 43 6c 65 61 6e  ose $ch..# Clean
8760: 75 70 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65 61 6e  up.::http::clean
8770: 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 45 78  up $token.}]..Ex
8780: 61 6d 70 6c 65 20 23 32 3a 20 44 6f 77 6e 6c 6f  ample #2: Downlo
8790: 61 64 20 61 20 66 69 6c 65 0a 0a 5b 65 78 61 6d  ad a file..[exam
87a0: 70 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72  ple {..package r
87b0: 65 71 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b  equire http.pack
87c0: 61 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a  age require tls.
87d0: 0a 73 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a  .set url "https:
87e0: 2f 2f 77 69 6b 69 2e 74 63 6c 2d 6c 61 6e 67 2e  //wiki.tcl-lang.
87f0: 6f 72 67 2f 73 69 74 65 6d 61 70 2e 78 6d 6c 22  org/sitemap.xml"
8800: 0a 68 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20  .http::register 
8810: 68 74 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20  https 443 [list 
8820: 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61  ::tls::socket -a
8830: 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 20 31 20  utoservername 1 
8840: 2d 72 65 71 75 69 72 65 20 31 5d 0a 0a 23 20 4f  -require 1]..# O
8850: 70 65 6e 20 6f 75 74 70 75 74 20 66 69 6c 65 0a  pen output file.
8860: 73 65 74 20 66 69 6c 65 6e 61 6d 65 20 5b 66 69  set filename [fi
8870: 6c 65 20 74 61 69 6c 20 24 75 72 6c 5d 0a 73 65  le tail $url].se
8880: 74 20 63 68 20 5b 6f 70 65 6e 20 24 66 69 6c 65  t ch [open $file
8890: 6e 61 6d 65 20 77 62 5d 0a 0a 23 20 47 65 74 20  name wb]..# Get 
88a0: 66 69 6c 65 0a 73 65 74 20 74 6f 6b 65 6e 20 5b  file.set token [
88b0: 3a 3a 68 74 74 70 3a 3a 67 65 74 75 72 6c 20 24  ::http::geturl $
88c0: 75 72 6c 20 2d 62 6c 6f 63 6b 73 69 7a 65 20 36  url -blocksize 6
88d0: 35 35 33 36 20 2d 63 68 61 6e 6e 65 6c 20 24 63  5536 -channel $c
88e0: 68 5d 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20  h]..# Check for 
88f0: 65 72 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a  error.if {[http:
8900: 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20  :status $token] 
8910: 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70  ne "ok"} {.    p
8920: 75 74 73 20 5b 66 6f 72 6d 61 74 20 22 45 72 72  uts [format "Err
8930: 6f 72 20 25 73 22 20 5b 68 74 74 70 3a 3a 73 74  or %s" [http::st
8940: 61 74 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a  atus $token]].}.
8950: 0a 23 20 43 6c 65 61 6e 75 70 0a 63 6c 6f 73 65  .# Cleanup.close
8960: 20 24 63 68 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65   $ch.::http::cle
8970: 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a  anup $token.}]..
8980: 5b 73 65 63 74 69 6f 6e 20 22 53 70 65 63 69 61  [section "Specia
8990: 6c 20 43 6f 6e 73 69 64 65 72 61 74 69 6f 6e 73  l Considerations
89a0: 22 5d 0a 0a 54 68 65 20 63 61 70 61 62 69 6c 69  "]..The capabili
89b0: 74 69 65 73 20 6f 66 20 74 68 69 73 20 70 61 63  ties of this pac
89c0: 6b 61 67 65 20 63 61 6e 20 76 61 72 79 20 65 6e  kage can vary en
89d0: 6f 72 6d 6f 75 73 6c 79 20 62 61 73 65 64 20 75  ormously based u
89e0: 70 6f 6e 20 68 6f 77 20 74 68 65 0a 6c 69 6e 6b  pon how the.link
89f0: 65 64 20 74 6f 20 4f 70 65 6e 53 53 4c 20 6c 69  ed to OpenSSL li
8a00: 62 72 61 72 79 20 77 61 73 20 63 6f 6e 66 69 67  brary was config
8a10: 75 72 65 64 20 61 6e 64 20 62 75 69 6c 74 2e 20  ured and built. 
8a20: 4e 65 77 20 76 65 72 73 69 6f 6e 73 20 6d 61 79  New versions may
8a30: 20 6f 62 73 6f 6c 65 74 65 0a 6f 6c 64 65 72 20   obsolete.older 
8a40: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e  protocol version
8a50: 73 2c 20 61 64 64 20 6f 72 20 72 65 6d 6f 76 65  s, add or remove
8a60: 20 63 69 70 68 65 72 73 2c 20 63 68 61 6e 67 65   ciphers, change
8a70: 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 73 2c   default values,
8a80: 20 65 74 63 2e 0a 55 73 65 20 74 68 65 20 5b 63   etc..Use the [c
8a90: 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c  md tls::protocol
8aa0: 73 5d 20 63 6f 6d 6d 61 6e 64 73 20 74 6f 20 6f  s] commands to o
8ab0: 62 74 61 69 6e 20 74 68 65 20 73 75 70 70 6f 72  btain the suppor
8ac0: 74 65 64 0a 70 72 6f 74 6f 63 6f 6c 20 76 65 72  ted.protocol ver
8ad0: 73 69 6f 6e 73 2e 0a 0a 5b 6d 61 6e 70 61 67 65  sions...[manpage
8ae0: 5f 65 6e 64 5d 0a                                _end].