MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / testEncryptEcies

Method testEncryptEcies

plugins/CryptMessage/Test/TestCrypt.py:15–22  ·  view source on GitHub ↗
(self, text, text_repeat)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 1

decryptMethod · 0.80

Tested by

no test coverage detected