OLD | NEW |
1 """Classes representing TLS messages.""" | 1 """Classes representing TLS messages.""" |
2 | 2 |
3 from utils.compat import * | 3 from utils.compat import * |
4 from utils.cryptomath import * | 4 from utils.cryptomath import * |
5 from errors import * | 5 from errors import * |
6 from utils.codec import * | 6 from utils.codec import * |
7 from constants import * | 7 from constants import * |
8 from X509 import X509 | 8 from X509 import X509 |
9 from X509CertChain import X509CertChain | 9 from X509CertChain import X509CertChain |
10 | 10 |
11 import sha | 11 # The sha module is deprecated in Python 2.6 |
12 import md5 | 12 try: |
| 13 import sha |
| 14 except ImportError: |
| 15 from hashlib import sha1 as sha |
| 16 |
| 17 # The md5 module is deprecated in Python 2.6 |
| 18 try: |
| 19 import md5 |
| 20 except ImportError: |
| 21 from hashlib import md5 |
13 | 22 |
14 class RecordHeader3: | 23 class RecordHeader3: |
15 def __init__(self): | 24 def __init__(self): |
16 self.type = 0 | 25 self.type = 0 |
17 self.version = (0,0) | 26 self.version = (0,0) |
18 self.length = 0 | 27 self.length = 0 |
19 self.ssl2 = False | 28 self.ssl2 = False |
20 | 29 |
21 def create(self, version, type, length): | 30 def create(self, version, type, length): |
22 self.type = type | 31 self.type = type |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 def create(self, bytes): | 561 def create(self, bytes): |
553 self.bytes = bytes | 562 self.bytes = bytes |
554 return self | 563 return self |
555 | 564 |
556 def parse(self, p): | 565 def parse(self, p): |
557 self.bytes = p.bytes | 566 self.bytes = p.bytes |
558 return self | 567 return self |
559 | 568 |
560 def write(self): | 569 def write(self): |
561 return self.bytes | 570 return self.bytes |
OLD | NEW |