(self, ui_websocket)
| 91 | assert ui_websocket.ws.getResult() == "hello" |
| 92 | |
| 93 | def testAes(self, ui_websocket): |
| 94 | ui_websocket.actionAesEncrypt(0, "hello") |
| 95 | key, iv, encrypted = ui_websocket.ws.getResult() |
| 96 | |
| 97 | assert len(key) == 44 |
| 98 | assert len(iv) == 24 |
| 99 | assert len(encrypted) == 24 |
| 100 | |
| 101 | # Single decrypt |
| 102 | ui_websocket.actionAesDecrypt(0, iv, encrypted, key) |
| 103 | assert ui_websocket.ws.getResult() == "hello" |
| 104 | |
| 105 | # Batch decrypt |
| 106 | ui_websocket.actionAesEncrypt(0, "hello") |
| 107 | key2, iv2, encrypted2 = ui_websocket.ws.getResult() |
| 108 | |
| 109 | assert [key, iv, encrypted] != [key2, iv2, encrypted2] |
| 110 | |
| 111 | # 2 correct key |
| 112 | ui_websocket.actionAesDecrypt(0, [[iv, encrypted], [iv, encrypted], [iv, "baad"], [iv2, encrypted2]], [key]) |
| 113 | assert ui_websocket.ws.getResult() == ["hello", "hello", None, None] |
| 114 | |
| 115 | # 3 key |
| 116 | ui_websocket.actionAesDecrypt(0, [[iv, encrypted], [iv, encrypted], [iv, "baad"], [iv2, encrypted2]], [key, key2]) |
| 117 | assert ui_websocket.ws.getResult() == ["hello", "hello", None, "hello"] |
| 118 | |
| 119 | def testAesUtf8(self, ui_websocket): |
| 120 | ui_websocket.actionAesEncrypt(0, self.utf8_text) |
nothing calls this directly
no test coverage detected