| 13 | @pytest.mark.parametrize("text", [b"hello", '\xc1rv\xedzt\xfbr\xf5t\xfck\xf6rf\xfar\xf3g\xe9'.encode("utf8")]) |
| 14 | @pytest.mark.parametrize("text_repeat", [1, 10, 128, 1024]) |
| 15 | def testEncryptEcies(self, text, text_repeat): |
| 16 | text_repeated = text * text_repeat |
| 17 | aes_key, encrypted = CryptMessage.eciesEncrypt(text_repeated, self.publickey) |
| 18 | assert len(aes_key) == 32 |
| 19 | # assert len(encrypted) == 134 + int(len(text) / 16) * 16 # Not always true |
| 20 | |
| 21 | ecc = CryptMessage.getEcc(self.privatekey) |
| 22 | assert ecc.decrypt(encrypted) == text_repeated |
| 23 | |
| 24 | def testDecryptEcies(self, user): |
| 25 | encrypted = base64.b64decode(self.ecies_encrypted_text) |