Artifact
2012ca4742a952e83f88144317d05a158c9b8d0f:
Wiki page
[
Documentation] by
rkeene on
2016-12-08 04:23:54.
0000: 44 20 32 30 31 36 2d 31 32 2d 30 38 54 30 34 3a D 2016-12-08T04:
0010: 32 33 3a 35 34 2e 37 39 30 0a 4c 20 44 6f 63 75 23:54.790.L Docu
0020: 6d 65 6e 74 61 74 69 6f 6e 0a 50 20 63 30 62 30 mentation.P c0b0
0030: 39 31 66 37 63 32 61 35 34 38 62 30 30 35 31 37 91f7c2a548b00517
0040: 36 33 37 66 64 65 35 39 37 62 65 36 31 34 32 37 637fde597be61427
0050: 33 32 38 66 0a 55 20 72 6b 65 65 6e 65 0a 57 20 328f.U rkeene.W
0060: 31 36 31 38 32 0a 0a 3c 64 6c 3e 0a 20 20 20 20 16182..<dl>.
0070: 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 4e 41 <dd><a href="#NA
0080: 4d 45 22 3e 4e 41 4d 45 3c 2f 61 3e 20 3c 64 6c ME">NAME</a> <dl
0090: 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 64 >. <d
00a0: 64 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3c 2f 73 d><strong>tls</s
00b0: 74 72 6f 6e 67 3e 20 2d 20 62 69 6e 64 69 6e 67 trong> - binding
00c0: 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e to <strong>Open
00d0: 53 53 4c 3c 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 SSL</strong>.
00e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 74 6f 6f too
00f0: 6c 6b 69 74 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 lkit.</dd>.
0100: 20 20 20 3c 2f 64 6c 3e 0a 20 20 20 20 3c 2f 64 </dl>. </d
0110: 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 d>. <dd><a hr
0120: 65 66 3d 22 23 53 59 4e 4f 50 53 49 53 22 3e 53 ef="#SYNOPSIS">S
0130: 59 4e 4f 50 53 49 53 3c 2f 61 3e 20 3c 2f 64 64 YNOPSIS</a> </dd
0140: 3e 0a 20 20 20 20 3c 64 64 3e 3c 64 6c 3e 0a 20 >. <dd><dl>.
0150: 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c <dd><
0160: 62 3e 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 b>package requir
0170: 65 20 54 63 6c 20 3c 2f 62 3e 3c 65 6d 3e 3f 38 e Tcl </b><em>?8
0180: 2e 34 3f 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20 20 .4?</em></dd>.
0190: 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c 62 <dd><b
01a0: 3e 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 >package require
01b0: 20 74 6c 73 20 3c 2f 62 3e 3c 65 6d 3e 3f 31 2e tls </b><em>?1.
01c0: 37 2e 33 3f 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20 7.3?</em></dd>.
01d0: 20 20 20 20 20 20 20 20 20 20 20 3c 64 74 3e 26 <dt>&
01e0: 6e 62 73 70 3b 3c 2f 64 74 3e 0a 20 20 20 20 20 nbsp;</dt>.
01f0: 20 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74 6c <dd><b>tl
0200: 73 3a 3a 69 6e 69 74 20 3c 2f 62 3e 3c 69 3e 3f s::init </b><i>?
0210: 6f 70 74 69 6f 6e 73 3f 3c 2f 69 3e 20 3c 2f 64 options?</i> </d
0220: 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c d>. <
0230: 64 64 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 dd><b>tls::socke
0240: 74 20 3c 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 69 6f t </b><em>?optio
0250: 6e 73 3f 20 68 6f 73 74 20 70 6f 72 74 3c 2f 65 ns? host port</e
0260: 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 m></dd>.
0270: 20 20 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a <dd><b>tls::
0280: 73 6f 63 6b 65 74 3c 2f 62 3e 3c 65 6d 3e 20 3f socket</b><em> ?
0290: 2d 73 65 72 76 65 72 20 63 6f 6d 6d 61 6e 64 3f -server command?
02a0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
02b0: 20 3f 6f 70 74 69 6f 6e 73 3f 20 70 6f 72 74 3c ?options? port<
02c0: 2f 65 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 /em></dd>.
02d0: 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 <dd><b>tls
02e0: 3a 3a 68 61 6e 64 73 68 61 6b 65 3c 2f 62 3e 3c ::handshake</b><
02f0: 65 6d 3e 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e em> channel</em>
0300: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 </dd>.
0310: 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 73 74 <dd><b>tls::st
0320: 61 74 75 73 20 3c 2f 62 3e 3c 65 6d 3e 3f 2d 6c atus </b><em>?-l
0330: 6f 63 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c 2f 65 ocal? channel</e
0340: 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 m></dd>.
0350: 20 20 20 20 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a <dd><b>tls::
0360: 69 6d 70 6f 72 74 3c 2f 62 3e 3c 65 6d 3e 20 63 import</b><em> c
0370: 68 61 6e 6e 65 6c 20 3f 6f 70 74 69 6f 6e 73 3f hannel ?options?
0380: 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 </em></dd>.
0390: 20 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74 6c <dd><b>tl
03a0: 73 3a 3a 75 6e 69 6d 70 6f 72 74 3c 2f 62 3e 3c s::unimport</b><
03b0: 65 6d 3e 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e em> 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 69 <dd><b>tls::ci
03e0: 70 68 65 72 73 20 3c 2f 62 3e 3c 65 6d 3e 70 72 phers </b><em>pr
03f0: 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f otocol ?verbose?
0400: 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 </em></dd>.
0410: 20 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74 6c <dd><b>tl
0420: 73 3a 3a 76 65 72 73 69 6f 6e 3c 2f 62 3e 3c 2f s::version</b></
0430: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 2f 64 6c dd>. </dl
0440: 3e 0a 20 20 20 20 3c 2f 64 64 3e 0a 20 20 20 20 >. </dd>.
0450: 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 43 4f <dd><a href="#CO
0460: 4d 4d 41 4e 44 53 22 3e 43 4f 4d 4d 41 4e 44 53 MMANDS">COMMANDS
0470: 3c 2f 61 3e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 </a></dd>. <d
0480: 64 3e 3c 61 20 68 72 65 66 3d 22 23 43 41 4c 4c d><a href="#CALL
0490: 42 41 43 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 BACK OPTIONS">CA
04a0: 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f LLBACK OPTIONS</
04b0: 61 3e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e a></dd>. <dd>
04c0: 3c 61 20 68 72 65 66 3d 22 23 48 54 54 50 53 20 <a href="#HTTPS
04d0: 45 58 41 4d 50 4c 45 22 3e 48 54 54 50 53 20 45 EXAMPLE">HTTPS E
04e0: 58 41 4d 50 4c 45 3c 2f 61 3e 3c 2f 64 64 3e 0a XAMPLE</a></dd>.
04f0: 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 66 3d <dd><a href=
0500: 22 23 53 45 45 20 41 4c 53 4f 22 3e 53 50 45 43 "#SEE ALSO">SPEC
0510: 49 41 4c 20 43 4f 4e 53 49 44 45 52 41 54 49 4f IAL CONSIDERATIO
0520: 4e 53 3c 2f 61 3e 3c 2f 64 64 3e 0a 20 20 20 20 NS</a></dd>.
0530: 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 53 45 <dd><a href="#SE
0540: 45 20 41 4c 53 4f 22 3e 53 45 45 20 41 4c 53 4f E ALSO">SEE ALSO
0550: 3c 2f 61 3e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a </a></dd>.</dl>.
0560: 0a 3c 68 72 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 .<hr>..<h3><a na
0570: 6d 65 3d 22 4e 41 4d 45 22 3e 4e 41 4d 45 3c 2f me="NAME">NAME</
0580: 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 3c 73 74 72 a></h3>..<p><str
0590: 6f 6e 67 3e 74 6c 73 3c 2f 73 74 72 6f 6e 67 3e ong>tls</strong>
05a0: 20 2d 20 62 69 6e 64 69 6e 67 20 74 6f 20 3c 73 - binding to <s
05b0: 74 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 trong>OpenSSL</s
05c0: 74 72 6f 6e 67 3e 0a 74 6f 6f 6c 6b 69 74 2e 3c trong>.toolkit.<
05d0: 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 /p>..<h3><a name
05e0: 3d 22 53 59 4e 4f 50 53 49 53 22 3e 53 59 4e 4f ="SYNOPSIS">SYNO
05f0: 50 53 49 53 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c PSIS</a></h3>..<
0600: 70 3e 3c 62 3e 70 61 63 6b 61 67 65 20 72 65 71 p><b>package req
0610: 75 69 72 65 20 54 63 6c 20 38 2e 34 3c 2f 62 3e uire Tcl 8.4</b>
0620: 3c 62 72 3e 0a 3c 62 3e 70 61 63 6b 61 67 65 20 <br>.<b>package
0630: 72 65 71 75 69 72 65 20 74 6c 73 20 31 2e 37 2e require tls 1.7.
0640: 33 3c 2f 62 3e 3c 62 72 3e 0a 3c 62 72 3e 0a 3c 3</b><br>.<br>.<
0650: 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 69 6e a href="#tls::in
0660: 69 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74 it"><b>tls::init
0670: 20 3c 2f 62 3e 3c 69 3e 3f 6f 70 74 69 6f 6e 73 </b><i>?options
0680: 3f 3c 2f 69 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 ?</i><br>.</a><a
0690: 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 73 6f 63 href="#tls::soc
06a0: 6b 65 74 22 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 ket"><b>tls::soc
06b0: 6b 65 74 20 3c 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 ket </b><em>?opt
06c0: 69 6f 6e 73 3f 20 68 6f 73 74 0a 70 6f 72 74 3c ions? host.port<
06d0: 2f 65 6d 3e 3c 62 72 3e 0a 3c 62 3e 74 6c 73 3a /em><br>.<b>tls:
06e0: 3a 73 6f 63 6b 65 74 3c 2f 62 3e 3c 65 6d 3e 20 :socket</b><em>
06f0: 3f 2d 73 65 72 76 65 72 20 63 6f 6d 6d 61 6e 64 ?-server command
0700: 3f 20 3f 6f 70 74 69 6f 6e 73 3f 20 70 6f 72 74 ? ?options? port
0710: 3c 2f 65 6d 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 </em><br>.</a><a
0720: 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 73 74 61 href="#tls::sta
0730: 74 75 73 22 3e 3c 62 3e 74 6c 73 3a 3a 73 74 61 tus"><b>tls::sta
0740: 74 75 73 20 3c 2f 62 3e 3c 65 6d 3e 3f 2d 6c 6f tus </b><em>?-lo
0750: 63 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d cal? channel</em
0760: 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65 ><br>.</a><a hre
0770: 66 3d 22 23 74 6c 73 3a 3a 68 61 6e 64 73 68 61 f="#tls::handsha
0780: 6b 65 22 3e 3c 62 3e 74 6c 73 3a 3a 68 61 6e 64 ke"><b>tls::hand
0790: 73 68 61 6b 65 3c 2f 62 3e 3c 65 6d 3e 20 63 68 shake</b><em> ch
07a0: 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61 3e 3c 62 annel</em></a><b
07b0: 72 3e 0a 3c 62 72 3e 0a 3c 61 20 68 72 65 66 3d r>.<br>.<a href=
07c0: 22 23 74 6c 73 3a 3a 69 6d 70 6f 72 74 22 3e 3c "#tls::import"><
07d0: 62 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 20 3c 2f b>tls::import </
07e0: 62 3e 3c 69 3e 63 68 61 6e 6e 65 6c 20 3f 6f 70 b><i>channel ?op
07f0: 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 62 tions?</i></a><b
0800: 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 r>.<a href="#tls
0810: 3a 3a 75 6e 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 ::unimport"><b>t
0820: 6c 73 3a 3a 75 6e 69 6d 70 6f 72 74 20 3c 2f 62 ls::unimport </b
0830: 3e 3c 69 3e 63 68 61 6e 6e 65 6c 3c 2f 69 3e 3c ><i>channel</i><
0840: 2f 61 3e 3c 62 72 3e 0a 3c 61 20 68 72 65 66 3d /a><br>.<a href=
0850: 22 23 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 70 "#tls::ciphers p
0860: 72 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f 73 65 rotocol ?verbose
0870: 3f 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a ?"><strong>tls::
0880: 63 69 70 68 65 72 73 3c 2f 73 74 72 6f 6e 67 3e ciphers</strong>
0890: 0a 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20 3f 76 .<em>protocol ?v
08a0: 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f 61 3e erbose?</em></a>
08b0: 3c 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 <br>.<a href="#t
08c0: 6c 73 3a 3a 76 65 72 73 69 6f 6e 22 3e 3c 62 3e ls::version"><b>
08d0: 74 6c 73 3a 3a 76 65 72 73 69 6f 6e 3c 2f 62 3e tls::version</b>
08e0: 3c 2f 61 3e 0a 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c </a>.</p>..<h3><
08f0: 61 20 6e 61 6d 65 3d 22 44 45 53 43 52 49 50 54 a name="DESCRIPT
0900: 49 4f 4e 22 3e 44 45 53 43 52 49 50 54 49 4f 4e ION">DESCRIPTION
0910: 3c 2f 61 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 </a></h3>..<p>Th
0920: 69 73 20 65 78 74 65 6e 73 69 6f 6e 20 70 72 6f is extension pro
0930: 76 69 64 65 73 20 61 20 67 65 6e 65 72 69 63 20 vides a generic
0940: 62 69 6e 64 69 6e 67 20 74 6f 20 3c 61 0a 68 72 binding to <a.hr
0950: 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 6f ef="http://www.o
0960: 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 4f 70 65 penssl.org/">Ope
0970: 6e 53 53 4c 3c 2f 61 3e 2c 20 75 74 69 6c 69 7a nSSL</a>, utiliz
0980: 69 6e 67 20 74 68 65 0a 3c 73 74 72 6f 6e 67 3e ing the.<strong>
0990: 54 63 6c 5f 53 74 61 63 6b 43 68 61 6e 6e 65 6c Tcl_StackChannel
09a0: 3c 2f 73 74 72 6f 6e 67 3e 0a 41 50 49 20 66 6f </strong>.API fo
09b0: 72 20 54 63 6c 20 38 2e 32 20 61 6e 64 20 68 69 r Tcl 8.2 and hi
09c0: 67 68 65 72 2e 20 54 68 65 20 73 6f 63 6b 65 74 gher. The socket
09d0: 73 20 62 65 68 61 76 65 20 65 78 61 63 74 6c 79 s behave exactly
09e0: 20 74 68 65 20 73 61 6d 65 0a 61 73 20 63 68 61 the same.as cha
09f0: 6e 6e 65 6c 73 20 63 72 65 61 74 65 64 20 75 73 nnels created us
0a00: 69 6e 67 20 54 63 6c 27 73 20 62 75 69 6c 74 2d ing Tcl's built-
0a10: 69 6e 20 3c 73 74 72 6f 6e 67 3e 73 6f 63 6b 65 in <strong>socke
0a20: 74 3c 2f 73 74 72 6f 6e 67 3e 0a 63 6f 6d 6d 61 t</strong>.comma
0a30: 6e 64 20 77 69 74 68 20 61 64 64 69 74 69 6f 6e nd with addition
0a40: 61 6c 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 63 al options for c
0a50: 6f 6e 74 72 6f 6c 6c 69 6e 67 20 74 68 65 20 53 ontrolling the S
0a60: 53 4c 20 73 65 73 73 69 6f 6e 2e 0a 54 6f 20 75 SL session..To u
0a70: 73 65 20 54 4c 53 20 77 69 74 68 20 61 6e 20 65 se TLS with an e
0a80: 61 72 6c 69 65 72 20 76 65 72 73 69 6f 6e 20 6f arlier version o
0a90: 66 20 54 63 6c 20 74 68 61 6e 20 38 2e 34 2c 20 f Tcl than 8.4,
0aa0: 70 6c 65 61 73 65 20 6f 62 74 61 69 6e 0a 54 4c please obtain.TL
0ab0: 53 20 31 2e 33 2e 0a 3c 2f 70 3e 0a 0a 3c 68 33 S 1.3..</p>..<h3
0ac0: 3e 3c 61 20 6e 61 6d 65 3d 22 43 4f 4d 4d 41 4e ><a name="COMMAN
0ad0: 44 53 22 3e 43 4f 4d 4d 41 4e 44 53 3c 2f 61 3e DS">COMMANDS</a>
0ae0: 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 79 70 69 63 61 </h3>..<p>Typica
0af0: 6c 6c 79 20 6f 6e 65 20 77 6f 75 6c 64 20 75 73 lly one would us
0b00: 65 20 74 68 65 20 3c 73 74 72 6f 6e 67 3e 74 6c e the <strong>tl
0b10: 73 3a 3a 73 6f 63 6b 65 74 20 3c 2f 73 74 72 6f s::socket </stro
0b20: 6e 67 3e 63 6f 6d 6d 61 6e 64 0a 77 68 69 63 68 ng>command.which
0b30: 20 70 72 6f 76 69 64 65 73 20 63 6f 6d 70 61 74 provides compat
0b40: 69 62 69 6c 69 74 79 20 77 69 74 68 20 74 68 65 ibility with the
0b50: 20 6e 61 74 69 76 65 20 54 63 6c 20 3c 73 74 72 native Tcl <str
0b60: 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 74 72 6f ong>socket</stro
0b70: 6e 67 3e 0a 63 6f 6d 6d 61 6e 64 2e 20 49 6e 20 ng>.command. In
0b80: 73 75 63 68 20 63 61 73 65 73 20 3c 73 74 72 6f such cases <stro
0b90: 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f ng>tls::import</
0ba0: 73 74 72 6f 6e 67 3e 20 73 68 6f 75 6c 64 20 6e strong> should n
0bb0: 6f 74 20 62 65 0a 75 73 65 64 20 64 69 72 65 63 ot be.used direc
0bc0: 74 6c 79 2e 3c 2f 70 3e 0a 0a 3c 64 6c 3e 0a 20 tly.</p>..<dl>.
0bd0: 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 <dt><a name="
0be0: 74 6c 73 3a 3a 69 6e 69 74 22 3e 3c 62 3e 74 6c tls::init"><b>tl
0bf0: 73 3a 3a 69 6e 69 74 20 3c 2f 62 3e 3c 69 3e 3f s::init </b><i>?
0c00: 6f 70 74 69 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e options?</i></a>
0c10: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 54 68 </dt>. <dd>Th
0c20: 69 73 20 72 6f 75 74 69 6e 65 20 73 65 74 73 20 is routine sets
0c30: 74 68 65 20 64 65 66 61 75 6c 74 20 6f 70 74 69 the default opti
0c40: 6f 6e 73 20 75 73 65 64 20 62 79 20 3c 73 74 72 ons used by <str
0c50: 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c ong>tls::socket<
0c60: 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20 20 20 /strong>.
0c70: 20 61 6e 64 20 69 73 20 3c 65 6d 3e 6f 70 74 69 and is <em>opti
0c80: 6f 6e 61 6c 3c 2f 65 6d 3e 2e 20 49 66 20 79 6f onal</em>. If yo
0c90: 75 20 63 61 6c 6c 20 3c 73 74 72 6f 6e 67 3e 74 u call <strong>t
0ca0: 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f ls::import</stro
0cb0: 6e 67 3e 0a 20 20 20 20 20 20 20 20 64 69 72 65 ng>. dire
0cc0: 63 74 6c 79 20 74 68 69 73 20 72 6f 75 74 69 6e ctly this routin
0cd0: 65 20 68 61 73 20 6e 6f 20 65 66 66 65 63 74 2e e has no effect.
0ce0: 20 41 6e 79 20 6f 66 20 74 68 65 20 6f 70 74 69 Any of the opti
0cf0: 6f 6e 73 0a 20 20 20 20 20 20 20 20 74 68 61 74 ons. that
0d00: 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f <strong>tls::so
0d10: 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 20 61 63 cket</strong> ac
0d20: 63 65 70 74 73 20 63 61 6e 20 62 65 20 73 65 74 cepts can be set
0d30: 0a 20 20 20 20 20 20 20 20 75 73 69 6e 67 20 74 . using t
0d40: 68 69 73 20 63 6f 6d 6d 61 6e 64 2c 20 74 68 6f his command, tho
0d50: 75 67 68 20 79 6f 75 20 73 68 6f 75 6c 64 20 6c ugh you should l
0d60: 69 6d 69 74 20 79 6f 75 72 20 6f 70 74 69 6f 6e imit your option
0d70: 73 0a 20 20 20 20 20 20 20 20 74 6f 20 6f 6e 6c s. to onl
0d80: 79 20 54 4c 53 20 72 65 6c 61 74 65 64 20 6f 6e y TLS related on
0d90: 65 73 2e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 74 es.</dd>. <dt
0da0: 3e 26 6e 62 73 70 3b 3c 2f 64 74 3e 0a 20 20 20 > </dt>.
0db0: 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c <dt><a name="tl
0dc0: 73 3a 3a 73 6f 63 6b 65 74 22 3e 3c 62 3e 74 6c s::socket"><b>tl
0dd0: 73 3a 3a 73 6f 63 6b 65 74 20 3c 2f 62 3e 3c 65 s::socket </b><e
0de0: 6d 3e 3f 6f 70 74 69 6f 6e 73 3f 0a 20 20 20 20 m>?options?.
0df0: 20 20 20 20 68 6f 73 74 20 70 6f 72 74 3c 2f 65 host port</e
0e00: 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 m></a></dt>.
0e10: 3c 64 74 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b <dt><b>tls::sock
0e20: 65 74 3c 2f 62 3e 3c 65 6d 3e 20 3f 2d 73 65 72 et</b><em> ?-ser
0e30: 76 65 72 20 63 6f 6d 6d 61 6e 64 3f 20 3f 6f 70 ver command? ?op
0e40: 74 69 6f 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d 3e tions? port</em>
0e50: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 54 68 </dt>. <dd>Th
0e60: 69 73 20 69 73 20 61 20 68 65 6c 70 65 72 20 66 is is a helper f
0e70: 75 6e 63 74 69 6f 6e 20 74 68 61 74 20 75 74 69 unction that uti
0e80: 6c 69 7a 65 73 20 74 68 65 20 75 6e 64 65 72 6c lizes the underl
0e90: 79 69 6e 67 0a 20 20 20 20 20 20 20 20 63 6f 6d ying. com
0ea0: 6d 61 6e 64 73 20 28 3c 73 74 72 6f 6e 67 3e 74 mands (<strong>t
0eb0: 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f ls::import</stro
0ec0: 6e 67 3e 29 2e 20 49 74 20 62 65 68 61 76 65 73 ng>). It behaves
0ed0: 0a 20 20 20 20 20 20 20 20 65 78 61 63 74 6c 79 . exactly
0ee0: 20 74 68 65 20 73 61 6d 65 20 61 73 20 74 68 65 the same as the
0ef0: 20 6e 61 74 69 76 65 20 54 63 6c 20 3c 73 74 72 native Tcl <str
0f00: 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 74 72 6f ong>socket</stro
0f10: 6e 67 3e 0a 20 20 20 20 20 20 20 20 63 6f 6d 6d ng>. comm
0f20: 61 6e 64 20 65 78 63 65 70 74 20 74 68 61 74 20 and except that
0f30: 74 68 65 20 6f 70 74 69 6f 6e 73 20 63 61 6e 20 the options can
0f40: 69 6e 63 6c 75 64 65 20 61 6e 79 20 6f 66 20 74 include any of t
0f50: 68 65 0a 20 20 20 20 20 20 20 20 61 70 70 6c 69 he. appli
0f60: 63 61 62 6c 65 20 3c 61 20 68 72 65 66 3d 22 23 cable <a href="#
0f70: 74 6c 73 3a 3a 69 6d 70 6f 72 74 22 3e 3c 73 74 tls::import"><st
0f80: 72 6f 6e 67 3e 74 6c 73 3a 69 6d 70 6f 72 74 3c rong>tls:import<
0f90: 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 0a 20 20 20 /strong></a>.
0fa0: 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 3c 2f 64 options.</d
0fb0: 64 3e 0a 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 d>. <dt> 
0fc0: 3b 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74 3e 3c ;</dt>. <dt><
0fd0: 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 68 61 6e a name="tls::han
0fe0: 64 73 68 61 6b 65 22 3e 3c 73 74 72 6f 6e 67 3e dshake"><strong>
0ff0: 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 3c 2f tls::handshake</
1000: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e strong> <em>chan
1010: 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 nel</em></a></dt
1020: 3e 0a 20 20 20 20 3c 64 64 3e 46 6f 72 63 65 73 >. <dd>Forces
1030: 20 68 61 6e 64 73 68 61 6b 65 20 74 6f 20 74 61 handshake to ta
1040: 6b 65 20 70 6c 61 63 65 2c 20 61 6e 64 20 72 65 ke place, and re
1050: 74 75 72 6e 73 20 30 20 69 66 0a 20 20 20 20 20 turns 0 if.
1060: 20 20 20 68 61 6e 64 73 68 61 6b 65 20 69 73 20 handshake is
1070: 73 74 69 6c 6c 20 69 6e 20 70 72 6f 67 72 65 73 still in progres
1080: 73 20 28 6e 6f 6e 2d 62 6c 6f 63 6b 69 6e 67 29 s (non-blocking)
1090: 2c 20 6f 72 20 31 20 69 66 0a 20 20 20 20 20 20 , or 1 if.
10a0: 20 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65 20 the handshake
10b0: 77 61 73 20 73 75 63 63 65 73 73 66 75 6c 2e 20 was successful.
10c0: 49 66 20 74 68 65 20 68 61 6e 64 73 68 61 6b 65 If the handshake
10d0: 20 66 61 69 6c 65 64 0a 20 20 20 20 20 20 20 20 failed.
10e0: 74 68 69 73 20 72 6f 75 74 69 6e 65 20 77 69 6c this routine wil
10f0: 6c 20 74 68 72 6f 77 20 61 6e 20 65 72 72 6f 72 l throw an error
1100: 2e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 74 3e 26 .</dd>. <dt>&
1110: 6e 62 73 70 3b 3c 2f 64 74 3e 0a 20 20 20 20 3c nbsp;</dt>. <
1120: 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a dt><a name="tls:
1130: 3a 73 74 61 74 75 73 22 3e 3c 73 74 72 6f 6e 67 :status"><strong
1140: 3e 74 6c 73 3a 3a 73 74 61 74 75 73 3c 2f 73 74 >tls::status</st
1150: 72 6f 6e 67 3e 0a 20 20 20 20 3c 65 6d 3e 3f 2d rong>. <em>?-
1160: 6c 6f 63 61 6c 3f 20 63 68 61 6e 6e 65 6c 3c 2f local? channel</
1170: 65 6d 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 em></a></dt>.
1180: 20 3c 64 64 3e 52 65 74 75 72 6e 73 20 74 68 65 <dd>Returns the
1190: 20 63 75 72 72 65 6e 74 20 73 65 63 75 72 69 74 current securit
11a0: 79 20 73 74 61 74 75 73 20 6f 66 20 61 6e 20 53 y status of an S
11b0: 53 4c 20 63 68 61 6e 6e 65 6c 2e 20 54 68 65 0a SL channel. The.
11c0: 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 20 69 result i
11d0: 73 20 61 20 6c 69 73 74 20 6f 66 20 6b 65 79 2d s a list of key-
11e0: 76 61 6c 75 65 20 70 61 69 72 73 20 64 65 73 63 value pairs desc
11f0: 72 69 62 69 6e 67 20 74 68 65 0a 20 20 20 20 20 ribing the.
1200: 20 20 20 63 6f 6e 6e 65 63 74 65 64 20 70 65 65 connected pee
1210: 72 2e 20 49 66 20 74 68 65 20 72 65 73 75 6c 74 r. If the result
1220: 20 69 73 20 61 6e 20 65 6d 70 74 79 20 6c 69 73 is an empty lis
1230: 74 20 74 68 65 6e 20 74 68 65 0a 20 20 20 20 20 t then the.
1240: 20 20 20 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 SSL handshake
1250: 20 68 61 73 20 6e 6f 74 20 79 65 74 20 63 6f 6d has not yet com
1260: 70 6c 65 74 65 64 2e 0a 20 20 20 20 20 20 20 20 pleted..
1270: 49 66 20 3c 65 6d 3e 2d 6c 6f 63 61 6c 3c 2f 65 If <em>-local</e
1280: 6d 3e 20 69 73 20 67 69 76 65 6e 2c 20 74 68 65 m> is given, the
1290: 6e 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 n the certificat
12a0: 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 0a 20 20 e information.
12b0: 20 20 20 20 20 20 69 73 20 74 68 65 20 6f 6e 65 is the one
12c0: 20 75 73 65 64 20 6c 6f 63 61 6c 6c 79 2e 3c 2f used locally.</
12d0: 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 62 6c 6f 63 dd>.</dl>..<bloc
12e0: 6b 71 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c 3e kquote>. <dl>
12f0: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 . <dt><st
1300: 72 6f 6e 67 3e 69 73 73 75 65 72 3c 2f 73 74 72 rong>issuer</str
1310: 6f 6e 67 3e 20 3c 65 6d 3e 64 6e 3c 2f 65 6d 3e ong> <em>dn</em>
1320: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 </dt>. <d
1330: 64 3e 54 68 65 20 64 69 73 74 69 6e 67 75 69 73 d>The distinguis
1340: 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 20 6f 66 hed name (DN) of
1350: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 the certificate
1360: 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 73 73 . iss
1370: 75 65 72 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 uer.</dd>.
1380: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 73 75 <dt><strong>su
1390: 62 6a 65 63 74 3c 2f 73 74 72 6f 6e 67 3e 20 3c bject</strong> <
13a0: 65 6d 3e 64 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a em>dn</em></dt>.
13b0: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 <dd>The
13c0: 64 69 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 distinguished na
13d0: 6d 65 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 me (DN) of the c
13e0: 65 72 74 69 66 69 63 61 74 65 0a 20 20 20 20 20 ertificate.
13f0: 20 20 20 20 20 20 20 73 75 62 6a 65 63 74 2e 3c subject.<
1400: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 /dd>. <dt
1410: 3e 3c 73 74 72 6f 6e 67 3e 6e 6f 74 42 65 66 6f ><strong>notBefo
1420: 72 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e re</strong> <em>
1430: 64 61 74 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 date</em></dt>.
1440: 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 62 <dd>The b
1450: 65 67 69 6e 20 64 61 74 65 20 66 6f 72 20 74 68 egin date for th
1460: 65 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 e validity of th
1470: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 3c 2f e certificate.</
1480: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e dd>. <dt>
1490: 3c 73 74 72 6f 6e 67 3e 6e 6f 74 41 66 74 65 72 <strong>notAfter
14a0: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 61 </strong> <em>da
14b0: 74 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 te</em></dt>.
14c0: 20 20 20 20 20 3c 64 64 3e 54 68 65 20 65 78 70 <dd>The exp
14d0: 69 72 79 20 64 61 74 65 20 66 6f 72 20 74 68 65 iry date for the
14e0: 20 63 65 72 74 69 66 69 63 61 74 65 2e 3c 2f 64 certificate.</d
14f0: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c d>. <dt><
1500: 73 74 72 6f 6e 67 3e 73 65 72 69 61 6c 3c 2f 73 strong>serial</s
1510: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d trong> <em>n</em
1520: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c ></dt>. <
1530: 64 64 3e 54 68 65 20 73 65 72 69 61 6c 20 6e 75 dd>The serial nu
1540: 6d 62 65 72 20 6f 66 20 74 68 65 20 63 65 72 74 mber of the cert
1550: 69 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 ificate.</dd>.
1560: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e <dt><stron
1570: 67 3e 63 69 70 68 65 72 3c 2f 73 74 72 6f 6e 67 g>cipher</strong
1580: 3e 20 3c 65 6d 3e 63 69 70 68 65 72 3c 2f 65 6d > <em>cipher</em
1590: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c ></dt>. <
15a0: 64 64 3e 54 68 65 20 63 75 72 72 65 6e 74 20 63 dd>The current c
15b0: 69 70 68 65 72 20 69 6e 20 75 73 65 20 62 65 74 ipher in use bet
15c0: 77 65 65 6e 20 74 68 65 20 63 6c 69 65 6e 74 20 ween the client
15d0: 61 6e 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 and.
15e0: 73 65 72 76 65 72 20 63 68 61 6e 6e 65 6c 73 2e server channels.
15f0: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 </dd>. <d
1600: 74 3e 3c 73 74 72 6f 6e 67 3e 73 62 69 74 73 3c t><strong>sbits<
1610: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f /strong> <em>n</
1620: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 em></dt>.
1630: 20 3c 64 64 3e 54 68 65 20 6e 75 6d 62 65 72 20 <dd>The number
1640: 6f 66 20 62 69 74 73 20 75 73 65 64 20 66 6f 72 of bits used for
1650: 20 74 68 65 20 73 65 73 73 69 6f 6e 20 6b 65 79 the session key
1660: 2e 3c 2f 64 64 3e 0a 20 20 20 20 3c 2f 64 6c 3e .</dd>. </dl>
1670: 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a .</blockquote>..
1680: 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20 <dl>. <dt><a
1690: 6e 61 6d 65 3d 22 74 6c 73 3a 3a 69 6d 70 6f 72 name="tls::impor
16a0: 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70 6f 72 t"><b>tls::impor
16b0: 74 20 3c 2f 62 3e 3c 69 3e 63 68 61 6e 6e 65 6c t </b><i>channel
16c0: 0a 20 20 20 20 20 20 20 20 3f 6f 70 74 69 6f 6e . ?option
16d0: 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a s?</i></a></dt>.
16e0: 20 20 20 20 3c 64 64 3e 53 53 4c 2d 65 6e 61 62 <dd>SSL-enab
16f0: 6c 65 20 61 20 72 65 67 75 6c 61 72 20 54 63 6c le a regular Tcl
1700: 20 63 68 61 6e 6e 65 6c 20 2d 20 69 74 20 6e 65 channel - it ne
1710: 65 64 20 6e 6f 74 20 62 65 20 61 0a 20 20 20 20 ed not be a.
1720: 20 20 20 20 73 6f 63 6b 65 74 2c 20 62 75 74 20 socket, but
1730: 6d 75 73 74 20 70 72 6f 76 69 64 65 20 62 69 2d must provide bi-
1740: 64 69 72 65 63 74 69 6f 6e 61 6c 20 66 6c 6f 77 directional flow
1750: 2e 20 41 6c 73 6f 0a 20 20 20 20 20 20 20 20 73 . Also. s
1760: 65 74 74 69 6e 67 20 73 65 73 73 69 6f 6e 20 70 etting session p
1770: 61 72 61 6d 65 74 65 72 73 20 66 6f 72 20 53 53 arameters for SS
1780: 4c 20 68 61 6e 64 73 68 61 6b 65 2e 3c 2f 64 64 L handshake.</dd
1790: 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 62 6c 6f 63 6b 71 >.</dl>..<blockq
17a0: 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20 uote>. <dl>.
17b0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f <dt><stro
17c0: 6e 67 3e 2d 63 61 64 69 72 3c 2f 73 74 72 6f 6e ng>-cadir</stron
17d0: 67 3e 20 3c 65 6d 3e 64 69 72 3c 2f 65 6d 3e 3c g> <em>dir</em><
17e0: 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 /dt>. <dd
17f0: 3e 50 72 6f 76 69 64 65 20 74 68 65 20 64 69 72 >Provide the dir
1800: 65 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e ectory containin
1810: 67 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69 g the CA certifi
1820: 63 61 74 65 73 2e 3c 2f 64 64 3e 0a 20 20 20 20 cates.</dd>.
1830: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e <dt><strong>
1840: 2d 63 61 66 69 6c 65 20 3c 2f 73 74 72 6f 6e 67 -cafile </strong
1850: 3e 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 ><em>filename</e
1860: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 m></dt>.
1870: 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 <dd>Provide the
1880: 43 41 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20 CA file.</dd>.
1890: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e <dt><stron
18a0: 67 3e 2d 63 65 72 74 66 69 6c 65 3c 2f 73 74 72 g>-certfile</str
18b0: 6f 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d ong> <em>filenam
18c0: 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 e</em></dt>.
18d0: 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 <dd>Provide
18e0: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 the certificate
18f0: 74 6f 20 75 73 65 2e 3c 2f 64 64 3e 0a 20 20 20 to use.</dd>.
1900: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 <dt><strong
1910: 3e 2d 63 69 70 68 65 72 20 3c 2f 73 74 72 6f 6e >-cipher </stron
1920: 67 3e 3c 65 6d 3e 73 74 72 69 6e 67 3c 2f 65 6d g><em>string</em
1930: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c ></dt>. <
1940: 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 63 dd>Provide the c
1950: 69 70 68 65 72 20 73 75 69 74 65 73 20 74 6f 20 ipher suites to
1960: 75 73 65 2e 20 53 79 6e 74 61 78 20 69 73 20 61 use. Syntax is a
1970: 73 20 70 65 72 0a 20 20 20 20 20 20 20 20 20 20 s per.
1980: 20 20 4f 70 65 6e 53 53 4c 2e 3c 2f 64 64 3e 0a OpenSSL.</dd>.
1990: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 <dt><str
19a0: 6f 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74 ong>-command</st
19b0: 72 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 rong> <em>callba
19c0: 63 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 ck</em></dt>.
19d0: 20 20 20 20 20 3c 64 64 3e 49 66 20 73 70 65 63 <dd>If spec
19e0: 69 66 69 65 64 2c 20 74 68 69 73 20 63 61 6c 6c ified, this call
19f0: 62 61 63 6b 20 77 69 6c 6c 20 62 65 20 69 6e 76 back will be inv
1a00: 6f 6b 65 64 20 61 74 20 73 65 76 65 72 61 6c 20 oked at several
1a10: 70 6f 69 6e 74 73 0a 20 20 20 20 20 20 20 20 20 points.
1a20: 20 20 20 64 75 72 69 6e 67 20 74 68 65 20 4f 70 during the Op
1a30: 65 6e 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e enSSL handshake.
1a40: 20 20 49 74 20 63 61 6e 20 70 61 73 73 20 65 72 It can pass er
1a50: 72 6f 72 73 20 61 6e 64 20 74 72 61 63 69 6e 67 rors and tracing
1a60: 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 6e 66 . inf
1a70: 6f 72 6d 61 74 69 6f 6e 2c 20 61 6e 64 20 69 74 ormation, and it
1a80: 20 63 61 6e 20 61 6c 6c 6f 77 20 54 63 6c 20 73 can allow Tcl s
1a90: 63 72 69 70 74 73 20 74 6f 20 70 65 72 66 6f 72 cripts to perfor
1aa0: 6d 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 68 m. th
1ab0: 65 69 72 20 6f 77 6e 20 76 61 6c 69 64 61 74 69 eir own validati
1ac0: 6f 6e 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 on of the certif
1ad0: 69 63 61 74 65 20 69 6e 20 70 6c 61 63 65 20 6f icate in place o
1ae0: 66 20 74 68 65 0a 20 20 20 20 20 20 20 20 20 20 f the.
1af0: 20 20 64 65 66 61 75 6c 74 20 76 61 6c 69 64 61 default valida
1b00: 74 69 6f 6e 20 70 72 6f 76 69 64 65 64 20 62 79 tion provided by
1b10: 20 4f 70 65 6e 53 53 4c 2e 0a 20 20 20 20 20 20 OpenSSL..
1b20: 20 20 20 20 20 20 3c 62 72 3e 0a 20 20 20 20 20 <br>.
1b30: 20 20 20 20 20 20 20 53 65 65 20 3c 61 20 68 72 See <a hr
1b40: 65 66 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50 ef="#CALLBACK OP
1b50: 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20 TIONS">CALLBACK
1b60: 4f 50 54 49 4f 4e 53 3c 2f 61 3e 20 66 6f 72 0a OPTIONS</a> for.
1b70: 20 20 20 20 20 20 20 20 20 20 20 20 66 75 72 74 furt
1b80: 68 65 72 20 64 69 73 63 75 73 73 69 6f 6e 2e 3c her discussion.<
1b90: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 /dd>. <dt
1ba0: 3e 3c 73 74 72 6f 6e 67 3e 2d 64 68 70 61 72 61 ><strong>-dhpara
1bb0: 6d 73 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e ms </strong><em>
1bc0: 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 filename</em></d
1bd0: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 50 t>. <dd>P
1be0: 72 6f 76 69 64 65 20 61 20 44 69 66 66 69 65 2d rovide a Diffie-
1bf0: 48 65 6c 6c 6d 61 6e 20 70 61 72 61 6d 65 74 65 Hellman paramete
1c00: 72 73 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20 rs file.</dd>.
1c10: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e <dt><stron
1c20: 67 3e 2d 6b 65 79 66 69 6c 65 3c 2f 73 74 72 6f g>-keyfile</stro
1c30: 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 ng> <em>filename
1c40: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 </em></dt>.
1c50: 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 <dd>Provide t
1c60: 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 66 he private key f
1c70: 69 6c 65 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 ile. (<strong>de
1c80: 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 0a fault</strong>:.
1c90: 20 20 20 20 20 20 20 20 20 20 20 20 76 61 6c 75 valu
1ca0: 65 20 6f 66 20 2d 63 65 72 74 66 69 6c 65 29 3c e of -certfile)<
1cb0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 /dd>. <dt
1cc0: 3e 3c 73 74 72 6f 6e 67 3e 2d 6d 6f 64 65 6c 3c ><strong>-model<
1cd0: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 /strong> <em>cha
1ce0: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 nnel</em></dt>.
1cf0: 20 20 20 20 20 20 20 3c 64 64 3e 54 68 69 73 20 <dd>This
1d00: 77 69 6c 6c 20 66 6f 72 63 65 20 74 68 69 73 20 will force this
1d10: 63 68 61 6e 6e 65 6c 20 74 6f 20 73 68 61 72 65 channel to share
1d20: 20 74 68 65 20 73 61 6d 65 20 3c 65 6d 3e 3c 73 the same <em><s
1d30: 74 72 6f 6e 67 3e 53 53 4c 5f 43 54 58 3c 2f 73 trong>SSL_CTX</s
1d40: 74 72 6f 6e 67 3e 3c 2f 65 6d 3e 0a 20 20 20 20 trong></em>.
1d50: 20 20 20 20 20 20 20 20 73 74 72 75 63 74 75 72 structur
1d60: 65 20 61 73 20 74 68 65 20 73 70 65 63 69 66 69 e as the specifi
1d70: 65 64 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f ed <em>channel</
1d80: 65 6d 3e 2c 20 61 6e 64 0a 20 20 20 20 20 20 20 em>, and.
1d90: 20 20 20 20 20 74 68 65 72 65 66 6f 72 65 20 73 therefore s
1da0: 68 61 72 65 20 63 61 6c 6c 62 61 63 6b 73 20 65 hare callbacks e
1db0: 74 63 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 tc.</dd>.
1dc0: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 <dt><strong>-pa
1dd0: 73 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 ssword</strong>
1de0: 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d <em>callback</em
1df0: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c ></dt>. <
1e00: 64 64 3e 49 66 20 73 75 70 70 6c 69 65 64 2c 20 dd>If supplied,
1e10: 74 68 69 73 20 63 61 6c 6c 62 61 63 6b 20 77 69 this callback wi
1e20: 6c 6c 20 62 65 20 69 6e 76 6f 6b 65 64 20 77 68 ll be invoked wh
1e30: 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73 en OpenSSL needs
1e40: 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 6f 20 . to
1e50: 6f 62 74 61 69 6e 20 61 20 70 61 73 73 77 6f 72 obtain a passwor
1e60: 64 2c 20 74 79 70 69 63 61 6c 6c 79 20 74 6f 20 d, typically to
1e70: 75 6e 6c 6f 63 6b 20 74 68 65 20 70 72 69 76 61 unlock the priva
1e80: 74 65 20 6b 65 79 20 6f 66 0a 09 20 20 20 20 61 te key of.. a
1e90: 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 20 20 certificate..
1ea0: 20 20 20 20 20 20 20 20 20 20 54 68 65 20 63 61 The ca
1eb0: 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65 llback should re
1ec0: 74 75 72 6e 20 61 20 73 74 72 69 6e 67 20 77 68 turn a string wh
1ed0: 69 63 68 20 72 65 70 72 65 73 65 6e 74 73 20 74 ich represents t
1ee0: 68 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 70 he. p
1ef0: 61 73 73 77 6f 72 64 20 74 6f 20 62 65 20 75 73 assword to be us
1f00: 65 64 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 ed..
1f10: 3c 62 72 3e 0a 20 20 20 20 20 20 20 20 20 20 20 <br>.
1f20: 20 53 65 65 20 3c 61 20 68 72 65 66 3d 22 23 43 See <a href="#C
1f30: 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e 53 22 ALLBACK OPTIONS"
1f40: 3e 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f 4e >CALLBACK OPTION
1f50: 53 3c 2f 61 3e 20 66 6f 72 0a 20 20 20 20 20 20 S</a> for.
1f60: 20 20 20 20 20 20 66 75 72 74 68 65 72 20 64 69 further di
1f70: 73 63 75 73 73 69 6f 6e 2e 3c 2f 64 64 3e 0a 20 scussion.</dd>.
1f80: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f <dt><stro
1f90: 6e 67 3e 2d 72 65 71 75 65 73 74 20 3c 2f 73 74 ng>-request </st
1fa0: 72 6f 6e 67 3e 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 rong><em>bool</e
1fb0: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 m></dt>.
1fc0: 3c 64 64 3e 52 65 71 75 65 73 74 20 61 20 63 65 <dd>Request a ce
1fd0: 72 74 69 66 69 63 61 74 65 20 66 72 6f 6d 20 70 rtificate from p
1fe0: 65 65 72 20 64 75 72 69 6e 67 20 53 53 4c 20 68 eer during SSL h
1ff0: 61 6e 64 73 68 61 6b 65 2e 0a 20 20 20 20 20 20 andshake..
2000: 20 20 20 20 20 20 28 3c 73 74 72 6f 6e 67 3e 64 (<strong>d
2010: 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a efault</strong>:
2020: 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 3c <em>true</em>)<
2030: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 /dd>. <dt
2040: 3e 3c 73 74 72 6f 6e 67 3e 2d 72 65 71 75 69 72 ><strong>-requir
2050: 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 e</strong> <em>b
2060: 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 ool</em></dt>.
2070: 20 20 20 20 20 20 3c 64 64 3e 52 65 71 75 69 72 <dd>Requir
2080: 65 20 61 20 76 61 6c 69 64 20 63 65 72 74 69 66 e a valid certif
2090: 69 63 61 74 65 20 66 72 6f 6d 20 70 65 65 72 20 icate from peer
20a0: 64 75 72 69 6e 67 20 53 53 4c 0a 20 20 20 20 20 during SSL.
20b0: 20 20 20 20 20 20 20 68 61 6e 64 73 68 61 6b 65 handshake
20c0: 2e 20 49 66 20 74 68 69 73 20 69 73 20 73 65 74 . If this is set
20d0: 20 74 6f 20 74 72 75 65 20 74 68 65 6e 20 3c 73 to true then <s
20e0: 74 72 6f 6e 67 3e 2d 72 65 71 75 65 73 74 3c 2f trong>-request</
20f0: 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20 strong>.
2100: 20 20 20 20 6d 75 73 74 20 61 6c 73 6f 20 62 65 must also be
2110: 20 73 65 74 20 74 6f 20 74 72 75 65 2e 20 28 3c set to true. (<
2120: 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f strong>default</
2130: 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c strong>: <em>fal
2140: 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 se</em>)</dd>.
2150: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e <dt><stron
2160: 67 3e 2d 73 65 72 76 65 72 3c 2f 73 74 72 6f 6e g>-server</stron
2170: 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e g> <em>bool</em>
2180: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 </dt>. <d
2190: 64 3e 48 61 6e 64 73 68 61 6b 65 20 61 73 20 73 d>Handshake as s
21a0: 65 72 76 65 72 20 69 66 20 74 72 75 65 2c 20 65 erver if true, e
21b0: 6c 73 65 20 68 61 6e 64 73 68 61 6b 65 20 61 73 lse handshake as
21c0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 63 6c 69 . cli
21d0: 65 6e 74 2e 28 3c 73 74 72 6f 6e 67 3e 64 65 66 ent.(<strong>def
21e0: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c ault</strong>: <
21f0: 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f em>false</em>)</
2200: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e dd>. <dt>
2210: 3c 73 74 72 6f 6e 67 3e 2d 73 65 72 76 65 72 6e <strong>-servern
2220: 61 6d 65 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d ame</strong> <em
2230: 3e 68 6f 73 74 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a >host</em></dt>.
2240: 20 20 20 20 20 20 20 20 3c 64 64 3e 4f 6e 6c 79 <dd>Only
2250: 20 61 76 61 69 6c 61 62 6c 65 20 69 66 20 74 68 available if th
2260: 65 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 e OpenSSL librar
2270: 79 20 74 68 65 20 70 61 63 6b 61 67 65 20 69 73 y the package is
2280: 20 6c 69 6e 6b 65 64 0a 09 20 20 20 20 61 67 61 linked.. aga
2290: 69 6e 73 74 20 73 75 70 70 6f 72 74 73 20 74 68 inst supports th
22a0: 65 20 54 4c 53 20 68 6f 73 74 6e 61 6d 65 20 65 e TLS hostname e
22b0: 78 74 65 6e 73 69 6f 6e 20 66 6f 72 20 27 53 65 xtension for 'Se
22c0: 72 76 65 72 20 4e 61 6d 65 0a 09 20 20 20 20 49 rver Name.. I
22d0: 6e 64 69 63 61 74 69 6f 6e 27 20 28 53 4e 49 29 ndication' (SNI)
22e0: 2e 20 55 73 65 20 74 6f 20 6e 61 6d 65 20 74 68 . Use to name th
22f0: 65 20 6c 6f 67 69 63 61 6c 20 68 6f 73 74 20 77 e logical host w
2300: 65 20 61 72 65 20 74 61 6c 6b 69 6e 67 0a 09 20 e are talking..
2310: 20 20 20 74 6f 20 61 6e 64 20 65 78 70 65 63 74 to and expect
2320: 69 6e 67 20 61 20 63 65 72 74 69 66 69 63 61 74 ing a certificat
2330: 65 20 66 6f 72 3c 2f 64 64 3e 0a 20 20 20 20 20 e for</dd>.
2340: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d <dt><strong>-
2350: 73 73 6c 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 ssl2</strong> <e
2360: 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e m>bool</em></dt>
2370: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 . <dd>Ena
2380: 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c 20 76 ble use of SSL v
2390: 32 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 2. (<strong>defa
23a0: 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 ult</strong>: <e
23b0: 6d 3e 74 72 75 65 3c 2f 65 6d 3e 0a 20 20 20 20 m>true</em>.
23c0: 20 20 20 20 20 20 20 20 75 6e 6c 65 73 73 20 2d unless -
23d0: 44 4e 4f 5f 50 41 54 45 4e 54 53 20 77 61 73 20 DNO_PATENTS was
23e0: 73 70 65 63 69 66 69 65 64 20 69 6e 20 62 75 69 specified in bui
23f0: 6c 64 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 ld)</dd>.
2400: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73 73 <dt><strong>-ss
2410: 6c 33 20 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e l3 </strong><em>
2420: 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 bool</em></dt>.
2430: 20 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c <dd>Enabl
2440: 65 20 75 73 65 20 6f 66 20 53 53 4c 20 76 33 2e e use of SSL v3.
2450: 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c (<strong>defaul
2460: 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e t</strong>: <em>
2470: 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a true</em>)</dd>.
2480: 20 20 20 20 20 20 20 20 3c 64 74 3e 2d 3c 73 74 <dt>-<st
2490: 72 6f 6e 67 3e 74 6c 73 31 3c 2f 73 74 72 6f 6e rong>tls1</stron
24a0: 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e g> <em>bool</em>
24b0: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 </dt>. <d
24c0: 64 3e 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 d>Enable use of
24d0: 54 4c 53 20 76 31 2e 20 28 3c 73 74 72 6f 6e 67 TLS v1. (<strong
24e0: 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 >default</strong
24f0: 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d >: <em>false</em
2500: 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 3c 2f 64 6c >)</dd>. </dl
2510: 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a >.</blockquote>.
2520: 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 .<dl>. <dt><a
2530: 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 75 6e 69 6d name="tls::unim
2540: 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a 75 6e port"><b>tls::un
2550: 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e 63 68 import </b><i>ch
2560: 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64 annel</i></a></d
2570: 74 3e 0a 20 20 20 20 3c 64 64 3e 50 72 6f 76 69 t>. <dd>Provi
2580: 64 65 64 20 66 6f 72 20 73 79 6d 6d 65 74 72 79 ded for symmetry
2590: 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a to <strong>tls:
25a0: 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e :import</strong>
25b0: 2c 20 74 68 69 73 0a 20 20 20 20 20 20 75 6e 73 , this. uns
25c0: 74 61 63 6b 73 20 74 68 65 20 53 53 4c 2d 65 6e tacks the SSL-en
25d0: 61 62 6c 69 6e 67 20 6f 66 20 61 20 72 65 67 75 abling of a regu
25e0: 6c 61 72 20 54 63 6c 20 63 68 61 6e 6e 65 6c 2e lar Tcl channel.
25f0: 20 20 41 6e 20 65 72 72 6f 72 0a 20 20 20 20 20 An error.
2600: 20 69 73 20 74 68 72 6f 77 6e 20 69 66 20 54 4c is thrown if TL
2610: 53 20 69 73 20 6e 6f 74 20 74 68 65 20 74 6f 70 S is not the top
2620: 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c stacked channel
2630: 20 74 79 70 65 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c type.</dd>.</dl
2640: 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e >..<dl>. <dt>
2650: 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 63 69 <a name="tls::ci
2660: 70 68 65 72 73 20 70 72 6f 74 6f 63 6f 6c 20 3f phers protocol ?
2670: 76 65 72 62 6f 73 65 3f 22 3e 3c 73 74 72 6f 6e verbose?"><stron
2680: 67 3e 74 6c 73 3a 3a 63 69 70 68 65 72 73 3c 2f g>tls::ciphers</
2690: 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20 strong>.
26a0: 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20 3f 76 65 <em>protocol ?ve
26b0: 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f 61 3e 3c rbose?</em></a><
26c0: 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 52 65 74 /dt>. <dd>Ret
26d0: 75 72 6e 73 20 6c 69 73 74 20 6f 66 20 73 75 70 urns list of sup
26e0: 70 6f 72 74 65 64 20 63 69 70 68 65 72 73 20 62 ported ciphers b
26f0: 61 73 65 64 20 6f 6e 20 74 68 65 20 3c 65 6d 3e ased on the <em>
2700: 70 72 6f 74 6f 63 6f 6c 3c 2f 65 6d 3e 0a 20 20 protocol</em>.
2710: 20 20 20 20 20 20 79 6f 75 20 73 75 70 70 6c 79 you supply
2720: 2c 20 77 68 69 63 68 20 6d 75 73 74 20 62 65 20 , which must be
2730: 6f 6e 65 20 6f 66 20 3c 65 6d 3e 73 73 6c 32 2c one of <em>ssl2,
2740: 20 73 73 6c 33 2c 20 6f 72 20 74 6c 73 31 3c 2f ssl3, or tls1</
2750: 65 6d 3e 2e 0a 20 20 20 20 20 20 20 20 49 66 20 em>.. If
2760: 3c 65 6d 3e 76 65 72 62 6f 73 65 3c 2f 65 6d 3e <em>verbose</em>
2770: 20 69 73 20 73 70 65 63 69 66 69 65 64 20 61 73 is specified as
2780: 20 74 72 75 65 20 74 68 65 6e 20 61 20 76 65 72 true then a ver
2790: 62 6f 73 65 2c 0a 20 20 20 20 20 20 20 20 73 65 bose,. se
27a0: 6d 69 2d 68 75 6d 61 6e 20 72 65 61 64 61 62 6c mi-human readabl
27b0: 65 20 6c 69 73 74 20 69 73 20 72 65 74 75 72 6e e list is return
27c0: 65 64 20 70 72 6f 76 69 64 69 6e 67 20 61 64 64 ed providing add
27d0: 69 74 69 6f 6e 61 6c 0a 20 20 20 20 20 20 20 20 itional.
27e0: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 information on t
27f0: 68 65 20 6e 61 74 75 72 65 20 6f 66 20 74 68 65 he nature of the
2800: 20 63 69 70 68 65 72 20 73 75 70 70 6f 72 74 2e cipher support.
2810: 20 49 6e 20 65 61 63 68 0a 20 20 20 20 20 20 20 In each.
2820: 20 63 61 73 65 20 74 68 65 20 72 65 73 75 6c 74 case the result
2830: 20 69 73 20 61 20 54 63 6c 20 6c 69 73 74 2e 3c is a Tcl list.<
2840: 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 64 6c 3e /dd>.</dl>..<dl>
2850: 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 . <dt><a name
2860: 3d 22 74 6c 73 3a 3a 76 65 72 73 69 6f 6e 22 3e ="tls::version">
2870: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 76 65 72 <strong>tls::ver
2880: 73 69 6f 6e 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61 sion</strong></a
2890: 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 52 ></dt>. <dd>R
28a0: 65 74 75 72 6e 73 20 74 68 65 20 76 65 72 73 69 eturns the versi
28b0: 6f 6e 20 73 74 72 69 6e 67 20 64 65 66 69 6e 65 on string define
28c0: 64 20 62 79 20 4f 70 65 6e 53 53 4c 2e 3c 2f 64 d by OpenSSL.</d
28d0: 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 68 33 3e 3c 61 d>.</dl>..<h3><a
28e0: 20 6e 61 6d 65 3d 22 43 41 4c 4c 42 41 43 4b 20 name="CALLBACK
28f0: 4f 50 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 OPTIONS">CALLBAC
2900: 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 68 K OPTIONS</a></h
2910: 33 3e 0a 0a 3c 70 3e 0a 41 73 20 69 6e 64 69 63 3>..<p>.As indic
2920: 61 74 65 64 20 61 62 6f 76 65 2c 20 69 6e 64 69 ated above, indi
2930: 76 69 64 75 61 6c 20 63 68 61 6e 6e 65 6c 73 20 vidual channels
2940: 63 61 6e 20 62 65 20 67 69 76 65 6e 20 74 68 65 can be given the
2950: 69 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 6b 73 ir own callbacks
2960: 0a 74 6f 20 68 61 6e 64 6c 65 20 69 6e 74 65 72 .to handle inter
2970: 6d 65 64 69 61 74 65 20 70 72 6f 63 65 73 73 69 mediate processi
2980: 6e 67 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 ng by the OpenSS
2990: 4c 20 6c 69 62 72 61 72 79 2c 20 75 73 69 6e 67 L library, using
29a0: 20 74 68 65 0a 3c 65 6d 3e 2d 63 6f 6d 6d 61 6e the.<em>-comman
29b0: 64 3c 2f 65 6d 3e 20 61 6e 64 20 3c 65 6d 3e 2d d</em> and <em>-
29c0: 70 61 73 73 77 6f 72 64 3c 2f 65 6d 3e 20 6f 70 password</em> op
29d0: 74 69 6f 6e 73 20 70 61 73 73 65 64 20 74 6f 20 tions passed to
29e0: 65 69 74 68 65 72 20 6f 66 0a 3c 73 74 72 6f 6e either of.<stron
29f0: 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f 73 g>tls::socket</s
2a00: 74 72 6f 6e 67 3e 20 6f 72 20 3c 73 74 72 6f 6e trong> or <stron
2a10: 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 g>tls::import</s
2a20: 74 72 6f 6e 67 3e 2e 0a 3c 2f 70 3e 0a 0a 3c 62 trong>..</p>..<b
2a30: 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 64 6c 3e 0a lockquote>.<dl>.
2a40: 0a 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 . <dt><strong
2a50: 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74 72 6f 6e >-command</stron
2a60: 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c g> <em>callback<
2a70: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 /em></dt>. <d
2a80: 64 3e 0a 09 49 6e 76 6f 6b 65 73 20 74 68 65 20 d>..Invokes the
2a90: 73 70 65 63 69 66 69 65 64 20 3c 65 6d 3e 63 61 specified <em>ca
2aa0: 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 20 73 63 72 69 llback</em> scri
2ab0: 70 74 20 61 74 0a 09 73 65 76 65 72 61 6c 20 70 pt at..several p
2ac0: 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 68 65 oints during the
2ad0: 20 4f 70 65 6e 53 53 4c 20 68 61 6e 64 73 68 61 OpenSSL handsha
2ae0: 6b 65 2e 0a 09 45 78 63 65 70 74 20 61 73 20 69 ke...Except as i
2af0: 6e 64 69 63 61 74 65 64 20 62 65 6c 6f 77 2c 20 ndicated below,
2b00: 76 61 6c 75 65 73 20 72 65 74 75 72 6e 65 64 20 values returned
2b10: 66 72 6f 6d 20 74 68 65 0a 09 63 61 6c 6c 62 61 from the..callba
2b20: 63 6b 20 61 72 65 20 69 67 6e 6f 72 65 64 2e 0a ck are ignored..
2b30: 09 41 72 67 75 6d 65 6e 74 73 20 61 70 70 65 6e .Arguments appen
2b40: 64 65 64 20 74 6f 20 74 68 65 20 73 63 72 69 70 ded to the scrip
2b50: 74 20 75 70 6f 6e 20 63 61 6c 6c 62 61 63 6b 20 t upon callback
2b60: 74 61 6b 65 20 6f 6e 65 20 6f 66 20 74 68 65 0a take one of the.
2b70: 09 66 6f 6c 6c 6f 77 69 6e 67 20 66 6f 72 6d 73 .following forms
2b80: 3a 0a 0a 09 3c 62 72 3e 0a 09 3c 62 72 3e 0a 0a :...<br>..<br>..
2b90: 09 3c 64 6c 3e 0a 0a 0a 09 3c 64 74 3e 0a 09 20 .<dl>....<dt>..
2ba0: 20 3c 73 74 72 6f 6e 67 3e 69 6e 66 6f 3c 2f 73 <strong>info</s
2bb0: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e trong> <em>chann
2bc0: 65 6c 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d el major minor m
2bd0: 65 73 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f 64 essage</em>..</d
2be0: 74 3e 0a 09 3c 64 64 3e 0a 09 20 20 54 68 69 73 t>..<dd>.. This
2bf0: 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 form of callbac
2c00: 6b 20 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 k is invoked by
2c10: 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 the OpenSSL func
2c20: 74 69 6f 6e 0a 09 20 20 3c 63 6f 64 65 3e 53 53 tion.. <code>SS
2c30: 4c 5f 43 54 58 5f 73 65 74 5f 69 6e 66 6f 5f 63 L_CTX_set_info_c
2c40: 61 6c 6c 62 61 63 6b 28 29 3c 2f 63 6f 64 65 3e allback()</code>
2c50: 2e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 ... <br>.. The
2c60: 20 3c 65 6d 3e 6d 61 6a 6f 72 3c 2f 65 6d 3e 20 <em>major</em>
2c70: 61 6e 64 20 3c 65 6d 3e 6d 69 6e 6f 72 3c 2f 65 and <em>minor</e
2c80: 6d 3e 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 m> arguments are
2c90: 20 75 73 65 64 20 74 6f 0a 09 20 20 72 65 70 72 used to.. repr
2ca0: 65 73 65 6e 74 20 74 68 65 20 73 74 61 74 65 20 esent the state
2cb0: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 62 69 74 6d information bitm
2cc0: 61 73 6b 2e 0a 09 20 20 3c 64 6c 3e 0a 09 20 20 ask... <dl>..
2cd0: 3c 64 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c <dt>Possible val
2ce0: 75 65 73 20 66 6f 72 20 3c 65 6d 3e 6d 61 6a 6f ues for <em>majo
2cf0: 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e r</em> are:</dt>
2d00: 0a 09 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 68 61 .. <dd><code>ha
2d10: 6e 64 73 68 61 6b 65 2c 20 61 6c 65 72 74 2c 20 ndshake, alert,
2d20: 63 6f 6e 6e 65 63 74 2c 20 61 63 63 65 70 74 3c connect, accept<
2d30: 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a 09 20 20 /code>.</dd>..
2d40: 3c 64 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c <dt>Possible val
2d50: 75 65 73 20 66 6f 72 20 3c 65 6d 3e 6d 69 6e 6f ues for <em>mino
2d60: 72 3c 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e r</em> are:</dt>
2d70: 0a 09 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 73 74 .. <dd><code>st
2d80: 61 72 74 2c 20 64 6f 6e 65 2c 20 72 65 61 64 2c art, done, read,
2d90: 20 77 72 69 74 65 2c 20 6c 6f 6f 70 2c 20 65 78 write, loop, ex
2da0: 69 74 3c 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a it</code>.</dd>.
2db0: 09 20 20 3c 2f 64 6c 3e 0a 09 20 20 54 68 65 20 . </dl>.. The
2dc0: 3c 65 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d 3e <em>message</em>
2dd0: 20 61 72 67 75 6d 65 6e 74 20 69 73 20 61 20 64 argument is a d
2de0: 65 73 63 72 69 70 74 69 76 65 20 73 74 72 69 6e escriptive strin
2df0: 67 20 77 68 69 63 68 20 6d 61 79 0a 09 20 20 62 g which may.. b
2e00: 65 20 67 65 6e 65 72 61 74 65 64 20 65 69 74 68 e generated eith
2e10: 65 72 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53 er by.. <code>S
2e20: 53 4c 5f 73 74 61 74 65 5f 73 74 72 69 6e 67 5f SL_state_string_
2e30: 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e 20 6f 72 long()</code> or
2e40: 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c by.. <code>SSL
2e50: 5f 61 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69 _alert_desc_stri
2e60: 6e 67 5f 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e ng_long()</code>
2e70: 2c 0a 09 20 20 64 65 70 65 6e 64 69 6e 67 20 6f ,.. depending o
2e80: 6e 20 63 6f 6e 74 65 78 74 2e 0a 09 3c 2f 64 64 n context...</dd
2e90: 3e 0a 0a 09 3c 62 72 3e 0a 0a 09 3c 64 74 3e 0a >...<br>...<dt>.
2ea0: 09 20 20 3c 73 74 72 6f 6e 67 3e 76 65 72 69 66 . <strong>verif
2eb0: 79 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 y</strong> <em>c
2ec0: 68 61 6e 6e 65 6c 20 64 65 70 74 68 20 63 65 72 hannel depth cer
2ed0: 74 20 73 74 61 74 75 73 20 65 72 72 6f 72 3c 2f t status error</
2ee0: 65 6d 3e 0a 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e em>..</dt>..<dd>
2ef0: 0a 09 20 20 54 68 69 73 20 66 6f 72 6d 20 6f 66 .. This form of
2f00: 20 63 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 callback is inv
2f10: 6f 6b 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e oked by the Open
2f20: 53 53 4c 20 66 75 6e 63 74 69 6f 6e 0a 09 20 20 SSL function..
2f30: 3c 63 6f 64 65 3e 53 53 4c 5f 73 65 74 5f 76 65 <code>SSL_set_ve
2f40: 72 69 66 79 28 29 3c 2f 63 6f 64 65 3e 2e 0a 09 rify()</code>...
2f50: 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65 <br>.. The <e
2f60: 6d 3e 64 65 70 74 68 3c 2f 65 6d 3e 20 61 72 67 m>depth</em> arg
2f70: 75 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e 74 65 ument is an inte
2f80: 67 65 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 ger representing
2f90: 20 74 68 65 0a 09 20 20 63 75 72 72 65 6e 74 20 the.. current
2fa0: 64 65 70 74 68 20 6f 6e 20 74 68 65 20 63 65 72 depth on the cer
2fb0: 74 69 66 69 63 61 74 65 20 63 68 61 69 6e 2c 20 tificate chain,
2fc0: 77 69 74 68 0a 09 20 20 3c 63 6f 64 65 3e 30 3c with.. <code>0<
2fd0: 2f 63 6f 64 65 3e 20 61 73 20 74 68 65 20 73 75 /code> as the su
2fe0: 62 6a 65 63 74 20 63 65 72 74 69 66 69 63 61 74 bject certificat
2ff0: 65 20 61 6e 64 20 68 69 67 68 65 72 20 76 61 6c e and higher val
3000: 75 65 73 0a 09 20 20 64 65 6e 6f 74 69 6e 67 20 ues.. denoting
3010: 70 72 6f 67 72 65 73 73 69 76 65 6c 79 20 6d 6f progressively mo
3020: 72 65 20 69 6e 64 69 72 65 63 74 20 69 73 73 75 re indirect issu
3030: 65 72 20 63 65 72 74 69 66 69 63 61 74 65 73 2e er certificates.
3040: 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 .. <br>.. The
3050: 3c 65 6d 3e 63 65 72 74 3c 2f 65 6d 3e 20 61 72 <em>cert</em> ar
3060: 67 75 6d 65 6e 74 20 69 73 20 61 20 6c 69 73 74 gument is a list
3070: 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 of key-value pa
3080: 69 72 73 20 73 69 6d 69 6c 61 72 0a 09 20 20 74 irs similar.. t
3090: 6f 20 74 68 6f 73 65 20 72 65 74 75 72 6e 65 64 o those returned
30a0: 20 62 79 0a 09 20 20 3c 61 20 68 72 65 66 3d 22 by.. <a href="
30b0: 23 74 6c 73 3a 3a 73 74 61 74 75 73 22 3e 3c 73 #tls::status"><s
30c0: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 74 61 74 75 trong>tls::statu
30d0: 73 3c 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 2e 0a s</strong></a>..
30e0: 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c . <br>.. The <
30f0: 65 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20 61 em>status</em> a
3100: 72 67 75 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e rgument is an in
3110: 74 65 67 65 72 20 72 65 70 72 65 73 65 6e 74 69 teger representi
3120: 6e 67 20 74 68 65 0a 09 20 20 63 75 72 72 65 6e ng the.. curren
3130: 74 20 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 t validity of th
3140: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 0a 09 e certificate...
3150: 20 20 41 20 76 61 6c 75 65 20 6f 66 20 3c 63 6f A value of <co
3160: 64 65 3e 30 3c 2f 63 6f 64 65 3e 20 6d 65 61 6e de>0</code> mean
3170: 73 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 s the certificat
3180: 65 20 69 73 20 64 65 65 6d 65 64 20 69 6e 76 61 e is deemed inva
3190: 6c 69 64 2e 0a 09 20 20 41 20 76 61 6c 75 65 20 lid... A value
31a0: 6f 66 20 3c 63 6f 64 65 3e 31 3c 2f 63 6f 64 65 of <code>1</code
31b0: 3e 20 6d 65 61 6e 73 20 74 68 65 20 63 65 72 74 > means the cert
31c0: 69 66 69 63 61 74 65 20 69 73 20 64 65 65 6d 65 ificate is deeme
31d0: 64 20 76 61 6c 69 64 2e 0a 09 20 20 3c 62 72 3e d valid... <br>
31e0: 0a 09 20 20 54 68 65 20 3c 65 6d 3e 65 72 72 6f .. The <em>erro
31f0: 72 3c 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 r</em> argument
3200: 73 75 70 70 6c 69 65 73 20 74 68 65 20 6d 65 73 supplies the mes
3210: 73 61 67 65 2c 20 69 66 20 61 6e 79 2c 20 67 65 sage, if any, ge
3220: 6e 65 72 61 74 65 64 0a 09 20 20 62 79 0a 09 20 nerated.. by..
3230: 20 3c 63 6f 64 65 3e 58 35 30 39 5f 53 54 4f 52 <code>X509_STOR
3240: 45 5f 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28 E_CTX_get_error(
3250: 29 3c 2f 63 6f 64 65 3e 2e 0a 09 20 20 3c 62 72 )</code>... <br
3260: 3e 0a 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 >.. <br>.. The
3270: 20 63 61 6c 6c 62 61 63 6b 20 6d 61 79 20 6f 76 callback may ov
3280: 65 72 72 69 64 65 20 6e 6f 72 6d 61 6c 20 76 61 erride normal va
3290: 6c 69 64 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 lidation process
32a0: 69 6e 67 20 62 79 20 65 78 70 6c 69 63 69 74 6c ing by explicitl
32b0: 79 0a 09 20 20 72 65 74 75 72 6e 69 6e 67 20 6f y.. returning o
32c0: 6e 65 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20 ne of the above
32d0: 3c 65 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20 <em>status</em>
32e0: 76 61 6c 75 65 73 2e 0a 09 3c 2f 64 64 3e 0a 0a values...</dd>..
32f0: 09 3c 2f 64 6c 3e 0a 20 20 20 20 3c 2f 64 64 3e .</dl>. </dd>
3300: 0a 0a 20 20 20 20 3c 62 72 3e 0a 0a 20 20 20 20 .. <br>..
3310: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 73 <dt><strong>-pas
3320: 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c sword</strong> <
3330: 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e em>callback</em>
3340: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 0a 09 </dt>. <dd>..
3350: 49 6e 76 6f 6b 65 73 20 74 68 65 20 73 70 65 63 Invokes the spec
3360: 69 66 69 65 64 20 3c 65 6d 3e 63 61 6c 6c 62 61 ified <em>callba
3370: 63 6b 3c 2f 65 6d 3e 20 73 63 72 69 70 74 20 77 ck</em> script w
3380: 68 65 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 hen OpenSSL need
3390: 73 20 74 6f 0a 09 6f 62 74 61 69 6e 20 61 20 70 s to..obtain a p
33a0: 61 73 73 77 6f 72 64 2e 20 20 54 68 65 20 63 61 assword. The ca
33b0: 6c 6c 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65 llback should re
33c0: 74 75 72 6e 20 61 20 73 74 72 69 6e 67 20 77 68 turn a string wh
33d0: 69 63 68 0a 09 72 65 70 72 65 73 65 6e 74 73 20 ich..represents
33e0: 74 68 65 20 70 61 73 73 77 6f 72 64 20 74 6f 20 the password to
33f0: 62 65 20 75 73 65 64 2e 0a 09 4e 6f 20 61 72 67 be used...No arg
3400: 75 6d 65 6e 74 73 20 61 72 65 20 61 70 70 65 6e uments are appen
3410: 64 65 64 20 74 6f 20 74 68 65 20 73 63 72 69 70 ded to the scrip
3420: 74 20 75 70 6f 6e 20 63 61 6c 6c 62 61 63 6b 2e t upon callback.
3430: 0a 20 20 20 20 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e . </dd>.</dl>
3440: 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a .</blockquote>..
3450: 3c 70 3e 0a 52 65 66 65 72 65 6e 63 65 20 69 6d <p>.Reference im
3460: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 plementations of
3470: 20 74 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73 these callbacks
3480: 20 61 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e are provided in
3490: 20 74 68 65 0a 64 69 73 74 72 69 62 75 74 69 6f the.distributio
34a0: 6e 20 61 73 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 n as <strong>tls
34b0: 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73 74 72 6f ::callback</stro
34c0: 6e 67 3e 20 61 6e 64 0a 3c 73 74 72 6f 6e 67 3e ng> and.<strong>
34d0: 74 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73 tls::password</s
34e0: 74 72 6f 6e 67 3e 20 72 65 73 70 65 63 74 69 76 trong> respectiv
34f0: 65 6c 79 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 ely. Note that
3500: 74 68 65 73 65 20 61 72 65 0a 3c 65 6d 3e 73 61 these are.<em>sa
3510: 6d 70 6c 65 3c 2f 65 6d 3e 20 69 6d 70 6c 65 6d mple</em> implem
3520: 65 6e 74 61 74 69 6f 6e 73 20 6f 6e 6c 79 2e 20 entations only.
3530: 20 49 6e 20 61 20 6d 6f 72 65 20 72 65 61 6c 69 In a more reali
3540: 73 74 69 63 20 64 65 70 6c 6f 79 6d 65 6e 74 0a stic deployment.
3550: 79 6f 75 20 77 6f 75 6c 64 20 73 70 65 63 69 66 you would specif
3560: 79 20 79 6f 75 72 20 6f 77 6e 20 63 61 6c 6c 62 y your own callb
3570: 61 63 6b 20 73 63 72 69 70 74 73 20 6f 6e 20 65 ack scripts on e
3580: 61 63 68 20 54 4c 53 20 63 68 61 6e 6e 65 6c 0a ach TLS channel.
3590: 75 73 69 6e 67 20 74 68 65 20 3c 65 6d 3e 2d 63 using the <em>-c
35a0: 6f 6d 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20 ommand</em> and
35b0: 3c 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 <em>-password</e
35c0: 6d 3e 20 6f 70 74 69 6f 6e 73 2e 0a 3c 2f 70 3e m> options..</p>
35d0: 0a 0a 3c 70 3e 0a 54 68 65 20 64 65 66 61 75 6c ..<p>.The defaul
35e0: 74 20 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20 t behavior when
35f0: 74 68 65 20 3c 65 6d 3e 2d 63 6f 6d 6d 61 6e 64 the <em>-command
3600: 3c 2f 65 6d 3e 20 6f 70 74 69 6f 6e 20 69 73 20 </em> option is
3610: 6e 6f 74 20 73 70 65 63 69 66 69 65 64 20 69 73 not specified is
3620: 20 66 6f 72 0a 54 4c 53 20 74 6f 20 70 72 6f 63 for.TLS to proc
3630: 65 73 73 20 74 68 65 20 61 73 73 6f 63 69 61 74 ess the associat
3640: 65 64 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62 ed library callb
3650: 61 63 6b 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2e acks internally.
3660: 0a 54 68 65 20 64 65 66 61 75 6c 74 20 62 65 68 .The default beh
3670: 61 76 69 6f 72 20 77 68 65 6e 20 74 68 65 20 3c avior when the <
3680: 65 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d em>-password</em
3690: 3e 20 6f 70 74 69 6f 6e 20 69 73 20 6e 6f 74 20 > option is not
36a0: 73 70 65 63 69 66 69 65 64 20 69 73 20 66 6f 72 specified is for
36b0: 0a 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 .TLS to process
36c0: 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c the associated l
36d0: 69 62 72 61 72 79 20 63 61 6c 6c 62 61 63 6b 73 ibrary callbacks
36e0: 20 62 79 20 61 74 74 65 6d 70 74 69 6e 67 20 74 by attempting t
36f0: 6f 20 63 61 6c 6c 0a 3c 73 74 72 6f 6e 67 3e 74 o call.<strong>t
3700: 6c 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74 ls::password</st
3710: 72 6f 6e 67 3e 2e 0a 54 68 65 20 64 69 66 66 65 rong>..The diffe
3720: 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 rence between th
3730: 65 73 65 20 74 77 6f 20 62 65 68 61 76 69 6f 72 ese two behavior
3740: 73 20 69 73 20 61 20 63 6f 6e 73 65 71 75 65 6e s is a consequen
3750: 63 65 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e ce of maintainin
3760: 67 0a 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 g.compatibility
3770: 77 69 74 68 20 65 61 72 6c 69 65 72 20 69 6d 70 with earlier imp
3780: 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a 3c 2f lementations..</
3790: 70 3e 0a 0a 3c 70 3e 0a 54 68 65 20 3c 73 74 72 p>..<p>.The <str
37a0: 6f 6e 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f ong>tls::debug</
37b0: 73 74 72 6f 6e 67 3e 20 76 61 72 69 61 62 6c 65 strong> variable
37c0: 20 70 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61 provides some a
37d0: 64 64 69 74 69 6f 6e 61 6c 0a 63 6f 6e 74 72 6f dditional.contro
37e0: 6c 20 6f 76 65 72 20 74 68 65 73 65 20 72 65 66 l over these ref
37f0: 65 72 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73 erence callbacks
3800: 2e 20 20 49 74 73 20 76 61 6c 75 65 20 69 73 20 . Its value is
3810: 7a 65 72 6f 20 62 79 20 64 65 66 61 75 6c 74 2e zero by default.
3820: 0a 48 69 67 68 65 72 20 76 61 6c 75 65 73 20 70 .Higher values p
3830: 72 6f 64 75 63 65 20 6d 6f 72 65 20 64 69 61 67 roduce more diag
3840: 6e 6f 73 74 69 63 20 6f 75 74 70 75 74 2c 20 61 nostic output, a
3850: 6e 64 20 77 69 6c 6c 20 61 6c 73 6f 20 66 6f 72 nd will also for
3860: 63 65 20 74 68 65 0a 76 65 72 69 66 79 20 6d 65 ce the.verify me
3870: 74 68 6f 64 20 69 6e 20 3c 73 74 72 6f 6e 67 3e thod in <strong>
3880: 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73 tls::callback</s
3890: 74 72 6f 6e 67 3e 20 74 6f 20 61 63 63 65 70 74 trong> to accept
38a0: 20 74 68 65 0a 63 65 72 74 69 66 69 63 61 74 65 the.certificate
38b0: 2c 20 65 76 65 6e 20 77 68 65 6e 20 69 74 20 69 , even when it i
38c0: 73 20 69 6e 76 61 6c 69 64 2e 0a 3c 2f 70 3e 0a s invalid..</p>.
38d0: 0a 3c 70 3e 0a 3c 65 6d 3e 0a 54 68 65 20 75 73 .<p>.<em>.The us
38e0: 65 20 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e e of the referen
38f0: 63 65 20 63 61 6c 6c 62 61 63 6b 73 20 3c 73 74 ce callbacks <st
3900: 72 6f 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 rong>tls::callba
3910: 63 6b 3c 2f 73 74 72 6f 6e 67 3e 20 61 6e 64 0a ck</strong> and.
3920: 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 70 61 73 <strong>tls::pas
3930: 73 77 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 69 sword</strong> i
3940: 73 20 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 s not recommende
3950: 64 2e 20 20 54 68 65 79 20 6d 61 79 20 62 65 20 d. They may be
3960: 72 65 6d 6f 76 65 64 0a 66 72 6f 6d 20 66 75 74 removed.from fut
3970: 75 72 65 20 72 65 6c 65 61 73 65 73 2e 0a 3c 2f ure releases..</
3980: 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 70 3e 0a 3c 65 em>.</p>..<p>.<e
3990: 6d 3e 0a 54 68 65 20 75 73 65 20 6f 66 20 74 68 m>.The use of th
39a0: 65 20 76 61 72 69 61 62 6c 65 20 3c 73 74 72 6f e variable <stro
39b0: 6e 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f 73 ng>tls::debug</s
39c0: 74 72 6f 6e 67 3e 20 69 73 20 6e 6f 74 20 72 65 trong> is not re
39d0: 63 6f 6d 6d 65 6e 64 65 64 2e 0a 49 74 20 6d 61 commended..It ma
39e0: 79 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f y be removed fro
39f0: 6d 20 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 m future release
3a00: 73 2e 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c s..</em>.</p>..<
3a10: 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 48 54 54 50 h3><a name="HTTP
3a20: 53 20 45 58 41 4d 50 4c 45 22 3e 48 54 54 50 53 S EXAMPLE">HTTPS
3a30: 20 45 58 41 4d 50 4c 45 3c 2f 61 3e 3c 2f 68 33 EXAMPLE</a></h3
3a40: 3e 0a 0a 3c 70 3e 54 68 69 73 20 65 78 61 6d 70 >..<p>This examp
3a50: 6c 65 20 75 73 65 73 20 61 20 73 61 6d 70 6c 65 le uses a sample
3a60: 20 73 65 72 76 65 72 2e 70 65 6d 20 70 72 6f 76 server.pem prov
3a70: 69 64 65 64 20 77 69 74 68 20 74 68 65 20 54 4c ided with the TL
3a80: 53 20 72 65 6c 65 61 73 65 2c 0a 63 6f 75 72 74 S release,.court
3a90: 65 73 79 20 6f 66 20 74 68 65 20 3c 73 74 72 6f esy of the <stro
3aa0: 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72 6f ng>OpenSSL</stro
3ab0: 6e 67 3e 20 70 72 6f 6a 65 63 74 2e 3c 2f 70 3e ng> project.</p>
3ac0: 0a 0a 3c 70 72 65 3e 3c 63 6f 64 65 3e 0a 70 61 ..<pre><code>.pa
3ad0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 68 74 ckage require ht
3ae0: 74 70 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 tp.package requi
3af0: 72 65 20 74 6c 73 0a 0a 68 74 74 70 3a 3a 72 65 re tls..http::re
3b00: 67 69 73 74 65 72 20 68 74 74 70 73 20 34 34 33 gister https 443
3b10: 20 5b 6c 69 73 74 20 3a 3a 74 6c 73 3a 3a 73 6f [list ::tls::so
3b20: 63 6b 65 74 20 2d 72 65 71 75 69 72 65 20 31 20 cket -require 1
3b30: 2d 63 61 66 69 6c 65 20 2e 2f 73 65 72 76 65 72 -cafile ./server
3b40: 2e 70 65 6d 5d 0a 0a 73 65 74 20 74 6f 6b 20 5b .pem]..set tok [
3b50: 68 74 74 70 3a 3a 67 65 74 75 72 6c 20 68 74 74 http::geturl htt
3b60: 70 73 3a 2f 2f 64 65 76 65 6c 6f 70 65 72 2e 6e ps://developer.n
3b70: 65 74 73 63 61 70 65 2e 63 6f 6d 2f 5d 0a 3c 2f etscape.com/].</
3b80: 63 6f 64 65 3e 3c 2f 70 72 65 3e 0a 0a 3c 68 33 code></pre>..<h3
3b90: 3e 3c 61 20 6e 61 6d 65 3d 22 53 50 45 43 49 41 ><a name="SPECIA
3ba0: 4c 20 43 4f 4e 53 49 44 45 52 41 54 49 4f 4e 53 L CONSIDERATIONS
3bb0: 22 3e 53 50 45 43 49 41 4c 20 43 4f 4e 53 49 44 ">SPECIAL CONSID
3bc0: 45 52 41 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 68 33 ERATIONS</a></h3
3bd0: 3e 0a 0a 3c 70 3e 54 68 65 20 63 61 70 61 62 69 >..<p>The capabi
3be0: 6c 69 74 69 65 73 20 6f 66 20 74 68 69 73 20 70 lities of this p
3bf0: 61 63 6b 61 67 65 20 63 61 6e 20 76 61 72 79 20 ackage can vary
3c00: 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61 73 65 64 enormously based
3c10: 0a 75 70 6f 6e 20 68 6f 77 20 79 6f 75 72 20 4f .upon how your O
3c20: 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 20 77 penSSL library w
3c30: 61 73 20 63 6f 6e 66 69 67 75 72 65 64 20 61 6e as configured an
3c40: 64 20 62 75 69 6c 74 2e 20 41 74 20 74 68 65 0a d built. At the.
3c50: 6d 6f 73 74 20 6d 61 63 72 6f 2d 6c 65 76 65 6c most macro-level
3c60: 20 4f 70 65 6e 53 53 4c 20 73 75 70 70 6f 72 74 OpenSSL support
3c70: 73 20 61 20 26 71 75 6f 74 3b 6e 6f 20 70 61 74 s a "no pat
3c80: 65 6e 74 73 26 71 75 6f 74 3b 20 62 75 69 6c 64 ents" build
3c90: 2c 0a 77 68 69 63 68 20 64 69 73 61 62 6c 65 73 ,.which disables
3ca0: 20 52 53 41 2c 20 49 44 45 41 2c 20 52 43 28 32 RSA, IDEA, RC(2
3cb0: 2c 34 2c 35 29 20 61 6e 64 20 53 53 4c 32 20 2d ,4,5) and SSL2 -
3cc0: 20 69 66 20 79 6f 75 72 20 4f 70 65 6e 53 53 4c if your OpenSSL
3cd0: 20 69 73 0a 63 6f 6e 66 69 67 75 72 65 64 20 74 is.configured t
3ce0: 68 69 73 20 77 61 79 20 74 68 65 6e 20 79 6f 75 his way then you
3cf0: 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 62 75 will need to bu
3d00: 69 6c 64 20 54 4c 53 20 77 69 74 68 20 74 68 65 ild TLS with the
3d10: 0a 2d 44 4e 4f 5f 50 41 54 45 4e 54 53 20 6f 70 .-DNO_PATENTS op
3d20: 74 69 6f 6e 20 2d 20 61 6e 64 20 74 68 65 20 72 tion - and the r
3d30: 65 73 75 6c 74 61 6e 74 20 6d 6f 64 75 6c 65 20 esultant module
3d40: 77 69 6c 6c 20 66 75 6e 63 74 69 6f 6e 0a 63 6f will function.co
3d50: 72 72 65 63 74 6c 79 20 61 6e 64 20 61 6c 73 6f rrectly and also
3d60: 20 73 75 70 70 6f 72 74 20 41 44 48 20 63 65 72 support ADH cer
3d70: 74 69 66 69 63 61 74 65 2d 6c 65 73 73 20 65 6e tificate-less en
3d80: 63 72 79 70 74 69 6f 6e 2c 0a 68 6f 77 65 76 65 cryption,.howeve
3d90: 72 20 79 6f 75 20 77 69 6c 6c 20 62 65 20 75 6e r you will be un
3da0: 61 62 6c 65 20 74 6f 20 75 74 69 6c 69 7a 65 20 able to utilize
3db0: 74 68 69 73 20 74 6f 20 73 70 65 61 6b 20 74 6f this to speak to
3dc0: 20 6e 6f 72 6d 61 6c 20 57 65 62 0a 53 65 72 76 normal Web.Serv
3dd0: 65 72 73 2c 20 77 68 69 63 68 20 74 79 70 69 63 ers, which typic
3de0: 61 6c 6c 79 20 72 65 71 75 69 72 65 20 52 53 41 ally require RSA
3df0: 20 73 75 70 70 6f 72 74 2e 20 50 6c 65 61 73 65 support. Please
3e00: 20 73 65 65 20 3c 61 0a 68 72 65 66 3d 22 68 74 see <a.href="ht
3e10: 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73 73 6c tp://www.openssl
3e20: 2e 6f 72 67 2f 22 3e 68 74 74 70 3a 2f 2f 77 77 .org/">http://ww
3e30: 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 3c 2f w.openssl.org/</
3e40: 61 3e 20 66 6f 72 0a 6d 6f 72 65 20 69 6e 66 6f a> for.more info
3e50: 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 20 77 rmation on the w
3e60: 68 6f 6c 65 20 69 73 73 75 65 20 6f 66 20 70 61 hole issue of pa
3e70: 74 65 6e 74 73 20 61 6e 64 20 55 53 20 65 78 70 tents and US exp
3e80: 6f 72 74 0a 72 65 73 74 72 69 63 74 69 6f 6e 73 ort.restrictions
3e90: 2e 20 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20 6e . </p>..<h3><a n
3ea0: 61 6d 65 3d 22 53 45 45 20 41 4c 53 4f 22 3e 53 ame="SEE ALSO">S
3eb0: 45 45 20 41 4c 53 4f 3c 2f 61 3e 3c 2f 68 33 3e EE ALSO</a></h3>
3ec0: 0a 0a 3c 70 3e 3c 73 74 72 6f 6e 67 3e 73 6f 63 ..<p><strong>soc
3ed0: 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 2c 20 3c 73 ket</strong>, <s
3ee0: 74 72 6f 6e 67 3e 66 69 6c 65 65 76 65 6e 74 2c trong>fileevent,
3ef0: 20 3c 2f 73 74 72 6f 6e 67 3e 3c 61 0a 68 72 65 </strong><a.hre
3f00: 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 f="http://www.op
3f10: 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 3c 73 74 72 enssl.org/"><str
3f20: 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72 ong>OpenSSL</str
3f30: 6f 6e 67 3e 3c 2f 61 3e 3c 2f 70 3e 0a 0a 3c 68 ong></a></p>..<h
3f40: 72 3e 0a 0a 3c 70 72 65 3e 0a 43 6f 70 79 72 69 r>..<pre>.Copyri
3f50: 67 68 74 20 26 63 6f 70 79 3b 20 31 39 39 39 20 ght © 1999
3f60: 4d 61 74 74 20 4e 65 77 6d 61 6e 2e 0a 43 6f 70 Matt Newman..Cop
3f70: 79 72 69 67 68 74 20 26 63 6f 70 79 3b 20 32 30 yright © 20
3f80: 30 34 20 53 74 61 72 66 69 73 68 20 53 79 73 74 04 Starfish Syst
3f90: 65 6d 73 2e 0a 3c 2f 70 72 65 3e 0a 0a 5a 20 33 ems..</pre>..Z 3
3fa0: 36 64 62 64 33 36 63 37 35 39 36 33 65 31 66 35 6dbd36c75963e1f5
3fb0: 37 63 36 61 31 61 33 61 64 38 35 39 30 65 31 0a 7c6a1a3ad8590e1.