Skip to content

Update to use from pycryptodome AES instead of pycrpto version as CCM…#20

Open
felimwhiteley wants to merge 1 commit intoasmw:masterfrom
felimwhiteley:patch-1
Open

Update to use from pycryptodome AES instead of pycrpto version as CCM…#20
felimwhiteley wants to merge 1 commit intoasmw:masterfrom
felimwhiteley:patch-1

Conversation

@felimwhiteley
Copy link

… is no longer present

As python3-pycryptodome was already part of the install dependencies it seems maybe this was forgotten or python 3.8 on Ubuntu 20.04 based distros caused it to break.

Otherwise it throws a

module 'Crypto.Cipher.AES' has no attribute 'MODE_GCM'

Error and exits after the password is entered.

… is no longer present

As python3-pycryptodome was already part of the install dependencies it seems maybe this was forgotten or python 3.8 on Ubuntu 20.04 based distros caused it to break.

Otherwise it throws a 

 module 'Crypto.Cipher.AES' has no attribute 'MODE_GCM'

Error and exits after the password is entered.
@asmw
Copy link
Owner

asmw commented Nov 2, 2021

Hmm, the main branch works fine for me on Ubuntu 21.10. When I merge this the tests fail:

ImportError while importing test module '/home/asmw/src/andOTP-decrypt/tests/test_andotp.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_andotp.py:2: in <module>
    import andotp_decrypt as ad
andotp_decrypt.py:21: in <module>
    from Cryptodome.Cipher import AES
E   ModuleNotFoundError: No module named 'Cryptodome'

@asmw
Copy link
Owner

asmw commented Nov 2, 2021

Looking at the examples (https://www.pycryptodome.org/en/latest/src/examples.html#encrypt-data-with-aes), pycryptodome provides the Crypto module

@felimwhiteley
Copy link
Author

Sorry had missed your replies. It's a weird one, but I've seen various bits about the web about the MODE_GCM going away with later python versions, here's one example;

https://stackoverflow.com/questions/43987779/python-module-crypto-cipher-aes-has-no-attribute-mode-ccm-even-though-pycry

I'm using KDE Neon, the base system is Ubuntu 20.04 and I have Python 3.8.10 as part of that. And once I made my change I could just run the decrypt script on it's own (once installed the deps you have for debian systems) and I managed to decrypt the andOTP backup perfectly. I didn't use pip and the requirements.

@asmw
Copy link
Owner

asmw commented Nov 5, 2021

I have no idea. I guess it might be a precedence issue with PyCrypto and PyCryptodome? As I wrote, the version in the patch does not work for me.
We could try the Crypto import first and fall-back to the Cryptodome?
I wonder why it says No module named 'Cryptodome' here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants