0

I have an Android Application that launches Python via JNI. Inside of Python I have web requets that I make, some need to be secure. I can configure the APK to be able to access a User CA certificate, but the problem comes in when trying to make a web request from Python.

If I manually copy the PEM file into my app space and load that, I can make SSL calls in python without a problem, but trying to use the OS installed credentials is where I'm having problems. Is there any way in which I can load or use the certificates that have been installed? I would need to be able to use or access them from the shell.

9
  • If you start python via JNI python is running within the app process? Anyway please note that (app+python) programming questions are better suited on stackoverflow.com. BTW: You can make a virtue out of "necessity" to add your own certificate to python: Just call it root ca/certificate pinning and you have a security feature ;) – Robert Jul 28 '20 at 16:41
  • I've posted a question to SO with no responses for a few months. I figured I'd post something here as more of a "Can I access these from outside of Java" type of thought process. Is there a folder on the device I can cat or try to load trusted certs from. Similar to what was mentioned here github.com/yan12125/python3-android/#ssltls – GR Envoy Jul 28 '20 at 17:20
  • And yes, python is running within the app process – GR Envoy Jul 28 '20 at 17:21
  • Directly accessing the certificate store is not a good idea as it may change in future Android versions. I would use the Java app, list all root CA certificate and convert them in a format that can be used by Python. – Robert Jul 28 '20 at 17:28
  • @Robert So once I can list all the CA, can you point me in a direction of how I would use this to create a PEM? I see how maybe I could do it with openssl, but not sure how to do it all from java stackoverflow.com/questions/652916/… – GR Envoy Jul 29 '20 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.