OLD | NEW |
1 # Authors: | 1 # Authors: |
2 # Trevor Perrin | 2 # Trevor Perrin |
3 # Google (adapted by Sam Rushing) - NPN support | 3 # Google (adapted by Sam Rushing) - NPN support |
4 # Martin von Loewis - python 3 port | 4 # Martin von Loewis - python 3 port |
5 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2 | 5 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2 |
6 # | 6 # |
7 # See the LICENSE file for legal information regarding use of this file. | 7 # See the LICENSE file for legal information regarding use of this file. |
8 | 8 |
9 """Helper class for TLSConnection.""" | 9 """Helper class for TLSConnection.""" |
10 from __future__ import generators | 10 from __future__ import generators |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 imac_md5.update(compatHMAC(label + masterSecret + bytearray([0x36]*48))) | 1249 imac_md5.update(compatHMAC(label + masterSecret + bytearray([0x36]*48))) |
1250 imac_sha.update(compatHMAC(label + masterSecret + bytearray([0x36]*40))) | 1250 imac_sha.update(compatHMAC(label + masterSecret + bytearray([0x36]*40))) |
1251 | 1251 |
1252 md5Bytes = MD5(masterSecret + bytearray([0x5c]*48) + \ | 1252 md5Bytes = MD5(masterSecret + bytearray([0x5c]*48) + \ |
1253 bytearray(imac_md5.digest())) | 1253 bytearray(imac_md5.digest())) |
1254 shaBytes = SHA1(masterSecret + bytearray([0x5c]*40) + \ | 1254 shaBytes = SHA1(masterSecret + bytearray([0x5c]*40) + \ |
1255 bytearray(imac_sha.digest())) | 1255 bytearray(imac_sha.digest())) |
1256 | 1256 |
1257 return md5Bytes + shaBytes | 1257 return md5Bytes + shaBytes |
1258 | 1258 |
| 1259 def _getHandshakeHash(self): |
| 1260 if self.version in ((3,1), (3,2)): |
| 1261 return self._handshake_md5.digest() + \ |
| 1262 self._handshake_sha.digest() |
| 1263 elif self.version == (3,3): |
| 1264 return self._handshake_sha256.digest() |
OLD | NEW |