OLD | NEW |
1 # Authors: | 1 # Authors: |
2 # Trevor Perrin | 2 # Trevor Perrin |
3 # Google - handling CertificateRequest.certificate_types | 3 # Google - handling CertificateRequest.certificate_types |
4 # Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support | 4 # Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support |
5 # Dimitris Moraitis - Anon ciphersuites | 5 # Dimitris Moraitis - Anon ciphersuites |
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 """Classes representing TLS messages.""" | 9 """Classes representing TLS messages.""" |
10 | 10 |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 447 |
448 def write(self): | 448 def write(self): |
449 w = Writer() | 449 w = Writer() |
450 w.add(CertificateStatusType.ocsp, 1) | 450 w.add(CertificateStatusType.ocsp, 1) |
451 w.addVarSeq(bytearray(self.ocsp_response), 1, 3) | 451 w.addVarSeq(bytearray(self.ocsp_response), 1, 3) |
452 return self.postWrite(w) | 452 return self.postWrite(w) |
453 | 453 |
454 class CertificateRequest(HandshakeMsg): | 454 class CertificateRequest(HandshakeMsg): |
455 def __init__(self): | 455 def __init__(self): |
456 HandshakeMsg.__init__(self, HandshakeType.certificate_request) | 456 HandshakeMsg.__init__(self, HandshakeType.certificate_request) |
457 #Apple's Secure Transport library rejects empty certificate_types, so | 457 self.certificate_types = [] |
458 #default to rsa_sign. | |
459 self.certificate_types = [ClientCertificateType.rsa_sign] | |
460 self.certificate_authorities = [] | 458 self.certificate_authorities = [] |
461 | 459 |
462 def create(self, certificate_types, certificate_authorities): | 460 def create(self, certificate_types, certificate_authorities): |
463 self.certificate_types = certificate_types | 461 self.certificate_types = certificate_types |
464 self.certificate_authorities = certificate_authorities | 462 self.certificate_authorities = certificate_authorities |
465 return self | 463 return self |
466 | 464 |
467 def parse(self, p): | 465 def parse(self, p): |
468 p.startLengthCheck(3) | 466 p.startLengthCheck(3) |
469 self.certificate_types = p.getVarList(1, 1) | 467 self.certificate_types = p.getVarList(1, 1) |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 newMsg = ApplicationData().create(self.bytes[:1]) | 754 newMsg = ApplicationData().create(self.bytes[:1]) |
757 self.bytes = self.bytes[1:] | 755 self.bytes = self.bytes[1:] |
758 return newMsg | 756 return newMsg |
759 | 757 |
760 def parse(self, p): | 758 def parse(self, p): |
761 self.bytes = p.bytes | 759 self.bytes = p.bytes |
762 return self | 760 return self |
763 | 761 |
764 def write(self): | 762 def write(self): |
765 return self.bytes | 763 return self.bytes |
OLD | NEW |