Hex Artifact Content

Artifact a06ffeb7adbdf8b8de1551d20c98afa884ddeae00cccfd1f5dead96391d65618:


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 63 65 72 74 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>cert</em></dt>
1830: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65  .        <dd>The
1840: 20 50 45 4d 20 65 6e 63 6f 64 65 64 20 63 65 72   PEM encoded cer
1850: 74 69 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20  tificate.</dd>. 
1860: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
1870: 6e 67 3e 73 68 61 31 5f 68 61 73 68 3c 2f 73 74  ng>sha1_hash</st
1880: 72 6f 6e 67 3e 20 3c 65 6d 3e 68 61 73 68 3c 2f  rong> <em>hash</
1890: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
18a0: 20 3c 64 64 3e 54 68 65 20 53 48 41 31 20 68 61   <dd>The SHA1 ha
18b0: 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  sh of the certif
18c0: 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20  icate.</dd>.    
18d0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
18e0: 73 68 61 32 35 36 5f 68 61 73 68 3c 2f 73 74 72  sha256_hash</str
18f0: 6f 6e 67 3e 20 3c 65 6d 3e 68 61 73 68 3c 2f 65  ong> <em>hash</e
1900: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
1910: 3c 64 64 3e 54 68 65 20 53 48 41 32 35 36 20 68  <dd>The SHA256 h
1920: 61 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 69  ash of the certi
1930: 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20  ficate.</dd>.   
1940: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
1950: 3e 61 6c 70 6e 3c 2f 73 74 72 6f 6e 67 3e 20 3c  >alpn</strong> <
1960: 65 6d 3e 70 72 6f 74 6f 63 6f 6c 3c 2f 65 6d 3e  em>protocol</em>
1970: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1980: 64 3e 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73  d>The protocol s
1990: 65 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70  elected after Ap
19a0: 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20  plication-Layer 
19b0: 50 72 6f 74 6f 63 6f 6c 0a 09 20 20 20 20 4e 65  Protocol..    Ne
19c0: 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29  gotiation (ALPN)
19d0: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  .</dd>.        <
19e0: 64 74 3e 3c 73 74 72 6f 6e 67 3e 76 65 72 73 69  dt><strong>versi
19f0: 6f 6e 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e  on</strong> <em>
1a00: 76 61 6c 75 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  value</em></dt>.
1a10: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
1a20: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e  protocol version
1a30: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 6f   used for the co
1a40: 6e 6e 65 63 74 69 6f 6e 3a 0a 09 20 20 53 53 4c  nnection:..  SSL
1a50: 76 32 2c 20 53 53 4c 76 33 2c 20 54 4c 53 76 31  v2, SSLv3, TLSv1
1a60: 2c 20 54 4c 53 76 31 2e 31 2c 20 54 4c 53 76 31  , TLSv1.1, TLSv1
1a70: 2e 32 2c 20 54 4c 53 76 31 2e 33 2c 20 75 6e 6b  .2, TLSv1.3, unk
1a80: 6e 6f 77 6e 3c 2f 64 64 3e 0a 20 20 20 20 3c 2f  nown</dd>.    </
1a90: 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65  dl>.</blockquote
1aa0: 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e  >..<dl>.    <dt>
1ab0: 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 69 6d  <a name="tls::im
1ac0: 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69 6d  port"><b>tls::im
1ad0: 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e 63 68 61 6e  port </b><i>chan
1ae0: 6e 65 6c 0a 20 20 20 20 20 20 20 20 3f 6f 70 74  nel.        ?opt
1af0: 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64  ions?</i></a></d
1b00: 74 3e 0a 20 20 20 20 3c 64 64 3e 53 53 4c 2d 65  t>.    <dd>SSL-e
1b10: 6e 61 62 6c 65 20 61 20 72 65 67 75 6c 61 72 20  nable a regular 
1b20: 54 63 6c 20 63 68 61 6e 6e 65 6c 20 2d 20 69 74  Tcl channel - it
1b30: 20 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 0a 20   need not be a. 
1b40: 20 20 20 20 20 20 20 73 6f 63 6b 65 74 2c 20 62         socket, b
1b50: 75 74 20 6d 75 73 74 20 70 72 6f 76 69 64 65 20  ut must provide 
1b60: 62 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c 20 66  bi-directional f
1b70: 6c 6f 77 2e 20 41 6c 73 6f 0a 20 20 20 20 20 20  low. Also.      
1b80: 20 20 73 65 74 74 69 6e 67 20 73 65 73 73 69 6f    setting sessio
1b90: 6e 20 70 61 72 61 6d 65 74 65 72 73 20 66 6f 72  n parameters for
1ba0: 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 3c   SSL handshake.<
1bb0: 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 62 6c 6f  /dd>.</dl>..<blo
1bc0: 63 6b 71 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c  ckquote>.    <dl
1bd0: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73  >.        <dt><s
1be0: 74 72 6f 6e 67 3e 2d 61 6c 70 6e 3c 2f 73 74 72  trong>-alpn</str
1bf0: 6f 6e 67 3e 20 3c 65 6d 3e 6c 69 73 74 3c 2f 65  ong> <em>list</e
1c00: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
1c10: 3c 64 64 3e 4c 69 73 74 20 6f 66 20 70 72 6f 74  <dd>List of prot
1c20: 6f 63 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20 64  ocols to offer d
1c30: 75 72 69 6e 67 20 41 70 70 6c 69 63 61 74 69 6f  uring Applicatio
1c40: 6e 2d 4c 61 79 65 72 0a 09 20 20 20 20 50 72 6f  n-Layer..    Pro
1c50: 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f  tocol Negotiatio
1c60: 6e 20 28 41 4c 50 4e 29 2e 20 46 6f 72 20 65 78  n (ALPN). For ex
1c70: 61 6d 70 6c 65 3a 20 68 32 2c 20 68 74 74 70 2f  ample: h2, http/
1c80: 31 2e 31 2c 20 65 74 63 2e 3c 2f 64 64 3e 0a 20  1.1, etc.</dd>. 
1c90: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
1ca0: 6e 67 3e 2d 63 61 64 69 72 3c 2f 73 74 72 6f 6e  ng>-cadir</stron
1cb0: 67 3e 20 3c 65 6d 3e 64 69 72 3c 2f 65 6d 3e 3c  g> <em>dir</em><
1cc0: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
1cd0: 3e 50 72 6f 76 69 64 65 20 74 68 65 20 64 69 72  >Provide the dir
1ce0: 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e  ectory containin
1cf0: 67 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69  g the CA certifi
1d00: 63 61 74 65 73 2e 20 54 68 65 0a 09 64 65 66 61  cates. The..defa
1d10: 75 6c 74 20 64 69 72 65 63 74 6f 72 79 20 69 73  ult directory is
1d20: 20 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66   platform specif
1d30: 69 63 20 61 6e 64 20 63 61 6e 20 62 65 20 73 65  ic and can be se
1d40: 74 20 61 74 0a 09 63 6f 6d 70 69 6c 65 20 74 69  t at..compile ti
1d50: 6d 65 2e 20 54 68 69 73 20 63 61 6e 20 62 65 20  me. This can be 
1d60: 6f 76 65 72 72 69 64 64 65 6e 20 76 69 61 20 74  overridden via t
1d70: 68 65 20 3c 62 3e 53 53 4c 5f 43 45 52 54 5f 44  he <b>SSL_CERT_D
1d80: 49 52 3c 2f 62 3e 0a 09 65 6e 76 69 72 6f 6e 6d  IR</b>..environm
1d90: 65 6e 74 20 76 61 72 69 61 62 6c 65 2e 3c 2f 64  ent variable.</d
1da0: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
1db0: 73 74 72 6f 6e 67 3e 2d 63 61 66 69 6c 65 20 3c  strong>-cafile <
1dc0: 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e 66 69 6c 65  /strong><em>file
1dd0: 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20  name</em></dt>. 
1de0: 20 20 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 69         <dd>Provi
1df0: 64 65 20 74 68 65 20 43 41 20 66 69 6c 65 2e 3c  de the CA file.<
1e00: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
1e10: 3e 3c 73 74 72 6f 6e 67 3e 2d 63 65 72 74 66 69  ><strong>-certfi
1e20: 6c 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e  le</strong> <em>
1e30: 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64  filename</em></d
1e40: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50  t>.        <dd>P
1e50: 72 6f 76 69 64 65 20 74 68 65 20 6e 61 6d 65 20  rovide the name 
1e60: 6f 66 20 61 20 66 69 6c 65 20 63 6f 6e 74 61 69  of a file contai
1e70: 6e 69 6e 67 20 63 65 72 74 69 66 69 63 61 74 65  ning certificate
1e80: 20 74 6f 20 75 73 65 2e 0a 09 54 68 65 20 64 65   to use...The de
1e90: 66 61 75 6c 74 20 6e 61 6d 65 20 69 73 20 63 65  fault name is ce
1ea0: 72 74 2e 70 65 6d 2e 20 54 68 69 73 20 63 61 6e  rt.pem. This can
1eb0: 20 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 76   be overridden v
1ec0: 69 61 20 74 68 65 0a 09 3c 62 3e 53 53 4c 5f 43  ia the..<b>SSL_C
1ed0: 45 52 54 5f 46 49 4c 45 3c 2f 62 3e 20 65 6e 76  ERT_FILE</b> env
1ee0: 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 62 6c  ironment variabl
1ef0: 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  e.</dd>.        
1f00: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63 65 72  <dt><strong>-cer
1f10: 74 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66  t</strong> <em>f
1f20: 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74  ilename</em></dt
1f30: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72  >.        <dd>Pr
1f40: 6f 76 69 64 65 20 74 68 65 20 63 6f 6e 74 65 6e  ovide the conten
1f50: 74 73 20 6f 66 20 61 20 63 65 72 74 69 66 69 63  ts of a certific
1f60: 61 74 65 20 74 6f 20 75 73 65 2c 20 61 73 20 61  ate to use, as a
1f70: 20 44 45 52 20 65 6e 63 6f 64 65 64 20 62 69 6e   DER encoded bin
1f80: 61 72 79 20 76 61 6c 75 65 20 28 58 2e 35 30 39  ary value (X.509
1f90: 20 44 45 52 29 2e 3c 2f 64 64 3e 0a 20 20 20 20   DER).</dd>.    
1fa0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
1fb0: 2d 63 69 70 68 65 72 20 3c 2f 73 74 72 6f 6e 67  -cipher </strong
1fc0: 3e 3c 65 6d 3e 73 74 72 69 6e 67 3c 2f 65 6d 3e  ><em>string</em>
1fd0: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1fe0: 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 63 69  d>Provide the ci
1ff0: 70 68 65 72 20 73 75 69 74 65 73 20 74 6f 20 75  pher suites to u
2000: 73 65 2e 20 53 79 6e 74 61 78 20 69 73 20 61 73  se. Syntax is as
2010: 20 70 65 72 0a 20 20 20 20 20 20 20 20 20 20 20   per.           
2020: 20 4f 70 65 6e 53 53 4c 2e 3c 2f 64 64 3e 0a 20   OpenSSL.</dd>. 
2030: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
2040: 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74 72  ng>-command</str
2050: 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63  ong> <em>callbac
2060: 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  k</em></dt>.    
2070: 20 20 20 20 3c 64 64 3e 49 66 20 73 70 65 63 69      <dd>If speci
2080: 66 69 65 64 2c 20 74 68 69 73 20 63 61 6c 6c 62  fied, this callb
2090: 61 63 6b 20 77 69 6c 6c 20 62 65 20 69 6e 76 6f  ack will be invo
20a0: 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70  ked at several p
20b0: 6f 69 6e 74 73 0a 20 20 20 20 20 20 20 20 20 20  oints.          
20c0: 20 20 64 75 72 69 6e 67 20 74 68 65 20 4f 70 65    during the Ope
20d0: 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20  nSSL handshake. 
20e0: 20 49 74 20 63 61 6e 20 70 61 73 73 20 65 72 72   It can pass err
20f0: 6f 72 73 20 61 6e 64 20 74 72 61 63 69 6e 67 0a  ors and tracing.
2100: 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 66 6f              info
2110: 72 6d 61 74 69 6f 6e 2c 20 61 6e 64 20 69 74 20  rmation, and it 
2120: 63 61 6e 20 61 6c 6c 6f 77 20 54 63 6c 20 73 63  can allow Tcl sc
2130: 72 69 70 74 73 20 74 6f 20 70 65 72 66 6f 72 6d  ripts to perform
2140: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65  .            the
2150: 69 72 20 6f 77 6e 20 76 61 6c 69 64 61 74 69 6f  ir own validatio
2160: 6e 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  n of the certifi
2170: 63 61 74 65 20 69 6e 20 70 6c 61 63 65 20 6f 66  cate in place of
2180: 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 20   the.           
2190: 20 64 65 66 61 75 6c 74 20 76 61 6c 69 64 61 74   default validat
21a0: 69 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20  ion provided by 
21b0: 4f 70 65 6e 53 53 4c 2e 0a 20 20 20 20 20 20 20  OpenSSL..       
21c0: 20 20 20 20 20 3c 62 72 3e 0a 20 20 20 20 20 20       <br>.      
21d0: 20 20 20 20 20 20 53 65 65 20 3c 61 20 68 72 65        See <a hre
21e0: 66 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50 54  f="#CALLBACK OPT
21f0: 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20 4f  IONS">CALLBACK O
2200: 50 54 49 4f 4e 53 3c 2f 61 3e 20 66 6f 72 0a 20  PTIONS</a> for. 
2210: 20 20 20 20 20 20 20 20 20 20 20 66 75 72 74 68             furth
2220: 65 72 20 64 69 73 63 75 73 73 69 6f 6e 2e 3c 2f  er discussion.</
2230: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
2240: 3c 73 74 72 6f 6e 67 3e 2d 64 68 70 61 72 61 6d  <strong>-dhparam
2250: 73 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e 66  s </strong><em>f
2260: 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74  ilename</em></dt
2270: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72  >.        <dd>Pr
2280: 6f 76 69 64 65 20 61 20 44 69 66 66 69 65 2d 48  ovide a Diffie-H
2290: 65 6c 6c 6d 61 6e 20 70 61 72 61 6d 65 74 65 72  ellman parameter
22a0: 73 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20  s file.</dd>.   
22b0: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
22c0: 3e 2d 6b 65 79 66 69 6c 65 3c 2f 73 74 72 6f 6e  >-keyfile</stron
22d0: 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c  g> <em>filename<
22e0: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
22f0: 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68    <dd>Provide th
2300: 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 66 69  e private key fi
2310: 6c 65 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66  le. (<strong>def
2320: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 0a 20  ault</strong>:. 
2330: 20 20 20 20 20 20 20 20 20 20 20 76 61 6c 75 65             value
2340: 20 6f 66 20 2d 63 65 72 74 66 69 6c 65 29 3c 2f   of -certfile)</
2350: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
2360: 3c 73 74 72 6f 6e 67 3e 2d 6b 65 79 3c 2f 73 74  <strong>-key</st
2370: 72 6f 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61  rong> <em>filena
2380: 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  me</em></dt>.   
2390: 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65       <dd>Provide
23a0: 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79   the private key
23b0: 20 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52   to use as a DER
23c0: 20 65 6e 63 6f 64 65 64 20 76 61 6c 75 65 20 28   encoded value (
23d0: 50 4b 43 53 23 31 20 44 45 52 29 3c 2f 64 64 3e  PKCS#1 DER)</dd>
23e0: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
23f0: 72 6f 6e 67 3e 2d 6d 6f 64 65 6c 3c 2f 73 74 72  rong>-model</str
2400: 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c  ong> <em>channel
2410: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
2420: 20 20 20 3c 64 64 3e 54 68 69 73 20 77 69 6c 6c     <dd>This will
2430: 20 66 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e   force this chan
2440: 6e 65 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65  nel to share the
2450: 20 73 61 6d 65 20 3c 65 6d 3e 3c 73 74 72 6f 6e   same <em><stron
2460: 67 3e 53 53 4c 5f 43 54 58 3c 2f 73 74 72 6f 6e  g>SSL_CTX</stron
2470: 67 3e 3c 2f 65 6d 3e 0a 20 20 20 20 20 20 20 20  g></em>.        
2480: 20 20 20 20 73 74 72 75 63 74 75 72 65 20 61 73      structure as
2490: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 3c   the specified <
24a0: 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 2c  em>channel</em>,
24b0: 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 20   and.           
24c0: 20 74 68 65 72 65 66 6f 72 65 20 73 68 61 72 65   therefore share
24d0: 20 63 61 6c 6c 62 61 63 6b 73 20 65 74 63 2e 3c   callbacks etc.<
24e0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
24f0: 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 73 73 77 6f  ><strong>-passwo
2500: 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e  rd</strong> <em>
2510: 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f 64  callback</em></d
2520: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 49  t>.        <dd>I
2530: 66 20 73 75 70 70 6c 69 65 64 2c 20 74 68 69 73  f supplied, this
2540: 20 63 61 6c 6c 62 61 63 6b 20 77 69 6c 6c 20 62   callback will b
2550: 65 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 4f  e invoked when O
2560: 70 65 6e 53 53 4c 20 6e 65 65 64 73 0a 20 20 20  penSSL needs.   
2570: 20 20 20 20 20 20 20 20 20 74 6f 20 6f 62 74 61           to obta
2580: 69 6e 20 61 20 70 61 73 73 77 6f 72 64 2c 20 74  in a password, t
2590: 79 70 69 63 61 6c 6c 79 20 74 6f 20 75 6e 6c 6f  ypically to unlo
25a0: 63 6b 20 74 68 65 20 70 72 69 76 61 74 65 20 6b  ck the private k
25b0: 65 79 20 6f 66 0a 09 20 20 20 20 61 20 63 65 72  ey of..    a cer
25c0: 74 69 66 69 63 61 74 65 2e 0a 20 20 20 20 20 20  tificate..      
25d0: 20 20 20 20 20 20 54 68 65 20 63 61 6c 6c 62 61        The callba
25e0: 63 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e  ck should return
25f0: 20 61 20 73 74 72 69 6e 67 20 77 68 69 63 68 20   a string which 
2600: 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 0a 20  represents the. 
2610: 20 20 20 20 20 20 20 20 20 20 20 70 61 73 73 77             passw
2620: 6f 72 64 20 74 6f 20 62 65 20 75 73 65 64 2e 0a  ord to be used..
2630: 20 20 20 20 20 20 20 20 20 20 20 20 3c 62 72 3e              <br>
2640: 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 65 65  .            See
2650: 20 3c 61 20 68 72 65 66 3d 22 23 43 41 4c 4c 42   <a href="#CALLB
2660: 41 43 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c  ACK OPTIONS">CAL
2670: 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61  LBACK OPTIONS</a
2680: 3e 20 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20  > for.          
2690: 20 20 66 75 72 74 68 65 72 20 64 69 73 63 75 73    further discus
26a0: 73 69 6f 6e 2e 3c 2f 64 64 3e 0a 20 20 20 20 20  sion.</dd>.     
26b0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
26c0: 72 65 71 75 65 73 74 20 3c 2f 73 74 72 6f 6e 67  request </strong
26d0: 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f  ><em>bool</em></
26e0: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e  dt>.        <dd>
26f0: 52 65 71 75 65 73 74 20 61 20 63 65 72 74 69 66  Request a certif
2700: 69 63 61 74 65 20 66 72 6f 6d 20 70 65 65 72 20  icate from peer 
2710: 64 75 72 69 6e 67 20 53 53 4c 20 68 61 6e 64 73  during SSL hands
2720: 68 61 6b 65 2e 0a 20 20 20 20 20 20 20 20 20 20  hake..          
2730: 20 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75    (<strong>defau
2740: 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d  lt</strong>: <em
2750: 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e  >true</em>)</dd>
2760: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
2770: 72 6f 6e 67 3e 2d 72 65 71 75 69 72 65 3c 2f 73  rong>-require</s
2780: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c  trong> <em>bool<
2790: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
27a0: 20 20 3c 64 64 3e 52 65 71 75 69 72 65 20 61 20    <dd>Require a 
27b0: 76 61 6c 69 64 20 63 65 72 74 69 66 69 63 61 74  valid certificat
27c0: 65 20 66 72 6f 6d 20 70 65 65 72 20 64 75 72 69  e from peer duri
27d0: 6e 67 20 53 53 4c 0a 20 20 20 20 20 20 20 20 20  ng SSL.         
27e0: 20 20 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66     handshake. If
27f0: 20 74 68 69 73 20 69 73 20 73 65 74 20 74 6f 20   this is set to 
2800: 74 72 75 65 20 74 68 65 6e 20 3c 73 74 72 6f 6e  true then <stron
2810: 67 3e 2d 72 65 71 75 65 73 74 3c 2f 73 74 72 6f  g>-request</stro
2820: 6e 67 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  ng>.            
2830: 6d 75 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74  must also be set
2840: 20 74 6f 20 74 72 75 65 2e 20 28 3c 73 74 72 6f   to true. (<stro
2850: 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f  ng>default</stro
2860: 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f  ng>: <em>false</
2870: 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20  em>)</dd>.      
2880: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73    <dt><strong>-s
2890: 65 72 76 65 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c  erver</strong> <
28a0: 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74  em>bool</em></dt
28b0: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 48 61  >.        <dd>Ha
28c0: 6e 64 73 68 61 6b 65 20 61 73 20 73 65 72 76 65  ndshake as serve
28d0: 72 20 69 66 20 74 72 75 65 2c 20 65 6c 73 65 20  r if true, else 
28e0: 68 61 6e 64 73 68 61 6b 65 20 61 73 0a 20 20 20  handshake as.   
28f0: 20 20 20 20 20 20 20 20 20 63 6c 69 65 6e 74 2e           client.
2900: 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74  (<strong>default
2910: 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66  </strong>: <em>f
2920: 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a  alse</em>)</dd>.
2930: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
2940: 6f 6e 67 3e 2d 73 65 72 76 65 72 6e 61 6d 65 3c  ong>-servername<
2950: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 68 6f 73  /strong> <em>hos
2960: 74 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  t</em></dt>.    
2970: 20 20 20 20 3c 64 64 3e 4f 6e 6c 79 20 61 76 61      <dd>Only ava
2980: 69 6c 61 62 6c 65 20 69 66 20 74 68 65 20 4f 70  ilable if the Op
2990: 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 20 74 68  enSSL library th
29a0: 65 20 70 61 63 6b 61 67 65 20 69 73 20 6c 69 6e  e package is lin
29b0: 6b 65 64 0a 09 20 20 20 20 61 67 61 69 6e 73 74  ked..    against
29c0: 20 73 75 70 70 6f 72 74 73 20 74 68 65 20 54 4c   supports the TL
29d0: 53 20 68 6f 73 74 6e 61 6d 65 20 65 78 74 65 6e  S hostname exten
29e0: 73 69 6f 6e 20 66 6f 72 20 27 53 65 72 76 65 72  sion for 'Server
29f0: 20 4e 61 6d 65 0a 09 20 20 20 20 49 6e 64 69 63   Name..    Indic
2a00: 61 74 69 6f 6e 27 20 28 53 4e 49 29 2e 20 55 73  ation' (SNI). Us
2a10: 65 20 74 6f 20 6e 61 6d 65 20 74 68 65 20 6c 6f  e to name the lo
2a20: 67 69 63 61 6c 20 68 6f 73 74 20 77 65 20 61 72  gical host we ar
2a30: 65 20 74 61 6c 6b 69 6e 67 0a 09 20 20 20 20 74  e talking..    t
2a40: 6f 20 61 6e 64 20 65 78 70 65 63 74 69 6e 67 20  o and expecting 
2a50: 61 20 63 65 72 74 69 66 69 63 61 74 65 20 66 6f  a certificate fo
2a60: 72 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  r</dd>.        <
2a70: 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73 73 6c 32  dt><strong>-ssl2
2a80: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f  </strong> <em>bo
2a90: 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  ol</em></dt>.   
2aa0: 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20       <dd>Enable 
2ab0: 75 73 65 20 6f 66 20 53 53 4c 20 76 32 2e 20 28  use of SSL v2. (
2ac0: 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c  <strong>default<
2ad0: 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61  /strong>: <em>fa
2ae0: 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20  lse</em>)</dd>. 
2af0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
2b00: 6e 67 3e 2d 73 73 6c 33 20 3c 2f 73 74 72 6f 6e  ng>-ssl3 </stron
2b10: 67 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c  g><em>bool</em><
2b20: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
2b30: 3e 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 53  >Enable use of S
2b40: 53 4c 20 76 33 2e 20 28 3c 73 74 72 6f 6e 67 3e  SL v3. (<strong>
2b50: 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e  default</strong>
2b60: 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e  : <em>false</em>
2b70: 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  )</dd>.        <
2b80: 64 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31  dt>-<strong>tls1
2b90: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f  </strong> <em>bo
2ba0: 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  ol</em></dt>.   
2bb0: 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20       <dd>Enable 
2bc0: 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 20 28  use of TLS v1. (
2bd0: 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c  <strong>default<
2be0: 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72  /strong>: <em>tr
2bf0: 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20  ue</em>)</dd>.  
2c00: 20 20 20 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f        <dt>-<stro
2c10: 6e 67 3e 74 6c 73 31 2e 31 3c 2f 73 74 72 6f 6e  ng>tls1.1</stron
2c20: 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e  g> <em>bool</em>
2c30: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
2c40: 64 3e 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20  d>Enable use of 
2c50: 54 4c 53 20 76 31 2e 31 20 28 3c 73 74 72 6f 6e  TLS v1.1 (<stron
2c60: 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e  g>default</stron
2c70: 67 3e 3a 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d  g>: <em>true</em
2c80: 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  >)</dd>.        
2c90: 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73  <dt>-<strong>tls
2ca0: 31 2e 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  1.2</strong> <em
2cb0: 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  >bool</em></dt>.
2cc0: 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 62          <dd>Enab
2cd0: 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31  le use of TLS v1
2ce0: 2e 32 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61  .2 (<strong>defa
2cf0: 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65  ult</strong>: <e
2d00: 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64  m>true</em>)</dd
2d10: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 2d 3c  >.        <dt>-<
2d20: 73 74 72 6f 6e 67 3e 74 6c 73 31 2e 33 3c 2f 73  strong>tls1.3</s
2d30: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c  trong> <em>bool<
2d40: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
2d50: 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65    <dd>Enable use
2d60: 20 6f 66 20 54 4c 53 20 76 31 2e 33 20 28 3c 73   of TLS v1.3 (<s
2d70: 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73  trong>default</s
2d80: 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72 75 65  trong>: <em>true
2d90: 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20  </em>)</dd>.    
2da0: 3c 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f  </dl>.</blockquo
2db0: 74 65 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64  te>..<dl>.    <d
2dc0: 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a  t><a name="tls::
2dd0: 75 6e 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73  unimport"><b>tls
2de0: 3a 3a 75 6e 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c  ::unimport </b><
2df0: 69 3e 63 68 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61  i>channel</i></a
2e00: 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 50  ></dt>.    <dd>P
2e10: 72 6f 76 69 64 65 64 20 66 6f 72 20 73 79 6d 6d  rovided for symm
2e20: 65 74 72 79 20 74 6f 20 3c 73 74 72 6f 6e 67 3e  etry to <strong>
2e30: 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72  tls::import</str
2e40: 6f 6e 67 3e 2c 20 74 68 69 73 0a 20 20 20 20 20  ong>, this.     
2e50: 20 75 6e 73 74 61 63 6b 73 20 74 68 65 20 53 53   unstacks the SS
2e60: 4c 2d 65 6e 61 62 6c 69 6e 67 20 6f 66 20 61 20  L-enabling of a 
2e70: 72 65 67 75 6c 61 72 20 54 63 6c 20 63 68 61 6e  regular Tcl chan
2e80: 6e 65 6c 2e 20 20 41 6e 20 65 72 72 6f 72 0a 20  nel.  An error. 
2e90: 20 20 20 20 20 69 73 20 74 68 72 6f 77 6e 20 69       is thrown i
2ea0: 66 20 54 4c 53 20 69 73 20 6e 6f 74 20 74 68 65  f TLS is not the
2eb0: 20 74 6f 70 20 73 74 61 63 6b 65 64 20 63 68 61   top stacked cha
2ec0: 6e 6e 65 6c 20 74 79 70 65 2e 3c 2f 64 64 3e 0a  nnel type.</dd>.
2ed0: 3c 2f 64 6c 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20  </dl>..<dl>.    
2ee0: 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73  <dt><a name="tls
2ef0: 3a 3a 63 69 70 68 65 72 73 20 70 72 6f 74 6f 63  ::ciphers protoc
2f00: 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 22 3e 3c 73  ol ?verbose?"><s
2f10: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 69 70 68 65  trong>tls::ciphe
2f20: 72 73 3c 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20  rs</strong>.    
2f30: 20 20 20 20 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c      <em>protocol
2f40: 20 3f 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c   ?verbose?</em><
2f50: 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64  /a></dt>.    <dd
2f60: 3e 52 65 74 75 72 6e 73 20 6c 69 73 74 20 6f 66  >Returns list of
2f70: 20 73 75 70 70 6f 72 74 65 64 20 63 69 70 68 65   supported ciphe
2f80: 72 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20  rs based on the 
2f90: 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 3c 2f 65 6d  <em>protocol</em
2fa0: 3e 0a 20 20 20 20 20 20 20 20 79 6f 75 20 73 75  >.        you su
2fb0: 70 70 6c 79 2c 20 77 68 69 63 68 20 6d 75 73 74  pply, which must
2fc0: 20 62 65 20 6f 6e 65 20 6f 66 20 3c 65 6d 3e 73   be one of <em>s
2fd0: 73 6c 32 2c 20 73 73 6c 33 2c 20 6f 72 20 74 6c  sl2, ssl3, or tl
2fe0: 73 31 3c 2f 65 6d 3e 2e 0a 20 20 20 20 20 20 20  s1</em>..       
2ff0: 20 49 66 20 3c 65 6d 3e 76 65 72 62 6f 73 65 3c   If <em>verbose<
3000: 2f 65 6d 3e 20 69 73 20 73 70 65 63 69 66 69 65  /em> is specifie
3010: 64 20 61 73 20 74 72 75 65 20 74 68 65 6e 20 61  d as true then a
3020: 20 76 65 72 62 6f 73 65 2c 0a 20 20 20 20 20 20   verbose,.      
3030: 20 20 73 65 6d 69 2d 68 75 6d 61 6e 20 72 65 61    semi-human rea
3040: 64 61 62 6c 65 20 6c 69 73 74 20 69 73 20 72 65  dable list is re
3050: 74 75 72 6e 65 64 20 70 72 6f 76 69 64 69 6e 67  turned providing
3060: 20 61 64 64 69 74 69 6f 6e 61 6c 0a 20 20 20 20   additional.    
3070: 20 20 20 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20      information 
3080: 6f 6e 20 74 68 65 20 6e 61 74 75 72 65 20 6f 66  on the nature of
3090: 20 74 68 65 20 63 69 70 68 65 72 20 73 75 70 70   the cipher supp
30a0: 6f 72 74 2e 20 49 6e 20 65 61 63 68 0a 20 20 20  ort. In each.   
30b0: 20 20 20 20 20 63 61 73 65 20 74 68 65 20 72 65       case the re
30c0: 73 75 6c 74 20 69 73 20 61 20 54 63 6c 20 6c 69  sult is a Tcl li
30d0: 73 74 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a  st.</dd>.</dl>..
30e0: 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20  <dl>.    <dt><a 
30f0: 6e 61 6d 65 3d 22 74 6c 73 3a 3a 76 65 72 73 69  name="tls::versi
3100: 6f 6e 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a  on"><strong>tls:
3110: 3a 76 65 72 73 69 6f 6e 3c 2f 73 74 72 6f 6e 67  :version</strong
3120: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c  ></a></dt>.    <
3130: 64 64 3e 52 65 74 75 72 6e 73 20 74 68 65 20 76  dd>Returns the v
3140: 65 72 73 69 6f 6e 20 73 74 72 69 6e 67 20 64 65  ersion string de
3150: 66 69 6e 65 64 20 62 79 20 4f 70 65 6e 53 53 4c  fined by OpenSSL
3160: 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 68  .</dd>.</dl>..<h
3170: 33 3e 3c 61 20 6e 61 6d 65 3d 22 43 41 4c 4c 42  3><a name="CALLB
3180: 41 43 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c  ACK OPTIONS">CAL
3190: 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61  LBACK OPTIONS</a
31a0: 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 0a 41 73 20 69  ></h3>..<p>.As i
31b0: 6e 64 69 63 61 74 65 64 20 61 62 6f 76 65 2c 20  ndicated above, 
31c0: 69 6e 64 69 76 69 64 75 61 6c 20 63 68 61 6e 6e  individual chann
31d0: 65 6c 73 20 63 61 6e 20 62 65 20 67 69 76 65 6e  els can be given
31e0: 20 74 68 65 69 72 20 6f 77 6e 20 63 61 6c 6c 62   their own callb
31f0: 61 63 6b 73 0a 74 6f 20 68 61 6e 64 6c 65 20 69  acks.to handle i
3200: 6e 74 65 72 6d 65 64 69 61 74 65 20 70 72 6f 63  ntermediate proc
3210: 65 73 73 69 6e 67 20 62 79 20 74 68 65 20 4f 70  essing by the Op
3220: 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 2c 20 75  enSSL library, u
3230: 73 69 6e 67 20 74 68 65 0a 3c 65 6d 3e 2d 63 6f  sing the.<em>-co
3240: 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20 3c  mmand</em> and <
3250: 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d  em>-password</em
3260: 3e 20 6f 70 74 69 6f 6e 73 20 70 61 73 73 65 64  > options passed
3270: 20 74 6f 20 65 69 74 68 65 72 20 6f 66 0a 3c 73   to either of.<s
3280: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65  trong>tls::socke
3290: 74 3c 2f 73 74 72 6f 6e 67 3e 20 6f 72 20 3c 73  t</strong> or <s
32a0: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72  trong>tls::impor
32b0: 74 3c 2f 73 74 72 6f 6e 67 3e 2e 0a 3c 2f 70 3e  t</strong>..</p>
32c0: 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c  ..<blockquote>.<
32d0: 64 6c 3e 0a 0a 20 20 20 20 3c 64 74 3e 3c 73 74  dl>..    <dt><st
32e0: 72 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73  rong>-command</s
32f0: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62  trong> <em>callb
3300: 61 63 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ack</em></dt>.  
3310: 20 20 3c 64 64 3e 0a 09 49 6e 76 6f 6b 65 73 20    <dd>..Invokes 
3320: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 3c 65  the specified <e
3330: 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 20  m>callback</em> 
3340: 73 63 72 69 70 74 20 61 74 0a 09 73 65 76 65 72  script at..sever
3350: 61 6c 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67  al points during
3360: 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 68 61 6e   the OpenSSL han
3370: 64 73 68 61 6b 65 2e 0a 09 45 78 63 65 70 74 20  dshake...Except 
3380: 61 73 20 69 6e 64 69 63 61 74 65 64 20 62 65 6c  as indicated bel
3390: 6f 77 2c 20 76 61 6c 75 65 73 20 72 65 74 75 72  ow, values retur
33a0: 6e 65 64 20 66 72 6f 6d 20 74 68 65 0a 09 63 61  ned from the..ca
33b0: 6c 6c 62 61 63 6b 20 61 72 65 20 69 67 6e 6f 72  llback are ignor
33c0: 65 64 2e 0a 09 41 72 67 75 6d 65 6e 74 73 20 61  ed...Arguments a
33d0: 70 70 65 6e 64 65 64 20 74 6f 20 74 68 65 20 73  ppended to the s
33e0: 63 72 69 70 74 20 75 70 6f 6e 20 63 61 6c 6c 62  cript upon callb
33f0: 61 63 6b 20 74 61 6b 65 20 6f 6e 65 20 6f 66 20  ack take one of 
3400: 74 68 65 0a 09 66 6f 6c 6c 6f 77 69 6e 67 20 66  the..following f
3410: 6f 72 6d 73 3a 0a 0a 09 3c 62 72 3e 0a 09 3c 62  orms:...<br>..<b
3420: 72 3e 0a 0a 09 3c 64 6c 3e 0a 0a 3c 21 2d 2d 09  r>...<dl>..<!--.
3430: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
3440: 6c 62 61 63 6b 20 69 73 20 64 69 73 61 62 6c 65  lback is disable
3450: 64 2e 0a 0a 09 3c 64 74 3e 0a 09 20 20 3c 73 74  d....<dt>..  <st
3460: 72 6f 6e 67 3e 65 72 72 6f 72 3c 2f 73 74 72 6f  rong>error</stro
3470: 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 20  ng> <em>channel 
3480: 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f  message</em>..</
3490: 64 74 3e 0a 09 3c 64 64 3e 0a 09 20 20 54 68 65  dt>..<dd>..  The
34a0: 20 3c 65 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d   <em>message</em
34b0: 3e 20 61 72 67 75 6d 65 6e 74 20 63 6f 6e 74 61  > argument conta
34c0: 69 6e 73 20 61 6e 20 65 72 72 6f 72 20 6d 65 73  ins an error mes
34d0: 73 61 67 65 20 67 65 6e 65 72 61 74 65 64 0a 09  sage generated..
34e0: 20 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c    by the OpenSSL
34f0: 20 66 75 6e 63 74 69 6f 6e 0a 09 20 20 3c 63 6f   function..  <co
3500: 64 65 3e 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72  de>ERR_reason_er
3510: 72 6f 72 5f 73 74 72 69 6e 67 28 29 3c 2f 63 6f  ror_string()</co
3520: 64 65 3e 2e 0a 09 3c 2f 64 64 3e 0a 0a 09 3c 62  de>...</dd>...<b
3530: 72 3e 0a 2d 2d 3e 0a 0a 09 3c 64 74 3e 0a 09 20  r>.-->...<dt>.. 
3540: 20 3c 73 74 72 6f 6e 67 3e 69 6e 66 6f 3c 2f 73   <strong>info</s
3550: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e  trong> <em>chann
3560: 65 6c 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d  el major minor m
3570: 65 73 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f 64  essage</em>..</d
3580: 74 3e 0a 09 3c 64 64 3e 0a 09 20 20 54 68 69 73  t>..<dd>..  This
3590: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63   form of callbac
35a0: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20  k is invoked by 
35b0: 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63  the OpenSSL func
35c0: 74 69 6f 6e 0a 09 20 20 3c 63 6f 64 65 3e 53 53  tion..  <code>SS
35d0: 4c 5f 43 54 58 5f 73 65 74 5f 69 6e 66 6f 5f 63  L_CTX_set_info_c
35e0: 61 6c 6c 62 61 63 6b 28 29 3c 2f 63 6f 64 65 3e  allback()</code>
35f0: 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65  ...  <br>..  The
3600: 20 3c 65 6d 3e 6d 61 6a 6f 72 3c 2f 65 6d 3e 20   <em>major</em> 
3610: 61 6e 64 20 3c 65 6d 3e 6d 69 6e 6f 72 3c 2f 65  and <em>minor</e
3620: 6d 3e 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65  m> arguments are
3630: 20 75 73 65 64 20 74 6f 0a 09 20 20 72 65 70 72   used to..  repr
3640: 65 73 65 6e 74 20 74 68 65 20 73 74 61 74 65 20  esent the state 
3650: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 62 69 74 6d  information bitm
3660: 61 73 6b 2e 0a 09 20 20 3c 64 6c 3e 0a 09 20 20  ask...  <dl>..  
3670: 3c 64 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c  <dt>Possible val
3680: 75 65 73 20 66 6f 72 20 3c 65 6d 3e 6d 61 6a 6f  ues for <em>majo
3690: 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e  r</em> are:</dt>
36a0: 0a 09 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 68 61  ..  <dd><code>ha
36b0: 6e 64 73 68 61 6b 65 2c 20 61 6c 65 72 74 2c 20  ndshake, alert, 
36c0: 63 6f 6e 6e 65 63 74 2c 20 61 63 63 65 70 74 3c  connect, accept<
36d0: 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a 09 20 20  /code>.</dd>..  
36e0: 3c 64 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c  <dt>Possible val
36f0: 75 65 73 20 66 6f 72 20 3c 65 6d 3e 6d 69 6e 6f  ues for <em>mino
3700: 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e  r</em> are:</dt>
3710: 0a 09 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 73 74  ..  <dd><code>st
3720: 61 72 74 2c 20 64 6f 6e 65 2c 20 72 65 61 64 2c  art, done, read,
3730: 20 77 72 69 74 65 2c 20 6c 6f 6f 70 2c 20 65 78   write, loop, ex
3740: 69 74 3c 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a  it</code>.</dd>.
3750: 09 20 20 3c 2f 64 6c 3e 0a 09 20 20 54 68 65 20  .  </dl>..  The 
3760: 3c 65 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d 3e  <em>message</em>
3770: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20 64   argument is a d
3780: 65 73 63 72 69 70 74 69 76 65 20 73 74 72 69 6e  escriptive strin
3790: 67 20 77 68 69 63 68 20 6d 61 79 0a 09 20 20 62  g which may..  b
37a0: 65 20 67 65 6e 65 72 61 74 65 64 20 65 69 74 68  e generated eith
37b0: 65 72 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53  er by..  <code>S
37c0: 53 4c 5f 73 74 61 74 65 5f 73 74 72 69 6e 67 5f  SL_state_string_
37d0: 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e 20 6f 72  long()</code> or
37e0: 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c   by..  <code>SSL
37f0: 5f 61 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69  _alert_desc_stri
3800: 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e  ng_long()</code>
3810: 2c 0a 09 20 20 64 65 70 65 6e 64 69 6e 67 20 6f  ,..  depending o
3820: 6e 20 63 6f 6e 74 65 78 74 2e 0a 09 3c 2f 64 64  n context...</dd
3830: 3e 0a 0a 09 3c 62 72 3e 0a 0a 09 3c 64 74 3e 0a  >...<br>...<dt>.
3840: 09 20 20 3c 73 74 72 6f 6e 67 3e 76 65 72 69 66  .  <strong>verif
3850: 79 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  y</strong> <em>c
3860: 68 61 6e 6e 65 6c 20 64 65 70 74 68 20 63 65 72  hannel depth cer
3870: 74 20 73 74 61 74 75 73 20 65 72 72 6f 72 3c 2f  t status error</
3880: 65 6d 3e 0a 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e  em>..</dt>..<dd>
3890: 0a 09 20 20 54 68 69 73 20 66 6f 72 6d 20 6f 66  ..  This form of
38a0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
38b0: 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e  oked by the Open
38c0: 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 09 20 20  SSL function..  
38d0: 3c 63 6f 64 65 3e 53 53 4c 5f 73 65 74 5f 76 65  <code>SSL_set_ve
38e0: 72 69 66 79 28 29 3c 2f 63 6f 64 65 3e 2e 0a 09  rify()</code>...
38f0: 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65    <br>..  The <e
3900: 6d 3e 64 65 70 74 68 3c 2f 65 6d 3e 20 61 72 67  m>depth</em> arg
3910: 75 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e 74 65  ument is an inte
3920: 67 65 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67  ger representing
3930: 20 74 68 65 0a 09 20 20 63 75 72 72 65 6e 74 20   the..  current 
3940: 64 65 70 74 68 20 6f 6e 20 74 68 65 20 63 65 72  depth on the cer
3950: 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 2c 20  tificate chain, 
3960: 77 69 74 68 0a 09 20 20 3c 63 6f 64 65 3e 30 3c  with..  <code>0<
3970: 2f 63 6f 64 65 3e 20 61 73 20 74 68 65 20 73 75  /code> as the su
3980: 62 6a 65 63 74 20 63 65 72 74 69 66 69 63 61 74  bject certificat
3990: 65 20 61 6e 64 20 68 69 67 68 65 72 20 76 61 6c  e and higher val
39a0: 75 65 73 0a 09 20 20 64 65 6e 6f 74 69 6e 67 20  ues..  denoting 
39b0: 70 72 6f 67 72 65 73 73 69 76 65 6c 79 20 6d 6f  progressively mo
39c0: 72 65 20 69 6e 64 69 72 65 63 74 20 69 73 73 75  re indirect issu
39d0: 65 72 20 63 65 72 74 69 66 69 63 61 74 65 73 2e  er certificates.
39e0: 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20  ..  <br>..  The 
39f0: 3c 65 6d 3e 63 65 72 74 3c 2f 65 6d 3e 20 61 72  <em>cert</em> ar
3a00: 67 75 6d 65 6e 74 20 69 73 20 61 20 6c 69 73 74  gument is a list
3a10: 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61   of key-value pa
3a20: 69 72 73 20 73 69 6d 69 6c 61 72 0a 09 20 20 74  irs similar..  t
3a30: 6f 20 74 68 6f 73 65 20 72 65 74 75 72 6e 65 64  o those returned
3a40: 20 62 79 0a 09 20 20 3c 61 20 68 72 65 66 3d 22   by..  <a href="
3a50: 23 74 6c 73 3a 3a 73 74 61 74 75 73 22 3e 3c 73  #tls::status"><s
3a60: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 74 61 74 75  trong>tls::statu
3a70: 73 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 2e 0a  s</strong></a>..
3a80: 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c  .  <br>..  The <
3a90: 65 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20 61  em>status</em> a
3aa0: 72 67 75 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e  rgument is an in
3ab0: 74 65 67 65 72 20 72 65 70 72 65 73 65 6e 74 69  teger representi
3ac0: 6e 67 20 74 68 65 0a 09 20 20 63 75 72 72 65 6e  ng the..  curren
3ad0: 74 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68  t validity of th
3ae0: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 09  e certificate...
3af0: 20 20 41 20 76 61 6c 75 65 20 6f 66 20 3c 63 6f    A value of <co
3b00: 64 65 3e 30 3c 2f 63 6f 64 65 3e 20 6d 65 61 6e  de>0</code> mean
3b10: 73 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  s the certificat
3b20: 65 20 69 73 20 64 65 65 6d 65 64 20 69 6e 76 61  e is deemed inva
3b30: 6c 69 64 2e 0a 09 20 20 41 20 76 61 6c 75 65 20  lid...  A value 
3b40: 6f 66 20 3c 63 6f 64 65 3e 31 3c 2f 63 6f 64 65  of <code>1</code
3b50: 3e 20 6d 65 61 6e 73 20 74 68 65 20 63 65 72 74  > means the cert
3b60: 69 66 69 63 61 74 65 20 69 73 20 64 65 65 6d 65  ificate is deeme
3b70: 64 20 76 61 6c 69 64 2e 0a 09 20 20 3c 62 72 3e  d valid...  <br>
3b80: 0a 09 20 20 54 68 65 20 3c 65 6d 3e 65 72 72 6f  ..  The <em>erro
3b90: 72 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20  r</em> argument 
3ba0: 73 75 70 70 6c 69 65 73 20 74 68 65 20 6d 65 73  supplies the mes
3bb0: 73 61 67 65 2c 20 69 66 20 61 6e 79 2c 20 67 65  sage, if any, ge
3bc0: 6e 65 72 61 74 65 64 0a 09 20 20 62 79 0a 09 20  nerated..  by.. 
3bd0: 20 3c 63 6f 64 65 3e 58 35 30 39 5f 53 54 4f 52   <code>X509_STOR
3be0: 45 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28  E_CTX_get_error(
3bf0: 29 3c 2f 63 6f 64 65 3e 2e 0a 09 20 20 3c 62 72  )</code>...  <br
3c00: 3e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65  >..  <br>..  The
3c10: 20 63 61 6c 6c 62 61 63 6b 20 6d 61 79 20 6f 76   callback may ov
3c20: 65 72 72 69 64 65 20 6e 6f 72 6d 61 6c 20 76 61  erride normal va
3c30: 6c 69 64 61 74 69 6f 6e 20 70 72 6f 63 65 73 73  lidation process
3c40: 69 6e 67 20 62 79 20 65 78 70 6c 69 63 69 74 6c  ing by explicitl
3c50: 79 0a 09 20 20 72 65 74 75 72 6e 69 6e 67 20 6f  y..  returning o
3c60: 6e 65 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20  ne of the above 
3c70: 3c 65 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20  <em>status</em> 
3c80: 76 61 6c 75 65 73 2e 0a 09 3c 2f 64 64 3e 0a 0a  values...</dd>..
3c90: 09 3c 2f 64 6c 3e 0a 20 20 20 20 3c 2f 64 64 3e  .</dl>.    </dd>
3ca0: 0a 0a 20 20 20 20 3c 62 72 3e 0a 0a 20 20 20 20  ..    <br>..    
3cb0: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 73  <dt><strong>-pas
3cc0: 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c  sword</strong> <
3cd0: 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e  em>callback</em>
3ce0: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 0a 09  </dt>.    <dd>..
3cf0: 49 6e 76 6f 6b 65 73 20 74 68 65 20 73 70 65 63  Invokes the spec
3d00: 69 66 69 65 64 20 3c 65 6d 3e 63 61 6c 6c 62 61  ified <em>callba
3d10: 63 6b 3c 2f 65 6d 3e 20 73 63 72 69 70 74 20 77  ck</em> script w
3d20: 68 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64  hen OpenSSL need
3d30: 73 20 74 6f 0a 09 6f 62 74 61 69 6e 20 61 20 70  s to..obtain a p
3d40: 61 73 73 77 6f 72 64 2e 20 20 54 68 65 20 63 61  assword.  The ca
3d50: 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65  llback should re
3d60: 74 75 72 6e 20 61 20 73 74 72 69 6e 67 20 77 68  turn a string wh
3d70: 69 63 68 0a 09 72 65 70 72 65 73 65 6e 74 73 20  ich..represents 
3d80: 74 68 65 20 70 61 73 73 77 6f 72 64 20 74 6f 20  the password to 
3d90: 62 65 20 75 73 65 64 2e 0a 09 4e 6f 20 61 72 67  be used...No arg
3da0: 75 6d 65 6e 74 73 20 61 72 65 20 61 70 70 65 6e  uments are appen
3db0: 64 65 64 20 74 6f 20 74 68 65 20 73 63 72 69 70  ded to the scrip
3dc0: 74 20 75 70 6f 6e 20 63 61 6c 6c 62 61 63 6b 2e  t upon callback.
3dd0: 0a 20 20 20 20 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e  .    </dd>.</dl>
3de0: 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a  .</blockquote>..
3df0: 3c 70 3e 0a 52 65 66 65 72 65 6e 63 65 20 69 6d  <p>.Reference im
3e00: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66  plementations of
3e10: 20 74 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73   these callbacks
3e20: 20 61 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e   are provided in
3e30: 20 74 68 65 0a 64 69 73 74 72 69 62 75 74 69 6f   the.distributio
3e40: 6e 20 61 73 20 3c 73 74 72 6f 6e 67 3e 74 6c 73  n as <strong>tls
3e50: 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73 74 72 6f  ::callback</stro
3e60: 6e 67 3e 20 61 6e 64 0a 3c 73 74 72 6f 6e 67 3e  ng> and.<strong>
3e70: 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73  tls::password</s
3e80: 74 72 6f 6e 67 3e 20 72 65 73 70 65 63 74 69 76  trong> respectiv
3e90: 65 6c 79 2e 20 20 4e 6f 74 65 20 74 68 61 74 20  ely.  Note that 
3ea0: 74 68 65 73 65 20 61 72 65 0a 3c 65 6d 3e 73 61  these are.<em>sa
3eb0: 6d 70 6c 65 3c 2f 65 6d 3e 20 69 6d 70 6c 65 6d  mple</em> implem
3ec0: 65 6e 74 61 74 69 6f 6e 73 20 6f 6e 6c 79 2e 20  entations only. 
3ed0: 20 49 6e 20 61 20 6d 6f 72 65 20 72 65 61 6c 69   In a more reali
3ee0: 73 74 69 63 20 64 65 70 6c 6f 79 6d 65 6e 74 0a  stic deployment.
3ef0: 79 6f 75 20 77 6f 75 6c 64 20 73 70 65 63 69 66  you would specif
3f00: 79 20 79 6f 75 72 20 6f 77 6e 20 63 61 6c 6c 62  y your own callb
3f10: 61 63 6b 20 73 63 72 69 70 74 73 20 6f 6e 20 65  ack scripts on e
3f20: 61 63 68 20 54 4c 53 20 63 68 61 6e 6e 65 6c 0a  ach TLS channel.
3f30: 75 73 69 6e 67 20 74 68 65 20 3c 65 6d 3e 2d 63  using the <em>-c
3f40: 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20  ommand</em> and 
3f50: 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65  <em>-password</e
3f60: 6d 3e 20 6f 70 74 69 6f 6e 73 2e 0a 3c 2f 70 3e  m> options..</p>
3f70: 0a 0a 3c 70 3e 0a 54 68 65 20 64 65 66 61 75 6c  ..<p>.The defaul
3f80: 74 20 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20  t behavior when 
3f90: 74 68 65 20 3c 65 6d 3e 2d 63 6f 6d 6d 61 6e 64  the <em>-command
3fa0: 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 20 69 73 20  </em> option is 
3fb0: 6e 6f 74 20 73 70 65 63 69 66 69 65 64 20 69 73  not specified is
3fc0: 20 66 6f 72 0a 54 4c 53 20 74 6f 20 70 72 6f 63   for.TLS to proc
3fd0: 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61 74  ess the associat
3fe0: 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62  ed library callb
3ff0: 61 63 6b 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2e  acks internally.
4000: 0a 54 68 65 20 64 65 66 61 75 6c 74 20 62 65 68  .The default beh
4010: 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65 20 3c  avior when the <
4020: 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d  em>-password</em
4030: 3e 20 6f 70 74 69 6f 6e 20 69 73 20 6e 6f 74 20  > option is not 
4040: 73 70 65 63 69 66 69 65 64 20 69 73 20 66 6f 72  specified is for
4050: 0a 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20  .TLS to process 
4060: 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c  the associated l
4070: 69 62 72 61 72 79 20 63 61 6c 6c 62 61 63 6b 73  ibrary callbacks
4080: 20 62 79 20 61 74 74 65 6d 70 74 69 6e 67 20 74   by attempting t
4090: 6f 20 63 61 6c 6c 0a 3c 73 74 72 6f 6e 67 3e 74  o call.<strong>t
40a0: 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74  ls::password</st
40b0: 72 6f 6e 67 3e 2e 0a 54 68 65 20 64 69 66 66 65  rong>..The diffe
40c0: 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68  rence between th
40d0: 65 73 65 20 74 77 6f 20 62 65 68 61 76 69 6f 72  ese two behavior
40e0: 73 20 69 73 20 61 20 63 6f 6e 73 65 71 75 65 6e  s is a consequen
40f0: 63 65 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e  ce of maintainin
4100: 67 0a 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20  g.compatibility 
4110: 77 69 74 68 20 65 61 72 6c 69 65 72 20 69 6d 70  with earlier imp
4120: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a 3c 2f  lementations..</
4130: 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20 3c 73 74 72  p>..<p>.The <str
4140: 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f  ong>tls::debug</
4150: 73 74 72 6f 6e 67 3e 20 76 61 72 69 61 62 6c 65  strong> variable
4160: 20 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61   provides some a
4170: 64 64 69 74 69 6f 6e 61 6c 0a 63 6f 6e 74 72 6f  dditional.contro
4180: 6c 20 6f 76 65 72 20 74 68 65 73 65 20 72 65 66  l over these ref
4190: 65 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73  erence callbacks
41a0: 2e 20 20 49 74 73 20 76 61 6c 75 65 20 69 73 20  .  Its value is 
41b0: 7a 65 72 6f 20 62 79 20 64 65 66 61 75 6c 74 2e  zero by default.
41c0: 0a 48 69 67 68 65 72 20 76 61 6c 75 65 73 20 70  .Higher values p
41d0: 72 6f 64 75 63 65 20 6d 6f 72 65 20 64 69 61 67  roduce more diag
41e0: 6e 6f 73 74 69 63 20 6f 75 74 70 75 74 2c 20 61  nostic output, a
41f0: 6e 64 20 77 69 6c 6c 20 61 6c 73 6f 20 66 6f 72  nd will also for
4200: 63 65 20 74 68 65 0a 76 65 72 69 66 79 20 6d 65  ce the.verify me
4210: 74 68 6f 64 20 69 6e 20 3c 73 74 72 6f 6e 67 3e  thod in <strong>
4220: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73  tls::callback</s
4230: 74 72 6f 6e 67 3e 20 74 6f 20 61 63 63 65 70 74  trong> to accept
4240: 20 74 68 65 0a 63 65 72 74 69 66 69 63 61 74 65   the.certificate
4250: 2c 20 65 76 65 6e 20 77 68 65 6e 20 69 74 20 69  , even when it i
4260: 73 20 69 6e 76 61 6c 69 64 2e 0a 3c 2f 70 3e 0a  s invalid..</p>.
4270: 0a 3c 70 3e 0a 3c 65 6d 3e 0a 54 68 65 20 75 73  .<p>.<em>.The us
4280: 65 20 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e  e of the referen
4290: 63 65 20 63 61 6c 6c 62 61 63 6b 73 20 3c 73 74  ce callbacks <st
42a0: 72 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61  rong>tls::callba
42b0: 63 6b 3c 2f 73 74 72 6f 6e 67 3e 20 61 6e 64 0a  ck</strong> and.
42c0: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 70 61 73  <strong>tls::pas
42d0: 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 69  sword</strong> i
42e0: 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65  s not recommende
42f0: 64 2e 20 20 54 68 65 79 20 6d 61 79 20 62 65 20  d.  They may be 
4300: 72 65 6d 6f 76 65 64 0a 66 72 6f 6d 20 66 75 74  removed.from fut
4310: 75 72 65 20 72 65 6c 65 61 73 65 73 2e 0a 3c 2f  ure releases..</
4320: 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 70 3e 0a 3c 65  em>.</p>..<p>.<e
4330: 6d 3e 0a 54 68 65 20 75 73 65 20 6f 66 20 74 68  m>.The use of th
4340: 65 20 76 61 72 69 61 62 6c 65 20 3c 73 74 72 6f  e variable <stro
4350: 6e 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f 73  ng>tls::debug</s
4360: 74 72 6f 6e 67 3e 20 69 73 20 6e 6f 74 20 72 65  trong> is not re
4370: 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49 74 20 6d 61  commended..It ma
4380: 79 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f  y be removed fro
4390: 6d 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65  m future release
43a0: 73 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c  s..</em>.</p>..<
43b0: 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 44 45 42 55  h3><a name="DEBU
43c0: 47 22 3e 44 45 42 55 47 3c 2f 61 3e 3c 2f 68 33  G">DEBUG</a></h3
43d0: 3e 0a 0a 54 4c 53 20 6b 65 79 20 6c 6f 67 67 69  >..TLS key loggi
43e0: 6e 67 20 63 61 6e 20 62 65 20 65 6e 61 62 6c 65  ng can be enable
43f0: 64 20 62 79 20 73 65 74 74 69 6e 67 20 74 68 65  d by setting the
4400: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72   environment var
4410: 69 61 62 6c 65 0a 3c 62 3e 53 53 4c 4b 45 59 4c  iable.<b>SSLKEYL
4420: 4f 47 46 49 4c 45 3c 2f 62 3e 20 74 6f 20 74 68  OGFILE</b> to th
4430: 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 66 69  e name of the fi
4440: 6c 65 20 74 6f 20 6c 6f 67 20 74 6f 2e 20 54 68  le to log to. Th
4450: 65 6e 20 77 68 65 6e 65 76 65 72 20 54 4c 53 0a  en whenever TLS.
4460: 6b 65 79 20 6d 61 74 65 72 69 61 6c 20 69 73 20  key material is 
4470: 67 65 6e 65 72 61 74 65 64 20 6f 72 20 72 65 63  generated or rec
4480: 65 69 76 65 64 20 69 74 20 77 69 6c 6c 20 62 65  eived it will be
4490: 20 6c 6f 67 67 65 64 20 74 6f 20 74 68 65 20 66   logged to the f
44a0: 69 6c 65 2e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d  ile...<h3><a nam
44b0: 65 3d 22 48 54 54 50 53 20 45 58 41 4d 50 4c 45  e="HTTPS EXAMPLE
44c0: 22 3e 48 54 54 50 53 20 45 58 41 4d 50 4c 45 3c  ">HTTPS EXAMPLE<
44d0: 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 69  /a></h3>..<p>Thi
44e0: 73 20 65 78 61 6d 70 6c 65 20 75 73 65 73 20 61  s example uses a
44f0: 20 73 61 6d 70 6c 65 20 73 65 72 76 65 72 2e 70   sample server.p
4500: 65 6d 20 70 72 6f 76 69 64 65 64 20 77 69 74 68  em provided with
4510: 20 74 68 65 20 54 4c 53 20 72 65 6c 65 61 73 65   the TLS release
4520: 2c 0a 63 6f 75 72 74 65 73 79 20 6f 66 20 74 68  ,.courtesy of th
4530: 65 20 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e 53 53  e <strong>OpenSS
4540: 4c 3c 2f 73 74 72 6f 6e 67 3e 20 70 72 6f 6a 65  L</strong> proje
4550: 63 74 2e 3c 2f 70 3e 0a 0a 3c 70 72 65 3e 3c 63  ct.</p>..<pre><c
4560: 6f 64 65 3e 0a 70 61 63 6b 61 67 65 20 72 65 71  ode>.package req
4570: 75 69 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67  uire http.packag
4580: 65 20 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 68  e require tls..h
4590: 74 74 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74  ttp::register ht
45a0: 74 70 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a  tps 443 [list ::
45b0: 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74  tls::socket -aut
45c0: 6f 73 65 72 76 65 72 6e 61 6d 65 20 74 72 75 65  oservername true
45d0: 20 2d 72 65 71 75 69 72 65 20 74 72 75 65 20 2d   -require true -
45e0: 63 61 64 69 72 20 2f 65 74 63 2f 73 73 6c 2f 63  cadir /etc/ssl/c
45f0: 65 72 74 73 5d 0a 0a 73 65 74 20 74 6f 6b 20 5b  erts]..set tok [
4600: 68 74 74 70 3a 3a 67 65 74 75 72 6c 20 68 74 74  http::geturl htt
4610: 70 73 3a 2f 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f  ps://www.tcl.tk/
4620: 5d 0a 3c 2f 63 6f 64 65 3e 3c 2f 70 72 65 3e 0a  ].</code></pre>.
4630: 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 50  .<h3><a name="SP
4640: 45 43 49 41 4c 20 43 4f 4e 53 49 44 45 52 41 54  ECIAL CONSIDERAT
4650: 49 4f 4e 53 22 3e 53 50 45 43 49 41 4c 20 43 4f  IONS">SPECIAL CO
4660: 4e 53 49 44 45 52 41 54 49 4f 4e 53 3c 2f 61 3e  NSIDERATIONS</a>
4670: 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 65 20 63 61  </h3>..<p>The ca
4680: 70 61 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68  pabilities of th
4690: 69 73 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76  is package can v
46a0: 61 72 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62  ary enormously b
46b0: 61 73 65 64 0a 75 70 6f 6e 20 68 6f 77 20 79 6f  ased.upon how yo
46c0: 75 72 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61  ur OpenSSL libra
46d0: 72 79 20 77 61 73 20 63 6f 6e 66 69 67 75 72 65  ry was configure
46e0: 64 20 61 6e 64 20 62 75 69 6c 74 2e 20 41 74 20  d and built. At 
46f0: 74 68 65 0a 6d 6f 73 74 20 6d 61 63 72 6f 2d 6c  the.most macro-l
4700: 65 76 65 6c 20 4f 70 65 6e 53 53 4c 20 73 75 70  evel OpenSSL sup
4710: 70 6f 72 74 73 20 61 20 26 71 75 6f 74 3b 6e 6f  ports a &quot;no
4720: 20 70 61 74 65 6e 74 73 26 71 75 6f 74 3b 20 62   patents&quot; b
4730: 75 69 6c 64 2c 0a 77 68 69 63 68 20 64 69 73 61  uild,.which disa
4740: 62 6c 65 73 20 52 53 41 2c 20 49 44 45 41 2c 20  bles RSA, IDEA, 
4750: 52 43 28 32 2c 34 2c 35 29 20 61 6e 64 20 53 53  RC(2,4,5) and SS
4760: 4c 32 20 2d 20 69 66 20 79 6f 75 72 20 4f 70 65  L2 - if your Ope
4770: 6e 53 53 4c 20 69 73 0a 63 6f 6e 66 69 67 75 72  nSSL is.configur
4780: 65 64 20 74 68 69 73 20 77 61 79 20 74 68 65 6e  ed this way then
4790: 20 79 6f 75 20 77 69 6c 6c 20 6e 65 65 64 20 74   you will need t
47a0: 6f 20 62 75 69 6c 64 20 54 4c 53 20 77 69 74 68  o build TLS with
47b0: 20 74 68 65 0a 2d 44 4e 4f 5f 50 41 54 45 4e 54   the.-DNO_PATENT
47c0: 53 20 6f 70 74 69 6f 6e 20 2d 20 61 6e 64 20 74  S option - and t
47d0: 68 65 20 72 65 73 75 6c 74 61 6e 74 20 6d 6f 64  he resultant mod
47e0: 75 6c 65 20 77 69 6c 6c 20 66 75 6e 63 74 69 6f  ule will functio
47f0: 6e 0a 63 6f 72 72 65 63 74 6c 79 20 61 6e 64 20  n.correctly and 
4800: 61 6c 73 6f 20 73 75 70 70 6f 72 74 20 41 44 48  also support ADH
4810: 20 63 65 72 74 69 66 69 63 61 74 65 2d 6c 65 73   certificate-les
4820: 73 20 65 6e 63 72 79 70 74 69 6f 6e 2c 0a 68 6f  s encryption,.ho
4830: 77 65 76 65 72 20 79 6f 75 20 77 69 6c 6c 20 62  wever you will b
4840: 65 20 75 6e 61 62 6c 65 20 74 6f 20 75 74 69 6c  e unable to util
4850: 69 7a 65 20 74 68 69 73 20 74 6f 20 73 70 65 61  ize this to spea
4860: 6b 20 74 6f 20 6e 6f 72 6d 61 6c 20 57 65 62 0a  k to normal Web.
4870: 53 65 72 76 65 72 73 2c 20 77 68 69 63 68 20 74  Servers, which t
4880: 79 70 69 63 61 6c 6c 79 20 72 65 71 75 69 72 65  ypically require
4890: 20 52 53 41 20 73 75 70 70 6f 72 74 2e 20 50 6c   RSA support. Pl
48a0: 65 61 73 65 20 73 65 65 20 3c 61 0a 68 72 65 66  ease see <a.href
48b0: 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65  ="http://www.ope
48c0: 6e 73 73 6c 2e 6f 72 67 2f 22 3e 68 74 74 70 3a  nssl.org/">http:
48d0: 2f 2f 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72  //www.openssl.or
48e0: 67 2f 3c 2f 61 3e 20 66 6f 72 0a 6d 6f 72 65 20  g/</a> for.more 
48f0: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74  information on t
4900: 68 65 20 77 68 6f 6c 65 20 69 73 73 75 65 20 6f  he whole issue o
4910: 66 20 70 61 74 65 6e 74 73 20 61 6e 64 20 55 53  f patents and US
4920: 20 65 78 70 6f 72 74 0a 72 65 73 74 72 69 63 74   export.restrict
4930: 69 6f 6e 73 2e 20 3c 2f 70 3e 0a 0a 3c 68 33 3e  ions. </p>..<h3>
4940: 3c 61 20 6e 61 6d 65 3d 22 53 45 45 20 41 4c 53  <a name="SEE ALS
4950: 4f 22 3e 53 45 45 20 41 4c 53 4f 3c 2f 61 3e 3c  O">SEE ALSO</a><
4960: 2f 68 33 3e 0a 0a 3c 70 3e 3c 73 74 72 6f 6e 67  /h3>..<p><strong
4970: 3e 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e  >socket</strong>
4980: 2c 20 3c 73 74 72 6f 6e 67 3e 66 69 6c 65 65 76  , <strong>fileev
4990: 65 6e 74 2c 20 3c 2f 73 74 72 6f 6e 67 3e 3c 61  ent, </strong><a
49a0: 0a 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77  .href="http://ww
49b0: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e  w.openssl.org/">
49c0: 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c  <strong>OpenSSL<
49d0: 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 3c 2f 70 3e  /strong></a></p>
49e0: 0a 0a 3c 68 72 3e 0a 0a 3c 70 72 65 3e 0a 43 6f  ..<hr>..<pre>.Co
49f0: 70 79 72 69 67 68 74 20 26 63 6f 70 79 3b 20 31  pyright &copy; 1
4a00: 39 39 39 20 4d 61 74 74 20 4e 65 77 6d 61 6e 2e  999 Matt Newman.
4a10: 0a 43 6f 70 79 72 69 67 68 74 20 26 63 6f 70 79  .Copyright &copy
4a20: 3b 20 32 30 30 34 20 53 74 61 72 66 69 73 68 20  ; 2004 Starfish 
4a30: 53 79 73 74 65 6d 73 2e 0a 3c 2f 70 72 65 3e 0a  Systems..</pre>.
4a40: 3c 2f 62 6f 64 79 3e 0a 3c 2f 68 74 6d 6c 3e 0a  </body>.</html>.