From a78291b2a3140f8a1910c1653acd06764bee4b12 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Fri, 25 Oct 2019 22:06:44 -0700 Subject: [PATCH] include the program used to generate the handshake message lengths array.. --- makemessagelengths.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 makemessagelengths.py diff --git a/makemessagelengths.py b/makemessagelengths.py new file mode 100644 index 0000000..c8e103b --- /dev/null +++ b/makemessagelengths.py @@ -0,0 +1,35 @@ +from twistednoise import genkeypair +from noise.connection import NoiseConnection, Keypair + +server_key_pair = genkeypair() +client_key_pair = genkeypair() + +init = NoiseConnection.from_name(b'Noise_XK_448_ChaChaPoly_SHA256') +init.set_as_initiator() + +init.set_keypair_from_private_bytes(Keypair.STATIC, client_key_pair[1]) +init.set_keypair_from_public_bytes(Keypair.REMOTE_STATIC, server_key_pair[0]) + +resp = NoiseConnection.from_name(b'Noise_XK_448_ChaChaPoly_SHA256') +resp.set_as_responder() + +resp.set_keypair_from_private_bytes(Keypair.STATIC, server_key_pair[1]) + +init.start_handshake() +resp.start_handshake() + +messages = [] + +cursend, currecv = init, resp +while not init.handshake_finished and not resp.handshake_finished: + # send a message + msg = cursend.write_message() + currecv.read_message(msg) + + # record it + messages.append(msg) + + # swap roles + cursend, currecv = currecv, cursend + +print(list(map(len, messages)))