Hex Artifact Content

Artifact 60845f0ae53a61772fcadd1d8ff258aeed395db5d08e852fc843aa24c36e14f3:


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 3c 2f 64 6c 3e  .</dd>.    </dl>
18b0: 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a  .</blockquote>..
18c0: 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20  <dl>.    <dt><a 
18d0: 6e 61 6d 65 3d 22 74 6c 73 3a 3a 69 6d 70 6f 72  name="tls::impor
18e0: 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70 6f 72  t"><b>tls::impor
18f0: 74 20 3c 2f 62 3e 3c 69 3e 63 68 61 6e 6e 65 6c  t </b><i>channel
1900: 0a 20 20 20 20 20 20 20 20 3f 6f 70 74 69 6f 6e  .        ?option
1910: 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a  s?</i></a></dt>.
1920: 20 20 20 20 3c 64 64 3e 53 53 4c 2d 65 6e 61 62      <dd>SSL-enab
1930: 6c 65 20 61 20 72 65 67 75 6c 61 72 20 54 63 6c  le a regular Tcl
1940: 20 63 68 61 6e 6e 65 6c 20 2d 20 69 74 20 6e 65   channel - it ne
1950: 65 64 20 6e 6f 74 20 62 65 20 61 0a 20 20 20 20  ed not be a.    
1960: 20 20 20 20 73 6f 63 6b 65 74 2c 20 62 75 74 20      socket, but 
1970: 6d 75 73 74 20 70 72 6f 76 69 64 65 20 62 69 2d  must provide bi-
1980: 64 69 72 65 63 74 69 6f 6e 61 6c 20 66 6c 6f 77  directional flow
1990: 2e 20 41 6c 73 6f 0a 20 20 20 20 20 20 20 20 73  . Also.        s
19a0: 65 74 74 69 6e 67 20 73 65 73 73 69 6f 6e 20 70  etting session p
19b0: 61 72 61 6d 65 74 65 72 73 20 66 6f 72 20 53 53  arameters for SS
19c0: 4c 20 68 61 6e 64 73 68 61 6b 65 2e 3c 2f 64 64  L handshake.</dd
19d0: 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 62 6c 6f 63 6b 71  >.</dl>..<blockq
19e0: 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20  uote>.    <dl>. 
19f0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
1a00: 6e 67 3e 2d 63 61 64 69 72 3c 2f 73 74 72 6f 6e  ng>-cadir</stron
1a10: 67 3e 20 3c 65 6d 3e 64 69 72 3c 2f 65 6d 3e 3c  g> <em>dir</em><
1a20: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
1a30: 3e 50 72 6f 76 69 64 65 20 74 68 65 20 64 69 72  >Provide the dir
1a40: 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e  ectory containin
1a50: 67 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69  g the CA certifi
1a60: 63 61 74 65 73 2e 3c 2f 64 64 3e 0a 20 20 20 20  cates.</dd>.    
1a70: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
1a80: 2d 63 61 66 69 6c 65 20 3c 2f 73 74 72 6f 6e 67  -cafile </strong
1a90: 3e 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65  ><em>filename</e
1aa0: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
1ab0: 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20  <dd>Provide the 
1ac0: 43 41 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20  CA file.</dd>.  
1ad0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
1ae0: 67 3e 2d 63 65 72 74 66 69 6c 65 3c 2f 73 74 72  g>-certfile</str
1af0: 6f 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d  ong> <em>filenam
1b00: 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  e</em></dt>.    
1b10: 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20      <dd>Provide 
1b20: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
1b30: 74 6f 20 75 73 65 2e 3c 2f 64 64 3e 0a 20 20 20  to use.</dd>.   
1b40: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
1b50: 3e 2d 63 69 70 68 65 72 20 3c 2f 73 74 72 6f 6e  >-cipher </stron
1b60: 67 3e 3c 65 6d 3e 73 74 72 69 6e 67 3c 2f 65 6d  g><em>string</em
1b70: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c  ></dt>.        <
1b80: 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 63  dd>Provide the c
1b90: 69 70 68 65 72 20 73 75 69 74 65 73 20 74 6f 20  ipher suites to 
1ba0: 75 73 65 2e 20 53 79 6e 74 61 78 20 69 73 20 61  use. Syntax is a
1bb0: 73 20 70 65 72 0a 20 20 20 20 20 20 20 20 20 20  s per.          
1bc0: 20 20 4f 70 65 6e 53 53 4c 2e 3c 2f 64 64 3e 0a    OpenSSL.</dd>.
1bd0: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
1be0: 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74  ong>-command</st
1bf0: 72 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61  rong> <em>callba
1c00: 63 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  ck</em></dt>.   
1c10: 20 20 20 20 20 3c 64 64 3e 49 66 20 73 70 65 63       <dd>If spec
1c20: 69 66 69 65 64 2c 20 74 68 69 73 20 63 61 6c 6c  ified, this call
1c30: 62 61 63 6b 20 77 69 6c 6c 20 62 65 20 69 6e 76  back will be inv
1c40: 6f 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20  oked at several 
1c50: 70 6f 69 6e 74 73 0a 20 20 20 20 20 20 20 20 20  points.         
1c60: 20 20 20 64 75 72 69 6e 67 20 74 68 65 20 4f 70     during the Op
1c70: 65 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e  enSSL handshake.
1c80: 20 20 49 74 20 63 61 6e 20 70 61 73 73 20 65 72    It can pass er
1c90: 72 6f 72 73 20 61 6e 64 20 74 72 61 63 69 6e 67  rors and tracing
1ca0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 66  .            inf
1cb0: 6f 72 6d 61 74 69 6f 6e 2c 20 61 6e 64 20 69 74  ormation, and it
1cc0: 20 63 61 6e 20 61 6c 6c 6f 77 20 54 63 6c 20 73   can allow Tcl s
1cd0: 63 72 69 70 74 73 20 74 6f 20 70 65 72 66 6f 72  cripts to perfor
1ce0: 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 68  m.            th
1cf0: 65 69 72 20 6f 77 6e 20 76 61 6c 69 64 61 74 69  eir own validati
1d00: 6f 6e 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  on of the certif
1d10: 69 63 61 74 65 20 69 6e 20 70 6c 61 63 65 20 6f  icate in place o
1d20: 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20  f the.          
1d30: 20 20 64 65 66 61 75 6c 74 20 76 61 6c 69 64 61    default valida
1d40: 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79  tion provided by
1d50: 20 4f 70 65 6e 53 53 4c 2e 0a 20 20 20 20 20 20   OpenSSL..      
1d60: 20 20 20 20 20 20 3c 62 72 3e 0a 20 20 20 20 20        <br>.     
1d70: 20 20 20 20 20 20 20 53 65 65 20 3c 61 20 68 72         See <a hr
1d80: 65 66 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50  ef="#CALLBACK OP
1d90: 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20  TIONS">CALLBACK 
1da0: 4f 50 54 49 4f 4e 53 3c 2f 61 3e 20 66 6f 72 0a  OPTIONS</a> for.
1db0: 20 20 20 20 20 20 20 20 20 20 20 20 66 75 72 74              furt
1dc0: 68 65 72 20 64 69 73 63 75 73 73 69 6f 6e 2e 3c  her discussion.<
1dd0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
1de0: 3e 3c 73 74 72 6f 6e 67 3e 2d 64 68 70 61 72 61  ><strong>-dhpara
1df0: 6d 73 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e  ms </strong><em>
1e00: 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64  filename</em></d
1e10: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50  t>.        <dd>P
1e20: 72 6f 76 69 64 65 20 61 20 44 69 66 66 69 65 2d  rovide a Diffie-
1e30: 48 65 6c 6c 6d 61 6e 20 70 61 72 61 6d 65 74 65  Hellman paramete
1e40: 72 73 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20  rs file.</dd>.  
1e50: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
1e60: 67 3e 2d 6b 65 79 66 69 6c 65 3c 2f 73 74 72 6f  g>-keyfile</stro
1e70: 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65  ng> <em>filename
1e80: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
1e90: 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74     <dd>Provide t
1ea0: 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 66  he private key f
1eb0: 69 6c 65 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65  ile. (<strong>de
1ec0: 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 0a  fault</strong>:.
1ed0: 20 20 20 20 20 20 20 20 20 20 20 20 76 61 6c 75              valu
1ee0: 65 20 6f 66 20 2d 63 65 72 74 66 69 6c 65 29 3c  e of -certfile)<
1ef0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
1f00: 3e 3c 73 74 72 6f 6e 67 3e 2d 6d 6f 64 65 6c 3c  ><strong>-model<
1f10: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61  /strong> <em>cha
1f20: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20  nnel</em></dt>. 
1f30: 20 20 20 20 20 20 20 3c 64 64 3e 54 68 69 73 20         <dd>This 
1f40: 77 69 6c 6c 20 66 6f 72 63 65 20 74 68 69 73 20  will force this 
1f50: 63 68 61 6e 6e 65 6c 20 74 6f 20 73 68 61 72 65  channel to share
1f60: 20 74 68 65 20 73 61 6d 65 20 3c 65 6d 3e 3c 73   the same <em><s
1f70: 74 72 6f 6e 67 3e 53 53 4c 5f 43 54 58 3c 2f 73  trong>SSL_CTX</s
1f80: 74 72 6f 6e 67 3e 3c 2f 65 6d 3e 0a 20 20 20 20  trong></em>.    
1f90: 20 20 20 20 20 20 20 20 73 74 72 75 63 74 75 72          structur
1fa0: 65 20 61 73 20 74 68 65 20 73 70 65 63 69 66 69  e as the specifi
1fb0: 65 64 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f  ed <em>channel</
1fc0: 65 6d 3e 2c 20 61 6e 64 0a 20 20 20 20 20 20 20  em>, and.       
1fd0: 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 20 73       therefore s
1fe0: 68 61 72 65 20 63 61 6c 6c 62 61 63 6b 73 20 65  hare callbacks e
1ff0: 74 63 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20  tc.</dd>.       
2000: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61   <dt><strong>-pa
2010: 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20  ssword</strong> 
2020: 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d  <em>callback</em
2030: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c  ></dt>.        <
2040: 64 64 3e 49 66 20 73 75 70 70 6c 69 65 64 2c 20  dd>If supplied, 
2050: 74 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 69  this callback wi
2060: 6c 6c 20 62 65 20 69 6e 76 6f 6b 65 64 20 77 68  ll be invoked wh
2070: 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73  en OpenSSL needs
2080: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 6f 20  .            to 
2090: 6f 62 74 61 69 6e 20 61 20 70 61 73 73 77 6f 72  obtain a passwor
20a0: 64 2c 20 74 79 70 69 63 61 6c 6c 79 20 74 6f 20  d, typically to 
20b0: 75 6e 6c 6f 63 6b 20 74 68 65 20 70 72 69 76 61  unlock the priva
20c0: 74 65 20 6b 65 79 20 6f 66 0a 09 20 20 20 20 61  te key of..    a
20d0: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 20 20   certificate..  
20e0: 20 20 20 20 20 20 20 20 20 20 54 68 65 20 63 61            The ca
20f0: 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65  llback should re
2100: 74 75 72 6e 20 61 20 73 74 72 69 6e 67 20 77 68  turn a string wh
2110: 69 63 68 20 72 65 70 72 65 73 65 6e 74 73 20 74  ich represents t
2120: 68 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 70  he.            p
2130: 61 73 73 77 6f 72 64 20 74 6f 20 62 65 20 75 73  assword to be us
2140: 65 64 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20  ed..            
2150: 3c 62 72 3e 0a 20 20 20 20 20 20 20 20 20 20 20  <br>.           
2160: 20 53 65 65 20 3c 61 20 68 72 65 66 3d 22 23 43   See <a href="#C
2170: 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 22  ALLBACK OPTIONS"
2180: 3e 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e  >CALLBACK OPTION
2190: 53 3c 2f 61 3e 20 66 6f 72 0a 20 20 20 20 20 20  S</a> for.      
21a0: 20 20 20 20 20 20 66 75 72 74 68 65 72 20 64 69        further di
21b0: 73 63 75 73 73 69 6f 6e 2e 3c 2f 64 64 3e 0a 20  scussion.</dd>. 
21c0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
21d0: 6e 67 3e 2d 72 65 71 75 65 73 74 20 3c 2f 73 74  ng>-request </st
21e0: 72 6f 6e 67 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65  rong><em>bool</e
21f0: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
2200: 3c 64 64 3e 52 65 71 75 65 73 74 20 61 20 63 65  <dd>Request a ce
2210: 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 70  rtificate from p
2220: 65 65 72 20 64 75 72 69 6e 67 20 53 53 4c 20 68  eer during SSL h
2230: 61 6e 64 73 68 61 6b 65 2e 0a 20 20 20 20 20 20  andshake..      
2240: 20 20 20 20 20 20 28 3c 73 74 72 6f 6e 67 3e 64        (<strong>d
2250: 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a  efault</strong>:
2260: 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c   <em>true</em>)<
2270: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
2280: 3e 3c 73 74 72 6f 6e 67 3e 2d 72 65 71 75 69 72  ><strong>-requir
2290: 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62  e</strong> <em>b
22a0: 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ool</em></dt>.  
22b0: 20 20 20 20 20 20 3c 64 64 3e 52 65 71 75 69 72        <dd>Requir
22c0: 65 20 61 20 76 61 6c 69 64 20 63 65 72 74 69 66  e a valid certif
22d0: 69 63 61 74 65 20 66 72 6f 6d 20 70 65 65 72 20  icate from peer 
22e0: 64 75 72 69 6e 67 20 53 53 4c 0a 20 20 20 20 20  during SSL.     
22f0: 20 20 20 20 20 20 20 68 61 6e 64 73 68 61 6b 65         handshake
2300: 2e 20 49 66 20 74 68 69 73 20 69 73 20 73 65 74  . If this is set
2310: 20 74 6f 20 74 72 75 65 20 74 68 65 6e 20 3c 73   to true then <s
2320: 74 72 6f 6e 67 3e 2d 72 65 71 75 65 73 74 3c 2f  trong>-request</
2330: 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20  strong>.        
2340: 20 20 20 20 6d 75 73 74 20 61 6c 73 6f 20 62 65      must also be
2350: 20 73 65 74 20 74 6f 20 74 72 75 65 2e 20 28 3c   set to true. (<
2360: 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f  strong>default</
2370: 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c  strong>: <em>fal
2380: 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20  se</em>)</dd>.  
2390: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
23a0: 67 3e 2d 73 65 72 76 65 72 3c 2f 73 74 72 6f 6e  g>-server</stron
23b0: 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e  g> <em>bool</em>
23c0: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
23d0: 64 3e 48 61 6e 64 73 68 61 6b 65 20 61 73 20 73  d>Handshake as s
23e0: 65 72 76 65 72 20 69 66 20 74 72 75 65 2c 20 65  erver if true, e
23f0: 6c 73 65 20 68 61 6e 64 73 68 61 6b 65 20 61 73  lse handshake as
2400: 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 6c 69  .            cli
2410: 65 6e 74 2e 28 3c 73 74 72 6f 6e 67 3e 64 65 66  ent.(<strong>def
2420: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c  ault</strong>: <
2430: 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f  em>false</em>)</
2440: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
2450: 3c 73 74 72 6f 6e 67 3e 2d 73 65 72 76 65 72 6e  <strong>-servern
2460: 61 6d 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  ame</strong> <em
2470: 3e 68 6f 73 74 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  >host</em></dt>.
2480: 20 20 20 20 20 20 20 20 3c 64 64 3e 4f 6e 6c 79          <dd>Only
2490: 20 61 76 61 69 6c 61 62 6c 65 20 69 66 20 74 68   available if th
24a0: 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72  e OpenSSL librar
24b0: 79 20 74 68 65 20 70 61 63 6b 61 67 65 20 69 73  y the package is
24c0: 20 6c 69 6e 6b 65 64 0a 09 20 20 20 20 61 67 61   linked..    aga
24d0: 69 6e 73 74 20 73 75 70 70 6f 72 74 73 20 74 68  inst supports th
24e0: 65 20 54 4c 53 20 68 6f 73 74 6e 61 6d 65 20 65  e TLS hostname e
24f0: 78 74 65 6e 73 69 6f 6e 20 66 6f 72 20 27 53 65  xtension for 'Se
2500: 72 76 65 72 20 4e 61 6d 65 0a 09 20 20 20 20 49  rver Name..    I
2510: 6e 64 69 63 61 74 69 6f 6e 27 20 28 53 4e 49 29  ndication' (SNI)
2520: 2e 20 55 73 65 20 74 6f 20 6e 61 6d 65 20 74 68  . Use to name th
2530: 65 20 6c 6f 67 69 63 61 6c 20 68 6f 73 74 20 77  e logical host w
2540: 65 20 61 72 65 20 74 61 6c 6b 69 6e 67 0a 09 20  e are talking.. 
2550: 20 20 20 74 6f 20 61 6e 64 20 65 78 70 65 63 74     to and expect
2560: 69 6e 67 20 61 20 63 65 72 74 69 66 69 63 61 74  ing a certificat
2570: 65 20 66 6f 72 3c 2f 64 64 3e 0a 20 20 20 20 20  e for</dd>.     
2580: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
2590: 73 73 6c 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  ssl2</strong> <e
25a0: 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>bool</em></dt>
25b0: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61  .        <dd>Ena
25c0: 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20 76  ble use of SSL v
25d0: 32 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61  2. (<strong>defa
25e0: 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65  ult</strong>: <e
25f0: 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64  m>false</em>)</d
2600: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
2610: 73 74 72 6f 6e 67 3e 2d 73 73 6c 33 20 3c 2f 73  strong>-ssl3 </s
2620: 74 72 6f 6e 67 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f  trong><em>bool</
2630: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
2640: 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65 20   <dd>Enable use 
2650: 6f 66 20 53 53 4c 20 76 33 2e 20 28 3c 73 74 72  of SSL v3. (<str
2660: 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72  ong>default</str
2670: 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c  ong>: <em>false<
2680: 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20  /em>)</dd>.     
2690: 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67 3e     <dt>-<strong>
26a0: 74 6c 73 31 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  tls1</strong> <e
26b0: 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>bool</em></dt>
26c0: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61  .        <dd>Ena
26d0: 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76  ble use of TLS v
26e0: 31 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61  1. (<strong>defa
26f0: 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65  ult</strong>: <e
2700: 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64  m>true</em>)</dd
2710: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 2d 3c  >.        <dt>-<
2720: 73 74 72 6f 6e 67 3e 74 6c 73 31 2e 31 3c 2f 73  strong>tls1.1</s
2730: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c  trong> <em>bool<
2740: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
2750: 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65    <dd>Enable use
2760: 20 6f 66 20 54 4c 53 20 76 31 2e 31 20 28 3c 73   of TLS v1.1 (<s
2770: 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73  trong>default</s
2780: 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72 75 65  trong>: <em>true
2790: 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20  </em>)</dd>.    
27a0: 20 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67      <dt>-<strong
27b0: 3e 74 6c 73 31 2e 32 3c 2f 73 74 72 6f 6e 67 3e  >tls1.2</strong>
27c0: 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f   <em>bool</em></
27d0: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e  dt>.        <dd>
27e0: 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c  Enable use of TL
27f0: 53 20 76 31 2e 32 20 28 3c 73 74 72 6f 6e 67 3e  S v1.2 (<strong>
2800: 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e  default</strong>
2810: 3a 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29  : <em>true</em>)
2820: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dd>.        <d
2830: 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31 2e  t>-<strong>tls1.
2840: 33 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62  3</strong> <em>b
2850: 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ool</em></dt>.  
2860: 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65        <dd>Enable
2870: 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 33   use of TLS v1.3
2880: 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c   (<strong>defaul
2890: 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e  t</strong>: <em>
28a0: 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a  true</em>)</dd>.
28b0: 20 20 20 20 3c 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63      </dl>.</bloc
28c0: 6b 71 75 6f 74 65 3e 0a 0a 3c 64 6c 3e 0a 20 20  kquote>..<dl>.  
28d0: 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74    <dt><a name="t
28e0: 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 22 3e 3c 62  ls::unimport"><b
28f0: 3e 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 20 3c  >tls::unimport <
2900: 2f 62 3e 3c 69 3e 63 68 61 6e 6e 65 6c 3c 2f 69  /b><i>channel</i
2910: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c  ></a></dt>.    <
2920: 64 64 3e 50 72 6f 76 69 64 65 64 20 66 6f 72 20  dd>Provided for 
2930: 73 79 6d 6d 65 74 72 79 20 74 6f 20 3c 73 74 72  symmetry to <str
2940: 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c  ong>tls::import<
2950: 2f 73 74 72 6f 6e 67 3e 2c 20 74 68 69 73 0a 20  /strong>, this. 
2960: 20 20 20 20 20 75 6e 73 74 61 63 6b 73 20 74 68       unstacks th
2970: 65 20 53 53 4c 2d 65 6e 61 62 6c 69 6e 67 20 6f  e SSL-enabling o
2980: 66 20 61 20 72 65 67 75 6c 61 72 20 54 63 6c 20  f a regular Tcl 
2990: 63 68 61 6e 6e 65 6c 2e 20 20 41 6e 20 65 72 72  channel.  An err
29a0: 6f 72 0a 20 20 20 20 20 20 69 73 20 74 68 72 6f  or.      is thro
29b0: 77 6e 20 69 66 20 54 4c 53 20 69 73 20 6e 6f 74  wn if TLS is not
29c0: 20 74 68 65 20 74 6f 70 20 73 74 61 63 6b 65 64   the top stacked
29d0: 20 63 68 61 6e 6e 65 6c 20 74 79 70 65 2e 3c 2f   channel type.</
29e0: 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 64 6c 3e 0a  dd>.</dl>..<dl>.
29f0: 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d      <dt><a name=
2a00: 22 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 70 72  "tls::ciphers pr
2a10: 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f  otocol ?verbose?
2a20: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63  "><strong>tls::c
2a30: 69 70 68 65 72 73 3c 2f 73 74 72 6f 6e 67 3e 0a  iphers</strong>.
2a40: 20 20 20 20 20 20 20 20 3c 65 6d 3e 70 72 6f 74          <em>prot
2a50: 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 3c 2f  ocol ?verbose?</
2a60: 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20  em></a></dt>.   
2a70: 20 3c 64 64 3e 52 65 74 75 72 6e 73 20 6c 69 73   <dd>Returns lis
2a80: 74 20 6f 66 20 73 75 70 70 6f 72 74 65 64 20 63  t of supported c
2a90: 69 70 68 65 72 73 20 62 61 73 65 64 20 6f 6e 20  iphers based on 
2aa0: 74 68 65 20 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c  the <em>protocol
2ab0: 3c 2f 65 6d 3e 0a 20 20 20 20 20 20 20 20 79 6f  </em>.        yo
2ac0: 75 20 73 75 70 70 6c 79 2c 20 77 68 69 63 68 20  u supply, which 
2ad0: 6d 75 73 74 20 62 65 20 6f 6e 65 20 6f 66 20 3c  must be one of <
2ae0: 65 6d 3e 73 73 6c 32 2c 20 73 73 6c 33 2c 20 6f  em>ssl2, ssl3, o
2af0: 72 20 74 6c 73 31 3c 2f 65 6d 3e 2e 0a 20 20 20  r tls1</em>..   
2b00: 20 20 20 20 20 49 66 20 3c 65 6d 3e 76 65 72 62       If <em>verb
2b10: 6f 73 65 3c 2f 65 6d 3e 20 69 73 20 73 70 65 63  ose</em> is spec
2b20: 69 66 69 65 64 20 61 73 20 74 72 75 65 20 74 68  ified as true th
2b30: 65 6e 20 61 20 76 65 72 62 6f 73 65 2c 0a 20 20  en a verbose,.  
2b40: 20 20 20 20 20 20 73 65 6d 69 2d 68 75 6d 61 6e        semi-human
2b50: 20 72 65 61 64 61 62 6c 65 20 6c 69 73 74 20 69   readable list i
2b60: 73 20 72 65 74 75 72 6e 65 64 20 70 72 6f 76 69  s returned provi
2b70: 64 69 6e 67 20 61 64 64 69 74 69 6f 6e 61 6c 0a  ding additional.
2b80: 20 20 20 20 20 20 20 20 69 6e 66 6f 72 6d 61 74          informat
2b90: 69 6f 6e 20 6f 6e 20 74 68 65 20 6e 61 74 75 72  ion on the natur
2ba0: 65 20 6f 66 20 74 68 65 20 63 69 70 68 65 72 20  e of the cipher 
2bb0: 73 75 70 70 6f 72 74 2e 20 49 6e 20 65 61 63 68  support. In each
2bc0: 0a 20 20 20 20 20 20 20 20 63 61 73 65 20 74 68  .        case th
2bd0: 65 20 72 65 73 75 6c 74 20 69 73 20 61 20 54 63  e result is a Tc
2be0: 6c 20 6c 69 73 74 2e 3c 2f 64 64 3e 0a 3c 2f 64  l list.</dd>.</d
2bf0: 6c 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74  l>..<dl>.    <dt
2c00: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 76  ><a name="tls::v
2c10: 65 72 73 69 6f 6e 22 3e 3c 73 74 72 6f 6e 67 3e  ersion"><strong>
2c20: 74 6c 73 3a 3a 76 65 72 73 69 6f 6e 3c 2f 73 74  tls::version</st
2c30: 72 6f 6e 67 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20  rong></a></dt>. 
2c40: 20 20 20 3c 64 64 3e 52 65 74 75 72 6e 73 20 74     <dd>Returns t
2c50: 68 65 20 76 65 72 73 69 6f 6e 20 73 74 72 69 6e  he version strin
2c60: 67 20 64 65 66 69 6e 65 64 20 62 79 20 4f 70 65  g defined by Ope
2c70: 6e 53 53 4c 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e  nSSL.</dd>.</dl>
2c80: 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 43  ..<h3><a name="C
2c90: 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 22  ALLBACK OPTIONS"
2ca0: 3e 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e  >CALLBACK OPTION
2cb0: 53 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 0a  S</a></h3>..<p>.
2cc0: 41 73 20 69 6e 64 69 63 61 74 65 64 20 61 62 6f  As indicated abo
2cd0: 76 65 2c 20 69 6e 64 69 76 69 64 75 61 6c 20 63  ve, individual c
2ce0: 68 61 6e 6e 65 6c 73 20 63 61 6e 20 62 65 20 67  hannels can be g
2cf0: 69 76 65 6e 20 74 68 65 69 72 20 6f 77 6e 20 63  iven their own c
2d00: 61 6c 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e 64  allbacks.to hand
2d10: 6c 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20  le intermediate 
2d20: 70 72 6f 63 65 73 73 69 6e 67 20 62 79 20 74 68  processing by th
2d30: 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72  e OpenSSL librar
2d40: 79 2c 20 75 73 69 6e 67 20 74 68 65 0a 3c 65 6d  y, using the.<em
2d50: 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61  >-command</em> a
2d60: 6e 64 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64  nd <em>-password
2d70: 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 73 20 70 61  </em> options pa
2d80: 73 73 65 64 20 74 6f 20 65 69 74 68 65 72 20 6f  ssed to either o
2d90: 66 0a 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  f.<strong>tls::s
2da0: 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 20 6f  ocket</strong> o
2db0: 72 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 69  r <strong>tls::i
2dc0: 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 2e 0a  mport</strong>..
2dd0: 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74  </p>..<blockquot
2de0: 65 3e 0a 3c 64 6c 3e 0a 0a 20 20 20 20 3c 64 74  e>.<dl>..    <dt
2df0: 3e 3c 73 74 72 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e  ><strong>-comman
2e00: 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  d</strong> <em>c
2e10: 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f 64 74  allback</em></dt
2e20: 3e 0a 20 20 20 20 3c 64 64 3e 0a 09 49 6e 76 6f  >.    <dd>..Invo
2e30: 6b 65 73 20 74 68 65 20 73 70 65 63 69 66 69 65  kes the specifie
2e40: 64 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f  d <em>callback</
2e50: 65 6d 3e 20 73 63 72 69 70 74 20 61 74 0a 09 73  em> script at..s
2e60: 65 76 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75  everal points du
2e70: 72 69 6e 67 20 74 68 65 20 4f 70 65 6e 53 53 4c  ring the OpenSSL
2e80: 20 68 61 6e 64 73 68 61 6b 65 2e 0a 09 45 78 63   handshake...Exc
2e90: 65 70 74 20 61 73 20 69 6e 64 69 63 61 74 65 64  ept as indicated
2ea0: 20 62 65 6c 6f 77 2c 20 76 61 6c 75 65 73 20 72   below, values r
2eb0: 65 74 75 72 6e 65 64 20 66 72 6f 6d 20 74 68 65  eturned from the
2ec0: 0a 09 63 61 6c 6c 62 61 63 6b 20 61 72 65 20 69  ..callback are i
2ed0: 67 6e 6f 72 65 64 2e 0a 09 41 72 67 75 6d 65 6e  gnored...Argumen
2ee0: 74 73 20 61 70 70 65 6e 64 65 64 20 74 6f 20 74  ts appended to t
2ef0: 68 65 20 73 63 72 69 70 74 20 75 70 6f 6e 20 63  he script upon c
2f00: 61 6c 6c 62 61 63 6b 20 74 61 6b 65 20 6f 6e 65  allback take one
2f10: 20 6f 66 20 74 68 65 0a 09 66 6f 6c 6c 6f 77 69   of the..followi
2f20: 6e 67 20 66 6f 72 6d 73 3a 0a 0a 09 3c 62 72 3e  ng forms:...<br>
2f30: 0a 09 3c 62 72 3e 0a 0a 09 3c 64 6c 3e 0a 0a 3c  ..<br>...<dl>..<
2f40: 21 2d 2d 09 54 68 69 73 20 66 6f 72 6d 20 6f 66  !--.This form of
2f50: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 64 69 73   callback is dis
2f60: 61 62 6c 65 64 2e 0a 0a 09 3c 64 74 3e 0a 09 20  abled....<dt>.. 
2f70: 20 3c 73 74 72 6f 6e 67 3e 65 72 72 6f 72 3c 2f   <strong>error</
2f80: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e  strong> <em>chan
2f90: 6e 65 6c 20 6d 65 73 73 61 67 65 3c 2f 65 6d 3e  nel message</em>
2fa0: 0a 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e 0a 09 20  ..</dt>..<dd>.. 
2fb0: 20 54 68 65 20 3c 65 6d 3e 6d 65 73 73 61 67 65   The <em>message
2fc0: 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 63  </em> argument c
2fd0: 6f 6e 74 61 69 6e 73 20 61 6e 20 65 72 72 6f 72  ontains an error
2fe0: 20 6d 65 73 73 61 67 65 20 67 65 6e 65 72 61 74   message generat
2ff0: 65 64 0a 09 20 20 62 79 20 74 68 65 20 4f 70 65  ed..  by the Ope
3000: 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 09 20  nSSL function.. 
3010: 20 3c 63 6f 64 65 3e 45 52 52 5f 72 65 61 73 6f   <code>ERR_reaso
3020: 6e 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67 28 29  n_error_string()
3030: 3c 2f 63 6f 64 65 3e 2e 0a 09 3c 2f 64 64 3e 0a  </code>...</dd>.
3040: 0a 09 3c 62 72 3e 0a 2d 2d 3e 0a 0a 09 3c 64 74  ..<br>.-->...<dt
3050: 3e 0a 09 20 20 3c 73 74 72 6f 6e 67 3e 69 6e 66  >..  <strong>inf
3060: 6f 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  o</strong> <em>c
3070: 68 61 6e 6e 65 6c 20 6d 61 6a 6f 72 20 6d 69 6e  hannel major min
3080: 6f 72 20 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 0a  or message</em>.
3090: 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e 0a 09 20 20  .</dt>..<dd>..  
30a0: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
30b0: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
30c0: 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20   by the OpenSSL 
30d0: 66 75 6e 63 74 69 6f 6e 0a 09 20 20 3c 63 6f 64  function..  <cod
30e0: 65 3e 53 53 4c 5f 43 54 58 5f 73 65 74 5f 69 6e  e>SSL_CTX_set_in
30f0: 66 6f 5f 63 61 6c 6c 62 61 63 6b 28 29 3c 2f 63  fo_callback()</c
3100: 6f 64 65 3e 2e 0a 09 20 20 3c 62 72 3e 0a 09 20  ode>...  <br>.. 
3110: 20 54 68 65 20 3c 65 6d 3e 6d 61 6a 6f 72 3c 2f   The <em>major</
3120: 65 6d 3e 20 61 6e 64 20 3c 65 6d 3e 6d 69 6e 6f  em> and <em>mino
3130: 72 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 73  r</em> arguments
3140: 20 61 72 65 20 75 73 65 64 20 74 6f 0a 09 20 20   are used to..  
3150: 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 73 74  represent the st
3160: 61 74 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20  ate information 
3170: 62 69 74 6d 61 73 6b 2e 0a 09 20 20 3c 64 6c 3e  bitmask...  <dl>
3180: 0a 09 20 20 3c 64 74 3e 50 6f 73 73 69 62 6c 65  ..  <dt>Possible
3190: 20 76 61 6c 75 65 73 20 66 6f 72 20 3c 65 6d 3e   values for <em>
31a0: 6d 61 6a 6f 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c  major</em> are:<
31b0: 2f 64 74 3e 0a 09 20 20 3c 64 64 3e 3c 63 6f 64  /dt>..  <dd><cod
31c0: 65 3e 68 61 6e 64 73 68 61 6b 65 2c 20 61 6c 65  e>handshake, ale
31d0: 72 74 2c 20 63 6f 6e 6e 65 63 74 2c 20 61 63 63  rt, connect, acc
31e0: 65 70 74 3c 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e  ept</code>.</dd>
31f0: 0a 09 20 20 3c 64 74 3e 50 6f 73 73 69 62 6c 65  ..  <dt>Possible
3200: 20 76 61 6c 75 65 73 20 66 6f 72 20 3c 65 6d 3e   values for <em>
3210: 6d 69 6e 6f 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c  minor</em> are:<
3220: 2f 64 74 3e 0a 09 20 20 3c 64 64 3e 3c 63 6f 64  /dt>..  <dd><cod
3230: 65 3e 73 74 61 72 74 2c 20 64 6f 6e 65 2c 20 72  e>start, done, r
3240: 65 61 64 2c 20 77 72 69 74 65 2c 20 6c 6f 6f 70  ead, write, loop
3250: 2c 20 65 78 69 74 3c 2f 63 6f 64 65 3e 2e 3c 2f  , exit</code>.</
3260: 64 64 3e 0a 09 20 20 3c 2f 64 6c 3e 0a 09 20 20  dd>..  </dl>..  
3270: 54 68 65 20 3c 65 6d 3e 6d 65 73 73 61 67 65 3c  The <em>message<
3280: 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 69 73  /em> argument is
3290: 20 61 20 64 65 73 63 72 69 70 74 69 76 65 20 73   a descriptive s
32a0: 74 72 69 6e 67 20 77 68 69 63 68 20 6d 61 79 0a  tring which may.
32b0: 09 20 20 62 65 20 67 65 6e 65 72 61 74 65 64 20  .  be generated 
32c0: 65 69 74 68 65 72 20 62 79 0a 09 20 20 3c 63 6f  either by..  <co
32d0: 64 65 3e 53 53 4c 5f 73 74 61 74 65 5f 73 74 72  de>SSL_state_str
32e0: 69 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65  ing_long()</code
32f0: 3e 20 6f 72 20 62 79 0a 09 20 20 3c 63 6f 64 65  > or by..  <code
3300: 3e 53 53 4c 5f 61 6c 65 72 74 5f 64 65 73 63 5f  >SSL_alert_desc_
3310: 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63  string_long()</c
3320: 6f 64 65 3e 2c 0a 09 20 20 64 65 70 65 6e 64 69  ode>,..  dependi
3330: 6e 67 20 6f 6e 20 63 6f 6e 74 65 78 74 2e 0a 09  ng on context...
3340: 3c 2f 64 64 3e 0a 0a 09 3c 62 72 3e 0a 0a 09 3c  </dd>...<br>...<
3350: 64 74 3e 0a 09 20 20 3c 73 74 72 6f 6e 67 3e 76  dt>..  <strong>v
3360: 65 72 69 66 79 3c 2f 73 74 72 6f 6e 67 3e 20 3c  erify</strong> <
3370: 65 6d 3e 63 68 61 6e 6e 65 6c 20 64 65 70 74 68  em>channel depth
3380: 20 63 65 72 74 20 73 74 61 74 75 73 20 65 72 72   cert status err
3390: 6f 72 3c 2f 65 6d 3e 0a 09 3c 2f 64 74 3e 0a 09  or</em>..</dt>..
33a0: 3c 64 64 3e 0a 09 20 20 54 68 69 73 20 66 6f 72  <dd>..  This for
33b0: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73  m of callback is
33c0: 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20   invoked by the 
33d0: 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e  OpenSSL function
33e0: 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c 5f 73 65  ..  <code>SSL_se
33f0: 74 5f 76 65 72 69 66 79 28 29 3c 2f 63 6f 64 65  t_verify()</code
3400: 3e 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68  >...  <br>..  Th
3410: 65 20 3c 65 6d 3e 64 65 70 74 68 3c 2f 65 6d 3e  e <em>depth</em>
3420: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 6e 20   argument is an 
3430: 69 6e 74 65 67 65 72 20 72 65 70 72 65 73 65 6e  integer represen
3440: 74 69 6e 67 20 74 68 65 0a 09 20 20 63 75 72 72  ting the..  curr
3450: 65 6e 74 20 64 65 70 74 68 20 6f 6e 20 74 68 65  ent depth on the
3460: 20 63 65 72 74 69 66 69 63 61 74 65 20 63 68 61   certificate cha
3470: 69 6e 2c 20 77 69 74 68 0a 09 20 20 3c 63 6f 64  in, with..  <cod
3480: 65 3e 30 3c 2f 63 6f 64 65 3e 20 61 73 20 74 68  e>0</code> as th
3490: 65 20 73 75 62 6a 65 63 74 20 63 65 72 74 69 66  e subject certif
34a0: 69 63 61 74 65 20 61 6e 64 20 68 69 67 68 65 72  icate and higher
34b0: 20 76 61 6c 75 65 73 0a 09 20 20 64 65 6e 6f 74   values..  denot
34c0: 69 6e 67 20 70 72 6f 67 72 65 73 73 69 76 65 6c  ing progressivel
34d0: 79 20 6d 6f 72 65 20 69 6e 64 69 72 65 63 74 20  y more indirect 
34e0: 69 73 73 75 65 72 20 63 65 72 74 69 66 69 63 61  issuer certifica
34f0: 74 65 73 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20  tes...  <br>..  
3500: 54 68 65 20 3c 65 6d 3e 63 65 72 74 3c 2f 65 6d  The <em>cert</em
3510: 3e 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20  > argument is a 
3520: 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75  list of key-valu
3530: 65 20 70 61 69 72 73 20 73 69 6d 69 6c 61 72 0a  e pairs similar.
3540: 09 20 20 74 6f 20 74 68 6f 73 65 20 72 65 74 75  .  to those retu
3550: 72 6e 65 64 20 62 79 0a 09 20 20 3c 61 20 68 72  rned by..  <a hr
3560: 65 66 3d 22 23 74 6c 73 3a 3a 73 74 61 74 75 73  ef="#tls::status
3570: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  "><strong>tls::s
3580: 74 61 74 75 73 3c 2f 73 74 72 6f 6e 67 3e 3c 2f  tatus</strong></
3590: 61 3e 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54  a>...  <br>..  T
35a0: 68 65 20 3c 65 6d 3e 73 74 61 74 75 73 3c 2f 65  he <em>status</e
35b0: 6d 3e 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61  m> argument is a
35c0: 6e 20 69 6e 74 65 67 65 72 20 72 65 70 72 65 73  n integer repres
35d0: 65 6e 74 69 6e 67 20 74 68 65 0a 09 20 20 63 75  enting the..  cu
35e0: 72 72 65 6e 74 20 76 61 6c 69 64 69 74 79 20 6f  rrent validity o
35f0: 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  f the certificat
3600: 65 2e 0a 09 20 20 41 20 76 61 6c 75 65 20 6f 66  e...  A value of
3610: 20 3c 63 6f 64 65 3e 30 3c 2f 63 6f 64 65 3e 20   <code>0</code> 
3620: 6d 65 61 6e 73 20 74 68 65 20 63 65 72 74 69 66  means the certif
3630: 69 63 61 74 65 20 69 73 20 64 65 65 6d 65 64 20  icate is deemed 
3640: 69 6e 76 61 6c 69 64 2e 0a 09 20 20 41 20 76 61  invalid...  A va
3650: 6c 75 65 20 6f 66 20 3c 63 6f 64 65 3e 31 3c 2f  lue of <code>1</
3660: 63 6f 64 65 3e 20 6d 65 61 6e 73 20 74 68 65 20  code> means the 
3670: 63 65 72 74 69 66 69 63 61 74 65 20 69 73 20 64  certificate is d
3680: 65 65 6d 65 64 20 76 61 6c 69 64 2e 0a 09 20 20  eemed valid...  
3690: 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65 6d 3e  <br>..  The <em>
36a0: 65 72 72 6f 72 3c 2f 65 6d 3e 20 61 72 67 75 6d  error</em> argum
36b0: 65 6e 74 20 73 75 70 70 6c 69 65 73 20 74 68 65  ent supplies the
36c0: 20 6d 65 73 73 61 67 65 2c 20 69 66 20 61 6e 79   message, if any
36d0: 2c 20 67 65 6e 65 72 61 74 65 64 0a 09 20 20 62  , generated..  b
36e0: 79 0a 09 20 20 3c 63 6f 64 65 3e 58 35 30 39 5f  y..  <code>X509_
36f0: 53 54 4f 52 45 5f 43 54 58 5f 67 65 74 5f 65 72  STORE_CTX_get_er
3700: 72 6f 72 28 29 3c 2f 63 6f 64 65 3e 2e 0a 09 20  ror()</code>... 
3710: 20 3c 62 72 3e 0a 09 20 20 3c 62 72 3e 0a 09 20   <br>..  <br>.. 
3720: 20 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 6d 61   The callback ma
3730: 79 20 6f 76 65 72 72 69 64 65 20 6e 6f 72 6d 61  y override norma
3740: 6c 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72 6f  l validation pro
3750: 63 65 73 73 69 6e 67 20 62 79 20 65 78 70 6c 69  cessing by expli
3760: 63 69 74 6c 79 0a 09 20 20 72 65 74 75 72 6e 69  citly..  returni
3770: 6e 67 20 6f 6e 65 20 6f 66 20 74 68 65 20 61 62  ng one of the ab
3780: 6f 76 65 20 3c 65 6d 3e 73 74 61 74 75 73 3c 2f  ove <em>status</
3790: 65 6d 3e 20 76 61 6c 75 65 73 2e 0a 09 3c 2f 64  em> values...</d
37a0: 64 3e 0a 0a 09 3c 2f 64 6c 3e 0a 20 20 20 20 3c  d>...</dl>.    <
37b0: 2f 64 64 3e 0a 0a 20 20 20 20 3c 62 72 3e 0a 0a  /dd>..    <br>..
37c0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
37d0: 2d 70 61 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e  -password</stron
37e0: 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c  g> <em>callback<
37f0: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64  /em></dt>.    <d
3800: 64 3e 0a 09 49 6e 76 6f 6b 65 73 20 74 68 65 20  d>..Invokes the 
3810: 73 70 65 63 69 66 69 65 64 20 3c 65 6d 3e 63 61  specified <em>ca
3820: 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 20 73 63 72 69  llback</em> scri
3830: 70 74 20 77 68 65 6e 20 4f 70 65 6e 53 53 4c 20  pt when OpenSSL 
3840: 6e 65 65 64 73 20 74 6f 0a 09 6f 62 74 61 69 6e  needs to..obtain
3850: 20 61 20 70 61 73 73 77 6f 72 64 2e 20 20 54 68   a password.  Th
3860: 65 20 63 61 6c 6c 62 61 63 6b 20 73 68 6f 75 6c  e callback shoul
3870: 64 20 72 65 74 75 72 6e 20 61 20 73 74 72 69 6e  d return a strin
3880: 67 20 77 68 69 63 68 0a 09 72 65 70 72 65 73 65  g which..represe
3890: 6e 74 73 20 74 68 65 20 70 61 73 73 77 6f 72 64  nts the password
38a0: 20 74 6f 20 62 65 20 75 73 65 64 2e 0a 09 4e 6f   to be used...No
38b0: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 61   arguments are a
38c0: 70 70 65 6e 64 65 64 20 74 6f 20 74 68 65 20 73  ppended to the s
38d0: 63 72 69 70 74 20 75 70 6f 6e 20 63 61 6c 6c 62  cript upon callb
38e0: 61 63 6b 2e 0a 20 20 20 20 3c 2f 64 64 3e 0a 3c  ack..    </dd>.<
38f0: 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  /dl>.</blockquot
3900: 65 3e 0a 0a 3c 70 3e 0a 52 65 66 65 72 65 6e 63  e>..<p>.Referenc
3910: 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e  e implementation
3920: 73 20 6f 66 20 74 68 65 73 65 20 63 61 6c 6c 62  s of these callb
3930: 61 63 6b 73 20 61 72 65 20 70 72 6f 76 69 64 65  acks are provide
3940: 64 20 69 6e 20 74 68 65 0a 64 69 73 74 72 69 62  d in the.distrib
3950: 75 74 69 6f 6e 20 61 73 20 3c 73 74 72 6f 6e 67  ution as <strong
3960: 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f  >tls::callback</
3970: 73 74 72 6f 6e 67 3e 20 61 6e 64 0a 3c 73 74 72  strong> and.<str
3980: 6f 6e 67 3e 74 6c 73 3a 3a 70 61 73 73 77 6f 72  ong>tls::passwor
3990: 64 3c 2f 73 74 72 6f 6e 67 3e 20 72 65 73 70 65  d</strong> respe
39a0: 63 74 69 76 65 6c 79 2e 20 20 4e 6f 74 65 20 74  ctively.  Note t
39b0: 68 61 74 20 74 68 65 73 65 20 61 72 65 0a 3c 65  hat these are.<e
39c0: 6d 3e 73 61 6d 70 6c 65 3c 2f 65 6d 3e 20 69 6d  m>sample</em> im
39d0: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 6e  plementations on
39e0: 6c 79 2e 20 20 49 6e 20 61 20 6d 6f 72 65 20 72  ly.  In a more r
39f0: 65 61 6c 69 73 74 69 63 20 64 65 70 6c 6f 79 6d  ealistic deploym
3a00: 65 6e 74 0a 79 6f 75 20 77 6f 75 6c 64 20 73 70  ent.you would sp
3a10: 65 63 69 66 79 20 79 6f 75 72 20 6f 77 6e 20 63  ecify your own c
3a20: 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 73 20  allback scripts 
3a30: 6f 6e 20 65 61 63 68 20 54 4c 53 20 63 68 61 6e  on each TLS chan
3a40: 6e 65 6c 0a 75 73 69 6e 67 20 74 68 65 20 3c 65  nel.using the <e
3a50: 6d 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20  m>-command</em> 
3a60: 61 6e 64 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72  and <em>-passwor
3a70: 64 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 73 2e 0a  d</em> options..
3a80: 3c 2f 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20 64 65  </p>..<p>.The de
3a90: 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72 20 77  fault behavior w
3aa0: 68 65 6e 20 74 68 65 20 3c 65 6d 3e 2d 63 6f 6d  hen the <em>-com
3ab0: 6d 61 6e 64 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e  mand</em> option
3ac0: 20 69 73 20 6e 6f 74 20 73 70 65 63 69 66 69 65   is not specifie
3ad0: 64 20 69 73 20 66 6f 72 0a 54 4c 53 20 74 6f 20  d is for.TLS to 
3ae0: 70 72 6f 63 65 73 73 20 74 68 65 20 61 73 73 6f  process the asso
3af0: 63 69 61 74 65 64 20 6c 69 62 72 61 72 79 20 63  ciated library c
3b00: 61 6c 6c 62 61 63 6b 73 20 69 6e 74 65 72 6e 61  allbacks interna
3b10: 6c 6c 79 2e 0a 54 68 65 20 64 65 66 61 75 6c 74  lly..The default
3b20: 20 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74   behavior when t
3b30: 68 65 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64  he <em>-password
3b40: 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 20 69 73 20  </em> option is 
3b50: 6e 6f 74 20 73 70 65 63 69 66 69 65 64 20 69 73  not specified is
3b60: 20 66 6f 72 0a 54 4c 53 20 74 6f 20 70 72 6f 63   for.TLS to proc
3b70: 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61 74  ess the associat
3b80: 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62  ed library callb
3b90: 61 63 6b 73 20 62 79 20 61 74 74 65 6d 70 74 69  acks by attempti
3ba0: 6e 67 20 74 6f 20 63 61 6c 6c 0a 3c 73 74 72 6f  ng to call.<stro
3bb0: 6e 67 3e 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64  ng>tls::password
3bc0: 3c 2f 73 74 72 6f 6e 67 3e 2e 0a 54 68 65 20 64  </strong>..The d
3bd0: 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65  ifference betwee
3be0: 6e 20 74 68 65 73 65 20 74 77 6f 20 62 65 68 61  n these two beha
3bf0: 76 69 6f 72 73 20 69 73 20 61 20 63 6f 6e 73 65  viors is a conse
3c00: 71 75 65 6e 63 65 20 6f 66 20 6d 61 69 6e 74 61  quence of mainta
3c10: 69 6e 69 6e 67 0a 63 6f 6d 70 61 74 69 62 69 6c  ining.compatibil
3c20: 69 74 79 20 77 69 74 68 20 65 61 72 6c 69 65 72  ity with earlier
3c30: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73   implementations
3c40: 2e 0a 3c 2f 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20  ..</p>..<p>.The 
3c50: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62  <strong>tls::deb
3c60: 75 67 3c 2f 73 74 72 6f 6e 67 3e 20 76 61 72 69  ug</strong> vari
3c70: 61 62 6c 65 20 70 72 6f 76 69 64 65 73 20 73 6f  able provides so
3c80: 6d 65 20 61 64 64 69 74 69 6f 6e 61 6c 0a 63 6f  me additional.co
3c90: 6e 74 72 6f 6c 20 6f 76 65 72 20 74 68 65 73 65  ntrol over these
3ca0: 20 72 65 66 65 72 65 6e 63 65 20 63 61 6c 6c 62   reference callb
3cb0: 61 63 6b 73 2e 20 20 49 74 73 20 76 61 6c 75 65  acks.  Its value
3cc0: 20 69 73 20 7a 65 72 6f 20 62 79 20 64 65 66 61   is zero by defa
3cd0: 75 6c 74 2e 0a 48 69 67 68 65 72 20 76 61 6c 75  ult..Higher valu
3ce0: 65 73 20 70 72 6f 64 75 63 65 20 6d 6f 72 65 20  es produce more 
3cf0: 64 69 61 67 6e 6f 73 74 69 63 20 6f 75 74 70 75  diagnostic outpu
3d00: 74 2c 20 61 6e 64 20 77 69 6c 6c 20 61 6c 73 6f  t, and will also
3d10: 20 66 6f 72 63 65 20 74 68 65 0a 76 65 72 69 66   force the.verif
3d20: 79 20 6d 65 74 68 6f 64 20 69 6e 20 3c 73 74 72  y method in <str
3d30: 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 63  ong>tls::callbac
3d40: 6b 3c 2f 73 74 72 6f 6e 67 3e 20 74 6f 20 61 63  k</strong> to ac
3d50: 63 65 70 74 20 74 68 65 0a 63 65 72 74 69 66 69  cept the.certifi
3d60: 63 61 74 65 2c 20 65 76 65 6e 20 77 68 65 6e 20  cate, even when 
3d70: 69 74 20 69 73 20 69 6e 76 61 6c 69 64 2e 0a 3c  it is invalid..<
3d80: 2f 70 3e 0a 0a 3c 70 3e 0a 3c 65 6d 3e 0a 54 68  /p>..<p>.<em>.Th
3d90: 65 20 75 73 65 20 6f 66 20 74 68 65 20 72 65 66  e use of the ref
3da0: 65 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73  erence callbacks
3db0: 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 61   <strong>tls::ca
3dc0: 6c 6c 62 61 63 6b 3c 2f 73 74 72 6f 6e 67 3e 20  llback</strong> 
3dd0: 61 6e 64 0a 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a  and.<strong>tls:
3de0: 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e  :password</stron
3df0: 67 3e 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d  g> is not recomm
3e00: 65 6e 64 65 64 2e 20 20 54 68 65 79 20 6d 61 79  ended.  They may
3e10: 20 62 65 20 72 65 6d 6f 76 65 64 0a 66 72 6f 6d   be removed.from
3e20: 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 73   future releases
3e30: 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 70  ..</em>.</p>..<p
3e40: 3e 0a 3c 65 6d 3e 0a 54 68 65 20 75 73 65 20 6f  >.<em>.The use o
3e50: 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 3c  f the variable <
3e60: 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62 75  strong>tls::debu
3e70: 67 3c 2f 73 74 72 6f 6e 67 3e 20 69 73 20 6e 6f  g</strong> is no
3e80: 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49  t recommended..I
3e90: 74 20 6d 61 79 20 62 65 20 72 65 6d 6f 76 65 64  t may be removed
3ea0: 20 66 72 6f 6d 20 66 75 74 75 72 65 20 72 65 6c   from future rel
3eb0: 65 61 73 65 73 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70  eases..</em>.</p
3ec0: 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22  >..<h3><a name="
3ed0: 48 54 54 50 53 20 45 58 41 4d 50 4c 45 22 3e 48  HTTPS EXAMPLE">H
3ee0: 54 54 50 53 20 45 58 41 4d 50 4c 45 3c 2f 61 3e  TTPS EXAMPLE</a>
3ef0: 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 69 73 20 65  </h3>..<p>This e
3f00: 78 61 6d 70 6c 65 20 75 73 65 73 20 61 20 73 61  xample uses a sa
3f10: 6d 70 6c 65 20 73 65 72 76 65 72 2e 70 65 6d 20  mple server.pem 
3f20: 70 72 6f 76 69 64 65 64 20 77 69 74 68 20 74 68  provided with th
3f30: 65 20 54 4c 53 20 72 65 6c 65 61 73 65 2c 0a 63  e TLS release,.c
3f40: 6f 75 72 74 65 73 79 20 6f 66 20 74 68 65 20 3c  ourtesy of the <
3f50: 73 74 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f  strong>OpenSSL</
3f60: 73 74 72 6f 6e 67 3e 20 70 72 6f 6a 65 63 74 2e  strong> project.
3f70: 3c 2f 70 3e 0a 0a 3c 70 72 65 3e 3c 63 6f 64 65  </p>..<pre><code
3f80: 3e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 72  >.package requir
3f90: 65 20 68 74 74 70 0a 70 61 63 6b 61 67 65 20 72  e http.package r
3fa0: 65 71 75 69 72 65 20 74 6c 73 0a 0a 68 74 74 70  equire tls..http
3fb0: 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74 70 73  ::register https
3fc0: 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c 73   443 [list ::tls
3fd0: 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73 65  ::socket -autose
3fe0: 72 76 65 72 6e 61 6d 65 20 74 72 75 65 20 2d 72  rvername true -r
3ff0: 65 71 75 69 72 65 20 74 72 75 65 20 2d 63 61 64  equire true -cad
4000: 69 72 20 2f 65 74 63 2f 73 73 6c 2f 63 65 72 74  ir /etc/ssl/cert
4010: 73 5d 0a 0a 73 65 74 20 74 6f 6b 20 5b 68 74 74  s]..set tok [htt
4020: 70 3a 3a 67 65 74 75 72 6c 20 68 74 74 70 73 3a  p::geturl https:
4030: 2f 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f 5d 0a 3c  //www.tcl.tk/].<
4040: 2f 63 6f 64 65 3e 3c 2f 70 72 65 3e 0a 0a 3c 68  /code></pre>..<h
4050: 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 50 45 43 49  3><a name="SPECI
4060: 41 4c 20 43 4f 4e 53 49 44 45 52 41 54 49 4f 4e  AL CONSIDERATION
4070: 53 22 3e 53 50 45 43 49 41 4c 20 43 4f 4e 53 49  S">SPECIAL CONSI
4080: 44 45 52 41 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 68  DERATIONS</a></h
4090: 33 3e 0a 0a 3c 70 3e 54 68 65 20 63 61 70 61 62  3>..<p>The capab
40a0: 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69 73 20  ilities of this 
40b0: 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61 72 79  package can vary
40c0: 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61 73 65   enormously base
40d0: 64 0a 75 70 6f 6e 20 68 6f 77 20 79 6f 75 72 20  d.upon how your 
40e0: 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 20  OpenSSL library 
40f0: 77 61 73 20 63 6f 6e 66 69 67 75 72 65 64 20 61  was configured a
4100: 6e 64 20 62 75 69 6c 74 2e 20 41 74 20 74 68 65  nd built. At the
4110: 0a 6d 6f 73 74 20 6d 61 63 72 6f 2d 6c 65 76 65  .most macro-leve
4120: 6c 20 4f 70 65 6e 53 53 4c 20 73 75 70 70 6f 72  l OpenSSL suppor
4130: 74 73 20 61 20 26 71 75 6f 74 3b 6e 6f 20 70 61  ts a &quot;no pa
4140: 74 65 6e 74 73 26 71 75 6f 74 3b 20 62 75 69 6c  tents&quot; buil
4150: 64 2c 0a 77 68 69 63 68 20 64 69 73 61 62 6c 65  d,.which disable
4160: 73 20 52 53 41 2c 20 49 44 45 41 2c 20 52 43 28  s RSA, IDEA, RC(
4170: 32 2c 34 2c 35 29 20 61 6e 64 20 53 53 4c 32 20  2,4,5) and SSL2 
4180: 2d 20 69 66 20 79 6f 75 72 20 4f 70 65 6e 53 53  - if your OpenSS
4190: 4c 20 69 73 0a 63 6f 6e 66 69 67 75 72 65 64 20  L is.configured 
41a0: 74 68 69 73 20 77 61 79 20 74 68 65 6e 20 79 6f  this way then yo
41b0: 75 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 62  u will need to b
41c0: 75 69 6c 64 20 54 4c 53 20 77 69 74 68 20 74 68  uild TLS with th
41d0: 65 0a 2d 44 4e 4f 5f 50 41 54 45 4e 54 53 20 6f  e.-DNO_PATENTS o
41e0: 70 74 69 6f 6e 20 2d 20 61 6e 64 20 74 68 65 20  ption - and the 
41f0: 72 65 73 75 6c 74 61 6e 74 20 6d 6f 64 75 6c 65  resultant module
4200: 20 77 69 6c 6c 20 66 75 6e 63 74 69 6f 6e 0a 63   will function.c
4210: 6f 72 72 65 63 74 6c 79 20 61 6e 64 20 61 6c 73  orrectly and als
4220: 6f 20 73 75 70 70 6f 72 74 20 41 44 48 20 63 65  o support ADH ce
4230: 72 74 69 66 69 63 61 74 65 2d 6c 65 73 73 20 65  rtificate-less e
4240: 6e 63 72 79 70 74 69 6f 6e 2c 0a 68 6f 77 65 76  ncryption,.howev
4250: 65 72 20 79 6f 75 20 77 69 6c 6c 20 62 65 20 75  er you will be u
4260: 6e 61 62 6c 65 20 74 6f 20 75 74 69 6c 69 7a 65  nable to utilize
4270: 20 74 68 69 73 20 74 6f 20 73 70 65 61 6b 20 74   this to speak t
4280: 6f 20 6e 6f 72 6d 61 6c 20 57 65 62 0a 53 65 72  o normal Web.Ser
4290: 76 65 72 73 2c 20 77 68 69 63 68 20 74 79 70 69  vers, which typi
42a0: 63 61 6c 6c 79 20 72 65 71 75 69 72 65 20 52 53  cally require RS
42b0: 41 20 73 75 70 70 6f 72 74 2e 20 50 6c 65 61 73  A support. Pleas
42c0: 65 20 73 65 65 20 3c 61 0a 68 72 65 66 3d 22 68  e see <a.href="h
42d0: 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73 73  ttp://www.openss
42e0: 6c 2e 6f 72 67 2f 22 3e 68 74 74 70 3a 2f 2f 77  l.org/">http://w
42f0: 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 3c  ww.openssl.org/<
4300: 2f 61 3e 20 66 6f 72 0a 6d 6f 72 65 20 69 6e 66  /a> for.more inf
4310: 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20  ormation on the 
4320: 77 68 6f 6c 65 20 69 73 73 75 65 20 6f 66 20 70  whole issue of p
4330: 61 74 65 6e 74 73 20 61 6e 64 20 55 53 20 65 78  atents and US ex
4340: 70 6f 72 74 0a 72 65 73 74 72 69 63 74 69 6f 6e  port.restriction
4350: 73 2e 20 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20  s. </p>..<h3><a 
4360: 6e 61 6d 65 3d 22 53 45 45 20 41 4c 53 4f 22 3e  name="SEE ALSO">
4370: 53 45 45 20 41 4c 53 4f 3c 2f 61 3e 3c 2f 68 33  SEE ALSO</a></h3
4380: 3e 0a 0a 3c 70 3e 3c 73 74 72 6f 6e 67 3e 73 6f  >..<p><strong>so
4390: 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 2c 20 3c  cket</strong>, <
43a0: 73 74 72 6f 6e 67 3e 66 69 6c 65 65 76 65 6e 74  strong>fileevent
43b0: 2c 20 3c 2f 73 74 72 6f 6e 67 3e 3c 61 0a 68 72  , </strong><a.hr
43c0: 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 6f  ef="http://www.o
43d0: 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 3c 73 74  penssl.org/"><st
43e0: 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74  rong>OpenSSL</st
43f0: 72 6f 6e 67 3e 3c 2f 61 3e 3c 2f 70 3e 0a 0a 3c  rong></a></p>..<
4400: 68 72 3e 0a 0a 3c 70 72 65 3e 0a 43 6f 70 79 72  hr>..<pre>.Copyr
4410: 69 67 68 74 20 26 63 6f 70 79 3b 20 31 39 39 39  ight &copy; 1999
4420: 20 4d 61 74 74 20 4e 65 77 6d 61 6e 2e 0a 43 6f   Matt Newman..Co
4430: 70 79 72 69 67 68 74 20 26 63 6f 70 79 3b 20 32  pyright &copy; 2
4440: 30 30 34 20 53 74 61 72 66 69 73 68 20 53 79 73  004 Starfish Sys
4450: 74 65 6d 73 2e 0a 3c 2f 70 72 65 3e 0a 3c 2f 62  tems..</pre>.</b
4460: 6f 64 79 3e 0a 3c 2f 68 74 6d 6c 3e 0a           ody>.</html>.