Hex Artifact Content

Artifact be912f239cba685a516067c64234ac78b932973a0950a4d61bcd32dad8597e85:


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 34 20 61 6e 64 20 68 69 67 68 65 72  l 8.4 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 3c 2f 70 3e 0a 0a 3c 68  ession..</p>..<h
0b40: 33 3e 3c 61 20 6e 61 6d 65 3d 22 43 4f 4d 4d 41  3><a name="COMMA
0b50: 4e 44 53 22 3e 43 4f 4d 4d 41 4e 44 53 3c 2f 61  NDS">COMMANDS</a
0b60: 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 79 70 69 63  ></h3>..<p>Typic
0b70: 61 6c 6c 79 20 6f 6e 65 20 77 6f 75 6c 64 20 75  ally one would u
0b80: 73 65 20 74 68 65 20 3c 73 74 72 6f 6e 67 3e 74  se the <strong>t
0b90: 6c 73 3a 3a 73 6f 63 6b 65 74 20 3c 2f 73 74 72  ls::socket </str
0ba0: 6f 6e 67 3e 63 6f 6d 6d 61 6e 64 0a 77 68 69 63  ong>command.whic
0bb0: 68 20 70 72 6f 76 69 64 65 73 20 63 6f 6d 70 61  h provides compa
0bc0: 74 69 62 69 6c 69 74 79 20 77 69 74 68 20 74 68  tibility with th
0bd0: 65 20 6e 61 74 69 76 65 20 54 63 6c 20 3c 73 74  e native Tcl <st
0be0: 72 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 74 72  rong>socket</str
0bf0: 6f 6e 67 3e 0a 63 6f 6d 6d 61 6e 64 2e 20 49 6e  ong>.command. In
0c00: 20 73 75 63 68 20 63 61 73 65 73 20 3c 73 74 72   such cases <str
0c10: 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c  ong>tls::import<
0c20: 2f 73 74 72 6f 6e 67 3e 20 73 68 6f 75 6c 64 20  /strong> should 
0c30: 6e 6f 74 20 62 65 0a 75 73 65 64 20 64 69 72 65  not be.used dire
0c40: 63 74 6c 79 2e 3c 2f 70 3e 0a 0a 3c 64 6c 3e 0a  ctly.</p>..<dl>.
0c50: 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d      <dt><a name=
0c60: 22 74 6c 73 3a 3a 69 6e 69 74 22 3e 3c 62 3e 74  "tls::init"><b>t
0c70: 6c 73 3a 3a 69 6e 69 74 20 3c 2f 62 3e 3c 69 3e  ls::init </b><i>
0c80: 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61  ?options?</i></a
0c90: 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 54  ></dt>.    <dd>T
0ca0: 68 69 73 20 72 6f 75 74 69 6e 65 20 73 65 74 73  his routine sets
0cb0: 20 74 68 65 20 64 65 66 61 75 6c 74 20 6f 70 74   the default opt
0cc0: 69 6f 6e 73 20 75 73 65 64 20 62 79 20 3c 73 74  ions used by <st
0cd0: 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74  rong>tls::socket
0ce0: 3c 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20 20  </strong>.      
0cf0: 20 20 61 6e 64 20 69 73 20 3c 65 6d 3e 6f 70 74    and is <em>opt
0d00: 69 6f 6e 61 6c 3c 2f 65 6d 3e 2e 20 49 66 20 79  ional</em>. If y
0d10: 6f 75 20 63 61 6c 6c 20 3c 73 74 72 6f 6e 67 3e  ou call <strong>
0d20: 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72  tls::import</str
0d30: 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20 64 69 72  ong>.        dir
0d40: 65 63 74 6c 79 20 74 68 69 73 20 72 6f 75 74 69  ectly this routi
0d50: 6e 65 20 68 61 73 20 6e 6f 20 65 66 66 65 63 74  ne has no effect
0d60: 2e 20 41 6e 79 20 6f 66 20 74 68 65 20 6f 70 74  . Any of the opt
0d70: 69 6f 6e 73 0a 20 20 20 20 20 20 20 20 74 68 61  ions.        tha
0d80: 74 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  t <strong>tls::s
0d90: 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 20 61  ocket</strong> a
0da0: 63 63 65 70 74 73 20 63 61 6e 20 62 65 20 73 65  ccepts can be se
0db0: 74 0a 20 20 20 20 20 20 20 20 75 73 69 6e 67 20  t.        using 
0dc0: 74 68 69 73 20 63 6f 6d 6d 61 6e 64 2c 20 74 68  this command, th
0dd0: 6f 75 67 68 20 79 6f 75 20 73 68 6f 75 6c 64 20  ough you should 
0de0: 6c 69 6d 69 74 20 79 6f 75 72 20 6f 70 74 69 6f  limit your optio
0df0: 6e 73 0a 20 20 20 20 20 20 20 20 74 6f 20 6f 6e  ns.        to on
0e00: 6c 79 20 54 4c 53 20 72 65 6c 61 74 65 64 20 6f  ly TLS related o
0e10: 6e 65 73 2e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64  nes.</dd>.    <d
0e20: 74 3e 26 6e 62 73 70 3b 3c 2f 64 74 3e 0a 20 20  t>&nbsp;</dt>.  
0e30: 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74    <dt><a name="t
0e40: 6c 73 3a 3a 73 6f 63 6b 65 74 22 3e 3c 62 3e 74  ls::socket"><b>t
0e50: 6c 73 3a 3a 73 6f 63 6b 65 74 20 3c 2f 62 3e 3c  ls::socket </b><
0e60: 65 6d 3e 3f 6f 70 74 69 6f 6e 73 3f 0a 20 20 20  em>?options?.   
0e70: 20 20 20 20 20 68 6f 73 74 20 70 6f 72 74 3c 2f       host port</
0e80: 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20  em></a></dt>.   
0e90: 20 3c 64 74 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63   <dt><b>tls::soc
0ea0: 6b 65 74 3c 2f 62 3e 3c 65 6d 3e 20 3f 2d 73 65  ket</b><em> ?-se
0eb0: 72 76 65 72 20 63 6f 6d 6d 61 6e 64 3f 20 3f 6f  rver command? ?o
0ec0: 70 74 69 6f 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d  ptions? port</em
0ed0: 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 54  ></dt>.    <dd>T
0ee0: 68 69 73 20 69 73 20 61 20 68 65 6c 70 65 72 20  his is a helper 
0ef0: 66 75 6e 63 74 69 6f 6e 20 74 68 61 74 20 75 74  function that ut
0f00: 69 6c 69 7a 65 73 20 74 68 65 20 75 6e 64 65 72  ilizes the under
0f10: 6c 79 69 6e 67 0a 20 20 20 20 20 20 20 20 63 6f  lying.        co
0f20: 6d 6d 61 6e 64 73 20 28 3c 73 74 72 6f 6e 67 3e  mmands (<strong>
0f30: 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72  tls::import</str
0f40: 6f 6e 67 3e 29 2e 20 49 74 20 62 65 68 61 76 65  ong>). It behave
0f50: 73 0a 20 20 20 20 20 20 20 20 65 78 61 63 74 6c  s.        exactl
0f60: 79 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68  y the same as th
0f70: 65 20 6e 61 74 69 76 65 20 54 63 6c 20 3c 73 74  e native Tcl <st
0f80: 72 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 74 72  rong>socket</str
0f90: 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20 63 6f 6d  ong>.        com
0fa0: 6d 61 6e 64 20 65 78 63 65 70 74 20 74 68 61 74  mand except that
0fb0: 20 74 68 65 20 6f 70 74 69 6f 6e 73 20 63 61 6e   the options can
0fc0: 20 69 6e 63 6c 75 64 65 20 61 6e 79 20 6f 66 20   include any of 
0fd0: 74 68 65 0a 20 20 20 20 20 20 20 20 61 70 70 6c  the.        appl
0fe0: 69 63 61 62 6c 65 20 3c 61 20 68 72 65 66 3d 22  icable <a href="
0ff0: 23 74 6c 73 3a 3a 69 6d 70 6f 72 74 22 3e 3c 73  #tls::import"><s
1000: 74 72 6f 6e 67 3e 74 6c 73 3a 69 6d 70 6f 72 74  trong>tls:import
1010: 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 0a 20 20  </strong></a>.  
1020: 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 77 69        options wi
1030: 74 68 20 6f 6e 65 20 61 64 64 69 74 69 6f 6e 61  th one additiona
1040: 6c 20 6f 70 74 69 6f 6e 3a 0a 3c 62 6c 6f 63 6b  l option:.<block
1050: 71 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c 3e 0a  quote>.    <dl>.
1060: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
1070: 6f 6e 67 3e 2d 61 75 74 6f 73 65 72 76 65 72 6e  ong>-autoservern
1080: 61 6d 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  ame</strong> <em
1090: 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  >bool</em></dt>.
10a0: 20 20 20 20 20 20 20 20 3c 64 64 3e 41 75 74 6f          <dd>Auto
10b0: 6d 61 74 69 63 61 6c 6c 79 20 73 65 6e 64 20 74  matically send t
10c0: 68 65 20 2d 73 65 72 76 65 72 6e 61 6d 65 20 61  he -servername a
10d0: 73 20 74 68 65 20 3c 65 6d 3e 68 6f 73 74 3c 2f  s the <em>host</
10e0: 65 6d 3e 20 61 72 67 75 6d 65 6e 74 0a 20 20 20  em> argument.   
10f0: 20 20 20 20 20 20 20 20 20 28 3c 73 74 72 6f 6e           (<stron
1100: 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e  g>default</stron
1110: 67 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65  g>: <em>false</e
1120: 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 3c 2f 64  m>)</dd>.    </d
1130: 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e  l>.</blockquote>
1140: 0a 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c  .    <dt>&nbsp;<
1150: 2f 64 74 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20  /dt>.    <dt><a 
1160: 6e 61 6d 65 3d 22 74 6c 73 3a 3a 68 61 6e 64 73  name="tls::hands
1170: 68 61 6b 65 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c  hake"><strong>tl
1180: 73 3a 3a 68 61 6e 64 73 68 61 6b 65 3c 2f 73 74  s::handshake</st
1190: 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65  rong> <em>channe
11a0: 6c 3c 2f 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a  l</em></a></dt>.
11b0: 20 20 20 20 3c 64 64 3e 46 6f 72 63 65 73 20 68      <dd>Forces h
11c0: 61 6e 64 73 68 61 6b 65 20 74 6f 20 74 61 6b 65  andshake to take
11d0: 20 70 6c 61 63 65 2c 20 61 6e 64 20 72 65 74 75   place, and retu
11e0: 72 6e 73 20 30 20 69 66 0a 20 20 20 20 20 20 20  rns 0 if.       
11f0: 20 68 61 6e 64 73 68 61 6b 65 20 69 73 20 73 74   handshake is st
1200: 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65 73 73 20  ill in progress 
1210: 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 29 2c 20  (non-blocking), 
1220: 6f 72 20 31 20 69 66 0a 20 20 20 20 20 20 20 20  or 1 if.        
1230: 74 68 65 20 68 61 6e 64 73 68 61 6b 65 20 77 61  the handshake wa
1240: 73 20 73 75 63 63 65 73 73 66 75 6c 2e 20 49 66  s successful. If
1250: 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65 20 66   the handshake f
1260: 61 69 6c 65 64 0a 20 20 20 20 20 20 20 20 74 68  ailed.        th
1270: 69 73 20 72 6f 75 74 69 6e 65 20 77 69 6c 6c 20  is routine will 
1280: 74 68 72 6f 77 20 61 6e 20 65 72 72 6f 72 2e 3c  throw an error.<
1290: 2f 64 64 3e 0a 20 20 20 20 3c 64 74 3e 26 6e 62  /dd>.    <dt>&nb
12a0: 73 70 3b 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74  sp;</dt>.    <dt
12b0: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 73  ><a name="tls::s
12c0: 74 61 74 75 73 22 3e 3c 73 74 72 6f 6e 67 3e 74  tatus"><strong>t
12d0: 6c 73 3a 3a 73 74 61 74 75 73 3c 2f 73 74 72 6f  ls::status</stro
12e0: 6e 67 3e 0a 20 20 20 20 3c 65 6d 3e 3f 2d 6c 6f  ng>.    <em>?-lo
12f0: 63 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d  cal? channel</em
1300: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c  ></a></dt>.    <
1310: 64 64 3e 52 65 74 75 72 6e 73 20 74 68 65 20 63  dd>Returns the c
1320: 75 72 72 65 6e 74 20 73 65 63 75 72 69 74 79 20  urrent security 
1330: 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c  status of an SSL
1340: 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 0a 20 20   channel. The.  
1350: 20 20 20 20 20 20 72 65 73 75 6c 74 20 69 73 20        result is 
1360: 61 20 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61  a list of key-va
1370: 6c 75 65 20 70 61 69 72 73 20 64 65 73 63 72 69  lue pairs descri
1380: 62 69 6e 67 20 74 68 65 0a 20 20 20 20 20 20 20  bing the.       
1390: 20 63 6f 6e 6e 65 63 74 65 64 20 70 65 65 72 2e   connected peer.
13a0: 20 49 66 20 74 68 65 20 72 65 73 75 6c 74 20 69   If the result i
13b0: 73 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 74 20  s an empty list 
13c0: 74 68 65 6e 20 74 68 65 0a 20 20 20 20 20 20 20  then the.       
13d0: 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 20 68   SSL handshake h
13e0: 61 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d 70 6c  as not yet compl
13f0: 65 74 65 64 2e 0a 20 20 20 20 20 20 20 20 49 66  eted..        If
1400: 20 3c 65 6d 3e 2d 6c 6f 63 61 6c 3c 2f 65 6d 3e   <em>-local</em>
1410: 20 69 73 20 67 69 76 65 6e 2c 20 74 68 65 6e 20   is given, then 
1420: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20  the certificate 
1430: 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 20 20 20 20  information.    
1440: 20 20 20 20 69 73 20 74 68 65 20 6f 6e 65 20 75      is the one u
1450: 73 65 64 20 6c 6f 63 61 6c 6c 79 2e 3c 2f 64 64  sed locally.</dd
1460: 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 62 6c 6f 63 6b 71  >.</dl>..<blockq
1470: 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20  uote>.    <dl>. 
1480: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
1490: 6e 67 3e 69 73 73 75 65 72 3c 2f 73 74 72 6f 6e  ng>issuer</stron
14a0: 67 3e 20 3c 65 6d 3e 64 6e 3c 2f 65 6d 3e 3c 2f  g> <em>dn</em></
14b0: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e  dt>.        <dd>
14c0: 54 68 65 20 64 69 73 74 69 6e 67 75 69 73 68 65  The distinguishe
14d0: 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66 20 74  d name (DN) of t
14e0: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 0a 20  he certificate. 
14f0: 20 20 20 20 20 20 20 20 20 20 20 69 73 73 75 65             issue
1500: 72 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  r.</dd>.        
1510: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 73 75 62 6a  <dt><strong>subj
1520: 65 63 74 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  ect</strong> <em
1530: 3e 64 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  >dn</em></dt>.  
1540: 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 64 69        <dd>The di
1550: 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d 65  stinguished name
1560: 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65 72   (DN) of the cer
1570: 74 69 66 69 63 61 74 65 0a 20 20 20 20 20 20 20  tificate.       
1580: 20 20 20 20 20 73 75 62 6a 65 63 74 2e 3c 2f 64       subject.</d
1590: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
15a0: 73 74 72 6f 6e 67 3e 6e 6f 74 42 65 66 6f 72 65  strong>notBefore
15b0: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 61  </strong> <em>da
15c0: 74 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  te</em></dt>.   
15d0: 20 20 20 20 20 3c 64 64 3e 54 68 65 20 62 65 67       <dd>The beg
15e0: 69 6e 20 64 61 74 65 20 66 6f 72 20 74 68 65 20  in date for the 
15f0: 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 65 20  validity of the 
1600: 63 65 72 74 69 66 69 63 61 74 65 2e 3c 2f 64 64  certificate.</dd
1610: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73  >.        <dt><s
1620: 74 72 6f 6e 67 3e 6e 6f 74 41 66 74 65 72 3c 2f  trong>notAfter</
1630: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 61 74 65  strong> <em>date
1640: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
1650: 20 20 20 3c 64 64 3e 54 68 65 20 65 78 70 69 72     <dd>The expir
1660: 79 20 64 61 74 65 20 66 6f 72 20 74 68 65 20 63  y date for the c
1670: 65 72 74 69 66 69 63 61 74 65 2e 3c 2f 64 64 3e  ertificate.</dd>
1680: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
1690: 72 6f 6e 67 3e 73 65 72 69 61 6c 3c 2f 73 74 72  rong>serial</str
16a0: 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c  ong> <em>n</em><
16b0: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
16c0: 3e 54 68 65 20 73 65 72 69 61 6c 20 6e 75 6d 62  >The serial numb
16d0: 65 72 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  er of the certif
16e0: 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20  icate.</dd>.    
16f0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
1700: 63 69 70 68 65 72 3c 2f 73 74 72 6f 6e 67 3e 20  cipher</strong> 
1710: 3c 65 6d 3e 63 69 70 68 65 72 3c 2f 65 6d 3e 3c  <em>cipher</em><
1720: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
1730: 3e 54 68 65 20 63 75 72 72 65 6e 74 20 63 69 70  >The current cip
1740: 68 65 72 20 69 6e 20 75 73 65 20 62 65 74 77 65  her in use betwe
1750: 65 6e 20 74 68 65 20 63 6c 69 65 6e 74 20 61 6e  en the client an
1760: 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65  d.            se
1770: 72 76 65 72 20 63 68 61 6e 6e 65 6c 73 2e 3c 2f  rver channels.</
1780: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
1790: 3c 73 74 72 6f 6e 67 3e 73 62 69 74 73 3c 2f 73  <strong>sbits</s
17a0: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d  trong> <em>n</em
17b0: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c  ></dt>.        <
17c0: 64 64 3e 54 68 65 20 6e 75 6d 62 65 72 20 6f 66  dd>The number of
17d0: 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 74   bits used for t
17e0: 68 65 20 73 65 73 73 69 6f 6e 20 6b 65 79 2e 3c  he session key.<
17f0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
1800: 3e 3c 73 74 72 6f 6e 67 3e 63 65 72 74 69 66 69  ><strong>certifi
1810: 63 61 74 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  cate</strong> <e
1820: 6d 3e 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  m>n</em></dt>.  
1830: 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 50 45        <dd>The PE
1840: 4d 20 65 6e 63 6f 64 65 64 20 63 65 72 74 69 66  M encoded certif
1850: 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20  icate.</dd>.    
1860: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
1870: 73 68 61 31 5f 68 61 73 68 3c 2f 73 74 72 6f 6e  sha1_hash</stron
1880: 67 3e 20 3c 65 6d 3e 68 61 73 68 3c 2f 65 6d 3e  g> <em>hash</em>
1890: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
18a0: 64 3e 54 68 65 20 53 48 41 31 20 68 61 73 68 20  d>The SHA1 hash 
18b0: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61  of the certifica
18c0: 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20  te.</dd>.       
18d0: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 73 68 61   <dt><strong>sha
18e0: 32 35 36 5f 68 61 73 68 3c 2f 73 74 72 6f 6e 67  256_hash</strong
18f0: 3e 20 3c 65 6d 3e 68 61 73 68 3c 2f 65 6d 3e 3c  > <em>hash</em><
1900: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
1910: 3e 54 68 65 20 53 48 41 32 35 36 20 68 61 73 68  >The SHA256 hash
1920: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
1930: 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20  ate.</dd>.      
1940: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 61 6c    <dt><strong>al
1950: 70 6e 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e  pn</strong> <em>
1960: 70 72 6f 74 6f 63 6f 6c 3c 2f 65 6d 3e 3c 2f 64  protocol</em></d
1970: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 54  t>.        <dd>T
1980: 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73 65 6c 65  he protocol sele
1990: 63 74 65 64 20 61 66 74 65 72 20 41 70 70 6c 69  cted after Appli
19a0: 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f  cation-Layer Pro
19b0: 74 6f 63 6f 6c 0a 09 20 20 20 20 4e 65 67 6f 74  tocol..    Negot
19c0: 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29 2e 3c 2f  iation (ALPN).</
19d0: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
19e0: 3c 73 74 72 6f 6e 67 3e 76 65 72 73 69 6f 6e 3c  <strong>version<
19f0: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 76 61 6c  /strong> <em>val
1a00: 75 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  ue</em></dt>.   
1a10: 20 20 20 20 20 3c 64 64 3e 54 68 65 20 70 72 6f       <dd>The pro
1a20: 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e 20 75 73  tocol version us
1a30: 65 64 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65  ed for the conne
1a40: 63 74 69 6f 6e 3a 0a 09 20 20 53 53 4c 76 32 2c  ction:..  SSLv2,
1a50: 20 53 53 4c 76 33 2c 20 54 4c 53 76 31 2c 20 54   SSLv3, TLSv1, T
1a60: 4c 53 76 31 2e 31 2c 20 54 4c 53 76 31 2e 32 2c  LSv1.1, TLSv1.2,
1a70: 20 75 6e 6b 6e 6f 77 6e 3c 2f 64 64 3e 0a 20 20   unknown</dd>.  
1a80: 20 20 3c 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71    </dl>.</blockq
1a90: 75 6f 74 65 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20  uote>..<dl>.    
1aa0: 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73  <dt><a name="tls
1ab0: 3a 3a 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73  ::import"><b>tls
1ac0: 3a 3a 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e  ::import </b><i>
1ad0: 63 68 61 6e 6e 65 6c 0a 20 20 20 20 20 20 20 20  channel.        
1ae0: 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61  ?options?</i></a
1af0: 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 53  ></dt>.    <dd>S
1b00: 53 4c 2d 65 6e 61 62 6c 65 20 61 20 72 65 67 75  SL-enable a regu
1b10: 6c 61 72 20 54 63 6c 20 63 68 61 6e 6e 65 6c 20  lar Tcl channel 
1b20: 2d 20 69 74 20 6e 65 65 64 20 6e 6f 74 20 62 65  - it need not be
1b30: 20 61 0a 20 20 20 20 20 20 20 20 73 6f 63 6b 65   a.        socke
1b40: 74 2c 20 62 75 74 20 6d 75 73 74 20 70 72 6f 76  t, but must prov
1b50: 69 64 65 20 62 69 2d 64 69 72 65 63 74 69 6f 6e  ide bi-direction
1b60: 61 6c 20 66 6c 6f 77 2e 20 41 6c 73 6f 0a 20 20  al flow. Also.  
1b70: 20 20 20 20 20 20 73 65 74 74 69 6e 67 20 73 65        setting se
1b80: 73 73 69 6f 6e 20 70 61 72 61 6d 65 74 65 72 73  ssion parameters
1b90: 20 66 6f 72 20 53 53 4c 20 68 61 6e 64 73 68 61   for SSL handsha
1ba0: 6b 65 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a  ke.</dd>.</dl>..
1bb0: 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 20  <blockquote>.   
1bc0: 20 3c 64 6c 3e 0a 20 20 20 20 20 20 20 20 3c 64   <dl>.        <d
1bd0: 74 3e 3c 73 74 72 6f 6e 67 3e 2d 61 6c 70 6e 3c  t><strong>-alpn<
1be0: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 6c 69 73  /strong> <em>lis
1bf0: 74 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  t</em></dt>.    
1c00: 20 20 20 20 3c 64 64 3e 4c 69 73 74 20 6f 66 20      <dd>List of 
1c10: 70 72 6f 74 6f 63 6f 6c 73 20 74 6f 20 6f 66 66  protocols to off
1c20: 65 72 20 64 75 72 69 6e 67 20 41 70 70 6c 69 63  er during Applic
1c30: 61 74 69 6f 6e 2d 4c 61 79 65 72 0a 09 20 20 20  ation-Layer..   
1c40: 20 50 72 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69   Protocol Negoti
1c50: 61 74 69 6f 6e 20 28 41 4c 50 4e 29 2e 20 46 6f  ation (ALPN). Fo
1c60: 72 20 65 78 61 6d 70 6c 65 3a 20 68 32 2c 20 68  r example: h2, h
1c70: 74 74 70 2f 31 2e 31 2c 20 65 74 63 2e 3c 2f 64  ttp/1.1, etc.</d
1c80: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
1c90: 73 74 72 6f 6e 67 3e 2d 63 61 64 69 72 3c 2f 73  strong>-cadir</s
1ca0: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 69 72 3c 2f  trong> <em>dir</
1cb0: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1cc0: 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65   <dd>Provide the
1cd0: 20 64 69 72 65 63 74 6f 72 79 20 63 6f 6e 74 61   directory conta
1ce0: 69 6e 69 6e 67 20 74 68 65 20 43 41 20 63 65 72  ining the CA cer
1cf0: 74 69 66 69 63 61 74 65 73 2e 20 54 68 65 0a 09  tificates. The..
1d00: 64 65 66 61 75 6c 74 20 64 69 72 65 63 74 6f 72  default director
1d10: 79 20 69 73 20 70 6c 61 74 66 6f 72 6d 20 73 70  y is platform sp
1d20: 65 63 69 66 69 63 20 61 6e 64 20 63 61 6e 20 62  ecific and can b
1d30: 65 20 73 65 74 20 61 74 0a 09 63 6f 6d 70 69 6c  e set at..compil
1d40: 65 20 74 69 6d 65 2e 20 54 68 69 73 20 63 61 6e  e time. This can
1d50: 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 76   be overridden v
1d60: 69 61 20 74 68 65 20 3c 62 3e 53 53 4c 5f 43 45  ia the <b>SSL_CE
1d70: 52 54 5f 44 49 52 3c 2f 62 3e 0a 09 65 6e 76 69  RT_DIR</b>..envi
1d80: 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c 65  ronment variable
1d90: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  .</dd>.        <
1da0: 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63 61 66 69  dt><strong>-cafi
1db0: 6c 65 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e  le </strong><em>
1dc0: 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64  filename</em></d
1dd0: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50  t>.        <dd>P
1de0: 72 6f 76 69 64 65 20 74 68 65 20 43 41 20 66 69  rovide the CA fi
1df0: 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20  le.</dd>.       
1e00: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63 65   <dt><strong>-ce
1e10: 72 74 66 69 6c 65 3c 2f 73 74 72 6f 6e 67 3e 20  rtfile</strong> 
1e20: 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d  <em>filename</em
1e30: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c  ></dt>.        <
1e40: 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 6e  dd>Provide the n
1e50: 61 6d 65 20 6f 66 20 61 20 66 69 6c 65 20 63 6f  ame of a file co
1e60: 6e 74 61 69 6e 69 6e 67 20 63 65 72 74 69 66 69  ntaining certifi
1e70: 63 61 74 65 20 74 6f 20 75 73 65 2e 0a 09 54 68  cate to use...Th
1e80: 65 20 64 65 66 61 75 6c 74 20 6e 61 6d 65 20 69  e default name i
1e90: 73 20 63 65 72 74 2e 70 65 6d 2e 20 54 68 69 73  s cert.pem. This
1ea0: 20 63 61 6e 20 62 65 20 6f 76 65 72 72 69 64 64   can be overridd
1eb0: 65 6e 20 76 69 61 20 74 68 65 0a 09 3c 62 3e 53  en via the..<b>S
1ec0: 53 4c 5f 43 45 52 54 5f 46 49 4c 45 3c 2f 62 3e  SL_CERT_FILE</b>
1ed0: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72   environment var
1ee0: 69 61 62 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20 20  iable.</dd>.    
1ef0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
1f00: 2d 63 65 72 74 3c 2f 73 74 72 6f 6e 67 3e 20 3c  -cert</strong> <
1f10: 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e  em>filename</em>
1f20: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1f30: 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 63 6f  d>Provide the co
1f40: 6e 74 65 6e 74 73 20 6f 66 20 61 20 63 65 72 74  ntents of a cert
1f50: 69 66 69 63 61 74 65 20 74 6f 20 75 73 65 2c 20  ificate to use, 
1f60: 61 73 20 61 20 44 45 52 20 65 6e 63 6f 64 65 64  as a DER encoded
1f70: 20 62 69 6e 61 72 79 20 76 61 6c 75 65 20 28 58   binary value (X
1f80: 2e 35 30 39 20 44 45 52 29 2e 3c 2f 64 64 3e 0a  .509 DER).</dd>.
1f90: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
1fa0: 6f 6e 67 3e 2d 63 69 70 68 65 72 20 3c 2f 73 74  ong>-cipher </st
1fb0: 72 6f 6e 67 3e 3c 65 6d 3e 73 74 72 69 6e 67 3c  rong><em>string<
1fc0: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
1fd0: 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68    <dd>Provide th
1fe0: 65 20 63 69 70 68 65 72 20 73 75 69 74 65 73 20  e cipher suites 
1ff0: 74 6f 20 75 73 65 2e 20 53 79 6e 74 61 78 20 69  to use. Syntax i
2000: 73 20 61 73 20 70 65 72 0a 20 20 20 20 20 20 20  s as per.       
2010: 20 20 20 20 20 4f 70 65 6e 53 53 4c 2e 3c 2f 64       OpenSSL.</d
2020: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
2030: 73 74 72 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c  strong>-command<
2040: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c  /strong> <em>cal
2050: 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  lback</em></dt>.
2060: 20 20 20 20 20 20 20 20 3c 64 64 3e 49 66 20 73          <dd>If s
2070: 70 65 63 69 66 69 65 64 2c 20 74 68 69 73 20 63  pecified, this c
2080: 61 6c 6c 62 61 63 6b 20 77 69 6c 6c 20 62 65 20  allback will be 
2090: 69 6e 76 6f 6b 65 64 20 61 74 20 73 65 76 65 72  invoked at sever
20a0: 61 6c 20 70 6f 69 6e 74 73 0a 20 20 20 20 20 20  al points.      
20b0: 20 20 20 20 20 20 64 75 72 69 6e 67 20 74 68 65        during the
20c0: 20 4f 70 65 6e 53 53 4c 20 68 61 6e 64 73 68 61   OpenSSL handsha
20d0: 6b 65 2e 20 20 49 74 20 63 61 6e 20 70 61 73 73  ke.  It can pass
20e0: 20 65 72 72 6f 72 73 20 61 6e 64 20 74 72 61 63   errors and trac
20f0: 69 6e 67 0a 20 20 20 20 20 20 20 20 20 20 20 20  ing.            
2100: 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20 61 6e 64  information, and
2110: 20 69 74 20 63 61 6e 20 61 6c 6c 6f 77 20 54 63   it can allow Tc
2120: 6c 20 73 63 72 69 70 74 73 20 74 6f 20 70 65 72  l scripts to per
2130: 66 6f 72 6d 0a 20 20 20 20 20 20 20 20 20 20 20  form.           
2140: 20 74 68 65 69 72 20 6f 77 6e 20 76 61 6c 69 64   their own valid
2150: 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 65 72  ation of the cer
2160: 74 69 66 69 63 61 74 65 20 69 6e 20 70 6c 61 63  tificate in plac
2170: 65 20 6f 66 20 74 68 65 0a 20 20 20 20 20 20 20  e of the.       
2180: 20 20 20 20 20 64 65 66 61 75 6c 74 20 76 61 6c       default val
2190: 69 64 61 74 69 6f 6e 20 70 72 6f 76 69 64 65 64  idation provided
21a0: 20 62 79 20 4f 70 65 6e 53 53 4c 2e 0a 20 20 20   by OpenSSL..   
21b0: 20 20 20 20 20 20 20 20 20 3c 62 72 3e 0a 20 20           <br>.  
21c0: 20 20 20 20 20 20 20 20 20 20 53 65 65 20 3c 61            See <a
21d0: 20 68 72 65 66 3d 22 23 43 41 4c 4c 42 41 43 4b   href="#CALLBACK
21e0: 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 41   OPTIONS">CALLBA
21f0: 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61 3e 20 66  CK OPTIONS</a> f
2200: 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 66  or.            f
2210: 75 72 74 68 65 72 20 64 69 73 63 75 73 73 69 6f  urther discussio
2220: 6e 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  n.</dd>.        
2230: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 64 68 70  <dt><strong>-dhp
2240: 61 72 61 6d 73 20 3c 2f 73 74 72 6f 6e 67 3e 3c  arams </strong><
2250: 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e  em>filename</em>
2260: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
2270: 64 3e 50 72 6f 76 69 64 65 20 61 20 44 69 66 66  d>Provide a Diff
2280: 69 65 2d 48 65 6c 6c 6d 61 6e 20 70 61 72 61 6d  ie-Hellman param
2290: 65 74 65 72 73 20 66 69 6c 65 2e 3c 2f 64 64 3e  eters file.</dd>
22a0: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
22b0: 72 6f 6e 67 3e 2d 6b 65 79 66 69 6c 65 3c 2f 73  rong>-keyfile</s
22c0: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e  trong> <em>filen
22d0: 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ame</em></dt>.  
22e0: 20 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64        <dd>Provid
22f0: 65 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65  e the private ke
2300: 79 20 66 69 6c 65 2e 20 28 3c 73 74 72 6f 6e 67  y file. (<strong
2310: 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67  >default</strong
2320: 3e 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 76  >:.            v
2330: 61 6c 75 65 20 6f 66 20 2d 63 65 72 74 66 69 6c  alue of -certfil
2340: 65 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  e)</dd>.        
2350: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 6b 65 79  <dt><strong>-key
2360: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66 69  </strong> <em>fi
2370: 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e  lename</em></dt>
2380: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72 6f  .        <dd>Pro
2390: 76 69 64 65 20 74 68 65 20 70 72 69 76 61 74 65  vide the private
23a0: 20 6b 65 79 20 74 6f 20 75 73 65 20 61 73 20 61   key to use as a
23b0: 20 44 45 52 20 65 6e 63 6f 64 65 64 20 76 61 6c   DER encoded val
23c0: 75 65 20 28 50 4b 43 53 23 31 20 44 45 52 29 3c  ue (PKCS#1 DER)<
23d0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
23e0: 3e 3c 73 74 72 6f 6e 67 3e 2d 6d 6f 64 65 6c 3c  ><strong>-model<
23f0: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61  /strong> <em>cha
2400: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20  nnel</em></dt>. 
2410: 20 20 20 20 20 20 20 3c 64 64 3e 54 68 69 73 20         <dd>This 
2420: 77 69 6c 6c 20 66 6f 72 63 65 20 74 68 69 73 20  will force this 
2430: 63 68 61 6e 6e 65 6c 20 74 6f 20 73 68 61 72 65  channel to share
2440: 20 74 68 65 20 73 61 6d 65 20 3c 65 6d 3e 3c 73   the same <em><s
2450: 74 72 6f 6e 67 3e 53 53 4c 5f 43 54 58 3c 2f 73  trong>SSL_CTX</s
2460: 74 72 6f 6e 67 3e 3c 2f 65 6d 3e 0a 20 20 20 20  trong></em>.    
2470: 20 20 20 20 20 20 20 20 73 74 72 75 63 74 75 72          structur
2480: 65 20 61 73 20 74 68 65 20 73 70 65 63 69 66 69  e as the specifi
2490: 65 64 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f  ed <em>channel</
24a0: 65 6d 3e 2c 20 61 6e 64 0a 20 20 20 20 20 20 20  em>, and.       
24b0: 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 20 73       therefore s
24c0: 68 61 72 65 20 63 61 6c 6c 62 61 63 6b 73 20 65  hare callbacks e
24d0: 74 63 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20  tc.</dd>.       
24e0: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61   <dt><strong>-pa
24f0: 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20  ssword</strong> 
2500: 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d  <em>callback</em
2510: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c  ></dt>.        <
2520: 64 64 3e 49 66 20 73 75 70 70 6c 69 65 64 2c 20  dd>If supplied, 
2530: 74 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 69  this callback wi
2540: 6c 6c 20 62 65 20 69 6e 76 6f 6b 65 64 20 77 68  ll be invoked wh
2550: 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73  en OpenSSL needs
2560: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 6f 20  .            to 
2570: 6f 62 74 61 69 6e 20 61 20 70 61 73 73 77 6f 72  obtain a passwor
2580: 64 2c 20 74 79 70 69 63 61 6c 6c 79 20 74 6f 20  d, typically to 
2590: 75 6e 6c 6f 63 6b 20 74 68 65 20 70 72 69 76 61  unlock the priva
25a0: 74 65 20 6b 65 79 20 6f 66 0a 09 20 20 20 20 61  te key of..    a
25b0: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 20 20   certificate..  
25c0: 20 20 20 20 20 20 20 20 20 20 54 68 65 20 63 61            The ca
25d0: 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65  llback should re
25e0: 74 75 72 6e 20 61 20 73 74 72 69 6e 67 20 77 68  turn a string wh
25f0: 69 63 68 20 72 65 70 72 65 73 65 6e 74 73 20 74  ich represents t
2600: 68 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 70  he.            p
2610: 61 73 73 77 6f 72 64 20 74 6f 20 62 65 20 75 73  assword to be us
2620: 65 64 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20  ed..            
2630: 3c 62 72 3e 0a 20 20 20 20 20 20 20 20 20 20 20  <br>.           
2640: 20 53 65 65 20 3c 61 20 68 72 65 66 3d 22 23 43   See <a href="#C
2650: 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 22  ALLBACK OPTIONS"
2660: 3e 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e  >CALLBACK OPTION
2670: 53 3c 2f 61 3e 20 66 6f 72 0a 20 20 20 20 20 20  S</a> for.      
2680: 20 20 20 20 20 20 66 75 72 74 68 65 72 20 64 69        further di
2690: 73 63 75 73 73 69 6f 6e 2e 3c 2f 64 64 3e 0a 20  scussion.</dd>. 
26a0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
26b0: 6e 67 3e 2d 72 65 71 75 65 73 74 20 3c 2f 73 74  ng>-request </st
26c0: 72 6f 6e 67 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65  rong><em>bool</e
26d0: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
26e0: 3c 64 64 3e 52 65 71 75 65 73 74 20 61 20 63 65  <dd>Request a ce
26f0: 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 70  rtificate from p
2700: 65 65 72 20 64 75 72 69 6e 67 20 53 53 4c 20 68  eer during SSL h
2710: 61 6e 64 73 68 61 6b 65 2e 0a 20 20 20 20 20 20  andshake..      
2720: 20 20 20 20 20 20 28 3c 73 74 72 6f 6e 67 3e 64        (<strong>d
2730: 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a  efault</strong>:
2740: 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c   <em>true</em>)<
2750: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
2760: 3e 3c 73 74 72 6f 6e 67 3e 2d 72 65 71 75 69 72  ><strong>-requir
2770: 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62  e</strong> <em>b
2780: 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ool</em></dt>.  
2790: 20 20 20 20 20 20 3c 64 64 3e 52 65 71 75 69 72        <dd>Requir
27a0: 65 20 61 20 76 61 6c 69 64 20 63 65 72 74 69 66  e a valid certif
27b0: 69 63 61 74 65 20 66 72 6f 6d 20 70 65 65 72 20  icate from peer 
27c0: 64 75 72 69 6e 67 20 53 53 4c 0a 20 20 20 20 20  during SSL.     
27d0: 20 20 20 20 20 20 20 68 61 6e 64 73 68 61 6b 65         handshake
27e0: 2e 20 49 66 20 74 68 69 73 20 69 73 20 73 65 74  . If this is set
27f0: 20 74 6f 20 74 72 75 65 20 74 68 65 6e 20 3c 73   to true then <s
2800: 74 72 6f 6e 67 3e 2d 72 65 71 75 65 73 74 3c 2f  trong>-request</
2810: 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20  strong>.        
2820: 20 20 20 20 6d 75 73 74 20 61 6c 73 6f 20 62 65      must also be
2830: 20 73 65 74 20 74 6f 20 74 72 75 65 2e 20 28 3c   set to true. (<
2840: 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f  strong>default</
2850: 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c  strong>: <em>fal
2860: 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20  se</em>)</dd>.  
2870: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
2880: 67 3e 2d 73 65 72 76 65 72 3c 2f 73 74 72 6f 6e  g>-server</stron
2890: 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e  g> <em>bool</em>
28a0: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
28b0: 64 3e 48 61 6e 64 73 68 61 6b 65 20 61 73 20 73  d>Handshake as s
28c0: 65 72 76 65 72 20 69 66 20 74 72 75 65 2c 20 65  erver if true, e
28d0: 6c 73 65 20 68 61 6e 64 73 68 61 6b 65 20 61 73  lse handshake as
28e0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 6c 69  .            cli
28f0: 65 6e 74 2e 28 3c 73 74 72 6f 6e 67 3e 64 65 66  ent.(<strong>def
2900: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c  ault</strong>: <
2910: 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f  em>false</em>)</
2920: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
2930: 3c 73 74 72 6f 6e 67 3e 2d 73 65 72 76 65 72 6e  <strong>-servern
2940: 61 6d 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  ame</strong> <em
2950: 3e 68 6f 73 74 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  >host</em></dt>.
2960: 20 20 20 20 20 20 20 20 3c 64 64 3e 4f 6e 6c 79          <dd>Only
2970: 20 61 76 61 69 6c 61 62 6c 65 20 69 66 20 74 68   available if th
2980: 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72  e OpenSSL librar
2990: 79 20 74 68 65 20 70 61 63 6b 61 67 65 20 69 73  y the package is
29a0: 20 6c 69 6e 6b 65 64 0a 09 20 20 20 20 61 67 61   linked..    aga
29b0: 69 6e 73 74 20 73 75 70 70 6f 72 74 73 20 74 68  inst supports th
29c0: 65 20 54 4c 53 20 68 6f 73 74 6e 61 6d 65 20 65  e TLS hostname e
29d0: 78 74 65 6e 73 69 6f 6e 20 66 6f 72 20 27 53 65  xtension for 'Se
29e0: 72 76 65 72 20 4e 61 6d 65 0a 09 20 20 20 20 49  rver Name..    I
29f0: 6e 64 69 63 61 74 69 6f 6e 27 20 28 53 4e 49 29  ndication' (SNI)
2a00: 2e 20 55 73 65 20 74 6f 20 6e 61 6d 65 20 74 68  . Use to name th
2a10: 65 20 6c 6f 67 69 63 61 6c 20 68 6f 73 74 20 77  e logical host w
2a20: 65 20 61 72 65 20 74 61 6c 6b 69 6e 67 0a 09 20  e are talking.. 
2a30: 20 20 20 74 6f 20 61 6e 64 20 65 78 70 65 63 74     to and expect
2a40: 69 6e 67 20 61 20 63 65 72 74 69 66 69 63 61 74  ing a certificat
2a50: 65 20 66 6f 72 3c 2f 64 64 3e 0a 20 20 20 20 20  e for</dd>.     
2a60: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
2a70: 73 73 6c 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  ssl2</strong> <e
2a80: 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>bool</em></dt>
2a90: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61  .        <dd>Ena
2aa0: 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20 76  ble use of SSL v
2ab0: 32 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61  2. (<strong>defa
2ac0: 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65  ult</strong>: <e
2ad0: 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64  m>false</em>)</d
2ae0: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
2af0: 73 74 72 6f 6e 67 3e 2d 73 73 6c 33 20 3c 2f 73  strong>-ssl3 </s
2b00: 74 72 6f 6e 67 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f  trong><em>bool</
2b10: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
2b20: 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65 20   <dd>Enable use 
2b30: 6f 66 20 53 53 4c 20 76 33 2e 20 28 3c 73 74 72  of SSL v3. (<str
2b40: 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72  ong>default</str
2b50: 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c  ong>: <em>false<
2b60: 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20  /em>)</dd>.     
2b70: 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67 3e     <dt>-<strong>
2b80: 74 6c 73 31 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  tls1</strong> <e
2b90: 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>bool</em></dt>
2ba0: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61  .        <dd>Ena
2bb0: 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76  ble use of TLS v
2bc0: 31 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61  1. (<strong>defa
2bd0: 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65  ult</strong>: <e
2be0: 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64  m>true</em>)</dd
2bf0: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 2d 3c  >.        <dt>-<
2c00: 73 74 72 6f 6e 67 3e 74 6c 73 31 2e 31 3c 2f 73  strong>tls1.1</s
2c10: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c  trong> <em>bool<
2c20: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
2c30: 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65    <dd>Enable use
2c40: 20 6f 66 20 54 4c 53 20 76 31 2e 31 20 28 3c 73   of TLS v1.1 (<s
2c50: 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73  trong>default</s
2c60: 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72 75 65  trong>: <em>true
2c70: 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20  </em>)</dd>.    
2c80: 20 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67      <dt>-<strong
2c90: 3e 74 6c 73 31 2e 32 3c 2f 73 74 72 6f 6e 67 3e  >tls1.2</strong>
2ca0: 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f   <em>bool</em></
2cb0: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e  dt>.        <dd>
2cc0: 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c  Enable use of TL
2cd0: 53 20 76 31 2e 32 20 28 3c 73 74 72 6f 6e 67 3e  S v1.2 (<strong>
2ce0: 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e  default</strong>
2cf0: 3a 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29  : <em>true</em>)
2d00: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dd>.        <d
2d10: 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31 2e  t>-<strong>tls1.
2d20: 33 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62  3</strong> <em>b
2d30: 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ool</em></dt>.  
2d40: 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65        <dd>Enable
2d50: 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 33   use of TLS v1.3
2d60: 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c   (<strong>defaul
2d70: 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e  t</strong>: <em>
2d80: 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a  true</em>)</dd>.
2d90: 20 20 20 20 3c 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63      </dl>.</bloc
2da0: 6b 71 75 6f 74 65 3e 0a 0a 3c 64 6c 3e 0a 20 20  kquote>..<dl>.  
2db0: 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74    <dt><a name="t
2dc0: 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 22 3e 3c 62  ls::unimport"><b
2dd0: 3e 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 20 3c  >tls::unimport <
2de0: 2f 62 3e 3c 69 3e 63 68 61 6e 6e 65 6c 3c 2f 69  /b><i>channel</i
2df0: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c  ></a></dt>.    <
2e00: 64 64 3e 50 72 6f 76 69 64 65 64 20 66 6f 72 20  dd>Provided for 
2e10: 73 79 6d 6d 65 74 72 79 20 74 6f 20 3c 73 74 72  symmetry to <str
2e20: 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c  ong>tls::import<
2e30: 2f 73 74 72 6f 6e 67 3e 2c 20 74 68 69 73 0a 20  /strong>, this. 
2e40: 20 20 20 20 20 75 6e 73 74 61 63 6b 73 20 74 68       unstacks th
2e50: 65 20 53 53 4c 2d 65 6e 61 62 6c 69 6e 67 20 6f  e SSL-enabling o
2e60: 66 20 61 20 72 65 67 75 6c 61 72 20 54 63 6c 20  f a regular Tcl 
2e70: 63 68 61 6e 6e 65 6c 2e 20 20 41 6e 20 65 72 72  channel.  An err
2e80: 6f 72 0a 20 20 20 20 20 20 69 73 20 74 68 72 6f  or.      is thro
2e90: 77 6e 20 69 66 20 54 4c 53 20 69 73 20 6e 6f 74  wn if TLS is not
2ea0: 20 74 68 65 20 74 6f 70 20 73 74 61 63 6b 65 64   the top stacked
2eb0: 20 63 68 61 6e 6e 65 6c 20 74 79 70 65 2e 3c 2f   channel type.</
2ec0: 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 64 6c 3e 0a  dd>.</dl>..<dl>.
2ed0: 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d      <dt><a name=
2ee0: 22 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 70 72  "tls::ciphers pr
2ef0: 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f  otocol ?verbose?
2f00: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63  "><strong>tls::c
2f10: 69 70 68 65 72 73 3c 2f 73 74 72 6f 6e 67 3e 0a  iphers</strong>.
2f20: 20 20 20 20 20 20 20 20 3c 65 6d 3e 70 72 6f 74          <em>prot
2f30: 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 3c 2f  ocol ?verbose?</
2f40: 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20  em></a></dt>.   
2f50: 20 3c 64 64 3e 52 65 74 75 72 6e 73 20 6c 69 73   <dd>Returns lis
2f60: 74 20 6f 66 20 73 75 70 70 6f 72 74 65 64 20 63  t of supported c
2f70: 69 70 68 65 72 73 20 62 61 73 65 64 20 6f 6e 20  iphers based on 
2f80: 74 68 65 20 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c  the <em>protocol
2f90: 3c 2f 65 6d 3e 0a 20 20 20 20 20 20 20 20 79 6f  </em>.        yo
2fa0: 75 20 73 75 70 70 6c 79 2c 20 77 68 69 63 68 20  u supply, which 
2fb0: 6d 75 73 74 20 62 65 20 6f 6e 65 20 6f 66 20 3c  must be one of <
2fc0: 65 6d 3e 73 73 6c 32 2c 20 73 73 6c 33 2c 20 6f  em>ssl2, ssl3, o
2fd0: 72 20 74 6c 73 31 3c 2f 65 6d 3e 2e 0a 20 20 20  r tls1</em>..   
2fe0: 20 20 20 20 20 49 66 20 3c 65 6d 3e 76 65 72 62       If <em>verb
2ff0: 6f 73 65 3c 2f 65 6d 3e 20 69 73 20 73 70 65 63  ose</em> is spec
3000: 69 66 69 65 64 20 61 73 20 74 72 75 65 20 74 68  ified as true th
3010: 65 6e 20 61 20 76 65 72 62 6f 73 65 2c 0a 20 20  en a verbose,.  
3020: 20 20 20 20 20 20 73 65 6d 69 2d 68 75 6d 61 6e        semi-human
3030: 20 72 65 61 64 61 62 6c 65 20 6c 69 73 74 20 69   readable list i
3040: 73 20 72 65 74 75 72 6e 65 64 20 70 72 6f 76 69  s returned provi
3050: 64 69 6e 67 20 61 64 64 69 74 69 6f 6e 61 6c 0a  ding additional.
3060: 20 20 20 20 20 20 20 20 69 6e 66 6f 72 6d 61 74          informat
3070: 69 6f 6e 20 6f 6e 20 74 68 65 20 6e 61 74 75 72  ion on the natur
3080: 65 20 6f 66 20 74 68 65 20 63 69 70 68 65 72 20  e of the cipher 
3090: 73 75 70 70 6f 72 74 2e 20 49 6e 20 65 61 63 68  support. In each
30a0: 0a 20 20 20 20 20 20 20 20 63 61 73 65 20 74 68  .        case th
30b0: 65 20 72 65 73 75 6c 74 20 69 73 20 61 20 54 63  e result is a Tc
30c0: 6c 20 6c 69 73 74 2e 3c 2f 64 64 3e 0a 3c 2f 64  l list.</dd>.</d
30d0: 6c 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74  l>..<dl>.    <dt
30e0: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 76  ><a name="tls::v
30f0: 65 72 73 69 6f 6e 22 3e 3c 73 74 72 6f 6e 67 3e  ersion"><strong>
3100: 74 6c 73 3a 3a 76 65 72 73 69 6f 6e 3c 2f 73 74  tls::version</st
3110: 72 6f 6e 67 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20  rong></a></dt>. 
3120: 20 20 20 3c 64 64 3e 52 65 74 75 72 6e 73 20 74     <dd>Returns t
3130: 68 65 20 76 65 72 73 69 6f 6e 20 73 74 72 69 6e  he version strin
3140: 67 20 64 65 66 69 6e 65 64 20 62 79 20 4f 70 65  g defined by Ope
3150: 6e 53 53 4c 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e  nSSL.</dd>.</dl>
3160: 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 43  ..<h3><a name="C
3170: 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 22  ALLBACK OPTIONS"
3180: 3e 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e  >CALLBACK OPTION
3190: 53 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 0a  S</a></h3>..<p>.
31a0: 41 73 20 69 6e 64 69 63 61 74 65 64 20 61 62 6f  As indicated abo
31b0: 76 65 2c 20 69 6e 64 69 76 69 64 75 61 6c 20 63  ve, individual c
31c0: 68 61 6e 6e 65 6c 73 20 63 61 6e 20 62 65 20 67  hannels can be g
31d0: 69 76 65 6e 20 74 68 65 69 72 20 6f 77 6e 20 63  iven their own c
31e0: 61 6c 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e 64  allbacks.to hand
31f0: 6c 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20  le intermediate 
3200: 70 72 6f 63 65 73 73 69 6e 67 20 62 79 20 74 68  processing by th
3210: 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72  e OpenSSL librar
3220: 79 2c 20 75 73 69 6e 67 20 74 68 65 0a 3c 65 6d  y, using the.<em
3230: 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61  >-command</em> a
3240: 6e 64 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64  nd <em>-password
3250: 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 73 20 70 61  </em> options pa
3260: 73 73 65 64 20 74 6f 20 65 69 74 68 65 72 20 6f  ssed to either o
3270: 66 0a 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  f.<strong>tls::s
3280: 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 20 6f  ocket</strong> o
3290: 72 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 69  r <strong>tls::i
32a0: 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 2e 0a  mport</strong>..
32b0: 3c 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74  </p>..<blockquot
32c0: 65 3e 0a 3c 64 6c 3e 0a 0a 20 20 20 20 3c 64 74  e>.<dl>..    <dt
32d0: 3e 3c 73 74 72 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e  ><strong>-comman
32e0: 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  d</strong> <em>c
32f0: 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f 64 74  allback</em></dt
3300: 3e 0a 20 20 20 20 3c 64 64 3e 0a 09 49 6e 76 6f  >.    <dd>..Invo
3310: 6b 65 73 20 74 68 65 20 73 70 65 63 69 66 69 65  kes the specifie
3320: 64 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f  d <em>callback</
3330: 65 6d 3e 20 73 63 72 69 70 74 20 61 74 0a 09 73  em> script at..s
3340: 65 76 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75  everal points du
3350: 72 69 6e 67 20 74 68 65 20 4f 70 65 6e 53 53 4c  ring the OpenSSL
3360: 20 68 61 6e 64 73 68 61 6b 65 2e 0a 09 45 78 63   handshake...Exc
3370: 65 70 74 20 61 73 20 69 6e 64 69 63 61 74 65 64  ept as indicated
3380: 20 62 65 6c 6f 77 2c 20 76 61 6c 75 65 73 20 72   below, values r
3390: 65 74 75 72 6e 65 64 20 66 72 6f 6d 20 74 68 65  eturned from the
33a0: 0a 09 63 61 6c 6c 62 61 63 6b 20 61 72 65 20 69  ..callback are i
33b0: 67 6e 6f 72 65 64 2e 0a 09 41 72 67 75 6d 65 6e  gnored...Argumen
33c0: 74 73 20 61 70 70 65 6e 64 65 64 20 74 6f 20 74  ts appended to t
33d0: 68 65 20 73 63 72 69 70 74 20 75 70 6f 6e 20 63  he script upon c
33e0: 61 6c 6c 62 61 63 6b 20 74 61 6b 65 20 6f 6e 65  allback take one
33f0: 20 6f 66 20 74 68 65 0a 09 66 6f 6c 6c 6f 77 69   of the..followi
3400: 6e 67 20 66 6f 72 6d 73 3a 0a 0a 09 3c 62 72 3e  ng forms:...<br>
3410: 0a 09 3c 62 72 3e 0a 0a 09 3c 64 6c 3e 0a 0a 3c  ..<br>...<dl>..<
3420: 21 2d 2d 09 54 68 69 73 20 66 6f 72 6d 20 6f 66  !--.This form of
3430: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 64 69 73   callback is dis
3440: 61 62 6c 65 64 2e 0a 0a 09 3c 64 74 3e 0a 09 20  abled....<dt>.. 
3450: 20 3c 73 74 72 6f 6e 67 3e 65 72 72 6f 72 3c 2f   <strong>error</
3460: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e  strong> <em>chan
3470: 6e 65 6c 20 6d 65 73 73 61 67 65 3c 2f 65 6d 3e  nel message</em>
3480: 0a 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e 0a 09 20  ..</dt>..<dd>.. 
3490: 20 54 68 65 20 3c 65 6d 3e 6d 65 73 73 61 67 65   The <em>message
34a0: 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 63  </em> argument c
34b0: 6f 6e 74 61 69 6e 73 20 61 6e 20 65 72 72 6f 72  ontains an error
34c0: 20 6d 65 73 73 61 67 65 20 67 65 6e 65 72 61 74   message generat
34d0: 65 64 0a 09 20 20 62 79 20 74 68 65 20 4f 70 65  ed..  by the Ope
34e0: 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 09 20  nSSL function.. 
34f0: 20 3c 63 6f 64 65 3e 45 52 52 5f 72 65 61 73 6f   <code>ERR_reaso
3500: 6e 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67 28 29  n_error_string()
3510: 3c 2f 63 6f 64 65 3e 2e 0a 09 3c 2f 64 64 3e 0a  </code>...</dd>.
3520: 0a 09 3c 62 72 3e 0a 2d 2d 3e 0a 0a 09 3c 64 74  ..<br>.-->...<dt
3530: 3e 0a 09 20 20 3c 73 74 72 6f 6e 67 3e 69 6e 66  >..  <strong>inf
3540: 6f 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  o</strong> <em>c
3550: 68 61 6e 6e 65 6c 20 6d 61 6a 6f 72 20 6d 69 6e  hannel major min
3560: 6f 72 20 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 0a  or message</em>.
3570: 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e 0a 09 20 20  .</dt>..<dd>..  
3580: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
3590: 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64  lback is invoked
35a0: 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20   by the OpenSSL 
35b0: 66 75 6e 63 74 69 6f 6e 0a 09 20 20 3c 63 6f 64  function..  <cod
35c0: 65 3e 53 53 4c 5f 43 54 58 5f 73 65 74 5f 69 6e  e>SSL_CTX_set_in
35d0: 66 6f 5f 63 61 6c 6c 62 61 63 6b 28 29 3c 2f 63  fo_callback()</c
35e0: 6f 64 65 3e 2e 0a 09 20 20 3c 62 72 3e 0a 09 20  ode>...  <br>.. 
35f0: 20 54 68 65 20 3c 65 6d 3e 6d 61 6a 6f 72 3c 2f   The <em>major</
3600: 65 6d 3e 20 61 6e 64 20 3c 65 6d 3e 6d 69 6e 6f  em> and <em>mino
3610: 72 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 73  r</em> arguments
3620: 20 61 72 65 20 75 73 65 64 20 74 6f 0a 09 20 20   are used to..  
3630: 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 73 74  represent the st
3640: 61 74 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20  ate information 
3650: 62 69 74 6d 61 73 6b 2e 0a 09 20 20 3c 64 6c 3e  bitmask...  <dl>
3660: 0a 09 20 20 3c 64 74 3e 50 6f 73 73 69 62 6c 65  ..  <dt>Possible
3670: 20 76 61 6c 75 65 73 20 66 6f 72 20 3c 65 6d 3e   values for <em>
3680: 6d 61 6a 6f 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c  major</em> are:<
3690: 2f 64 74 3e 0a 09 20 20 3c 64 64 3e 3c 63 6f 64  /dt>..  <dd><cod
36a0: 65 3e 68 61 6e 64 73 68 61 6b 65 2c 20 61 6c 65  e>handshake, ale
36b0: 72 74 2c 20 63 6f 6e 6e 65 63 74 2c 20 61 63 63  rt, connect, acc
36c0: 65 70 74 3c 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e  ept</code>.</dd>
36d0: 0a 09 20 20 3c 64 74 3e 50 6f 73 73 69 62 6c 65  ..  <dt>Possible
36e0: 20 76 61 6c 75 65 73 20 66 6f 72 20 3c 65 6d 3e   values for <em>
36f0: 6d 69 6e 6f 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c  minor</em> are:<
3700: 2f 64 74 3e 0a 09 20 20 3c 64 64 3e 3c 63 6f 64  /dt>..  <dd><cod
3710: 65 3e 73 74 61 72 74 2c 20 64 6f 6e 65 2c 20 72  e>start, done, r
3720: 65 61 64 2c 20 77 72 69 74 65 2c 20 6c 6f 6f 70  ead, write, loop
3730: 2c 20 65 78 69 74 3c 2f 63 6f 64 65 3e 2e 3c 2f  , exit</code>.</
3740: 64 64 3e 0a 09 20 20 3c 2f 64 6c 3e 0a 09 20 20  dd>..  </dl>..  
3750: 54 68 65 20 3c 65 6d 3e 6d 65 73 73 61 67 65 3c  The <em>message<
3760: 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 69 73  /em> argument is
3770: 20 61 20 64 65 73 63 72 69 70 74 69 76 65 20 73   a descriptive s
3780: 74 72 69 6e 67 20 77 68 69 63 68 20 6d 61 79 0a  tring which may.
3790: 09 20 20 62 65 20 67 65 6e 65 72 61 74 65 64 20  .  be generated 
37a0: 65 69 74 68 65 72 20 62 79 0a 09 20 20 3c 63 6f  either by..  <co
37b0: 64 65 3e 53 53 4c 5f 73 74 61 74 65 5f 73 74 72  de>SSL_state_str
37c0: 69 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65  ing_long()</code
37d0: 3e 20 6f 72 20 62 79 0a 09 20 20 3c 63 6f 64 65  > or by..  <code
37e0: 3e 53 53 4c 5f 61 6c 65 72 74 5f 64 65 73 63 5f  >SSL_alert_desc_
37f0: 73 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63  string_long()</c
3800: 6f 64 65 3e 2c 0a 09 20 20 64 65 70 65 6e 64 69  ode>,..  dependi
3810: 6e 67 20 6f 6e 20 63 6f 6e 74 65 78 74 2e 0a 09  ng on context...
3820: 3c 2f 64 64 3e 0a 0a 09 3c 62 72 3e 0a 0a 09 3c  </dd>...<br>...<
3830: 64 74 3e 0a 09 20 20 3c 73 74 72 6f 6e 67 3e 76  dt>..  <strong>v
3840: 65 72 69 66 79 3c 2f 73 74 72 6f 6e 67 3e 20 3c  erify</strong> <
3850: 65 6d 3e 63 68 61 6e 6e 65 6c 20 64 65 70 74 68  em>channel depth
3860: 20 63 65 72 74 20 73 74 61 74 75 73 20 65 72 72   cert status err
3870: 6f 72 3c 2f 65 6d 3e 0a 09 3c 2f 64 74 3e 0a 09  or</em>..</dt>..
3880: 3c 64 64 3e 0a 09 20 20 54 68 69 73 20 66 6f 72  <dd>..  This for
3890: 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73  m of callback is
38a0: 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20   invoked by the 
38b0: 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e  OpenSSL function
38c0: 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c 5f 73 65  ..  <code>SSL_se
38d0: 74 5f 76 65 72 69 66 79 28 29 3c 2f 63 6f 64 65  t_verify()</code
38e0: 3e 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68  >...  <br>..  Th
38f0: 65 20 3c 65 6d 3e 64 65 70 74 68 3c 2f 65 6d 3e  e <em>depth</em>
3900: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 6e 20   argument is an 
3910: 69 6e 74 65 67 65 72 20 72 65 70 72 65 73 65 6e  integer represen
3920: 74 69 6e 67 20 74 68 65 0a 09 20 20 63 75 72 72  ting the..  curr
3930: 65 6e 74 20 64 65 70 74 68 20 6f 6e 20 74 68 65  ent depth on the
3940: 20 63 65 72 74 69 66 69 63 61 74 65 20 63 68 61   certificate cha
3950: 69 6e 2c 20 77 69 74 68 0a 09 20 20 3c 63 6f 64  in, with..  <cod
3960: 65 3e 30 3c 2f 63 6f 64 65 3e 20 61 73 20 74 68  e>0</code> as th
3970: 65 20 73 75 62 6a 65 63 74 20 63 65 72 74 69 66  e subject certif
3980: 69 63 61 74 65 20 61 6e 64 20 68 69 67 68 65 72  icate and higher
3990: 20 76 61 6c 75 65 73 0a 09 20 20 64 65 6e 6f 74   values..  denot
39a0: 69 6e 67 20 70 72 6f 67 72 65 73 73 69 76 65 6c  ing progressivel
39b0: 79 20 6d 6f 72 65 20 69 6e 64 69 72 65 63 74 20  y more indirect 
39c0: 69 73 73 75 65 72 20 63 65 72 74 69 66 69 63 61  issuer certifica
39d0: 74 65 73 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20  tes...  <br>..  
39e0: 54 68 65 20 3c 65 6d 3e 63 65 72 74 3c 2f 65 6d  The <em>cert</em
39f0: 3e 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20  > argument is a 
3a00: 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75  list of key-valu
3a10: 65 20 70 61 69 72 73 20 73 69 6d 69 6c 61 72 0a  e pairs similar.
3a20: 09 20 20 74 6f 20 74 68 6f 73 65 20 72 65 74 75  .  to those retu
3a30: 72 6e 65 64 20 62 79 0a 09 20 20 3c 61 20 68 72  rned by..  <a hr
3a40: 65 66 3d 22 23 74 6c 73 3a 3a 73 74 61 74 75 73  ef="#tls::status
3a50: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  "><strong>tls::s
3a60: 74 61 74 75 73 3c 2f 73 74 72 6f 6e 67 3e 3c 2f  tatus</strong></
3a70: 61 3e 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54  a>...  <br>..  T
3a80: 68 65 20 3c 65 6d 3e 73 74 61 74 75 73 3c 2f 65  he <em>status</e
3a90: 6d 3e 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61  m> argument is a
3aa0: 6e 20 69 6e 74 65 67 65 72 20 72 65 70 72 65 73  n integer repres
3ab0: 65 6e 74 69 6e 67 20 74 68 65 0a 09 20 20 63 75  enting the..  cu
3ac0: 72 72 65 6e 74 20 76 61 6c 69 64 69 74 79 20 6f  rrent validity o
3ad0: 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  f the certificat
3ae0: 65 2e 0a 09 20 20 41 20 76 61 6c 75 65 20 6f 66  e...  A value of
3af0: 20 3c 63 6f 64 65 3e 30 3c 2f 63 6f 64 65 3e 20   <code>0</code> 
3b00: 6d 65 61 6e 73 20 74 68 65 20 63 65 72 74 69 66  means the certif
3b10: 69 63 61 74 65 20 69 73 20 64 65 65 6d 65 64 20  icate is deemed 
3b20: 69 6e 76 61 6c 69 64 2e 0a 09 20 20 41 20 76 61  invalid...  A va
3b30: 6c 75 65 20 6f 66 20 3c 63 6f 64 65 3e 31 3c 2f  lue of <code>1</
3b40: 63 6f 64 65 3e 20 6d 65 61 6e 73 20 74 68 65 20  code> means the 
3b50: 63 65 72 74 69 66 69 63 61 74 65 20 69 73 20 64  certificate is d
3b60: 65 65 6d 65 64 20 76 61 6c 69 64 2e 0a 09 20 20  eemed valid...  
3b70: 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65 6d 3e  <br>..  The <em>
3b80: 65 72 72 6f 72 3c 2f 65 6d 3e 20 61 72 67 75 6d  error</em> argum
3b90: 65 6e 74 20 73 75 70 70 6c 69 65 73 20 74 68 65  ent supplies the
3ba0: 20 6d 65 73 73 61 67 65 2c 20 69 66 20 61 6e 79   message, if any
3bb0: 2c 20 67 65 6e 65 72 61 74 65 64 0a 09 20 20 62  , generated..  b
3bc0: 79 0a 09 20 20 3c 63 6f 64 65 3e 58 35 30 39 5f  y..  <code>X509_
3bd0: 53 54 4f 52 45 5f 43 54 58 5f 67 65 74 5f 65 72  STORE_CTX_get_er
3be0: 72 6f 72 28 29 3c 2f 63 6f 64 65 3e 2e 0a 09 20  ror()</code>... 
3bf0: 20 3c 62 72 3e 0a 09 20 20 3c 62 72 3e 0a 09 20   <br>..  <br>.. 
3c00: 20 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 6d 61   The callback ma
3c10: 79 20 6f 76 65 72 72 69 64 65 20 6e 6f 72 6d 61  y override norma
3c20: 6c 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72 6f  l validation pro
3c30: 63 65 73 73 69 6e 67 20 62 79 20 65 78 70 6c 69  cessing by expli
3c40: 63 69 74 6c 79 0a 09 20 20 72 65 74 75 72 6e 69  citly..  returni
3c50: 6e 67 20 6f 6e 65 20 6f 66 20 74 68 65 20 61 62  ng one of the ab
3c60: 6f 76 65 20 3c 65 6d 3e 73 74 61 74 75 73 3c 2f  ove <em>status</
3c70: 65 6d 3e 20 76 61 6c 75 65 73 2e 0a 09 3c 2f 64  em> values...</d
3c80: 64 3e 0a 0a 09 3c 2f 64 6c 3e 0a 20 20 20 20 3c  d>...</dl>.    <
3c90: 2f 64 64 3e 0a 0a 20 20 20 20 3c 62 72 3e 0a 0a  /dd>..    <br>..
3ca0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
3cb0: 2d 70 61 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e  -password</stron
3cc0: 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c  g> <em>callback<
3cd0: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64  /em></dt>.    <d
3ce0: 64 3e 0a 09 49 6e 76 6f 6b 65 73 20 74 68 65 20  d>..Invokes the 
3cf0: 73 70 65 63 69 66 69 65 64 20 3c 65 6d 3e 63 61  specified <em>ca
3d00: 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 20 73 63 72 69  llback</em> scri
3d10: 70 74 20 77 68 65 6e 20 4f 70 65 6e 53 53 4c 20  pt when OpenSSL 
3d20: 6e 65 65 64 73 20 74 6f 0a 09 6f 62 74 61 69 6e  needs to..obtain
3d30: 20 61 20 70 61 73 73 77 6f 72 64 2e 20 20 54 68   a password.  Th
3d40: 65 20 63 61 6c 6c 62 61 63 6b 20 73 68 6f 75 6c  e callback shoul
3d50: 64 20 72 65 74 75 72 6e 20 61 20 73 74 72 69 6e  d return a strin
3d60: 67 20 77 68 69 63 68 0a 09 72 65 70 72 65 73 65  g which..represe
3d70: 6e 74 73 20 74 68 65 20 70 61 73 73 77 6f 72 64  nts the password
3d80: 20 74 6f 20 62 65 20 75 73 65 64 2e 0a 09 4e 6f   to be used...No
3d90: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 61   arguments are a
3da0: 70 70 65 6e 64 65 64 20 74 6f 20 74 68 65 20 73  ppended to the s
3db0: 63 72 69 70 74 20 75 70 6f 6e 20 63 61 6c 6c 62  cript upon callb
3dc0: 61 63 6b 2e 0a 20 20 20 20 3c 2f 64 64 3e 0a 3c  ack..    </dd>.<
3dd0: 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  /dl>.</blockquot
3de0: 65 3e 0a 0a 3c 70 3e 0a 52 65 66 65 72 65 6e 63  e>..<p>.Referenc
3df0: 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e  e implementation
3e00: 73 20 6f 66 20 74 68 65 73 65 20 63 61 6c 6c 62  s of these callb
3e10: 61 63 6b 73 20 61 72 65 20 70 72 6f 76 69 64 65  acks are provide
3e20: 64 20 69 6e 20 74 68 65 0a 64 69 73 74 72 69 62  d in the.distrib
3e30: 75 74 69 6f 6e 20 61 73 20 3c 73 74 72 6f 6e 67  ution as <strong
3e40: 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f  >tls::callback</
3e50: 73 74 72 6f 6e 67 3e 20 61 6e 64 0a 3c 73 74 72  strong> and.<str
3e60: 6f 6e 67 3e 74 6c 73 3a 3a 70 61 73 73 77 6f 72  ong>tls::passwor
3e70: 64 3c 2f 73 74 72 6f 6e 67 3e 20 72 65 73 70 65  d</strong> respe
3e80: 63 74 69 76 65 6c 79 2e 20 20 4e 6f 74 65 20 74  ctively.  Note t
3e90: 68 61 74 20 74 68 65 73 65 20 61 72 65 0a 3c 65  hat these are.<e
3ea0: 6d 3e 73 61 6d 70 6c 65 3c 2f 65 6d 3e 20 69 6d  m>sample</em> im
3eb0: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 6e  plementations on
3ec0: 6c 79 2e 20 20 49 6e 20 61 20 6d 6f 72 65 20 72  ly.  In a more r
3ed0: 65 61 6c 69 73 74 69 63 20 64 65 70 6c 6f 79 6d  ealistic deploym
3ee0: 65 6e 74 0a 79 6f 75 20 77 6f 75 6c 64 20 73 70  ent.you would sp
3ef0: 65 63 69 66 79 20 79 6f 75 72 20 6f 77 6e 20 63  ecify your own c
3f00: 61 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 73 20  allback scripts 
3f10: 6f 6e 20 65 61 63 68 20 54 4c 53 20 63 68 61 6e  on each TLS chan
3f20: 6e 65 6c 0a 75 73 69 6e 67 20 74 68 65 20 3c 65  nel.using the <e
3f30: 6d 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20  m>-command</em> 
3f40: 61 6e 64 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72  and <em>-passwor
3f50: 64 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 73 2e 0a  d</em> options..
3f60: 3c 2f 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20 64 65  </p>..<p>.The de
3f70: 66 61 75 6c 74 20 62 65 68 61 76 69 6f 72 20 77  fault behavior w
3f80: 68 65 6e 20 74 68 65 20 3c 65 6d 3e 2d 63 6f 6d  hen the <em>-com
3f90: 6d 61 6e 64 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e  mand</em> option
3fa0: 20 69 73 20 6e 6f 74 20 73 70 65 63 69 66 69 65   is not specifie
3fb0: 64 20 69 73 20 66 6f 72 0a 54 4c 53 20 74 6f 20  d is for.TLS to 
3fc0: 70 72 6f 63 65 73 73 20 74 68 65 20 61 73 73 6f  process the asso
3fd0: 63 69 61 74 65 64 20 6c 69 62 72 61 72 79 20 63  ciated library c
3fe0: 61 6c 6c 62 61 63 6b 73 20 69 6e 74 65 72 6e 61  allbacks interna
3ff0: 6c 6c 79 2e 0a 54 68 65 20 64 65 66 61 75 6c 74  lly..The default
4000: 20 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74   behavior when t
4010: 68 65 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64  he <em>-password
4020: 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 20 69 73 20  </em> option is 
4030: 6e 6f 74 20 73 70 65 63 69 66 69 65 64 20 69 73  not specified is
4040: 20 66 6f 72 0a 54 4c 53 20 74 6f 20 70 72 6f 63   for.TLS to proc
4050: 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61 74  ess the associat
4060: 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62  ed library callb
4070: 61 63 6b 73 20 62 79 20 61 74 74 65 6d 70 74 69  acks by attempti
4080: 6e 67 20 74 6f 20 63 61 6c 6c 0a 3c 73 74 72 6f  ng to call.<stro
4090: 6e 67 3e 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64  ng>tls::password
40a0: 3c 2f 73 74 72 6f 6e 67 3e 2e 0a 54 68 65 20 64  </strong>..The d
40b0: 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65  ifference betwee
40c0: 6e 20 74 68 65 73 65 20 74 77 6f 20 62 65 68 61  n these two beha
40d0: 76 69 6f 72 73 20 69 73 20 61 20 63 6f 6e 73 65  viors is a conse
40e0: 71 75 65 6e 63 65 20 6f 66 20 6d 61 69 6e 74 61  quence of mainta
40f0: 69 6e 69 6e 67 0a 63 6f 6d 70 61 74 69 62 69 6c  ining.compatibil
4100: 69 74 79 20 77 69 74 68 20 65 61 72 6c 69 65 72  ity with earlier
4110: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73   implementations
4120: 2e 0a 3c 2f 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20  ..</p>..<p>.The 
4130: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62  <strong>tls::deb
4140: 75 67 3c 2f 73 74 72 6f 6e 67 3e 20 76 61 72 69  ug</strong> vari
4150: 61 62 6c 65 20 70 72 6f 76 69 64 65 73 20 73 6f  able provides so
4160: 6d 65 20 61 64 64 69 74 69 6f 6e 61 6c 0a 63 6f  me additional.co
4170: 6e 74 72 6f 6c 20 6f 76 65 72 20 74 68 65 73 65  ntrol over these
4180: 20 72 65 66 65 72 65 6e 63 65 20 63 61 6c 6c 62   reference callb
4190: 61 63 6b 73 2e 20 20 49 74 73 20 76 61 6c 75 65  acks.  Its value
41a0: 20 69 73 20 7a 65 72 6f 20 62 79 20 64 65 66 61   is zero by defa
41b0: 75 6c 74 2e 0a 48 69 67 68 65 72 20 76 61 6c 75  ult..Higher valu
41c0: 65 73 20 70 72 6f 64 75 63 65 20 6d 6f 72 65 20  es produce more 
41d0: 64 69 61 67 6e 6f 73 74 69 63 20 6f 75 74 70 75  diagnostic outpu
41e0: 74 2c 20 61 6e 64 20 77 69 6c 6c 20 61 6c 73 6f  t, and will also
41f0: 20 66 6f 72 63 65 20 74 68 65 0a 76 65 72 69 66   force the.verif
4200: 79 20 6d 65 74 68 6f 64 20 69 6e 20 3c 73 74 72  y method in <str
4210: 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 63  ong>tls::callbac
4220: 6b 3c 2f 73 74 72 6f 6e 67 3e 20 74 6f 20 61 63  k</strong> to ac
4230: 63 65 70 74 20 74 68 65 0a 63 65 72 74 69 66 69  cept the.certifi
4240: 63 61 74 65 2c 20 65 76 65 6e 20 77 68 65 6e 20  cate, even when 
4250: 69 74 20 69 73 20 69 6e 76 61 6c 69 64 2e 0a 3c  it is invalid..<
4260: 2f 70 3e 0a 0a 3c 70 3e 0a 3c 65 6d 3e 0a 54 68  /p>..<p>.<em>.Th
4270: 65 20 75 73 65 20 6f 66 20 74 68 65 20 72 65 66  e use of the ref
4280: 65 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73  erence callbacks
4290: 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 61   <strong>tls::ca
42a0: 6c 6c 62 61 63 6b 3c 2f 73 74 72 6f 6e 67 3e 20  llback</strong> 
42b0: 61 6e 64 0a 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a  and.<strong>tls:
42c0: 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e  :password</stron
42d0: 67 3e 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d  g> is not recomm
42e0: 65 6e 64 65 64 2e 20 20 54 68 65 79 20 6d 61 79  ended.  They may
42f0: 20 62 65 20 72 65 6d 6f 76 65 64 0a 66 72 6f 6d   be removed.from
4300: 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 73   future releases
4310: 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 70  ..</em>.</p>..<p
4320: 3e 0a 3c 65 6d 3e 0a 54 68 65 20 75 73 65 20 6f  >.<em>.The use o
4330: 66 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 3c  f the variable <
4340: 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62 75  strong>tls::debu
4350: 67 3c 2f 73 74 72 6f 6e 67 3e 20 69 73 20 6e 6f  g</strong> is no
4360: 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49  t recommended..I
4370: 74 20 6d 61 79 20 62 65 20 72 65 6d 6f 76 65 64  t may be removed
4380: 20 66 72 6f 6d 20 66 75 74 75 72 65 20 72 65 6c   from future rel
4390: 65 61 73 65 73 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70  eases..</em>.</p
43a0: 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22  >..<h3><a name="
43b0: 44 45 42 55 47 22 3e 44 45 42 55 47 3c 2f 61 3e  DEBUG">DEBUG</a>
43c0: 3c 2f 68 33 3e 0a 0a 54 4c 53 20 6b 65 79 20 6c  </h3>..TLS key l
43d0: 6f 67 67 69 6e 67 20 63 61 6e 20 62 65 20 65 6e  ogging can be en
43e0: 61 62 6c 65 64 20 62 79 20 73 65 74 74 69 6e 67  abled by setting
43f0: 20 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74   the environment
4400: 20 76 61 72 69 61 62 6c 65 0a 3c 62 3e 53 53 4c   variable.<b>SSL
4410: 4b 45 59 4c 4f 47 46 49 4c 45 3c 2f 62 3e 20 74  KEYLOGFILE</b> t
4420: 6f 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68  o the name of th
4430: 65 20 66 69 6c 65 20 74 6f 20 6c 6f 67 20 74 6f  e file to log to
4440: 2e 20 54 68 65 6e 20 77 68 65 6e 65 76 65 72 20  . Then whenever 
4450: 54 4c 53 0a 6b 65 79 20 6d 61 74 65 72 69 61 6c  TLS.key material
4460: 20 69 73 20 67 65 6e 65 72 61 74 65 64 20 6f 72   is generated or
4470: 20 72 65 63 65 69 76 65 64 20 69 74 20 77 69 6c   received it wil
4480: 6c 20 62 65 20 6c 6f 67 67 65 64 20 74 6f 20 74  l be logged to t
4490: 68 65 20 66 69 6c 65 2e 0a 0a 3c 68 33 3e 3c 61  he file...<h3><a
44a0: 20 6e 61 6d 65 3d 22 48 54 54 50 53 20 45 58 41   name="HTTPS EXA
44b0: 4d 50 4c 45 22 3e 48 54 54 50 53 20 45 58 41 4d  MPLE">HTTPS EXAM
44c0: 50 4c 45 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70  PLE</a></h3>..<p
44d0: 3e 54 68 69 73 20 65 78 61 6d 70 6c 65 20 75 73  >This example us
44e0: 65 73 20 61 20 73 61 6d 70 6c 65 20 73 65 72 76  es a sample serv
44f0: 65 72 2e 70 65 6d 20 70 72 6f 76 69 64 65 64 20  er.pem provided 
4500: 77 69 74 68 20 74 68 65 20 54 4c 53 20 72 65 6c  with the TLS rel
4510: 65 61 73 65 2c 0a 63 6f 75 72 74 65 73 79 20 6f  ease,.courtesy o
4520: 66 20 74 68 65 20 3c 73 74 72 6f 6e 67 3e 4f 70  f the <strong>Op
4530: 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e 67 3e 20 70  enSSL</strong> p
4540: 72 6f 6a 65 63 74 2e 3c 2f 70 3e 0a 0a 3c 70 72  roject.</p>..<pr
4550: 65 3e 3c 63 6f 64 65 3e 0a 70 61 63 6b 61 67 65  e><code>.package
4560: 20 72 65 71 75 69 72 65 20 68 74 74 70 0a 70 61   require http.pa
4570: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 74 6c  ckage require tl
4580: 73 0a 0a 68 74 74 70 3a 3a 72 65 67 69 73 74 65  s..http::registe
4590: 72 20 68 74 74 70 73 20 34 34 33 20 5b 6c 69 73  r https 443 [lis
45a0: 74 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74 20  t ::tls::socket 
45b0: 2d 61 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 20  -autoservername 
45c0: 74 72 75 65 20 2d 72 65 71 75 69 72 65 20 74 72  true -require tr
45d0: 75 65 20 2d 63 61 64 69 72 20 2f 65 74 63 2f 73  ue -cadir /etc/s
45e0: 73 6c 2f 63 65 72 74 73 5d 0a 0a 73 65 74 20 74  sl/certs]..set t
45f0: 6f 6b 20 5b 68 74 74 70 3a 3a 67 65 74 75 72 6c  ok [http::geturl
4600: 20 68 74 74 70 73 3a 2f 2f 77 77 77 2e 74 63 6c   https://www.tcl
4610: 2e 74 6b 2f 5d 0a 3c 2f 63 6f 64 65 3e 3c 2f 70  .tk/].</code></p
4620: 72 65 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65  re>..<h3><a name
4630: 3d 22 53 50 45 43 49 41 4c 20 43 4f 4e 53 49 44  ="SPECIAL CONSID
4640: 45 52 41 54 49 4f 4e 53 22 3e 53 50 45 43 49 41  ERATIONS">SPECIA
4650: 4c 20 43 4f 4e 53 49 44 45 52 41 54 49 4f 4e 53  L CONSIDERATIONS
4660: 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68  </a></h3>..<p>Th
4670: 65 20 63 61 70 61 62 69 6c 69 74 69 65 73 20 6f  e capabilities o
4680: 66 20 74 68 69 73 20 70 61 63 6b 61 67 65 20 63  f this package c
4690: 61 6e 20 76 61 72 79 20 65 6e 6f 72 6d 6f 75 73  an vary enormous
46a0: 6c 79 20 62 61 73 65 64 0a 75 70 6f 6e 20 68 6f  ly based.upon ho
46b0: 77 20 79 6f 75 72 20 4f 70 65 6e 53 53 4c 20 6c  w your OpenSSL l
46c0: 69 62 72 61 72 79 20 77 61 73 20 63 6f 6e 66 69  ibrary was confi
46d0: 67 75 72 65 64 20 61 6e 64 20 62 75 69 6c 74 2e  gured and built.
46e0: 20 41 74 20 74 68 65 0a 6d 6f 73 74 20 6d 61 63   At the.most mac
46f0: 72 6f 2d 6c 65 76 65 6c 20 4f 70 65 6e 53 53 4c  ro-level OpenSSL
4700: 20 73 75 70 70 6f 72 74 73 20 61 20 26 71 75 6f   supports a &quo
4710: 74 3b 6e 6f 20 70 61 74 65 6e 74 73 26 71 75 6f  t;no patents&quo
4720: 74 3b 20 62 75 69 6c 64 2c 0a 77 68 69 63 68 20  t; build,.which 
4730: 64 69 73 61 62 6c 65 73 20 52 53 41 2c 20 49 44  disables RSA, ID
4740: 45 41 2c 20 52 43 28 32 2c 34 2c 35 29 20 61 6e  EA, RC(2,4,5) an
4750: 64 20 53 53 4c 32 20 2d 20 69 66 20 79 6f 75 72  d SSL2 - if your
4760: 20 4f 70 65 6e 53 53 4c 20 69 73 0a 63 6f 6e 66   OpenSSL is.conf
4770: 69 67 75 72 65 64 20 74 68 69 73 20 77 61 79 20  igured this way 
4780: 74 68 65 6e 20 79 6f 75 20 77 69 6c 6c 20 6e 65  then you will ne
4790: 65 64 20 74 6f 20 62 75 69 6c 64 20 54 4c 53 20  ed to build TLS 
47a0: 77 69 74 68 20 74 68 65 0a 2d 44 4e 4f 5f 50 41  with the.-DNO_PA
47b0: 54 45 4e 54 53 20 6f 70 74 69 6f 6e 20 2d 20 61  TENTS option - a
47c0: 6e 64 20 74 68 65 20 72 65 73 75 6c 74 61 6e 74  nd the resultant
47d0: 20 6d 6f 64 75 6c 65 20 77 69 6c 6c 20 66 75 6e   module will fun
47e0: 63 74 69 6f 6e 0a 63 6f 72 72 65 63 74 6c 79 20  ction.correctly 
47f0: 61 6e 64 20 61 6c 73 6f 20 73 75 70 70 6f 72 74  and also support
4800: 20 41 44 48 20 63 65 72 74 69 66 69 63 61 74 65   ADH certificate
4810: 2d 6c 65 73 73 20 65 6e 63 72 79 70 74 69 6f 6e  -less encryption
4820: 2c 0a 68 6f 77 65 76 65 72 20 79 6f 75 20 77 69  ,.however you wi
4830: 6c 6c 20 62 65 20 75 6e 61 62 6c 65 20 74 6f 20  ll be unable to 
4840: 75 74 69 6c 69 7a 65 20 74 68 69 73 20 74 6f 20  utilize this to 
4850: 73 70 65 61 6b 20 74 6f 20 6e 6f 72 6d 61 6c 20  speak to normal 
4860: 57 65 62 0a 53 65 72 76 65 72 73 2c 20 77 68 69  Web.Servers, whi
4870: 63 68 20 74 79 70 69 63 61 6c 6c 79 20 72 65 71  ch typically req
4880: 75 69 72 65 20 52 53 41 20 73 75 70 70 6f 72 74  uire RSA support
4890: 2e 20 50 6c 65 61 73 65 20 73 65 65 20 3c 61 0a  . Please see <a.
48a0: 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77  href="http://www
48b0: 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 68  .openssl.org/">h
48c0: 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73 73  ttp://www.openss
48d0: 6c 2e 6f 72 67 2f 3c 2f 61 3e 20 66 6f 72 0a 6d  l.org/</a> for.m
48e0: 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20  ore information 
48f0: 6f 6e 20 74 68 65 20 77 68 6f 6c 65 20 69 73 73  on the whole iss
4900: 75 65 20 6f 66 20 70 61 74 65 6e 74 73 20 61 6e  ue of patents an
4910: 64 20 55 53 20 65 78 70 6f 72 74 0a 72 65 73 74  d US export.rest
4920: 72 69 63 74 69 6f 6e 73 2e 20 3c 2f 70 3e 0a 0a  rictions. </p>..
4930: 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 45 45  <h3><a name="SEE
4940: 20 41 4c 53 4f 22 3e 53 45 45 20 41 4c 53 4f 3c   ALSO">SEE ALSO<
4950: 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 3c 73 74  /a></h3>..<p><st
4960: 72 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 74 72  rong>socket</str
4970: 6f 6e 67 3e 2c 20 3c 73 74 72 6f 6e 67 3e 66 69  ong>, <strong>fi
4980: 6c 65 65 76 65 6e 74 2c 20 3c 2f 73 74 72 6f 6e  leevent, </stron
4990: 67 3e 3c 61 0a 68 72 65 66 3d 22 68 74 74 70 3a  g><a.href="http:
49a0: 2f 2f 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72  //www.openssl.or
49b0: 67 2f 22 3e 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e  g/"><strong>Open
49c0: 53 53 4c 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e  SSL</strong></a>
49d0: 3c 2f 70 3e 0a 0a 3c 68 72 3e 0a 0a 3c 70 72 65  </p>..<hr>..<pre
49e0: 3e 0a 43 6f 70 79 72 69 67 68 74 20 26 63 6f 70  >.Copyright &cop
49f0: 79 3b 20 31 39 39 39 20 4d 61 74 74 20 4e 65 77  y; 1999 Matt New
4a00: 6d 61 6e 2e 0a 43 6f 70 79 72 69 67 68 74 20 26  man..Copyright &
4a10: 63 6f 70 79 3b 20 32 30 30 34 20 53 74 61 72 66  copy; 2004 Starf
4a20: 69 73 68 20 53 79 73 74 65 6d 73 2e 0a 3c 2f 70  ish Systems..</p
4a30: 72 65 3e 0a 3c 2f 62 6f 64 79 3e 0a 3c 2f 68 74  re>.</body>.</ht
4a40: 6d 6c 3e 0a                                      ml>.