Skip to content

Commit

Permalink
Merge 782b05f into ed727a7
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Dec 4, 2019
2 parents ed727a7 + 782b05f commit eb0992e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/tlstest.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,25 @@ def connect():

test_no += 1

print("Test {0} - good mutual X.509, PHA and KeyUpdate, TLSv1.3".format(test_no))
synchro.recv(1)
connection = connect()
settings = HandshakeSettings()
settings.minVersion = (3, 4)
settings.maxVersion = (3, 4)
connection.handshakeClientCert(x509Chain, x509Key, settings=settings)
synchro.recv(1)
for result in connection.send_keyupdate_request(
KeyUpdateMessageType.update_requested):
assert result in (0, 1)
b = connection.read(0, 0)
assert b == b''
testConnClient(connection)
assert(isinstance(connection.session.serverCertChain, X509CertChain))
connection.close()

test_no += 1

print("Test {0} - mutual X.509, PHA, no client cert, TLSv1.3".format(test_no))
synchro.recv(1)
connection = connect()
Expand Down Expand Up @@ -1995,6 +2014,26 @@ def connect():

test_no += 1

print("Test {0} - good mutual X.509, PHA and KeyUpdate, TLSv1.3".format(test_no))
synchro.send(b'R')
connection = connect()
settings = HandshakeSettings()
settings.minVersion = (3, 4)
settings.maxVersion = (3, 4)
connection.handshakeServer(certChain=x509Chain, privateKey=x509Key,
settings=settings)
assert connection.session.clientCertChain is None
for result in connection.request_post_handshake_auth(settings):
assert result in (0, 1)
synchro.send(b'R')
testConnServer(connection)

assert connection.session.clientCertChain is not None
assert isinstance(connection.session.clientCertChain, X509CertChain)
connection.close()

test_no += 1

print("Test {0} - mutual X.509, PHA, no client cert, TLSv1.3".format(test_no))
synchro.send(b'R')
connection = connect()
Expand Down
3 changes: 3 additions & 0 deletions tlslite/tlsrecordlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ def readAsync(self, max=None, min=1):
elif isinstance(result, KeyUpdate):
for result in self._handle_keyupdate_request(result):
yield result
# KeyUpdate messages are not solicited, while call with
# min==0 are done to perform PHA
try_once = True
elif isinstance(result, Certificate):
for result in self._handle_srv_pha(result):
yield result
Expand Down

0 comments on commit eb0992e

Please sign in to comment.