Hex Artifact Content

Artifact 9ac98151aed405298673ace847f1e8b488524e608ff5dd480bb60cb47058200e:


0000: 3c 21 64 6f 63 74 79 70 65 20 68 74 6d 6c 20 70  <!doctype html p
0010: 75 62 6c 69 63 20 22 2d 2f 2f 57 33 43 2f 2f 44  ublic "-//W3C//D
0020: 54 44 20 48 54 4d 4c 20 34 2e 30 20 54 72 61 6e  TD HTML 4.0 Tran
0030: 73 69 74 69 6f 6e 61 6c 2f 2f 45 4e 22 3e 20 0a  sitional//EN"> .
0040: 0a 3c 68 74 6d 6c 3e 0a 0a 3c 68 65 61 64 3e 0a  .<html>..<head>.
0050: 3c 6d 65 74 61 20 68 74 74 70 2d 65 71 75 69 76  <meta http-equiv
0060: 3d 22 43 6f 6e 74 65 6e 74 2d 54 79 70 65 22 0a  ="Content-Type".
0070: 63 6f 6e 74 65 6e 74 3d 22 74 65 78 74 2f 68 74  content="text/ht
0080: 6d 6c 3b 20 63 68 61 72 73 65 74 3d 69 73 6f 2d  ml; charset=iso-
0090: 38 38 35 39 2d 31 22 3e 0a 3c 6d 65 74 61 20 6e  8859-1">.<meta n
00a0: 61 6d 65 3d 22 43 6f 70 79 72 69 67 68 74 22 20  ame="Copyright" 
00b0: 63 6f 6e 74 65 6e 74 3d 22 31 39 39 39 20 4d 61  content="1999 Ma
00c0: 74 74 20 4e 65 77 6d 61 6e 20 2f 20 32 30 30 34  tt Newman / 2004
00d0: 20 53 74 61 72 66 69 73 68 20 53 79 73 74 65 6d   Starfish System
00e0: 73 22 3e 0a 3c 74 69 74 6c 65 3e 54 4c 53 20 28  s">.<title>TLS (
00f0: 53 53 4c 29 20 54 63 6c 20 43 6f 6d 6d 61 6e 64  SSL) Tcl Command
0100: 73 3c 2f 74 69 74 6c 65 3e 0a 3c 2f 68 65 61 64  s</title>.</head
0110: 3e 0a 0a 3c 62 6f 64 79 20 62 67 63 6f 6c 6f 72  >..<body bgcolor
0120: 3d 22 23 46 46 46 46 46 46 22 3e 0a 0a 3c 64 6c  ="#FFFFFF">..<dl
0130: 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65  >.    <dd><a hre
0140: 66 3d 22 23 4e 41 4d 45 22 3e 4e 41 4d 45 3c 2f  f="#NAME">NAME</
0150: 61 3e 20 3c 64 6c 3e 0a 20 20 20 20 20 20 20 20  a> <dl>.        
0160: 20 20 20 20 3c 64 64 3e 3c 73 74 72 6f 6e 67 3e      <dd><strong>
0170: 74 6c 73 3c 2f 73 74 72 6f 6e 67 3e 20 2d 20 62  tls</strong> - b
0180: 69 6e 64 69 6e 67 20 74 6f 20 3c 73 74 72 6f 6e  inding to <stron
0190: 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e  g>OpenSSL</stron
01a0: 67 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20  g>.             
01b0: 20 20 20 74 6f 6f 6c 6b 69 74 2e 3c 2f 64 64 3e     toolkit.</dd>
01c0: 0a 20 20 20 20 20 20 20 20 3c 2f 64 6c 3e 0a 20  .        </dl>. 
01d0: 20 20 20 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64     </dd>.    <dd
01e0: 3e 3c 61 20 68 72 65 66 3d 22 23 53 59 4e 4f 50  ><a href="#SYNOP
01f0: 53 49 53 22 3e 53 59 4e 4f 50 53 49 53 3c 2f 61  SIS">SYNOPSIS</a
0200: 3e 20 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e  > </dd>.    <dd>
0210: 3c 64 6c 3e 0a 20 20 20 20 20 20 20 20 20 20 20  <dl>.           
0220: 20 3c 64 64 3e 3c 62 3e 70 61 63 6b 61 67 65 20   <dd><b>package 
0230: 72 65 71 75 69 72 65 20 54 63 6c 20 3c 2f 62 3e  require Tcl </b>
0240: 3c 65 6d 3e 3f 38 2e 34 3f 3c 2f 65 6d 3e 3c 2f  <em>?8.4?</em></
0250: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dd>.            
0260: 3c 64 64 3e 3c 62 3e 70 61 63 6b 61 67 65 20 72  <dd><b>package r
0270: 65 71 75 69 72 65 20 74 6c 73 20 3c 2f 62 3e 3c  equire tls </b><
0280: 65 6d 3e 3f 40 40 56 45 52 53 40 40 3f 3c 2f 65  em>?@@VERS@@?</e
0290: 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  m></dd>.        
02a0: 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f      <dt>&nbsp;</
02b0: 64 74 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dt>.            
02c0: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74  <dd><b>tls::init
02d0: 20 3c 2f 62 3e 3c 69 3e 3f 6f 70 74 69 6f 6e 73   </b><i>?options
02e0: 3f 3c 2f 69 3e 20 3c 2f 64 64 3e 0a 20 20 20 20  ?</i> </dd>.    
02f0: 20 20 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74          <dd><b>t
0300: 6c 73 3a 3a 73 6f 63 6b 65 74 20 3c 2f 62 3e 3c  ls::socket </b><
0310: 65 6d 3e 3f 6f 70 74 69 6f 6e 73 3f 20 68 6f 73  em>?options? hos
0320: 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64 64 3e  t port</em></dd>
0330: 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 64 64  .            <dd
0340: 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c  ><b>tls::socket<
0350: 2f 62 3e 3c 65 6d 3e 20 3f 2d 73 65 72 76 65 72  /b><em> ?-server
0360: 20 63 6f 6d 6d 61 6e 64 3f 0a 20 20 20 20 20 20   command?.      
0370: 20 20 20 20 20 20 20 20 20 20 3f 6f 70 74 69 6f            ?optio
0380: 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64  ns? port</em></d
0390: 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c  d>.            <
03a0: 64 64 3e 3c 62 3e 74 6c 73 3a 3a 68 61 6e 64 73  dd><b>tls::hands
03b0: 68 61 6b 65 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61  hake</b><em> cha
03c0: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20  nnel</em></dd>. 
03d0: 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c             <dd><
03e0: 62 3e 74 6c 73 3a 3a 73 74 61 74 75 73 20 3c 2f  b>tls::status </
03f0: 62 3e 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f 20 63  b><em>?-local? c
0400: 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e  hannel</em></dd>
0410: 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 64 64  .            <dd
0420: 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c  ><b>tls::import<
0430: 2f 62 3e 3c 65 6d 3e 20 63 68 61 6e 6e 65 6c 20  /b><em> channel 
0440: 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 65 6d 3e 3c 2f  ?options?</em></
0450: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dd>.            
0460: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 75 6e 69 6d  <dd><b>tls::unim
0470: 70 6f 72 74 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61  port</b><em> cha
0480: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20  nnel</em></dd>. 
0490: 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c             <dd><
04a0: 62 3e 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 3c  b>tls::ciphers <
04b0: 2f 62 3e 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20  /b><em>protocol 
04c0: 3f 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f  ?verbose?</em></
04d0: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dd>.            
04e0: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 76 65 72 73  <dd><b>tls::vers
04f0: 69 6f 6e 3c 2f 62 3e 3c 2f 64 64 3e 0a 20 20 20  ion</b></dd>.   
0500: 20 20 20 20 20 3c 2f 64 6c 3e 0a 20 20 20 20 3c       </dl>.    <
0510: 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20  /dd>.    <dd><a 
0520: 68 72 65 66 3d 22 23 43 4f 4d 4d 41 4e 44 53 22  href="#COMMANDS"
0530: 3e 43 4f 4d 4d 41 4e 44 53 3c 2f 61 3e 3c 2f 64  >COMMANDS</a></d
0540: 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72  d>.    <dd><a hr
0550: 65 66 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50  ef="#CALLBACK OP
0560: 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20  TIONS">CALLBACK 
0570: 4f 50 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 64 64 3e  OPTIONS</a></dd>
0580: 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 66  .    <dd><a href
0590: 3d 22 23 48 54 54 50 53 20 45 58 41 4d 50 4c 45  ="#HTTPS EXAMPLE
05a0: 22 3e 48 54 54 50 53 20 45 58 41 4d 50 4c 45 3c  ">HTTPS EXAMPLE<
05b0: 2f 61 3e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64  /a></dd>.    <dd
05c0: 3e 3c 61 20 68 72 65 66 3d 22 23 53 45 45 20 41  ><a href="#SEE A
05d0: 4c 53 4f 22 3e 53 50 45 43 49 41 4c 20 43 4f 4e  LSO">SPECIAL CON
05e0: 53 49 44 45 52 41 54 49 4f 4e 53 3c 2f 61 3e 3c  SIDERATIONS</a><
05f0: 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20  /dd>.    <dd><a 
0600: 68 72 65 66 3d 22 23 53 45 45 20 41 4c 53 4f 22  href="#SEE ALSO"
0610: 3e 53 45 45 20 41 4c 53 4f 3c 2f 61 3e 3c 2f 64  >SEE ALSO</a></d
0620: 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 68 72 3e 0a 0a  d>.</dl>..<hr>..
0630: 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 4e 41 4d  <h3><a name="NAM
0640: 45 22 3e 4e 41 4d 45 3c 2f 61 3e 3c 2f 68 33 3e  E">NAME</a></h3>
0650: 0a 0a 3c 70 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73  ..<p><strong>tls
0660: 3c 2f 73 74 72 6f 6e 67 3e 20 2d 20 62 69 6e 64  </strong> - bind
0670: 69 6e 67 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 4f  ing to <strong>O
0680: 70 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e 67 3e 0a  penSSL</strong>.
0690: 74 6f 6f 6c 6b 69 74 2e 3c 2f 70 3e 0a 0a 3c 68  toolkit.</p>..<h
06a0: 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 59 4e 4f 50  3><a name="SYNOP
06b0: 53 49 53 22 3e 53 59 4e 4f 50 53 49 53 3c 2f 61  SIS">SYNOPSIS</a
06c0: 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 3c 62 3e 70 61  ></h3>..<p><b>pa
06d0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63  ckage require Tc
06e0: 6c 20 38 2e 34 3c 2f 62 3e 3c 62 72 3e 0a 3c 62  l 8.4</b><br>.<b
06f0: 3e 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65  >package require
0700: 20 74 6c 73 20 40 40 56 45 52 53 40 40 3c 2f 62   tls @@VERS@@</b
0710: 3e 3c 62 72 3e 0a 3c 62 72 3e 0a 3c 61 20 68 72  ><br>.<br>.<a hr
0720: 65 66 3d 22 23 74 6c 73 3a 3a 69 6e 69 74 22 3e  ef="#tls::init">
0730: 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74 20 3c 2f 62  <b>tls::init </b
0740: 3e 3c 69 3e 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 69  ><i>?options?</i
0750: 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65  ><br>.</a><a hre
0760: 66 3d 22 23 74 6c 73 3a 3a 73 6f 63 6b 65 74 22  f="#tls::socket"
0770: 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 20  ><b>tls::socket 
0780: 3c 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 69 6f 6e 73  </b><em>?options
0790: 3f 20 68 6f 73 74 0a 70 6f 72 74 3c 2f 65 6d 3e  ? host.port</em>
07a0: 3c 62 72 3e 0a 3c 62 3e 74 6c 73 3a 3a 73 6f 63  <br>.<b>tls::soc
07b0: 6b 65 74 3c 2f 62 3e 3c 65 6d 3e 20 3f 2d 73 65  ket</b><em> ?-se
07c0: 72 76 65 72 20 63 6f 6d 6d 61 6e 64 3f 20 3f 6f  rver command? ?o
07d0: 70 74 69 6f 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d  ptions? port</em
07e0: 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65  ><br>.</a><a hre
07f0: 66 3d 22 23 74 6c 73 3a 3a 73 74 61 74 75 73 22  f="#tls::status"
0800: 3e 3c 62 3e 74 6c 73 3a 3a 73 74 61 74 75 73 20  ><b>tls::status 
0810: 3c 2f 62 3e 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f  </b><em>?-local?
0820: 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 62 72   channel</em><br
0830: 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65 66 3d 22 23  >.</a><a href="#
0840: 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 22 3e  tls::handshake">
0850: 3c 62 3e 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b  <b>tls::handshak
0860: 65 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61 6e 6e 65  e</b><em> channe
0870: 6c 3c 2f 65 6d 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c  l</em></a><br>.<
0880: 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c  br>.<a href="#tl
0890: 73 3a 3a 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c  s::import"><b>tl
08a0: 73 3a 3a 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69  s::import </b><i
08b0: 3e 63 68 61 6e 6e 65 6c 20 3f 6f 70 74 69 6f 6e  >channel ?option
08c0: 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c  s?</i></a><br>.<
08d0: 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 75 6e  a href="#tls::un
08e0: 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a  import"><b>tls::
08f0: 75 6e 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e  unimport </b><i>
0900: 63 68 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61 3e 3c  channel</i></a><
0910: 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c  br>.<a href="#tl
0920: 73 3a 3a 63 69 70 68 65 72 73 20 70 72 6f 74 6f  s::ciphers proto
0930: 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 22 3e 3c  col ?verbose?"><
0940: 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 69 70 68  strong>tls::ciph
0950: 65 72 73 3c 2f 73 74 72 6f 6e 67 3e 0a 3c 65 6d  ers</strong>.<em
0960: 3e 70 72 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f  >protocol ?verbo
0970: 73 65 3f 3c 2f 65 6d 3e 3c 2f 61 3e 3c 62 72 3e  se?</em></a><br>
0980: 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a  .<a href="#tls::
0990: 76 65 72 73 69 6f 6e 22 3e 3c 62 3e 74 6c 73 3a  version"><b>tls:
09a0: 3a 76 65 72 73 69 6f 6e 3c 2f 62 3e 3c 2f 61 3e  :version</b></a>
09b0: 0a 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61  .</p>..<h3><a na
09c0: 6d 65 3d 22 44 45 53 43 52 49 50 54 49 4f 4e 22  me="DESCRIPTION"
09d0: 3e 44 45 53 43 52 49 50 54 49 4f 4e 3c 2f 61 3e  >DESCRIPTION</a>
09e0: 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 69 73 20 65  </h3>..<p>This e
09f0: 78 74 65 6e 73 69 6f 6e 20 70 72 6f 76 69 64 65  xtension provide
0a00: 73 20 61 20 67 65 6e 65 72 69 63 20 62 69 6e 64  s a generic bind
0a10: 69 6e 67 20 74 6f 20 3c 61 0a 68 72 65 66 3d 22  ing to <a.href="
0a20: 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73  http://www.opens
0a30: 73 6c 2e 6f 72 67 2f 22 3e 4f 70 65 6e 53 53 4c  sl.org/">OpenSSL
0a40: 3c 2f 61 3e 2c 20 75 74 69 6c 69 7a 69 6e 67 20  </a>, utilizing 
0a50: 74 68 65 0a 3c 73 74 72 6f 6e 67 3e 54 63 6c 5f  the.<strong>Tcl_
0a60: 53 74 61 63 6b 43 68 61 6e 6e 65 6c 3c 2f 73 74  StackChannel</st
0a70: 72 6f 6e 67 3e 0a 41 50 49 20 66 6f 72 20 54 63  rong>.API for Tc
0a80: 6c 20 38 2e 32 20 61 6e 64 20 68 69 67 68 65 72  l 8.2 and higher
0a90: 2e 20 54 68 65 20 73 6f 63 6b 65 74 73 20 62 65  . The sockets be
0aa0: 68 61 76 65 20 65 78 61 63 74 6c 79 20 74 68 65  have exactly the
0ab0: 20 73 61 6d 65 0a 61 73 20 63 68 61 6e 6e 65 6c   same.as channel
0ac0: 73 20 63 72 65 61 74 65 64 20 75 73 69 6e 67 20  s created using 
0ad0: 54 63 6c 27 73 20 62 75 69 6c 74 2d 69 6e 20 3c  Tcl's built-in <
0ae0: 73 74 72 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73  strong>socket</s
0af0: 74 72 6f 6e 67 3e 0a 63 6f 6d 6d 61 6e 64 20 77  trong>.command w
0b00: 69 74 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f  ith additional o
0b10: 70 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6e 74 72  ptions for contr
0b20: 6f 6c 6c 69 6e 67 20 74 68 65 20 53 53 4c 20 73  olling the SSL s
0b30: 65 73 73 69 6f 6e 2e 0a 54 6f 20 75 73 65 20 54  ession..To use T
0b40: 4c 53 20 77 69 74 68 20 61 6e 20 65 61 72 6c 69  LS with an earli
0b50: 65 72 20 76 65 72 73 69 6f 6e 20 6f 66 20 54 63  er version of Tc
0b60: 6c 20 74 68 61 6e 20 38 2e 34 2c 20 70 6c 65 61  l than 8.4, plea
0b70: 73 65 20 6f 62 74 61 69 6e 0a 54 4c 53 20 31 2e  se obtain.TLS 1.
0b80: 33 2e 0a 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20  3..</p>..<h3><a 
0b90: 6e 61 6d 65 3d 22 43 4f 4d 4d 41 4e 44 53 22 3e  name="COMMANDS">
0ba0: 43 4f 4d 4d 41 4e 44 53 3c 2f 61 3e 3c 2f 68 33  COMMANDS</a></h3
0bb0: 3e 0a 0a 3c 70 3e 54 79 70 69 63 61 6c 6c 79 20  >..<p>Typically 
0bc0: 6f 6e 65 20 77 6f 75 6c 64 20 75 73 65 20 74 68  one would use th
0bd0: 65 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  e <strong>tls::s
0be0: 6f 63 6b 65 74 20 3c 2f 73 74 72 6f 6e 67 3e 63  ocket </strong>c
0bf0: 6f 6d 6d 61 6e 64 0a 77 68 69 63 68 20 70 72 6f  ommand.which pro
0c00: 76 69 64 65 73 20 63 6f 6d 70 61 74 69 62 69 6c  vides compatibil
0c10: 69 74 79 20 77 69 74 68 20 74 68 65 20 6e 61 74  ity with the nat
0c20: 69 76 65 20 54 63 6c 20 3c 73 74 72 6f 6e 67 3e  ive Tcl <strong>
0c30: 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 0a  socket</strong>.
0c40: 63 6f 6d 6d 61 6e 64 2e 20 49 6e 20 73 75 63 68  command. In such
0c50: 20 63 61 73 65 73 20 3c 73 74 72 6f 6e 67 3e 74   cases <strong>t
0c60: 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f  ls::import</stro
0c70: 6e 67 3e 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62  ng> should not b
0c80: 65 0a 75 73 65 64 20 64 69 72 65 63 74 6c 79 2e  e.used directly.
0c90: 3c 2f 70 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c  </p>..<dl>.    <
0ca0: 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a  dt><a name="tls:
0cb0: 3a 69 6e 69 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69  :init"><b>tls::i
0cc0: 6e 69 74 20 3c 2f 62 3e 3c 69 3e 3f 6f 70 74 69  nit </b><i>?opti
0cd0: 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64 74  ons?</i></a></dt
0ce0: 3e 0a 20 20 20 20 3c 64 64 3e 54 68 69 73 20 72  >.    <dd>This r
0cf0: 6f 75 74 69 6e 65 20 73 65 74 73 20 74 68 65 20  outine sets the 
0d00: 64 65 66 61 75 6c 74 20 6f 70 74 69 6f 6e 73 20  default options 
0d10: 75 73 65 64 20 62 79 20 3c 73 74 72 6f 6e 67 3e  used by <strong>
0d20: 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f 73 74 72  tls::socket</str
0d30: 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20 61 6e 64  ong>.        and
0d40: 20 69 73 20 3c 65 6d 3e 6f 70 74 69 6f 6e 61 6c   is <em>optional
0d50: 3c 2f 65 6d 3e 2e 20 49 66 20 79 6f 75 20 63 61  </em>. If you ca
0d60: 6c 6c 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a  ll <strong>tls::
0d70: 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 0a  import</strong>.
0d80: 20 20 20 20 20 20 20 20 64 69 72 65 63 74 6c 79          directly
0d90: 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 68 61   this routine ha
0da0: 73 20 6e 6f 20 65 66 66 65 63 74 2e 20 41 6e 79  s no effect. Any
0db0: 20 6f 66 20 74 68 65 20 6f 70 74 69 6f 6e 73 0a   of the options.
0dc0: 20 20 20 20 20 20 20 20 74 68 61 74 20 3c 73 74          that <st
0dd0: 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74  rong>tls::socket
0de0: 3c 2f 73 74 72 6f 6e 67 3e 20 61 63 63 65 70 74  </strong> accept
0df0: 73 20 63 61 6e 20 62 65 20 73 65 74 0a 20 20 20  s can be set.   
0e00: 20 20 20 20 20 75 73 69 6e 67 20 74 68 69 73 20       using this 
0e10: 63 6f 6d 6d 61 6e 64 2c 20 74 68 6f 75 67 68 20  command, though 
0e20: 79 6f 75 20 73 68 6f 75 6c 64 20 6c 69 6d 69 74  you should limit
0e30: 20 79 6f 75 72 20 6f 70 74 69 6f 6e 73 0a 20 20   your options.  
0e40: 20 20 20 20 20 20 74 6f 20 6f 6e 6c 79 20 54 4c        to only TL
0e50: 53 20 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 3c  S related ones.<
0e60: 2f 64 64 3e 0a 20 20 20 20 3c 64 74 3e 26 6e 62  /dd>.    <dt>&nb
0e70: 73 70 3b 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74  sp;</dt>.    <dt
0e80: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 73  ><a name="tls::s
0e90: 6f 63 6b 65 74 22 3e 3c 62 3e 74 6c 73 3a 3a 73  ocket"><b>tls::s
0ea0: 6f 63 6b 65 74 20 3c 2f 62 3e 3c 65 6d 3e 3f 6f  ocket </b><em>?o
0eb0: 70 74 69 6f 6e 73 3f 0a 20 20 20 20 20 20 20 20  ptions?.        
0ec0: 68 6f 73 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f  host port</em></
0ed0: 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74 3e  a></dt>.    <dt>
0ee0: 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f  <b>tls::socket</
0ef0: 62 3e 3c 65 6d 3e 20 3f 2d 73 65 72 76 65 72 20  b><em> ?-server 
0f00: 63 6f 6d 6d 61 6e 64 3f 20 3f 6f 70 74 69 6f 6e  command? ?option
0f10: 73 3f 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64 74  s? port</em></dt
0f20: 3e 0a 20 20 20 20 3c 64 64 3e 54 68 69 73 20 69  >.    <dd>This i
0f30: 73 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63 74  s a helper funct
0f40: 69 6f 6e 20 74 68 61 74 20 75 74 69 6c 69 7a 65  ion that utilize
0f50: 73 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67  s the underlying
0f60: 0a 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64  .        command
0f70: 73 20 28 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a  s (<strong>tls::
0f80: 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 29  import</strong>)
0f90: 2e 20 49 74 20 62 65 68 61 76 65 73 0a 20 20 20  . It behaves.   
0fa0: 20 20 20 20 20 65 78 61 63 74 6c 79 20 74 68 65       exactly the
0fb0: 20 73 61 6d 65 20 61 73 20 74 68 65 20 6e 61 74   same as the nat
0fc0: 69 76 65 20 54 63 6c 20 3c 73 74 72 6f 6e 67 3e  ive Tcl <strong>
0fd0: 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 0a  socket</strong>.
0fe0: 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 20          command 
0ff0: 65 78 63 65 70 74 20 74 68 61 74 20 74 68 65 20  except that the 
1000: 6f 70 74 69 6f 6e 73 20 63 61 6e 20 69 6e 63 6c  options can incl
1010: 75 64 65 20 61 6e 79 20 6f 66 20 74 68 65 0a 20  ude any of the. 
1020: 20 20 20 20 20 20 20 61 70 70 6c 69 63 61 62 6c         applicabl
1030: 65 20 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 3a  e <a href="#tls:
1040: 3a 69 6d 70 6f 72 74 22 3e 3c 73 74 72 6f 6e 67  :import"><strong
1050: 3e 74 6c 73 3a 69 6d 70 6f 72 74 3c 2f 73 74 72  >tls:import</str
1060: 6f 6e 67 3e 3c 2f 61 3e 0a 20 20 20 20 20 20 20  ong></a>.       
1070: 20 6f 70 74 69 6f 6e 73 20 77 69 74 68 20 6f 6e   options with on
1080: 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74  e additional opt
1090: 69 6f 6e 3a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65  ion:.<blockquote
10a0: 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20 20 20 20 20  >.    <dl>.     
10b0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
10c0: 61 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 3c 2f  autoservername</
10d0: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c  strong> <em>bool
10e0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
10f0: 20 20 20 3c 64 64 3e 41 75 74 6f 6d 61 74 69 63     <dd>Automatic
1100: 61 6c 6c 79 20 73 65 6e 64 20 74 68 65 20 2d 73  ally send the -s
1110: 65 72 76 65 72 6e 61 6d 65 20 61 73 20 74 68 65  ervername as the
1120: 20 3c 65 6d 3e 68 6f 73 74 3c 2f 65 6d 3e 20 61   <em>host</em> a
1130: 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 20 20 20  rgument.        
1140: 20 20 20 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66      (<strong>def
1150: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c  ault</strong>: <
1160: 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f  em>false</em>)</
1170: 64 64 3e 0a 20 20 20 20 3c 2f 64 6c 3e 0a 3c 2f  dd>.    </dl>.</
1180: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 20 20  blockquote>.    
1190: 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f 64 74 3e 0a  <dt>&nbsp;</dt>.
11a0: 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d      <dt><a name=
11b0: 22 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 22  "tls::handshake"
11c0: 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 68 61  ><strong>tls::ha
11d0: 6e 64 73 68 61 6b 65 3c 2f 73 74 72 6f 6e 67 3e  ndshake</strong>
11e0: 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d   <em>channel</em
11f0: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c  ></a></dt>.    <
1200: 64 64 3e 46 6f 72 63 65 73 20 68 61 6e 64 73 68  dd>Forces handsh
1210: 61 6b 65 20 74 6f 20 74 61 6b 65 20 70 6c 61 63  ake to take plac
1220: 65 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 30  e, and returns 0
1230: 20 69 66 0a 20 20 20 20 20 20 20 20 68 61 6e 64   if.        hand
1240: 73 68 61 6b 65 20 69 73 20 73 74 69 6c 6c 20 69  shake is still i
1250: 6e 20 70 72 6f 67 72 65 73 73 20 28 6e 6f 6e 2d  n progress (non-
1260: 62 6c 6f 63 6b 69 6e 67 29 2c 20 6f 72 20 31 20  blocking), or 1 
1270: 69 66 0a 20 20 20 20 20 20 20 20 74 68 65 20 68  if.        the h
1280: 61 6e 64 73 68 61 6b 65 20 77 61 73 20 73 75 63  andshake was suc
1290: 63 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65 20  cessful. If the 
12a0: 68 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65 64  handshake failed
12b0: 0a 20 20 20 20 20 20 20 20 74 68 69 73 20 72 6f  .        this ro
12c0: 75 74 69 6e 65 20 77 69 6c 6c 20 74 68 72 6f 77  utine will throw
12d0: 20 61 6e 20 65 72 72 6f 72 2e 3c 2f 64 64 3e 0a   an error.</dd>.
12e0: 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f      <dt>&nbsp;</
12f0: 64 74 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e  dt>.    <dt><a n
1300: 61 6d 65 3d 22 74 6c 73 3a 3a 73 74 61 74 75 73  ame="tls::status
1310: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73  "><strong>tls::s
1320: 74 61 74 75 73 3c 2f 73 74 72 6f 6e 67 3e 0a 20  tatus</strong>. 
1330: 20 20 20 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f 20     <em>?-local? 
1340: 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61 3e  channel</em></a>
1350: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 52 65  </dt>.    <dd>Re
1360: 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65 6e  turns the curren
1370: 74 20 73 65 63 75 72 69 74 79 20 73 74 61 74 75  t security statu
1380: 73 20 6f 66 20 61 6e 20 53 53 4c 20 63 68 61 6e  s of an SSL chan
1390: 6e 65 6c 2e 20 54 68 65 0a 20 20 20 20 20 20 20  nel. The.       
13a0: 20 72 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73   result is a lis
13b0: 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70  t of key-value p
13c0: 61 69 72 73 20 64 65 73 63 72 69 62 69 6e 67 20  airs describing 
13d0: 74 68 65 0a 20 20 20 20 20 20 20 20 63 6f 6e 6e  the.        conn
13e0: 65 63 74 65 64 20 70 65 65 72 2e 20 49 66 20 74  ected peer. If t
13f0: 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 6e 20  he result is an 
1400: 65 6d 70 74 79 20 6c 69 73 74 20 74 68 65 6e 20  empty list then 
1410: 74 68 65 0a 20 20 20 20 20 20 20 20 53 53 4c 20  the.        SSL 
1420: 68 61 6e 64 73 68 61 6b 65 20 68 61 73 20 6e 6f  handshake has no
1430: 74 20 79 65 74 20 63 6f 6d 70 6c 65 74 65 64 2e  t yet completed.
1440: 0a 20 20 20 20 20 20 20 20 49 66 20 3c 65 6d 3e  .        If <em>
1450: 2d 6c 6f 63 61 6c 3c 2f 65 6d 3e 20 69 73 20 67  -local</em> is g
1460: 69 76 65 6e 2c 20 74 68 65 6e 20 74 68 65 20 63  iven, then the c
1470: 65 72 74 69 66 69 63 61 74 65 20 69 6e 66 6f 72  ertificate infor
1480: 6d 61 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 69  mation.        i
1490: 73 20 74 68 65 20 6f 6e 65 20 75 73 65 64 20 6c  s the one used l
14a0: 6f 63 61 6c 6c 79 2e 3c 2f 64 64 3e 0a 3c 2f 64  ocally.</dd>.</d
14b0: 6c 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e  l>..<blockquote>
14c0: 0a 20 20 20 20 3c 64 6c 3e 0a 20 20 20 20 20 20  .    <dl>.      
14d0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 69 73    <dt><strong>is
14e0: 73 75 65 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  suer</strong> <e
14f0: 6d 3e 64 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20  m>dn</em></dt>. 
1500: 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 64         <dd>The d
1510: 69 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d  istinguished nam
1520: 65 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65  e (DN) of the ce
1530: 72 74 69 66 69 63 61 74 65 0a 20 20 20 20 20 20  rtificate.      
1540: 20 20 20 20 20 20 69 73 73 75 65 72 2e 3c 2f 64        issuer.</d
1550: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
1560: 73 74 72 6f 6e 67 3e 73 75 62 6a 65 63 74 3c 2f  strong>subject</
1570: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 6e 3c 2f  strong> <em>dn</
1580: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1590: 20 3c 64 64 3e 54 68 65 20 64 69 73 74 69 6e 67   <dd>The disting
15a0: 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29  uished name (DN)
15b0: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63   of the certific
15c0: 61 74 65 0a 20 20 20 20 20 20 20 20 20 20 20 20  ate.            
15d0: 73 75 62 6a 65 63 74 2e 3c 2f 64 64 3e 0a 20 20  subject.</dd>.  
15e0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
15f0: 67 3e 6e 6f 74 42 65 66 6f 72 65 3c 2f 73 74 72  g>notBefore</str
1600: 6f 6e 67 3e 20 3c 65 6d 3e 64 61 74 65 3c 2f 65  ong> <em>date</e
1610: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
1620: 3c 64 64 3e 54 68 65 20 62 65 67 69 6e 20 64 61  <dd>The begin da
1630: 74 65 20 66 6f 72 20 74 68 65 20 76 61 6c 69 64  te for the valid
1640: 69 74 79 20 6f 66 20 74 68 65 20 63 65 72 74 69  ity of the certi
1650: 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20  ficate.</dd>.   
1660: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
1670: 3e 6e 6f 74 41 66 74 65 72 3c 2f 73 74 72 6f 6e  >notAfter</stron
1680: 67 3e 20 3c 65 6d 3e 64 61 74 65 3c 2f 65 6d 3e  g> <em>date</em>
1690: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
16a0: 64 3e 54 68 65 20 65 78 70 69 72 79 20 64 61 74  d>The expiry dat
16b0: 65 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 66  e for the certif
16c0: 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20  icate.</dd>.    
16d0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
16e0: 73 65 72 69 61 6c 3c 2f 73 74 72 6f 6e 67 3e 20  serial</strong> 
16f0: 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  <em>n</em></dt>.
1700: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
1710: 73 65 72 69 61 6c 20 6e 75 6d 62 65 72 20 6f 66  serial number of
1720: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
1730: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  .</dd>.        <
1740: 64 74 3e 3c 73 74 72 6f 6e 67 3e 63 69 70 68 65  dt><strong>ciphe
1750: 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  r</strong> <em>c
1760: 69 70 68 65 72 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  ipher</em></dt>.
1770: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
1780: 63 75 72 72 65 6e 74 20 63 69 70 68 65 72 20 69  current cipher i
1790: 6e 20 75 73 65 20 62 65 74 77 65 65 6e 20 74 68  n use between th
17a0: 65 20 63 6c 69 65 6e 74 20 61 6e 64 0a 20 20 20  e client and.   
17b0: 20 20 20 20 20 20 20 20 20 73 65 72 76 65 72 20           server 
17c0: 63 68 61 6e 6e 65 6c 73 2e 3c 2f 64 64 3e 0a 20  channels.</dd>. 
17d0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
17e0: 6e 67 3e 73 62 69 74 73 3c 2f 73 74 72 6f 6e 67  ng>sbits</strong
17f0: 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c 2f 64 74  > <em>n</em></dt
1800: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68  >.        <dd>Th
1810: 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 69 74 73  e number of bits
1820: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 73 65   used for the se
1830: 73 73 69 6f 6e 20 6b 65 79 2e 3c 2f 64 64 3e 0a  ssion key.</dd>.
1840: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
1850: 6f 6e 67 3e 63 65 72 74 69 66 69 63 61 74 65 3c  ong>certificate<
1860: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f  /strong> <em>n</
1870: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1880: 20 3c 64 64 3e 54 68 65 20 50 45 4d 20 65 6e 63   <dd>The PEM enc
1890: 6f 64 65 64 20 63 65 72 74 69 66 69 63 61 74 65  oded certificate
18a0: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  .</dd>.        <
18b0: 64 74 3e 3c 73 74 72 6f 6e 67 3e 61 6c 70 6e 3c  dt><strong>alpn<
18c0: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 70 72 6f  /strong> <em>pro
18d0: 74 6f 63 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  tocol</em></dt>.
18e0: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
18f0: 70 72 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65  protocol selecte
1900: 64 20 61 66 74 65 72 20 41 70 70 6c 69 63 61 74  d after Applicat
1910: 69 6f 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63  ion-Layer Protoc
1920: 6f 6c 0a 09 20 20 20 20 4e 65 67 6f 74 69 61 74  ol..    Negotiat
1930: 69 6f 6e 20 28 41 4c 50 4e 29 2e 3c 2f 64 64 3e  ion (ALPN).</dd>
1940: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
1950: 72 6f 6e 67 3e 76 65 72 73 69 6f 6e 3c 2f 73 74  rong>version</st
1960: 72 6f 6e 67 3e 20 3c 65 6d 3e 76 61 6c 75 65 3c  rong> <em>value<
1970: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
1980: 20 20 3c 64 64 3e 54 68 65 20 70 72 6f 74 6f 63    <dd>The protoc
1990: 6f 6c 20 76 65 72 73 69 6f 6e 20 75 73 65 64 20  ol version used 
19a0: 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69  for the connecti
19b0: 6f 6e 3a 0a 09 20 20 53 53 4c 76 32 2c 20 53 53  on:..  SSLv2, SS
19c0: 4c 76 33 2c 20 54 4c 53 76 31 2c 20 54 4c 53 76  Lv3, TLSv1, TLSv
19d0: 31 2e 31 2c 20 54 4c 53 76 31 2e 32 2c 20 75 6e  1.1, TLSv1.2, un
19e0: 6b 6e 6f 77 6e 3c 2f 64 64 3e 0a 20 20 20 20 3c  known</dd>.    <
19f0: 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74  /dl>.</blockquot
1a00: 65 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74  e>..<dl>.    <dt
1a10: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 69  ><a name="tls::i
1a20: 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69  mport"><b>tls::i
1a30: 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e 63 68 61  mport </b><i>cha
1a40: 6e 6e 65 6c 0a 20 20 20 20 20 20 20 20 3f 6f 70  nnel.        ?op
1a50: 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f  tions?</i></a></
1a60: 64 74 3e 0a 20 20 20 20 3c 64 64 3e 53 53 4c 2d  dt>.    <dd>SSL-
1a70: 65 6e 61 62 6c 65 20 61 20 72 65 67 75 6c 61 72  enable a regular
1a80: 20 54 63 6c 20 63 68 61 6e 6e 65 6c 20 2d 20 69   Tcl channel - i
1a90: 74 20 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 0a  t need not be a.
1aa0: 20 20 20 20 20 20 20 20 73 6f 63 6b 65 74 2c 20          socket, 
1ab0: 62 75 74 20 6d 75 73 74 20 70 72 6f 76 69 64 65  but must provide
1ac0: 20 62 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c 20   bi-directional 
1ad0: 66 6c 6f 77 2e 20 41 6c 73 6f 0a 20 20 20 20 20  flow. Also.     
1ae0: 20 20 20 73 65 74 74 69 6e 67 20 73 65 73 73 69     setting sessi
1af0: 6f 6e 20 70 61 72 61 6d 65 74 65 72 73 20 66 6f  on parameters fo
1b00: 72 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e  r SSL handshake.
1b10: 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 62 6c  </dd>.</dl>..<bl
1b20: 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 20 20 3c 64  ockquote>.    <d
1b30: 6c 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  l>.        <dt><
1b40: 73 74 72 6f 6e 67 3e 2d 61 6c 70 6e 3c 2f 73 74  strong>-alpn</st
1b50: 72 6f 6e 67 3e 20 3c 65 6d 3e 6c 69 73 74 3c 2f  rong> <em>list</
1b60: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1b70: 20 3c 64 64 3e 4c 69 73 74 20 6f 66 20 70 72 6f   <dd>List of pro
1b80: 74 6f 63 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20  tocols to offer 
1b90: 64 75 72 69 6e 67 20 41 70 70 6c 69 63 61 74 69  during Applicati
1ba0: 6f 6e 2d 4c 61 79 65 72 0a 09 20 20 20 20 50 72  on-Layer..    Pr
1bb0: 6f 74 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69  otocol Negotiati
1bc0: 6f 6e 20 28 41 4c 50 4e 29 2e 3c 2f 64 64 3e 0a  on (ALPN).</dd>.
1bd0: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
1be0: 6f 6e 67 3e 2d 63 61 64 69 72 3c 2f 73 74 72 6f  ong>-cadir</stro
1bf0: 6e 67 3e 20 3c 65 6d 3e 64 69 72 3c 2f 65 6d 3e  ng> <em>dir</em>
1c00: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1c10: 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 64 69  d>Provide the di
1c20: 72 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69  rectory containi
1c30: 6e 67 20 74 68 65 20 43 41 20 63 65 72 74 69 66  ng the CA certif
1c40: 69 63 61 74 65 73 2e 3c 2f 64 64 3e 0a 20 20 20  icates.</dd>.   
1c50: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
1c60: 3e 2d 63 61 66 69 6c 65 20 3c 2f 73 74 72 6f 6e  >-cafile </stron
1c70: 67 3e 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f  g><em>filename</
1c80: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1c90: 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65   <dd>Provide the
1ca0: 20 43 41 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20   CA file.</dd>. 
1cb0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
1cc0: 6e 67 3e 2d 63 65 72 74 66 69 6c 65 3c 2f 73 74  ng>-certfile</st
1cd0: 72 6f 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61  rong> <em>filena
1ce0: 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  me</em></dt>.   
1cf0: 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65       <dd>Provide
1d00: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 61 20 66   the name of a f
1d10: 69 6c 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 63  ile containing c
1d20: 65 72 74 69 66 69 63 61 74 65 20 74 6f 20 75 73  ertificate to us
1d30: 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  e.</dd>.        
1d40: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63 65 72  <dt><strong>-cer
1d50: 74 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66  t</strong> <em>f
1d60: 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74  ilename</em></dt
1d70: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72  >.        <dd>Pr
1d80: 6f 76 69 64 65 20 74 68 65 20 63 6f 6e 74 65 6e  ovide the conten
1d90: 74 73 20 6f 66 20 61 20 63 65 72 74 69 66 69 63  ts of a certific
1da0: 61 74 65 20 74 6f 20 75 73 65 2c 20 61 73 20 61  ate to use, as a
1db0: 20 44 45 52 20 65 6e 63 6f 64 65 64 20 62 69 6e   DER encoded bin
1dc0: 61 72 79 20 76 61 6c 75 65 20 28 58 2e 35 30 39  ary value (X.509
1dd0: 20 44 45 52 29 2e 3c 2f 64 64 3e 0a 20 20 20 20   DER).</dd>.    
1de0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
1df0: 2d 63 69 70 68 65 72 20 3c 2f 73 74 72 6f 6e 67  -cipher </strong
1e00: 3e 3c 65 6d 3e 73 74 72 69 6e 67 3c 2f 65 6d 3e  ><em>string</em>
1e10: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1e20: 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 63 69  d>Provide the ci
1e30: 70 68 65 72 20 73 75 69 74 65 73 20 74 6f 20 75  pher suites to u
1e40: 73 65 2e 20 53 79 6e 74 61 78 20 69 73 20 61 73  se. Syntax is as
1e50: 20 70 65 72 0a 20 20 20 20 20 20 20 20 20 20 20   per.           
1e60: 20 4f 70 65 6e 53 53 4c 2e 3c 2f 64 64 3e 0a 20   OpenSSL.</dd>. 
1e70: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
1e80: 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74 72  ng>-command</str
1e90: 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63  ong> <em>callbac
1ea0: 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  k</em></dt>.    
1eb0: 20 20 20 20 3c 64 64 3e 49 66 20 73 70 65 63 69      <dd>If speci
1ec0: 66 69 65 64 2c 20 74 68 69 73 20 63 61 6c 6c 62  fied, this callb
1ed0: 61 63 6b 20 77 69 6c 6c 20 62 65 20 69 6e 76 6f  ack will be invo
1ee0: 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 70  ked at several p
1ef0: 6f 69 6e 74 73 0a 20 20 20 20 20 20 20 20 20 20  oints.          
1f00: 20 20 64 75 72 69 6e 67 20 74 68 65 20 4f 70 65    during the Ope
1f10: 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20  nSSL handshake. 
1f20: 20 49 74 20 63 61 6e 20 70 61 73 73 20 65 72 72   It can pass err
1f30: 6f 72 73 20 61 6e 64 20 74 72 61 63 69 6e 67 0a  ors and tracing.
1f40: 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 66 6f              info
1f50: 72 6d 61 74 69 6f 6e 2c 20 61 6e 64 20 69 74 20  rmation, and it 
1f60: 63 61 6e 20 61 6c 6c 6f 77 20 54 63 6c 20 73 63  can allow Tcl sc
1f70: 72 69 70 74 73 20 74 6f 20 70 65 72 66 6f 72 6d  ripts to perform
1f80: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 68 65  .            the
1f90: 69 72 20 6f 77 6e 20 76 61 6c 69 64 61 74 69 6f  ir own validatio
1fa0: 6e 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69  n of the certifi
1fb0: 63 61 74 65 20 69 6e 20 70 6c 61 63 65 20 6f 66  cate in place of
1fc0: 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 20   the.           
1fd0: 20 64 65 66 61 75 6c 74 20 76 61 6c 69 64 61 74   default validat
1fe0: 69 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20  ion provided by 
1ff0: 4f 70 65 6e 53 53 4c 2e 0a 20 20 20 20 20 20 20  OpenSSL..       
2000: 20 20 20 20 20 3c 62 72 3e 0a 20 20 20 20 20 20       <br>.      
2010: 20 20 20 20 20 20 53 65 65 20 3c 61 20 68 72 65        See <a hre
2020: 66 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50 54  f="#CALLBACK OPT
2030: 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20 4f  IONS">CALLBACK O
2040: 50 54 49 4f 4e 53 3c 2f 61 3e 20 66 6f 72 0a 20  PTIONS</a> for. 
2050: 20 20 20 20 20 20 20 20 20 20 20 66 75 72 74 68             furth
2060: 65 72 20 64 69 73 63 75 73 73 69 6f 6e 2e 3c 2f  er discussion.</
2070: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
2080: 3c 73 74 72 6f 6e 67 3e 2d 64 68 70 61 72 61 6d  <strong>-dhparam
2090: 73 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e 66  s </strong><em>f
20a0: 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74  ilename</em></dt
20b0: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72  >.        <dd>Pr
20c0: 6f 76 69 64 65 20 61 20 44 69 66 66 69 65 2d 48  ovide a Diffie-H
20d0: 65 6c 6c 6d 61 6e 20 70 61 72 61 6d 65 74 65 72  ellman parameter
20e0: 73 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20  s file.</dd>.   
20f0: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
2100: 3e 2d 6b 65 79 66 69 6c 65 3c 2f 73 74 72 6f 6e  >-keyfile</stron
2110: 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c  g> <em>filename<
2120: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
2130: 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68    <dd>Provide th
2140: 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 66 69  e private key fi
2150: 6c 65 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66  le. (<strong>def
2160: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 0a 20  ault</strong>:. 
2170: 20 20 20 20 20 20 20 20 20 20 20 76 61 6c 75 65             value
2180: 20 6f 66 20 2d 63 65 72 74 66 69 6c 65 29 3c 2f   of -certfile)</
2190: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
21a0: 3c 73 74 72 6f 6e 67 3e 2d 6b 65 79 3c 2f 73 74  <strong>-key</st
21b0: 72 6f 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61  rong> <em>filena
21c0: 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  me</em></dt>.   
21d0: 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65       <dd>Provide
21e0: 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79   the private key
21f0: 20 74 6f 20 75 73 65 20 61 73 20 61 20 44 45 52   to use as a DER
2200: 20 65 6e 63 6f 64 65 64 20 76 61 6c 75 65 20 28   encoded value (
2210: 50 4b 43 53 23 31 20 44 45 52 29 3c 2f 64 64 3e  PKCS#1 DER)</dd>
2220: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
2230: 72 6f 6e 67 3e 2d 6d 6f 64 65 6c 3c 2f 73 74 72  rong>-model</str
2240: 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c  ong> <em>channel
2250: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
2260: 20 20 20 3c 64 64 3e 54 68 69 73 20 77 69 6c 6c     <dd>This will
2270: 20 66 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e   force this chan
2280: 6e 65 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65  nel to share the
2290: 20 73 61 6d 65 20 3c 65 6d 3e 3c 73 74 72 6f 6e   same <em><stron
22a0: 67 3e 53 53 4c 5f 43 54 58 3c 2f 73 74 72 6f 6e  g>SSL_CTX</stron
22b0: 67 3e 3c 2f 65 6d 3e 0a 20 20 20 20 20 20 20 20  g></em>.        
22c0: 20 20 20 20 73 74 72 75 63 74 75 72 65 20 61 73      structure as
22d0: 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 3c   the specified <
22e0: 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 2c  em>channel</em>,
22f0: 20 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 20   and.           
2300: 20 74 68 65 72 65 66 6f 72 65 20 73 68 61 72 65   therefore share
2310: 20 63 61 6c 6c 62 61 63 6b 73 20 65 74 63 2e 3c   callbacks etc.<
2320: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
2330: 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 73 73 77 6f  ><strong>-passwo
2340: 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e  rd</strong> <em>
2350: 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f 64  callback</em></d
2360: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 49  t>.        <dd>I
2370: 66 20 73 75 70 70 6c 69 65 64 2c 20 74 68 69 73  f supplied, this
2380: 20 63 61 6c 6c 62 61 63 6b 20 77 69 6c 6c 20 62   callback will b
2390: 65 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 4f  e invoked when O
23a0: 70 65 6e 53 53 4c 20 6e 65 65 64 73 0a 20 20 20  penSSL needs.   
23b0: 20 20 20 20 20 20 20 20 20 74 6f 20 6f 62 74 61           to obta
23c0: 69 6e 20 61 20 70 61 73 73 77 6f 72 64 2c 20 74  in a password, t
23d0: 79 70 69 63 61 6c 6c 79 20 74 6f 20 75 6e 6c 6f  ypically to unlo
23e0: 63 6b 20 74 68 65 20 70 72 69 76 61 74 65 20 6b  ck the private k
23f0: 65 79 20 6f 66 0a 09 20 20 20 20 61 20 63 65 72  ey of..    a cer
2400: 74 69 66 69 63 61 74 65 2e 0a 20 20 20 20 20 20  tificate..      
2410: 20 20 20 20 20 20 54 68 65 20 63 61 6c 6c 62 61        The callba
2420: 63 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e  ck should return
2430: 20 61 20 73 74 72 69 6e 67 20 77 68 69 63 68 20   a string which 
2440: 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 0a 20  represents the. 
2450: 20 20 20 20 20 20 20 20 20 20 20 70 61 73 73 77             passw
2460: 6f 72 64 20 74 6f 20 62 65 20 75 73 65 64 2e 0a  ord to be used..
2470: 20 20 20 20 20 20 20 20 20 20 20 20 3c 62 72 3e              <br>
2480: 0a 20 20 20 20 20 20 20 20 20 20 20 20 53 65 65  .            See
2490: 20 3c 61 20 68 72 65 66 3d 22 23 43 41 4c 4c 42   <a href="#CALLB
24a0: 41 43 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c  ACK OPTIONS">CAL
24b0: 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61  LBACK OPTIONS</a
24c0: 3e 20 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20  > for.          
24d0: 20 20 66 75 72 74 68 65 72 20 64 69 73 63 75 73    further discus
24e0: 73 69 6f 6e 2e 3c 2f 64 64 3e 0a 20 20 20 20 20  sion.</dd>.     
24f0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
2500: 72 65 71 75 65 73 74 20 3c 2f 73 74 72 6f 6e 67  request </strong
2510: 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f  ><em>bool</em></
2520: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e  dt>.        <dd>
2530: 52 65 71 75 65 73 74 20 61 20 63 65 72 74 69 66  Request a certif
2540: 69 63 61 74 65 20 66 72 6f 6d 20 70 65 65 72 20  icate from peer 
2550: 64 75 72 69 6e 67 20 53 53 4c 20 68 61 6e 64 73  during SSL hands
2560: 68 61 6b 65 2e 0a 20 20 20 20 20 20 20 20 20 20  hake..          
2570: 20 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75    (<strong>defau
2580: 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d  lt</strong>: <em
2590: 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e  >true</em>)</dd>
25a0: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
25b0: 72 6f 6e 67 3e 2d 72 65 71 75 69 72 65 3c 2f 73  rong>-require</s
25c0: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c  trong> <em>bool<
25d0: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
25e0: 20 20 3c 64 64 3e 52 65 71 75 69 72 65 20 61 20    <dd>Require a 
25f0: 76 61 6c 69 64 20 63 65 72 74 69 66 69 63 61 74  valid certificat
2600: 65 20 66 72 6f 6d 20 70 65 65 72 20 64 75 72 69  e from peer duri
2610: 6e 67 20 53 53 4c 0a 20 20 20 20 20 20 20 20 20  ng SSL.         
2620: 20 20 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66     handshake. If
2630: 20 74 68 69 73 20 69 73 20 73 65 74 20 74 6f 20   this is set to 
2640: 74 72 75 65 20 74 68 65 6e 20 3c 73 74 72 6f 6e  true then <stron
2650: 67 3e 2d 72 65 71 75 65 73 74 3c 2f 73 74 72 6f  g>-request</stro
2660: 6e 67 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  ng>.            
2670: 6d 75 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74  must also be set
2680: 20 74 6f 20 74 72 75 65 2e 20 28 3c 73 74 72 6f   to true. (<stro
2690: 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f  ng>default</stro
26a0: 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f  ng>: <em>false</
26b0: 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20  em>)</dd>.      
26c0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73    <dt><strong>-s
26d0: 65 72 76 65 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c  erver</strong> <
26e0: 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74  em>bool</em></dt
26f0: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 48 61  >.        <dd>Ha
2700: 6e 64 73 68 61 6b 65 20 61 73 20 73 65 72 76 65  ndshake as serve
2710: 72 20 69 66 20 74 72 75 65 2c 20 65 6c 73 65 20  r if true, else 
2720: 68 61 6e 64 73 68 61 6b 65 20 61 73 0a 20 20 20  handshake as.   
2730: 20 20 20 20 20 20 20 20 20 63 6c 69 65 6e 74 2e           client.
2740: 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74  (<strong>default
2750: 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66  </strong>: <em>f
2760: 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a  alse</em>)</dd>.
2770: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72          <dt><str
2780: 6f 6e 67 3e 2d 73 65 72 76 65 72 6e 61 6d 65 3c  ong>-servername<
2790: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 68 6f 73  /strong> <em>hos
27a0: 74 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  t</em></dt>.    
27b0: 20 20 20 20 3c 64 64 3e 4f 6e 6c 79 20 61 76 61      <dd>Only ava
27c0: 69 6c 61 62 6c 65 20 69 66 20 74 68 65 20 4f 70  ilable if the Op
27d0: 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 20 74 68  enSSL library th
27e0: 65 20 70 61 63 6b 61 67 65 20 69 73 20 6c 69 6e  e package is lin
27f0: 6b 65 64 0a 09 20 20 20 20 61 67 61 69 6e 73 74  ked..    against
2800: 20 73 75 70 70 6f 72 74 73 20 74 68 65 20 54 4c   supports the TL
2810: 53 20 68 6f 73 74 6e 61 6d 65 20 65 78 74 65 6e  S hostname exten
2820: 73 69 6f 6e 20 66 6f 72 20 27 53 65 72 76 65 72  sion for 'Server
2830: 20 4e 61 6d 65 0a 09 20 20 20 20 49 6e 64 69 63   Name..    Indic
2840: 61 74 69 6f 6e 27 20 28 53 4e 49 29 2e 20 55 73  ation' (SNI). Us
2850: 65 20 74 6f 20 6e 61 6d 65 20 74 68 65 20 6c 6f  e to name the lo
2860: 67 69 63 61 6c 20 68 6f 73 74 20 77 65 20 61 72  gical host we ar
2870: 65 20 74 61 6c 6b 69 6e 67 0a 09 20 20 20 20 74  e talking..    t
2880: 6f 20 61 6e 64 20 65 78 70 65 63 74 69 6e 67 20  o and expecting 
2890: 61 20 63 65 72 74 69 66 69 63 61 74 65 20 66 6f  a certificate fo
28a0: 72 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  r</dd>.        <
28b0: 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73 73 6c 32  dt><strong>-ssl2
28c0: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f  </strong> <em>bo
28d0: 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  ol</em></dt>.   
28e0: 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20       <dd>Enable 
28f0: 75 73 65 20 6f 66 20 53 53 4c 20 76 32 2e 20 28  use of SSL v2. (
2900: 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c  <strong>default<
2910: 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61  /strong>: <em>fa
2920: 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20  lse</em>)</dd>. 
2930: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
2940: 6e 67 3e 2d 73 73 6c 33 20 3c 2f 73 74 72 6f 6e  ng>-ssl3 </stron
2950: 67 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c  g><em>bool</em><
2960: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
2970: 3e 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 53  >Enable use of S
2980: 53 4c 20 76 33 2e 20 28 3c 73 74 72 6f 6e 67 3e  SL v3. (<strong>
2990: 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e  default</strong>
29a0: 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e  : <em>false</em>
29b0: 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  )</dd>.        <
29c0: 64 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31  dt>-<strong>tls1
29d0: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f  </strong> <em>bo
29e0: 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  ol</em></dt>.   
29f0: 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20       <dd>Enable 
2a00: 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 20 28  use of TLS v1. (
2a10: 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c  <strong>default<
2a20: 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72  /strong>: <em>tr
2a30: 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20  ue</em>)</dd>.  
2a40: 20 20 20 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f        <dt>-<stro
2a50: 6e 67 3e 74 6c 73 31 2e 31 3c 2f 73 74 72 6f 6e  ng>tls1.1</stron
2a60: 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e  g> <em>bool</em>
2a70: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
2a80: 64 3e 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20  d>Enable use of 
2a90: 54 4c 53 20 76 31 2e 31 20 28 3c 73 74 72 6f 6e  TLS v1.1 (<stron
2aa0: 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e  g>default</stron
2ab0: 67 3e 3a 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d  g>: <em>true</em
2ac0: 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  >)</dd>.        
2ad0: 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73  <dt>-<strong>tls
2ae0: 31 2e 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  1.2</strong> <em
2af0: 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  >bool</em></dt>.
2b00: 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 62          <dd>Enab
2b10: 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31  le use of TLS v1
2b20: 2e 32 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61  .2 (<strong>defa
2b30: 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65  ult</strong>: <e
2b40: 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64  m>true</em>)</dd
2b50: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 2d 3c  >.        <dt>-<
2b60: 73 74 72 6f 6e 67 3e 74 6c 73 31 2e 33 3c 2f 73  strong>tls1.3</s
2b70: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c  trong> <em>bool<
2b80: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
2b90: 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65    <dd>Enable use
2ba0: 20 6f 66 20 54 4c 53 20 76 31 2e 33 20 28 3c 73   of TLS v1.3 (<s
2bb0: 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73  trong>default</s
2bc0: 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72 75 65  trong>: <em>true
2bd0: 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20  </em>)</dd>.    
2be0: 3c 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f  </dl>.</blockquo
2bf0: 74 65 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64  te>..<dl>.    <d
2c00: 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a  t><a name="tls::
2c10: 75 6e 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73  unimport"><b>tls
2c20: 3a 3a 75 6e 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c  ::unimport </b><
2c30: 69 3e 63 68 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61  i>channel</i></a
2c40: 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 50  ></dt>.    <dd>P
2c50: 72 6f 76 69 64 65 64 20 66 6f 72 20 73 79 6d 6d  rovided for symm
2c60: 65 74 72 79 20 74 6f 20 3c 73 74 72 6f 6e 67 3e  etry to <strong>
2c70: 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72  tls::import</str
2c80: 6f 6e 67 3e 2c 20 74 68 69 73 0a 20 20 20 20 20  ong>, this.     
2c90: 20 75 6e 73 74 61 63 6b 73 20 74 68 65 20 53 53   unstacks the SS
2ca0: 4c 2d 65 6e 61 62 6c 69 6e 67 20 6f 66 20 61 20  L-enabling of a 
2cb0: 72 65 67 75 6c 61 72 20 54 63 6c 20 63 68 61 6e  regular Tcl chan
2cc0: 6e 65 6c 2e 20 20 41 6e 20 65 72 72 6f 72 0a 20  nel.  An error. 
2cd0: 20 20 20 20 20 69 73 20 74 68 72 6f 77 6e 20 69       is thrown i
2ce0: 66 20 54 4c 53 20 69 73 20 6e 6f 74 20 74 68 65  f TLS is not the
2cf0: 20 74 6f 70 20 73 74 61 63 6b 65 64 20 63 68 61   top stacked cha
2d00: 6e 6e 65 6c 20 74 79 70 65 2e 3c 2f 64 64 3e 0a  nnel type.</dd>.
2d10: 3c 2f 64 6c 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20  </dl>..<dl>.    
2d20: 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73  <dt><a name="tls
2d30: 3a 3a 63 69 70 68 65 72 73 20 70 72 6f 74 6f 63  ::ciphers protoc
2d40: 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 22 3e 3c 73  ol ?verbose?"><s
2d50: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 69 70 68 65  trong>tls::ciphe
2d60: 72 73 3c 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20  rs</strong>.    
2d70: 20 20 20 20 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c      <em>protocol
2d80: 20 3f 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c   ?verbose?</em><
2d90: 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64  /a></dt>.    <dd
2da0: 3e 52 65 74 75 72 6e 73 20 6c 69 73 74 20 6f 66  >Returns list of
2db0: 20 73 75 70 70 6f 72 74 65 64 20 63 69 70 68 65   supported ciphe
2dc0: 72 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20  rs based on the 
2dd0: 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 3c 2f 65 6d  <em>protocol</em
2de0: 3e 0a 20 20 20 20 20 20 20 20 79 6f 75 20 73 75  >.        you su
2df0: 70 70 6c 79 2c 20 77 68 69 63 68 20 6d 75 73 74  pply, which must
2e00: 20 62 65 20 6f 6e 65 20 6f 66 20 3c 65 6d 3e 73   be one of <em>s
2e10: 73 6c 32 2c 20 73 73 6c 33 2c 20 6f 72 20 74 6c  sl2, ssl3, or tl
2e20: 73 31 3c 2f 65 6d 3e 2e 0a 20 20 20 20 20 20 20  s1</em>..       
2e30: 20 49 66 20 3c 65 6d 3e 76 65 72 62 6f 73 65 3c   If <em>verbose<
2e40: 2f 65 6d 3e 20 69 73 20 73 70 65 63 69 66 69 65  /em> is specifie
2e50: 64 20 61 73 20 74 72 75 65 20 74 68 65 6e 20 61  d as true then a
2e60: 20 76 65 72 62 6f 73 65 2c 0a 20 20 20 20 20 20   verbose,.      
2e70: 20 20 73 65 6d 69 2d 68 75 6d 61 6e 20 72 65 61    semi-human rea
2e80: 64 61 62 6c 65 20 6c 69 73 74 20 69 73 20 72 65  dable list is re
2e90: 74 75 72 6e 65 64 20 70 72 6f 76 69 64 69 6e 67  turned providing
2ea0: 20 61 64 64 69 74 69 6f 6e 61 6c 0a 20 20 20 20   additional.    
2eb0: 20 20 20 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20      information 
2ec0: 6f 6e 20 74 68 65 20 6e 61 74 75 72 65 20 6f 66  on the nature of
2ed0: 20 74 68 65 20 63 69 70 68 65 72 20 73 75 70 70   the cipher supp
2ee0: 6f 72 74 2e 20 49 6e 20 65 61 63 68 0a 20 20 20  ort. In each.   
2ef0: 20 20 20 20 20 63 61 73 65 20 74 68 65 20 72 65       case the re
2f00: 73 75 6c 74 20 69 73 20 61 20 54 63 6c 20 6c 69  sult is a Tcl li
2f10: 73 74 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a  st.</dd>.</dl>..
2f20: 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20  <dl>.    <dt><a 
2f30: 6e 61 6d 65 3d 22 74 6c 73 3a 3a 76 65 72 73 69  name="tls::versi
2f40: 6f 6e 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a  on"><strong>tls:
2f50: 3a 76 65 72 73 69 6f 6e 3c 2f 73 74 72 6f 6e 67  :version</strong
2f60: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c  ></a></dt>.    <
2f70: 64 64 3e 52 65 74 75 72 6e 73 20 74 68 65 20 76  dd>Returns the v
2f80: 65 72 73 69 6f 6e 20 73 74 72 69 6e 67 20 64 65  ersion string de
2f90: 66 69 6e 65 64 20 62 79 20 4f 70 65 6e 53 53 4c  fined by OpenSSL
2fa0: 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 68  .</dd>.</dl>..<h
2fb0: 33 3e 3c 61 20 6e 61 6d 65 3d 22 43 41 4c 4c 42  3><a name="CALLB
2fc0: 41 43 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c  ACK OPTIONS">CAL
2fd0: 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61  LBACK OPTIONS</a
2fe0: 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 0a 41 73 20 69  ></h3>..<p>.As i
2ff0: 6e 64 69 63 61 74 65 64 20 61 62 6f 76 65 2c 20  ndicated above, 
3000: 69 6e 64 69 76 69 64 75 61 6c 20 63 68 61 6e 6e  individual chann
3010: 65 6c 73 20 63 61 6e 20 62 65 20 67 69 76 65 6e  els can be given
3020: 20 74 68 65 69 72 20 6f 77 6e 20 63 61 6c 6c 62   their own callb
3030: 61 63 6b 73 0a 74 6f 20 68 61 6e 64 6c 65 20 69  acks.to handle i
3040: 6e 74 65 72 6d 65 64 69 61 74 65 20 70 72 6f 63  ntermediate proc
3050: 65 73 73 69 6e 67 20 62 79 20 74 68 65 20 4f 70  essing by the Op
3060: 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 2c 20 75  enSSL library, u
3070: 73 69 6e 67 20 74 68 65 0a 3c 65 6d 3e 2d 63 6f  sing the.<em>-co
3080: 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20 3c  mmand</em> and <
3090: 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d  em>-password</em
30a0: 3e 20 6f 70 74 69 6f 6e 73 20 70 61 73 73 65 64  > options passed
30b0: 20 74 6f 20 65 69 74 68 65 72 20 6f 66 0a 3c 73   to either of.<s
30c0: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65  trong>tls::socke
30d0: 74 3c 2f 73 74 72 6f 6e 67 3e 20 6f 72 20 3c 73  t</strong> or <s
30e0: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72  trong>tls::impor
30f0: 74 3c 2f 73 74 72 6f 6e 67 3e 2e 0a 3c 2f 70 3e  t</strong>..</p>
3100: 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c  ..<blockquote>.<
3110: 64 6c 3e 0a 0a 20 20 20 20 3c 64 74 3e 3c 73 74  dl>..    <dt><st
3120: 72 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73  rong>-command</s
3130: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62  trong> <em>callb
3140: 61 63 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ack</em></dt>.  
3150: 20 20 3c 64 64 3e 0a 09 49 6e 76 6f 6b 65 73 20    <dd>..Invokes 
3160: 74 68 65 20 73 70 65 63 69 66 69 65 64 20 3c 65  the specified <e
3170: 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 20  m>callback</em> 
3180: 73 63 72 69 70 74 20 61 74 0a 09 73 65 76 65 72  script at..sever
3190: 61 6c 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67  al points during
31a0: 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 68 61 6e   the OpenSSL han
31b0: 64 73 68 61 6b 65 2e 0a 09 45 78 63 65 70 74 20  dshake...Except 
31c0: 61 73 20 69 6e 64 69 63 61 74 65 64 20 62 65 6c  as indicated bel
31d0: 6f 77 2c 20 76 61 6c 75 65 73 20 72 65 74 75 72  ow, values retur
31e0: 6e 65 64 20 66 72 6f 6d 20 74 68 65 0a 09 63 61  ned from the..ca
31f0: 6c 6c 62 61 63 6b 20 61 72 65 20 69 67 6e 6f 72  llback are ignor
3200: 65 64 2e 0a 09 41 72 67 75 6d 65 6e 74 73 20 61  ed...Arguments a
3210: 70 70 65 6e 64 65 64 20 74 6f 20 74 68 65 20 73  ppended to the s
3220: 63 72 69 70 74 20 75 70 6f 6e 20 63 61 6c 6c 62  cript upon callb
3230: 61 63 6b 20 74 61 6b 65 20 6f 6e 65 20 6f 66 20  ack take one of 
3240: 74 68 65 0a 09 66 6f 6c 6c 6f 77 69 6e 67 20 66  the..following f
3250: 6f 72 6d 73 3a 0a 0a 09 3c 62 72 3e 0a 09 3c 62  orms:...<br>..<b
3260: 72 3e 0a 0a 09 3c 64 6c 3e 0a 0a 3c 21 2d 2d 09  r>...<dl>..<!--.
3270: 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c  This form of cal
3280: 6c 62 61 63 6b 20 69 73 20 64 69 73 61 62 6c 65  lback is disable
3290: 64 2e 0a 0a 09 3c 64 74 3e 0a 09 20 20 3c 73 74  d....<dt>..  <st
32a0: 72 6f 6e 67 3e 65 72 72 6f 72 3c 2f 73 74 72 6f  rong>error</stro
32b0: 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 20  ng> <em>channel 
32c0: 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f  message</em>..</
32d0: 64 74 3e 0a 09 3c 64 64 3e 0a 09 20 20 54 68 65  dt>..<dd>..  The
32e0: 20 3c 65 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d   <em>message</em
32f0: 3e 20 61 72 67 75 6d 65 6e 74 20 63 6f 6e 74 61  > argument conta
3300: 69 6e 73 20 61 6e 20 65 72 72 6f 72 20 6d 65 73  ins an error mes
3310: 73 61 67 65 20 67 65 6e 65 72 61 74 65 64 0a 09  sage generated..
3320: 20 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c    by the OpenSSL
3330: 20 66 75 6e 63 74 69 6f 6e 0a 09 20 20 3c 63 6f   function..  <co
3340: 64 65 3e 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72  de>ERR_reason_er
3350: 72 6f 72 5f 73 74 72 69 6e 67 28 29 3c 2f 63 6f  ror_string()</co
3360: 64 65 3e 2e 0a 09 3c 2f 64 64 3e 0a 0a 09 3c 62  de>...</dd>...<b
3370: 72 3e 0a 2d 2d 3e 0a 0a 09 3c 64 74 3e 0a 09 20  r>.-->...<dt>.. 
3380: 20 3c 73 74 72 6f 6e 67 3e 69 6e 66 6f 3c 2f 73   <strong>info</s
3390: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e  trong> <em>chann
33a0: 65 6c 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d  el major minor m
33b0: 65 73 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f 64  essage</em>..</d
33c0: 74 3e 0a 09 3c 64 64 3e 0a 09 20 20 54 68 69 73  t>..<dd>..  This
33d0: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63   form of callbac
33e0: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20  k is invoked by 
33f0: 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63  the OpenSSL func
3400: 74 69 6f 6e 0a 09 20 20 3c 63 6f 64 65 3e 53 53  tion..  <code>SS
3410: 4c 5f 43 54 58 5f 73 65 74 5f 69 6e 66 6f 5f 63  L_CTX_set_info_c
3420: 61 6c 6c 62 61 63 6b 28 29 3c 2f 63 6f 64 65 3e  allback()</code>
3430: 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65  ...  <br>..  The
3440: 20 3c 65 6d 3e 6d 61 6a 6f 72 3c 2f 65 6d 3e 20   <em>major</em> 
3450: 61 6e 64 20 3c 65 6d 3e 6d 69 6e 6f 72 3c 2f 65  and <em>minor</e
3460: 6d 3e 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65  m> arguments are
3470: 20 75 73 65 64 20 74 6f 0a 09 20 20 72 65 70 72   used to..  repr
3480: 65 73 65 6e 74 20 74 68 65 20 73 74 61 74 65 20  esent the state 
3490: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 62 69 74 6d  information bitm
34a0: 61 73 6b 2e 0a 09 20 20 3c 64 6c 3e 0a 09 20 20  ask...  <dl>..  
34b0: 3c 64 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c  <dt>Possible val
34c0: 75 65 73 20 66 6f 72 20 3c 65 6d 3e 6d 61 6a 6f  ues for <em>majo
34d0: 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e  r</em> are:</dt>
34e0: 0a 09 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 68 61  ..  <dd><code>ha
34f0: 6e 64 73 68 61 6b 65 2c 20 61 6c 65 72 74 2c 20  ndshake, alert, 
3500: 63 6f 6e 6e 65 63 74 2c 20 61 63 63 65 70 74 3c  connect, accept<
3510: 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a 09 20 20  /code>.</dd>..  
3520: 3c 64 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c  <dt>Possible val
3530: 75 65 73 20 66 6f 72 20 3c 65 6d 3e 6d 69 6e 6f  ues for <em>mino
3540: 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e  r</em> are:</dt>
3550: 0a 09 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 73 74  ..  <dd><code>st
3560: 61 72 74 2c 20 64 6f 6e 65 2c 20 72 65 61 64 2c  art, done, read,
3570: 20 77 72 69 74 65 2c 20 6c 6f 6f 70 2c 20 65 78   write, loop, ex
3580: 69 74 3c 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a  it</code>.</dd>.
3590: 09 20 20 3c 2f 64 6c 3e 0a 09 20 20 54 68 65 20  .  </dl>..  The 
35a0: 3c 65 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d 3e  <em>message</em>
35b0: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20 64   argument is a d
35c0: 65 73 63 72 69 70 74 69 76 65 20 73 74 72 69 6e  escriptive strin
35d0: 67 20 77 68 69 63 68 20 6d 61 79 0a 09 20 20 62  g which may..  b
35e0: 65 20 67 65 6e 65 72 61 74 65 64 20 65 69 74 68  e generated eith
35f0: 65 72 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53  er by..  <code>S
3600: 53 4c 5f 73 74 61 74 65 5f 73 74 72 69 6e 67 5f  SL_state_string_
3610: 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e 20 6f 72  long()</code> or
3620: 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c   by..  <code>SSL
3630: 5f 61 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69  _alert_desc_stri
3640: 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e  ng_long()</code>
3650: 2c 0a 09 20 20 64 65 70 65 6e 64 69 6e 67 20 6f  ,..  depending o
3660: 6e 20 63 6f 6e 74 65 78 74 2e 0a 09 3c 2f 64 64  n context...</dd
3670: 3e 0a 0a 09 3c 62 72 3e 0a 0a 09 3c 64 74 3e 0a  >...<br>...<dt>.
3680: 09 20 20 3c 73 74 72 6f 6e 67 3e 76 65 72 69 66  .  <strong>verif
3690: 79 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63  y</strong> <em>c
36a0: 68 61 6e 6e 65 6c 20 64 65 70 74 68 20 63 65 72  hannel depth cer
36b0: 74 20 73 74 61 74 75 73 20 65 72 72 6f 72 3c 2f  t status error</
36c0: 65 6d 3e 0a 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e  em>..</dt>..<dd>
36d0: 0a 09 20 20 54 68 69 73 20 66 6f 72 6d 20 6f 66  ..  This form of
36e0: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76   callback is inv
36f0: 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e  oked by the Open
3700: 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 09 20 20  SSL function..  
3710: 3c 63 6f 64 65 3e 53 53 4c 5f 73 65 74 5f 76 65  <code>SSL_set_ve
3720: 72 69 66 79 28 29 3c 2f 63 6f 64 65 3e 2e 0a 09  rify()</code>...
3730: 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65    <br>..  The <e
3740: 6d 3e 64 65 70 74 68 3c 2f 65 6d 3e 20 61 72 67  m>depth</em> arg
3750: 75 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e 74 65  ument is an inte
3760: 67 65 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67  ger representing
3770: 20 74 68 65 0a 09 20 20 63 75 72 72 65 6e 74 20   the..  current 
3780: 64 65 70 74 68 20 6f 6e 20 74 68 65 20 63 65 72  depth on the cer
3790: 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 2c 20  tificate chain, 
37a0: 77 69 74 68 0a 09 20 20 3c 63 6f 64 65 3e 30 3c  with..  <code>0<
37b0: 2f 63 6f 64 65 3e 20 61 73 20 74 68 65 20 73 75  /code> as the su
37c0: 62 6a 65 63 74 20 63 65 72 74 69 66 69 63 61 74  bject certificat
37d0: 65 20 61 6e 64 20 68 69 67 68 65 72 20 76 61 6c  e and higher val
37e0: 75 65 73 0a 09 20 20 64 65 6e 6f 74 69 6e 67 20  ues..  denoting 
37f0: 70 72 6f 67 72 65 73 73 69 76 65 6c 79 20 6d 6f  progressively mo
3800: 72 65 20 69 6e 64 69 72 65 63 74 20 69 73 73 75  re indirect issu
3810: 65 72 20 63 65 72 74 69 66 69 63 61 74 65 73 2e  er certificates.
3820: 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20  ..  <br>..  The 
3830: 3c 65 6d 3e 63 65 72 74 3c 2f 65 6d 3e 20 61 72  <em>cert</em> ar
3840: 67 75 6d 65 6e 74 20 69 73 20 61 20 6c 69 73 74  gument is a list
3850: 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61   of key-value pa
3860: 69 72 73 20 73 69 6d 69 6c 61 72 0a 09 20 20 74  irs similar..  t
3870: 6f 20 74 68 6f 73 65 20 72 65 74 75 72 6e 65 64  o those returned
3880: 20 62 79 0a 09 20 20 3c 61 20 68 72 65 66 3d 22   by..  <a href="
3890: 23 74 6c 73 3a 3a 73 74 61 74 75 73 22 3e 3c 73  #tls::status"><s
38a0: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 74 61 74 75  trong>tls::statu
38b0: 73 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 2e 0a  s</strong></a>..
38c0: 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c  .  <br>..  The <
38d0: 65 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20 61  em>status</em> a
38e0: 72 67 75 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e  rgument is an in
38f0: 74 65 67 65 72 20 72 65 70 72 65 73 65 6e 74 69  teger representi
3900: 6e 67 20 74 68 65 0a 09 20 20 63 75 72 72 65 6e  ng the..  curren
3910: 74 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68  t validity of th
3920: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 09  e certificate...
3930: 20 20 41 20 76 61 6c 75 65 20 6f 66 20 3c 63 6f    A value of <co
3940: 64 65 3e 30 3c 2f 63 6f 64 65 3e 20 6d 65 61 6e  de>0</code> mean
3950: 73 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74  s the certificat
3960: 65 20 69 73 20 64 65 65 6d 65 64 20 69 6e 76 61  e is deemed inva
3970: 6c 69 64 2e 0a 09 20 20 41 20 76 61 6c 75 65 20  lid...  A value 
3980: 6f 66 20 3c 63 6f 64 65 3e 31 3c 2f 63 6f 64 65  of <code>1</code
3990: 3e 20 6d 65 61 6e 73 20 74 68 65 20 63 65 72 74  > means the cert
39a0: 69 66 69 63 61 74 65 20 69 73 20 64 65 65 6d 65  ificate is deeme
39b0: 64 20 76 61 6c 69 64 2e 0a 09 20 20 3c 62 72 3e  d valid...  <br>
39c0: 0a 09 20 20 54 68 65 20 3c 65 6d 3e 65 72 72 6f  ..  The <em>erro
39d0: 72 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20  r</em> argument 
39e0: 73 75 70 70 6c 69 65 73 20 74 68 65 20 6d 65 73  supplies the mes
39f0: 73 61 67 65 2c 20 69 66 20 61 6e 79 2c 20 67 65  sage, if any, ge
3a00: 6e 65 72 61 74 65 64 0a 09 20 20 62 79 0a 09 20  nerated..  by.. 
3a10: 20 3c 63 6f 64 65 3e 58 35 30 39 5f 53 54 4f 52   <code>X509_STOR
3a20: 45 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28  E_CTX_get_error(
3a30: 29 3c 2f 63 6f 64 65 3e 2e 0a 09 20 20 3c 62 72  )</code>...  <br
3a40: 3e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65  >..  <br>..  The
3a50: 20 63 61 6c 6c 62 61 63 6b 20 6d 61 79 20 6f 76   callback may ov
3a60: 65 72 72 69 64 65 20 6e 6f 72 6d 61 6c 20 76 61  erride normal va
3a70: 6c 69 64 61 74 69 6f 6e 20 70 72 6f 63 65 73 73  lidation process
3a80: 69 6e 67 20 62 79 20 65 78 70 6c 69 63 69 74 6c  ing by explicitl
3a90: 79 0a 09 20 20 72 65 74 75 72 6e 69 6e 67 20 6f  y..  returning o
3aa0: 6e 65 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20  ne of the above 
3ab0: 3c 65 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20  <em>status</em> 
3ac0: 76 61 6c 75 65 73 2e 0a 09 3c 2f 64 64 3e 0a 0a  values...</dd>..
3ad0: 09 3c 2f 64 6c 3e 0a 20 20 20 20 3c 2f 64 64 3e  .</dl>.    </dd>
3ae0: 0a 0a 20 20 20 20 3c 62 72 3e 0a 0a 20 20 20 20  ..    <br>..    
3af0: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 73  <dt><strong>-pas
3b00: 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c  sword</strong> <
3b10: 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e  em>callback</em>
3b20: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 0a 09  </dt>.    <dd>..
3b30: 49 6e 76 6f 6b 65 73 20 74 68 65 20 73 70 65 63  Invokes the spec
3b40: 69 66 69 65 64 20 3c 65 6d 3e 63 61 6c 6c 62 61  ified <em>callba
3b50: 63 6b 3c 2f 65 6d 3e 20 73 63 72 69 70 74 20 77  ck</em> script w
3b60: 68 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64  hen OpenSSL need
3b70: 73 20 74 6f 0a 09 6f 62 74 61 69 6e 20 61 20 70  s to..obtain a p
3b80: 61 73 73 77 6f 72 64 2e 20 20 54 68 65 20 63 61  assword.  The ca
3b90: 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65  llback should re
3ba0: 74 75 72 6e 20 61 20 73 74 72 69 6e 67 20 77 68  turn a string wh
3bb0: 69 63 68 0a 09 72 65 70 72 65 73 65 6e 74 73 20  ich..represents 
3bc0: 74 68 65 20 70 61 73 73 77 6f 72 64 20 74 6f 20  the password to 
3bd0: 62 65 20 75 73 65 64 2e 0a 09 4e 6f 20 61 72 67  be used...No arg
3be0: 75 6d 65 6e 74 73 20 61 72 65 20 61 70 70 65 6e  uments are appen
3bf0: 64 65 64 20 74 6f 20 74 68 65 20 73 63 72 69 70  ded to the scrip
3c00: 74 20 75 70 6f 6e 20 63 61 6c 6c 62 61 63 6b 2e  t upon callback.
3c10: 0a 20 20 20 20 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e  .    </dd>.</dl>
3c20: 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a  .</blockquote>..
3c30: 3c 70 3e 0a 52 65 66 65 72 65 6e 63 65 20 69 6d  <p>.Reference im
3c40: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66  plementations of
3c50: 20 74 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73   these callbacks
3c60: 20 61 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e   are provided in
3c70: 20 74 68 65 0a 64 69 73 74 72 69 62 75 74 69 6f   the.distributio
3c80: 6e 20 61 73 20 3c 73 74 72 6f 6e 67 3e 74 6c 73  n as <strong>tls
3c90: 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73 74 72 6f  ::callback</stro
3ca0: 6e 67 3e 20 61 6e 64 0a 3c 73 74 72 6f 6e 67 3e  ng> and.<strong>
3cb0: 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73  tls::password</s
3cc0: 74 72 6f 6e 67 3e 20 72 65 73 70 65 63 74 69 76  trong> respectiv
3cd0: 65 6c 79 2e 20 20 4e 6f 74 65 20 74 68 61 74 20  ely.  Note that 
3ce0: 74 68 65 73 65 20 61 72 65 0a 3c 65 6d 3e 73 61  these are.<em>sa
3cf0: 6d 70 6c 65 3c 2f 65 6d 3e 20 69 6d 70 6c 65 6d  mple</em> implem
3d00: 65 6e 74 61 74 69 6f 6e 73 20 6f 6e 6c 79 2e 20  entations only. 
3d10: 20 49 6e 20 61 20 6d 6f 72 65 20 72 65 61 6c 69   In a more reali
3d20: 73 74 69 63 20 64 65 70 6c 6f 79 6d 65 6e 74 0a  stic deployment.
3d30: 79 6f 75 20 77 6f 75 6c 64 20 73 70 65 63 69 66  you would specif
3d40: 79 20 79 6f 75 72 20 6f 77 6e 20 63 61 6c 6c 62  y your own callb
3d50: 61 63 6b 20 73 63 72 69 70 74 73 20 6f 6e 20 65  ack scripts on e
3d60: 61 63 68 20 54 4c 53 20 63 68 61 6e 6e 65 6c 0a  ach TLS channel.
3d70: 75 73 69 6e 67 20 74 68 65 20 3c 65 6d 3e 2d 63  using the <em>-c
3d80: 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20  ommand</em> and 
3d90: 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65  <em>-password</e
3da0: 6d 3e 20 6f 70 74 69 6f 6e 73 2e 0a 3c 2f 70 3e  m> options..</p>
3db0: 0a 0a 3c 70 3e 0a 54 68 65 20 64 65 66 61 75 6c  ..<p>.The defaul
3dc0: 74 20 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20  t behavior when 
3dd0: 74 68 65 20 3c 65 6d 3e 2d 63 6f 6d 6d 61 6e 64  the <em>-command
3de0: 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 20 69 73 20  </em> option is 
3df0: 6e 6f 74 20 73 70 65 63 69 66 69 65 64 20 69 73  not specified is
3e00: 20 66 6f 72 0a 54 4c 53 20 74 6f 20 70 72 6f 63   for.TLS to proc
3e10: 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61 74  ess the associat
3e20: 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62  ed library callb
3e30: 61 63 6b 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2e  acks internally.
3e40: 0a 54 68 65 20 64 65 66 61 75 6c 74 20 62 65 68  .The default beh
3e50: 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65 20 3c  avior when the <
3e60: 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d  em>-password</em
3e70: 3e 20 6f 70 74 69 6f 6e 20 69 73 20 6e 6f 74 20  > option is not 
3e80: 73 70 65 63 69 66 69 65 64 20 69 73 20 66 6f 72  specified is for
3e90: 0a 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20  .TLS to process 
3ea0: 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c  the associated l
3eb0: 69 62 72 61 72 79 20 63 61 6c 6c 62 61 63 6b 73  ibrary callbacks
3ec0: 20 62 79 20 61 74 74 65 6d 70 74 69 6e 67 20 74   by attempting t
3ed0: 6f 20 63 61 6c 6c 0a 3c 73 74 72 6f 6e 67 3e 74  o call.<strong>t
3ee0: 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74  ls::password</st
3ef0: 72 6f 6e 67 3e 2e 0a 54 68 65 20 64 69 66 66 65  rong>..The diffe
3f00: 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68  rence between th
3f10: 65 73 65 20 74 77 6f 20 62 65 68 61 76 69 6f 72  ese two behavior
3f20: 73 20 69 73 20 61 20 63 6f 6e 73 65 71 75 65 6e  s is a consequen
3f30: 63 65 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e  ce of maintainin
3f40: 67 0a 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20  g.compatibility 
3f50: 77 69 74 68 20 65 61 72 6c 69 65 72 20 69 6d 70  with earlier imp
3f60: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a 3c 2f  lementations..</
3f70: 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20 3c 73 74 72  p>..<p>.The <str
3f80: 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f  ong>tls::debug</
3f90: 73 74 72 6f 6e 67 3e 20 76 61 72 69 61 62 6c 65  strong> variable
3fa0: 20 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61   provides some a
3fb0: 64 64 69 74 69 6f 6e 61 6c 0a 63 6f 6e 74 72 6f  dditional.contro
3fc0: 6c 20 6f 76 65 72 20 74 68 65 73 65 20 72 65 66  l over these ref
3fd0: 65 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73  erence callbacks
3fe0: 2e 20 20 49 74 73 20 76 61 6c 75 65 20 69 73 20  .  Its value is 
3ff0: 7a 65 72 6f 20 62 79 20 64 65 66 61 75 6c 74 2e  zero by default.
4000: 0a 48 69 67 68 65 72 20 76 61 6c 75 65 73 20 70  .Higher values p
4010: 72 6f 64 75 63 65 20 6d 6f 72 65 20 64 69 61 67  roduce more diag
4020: 6e 6f 73 74 69 63 20 6f 75 74 70 75 74 2c 20 61  nostic output, a
4030: 6e 64 20 77 69 6c 6c 20 61 6c 73 6f 20 66 6f 72  nd will also for
4040: 63 65 20 74 68 65 0a 76 65 72 69 66 79 20 6d 65  ce the.verify me
4050: 74 68 6f 64 20 69 6e 20 3c 73 74 72 6f 6e 67 3e  thod in <strong>
4060: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73  tls::callback</s
4070: 74 72 6f 6e 67 3e 20 74 6f 20 61 63 63 65 70 74  trong> to accept
4080: 20 74 68 65 0a 63 65 72 74 69 66 69 63 61 74 65   the.certificate
4090: 2c 20 65 76 65 6e 20 77 68 65 6e 20 69 74 20 69  , even when it i
40a0: 73 20 69 6e 76 61 6c 69 64 2e 0a 3c 2f 70 3e 0a  s invalid..</p>.
40b0: 0a 3c 70 3e 0a 3c 65 6d 3e 0a 54 68 65 20 75 73  .<p>.<em>.The us
40c0: 65 20 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e  e of the referen
40d0: 63 65 20 63 61 6c 6c 62 61 63 6b 73 20 3c 73 74  ce callbacks <st
40e0: 72 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61  rong>tls::callba
40f0: 63 6b 3c 2f 73 74 72 6f 6e 67 3e 20 61 6e 64 0a  ck</strong> and.
4100: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 70 61 73  <strong>tls::pas
4110: 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 69  sword</strong> i
4120: 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65  s not recommende
4130: 64 2e 20 20 54 68 65 79 20 6d 61 79 20 62 65 20  d.  They may be 
4140: 72 65 6d 6f 76 65 64 0a 66 72 6f 6d 20 66 75 74  removed.from fut
4150: 75 72 65 20 72 65 6c 65 61 73 65 73 2e 0a 3c 2f  ure releases..</
4160: 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 70 3e 0a 3c 65  em>.</p>..<p>.<e
4170: 6d 3e 0a 54 68 65 20 75 73 65 20 6f 66 20 74 68  m>.The use of th
4180: 65 20 76 61 72 69 61 62 6c 65 20 3c 73 74 72 6f  e variable <stro
4190: 6e 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f 73  ng>tls::debug</s
41a0: 74 72 6f 6e 67 3e 20 69 73 20 6e 6f 74 20 72 65  trong> is not re
41b0: 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49 74 20 6d 61  commended..It ma
41c0: 79 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f  y be removed fro
41d0: 6d 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65  m future release
41e0: 73 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c  s..</em>.</p>..<
41f0: 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 48 54 54 50  h3><a name="HTTP
4200: 53 20 45 58 41 4d 50 4c 45 22 3e 48 54 54 50 53  S EXAMPLE">HTTPS
4210: 20 45 58 41 4d 50 4c 45 3c 2f 61 3e 3c 2f 68 33   EXAMPLE</a></h3
4220: 3e 0a 0a 3c 70 3e 54 68 69 73 20 65 78 61 6d 70  >..<p>This examp
4230: 6c 65 20 75 73 65 73 20 61 20 73 61 6d 70 6c 65  le uses a sample
4240: 20 73 65 72 76 65 72 2e 70 65 6d 20 70 72 6f 76   server.pem prov
4250: 69 64 65 64 20 77 69 74 68 20 74 68 65 20 54 4c  ided with the TL
4260: 53 20 72 65 6c 65 61 73 65 2c 0a 63 6f 75 72 74  S release,.court
4270: 65 73 79 20 6f 66 20 74 68 65 20 3c 73 74 72 6f  esy of the <stro
4280: 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72 6f  ng>OpenSSL</stro
4290: 6e 67 3e 20 70 72 6f 6a 65 63 74 2e 3c 2f 70 3e  ng> project.</p>
42a0: 0a 0a 3c 70 72 65 3e 3c 63 6f 64 65 3e 0a 70 61  ..<pre><code>.pa
42b0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 68 74  ckage require ht
42c0: 74 70 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69  tp.package requi
42d0: 72 65 20 74 6c 73 0a 0a 68 74 74 70 3a 3a 72 65  re tls..http::re
42e0: 67 69 73 74 65 72 20 68 74 74 70 73 20 34 34 33  gister https 443
42f0: 20 5b 6c 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f   [list ::tls::so
4300: 63 6b 65 74 20 2d 61 75 74 6f 73 65 72 76 65 72  cket -autoserver
4310: 6e 61 6d 65 20 74 72 75 65 20 2d 72 65 71 75 69  name true -requi
4320: 72 65 20 74 72 75 65 20 2d 63 61 64 69 72 20 2f  re true -cadir /
4330: 65 74 63 2f 73 73 6c 2f 63 65 72 74 73 5d 0a 0a  etc/ssl/certs]..
4340: 73 65 74 20 74 6f 6b 20 5b 68 74 74 70 3a 3a 67  set tok [http::g
4350: 65 74 75 72 6c 20 68 74 74 70 73 3a 2f 2f 77 77  eturl https://ww
4360: 77 2e 74 63 6c 2e 74 6b 2f 5d 0a 3c 2f 63 6f 64  w.tcl.tk/].</cod
4370: 65 3e 3c 2f 70 72 65 3e 0a 0a 3c 68 33 3e 3c 61  e></pre>..<h3><a
4380: 20 6e 61 6d 65 3d 22 53 50 45 43 49 41 4c 20 43   name="SPECIAL C
4390: 4f 4e 53 49 44 45 52 41 54 49 4f 4e 53 22 3e 53  ONSIDERATIONS">S
43a0: 50 45 43 49 41 4c 20 43 4f 4e 53 49 44 45 52 41  PECIAL CONSIDERA
43b0: 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a  TIONS</a></h3>..
43c0: 3c 70 3e 54 68 65 20 63 61 70 61 62 69 6c 69 74  <p>The capabilit
43d0: 69 65 73 20 6f 66 20 74 68 69 73 20 70 61 63 6b  ies of this pack
43e0: 61 67 65 20 63 61 6e 20 76 61 72 79 20 65 6e 6f  age can vary eno
43f0: 72 6d 6f 75 73 6c 79 20 62 61 73 65 64 0a 75 70  rmously based.up
4400: 6f 6e 20 68 6f 77 20 79 6f 75 72 20 4f 70 65 6e  on how your Open
4410: 53 53 4c 20 6c 69 62 72 61 72 79 20 77 61 73 20  SSL library was 
4420: 63 6f 6e 66 69 67 75 72 65 64 20 61 6e 64 20 62  configured and b
4430: 75 69 6c 74 2e 20 41 74 20 74 68 65 0a 6d 6f 73  uilt. At the.mos
4440: 74 20 6d 61 63 72 6f 2d 6c 65 76 65 6c 20 4f 70  t macro-level Op
4450: 65 6e 53 53 4c 20 73 75 70 70 6f 72 74 73 20 61  enSSL supports a
4460: 20 26 71 75 6f 74 3b 6e 6f 20 70 61 74 65 6e 74   &quot;no patent
4470: 73 26 71 75 6f 74 3b 20 62 75 69 6c 64 2c 0a 77  s&quot; build,.w
4480: 68 69 63 68 20 64 69 73 61 62 6c 65 73 20 52 53  hich disables RS
4490: 41 2c 20 49 44 45 41 2c 20 52 43 28 32 2c 34 2c  A, IDEA, RC(2,4,
44a0: 35 29 20 61 6e 64 20 53 53 4c 32 20 2d 20 69 66  5) and SSL2 - if
44b0: 20 79 6f 75 72 20 4f 70 65 6e 53 53 4c 20 69 73   your OpenSSL is
44c0: 0a 63 6f 6e 66 69 67 75 72 65 64 20 74 68 69 73  .configured this
44d0: 20 77 61 79 20 74 68 65 6e 20 79 6f 75 20 77 69   way then you wi
44e0: 6c 6c 20 6e 65 65 64 20 74 6f 20 62 75 69 6c 64  ll need to build
44f0: 20 54 4c 53 20 77 69 74 68 20 74 68 65 0a 2d 44   TLS with the.-D
4500: 4e 4f 5f 50 41 54 45 4e 54 53 20 6f 70 74 69 6f  NO_PATENTS optio
4510: 6e 20 2d 20 61 6e 64 20 74 68 65 20 72 65 73 75  n - and the resu
4520: 6c 74 61 6e 74 20 6d 6f 64 75 6c 65 20 77 69 6c  ltant module wil
4530: 6c 20 66 75 6e 63 74 69 6f 6e 0a 63 6f 72 72 65  l function.corre
4540: 63 74 6c 79 20 61 6e 64 20 61 6c 73 6f 20 73 75  ctly and also su
4550: 70 70 6f 72 74 20 41 44 48 20 63 65 72 74 69 66  pport ADH certif
4560: 69 63 61 74 65 2d 6c 65 73 73 20 65 6e 63 72 79  icate-less encry
4570: 70 74 69 6f 6e 2c 0a 68 6f 77 65 76 65 72 20 79  ption,.however y
4580: 6f 75 20 77 69 6c 6c 20 62 65 20 75 6e 61 62 6c  ou will be unabl
4590: 65 20 74 6f 20 75 74 69 6c 69 7a 65 20 74 68 69  e to utilize thi
45a0: 73 20 74 6f 20 73 70 65 61 6b 20 74 6f 20 6e 6f  s to speak to no
45b0: 72 6d 61 6c 20 57 65 62 0a 53 65 72 76 65 72 73  rmal Web.Servers
45c0: 2c 20 77 68 69 63 68 20 74 79 70 69 63 61 6c 6c  , which typicall
45d0: 79 20 72 65 71 75 69 72 65 20 52 53 41 20 73 75  y require RSA su
45e0: 70 70 6f 72 74 2e 20 50 6c 65 61 73 65 20 73 65  pport. Please se
45f0: 65 20 3c 61 0a 68 72 65 66 3d 22 68 74 74 70 3a  e <a.href="http:
4600: 2f 2f 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72  //www.openssl.or
4610: 67 2f 22 3e 68 74 74 70 3a 2f 2f 77 77 77 2e 6f  g/">http://www.o
4620: 70 65 6e 73 73 6c 2e 6f 72 67 2f 3c 2f 61 3e 20  penssl.org/</a> 
4630: 66 6f 72 0a 6d 6f 72 65 20 69 6e 66 6f 72 6d 61  for.more informa
4640: 74 69 6f 6e 20 6f 6e 20 74 68 65 20 77 68 6f 6c  tion on the whol
4650: 65 20 69 73 73 75 65 20 6f 66 20 70 61 74 65 6e  e issue of paten
4660: 74 73 20 61 6e 64 20 55 53 20 65 78 70 6f 72 74  ts and US export
4670: 0a 72 65 73 74 72 69 63 74 69 6f 6e 73 2e 20 3c  .restrictions. <
4680: 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65  /p>..<h3><a name
4690: 3d 22 53 45 45 20 41 4c 53 4f 22 3e 53 45 45 20  ="SEE ALSO">SEE 
46a0: 41 4c 53 4f 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c  ALSO</a></h3>..<
46b0: 70 3e 3c 73 74 72 6f 6e 67 3e 73 6f 63 6b 65 74  p><strong>socket
46c0: 3c 2f 73 74 72 6f 6e 67 3e 2c 20 3c 73 74 72 6f  </strong>, <stro
46d0: 6e 67 3e 66 69 6c 65 65 76 65 6e 74 2c 20 3c 2f  ng>fileevent, </
46e0: 73 74 72 6f 6e 67 3e 3c 61 0a 68 72 65 66 3d 22  strong><a.href="
46f0: 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73  http://www.opens
4700: 73 6c 2e 6f 72 67 2f 22 3e 3c 73 74 72 6f 6e 67  sl.org/"><strong
4710: 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e 67  >OpenSSL</strong
4720: 3e 3c 2f 61 3e 3c 2f 70 3e 0a 0a 3c 68 72 3e 0a  ></a></p>..<hr>.
4730: 0a 3c 70 72 65 3e 0a 43 6f 70 79 72 69 67 68 74  .<pre>.Copyright
4740: 20 26 63 6f 70 79 3b 20 31 39 39 39 20 4d 61 74   &copy; 1999 Mat
4750: 74 20 4e 65 77 6d 61 6e 2e 0a 43 6f 70 79 72 69  t Newman..Copyri
4760: 67 68 74 20 26 63 6f 70 79 3b 20 32 30 30 34 20  ght &copy; 2004 
4770: 53 74 61 72 66 69 73 68 20 53 79 73 74 65 6d 73  Starfish Systems
4780: 2e 0a 3c 2f 70 72 65 3e 0a 3c 2f 62 6f 64 79 3e  ..</pre>.</body>
4790: 0a 3c 2f 68 74 6d 6c 3e 0a                       .</html>.