1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module gdata.tlslite.TLSConnection</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="gdata.html"><font color="#ffffff">gdata</font></a>.<a href="gdata.tlslite.html"><font color="#ffffff">tlslite</font></a>.TLSConnection</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/afshar/wrk/gdata-python-client/src/gdata/tlslite/TLSConnection.py">/home/afshar/wrk/gdata-python-client/src/gdata/tlslite/TLSConnection.py</a></font></td></tr></table>
<p><tt>MAIN CLASS FOR TLS LITE (START HERE!).</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="Crypto.html">Crypto</a><br>
<a href="array.html">array</a><br>
<a href="base64.html">base64</a><br>
</td><td width="25%" valign=top><a href="binascii.html">binascii</a><br>
<a href="hmac.html">hmac</a><br>
<a href="math.html">math</a><br>
</td><td width="25%" valign=top><a href="md5.html">md5</a><br>
<a href="os.html">os</a><br>
<a href="sha.html">sha</a><br>
</td><td width="25%" valign=top><a href="socket.html">socket</a><br>
<a href="sys.html">sys</a><br>
<a href="traceback.html">traceback</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="gdata.tlslite.TLSRecordLayer.html#TLSRecordLayer">gdata.tlslite.TLSRecordLayer.TLSRecordLayer</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="gdata.tlslite.TLSConnection.html#TLSConnection">TLSConnection</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="TLSConnection">class <strong>TLSConnection</strong></a>(<a href="gdata.tlslite.TLSRecordLayer.html#TLSRecordLayer">gdata.tlslite.TLSRecordLayer.TLSRecordLayer</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt>This class wraps a socket and provides TLS handshaking and data<br>
transfer.<br>
<br>
To use this class, create a new instance, passing a connected<br>
socket into the constructor. Then call some handshake function.<br>
If the handshake completes without raising an exception, then a TLS<br>
connection has been negotiated. You can transfer data over this<br>
connection as if it were a socket.<br>
<br>
This class provides both synchronous and asynchronous versions of<br>
its key functions. The synchronous versions should be used when<br>
writing single-or multi-threaded code using blocking sockets. The<br>
asynchronous versions should be used when performing asynchronous,<br>
event-based I/O with non-blocking sockets.<br>
<br>
Asynchronous I/O is a complicated subject; typically, you should<br>
not use the asynchronous functions directly, but should use some<br>
framework like asyncore or Twisted which TLS Lite integrates with<br>
(see<br>
L{tlslite.integration.TLSAsyncDispatcherMixIn.TLSAsyncDispatcherMixIn} or<br>
L{tlslite.integration.TLSTwistedProtocolWrapper.TLSTwistedProtocolWrapper}).<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="TLSConnection-__init__"><strong>__init__</strong></a>(self, sock)</dt><dd><tt>Create a new <a href="#TLSConnection">TLSConnection</a> instance.<br>
<br>
@param sock: The socket data will be transmitted on. The<br>
socket should already be connected. It may be in blocking or<br>
non-blocking mode.<br>
<br>
@type sock: L{socket.socket}</tt></dd></dl>
<dl><dt><a name="TLSConnection-handshakeClientCert"><strong>handshakeClientCert</strong></a>(self, certChain<font color="#909090">=None</font>, privateKey<font color="#909090">=None</font>, session<font color="#909090">=None</font>, settings<font color="#909090">=None</font>, checker<font color="#909090">=None</font>, async<font color="#909090">=False</font>)</dt><dd><tt>Perform a certificate-based handshake in the role of client.<br>
<br>
This function performs an SSL or TLS handshake. The server<br>
will authenticate itself using an X.509 or cryptoID certificate<br>
chain. If the handshake succeeds, the server's certificate<br>
chain will be stored in the session's serverCertChain attribute.<br>
Unless a checker object is passed in, this function does no<br>
validation or checking of the server's certificate chain.<br>
<br>
If the server requests client authentication, the<br>
client will send the passed-in certificate chain, and use the<br>
passed-in private key to authenticate itself. If no<br>
certificate chain and private key were passed in, the client<br>
will attempt to proceed without client authentication. The<br>
server may or may not allow this.<br>
<br>
Like any handshake function, this can be called on a closed<br>
TLS connection, or on a TLS connection that is already open.<br>
If called on an open connection it performs a re-handshake.<br>
<br>
If the function completes without raising an exception, the<br>
TLS connection will be open and available for data transfer.<br>
<br>
If an exception is raised, the connection will have been<br>
automatically closed (if it was ever open).<br>
<br>
@type certChain: L{tlslite.X509CertChain.X509CertChain} or<br>
L{cryptoIDlib.CertChain.CertChain}<br>
@param certChain: The certificate chain to be used if the<br>
server requests client authentication.<br>
<br>
@type privateKey: L{tlslite.utils.RSAKey.RSAKey}<br>
@param privateKey: The private key to be used if the server<br>
requests client authentication.<br>
<br>
@type session: L{tlslite.Session.Session}<br>
@param session: A TLS session to attempt to resume. If the<br>
resumption does not succeed, a full handshake will be<br>
performed.<br>
<br>
@type settings: L{tlslite.HandshakeSettings.HandshakeSettings}<br>
@param settings: Various settings which can be used to control<br>
the ciphersuites, certificate types, and SSL/TLS versions<br>
offered by the client.<br>
<br>
@type checker: L{tlslite.Checker.Checker}<br>
@param checker: A Checker instance. This instance will be<br>
invoked to examine the other party's authentication<br>
credentials, if the handshake completes succesfully.<br>
<br>
@type async: bool<br>
@param async: If False, this function will block until the<br>
handshake is completed. If True, this function will return a<br>
generator. Successive invocations of the generator will<br>
return 0 if it is waiting to read from the socket, 1 if it is<br>
waiting to write to the socket, or will raise StopIteration if<br>
the handshake operation is completed.<br>
<br>
@rtype: None or an iterable<br>
@return: If 'async' is True, a generator object will be<br>
returned.<br>
<br>
@raise socket.error: If a socket error occurs.<br>
@raise tlslite.errors.TLSAbruptCloseError: If the socket is closed<br>
without a preceding alert.<br>
@raise tlslite.errors.TLSAlert: If a TLS alert is signalled.<br>
@raise tlslite.errors.TLSAuthenticationError: If the checker<br>
doesn't like the other party's authentication credentials.</tt></dd></dl>
<dl><dt><a name="TLSConnection-handshakeClientSRP"><strong>handshakeClientSRP</strong></a>(self, username, password, session<font color="#909090">=None</font>, settings<font color="#909090">=None</font>, checker<font color="#909090">=None</font>, async<font color="#909090">=False</font>)</dt><dd><tt>Perform an SRP handshake in the role of client.<br>
<br>
This function performs a TLS/SRP handshake. SRP mutually<br>
authenticates both parties to each other using only a<br>
username and password. This function may also perform a<br>
combined SRP and server-certificate handshake, if the server<br>
chooses to authenticate itself with a certificate chain in<br>
addition to doing SRP.<br>
<br>
TLS/SRP is non-standard. Most TLS implementations don't<br>
support it. See<br>
U{<a href="http://www.ietf.org/html.charters/tls-charter.html">http://www.ietf.org/html.charters/tls-charter.html</a>} or<br>
U{<a href="http://trevp.net/tlssrp/">http://trevp.net/tlssrp/</a>} for the latest information on<br>
TLS/SRP.<br>
<br>
Like any handshake function, this can be called on a closed<br>
TLS connection, or on a TLS connection that is already open.<br>
If called on an open connection it performs a re-handshake.<br>
<br>
If the function completes without raising an exception, the<br>
TLS connection will be open and available for data transfer.<br>
<br>
If an exception is raised, the connection will have been<br>
automatically closed (if it was ever open).<br>
<br>
@type username: str<br>
@param username: The SRP username.<br>
<br>
@type password: str<br>
@param password: The SRP password.<br>
<br>
@type session: L{tlslite.Session.Session}<br>
@param session: A TLS session to attempt to resume. This<br>
session must be an SRP session performed with the same username<br>
and password as were passed in. If the resumption does not<br>
succeed, a full SRP handshake will be performed.<br>
<br>
@type settings: L{tlslite.HandshakeSettings.HandshakeSettings}<br>
@param settings: Various settings which can be used to control<br>
the ciphersuites, certificate types, and SSL/TLS versions<br>
offered by the client.<br>
<br>
@type checker: L{tlslite.Checker.Checker}<br>
@param checker: A Checker instance. This instance will be<br>
invoked to examine the other party's authentication<br>
credentials, if the handshake completes succesfully.<br>
<br>
@type async: bool<br>
@param async: If False, this function will block until the<br>
handshake is completed. If True, this function will return a<br>
generator. Successive invocations of the generator will<br>
return 0 if it is waiting to read from the socket, 1 if it is<br>
waiting to write to the socket, or will raise StopIteration if<br>
the handshake operation is completed.<br>
<br>
@rtype: None or an iterable<br>
@return: If 'async' is True, a generator object will be<br>
returned.<br>
<br>
@raise socket.error: If a socket error occurs.<br>
@raise tlslite.errors.TLSAbruptCloseError: If the socket is closed<br>
without a preceding alert.<br>
@raise tlslite.errors.TLSAlert: If a TLS alert is signalled.<br>
@raise tlslite.errors.TLSAuthenticationError: If the checker<br>
doesn't like the other party's authentication credentials.</tt></dd></dl>
<dl><dt><a name="TLSConnection-handshakeClientSharedKey"><strong>handshakeClientSharedKey</strong></a>(self, username, sharedKey, settings<font color="#909090">=None</font>, checker<font color="#909090">=None</font>, async<font color="#909090">=False</font>)</dt><dd><tt>Perform a shared-key handshake in the role of client.<br>
<br>
This function performs a shared-key handshake. Using shared<br>
symmetric keys of high entropy (128 bits or greater) mutually<br>
authenticates both parties to each other.<br>
<br>
TLS with shared-keys is non-standard. Most TLS<br>
implementations don't support it. See<br>
U{<a href="http://www.ietf.org/html.charters/tls-charter.html">http://www.ietf.org/html.charters/tls-charter.html</a>} for the<br>
latest information on TLS with shared-keys. If the shared-keys<br>
Internet-Draft changes or is superceded, TLS Lite will track<br>
those changes, so the shared-key support in later versions of<br>
TLS Lite may become incompatible with this version.<br>
<br>
Like any handshake function, this can be called on a closed<br>
TLS connection, or on a TLS connection that is already open.<br>
If called on an open connection it performs a re-handshake.<br>
<br>
If the function completes without raising an exception, the<br>
TLS connection will be open and available for data transfer.<br>
<br>
If an exception is raised, the connection will have been<br>
automatically closed (if it was ever open).<br>
<br>
@type username: str<br>
@param username: The shared-key username.<br>
<br>
@type sharedKey: str<br>
@param sharedKey: The shared key.<br>
<br>
@type settings: L{tlslite.HandshakeSettings.HandshakeSettings}<br>
@param settings: Various settings which can be used to control<br>
the ciphersuites, certificate types, and SSL/TLS versions<br>
offered by the client.<br>
<br>
@type checker: L{tlslite.Checker.Checker}<br>
@param checker: A Checker instance. This instance will be<br>
invoked to examine the other party's authentication<br>
credentials, if the handshake completes succesfully.<br>
<br>
@type async: bool<br>
@param async: If False, this function will block until the<br>
handshake is completed. If True, this function will return a<br>
generator. Successive invocations of the generator will<br>
return 0 if it is waiting to read from the socket, 1 if it is<br>
waiting to write to the socket, or will raise StopIteration if<br>
the handshake operation is completed.<br>
<br>
@rtype: None or an iterable<br>
@return: If 'async' is True, a generator object will be<br>
returned.<br>
<br>
@raise socket.error: If a socket error occurs.<br>
@raise tlslite.errors.TLSAbruptCloseError: If the socket is closed<br>
without a preceding alert.<br>
@raise tlslite.errors.TLSAlert: If a TLS alert is signalled.<br>
@raise tlslite.errors.TLSAuthenticationError: If the checker<br>
doesn't like the other party's authentication credentials.</tt></dd></dl>
<dl><dt><a name="TLSConnection-handshakeClientUnknown"><strong>handshakeClientUnknown</strong></a>(self, srpCallback<font color="#909090">=None</font>, certCallback<font color="#909090">=None</font>, session<font color="#909090">=None</font>, settings<font color="#909090">=None</font>, checker<font color="#909090">=None</font>, async<font color="#909090">=False</font>)</dt><dd><tt>Perform a to-be-determined type of handshake in the role of client.<br>
<br>
This function performs an SSL or TLS handshake. If the server<br>
requests client certificate authentication, the<br>
certCallback will be invoked and should return a (certChain,<br>
privateKey) pair. If the callback returns None, the library<br>
will attempt to proceed without client authentication. The<br>
server may or may not allow this.<br>
<br>
If the server requests SRP authentication, the srpCallback<br>
will be invoked and should return a (username, password) pair.<br>
If the callback returns None, the local implementation will<br>
signal a user_canceled error alert.<br>
<br>
After the handshake completes, the client can inspect the<br>
connection's session attribute to determine what type of<br>
authentication was performed.<br>
<br>
Like any handshake function, this can be called on a closed<br>
TLS connection, or on a TLS connection that is already open.<br>
If called on an open connection it performs a re-handshake.<br>
<br>
If the function completes without raising an exception, the<br>
TLS connection will be open and available for data transfer.<br>
<br>
If an exception is raised, the connection will have been<br>
automatically closed (if it was ever open).<br>
<br>
@type srpCallback: callable<br>
@param srpCallback: The callback to be used if the server<br>
requests SRP authentication. If None, the client will not<br>
offer support for SRP ciphersuites.<br>
<br>
@type certCallback: callable<br>
@param certCallback: The callback to be used if the server<br>
requests client certificate authentication.<br>
<br>
@type session: L{tlslite.Session.Session}<br>
@param session: A TLS session to attempt to resume. If the<br>
resumption does not succeed, a full handshake will be<br>
performed.<br>
<br>
@type settings: L{tlslite.HandshakeSettings.HandshakeSettings}<br>
@param settings: Various settings which can be used to control<br>
the ciphersuites, certificate types, and SSL/TLS versions<br>
offered by the client.<br>
<br>
@type checker: L{tlslite.Checker.Checker}<br>
@param checker: A Checker instance. This instance will be<br>
invoked to examine the other party's authentication<br>
credentials, if the handshake completes succesfully.<br>
<br>
@type async: bool<br>
@param async: If False, this function will block until the<br>
handshake is completed. If True, this function will return a<br>
generator. Successive invocations of the generator will<br>
return 0 if it is waiting to read from the socket, 1 if it is<br>
waiting to write to the socket, or will raise StopIteration if<br>
the handshake operation is completed.<br>
<br>
@rtype: None or an iterable<br>
@return: If 'async' is True, a generator object will be<br>
returned.<br>
<br>
@raise socket.error: If a socket error occurs.<br>
@raise tlslite.errors.TLSAbruptCloseError: If the socket is closed<br>
without a preceding alert.<br>
@raise tlslite.errors.TLSAlert: If a TLS alert is signalled.<br>
@raise tlslite.errors.TLSAuthenticationError: If the checker<br>
doesn't like the other party's authentication credentials.</tt></dd></dl>
<dl><dt><a name="TLSConnection-handshakeServer"><strong>handshakeServer</strong></a>(self, sharedKeyDB<font color="#909090">=None</font>, verifierDB<font color="#909090">=None</font>, certChain<font color="#909090">=None</font>, privateKey<font color="#909090">=None</font>, reqCert<font color="#909090">=False</font>, sessionCache<font color="#909090">=None</font>, settings<font color="#909090">=None</font>, checker<font color="#909090">=None</font>)</dt><dd><tt>Perform a handshake in the role of server.<br>
<br>
This function performs an SSL or TLS handshake. Depending on<br>
the arguments and the behavior of the client, this function can<br>
perform a shared-key, SRP, or certificate-based handshake. It<br>
can also perform a combined SRP and server-certificate<br>
handshake.<br>
<br>
Like any handshake function, this can be called on a closed<br>
TLS connection, or on a TLS connection that is already open.<br>
If called on an open connection it performs a re-handshake.<br>
This function does not send a Hello Request message before<br>
performing the handshake, so if re-handshaking is required,<br>
the server must signal the client to begin the re-handshake<br>
through some other means.<br>
<br>
If the function completes without raising an exception, the<br>
TLS connection will be open and available for data transfer.<br>
<br>
If an exception is raised, the connection will have been<br>
automatically closed (if it was ever open).<br>
<br>
@type sharedKeyDB: L{tlslite.SharedKeyDB.SharedKeyDB}<br>
@param sharedKeyDB: A database of shared symmetric keys<br>
associated with usernames. If the client performs a<br>
shared-key handshake, the session's sharedKeyUsername<br>
attribute will be set.<br>
<br>
@type verifierDB: L{tlslite.VerifierDB.VerifierDB}<br>
@param verifierDB: A database of SRP password verifiers<br>
associated with usernames. If the client performs an SRP<br>
handshake, the session's srpUsername attribute will be set.<br>
<br>
@type certChain: L{tlslite.X509CertChain.X509CertChain} or<br>
L{cryptoIDlib.CertChain.CertChain}<br>
@param certChain: The certificate chain to be used if the<br>
client requests server certificate authentication.<br>
<br>
@type privateKey: L{tlslite.utils.RSAKey.RSAKey}<br>
@param privateKey: The private key to be used if the client<br>
requests server certificate authentication.<br>
<br>
@type reqCert: bool<br>
@param reqCert: Whether to request client certificate<br>
authentication. This only applies if the client chooses server<br>
certificate authentication; if the client chooses SRP or<br>
shared-key authentication, this will be ignored. If the client<br>
performs a client certificate authentication, the sessions's<br>
clientCertChain attribute will be set.<br>
<br>
@type sessionCache: L{tlslite.SessionCache.SessionCache}<br>
@param sessionCache: An in-memory cache of resumable sessions.<br>
The client can resume sessions from this cache. Alternatively,<br>
if the client performs a full handshake, a new session will be<br>
added to the cache.<br>
<br>
@type settings: L{tlslite.HandshakeSettings.HandshakeSettings}<br>
@param settings: Various settings which can be used to control<br>
the ciphersuites and SSL/TLS version chosen by the server.<br>
<br>
@type checker: L{tlslite.Checker.Checker}<br>
@param checker: A Checker instance. This instance will be<br>
invoked to examine the other party's authentication<br>
credentials, if the handshake completes succesfully.<br>
<br>
@raise socket.error: If a socket error occurs.<br>
@raise tlslite.errors.TLSAbruptCloseError: If the socket is closed<br>
without a preceding alert.<br>
@raise tlslite.errors.TLSAlert: If a TLS alert is signalled.<br>
@raise tlslite.errors.TLSAuthenticationError: If the checker<br>
doesn't like the other party's authentication credentials.</tt></dd></dl>
<dl><dt><a name="TLSConnection-handshakeServerAsync"><strong>handshakeServerAsync</strong></a>(self, sharedKeyDB<font color="#909090">=None</font>, verifierDB<font color="#909090">=None</font>, certChain<font color="#909090">=None</font>, privateKey<font color="#909090">=None</font>, reqCert<font color="#909090">=False</font>, sessionCache<font color="#909090">=None</font>, settings<font color="#909090">=None</font>, checker<font color="#909090">=None</font>)</dt><dd><tt>Start a server handshake operation on the TLS connection.<br>
<br>
This function returns a generator which behaves similarly to<br>
<a href="#TLSConnection-handshakeServer">handshakeServer</a>(). Successive invocations of the generator<br>
will return 0 if it is waiting to read from the socket, 1 if it is<br>
waiting to write to the socket, or it will raise StopIteration<br>
if the handshake operation is complete.<br>
<br>
@rtype: iterable<br>
@return: A generator; see above for details.</tt></dd></dl>
<hr>
Methods inherited from <a href="gdata.tlslite.TLSRecordLayer.html#TLSRecordLayer">gdata.tlslite.TLSRecordLayer.TLSRecordLayer</a>:<br>
<dl><dt><a name="TLSConnection-close"><strong>close</strong></a>(self)</dt><dd><tt>Close the TLS connection.<br>
<br>
This function will block until it has exchanged close_notify<br>
alerts with the other party. After doing so, it will shut down the<br>
TLS connection. Further attempts to read through this connection<br>
will return "". Further attempts to write through this connection<br>
will raise ValueError.<br>
<br>
If <a href="#TLSConnection-makefile">makefile</a>() has been called on this connection, the connection<br>
will be not be closed until the connection object and all file<br>
objects have been closed.<br>
<br>
Even if an exception is raised, the connection will have been<br>
closed.<br>
<br>
@raise socket.error: If a socket error occurs.<br>
@raise tlslite.errors.TLSAbruptCloseError: If the socket is closed<br>
without a preceding alert.<br>
@raise tlslite.errors.TLSAlert: If a TLS alert is signalled.</tt></dd></dl>
<dl><dt><a name="TLSConnection-closeAsync"><strong>closeAsync</strong></a>(self)</dt><dd><tt>Start a close operation on the TLS connection.<br>
<br>
This function returns a generator which behaves similarly to<br>
<a href="#TLSConnection-close">close</a>(). Successive invocations of the generator will return 0<br>
if it is waiting to read from the socket, 1 if it is waiting<br>
to write to the socket, or will raise StopIteration if the<br>
close operation has completed.<br>
<br>
@rtype: iterable<br>
@return: A generator; see above for details.</tt></dd></dl>
<dl><dt><a name="TLSConnection-getCipherImplementation"><strong>getCipherImplementation</strong></a>(self)</dt><dd><tt>Get the name of the cipher implementation used with<br>
this connection.<br>
<br>
@rtype: str<br>
@return: The name of the cipher implementation used with<br>
this connection. Either 'python', 'cryptlib', 'openssl',<br>
or 'pycrypto'.</tt></dd></dl>
<dl><dt><a name="TLSConnection-getCipherName"><strong>getCipherName</strong></a>(self)</dt><dd><tt>Get the name of the cipher used with this connection.<br>
<br>
@rtype: str<br>
@return: The name of the cipher used with this connection.<br>
Either 'aes128', 'aes256', 'rc4', or '3des'.</tt></dd></dl>
<dl><dt><a name="TLSConnection-getpeername"><strong>getpeername</strong></a>(self)</dt><dd><tt>Return the remote address to which the socket is connected<br>
(socket emulation).</tt></dd></dl>
<dl><dt><a name="TLSConnection-getsockname"><strong>getsockname</strong></a>(self)</dt><dd><tt>Return the socket's own address (socket emulation).</tt></dd></dl>
<dl><dt><a name="TLSConnection-gettimeout"><strong>gettimeout</strong></a>(self)</dt><dd><tt>Return the timeout associated with socket operations (socket<br>
emulation).</tt></dd></dl>
<dl><dt><a name="TLSConnection-makefile"><strong>makefile</strong></a>(self, mode<font color="#909090">='r'</font>, bufsize<font color="#909090">=-1</font>)</dt><dd><tt>Create a file object for the TLS connection (socket emulation).<br>
<br>
@rtype: L{tlslite.FileObject.FileObject}</tt></dd></dl>
<dl><dt><a name="TLSConnection-read"><strong>read</strong></a>(self, max<font color="#909090">=None</font>, min<font color="#909090">=1</font>)</dt><dd><tt>Read some data from the TLS connection.<br>
<br>
This function will block until at least 'min' bytes are<br>
available (or the connection is closed).<br>
<br>
If an exception is raised, the connection will have been<br>
automatically closed.<br>
<br>
@type max: int<br>
@param max: The maximum number of bytes to return.<br>
<br>
@type min: int<br>
@param min: The minimum number of bytes to return<br>
<br>
@rtype: str<br>
@return: A string of no more than 'max' bytes, and no fewer<br>
than 'min' (unless the connection has been closed, in which<br>
case fewer than 'min' bytes may be returned).<br>
<br>
@raise socket.error: If a socket error occurs.<br>
@raise tlslite.errors.TLSAbruptCloseError: If the socket is closed<br>
without a preceding alert.<br>
@raise tlslite.errors.TLSAlert: If a TLS alert is signalled.</tt></dd></dl>
<dl><dt><a name="TLSConnection-readAsync"><strong>readAsync</strong></a>(self, max<font color="#909090">=None</font>, min<font color="#909090">=1</font>)</dt><dd><tt>Start a read operation on the TLS connection.<br>
<br>
This function returns a generator which behaves similarly to<br>
<a href="#TLSConnection-read">read</a>(). Successive invocations of the generator will return 0<br>
if it is waiting to read from the socket, 1 if it is waiting<br>
to write to the socket, or a string if the read operation has<br>
completed.<br>
<br>
@rtype: iterable<br>
@return: A generator; see above for details.</tt></dd></dl>
<dl><dt><a name="TLSConnection-recv"><strong>recv</strong></a>(self, bufsize)</dt><dd><tt>Get some data from the TLS connection (socket emulation).<br>
<br>
@raise socket.error: If a socket error occurs.<br>
@raise tlslite.errors.TLSAbruptCloseError: If the socket is closed<br>
without a preceding alert.<br>
@raise tlslite.errors.TLSAlert: If a TLS alert is signalled.</tt></dd></dl>
<dl><dt><a name="TLSConnection-send"><strong>send</strong></a>(self, s)</dt><dd><tt>Send data to the TLS connection (socket emulation).<br>
<br>
@raise socket.error: If a socket error occurs.</tt></dd></dl>
<dl><dt><a name="TLSConnection-sendall"><strong>sendall</strong></a>(self, s)</dt><dd><tt>Send data to the TLS connection (socket emulation).<br>
<br>
@raise socket.error: If a socket error occurs.</tt></dd></dl>
<dl><dt><a name="TLSConnection-setsockopt"><strong>setsockopt</strong></a>(self, level, optname, value)</dt><dd><tt>Set the value of the given socket option (socket emulation).</tt></dd></dl>
<dl><dt><a name="TLSConnection-settimeout"><strong>settimeout</strong></a>(self, value)</dt><dd><tt>Set a timeout on blocking socket operations (socket emulation).</tt></dd></dl>
<dl><dt><a name="TLSConnection-write"><strong>write</strong></a>(self, s)</dt><dd><tt>Write some data to the TLS connection.<br>
<br>
This function will block until all the data has been sent.<br>
<br>
If an exception is raised, the connection will have been<br>
automatically closed.<br>
<br>
@type s: str<br>
@param s: The data to transmit to the other party.<br>
<br>
@raise socket.error: If a socket error occurs.</tt></dd></dl>
<dl><dt><a name="TLSConnection-writeAsync"><strong>writeAsync</strong></a>(self, s)</dt><dd><tt>Start a write operation on the TLS connection.<br>
<br>
This function returns a generator which behaves similarly to<br>
<a href="#TLSConnection-write">write</a>(). Successive invocations of the generator will return<br>
1 if it is waiting to write to the socket, or will raise<br>
StopIteration if the write operation has completed.<br>
<br>
@rtype: iterable<br>
@return: A generator; see above for details.</tt></dd></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-sha1"><strong>sha1</strong></a> = openssl_sha1(...)</dt><dd><tt>Returns a sha1 hash object; optionally initialized with a string</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>cryptlibpyLoaded</strong> = False<br>
<strong>generators</strong> = _Feature((2, 2, 0, 'alpha', 1), (2, 3, 0, 'final', 0), 0)<br>
<strong>gmpyLoaded</strong> = False<br>
<strong>goodGroupParameters</strong> = [(2, 167609434410335061...389658897350067939L), (2, 148699818592312829...022696100064262587L), (2, 217661744586174357...299250924469288819L), (2, 580960599536995806...769998514148343807L), (5, 104438888141315250...045385534758453247L), (5, 337515218214385611...109988915707117567L), (5, 109074813561941592...353154294858383359L)]<br>
<strong>m2cryptoLoaded</strong> = False<br>
<strong>prngName</strong> = 'os.urandom'<br>
<strong>pycryptoLoaded</strong> = True<br>
<strong>sieve</strong> = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ...]</td></tr></table>
</body></html>
|