-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Enabling SSL for python3.5 using crystax #705
Comments
There is a python3 section somewhere in the docs that explains the need to use crystax. You could add further instructions here. Do you know how to add openssl, using the crystax build scripts to recompile python but compiling openssl first? If not, I can give some information about this (another user pointed it out to me recently - unless that was you?), but it needs some manual hacking of p4a builds right now. I think the real problem is that crystax's build process currently doesn't build openssl binaries (see https://groups.google.com/forum/#!topic/crystax-ndk/x2LXh3egRuM), but apparently will do so in the next release. I'd guess they'll also compile python against it at that point, so I've been leaving this problem partly to wait for that, though the openssl recipe will need modifying to load openssl differently in this case (rather than compiling it internally). |
Well their I guess that it would be possible to make a Maybe it is possible to just tweak the python-crystax recipe to copy over, and recompile if openssl is in the build order... hmmmmm.. |
Hello, are there any news about this issue since last year? It seems that CystaxNDK had a new release, but still without OpenSSL support. Is there a way we can manually add this to Kivy/P4A? Right now it all works nicely with Python3, but the lack of HTTPS kinda makes any serious app impossible to deploy :-/ I'd be happy to test potential patches/solutions that made this happen. Thank you! |
@mgc8 This is currently a priority for me, having mostly got through some of the major other things. I don't know when we will support it though. You can probably manually add it to p4a by working out the steps that p4a itself needs to take to add openssl support. I think it should work to build openssl with crystax (it has a script for this), then build python with CrystaX (it automatically locates the openssl build). |
@inclement thank you for looking into this, I will then attempt to dig deeper into the build process for CrystaX to see how best to add it. If you have any update on official support or a testing version please let me know. |
Hello, is there now a working solution to this? |
I am stuck with same issue here. Gone all the way around from python 3.5 to 2.7 back to 3.5 in order to be able to use https in urlrequest. stuck at HTTPSConnection' is not defined with requirements = kivy, python3crystax,openssl |
There is a pull request that allows building ssl with crystax, the code hasn't been merged because it really needs a refactor, but a few projects are using it, so it could help you. #1217 you should be able to use it either by telling buildozer to use that branch, or by copying the recipes in your local_recipes directory (also defined in buildozer.spec). |
Thanks @tshirtman My application happily runs with https in the kivy launcher. Any hints on how ssl has been baked into it ? Is there any possibility I could do the same for an converting my application into an apk with ssl support ? what dependencies and specs are used ? Many Thanks. JCG |
I'm pretty sure the kivy launcher runs python2, which should have no issue with ssl, this issue is specifically about the python3crystax build. |
I was unlucky with python2 ssl then. After more than a week of trying maybe my environment is so deeply corrupted that is helpless. I need to try again with the stock VM provided. Though it does not work verbatim out of the box. I had compiling problems as well. Probably will stay put for a while. I need to build a MVP of my application. It rather be without SSL that no MVP with SSL.....I need a fresh mind to look at this again. |
Also trying really hard to get this to work. Using armeabi-v7a with API 19 (default), arm64-v8a not availible with API 19. If anybody could point me in the right direction I'd be really grateful. Not sure if this is the right place to post this though |
SSL is not supported in python3. If you want to use SSL, you need to move your apk to python 2.7...... I have done extensive research and tests on this. There are comments somewhere where they say is possible.. I failed finding the evidence. It eventually resumes to Crystax not currently supporting ssl out of the box. There are claims that can be manually compile with SSL. I never found instructions clear enough for me to implement it. |
Rewriting the whole application to 2.7 would be too much work. But thanks for your reply. Will try from scratch in a new environment to compile the Electrum app, and I suppose also ask on a different issue. Will let you know if I make any progress. |
@Davincible yes Electrum has it working and I'm also having it working here https://github.com/AndreMiras/EtherollApp/tree/v20180617/src/python-for-android/recipes/python3crystax using the method described by Electrum. |
@AndreMiras Do you also get the many 'hashtype not supported' warnings upon running the apk through logcat? |
Yes I do, here's the extract:
|
@AndreMiras Mine look exactly the same, Do you know if these errors are important (to the ssl functionality), or will ssl will work just fine even with these errors? |
@Davincible I don't think these errors are important, they seem to arise from an internal import check and probably should be taken as info/warnings. Although not explicitly logged, other hashes do work okay, and I don't think these ones are essential. |
Yes I confirm it doesn't cause any trouble to my apps. |
Closing as the crystax build is obseleted by the new python3 recipe. |
Wait we don't need to use crystax anymore? That's exciting |
Yep, we now support python3.7 using the normal google NDK. |
Hi
I have just spend a full day solving a problem with accessing HTTPS sites on android. I finally figured out the problem:
Almost all http libraries in python relies on the ssl.py module in the standard library. This module is uses a C-extension
_ssl.so
that must be "baked in" with the cpython interpreter at compilation.The crystax android ndk however does not do this by default however, and so reaching any https site is not possible. For the novice programmer it is, in no way obvious why ssl.py cannot be imported, so I would propose that somewhere in the documentation, it is described how to recompile the crystax python interpreter with ssl support from the crystax-ndk.
I would gladly write this, but where would it be appropriate to put it in the docs?
Regards
Emil Lynge
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: