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 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 else: | 339 else: |
340 bytes = createByteArraySequence([]) | 340 bytes = createByteArraySequence([]) |
341 w.addVarSeq(bytes, 1, 2) | 341 w.addVarSeq(bytes, 1, 2) |
342 else: | 342 else: |
343 raise AssertionError() | 343 raise AssertionError() |
344 return HandshakeMsg.postWrite(self, w, trial) | 344 return HandshakeMsg.postWrite(self, w, trial) |
345 | 345 |
346 class CertificateRequest(HandshakeMsg): | 346 class CertificateRequest(HandshakeMsg): |
347 def __init__(self): | 347 def __init__(self): |
348 self.contentType = ContentType.handshake | 348 self.contentType = ContentType.handshake |
349 self.certificate_types = [] | 349 #Apple's Secure Transport library rejects empty certificate_types, so |
| 350 #default to rsa_sign. |
| 351 self.certificate_types = [ClientCertificateType.rsa_sign] |
350 self.certificate_authorities = [] | 352 self.certificate_authorities = [] |
351 | 353 |
352 def create(self, certificate_types, certificate_authorities): | 354 def create(self, certificate_types, certificate_authorities): |
353 self.certificate_types = certificate_types | 355 self.certificate_types = certificate_types |
354 self.certificate_authorities = certificate_authorities | 356 self.certificate_authorities = certificate_authorities |
355 return self | 357 return self |
356 | 358 |
357 def parse(self, p): | 359 def parse(self, p): |
358 p.startLengthCheck(3) | 360 p.startLengthCheck(3) |
359 self.certificate_types = p.getVarList(1, 1) | 361 self.certificate_types = p.getVarList(1, 1) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 574 |
573 def create(self, bytes): | 575 def create(self, bytes): |
574 self.bytes = bytes | 576 self.bytes = bytes |
575 return self | 577 return self |
576 | 578 |
577 def parse(self, p): | 579 def parse(self, p): |
578 self.bytes = p.bytes | 580 self.bytes = p.bytes |
579 return self | 581 return self |
580 | 582 |
581 def write(self): | 583 def write(self): |
582 return self.bytes | 584 return self.bytes |
OLD | NEW |