tlambertz / seedvault_backup_parser

Decrypt, Modify and Reencrypt Seedvault Android Backups
Apache License 2.0
103 stars 15 forks source link

Support alternative Cryptodome import #8

Closed emorrp1 closed 3 years ago

emorrp1 commented 3 years ago

Version: cda9f67 Platform: Debian buster

Changing line 10 to say Cryptodome was enough to fix AttributeError: module 'Crypto.Cipher.AES' has no attribute 'MODE_GCM'. Please consider adding some form of check for supported modes and switching implementation depending on availability.

tlambertz commented 3 years ago

According to https://github.com/Legrandin/pycryptodome, there are two versions of pycryptodome. One which is just a drop-in replacement for pycrypto (with the addition of some modes like MODE_GCM), and one which installs under the module-name Cryptodome. You should be able to just pip install pycryptodome? Or is this a Debian Buster package versioning issue?

emorrp1 commented 3 years ago

Hi, I am just using it from the debian packages, so it sounds like this is the latter of those:

package version project import
python3-crypto 2.6.1-9+b1 http://www.pycrypto.org/ Crypto
python3-cryptography 2.6.1-3+deb10u2 https://cryptography.io/ cryptography
python3-pycryptodome 3.6.1-2+b1 http://www.pycryptodome.org/ Cryptodome

As the next major Debian version is due to be released in a couple of months, I did a quick check that the module import is still Cryptodome. The only difference is that Crypto has been removed entirely, so the error message will become ModuleNotFoundError: No module named 'Crypto' instead - perhaps that makes implementation easier?.

tlambertz commented 3 years ago

It should work now, but I have not tested it on debian.

emorrp1 commented 3 years ago

Thanks, tested and works fine.