Exemplo n.º 1
0
def client_handshake_finish(client_priv, secret, challenge):
    """
    Sign the challenge from the server's handshake response
    :param client_priv:
    :param secret:
    :param challenge:
    :return:
    """
    pubkeyhash = identity.pubkeyhash(client_priv.get_verifying_key())
    plaintext = aes_decrypt_str(secret, challenge["iv"], challenge["challenge"])
    signature = identity.sign_string(client_priv, plaintext)
    return {"signature": signature,
            "fingerprint": pubkeyhash
            }
Exemplo n.º 2
0
    def POST(self):
        clean_sessions()

        postdata = web.data()
        request = json.loads(postdata)

        server_secret, gotpub, challenge, challenge_plain = null_proto.server_handshake_begin(PRIVKEY, request)

        session = Session()
        session.secret = server_secret
        session.pubkey = gotpub
        session.challenge_plain = challenge_plain
        pubhash = identity.pubkeyhash(gotpub)

        with session_lock:
            pending_sessions[pubhash] = session

        return json.dumps(challenge)