Hex Artifact Content

Artifact 1f01ff8ecca0998de39f8cdd02a72973f6772de59d7751e433491f8a3b87cab7:


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: 3c 64 64 3e 3c 62 3e 74 6c 73 3c 2f 62 3e 20 2d  <dd><b>tls</b> -
0170: 20 62 69 6e 64 69 6e 67 20 74 6f 20 3c 62 3e 4f   binding to <b>O
0180: 70 65 6e 53 53 4c 3c 2f 62 3e 20 74 6f 6f 6c 6b  penSSL</b> toolk
0190: 69 74 2e 3c 2f 64 64 3e 0a 20 20 20 20 3c 2f 64  it.</dd>.    </d
01a0: 6c 3e 0a 20 20 20 20 3c 2f 64 64 3e 0a 20 20 20  l>.    </dd>.   
01b0: 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 53   <dd><a href="#S
01c0: 59 4e 4f 50 53 49 53 22 3e 53 59 4e 4f 50 53 49  YNOPSIS">SYNOPSI
01d0: 53 3c 2f 61 3e 20 3c 2f 64 64 3e 0a 20 20 20 20  S</a> </dd>.    
01e0: 3c 64 64 3e 3c 64 6c 3e 0a 20 20 20 20 20 20 20  <dd><dl>.       
01f0: 20 20 20 20 20 3c 64 64 3e 3c 62 3e 70 61 63 6b       <dd><b>pack
0200: 61 67 65 20 72 65 71 75 69 72 65 20 54 63 6c 3c  age require Tcl<
0210: 2f 62 3e 20 3c 65 6d 3e 3f 38 2e 34 3f 3c 2f 65  /b> <em>?8.4?</e
0220: 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  m></dd>.        
0230: 20 20 20 20 3c 64 64 3e 3c 62 3e 70 61 63 6b 61      <dd><b>packa
0240: 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 3c 2f  ge require tls</
0250: 62 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  b></dd>.        
0260: 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f      <dt>&nbsp;</
0270: 64 74 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dt>.            
0280: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74  <dd><b>tls::init
0290: 3c 2f 62 3e 20 3c 65 6d 3e 3f 6f 70 74 69 6f 6e  </b> <em>?option
02a0: 73 3f 3c 2f 65 6d 3e 20 3c 2f 64 64 3e 0a 20 20  s?</em> </dd>.  
02b0: 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c 62            <dd><b
02c0: 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f 62 3e  >tls::socket</b>
02d0: 20 3c 65 6d 3e 3f 6f 70 74 69 6f 6e 73 3f 20 68   <em>?options? h
02e0: 6f 73 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64  ost port</em></d
02f0: 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c  d>.            <
0300: 64 64 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65  dd><b>tls::socke
0310: 74 3c 2f 62 3e 20 3c 65 6d 3e 20 3f 2d 73 65 72  t</b> <em> ?-ser
0320: 76 65 72 20 63 6f 6d 6d 61 6e 64 3f 20 3f 6f 70  ver command? ?op
0330: 74 69 6f 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d 3e  tions? port</em>
0340: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20  </dd>.          
0350: 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 68 61    <dd><b>tls::ha
0360: 6e 64 73 68 61 6b 65 3c 2f 62 3e 20 3c 65 6d 3e  ndshake</b> <em>
0370: 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64   channel</em></d
0380: 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c  d>.            <
0390: 64 64 3e 3c 62 3e 74 6c 73 3a 3a 73 74 61 74 75  dd><b>tls::statu
03a0: 73 20 3c 2f 62 3e 20 3c 65 6d 3e 3f 2d 6c 6f 63  s </b> <em>?-loc
03b0: 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e  al? channel</em>
03c0: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20  </dd>.          
03d0: 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 63 6f    <dd><b>tls::co
03e0: 6e 6e 65 63 74 69 6f 6e 20 3c 2f 62 3e 20 3c 65  nnection </b> <e
03f0: 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f  m>channel</em></
0400: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dd>.            
0410: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70 6f  <dd><b>tls::impo
0420: 72 74 3c 2f 62 3e 20 3c 65 6d 3e 63 68 61 6e 6e  rt</b> <em>chann
0430: 65 6c 20 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 65 6d  el ?options?</em
0440: 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 20  ></dd>.         
0450: 20 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 75     <dd><b>tls::u
0460: 6e 69 6d 70 6f 72 74 3c 2f 62 3e 20 3c 65 6d 3e  nimport</b> <em>
0470: 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64  channel</em></dd
0480: 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 64  >.            <d
0490: 74 3e 26 6e 62 73 70 3b 3c 2f 64 74 3e 0a 20 20  t>&nbsp;</dt>.  
04a0: 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c 62            <dd><b
04b0: 3e 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 3c 2f  >tls::ciphers </
04c0: 62 3e 20 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20  b> <em>protocol 
04d0: 3f 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f  ?verbose?</em></
04e0: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20  dd>.            
04f0: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 70 72 6f 74  <dd><b>tls::prot
0500: 6f 63 6f 6c 73 3c 2f 62 3e 3c 2f 64 64 3e 0a 20  ocols</b></dd>. 
0510: 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c             <dd><
0520: 62 3e 74 6c 73 3a 3a 76 65 72 73 69 6f 6e 3c 2f  b>tls::version</
0530: 62 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  b></dd>.        
0540: 3c 2f 64 6c 3e 0a 20 20 20 20 3c 2f 64 64 3e 0a  </dl>.    </dd>.
0550: 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d      <dd><a href=
0560: 22 23 43 4f 4d 4d 41 4e 44 53 22 3e 43 4f 4d 4d  "#COMMANDS">COMM
0570: 41 4e 44 53 3c 2f 61 3e 3c 2f 64 64 3e 0a 20 20  ANDS</a></dd>.  
0580: 20 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23    <dd><a href="#
0590: 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53  CALLBACK OPTIONS
05a0: 22 3e 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f  ">CALLBACK OPTIO
05b0: 4e 53 3c 2f 61 3e 3c 2f 64 64 3e 0a 20 20 20 20  NS</a></dd>.    
05c0: 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 48 54  <dd><a href="#HT
05d0: 54 50 53 20 45 58 41 4d 50 4c 45 22 3e 48 54 54  TPS EXAMPLE">HTT
05e0: 50 53 20 45 58 41 4d 50 4c 45 3c 2f 61 3e 3c 2f  PS EXAMPLE</a></
05f0: 64 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68  dd>.    <dd><a h
0600: 72 65 66 3d 22 23 53 45 45 20 41 4c 53 4f 22 3e  ref="#SEE ALSO">
0610: 53 50 45 43 49 41 4c 20 43 4f 4e 53 49 44 45 52  SPECIAL CONSIDER
0620: 41 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 64 64 3e 0a  ATIONS</a></dd>.
0630: 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d      <dd><a href=
0640: 22 23 53 45 45 20 41 4c 53 4f 22 3e 53 45 45 20  "#SEE ALSO">SEE 
0650: 41 4c 53 4f 3c 2f 61 3e 3c 2f 64 64 3e 0a 3c 2f  ALSO</a></dd>.</
0660: 64 6c 3e 0a 0a 3c 68 72 3e 0a 0a 3c 68 33 3e 3c  dl>..<hr>..<h3><
0670: 61 20 6e 61 6d 65 3d 22 4e 41 4d 45 22 3e 4e 41  a name="NAME">NA
0680: 4d 45 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e  ME</a></h3>..<p>
0690: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3c 2f 73 74 72  <strong>tls</str
06a0: 6f 6e 67 3e 20 2d 20 62 69 6e 64 69 6e 67 20 74  ong> - binding t
06b0: 6f 20 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e 53 53  o <strong>OpenSS
06c0: 4c 3c 2f 73 74 72 6f 6e 67 3e 0a 74 6f 6f 6c 6b  L</strong>.toolk
06d0: 69 74 2e 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20  it.</p>..<h3><a 
06e0: 6e 61 6d 65 3d 22 53 59 4e 4f 50 53 49 53 22 3e  name="SYNOPSIS">
06f0: 53 59 4e 4f 50 53 49 53 3c 2f 61 3e 3c 2f 68 33  SYNOPSIS</a></h3
0700: 3e 0a 0a 3c 70 3e 3c 62 3e 70 61 63 6b 61 67 65  >..<p><b>package
0710: 20 72 65 71 75 69 72 65 20 54 63 6c 20 38 2e 34   require Tcl 8.4
0720: 3c 2f 62 3e 3c 62 72 3e 0a 3c 62 3e 70 61 63 6b  </b><br>.<b>pack
0730: 61 67 65 20 72 65 71 75 69 72 65 20 74 6c 73 3c  age require tls<
0740: 2f 62 3e 3c 62 72 3e 0a 3c 62 72 3e 0a 3c 61 20  /b><br>.<br>.<a 
0750: 68 72 65 66 3d 22 23 74 6c 73 3a 3a 69 6e 69 74  href="#tls::init
0760: 22 3e 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74 3c 2f  "><b>tls::init</
0770: 62 3e 20 3c 69 3e 3f 6f 70 74 69 6f 6e 73 3f 3c  b> <i>?options?<
0780: 2f 69 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c 61 20 68  /i></a><br>.<a h
0790: 72 65 66 3d 22 23 74 6c 73 3a 3a 73 6f 63 6b 65  ref="#tls::socke
07a0: 74 22 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65  t"><b>tls::socke
07b0: 74 3c 2f 62 3e 20 3c 69 3e 3f 6f 70 74 69 6f 6e  t</b> <i>?option
07c0: 73 3f 20 68 6f 73 74 20 70 6f 72 74 3c 2f 69 3e  s? host port</i>
07d0: 3c 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74  <br>.<a href="#t
07e0: 6c 73 3a 3a 73 6f 63 6b 65 74 22 3e 3c 62 3e 74  ls::socket"><b>t
07f0: 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f 62 3e 20 3c  ls::socket</b> <
0800: 69 3e 3f 2d 73 65 72 76 65 72 20 63 6f 6d 6d 61  i>?-server comma
0810: 6e 64 3f 20 3f 6f 70 74 69 6f 6e 73 3f 20 70 6f  nd? ?options? po
0820: 72 74 3c 2f 69 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c  rt</i></a><br>.<
0830: 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 73 74  a href="#tls::st
0840: 61 74 75 73 22 3e 3c 62 3e 74 6c 73 3a 3a 73 74  atus"><b>tls::st
0850: 61 74 75 73 3c 2f 62 3e 20 3c 69 3e 3f 2d 6c 6f  atus</b> <i>?-lo
0860: 63 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c 2f 69 3e  cal? channel</i>
0870: 3c 2f 61 3e 3c 62 72 3e 0a 3c 61 20 68 72 65 66  </a><br>.<a href
0880: 3d 22 23 74 6c 73 3a 3a 63 6f 6e 6e 65 63 74 69  ="#tls::connecti
0890: 6f 6e 22 3e 3c 62 3e 74 6c 73 3a 3a 63 6f 6e 6e  on"><b>tls::conn
08a0: 65 63 74 69 6f 6e 3c 2f 62 3e 20 3c 69 3e 63 68  ection</b> <i>ch
08b0: 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61 3e 3c 62 72  annel</i></a><br
08c0: 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 3a  >.<a href="#tls:
08d0: 3a 68 61 6e 64 73 68 61 6b 65 22 3e 3c 62 3e 74  :handshake"><b>t
08e0: 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 3c 2f 62  ls::handshake</b
08f0: 3e 20 3c 69 3e 63 68 61 6e 6e 65 6c 3c 2f 69 3e  > <i>channel</i>
0900: 3c 2f 61 3e 3c 62 72 3e 0a 3c 61 20 68 72 65 66  </a><br>.<a href
0910: 3d 22 23 74 6c 73 3a 3a 69 6d 70 6f 72 74 22 3e  ="#tls::import">
0920: 3c 62 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f  <b>tls::import</
0930: 62 3e 20 3c 69 3e 63 68 61 6e 6e 65 6c 20 3f 6f  b> <i>channel ?o
0940: 70 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c  ptions?</i></a><
0950: 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c  br>.<a href="#tl
0960: 73 3a 3a 75 6e 69 6d 70 6f 72 74 22 3e 3c 62 3e  s::unimport"><b>
0970: 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 3c 2f 62  tls::unimport</b
0980: 3e 20 3c 69 3e 63 68 61 6e 6e 65 6c 3c 2f 69 3e  > <i>channel</i>
0990: 3c 2f 61 3e 3c 62 72 3e 0a 3c 62 72 3e 0a 3c 61  </a><br>.<br>.<a
09a0: 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 63 69 70   href="#tls::cip
09b0: 68 65 72 73 22 3e 3c 62 3e 74 6c 73 3a 3a 63 69  hers"><b>tls::ci
09c0: 70 68 65 72 73 3c 2f 62 3e 20 3c 69 3e 70 72 6f  phers</b> <i>pro
09d0: 74 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 3c  tocol ?verbose?<
09e0: 2f 69 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c 61 20 68  /i></a><br>.<a h
09f0: 72 65 66 3d 22 23 74 6c 73 3a 3a 70 72 6f 74 6f  ref="#tls::proto
0a00: 63 6f 6c 73 22 3e 3c 62 3e 74 6c 73 3a 3a 70 72  cols"><b>tls::pr
0a10: 6f 74 6f 63 6f 6c 73 3c 2f 62 3e 3c 2f 61 3e 0a  otocols</b></a>.
0a20: 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 76  <a href="#tls::v
0a30: 65 72 73 69 6f 6e 22 3e 3c 62 3e 74 6c 73 3a 3a  ersion"><b>tls::
0a40: 76 65 72 73 69 6f 6e 3c 2f 62 3e 3c 2f 61 3e 0a  version</b></a>.
0a50: 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d  </p>..<h3><a nam
0a60: 65 3d 22 44 45 53 43 52 49 50 54 49 4f 4e 22 3e  e="DESCRIPTION">
0a70: 44 45 53 43 52 49 50 54 49 4f 4e 3c 2f 61 3e 3c  DESCRIPTION</a><
0a80: 2f 68 33 3e 0a 0a 3c 70 3e 54 68 69 73 20 65 78  /h3>..<p>This ex
0a90: 74 65 6e 73 69 6f 6e 20 70 72 6f 76 69 64 65 73  tension provides
0aa0: 20 61 20 67 65 6e 65 72 69 63 20 62 69 6e 64 69   a generic bindi
0ab0: 6e 67 20 74 6f 20 3c 61 0a 68 72 65 66 3d 22 68  ng to <a.href="h
0ac0: 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73 73  ttp://www.openss
0ad0: 6c 2e 6f 72 67 2f 22 3e 4f 70 65 6e 53 53 4c 3c  l.org/">OpenSSL<
0ae0: 2f 61 3e 2c 20 75 74 69 6c 69 7a 69 6e 67 20 74  /a>, utilizing t
0af0: 68 65 0a 3c 73 74 72 6f 6e 67 3e 54 63 6c 5f 53  he.<strong>Tcl_S
0b00: 74 61 63 6b 43 68 61 6e 6e 65 6c 3c 2f 73 74 72  tackChannel</str
0b10: 6f 6e 67 3e 0a 41 50 49 20 66 6f 72 20 54 63 6c  ong>.API for Tcl
0b20: 20 38 2e 34 20 61 6e 64 20 68 69 67 68 65 72 2e   8.4 and higher.
0b30: 20 54 68 65 20 73 6f 63 6b 65 74 73 20 62 65 68   The sockets beh
0b40: 61 76 65 20 65 78 61 63 74 6c 79 20 74 68 65 20  ave exactly the 
0b50: 73 61 6d 65 0a 61 73 20 63 68 61 6e 6e 65 6c 73  same.as channels
0b60: 20 63 72 65 61 74 65 64 20 75 73 69 6e 67 20 54   created using T
0b70: 63 6c 27 73 20 62 75 69 6c 74 2d 69 6e 20 3c 73  cl's built-in <s
0b80: 74 72 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 74  trong>socket</st
0b90: 72 6f 6e 67 3e 0a 63 6f 6d 6d 61 6e 64 20 77 69  rong>.command wi
0ba0: 74 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70  th additional op
0bb0: 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6e 74 72 6f  tions for contro
0bc0: 6c 6c 69 6e 67 20 74 68 65 20 53 53 4c 20 73 65  lling the SSL se
0bd0: 73 73 69 6f 6e 2e 0a 3c 2f 70 3e 0a 0a 3c 68 33  ssion..</p>..<h3
0be0: 3e 3c 61 20 6e 61 6d 65 3d 22 43 4f 4d 4d 41 4e  ><a name="COMMAN
0bf0: 44 53 22 3e 43 4f 4d 4d 41 4e 44 53 3c 2f 61 3e  DS">COMMANDS</a>
0c00: 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 79 70 69 63 61  </h3>..<p>Typica
0c10: 6c 6c 79 20 6f 6e 65 20 77 6f 75 6c 64 20 75 73  lly one would us
0c20: 65 20 74 68 65 20 3c 73 74 72 6f 6e 67 3e 74 6c  e the <strong>tl
0c30: 73 3a 3a 73 6f 63 6b 65 74 20 3c 2f 73 74 72 6f  s::socket </stro
0c40: 6e 67 3e 63 6f 6d 6d 61 6e 64 0a 77 68 69 63 68  ng>command.which
0c50: 20 70 72 6f 76 69 64 65 73 20 63 6f 6d 70 61 74   provides compat
0c60: 69 62 69 6c 69 74 79 20 77 69 74 68 20 74 68 65  ibility with the
0c70: 20 6e 61 74 69 76 65 20 54 63 6c 20 3c 73 74 72   native Tcl <str
0c80: 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 74 72 6f  ong>socket</stro
0c90: 6e 67 3e 0a 63 6f 6d 6d 61 6e 64 2e 20 49 6e 20  ng>.command. In 
0ca0: 73 75 63 68 20 63 61 73 65 73 20 3c 73 74 72 6f  such cases <stro
0cb0: 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f  ng>tls::import</
0cc0: 73 74 72 6f 6e 67 3e 20 73 68 6f 75 6c 64 20 6e  strong> should n
0cd0: 6f 74 20 62 65 0a 75 73 65 64 20 64 69 72 65 63  ot be.used direc
0ce0: 74 6c 79 2e 3c 2f 70 3e 0a 0a 3c 64 6c 3e 0a 20  tly.</p>..<dl>. 
0cf0: 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22     <dt><a name="
0d00: 74 6c 73 3a 3a 69 6e 69 74 22 3e 3c 62 3e 74 6c  tls::init"><b>tl
0d10: 73 3a 3a 69 6e 69 74 20 3c 2f 62 3e 3c 69 3e 3f  s::init </b><i>?
0d20: 6f 70 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e  options?</i></a>
0d30: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 4f 70  </dt>.    <dd>Op
0d40: 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 20  tional function 
0d50: 74 6f 20 73 65 74 20 74 68 65 20 64 65 66 61 75  to set the defau
0d60: 6c 74 20 6f 70 74 69 6f 6e 73 20 75 73 65 64 20  lt options used 
0d70: 62 79 0a 09 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a  by..<strong>tls:
0d80: 3a 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e  :socket</strong>
0d90: 2e 20 49 66 20 79 6f 75 20 63 61 6c 6c 20 3c 73  . If you call <s
0da0: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72  trong>tls::impor
0db0: 74 3c 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20  t</strong>.     
0dc0: 20 20 20 64 69 72 65 63 74 6c 79 20 74 68 69 73     directly this
0dd0: 20 72 6f 75 74 69 6e 65 20 68 61 73 20 6e 6f 20   routine has no 
0de0: 65 66 66 65 63 74 2e 20 41 6e 79 20 6f 66 20 74  effect. Any of t
0df0: 68 65 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 20  he options.     
0e00: 20 20 20 74 68 61 74 20 3c 73 74 72 6f 6e 67 3e     that <strong>
0e10: 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f 73 74 72  tls::socket</str
0e20: 6f 6e 67 3e 20 61 63 63 65 70 74 73 20 63 61 6e  ong> accepts can
0e30: 20 62 65 20 73 65 74 0a 20 20 20 20 20 20 20 20   be set.        
0e40: 75 73 69 6e 67 20 74 68 69 73 20 63 6f 6d 6d 61  using this comma
0e50: 6e 64 2c 20 74 68 6f 75 67 68 20 79 6f 75 20 73  nd, though you s
0e60: 68 6f 75 6c 64 20 6c 69 6d 69 74 20 79 6f 75 72  hould limit your
0e70: 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 20 20 20   options.       
0e80: 20 74 6f 20 6f 6e 6c 79 20 54 4c 53 20 72 65 6c   to only TLS rel
0e90: 61 74 65 64 20 6f 6e 65 73 2e 3c 2f 64 64 3e 0a  ated ones.</dd>.
0ea0: 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f      <dt>&nbsp;</
0eb0: 64 74 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e  dt>.    <dt><a n
0ec0: 61 6d 65 3d 22 74 6c 73 3a 3a 73 6f 63 6b 65 74  ame="tls::socket
0ed0: 22 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74  "><b>tls::socket
0ee0: 20 3c 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 69 6f 6e   </b><em>?option
0ef0: 73 3f 0a 20 20 20 20 20 20 20 20 68 6f 73 74 20  s?.        host 
0f00: 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 61 3e 3c 2f 64  port</em></a></d
0f10: 74 3e 0a 20 20 20 20 3c 64 74 3e 3c 62 3e 74 6c  t>.    <dt><b>tl
0f20: 73 3a 3a 73 6f 63 6b 65 74 3c 2f 62 3e 3c 65 6d  s::socket</b><em
0f30: 3e 20 3f 2d 73 65 72 76 65 72 20 63 6f 6d 6d 61  > ?-server comma
0f40: 6e 64 3f 20 3f 6f 70 74 69 6f 6e 73 3f 20 70 6f  nd? ?options? po
0f50: 72 74 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  rt</em></dt>.   
0f60: 20 3c 64 64 3e 54 68 69 73 20 69 73 20 61 20 68   <dd>This is a h
0f70: 65 6c 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 74  elper function t
0f80: 68 61 74 20 75 74 69 6c 69 7a 65 73 20 74 68 65  hat utilizes the
0f90: 20 75 6e 64 65 72 6c 79 69 6e 67 0a 20 20 20 20   underlying.    
0fa0: 20 20 20 20 63 6f 6d 6d 61 6e 64 73 20 28 3c 73      commands (<s
0fb0: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72  trong>tls::impor
0fc0: 74 3c 2f 73 74 72 6f 6e 67 3e 29 2e 20 49 74 20  t</strong>). It 
0fd0: 62 65 68 61 76 65 73 0a 20 20 20 20 20 20 20 20  behaves.        
0fe0: 65 78 61 63 74 6c 79 20 74 68 65 20 73 61 6d 65  exactly the same
0ff0: 20 61 73 20 74 68 65 20 6e 61 74 69 76 65 20 54   as the native T
1000: 63 6c 20 3c 73 74 72 6f 6e 67 3e 73 6f 63 6b 65  cl <strong>socke
1010: 74 3c 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20  t</strong>.     
1020: 20 20 20 63 6f 6d 6d 61 6e 64 20 65 78 63 65 70     command excep
1030: 74 20 74 68 61 74 20 74 68 65 20 6f 70 74 69 6f  t that the optio
1040: 6e 73 20 63 61 6e 20 69 6e 63 6c 75 64 65 20 61  ns can include a
1050: 6e 79 20 6f 66 20 74 68 65 0a 20 20 20 20 20 20  ny of the.      
1060: 20 20 61 70 70 6c 69 63 61 62 6c 65 20 3c 61 20    applicable <a 
1070: 68 72 65 66 3d 22 23 74 6c 73 3a 3a 69 6d 70 6f  href="#tls::impo
1080: 72 74 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a  rt"><strong>tls:
1090: 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 3c  import</strong><
10a0: 2f 61 3e 0a 20 20 20 20 20 20 20 20 6f 70 74 69  /a>.        opti
10b0: 6f 6e 73 20 77 69 74 68 20 6f 6e 65 20 61 64 64  ons with one add
10c0: 69 74 69 6f 6e 61 6c 20 6f 70 74 69 6f 6e 3a 0a  itional option:.
10d0: 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 20  <blockquote>.   
10e0: 20 3c 64 6c 3e 0a 20 20 20 20 20 20 20 20 3c 64   <dl>.        <d
10f0: 74 3e 3c 73 74 72 6f 6e 67 3e 2d 61 75 74 6f 73  t><strong>-autos
1100: 65 72 76 65 72 6e 61 6d 65 3c 2f 73 74 72 6f 6e  ervername</stron
1110: 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e  g> <em>bool</em>
1120: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1130: 64 3e 41 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20  d>Automatically 
1140: 73 65 6e 64 20 74 68 65 20 2d 73 65 72 76 65 72  send the -server
1150: 6e 61 6d 65 20 61 73 20 74 68 65 20 3c 65 6d 3e  name as the <em>
1160: 68 6f 73 74 3c 2f 65 6d 3e 20 61 72 67 75 6d 65  host</em> argume
1170: 6e 74 0a 20 20 20 20 20 20 20 20 20 20 20 20 28  nt.            (
1180: 64 65 66 61 75 6c 74 20 69 73 20 3c 65 6d 3e 66  default is <em>f
1190: 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a  alse</em>)</dd>.
11a0: 20 20 20 20 3c 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63      </dl>.</bloc
11b0: 6b 71 75 6f 74 65 3e 0a 0a 20 20 20 20 3c 64 74  kquote>..    <dt
11c0: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 69  ><a name="tls::i
11d0: 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69  mport"><b>tls::i
11e0: 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e 63 68 61  mport </b><i>cha
11f0: 6e 6e 65 6c 0a 20 20 20 20 20 20 20 20 3f 6f 70  nnel.        ?op
1200: 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f  tions?</i></a></
1210: 64 74 3e 0a 20 20 20 20 3c 64 64 3e 53 53 4c 2d  dt>.    <dd>SSL-
1220: 65 6e 61 62 6c 65 20 61 20 72 65 67 75 6c 61 72  enable a regular
1230: 20 54 63 6c 20 63 68 61 6e 6e 65 6c 20 2d 20 69   Tcl channel - i
1240: 74 20 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 0a  t need not be a.
1250: 20 20 20 20 20 20 20 20 73 6f 63 6b 65 74 2c 20          socket, 
1260: 62 75 74 20 6d 75 73 74 20 70 72 6f 76 69 64 65  but must provide
1270: 20 62 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c 20   bi-directional 
1280: 66 6c 6f 77 2e 20 41 6c 73 6f 0a 20 20 20 20 20  flow. Also.     
1290: 20 20 20 73 65 74 74 69 6e 67 20 73 65 73 73 69     setting sessi
12a0: 6f 6e 20 70 61 72 61 6d 65 74 65 72 73 20 66 6f  on parameters fo
12b0: 72 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e  r SSL handshake.
12c0: 3c 2f 64 64 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f  </dd>..<blockquo
12d0: 74 65 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20 20 20  te>.    <dl>.   
12e0: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
12f0: 3e 2d 61 6c 70 6e 3c 2f 73 74 72 6f 6e 67 3e 20  >-alpn</strong> 
1300: 3c 65 6d 3e 6c 69 73 74 3c 2f 65 6d 3e 3c 2f 64  <em>list</em></d
1310: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 4c  t>.        <dd>L
1320: 69 73 74 20 6f 66 20 70 72 6f 74 6f 63 6f 6c 73  ist of protocols
1330: 20 74 6f 20 6f 66 66 65 72 20 64 75 72 69 6e 67   to offer during
1340: 20 41 70 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79   Application-Lay
1350: 65 72 0a 09 20 20 20 20 50 72 6f 74 6f 63 6f 6c  er..    Protocol
1360: 20 4e 65 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c   Negotiation (AL
1370: 50 4e 29 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65  PN). For example
1380: 3a 20 68 32 2c 20 68 74 74 70 2f 31 2e 31 2c 20  : h2, http/1.1, 
1390: 65 74 63 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20  etc.</dd>.      
13a0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63    <dt><strong>-c
13b0: 61 64 69 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  adir</strong> <e
13c0: 6d 3e 64 69 72 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  m>dir</em></dt>.
13d0: 20 20 20 20 20 20 20 20 3c 64 64 3e 53 70 65 63          <dd>Spec
13e0: 69 66 79 20 74 68 65 20 64 69 72 65 63 74 6f 72  ify the director
13f0: 79 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65  y containing the
1400: 20 43 41 20 63 65 72 74 69 66 69 63 61 74 65 73   CA certificates
1410: 2e 20 54 68 65 0a 09 20 20 20 20 64 65 66 61 75  . The..    defau
1420: 6c 74 20 64 69 72 65 63 74 6f 72 79 20 69 73 20  lt directory is 
1430: 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66 69  platform specifi
1440: 63 20 61 6e 64 20 63 61 6e 20 62 65 20 73 65 74  c and can be set
1450: 20 61 74 0a 09 20 20 20 20 63 6f 6d 70 69 6c 65   at..    compile
1460: 20 74 69 6d 65 2e 20 54 68 69 73 20 63 61 6e 20   time. This can 
1470: 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 76 69  be overridden vi
1480: 61 20 74 68 65 20 3c 62 3e 53 53 4c 5f 43 45 52  a the <b>SSL_CER
1490: 54 5f 44 49 52 3c 2f 62 3e 0a 09 20 20 20 20 65  T_DIR</b>..    e
14a0: 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61  nvironment varia
14b0: 62 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20  ble.</dd>.      
14c0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63    <dt><strong>-c
14d0: 61 66 69 6c 65 20 3c 2f 73 74 72 6f 6e 67 3e 3c  afile </strong><
14e0: 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e  em>filename</em>
14f0: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1500: 64 3e 53 70 65 63 69 66 79 20 74 68 65 20 63 65  d>Specify the ce
1510: 72 74 69 66 69 63 61 74 65 20 61 75 74 68 6f 72  rtificate author
1520: 69 74 79 20 28 43 41 29 20 66 69 6c 65 20 74 6f  ity (CA) file to
1530: 20 75 73 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20   use.</dd>.     
1540: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
1550: 63 65 72 74 66 69 6c 65 3c 2f 73 74 72 6f 6e 67  certfile</strong
1560: 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f  > <em>filename</
1570: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1580: 20 3c 64 64 3e 53 70 65 63 69 66 79 20 74 68 65   <dd>Specify the
1590: 20 66 69 6c 65 6e 61 6d 65 20 63 6f 6e 74 61 69   filename contai
15a0: 6e 69 6e 67 20 74 68 65 20 63 65 72 74 69 66 69  ning the certifi
15b0: 63 61 74 65 20 74 6f 20 75 73 65 2e 20 54 68 65  cate to use. The
15c0: 0a 09 20 20 20 20 64 65 66 61 75 6c 74 20 6e 61  ..    default na
15d0: 6d 65 20 69 73 20 3c 62 3e 63 65 72 74 2e 70 65  me is <b>cert.pe
15e0: 6d 3c 2f 62 3e 2e 20 54 68 69 73 20 63 61 6e 20  m</b>. This can 
15f0: 62 65 20 6f 76 65 72 72 69 64 64 65 6e 20 76 69  be overridden vi
1600: 61 0a 09 20 20 20 20 74 68 65 20 3c 62 3e 53 53  a..    the <b>SS
1610: 4c 5f 43 45 52 54 5f 46 49 4c 45 3c 2f 62 3e 20  L_CERT_FILE</b> 
1620: 65 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69  environment vari
1630: 61 62 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20  able.</dd>.     
1640: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
1650: 63 65 72 74 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  cert</strong> <e
1660: 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c  m>filename</em><
1670: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
1680: 3e 53 70 65 63 69 66 79 20 74 68 65 20 63 6f 6e  >Specify the con
1690: 74 65 6e 74 73 20 6f 66 20 61 20 63 65 72 74 69  tents of a certi
16a0: 66 69 63 61 74 65 20 74 6f 20 75 73 65 2c 20 61  ficate to use, a
16b0: 73 20 61 20 44 45 52 0a 09 20 20 20 20 65 6e 63  s a DER..    enc
16c0: 6f 64 65 64 20 62 69 6e 61 72 79 20 76 61 6c 75  oded binary valu
16d0: 65 20 28 58 2e 35 30 39 20 44 45 52 29 2e 3c 2f  e (X.509 DER).</
16e0: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
16f0: 3c 73 74 72 6f 6e 67 3e 2d 63 69 70 68 65 72 3c  <strong>-cipher<
1700: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 73 74 72  /strong> <em>str
1710: 69 6e 67 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  ing</em></dt>.  
1720: 20 20 20 20 20 20 3c 64 64 3e 4c 69 73 74 20 6f        <dd>List o
1730: 66 20 63 69 70 68 65 72 73 20 74 6f 20 75 73 65  f ciphers to use
1740: 2e 20 53 65 65 20 4f 70 65 6e 53 53 4c 20 64 6f  . See OpenSSL do
1750: 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20  cumentation for 
1760: 74 68 65 20 66 75 6c 6c 0a 09 20 20 20 20 6c 69  the full..    li
1770: 73 74 20 6f 66 20 76 61 6c 69 64 20 76 61 6c 75  st of valid valu
1780: 65 73 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20  es.</dd>.       
1790: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63 6f   <dt><strong>-co
17a0: 6d 6d 61 6e 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c  mmand</strong> <
17b0: 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e  em>callback</em>
17c0: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
17d0: 64 3e 43 61 6c 6c 62 61 63 6b 20 74 6f 20 69 6e  d>Callback to in
17e0: 76 6f 6b 65 20 61 74 20 73 65 76 65 72 61 6c 20  voke at several 
17f0: 70 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68  points during th
1800: 65 20 68 61 6e 64 73 68 61 6b 65 2e 0a 09 20 20  e handshake...  
1810: 20 20 54 68 69 73 20 69 73 20 75 73 65 64 20 74    This is used t
1820: 6f 20 70 61 73 73 20 65 72 72 6f 72 73 20 61 6e  o pass errors an
1830: 64 20 74 72 61 63 69 6e 67 20 69 6e 66 6f 72 6d  d tracing inform
1840: 61 74 69 6f 6e 2c 20 61 6e 64 0a 09 20 20 20 20  ation, and..    
1850: 69 74 20 63 61 6e 20 61 6c 6c 6f 77 20 54 63 6c  it can allow Tcl
1860: 20 73 63 72 69 70 74 73 20 74 6f 20 70 65 72 66   scripts to perf
1870: 6f 72 6d 20 74 68 65 69 72 20 6f 77 6e 20 63 65  orm their own ce
1880: 72 74 69 66 69 63 61 74 65 0a 09 20 20 20 20 76  rtificate..    v
1890: 61 6c 69 64 61 74 69 6f 6e 20 69 6e 20 70 6c 61  alidation in pla
18a0: 63 65 20 6f 66 20 74 68 65 20 64 65 66 61 75 6c  ce of the defaul
18b0: 74 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72 6f  t validation pro
18c0: 76 69 64 65 64 20 62 79 0a 09 20 20 20 20 4f 70  vided by..    Op
18d0: 65 6e 53 53 4c 2e 20 53 65 65 20 3c 61 20 68 72  enSSL. See <a hr
18e0: 65 66 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50  ef="#CALLBACK OP
18f0: 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20  TIONS">CALLBACK 
1900: 4f 50 54 49 4f 4e 53 3c 2f 61 3e 0a 09 20 20 20  OPTIONS</a>..   
1910: 20 66 6f 72 20 66 75 72 74 68 65 72 20 64 69 73   for further dis
1920: 63 75 73 73 69 6f 6e 2e 3c 2f 64 64 3e 0a 20 20  cussion.</dd>.  
1930: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
1940: 67 3e 2d 64 68 70 61 72 61 6d 73 20 3c 2f 73 74  g>-dhparams </st
1950: 72 6f 6e 67 3e 3c 65 6d 3e 66 69 6c 65 6e 61 6d  rong><em>filenam
1960: 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  e</em></dt>.    
1970: 20 20 20 20 3c 64 64 3e 53 70 65 63 69 66 79 20      <dd>Specify 
1980: 74 68 65 20 44 69 66 66 69 65 2d 48 65 6c 6c 6d  the Diffie-Hellm
1990: 61 6e 20 70 61 72 61 6d 65 74 65 72 73 20 66 69  an parameters fi
19a0: 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20  le.</dd>.       
19b0: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 6b 65   <dt><strong>-ke
19c0: 79 66 69 6c 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c  yfile</strong> <
19d0: 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e  em>filename</em>
19e0: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
19f0: 64 3e 53 70 65 63 69 66 79 20 74 68 65 20 70 72  d>Specify the pr
1a00: 69 76 61 74 65 20 6b 65 79 20 66 69 6c 65 2e 20  ivate key file. 
1a10: 28 64 65 66 61 75 6c 74 20 69 73 0a 20 20 20 20  (default is.    
1a20: 20 20 20 20 20 20 20 20 76 61 6c 75 65 20 6f 66          value of
1a30: 20 2d 63 65 72 74 66 69 6c 65 29 3c 2f 64 64 3e   -certfile)</dd>
1a40: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
1a50: 72 6f 6e 67 3e 2d 6b 65 79 3c 2f 73 74 72 6f 6e  rong>-key</stron
1a60: 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c  g> <em>filename<
1a70: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
1a80: 20 20 3c 64 64 3e 53 70 65 63 69 66 79 20 74 68    <dd>Specify th
1a90: 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 74 6f  e private key to
1aa0: 20 75 73 65 20 61 73 20 61 20 44 45 52 20 65 6e   use as a DER en
1ab0: 63 6f 64 65 64 20 76 61 6c 75 65 20 28 50 4b 43  coded value (PKC
1ac0: 53 23 31 20 44 45 52 29 3c 2f 64 64 3e 0a 20 20  S#1 DER)</dd>.  
1ad0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
1ae0: 67 3e 2d 6d 6f 64 65 6c 3c 2f 73 74 72 6f 6e 67  g>-model</strong
1af0: 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65  > <em>channel</e
1b00: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
1b10: 3c 64 64 3e 46 6f 72 63 65 20 74 68 69 73 20 63  <dd>Force this c
1b20: 68 61 6e 6e 65 6c 20 74 6f 20 73 68 61 72 65 20  hannel to share 
1b30: 74 68 65 20 73 61 6d 65 20 3c 65 6d 3e 3c 73 74  the same <em><st
1b40: 72 6f 6e 67 3e 53 53 4c 5f 43 54 58 3c 2f 73 74  rong>SSL_CTX</st
1b50: 72 6f 6e 67 3e 3c 2f 65 6d 3e 0a 20 20 20 20 20  rong></em>.     
1b60: 20 20 20 20 20 20 20 73 74 72 75 63 74 75 72 65         structure
1b70: 20 61 73 20 74 68 65 20 73 70 65 63 69 66 69 65   as the specifie
1b80: 64 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65  d <em>channel</e
1b90: 6d 3e 2c 20 61 6e 64 0a 20 20 20 20 20 20 20 20  m>, and.        
1ba0: 20 20 20 20 74 68 65 72 65 66 6f 72 65 20 73 68      therefore sh
1bb0: 61 72 65 20 63 61 6c 6c 62 61 63 6b 73 20 65 74  are callbacks et
1bc0: 63 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  c.</dd>.        
1bd0: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 73  <dt><strong>-pas
1be0: 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c  sword</strong> <
1bf0: 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e  em>callback</em>
1c00: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1c10: 64 3e 43 61 6c 6c 62 61 63 6b 20 74 6f 20 69 6e  d>Callback to in
1c20: 76 6f 6b 65 20 77 68 65 6e 20 4f 70 65 6e 53 53  voke when OpenSS
1c30: 4c 20 6e 65 65 64 73 20 74 6f 20 6f 62 74 61 69  L needs to obtai
1c40: 6e 20 61 20 70 61 73 73 77 6f 72 64 2c 0a 09 20  n a password,.. 
1c50: 20 20 20 74 79 70 69 63 61 6c 6c 79 20 74 6f 20     typically to 
1c60: 75 6e 6c 6f 63 6b 20 74 68 65 20 70 72 69 76 61  unlock the priva
1c70: 74 65 20 6b 65 79 20 6f 66 20 61 20 63 65 72 74  te key of a cert
1c80: 69 66 69 63 61 74 65 2e 20 54 68 65 0a 20 20 20  ificate. The.   
1c90: 20 20 20 20 20 20 20 20 20 63 61 6c 6c 62 61 63           callbac
1ca0: 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20  k should return 
1cb0: 61 20 73 74 72 69 6e 67 20 77 68 69 63 68 20 72  a string which r
1cc0: 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 70 61  epresents the pa
1cd0: 73 73 77 6f 72 64 0a 20 20 20 20 20 20 20 20 20  ssword.         
1ce0: 20 20 20 74 6f 20 62 65 20 75 73 65 64 2e 20 53     to be used. S
1cf0: 65 65 20 3c 61 20 68 72 65 66 3d 22 23 43 41 4c  ee <a href="#CAL
1d00: 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 22 3e 43  LBACK OPTIONS">C
1d10: 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 3c  ALLBACK OPTIONS<
1d20: 2f 61 3e 0a 09 20 20 20 20 66 6f 72 20 66 75 72  /a>..    for fur
1d30: 74 68 65 72 20 64 69 73 63 75 73 73 69 6f 6e 2e  ther discussion.
1d40: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dd>.        <d
1d50: 74 3e 3c 73 74 72 6f 6e 67 3e 2d 72 65 71 75 65  t><strong>-reque
1d60: 73 74 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e  st </strong><em>
1d70: 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20  bool</em></dt>. 
1d80: 20 20 20 20 20 20 20 3c 64 64 3e 52 65 71 75 65         <dd>Reque
1d90: 73 74 20 61 20 63 65 72 74 69 66 69 63 61 74 65  st a certificate
1da0: 20 66 72 6f 6d 20 70 65 65 72 20 64 75 72 69 6e   from peer durin
1db0: 67 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e  g SSL handshake.
1dc0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 28 64 65  .            (de
1dd0: 66 61 75 6c 74 20 69 73 20 3c 65 6d 3e 74 72 75  fault is <em>tru
1de0: 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20  e</em>)</dd>.   
1df0: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
1e00: 3e 2d 72 65 71 75 69 72 65 3c 2f 73 74 72 6f 6e  >-require</stron
1e10: 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e  g> <em>bool</em>
1e20: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
1e30: 64 3e 52 65 71 75 69 72 65 20 61 20 76 61 6c 69  d>Require a vali
1e40: 64 20 63 65 72 74 69 66 69 63 61 74 65 20 66 72  d certificate fr
1e50: 6f 6d 20 70 65 65 72 20 64 75 72 69 6e 67 20 53  om peer during S
1e60: 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 0a 09 20  SL handshake... 
1e70: 20 20 20 49 66 20 74 68 69 73 20 69 73 20 73 65     If this is se
1e80: 74 20 74 6f 20 74 72 75 65 2c 20 74 68 65 6e 20  t to true, then 
1e90: 3c 73 74 72 6f 6e 67 3e 2d 72 65 71 75 65 73 74  <strong>-request
1ea0: 3c 2f 73 74 72 6f 6e 67 3e 20 6d 75 73 74 0a 20  </strong> must. 
1eb0: 20 20 20 20 20 20 20 20 20 20 20 61 6c 73 6f 20             also 
1ec0: 62 65 20 73 65 74 20 74 6f 20 74 72 75 65 2e 20  be set to true. 
1ed0: 28 64 65 66 61 75 6c 74 20 69 73 20 3c 65 6d 3e  (default is <em>
1ee0: 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e  false</em>)</dd>
1ef0: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
1f00: 72 6f 6e 67 3e 2d 73 65 72 76 65 72 3c 2f 73 74  rong>-server</st
1f10: 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f  rong> <em>bool</
1f20: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
1f30: 20 3c 64 64 3e 48 61 6e 64 73 68 61 6b 65 20 61   <dd>Handshake a
1f40: 73 20 73 65 72 76 65 72 20 69 66 20 74 72 75 65  s server if true
1f50: 2c 20 65 6c 73 65 20 68 61 6e 64 73 68 61 6b 65  , else handshake
1f60: 20 61 73 0a 20 20 20 20 20 20 20 20 20 20 20 20   as.            
1f70: 63 6c 69 65 6e 74 2e 20 28 64 65 66 61 75 6c 74  client. (default
1f80: 20 69 73 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65   is <em>false</e
1f90: 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20  m>)</dd>.       
1fa0: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73 65   <dt><strong>-se
1fb0: 72 76 65 72 6e 61 6d 65 3c 2f 73 74 72 6f 6e 67  rvername</strong
1fc0: 3e 20 3c 65 6d 3e 68 6f 73 74 3c 2f 65 6d 3e 3c  > <em>host</em><
1fd0: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
1fe0: 3e 53 70 65 63 69 66 79 20 73 65 72 76 65 72 20  >Specify server 
1ff0: 68 6f 73 74 6e 61 6d 65 2e 20 4f 6e 6c 79 20 61  hostname. Only a
2000: 76 61 69 6c 61 62 6c 65 20 69 66 20 74 68 65 20  vailable if the 
2010: 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 0a  OpenSSL library.
2020: 09 20 20 20 20 74 68 65 20 70 61 63 6b 61 67 65  .    the package
2030: 20 69 73 20 6c 69 6e 6b 65 64 20 61 67 61 69 6e   is linked again
2040: 73 74 20 73 75 70 70 6f 72 74 73 20 74 68 65 20  st supports the 
2050: 54 4c 53 20 68 6f 73 74 6e 61 6d 65 20 65 78 74  TLS hostname ext
2060: 65 6e 73 69 6f 6e 0a 09 20 20 20 20 66 6f 72 20  ension..    for 
2070: 27 53 65 72 76 65 72 20 4e 61 6d 65 20 49 6e 64  'Server Name Ind
2080: 69 63 61 74 69 6f 6e 27 20 28 53 4e 49 29 2e 20  ication' (SNI). 
2090: 55 73 65 20 74 6f 20 6e 61 6d 65 20 74 68 65 20  Use to name the 
20a0: 6c 6f 67 69 63 61 6c 20 68 6f 73 74 0a 09 20 20  logical host..  
20b0: 20 20 77 65 20 61 72 65 20 74 61 6c 6b 69 6e 67    we are talking
20c0: 20 74 6f 20 61 6e 64 20 65 78 70 65 63 74 69 6e   to and expectin
20d0: 67 20 61 20 63 65 72 74 69 66 69 63 61 74 65 20  g a certificate 
20e0: 66 6f 72 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20  for.</dd>.      
20f0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73    <dt><strong>-s
2100: 73 6c 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  sl2</strong> <em
2110: 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  >bool</em></dt>.
2120: 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 62          <dd>Enab
2130: 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20 76 32  le use of SSL v2
2140: 2e 20 28 64 65 66 61 75 6c 74 20 69 73 20 3c 65  . (default is <e
2150: 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f 64  m>false</em>)</d
2160: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
2170: 73 74 72 6f 6e 67 3e 2d 73 73 6c 33 20 3c 2f 73  strong>-ssl3 </s
2180: 74 72 6f 6e 67 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f  trong><em>bool</
2190: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
21a0: 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65 20   <dd>Enable use 
21b0: 6f 66 20 53 53 4c 20 76 33 2e 20 28 64 65 66 61  of SSL v3. (defa
21c0: 75 6c 74 20 69 73 20 3c 65 6d 3e 66 61 6c 73 65  ult is <em>false
21d0: 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20  </em>)</dd>.    
21e0: 20 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67      <dt>-<strong
21f0: 3e 74 6c 73 31 3c 2f 73 74 72 6f 6e 67 3e 20 3c  >tls1</strong> <
2200: 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74  em>bool</em></dt
2210: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e  >.        <dd>En
2220: 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20  able use of TLS 
2230: 76 31 2e 20 28 64 65 66 61 75 6c 74 20 69 73 20  v1. (default is 
2240: 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f  <em>true</em>)</
2250: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
2260: 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31 2e 31 3c  -<strong>tls1.1<
2270: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f  /strong> <em>boo
2280: 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  l</em></dt>.    
2290: 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75      <dd>Enable u
22a0: 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 31 20 28  se of TLS v1.1 (
22b0: 64 65 66 61 75 6c 74 20 69 73 20 3c 65 6d 3e 74  default is <em>t
22c0: 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20  rue</em>)</dd>. 
22d0: 20 20 20 20 20 20 20 3c 64 74 3e 2d 3c 73 74 72         <dt>-<str
22e0: 6f 6e 67 3e 74 6c 73 31 2e 32 3c 2f 73 74 72 6f  ong>tls1.2</stro
22f0: 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d  ng> <em>bool</em
2300: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c  ></dt>.        <
2310: 64 64 3e 45 6e 61 62 6c 65 20 75 73 65 20 6f 66  dd>Enable use of
2320: 20 54 4c 53 20 76 31 2e 32 20 28 64 65 66 61 75   TLS v1.2 (defau
2330: 6c 74 20 69 73 20 3c 65 6d 3e 74 72 75 65 3c 2f  lt is <em>true</
2340: 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20  em>)</dd>.      
2350: 20 20 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74    <dt>-<strong>t
2360: 6c 73 31 2e 33 3c 2f 73 74 72 6f 6e 67 3e 20 3c  ls1.3</strong> <
2370: 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74  em>bool</em></dt
2380: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e  >.        <dd>En
2390: 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c 53 20  able use of TLS 
23a0: 76 31 2e 33 20 28 64 65 66 61 75 6c 74 20 69 73  v1.3 (default is
23b0: 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c   <em>true</em>)<
23c0: 2f 64 64 3e 0a 20 20 20 20 3c 2f 64 6c 3e 0a 3c  /dd>.    </dl>.<
23d0: 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 20 20  /blockquote>..  
23e0: 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74    <dt><a name="t
23f0: 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 22 3e 3c 62  ls::unimport"><b
2400: 3e 74 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 20 3c  >tls::unimport <
2410: 2f 62 3e 3c 69 3e 63 68 61 6e 6e 65 6c 3c 2f 69  /b><i>channel</i
2420: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c  ></a></dt>.    <
2430: 64 64 3e 50 72 6f 76 69 64 65 64 20 66 6f 72 20  dd>Provided for 
2440: 73 79 6d 6d 65 74 72 79 20 74 6f 20 3c 73 74 72  symmetry to <str
2450: 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c  ong>tls::import<
2460: 2f 73 74 72 6f 6e 67 3e 2c 20 74 68 69 73 0a 20  /strong>, this. 
2470: 20 20 20 20 20 75 6e 73 74 61 63 6b 73 20 74 68       unstacks th
2480: 65 20 53 53 4c 2d 65 6e 61 62 6c 69 6e 67 20 6f  e SSL-enabling o
2490: 66 20 61 20 72 65 67 75 6c 61 72 20 54 63 6c 20  f a regular Tcl 
24a0: 63 68 61 6e 6e 65 6c 2e 20 20 41 6e 20 65 72 72  channel.  An err
24b0: 6f 72 0a 20 20 20 20 20 20 69 73 20 74 68 72 6f  or.      is thro
24c0: 77 6e 20 69 66 20 54 4c 53 20 69 73 20 6e 6f 74  wn if TLS is not
24d0: 20 74 68 65 20 74 6f 70 20 73 74 61 63 6b 65 64   the top stacked
24e0: 20 63 68 61 6e 6e 65 6c 20 74 79 70 65 2e 3c 2f   channel type.</
24f0: 64 64 3e 0a 20 20 20 20 3c 64 74 3e 26 6e 62 73  dd>.    <dt>&nbs
2500: 70 3b 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74 3e  p;</dt>.    <dt>
2510: 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 68 61  <a name="tls::ha
2520: 6e 64 73 68 61 6b 65 22 3e 3c 73 74 72 6f 6e 67  ndshake"><strong
2530: 3e 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 3c  >tls::handshake<
2540: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61  /strong> <em>cha
2550: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61 3e 3c 2f 64  nnel</em></a></d
2560: 74 3e 0a 20 20 20 20 3c 64 64 3e 46 6f 72 63 65  t>.    <dd>Force
2570: 73 20 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 74  s handshake to t
2580: 61 6b 65 20 70 6c 61 63 65 2c 20 61 6e 64 20 72  ake place, and r
2590: 65 74 75 72 6e 73 20 30 20 69 66 0a 20 20 20 20  eturns 0 if.    
25a0: 20 20 20 20 68 61 6e 64 73 68 61 6b 65 20 69 73      handshake is
25b0: 20 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65   still in progre
25c0: 73 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67  ss (non-blocking
25d0: 29 2c 20 6f 72 20 31 20 69 66 0a 20 20 20 20 20  ), or 1 if.     
25e0: 20 20 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65     the handshake
25f0: 20 77 61 73 20 73 75 63 63 65 73 73 66 75 6c 2e   was successful.
2600: 20 49 66 20 74 68 65 20 68 61 6e 64 73 68 61 6b   If the handshak
2610: 65 20 66 61 69 6c 65 64 0a 20 20 20 20 20 20 20  e failed.       
2620: 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 77 69   this routine wi
2630: 6c 6c 20 74 68 72 6f 77 20 61 6e 20 65 72 72 6f  ll throw an erro
2640: 72 2e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 74 3e  r.</dd>.    <dt>
2650: 26 6e 62 73 70 3b 3c 2f 64 74 3e 0a 20 20 20 20  &nbsp;</dt>.    
2660: 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73  <dt><a name="tls
2670: 3a 3a 73 74 61 74 75 73 22 3e 3c 73 74 72 6f 6e  ::status"><stron
2680: 67 3e 74 6c 73 3a 3a 73 74 61 74 75 73 3c 2f 73  g>tls::status</s
2690: 74 72 6f 6e 67 3e 0a 20 20 20 20 3c 65 6d 3e 3f  trong>.    <em>?
26a0: 2d 6c 6f 63 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c  -local? channel<
26b0: 2f 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20  /em></a></dt>.  
26c0: 20 20 3c 64 64 3e 52 65 74 75 72 6e 73 20 74 68    <dd>Returns th
26d0: 65 20 63 75 72 72 65 6e 74 20 63 65 72 74 69 66  e current certif
26e0: 69 63 61 74 65 20 73 74 61 74 75 73 20 6f 66 20  icate status of 
26f0: 61 6e 20 53 53 4c 20 63 68 61 6e 6e 65 6c 2e 20  an SSL channel. 
2700: 54 68 65 0a 20 20 20 20 20 20 20 20 72 65 73 75  The.        resu
2710: 6c 74 20 69 73 20 61 20 6c 69 73 74 20 6f 66 20  lt is a list of 
2720: 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 73 20  key-value pairs 
2730: 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 0a 20  describing the. 
2740: 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 65 64         connected
2750: 20 70 65 65 72 2e 20 49 66 20 74 68 65 20 72 65   peer. If the re
2760: 73 75 6c 74 20 69 73 20 61 6e 20 65 6d 70 74 79  sult is an empty
2770: 20 6c 69 73 74 20 74 68 65 6e 20 74 68 65 0a 20   list then the. 
2780: 20 20 20 20 20 20 20 53 53 4c 20 68 61 6e 64 73         SSL hands
2790: 68 61 6b 65 20 68 61 73 20 6e 6f 74 20 79 65 74  hake has not yet
27a0: 20 63 6f 6d 70 6c 65 74 65 64 2e 0a 20 20 20 20   completed..    
27b0: 20 20 20 20 49 66 20 3c 65 6d 3e 2d 6c 6f 63 61      If <em>-loca
27c0: 6c 3c 2f 65 6d 3e 20 69 73 20 67 69 76 65 6e 2c  l</em> is given,
27d0: 20 74 68 65 6e 20 74 68 65 20 63 65 72 74 69 66   then the certif
27e0: 69 63 61 74 65 20 69 6e 66 6f 72 6d 61 74 69 6f  icate informatio
27f0: 6e 0a 20 20 20 20 20 20 20 20 69 73 20 74 68 65  n.        is the
2800: 20 6f 6e 65 20 75 73 65 64 20 6c 6f 63 61 6c 6c   one used locall
2810: 79 2e 3c 2f 64 64 3e 0a 0a 3c 62 6c 6f 63 6b 71  y.</dd>..<blockq
2820: 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20  uote>.    <dl>. 
2830: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
2840: 6e 67 3e 69 73 73 75 65 72 3c 2f 73 74 72 6f 6e  ng>issuer</stron
2850: 67 3e 20 3c 65 6d 3e 64 6e 3c 2f 65 6d 3e 3c 2f  g> <em>dn</em></
2860: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e  dt>.        <dd>
2870: 54 68 65 20 64 69 73 74 69 6e 67 75 69 73 68 65  The distinguishe
2880: 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66 20 74  d name (DN) of t
2890: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 0a 20  he certificate. 
28a0: 20 20 20 20 20 20 20 20 20 20 20 69 73 73 75 65             issue
28b0: 72 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20  r.</dd>.        
28c0: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 73 75 62 6a  <dt><strong>subj
28d0: 65 63 74 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  ect</strong> <em
28e0: 3e 64 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20  >dn</em></dt>.  
28f0: 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 64 69        <dd>The di
2900: 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d 65  stinguished name
2910: 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65 72   (DN) of the cer
2920: 74 69 66 69 63 61 74 65 0a 20 20 20 20 20 20 20  tificate.       
2930: 20 20 20 20 20 73 75 62 6a 65 63 74 2e 3c 2f 64       subject.</d
2940: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
2950: 73 74 72 6f 6e 67 3e 6e 6f 74 42 65 66 6f 72 65  strong>notBefore
2960: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 61  </strong> <em>da
2970: 74 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  te</em></dt>.   
2980: 20 20 20 20 20 3c 64 64 3e 54 68 65 20 62 65 67       <dd>The beg
2990: 69 6e 20 64 61 74 65 20 66 6f 72 20 74 68 65 20  in date for the 
29a0: 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 65 20  validity of the 
29b0: 63 65 72 74 69 66 69 63 61 74 65 2e 3c 2f 64 64  certificate.</dd
29c0: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73  >.        <dt><s
29d0: 74 72 6f 6e 67 3e 6e 6f 74 41 66 74 65 72 3c 2f  trong>notAfter</
29e0: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 61 74 65  strong> <em>date
29f0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20  </em></dt>.     
2a00: 20 20 20 3c 64 64 3e 54 68 65 20 65 78 70 69 72     <dd>The expir
2a10: 79 20 64 61 74 65 20 66 6f 72 20 74 68 65 20 63  y date for the c
2a20: 65 72 74 69 66 69 63 61 74 65 2e 3c 2f 64 64 3e  ertificate.</dd>
2a30: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
2a40: 72 6f 6e 67 3e 73 65 72 69 61 6c 3c 2f 73 74 72  rong>serial</str
2a50: 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c  ong> <em>n</em><
2a60: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
2a70: 3e 54 68 65 20 73 65 72 69 61 6c 20 6e 75 6d 62  >The serial numb
2a80: 65 72 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  er of the certif
2a90: 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20  icate.</dd>.    
2aa0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
2ab0: 63 69 70 68 65 72 3c 2f 73 74 72 6f 6e 67 3e 20  cipher</strong> 
2ac0: 3c 65 6d 3e 63 69 70 68 65 72 3c 2f 65 6d 3e 3c  <em>cipher</em><
2ad0: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
2ae0: 3e 54 68 65 20 63 75 72 72 65 6e 74 20 63 69 70  >The current cip
2af0: 68 65 72 20 69 6e 20 75 73 65 20 62 65 74 77 65  her in use betwe
2b00: 65 6e 20 74 68 65 20 63 6c 69 65 6e 74 20 61 6e  en the client an
2b10: 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 73 65  d.            se
2b20: 72 76 65 72 20 63 68 61 6e 6e 65 6c 73 2e 3c 2f  rver channels.</
2b30: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
2b40: 3c 73 74 72 6f 6e 67 3e 73 62 69 74 73 3c 2f 73  <strong>sbits</s
2b50: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d  trong> <em>n</em
2b60: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c  ></dt>.        <
2b70: 64 64 3e 54 68 65 20 6e 75 6d 62 65 72 20 6f 66  dd>The number of
2b80: 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 74   bits used for t
2b90: 68 65 20 73 65 73 73 69 6f 6e 20 6b 65 79 2e 3c  he session key.<
2ba0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74  /dd>.        <dt
2bb0: 3e 3c 73 74 72 6f 6e 67 3e 63 65 72 74 69 66 69  ><strong>certifi
2bc0: 63 61 74 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  cate</strong> <e
2bd0: 6d 3e 63 65 72 74 3c 2f 65 6d 3e 3c 2f 64 74 3e  m>cert</em></dt>
2be0: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65  .        <dd>The
2bf0: 20 50 45 4d 20 65 6e 63 6f 64 65 64 20 63 65 72   PEM encoded cer
2c00: 74 69 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20  tificate.</dd>. 
2c10: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f         <dt><stro
2c20: 6e 67 3e 73 68 61 31 5f 68 61 73 68 3c 2f 73 74  ng>sha1_hash</st
2c30: 72 6f 6e 67 3e 20 3c 65 6d 3e 68 61 73 68 3c 2f  rong> <em>hash</
2c40: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
2c50: 20 3c 64 64 3e 54 68 65 20 53 48 41 31 20 68 61   <dd>The SHA1 ha
2c60: 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 69 66  sh of the certif
2c70: 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20  icate.</dd>.    
2c80: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
2c90: 73 68 61 32 35 36 5f 68 61 73 68 3c 2f 73 74 72  sha256_hash</str
2ca0: 6f 6e 67 3e 20 3c 65 6d 3e 68 61 73 68 3c 2f 65  ong> <em>hash</e
2cb0: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
2cc0: 3c 64 64 3e 54 68 65 20 53 48 41 32 35 36 20 68  <dd>The SHA256 h
2cd0: 61 73 68 20 6f 66 20 74 68 65 20 63 65 72 74 69  ash of the certi
2ce0: 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20  ficate.</dd>.   
2cf0: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67       <dt><strong
2d00: 3e 61 6c 70 6e 3c 2f 73 74 72 6f 6e 67 3e 20 3c  >alpn</strong> <
2d10: 65 6d 3e 70 72 6f 74 6f 63 6f 6c 3c 2f 65 6d 3e  em>protocol</em>
2d20: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64  </dt>.        <d
2d30: 64 3e 54 68 65 20 70 72 6f 74 6f 63 6f 6c 20 73  d>The protocol s
2d40: 65 6c 65 63 74 65 64 20 61 66 74 65 72 20 41 70  elected after Ap
2d50: 70 6c 69 63 61 74 69 6f 6e 2d 4c 61 79 65 72 20  plication-Layer 
2d60: 50 72 6f 74 6f 63 6f 6c 0a 09 20 20 20 20 4e 65  Protocol..    Ne
2d70: 67 6f 74 69 61 74 69 6f 6e 20 28 41 4c 50 4e 29  gotiation (ALPN)
2d80: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c  .</dd>.        <
2d90: 64 74 3e 3c 73 74 72 6f 6e 67 3e 76 65 72 73 69  dt><strong>versi
2da0: 6f 6e 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e  on</strong> <em>
2db0: 76 61 6c 75 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  value</em></dt>.
2dc0: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
2dd0: 70 72 6f 74 6f 63 6f 6c 20 76 65 72 73 69 6f 6e  protocol version
2de0: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 63 6f   used for the co
2df0: 6e 6e 65 63 74 69 6f 6e 3a 0a 09 20 20 53 53 4c  nnection:..  SSL
2e00: 76 32 2c 20 53 53 4c 76 33 2c 20 54 4c 53 76 31  v2, SSLv3, TLSv1
2e10: 2c 20 54 4c 53 76 31 2e 31 2c 20 54 4c 53 76 31  , TLSv1.1, TLSv1
2e20: 2e 32 2c 20 54 4c 53 76 31 2e 33 2c 20 6f 72 20  .2, TLSv1.3, or 
2e30: 75 6e 6b 6e 6f 77 6e 3c 2f 64 64 3e 0a 20 20 20  unknown</dd>.   
2e40: 20 3c 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75   </dl>.</blockqu
2e50: 6f 74 65 3e 0a 0a 20 20 20 20 3c 64 74 3e 3c 61  ote>..    <dt><a
2e60: 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 63 6f 6e 6e   name="tls::conn
2e70: 65 63 74 69 6f 6e 22 3e 3c 73 74 72 6f 6e 67 3e  ection"><strong>
2e80: 74 6c 73 3a 3a 63 6f 6e 6e 65 63 74 69 6f 6e 3c  tls::connection<
2e90: 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20 3c 65 6d  /strong>.    <em
2ea0: 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61  >channel</em></a
2eb0: 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 52  ></dt>.    <dd>R
2ec0: 65 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65  eturns the curre
2ed0: 6e 74 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 74  nt connection st
2ee0: 61 74 75 73 20 6f 66 20 61 6e 20 53 53 4c 20 63  atus of an SSL c
2ef0: 68 61 6e 6e 65 6c 2e 20 54 68 65 0a 20 20 20 20  hannel. The.    
2f00: 20 20 20 20 72 65 73 75 6c 74 20 69 73 20 61 20      result is a 
2f10: 6c 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75  list of key-valu
2f20: 65 20 70 61 69 72 73 20 64 65 73 63 72 69 62 69  e pairs describi
2f30: 6e 67 20 74 68 65 0a 20 20 20 20 20 20 20 20 63  ng the.        c
2f40: 6f 6e 6e 65 63 74 65 64 20 70 65 65 72 2e 3c 2f  onnected peer.</
2f50: 64 64 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65  dd>..<blockquote
2f60: 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20 20 20 20 20  >.    <dl>.     
2f70: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 73     <dt><strong>s
2f80: 74 61 74 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  tate</strong> <e
2f90: 6d 3e 73 74 61 74 65 3c 2f 65 6d 3e 3c 2f 64 74  m>state</em></dt
2fa0: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 53 74  >.        <dd>St
2fb0: 61 74 65 20 6f 66 20 74 68 65 20 63 6f 6e 6e 65  ate of the conne
2fc0: 63 74 69 6f 6e 3a 20 69 6e 69 74 69 61 6c 69 7a  ction: initializ
2fd0: 69 6e 67 2c 20 68 61 6e 64 73 68 61 6b 65 2c 20  ing, handshake, 
2fe0: 65 73 74 61 62 6c 69 73 68 65 64 3c 2f 64 64 3e  established</dd>
2ff0: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
3000: 72 6f 6e 67 3e 73 65 72 76 65 72 3c 2f 73 74 72  rong>server</str
3010: 6f 6e 67 3e 20 3c 65 6d 3e 6e 61 6d 65 3c 2f 65  ong> <em>name</e
3020: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
3030: 3c 64 64 3e 54 68 65 20 6e 61 6d 65 20 6f 66 20  <dd>The name of 
3040: 74 68 65 20 63 6f 6e 6e 65 63 74 65 64 20 74 6f  the connected to
3050: 20 73 65 72 76 65 72 2e 3c 2f 64 64 3e 0a 20 20   server.</dd>.  
3060: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
3070: 67 3e 70 72 6f 74 6f 63 6f 6c 3c 2f 73 74 72 6f  g>protocol</stro
3080: 6e 67 3e 20 3c 65 6d 3e 76 65 72 73 69 6f 6e 3c  ng> <em>version<
3090: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
30a0: 20 20 3c 64 64 3e 54 68 65 20 70 72 6f 74 6f 63    <dd>The protoc
30b0: 6f 6c 20 76 65 72 73 69 6f 6e 20 75 73 65 64 20  ol version used 
30c0: 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69  for the connecti
30d0: 6f 6e 3a 0a 09 20 20 20 20 53 53 4c 32 2c 20 53  on:..    SSL2, S
30e0: 53 4c 33 2c 20 54 4c 53 31 2c 20 54 4c 53 31 2e  SL3, TLS1, TLS1.
30f0: 31 2c 20 54 4c 53 31 2e 32 2c 20 54 4c 53 31 2e  1, TLS1.2, TLS1.
3100: 33 2c 20 6f 72 20 75 6e 6b 6e 6f 77 6e 3c 2f 64  3, or unknown</d
3110: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c  d>.        <dt><
3120: 73 74 72 6f 6e 67 3e 63 69 70 68 65 72 3c 2f 73  strong>cipher</s
3130: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 69 70 68 65  trong> <em>ciphe
3140: 72 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20  r</em></dt>.    
3150: 20 20 20 20 3c 64 64 3e 54 68 65 20 63 75 72 72      <dd>The curr
3160: 65 6e 74 20 63 69 70 68 65 72 20 69 6e 20 75 73  ent cipher in us
3170: 65 20 66 6f 72 20 74 68 65 20 63 6f 6e 6e 65 63  e for the connec
3180: 74 69 6f 6e 2e 3c 2f 64 64 3e 0a 20 20 20 20 20  tion.</dd>.     
3190: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 73     <dt><strong>s
31a0: 74 61 6e 64 61 72 64 5f 6e 61 6d 65 3c 2f 73 74  tandard_name</st
31b0: 72 6f 6e 67 3e 20 3c 65 6d 3e 6e 61 6d 65 3c 2f  rong> <em>name</
31c0: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20  em></dt>.       
31d0: 20 3c 64 64 3e 54 68 65 20 73 74 61 6e 64 61 72   <dd>The standar
31e0: 64 20 52 46 43 20 6e 61 6d 65 20 6f 66 20 63 69  d RFC name of ci
31f0: 70 68 65 72 2e 3c 2f 64 64 3e 0a 20 20 20 20 20  pher.</dd>.     
3200: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 62     <dt><strong>b
3210: 69 74 73 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d  its</strong> <em
3220: 3e 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  >n</em></dt>.   
3230: 20 20 20 20 20 3c 64 64 3e 54 68 65 20 6e 75 6d       <dd>The num
3240: 62 65 72 20 6f 66 20 70 72 6f 63 65 73 73 65 64  ber of processed
3250: 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 20 63   bits used for c
3260: 69 70 68 65 72 2e 3c 2f 64 64 3e 0a 20 20 20 20  ipher.</dd>.    
3270: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e      <dt><strong>
3280: 73 65 63 72 65 74 5f 62 69 74 73 3c 2f 73 74 72  secret_bits</str
3290: 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c  ong> <em>n</em><
32a0: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64  /dt>.        <dd
32b0: 3e 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 73  >The number of s
32c0: 65 63 72 65 74 20 62 69 74 73 20 75 73 65 64 20  ecret bits used 
32d0: 66 6f 72 20 63 69 70 68 65 72 2e 3c 2f 64 64 3e  for cipher.</dd>
32e0: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74  .        <dt><st
32f0: 72 6f 6e 67 3e 6d 69 6e 5f 76 65 72 73 69 6f 6e  rong>min_version
3300: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 76 65  </strong> <em>ve
3310: 72 73 69 6f 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  rsion</em></dt>.
3320: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20          <dd>The 
3330: 6d 69 6e 69 6d 75 6d 20 70 72 6f 74 6f 63 6f 6c  minimum protocol
3340: 20 76 65 72 73 69 6f 6e 20 66 6f 72 20 63 69 70   version for cip
3350: 68 65 72 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20  her.</dd>.      
3360: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 64 65    <dt><strong>de
3370: 73 63 72 69 70 74 69 6f 6e 3c 2f 73 74 72 6f 6e  scription</stron
3380: 67 3e 20 3c 65 6d 3e 73 74 72 69 6e 67 3c 2f 65  g> <em>string</e
3390: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20  m></dt>.        
33a0: 3c 64 64 3e 41 20 74 65 78 74 20 64 65 73 63 72  <dd>A text descr
33b0: 69 70 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 69  iption of the ci
33c0: 70 68 65 72 2e 3c 2f 64 64 3e 0a 20 20 20 20 20  pher.</dd>.     
33d0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 72     <dt><strong>r
33e0: 65 6e 65 67 6f 74 69 61 74 69 6f 6e 3c 2f 73 74  enegotiation</st
33f0: 72 6f 6e 67 3e 20 3c 65 6d 3e 73 74 61 74 65 3c  rong> <em>state<
3400: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20  /em></dt>.      
3410: 20 20 3c 64 64 3e 57 68 65 74 68 65 72 20 70 72    <dd>Whether pr
3420: 6f 74 6f 63 6f 6c 20 72 65 6e 65 67 6f 74 69 61  otocol renegotia
3430: 74 69 6f 6e 20 69 73 20 61 6c 6c 6f 77 65 64 20  tion is allowed 
3440: 6f 72 20 64 69 73 61 6c 6c 6f 77 65 64 2e 3c 2f  or disallowed.</
3450: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e  dd>.        <dt>
3460: 3c 73 74 72 6f 6e 67 3e 61 6c 70 6e 3c 2f 73 74  <strong>alpn</st
3470: 72 6f 6e 67 3e 20 3c 65 6d 3e 70 72 6f 74 6f 63  rong> <em>protoc
3480: 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20  ol</em></dt>.   
3490: 20 20 20 20 20 3c 64 64 3e 54 68 65 20 70 72 6f       <dd>The pro
34a0: 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20 61  tocol selected a
34b0: 66 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f 6e  fter Application
34c0: 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c 0a  -Layer Protocol.
34d0: 09 20 20 20 20 4e 65 67 6f 74 69 61 74 69 6f 6e  .    Negotiation
34e0: 20 28 41 4c 50 4e 29 2e 3c 2f 64 64 3e 0a 20 20   (ALPN).</dd>.  
34f0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e        <dt><stron
3500: 67 3e 73 65 73 73 69 6f 6e 5f 72 65 75 73 65 64  g>session_reused
3510: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f  </strong> <em>bo
3520: 6f 6c 65 61 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a  olean</em></dt>.
3530: 20 20 20 20 20 20 20 20 3c 64 64 3e 57 68 65 74          <dd>Whet
3540: 68 65 72 20 74 68 65 20 73 65 73 73 69 6f 6e 20  her the session 
3550: 68 61 73 20 62 65 65 6e 20 72 65 75 73 65 64 20  has been reused 
3560: 6f 72 20 6e 6f 74 2e 3c 2f 64 64 3e 0a 20 20 20  or not.</dd>.   
3570: 20 3c 2f 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75   </dl>.</blockqu
3580: 6f 74 65 3e 0a 0a 20 20 20 20 3c 64 74 3e 3c 61  ote>..    <dt><a
3590: 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 63 69 70 68   name="tls::ciph
35a0: 65 72 73 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73  ers"><strong>tls
35b0: 3a 3a 63 69 70 68 65 72 73 3c 2f 73 74 72 6f 6e  ::ciphers</stron
35c0: 67 3e 20 0a 20 20 20 20 3c 65 6d 3e 70 72 6f 74  g> .    <em>prot
35d0: 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 3c 2f  ocol ?verbose?</
35e0: 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20  em></a></dt>.   
35f0: 20 3c 64 64 3e 52 65 74 75 72 6e 73 20 61 20 6c   <dd>Returns a l
3600: 69 73 74 20 6f 66 20 73 75 70 70 6f 72 74 65 64  ist of supported
3610: 20 63 69 70 68 65 72 73 20 61 76 61 69 6c 61 62   ciphers availab
3620: 6c 65 20 66 6f 72 20 3c 65 6d 3e 70 72 6f 74 6f  le for <em>proto
3630: 63 6f 6c 3c 2f 65 6d 3e 2c 0a 20 20 20 20 20 20  col</em>,.      
3640: 20 20 77 68 65 72 65 20 70 72 6f 74 6f 63 6f 6c    where protocol
3650: 20 6d 75 73 74 20 62 65 20 6f 6e 65 20 6f 66 20   must be one of 
3660: 3c 62 3e 73 73 6c 32 2c 20 73 73 6c 33 2c 20 74  <b>ssl2, ssl3, t
3670: 6c 73 31 2c 20 74 6c 73 31 2e 31 2c 0a 09 74 6c  ls1, tls1.1,..tl
3680: 73 31 2e 32 2c 3c 2f 62 3e 20 6f 72 20 3c 62 3e  s1.2,</b> or <b>
3690: 74 6c 73 31 2e 33 3c 2f 62 3e 2e 20 49 66 20 3c  tls1.3</b>. If <
36a0: 65 6d 3e 76 65 72 62 6f 73 65 3c 2f 65 6d 3e 20  em>verbose</em> 
36b0: 69 73 20 73 70 65 63 69 66 69 65 64 20 61 73 0a  is specified as.
36c0: 09 74 72 75 65 20 74 68 65 6e 20 61 20 76 65 72  .true then a ver
36d0: 62 6f 73 65 2c 20 68 75 6d 61 6e 20 72 65 61 64  bose, human read
36e0: 61 62 6c 65 20 6c 69 73 74 20 69 73 20 72 65 74  able list is ret
36f0: 75 72 6e 65 64 20 77 69 74 68 0a 09 61 64 64 69  urned with..addi
3700: 74 69 6f 6e 61 6c 20 69 6e 66 6f 72 6d 61 74 69  tional informati
3710: 6f 6e 20 6f 6e 20 74 68 65 20 63 69 70 68 65 72  on on the cipher
3720: 2e 3c 2f 64 64 3e 0a 0a 20 20 20 20 3c 64 74 3e  .</dd>..    <dt>
3730: 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 70 72  <a name="tls::pr
3740: 6f 74 6f 63 6f 6c 73 22 3e 3c 73 74 72 6f 6e 67  otocols"><strong
3750: 3e 74 6c 73 3a 3a 70 72 6f 74 6f 63 6f 6c 73 3c  >tls::protocols<
3760: 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 3c 2f 64 74  /strong></a></dt
3770: 3e 0a 20 20 20 20 3c 64 64 3e 52 65 74 75 72 6e  >.    <dd>Return
3780: 73 20 61 20 6c 69 73 74 20 6f 66 20 73 75 70 70  s a list of supp
3790: 6f 72 74 65 64 20 70 72 6f 74 6f 63 6f 6c 73 2e  orted protocols.
37a0: 20 56 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72   Valid values ar
37b0: 65 3a 0a 09 3c 62 3e 73 73 6c 32 3c 2f 62 3e 2c  e:..<b>ssl2</b>,
37c0: 20 3c 62 3e 73 73 6c 33 3c 2f 62 3e 2c 20 3c 62   <b>ssl3</b>, <b
37d0: 3e 74 6c 73 31 3c 2f 62 3e 2c 20 3c 62 3e 74 6c  >tls1</b>, <b>tl
37e0: 73 31 2e 31 3c 2f 62 3e 2c 20 3c 62 3e 74 6c 73  s1.1</b>, <b>tls
37f0: 31 2e 32 3c 2f 62 3e 2c 0a 09 61 6e 64 20 3c 62  1.2</b>,..and <b
3800: 3e 74 6c 73 31 2e 33 3c 2f 62 3e 2e 3c 2f 64 64  >tls1.3</b>.</dd
3810: 3e 0a 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61  >..    <dt><a na
3820: 6d 65 3d 22 74 6c 73 3a 3a 76 65 72 73 69 6f 6e  me="tls::version
3830: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 76  "><strong>tls::v
3840: 65 72 73 69 6f 6e 3c 2f 73 74 72 6f 6e 67 3e 3c  ersion</strong><
3850: 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64  /a></dt>.    <dd
3860: 3e 52 65 74 75 72 6e 73 20 74 68 65 20 4f 70 65  >Returns the Ope
3870: 6e 53 53 4c 20 76 65 72 73 69 6f 6e 20 73 74 72  nSSL version str
3880: 69 6e 67 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a  ing.</dd>.</dl>.
3890: 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 43 41  .<h3><a name="CA
38a0: 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 22 3e  LLBACK OPTIONS">
38b0: 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53  CALLBACK OPTIONS
38c0: 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 0a 41  </a></h3>..<p>.A
38d0: 73 20 69 6e 64 69 63 61 74 65 64 20 61 62 6f 76  s indicated abov
38e0: 65 2c 20 69 6e 64 69 76 69 64 75 61 6c 20 63 68  e, individual ch
38f0: 61 6e 6e 65 6c 73 20 63 61 6e 20 62 65 20 67 69  annels can be gi
3900: 76 65 6e 20 74 68 65 69 72 20 6f 77 6e 20 63 61  ven their own ca
3910: 6c 6c 62 61 63 6b 73 0a 74 6f 20 68 61 6e 64 6c  llbacks.to handl
3920: 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65 20 70  e intermediate p
3930: 72 6f 63 65 73 73 69 6e 67 20 62 79 20 74 68 65  rocessing by the
3940: 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79   OpenSSL library
3950: 2c 20 75 73 69 6e 67 20 74 68 65 0a 3c 65 6d 3e  , using the.<em>
3960: 2d 63 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e  -command</em> an
3970: 64 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c  d <em>-password<
3980: 2f 65 6d 3e 20 6f 70 74 69 6f 6e 73 20 70 61 73  /em> options pas
3990: 73 65 64 20 74 6f 20 65 69 74 68 65 72 20 6f 66  sed to either of
39a0: 0a 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f  .<strong>tls::so
39b0: 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 20 6f 72  cket</strong> or
39c0: 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 69 6d   <strong>tls::im
39d0: 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 2e 0a 3c  port</strong>..<
39e0: 2f 70 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65  /p>..<blockquote
39f0: 3e 0a 3c 64 6c 3e 0a 0a 20 20 20 20 3c 64 74 3e  >.<dl>..    <dt>
3a00: 3c 73 74 72 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e 64  <strong>-command
3a10: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 61  </strong> <em>ca
3a20: 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e  llback</em></dt>
3a30: 0a 20 20 20 20 3c 64 64 3e 0a 09 49 6e 76 6f 6b  .    <dd>..Invok
3a40: 65 73 20 74 68 65 20 73 70 65 63 69 66 69 65 64  es the specified
3a50: 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65   <em>callback</e
3a60: 6d 3e 20 73 63 72 69 70 74 20 61 74 0a 09 73 65  m> script at..se
3a70: 76 65 72 61 6c 20 70 6f 69 6e 74 73 20 64 75 72  veral points dur
3a80: 69 6e 67 20 74 68 65 20 4f 70 65 6e 53 53 4c 20  ing the OpenSSL 
3a90: 68 61 6e 64 73 68 61 6b 65 2e 0a 09 45 78 63 65  handshake...Exce
3aa0: 70 74 20 61 73 20 69 6e 64 69 63 61 74 65 64 20  pt as indicated 
3ab0: 62 65 6c 6f 77 2c 20 76 61 6c 75 65 73 20 72 65  below, values re
3ac0: 74 75 72 6e 65 64 20 66 72 6f 6d 20 74 68 65 0a  turned from the.
3ad0: 09 63 61 6c 6c 62 61 63 6b 20 61 72 65 20 69 67  .callback are ig
3ae0: 6e 6f 72 65 64 2e 0a 09 41 72 67 75 6d 65 6e 74  nored...Argument
3af0: 73 20 61 70 70 65 6e 64 65 64 20 74 6f 20 74 68  s appended to th
3b00: 65 20 73 63 72 69 70 74 20 75 70 6f 6e 20 63 61  e script upon ca
3b10: 6c 6c 62 61 63 6b 20 74 61 6b 65 20 6f 6e 65 20  llback take one 
3b20: 6f 66 20 74 68 65 0a 09 66 6f 6c 6c 6f 77 69 6e  of the..followin
3b30: 67 20 66 6f 72 6d 73 3a 0a 0a 09 3c 62 72 3e 0a  g forms:...<br>.
3b40: 09 3c 62 72 3e 0a 0a 09 3c 64 6c 3e 0a 0a 3c 21  .<br>...<dl>..<!
3b50: 2d 2d 09 54 68 69 73 20 66 6f 72 6d 20 6f 66 20  --.This form of 
3b60: 63 61 6c 6c 62 61 63 6b 20 69 73 20 64 69 73 61  callback is disa
3b70: 62 6c 65 64 2e 0a 0a 09 3c 64 74 3e 0a 09 20 20  bled....<dt>..  
3b80: 3c 73 74 72 6f 6e 67 3e 65 72 72 6f 72 3c 2f 73  <strong>error</s
3b90: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e  trong> <em>chann
3ba0: 65 6c 20 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 0a  el message</em>.
3bb0: 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e 0a 09 20 20  .</dt>..<dd>..  
3bc0: 54 68 65 20 3c 65 6d 3e 6d 65 73 73 61 67 65 3c  The <em>message<
3bd0: 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 63 6f  /em> argument co
3be0: 6e 74 61 69 6e 73 20 61 6e 20 65 72 72 6f 72 20  ntains an error 
3bf0: 6d 65 73 73 61 67 65 20 67 65 6e 65 72 61 74 65  message generate
3c00: 64 0a 09 20 20 62 79 20 74 68 65 20 4f 70 65 6e  d..  by the Open
3c10: 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 09 20 20  SSL function..  
3c20: 3c 63 6f 64 65 3e 45 52 52 5f 72 65 61 73 6f 6e  <code>ERR_reason
3c30: 5f 65 72 72 6f 72 5f 73 74 72 69 6e 67 28 29 3c  _error_string()<
3c40: 2f 63 6f 64 65 3e 2e 0a 09 3c 2f 64 64 3e 0a 0a  /code>...</dd>..
3c50: 09 3c 62 72 3e 0a 2d 2d 3e 0a 0a 09 3c 64 74 3e  .<br>.-->...<dt>
3c60: 0a 09 20 20 3c 73 74 72 6f 6e 67 3e 69 6e 66 6f  ..  <strong>info
3c70: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68  </strong> <em>ch
3c80: 61 6e 6e 65 6c 20 6d 61 6a 6f 72 20 6d 69 6e 6f  annel major mino
3c90: 72 20 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 0a 09  r message</em>..
3ca0: 3c 2f 64 74 3e 0a 09 3c 64 64 3e 0a 09 20 20 54  </dt>..<dd>..  T
3cb0: 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c  his form of call
3cc0: 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20  back is invoked 
3cd0: 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66  by the OpenSSL f
3ce0: 75 6e 63 74 69 6f 6e 0a 09 20 20 3c 63 6f 64 65  unction..  <code
3cf0: 3e 53 53 4c 5f 43 54 58 5f 73 65 74 5f 69 6e 66  >SSL_CTX_set_inf
3d00: 6f 5f 63 61 6c 6c 62 61 63 6b 28 29 3c 2f 63 6f  o_callback()</co
3d10: 64 65 3e 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20  de>...  <br>..  
3d20: 54 68 65 20 3c 65 6d 3e 6d 61 6a 6f 72 3c 2f 65  The <em>major</e
3d30: 6d 3e 20 61 6e 64 20 3c 65 6d 3e 6d 69 6e 6f 72  m> and <em>minor
3d40: 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 73 20  </em> arguments 
3d50: 61 72 65 20 75 73 65 64 20 74 6f 0a 09 20 20 72  are used to..  r
3d60: 65 70 72 65 73 65 6e 74 20 74 68 65 20 73 74 61  epresent the sta
3d70: 74 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 62  te information b
3d80: 69 74 6d 61 73 6b 2e 0a 09 20 20 3c 64 6c 3e 0a  itmask...  <dl>.
3d90: 09 20 20 3c 64 74 3e 50 6f 73 73 69 62 6c 65 20  .  <dt>Possible 
3da0: 76 61 6c 75 65 73 20 66 6f 72 20 3c 65 6d 3e 6d  values for <em>m
3db0: 61 6a 6f 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f  ajor</em> are:</
3dc0: 64 74 3e 0a 09 20 20 3c 64 64 3e 3c 63 6f 64 65  dt>..  <dd><code
3dd0: 3e 68 61 6e 64 73 68 61 6b 65 2c 20 61 6c 65 72  >handshake, aler
3de0: 74 2c 20 63 6f 6e 6e 65 63 74 2c 20 61 63 63 65  t, connect, acce
3df0: 70 74 3c 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a  pt</code>.</dd>.
3e00: 09 20 20 3c 64 74 3e 50 6f 73 73 69 62 6c 65 20  .  <dt>Possible 
3e10: 76 61 6c 75 65 73 20 66 6f 72 20 3c 65 6d 3e 6d  values for <em>m
3e20: 69 6e 6f 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f  inor</em> are:</
3e30: 64 74 3e 0a 09 20 20 3c 64 64 3e 3c 63 6f 64 65  dt>..  <dd><code
3e40: 3e 73 74 61 72 74 2c 20 64 6f 6e 65 2c 20 72 65  >start, done, re
3e50: 61 64 2c 20 77 72 69 74 65 2c 20 6c 6f 6f 70 2c  ad, write, loop,
3e60: 20 65 78 69 74 3c 2f 63 6f 64 65 3e 2e 3c 2f 64   exit</code>.</d
3e70: 64 3e 0a 09 20 20 3c 2f 64 6c 3e 0a 09 20 20 54  d>..  </dl>..  T
3e80: 68 65 20 3c 65 6d 3e 6d 65 73 73 61 67 65 3c 2f  he <em>message</
3e90: 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 69 73 20  em> argument is 
3ea0: 61 20 64 65 73 63 72 69 70 74 69 76 65 20 73 74  a descriptive st
3eb0: 72 69 6e 67 20 77 68 69 63 68 20 6d 61 79 0a 09  ring which may..
3ec0: 20 20 62 65 20 67 65 6e 65 72 61 74 65 64 20 65    be generated e
3ed0: 69 74 68 65 72 20 62 79 0a 09 20 20 3c 63 6f 64  ither by..  <cod
3ee0: 65 3e 53 53 4c 5f 73 74 61 74 65 5f 73 74 72 69  e>SSL_state_stri
3ef0: 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e  ng_long()</code>
3f00: 20 6f 72 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e   or by..  <code>
3f10: 53 53 4c 5f 61 6c 65 72 74 5f 64 65 73 63 5f 73  SSL_alert_desc_s
3f20: 74 72 69 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63 6f  tring_long()</co
3f30: 64 65 3e 2c 0a 09 20 20 64 65 70 65 6e 64 69 6e  de>,..  dependin
3f40: 67 20 6f 6e 20 63 6f 6e 74 65 78 74 2e 0a 09 3c  g on context...<
3f50: 2f 64 64 3e 0a 0a 09 3c 62 72 3e 0a 0a 09 3c 64  /dd>...<br>...<d
3f60: 74 3e 0a 09 20 20 3c 73 74 72 6f 6e 67 3e 76 65  t>..  <strong>ve
3f70: 72 69 66 79 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65  rify</strong> <e
3f80: 6d 3e 63 68 61 6e 6e 65 6c 20 64 65 70 74 68 20  m>channel depth 
3f90: 63 65 72 74 20 73 74 61 74 75 73 20 65 72 72 6f  cert status erro
3fa0: 72 3c 2f 65 6d 3e 0a 09 3c 2f 64 74 3e 0a 09 3c  r</em>..</dt>..<
3fb0: 64 64 3e 0a 09 20 20 54 68 69 73 20 66 6f 72 6d  dd>..  This form
3fc0: 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 69 73 20   of callback is 
3fd0: 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 65 20 4f  invoked by the O
3fe0: 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a  penSSL function.
3ff0: 09 20 20 3c 63 6f 64 65 3e 53 53 4c 5f 73 65 74  .  <code>SSL_set
4000: 5f 76 65 72 69 66 79 28 29 3c 2f 63 6f 64 65 3e  _verify()</code>
4010: 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65  ...  <br>..  The
4020: 20 3c 65 6d 3e 64 65 70 74 68 3c 2f 65 6d 3e 20   <em>depth</em> 
4030: 61 72 67 75 6d 65 6e 74 20 69 73 20 61 6e 20 69  argument is an i
4040: 6e 74 65 67 65 72 20 72 65 70 72 65 73 65 6e 74  nteger represent
4050: 69 6e 67 20 74 68 65 0a 09 20 20 63 75 72 72 65  ing the..  curre
4060: 6e 74 20 64 65 70 74 68 20 6f 6e 20 74 68 65 20  nt depth on the 
4070: 63 65 72 74 69 66 69 63 61 74 65 20 63 68 61 69  certificate chai
4080: 6e 2c 20 77 69 74 68 0a 09 20 20 3c 63 6f 64 65  n, with..  <code
4090: 3e 30 3c 2f 63 6f 64 65 3e 20 61 73 20 74 68 65  >0</code> as the
40a0: 20 73 75 62 6a 65 63 74 20 63 65 72 74 69 66 69   subject certifi
40b0: 63 61 74 65 20 61 6e 64 20 68 69 67 68 65 72 20  cate and higher 
40c0: 76 61 6c 75 65 73 0a 09 20 20 64 65 6e 6f 74 69  values..  denoti
40d0: 6e 67 20 70 72 6f 67 72 65 73 73 69 76 65 6c 79  ng progressively
40e0: 20 6d 6f 72 65 20 69 6e 64 69 72 65 63 74 20 69   more indirect i
40f0: 73 73 75 65 72 20 63 65 72 74 69 66 69 63 61 74  ssuer certificat
4100: 65 73 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54  es...  <br>..  T
4110: 68 65 20 3c 65 6d 3e 63 65 72 74 3c 2f 65 6d 3e  he <em>cert</em>
4120: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20 6c   argument is a l
4130: 69 73 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65  ist of key-value
4140: 20 70 61 69 72 73 20 73 69 6d 69 6c 61 72 0a 09   pairs similar..
4150: 20 20 74 6f 20 74 68 6f 73 65 20 72 65 74 75 72    to those retur
4160: 6e 65 64 20 62 79 0a 09 20 20 3c 61 20 68 72 65  ned by..  <a hre
4170: 66 3d 22 23 74 6c 73 3a 3a 73 74 61 74 75 73 22  f="#tls::status"
4180: 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 74  ><strong>tls::st
4190: 61 74 75 73 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61  atus</strong></a
41a0: 3e 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68  >...  <br>..  Th
41b0: 65 20 3c 65 6d 3e 73 74 61 74 75 73 3c 2f 65 6d  e <em>status</em
41c0: 3e 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 6e  > argument is an
41d0: 20 69 6e 74 65 67 65 72 20 72 65 70 72 65 73 65   integer represe
41e0: 6e 74 69 6e 67 20 74 68 65 0a 09 20 20 63 75 72  nting the..  cur
41f0: 72 65 6e 74 20 76 61 6c 69 64 69 74 79 20 6f 66  rent validity of
4200: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65   the certificate
4210: 2e 0a 09 20 20 41 20 76 61 6c 75 65 20 6f 66 20  ...  A value of 
4220: 3c 63 6f 64 65 3e 30 3c 2f 63 6f 64 65 3e 20 6d  <code>0</code> m
4230: 65 61 6e 73 20 74 68 65 20 63 65 72 74 69 66 69  eans the certifi
4240: 63 61 74 65 20 69 73 20 64 65 65 6d 65 64 20 69  cate is deemed i
4250: 6e 76 61 6c 69 64 2e 0a 09 20 20 41 20 76 61 6c  nvalid...  A val
4260: 75 65 20 6f 66 20 3c 63 6f 64 65 3e 31 3c 2f 63  ue of <code>1</c
4270: 6f 64 65 3e 20 6d 65 61 6e 73 20 74 68 65 20 63  ode> means the c
4280: 65 72 74 69 66 69 63 61 74 65 20 69 73 20 64 65  ertificate is de
4290: 65 6d 65 64 20 76 61 6c 69 64 2e 0a 09 20 20 3c  emed valid...  <
42a0: 62 72 3e 0a 09 20 20 54 68 65 20 3c 65 6d 3e 65  br>..  The <em>e
42b0: 72 72 6f 72 3c 2f 65 6d 3e 20 61 72 67 75 6d 65  rror</em> argume
42c0: 6e 74 20 73 75 70 70 6c 69 65 73 20 74 68 65 20  nt supplies the 
42d0: 6d 65 73 73 61 67 65 2c 20 69 66 20 61 6e 79 2c  message, if any,
42e0: 20 67 65 6e 65 72 61 74 65 64 0a 09 20 20 62 79   generated..  by
42f0: 0a 09 20 20 3c 63 6f 64 65 3e 58 35 30 39 5f 53  ..  <code>X509_S
4300: 54 4f 52 45 5f 43 54 58 5f 67 65 74 5f 65 72 72  TORE_CTX_get_err
4310: 6f 72 28 29 3c 2f 63 6f 64 65 3e 2e 0a 09 20 20  or()</code>...  
4320: 3c 62 72 3e 0a 09 20 20 3c 62 72 3e 0a 09 20 20  <br>..  <br>..  
4330: 54 68 65 20 63 61 6c 6c 62 61 63 6b 20 6d 61 79  The callback may
4340: 20 6f 76 65 72 72 69 64 65 20 6e 6f 72 6d 61 6c   override normal
4350: 20 76 61 6c 69 64 61 74 69 6f 6e 20 70 72 6f 63   validation proc
4360: 65 73 73 69 6e 67 20 62 79 20 65 78 70 6c 69 63  essing by explic
4370: 69 74 6c 79 0a 09 20 20 72 65 74 75 72 6e 69 6e  itly..  returnin
4380: 67 20 6f 6e 65 20 6f 66 20 74 68 65 20 61 62 6f  g one of the abo
4390: 76 65 20 3c 65 6d 3e 73 74 61 74 75 73 3c 2f 65  ve <em>status</e
43a0: 6d 3e 20 76 61 6c 75 65 73 2e 0a 09 3c 2f 64 64  m> values...</dd
43b0: 3e 0a 0a 09 3c 2f 64 6c 3e 0a 20 20 20 20 3c 2f  >...</dl>.    </
43c0: 64 64 3e 0a 0a 20 20 20 20 3c 62 72 3e 0a 0a 20  dd>..    <br>.. 
43d0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d     <dt><strong>-
43e0: 70 61 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67  password</strong
43f0: 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f  > <em>callback</
4400: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64  em></dt>.    <dd
4410: 3e 0a 09 49 6e 76 6f 6b 65 73 20 74 68 65 20 73  >..Invokes the s
4420: 70 65 63 69 66 69 65 64 20 3c 65 6d 3e 63 61 6c  pecified <em>cal
4430: 6c 62 61 63 6b 3c 2f 65 6d 3e 20 73 63 72 69 70  lback</em> scrip
4440: 74 20 77 68 65 6e 20 4f 70 65 6e 53 53 4c 20 6e  t when OpenSSL n
4450: 65 65 64 73 20 74 6f 0a 09 6f 62 74 61 69 6e 20  eeds to..obtain 
4460: 61 20 70 61 73 73 77 6f 72 64 2e 20 20 54 68 65  a password.  The
4470: 20 63 61 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64   callback should
4480: 20 72 65 74 75 72 6e 20 61 20 73 74 72 69 6e 67   return a string
4490: 20 77 68 69 63 68 0a 09 72 65 70 72 65 73 65 6e   which..represen
44a0: 74 73 20 74 68 65 20 70 61 73 73 77 6f 72 64 20  ts the password 
44b0: 74 6f 20 62 65 20 75 73 65 64 2e 0a 09 4e 6f 20  to be used...No 
44c0: 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 61 70  arguments are ap
44d0: 70 65 6e 64 65 64 20 74 6f 20 74 68 65 20 73 63  pended to the sc
44e0: 72 69 70 74 20 75 70 6f 6e 20 63 61 6c 6c 62 61  ript upon callba
44f0: 63 6b 2e 0a 20 20 20 20 3c 2f 64 64 3e 0a 3c 2f  ck..    </dd>.</
4500: 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65  dl>.</blockquote
4510: 3e 0a 0a 3c 70 3e 0a 52 65 66 65 72 65 6e 63 65  >..<p>.Reference
4520: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73   implementations
4530: 20 6f 66 20 74 68 65 73 65 20 63 61 6c 6c 62 61   of these callba
4540: 63 6b 73 20 61 72 65 20 70 72 6f 76 69 64 65 64  cks are provided
4550: 20 69 6e 20 74 68 65 0a 64 69 73 74 72 69 62 75   in the.distribu
4560: 74 69 6f 6e 20 61 73 20 3c 73 74 72 6f 6e 67 3e  tion as <strong>
4570: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73  tls::callback</s
4580: 74 72 6f 6e 67 3e 20 61 6e 64 0a 3c 73 74 72 6f  trong> and.<stro
4590: 6e 67 3e 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64  ng>tls::password
45a0: 3c 2f 73 74 72 6f 6e 67 3e 20 72 65 73 70 65 63  </strong> respec
45b0: 74 69 76 65 6c 79 2e 20 20 4e 6f 74 65 20 74 68  tively.  Note th
45c0: 61 74 20 74 68 65 73 65 20 61 72 65 0a 3c 65 6d  at these are.<em
45d0: 3e 73 61 6d 70 6c 65 3c 2f 65 6d 3e 20 69 6d 70  >sample</em> imp
45e0: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 6e 6c  lementations onl
45f0: 79 2e 20 20 49 6e 20 61 20 6d 6f 72 65 20 72 65  y.  In a more re
4600: 61 6c 69 73 74 69 63 20 64 65 70 6c 6f 79 6d 65  alistic deployme
4610: 6e 74 0a 79 6f 75 20 77 6f 75 6c 64 20 73 70 65  nt.you would spe
4620: 63 69 66 79 20 79 6f 75 72 20 6f 77 6e 20 63 61  cify your own ca
4630: 6c 6c 62 61 63 6b 20 73 63 72 69 70 74 73 20 6f  llback scripts o
4640: 6e 20 65 61 63 68 20 54 4c 53 20 63 68 61 6e 6e  n each TLS chann
4650: 65 6c 0a 75 73 69 6e 67 20 74 68 65 20 3c 65 6d  el.using the <em
4660: 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61  >-command</em> a
4670: 6e 64 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64  nd <em>-password
4680: 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 73 2e 0a 3c  </em> options..<
4690: 2f 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20 64 65 66  /p>..<p>.The def
46a0: 61 75 6c 74 20 62 65 68 61 76 69 6f 72 20 77 68  ault behavior wh
46b0: 65 6e 20 74 68 65 20 3c 65 6d 3e 2d 63 6f 6d 6d  en the <em>-comm
46c0: 61 6e 64 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 20  and</em> option 
46d0: 69 73 20 6e 6f 74 20 73 70 65 63 69 66 69 65 64  is not specified
46e0: 20 69 73 20 66 6f 72 0a 54 4c 53 20 74 6f 20 70   is for.TLS to p
46f0: 72 6f 63 65 73 73 20 74 68 65 20 61 73 73 6f 63  rocess the assoc
4700: 69 61 74 65 64 20 6c 69 62 72 61 72 79 20 63 61  iated library ca
4710: 6c 6c 62 61 63 6b 73 20 69 6e 74 65 72 6e 61 6c  llbacks internal
4720: 6c 79 2e 0a 54 68 65 20 64 65 66 61 75 6c 74 20  ly..The default 
4730: 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68  behavior when th
4740: 65 20 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c  e <em>-password<
4750: 2f 65 6d 3e 20 6f 70 74 69 6f 6e 20 69 73 20 6e  /em> option is n
4760: 6f 74 20 73 70 65 63 69 66 69 65 64 20 69 73 20  ot specified is 
4770: 66 6f 72 0a 54 4c 53 20 74 6f 20 70 72 6f 63 65  for.TLS to proce
4780: 73 73 20 74 68 65 20 61 73 73 6f 63 69 61 74 65  ss the associate
4790: 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62 61  d library callba
47a0: 63 6b 73 20 62 79 20 61 74 74 65 6d 70 74 69 6e  cks by attemptin
47b0: 67 20 74 6f 20 63 61 6c 6c 0a 3c 73 74 72 6f 6e  g to call.<stron
47c0: 67 3e 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c  g>tls::password<
47d0: 2f 73 74 72 6f 6e 67 3e 2e 0a 54 68 65 20 64 69  /strong>..The di
47e0: 66 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e  fference between
47f0: 20 74 68 65 73 65 20 74 77 6f 20 62 65 68 61 76   these two behav
4800: 69 6f 72 73 20 69 73 20 61 20 63 6f 6e 73 65 71  iors is a conseq
4810: 75 65 6e 63 65 20 6f 66 20 6d 61 69 6e 74 61 69  uence of maintai
4820: 6e 69 6e 67 0a 63 6f 6d 70 61 74 69 62 69 6c 69  ning.compatibili
4830: 74 79 20 77 69 74 68 20 65 61 72 6c 69 65 72 20  ty with earlier 
4840: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e  implementations.
4850: 0a 3c 2f 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20 3c  .</p>..<p>.The <
4860: 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62 75  strong>tls::debu
4870: 67 3c 2f 73 74 72 6f 6e 67 3e 20 76 61 72 69 61  g</strong> varia
4880: 62 6c 65 20 70 72 6f 76 69 64 65 73 20 73 6f 6d  ble provides som
4890: 65 20 61 64 64 69 74 69 6f 6e 61 6c 0a 63 6f 6e  e additional.con
48a0: 74 72 6f 6c 20 6f 76 65 72 20 74 68 65 73 65 20  trol over these 
48b0: 72 65 66 65 72 65 6e 63 65 20 63 61 6c 6c 62 61  reference callba
48c0: 63 6b 73 2e 20 20 49 74 73 20 76 61 6c 75 65 20  cks.  Its value 
48d0: 69 73 20 7a 65 72 6f 20 62 79 20 64 65 66 61 75  is zero by defau
48e0: 6c 74 2e 0a 48 69 67 68 65 72 20 76 61 6c 75 65  lt..Higher value
48f0: 73 20 70 72 6f 64 75 63 65 20 6d 6f 72 65 20 64  s produce more d
4900: 69 61 67 6e 6f 73 74 69 63 20 6f 75 74 70 75 74  iagnostic output
4910: 2c 20 61 6e 64 20 77 69 6c 6c 20 61 6c 73 6f 20  , and will also 
4920: 66 6f 72 63 65 20 74 68 65 0a 76 65 72 69 66 79  force the.verify
4930: 20 6d 65 74 68 6f 64 20 69 6e 20 3c 73 74 72 6f   method in <stro
4940: 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b  ng>tls::callback
4950: 3c 2f 73 74 72 6f 6e 67 3e 20 74 6f 20 61 63 63  </strong> to acc
4960: 65 70 74 20 74 68 65 0a 63 65 72 74 69 66 69 63  ept the.certific
4970: 61 74 65 2c 20 65 76 65 6e 20 77 68 65 6e 20 69  ate, even when i
4980: 74 20 69 73 20 69 6e 76 61 6c 69 64 2e 0a 3c 2f  t is invalid..</
4990: 70 3e 0a 0a 3c 70 3e 0a 3c 65 6d 3e 0a 54 68 65  p>..<p>.<em>.The
49a0: 20 75 73 65 20 6f 66 20 74 68 65 20 72 65 66 65   use of the refe
49b0: 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73 20  rence callbacks 
49c0: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c  <strong>tls::cal
49d0: 6c 62 61 63 6b 3c 2f 73 74 72 6f 6e 67 3e 20 61  lback</strong> a
49e0: 6e 64 0a 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a  nd.<strong>tls::
49f0: 70 61 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67  password</strong
4a00: 3e 20 69 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65  > is not recomme
4a10: 6e 64 65 64 2e 20 20 54 68 65 79 20 6d 61 79 20  nded.  They may 
4a20: 62 65 20 72 65 6d 6f 76 65 64 0a 66 72 6f 6d 20  be removed.from 
4a30: 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 73 2e  future releases.
4a40: 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 70 3e  .</em>.</p>..<p>
4a50: 0a 3c 65 6d 3e 0a 54 68 65 20 75 73 65 20 6f 66  .<em>.The use of
4a60: 20 74 68 65 20 76 61 72 69 61 62 6c 65 20 3c 73   the variable <s
4a70: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62 75 67  trong>tls::debug
4a80: 3c 2f 73 74 72 6f 6e 67 3e 20 69 73 20 6e 6f 74  </strong> is not
4a90: 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49 74   recommended..It
4aa0: 20 6d 61 79 20 62 65 20 72 65 6d 6f 76 65 64 20   may be removed 
4ab0: 66 72 6f 6d 20 66 75 74 75 72 65 20 72 65 6c 65  from future rele
4ac0: 61 73 65 73 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e  ases..</em>.</p>
4ad0: 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 44  ..<h3><a name="D
4ae0: 45 42 55 47 22 3e 44 45 42 55 47 3c 2f 61 3e 3c  EBUG">DEBUG</a><
4af0: 2f 68 33 3e 0a 0a 54 4c 53 20 6b 65 79 20 6c 6f  /h3>..TLS key lo
4b00: 67 67 69 6e 67 20 63 61 6e 20 62 65 20 65 6e 61  gging can be ena
4b10: 62 6c 65 64 20 62 79 20 73 65 74 74 69 6e 67 20  bled by setting 
4b20: 74 68 65 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 20  the environment 
4b30: 76 61 72 69 61 62 6c 65 0a 3c 62 3e 53 53 4c 4b  variable.<b>SSLK
4b40: 45 59 4c 4f 47 46 49 4c 45 3c 2f 62 3e 20 74 6f  EYLOGFILE</b> to
4b50: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65   the name of the
4b60: 20 66 69 6c 65 20 74 6f 20 6c 6f 67 20 74 6f 2e   file to log to.
4b70: 20 54 68 65 6e 20 77 68 65 6e 65 76 65 72 20 54   Then whenever T
4b80: 4c 53 0a 6b 65 79 20 6d 61 74 65 72 69 61 6c 20  LS.key material 
4b90: 69 73 20 67 65 6e 65 72 61 74 65 64 20 6f 72 20  is generated or 
4ba0: 72 65 63 65 69 76 65 64 20 69 74 20 77 69 6c 6c  received it will
4bb0: 20 62 65 20 6c 6f 67 67 65 64 20 74 6f 20 74 68   be logged to th
4bc0: 65 20 66 69 6c 65 2e 0a 0a 3c 68 33 3e 3c 61 20  e file...<h3><a 
4bd0: 6e 61 6d 65 3d 22 48 54 54 50 53 20 45 58 41 4d  name="HTTPS EXAM
4be0: 50 4c 45 22 3e 48 54 54 50 53 20 45 58 41 4d 50  PLE">HTTPS EXAMP
4bf0: 4c 45 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e  LE</a></h3>..<p>
4c00: 54 68 69 73 20 65 78 61 6d 70 6c 65 20 75 73 65  This example use
4c10: 73 20 61 20 73 61 6d 70 6c 65 20 73 65 72 76 65  s a sample serve
4c20: 72 2e 70 65 6d 20 70 72 6f 76 69 64 65 64 20 77  r.pem provided w
4c30: 69 74 68 20 74 68 65 20 54 4c 53 20 72 65 6c 65  ith the TLS rele
4c40: 61 73 65 2c 0a 63 6f 75 72 74 65 73 79 20 6f 66  ase,.courtesy of
4c50: 20 74 68 65 20 3c 73 74 72 6f 6e 67 3e 4f 70 65   the <strong>Ope
4c60: 6e 53 53 4c 3c 2f 73 74 72 6f 6e 67 3e 20 70 72  nSSL</strong> pr
4c70: 6f 6a 65 63 74 2e 3c 2f 70 3e 0a 0a 3c 70 72 65  oject.</p>..<pre
4c80: 3e 3c 63 6f 64 65 3e 0a 70 61 63 6b 61 67 65 20  ><code>.package 
4c90: 72 65 71 75 69 72 65 20 68 74 74 70 0a 70 61 63  require http.pac
4ca0: 6b 61 67 65 20 72 65 71 75 69 72 65 20 74 6c 73  kage require tls
4cb0: 0a 0a 68 74 74 70 3a 3a 72 65 67 69 73 74 65 72  ..http::register
4cc0: 20 68 74 74 70 73 20 34 34 33 20 5b 6c 69 73 74   https 443 [list
4cd0: 20 3a 3a 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 2d   ::tls::socket -
4ce0: 61 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 20 74  autoservername t
4cf0: 72 75 65 20 2d 72 65 71 75 69 72 65 20 74 72 75  rue -require tru
4d00: 65 20 2d 63 61 64 69 72 20 2f 65 74 63 2f 73 73  e -cadir /etc/ss
4d10: 6c 2f 63 65 72 74 73 5d 0a 0a 73 65 74 20 74 6f  l/certs]..set to
4d20: 6b 20 5b 68 74 74 70 3a 3a 67 65 74 75 72 6c 20  k [http::geturl 
4d30: 68 74 74 70 73 3a 2f 2f 77 77 77 2e 74 63 6c 2e  https://www.tcl.
4d40: 74 6b 2f 5d 0a 3c 2f 63 6f 64 65 3e 3c 2f 70 72  tk/].</code></pr
4d50: 65 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d  e>..<h3><a name=
4d60: 22 53 50 45 43 49 41 4c 20 43 4f 4e 53 49 44 45  "SPECIAL CONSIDE
4d70: 52 41 54 49 4f 4e 53 22 3e 53 50 45 43 49 41 4c  RATIONS">SPECIAL
4d80: 20 43 4f 4e 53 49 44 45 52 41 54 49 4f 4e 53 3c   CONSIDERATIONS<
4d90: 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 65  /a></h3>..<p>The
4da0: 20 63 61 70 61 62 69 6c 69 74 69 65 73 20 6f 66   capabilities of
4db0: 20 74 68 69 73 20 70 61 63 6b 61 67 65 20 63 61   this package ca
4dc0: 6e 20 76 61 72 79 20 65 6e 6f 72 6d 6f 75 73 6c  n vary enormousl
4dd0: 79 20 62 61 73 65 64 0a 75 70 6f 6e 20 68 6f 77  y based.upon how
4de0: 20 79 6f 75 72 20 4f 70 65 6e 53 53 4c 20 6c 69   your OpenSSL li
4df0: 62 72 61 72 79 20 77 61 73 20 63 6f 6e 66 69 67  brary was config
4e00: 75 72 65 64 20 61 6e 64 20 62 75 69 6c 74 2e 20  ured and built. 
4e10: 41 74 20 74 68 65 0a 6d 6f 73 74 20 6d 61 63 72  At the.most macr
4e20: 6f 2d 6c 65 76 65 6c 20 4f 70 65 6e 53 53 4c 20  o-level OpenSSL 
4e30: 73 75 70 70 6f 72 74 73 20 61 20 26 71 75 6f 74  supports a &quot
4e40: 3b 6e 6f 20 70 61 74 65 6e 74 73 26 71 75 6f 74  ;no patents&quot
4e50: 3b 20 62 75 69 6c 64 2c 0a 77 68 69 63 68 20 64  ; build,.which d
4e60: 69 73 61 62 6c 65 73 20 52 53 41 2c 20 49 44 45  isables RSA, IDE
4e70: 41 2c 20 52 43 28 32 2c 34 2c 35 29 20 61 6e 64  A, RC(2,4,5) and
4e80: 20 53 53 4c 32 20 2d 20 69 66 20 79 6f 75 72 20   SSL2 - if your 
4e90: 4f 70 65 6e 53 53 4c 20 69 73 0a 63 6f 6e 66 69  OpenSSL is.confi
4ea0: 67 75 72 65 64 20 74 68 69 73 20 77 61 79 20 74  gured this way t
4eb0: 68 65 6e 20 79 6f 75 20 77 69 6c 6c 20 6e 65 65  hen you will nee
4ec0: 64 20 74 6f 20 62 75 69 6c 64 20 54 4c 53 20 77  d to build TLS w
4ed0: 69 74 68 20 74 68 65 0a 2d 44 4e 4f 5f 50 41 54  ith the.-DNO_PAT
4ee0: 45 4e 54 53 20 6f 70 74 69 6f 6e 20 2d 20 61 6e  ENTS option - an
4ef0: 64 20 74 68 65 20 72 65 73 75 6c 74 61 6e 74 20  d the resultant 
4f00: 6d 6f 64 75 6c 65 20 77 69 6c 6c 20 66 75 6e 63  module will func
4f10: 74 69 6f 6e 0a 63 6f 72 72 65 63 74 6c 79 20 61  tion.correctly a
4f20: 6e 64 20 61 6c 73 6f 20 73 75 70 70 6f 72 74 20  nd also support 
4f30: 41 44 48 20 63 65 72 74 69 66 69 63 61 74 65 2d  ADH certificate-
4f40: 6c 65 73 73 20 65 6e 63 72 79 70 74 69 6f 6e 2c  less encryption,
4f50: 0a 68 6f 77 65 76 65 72 20 79 6f 75 20 77 69 6c  .however you wil
4f60: 6c 20 62 65 20 75 6e 61 62 6c 65 20 74 6f 20 75  l be unable to u
4f70: 74 69 6c 69 7a 65 20 74 68 69 73 20 74 6f 20 73  tilize this to s
4f80: 70 65 61 6b 20 74 6f 20 6e 6f 72 6d 61 6c 20 57  peak to normal W
4f90: 65 62 0a 53 65 72 76 65 72 73 2c 20 77 68 69 63  eb.Servers, whic
4fa0: 68 20 74 79 70 69 63 61 6c 6c 79 20 72 65 71 75  h typically requ
4fb0: 69 72 65 20 52 53 41 20 73 75 70 70 6f 72 74 2e  ire RSA support.
4fc0: 20 50 6c 65 61 73 65 20 73 65 65 20 3c 61 0a 68   Please see <a.h
4fd0: 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e  ref="http://www.
4fe0: 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 68 74  openssl.org/">ht
4ff0: 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73 73 6c  tp://www.openssl
5000: 2e 6f 72 67 2f 3c 2f 61 3e 20 66 6f 72 0a 6d 6f  .org/</a> for.mo
5010: 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f  re information o
5020: 6e 20 74 68 65 20 77 68 6f 6c 65 20 69 73 73 75  n the whole issu
5030: 65 20 6f 66 20 70 61 74 65 6e 74 73 20 61 6e 64  e of patents and
5040: 20 55 53 20 65 78 70 6f 72 74 0a 72 65 73 74 72   US export.restr
5050: 69 63 74 69 6f 6e 73 2e 20 3c 2f 70 3e 0a 0a 3c  ictions. </p>..<
5060: 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 45 45 20  h3><a name="SEE 
5070: 41 4c 53 4f 22 3e 53 45 45 20 41 4c 53 4f 3c 2f  ALSO">SEE ALSO</
5080: 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 3c 73 74 72  a></h3>..<p><str
5090: 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 74 72 6f  ong>socket</stro
50a0: 6e 67 3e 2c 20 3c 73 74 72 6f 6e 67 3e 66 69 6c  ng>, <strong>fil
50b0: 65 65 76 65 6e 74 2c 20 3c 2f 73 74 72 6f 6e 67  eevent, </strong
50c0: 3e 3c 61 0a 68 72 65 66 3d 22 68 74 74 70 3a 2f  ><a.href="http:/
50d0: 2f 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67  /www.openssl.org
50e0: 2f 22 3e 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e 53  /"><strong>OpenS
50f0: 53 4c 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 3c  SL</strong></a><
5100: 2f 70 3e 0a 0a 3c 68 72 3e 0a 0a 3c 70 72 65 3e  /p>..<hr>..<pre>
5110: 0a 43 6f 70 79 72 69 67 68 74 20 26 63 6f 70 79  .Copyright &copy
5120: 3b 20 31 39 39 39 20 4d 61 74 74 20 4e 65 77 6d  ; 1999 Matt Newm
5130: 61 6e 2e 0a 43 6f 70 79 72 69 67 68 74 20 26 63  an..Copyright &c
5140: 6f 70 79 3b 20 32 30 30 34 20 53 74 61 72 66 69  opy; 2004 Starfi
5150: 73 68 20 53 79 73 74 65 6d 73 2e 0a 3c 2f 70 72  sh Systems..</pr
5160: 65 3e 0a 3c 2f 62 6f 64 79 3e 0a 3c 2f 68 74 6d  e>.</body>.</htm
5170: 6c 3e 0a                                         l>.