Hex Artifact Content

Artifact 3e3e507451416fbb2b57a832f2c533810d952cbcc942ccd0fa13b454d0b82abc:


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 0a 5b 6f 70 74 5f 64 65 66  ocols...[opt_def
2240: 20 2d 73 73 6c 33 20 5b 61 72 67 20 62 6f 6f 6c   -ssl3 [arg bool
2250: 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66  ]].Enable use of
2260: 20 53 53 4c 20 76 33 2e 20 54 68 65 20 64 65 66   SSL v3. The def
2270: 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74 20 66  ault is [const f
2280: 61 6c 73 65 5d 2e 20 4e 6f 74 65 3a 20 52 65 63  alse]. Note: Rec
2290: 65 6e 74 20 76 65 72 73 69 6f 6e 73 0a 6f 66 20  ent versions.of 
22a0: 4f 70 65 6e 53 53 4c 20 6d 61 79 20 68 61 76 65  OpenSSL may have
22b0: 20 74 68 69 73 20 64 69 73 61 62 6c 65 64 20 61   this disabled a
22c0: 74 20 63 6f 6d 70 69 6c 65 20 74 69 6d 65 2c 20  t compile time, 
22d0: 73 6f 20 74 68 69 73 20 6d 61 79 20 6e 6f 74 20  so this may not 
22e0: 68 61 76 65 20 61 6e 79 0a 65 66 66 65 63 74 2e  have any.effect.
22f0: 20 53 65 65 20 74 68 65 20 5b 63 6d 64 20 74 6c   See the [cmd tl
2300: 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f  s::protocols] co
2310: 6d 6d 61 6e 64 20 66 6f 72 20 73 75 70 70 6f 72  mmand for suppor
2320: 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73 2e 0a 0a  ted protocols...
2330: 5b 6f 70 74 5f 64 65 66 20 2d 74 6c 73 31 20 5b  [opt_def -tls1 [
2340: 61 72 67 20 62 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c  arg bool]].Enabl
2350: 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e  e use of TLS v1.
2360: 20 54 68 65 20 64 65 66 61 75 6c 74 20 69 73 20   The default is 
2370: 5b 63 6f 6e 73 74 20 74 72 75 65 5d 2e 20 4e 6f  [const true]. No
2380: 74 65 3a 20 54 4c 53 20 31 2e 30 20 6e 65 65 64  te: TLS 1.0 need
2390: 73 0a 53 48 41 31 20 74 6f 20 6f 70 65 72 61 74  s.SHA1 to operat
23a0: 65 2c 20 77 68 69 63 68 20 69 73 20 6f 6e 6c 79  e, which is only
23b0: 20 61 76 61 69 6c 61 62 6c 65 20 69 6e 20 73 65   available in se
23c0: 63 75 72 69 74 79 20 6c 65 76 65 6c 20 30 20 66  curity level 0 f
23d0: 6f 72 20 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b  or Open SSL 3.0+
23e0: 2e 0a 53 65 65 20 74 68 65 20 5b 61 72 67 20 2d  ..See the [arg -
23f0: 73 65 63 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20  security_level] 
2400: 6f 70 74 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65  option...[opt_de
2410: 66 20 2d 74 6c 73 31 2e 31 20 5b 61 72 67 20 62  f -tls1.1 [arg b
2420: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
2430: 20 6f 66 20 54 4c 53 20 76 31 2e 31 2e 20 54 68   of TLS v1.1. Th
2440: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
2450: 6e 73 74 20 74 72 75 65 5d 2e 20 4e 6f 74 65 3a  nst true]. Note:
2460: 20 54 4c 53 20 31 2e 31 20 6e 65 65 64 73 0a 53   TLS 1.1 needs.S
2470: 48 41 31 20 74 6f 20 6f 70 65 72 61 74 65 2c 20  HA1 to operate, 
2480: 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 61 76  which is only av
2490: 61 69 6c 61 62 6c 65 20 69 6e 20 73 65 63 75 72  ailable in secur
24a0: 69 74 79 20 6c 65 76 65 6c 20 30 20 66 6f 72 20  ity level 0 for 
24b0: 4f 70 65 6e 20 53 53 4c 20 33 2e 30 2b 2e 0a 53  Open SSL 3.0+..S
24c0: 65 65 20 74 68 65 20 5b 61 72 67 20 2d 73 65 63  ee the [arg -sec
24d0: 75 72 69 74 79 5f 6c 65 76 65 6c 5d 20 6f 70 74  urity_level] opt
24e0: 69 6f 6e 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d  ion...[opt_def -
24f0: 74 6c 73 31 2e 32 20 5b 61 72 67 20 62 6f 6f 6c  tls1.2 [arg bool
2500: 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65 20 6f 66  ]].Enable use of
2510: 20 54 4c 53 20 76 31 2e 32 2e 20 54 68 65 20 64   TLS v1.2. The d
2520: 65 66 61 75 6c 74 20 69 73 20 5b 63 6f 6e 73 74  efault is [const
2530: 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74 5f 64 65   true]...[opt_de
2540: 66 20 2d 74 6c 73 31 2e 33 20 5b 61 72 67 20 62  f -tls1.3 [arg b
2550: 6f 6f 6c 5d 5d 0a 45 6e 61 62 6c 65 20 75 73 65  ool]].Enable use
2560: 20 6f 66 20 54 4c 53 20 76 31 2e 33 2e 20 54 68   of TLS v1.3. Th
2570: 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63 6f  e default is [co
2580: 6e 73 74 20 74 72 75 65 5d 2e 0a 0a 5b 6f 70 74  nst true]...[opt
2590: 5f 64 65 66 20 2d 76 61 6c 69 64 61 74 65 63 6f  _def -validateco
25a0: 6d 6d 61 6e 64 20 5b 61 72 67 20 63 61 6c 6c 62  mmand [arg callb
25b0: 61 63 6b 5d 5d 0a 53 70 65 63 69 66 69 65 73 20  ack]].Specifies 
25c0: 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 63 6f 6d  the callback com
25d0: 6d 61 6e 64 20 74 6f 20 69 6e 76 6f 6b 65 20 74  mand to invoke t
25e0: 6f 20 76 61 6c 69 64 61 74 65 20 74 68 65 20 70  o validate the p
25f0: 65 65 72 20 63 65 72 74 69 66 69 63 61 74 65 73  eer certificates
2600: 0a 61 6e 64 20 6f 74 68 65 72 20 63 6f 6e 66 69  .and other confi
2610: 67 20 69 6e 66 6f 20 64 75 72 69 6e 67 20 74 68  g info during th
2620: 65 20 70 72 6f 74 6f 63 6f 6c 20 6e 65 67 6f 74  e protocol negot
2630: 69 61 74 69 6f 6e 20 70 68 61 73 65 2e 20 54 68  iation phase. Th
2640: 69 73 20 63 61 6e 20 62 65 20 75 73 65 64 0a 62  is can be used.b
2650: 79 20 54 43 4c 20 73 63 72 69 70 74 73 20 74 6f  y TCL scripts to
2660: 20 70 65 72 66 6f 72 6d 20 74 68 65 69 72 20 6f   perform their o
2670: 77 6e 20 43 65 72 74 69 66 69 63 61 74 65 20 56  wn Certificate V
2680: 61 6c 69 64 61 74 69 6f 6e 20 74 6f 20 73 75 70  alidation to sup
2690: 70 6c 65 6d 65 6e 74 20 74 68 65 0a 64 65 66 61  plement the.defa
26a0: 75 6c 74 20 76 61 6c 69 64 61 74 69 6f 6e 20 70  ult validation p
26b0: 72 6f 76 69 64 65 64 20 62 79 20 4f 70 65 6e 53  rovided by OpenS
26c0: 53 4c 2e 20 54 68 65 20 73 63 72 69 70 74 20 6d  SL. The script m
26d0: 75 73 74 20 72 65 74 75 72 6e 20 61 20 62 6f 6f  ust return a boo
26e0: 6c 65 61 6e 20 74 72 75 65 0a 74 6f 20 63 6f 6e  lean true.to con
26f0: 74 69 6e 75 65 20 74 68 65 20 6e 65 67 6f 74 69  tinue the negoti
2700: 61 74 69 6f 6e 2e 20 53 65 65 20 5b 73 65 63 74  ation. See [sect
2710: 72 65 66 20 22 43 61 6c 6c 62 61 63 6b 20 4f 70  ref "Callback Op
2720: 74 69 6f 6e 73 22 5d 20 66 6f 72 20 6d 6f 72 65  tions"] for more
2730: 20 69 6e 66 6f 2e 0a 0a 5b 6c 69 73 74 5f 65 6e   info...[list_en
2740: 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74  d]..[call [cmd t
2750: 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 5d 20 5b 61  ls::unimport] [a
2760: 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 43 6f  rg channel]]..Co
2770: 6d 70 6c 69 6d 65 6e 74 20 74 6f 20 5b 63 6d 64  mpliment to [cmd
2780: 20 74 6c 73 3a 3a 69 6d 70 6f 72 74 5d 2e 20 55   tls::import]. U
2790: 73 65 64 20 74 6f 20 72 65 6d 6f 76 65 20 74 68  sed to remove th
27a0: 65 20 74 6f 70 20 6c 65 76 65 6c 20 73 74 61 63  e top level stac
27b0: 6b 65 64 20 63 68 61 6e 6e 65 6c 0a 66 72 6f 6d  ked channel.from
27c0: 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 2e 20   [arg channel]. 
27d0: 54 68 69 73 20 75 6e 73 74 61 63 6b 73 20 74 68  This unstacks th
27e0: 65 20 65 6e 63 72 79 70 74 69 6f 6e 20 6f 66 20  e encryption of 
27f0: 61 20 72 65 67 75 6c 61 72 20 54 43 4c 20 63 68  a regular TCL ch
2800: 61 6e 6e 65 6c 2e 20 41 6e 0a 65 72 72 6f 72 20  annel. An.error 
2810: 69 73 20 74 68 72 6f 77 6e 20 69 66 20 54 4c 53  is thrown if TLS
2820: 20 69 73 20 6e 6f 74 20 74 68 65 20 74 6f 70 20   is not the top 
2830: 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 20  stacked channel 
2840: 74 79 70 65 2e 0a 0a 5b 63 61 6c 6c 20 5b 63 6d  type...[call [cm
2850: 64 20 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65  d tls::handshake
2860: 5d 20 5b 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d  ] [arg channel]]
2870: 0a 0a 46 6f 72 63 65 73 20 74 68 65 20 54 4c 53  ..Forces the TLS
2880: 20 6e 65 67 6f 74 69 61 74 69 6f 6e 20 68 61 6e   negotiation han
2890: 64 73 68 61 6b 65 20 74 6f 20 74 61 6b 65 20 70  dshake to take p
28a0: 6c 61 63 65 20 69 6d 6d 65 64 69 61 74 65 6c 79  lace immediately
28b0: 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 30 0a  , and returns 0.
28c0: 69 66 20 68 61 6e 64 73 68 61 6b 65 20 69 73 20  if handshake is 
28d0: 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65 73  still in progres
28e0: 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 29  s (non-blocking)
28f0: 2c 20 6f 72 20 31 20 69 66 20 74 68 65 20 68 61  , or 1 if the ha
2900: 6e 64 73 68 61 6b 65 20 77 61 73 0a 73 75 63 63  ndshake was.succ
2910: 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65 20 68  essful. If the h
2920: 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65 64 2c  andshake failed,
2930: 20 61 6e 20 65 72 72 6f 72 20 77 69 6c 6c 20 62   an error will b
2940: 65 20 72 65 74 75 72 6e 65 64 2e 0a 0a 5b 63 61  e returned...[ca
2950: 6c 6c 20 5b 63 6d 64 20 74 6c 73 3a 3a 73 74 61  ll [cmd tls::sta
2960: 74 75 73 5d 20 5b 6f 70 74 20 5b 6f 70 74 69 6f  tus] [opt [optio
2970: 6e 20 2d 6c 6f 63 61 6c 5d 5d 20 5b 61 72 67 20  n -local]] [arg 
2980: 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52 65 74 75 72  channel]]..Retur
2990: 6e 73 20 74 68 65 20 63 75 72 72 65 6e 74 20 73  ns the current s
29a0: 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20  tatus of an SSL 
29b0: 63 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73  channel. The res
29c0: 75 6c 74 20 69 73 20 61 20 6c 69 73 74 20 6f 66  ult is a list of
29d0: 20 6b 65 79 2d 76 61 6c 75 65 0a 70 61 69 72 73   key-value.pairs
29e0: 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20   describing the 
29f0: 53 53 4c 2c 20 63 65 72 74 69 66 69 63 61 74 65  SSL, certificate
2a00: 2c 20 61 6e 64 20 63 65 72 74 69 66 69 63 61 74  , and certificat
2a10: 65 20 76 65 72 69 66 69 63 61 74 69 6f 6e 20 73  e verification s
2a20: 74 61 74 75 73 2e 20 49 66 0a 74 68 65 20 53 53  tatus. If.the SS
2a30: 4c 20 68 61 6e 64 73 68 61 6b 65 20 68 61 73 20  L handshake has 
2a40: 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65 74 65  not yet complete
2a50: 64 2c 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 74  d, an empty list
2a60: 20 69 73 20 72 65 74 75 72 6e 65 64 2e 20 49 66   is returned. If
2a70: 20 74 68 65 0a 5b 6f 70 74 69 6f 6e 20 2d 6c 6f   the.[option -lo
2a80: 63 61 6c 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73  cal] option is s
2a90: 70 65 63 69 66 69 65 64 2c 20 74 68 65 6e 20 74  pecified, then t
2aa0: 68 65 20 6c 6f 63 61 6c 20 63 65 72 74 69 66 69  he local certifi
2ab0: 63 61 74 65 20 69 73 20 75 73 65 64 2e 20 52 65  cate is used. Re
2ac0: 74 75 72 6e 65 64 0a 76 61 6c 75 65 73 20 69 6e  turned.values in
2ad0: 63 6c 75 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a  clude:..[para]..
2ae0: 53 53 4c 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73  SSL Status..[lis
2af0: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
2b00: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ons]..[def "[var
2b10: 20 61 6c 70 6e 5d 20 5b 61 72 67 20 70 72 6f 74   alpn] [arg prot
2b20: 6f 63 6f 6c 5d 22 5d 0a 54 68 65 20 70 72 6f 74  ocol]"].The prot
2b30: 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20 61 66  ocol selected af
2b40: 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d  ter Application-
2b50: 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c 20 4e  Layer Protocol N
2b60: 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e  egotiation (ALPN
2b70: 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  )...[def "[var c
2b80: 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69 70 68  ipher] [arg ciph
2b90: 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72 65 6e  er]"].The curren
2ba0: 74 20 63 69 70 68 65 72 20 69 6e 20 75 73 65 20  t cipher in use 
2bb0: 66 6f 72 20 74 68 65 20 73 65 73 73 69 6f 6e 2e  for the session.
2bc0: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 70 65 65  ..[def "[var pee
2bd0: 72 6e 61 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65  rname] [arg name
2be0: 5d 22 5d 0a 54 68 65 20 70 65 65 72 6e 61 6d 65  ]"].The peername
2bf0: 20 66 72 6f 6d 20 74 68 65 20 63 65 72 74 69 66   from the certif
2c00: 69 63 61 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76  icate...[def "[v
2c10: 61 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72  ar protocol] [ar
2c20: 67 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65  g version]"].The
2c30: 20 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f   protocol versio
2c40: 6e 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63  n used for the c
2c50: 6f 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c  onnection: SSL2,
2c60: 20 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53   SSL3, TLS1, TLS
2c70: 31 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53  1.1, TLS1.2, TLS
2c80: 31 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e  1.3, or unknown.
2c90: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 62 69  ..[def "[var sbi
2ca0: 74 73 5d 20 5b 61 72 67 20 6e 5d 22 5d 0a 54 68  ts] [arg n]"].Th
2cb0: 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 69 74 73  e number of bits
2cc0: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 73 65   used for the se
2cd0: 73 73 69 6f 6e 20 6b 65 79 2e 0a 0a 5b 64 65 66  ssion key...[def
2ce0: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65   "[var signature
2cf0: 48 61 73 68 41 6c 67 6f 72 69 74 68 6d 5d 20 5b  HashAlgorithm] [
2d00: 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d  arg algorithm]"]
2d10: 0a 54 68 65 20 73 69 67 6e 61 74 75 72 65 20 68  .The signature h
2d20: 61 73 68 20 61 6c 67 6f 72 69 74 68 6d 2e 0a 0a  ash algorithm...
2d30: 5b 64 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61  [def "[var signa
2d40: 74 75 72 65 54 79 70 65 5d 20 5b 61 72 67 20 74  tureType] [arg t
2d50: 79 70 65 5d 22 5d 0a 54 68 65 20 73 69 67 6e 61  ype]"].The signa
2d60: 74 75 72 65 20 74 79 70 65 20 76 61 6c 75 65 2e  ture type value.
2d70: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 76 65 72  ..[def "[var ver
2d80: 69 66 79 44 65 70 74 68 5d 20 5b 61 72 67 20 6e  ifyDepth] [arg n
2d90: 5d 22 5d 0a 4d 61 78 69 6d 75 6d 20 64 65 70 74  ]"].Maximum dept
2da0: 68 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 66  h for the certif
2db0: 69 63 61 74 65 20 63 68 61 69 6e 20 76 65 72 69  icate chain veri
2dc0: 66 69 63 61 74 69 6f 6e 2e 20 44 65 66 61 75 6c  fication. Defaul
2dd0: 74 20 69 73 20 2d 31 2c 20 74 6f 20 63 68 65 63  t is -1, to chec
2de0: 6b 20 61 6c 6c 2e 0a 0a 5b 64 65 66 20 22 5b 76  k all...[def "[v
2df0: 61 72 20 76 65 72 69 66 79 4d 6f 64 65 5d 20 5b  ar verifyMode] [
2e00: 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74  arg list]"].List
2e10: 20 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 20   of certificate 
2e20: 76 65 72 69 66 69 63 61 74 69 6f 6e 20 6d 6f 64  verification mod
2e30: 65 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  es...[def "[var 
2e40: 76 65 72 69 66 79 52 65 73 75 6c 74 5d 20 5b 61  verifyResult] [a
2e50: 72 67 20 72 65 73 75 6c 74 5d 22 5d 0a 43 65 72  rg result]"].Cer
2e60: 74 69 66 69 63 61 74 65 20 76 65 72 69 66 69 63  tificate verific
2e70: 61 74 69 6f 6e 20 72 65 73 75 6c 74 2e 0a 0a 5b  ation result...[
2e80: 64 65 66 20 22 5b 76 61 72 20 63 61 5f 6e 61 6d  def "[var ca_nam
2e90: 65 73 5d 20 5b 61 72 67 20 6c 69 73 74 5d 22 5d  es] [arg list]"]
2ea0: 0a 4c 69 73 74 20 6f 66 20 74 68 65 20 43 65 72  .List of the Cer
2eb0: 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72 69  tificate Authori
2ec0: 74 69 65 73 20 75 73 65 64 20 74 6f 20 63 72 65  ties used to cre
2ed0: 61 74 65 20 74 68 65 20 63 65 72 74 69 66 69 63  ate the certific
2ee0: 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  ate...[list_end]
2ef0: 0a 0a 43 65 72 74 69 66 69 63 61 74 65 20 53 74  ..Certificate St
2f00: 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62 65 67 69  atus..[list_begi
2f10: 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a  n definitions]..
2f20: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 6c 5d 20  [def "[var all] 
2f30: 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a 44  [arg string]"].D
2f40: 75 6d 70 20 6f 66 20 61 6c 6c 20 63 65 72 74 69  ump of all certi
2f50: 66 69 63 61 74 65 20 69 6e 66 6f 2e 0a 0a 5b 64  ficate info...[d
2f60: 65 66 20 22 5b 76 61 72 20 76 65 72 73 69 6f 6e  ef "[var version
2f70: 5d 20 5b 61 72 67 20 76 61 6c 75 65 5d 22 5d 0a  ] [arg value]"].
2f80: 54 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  The certificate 
2f90: 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22  version...[def "
2fa0: 5b 76 61 72 20 73 65 72 69 61 6c 4e 75 6d 62 65  [var serialNumbe
2fb0: 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  r] [arg string]"
2fc0: 5d 0a 54 68 65 20 73 65 72 69 61 6c 20 6e 75 6d  ].The serial num
2fd0: 62 65 72 20 6f 66 20 74 68 65 20 63 65 72 74 69  ber of the certi
2fe0: 66 69 63 61 74 65 20 61 73 20 61 20 68 65 78 20  ficate as a hex 
2ff0: 73 74 72 69 6e 67 2e 0a 0a 5b 64 65 66 20 22 5b  string...[def "[
3000: 76 61 72 20 73 69 67 6e 61 74 75 72 65 5d 20 5b  var signature] [
3010: 61 72 67 20 61 6c 67 6f 72 69 74 68 6d 5d 22 5d  arg algorithm]"]
3020: 0a 43 69 70 68 65 72 20 61 6c 67 6f 72 69 74 68  .Cipher algorith
3030: 6d 20 75 73 65 64 20 66 6f 72 20 63 65 72 74 69  m used for certi
3040: 66 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65  ficate signature
3050: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 69 73  ...[def "[var is
3060: 73 75 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e  suer] [arg strin
3070: 67 5d 22 5d 0a 54 68 65 20 64 69 73 74 69 6e 67  g]"].The disting
3080: 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29  uished name (DN)
3090: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
30a0: 61 74 65 20 69 73 73 75 65 72 2e 0a 0a 5b 64 65  ate issuer...[de
30b0: 66 20 22 5b 76 61 72 20 6e 6f 74 42 65 66 6f 72  f "[var notBefor
30c0: 65 5d 20 5b 61 72 67 20 64 61 74 65 5d 22 5d 0a  e] [arg date]"].
30d0: 54 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 64 61  The beginning da
30e0: 74 65 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  te of the certif
30f0: 69 63 61 74 65 20 76 61 6c 69 64 69 74 79 2e 0a  icate validity..
3100: 0a 5b 64 65 66 20 22 5b 76 61 72 20 6e 6f 74 41  .[def "[var notA
3110: 66 74 65 72 5d 20 5b 61 72 67 20 64 61 74 65 5d  fter] [arg date]
3120: 22 5d 0a 54 68 65 20 65 78 70 69 72 61 74 69 6f  "].The expiratio
3130: 6e 20 64 61 74 65 20 6f 66 20 74 68 65 20 63 65  n date of the ce
3140: 72 74 69 66 69 63 61 74 65 20 76 61 6c 69 64 69  rtificate validi
3150: 74 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ty...[def "[var 
3160: 73 75 62 6a 65 63 74 5d 20 5b 61 72 67 20 73 74  subject] [arg st
3170: 72 69 6e 67 5d 22 5d 0a 54 68 65 20 64 69 73 74  ring]"].The dist
3180: 69 6e 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28  inguished name (
3190: 44 4e 29 20 6f 66 20 74 68 65 20 63 65 72 74 69  DN) of the certi
31a0: 66 69 63 61 74 65 20 73 75 62 6a 65 63 74 2e 20  ficate subject. 
31b0: 46 69 65 6c 64 73 20 69 6e 63 6c 75 64 65 3a 20  Fields include: 
31c0: 43 6f 6d 6d 6f 6e 0a 4e 61 6d 65 20 28 43 4e 29  Common.Name (CN)
31d0: 2c 20 4f 72 67 61 6e 69 7a 61 74 69 6f 6e 20 28  , Organization (
31e0: 4f 29 2c 20 4c 6f 63 61 6c 69 74 79 20 6f 72 20  O), Locality or 
31f0: 43 69 74 79 20 28 4c 29 2c 20 53 74 61 74 65 20  City (L), State 
3200: 6f 72 20 50 72 6f 76 69 6e 63 65 20 28 53 29 2c  or Province (S),
3210: 20 61 6e 64 0a 43 6f 75 6e 74 72 79 20 4e 61 6d   and.Country Nam
3220: 65 20 28 43 29 2e 0a 0a 5b 64 65 66 20 22 5b 76  e (C)...[def "[v
3230: 61 72 20 69 73 73 75 65 72 55 6e 69 71 75 65 49  ar issuerUniqueI
3240: 44 5d 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22  D] [arg string]"
3250: 5d 0a 54 68 65 20 69 73 73 75 65 72 20 75 6e 69  ].The issuer uni
3260: 71 75 65 20 69 64 2e 0a 0a 5b 64 65 66 20 22 5b  que id...[def "[
3270: 76 61 72 20 73 75 62 6a 65 63 74 55 6e 69 71 75  var subjectUniqu
3280: 65 49 44 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  eID] [arg string
3290: 5d 22 5d 0a 54 68 65 20 73 75 62 6a 65 63 74 20  ]"].The subject 
32a0: 75 6e 69 71 75 65 20 69 64 2e 0a 0a 5b 64 65 66  unique id...[def
32b0: 20 22 5b 76 61 72 20 6e 75 6d 5f 65 78 74 65 6e   "[var num_exten
32c0: 73 69 6f 6e 73 5d 20 5b 61 72 67 20 6e 5d 22 5d  sions] [arg n]"]
32d0: 0a 4e 75 6d 62 65 72 20 6f 66 20 63 65 72 74 69  .Number of certi
32e0: 66 69 63 61 74 65 20 65 78 74 65 6e 73 69 6f 6e  ficate extension
32f0: 73 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 65  s...[def "[var e
3300: 78 74 65 6e 73 69 6f 6e 73 5d 20 5b 61 72 67 20  xtensions] [arg 
3310: 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20  list]"].List of 
3320: 63 65 72 74 69 66 69 63 61 74 65 20 65 78 74 65  certificate exte
3330: 6e 73 69 6f 6e 20 6e 61 6d 65 73 2e 0a 0a 5b 64  nsion names...[d
3340: 65 66 20 22 5b 76 61 72 20 61 75 74 68 6f 72 69  ef "[var authori
3350: 74 79 4b 65 79 49 64 65 6e 74 69 66 69 65 72 5d  tyKeyIdentifier]
3360: 20 5b 61 72 67 20 73 74 72 69 6e 67 5d 22 5d 0a   [arg string]"].
3370: 41 75 74 68 6f 72 69 74 79 20 4b 65 79 20 49 64  Authority Key Id
3380: 65 6e 74 69 66 69 65 72 20 28 41 4b 49 29 20 6f  entifier (AKI) o
3390: 66 20 74 68 65 20 49 73 73 75 69 6e 67 20 43 41  f the Issuing CA
33a0: 20 63 65 72 74 69 66 69 63 61 74 65 20 74 68 61   certificate tha
33b0: 74 20 73 69 67 6e 65 64 20 74 68 65 0a 53 53 4c  t signed the.SSL
33c0: 20 63 65 72 74 69 66 69 63 61 74 65 20 61 73 20   certificate as 
33d0: 61 20 68 65 78 20 73 74 72 69 6e 67 2e 20 54 68  a hex string. Th
33e0: 69 73 20 76 61 6c 75 65 20 6d 61 74 63 68 65 73  is value matches
33f0: 20 74 68 65 20 53 4b 49 20 76 61 6c 75 65 20 6f   the SKI value o
3400: 66 20 74 68 65 0a 49 6e 74 65 72 6d 65 64 69 61  f the.Intermedia
3410: 74 65 20 43 41 20 63 65 72 74 69 66 69 63 61 74  te CA certificat
3420: 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  e...[def "[var s
3430: 75 62 6a 65 63 74 4b 65 79 49 64 65 6e 74 69 66  ubjectKeyIdentif
3440: 69 65 72 5d 20 5b 61 72 67 20 73 74 72 69 6e 67  ier] [arg string
3450: 5d 22 5d 0a 53 75 62 6a 65 63 74 20 4b 65 79 20  ]"].Subject Key 
3460: 49 64 65 6e 74 69 66 69 65 72 20 28 53 4b 49 29  Identifier (SKI)
3470: 20 68 61 73 68 20 6f 66 20 74 68 65 20 70 75 62   hash of the pub
3480: 6c 69 63 20 6b 65 79 20 69 6e 73 69 64 65 20 74  lic key inside t
3490: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 61  he certificate a
34a0: 73 20 61 0a 68 65 78 20 73 74 72 69 6e 67 2e 20  s a.hex string. 
34b0: 55 73 65 64 20 74 6f 20 69 64 65 6e 74 69 66 79  Used to identify
34c0: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74 68   certificates th
34d0: 61 74 20 63 6f 6e 74 61 69 6e 20 61 20 70 61 72  at contain a par
34e0: 74 69 63 75 6c 61 72 20 70 75 62 6c 69 63 20 6b  ticular public k
34f0: 65 79 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  ey...[def "[var 
3500: 73 75 62 6a 65 63 74 41 6c 74 4e 61 6d 65 5d 20  subjectAltName] 
3510: 5b 61 72 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73  [arg list]"].Lis
3520: 74 20 6f 66 20 61 6c 6c 20 6f 66 20 74 68 65 20  t of all of the 
3530: 53 75 62 6a 65 63 74 20 41 6c 74 65 72 6e 61 74  Subject Alternat
3540: 69 76 65 20 4e 61 6d 65 73 20 28 53 41 4e 29 20  ive Names (SAN) 
3550: 69 6e 63 6c 75 64 69 6e 67 20 64 6f 6d 61 69 6e  including domain
3560: 20 6e 61 6d 65 73 2c 20 73 75 62 0a 64 6f 6d 61   names, sub.doma
3570: 69 6e 73 2c 20 61 6e 64 20 49 50 20 61 64 64 72  ins, and IP addr
3580: 65 73 73 65 73 20 74 68 61 74 20 61 72 65 20 73  esses that are s
3590: 65 63 75 72 65 64 20 62 79 20 74 68 65 20 63 65  ecured by the ce
35a0: 72 74 69 66 69 63 61 74 65 2e 0a 0a 5b 64 65 66  rtificate...[def
35b0: 20 22 5b 76 61 72 20 6f 63 73 70 5d 20 5b 61 72   "[var ocsp] [ar
35c0: 67 20 6c 69 73 74 5d 22 5d 0a 4c 69 73 74 20 6f  g list]"].List o
35d0: 66 20 61 6c 6c 20 4f 6e 6c 69 6e 65 20 43 65 72  f all Online Cer
35e0: 74 69 66 69 63 61 74 65 20 53 74 61 74 75 73 20  tificate Status 
35f0: 50 72 6f 74 6f 63 6f 6c 20 28 4f 43 53 50 29 20  Protocol (OCSP) 
3600: 55 52 4c 73 20 74 68 61 74 20 63 61 6e 20 62 65  URLs that can be
3610: 20 75 73 65 64 20 74 6f 0a 63 68 65 63 6b 20 74   used to.check t
3620: 68 65 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74  he validity of t
3630: 68 69 73 20 63 65 72 74 69 66 69 63 61 74 65 2e  his certificate.
3640: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63 65 72  ..[def "[var cer
3650: 74 69 66 69 63 61 74 65 5d 20 5b 61 72 67 20 63  tificate] [arg c
3660: 65 72 74 5d 22 5d 0a 54 68 65 20 50 45 4d 20 65  ert]"].The PEM e
3670: 6e 63 6f 64 65 64 20 63 65 72 74 69 66 69 63 61  ncoded certifica
3680: 74 65 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  te...[def "[var 
3690: 73 69 67 6e 61 74 75 72 65 41 6c 67 6f 72 69 74  signatureAlgorit
36a0: 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72 69 74  hm] [arg algorit
36b0: 68 6d 5d 22 5d 0a 43 69 70 68 65 72 20 61 6c 67  hm]"].Cipher alg
36c0: 6f 72 69 74 68 6d 20 75 73 65 64 20 66 6f 72 20  orithm used for 
36d0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
36e0: 73 69 67 6e 61 74 75 72 65 2e 0a 0a 5b 64 65 66  signature...[def
36f0: 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75 72 65   "[var signature
3700: 56 61 6c 75 65 5d 20 5b 61 72 67 20 73 74 72 69  Value] [arg stri
3710: 6e 67 5d 22 5d 0a 43 65 72 74 69 66 69 63 61 74  ng]"].Certificat
3720: 65 20 73 69 67 6e 61 74 75 72 65 20 61 73 20 61  e signature as a
3730: 20 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64   hex string...[d
3740: 65 66 20 22 5b 76 61 72 20 73 69 67 6e 61 74 75  ef "[var signatu
3750: 72 65 44 69 67 65 73 74 5d 20 5b 61 72 67 20 76  reDigest] [arg v
3760: 65 72 73 69 6f 6e 5d 22 5d 0a 43 65 72 74 69 66  ersion]"].Certif
3770: 69 63 61 74 65 20 73 69 67 6e 69 6e 67 20 64 69  icate signing di
3780: 67 65 73 74 20 61 73 20 61 20 68 65 78 20 73 74  gest as a hex st
3790: 72 69 6e 67 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  ring...[def "[va
37a0: 72 20 70 75 62 6c 69 63 4b 65 79 41 6c 67 6f 72  r publicKeyAlgor
37b0: 69 74 68 6d 5d 20 5b 61 72 67 20 61 6c 67 6f 72  ithm] [arg algor
37c0: 69 74 68 6d 5d 22 5d 0a 43 65 72 74 69 66 69 63  ithm]"].Certific
37d0: 61 74 65 20 73 69 67 6e 61 74 75 72 65 20 70 75  ate signature pu
37e0: 62 6c 69 63 20 6b 65 79 20 61 6c 67 6f 72 69 74  blic key algorit
37f0: 68 6d 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  hm...[def "[var 
3800: 70 75 62 6c 69 63 4b 65 79 5d 20 5b 61 72 67 20  publicKey] [arg 
3810: 73 74 72 69 6e 67 5d 22 5d 0a 43 65 72 74 69 66  string]"].Certif
3820: 69 63 61 74 65 20 73 69 67 6e 61 74 75 72 65 20  icate signature 
3830: 70 75 62 6c 69 63 20 6b 65 79 20 61 73 20 61 20  public key as a 
3840: 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65  hex string...[de
3850: 66 20 22 5b 76 61 72 20 62 69 74 73 5d 20 5b 61  f "[var bits] [a
3860: 72 67 20 6e 5d 22 5d 0a 4e 75 6d 62 65 72 20 6f  rg n]"].Number o
3870: 66 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20  f bits used for 
3880: 63 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e  certificate sign
3890: 61 74 75 72 65 20 6b 65 79 2e 0a 0a 5b 64 65 66  ature key...[def
38a0: 20 22 5b 76 61 72 20 73 65 6c 66 5f 73 69 67 6e   "[var self_sign
38b0: 65 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e  ed] [arg boolean
38c0: 5d 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20  ]"].Whether the 
38d0: 63 65 72 74 69 66 69 63 61 74 65 20 73 69 67 6e  certificate sign
38e0: 61 74 75 72 65 20 69 73 20 73 65 6c 66 20 73 69  ature is self si
38f0: 67 6e 65 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  gned...[def "[va
3900: 72 20 73 68 61 31 5f 68 61 73 68 5d 20 5b 61 72  r sha1_hash] [ar
3910: 67 20 68 61 73 68 5d 22 5d 0a 54 68 65 20 53 48  g hash]"].The SH
3920: 41 31 20 68 61 73 68 20 6f 66 20 74 68 65 20 63  A1 hash of the c
3930: 65 72 74 69 66 69 63 61 74 65 20 61 73 20 61 20  ertificate as a 
3940: 68 65 78 20 73 74 72 69 6e 67 2e 0a 0a 5b 64 65  hex string...[de
3950: 66 20 22 5b 76 61 72 20 73 68 61 32 35 36 5f 68  f "[var sha256_h
3960: 61 73 68 5d 20 5b 61 72 67 20 68 61 73 68 5d 22  ash] [arg hash]"
3970: 5d 0a 54 68 65 20 53 48 41 32 35 36 20 68 61 73  ].The SHA256 has
3980: 68 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  h of the certifi
3990: 63 61 74 65 20 61 73 20 61 20 68 65 78 20 73 74  cate as a hex st
39a0: 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  ring...[list_end
39b0: 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64 20 74 6c  ]..[call [cmd tl
39c0: 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 5d 20 5b  s::connection] [
39d0: 61 72 67 20 63 68 61 6e 6e 65 6c 5d 5d 0a 0a 52  arg channel]]..R
39e0: 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65  eturns the curre
39f0: 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74  nt connection st
3a00: 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20 63  atus of an SSL c
3a10: 68 61 6e 6e 65 6c 2e 20 54 68 65 20 72 65 73 75  hannel. The resu
3a20: 6c 74 20 69 73 20 61 20 6c 69 73 74 0a 6f 66 20  lt is a list.of 
3a30: 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73 20  key-value pairs 
3a40: 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 63  describing the c
3a50: 6f 6e 6e 65 63 74 69 6f 6e 2e 20 52 65 74 75 72  onnection. Retur
3a60: 6e 65 64 20 76 61 6c 75 65 73 20 69 6e 63 6c 75  ned values inclu
3a70: 64 65 3a 0a 0a 5b 70 61 72 61 5d 0a 0a 53 53 4c  de:..[para]..SSL
3a80: 20 53 74 61 74 75 73 0a 0a 5b 6c 69 73 74 5f 62   Status..[list_b
3a90: 65 67 69 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73  egin definitions
3aa0: 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 74  ]..[def "[var st
3ab0: 61 74 65 5d 20 5b 61 72 67 20 73 74 61 74 65 5d  ate] [arg state]
3ac0: 22 5d 0a 53 74 61 74 65 20 6f 66 20 74 68 65 20  "].State of the 
3ad0: 63 6f 6e 6e 65 63 74 69 6f 6e 2e 0a 0a 5b 64 65  connection...[de
3ae0: 66 20 22 5b 76 61 72 20 73 65 72 76 65 72 6e 61  f "[var serverna
3af0: 6d 65 5d 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d  me] [arg name]"]
3b00: 0a 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65  .The name of the
3b10: 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f 20 73 65   connected to se
3b20: 72 76 65 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  rver...[def "[va
3b30: 72 20 70 72 6f 74 6f 63 6f 6c 5d 20 5b 61 72 67  r protocol] [arg
3b40: 20 76 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20   version]"].The 
3b50: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e  protocol version
3b60: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 6f   used for the co
3b70: 6e 6e 65 63 74 69 6f 6e 3a 20 53 53 4c 32 2c 20  nnection: SSL2, 
3b80: 53 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53 31  SSL3, TLS1, TLS1
3b90: 2e 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53 31  .1, TLS1.2, TLS1
3ba0: 2e 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 2e 0a  .3, or unknown..
3bb0: 0a 5b 64 65 66 20 22 5b 76 61 72 20 72 65 6e 65  .[def "[var rene
3bc0: 67 6f 74 69 61 74 69 6f 6e 5f 61 6c 6c 6f 77 65  gotiation_allowe
3bd0: 64 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  d] [arg boolean]
3be0: 22 5d 0a 57 68 65 74 68 65 72 20 70 72 6f 74 6f  "].Whether proto
3bf0: 63 6f 6c 20 72 65 6e 65 67 6f 74 69 61 74 69 6f  col renegotiatio
3c00: 6e 20 69 73 20 73 75 70 70 6f 72 74 65 64 20 6f  n is supported o
3c10: 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20 22 5b 76  r not...[def "[v
3c20: 61 72 20 73 65 63 75 72 69 74 79 5f 6c 65 76 65  ar security_leve
3c30: 6c 5d 20 5b 61 72 67 20 6c 65 76 65 6c 5d 22 5d  l] [arg level]"]
3c40: 0a 54 68 65 20 73 65 63 75 72 69 74 79 20 6c 65  .The security le
3c50: 76 65 6c 20 75 73 65 64 20 66 6f 72 20 73 65 6c  vel used for sel
3c60: 65 63 74 69 6f 6e 20 6f 66 20 63 69 70 68 65 72  ection of cipher
3c70: 73 2c 20 6b 65 79 20 73 69 7a 65 2c 20 65 74 63  s, key size, etc
3c80: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
3c90: 73 73 69 6f 6e 5f 72 65 75 73 65 64 5d 20 5b 61  ssion_reused] [a
3ca0: 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57 68  rg boolean]"].Wh
3cb0: 65 74 68 65 72 20 74 68 65 20 73 65 73 73 69 6f  ether the sessio
3cc0: 6e 20 68 61 73 20 62 65 65 6e 20 72 65 75 73 65  n has been reuse
3cd0: 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b 64 65 66 20  d or not...[def 
3ce0: 22 5b 76 61 72 20 69 73 5f 73 65 72 76 65 72 5d  "[var is_server]
3cf0: 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d   [arg boolean]"]
3d00: 0a 57 68 65 74 68 65 72 20 74 68 65 20 63 6f 6e  .Whether the con
3d10: 6e 65 63 74 69 6f 6e 20 69 73 20 63 6f 6e 66 69  nection is confi
3d20: 67 75 72 65 64 20 61 73 20 61 20 73 65 72 76 65  gured as a serve
3d30: 72 20 28 31 29 20 6f 72 20 63 6c 69 65 6e 74 20  r (1) or client 
3d40: 28 30 29 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  (0)...[def "[var
3d50: 20 63 6f 6d 70 72 65 73 73 69 6f 6e 5d 20 5b 61   compression] [a
3d60: 72 67 20 6d 6f 64 65 5d 22 5d 0a 43 6f 6d 70 72  rg mode]"].Compr
3d70: 65 73 73 69 6f 6e 20 6d 65 74 68 6f 64 2e 0a 0a  ession method...
3d80: 5b 64 65 66 20 22 5b 76 61 72 20 65 78 70 61 6e  [def "[var expan
3d90: 73 69 6f 6e 5d 20 5b 61 72 67 20 6d 6f 64 65 5d  sion] [arg mode]
3da0: 22 5d 0a 45 78 70 61 6e 73 69 6f 6e 20 6d 65 74  "].Expansion met
3db0: 68 6f 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72  hod...[def "[var
3dc0: 20 63 61 4c 69 73 74 5d 20 5b 61 72 67 20 6c 69   caList] [arg li
3dd0: 73 74 5d 22 5d 0a 4c 69 73 74 20 6f 66 20 43 65  st]"].List of Ce
3de0: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
3df0: 69 74 69 65 73 20 28 43 41 29 20 66 6f 72 20 58  ities (CA) for X
3e00: 2e 35 30 39 20 63 65 72 74 69 66 69 63 61 74 65  .509 certificate
3e10: 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a 43  ...[list_end]..C
3e20: 69 70 68 65 72 20 49 6e 66 6f 0a 0a 5b 6c 69 73  ipher Info..[lis
3e30: 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74 69  t_begin definiti
3e40: 6f 6e 73 5d 0a 0a 5b 64 65 66 20 22 5b 76 61 72  ons]..[def "[var
3e50: 20 63 69 70 68 65 72 5d 20 5b 61 72 67 20 63 69   cipher] [arg ci
3e60: 70 68 65 72 5d 22 5d 0a 54 68 65 20 63 75 72 72  pher]"].The curr
3e70: 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75 73  ent cipher in us
3e80: 65 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63  e for the connec
3e90: 74 69 6f 6e 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  tion...[def "[va
3ea0: 72 20 73 74 61 6e 64 61 72 64 5f 6e 61 6d 65 5d  r standard_name]
3eb0: 20 5b 61 72 67 20 6e 61 6d 65 5d 22 5d 0a 54 68   [arg name]"].Th
3ec0: 65 20 73 74 61 6e 64 61 72 64 20 52 46 43 20 6e  e standard RFC n
3ed0: 61 6d 65 20 6f 66 20 63 69 70 68 65 72 2e 0a 0a  ame of cipher...
3ee0: 5b 64 65 66 20 22 5b 76 61 72 20 61 6c 67 6f 72  [def "[var algor
3ef0: 69 74 68 6d 5f 62 69 74 73 5d 20 5b 61 72 67 20  ithm_bits] [arg 
3f00: 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72 20  n]"].The number 
3f10: 6f 66 20 70 72 6f 63 65 73 73 65 64 20 62 69 74  of processed bit
3f20: 73 20 75 73 65 64 20 66 6f 72 20 63 69 70 68 65  s used for ciphe
3f30: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73  r...[def "[var s
3f40: 65 63 72 65 74 5f 62 69 74 73 5d 20 5b 61 72 67  ecret_bits] [arg
3f50: 20 6e 5d 22 5d 0a 54 68 65 20 6e 75 6d 62 65 72   n]"].The number
3f60: 20 6f 66 20 73 65 63 72 65 74 20 62 69 74 73 20   of secret bits 
3f70: 75 73 65 64 20 66 6f 72 20 63 69 70 68 65 72 2e  used for cipher.
3f80: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6d 69 6e  ..[def "[var min
3f90: 5f 76 65 72 73 69 6f 6e 5d 20 5b 61 72 67 20 76  _version] [arg v
3fa0: 65 72 73 69 6f 6e 5d 22 5d 0a 54 68 65 20 6d 69  ersion]"].The mi
3fb0: 6e 69 6d 75 6d 20 70 72 6f 74 6f 63 6f 6c 20 76  nimum protocol v
3fc0: 65 72 73 69 6f 6e 20 66 6f 72 20 63 69 70 68 65  ersion for ciphe
3fd0: 72 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 63  r...[def "[var c
3fe0: 69 70 68 65 72 5f 69 73 5f 61 65 61 64 5d 20 5b  ipher_is_aead] [
3ff0: 61 72 67 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 57  arg boolean]"].W
4000: 68 65 74 68 65 72 20 74 68 65 20 63 69 70 68 65  hether the ciphe
4010: 72 20 69 73 20 41 75 74 68 65 6e 74 69 63 61 74  r is Authenticat
4020: 65 64 20 45 6e 63 72 79 70 74 69 6f 6e 20 77 69  ed Encryption wi
4030: 74 68 20 41 73 73 6f 63 69 61 74 65 64 20 44 61  th Associated Da
4040: 74 61 20 28 41 45 41 44 29 2e 0a 0a 5b 64 65 66  ta (AEAD)...[def
4050: 20 22 5b 76 61 72 20 63 69 70 68 65 72 5f 69 64   "[var cipher_id
4060: 5d 20 5b 61 72 67 20 69 64 5d 22 5d 0a 54 68 65  ] [arg id]"].The
4070: 20 4f 70 65 6e 53 53 4c 20 63 69 70 68 65 72 20   OpenSSL cipher 
4080: 69 64 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20  id...[def "[var 
4090: 64 65 73 63 72 69 70 74 69 6f 6e 5d 20 5b 61 72  description] [ar
40a0: 67 20 73 74 72 69 6e 67 5d 22 5d 0a 41 20 74 65  g string]"].A te
40b0: 78 74 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f  xt description o
40c0: 66 20 74 68 65 20 63 69 70 68 65 72 2e 0a 0a 5b  f the cipher...[
40d0: 64 65 66 20 22 5b 76 61 72 20 68 61 6e 64 73 68  def "[var handsh
40e0: 61 6b 65 5f 64 69 67 65 73 74 5d 20 5b 61 72 67  ake_digest] [arg
40f0: 20 62 6f 6f 6c 65 61 6e 5d 22 5d 0a 44 69 67 65   boolean]"].Dige
4100: 73 74 20 75 73 65 64 20 64 75 72 69 6e 67 20 68  st used during h
4110: 61 6e 64 73 68 61 6b 65 2e 0a 0a 5b 6c 69 73 74  andshake...[list
4120: 5f 65 6e 64 5d 0a 0a 53 65 73 73 69 6f 6e 20 49  _end]..Session I
4130: 6e 66 6f 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e  nfo..[list_begin
4140: 20 64 65 66 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b   definitions]..[
4150: 64 65 66 20 22 5b 76 61 72 20 61 6c 70 6e 5d 20  def "[var alpn] 
4160: 5b 61 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 22 5d  [arg protocol]"]
4170: 0a 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65  .The protocol se
4180: 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70 70  lected after App
4190: 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50  lication-Layer P
41a0: 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74  rotocol Negotiat
41b0: 69 6f 6e 20 28 41 4c 50 4e 29 2e 0a 0a 5b 64 65  ion (ALPN)...[de
41c0: 66 20 22 5b 76 61 72 20 72 65 73 75 6d 61 62 6c  f "[var resumabl
41d0: 65 5d 20 5b 61 72 67 20 62 6f 6f 6c 65 61 6e 5d  e] [arg boolean]
41e0: 22 5d 0a 57 68 65 74 68 65 72 20 74 68 65 20 73  "].Whether the s
41f0: 65 73 73 69 6f 6e 20 63 61 6e 20 62 65 20 72 65  ession can be re
4200: 73 75 6d 65 64 20 6f 72 20 6e 6f 74 2e 0a 0a 5b  sumed or not...[
4210: 64 65 66 20 22 5b 76 61 72 20 73 74 61 72 74 5f  def "[var start_
4220: 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63 6f 6e  time] [arg secon
4230: 64 73 5d 22 5d 0a 54 69 6d 65 20 73 69 6e 63 65  ds]"].Time since
4240: 20 73 65 73 73 69 6f 6e 20 73 74 61 72 74 65 64   session started
4250: 20 69 6e 20 73 65 63 6f 6e 64 73 20 73 69 6e 63   in seconds sinc
4260: 65 20 65 70 6f 63 68 2e 0a 0a 5b 64 65 66 20 22  e epoch...[def "
4270: 5b 76 61 72 20 74 69 6d 65 6f 75 74 5d 20 5b 61  [var timeout] [a
4280: 72 67 20 73 65 63 6f 6e 64 73 5d 22 5d 0a 4d 61  rg seconds]"].Ma
4290: 78 20 64 75 72 61 74 69 6f 6e 20 6f 66 20 73 65  x duration of se
42a0: 73 73 69 6f 6e 20 69 6e 20 73 65 63 6f 6e 64 73  ssion in seconds
42b0: 20 62 65 66 6f 72 65 20 74 69 6d 65 2d 6f 75 74   before time-out
42c0: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 6c 69  ...[def "[var li
42d0: 66 65 74 69 6d 65 5d 20 5b 61 72 67 20 73 65 63  fetime] [arg sec
42e0: 6f 6e 64 73 5d 22 5d 0a 53 65 73 73 69 6f 6e 20  onds]"].Session 
42f0: 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d 65 20  ticket lifetime 
4300: 68 69 6e 74 20 69 6e 20 73 65 63 6f 6e 64 73 2e  hint in seconds.
4310: 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73  ..[def "[var ses
4320: 73 69 6f 6e 5f 69 64 5d 20 5b 61 72 67 20 62 69  sion_id] [arg bi
4330: 6e 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55  nary_string]"].U
4340: 6e 69 71 75 65 20 73 65 73 73 69 6f 6e 20 69 64  nique session id
4350: 20 66 6f 72 20 75 73 65 20 69 6e 20 72 65 73 75   for use in resu
4360: 6d 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e  ming the session
4370: 2e 0a 0a 5b 64 65 66 20 22 5b 76 61 72 20 73 65  ...[def "[var se
4380: 73 73 69 6f 6e 5f 74 69 63 6b 65 74 5d 20 5b 61  ssion_ticket] [a
4390: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67  rg binary_string
43a0: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69  ]"].Unique sessi
43b0: 6f 6e 20 74 69 63 6b 65 74 20 66 6f 72 20 75 73  on ticket for us
43c0: 65 20 69 6e 20 72 65 73 75 6d 69 6e 67 20 74 68  e in resuming th
43d0: 65 20 73 65 73 73 69 6f 6e 2e 0a 0a 5b 64 65 66  e session...[def
43e0: 20 22 5b 76 61 72 20 74 69 63 6b 65 74 5f 61 70   "[var ticket_ap
43f0: 70 5f 64 61 74 61 5d 20 5b 61 72 67 20 62 69 6e  p_data] [arg bin
4400: 61 72 79 5f 73 74 72 69 6e 67 5d 22 5d 0a 55 6e  ary_string]"].Un
4410: 69 71 75 65 20 73 65 73 73 69 6f 6e 20 74 69 63  ique session tic
4420: 6b 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 20  ket application 
4430: 64 61 74 61 2e 0a 0a 5b 64 65 66 20 22 5b 76 61  data...[def "[va
4440: 72 20 6d 61 73 74 65 72 5f 6b 65 79 5d 20 5b 61  r master_key] [a
4450: 72 67 20 62 69 6e 61 72 79 5f 73 74 72 69 6e 67  rg binary_string
4460: 5d 22 5d 0a 55 6e 69 71 75 65 20 73 65 73 73 69  ]"].Unique sessi
4470: 6f 6e 20 6d 61 73 74 65 72 20 6b 65 79 2e 0a 0a  on master key...
4480: 5b 64 65 66 20 22 5b 76 61 72 20 73 65 73 73 69  [def "[var sessi
4490: 6f 6e 5f 63 61 63 68 65 5f 6d 6f 64 65 5d 20 5b  on_cache_mode] [
44a0: 61 72 67 20 6d 6f 64 65 5d 22 5d 0a 53 65 72 76  arg mode]"].Serv
44b0: 65 72 20 63 61 63 68 65 20 6d 6f 64 65 20 28 63  er cache mode (c
44c0: 6c 69 65 6e 74 2c 20 73 65 72 76 65 72 2c 20 6f  lient, server, o
44d0: 72 20 62 6f 74 68 29 2e 0a 0a 5b 6c 69 73 74 5f  r both)...[list_
44e0: 65 6e 64 5d 0a 0a 5b 63 61 6c 6c 20 5b 63 6d 64  end]..[call [cmd
44f0: 20 74 6c 73 3a 3a 63 69 70 68 65 72 73 5d 20 5b   tls::ciphers] [
4500: 6f 70 74 20 5b 61 72 67 20 70 72 6f 74 6f 63 6f  opt [arg protoco
4510: 6c 5d 5d 20 5b 6f 70 74 20 5b 61 72 67 20 76 65  l]] [opt [arg ve
4520: 72 62 6f 73 65 5d 5d 20 5b 6f 70 74 20 5b 61 72  rbose]] [opt [ar
4530: 67 20 73 75 70 70 6f 72 74 65 64 5d 5d 5d 0a 0a  g supported]]]..
4540: 57 69 74 68 6f 75 74 20 61 6e 79 20 61 72 67 73  Without any args
4550: 2c 20 72 65 74 75 72 6e 73 20 61 20 6c 69 73 74  , returns a list
4560: 20 6f 66 20 61 6c 6c 20 73 79 6d 6d 65 74 72 69   of all symmetri
4570: 63 20 63 69 70 68 65 72 73 20 66 6f 72 20 75 73  c ciphers for us
4580: 65 20 77 69 74 68 20 74 68 65 0a 5b 61 72 67 20  e with the.[arg 
4590: 2d 63 69 70 68 65 72 5d 20 6f 70 74 69 6f 6e 2e  -cipher] option.
45a0: 20 57 69 74 68 20 5b 61 72 67 20 70 72 6f 74 6f   With [arg proto
45b0: 63 6f 6c 5d 2c 20 6f 6e 6c 79 20 74 68 65 20 63  col], only the c
45c0: 69 70 68 65 72 73 20 73 75 70 70 6f 72 74 65 64  iphers supported
45d0: 20 66 6f 72 20 74 68 61 74 0a 70 72 6f 74 6f 63   for that.protoc
45e0: 6f 6c 20 61 72 65 20 72 65 74 75 72 6e 65 64 2e  ol are returned.
45f0: 20 53 65 65 20 74 68 65 20 5b 63 6d 64 20 74 6c   See the [cmd tl
4600: 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 5d 20 63 6f  s::protocols] co
4610: 6d 6d 61 6e 64 20 66 6f 72 20 74 68 65 20 73 75  mmand for the su
4620: 70 70 6f 72 74 65 64 0a 70 72 6f 74 6f 63 6f 6c  pported.protocol
4630: 73 2e 20 49 66 20 5b 61 72 67 20 76 65 72 62 6f  s. If [arg verbo
4640: 73 65 5d 20 69 73 20 73 70 65 63 69 66 69 65 64  se] is specified
4650: 20 61 73 20 74 72 75 65 20 74 68 65 6e 20 61 20   as true then a 
4660: 76 65 72 62 6f 73 65 2c 20 68 75 6d 61 6e 20 72  verbose, human r
4670: 65 61 64 61 62 6c 65 0a 6c 69 73 74 20 69 73 20  eadable.list is 
4680: 72 65 74 75 72 6e 65 64 20 77 69 74 68 20 61 64  returned with ad
4690: 64 69 74 69 6f 6e 61 6c 20 69 6e 66 6f 72 6d 61  ditional informa
46a0: 74 69 6f 6e 20 6f 6e 20 74 68 65 20 63 69 70 68  tion on the ciph
46b0: 65 72 2e 20 49 66 20 5b 61 72 67 20 73 75 70 70  er. If [arg supp
46c0: 6f 72 74 65 64 5d 0a 69 73 20 73 70 65 63 69 66  orted].is specif
46d0: 69 65 64 20 61 73 20 74 72 75 65 2c 20 74 68 65  ied as true, the
46e0: 6e 20 6f 6e 6c 79 20 74 68 65 20 63 69 70 68 65  n only the ciphe
46f0: 72 73 20 73 75 70 70 6f 72 74 65 64 20 66 6f 72  rs supported for
4700: 20 70 72 6f 74 6f 63 6f 6c 20 77 69 6c 6c 20 62   protocol will b
4710: 65 20 6c 69 73 74 65 64 2e 0a 0a 5b 63 61 6c 6c  e listed...[call
4720: 20 5b 63 6d 64 20 74 6c 73 3a 3a 70 72 6f 74 6f   [cmd tls::proto
4730: 63 6f 6c 73 5d 5d 0a 0a 52 65 74 75 72 6e 73 20  cols]]..Returns 
4740: 61 20 6c 69 73 74 20 6f 66 20 74 68 65 20 73 75  a list of the su
4750: 70 70 6f 72 74 65 64 20 53 53 4c 2f 54 4c 53 20  pported SSL/TLS 
4760: 70 72 6f 74 6f 63 6f 6c 73 2e 20 56 61 6c 69 64  protocols. Valid
4770: 20 76 61 6c 75 65 73 20 61 72 65 3a 0a 5b 63 6f   values are:.[co
4780: 6e 73 74 20 73 73 6c 32 5d 2c 20 5b 63 6f 6e 73  nst ssl2], [cons
4790: 74 20 73 73 6c 33 5d 2c 20 5b 63 6f 6e 73 74 20  t ssl3], [const 
47a0: 74 6c 73 31 5d 2c 20 5b 63 6f 6e 73 74 20 74 6c  tls1], [const tl
47b0: 73 31 2e 31 5d 2c 20 5b 63 6f 6e 73 74 20 74 6c  s1.1], [const tl
47c0: 73 31 2e 32 5d 2c 20 61 6e 64 0a 5b 63 6f 6e 73  s1.2], and.[cons
47d0: 74 20 74 6c 73 31 2e 33 5d 2e 20 45 78 61 63 74  t tls1.3]. Exact
47e0: 20 6c 69 73 74 20 64 65 70 65 6e 64 73 20 6f 6e   list depends on
47f0: 20 4f 70 65 6e 53 53 4c 20 76 65 72 73 69 6f 6e   OpenSSL version
4800: 20 61 6e 64 20 63 6f 6d 70 69 6c 65 20 74 69 6d   and compile tim
4810: 65 20 66 6c 61 67 73 2e 0a 0a 5b 63 61 6c 6c 20  e flags...[call 
4820: 5b 63 6d 64 20 74 6c 73 3a 3a 76 65 72 73 69 6f  [cmd tls::versio
4830: 6e 5d 5d 0a 0a 52 65 74 75 72 6e 73 20 74 68 65  n]]..Returns the
4840: 20 4f 70 65 6e 53 53 4c 20 76 65 72 73 69 6f 6e   OpenSSL version
4850: 20 73 74 72 69 6e 67 2e 0a 0a 5b 6c 69 73 74 5f   string...[list_
4860: 65 6e 64 5d 0a 0a 0a 5b 73 65 63 74 69 6f 6e 20  end]...[section 
4870: 22 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c  "Certificate Val
4880: 69 64 61 74 69 6f 6e 22 5d 0a 0a 5b 73 75 62 73  idation"]..[subs
4890: 65 63 74 69 6f 6e 20 22 53 75 6d 6d 61 72 79 20  ection "Summary 
48a0: 6f 66 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20  of command line 
48b0: 6f 70 74 69 6f 6e 73 22 5d 0a 0a 54 68 65 20 66  options"]..The f
48c0: 6f 6c 6c 6f 77 69 6e 67 20 6f 70 74 69 6f 6e 73  ollowing options
48d0: 20 61 72 65 20 75 73 65 64 20 66 6f 72 20 70 65   are used for pe
48e0: 65 72 20 43 65 72 74 69 66 69 63 61 74 65 20 56  er Certificate V
48f0: 61 6c 69 64 61 74 69 6f 6e 3a 0a 0a 5b 6c 69 73  alidation:..[lis
4900: 74 5f 62 65 67 69 6e 20 6f 70 74 69 6f 6e 73 5d  t_begin options]
4910: 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 64 69  ..[opt_def -cadi
4920: 72 20 5b 61 72 67 20 64 69 72 65 63 74 6f 72 79  r [arg directory
4930: 5d 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65  ]].Specifies the
4940: 20 64 69 72 65 63 74 6f 72 79 20 77 68 65 72 65   directory where
4950: 20 74 68 65 20 43 65 72 74 69 66 69 63 61 74 65   the Certificate
4960: 20 41 75 74 68 6f 72 69 74 79 20 28 43 41 29 20   Authority (CA) 
4970: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65  certificates are
4980: 0a 73 74 6f 72 65 64 2e 20 54 68 65 20 64 65 66  .stored. The def
4990: 61 75 6c 74 20 69 73 20 70 6c 61 74 66 6f 72 6d  ault is platform
49a0: 20 73 70 65 63 69 66 69 63 2c 20 62 75 74 20 69   specific, but i
49b0: 73 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20  s usually [file 
49c0: 22 2f 65 74 63 2f 73 73 6c 2f 63 65 72 74 73 22  "/etc/ssl/certs"
49d0: 5d 20 6f 6e 0a 4c 69 6e 75 78 2f 55 6e 69 78 20  ] on.Linux/Unix 
49e0: 73 79 73 74 65 6d 73 2e 20 54 68 65 20 64 65 66  systems. The def
49f0: 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 20 63 61  ault location ca
4a00: 6e 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20  n be overridden 
4a10: 62 79 20 74 68 65 0a 5b 76 61 72 20 53 53 4c 5f  by the.[var SSL_
4a20: 43 45 52 54 5f 44 49 52 5d 20 65 6e 76 69 72 6f  CERT_DIR] enviro
4a30: 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 2e 0a  nment variable..
4a40: 0a 5b 6f 70 74 5f 64 65 66 20 2d 63 61 66 69 6c  .[opt_def -cafil
4a50: 65 20 5b 61 72 67 20 66 69 6c 65 6e 61 6d 65 5d  e [arg filename]
4a60: 5d 0a 53 70 65 63 69 66 69 65 73 20 74 68 65 20  ].Specifies the 
4a70: 66 69 6c 65 20 77 69 74 68 20 74 68 65 20 43 65  file with the Ce
4a80: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
4a90: 69 74 79 20 28 43 41 29 20 63 65 72 74 69 66 69  ity (CA) certifi
4aa0: 63 61 74 65 73 20 74 6f 20 75 73 65 20 69 6e 0a  cates to use in.
4ab0: 5b 63 6f 6e 73 74 20 50 45 4d 5d 20 66 69 6c 65  [const PEM] file
4ac0: 20 66 6f 72 6d 61 74 2e 20 54 68 65 20 64 65 66   format. The def
4ad0: 61 75 6c 74 20 69 73 20 5b 66 69 6c 65 20 63 65  ault is [file ce
4ae0: 72 74 2e 70 65 6d 5d 2c 20 69 6e 20 74 68 65 20  rt.pem], in the 
4af0: 4f 70 65 6e 53 53 4c 20 64 69 72 65 63 74 6f 72  OpenSSL director
4b00: 79 2e 20 4f 6e 0a 4c 69 6e 75 78 2f 55 6e 69 78  y. On.Linux/Unix
4b10: 20 73 79 73 74 65 6d 73 2c 20 74 68 69 73 20 69   systems, this i
4b20: 73 20 75 73 75 61 6c 6c 79 20 5b 66 69 6c 65 20  s usually [file 
4b30: 2f 65 74 63 2f 73 73 6c 2f 63 61 2d 62 75 6e 64  /etc/ssl/ca-bund
4b40: 6c 65 2e 70 65 6d 5d 2e 20 54 68 65 20 64 65 66  le.pem]. The def
4b50: 61 75 6c 74 20 66 69 6c 65 0a 63 61 6e 20 62 65  ault file.can be
4b60: 20 6f 76 65 72 72 69 64 64 65 6e 20 62 79 20 74   overridden by t
4b70: 68 65 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54  he [var SSL_CERT
4b80: 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65  _FILE] environme
4b90: 6e 74 20 76 61 72 69 61 62 6c 65 2e 0a 0a 5b 6f  nt variable...[o
4ba0: 70 74 5f 64 65 66 20 2d 63 61 73 74 6f 72 65 20  pt_def -castore 
4bb0: 5b 61 72 67 20 55 52 49 5d 5d 0a 53 70 65 63 69  [arg URI]].Speci
4bc0: 66 69 65 73 20 74 68 65 20 55 6e 69 66 6f 72 6d  fies the Uniform
4bd0: 20 52 65 73 6f 75 72 63 65 20 49 64 65 6e 74 69   Resource Identi
4be0: 66 69 65 72 20 28 55 52 49 29 20 66 6f 72 20 74  fier (URI) for t
4bf0: 68 65 20 43 65 72 74 69 66 69 63 61 74 65 20 41  he Certificate A
4c00: 75 74 68 6f 72 69 74 79 0a 28 43 41 29 20 73 74  uthority.(CA) st
4c10: 6f 72 65 2c 20 77 68 69 63 68 20 6d 61 79 20 62  ore, which may b
4c20: 65 20 61 20 73 69 6e 67 6c 65 20 63 6f 6e 74 61  e a single conta
4c30: 69 6e 65 72 20 6f 72 20 61 20 63 61 74 61 6c 6f  iner or a catalo
4c40: 67 20 6f 66 20 63 6f 6e 74 61 69 6e 65 72 73 2e  g of containers.
4c50: 0a 53 74 61 72 74 69 6e 67 20 77 69 74 68 20 4f  .Starting with O
4c60: 70 65 6e 53 53 4c 20 33 2e 32 20 6f 6e 20 57 69  penSSL 3.2 on Wi
4c70: 6e 64 6f 77 73 2c 20 73 65 74 20 74 6f 20 22 5b  ndows, set to "[
4c80: 63 6f 6e 73 74 20 22 6f 72 67 2e 6f 70 65 6e 73  const "org.opens
4c90: 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f 2f 22 5d  sl.winstore://"]
4ca0: 22 0a 74 6f 20 75 73 65 20 74 68 65 20 62 75 69  ".to use the bui
4cb0: 6c 74 2d 69 6e 20 57 69 6e 64 6f 77 73 20 43 65  lt-in Windows Ce
4cc0: 72 74 69 66 69 63 61 74 65 20 53 74 6f 72 65 2e  rtificate Store.
4cd0: 20 54 68 69 73 20 73 74 6f 72 65 20 6f 6e 6c 79   This store only
4ce0: 20 73 75 70 70 6f 72 74 73 20 72 6f 6f 74 0a 63   supports root.c
4cf0: 65 72 74 69 66 69 63 61 74 65 20 73 74 6f 72 65  ertificate store
4d00: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 2d 72 65  s...[opt_def -re
4d10: 71 75 65 73 74 20 5b 61 72 67 20 62 6f 6f 6c 5d  quest [arg bool]
4d20: 5d 0a 52 65 71 75 65 73 74 20 61 20 63 65 72 74  ].Request a cert
4d30: 69 66 69 63 61 74 65 20 66 72 6f 6d 20 70 65 65  ificate from pee
4d40: 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53 4c  r during the SSL
4d50: 20 68 61 6e 64 73 68 61 6b 65 2e 20 54 68 69 73   handshake. This
4d60: 20 69 73 20 6e 65 65 64 65 64 20 74 6f 20 64 6f   is needed to do
4d70: 0a 43 65 72 74 69 66 69 63 61 74 65 20 56 61 6c  .Certificate Val
4d80: 69 64 61 74 69 6f 6e 2e 20 44 65 66 61 75 6c 74  idation. Default
4d90: 20 69 73 20 5b 63 6f 6e 73 74 20 74 72 75 65 5d   is [const true]
4da0: 2e 20 49 6e 20 61 64 64 69 74 69 6f 6e 2c 20 74  . In addition, t
4db0: 68 65 0a 63 6c 69 65 6e 74 20 63 61 6e 20 6d 61  he.client can ma
4dc0: 6e 75 61 6c 6c 79 20 69 6e 73 70 65 63 74 20 61  nually inspect a
4dd0: 6e 64 20 61 63 63 65 70 74 20 6f 72 20 72 65 6a  nd accept or rej
4de0: 65 63 74 20 65 61 63 68 20 63 65 72 74 69 66 69  ect each certifi
4df0: 63 61 74 65 20 75 73 69 6e 67 20 74 68 65 0a 5b  cate using the.[
4e00: 61 72 67 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d  arg -validatecom
4e10: 6d 61 6e 64 5d 20 6f 70 74 69 6f 6e 2e 0a 0a 5b  mand] option...[
4e20: 6f 70 74 5f 64 65 66 20 2d 72 65 71 75 69 72 65  opt_def -require
4e30: 20 5b 61 72 67 20 62 6f 6f 6c 5d 5d 0a 52 65 71   [arg bool]].Req
4e40: 75 69 72 65 20 61 20 76 61 6c 69 64 20 63 65 72  uire a valid cer
4e50: 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 70 65  tificate from pe
4e60: 65 72 20 64 75 72 69 6e 67 20 74 68 65 20 53 53  er during the SS
4e70: 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20  L handshake. If 
4e80: 74 68 69 73 20 69 73 20 73 65 74 0a 74 6f 20 5b  this is set.to [
4e90: 63 6f 6e 73 74 20 74 72 75 65 5d 2c 20 74 68 65  const true], the
4ea0: 6e 20 5b 61 72 67 20 2d 72 65 71 75 65 73 74 5d  n [arg -request]
4eb0: 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 20 73 65   must also be se
4ec0: 74 20 74 6f 20 5b 63 6f 6e 73 74 20 74 72 75 65  t to [const true
4ed0: 5d 20 61 6e 64 20 65 69 74 68 65 72 0a 5b 61 72  ] and either.[ar
4ee0: 67 20 2d 63 61 64 69 72 5d 2c 20 5b 61 72 67 20  g -cadir], [arg 
4ef0: 2d 63 61 66 69 6c 65 5d 2c 20 5b 61 72 67 20 2d  -cafile], [arg -
4f00: 63 61 73 74 6f 72 65 5d 2c 20 6f 72 20 61 20 70  castore], or a p
4f10: 6c 61 74 66 6f 72 6d 20 64 65 66 61 75 6c 74 20  latform default 
4f20: 6d 75 73 74 20 62 65 0a 70 72 6f 76 69 64 65 64  must be.provided
4f30: 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 76 61 6c   in order to val
4f40: 69 64 61 74 65 20 61 67 61 69 6e 73 74 2e 20 54  idate against. T
4f50: 68 65 20 64 65 66 61 75 6c 74 20 69 73 20 5b 63  he default is [c
4f60: 6f 6e 73 74 20 66 61 6c 73 65 5d 20 73 69 6e 63  onst false] sinc
4f70: 65 20 6e 6f 74 0a 61 6c 6c 20 70 6c 61 74 66 6f  e not.all platfo
4f80: 72 6d 73 20 68 61 76 65 20 63 65 72 74 69 66 69  rms have certifi
4f90: 63 61 74 65 73 20 74 6f 20 76 61 6c 69 64 61 74  cates to validat
4fa0: 65 20 61 67 61 69 6e 73 74 20 69 6e 20 61 20 66  e against in a f
4fb0: 6f 72 6d 20 63 6f 6d 70 61 74 69 62 6c 65 20 77  orm compatible w
4fc0: 69 74 68 0a 4f 70 65 6e 53 53 4c 2e 20 53 65 65  ith.OpenSSL. See
4fd0: 20 5b 73 65 63 74 72 65 66 20 22 43 65 72 74 69   [sectref "Certi
4fe0: 66 69 63 61 74 65 20 56 61 6c 69 64 61 74 69 6f  ficate Validatio
4ff0: 6e 22 5d 20 66 6f 72 20 6d 6f 72 65 20 64 65 74  n"] for more det
5000: 61 69 6c 73 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64  ails...[list_end
5010: 5d 0a 0a 5b 73 75 62 73 65 63 74 69 6f 6e 20 22  ]..[subsection "
5020: 57 68 65 6e 20 61 72 65 20 63 6f 6d 6d 61 6e 64  When are command
5030: 20 6c 69 6e 65 20 6f 70 74 69 6f 6e 73 20 6e 65   line options ne
5040: 65 64 65 64 3f 22 5d 0a 0a 42 79 20 64 65 66 61  eded?"]..By defa
5050: 75 6c 74 2c 20 61 20 63 6c 69 65 6e 74 20 54 4c  ult, a client TL
5060: 53 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 64 6f 65  S connection doe
5070: 73 20 5b 65 6d 70 68 20 4e 4f 54 5d 20 76 61 6c  s [emph NOT] val
5080: 69 64 61 74 65 20 74 68 65 20 73 65 72 76 65 72  idate the server
5090: 20 63 65 72 74 69 66 69 63 61 74 65 0a 63 68 61   certificate.cha
50a0: 69 6e 2e 20 54 68 69 73 20 6c 69 6d 69 74 61 74  in. This limitat
50b0: 69 6f 6e 20 69 73 20 64 75 65 20 74 6f 20 74 68  ion is due to th
50c0: 65 20 6c 61 63 6b 20 6f 66 20 61 20 63 6f 6d 6d  e lack of a comm
50d0: 6f 6e 20 63 72 6f 73 73 20 70 6c 61 74 66 6f 72  on cross platfor
50e0: 6d 0a 64 61 74 61 62 61 73 65 20 6f 66 20 43 65  m.database of Ce
50f0: 72 74 69 66 69 63 61 74 65 20 41 75 74 68 6f 72  rtificate Author
5100: 69 74 79 20 28 43 41 29 20 70 72 6f 76 69 64 65  ity (CA) provide
5110: 64 20 63 65 72 74 69 66 69 63 61 74 65 73 20 74  d certificates t
5120: 6f 20 76 61 6c 69 64 61 74 65 0a 61 67 61 69 6e  o validate.again
5130: 73 74 2e 20 4d 61 6e 79 20 4c 69 6e 75 78 20 73  st. Many Linux s
5140: 79 73 74 65 6d 73 20 6e 61 74 69 76 65 6c 79 20  ystems natively 
5150: 73 75 70 70 6f 72 74 20 4f 70 65 6e 53 53 4c 20  support OpenSSL 
5160: 61 6e 64 20 74 68 75 73 20 68 61 76 65 20 74 68  and thus have th
5170: 65 73 65 0a 63 65 72 74 69 66 69 63 61 74 65 73  ese.certificates
5180: 20 69 6e 73 74 61 6c 6c 65 64 20 61 73 20 70 61   installed as pa
5190: 72 74 20 6f 66 20 74 68 65 20 4f 53 2c 20 62 75  rt of the OS, bu
51a0: 74 20 4d 61 63 4f 53 20 61 6e 64 20 57 69 6e 64  t MacOS and Wind
51b0: 6f 77 73 20 64 6f 20 6e 6f 74 2e 20 49 6e 0a 6f  ows do not. In.o
51c0: 72 64 65 72 20 74 6f 20 75 73 65 20 74 68 65 20  rder to use the 
51d0: 5b 6f 70 74 69 6f 6e 20 2d 72 65 71 75 69 72 65  [option -require
51e0: 5d 20 6f 70 74 69 6f 6e 2c 20 6f 6e 65 20 6f 66  ] option, one of
51f0: 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 6d   the following m
5200: 75 73 74 20 62 65 20 74 72 75 65 3a 0a 0a 5b 6c  ust be true:..[l
5210: 69 73 74 5f 62 65 67 69 6e 20 69 74 65 6d 69 7a  ist_begin itemiz
5220: 65 64 5d 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20 4c  ed]..[item].On L
5230: 69 6e 75 78 20 61 6e 64 20 55 6e 69 78 20 73 79  inux and Unix sy
5240: 73 74 65 6d 73 20 77 69 74 68 20 4f 70 65 6e 53  stems with OpenS
5250: 53 4c 20 61 6c 72 65 61 64 79 20 69 6e 73 74 61  SL already insta
5260: 6c 6c 65 64 2c 20 69 66 20 74 68 65 20 43 41 0a  lled, if the CA.
5270: 63 65 72 74 69 66 69 63 61 74 65 73 20 61 72 65  certificates are
5280: 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 73   stored in the s
5290: 74 61 6e 64 61 72 64 20 6c 6f 63 61 74 69 6f 6e  tandard location
52a0: 73 2c 20 6f 72 20 69 66 20 74 68 65 20 5b 76 61  s, or if the [va
52b0: 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 0a  r SSL_CERT_DIR].
52c0: 6f 72 20 5b 76 61 72 20 53 53 4c 5f 43 45 52 54  or [var SSL_CERT
52d0: 5f 46 49 4c 45 5d 20 65 6e 76 69 72 6f 6e 6d 65  _FILE] environme
52e0: 6e 74 20 76 61 72 69 61 62 6c 65 73 20 61 72 65  nt variables are
52f0: 20 73 65 74 2c 20 74 68 65 6e 20 5b 6f 70 74 69   set, then [opti
5300: 6f 6e 20 2d 63 61 64 69 72 5d 2c 0a 5b 6f 70 74  on -cadir],.[opt
5310: 69 6f 6e 20 2d 63 61 64 69 72 5d 2c 20 61 6e 64  ion -cadir], and
5320: 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 73 74 6f 72   [option -castor
5330: 65 5d 20 61 72 65 6e 27 74 20 6e 65 65 64 65 64  e] aren't needed
5340: 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20 4f 70 65  ...[item].If Ope
5350: 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69 6e 73 74  nSSL is not inst
5360: 61 6c 6c 65 64 20 69 6e 20 74 68 65 20 64 65 66  alled in the def
5370: 61 75 6c 74 20 6c 6f 63 61 74 69 6f 6e 2c 20 6f  ault location, o
5380: 72 20 77 68 65 6e 20 75 73 69 6e 67 20 4d 61 63  r when using Mac
5390: 20 4f 53 0a 6f 72 20 57 69 6e 64 6f 77 73 20 61   OS.or Windows a
53a0: 6e 64 20 4f 70 65 6e 53 53 4c 20 69 73 20 69 6e  nd OpenSSL is in
53b0: 73 74 61 6c 6c 65 64 2c 20 74 68 65 20 5b 76 61  stalled, the [va
53c0: 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d 20  r SSL_CERT_DIR] 
53d0: 61 6e 64 2f 6f 72 0a 5b 76 61 72 20 53 53 4c 5f  and/or.[var SSL_
53e0: 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69 72  CERT_FILE] envir
53f0: 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65 73  onment variables
5400: 20 6f 72 20 74 68 65 20 6f 6e 65 20 6f 66 20 74   or the one of t
5410: 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 64 69  he [option -cadi
5420: 72 5d 2c 0a 5b 6f 70 74 69 6f 6e 20 2d 63 61 64  r],.[option -cad
5430: 69 72 5d 2c 20 6f 72 20 5b 6f 70 74 69 6f 6e 20  ir], or [option 
5440: 2d 63 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e  -castore] option
5450: 73 20 6d 75 73 74 20 62 65 20 64 65 66 69 6e 65  s must be define
5460: 64 2e 0a 0a 5b 69 74 65 6d 5d 0a 4f 6e 20 57 69  d...[item].On Wi
5470: 6e 64 6f 77 73 2c 20 73 74 61 72 74 69 6e 67 20  ndows, starting 
5480: 69 6e 20 4f 70 65 6e 53 53 4c 20 33 2e 32 2c 20  in OpenSSL 3.2, 
5490: 69 74 20 69 73 20 6e 6f 77 20 70 6f 73 73 69 62  it is now possib
54a0: 6c 65 20 74 6f 20 61 63 63 65 73 73 20 74 68 65  le to access the
54b0: 0a 62 75 69 6c 74 2d 69 6e 20 57 69 6e 64 6f 77  .built-in Window
54c0: 73 20 43 65 72 74 69 66 69 63 61 74 65 20 53 74  s Certificate St
54d0: 6f 72 65 20 66 72 6f 6d 20 4f 70 65 6e 53 53 4c  ore from OpenSSL
54e0: 2e 20 54 68 69 73 20 63 61 6e 20 62 65 20 61 63  . This can be ac
54f0: 68 69 65 76 65 64 20 62 79 0a 73 65 74 74 69 6e  hieved by.settin
5500: 67 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63  g the [option -c
5510: 61 73 74 6f 72 65 5d 20 6f 70 74 69 6f 6e 20 74  astore] option t
5520: 6f 20 22 5b 63 6f 6e 73 74 20 6f 72 67 2e 6f 70  o "[const org.op
5530: 65 6e 73 73 6c 2e 77 69 6e 73 74 6f 72 65 3a 2f  enssl.winstore:/
5540: 2f 5d 22 2e 0a 0a 5b 69 74 65 6d 5d 0a 49 66 20  /]"...[item].If 
5550: 4f 70 65 6e 53 53 4c 20 69 73 20 6e 6f 74 20 69  OpenSSL is not i
5560: 6e 73 74 61 6c 6c 65 64 2c 20 74 68 65 20 43 41  nstalled, the CA
5570: 20 63 65 72 74 69 66 69 63 61 74 65 73 20 6d 75   certificates mu
5580: 73 74 20 62 65 20 64 6f 77 6e 6c 6f 61 64 65 64  st be downloaded
5590: 20 61 6e 64 0a 69 6e 73 74 61 6c 6c 65 64 20 77   and.installed w
55a0: 69 74 68 20 74 68 65 20 75 73 65 72 20 73 6f 66  ith the user sof
55b0: 74 77 61 72 65 2e 20 54 68 65 20 43 55 52 4c 20  tware. The CURL 
55c0: 74 65 61 6d 20 6d 61 6b 65 73 20 74 68 65 6d 20  team makes them 
55d0: 61 76 61 69 6c 61 62 6c 65 20 61 74 0a 5b 75 72  available at.[ur
55e0: 69 20 22 68 74 74 70 73 3a 2f 2f 63 75 72 6c 2e  i "https://curl.
55f0: 73 65 2f 64 6f 63 73 2f 63 61 65 78 74 72 61 63  se/docs/caextrac
5600: 74 2e 68 74 6d 6c 22 20 22 43 41 20 63 65 72 74  t.html" "CA cert
5610: 69 66 69 63 61 74 65 73 20 65 78 74 72 61 63 74  ificates extract
5620: 65 64 0a 66 72 6f 6d 20 4d 6f 7a 69 6c 6c 61 22  ed.from Mozilla"
5630: 5d 20 69 6e 20 74 68 65 20 5b 66 69 6c 65 20 63  ] in the [file c
5640: 61 63 65 72 74 2e 70 65 6d 5d 20 66 69 6c 65 2e  acert.pem] file.
5650: 20 59 6f 75 20 6d 75 73 74 20 74 68 65 6e 20 65   You must then e
5660: 69 74 68 65 72 20 73 65 74 20 74 68 65 0a 5b 76  ither set the.[v
5670: 61 72 20 53 53 4c 5f 43 45 52 54 5f 44 49 52 5d  ar SSL_CERT_DIR]
5680: 20 61 6e 64 2f 6f 72 20 5b 76 61 72 20 53 53 4c   and/or [var SSL
5690: 5f 43 45 52 54 5f 46 49 4c 45 5d 20 65 6e 76 69  _CERT_FILE] envi
56a0: 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65  ronment variable
56b0: 73 20 6f 72 20 74 68 65 0a 5b 6f 70 74 69 6f 6e  s or the.[option
56c0: 20 2d 63 61 64 69 72 5d 20 6f 72 20 5b 6f 70 74   -cadir] or [opt
56d0: 69 6f 6e 20 2d 63 61 66 69 6c 65 5d 20 6f 70 74  ion -cafile] opt
56e0: 69 6f 6e 73 20 74 6f 20 74 68 65 20 43 41 20 63  ions to the CA c
56f0: 65 72 74 20 66 69 6c 65 27 73 20 69 6e 73 74 61  ert file's insta
5700: 6c 6c 0a 6c 6f 63 61 74 69 6f 6e 2e 20 49 74 20  ll.location. It 
5710: 69 73 20 79 6f 75 72 20 72 65 73 70 6f 6e 73 69  is your responsi
5720: 62 69 6c 69 74 79 20 74 6f 20 6b 65 65 70 20 74  bility to keep t
5730: 68 69 73 20 66 69 6c 65 20 75 70 20 74 6f 20 64  his file up to d
5740: 61 74 65 2e 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  ate...[list_end]
5750: 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 43 61 6c 6c  ..[section "Call
5760: 62 61 63 6b 20 4f 70 74 69 6f 6e 73 22 5d 0a 0a  back Options"]..
5770: 41 73 20 70 72 65 76 69 6f 75 73 6c 79 20 64 65  As previously de
5780: 73 63 72 69 62 65 64 2c 20 65 61 63 68 20 63 68  scribed, each ch
5790: 61 6e 6e 65 6c 20 63 61 6e 20 62 65 20 67 69 76  annel can be giv
57a0: 65 6e 20 74 68 65 69 72 20 6f 77 6e 20 63 61 6c  en their own cal
57b0: 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e 64 6c 65  lbacks.to handle
57c0: 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20 70 72   intermediate pr
57d0: 6f 63 65 73 73 69 6e 67 20 62 79 20 74 68 65 20  ocessing by the 
57e0: 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 2c  OpenSSL library,
57f0: 20 75 73 69 6e 67 20 74 68 65 0a 5b 6f 70 74 69   using the.[opti
5800: 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f  on -command], [o
5810: 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d  ption -password]
5820: 2c 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 76  , and [option -v
5830: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
5840: 20 6f 70 74 69 6f 6e 73 0a 70 61 73 73 65 64 20   options.passed 
5850: 74 6f 20 65 69 74 68 65 72 20 6f 66 20 5b 63 6d  to either of [cm
5860: 64 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 20 6f  d tls::socket] o
5870: 72 20 5b 63 6d 64 20 74 6c 73 3a 3a 69 6d 70 6f  r [cmd tls::impo
5880: 72 74 5d 2e 0a 55 6e 6c 69 6b 65 20 70 72 65 76  rt]..Unlike prev
5890: 69 6f 75 73 20 76 65 72 73 69 6f 6e 73 20 6f 66  ious versions of
58a0: 20 54 63 6c 54 4c 53 2c 20 6f 6e 6c 79 20 69 66   TclTLS, only if
58b0: 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 67 65   the callback ge
58c0: 6e 65 72 61 74 65 73 20 61 6e 20 65 72 72 6f 72  nerates an error
58d0: 2c 0a 77 69 6c 6c 20 74 68 65 20 5b 73 79 73 63  ,.will the [sysc
58e0: 6d 64 20 62 67 65 72 72 6f 72 5d 20 63 6f 6d 6d  md bgerror] comm
58f0: 61 6e 64 20 62 65 20 69 6e 76 6f 6b 65 64 20 77  and be invoked w
5900: 69 74 68 20 74 68 65 20 65 72 72 6f 72 20 69 6e  ith the error in
5910: 66 6f 72 6d 61 74 69 6f 6e 2e 0a 0a 5b 73 75 62  formation...[sub
5920: 73 65 63 74 69 6f 6e 20 22 56 61 6c 75 65 73 20  section "Values 
5930: 66 6f 72 20 43 6f 6d 6d 61 6e 64 20 43 61 6c 6c  for Command Call
5940: 62 61 63 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c  back"]..The call
5950: 62 61 63 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70  back for the [op
5960: 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 6f  tion -command] o
5970: 70 74 69 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64  ption is invoked
5980: 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f 69 6e   at several poin
5990: 74 73 20 64 75 72 69 6e 67 20 74 68 65 0a 4f 70  ts during the.Op
59a0: 65 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 20  enSSL handshake 
59b0: 61 6e 64 20 64 75 72 69 6e 67 20 72 6f 75 74 69  and during routi
59c0: 6e 65 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20 53  ne operations. S
59d0: 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 74 68 65  ee below for the
59e0: 20 70 6f 73 73 69 62 6c 65 0a 61 72 67 75 6d 65   possible.argume
59f0: 6e 74 73 20 70 61 73 73 65 64 20 74 6f 20 74 68  nts passed to th
5a00: 65 20 63 61 6c 6c 62 61 63 6b 20 73 63 72 69 70  e callback scrip
5a10: 74 2e 20 56 61 6c 75 65 73 20 72 65 74 75 72 6e  t. Values return
5a20: 65 64 20 66 72 6f 6d 20 74 68 65 20 63 61 6c 6c  ed from the call
5a30: 62 61 63 6b 20 61 72 65 0a 69 67 6e 6f 72 65 64  back are.ignored
5a40: 2e 0a 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f  ...[list_begin o
5a50: 70 74 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65  ptions]..[opt_de
5a60: 66 20 65 72 72 6f 72 20 5b 61 72 67 20 22 63 68  f error [arg "ch
5a70: 61 6e 6e 65 6c 49 64 20 6d 65 73 73 61 67 65 22  annelId message"
5a80: 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20 6f 66 20  ]].This form of 
5a90: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f  callback is invo
5aa0: 6b 65 64 20 77 68 65 6e 65 76 65 72 20 61 6e 20  ked whenever an 
5ab0: 65 72 72 6f 72 20 6f 63 63 75 72 73 20 64 75 72  error occurs dur
5ac0: 69 6e 67 20 74 68 65 20 69 6e 69 74 69 61 6c 0a  ing the initial.
5ad0: 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 68 61 6e 64  connection, hand
5ae0: 73 68 61 6b 65 2c 20 6f 72 20 49 2f 4f 20 6f 70  shake, or I/O op
5af0: 65 72 61 74 69 6f 6e 73 2e 20 54 68 65 20 5b 61  erations. The [a
5b00: 72 67 20 6d 65 73 73 61 67 65 5d 20 61 72 67 75  rg message] argu
5b10: 6d 65 6e 74 20 63 61 6e 20 62 65 0a 66 72 6f 6d  ment can be.from
5b20: 20 74 68 65 20 54 63 6c 5f 45 72 72 6e 6f 4d 73   the Tcl_ErrnoMs
5b30: 67 2c 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74  g, OpenSSL funct
5b40: 69 6f 6e 20 5b 66 75 6e 20 45 52 52 5f 72 65 61  ion [fun ERR_rea
5b50: 73 6f 6e 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67  son_error_string
5b60: 28 29 5d 2c 0a 6f 72 20 61 20 63 75 73 74 6f 6d  ()],.or a custom
5b70: 20 6d 65 73 73 61 67 65 2e 20 54 68 69 73 20 63   message. This c
5b80: 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20 66  allback is new f
5b90: 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a  or TclTLS 1.8...
5ba0: 5b 6f 70 74 5f 64 65 66 20 69 6e 66 6f 20 5b 61  [opt_def info [a
5bb0: 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20 6d 61  rg "channelId ma
5bc0: 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65 73 73 61 67  jor minor messag
5bd0: 65 20 74 79 70 65 22 5d 5d 0a 54 68 69 73 20 66  e type"]].This f
5be0: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20  orm of callback 
5bf0: 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68  is invoked by th
5c00: 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69  e OpenSSL functi
5c10: 6f 6e 0a 5b 66 75 6e 20 53 53 4c 5f 73 65 74 5f  on.[fun SSL_set_
5c20: 69 6e 66 6f 5f 63 61 6c 6c 62 61 63 6b 28 29 5d  info_callback()]
5c30: 20 64 75 72 69 6e 67 20 74 68 65 20 69 6e 69 74   during the init
5c40: 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 61  ial connection a
5c50: 6e 64 20 68 61 6e 64 73 68 61 6b 65 0a 6f 70 65  nd handshake.ope
5c60: 72 61 74 69 6f 6e 73 2e 20 54 68 65 20 61 72 67  rations. The arg
5c70: 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a 5b 6c 69  uments are:..[li
5c80: 73 74 5f 62 65 67 69 6e 20 64 65 66 69 6e 69 74  st_begin definit
5c90: 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b 61 72 67  ions]..[def [arg
5ca0: 20 6d 61 6a 6f 72 5d 5d 0a 4d 61 6a 6f 72 20 63   major]].Major c
5cb0: 61 74 65 67 6f 72 79 20 66 6f 72 20 65 72 72 6f  ategory for erro
5cc0: 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d 73 20 61  r. Valid enums a
5cd0: 72 65 3a 20 5b 63 6f 6e 73 74 20 68 61 6e 64 73  re: [const hands
5ce0: 68 61 6b 65 5d 2c 20 5b 63 6f 6e 73 74 20 61 6c  hake], [const al
5cf0: 65 72 74 5d 2c 0a 5b 63 6f 6e 73 74 20 63 6f 6e  ert],.[const con
5d00: 6e 65 63 74 5d 2c 20 5b 63 6f 6e 73 74 20 61 63  nect], [const ac
5d10: 63 65 70 74 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72  cept]...[def [ar
5d20: 67 20 6d 69 6e 6f 72 5d 5d 0a 4d 69 6e 6f 72 20  g minor]].Minor 
5d30: 63 61 74 65 67 6f 72 79 20 66 6f 72 20 65 72 72  category for err
5d40: 6f 72 2e 20 56 61 6c 69 64 20 65 6e 75 6d 73 20  or. Valid enums 
5d50: 61 72 65 3a 20 5b 63 6f 6e 73 74 20 73 74 61 72  are: [const star
5d60: 74 5d 2c 20 5b 63 6f 6e 73 74 20 64 6f 6e 65 5d  t], [const done]
5d70: 2c 20 5b 63 6f 6e 73 74 20 72 65 61 64 5d 2c 0a  , [const read],.
5d80: 5b 63 6f 6e 73 74 20 77 72 69 74 65 5d 2c 20 5b  [const write], [
5d90: 63 6f 6e 73 74 20 6c 6f 6f 70 5d 2c 20 5b 63 6f  const loop], [co
5da0: 6e 73 74 20 65 78 69 74 5d 2e 0a 0a 5b 64 65 66  nst exit]...[def
5db0: 20 5b 61 72 67 20 6d 65 73 73 61 67 65 5d 5d 0a   [arg message]].
5dc0: 44 65 73 63 72 69 70 74 69 76 65 20 6d 65 73 73  Descriptive mess
5dd0: 61 67 65 20 73 74 72 69 6e 67 20 77 68 69 63 68  age string which
5de0: 20 6d 61 79 20 62 65 20 67 65 6e 65 72 61 74 65   may be generate
5df0: 64 20 65 69 74 68 65 72 20 62 79 0a 5b 66 75 6e  d either by.[fun
5e00: 20 53 53 4c 5f 73 74 61 74 65 5f 73 74 72 69 6e   SSL_state_strin
5e10: 67 5f 6c 6f 6e 67 28 29 5d 20 6f 72 20 5b 66 75  g_long()] or [fu
5e20: 6e 20 53 53 4c 5f 61 6c 65 72 74 5f 64 65 73 63  n SSL_alert_desc
5e30: 5f 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 5d 2c  _string_long()],
5e40: 0a 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68  .depending on th
5e50: 65 20 63 6f 6e 74 65 78 74 2e 0a 0a 5b 64 65 66  e context...[def
5e60: 20 5b 61 72 67 20 74 79 70 65 5d 5d 0a 46 6f 72   [arg type]].For
5e70: 20 61 6c 65 72 74 73 2c 20 74 68 65 20 70 6f 73   alerts, the pos
5e80: 73 69 62 6c 65 20 76 61 6c 75 65 73 20 61 72 65  sible values are
5e90: 3a 20 5b 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67  : [const warning
5ea0: 5d 2c 0a 5b 63 6f 6e 73 74 20 66 61 74 61 6c 5d  ],.[const fatal]
5eb0: 2c 20 61 6e 64 20 5b 63 6f 6e 73 74 20 75 6e 6b  , and [const unk
5ec0: 6e 6f 77 6e 5d 2e 20 46 6f 72 20 6f 74 68 65 72  nown]. For other
5ed0: 73 2c 20 5b 63 6f 6e 73 74 20 69 6e 66 6f 5d 20  s, [const info] 
5ee0: 69 73 20 75 73 65 64 2e 0a 54 68 69 73 20 61 72  is used..This ar
5ef0: 67 75 6d 65 6e 74 20 69 73 20 6e 65 77 20 66 6f  gument is new fo
5f00: 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b  r TclTLS 1.8...[
5f10: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f  list_end]..[opt_
5f20: 64 65 66 20 6d 65 73 73 61 67 65 20 5b 61 72 67  def message [arg
5f30: 20 22 63 68 61 6e 6e 65 6c 49 64 20 64 69 72 65   "channelId dire
5f40: 63 74 69 6f 6e 20 76 65 72 73 69 6f 6e 20 63 6f  ction version co
5f50: 6e 74 65 6e 74 5f 74 79 70 65 20 6d 65 73 73 61  ntent_type messa
5f60: 67 65 22 5d 5d 0a 54 68 69 73 20 66 6f 72 6d 20  ge"]].This form 
5f70: 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69  of callback is i
5f80: 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70  nvoked by the Op
5f90: 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 5b  enSSL function.[
5fa0: 66 75 6e 20 53 53 4c 5f 73 65 74 5f 6d 73 67 5f  fun SSL_set_msg_
5fb0: 63 61 6c 6c 62 61 63 6b 28 29 5d 20 77 68 65 6e  callback()] when
5fc0: 65 76 65 72 20 61 20 6d 65 73 73 61 67 65 20 69  ever a message i
5fd0: 73 20 73 65 6e 74 20 6f 72 20 72 65 63 65 69 76  s sent or receiv
5fe0: 65 64 20 64 75 72 69 6e 67 20 74 68 65 0a 69 6e  ed during the.in
5ff0: 69 74 69 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e  itial connection
6000: 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20 6f 72 20  , handshake, or 
6010: 49 2f 4f 20 6f 70 65 72 61 74 69 6f 6e 73 2e 20  I/O operations. 
6020: 49 74 20 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c  It is only avail
6030: 61 62 6c 65 20 77 68 65 6e 0a 4f 70 65 6e 53 53  able when.OpenSS
6040: 4c 20 69 73 20 63 6f 6d 70 6c 69 65 64 20 77 69  L is complied wi
6050: 74 68 20 74 68 65 20 5b 63 6f 6e 73 74 20 65 6e  th the [const en
6060: 61 62 6c 65 2d 73 73 6c 2d 74 72 61 63 65 5d 20  able-ssl-trace] 
6070: 6f 70 74 69 6f 6e 2e 20 54 68 69 73 20 63 61 6c  option. This cal
6080: 6c 62 61 63 6b 20 69 73 0a 6e 65 77 20 66 6f 72  lback is.new for
6090: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65   TclTLS 1.8. The
60a0: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a   arguments are:.
60b0: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66  .[list_begin def
60c0: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20  initions]..[def 
60d0: 5b 61 72 67 20 64 69 72 65 63 74 69 6f 6e 5d 5d  [arg direction]]
60e0: 0a 44 69 72 65 63 74 69 6f 6e 20 69 73 20 65 69  .Direction is ei
60f0: 74 68 65 72 20 5b 63 6f 6e 73 74 20 53 65 6e 74  ther [const Sent
6100: 5d 20 6f 72 20 5b 63 6f 6e 73 74 20 52 65 63 65  ] or [const Rece
6110: 69 76 65 64 5d 2e 0a 0a 5b 64 65 66 20 5b 61 72  ived]...[def [ar
6120: 67 20 76 65 72 73 69 6f 6e 5d 5d 0a 56 65 72 73  g version]].Vers
6130: 69 6f 6e 20 69 73 20 74 68 65 20 70 72 6f 74 6f  ion is the proto
6140: 63 6f 6c 20 76 65 72 73 69 6f 6e 2e 0a 0a 5b 64  col version...[d
6150: 65 66 20 5b 61 72 67 20 63 6f 6e 74 65 6e 74 5f  ef [arg content_
6160: 74 79 70 65 5d 5d 0a 43 6f 6e 74 65 6e 74 20 74  type]].Content t
6170: 79 70 65 20 69 73 20 74 68 65 20 6d 65 73 73 61  ype is the messa
6180: 67 65 20 63 6f 6e 74 65 6e 74 20 74 79 70 65 2e  ge content type.
6190: 0a 0a 5b 64 65 66 20 5b 61 72 67 20 6d 65 73 73  ..[def [arg mess
61a0: 61 67 65 5d 5d 0a 4d 65 73 73 61 67 65 20 69 73  age]].Message is
61b0: 20 6d 6f 72 65 20 69 6e 66 6f 20 66 72 6f 6d 20   more info from 
61c0: 74 68 65 20 5b 63 6f 6e 73 74 20 53 53 4c 5f 74  the [const SSL_t
61d0: 72 61 63 65 5d 20 41 50 49 2e 0a 0a 5b 6c 69 73  race] API...[lis
61e0: 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f 64 65 66  t_end]..[opt_def
61f0: 20 73 65 73 73 69 6f 6e 20 5b 61 72 67 20 22 63   session [arg "c
6200: 68 61 6e 6e 65 6c 49 64 20 73 65 73 73 69 6f 6e  hannelId session
6210: 5f 69 64 20 73 65 73 73 69 6f 6e 5f 74 69 63 6b  _id session_tick
6220: 65 74 20 6c 69 66 65 74 69 6d 65 22 5d 5d 0a 54  et lifetime"]].T
6230: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
6240: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20  back is invoked 
6250: 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66  by the OpenSSL f
6260: 75 6e 63 74 69 6f 6e 0a 5b 66 75 6e 20 53 53 4c  unction.[fun SSL
6270: 5f 43 54 58 5f 73 65 73 73 5f 73 65 74 5f 6e 65  _CTX_sess_set_ne
6280: 77 5f 63 62 28 29 5d 20 77 68 65 6e 65 76 65 72  w_cb()] whenever
6290: 20 61 20 6e 65 77 20 73 65 73 73 69 6f 6e 20 69   a new session i
62a0: 64 20 69 73 20 73 65 6e 74 20 62 79 20 74 68 65  d is sent by the
62b0: 0a 73 65 72 76 65 72 20 64 75 72 69 6e 67 20 74  .server during t
62c0: 68 65 20 69 6e 69 74 69 61 6c 20 63 6f 6e 6e 65  he initial conne
62d0: 63 74 69 6f 6e 20 61 6e 64 20 68 61 6e 64 73 68  ction and handsh
62e0: 61 6b 65 20 61 6e 64 20 61 6c 73 6f 20 64 75 72  ake and also dur
62f0: 69 6e 67 20 74 68 65 20 73 65 73 73 69 6f 6e 0a  ing the session.
6300: 69 66 20 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d  if the [option -
6310: 70 6f 73 74 5f 68 61 6e 64 73 68 61 6b 65 5d 20  post_handshake] 
6320: 6f 70 74 69 6f 6e 20 69 73 20 73 65 74 20 74 6f  option is set to
6330: 20 74 72 75 65 2e 20 54 68 69 73 20 63 61 6c 6c   true. This call
6340: 62 61 63 6b 20 69 73 20 6e 65 77 20 66 6f 72 0a  back is new for.
6350: 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65 20  TclTLS 1.8. The 
6360: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a  arguments are:..
6370: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
6380: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b  nitions]..[def [
6390: 61 72 67 20 73 65 73 73 69 6f 6e 5f 69 64 5d 5d  arg session_id]]
63a0: 0a 53 65 73 73 69 6f 6e 20 49 64 20 69 73 20 74  .Session Id is t
63b0: 68 65 20 63 75 72 72 65 6e 74 20 73 65 73 73 69  he current sessi
63c0: 6f 6e 20 69 64 65 6e 74 69 66 69 65 72 0a 0a 5b  on identifier..[
63d0: 64 65 66 20 5b 61 72 67 20 73 65 73 73 69 6f 6e  def [arg session
63e0: 5f 74 69 63 6b 65 74 5d 5d 0a 54 69 63 6b 65 74  _ticket]].Ticket
63f0: 20 69 73 20 74 68 65 20 73 65 73 73 69 6f 6e 20   is the session 
6400: 74 69 63 6b 65 74 20 69 6e 66 6f 0a 0a 5b 64 65  ticket info..[de
6410: 66 20 5b 61 72 67 20 6c 69 66 65 74 69 6d 65 5d  f [arg lifetime]
6420: 5d 0a 4c 69 66 65 74 69 6d 65 20 69 73 20 74 68  ].Lifetime is th
6430: 65 20 74 69 63 6b 65 74 20 6c 69 66 65 74 69 6d  e ticket lifetim
6440: 65 20 69 6e 20 73 65 63 6f 6e 64 73 2e 0a 0a 5b  e in seconds...[
6450: 6c 69 73 74 5f 65 6e 64 5d 0a 0a 5b 6f 70 74 5f  list_end]..[opt_
6460: 64 65 66 20 76 65 72 69 66 79 20 5b 61 72 67 20  def verify [arg 
6470: 22 63 68 61 6e 6e 65 6c 49 64 20 64 65 70 74 68  "channelId depth
6480: 20 63 65 72 74 20 73 74 61 74 75 73 20 65 72 72   cert status err
6490: 6f 72 22 5d 5d 0a 54 68 69 73 20 63 61 6c 6c 62  or"]].This callb
64a0: 61 63 6b 20 77 61 73 20 6d 6f 76 65 64 20 74 6f  ack was moved to
64b0: 20 5b 6f 70 74 69 6f 6e 20 2d 76 61 6c 69 64 61   [option -valida
64c0: 74 65 63 6f 6d 6d 61 6e 64 5d 20 69 6e 20 54 63  tecommand] in Tc
64d0: 6c 54 4c 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74  lTLS 1.8...[list
64e0: 5f 65 6e 64 5d 0a 0a 5b 73 75 62 73 65 63 74 69  _end]..[subsecti
64f0: 6f 6e 20 22 56 61 6c 75 65 73 20 66 6f 72 20 50  on "Values for P
6500: 61 73 73 77 6f 72 64 20 43 61 6c 6c 62 61 63 6b  assword Callback
6510: 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63 6b  "]..The callback
6520: 20 66 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f 6e   for the [option
6530: 20 2d 70 61 73 73 77 6f 72 64 5d 20 6f 70 74 69   -password] opti
6540: 6f 6e 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79  on is invoked by
6550: 20 54 63 6c 54 4c 53 20 77 68 65 6e 65 76 65 72   TclTLS whenever
6560: 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73 0a 74   OpenSSL needs.t
6570: 6f 20 6f 62 74 61 69 6e 20 61 20 70 61 73 73 77  o obtain a passw
6580: 6f 72 64 2e 20 53 65 65 20 62 65 6c 6f 77 20 66  ord. See below f
6590: 6f 72 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20  or the possible 
65a0: 61 72 67 75 6d 65 6e 74 73 20 70 61 73 73 65 64  arguments passed
65b0: 20 74 6f 20 74 68 65 0a 63 61 6c 6c 62 61 63 6b   to the.callback
65c0: 20 73 63 72 69 70 74 2e 20 54 68 65 20 75 73 65   script. The use
65d0: 72 20 70 72 6f 76 69 64 65 64 20 70 61 73 73 77  r provided passw
65e0: 6f 72 64 20 69 73 20 65 78 70 65 63 74 65 64 20  ord is expected 
65f0: 74 6f 20 62 65 20 72 65 74 75 72 6e 65 64 20 62  to be returned b
6600: 79 20 74 68 65 0a 63 61 6c 6c 62 61 63 6b 2e 0a  y the.callback..
6610: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74  .[list_begin opt
6620: 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20  ions]..[opt_def 
6630: 70 61 73 73 77 6f 72 64 20 5b 61 72 67 20 22 72  password [arg "r
6640: 77 66 6c 61 67 20 73 69 7a 65 22 5d 5d 0a 49 6e  wflag size"]].In
6650: 76 6f 6b 65 64 20 77 68 65 6e 20 6c 6f 61 64 69  voked when loadi
6660: 6e 67 20 6f 72 20 73 74 6f 72 69 6e 67 20 61 6e  ng or storing an
6670: 20 65 6e 63 72 79 70 74 65 64 20 50 45 4d 20 63   encrypted PEM c
6680: 65 72 74 69 66 69 63 61 74 65 2e 20 54 68 65 20  ertificate. The 
6690: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a 0a  arguments are:..
66a0: 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66 69  [list_begin defi
66b0: 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20 5b  nitions]..[def [
66c0: 61 72 67 20 72 77 66 6c 61 67 5d 5d 0a 54 68 65  arg rwflag]].The
66d0: 20 72 65 61 64 2f 77 72 69 74 65 20 66 6c 61 67   read/write flag
66e0: 20 69 73 20 30 20 66 6f 72 20 72 65 61 64 69 6e   is 0 for readin
66f0: 67 2f 64 65 63 72 79 70 74 69 6f 6e 20 6f 72 20  g/decryption or 
6700: 31 20 66 6f 72 20 77 72 69 74 69 6e 67 2f 65 6e  1 for writing/en
6710: 63 72 79 70 74 69 6f 6e 2e 0a 54 68 65 20 6c 61  cryption..The la
6720: 74 74 65 72 20 63 61 6e 20 62 65 20 75 73 65 64  tter can be used
6730: 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68   to determine wh
6740: 65 6e 20 74 6f 20 70 72 6f 6d 70 74 20 74 68 65  en to prompt the
6750: 20 75 73 65 72 20 74 6f 20 63 6f 6e 66 69 72 6d   user to confirm
6760: 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74 20  ..This argument 
6770: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
6780: 53 20 31 2e 38 2e 0a 0a 5b 64 65 66 20 5b 61 72  S 1.8...[def [ar
6790: 67 20 73 69 7a 65 5d 5d 0a 54 68 65 20 73 69 7a  g size]].The siz
67a0: 65 20 69 73 20 74 68 65 20 6d 61 78 69 6d 75 6d  e is the maximum
67b0: 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 70   length of the p
67c0: 61 73 73 77 6f 72 64 20 69 6e 20 62 79 74 65 73  assword in bytes
67d0: 2e 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74 20  ..This argument 
67e0: 69 73 20 6e 65 77 20 66 6f 72 20 54 63 6c 54 4c  is new for TclTL
67f0: 53 20 31 2e 38 2e 0a 0a 5b 6c 69 73 74 5f 65 6e  S 1.8...[list_en
6800: 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d 0a 0a  d]..[list_end]..
6810: 5b 73 75 62 73 65 63 74 69 6f 6e 20 22 56 61 6c  [subsection "Val
6820: 75 65 73 20 66 6f 72 20 56 61 6c 69 64 61 74 65  ues for Validate
6830: 20 43 6f 6d 6d 61 6e 64 20 43 61 6c 6c 62 61 63   Command Callbac
6840: 6b 22 5d 0a 0a 54 68 65 20 63 61 6c 6c 62 61 63  k"]..The callbac
6850: 6b 20 66 6f 72 20 74 68 65 20 5b 6f 70 74 69 6f  k for the [optio
6860: 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d 61  n -validatecomma
6870: 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20 69 6e  nd] option is in
6880: 76 6f 6b 65 64 20 64 75 72 69 6e 67 20 74 68 65  voked during the
6890: 20 68 61 6e 64 73 68 61 6b 65 0a 70 72 6f 63 65   handshake.proce
68a0: 73 73 20 69 6e 20 6f 72 64 65 72 20 66 6f 72 20  ss in order for 
68b0: 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20  the application 
68c0: 74 6f 20 76 61 6c 69 64 61 74 65 20 74 68 65 20  to validate the 
68d0: 70 72 6f 76 69 64 65 64 20 76 61 6c 75 65 28 73  provided value(s
68e0: 29 2e 20 53 65 65 0a 62 65 6c 6f 77 20 66 6f 72  ). See.below for
68f0: 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20 61 72   the possible ar
6900: 67 75 6d 65 6e 74 73 20 70 61 73 73 65 64 20 74  guments passed t
6910: 6f 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73  o the callback s
6920: 63 72 69 70 74 2e 20 49 66 20 6e 6f 74 0a 73 70  cript. If not.sp
6930: 65 63 69 66 69 65 64 2c 20 4f 70 65 6e 53 53 4c  ecified, OpenSSL
6940: 20 77 69 6c 6c 20 61 63 63 65 70 74 20 61 6c 6c   will accept all
6950: 20 76 61 6c 69 64 20 63 65 72 74 69 66 69 63 61   valid certifica
6960: 74 65 73 20 61 6e 64 20 65 78 74 65 6e 73 69 6f  tes and extensio
6970: 6e 73 2e 20 54 6f 20 72 65 6a 65 63 74 0a 74 68  ns. To reject.th
6980: 65 20 76 61 6c 75 65 20 61 6e 64 20 61 62 6f 72  e value and abor
6990: 74 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  t the connection
69a0: 2c 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 73  , the callback s
69b0: 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 30 2e 20  hould return 0. 
69c0: 54 6f 20 61 63 63 65 70 74 20 74 68 65 0a 76 61  To accept the.va
69d0: 6c 75 65 20 61 6e 64 20 63 6f 6e 74 69 6e 75 65  lue and continue
69e0: 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c   the connection,
69f0: 20 69 74 20 73 68 6f 75 6c 64 20 72 65 74 75 72   it should retur
6a00: 6e 20 31 2e 20 54 6f 20 72 65 6a 65 63 74 20 74  n 1. To reject t
6a10: 68 65 20 76 61 6c 75 65 2c 20 62 75 74 0a 63 6f  he value, but.co
6a20: 6e 74 69 6e 75 65 20 74 68 65 20 63 6f 6e 6e 65  ntinue the conne
6a30: 63 74 69 6f 6e 2c 20 69 74 20 73 68 6f 75 6c 64  ction, it should
6a40: 20 72 65 74 75 72 6e 20 32 2e 20 54 68 69 73 20   return 2. This 
6a50: 63 61 6c 6c 62 61 63 6b 20 69 73 20 6e 65 77 20  callback is new 
6a60: 66 6f 72 20 54 63 6c 54 4c 53 20 31 2e 38 2e 0a  for TclTLS 1.8..
6a70: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 6f 70 74  .[list_begin opt
6a80: 69 6f 6e 73 5d 0a 0a 5b 6f 70 74 5f 64 65 66 20  ions]..[opt_def 
6a90: 61 6c 70 6e 20 5b 61 72 67 20 22 63 68 61 6e 6e  alpn [arg "chann
6aa0: 65 6c 49 64 20 70 72 6f 74 6f 63 6f 6c 20 6d 61  elId protocol ma
6ab0: 74 63 68 22 5d 5d 0a 46 6f 72 20 73 65 72 76 65  tch"]].For serve
6ac0: 72 73 2c 20 74 68 69 73 20 66 6f 72 6d 20 6f 66  rs, this form of
6ad0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
6ae0: 6f 6b 65 64 20 77 68 65 6e 20 74 68 65 20 63 6c  oked when the cl
6af0: 69 65 6e 74 20 41 4c 50 4e 20 65 78 74 65 6e 73  ient ALPN extens
6b00: 69 6f 6e 20 69 73 0a 72 65 63 65 69 76 65 64 2e  ion is.received.
6b10: 20 49 66 20 5b 61 72 67 20 6d 61 74 63 68 5d 20   If [arg match] 
6b20: 69 73 20 74 72 75 65 2c 20 74 68 65 6e 20 5b 61  is true, then [a
6b30: 72 67 20 70 72 6f 74 6f 63 6f 6c 5d 20 69 73 20  rg protocol] is 
6b40: 74 68 65 20 66 69 72 73 74 0a 5b 6f 70 74 69 6f  the first.[optio
6b50: 6e 20 2d 61 6c 70 6e 5d 20 70 72 6f 74 6f 63 6f  n -alpn] protoco
6b60: 6c 20 6f 70 74 69 6f 6e 20 69 6e 20 63 6f 6d 6d  l option in comm
6b70: 6f 6e 20 74 6f 20 62 6f 74 68 20 74 68 65 20 63  on to both the c
6b80: 6c 69 65 6e 74 20 61 6e 64 20 73 65 72 76 65 72  lient and server
6b90: 2e 0a 49 66 20 6e 6f 74 2c 20 74 68 65 20 66 69  ..If not, the fi
6ba0: 72 73 74 20 63 6c 69 65 6e 74 20 73 70 65 63 69  rst client speci
6bb0: 66 69 65 64 20 70 72 6f 74 6f 63 6f 6c 20 69 73  fied protocol is
6bc0: 20 75 73 65 64 2e 20 54 68 69 73 20 63 61 6c 6c   used. This call
6bd0: 62 61 63 6b 20 69 73 20 63 61 6c 6c 65 64 0a 61  back is called.a
6be0: 66 74 65 72 20 74 68 65 20 48 65 6c 6c 6f 20 61  fter the Hello a
6bf0: 6e 64 20 41 4c 50 4e 20 63 61 6c 6c 62 61 63 6b  nd ALPN callback
6c00: 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 68 65 6c  s...[opt_def hel
6c10: 6c 6f 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c  lo [arg "channel
6c20: 49 64 20 73 65 72 76 65 72 6e 61 6d 65 22 5d 5d  Id servername"]]
6c30: 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68  .For servers, th
6c40: 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62  is form of callb
6c50: 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 64  ack is invoked d
6c60: 75 72 69 6e 67 20 63 6c 69 65 6e 74 20 68 65 6c  uring client hel
6c70: 6c 6f 20 6d 65 73 73 61 67 65 0a 70 72 6f 63 65  lo message.proce
6c80: 73 73 69 6e 67 2e 20 54 68 65 20 70 75 72 70 6f  ssing. The purpo
6c90: 73 65 20 69 73 20 73 6f 20 74 68 65 20 73 65 72  se is so the ser
6ca0: 76 65 72 20 63 61 6e 20 73 65 6c 65 63 74 20 74  ver can select t
6cb0: 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 63  he appropriate c
6cc0: 65 72 74 69 66 69 63 61 74 65 0a 74 6f 20 70 72  ertificate.to pr
6cd0: 65 73 65 6e 74 20 74 6f 20 74 68 65 20 63 6c 69  esent to the cli
6ce0: 65 6e 74 2c 20 61 6e 64 20 74 6f 20 6d 61 6b 65  ent, and to make
6cf0: 20 6f 74 68 65 72 20 63 6f 6e 66 69 67 75 72 61   other configura
6d00: 74 69 6f 6e 20 61 64 6a 75 73 74 6d 65 6e 74 73  tion adjustments
6d10: 20 72 65 6c 65 76 61 6e 74 0a 74 6f 20 74 68 61   relevant.to tha
6d20: 74 20 73 65 72 76 65 72 20 6e 61 6d 65 20 61 6e  t server name an
6d30: 64 20 69 74 73 20 63 6f 6e 66 69 67 75 72 61 74  d its configurat
6d40: 69 6f 6e 2e 20 49 74 20 69 73 20 63 61 6c 6c 65  ion. It is calle
6d50: 64 20 62 65 66 6f 72 65 20 74 68 65 20 53 4e 49  d before the SNI
6d60: 20 61 6e 64 20 41 4c 50 4e 0a 63 61 6c 6c 62 61   and ALPN.callba
6d70: 63 6b 73 2e 0a 0a 5b 6f 70 74 5f 64 65 66 20 73  cks...[opt_def s
6d80: 6e 69 20 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c  ni [arg "channel
6d90: 49 64 20 73 65 72 76 65 72 6e 61 6d 65 22 5d 5d  Id servername"]]
6da0: 0a 46 6f 72 20 73 65 72 76 65 72 73 2c 20 74 68  .For servers, th
6db0: 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62  is form of callb
6dc0: 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 77  ack is invoked w
6dd0: 68 65 6e 20 74 68 65 20 53 65 72 76 65 72 20 4e  hen the Server N
6de0: 61 6d 65 20 49 6e 64 69 63 61 74 69 6f 6e 0a 28  ame Indication.(
6df0: 53 4e 49 29 20 65 78 74 65 6e 73 69 6f 6e 20 69  SNI) extension i
6e00: 73 20 72 65 63 65 69 76 65 64 2e 20 54 68 65 20  s received. The 
6e10: 5b 61 72 67 20 73 65 72 76 65 72 6e 61 6d 65 5d  [arg servername]
6e20: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74 68 65   argument is the
6e30: 20 63 6c 69 65 6e 74 0a 70 72 6f 76 69 64 65 64   client.provided
6e40: 20 73 65 72 76 65 72 20 6e 61 6d 65 20 73 70 65   server name spe
6e50: 63 69 66 69 65 64 20 69 6e 20 74 68 65 20 5b 6f  cified in the [o
6e60: 70 74 69 6f 6e 20 2d 73 65 72 76 65 72 6e 61 6d  ption -servernam
6e70: 65 3c 2f 62 3e 5d 20 6f 70 74 69 6f 6e 2e 20 54  e</b>] option. T
6e80: 68 65 0a 70 75 72 70 6f 73 65 20 69 73 20 73 6f  he.purpose is so
6e90: 20 77 68 65 6e 20 61 20 73 65 72 76 65 72 20 73   when a server s
6ea0: 75 70 70 6f 72 74 73 20 6d 75 6c 74 69 70 6c 65  upports multiple
6eb0: 20 6e 61 6d 65 73 2c 20 74 68 65 20 72 69 67 68   names, the righ
6ec0: 74 20 63 65 72 74 69 66 69 63 61 74 65 0a 63 61  t certificate.ca
6ed0: 6e 20 62 65 20 75 73 65 64 2e 20 49 74 20 69 73  n be used. It is
6ee0: 20 63 61 6c 6c 65 64 20 61 66 74 65 72 20 74 68   called after th
6ef0: 65 20 68 65 6c 6c 6f 20 63 61 6c 6c 62 61 63 6b  e hello callback
6f00: 20 62 75 74 20 62 65 66 6f 72 65 20 74 68 65 20   but before the 
6f10: 41 4c 50 4e 0a 63 61 6c 6c 62 61 63 6b 2e 0a 0a  ALPN.callback...
6f20: 5b 6f 70 74 5f 64 65 66 20 76 65 72 69 66 79 20  [opt_def verify 
6f30: 5b 61 72 67 20 22 63 68 61 6e 6e 65 6c 49 64 20  [arg "channelId 
6f40: 64 65 70 74 68 20 63 65 72 74 20 73 74 61 74 75  depth cert statu
6f50: 73 20 65 72 72 6f 72 22 5d 5d 0a 54 68 69 73 20  s error"]].This 
6f60: 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b  form of callback
6f70: 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 4f   is invoked by O
6f80: 70 65 6e 53 53 4c 20 77 68 65 6e 20 61 20 6e 65  penSSL when a ne
6f90: 77 20 63 65 72 74 69 66 69 63 61 74 65 20 69 73  w certificate is
6fa0: 20 72 65 63 65 69 76 65 64 0a 66 72 6f 6d 20 74   received.from t
6fb0: 68 65 20 70 65 65 72 2e 20 49 74 20 61 6c 6c 6f  he peer. It allo
6fc0: 77 73 20 74 68 65 20 63 6c 69 65 6e 74 20 74 6f  ws the client to
6fd0: 20 63 68 65 63 6b 20 74 68 65 20 63 65 72 74 69   check the certi
6fe0: 66 69 63 61 74 65 20 76 65 72 69 66 69 63 61 74  ficate verificat
6ff0: 69 6f 6e 0a 72 65 73 75 6c 74 73 20 61 6e 64 20  ion.results and 
7000: 63 68 6f 6f 73 65 20 77 68 65 74 68 65 72 20 74  choose whether t
7010: 6f 20 63 6f 6e 74 69 6e 75 65 20 6f 72 20 6e 6f  o continue or no
7020: 74 2e 20 49 74 20 69 73 20 63 61 6c 6c 65 64 20  t. It is called 
7030: 66 6f 72 20 65 61 63 68 0a 63 65 72 74 69 66 69  for each.certifi
7040: 63 61 74 65 20 69 6e 20 74 68 65 20 63 65 72 74  cate in the cert
7050: 69 66 69 63 61 74 65 20 63 68 61 69 6e 2e 20 54  ificate chain. T
7060: 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 61 73  his callback was
7070: 20 6d 6f 76 65 64 20 66 72 6f 6d 0a 5b 6f 70 74   moved from.[opt
7080: 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 20 69 6e  ion -command] in
7090: 20 54 63 6c 54 4c 53 20 31 2e 38 2e 20 54 68 65   TclTLS 1.8. The
70a0: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 3a 0a   arguments are:.
70b0: 0a 5b 6c 69 73 74 5f 62 65 67 69 6e 20 64 65 66  .[list_begin def
70c0: 69 6e 69 74 69 6f 6e 73 5d 0a 0a 5b 64 65 66 20  initions]..[def 
70d0: 5b 61 72 67 20 64 65 70 74 68 5d 5d 0a 54 68 65  [arg depth]].The
70e0: 20 64 65 70 74 68 20 69 73 20 74 68 65 20 69 6e   depth is the in
70f0: 74 65 67 65 72 20 64 65 70 74 68 20 6f 66 20 74  teger depth of t
7100: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 69  he certificate i
7110: 6e 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  n the certificat
7120: 65 20 63 68 61 69 6e 2c 0a 77 68 65 72 65 20 30  e chain,.where 0
7130: 20 69 73 20 74 68 65 20 70 65 65 72 20 63 65 72   is the peer cer
7140: 74 69 66 69 63 61 74 65 20 61 6e 64 20 68 69 67  tificate and hig
7150: 68 65 72 20 76 61 6c 75 65 73 20 67 6f 69 6e 67  her values going
7160: 20 75 70 20 74 6f 20 74 68 65 20 43 65 72 74 69   up to the Certi
7170: 66 69 63 61 74 65 0a 41 75 74 68 6f 72 69 74 79  ficate.Authority
7180: 20 28 43 41 29 2e 0a 0a 5b 64 65 66 20 5b 61 72   (CA)...[def [ar
7190: 67 20 63 65 72 74 5d 5d 0a 54 68 65 20 63 65 72  g cert]].The cer
71a0: 74 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20  t argument is a 
71b0: 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75  list of key-valu
71c0: 65 20 70 61 69 72 73 20 73 69 6d 69 6c 61 72 20  e pairs similar 
71d0: 74 6f 20 74 68 6f 73 65 20 72 65 74 75 72 6e 65  to those returne
71e0: 64 20 62 79 0a 5b 63 6d 64 20 74 6c 73 3a 3a 73  d by.[cmd tls::s
71f0: 74 61 74 75 73 5d 2e 0a 0a 5b 64 65 66 20 5b 61  tatus]...[def [a
7200: 72 67 20 73 74 61 74 75 73 5d 5d 0a 54 68 65 20  rg status]].The 
7210: 73 74 61 74 75 73 20 61 72 67 75 6d 65 6e 74 20  status argument 
7220: 69 73 20 74 68 65 20 62 6f 6f 6c 65 61 6e 20 76  is the boolean v
7230: 61 6c 69 64 69 74 79 20 6f 66 20 74 68 65 20 63  alidity of the c
7240: 75 72 72 65 6e 74 20 63 65 72 74 69 66 69 63 61  urrent certifica
7250: 74 65 20 77 68 65 72 65 20 30 0a 69 73 20 69 6e  te where 0.is in
7260: 76 61 6c 69 64 20 61 6e 64 20 31 20 69 73 20 76  valid and 1 is v
7270: 61 6c 69 64 2e 0a 0a 5b 64 65 66 20 5b 61 72 67  alid...[def [arg
7280: 20 65 72 72 6f 72 5d 5d 0a 54 68 65 20 65 72 72   error]].The err
7290: 6f 72 20 61 72 67 75 6d 65 6e 74 20 69 73 20 74  or argument is t
72a0: 68 65 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65  he error message
72b0: 2c 20 69 66 20 61 6e 79 2c 20 67 65 6e 65 72 61  , if any, genera
72c0: 74 65 64 20 62 79 0a 5b 66 75 6e 20 58 35 30 39  ted by.[fun X509
72d0: 5f 53 54 4f 52 45 5f 43 54 58 5f 67 65 74 5f 65  _STORE_CTX_get_e
72e0: 72 72 6f 72 28 29 5d 2e 0a 0a 5b 6c 69 73 74 5f  rror()]...[list_
72f0: 65 6e 64 5d 0a 0a 5b 6c 69 73 74 5f 65 6e 64 5d  end]..[list_end]
7300: 0a 0a 52 65 66 65 72 65 6e 63 65 20 69 6d 70 6c  ..Reference impl
7310: 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 74  ementations of t
7320: 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73 20 61  hese callbacks a
7330: 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e 20 5b  re provided in [
7340: 66 69 6c 65 20 74 6c 73 2e 74 63 6c 5d 0a 61 73  file tls.tcl].as
7350: 20 5b 63 6d 64 20 74 6c 73 3a 3a 63 61 6c 6c 62   [cmd tls::callb
7360: 61 63 6b 5d 2c 20 5b 63 6d 64 20 74 6c 73 3a 3a  ack], [cmd tls::
7370: 70 61 73 73 77 6f 72 64 5d 2c 20 61 6e 64 20 5b  password], and [
7380: 63 6d 64 20 74 6c 73 3a 3a 76 61 6c 69 64 61 74  cmd tls::validat
7390: 65 5f 63 6f 6d 6d 61 6e 64 5d 0a 72 65 73 70 65  e_command].respe
73a0: 63 74 69 76 65 6c 79 2e 20 4e 6f 74 65 20 74 68  ctively. Note th
73b0: 61 74 20 74 68 65 73 65 20 61 72 65 20 6f 6e 6c  at these are onl
73c0: 79 20 5b 65 6d 70 68 20 73 61 6d 70 6c 65 5d 20  y [emph sample] 
73d0: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e  implementations.
73e0: 20 49 6e 20 61 20 6d 6f 72 65 0a 72 65 61 6c 69   In a more.reali
73f0: 73 74 69 63 20 64 65 70 6c 6f 79 6d 65 6e 74 20  stic deployment 
7400: 79 6f 75 20 77 6f 75 6c 64 20 73 70 65 63 69 66  you would specif
7410: 79 20 79 6f 75 72 20 6f 77 6e 20 63 61 6c 6c 62  y your own callb
7420: 61 63 6b 20 73 63 72 69 70 74 73 20 6f 6e 20 65  ack scripts on e
7430: 61 63 68 20 54 4c 53 0a 63 68 61 6e 6e 65 6c 20  ach TLS.channel 
7440: 75 73 69 6e 67 20 74 68 65 20 5b 6f 70 74 69 6f  using the [optio
7450: 6e 20 2d 63 6f 6d 6d 61 6e 64 5d 2c 20 5b 6f 70  n -command], [op
7460: 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72 64 5d 2c  tion -password],
7470: 20 61 6e 64 0a 5b 6f 70 74 69 6f 6e 20 2d 76 61   and.[option -va
7480: 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d 20  lidate_command] 
7490: 6f 70 74 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61 5d  options...[para]
74a0: 0a 0a 54 68 65 20 64 65 66 61 75 6c 74 20 62 65  ..The default be
74b0: 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65 20  havior when the 
74c0: 5b 6f 70 74 69 6f 6e 20 2d 63 6f 6d 6d 61 6e 64  [option -command
74d0: 5d 20 61 6e 64 20 5b 6f 70 74 69 6f 6e 20 2d 76  ] and [option -v
74e0: 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64 5d  alidate_command]
74f0: 0a 6f 70 74 69 6f 6e 73 20 61 72 65 20 6e 6f 74  .options are not
7500: 20 73 70 65 63 69 66 69 65 64 2c 20 69 73 20 66   specified, is f
7510: 6f 72 20 54 63 6c 54 4c 53 20 74 6f 20 70 72 6f  or TclTLS to pro
7520: 63 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61  cess the associa
7530: 74 65 64 20 6c 69 62 72 61 72 79 0a 63 61 6c 6c  ted library.call
7540: 62 61 63 6b 73 20 69 6e 74 65 72 6e 61 6c 6c 79  backs internally
7550: 2e 20 54 68 65 20 64 65 66 61 75 6c 74 20 62 65  . The default be
7560: 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65 20  havior when the 
7570: 5b 6f 70 74 69 6f 6e 20 2d 70 61 73 73 77 6f 72  [option -passwor
7580: 64 5d 20 6f 70 74 69 6f 6e 0a 69 73 20 6e 6f 74  d] option.is not
7590: 20 73 70 65 63 69 66 69 65 64 20 69 73 20 66 6f   specified is fo
75a0: 72 20 54 63 6c 54 4c 53 20 74 6f 20 70 72 6f 63  r TclTLS to proc
75b0: 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61 74  ess the associat
75c0: 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62  ed library callb
75d0: 61 63 6b 73 20 62 79 0a 61 74 74 65 6d 70 74 69  acks by.attempti
75e0: 6e 67 20 74 6f 20 63 61 6c 6c 20 5b 63 6d 64 20  ng to call [cmd 
75f0: 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 5d 2e 20  tls::password]. 
7600: 54 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 62  The difference b
7610: 65 74 77 65 65 6e 20 74 68 65 73 65 20 74 77 6f  etween these two
7620: 0a 62 65 68 61 76 69 6f 72 73 20 69 73 20 61 20  .behaviors is a 
7630: 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66 20 6d  consequence of m
7640: 61 69 6e 74 61 69 6e 69 6e 67 20 63 6f 6d 70 61  aintaining compa
7650: 74 69 62 69 6c 69 74 79 20 77 69 74 68 20 65 61  tibility with ea
7660: 72 6c 69 65 72 0a 69 6d 70 6c 65 6d 65 6e 74 61  rlier.implementa
7670: 74 69 6f 6e 73 2e 0a 0a 5b 70 61 72 61 5d 0a 0a  tions...[para]..
7680: 5b 65 6d 70 68 20 22 54 68 65 20 75 73 65 20 6f  [emph "The use o
7690: 66 20 74 68 65 20 72 65 66 65 72 65 6e 63 65 20  f the reference 
76a0: 63 61 6c 6c 62 61 63 6b 73 20 5b 63 6d 64 20 74  callbacks [cmd t
76b0: 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d 2c 20 5b  ls::callback], [
76c0: 63 6d 64 20 74 6c 73 3a 3a 70 61 73 73 77 6f 72  cmd tls::passwor
76d0: 64 5d 2c 0a 61 6e 64 20 5b 63 6d 64 20 74 6c 73  d],.and [cmd tls
76e0: 3a 3a 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61  ::validate_comma
76f0: 6e 64 5d 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d  nd] is not recom
7700: 6d 65 6e 64 65 64 2e 20 54 68 65 79 20 6d 61 79  mended. They may
7710: 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d   be removed from
7720: 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 73   future releases
7730: 2e 22 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 44 65  ."]..[section De
7740: 62 75 67 5d 0a 0a 46 6f 72 20 6d 6f 73 74 20 64  bug]..For most d
7750: 65 62 75 67 67 69 6e 67 20 6e 65 65 64 73 2c 20  ebugging needs, 
7760: 74 68 65 20 5b 6f 70 74 69 6f 6e 20 2d 63 61 6c  the [option -cal
7770: 6c 62 61 63 6b 5d 20 6f 70 74 69 6f 6e 20 63 61  lback] option ca
7780: 6e 20 62 65 20 75 73 65 64 20 74 6f 20 70 72 6f  n be used to pro
7790: 76 69 64 65 0a 73 75 66 66 69 63 69 65 6e 74 20  vide.sufficient 
77a0: 69 6e 73 69 67 68 74 20 61 6e 64 20 69 6e 66 6f  insight and info
77b0: 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 54  rmation on the T
77c0: 4c 53 20 68 61 6e 64 73 68 61 6b 65 20 61 6e 64  LS handshake and
77d0: 20 70 72 6f 67 72 65 73 73 2e 20 49 66 0a 66 75   progress. If.fu
77e0: 72 74 68 65 72 20 74 72 6f 75 62 6c 65 73 68 6f  rther troublesho
77f0: 6f 74 69 6e 67 20 69 6e 73 69 67 68 74 20 69 73  oting insight is
7800: 20 6e 65 65 64 65 64 2c 20 74 68 65 20 63 6f 6d   needed, the com
7810: 70 69 6c 65 20 74 69 6d 65 20 6f 70 74 69 6f 6e  pile time option
7820: 0a 5b 6f 70 74 69 6f 6e 20 2d 2d 65 6e 61 62 6c  .[option --enabl
7830: 65 2d 64 65 62 75 67 5d 20 63 61 6e 20 62 65 20  e-debug] can be 
7840: 75 73 65 64 20 74 6f 20 67 65 74 20 64 65 74 61  used to get deta
7850: 69 6c 65 64 20 65 78 65 63 75 74 69 6f 6e 20 66  iled execution f
7860: 6c 6f 77 20 73 74 61 74 75 73 2e 0a 0a 5b 70 61  low status...[pa
7870: 72 61 5d 0a 0a 54 4c 53 20 6b 65 79 20 6c 6f 67  ra]..TLS key log
7880: 67 69 6e 67 20 63 61 6e 20 62 65 20 65 6e 61 62  ging can be enab
7890: 6c 65 64 20 62 79 20 73 65 74 74 69 6e 67 20 74  led by setting t
78a0: 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76  he environment v
78b0: 61 72 69 61 62 6c 65 0a 5b 76 61 72 20 53 53 4c  ariable.[var SSL
78c0: 4b 45 59 4c 4f 47 46 49 4c 45 5d 20 74 6f 20 74  KEYLOGFILE] to t
78d0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 66  he name of the f
78e0: 69 6c 65 20 74 6f 20 6c 6f 67 20 74 6f 2e 20 54  ile to log to. T
78f0: 68 65 6e 20 77 68 65 6e 65 76 65 72 20 54 4c 53  hen whenever TLS
7900: 20 6b 65 79 0a 6d 61 74 65 72 69 61 6c 20 69 73   key.material is
7910: 20 67 65 6e 65 72 61 74 65 64 20 6f 72 20 72 65   generated or re
7920: 63 65 69 76 65 64 20 69 74 20 77 69 6c 6c 20 62  ceived it will b
7930: 65 20 6c 6f 67 67 65 64 20 74 6f 20 74 68 65 20  e logged to the 
7940: 66 69 6c 65 2e 20 54 68 69 73 20 69 73 20 75 73  file. This is us
7950: 65 66 75 6c 0a 66 6f 72 20 6c 6f 67 67 69 6e 67  eful.for logging
7960: 20 6b 65 79 20 64 61 74 61 20 66 6f 72 20 6e 65   key data for ne
7970: 74 77 6f 72 6b 20 6c 6f 67 67 69 6e 67 20 74 6f  twork logging to
7980: 6f 6c 73 20 74 6f 20 75 73 65 20 74 6f 20 64 65  ols to use to de
7990: 63 72 79 70 74 20 74 68 65 20 64 61 74 61 2e 0a  crypt the data..
79a0: 0a 5b 70 61 72 61 5d 0a 0a 54 68 65 20 5b 76 61  .[para]..The [va
79b0: 72 20 74 6c 73 3a 3a 64 65 62 75 67 5d 20 76 61  r tls::debug] va
79c0: 72 69 61 62 6c 65 20 70 72 6f 76 69 64 65 73 20  riable provides 
79d0: 73 6f 6d 65 20 61 64 64 69 74 69 6f 6e 61 6c 20  some additional 
79e0: 63 6f 6e 74 72 6f 6c 20 6f 76 65 72 20 74 68 65  control over the
79f0: 73 65 0a 72 65 66 65 72 65 6e 63 65 20 63 61 6c  se.reference cal
7a00: 6c 62 61 63 6b 73 2e 20 49 74 73 20 76 61 6c 75  lbacks. Its valu
7a10: 65 20 69 73 20 7a 65 72 6f 20 62 79 20 64 65 66  e is zero by def
7a20: 61 75 6c 74 2e 20 48 69 67 68 65 72 20 76 61 6c  ault. Higher val
7a30: 75 65 73 20 70 72 6f 64 75 63 65 20 6d 6f 72 65  ues produce more
7a40: 0a 64 69 61 67 6e 6f 73 74 69 63 20 6f 75 74 70  .diagnostic outp
7a50: 75 74 2c 20 61 6e 64 20 77 69 6c 6c 20 61 6c 73  ut, and will als
7a60: 6f 20 66 6f 72 63 65 20 74 68 65 20 76 65 72 69  o force the veri
7a70: 66 79 20 6d 65 74 68 6f 64 20 69 6e 20 5b 63 6d  fy method in [cm
7a80: 64 20 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 5d  d tls::callback]
7a90: 0a 74 6f 20 61 63 63 65 70 74 20 74 68 65 20 63  .to accept the c
7aa0: 65 72 74 69 66 69 63 61 74 65 2c 20 65 76 65 6e  ertificate, even
7ab0: 20 77 68 65 6e 20 69 74 20 69 73 20 69 6e 76 61   when it is inva
7ac0: 6c 69 64 20 69 66 20 74 68 65 0a 5b 6f 70 74 69  lid if the.[opti
7ad0: 6f 6e 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d  on -validatecomm
7ae0: 61 6e 64 5d 20 6f 70 74 69 6f 6e 20 69 73 20 73  and] option is s
7af0: 65 74 20 74 6f 20 5b 63 6d 64 20 74 6c 73 3a 3a  et to [cmd tls::
7b00: 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64  validate_command
7b10: 5d 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 5b 65 6d 70  ]...[para]..[emp
7b20: 68 20 22 54 68 65 20 75 73 65 20 6f 66 20 74 68  h "The use of th
7b30: 65 20 76 61 72 69 61 62 6c 65 20 5b 76 61 72 20  e variable [var 
7b40: 74 6c 73 3a 3a 64 65 62 75 67 5d 20 69 73 20 6e  tls::debug] is n
7b50: 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 0a  ot recommended..
7b60: 49 74 20 6d 61 79 20 62 65 20 72 65 6d 6f 76 65  It may be remove
7b70: 64 20 66 72 6f 6d 20 66 75 74 75 72 65 20 72 65  d from future re
7b80: 6c 65 61 73 65 73 2e 22 5d 0a 0a 5b 73 65 63 74  leases."]..[sect
7b90: 69 6f 6e 20 22 44 65 62 75 67 20 45 78 61 6d 70  ion "Debug Examp
7ba0: 6c 65 73 22 5d 0a 0a 54 68 65 73 65 20 65 78 61  les"]..These exa
7bb0: 6d 70 6c 65 73 20 75 73 65 20 74 68 65 20 64 65  mples use the de
7bc0: 66 61 75 6c 74 20 55 6e 69 78 20 70 6c 61 74 66  fault Unix platf
7bd0: 6f 72 6d 20 53 53 4c 20 63 65 72 74 69 66 69 63  orm SSL certific
7be0: 61 74 65 73 2e 20 46 6f 72 20 73 74 61 6e 64 61  ates. For standa
7bf0: 72 64 0a 69 6e 73 74 61 6c 6c 61 74 69 6f 6e 73  rd.installations
7c00: 2c 20 2d 63 61 64 69 72 20 61 6e 64 20 2d 63 61  , -cadir and -ca
7c10: 66 69 6c 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20  file should not 
7c20: 62 65 20 6e 65 65 64 65 64 2e 20 49 66 20 79 6f  be needed. If yo
7c30: 75 72 20 63 65 72 74 69 66 69 63 61 74 65 73 0a  ur certificates.
7c40: 61 72 65 20 69 6e 20 6e 6f 6e 2d 73 74 61 6e 64  are in non-stand
7c50: 61 72 64 20 6c 6f 63 61 74 69 6f 6e 73 2c 20 73  ard locations, s
7c60: 70 65 63 69 66 79 20 2d 63 61 64 69 72 20 6f 72  pecify -cadir or
7c70: 20 2d 63 61 66 69 6c 65 20 61 73 20 6e 65 65 64   -cafile as need
7c80: 65 64 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 45 78 61  ed...[para]..Exa
7c90: 6d 70 6c 65 20 23 31 3a 20 55 73 65 20 48 54 54  mple #1: Use HTT
7ca0: 50 20 70 61 63 6b 61 67 65 0a 0a 5b 65 78 61 6d  P package..[exam
7cb0: 70 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72  ple {..package r
7cc0: 65 71 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b  equire http.pack
7cd0: 61 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a  age require tls.
7ce0: 73 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f  set url "https:/
7cf0: 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f 22 0a 0a 68  /www.tcl.tk/"..h
7d00: 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74  ttp::register ht
7d10: 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a  tps 443 [list ::
7d20: 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74  tls::socket -aut
7d30: 6f 73 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 72  oservername 1 -r
7d40: 65 71 75 69 72 65 20 31 20 5c 0a 20 20 20 20 2d  equire 1 \.    -
7d50: 63 6f 6d 6d 61 6e 64 20 3a 3a 74 6c 73 3a 3a 63  command ::tls::c
7d60: 61 6c 6c 62 61 63 6b 20 2d 70 61 73 73 77 6f 72  allback -passwor
7d70: 64 20 3a 3a 74 6c 73 3a 3a 70 61 73 73 77 6f 72  d ::tls::passwor
7d80: 64 20 5c 0a 20 20 20 20 2d 76 61 6c 69 64 61 74  d \.    -validat
7d90: 65 63 6f 6d 6d 61 6e 64 20 3a 3a 74 6c 73 3a 3a  ecommand ::tls::
7da0: 76 61 6c 69 64 61 74 65 5f 63 6f 6d 6d 61 6e 64  validate_command
7db0: 5d 0a 0a 23 20 43 68 65 63 6b 20 66 6f 72 20 65  ]..# Check for e
7dc0: 72 72 6f 72 0a 73 65 74 20 74 6f 6b 65 6e 20 5b  rror.set token [
7dd0: 68 74 74 70 3a 3a 67 65 74 75 72 6c 20 24 75 72  http::geturl $ur
7de0: 6c 5d 0a 69 66 20 7b 5b 68 74 74 70 3a 3a 73 74  l].if {[http::st
7df0: 61 74 75 73 20 24 74 6f 6b 65 6e 5d 20 6e 65 20  atus $token] ne 
7e00: 22 6f 6b 22 7d 20 7b 0a 20 20 20 20 70 75 74 73  "ok"} {.    puts
7e10: 20 5b 66 6f 72 6d 61 74 20 22 45 72 72 6f 72 20   [format "Error 
7e20: 25 73 22 20 5b 68 74 74 70 3a 3a 73 74 61 74 75  %s" [http::statu
7e30: 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d 0a 0a 23 20  s $token]].}..# 
7e40: 47 65 74 20 77 65 62 20 70 61 67 65 0a 73 65 74  Get web page.set
7e50: 20 64 61 74 61 20 5b 68 74 74 70 3a 3a 64 61 74   data [http::dat
7e60: 61 20 24 74 6f 6b 65 6e 5d 0a 70 75 74 73 20 5b  a $token].puts [
7e70: 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 24 64  string length $d
7e80: 61 74 61 5d 0a 0a 23 20 43 6c 65 61 6e 75 70 0a  ata]..# Cleanup.
7e90: 3a 3a 68 74 74 70 3a 3a 63 6c 65 61 6e 75 70 20  ::http::cleanup 
7ea0: 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 45 78 61 6d 70  $token.}]..Examp
7eb0: 6c 65 20 23 32 3a 20 55 73 65 20 72 61 77 20 73  le #2: Use raw s
7ec0: 6f 63 6b 65 74 0a 0a 5b 65 78 61 6d 70 6c 65 20  ocket..[example 
7ed0: 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69  {..package requi
7ee0: 72 65 20 74 6c 73 0a 0a 73 65 74 20 75 72 6c 20  re tls..set url 
7ef0: 22 77 77 77 2e 74 63 6c 2d 6c 61 6e 67 2e 6f 72  "www.tcl-lang.or
7f00: 67 22 0a 73 65 74 20 70 6f 72 74 20 34 34 33 0a  g".set port 443.
7f10: 0a 73 65 74 20 63 68 20 5b 74 6c 73 3a 3a 73 6f  .set ch [tls::so
7f20: 63 6b 65 74 20 2d 61 75 74 6f 73 65 72 76 65 72  cket -autoserver
7f30: 6e 61 6d 65 20 31 20 2d 73 65 72 76 65 72 6e 61  name 1 -serverna
7f40: 6d 65 20 24 75 72 6c 20 2d 72 65 71 75 69 72 65  me $url -require
7f50: 20 31 20 5c 0a 20 20 20 20 2d 61 6c 70 6e 20 7b   1 \.    -alpn {
7f60: 68 74 74 70 2f 31 2e 31 7d 20 2d 63 6f 6d 6d 61  http/1.1} -comma
7f70: 6e 64 20 3a 3a 74 6c 73 3a 3a 63 61 6c 6c 62 61  nd ::tls::callba
7f80: 63 6b 20 2d 70 61 73 73 77 6f 72 64 20 3a 3a 74  ck -password ::t
7f90: 6c 73 3a 3a 70 61 73 73 77 6f 72 64 20 5c 0a 20  ls::password \. 
7fa0: 20 20 20 2d 76 61 6c 69 64 61 74 65 63 6f 6d 6d     -validatecomm
7fb0: 61 6e 64 20 3a 3a 74 6c 73 3a 3a 76 61 6c 69 64  and ::tls::valid
7fc0: 61 74 65 5f 63 6f 6d 6d 61 6e 64 20 24 75 72 6c  ate_command $url
7fd0: 20 24 70 6f 72 74 5d 0a 63 68 61 6e 20 63 6f 6e   $port].chan con
7fe0: 66 69 67 75 72 65 20 24 63 68 20 2d 62 75 66 66  figure $ch -buff
7ff0: 65 72 73 69 7a 65 20 36 35 35 33 36 0a 74 6c 73  ersize 65536.tls
8000: 3a 3a 68 61 6e 64 73 68 61 6b 65 20 24 63 68 0a  ::handshake $ch.
8010: 0a 70 75 74 73 20 24 63 68 20 22 47 45 54 20 2f  .puts $ch "GET /
8020: 20 48 54 54 50 2f 31 2e 31 22 0a 66 6c 75 73 68   HTTP/1.1".flush
8030: 20 24 63 68 0a 61 66 74 65 72 20 35 30 30 0a 73   $ch.after 500.s
8040: 65 74 20 64 61 74 61 20 5b 72 65 61 64 20 24 63  et data [read $c
8050: 68 5d 0a 0a 61 72 72 61 79 20 73 65 74 20 73 74  h]..array set st
8060: 61 74 75 73 20 5b 74 6c 73 3a 3a 73 74 61 74 75  atus [tls::statu
8070: 73 20 24 63 68 5d 0a 61 72 72 61 79 20 73 65 74  s $ch].array set
8080: 20 63 6f 6e 6e 20 5b 74 6c 73 3a 3a 63 6f 6e 6e   conn [tls::conn
8090: 65 63 74 69 6f 6e 20 24 63 68 5d 0a 61 72 72 61  ection $ch].arra
80a0: 79 20 73 65 74 20 63 68 61 6e 20 5b 63 68 61 6e  y set chan [chan
80b0: 20 63 6f 6e 66 69 67 75 72 65 20 24 63 68 5d 0a   configure $ch].
80c0: 63 6c 6f 73 65 20 24 63 68 0a 70 61 72 72 61 79  close $ch.parray
80d0: 20 73 74 61 74 75 73 0a 70 61 72 72 61 79 20 63   status.parray c
80e0: 6f 6e 6e 0a 70 61 72 72 61 79 20 63 68 61 6e 0a  onn.parray chan.
80f0: 7d 5d 0a 0a 5b 73 65 63 74 69 6f 6e 20 22 48 54  }]..[section "HT
8100: 54 50 20 50 61 63 6b 61 67 65 20 45 78 61 6d 70  TP Package Examp
8110: 6c 65 73 22 5d 0a 0a 54 68 65 73 65 20 65 78 61  les"]..These exa
8120: 6d 70 6c 65 73 20 75 73 65 20 74 68 65 20 64 65  mples use the de
8130: 66 61 75 6c 74 20 55 6e 69 78 20 70 6c 61 74 66  fault Unix platf
8140: 6f 72 6d 20 53 53 4c 20 63 65 72 74 69 66 69 63  orm SSL certific
8150: 61 74 65 73 2e 20 46 6f 72 20 73 74 61 6e 64 61  ates. For standa
8160: 72 64 0a 69 6e 73 74 61 6c 6c 61 74 69 6f 6e 73  rd.installations
8170: 2c 20 2d 63 61 64 69 72 20 61 6e 64 20 2d 63 61  , -cadir and -ca
8180: 66 69 6c 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20  file should not 
8190: 62 65 20 6e 65 65 64 65 64 2e 20 49 66 20 79 6f  be needed. If yo
81a0: 75 72 20 63 65 72 74 69 66 69 63 61 74 65 73 0a  ur certificates.
81b0: 61 72 65 20 69 6e 20 6e 6f 6e 2d 73 74 61 6e 64  are in non-stand
81c0: 61 72 64 20 6c 6f 63 61 74 69 6f 6e 73 2c 20 73  ard locations, s
81d0: 65 74 20 2d 63 61 64 69 72 20 6f 72 20 75 73 65  et -cadir or use
81e0: 20 2d 63 61 66 69 6c 65 20 61 73 20 6e 65 65 64   -cafile as need
81f0: 65 64 2e 0a 0a 5b 70 61 72 61 5d 0a 0a 45 78 61  ed...[para]..Exa
8200: 6d 70 6c 65 20 23 33 3a 20 47 65 74 20 77 65 62  mple #3: Get web
8210: 20 70 61 67 65 0a 0a 5b 65 78 61 6d 70 6c 65 20   page..[example 
8220: 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69  {..package requi
8230: 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67 65 20  re http.package 
8240: 72 65 71 75 69 72 65 20 74 6c 73 0a 73 65 74 20  require tls.set 
8250: 75 72 6c 20 22 68 74 74 70 73 3a 2f 2f 77 77 77  url "https://www
8260: 2e 74 63 6c 2e 74 6b 2f 22 0a 0a 68 74 74 70 3a  .tcl.tk/"..http:
8270: 3a 72 65 67 69 73 74 65 72 20 68 74 74 70 73 20  :register https 
8280: 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c 73 3a  443 [list ::tls:
8290: 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73 65 72  :socket -autoser
82a0: 76 65 72 6e 61 6d 65 20 31 20 2d 72 65 71 75 69  vername 1 -requi
82b0: 72 65 20 31 5d 0a 0a 23 20 43 68 65 63 6b 20 66  re 1]..# Check f
82c0: 6f 72 20 65 72 72 6f 72 0a 73 65 74 20 74 6f 6b  or error.set tok
82d0: 65 6e 20 5b 68 74 74 70 3a 3a 67 65 74 75 72 6c  en [http::geturl
82e0: 20 24 75 72 6c 5d 0a 69 66 20 7b 5b 68 74 74 70   $url].if {[http
82f0: 3a 3a 73 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d  ::status $token]
8300: 20 6e 65 20 22 6f 6b 22 7d 20 7b 0a 20 20 20 20   ne "ok"} {.    
8310: 70 75 74 73 20 5b 66 6f 72 6d 61 74 20 22 45 72  puts [format "Er
8320: 72 6f 72 20 25 73 22 20 5b 68 74 74 70 3a 3a 73  ror %s" [http::s
8330: 74 61 74 75 73 20 24 74 6f 6b 65 6e 5d 5d 0a 7d  tatus $token]].}
8340: 0a 0a 23 20 47 65 74 20 77 65 62 20 70 61 67 65  ..# Get web page
8350: 0a 73 65 74 20 64 61 74 61 20 5b 68 74 74 70 3a  .set data [http:
8360: 3a 64 61 74 61 20 24 74 6f 6b 65 6e 5d 0a 70 75  :data $token].pu
8370: 74 73 20 24 64 61 74 61 0a 0a 23 20 43 6c 65 61  ts $data..# Clea
8380: 6e 75 70 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65 61  nup.::http::clea
8390: 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 45  nup $token.}]..E
83a0: 78 61 6d 70 6c 65 20 23 34 3a 20 44 6f 77 6e 6c  xample #4: Downl
83b0: 6f 61 64 20 66 69 6c 65 0a 0a 5b 65 78 61 6d 70  oad file..[examp
83c0: 6c 65 20 7b 0a 0a 70 61 63 6b 61 67 65 20 72 65  le {..package re
83d0: 71 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61  quire http.packa
83e0: 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a  ge require tls..
83f0: 73 65 74 20 75 72 6c 20 22 68 74 74 70 73 3a 2f  set url "https:/
8400: 2f 77 69 6b 69 2e 74 63 6c 2d 6c 61 6e 67 2e 6f  /wiki.tcl-lang.o
8410: 72 67 2f 73 69 74 65 6d 61 70 2e 78 6d 6c 22 0a  rg/sitemap.xml".
8420: 73 65 74 20 66 69 6c 65 6e 61 6d 65 20 5b 66 69  set filename [fi
8430: 6c 65 20 74 61 69 6c 20 24 75 72 6c 5d 0a 0a 68  le tail $url]..h
8440: 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74  ttp::register ht
8450: 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a  tps 443 [list ::
8460: 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74  tls::socket -aut
8470: 6f 73 65 72 76 65 72 6e 61 6d 65 20 31 20 2d 72  oservername 1 -r
8480: 65 71 75 69 72 65 20 31 5d 0a 0a 23 20 47 65 74  equire 1]..# Get
8490: 20 66 69 6c 65 0a 73 65 74 20 63 68 20 5b 6f 70   file.set ch [op
84a0: 65 6e 20 24 66 69 6c 65 6e 61 6d 65 20 77 62 5d  en $filename wb]
84b0: 0a 73 65 74 20 74 6f 6b 65 6e 20 5b 3a 3a 68 74  .set token [::ht
84c0: 74 70 3a 3a 67 65 74 75 72 6c 20 24 75 72 6c 20  tp::geturl $url 
84d0: 2d 62 6c 6f 63 6b 73 69 7a 65 20 36 35 35 33 36  -blocksize 65536
84e0: 20 2d 63 68 61 6e 6e 65 6c 20 24 63 68 5d 0a 0a   -channel $ch]..
84f0: 23 20 43 6c 65 61 6e 75 70 0a 63 6c 6f 73 65 20  # Cleanup.close 
8500: 24 63 68 0a 3a 3a 68 74 74 70 3a 3a 63 6c 65 61  $ch.::http::clea
8510: 6e 75 70 20 24 74 6f 6b 65 6e 0a 7d 5d 0a 0a 5b  nup $token.}]..[
8520: 73 65 63 74 69 6f 6e 20 22 53 70 65 63 69 61 6c  section "Special
8530: 20 43 6f 6e 73 69 64 65 72 61 74 69 6f 6e 73 22   Considerations"
8540: 5d 0a 0a 54 68 65 20 63 61 70 61 62 69 6c 69 74  ]..The capabilit
8550: 69 65 73 20 6f 66 20 74 68 69 73 20 70 61 63 6b  ies of this pack
8560: 61 67 65 20 63 61 6e 20 76 61 72 79 20 65 6e 6f  age can vary eno
8570: 72 6d 6f 75 73 6c 79 20 62 61 73 65 64 20 75 70  rmously based up
8580: 6f 6e 20 68 6f 77 20 74 68 65 0a 6c 69 6e 6b 65  on how the.linke
8590: 64 20 74 6f 20 4f 70 65 6e 53 53 4c 20 6c 69 62  d to OpenSSL lib
85a0: 72 61 72 79 20 77 61 73 20 63 6f 6e 66 69 67 75  rary was configu
85b0: 72 65 64 20 61 6e 64 20 62 75 69 6c 74 2e 20 4e  red and built. N
85c0: 65 77 20 76 65 72 73 69 6f 6e 73 20 6d 61 79 20  ew versions may 
85d0: 6f 62 73 6f 6c 65 74 65 0a 6f 6c 64 65 72 20 70  obsolete.older p
85e0: 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 73  rotocol versions
85f0: 2c 20 61 64 64 20 6f 72 20 72 65 6d 6f 76 65 20  , add or remove 
8600: 63 69 70 68 65 72 73 2c 20 63 68 61 6e 67 65 20  ciphers, change 
8610: 64 65 66 61 75 6c 74 20 76 61 6c 75 65 73 2c 20  default values, 
8620: 65 74 63 2e 0a 55 73 65 20 74 68 65 20 5b 63 6d  etc..Use the [cm
8630: 64 20 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73  d tls::protocols
8640: 5d 20 63 6f 6d 6d 61 6e 64 73 20 74 6f 20 6f 62  ] commands to ob
8650: 74 61 69 6e 20 74 68 65 20 73 75 70 70 6f 72 74  tain the support
8660: 65 64 0a 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73  ed.protocol vers
8670: 69 6f 6e 73 2e 0a 0a 5b 6d 61 6e 70 61 67 65 5f  ions...[manpage_
8680: 65 6e 64 5d 0a                                   end].