OLD | NEW |
(Empty) | |
| 1 diff --git a/third_party/tlslite/tlslite/messages.py b/third_party/tlslite/tlsli
te/messages.py |
| 2 index e1be195..65170de 100644 |
| 3 --- a/third_party/tlslite/tlslite/messages.py |
| 4 +++ b/third_party/tlslite/tlslite/messages.py |
| 5 @@ -460,7 +460,8 @@ class CertificateRequest(HandshakeMsg): |
| 6 self.version = version |
| 7 self.supported_signature_algs = [] |
| 8 |
| 9 - def create(self, certificate_types, certificate_authorities, sig_algs=()): |
| 10 + def create(self, certificate_types, certificate_authorities, |
| 11 + sig_algs=((HashAlgorithm.sha256, SignatureAlgorithm.rsa),)): |
| 12 self.certificate_types = certificate_types |
| 13 self.certificate_authorities = certificate_authorities |
| 14 self.supported_signature_algs = sig_algs |
| 15 @@ -470,7 +471,8 @@ class CertificateRequest(HandshakeMsg): |
| 16 p.startLengthCheck(3) |
| 17 self.certificate_types = p.getVarList(1, 1) |
| 18 if self.version >= (3,3): |
| 19 - self.supported_signature_algs = p.getVarList(2, 2) |
| 20 + self.supported_signature_algs = \ |
| 21 + [(b >> 8, b & 0xff) for b in p.getVarList(2, 2)] |
| 22 ca_list_length = p.get(2) |
| 23 index = 0 |
| 24 self.certificate_authorities = [] |
| 25 @@ -485,7 +487,10 @@ class CertificateRequest(HandshakeMsg): |
| 26 w = Writer() |
| 27 w.addVarSeq(self.certificate_types, 1, 1) |
| 28 if self.version >= (3,3): |
| 29 - w.addVarSeq(self.supported_signature_algs, 2, 2) |
| 30 + w.add(2 * len(self.supported_signature_algs), 2) |
| 31 + for (hash, signature) in self.supported_signature_algs: |
| 32 + w.add(hash, 1) |
| 33 + w.add(signature, 1) |
| 34 caLength = 0 |
| 35 #determine length |
| 36 for ca_dn in self.certificate_authorities: |
| 37 @@ -647,6 +652,7 @@ class ClientKeyExchange(HandshakeMsg): |
| 38 |
| 39 class CertificateVerify(HandshakeMsg): |
| 40 def __init__(self): |
| 41 + # TODO: This does not handle the SignatureAlgorithm in TLS 1.2. |
| 42 HandshakeMsg.__init__(self, HandshakeType.certificate_verify) |
| 43 self.signature = bytearray(0) |
| 44 |
| 45 diff --git a/third_party/tlslite/tlslite/tlsconnection.py b/third_party/tlslite/
tlslite/tlsconnection.py |
| 46 index cb743fe..65f8d67 100644 |
| 47 --- a/third_party/tlslite/tlslite/tlsconnection.py |
| 48 +++ b/third_party/tlslite/tlslite/tlsconnection.py |
| 49 @@ -966,6 +966,7 @@ class TLSConnection(TLSRecordLayer): |
| 50 verifyBytes = self._handshake_md5.digest() + \ |
| 51 self._handshake_sha.digest() |
| 52 elif self.version == (3,3): |
| 53 + # TODO: This does not handle the PKCS#1 prefix in TLS 1.2. |
| 54 verifyBytes = self._handshake_sha256.digest() |
| 55 if self.fault == Fault.badVerifyMessage: |
| 56 verifyBytes[0] = ((verifyBytes[0]+1) % 256) |
OLD | NEW |