| OLD | NEW |
| 1 """ | 1 """ |
| 2 MAIN CLASS FOR TLS LITE (START HERE!). | 2 MAIN CLASS FOR TLS LITE (START HERE!). |
| 3 """ | 3 """ |
| 4 from __future__ import generators | 4 from __future__ import generators |
| 5 | 5 |
| 6 import socket | 6 import socket |
| 7 from utils.compat import formatExceptionTrace | 7 from utils.compat import formatExceptionTrace |
| 8 from TLSRecordLayer import TLSRecordLayer | 8 from tlsrecordlayer import TLSRecordLayer |
| 9 from Session import Session | 9 from session import Session |
| 10 from constants import * | 10 from constants import * |
| 11 from utils.cryptomath import getRandomBytes | 11 from utils.cryptomath import getRandomBytes |
| 12 from errors import * | 12 from errors import * |
| 13 from messages import * | 13 from messages import * |
| 14 from mathtls import * | 14 from mathtls import * |
| 15 from HandshakeSettings import HandshakeSettings | 15 from handshakesettings import HandshakeSettings |
| 16 | 16 |
| 17 | 17 |
| 18 class TLSConnection(TLSRecordLayer): | 18 class TLSConnection(TLSRecordLayer): |
| 19 """ | 19 """ |
| 20 This class wraps a socket and provides TLS handshaking and data | 20 This class wraps a socket and provides TLS handshaking and data |
| 21 transfer. | 21 transfer. |
| 22 | 22 |
| 23 To use this class, create a new instance, passing a connected | 23 To use this class, create a new instance, passing a connected |
| 24 socket into the constructor. Then call some handshake function. | 24 socket into the constructor. Then call some handshake function. |
| 25 If the handshake completes without raising an exception, then a TLS | 25 If the handshake completes without raising an exception, then a TLS |
| (...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 if len(publicKey) < settings.minKeySize: | 1689 if len(publicKey) < settings.minKeySize: |
| 1690 for result in self._sendError(AlertDescription.handshake_failure, | 1690 for result in self._sendError(AlertDescription.handshake_failure, |
| 1691 "Other party's public key too small: %d" % len(publicKey)): | 1691 "Other party's public key too small: %d" % len(publicKey)): |
| 1692 yield result | 1692 yield result |
| 1693 if len(publicKey) > settings.maxKeySize: | 1693 if len(publicKey) > settings.maxKeySize: |
| 1694 for result in self._sendError(AlertDescription.handshake_failure, | 1694 for result in self._sendError(AlertDescription.handshake_failure, |
| 1695 "Other party's public key too large: %d" % len(publicKey)): | 1695 "Other party's public key too large: %d" % len(publicKey)): |
| 1696 yield result | 1696 yield result |
| 1697 | 1697 |
| 1698 yield publicKey, certChain | 1698 yield publicKey, certChain |
| OLD | NEW |