Ejemplo n.º 1
0
    def test_encrypt_short_server(self):
        pair = CryptoPair()
        pair.send.setup(
            INITIAL_CIPHER_SUITE,
            binascii.unhexlify(
                "310281977cb8c1c1c1212d784b2d29e5a6489e23de848d370a5a2f9537f3a100"
            ),
        )

        packet = pair.encrypt_packet(SHORT_SERVER_PLAIN_HEADER,
                                     SHORT_SERVER_PLAIN_PAYLOAD)
        self.assertEqual(packet, SHORT_SERVER_ENCRYPTED_PACKET)
Ejemplo n.º 2
0
    def test_encrypt_chacha20(self):
        pair = CryptoPair()
        pair.send.setup(
            CipherSuite.CHACHA20_POLY1305_SHA256,
            binascii.unhexlify(
                "fcc211ac3ff1f3fe1b096a41e701e30033cbd899494ebabbbc009ee2626d987e"
            ),
        )

        packet = pair.encrypt_packet(CHACHA20_CLIENT_PLAIN_HEADER,
                                     CHACHA20_CLIENT_PLAIN_PAYLOAD)
        self.assertEqual(packet, CHACHA20_CLIENT_ENCRYPTED_PACKET)