Hex Artifact Content

Artifact 7a056675290e4ed6ac1771b799d028f9b13ff2788156359f33c1b7e5f6c0d5ef:


0000: 5b 63 6f 6d 6d 65 6e 74 20 7b 2d 2a 2d 20 74 63  [comment {-*- tc
0010: 6c 20 2d 2a 2d 20 64 6f 63 74 6f 6f 6c 73 20 6d  l -*- doctools m
0020: 61 6e 70 61 67 65 7d 5d 0a 5b 63 6f 6d 6d 65 6e  anpage}].[commen
0030: 74 20 7b 54 6f 20 63 6f 6e 76 65 72 74 20 74 68  t {To convert th
0040: 69 73 20 74 6f 20 61 6e 6f 74 68 65 72 20 64 6f  is to another do
0050: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 6d  cumentation form
0060: 61 74 20 75 73 65 20 74 68 65 20 64 74 70 6c 69  at use the dtpli
0070: 74 65 0a 20 20 20 20 20 20 20 20 20 20 73 63 72  te.          scr
0080: 69 70 74 20 66 72 6f 6d 20 74 63 6c 6c 69 62 3a  ipt from tcllib:
0090: 20 64 74 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e   dtplite -o tls.
00a0: 6e 20 6e 72 6f 66 66 20 74 6c 73 2e 6d 61 6e 0a  n nroff tls.man.
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 74                dt
00d0: 70 6c 69 74 65 20 2d 6f 20 74 6c 73 2e 68 74 6d  plite -o tls.htm
00e0: 6c 20 68 74 6d 6c 20 74 6c 73 2e 6d 61 6e 0a 7d  l html tls.man.}
00f0: 5d 0a 5b 6d 61 6e 70 61 67 65 5f 62 65 67 69 6e  ].[manpage_begin
0100: 20 74 6c 73 20 6e 20 32 2e 30 62 31 5d 0a 5b 63   tls n 2.0b1].[c
0110: 61 74 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f  ategory tls].[co
0120: 70 79 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61  pyright {1999 Ma
0130: 74 74 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70  tt Newman}].[cop
0140: 79 72 69 67 68 74 20 7b 32 30 30 34 20 53 74 61  yright {2004 Sta
0150: 72 66 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a  rfish Systems}].
0160: 5b 63 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34  [copyright {2024
0170: 20 42 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d   Brian O'Hagan}]
0180: 0a 5b 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49  .[keywords tls I
0190: 2f 4f 20 22 49 50 20 41 64 64 72 65 73 73 22 20  /O "IP Address" 
01a0: 4f 70 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20  OpenSSL SSL TCP 
01b0: 54 4c 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75  TLS "asynchronou
01c0: 73 20 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74  s I/O" bind cert
01d0: 69 66 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20  ificate channel 
01e0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61  connection "doma
01f0: 69 6e 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68  in name" host "h
0200: 74 74 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61  ttps" "network a
0210: 64 64 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20  ddress" network 
0220: 73 6f 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b  socket TclTLS].[
0230: 6d 6f 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53  moddesc {Tcl TLS
0240: 20 65 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65   extension}].[se
0250: 65 5f 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b  e_also http sock
0260: 65 74 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f  et [uri https://
0270: 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f  www.openssl.org/
0280: 20 4f 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c   OpenSSL]].[titl
0290: 65 64 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74  edesc {binding t
02a0: 6f 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69  o the OpenSSL li
02b0: 62 72 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70  brary for encryp
02c0: 74 65 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49  ted socket and I
02d0: 2f 4f 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75  /O channel commu
02e0: 6e 69 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71  nications}].[req
02f0: 75 69 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b  uire Tcl 8.5-].[
0300: 72 65 71 75 69 72 65 20 74 6c 73 20 32 2e 30 62  require tls 2.0b
0310: 31 5d 0a 5b 64 65 73 63 72 69 70 74 69 6f 6e 5d  1].[description]
0320: 0a 0a 54 68 69 73 20 65 78 74 65 6e 73 69 6f 6e  ..This extension
0330: 20 70 72 6f 76 69 64 65 73 20 54 43 4c 20 73 63   provides TCL sc
0340: 72 69 70 74 20 61 63 63 65 73 73 20 74 6f 20 73  ript access to s
0350: 65 63 75 72 65 20 73 6f 63 6b 65 74 20 63 6f 6d  ecure socket com
0360: 6d 75 6e 69 63 61 74 69 6f 6e 73 0a 75 73 69 6e  munications.usin
0370: 67 20 74 68 65 20 54 72 61 6e 73 70 6f 72 74 20  g the Transport 
0380: 4c 61 79 65 72 20 53 65 63 75 72 69 74 79 20 28  Layer Security (
0390: 54 4c 53 29 20 70 72 6f 74 6f 63 6f 6c 2e 20 49  TLS) protocol. I
03a0: 74 20 70 72 6f 76 69 64 65 73 20 61 20 67 65 6e  t provides a gen
03b0: 65 72 69 63 0a 62 69 6e 64 69 6e 67 20 74 6f 20  eric.binding to 
03c0: 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 77 77  [uri "https://ww
03d0: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 20  w.openssl.org/" 
03e0: 4f 70 65 6e 53 53 4c 5d 2c 20 75 74 69 6c 69 7a  OpenSSL], utiliz
03f0: 69 6e 67 20 74 68 65 0a 5b 73 79 73 63 6d 64 20  ing the.[syscmd 
0400: 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e 65 6c  Tcl_StackChannel
0410: 5d 20 41 50 49 20 69 6e 20 54 43 4c 20 38 2e 34  ] API in TCL 8.4
0420: 20 61 6e 64 20 68 69 67 68 65 72 2e 0a 54 68 65   and higher..The
0430: 73 65 20 73 6f 63 6b 65 74 73 20 62 65 68 61 76  se sockets behav
0440: 65 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 61  e exactly the sa
0450: 6d 65 20 61 73 20 63 68 61 6e 6e 65 6c 73 20 63  me as channels c
0460: 72 65 61 74 65 64 20 75 73 69 6e 67 20 74 68 65  reated using the
0470: 20 62 75 69 6c 74 2d 69 6e 0a 5b 73 79 73 63 6d   built-in.[syscm
0480: 64 20 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e  d socket] comman
0490: 64 2c 20 62 75 74 20 70 72 6f 76 69 64 65 20 61  d, but provide a
04a0: 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e  dditional option
04b0: 73 20 66 6f 72 20 63 6f 6e 74 72 6f 6c 6c 69 6e  s for controllin
04c0: 67 0a 74 68 65 20 53 53 4c 2f 54 4c 53 20 73 65  g.the SSL/TLS se
04d0: 73 73 69 6f 6e 2e 0a 0a 5b 73 65 63 74 69 6f 6e  ssion...[section
04e0: 20 43 6f 6d 6d 61 6e 64 73 5d 0a 0a 54 68 65 20   Commands]..The 
04f0: 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 65 20 74 68  following are th
0500: 65 20 63 6f 6d 6d 61 6e 64 73 20 70 72 6f 76 69  e commands provi
0510: 64 65 64 20 62 79 20 74 68 65 20 54 63 4c 54 4c  ded by the TcLTL
0520: 53 20 70 61 63 6b 61 67 65 2e 20 53 65 65 20 74  S package. See t
0530: 68 65 0a 5b 73 65 63 74 72 65 66 20 45 78 61 6d  he.[sectref Exam
0540: 70 6c 65 73 5d 20 66 6f 72 20 65 78 61 6d 70 6c  ples] for exampl
0550: 65 20 75 73 61 67 65 20 61 6e 64 20 74 68 65 20  e usage and the 
0560: 5b 66 69 6c 65 20 64 65 6d 6f 73 5d 20 64 69 72  [file demos] dir
0570: 65 63 74 6f 72 79 20 66 6f 72 0a 6d 6f 72 65 20  ectory for.more 
0580: 65 78 61 6d 70 6c 65 20 75 73 61 67 65 2e 0a 0a  example usage...
0590: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
05a0: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 63 61 6c 6c 20  nitions]..[call 
05b0: 5b 63 6d 64 20 74 6c 73 3a 3a 69 6e 69 74 5d 20  [cmd tls::init] 
05c0: 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f  [opt [arg -optio
05d0: 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61  n]] [opt [arg va
05e0: 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  lue]] [opt [arg 
05f0: 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e  "-option value .
0600: 2e 2e 22 5d 5d 5d 0a 0a 4f 70 74 69 6f 6e 61 6c  .."]]]..Optional
0610: 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 73 65 74   function to set
0620: 20 74 68 65 20 64 65 66 61 75 6c 74 20 6f 70 74   the default opt
0630: 69 6f 6e 73 20 75 73 65 64 20 62 79 20 5b 63 6d  ions used by [cm
0640: 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 2e 20  d tls::socket]. 
0650: 49 66 20 79 6f 75 0a 63 61 6c 6c 20 5b 63 6d 64  If you.call [cmd
0660: 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 20 64 69   tls::import] di
0670: 72 65 63 74 6c 79 2c 20 74 68 65 20 76 61 6c 75  rectly, the valu
0680: 65 73 20 73 65 74 20 62 79 20 74 68 69 73 20 63  es set by this c
0690: 6f 6d 6d 61 6e 64 20 68 61 76 65 20 6e 6f 20 65  ommand have no e
06a0: 66 66 65 63 74 2e 0a 54 68 69 73 20 63 6f 6d 6d  ffect..This comm
06b0: 61 6e 64 20 73 75 70 70 6f 72 74 73 20 61 6c 6c  and supports all
06c0: 20 6f 66 20 74 68 65 20 73 61 6d 65 20 6f 70 74   of the same opt
06d0: 69 6f 6e 73 20 61 73 20 74 68 65 20 5b 63 6d 64  ions as the [cmd
06e0: 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f   tls::socket] co
06f0: 6d 6d 61 6e 64 2c 0a 74 68 6f 75 67 68 20 79 6f  mmand,.though yo
0700: 75 20 73 68 6f 75 6c 64 20 6c 69 6d 69 74 20 79  u should limit y
0710: 6f 75 72 20 6f 70 74 69 6f 6e 73 20 74 6f 20 6f  our options to o
0720: 6e 6c 79 20 54 4c 53 20 72 65 6c 61 74 65 64 20  nly TLS related 
0730: 6f 6e 65 73 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  ones...[call [cm
0740: 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 5b  d tls::socket] [
0750: 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e  opt [arg -option
0760: 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c  ]] [opt [arg val
0770: 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22  ue]] [opt [arg "
0780: 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e  -option value ..
0790: 2e 22 5d 5d 20 5b 61 72 67 20 68 6f 73 74 5d 20  ."]] [arg host] 
07a0: 5b 61 72 67 20 70 6f 72 74 5d 5d 0a 0a 54 68 69  [arg port]]..Thi
07b0: 73 20 69 73 20 61 20 68 65 6c 70 65 72 20 66 75  s is a helper fu
07c0: 6e 63 74 69 6f 6e 20 74 68 61 74 20 75 74 69 6c  nction that util
07d0: 69 7a 65 73 20 74 68 65 20 75 6e 64 65 72 6c 79  izes the underly
07e0: 69 6e 67 20 63 6f 6d 6d 61 6e 64 73 20 5b 73 79  ing commands [sy
07f0: 73 63 6d 64 20 73 6f 63 6b 65 74 5d 0a 61 6e 64  scmd socket].and
0800: 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72   [cmd tls::impor
0810: 74 5d 20 74 6f 20 63 72 65 61 74 65 20 74 68 65  t] to create the
0820: 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 20 49 74 20   connection. It 
0830: 62 65 68 61 76 65 73 20 74 68 65 20 73 61 6d 65  behaves the same
0840: 20 61 73 20 74 68 65 0a 6e 61 74 69 76 65 20 54   as the.native T
0850: 43 4c 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65  CL [syscmd socke
0860: 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 62 75 74 20  t] command, but 
0870: 61 6c 73 6f 20 73 75 70 70 6f 72 74 73 20 74 68  also supports th
0880: 65 20 5b 63 6d 64 20 74 6c 73 3a 69 6d 70 6f 72  e [cmd tls:impor
0890: 74 5d 0a 63 6f 6d 6d 61 6e 64 20 6f 70 74 69 6f  t].command optio
08a0: 6e 73 20 77 69 74 68 20 6f 6e 65 20 61 64 64 69  ns with one addi
08b0: 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 2e 20 49  tional option. I
08c0: 74 20 72 65 74 75 72 6e 73 20 74 68 65 20 63 68  t returns the ch
08d0: 61 6e 6e 65 6c 20 68 61 6e 64 6c 65 20 69 64 0a  annel handle id.
08e0: 66 6f 72 20 74 68 65 20 6e 65 77 20 73 6f 63 6b  for the new sock
08f0: 65 74 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  et...[list_begin
0900: 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f   options]..[opt_
0910: 64 65 66 20 2d 61 75 74 6f 73 65 72 76 65 72 6e  def -autoservern
0920: 61 6d 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a  ame [arg bool]].
0930: 49 66 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2c  If [const true],
0940: 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73   automatically s
0950: 65 74 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  et the [option -
0960: 73 65 72 76 65 72 6e 61 6d 65 5d 20 61 72 67 75  servername] argu
0970: 6d 65 6e 74 20 74 6f 20 74 68 65 0a 5b 65 6d 70  ment to the.[emp
0980: 68 20 68 6f 73 74 5d 20 61 72 67 75 6d 65 6e 74  h host] argument
0990: 2e 20 50 72 69 6f 72 20 74 6f 20 54 63 6c 54 4c  . Prior to TclTL
09a0: 53 20 32 2e 30 2c 20 74 68 65 20 64 65 66 61 75  S 2.0, the defau
09b0: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61 6c  lt is [const fal
09c0: 73 65 5d 2e 0a 53 74 61 72 74 69 6e 67 20 69 6e  se]..Starting in
09d0: 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 65   TclTLS 2.0, the
09e0: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e   default is [con
09f0: 73 74 20 74 72 75 65 5d 20 75 6e 6c 65 73 73 20  st true] unless 
0a00: 5b 6f 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e  [option -servern
0a10: 61 6d 65 5d 0a 69 73 20 61 6c 73 6f 20 73 70 65  ame].is also spe
0a20: 63 69 66 69 65 64 2e 0a 0a 5b 6c 69 73 74 5f 65  cified...[list_e
0a30: 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20  nd]..[call [cmd 
0a40: 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 5b 6f 70  tls::socket] [op
0a50: 74 69 6f 6e 20 2d 73 65 72 76 65 72 5d 20 5b 61  tion -server] [a
0a60: 72 67 20 63 6f 6d 6d 61 6e 64 5d 20 5b 6f 70 74  rg command] [opt
0a70: 20 5b 61 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20   [arg -option]] 
0a80: 5b 6f 70 74 20 5b 61 72 67 20 76 61 6c 75 65 5d  [opt [arg value]
0a90: 5d 20 5b 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70  ] [opt [arg "-op
0aa0: 74 69 6f 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d  tion value ..."]
0ab0: 5d 20 5b 61 72 67 20 70 6f 72 74 5d 5d 0a 0a 53  ] [arg port]]..S
0ac0: 61 6d 65 20 61 73 20 70 72 65 76 69 6f 75 73 2c  ame as previous,
0ad0: 20 62 75 74 20 69 6e 73 74 65 61 64 20 63 72 65   but instead cre
0ae0: 61 74 65 73 20 61 20 73 65 72 76 65 72 20 73 6f  ates a server so
0af0: 63 6b 65 74 20 66 6f 72 20 63 6c 69 65 6e 74 73  cket for clients
0b00: 20 74 6f 20 63 6f 6e 6e 65 63 74 20 74 6f 0a 6a   to connect to.j
0b10: 75 73 74 20 6c 69 6b 65 20 74 68 65 20 54 63 6c  ust like the Tcl
0b20: 20 5b 73 79 73 63 6d 64 20 22 73 6f 63 6b 65 74   [syscmd "socket
0b30: 20 2d 73 65 72 76 65 72 22 5d 20 63 6f 6d 6d 61   -server"] comma
0b40: 6e 64 2e 20 49 74 20 72 65 74 75 72 6e 73 20 74  nd. It returns t
0b50: 68 65 20 63 68 61 6e 6e 65 6c 0a 68 61 6e 64 6c  he channel.handl
0b60: 65 20 69 64 20 66 6f 72 20 74 68 65 20 6e 65 77  e id for the new
0b70: 20 73 6f 63 6b 65 74 2e 0a 0a 5b 63 61 6c 6c 20   socket...[call 
0b80: 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74  [cmd tls::import
0b90: 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 20  ] [arg channel] 
0ba0: 5b 6f 70 74 20 5b 61 72 67 20 2d 6f 70 74 69 6f  [opt [arg -optio
0bb0: 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 61  n]] [opt [arg va
0bc0: 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20  lue]] [opt [arg 
0bd0: 22 2d 6f 70 74 69 6f 6e 20 76 61 6c 75 65 20 2e  "-option value .
0be0: 2e 2e 22 5d 5d 5d 0a 0a 53 74 61 72 74 20 54 4c  .."]]]..Start TL
0bf0: 53 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f 6e 20  S encryption on 
0c00: 54 43 4c 20 63 68 61 6e 6e 65 6c 20 5b 61 72 67  TCL channel [arg
0c10: 20 63 68 61 6e 6e 65 6c 5d 20 76 69 61 20 61 20   channel] via a 
0c20: 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 2e  stacked channel.
0c30: 20 49 74 0a 6e 65 65 64 20 6e 6f 74 20 62 65 20   It.need not be 
0c40: 61 20 73 6f 63 6b 65 74 2c 20 62 75 74 20 6d 75  a socket, but mu
0c50: 73 74 20 70 72 6f 76 69 64 65 20 62 69 2d 64 69  st provide bi-di
0c60: 72 65 63 74 69 6f 6e 61 6c 20 66 6c 6f 77 2e 20  rectional flow. 
0c70: 41 6c 73 6f 20 73 65 74 73 20 73 65 73 73 69 6f  Also sets sessio
0c80: 6e 0a 70 61 72 61 6d 65 74 65 72 73 20 66 6f 72  n.parameters for
0c90: 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20   SSL handshake. 
0ca0: 56 61 6c 69 64 20 6f 70 74 69 6f 6e 73 20 61 72  Valid options ar
0cb0: 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  e:..[list_begin 
0cc0: 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64  options]..[opt_d
0cd0: 65 66 20 2d 61 6c 70 6e 20 5b 61 72 67 20 6c 69  ef -alpn [arg li
0ce0: 73 74 5d 5d 0a 4c 69 73 74 20 6f 66 20 70 72 6f  st]].List of pro
0cf0: 74 6f 63 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20  tocols to offer 
0d00: 64 75 72 69 6e 67 20 41 70 70 6c 69 63 61 74 69  during Applicati
0d10: 6f 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f  on-Layer Protoco
0d20: 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e 0a 28 41  l Negotiation.(A
0d30: 4c 50 4e 29 2e 20 46 6f 72 20 65 78 61 6d 70 6c  LPN). For exampl
0d40: 65 3a 20 5b 63 6f 6e 73 74 20 68 32 5d 20 61 6e  e: [const h2] an
0d50: 64 20 5b 63 6f 6e 73 74 20 68 74 74 70 2f 31 2e  d [const http/1.
0d60: 31 5d 2c 20 62 75 74 20 6e 6f 74 20 5b 63 6f 6e  1], but not [con
0d70: 73 74 20 68 33 5d 20 6f 72 0a 5b 63 6f 6e 73 74  st h3] or.[const
0d80: 20 71 75 69 63 5d 2e 20 54 68 69 73 20 6f 70 74   quic]. This opt
0d90: 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54  ion is new for T
0da0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74  clTLS 1.8...[opt
0db0: 5f 64 65 66 20 2d 63 61 64 69 72 20 5b 61 72 67  _def -cadir [arg
0dc0: 20 64 69 72 65 63 74 6f 72 79 5d 5d 0a 53 70 65   directory]].Spe
0dd0: 63 69 66 69 65 73 20 74 68 65 20 64 69 72 65 63  cifies the direc
0de0: 74 6f 72 79 20 77 68 65 72 65 20 74 68 65 20 43  tory where the C
0df0: 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f  ertificate Autho
0e00: 72 69 74 79 20 28 43 41 29 20 63 65 72 74 69 66  rity (CA) certif
0e10: 69 63 61 74 65 73 20 61 72 65 0a 73 74 6f 72 65  icates are.store
0e20: 64 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69  d. The default i
0e30: 73 20 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69  s platform speci
0e40: 66 69 63 20 61 6e 64 20 63 61 6e 20 62 65 20 73  fic and can be s
0e50: 65 74 20 61 74 20 63 6f 6d 70 69 6c 65 20 74 69  et at compile ti
0e60: 6d 65 2e 20 54 68 65 0a 64 65 66 61 75 6c 74 20  me. The.default 
0e70: 6c 6f 63 61 74 69 6f 6e 20 63 61 6e 20 62 65 20  location can be 
0e80: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68  overridden by th
0e90: 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  e [var SSL_CERT_
0ea0: 44 49 52 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74  DIR] environment
0eb0: 0a 76 61 72 69 61 62 6c 65 2e 20 53 65 65 20 5b  .variable. See [
0ec0: 73 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69  sectref "Certifi
0ed0: 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22  cate Validation"
0ee0: 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69  ] for more detai
0ef0: 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  ls...[opt_def -c
0f00: 61 66 69 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e  afile [arg filen
0f10: 61 6d 65 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ame]].Specifies 
0f20: 74 68 65 20 66 69 6c 65 20 77 69 74 68 20 74 68  the file with th
0f30: 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  e Certificate Au
0f40: 74 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72  thority (CA) cer
0f50: 74 69 66 69 63 61 74 65 73 20 74 6f 20 75 73 65  tificates to use
0f60: 20 69 6e 0a 5b 63 6f 6e 73 74 20 50 45 4d 5d 20   in.[const PEM] 
0f70: 66 69 6c 65 20 66 6f 72 6d 61 74 2e 20 54 68 65  file format. The
0f80: 20 64 65 66 61 75 6c 74 20 69 73 20 5b 66 69 6c   default is [fil
0f90: 65 20 63 65 72 74 2e 70 65 6d 5d 2c 20 69 6e 20  e cert.pem], in 
0fa0: 74 68 65 20 4f 70 65 6e 53 53 4c 0a 64 69 72 65  the OpenSSL.dire
0fb0: 63 74 6f 72 79 2e 20 54 68 65 20 64 65 66 61 75  ctory. The defau
0fc0: 6c 74 20 66 69 6c 65 20 63 61 6e 20 62 65 20 6f  lt file can be o
0fd0: 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68 65  verridden by the
0fe0: 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46   [var SSL_CERT_F
0ff0: 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74  ILE] environment
1000: 0a 76 61 72 69 61 62 6c 65 2e 20 53 65 65 20 5b  .variable. See [
1010: 73 65 63 74 72 65 66 20 22 43 65 72 74 69 66 69  sectref "Certifi
1020: 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 22  cate Validation"
1030: 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69  ] for more detai
1040: 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  ls...[opt_def -c
1050: 61 73 74 6f 72 65 20 5b 61 72 67 20 55 52 49 5d  astore [arg URI]
1060: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
1070: 55 6e 69 66 6f 72 6d 20 52 65 73 6f 75 72 63 65  Uniform Resource
1080: 20 49 64 65 6e 74 69 66 69 65 72 20 28 55 52 49   Identifier (URI
1090: 29 20 66 6f 72 20 74 68 65 20 43 65 72 74 69 66  ) for the Certif
10a0: 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 0a  icate Authority.
10b0: 28 43 41 29 20 73 74 6f 72 65 2c 20 77 68 69 63  (CA) store, whic
10c0: 68 20 6d 61 79 20 62 65 20 61 20 73 69 6e 67 6c  h may be a singl
10d0: 65 20 63 6f 6e 74 61 69 6e 65 72 20 6f 72 20 61  e container or a
10e0: 20 63 61 74 61 6c 6f 67 20 6f 66 20 63 6f 6e 74   catalog of cont
10f0: 61 69 6e 65 72 73 2e 0a 53 74 61 72 74 69 6e 67  ainers..Starting
1100: 20 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 33 2e   with OpenSSL 3.
1110: 32 20 6f 6e 20 4d 53 20 57 69 6e 64 6f 77 73 2c  2 on MS Windows,
1120: 20 73 65 74 20 74 6f 20 22 5b 63 6f 6e 73 74 20   set to "[const 
1130: 22 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69 6e  "org.openssl.win
1140: 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a 74 6f 20 75  store://"]".to u
1150: 73 65 20 74 68 65 20 62 75 69 6c 74 2d 69 6e 20  se the built-in 
1160: 4d 53 20 57 69 6e 64 6f 77 73 20 43 65 72 74 69  MS Windows Certi
1170: 66 69 63 61 74 65 20 53 74 6f 72 65 2e 0a 53 65  ficate Store..Se
1180: 65 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74  e [sectref "Cert
1190: 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69  ificate Validati
11a0: 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65  on"] for more de
11b0: 74 61 69 6c 73 2e 0a 54 68 69 73 20 6f 70 74 69  tails..This opti
11c0: 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  on is new for Tc
11d0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f  lTLS 1.8...[opt_
11e0: 64 65 66 20 2d 63 65 72 74 66 69 6c 65 20 5b 61  def -certfile [a
11f0: 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70  rg filename]].Sp
1200: 65 63 69 66 69 65 73 20 74 68 65 20 6e 61 6d 65  ecifies the name
1210: 20 6f 66 20 74 68 65 20 66 69 6c 65 20 77 69 74   of the file wit
1220: 68 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  h the certificat
1230: 65 20 74 6f 20 75 73 65 20 69 6e 20 50 45 4d 20  e to use in PEM 
1240: 66 6f 72 6d 61 74 0a 61 73 20 74 68 65 20 6c 6f  format.as the lo
1250: 63 61 6c 20 28 63 6c 69 65 6e 74 20 6f 72 20 73  cal (client or s
1260: 65 72 76 65 72 29 20 63 65 72 74 69 66 69 63 61  erver) certifica
1270: 74 65 2e 20 49 74 20 61 6c 73 6f 20 63 6f 6e 74  te. It also cont
1280: 61 69 6e 73 20 74 68 65 20 70 75 62 6c 69 63 20  ains the public 
1290: 6b 65 79 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  key...[opt_def -
12a0: 63 65 72 74 20 5b 61 72 67 20 73 74 72 69 6e 67  cert [arg string
12b0: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
12c0: 20 63 65 72 74 69 66 69 63 61 74 65 20 74 6f 20   certificate to 
12d0: 75 73 65 20 61 73 20 61 20 44 45 52 20 65 6e 63  use as a DER enc
12e0: 6f 64 65 64 20 73 74 72 69 6e 67 20 28 58 2e 35  oded string (X.5
12f0: 30 39 20 44 45 52 29 2e 0a 0a 5b 6f 70 74 5f 64  09 DER)...[opt_d
1300: 65 66 20 2d 63 69 70 68 65 72 20 5b 61 72 67 20  ef -cipher [arg 
1310: 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69  string]].Specifi
1320: 65 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20 63  es the list of c
1330: 69 70 68 65 72 73 20 74 6f 20 75 73 65 20 66 6f  iphers to use fo
1340: 72 20 54 4c 53 20 31 2e 32 20 61 6e 64 20 65 61  r TLS 1.2 and ea
1350: 72 6c 69 65 72 20 63 6f 6e 6e 65 63 74 69 6f 6e  rlier connection
1360: 73 2e 0a 53 74 72 69 6e 67 20 69 73 20 61 20 63  s..String is a c
1370: 6f 6c 6f 6e 20 22 5b 63 6f 6e 73 74 20 3a 5d 22  olon "[const :]"
1380: 20 73 65 70 61 72 61 74 65 64 20 6c 69 73 74 20   separated list 
1390: 6f 66 20 63 69 70 68 65 72 73 2e 0a 43 69 70 68  of ciphers..Ciph
13a0: 65 72 73 20 63 61 6e 20 62 65 20 63 6f 6d 62 69  ers can be combi
13b0: 6e 65 64 20 75 73 69 6e 67 20 74 68 65 20 22 5b  ned using the "[
13c0: 63 6f 6e 73 74 20 2b 5d 22 20 63 68 61 72 61 63  const +]" charac
13d0: 74 65 72 2e 0a 50 72 65 66 69 78 65 73 20 63 61  ter..Prefixes ca
13e0: 6e 20 62 65 20 75 73 65 64 20 74 6f 20 70 65 72  n be used to per
13f0: 6d 61 6e 65 6e 74 6c 79 20 72 65 6d 6f 76 65 20  manently remove 
1400: 22 5b 63 6f 6e 73 74 20 21 5d 22 2c 20 64 65 6c  "[const !]", del
1410: 65 74 65 20 22 5b 63 6f 6e 73 74 20 2d 5d 22 2c  ete "[const -]",
1420: 20 6f 72 0a 6d 6f 76 65 20 74 6f 20 74 68 65 20   or.move to the 
1430: 65 6e 64 20 22 5b 63 6f 6e 73 74 20 2b 5d 22 20  end "[const +]" 
1440: 61 20 73 70 65 63 69 66 69 65 64 20 63 69 70 68  a specified ciph
1450: 65 72 2e 0a 4b 65 79 77 6f 72 64 73 20 5b 63 6f  er..Keywords [co
1460: 6e 73 74 20 40 53 54 52 45 4e 47 54 48 5d 20 28  nst @STRENGTH] (
1470: 73 6f 72 74 20 62 79 20 61 6c 67 6f 72 69 74 68  sort by algorith
1480: 6d 20 6b 65 79 20 6c 65 6e 67 74 68 29 2c 0a 5b  m key length),.[
1490: 63 6f 6e 73 74 20 40 53 45 43 4c 45 56 45 4c 3d  const @SECLEVEL=
14a0: 5d 5b 65 6d 70 68 20 6e 5d 20 28 73 65 74 20 73  ][emph n] (set s
14b0: 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20 74 6f  ecurity level to
14c0: 20 6e 29 2c 20 61 6e 64 0a 5b 63 6f 6e 73 74 20   n), and.[const 
14d0: 44 45 46 41 55 4c 54 5d 20 28 75 73 65 20 64 65  DEFAULT] (use de
14e0: 66 61 75 6c 74 20 63 69 70 68 65 72 20 6c 69 73  fault cipher lis
14f0: 74 2c 20 61 74 20 73 74 61 72 74 20 6f 6e 6c 79  t, at start only
1500: 29 20 63 61 6e 20 61 6c 73 6f 20 62 65 20 73 70  ) can also be sp
1510: 65 63 69 66 69 65 64 2e 0a 53 65 65 20 74 68 65  ecified..See the
1520: 20 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 64   [uri "https://d
1530: 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f  ocs.openssl.org/
1540: 6d 61 73 74 65 72 2f 6d 61 6e 31 2f 6f 70 65 6e  master/man1/open
1550: 73 73 6c 2d 63 69 70 68 65 72 73 2f 23 6f 70 74  ssl-ciphers/#opt
1560: 69 6f 6e 73 22 20 4f 70 65 6e 53 53 4c 5d 0a 64  ions" OpenSSL].d
1570: 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72  ocumentation for
1580: 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20 6f   the full list o
1590: 66 20 76 61 6c 69 64 20 76 61 6c 75 65 73 2e 0a  f valid values..
15a0: 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 69 70 68 65  .[opt_def -ciphe
15b0: 72 73 75 69 74 65 73 20 5b 61 72 67 20 73 74 72  rsuites [arg str
15c0: 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ing]].Specifies 
15d0: 74 68 65 20 6c 69 73 74 20 6f 66 20 63 69 70 68  the list of ciph
15e0: 65 72 20 73 75 69 74 65 73 20 74 6f 20 75 73 65  er suites to use
15f0: 20 66 6f 72 20 54 4c 53 20 31 2e 33 20 61 73 20   for TLS 1.3 as 
1600: 61 20 63 6f 6c 6f 6e 0a 22 5b 63 6f 6e 73 74 20  a colon."[const 
1610: 3a 5d 22 20 73 65 70 61 72 61 74 65 64 20 6c 69  :]" separated li
1620: 73 74 20 6f 66 20 63 69 70 68 65 72 20 73 75 69  st of cipher sui
1630: 74 65 20 6e 61 6d 65 73 2e 20 53 65 65 20 74 68  te names. See th
1640: 65 0a 5b 75 72 69 20 22 68 74 74 70 73 3a 2f 2f  e.[uri "https://
1650: 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67  docs.openssl.org
1660: 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f 6f 70 65  /master/man1/ope
1670: 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f 23 6f 70  nssl-ciphers/#op
1680: 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53 4c 5d 0a  tions" OpenSSL].
1690: 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f  documentation fo
16a0: 72 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 20  r the full list 
16b0: 6f 66 20 76 61 6c 69 64 20 76 61 6c 75 65 73 2e  of valid values.
16c0: 0a 54 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20  .This option is 
16d0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
16e0: 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  .8...[opt_def -c
16f0: 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c  ommand [arg call
1700: 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73  back]].Specifies
1710: 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f   the callback co
1720: 6d 6d 61 6e 64 20 74 6f 20 62 65 20 69 6e 76 6f  mmand to be invo
1730: 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70  ked at several p
1740: 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65  oints during the
1750: 0a 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 70 61  .handshake to pa
1760: 73 73 20 65 72 72 6f 72 73 2c 20 74 72 61 63 69  ss errors, traci
1770: 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20  ng information, 
1780: 61 6e 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 65 73  and protocol mes
1790: 73 61 67 65 73 2e 0a 53 65 65 20 5b 73 65 63 74  sages..See [sect
17a0: 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70  ref "Callback Op
17b0: 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65  tions"] for more
17c0: 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66   info...[opt_def
17d0: 20 2d 64 68 70 61 72 61 6d 73 20 5b 61 72 67 20   -dhparams [arg 
17e0: 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63 69  filename]].Speci
17f0: 66 69 65 73 20 74 68 65 20 44 69 66 66 69 65 2d  fies the Diffie-
1800: 48 65 6c 6c 6d 61 6e 20 28 44 48 29 20 70 61 72  Hellman (DH) par
1810: 61 6d 65 74 65 72 73 20 66 69 6c 65 2e 0a 0a 5b  ameters file...[
1820: 6f 70 74 5f 64 65 66 20 2d 6b 65 79 66 69 6c 65  opt_def -keyfile
1830: 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d 5d   [arg filename]]
1840: 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20 70  .Specifies the p
1850: 72 69 76 61 74 65 20 6b 65 79 20 66 69 6c 65 2e  rivate key file.
1860: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
1870: 74 6f 20 75 73 65 20 74 68 65 20 66 69 6c 65 0a  to use the file.
1880: 73 70 65 63 69 66 69 65 64 20 62 79 20 74 68 65  specified by the
1890: 20 5b 61 72 67 20 2d 63 65 72 74 66 69 6c 65 5d   [arg -certfile]
18a0: 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64   option...[opt_d
18b0: 65 66 20 2d 6b 65 79 20 5b 61 72 67 20 73 74 72  ef -key [arg str
18c0: 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ing]].Specifies 
18d0: 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20  the private key 
18e0: 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52 20  to use as a DER 
18f0: 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20 28  encoded string (
1900: 50 4b 43 53 23 31 20 44 45 52 29 2e 0a 0a 5b 6f  PKCS#1 DER)...[o
1910: 70 74 5f 64 65 66 20 2d 6d 6f 64 65 6c 20 5b 61  pt_def -model [a
1920: 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 46 6f 72  rg channel]].For
1930: 63 65 20 74 68 69 73 20 63 68 61 6e 6e 65 6c 20  ce this channel 
1940: 74 6f 20 73 68 61 72 65 20 74 68 65 20 73 61 6d  to share the sam
1950: 65 20 5b 74 65 72 6d 20 53 53 4c 5f 43 54 58 5d  e [term SSL_CTX]
1960: 20 73 74 72 75 63 74 75 72 65 20 61 73 20 74 68   structure as th
1970: 65 0a 73 70 65 63 69 66 69 65 64 20 5b 61 72 67  e.specified [arg
1980: 20 63 68 61 6e 6e 65 6c 5d 2c 20 61 6e 64 20 74   channel], and t
1990: 68 65 72 65 66 6f 72 65 20 73 68 61 72 65 20 63  herefore share c
19a0: 6f 6e 66 69 67 2c 20 63 61 6c 6c 62 61 63 6b 73  onfig, callbacks
19b0: 2c 20 65 74 63 2e 0a 0a 5b 6f 70 74 5f 64 65 66  , etc...[opt_def
19c0: 20 2d 70 61 73 73 77 6f 72 64 20 5b 61 72 67 20   -password [arg 
19d0: 63 61 6c 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69  callback]].Speci
19e0: 66 69 65 73 20 74 68 65 20 63 61 6c 6c 62 61 63  fies the callbac
19f0: 6b 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 69 6e 76  k command to inv
1a00: 6f 6b 65 20 77 68 65 6e 20 4f 70 65 6e 53 53 4c  oke when OpenSSL
1a10: 20 6e 65 65 64 73 20 74 6f 20 6f 62 74 61 69 6e   needs to obtain
1a20: 20 61 0a 70 61 73 73 77 6f 72 64 2e 20 54 68 69   a.password. Thi
1a30: 73 20 69 73 20 74 79 70 69 63 61 6c 6c 79 20 75  s is typically u
1a40: 73 65 64 20 74 6f 20 75 6e 6c 6f 63 6b 20 74 68  sed to unlock th
1a50: 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 6f 66  e private key of
1a60: 20 61 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a   a certificate..
1a70: 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 68 6f  The callback sho
1a80: 75 6c 64 20 72 65 74 75 72 6e 20 61 20 70 61 73  uld return a pas
1a90: 73 77 6f 72 64 20 73 74 72 69 6e 67 2e 20 54 68  sword string. Th
1aa0: 69 73 20 6f 70 74 69 6f 6e 20 68 61 73 20 63 68  is option has ch
1ab0: 61 6e 67 65 64 20 66 6f 72 0a 54 63 6c 54 4c 53  anged for.TclTLS
1ac0: 20 31 2e 38 2e 20 53 65 65 20 5b 73 65 63 74 72   1.8. See [sectr
1ad0: 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74  ef "Callback Opt
1ae0: 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20  ions"] for more 
1af0: 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  info...[opt_def 
1b00: 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b 65 20  -post_handshake 
1b10: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 41 6c 6c 6f  [arg bool]].Allo
1b20: 77 20 70 6f 73 74 2d 68 61 6e 64 73 68 61 6b 65  w post-handshake
1b30: 20 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20   session ticket 
1b40: 75 70 64 61 74 65 73 2e 20 54 68 69 73 20 6f 70  updates. This op
1b50: 74 69 6f 6e 20 69 73 20 6e 65 77 20 66 6f 72 20  tion is new for 
1b60: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70  TclTLS 1.8...[op
1b70: 74 5f 64 65 66 20 2d 72 65 71 75 65 73 74 20 5b  t_def -request [
1b80: 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 65  arg bool]].Reque
1b90: 73 74 20 61 20 63 65 72 74 69 66 69 63 61 74 65  st a certificate
1ba0: 20 66 72 6f 6d 20 74 68 65 20 70 65 65 72 20 64   from the peer d
1bb0: 75 72 69 6e 67 20 74 68 65 20 53 53 4c 20 68 61  uring the SSL ha
1bc0: 6e 64 73 68 61 6b 65 2e 20 54 68 69 73 20 69 73  ndshake. This is
1bd0: 20 6e 65 65 64 65 64 0a 74 6f 20 64 6f 20 43 65   needed.to do Ce
1be0: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
1bf0: 74 69 6f 6e 2e 20 53 74 61 72 74 69 6e 67 20 69  tion. Starting i
1c00: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c 20 74 68  n TclTLS 1.8, th
1c10: 65 20 64 65 66 61 75 6c 74 20 69 73 0a 5b 63 6f  e default is.[co
1c20: 6e 73 74 20 74 72 75 65 5d 2e 20 53 74 61 72 74  nst true]. Start
1c30: 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e  ing in TclTLS 2.
1c40: 30 2c 20 49 66 20 73 65 74 20 74 6f 20 5b 63 6f  0, If set to [co
1c50: 6e 73 74 20 66 61 6c 73 65 5d 20 61 6e 64 0a 5b  nst false] and.[
1c60: 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d  option -require]
1c70: 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d   is [const true]
1c80: 2c 20 74 68 65 6e 20 74 68 69 73 20 77 69 6c 6c  , then this will
1c90: 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 74   be overridden t
1ca0: 6f 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 0a  o [const true]..
1cb0: 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43 65  See [sectref "Ce
1cc0: 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64 61  rtificate Valida
1cd0: 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20  tion"] for more 
1ce0: 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64  details...[opt_d
1cf0: 65 66 20 2d 72 65 71 75 69 72 65 20 5b 61 72 67  ef -require [arg
1d00: 20 62 6f 6f 6c 5d 5d 0a 52 65 71 75 69 72 65 20   bool]].Require 
1d10: 61 20 76 61 6c 69 64 20 63 65 72 74 69 66 69 63  a valid certific
1d20: 61 74 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65  ate from the pee
1d30: 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c  r during the SSL
1d40: 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20 74   handshake. If t
1d50: 68 69 73 20 69 73 0a 73 65 74 20 74 6f 20 74 72  his is.set to tr
1d60: 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f 6e  ue, then [option
1d70: 20 2d 72 65 71 75 65 73 74 5d 20 6d 75 73 74 20   -request] must 
1d80: 61 6c 73 6f 20 62 65 20 73 65 74 20 74 6f 20 74  also be set to t
1d90: 72 75 65 20 61 6e 64 20 61 20 65 69 74 68 65 72  rue and a either
1da0: 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d  .[option -cadir]
1db0: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c  , [option -cafil
1dc0: 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73  e], [option -cas
1dd0: 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70 6c 61 74  tore], or a plat
1de0: 66 6f 72 6d 20 64 65 66 61 75 6c 74 0a 6d 75 73  form default.mus
1df0: 74 20 62 65 20 70 72 6f 76 69 64 65 64 20 69 6e  t be provided in
1e00: 20 6f 72 64 65 72 20 74 6f 20 76 61 6c 69 64 61   order to valida
1e10: 74 65 20 61 67 61 69 6e 73 74 2e 20 54 68 65 20  te against. The 
1e20: 64 65 66 61 75 6c 74 20 69 6e 20 54 63 6c 54 4c  default in TclTL
1e30: 53 20 31 2e 38 20 61 6e 64 0a 65 61 72 6c 69 65  S 1.8 and.earlie
1e40: 72 20 76 65 72 73 69 6f 6e 73 20 69 73 20 5b 63  r versions is [c
1e50: 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e 63  onst false] sinc
1e60: 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61 74 66 6f  e not all platfo
1e70: 72 6d 73 20 68 61 76 65 20 63 65 72 74 69 66 69  rms have certifi
1e80: 63 61 74 65 73 20 74 6f 0a 76 61 6c 69 64 61 74  cates to.validat
1e90: 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20 66  e against in a f
1ea0: 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20 77  orm compatible w
1eb0: 69 74 68 20 4f 70 65 6e 53 53 4c 2e 20 53 74 61  ith OpenSSL. Sta
1ec0: 72 74 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20  rting in TclTLS 
1ed0: 32 2e 30 2c 0a 74 68 65 20 64 65 66 61 75 6c 74  2.0,.the default
1ee0: 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d   is [const true]
1ef0: 2e 0a 53 65 65 20 5b 73 65 63 74 72 65 66 20 22  ..See [sectref "
1f00: 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69  Certificate Vali
1f10: 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72  dation"] for mor
1f20: 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74  e details...[opt
1f30: 5f 64 65 66 20 2d 73 65 63 75 72 69 74 79 5f 6c  _def -security_l
1f40: 65 76 65 6c 20 5b 61 72 67 20 69 6e 74 65 67 65  evel [arg intege
1f50: 72 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  r]].Specifies th
1f60: 65 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c  e security level
1f70: 20 28 76 61 6c 75 65 20 66 72 6f 6d 20 30 20 74   (value from 0 t
1f80: 6f 20 35 29 2e 20 54 68 65 20 73 65 63 75 72 69  o 5). The securi
1f90: 74 79 20 6c 65 76 65 6c 20 61 66 66 65 63 74 73  ty level affects
1fa0: 0a 74 68 65 20 61 6c 6c 6f 77 65 64 20 63 69 70  .the allowed cip
1fb0: 68 65 72 20 73 75 69 74 65 20 65 6e 63 72 79 70  her suite encryp
1fc0: 74 69 6f 6e 20 61 6c 67 6f 72 69 74 68 6d 73 2c  tion algorithms,
1fd0: 20 73 75 70 70 6f 72 74 65 64 20 45 43 43 20 63   supported ECC c
1fe0: 75 72 76 65 73 2c 0a 73 75 70 70 6f 72 74 65 64  urves,.supported
1ff0: 20 73 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72   signature algor
2000: 69 74 68 6d 73 2c 20 44 48 20 70 61 72 61 6d 65  ithms, DH parame
2010: 74 65 72 20 73 69 7a 65 73 2c 20 63 65 72 74 69  ter sizes, certi
2020: 66 69 63 61 74 65 20 6b 65 79 20 73 69 7a 65 73  ficate key sizes
2030: 0a 61 6e 64 20 73 69 67 6e 61 74 75 72 65 20 61  .and signature a
2040: 6c 67 6f 72 69 74 68 6d 73 2e 20 54 68 65 20 64  lgorithms. The d
2050: 65 66 61 75 6c 74 20 69 73 20 31 20 70 72 69 6f  efault is 1 prio
2060: 72 20 74 6f 20 4f 70 65 6e 53 53 4c 20 33 2e 32  r to OpenSSL 3.2
2070: 20 61 6e 64 20 32 0a 74 68 65 72 65 61 66 74 65   and 2.thereafte
2080: 72 2e 20 4c 65 76 65 6c 20 33 20 61 6e 64 20 68  r. Level 3 and h
2090: 69 67 68 65 72 20 64 69 73 61 62 6c 65 20 73 75  igher disable su
20a0: 70 70 6f 72 74 20 66 6f 72 20 73 65 73 73 69 6f  pport for sessio
20b0: 6e 20 74 69 63 6b 65 74 73 20 61 6e 64 0a 6f 6e  n tickets and.on
20c0: 6c 79 20 61 63 63 65 70 74 20 63 69 70 68 65 72  ly accept cipher
20d0: 20 73 75 69 74 65 73 20 74 68 61 74 20 70 72 6f   suites that pro
20e0: 76 69 64 65 20 66 6f 72 77 61 72 64 20 73 65 63  vide forward sec
20f0: 72 65 63 79 2e 0a 54 68 69 73 20 6f 70 74 69 6f  recy..This optio
2100: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  n is new for Tcl
2110: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64  TLS 1.8...[opt_d
2120: 65 66 20 2d 73 65 72 76 65 72 20 5b 61 72 67 20  ef -server [arg 
2130: 62 6f 6f 6c 5d 5d 0a 53 70 65 63 69 66 69 65 73  bool]].Specifies
2140: 20 77 68 65 74 68 65 72 20 74 6f 20 61 63 74 20   whether to act 
2150: 61 73 20 61 20 73 65 72 76 65 72 20 61 6e 64 20  as a server and 
2160: 72 65 73 70 6f 6e 64 20 77 69 74 68 20 61 20 73  respond with a s
2170: 65 72 76 65 72 20 68 61 6e 64 73 68 61 6b 65 20  erver handshake 
2180: 77 68 65 6e 20 61 0a 63 6c 69 65 6e 74 20 63 6f  when a.client co
2190: 6e 6e 65 63 74 73 20 61 6e 64 20 70 72 6f 76 69  nnects and provi
21a0: 64 65 73 20 61 20 63 6c 69 65 6e 74 20 68 61 6e  des a client han
21b0: 64 73 68 61 6b 65 2e 20 54 68 65 20 64 65 66 61  dshake. The defa
21c0: 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66 61  ult is [const fa
21d0: 6c 73 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  lse]...[opt_def 
21e0: 2d 73 65 72 76 65 72 6e 61 6d 65 20 5b 61 72 67  -servername [arg
21f0: 20 68 6f 73 74 6e 61 6d 65 5d 5d 0a 53 70 65 63   hostname]].Spec
2200: 69 66 79 20 74 68 65 20 70 65 65 72 27 73 20 68  ify the peer's h
2210: 6f 73 74 6e 61 6d 65 2e 20 54 68 69 73 20 69 73  ostname. This is
2220: 20 75 73 65 64 20 74 6f 20 73 65 74 20 74 68 65   used to set the
2230: 20 54 4c 53 20 53 65 72 76 65 72 20 4e 61 6d 65   TLS Server Name
2240: 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28 53 4e 49   Indication.(SNI
2250: 29 20 65 78 74 65 6e 73 69 6f 6e 2e 20 53 65 74  ) extension. Set
2260: 20 74 68 69 73 20 74 6f 20 74 68 65 20 65 78 70   this to the exp
2270: 65 63 74 65 64 20 73 65 72 76 65 72 6e 61 6d 65  ected servername
2280: 20 69 6e 20 74 68 65 20 73 65 72 76 65 72 27 73   in the server's
2290: 20 63 65 72 74 69 66 69 63 61 74 65 0a 6f 72 20   certificate.or 
22a0: 6f 6e 65 20 6f 66 20 74 68 65 20 53 75 62 6a 65  one of the Subje
22b0: 63 74 20 41 6c 74 65 72 6e 61 74 65 20 4e 61 6d  ct Alternate Nam
22c0: 65 73 20 28 53 41 4e 29 2e 20 53 74 61 72 74 69  es (SAN). Starti
22d0: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30  ng in TclTLS 2.0
22e0: 2c 20 74 68 69 73 20 77 69 6c 6c 0a 64 65 66 61  , this will.defa
22f0: 75 6c 74 20 74 6f 20 74 68 65 20 68 6f 73 74 20  ult to the host 
2300: 66 6f 72 20 74 68 65 20 5b 63 6d 64 20 74 6c 73  for the [cmd tls
2310: 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e  ::socket] comman
2320: 64 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65  d...[opt_def -se
2330: 73 73 69 6f 6e 5f 69 64 20 5b 61 72 67 20 62 69  ssion_id [arg bi
2340: 6e 61 72 79 5f 73 74 72 69 6e 67 5d 5d 0a 53 70  nary_string]].Sp
2350: 65 63 69 66 69 65 73 20 74 68 65 20 73 65 73 73  ecifies the sess
2360: 69 6f 6e 20 69 64 20 74 6f 20 72 65 73 75 6d 65  ion id to resume
2370: 20 61 20 73 65 73 73 69 6f 6e 2e 20 4e 6f 74 20   a session. Not 
2380: 73 75 70 70 6f 72 74 65 64 20 79 65 74 2e 0a 54  supported yet..T
2390: 68 69 73 20 6f 70 74 69 6f 6e 20 69 73 20 6e 65  his option is ne
23a0: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
23b0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 73 6c  ...[opt_def -ssl
23c0: 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e  2 [arg bool]].En
23d0: 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20  able use of SSL 
23e0: 76 32 2e 54 68 65 20 64 65 66 61 75 6c 74 20 69  v2.The default i
23f0: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e  s [const false].
2400: 0a 4f 70 65 6e 53 53 4c 20 31 2e 31 2b 20 6e 6f  .OpenSSL 1.1+ no
2410: 20 6c 6f 6e 67 65 72 20 73 75 70 70 6f 72 74 73   longer supports
2420: 20 53 53 4c 20 76 32 2c 20 73 6f 20 74 68 69 73   SSL v2, so this
2430: 20 6d 61 79 20 6e 6f 74 20 68 61 76 65 20 61 6e   may not have an
2440: 79 20 65 66 66 65 63 74 2e 0a 53 65 65 20 74 68  y effect..See th
2450: 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74  e [cmd tls::prot
2460: 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66  ocols] command f
2470: 6f 72 20 73 75 70 70 6f 72 74 65 64 20 70 72 6f  or supported pro
2480: 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65  tocols...[opt_de
2490: 66 20 2d 73 73 6c 33 20 5b 61 72 67 20 62 6f 6f  f -ssl3 [arg boo
24a0: 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f  l]].Enable use o
24b0: 66 20 53 53 4c 20 76 33 2e 20 54 68 65 20 64 65  f SSL v3. The de
24c0: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
24d0: 66 61 6c 73 65 5d 2e 20 53 74 61 72 74 69 6e 67  false]. Starting
24e0: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2c 0a   in TclTLS 1.8,.
24f0: 75 73 65 20 6f 66 20 53 53 4c 20 76 33 20 69 66  use of SSL v3 if
2500: 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20   only available 
2510: 76 69 61 20 61 20 63 6f 6d 70 69 6c 65 20 74 69  via a compile ti
2520: 6d 65 20 6f 70 74 69 6f 6e 2e 0a 53 65 65 20 74  me option..See t
2530: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f  he [cmd tls::pro
2540: 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20  tocols] command 
2550: 66 6f 72 20 73 75 70 70 6f 72 74 65 64 20 70 72  for supported pr
2560: 6f 74 6f 63 6f 6c 73 2e 0a 0a 5b 6f 70 74 5f 64  otocols...[opt_d
2570: 65 66 20 2d 74 6c 73 31 20 5b 61 72 67 20 62 6f  ef -tls1 [arg bo
2580: 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20  ol]].Enable use 
2590: 6f 66 20 54 4c 53 20 76 31 2e 20 53 74 61 72 74  of TLS v1. Start
25a0: 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e  ing in TclTLS 2.
25b0: 30 2c 20 74 68 65 20 64 65 66 61 75 6c 74 20 69  0, the default i
25c0: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e  s [const false].
25d0: 0a 4e 6f 74 65 3a 20 54 4c 53 20 31 2e 30 20 6e  .Note: TLS 1.0 n
25e0: 65 65 64 73 20 53 48 41 31 20 74 6f 20 6f 70 65  eeds SHA1 to ope
25f0: 72 61 74 65 2c 20 77 68 69 63 68 20 69 73 20 6f  rate, which is o
2600: 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 20 69 6e  nly available in
2610: 20 73 65 63 75 72 69 74 79 20 6c 65 76 65 6c 0a   security level.
2620: 30 20 66 6f 72 20 4f 70 65 6e 20 53 53 4c 20 33  0 for Open SSL 3
2630: 2e 30 2b 2e 20 53 65 65 20 74 68 65 20 5b 61 72  .0+. See the [ar
2640: 67 20 2d 73 65 63 75 72 69 74 79 5f 6c 65 76 65  g -security_leve
2650: 6c 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74  l] option...[opt
2660: 5f 64 65 66 20 2d 74 6c 73 31 2e 31 20 5b 61 72  _def -tls1.1 [ar
2670: 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20  g bool]].Enable 
2680: 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 31 2e  use of TLS v1.1.
2690: 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c   Starting in Tcl
26a0: 54 4c 53 20 32 2e 30 2c 20 74 68 65 20 64 65 66  TLS 2.0, the def
26b0: 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66  ault is [const f
26c0: 61 6c 73 65 5d 2e 0a 4e 6f 74 65 3a 20 54 4c 53  alse]..Note: TLS
26d0: 20 31 2e 31 20 6e 65 65 64 73 20 53 48 41 31 20   1.1 needs SHA1 
26e0: 74 6f 20 6f 70 65 72 61 74 65 2c 20 77 68 69 63  to operate, whic
26f0: 68 20 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61  h is only availa
2700: 62 6c 65 20 69 6e 20 73 65 63 75 72 69 74 79 20  ble in security 
2710: 6c 65 76 65 6c 0a 30 20 66 6f 72 20 4f 70 65 6e  level.0 for Open
2720: 20 53 53 4c 20 33 2e 30 2b 2e 20 53 65 65 20 74   SSL 3.0+. See t
2730: 68 65 20 5b 61 72 67 20 2d 73 65 63 75 72 69 74  he [arg -securit
2740: 79 5f 6c 65 76 65 6c 5d 20 6f 70 74 69 6f 6e 2e  y_level] option.
2750: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31  ..[opt_def -tls1
2760: 2e 32 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45  .2 [arg bool]].E
2770: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53  nable use of TLS
2780: 20 76 31 2e 32 2e 20 54 68 65 20 64 65 66 61 75   v1.2. The defau
2790: 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75  lt is [const tru
27a0: 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 74  e]...[opt_def -t
27b0: 6c 73 31 2e 33 20 5b 61 72 67 20 62 6f 6f 6c 5d  ls1.3 [arg bool]
27c0: 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20  ].Enable use of 
27d0: 54 4c 53 20 76 31 2e 33 2e 20 54 68 65 20 64 65  TLS v1.3. The de
27e0: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
27f0: 74 72 75 65 5d 2e 20 54 68 69 73 20 69 73 20 6f  true]. This is o
2800: 6e 6c 79 20 61 76 61 69 6c 61 62 6c 65 0a 73 74  nly available.st
2810: 61 72 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e  arting with Open
2820: 53 53 4c 20 31 2e 31 2e 31 20 61 6e 64 20 54 63  SSL 1.1.1 and Tc
2830: 6c 54 4c 53 20 31 2e 37 2e 0a 0a 5b 6f 70 74 5f  lTLS 1.7...[opt_
2840: 64 65 66 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d  def -validatecom
2850: 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62 61  mand [arg callba
2860: 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74  ck]].Specifies t
2870: 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d  he callback comm
2880: 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20 74 6f  and to invoke to
2890: 20 76 61 6c 69 64 61 74 65 20 74 68 65 20 70 65   validate the pe
28a0: 65 72 20 63 65 72 74 69 66 69 63 61 74 65 73 0a  er certificates.
28b0: 61 6e 64 20 6f 74 68 65 72 20 63 6f 6e 66 69 67  and other config
28c0: 20 69 6e 66 6f 20 64 75 72 69 6e 67 20 74 68 65   info during the
28d0: 20 70 72 6f 74 6f 63 6f 6c 20 6e 65 67 6f 74 69   protocol negoti
28e0: 61 74 69 6f 6e 20 70 68 61 73 65 2e 20 54 68 69  ation phase. Thi
28f0: 73 20 63 61 6e 20 62 65 20 75 73 65 64 0a 62 79  s can be used.by
2900: 20 54 43 4c 20 73 63 72 69 70 74 73 20 74 6f 20   TCL scripts to 
2910: 70 65 72 66 6f 72 6d 20 74 68 65 69 72 20 6f 77  perform their ow
2920: 6e 20 43 65 72 74 69 66 69 63 61 74 65 20 56 61  n Certificate Va
2930: 6c 69 64 61 74 69 6f 6e 20 74 6f 20 73 75 70 70  lidation to supp
2940: 6c 65 6d 65 6e 74 20 74 68 65 0a 64 65 66 61 75  lement the.defau
2950: 6c 74 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72  lt validation pr
2960: 6f 76 69 64 65 64 20 62 79 20 4f 70 65 6e 53 53  ovided by OpenSS
2970: 4c 2e 20 54 68 65 20 73 63 72 69 70 74 20 6d 75  L. The script mu
2980: 73 74 20 72 65 74 75 72 6e 20 61 20 62 6f 6f 6c  st return a bool
2990: 65 61 6e 20 74 72 75 65 0a 74 6f 20 63 6f 6e 74  ean true.to cont
29a0: 69 6e 75 65 20 74 68 65 20 6e 65 67 6f 74 69 61  inue the negotia
29b0: 74 69 6f 6e 2e 20 53 65 65 20 5b 73 65 63 74 72  tion. See [sectr
29c0: 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74  ef "Callback Opt
29d0: 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65 20  ions"] for more 
29e0: 69 6e 66 6f 2e 0a 54 68 69 73 20 6f 70 74 69 6f  info..This optio
29f0: 6e 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  n is new for Tcl
2a00: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f  TLS 1.8...[list_
2a10: 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  end]..[call [cmd
2a20: 20 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d 20   tls::unimport] 
2a30: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a  [arg channel]]..
2a40: 43 6f 6d 70 6c 69 6d 65 6e 74 20 74 6f 20 5b 63  Compliment to [c
2a50: 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e  md tls::import].
2a60: 20 55 73 65 64 20 74 6f 20 72 65 6d 6f 76 65 20   Used to remove 
2a70: 74 68 65 20 74 6f 70 20 6c 65 76 65 6c 20 73 74  the top level st
2a80: 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 0a 66 72  acked channel.fr
2a90: 6f 6d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  om [arg channel]
2aa0: 2e 20 54 68 69 73 20 75 6e 73 74 61 63 6b 73 20  . This unstacks 
2ab0: 74 68 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f  the encryption o
2ac0: 66 20 61 20 72 65 67 75 6c 61 72 20 54 43 4c 20  f a regular TCL 
2ad0: 63 68 61 6e 6e 65 6c 2e 20 41 6e 0a 65 72 72 6f  channel. An.erro
2ae0: 72 20 69 73 20 74 68 72 6f 77 6e 20 69 66 20 54  r is thrown if T
2af0: 4c 53 20 69 73 20 6e 6f 74 20 74 68 65 20 74 6f  LS is not the to
2b00: 70 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65  p stacked channe
2b10: 6c 20 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c 20 5b  l type...[call [
2b20: 63 6d 64 20 74 6c 73 3a 3a 68 61 6e 64 73 68 61  cmd tls::handsha
2b30: 6b 65 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c  ke] [arg channel
2b40: 5d 5d 0a 0a 46 6f 72 63 65 73 20 74 68 65 20 54  ]]..Forces the T
2b50: 4c 53 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20 68  LS negotiation h
2b60: 61 6e 64 73 68 61 6b 65 20 74 6f 20 74 61 6b 65  andshake to take
2b70: 20 70 6c 61 63 65 20 69 6d 6d 65 64 69 61 74 65   place immediate
2b80: 6c 79 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20  ly, and returns 
2b90: 30 0a 69 66 20 68 61 6e 64 73 68 61 6b 65 20 69  0.if handshake i
2ba0: 73 20 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72  s still in progr
2bb0: 65 73 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e  ess (non-blockin
2bc0: 67 29 2c 20 6f 72 20 31 20 69 66 20 74 68 65 20  g), or 1 if the 
2bd0: 68 61 6e 64 73 68 61 6b 65 20 77 61 73 0a 73 75  handshake was.su
2be0: 63 63 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65  ccessful. If the
2bf0: 20 68 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65   handshake faile
2c00: 64 2c 20 61 6e 20 65 72 72 6f 72 20 77 69 6c 6c  d, an error will
2c10: 20 62 65 20 72 65 74 75 72 6e 65 64 2e 0a 0a 5b   be returned...[
2c20: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73  call [cmd tls::s
2c30: 74 61 74 75 73 5d 20 5b 6f 70 74 20 5b 6f 70 74  tatus] [opt [opt
2c40: 69 6f 6e 20 2d 6c 6f 63 61 6c 5d 5d 20 5b 61 72  ion -local]] [ar
2c50: 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74  g channel]]..Ret
2c60: 75 72 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74  urns the current
2c70: 20 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53   status of an SS
2c80: 4c 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72  L channel. The r
2c90: 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73 74 20  esult is a list 
2ca0: 6f 66 20 6b 65 79 2d 76 61 6c 75 65 0a 70 61 69  of key-value.pai
2cb0: 72 73 20 64 65 73 63 72 69 62 69 6e 67 20 74 68  rs describing th
2cc0: 65 20 53 53 4c 2c 20 63 65 72 74 69 66 69 63 61  e SSL, certifica
2cd0: 74 65 2c 20 61 6e 64 20 63 65 72 74 69 66 69 63  te, and certific
2ce0: 61 74 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e  ate verification
2cf0: 20 73 74 61 74 75 73 2e 20 49 66 0a 74 68 65 20   status. If.the 
2d00: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 20 68 61  SSL handshake ha
2d10: 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65  s not yet comple
2d20: 74 65 64 2c 20 61 6e 20 65 6d 70 74 79 20 6c 69  ted, an empty li
2d30: 73 74 20 69 73 20 72 65 74 75 72 6e 65 64 2e 20  st is returned. 
2d40: 49 66 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d  If the.[option -
2d50: 6c 6f 63 61 6c 5d 20 6f 70 74 69 6f 6e 20 69 73  local] option is
2d60: 20 73 70 65 63 69 66 69 65 64 2c 20 74 68 65 6e   specified, then
2d70: 20 74 68 65 20 6c 6f 63 61 6c 20 63 65 72 74 69   the local certi
2d80: 66 69 63 61 74 65 20 69 73 20 75 73 65 64 2e 20  ficate is used. 
2d90: 52 65 74 75 72 6e 65 64 0a 76 61 6c 75 65 73 20  Returned.values 
2da0: 69 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d  include:..[para]
2db0: 0a 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c  ..SSL Status..[l
2dc0: 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69  ist_begin defini
2dd0: 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76  tions]..[def "[v
2de0: 61 72 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70 72  ar alpn] [arg pr
2df0: 6f 74 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70 72  otocol]"].The pr
2e00: 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20  otocol selected 
2e10: 61 66 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f  after Applicatio
2e20: 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c  n-Layer Protocol
2e30: 20 4e 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c   Negotiation (AL
2e40: 50 4e 29 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  PN)..This value 
2e50: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
2e60: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
2e70: 61 72 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20  ar cipher] [arg 
2e80: 63 69 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75  cipher]"].The cu
2e90: 72 72 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20  rrent cipher in 
2ea0: 75 73 65 20 66 6f 72 20 74 68 65 20 73 65 73 73  use for the sess
2eb0: 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ion...[def "[var
2ec0: 20 70 65 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20   peername] [arg 
2ed0: 6e 61 6d 65 5d 22 5d 0a 54 68 65 20 70 65 65 72  name]"].The peer
2ee0: 6e 61 6d 65 20 66 72 6f 6d 20 74 68 65 20 63 65  name from the ce
2ef0: 72 74 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20  rtificate..This 
2f00: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
2f10: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
2f20: 65 66 20 22 5b 76 61 72 20 70 72 6f 74 6f 63 6f  ef "[var protoco
2f30: 6c 5d 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d  l] [arg version]
2f40: 22 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20  "].The protocol 
2f50: 76 65 72 73 69 6f 6e 20 75 73 65 64 20 66 6f 72  version used for
2f60: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 3a   the connection:
2f70: 20 53 53 4c 32 2c 20 53 53 4c 33 2c 20 54 4c 53   SSL2, SSL3, TLS
2f80: 31 2c 20 54 4c 53 31 2e 31 2c 20 54 4c 53 31 2e  1, TLS1.1, TLS1.
2f90: 32 2c 0a 54 4c 53 31 2e 33 2c 20 6f 72 20 75 6e  2,.TLS1.3, or un
2fa0: 6b 6e 6f 77 6e 2e 20 54 68 69 73 20 76 61 6c 75  known. This valu
2fb0: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
2fc0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
2fd0: 5b 76 61 72 20 73 62 69 74 73 5d 20 5b 61 72 67  [var sbits] [arg
2fe0: 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72   n]"].The number
2ff0: 20 6f 66 20 62 69 74 73 20 75 73 65 64 20 66 6f   of bits used fo
3000: 72 20 74 68 65 20 73 65 73 73 69 6f 6e 20 6b 65  r the session ke
3010: 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  y...[def "[var s
3020: 69 67 6e 61 74 75 72 65 48 61 73 68 41 6c 67 6f  ignatureHashAlgo
3030: 72 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f  rithm] [arg algo
3040: 72 69 74 68 6d 5d 22 5d 0a 54 68 65 20 73 69 67  rithm]"].The sig
3050: 6e 61 74 75 72 65 20 68 61 73 68 20 61 6c 67 6f  nature hash algo
3060: 72 69 74 68 6d 2e 0a 54 68 69 73 20 76 61 6c 75  rithm..This valu
3070: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3080: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3090: 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65 54 79  [var signatureTy
30a0: 70 65 5d 20 5b 61 72 67 20 74 79 70 65 5d 22 5d  pe] [arg type]"]
30b0: 0a 54 68 65 20 73 69 67 6e 61 74 75 72 65 20 74  .The signature t
30c0: 79 70 65 20 76 61 6c 75 65 2e 0a 54 68 69 73 20  ype value..This 
30d0: 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72  value is new for
30e0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
30f0: 65 66 20 22 5b 76 61 72 20 76 65 72 69 66 79 44  ef "[var verifyD
3100: 65 70 74 68 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a  epth] [arg n]"].
3110: 4d 61 78 69 6d 75 6d 20 64 65 70 74 68 20 66 6f  Maximum depth fo
3120: 72 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  r the certificat
3130: 65 20 63 68 61 69 6e 20 76 65 72 69 66 69 63 61  e chain verifica
3140: 74 69 6f 6e 2e 20 44 65 66 61 75 6c 74 20 69 73  tion. Default is
3150: 20 2d 31 2c 20 74 6f 20 63 68 65 63 6b 20 61 6c   -1, to check al
3160: 6c 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73  l..This value is
3170: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
3180: 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  1.8...[def "[var
3190: 20 76 65 72 69 66 79 4d 6f 64 65 5d 20 5b 61 72   verifyMode] [ar
31a0: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f  g list]"].List o
31b0: 66 20 63 65 72 74 69 66 69 63 61 74 65 20 76 65  f certificate ve
31c0: 72 69 66 69 63 61 74 69 6f 6e 20 6d 6f 64 65 73  rification modes
31d0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
31e0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
31f0: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
3200: 76 65 72 69 66 79 52 65 73 75 6c 74 5d 20 5b 61  verifyResult] [a
3210: 72 67 20 72 65 73 75 6c 74 5d 22 5d 0a 43 65 72  rg result]"].Cer
3220: 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63  tificate verific
3230: 61 74 69 6f 6e 20 72 65 73 75 6c 74 2e 0a 54 68  ation result..Th
3240: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
3250: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
3260: 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 61 5f 6e  .[def "[var ca_n
3270: 61 6d 65 73 5d 20 5b 61 72 67 20 6c 69 73 74 5d  ames] [arg list]
3280: 22 5d 0a 4c 69 73 74 20 6f 66 20 74 68 65 20 43  "].List of the C
3290: 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f  ertificate Autho
32a0: 72 69 74 69 65 73 20 75 73 65 64 20 74 6f 20 63  rities used to c
32b0: 72 65 61 74 65 20 74 68 65 20 63 65 72 74 69 66  reate the certif
32c0: 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75  icate..This valu
32d0: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
32e0: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f  TLS 1.8...[list_
32f0: 65 6e 64 5d 0a 0a 43 65 72 74 69 66 69 63 61 74  end]..Certificat
3300: 65 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f  e Status..[list_
3310: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
3320: 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 61  s]..[def "[var a
3330: 6c 6c 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  ll] [arg string]
3340: 22 5d 0a 44 75 6d 70 20 6f 66 20 61 6c 6c 20 63  "].Dump of all c
3350: 65 72 74 69 66 69 63 61 74 65 20 69 6e 66 6f 2e  ertificate info.
3360: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3370: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3380: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76  8...[def "[var v
3390: 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20 76 61 6c  ersion] [arg val
33a0: 75 65 5d 22 5d 0a 54 68 65 20 63 65 72 74 69 66  ue]"].The certif
33b0: 69 63 61 74 65 20 76 65 72 73 69 6f 6e 2e 0a 0a  icate version...
33c0: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 72 69 61  [def "[var seria
33d0: 6c 4e 75 6d 62 65 72 5d 20 5b 61 72 67 20 73 74  lNumber] [arg st
33e0: 72 69 6e 67 5d 22 5d 0a 54 68 65 20 73 65 72 69  ring]"].The seri
33f0: 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 74 68 65  al number of the
3400: 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73 20   certificate as 
3410: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68  a hex string..Th
3420: 69 73 20 76 61 6c 75 65 20 77 61 73 20 63 68 61  is value was cha
3430: 6e 67 65 64 20 66 72 6f 6d 20 73 65 72 69 61 6c  nged from serial
3440: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a   in TclTLS 1.8..
3450: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e  .[def "[var sign
3460: 61 74 75 72 65 5d 20 5b 61 72 67 20 61 6c 67 6f  ature] [arg algo
3470: 72 69 74 68 6d 5d 22 5d 0a 43 69 70 68 65 72 20  rithm]"].Cipher 
3480: 61 6c 67 6f 72 69 74 68 6d 20 75 73 65 64 20 66  algorithm used f
3490: 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 20 73  or certificate s
34a0: 69 67 6e 61 74 75 72 65 2e 0a 54 68 69 73 20 76  ignature..This v
34b0: 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20  alue is new for 
34c0: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65  TclTLS 1.8...[de
34d0: 66 20 22 5b 76 61 72 20 69 73 73 75 65 72 5d 20  f "[var issuer] 
34e0: 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54  [arg string]"].T
34f0: 68 65 20 64 69 73 74 69 6e 67 75 69 73 68 65 64  he distinguished
3500: 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66 20 74 68   name (DN) of th
3510: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 69 73  e certificate is
3520: 73 75 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  suer...[def "[va
3530: 72 20 6e 6f 74 42 65 66 6f 72 65 5d 20 5b 61 72  r notBefore] [ar
3540: 67 20 64 61 74 65 5d 22 5d 0a 54 68 65 20 62 65  g date]"].The be
3550: 67 69 6e 6e 69 6e 67 20 64 61 74 65 20 6f 66 20  ginning date of 
3560: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
3570: 76 61 6c 69 64 69 74 79 2e 0a 0a 5b 64 65 66 20  validity...[def 
3580: 22 5b 76 61 72 20 6e 6f 74 41 66 74 65 72 5d 20  "[var notAfter] 
3590: 5b 61 72 67 20 64 61 74 65 5d 22 5d 0a 54 68 65  [arg date]"].The
35a0: 20 65 78 70 69 72 61 74 69 6f 6e 20 64 61 74 65   expiration date
35b0: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
35c0: 61 74 65 20 76 61 6c 69 64 69 74 79 2e 0a 0a 5b  ate validity...[
35d0: 64 65 66 20 22 5b 76 61 72 20 73 75 62 6a 65 63  def "[var subjec
35e0: 74 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  t] [arg string]"
35f0: 5d 0a 54 68 65 20 64 69 73 74 69 6e 67 75 69 73  ].The distinguis
3600: 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66  hed name (DN) of
3610: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
3620: 20 73 75 62 6a 65 63 74 2e 20 46 69 65 6c 64 73   subject. Fields
3630: 20 69 6e 63 6c 75 64 65 3a 20 43 6f 6d 6d 6f 6e   include: Common
3640: 0a 4e 61 6d 65 20 28 43 4e 29 2c 20 4f 72 67 61  .Name (CN), Orga
3650: 6e 69 7a 61 74 69 6f 6e 20 28 4f 29 2c 20 4c 6f  nization (O), Lo
3660: 63 61 6c 69 74 79 20 6f 72 20 43 69 74 79 20 28  cality or City (
3670: 4c 29 2c 20 53 74 61 74 65 20 6f 72 20 50 72 6f  L), State or Pro
3680: 76 69 6e 63 65 20 28 53 29 2c 20 61 6e 64 0a 43  vince (S), and.C
3690: 6f 75 6e 74 72 79 20 4e 61 6d 65 20 28 43 29 2e  ountry Name (C).
36a0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73 73  ..[def "[var iss
36b0: 75 65 72 55 6e 69 71 75 65 49 44 5d 20 5b 61 72  uerUniqueID] [ar
36c0: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20  g string]"].The 
36d0: 69 73 73 75 65 72 20 75 6e 69 71 75 65 20 69 64  issuer unique id
36e0: 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20  ..This value is 
36f0: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
3700: 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  .8...[def "[var 
3710: 73 75 62 6a 65 63 74 55 6e 69 71 75 65 49 44 5d  subjectUniqueID]
3720: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3730: 54 68 65 20 73 75 62 6a 65 63 74 20 75 6e 69 71  The subject uniq
3740: 75 65 20 69 64 2e 0a 54 68 69 73 20 76 61 6c 75  ue id..This valu
3750: 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c  e is new for Tcl
3760: 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22  TLS 1.8...[def "
3770: 5b 76 61 72 20 6e 75 6d 5f 65 78 74 65 6e 73 69  [var num_extensi
3780: 6f 6e 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4e  ons] [arg n]"].N
3790: 75 6d 62 65 72 20 6f 66 20 63 65 72 74 69 66 69  umber of certifi
37a0: 63 61 74 65 20 65 78 74 65 6e 73 69 6f 6e 73 2e  cate extensions.
37b0: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
37c0: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
37d0: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65  8...[def "[var e
37e0: 78 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20  xtensions] [arg 
37f0: 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20  list]"].List of 
3800: 63 65 72 74 69 66 69 63 61 74 65 20 65 78 74 65  certificate exte
3810: 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e 0a 54 68 69  nsion names..Thi
3820: 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66  s value is new f
3830: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
3840: 5b 64 65 66 20 22 5b 76 61 72 20 61 75 74 68 6f  [def "[var autho
3850: 72 69 74 79 4b 65 79 49 64 65 6e 74 69 66 69 65  rityKeyIdentifie
3860: 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  r] [arg string]"
3870: 5d 0a 41 75 74 68 6f 72 69 74 79 20 4b 65 79 20  ].Authority Key 
3880: 49 64 65 6e 74 69 66 69 65 72 20 28 41 4b 49 29  Identifier (AKI)
3890: 20 6f 66 20 74 68 65 20 49 73 73 75 69 6e 67 20   of the Issuing 
38a0: 43 41 20 63 65 72 74 69 66 69 63 61 74 65 20 74  CA certificate t
38b0: 68 61 74 20 73 69 67 6e 65 64 20 74 68 65 0a 53  hat signed the.S
38c0: 53 4c 20 63 65 72 74 69 66 69 63 61 74 65 20 61  SL certificate a
38d0: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 20  s a hex string. 
38e0: 54 68 69 73 20 76 61 6c 75 65 20 6d 61 74 63 68  This value match
38f0: 65 73 20 74 68 65 20 53 4b 49 20 76 61 6c 75 65  es the SKI value
3900: 20 6f 66 20 74 68 65 0a 49 6e 74 65 72 6d 65 64   of the.Intermed
3910: 69 61 74 65 20 43 41 20 63 65 72 74 69 66 69 63  iate CA certific
3920: 61 74 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ate..This value 
3930: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3940: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3950: 61 72 20 73 75 62 6a 65 63 74 4b 65 79 49 64 65  ar subjectKeyIde
3960: 6e 74 69 66 69 65 72 5d 20 5b 61 72 67 20 73 74  ntifier] [arg st
3970: 72 69 6e 67 5d 22 5d 0a 53 75 62 6a 65 63 74 20  ring]"].Subject 
3980: 4b 65 79 20 49 64 65 6e 74 69 66 69 65 72 20 28  Key Identifier (
3990: 53 4b 49 29 20 68 61 73 68 20 6f 66 20 74 68 65  SKI) hash of the
39a0: 20 70 75 62 6c 69 63 20 6b 65 79 20 69 6e 73 69   public key insi
39b0: 64 65 20 74 68 65 20 63 65 72 74 69 66 69 63 61  de the certifica
39c0: 74 65 20 61 73 20 61 0a 68 65 78 20 73 74 72 69  te as a.hex stri
39d0: 6e 67 2e 20 55 73 65 64 20 74 6f 20 69 64 65 6e  ng. Used to iden
39e0: 74 69 66 79 20 63 65 72 74 69 66 69 63 61 74 65  tify certificate
39f0: 73 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 20 61  s that contain a
3a00: 20 70 61 72 74 69 63 75 6c 61 72 20 70 75 62 6c   particular publ
3a10: 69 63 20 6b 65 79 2e 0a 54 68 69 73 20 76 61 6c  ic key..This val
3a20: 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54 63  ue is new for Tc
3a30: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20  lTLS 1.8...[def 
3a40: 22 5b 76 61 72 20 73 75 62 6a 65 63 74 41 6c 74  "[var subjectAlt
3a50: 4e 61 6d 65 5d 20 5b 61 72 67 20 6c 69 73 74 5d  Name] [arg list]
3a60: 22 5d 0a 4c 69 73 74 20 6f 66 20 61 6c 6c 20 6f  "].List of all o
3a70: 66 20 74 68 65 20 53 75 62 6a 65 63 74 20 41 6c  f the Subject Al
3a80: 74 65 72 6e 61 74 69 76 65 20 4e 61 6d 65 73 20  ternative Names 
3a90: 28 53 41 4e 29 20 69 6e 63 6c 75 64 69 6e 67 20  (SAN) including 
3aa0: 64 6f 6d 61 69 6e 20 6e 61 6d 65 73 2c 20 73 75  domain names, su
3ab0: 62 0a 64 6f 6d 61 69 6e 73 2c 20 61 6e 64 20 49  b.domains, and I
3ac0: 50 20 61 64 64 72 65 73 73 65 73 20 74 68 61 74  P addresses that
3ad0: 20 61 72 65 20 73 65 63 75 72 65 64 20 62 79 20   are secured by 
3ae0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 2e  the certificate.
3af0: 0a 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e  .This value is n
3b00: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
3b10: 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6f  8...[def "[var o
3b20: 63 73 70 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22  csp] [arg list]"
3b30: 5d 0a 4c 69 73 74 20 6f 66 20 61 6c 6c 20 4f 6e  ].List of all On
3b40: 6c 69 6e 65 20 43 65 72 74 69 66 69 63 61 74 65  line Certificate
3b50: 20 53 74 61 74 75 73 20 50 72 6f 74 6f 63 6f 6c   Status Protocol
3b60: 20 28 4f 43 53 50 29 20 55 52 4c 73 20 74 68 61   (OCSP) URLs tha
3b70: 74 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f  t can be used to
3b80: 0a 63 68 65 63 6b 20 74 68 65 20 76 61 6c 69 64  .check the valid
3b90: 69 74 79 20 6f 66 20 74 68 69 73 20 63 65 72 74  ity of this cert
3ba0: 69 66 69 63 61 74 65 2e 0a 54 68 69 73 20 76 61  ificate..This va
3bb0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3bc0: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3bd0: 20 22 5b 76 61 72 20 63 65 72 74 69 66 69 63 61   "[var certifica
3be0: 74 65 5d 20 5b 61 72 67 20 63 65 72 74 5d 22 5d  te] [arg cert]"]
3bf0: 0a 54 68 65 20 50 45 4d 20 65 6e 63 6f 64 65 64  .The PEM encoded
3c00: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b   certificate...[
3c10: 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74  def "[var signat
3c20: 75 72 65 41 6c 67 6f 72 69 74 68 6d 5d 20 5b 61  ureAlgorithm] [a
3c30: 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d 0a  rg algorithm]"].
3c40: 43 69 70 68 65 72 20 61 6c 67 6f 72 69 74 68 6d  Cipher algorithm
3c50: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 65   used for the ce
3c60: 72 74 69 66 69 63 61 74 65 20 73 69 67 6e 61 74  rtificate signat
3c70: 75 72 65 2e 0a 54 68 69 73 20 76 61 6c 75 65 20  ure..This value 
3c80: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
3c90: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76  S 1.8...[def "[v
3ca0: 61 72 20 73 69 67 6e 61 74 75 72 65 56 61 6c 75  ar signatureValu
3cb0: 65 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  e] [arg string]"
3cc0: 5d 0a 43 65 72 74 69 66 69 63 61 74 65 20 73 69  ].Certificate si
3cd0: 67 6e 61 74 75 72 65 20 61 73 20 61 20 68 65 78  gnature as a hex
3ce0: 20 73 74 72 69 6e 67 2e 0a 54 68 69 73 20 76 61   string..This va
3cf0: 6c 75 65 20 69 73 20 6e 65 77 20 66 6f 72 20 54  lue is new for T
3d00: 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65 66  clTLS 1.8...[def
3d10: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65   "[var signature
3d20: 44 69 67 65 73 74 5d 20 5b 61 72 67 20 76 65 72  Digest] [arg ver
3d30: 73 69 6f 6e 5d 22 5d 0a 43 65 72 74 69 66 69 63  sion]"].Certific
3d40: 61 74 65 20 73 69 67 6e 69 6e 67 20 64 69 67 65  ate signing dige
3d50: 73 74 20 61 73 20 61 20 68 65 78 20 73 74 72 69  st as a hex stri
3d60: 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  ng..This value i
3d70: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
3d80: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   1.8...[def "[va
3d90: 72 20 70 75 62 6c 69 63 4b 65 79 41 6c 67 6f 72  r publicKeyAlgor
3da0: 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72  ithm] [arg algor
3db0: 69 74 68 6d 5d 22 5d 0a 43 65 72 74 69 66 69 63  ithm]"].Certific
3dc0: 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 70 75  ate signature pu
3dd0: 62 6c 69 63 20 6b 65 79 20 61 6c 67 6f 72 69 74  blic key algorit
3de0: 68 6d 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  hm..This value i
3df0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
3e00: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   1.8...[def "[va
3e10: 72 20 70 75 62 6c 69 63 4b 65 79 5d 20 5b 61 72  r publicKey] [ar
3e20: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74  g string]"].Cert
3e30: 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72  ificate signatur
3e40: 65 20 70 75 62 6c 69 63 20 6b 65 79 20 61 73 20  e public key as 
3e50: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 54 68  a hex string..Th
3e60: 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20  is value is new 
3e70: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
3e80: 0a 5b 64 65 66 20 22 5b 76 61 72 20 62 69 74 73  .[def "[var bits
3e90: 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62  ] [arg n]"].Numb
3ea0: 65 72 20 6f 66 20 62 69 74 73 20 75 73 65 64 20  er of bits used 
3eb0: 66 6f 72 20 63 65 72 74 69 66 69 63 61 74 65 20  for certificate 
3ec0: 73 69 67 6e 61 74 75 72 65 20 6b 65 79 2e 0a 54  signature key..T
3ed0: 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65 77  his value is new
3ee0: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
3ef0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 6c  ..[def "[var sel
3f00: 66 5f 73 69 67 6e 65 64 5d 20 5b 61 72 67 20 62  f_signed] [arg b
3f10: 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68 65 74 68 65  oolean]"].Whethe
3f20: 72 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  r the certificat
3f30: 65 20 73 69 67 6e 61 74 75 72 65 20 69 73 20 73  e signature is s
3f40: 65 6c 66 20 73 69 67 6e 65 64 2e 0a 54 68 69 73  elf signed..This
3f50: 20 76 61 6c 75 65 20 69 73 20 6e 65 77 20 66 6f   value is new fo
3f60: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
3f70: 64 65 66 20 22 5b 76 61 72 20 73 68 61 31 5f 68  def "[var sha1_h
3f80: 61 73 68 5d 20 5b 61 72 67 20 68 61 73 68 5d 22  ash] [arg hash]"
3f90: 5d 0a 54 68 65 20 53 48 41 31 20 68 61 73 68 20  ].The SHA1 hash 
3fa0: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61  of the certifica
3fb0: 74 65 20 61 73 20 61 20 68 65 78 20 73 74 72 69  te as a hex stri
3fc0: 6e 67 2e 0a 54 68 69 73 20 76 61 6c 75 65 20 69  ng..This value i
3fd0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
3fe0: 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   1.8...[def "[va
3ff0: 72 20 73 68 61 32 35 36 5f 68 61 73 68 5d 20 5b  r sha256_hash] [
4000: 61 72 67 20 68 61 73 68 5d 22 5d 0a 54 68 65 20  arg hash]"].The 
4010: 53 48 41 32 35 36 20 68 61 73 68 20 6f 66 20 74  SHA256 hash of t
4020: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61  he certificate a
4030: 73 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a  s a hex string..
4040: 54 68 69 73 20 76 61 6c 75 65 20 69 73 20 6e 65  This value is ne
4050: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
4060: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
4070: 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 63  call [cmd tls::c
4080: 6f 6e 6e 65 63 74 69 6f 6e 5d 20 5b 61 72 67 20  onnection] [arg 
4090: 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72  channel]]..Retur
40a0: 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 63  ns the current c
40b0: 6f 6e 6e 65 63 74 69 6f 6e 20 73 74 61 74 75 73  onnection status
40c0: 20 6f 66 20 61 6e 20 53 53 4c 20 63 68 61 6e 6e   of an SSL chann
40d0: 65 6c 2e 20 54 68 65 20 72 65 73 75 6c 74 20 69  el. The result i
40e0: 73 20 61 20 6c 69 73 74 0a 6f 66 20 6b 65 79 2d  s a list.of key-
40f0: 76 61 6c 75 65 20 70 61 69 72 73 20 64 65 73 63  value pairs desc
4100: 72 69 62 69 6e 67 20 74 68 65 20 63 6f 6e 6e 65  ribing the conne
4110: 63 74 69 6f 6e 2e 0a 54 68 69 73 20 63 6f 6d 6d  ction..This comm
4120: 61 6e 64 20 69 73 20 6e 65 77 20 66 6f 72 20 54  and is new for T
4130: 63 6c 54 4c 53 20 31 2e 38 2e 20 52 65 74 75 72  clTLS 1.8. Retur
4140: 6e 65 64 20 76 61 6c 75 65 73 20 69 6e 63 6c 75  ned values inclu
4150: 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a 53 53 4c  de:..[para]..SSL
4160: 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62   Status..[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 73 74  ]..[def "[var st
4190: 61 74 65 5d 20 5b 61 72 67 20 73 74 61 74 65 5d  ate] [arg state]
41a0: 22 5d 0a 53 74 61 74 65 20 6f 66 20 74 68 65 20  "].State of the 
41b0: 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65  connection...[de
41c0: 66 20 22 5b 76 61 72 20 73 65 72 76 65 72 6e 61  f "[var serverna
41d0: 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d  me] [arg name]"]
41e0: 0a 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65  .The name of the
41f0: 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 73 65   connected to se
4200: 72 76 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  rver...[def "[va
4210: 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72 67  r protocol] [arg
4220: 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20   version]"].The 
4230: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e  protocol version
4240: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 6f   used for the co
4250: 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c 20  nnection: SSL2, 
4260: 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53 31  SSL3, TLS1, TLS1
4270: 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53 31  .1, TLS1.2, TLS1
4280: 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 0a  .3, or unknown..
4290: 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 6e 65  .[def "[var rene
42a0: 67 6f 74 69 61 74 69 6f 6e 5f 61 6c 6c 6f 77 65  gotiation_allowe
42b0: 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  d] [arg boolean]
42c0: 22 5d 0a 57 68 65 74 68 65 72 20 70 72 6f 74 6f  "].Whether proto
42d0: 63 6f 6c 20 72 65 6e 65 67 6f 74 69 61 74 69 6f  col renegotiatio
42e0: 6e 20 69 73 20 73 75 70 70 6f 72 74 65 64 20 6f  n is supported o
42f0: 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b 76  r not...[def "[v
4300: 61 72 20 73 65 63 75 72 69 74 79 5f 6c 65 76 65  ar security_leve
4310: 6c 5d 20 5b 61 72 67 20 6c 65 76 65 6c 5d 22 5d  l] [arg level]"]
4320: 0a 54 68 65 20 73 65 63 75 72 69 74 79 20 6c 65  .The security le
4330: 76 65 6c 20 75 73 65 64 20 66 6f 72 20 73 65 6c  vel used for sel
4340: 65 63 74 69 6f 6e 20 6f 66 20 63 69 70 68 65 72  ection of cipher
4350: 73 2c 20 6b 65 79 20 73 69 7a 65 2c 20 65 74 63  s, key size, etc
4360: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
4370: 73 73 69 6f 6e 5f 72 65 75 73 65 64 5d 20 5b 61  ssion_reused] [a
4380: 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68  rg boolean]"].Wh
4390: 65 74 68 65 72 20 74 68 65 20 73 65 73 73 69 6f  ether the sessio
43a0: 6e 20 68 61 73 20 62 65 65 6e 20 72 65 75 73 65  n has been reuse
43b0: 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20  d or not...[def 
43c0: 22 5b 76 61 72 20 69 73 5f 73 65 72 76 65 72 5d  "[var is_server]
43d0: 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d   [arg boolean]"]
43e0: 0a 57 68 65 74 68 65 72 20 74 68 65 20 63 6f 6e  .Whether the con
43f0: 6e 65 63 74 69 6f 6e 20 69 73 20 63 6f 6e 66 69  nection is confi
4400: 67 75 72 65 64 20 61 73 20 61 20 73 65 72 76 65  gured as a serve
4410: 72 20 28 31 29 20 6f 72 20 63 6c 69 65 6e 74 20  r (1) or client 
4420: 28 30 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  (0)...[def "[var
4430: 20 63 6f 6d 70 72 65 73 73 69 6f 6e 5d 20 5b 61   compression] [a
4440: 72 67 20 6d 6f 64 65 5d 22 5d 0a 43 6f 6d 70 72  rg mode]"].Compr
4450: 65 73 73 69 6f 6e 20 6d 65 74 68 6f 64 2e 0a 0a  ession method...
4460: 5b 64 65 66 20 22 5b 76 61 72 20 65 78 70 61 6e  [def "[var expan
4470: 73 69 6f 6e 5d 20 5b 61 72 67 20 6d 6f 64 65 5d  sion] [arg mode]
4480: 22 5d 0a 45 78 70 61 6e 73 69 6f 6e 20 6d 65 74  "].Expansion met
4490: 68 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  hod...[def "[var
44a0: 20 63 61 4c 69 73 74 5d 20 5b 61 72 67 20 6c 69   caList] [arg li
44b0: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 43 65  st]"].List of Ce
44c0: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
44d0: 69 74 69 65 73 20 28 43 41 29 20 66 6f 72 20 58  ities (CA) for X
44e0: 2e 35 30 39 20 63 65 72 74 69 66 69 63 61 74 65  .509 certificate
44f0: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43  ...[list_end]..C
4500: 69 70 68 65 72 20 49 6e 66 6f 0a 0a 5b 6c 69 73  ipher Info..[lis
4510: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
4520: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ons]..[def "[var
4530: 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69   cipher] [arg ci
4540: 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72  pher]"].The curr
4550: 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75 73  ent cipher in us
4560: 65 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63  e for the connec
4570: 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  tion...[def "[va
4580: 72 20 73 74 61 6e 64 61 72 64 5f 6e 61 6d 65 5d  r standard_name]
4590: 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68   [arg name]"].Th
45a0: 65 20 73 74 61 6e 64 61 72 64 20 52 46 43 20 6e  e standard RFC n
45b0: 61 6d 65 20 6f 66 20 63 69 70 68 65 72 2e 0a 0a  ame of cipher...
45c0: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 67 6f 72  [def "[var algor
45d0: 69 74 68 6d 5f 62 69 74 73 5d 20 5b 61 72 67 20  ithm_bits] [arg 
45e0: 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20  n]"].The number 
45f0: 6f 66 20 70 72 6f 63 65 73 73 65 64 20 62 69 74  of processed bit
4600: 73 20 75 73 65 64 20 66 6f 72 20 63 69 70 68 65  s used for ciphe
4610: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  r...[def "[var s
4620: 65 63 72 65 74 5f 62 69 74 73 5d 20 5b 61 72 67  ecret_bits] [arg
4630: 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72   n]"].The number
4640: 20 6f 66 20 73 65 63 72 65 74 20 62 69 74 73 20   of secret bits 
4650: 75 73 65 64 20 66 6f 72 20 63 69 70 68 65 72 2e  used for cipher.
4660: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6d 69 6e  ..[def "[var min
4670: 5f 76 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20 76  _version] [arg v
4680: 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 6d 69  ersion]"].The mi
4690: 6e 69 6d 75 6d 20 70 72 6f 74 6f 63 6f 6c 20 76  nimum protocol v
46a0: 65 72 73 69 6f 6e 20 66 6f 72 20 63 69 70 68 65  ersion for ciphe
46b0: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  r...[def "[var c
46c0: 69 70 68 65 72 5f 69 73 5f 61 65 61 64 5d 20 5b  ipher_is_aead] [
46d0: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57  arg boolean]"].W
46e0: 68 65 74 68 65 72 20 74 68 65 20 63 69 70 68 65  hether the ciphe
46f0: 72 20 69 73 20 41 75 74 68 65 6e 74 69 63 61 74  r is Authenticat
4700: 65 64 20 45 6e 63 72 79 70 74 69 6f 6e 20 77 69  ed Encryption wi
4710: 74 68 20 41 73 73 6f 63 69 61 74 65 64 20 44 61  th Associated Da
4720: 74 61 20 28 41 45 41 44 29 2e 0a 0a 5b 64 65 66  ta (AEAD)...[def
4730: 20 22 5b 76 61 72 20 63 69 70 68 65 72 5f 69 64   "[var cipher_id
4740: 5d 20 5b 61 72 67 20 69 64 5d 22 5d 0a 54 68 65  ] [arg id]"].The
4750: 20 4f 70 65 6e 53 53 4c 20 63 69 70 68 65 72 20   OpenSSL cipher 
4760: 69 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  id...[def "[var 
4770: 64 65 73 63 72 69 70 74 69 6f 6e 5d 20 5b 61 72  description] [ar
4780: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 41 20 74 65  g string]"].A te
4790: 78 74 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f  xt description o
47a0: 66 20 74 68 65 20 63 69 70 68 65 72 2e 0a 0a 5b  f the cipher...[
47b0: 64 65 66 20 22 5b 76 61 72 20 68 61 6e 64 73 68  def "[var handsh
47c0: 61 6b 65 5f 64 69 67 65 73 74 5d 20 5b 61 72 67  ake_digest] [arg
47d0: 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 44 69 67 65   boolean]"].Dige
47e0: 73 74 20 75 73 65 64 20 64 75 72 69 6e 67 20 68  st used during h
47f0: 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b 6c 69 73 74  andshake...[list
4800: 5f 65 6e 64 5d 0a 0a 53 65 73 73 69 6f 6e 20 49  _end]..Session I
4810: 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  nfo..[list_begin
4820: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b   definitions]..[
4830: 64 65 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20  def "[var alpn] 
4840: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d  [arg protocol]"]
4850: 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65  .The protocol se
4860: 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70 70  lected after App
4870: 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50  lication-Layer P
4880: 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74  rotocol Negotiat
4890: 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a 0a 5b 64 65  ion (ALPN)...[de
48a0: 66 20 22 5b 76 61 72 20 72 65 73 75 6d 61 62 6c  f "[var resumabl
48b0: 65 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  e] [arg boolean]
48c0: 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 73  "].Whether the s
48d0: 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 72 65  ession can be re
48e0: 73 75 6d 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b  sumed or not...[
48f0: 64 65 66 20 22 5b 76 61 72 20 73 74 61 72 74 5f  def "[var start_
4900: 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63 6f 6e  time] [arg secon
4910: 64 73 5d 22 5d 0a 54 69 6d 65 20 73 69 6e 63 65  ds]"].Time since
4920: 20 73 65 73 73 69 6f 6e 20 73 74 61 72 74 65 64   session started
4930: 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e 63   in seconds sinc
4940: 65 20 65 70 6f 63 68 2e 0a 0a 5b 64 65 66 20 22  e epoch...[def "
4950: 5b 76 61 72 20 74 69 6d 65 6f 75 74 5d 20 5b 61  [var timeout] [a
4960: 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 4d 61  rg seconds]"].Ma
4970: 78 20 64 75 72 61 74 69 6f 6e 20 6f 66 20 73 65  x duration of se
4980: 73 73 69 6f 6e 20 69 6e 20 73 65 63 6f 6e 64 73  ssion in seconds
4990: 20 62 65 66 6f 72 65 20 74 69 6d 65 2d 6f 75 74   before time-out
49a0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6c 69  ...[def "[var li
49b0: 66 65 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63  fetime] [arg sec
49c0: 6f 6e 64 73 5d 22 5d 0a 53 65 73 73 69 6f 6e 20  onds]"].Session 
49d0: 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 20  ticket lifetime 
49e0: 68 69 6e 74 20 69 6e 20 73 65 63 6f 6e 64 73 2e  hint in seconds.
49f0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73  ..[def "[var ses
4a00: 73 69 6f 6e 5f 69 64 5d 20 5b 61 72 67 20 62 69  sion_id] [arg bi
4a10: 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55  nary_string]"].U
4a20: 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20 69 64  nique session id
4a30: 20 66 6f 72 20 75 73 65 20 69 6e 20 72 65 73 75   for use in resu
4a40: 6d 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e  ming the session
4a50: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
4a60: 73 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 20 5b 61  ssion_ticket] [a
4a70: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67  rg binary_string
4a80: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69  ]"].Unique sessi
4a90: 6f 6e 20 74 69 63 6b 65 74 20 66 6f 72 20 75 73  on ticket for us
4aa0: 65 20 69 6e 20 72 65 73 75 6d 69 6e 67 20 74 68  e in resuming th
4ab0: 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66  e session...[def
4ac0: 20 22 5b 76 61 72 20 74 69 63 6b 65 74 5f 61 70   "[var ticket_ap
4ad0: 70 5f 64 61 74 61 5d 20 5b 61 72 67 20 62 69 6e  p_data] [arg bin
4ae0: 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e  ary_string]"].Un
4af0: 69 71 75 65 20 73 65 73 73 69 6f 6e 20 74 69 63  ique session tic
4b00: 6b 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 20  ket application 
4b10: 64 61 74 61 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  data...[def "[va
4b20: 72 20 6d 61 73 74 65 72 5f 6b 65 79 5d 20 5b 61  r master_key] [a
4b30: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67  rg binary_string
4b40: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69  ]"].Unique sessi
4b50: 6f 6e 20 6d 61 73 74 65 72 20 6b 65 79 2e 0a 0a  on master key...
4b60: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 73 69  [def "[var sessi
4b70: 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64 65 5d 20 5b  on_cache_mode] [
4b80: 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 53 65 72 76  arg mode]"].Serv
4b90: 65 72 20 63 61 63 68 65 20 6d 6f 64 65 20 28 63  er cache mode (c
4ba0: 6c 69 65 6e 74 2c 20 73 65 72 76 65 72 2c 20 6f  lient, server, o
4bb0: 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c 69 73 74 5f  r both)...[list_
4bc0: 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  end]..[call [cmd
4bd0: 20 74 6c 73 3a 3a 63 69 70 68 65 72 73 5d 20 5b   tls::ciphers] [
4be0: 6f 70 74 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  opt [arg protoco
4bf0: 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 65  l]] [opt [arg ve
4c00: 72 62 6f 73 65 5d 5d 20 5b 6f 70 74 20 5b 61 72  rbose]] [opt [ar
4c10: 67 20 73 75 70 70 6f 72 74 65 64 5d 5d 5d 0a 0a  g supported]]]..
4c20: 57 69 74 68 6f 75 74 20 61 6e 79 20 6f 70 74 69  Without any opti
4c30: 6f 6e 73 2c 20 69 74 20 72 65 74 75 72 6e 73 20  ons, it returns 
4c40: 61 20 6c 69 73 74 20 6f 66 20 61 6c 6c 20 73 79  a list of all sy
4c50: 6d 6d 65 74 72 69 63 20 63 69 70 68 65 72 73 20  mmetric ciphers 
4c60: 66 6f 72 20 75 73 65 20 77 69 74 68 20 74 68 65  for use with the
4c70: 0a 5b 61 72 67 20 2d 63 69 70 68 65 72 5d 20 6f  .[arg -cipher] o
4c80: 70 74 69 6f 6e 2e 20 57 69 74 68 20 5b 61 72 67  ption. With [arg
4c90: 20 70 72 6f 74 6f 63 6f 6c 5d 2c 20 6f 6e 6c 79   protocol], only
4ca0: 20 74 68 65 20 63 69 70 68 65 72 73 20 73 75 70   the ciphers sup
4cb0: 70 6f 72 74 65 64 20 66 6f 72 20 74 68 61 74 0a  ported for that.
4cc0: 70 72 6f 74 6f 63 6f 6c 20 61 72 65 20 72 65 74  protocol are ret
4cd0: 75 72 6e 65 64 2e 20 53 65 65 20 74 68 65 20 5b  urned. See the [
4ce0: 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f  cmd tls::protoco
4cf0: 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f 72 20  ls] command for 
4d00: 74 68 65 20 73 75 70 70 6f 72 74 65 64 0a 70 72  the supported.pr
4d10: 6f 74 6f 63 6f 6c 73 2e 20 49 66 20 5b 61 72 67  otocols. If [arg
4d20: 20 76 65 72 62 6f 73 65 5d 20 69 73 20 73 70 65   verbose] is spe
4d30: 63 69 66 69 65 64 20 61 73 20 74 72 75 65 20 74  cified as true t
4d40: 68 65 6e 20 61 20 76 65 72 62 6f 73 65 2c 20 68  hen a verbose, h
4d50: 75 6d 61 6e 20 72 65 61 64 61 62 6c 65 0a 6c 69  uman readable.li
4d60: 73 74 20 69 73 20 72 65 74 75 72 6e 65 64 20 77  st is returned w
4d70: 69 74 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 69  ith additional i
4d80: 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68  nformation on th
4d90: 65 20 63 69 70 68 65 72 2e 20 49 66 20 5b 61 72  e cipher. If [ar
4da0: 67 20 73 75 70 70 6f 72 74 65 64 5d 0a 69 73 20  g supported].is 
4db0: 73 70 65 63 69 66 69 65 64 20 61 73 20 74 72 75  specified as tru
4dc0: 65 2c 20 74 68 65 6e 20 6f 6e 6c 79 20 74 68 65  e, then only the
4dd0: 20 63 69 70 68 65 72 73 20 73 75 70 70 6f 72 74   ciphers support
4de0: 65 64 20 66 6f 72 20 70 72 6f 74 6f 63 6f 6c 20  ed for protocol 
4df0: 77 69 6c 6c 20 62 65 20 6c 69 73 74 65 64 2e 0a  will be listed..
4e00: 54 68 65 20 5b 61 72 67 20 73 75 70 70 6f 72 74  The [arg support
4e10: 65 64 5d 20 61 72 67 20 69 73 20 6e 65 77 20 66  ed] arg is new f
4e20: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
4e30: 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a  [call [cmd tls::
4e40: 70 72 6f 74 6f 63 6f 6c 73 5d 5d 0a 0a 52 65 74  protocols]]..Ret
4e50: 75 72 6e 73 20 61 20 6c 69 73 74 20 6f 66 20 74  urns a list of t
4e60: 68 65 20 73 75 70 70 6f 72 74 65 64 20 53 53 4c  he supported SSL
4e70: 2f 54 4c 53 20 70 72 6f 74 6f 63 6f 6c 73 2e 20  /TLS protocols. 
4e80: 56 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65  Valid values are
4e90: 3a 0a 5b 63 6f 6e 73 74 20 73 73 6c 32 5d 2c 20  :.[const ssl2], 
4ea0: 5b 63 6f 6e 73 74 20 73 73 6c 33 5d 2c 20 5b 63  [const ssl3], [c
4eb0: 6f 6e 73 74 20 74 6c 73 31 5d 2c 20 5b 63 6f 6e  onst tls1], [con
4ec0: 73 74 20 74 6c 73 31 2e 31 5d 2c 20 5b 63 6f 6e  st tls1.1], [con
4ed0: 73 74 20 74 6c 73 31 2e 32 5d 2c 20 61 6e 64 0a  st tls1.2], and.
4ee0: 5b 63 6f 6e 73 74 20 74 6c 73 31 2e 33 5d 2e 20  [const tls1.3]. 
4ef0: 45 78 61 63 74 20 6c 69 73 74 20 64 65 70 65 6e  Exact list depen
4f00: 64 73 20 6f 6e 20 4f 70 65 6e 53 53 4c 20 76 65  ds on OpenSSL ve
4f10: 72 73 69 6f 6e 20 61 6e 64 20 63 6f 6d 70 69 6c  rsion and compil
4f20: 65 20 74 69 6d 65 20 66 6c 61 67 73 2e 0a 54 68  e time flags..Th
4f30: 69 73 20 63 6f 6d 6d 61 6e 64 20 69 73 20 6e 65  is command is ne
4f40: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
4f50: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ...[call [cmd tl
4f60: 73 3a 3a 76 65 72 73 69 6f 6e 5d 5d 0a 0a 52 65  s::version]]..Re
4f70: 74 75 72 6e 73 20 74 68 65 20 4f 70 65 6e 53 53  turns the OpenSS
4f80: 4c 20 76 65 72 73 69 6f 6e 20 73 74 72 69 6e 67  L version string
4f90: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 0a  ...[list_end]...
4fa0: 5b 73 65 63 74 69 6f 6e 20 22 43 65 72 74 69 66  [section "Certif
4fb0: 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e  icate Validation
4fc0: 22 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20  "]..[subsection 
4fd0: 22 50 4b 49 20 61 6e 64 20 43 65 72 74 69 66 69  "PKI and Certifi
4fe0: 63 61 74 65 73 22 5d 0a 0a 55 73 69 6e 67 20 74  cates"]..Using t
4ff0: 68 65 20 50 75 62 6c 69 63 20 4b 65 79 20 49 6e  he Public Key In
5000: 66 72 61 73 74 72 75 63 74 75 72 65 20 28 50 4b  frastructure (PK
5010: 49 29 2c 20 65 61 63 68 20 75 73 65 72 20 63 72  I), each user cr
5020: 65 61 74 65 73 20 61 20 70 72 69 76 61 74 65 20  eates a private 
5030: 6b 65 79 20 74 68 61 74 0a 6f 6e 6c 79 20 74 68  key that.only th
5040: 65 79 20 6b 6e 6f 77 20 61 62 6f 75 74 20 61 6e  ey know about an
5050: 64 20 61 20 70 75 62 6c 69 63 20 6b 65 79 20 74  d a public key t
5060: 68 65 79 20 63 61 6e 20 65 78 63 68 61 6e 67 65  hey can exchange
5070: 20 77 69 74 68 20 6f 74 68 65 72 73 20 66 6f 72   with others for
5080: 20 75 73 65 20 69 6e 0a 65 6e 63 72 79 70 74 69   use in.encrypti
5090: 6e 67 20 61 6e 64 20 64 65 63 72 79 70 74 69 6e  ng and decryptin
50a0: 67 20 64 61 74 61 2e 20 54 68 65 20 70 72 6f 63  g data. The proc
50b0: 65 73 73 20 69 73 20 74 68 65 20 73 65 6e 64 65  ess is the sende
50c0: 72 20 65 6e 63 72 79 70 74 73 20 74 68 65 69 72  r encrypts their
50d0: 20 64 61 74 61 0a 75 73 69 6e 67 20 74 68 65 69   data.using thei
50e0: 72 20 70 72 69 76 61 74 65 20 6b 65 79 20 61 6e  r private key an
50f0: 64 20 74 68 65 20 72 65 63 65 69 76 65 72 27 73  d the receiver's
5100: 20 70 75 62 6c 69 63 20 6b 65 79 2e 20 54 68 65   public key. The
5110: 20 64 61 74 61 20 69 73 20 74 68 65 6e 20 73 65   data is then se
5120: 6e 74 0a 74 6f 20 74 68 65 20 72 65 63 65 69 76  nt.to the receiv
5130: 65 72 2e 20 49 6e 20 61 20 73 69 6d 69 6c 61 72  er. In a similar
5140: 20 6d 61 6e 6e 65 72 2c 20 74 68 65 20 72 65 63   manner, the rec
5150: 65 69 76 65 72 20 75 73 65 73 20 74 68 65 69 72  eiver uses their
5160: 20 70 72 69 76 61 74 65 20 6b 65 79 20 61 6e 64   private key and
5170: 0a 74 68 65 20 73 65 6e 64 65 72 27 73 20 70 75  .the sender's pu
5180: 62 6c 69 63 20 6b 65 79 20 74 6f 20 64 65 63 72  blic key to decr
5190: 79 70 74 20 74 68 65 20 64 61 74 61 2e 20 54 68  ypt the data. Th
51a0: 69 73 20 70 72 6f 76 69 64 65 73 20 64 61 74 61  is provides data
51b0: 20 69 6e 74 65 67 72 69 74 79 2c 20 74 6f 0a 65   integrity, to.e
51c0: 6e 73 75 72 65 20 74 68 65 20 64 61 74 61 20 63  nsure the data c
51d0: 61 6e 27 74 20 62 65 20 76 69 65 77 65 64 20 6f  an't be viewed o
51e0: 72 20 61 6c 74 65 72 65 64 20 64 75 72 69 6e 67  r altered during
51f0: 20 74 72 61 6e 73 70 6f 72 74 2e 20 53 65 65 20   transport. See 
5200: 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6b 65 79  the.[option -key
5210: 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 6b  ] and [option -k
5220: 65 79 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20  eyfile] options 
5230: 66 6f 72 20 68 6f 77 20 74 6f 20 73 70 65 63 69  for how to speci
5240: 66 79 20 74 68 65 20 70 72 69 76 61 74 65 20 6b  fy the private k
5250: 65 79 2e 0a 41 6c 73 6f 20 73 65 65 20 74 68 65  ey..Also see the
5260: 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f   [option -passwo
5270: 72 64 5d 20 6f 70 74 69 6f 6e 20 66 6f 72 20 68  rd] option for h
5280: 6f 77 20 74 6f 20 70 72 6f 76 69 64 65 20 74 68  ow to provide th
5290: 65 20 70 61 73 73 77 6f 72 64 2e 0a 5b 70 61 72  e password..[par
52a0: 61 5d 0a 49 6e 20 6f 72 64 65 72 20 74 6f 20 70  a].In order to p
52b0: 72 6f 76 69 64 65 20 61 75 74 68 65 6e 74 69 63  rovide authentic
52c0: 61 74 69 6f 6e 2c 20 69 2e 65 2e 20 65 6e 73 75  ation, i.e. ensu
52d0: 72 69 6e 67 20 73 6f 6d 65 6f 6e 65 20 69 73 20  ring someone is 
52e0: 77 68 6f 20 74 68 65 79 20 73 61 79 20 74 68 65  who they say the
52f0: 79 0a 61 72 65 2c 20 74 68 65 20 70 75 62 6c 69  y.are, the publi
5300: 63 20 6b 65 79 20 61 6e 64 20 75 73 65 72 20 69  c key and user i
5310: 64 65 6e 74 69 66 69 63 61 74 69 6f 6e 20 69 6e  dentification in
5320: 66 6f 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20  fo is stored in 
5330: 61 20 58 2e 35 30 39 0a 63 65 72 74 69 66 69 63  a X.509.certific
5340: 61 74 65 20 61 6e 64 20 74 68 61 74 20 63 65 72  ate and that cer
5350: 74 69 66 69 63 61 74 65 20 69 73 20 61 75 74 68  tificate is auth
5360: 65 6e 74 69 63 61 74 65 64 20 28 69 2e 65 2e 20  enticated (i.e. 
5370: 73 69 67 6e 65 64 29 20 62 79 20 61 20 43 65 72  signed) by a Cer
5380: 74 69 66 69 63 61 74 65 0a 41 75 74 68 6f 72 69  tificate.Authori
5390: 74 79 20 28 43 41 29 2e 20 55 73 65 72 73 20 63  ty (CA). Users c
53a0: 61 6e 20 74 68 65 6e 20 65 78 63 68 61 6e 67 65  an then exchange
53b0: 20 74 68 65 73 65 20 63 65 72 74 69 66 69 63 61   these certifica
53c0: 74 65 73 20 64 75 72 69 6e 67 20 74 68 65 20 54  tes during the T
53d0: 4c 53 0a 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f  LS.initializatio
53e0: 6e 20 70 72 6f 63 65 73 73 20 61 6e 64 20 63 68  n process and ch
53f0: 65 63 6b 20 74 68 65 6d 20 61 67 61 69 6e 73 74  eck them against
5400: 20 74 68 65 20 72 6f 6f 74 20 43 41 20 63 65 72   the root CA cer
5410: 74 69 66 69 63 61 74 65 73 20 74 6f 20 65 6e 73  tificates to ens
5420: 75 72 65 0a 74 68 65 79 20 61 72 65 20 76 61 6c  ure.they are val
5430: 69 64 2e 20 54 68 69 73 20 69 73 20 68 61 6e 64  id. This is hand
5440: 6c 65 64 20 62 79 20 4f 70 65 6e 53 53 4c 20 76  led by OpenSSL v
5450: 69 61 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  ia the [option -
5460: 72 65 71 75 65 73 74 5d 20 61 6e 64 0a 5b 6f 70  request] and.[op
5470: 74 69 6f 6e 20 2d 72 65 71 75 69 72 65 5d 20 6f  tion -require] o
5480: 70 74 69 6f 6e 73 2e 20 53 65 65 20 74 68 65 20  ptions. See the 
5490: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c  [option -cadir],
54a0: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d   [option -cadir]
54b0: 2c 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 63  , and.[option -c
54c0: 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 73 20  astore] options 
54d0: 66 6f 72 20 68 6f 77 20 74 70 20 73 70 65 63 69  for how tp speci
54e0: 66 79 20 77 68 65 72 65 20 74 6f 20 66 69 6e 64  fy where to find
54f0: 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69 63   the CA certific
5500: 61 74 65 73 2e 0a 4f 70 74 69 6f 6e 61 6c 6c 79  ates..Optionally
5510: 2c 20 69 6e 20 61 20 66 75 74 75 72 65 20 72 65  , in a future re
5520: 6c 65 61 73 65 2c 20 74 68 65 79 20 63 61 6e 20  lease, they can 
5530: 61 6c 73 6f 20 62 65 20 63 68 65 63 6b 65 64 20  also be checked 
5540: 61 67 61 69 6e 73 74 20 74 68 65 20 43 65 72 74  against the Cert
5550: 69 66 69 63 61 74 65 0a 52 65 76 6f 63 61 74 69  ificate.Revocati
5560: 6f 6e 20 4c 69 73 74 20 28 43 52 4c 29 20 6f 66  on List (CRL) of
5570: 20 72 65 76 6f 6b 65 64 20 63 65 72 74 69 66 69   revoked certifi
5580: 63 61 74 65 73 2e 20 43 65 72 74 69 66 69 63 61  cates. Certifica
5590: 74 65 73 20 63 61 6e 20 61 6c 73 6f 20 62 65 0a  tes can also be.
55a0: 73 65 6c 66 2d 73 69 67 6e 65 64 2c 20 62 75 74  self-signed, but
55b0: 20 74 68 65 79 20 61 72 65 20 62 79 20 64 65 66   they are by def
55c0: 61 75 6c 74 20 6e 6f 74 20 74 72 75 73 74 65 64  ault not trusted
55d0: 20 75 6e 6c 65 73 73 20 79 6f 75 20 61 64 64 20   unless you add 
55e0: 74 68 65 6d 20 74 6f 20 79 6f 75 72 0a 63 65 72  them to your.cer
55f0: 74 69 66 69 63 61 74 65 20 73 74 6f 72 65 2e 0a  tificate store..
5600: 5b 70 61 72 61 5d 0a 54 79 70 69 63 61 6c 6c 79  [para].Typically
5610: 20 77 68 65 6e 20 76 69 73 69 74 69 6e 67 20 77   when visiting w
5620: 65 62 20 73 69 74 65 73 2c 20 6f 6e 6c 79 20 74  eb sites, only t
5630: 68 65 20 63 6c 69 65 6e 74 20 6e 65 65 64 73 20  he client needs 
5640: 74 6f 20 63 68 65 63 6b 20 74 68 65 20 73 65 72  to check the ser
5650: 76 65 72 27 73 0a 63 65 72 74 69 66 69 63 61 74  ver's.certificat
5660: 65 20 74 6f 20 65 6e 73 75 72 65 20 69 74 20 69  e to ensure it i
5670: 73 20 76 61 6c 69 64 2e 20 54 68 65 20 73 65 72  s valid. The ser
5680: 76 65 72 20 64 6f 65 73 6e 27 74 20 6e 65 65 64  ver doesn't need
5690: 20 74 6f 20 63 68 65 63 6b 20 74 68 65 20 63 6c   to check the cl
56a0: 69 65 6e 74 0a 63 65 72 74 69 66 69 63 61 74 65  ient.certificate
56b0: 20 75 6e 6c 65 73 73 20 79 6f 75 20 6e 65 65 64   unless you need
56c0: 20 74 6f 20 61 75 74 68 65 6e 74 69 63 61 74 65   to authenticate
56d0: 20 77 69 74 68 20 74 68 65 6d 20 74 6f 20 6c 6f   with them to lo
56e0: 67 69 6e 2c 20 65 74 63 2e 20 53 65 65 20 74 68  gin, etc. See th
56f0: 65 0a 5b 6f 70 74 69 6f 6e 20 2d 63 65 72 74 5d  e.[option -cert]
5700: 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 65   and [option -ce
5710: 72 74 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 73 20  rtfile] options 
5720: 69 66 20 79 6f 75 20 6e 65 65 64 20 74 6f 20 70  if you need to p
5730: 72 6f 76 69 64 65 20 61 20 63 65 72 74 69 66 69  rovide a certifi
5740: 63 61 74 65 2e 0a 0a 0a 5b 73 75 62 73 65 63 74  cate....[subsect
5750: 69 6f 6e 20 22 53 75 6d 6d 61 72 79 20 6f 66 20  ion "Summary of 
5760: 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 6f 70 74  command line opt
5770: 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 66 6f 6c 6c  ions"]..The foll
5780: 6f 77 69 6e 67 20 6f 70 74 69 6f 6e 73 20 61 72  owing options ar
5790: 65 20 75 73 65 64 20 66 6f 72 20 70 65 65 72 20  e used for peer 
57a0: 63 65 72 74 69 66 69 63 61 74 65 20 76 61 6c 69  certificate vali
57b0: 64 61 74 69 6f 6e 3a 0a 0a 5b 6c 69 73 74 5f 62  dation:..[list_b
57c0: 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b  egin options]..[
57d0: 6f 70 74 5f 64 65 66 20 2d 63 61 64 69 72 20 5b  opt_def -cadir [
57e0: 61 72 67 20 64 69 72 65 63 74 6f 72 79 5d 5d 0a  arg directory]].
57f0: 53 70 65 63 69 66 69 65 73 20 74 68 65 20 64 69  Specifies the di
5800: 72 65 63 74 6f 72 79 20 77 68 65 72 65 20 74 68  rectory where th
5810: 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41 75  e Certificate Au
5820: 74 68 6f 72 69 74 79 20 28 43 41 29 20 63 65 72  thority (CA) cer
5830: 74 69 66 69 63 61 74 65 73 20 61 72 65 0a 73 74  tificates are.st
5840: 6f 72 65 64 2e 20 54 68 65 20 64 65 66 61 75 6c  ored. The defaul
5850: 74 20 69 73 20 70 6c 61 74 66 6f 72 6d 20 73 70  t is platform sp
5860: 65 63 69 66 69 63 2c 20 62 75 74 20 69 73 20 75  ecific, but is u
5870: 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20 2f 65 74  sually [file /et
5880: 63 2f 73 73 6c 2f 63 65 72 74 73 5d 20 6f 6e 0a  c/ssl/certs] on.
5890: 4c 69 6e 75 78 2f 55 6e 69 78 20 73 79 73 74 65  Linux/Unix syste
58a0: 6d 73 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  ms. The default 
58b0: 6c 6f 63 61 74 69 6f 6e 20 63 61 6e 20 62 65 20  location can be 
58c0: 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74 68  overridden by th
58d0: 65 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  e.[var SSL_CERT_
58e0: 44 49 52 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74  DIR] environment
58f0: 20 76 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74   variable...[opt
5900: 5f 64 65 66 20 2d 63 61 66 69 6c 65 20 5b 61 72  _def -cafile [ar
5910: 67 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65  g filename]].Spe
5920: 63 69 66 69 65 73 20 74 68 65 20 66 69 6c 65 20  cifies the file 
5930: 77 69 74 68 20 74 68 65 20 43 65 72 74 69 66 69  with the Certifi
5940: 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28  cate Authority (
5950: 43 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73  CA) certificates
5960: 20 74 6f 20 75 73 65 20 69 6e 0a 5b 63 6f 6e 73   to use in.[cons
5970: 74 20 50 45 4d 5d 20 66 69 6c 65 20 66 6f 72 6d  t PEM] file form
5980: 61 74 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20  at. The default 
5990: 69 73 20 5b 66 69 6c 65 20 63 65 72 74 2e 70 65  is [file cert.pe
59a0: 6d 5d 2c 20 69 6e 20 74 68 65 20 4f 70 65 6e 53  m], in the OpenS
59b0: 53 4c 0a 64 69 72 65 63 74 6f 72 79 2e 20 4f 6e  SL.directory. On
59c0: 20 4c 69 6e 75 78 2f 55 6e 69 78 20 73 79 73 74   Linux/Unix syst
59d0: 65 6d 73 2c 20 74 68 69 73 20 69 73 20 75 73 75  ems, this is usu
59e0: 61 6c 6c 79 20 5b 66 69 6c 65 20 2f 65 74 63 2f  ally [file /etc/
59f0: 73 73 6c 2f 63 61 2d 62 75 6e 64 6c 65 2e 70 65  ssl/ca-bundle.pe
5a00: 6d 5d 2e 0a 54 68 65 20 64 65 66 61 75 6c 74 20  m]..The default 
5a10: 66 69 6c 65 20 63 61 6e 20 62 65 20 6f 76 65 72  file can be over
5a20: 72 69 64 64 65 6e 20 62 79 20 74 68 65 20 5b 76  ridden by the [v
5a30: 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45  ar SSL_CERT_FILE
5a40: 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 0a 76 61  ] environment.va
5a50: 72 69 61 62 6c 65 2e 0a 0a 5b 6f 70 74 5f 64 65  riable...[opt_de
5a60: 66 20 2d 63 61 73 74 6f 72 65 20 5b 61 72 67 20  f -castore [arg 
5a70: 55 52 49 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  URI]].Specifies 
5a80: 74 68 65 20 55 6e 69 66 6f 72 6d 20 52 65 73 6f  the Uniform Reso
5a90: 75 72 63 65 20 49 64 65 6e 74 69 66 69 65 72 20  urce Identifier 
5aa0: 28 55 52 49 29 20 66 6f 72 20 74 68 65 20 43 65  (URI) for the Ce
5ab0: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
5ac0: 69 74 79 0a 28 43 41 29 20 73 74 6f 72 65 2c 20  ity.(CA) store, 
5ad0: 77 68 69 63 68 20 6d 61 79 20 62 65 20 61 20 73  which may be a s
5ae0: 69 6e 67 6c 65 20 63 6f 6e 74 61 69 6e 65 72 20  ingle container 
5af0: 6f 72 20 61 20 63 61 74 61 6c 6f 67 20 6f 66 20  or a catalog of 
5b00: 63 6f 6e 74 61 69 6e 65 72 73 2e 0a 53 74 61 72  containers..Star
5b10: 74 69 6e 67 20 77 69 74 68 20 4f 70 65 6e 53 53  ting with OpenSS
5b20: 4c 20 33 2e 32 20 6f 6e 20 4d 53 20 57 69 6e 64  L 3.2 on MS Wind
5b30: 6f 77 73 2c 20 73 65 74 20 74 6f 20 22 5b 63 6f  ows, set to "[co
5b40: 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e 73 73 6c  nst "org.openssl
5b50: 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d 22 0a  .winstore://"]".
5b60: 74 6f 20 75 73 65 20 74 68 65 20 62 75 69 6c 74  to use the built
5b70: 2d 69 6e 20 4d 53 20 57 69 6e 64 6f 77 73 20 43  -in MS Windows C
5b80: 65 72 74 69 66 69 63 61 74 65 20 53 74 6f 72 65  ertificate Store
5b90: 2e 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63  . Starting in Tc
5ba0: 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69 73 0a 69  lTLS 2.0, this.i
5bb0: 73 20 74 68 65 20 64 65 66 61 75 6c 74 20 69 66  s the default if
5bc0: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d   [option -cadir]
5bd0: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72  , [option -cadir
5be0: 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d  ], and [option -
5bf0: 63 61 73 74 6f 72 65 5d 20 61 72 65 0a 6e 6f 74  castore] are.not
5c00: 20 73 70 65 63 69 66 69 65 64 2e 20 54 68 69 73   specified. This
5c10: 20 73 74 6f 72 65 20 6f 6e 6c 79 20 73 75 70 70   store only supp
5c20: 6f 72 74 73 20 72 6f 6f 74 20 63 65 72 74 69 66  orts root certif
5c30: 69 63 61 74 65 20 73 74 6f 72 65 73 2e 20 53 65  icate stores. Se
5c40: 65 0a 5b 73 65 63 74 72 65 66 20 22 43 65 72 74  e.[sectref "Cert
5c50: 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69  ificate Validati
5c60: 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65  on"] for more de
5c70: 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66  tails...[opt_def
5c80: 20 2d 72 65 71 75 65 73 74 20 5b 61 72 67 20 62   -request [arg b
5c90: 6f 6f 6c 5d 5d 0a 52 65 71 75 65 73 74 20 61 20  ool]].Request a 
5ca0: 63 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d  certificate from
5cb0: 20 74 68 65 20 70 65 65 72 20 64 75 72 69 6e 67   the peer during
5cc0: 20 74 68 65 20 53 53 4c 20 68 61 6e 64 73 68 61   the SSL handsha
5cd0: 6b 65 2e 20 54 68 69 73 20 69 73 20 6e 65 65 64  ke. This is need
5ce0: 65 64 0a 74 6f 20 64 6f 20 43 65 72 74 69 66 69  ed.to do Certifi
5cf0: 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e 2e  cate Validation.
5d00: 20 53 74 61 72 74 69 6e 67 20 69 6e 20 54 63 6c   Starting in Tcl
5d10: 54 4c 53 20 31 2e 38 2c 20 74 68 65 20 64 65 66  TLS 1.8, the def
5d20: 61 75 6c 74 20 69 73 0a 5b 63 6f 6e 73 74 20 74  ault is.[const t
5d30: 72 75 65 5d 2e 20 53 74 61 72 74 69 6e 67 20 69  rue]. Starting i
5d40: 6e 20 54 63 6c 54 4c 53 20 32 2e 30 2c 20 49 66  n TclTLS 2.0, If
5d50: 20 73 65 74 20 74 6f 20 5b 63 6f 6e 73 74 20 66   set to [const f
5d60: 61 6c 73 65 5d 20 61 6e 64 0a 5b 6f 70 74 69 6f  alse] and.[optio
5d70: 6e 20 2d 72 65 71 75 69 72 65 5d 20 69 73 20 5b  n -require] is [
5d80: 63 6f 6e 73 74 20 74 72 75 65 5d 2c 20 74 68 65  const true], the
5d90: 6e 20 74 68 69 73 20 77 69 6c 6c 20 62 65 20 6f  n this will be o
5da0: 76 65 72 72 69 64 64 65 6e 20 74 6f 20 5b 63 6f  verridden to [co
5db0: 6e 73 74 20 74 72 75 65 5d 2e 0a 49 6e 20 61 64  nst true]..In ad
5dc0: 64 69 74 69 6f 6e 2c 20 74 68 65 20 63 6c 69 65  dition, the clie
5dd0: 6e 74 20 63 61 6e 20 6d 61 6e 75 61 6c 6c 79 20  nt can manually 
5de0: 69 6e 73 70 65 63 74 20 61 6e 64 20 61 63 63 65  inspect and acce
5df0: 70 74 20 6f 72 20 72 65 6a 65 63 74 0a 65 61 63  pt or reject.eac
5e00: 68 20 63 65 72 74 69 66 69 63 61 74 65 20 75 73  h certificate us
5e10: 69 6e 67 20 74 68 65 20 5b 61 72 67 20 2d 76 61  ing the [arg -va
5e20: 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f  lidatecommand] o
5e30: 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66  ption...[opt_def
5e40: 20 2d 72 65 71 75 69 72 65 20 5b 61 72 67 20 62   -require [arg b
5e50: 6f 6f 6c 5d 5d 0a 52 65 71 75 69 72 65 20 61 20  ool]].Require a 
5e60: 76 61 6c 69 64 20 63 65 72 74 69 66 69 63 61 74  valid certificat
5e70: 65 20 66 72 6f 6d 20 74 68 65 20 70 65 65 72 20  e from the peer 
5e80: 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c 20 68  during the SSL h
5e90: 61 6e 64 73 68 61 6b 65 2e 20 49 66 20 74 68 69  andshake. If thi
5ea0: 73 20 69 73 0a 73 65 74 20 74 6f 20 74 72 75 65  s is.set to true
5eb0: 2c 20 74 68 65 6e 20 5b 6f 70 74 69 6f 6e 20 2d  , then [option -
5ec0: 72 65 71 75 65 73 74 5d 20 6d 75 73 74 20 61 6c  request] must al
5ed0: 73 6f 20 62 65 20 73 65 74 20 74 6f 20 74 72 75  so be set to tru
5ee0: 65 20 61 6e 64 20 61 20 65 69 74 68 65 72 0a 5b  e and a either.[
5ef0: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20  option -cadir], 
5f00: 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d  [option -cafile]
5f10: 2c 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  , [option -casto
5f20: 72 65 5d 2c 20 6f 72 20 61 20 70 6c 61 74 66 6f  re], or a platfo
5f30: 72 6d 20 64 65 66 61 75 6c 74 0a 6d 75 73 74 20  rm default.must 
5f40: 62 65 20 70 72 6f 76 69 64 65 64 20 69 6e 20 6f  be provided in o
5f50: 72 64 65 72 20 74 6f 20 76 61 6c 69 64 61 74 65  rder to validate
5f60: 20 61 67 61 69 6e 73 74 2e 20 54 68 65 20 64 65   against. The de
5f70: 66 61 75 6c 74 20 69 6e 20 54 63 6c 54 4c 53 20  fault in TclTLS 
5f80: 31 2e 38 20 61 6e 64 0a 65 61 72 6c 69 65 72 20  1.8 and.earlier 
5f90: 76 65 72 73 69 6f 6e 73 20 69 73 20 5b 63 6f 6e  versions is [con
5fa0: 73 74 20 66 61 6c 73 65 5d 20 73 69 6e 63 65 20  st false] since 
5fb0: 6e 6f 74 20 61 6c 6c 20 70 6c 61 74 66 6f 72 6d  not all platform
5fc0: 73 20 68 61 76 65 20 63 65 72 74 69 66 69 63 61  s have certifica
5fd0: 74 65 73 20 74 6f 0a 76 61 6c 69 64 61 74 65 20  tes to.validate 
5fe0: 61 67 61 69 6e 73 74 20 69 6e 20 61 20 66 6f 72  against in a for
5ff0: 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74  m compatible wit
6000: 68 20 4f 70 65 6e 53 53 4c 2e 20 53 74 61 72 74  h OpenSSL. Start
6010: 69 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e  ing in TclTLS 2.
6020: 30 2c 0a 74 68 65 20 64 65 66 61 75 6c 74 20 69  0,.the default i
6030: 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 0a  s [const true]..
6040: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75  .[list_end]..[su
6050: 62 73 65 63 74 69 6f 6e 20 22 57 68 65 6e 20 61  bsection "When a
6060: 72 65 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20  re command line 
6070: 6f 70 74 69 6f 6e 73 20 6e 65 65 64 65 64 3f 22  options needed?"
6080: 5d 0a 0a 49 6e 20 54 63 6c 54 4c 53 20 31 2e 38  ]..In TclTLS 1.8
6090: 20 61 6e 64 20 65 61 72 6c 69 65 72 20 76 65 72   and earlier ver
60a0: 73 69 6f 6e 73 2c 20 63 65 72 74 69 66 69 63 61  sions, certifica
60b0: 74 65 20 76 61 6c 69 64 61 74 69 6f 6e 20 69 73  te validation is
60c0: 0a 5b 65 6d 70 68 20 4e 4f 54 5d 20 65 6e 61 62  .[emph NOT] enab
60d0: 6c 65 64 20 62 79 20 64 65 66 61 75 6c 74 2e 20  led by default. 
60e0: 54 68 69 73 20 6c 69 6d 69 74 61 74 69 6f 6e 20  This limitation 
60f0: 69 73 20 64 75 65 20 74 6f 20 74 68 65 20 6c 61  is due to the la
6100: 63 6b 20 6f 66 20 61 20 63 6f 6d 6d 6f 6e 0a 63  ck of a common.c
6110: 72 6f 73 73 20 70 6c 61 74 66 6f 72 6d 20 64 61  ross platform da
6120: 74 61 62 61 73 65 20 6f 66 20 43 65 72 74 69 66  tabase of Certif
6130: 69 63 61 74 65 20 41 75 74 68 6f 72 69 74 79 20  icate Authority 
6140: 28 43 41 29 20 70 72 6f 76 69 64 65 64 20 63 65  (CA) provided ce
6150: 72 74 69 66 69 63 61 74 65 73 20 74 6f 0a 76 61  rtificates to.va
6160: 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20  lidate against. 
6170: 4d 61 6e 79 20 4c 69 6e 75 78 20 73 79 73 74 65  Many Linux syste
6180: 6d 73 20 6e 61 74 69 76 65 6c 79 20 73 75 70 70  ms natively supp
6190: 6f 72 74 20 4f 70 65 6e 53 53 4c 20 61 6e 64 20  ort OpenSSL and 
61a0: 74 68 75 73 20 68 61 76 65 0a 74 68 65 73 65 20  thus have.these 
61b0: 63 65 72 74 69 66 69 63 61 74 65 73 20 69 6e 73  certificates ins
61c0: 74 61 6c 6c 65 64 20 61 73 20 70 61 72 74 20 6f  talled as part o
61d0: 66 20 74 68 65 20 4f 53 2c 20 62 75 74 20 4d 61  f the OS, but Ma
61e0: 63 4f 53 20 61 6e 64 20 4d 53 20 57 69 6e 64 6f  cOS and MS Windo
61f0: 77 73 20 64 6f 20 6e 6f 74 2e 0a 53 74 61 72 69  ws do not..Stari
6200: 6e 67 20 69 6e 20 54 63 6c 54 4c 53 20 32 2e 30  ng in TclTLS 2.0
6210: 2c 20 74 68 69 73 20 68 61 73 20 62 65 65 6e 20  , this has been 
6220: 63 68 61 6e 67 65 64 20 74 6f 20 72 65 71 75 69  changed to requi
6230: 72 65 20 63 65 72 74 69 66 69 63 61 74 65 20 76  re certificate v
6240: 61 6c 69 64 61 74 69 6f 6e 0a 62 79 20 64 65 66  alidation.by def
6250: 61 75 6c 74 2e 20 49 6e 20 6f 72 64 65 72 20 74  ault. In order t
6260: 6f 20 75 73 65 20 74 68 65 20 5b 6f 70 74 69 6f  o use the [optio
6270: 6e 20 2d 72 65 71 75 69 72 65 5d 20 6f 70 74 69  n -require] opti
6280: 6f 6e 2c 20 6f 6e 65 20 6f 66 20 74 68 65 20 66  on, one of the f
6290: 6f 6c 6c 6f 77 69 6e 67 0a 6d 75 73 74 20 62 65  ollowing.must be
62a0: 20 74 72 75 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65   true:..[list_be
62b0: 67 69 6e 20 69 74 65 6d 69 7a 65 64 5d 0a 0a 5b  gin itemized]..[
62c0: 69 74 65 6d 5d 0a 4f 6e 20 4c 69 6e 75 78 20 61  item].On Linux a
62d0: 6e 64 20 55 6e 69 78 20 73 79 73 74 65 6d 73 20  nd Unix systems 
62e0: 77 69 74 68 20 4f 70 65 6e 53 53 4c 20 61 6c 72  with OpenSSL alr
62f0: 65 61 64 79 20 69 6e 73 74 61 6c 6c 65 64 20 6f  eady installed o
6300: 72 20 69 66 20 74 68 65 20 43 41 0a 63 65 72 74  r if the CA.cert
6310: 69 66 69 63 61 74 65 73 20 61 72 65 20 61 76 61  ificates are ava
6320: 69 6c 61 62 6c 65 20 69 6e 20 50 45 4d 20 66 6f  ilable in PEM fo
6330: 72 6d 61 74 2c 20 61 6e 64 20 69 66 20 74 68 65  rmat, and if the
6340: 79 20 61 72 65 20 73 74 6f 72 65 64 20 69 6e 20  y are stored in 
6350: 74 68 65 0a 73 74 61 6e 64 61 72 64 20 6c 6f 63  the.standard loc
6360: 61 74 69 6f 6e 73 2c 20 6f 72 20 69 66 20 74 68  ations, or if th
6370: 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f  e [var SSL_CERT_
6380: 44 49 52 5d 20 6f 72 20 5b 76 61 72 20 53 53 4c  DIR] or [var SSL
6390: 5f 43 45 52 54 5f 46 49 4c 45 5d 0a 65 6e 76 69  _CERT_FILE].envi
63a0: 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65  ronment variable
63b0: 73 20 61 72 65 20 73 65 74 2c 20 74 68 65 6e 20  s are set, then 
63c0: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c  [option -cadir],
63d0: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d   [option -cadir]
63e0: 2c 0a 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 63  ,.and [option -c
63f0: 61 73 74 6f 72 65 5d 20 61 72 65 6e 27 74 20 6e  astore] aren't n
6400: 65 65 64 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 49  eeded...[item].I
6410: 66 20 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f 74  f OpenSSL is not
6420: 20 69 6e 73 74 61 6c 6c 65 64 20 69 6e 20 74 68   installed in th
6430: 65 20 64 65 66 61 75 6c 74 20 6c 6f 63 61 74 69  e default locati
6440: 6f 6e 2c 20 6f 72 20 77 68 65 6e 20 75 73 69 6e  on, or when usin
6450: 67 20 4d 61 63 20 4f 53 0a 6f 72 20 4d 53 20 57  g Mac OS.or MS W
6460: 69 6e 64 6f 77 73 20 61 6e 64 20 4f 70 65 6e 53  indows and OpenS
6470: 53 4c 20 69 73 20 69 6e 73 74 61 6c 6c 65 64 2c  SL is installed,
6480: 20 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45   the [var SSL_CE
6490: 52 54 5f 44 49 52 5d 20 61 6e 64 2f 6f 72 0a 5b  RT_DIR] and/or.[
64a0: 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c  var SSL_CERT_FIL
64b0: 45 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76  E] environment v
64c0: 61 72 69 61 62 6c 65 73 20 6f 72 20 74 68 65 20  ariables or the 
64d0: 6f 6e 65 20 6f 66 20 74 68 65 20 5b 6f 70 74 69  one of the [opti
64e0: 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f 70 74  on -cadir],.[opt
64f0: 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 6f 72 20  ion -cadir], or 
6500: 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65  [option -castore
6510: 5d 20 6f 70 74 69 6f 6e 73 20 6d 75 73 74 20 62  ] options must b
6520: 65 20 64 65 66 69 6e 65 64 2e 0a 0a 5b 69 74 65  e defined...[ite
6530: 6d 5d 0a 4f 6e 20 4d 53 20 57 69 6e 64 6f 77 73  m].On MS Windows
6540: 2c 20 73 74 61 72 74 69 6e 67 20 69 6e 20 4f 70  , starting in Op
6550: 65 6e 53 53 4c 20 33 2e 32 2c 20 69 74 20 69 73  enSSL 3.2, it is
6560: 20 6e 6f 77 20 70 6f 73 73 69 62 6c 65 20 74 6f   now possible to
6570: 20 61 63 63 65 73 73 20 74 68 65 0a 62 75 69 6c   access the.buil
6580: 74 2d 69 6e 20 57 69 6e 64 6f 77 73 20 43 65 72  t-in Windows Cer
6590: 74 69 66 69 63 61 74 65 20 53 74 6f 72 65 20 66  tificate Store f
65a0: 72 6f 6d 20 4f 70 65 6e 53 53 4c 2e 20 54 68 69  rom OpenSSL. Thi
65b0: 73 20 63 61 6e 20 75 74 69 6c 69 7a 65 64 20 62  s can utilized b
65c0: 79 0a 73 65 74 74 69 6e 67 20 74 68 65 20 5b 6f  y.setting the [o
65d0: 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d 20  ption -castore] 
65e0: 6f 70 74 69 6f 6e 20 74 6f 20 22 5b 63 6f 6e 73  option to "[cons
65f0: 74 20 6f 72 67 2e 6f 70 65 6e 73 73 6c 2e 77 69  t org.openssl.wi
6600: 6e 73 74 6f 72 65 3a 2f 2f 5d 22 2e 0a 49 6e 20  nstore://]"..In 
6610: 54 63 6c 54 4c 53 20 32 2e 30 2c 20 74 68 69 73  TclTLS 2.0, this
6620: 20 69 73 20 74 68 65 20 64 65 66 61 75 6c 74 20   is the default 
6630: 76 61 6c 75 65 20 69 66 20 5b 6f 70 74 69 6f 6e  value if [option
6640: 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f   -cadir],.[optio
6650: 6e 20 2d 63 61 64 69 72 5d 2c 20 61 6e 64 20 5b  n -cadir], and [
6660: 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72 65 5d  option -castore]
6670: 20 61 72 65 20 6e 6f 74 20 73 70 65 63 69 66 69   are not specifi
6680: 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f  ed...[item].If O
6690: 70 65 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e  penSSL is not in
66a0: 73 74 61 6c 6c 65 64 20 6f 72 20 74 68 65 20 43  stalled or the C
66b0: 41 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61  A certificates a
66c0: 72 65 20 6e 6f 74 20 61 76 61 69 6c 61 62 6c 65  re not available
66d0: 20 69 6e 20 50 45 4d 0a 66 6f 72 6d 61 74 2c 20   in PEM.format, 
66e0: 74 68 65 20 43 41 20 63 65 72 74 69 66 69 63 61  the CA certifica
66f0: 74 65 73 20 6d 75 73 74 20 62 65 20 64 6f 77 6e  tes must be down
6700: 6c 6f 61 64 65 64 20 61 6e 64 20 69 6e 73 74 61  loaded and insta
6710: 6c 6c 65 64 20 77 69 74 68 20 74 68 65 20 75 73  lled with the us
6720: 65 72 0a 73 6f 66 74 77 61 72 65 2e 20 54 68 65  er.software. The
6730: 20 43 55 52 4c 20 74 65 61 6d 20 6d 61 6b 65 73   CURL team makes
6740: 20 74 68 65 6d 20 61 76 61 69 6c 61 62 6c 65 20   them available 
6750: 61 74 0a 5b 75 72 69 20 22 68 74 74 70 73 3a 2f  at.[uri "https:/
6760: 2f 63 75 72 6c 2e 73 65 2f 64 6f 63 73 2f 63 61  /curl.se/docs/ca
6770: 65 78 74 72 61 63 74 2e 68 74 6d 6c 22 20 22 43  extract.html" "C
6780: 41 20 63 65 72 74 69 66 69 63 61 74 65 73 20 65  A certificates e
6790: 78 74 72 61 63 74 65 64 0a 66 72 6f 6d 20 4d 6f  xtracted.from Mo
67a0: 7a 69 6c 6c 61 22 5d 20 69 6e 20 74 68 65 20 5b  zilla"] in the [
67b0: 66 69 6c 65 20 63 61 63 65 72 74 2e 70 65 6d 5d  file cacert.pem]
67c0: 20 66 69 6c 65 2e 20 59 6f 75 20 6d 75 73 74 20   file. You must 
67d0: 74 68 65 6e 20 65 69 74 68 65 72 20 73 65 74 20  then either set 
67e0: 74 68 65 0a 5b 76 61 72 20 53 53 4c 5f 43 45 52  the.[var SSL_CER
67f0: 54 5f 44 49 52 5d 20 61 6e 64 2f 6f 72 20 5b 76  T_DIR] and/or [v
6800: 61 72 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45  ar SSL_CERT_FILE
6810: 5d 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61  ] environment va
6820: 72 69 61 62 6c 65 73 20 6f 72 20 74 68 65 0a 5b  riables or the.[
6830: 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 20 6f  option -cadir] o
6840: 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c  r [option -cafil
6850: 65 5d 20 6f 70 74 69 6f 6e 73 20 74 6f 20 74 68  e] options to th
6860: 65 20 43 41 20 63 65 72 74 20 66 69 6c 65 27 73  e CA cert file's
6870: 20 69 6e 73 74 61 6c 6c 0a 6c 6f 63 61 74 69 6f   install.locatio
6880: 6e 2e 20 49 74 20 69 73 20 79 6f 75 72 20 72 65  n. It is your re
6890: 73 70 6f 6e 73 69 62 69 6c 69 74 79 20 74 6f 20  sponsibility to 
68a0: 6b 65 65 70 20 74 68 69 73 20 66 69 6c 65 20 75  keep this file u
68b0: 70 20 74 6f 20 64 61 74 65 2e 0a 0a 5b 6c 69 73  p to date...[lis
68c0: 74 5f 65 6e 64 5d 0a 0a 5b 73 65 63 74 69 6f 6e  t_end]..[section
68d0: 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74 69 6f   "Callback Optio
68e0: 6e 73 22 5d 0a 0a 41 73 20 70 72 65 76 69 6f 75  ns"]..As previou
68f0: 73 6c 79 20 64 65 73 63 72 69 62 65 64 2c 20 65  sly described, e
6900: 61 63 68 20 63 68 61 6e 6e 65 6c 20 63 61 6e 20  ach channel can 
6910: 62 65 20 67 69 76 65 6e 20 74 68 65 69 72 20 6f  be given their o
6920: 77 6e 20 63 61 6c 6c 62 61 63 6b 73 0a 74 6f 20  wn callbacks.to 
6930: 68 61 6e 64 6c 65 20 69 6e 74 65 72 6d 65 64 69  handle intermedi
6940: 61 74 65 20 70 72 6f 63 65 73 73 69 6e 67 20 62  ate processing b
6950: 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69  y the OpenSSL li
6960: 62 72 61 72 79 2c 20 75 73 69 6e 67 20 74 68 65  brary, using the
6970: 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e  .[option -comman
6980: 64 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73  d], [option -pas
6990: 73 77 6f 72 64 5d 2c 20 61 6e 64 20 5b 6f 70 74  sword], and [opt
69a0: 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f  ion -validate_co
69b0: 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 73 0a 70  mmand] options.p
69c0: 61 73 73 65 64 20 74 6f 20 65 69 74 68 65 72 20  assed to either 
69d0: 6f 66 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63  of [cmd tls::soc
69e0: 6b 65 74 5d 20 6f 72 20 5b 63 6d 64 20 74 6c 73  ket] or [cmd tls
69f0: 3a 3a 69 6d 70 6f 72 74 5d 2e 0a 55 6e 6c 69 6b  ::import]..Unlik
6a00: 65 20 70 72 65 76 69 6f 75 73 20 76 65 72 73 69  e previous versi
6a10: 6f 6e 73 20 6f 66 20 54 63 6c 54 4c 53 2c 20 6f  ons of TclTLS, o
6a20: 6e 6c 79 20 69 66 20 74 68 65 20 63 61 6c 6c 62  nly if the callb
6a30: 61 63 6b 20 67 65 6e 65 72 61 74 65 73 20 61 6e  ack generates an
6a40: 20 65 72 72 6f 72 2c 0a 77 69 6c 6c 20 74 68 65   error,.will the
6a50: 20 5b 73 79 73 63 6d 64 20 62 67 65 72 72 6f 72   [syscmd bgerror
6a60: 5d 20 63 6f 6d 6d 61 6e 64 20 62 65 20 69 6e 76  ] command be inv
6a70: 6f 6b 65 64 20 77 69 74 68 20 74 68 65 20 65 72  oked with the er
6a80: 72 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e  ror information.
6a90: 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56  ..[subsection "V
6aa0: 61 6c 75 65 73 20 66 6f 72 20 43 6f 6d 6d 61 6e  alues for Comman
6ab0: 64 20 43 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68  d Callback"]..Th
6ac0: 65 20 63 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74  e callback for t
6ad0: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d  he [option -comm
6ae0: 61 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69  and] option is i
6af0: 6e 76 6f 6b 65 64 20 61 74 20 73 65 76 65 72 61  nvoked at severa
6b00: 6c 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67 20  l points during 
6b10: 74 68 65 0a 4f 70 65 6e 53 53 4c 20 68 61 6e 64  the.OpenSSL hand
6b20: 73 68 61 6b 65 20 61 6e 64 20 64 75 72 69 6e 67  shake and during
6b30: 20 72 6f 75 74 69 6e 65 20 6f 70 65 72 61 74 69   routine operati
6b40: 6f 6e 73 2e 20 53 65 65 20 62 65 6c 6f 77 20 66  ons. See below f
6b50: 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c 65 0a  or the possible.
6b60: 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73 65 64  arguments passed
6b70: 20 74 6f 20 74 68 65 20 63 61 6c 6c 62 61 63 6b   to the callback
6b80: 20 73 63 72 69 70 74 2e 20 56 61 6c 75 65 73 20   script. Values 
6b90: 72 65 74 75 72 6e 65 64 20 66 72 6f 6d 20 74 68  returned from th
6ba0: 65 20 63 61 6c 6c 62 61 63 6b 20 61 72 65 0a 69  e callback are.i
6bb0: 67 6e 6f 72 65 64 2e 0a 0a 5b 6c 69 73 74 5f 62  gnored...[list_b
6bc0: 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b  egin options]..[
6bd0: 6f 70 74 5f 64 65 66 20 65 72 72 6f 72 20 5b 61  opt_def error [a
6be0: 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 6d 65  rg "channelId me
6bf0: 73 73 61 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f  ssage"]].This fo
6c00: 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69  rm of callback i
6c10: 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 65 76  s invoked whenev
6c20: 65 72 20 61 6e 20 65 72 72 6f 72 20 6f 63 63 75  er an error occu
6c30: 72 73 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e  rs during the in
6c40: 69 74 69 61 6c 0a 63 6f 6e 6e 65 63 74 69 6f 6e  itial.connection
6c50: 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20 6f 72 20  , handshake, or 
6c60: 49 2f 4f 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20  I/O operations. 
6c70: 54 68 65 20 5b 61 72 67 20 6d 65 73 73 61 67 65  The [arg message
6c80: 5d 20 61 72 67 75 6d 65 6e 74 20 63 61 6e 20 62  ] argument can b
6c90: 65 0a 66 72 6f 6d 20 74 68 65 20 54 63 6c 5f 45  e.from the Tcl_E
6ca0: 72 72 6e 6f 4d 73 67 2c 20 4f 70 65 6e 53 53 4c  rrnoMsg, OpenSSL
6cb0: 20 66 75 6e 63 74 69 6f 6e 20 5b 66 75 6e 20 45   function [fun E
6cc0: 52 52 5f 72 65 61 73 6f 6e 5f 65 72 72 6f 72 5f  RR_reason_error_
6cd0: 73 74 72 69 6e 67 28 29 5d 2c 0a 6f 72 20 61 20  string()],.or a 
6ce0: 63 75 73 74 6f 6d 20 6d 65 73 73 61 67 65 2e 20  custom message. 
6cf0: 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73  This callback is
6d00: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
6d10: 31 2e 38 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 69  1.8...[opt_def i
6d20: 6e 66 6f 20 5b 61 72 67 20 22 63 68 61 6e 6e 65  nfo [arg "channe
6d30: 6c 49 64 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20  lId major minor 
6d40: 6d 65 73 73 61 67 65 20 74 79 70 65 22 5d 5d 0a  message type"]].
6d50: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
6d60: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
6d70: 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20   by the OpenSSL 
6d80: 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53  function.[fun SS
6d90: 4c 5f 73 65 74 5f 69 6e 66 6f 5f 63 61 6c 6c 62  L_set_info_callb
6da0: 61 63 6b 28 29 5d 20 64 75 72 69 6e 67 20 74 68  ack()] during th
6db0: 65 20 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63  e initial connec
6dc0: 74 69 6f 6e 20 61 6e 64 20 68 61 6e 64 73 68 61  tion and handsha
6dd0: 6b 65 0a 6f 70 65 72 61 74 69 6f 6e 73 2e 20 54  ke.operations. T
6de0: 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65  he arguments are
6df0: 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64  :..[list_begin d
6e00: 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65  efinitions]..[de
6e10: 66 20 5b 61 72 67 20 6d 61 6a 6f 72 5d 5d 0a 4d  f [arg major]].M
6e20: 61 6a 6f 72 20 63 61 74 65 67 6f 72 79 20 66 6f  ajor category fo
6e30: 72 20 65 72 72 6f 72 2e 20 56 61 6c 69 64 20 65  r error. Valid e
6e40: 6e 75 6d 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74  nums are: [const
6e50: 20 68 61 6e 64 73 68 61 6b 65 5d 2c 20 5b 63 6f   handshake], [co
6e60: 6e 73 74 20 61 6c 65 72 74 5d 2c 0a 5b 63 6f 6e  nst alert],.[con
6e70: 73 74 20 63 6f 6e 6e 65 63 74 5d 2c 20 5b 63 6f  st connect], [co
6e80: 6e 73 74 20 61 63 63 65 70 74 5d 2e 0a 0a 5b 64  nst accept]...[d
6e90: 65 66 20 5b 61 72 67 20 6d 69 6e 6f 72 5d 5d 0a  ef [arg minor]].
6ea0: 4d 69 6e 6f 72 20 63 61 74 65 67 6f 72 79 20 66  Minor category f
6eb0: 6f 72 20 65 72 72 6f 72 2e 20 56 61 6c 69 64 20  or error. Valid 
6ec0: 65 6e 75 6d 73 20 61 72 65 3a 20 5b 63 6f 6e 73  enums are: [cons
6ed0: 74 20 73 74 61 72 74 5d 2c 20 5b 63 6f 6e 73 74  t start], [const
6ee0: 20 64 6f 6e 65 5d 2c 20 5b 63 6f 6e 73 74 20 72   done], [const r
6ef0: 65 61 64 5d 2c 0a 5b 63 6f 6e 73 74 20 77 72 69  ead],.[const wri
6f00: 74 65 5d 2c 20 5b 63 6f 6e 73 74 20 6c 6f 6f 70  te], [const loop
6f10: 5d 2c 20 5b 63 6f 6e 73 74 20 65 78 69 74 5d 2e  ], [const exit].
6f20: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 65 73 73  ..[def [arg mess
6f30: 61 67 65 5d 5d 0a 44 65 73 63 72 69 70 74 69 76  age]].Descriptiv
6f40: 65 20 6d 65 73 73 61 67 65 20 73 74 72 69 6e 67  e message string
6f50: 20 77 68 69 63 68 20 6d 61 79 20 62 65 20 67 65   which may be ge
6f60: 6e 65 72 61 74 65 64 20 65 69 74 68 65 72 20 62  nerated either b
6f70: 79 0a 5b 66 75 6e 20 53 53 4c 5f 73 74 61 74 65  y.[fun SSL_state
6f80: 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d 20  _string_long()] 
6f90: 6f 72 20 5b 66 75 6e 20 53 53 4c 5f 61 6c 65 72  or [fun SSL_aler
6fa0: 74 5f 64 65 73 63 5f 73 74 72 69 6e 67 5f 6c 6f  t_desc_string_lo
6fb0: 6e 67 28 29 5d 2c 0a 64 65 70 65 6e 64 69 6e 67  ng()],.depending
6fc0: 20 6f 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 2e   on the context.
6fd0: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 74 79 70 65  ..[def [arg type
6fe0: 5d 5d 0a 46 6f 72 20 61 6c 65 72 74 73 2c 20 74  ]].For alerts, t
6ff0: 68 65 20 70 6f 73 73 69 62 6c 65 20 76 61 6c 75  he possible valu
7000: 65 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 77  es are: [const w
7010: 61 72 6e 69 6e 67 5d 2c 0a 5b 63 6f 6e 73 74 20  arning],.[const 
7020: 66 61 74 61 6c 5d 2c 20 61 6e 64 20 5b 63 6f 6e  fatal], and [con
7030: 73 74 20 75 6e 6b 6e 6f 77 6e 5d 2e 20 46 6f 72  st unknown]. For
7040: 20 6f 74 68 65 72 73 2c 20 5b 63 6f 6e 73 74 20   others, [const 
7050: 69 6e 66 6f 5d 20 69 73 20 75 73 65 64 2e 0a 54  info] is used..T
7060: 68 69 73 20 61 72 67 75 6d 65 6e 74 20 69 73 20  his argument is 
7070: 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31  new for TclTLS 1
7080: 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  .8...[list_end].
7090: 0a 5b 6f 70 74 5f 64 65 66 20 6d 65 73 73 61 67  .[opt_def messag
70a0: 65 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49  e [arg "channelI
70b0: 64 20 64 69 72 65 63 74 69 6f 6e 20 76 65 72 73  d direction vers
70c0: 69 6f 6e 20 63 6f 6e 74 65 6e 74 5f 74 79 70 65  ion content_type
70d0: 20 6d 65 73 73 61 67 65 22 5d 5d 0a 54 68 69 73   message"]].This
70e0: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63   form of callbac
70f0: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20  k is invoked by 
7100: 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63  the OpenSSL func
7110: 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73 65  tion.[fun SSL_se
7120: 74 5f 6d 73 67 5f 63 61 6c 6c 62 61 63 6b 28 29  t_msg_callback()
7130: 5d 20 77 68 65 6e 65 76 65 72 20 61 20 6d 65 73  ] whenever a mes
7140: 73 61 67 65 20 69 73 20 73 65 6e 74 20 6f 72 20  sage is sent or 
7150: 72 65 63 65 69 76 65 64 20 64 75 72 69 6e 67 20  received during 
7160: 74 68 65 0a 69 6e 69 74 69 61 6c 20 63 6f 6e 6e  the.initial conn
7170: 65 63 74 69 6f 6e 2c 20 68 61 6e 64 73 68 61 6b  ection, handshak
7180: 65 2c 20 6f 72 20 49 2f 4f 20 6f 70 65 72 61 74  e, or I/O operat
7190: 69 6f 6e 73 2e 20 49 74 20 69 73 20 6f 6e 6c 79  ions. It is only
71a0: 20 61 76 61 69 6c 61 62 6c 65 20 77 68 65 6e 0a   available when.
71b0: 4f 70 65 6e 53 53 4c 20 69 73 20 63 6f 6d 70 6c  OpenSSL is compl
71c0: 69 65 64 20 77 69 74 68 20 74 68 65 20 5b 63 6f  ied with the [co
71d0: 6e 73 74 20 65 6e 61 62 6c 65 2d 73 73 6c 2d 74  nst enable-ssl-t
71e0: 72 61 63 65 5d 20 6f 70 74 69 6f 6e 2e 20 54 68  race] option. Th
71f0: 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 0a 6e  is callback is.n
7200: 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e  ew for TclTLS 1.
7210: 38 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73  8. The arguments
7220: 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67   are:..[list_beg
7230: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
7240: 0a 5b 64 65 66 20 5b 61 72 67 20 64 69 72 65 63  .[def [arg direc
7250: 74 69 6f 6e 5d 5d 0a 44 69 72 65 63 74 69 6f 6e  tion]].Direction
7260: 20 69 73 20 65 69 74 68 65 72 20 5b 63 6f 6e 73   is either [cons
7270: 74 20 53 65 6e 74 5d 20 6f 72 20 5b 63 6f 6e 73  t Sent] or [cons
7280: 74 20 52 65 63 65 69 76 65 64 5d 2e 0a 0a 5b 64  t Received]...[d
7290: 65 66 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d  ef [arg version]
72a0: 5d 0a 56 65 72 73 69 6f 6e 20 69 73 20 74 68 65  ].Version is the
72b0: 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f   protocol versio
72c0: 6e 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63 6f  n...[def [arg co
72d0: 6e 74 65 6e 74 5f 74 79 70 65 5d 5d 0a 43 6f 6e  ntent_type]].Con
72e0: 74 65 6e 74 20 74 79 70 65 20 69 73 20 74 68 65  tent type is the
72f0: 20 6d 65 73 73 61 67 65 20 63 6f 6e 74 65 6e 74   message content
7300: 20 74 79 70 65 2e 0a 0a 5b 64 65 66 20 5b 61 72   type...[def [ar
7310: 67 20 6d 65 73 73 61 67 65 5d 5d 0a 4d 65 73 73  g message]].Mess
7320: 61 67 65 20 69 73 20 6d 6f 72 65 20 69 6e 66 6f  age is more info
7330: 20 66 72 6f 6d 20 74 68 65 20 5b 63 6f 6e 73 74   from the [const
7340: 20 53 53 4c 5f 74 72 61 63 65 5d 20 41 50 49 2e   SSL_trace] API.
7350: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f  ..[list_end]..[o
7360: 70 74 5f 64 65 66 20 73 65 73 73 69 6f 6e 20 5b  pt_def session [
7370: 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 73  arg "channelId s
7380: 65 73 73 69 6f 6e 5f 69 64 20 73 65 73 73 69 6f  ession_id sessio
7390: 6e 5f 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d  n_ticket lifetim
73a0: 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f  e"]].This form o
73b0: 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e  f callback is in
73c0: 76 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65  voked by the Ope
73d0: 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66  nSSL function.[f
73e0: 75 6e 20 53 53 4c 5f 43 54 58 5f 73 65 73 73 5f  un SSL_CTX_sess_
73f0: 73 65 74 5f 6e 65 77 5f 63 62 28 29 5d 20 77 68  set_new_cb()] wh
7400: 65 6e 65 76 65 72 20 61 20 6e 65 77 20 73 65 73  enever a new ses
7410: 73 69 6f 6e 20 69 64 20 69 73 20 73 65 6e 74 20  sion id is sent 
7420: 62 79 20 74 68 65 0a 73 65 72 76 65 72 20 64 75  by the.server du
7430: 72 69 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c  ring the initial
7440: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61 6e 64 20   connection and 
7450: 68 61 6e 64 73 68 61 6b 65 20 61 6e 64 20 61 6c  handshake and al
7460: 73 6f 20 64 75 72 69 6e 67 20 74 68 65 20 73 65  so during the se
7470: 73 73 69 6f 6e 0a 69 66 20 74 68 65 20 5b 6f 70  ssion.if the [op
7480: 74 69 6f 6e 20 2d 70 6f 73 74 5f 68 61 6e 64 73  tion -post_hands
7490: 68 61 6b 65 5d 20 6f 70 74 69 6f 6e 20 69 73 20  hake] option is 
74a0: 73 65 74 20 74 6f 20 74 72 75 65 2e 20 54 68 69  set to true. Thi
74b0: 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65  s callback is ne
74c0: 77 20 66 6f 72 0a 54 63 6c 54 4c 53 20 31 2e 38  w for.TclTLS 1.8
74d0: 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20  . The arguments 
74e0: 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  are:..[list_begi
74f0: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a  n definitions]..
7500: 5b 64 65 66 20 5b 61 72 67 20 73 65 73 73 69 6f  [def [arg sessio
7510: 6e 5f 69 64 5d 5d 0a 53 65 73 73 69 6f 6e 20 49  n_id]].Session I
7520: 64 20 69 73 20 74 68 65 20 63 75 72 72 65 6e 74  d is the current
7530: 20 73 65 73 73 69 6f 6e 20 69 64 65 6e 74 69 66   session identif
7540: 69 65 72 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73  ier..[def [arg s
7550: 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 5d 0a  ession_ticket]].
7560: 54 69 63 6b 65 74 20 69 73 20 74 68 65 20 73 65  Ticket is the se
7570: 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 69 6e 66  ssion ticket inf
7580: 6f 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6c 69 66  o..[def [arg lif
7590: 65 74 69 6d 65 5d 5d 0a 4c 69 66 65 74 69 6d 65  etime]].Lifetime
75a0: 20 69 73 20 74 68 65 20 74 69 63 6b 65 74 20 6c   is the ticket l
75b0: 69 66 65 74 69 6d 65 20 69 6e 20 73 65 63 6f 6e  ifetime in secon
75c0: 64 73 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a  ds...[list_end].
75d0: 0a 5b 6f 70 74 5f 64 65 66 20 76 65 72 69 66 79  .[opt_def verify
75e0: 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64   [arg "channelId
75f0: 20 64 65 70 74 68 20 63 65 72 74 20 73 74 61 74   depth cert stat
7600: 75 73 20 65 72 72 6f 72 22 5d 5d 0a 54 68 69 73  us error"]].This
7610: 20 63 61 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f   callback was mo
7620: 76 65 64 20 74 6f 20 5b 6f 70 74 69 6f 6e 20 2d  ved to [option -
7630: 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d  validatecommand]
7640: 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a   in TclTLS 1.8..
7650: 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75  .[list_end]..[su
7660: 62 73 65 63 74 69 6f 6e 20 22 56 61 6c 75 65 73  bsection "Values
7670: 20 66 6f 72 20 50 61 73 73 77 6f 72 64 20 43 61   for Password Ca
7680: 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61  llback"]..The ca
7690: 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b  llback for the [
76a0: 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64  option -password
76b0: 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f  ] option is invo
76c0: 6b 65 64 20 62 79 20 54 63 6c 54 4c 53 20 77 68  ked by TclTLS wh
76d0: 65 6e 65 76 65 72 20 4f 70 65 6e 53 53 4c 20 6e  enever OpenSSL n
76e0: 65 65 64 73 0a 74 6f 20 6f 62 74 61 69 6e 20 61  eeds.to obtain a
76f0: 20 70 61 73 73 77 6f 72 64 2e 20 53 65 65 20 62   password. See b
7700: 65 6c 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73  elow for the pos
7710: 73 69 62 6c 65 20 61 72 67 75 6d 65 6e 74 73 20  sible arguments 
7720: 70 61 73 73 65 64 20 74 6f 20 74 68 65 0a 63 61  passed to the.ca
7730: 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 2e 20 54  llback script. T
7740: 68 65 20 75 73 65 72 20 70 72 6f 76 69 64 65 64  he user provided
7750: 20 70 61 73 73 77 6f 72 64 20 69 73 20 65 78 70   password is exp
7760: 65 63 74 65 64 20 74 6f 20 62 65 20 72 65 74 75  ected to be retu
7770: 72 6e 65 64 20 62 79 20 74 68 65 0a 63 61 6c 6c  rned by the.call
7780: 62 61 63 6b 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67  back...[list_beg
7790: 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70  in options]..[op
77a0: 74 5f 64 65 66 20 70 61 73 73 77 6f 72 64 20 5b  t_def password [
77b0: 61 72 67 20 22 72 77 66 6c 61 67 20 73 69 7a 65  arg "rwflag size
77c0: 22 5d 5d 0a 49 6e 76 6f 6b 65 64 20 77 68 65 6e  "]].Invoked when
77d0: 20 6c 6f 61 64 69 6e 67 20 6f 72 20 73 74 6f 72   loading or stor
77e0: 69 6e 67 20 61 6e 20 65 6e 63 72 79 70 74 65 64  ing an encrypted
77f0: 20 50 45 4d 20 63 65 72 74 69 66 69 63 61 74 65   PEM certificate
7800: 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20  . The arguments 
7810: 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  are:..[list_begi
7820: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a  n definitions]..
7830: 5b 64 65 66 20 5b 61 72 67 20 72 77 66 6c 61 67  [def [arg rwflag
7840: 5d 5d 0a 54 68 65 20 72 65 61 64 2f 77 72 69 74  ]].The read/writ
7850: 65 20 66 6c 61 67 20 69 73 20 30 20 66 6f 72 20  e flag is 0 for 
7860: 72 65 61 64 69 6e 67 2f 64 65 63 72 79 70 74 69  reading/decrypti
7870: 6f 6e 20 6f 72 20 31 20 66 6f 72 20 77 72 69 74  on or 1 for writ
7880: 69 6e 67 2f 65 6e 63 72 79 70 74 69 6f 6e 2e 0a  ing/encryption..
7890: 54 68 65 20 6c 61 74 74 65 72 20 63 61 6e 20 62  The latter can b
78a0: 65 20 75 73 65 64 20 74 6f 20 64 65 74 65 72 6d  e used to determ
78b0: 69 6e 65 20 77 68 65 6e 20 74 6f 20 70 72 6f 6d  ine when to prom
78c0: 70 74 20 74 68 65 20 75 73 65 72 20 74 6f 20 63  pt the user to c
78d0: 6f 6e 66 69 72 6d 2e 0a 54 68 69 73 20 61 72 67  onfirm..This arg
78e0: 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 66 6f 72  ument is new for
78f0: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64   TclTLS 1.8...[d
7900: 65 66 20 5b 61 72 67 20 73 69 7a 65 5d 5d 0a 54  ef [arg size]].T
7910: 68 65 20 73 69 7a 65 20 69 73 20 74 68 65 20 6d  he size is the m
7920: 61 78 69 6d 75 6d 20 6c 65 6e 67 74 68 20 6f 66  aximum length of
7930: 20 74 68 65 20 70 61 73 73 77 6f 72 64 20 69 6e   the password in
7940: 20 62 79 74 65 73 2e 0a 54 68 69 73 20 61 72 67   bytes..This arg
7950: 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 66 6f 72  ument is new for
7960: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c   TclTLS 1.8...[l
7970: 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f  ist_end]..[list_
7980: 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f  end]..[subsectio
7990: 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 20 56 61  n "Values for Va
79a0: 6c 69 64 61 74 65 20 43 6f 6d 6d 61 6e 64 20 43  lidate Command C
79b0: 61 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63  allback"]..The c
79c0: 61 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20  allback for the 
79d0: 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74  [option -validat
79e0: 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e  ecommand] option
79f0: 20 69 73 20 69 6e 76 6f 6b 65 64 20 64 75 72 69   is invoked duri
7a00: 6e 67 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65  ng the handshake
7a10: 0a 70 72 6f 63 65 73 73 20 69 6e 20 6f 72 64 65  .process in orde
7a20: 72 20 66 6f 72 20 74 68 65 20 61 70 70 6c 69 63  r for the applic
7a30: 61 74 69 6f 6e 20 74 6f 20 76 61 6c 69 64 61 74  ation to validat
7a40: 65 20 74 68 65 20 70 72 6f 76 69 64 65 64 20 76  e the provided v
7a50: 61 6c 75 65 28 73 29 2e 20 53 65 65 0a 62 65 6c  alue(s). See.bel
7a60: 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69  ow for the possi
7a70: 62 6c 65 20 61 72 67 75 6d 65 6e 74 73 20 70 61  ble arguments pa
7a80: 73 73 65 64 20 74 6f 20 74 68 65 20 63 61 6c 6c  ssed to the call
7a90: 62 61 63 6b 20 73 63 72 69 70 74 2e 20 49 66 20  back script. If 
7aa0: 6e 6f 74 0a 73 70 65 63 69 66 69 65 64 2c 20 4f  not.specified, O
7ab0: 70 65 6e 53 53 4c 20 77 69 6c 6c 20 61 63 63 65  penSSL will acce
7ac0: 70 74 20 61 6c 6c 20 76 61 6c 69 64 20 63 65 72  pt all valid cer
7ad0: 74 69 66 69 63 61 74 65 73 20 61 6e 64 20 65 78  tificates and ex
7ae0: 74 65 6e 73 69 6f 6e 73 2e 20 54 6f 20 72 65 6a  tensions. To rej
7af0: 65 63 74 0a 74 68 65 20 76 61 6c 75 65 20 61 6e  ect.the value an
7b00: 64 20 61 62 6f 72 74 20 74 68 65 20 63 6f 6e 6e  d abort the conn
7b10: 65 63 74 69 6f 6e 2c 20 74 68 65 20 63 61 6c 6c  ection, the call
7b20: 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65 74 75  back should retu
7b30: 72 6e 20 30 2e 20 54 6f 20 61 63 63 65 70 74 20  rn 0. To accept 
7b40: 74 68 65 0a 76 61 6c 75 65 20 61 6e 64 20 63 6f  the.value and co
7b50: 6e 74 69 6e 75 65 20 74 68 65 20 63 6f 6e 6e 65  ntinue the conne
7b60: 63 74 69 6f 6e 2c 20 69 74 20 73 68 6f 75 6c 64  ction, it should
7b70: 20 72 65 74 75 72 6e 20 31 2e 20 54 6f 20 72 65   return 1. To re
7b80: 6a 65 63 74 20 74 68 65 20 76 61 6c 75 65 2c 20  ject the value, 
7b90: 62 75 74 0a 63 6f 6e 74 69 6e 75 65 20 74 68 65  but.continue the
7ba0: 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 74 20   connection, it 
7bb0: 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 32 2e  should return 2.
7bc0: 20 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69   This callback i
7bd0: 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53  s new for TclTLS
7be0: 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67   1.8...[list_beg
7bf0: 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70  in options]..[op
7c00: 74 5f 64 65 66 20 61 6c 70 6e 20 5b 61 72 67 20  t_def alpn [arg 
7c10: 22 63 68 61 6e 6e 65 6c 49 64 20 70 72 6f 74 6f  "channelId proto
7c20: 63 6f 6c 20 6d 61 74 63 68 22 5d 5d 0a 46 6f 72  col match"]].For
7c30: 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 20 66   servers, this f
7c40: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20  orm of callback 
7c50: 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20  is invoked when 
7c60: 74 68 65 20 63 6c 69 65 6e 74 20 41 4c 50 4e 20  the client ALPN 
7c70: 65 78 74 65 6e 73 69 6f 6e 20 69 73 0a 72 65 63  extension is.rec
7c80: 65 69 76 65 64 2e 20 49 66 20 5b 61 72 67 20 6d  eived. If [arg m
7c90: 61 74 63 68 5d 20 69 73 20 74 72 75 65 2c 20 74  atch] is true, t
7ca0: 68 65 6e 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  hen [arg protoco
7cb0: 6c 5d 20 69 73 20 74 68 65 20 66 69 72 73 74 0a  l] is the first.
7cc0: 5b 6f 70 74 69 6f 6e 20 2d 61 6c 70 6e 5d 20 70  [option -alpn] p
7cd0: 72 6f 74 6f 63 6f 6c 20 6f 70 74 69 6f 6e 20 69  rotocol option i
7ce0: 6e 20 63 6f 6d 6d 6f 6e 20 74 6f 20 62 6f 74 68  n common to both
7cf0: 20 74 68 65 20 63 6c 69 65 6e 74 20 61 6e 64 20   the client and 
7d00: 73 65 72 76 65 72 2e 0a 49 66 20 6e 6f 74 2c 20  server..If not, 
7d10: 74 68 65 20 66 69 72 73 74 20 63 6c 69 65 6e 74  the first client
7d20: 20 73 70 65 63 69 66 69 65 64 20 70 72 6f 74 6f   specified proto
7d30: 63 6f 6c 20 69 73 20 75 73 65 64 2e 20 54 68 69  col is used. Thi
7d40: 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 63 61  s callback is ca
7d50: 6c 6c 65 64 0a 61 66 74 65 72 20 74 68 65 20 48  lled.after the H
7d60: 65 6c 6c 6f 20 61 6e 64 20 41 4c 50 4e 20 63 61  ello and ALPN ca
7d70: 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64  llbacks...[opt_d
7d80: 65 66 20 68 65 6c 6c 6f 20 5b 61 72 67 20 22 63  ef hello [arg "c
7d90: 68 61 6e 6e 65 6c 49 64 20 73 65 72 76 65 72 6e  hannelId servern
7da0: 61 6d 65 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65  ame"]].For serve
7db0: 72 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f 66  rs, this form of
7dc0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
7dd0: 6f 6b 65 64 20 64 75 72 69 6e 67 20 63 6c 69 65  oked during clie
7de0: 6e 74 20 68 65 6c 6c 6f 20 6d 65 73 73 61 67 65  nt hello message
7df0: 0a 70 72 6f 63 65 73 73 69 6e 67 2e 20 54 68 65  .processing. The
7e00: 20 70 75 72 70 6f 73 65 20 69 73 20 73 6f 20 74   purpose is so t
7e10: 68 65 20 73 65 72 76 65 72 20 63 61 6e 20 73 65  he server can se
7e20: 6c 65 63 74 20 74 68 65 20 61 70 70 72 6f 70 72  lect the appropr
7e30: 69 61 74 65 20 63 65 72 74 69 66 69 63 61 74 65  iate certificate
7e40: 0a 74 6f 20 70 72 65 73 65 6e 74 20 74 6f 20 74  .to present to t
7e50: 68 65 20 63 6c 69 65 6e 74 2c 20 61 6e 64 20 74  he client, and t
7e60: 6f 20 6d 61 6b 65 20 6f 74 68 65 72 20 63 6f 6e  o make other con
7e70: 66 69 67 75 72 61 74 69 6f 6e 20 61 64 6a 75 73  figuration adjus
7e80: 74 6d 65 6e 74 73 20 72 65 6c 65 76 61 6e 74 0a  tments relevant.
7e90: 74 6f 20 74 68 61 74 20 73 65 72 76 65 72 20 6e  to that server n
7ea0: 61 6d 65 20 61 6e 64 20 69 74 73 20 63 6f 6e 66  ame and its conf
7eb0: 69 67 75 72 61 74 69 6f 6e 2e 20 49 74 20 69 73  iguration. It is
7ec0: 20 63 61 6c 6c 65 64 20 62 65 66 6f 72 65 20 74   called before t
7ed0: 68 65 20 53 4e 49 20 61 6e 64 20 41 4c 50 4e 0a  he SNI and ALPN.
7ee0: 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f 70 74  callbacks...[opt
7ef0: 5f 64 65 66 20 73 6e 69 20 5b 61 72 67 20 22 63  _def sni [arg "c
7f00: 68 61 6e 6e 65 6c 49 64 20 73 65 72 76 65 72 6e  hannelId servern
7f10: 61 6d 65 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65  ame"]].For serve
7f20: 72 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f 66  rs, this form of
7f30: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
7f40: 6f 6b 65 64 20 77 68 65 6e 20 74 68 65 20 53 65  oked when the Se
7f50: 72 76 65 72 20 4e 61 6d 65 20 49 6e 64 69 63 61  rver Name Indica
7f60: 74 69 6f 6e 0a 28 53 4e 49 29 20 65 78 74 65 6e  tion.(SNI) exten
7f70: 73 69 6f 6e 20 69 73 20 72 65 63 65 69 76 65 64  sion is received
7f80: 2e 20 54 68 65 20 5b 61 72 67 20 73 65 72 76 65  . The [arg serve
7f90: 72 6e 61 6d 65 5d 20 61 72 67 75 6d 65 6e 74 20  rname] argument 
7fa0: 69 73 20 74 68 65 20 63 6c 69 65 6e 74 0a 70 72  is the client.pr
7fb0: 6f 76 69 64 65 64 20 73 65 72 76 65 72 20 6e 61  ovided server na
7fc0: 6d 65 20 73 70 65 63 69 66 69 65 64 20 69 6e 20  me specified in 
7fd0: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72  the [option -ser
7fe0: 76 65 72 6e 61 6d 65 3c 2f 62 3e 5d 20 6f 70 74  vername</b>] opt
7ff0: 69 6f 6e 2e 20 54 68 65 0a 70 75 72 70 6f 73 65  ion. The.purpose
8000: 20 69 73 20 73 6f 20 77 68 65 6e 20 61 20 73 65   is so when a se
8010: 72 76 65 72 20 73 75 70 70 6f 72 74 73 20 6d 75  rver supports mu
8020: 6c 74 69 70 6c 65 20 6e 61 6d 65 73 2c 20 74 68  ltiple names, th
8030: 65 20 72 69 67 68 74 20 63 65 72 74 69 66 69 63  e right certific
8040: 61 74 65 0a 63 61 6e 20 62 65 20 75 73 65 64 2e  ate.can be used.
8050: 20 49 74 20 69 73 20 63 61 6c 6c 65 64 20 61 66   It is called af
8060: 74 65 72 20 74 68 65 20 68 65 6c 6c 6f 20 63 61  ter the hello ca
8070: 6c 6c 62 61 63 6b 20 62 75 74 20 62 65 66 6f 72  llback but befor
8080: 65 20 74 68 65 20 41 4c 50 4e 0a 63 61 6c 6c 62  e the ALPN.callb
8090: 61 63 6b 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 76  ack...[opt_def v
80a0: 65 72 69 66 79 20 5b 61 72 67 20 22 63 68 61 6e  erify [arg "chan
80b0: 6e 65 6c 49 64 20 64 65 70 74 68 20 63 65 72 74  nelId depth cert
80c0: 20 73 74 61 74 75 73 20 65 72 72 6f 72 22 5d 5d   status error"]]
80d0: 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61  .This form of ca
80e0: 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65  llback is invoke
80f0: 64 20 62 79 20 4f 70 65 6e 53 53 4c 20 77 68 65  d by OpenSSL whe
8100: 6e 20 61 20 6e 65 77 20 63 65 72 74 69 66 69 63  n a new certific
8110: 61 74 65 20 69 73 20 72 65 63 65 69 76 65 64 0a  ate is received.
8120: 66 72 6f 6d 20 74 68 65 20 70 65 65 72 2e 20 49  from the peer. I
8130: 74 20 61 6c 6c 6f 77 73 20 74 68 65 20 63 6c 69  t allows the cli
8140: 65 6e 74 20 74 6f 20 63 68 65 63 6b 20 74 68 65  ent to check the
8150: 20 63 65 72 74 69 66 69 63 61 74 65 20 76 65 72   certificate ver
8160: 69 66 69 63 61 74 69 6f 6e 0a 72 65 73 75 6c 74  ification.result
8170: 73 20 61 6e 64 20 63 68 6f 6f 73 65 20 77 68 65  s and choose whe
8180: 74 68 65 72 20 74 6f 20 63 6f 6e 74 69 6e 75 65  ther to continue
8190: 20 6f 72 20 6e 6f 74 2e 20 49 74 20 69 73 20 63   or not. It is c
81a0: 61 6c 6c 65 64 20 66 6f 72 20 65 61 63 68 0a 63  alled for each.c
81b0: 65 72 74 69 66 69 63 61 74 65 20 69 6e 20 74 68  ertificate in th
81c0: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 63 68  e certificate ch
81d0: 61 69 6e 2e 20 54 68 69 73 20 63 61 6c 6c 62 61  ain. This callba
81e0: 63 6b 20 77 61 73 20 6d 6f 76 65 64 20 66 72 6f  ck was moved fro
81f0: 6d 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61  m.[option -comma
8200: 6e 64 5d 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e  nd] in TclTLS 1.
8210: 38 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73  8. The arguments
8220: 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67   are:..[list_beg
8230: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
8240: 0a 5b 64 65 66 20 5b 61 72 67 20 64 65 70 74 68  .[def [arg depth
8250: 5d 5d 0a 54 68 65 20 64 65 70 74 68 20 69 73 20  ]].The depth is 
8260: 74 68 65 20 69 6e 74 65 67 65 72 20 64 65 70 74  the integer dept
8270: 68 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  h of the certifi
8280: 63 61 74 65 20 69 6e 20 74 68 65 20 63 65 72 74  cate in the cert
8290: 69 66 69 63 61 74 65 20 63 68 61 69 6e 2c 0a 77  ificate chain,.w
82a0: 68 65 72 65 20 30 20 69 73 20 74 68 65 20 70 65  here 0 is the pe
82b0: 65 72 20 63 65 72 74 69 66 69 63 61 74 65 20 61  er certificate a
82c0: 6e 64 20 68 69 67 68 65 72 20 76 61 6c 75 65 73  nd higher values
82d0: 20 67 6f 69 6e 67 20 75 70 20 74 6f 20 74 68 65   going up to the
82e0: 20 43 65 72 74 69 66 69 63 61 74 65 0a 41 75 74   Certificate.Aut
82f0: 68 6f 72 69 74 79 20 28 43 41 29 2e 0a 0a 5b 64  hority (CA)...[d
8300: 65 66 20 5b 61 72 67 20 63 65 72 74 5d 5d 0a 54  ef [arg cert]].T
8310: 68 65 20 63 65 72 74 20 61 72 67 75 6d 65 6e 74  he cert argument
8320: 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20 6b 65   is a list of ke
8330: 79 2d 76 61 6c 75 65 20 70 61 69 72 73 20 73 69  y-value pairs si
8340: 6d 69 6c 61 72 20 74 6f 20 74 68 6f 73 65 20 72  milar to those r
8350: 65 74 75 72 6e 65 64 20 62 79 0a 5b 63 6d 64 20  eturned by.[cmd 
8360: 74 6c 73 3a 3a 73 74 61 74 75 73 5d 2e 0a 0a 5b  tls::status]...[
8370: 64 65 66 20 5b 61 72 67 20 73 74 61 74 75 73 5d  def [arg status]
8380: 5d 0a 54 68 65 20 73 74 61 74 75 73 20 61 72 67  ].The status arg
8390: 75 6d 65 6e 74 20 69 73 20 74 68 65 20 62 6f 6f  ument is the boo
83a0: 6c 65 61 6e 20 76 61 6c 69 64 69 74 79 20 6f 66  lean validity of
83b0: 20 74 68 65 20 63 75 72 72 65 6e 74 20 63 65 72   the current cer
83c0: 74 69 66 69 63 61 74 65 20 77 68 65 72 65 20 30  tificate where 0
83d0: 0a 69 73 20 69 6e 76 61 6c 69 64 20 61 6e 64 20  .is invalid and 
83e0: 31 20 69 73 20 76 61 6c 69 64 2e 0a 0a 5b 64 65  1 is valid...[de
83f0: 66 20 5b 61 72 67 20 65 72 72 6f 72 5d 5d 0a 54  f [arg error]].T
8400: 68 65 20 65 72 72 6f 72 20 61 72 67 75 6d 65 6e  he error argumen
8410: 74 20 69 73 20 74 68 65 20 65 72 72 6f 72 20 6d  t is the error m
8420: 65 73 73 61 67 65 2c 20 69 66 20 61 6e 79 2c 20  essage, if any, 
8430: 67 65 6e 65 72 61 74 65 64 20 62 79 0a 5b 66 75  generated by.[fu
8440: 6e 20 58 35 30 39 5f 53 54 4f 52 45 5f 43 54 58  n X509_STORE_CTX
8450: 5f 67 65 74 5f 65 72 72 6f 72 28 29 5d 2e 0a 0a  _get_error()]...
8460: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 73  [list_end]..[lis
8470: 74 5f 65 6e 64 5d 0a 0a 52 65 66 65 72 65 6e 63  t_end]..Referenc
8480: 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e  e implementation
8490: 73 20 6f 66 20 74 68 65 73 65 20 63 61 6c 6c 62  s of these callb
84a0: 61 63 6b 73 20 61 72 65 20 70 72 6f 76 69 64 65  acks are provide
84b0: 64 20 69 6e 20 5b 66 69 6c 65 20 74 6c 73 2e 74  d in [file tls.t
84c0: 63 6c 5d 0a 61 73 20 5b 63 6d 64 20 74 6c 73 3a  cl].as [cmd tls:
84d0: 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64  :callback], [cmd
84e0: 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c   tls::password],
84f0: 20 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 76   and [cmd tls::v
8500: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
8510: 0a 72 65 73 70 65 63 74 69 76 65 6c 79 2e 20 4e  .respectively. N
8520: 6f 74 65 20 74 68 61 74 20 74 68 65 73 65 20 61  ote that these a
8530: 72 65 20 6f 6e 6c 79 20 5b 65 6d 70 68 20 73 61  re only [emph sa
8540: 6d 70 6c 65 5d 20 69 6d 70 6c 65 6d 65 6e 74 61  mple] implementa
8550: 74 69 6f 6e 73 2e 20 49 6e 20 61 20 6d 6f 72 65  tions. In a more
8560: 0a 72 65 61 6c 69 73 74 69 63 20 64 65 70 6c 6f  .realistic deplo
8570: 79 6d 65 6e 74 20 79 6f 75 20 77 6f 75 6c 64 20  yment you would 
8580: 73 70 65 63 69 66 79 20 79 6f 75 72 20 6f 77 6e  specify your own
8590: 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74   callback script
85a0: 73 20 6f 6e 20 65 61 63 68 20 54 4c 53 0a 63 68  s on each TLS.ch
85b0: 61 6e 6e 65 6c 20 75 73 69 6e 67 20 74 68 65 20  annel using the 
85c0: 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64  [option -command
85d0: 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73  ], [option -pass
85e0: 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b 6f 70 74 69  word], and.[opti
85f0: 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d  on -validate_com
8600: 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 73 2e 0a 0a  mand] options...
8610: 5b 70 61 72 61 5d 0a 0a 54 68 65 20 64 65 66 61  [para]..The defa
8620: 75 6c 74 20 62 65 68 61 76 69 6f 72 20 77 68 65  ult behavior whe
8630: 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63  n the [option -c
8640: 6f 6d 6d 61 6e 64 5d 20 61 6e 64 20 5b 6f 70 74  ommand] and [opt
8650: 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f  ion -validate_co
8660: 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e 73 20 61  mmand].options a
8670: 72 65 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64  re not specified
8680: 2c 20 69 73 20 66 6f 72 20 54 63 6c 54 4c 53 20  , is for TclTLS 
8690: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 65 20 61  to process the a
86a0: 73 73 6f 63 69 61 74 65 64 20 6c 69 62 72 61 72  ssociated librar
86b0: 79 0a 63 61 6c 6c 62 61 63 6b 73 20 69 6e 74 65  y.callbacks inte
86c0: 72 6e 61 6c 6c 79 2e 20 54 68 65 20 64 65 66 61  rnally. The defa
86d0: 75 6c 74 20 62 65 68 61 76 69 6f 72 20 77 68 65  ult behavior whe
86e0: 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70  n the [option -p
86f0: 61 73 73 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 0a  assword] option.
8700: 69 73 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64  is not specified
8710: 20 69 73 20 66 6f 72 20 54 63 6c 54 4c 53 20 74   is for TclTLS t
8720: 6f 20 70 72 6f 63 65 73 73 20 74 68 65 20 61 73  o process the as
8730: 73 6f 63 69 61 74 65 64 20 6c 69 62 72 61 72 79  sociated library
8740: 20 63 61 6c 6c 62 61 63 6b 73 20 62 79 0a 61 74   callbacks by.at
8750: 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 61 6c 6c  tempting to call
8760: 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77   [cmd tls::passw
8770: 6f 72 64 5d 2e 20 54 68 65 20 64 69 66 66 65 72  ord]. The differ
8780: 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65  ence between the
8790: 73 65 20 74 77 6f 0a 62 65 68 61 76 69 6f 72 73  se two.behaviors
87a0: 20 69 73 20 61 20 63 6f 6e 73 65 71 75 65 6e 63   is a consequenc
87b0: 65 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e 67  e of maintaining
87c0: 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 77   compatibility w
87d0: 69 74 68 20 65 61 72 6c 69 65 72 0a 69 6d 70 6c  ith earlier.impl
87e0: 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a 0a 5b 70  ementations...[p
87f0: 61 72 61 5d 0a 0a 5b 65 6d 70 68 20 22 54 68 65  ara]..[emph "The
8800: 20 75 73 65 20 6f 66 20 74 68 65 20 72 65 66 65   use of the refe
8810: 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73 20  rence callbacks 
8820: 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61  [cmd tls::callba
8830: 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70  ck], [cmd tls::p
8840: 61 73 73 77 6f 72 64 5d 2c 0a 61 6e 64 20 5b 63  assword],.and [c
8850: 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65  md tls::validate
8860: 5f 63 6f 6d 6d 61 6e 64 5d 20 69 73 20 6e 6f 74  _command] is not
8870: 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 20 54 68   recommended. Th
8880: 65 79 20 6d 61 79 20 62 65 20 72 65 6d 6f 76 65  ey may be remove
8890: 64 20 66 72 6f 6d 20 66 75 74 75 72 65 20 72 65  d from future re
88a0: 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b 73 65 63 74  leases."]..[sect
88b0: 69 6f 6e 20 44 65 62 75 67 5d 0a 0a 46 6f 72 20  ion Debug]..For 
88c0: 6d 6f 73 74 20 64 65 62 75 67 67 69 6e 67 20 6e  most debugging n
88d0: 65 65 64 73 2c 20 74 68 65 20 5b 6f 70 74 69 6f  eeds, the [optio
88e0: 6e 20 2d 63 61 6c 6c 62 61 63 6b 5d 20 6f 70 74  n -callback] opt
88f0: 69 6f 6e 20 63 61 6e 20 62 65 20 75 73 65 64 20  ion can be used 
8900: 74 6f 20 70 72 6f 76 69 64 65 0a 73 75 66 66 69  to provide.suffi
8910: 63 69 65 6e 74 20 69 6e 73 69 67 68 74 20 61 6e  cient insight an
8920: 64 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e  d information on
8930: 20 74 68 65 20 54 4c 53 20 68 61 6e 64 73 68 61   the TLS handsha
8940: 6b 65 20 61 6e 64 20 70 72 6f 67 72 65 73 73 2e  ke and progress.
8950: 20 49 66 0a 66 75 72 74 68 65 72 20 74 72 6f 75   If.further trou
8960: 62 6c 65 73 68 6f 6f 74 69 6e 67 20 69 6e 73 69  bleshooting insi
8970: 67 68 74 20 69 73 20 6e 65 65 64 65 64 2c 20 74  ght is needed, t
8980: 68 65 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 20  he compile time 
8990: 6f 70 74 69 6f 6e 0a 5b 6f 70 74 69 6f 6e 20 2d  option.[option -
89a0: 2d 65 6e 61 62 6c 65 2d 64 65 62 75 67 5d 20 63  -enable-debug] c
89b0: 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 67 65  an be used to ge
89c0: 74 20 64 65 74 61 69 6c 65 64 20 65 78 65 63 75  t detailed execu
89d0: 74 69 6f 6e 20 66 6c 6f 77 20 73 74 61 74 75 73  tion flow status
89e0: 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 4c 53 20 6b  ...[para]..TLS k
89f0: 65 79 20 6c 6f 67 67 69 6e 67 20 63 61 6e 20 62  ey logging can b
8a00: 65 20 65 6e 61 62 6c 65 64 20 62 79 20 73 65 74  e enabled by set
8a10: 74 69 6e 67 20 74 68 65 20 65 6e 76 69 72 6f 6e  ting the environ
8a20: 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 0a 5b 76  ment variable.[v
8a30: 61 72 20 53 53 4c 4b 45 59 4c 4f 47 46 49 4c 45  ar SSLKEYLOGFILE
8a40: 5d 20 74 6f 20 74 68 65 20 6e 61 6d 65 20 6f 66  ] to the name of
8a50: 20 74 68 65 20 66 69 6c 65 20 74 6f 20 6c 6f 67   the file to log
8a60: 20 74 6f 2e 20 54 68 65 6e 20 77 68 65 6e 65 76   to. Then whenev
8a70: 65 72 20 54 4c 53 20 6b 65 79 0a 6d 61 74 65 72  er TLS key.mater
8a80: 69 61 6c 20 69 73 20 67 65 6e 65 72 61 74 65 64  ial is generated
8a90: 20 6f 72 20 72 65 63 65 69 76 65 64 20 69 74 20   or received it 
8aa0: 77 69 6c 6c 20 62 65 20 6c 6f 67 67 65 64 20 74  will be logged t
8ab0: 6f 20 74 68 65 20 66 69 6c 65 2e 20 54 68 69 73  o the file. This
8ac0: 20 69 73 20 75 73 65 66 75 6c 0a 66 6f 72 20 6c   is useful.for l
8ad0: 6f 67 67 69 6e 67 20 6b 65 79 20 64 61 74 61 20  ogging key data 
8ae0: 66 6f 72 20 6e 65 74 77 6f 72 6b 20 6c 6f 67 67  for network logg
8af0: 69 6e 67 20 74 6f 6f 6c 73 20 74 6f 20 75 73 65  ing tools to use
8b00: 20 74 6f 20 64 65 63 72 79 70 74 20 74 68 65 20   to decrypt the 
8b10: 64 61 74 61 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54  data...[para]..T
8b20: 68 65 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62  he [var tls::deb
8b30: 75 67 5d 20 76 61 72 69 61 62 6c 65 20 70 72 6f  ug] variable pro
8b40: 76 69 64 65 73 20 73 6f 6d 65 20 61 64 64 69 74  vides some addit
8b50: 69 6f 6e 61 6c 20 63 6f 6e 74 72 6f 6c 20 6f 76  ional control ov
8b60: 65 72 20 74 68 65 0a 64 65 62 75 67 20 6c 6f 67  er the.debug log
8b70: 67 69 6e 67 20 69 6e 20 74 68 65 20 5b 63 6d 64  ging in the [cmd
8b80: 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c   tls::callback],
8b90: 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77   [cmd tls::passw
8ba0: 6f 72 64 5d 2c 20 61 6e 64 0a 5b 63 6d 64 20 74  ord], and.[cmd t
8bb0: 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d  ls::validate_com
8bc0: 6d 61 6e 64 5d 20 64 65 66 61 75 6c 74 20 68 61  mand] default ha
8bd0: 6e 64 6c 65 72 73 20 69 6e 20 5b 66 69 6c 65 20  ndlers in [file 
8be0: 74 6c 73 2e 74 63 6c 5d 2e 0a 54 68 65 20 64 65  tls.tcl]..The de
8bf0: 66 61 75 6c 74 20 76 61 6c 75 65 20 69 73 20 30  fault value is 0
8c00: 20 77 69 74 68 20 68 69 67 68 65 72 20 76 61 6c   with higher val
8c10: 75 65 73 20 70 72 6f 64 75 63 69 6e 67 20 6d 6f  ues producing mo
8c20: 72 65 20 64 69 61 67 6e 6f 73 74 69 63 20 6f 75  re diagnostic ou
8c30: 74 70 75 74 2c 0a 61 6e 64 20 77 69 6c 6c 20 61  tput,.and will a
8c40: 6c 73 6f 20 66 6f 72 63 65 20 74 68 65 20 76 65  lso force the ve
8c50: 72 69 66 79 20 6d 65 74 68 6f 64 20 69 6e 20 5b  rify method in [
8c60: 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63  cmd tls::callbac
8c70: 6b 5d 20 74 6f 20 61 63 63 65 70 74 20 74 68 65  k] to accept the
8c80: 0a 63 65 72 74 69 66 69 63 61 74 65 2c 20 65 76  .certificate, ev
8c90: 65 6e 20 69 66 20 69 74 20 69 73 20 69 6e 76 61  en if it is inva
8ca0: 6c 69 64 20 77 68 65 6e 20 74 68 65 20 5b 6f 70  lid when the [op
8cb0: 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f  tion -validateco
8cc0: 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e 20 69 73  mmand].option is
8cd0: 20 73 65 74 20 74 6f 20 5b 63 6d 64 20 74 6c 73   set to [cmd tls
8ce0: 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61  ::validate_comma
8cf0: 6e 64 5d 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65  nd]...[para]..[e
8d00: 6d 70 68 20 22 54 68 65 20 75 73 65 20 6f 66 20  mph "The use of 
8d10: 74 68 65 20 76 61 72 69 61 62 6c 65 20 5b 76 61  the variable [va
8d20: 72 20 74 6c 73 3a 3a 64 65 62 75 67 5d 20 69 73  r tls::debug] is
8d30: 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64   not recommended
8d40: 2e 0a 49 74 20 6d 61 79 20 62 65 20 72 65 6d 6f  ..It may be remo
8d50: 76 65 64 20 66 72 6f 6d 20 66 75 74 75 72 65 20  ved from future 
8d60: 72 65 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b 73 65  releases."]..[se
8d70: 63 74 69 6f 6e 20 22 45 78 61 6d 70 6c 65 73 22  ction "Examples"
8d80: 5d 0a 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67  ]..The following
8d90: 20 61 72 65 20 65 78 61 6d 70 6c 65 20 73 63 72   are example scr
8da0: 69 70 74 73 20 74 6f 20 64 6f 77 6e 6c 6f 61 64  ipts to download
8db0: 20 61 20 77 65 62 70 61 67 65 20 61 6e 64 20 66   a webpage and f
8dc0: 69 6c 65 20 75 73 69 6e 67 20 74 68 65 0a 68 74  ile using the.ht
8dd0: 74 70 20 70 61 63 6b 61 67 65 2e 20 53 65 65 20  tp package. See 
8de0: 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69 66  [sectref "Certif
8df0: 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f 6e  icate Validation
8e00: 22 5d 20 66 6f 72 20 77 68 65 6e 20 74 68 65 0a  "] for when the.
8e10: 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c  [option -cadir],
8e20: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65   [option -cafile
8e30: 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d  ], and [option -
8e40: 63 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 73  castore] options
8e50: 20 61 72 65 20 61 6c 73 6f 0a 6e 65 65 64 65 64   are also.needed
8e60: 2e 20 53 65 65 20 74 68 65 20 5b 66 69 6c 65 20  . See the [file 
8e70: 64 65 6d 6f 73 5d 20 64 69 72 65 63 74 6f 72 79  demos] directory
8e80: 20 66 6f 72 20 6d 6f 72 65 20 65 78 61 6d 70 6c   for more exampl
8e90: 65 20 73 63 72 69 70 74 73 2e 0a 0a 5b 70 61 72  e scripts...[par
8ea0: 61 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 31 3a 20  a]..Example #1: 
8eb0: 44 6f 77 6e 6c 6f 61 64 20 61 20 77 65 62 20 70  Download a web p
8ec0: 61 67 65 0a 0a 5b 65 78 61 6d 70 6c 65 20 7b 0a  age..[example {.
8ed0: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
8ee0: 20 68 74 74 70 0a 70 61 63 6b 61 67 65 20 72 65   http.package re
8ef0: 71 75 69 72 65 20 74 6c 73 0a 0a 73 65 74 20 75  quire tls..set u
8f00: 72 6c 20 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e  rl "https://www.
8f10: 74 63 6c 2e 74 6b 2f 22 0a 68 74 74 70 3a 3a 72  tcl.tk/".http::r
8f20: 65 67 69 73 74 65 72 20 68 74 74 70 73 20 34 34  egister https 44
8f30: 33 20 5b 6c 69 73 74 20 3a 3a 74 6c 73 3a 3a 73  3 [list ::tls::s
8f40: 6f 63 6b 65 74 20 2d 61 75 74 6f 73 65 72 76 65  ocket -autoserve
8f50: 72 6e 61 6d 65 20 31 20 2d 72 65 71 75 69 72 65  rname 1 -require
8f60: 20 31 5d 0a 0a 23 20 47 65 74 20 55 52 4c 0a 73   1]..# Get URL.s
8f70: 65 74 20 74 6f 6b 65 6e 20 5b 68 74 74 70 3a 3a  et token [http::
8f80: 67 65 74 75 72 6c 20 24 75 72 6c 5d 0a 0a 23 20  geturl $url]..# 
8f90: 43 68 65 63 6b 20 66 6f 72 20 65 72 72 6f 72 0a  Check for error.
8fa0: 69 66 20 7b 5b 68 74 74 70 3a 3a 73 74 61 74 75  if {[http::statu
8fb0: 73 20 24 74 6f 6b 65 6e 5d 20 6e 65 20 22 6f 6b  s $token] ne "ok
8fc0: 22 7d 20 7b 0a 20 20 20 20 70 75 74 73 20 5b 66  "} {.    puts [f
8fd0: 6f 72 6d 61 74 20 22 45 72 72 6f 72 20 25 73 22  ormat "Error %s"
8fe0: 20 5b 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24   [http::status $
8ff0: 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23 20 53 61 76  token]].}..# Sav
9000: 65 20 77 65 62 20 70 61 67 65 20 74 6f 20 66 69  e web page to fi
9010: 6c 65 0a 73 65 74 20 63 68 20 5b 6f 70 65 6e 20  le.set ch [open 
9020: 65 78 61 6d 70 6c 65 2e 68 74 6d 6c 20 77 62 5d  example.html wb]
9030: 0a 70 75 74 73 20 24 63 68 20 5b 68 74 74 70 3a  .puts $ch [http:
9040: 3a 64 61 74 61 20 24 74 6f 6b 65 6e 5d 0a 63 6c  :data $token].cl
9050: 6f 73 65 20 24 63 68 0a 0a 23 20 43 6c 65 61 6e  ose $ch..# Clean
9060: 75 70 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65 61 6e  up.::http::clean
9070: 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 45 78  up $token.}]..Ex
9080: 61 6d 70 6c 65 20 23 32 3a 20 44 6f 77 6e 6c 6f  ample #2: Downlo
9090: 61 64 20 61 20 66 69 6c 65 0a 0a 5b 65 78 61 6d  ad a file..[exam
90a0: 70 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72  ple {..package r
90b0: 65 71 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b  equire http.pack
90c0: 61 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a  age require tls.
90d0: 0a 73 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a  .set url "https:
90e0: 2f 2f 77 69 6b 69 2e 74 63 6c 2d 6c 61 6e 67 2e  //wiki.tcl-lang.
90f0: 6f 72 67 2f 73 69 74 65 6d 61 70 2e 78 6d 6c 22  org/sitemap.xml"
9100: 0a 68 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20  .http::register 
9110: 68 74 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20  https 443 [list 
9120: 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61  ::tls::socket -a
9130: 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 20 31 20  utoservername 1 
9140: 2d 72 65 71 75 69 72 65 20 31 5d 0a 0a 23 20 4f  -require 1]..# O
9150: 70 65 6e 20 6f 75 74 70 75 74 20 66 69 6c 65 0a  pen output file.
9160: 73 65 74 20 66 69 6c 65 6e 61 6d 65 20 5b 66 69  set filename [fi
9170: 6c 65 20 74 61 69 6c 20 24 75 72 6c 5d 0a 73 65  le tail $url].se
9180: 74 20 63 68 20 5b 6f 70 65 6e 20 24 66 69 6c 65  t ch [open $file
9190: 6e 61 6d 65 20 77 62 5d 0a 0a 23 20 47 65 74 20  name wb]..# Get 
91a0: 66 69 6c 65 0a 73 65 74 20 74 6f 6b 65 6e 20 5b  file.set token [
91b0: 3a 3a 68 74 74 70 3a 3a 67 65 74 75 72 6c 20 24  ::http::geturl $
91c0: 75 72 6c 20 2d 62 6c 6f 63 6b 73 69 7a 65 20 36  url -blocksize 6
91d0: 35 35 33 36 20 2d 63 68 61 6e 6e 65 6c 20 24 63  5536 -channel $c
91e0: 68 5d 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20  h]..# Check for 
91f0: 65 72 72 6f 72 0a 69 66 20 7b 5b 68 74 74 70 3a  error.if {[http:
9200: 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20  :status $token] 
9210: 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70  ne "ok"} {.    p
9220: 75 74 73 20 5b 66 6f 72 6d 61 74 20 22 45 72 72  uts [format "Err
9230: 6f 72 20 25 73 22 20 5b 68 74 74 70 3a 3a 73 74  or %s" [http::st
9240: 61 74 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a  atus $token]].}.
9250: 0a 23 20 43 6c 65 61 6e 75 70 0a 63 6c 6f 73 65  .# Cleanup.close
9260: 20 24 63 68 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65   $ch.::http::cle
9270: 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a  anup $token.}]..
9280: 5b 73 65 63 74 69 6f 6e 20 22 53 70 65 63 69 61  [section "Specia
9290: 6c 20 43 6f 6e 73 69 64 65 72 61 74 69 6f 6e 73  l Considerations
92a0: 22 5d 0a 0a 54 68 65 20 63 61 70 61 62 69 6c 69  "]..The capabili
92b0: 74 69 65 73 20 6f 66 20 74 68 69 73 20 70 61 63  ties of this pac
92c0: 6b 61 67 65 20 63 61 6e 20 76 61 72 79 20 65 6e  kage can vary en
92d0: 6f 72 6d 6f 75 73 6c 79 20 62 61 73 65 64 20 75  ormously based u
92e0: 70 6f 6e 20 68 6f 77 20 74 68 65 0a 6c 69 6e 6b  pon how the.link
92f0: 65 64 20 74 6f 20 4f 70 65 6e 53 53 4c 20 6c 69  ed to OpenSSL li
9300: 62 72 61 72 79 20 77 61 73 20 63 6f 6e 66 69 67  brary was config
9310: 75 72 65 64 20 61 6e 64 20 62 75 69 6c 74 2e 20  ured and built. 
9320: 4e 65 77 20 76 65 72 73 69 6f 6e 73 20 6d 61 79  New versions may
9330: 20 6f 62 73 6f 6c 65 74 65 0a 6f 6c 64 65 72 20   obsolete.older 
9340: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e  protocol version
9350: 73 2c 20 61 64 64 20 6f 72 20 72 65 6d 6f 76 65  s, add or remove
9360: 20 63 69 70 68 65 72 73 2c 20 63 68 61 6e 67 65   ciphers, change
9370: 20 64 65 66 61 75 6c 74 20 76 61 6c 75 65 73 2c   default values,
9380: 20 65 74 63 2e 0a 55 73 65 20 74 68 65 20 5b 63   etc..Use the [c
9390: 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c  md tls::protocol
93a0: 73 5d 20 63 6f 6d 6d 61 6e 64 73 20 74 6f 20 6f  s] commands to o
93b0: 62 74 61 69 6e 20 74 68 65 20 73 75 70 70 6f 72  btain the suppor
93c0: 74 65 64 0a 70 72 6f 74 6f 63 6f 6c 20 76 65 72  ted.protocol ver
93d0: 73 69 6f 6e 73 2e 0a 0a 5b 6d 61 6e 70 61 67 65  sions...[manpage
93e0: 5f 65 6e 64 5d 0a                                _end].