kivy / kivy-ios

Toolchain for compiling Python / Kivy / other libraries for iOS
https://kivy.org/docs/guide/packaging-ios.html
MIT License
758 stars 238 forks source link

`cryptography` recipe #733

Open Neizvestnyj opened 1 year ago

Neizvestnyj commented 1 year ago

Request to create an important recipe for the cryptography module

Traceback (most recent call last):
   File "<string>", line 44, in load_module
   File "/Users/neizvestnyj/PycharmProjects/<APP>/ios/test/dist/root/python3/lib/python3.9/imp.py", line 342, in load_dynamic
   File "<frozen importlib._bootstrap>", line 711, in _load
   File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
   File "<frozen importlib._bootstrap>", line 565, in module_from_spec
   File "<frozen importlib._bootstrap_external>", line 1173, in create_module
   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
 ImportError: dynamic module does not define module export function (PyInit_cryptography_hazmat_bindings__rust)

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/Users/neizvestnyj/PycharmProjects/<APP>/ios/test/test-ios/YourApp/main.py", line 5, in <module>
   File "/private/var/containers/Bundle/Application/E3F2D3F4-C2BA-47F1-8750-5469DA73BC9E/test.app/lib/python3.9/site-packages/cryptography/fernet.py", line 14, in <module>
     from cryptography.hazmat.primitives import hashes, padding
   File "/private/var/containers/Bundle/Application/E3F2D3F4-C2BA-47F1-8750-5469DA73BC9E/test.app/lib/python3.9/site-packages/cryptography/hazmat/primitives/padding.py", line 11, in <module>
     from cryptography.hazmat.bindings._rust import (
   File "<string>", line 48, in load_module
   File "/Users/neizvestnyj/PycharmProjects/<APP>/ios/test/dist/root/python3/lib/python3.9/imp.py", line 342, in load_dynamic
 ImportError: dynamic module does not define module export function (PyInit__rust)
from kivy.app import App
from kivy.uix.button import Button
from cryptography.fernet import Fernet

key = Fernet.generate_key()
f = Fernet(key)
token = f.encrypt(b"A really secret message. Not for prying eyes.")
print(f.decrypt(token)) 

class TestApp(App):
    def build(self):
        return Button(text='Hello World')

TestApp().run()
pythonsus commented 1 year ago

there is a pycyprto that might work

pythonsus commented 1 year ago

repice

Neizvestnyj commented 1 year ago

there is a pycyprto that might work

PyCrypto 2.x is unmaintained, obsolete, and contains security vulnerabilities. See https://www.pycrypto.org/ for details. The following is provided for historical/reference purposes only.

Moa-C8 commented 1 year ago

When does this error occur, when launching the program on your computer or on your ios? Can you post your requirements ? do you try hashlib ?