0000: 3c 21 64 6f 63 74 79 70 65 20 68 74 6d 6c 20 70 <!doctype html p
0010: 75 62 6c 69 63 20 22 2d 2f 2f 57 33 43 2f 2f 44 ublic "-//W3C//D
0020: 54 44 20 48 54 4d 4c 20 34 2e 30 20 54 72 61 6e TD HTML 4.0 Tran
0030: 73 69 74 69 6f 6e 61 6c 2f 2f 45 4e 22 3e 20 0a sitional//EN"> .
0040: 0a 3c 68 74 6d 6c 3e 0a 0a 3c 68 65 61 64 3e 0a .<html>..<head>.
0050: 3c 6d 65 74 61 20 68 74 74 70 2d 65 71 75 69 76 <meta http-equiv
0060: 3d 22 43 6f 6e 74 65 6e 74 2d 54 79 70 65 22 0a ="Content-Type".
0070: 63 6f 6e 74 65 6e 74 3d 22 74 65 78 74 2f 68 74 content="text/ht
0080: 6d 6c 3b 20 63 68 61 72 73 65 74 3d 69 73 6f 2d ml; charset=iso-
0090: 38 38 35 39 2d 31 22 3e 0a 3c 6d 65 74 61 20 6e 8859-1">.<meta n
00a0: 61 6d 65 3d 22 43 6f 70 79 72 69 67 68 74 22 20 ame="Copyright"
00b0: 63 6f 6e 74 65 6e 74 3d 22 31 39 39 39 20 4d 61 content="1999 Ma
00c0: 74 74 20 4e 65 77 6d 61 6e 20 2f 20 32 30 30 34 tt Newman / 2004
00d0: 20 53 74 61 72 66 69 73 68 20 53 79 73 74 65 6d Starfish System
00e0: 73 22 3e 0a 3c 74 69 74 6c 65 3e 54 4c 53 20 28 s">.<title>TLS (
00f0: 53 53 4c 29 20 54 63 6c 20 43 6f 6d 6d 61 6e 64 SSL) Tcl Command
0100: 73 3c 2f 74 69 74 6c 65 3e 0a 3c 2f 68 65 61 64 s</title>.</head
0110: 3e 0a 0a 3c 62 6f 64 79 20 62 67 63 6f 6c 6f 72 >..<body bgcolor
0120: 3d 22 23 46 46 46 46 46 46 22 3e 0a 0a 3c 64 6c ="#FFFFFF">..<dl
0130: 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 >. <dd><a hre
0140: 66 3d 22 23 4e 41 4d 45 22 3e 4e 41 4d 45 3c 2f f="#NAME">NAME</
0150: 61 3e 20 3c 64 6c 3e 0a 20 20 20 20 20 20 20 20 a> <dl>.
0160: 20 20 20 20 3c 64 64 3e 3c 73 74 72 6f 6e 67 3e <dd><strong>
0170: 74 6c 73 3c 2f 73 74 72 6f 6e 67 3e 20 2d 20 62 tls</strong> - b
0180: 69 6e 64 69 6e 67 20 74 6f 20 3c 73 74 72 6f 6e inding to <stron
0190: 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e g>OpenSSL</stron
01a0: 67 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 g>.
01b0: 20 20 20 74 6f 6f 6c 6b 69 74 2e 3c 2f 64 64 3e toolkit.</dd>
01c0: 0a 20 20 20 20 20 20 20 20 3c 2f 64 6c 3e 0a 20 . </dl>.
01d0: 20 20 20 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64 </dd>. <dd
01e0: 3e 3c 61 20 68 72 65 66 3d 22 23 53 59 4e 4f 50 ><a href="#SYNOP
01f0: 53 49 53 22 3e 53 59 4e 4f 50 53 49 53 3c 2f 61 SIS">SYNOPSIS</a
0200: 3e 20 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e > </dd>. <dd>
0210: 3c 64 6c 3e 0a 20 20 20 20 20 20 20 20 20 20 20 <dl>.
0220: 20 3c 64 64 3e 3c 62 3e 70 61 63 6b 61 67 65 20 <dd><b>package
0230: 72 65 71 75 69 72 65 20 54 63 6c 20 3c 2f 62 3e require Tcl </b>
0240: 3c 65 6d 3e 3f 38 2e 34 3f 3c 2f 65 6d 3e 3c 2f <em>?8.4?</em></
0250: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 dd>.
0260: 3c 64 64 3e 3c 62 3e 70 61 63 6b 61 67 65 20 72 <dd><b>package r
0270: 65 71 75 69 72 65 20 74 6c 73 20 3c 2f 62 3e 3c equire tls </b><
0280: 65 6d 3e 3f 40 40 56 45 52 53 40 40 3f 3c 2f 65 em>?@@VERS@@?</e
0290: 6d 3e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 m></dd>.
02a0: 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f <dt> </
02b0: 64 74 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 dt>.
02c0: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74 <dd><b>tls::init
02d0: 20 3c 2f 62 3e 3c 69 3e 3f 6f 70 74 69 6f 6e 73 </b><i>?options
02e0: 3f 3c 2f 69 3e 20 3c 2f 64 64 3e 0a 20 20 20 20 ?</i> </dd>.
02f0: 20 20 20 20 20 20 20 20 3c 64 64 3e 3c 62 3e 74 <dd><b>t
0300: 6c 73 3a 3a 73 6f 63 6b 65 74 20 3c 2f 62 3e 3c ls::socket </b><
0310: 65 6d 3e 3f 6f 70 74 69 6f 6e 73 3f 20 68 6f 73 em>?options? hos
0320: 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64 64 3e t port</em></dd>
0330: 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 . <dd
0340: 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c ><b>tls::socket<
0350: 2f 62 3e 3c 65 6d 3e 20 3f 2d 73 65 72 76 65 72 /b><em> ?-server
0360: 20 63 6f 6d 6d 61 6e 64 3f 0a 20 20 20 20 20 20 command?.
0370: 20 20 20 20 20 20 20 20 20 20 3f 6f 70 74 69 6f ?optio
0380: 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64 ns? port</em></d
0390: 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c d>. <
03a0: 64 64 3e 3c 62 3e 74 6c 73 3a 3a 68 61 6e 64 73 dd><b>tls::hands
03b0: 68 61 6b 65 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61 hake</b><em> cha
03c0: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20 nnel</em></dd>.
03d0: 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c <dd><
03e0: 62 3e 74 6c 73 3a 3a 73 74 61 74 75 73 20 3c 2f b>tls::status </
03f0: 62 3e 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f 20 63 b><em>?-local? c
0400: 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e hannel</em></dd>
0410: 0a 20 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 . <dd
0420: 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c ><b>tls::import<
0430: 2f 62 3e 3c 65 6d 3e 20 63 68 61 6e 6e 65 6c 20 /b><em> channel
0440: 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 65 6d 3e 3c 2f ?options?</em></
0450: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 dd>.
0460: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 75 6e 69 6d <dd><b>tls::unim
0470: 70 6f 72 74 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61 port</b><em> cha
0480: 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 64 64 3e 0a 20 nnel</em></dd>.
0490: 20 20 20 20 20 20 20 20 20 20 20 3c 64 64 3e 3c <dd><
04a0: 62 3e 74 6c 73 3a 3a 63 69 70 68 65 72 73 20 3c b>tls::ciphers <
04b0: 2f 62 3e 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20 /b><em>protocol
04c0: 3f 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f ?verbose?</em></
04d0: 64 64 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 dd>.
04e0: 3c 64 64 3e 3c 62 3e 74 6c 73 3a 3a 76 65 72 73 <dd><b>tls::vers
04f0: 69 6f 6e 3c 2f 62 3e 3c 2f 64 64 3e 0a 20 20 20 ion</b></dd>.
0500: 20 20 20 20 20 3c 2f 64 6c 3e 0a 20 20 20 20 3c </dl>. <
0510: 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 /dd>. <dd><a
0520: 68 72 65 66 3d 22 23 43 4f 4d 4d 41 4e 44 53 22 href="#COMMANDS"
0530: 3e 43 4f 4d 4d 41 4e 44 53 3c 2f 61 3e 3c 2f 64 >COMMANDS</a></d
0540: 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 d>. <dd><a hr
0550: 65 66 3d 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50 ef="#CALLBACK OP
0560: 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20 TIONS">CALLBACK
0570: 4f 50 54 49 4f 4e 53 3c 2f 61 3e 3c 2f 64 64 3e OPTIONS</a></dd>
0580: 0a 20 20 20 20 3c 64 64 3e 3c 61 20 68 72 65 66 . <dd><a href
0590: 3d 22 23 48 54 54 50 53 20 45 58 41 4d 50 4c 45 ="#HTTPS EXAMPLE
05a0: 22 3e 48 54 54 50 53 20 45 58 41 4d 50 4c 45 3c ">HTTPS EXAMPLE<
05b0: 2f 61 3e 3c 2f 64 64 3e 0a 20 20 20 20 3c 64 64 /a></dd>. <dd
05c0: 3e 3c 61 20 68 72 65 66 3d 22 23 53 45 45 20 41 ><a href="#SEE A
05d0: 4c 53 4f 22 3e 53 50 45 43 49 41 4c 20 43 4f 4e LSO">SPECIAL CON
05e0: 53 49 44 45 52 41 54 49 4f 4e 53 3c 2f 61 3e 3c SIDERATIONS</a><
05f0: 2f 64 64 3e 0a 20 20 20 20 3c 64 64 3e 3c 61 20 /dd>. <dd><a
0600: 68 72 65 66 3d 22 23 53 45 45 20 41 4c 53 4f 22 href="#SEE ALSO"
0610: 3e 53 45 45 20 41 4c 53 4f 3c 2f 61 3e 3c 2f 64 >SEE ALSO</a></d
0620: 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 68 72 3e 0a 0a d>.</dl>..<hr>..
0630: 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 4e 41 4d <h3><a name="NAM
0640: 45 22 3e 4e 41 4d 45 3c 2f 61 3e 3c 2f 68 33 3e E">NAME</a></h3>
0650: 0a 0a 3c 70 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 ..<p><strong>tls
0660: 3c 2f 73 74 72 6f 6e 67 3e 20 2d 20 62 69 6e 64 </strong> - bind
0670: 69 6e 67 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 4f ing to <strong>O
0680: 70 65 6e 53 53 4c 3c 2f 73 74 72 6f 6e 67 3e 0a penSSL</strong>.
0690: 74 6f 6f 6c 6b 69 74 2e 3c 2f 70 3e 0a 0a 3c 68 toolkit.</p>..<h
06a0: 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 59 4e 4f 50 3><a name="SYNOP
06b0: 53 49 53 22 3e 53 59 4e 4f 50 53 49 53 3c 2f 61 SIS">SYNOPSIS</a
06c0: 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 3c 62 3e 70 61 ></h3>..<p><b>pa
06d0: 63 6b 61 67 65 20 72 65 71 75 69 72 65 20 54 63 ckage require Tc
06e0: 6c 20 38 2e 34 3c 2f 62 3e 3c 62 72 3e 0a 3c 62 l 8.4</b><br>.<b
06f0: 3e 70 61 63 6b 61 67 65 20 72 65 71 75 69 72 65 >package require
0700: 20 74 6c 73 20 40 40 56 45 52 53 40 40 3c 2f 62 tls @@VERS@@</b
0710: 3e 3c 62 72 3e 0a 3c 62 72 3e 0a 3c 61 20 68 72 ><br>.<br>.<a hr
0720: 65 66 3d 22 23 74 6c 73 3a 3a 69 6e 69 74 22 3e ef="#tls::init">
0730: 3c 62 3e 74 6c 73 3a 3a 69 6e 69 74 20 3c 2f 62 <b>tls::init </b
0740: 3e 3c 69 3e 3f 6f 70 74 69 6f 6e 73 3f 3c 2f 69 ><i>?options?</i
0750: 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65 ><br>.</a><a hre
0760: 66 3d 22 23 74 6c 73 3a 3a 73 6f 63 6b 65 74 22 f="#tls::socket"
0770: 3e 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 20 ><b>tls::socket
0780: 3c 2f 62 3e 3c 65 6d 3e 3f 6f 70 74 69 6f 6e 73 </b><em>?options
0790: 3f 20 68 6f 73 74 0a 70 6f 72 74 3c 2f 65 6d 3e ? host.port</em>
07a0: 3c 62 72 3e 0a 3c 62 3e 74 6c 73 3a 3a 73 6f 63 <br>.<b>tls::soc
07b0: 6b 65 74 3c 2f 62 3e 3c 65 6d 3e 20 3f 2d 73 65 ket</b><em> ?-se
07c0: 72 76 65 72 20 63 6f 6d 6d 61 6e 64 3f 20 3f 6f rver command? ?o
07d0: 70 74 69 6f 6e 73 3f 20 70 6f 72 74 3c 2f 65 6d ptions? port</em
07e0: 3e 3c 62 72 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65 ><br>.</a><a hre
07f0: 66 3d 22 23 74 6c 73 3a 3a 73 74 61 74 75 73 22 f="#tls::status"
0800: 3e 3c 62 3e 74 6c 73 3a 3a 73 74 61 74 75 73 20 ><b>tls::status
0810: 3c 2f 62 3e 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f </b><em>?-local?
0820: 20 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 62 72 channel</em><br
0830: 3e 0a 3c 2f 61 3e 3c 61 20 68 72 65 66 3d 22 23 >.</a><a href="#
0840: 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 22 3e tls::handshake">
0850: 3c 62 3e 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b <b>tls::handshak
0860: 65 3c 2f 62 3e 3c 65 6d 3e 20 63 68 61 6e 6e 65 e</b><em> channe
0870: 6c 3c 2f 65 6d 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c l</em></a><br>.<
0880: 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c br>.<a href="#tl
0890: 73 3a 3a 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c s::import"><b>tl
08a0: 73 3a 3a 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 s::import </b><i
08b0: 3e 63 68 61 6e 6e 65 6c 20 3f 6f 70 74 69 6f 6e >channel ?option
08c0: 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 62 72 3e 0a 3c s?</i></a><br>.<
08d0: 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a 75 6e a href="#tls::un
08e0: 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a import"><b>tls::
08f0: 75 6e 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e unimport </b><i>
0900: 63 68 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61 3e 3c channel</i></a><
0910: 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c br>.<a href="#tl
0920: 73 3a 3a 63 69 70 68 65 72 73 20 70 72 6f 74 6f s::ciphers proto
0930: 63 6f 6c 20 3f 76 65 72 62 6f 73 65 3f 22 3e 3c col ?verbose?"><
0940: 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 63 69 70 68 strong>tls::ciph
0950: 65 72 73 3c 2f 73 74 72 6f 6e 67 3e 0a 3c 65 6d ers</strong>.<em
0960: 3e 70 72 6f 74 6f 63 6f 6c 20 3f 76 65 72 62 6f >protocol ?verbo
0970: 73 65 3f 3c 2f 65 6d 3e 3c 2f 61 3e 3c 62 72 3e se?</em></a><br>
0980: 0a 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 3a 3a .<a href="#tls::
0990: 76 65 72 73 69 6f 6e 22 3e 3c 62 3e 74 6c 73 3a version"><b>tls:
09a0: 3a 76 65 72 73 69 6f 6e 3c 2f 62 3e 3c 2f 61 3e :version</b></a>
09b0: 0a 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 .</p>..<h3><a na
09c0: 6d 65 3d 22 44 45 53 43 52 49 50 54 49 4f 4e 22 me="DESCRIPTION"
09d0: 3e 44 45 53 43 52 49 50 54 49 4f 4e 3c 2f 61 3e >DESCRIPTION</a>
09e0: 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 69 73 20 65 </h3>..<p>This e
09f0: 78 74 65 6e 73 69 6f 6e 20 70 72 6f 76 69 64 65 xtension provide
0a00: 73 20 61 20 67 65 6e 65 72 69 63 20 62 69 6e 64 s a generic bind
0a10: 69 6e 67 20 74 6f 20 3c 61 0a 68 72 65 66 3d 22 ing to <a.href="
0a20: 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73 http://www.opens
0a30: 73 6c 2e 6f 72 67 2f 22 3e 4f 70 65 6e 53 53 4c sl.org/">OpenSSL
0a40: 3c 2f 61 3e 2c 20 75 74 69 6c 69 7a 69 6e 67 20 </a>, utilizing
0a50: 74 68 65 0a 3c 73 74 72 6f 6e 67 3e 54 63 6c 5f the.<strong>Tcl_
0a60: 53 74 61 63 6b 43 68 61 6e 6e 65 6c 3c 2f 73 74 StackChannel</st
0a70: 72 6f 6e 67 3e 0a 41 50 49 20 66 6f 72 20 54 63 rong>.API for Tc
0a80: 6c 20 38 2e 32 20 61 6e 64 20 68 69 67 68 65 72 l 8.2 and higher
0a90: 2e 20 54 68 65 20 73 6f 63 6b 65 74 73 20 62 65 . The sockets be
0aa0: 68 61 76 65 20 65 78 61 63 74 6c 79 20 74 68 65 have exactly the
0ab0: 20 73 61 6d 65 0a 61 73 20 63 68 61 6e 6e 65 6c same.as channel
0ac0: 73 20 63 72 65 61 74 65 64 20 75 73 69 6e 67 20 s created using
0ad0: 54 63 6c 27 73 20 62 75 69 6c 74 2d 69 6e 20 3c Tcl's built-in <
0ae0: 73 74 72 6f 6e 67 3e 73 6f 63 6b 65 74 3c 2f 73 strong>socket</s
0af0: 74 72 6f 6e 67 3e 0a 63 6f 6d 6d 61 6e 64 20 77 trong>.command w
0b00: 69 74 68 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f ith additional o
0b10: 70 74 69 6f 6e 73 20 66 6f 72 20 63 6f 6e 74 72 ptions for contr
0b20: 6f 6c 6c 69 6e 67 20 74 68 65 20 53 53 4c 20 73 olling the SSL s
0b30: 65 73 73 69 6f 6e 2e 0a 54 6f 20 75 73 65 20 54 ession..To use T
0b40: 4c 53 20 77 69 74 68 20 61 6e 20 65 61 72 6c 69 LS with an earli
0b50: 65 72 20 76 65 72 73 69 6f 6e 20 6f 66 20 54 63 er version of Tc
0b60: 6c 20 74 68 61 6e 20 38 2e 34 2c 20 70 6c 65 61 l than 8.4, plea
0b70: 73 65 20 6f 62 74 61 69 6e 0a 54 4c 53 20 31 2e se obtain.TLS 1.
0b80: 33 2e 0a 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 20 3..</p>..<h3><a
0b90: 6e 61 6d 65 3d 22 43 4f 4d 4d 41 4e 44 53 22 3e name="COMMANDS">
0ba0: 43 4f 4d 4d 41 4e 44 53 3c 2f 61 3e 3c 2f 68 33 COMMANDS</a></h3
0bb0: 3e 0a 0a 3c 70 3e 54 79 70 69 63 61 6c 6c 79 20 >..<p>Typically
0bc0: 6f 6e 65 20 77 6f 75 6c 64 20 75 73 65 20 74 68 one would use th
0bd0: 65 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 e <strong>tls::s
0be0: 6f 63 6b 65 74 20 3c 2f 73 74 72 6f 6e 67 3e 63 ocket </strong>c
0bf0: 6f 6d 6d 61 6e 64 0a 77 68 69 63 68 20 70 72 6f ommand.which pro
0c00: 76 69 64 65 73 20 63 6f 6d 70 61 74 69 62 69 6c vides compatibil
0c10: 69 74 79 20 77 69 74 68 20 74 68 65 20 6e 61 74 ity with the nat
0c20: 69 76 65 20 54 63 6c 20 3c 73 74 72 6f 6e 67 3e ive Tcl <strong>
0c30: 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 0a socket</strong>.
0c40: 63 6f 6d 6d 61 6e 64 2e 20 49 6e 20 73 75 63 68 command. In such
0c50: 20 63 61 73 65 73 20 3c 73 74 72 6f 6e 67 3e 74 cases <strong>t
0c60: 6c 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f ls::import</stro
0c70: 6e 67 3e 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 ng> should not b
0c80: 65 0a 75 73 65 64 20 64 69 72 65 63 74 6c 79 2e e.used directly.
0c90: 3c 2f 70 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c </p>..<dl>. <
0ca0: 64 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a dt><a name="tls:
0cb0: 3a 69 6e 69 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69 :init"><b>tls::i
0cc0: 6e 69 74 20 3c 2f 62 3e 3c 69 3e 3f 6f 70 74 69 nit </b><i>?opti
0cd0: 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64 74 ons?</i></a></dt
0ce0: 3e 0a 20 20 20 20 3c 64 64 3e 54 68 69 73 20 72 >. <dd>This r
0cf0: 6f 75 74 69 6e 65 20 73 65 74 73 20 74 68 65 20 outine sets the
0d00: 64 65 66 61 75 6c 74 20 6f 70 74 69 6f 6e 73 20 default options
0d10: 75 73 65 64 20 62 79 20 3c 73 74 72 6f 6e 67 3e used by <strong>
0d20: 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f 73 74 72 tls::socket</str
0d30: 6f 6e 67 3e 0a 20 20 20 20 20 20 20 20 61 6e 64 ong>. and
0d40: 20 69 73 20 3c 65 6d 3e 6f 70 74 69 6f 6e 61 6c is <em>optional
0d50: 3c 2f 65 6d 3e 2e 20 49 66 20 79 6f 75 20 63 61 </em>. If you ca
0d60: 6c 6c 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a ll <strong>tls::
0d70: 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 0a import</strong>.
0d80: 20 20 20 20 20 20 20 20 64 69 72 65 63 74 6c 79 directly
0d90: 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 68 61 this routine ha
0da0: 73 20 6e 6f 20 65 66 66 65 63 74 2e 20 41 6e 79 s no effect. Any
0db0: 20 6f 66 20 74 68 65 20 6f 70 74 69 6f 6e 73 0a of the options.
0dc0: 20 20 20 20 20 20 20 20 74 68 61 74 20 3c 73 74 that <st
0dd0: 72 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 rong>tls::socket
0de0: 3c 2f 73 74 72 6f 6e 67 3e 20 61 63 63 65 70 74 </strong> accept
0df0: 73 20 63 61 6e 20 62 65 20 73 65 74 0a 20 20 20 s can be set.
0e00: 20 20 20 20 20 75 73 69 6e 67 20 74 68 69 73 20 using this
0e10: 63 6f 6d 6d 61 6e 64 2c 20 74 68 6f 75 67 68 20 command, though
0e20: 79 6f 75 20 73 68 6f 75 6c 64 20 6c 69 6d 69 74 you should limit
0e30: 20 79 6f 75 72 20 6f 70 74 69 6f 6e 73 0a 20 20 your options.
0e40: 20 20 20 20 20 20 74 6f 20 6f 6e 6c 79 20 54 4c to only TL
0e50: 53 20 72 65 6c 61 74 65 64 20 6f 6e 65 73 2e 3c S related ones.<
0e60: 2f 64 64 3e 0a 20 20 20 20 3c 64 74 3e 26 6e 62 /dd>. <dt>&nb
0e70: 73 70 3b 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74 sp;</dt>. <dt
0e80: 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 73 ><a name="tls::s
0e90: 6f 63 6b 65 74 22 3e 3c 62 3e 74 6c 73 3a 3a 73 ocket"><b>tls::s
0ea0: 6f 63 6b 65 74 20 3c 2f 62 3e 3c 65 6d 3e 3f 6f ocket </b><em>?o
0eb0: 70 74 69 6f 6e 73 3f 0a 20 20 20 20 20 20 20 20 ptions?.
0ec0: 68 6f 73 74 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f host port</em></
0ed0: 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 74 3e a></dt>. <dt>
0ee0: 3c 62 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c 2f <b>tls::socket</
0ef0: 62 3e 3c 65 6d 3e 20 3f 2d 73 65 72 76 65 72 20 b><em> ?-server
0f00: 63 6f 6d 6d 61 6e 64 3f 20 3f 6f 70 74 69 6f 6e command? ?option
0f10: 73 3f 20 70 6f 72 74 3c 2f 65 6d 3e 3c 2f 64 74 s? port</em></dt
0f20: 3e 0a 20 20 20 20 3c 64 64 3e 54 68 69 73 20 69 >. <dd>This i
0f30: 73 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63 74 s a helper funct
0f40: 69 6f 6e 20 74 68 61 74 20 75 74 69 6c 69 7a 65 ion that utilize
0f50: 73 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 s the underlying
0f60: 0a 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 . command
0f70: 73 20 28 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a s (<strong>tls::
0f80: 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e 67 3e 29 import</strong>)
0f90: 2e 20 49 74 20 62 65 68 61 76 65 73 0a 20 20 20 . It behaves.
0fa0: 20 20 20 20 20 65 78 61 63 74 6c 79 20 74 68 65 exactly the
0fb0: 20 73 61 6d 65 20 61 73 20 74 68 65 20 6e 61 74 same as the nat
0fc0: 69 76 65 20 54 63 6c 20 3c 73 74 72 6f 6e 67 3e ive Tcl <strong>
0fd0: 73 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 0a socket</strong>.
0fe0: 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 20 command
0ff0: 65 78 63 65 70 74 20 74 68 61 74 20 74 68 65 20 except that the
1000: 6f 70 74 69 6f 6e 73 20 63 61 6e 20 69 6e 63 6c options can incl
1010: 75 64 65 20 61 6e 79 20 6f 66 20 74 68 65 0a 20 ude any of the.
1020: 20 20 20 20 20 20 20 61 70 70 6c 69 63 61 62 6c applicabl
1030: 65 20 3c 61 20 68 72 65 66 3d 22 23 74 6c 73 3a e <a href="#tls:
1040: 3a 69 6d 70 6f 72 74 22 3e 3c 73 74 72 6f 6e 67 :import"><strong
1050: 3e 74 6c 73 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 >tls:import</str
1060: 6f 6e 67 3e 3c 2f 61 3e 0a 20 20 20 20 20 20 20 ong></a>.
1070: 20 6f 70 74 69 6f 6e 73 20 77 69 74 68 20 6f 6e options with on
1080: 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 6f 70 74 e additional opt
1090: 69 6f 6e 3a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 ion:.<blockquote
10a0: 3e 0a 20 20 20 20 3c 64 6c 3e 0a 20 20 20 20 20 >. <dl>.
10b0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d <dt><strong>-
10c0: 61 75 74 6f 73 65 72 76 65 72 6e 61 6d 65 3c 2f autoservername</
10d0: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c strong> <em>bool
10e0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 </em></dt>.
10f0: 20 20 20 3c 64 64 3e 41 75 74 6f 6d 61 74 69 63 <dd>Automatic
1100: 61 6c 6c 79 20 73 65 6e 64 20 74 68 65 20 2d 73 ally send the -s
1110: 65 72 76 65 72 6e 61 6d 65 20 61 73 20 74 68 65 ervername as the
1120: 20 3c 65 6d 3e 68 6f 73 74 3c 2f 65 6d 3e 20 61 <em>host</em> a
1130: 72 67 75 6d 65 6e 74 0a 20 20 20 20 20 20 20 20 rgument.
1140: 20 20 20 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 (<strong>def
1150: 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c ault</strong>: <
1160: 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c 2f em>false</em>)</
1170: 64 64 3e 0a 20 20 20 20 3c 2f 64 6c 3e 0a 3c 2f dd>. </dl>.</
1180: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 20 20 blockquote>.
1190: 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f 64 74 3e 0a <dt> </dt>.
11a0: 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 6d 65 3d <dt><a name=
11b0: 22 74 6c 73 3a 3a 68 61 6e 64 73 68 61 6b 65 22 "tls::handshake"
11c0: 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 68 61 ><strong>tls::ha
11d0: 6e 64 73 68 61 6b 65 3c 2f 73 74 72 6f 6e 67 3e ndshake</strong>
11e0: 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d <em>channel</em
11f0: 3e 3c 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c ></a></dt>. <
1200: 64 64 3e 46 6f 72 63 65 73 20 68 61 6e 64 73 68 dd>Forces handsh
1210: 61 6b 65 20 74 6f 20 74 61 6b 65 20 70 6c 61 63 ake to take plac
1220: 65 2c 20 61 6e 64 20 72 65 74 75 72 6e 73 20 30 e, and returns 0
1230: 20 69 66 0a 20 20 20 20 20 20 20 20 68 61 6e 64 if. hand
1240: 73 68 61 6b 65 20 69 73 20 73 74 69 6c 6c 20 69 shake is still i
1250: 6e 20 70 72 6f 67 72 65 73 73 20 28 6e 6f 6e 2d n progress (non-
1260: 62 6c 6f 63 6b 69 6e 67 29 2c 20 6f 72 20 31 20 blocking), or 1
1270: 69 66 0a 20 20 20 20 20 20 20 20 74 68 65 20 68 if. the h
1280: 61 6e 64 73 68 61 6b 65 20 77 61 73 20 73 75 63 andshake was suc
1290: 63 65 73 73 66 75 6c 2e 20 49 66 20 74 68 65 20 cessful. If the
12a0: 68 61 6e 64 73 68 61 6b 65 20 66 61 69 6c 65 64 handshake failed
12b0: 0a 20 20 20 20 20 20 20 20 74 68 69 73 20 72 6f . this ro
12c0: 75 74 69 6e 65 20 77 69 6c 6c 20 74 68 72 6f 77 utine will throw
12d0: 20 61 6e 20 65 72 72 6f 72 2e 3c 2f 64 64 3e 0a an error.</dd>.
12e0: 20 20 20 20 3c 64 74 3e 26 6e 62 73 70 3b 3c 2f <dt> </
12f0: 64 74 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e dt>. <dt><a n
1300: 61 6d 65 3d 22 74 6c 73 3a 3a 73 74 61 74 75 73 ame="tls::status
1310: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 73 "><strong>tls::s
1320: 74 61 74 75 73 3c 2f 73 74 72 6f 6e 67 3e 0a 20 tatus</strong>.
1330: 20 20 20 3c 65 6d 3e 3f 2d 6c 6f 63 61 6c 3f 20 <em>?-local?
1340: 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 3c 2f 61 3e channel</em></a>
1350: 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 52 65 </dt>. <dd>Re
1360: 74 75 72 6e 73 20 74 68 65 20 63 75 72 72 65 6e turns the curren
1370: 74 20 73 65 63 75 72 69 74 79 20 73 74 61 74 75 t security statu
1380: 73 20 6f 66 20 61 6e 20 53 53 4c 20 63 68 61 6e s of an SSL chan
1390: 6e 65 6c 2e 20 54 68 65 0a 20 20 20 20 20 20 20 nel. The.
13a0: 20 72 65 73 75 6c 74 20 69 73 20 61 20 6c 69 73 result is a lis
13b0: 74 20 6f 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 t of key-value p
13c0: 61 69 72 73 20 64 65 73 63 72 69 62 69 6e 67 20 airs describing
13d0: 74 68 65 0a 20 20 20 20 20 20 20 20 63 6f 6e 6e the. conn
13e0: 65 63 74 65 64 20 70 65 65 72 2e 20 49 66 20 74 ected peer. If t
13f0: 68 65 20 72 65 73 75 6c 74 20 69 73 20 61 6e 20 he result is an
1400: 65 6d 70 74 79 20 6c 69 73 74 20 74 68 65 6e 20 empty list then
1410: 74 68 65 0a 20 20 20 20 20 20 20 20 53 53 4c 20 the. SSL
1420: 68 61 6e 64 73 68 61 6b 65 20 68 61 73 20 6e 6f handshake has no
1430: 74 20 79 65 74 20 63 6f 6d 70 6c 65 74 65 64 2e t yet completed.
1440: 0a 20 20 20 20 20 20 20 20 49 66 20 3c 65 6d 3e . If <em>
1450: 2d 6c 6f 63 61 6c 3c 2f 65 6d 3e 20 69 73 20 67 -local</em> is g
1460: 69 76 65 6e 2c 20 74 68 65 6e 20 74 68 65 20 63 iven, then the c
1470: 65 72 74 69 66 69 63 61 74 65 20 69 6e 66 6f 72 ertificate infor
1480: 6d 61 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 69 mation. i
1490: 73 20 74 68 65 20 6f 6e 65 20 75 73 65 64 20 6c s the one used l
14a0: 6f 63 61 6c 6c 79 2e 3c 2f 64 64 3e 0a 3c 2f 64 ocally.</dd>.</d
14b0: 6c 3e 0a 0a 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e l>..<blockquote>
14c0: 0a 20 20 20 20 3c 64 6c 3e 0a 20 20 20 20 20 20 . <dl>.
14d0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 69 73 <dt><strong>is
14e0: 73 75 65 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 suer</strong> <e
14f0: 6d 3e 64 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 m>dn</em></dt>.
1500: 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 64 <dd>The d
1510: 69 73 74 69 6e 67 75 69 73 68 65 64 20 6e 61 6d istinguished nam
1520: 65 20 28 44 4e 29 20 6f 66 20 74 68 65 20 63 65 e (DN) of the ce
1530: 72 74 69 66 69 63 61 74 65 0a 20 20 20 20 20 20 rtificate.
1540: 20 20 20 20 20 20 69 73 73 75 65 72 2e 3c 2f 64 issuer.</d
1550: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c d>. <dt><
1560: 73 74 72 6f 6e 67 3e 73 75 62 6a 65 63 74 3c 2f strong>subject</
1570: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 64 6e 3c 2f strong> <em>dn</
1580: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 em></dt>.
1590: 20 3c 64 64 3e 54 68 65 20 64 69 73 74 69 6e 67 <dd>The disting
15a0: 75 69 73 68 65 64 20 6e 61 6d 65 20 28 44 4e 29 uished name (DN)
15b0: 20 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 of the certific
15c0: 61 74 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 ate.
15d0: 73 75 62 6a 65 63 74 2e 3c 2f 64 64 3e 0a 20 20 subject.</dd>.
15e0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e <dt><stron
15f0: 67 3e 6e 6f 74 42 65 66 6f 72 65 3c 2f 73 74 72 g>notBefore</str
1600: 6f 6e 67 3e 20 3c 65 6d 3e 64 61 74 65 3c 2f 65 ong> <em>date</e
1610: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 m></dt>.
1620: 3c 64 64 3e 54 68 65 20 62 65 67 69 6e 20 64 61 <dd>The begin da
1630: 74 65 20 66 6f 72 20 74 68 65 20 76 61 6c 69 64 te for the valid
1640: 69 74 79 20 6f 66 20 74 68 65 20 63 65 72 74 69 ity of the certi
1650: 66 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 ficate.</dd>.
1660: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 <dt><strong
1670: 3e 6e 6f 74 41 66 74 65 72 3c 2f 73 74 72 6f 6e >notAfter</stron
1680: 67 3e 20 3c 65 6d 3e 64 61 74 65 3c 2f 65 6d 3e g> <em>date</em>
1690: 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 </dt>. <d
16a0: 64 3e 54 68 65 20 65 78 70 69 72 79 20 64 61 74 d>The expiry dat
16b0: 65 20 66 6f 72 20 74 68 65 20 63 65 72 74 69 66 e for the certif
16c0: 69 63 61 74 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 icate.</dd>.
16d0: 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e <dt><strong>
16e0: 73 65 72 69 61 6c 3c 2f 73 74 72 6f 6e 67 3e 20 serial</strong>
16f0: 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a <em>n</em></dt>.
1700: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 <dd>The
1710: 73 65 72 69 61 6c 20 6e 75 6d 62 65 72 20 6f 66 serial number of
1720: 20 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 the certificate
1730: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c .</dd>. <
1740: 64 74 3e 3c 73 74 72 6f 6e 67 3e 63 69 70 68 65 dt><strong>ciphe
1750: 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 r</strong> <em>c
1760: 69 70 68 65 72 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a ipher</em></dt>.
1770: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 <dd>The
1780: 63 75 72 72 65 6e 74 20 63 69 70 68 65 72 20 69 current cipher i
1790: 6e 20 75 73 65 20 62 65 74 77 65 65 6e 20 74 68 n use between th
17a0: 65 20 63 6c 69 65 6e 74 20 61 6e 64 0a 20 20 20 e client and.
17b0: 20 20 20 20 20 20 20 20 20 73 65 72 76 65 72 20 server
17c0: 63 68 61 6e 6e 65 6c 73 2e 3c 2f 64 64 3e 0a 20 channels.</dd>.
17d0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f <dt><stro
17e0: 6e 67 3e 73 62 69 74 73 3c 2f 73 74 72 6f 6e 67 ng>sbits</strong
17f0: 3e 20 3c 65 6d 3e 6e 3c 2f 65 6d 3e 3c 2f 64 74 > <em>n</em></dt
1800: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 >. <dd>Th
1810: 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 69 74 73 e number of bits
1820: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 73 65 used for the se
1830: 73 73 69 6f 6e 20 6b 65 79 2e 3c 2f 64 64 3e 0a ssion key.</dd>.
1840: 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 <dt><str
1850: 6f 6e 67 3e 63 65 72 74 69 66 69 63 61 74 65 3c ong>certificate<
1860: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 6e 3c 2f /strong> <em>n</
1870: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 em></dt>.
1880: 20 3c 64 64 3e 54 68 65 20 50 45 4d 20 65 6e 63 <dd>The PEM enc
1890: 6f 64 65 64 20 63 65 72 74 69 66 69 63 61 74 65 oded certificate
18a0: 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c .</dd>. <
18b0: 64 74 3e 3c 73 74 72 6f 6e 67 3e 73 68 61 31 5f dt><strong>sha1_
18c0: 68 61 73 68 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 hash</strong> <e
18d0: 6d 3e 68 61 73 68 3c 2f 65 6d 3e 3c 2f 64 74 3e m>hash</em></dt>
18e0: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 . <dd>The
18f0: 20 53 48 41 31 20 68 61 73 68 20 6f 66 20 74 68 SHA1 hash of th
1900: 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 3c 2f e certificate.</
1910: 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e dd>. <dt>
1920: 3c 73 74 72 6f 6e 67 3e 73 68 61 32 35 36 5f 68 <strong>sha256_h
1930: 61 73 68 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d ash</strong> <em
1940: 3e 68 61 73 68 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a >hash</em></dt>.
1950: 20 20 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 <dd>The
1960: 53 48 41 32 35 36 20 68 61 73 68 20 6f 66 20 74 SHA256 hash of t
1970: 68 65 20 63 65 72 74 69 66 69 63 61 74 65 2e 3c he certificate.<
1980: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 /dd>. <dt
1990: 3e 3c 73 74 72 6f 6e 67 3e 61 6c 70 6e 3c 2f 73 ><strong>alpn</s
19a0: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 70 72 6f 74 6f trong> <em>proto
19b0: 63 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 col</em></dt>.
19c0: 20 20 20 20 20 20 3c 64 64 3e 54 68 65 20 70 72 <dd>The pr
19d0: 6f 74 6f 63 6f 6c 20 73 65 6c 65 63 74 65 64 20 otocol selected
19e0: 61 66 74 65 72 20 41 70 70 6c 69 63 61 74 69 6f after Applicatio
19f0: 6e 2d 4c 61 79 65 72 20 50 72 6f 74 6f 63 6f 6c n-Layer Protocol
1a00: 0a 09 20 20 20 20 4e 65 67 6f 74 69 61 74 69 6f .. Negotiatio
1a10: 6e 20 28 41 4c 50 4e 29 2e 3c 2f 64 64 3e 0a 20 n (ALPN).</dd>.
1a20: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f <dt><stro
1a30: 6e 67 3e 76 65 72 73 69 6f 6e 3c 2f 73 74 72 6f ng>version</stro
1a40: 6e 67 3e 20 3c 65 6d 3e 76 61 6c 75 65 3c 2f 65 ng> <em>value</e
1a50: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 m></dt>.
1a60: 3c 64 64 3e 54 68 65 20 70 72 6f 74 6f 63 6f 6c <dd>The protocol
1a70: 20 76 65 72 73 69 6f 6e 20 75 73 65 64 20 66 6f version used fo
1a80: 72 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f 6e r the connection
1a90: 3a 0a 09 20 20 53 53 4c 76 32 2c 20 53 53 4c 76 :.. SSLv2, SSLv
1aa0: 33 2c 20 54 4c 53 76 31 2c 20 54 4c 53 76 31 2e 3, TLSv1, TLSv1.
1ab0: 31 2c 20 54 4c 53 76 31 2e 32 2c 20 75 6e 6b 6e 1, TLSv1.2, unkn
1ac0: 6f 77 6e 3c 2f 64 64 3e 0a 20 20 20 20 3c 2f 64 own</dd>. </d
1ad0: 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e l>.</blockquote>
1ae0: 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c ..<dl>. <dt><
1af0: 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 69 6d 70 a name="tls::imp
1b00: 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a 69 6d 70 ort"><b>tls::imp
1b10: 6f 72 74 20 3c 2f 62 3e 3c 69 3e 63 68 61 6e 6e ort </b><i>chann
1b20: 65 6c 0a 20 20 20 20 20 20 20 20 3f 6f 70 74 69 el. ?opti
1b30: 6f 6e 73 3f 3c 2f 69 3e 3c 2f 61 3e 3c 2f 64 74 ons?</i></a></dt
1b40: 3e 0a 20 20 20 20 3c 64 64 3e 53 53 4c 2d 65 6e >. <dd>SSL-en
1b50: 61 62 6c 65 20 61 20 72 65 67 75 6c 61 72 20 54 able a regular T
1b60: 63 6c 20 63 68 61 6e 6e 65 6c 20 2d 20 69 74 20 cl channel - it
1b70: 6e 65 65 64 20 6e 6f 74 20 62 65 20 61 0a 20 20 need not be a.
1b80: 20 20 20 20 20 20 73 6f 63 6b 65 74 2c 20 62 75 socket, bu
1b90: 74 20 6d 75 73 74 20 70 72 6f 76 69 64 65 20 62 t must provide b
1ba0: 69 2d 64 69 72 65 63 74 69 6f 6e 61 6c 20 66 6c i-directional fl
1bb0: 6f 77 2e 20 41 6c 73 6f 0a 20 20 20 20 20 20 20 ow. Also.
1bc0: 20 73 65 74 74 69 6e 67 20 73 65 73 73 69 6f 6e setting session
1bd0: 20 70 61 72 61 6d 65 74 65 72 73 20 66 6f 72 20 parameters for
1be0: 53 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 3c 2f SSL handshake.</
1bf0: 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 62 6c 6f 63 dd>.</dl>..<bloc
1c00: 6b 71 75 6f 74 65 3e 0a 20 20 20 20 3c 64 6c 3e kquote>. <dl>
1c10: 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 . <dt><st
1c20: 72 6f 6e 67 3e 2d 61 6c 70 6e 3c 2f 73 74 72 6f rong>-alpn</stro
1c30: 6e 67 3e 20 3c 65 6d 3e 6c 69 73 74 3c 2f 65 6d ng> <em>list</em
1c40: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c ></dt>. <
1c50: 64 64 3e 4c 69 73 74 20 6f 66 20 70 72 6f 74 6f dd>List of proto
1c60: 63 6f 6c 73 20 74 6f 20 6f 66 66 65 72 20 64 75 cols to offer du
1c70: 72 69 6e 67 20 41 70 70 6c 69 63 61 74 69 6f 6e ring Application
1c80: 2d 4c 61 79 65 72 0a 09 20 20 20 20 50 72 6f 74 -Layer.. Prot
1c90: 6f 63 6f 6c 20 4e 65 67 6f 74 69 61 74 69 6f 6e ocol Negotiation
1ca0: 20 28 41 4c 50 4e 29 2e 20 46 6f 72 20 65 78 61 (ALPN). For exa
1cb0: 6d 70 6c 65 3a 20 68 32 2c 20 68 74 74 70 2f 31 mple: h2, http/1
1cc0: 2e 31 2c 20 65 74 63 2e 3c 2f 64 64 3e 0a 20 20 .1, etc.</dd>.
1cd0: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e <dt><stron
1ce0: 67 3e 2d 63 61 64 69 72 3c 2f 73 74 72 6f 6e 67 g>-cadir</strong
1cf0: 3e 20 3c 65 6d 3e 64 69 72 3c 2f 65 6d 3e 3c 2f > <em>dir</em></
1d00: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e dt>. <dd>
1d10: 50 72 6f 76 69 64 65 20 74 68 65 20 64 69 72 65 Provide the dire
1d20: 63 74 6f 72 79 20 63 6f 6e 74 61 69 6e 69 6e 67 ctory containing
1d30: 20 74 68 65 20 43 41 20 63 65 72 74 69 66 69 63 the CA certific
1d40: 61 74 65 73 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 ates.</dd>.
1d50: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d <dt><strong>-
1d60: 63 61 66 69 6c 65 20 3c 2f 73 74 72 6f 6e 67 3e cafile </strong>
1d70: 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 6d <em>filename</em
1d80: 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 3c ></dt>. <
1d90: 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 43 dd>Provide the C
1da0: 41 20 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20 A file.</dd>.
1db0: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 <dt><strong
1dc0: 3e 2d 63 65 72 74 66 69 6c 65 3c 2f 73 74 72 6f >-certfile</stro
1dd0: 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 ng> <em>filename
1de0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 </em></dt>.
1df0: 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 <dd>Provide t
1e00: 68 65 20 6e 61 6d 65 20 6f 66 20 61 20 66 69 6c he name of a fil
1e10: 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 63 65 72 e containing cer
1e20: 74 69 66 69 63 61 74 65 20 74 6f 20 75 73 65 2e tificate to use.
1e30: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 </dd>. <d
1e40: 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63 65 72 74 3c t><strong>-cert<
1e50: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 66 69 6c /strong> <em>fil
1e60: 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a ename</em></dt>.
1e70: 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 <dd>Prov
1e80: 69 64 65 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 ide the contents
1e90: 20 6f 66 20 61 20 63 65 72 74 69 66 69 63 61 74 of a certificat
1ea0: 65 20 74 6f 20 75 73 65 2c 20 61 73 20 61 20 44 e to use, as a D
1eb0: 45 52 20 65 6e 63 6f 64 65 64 20 62 69 6e 61 72 ER encoded binar
1ec0: 79 20 76 61 6c 75 65 20 28 58 2e 35 30 39 20 44 y value (X.509 D
1ed0: 45 52 29 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 ER).</dd>.
1ee0: 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 63 <dt><strong>-c
1ef0: 69 70 68 65 72 20 3c 2f 73 74 72 6f 6e 67 3e 3c ipher </strong><
1f00: 65 6d 3e 73 74 72 69 6e 67 3c 2f 65 6d 3e 3c 2f em>string</em></
1f10: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e dt>. <dd>
1f20: 50 72 6f 76 69 64 65 20 74 68 65 20 63 69 70 68 Provide the ciph
1f30: 65 72 20 73 75 69 74 65 73 20 74 6f 20 75 73 65 er suites to use
1f40: 2e 20 53 79 6e 74 61 78 20 69 73 20 61 73 20 70 . Syntax is as p
1f50: 65 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 4f er. O
1f60: 70 65 6e 53 53 4c 2e 3c 2f 64 64 3e 0a 20 20 20 penSSL.</dd>.
1f70: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 <dt><strong
1f80: 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74 72 6f 6e >-command</stron
1f90: 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b 3c g> <em>callback<
1fa0: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 /em></dt>.
1fb0: 20 20 3c 64 64 3e 49 66 20 73 70 65 63 69 66 69 <dd>If specifi
1fc0: 65 64 2c 20 74 68 69 73 20 63 61 6c 6c 62 61 63 ed, this callbac
1fd0: 6b 20 77 69 6c 6c 20 62 65 20 69 6e 76 6f 6b 65 k will be invoke
1fe0: 64 20 61 74 20 73 65 76 65 72 61 6c 20 70 6f 69 d at several poi
1ff0: 6e 74 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 nts.
2000: 64 75 72 69 6e 67 20 74 68 65 20 4f 70 65 6e 53 during the OpenS
2010: 53 4c 20 68 61 6e 64 73 68 61 6b 65 2e 20 20 49 SL handshake. I
2020: 74 20 63 61 6e 20 70 61 73 73 20 65 72 72 6f 72 t can pass error
2030: 73 20 61 6e 64 20 74 72 61 63 69 6e 67 0a 20 20 s and tracing.
2040: 20 20 20 20 20 20 20 20 20 20 69 6e 66 6f 72 6d inform
2050: 61 74 69 6f 6e 2c 20 61 6e 64 20 69 74 20 63 61 ation, and it ca
2060: 6e 20 61 6c 6c 6f 77 20 54 63 6c 20 73 63 72 69 n allow Tcl scri
2070: 70 74 73 20 74 6f 20 70 65 72 66 6f 72 6d 0a 20 pts to perform.
2080: 20 20 20 20 20 20 20 20 20 20 20 74 68 65 69 72 their
2090: 20 6f 77 6e 20 76 61 6c 69 64 61 74 69 6f 6e 20 own validation
20a0: 6f 66 20 74 68 65 20 63 65 72 74 69 66 69 63 61 of the certifica
20b0: 74 65 20 69 6e 20 70 6c 61 63 65 20 6f 66 20 74 te in place of t
20c0: 68 65 0a 20 20 20 20 20 20 20 20 20 20 20 20 64 he. d
20d0: 65 66 61 75 6c 74 20 76 61 6c 69 64 61 74 69 6f efault validatio
20e0: 6e 20 70 72 6f 76 69 64 65 64 20 62 79 20 4f 70 n provided by Op
20f0: 65 6e 53 53 4c 2e 0a 20 20 20 20 20 20 20 20 20 enSSL..
2100: 20 20 20 3c 62 72 3e 0a 20 20 20 20 20 20 20 20 <br>.
2110: 20 20 20 20 53 65 65 20 3c 61 20 68 72 65 66 3d See <a href=
2120: 22 23 43 41 4c 4c 42 41 43 4b 20 4f 50 54 49 4f "#CALLBACK OPTIO
2130: 4e 53 22 3e 43 41 4c 4c 42 41 43 4b 20 4f 50 54 NS">CALLBACK OPT
2140: 49 4f 4e 53 3c 2f 61 3e 20 66 6f 72 0a 20 20 20 IONS</a> for.
2150: 20 20 20 20 20 20 20 20 20 66 75 72 74 68 65 72 further
2160: 20 64 69 73 63 75 73 73 69 6f 6e 2e 3c 2f 64 64 discussion.</dd
2170: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 >. <dt><s
2180: 74 72 6f 6e 67 3e 2d 64 68 70 61 72 61 6d 73 20 trong>-dhparams
2190: 3c 2f 73 74 72 6f 6e 67 3e 3c 65 6d 3e 66 69 6c </strong><em>fil
21a0: 65 6e 61 6d 65 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a ename</em></dt>.
21b0: 20 20 20 20 20 20 20 20 3c 64 64 3e 50 72 6f 76 <dd>Prov
21c0: 69 64 65 20 61 20 44 69 66 66 69 65 2d 48 65 6c ide a Diffie-Hel
21d0: 6c 6d 61 6e 20 70 61 72 61 6d 65 74 65 72 73 20 lman parameters
21e0: 66 69 6c 65 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 file.</dd>.
21f0: 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d <dt><strong>-
2200: 6b 65 79 66 69 6c 65 3c 2f 73 74 72 6f 6e 67 3e keyfile</strong>
2210: 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 3c 2f 65 <em>filename</e
2220: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 m></dt>.
2230: 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 68 65 20 <dd>Provide the
2240: 70 72 69 76 61 74 65 20 6b 65 79 20 66 69 6c 65 private key file
2250: 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 . (<strong>defau
2260: 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 0a 20 20 20 lt</strong>:.
2270: 20 20 20 20 20 20 20 20 20 76 61 6c 75 65 20 6f value o
2280: 66 20 2d 63 65 72 74 66 69 6c 65 29 3c 2f 64 64 f -certfile)</dd
2290: 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 >. <dt><s
22a0: 74 72 6f 6e 67 3e 2d 6b 65 79 3c 2f 73 74 72 6f trong>-key</stro
22b0: 6e 67 3e 20 3c 65 6d 3e 66 69 6c 65 6e 61 6d 65 ng> <em>filename
22c0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 </em></dt>.
22d0: 20 20 20 3c 64 64 3e 50 72 6f 76 69 64 65 20 74 <dd>Provide t
22e0: 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 20 74 he private key t
22f0: 6f 20 75 73 65 20 61 73 20 61 20 44 45 52 20 65 o use as a DER e
2300: 6e 63 6f 64 65 64 20 76 61 6c 75 65 20 28 50 4b ncoded value (PK
2310: 43 53 23 31 20 44 45 52 29 3c 2f 64 64 3e 0a 20 CS#1 DER)</dd>.
2320: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f <dt><stro
2330: 6e 67 3e 2d 6d 6f 64 65 6c 3c 2f 73 74 72 6f 6e ng>-model</stron
2340: 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 3c 2f g> <em>channel</
2350: 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 em></dt>.
2360: 20 3c 64 64 3e 54 68 69 73 20 77 69 6c 6c 20 66 <dd>This will f
2370: 6f 72 63 65 20 74 68 69 73 20 63 68 61 6e 6e 65 orce this channe
2380: 6c 20 74 6f 20 73 68 61 72 65 20 74 68 65 20 73 l to share the s
2390: 61 6d 65 20 3c 65 6d 3e 3c 73 74 72 6f 6e 67 3e ame <em><strong>
23a0: 53 53 4c 5f 43 54 58 3c 2f 73 74 72 6f 6e 67 3e SSL_CTX</strong>
23b0: 3c 2f 65 6d 3e 0a 20 20 20 20 20 20 20 20 20 20 </em>.
23c0: 20 20 73 74 72 75 63 74 75 72 65 20 61 73 20 74 structure as t
23d0: 68 65 20 73 70 65 63 69 66 69 65 64 20 3c 65 6d he specified <em
23e0: 3e 63 68 61 6e 6e 65 6c 3c 2f 65 6d 3e 2c 20 61 >channel</em>, a
23f0: 6e 64 0a 20 20 20 20 20 20 20 20 20 20 20 20 74 nd. t
2400: 68 65 72 65 66 6f 72 65 20 73 68 61 72 65 20 63 herefore share c
2410: 61 6c 6c 62 61 63 6b 73 20 65 74 63 2e 3c 2f 64 allbacks etc.</d
2420: 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 3e 3c d>. <dt><
2430: 73 74 72 6f 6e 67 3e 2d 70 61 73 73 77 6f 72 64 strong>-password
2440: 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 61 </strong> <em>ca
2450: 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e llback</em></dt>
2460: 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 49 66 20 . <dd>If
2470: 73 75 70 70 6c 69 65 64 2c 20 74 68 69 73 20 63 supplied, this c
2480: 61 6c 6c 62 61 63 6b 20 77 69 6c 6c 20 62 65 20 allback will be
2490: 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 4f 70 65 invoked when Ope
24a0: 6e 53 53 4c 20 6e 65 65 64 73 0a 20 20 20 20 20 nSSL needs.
24b0: 20 20 20 20 20 20 20 74 6f 20 6f 62 74 61 69 6e to obtain
24c0: 20 61 20 70 61 73 73 77 6f 72 64 2c 20 74 79 70 a password, typ
24d0: 69 63 61 6c 6c 79 20 74 6f 20 75 6e 6c 6f 63 6b ically to unlock
24e0: 20 74 68 65 20 70 72 69 76 61 74 65 20 6b 65 79 the private key
24f0: 20 6f 66 0a 09 20 20 20 20 61 20 63 65 72 74 69 of.. a certi
2500: 66 69 63 61 74 65 2e 0a 20 20 20 20 20 20 20 20 ficate..
2510: 20 20 20 20 54 68 65 20 63 61 6c 6c 62 61 63 6b The callback
2520: 20 73 68 6f 75 6c 64 20 72 65 74 75 72 6e 20 61 should return a
2530: 20 73 74 72 69 6e 67 20 77 68 69 63 68 20 72 65 string which re
2540: 70 72 65 73 65 6e 74 73 20 74 68 65 0a 20 20 20 presents the.
2550: 20 20 20 20 20 20 20 20 20 70 61 73 73 77 6f 72 passwor
2560: 64 20 74 6f 20 62 65 20 75 73 65 64 2e 0a 20 20 d to be used..
2570: 20 20 20 20 20 20 20 20 20 20 3c 62 72 3e 0a 20 <br>.
2580: 20 20 20 20 20 20 20 20 20 20 20 53 65 65 20 3c See <
2590: 61 20 68 72 65 66 3d 22 23 43 41 4c 4c 42 41 43 a href="#CALLBAC
25a0: 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 K OPTIONS">CALLB
25b0: 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61 3e 20 ACK OPTIONS</a>
25c0: 66 6f 72 0a 20 20 20 20 20 20 20 20 20 20 20 20 for.
25d0: 66 75 72 74 68 65 72 20 64 69 73 63 75 73 73 69 further discussi
25e0: 6f 6e 2e 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 on.</dd>.
25f0: 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 72 65 <dt><strong>-re
2600: 71 75 65 73 74 20 3c 2f 73 74 72 6f 6e 67 3e 3c quest </strong><
2610: 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 em>bool</em></dt
2620: 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 52 65 >. <dd>Re
2630: 71 75 65 73 74 20 61 20 63 65 72 74 69 66 69 63 quest a certific
2640: 61 74 65 20 66 72 6f 6d 20 70 65 65 72 20 64 75 ate from peer du
2650: 72 69 6e 67 20 53 53 4c 20 68 61 6e 64 73 68 61 ring SSL handsha
2660: 6b 65 2e 0a 20 20 20 20 20 20 20 20 20 20 20 20 ke..
2670: 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 (<strong>default
2680: 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 </strong>: <em>t
2690: 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 rue</em>)</dd>.
26a0: 20 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f <dt><stro
26b0: 6e 67 3e 2d 72 65 71 75 69 72 65 3c 2f 73 74 72 ng>-require</str
26c0: 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 ong> <em>bool</e
26d0: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 m></dt>.
26e0: 3c 64 64 3e 52 65 71 75 69 72 65 20 61 20 76 61 <dd>Require a va
26f0: 6c 69 64 20 63 65 72 74 69 66 69 63 61 74 65 20 lid certificate
2700: 66 72 6f 6d 20 70 65 65 72 20 64 75 72 69 6e 67 from peer during
2710: 20 53 53 4c 0a 20 20 20 20 20 20 20 20 20 20 20 SSL.
2720: 20 68 61 6e 64 73 68 61 6b 65 2e 20 49 66 20 74 handshake. If t
2730: 68 69 73 20 69 73 20 73 65 74 20 74 6f 20 74 72 his is set to tr
2740: 75 65 20 74 68 65 6e 20 3c 73 74 72 6f 6e 67 3e ue then <strong>
2750: 2d 72 65 71 75 65 73 74 3c 2f 73 74 72 6f 6e 67 -request</strong
2760: 3e 0a 20 20 20 20 20 20 20 20 20 20 20 20 6d 75 >. mu
2770: 73 74 20 61 6c 73 6f 20 62 65 20 73 65 74 20 74 st also be set t
2780: 6f 20 74 72 75 65 2e 20 28 3c 73 74 72 6f 6e 67 o true. (<strong
2790: 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 >default</strong
27a0: 3e 3a 20 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d >: <em>false</em
27b0: 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 >)</dd>.
27c0: 3c 64 74 3e 3c 73 74 72 6f 6e 67 3e 2d 73 65 72 <dt><strong>-ser
27d0: 76 65 72 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d ver</strong> <em
27e0: 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a >bool</em></dt>.
27f0: 20 20 20 20 20 20 20 20 3c 64 64 3e 48 61 6e 64 <dd>Hand
2800: 73 68 61 6b 65 20 61 73 20 73 65 72 76 65 72 20 shake as server
2810: 69 66 20 74 72 75 65 2c 20 65 6c 73 65 20 68 61 if true, else ha
2820: 6e 64 73 68 61 6b 65 20 61 73 0a 20 20 20 20 20 ndshake as.
2830: 20 20 20 20 20 20 20 63 6c 69 65 6e 74 2e 28 3c client.(<
2840: 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f strong>default</
2850: 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c strong>: <em>fal
2860: 73 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 se</em>)</dd>.
2870: 20 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e <dt><stron
2880: 67 3e 2d 73 65 72 76 65 72 6e 61 6d 65 3c 2f 73 g>-servername</s
2890: 74 72 6f 6e 67 3e 20 3c 65 6d 3e 68 6f 73 74 3c trong> <em>host<
28a0: 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 /em></dt>.
28b0: 20 20 3c 64 64 3e 4f 6e 6c 79 20 61 76 61 69 6c <dd>Only avail
28c0: 61 62 6c 65 20 69 66 20 74 68 65 20 4f 70 65 6e able if the Open
28d0: 53 53 4c 20 6c 69 62 72 61 72 79 20 74 68 65 20 SSL library the
28e0: 70 61 63 6b 61 67 65 20 69 73 20 6c 69 6e 6b 65 package is linke
28f0: 64 0a 09 20 20 20 20 61 67 61 69 6e 73 74 20 73 d.. against s
2900: 75 70 70 6f 72 74 73 20 74 68 65 20 54 4c 53 20 upports the TLS
2910: 68 6f 73 74 6e 61 6d 65 20 65 78 74 65 6e 73 69 hostname extensi
2920: 6f 6e 20 66 6f 72 20 27 53 65 72 76 65 72 20 4e on for 'Server N
2930: 61 6d 65 0a 09 20 20 20 20 49 6e 64 69 63 61 74 ame.. Indicat
2940: 69 6f 6e 27 20 28 53 4e 49 29 2e 20 55 73 65 20 ion' (SNI). Use
2950: 74 6f 20 6e 61 6d 65 20 74 68 65 20 6c 6f 67 69 to name the logi
2960: 63 61 6c 20 68 6f 73 74 20 77 65 20 61 72 65 20 cal host we are
2970: 74 61 6c 6b 69 6e 67 0a 09 20 20 20 20 74 6f 20 talking.. to
2980: 61 6e 64 20 65 78 70 65 63 74 69 6e 67 20 61 20 and expecting a
2990: 63 65 72 74 69 66 69 63 61 74 65 20 66 6f 72 3c certificate for<
29a0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 /dd>. <dt
29b0: 3e 3c 73 74 72 6f 6e 67 3e 2d 73 73 6c 32 3c 2f ><strong>-ssl2</
29c0: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c strong> <em>bool
29d0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 </em></dt>.
29e0: 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 <dd>Enable us
29f0: 65 20 6f 66 20 53 53 4c 20 76 32 2e 20 28 3c 73 e of SSL v2. (<s
2a00: 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 trong>default</s
2a10: 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 66 61 6c 73 trong>: <em>fals
2a20: 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 e</em>)</dd>.
2a30: 20 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f 6e 67 <dt><strong
2a40: 3e 2d 73 73 6c 33 20 3c 2f 73 74 72 6f 6e 67 3e >-ssl3 </strong>
2a50: 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 <em>bool</em></d
2a60: 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e 45 t>. <dd>E
2a70: 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 53 53 4c nable use of SSL
2a80: 20 76 33 2e 20 28 3c 73 74 72 6f 6e 67 3e 64 65 v3. (<strong>de
2a90: 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 fault</strong>:
2aa0: 3c 65 6d 3e 66 61 6c 73 65 3c 2f 65 6d 3e 29 3c <em>false</em>)<
2ab0: 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 74 /dd>. <dt
2ac0: 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31 3c 2f >-<strong>tls1</
2ad0: 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c strong> <em>bool
2ae0: 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 </em></dt>.
2af0: 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 <dd>Enable us
2b00: 65 20 6f 66 20 54 4c 53 20 76 31 2e 20 28 3c 73 e of TLS v1. (<s
2b10: 74 72 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 trong>default</s
2b20: 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72 75 65 trong>: <em>true
2b30: 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 </em>)</dd>.
2b40: 20 20 20 20 3c 64 74 3e 2d 3c 73 74 72 6f 6e 67 <dt>-<strong
2b50: 3e 74 6c 73 31 2e 31 3c 2f 73 74 72 6f 6e 67 3e >tls1.1</strong>
2b60: 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 6d 3e 3c 2f <em>bool</em></
2b70: 64 74 3e 0a 20 20 20 20 20 20 20 20 3c 64 64 3e dt>. <dd>
2b80: 45 6e 61 62 6c 65 20 75 73 65 20 6f 66 20 54 4c Enable use of TL
2b90: 53 20 76 31 2e 31 20 28 3c 73 74 72 6f 6e 67 3e S v1.1 (<strong>
2ba0: 64 65 66 61 75 6c 74 3c 2f 73 74 72 6f 6e 67 3e default</strong>
2bb0: 3a 20 3c 65 6d 3e 74 72 75 65 3c 2f 65 6d 3e 29 : <em>true</em>)
2bc0: 3c 2f 64 64 3e 0a 20 20 20 20 20 20 20 20 3c 64 </dd>. <d
2bd0: 74 3e 2d 3c 73 74 72 6f 6e 67 3e 74 6c 73 31 2e t>-<strong>tls1.
2be0: 32 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 62 2</strong> <em>b
2bf0: 6f 6f 6c 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 ool</em></dt>.
2c00: 20 20 20 20 20 20 3c 64 64 3e 45 6e 61 62 6c 65 <dd>Enable
2c10: 20 75 73 65 20 6f 66 20 54 4c 53 20 76 31 2e 32 use of TLS v1.2
2c20: 20 28 3c 73 74 72 6f 6e 67 3e 64 65 66 61 75 6c (<strong>defaul
2c30: 74 3c 2f 73 74 72 6f 6e 67 3e 3a 20 3c 65 6d 3e t</strong>: <em>
2c40: 74 72 75 65 3c 2f 65 6d 3e 29 3c 2f 64 64 3e 0a true</em>)</dd>.
2c50: 20 20 20 20 20 20 20 20 3c 64 74 3e 2d 3c 73 74 <dt>-<st
2c60: 72 6f 6e 67 3e 74 6c 73 31 2e 33 3c 2f 73 74 72 rong>tls1.3</str
2c70: 6f 6e 67 3e 20 3c 65 6d 3e 62 6f 6f 6c 3c 2f 65 ong> <em>bool</e
2c80: 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 20 20 20 20 m></dt>.
2c90: 3c 64 64 3e 45 6e 61 62 6c 65 20 75 73 65 20 6f <dd>Enable use o
2ca0: 66 20 54 4c 53 20 76 31 2e 33 20 28 3c 73 74 72 f TLS v1.3 (<str
2cb0: 6f 6e 67 3e 64 65 66 61 75 6c 74 3c 2f 73 74 72 ong>default</str
2cc0: 6f 6e 67 3e 3a 20 3c 65 6d 3e 74 72 75 65 3c 2f ong>: <em>true</
2cd0: 65 6d 3e 29 3c 2f 64 64 3e 0a 20 20 20 20 3c 2f em>)</dd>. </
2ce0: 64 6c 3e 0a 3c 2f 62 6c 6f 63 6b 71 75 6f 74 65 dl>.</blockquote
2cf0: 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 74 3e >..<dl>. <dt>
2d00: 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a 75 6e <a name="tls::un
2d10: 69 6d 70 6f 72 74 22 3e 3c 62 3e 74 6c 73 3a 3a import"><b>tls::
2d20: 75 6e 69 6d 70 6f 72 74 20 3c 2f 62 3e 3c 69 3e unimport </b><i>
2d30: 63 68 61 6e 6e 65 6c 3c 2f 69 3e 3c 2f 61 3e 3c channel</i></a><
2d40: 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 50 72 6f /dt>. <dd>Pro
2d50: 76 69 64 65 64 20 66 6f 72 20 73 79 6d 6d 65 74 vided for symmet
2d60: 72 79 20 74 6f 20 3c 73 74 72 6f 6e 67 3e 74 6c ry to <strong>tl
2d70: 73 3a 3a 69 6d 70 6f 72 74 3c 2f 73 74 72 6f 6e s::import</stron
2d80: 67 3e 2c 20 74 68 69 73 0a 20 20 20 20 20 20 75 g>, this. u
2d90: 6e 73 74 61 63 6b 73 20 74 68 65 20 53 53 4c 2d nstacks the SSL-
2da0: 65 6e 61 62 6c 69 6e 67 20 6f 66 20 61 20 72 65 enabling of a re
2db0: 67 75 6c 61 72 20 54 63 6c 20 63 68 61 6e 6e 65 gular Tcl channe
2dc0: 6c 2e 20 20 41 6e 20 65 72 72 6f 72 0a 20 20 20 l. An error.
2dd0: 20 20 20 69 73 20 74 68 72 6f 77 6e 20 69 66 20 is thrown if
2de0: 54 4c 53 20 69 73 20 6e 6f 74 20 74 68 65 20 74 TLS is not the t
2df0: 6f 70 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e op stacked chann
2e00: 65 6c 20 74 79 70 65 2e 3c 2f 64 64 3e 0a 3c 2f el type.</dd>.</
2e10: 64 6c 3e 0a 0a 3c 64 6c 3e 0a 20 20 20 20 3c 64 dl>..<dl>. <d
2e20: 74 3e 3c 61 20 6e 61 6d 65 3d 22 74 6c 73 3a 3a t><a name="tls::
2e30: 63 69 70 68 65 72 73 20 70 72 6f 74 6f 63 6f 6c ciphers protocol
2e40: 20 3f 76 65 72 62 6f 73 65 3f 22 3e 3c 73 74 72 ?verbose?"><str
2e50: 6f 6e 67 3e 74 6c 73 3a 3a 63 69 70 68 65 72 73 ong>tls::ciphers
2e60: 3c 2f 73 74 72 6f 6e 67 3e 0a 20 20 20 20 20 20 </strong>.
2e70: 20 20 3c 65 6d 3e 70 72 6f 74 6f 63 6f 6c 20 3f <em>protocol ?
2e80: 76 65 72 62 6f 73 65 3f 3c 2f 65 6d 3e 3c 2f 61 verbose?</em></a
2e90: 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 3e 52 ></dt>. <dd>R
2ea0: 65 74 75 72 6e 73 20 6c 69 73 74 20 6f 66 20 73 eturns list of s
2eb0: 75 70 70 6f 72 74 65 64 20 63 69 70 68 65 72 73 upported ciphers
2ec0: 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 3c 65 based on the <e
2ed0: 6d 3e 70 72 6f 74 6f 63 6f 6c 3c 2f 65 6d 3e 0a m>protocol</em>.
2ee0: 20 20 20 20 20 20 20 20 79 6f 75 20 73 75 70 70 you supp
2ef0: 6c 79 2c 20 77 68 69 63 68 20 6d 75 73 74 20 62 ly, which must b
2f00: 65 20 6f 6e 65 20 6f 66 20 3c 65 6d 3e 73 73 6c e one of <em>ssl
2f10: 32 2c 20 73 73 6c 33 2c 20 6f 72 20 74 6c 73 31 2, ssl3, or tls1
2f20: 3c 2f 65 6d 3e 2e 0a 20 20 20 20 20 20 20 20 49 </em>.. I
2f30: 66 20 3c 65 6d 3e 76 65 72 62 6f 73 65 3c 2f 65 f <em>verbose</e
2f40: 6d 3e 20 69 73 20 73 70 65 63 69 66 69 65 64 20 m> is specified
2f50: 61 73 20 74 72 75 65 20 74 68 65 6e 20 61 20 76 as true then a v
2f60: 65 72 62 6f 73 65 2c 0a 20 20 20 20 20 20 20 20 erbose,.
2f70: 73 65 6d 69 2d 68 75 6d 61 6e 20 72 65 61 64 61 semi-human reada
2f80: 62 6c 65 20 6c 69 73 74 20 69 73 20 72 65 74 75 ble list is retu
2f90: 72 6e 65 64 20 70 72 6f 76 69 64 69 6e 67 20 61 rned providing a
2fa0: 64 64 69 74 69 6f 6e 61 6c 0a 20 20 20 20 20 20 dditional.
2fb0: 20 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e information on
2fc0: 20 74 68 65 20 6e 61 74 75 72 65 20 6f 66 20 74 the nature of t
2fd0: 68 65 20 63 69 70 68 65 72 20 73 75 70 70 6f 72 he cipher suppor
2fe0: 74 2e 20 49 6e 20 65 61 63 68 0a 20 20 20 20 20 t. In each.
2ff0: 20 20 20 63 61 73 65 20 74 68 65 20 72 65 73 75 case the resu
3000: 6c 74 20 69 73 20 61 20 54 63 6c 20 6c 69 73 74 lt is a Tcl list
3010: 2e 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 64 .</dd>.</dl>..<d
3020: 6c 3e 0a 20 20 20 20 3c 64 74 3e 3c 61 20 6e 61 l>. <dt><a na
3030: 6d 65 3d 22 74 6c 73 3a 3a 76 65 72 73 69 6f 6e me="tls::version
3040: 22 3e 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a 76 "><strong>tls::v
3050: 65 72 73 69 6f 6e 3c 2f 73 74 72 6f 6e 67 3e 3c ersion</strong><
3060: 2f 61 3e 3c 2f 64 74 3e 0a 20 20 20 20 3c 64 64 /a></dt>. <dd
3070: 3e 52 65 74 75 72 6e 73 20 74 68 65 20 76 65 72 >Returns the ver
3080: 73 69 6f 6e 20 73 74 72 69 6e 67 20 64 65 66 69 sion string defi
3090: 6e 65 64 20 62 79 20 4f 70 65 6e 53 53 4c 2e 3c ned by OpenSSL.<
30a0: 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 0a 3c 68 33 3e /dd>.</dl>..<h3>
30b0: 3c 61 20 6e 61 6d 65 3d 22 43 41 4c 4c 42 41 43 <a name="CALLBAC
30c0: 4b 20 4f 50 54 49 4f 4e 53 22 3e 43 41 4c 4c 42 K OPTIONS">CALLB
30d0: 41 43 4b 20 4f 50 54 49 4f 4e 53 3c 2f 61 3e 3c ACK OPTIONS</a><
30e0: 2f 68 33 3e 0a 0a 3c 70 3e 0a 41 73 20 69 6e 64 /h3>..<p>.As ind
30f0: 69 63 61 74 65 64 20 61 62 6f 76 65 2c 20 69 6e icated above, in
3100: 64 69 76 69 64 75 61 6c 20 63 68 61 6e 6e 65 6c dividual channel
3110: 73 20 63 61 6e 20 62 65 20 67 69 76 65 6e 20 74 s can be given t
3120: 68 65 69 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 heir own callbac
3130: 6b 73 0a 74 6f 20 68 61 6e 64 6c 65 20 69 6e 74 ks.to handle int
3140: 65 72 6d 65 64 69 61 74 65 20 70 72 6f 63 65 73 ermediate proces
3150: 73 69 6e 67 20 62 79 20 74 68 65 20 4f 70 65 6e sing by the Open
3160: 53 53 4c 20 6c 69 62 72 61 72 79 2c 20 75 73 69 SSL library, usi
3170: 6e 67 20 74 68 65 0a 3c 65 6d 3e 2d 63 6f 6d 6d ng the.<em>-comm
3180: 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20 3c 65 6d and</em> and <em
3190: 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d 3e 20 >-password</em>
31a0: 6f 70 74 69 6f 6e 73 20 70 61 73 73 65 64 20 74 options passed t
31b0: 6f 20 65 69 74 68 65 72 20 6f 66 0a 3c 73 74 72 o either of.<str
31c0: 6f 6e 67 3e 74 6c 73 3a 3a 73 6f 63 6b 65 74 3c ong>tls::socket<
31d0: 2f 73 74 72 6f 6e 67 3e 20 6f 72 20 3c 73 74 72 /strong> or <str
31e0: 6f 6e 67 3e 74 6c 73 3a 3a 69 6d 70 6f 72 74 3c ong>tls::import<
31f0: 2f 73 74 72 6f 6e 67 3e 2e 0a 3c 2f 70 3e 0a 0a /strong>..</p>..
3200: 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 3c 64 6c <blockquote>.<dl
3210: 3e 0a 0a 20 20 20 20 3c 64 74 3e 3c 73 74 72 6f >.. <dt><stro
3220: 6e 67 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f 73 74 72 ng>-command</str
3230: 6f 6e 67 3e 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 ong> <em>callbac
3240: 6b 3c 2f 65 6d 3e 3c 2f 64 74 3e 0a 20 20 20 20 k</em></dt>.
3250: 3c 64 64 3e 0a 09 49 6e 76 6f 6b 65 73 20 74 68 <dd>..Invokes th
3260: 65 20 73 70 65 63 69 66 69 65 64 20 3c 65 6d 3e e specified <em>
3270: 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 20 73 63 callback</em> sc
3280: 72 69 70 74 20 61 74 0a 09 73 65 76 65 72 61 6c ript at..several
3290: 20 70 6f 69 6e 74 73 20 64 75 72 69 6e 67 20 74 points during t
32a0: 68 65 20 4f 70 65 6e 53 53 4c 20 68 61 6e 64 73 he OpenSSL hands
32b0: 68 61 6b 65 2e 0a 09 45 78 63 65 70 74 20 61 73 hake...Except as
32c0: 20 69 6e 64 69 63 61 74 65 64 20 62 65 6c 6f 77 indicated below
32d0: 2c 20 76 61 6c 75 65 73 20 72 65 74 75 72 6e 65 , values returne
32e0: 64 20 66 72 6f 6d 20 74 68 65 0a 09 63 61 6c 6c d from the..call
32f0: 62 61 63 6b 20 61 72 65 20 69 67 6e 6f 72 65 64 back are ignored
3300: 2e 0a 09 41 72 67 75 6d 65 6e 74 73 20 61 70 70 ...Arguments app
3310: 65 6e 64 65 64 20 74 6f 20 74 68 65 20 73 63 72 ended to the scr
3320: 69 70 74 20 75 70 6f 6e 20 63 61 6c 6c 62 61 63 ipt upon callbac
3330: 6b 20 74 61 6b 65 20 6f 6e 65 20 6f 66 20 74 68 k take one of th
3340: 65 0a 09 66 6f 6c 6c 6f 77 69 6e 67 20 66 6f 72 e..following for
3350: 6d 73 3a 0a 0a 09 3c 62 72 3e 0a 09 3c 62 72 3e ms:...<br>..<br>
3360: 0a 0a 09 3c 64 6c 3e 0a 0a 3c 21 2d 2d 09 54 68 ...<dl>..<!--.Th
3370: 69 73 20 66 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 is form of callb
3380: 61 63 6b 20 69 73 20 64 69 73 61 62 6c 65 64 2e ack is disabled.
3390: 0a 0a 09 3c 64 74 3e 0a 09 20 20 3c 73 74 72 6f ...<dt>.. <stro
33a0: 6e 67 3e 65 72 72 6f 72 3c 2f 73 74 72 6f 6e 67 ng>error</strong
33b0: 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c 20 6d 65 > <em>channel me
33c0: 73 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f 64 74 ssage</em>..</dt
33d0: 3e 0a 09 3c 64 64 3e 0a 09 20 20 54 68 65 20 3c >..<dd>.. The <
33e0: 65 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 20 em>message</em>
33f0: 61 72 67 75 6d 65 6e 74 20 63 6f 6e 74 61 69 6e argument contain
3400: 73 20 61 6e 20 65 72 72 6f 72 20 6d 65 73 73 61 s an error messa
3410: 67 65 20 67 65 6e 65 72 61 74 65 64 0a 09 20 20 ge generated..
3420: 62 79 20 74 68 65 20 4f 70 65 6e 53 53 4c 20 66 by the OpenSSL f
3430: 75 6e 63 74 69 6f 6e 0a 09 20 20 3c 63 6f 64 65 unction.. <code
3440: 3e 45 52 52 5f 72 65 61 73 6f 6e 5f 65 72 72 6f >ERR_reason_erro
3450: 72 5f 73 74 72 69 6e 67 28 29 3c 2f 63 6f 64 65 r_string()</code
3460: 3e 2e 0a 09 3c 2f 64 64 3e 0a 0a 09 3c 62 72 3e >...</dd>...<br>
3470: 0a 2d 2d 3e 0a 0a 09 3c 64 74 3e 0a 09 20 20 3c .-->...<dt>.. <
3480: 73 74 72 6f 6e 67 3e 69 6e 66 6f 3c 2f 73 74 72 strong>info</str
3490: 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 6e 6e 65 6c ong> <em>channel
34a0: 20 6d 61 6a 6f 72 20 6d 69 6e 6f 72 20 6d 65 73 major minor mes
34b0: 73 61 67 65 3c 2f 65 6d 3e 0a 09 3c 2f 64 74 3e sage</em>..</dt>
34c0: 0a 09 3c 64 64 3e 0a 09 20 20 54 68 69 73 20 66 ..<dd>.. This f
34d0: 6f 72 6d 20 6f 66 20 63 61 6c 6c 62 61 63 6b 20 orm of callback
34e0: 69 73 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 is invoked by th
34f0: 65 20 4f 70 65 6e 53 53 4c 20 66 75 6e 63 74 69 e OpenSSL functi
3500: 6f 6e 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c 5f on.. <code>SSL_
3510: 43 54 58 5f 73 65 74 5f 69 6e 66 6f 5f 63 61 6c CTX_set_info_cal
3520: 6c 62 61 63 6b 28 29 3c 2f 63 6f 64 65 3e 2e 0a lback()</code>..
3530: 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c . <br>.. The <
3540: 65 6d 3e 6d 61 6a 6f 72 3c 2f 65 6d 3e 20 61 6e em>major</em> an
3550: 64 20 3c 65 6d 3e 6d 69 6e 6f 72 3c 2f 65 6d 3e d <em>minor</em>
3560: 20 61 72 67 75 6d 65 6e 74 73 20 61 72 65 20 75 arguments are u
3570: 73 65 64 20 74 6f 0a 09 20 20 72 65 70 72 65 73 sed to.. repres
3580: 65 6e 74 20 74 68 65 20 73 74 61 74 65 20 69 6e ent the state in
3590: 66 6f 72 6d 61 74 69 6f 6e 20 62 69 74 6d 61 73 formation bitmas
35a0: 6b 2e 0a 09 20 20 3c 64 6c 3e 0a 09 20 20 3c 64 k... <dl>.. <d
35b0: 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 t>Possible value
35c0: 73 20 66 6f 72 20 3c 65 6d 3e 6d 61 6a 6f 72 3c s for <em>major<
35d0: 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e 0a 09 /em> are:</dt>..
35e0: 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 68 61 6e 64 <dd><code>hand
35f0: 73 68 61 6b 65 2c 20 61 6c 65 72 74 2c 20 63 6f shake, alert, co
3600: 6e 6e 65 63 74 2c 20 61 63 63 65 70 74 3c 2f 63 nnect, accept</c
3610: 6f 64 65 3e 2e 3c 2f 64 64 3e 0a 09 20 20 3c 64 ode>.</dd>.. <d
3620: 74 3e 50 6f 73 73 69 62 6c 65 20 76 61 6c 75 65 t>Possible value
3630: 73 20 66 6f 72 20 3c 65 6d 3e 6d 69 6e 6f 72 3c s for <em>minor<
3640: 2f 65 6d 3e 20 61 72 65 3a 3c 2f 64 74 3e 0a 09 /em> are:</dt>..
3650: 20 20 3c 64 64 3e 3c 63 6f 64 65 3e 73 74 61 72 <dd><code>star
3660: 74 2c 20 64 6f 6e 65 2c 20 72 65 61 64 2c 20 77 t, done, read, w
3670: 72 69 74 65 2c 20 6c 6f 6f 70 2c 20 65 78 69 74 rite, loop, exit
3680: 3c 2f 63 6f 64 65 3e 2e 3c 2f 64 64 3e 0a 09 20 </code>.</dd>..
3690: 20 3c 2f 64 6c 3e 0a 09 20 20 54 68 65 20 3c 65 </dl>.. The <e
36a0: 6d 3e 6d 65 73 73 61 67 65 3c 2f 65 6d 3e 20 61 m>message</em> a
36b0: 72 67 75 6d 65 6e 74 20 69 73 20 61 20 64 65 73 rgument is a des
36c0: 63 72 69 70 74 69 76 65 20 73 74 72 69 6e 67 20 criptive string
36d0: 77 68 69 63 68 20 6d 61 79 0a 09 20 20 62 65 20 which may.. be
36e0: 67 65 6e 65 72 61 74 65 64 20 65 69 74 68 65 72 generated either
36f0: 20 62 79 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c by.. <code>SSL
3700: 5f 73 74 61 74 65 5f 73 74 72 69 6e 67 5f 6c 6f _state_string_lo
3710: 6e 67 28 29 3c 2f 63 6f 64 65 3e 20 6f 72 20 62 ng()</code> or b
3720: 79 0a 09 20 20 3c 63 6f 64 65 3e 53 53 4c 5f 61 y.. <code>SSL_a
3730: 6c 65 72 74 5f 64 65 73 63 5f 73 74 72 69 6e 67 lert_desc_string
3740: 5f 6c 6f 6e 67 28 29 3c 2f 63 6f 64 65 3e 2c 0a _long()</code>,.
3750: 09 20 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 . depending on
3760: 63 6f 6e 74 65 78 74 2e 0a 09 3c 2f 64 64 3e 0a context...</dd>.
3770: 0a 09 3c 62 72 3e 0a 0a 09 3c 64 74 3e 0a 09 20 ..<br>...<dt>..
3780: 20 3c 73 74 72 6f 6e 67 3e 76 65 72 69 66 79 3c <strong>verify<
3790: 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d 3e 63 68 61 /strong> <em>cha
37a0: 6e 6e 65 6c 20 64 65 70 74 68 20 63 65 72 74 20 nnel depth cert
37b0: 73 74 61 74 75 73 20 65 72 72 6f 72 3c 2f 65 6d status error</em
37c0: 3e 0a 09 3c 2f 64 74 3e 0a 09 3c 64 64 3e 0a 09 >..</dt>..<dd>..
37d0: 20 20 54 68 69 73 20 66 6f 72 6d 20 6f 66 20 63 This form of c
37e0: 61 6c 6c 62 61 63 6b 20 69 73 20 69 6e 76 6f 6b allback is invok
37f0: 65 64 20 62 79 20 74 68 65 20 4f 70 65 6e 53 53 ed by the OpenSS
3800: 4c 20 66 75 6e 63 74 69 6f 6e 0a 09 20 20 3c 63 L function.. <c
3810: 6f 64 65 3e 53 53 4c 5f 73 65 74 5f 76 65 72 69 ode>SSL_set_veri
3820: 66 79 28 29 3c 2f 63 6f 64 65 3e 2e 0a 09 20 20 fy()</code>...
3830: 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65 6d 3e <br>.. The <em>
3840: 64 65 70 74 68 3c 2f 65 6d 3e 20 61 72 67 75 6d depth</em> argum
3850: 65 6e 74 20 69 73 20 61 6e 20 69 6e 74 65 67 65 ent is an intege
3860: 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 r representing t
3870: 68 65 0a 09 20 20 63 75 72 72 65 6e 74 20 64 65 he.. current de
3880: 70 74 68 20 6f 6e 20 74 68 65 20 63 65 72 74 69 pth on the certi
3890: 66 69 63 61 74 65 20 63 68 61 69 6e 2c 20 77 69 ficate chain, wi
38a0: 74 68 0a 09 20 20 3c 63 6f 64 65 3e 30 3c 2f 63 th.. <code>0</c
38b0: 6f 64 65 3e 20 61 73 20 74 68 65 20 73 75 62 6a ode> as the subj
38c0: 65 63 74 20 63 65 72 74 69 66 69 63 61 74 65 20 ect certificate
38d0: 61 6e 64 20 68 69 67 68 65 72 20 76 61 6c 75 65 and higher value
38e0: 73 0a 09 20 20 64 65 6e 6f 74 69 6e 67 20 70 72 s.. denoting pr
38f0: 6f 67 72 65 73 73 69 76 65 6c 79 20 6d 6f 72 65 ogressively more
3900: 20 69 6e 64 69 72 65 63 74 20 69 73 73 75 65 72 indirect issuer
3910: 20 63 65 72 74 69 66 69 63 61 74 65 73 2e 0a 09 certificates...
3920: 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65 <br>.. The <e
3930: 6d 3e 63 65 72 74 3c 2f 65 6d 3e 20 61 72 67 75 m>cert</em> argu
3940: 6d 65 6e 74 20 69 73 20 61 20 6c 69 73 74 20 6f ment is a list o
3950: 66 20 6b 65 79 2d 76 61 6c 75 65 20 70 61 69 72 f key-value pair
3960: 73 20 73 69 6d 69 6c 61 72 0a 09 20 20 74 6f 20 s similar.. to
3970: 74 68 6f 73 65 20 72 65 74 75 72 6e 65 64 20 62 those returned b
3980: 79 0a 09 20 20 3c 61 20 68 72 65 66 3d 22 23 74 y.. <a href="#t
3990: 6c 73 3a 3a 73 74 61 74 75 73 22 3e 3c 73 74 72 ls::status"><str
39a0: 6f 6e 67 3e 74 6c 73 3a 3a 73 74 61 74 75 73 3c ong>tls::status<
39b0: 2f 73 74 72 6f 6e 67 3e 3c 2f 61 3e 2e 0a 09 20 /strong></a>...
39c0: 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 3c 65 6d <br>.. The <em
39d0: 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20 61 72 67 >status</em> arg
39e0: 75 6d 65 6e 74 20 69 73 20 61 6e 20 69 6e 74 65 ument is an inte
39f0: 67 65 72 20 72 65 70 72 65 73 65 6e 74 69 6e 67 ger representing
3a00: 20 74 68 65 0a 09 20 20 63 75 72 72 65 6e 74 20 the.. current
3a10: 76 61 6c 69 64 69 74 79 20 6f 66 20 74 68 65 20 validity of the
3a20: 63 65 72 74 69 66 69 63 61 74 65 2e 0a 09 20 20 certificate...
3a30: 41 20 76 61 6c 75 65 20 6f 66 20 3c 63 6f 64 65 A value of <code
3a40: 3e 30 3c 2f 63 6f 64 65 3e 20 6d 65 61 6e 73 20 >0</code> means
3a50: 74 68 65 20 63 65 72 74 69 66 69 63 61 74 65 20 the certificate
3a60: 69 73 20 64 65 65 6d 65 64 20 69 6e 76 61 6c 69 is deemed invali
3a70: 64 2e 0a 09 20 20 41 20 76 61 6c 75 65 20 6f 66 d... A value of
3a80: 20 3c 63 6f 64 65 3e 31 3c 2f 63 6f 64 65 3e 20 <code>1</code>
3a90: 6d 65 61 6e 73 20 74 68 65 20 63 65 72 74 69 66 means the certif
3aa0: 69 63 61 74 65 20 69 73 20 64 65 65 6d 65 64 20 icate is deemed
3ab0: 76 61 6c 69 64 2e 0a 09 20 20 3c 62 72 3e 0a 09 valid... <br>..
3ac0: 20 20 54 68 65 20 3c 65 6d 3e 65 72 72 6f 72 3c The <em>error<
3ad0: 2f 65 6d 3e 20 61 72 67 75 6d 65 6e 74 20 73 75 /em> argument su
3ae0: 70 70 6c 69 65 73 20 74 68 65 20 6d 65 73 73 61 pplies the messa
3af0: 67 65 2c 20 69 66 20 61 6e 79 2c 20 67 65 6e 65 ge, if any, gene
3b00: 72 61 74 65 64 0a 09 20 20 62 79 0a 09 20 20 3c rated.. by.. <
3b10: 63 6f 64 65 3e 58 35 30 39 5f 53 54 4f 52 45 5f code>X509_STORE_
3b20: 43 54 58 5f 67 65 74 5f 65 72 72 6f 72 28 29 3c CTX_get_error()<
3b30: 2f 63 6f 64 65 3e 2e 0a 09 20 20 3c 62 72 3e 0a /code>... <br>.
3b40: 09 20 20 3c 62 72 3e 0a 09 20 20 54 68 65 20 63 . <br>.. The c
3b50: 61 6c 6c 62 61 63 6b 20 6d 61 79 20 6f 76 65 72 allback may over
3b60: 72 69 64 65 20 6e 6f 72 6d 61 6c 20 76 61 6c 69 ride normal vali
3b70: 64 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 69 6e dation processin
3b80: 67 20 62 79 20 65 78 70 6c 69 63 69 74 6c 79 0a g by explicitly.
3b90: 09 20 20 72 65 74 75 72 6e 69 6e 67 20 6f 6e 65 . returning one
3ba0: 20 6f 66 20 74 68 65 20 61 62 6f 76 65 20 3c 65 of the above <e
3bb0: 6d 3e 73 74 61 74 75 73 3c 2f 65 6d 3e 20 76 61 m>status</em> va
3bc0: 6c 75 65 73 2e 0a 09 3c 2f 64 64 3e 0a 0a 09 3c lues...</dd>...<
3bd0: 2f 64 6c 3e 0a 20 20 20 20 3c 2f 64 64 3e 0a 0a /dl>. </dd>..
3be0: 20 20 20 20 3c 62 72 3e 0a 0a 20 20 20 20 3c 64 <br>.. <d
3bf0: 74 3e 3c 73 74 72 6f 6e 67 3e 2d 70 61 73 73 77 t><strong>-passw
3c00: 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 3c 65 6d ord</strong> <em
3c10: 3e 63 61 6c 6c 62 61 63 6b 3c 2f 65 6d 3e 3c 2f >callback</em></
3c20: 64 74 3e 0a 20 20 20 20 3c 64 64 3e 0a 09 49 6e dt>. <dd>..In
3c30: 76 6f 6b 65 73 20 74 68 65 20 73 70 65 63 69 66 vokes the specif
3c40: 69 65 64 20 3c 65 6d 3e 63 61 6c 6c 62 61 63 6b ied <em>callback
3c50: 3c 2f 65 6d 3e 20 73 63 72 69 70 74 20 77 68 65 </em> script whe
3c60: 6e 20 4f 70 65 6e 53 53 4c 20 6e 65 65 64 73 20 n OpenSSL needs
3c70: 74 6f 0a 09 6f 62 74 61 69 6e 20 61 20 70 61 73 to..obtain a pas
3c80: 73 77 6f 72 64 2e 20 20 54 68 65 20 63 61 6c 6c sword. The call
3c90: 62 61 63 6b 20 73 68 6f 75 6c 64 20 72 65 74 75 back should retu
3ca0: 72 6e 20 61 20 73 74 72 69 6e 67 20 77 68 69 63 rn a string whic
3cb0: 68 0a 09 72 65 70 72 65 73 65 6e 74 73 20 74 68 h..represents th
3cc0: 65 20 70 61 73 73 77 6f 72 64 20 74 6f 20 62 65 e password to be
3cd0: 20 75 73 65 64 2e 0a 09 4e 6f 20 61 72 67 75 6d used...No argum
3ce0: 65 6e 74 73 20 61 72 65 20 61 70 70 65 6e 64 65 ents are appende
3cf0: 64 20 74 6f 20 74 68 65 20 73 63 72 69 70 74 20 d to the script
3d00: 75 70 6f 6e 20 63 61 6c 6c 62 61 63 6b 2e 0a 20 upon callback..
3d10: 20 20 20 3c 2f 64 64 3e 0a 3c 2f 64 6c 3e 0a 3c </dd>.</dl>.<
3d20: 2f 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 0a 3c 70 /blockquote>..<p
3d30: 3e 0a 52 65 66 65 72 65 6e 63 65 20 69 6d 70 6c >.Reference impl
3d40: 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 74 ementations of t
3d50: 68 65 73 65 20 63 61 6c 6c 62 61 63 6b 73 20 61 hese callbacks a
3d60: 72 65 20 70 72 6f 76 69 64 65 64 20 69 6e 20 74 re provided in t
3d70: 68 65 0a 64 69 73 74 72 69 62 75 74 69 6f 6e 20 he.distribution
3d80: 61 73 20 3c 73 74 72 6f 6e 67 3e 74 6c 73 3a 3a as <strong>tls::
3d90: 63 61 6c 6c 62 61 63 6b 3c 2f 73 74 72 6f 6e 67 callback</strong
3da0: 3e 20 61 6e 64 0a 3c 73 74 72 6f 6e 67 3e 74 6c > and.<strong>tl
3db0: 73 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74 72 s::password</str
3dc0: 6f 6e 67 3e 20 72 65 73 70 65 63 74 69 76 65 6c ong> respectivel
3dd0: 79 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 74 68 y. Note that th
3de0: 65 73 65 20 61 72 65 0a 3c 65 6d 3e 73 61 6d 70 ese are.<em>samp
3df0: 6c 65 3c 2f 65 6d 3e 20 69 6d 70 6c 65 6d 65 6e le</em> implemen
3e00: 74 61 74 69 6f 6e 73 20 6f 6e 6c 79 2e 20 20 49 tations only. I
3e10: 6e 20 61 20 6d 6f 72 65 20 72 65 61 6c 69 73 74 n a more realist
3e20: 69 63 20 64 65 70 6c 6f 79 6d 65 6e 74 0a 79 6f ic deployment.yo
3e30: 75 20 77 6f 75 6c 64 20 73 70 65 63 69 66 79 20 u would specify
3e40: 79 6f 75 72 20 6f 77 6e 20 63 61 6c 6c 62 61 63 your own callbac
3e50: 6b 20 73 63 72 69 70 74 73 20 6f 6e 20 65 61 63 k scripts on eac
3e60: 68 20 54 4c 53 20 63 68 61 6e 6e 65 6c 0a 75 73 h TLS channel.us
3e70: 69 6e 67 20 74 68 65 20 3c 65 6d 3e 2d 63 6f 6d ing the <em>-com
3e80: 6d 61 6e 64 3c 2f 65 6d 3e 20 61 6e 64 20 3c 65 mand</em> and <e
3e90: 6d 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d 3e m>-password</em>
3ea0: 20 6f 70 74 69 6f 6e 73 2e 0a 3c 2f 70 3e 0a 0a options..</p>..
3eb0: 3c 70 3e 0a 54 68 65 20 64 65 66 61 75 6c 74 20 <p>.The default
3ec0: 62 65 68 61 76 69 6f 72 20 77 68 65 6e 20 74 68 behavior when th
3ed0: 65 20 3c 65 6d 3e 2d 63 6f 6d 6d 61 6e 64 3c 2f e <em>-command</
3ee0: 65 6d 3e 20 6f 70 74 69 6f 6e 20 69 73 20 6e 6f em> option is no
3ef0: 74 20 73 70 65 63 69 66 69 65 64 20 69 73 20 66 t specified is f
3f00: 6f 72 0a 54 4c 53 20 74 6f 20 70 72 6f 63 65 73 or.TLS to proces
3f10: 73 20 74 68 65 20 61 73 73 6f 63 69 61 74 65 64 s the associated
3f20: 20 6c 69 62 72 61 72 79 20 63 61 6c 6c 62 61 63 library callbac
3f30: 6b 73 20 69 6e 74 65 72 6e 61 6c 6c 79 2e 0a 54 ks internally..T
3f40: 68 65 20 64 65 66 61 75 6c 74 20 62 65 68 61 76 he default behav
3f50: 69 6f 72 20 77 68 65 6e 20 74 68 65 20 3c 65 6d ior when the <em
3f60: 3e 2d 70 61 73 73 77 6f 72 64 3c 2f 65 6d 3e 20 >-password</em>
3f70: 6f 70 74 69 6f 6e 20 69 73 20 6e 6f 74 20 73 70 option is not sp
3f80: 65 63 69 66 69 65 64 20 69 73 20 66 6f 72 0a 54 ecified is for.T
3f90: 4c 53 20 74 6f 20 70 72 6f 63 65 73 73 20 74 68 LS to process th
3fa0: 65 20 61 73 73 6f 63 69 61 74 65 64 20 6c 69 62 e associated lib
3fb0: 72 61 72 79 20 63 61 6c 6c 62 61 63 6b 73 20 62 rary callbacks b
3fc0: 79 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 y attempting to
3fd0: 63 61 6c 6c 0a 3c 73 74 72 6f 6e 67 3e 74 6c 73 call.<strong>tls
3fe0: 3a 3a 70 61 73 73 77 6f 72 64 3c 2f 73 74 72 6f ::password</stro
3ff0: 6e 67 3e 2e 0a 54 68 65 20 64 69 66 66 65 72 65 ng>..The differe
4000: 6e 63 65 20 62 65 74 77 65 65 6e 20 74 68 65 73 nce between thes
4010: 65 20 74 77 6f 20 62 65 68 61 76 69 6f 72 73 20 e two behaviors
4020: 69 73 20 61 20 63 6f 6e 73 65 71 75 65 6e 63 65 is a consequence
4030: 20 6f 66 20 6d 61 69 6e 74 61 69 6e 69 6e 67 0a of maintaining.
4040: 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 77 69 compatibility wi
4050: 74 68 20 65 61 72 6c 69 65 72 20 69 6d 70 6c 65 th earlier imple
4060: 6d 65 6e 74 61 74 69 6f 6e 73 2e 0a 3c 2f 70 3e mentations..</p>
4070: 0a 0a 3c 70 3e 0a 54 68 65 20 3c 73 74 72 6f 6e ..<p>.The <stron
4080: 67 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f 73 74 g>tls::debug</st
4090: 72 6f 6e 67 3e 20 76 61 72 69 61 62 6c 65 20 70 rong> variable p
40a0: 72 6f 76 69 64 65 73 20 73 6f 6d 65 20 61 64 64 rovides some add
40b0: 69 74 69 6f 6e 61 6c 0a 63 6f 6e 74 72 6f 6c 20 itional.control
40c0: 6f 76 65 72 20 74 68 65 73 65 20 72 65 66 65 72 over these refer
40d0: 65 6e 63 65 20 63 61 6c 6c 62 61 63 6b 73 2e 20 ence callbacks.
40e0: 20 49 74 73 20 76 61 6c 75 65 20 69 73 20 7a 65 Its value is ze
40f0: 72 6f 20 62 79 20 64 65 66 61 75 6c 74 2e 0a 48 ro by default..H
4100: 69 67 68 65 72 20 76 61 6c 75 65 73 20 70 72 6f igher values pro
4110: 64 75 63 65 20 6d 6f 72 65 20 64 69 61 67 6e 6f duce more diagno
4120: 73 74 69 63 20 6f 75 74 70 75 74 2c 20 61 6e 64 stic output, and
4130: 20 77 69 6c 6c 20 61 6c 73 6f 20 66 6f 72 63 65 will also force
4140: 20 74 68 65 0a 76 65 72 69 66 79 20 6d 65 74 68 the.verify meth
4150: 6f 64 20 69 6e 20 3c 73 74 72 6f 6e 67 3e 74 6c od in <strong>tl
4160: 73 3a 3a 63 61 6c 6c 62 61 63 6b 3c 2f 73 74 72 s::callback</str
4170: 6f 6e 67 3e 20 74 6f 20 61 63 63 65 70 74 20 74 ong> to accept t
4180: 68 65 0a 63 65 72 74 69 66 69 63 61 74 65 2c 20 he.certificate,
4190: 65 76 65 6e 20 77 68 65 6e 20 69 74 20 69 73 20 even when it is
41a0: 69 6e 76 61 6c 69 64 2e 0a 3c 2f 70 3e 0a 0a 3c invalid..</p>..<
41b0: 70 3e 0a 3c 65 6d 3e 0a 54 68 65 20 75 73 65 20 p>.<em>.The use
41c0: 6f 66 20 74 68 65 20 72 65 66 65 72 65 6e 63 65 of the reference
41d0: 20 63 61 6c 6c 62 61 63 6b 73 20 3c 73 74 72 6f callbacks <stro
41e0: 6e 67 3e 74 6c 73 3a 3a 63 61 6c 6c 62 61 63 6b ng>tls::callback
41f0: 3c 2f 73 74 72 6f 6e 67 3e 20 61 6e 64 0a 3c 73 </strong> and.<s
4200: 74 72 6f 6e 67 3e 74 6c 73 3a 3a 70 61 73 73 77 trong>tls::passw
4210: 6f 72 64 3c 2f 73 74 72 6f 6e 67 3e 20 69 73 20 ord</strong> is
4220: 6e 6f 74 20 72 65 63 6f 6d 6d 65 6e 64 65 64 2e not recommended.
4230: 20 20 54 68 65 79 20 6d 61 79 20 62 65 20 72 65 They may be re
4240: 6d 6f 76 65 64 0a 66 72 6f 6d 20 66 75 74 75 72 moved.from futur
4250: 65 20 72 65 6c 65 61 73 65 73 2e 0a 3c 2f 65 6d e releases..</em
4260: 3e 0a 3c 2f 70 3e 0a 0a 3c 70 3e 0a 3c 65 6d 3e >.</p>..<p>.<em>
4270: 0a 54 68 65 20 75 73 65 20 6f 66 20 74 68 65 20 .The use of the
4280: 76 61 72 69 61 62 6c 65 20 3c 73 74 72 6f 6e 67 variable <strong
4290: 3e 74 6c 73 3a 3a 64 65 62 75 67 3c 2f 73 74 72 >tls::debug</str
42a0: 6f 6e 67 3e 20 69 73 20 6e 6f 74 20 72 65 63 6f ong> is not reco
42b0: 6d 6d 65 6e 64 65 64 2e 0a 49 74 20 6d 61 79 20 mmended..It may
42c0: 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d 20 be removed from
42d0: 66 75 74 75 72 65 20 72 65 6c 65 61 73 65 73 2e future releases.
42e0: 0a 3c 2f 65 6d 3e 0a 3c 2f 70 3e 0a 0a 3c 68 33 .</em>.</p>..<h3
42f0: 3e 3c 61 20 6e 61 6d 65 3d 22 44 45 42 55 47 22 ><a name="DEBUG"
4300: 3e 44 45 42 55 47 3c 2f 61 3e 3c 2f 68 33 3e 0a >DEBUG</a></h3>.
4310: 0a 54 4c 53 20 6b 65 79 20 6c 6f 67 67 69 6e 67 .TLS key logging
4320: 20 63 61 6e 20 62 65 20 65 6e 61 62 6c 65 64 20 can be enabled
4330: 62 79 20 73 65 74 74 69 6e 67 20 74 68 65 20 65 by setting the e
4340: 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61 nvironment varia
4350: 62 6c 65 0a 3c 62 3e 53 53 4c 4b 45 59 4c 4f 47 ble.<b>SSLKEYLOG
4360: 46 49 4c 45 3c 2f 62 3e 20 74 6f 20 74 68 65 20 FILE</b> to the
4370: 6e 61 6d 65 20 6f 66 20 74 68 65 20 66 69 6c 65 name of the file
4380: 20 74 6f 20 6c 6f 67 20 74 6f 2e 20 54 68 65 6e to log to. Then
4390: 20 77 68 65 6e 65 76 65 72 20 54 4c 53 0a 6b 65 whenever TLS.ke
43a0: 79 20 6d 61 74 65 72 69 61 6c 20 69 73 20 67 65 y material is ge
43b0: 6e 65 72 61 74 65 64 20 6f 72 20 72 65 63 65 69 nerated or recei
43c0: 76 65 64 20 69 74 20 77 69 6c 6c 20 62 65 20 6c ved it will be l
43d0: 6f 67 67 65 64 20 74 6f 20 74 68 65 20 66 69 6c ogged to the fil
43e0: 65 2e 0a 0a 3c 68 33 3e 3c 61 20 6e 61 6d 65 3d e...<h3><a name=
43f0: 22 48 54 54 50 53 20 45 58 41 4d 50 4c 45 22 3e "HTTPS EXAMPLE">
4400: 48 54 54 50 53 20 45 58 41 4d 50 4c 45 3c 2f 61 HTTPS EXAMPLE</a
4410: 3e 3c 2f 68 33 3e 0a 0a 3c 70 3e 54 68 69 73 20 ></h3>..<p>This
4420: 65 78 61 6d 70 6c 65 20 75 73 65 73 20 61 20 73 example uses a s
4430: 61 6d 70 6c 65 20 73 65 72 76 65 72 2e 70 65 6d ample server.pem
4440: 20 70 72 6f 76 69 64 65 64 20 77 69 74 68 20 74 provided with t
4450: 68 65 20 54 4c 53 20 72 65 6c 65 61 73 65 2c 0a he TLS release,.
4460: 63 6f 75 72 74 65 73 79 20 6f 66 20 74 68 65 20 courtesy of the
4470: 3c 73 74 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c <strong>OpenSSL<
4480: 2f 73 74 72 6f 6e 67 3e 20 70 72 6f 6a 65 63 74 /strong> project
4490: 2e 3c 2f 70 3e 0a 0a 3c 70 72 65 3e 3c 63 6f 64 .</p>..<pre><cod
44a0: 65 3e 0a 70 61 63 6b 61 67 65 20 72 65 71 75 69 e>.package requi
44b0: 72 65 20 68 74 74 70 0a 70 61 63 6b 61 67 65 20 re http.package
44c0: 72 65 71 75 69 72 65 20 74 6c 73 0a 0a 68 74 74 require tls..htt
44d0: 70 3a 3a 72 65 67 69 73 74 65 72 20 68 74 74 70 p::register http
44e0: 73 20 34 34 33 20 5b 6c 69 73 74 20 3a 3a 74 6c s 443 [list ::tl
44f0: 73 3a 3a 73 6f 63 6b 65 74 20 2d 61 75 74 6f 73 s::socket -autos
4500: 65 72 76 65 72 6e 61 6d 65 20 74 72 75 65 20 2d ervername true -
4510: 72 65 71 75 69 72 65 20 74 72 75 65 20 2d 63 61 require true -ca
4520: 64 69 72 20 2f 65 74 63 2f 73 73 6c 2f 63 65 72 dir /etc/ssl/cer
4530: 74 73 5d 0a 0a 73 65 74 20 74 6f 6b 20 5b 68 74 ts]..set tok [ht
4540: 74 70 3a 3a 67 65 74 75 72 6c 20 68 74 74 70 73 tp::geturl https
4550: 3a 2f 2f 77 77 77 2e 74 63 6c 2e 74 6b 2f 5d 0a ://www.tcl.tk/].
4560: 3c 2f 63 6f 64 65 3e 3c 2f 70 72 65 3e 0a 0a 3c </code></pre>..<
4570: 68 33 3e 3c 61 20 6e 61 6d 65 3d 22 53 50 45 43 h3><a name="SPEC
4580: 49 41 4c 20 43 4f 4e 53 49 44 45 52 41 54 49 4f IAL CONSIDERATIO
4590: 4e 53 22 3e 53 50 45 43 49 41 4c 20 43 4f 4e 53 NS">SPECIAL CONS
45a0: 49 44 45 52 41 54 49 4f 4e 53 3c 2f 61 3e 3c 2f IDERATIONS</a></
45b0: 68 33 3e 0a 0a 3c 70 3e 54 68 65 20 63 61 70 61 h3>..<p>The capa
45c0: 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 69 73 bilities of this
45d0: 20 70 61 63 6b 61 67 65 20 63 61 6e 20 76 61 72 package can var
45e0: 79 20 65 6e 6f 72 6d 6f 75 73 6c 79 20 62 61 73 y enormously bas
45f0: 65 64 0a 75 70 6f 6e 20 68 6f 77 20 79 6f 75 72 ed.upon how your
4600: 20 4f 70 65 6e 53 53 4c 20 6c 69 62 72 61 72 79 OpenSSL library
4610: 20 77 61 73 20 63 6f 6e 66 69 67 75 72 65 64 20 was configured
4620: 61 6e 64 20 62 75 69 6c 74 2e 20 41 74 20 74 68 and built. At th
4630: 65 0a 6d 6f 73 74 20 6d 61 63 72 6f 2d 6c 65 76 e.most macro-lev
4640: 65 6c 20 4f 70 65 6e 53 53 4c 20 73 75 70 70 6f el OpenSSL suppo
4650: 72 74 73 20 61 20 26 71 75 6f 74 3b 6e 6f 20 70 rts a "no p
4660: 61 74 65 6e 74 73 26 71 75 6f 74 3b 20 62 75 69 atents" bui
4670: 6c 64 2c 0a 77 68 69 63 68 20 64 69 73 61 62 6c ld,.which disabl
4680: 65 73 20 52 53 41 2c 20 49 44 45 41 2c 20 52 43 es RSA, IDEA, RC
4690: 28 32 2c 34 2c 35 29 20 61 6e 64 20 53 53 4c 32 (2,4,5) and SSL2
46a0: 20 2d 20 69 66 20 79 6f 75 72 20 4f 70 65 6e 53 - if your OpenS
46b0: 53 4c 20 69 73 0a 63 6f 6e 66 69 67 75 72 65 64 SL is.configured
46c0: 20 74 68 69 73 20 77 61 79 20 74 68 65 6e 20 79 this way then y
46d0: 6f 75 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 ou will need to
46e0: 62 75 69 6c 64 20 54 4c 53 20 77 69 74 68 20 74 build TLS with t
46f0: 68 65 0a 2d 44 4e 4f 5f 50 41 54 45 4e 54 53 20 he.-DNO_PATENTS
4700: 6f 70 74 69 6f 6e 20 2d 20 61 6e 64 20 74 68 65 option - and the
4710: 20 72 65 73 75 6c 74 61 6e 74 20 6d 6f 64 75 6c resultant modul
4720: 65 20 77 69 6c 6c 20 66 75 6e 63 74 69 6f 6e 0a e will function.
4730: 63 6f 72 72 65 63 74 6c 79 20 61 6e 64 20 61 6c correctly and al
4740: 73 6f 20 73 75 70 70 6f 72 74 20 41 44 48 20 63 so support ADH c
4750: 65 72 74 69 66 69 63 61 74 65 2d 6c 65 73 73 20 ertificate-less
4760: 65 6e 63 72 79 70 74 69 6f 6e 2c 0a 68 6f 77 65 encryption,.howe
4770: 76 65 72 20 79 6f 75 20 77 69 6c 6c 20 62 65 20 ver you will be
4780: 75 6e 61 62 6c 65 20 74 6f 20 75 74 69 6c 69 7a unable to utiliz
4790: 65 20 74 68 69 73 20 74 6f 20 73 70 65 61 6b 20 e this to speak
47a0: 74 6f 20 6e 6f 72 6d 61 6c 20 57 65 62 0a 53 65 to normal Web.Se
47b0: 72 76 65 72 73 2c 20 77 68 69 63 68 20 74 79 70 rvers, which typ
47c0: 69 63 61 6c 6c 79 20 72 65 71 75 69 72 65 20 52 ically require R
47d0: 53 41 20 73 75 70 70 6f 72 74 2e 20 50 6c 65 61 SA support. Plea
47e0: 73 65 20 73 65 65 20 3c 61 0a 68 72 65 66 3d 22 se see <a.href="
47f0: 68 74 74 70 3a 2f 2f 77 77 77 2e 6f 70 65 6e 73 http://www.opens
4800: 73 6c 2e 6f 72 67 2f 22 3e 68 74 74 70 3a 2f 2f sl.org/">http://
4810: 77 77 77 2e 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f www.openssl.org/
4820: 3c 2f 61 3e 20 66 6f 72 0a 6d 6f 72 65 20 69 6e </a> for.more in
4830: 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 formation on the
4840: 20 77 68 6f 6c 65 20 69 73 73 75 65 20 6f 66 20 whole issue of
4850: 70 61 74 65 6e 74 73 20 61 6e 64 20 55 53 20 65 patents and US e
4860: 78 70 6f 72 74 0a 72 65 73 74 72 69 63 74 69 6f xport.restrictio
4870: 6e 73 2e 20 3c 2f 70 3e 0a 0a 3c 68 33 3e 3c 61 ns. </p>..<h3><a
4880: 20 6e 61 6d 65 3d 22 53 45 45 20 41 4c 53 4f 22 name="SEE ALSO"
4890: 3e 53 45 45 20 41 4c 53 4f 3c 2f 61 3e 3c 2f 68 >SEE ALSO</a></h
48a0: 33 3e 0a 0a 3c 70 3e 3c 73 74 72 6f 6e 67 3e 73 3>..<p><strong>s
48b0: 6f 63 6b 65 74 3c 2f 73 74 72 6f 6e 67 3e 2c 20 ocket</strong>,
48c0: 3c 73 74 72 6f 6e 67 3e 66 69 6c 65 65 76 65 6e <strong>fileeven
48d0: 74 2c 20 3c 2f 73 74 72 6f 6e 67 3e 3c 61 0a 68 t, </strong><a.h
48e0: 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e ref="http://www.
48f0: 6f 70 65 6e 73 73 6c 2e 6f 72 67 2f 22 3e 3c 73 openssl.org/"><s
4900: 74 72 6f 6e 67 3e 4f 70 65 6e 53 53 4c 3c 2f 73 trong>OpenSSL</s
4910: 74 72 6f 6e 67 3e 3c 2f 61 3e 3c 2f 70 3e 0a 0a trong></a></p>..
4920: 3c 68 72 3e 0a 0a 3c 70 72 65 3e 0a 43 6f 70 79 <hr>..<pre>.Copy
4930: 72 69 67 68 74 20 26 63 6f 70 79 3b 20 31 39 39 right © 199
4940: 39 20 4d 61 74 74 20 4e 65 77 6d 61 6e 2e 0a 43 9 Matt Newman..C
4950: 6f 70 79 72 69 67 68 74 20 26 63 6f 70 79 3b 20 opyright ©
4960: 32 30 30 34 20 53 74 61 72 66 69 73 68 20 53 79 2004 Starfish Sy
4970: 73 74 65 6d 73 2e 0a 3c 2f 70 72 65 3e 0a 3c 2f stems..</pre>.</
4980: 62 6f 64 79 3e 0a 3c 2f 68 74 6d 6c 3e 0a body>.</html>.