clach04 / EncScite

SciTE with encryption/decryption support
GNU Lesser General Public License v2.1
0 stars 0 forks source link

crypto issues with py2exe and pycryptodome #2

Closed clach04 closed 10 months ago

clach04 commented 10 months ago

At runtime see:

C:\>C:\code\py\EncScite\puren_tonbo\dist\prog\ptig.exe
Traceback (most recent call last):
  File "ptig.py", line 29, in <module>
  File "puren_tonbo\__init__.pyo", line 70, in <module>
  File "openssl_enc_compat\cipher.pyo", line 28, in <module>
  File "Crypto\Cipher\__init__.pyo", line 27, in <module>
  File "Crypto\Cipher\_mode_ecb.pyo", line 47, in <module>
  File "Crypto\Util\_raw_api.pyo", line 315, in load_pycryptodome_raw_lib
OSError: Cannot load native module 'Crypto.Cipher._raw_ecb': Not found '_raw_ecb.pyd'

py2exe Version 0.10.2.0:

New hooks for pycryptodome and shapely.

Do not have issues with older Python 2.7.x, unknown (probably newer) version of py2exe and PyCrypto (no longer supported/maintained).

Ideas

clach04 commented 10 months ago

Dirty experiment:

pip uninstall pycryptodome :: no compiler. so prebuilts from https://web.archive.org/web/20200427093214/http://www.voidspace.org.uk/python/modules.shtml#pycrypto echo install old pycrypto bins 🤮

Works

TODO check into py2exe hooks added for pycryptodome.

clach04 commented 10 months ago

https://github.com/py2exe/py2exe/commit/7dbef282372b3b0489f038c3b019272313b44dfd

https://github.com/py2exe/py2exe/blob/master/py2exe/hooks.py

clach04 commented 10 months ago

PyCrypto (todo Cryptodome again):

testimport_cli

from Crypto.Cipher import AES

build then run:

> dist\prog\testimport_cli.exe
Traceback (most recent call last):
  File "testimport_cli.py", line 1, in <module>
  File "Crypto\Cipher\__init__.pyo", line 27, in <module>
ImportError: No module named _mode_ecb

no files with mode_ecb in dist (or PyCrypto site packages).

__init__.py only contains __all__ list of strings (and __revision__).

clach04 commented 10 months ago

Setting "optimize": 0 to appears to fix this. To be continued....