def test_box_truncated(): key = KeyPair('a0c2b2bcb68bbe50b01181bfbcbff28ee00f37e44103d3a591dbae6cd5fb9f6a') box = bytes.fromhex('a63794c4f7033b9c769023f28c12390a7b89296452a4695e35a952625839ae2d9d19715ba2130a6ae49aaf0ea5a' 'b3eacededbb7676724618abb1fe648328086ed253a75d9672540c319114c4891cc6a1356ae7a8f3c9866c704b14' '5efaa0313c9e52f609a4f6c41070ad4741c3ef637e7b7e0a7a7b03a0261607a9') for i in range(len(box)): box_kaput = box[:i] with pytest.raises(NoiseError): decrypt_box(key, box_kaput)
def test_box_truncated(): key = KeyPair( 'a0c2b2bcb68bbe50b01181bfbcbff28ee00f37e44103d3a591dbae6cd5fb9f6a') box = bytes.fromhex( 'a63794c4f7033b9c769023f28c12390a7b89296452a4695e35a952625839ae2d9d19715ba2130a6ae49aaf0ea5a' 'b3eacededbb7676724618abb1fe648328086ed253a75d9672540c319114c4891cc6a1356ae7a8f3c9866c704b14' '5efaa0313c9e52f609a4f6c41070ad4741c3ef637e7b7e0a7a7b03a0261607a9') for i in range(len(box)): box_kaput = box[:i] with pytest.raises(NoiseError): decrypt_box(key, box_kaput)
def test_box_from_go_implementation(plaintext, sender_key, key, box): sender_key = bytes.fromhex(sender_key) key = KeyPair(key) box = bytes.fromhex(box) sender_pubkey, payload = decrypt_box(key, box) assert payload == plaintext if sender_key: assert sender_pubkey == sender_key