| |
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html><head><title>Python: module gdata.tlslite.TLSRecordLayer</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>.TLSRecordLayer</strong></big></big></font></td |
| ><td align=right valign=bottom |
| ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/tlslite/TLSRecordLayer.py">/usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/tlslite/TLSRecordLayer.py</a></font></td></tr></table> |
| <p><tt>Helper class for TLSConnection.</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> |
| <a href="binascii.html">binascii</a><br> |
| </td><td width="25%" valign=top><a href="errno.html">errno</a><br> |
| <a href="gdata.tlslite.utils.hmac.html">gdata.tlslite.utils.hmac</a><br> |
| <a href="math.html">math</a><br> |
| <a href="md5.html">md5</a><br> |
| </td><td width="25%" valign=top><a href="os.html">os</a><br> |
| <a href="sha.html">sha</a><br> |
| <a href="socket.html">socket</a><br> |
| <a href="sys.html">sys</a><br> |
| </td><td width="25%" valign=top><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">TLSRecordLayer</a> |
| </font></dt></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="TLSRecordLayer">class <strong>TLSRecordLayer</strong></a></font></td></tr> |
| |
| <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td> |
| <td colspan=2><tt>This class handles data transmission for a TLS connection.<br> |
| <br> |
| Its only subclass is L{tlslite.TLSConnection.TLSConnection}. We've<br> |
| separated the code in this class from TLSConnection to make things<br> |
| more readable.<br> |
| <br> |
| <br> |
| @type sock: socket.socket<br> |
| @ivar sock: The underlying socket object.<br> |
| <br> |
| @type session: L{tlslite.Session.Session}<br> |
| @ivar session: The session corresponding to this connection.<br> |
| <br> |
| Due to TLS session resumption, multiple connections can correspond<br> |
| to the same underlying session.<br> |
| <br> |
| @type version: tuple<br> |
| @ivar version: The TLS version being used for this connection.<br> |
| <br> |
| (3,0) means SSL 3.0, and (3,1) means TLS 1.0.<br> |
| <br> |
| @type closed: bool<br> |
| @ivar closed: If this connection is closed.<br> |
| <br> |
| @type resumed: bool<br> |
| @ivar resumed: If this connection is based on a resumed session.<br> |
| <br> |
| @type allegedSharedKeyUsername: str or None<br> |
| @ivar allegedSharedKeyUsername: This is set to the shared-key<br> |
| username asserted by the client, whether the handshake succeeded or<br> |
| not. If the handshake fails, this can be inspected to<br> |
| determine if a guessing attack is in progress against a particular<br> |
| user account.<br> |
| <br> |
| @type allegedSrpUsername: str or None<br> |
| @ivar allegedSrpUsername: This is set to the SRP username<br> |
| asserted by the client, whether the handshake succeeded or not.<br> |
| If the handshake fails, this can be inspected to determine<br> |
| if a guessing attack is in progress against a particular user<br> |
| account.<br> |
| <br> |
| @type closeSocket: bool<br> |
| @ivar closeSocket: If the socket should be closed when the<br> |
| connection is closed (writable).<br> |
| <br> |
| If you set this to True, TLS Lite will assume the responsibility of<br> |
| closing the socket when the TLS Connection is shutdown (either<br> |
| through an error or through the user calling <a href="#TLSRecordLayer-close">close</a>()). The default<br> |
| is False.<br> |
| <br> |
| @type ignoreAbruptClose: bool<br> |
| @ivar ignoreAbruptClose: If an abrupt close of the socket should<br> |
| raise an error (writable).<br> |
| <br> |
| If you set this to True, TLS Lite will not raise a<br> |
| L{tlslite.errors.TLSAbruptCloseError} exception if the underlying<br> |
| socket is unexpectedly closed. Such an unexpected closure could be<br> |
| caused by an attacker. However, it also occurs with some incorrect<br> |
| TLS implementations.<br> |
| <br> |
| You should set this to True only if you're not worried about an<br> |
| attacker truncating the connection, and only if necessary to avoid<br> |
| spurious errors. The default is False.<br> |
| <br> |
| @sort: __init__, read, readAsync, write, writeAsync, close, closeAsync,<br> |
| getCipherImplementation, getCipherName<br> </tt></td></tr> |
| <tr><td> </td> |
| <td width="100%">Methods defined here:<br> |
| <dl><dt><a name="TLSRecordLayer-__init__"><strong>__init__</strong></a>(self, sock)</dt></dl> |
| |
| <dl><dt><a name="TLSRecordLayer-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="#TLSRecordLayer-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="TLSRecordLayer-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="#TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-getsockname"><strong>getsockname</strong></a>(self)</dt><dd><tt>Return the socket's own address (socket emulation).</tt></dd></dl> |
| |
| <dl><dt><a name="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="#TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="TLSRecordLayer-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="#TLSRecordLayer-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> |