Skip to content
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

android trust store #610

Closed
dten opened this issue Apr 3, 2017 · 10 comments
Closed

android trust store #610

dten opened this issue Apr 3, 2017 · 10 comments

Comments

@dten
Copy link

dten commented Apr 3, 2017

We've had some issues using crates that use openssl for https etc because android's trust store works differently (https://nelenkov.blogspot.co.uk/2011/12/ics-trust-store-implementation.html)

We had a bit of discussion on how to get this working in reqwest as myself and @king6cong also was having the issue seanmonstar/reqwest#70

After some attemps I settled on this (very rough) fix, I'm not 100% happy with it, though it does mean it works for all crates the use openssl without needed to change them.
dten@72da006

Since this crate takes the responsibility of loading the default certificates it feels like this is the right place to fix this but I wondered if there was preferred way.

@king6cong
Copy link

@dten Can you make a PR here? This will be better.

@dten
Copy link
Author

dten commented Apr 3, 2017

I'll flesh out the missing parts and neaten things up for a PR if this is something that is likely to be accepted

@dten
Copy link
Author

dten commented Apr 3, 2017

@sfackler
Copy link
Owner

sfackler commented Apr 4, 2017

My intuition is that this'd live outside of rust-openssl itself in the same way that openssl-probe does, but that things like native-tls would pull it in when targeting Android.

@dten
Copy link
Author

dten commented Apr 4, 2017

openssl-probe can get away with setting those environment variables which the C side of things pick up. Which means the final crate that is deployed in the app can be the one who decides to run it and re-target openssl from the default.
Those env variables don't work on android sadly. Mostly because android's certs are stored using the the old hash format (pre 1.0) and there's no way to compile openssl to use that (without actual changes to the c).

@sfackler
Copy link
Owner

sfackler commented Apr 4, 2017

It wouldn't work exactly like openssl-probe at an API level (it'd probably instead fill in an X509Store?), but it'd be similar in that it's a separate crate.

@dten
Copy link
Author

dten commented Apr 4, 2017

Would this be possible to do without having to intervene in every crate that used openssl?

@sfackler
Copy link
Owner

sfackler commented Apr 4, 2017

It'd hopefully only need to be done on things that are explicitly targeting Android and things that want to "magically" just work like native-tls. I want to keep the magic out of openssl itself, since it opens a pretty huge can of worms. Android isn't the only platform that'd need special support to integrate with the system - we'd need to do similar things on Windows and macOS.

@cpick
Copy link

cpick commented Apr 5, 2018

I've updated @dten's patch from seanmonstar/reqwest#70 in cpick/rust-openssl@c5f6616 to get it working on the 0.9.x branch.

(As an aside, @dten: are you still using that patch or have you found a different solution?)

@dten
Copy link
Author

dten commented Apr 6, 2018

I do not currently have another solution as this sufficed for my needs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants