Hex Artifact Content

Artifact dd76fd83fe6ce3752c8463a8d56a3470e7b1df3c:


0000: 3c 68 74 6d 6c 3e 0d 0a 0d 0a 3c 68 65 61 64 3e  <html>....<head>
0010: 0d 0a 3c 6d 65 74 61 20 68 74 74 70 2d 65 71 75  ..<meta http-equ
0020: 69 76 3d 22 43 6f 6e 74 65 6e 74 2d 54 79 70 65  iv="Content-Type
0030: 22 0d 0a 63 6f 6e 74 65 6e 74 3d 22 74 65 78 74  "..content="text
0040: 2f 68 74 6d 6c 3b 20 63 68 61 72 73 65 74 3d 69  /html; charset=i
0050: 73 6f 2d 38 38 35 39 2d 31 22 3e 0d 0a 3c 6d 65  so-8859-1">..<me
0060: 74 61 20 6e 61 6d 65 3d 22 41 75 74 68 6f 72 22  ta name="Author"
0070: 0d 0a 63 6f 6e 74 65 6e 74 3d 22 4d 61 74 74 20  ..content="Matt 
0080: 4e 65 77 6d 61 6e 20 26 6c 74 3b 6d 61 74 74 40  Newman &lt;matt@
0090: 6e 6f 76 61 64 69 67 6d 2e 63 6f 6d 26 67 74 3b  novadigm.com&gt;
00a0: 22 3e 0d 0a 3c 6d 65 74 61 20 6e 61 6d 65 3d 22  ">..<meta name="
00b0: 43 6f 70 79 72 69 67 68 74 22 20 63 6f 6e 74 65  Copyright" conte
00c0: 6e 74 3d 22 31 39 39 39 20 4d 61 74 74 20 4e 65  nt="1999 Matt Ne
00d0: 77 6d 61 6e 2e 22 3e 0d 0a 3c 6d 65 74 61 20 6e  wman.">..<meta n
00e0: 61 6d 65 3d 22 47 45 4e 45 52 41 54 4f 52 22 20  ame="GENERATOR" 
00f0: 63 6f 6e 74 65 6e 74 3d 22 4d 69 63 72 6f 73 6f  content="Microso
0100: 66 74 20 46 72 6f 6e 74 50 61 67 65 20 45 78 70  ft FrontPage Exp
0110: 72 65 73 73 20 32 2e 30 22 3e 0d 0a 3c 74 69 74  ress 2.0">..<tit
0120: 6c 65 3e 54 4c 53 20 28 53 53 4c 29 20 54 63 6c  le>TLS (SSL) Tcl
0130: 20 43 6f 6d 6d 61 6e 64 73 3c 2f 74 69 74 6c 65   Commands</title
0140: 3e 0d 0a 3c 2f 68 65 61 64 3e 0d 0a 0d 0a 3c 62  >..</head>....<b
0150: 6f 64 79 20 62 67 63 6f 6c 6f 72 3d 22 23 46 46  ody bgcolor="#FF
0160: 46 46 46 46 22 3e 0d 0a 0d 0a 3c 64 6c 3e 0d 0a  FFFF">....<dl>..
0170: 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d      <dd><a href=
0180: 22 23 4e 41 4d 45 22 3e 4e 41 4d 45 3c 2f 61 3e  "#NAME">NAME</a>
0190: 20 3c 64 6c 3e 0d 0a 20 20 20 20 20 20 20 20 20   <dl>..         
01a0: 20 20 20 3c 64 64 3e 3c 73 74 72 6f 6e 67 3e 74     <dd><strong>t
01b0: 6c 73 3c 2f 73 74 72 6f 6e 67 3e 20 2d 20 62 69  ls</strong> - bi
01c0: 6e 64 69 6e 67 20 74 6f 20 3c 73 74 72 6f 6e 67  nding to <strong
01d0: 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e 67  >OpenSSL</strong
01e0: 3e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  >..             
01f0: 20 20 20 74 6f 6f 6c 6b 69 74 2e 3c 2f 64 64 3e     toolkit.</dd>
0200: 0d 0a 20 20 20 20 20 20 20 20 3c 2f 64 6c 3e 0d  ..        </dl>.
0210: 0a 20 20 20 20 3c 2f 64 64 3e 0d 0a 20 20 20 20  .    </dd>..    
0220: 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 53 59  <dd><a href="#SY
0230: 4e 4f 50 53 49 53 22 3e 53 59 4e 4f 50 53 49 53  NOPSIS">SYNOPSIS
0240: 3c 2f 61 3e 20 3c 2f 64 64 3e 0d 0a 20 20 20 20  </a> </dd>..    
0250: 3c 64 64 3e 3c 64 6c 3e 0d 0a 20 20 20 20 20 20  <dd><dl>..      
0260: 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 70 61 63        <dd><b>pac
0270: 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c  kage require Tcl
0280: 20 3c 2f 62 3e 3c 65 6d 3e 3f 38 2e 32 3f 3c 2f   </b><em>?8.2?</
0290: 65 6d 3e 3c 2f 64 64 3e 0d 0a 20 20 20 20 20 20  em></dd>..      
02a0: 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 70 61 63        <dd><b>pac
02b0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 74 6c 73  kage require tls
02c0: 20 3c 2f 62 3e 3c 65 6d 3e 3f 31 2e 34 3f 3c 2f   </b><em>?1.4?</
02d0: 65 6d 3e 3c 2f 64 64 3e 0d 0a 20 20 20 20 20 20  em></dd>..      
02e0: 20 20 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b        <dt>&nbsp;
02f0: 3c 2f 64 74 3e 0d 0a 20 20 20 20 20 20 20 20 20  </dt>..         
0300: 20 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 69     <dd><b>tls::i
0310: 6e 69 74 20 3c 2f 62 3e 3c 69 3e 3f 6f 70 74 69  nit </b><i>?opti
0320: 6f 6e 73 3f 3c 2f 69 3e 20 3c 2f 64 64 3e 0d 0a  ons?</i> </dd>..
0330: 20 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e              <dd>
0340: 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 3c  <b>tls::socket <
0350: 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 69 6f 6e 73 3f  /b><em>?options?
0360: 20 68 6f 73 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c   host port</em><
0370: 2f 64 64 3e 0d 0a 20 20 20 20 20 20 20 20 20 20  /dd>..          
0380: 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 73 6f    <dd><b>tls::so
0390: 63 6b 65 74 3c 2f 62 3e 3c 65 6d 3e 20 3f 2d 73  cket</b><em> ?-s
03a0: 65 72 76 65 72 20 63 6f 6d 6d 61 6e 64 3f 0d 0a  erver command?..
03b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
03c0: 3f 6f 70 74 69 6f 6e 73 3f 20 70 6f 72 74 3c 2f  ?options? port</
03d0: 65 6d 3e 3c 2f 64 64 3e 0d 0a 20 20 20 20 20 20  em></dd>..      
03e0: 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74 6c 73        <dd><b>tls
03f0: 3a 3a 68 61 6e 64 73 68 61 6b 65 3c 2f 62 3e 3c  ::handshake</b><
0400: 65 6d 3e 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e  em> channel</em>
0410: 3c 2f 64 64 3e 0d 0a 20 20 20 20 20 20 20 20 20  </dd>..         
0420: 20 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 73     <dd><b>tls::s
0430: 74 61 74 75 73 20 3c 2f 62 3e 3c 65 6d 3e 3f 2d  tatus </b><em>?-
0440: 6c 6f 63 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c 2f  local? channel</
0450: 65 6d 3e 3c 2f 64 64 3e 0d 0a 20 20 20 20 20 20  em></dd>..      
0460: 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74 6c 73        <dd><b>tls
0470: 3a 3a 69 6d 70 6f 72 74 3c 2f 62 3e 3c 65 6d 3e  ::import</b><em>
0480: 20 63 68 61 6e 6e 65 6c 20 3f 6f 70 74 69 6f 6e   channel ?option
0490: 73 3f 3c 2f 65 6d 3e 3c 2f 64 64 3e 0d 0a 20 20  s?</em></dd>..  
04a0: 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c 62            <dd><b
04b0: 3e 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 3c 2f  >tls::ciphers </
04c0: 62 3e 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20 3f  b><em>protocol ?
04d0: 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f 64  verbose?</em></d
04e0: 64 3e 0d 0a 20 20 20 20 20 20 20 20 3c 2f 64 6c  d>..        </dl
04f0: 3e 0d 0a 20 20 20 20 3c 2f 64 64 3e 0d 0a 20 20  >..    </dd>..  
0500: 20 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23    <dd><a href="#
0510: 43 4f 4d 4d 41 4e 44 53 22 3e 43 4f 4d 4d 41 4e  COMMANDS">COMMAN
0520: 44 53 3c 2f 61 3e 3c 2f 64 64 3e 0d 0a 20 20 20  DS</a></dd>..   
0530: 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 43   <dd><a href="#C
0540: 4f 4e 46 49 47 55 52 41 54 49 4f 4e 20 4f 50 54  ONFIGURATION OPT
0550: 49 4f 4e 53 22 3e 43 4f 4e 46 49 47 55 52 41 54  IONS">CONFIGURAT
0560: 49 4f 4e 20 4f 50 54 49 4f 4e 53 3c 2f 61 3e 3c  ION OPTIONS</a><
0570: 2f 64 64 3e 0d 0a 20 20 20 20 3c 64 64 3e 3c 61  /dd>..    <dd><a
0580: 20 68 72 65 66 3d 22 23 48 54 54 50 53 20 45 58   href="#HTTPS EX
0590: 41 4d 50 4c 45 22 3e 48 54 54 50 53 20 45 58 41  AMPLE">HTTPS EXA
05a0: 4d 50 4c 45 3c 2f 61 3e 3c 2f 64 64 3e 0d 0a 20  MPLE</a></dd>.. 
05b0: 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22     <dd><a href="
05c0: 23 53 45 45 20 41 4c 53 4f 22 3e 53 50 45 43 49  #SEE ALSO">SPECI
05d0: 41 4c 20 43 4f 4e 53 49 44 45 52 41 54 49 4f 4e  AL CONSIDERATION
05e0: 53 3c 2f 61 3e 3c 2f 64 64 3e 0d 0a 20 20 20 20  S</a></dd>..    
05f0: 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 53 45  <dd><a href="#SE
0600: 45 20 41 4c 53 4f 22 3e 53 45 45 20 41 4c 53 4f  E ALSO">SEE ALSO
0610: 3c 2f 61 3e 3c 2f 64 64 3e 0d 0a 3c 2f 64 6c 3e  </a></dd>..</dl>
0620: 0d 0a 0d 0a 3c 68 72 3e 0d 0a 0d 0a 3c 68 33 3e  ....<hr>....<h3>
0630: 3c 61 20 6e 61 6d 65 3d 22 4e 41 4d 45 22 3e 4e  <a name="NAME">N
0640: 41 4d 45 3c 2f 61 3e 3c 2f 68 33 3e 0d 0a 0d 0a  AME</a></h3>....
0650: 3c 70 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3c 2f  <p><strong>tls</
0660: 73 74 72 6f 6e 67 3e 20 2d 20 62 69 6e 64 69 6e  strong> - bindin
0670: 67 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 4f 70 65  g to <strong>Ope
0680: 6e 53 53 4c 3c 2f 73 74 72 6f 6e 67 3e 0d 0a 74  nSSL</strong>..t
0690: 6f 6f 6c 6b 69 74 2e 3c 2f 70 3e 0d 0a 0d 0a 3c  oolkit.</p>....<
06a0: 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 59 4e 4f  h3><a name="SYNO
06b0: 50 53 49 53 22 3e 53 59 4e 4f 50 53 49 53 3c 2f  PSIS">SYNOPSIS</
06c0: 61 3e 3c 2f 68 33 3e 0d 0a 0d 0a 3c 70 3e 3c 62  a></h3>....<p><b
06d0: 3e 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  >package require
06e0: 20 54 63 6c 20 38 2e 32 3c 2f 62 3e 3c 62 72 3e   Tcl 8.2</b><br>
06f0: 0d 0a 3c 62 3e 70 61 63 6b 61 67 65 20 72 65 71  ..<b>package req
0700: 75 69 72 65 20 74 6c 73 20 31 2e 34 3c 2f 62 3e  uire tls 1.4</b>
0710: 3c 62 72 3e 0d 0a 3c 62 72 3e 0d 0a 3c 61 20 68  <br>..<br>..<a h
0720: 72 65 66 3d 22 23 74 6c 73 3a 3a 69 6e 69 74 22  ref="#tls::init"
0730: 3e 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74 20 3c 2f  ><b>tls::init </
0740: 62 3e 3c 69 3e 3f 6f 70 74 69 6f 6e 73 3f 3c 2f  b><i>?options?</
0750: 69 3e 3c 62 72 3e 0d 0a 3c 2f 61 3e 3c 61 20 68  i><br>..</a><a h
0760: 72 65 66 3d 22 23 74 6c 73 3a 3a 73 6f 63 6b 65  ref="#tls::socke
0770: 74 22 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65  t"><b>tls::socke
0780: 74 20 3c 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 69 6f  t </b><em>?optio
0790: 6e 73 3f 20 68 6f 73 74 0d 0a 70 6f 72 74 3c 2f  ns? host..port</
07a0: 65 6d 3e 3c 62 72 3e 0d 0a 3c 62 3e 74 6c 73 3a  em><br>..<b>tls:
07b0: 3a 73 6f 63 6b 65 74 3c 2f 62 3e 3c 65 6d 3e 20  :socket</b><em> 
07c0: 3f 2d 73 65 72 76 65 72 20 63 6f 6d 6d 61 6e 64  ?-server command
07d0: 3f 20 3f 6f 70 74 69 6f 6e 73 3f 20 70 6f 72 74  ? ?options? port
07e0: 3c 2f 65 6d 3e 3c 62 72 3e 0d 0a 3c 2f 61 3e 3c  </em><br>..</a><
07f0: 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 73 74  a href="#tls::st
0800: 61 74 75 73 22 3e 3c 62 3e 74 6c 73 3a 3a 73 74  atus"><b>tls::st
0810: 61 74 75 73 20 3c 2f 62 3e 3c 65 6d 3e 3f 2d 6c  atus </b><em>?-l
0820: 6f 63 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c 2f 65  ocal? channel</e
0830: 6d 3e 3c 62 72 3e 0d 0a 3c 2f 61 3e 3c 61 20 68  m><br>..</a><a h
0840: 72 65 66 3d 22 23 74 6c 73 3a 3a 68 61 6e 64 73  ref="#tls::hands
0850: 68 61 6b 65 22 3e 3c 62 3e 74 6c 73 3a 3a 68 61  hake"><b>tls::ha
0860: 6e 64 73 68 61 6b 65 3c 2f 62 3e 3c 65 6d 3e 20  ndshake</b><em> 
0870: 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61 3e  channel</em></a>
0880: 3c 62 72 3e 0d 0a 3c 62 72 3e 0d 0a 3c 61 20 68  <br>..<br>..<a h
0890: 72 65 66 3d 22 23 74 6c 73 3a 3a 69 6d 70 6f 72  ref="#tls::impor
08a0: 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70 6f 72  t"><b>tls::impor
08b0: 74 20 3c 2f 62 3e 3c 69 3e 63 68 61 6e 6e 65 6c  t </b><i>channel
08c0: 20 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f   ?options?</i></
08d0: 61 3e 3c 62 72 3e 0d 0a 3c 61 20 68 72 65 66 3d  a><br>..<a href=
08e0: 22 23 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 70  "#tls::ciphers p
08f0: 72 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65  rotocol ?verbose
0900: 3f 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a  ?"><strong>tls::
0910: 63 69 70 68 65 72 73 3c 2f 73 74 72 6f 6e 67 3e  ciphers</strong>
0920: 0d 0a 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20 3f  ..<em>protocol ?
0930: 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f 61  verbose?</em></a
0940: 3e 3c 2f 70 3e 0d 0a 0d 0a 3c 68 33 3e 3c 61 20  ></p>....<h3><a 
0950: 6e 61 6d 65 3d 22 44 45 53 43 52 49 50 54 49 4f  name="DESCRIPTIO
0960: 4e 22 3e 44 45 53 43 52 49 50 54 49 4f 4e 3c 2f  N">DESCRIPTION</
0970: 61 3e 3c 2f 68 33 3e 0d 0a 0d 0a 3c 70 3e 54 68  a></h3>....<p>Th
0980: 69 73 20 65 78 74 65 6e 73 69 6f 6e 20 70 72 6f  is extension pro
0990: 76 69 64 65 73 20 61 20 67 65 6e 65 72 69 63 20  vides a generic 
09a0: 62 69 6e 64 69 6e 67 20 74 6f 20 3c 61 0d 0a 68  binding to <a..h
09b0: 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e  ref="http://www.
09c0: 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 4f 70  openssl.org/">Op
09d0: 65 6e 53 53 4c 3c 2f 61 3e 2c 20 75 74 69 6c 69  enSSL</a>, utili
09e0: 7a 69 6e 67 20 74 68 65 0d 0a 3c 73 74 72 6f 6e  zing the..<stron
09f0: 67 3e 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e  g>Tcl_StackChann
0a00: 65 6c 3c 2f 73 74 72 6f 6e 67 3e 0d 0a 41 50 49  el</strong>..API
0a10: 20 66 6f 72 20 54 63 6c 20 38 2e 32 20 61 6e 64   for Tcl 8.2 and
0a20: 20 68 69 67 68 65 72 2e 20 54 68 65 20 73 6f 63   higher. The soc
0a30: 6b 65 74 73 20 62 65 68 61 76 65 20 65 78 61 63  kets behave exac
0a40: 74 6c 79 20 74 68 65 20 73 61 6d 65 0d 0a 61 73  tly the same..as
0a50: 20 63 68 61 6e 6e 65 6c 73 20 63 72 65 61 74 65   channels create
0a60: 64 20 75 73 69 6e 67 20 54 63 6c 27 73 20 62 75  d using Tcl's bu
0a70: 69 6c 74 2d 69 6e 20 3c 73 74 72 6f 6e 67 3e 73  ilt-in <strong>s
0a80: 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 0d 0a  ocket</strong>..
0a90: 63 6f 6d 6d 61 6e 64 20 77 69 74 68 20 61 64 64  command with add
0aa0: 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 73 20  itional options 
0ab0: 66 6f 72 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20  for controlling 
0ac0: 74 68 65 20 53 53 4c 20 73 65 73 73 69 6f 6e 2e  the SSL session.
0ad0: 0d 0a 54 6f 20 75 73 65 20 54 4c 53 20 77 69 74  ..To use TLS wit
0ae0: 68 20 61 6e 20 65 61 72 6c 69 65 72 20 76 65 72  h an earlier ver
0af0: 73 69 6f 6e 20 6f 66 20 54 63 6c 20 74 68 61 6e  sion of Tcl than
0b00: 20 38 2e 32 2c 20 70 6c 65 61 73 65 20 6f 62 74   8.2, please obt
0b10: 61 69 6e 0d 0a 54 4c 53 20 76 31 2e 33 2e 20 20  ain..TLS v1.3.  
0b20: 50 6c 65 61 73 65 20 6e 6f 74 65 20 74 68 61 74  Please note that
0b30: 20 74 68 65 72 65 20 61 72 65 20 6b 6e 6f 77 6e   there are known
0b40: 20 6c 69 6d 69 74 61 74 69 6f 6e 73 20 77 69 74   limitations wit
0b50: 68 20 74 68 65 0d 0a 73 74 61 63 6b 65 64 20 63  h the..stacked c
0b60: 68 61 6e 6e 65 6c 20 69 6d 70 6c 65 6d 65 6e 74  hannel implement
0b70: 61 74 69 6f 6e 20 70 72 69 6f 72 20 74 6f 20 38  ation prior to 8
0b80: 2e 33 2e 32 2c 20 73 6f 20 69 74 20 69 73 20 72  .3.2, so it is r
0b90: 65 63 6f 6d 6d 65 6e 64 65 64 0d 0a 74 68 61 74  ecommended..that
0ba0: 20 54 4c 53 20 69 73 20 75 73 65 64 20 77 69 74   TLS is used wit
0bb0: 68 20 61 6e 20 38 2e 33 2e 32 2b 20 69 6e 74 65  h an 8.3.2+ inte
0bc0: 72 70 72 65 74 65 72 2e 20 20 54 4c 53 20 76 31  rpreter.  TLS v1
0bd0: 2e 34 20 77 69 6c 6c 20 77 6f 72 6b 0d 0a 77 69  .4 will work..wi
0be0: 74 68 20 38 2e 32 2b 2c 20 69 74 20 69 73 20 6a  th 8.2+, it is j
0bf0: 75 73 74 20 6d 6f 72 65 20 73 74 61 62 6c 65 20  ust more stable 
0c00: 77 69 74 68 20 38 2e 33 2e 32 2b 2e 0d 0a 3c 2f  with 8.3.2+...</
0c10: 70 3e 0d 0a 0d 0a 3c 68 33 3e 3c 61 20 6e 61 6d  p>....<h3><a nam
0c20: 65 3d 22 43 4f 4d 4d 41 4e 44 53 22 3e 43 4f 4d  e="COMMANDS">COM
0c30: 4d 41 4e 44 53 3c 2f 61 3e 3c 2f 68 33 3e 0d 0a  MANDS</a></h3>..
0c40: 0d 0a 3c 70 3e 54 79 70 69 63 61 6c 6c 79 20 6f  ..<p>Typically o
0c50: 6e 65 20 77 6f 75 6c 64 20 75 73 65 20 74 68 65  ne would use the
0c60: 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f   <strong>tls::so
0c70: 63 6b 65 74 20 3c 2f 73 74 72 6f 6e 67 3e 63 6f  cket </strong>co
0c80: 6d 6d 61 6e 64 0d 0a 77 68 69 63 68 20 70 72 6f  mmand..which pro
0c90: 76 69 64 65 73 20 63 6f 6d 70 61 74 69 62 69 6c  vides compatibil
0ca0: 69 74 79 20 77 69 74 68 20 74 68 65 20 6e 61 74  ity with the nat
0cb0: 69 76 65 20 54 63 6c 20 3c 73 74 72 6f 6e 67 3e  ive Tcl <strong>
0cc0: 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 0d  socket</strong>.
0cd0: 0a 63 6f 6d 6d 61 6e 64 2e 20 49 6e 20 73 75 63  .command. In suc
0ce0: 68 20 63 61 73 65 73 20 3c 73 74 72 6f 6e 67 3e  h cases <strong>
0cf0: 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72  tls::import</str
0d00: 6f 6e 67 3e 20 73 68 6f 75 6c 64 20 6e 6f 74 20  ong> should not 
0d10: 62 65 0d 0a 75 73 65 64 20 64 69 72 65 63 74 6c  be..used directl
0d20: 79 2e 3c 2f 70 3e 0d 0a 0d 0a 3c 64 6c 3e 0d 0a  y.</p>....<dl>..
0d30: 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d      <dt><a name=
0d40: 22 74 6c 73 3a 3a 69 6e 69 74 22 3e 3c 62 3e 74  "tls::init"><b>t
0d50: 6c 73 3a 3a 69 6e 69 74 20 3c 2f 62 3e 3c 69 3e  ls::init </b><i>
0d60: 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61  ?options?</i></a
0d70: 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 3c 64 64 3e  ></dt>..    <dd>
0d80: 54 68 69 73 20 72 6f 75 74 69 6e 65 20 73 65 74  This routine set
0d90: 73 20 74 68 65 20 64 65 66 61 75 6c 74 20 6f 70  s the default op
0da0: 74 69 6f 6e 73 20 75 73 65 64 20 62 79 20 3c 73  tions used by <s
0db0: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65  trong>tls::socke
0dc0: 74 3c 2f 73 74 72 6f 6e 67 3e 0d 0a 20 20 20 20  t</strong>..    
0dd0: 20 20 20 20 61 6e 64 20 69 73 20 3c 65 6d 3e 6f      and is <em>o
0de0: 70 74 69 6f 6e 61 6c 3c 2f 65 6d 3e 2e 20 49 66  ptional</em>. If
0df0: 20 79 6f 75 20 63 61 6c 6c 20 3c 73 74 72 6f 6e   you call <stron
0e00: 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73  g>tls::import</s
0e10: 74 72 6f 6e 67 3e 0d 0a 20 20 20 20 20 20 20 20  trong>..        
0e20: 64 69 72 65 63 74 6c 79 20 74 68 69 73 20 72 6f  directly this ro
0e30: 75 74 69 6e 65 20 68 61 73 20 6e 6f 20 65 66 66  utine has no eff
0e40: 65 63 74 2e 20 41 6e 79 20 6f 66 20 74 68 65 20  ect. Any of the 
0e50: 6f 70 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20  options..       
0e60: 20 74 68 61 74 20 3c 73 74 72 6f 6e 67 3e 74 6c   that <strong>tl
0e70: 73 3a 3a 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e  s::socket</stron
0e80: 67 3e 20 61 63 63 65 70 74 73 20 63 61 6e 20 62  g> accepts can b
0e90: 65 20 73 65 74 0d 0a 20 20 20 20 20 20 20 20 75  e set..        u
0ea0: 73 69 6e 67 20 74 68 69 73 20 63 6f 6d 6d 61 6e  sing this comman
0eb0: 64 2c 20 74 68 6f 75 67 68 20 79 6f 75 20 73 68  d, though you sh
0ec0: 6f 75 6c 64 20 6c 69 6d 69 74 20 79 6f 75 72 20  ould limit your 
0ed0: 6f 70 74 69 6f 6e 73 0d 0a 20 20 20 20 20 20 20  options..       
0ee0: 20 74 6f 20 6f 6e 6c 79 20 54 4c 53 20 72 65 6c   to only TLS rel
0ef0: 61 74 65 64 20 6f 6e 65 73 2e 3c 2f 64 64 3e 0d  ated ones.</dd>.
0f00: 0a 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c  .    <dt>&nbsp;<
0f10: 2f 64 74 3e 0d 0a 20 20 20 20 3c 64 74 3e 3c 61  /dt>..    <dt><a
0f20: 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 73 6f 63 6b   name="tls::sock
0f30: 65 74 22 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b  et"><b>tls::sock
0f40: 65 74 20 3c 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 69  et </b><em>?opti
0f50: 6f 6e 73 3f 0d 0a 20 20 20 20 20 20 20 20 68 6f  ons?..        ho
0f60: 73 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 61 3e  st port</em></a>
0f70: 3c 2f 64 74 3e 0d 0a 20 20 20 20 3c 64 74 3e 3c  </dt>..    <dt><
0f80: 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f 62  b>tls::socket</b
0f90: 3e 3c 65 6d 3e 20 3f 2d 73 65 72 76 65 72 20 63  ><em> ?-server c
0fa0: 6f 6d 6d 61 6e 64 3f 20 3f 6f 70 74 69 6f 6e 73  ommand? ?options
0fb0: 3f 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64 74 3e  ? port</em></dt>
0fc0: 0d 0a 20 20 20 20 3c 64 64 3e 54 68 69 73 20 69  ..    <dd>This i
0fd0: 73 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63 74  s a helper funct
0fe0: 69 6f 6e 20 74 68 61 74 20 75 74 69 6c 69 7a 65  ion that utilize
0ff0: 73 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67  s the underlying
1000: 0d 0a 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e  ..        comman
1010: 64 73 20 28 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a  ds (<strong>tls:
1020: 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e  :import</strong>
1030: 29 2e 20 49 74 20 62 65 68 61 76 65 73 0d 0a 20  ). It behaves.. 
1040: 20 20 20 20 20 20 20 65 78 61 63 74 6c 79 20 74         exactly t
1050: 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 6e  he same as the n
1060: 61 74 69 76 65 20 54 63 6c 20 3c 73 74 72 6f 6e  ative Tcl <stron
1070: 67 3e 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67  g>socket</strong
1080: 3e 0d 0a 20 20 20 20 20 20 20 20 63 6f 6d 6d 61  >..        comma
1090: 6e 64 20 65 78 63 65 70 74 20 74 68 61 74 20 74  nd except that t
10a0: 68 65 20 6f 70 74 69 6f 6e 73 20 63 61 6e 20 69  he options can i
10b0: 6e 63 6c 75 64 65 20 61 6e 79 20 6f 66 20 74 68  nclude any of th
10c0: 65 0d 0a 20 20 20 20 20 20 20 20 61 70 70 6c 69  e..        appli
10d0: 63 61 62 6c 65 20 3c 61 20 68 72 65 66 3d 22 23  cable <a href="#
10e0: 74 6c 73 3a 3a 69 6d 70 6f 72 74 22 3e 3c 73 74  tls::import"><st
10f0: 72 6f 6e 67 3e 74 6c 73 3a 69 6d 70 6f 72 74 3c  rong>tls:import<
1100: 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 0d 0a 20 20  /strong></a>..  
1110: 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 3c 2f        options.</
1120: 64 64 3e 0d 0a 20 20 20 20 3c 64 74 3e 26 6e 62  dd>..    <dt>&nb
1130: 73 70 3b 3c 2f 64 74 3e 0d 0a 20 20 20 20 3c 64  sp;</dt>..    <d
1140: 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a  t><a name="tls::
1150: 68 61 6e 64 73 68 61 6b 65 22 3e 3c 73 74 72 6f  handshake"><stro
1160: 6e 67 3e 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b  ng>tls::handshak
1170: 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  e</strong> <em>c
1180: 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61 3e 3c  hannel</em></a><
1190: 2f 64 74 3e 0d 0a 20 20 20 20 3c 64 64 3e 46 6f  /dt>..    <dd>Fo
11a0: 72 63 65 73 20 68 61 6e 64 73 68 61 6b 65 20 74  rces handshake t
11b0: 6f 20 74 61 6b 65 20 70 6c 61 63 65 2c 20 61 6e  o take place, an
11c0: 64 20 72 65 74 75 72 6e 73 20 30 20 69 66 0d 0a  d returns 0 if..
11d0: 20 20 20 20 20 20 20 20 68 61 6e 64 73 68 61 6b          handshak
11e0: 65 20 69 73 20 73 74 69 6c 6c 20 69 6e 20 70 72  e is still in pr
11f0: 6f 67 72 65 73 73 20 28 6e 6f 6e 2d 62 6c 6f 63  ogress (non-bloc
1200: 6b 69 6e 67 29 2c 20 6f 72 20 31 20 69 66 0d 0a  king), or 1 if..
1210: 20 20 20 20 20 20 20 20 74 68 65 20 68 61 6e 64          the hand
1220: 73 68 61 6b 65 20 77 61 73 20 73 75 63 63 65 73  shake was succes
1230: 73 66 75 6c 2e 20 49 66 20 74 68 65 20 68 61 6e  sful. If the han
1240: 64 73 68 61 6b 65 20 66 61 69 6c 65 64 0d 0a 20  dshake failed.. 
1250: 20 20 20 20 20 20 20 74 68 69 73 20 72 6f 75 74         this rout
1260: 69 6e 65 20 77 69 6c 6c 20 74 68 72 6f 77 20 61  ine will throw a
1270: 6e 20 65 72 72 6f 72 2e 3c 2f 64 64 3e 0d 0a 20  n error.</dd>.. 
1280: 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f 64     <dt>&nbsp;</d
1290: 74 3e 0d 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e  t>..    <dt><a n
12a0: 61 6d 65 3d 22 74 6c 73 3a 3a 73 74 61 74 75 73  ame="tls::status
12b0: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  "><strong>tls::s
12c0: 74 61 74 75 73 3c 2f 73 74 72 6f 6e 67 3e 0d 0a  tatus</strong>..
12d0: 20 20 20 20 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f      <em>?-local?
12e0: 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61   channel</em></a
12f0: 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 3c 64 64 3e  ></dt>..    <dd>
1300: 52 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72  Returns the curr
1310: 65 6e 74 20 73 65 63 75 72 69 74 79 20 73 74 61  ent security sta
1320: 74 75 73 20 6f 66 20 61 20 53 53 4c 20 63 68 61  tus of a SSL cha
1330: 6e 6e 65 6c 2e 20 54 68 65 0d 0a 20 20 20 20 20  nnel. The..     
1340: 20 20 20 72 65 73 75 6c 74 20 69 73 20 61 20 6c     result is a l
1350: 69 73 74 20 6f 66 20 6b 65 79 20 76 61 6c 75 65  ist of key value
1360: 20 70 61 69 72 73 20 64 65 73 63 72 69 62 69 6e   pairs describin
1370: 67 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20 63  g the..        c
1380: 6f 6e 6e 65 63 74 65 64 20 70 65 65 72 2e 20 49  onnected peer. I
1390: 66 20 74 68 65 20 72 65 73 75 6c 74 20 69 73 20  f the result is 
13a0: 61 6e 20 65 6d 70 74 79 20 6c 69 73 74 20 74 68  an empty list th
13b0: 65 6e 20 74 68 65 0d 0a 20 20 20 20 20 20 20 20  en the..        
13c0: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 20 68 61  SSL handshake ha
13d0: 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c 65  s not yet comple
13e0: 74 65 64 2e 0d 0a 20 20 20 20 20 20 20 20 49 66  ted...        If
13f0: 20 3c 65 6d 3e 2d 6c 6f 63 61 6c 3c 2f 65 6d 3e   <em>-local</em>
1400: 20 69 73 20 67 69 76 65 6e 2c 20 74 68 65 6e 20   is given, then 
1410: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
1420: 69 6e 66 6f 72 6d 61 74 69 6f 6e 0d 0a 20 20 20  information..   
1430: 20 20 20 20 20 69 73 20 74 68 65 20 6f 6e 65 20       is the one 
1440: 75 73 65 64 20 6c 6f 63 61 6c 6c 79 2e 3c 2f 64  used locally.</d
1450: 64 3e 0d 0a 3c 2f 64 6c 3e 0d 0a 0d 0a 3c 62 6c  d>..</dl>....<bl
1460: 6f 63 6b 71 75 6f 74 65 3e 0d 0a 20 20 20 20 3c  ockquote>..    <
1470: 64 6c 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 74  dl>..        <dt
1480: 3e 3c 73 74 72 6f 6e 67 3e 69 73 73 75 65 72 3c  ><strong>issuer<
1490: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 6e 3c  /strong> <em>dn<
14a0: 2f 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 20  /em></dt>..     
14b0: 20 20 20 3c 64 64 3e 54 68 65 20 64 69 73 74 69     <dd>The disti
14c0: 6e 67 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44  nguished name (D
14d0: 4e 29 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  N) of the certif
14e0: 69 63 61 74 65 0d 0a 20 20 20 20 20 20 20 20 20  icate..         
14f0: 20 20 20 69 73 73 75 65 72 2e 3c 2f 64 64 3e 0d     issuer.</dd>.
1500: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
1510: 72 6f 6e 67 3e 73 75 62 6a 65 63 74 3c 2f 73 74  rong>subject</st
1520: 72 6f 6e 67 3e 20 3c 65 6d 3e 64 6e 3c 2f 65 6d  rong> <em>dn</em
1530: 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 20 20 20 20  ></dt>..        
1540: 3c 64 64 3e 54 68 65 20 64 69 73 74 69 6e 67 75  <dd>The distingu
1550: 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 20  ished name (DN) 
1560: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61  of the certifica
1570: 74 65 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20  te..            
1580: 73 75 62 6a 65 63 74 2e 3c 2f 64 64 3e 0d 0a 20  subject.</dd>.. 
1590: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
15a0: 6e 67 3e 6e 6f 74 42 65 66 6f 72 65 3c 2f 73 74  ng>notBefore</st
15b0: 72 6f 6e 67 3e 20 3c 65 6d 3e 64 61 74 65 3c 2f  rong> <em>date</
15c0: 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 20 20  em></dt>..      
15d0: 20 20 3c 64 64 3e 54 68 65 20 62 65 67 69 6e 20    <dd>The begin 
15e0: 64 61 74 65 20 66 6f 72 20 74 68 65 20 76 61 6c  date for the val
15f0: 69 64 69 74 79 20 6f 66 20 74 68 65 20 63 65 72  idity of the cer
1600: 74 69 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0d 0a  tificate.</dd>..
1610: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
1620: 6f 6e 67 3e 6e 6f 74 41 66 74 65 72 3c 2f 73 74  ong>notAfter</st
1630: 72 6f 6e 67 3e 20 3c 65 6d 3e 64 61 74 65 3c 2f  rong> <em>date</
1640: 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 20 20  em></dt>..      
1650: 20 20 3c 64 64 3e 54 68 65 20 65 78 70 69 72 79    <dd>The expiry
1660: 20 64 61 74 65 20 66 6f 72 20 74 68 65 20 63 65   date for the ce
1670: 72 74 69 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0d  rtificate.</dd>.
1680: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
1690: 72 6f 6e 67 3e 73 65 72 69 61 6c 3c 2f 73 74 72  rong>serial</str
16a0: 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c  ong> <em>n</em><
16b0: 2f 64 74 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64  /dt>..        <d
16c0: 64 3e 54 68 65 20 73 65 72 69 61 6c 20 6e 75 6d  d>The serial num
16d0: 62 65 72 20 6f 66 20 74 68 65 20 63 65 72 74 69  ber of the certi
16e0: 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0d 0a 20 20  ficate.</dd>..  
16f0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
1700: 67 3e 63 69 70 68 65 72 3c 2f 73 74 72 6f 6e 67  g>cipher</strong
1710: 3e 20 3c 65 6d 3e 63 69 70 68 65 72 3c 2f 65 6d  > <em>cipher</em
1720: 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 20 20 20 20  ></dt>..        
1730: 3c 64 64 3e 54 68 65 20 63 75 72 72 65 6e 74 20  <dd>The current 
1740: 63 69 70 68 65 72 20 69 6e 20 75 73 65 20 62 65  cipher in use be
1750: 74 77 65 65 6e 20 74 68 65 20 63 6c 69 65 6e 74  tween the client
1760: 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 20 20   and..          
1770: 20 20 73 65 72 76 65 72 20 63 68 61 6e 6e 65 6c    server channel
1780: 73 2e 3c 2f 64 64 3e 0d 0a 20 20 20 20 20 20 20  s.</dd>..       
1790: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 73 62 69   <dt><strong>sbi
17a0: 74 73 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e  ts</strong> <em>
17b0: 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20  n</em></dt>..   
17c0: 20 20 20 20 20 3c 64 64 3e 54 68 65 20 6e 75 6d       <dd>The num
17d0: 62 65 72 20 6f 66 20 62 69 74 73 20 75 73 65 64  ber of bits used
17e0: 20 66 6f 72 20 74 68 65 20 73 65 73 73 69 6f 6e   for the session
17f0: 20 6b 65 79 2e 3c 2f 64 64 3e 0d 0a 20 20 20 20   key.</dd>..    
1800: 3c 2f 64 6c 3e 0d 0a 3c 2f 62 6c 6f 63 6b 71 75  </dl>..</blockqu
1810: 6f 74 65 3e 0d 0a 0d 0a 3c 64 6c 3e 0d 0a 20 20  ote>....<dl>..  
1820: 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74    <dt><a name="t
1830: 6c 73 3a 3a 69 6d 70 6f 72 74 22 3e 3c 62 3e 74  ls::import"><b>t
1840: 6c 73 3a 3a 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c  ls::import </b><
1850: 69 3e 63 68 61 6e 6e 65 6c 0d 0a 20 20 20 20 20  i>channel..     
1860: 20 20 20 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 69 3e     ?options?</i>
1870: 3c 2f 61 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 3c  </a></dt>..    <
1880: 64 64 3e 53 53 4c 2d 65 6e 61 62 6c 65 20 61 20  dd>SSL-enable a 
1890: 72 65 67 75 6c 61 72 20 54 63 6c 20 63 68 61 6e  regular Tcl chan
18a0: 6e 65 6c 20 2d 20 69 74 20 6e 65 65 64 20 6e 6f  nel - it need no
18b0: 74 20 62 65 20 61 0d 0a 20 20 20 20 20 20 20 20  t be a..        
18c0: 73 6f 63 6b 65 74 2c 20 62 75 74 20 6d 75 73 74  socket, but must
18d0: 20 70 72 6f 76 69 64 65 20 62 69 2d 64 69 72 65   provide bi-dire
18e0: 63 74 69 6f 6e 61 6c 20 66 6c 6f 77 2e 20 41 6c  ctional flow. Al
18f0: 73 6f 0d 0a 20 20 20 20 20 20 20 20 73 65 74 74  so..        sett
1900: 69 6e 67 20 73 65 73 73 69 6f 6e 20 70 61 72 61  ing session para
1910: 6d 65 74 65 72 73 20 66 6f 72 20 53 53 4c 20 68  meters for SSL h
1920: 61 6e 64 73 68 61 6b 65 2e 3c 2f 64 64 3e 0d 0a  andshake.</dd>..
1930: 3c 2f 64 6c 3e 0d 0a 0d 0a 3c 62 6c 6f 63 6b 71  </dl>....<blockq
1940: 75 6f 74 65 3e 0d 0a 20 20 20 20 3c 64 6c 3e 0d  uote>..    <dl>.
1950: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
1960: 72 6f 6e 67 3e 2d 63 61 66 69 6c 65 20 3c 2f 73  rong>-cafile </s
1970: 74 72 6f 6e 67 3e 3c 65 6d 3e 66 69 6c 65 6e 61  trong><em>filena
1980: 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20  me</em></dt>..  
1990: 20 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64        <dd>Provid
19a0: 65 20 74 68 65 20 43 41 20 66 69 6c 65 2e 3c 2f  e the CA file.</
19b0: 64 64 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 74  dd>..        <dt
19c0: 3e 2d 3c 73 74 72 6f 6e 67 3e 63 61 64 69 72 3c  >-<strong>cadir<
19d0: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 69 72  /strong> <em>dir
19e0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20  </em></dt>..    
19f0: 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20      <dd>Provide 
1a00: 74 68 65 20 64 69 72 65 63 74 6f 72 79 20 63 6f  the directory co
1a10: 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 43 41 20  ntaining the CA 
1a20: 63 65 72 74 69 66 69 63 61 74 65 73 2e 3c 2f 64  certificates.</d
1a30: 64 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  d>..        <dt>
1a40: 3c 73 74 72 6f 6e 67 3e 2d 63 65 72 74 66 69 6c  <strong>-certfil
1a50: 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66  e</strong> <em>f
1a60: 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74  ilename</em></dt
1a70: 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50  >..        <dd>P
1a80: 72 6f 76 69 64 65 20 74 68 65 20 63 65 72 74 69  rovide the certi
1a90: 66 69 63 61 74 65 20 74 6f 20 75 73 65 2e 3c 2f  ficate to use.</
1aa0: 64 64 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 74  dd>..        <dt
1ab0: 3e 3c 73 74 72 6f 6e 67 3e 2d 63 69 70 68 65 72  ><strong>-cipher
1ac0: 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e 73 74   </strong><em>st
1ad0: 72 69 6e 67 3c 2f 65 6d 3e 3c 2f 64 74 3e 0d 0a  ring</em></dt>..
1ae0: 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72 6f 76          <dd>Prov
1af0: 69 64 65 20 74 68 65 20 63 69 70 68 65 72 20 73  ide the cipher s
1b00: 75 69 74 65 73 20 74 6f 20 75 73 65 2e 20 53 79  uites to use. Sy
1b10: 6e 74 61 78 20 69 73 20 61 73 20 70 65 72 0d 0a  ntax is as per..
1b20: 20 20 20 20 20 20 20 20 20 20 20 20 4f 70 65 6e              Open
1b30: 53 53 4c 2e 3c 2f 64 64 3e 0d 0a 20 20 20 20 20  SSL.</dd>..     
1b40: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
1b50: 63 6f 6d 6d 61 6e 64 3c 2f 73 74 72 6f 6e 67 3e  command</strong>
1b60: 3c 65 6d 3e 20 63 61 6c 6c 62 61 63 6b 3c 2f 65  <em> callback</e
1b70: 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 20 20 20  m></dt>..       
1b80: 20 3c 64 64 3e 54 68 69 73 20 63 61 6c 6c 62 61   <dd>This callba
1b90: 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 74 6f  ck is invoked to
1ba0: 20 70 61 73 73 20 65 72 72 6f 72 73 2c 20 74 72   pass errors, tr
1bb0: 61 63 69 6e 67 0d 0a 20 20 20 20 20 20 20 20 20  acing..         
1bc0: 20 20 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61     information a
1bd0: 6e 64 20 74 6f 20 61 6c 6c 6f 77 20 54 63 6c 20  nd to allow Tcl 
1be0: 73 63 72 69 70 74 73 20 74 6f 20 70 65 72 66 6f  scripts to perfo
1bf0: 72 6d 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20  rm..            
1c00: 61 64 64 69 74 69 6f 6e 61 6c 20 76 65 72 69 66  additional verif
1c10: 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 63  ication of the c
1c20: 65 72 74 69 66 69 63 61 74 65 2c 20 77 68 69 63  ertificate, whic
1c30: 68 20 63 61 6e 0d 0a 20 20 20 20 20 20 20 20 20  h can..         
1c40: 20 20 20 6f 76 65 72 72 69 64 65 20 74 68 65 20     override the 
1c50: 64 65 66 61 75 6c 74 20 76 61 6c 69 64 61 74 69  default validati
1c60: 6f 6e 20 69 6e 20 4f 70 65 6e 53 53 4c 2e 3c 2f  on in OpenSSL.</
1c70: 64 64 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 74  dd>..        <dt
1c80: 3e 3c 73 74 72 6f 6e 67 3e 2d 6b 65 79 66 69 6c  ><strong>-keyfil
1c90: 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66  e</strong> <em>f
1ca0: 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74  ilename</em></dt
1cb0: 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50  >..        <dd>P
1cc0: 72 6f 76 69 64 65 20 74 68 65 20 70 72 69 76 61  rovide the priva
1cd0: 74 65 20 6b 65 79 20 66 69 6c 65 2e 20 28 3c 73  te key file. (<s
1ce0: 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73  trong>default</s
1cf0: 74 72 6f 6e 67 3e 3a 0d 0a 20 20 20 20 20 20 20  trong>:..       
1d00: 20 20 20 20 20 76 61 6c 75 65 20 6f 66 20 2d 63       value of -c
1d10: 65 72 74 66 69 6c 65 29 3c 2f 64 64 3e 0d 0a 20  ertfile)</dd>.. 
1d20: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
1d30: 6e 67 3e 2d 6d 6f 64 65 6c 3c 2f 73 74 72 6f 6e  ng>-model</stron
1d40: 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f  g> <em>channel</
1d50: 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 20 20  em></dt>..      
1d60: 20 20 3c 64 64 3e 54 68 69 73 20 77 69 6c 6c 20    <dd>This will 
1d70: 66 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e 6e  force this chann
1d80: 65 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65 20  el to share the 
1d90: 73 61 6d 65 20 3c 65 6d 3e 3c 73 74 72 6f 6e 67  same <em><strong
1da0: 3e 53 53 4c 5f 43 54 58 3c 2f 73 74 72 6f 6e 67  >SSL_CTX</strong
1db0: 3e 3c 2f 65 6d 3e 0d 0a 20 20 20 20 20 20 20 20  ></em>..        
1dc0: 20 20 20 20 73 74 72 75 63 74 75 72 65 20 61 73      structure as
1dd0: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 3c   the specified <
1de0: 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 2c  em>channel</em>,
1df0: 20 61 6e 64 0d 0a 20 20 20 20 20 20 20 20 20 20   and..          
1e00: 20 20 74 68 65 72 65 66 6f 72 65 20 73 68 61 72    therefore shar
1e10: 65 20 63 61 6c 6c 62 61 63 6b 73 20 65 74 63 2e  e callbacks etc.
1e20: 3c 2f 64 64 3e 0d 0a 20 20 20 20 20 20 20 20 3c  </dd>..        <
1e30: 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 72 65 71 75  dt><strong>-requ
1e40: 65 73 74 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d  est </strong><em
1e50: 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0d  >bool</em></dt>.
1e60: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 52 65 71  .        <dd>Req
1e70: 75 65 73 74 20 61 20 63 65 72 74 69 66 69 63 61  uest a certifica
1e80: 74 65 20 66 72 6f 6d 20 70 65 65 72 20 64 75 72  te from peer dur
1e90: 69 6e 67 20 53 53 4c 20 68 61 6e 64 73 68 61 6b  ing SSL handshak
1ea0: 65 2e 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20  e...            
1eb0: 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74  (<strong>default
1ec0: 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74  </strong>: <em>t
1ed0: 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0d 0a  rue</em>)</dd>..
1ee0: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
1ef0: 6f 6e 67 3e 2d 72 65 71 75 69 72 65 3c 2f 73 74  ong>-require</st
1f00: 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f  rong> <em>bool</
1f10: 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20 20 20  em></dt>..      
1f20: 20 20 3c 64 64 3e 52 65 71 75 69 72 65 20 61 20    <dd>Require a 
1f30: 76 61 6c 69 64 20 63 65 72 74 69 66 69 63 61 74  valid certificat
1f40: 65 20 66 72 6f 6d 20 70 65 65 72 20 64 75 72 69  e from peer duri
1f50: 6e 67 20 53 53 4c 0d 0a 20 20 20 20 20 20 20 20  ng SSL..        
1f60: 20 20 20 20 68 61 6e 64 73 68 61 6b 65 2e 20 49      handshake. I
1f70: 66 20 74 68 69 73 20 69 73 20 73 65 74 20 74 6f  f this is set to
1f80: 20 74 72 75 65 20 74 68 65 6e 20 3c 73 74 72 6f   true then <stro
1f90: 6e 67 3e 2d 72 65 71 75 65 73 74 3c 2f 73 74 72  ng>-request</str
1fa0: 6f 6e 67 3e 0d 0a 20 20 20 20 20 20 20 20 20 20  ong>..          
1fb0: 20 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 20 73    must also be s
1fc0: 65 74 20 74 6f 20 74 72 75 65 2e 20 28 3c 73 74  et to true. (<st
1fd0: 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74  rong>default</st
1fe0: 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65  rong>: <em>false
1ff0: 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0d 0a 20 20 20  </em>)</dd>..   
2000: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
2010: 3e 2d 73 65 72 76 65 72 3c 2f 73 74 72 6f 6e 67  >-server</strong
2020: 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c  > <em>bool</em><
2030: 2f 64 74 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64  /dt>..        <d
2040: 64 3e 48 61 6e 64 73 68 61 6b 65 20 61 73 20 73  d>Handshake as s
2050: 65 72 76 65 72 20 69 66 20 74 72 75 65 2c 20 65  erver if true, e
2060: 6c 73 65 20 68 61 6e 64 73 68 61 6b 65 20 61 73  lse handshake as
2070: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 6c  ..            cl
2080: 69 65 6e 74 2e 28 3c 73 74 72 6f 6e 67 3e 64 65  ient.(<strong>de
2090: 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20  fault</strong>: 
20a0: 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 20  <em>false</em>) 
20b0: 3c 65 6d 3e 5b 4e 6f 74 0d 0a 20 20 20 20 20 20  <em>[Not..      
20c0: 20 20 20 20 20 20 61 76 61 69 6c 61 62 6c 65 20        available 
20d0: 74 6f 20 74 6c 73 3a 3a 73 6f 63 6b 65 74 5d 3c  to tls::socket]<
20e0: 2f 65 6d 3e 3c 2f 64 64 3e 0d 0a 20 20 20 20 20  /em></dd>..     
20f0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
2100: 73 73 6c 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  ssl2</strong> <e
2110: 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>bool</em></dt>
2120: 0d 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e  ..        <dd>En
2130: 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20  able use of SSL 
2140: 76 32 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66  v2. (<strong>def
2150: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c  ault</strong>: <
2160: 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 0d 0a 20 20  em>true</em>..  
2170: 20 20 20 20 20 20 20 20 20 20 75 6e 6c 65 73 73            unless
2180: 20 2d 44 4e 4f 5f 50 41 54 45 4e 54 53 20 77 61   -DNO_PATENTS wa
2190: 73 20 73 70 65 63 69 66 69 65 64 20 69 6e 20 62  s specified in b
21a0: 75 69 6c 64 29 3c 2f 64 64 3e 0d 0a 20 20 20 20  uild)</dd>..    
21b0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
21c0: 2d 73 73 6c 33 20 3c 2f 73 74 72 6f 6e 67 3e 3c  -ssl3 </strong><
21d0: 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74  em>bool</em></dt
21e0: 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45  >..        <dd>E
21f0: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c  nable use of SSL
2200: 20 76 33 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65   v3. (<strong>de
2210: 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20  fault</strong>: 
2220: 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f  <em>true</em>)</
2230: 64 64 3e 0d 0a 20 20 20 20 20 20 20 20 3c 64 74  dd>..        <dt
2240: 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31 3c 2f  >-<strong>tls1</
2250: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c  strong> <em>bool
2260: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0d 0a 20 20 20 20  </em></dt>..    
2270: 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75      <dd>Enable u
2280: 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 20 28 3c  se of TLS v1. (<
2290: 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f  strong>default</
22a0: 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c  strong>: <em>fal
22b0: 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0d 0a 20  se</em>)</dd>.. 
22c0: 20 20 20 3c 2f 64 6c 3e 0d 0a 3c 2f 62 6c 6f 63     </dl>..</bloc
22d0: 6b 71 75 6f 74 65 3e 0d 0a 0d 0a 3c 64 6c 3e 0d  kquote>....<dl>.
22e0: 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65  .    <dt><a name
22f0: 3d 22 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 70  ="tls::ciphers p
2300: 72 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65  rotocol ?verbose
2310: 3f 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a  ?"><strong>tls::
2320: 63 69 70 68 65 72 73 3c 2f 73 74 72 6f 6e 67 3e  ciphers</strong>
2330: 0d 0a 20 20 20 20 20 20 20 20 3c 65 6d 3e 70 72  ..        <em>pr
2340: 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f  otocol ?verbose?
2350: 3c 2f 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0d 0a  </em></a></dt>..
2360: 20 20 20 20 3c 64 64 3e 52 65 74 75 72 6e 73 20      <dd>Returns 
2370: 6c 69 73 74 20 6f 66 20 73 75 70 70 6f 72 74 65  list of supporte
2380: 64 20 63 69 70 68 65 72 73 20 62 61 73 65 64 20  d ciphers based 
2390: 6f 6e 20 74 68 65 20 3c 65 6d 3e 70 72 6f 74 6f  on the <em>proto
23a0: 63 6f 6c 3c 2f 65 6d 3e 0d 0a 20 20 20 20 20 20  col</em>..      
23b0: 20 20 79 6f 75 20 73 75 70 70 6c 79 2c 20 77 68    you supply, wh
23c0: 69 63 68 20 6d 75 73 74 20 62 65 20 6f 6e 65 20  ich must be one 
23d0: 6f 66 20 3c 65 6d 3e 73 73 6c 32 2c 20 73 73 6c  of <em>ssl2, ssl
23e0: 33 2c 20 6f 72 20 74 6c 73 31 3c 2f 65 6d 3e 2e  3, or tls1</em>.
23f0: 0d 0a 20 20 20 20 20 20 20 20 49 66 20 3c 65 6d  ..        If <em
2400: 3e 76 65 72 62 6f 73 65 3c 2f 65 6d 3e 20 69 73  >verbose</em> is
2410: 20 73 70 65 63 69 66 69 65 64 20 61 73 20 74 72   specified as tr
2420: 75 65 20 74 68 65 6e 20 61 20 76 65 72 62 6f 73  ue then a verbos
2430: 65 2c 0d 0a 20 20 20 20 20 20 20 20 73 65 6d 69  e,..        semi
2440: 2d 68 75 6d 61 6e 20 72 65 61 64 61 62 6c 65 20  -human readable 
2450: 6c 69 73 74 20 69 73 20 72 65 74 75 72 6e 65 64  list is returned
2460: 20 70 72 6f 76 69 64 69 6e 67 20 61 64 64 69 74   providing addit
2470: 69 6f 6e 61 6c 0d 0a 20 20 20 20 20 20 20 20 69  ional..        i
2480: 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68  nformation on th
2490: 65 20 6e 61 74 75 72 65 20 6f 66 20 74 68 65 20  e nature of the 
24a0: 63 69 70 68 65 72 20 73 75 70 70 6f 72 74 2e 20  cipher support. 
24b0: 49 6e 20 65 61 63 68 0d 0a 20 20 20 20 20 20 20  In each..       
24c0: 20 63 61 73 65 20 74 68 65 20 72 65 73 75 6c 74   case the result
24d0: 20 69 73 20 61 20 54 63 6c 20 6c 69 73 74 2e 3c   is a Tcl list.<
24e0: 2f 64 64 3e 0d 0a 3c 2f 64 6c 3e 0d 0a 0d 0a 3c  /dd>..</dl>....<
24f0: 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 43 4f 4e 46  h3><a name="CONF
2500: 49 47 55 52 41 54 49 4f 4e 20 4f 50 54 49 4f 4e  IGURATION OPTION
2510: 53 22 3e 43 4f 4e 46 49 47 55 52 41 54 49 4f 4e  S">CONFIGURATION
2520: 20 4f 50 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 68 33   OPTIONS</a></h3
2530: 3e 0d 0a 0d 0a 3c 70 3e 49 6e 20 61 64 64 69 74  >....<p>In addit
2540: 69 6f 6e 20 74 6f 20 74 68 65 20 6f 70 74 69 6f  ion to the optio
2550: 6e 73 20 6c 69 73 74 65 64 20 61 62 6f 76 65 20  ns listed above 
2560: 79 6f 75 20 63 61 6e 20 73 65 74 20 74 68 65 20  you can set the 
2570: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62  <strong>tls::deb
2580: 75 67 3c 2f 73 74 72 6f 6e 67 3e 0d 0a 66 6c 61  ug</strong>..fla
2590: 67 20 74 6f 20 61 20 6e 6f 6e 2d 7a 65 72 6f 20  g to a non-zero 
25a0: 76 61 6c 75 65 20 74 6f 20 73 65 65 20 74 68 65  value to see the
25b0: 20 6f 75 74 70 75 74 20 66 72 6f 6d 20 74 68 65   output from the
25c0: 20 64 65 66 61 75 6c 74 0d 0a 63 6f 6d 6d 61 6e   default..comman
25d0: 64 20 63 61 6c 6c 62 61 63 6b 20 28 3c 73 74 72  d callback (<str
25e0: 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 63  ong>tls::callbac
25f0: 6b 3c 2f 73 74 72 6f 6e 67 3e 29 20 77 68 69 63  k</strong>) whic
2600: 68 20 73 68 6f 77 73 20 74 68 65 0d 0a 70 72 6f  h shows the..pro
2610: 67 72 65 73 73 69 6f 6e 20 6f 66 20 74 68 65 20  gression of the 
2620: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 53  SSL handshake. S
2630: 65 74 74 69 6e 67 20 74 68 69 73 20 76 61 6c 75  etting this valu
2640: 65 20 74 6f 20 67 72 65 61 74 65 64 0d 0a 74 68  e to greated..th
2650: 61 6e 20 31 20 77 69 6c 6c 20 63 61 75 73 65 20  an 1 will cause 
2660: 74 68 65 20 64 65 66 61 75 6c 74 20 76 65 72 69  the default veri
2670: 66 79 20 6d 65 74 68 6f 64 20 69 6e 20 3c 73 74  fy method in <st
2680: 72 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61  rong>tls::callba
2690: 63 6b 3c 2f 73 74 72 6f 6e 67 3e 0d 0a 74 6f 20  ck</strong>..to 
26a0: 61 6c 77 61 79 73 20 61 63 63 65 70 74 20 74 68  always accept th
26b0: 65 20 63 65 72 74 69 66 69 63 61 74 65 2c 20 65  e certificate, e
26c0: 76 65 6e 20 69 66 20 69 74 20 69 73 20 69 6e 76  ven if it is inv
26d0: 61 6c 69 64 2e 3c 2f 70 3e 0d 0a 0d 0a 3c 70 3e  alid.</p>....<p>
26e0: 49 6e 20 61 20 72 65 61 6c 2d 77 6f 72 6c 64 20  In a real-world 
26f0: 64 65 70 6c 6f 79 6d 65 6e 74 20 79 6f 75 20 73  deployment you s
2700: 68 6f 75 6c 64 20 73 75 62 73 74 69 74 75 74 65  hould substitute
2710: 20 79 6f 75 72 20 6f 77 6e 0d 0a 63 61 6c 6c 62   your own..callb
2720: 61 63 6b 20 69 6e 20 70 6c 61 63 65 20 6f 66 20  ack in place of 
2730: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c  <strong>tls::cal
2740: 6c 62 61 63 6b 3c 2f 73 74 72 6f 6e 67 3e 2c 20  lback</strong>, 
2750: 76 69 61 20 74 68 65 20 3c 65 6d 3e 2d 63 6f 6d  via the <em>-com
2760: 6d 61 6e 64 0d 0a 3c 2f 65 6d 3e 6f 70 74 69 6f  mand..</em>optio
2770: 6e 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 74 6c 73  n to <strong>tls
2780: 3a 3a 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67  ::socket</strong
2790: 3e 20 6f 72 20 3c 73 74 72 6f 6e 67 3e 74 6c 73  > or <strong>tls
27a0: 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67  ::import</strong
27b0: 3e 2e 3c 2f 70 3e 0d 0a 0d 0a 3c 70 3e 57 68 65  >.</p>....<p>Whe
27c0: 6e 20 74 68 65 20 54 4c 53 20 6c 61 79 65 72 20  n the TLS layer 
27d0: 6e 65 65 64 73 20 74 6f 20 6f 62 74 61 69 6e 20  needs to obtain 
27e0: 61 20 70 61 73 73 77 6f 72 64 2c 20 74 79 70 69  a password, typi
27f0: 63 61 6c 6c 79 20 66 6f 72 20 61 0d 0a 63 65 72  cally for a..cer
2800: 74 69 66 69 63 61 74 65 2c 20 74 68 65 20 73 6f  tificate, the so
2810: 66 74 77 61 72 65 20 77 69 6c 6c 20 69 6e 76 6f  ftware will invo
2820: 6b 65 20 61 20 54 63 6c 20 63 6f 6d 6d 61 6e 64  ke a Tcl command
2830: 20 63 61 6c 6c 65 64 20 3c 73 74 72 6f 6e 67 3e   called <strong>
2840: 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73  tls::password</s
2850: 74 72 6f 6e 67 3e 2c 0d 0a 77 68 69 63 68 20 73  trong>,..which s
2860: 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 20 73  hould return a s
2870: 74 72 69 6e 67 20 77 68 69 63 68 20 72 65 70 72  tring which repr
2880: 65 73 65 6e 74 73 20 74 68 65 20 70 61 73 73 77  esents the passw
2890: 6f 72 64 20 74 6f 20 62 65 0d 0a 75 73 65 64 2e  ord to be..used.
28a0: 20 41 20 64 65 66 61 75 6c 74 20 69 6d 70 6c 65   A default imple
28b0: 6d 65 6e 74 61 74 69 6f 6e 20 69 73 20 70 72 6f  mentation is pro
28c0: 76 69 64 65 64 2c 20 77 68 69 63 68 20 73 69 6d  vided, which sim
28d0: 70 6c 79 20 72 65 74 75 72 6e 73 3c 65 6d 3e 0d  ply returns<em>.
28e0: 0a 26 71 75 6f 74 3b 73 65 63 72 65 74 26 71 75  .&quot;secret&qu
28f0: 6f 74 3b 3c 2f 65 6d 3e 20 2d 20 79 6f 75 20 73  ot;</em> - you s
2900: 68 6f 75 6c 64 20 72 65 64 65 66 69 6e 65 20 74  hould redefine t
2910: 68 69 73 20 70 72 6f 63 65 64 75 72 65 0d 0a 61  his procedure..a
2920: 66 74 65 72 20 69 73 73 75 69 6e 67 20 74 68 65  fter issuing the
2930: 20 3c 65 6d 3e 70 61 63 6b 61 67 65 20 72 65 71   <em>package req
2940: 75 69 72 65 20 74 6c 73 3c 2f 65 6d 3e 2e 3c 2f  uire tls</em>.</
2950: 70 3e 0d 0a 0d 0a 3c 68 33 3e 3c 61 20 6e 61 6d  p>....<h3><a nam
2960: 65 3d 22 48 54 54 50 53 20 45 58 41 4d 50 4c 45  e="HTTPS EXAMPLE
2970: 22 3e 48 54 54 50 53 20 45 58 41 4d 50 4c 45 3c  ">HTTPS EXAMPLE<
2980: 2f 61 3e 3c 2f 68 33 3e 0d 0a 0d 0a 3c 70 3e 54  /a></h3>....<p>T
2990: 68 69 73 20 65 78 61 6d 70 6c 65 20 72 65 71 75  his example requ
29a0: 69 72 65 73 20 61 20 70 61 74 63 68 20 74 6f 20  ires a patch to 
29b0: 74 68 65 20 3c 73 74 72 6f 6e 67 3e 68 74 74 70  the <strong>http
29c0: 3c 2f 73 74 72 6f 6e 67 3e 0d 0a 6d 6f 64 75 6c  </strong>..modul
29d0: 65 20 74 68 61 74 20 73 68 69 70 73 20 77 69 74  e that ships wit
29e0: 68 20 54 63 6c 20 2d 20 74 68 69 73 20 70 61 74  h Tcl - this pat
29f0: 63 68 20 68 61 73 20 62 65 65 6e 20 73 75 62 6d  ch has been subm
2a00: 69 74 74 65 64 20 66 6f 72 0d 0a 69 6e 63 6c 75  itted for..inclu
2a10: 73 69 6f 6e 20 69 6e 20 54 63 6c 20 38 2e 32 2e  sion in Tcl 8.2.
2a20: 31 2c 20 62 75 74 20 69 73 20 61 6c 73 6f 20 70  1, but is also p
2a30: 72 6f 76 69 64 65 64 20 69 6e 20 74 68 65 20 74  rovided in the t
2a40: 6c 73 20 64 69 72 65 63 74 6f 72 79 0d 0a 69 66  ls directory..if
2a50: 20 6e 65 65 64 65 64 2e 20 41 20 73 61 6d 70 6c   needed. A sampl
2a60: 65 20 73 65 72 76 65 72 2e 70 65 6d 20 69 73 20  e server.pem is 
2a70: 70 72 6f 76 69 64 65 64 20 77 69 74 68 20 74 68  provided with th
2a80: 65 20 54 4c 53 20 72 65 6c 65 61 73 65 2c 0d 0a  e TLS release,..
2a90: 63 6f 75 72 74 65 73 79 20 6f 66 20 74 68 65 20  courtesy of the 
2aa0: 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c  <strong>OpenSSL<
2ab0: 2f 73 74 72 6f 6e 67 3e 20 70 72 6f 6a 65 63 74  /strong> project
2ac0: 2e 3c 2f 70 3e 0d 0a 0d 0a 3c 70 72 65 3e 3c 63  .</p>....<pre><c
2ad0: 6f 64 65 3e 70 61 63 6b 61 67 65 20 72 65 71 75  ode>package requ
2ae0: 69 72 65 20 68 74 74 70 0d 0a 70 61 63 6b 61 67  ire http..packag
2af0: 65 20 72 65 71 75 69 72 65 20 74 6c 73 0d 0a 0d  e require tls...
2b00: 0a 68 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20  .http::register 
2b10: 68 74 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20  https 443 [list 
2b20: 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 72  ::tls::socket -r
2b30: 65 71 75 69 72 65 20 31 20 2d 63 61 66 69 6c 65  equire 1 -cafile
2b40: 20 2e 2f 73 65 72 76 65 72 2e 70 65 6d 5d 0d 0a   ./server.pem]..
2b50: 0d 0a 73 65 74 20 74 6f 6b 20 5b 68 74 74 70 3a  ..set tok [http:
2b60: 3a 67 65 74 75 72 6c 20 68 74 74 70 73 3a 2f 2f  :geturl https://
2b70: 64 65 76 65 6c 6f 70 65 72 2e 6e 65 74 73 63 61  developer.netsca
2b80: 70 65 2e 63 6f 6d 2f 5d 0d 0a 3c 2f 63 6f 64 65  pe.com/]..</code
2b90: 3e 3c 2f 70 72 65 3e 0d 0a 0d 0a 3c 68 33 3e 3c  ></pre>....<h3><
2ba0: 61 20 6e 61 6d 65 3d 22 53 50 45 43 49 41 4c 20  a name="SPECIAL 
2bb0: 43 4f 4e 53 49 44 45 52 41 54 49 4f 4e 53 22 3e  CONSIDERATIONS">
2bc0: 53 50 45 43 49 41 4c 20 43 4f 4e 53 49 44 45 52  SPECIAL CONSIDER
2bd0: 41 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 68 33 3e 0d  ATIONS</a></h3>.
2be0: 0a 0d 0a 3c 70 3e 54 68 65 20 63 61 70 61 62 69  ...<p>The capabi
2bf0: 6c 69 74 69 65 73 20 6f 66 20 74 68 69 73 20 70  lities of this p
2c00: 61 63 6b 61 67 65 20 63 61 6e 20 76 61 72 79 20  ackage can vary 
2c10: 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61 73 65 64  enormously based
2c20: 0d 0a 75 70 6f 6e 20 68 6f 77 20 79 6f 75 72 20  ..upon how your 
2c30: 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 20  OpenSSL library 
2c40: 77 61 73 20 63 6f 6e 66 69 67 75 72 65 64 20 61  was configured a
2c50: 6e 64 20 62 75 69 6c 74 2e 20 41 74 20 74 68 65  nd built. At the
2c60: 0d 0a 6d 6f 73 74 20 6d 61 63 72 6f 2d 6c 65 76  ..most macro-lev
2c70: 65 6c 20 4f 70 65 6e 53 53 4c 20 73 75 70 70 6f  el OpenSSL suppo
2c80: 72 74 73 20 61 20 26 71 75 6f 74 3b 6e 6f 20 70  rts a &quot;no p
2c90: 61 74 65 6e 74 73 26 71 75 6f 74 3b 20 62 75 69  atents&quot; bui
2ca0: 6c 64 2c 0d 0a 77 68 69 63 68 20 64 69 73 61 62  ld,..which disab
2cb0: 6c 65 73 20 52 53 41 2c 20 49 44 45 41 2c 20 52  les RSA, IDEA, R
2cc0: 43 28 32 2c 34 2c 35 29 20 61 6e 64 20 53 53 4c  C(2,4,5) and SSL
2cd0: 32 20 2d 20 69 66 20 79 6f 75 72 20 4f 70 65 6e  2 - if your Open
2ce0: 53 53 4c 20 69 73 0d 0a 63 6f 6e 66 69 67 75 72  SSL is..configur
2cf0: 65 64 20 74 68 69 73 20 77 61 79 20 74 68 65 6e  ed this way then
2d00: 20 79 6f 75 20 77 69 6c 6c 20 6e 65 65 64 20 74   you will need t
2d10: 6f 20 62 75 69 6c 64 20 54 4c 53 20 77 69 74 68  o build TLS with
2d20: 20 74 68 65 0d 0a 2d 44 4e 4f 5f 50 41 54 45 4e   the..-DNO_PATEN
2d30: 54 53 20 6f 70 74 69 6f 6e 20 2d 20 61 6e 64 20  TS option - and 
2d40: 74 68 65 20 72 65 73 75 6c 74 61 6e 74 20 6d 6f  the resultant mo
2d50: 64 75 6c 65 20 77 69 6c 6c 20 66 75 6e 63 74 69  dule will functi
2d60: 6f 6e 0d 0a 63 6f 72 72 65 63 74 6c 79 20 61 6e  on..correctly an
2d70: 64 20 61 6c 73 6f 20 73 75 70 70 6f 72 74 20 41  d also support A
2d80: 44 48 20 63 65 72 74 69 66 69 63 61 74 65 2d 6c  DH certificate-l
2d90: 65 73 73 20 65 6e 63 72 79 70 74 69 6f 6e 2c 0d  ess encryption,.
2da0: 0a 68 6f 77 65 76 65 72 20 79 6f 75 20 77 69 6c  .however you wil
2db0: 6c 20 62 65 20 75 6e 61 62 6c 65 20 74 6f 20 75  l be unable to u
2dc0: 74 69 6c 69 7a 65 20 74 68 69 73 20 74 6f 20 73  tilize this to s
2dd0: 70 65 61 6b 20 74 6f 20 6e 6f 72 6d 61 6c 20 57  peak to normal W
2de0: 65 62 0d 0a 53 65 72 76 65 72 73 2c 20 77 68 69  eb..Servers, whi
2df0: 63 68 20 74 79 70 69 63 61 6c 6c 79 20 72 65 71  ch typically req
2e00: 75 69 72 65 20 52 53 41 20 73 75 70 70 6f 72 74  uire RSA support
2e10: 2e 20 50 6c 65 61 73 65 20 73 65 65 20 3c 61 0d  . Please see <a.
2e20: 0a 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77  .href="http://ww
2e30: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e  w.openssl.org/">
2e40: 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73  http://www.opens
2e50: 73 6c 2e 6f 72 67 2f 3c 2f 61 3e 20 66 6f 72 0d  sl.org/</a> for.
2e60: 0a 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f  .more informatio
2e70: 6e 20 6f 6e 20 74 68 65 20 77 68 6f 6c 65 20 69  n on the whole i
2e80: 73 73 75 65 20 6f 66 20 70 61 74 65 6e 74 73 20  ssue of patents 
2e90: 61 6e 64 20 55 53 20 65 78 70 6f 72 74 0d 0a 72  and US export..r
2ea0: 65 73 74 72 69 63 74 69 6f 6e 73 2e 20 3c 2f 70  estrictions. </p
2eb0: 3e 0d 0a 0d 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65  >....<h3><a name
2ec0: 3d 22 53 45 45 20 41 4c 53 4f 22 3e 53 45 45 20  ="SEE ALSO">SEE 
2ed0: 41 4c 53 4f 3c 2f 61 3e 3c 2f 68 33 3e 0d 0a 0d  ALSO</a></h3>...
2ee0: 0a 3c 70 3e 3c 73 74 72 6f 6e 67 3e 73 6f 63 6b  .<p><strong>sock
2ef0: 65 74 3c 2f 73 74 72 6f 6e 67 3e 2c 20 3c 73 74  et</strong>, <st
2f00: 72 6f 6e 67 3e 66 69 6c 65 65 76 65 6e 74 2c 20  rong>fileevent, 
2f10: 3c 2f 73 74 72 6f 6e 67 3e 3c 61 0d 0a 68 72 65  </strong><a..hre
2f20: 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70  f="http://www.op
2f30: 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 3c 73 74 72  enssl.org/"><str
2f40: 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72  ong>OpenSSL</str
2f50: 6f 6e 67 3e 3c 2f 61 3e 3c 2f 70 3e 0d 0a 0d 0a  ong></a></p>....
2f60: 3c 68 72 3e 0d 0a 0d 0a 3c 70 72 65 3e 0d 0a 43  <hr>....<pre>..C
2f70: 6f 70 79 72 69 67 68 74 20 a9 20 31 39 39 39 20  opyright © 1999 
2f80: 4d 61 74 74 20 4e 65 77 6d 61 6e 2e 3c 2f 70 72  Matt Newman.</pr
2f90: 65 3e 0d 0a 3c 2f 62 6f 64 79 3e 0d 0a 3c 2f 68  e>..</body>..</h
2fa0: 74 6d 6c 3e 0d 0a                                tml>..