Hex Artifact Content

Artifact 51bf793bc5266cd614ee73fc437856910a8a535db8beef0ddda6591a5becc688:


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 31 2e 38 5d 0a 5b 63 61 74   tls n 1.8].[cat
0110: 65 67 6f 72 79 20 74 6c 73 5d 0a 5b 63 6f 70 79  egory tls].[copy
0120: 72 69 67 68 74 20 7b 31 39 39 39 20 4d 61 74 74  right {1999 Matt
0130: 20 4e 65 77 6d 61 6e 7d 5d 0a 5b 63 6f 70 79 72   Newman}].[copyr
0140: 69 67 68 74 20 7b 32 30 30 34 20 53 74 61 72 66  ight {2004 Starf
0150: 69 73 68 20 53 79 73 74 65 6d 73 7d 5d 0a 5b 63  ish Systems}].[c
0160: 6f 70 79 72 69 67 68 74 20 7b 32 30 32 34 20 42  opyright {2024 B
0170: 72 69 61 6e 20 4f 27 48 61 67 61 6e 7d 5d 0a 5b  rian O'Hagan}].[
0180: 6b 65 79 77 6f 72 64 73 20 74 6c 73 20 49 2f 4f  keywords tls I/O
0190: 20 22 49 50 20 41 64 64 72 65 73 73 22 20 4f 70   "IP Address" Op
01a0: 65 6e 53 53 4c 20 53 53 4c 20 54 43 50 20 54 4c  enSSL SSL TCP TL
01b0: 53 20 22 61 73 79 6e 63 68 72 6f 6e 6f 75 73 20  S "asynchronous 
01c0: 49 2f 4f 22 20 62 69 6e 64 20 63 65 72 74 69 66  I/O" bind certif
01d0: 69 63 61 74 65 20 63 68 61 6e 6e 65 6c 20 63 6f  icate channel co
01e0: 6e 6e 65 63 74 69 6f 6e 20 22 64 6f 6d 61 69 6e  nnection "domain
01f0: 20 6e 61 6d 65 22 20 68 6f 73 74 20 22 68 74 74   name" host "htt
0200: 70 73 22 20 22 6e 65 74 77 6f 72 6b 20 61 64 64  ps" "network add
0210: 72 65 73 73 22 20 6e 65 74 77 6f 72 6b 20 73 6f  ress" network so
0220: 63 6b 65 74 20 54 63 6c 54 4c 53 5d 0a 5b 6d 6f  cket TclTLS].[mo
0230: 64 64 65 73 63 20 7b 54 63 6c 20 54 4c 53 20 65  ddesc {Tcl TLS e
0240: 78 74 65 6e 73 69 6f 6e 7d 5d 0a 5b 73 65 65 5f  xtension}].[see_
0250: 61 6c 73 6f 20 68 74 74 70 20 73 6f 63 6b 65 74  also http socket
0260: 20 5b 75 72 69 20 68 74 74 70 73 3a 2f 2f 77 77   [uri https://ww
0270: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 20 4f  w.openssl.org/ O
0280: 70 65 6e 53 53 4c 5d 5d 0a 5b 74 69 74 6c 65 64  penSSL]].[titled
0290: 65 73 63 20 7b 62 69 6e 64 69 6e 67 20 74 6f 20  esc {binding to 
02a0: 74 68 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72  the OpenSSL libr
02b0: 61 72 79 20 66 6f 72 20 65 6e 63 72 79 70 74 65  ary for encrypte
02c0: 64 20 73 6f 63 6b 65 74 20 61 6e 64 20 49 2f 4f  d socket and I/O
02d0: 20 63 68 61 6e 6e 65 6c 20 63 6f 6d 6d 75 6e 69   channel communi
02e0: 63 61 74 69 6f 6e 73 7d 5d 0a 5b 72 65 71 75 69  cations}].[requi
02f0: 72 65 20 54 63 6c 20 38 2e 35 2d 5d 0a 5b 72 65  re Tcl 8.5-].[re
0300: 71 75 69 72 65 20 74 6c 73 20 31 2e 38 5d 0a 5b  quire tls 1.8].[
0310: 64 65 73 63 72 69 70 74 69 6f 6e 5d 0a 0a 54 68  description]..Th
0320: 69 73 20 65 78 74 65 6e 73 69 6f 6e 20 70 72 6f  is extension pro
0330: 76 69 64 65 73 20 54 43 4c 20 73 63 72 69 70 74  vides TCL script
0340: 20 61 63 63 65 73 73 20 74 6f 20 73 65 63 75 72   access to secur
0350: 65 20 73 6f 63 6b 65 74 20 63 6f 6d 6d 75 6e 69  e socket communi
0360: 63 61 74 69 6f 6e 73 0a 75 73 69 6e 67 20 74 68  cations.using th
0370: 65 20 54 72 61 6e 73 70 6f 72 74 20 4c 61 79 65  e Transport Laye
0380: 72 20 53 65 63 75 72 69 74 79 20 28 54 4c 53 29  r Security (TLS)
0390: 20 70 72 6f 74 6f 63 6f 6c 2e 20 49 74 20 70 72   protocol. It pr
03a0: 6f 76 69 64 65 73 20 61 20 67 65 6e 65 72 69 63  ovides a generic
03b0: 0a 62 69 6e 64 69 6e 67 20 74 6f 20 5b 75 72 69  .binding to [uri
03c0: 20 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 6f 70   "https://www.op
03d0: 65 6e 73 73 6c 2e 6f 72 67 2f 22 20 4f 70 65 6e  enssl.org/" Open
03e0: 53 53 4c 5d 2c 20 75 74 69 6c 69 7a 69 6e 67 20  SSL], utilizing 
03f0: 74 68 65 0a 5b 73 79 73 63 6d 64 20 54 63 6c 5f  the.[syscmd Tcl_
0400: 53 74 61 63 6b 43 68 61 6e 6e 65 6c 5d 20 41 50  StackChannel] AP
0410: 49 20 69 6e 20 54 43 4c 20 38 2e 34 20 61 6e 64  I in TCL 8.4 and
0420: 20 68 69 67 68 65 72 2e 0a 54 68 65 73 65 20 73   higher..These s
0430: 6f 63 6b 65 74 73 20 62 65 68 61 76 65 20 65 78  ockets behave ex
0440: 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 61  actly the same a
0450: 73 20 63 68 61 6e 6e 65 6c 73 20 63 72 65 61 74  s channels creat
0460: 65 64 20 75 73 69 6e 67 20 74 68 65 20 62 75 69  ed using the bui
0470: 6c 74 2d 69 6e 0a 5b 73 79 73 63 6d 64 20 73 6f  lt-in.[syscmd so
0480: 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 61  cket] command, a
0490: 6c 6f 6e 67 20 77 69 74 68 20 61 64 64 69 74 69  long with additi
04a0: 6f 6e 61 6c 20 6f 70 74 69 6f 6e 73 20 66 6f 72  onal options for
04b0: 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 0a 74 68 65   controlling.the
04c0: 20 53 53 4c 2f 54 4c 53 20 73 65 73 73 69 6f 6e   SSL/TLS session
04d0: 2e 0a 0a 5b 73 65 63 74 69 6f 6e 20 43 6f 6d 6d  ...[section Comm
04e0: 61 6e 64 73 5d 0a 0a 54 79 70 69 63 61 6c 6c 79  ands]..Typically
04f0: 20 6f 6e 65 20 77 6f 75 6c 64 20 75 73 65 20 74   one would use t
0500: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63  he [cmd tls::soc
0510: 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 20 74 6f 20  ket] command to 
0520: 63 72 65 61 74 65 20 61 20 6e 65 77 20 65 6e 63  create a new enc
0530: 72 79 70 74 65 64 0a 54 43 50 20 73 6f 63 6b 65  rypted.TCP socke
0540: 74 2e 20 49 74 20 69 73 20 63 6f 6d 70 61 74 69  t. It is compati
0550: 62 6c 65 20 77 69 74 68 20 74 68 65 20 6e 61 74  ble with the nat
0560: 69 76 65 20 54 43 4c 20 5b 73 79 73 63 6d 64 20  ive TCL [syscmd 
0570: 3a 3a 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e  ::socket] comman
0580: 64 2e 0a 41 6c 74 65 72 6e 61 74 69 76 65 6c 79  d..Alternatively
0590: 20 66 6f 72 20 61 6e 20 65 78 69 73 74 69 6e 67   for an existing
05a0: 20 54 43 50 20 73 6f 63 6b 65 74 2c 20 74 68 65   TCP socket, the
05b0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f 72   [cmd tls::impor
05c0: 74 5d 20 63 6f 6d 6d 61 6e 64 20 63 61 6e 20 62  t] command can b
05d0: 65 0a 75 73 65 64 20 74 6f 20 73 74 61 72 74 20  e.used to start 
05e0: 54 4c 53 20 6f 6e 20 74 68 65 20 63 6f 6e 6e 65  TLS on the conne
05f0: 63 74 69 6f 6e 2e 0a 0a 5b 6c 69 73 74 5f 62 65  ction...[list_be
0600: 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d  gin definitions]
0610: 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c 73  ..[call [cmd tls
0620: 3a 3a 69 6e 69 74 5d 20 5b 6f 70 74 20 5b 61 72  ::init] [opt [ar
0630: 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74  g -option]] [opt
0640: 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f   [arg value]] [o
0650: 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e  pt [arg "-option
0660: 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d 0a 0a   value ..."]]]..
0670: 4f 70 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f  Optional functio
0680: 6e 20 74 6f 20 73 65 74 20 74 68 65 20 64 65 66  n to set the def
0690: 61 75 6c 74 20 6f 70 74 69 6f 6e 73 20 75 73 65  ault options use
06a0: 64 20 62 79 20 5b 63 6d 64 20 74 6c 73 3a 3a 73  d by [cmd tls::s
06b0: 6f 63 6b 65 74 5d 2e 20 49 66 20 79 6f 75 0a 63  ocket]. If you.c
06c0: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d  all [cmd tls::im
06d0: 70 6f 72 74 5d 20 64 69 72 65 63 74 6c 79 2c 20  port] directly, 
06e0: 74 68 69 73 20 63 6f 6d 6d 61 6e 64 20 68 61 73  this command has
06f0: 20 6e 6f 20 65 66 66 65 63 74 2e 20 54 68 69 73   no effect. This
0700: 20 63 6f 6d 6d 61 6e 64 0a 73 75 70 70 6f 72 74   command.support
0710: 73 20 61 6c 6c 20 6f 66 20 74 68 65 20 73 61 6d  s all of the sam
0720: 65 20 6f 70 74 69 6f 6e 73 20 61 73 20 74 68 65  e options as the
0730: 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65   [cmd tls::socke
0740: 74 5d 20 63 6f 6d 6d 61 6e 64 2c 20 74 68 6f 75  t] command, thou
0750: 67 68 20 79 6f 75 0a 73 68 6f 75 6c 64 20 6c 69  gh you.should li
0760: 6d 69 74 20 79 6f 75 72 20 6f 70 74 69 6f 6e 73  mit your options
0770: 20 74 6f 20 6f 6e 6c 79 20 54 4c 53 20 72 65 6c   to only TLS rel
0780: 61 74 65 64 20 6f 6e 65 73 2e 0a 0a 5b 63 61 6c  ated ones...[cal
0790: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b  l [cmd tls::sock
07a0: 65 74 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d 6f  et] [opt [arg -o
07b0: 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61 72  ption]] [opt [ar
07c0: 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20 5b  g value]] [opt [
07d0: 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61 6c  arg "-option val
07e0: 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20 68  ue ..."]] [arg h
07f0: 6f 73 74 5d 20 5b 61 72 67 20 70 6f 72 74 5d 5d  ost] [arg port]]
0800: 0a 0a 54 68 69 73 20 69 73 20 61 20 68 65 6c 70  ..This is a help
0810: 65 72 20 66 75 6e 63 74 69 6f 6e 20 74 68 61 74  er function that
0820: 20 75 74 69 6c 69 7a 65 73 20 74 68 65 20 75 6e   utilizes the un
0830: 64 65 72 6c 79 69 6e 67 20 63 6f 6d 6d 61 6e 64  derlying command
0840: 73 20 5b 73 79 73 63 6d 64 20 73 6f 63 6b 65 74  s [syscmd socket
0850: 5d 0a 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a  ].and [cmd tls::
0860: 69 6d 70 6f 72 74 5d 20 74 6f 20 63 72 65 61 74  import] to creat
0870: 65 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  e the connection
0880: 2e 20 49 74 20 62 65 68 61 76 65 73 20 74 68 65  . It behaves the
0890: 20 73 61 6d 65 20 61 73 20 74 68 65 0a 6e 61 74   same as the.nat
08a0: 69 76 65 20 54 43 4c 20 5b 73 79 73 63 6d 64 20  ive TCL [syscmd 
08b0: 73 6f 63 6b 65 74 5d 20 63 6f 6d 6d 61 6e 64 2c  socket] command,
08c0: 20 62 75 74 20 61 6c 73 6f 20 73 75 70 70 6f 72   but also suppor
08d0: 74 73 20 74 68 65 20 5b 63 6d 64 20 74 6c 73 3a  ts the [cmd tls:
08e0: 69 6d 70 6f 72 74 5d 0a 63 6f 6d 6d 61 6e 64 20  import].command 
08f0: 6f 70 74 69 6f 6e 73 20 77 69 74 68 20 6f 6e 65  options with one
0900: 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74 69   additional opti
0910: 6f 6e 2e 20 49 74 20 72 65 74 75 72 6e 73 20 74  on. It returns t
0920: 68 65 20 63 68 61 6e 6e 65 6c 20 68 61 6e 64 6c  he channel handl
0930: 65 20 69 64 0a 66 6f 72 20 74 68 65 20 6e 65 77  e id.for the new
0940: 20 73 6f 63 6b 65 74 2e 0a 0a 5b 6c 69 73 74 5f   socket...[list_
0950: 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a  begin options]..
0960: 5b 6f 70 74 5f 64 65 66 20 2d 61 75 74 6f 73 65  [opt_def -autose
0970: 72 76 65 72 6e 61 6d 65 20 5b 61 72 67 20 62 6f  rvername [arg bo
0980: 6f 6c 5d 5d 0a 49 66 20 5b 63 6f 6e 73 74 20 74  ol]].If [const t
0990: 72 75 65 5d 2c 20 61 75 74 6f 6d 61 74 69 63 61  rue], automatica
09a0: 6c 6c 79 20 73 65 74 20 74 68 65 20 5b 6f 70 74  lly set the [opt
09b0: 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d 65 5d  ion -servername]
09c0: 20 61 72 67 75 6d 65 6e 74 20 74 6f 20 74 68 65   argument to the
09d0: 0a 5b 65 6d 70 68 20 68 6f 73 74 5d 20 61 72 67  .[emph host] arg
09e0: 75 6d 65 6e 74 2e 20 44 65 66 61 75 6c 74 20 69  ument. Default i
09f0: 73 20 5b 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e  s [const false].
0a00: 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 63  ..[list_end]..[c
0a10: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 6f  all [cmd tls::so
0a20: 63 6b 65 74 5d 20 5b 6f 70 74 69 6f 6e 20 2d 73  cket] [option -s
0a30: 65 72 76 65 72 5d 20 5b 61 72 67 20 63 6f 6d 6d  erver] [arg comm
0a40: 61 6e 64 5d 20 5b 6f 70 74 20 5b 61 72 67 20 2d  and] [opt [arg -
0a50: 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70 74 20 5b 61  option]] [opt [a
0a60: 72 67 20 76 61 6c 75 65 5d 5d 20 5b 6f 70 74 20  rg value]] [opt 
0a70: 5b 61 72 67 20 22 2d 6f 70 74 69 6f 6e 20 76 61  [arg "-option va
0a80: 6c 75 65 20 2e 2e 2e 22 5d 5d 20 5b 61 72 67 20  lue ..."]] [arg 
0a90: 70 6f 72 74 5d 5d 0a 0a 53 61 6d 65 20 61 73 20  port]]..Same as 
0aa0: 70 72 65 76 69 6f 75 73 2c 20 62 75 74 20 69 6e  previous, but in
0ab0: 73 74 65 61 64 20 63 72 65 61 74 65 73 20 61 20  stead creates a 
0ac0: 73 65 72 76 65 72 20 73 6f 63 6b 65 74 20 66 6f  server socket fo
0ad0: 72 20 63 6c 69 65 6e 74 73 20 74 6f 20 63 6f 6e  r clients to con
0ae0: 6e 65 63 74 20 74 6f 0a 6a 75 73 74 20 6c 69 6b  nect to.just lik
0af0: 65 20 74 68 65 20 54 63 6c 20 5b 73 79 73 63 6d  e the Tcl [syscm
0b00: 64 20 22 73 6f 63 6b 65 74 20 2d 73 65 72 76 65  d "socket -serve
0b10: 72 22 5d 20 63 6f 6d 6d 61 6e 64 2e 20 49 74 20  r"] command. It 
0b20: 72 65 74 75 72 6e 73 20 74 68 65 20 63 68 61 6e  returns the chan
0b30: 6e 65 6c 0a 68 61 6e 64 6c 65 20 69 64 20 66 6f  nel.handle id fo
0b40: 72 20 74 68 65 20 6e 65 77 20 73 6f 63 6b 65 74  r the new socket
0b50: 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ...[call [cmd tl
0b60: 73 3a 3a 69 6d 70 6f 72 74 5d 20 5b 61 72 67 20  s::import] [arg 
0b70: 63 68 61 6e 6e 65 6c 5d 20 5b 6f 70 74 20 5b 61  channel] [opt [a
0b80: 72 67 20 2d 6f 70 74 69 6f 6e 5d 5d 20 5b 6f 70  rg -option]] [op
0b90: 74 20 5b 61 72 67 20 76 61 6c 75 65 5d 5d 20 5b  t [arg value]] [
0ba0: 6f 70 74 20 5b 61 72 67 20 22 2d 6f 70 74 69 6f  opt [arg "-optio
0bb0: 6e 20 76 61 6c 75 65 20 2e 2e 2e 22 5d 5d 5d 0a  n value ..."]]].
0bc0: 0a 53 74 61 72 74 20 54 4c 53 20 65 6e 63 72 79  .Start TLS encry
0bd0: 70 74 69 6f 6e 20 6f 6e 20 54 43 4c 20 63 68 61  ption on TCL cha
0be0: 6e 6e 65 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65  nnel [arg channe
0bf0: 6c 5d 20 76 69 61 20 61 20 73 74 61 63 6b 65 64  l] via a stacked
0c00: 20 63 68 61 6e 6e 65 6c 2e 20 49 74 0a 6e 65 65   channel. It.nee
0c10: 64 20 6e 6f 74 20 62 65 20 61 20 73 6f 63 6b 65  d not be a socke
0c20: 74 2c 20 62 75 74 20 6d 75 73 74 20 70 72 6f 76  t, but must prov
0c30: 69 64 65 20 62 69 2d 64 69 72 65 63 74 69 6f 6e  ide bi-direction
0c40: 61 6c 20 66 6c 6f 77 2e 20 41 6c 73 6f 20 73 65  al flow. Also se
0c50: 74 73 20 73 65 73 73 69 6f 6e 0a 70 61 72 61 6d  ts session.param
0c60: 65 74 65 72 73 20 66 6f 72 20 53 53 4c 20 68 61  eters for SSL ha
0c70: 6e 64 73 68 61 6b 65 2e 20 56 61 6c 69 64 20 6f  ndshake. Valid o
0c80: 70 74 69 6f 6e 73 20 61 72 65 3a 0a 0a 5b 6c 69  ptions are:..[li
0c90: 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73  st_begin options
0ca0: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 61 6c 70  ]..[opt_def -alp
0cb0: 6e 20 5b 61 72 67 20 6c 69 73 74 5d 5d 0a 4c 69  n [arg list]].Li
0cc0: 73 74 20 6f 66 20 70 72 6f 74 6f 63 6f 6c 73 20  st of protocols 
0cd0: 74 6f 20 6f 66 66 65 72 20 64 75 72 69 6e 67 20  to offer during 
0ce0: 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65  Application-Laye
0cf0: 72 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74  r Protocol Negot
0d00: 69 61 74 69 6f 6e 0a 28 41 4c 50 4e 29 2e 20 46  iation.(ALPN). F
0d10: 6f 72 20 65 78 61 6d 70 6c 65 3a 20 5b 63 6f 6e  or example: [con
0d20: 73 74 20 68 32 5d 20 61 6e 64 20 5b 63 6f 6e 73  st h2] and [cons
0d30: 74 20 68 74 74 70 2f 31 2e 31 5d 2c 20 62 75 74  t http/1.1], but
0d40: 20 6e 6f 74 20 5b 63 6f 6e 73 74 20 68 33 5d 20   not [const h3] 
0d50: 6f 72 0a 5b 63 6f 6e 73 74 20 71 75 69 63 5d 2e  or.[const quic].
0d60: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64 69  ..[opt_def -cadi
0d70: 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72 79  r [arg directory
0d80: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
0d90: 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 65   directory where
0da0: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65   the Certificate
0db0: 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 20   Authority (CA) 
0dc0: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65  certificates are
0dd0: 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65 66  .stored. The def
0de0: 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72 6d  ault is platform
0df0: 20 73 70 65 63 69 66 69 63 20 61 6e 64 20 63 61   specific and ca
0e00: 6e 20 62 65 20 73 65 74 20 61 74 20 63 6f 6d 70  n be set at comp
0e10: 69 6c 65 20 74 69 6d 65 2e 20 54 68 65 0a 64 65  ile time. The.de
0e20: 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63  fault location c
0e30: 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e  an be overridden
0e40: 20 62 79 20 74 68 65 20 5b 76 61 72 20 53 53 4c   by the [var SSL
0e50: 5f 43 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72  _CERT_DIR] envir
0e60: 6f 6e 6d 65 6e 74 0a 76 61 72 69 61 62 6c 65 2e  onment.variable.
0e70: 20 53 65 65 20 5b 73 65 63 74 72 65 66 20 22 43   See [sectref "C
0e80: 65 72 74 69 66 69 63 61 74 65 20 56 61 6c 69 64  ertificate Valid
0e90: 61 74 69 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65  ation"] for more
0ea0: 20 64 65 74 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f   details...[opt_
0eb0: 64 65 66 20 2d 63 61 66 69 6c 65 20 5b 61 72 67  def -cafile [arg
0ec0: 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63   filename]].Spec
0ed0: 69 66 69 65 73 20 74 68 65 20 66 69 6c 65 20 77  ifies the file w
0ee0: 69 74 68 20 74 68 65 20 43 65 72 74 69 66 69 63  ith the Certific
0ef0: 61 74 65 20 41 75 74 68 6f 72 69 74 79 20 28 43  ate Authority (C
0f00: 41 29 20 63 65 72 74 69 66 69 63 61 74 65 73 20  A) certificates 
0f10: 74 6f 20 75 73 65 2e 0a 54 68 65 20 64 65 66 61  to use..The defa
0f20: 75 6c 74 20 69 73 20 5b 66 69 6c 65 20 63 65 72  ult is [file cer
0f30: 74 2e 70 65 6d 5d 2c 20 69 6e 20 74 68 65 20 4f  t.pem], in the O
0f40: 70 65 6e 53 53 4c 20 64 69 72 65 63 74 6f 72 79  penSSL directory
0f50: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 66 69  . The default fi
0f60: 6c 65 20 63 61 6e 0a 62 65 20 6f 76 65 72 72 69  le can.be overri
0f70: 64 64 65 6e 20 62 79 20 74 68 65 20 5b 76 61 72  dden by the [var
0f80: 20 53 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20   SSL_CERT_FILE] 
0f90: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69  environment vari
0fa0: 61 62 6c 65 2e 20 53 65 65 0a 5b 73 65 63 74 72  able. See.[sectr
0fb0: 65 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20  ef "Certificate 
0fc0: 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72  Validation"] for
0fd0: 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a   more details...
0fe0: 5b 6f 70 74 5f 64 65 66 20 2d 63 61 73 74 6f 72  [opt_def -castor
0ff0: 65 20 5b 61 72 67 20 55 52 49 5d 5d 0a 53 70 65  e [arg URI]].Spe
1000: 63 69 66 69 65 73 20 74 68 65 20 55 6e 69 66 6f  cifies the Unifo
1010: 72 6d 20 52 65 73 6f 75 72 63 65 20 49 64 65 6e  rm Resource Iden
1020: 74 69 66 69 65 72 20 28 55 52 49 29 20 66 6f 72  tifier (URI) for
1030: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65   the Certificate
1040: 20 41 75 74 68 6f 72 69 74 79 0a 28 43 41 29 20   Authority.(CA) 
1050: 73 74 6f 72 65 2c 20 77 68 69 63 68 20 6d 61 79  store, which may
1060: 20 62 65 20 61 20 73 69 6e 67 6c 65 20 63 6f 6e   be a single con
1070: 74 61 69 6e 65 72 20 6f 72 20 61 20 63 61 74 61  tainer or a cata
1080: 6c 6f 67 20 6f 66 20 63 6f 6e 74 61 69 6e 65 72  log of container
1090: 73 2e 0a 53 74 61 72 74 69 6e 67 20 77 69 74 68  s..Starting with
10a0: 20 4f 70 65 6e 53 53 4c 20 33 2e 32 20 6f 6e 20   OpenSSL 3.2 on 
10b0: 57 69 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20  Windows, set to 
10c0: 22 5b 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65  "[const "org.ope
10d0: 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f  nssl.winstore://
10e0: 22 5d 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62  "]".to use the b
10f0: 75 69 6c 74 2d 69 6e 20 57 69 6e 64 6f 77 73 20  uilt-in Windows 
1100: 43 65 72 74 69 66 69 63 61 74 65 20 53 74 6f 72  Certificate Stor
1110: 65 2e 20 54 68 69 73 20 73 74 6f 72 65 20 6f 6e  e. This store on
1120: 6c 79 20 73 75 70 70 6f 72 74 73 20 72 6f 6f 74  ly supports root
1130: 0a 63 65 72 74 69 66 69 63 61 74 65 20 73 74 6f  .certificate sto
1140: 72 65 73 2e 20 53 65 65 20 5b 73 65 63 74 72 65  res. See [sectre
1150: 66 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56  f "Certificate V
1160: 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f 72 20  alidation"] for 
1170: 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 0a 5b  more details...[
1180: 6f 70 74 5f 64 65 66 20 2d 63 65 72 74 66 69 6c  opt_def -certfil
1190: 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d  e [arg filename]
11a0: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
11b0: 6e 61 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65  name of the file
11c0: 20 77 69 74 68 20 74 68 65 20 63 65 72 74 69 66   with the certif
11d0: 69 63 61 74 65 20 69 6e 20 50 45 4d 20 66 6f 72  icate in PEM for
11e0: 6d 61 74 20 74 6f 20 75 73 65 0a 61 73 20 74 68  mat to use.as th
11f0: 65 20 6c 6f 63 61 6c 20 28 63 6c 69 65 6e 74 20  e local (client 
1200: 6f 72 20 73 65 72 76 65 72 29 20 63 65 72 74 69  or server) certi
1210: 66 69 63 61 74 65 2e 20 49 74 20 61 6c 73 6f 20  ficate. It also 
1220: 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 70 75 62  contains the pub
1230: 6c 69 63 20 6b 65 79 2e 0a 0a 5b 6f 70 74 5f 64  lic key...[opt_d
1240: 65 66 20 2d 63 65 72 74 20 5b 61 72 67 20 73 74  ef -cert [arg st
1250: 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66 69 65 73  ring]].Specifies
1260: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
1270: 20 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52   to use as a DER
1280: 20 65 6e 63 6f 64 65 64 20 73 74 72 69 6e 67 20   encoded string 
1290: 28 58 2e 35 30 39 20 44 45 52 29 2e 0a 0a 5b 6f  (X.509 DER)...[o
12a0: 70 74 5f 64 65 66 20 2d 63 69 70 68 65 72 20 5b  pt_def -cipher [
12b0: 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65  arg string]].Spe
12c0: 63 69 66 69 65 73 20 74 68 65 20 6c 69 73 74 20  cifies the list 
12d0: 6f 66 20 63 69 70 68 65 72 73 20 74 6f 20 75 73  of ciphers to us
12e0: 65 20 66 6f 72 20 54 4c 53 20 31 2e 32 20 61 6e  e for TLS 1.2 an
12f0: 64 20 65 61 72 6c 69 65 72 20 63 6f 6e 6e 65 63  d earlier connec
1300: 74 69 6f 6e 73 2e 0a 53 74 72 69 6e 67 20 69 73  tions..String is
1310: 20 61 20 63 6f 6c 6f 6e 20 22 5b 63 6f 6e 73 74   a colon "[const
1320: 20 3a 5d 22 20 73 65 70 61 72 61 74 65 64 20 6c   :]" separated l
1330: 69 73 74 20 6f 66 20 63 69 70 68 65 72 73 2e 0a  ist of ciphers..
1340: 43 69 70 68 65 72 73 20 63 61 6e 20 62 65 20 63  Ciphers can be c
1350: 6f 6d 62 69 6e 65 64 20 75 73 69 6e 67 20 74 68  ombined using th
1360: 65 20 22 5b 63 6f 6e 73 74 20 2b 5d 22 20 63 68  e "[const +]" ch
1370: 61 72 61 63 74 65 72 2e 0a 50 72 65 66 69 78 65  aracter..Prefixe
1380: 73 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f  s can be used to
1390: 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20 72 65 6d   permanently rem
13a0: 6f 76 65 20 22 5b 63 6f 6e 73 74 20 21 5d 22 2c  ove "[const !]",
13b0: 20 64 65 6c 65 74 65 20 22 5b 63 6f 6e 73 74 20   delete "[const 
13c0: 2d 5d 22 2c 20 6f 72 0a 6d 6f 76 65 20 74 6f 20  -]", or.move to 
13d0: 74 68 65 20 65 6e 64 20 22 5b 63 6f 6e 73 74 20  the end "[const 
13e0: 2b 5d 22 20 61 20 73 70 65 63 69 66 69 65 64 20  +]" a specified 
13f0: 63 69 70 68 65 72 2e 0a 4b 65 79 77 6f 72 64 73  cipher..Keywords
1400: 20 5b 63 6f 6e 73 74 20 40 53 54 52 45 4e 47 54   [const @STRENGT
1410: 48 5d 20 28 73 6f 72 74 20 62 79 20 61 6c 67 6f  H] (sort by algo
1420: 72 69 74 68 6d 20 6b 65 79 20 6c 65 6e 67 74 68  rithm key length
1430: 29 2c 0a 5b 63 6f 6e 73 74 20 40 53 45 43 4c 45  ),.[const @SECLE
1440: 56 45 4c 3d 5d 5b 65 6d 70 68 20 6e 5d 20 28 73  VEL=][emph n] (s
1450: 65 74 20 73 65 63 75 72 69 74 79 20 6c 65 76 65  et security leve
1460: 6c 20 74 6f 20 6e 29 2c 20 61 6e 64 0a 5b 63 6f  l to n), and.[co
1470: 6e 73 74 20 44 45 46 41 55 4c 54 5d 20 28 75 73  nst DEFAULT] (us
1480: 65 20 64 65 66 61 75 6c 74 20 63 69 70 68 65 72  e default cipher
1490: 20 6c 69 73 74 2c 20 61 74 20 73 74 61 72 74 20   list, at start 
14a0: 6f 6e 6c 79 29 20 63 61 6e 20 61 6c 73 6f 20 62  only) can also b
14b0: 65 20 73 70 65 63 69 66 69 65 64 2e 0a 53 65 65  e specified..See
14c0: 20 74 68 65 20 5b 75 72 69 20 22 68 74 74 70 73   the [uri "https
14d0: 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c 2e  ://docs.openssl.
14e0: 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31 2f  org/master/man1/
14f0: 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73 2f  openssl-ciphers/
1500: 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53 53  #options" OpenSS
1510: 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e  L].documentation
1520: 20 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c 69   for the full li
1530: 73 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75  st of valid valu
1540: 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63  es...[opt_def -c
1550: 69 70 68 65 72 73 75 69 74 65 73 20 5b 61 72 67  iphersuites [arg
1560: 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65 63 69 66   string]].Specif
1570: 69 65 73 20 74 68 65 20 6c 69 73 74 20 6f 66 20  ies the list of 
1580: 63 69 70 68 65 72 20 73 75 69 74 65 73 20 74 6f  cipher suites to
1590: 20 75 73 65 20 66 6f 72 20 54 4c 53 20 31 2e 33   use for TLS 1.3
15a0: 20 61 73 20 61 20 63 6f 6c 6f 6e 0a 22 5b 63 6f   as a colon."[co
15b0: 6e 73 74 20 3a 5d 22 20 73 65 70 61 72 61 74 65  nst :]" separate
15c0: 64 20 6c 69 73 74 20 6f 66 20 63 69 70 68 65 72  d list of cipher
15d0: 20 73 75 69 74 65 20 6e 61 6d 65 73 2e 20 53 65   suite names. Se
15e0: 65 20 74 68 65 0a 5b 75 72 69 20 22 68 74 74 70  e the.[uri "http
15f0: 73 3a 2f 2f 64 6f 63 73 2e 6f 70 65 6e 73 73 6c  s://docs.openssl
1600: 2e 6f 72 67 2f 6d 61 73 74 65 72 2f 6d 61 6e 31  .org/master/man1
1610: 2f 6f 70 65 6e 73 73 6c 2d 63 69 70 68 65 72 73  /openssl-ciphers
1620: 2f 23 6f 70 74 69 6f 6e 73 22 20 4f 70 65 6e 53  /#options" OpenS
1630: 53 4c 5d 0a 64 6f 63 75 6d 65 6e 74 61 74 69 6f  SL].documentatio
1640: 6e 20 66 6f 72 20 74 68 65 20 66 75 6c 6c 20 6c  n for the full l
1650: 69 73 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c  ist of valid val
1660: 75 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ues...[opt_def -
1670: 63 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c  command [arg cal
1680: 6c 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65  lback]].Specifie
1690: 73 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63  s the callback c
16a0: 6f 6d 6d 61 6e 64 20 74 6f 20 62 65 20 69 6e 76  ommand to be inv
16b0: 6f 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20  oked at several 
16c0: 70 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68  points during th
16d0: 65 0a 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 70  e.handshake to p
16e0: 61 73 73 20 65 72 72 6f 72 73 2c 20 74 72 61 63  ass errors, trac
16f0: 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c  ing information,
1700: 20 61 6e 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 65   and protocol me
1710: 73 73 61 67 65 73 2e 0a 53 65 65 20 5b 73 65 63  ssages..See [sec
1720: 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f  tref "Callback O
1730: 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72  ptions"] for mor
1740: 65 20 69 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65  e info...[opt_de
1750: 66 20 2d 64 68 70 61 72 61 6d 73 20 5b 61 72 67  f -dhparams [arg
1760: 20 66 69 6c 65 6e 61 6d 65 5d 5d 0a 53 70 65 63   filename]].Spec
1770: 69 66 69 65 73 20 74 68 65 20 44 69 66 66 69 65  ifies the Diffie
1780: 2d 48 65 6c 6c 6d 61 6e 20 28 44 48 29 20 70 61  -Hellman (DH) pa
1790: 72 61 6d 65 74 65 72 73 20 66 69 6c 65 2e 0a 0a  rameters file...
17a0: 5b 6f 70 74 5f 64 65 66 20 2d 6b 65 79 66 69 6c  [opt_def -keyfil
17b0: 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d  e [arg filename]
17c0: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
17d0: 70 72 69 76 61 74 65 20 6b 65 79 20 66 69 6c 65  private key file
17e0: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 76 61  . The default va
17f0: 6c 75 65 20 69 73 20 74 6f 20 75 73 65 20 74 68  lue is to use th
1800: 65 20 66 69 6c 65 0a 73 70 65 63 69 66 69 65 64  e file.specified
1810: 20 62 79 20 74 68 65 20 5b 61 72 67 20 2d 63 65   by the [arg -ce
1820: 72 74 66 69 6c 65 5d 20 6f 70 74 69 6f 6e 2e 0a  rtfile] option..
1830: 0a 5b 6f 70 74 5f 64 65 66 20 2d 6b 65 79 20 5b  .[opt_def -key [
1840: 61 72 67 20 73 74 72 69 6e 67 5d 5d 0a 53 70 65  arg string]].Spe
1850: 63 69 66 69 65 73 20 74 68 65 20 70 72 69 76 61  cifies the priva
1860: 74 65 20 6b 65 79 20 74 6f 20 75 73 65 20 61 73  te key to use as
1870: 20 61 20 44 45 52 20 65 6e 63 6f 64 65 64 20 73   a DER encoded s
1880: 74 72 69 6e 67 20 28 50 4b 43 53 23 31 20 44 45  tring (PKCS#1 DE
1890: 52 29 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 6d  R)...[opt_def -m
18a0: 6f 64 65 6c 20 5b 61 72 67 20 63 68 61 6e 6e 65  odel [arg channe
18b0: 6c 5d 5d 0a 46 6f 72 63 65 20 74 68 69 73 20 63  l]].Force this c
18c0: 68 61 6e 6e 65 6c 20 74 6f 20 73 68 61 72 65 20  hannel to share 
18d0: 74 68 65 20 73 61 6d 65 20 5b 74 65 72 6d 20 53  the same [term S
18e0: 53 4c 5f 43 54 58 5d 20 73 74 72 75 63 74 75 72  SL_CTX] structur
18f0: 65 20 61 73 20 74 68 65 0a 73 70 65 63 69 66 69  e as the.specifi
1900: 65 64 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  ed [arg channel]
1910: 2c 20 61 6e 64 20 74 68 65 72 65 66 6f 72 65 20  , and therefore 
1920: 73 68 61 72 65 20 63 6f 6e 66 69 67 2c 20 63 61  share config, ca
1930: 6c 6c 62 61 63 6b 73 2c 20 65 74 63 2e 0a 0a 5b  llbacks, etc...[
1940: 6f 70 74 5f 64 65 66 20 2d 70 61 73 73 77 6f 72  opt_def -passwor
1950: 64 20 5b 61 72 67 20 63 61 6c 6c 62 61 63 6b 5d  d [arg callback]
1960: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
1970: 63 61 6c 6c 62 61 63 6b 20 63 6f 6d 6d 61 6e 64  callback command
1980: 20 74 6f 20 69 6e 76 6f 6b 65 20 77 68 65 6e 20   to invoke when 
1990: 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73 20 74 6f  OpenSSL needs to
19a0: 20 6f 62 74 61 69 6e 20 61 0a 70 61 73 73 77 6f   obtain a.passwo
19b0: 72 64 2e 20 54 68 69 73 20 69 73 20 74 79 70 69  rd. This is typi
19c0: 63 61 6c 6c 79 20 75 73 65 64 20 74 6f 20 75 6e  cally used to un
19d0: 6c 6f 63 6b 20 74 68 65 20 70 72 69 76 61 74 65  lock the private
19e0: 20 6b 65 79 20 6f 66 20 61 20 63 65 72 74 69 66   key of a certif
19f0: 69 63 61 74 65 2e 0a 54 68 65 20 63 61 6c 6c 62  icate..The callb
1a00: 61 63 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72  ack should retur
1a10: 6e 20 61 20 70 61 73 73 77 6f 72 64 20 73 74 72  n a password str
1a20: 69 6e 67 2e 20 53 65 65 20 5b 73 65 63 74 72 65  ing. See [sectre
1a30: 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70 74 69  f "Callback Opti
1a40: 6f 6e 73 22 5d 0a 66 6f 72 20 6d 6f 72 65 20 69  ons"].for more i
1a50: 6e 66 6f 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  nfo...[opt_def -
1a60: 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b 65 20 5b  post_handshake [
1a70: 61 72 67 20 62 6f 6f 6c 5d 5d 0a 41 6c 6c 6f 77  arg bool]].Allow
1a80: 20 70 6f 73 74 2d 68 61 6e 64 73 68 61 6b 65 20   post-handshake 
1a90: 73 65 73 73 69 6f 6e 20 74 69 63 6b 65 74 20 75  session ticket u
1aa0: 70 64 61 74 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65  pdates...[opt_de
1ab0: 66 20 2d 72 65 71 75 65 73 74 20 5b 61 72 67 20  f -request [arg 
1ac0: 62 6f 6f 6c 5d 5d 0a 52 65 71 75 65 73 74 20 61  bool]].Request a
1ad0: 20 63 65 72 74 69 66 69 63 61 74 65 20 66 72 6f   certificate fro
1ae0: 6d 20 70 65 65 72 20 64 75 72 69 6e 67 20 74 68  m peer during th
1af0: 65 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e  e SSL handshake.
1b00: 20 54 68 69 73 20 69 73 20 6e 65 65 64 65 64 20   This is needed 
1b10: 74 6f 20 64 6f 0a 43 65 72 74 69 66 69 63 61 74  to do.Certificat
1b20: 65 20 56 61 6c 69 64 61 74 69 6f 6e 2e 20 44 65  e Validation. De
1b30: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
1b40: 74 72 75 65 5d 2e 0a 53 65 65 20 5b 73 65 63 74  true]..See [sect
1b50: 72 65 66 20 22 43 65 72 74 69 66 69 63 61 74 65  ref "Certificate
1b60: 20 56 61 6c 69 64 61 74 69 6f 6e 22 5d 20 66 6f   Validation"] fo
1b70: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a  r more details..
1b80: 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 69  .[opt_def -requi
1b90: 72 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52  re [arg bool]].R
1ba0: 65 71 75 69 72 65 20 61 20 76 61 6c 69 64 20 63  equire a valid c
1bb0: 65 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20  ertificate from 
1bc0: 70 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 20  peer during the 
1bd0: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 49  SSL handshake. I
1be0: 66 20 74 68 69 73 20 69 73 20 73 65 74 20 74 6f  f this is set to
1bf0: 0a 74 72 75 65 2c 20 74 68 65 6e 20 5b 6f 70 74  .true, then [opt
1c00: 69 6f 6e 20 2d 72 65 71 75 65 73 74 5d 20 6d 75  ion -request] mu
1c10: 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74 20 74  st also be set t
1c20: 6f 20 74 72 75 65 20 61 6e 64 20 61 20 65 69 74  o true and a eit
1c30: 68 65 72 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  her [option -cad
1c40: 69 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61  ir],.[option -ca
1c50: 66 69 6c 65 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d  file], [option -
1c60: 63 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70  castore], or a p
1c70: 6c 61 74 66 6f 72 6d 20 64 65 66 61 75 6c 74 20  latform default 
1c80: 6d 75 73 74 20 62 65 20 70 72 6f 76 69 64 65 64  must be provided
1c90: 20 69 6e 20 6f 72 64 65 72 20 74 6f 0a 76 61 6c   in order to.val
1ca0: 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20 54  idate against. T
1cb0: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63  he default is [c
1cc0: 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e 63  onst false] sinc
1cd0: 65 20 6e 6f 74 20 61 6c 6c 20 70 6c 61 74 66 6f  e not all platfo
1ce0: 72 6d 73 20 68 61 76 65 0a 63 65 72 74 69 66 69  rms have.certifi
1cf0: 63 61 74 65 73 20 74 6f 20 76 61 6c 69 64 61 74  cates to validat
1d00: 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20 66  e against in a f
1d10: 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20 77  orm compatible w
1d20: 69 74 68 20 4f 70 65 6e 53 53 4c 2e 0a 53 65 65  ith OpenSSL..See
1d30: 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69   [sectref "Certi
1d40: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f  ficate Validatio
1d50: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74  n"] for more det
1d60: 61 69 6c 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  ails...[opt_def 
1d70: 2d 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 20  -security_level 
1d80: 5b 61 72 67 20 69 6e 74 65 67 65 72 5d 5d 0a 53  [arg integer]].S
1d90: 70 65 63 69 66 69 65 73 20 74 68 65 20 73 65 63  pecifies the sec
1da0: 75 72 69 74 79 20 6c 65 76 65 6c 20 28 76 61 6c  urity level (val
1db0: 75 65 20 66 72 6f 6d 20 30 20 74 6f 20 35 29 2e  ue from 0 to 5).
1dc0: 20 54 68 65 20 73 65 63 75 72 69 74 79 20 6c 65   The security le
1dd0: 76 65 6c 20 61 66 66 65 63 74 73 0a 74 68 65 20  vel affects.the 
1de0: 61 6c 6c 6f 77 65 64 20 63 69 70 68 65 72 20 73  allowed cipher s
1df0: 75 69 74 65 20 65 6e 63 72 79 70 74 69 6f 6e 20  uite encryption 
1e00: 61 6c 67 6f 72 69 74 68 6d 73 2c 20 73 75 70 70  algorithms, supp
1e10: 6f 72 74 65 64 20 45 43 43 20 63 75 72 76 65 73  orted ECC curves
1e20: 2c 0a 73 75 70 70 6f 72 74 65 64 20 73 69 67 6e  ,.supported sign
1e30: 61 74 75 72 65 20 61 6c 67 6f 72 69 74 68 6d 73  ature algorithms
1e40: 2c 20 44 48 20 70 61 72 61 6d 65 74 65 72 20 73  , DH parameter s
1e50: 69 7a 65 73 2c 20 63 65 72 74 69 66 69 63 61 74  izes, certificat
1e60: 65 20 6b 65 79 20 73 69 7a 65 73 0a 61 6e 64 20  e key sizes.and 
1e70: 73 69 67 6e 61 74 75 72 65 20 61 6c 67 6f 72 69  signature algori
1e80: 74 68 6d 73 2e 20 54 68 65 20 64 65 66 61 75 6c  thms. The defaul
1e90: 74 20 69 73 20 31 20 70 72 69 6f 72 20 74 6f 20  t is 1 prior to 
1ea0: 4f 70 65 6e 53 53 4c 20 33 2e 32 20 61 6e 64 20  OpenSSL 3.2 and 
1eb0: 32 0a 74 68 65 72 65 61 66 74 65 72 2e 20 4c 65  2.thereafter. Le
1ec0: 76 65 6c 20 33 20 61 6e 64 20 68 69 67 68 65 72  vel 3 and higher
1ed0: 20 64 69 73 61 62 6c 65 20 73 75 70 70 6f 72 74   disable support
1ee0: 20 66 6f 72 20 73 65 73 73 69 6f 6e 20 74 69 63   for session tic
1ef0: 6b 65 74 73 20 61 6e 64 0a 6f 6e 6c 79 20 61 63  kets and.only ac
1f00: 63 65 70 74 20 63 69 70 68 65 72 20 73 75 69 74  cept cipher suit
1f10: 65 73 20 74 68 61 74 20 70 72 6f 76 69 64 65 20  es that provide 
1f20: 66 6f 72 77 61 72 64 20 73 65 63 72 65 63 79 2e  forward secrecy.
1f30: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 72 76  ..[opt_def -serv
1f40: 65 72 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 53  er [arg bool]].S
1f50: 70 65 63 69 66 69 65 73 20 77 68 65 74 68 65 72  pecifies whether
1f60: 20 74 6f 20 61 63 74 20 61 73 20 61 20 73 65 72   to act as a ser
1f70: 76 65 72 20 61 6e 64 20 72 65 73 70 6f 6e 64 20  ver and respond 
1f80: 77 69 74 68 20 61 20 73 65 72 76 65 72 20 68 61  with a server ha
1f90: 6e 64 73 68 61 6b 65 20 77 68 65 6e 20 61 0a 63  ndshake when a.c
1fa0: 6c 69 65 6e 74 20 63 6f 6e 6e 65 63 74 73 20 61  lient connects a
1fb0: 6e 64 20 70 72 6f 76 69 64 65 73 20 61 20 63 6c  nd provides a cl
1fc0: 69 65 6e 74 20 68 61 6e 64 73 68 61 6b 65 2e 20  ient handshake. 
1fd0: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  The default is [
1fe0: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 0a 0a 5b  const false]...[
1ff0: 6f 70 74 5f 64 65 66 20 2d 73 65 72 76 65 72 6e  opt_def -servern
2000: 61 6d 65 20 5b 61 72 67 20 68 6f 73 74 6e 61 6d  ame [arg hostnam
2010: 65 5d 5d 0a 53 70 65 63 69 66 79 20 74 68 65 20  e]].Specify the 
2020: 70 65 65 72 27 73 20 68 6f 73 74 6e 61 6d 65 2e  peer's hostname.
2030: 20 54 68 69 73 20 69 73 20 75 73 65 64 20 74 6f   This is used to
2040: 20 73 65 74 20 74 68 65 20 54 4c 53 20 53 65 72   set the TLS Ser
2050: 76 65 72 20 4e 61 6d 65 0a 49 6e 64 69 63 61 74  ver Name.Indicat
2060: 69 6f 6e 20 28 53 4e 49 29 20 65 78 74 65 6e 73  ion (SNI) extens
2070: 69 6f 6e 2e 20 53 65 74 20 74 68 69 73 20 74 6f  ion. Set this to
2080: 20 74 68 65 20 65 78 70 65 63 74 65 64 20 73 65   the expected se
2090: 72 76 65 72 6e 61 6d 65 20 69 6e 20 74 68 65 0a  rvername in the.
20a0: 73 65 72 76 65 72 27 73 20 63 65 72 74 69 66 69  server's certifi
20b0: 63 61 74 65 20 6f 72 20 6f 6e 65 20 6f 66 20 74  cate or one of t
20c0: 68 65 20 53 75 62 6a 65 63 74 20 41 6c 74 65 72  he Subject Alter
20d0: 6e 61 74 65 20 4e 61 6d 65 73 20 28 53 41 4e 29  nate Names (SAN)
20e0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 73 65 73  ...[opt_def -ses
20f0: 73 69 6f 6e 5f 69 64 20 5b 61 72 67 20 62 69 6e  sion_id [arg bin
2100: 61 72 79 5f 73 74 72 69 6e 67 5d 5d 0a 53 70 65  ary_string]].Spe
2110: 63 69 66 69 65 73 20 74 68 65 20 73 65 73 73 69  cifies the sessi
2120: 6f 6e 20 69 64 20 74 6f 20 72 65 73 75 6d 65 20  on id to resume 
2130: 61 20 73 65 73 73 69 6f 6e 2e 20 4e 6f 74 20 73  a session. Not s
2140: 75 70 70 6f 72 74 65 64 20 79 65 74 2e 0a 0a 5b  upported yet...[
2150: 6f 70 74 5f 64 65 66 20 2d 73 73 6c 32 20 5b 61  opt_def -ssl2 [a
2160: 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65  rg bool]].Enable
2170: 20 75 73 65 20 6f 66 20 53 53 4c 20 76 32 2e 20   use of SSL v2. 
2180: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  The default is [
2190: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 2e 20 4e 6f  const false]. No
21a0: 74 65 3a 20 52 65 63 65 6e 74 20 76 65 72 73 69  te: Recent versi
21b0: 6f 6e 73 20 6f 66 0a 4f 70 65 6e 53 53 4c 20 6e  ons of.OpenSSL n
21c0: 6f 20 6c 6f 6e 67 65 72 20 73 75 70 70 6f 72 74  o longer support
21d0: 20 53 53 4c 76 32 2c 20 73 6f 20 74 68 69 73 20   SSLv2, so this 
21e0: 6d 61 79 20 6e 6f 74 20 68 61 76 65 20 61 6e 79  may not have any
21f0: 20 65 66 66 65 63 74 2e 20 53 65 65 20 74 68 65   effect. See the
2200: 0a 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f  .[cmd tls::proto
2210: 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 20 66 6f  cols] command fo
2220: 72 20 73 75 70 70 6f 72 74 65 64 20 70 72 6f 74  r supported prot
2230: 6f 63 6f 6c 73 2e 0a 09 0a 5b 6f 70 74 5f 64 65  ocols....[opt_de
2240: 66 20 2d 73 73 6c 33 20 5b 61 72 67 20 62 6f 6f  f -ssl3 [arg boo
2250: 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f  l]].Enable use o
2260: 66 20 53 53 4c 20 76 33 2e 20 54 68 65 20 64 65  f SSL v3. The de
2270: 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20  fault is [const 
2280: 66 61 6c 73 65 5d 2e 20 4e 6f 74 65 3a 20 52 65  false]. Note: Re
2290: 63 65 6e 74 20 76 65 72 73 69 6f 6e 73 0a 6f 66  cent versions.of
22a0: 20 4f 70 65 6e 53 53 4c 20 6d 61 79 20 68 61 76   OpenSSL may hav
22b0: 65 20 74 68 69 73 20 64 69 73 61 62 6c 65 64 20  e this disabled 
22c0: 61 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 2c  at compile time,
22d0: 20 73 6f 20 74 68 69 73 20 6d 61 79 20 6e 6f 74   so this may not
22e0: 20 68 61 76 65 20 61 6e 79 0a 65 66 66 65 63 74   have any.effect
22f0: 2e 20 53 65 65 20 74 68 65 20 5b 63 6d 64 20 74  . See the [cmd t
2300: 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63  ls::protocols] c
2310: 6f 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70 70 6f  ommand for suppo
2320: 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73 2e 0a  rted protocols..
2330: 0a 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 20  .[opt_def -tls1 
2340: 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62  [arg bool]].Enab
2350: 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31  le use of TLS v1
2360: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73  . The default is
2370: 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 4e   [const true]. N
2380: 6f 74 65 3a 20 54 4c 53 20 31 2e 30 20 6e 65 65  ote: TLS 1.0 nee
2390: 64 73 0a 53 48 41 31 20 74 6f 20 6f 70 65 72 61  ds.SHA1 to opera
23a0: 74 65 2c 20 77 68 69 63 68 20 69 73 20 6f 6e 6c  te, which is onl
23b0: 79 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 73  y available in s
23c0: 65 63 75 72 69 74 79 20 6c 65 76 65 6c 20 30 20  ecurity level 0 
23d0: 66 6f 72 20 4f 70 65 6e 20 53 53 4c 20 33 2e 30  for Open SSL 3.0
23e0: 2b 2e 0a 53 65 65 20 74 68 65 20 5b 61 72 67 20  +..See the [arg 
23f0: 2d 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d  -security_level]
2400: 20 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64   option...[opt_d
2410: 65 66 20 2d 74 6c 73 31 2e 31 20 5b 61 72 67 20  ef -tls1.1 [arg 
2420: 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73  bool]].Enable us
2430: 65 20 6f 66 20 54 4c 53 20 76 31 2e 31 2e 20 54  e of TLS v1.1. T
2440: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63  he default is [c
2450: 6f 6e 73 74 20 74 72 75 65 5d 2e 20 4e 6f 74 65  onst true]. Note
2460: 3a 20 54 4c 53 20 31 2e 31 20 6e 65 65 64 73 0a  : TLS 1.1 needs.
2470: 53 48 41 31 20 74 6f 20 6f 70 65 72 61 74 65 2c  SHA1 to operate,
2480: 20 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 61   which is only a
2490: 76 61 69 6c 61 62 6c 65 20 69 6e 20 73 65 63 75  vailable in secu
24a0: 72 69 74 79 20 6c 65 76 65 6c 20 30 20 66 6f 72  rity level 0 for
24b0: 20 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 0a   Open SSL 3.0+..
24c0: 53 65 65 20 74 68 65 20 5b 61 72 67 20 2d 73 65  See the [arg -se
24d0: 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 6f 70  curity_level] op
24e0: 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20  tion...[opt_def 
24f0: 2d 74 6c 73 31 2e 32 20 5b 61 72 67 20 62 6f 6f  -tls1.2 [arg boo
2500: 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f  l]].Enable use o
2510: 66 20 54 4c 53 20 76 31 2e 32 2e 20 54 68 65 20  f TLS v1.2. The 
2520: 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73  default is [cons
2530: 74 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74 5f 64  t true]...[opt_d
2540: 65 66 20 2d 74 6c 73 31 2e 33 20 5b 61 72 67 20  ef -tls1.3 [arg 
2550: 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73  bool]].Enable us
2560: 65 20 6f 66 20 54 4c 53 20 76 31 2e 33 2e 20 54  e of TLS v1.3. T
2570: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63  he default is [c
2580: 6f 6e 73 74 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70  onst true]...[op
2590: 74 5f 64 65 66 20 2d 76 61 6c 69 64 61 74 65 63  t_def -validatec
25a0: 6f 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c  ommand [arg call
25b0: 62 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73  back]].Specifies
25c0: 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f   the callback co
25d0: 6d 6d 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20  mmand to invoke 
25e0: 74 6f 20 76 61 6c 69 64 61 74 65 20 74 68 65 20  to validate the 
25f0: 70 65 65 72 20 63 65 72 74 69 66 69 63 61 74 65  peer certificate
2600: 73 0a 61 6e 64 20 6f 74 68 65 72 20 63 6f 6e 66  s.and other conf
2610: 69 67 20 69 6e 66 6f 20 64 75 72 69 6e 67 20 74  ig info during t
2620: 68 65 20 70 72 6f 74 6f 63 6f 6c 20 6e 65 67 6f  he protocol nego
2630: 74 69 61 74 69 6f 6e 20 70 68 61 73 65 2e 20 54  tiation phase. T
2640: 68 69 73 20 63 61 6e 20 62 65 20 75 73 65 64 0a  his can be used.
2650: 62 79 20 54 43 4c 20 73 63 72 69 70 74 73 20 74  by TCL scripts t
2660: 6f 20 70 65 72 66 6f 72 6d 20 74 68 65 69 72 20  o perform their 
2670: 6f 77 6e 20 43 65 72 74 69 66 69 63 61 74 65 20  own Certificate 
2680: 56 61 6c 69 64 61 74 69 6f 6e 20 74 6f 20 73 75  Validation to su
2690: 70 70 6c 65 6d 65 6e 74 20 74 68 65 0a 64 65 66  pplement the.def
26a0: 61 75 6c 74 20 76 61 6c 69 64 61 74 69 6f 6e 20  ault validation 
26b0: 70 72 6f 76 69 64 65 64 20 62 79 20 4f 70 65 6e  provided by Open
26c0: 53 53 4c 2e 20 54 68 65 20 73 63 72 69 70 74 20  SSL. The script 
26d0: 6d 75 73 74 20 72 65 74 75 72 6e 20 61 20 62 6f  must return a bo
26e0: 6f 6c 65 61 6e 20 74 72 75 65 0a 74 6f 20 63 6f  olean true.to co
26f0: 6e 74 69 6e 75 65 20 74 68 65 20 6e 65 67 6f 74  ntinue the negot
2700: 69 61 74 69 6f 6e 2e 20 53 65 65 20 5b 73 65 63  iation. See [sec
2710: 74 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f  tref "Callback O
2720: 70 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72  ptions"] for mor
2730: 65 20 69 6e 66 6f 2e 0a 0a 5b 6c 69 73 74 5f 65  e info...[list_e
2740: 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20  nd]..[call [cmd 
2750: 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d 20 5b  tls::unimport] [
2760: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 43  arg channel]]..C
2770: 6f 6d 70 6c 69 6d 65 6e 74 20 74 6f 20 5b 63 6d  ompliment to [cm
2780: 64 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e 20  d tls::import]. 
2790: 55 73 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 74  Used to remove t
27a0: 68 65 20 74 6f 70 20 6c 65 76 65 6c 20 73 74 61  he top level sta
27b0: 63 6b 65 64 20 63 68 61 6e 6e 65 6c 0a 66 72 6f  cked channel.fro
27c0: 6d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2e  m [arg channel].
27d0: 20 54 68 69 73 20 75 6e 73 74 61 63 6b 73 20 74   This unstacks t
27e0: 68 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f 66  he encryption of
27f0: 20 61 20 72 65 67 75 6c 61 72 20 54 43 4c 20 63   a regular TCL c
2800: 68 61 6e 6e 65 6c 2e 20 41 6e 0a 65 72 72 6f 72  hannel. An.error
2810: 20 69 73 20 74 68 72 6f 77 6e 20 69 66 20 54 4c   is thrown if TL
2820: 53 20 69 73 20 6e 6f 74 20 74 68 65 20 74 6f 70  S is not the top
2830: 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c   stacked channel
2840: 20 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c 20 5b 63   type...[call [c
2850: 6d 64 20 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b  md tls::handshak
2860: 65 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d  e] [arg channel]
2870: 5d 0a 0a 46 6f 72 63 65 73 20 74 68 65 20 54 4c  ]..Forces the TL
2880: 53 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20 68 61  S negotiation ha
2890: 6e 64 73 68 61 6b 65 20 74 6f 20 74 61 6b 65 20  ndshake to take 
28a0: 70 6c 61 63 65 20 69 6d 6d 65 64 69 61 74 65 6c  place immediatel
28b0: 79 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 30  y, and returns 0
28c0: 0a 69 66 20 68 61 6e 64 73 68 61 6b 65 20 69 73  .if handshake is
28d0: 20 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65   still in progre
28e0: 73 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67  ss (non-blocking
28f0: 29 2c 20 6f 72 20 31 20 69 66 20 74 68 65 20 68  ), or 1 if the h
2900: 61 6e 64 73 68 61 6b 65 20 77 61 73 0a 73 75 63  andshake was.suc
2910: 63 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65 20  cessful. If the 
2920: 68 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65 64  handshake failed
2930: 2c 20 61 6e 20 65 72 72 6f 72 20 77 69 6c 6c 20  , an error will 
2940: 62 65 20 72 65 74 75 72 6e 65 64 2e 0a 0a 5b 63  be returned...[c
2950: 61 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 74  all [cmd tls::st
2960: 61 74 75 73 5d 20 5b 6f 70 74 20 5b 6f 70 74 69  atus] [opt [opti
2970: 6f 6e 20 2d 6c 6f 63 61 6c 5d 5d 20 5b 61 72 67  on -local]] [arg
2980: 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75   channel]]..Retu
2990: 72 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74 20  rns the current 
29a0: 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c  status of an SSL
29b0: 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65   channel. The re
29c0: 73 75 6c 74 20 69 73 20 61 20 6c 69 73 74 20 6f  sult is a list o
29d0: 66 20 6b 65 79 2d 76 61 6c 75 65 0a 70 61 69 72  f key-value.pair
29e0: 73 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 65  s describing the
29f0: 20 53 53 4c 2c 20 63 65 72 74 69 66 69 63 61 74   SSL, certificat
2a00: 65 2c 20 61 6e 64 20 63 65 72 74 69 66 69 63 61  e, and certifica
2a10: 74 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20  te verification 
2a20: 73 74 61 74 75 73 2e 20 49 66 0a 74 68 65 20 53  status. If.the S
2a30: 53 4c 20 68 61 6e 64 73 68 61 6b 65 20 68 61 73  SL handshake has
2a40: 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65 74   not yet complet
2a50: 65 64 2c 20 61 6e 20 65 6d 70 74 79 20 6c 69 73  ed, an empty lis
2a60: 74 20 69 73 20 72 65 74 75 72 6e 65 64 2e 20 49  t is returned. I
2a70: 66 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6c  f the.[option -l
2a80: 6f 63 61 6c 5d 20 6f 70 74 69 6f 6e 20 69 73 20  ocal] option is 
2a90: 73 70 65 63 69 66 69 65 64 2c 20 74 68 65 6e 20  specified, then 
2aa0: 74 68 65 20 6c 6f 63 61 6c 20 63 65 72 74 69 66  the local certif
2ab0: 69 63 61 74 65 20 69 73 20 75 73 65 64 2e 20 52  icate is used. R
2ac0: 65 74 75 72 6e 65 64 0a 76 61 6c 75 65 73 20 69  eturned.values i
2ad0: 6e 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a  nclude:..[para].
2ae0: 0a 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69  .SSL Status..[li
2af0: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
2b00: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61  ions]..[def "[va
2b10: 72 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70 72 6f  r alpn] [arg pro
2b20: 74 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70 72 6f  tocol]"].The pro
2b30: 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20 61  tocol selected a
2b40: 66 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f 6e  fter Application
2b50: 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20  -Layer Protocol 
2b60: 4e 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50  Negotiation (ALP
2b70: 4e 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  N)...[def "[var 
2b80: 63 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69 70  cipher] [arg cip
2b90: 68 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72 65  her]"].The curre
2ba0: 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75 73 65  nt cipher in use
2bb0: 20 66 6f 72 20 74 68 65 20 73 65 73 73 69 6f 6e   for the session
2bc0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 65  ...[def "[var pe
2bd0: 65 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d  ername] [arg nam
2be0: 65 5d 22 5d 0a 54 68 65 20 70 65 65 72 6e 61 6d  e]"].The peernam
2bf0: 65 20 66 72 6f 6d 20 74 68 65 20 63 65 72 74 69  e from the certi
2c00: 66 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b  ficate...[def "[
2c10: 76 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61  var protocol] [a
2c20: 72 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68  rg version]"].Th
2c30: 65 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69  e protocol versi
2c40: 6f 6e 20 75 73 65 64 20 66 6f 72 20 74 68 65 20  on used for the 
2c50: 63 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32  connection: SSL2
2c60: 2c 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c  , SSL3, TLS1, TL
2c70: 53 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c  S1.1, TLS1.2, TL
2c80: 53 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e  S1.3, or unknown
2c90: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 62  ...[def "[var sb
2ca0: 69 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 54  its] [arg n]"].T
2cb0: 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 69 74  he number of bit
2cc0: 73 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 73  s used for the s
2cd0: 65 73 73 69 6f 6e 20 6b 65 79 2e 0a 0a 5b 64 65  ession key...[de
2ce0: 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72  f "[var signatur
2cf0: 65 48 61 73 68 41 6c 67 6f 72 69 74 68 6d 5d 20  eHashAlgorithm] 
2d00: 5b 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22  [arg algorithm]"
2d10: 5d 0a 54 68 65 20 73 69 67 6e 61 74 75 72 65 20  ].The signature 
2d20: 68 61 73 68 20 61 6c 67 6f 72 69 74 68 6d 2e 0a  hash algorithm..
2d30: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e  .[def "[var sign
2d40: 61 74 75 72 65 54 79 70 65 5d 20 5b 61 72 67 20  atureType] [arg 
2d50: 74 79 70 65 5d 22 5d 0a 54 68 65 20 73 69 67 6e  type]"].The sign
2d60: 61 74 75 72 65 20 74 79 70 65 20 76 61 6c 75 65  ature type value
2d70: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65  ...[def "[var ve
2d80: 72 69 66 79 44 65 70 74 68 5d 20 5b 61 72 67 20  rifyDepth] [arg 
2d90: 6e 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20 64 65 70  n]"].Maximum dep
2da0: 74 68 20 66 6f 72 20 74 68 65 20 63 65 72 74 69  th for the certi
2db0: 66 69 63 61 74 65 20 63 68 61 69 6e 20 76 65 72  ficate chain ver
2dc0: 69 66 69 63 61 74 69 6f 6e 2e 20 44 65 66 61 75  ification. Defau
2dd0: 6c 74 20 69 73 20 2d 31 2c 20 74 6f 20 63 68 65  lt is -1, to che
2de0: 63 6b 20 61 6c 6c 2e 0a 0a 5b 64 65 66 20 22 5b  ck all...[def "[
2df0: 76 61 72 20 76 65 72 69 66 79 4d 6f 64 65 5d 20  var verifyMode] 
2e00: 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73  [arg list]"].Lis
2e10: 74 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65  t of certificate
2e20: 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 6d 6f   verification mo
2e30: 64 65 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  des...[def "[var
2e40: 20 76 65 72 69 66 79 52 65 73 75 6c 74 5d 20 5b   verifyResult] [
2e50: 61 72 67 20 72 65 73 75 6c 74 5d 22 5d 0a 43 65  arg result]"].Ce
2e60: 72 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69  rtificate verifi
2e70: 63 61 74 69 6f 6e 20 72 65 73 75 6c 74 2e 0a 0a  cation result...
2e80: 5b 64 65 66 20 22 5b 76 61 72 20 63 61 5f 6e 61  [def "[var ca_na
2e90: 6d 65 73 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22  mes] [arg list]"
2ea0: 5d 0a 4c 69 73 74 20 6f 66 20 74 68 65 20 43 65  ].List of the Ce
2eb0: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
2ec0: 69 74 69 65 73 20 75 73 65 64 20 74 6f 20 63 72  ities used to cr
2ed0: 65 61 74 65 20 74 68 65 20 63 65 72 74 69 66 69  eate the certifi
2ee0: 63 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  cate...[list_end
2ef0: 5d 0a 0a 43 65 72 74 69 66 69 63 61 74 65 20 53  ]..Certificate S
2f00: 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65 67  tatus..[list_beg
2f10: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
2f20: 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 6c 5d  .[def "[var all]
2f30: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
2f40: 44 75 6d 70 20 6f 66 20 61 6c 6c 20 63 65 72 74  Dump of all cert
2f50: 69 66 69 63 61 74 65 20 69 6e 66 6f 2e 0a 0a 5b  ificate info...[
2f60: 64 65 66 20 22 5b 76 61 72 20 76 65 72 73 69 6f  def "[var versio
2f70: 6e 5d 20 5b 61 72 67 20 76 61 6c 75 65 5d 22 5d  n] [arg value]"]
2f80: 0a 54 68 65 20 63 65 72 74 69 66 69 63 61 74 65  .The certificate
2f90: 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20   version...[def 
2fa0: 22 5b 76 61 72 20 73 65 72 69 61 6c 4e 75 6d 62  "[var serialNumb
2fb0: 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  er] [arg string]
2fc0: 22 5d 0a 54 68 65 20 73 65 72 69 61 6c 20 6e 75  "].The serial nu
2fd0: 6d 62 65 72 20 6f 66 20 74 68 65 20 63 65 72 74  mber of the cert
2fe0: 69 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78  ificate as a hex
2ff0: 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65 66 20 22   string...[def "
3000: 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65 5d 20  [var signature] 
3010: 5b 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22  [arg algorithm]"
3020: 5d 0a 43 69 70 68 65 72 20 61 6c 67 6f 72 69 74  ].Cipher algorit
3030: 68 6d 20 75 73 65 64 20 66 6f 72 20 63 65 72 74  hm used for cert
3040: 69 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72  ificate signatur
3050: 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 69  e...[def "[var i
3060: 73 73 75 65 72 5d 20 5b 61 72 67 20 73 74 72 69  ssuer] [arg stri
3070: 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73 74 69 6e  ng]"].The distin
3080: 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e  guished name (DN
3090: 29 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  ) of the certifi
30a0: 63 61 74 65 20 69 73 73 75 65 72 2e 0a 0a 5b 64  cate issuer...[d
30b0: 65 66 20 22 5b 76 61 72 20 6e 6f 74 42 65 66 6f  ef "[var notBefo
30c0: 72 65 5d 20 5b 61 72 67 20 64 61 74 65 5d 22 5d  re] [arg date]"]
30d0: 0a 54 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 64  .The beginning d
30e0: 61 74 65 20 6f 66 20 74 68 65 20 63 65 72 74 69  ate of the certi
30f0: 66 69 63 61 74 65 20 76 61 6c 69 64 69 74 79 2e  ficate validity.
3100: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6e 6f 74  ..[def "[var not
3110: 41 66 74 65 72 5d 20 5b 61 72 67 20 64 61 74 65  After] [arg date
3120: 5d 22 5d 0a 54 68 65 20 65 78 70 69 72 61 74 69  ]"].The expirati
3130: 6f 6e 20 64 61 74 65 20 6f 66 20 74 68 65 20 63  on date of the c
3140: 65 72 74 69 66 69 63 61 74 65 20 76 61 6c 69 64  ertificate valid
3150: 69 74 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ity...[def "[var
3160: 20 73 75 62 6a 65 63 74 5d 20 5b 61 72 67 20 73   subject] [arg s
3170: 74 72 69 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73  tring]"].The dis
3180: 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d 65 20  tinguished name 
3190: 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65 72 74  (DN) of the cert
31a0: 69 66 69 63 61 74 65 20 73 75 62 6a 65 63 74 2e  ificate subject.
31b0: 20 46 69 65 6c 64 73 20 69 6e 63 6c 75 64 65 3a   Fields include:
31c0: 20 43 6f 6d 6d 6f 6e 0a 4e 61 6d 65 20 28 43 4e   Common.Name (CN
31d0: 29 2c 20 4f 72 67 61 6e 69 7a 61 74 69 6f 6e 20  ), Organization 
31e0: 28 4f 29 2c 20 4c 6f 63 61 6c 69 74 79 20 6f 72  (O), Locality or
31f0: 20 43 69 74 79 20 28 4c 29 2c 20 53 74 61 74 65   City (L), State
3200: 20 6f 72 20 50 72 6f 76 69 6e 63 65 20 28 53 29   or Province (S)
3210: 2c 20 61 6e 64 0a 43 6f 75 6e 74 72 79 20 4e 61  , and.Country Na
3220: 6d 65 20 28 43 29 2e 0a 0a 5b 64 65 66 20 22 5b  me (C)...[def "[
3230: 76 61 72 20 69 73 73 75 65 72 55 6e 69 71 75 65  var issuerUnique
3240: 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d  ID] [arg string]
3250: 22 5d 0a 54 68 65 20 69 73 73 75 65 72 20 75 6e  "].The issuer un
3260: 69 71 75 65 20 69 64 2e 0a 0a 5b 64 65 66 20 22  ique id...[def "
3270: 5b 76 61 72 20 73 75 62 6a 65 63 74 55 6e 69 71  [var subjectUniq
3280: 75 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e  ueID] [arg strin
3290: 67 5d 22 5d 0a 54 68 65 20 73 75 62 6a 65 63 74  g]"].The subject
32a0: 20 75 6e 69 71 75 65 20 69 64 2e 0a 0a 5b 64 65   unique id...[de
32b0: 66 20 22 5b 76 61 72 20 6e 75 6d 5f 65 78 74 65  f "[var num_exte
32c0: 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6e 5d 22  nsions] [arg n]"
32d0: 5d 0a 4e 75 6d 62 65 72 20 6f 66 20 63 65 72 74  ].Number of cert
32e0: 69 66 69 63 61 74 65 20 65 78 74 65 6e 73 69 6f  ificate extensio
32f0: 6e 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ns...[def "[var 
3300: 65 78 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67  extensions] [arg
3310: 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66   list]"].List of
3320: 20 63 65 72 74 69 66 69 63 61 74 65 20 65 78 74   certificate ext
3330: 65 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e 0a 0a 5b  ension names...[
3340: 64 65 66 20 22 5b 76 61 72 20 61 75 74 68 6f 72  def "[var author
3350: 69 74 79 4b 65 79 49 64 65 6e 74 69 66 69 65 72  ityKeyIdentifier
3360: 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d  ] [arg string]"]
3370: 0a 41 75 74 68 6f 72 69 74 79 20 4b 65 79 20 49  .Authority Key I
3380: 64 65 6e 74 69 66 69 65 72 20 28 41 4b 49 29 20  dentifier (AKI) 
3390: 6f 66 20 74 68 65 20 49 73 73 75 69 6e 67 20 43  of the Issuing C
33a0: 41 20 63 65 72 74 69 66 69 63 61 74 65 20 74 68  A certificate th
33b0: 61 74 20 73 69 67 6e 65 64 20 74 68 65 0a 53 53  at signed the.SS
33c0: 4c 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73  L certificate as
33d0: 20 61 20 68 65 78 20 73 74 72 69 6e 67 2e 20 54   a hex string. T
33e0: 68 69 73 20 76 61 6c 75 65 20 6d 61 74 63 68 65  his value matche
33f0: 73 20 74 68 65 20 53 4b 49 20 76 61 6c 75 65 20  s the SKI value 
3400: 6f 66 20 74 68 65 0a 49 6e 74 65 72 6d 65 64 69  of the.Intermedi
3410: 61 74 65 20 43 41 20 63 65 72 74 69 66 69 63 61  ate CA certifica
3420: 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  te...[def "[var 
3430: 73 75 62 6a 65 63 74 4b 65 79 49 64 65 6e 74 69  subjectKeyIdenti
3440: 66 69 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e  fier] [arg strin
3450: 67 5d 22 5d 0a 53 75 62 6a 65 63 74 20 4b 65 79  g]"].Subject Key
3460: 20 49 64 65 6e 74 69 66 69 65 72 20 28 53 4b 49   Identifier (SKI
3470: 29 20 68 61 73 68 20 6f 66 20 74 68 65 20 70 75  ) hash of the pu
3480: 62 6c 69 63 20 6b 65 79 20 69 6e 73 69 64 65 20  blic key inside 
3490: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
34a0: 61 73 20 61 0a 68 65 78 20 73 74 72 69 6e 67 2e  as a.hex string.
34b0: 20 55 73 65 64 20 74 6f 20 69 64 65 6e 74 69 66   Used to identif
34c0: 79 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74  y certificates t
34d0: 68 61 74 20 63 6f 6e 74 61 69 6e 20 61 20 70 61  hat contain a pa
34e0: 72 74 69 63 75 6c 61 72 20 70 75 62 6c 69 63 20  rticular public 
34f0: 6b 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  key...[def "[var
3500: 20 73 75 62 6a 65 63 74 41 6c 74 4e 61 6d 65 5d   subjectAltName]
3510: 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69   [arg list]"].Li
3520: 73 74 20 6f 66 20 61 6c 6c 20 6f 66 20 74 68 65  st of all of the
3530: 20 53 75 62 6a 65 63 74 20 41 6c 74 65 72 6e 61   Subject Alterna
3540: 74 69 76 65 20 4e 61 6d 65 73 20 28 53 41 4e 29  tive Names (SAN)
3550: 20 69 6e 63 6c 75 64 69 6e 67 20 64 6f 6d 61 69   including domai
3560: 6e 20 6e 61 6d 65 73 2c 20 73 75 62 0a 64 6f 6d  n names, sub.dom
3570: 61 69 6e 73 2c 20 61 6e 64 20 49 50 20 61 64 64  ains, and IP add
3580: 72 65 73 73 65 73 20 74 68 61 74 20 61 72 65 20  resses that are 
3590: 73 65 63 75 72 65 64 20 62 79 20 74 68 65 20 63  secured by the c
35a0: 65 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65  ertificate...[de
35b0: 66 20 22 5b 76 61 72 20 6f 63 73 70 5d 20 5b 61  f "[var ocsp] [a
35c0: 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20  rg list]"].List 
35d0: 6f 66 20 61 6c 6c 20 4f 6e 6c 69 6e 65 20 43 65  of all Online Ce
35e0: 72 74 69 66 69 63 61 74 65 20 53 74 61 74 75 73  rtificate Status
35f0: 20 50 72 6f 74 6f 63 6f 6c 20 28 4f 43 53 50 29   Protocol (OCSP)
3600: 20 55 52 4c 73 20 74 68 61 74 20 63 61 6e 20 62   URLs that can b
3610: 65 20 75 73 65 64 20 74 6f 0a 63 68 65 63 6b 20  e used to.check 
3620: 74 68 65 20 76 61 6c 69 64 69 74 79 20 6f 66 20  the validity of 
3630: 74 68 69 73 20 63 65 72 74 69 66 69 63 61 74 65  this certificate
3640: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 65  ...[def "[var ce
3650: 72 74 69 66 69 63 61 74 65 5d 20 5b 61 72 67 20  rtificate] [arg 
3660: 63 65 72 74 5d 22 5d 0a 54 68 65 20 50 45 4d 20  cert]"].The PEM 
3670: 65 6e 63 6f 64 65 64 20 63 65 72 74 69 66 69 63  encoded certific
3680: 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ate...[def "[var
3690: 20 73 69 67 6e 61 74 75 72 65 41 6c 67 6f 72 69   signatureAlgori
36a0: 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69  thm] [arg algori
36b0: 74 68 6d 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c  thm]"].Cipher al
36c0: 67 6f 72 69 74 68 6d 20 75 73 65 64 20 66 6f 72  gorithm used for
36d0: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
36e0: 20 73 69 67 6e 61 74 75 72 65 2e 0a 0a 5b 64 65   signature...[de
36f0: 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72  f "[var signatur
3700: 65 56 61 6c 75 65 5d 20 5b 61 72 67 20 73 74 72  eValue] [arg str
3710: 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66 69 63 61  ing]"].Certifica
3720: 74 65 20 73 69 67 6e 61 74 75 72 65 20 61 73 20  te signature as 
3730: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b  a hex string...[
3740: 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74  def "[var signat
3750: 75 72 65 44 69 67 65 73 74 5d 20 5b 61 72 67 20  ureDigest] [arg 
3760: 76 65 72 73 69 6f 6e 5d 22 5d 0a 43 65 72 74 69  version]"].Certi
3770: 66 69 63 61 74 65 20 73 69 67 6e 69 6e 67 20 64  ficate signing d
3780: 69 67 65 73 74 20 61 73 20 61 20 68 65 78 20 73  igest as a hex s
3790: 74 72 69 6e 67 2e 0a 0a 5b 64 65 66 20 22 5b 76  tring...[def "[v
37a0: 61 72 20 70 75 62 6c 69 63 4b 65 79 41 6c 67 6f  ar publicKeyAlgo
37b0: 72 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f  rithm] [arg algo
37c0: 72 69 74 68 6d 5d 22 5d 0a 43 65 72 74 69 66 69  rithm]"].Certifi
37d0: 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 70  cate signature p
37e0: 75 62 6c 69 63 20 6b 65 79 20 61 6c 67 6f 72 69  ublic key algori
37f0: 74 68 6d 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  thm...[def "[var
3800: 20 70 75 62 6c 69 63 4b 65 79 5d 20 5b 61 72 67   publicKey] [arg
3810: 20 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74 69   string]"].Certi
3820: 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65  ficate signature
3830: 20 70 75 62 6c 69 63 20 6b 65 79 20 61 73 20 61   public key as a
3840: 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64   hex string...[d
3850: 65 66 20 22 5b 76 61 72 20 62 69 74 73 5d 20 5b  ef "[var bits] [
3860: 61 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65 72 20  arg n]"].Number 
3870: 6f 66 20 62 69 74 73 20 75 73 65 64 20 66 6f 72  of bits used for
3880: 20 63 65 72 74 69 66 69 63 61 74 65 20 73 69 67   certificate sig
3890: 6e 61 74 75 72 65 20 6b 65 79 2e 0a 0a 5b 64 65  nature key...[de
38a0: 66 20 22 5b 76 61 72 20 73 65 6c 66 5f 73 69 67  f "[var self_sig
38b0: 6e 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61  ned] [arg boolea
38c0: 6e 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65  n]"].Whether the
38d0: 20 63 65 72 74 69 66 69 63 61 74 65 20 73 69 67   certificate sig
38e0: 6e 61 74 75 72 65 20 69 73 20 73 65 6c 66 20 73  nature is self s
38f0: 69 67 6e 65 64 2e 0a 0a 5b 64 65 66 20 22 5b 76  igned...[def "[v
3900: 61 72 20 73 68 61 31 5f 68 61 73 68 5d 20 5b 61  ar sha1_hash] [a
3910: 72 67 20 68 61 73 68 5d 22 5d 0a 54 68 65 20 53  rg hash]"].The S
3920: 48 41 31 20 68 61 73 68 20 6f 66 20 74 68 65 20  HA1 hash of the 
3930: 63 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61  certificate as a
3940: 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64   hex string...[d
3950: 65 66 20 22 5b 76 61 72 20 73 68 61 32 35 36 5f  ef "[var sha256_
3960: 68 61 73 68 5d 20 5b 61 72 67 20 68 61 73 68 5d  hash] [arg hash]
3970: 22 5d 0a 54 68 65 20 53 48 41 32 35 36 20 68 61  "].The SHA256 ha
3980: 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  sh of the certif
3990: 69 63 61 74 65 20 61 73 20 61 20 68 65 78 20 73  icate as a hex s
39a0: 74 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f 65 6e  tring...[list_en
39b0: 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  d]..[call [cmd t
39c0: 6c 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5d 20  ls::connection] 
39d0: 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a  [arg channel]]..
39e0: 52 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72  Returns the curr
39f0: 65 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73  ent connection s
3a00: 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20  tatus of an SSL 
3a10: 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73  channel. The res
3a20: 75 6c 74 20 69 73 20 61 20 6c 69 73 74 0a 6f 66  ult is a list.of
3a30: 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73   key-value pairs
3a40: 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20   describing the 
3a50: 63 6f 6e 6e 65 63 74 69 6f 6e 2e 20 52 65 74 75  connection. Retu
3a60: 72 6e 65 64 20 76 61 6c 75 65 73 20 69 6e 63 6c  rned values incl
3a70: 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a 53 53  ude:..[para]..SS
3a80: 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f  L Status..[list_
3a90: 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e  begin definition
3aa0: 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  s]..[def "[var s
3ab0: 74 61 74 65 5d 20 5b 61 72 67 20 73 74 61 74 65  tate] [arg state
3ac0: 5d 22 5d 0a 53 74 61 74 65 20 6f 66 20 74 68 65  ]"].State of the
3ad0: 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64   connection...[d
3ae0: 65 66 20 22 5b 76 61 72 20 73 65 72 76 65 72 6e  ef "[var servern
3af0: 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22  ame] [arg name]"
3b00: 5d 0a 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68  ].The name of th
3b10: 65 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 73  e connected to s
3b20: 65 72 76 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76  erver...[def "[v
3b30: 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72  ar protocol] [ar
3b40: 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65  g version]"].The
3b50: 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f   protocol versio
3b60: 6e 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63  n used for the c
3b70: 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c  onnection: SSL2,
3b80: 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53   SSL3, TLS1, TLS
3b90: 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53  1.1, TLS1.2, TLS
3ba0: 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e  1.3, or unknown.
3bb0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 6e  ..[def "[var ren
3bc0: 65 67 6f 74 69 61 74 69 6f 6e 5f 61 6c 6c 6f 77  egotiation_allow
3bd0: 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e  ed] [arg boolean
3be0: 5d 22 5d 0a 57 68 65 74 68 65 72 20 70 72 6f 74  ]"].Whether prot
3bf0: 6f 63 6f 6c 20 72 65 6e 65 67 6f 74 69 61 74 69  ocol renegotiati
3c00: 6f 6e 20 69 73 20 73 75 70 70 6f 72 74 65 64 20  on is supported 
3c10: 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b  or not...[def "[
3c20: 76 61 72 20 73 65 63 75 72 69 74 79 5f 6c 65 76  var security_lev
3c30: 65 6c 5d 20 5b 61 72 67 20 6c 65 76 65 6c 5d 22  el] [arg level]"
3c40: 5d 0a 54 68 65 20 73 65 63 75 72 69 74 79 20 6c  ].The security l
3c50: 65 76 65 6c 20 75 73 65 64 20 66 6f 72 20 73 65  evel used for se
3c60: 6c 65 63 74 69 6f 6e 20 6f 66 20 63 69 70 68 65  lection of ciphe
3c70: 72 73 2c 20 6b 65 79 20 73 69 7a 65 2c 20 65 74  rs, key size, et
3c80: 63 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  c...[def "[var s
3c90: 65 73 73 69 6f 6e 5f 72 65 75 73 65 64 5d 20 5b  ession_reused] [
3ca0: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57  arg boolean]"].W
3cb0: 68 65 74 68 65 72 20 74 68 65 20 73 65 73 73 69  hether the sessi
3cc0: 6f 6e 20 68 61 73 20 62 65 65 6e 20 72 65 75 73  on has been reus
3cd0: 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66  ed or not...[def
3ce0: 20 22 5b 76 61 72 20 69 73 5f 73 65 72 76 65 72   "[var is_server
3cf0: 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22  ] [arg boolean]"
3d00: 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 63 6f  ].Whether the co
3d10: 6e 6e 65 63 74 69 6f 6e 20 69 73 20 63 6f 6e 66  nnection is conf
3d20: 69 67 75 72 65 64 20 61 73 20 61 20 73 65 72 76  igured as a serv
3d30: 65 72 20 28 31 29 20 6f 72 20 63 6c 69 65 6e 74  er (1) or client
3d40: 20 28 30 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61   (0)...[def "[va
3d50: 72 20 63 6f 6d 70 72 65 73 73 69 6f 6e 5d 20 5b  r compression] [
3d60: 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 43 6f 6d 70  arg mode]"].Comp
3d70: 72 65 73 73 69 6f 6e 20 6d 65 74 68 6f 64 2e 0a  ression method..
3d80: 0a 5b 64 65 66 20 22 5b 76 61 72 20 65 78 70 61  .[def "[var expa
3d90: 6e 73 69 6f 6e 5d 20 5b 61 72 67 20 6d 6f 64 65  nsion] [arg mode
3da0: 5d 22 5d 0a 45 78 70 61 6e 73 69 6f 6e 20 6d 65  ]"].Expansion me
3db0: 74 68 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  thod...[def "[va
3dc0: 72 20 63 61 4c 69 73 74 5d 20 5b 61 72 67 20 6c  r caList] [arg l
3dd0: 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 43  ist]"].List of C
3de0: 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f  ertificate Autho
3df0: 72 69 74 69 65 73 20 28 43 41 29 20 66 6f 72 20  rities (CA) for 
3e00: 58 2e 35 30 39 20 63 65 72 74 69 66 69 63 61 74  X.509 certificat
3e10: 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a  e...[list_end]..
3e20: 43 69 70 68 65 72 20 49 6e 66 6f 0a 0a 5b 6c 69  Cipher Info..[li
3e30: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
3e40: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61  ions]..[def "[va
3e50: 72 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20 63  r cipher] [arg c
3e60: 69 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75 72  ipher]"].The cur
3e70: 72 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75  rent cipher in u
3e80: 73 65 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65  se for the conne
3e90: 63 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76  ction...[def "[v
3ea0: 61 72 20 73 74 61 6e 64 61 72 64 5f 6e 61 6d 65  ar standard_name
3eb0: 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54  ] [arg name]"].T
3ec0: 68 65 20 73 74 61 6e 64 61 72 64 20 52 46 43 20  he standard RFC 
3ed0: 6e 61 6d 65 20 6f 66 20 63 69 70 68 65 72 2e 0a  name of cipher..
3ee0: 0a 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 67 6f  .[def "[var algo
3ef0: 72 69 74 68 6d 5f 62 69 74 73 5d 20 5b 61 72 67  rithm_bits] [arg
3f00: 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72   n]"].The number
3f10: 20 6f 66 20 70 72 6f 63 65 73 73 65 64 20 62 69   of processed bi
3f20: 74 73 20 75 73 65 64 20 66 6f 72 20 63 69 70 68  ts used for ciph
3f30: 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  er...[def "[var 
3f40: 73 65 63 72 65 74 5f 62 69 74 73 5d 20 5b 61 72  secret_bits] [ar
3f50: 67 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65  g n]"].The numbe
3f60: 72 20 6f 66 20 73 65 63 72 65 74 20 62 69 74 73  r of secret bits
3f70: 20 75 73 65 64 20 66 6f 72 20 63 69 70 68 65 72   used for cipher
3f80: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6d 69  ...[def "[var mi
3f90: 6e 5f 76 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20  n_version] [arg 
3fa0: 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 6d  version]"].The m
3fb0: 69 6e 69 6d 75 6d 20 70 72 6f 74 6f 63 6f 6c 20  inimum protocol 
3fc0: 76 65 72 73 69 6f 6e 20 66 6f 72 20 63 69 70 68  version for ciph
3fd0: 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  er...[def "[var 
3fe0: 63 69 70 68 65 72 5f 69 73 5f 61 65 61 64 5d 20  cipher_is_aead] 
3ff0: 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a  [arg boolean]"].
4000: 57 68 65 74 68 65 72 20 74 68 65 20 63 69 70 68  Whether the ciph
4010: 65 72 20 69 73 20 41 75 74 68 65 6e 74 69 63 61  er is Authentica
4020: 74 65 64 20 45 6e 63 72 79 70 74 69 6f 6e 20 77  ted Encryption w
4030: 69 74 68 20 41 73 73 6f 63 69 61 74 65 64 20 44  ith Associated D
4040: 61 74 61 20 28 41 45 41 44 29 2e 0a 0a 5b 64 65  ata (AEAD)...[de
4050: 66 20 22 5b 76 61 72 20 63 69 70 68 65 72 5f 69  f "[var cipher_i
4060: 64 5d 20 5b 61 72 67 20 69 64 5d 22 5d 0a 54 68  d] [arg id]"].Th
4070: 65 20 4f 70 65 6e 53 53 4c 20 63 69 70 68 65 72  e OpenSSL cipher
4080: 20 69 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72   id...[def "[var
4090: 20 64 65 73 63 72 69 70 74 69 6f 6e 5d 20 5b 61   description] [a
40a0: 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 41 20 74  rg string]"].A t
40b0: 65 78 74 20 64 65 73 63 72 69 70 74 69 6f 6e 20  ext description 
40c0: 6f 66 20 74 68 65 20 63 69 70 68 65 72 2e 0a 0a  of the cipher...
40d0: 5b 64 65 66 20 22 5b 76 61 72 20 68 61 6e 64 73  [def "[var hands
40e0: 68 61 6b 65 5f 64 69 67 65 73 74 5d 20 5b 61 72  hake_digest] [ar
40f0: 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 44 69 67  g boolean]"].Dig
4100: 65 73 74 20 75 73 65 64 20 64 75 72 69 6e 67 20  est used during 
4110: 68 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b 6c 69 73  handshake...[lis
4120: 74 5f 65 6e 64 5d 0a 0a 53 65 73 73 69 6f 6e 20  t_end]..Session 
4130: 49 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  Info..[list_begi
4140: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a  n definitions]..
4150: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d  [def "[var alpn]
4160: 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22   [arg protocol]"
4170: 5d 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73  ].The protocol s
4180: 65 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70  elected after Ap
4190: 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20  plication-Layer 
41a0: 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61  Protocol Negotia
41b0: 74 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a 0a 5b 64  tion (ALPN)...[d
41c0: 65 66 20 22 5b 76 61 72 20 72 65 73 75 6d 61 62  ef "[var resumab
41d0: 6c 65 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e  le] [arg boolean
41e0: 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20  ]"].Whether the 
41f0: 73 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 72  session can be r
4200: 65 73 75 6d 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a  esumed or not...
4210: 5b 64 65 66 20 22 5b 76 61 72 20 73 74 61 72 74  [def "[var start
4220: 5f 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63 6f  _time] [arg seco
4230: 6e 64 73 5d 22 5d 0a 54 69 6d 65 20 73 69 6e 63  nds]"].Time sinc
4240: 65 20 73 65 73 73 69 6f 6e 20 73 74 61 72 74 65  e session starte
4250: 64 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e  d in seconds sin
4260: 63 65 20 65 70 6f 63 68 2e 0a 0a 5b 64 65 66 20  ce epoch...[def 
4270: 22 5b 76 61 72 20 74 69 6d 65 6f 75 74 5d 20 5b  "[var timeout] [
4280: 61 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 4d  arg seconds]"].M
4290: 61 78 20 64 75 72 61 74 69 6f 6e 20 6f 66 20 73  ax duration of s
42a0: 65 73 73 69 6f 6e 20 69 6e 20 73 65 63 6f 6e 64  ession in second
42b0: 73 20 62 65 66 6f 72 65 20 74 69 6d 65 2d 6f 75  s before time-ou
42c0: 74 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6c  t...[def "[var l
42d0: 69 66 65 74 69 6d 65 5d 20 5b 61 72 67 20 73 65  ifetime] [arg se
42e0: 63 6f 6e 64 73 5d 22 5d 0a 53 65 73 73 69 6f 6e  conds]"].Session
42f0: 20 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65   ticket lifetime
4300: 20 68 69 6e 74 20 69 6e 20 73 65 63 6f 6e 64 73   hint in seconds
4310: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
4320: 73 73 69 6f 6e 5f 69 64 5d 20 5b 61 72 67 20 62  ssion_id] [arg b
4330: 69 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a  inary_string]"].
4340: 55 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20 69  Unique session i
4350: 64 20 66 6f 72 20 75 73 65 20 69 6e 20 72 65 73  d for use in res
4360: 75 6d 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f  uming the sessio
4370: 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  n...[def "[var s
4380: 65 73 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 20 5b  ession_ticket] [
4390: 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e  arg binary_strin
43a0: 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73  g]"].Unique sess
43b0: 69 6f 6e 20 74 69 63 6b 65 74 20 66 6f 72 20 75  ion ticket for u
43c0: 73 65 20 69 6e 20 72 65 73 75 6d 69 6e 67 20 74  se in resuming t
43d0: 68 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65  he session...[de
43e0: 66 20 22 5b 76 61 72 20 74 69 63 6b 65 74 5f 61  f "[var ticket_a
43f0: 70 70 5f 64 61 74 61 5d 20 5b 61 72 67 20 62 69  pp_data] [arg bi
4400: 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55  nary_string]"].U
4410: 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20 74 69  nique session ti
4420: 63 6b 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e  cket application
4430: 20 64 61 74 61 2e 0a 0a 5b 64 65 66 20 22 5b 76   data...[def "[v
4440: 61 72 20 6d 61 73 74 65 72 5f 6b 65 79 5d 20 5b  ar master_key] [
4450: 61 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e  arg binary_strin
4460: 67 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73  g]"].Unique sess
4470: 69 6f 6e 20 6d 61 73 74 65 72 20 6b 65 79 2e 0a  ion master key..
4480: 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 73  .[def "[var sess
4490: 69 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64 65 5d 20  ion_cache_mode] 
44a0: 5b 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 53 65 72  [arg mode]"].Ser
44b0: 76 65 72 20 63 61 63 68 65 20 6d 6f 64 65 20 28  ver cache mode (
44c0: 63 6c 69 65 6e 74 2c 20 73 65 72 76 65 72 2c 20  client, server, 
44d0: 6f 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c 69 73 74  or both)...[list
44e0: 5f 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  _end]..[call [cm
44f0: 64 20 74 6c 73 3a 3a 63 69 70 68 65 72 73 5d 20  d tls::ciphers] 
4500: 5b 6f 70 74 20 5b 61 72 67 20 70 72 6f 74 6f 63  [opt [arg protoc
4510: 6f 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76  ol]] [opt [arg v
4520: 65 72 62 6f 73 65 5d 5d 20 5b 6f 70 74 20 5b 61  erbose]] [opt [a
4530: 72 67 20 73 75 70 70 6f 72 74 65 64 5d 5d 5d 0a  rg supported]]].
4540: 0a 57 69 74 68 6f 75 74 20 61 6e 79 20 61 72 67  .Without any arg
4550: 73 2c 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73  s, returns a lis
4560: 74 20 6f 66 20 61 6c 6c 20 73 79 6d 6d 65 74 72  t of all symmetr
4570: 69 63 20 63 69 70 68 65 72 73 20 66 6f 72 20 75  ic ciphers for u
4580: 73 65 20 77 69 74 68 20 74 68 65 0a 5b 61 72 67  se with the.[arg
4590: 20 2d 63 69 70 68 65 72 5d 20 6f 70 74 69 6f 6e   -cipher] option
45a0: 2e 20 57 69 74 68 20 5b 61 72 67 20 70 72 6f 74  . With [arg prot
45b0: 6f 63 6f 6c 5d 2c 20 6f 6e 6c 79 20 74 68 65 20  ocol], only the 
45c0: 63 69 70 68 65 72 73 20 73 75 70 70 6f 72 74 65  ciphers supporte
45d0: 64 20 66 6f 72 20 74 68 61 74 0a 70 72 6f 74 6f  d for that.proto
45e0: 63 6f 6c 20 61 72 65 20 72 65 74 75 72 6e 65 64  col are returned
45f0: 2e 20 53 65 65 20 74 68 65 20 5b 63 6d 64 20 74  . See the [cmd t
4600: 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63  ls::protocols] c
4610: 6f 6d 6d 61 6e 64 20 66 6f 72 20 74 68 65 20 73  ommand for the s
4620: 75 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f  upported.protoco
4630: 6c 73 2e 20 49 66 20 5b 61 72 67 20 76 65 72 62  ls. If [arg verb
4640: 6f 73 65 5d 20 69 73 20 73 70 65 63 69 66 69 65  ose] is specifie
4650: 64 20 61 73 20 74 72 75 65 20 74 68 65 6e 20 61  d as true then a
4660: 20 76 65 72 62 6f 73 65 2c 20 68 75 6d 61 6e 20   verbose, human 
4670: 72 65 61 64 61 62 6c 65 0a 6c 69 73 74 20 69 73  readable.list is
4680: 20 72 65 74 75 72 6e 65 64 20 77 69 74 68 20 61   returned with a
4690: 64 64 69 74 69 6f 6e 61 6c 20 69 6e 66 6f 72 6d  dditional inform
46a0: 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 63 69 70  ation on the cip
46b0: 68 65 72 2e 20 49 66 20 5b 61 72 67 20 73 75 70  her. If [arg sup
46c0: 70 6f 72 74 65 64 5d 0a 69 73 20 73 70 65 63 69  ported].is speci
46d0: 66 69 65 64 20 61 73 20 74 72 75 65 2c 20 74 68  fied as true, th
46e0: 65 6e 20 6f 6e 6c 79 20 74 68 65 20 63 69 70 68  en only the ciph
46f0: 65 72 73 20 73 75 70 70 6f 72 74 65 64 20 66 6f  ers supported fo
4700: 72 20 70 72 6f 74 6f 63 6f 6c 20 77 69 6c 6c 20  r protocol will 
4710: 62 65 20 6c 69 73 74 65 64 2e 0a 0a 5b 63 61 6c  be listed...[cal
4720: 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74  l [cmd tls::prot
4730: 6f 63 6f 6c 73 5d 5d 0a 0a 52 65 74 75 72 6e 73  ocols]]..Returns
4740: 20 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 73   a list of the s
4750: 75 70 70 6f 72 74 65 64 20 53 53 4c 2f 54 4c 53  upported SSL/TLS
4760: 20 70 72 6f 74 6f 63 6f 6c 73 2e 20 56 61 6c 69   protocols. Vali
4770: 64 20 76 61 6c 75 65 73 20 61 72 65 3a 0a 5b 63  d values are:.[c
4780: 6f 6e 73 74 20 73 73 6c 32 5d 2c 20 5b 63 6f 6e  onst ssl2], [con
4790: 73 74 20 73 73 6c 33 5d 2c 20 5b 63 6f 6e 73 74  st ssl3], [const
47a0: 20 74 6c 73 31 5d 2c 20 5b 63 6f 6e 73 74 20 74   tls1], [const t
47b0: 6c 73 31 2e 31 5d 2c 20 5b 63 6f 6e 73 74 20 74  ls1.1], [const t
47c0: 6c 73 31 2e 32 5d 2c 20 61 6e 64 0a 5b 63 6f 6e  ls1.2], and.[con
47d0: 73 74 20 74 6c 73 31 2e 33 5d 2e 20 45 78 61 63  st tls1.3]. Exac
47e0: 74 20 6c 69 73 74 20 64 65 70 65 6e 64 73 20 6f  t list depends o
47f0: 6e 20 4f 70 65 6e 53 53 4c 20 76 65 72 73 69 6f  n OpenSSL versio
4800: 6e 20 61 6e 64 20 63 6f 6d 70 69 6c 65 20 74 69  n and compile ti
4810: 6d 65 20 66 6c 61 67 73 2e 0a 0a 5b 63 61 6c 6c  me flags...[call
4820: 20 5b 63 6d 64 20 74 6c 73 3a 3a 76 65 72 73 69   [cmd tls::versi
4830: 6f 6e 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68  on]]..Returns th
4840: 65 20 4f 70 65 6e 53 53 4c 20 76 65 72 73 69 6f  e OpenSSL versio
4850: 6e 20 73 74 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74  n string...[list
4860: 5f 65 6e 64 5d 0a 0a 0a 5b 73 65 63 74 69 6f 6e  _end]...[section
4870: 20 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61   "Certificate Va
4880: 6c 69 64 61 74 69 6f 6e 22 5d 0a 0a 5b 73 75 62  lidation"]..[sub
4890: 73 65 63 74 69 6f 6e 20 22 53 75 6d 6d 61 72 79  section "Summary
48a0: 20 6f 66 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65   of command line
48b0: 20 6f 70 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 20   options"]..The 
48c0: 66 6f 6c 6c 6f 77 69 6e 67 20 6f 70 74 69 6f 6e  following option
48d0: 73 20 61 72 65 20 75 73 65 64 20 66 6f 72 20 70  s are used for p
48e0: 65 65 72 20 43 65 72 74 69 66 69 63 61 74 65 20  eer Certificate 
48f0: 56 61 6c 69 64 61 74 69 6f 6e 3a 0a 0a 5b 6c 69  Validation:..[li
4900: 73 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73  st_begin options
4910: 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64  ]..[opt_def -cad
4920: 69 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72  ir [arg director
4930: 79 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68  y]].Specifies th
4940: 65 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72  e directory wher
4950: 65 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74  e the Certificat
4960: 65 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29  e Authority (CA)
4970: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72   certificates ar
4980: 65 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65  e.stored. The de
4990: 66 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72  fault is platfor
49a0: 6d 20 73 70 65 63 69 66 69 63 2c 20 62 75 74 20  m specific, but 
49b0: 69 73 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65  is usually [file
49c0: 20 22 2f 65 74 63 2f 73 73 6c 2f 63 65 72 74 73   "/etc/ssl/certs
49d0: 22 5d 20 6f 6e 0a 4c 69 6e 75 78 2f 55 6e 69 78  "] on.Linux/Unix
49e0: 20 73 79 73 74 65 6d 73 2e 20 54 68 65 20 64 65   systems. The de
49f0: 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63  fault location c
4a00: 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e  an be overridden
4a10: 20 62 79 20 74 68 65 0a 5b 76 61 72 20 53 53 4c   by the.[var SSL
4a20: 5f 43 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72  _CERT_DIR] envir
4a30: 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 2e  onment variable.
4a40: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 66 69  ..[opt_def -cafi
4a50: 6c 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65  le [arg filename
4a60: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
4a70: 20 66 69 6c 65 20 77 69 74 68 20 74 68 65 20 43   file with the C
4a80: 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f  ertificate Autho
4a90: 72 69 74 79 20 28 43 41 29 20 63 65 72 74 69 66  rity (CA) certif
4aa0: 69 63 61 74 65 73 20 74 6f 20 75 73 65 20 69 6e  icates to use in
4ab0: 0a 5b 63 6f 6e 73 74 20 50 45 4d 5d 20 66 69 6c  .[const PEM] fil
4ac0: 65 20 66 6f 72 6d 61 74 2e 20 54 68 65 20 64 65  e format. The de
4ad0: 66 61 75 6c 74 20 69 73 20 5b 66 69 6c 65 20 63  fault is [file c
4ae0: 65 72 74 2e 70 65 6d 5d 2c 20 69 6e 20 74 68 65  ert.pem], in the
4af0: 20 4f 70 65 6e 53 53 4c 20 64 69 72 65 63 74 6f   OpenSSL directo
4b00: 72 79 2e 20 4f 6e 0a 4c 69 6e 75 78 2f 55 6e 69  ry. On.Linux/Uni
4b10: 78 20 73 79 73 74 65 6d 73 2c 20 74 68 69 73 20  x systems, this 
4b20: 69 73 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65  is usually [file
4b30: 20 2f 65 74 63 2f 73 73 6c 2f 63 61 2d 62 75 6e   /etc/ssl/ca-bun
4b40: 64 6c 65 2e 70 65 6d 5d 2e 20 54 68 65 20 64 65  dle.pem]. The de
4b50: 66 61 75 6c 74 20 66 69 6c 65 0a 63 61 6e 20 62  fault file.can b
4b60: 65 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20  e overridden by 
4b70: 74 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52  the [var SSL_CER
4b80: 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d  T_FILE] environm
4b90: 65 6e 74 20 76 61 72 69 61 62 6c 65 2e 0a 0a 5b  ent variable...[
4ba0: 6f 70 74 5f 64 65 66 20 2d 63 61 73 74 6f 72 65  opt_def -castore
4bb0: 20 5b 61 72 67 20 55 52 49 5d 5d 0a 53 70 65 63   [arg URI]].Spec
4bc0: 69 66 69 65 73 20 74 68 65 20 55 6e 69 66 6f 72  ifies the Unifor
4bd0: 6d 20 52 65 73 6f 75 72 63 65 20 49 64 65 6e 74  m Resource Ident
4be0: 69 66 69 65 72 20 28 55 52 49 29 20 66 6f 72 20  ifier (URI) for 
4bf0: 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20  the Certificate 
4c00: 41 75 74 68 6f 72 69 74 79 0a 28 43 41 29 20 73  Authority.(CA) s
4c10: 74 6f 72 65 2c 20 77 68 69 63 68 20 6d 61 79 20  tore, which may 
4c20: 62 65 20 61 20 73 69 6e 67 6c 65 20 63 6f 6e 74  be a single cont
4c30: 61 69 6e 65 72 20 6f 72 20 61 20 63 61 74 61 6c  ainer or a catal
4c40: 6f 67 20 6f 66 20 63 6f 6e 74 61 69 6e 65 72 73  og of containers
4c50: 2e 0a 53 74 61 72 74 69 6e 67 20 77 69 74 68 20  ..Starting with 
4c60: 4f 70 65 6e 53 53 4c 20 33 2e 32 20 6f 6e 20 57  OpenSSL 3.2 on W
4c70: 69 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20 22  indows, set to "
4c80: 5b 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e  [const "org.open
4c90: 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22  ssl.winstore://"
4ca0: 5d 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62 75  ]".to use the bu
4cb0: 69 6c 74 2d 69 6e 20 57 69 6e 64 6f 77 73 20 43  ilt-in Windows C
4cc0: 65 72 74 69 66 69 63 61 74 65 20 53 74 6f 72 65  ertificate Store
4cd0: 2e 20 54 68 69 73 20 73 74 6f 72 65 20 6f 6e 6c  . This store onl
4ce0: 79 20 73 75 70 70 6f 72 74 73 20 72 6f 6f 74 0a  y supports root.
4cf0: 63 65 72 74 69 66 69 63 61 74 65 20 73 74 6f 72  certificate stor
4d00: 65 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72  es...[opt_def -r
4d10: 65 71 75 65 73 74 20 5b 61 72 67 20 62 6f 6f 6c  equest [arg bool
4d20: 5d 5d 0a 52 65 71 75 65 73 74 20 61 20 63 65 72  ]].Request a cer
4d30: 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 70 65  tificate from pe
4d40: 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53  er during the SS
4d50: 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 69  L handshake. Thi
4d60: 73 20 69 73 20 6e 65 65 64 65 64 20 74 6f 20 64  s is needed to d
4d70: 6f 0a 43 65 72 74 69 66 69 63 61 74 65 20 56 61  o.Certificate Va
4d80: 6c 69 64 61 74 69 6f 6e 2e 20 44 65 66 61 75 6c  lidation. Defaul
4d90: 74 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65  t is [const true
4da0: 5d 2e 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20  ]. In addition, 
4db0: 74 68 65 0a 63 6c 69 65 6e 74 20 63 61 6e 20 6d  the.client can m
4dc0: 61 6e 75 61 6c 6c 79 20 69 6e 73 70 65 63 74 20  anually inspect 
4dd0: 61 6e 64 20 61 63 63 65 70 74 20 6f 72 20 72 65  and accept or re
4de0: 6a 65 63 74 20 65 61 63 68 20 63 65 72 74 69 66  ject each certif
4df0: 69 63 61 74 65 20 75 73 69 6e 67 20 74 68 65 0a  icate using the.
4e00: 5b 61 72 67 20 2d 76 61 6c 69 64 61 74 65 63 6f  [arg -validateco
4e10: 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 2e 0a 0a  mmand] option...
4e20: 5b 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 69 72  [opt_def -requir
4e30: 65 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65  e [arg bool]].Re
4e40: 71 75 69 72 65 20 61 20 76 61 6c 69 64 20 63 65  quire a valid ce
4e50: 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 70  rtificate from p
4e60: 65 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53  eer during the S
4e70: 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66  SL handshake. If
4e80: 20 74 68 69 73 20 69 73 20 73 65 74 0a 74 6f 20   this is set.to 
4e90: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2c 20 74 68  [const true], th
4ea0: 65 6e 20 5b 61 72 67 20 2d 72 65 71 75 65 73 74  en [arg -request
4eb0: 5d 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 20 73  ] must also be s
4ec0: 65 74 20 74 6f 20 5b 63 6f 6e 73 74 20 74 72 75  et to [const tru
4ed0: 65 5d 20 61 6e 64 20 65 69 74 68 65 72 0a 5b 61  e] and either.[a
4ee0: 72 67 20 2d 63 61 64 69 72 5d 2c 20 5b 61 72 67  rg -cadir], [arg
4ef0: 20 2d 63 61 66 69 6c 65 5d 2c 20 5b 61 72 67 20   -cafile], [arg 
4f00: 2d 63 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20  -castore], or a 
4f10: 70 6c 61 74 66 6f 72 6d 20 64 65 66 61 75 6c 74  platform default
4f20: 20 6d 75 73 74 20 62 65 0a 70 72 6f 76 69 64 65   must be.provide
4f30: 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 76 61  d in order to va
4f40: 6c 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20  lidate against. 
4f50: 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b  The default is [
4f60: 63 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e  const false] sin
4f70: 63 65 20 6e 6f 74 0a 61 6c 6c 20 70 6c 61 74 66  ce not.all platf
4f80: 6f 72 6d 73 20 68 61 76 65 20 63 65 72 74 69 66  orms have certif
4f90: 69 63 61 74 65 73 20 74 6f 20 76 61 6c 69 64 61  icates to valida
4fa0: 74 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20  te against in a 
4fb0: 66 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20  form compatible 
4fc0: 77 69 74 68 0a 4f 70 65 6e 53 53 4c 2e 20 53 65  with.OpenSSL. Se
4fd0: 65 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74  e [sectref "Cert
4fe0: 69 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69  ificate Validati
4ff0: 6f 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65  on"] for more de
5000: 74 61 69 6c 73 2e 0a 0a 5b 6c 69 73 74 5f 65 6e  tails...[list_en
5010: 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20  d]..[subsection 
5020: 22 57 68 65 6e 20 61 72 65 20 63 6f 6d 6d 61 6e  "When are comman
5030: 64 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 73 20 6e  d line options n
5040: 65 65 64 65 64 3f 22 5d 0a 0a 42 79 20 64 65 66  eeded?"]..By def
5050: 61 75 6c 74 2c 20 61 20 63 6c 69 65 6e 74 20 54  ault, a client T
5060: 4c 53 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 64 6f  LS connection do
5070: 65 73 20 5b 65 6d 70 68 20 4e 4f 54 5d 20 76 61  es [emph NOT] va
5080: 6c 69 64 61 74 65 20 74 68 65 20 73 65 72 76 65  lidate the serve
5090: 72 20 63 65 72 74 69 66 69 63 61 74 65 0a 63 68  r certificate.ch
50a0: 61 69 6e 2e 20 54 68 69 73 20 6c 69 6d 69 74 61  ain. This limita
50b0: 74 69 6f 6e 20 69 73 20 64 75 65 20 74 6f 20 74  tion is due to t
50c0: 68 65 20 6c 61 63 6b 20 6f 66 20 61 20 63 6f 6d  he lack of a com
50d0: 6d 6f 6e 20 63 72 6f 73 73 20 70 6c 61 74 66 6f  mon cross platfo
50e0: 72 6d 0a 64 61 74 61 62 61 73 65 20 6f 66 20 43  rm.database of C
50f0: 65 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f  ertificate Autho
5100: 72 69 74 79 20 28 43 41 29 20 70 72 6f 76 69 64  rity (CA) provid
5110: 65 64 20 63 65 72 74 69 66 69 63 61 74 65 73 20  ed certificates 
5120: 74 6f 20 76 61 6c 69 64 61 74 65 0a 61 67 61 69  to validate.agai
5130: 6e 73 74 2e 20 4d 61 6e 79 20 4c 69 6e 75 78 20  nst. Many Linux 
5140: 73 79 73 74 65 6d 73 20 6e 61 74 69 76 65 6c 79  systems natively
5150: 20 73 75 70 70 6f 72 74 20 4f 70 65 6e 53 53 4c   support OpenSSL
5160: 20 61 6e 64 20 74 68 75 73 20 68 61 76 65 20 74   and thus have t
5170: 68 65 73 65 0a 63 65 72 74 69 66 69 63 61 74 65  hese.certificate
5180: 73 20 69 6e 73 74 61 6c 6c 65 64 20 61 73 20 70  s installed as p
5190: 61 72 74 20 6f 66 20 74 68 65 20 4f 53 2c 20 62  art of the OS, b
51a0: 75 74 20 4d 61 63 4f 53 20 61 6e 64 20 57 69 6e  ut MacOS and Win
51b0: 64 6f 77 73 20 64 6f 20 6e 6f 74 2e 20 49 6e 0a  dows do not. In.
51c0: 6f 72 64 65 72 20 74 6f 20 75 73 65 20 74 68 65  order to use the
51d0: 20 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 72   [option -requir
51e0: 65 5d 20 6f 70 74 69 6f 6e 2c 20 6f 6e 65 20 6f  e] option, one o
51f0: 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20  f the following 
5200: 6d 75 73 74 20 62 65 20 74 72 75 65 3a 0a 0a 5b  must be true:..[
5210: 6c 69 73 74 5f 62 65 67 69 6e 20 69 74 65 6d 69  list_begin itemi
5220: 7a 65 64 5d 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20  zed]..[item].On 
5230: 4c 69 6e 75 78 20 61 6e 64 20 55 6e 69 78 20 73  Linux and Unix s
5240: 79 73 74 65 6d 73 20 77 69 74 68 20 4f 70 65 6e  ystems with Open
5250: 53 53 4c 20 61 6c 72 65 61 64 79 20 69 6e 73 74  SSL already inst
5260: 61 6c 6c 65 64 2c 20 69 66 20 74 68 65 20 43 41  alled, if the CA
5270: 0a 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72  .certificates ar
5280: 65 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20  e stored in the 
5290: 73 74 61 6e 64 61 72 64 20 6c 6f 63 61 74 69 6f  standard locatio
52a0: 6e 73 2c 20 6f 72 20 69 66 20 74 68 65 20 5b 76  ns, or if the [v
52b0: 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d  ar SSL_CERT_DIR]
52c0: 0a 6f 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52  .or [var SSL_CER
52d0: 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d  T_FILE] environm
52e0: 65 6e 74 20 76 61 72 69 61 62 6c 65 73 20 61 72  ent variables ar
52f0: 65 20 73 65 74 2c 20 74 68 65 6e 20 5b 6f 70 74  e set, then [opt
5300: 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f 70  ion -cadir],.[op
5310: 74 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61 6e  tion -cadir], an
5320: 64 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f  d [option -casto
5330: 72 65 5d 20 61 72 65 6e 27 74 20 6e 65 65 64 65  re] aren't neede
5340: 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70  d...[item].If Op
5350: 65 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73  enSSL is not ins
5360: 74 61 6c 6c 65 64 20 69 6e 20 74 68 65 20 64 65  talled in the de
5370: 66 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 2c 20  fault location, 
5380: 6f 72 20 77 68 65 6e 20 75 73 69 6e 67 20 4d 61  or when using Ma
5390: 63 20 4f 53 0a 6f 72 20 57 69 6e 64 6f 77 73 20  c OS.or Windows 
53a0: 61 6e 64 20 4f 70 65 6e 53 53 4c 20 69 73 20 69  and OpenSSL is i
53b0: 6e 73 74 61 6c 6c 65 64 2c 20 74 68 65 20 5b 76  nstalled, the [v
53c0: 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d  ar SSL_CERT_DIR]
53d0: 20 61 6e 64 2f 6f 72 20 0a 5b 76 61 72 20 53 53   and/or .[var SS
53e0: 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76  L_CERT_FILE] env
53f0: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c  ironment variabl
5400: 65 73 20 6f 72 20 74 68 65 20 6f 6e 65 20 6f 66  es or the one of
5410: 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61   the [option -ca
5420: 64 69 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d 63  dir],.[option -c
5430: 61 64 69 72 5d 2c 20 6f 72 20 5b 6f 70 74 69 6f  adir], or [optio
5440: 6e 20 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69  n -castore] opti
5450: 6f 6e 73 20 6d 75 73 74 20 62 65 20 64 65 66 69  ons must be defi
5460: 6e 65 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20  ned...[item].On 
5470: 57 69 6e 64 6f 77 73 2c 20 73 74 61 72 74 69 6e  Windows, startin
5480: 67 20 69 6e 20 4f 70 65 6e 53 53 4c 20 33 2e 32  g in OpenSSL 3.2
5490: 2c 20 69 74 20 69 73 20 6e 6f 77 20 70 6f 73 73  , it is now poss
54a0: 69 62 6c 65 20 74 6f 20 61 63 63 65 73 73 20 74  ible to access t
54b0: 68 65 0a 62 75 69 6c 74 2d 69 6e 20 57 69 6e 64  he.built-in Wind
54c0: 6f 77 73 20 43 65 72 74 69 66 69 63 61 74 65 20  ows Certificate 
54d0: 53 74 6f 72 65 20 66 72 6f 6d 20 4f 70 65 6e 53  Store from OpenS
54e0: 53 4c 2e 20 54 68 69 73 20 63 61 6e 20 62 65 20  SL. This can be 
54f0: 61 63 68 69 65 76 65 64 20 62 79 0a 73 65 74 74  achieved by.sett
5500: 69 6e 67 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20  ing the [option 
5510: 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e  -castore] option
5520: 20 74 6f 20 22 5b 63 6f 6e 73 74 20 6f 72 67 2e   to "[const org.
5530: 6f 70 65 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65  openssl.winstore
5540: 3a 2f 2f 5d 22 2e 0a 0a 5b 69 74 65 6d 5d 0a 49  ://]"...[item].I
5550: 66 20 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f 74  f OpenSSL is not
5560: 20 69 6e 73 74 61 6c 6c 65 64 2c 20 74 68 65 20   installed, the 
5570: 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73 20  CA certificates 
5580: 6d 75 73 74 20 62 65 20 64 6f 77 6e 6c 6f 61 64  must be download
5590: 65 64 20 61 6e 64 0a 69 6e 73 74 61 6c 6c 65 64  ed and.installed
55a0: 20 77 69 74 68 20 74 68 65 20 75 73 65 72 20 73   with the user s
55b0: 6f 66 74 77 61 72 65 2e 20 54 68 65 20 43 55 52  oftware. The CUR
55c0: 4c 20 74 65 61 6d 20 6d 61 6b 65 73 20 74 68 65  L team makes the
55d0: 6d 20 61 76 61 69 6c 61 62 6c 65 20 61 74 0a 5b  m available at.[
55e0: 75 72 69 20 22 68 74 74 70 73 3a 2f 2f 63 75 72  uri "https://cur
55f0: 6c 2e 73 65 2f 64 6f 63 73 2f 63 61 65 78 74 72  l.se/docs/caextr
5600: 61 63 74 2e 68 74 6d 6c 22 20 22 43 41 20 63 65  act.html" "CA ce
5610: 72 74 69 66 69 63 61 74 65 73 20 65 78 74 72 61  rtificates extra
5620: 63 74 65 64 0a 66 72 6f 6d 20 4d 6f 7a 69 6c 6c  cted.from Mozill
5630: 61 22 5d 20 69 6e 20 74 68 65 20 5b 66 69 6c 65  a"] in the [file
5640: 20 63 61 63 65 72 74 2e 70 65 6d 5d 20 66 69 6c   cacert.pem] fil
5650: 65 2e 20 59 6f 75 20 6d 75 73 74 20 74 68 65 6e  e. You must then
5660: 20 65 69 74 68 65 72 20 73 65 74 20 74 68 65 0a   either set the.
5670: 5b 76 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49  [var SSL_CERT_DI
5680: 52 5d 20 61 6e 64 2f 6f 72 20 5b 76 61 72 20 53  R] and/or [var S
5690: 53 4c 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e  SL_CERT_FILE] en
56a0: 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62  vironment variab
56b0: 6c 65 73 20 6f 72 20 74 68 65 0a 5b 6f 70 74 69  les or the.[opti
56c0: 6f 6e 20 2d 63 61 64 69 72 5d 20 6f 72 20 5b 6f  on -cadir] or [o
56d0: 70 74 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 20 6f  ption -cafile] o
56e0: 70 74 69 6f 6e 73 20 74 6f 20 74 68 65 20 43 41  ptions to the CA
56f0: 20 63 65 72 74 20 66 69 6c 65 27 73 20 69 6e 73   cert file's ins
5700: 74 61 6c 6c 0a 6c 6f 63 61 74 69 6f 6e 2e 20 49  tall.location. I
5710: 74 20 69 73 20 79 6f 75 72 20 72 65 73 70 6f 6e  t is your respon
5720: 73 69 62 69 6c 69 74 79 20 74 6f 20 6b 65 65 70  sibility to keep
5730: 20 74 68 69 73 20 66 69 6c 65 20 75 70 20 74 6f   this file up to
5740: 20 64 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e   date...[list_en
5750: 64 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43 61  d]..[section "Ca
5760: 6c 6c 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d  llback Options"]
5770: 0a 0a 41 73 20 70 72 65 76 69 6f 75 73 6c 79 20  ..As previously 
5780: 64 65 73 63 72 69 62 65 64 2c 20 65 61 63 68 20  described, each 
5790: 63 68 61 6e 6e 65 6c 20 63 61 6e 20 62 65 20 67  channel can be g
57a0: 69 76 65 6e 20 74 68 65 69 72 20 6f 77 6e 20 63  iven their own c
57b0: 61 6c 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e 64  allbacks.to hand
57c0: 6c 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20  le intermediate 
57d0: 70 72 6f 63 65 73 73 69 6e 67 20 62 79 20 74 68  processing by th
57e0: 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72  e OpenSSL librar
57f0: 79 2c 20 75 73 69 6e 67 20 74 68 65 0a 5b 6f 70  y, using the.[op
5800: 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20  tion -command], 
5810: 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72  [option -passwor
5820: 64 5d 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20  d], and [option 
5830: 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e  -validate_comman
5840: 64 5d 20 6f 70 74 69 6f 6e 73 0a 70 61 73 73 65  d] options.passe
5850: 64 20 74 6f 20 65 69 74 68 65 72 20 6f 66 20 5b  d to either of [
5860: 63 6d 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d  cmd tls::socket]
5870: 20 6f 72 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d   or [cmd tls::im
5880: 70 6f 72 74 5d 2e 0a 55 6e 6c 69 6b 65 20 70 72  port]..Unlike pr
5890: 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 73 20  evious versions 
58a0: 6f 66 20 54 63 6c 54 4c 53 2c 20 6f 6e 6c 79 20  of TclTLS, only 
58b0: 69 66 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20  if the callback 
58c0: 67 65 6e 65 72 61 74 65 73 20 61 6e 20 65 72 72  generates an err
58d0: 6f 72 2c 0a 77 69 6c 6c 20 74 68 65 20 5b 73 79  or,.will the [sy
58e0: 73 63 6d 64 20 62 67 65 72 72 6f 72 5d 20 63 6f  scmd bgerror] co
58f0: 6d 6d 61 6e 64 20 62 65 20 69 6e 76 6f 6b 65 64  mmand be invoked
5900: 20 77 69 74 68 20 74 68 65 20 65 72 72 6f 72 20   with the error 
5910: 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 5b 73  information...[s
5920: 75 62 73 65 63 74 69 6f 6e 20 22 56 61 6c 75 65  ubsection "Value
5930: 73 20 66 6f 72 20 43 6f 6d 6d 61 6e 64 20 43 61  s for Command Ca
5940: 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61  llback"]..The ca
5950: 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b  llback for the [
5960: 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d  option -command]
5970: 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b   option is invok
5980: 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f  ed at several po
5990: 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a  ints during the.
59a0: 4f 70 65 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b  OpenSSL handshak
59b0: 65 20 61 6e 64 20 64 75 72 69 6e 67 20 72 6f 75  e and during rou
59c0: 74 69 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e  tine operations.
59d0: 20 53 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 74   See below for t
59e0: 68 65 20 70 6f 73 73 69 62 6c 65 0a 61 72 67 75  he possible.argu
59f0: 6d 65 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20  ments passed to 
5a00: 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73 63 72  the callback scr
5a10: 69 70 74 2e 20 56 61 6c 75 65 73 20 72 65 74 75  ipt. Values retu
5a20: 72 6e 65 64 20 66 72 6f 6d 20 74 68 65 20 63 61  rned from the ca
5a30: 6c 6c 62 61 63 6b 20 61 72 65 0a 69 67 6e 6f 72  llback are.ignor
5a40: 65 64 2e 0a 09 0a 5b 6c 69 73 74 5f 62 65 67 69  ed....[list_begi
5a50: 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74  n options]..[opt
5a60: 5f 64 65 66 20 65 72 72 6f 72 20 5b 61 72 67 20  _def error [arg 
5a70: 22 63 68 61 6e 6e 65 6c 49 64 20 6d 65 73 73 61  "channelId messa
5a80: 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20  ge"]].This form 
5a90: 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69  of callback is i
5aa0: 6e 76 6f 6b 65 64 20 77 68 65 6e 65 76 65 72 20  nvoked whenever 
5ab0: 61 6e 20 65 72 72 6f 72 20 6f 63 63 75 72 73 20  an error occurs 
5ac0: 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69 74 69  during the initi
5ad0: 61 6c 0a 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68  al.connection, h
5ae0: 61 6e 64 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f  andshake, or I/O
5af0: 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 65   operations. The
5b00: 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 20 61   [arg message] a
5b10: 72 67 75 6d 65 6e 74 20 63 61 6e 20 62 65 0a 66  rgument can be.f
5b20: 72 6f 6d 20 74 68 65 20 54 63 6c 5f 45 72 72 6e  rom the Tcl_Errn
5b30: 6f 4d 73 67 2c 20 4f 70 65 6e 53 53 4c 20 66 75  oMsg, OpenSSL fu
5b40: 6e 63 74 69 6f 6e 20 5b 66 75 6e 20 45 52 52 5f  nction [fun ERR_
5b50: 72 65 61 73 6f 6e 5f 65 72 72 6f 72 5f 73 74 72  reason_error_str
5b60: 69 6e 67 28 29 5d 2c 0a 6f 72 20 61 20 63 75 73  ing()],.or a cus
5b70: 74 6f 6d 20 6d 65 73 73 61 67 65 2e 20 54 68 69  tom message. Thi
5b80: 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65  s callback is ne
5b90: 77 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38  w for TclTLS 1.8
5ba0: 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 69 6e 66 6f  ...[opt_def info
5bb0: 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64   [arg "channelId
5bc0: 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65 73   major minor mes
5bd0: 73 61 67 65 20 74 79 70 65 22 5d 5d 0a 54 68 69  sage type"]].Thi
5be0: 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61  s form of callba
5bf0: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79  ck is invoked by
5c00: 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e   the OpenSSL fun
5c10: 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73  ction.[fun SSL_s
5c20: 65 74 5f 69 6e 66 6f 5f 63 61 6c 6c 62 61 63 6b  et_info_callback
5c30: 28 29 5d 20 64 75 72 69 6e 67 20 74 68 65 20 69  ()] during the i
5c40: 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f  nitial connectio
5c50: 6e 20 61 6e 64 20 68 61 6e 64 73 68 61 6b 65 0a  n and handshake.
5c60: 6f 70 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 20  operations. The 
5c70: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a  arguments are:..
5c80: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
5c90: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b  nitions]..[def [
5ca0: 61 72 67 20 6d 61 6a 6f 72 5d 5d 0a 4d 61 6a 6f  arg major]].Majo
5cb0: 72 20 63 61 74 65 67 6f 72 79 20 66 6f 72 20 65  r category for e
5cc0: 72 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d  rror. Valid enum
5cd0: 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 68 61  s are: [const ha
5ce0: 6e 64 73 68 61 6b 65 5d 2c 20 5b 63 6f 6e 73 74  ndshake], [const
5cf0: 20 61 6c 65 72 74 5d 2c 0a 5b 63 6f 6e 73 74 20   alert],.[const 
5d00: 63 6f 6e 6e 65 63 74 5d 2c 20 5b 63 6f 6e 73 74  connect], [const
5d10: 20 61 63 63 65 70 74 5d 2e 0a 0a 5b 64 65 66 20   accept]...[def 
5d20: 5b 61 72 67 20 6d 69 6e 6f 72 5d 5d 0a 4d 69 6e  [arg minor]].Min
5d30: 6f 72 20 63 61 74 65 67 6f 72 79 20 66 6f 72 20  or category for 
5d40: 65 72 72 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75  error. Valid enu
5d50: 6d 73 20 61 72 65 3a 20 5b 63 6f 6e 73 74 20 73  ms are: [const s
5d60: 74 61 72 74 5d 2c 20 5b 63 6f 6e 73 74 20 64 6f  tart], [const do
5d70: 6e 65 5d 2c 20 5b 63 6f 6e 73 74 20 72 65 61 64  ne], [const read
5d80: 5d 2c 0a 5b 63 6f 6e 73 74 20 77 72 69 74 65 5d  ],.[const write]
5d90: 2c 20 5b 63 6f 6e 73 74 20 6c 6f 6f 70 5d 2c 20  , [const loop], 
5da0: 5b 63 6f 6e 73 74 20 65 78 69 74 5d 2e 0a 0a 5b  [const exit]...[
5db0: 64 65 66 20 5b 61 72 67 20 6d 65 73 73 61 67 65  def [arg message
5dc0: 5d 5d 0a 44 65 73 63 72 69 70 74 69 76 65 20 6d  ]].Descriptive m
5dd0: 65 73 73 61 67 65 20 73 74 72 69 6e 67 20 77 68  essage string wh
5de0: 69 63 68 20 6d 61 79 20 62 65 20 67 65 6e 65 72  ich may be gener
5df0: 61 74 65 64 20 65 69 74 68 65 72 20 62 79 0a 5b  ated either by.[
5e00: 66 75 6e 20 53 53 4c 5f 73 74 61 74 65 5f 73 74  fun SSL_state_st
5e10: 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d 20 6f 72 20  ring_long()] or 
5e20: 5b 66 75 6e 20 53 53 4c 5f 61 6c 65 72 74 5f 64  [fun SSL_alert_d
5e30: 65 73 63 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28  esc_string_long(
5e40: 29 5d 2c 0a 64 65 70 65 6e 64 69 6e 67 20 6f 6e  )],.depending on
5e50: 20 74 68 65 20 63 6f 6e 74 65 78 74 2e 0a 0a 5b   the context...[
5e60: 64 65 66 20 5b 61 72 67 20 74 79 70 65 5d 5d 0a  def [arg type]].
5e70: 46 6f 72 20 61 6c 65 72 74 73 2c 20 74 68 65 20  For alerts, the 
5e80: 70 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 73 20  possible values 
5e90: 61 72 65 3a 20 5b 63 6f 6e 73 74 20 77 61 72 6e  are: [const warn
5ea0: 69 6e 67 5d 2c 0a 5b 63 6f 6e 73 74 20 66 61 74  ing],.[const fat
5eb0: 61 6c 5d 2c 20 61 6e 64 20 5b 63 6f 6e 73 74 20  al], and [const 
5ec0: 75 6e 6b 6e 6f 77 6e 5d 2e 20 46 6f 72 20 6f 74  unknown]. For ot
5ed0: 68 65 72 73 2c 20 5b 63 6f 6e 73 74 20 69 6e 66  hers, [const inf
5ee0: 6f 5d 20 69 73 20 75 73 65 64 2e 0a 54 68 69 73  o] is used..This
5ef0: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 65 77   argument is new
5f00: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
5f10: 20 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b   ..[list_end]..[
5f20: 6f 70 74 5f 64 65 66 20 6d 65 73 73 61 67 65 20  opt_def message 
5f30: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20  [arg "channelId 
5f40: 64 69 72 65 63 74 69 6f 6e 20 76 65 72 73 69 6f  direction versio
5f50: 6e 20 63 6f 6e 74 65 6e 74 5f 74 79 70 65 20 6d  n content_type m
5f60: 65 73 73 61 67 65 22 5d 5d 0a 54 68 69 73 20 66  essage"]].This f
5f70: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20  orm of callback 
5f80: 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68  is invoked by th
5f90: 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69  e OpenSSL functi
5fa0: 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73 65 74 5f  on.[fun SSL_set_
5fb0: 6d 73 67 5f 63 61 6c 6c 62 61 63 6b 28 29 5d 20  msg_callback()] 
5fc0: 77 68 65 6e 65 76 65 72 20 61 20 6d 65 73 73 61  whenever a messa
5fd0: 67 65 20 69 73 20 73 65 6e 74 20 6f 72 20 72 65  ge is sent or re
5fe0: 63 65 69 76 65 64 20 64 75 72 69 6e 67 20 74 68  ceived during th
5ff0: 65 0a 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65 63  e.initial connec
6000: 74 69 6f 6e 2c 20 68 61 6e 64 73 68 61 6b 65 2c  tion, handshake,
6010: 20 6f 72 20 49 2f 4f 20 6f 70 65 72 61 74 69 6f   or I/O operatio
6020: 6e 73 2e 20 49 74 20 69 73 20 6f 6e 6c 79 20 61  ns. It is only a
6030: 76 61 69 6c 61 62 6c 65 20 77 68 65 6e 0a 4f 70  vailable when.Op
6040: 65 6e 53 53 4c 20 69 73 20 63 6f 6d 70 6c 69 65  enSSL is complie
6050: 64 20 77 69 74 68 20 74 68 65 20 5b 63 6f 6e 73  d with the [cons
6060: 74 20 65 6e 61 62 6c 65 2d 73 73 6c 2d 74 72 61  t enable-ssl-tra
6070: 63 65 5d 20 6f 70 74 69 6f 6e 2e 20 54 68 69 73  ce] option. This
6080: 20 63 61 6c 6c 62 61 63 6b 20 69 73 0a 6e 65 77   callback is.new
6090: 20 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e   for TclTLS 1.8.
60a0: 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61   The arguments a
60b0: 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  re:..[list_begin
60c0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b   definitions]..[
60d0: 64 65 66 20 5b 61 72 67 20 64 69 72 65 63 74 69  def [arg directi
60e0: 6f 6e 5d 5d 0a 44 69 72 65 63 74 69 6f 6e 20 69  on]].Direction i
60f0: 73 20 65 69 74 68 65 72 20 5b 63 6f 6e 73 74 20  s either [const 
6100: 53 65 6e 74 5d 20 6f 72 20 5b 63 6f 6e 73 74 20  Sent] or [const 
6110: 52 65 63 65 69 76 65 64 5d 2e 0a 0a 5b 64 65 66  Received]...[def
6120: 20 5b 61 72 67 20 76 65 72 73 69 6f 6e 5d 5d 0a   [arg version]].
6130: 56 65 72 73 69 6f 6e 20 69 73 20 74 68 65 20 70  Version is the p
6140: 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 2e  rotocol version.
6150: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 63 6f 6e 74  ..[def [arg cont
6160: 65 6e 74 5f 74 79 70 65 5d 5d 0a 43 6f 6e 74 65  ent_type]].Conte
6170: 6e 74 20 74 79 70 65 20 69 73 20 74 68 65 20 6d  nt type is the m
6180: 65 73 73 61 67 65 20 63 6f 6e 74 65 6e 74 20 74  essage content t
6190: 79 70 65 2e 0a 0a 5b 64 65 66 20 5b 61 72 67 20  ype...[def [arg 
61a0: 6d 65 73 73 61 67 65 5d 5d 0a 4d 65 73 73 61 67  message]].Messag
61b0: 65 20 69 73 20 6d 6f 72 65 20 69 6e 66 6f 20 66  e is more info f
61c0: 72 6f 6d 20 74 68 65 20 5b 63 6f 6e 73 74 20 53  rom the [const S
61d0: 53 4c 5f 74 72 61 63 65 5d 20 41 50 49 2e 0a 0a  SL_trace] API...
61e0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74  [list_end]..[opt
61f0: 5f 64 65 66 20 73 65 73 73 69 6f 6e 20 5b 61 72  _def session [ar
6200: 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 73 65 73  g "channelId ses
6210: 73 69 6f 6e 5f 69 64 20 73 65 73 73 69 6f 6e 5f  sion_id session_
6220: 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 22  ticket lifetime"
6230: 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20  ]].This form of 
6240: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f  callback is invo
6250: 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53  ked by the OpenS
6260: 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e  SL function.[fun
6270: 20 53 53 4c 5f 43 54 58 5f 73 65 73 73 5f 73 65   SSL_CTX_sess_se
6280: 74 5f 6e 65 77 5f 63 62 28 29 5d 20 77 68 65 6e  t_new_cb()] when
6290: 65 76 65 72 20 61 20 6e 65 77 20 73 65 73 73 69  ever a new sessi
62a0: 6f 6e 20 69 64 20 69 73 20 73 65 6e 74 20 62 79  on id is sent by
62b0: 20 74 68 65 0a 73 65 72 76 65 72 20 64 75 72 69   the.server duri
62c0: 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c 20 63  ng the initial c
62d0: 6f 6e 6e 65 63 74 69 6f 6e 20 61 6e 64 20 68 61  onnection and ha
62e0: 6e 64 73 68 61 6b 65 20 61 6e 64 20 61 6c 73 6f  ndshake and also
62f0: 20 64 75 72 69 6e 67 20 74 68 65 20 73 65 73 73   during the sess
6300: 69 6f 6e 0a 69 66 20 74 68 65 20 5b 6f 70 74 69  ion.if the [opti
6310: 6f 6e 20 2d 70 6f 73 74 5f 68 61 6e 64 73 68 61  on -post_handsha
6320: 6b 65 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73 65  ke] option is se
6330: 74 20 74 6f 20 74 72 75 65 2e 20 54 68 69 73 20  t to true. This 
6340: 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20  callback is new 
6350: 66 6f 72 0a 54 63 6c 54 4c 53 20 31 2e 38 2e 20  for.TclTLS 1.8. 
6360: 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 72  The arguments ar
6370: 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20  e:..[list_begin 
6380: 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64  definitions]..[d
6390: 65 66 20 5b 61 72 67 20 73 65 73 73 69 6f 6e 5f  ef [arg session_
63a0: 69 64 5d 5d 0a 53 65 73 73 69 6f 6e 20 49 64 20  id]].Session Id 
63b0: 69 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 73  is the current s
63c0: 65 73 73 69 6f 6e 20 69 64 65 6e 74 69 66 69 65  ession identifie
63d0: 72 0a 0a 5b 64 65 66 20 5b 61 72 67 20 73 65 73  r..[def [arg ses
63e0: 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 5d 0a 54 69  sion_ticket]].Ti
63f0: 63 6b 65 74 20 69 73 20 74 68 65 20 73 65 73 73  cket is the sess
6400: 69 6f 6e 20 74 69 63 6b 65 74 20 69 6e 66 6f 0a  ion ticket info.
6410: 0a 5b 64 65 66 20 5b 61 72 67 20 6c 69 66 65 74  .[def [arg lifet
6420: 69 6d 65 5d 5d 0a 4c 69 66 65 74 69 6d 65 20 69  ime]].Lifetime i
6430: 73 20 74 68 65 20 74 69 63 6b 65 74 20 6c 69 66  s the ticket lif
6440: 65 74 69 6d 65 20 69 6e 20 73 65 63 6f 6e 64 73  etime in seconds
6450: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b  ...[list_end]..[
6460: 6f 70 74 5f 64 65 66 20 76 65 72 69 66 79 20 5b  opt_def verify [
6470: 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 64  arg "channelId d
6480: 65 70 74 68 20 63 65 72 74 20 73 74 61 74 75 73  epth cert status
6490: 20 65 72 72 6f 72 22 5d 5d 0a 54 68 69 73 20 63   error"]].This c
64a0: 61 6c 6c 62 61 63 6b 20 77 61 73 20 6d 6f 76 65  allback was move
64b0: 64 20 74 6f 20 5b 6f 70 74 69 6f 6e 20 2d 76 61  d to [option -va
64c0: 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 5d 20 69  lidatecommand] i
64d0: 6e 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  n TclTLS 1.8...[
64e0: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73  list_end]..[subs
64f0: 65 63 74 69 6f 6e 20 22 56 61 6c 75 65 73 20 66  ection "Values f
6500: 6f 72 20 50 61 73 73 77 6f 72 64 20 43 61 6c 6c  or Password Call
6510: 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c  back"]..The call
6520: 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70  back for the [op
6530: 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 20  tion -password] 
6540: 6f 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65  option is invoke
6550: 64 20 62 79 20 54 63 6c 54 4c 53 20 77 68 65 6e  d by TclTLS when
6560: 65 76 65 72 20 4f 70 65 6e 53 53 4c 20 6e 65 65  ever OpenSSL nee
6570: 64 73 0a 74 6f 20 6f 62 74 61 69 6e 20 61 20 70  ds.to obtain a p
6580: 61 73 73 77 6f 72 64 2e 20 53 65 65 20 62 65 6c  assword. See bel
6590: 6f 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69  ow for the possi
65a0: 62 6c 65 20 61 72 67 75 6d 65 6e 74 73 20 70 61  ble arguments pa
65b0: 73 73 65 64 20 74 6f 20 74 68 65 0a 63 61 6c 6c  ssed to the.call
65c0: 62 61 63 6b 20 73 63 72 69 70 74 2e 20 54 68 65  back script. The
65d0: 20 75 73 65 72 20 70 72 6f 76 69 64 65 64 20 70   user provided p
65e0: 61 73 73 77 6f 72 64 20 69 73 20 65 78 70 65 63  assword is expec
65f0: 74 65 64 20 74 6f 20 62 65 20 72 65 74 75 72 6e  ted to be return
6600: 65 64 20 62 79 20 74 68 65 0a 63 61 6c 6c 62 61  ed by the.callba
6610: 63 6b 2e 0a 09 0a 5b 6c 69 73 74 5f 62 65 67 69  ck....[list_begi
6620: 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74  n options]..[opt
6630: 5f 64 65 66 20 70 61 73 73 77 6f 72 64 20 5b 61  _def password [a
6640: 72 67 20 22 72 77 66 6c 61 67 20 73 69 7a 65 22  rg "rwflag size"
6650: 5d 5d 0a 49 6e 76 6f 6b 65 64 20 77 68 65 6e 20  ]].Invoked when 
6660: 6c 6f 61 64 69 6e 67 20 6f 72 20 73 74 6f 72 69  loading or stori
6670: 6e 67 20 61 6e 20 65 6e 63 72 79 70 74 65 64 20  ng an encrypted 
6680: 50 45 4d 20 63 65 72 74 69 66 69 63 61 74 65 2e  PEM certificate.
6690: 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61   The arguments a
66a0: 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  re:..[list_begin
66b0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b   definitions]..[
66c0: 64 65 66 20 5b 61 72 67 20 72 77 66 6c 61 67 5d  def [arg rwflag]
66d0: 5d 0a 54 68 65 20 72 65 61 64 2f 77 72 69 74 65  ].The read/write
66e0: 20 66 6c 61 67 20 69 73 20 30 20 66 6f 72 20 72   flag is 0 for r
66f0: 65 61 64 69 6e 67 2f 64 65 63 72 79 70 74 69 6f  eading/decryptio
6700: 6e 20 6f 72 20 31 20 66 6f 72 20 77 72 69 74 69  n or 1 for writi
6710: 6e 67 2f 65 6e 63 72 79 70 74 69 6f 6e 2e 0a 54  ng/encryption..T
6720: 68 65 20 6c 61 74 74 65 72 20 63 61 6e 20 62 65  he latter can be
6730: 20 75 73 65 64 20 74 6f 20 64 65 74 65 72 6d 69   used to determi
6740: 6e 65 20 77 68 65 6e 20 74 6f 20 70 72 6f 6d 70  ne when to promp
6750: 74 20 74 68 65 20 75 73 65 72 20 74 6f 20 63 6f  t the user to co
6760: 6e 66 69 72 6d 2e 0a 54 68 69 73 20 61 72 67 75  nfirm..This argu
6770: 6d 65 6e 74 20 69 73 20 6e 65 77 20 66 6f 72 20  ment is new for 
6780: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 64 65  TclTLS 1.8...[de
6790: 66 20 5b 61 72 67 20 73 69 7a 65 5d 5d 0a 54 68  f [arg size]].Th
67a0: 65 20 73 69 7a 65 20 69 73 20 74 68 65 20 6d 61  e size is the ma
67b0: 78 69 6d 75 6d 20 6c 65 6e 67 74 68 20 6f 66 20  ximum length of 
67c0: 74 68 65 20 70 61 73 73 77 6f 72 64 20 69 6e 20  the password in 
67d0: 62 79 74 65 73 2e 0a 54 68 69 73 20 61 72 67 75  bytes..This argu
67e0: 6d 65 6e 74 20 69 73 20 6e 65 77 20 66 6f 72 20  ment is new for 
67f0: 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69  TclTLS 1.8...[li
6800: 73 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65  st_end]..[list_e
6810: 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e  nd]..[subsection
6820: 20 22 56 61 6c 75 65 73 20 66 6f 72 20 56 61 6c   "Values for Val
6830: 69 64 61 74 65 20 43 6f 6d 6d 61 6e 64 20 43 61  idate Command Ca
6840: 6c 6c 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61  llback"]..The ca
6850: 6c 6c 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b  llback for the [
6860: 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65  option -validate
6870: 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 20  command] option 
6880: 69 73 20 69 6e 76 6f 6b 65 64 20 64 75 72 69 6e  is invoked durin
6890: 67 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65 0a  g the handshake.
68a0: 70 72 6f 63 65 73 73 20 69 6e 20 6f 72 64 65 72  process in order
68b0: 20 66 6f 72 20 74 68 65 20 61 70 70 6c 69 63 61   for the applica
68c0: 74 69 6f 6e 20 74 6f 20 76 61 6c 69 64 61 74 65  tion to validate
68d0: 20 74 68 65 20 70 72 6f 76 69 64 65 64 20 76 61   the provided va
68e0: 6c 75 65 28 73 29 2e 20 53 65 65 0a 62 65 6c 6f  lue(s). See.belo
68f0: 77 20 66 6f 72 20 74 68 65 20 70 6f 73 73 69 62  w for the possib
6900: 6c 65 20 61 72 67 75 6d 65 6e 74 73 20 70 61 73  le arguments pas
6910: 73 65 64 20 74 6f 20 74 68 65 20 63 61 6c 6c 62  sed to the callb
6920: 61 63 6b 20 73 63 72 69 70 74 2e 20 49 66 20 6e  ack script. If n
6930: 6f 74 0a 73 70 65 63 69 66 69 65 64 2c 20 4f 70  ot.specified, Op
6940: 65 6e 53 53 4c 20 77 69 6c 6c 20 61 63 63 65 70  enSSL will accep
6950: 74 20 61 6c 6c 20 76 61 6c 69 64 20 63 65 72 74  t all valid cert
6960: 69 66 69 63 61 74 65 73 20 61 6e 64 20 65 78 74  ificates and ext
6970: 65 6e 73 69 6f 6e 73 2e 20 54 6f 20 72 65 6a 65  ensions. To reje
6980: 63 74 0a 74 68 65 20 76 61 6c 75 65 20 61 6e 64  ct.the value and
6990: 20 61 62 6f 72 74 20 74 68 65 20 63 6f 6e 6e 65   abort the conne
69a0: 63 74 69 6f 6e 2c 20 74 68 65 20 63 61 6c 6c 62  ction, the callb
69b0: 61 63 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72  ack should retur
69c0: 6e 20 30 2e 20 54 6f 20 61 63 63 65 70 74 20 74  n 0. To accept t
69d0: 68 65 0a 76 61 6c 75 65 20 61 6e 64 20 63 6f 6e  he.value and con
69e0: 74 69 6e 75 65 20 74 68 65 20 63 6f 6e 6e 65 63  tinue the connec
69f0: 74 69 6f 6e 2c 20 69 74 20 73 68 6f 75 6c 64 20  tion, it should 
6a00: 72 65 74 75 72 6e 20 31 2e 20 54 6f 20 72 65 6a  return 1. To rej
6a10: 65 63 74 20 74 68 65 20 76 61 6c 75 65 2c 20 62  ect the value, b
6a20: 75 74 0a 63 6f 6e 74 69 6e 75 65 20 74 68 65 20  ut.continue the 
6a30: 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 69 74 20 73  connection, it s
6a40: 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 32 2e 20  hould return 2. 
6a50: 54 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 69 73  This callback is
6a60: 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c 53 20   new for TclTLS 
6a70: 31 2e 38 2e 0a 09 0a 5b 6c 69 73 74 5f 62 65 67  1.8....[list_beg
6a80: 69 6e 20 6f 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70  in options]..[op
6a90: 74 5f 64 65 66 20 61 6c 70 6e 20 5b 61 72 67 20  t_def alpn [arg 
6aa0: 22 63 68 61 6e 6e 65 6c 49 64 20 70 72 6f 74 6f  "channelId proto
6ab0: 63 6f 6c 20 6d 61 74 63 68 22 5d 5d 0a 46 6f 72  col match"]].For
6ac0: 20 73 65 72 76 65 72 73 2c 20 74 68 69 73 20 66   servers, this f
6ad0: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20  orm of callback 
6ae0: 69 73 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20  is invoked when 
6af0: 74 68 65 20 63 6c 69 65 6e 74 20 41 4c 50 4e 20  the client ALPN 
6b00: 65 78 74 65 6e 73 69 6f 6e 20 69 73 0a 72 65 63  extension is.rec
6b10: 65 69 76 65 64 2e 20 49 66 20 5b 61 72 67 20 6d  eived. If [arg m
6b20: 61 74 63 68 5d 20 69 73 20 74 72 75 65 2c 20 74  atch] is true, t
6b30: 68 65 6e 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  hen [arg protoco
6b40: 6c 5d 20 69 73 20 74 68 65 20 66 69 72 73 74 0a  l] is the first.
6b50: 5b 6f 70 74 69 6f 6e 20 2d 61 6c 70 6e 5d 20 70  [option -alpn] p
6b60: 72 6f 74 6f 63 6f 6c 20 6f 70 74 69 6f 6e 20 69  rotocol option i
6b70: 6e 20 63 6f 6d 6d 6f 6e 20 74 6f 20 62 6f 74 68  n common to both
6b80: 20 74 68 65 20 63 6c 69 65 6e 74 20 61 6e 64 20   the client and 
6b90: 73 65 72 76 65 72 2e 0a 49 66 20 6e 6f 74 2c 20  server..If not, 
6ba0: 74 68 65 20 66 69 72 73 74 20 63 6c 69 65 6e 74  the first client
6bb0: 20 73 70 65 63 69 66 69 65 64 20 70 72 6f 74 6f   specified proto
6bc0: 63 6f 6c 20 69 73 20 75 73 65 64 2e 20 54 68 69  col is used. Thi
6bd0: 73 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 63 61  s callback is ca
6be0: 6c 6c 65 64 0a 61 66 74 65 72 20 74 68 65 20 48  lled.after the H
6bf0: 65 6c 6c 6f 20 61 6e 64 20 41 4c 50 4e 20 63 61  ello and ALPN ca
6c00: 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64  llbacks...[opt_d
6c10: 65 66 20 68 65 6c 6c 6f 20 5b 61 72 67 20 22 63  ef hello [arg "c
6c20: 68 61 6e 6e 65 6c 49 64 20 73 65 72 76 65 72 6e  hannelId servern
6c30: 61 6d 65 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65  ame"]].For serve
6c40: 72 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f 66  rs, this form of
6c50: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
6c60: 6f 6b 65 64 20 64 75 72 69 6e 67 20 63 6c 69 65  oked during clie
6c70: 6e 74 20 68 65 6c 6c 6f 20 6d 65 73 73 61 67 65  nt hello message
6c80: 0a 70 72 6f 63 65 73 73 69 6e 67 2e 20 54 68 65  .processing. The
6c90: 20 70 75 72 70 6f 73 65 20 69 73 20 73 6f 20 74   purpose is so t
6ca0: 68 65 20 73 65 72 76 65 72 20 63 61 6e 20 73 65  he server can se
6cb0: 6c 65 63 74 20 74 68 65 20 61 70 70 72 6f 70 72  lect the appropr
6cc0: 69 61 74 65 20 63 65 72 74 69 66 69 63 61 74 65  iate certificate
6cd0: 0a 74 6f 20 70 72 65 73 65 6e 74 20 74 6f 20 74  .to present to t
6ce0: 68 65 20 63 6c 69 65 6e 74 2c 20 61 6e 64 20 74  he client, and t
6cf0: 6f 20 6d 61 6b 65 20 6f 74 68 65 72 20 63 6f 6e  o make other con
6d00: 66 69 67 75 72 61 74 69 6f 6e 20 61 64 6a 75 73  figuration adjus
6d10: 74 6d 65 6e 74 73 20 72 65 6c 65 76 61 6e 74 0a  tments relevant.
6d20: 74 6f 20 74 68 61 74 20 73 65 72 76 65 72 20 6e  to that server n
6d30: 61 6d 65 20 61 6e 64 20 69 74 73 20 63 6f 6e 66  ame and its conf
6d40: 69 67 75 72 61 74 69 6f 6e 2e 20 49 74 20 69 73  iguration. It is
6d50: 20 63 61 6c 6c 65 64 20 62 65 66 6f 72 65 20 74   called before t
6d60: 68 65 20 53 4e 49 20 61 6e 64 20 41 4c 50 4e 0a  he SNI and ALPN.
6d70: 63 61 6c 6c 62 61 63 6b 73 2e 0a 0a 5b 6f 70 74  callbacks...[opt
6d80: 5f 64 65 66 20 73 6e 69 20 5b 61 72 67 20 22 63  _def sni [arg "c
6d90: 68 61 6e 6e 65 6c 49 64 20 73 65 72 76 65 72 6e  hannelId servern
6da0: 61 6d 65 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65  ame"]].For serve
6db0: 72 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f 66  rs, this form of
6dc0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
6dd0: 6f 6b 65 64 20 77 68 65 6e 20 74 68 65 20 53 65  oked when the Se
6de0: 72 76 65 72 20 4e 61 6d 65 20 49 6e 64 69 63 61  rver Name Indica
6df0: 74 69 6f 6e 0a 28 53 4e 49 29 20 65 78 74 65 6e  tion.(SNI) exten
6e00: 73 69 6f 6e 20 69 73 20 72 65 63 65 69 76 65 64  sion is received
6e10: 2e 20 54 68 65 20 5b 61 72 67 20 73 65 72 76 65  . The [arg serve
6e20: 72 6e 61 6d 65 5d 20 61 72 67 75 6d 65 6e 74 20  rname] argument 
6e30: 69 73 20 74 68 65 20 63 6c 69 65 6e 74 0a 70 72  is the client.pr
6e40: 6f 76 69 64 65 64 20 73 65 72 76 65 72 20 6e 61  ovided server na
6e50: 6d 65 20 73 70 65 63 69 66 69 65 64 20 69 6e 20  me specified in 
6e60: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 73 65 72  the [option -ser
6e70: 76 65 72 6e 61 6d 65 3c 2f 62 3e 5d 20 6f 70 74  vername</b>] opt
6e80: 69 6f 6e 2e 20 54 68 65 0a 70 75 72 70 6f 73 65  ion. The.purpose
6e90: 20 69 73 20 73 6f 20 77 68 65 6e 20 61 20 73 65   is so when a se
6ea0: 72 76 65 72 20 73 75 70 70 6f 72 74 73 20 6d 75  rver supports mu
6eb0: 6c 74 69 70 6c 65 20 6e 61 6d 65 73 2c 20 74 68  ltiple names, th
6ec0: 65 20 72 69 67 68 74 20 63 65 72 74 69 66 69 63  e right certific
6ed0: 61 74 65 0a 63 61 6e 20 62 65 20 75 73 65 64 2e  ate.can be used.
6ee0: 20 49 74 20 69 73 20 63 61 6c 6c 65 64 20 61 66   It is called af
6ef0: 74 65 72 20 74 68 65 20 68 65 6c 6c 6f 20 63 61  ter the hello ca
6f00: 6c 6c 62 61 63 6b 20 62 75 74 20 62 65 66 6f 72  llback but befor
6f10: 65 20 74 68 65 20 41 4c 50 4e 0a 63 61 6c 6c 62  e the ALPN.callb
6f20: 61 63 6b 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 76  ack...[opt_def v
6f30: 65 72 69 66 79 20 5b 61 72 67 20 22 63 68 61 6e  erify [arg "chan
6f40: 6e 65 6c 49 64 20 64 65 70 74 68 20 63 65 72 74  nelId depth cert
6f50: 20 73 74 61 74 75 73 20 65 72 72 6f 72 22 5d 5d   status error"]]
6f60: 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61  .This form of ca
6f70: 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65  llback is invoke
6f80: 64 20 62 79 20 4f 70 65 6e 53 53 4c 20 77 68 65  d by OpenSSL whe
6f90: 6e 20 61 20 6e 65 77 20 63 65 72 74 69 66 69 63  n a new certific
6fa0: 61 74 65 20 69 73 20 72 65 63 65 69 76 65 64 0a  ate is received.
6fb0: 66 72 6f 6d 20 74 68 65 20 70 65 65 72 2e 20 49  from the peer. I
6fc0: 74 20 61 6c 6c 6f 77 73 20 74 68 65 20 63 6c 69  t allows the cli
6fd0: 65 6e 74 20 74 6f 20 63 68 65 63 6b 20 74 68 65  ent to check the
6fe0: 20 63 65 72 74 69 66 69 63 61 74 65 20 76 65 72   certificate ver
6ff0: 69 66 69 63 61 74 69 6f 6e 0a 72 65 73 75 6c 74  ification.result
7000: 73 20 61 6e 64 20 63 68 6f 6f 73 65 20 77 68 65  s and choose whe
7010: 74 68 65 72 20 74 6f 20 63 6f 6e 74 69 6e 75 65  ther to continue
7020: 20 6f 72 20 6e 6f 74 2e 20 49 74 20 69 73 20 63   or not. It is c
7030: 61 6c 6c 65 64 20 66 6f 72 20 65 61 63 68 0a 63  alled for each.c
7040: 65 72 74 69 66 69 63 61 74 65 20 69 6e 20 74 68  ertificate in th
7050: 65 20 63 65 72 74 69 66 69 63 61 74 65 20 63 68  e certificate ch
7060: 61 69 6e 2e 20 54 68 69 73 20 63 61 6c 6c 62 61  ain. This callba
7070: 63 6b 20 77 61 73 20 6d 6f 76 65 64 20 66 72 6f  ck was moved fro
7080: 6d 0a 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61  m.[option -comma
7090: 6e 64 5d 20 69 6e 20 54 63 6c 54 4c 53 20 31 2e  nd] in TclTLS 1.
70a0: 38 2e 20 54 68 65 20 61 72 67 75 6d 65 6e 74 73  8. The arguments
70b0: 20 61 72 65 3a 0a 0a 5b 6c 69 73 74 5f 62 65 67   are:..[list_beg
70c0: 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a  in definitions].
70d0: 0a 5b 64 65 66 20 5b 61 72 67 20 64 65 70 74 68  .[def [arg depth
70e0: 5d 5d 0a 54 68 65 20 64 65 70 74 68 20 69 73 20  ]].The depth is 
70f0: 74 68 65 20 69 6e 74 65 67 65 72 20 64 65 70 74  the integer dept
7100: 68 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  h of the certifi
7110: 63 61 74 65 20 69 6e 20 74 68 65 20 63 65 72 74  cate in the cert
7120: 69 66 69 63 61 74 65 20 63 68 61 69 6e 2c 0a 77  ificate chain,.w
7130: 68 65 72 65 20 30 20 69 73 20 74 68 65 20 70 65  here 0 is the pe
7140: 65 72 20 63 65 72 74 69 66 69 63 61 74 65 20 61  er certificate a
7150: 6e 64 20 68 69 67 68 65 72 20 76 61 6c 75 65 73  nd higher values
7160: 20 67 6f 69 6e 67 20 75 70 20 74 6f 20 74 68 65   going up to the
7170: 20 43 65 72 74 69 66 69 63 61 74 65 0a 41 75 74   Certificate.Aut
7180: 68 6f 72 69 74 79 20 28 43 41 29 2e 0a 0a 5b 64  hority (CA)...[d
7190: 65 66 20 5b 61 72 67 20 63 65 72 74 5d 5d 0a 54  ef [arg cert]].T
71a0: 68 65 20 63 65 72 74 20 61 72 67 75 6d 65 6e 74  he cert argument
71b0: 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20 6b 65   is a list of ke
71c0: 79 2d 76 61 6c 75 65 20 70 61 69 72 73 20 73 69  y-value pairs si
71d0: 6d 69 6c 61 72 20 74 6f 20 74 68 6f 73 65 20 72  milar to those r
71e0: 65 74 75 72 6e 65 64 20 62 79 0a 5b 63 6d 64 20  eturned by.[cmd 
71f0: 74 6c 73 3a 3a 73 74 61 74 75 73 5d 2e 0a 0a 5b  tls::status]...[
7200: 64 65 66 20 5b 61 72 67 20 73 74 61 74 75 73 5d  def [arg status]
7210: 5d 0a 54 68 65 20 73 74 61 74 75 73 20 61 72 67  ].The status arg
7220: 75 6d 65 6e 74 20 69 73 20 74 68 65 20 62 6f 6f  ument is the boo
7230: 6c 65 61 6e 20 76 61 6c 69 64 69 74 79 20 6f 66  lean validity of
7240: 20 74 68 65 20 63 75 72 72 65 6e 74 20 63 65 72   the current cer
7250: 74 69 66 69 63 61 74 65 20 77 68 65 72 65 20 30  tificate where 0
7260: 0a 69 73 20 69 6e 76 61 6c 69 64 20 61 6e 64 20  .is invalid and 
7270: 31 20 69 73 20 76 61 6c 69 64 2e 0a 0a 5b 64 65  1 is valid...[de
7280: 66 20 5b 61 72 67 20 65 72 72 6f 72 5d 5d 0a 54  f [arg error]].T
7290: 68 65 20 65 72 72 6f 72 20 61 72 67 75 6d 65 6e  he error argumen
72a0: 74 20 69 73 20 74 68 65 20 65 72 72 6f 72 20 6d  t is the error m
72b0: 65 73 73 61 67 65 2c 20 69 66 20 61 6e 79 2c 20  essage, if any, 
72c0: 67 65 6e 65 72 61 74 65 64 20 62 79 0a 5b 66 75  generated by.[fu
72d0: 6e 20 58 35 30 39 5f 53 54 4f 52 45 5f 43 54 58  n X509_STORE_CTX
72e0: 5f 67 65 74 5f 65 72 72 6f 72 28 29 5d 2e 0a 0a  _get_error()]...
72f0: 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6c 69 73  [list_end]..[lis
7300: 74 5f 65 6e 64 5d 0a 0a 52 65 66 65 72 65 6e 63  t_end]..Referenc
7310: 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e  e implementation
7320: 73 20 6f 66 20 74 68 65 73 65 20 63 61 6c 6c 62  s of these callb
7330: 61 63 6b 73 20 61 72 65 20 70 72 6f 76 69 64 65  acks are provide
7340: 64 20 69 6e 20 5b 66 69 6c 65 20 74 6c 73 2e 74  d in [file tls.t
7350: 63 6c 5d 0a 61 73 20 5b 63 6d 64 20 74 6c 73 3a  cl].as [cmd tls:
7360: 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b 63 6d 64  :callback], [cmd
7370: 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2c   tls::password],
7380: 20 61 6e 64 20 5b 63 6d 64 20 74 6c 73 3a 3a 76   and [cmd tls::v
7390: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
73a0: 0a 72 65 73 70 65 63 74 69 76 65 6c 79 2e 20 4e  .respectively. N
73b0: 6f 74 65 20 74 68 61 74 20 74 68 65 73 65 20 61  ote that these a
73c0: 72 65 20 6f 6e 6c 79 20 5b 65 6d 70 68 20 73 61  re only [emph sa
73d0: 6d 70 6c 65 5d 20 69 6d 70 6c 65 6d 65 6e 74 61  mple] implementa
73e0: 74 69 6f 6e 73 2e 20 49 6e 20 61 20 6d 6f 72 65  tions. In a more
73f0: 0a 72 65 61 6c 69 73 74 69 63 20 64 65 70 6c 6f  .realistic deplo
7400: 79 6d 65 6e 74 20 79 6f 75 20 77 6f 75 6c 64 20  yment you would 
7410: 73 70 65 63 69 66 79 20 79 6f 75 72 20 6f 77 6e  specify your own
7420: 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74   callback script
7430: 73 20 6f 6e 20 65 61 63 68 20 54 4c 53 0a 63 68  s on each TLS.ch
7440: 61 6e 6e 65 6c 20 75 73 69 6e 67 20 74 68 65 20  annel using the 
7450: 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64  [option -command
7460: 5d 2c 20 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73  ], [option -pass
7470: 77 6f 72 64 5d 2c 20 61 6e 64 0a 5b 6f 70 74 69  word], and.[opti
7480: 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f 6d  on -validate_com
7490: 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 73 2e 0a 0a  mand] options...
74a0: 5b 70 61 72 61 5d 0a 0a 54 68 65 20 64 65 66 61  [para]..The defa
74b0: 75 6c 74 20 62 65 68 61 76 69 6f 72 20 77 68 65  ult behavior whe
74c0: 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63  n the [option -c
74d0: 6f 6d 6d 61 6e 64 5d 20 61 6e 64 20 5b 6f 70 74  ommand] and [opt
74e0: 69 6f 6e 20 2d 76 61 6c 69 64 61 74 65 5f 63 6f  ion -validate_co
74f0: 6d 6d 61 6e 64 5d 0a 6f 70 74 69 6f 6e 73 20 61  mmand].options a
7500: 72 65 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64  re not specified
7510: 2c 20 69 73 20 66 6f 72 20 54 63 6c 54 4c 53 20  , is for TclTLS 
7520: 74 6f 20 70 72 6f 63 65 73 73 20 74 68 65 20 61  to process the a
7530: 73 73 6f 63 69 61 74 65 64 20 6c 69 62 72 61 72  ssociated librar
7540: 79 0a 63 61 6c 6c 62 61 63 6b 73 20 69 6e 74 65  y.callbacks inte
7550: 72 6e 61 6c 6c 79 2e 20 54 68 65 20 64 65 66 61  rnally. The defa
7560: 75 6c 74 20 62 65 68 61 76 69 6f 72 20 77 68 65  ult behavior whe
7570: 6e 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 70  n the [option -p
7580: 61 73 73 77 6f 72 64 5d 20 6f 70 74 69 6f 6e 0a  assword] option.
7590: 69 73 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64  is not specified
75a0: 20 69 73 20 66 6f 72 20 54 63 6c 54 4c 53 20 74   is for TclTLS t
75b0: 6f 20 70 72 6f 63 65 73 73 20 74 68 65 20 61 73  o process the as
75c0: 73 6f 63 69 61 74 65 64 20 6c 69 62 72 61 72 79  sociated library
75d0: 20 63 61 6c 6c 62 61 63 6b 73 20 62 79 0a 61 74   callbacks by.at
75e0: 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 61 6c 6c  tempting to call
75f0: 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77   [cmd tls::passw
7600: 6f 72 64 5d 2e 20 54 68 65 20 64 69 66 66 65 72  ord]. The differ
7610: 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65  ence between the
7620: 73 65 20 74 77 6f 0a 62 65 68 61 76 69 6f 72 73  se two.behaviors
7630: 20 69 73 20 61 20 63 6f 6e 73 65 71 75 65 6e 63   is a consequenc
7640: 65 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e 67  e of maintaining
7650: 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 77   compatibility w
7660: 69 74 68 20 65 61 72 6c 69 65 72 0a 69 6d 70 6c  ith earlier.impl
7670: 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a 0a 5b 70  ementations...[p
7680: 61 72 61 5d 0a 0a 5b 65 6d 70 68 20 22 54 68 65  ara]..[emph "The
7690: 20 75 73 65 20 6f 66 20 74 68 65 20 72 65 66 65   use of the refe
76a0: 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73 20  rence callbacks 
76b0: 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61  [cmd tls::callba
76c0: 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a 70  ck], [cmd tls::p
76d0: 61 73 73 77 6f 72 64 5d 2c 0a 61 6e 64 20 5b 63  assword],.and [c
76e0: 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65  md tls::validate
76f0: 5f 63 6f 6d 6d 61 6e 64 5d 20 69 73 20 6e 6f 74  _command] is not
7700: 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 20 54 68   recommended. Th
7710: 65 79 20 6d 61 79 20 62 65 20 72 65 6d 6f 76 65  ey may be remove
7720: 64 20 66 72 6f 6d 20 66 75 74 75 72 65 20 72 65  d from future re
7730: 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b 73 65 63 74  leases."]..[sect
7740: 69 6f 6e 20 44 65 62 75 67 5d 0a 0a 46 6f 72 20  ion Debug]..For 
7750: 6d 6f 73 74 20 64 65 62 75 67 67 69 6e 67 20 6e  most debugging n
7760: 65 65 64 73 2c 20 74 68 65 20 5b 6f 70 74 69 6f  eeds, the [optio
7770: 6e 20 2d 63 61 6c 6c 62 61 63 6b 5d 20 6f 70 74  n -callback] opt
7780: 69 6f 6e 20 63 61 6e 20 62 65 20 75 73 65 64 20  ion can be used 
7790: 74 6f 20 70 72 6f 76 69 64 65 0a 73 75 66 66 69  to provide.suffi
77a0: 63 69 65 6e 74 20 69 6e 73 69 67 68 74 20 61 6e  cient insight an
77b0: 64 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e  d information on
77c0: 20 74 68 65 20 54 4c 53 20 68 61 6e 64 73 68 61   the TLS handsha
77d0: 6b 65 20 61 6e 64 20 70 72 6f 67 72 65 73 73 2e  ke and progress.
77e0: 20 49 66 0a 66 75 72 74 68 65 72 20 74 72 6f 75   If.further trou
77f0: 62 6c 65 73 68 6f 6f 74 69 6e 67 20 69 6e 73 69  bleshooting insi
7800: 67 68 74 20 69 73 20 6e 65 65 64 65 64 2c 20 74  ght is needed, t
7810: 68 65 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 20  he compile time 
7820: 6f 70 74 69 6f 6e 0a 5b 6f 70 74 69 6f 6e 20 2d  option.[option -
7830: 2d 65 6e 61 62 6c 65 2d 64 65 62 75 67 5d 20 63  -enable-debug] c
7840: 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 67 65  an be used to ge
7850: 74 20 64 65 74 61 69 6c 65 64 20 65 78 65 63 75  t detailed execu
7860: 74 69 6f 6e 20 66 6c 6f 77 20 73 74 61 74 75 73  tion flow status
7870: 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54 4c 53 20 6b  ...[para]..TLS k
7880: 65 79 20 6c 6f 67 67 69 6e 67 20 63 61 6e 20 62  ey logging can b
7890: 65 20 65 6e 61 62 6c 65 64 20 62 79 20 73 65 74  e enabled by set
78a0: 74 69 6e 67 20 74 68 65 20 65 6e 76 69 72 6f 6e  ting the environ
78b0: 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 0a 5b 76  ment variable.[v
78c0: 61 72 20 53 53 4c 4b 45 59 4c 4f 47 46 49 4c 45  ar SSLKEYLOGFILE
78d0: 5d 20 74 6f 20 74 68 65 20 6e 61 6d 65 20 6f 66  ] to the name of
78e0: 20 74 68 65 20 66 69 6c 65 20 74 6f 20 6c 6f 67   the file to log
78f0: 20 74 6f 2e 20 54 68 65 6e 20 77 68 65 6e 65 76   to. Then whenev
7900: 65 72 20 54 4c 53 20 6b 65 79 0a 6d 61 74 65 72  er TLS key.mater
7910: 69 61 6c 20 69 73 20 67 65 6e 65 72 61 74 65 64  ial is generated
7920: 20 6f 72 20 72 65 63 65 69 76 65 64 20 69 74 20   or received it 
7930: 77 69 6c 6c 20 62 65 20 6c 6f 67 67 65 64 20 74  will be logged t
7940: 6f 20 74 68 65 20 66 69 6c 65 2e 20 54 68 69 73  o the file. This
7950: 20 69 73 20 75 73 65 66 75 6c 0a 66 6f 72 20 6c   is useful.for l
7960: 6f 67 67 69 6e 67 20 6b 65 79 20 64 61 74 61 20  ogging key data 
7970: 66 6f 72 20 6e 65 74 77 6f 72 6b 20 6c 6f 67 67  for network logg
7980: 69 6e 67 20 74 6f 6f 6c 73 20 74 6f 20 75 73 65  ing tools to use
7990: 20 74 6f 20 64 65 63 72 79 70 74 20 74 68 65 20   to decrypt the 
79a0: 64 61 74 61 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 54  data...[para]..T
79b0: 68 65 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62  he [var tls::deb
79c0: 75 67 5d 20 76 61 72 69 61 62 6c 65 20 70 72 6f  ug] variable pro
79d0: 76 69 64 65 73 20 73 6f 6d 65 20 61 64 64 69 74  vides some addit
79e0: 69 6f 6e 61 6c 20 63 6f 6e 74 72 6f 6c 20 6f 76  ional control ov
79f0: 65 72 20 74 68 65 73 65 0a 72 65 66 65 72 65 6e  er these.referen
7a00: 63 65 20 63 61 6c 6c 62 61 63 6b 73 2e 20 49 74  ce callbacks. It
7a10: 73 20 76 61 6c 75 65 20 69 73 20 7a 65 72 6f 20  s value is zero 
7a20: 62 79 20 64 65 66 61 75 6c 74 2e 20 48 69 67 68  by default. High
7a30: 65 72 20 76 61 6c 75 65 73 20 70 72 6f 64 75 63  er values produc
7a40: 65 20 6d 6f 72 65 0a 64 69 61 67 6e 6f 73 74 69  e more.diagnosti
7a50: 63 20 6f 75 74 70 75 74 2c 20 61 6e 64 20 77 69  c output, and wi
7a60: 6c 6c 20 61 6c 73 6f 20 66 6f 72 63 65 20 74 68  ll also force th
7a70: 65 20 76 65 72 69 66 79 20 6d 65 74 68 6f 64 20  e verify method 
7a80: 69 6e 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c  in [cmd tls::cal
7a90: 6c 62 61 63 6b 5d 0a 74 6f 20 61 63 63 65 70 74  lback].to accept
7aa0: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
7ab0: 2c 20 65 76 65 6e 20 77 68 65 6e 20 69 74 20 69  , even when it i
7ac0: 73 20 69 6e 76 61 6c 69 64 20 69 66 20 74 68 65  s invalid if the
7ad0: 0a 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61  .[option -valida
7ae0: 74 65 63 6f 6d 6d 61 6e 64 5d 20 6f 70 74 69 6f  tecommand] optio
7af0: 6e 20 69 73 20 73 65 74 20 74 6f 20 5b 63 6d 64  n is set to [cmd
7b00: 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63   tls::validate_c
7b10: 6f 6d 6d 61 6e 64 5d 2e 0a 0a 5b 70 61 72 61 5d  ommand]...[para]
7b20: 0a 0a 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65  ..[emph "The use
7b30: 20 6f 66 20 74 68 65 20 76 61 72 69 61 62 6c 65   of the variable
7b40: 20 5b 76 61 72 20 74 6c 73 3a 3a 64 65 62 75 67   [var tls::debug
7b50: 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65  ] is not recomme
7b60: 6e 64 65 64 2e 0a 49 74 20 6d 61 79 20 62 65 20  nded..It may be 
7b70: 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20 66 75 74  removed from fut
7b80: 75 72 65 20 72 65 6c 65 61 73 65 73 2e 22 5d 0a  ure releases."].
7b90: 0a 5b 73 65 63 74 69 6f 6e 20 22 44 65 62 75 67  .[section "Debug
7ba0: 20 45 78 61 6d 70 6c 65 73 22 5d 0a 0a 54 68 65   Examples"]..The
7bb0: 73 65 20 65 78 61 6d 70 6c 65 73 20 75 73 65 20  se examples use 
7bc0: 74 68 65 20 64 65 66 61 75 6c 74 20 55 6e 69 78  the default Unix
7bd0: 20 70 6c 61 74 66 6f 72 6d 20 53 53 4c 20 63 65   platform SSL ce
7be0: 72 74 69 66 69 63 61 74 65 73 2e 20 46 6f 72 20  rtificates. For 
7bf0: 73 74 61 6e 64 61 72 64 0a 69 6e 73 74 61 6c 6c  standard.install
7c00: 61 74 69 6f 6e 73 2c 20 2d 63 61 64 69 72 20 61  ations, -cadir a
7c10: 6e 64 20 2d 63 61 66 69 6c 65 20 73 68 6f 75 6c  nd -cafile shoul
7c20: 64 20 6e 6f 74 20 62 65 20 6e 65 65 64 65 64 2e  d not be needed.
7c30: 20 49 66 20 79 6f 75 72 20 63 65 72 74 69 66 69   If your certifi
7c40: 63 61 74 65 73 0a 61 72 65 20 69 6e 20 6e 6f 6e  cates.are in non
7c50: 2d 73 74 61 6e 64 61 72 64 20 6c 6f 63 61 74 69  -standard locati
7c60: 6f 6e 73 2c 20 73 70 65 63 69 66 79 20 2d 63 61  ons, specify -ca
7c70: 64 69 72 20 6f 72 20 2d 63 61 66 69 6c 65 20 61  dir or -cafile a
7c80: 73 20 6e 65 65 64 65 64 2e 0a 0a 5b 70 61 72 61  s needed...[para
7c90: 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 31 3a 20 55  ]..Example #1: U
7ca0: 73 65 20 48 54 54 50 20 70 61 63 6b 61 67 65 0a  se HTTP package.
7cb0: 0a 5b 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63  .[example {..pac
7cc0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 68 74 74  kage require htt
7cd0: 70 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  p.package requir
7ce0: 65 20 74 6c 73 0a 73 65 74 20 75 72 6c 20 22 68  e tls.set url "h
7cf0: 74 74 70 73 3a 2f 2f 77 77 77 2e 74 63 6c 2e 74  ttps://www.tcl.t
7d00: 6b 2f 22 0a 0a 68 74 74 70 3a 3a 72 65 67 69 73  k/"..http::regis
7d10: 74 65 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c  ter https 443 [l
7d20: 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65  ist ::tls::socke
7d30: 74 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d  t -autoservernam
7d40: 65 20 31 20 2d 72 65 71 75 69 72 65 20 31 20 5c  e 1 -require 1 \
7d50: 0a 20 20 20 20 2d 63 6f 6d 6d 61 6e 64 20 3a 3a  .    -command ::
7d60: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 20 2d 70  tls::callback -p
7d70: 61 73 73 77 6f 72 64 20 3a 3a 74 6c 73 3a 3a 70  assword ::tls::p
7d80: 61 73 73 77 6f 72 64 20 5c 0a 20 20 20 20 2d 76  assword \.    -v
7d90: 61 6c 69 64 61 74 65 63 6f 6d 6d 61 6e 64 20 3a  alidatecommand :
7da0: 3a 74 6c 73 3a 3a 76 61 6c 69 64 61 74 65 5f 63  :tls::validate_c
7db0: 6f 6d 6d 61 6e 64 5d 0a 0a 23 20 43 68 65 63 6b  ommand]..# Check
7dc0: 20 66 6f 72 20 65 72 72 6f 72 0a 73 65 74 20 74   for error.set t
7dd0: 6f 6b 65 6e 20 5b 68 74 74 70 3a 3a 67 65 74 75  oken [http::getu
7de0: 72 6c 20 24 75 72 6c 5d 0a 69 66 20 7b 5b 68 74  rl $url].if {[ht
7df0: 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65  tp::status $toke
7e00: 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20 20  n] ne "ok"} {.  
7e10: 20 20 70 75 74 73 20 5b 66 6f 72 6d 61 74 20 22    puts [format "
7e20: 45 72 72 6f 72 20 25 73 22 20 5b 68 74 74 70 3a  Error %s" [http:
7e30: 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 5d  :status $token]]
7e40: 0a 7d 0a 0a 23 20 47 65 74 20 77 65 62 20 70 61  .}..# Get web pa
7e50: 67 65 0a 73 65 74 20 64 61 74 61 20 5b 68 74 74  ge.set data [htt
7e60: 70 3a 3a 64 61 74 61 20 24 74 6f 6b 65 6e 5d 0a  p::data $token].
7e70: 70 75 74 73 20 5b 73 74 72 69 6e 67 20 6c 65 6e  puts [string len
7e80: 67 74 68 20 24 64 61 74 61 5d 0a 0a 23 20 43 6c  gth $data]..# Cl
7e90: 65 61 6e 75 70 0a 3a 3a 68 74 74 70 3a 3a 63 6c  eanup.::http::cl
7ea0: 65 61 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a  eanup $token.}].
7eb0: 0a 45 78 61 6d 70 6c 65 20 23 32 3a 20 55 73 65  .Example #2: Use
7ec0: 20 72 61 77 20 73 6f 63 6b 65 74 0a 0a 5b 65 78   raw socket..[ex
7ed0: 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65  ample {..package
7ee0: 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 73 65   require tls..se
7ef0: 74 20 75 72 6c 20 22 77 77 77 2e 74 63 6c 2d 6c  t url "www.tcl-l
7f00: 61 6e 67 2e 6f 72 67 22 0a 73 65 74 20 70 6f 72  ang.org".set por
7f10: 74 20 34 34 33 0a 0a 73 65 74 20 63 68 20 5b 74  t 443..set ch [t
7f20: 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f  ls::socket -auto
7f30: 73 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 73 65  servername 1 -se
7f40: 72 76 65 72 6e 61 6d 65 20 24 75 72 6c 20 2d 72  rvername $url -r
7f50: 65 71 75 69 72 65 20 31 20 5c 0a 20 20 20 20 2d  equire 1 \.    -
7f60: 61 6c 70 6e 20 7b 68 74 74 70 2f 31 2e 31 7d 20  alpn {http/1.1} 
7f70: 2d 63 6f 6d 6d 61 6e 64 20 3a 3a 74 6c 73 3a 3a  -command ::tls::
7f80: 63 61 6c 6c 62 61 63 6b 20 2d 70 61 73 73 77 6f  callback -passwo
7f90: 72 64 20 3a 3a 74 6c 73 3a 3a 70 61 73 73 77 6f  rd ::tls::passwo
7fa0: 72 64 20 5c 0a 20 20 20 20 2d 76 61 6c 69 64 61  rd \.    -valida
7fb0: 74 65 63 6f 6d 6d 61 6e 64 20 3a 3a 74 6c 73 3a  tecommand ::tls:
7fc0: 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e  :validate_comman
7fd0: 64 20 24 75 72 6c 20 24 70 6f 72 74 5d 0a 63 68  d $url $port].ch
7fe0: 61 6e 20 63 6f 6e 66 69 67 75 72 65 20 24 63 68  an configure $ch
7ff0: 20 2d 62 75 66 66 65 72 73 69 7a 65 20 36 35 35   -buffersize 655
8000: 33 36 0a 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b  36.tls::handshak
8010: 65 20 24 63 68 0a 0a 70 75 74 73 20 24 63 68 20  e $ch..puts $ch 
8020: 22 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 22  "GET / HTTP/1.1"
8030: 0a 66 6c 75 73 68 20 24 63 68 0a 61 66 74 65 72  .flush $ch.after
8040: 20 35 30 30 0a 73 65 74 20 64 61 74 61 20 5b 72   500.set data [r
8050: 65 61 64 20 24 63 68 5d 0a 0a 61 72 72 61 79 20  ead $ch]..array 
8060: 73 65 74 20 73 74 61 74 75 73 20 5b 74 6c 73 3a  set status [tls:
8070: 3a 73 74 61 74 75 73 20 24 63 68 5d 0a 61 72 72  :status $ch].arr
8080: 61 79 20 73 65 74 20 63 6f 6e 6e 20 5b 74 6c 73  ay set conn [tls
8090: 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 20 24 63 68  ::connection $ch
80a0: 5d 0a 61 72 72 61 79 20 73 65 74 20 63 68 61 6e  ].array set chan
80b0: 20 5b 63 68 61 6e 20 63 6f 6e 66 69 67 75 72 65   [chan configure
80c0: 20 24 63 68 5d 0a 63 6c 6f 73 65 20 24 63 68 0a   $ch].close $ch.
80d0: 70 61 72 72 61 79 20 73 74 61 74 75 73 0a 70 61  parray status.pa
80e0: 72 72 61 79 20 63 6f 6e 6e 0a 70 61 72 72 61 79  rray conn.parray
80f0: 20 63 68 61 6e 0a 7d 5d 0a 0a 5b 73 65 63 74 69   chan.}]..[secti
8100: 6f 6e 20 22 48 54 54 50 20 50 61 63 6b 61 67 65  on "HTTP Package
8110: 20 45 78 61 6d 70 6c 65 73 22 5d 0a 0a 54 68 65   Examples"]..The
8120: 73 65 20 65 78 61 6d 70 6c 65 73 20 75 73 65 20  se examples use 
8130: 74 68 65 20 64 65 66 61 75 6c 74 20 55 6e 69 78  the default Unix
8140: 20 70 6c 61 74 66 6f 72 6d 20 53 53 4c 20 63 65   platform SSL ce
8150: 72 74 69 66 69 63 61 74 65 73 2e 20 46 6f 72 20  rtificates. For 
8160: 73 74 61 6e 64 61 72 64 0a 69 6e 73 74 61 6c 6c  standard.install
8170: 61 74 69 6f 6e 73 2c 20 2d 63 61 64 69 72 20 61  ations, -cadir a
8180: 6e 64 20 2d 63 61 66 69 6c 65 20 73 68 6f 75 6c  nd -cafile shoul
8190: 64 20 6e 6f 74 20 62 65 20 6e 65 65 64 65 64 2e  d not be needed.
81a0: 20 49 66 20 79 6f 75 72 20 63 65 72 74 69 66 69   If your certifi
81b0: 63 61 74 65 73 0a 61 72 65 20 69 6e 20 6e 6f 6e  cates.are in non
81c0: 2d 73 74 61 6e 64 61 72 64 20 6c 6f 63 61 74 69  -standard locati
81d0: 6f 6e 73 2c 20 73 65 74 20 2d 63 61 64 69 72 20  ons, set -cadir 
81e0: 6f 72 20 75 73 65 20 2d 63 61 66 69 6c 65 20 61  or use -cafile a
81f0: 73 20 6e 65 65 64 65 64 2e 0a 0a 5b 70 61 72 61  s needed...[para
8200: 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 33 3a 20 47  ]..Example #3: G
8210: 65 74 20 77 65 62 20 70 61 67 65 0a 0a 5b 65 78  et web page..[ex
8220: 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65  ample {..package
8230: 20 72 65 71 75 69 72 65 20 68 74 74 70 0a 70 61   require http.pa
8240: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 74 6c  ckage require tl
8250: 73 0a 73 65 74 20 75 72 6c 20 22 68 74 74 70 73  s.set url "https
8260: 3a 2f 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a  ://www.tcl.tk/".
8270: 0a 68 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20  .http::register 
8280: 68 74 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20  https 443 [list 
8290: 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61  ::tls::socket -a
82a0: 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 20 31 20  utoservername 1 
82b0: 2d 72 65 71 75 69 72 65 20 31 5d 0a 0a 23 20 43  -require 1]..# C
82c0: 68 65 63 6b 20 66 6f 72 20 65 72 72 6f 72 0a 73  heck for error.s
82d0: 65 74 20 74 6f 6b 65 6e 20 5b 68 74 74 70 3a 3a  et token [http::
82e0: 67 65 74 75 72 6c 20 24 75 72 6c 5d 0a 69 66 20  geturl $url].if 
82f0: 7b 5b 68 74 74 70 3a 3a 73 74 61 74 75 73 20 24  {[http::status $
8300: 74 6f 6b 65 6e 5d 20 6e 65 20 22 6f 6b 22 7d 20  token] ne "ok"} 
8310: 7b 0a 20 20 20 20 70 75 74 73 20 5b 66 6f 72 6d  {.    puts [form
8320: 61 74 20 22 45 72 72 6f 72 20 25 73 22 20 5b 68  at "Error %s" [h
8330: 74 74 70 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b  ttp::status $tok
8340: 65 6e 5d 5d 0a 7d 0a 0a 23 20 47 65 74 20 77 65  en]].}..# Get we
8350: 62 20 70 61 67 65 0a 73 65 74 20 64 61 74 61 20  b page.set data 
8360: 5b 68 74 74 70 3a 3a 64 61 74 61 20 24 74 6f 6b  [http::data $tok
8370: 65 6e 5d 0a 70 75 74 73 20 24 64 61 74 61 0a 0a  en].puts $data..
8380: 23 20 43 6c 65 61 6e 75 70 0a 3a 3a 68 74 74 70  # Cleanup.::http
8390: 3a 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e  ::cleanup $token
83a0: 0a 7d 5d 0a 0a 45 78 61 6d 70 6c 65 20 23 34 3a  .}]..Example #4:
83b0: 20 44 6f 77 6e 6c 6f 61 64 20 66 69 6c 65 0a 0a   Download file..
83c0: 5b 65 78 61 6d 70 6c 65 20 7b 0a 0a 70 61 63 6b  [example {..pack
83d0: 61 67 65 20 72 65 71 75 69 72 65 20 68 74 74 70  age require http
83e0: 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  .package require
83f0: 20 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20 22 68   tls..set url "h
8400: 74 74 70 73 3a 2f 2f 77 69 6b 69 2e 74 63 6c 2d  ttps://wiki.tcl-
8410: 6c 61 6e 67 2e 6f 72 67 2f 73 69 74 65 6d 61 70  lang.org/sitemap
8420: 2e 78 6d 6c 22 0a 73 65 74 20 66 69 6c 65 6e 61  .xml".set filena
8430: 6d 65 20 5b 66 69 6c 65 20 74 61 69 6c 20 24 75  me [file tail $u
8440: 72 6c 5d 0a 0a 68 74 74 70 3a 3a 72 65 67 69 73  rl]..http::regis
8450: 74 65 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c  ter https 443 [l
8460: 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65  ist ::tls::socke
8470: 74 20 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d  t -autoservernam
8480: 65 20 31 20 2d 72 65 71 75 69 72 65 20 31 5d 0a  e 1 -require 1].
8490: 0a 23 20 47 65 74 20 66 69 6c 65 0a 73 65 74 20  .# Get file.set 
84a0: 63 68 20 5b 6f 70 65 6e 20 24 66 69 6c 65 6e 61  ch [open $filena
84b0: 6d 65 20 77 62 5d 0a 73 65 74 20 74 6f 6b 65 6e  me wb].set token
84c0: 20 5b 3a 3a 68 74 74 70 3a 3a 67 65 74 75 72 6c   [::http::geturl
84d0: 20 24 75 72 6c 20 2d 62 6c 6f 63 6b 73 69 7a 65   $url -blocksize
84e0: 20 36 35 35 33 36 20 2d 63 68 61 6e 6e 65 6c 20   65536 -channel 
84f0: 24 63 68 5d 0a 0a 23 20 43 6c 65 61 6e 75 70 0a  $ch]..# Cleanup.
8500: 63 6c 6f 73 65 20 24 63 68 0a 3a 3a 68 74 74 70  close $ch.::http
8510: 3a 3a 63 6c 65 61 6e 75 70 20 24 74 6f 6b 65 6e  ::cleanup $token
8520: 0a 7d 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 53  .}]..[section "S
8530: 70 65 63 69 61 6c 20 43 6f 6e 73 69 64 65 72 61  pecial Considera
8540: 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 63 61 70  tions"]..The cap
8550: 61 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69  abilities of thi
8560: 73 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61  s package can va
8570: 72 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61  ry enormously ba
8580: 73 65 64 20 75 70 6f 6e 20 68 6f 77 20 74 68 65  sed upon how the
8590: 0a 6c 69 6e 6b 65 64 20 74 6f 20 4f 70 65 6e 53  .linked to OpenS
85a0: 53 4c 20 6c 69 62 72 61 72 79 20 77 61 73 20 63  SL library was c
85b0: 6f 6e 66 69 67 75 72 65 64 20 61 6e 64 20 62 75  onfigured and bu
85c0: 69 6c 74 2e 20 4e 65 77 20 76 65 72 73 69 6f 6e  ilt. New version
85d0: 73 20 6d 61 79 20 6f 62 73 6f 6c 65 74 65 0a 6f  s may obsolete.o
85e0: 6c 64 65 72 20 70 72 6f 74 6f 63 6f 6c 20 76 65  lder protocol ve
85f0: 72 73 69 6f 6e 73 2c 20 61 64 64 20 6f 72 20 72  rsions, add or r
8600: 65 6d 6f 76 65 20 63 69 70 68 65 72 73 2c 20 63  emove ciphers, c
8610: 68 61 6e 67 65 20 64 65 66 61 75 6c 74 20 76 61  hange default va
8620: 6c 75 65 73 2c 20 65 74 63 2e 0a 55 73 65 20 74  lues, etc..Use t
8630: 68 65 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f  he [cmd tls::pro
8640: 74 6f 63 6f 6c 73 5d 20 63 6f 6d 6d 61 6e 64 73  tocols] commands
8650: 20 74 6f 20 6f 62 74 61 69 6e 20 74 68 65 20 73   to obtain the s
8660: 75 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f  upported.protoco
8670: 6c 20 76 65 72 73 69 6f 6e 73 2e 0a 0a 5b 6d 61  l versions...[ma
8680: 6e 70 61 67 65 5f 65 6e 64 5d 0a                 npage_end].