MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / testEciesAes

Method testEciesAes

plugins/CryptMessage/Test/TestCrypt.py:79–91  ·  view source on GitHub ↗
(self, ui_websocket)

Source from the content-addressed store, hash-verified

77 assert ui_websocket.ws.getResult() == self.utf8_text
78
79 def testEciesAes(self, ui_websocket):
80 ui_websocket.actionEciesEncrypt(0, "hello", return_aes_key=True)
81 ecies_encrypted, aes_key = ui_websocket.ws.getResult()
82
83 # Decrypt using Ecies
84 ui_websocket.actionEciesDecrypt(0, ecies_encrypted)
85 assert ui_websocket.ws.getResult() == "hello"
86
87 # Decrypt using AES
88 aes_iv, aes_encrypted = CryptMessage.split(base64.b64decode(ecies_encrypted))
89
90 ui_websocket.actionAesDecrypt(0, base64.b64encode(aes_iv), base64.b64encode(aes_encrypted), aes_key)
91 assert ui_websocket.ws.getResult() == "hello"
92
93 def testAes(self, ui_websocket):
94 ui_websocket.actionAesEncrypt(0, "hello")

Callers

nothing calls this directly

Calls 4

actionEciesEncryptMethod · 0.80
getResultMethod · 0.80
actionEciesDecryptMethod · 0.80
actionAesDecryptMethod · 0.80

Tested by

no test coverage detected