Hex Artifact Content

Artifact a18669097e5e25bb4a0d90ee550baf7dabf29605df95ab829ddb61e38e046778:


0000: 3c 21 64 6f 63 74 79 70 65 20 68 74 6d 6c 20 70  <!doctype html p
0010: 75 62 6c 69 63 20 22 2d 2f 2f 57 33 43 2f 2f 44  ublic "-//W3C//D
0020: 54 44 20 48 54 4d 4c 20 34 2e 30 20 54 72 61 6e  TD HTML 4.0 Tran
0030: 73 69 74 69 6f 6e 61 6c 2f 2f 45 4e 22 3e 20 0a  sitional//EN"> .
0040: 0a 3c 68 74 6d 6c 3e 0a 0a 3c 68 65 61 64 3e 0a  .<html>..<head>.
0050: 3c 6d 65 74 61 20 68 74 74 70 2d 65 71 75 69 76  <meta http-equiv
0060: 3d 22 43 6f 6e 74 65 6e 74 2d 54 79 70 65 22 0a  ="Content-Type".
0070: 63 6f 6e 74 65 6e 74 3d 22 74 65 78 74 2f 68 74  content="text/ht
0080: 6d 6c 3b 20 63 68 61 72 73 65 74 3d 69 73 6f 2d  ml; charset=iso-
0090: 38 38 35 39 2d 31 22 3e 0a 3c 6d 65 74 61 20 6e  8859-1">.<meta n
00a0: 61 6d 65 3d 22 43 6f 70 79 72 69 67 68 74 22 20  ame="Copyright" 
00b0: 63 6f 6e 74 65 6e 74 3d 22 31 39 39 39 20 4d 61  content="1999 Ma
00c0: 74 74 20 4e 65 77 6d 61 6e 20 2f 20 32 30 30 34  tt Newman / 2004
00d0: 20 53 74 61 72 66 69 73 68 20 53 79 73 74 65 6d   Starfish System
00e0: 73 22 3e 0a 3c 74 69 74 6c 65 3e 54 4c 53 20 28  s">.<title>TLS (
00f0: 53 53 4c 29 20 54 63 6c 20 43 6f 6d 6d 61 6e 64  SSL) Tcl Command
0100: 73 3c 2f 74 69 74 6c 65 3e 0a 3c 2f 68 65 61 64  s</title>.</head
0110: 3e 0a 0a 3c 62 6f 64 79 20 62 67 63 6f 6c 6f 72  >..<body bgcolor
0120: 3d 22 23 46 46 46 46 46 46 22 3e 0a 0a 3c 64 6c  ="#FFFFFF">..<dl
0130: 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65  >.    <dd><a hre
0140: 66 3d 22 23 4e 41 4d 45 22 3e 4e 41 4d 45 3c 2f  f="#NAME">NAME</
0150: 61 3e 20 3c 64 6c 3e 0a 20 20 20 20 20 20 20 20  a> <dl>.        
0160: 20 20 20 20 3c 64 64 3e 3c 73 74 72 6f 6e 67 3e      <dd><strong>
0170: 74 6c 73 3c 2f 73 74 72 6f 6e 67 3e 20 2d 20 62  tls</strong> - b
0180: 69 6e 64 69 6e 67 20 74 6f 20 3c 73 74 72 6f 6e  inding to <stron
0190: 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e  g>OpenSSL</stron
01a0: 67 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  g>.             
01b0: 20 20 20 74 6f 6f 6c 6b 69 74 2e 3c 2f 64 64 3e     toolkit.</dd>
01c0: 0a 20 20 20 20 20 20 20 20 3c 2f 64 6c 3e 0a 20  .        </dl>. 
01d0: 20 20 20 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64     </dd>.    <dd
01e0: 3e 3c 61 20 68 72 65 66 3d 22 23 53 59 4e 4f 50  ><a href="#SYNOP
01f0: 53 49 53 22 3e 53 59 4e 4f 50 53 49 53 3c 2f 61  SIS">SYNOPSIS</a
0200: 3e 20 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e  > </dd>.    <dd>
0210: 3c 64 6c 3e 0a 20 20 20 20 20 20 20 20 20 20 20  <dl>.           
0220: 20 3c 64 64 3e 3c 62 3e 70 61 63 6b 61 67 65 20   <dd><b>package 
0230: 72 65 71 75 69 72 65 20 54 63 6c 20 3c 2f 62 3e  require Tcl </b>
0240: 3c 65 6d 3e 3f 38 2e 34 3f 3c 2f 65 6d 3e 3c 2f  <em>?8.4?</em></
0250: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dd>.            
0260: 3c 64 64 3e 3c 62 3e 70 61 63 6b 61 67 65 20 72  <dd><b>package r
0270: 65 71 75 69 72 65 20 74 6c 73 20 3c 2f 62 3e 3c  equire tls </b><
0280: 65 6d 3e 3f 40 40 56 45 52 53 40 40 3f 3c 2f 65  em>?@@VERS@@?</e
0290: 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  m></dd>.        
02a0: 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f      <dt>&nbsp;</
02b0: 64 74 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dt>.            
02c0: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74  <dd><b>tls::init
02d0: 20 3c 2f 62 3e 3c 69 3e 3f 6f 70 74 69 6f 6e 73   </b><i>?options
02e0: 3f 3c 2f 69 3e 20 3c 2f 64 64 3e 0a 20 20 20 20  ?</i> </dd>.    
02f0: 20 20 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74          <dd><b>t
0300: 6c 73 3a 3a 73 6f 63 6b 65 74 20 3c 2f 62 3e 3c  ls::socket </b><
0310: 65 6d 3e 3f 6f 70 74 69 6f 6e 73 3f 20 68 6f 73  em>?options? hos
0320: 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64 64 3e  t port</em></dd>
0330: 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 64 64  .            <dd
0340: 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c  ><b>tls::socket<
0350: 2f 62 3e 3c 65 6d 3e 20 3f 2d 73 65 72 76 65 72  /b><em> ?-server
0360: 20 63 6f 6d 6d 61 6e 64 3f 0a 20 20 20 20 20 20   command?.      
0370: 20 20 20 20 20 20 20 20 20 20 3f 6f 70 74 69 6f            ?optio
0380: 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64  ns? port</em></d
0390: 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c  d>.            <
03a0: 64 64 3e 3c 62 3e 74 6c 73 3a 3a 68 61 6e 64 73  dd><b>tls::hands
03b0: 68 61 6b 65 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61  hake</b><em> cha
03c0: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20  nnel</em></dd>. 
03d0: 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c             <dd><
03e0: 62 3e 74 6c 73 3a 3a 73 74 61 74 75 73 20 3c 2f  b>tls::status </
03f0: 62 3e 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f 20 63  b><em>?-local? c
0400: 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e  hannel</em></dd>
0410: 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 64 64  .            <dd
0420: 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c  ><b>tls::import<
0430: 2f 62 3e 3c 65 6d 3e 20 63 68 61 6e 6e 65 6c 20  /b><em> channel 
0440: 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 65 6d 3e 3c 2f  ?options?</em></
0450: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dd>.            
0460: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 75 6e 69 6d  <dd><b>tls::unim
0470: 70 6f 72 74 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61  port</b><em> cha
0480: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20  nnel</em></dd>. 
0490: 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c             <dd><
04a0: 62 3e 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 3c  b>tls::ciphers <
04b0: 2f 62 3e 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20  /b><em>protocol 
04c0: 3f 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f  ?verbose?</em></
04d0: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dd>.            
04e0: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 76 65 72 73  <dd><b>tls::vers
04f0: 69 6f 6e 3c 2f 62 3e 3c 2f 64 64 3e 0a 20 20 20  ion</b></dd>.   
0500: 20 20 20 20 20 3c 2f 64 6c 3e 0a 20 20 20 20 3c       </dl>.    <
0510: 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20  /dd>.    <dd><a 
0520: 68 72 65 66 3d 22 23 43 4f 4d 4d 41 4e 44 53 22  href="#COMMANDS"
0530: 3e 43 4f 4d 4d 41 4e 44 53 3c 2f 61 3e 3c 2f 64  >COMMANDS</a></d
0540: 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72  d>.    <dd><a hr
0550: 65 66 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50  ef="#CALLBACK OP
0560: 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20  TIONS">CALLBACK 
0570: 4f 50 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 64 64 3e  OPTIONS</a></dd>
0580: 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 66  .    <dd><a href
0590: 3d 22 23 48 54 54 50 53 20 45 58 41 4d 50 4c 45  ="#HTTPS EXAMPLE
05a0: 22 3e 48 54 54 50 53 20 45 58 41 4d 50 4c 45 3c  ">HTTPS EXAMPLE<
05b0: 2f 61 3e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64  /a></dd>.    <dd
05c0: 3e 3c 61 20 68 72 65 66 3d 22 23 53 45 45 20 41  ><a href="#SEE A
05d0: 4c 53 4f 22 3e 53 50 45 43 49 41 4c 20 43 4f 4e  LSO">SPECIAL CON
05e0: 53 49 44 45 52 41 54 49 4f 4e 53 3c 2f 61 3e 3c  SIDERATIONS</a><
05f0: 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20  /dd>.    <dd><a 
0600: 68 72 65 66 3d 22 23 53 45 45 20 41 4c 53 4f 22  href="#SEE ALSO"
0610: 3e 53 45 45 20 41 4c 53 4f 3c 2f 61 3e 3c 2f 64  >SEE ALSO</a></d
0620: 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 68 72 3e 0a 0a  d>.</dl>..<hr>..
0630: 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 4e 41 4d  <h3><a name="NAM
0640: 45 22 3e 4e 41 4d 45 3c 2f 61 3e 3c 2f 68 33 3e  E">NAME</a></h3>
0650: 0a 0a 3c 70 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73  ..<p><strong>tls
0660: 3c 2f 73 74 72 6f 6e 67 3e 20 2d 20 62 69 6e 64  </strong> - bind
0670: 69 6e 67 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 4f  ing to <strong>O
0680: 70 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e 67 3e 0a  penSSL</strong>.
0690: 74 6f 6f 6c 6b 69 74 2e 3c 2f 70 3e 0a 0a 3c 68  toolkit.</p>..<h
06a0: 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 59 4e 4f 50  3><a name="SYNOP
06b0: 53 49 53 22 3e 53 59 4e 4f 50 53 49 53 3c 2f 61  SIS">SYNOPSIS</a
06c0: 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 3c 62 3e 70 61  ></h3>..<p><b>pa
06d0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63  ckage require Tc
06e0: 6c 20 38 2e 34 3c 2f 62 3e 3c 62 72 3e 0a 3c 62  l 8.4</b><br>.<b
06f0: 3e 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  >package require
0700: 20 74 6c 73 20 40 40 56 45 52 53 40 40 3c 2f 62   tls @@VERS@@</b
0710: 3e 3c 62 72 3e 0a 3c 62 72 3e 0a 3c 61 20 68 72  ><br>.<br>.<a hr
0720: 65 66 3d 22 23 74 6c 73 3a 3a 69 6e 69 74 22 3e  ef="#tls::init">
0730: 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74 20 3c 2f 62  <b>tls::init </b
0740: 3e 3c 69 3e 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 69  ><i>?options?</i
0750: 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65  ><br>.</a><a hre
0760: 66 3d 22 23 74 6c 73 3a 3a 73 6f 63 6b 65 74 22  f="#tls::socket"
0770: 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 20  ><b>tls::socket 
0780: 3c 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 69 6f 6e 73  </b><em>?options
0790: 3f 20 68 6f 73 74 0a 70 6f 72 74 3c 2f 65 6d 3e  ? host.port</em>
07a0: 3c 62 72 3e 0a 3c 62 3e 74 6c 73 3a 3a 73 6f 63  <br>.<b>tls::soc
07b0: 6b 65 74 3c 2f 62 3e 3c 65 6d 3e 20 3f 2d 73 65  ket</b><em> ?-se
07c0: 72 76 65 72 20 63 6f 6d 6d 61 6e 64 3f 20 3f 6f  rver command? ?o
07d0: 70 74 69 6f 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d  ptions? port</em
07e0: 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65  ><br>.</a><a hre
07f0: 66 3d 22 23 74 6c 73 3a 3a 73 74 61 74 75 73 22  f="#tls::status"
0800: 3e 3c 62 3e 74 6c 73 3a 3a 73 74 61 74 75 73 20  ><b>tls::status 
0810: 3c 2f 62 3e 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f  </b><em>?-local?
0820: 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 62 72   channel</em><br
0830: 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65 66 3d 22 23  >.</a><a href="#
0840: 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 22 3e  tls::handshake">
0850: 3c 62 3e 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b  <b>tls::handshak
0860: 65 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61 6e 6e 65  e</b><em> channe
0870: 6c 3c 2f 65 6d 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c  l</em></a><br>.<
0880: 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c  br>.<a href="#tl
0890: 73 3a 3a 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c  s::import"><b>tl
08a0: 73 3a 3a 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69  s::import </b><i
08b0: 3e 63 68 61 6e 6e 65 6c 20 3f 6f 70 74 69 6f 6e  >channel ?option
08c0: 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c  s?</i></a><br>.<
08d0: 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 75 6e  a href="#tls::un
08e0: 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a  import"><b>tls::
08f0: 75 6e 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e  unimport </b><i>
0900: 63 68 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61 3e 3c  channel</i></a><
0910: 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c  br>.<a href="#tl
0920: 73 3a 3a 63 69 70 68 65 72 73 20 70 72 6f 74 6f  s::ciphers proto
0930: 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 22 3e 3c  col ?verbose?"><
0940: 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 69 70 68  strong>tls::ciph
0950: 65 72 73 3c 2f 73 74 72 6f 6e 67 3e 0a 3c 65 6d  ers</strong>.<em
0960: 3e 70 72 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f  >protocol ?verbo
0970: 73 65 3f 3c 2f 65 6d 3e 3c 2f 61 3e 3c 62 72 3e  se?</em></a><br>
0980: 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a  .<a href="#tls::
0990: 76 65 72 73 69 6f 6e 22 3e 3c 62 3e 74 6c 73 3a  version"><b>tls:
09a0: 3a 76 65 72 73 69 6f 6e 3c 2f 62 3e 3c 2f 61 3e  :version</b></a>
09b0: 0a 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61  .</p>..<h3><a na
09c0: 6d 65 3d 22 44 45 53 43 52 49 50 54 49 4f 4e 22  me="DESCRIPTION"
09d0: 3e 44 45 53 43 52 49 50 54 49 4f 4e 3c 2f 61 3e  >DESCRIPTION</a>
09e0: 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 69 73 20 65  </h3>..<p>This e
09f0: 78 74 65 6e 73 69 6f 6e 20 70 72 6f 76 69 64 65  xtension provide
0a00: 73 20 61 20 67 65 6e 65 72 69 63 20 62 69 6e 64  s a generic bind
0a10: 69 6e 67 20 74 6f 20 3c 61 0a 68 72 65 66 3d 22  ing to <a.href="
0a20: 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73  http://www.opens
0a30: 73 6c 2e 6f 72 67 2f 22 3e 4f 70 65 6e 53 53 4c  sl.org/">OpenSSL
0a40: 3c 2f 61 3e 2c 20 75 74 69 6c 69 7a 69 6e 67 20  </a>, utilizing 
0a50: 74 68 65 0a 3c 73 74 72 6f 6e 67 3e 54 63 6c 5f  the.<strong>Tcl_
0a60: 53 74 61 63 6b 43 68 61 6e 6e 65 6c 3c 2f 73 74  StackChannel</st
0a70: 72 6f 6e 67 3e 0a 41 50 49 20 66 6f 72 20 54 63  rong>.API for Tc
0a80: 6c 20 38 2e 32 20 61 6e 64 20 68 69 67 68 65 72  l 8.2 and higher
0a90: 2e 20 54 68 65 20 73 6f 63 6b 65 74 73 20 62 65  . The sockets be
0aa0: 68 61 76 65 20 65 78 61 63 74 6c 79 20 74 68 65  have exactly the
0ab0: 20 73 61 6d 65 0a 61 73 20 63 68 61 6e 6e 65 6c   same.as channel
0ac0: 73 20 63 72 65 61 74 65 64 20 75 73 69 6e 67 20  s created using 
0ad0: 54 63 6c 27 73 20 62 75 69 6c 74 2d 69 6e 20 3c  Tcl's built-in <
0ae0: 73 74 72 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73  strong>socket</s
0af0: 74 72 6f 6e 67 3e 0a 63 6f 6d 6d 61 6e 64 20 77  trong>.command w
0b00: 69 74 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f  ith additional o
0b10: 70 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6e 74 72  ptions for contr
0b20: 6f 6c 6c 69 6e 67 20 74 68 65 20 53 53 4c 20 73  olling the SSL s
0b30: 65 73 73 69 6f 6e 2e 0a 54 6f 20 75 73 65 20 54  ession..To use T
0b40: 4c 53 20 77 69 74 68 20 61 6e 20 65 61 72 6c 69  LS with an earli
0b50: 65 72 20 76 65 72 73 69 6f 6e 20 6f 66 20 54 63  er version of Tc
0b60: 6c 20 74 68 61 6e 20 38 2e 34 2c 20 70 6c 65 61  l than 8.4, plea
0b70: 73 65 20 6f 62 74 61 69 6e 0a 54 4c 53 20 31 2e  se obtain.TLS 1.
0b80: 33 2e 0a 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20  3..</p>..<h3><a 
0b90: 6e 61 6d 65 3d 22 43 4f 4d 4d 41 4e 44 53 22 3e  name="COMMANDS">
0ba0: 43 4f 4d 4d 41 4e 44 53 3c 2f 61 3e 3c 2f 68 33  COMMANDS</a></h3
0bb0: 3e 0a 0a 3c 70 3e 54 79 70 69 63 61 6c 6c 79 20  >..<p>Typically 
0bc0: 6f 6e 65 20 77 6f 75 6c 64 20 75 73 65 20 74 68  one would use th
0bd0: 65 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  e <strong>tls::s
0be0: 6f 63 6b 65 74 20 3c 2f 73 74 72 6f 6e 67 3e 63  ocket </strong>c
0bf0: 6f 6d 6d 61 6e 64 0a 77 68 69 63 68 20 70 72 6f  ommand.which pro
0c00: 76 69 64 65 73 20 63 6f 6d 70 61 74 69 62 69 6c  vides compatibil
0c10: 69 74 79 20 77 69 74 68 20 74 68 65 20 6e 61 74  ity with the nat
0c20: 69 76 65 20 54 63 6c 20 3c 73 74 72 6f 6e 67 3e  ive Tcl <strong>
0c30: 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 0a  socket</strong>.
0c40: 63 6f 6d 6d 61 6e 64 2e 20 49 6e 20 73 75 63 68  command. In such
0c50: 20 63 61 73 65 73 20 3c 73 74 72 6f 6e 67 3e 74   cases <strong>t
0c60: 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f  ls::import</stro
0c70: 6e 67 3e 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62  ng> should not b
0c80: 65 0a 75 73 65 64 20 64 69 72 65 63 74 6c 79 2e  e.used directly.
0c90: 3c 2f 70 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c  </p>..<dl>.    <
0ca0: 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a  dt><a name="tls:
0cb0: 3a 69 6e 69 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69  :init"><b>tls::i
0cc0: 6e 69 74 20 3c 2f 62 3e 3c 69 3e 3f 6f 70 74 69  nit </b><i>?opti
0cd0: 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64 74  ons?</i></a></dt
0ce0: 3e 0a 20 20 20 20 3c 64 64 3e 54 68 69 73 20 72  >.    <dd>This r
0cf0: 6f 75 74 69 6e 65 20 73 65 74 73 20 74 68 65 20  outine sets the 
0d00: 64 65 66 61 75 6c 74 20 6f 70 74 69 6f 6e 73 20  default options 
0d10: 75 73 65 64 20 62 79 20 3c 73 74 72 6f 6e 67 3e  used by <strong>
0d20: 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f 73 74 72  tls::socket</str
0d30: 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20 61 6e 64  ong>.        and
0d40: 20 69 73 20 3c 65 6d 3e 6f 70 74 69 6f 6e 61 6c   is <em>optional
0d50: 3c 2f 65 6d 3e 2e 20 49 66 20 79 6f 75 20 63 61  </em>. If you ca
0d60: 6c 6c 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a  ll <strong>tls::
0d70: 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 0a  import</strong>.
0d80: 20 20 20 20 20 20 20 20 64 69 72 65 63 74 6c 79          directly
0d90: 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 68 61   this routine ha
0da0: 73 20 6e 6f 20 65 66 66 65 63 74 2e 20 41 6e 79  s no effect. Any
0db0: 20 6f 66 20 74 68 65 20 6f 70 74 69 6f 6e 73 0a   of the options.
0dc0: 20 20 20 20 20 20 20 20 74 68 61 74 20 3c 73 74          that <st
0dd0: 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74  rong>tls::socket
0de0: 3c 2f 73 74 72 6f 6e 67 3e 20 61 63 63 65 70 74  </strong> accept
0df0: 73 20 63 61 6e 20 62 65 20 73 65 74 0a 20 20 20  s can be set.   
0e00: 20 20 20 20 20 75 73 69 6e 67 20 74 68 69 73 20       using this 
0e10: 63 6f 6d 6d 61 6e 64 2c 20 74 68 6f 75 67 68 20  command, though 
0e20: 79 6f 75 20 73 68 6f 75 6c 64 20 6c 69 6d 69 74  you should limit
0e30: 20 79 6f 75 72 20 6f 70 74 69 6f 6e 73 0a 20 20   your options.  
0e40: 20 20 20 20 20 20 74 6f 20 6f 6e 6c 79 20 54 4c        to only TL
0e50: 53 20 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 3c  S related ones.<
0e60: 2f 64 64 3e 0a 20 20 20 20 3c 64 74 3e 26 6e 62  /dd>.    <dt>&nb
0e70: 73 70 3b 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74  sp;</dt>.    <dt
0e80: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 73  ><a name="tls::s
0e90: 6f 63 6b 65 74 22 3e 3c 62 3e 74 6c 73 3a 3a 73  ocket"><b>tls::s
0ea0: 6f 63 6b 65 74 20 3c 2f 62 3e 3c 65 6d 3e 3f 6f  ocket </b><em>?o
0eb0: 70 74 69 6f 6e 73 3f 0a 20 20 20 20 20 20 20 20  ptions?.        
0ec0: 68 6f 73 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f  host port</em></
0ed0: 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74 3e  a></dt>.    <dt>
0ee0: 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f  <b>tls::socket</
0ef0: 62 3e 3c 65 6d 3e 20 3f 2d 73 65 72 76 65 72 20  b><em> ?-server 
0f00: 63 6f 6d 6d 61 6e 64 3f 20 3f 6f 70 74 69 6f 6e  command? ?option
0f10: 73 3f 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64 74  s? port</em></dt
0f20: 3e 0a 20 20 20 20 3c 64 64 3e 54 68 69 73 20 69  >.    <dd>This i
0f30: 73 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63 74  s a helper funct
0f40: 69 6f 6e 20 74 68 61 74 20 75 74 69 6c 69 7a 65  ion that utilize
0f50: 73 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67  s the underlying
0f60: 0a 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64  .        command
0f70: 73 20 28 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a  s (<strong>tls::
0f80: 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 29  import</strong>)
0f90: 2e 20 49 74 20 62 65 68 61 76 65 73 0a 20 20 20  . It behaves.   
0fa0: 20 20 20 20 20 65 78 61 63 74 6c 79 20 74 68 65       exactly the
0fb0: 20 73 61 6d 65 20 61 73 20 74 68 65 20 6e 61 74   same as the nat
0fc0: 69 76 65 20 54 63 6c 20 3c 73 74 72 6f 6e 67 3e  ive Tcl <strong>
0fd0: 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 0a  socket</strong>.
0fe0: 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 20          command 
0ff0: 65 78 63 65 70 74 20 74 68 61 74 20 74 68 65 20  except that the 
1000: 6f 70 74 69 6f 6e 73 20 63 61 6e 20 69 6e 63 6c  options can incl
1010: 75 64 65 20 61 6e 79 20 6f 66 20 74 68 65 0a 20  ude any of the. 
1020: 20 20 20 20 20 20 20 61 70 70 6c 69 63 61 62 6c         applicabl
1030: 65 20 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 3a  e <a href="#tls:
1040: 3a 69 6d 70 6f 72 74 22 3e 3c 73 74 72 6f 6e 67  :import"><strong
1050: 3e 74 6c 73 3a 69 6d 70 6f 72 74 3c 2f 73 74 72  >tls:import</str
1060: 6f 6e 67 3e 3c 2f 61 3e 0a 20 20 20 20 20 20 20  ong></a>.       
1070: 20 6f 70 74 69 6f 6e 73 20 77 69 74 68 20 6f 6e   options with on
1080: 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74  e additional opt
1090: 69 6f 6e 3a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65  ion:.<blockquote
10a0: 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20 20 20 20 20  >.    <dl>.     
10b0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
10c0: 61 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 3c 2f  autoservername</
10d0: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c  strong> <em>bool
10e0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
10f0: 20 20 20 3c 64 64 3e 41 75 74 6f 6d 61 74 69 63     <dd>Automatic
1100: 61 6c 6c 79 20 73 65 6e 64 20 74 68 65 20 2d 73  ally send the -s
1110: 65 72 76 65 72 6e 61 6d 65 20 61 73 20 74 68 65  ervername as the
1120: 20 3c 65 6d 3e 68 6f 73 74 3c 2f 65 6d 3e 20 61   <em>host</em> a
1130: 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 20 20 20  rgument.        
1140: 20 20 20 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66      (<strong>def
1150: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c  ault</strong>: <
1160: 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f  em>false</em>)</
1170: 64 64 3e 0a 20 20 20 20 3c 2f 64 6c 3e 0a 3c 2f  dd>.    </dl>.</
1180: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 20 20  blockquote>.    
1190: 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f 64 74 3e 0a  <dt>&nbsp;</dt>.
11a0: 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d      <dt><a name=
11b0: 22 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 22  "tls::handshake"
11c0: 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 68 61  ><strong>tls::ha
11d0: 6e 64 73 68 61 6b 65 3c 2f 73 74 72 6f 6e 67 3e  ndshake</strong>
11e0: 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d   <em>channel</em
11f0: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c  ></a></dt>.    <
1200: 64 64 3e 46 6f 72 63 65 73 20 68 61 6e 64 73 68  dd>Forces handsh
1210: 61 6b 65 20 74 6f 20 74 61 6b 65 20 70 6c 61 63  ake to take plac
1220: 65 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 30  e, and returns 0
1230: 20 69 66 0a 20 20 20 20 20 20 20 20 68 61 6e 64   if.        hand
1240: 73 68 61 6b 65 20 69 73 20 73 74 69 6c 6c 20 69  shake is still i
1250: 6e 20 70 72 6f 67 72 65 73 73 20 28 6e 6f 6e 2d  n progress (non-
1260: 62 6c 6f 63 6b 69 6e 67 29 2c 20 6f 72 20 31 20  blocking), or 1 
1270: 69 66 0a 20 20 20 20 20 20 20 20 74 68 65 20 68  if.        the h
1280: 61 6e 64 73 68 61 6b 65 20 77 61 73 20 73 75 63  andshake was suc
1290: 63 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65 20  cessful. If the 
12a0: 68 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65 64  handshake failed
12b0: 0a 20 20 20 20 20 20 20 20 74 68 69 73 20 72 6f  .        this ro
12c0: 75 74 69 6e 65 20 77 69 6c 6c 20 74 68 72 6f 77  utine will throw
12d0: 20 61 6e 20 65 72 72 6f 72 2e 3c 2f 64 64 3e 0a   an error.</dd>.
12e0: 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f      <dt>&nbsp;</
12f0: 64 74 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e  dt>.    <dt><a n
1300: 61 6d 65 3d 22 74 6c 73 3a 3a 73 74 61 74 75 73  ame="tls::status
1310: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  "><strong>tls::s
1320: 74 61 74 75 73 3c 2f 73 74 72 6f 6e 67 3e 0a 20  tatus</strong>. 
1330: 20 20 20 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f 20     <em>?-local? 
1340: 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61 3e  channel</em></a>
1350: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 52 65  </dt>.    <dd>Re
1360: 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65 6e  turns the curren
1370: 74 20 73 65 63 75 72 69 74 79 20 73 74 61 74 75  t security statu
1380: 73 20 6f 66 20 61 6e 20 53 53 4c 20 63 68 61 6e  s of an SSL chan
1390: 6e 65 6c 2e 20 54 68 65 0a 20 20 20 20 20 20 20  nel. The.       
13a0: 20 72 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73   result is a lis
13b0: 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70  t of key-value p
13c0: 61 69 72 73 20 64 65 73 63 72 69 62 69 6e 67 20  airs describing 
13d0: 74 68 65 0a 20 20 20 20 20 20 20 20 63 6f 6e 6e  the.        conn
13e0: 65 63 74 65 64 20 70 65 65 72 2e 20 49 66 20 74  ected peer. If t
13f0: 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 6e 20  he result is an 
1400: 65 6d 70 74 79 20 6c 69 73 74 20 74 68 65 6e 20  empty list then 
1410: 74 68 65 0a 20 20 20 20 20 20 20 20 53 53 4c 20  the.        SSL 
1420: 68 61 6e 64 73 68 61 6b 65 20 68 61 73 20 6e 6f  handshake has no
1430: 74 20 79 65 74 20 63 6f 6d 70 6c 65 74 65 64 2e  t yet completed.
1440: 0a 20 20 20 20 20 20 20 20 49 66 20 3c 65 6d 3e  .        If <em>
1450: 2d 6c 6f 63 61 6c 3c 2f 65 6d 3e 20 69 73 20 67  -local</em> is g
1460: 69 76 65 6e 2c 20 74 68 65 6e 20 74 68 65 20 63  iven, then the c
1470: 65 72 74 69 66 69 63 61 74 65 20 69 6e 66 6f 72  ertificate infor
1480: 6d 61 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 69  mation.        i
1490: 73 20 74 68 65 20 6f 6e 65 20 75 73 65 64 20 6c  s the one used l
14a0: 6f 63 61 6c 6c 79 2e 3c 2f 64 64 3e 0a 3c 2f 64  ocally.</dd>.</d
14b0: 6c 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e  l>..<blockquote>
14c0: 0a 20 20 20 20 3c 64 6c 3e 0a 20 20 20 20 20 20  .    <dl>.      
14d0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 69 73    <dt><strong>is
14e0: 73 75 65 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  suer</strong> <e
14f0: 6d 3e 64 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20  m>dn</em></dt>. 
1500: 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 64         <dd>The d
1510: 69 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d  istinguished nam
1520: 65 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65  e (DN) of the ce
1530: 72 74 69 66 69 63 61 74 65 0a 20 20 20 20 20 20  rtificate.      
1540: 20 20 20 20 20 20 69 73 73 75 65 72 2e 3c 2f 64        issuer.</d
1550: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
1560: 73 74 72 6f 6e 67 3e 73 75 62 6a 65 63 74 3c 2f  strong>subject</
1570: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 6e 3c 2f  strong> <em>dn</
1580: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1590: 20 3c 64 64 3e 54 68 65 20 64 69 73 74 69 6e 67   <dd>The disting
15a0: 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29  uished name (DN)
15b0: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
15c0: 61 74 65 0a 20 20 20 20 20 20 20 20 20 20 20 20  ate.            
15d0: 73 75 62 6a 65 63 74 2e 3c 2f 64 64 3e 0a 20 20  subject.</dd>.  
15e0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
15f0: 67 3e 6e 6f 74 42 65 66 6f 72 65 3c 2f 73 74 72  g>notBefore</str
1600: 6f 6e 67 3e 20 3c 65 6d 3e 64 61 74 65 3c 2f 65  ong> <em>date</e
1610: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
1620: 3c 64 64 3e 54 68 65 20 62 65 67 69 6e 20 64 61  <dd>The begin da
1630: 74 65 20 66 6f 72 20 74 68 65 20 76 61 6c 69 64  te for the valid
1640: 69 74 79 20 6f 66 20 74 68 65 20 63 65 72 74 69  ity of the certi
1650: 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20  ficate.</dd>.   
1660: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
1670: 3e 6e 6f 74 41 66 74 65 72 3c 2f 73 74 72 6f 6e  >notAfter</stron
1680: 67 3e 20 3c 65 6d 3e 64 61 74 65 3c 2f 65 6d 3e  g> <em>date</em>
1690: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
16a0: 64 3e 54 68 65 20 65 78 70 69 72 79 20 64 61 74  d>The expiry dat
16b0: 65 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 66  e for the certif
16c0: 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20  icate.</dd>.    
16d0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
16e0: 73 65 72 69 61 6c 3c 2f 73 74 72 6f 6e 67 3e 20  serial</strong> 
16f0: 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  <em>n</em></dt>.
1700: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
1710: 73 65 72 69 61 6c 20 6e 75 6d 62 65 72 20 6f 66  serial number of
1720: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
1730: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  .</dd>.        <
1740: 64 74 3e 3c 73 74 72 6f 6e 67 3e 63 69 70 68 65  dt><strong>ciphe
1750: 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  r</strong> <em>c
1760: 69 70 68 65 72 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  ipher</em></dt>.
1770: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
1780: 63 75 72 72 65 6e 74 20 63 69 70 68 65 72 20 69  current cipher i
1790: 6e 20 75 73 65 20 62 65 74 77 65 65 6e 20 74 68  n use between th
17a0: 65 20 63 6c 69 65 6e 74 20 61 6e 64 0a 20 20 20  e client and.   
17b0: 20 20 20 20 20 20 20 20 20 73 65 72 76 65 72 20           server 
17c0: 63 68 61 6e 6e 65 6c 73 2e 3c 2f 64 64 3e 0a 20  channels.</dd>. 
17d0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
17e0: 6e 67 3e 73 62 69 74 73 3c 2f 73 74 72 6f 6e 67  ng>sbits</strong
17f0: 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c 2f 64 74  > <em>n</em></dt
1800: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68  >.        <dd>Th
1810: 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 69 74 73  e number of bits
1820: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 73 65   used for the se
1830: 73 73 69 6f 6e 20 6b 65 79 2e 3c 2f 64 64 3e 0a  ssion key.</dd>.
1840: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
1850: 6f 6e 67 3e 63 65 72 74 69 66 69 63 61 74 65 3c  ong>certificate<
1860: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f  /strong> <em>n</
1870: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1880: 20 3c 64 64 3e 54 68 65 20 50 45 4d 20 65 6e 63   <dd>The PEM enc
1890: 6f 64 65 64 20 63 65 72 74 69 66 69 63 61 74 65  oded certificate
18a0: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  .</dd>.        <
18b0: 64 74 3e 3c 73 74 72 6f 6e 67 3e 73 68 61 31 5f  dt><strong>sha1_
18c0: 68 61 73 68 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  hash</strong> <e
18d0: 6d 3e 68 61 73 68 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>hash</em></dt>
18e0: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65  .        <dd>The
18f0: 20 53 48 41 31 20 68 61 73 68 20 6f 66 20 74 68   SHA1 hash of th
1900: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 3c 2f  e certificate.</
1910: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
1920: 3c 73 74 72 6f 6e 67 3e 73 68 61 32 35 36 5f 68  <strong>sha256_h
1930: 61 73 68 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  ash</strong> <em
1940: 3e 68 61 73 68 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  >hash</em></dt>.
1950: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
1960: 53 48 41 32 35 36 20 68 61 73 68 20 6f 66 20 74  SHA256 hash of t
1970: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 3c  he certificate.<
1980: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
1990: 3e 3c 73 74 72 6f 6e 67 3e 61 6c 70 6e 3c 2f 73  ><strong>alpn</s
19a0: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 70 72 6f 74 6f  trong> <em>proto
19b0: 63 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  col</em></dt>.  
19c0: 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 70 72        <dd>The pr
19d0: 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20  otocol selected 
19e0: 61 66 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f  after Applicatio
19f0: 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c  n-Layer Protocol
1a00: 0a 09 20 20 20 20 4e 65 67 6f 74 69 61 74 69 6f  ..    Negotiatio
1a10: 6e 20 28 41 4c 50 4e 29 2e 3c 2f 64 64 3e 0a 20  n (ALPN).</dd>. 
1a20: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
1a30: 6e 67 3e 76 65 72 73 69 6f 6e 3c 2f 73 74 72 6f  ng>version</stro
1a40: 6e 67 3e 20 3c 65 6d 3e 76 61 6c 75 65 3c 2f 65  ng> <em>value</e
1a50: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
1a60: 3c 64 64 3e 54 68 65 20 70 72 6f 74 6f 63 6f 6c  <dd>The protocol
1a70: 20 76 65 72 73 69 6f 6e 20 75 73 65 64 20 66 6f   version used fo
1a80: 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e  r the connection
1a90: 3a 0a 09 20 20 53 53 4c 76 32 2c 20 53 53 4c 76  :..  SSLv2, SSLv
1aa0: 33 2c 20 54 4c 53 76 31 2c 20 54 4c 53 76 31 2e  3, TLSv1, TLSv1.
1ab0: 31 2c 20 54 4c 53 76 31 2e 32 2c 20 75 6e 6b 6e  1, TLSv1.2, unkn
1ac0: 6f 77 6e 3c 2f 64 64 3e 0a 20 20 20 20 3c 2f 64  own</dd>.    </d
1ad0: 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e  l>.</blockquote>
1ae0: 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c  ..<dl>.    <dt><
1af0: 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 69 6d 70  a name="tls::imp
1b00: 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70  ort"><b>tls::imp
1b10: 6f 72 74 20 3c 2f 62 3e 3c 69 3e 63 68 61 6e 6e  ort </b><i>chann
1b20: 65 6c 0a 20 20 20 20 20 20 20 20 3f 6f 70 74 69  el.        ?opti
1b30: 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64 74  ons?</i></a></dt
1b40: 3e 0a 20 20 20 20 3c 64 64 3e 53 53 4c 2d 65 6e  >.    <dd>SSL-en
1b50: 61 62 6c 65 20 61 20 72 65 67 75 6c 61 72 20 54  able a regular T
1b60: 63 6c 20 63 68 61 6e 6e 65 6c 20 2d 20 69 74 20  cl channel - it 
1b70: 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 0a 20 20  need not be a.  
1b80: 20 20 20 20 20 20 73 6f 63 6b 65 74 2c 20 62 75        socket, bu
1b90: 74 20 6d 75 73 74 20 70 72 6f 76 69 64 65 20 62  t must provide b
1ba0: 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c 20 66 6c  i-directional fl
1bb0: 6f 77 2e 20 41 6c 73 6f 0a 20 20 20 20 20 20 20  ow. Also.       
1bc0: 20 73 65 74 74 69 6e 67 20 73 65 73 73 69 6f 6e   setting session
1bd0: 20 70 61 72 61 6d 65 74 65 72 73 20 66 6f 72 20   parameters for 
1be0: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 3c 2f  SSL handshake.</
1bf0: 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 62 6c 6f 63  dd>.</dl>..<bloc
1c00: 6b 71 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c 3e  kquote>.    <dl>
1c10: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
1c20: 72 6f 6e 67 3e 2d 61 6c 70 6e 3c 2f 73 74 72 6f  rong>-alpn</stro
1c30: 6e 67 3e 20 3c 65 6d 3e 6c 69 73 74 3c 2f 65 6d  ng> <em>list</em
1c40: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c  ></dt>.        <
1c50: 64 64 3e 4c 69 73 74 20 6f 66 20 70 72 6f 74 6f  dd>List of proto
1c60: 63 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20 64 75  cols to offer du
1c70: 72 69 6e 67 20 41 70 70 6c 69 63 61 74 69 6f 6e  ring Application
1c80: 2d 4c 61 79 65 72 0a 09 20 20 20 20 50 72 6f 74  -Layer..    Prot
1c90: 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e  ocol Negotiation
1ca0: 20 28 41 4c 50 4e 29 2e 20 46 6f 72 20 65 78 61   (ALPN). For exa
1cb0: 6d 70 6c 65 3a 20 68 32 2c 20 68 74 74 70 2f 31  mple: h2, http/1
1cc0: 2e 31 2c 20 65 74 63 2e 3c 2f 64 64 3e 0a 20 20  .1, etc.</dd>.  
1cd0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
1ce0: 67 3e 2d 63 61 64 69 72 3c 2f 73 74 72 6f 6e 67  g>-cadir</strong
1cf0: 3e 20 3c 65 6d 3e 64 69 72 3c 2f 65 6d 3e 3c 2f  > <em>dir</em></
1d00: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e  dt>.        <dd>
1d10: 50 72 6f 76 69 64 65 20 74 68 65 20 64 69 72 65  Provide the dire
1d20: 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67  ctory containing
1d30: 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69 63   the CA certific
1d40: 61 74 65 73 2e 20 54 68 65 0a 09 64 65 66 61 75  ates. The..defau
1d50: 6c 74 20 64 69 72 65 63 74 6f 72 79 20 69 73 20  lt directory is 
1d60: 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66 69  platform specifi
1d70: 63 20 61 6e 64 20 63 61 6e 20 62 65 20 73 65 74  c and can be set
1d80: 20 61 74 0a 09 63 6f 6d 70 69 6c 65 20 74 69 6d   at..compile tim
1d90: 65 2e 20 54 68 69 73 20 63 61 6e 20 62 65 20 6f  e. This can be o
1da0: 76 65 72 72 69 64 64 65 6e 20 76 69 61 20 74 68  verridden via th
1db0: 65 20 3c 62 3e 53 53 4c 5f 43 45 52 54 5f 44 49  e <b>SSL_CERT_DI
1dc0: 52 3c 2f 62 3e 0a 09 65 6e 76 69 72 6f 6e 6d 65  R</b>..environme
1dd0: 6e 74 20 76 61 72 69 61 62 6c 65 2e 3c 2f 64 64  nt variable.</dd
1de0: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73  >.        <dt><s
1df0: 74 72 6f 6e 67 3e 2d 63 61 66 69 6c 65 20 3c 2f  trong>-cafile </
1e00: 73 74 72 6f 6e 67 3e 3c 65 6d 3e 66 69 6c 65 6e  strong><em>filen
1e10: 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ame</em></dt>.  
1e20: 20 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64        <dd>Provid
1e30: 65 20 74 68 65 20 43 41 20 66 69 6c 65 2e 3c 2f  e the CA file.</
1e40: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
1e50: 3c 73 74 72 6f 6e 67 3e 2d 63 65 72 74 66 69 6c  <strong>-certfil
1e60: 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66  e</strong> <em>f
1e70: 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74  ilename</em></dt
1e80: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72  >.        <dd>Pr
1e90: 6f 76 69 64 65 20 74 68 65 20 6e 61 6d 65 20 6f  ovide the name o
1ea0: 66 20 61 20 66 69 6c 65 20 63 6f 6e 74 61 69 6e  f a file contain
1eb0: 69 6e 67 20 63 65 72 74 69 66 69 63 61 74 65 20  ing certificate 
1ec0: 74 6f 20 75 73 65 2e 0a 09 54 68 65 20 64 65 66  to use...The def
1ed0: 61 75 6c 74 20 6e 61 6d 65 20 69 73 20 63 65 72  ault name is cer
1ee0: 74 2e 70 65 6d 2e 20 54 68 69 73 20 63 61 6e 20  t.pem. This can 
1ef0: 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 76 69  be overridden vi
1f00: 61 20 74 68 65 0a 09 3c 62 3e 53 53 4c 5f 43 45  a the..<b>SSL_CE
1f10: 52 54 5f 46 49 4c 45 3c 2f 62 3e 20 65 6e 76 69  RT_FILE</b> envi
1f20: 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65  ronment variable
1f30: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  .</dd>.        <
1f40: 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63 65 72 74  dt><strong>-cert
1f50: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66 69  </strong> <em>fi
1f60: 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e  lename</em></dt>
1f70: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72 6f  .        <dd>Pro
1f80: 76 69 64 65 20 74 68 65 20 63 6f 6e 74 65 6e 74  vide the content
1f90: 73 20 6f 66 20 61 20 63 65 72 74 69 66 69 63 61  s of a certifica
1fa0: 74 65 20 74 6f 20 75 73 65 2c 20 61 73 20 61 20  te to use, as a 
1fb0: 44 45 52 20 65 6e 63 6f 64 65 64 20 62 69 6e 61  DER encoded bina
1fc0: 72 79 20 76 61 6c 75 65 20 28 58 2e 35 30 39 20  ry value (X.509 
1fd0: 44 45 52 29 2e 3c 2f 64 64 3e 0a 20 20 20 20 20  DER).</dd>.     
1fe0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
1ff0: 63 69 70 68 65 72 20 3c 2f 73 74 72 6f 6e 67 3e  cipher </strong>
2000: 3c 65 6d 3e 73 74 72 69 6e 67 3c 2f 65 6d 3e 3c  <em>string</em><
2010: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
2020: 3e 50 72 6f 76 69 64 65 20 74 68 65 20 63 69 70  >Provide the cip
2030: 68 65 72 20 73 75 69 74 65 73 20 74 6f 20 75 73  her suites to us
2040: 65 2e 20 53 79 6e 74 61 78 20 69 73 20 61 73 20  e. Syntax is as 
2050: 70 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20  per.            
2060: 4f 70 65 6e 53 53 4c 2e 3c 2f 64 64 3e 0a 20 20  OpenSSL.</dd>.  
2070: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
2080: 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74 72 6f  g>-command</stro
2090: 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b  ng> <em>callback
20a0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
20b0: 20 20 20 3c 64 64 3e 49 66 20 73 70 65 63 69 66     <dd>If specif
20c0: 69 65 64 2c 20 74 68 69 73 20 63 61 6c 6c 62 61  ied, this callba
20d0: 63 6b 20 77 69 6c 6c 20 62 65 20 69 6e 76 6f 6b  ck will be invok
20e0: 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f  ed at several po
20f0: 69 6e 74 73 0a 20 20 20 20 20 20 20 20 20 20 20  ints.           
2100: 20 64 75 72 69 6e 67 20 74 68 65 20 4f 70 65 6e   during the Open
2110: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 20  SSL handshake.  
2120: 49 74 20 63 61 6e 20 70 61 73 73 20 65 72 72 6f  It can pass erro
2130: 72 73 20 61 6e 64 20 74 72 61 63 69 6e 67 0a 20  rs and tracing. 
2140: 20 20 20 20 20 20 20 20 20 20 20 69 6e 66 6f 72             infor
2150: 6d 61 74 69 6f 6e 2c 20 61 6e 64 20 69 74 20 63  mation, and it c
2160: 61 6e 20 61 6c 6c 6f 77 20 54 63 6c 20 73 63 72  an allow Tcl scr
2170: 69 70 74 73 20 74 6f 20 70 65 72 66 6f 72 6d 0a  ipts to perform.
2180: 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65 69              thei
2190: 72 20 6f 77 6e 20 76 61 6c 69 64 61 74 69 6f 6e  r own validation
21a0: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
21b0: 61 74 65 20 69 6e 20 70 6c 61 63 65 20 6f 66 20  ate in place of 
21c0: 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 20 20  the.            
21d0: 64 65 66 61 75 6c 74 20 76 61 6c 69 64 61 74 69  default validati
21e0: 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 4f  on provided by O
21f0: 70 65 6e 53 53 4c 2e 0a 20 20 20 20 20 20 20 20  penSSL..        
2200: 20 20 20 20 3c 62 72 3e 0a 20 20 20 20 20 20 20      <br>.       
2210: 20 20 20 20 20 53 65 65 20 3c 61 20 68 72 65 66       See <a href
2220: 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49  ="#CALLBACK OPTI
2230: 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20 4f 50  ONS">CALLBACK OP
2240: 54 49 4f 4e 53 3c 2f 61 3e 20 66 6f 72 0a 20 20  TIONS</a> for.  
2250: 20 20 20 20 20 20 20 20 20 20 66 75 72 74 68 65            furthe
2260: 72 20 64 69 73 63 75 73 73 69 6f 6e 2e 3c 2f 64  r discussion.</d
2270: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
2280: 73 74 72 6f 6e 67 3e 2d 64 68 70 61 72 61 6d 73  strong>-dhparams
2290: 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e 66 69   </strong><em>fi
22a0: 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e  lename</em></dt>
22b0: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72 6f  .        <dd>Pro
22c0: 76 69 64 65 20 61 20 44 69 66 66 69 65 2d 48 65  vide a Diffie-He
22d0: 6c 6c 6d 61 6e 20 70 61 72 61 6d 65 74 65 72 73  llman parameters
22e0: 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20 20   file.</dd>.    
22f0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
2300: 2d 6b 65 79 66 69 6c 65 3c 2f 73 74 72 6f 6e 67  -keyfile</strong
2310: 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f  > <em>filename</
2320: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
2330: 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65   <dd>Provide the
2340: 20 70 72 69 76 61 74 65 20 6b 65 79 20 66 69 6c   private key fil
2350: 65 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61  e. (<strong>defa
2360: 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 0a 20 20  ult</strong>:.  
2370: 20 20 20 20 20 20 20 20 20 20 76 61 6c 75 65 20            value 
2380: 6f 66 20 2d 63 65 72 74 66 69 6c 65 29 3c 2f 64  of -certfile)</d
2390: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
23a0: 73 74 72 6f 6e 67 3e 2d 6b 65 79 3c 2f 73 74 72  strong>-key</str
23b0: 6f 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d  ong> <em>filenam
23c0: 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  e</em></dt>.    
23d0: 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20      <dd>Provide 
23e0: 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20  the private key 
23f0: 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52 20  to use as a DER 
2400: 65 6e 63 6f 64 65 64 20 76 61 6c 75 65 20 28 50  encoded value (P
2410: 4b 43 53 23 31 20 44 45 52 29 3c 2f 64 64 3e 0a  KCS#1 DER)</dd>.
2420: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
2430: 6f 6e 67 3e 2d 6d 6f 64 65 6c 3c 2f 73 74 72 6f  ong>-model</stro
2440: 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c  ng> <em>channel<
2450: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
2460: 20 20 3c 64 64 3e 54 68 69 73 20 77 69 6c 6c 20    <dd>This will 
2470: 66 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e 6e  force this chann
2480: 65 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65 20  el to share the 
2490: 73 61 6d 65 20 3c 65 6d 3e 3c 73 74 72 6f 6e 67  same <em><strong
24a0: 3e 53 53 4c 5f 43 54 58 3c 2f 73 74 72 6f 6e 67  >SSL_CTX</strong
24b0: 3e 3c 2f 65 6d 3e 0a 20 20 20 20 20 20 20 20 20  ></em>.         
24c0: 20 20 20 73 74 72 75 63 74 75 72 65 20 61 73 20     structure as 
24d0: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 3c 65  the specified <e
24e0: 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 2c 20  m>channel</em>, 
24f0: 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 20 20  and.            
2500: 74 68 65 72 65 66 6f 72 65 20 73 68 61 72 65 20  therefore share 
2510: 63 61 6c 6c 62 61 63 6b 73 20 65 74 63 2e 3c 2f  callbacks etc.</
2520: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
2530: 3c 73 74 72 6f 6e 67 3e 2d 70 61 73 73 77 6f 72  <strong>-passwor
2540: 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  d</strong> <em>c
2550: 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f 64 74  allback</em></dt
2560: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 49 66  >.        <dd>If
2570: 20 73 75 70 70 6c 69 65 64 2c 20 74 68 69 73 20   supplied, this 
2580: 63 61 6c 6c 62 61 63 6b 20 77 69 6c 6c 20 62 65  callback will be
2590: 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 4f 70   invoked when Op
25a0: 65 6e 53 53 4c 20 6e 65 65 64 73 0a 20 20 20 20  enSSL needs.    
25b0: 20 20 20 20 20 20 20 20 74 6f 20 6f 62 74 61 69          to obtai
25c0: 6e 20 61 20 70 61 73 73 77 6f 72 64 2c 20 74 79  n a password, ty
25d0: 70 69 63 61 6c 6c 79 20 74 6f 20 75 6e 6c 6f 63  pically to unloc
25e0: 6b 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65  k the private ke
25f0: 79 20 6f 66 0a 09 20 20 20 20 61 20 63 65 72 74  y of..    a cert
2600: 69 66 69 63 61 74 65 2e 0a 20 20 20 20 20 20 20  ificate..       
2610: 20 20 20 20 20 54 68 65 20 63 61 6c 6c 62 61 63       The callbac
2620: 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20  k should return 
2630: 61 20 73 74 72 69 6e 67 20 77 68 69 63 68 20 72  a string which r
2640: 65 70 72 65 73 65 6e 74 73 20 74 68 65 0a 20 20  epresents the.  
2650: 20 20 20 20 20 20 20 20 20 20 70 61 73 73 77 6f            passwo
2660: 72 64 20 74 6f 20 62 65 20 75 73 65 64 2e 0a 20  rd to be used.. 
2670: 20 20 20 20 20 20 20 20 20 20 20 3c 62 72 3e 0a             <br>.
2680: 20 20 20 20 20 20 20 20 20 20 20 20 53 65 65 20              See 
2690: 3c 61 20 68 72 65 66 3d 22 23 43 41 4c 4c 42 41  <a href="#CALLBA
26a0: 43 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c 4c  CK OPTIONS">CALL
26b0: 42 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61 3e  BACK OPTIONS</a>
26c0: 20 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20   for.           
26d0: 20 66 75 72 74 68 65 72 20 64 69 73 63 75 73 73   further discuss
26e0: 69 6f 6e 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20  ion.</dd>.      
26f0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 72    <dt><strong>-r
2700: 65 71 75 65 73 74 20 3c 2f 73 74 72 6f 6e 67 3e  equest </strong>
2710: 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64  <em>bool</em></d
2720: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 52  t>.        <dd>R
2730: 65 71 75 65 73 74 20 61 20 63 65 72 74 69 66 69  equest a certifi
2740: 63 61 74 65 20 66 72 6f 6d 20 70 65 65 72 20 64  cate from peer d
2750: 75 72 69 6e 67 20 53 53 4c 20 68 61 6e 64 73 68  uring SSL handsh
2760: 61 6b 65 2e 0a 20 20 20 20 20 20 20 20 20 20 20  ake..           
2770: 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c   (<strong>defaul
2780: 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e  t</strong>: <em>
2790: 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a  true</em>)</dd>.
27a0: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
27b0: 6f 6e 67 3e 2d 72 65 71 75 69 72 65 3c 2f 73 74  ong>-require</st
27c0: 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f  rong> <em>bool</
27d0: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
27e0: 20 3c 64 64 3e 52 65 71 75 69 72 65 20 61 20 76   <dd>Require a v
27f0: 61 6c 69 64 20 63 65 72 74 69 66 69 63 61 74 65  alid certificate
2800: 20 66 72 6f 6d 20 70 65 65 72 20 64 75 72 69 6e   from peer durin
2810: 67 20 53 53 4c 0a 20 20 20 20 20 20 20 20 20 20  g SSL.          
2820: 20 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20    handshake. If 
2830: 74 68 69 73 20 69 73 20 73 65 74 20 74 6f 20 74  this is set to t
2840: 72 75 65 20 74 68 65 6e 20 3c 73 74 72 6f 6e 67  rue then <strong
2850: 3e 2d 72 65 71 75 65 73 74 3c 2f 73 74 72 6f 6e  >-request</stron
2860: 67 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 6d  g>.            m
2870: 75 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74 20  ust also be set 
2880: 74 6f 20 74 72 75 65 2e 20 28 3c 73 74 72 6f 6e  to true. (<stron
2890: 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e  g>default</stron
28a0: 67 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65  g>: <em>false</e
28b0: 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20  m>)</dd>.       
28c0: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73 65   <dt><strong>-se
28d0: 72 76 65 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  rver</strong> <e
28e0: 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>bool</em></dt>
28f0: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 48 61 6e  .        <dd>Han
2900: 64 73 68 61 6b 65 20 61 73 20 73 65 72 76 65 72  dshake as server
2910: 20 69 66 20 74 72 75 65 2c 20 65 6c 73 65 20 68   if true, else h
2920: 61 6e 64 73 68 61 6b 65 20 61 73 0a 20 20 20 20  andshake as.    
2930: 20 20 20 20 20 20 20 20 63 6c 69 65 6e 74 2e 28          client.(
2940: 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c  <strong>default<
2950: 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61  /strong>: <em>fa
2960: 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20  lse</em>)</dd>. 
2970: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
2980: 6e 67 3e 2d 73 65 72 76 65 72 6e 61 6d 65 3c 2f  ng>-servername</
2990: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 68 6f 73 74  strong> <em>host
29a0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
29b0: 20 20 20 3c 64 64 3e 4f 6e 6c 79 20 61 76 61 69     <dd>Only avai
29c0: 6c 61 62 6c 65 20 69 66 20 74 68 65 20 4f 70 65  lable if the Ope
29d0: 6e 53 53 4c 20 6c 69 62 72 61 72 79 20 74 68 65  nSSL library the
29e0: 20 70 61 63 6b 61 67 65 20 69 73 20 6c 69 6e 6b   package is link
29f0: 65 64 0a 09 20 20 20 20 61 67 61 69 6e 73 74 20  ed..    against 
2a00: 73 75 70 70 6f 72 74 73 20 74 68 65 20 54 4c 53  supports the TLS
2a10: 20 68 6f 73 74 6e 61 6d 65 20 65 78 74 65 6e 73   hostname extens
2a20: 69 6f 6e 20 66 6f 72 20 27 53 65 72 76 65 72 20  ion for 'Server 
2a30: 4e 61 6d 65 0a 09 20 20 20 20 49 6e 64 69 63 61  Name..    Indica
2a40: 74 69 6f 6e 27 20 28 53 4e 49 29 2e 20 55 73 65  tion' (SNI). Use
2a50: 20 74 6f 20 6e 61 6d 65 20 74 68 65 20 6c 6f 67   to name the log
2a60: 69 63 61 6c 20 68 6f 73 74 20 77 65 20 61 72 65  ical host we are
2a70: 20 74 61 6c 6b 69 6e 67 0a 09 20 20 20 20 74 6f   talking..    to
2a80: 20 61 6e 64 20 65 78 70 65 63 74 69 6e 67 20 61   and expecting a
2a90: 20 63 65 72 74 69 66 69 63 61 74 65 20 66 6f 72   certificate for
2aa0: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dd>.        <d
2ab0: 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73 73 6c 32 3c  t><strong>-ssl2<
2ac0: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f  /strong> <em>boo
2ad0: 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  l</em></dt>.    
2ae0: 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75      <dd>Enable u
2af0: 73 65 20 6f 66 20 53 53 4c 20 76 32 2e 20 28 3c  se of SSL v2. (<
2b00: 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f  strong>default</
2b10: 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c  strong>: <em>fal
2b20: 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20  se</em>)</dd>.  
2b30: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
2b40: 67 3e 2d 73 73 6c 33 20 3c 2f 73 74 72 6f 6e 67  g>-ssl3 </strong
2b50: 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f  ><em>bool</em></
2b60: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e  dt>.        <dd>
2b70: 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53  Enable use of SS
2b80: 4c 20 76 33 2e 20 28 3c 73 74 72 6f 6e 67 3e 64  L v3. (<strong>d
2b90: 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a  efault</strong>:
2ba0: 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29   <em>false</em>)
2bb0: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dd>.        <d
2bc0: 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31 3c  t>-<strong>tls1<
2bd0: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f  /strong> <em>boo
2be0: 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  l</em></dt>.    
2bf0: 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75      <dd>Enable u
2c00: 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 20 28 3c  se of TLS v1. (<
2c10: 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f  strong>default</
2c20: 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72 75  strong>: <em>tru
2c30: 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20  e</em>)</dd>.   
2c40: 20 20 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f 6e       <dt>-<stron
2c50: 67 3e 74 6c 73 31 2e 31 3c 2f 73 74 72 6f 6e 67  g>tls1.1</strong
2c60: 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c  > <em>bool</em><
2c70: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
2c80: 3e 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54  >Enable use of T
2c90: 4c 53 20 76 31 2e 31 20 28 3c 73 74 72 6f 6e 67  LS v1.1 (<strong
2ca0: 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67  >default</strong
2cb0: 3e 3a 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e  >: <em>true</em>
2cc0: 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  )</dd>.        <
2cd0: 64 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31  dt>-<strong>tls1
2ce0: 2e 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e  .2</strong> <em>
2cf0: 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20  bool</em></dt>. 
2d00: 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c         <dd>Enabl
2d10: 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e  e use of TLS v1.
2d20: 32 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75  2 (<strong>defau
2d30: 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d  lt</strong>: <em
2d40: 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e  >true</em>)</dd>
2d50: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 2d 3c 73  .        <dt>-<s
2d60: 74 72 6f 6e 67 3e 74 6c 73 31 2e 33 3c 2f 73 74  trong>tls1.3</st
2d70: 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f  rong> <em>bool</
2d80: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
2d90: 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65 20   <dd>Enable use 
2da0: 6f 66 20 54 4c 53 20 76 31 2e 33 20 28 3c 73 74  of TLS v1.3 (<st
2db0: 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74  rong>default</st
2dc0: 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72 75 65 3c  rong>: <em>true<
2dd0: 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 3c  /em>)</dd>.    <
2de0: 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  /dl>.</blockquot
2df0: 65 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74  e>..<dl>.    <dt
2e00: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 75  ><a name="tls::u
2e10: 6e 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a  nimport"><b>tls:
2e20: 3a 75 6e 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69  :unimport </b><i
2e30: 3e 63 68 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61 3e  >channel</i></a>
2e40: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 50 72  </dt>.    <dd>Pr
2e50: 6f 76 69 64 65 64 20 66 6f 72 20 73 79 6d 6d 65  ovided for symme
2e60: 74 72 79 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 74  try to <strong>t
2e70: 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f  ls::import</stro
2e80: 6e 67 3e 2c 20 74 68 69 73 0a 20 20 20 20 20 20  ng>, this.      
2e90: 75 6e 73 74 61 63 6b 73 20 74 68 65 20 53 53 4c  unstacks the SSL
2ea0: 2d 65 6e 61 62 6c 69 6e 67 20 6f 66 20 61 20 72  -enabling of a r
2eb0: 65 67 75 6c 61 72 20 54 63 6c 20 63 68 61 6e 6e  egular Tcl chann
2ec0: 65 6c 2e 20 20 41 6e 20 65 72 72 6f 72 0a 20 20  el.  An error.  
2ed0: 20 20 20 20 69 73 20 74 68 72 6f 77 6e 20 69 66      is thrown if
2ee0: 20 54 4c 53 20 69 73 20 6e 6f 74 20 74 68 65 20   TLS is not the 
2ef0: 74 6f 70 20 73 74 61 63 6b 65 64 20 63 68 61 6e  top stacked chan
2f00: 6e 65 6c 20 74 79 70 65 2e 3c 2f 64 64 3e 0a 3c  nel type.</dd>.<
2f10: 2f 64 6c 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c  /dl>..<dl>.    <
2f20: 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a  dt><a name="tls:
2f30: 3a 63 69 70 68 65 72 73 20 70 72 6f 74 6f 63 6f  :ciphers protoco
2f40: 6c 20 3f 76 65 72 62 6f 73 65 3f 22 3e 3c 73 74  l ?verbose?"><st
2f50: 72 6f 6e 67 3e 74 6c 73 3a 3a 63 69 70 68 65 72  rong>tls::cipher
2f60: 73 3c 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20  s</strong>.     
2f70: 20 20 20 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20     <em>protocol 
2f80: 3f 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f  ?verbose?</em></
2f90: 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e  a></dt>.    <dd>
2fa0: 52 65 74 75 72 6e 73 20 6c 69 73 74 20 6f 66 20  Returns list of 
2fb0: 73 75 70 70 6f 72 74 65 64 20 63 69 70 68 65 72  supported cipher
2fc0: 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 3c  s based on the <
2fd0: 65 6d 3e 70 72 6f 74 6f 63 6f 6c 3c 2f 65 6d 3e  em>protocol</em>
2fe0: 0a 20 20 20 20 20 20 20 20 79 6f 75 20 73 75 70  .        you sup
2ff0: 70 6c 79 2c 20 77 68 69 63 68 20 6d 75 73 74 20  ply, which must 
3000: 62 65 20 6f 6e 65 20 6f 66 20 3c 65 6d 3e 73 73  be one of <em>ss
3010: 6c 32 2c 20 73 73 6c 33 2c 20 6f 72 20 74 6c 73  l2, ssl3, or tls
3020: 31 3c 2f 65 6d 3e 2e 0a 20 20 20 20 20 20 20 20  1</em>..        
3030: 49 66 20 3c 65 6d 3e 76 65 72 62 6f 73 65 3c 2f  If <em>verbose</
3040: 65 6d 3e 20 69 73 20 73 70 65 63 69 66 69 65 64  em> is specified
3050: 20 61 73 20 74 72 75 65 20 74 68 65 6e 20 61 20   as true then a 
3060: 76 65 72 62 6f 73 65 2c 0a 20 20 20 20 20 20 20  verbose,.       
3070: 20 73 65 6d 69 2d 68 75 6d 61 6e 20 72 65 61 64   semi-human read
3080: 61 62 6c 65 20 6c 69 73 74 20 69 73 20 72 65 74  able list is ret
3090: 75 72 6e 65 64 20 70 72 6f 76 69 64 69 6e 67 20  urned providing 
30a0: 61 64 64 69 74 69 6f 6e 61 6c 0a 20 20 20 20 20  additional.     
30b0: 20 20 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f     information o
30c0: 6e 20 74 68 65 20 6e 61 74 75 72 65 20 6f 66 20  n the nature of 
30d0: 74 68 65 20 63 69 70 68 65 72 20 73 75 70 70 6f  the cipher suppo
30e0: 72 74 2e 20 49 6e 20 65 61 63 68 0a 20 20 20 20  rt. In each.    
30f0: 20 20 20 20 63 61 73 65 20 74 68 65 20 72 65 73      case the res
3100: 75 6c 74 20 69 73 20 61 20 54 63 6c 20 6c 69 73  ult is a Tcl lis
3110: 74 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c  t.</dd>.</dl>..<
3120: 64 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e  dl>.    <dt><a n
3130: 61 6d 65 3d 22 74 6c 73 3a 3a 76 65 72 73 69 6f  ame="tls::versio
3140: 6e 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a  n"><strong>tls::
3150: 76 65 72 73 69 6f 6e 3c 2f 73 74 72 6f 6e 67 3e  version</strong>
3160: 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64  </a></dt>.    <d
3170: 64 3e 52 65 74 75 72 6e 73 20 74 68 65 20 76 65  d>Returns the ve
3180: 72 73 69 6f 6e 20 73 74 72 69 6e 67 20 64 65 66  rsion string def
3190: 69 6e 65 64 20 62 79 20 4f 70 65 6e 53 53 4c 2e  ined by OpenSSL.
31a0: 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 68 33  </dd>.</dl>..<h3
31b0: 3e 3c 61 20 6e 61 6d 65 3d 22 43 41 4c 4c 42 41  ><a name="CALLBA
31c0: 43 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c 4c  CK OPTIONS">CALL
31d0: 42 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61 3e  BACK OPTIONS</a>
31e0: 3c 2f 68 33 3e 0a 0a 3c 70 3e 0a 41 73 20 69 6e  </h3>..<p>.As in
31f0: 64 69 63 61 74 65 64 20 61 62 6f 76 65 2c 20 69  dicated above, i
3200: 6e 64 69 76 69 64 75 61 6c 20 63 68 61 6e 6e 65  ndividual channe
3210: 6c 73 20 63 61 6e 20 62 65 20 67 69 76 65 6e 20  ls can be given 
3220: 74 68 65 69 72 20 6f 77 6e 20 63 61 6c 6c 62 61  their own callba
3230: 63 6b 73 0a 74 6f 20 68 61 6e 64 6c 65 20 69 6e  cks.to handle in
3240: 74 65 72 6d 65 64 69 61 74 65 20 70 72 6f 63 65  termediate proce
3250: 73 73 69 6e 67 20 62 79 20 74 68 65 20 4f 70 65  ssing by the Ope
3260: 6e 53 53 4c 20 6c 69 62 72 61 72 79 2c 20 75 73  nSSL library, us
3270: 69 6e 67 20 74 68 65 0a 3c 65 6d 3e 2d 63 6f 6d  ing the.<em>-com
3280: 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20 3c 65  mand</em> and <e
3290: 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d 3e  m>-password</em>
32a0: 20 6f 70 74 69 6f 6e 73 20 70 61 73 73 65 64 20   options passed 
32b0: 74 6f 20 65 69 74 68 65 72 20 6f 66 0a 3c 73 74  to either of.<st
32c0: 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74  rong>tls::socket
32d0: 3c 2f 73 74 72 6f 6e 67 3e 20 6f 72 20 3c 73 74  </strong> or <st
32e0: 72 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74  rong>tls::import
32f0: 3c 2f 73 74 72 6f 6e 67 3e 2e 0a 3c 2f 70 3e 0a  </strong>..</p>.
3300: 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 64  .<blockquote>.<d
3310: 6c 3e 0a 0a 20 20 20 20 3c 64 74 3e 3c 73 74 72  l>..    <dt><str
3320: 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74  ong>-command</st
3330: 72 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61  rong> <em>callba
3340: 63 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  ck</em></dt>.   
3350: 20 3c 64 64 3e 0a 09 49 6e 76 6f 6b 65 73 20 74   <dd>..Invokes t
3360: 68 65 20 73 70 65 63 69 66 69 65 64 20 3c 65 6d  he specified <em
3370: 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 20 73  >callback</em> s
3380: 63 72 69 70 74 20 61 74 0a 09 73 65 76 65 72 61  cript at..severa
3390: 6c 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67 20  l points during 
33a0: 74 68 65 20 4f 70 65 6e 53 53 4c 20 68 61 6e 64  the OpenSSL hand
33b0: 73 68 61 6b 65 2e 0a 09 45 78 63 65 70 74 20 61  shake...Except a
33c0: 73 20 69 6e 64 69 63 61 74 65 64 20 62 65 6c 6f  s indicated belo
33d0: 77 2c 20 76 61 6c 75 65 73 20 72 65 74 75 72 6e  w, values return
33e0: 65 64 20 66 72 6f 6d 20 74 68 65 0a 09 63 61 6c  ed from the..cal
33f0: 6c 62 61 63 6b 20 61 72 65 20 69 67 6e 6f 72 65  lback are ignore
3400: 64 2e 0a 09 41 72 67 75 6d 65 6e 74 73 20 61 70  d...Arguments ap
3410: 70 65 6e 64 65 64 20 74 6f 20 74 68 65 20 73 63  pended to the sc
3420: 72 69 70 74 20 75 70 6f 6e 20 63 61 6c 6c 62 61  ript upon callba
3430: 63 6b 20 74 61 6b 65 20 6f 6e 65 20 6f 66 20 74  ck take one of t
3440: 68 65 0a 09 66 6f 6c 6c 6f 77 69 6e 67 20 66 6f  he..following fo
3450: 72 6d 73 3a 0a 0a 09 3c 62 72 3e 0a 09 3c 62 72  rms:...<br>..<br
3460: 3e 0a 0a 09 3c 64 6c 3e 0a 0a 3c 21 2d 2d 09 54  >...<dl>..<!--.T
3470: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
3480: 62 61 63 6b 20 69 73 20 64 69 73 61 62 6c 65 64  back is disabled
3490: 2e 0a 0a 09 3c 64 74 3e 0a 09 20 20 3c 73 74 72  ....<dt>..  <str
34a0: 6f 6e 67 3e 65 72 72 6f 72 3c 2f 73 74 72 6f 6e  ong>error</stron
34b0: 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 20 6d  g> <em>channel m
34c0: 65 73 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f 64  essage</em>..</d
34d0: 74 3e 0a 09 3c 64 64 3e 0a 09 20 20 54 68 65 20  t>..<dd>..  The 
34e0: 3c 65 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d 3e  <em>message</em>
34f0: 20 61 72 67 75 6d 65 6e 74 20 63 6f 6e 74 61 69   argument contai
3500: 6e 73 20 61 6e 20 65 72 72 6f 72 20 6d 65 73 73  ns an error mess
3510: 61 67 65 20 67 65 6e 65 72 61 74 65 64 0a 09 20  age generated.. 
3520: 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20   by the OpenSSL 
3530: 66 75 6e 63 74 69 6f 6e 0a 09 20 20 3c 63 6f 64  function..  <cod
3540: 65 3e 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72 72  e>ERR_reason_err
3550: 6f 72 5f 73 74 72 69 6e 67 28 29 3c 2f 63 6f 64  or_string()</cod
3560: 65 3e 2e 0a 09 3c 2f 64 64 3e 0a 0a 09 3c 62 72  e>...</dd>...<br
3570: 3e 0a 2d 2d 3e 0a 0a 09 3c 64 74 3e 0a 09 20 20  >.-->...<dt>..  
3580: 3c 73 74 72 6f 6e 67 3e 69 6e 66 6f 3c 2f 73 74  <strong>info</st
3590: 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65  rong> <em>channe
35a0: 6c 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65  l major minor me
35b0: 73 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f 64 74  ssage</em>..</dt
35c0: 3e 0a 09 3c 64 64 3e 0a 09 20 20 54 68 69 73 20  >..<dd>..  This 
35d0: 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b  form of callback
35e0: 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74   is invoked by t
35f0: 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74  he OpenSSL funct
3600: 69 6f 6e 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c  ion..  <code>SSL
3610: 5f 43 54 58 5f 73 65 74 5f 69 6e 66 6f 5f 63 61  _CTX_set_info_ca
3620: 6c 6c 62 61 63 6b 28 29 3c 2f 63 6f 64 65 3e 2e  llback()</code>.
3630: 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20  ..  <br>..  The 
3640: 3c 65 6d 3e 6d 61 6a 6f 72 3c 2f 65 6d 3e 20 61  <em>major</em> a
3650: 6e 64 20 3c 65 6d 3e 6d 69 6e 6f 72 3c 2f 65 6d  nd <em>minor</em
3660: 3e 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20  > arguments are 
3670: 75 73 65 64 20 74 6f 0a 09 20 20 72 65 70 72 65  used to..  repre
3680: 73 65 6e 74 20 74 68 65 20 73 74 61 74 65 20 69  sent the state i
3690: 6e 66 6f 72 6d 61 74 69 6f 6e 20 62 69 74 6d 61  nformation bitma
36a0: 73 6b 2e 0a 09 20 20 3c 64 6c 3e 0a 09 20 20 3c  sk...  <dl>..  <
36b0: 64 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c 75  dt>Possible valu
36c0: 65 73 20 66 6f 72 20 3c 65 6d 3e 6d 61 6a 6f 72  es for <em>major
36d0: 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e 0a  </em> are:</dt>.
36e0: 09 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 68 61 6e  .  <dd><code>han
36f0: 64 73 68 61 6b 65 2c 20 61 6c 65 72 74 2c 20 63  dshake, alert, c
3700: 6f 6e 6e 65 63 74 2c 20 61 63 63 65 70 74 3c 2f  onnect, accept</
3710: 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a 09 20 20 3c  code>.</dd>..  <
3720: 64 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c 75  dt>Possible valu
3730: 65 73 20 66 6f 72 20 3c 65 6d 3e 6d 69 6e 6f 72  es for <em>minor
3740: 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e 0a  </em> are:</dt>.
3750: 09 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 73 74 61  .  <dd><code>sta
3760: 72 74 2c 20 64 6f 6e 65 2c 20 72 65 61 64 2c 20  rt, done, read, 
3770: 77 72 69 74 65 2c 20 6c 6f 6f 70 2c 20 65 78 69  write, loop, exi
3780: 74 3c 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a 09  t</code>.</dd>..
3790: 20 20 3c 2f 64 6c 3e 0a 09 20 20 54 68 65 20 3c    </dl>..  The <
37a0: 65 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 20  em>message</em> 
37b0: 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20 64 65  argument is a de
37c0: 73 63 72 69 70 74 69 76 65 20 73 74 72 69 6e 67  scriptive string
37d0: 20 77 68 69 63 68 20 6d 61 79 0a 09 20 20 62 65   which may..  be
37e0: 20 67 65 6e 65 72 61 74 65 64 20 65 69 74 68 65   generated eithe
37f0: 72 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53 53  r by..  <code>SS
3800: 4c 5f 73 74 61 74 65 5f 73 74 72 69 6e 67 5f 6c  L_state_string_l
3810: 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e 20 6f 72 20  ong()</code> or 
3820: 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c 5f  by..  <code>SSL_
3830: 61 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69 6e  alert_desc_strin
3840: 67 5f 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e 2c  g_long()</code>,
3850: 0a 09 20 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e  ..  depending on
3860: 20 63 6f 6e 74 65 78 74 2e 0a 09 3c 2f 64 64 3e   context...</dd>
3870: 0a 0a 09 3c 62 72 3e 0a 0a 09 3c 64 74 3e 0a 09  ...<br>...<dt>..
3880: 20 20 3c 73 74 72 6f 6e 67 3e 76 65 72 69 66 79    <strong>verify
3890: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68  </strong> <em>ch
38a0: 61 6e 6e 65 6c 20 64 65 70 74 68 20 63 65 72 74  annel depth cert
38b0: 20 73 74 61 74 75 73 20 65 72 72 6f 72 3c 2f 65   status error</e
38c0: 6d 3e 0a 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e 0a  m>..</dt>..<dd>.
38d0: 09 20 20 54 68 69 73 20 66 6f 72 6d 20 6f 66 20  .  This form of 
38e0: 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f  callback is invo
38f0: 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53  ked by the OpenS
3900: 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 09 20 20 3c  SL function..  <
3910: 63 6f 64 65 3e 53 53 4c 5f 73 65 74 5f 76 65 72  code>SSL_set_ver
3920: 69 66 79 28 29 3c 2f 63 6f 64 65 3e 2e 0a 09 20  ify()</code>... 
3930: 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65 6d   <br>..  The <em
3940: 3e 64 65 70 74 68 3c 2f 65 6d 3e 20 61 72 67 75  >depth</em> argu
3950: 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e 74 65 67  ment is an integ
3960: 65 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20  er representing 
3970: 74 68 65 0a 09 20 20 63 75 72 72 65 6e 74 20 64  the..  current d
3980: 65 70 74 68 20 6f 6e 20 74 68 65 20 63 65 72 74  epth on the cert
3990: 69 66 69 63 61 74 65 20 63 68 61 69 6e 2c 20 77  ificate chain, w
39a0: 69 74 68 0a 09 20 20 3c 63 6f 64 65 3e 30 3c 2f  ith..  <code>0</
39b0: 63 6f 64 65 3e 20 61 73 20 74 68 65 20 73 75 62  code> as the sub
39c0: 6a 65 63 74 20 63 65 72 74 69 66 69 63 61 74 65  ject certificate
39d0: 20 61 6e 64 20 68 69 67 68 65 72 20 76 61 6c 75   and higher valu
39e0: 65 73 0a 09 20 20 64 65 6e 6f 74 69 6e 67 20 70  es..  denoting p
39f0: 72 6f 67 72 65 73 73 69 76 65 6c 79 20 6d 6f 72  rogressively mor
3a00: 65 20 69 6e 64 69 72 65 63 74 20 69 73 73 75 65  e indirect issue
3a10: 72 20 63 65 72 74 69 66 69 63 61 74 65 73 2e 0a  r certificates..
3a20: 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c  .  <br>..  The <
3a30: 65 6d 3e 63 65 72 74 3c 2f 65 6d 3e 20 61 72 67  em>cert</em> arg
3a40: 75 6d 65 6e 74 20 69 73 20 61 20 6c 69 73 74 20  ument is a list 
3a50: 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69  of key-value pai
3a60: 72 73 20 73 69 6d 69 6c 61 72 0a 09 20 20 74 6f  rs similar..  to
3a70: 20 74 68 6f 73 65 20 72 65 74 75 72 6e 65 64 20   those returned 
3a80: 62 79 0a 09 20 20 3c 61 20 68 72 65 66 3d 22 23  by..  <a href="#
3a90: 74 6c 73 3a 3a 73 74 61 74 75 73 22 3e 3c 73 74  tls::status"><st
3aa0: 72 6f 6e 67 3e 74 6c 73 3a 3a 73 74 61 74 75 73  rong>tls::status
3ab0: 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 2e 0a 09  </strong></a>...
3ac0: 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65    <br>..  The <e
3ad0: 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20 61 72  m>status</em> ar
3ae0: 67 75 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e 74  gument is an int
3af0: 65 67 65 72 20 72 65 70 72 65 73 65 6e 74 69 6e  eger representin
3b00: 67 20 74 68 65 0a 09 20 20 63 75 72 72 65 6e 74  g the..  current
3b10: 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 65   validity of the
3b20: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 09 20   certificate... 
3b30: 20 41 20 76 61 6c 75 65 20 6f 66 20 3c 63 6f 64   A value of <cod
3b40: 65 3e 30 3c 2f 63 6f 64 65 3e 20 6d 65 61 6e 73  e>0</code> means
3b50: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
3b60: 20 69 73 20 64 65 65 6d 65 64 20 69 6e 76 61 6c   is deemed inval
3b70: 69 64 2e 0a 09 20 20 41 20 76 61 6c 75 65 20 6f  id...  A value o
3b80: 66 20 3c 63 6f 64 65 3e 31 3c 2f 63 6f 64 65 3e  f <code>1</code>
3b90: 20 6d 65 61 6e 73 20 74 68 65 20 63 65 72 74 69   means the certi
3ba0: 66 69 63 61 74 65 20 69 73 20 64 65 65 6d 65 64  ficate is deemed
3bb0: 20 76 61 6c 69 64 2e 0a 09 20 20 3c 62 72 3e 0a   valid...  <br>.
3bc0: 09 20 20 54 68 65 20 3c 65 6d 3e 65 72 72 6f 72  .  The <em>error
3bd0: 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 73  </em> argument s
3be0: 75 70 70 6c 69 65 73 20 74 68 65 20 6d 65 73 73  upplies the mess
3bf0: 61 67 65 2c 20 69 66 20 61 6e 79 2c 20 67 65 6e  age, if any, gen
3c00: 65 72 61 74 65 64 0a 09 20 20 62 79 0a 09 20 20  erated..  by..  
3c10: 3c 63 6f 64 65 3e 58 35 30 39 5f 53 54 4f 52 45  <code>X509_STORE
3c20: 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28 29  _CTX_get_error()
3c30: 3c 2f 63 6f 64 65 3e 2e 0a 09 20 20 3c 62 72 3e  </code>...  <br>
3c40: 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20  ..  <br>..  The 
3c50: 63 61 6c 6c 62 61 63 6b 20 6d 61 79 20 6f 76 65  callback may ove
3c60: 72 72 69 64 65 20 6e 6f 72 6d 61 6c 20 76 61 6c  rride normal val
3c70: 69 64 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 69  idation processi
3c80: 6e 67 20 62 79 20 65 78 70 6c 69 63 69 74 6c 79  ng by explicitly
3c90: 0a 09 20 20 72 65 74 75 72 6e 69 6e 67 20 6f 6e  ..  returning on
3ca0: 65 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20 3c  e of the above <
3cb0: 65 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20 76  em>status</em> v
3cc0: 61 6c 75 65 73 2e 0a 09 3c 2f 64 64 3e 0a 0a 09  alues...</dd>...
3cd0: 3c 2f 64 6c 3e 0a 20 20 20 20 3c 2f 64 64 3e 0a  </dl>.    </dd>.
3ce0: 0a 20 20 20 20 3c 62 72 3e 0a 0a 20 20 20 20 3c  .    <br>..    <
3cf0: 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 73 73  dt><strong>-pass
3d00: 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  word</strong> <e
3d10: 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c  m>callback</em><
3d20: 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 0a 09 49  /dt>.    <dd>..I
3d30: 6e 76 6f 6b 65 73 20 74 68 65 20 73 70 65 63 69  nvokes the speci
3d40: 66 69 65 64 20 3c 65 6d 3e 63 61 6c 6c 62 61 63  fied <em>callbac
3d50: 6b 3c 2f 65 6d 3e 20 73 63 72 69 70 74 20 77 68  k</em> script wh
3d60: 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73  en OpenSSL needs
3d70: 20 74 6f 0a 09 6f 62 74 61 69 6e 20 61 20 70 61   to..obtain a pa
3d80: 73 73 77 6f 72 64 2e 20 20 54 68 65 20 63 61 6c  ssword.  The cal
3d90: 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65 74  lback should ret
3da0: 75 72 6e 20 61 20 73 74 72 69 6e 67 20 77 68 69  urn a string whi
3db0: 63 68 0a 09 72 65 70 72 65 73 65 6e 74 73 20 74  ch..represents t
3dc0: 68 65 20 70 61 73 73 77 6f 72 64 20 74 6f 20 62  he password to b
3dd0: 65 20 75 73 65 64 2e 0a 09 4e 6f 20 61 72 67 75  e used...No argu
3de0: 6d 65 6e 74 73 20 61 72 65 20 61 70 70 65 6e 64  ments are append
3df0: 65 64 20 74 6f 20 74 68 65 20 73 63 72 69 70 74  ed to the script
3e00: 20 75 70 6f 6e 20 63 61 6c 6c 62 61 63 6b 2e 0a   upon callback..
3e10: 20 20 20 20 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a      </dd>.</dl>.
3e20: 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 3c  </blockquote>..<
3e30: 70 3e 0a 52 65 66 65 72 65 6e 63 65 20 69 6d 70  p>.Reference imp
3e40: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20  lementations of 
3e50: 74 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73 20  these callbacks 
3e60: 61 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e 20  are provided in 
3e70: 74 68 65 0a 64 69 73 74 72 69 62 75 74 69 6f 6e  the.distribution
3e80: 20 61 73 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a   as <strong>tls:
3e90: 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73 74 72 6f 6e  :callback</stron
3ea0: 67 3e 20 61 6e 64 0a 3c 73 74 72 6f 6e 67 3e 74  g> and.<strong>t
3eb0: 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74  ls::password</st
3ec0: 72 6f 6e 67 3e 20 72 65 73 70 65 63 74 69 76 65  rong> respective
3ed0: 6c 79 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 74  ly.  Note that t
3ee0: 68 65 73 65 20 61 72 65 0a 3c 65 6d 3e 73 61 6d  hese are.<em>sam
3ef0: 70 6c 65 3c 2f 65 6d 3e 20 69 6d 70 6c 65 6d 65  ple</em> impleme
3f00: 6e 74 61 74 69 6f 6e 73 20 6f 6e 6c 79 2e 20 20  ntations only.  
3f10: 49 6e 20 61 20 6d 6f 72 65 20 72 65 61 6c 69 73  In a more realis
3f20: 74 69 63 20 64 65 70 6c 6f 79 6d 65 6e 74 0a 79  tic deployment.y
3f30: 6f 75 20 77 6f 75 6c 64 20 73 70 65 63 69 66 79  ou would specify
3f40: 20 79 6f 75 72 20 6f 77 6e 20 63 61 6c 6c 62 61   your own callba
3f50: 63 6b 20 73 63 72 69 70 74 73 20 6f 6e 20 65 61  ck scripts on ea
3f60: 63 68 20 54 4c 53 20 63 68 61 6e 6e 65 6c 0a 75  ch TLS channel.u
3f70: 73 69 6e 67 20 74 68 65 20 3c 65 6d 3e 2d 63 6f  sing the <em>-co
3f80: 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20 3c  mmand</em> and <
3f90: 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d  em>-password</em
3fa0: 3e 20 6f 70 74 69 6f 6e 73 2e 0a 3c 2f 70 3e 0a  > options..</p>.
3fb0: 0a 3c 70 3e 0a 54 68 65 20 64 65 66 61 75 6c 74  .<p>.The default
3fc0: 20 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74   behavior when t
3fd0: 68 65 20 3c 65 6d 3e 2d 63 6f 6d 6d 61 6e 64 3c  he <em>-command<
3fe0: 2f 65 6d 3e 20 6f 70 74 69 6f 6e 20 69 73 20 6e  /em> option is n
3ff0: 6f 74 20 73 70 65 63 69 66 69 65 64 20 69 73 20  ot specified is 
4000: 66 6f 72 0a 54 4c 53 20 74 6f 20 70 72 6f 63 65  for.TLS to proce
4010: 73 73 20 74 68 65 20 61 73 73 6f 63 69 61 74 65  ss the associate
4020: 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62 61  d library callba
4030: 63 6b 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2e 0a  cks internally..
4040: 54 68 65 20 64 65 66 61 75 6c 74 20 62 65 68 61  The default beha
4050: 76 69 6f 72 20 77 68 65 6e 20 74 68 65 20 3c 65  vior when the <e
4060: 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d 3e  m>-password</em>
4070: 20 6f 70 74 69 6f 6e 20 69 73 20 6e 6f 74 20 73   option is not s
4080: 70 65 63 69 66 69 65 64 20 69 73 20 66 6f 72 0a  pecified is for.
4090: 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74  TLS to process t
40a0: 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69  he associated li
40b0: 62 72 61 72 79 20 63 61 6c 6c 62 61 63 6b 73 20  brary callbacks 
40c0: 62 79 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f  by attempting to
40d0: 20 63 61 6c 6c 0a 3c 73 74 72 6f 6e 67 3e 74 6c   call.<strong>tl
40e0: 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74 72  s::password</str
40f0: 6f 6e 67 3e 2e 0a 54 68 65 20 64 69 66 66 65 72  ong>..The differ
4100: 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65  ence between the
4110: 73 65 20 74 77 6f 20 62 65 68 61 76 69 6f 72 73  se two behaviors
4120: 20 69 73 20 61 20 63 6f 6e 73 65 71 75 65 6e 63   is a consequenc
4130: 65 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e 67  e of maintaining
4140: 0a 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 77  .compatibility w
4150: 69 74 68 20 65 61 72 6c 69 65 72 20 69 6d 70 6c  ith earlier impl
4160: 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a 3c 2f 70  ementations..</p
4170: 3e 0a 0a 3c 70 3e 0a 54 68 65 20 3c 73 74 72 6f  >..<p>.The <stro
4180: 6e 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f 73  ng>tls::debug</s
4190: 74 72 6f 6e 67 3e 20 76 61 72 69 61 62 6c 65 20  trong> variable 
41a0: 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61 64  provides some ad
41b0: 64 69 74 69 6f 6e 61 6c 0a 63 6f 6e 74 72 6f 6c  ditional.control
41c0: 20 6f 76 65 72 20 74 68 65 73 65 20 72 65 66 65   over these refe
41d0: 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73 2e  rence callbacks.
41e0: 20 20 49 74 73 20 76 61 6c 75 65 20 69 73 20 7a    Its value is z
41f0: 65 72 6f 20 62 79 20 64 65 66 61 75 6c 74 2e 0a  ero by default..
4200: 48 69 67 68 65 72 20 76 61 6c 75 65 73 20 70 72  Higher values pr
4210: 6f 64 75 63 65 20 6d 6f 72 65 20 64 69 61 67 6e  oduce more diagn
4220: 6f 73 74 69 63 20 6f 75 74 70 75 74 2c 20 61 6e  ostic output, an
4230: 64 20 77 69 6c 6c 20 61 6c 73 6f 20 66 6f 72 63  d will also forc
4240: 65 20 74 68 65 0a 76 65 72 69 66 79 20 6d 65 74  e the.verify met
4250: 68 6f 64 20 69 6e 20 3c 73 74 72 6f 6e 67 3e 74  hod in <strong>t
4260: 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73 74  ls::callback</st
4270: 72 6f 6e 67 3e 20 74 6f 20 61 63 63 65 70 74 20  rong> to accept 
4280: 74 68 65 0a 63 65 72 74 69 66 69 63 61 74 65 2c  the.certificate,
4290: 20 65 76 65 6e 20 77 68 65 6e 20 69 74 20 69 73   even when it is
42a0: 20 69 6e 76 61 6c 69 64 2e 0a 3c 2f 70 3e 0a 0a   invalid..</p>..
42b0: 3c 70 3e 0a 3c 65 6d 3e 0a 54 68 65 20 75 73 65  <p>.<em>.The use
42c0: 20 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e 63   of the referenc
42d0: 65 20 63 61 6c 6c 62 61 63 6b 73 20 3c 73 74 72  e callbacks <str
42e0: 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 63  ong>tls::callbac
42f0: 6b 3c 2f 73 74 72 6f 6e 67 3e 20 61 6e 64 0a 3c  k</strong> and.<
4300: 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 70 61 73 73  strong>tls::pass
4310: 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 69 73  word</strong> is
4320: 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64   not recommended
4330: 2e 20 20 54 68 65 79 20 6d 61 79 20 62 65 20 72  .  They may be r
4340: 65 6d 6f 76 65 64 0a 66 72 6f 6d 20 66 75 74 75  emoved.from futu
4350: 72 65 20 72 65 6c 65 61 73 65 73 2e 0a 3c 2f 65  re releases..</e
4360: 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 70 3e 0a 3c 65 6d  m>.</p>..<p>.<em
4370: 3e 0a 54 68 65 20 75 73 65 20 6f 66 20 74 68 65  >.The use of the
4380: 20 76 61 72 69 61 62 6c 65 20 3c 73 74 72 6f 6e   variable <stron
4390: 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f 73 74  g>tls::debug</st
43a0: 72 6f 6e 67 3e 20 69 73 20 6e 6f 74 20 72 65 63  rong> is not rec
43b0: 6f 6d 6d 65 6e 64 65 64 2e 0a 49 74 20 6d 61 79  ommended..It may
43c0: 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d   be removed from
43d0: 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 73   future releases
43e0: 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 68  ..</em>.</p>..<h
43f0: 33 3e 3c 61 20 6e 61 6d 65 3d 22 44 45 42 55 47  3><a name="DEBUG
4400: 22 3e 44 45 42 55 47 3c 2f 61 3e 3c 2f 68 33 3e  ">DEBUG</a></h3>
4410: 0a 0a 54 4c 53 20 6b 65 79 20 6c 6f 67 67 69 6e  ..TLS key loggin
4420: 67 20 63 61 6e 20 62 65 20 65 6e 61 62 6c 65 64  g can be enabled
4430: 20 62 79 20 73 65 74 74 69 6e 67 20 74 68 65 20   by setting the 
4440: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69  environment vari
4450: 61 62 6c 65 0a 3c 62 3e 53 53 4c 4b 45 59 4c 4f  able.<b>SSLKEYLO
4460: 47 46 49 4c 45 3c 2f 62 3e 20 74 6f 20 74 68 65  GFILE</b> to the
4470: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 66 69 6c   name of the fil
4480: 65 20 74 6f 20 6c 6f 67 20 74 6f 2e 20 54 68 65  e to log to. The
4490: 6e 20 77 68 65 6e 65 76 65 72 20 54 4c 53 0a 6b  n whenever TLS.k
44a0: 65 79 20 6d 61 74 65 72 69 61 6c 20 69 73 20 67  ey material is g
44b0: 65 6e 65 72 61 74 65 64 20 6f 72 20 72 65 63 65  enerated or rece
44c0: 69 76 65 64 20 69 74 20 77 69 6c 6c 20 62 65 20  ived it will be 
44d0: 6c 6f 67 67 65 64 20 74 6f 20 74 68 65 20 66 69  logged to the fi
44e0: 6c 65 2e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65  le...<h3><a name
44f0: 3d 22 48 54 54 50 53 20 45 58 41 4d 50 4c 45 22  ="HTTPS EXAMPLE"
4500: 3e 48 54 54 50 53 20 45 58 41 4d 50 4c 45 3c 2f  >HTTPS EXAMPLE</
4510: 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 69 73  a></h3>..<p>This
4520: 20 65 78 61 6d 70 6c 65 20 75 73 65 73 20 61 20   example uses a 
4530: 73 61 6d 70 6c 65 20 73 65 72 76 65 72 2e 70 65  sample server.pe
4540: 6d 20 70 72 6f 76 69 64 65 64 20 77 69 74 68 20  m provided with 
4550: 74 68 65 20 54 4c 53 20 72 65 6c 65 61 73 65 2c  the TLS release,
4560: 0a 63 6f 75 72 74 65 73 79 20 6f 66 20 74 68 65  .courtesy of the
4570: 20 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c   <strong>OpenSSL
4580: 3c 2f 73 74 72 6f 6e 67 3e 20 70 72 6f 6a 65 63  </strong> projec
4590: 74 2e 3c 2f 70 3e 0a 0a 3c 70 72 65 3e 3c 63 6f  t.</p>..<pre><co
45a0: 64 65 3e 0a 70 61 63 6b 61 67 65 20 72 65 71 75  de>.package requ
45b0: 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67 65  ire http.package
45c0: 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 68 74   require tls..ht
45d0: 74 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74  tp::register htt
45e0: 70 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74  ps 443 [list ::t
45f0: 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f  ls::socket -auto
4600: 73 65 72 76 65 72 6e 61 6d 65 20 74 72 75 65 20  servername true 
4610: 2d 72 65 71 75 69 72 65 20 74 72 75 65 20 2d 63  -require true -c
4620: 61 64 69 72 20 2f 65 74 63 2f 73 73 6c 2f 63 65  adir /etc/ssl/ce
4630: 72 74 73 5d 0a 0a 73 65 74 20 74 6f 6b 20 5b 68  rts]..set tok [h
4640: 74 74 70 3a 3a 67 65 74 75 72 6c 20 68 74 74 70  ttp::geturl http
4650: 73 3a 2f 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f 5d  s://www.tcl.tk/]
4660: 0a 3c 2f 63 6f 64 65 3e 3c 2f 70 72 65 3e 0a 0a  .</code></pre>..
4670: 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 50 45  <h3><a name="SPE
4680: 43 49 41 4c 20 43 4f 4e 53 49 44 45 52 41 54 49  CIAL CONSIDERATI
4690: 4f 4e 53 22 3e 53 50 45 43 49 41 4c 20 43 4f 4e  ONS">SPECIAL CON
46a0: 53 49 44 45 52 41 54 49 4f 4e 53 3c 2f 61 3e 3c  SIDERATIONS</a><
46b0: 2f 68 33 3e 0a 0a 3c 70 3e 54 68 65 20 63 61 70  /h3>..<p>The cap
46c0: 61 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69  abilities of thi
46d0: 73 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61  s package can va
46e0: 72 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61  ry enormously ba
46f0: 73 65 64 0a 75 70 6f 6e 20 68 6f 77 20 79 6f 75  sed.upon how you
4700: 72 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72  r OpenSSL librar
4710: 79 20 77 61 73 20 63 6f 6e 66 69 67 75 72 65 64  y was configured
4720: 20 61 6e 64 20 62 75 69 6c 74 2e 20 41 74 20 74   and built. At t
4730: 68 65 0a 6d 6f 73 74 20 6d 61 63 72 6f 2d 6c 65  he.most macro-le
4740: 76 65 6c 20 4f 70 65 6e 53 53 4c 20 73 75 70 70  vel OpenSSL supp
4750: 6f 72 74 73 20 61 20 26 71 75 6f 74 3b 6e 6f 20  orts a &quot;no 
4760: 70 61 74 65 6e 74 73 26 71 75 6f 74 3b 20 62 75  patents&quot; bu
4770: 69 6c 64 2c 0a 77 68 69 63 68 20 64 69 73 61 62  ild,.which disab
4780: 6c 65 73 20 52 53 41 2c 20 49 44 45 41 2c 20 52  les RSA, IDEA, R
4790: 43 28 32 2c 34 2c 35 29 20 61 6e 64 20 53 53 4c  C(2,4,5) and SSL
47a0: 32 20 2d 20 69 66 20 79 6f 75 72 20 4f 70 65 6e  2 - if your Open
47b0: 53 53 4c 20 69 73 0a 63 6f 6e 66 69 67 75 72 65  SSL is.configure
47c0: 64 20 74 68 69 73 20 77 61 79 20 74 68 65 6e 20  d this way then 
47d0: 79 6f 75 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f  you will need to
47e0: 20 62 75 69 6c 64 20 54 4c 53 20 77 69 74 68 20   build TLS with 
47f0: 74 68 65 0a 2d 44 4e 4f 5f 50 41 54 45 4e 54 53  the.-DNO_PATENTS
4800: 20 6f 70 74 69 6f 6e 20 2d 20 61 6e 64 20 74 68   option - and th
4810: 65 20 72 65 73 75 6c 74 61 6e 74 20 6d 6f 64 75  e resultant modu
4820: 6c 65 20 77 69 6c 6c 20 66 75 6e 63 74 69 6f 6e  le will function
4830: 0a 63 6f 72 72 65 63 74 6c 79 20 61 6e 64 20 61  .correctly and a
4840: 6c 73 6f 20 73 75 70 70 6f 72 74 20 41 44 48 20  lso support ADH 
4850: 63 65 72 74 69 66 69 63 61 74 65 2d 6c 65 73 73  certificate-less
4860: 20 65 6e 63 72 79 70 74 69 6f 6e 2c 0a 68 6f 77   encryption,.how
4870: 65 76 65 72 20 79 6f 75 20 77 69 6c 6c 20 62 65  ever you will be
4880: 20 75 6e 61 62 6c 65 20 74 6f 20 75 74 69 6c 69   unable to utili
4890: 7a 65 20 74 68 69 73 20 74 6f 20 73 70 65 61 6b  ze this to speak
48a0: 20 74 6f 20 6e 6f 72 6d 61 6c 20 57 65 62 0a 53   to normal Web.S
48b0: 65 72 76 65 72 73 2c 20 77 68 69 63 68 20 74 79  ervers, which ty
48c0: 70 69 63 61 6c 6c 79 20 72 65 71 75 69 72 65 20  pically require 
48d0: 52 53 41 20 73 75 70 70 6f 72 74 2e 20 50 6c 65  RSA support. Ple
48e0: 61 73 65 20 73 65 65 20 3c 61 0a 68 72 65 66 3d  ase see <a.href=
48f0: 22 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e  "http://www.open
4900: 73 73 6c 2e 6f 72 67 2f 22 3e 68 74 74 70 3a 2f  ssl.org/">http:/
4910: 2f 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67  /www.openssl.org
4920: 2f 3c 2f 61 3e 20 66 6f 72 0a 6d 6f 72 65 20 69  /</a> for.more i
4930: 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68  nformation on th
4940: 65 20 77 68 6f 6c 65 20 69 73 73 75 65 20 6f 66  e whole issue of
4950: 20 70 61 74 65 6e 74 73 20 61 6e 64 20 55 53 20   patents and US 
4960: 65 78 70 6f 72 74 0a 72 65 73 74 72 69 63 74 69  export.restricti
4970: 6f 6e 73 2e 20 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c  ons. </p>..<h3><
4980: 61 20 6e 61 6d 65 3d 22 53 45 45 20 41 4c 53 4f  a name="SEE ALSO
4990: 22 3e 53 45 45 20 41 4c 53 4f 3c 2f 61 3e 3c 2f  ">SEE ALSO</a></
49a0: 68 33 3e 0a 0a 3c 70 3e 3c 73 74 72 6f 6e 67 3e  h3>..<p><strong>
49b0: 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 2c  socket</strong>,
49c0: 20 3c 73 74 72 6f 6e 67 3e 66 69 6c 65 65 76 65   <strong>fileeve
49d0: 6e 74 2c 20 3c 2f 73 74 72 6f 6e 67 3e 3c 61 0a  nt, </strong><a.
49e0: 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77  href="http://www
49f0: 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 3c  .openssl.org/"><
4a00: 73 74 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f  strong>OpenSSL</
4a10: 73 74 72 6f 6e 67 3e 3c 2f 61 3e 3c 2f 70 3e 0a  strong></a></p>.
4a20: 0a 3c 68 72 3e 0a 0a 3c 70 72 65 3e 0a 43 6f 70  .<hr>..<pre>.Cop
4a30: 79 72 69 67 68 74 20 26 63 6f 70 79 3b 20 31 39  yright &copy; 19
4a40: 39 39 20 4d 61 74 74 20 4e 65 77 6d 61 6e 2e 0a  99 Matt Newman..
4a50: 43 6f 70 79 72 69 67 68 74 20 26 63 6f 70 79 3b  Copyright &copy;
4a60: 20 32 30 30 34 20 53 74 61 72 66 69 73 68 20 53   2004 Starfish S
4a70: 79 73 74 65 6d 73 2e 0a 3c 2f 70 72 65 3e 0a 3c  ystems..</pre>.<
4a80: 2f 62 6f 64 79 3e 0a 3c 2f 68 74 6d 6c 3e 0a     /body>.</html>.