in hexforge_modules/crypto_modules.py [0:0]
def _action(self) -> None:
aes_mods_dict = {"CBC": CryptoAES.MODE_CBC, "ECB": CryptoAES.MODE_ECB}
aes_key, aes_iv, aes_mod = self._show(
[item for item in list(aes_mods_dict.keys())]
)
encrypted_data = helper.get_selected_bytes()
if aes_mods_dict[aes_mod] == CryptoAES.MODE_CBC:
cipher = CryptoAES.new(aes_key, aes_mods_dict[aes_mod], aes_iv)
elif aes_mods_dict[aes_mod] == CryptoAES.MODE_ECB:
cipher = CryptoAES.new(aes_key, aes_mods_dict[aes_mod])
if not encrypted_data or not aes_key or not aes_iv:
return None
decrypted_data = cipher.decrypt(encrypted_data)
helper.write_bytes_to_selected(decrypted_data)