Skip to content

Commit

Permalink
TLSv1.2 versions of DoubleExtension probe
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Aug 27, 2016
1 parent 4a7d7cf commit b84adab
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
4 changes: 3 additions & 1 deletion prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@
OCSPUnderflow(),
OCSPUnderflow12(),
OCSPUnderflow12PFS(),
DoubleExtension()
DoubleExtension(),
DoubleExtension12(),
DoubleExtension12PFS()
]

def probe(ipaddress, port, starttls, specified_probe):
Expand Down
10 changes: 10 additions & 0 deletions probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1372,3 +1372,13 @@ def test(self, sock):
# correct Client Hello messages must not contain two extensions
# of the same type
sock.write(self.make_double_ext_hello())


class DoubleExtension12(DoubleExtension, NormalHandshake12):
'''Duplicate secure renegotiation extension in TLSv1.2 hello'''
pass


class DoubleExtension12PFS(DoubleExtension, NormalHandshake12PFS):
'''Duplicate secure renegotiation extension in PFS TLSv1.2 hello'''
pass
47 changes: 47 additions & 0 deletions tests/test_probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2236,3 +2236,50 @@ def test_test(self):
b'\x00'
b'\xff\x01\x00\x01'
b'\x00'])


class TestDoubleExtension12(unittest.TestCase):
def test_test(self):
probe = DoubleExtension12()
sock = MockSock()

probe.test(sock)

self.assertEqual(sock.sent_data,
[b'\x16\x03\x01\x00]'
b'\x01\x00\x00Y'
b'\x03\x03' +
RANDOM_STR +
b'\x00'
b'\x00&' +
DEFAULT_12_CIPHERS_STR +
b'\x01\x00'
b'\x00\x0a'
b'\xff\x01\x00\x01'
b'\x00'
b'\xff\x01\x00\x01'
b'\x00'])


class TestDoubleExtension12PFS(unittest.TestCase):
def test_test(self):
probe = DoubleExtension12PFS()
sock = MockSock()

probe.test(sock)

self.maxDiff = None
self.assertEqual(sock.sent_data,
[b"\x16\x03\x01\x00\x95"
b"\x01\x00\x00\x91"
b"\x03\x03" +
RANDOM_STR +
b"\x00"
b"\x00^" +
DEFAULT_PFS_CIPHERS_STR +
b"\x01\x00"
b'\x00\x0a'
b'\xff\x01\x00\x01'
b'\x00'
b'\xff\x01\x00\x01'
b'\x00'])

0 comments on commit b84adab

Please sign in to comment.