Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

2 participants