OLD | NEW |
1 """Helper class for TLSConnection.""" | 1 """Helper class for TLSConnection.""" |
2 from __future__ import generators | 2 from __future__ import generators |
3 | 3 |
4 from utils.compat import * | 4 from utils.compat import * |
5 from utils.cryptomath import * | 5 from utils.cryptomath import * |
6 from utils.cipherfactory import createAES, createRC4, createTripleDES | 6 from utils.cipherfactory import createAES, createRC4, createTripleDES |
7 from utils.codec import * | 7 from utils.codec import * |
8 from errors import * | 8 from errors import * |
9 from messages import * | 9 from messages import * |
10 from mathtls import * | 10 from mathtls import * |
11 from constants import * | 11 from constants import * |
12 from utils.cryptomath import getRandomBytes | 12 from utils.cryptomath import getRandomBytes |
13 from utils import hmac | 13 from utils import hmac |
14 from FileObject import FileObject | 14 from fileobject import FileObject |
15 | 15 |
16 # The sha module is deprecated in Python 2.6 | 16 # The sha module is deprecated in Python 2.6 |
17 try: | 17 try: |
18 import sha | 18 import sha |
19 except ImportError: | 19 except ImportError: |
20 from hashlib import sha1 as sha | 20 from hashlib import sha1 as sha |
21 | 21 |
22 # The md5 module is deprecated in Python 2.6 | 22 # The md5 module is deprecated in Python 2.6 |
23 try: | 23 try: |
24 import md5 | 24 import md5 |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1141 |
1142 imac_md5.update(label + masterSecretStr + '\x36'*48) | 1142 imac_md5.update(label + masterSecretStr + '\x36'*48) |
1143 imac_sha.update(label + masterSecretStr + '\x36'*40) | 1143 imac_sha.update(label + masterSecretStr + '\x36'*40) |
1144 | 1144 |
1145 md5Str = md5.md5(masterSecretStr + ('\x5c'*48) + \ | 1145 md5Str = md5.md5(masterSecretStr + ('\x5c'*48) + \ |
1146 imac_md5.digest()).digest() | 1146 imac_md5.digest()).digest() |
1147 shaStr = sha.sha(masterSecretStr + ('\x5c'*40) + \ | 1147 shaStr = sha.sha(masterSecretStr + ('\x5c'*40) + \ |
1148 imac_sha.digest()).digest() | 1148 imac_sha.digest()).digest() |
1149 | 1149 |
1150 return stringToBytes(md5Str + shaStr) | 1150 return stringToBytes(md5Str + shaStr) |
OLD | NEW |