def __init__(self, remote: NodeAPI, private_key: datatypes.PrivateKey, reader: asyncio.StreamReader, writer: asyncio.StreamWriter, aes_secret: bytes, mac_secret: bytes, egress_mac: sha3.keccak_256, ingress_mac: sha3.keccak_256) -> None: self.remote = remote self.session = Session(self.remote) self._private_key = private_key # Encryption and Cryptography *stuff* self._egress_mac = egress_mac self._ingress_mac = ingress_mac self._reader = reader self._writer = writer # FIXME: Insecure Encryption: https://github.com/ethereum/devp2p/issues/32 iv = b"\x00" * 16 aes_secret = aes_secret mac_secret = mac_secret aes_cipher = Cipher(algorithms.AES(aes_secret), modes.CTR(iv), default_backend()) self._aes_enc = aes_cipher.encryptor() self._aes_dec = aes_cipher.decryptor() mac_cipher = Cipher(algorithms.AES(mac_secret), modes.ECB(), default_backend()) self._mac_enc = mac_cipher.encryptor().update
def __init__(self, remote: NodeAPI, private_key: datatypes.PrivateKey, reader: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None: self.remote = remote self.session = Session(remote) self._private_key = private_key self._reader = reader self._writer = writer
def __init__(self, remote: NodeAPI, private_key: datatypes.PrivateKey, reader: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None: self.logger = get_logger('p2p.tools.memory_transport.MemoryTransport') self.remote = remote self.session = Session(remote) self._private_key = private_key self._reader = reader self._writer = writer