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