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

[C Bindings] open remote connection fails with CA certificates on Android #1432

Closed
ospfranco opened this issue Jun 1, 2024 · 4 comments · Fixed by #1433
Closed

[C Bindings] open remote connection fails with CA certificates on Android #1432

ospfranco opened this issue Jun 1, 2024 · 4 comments · Fixed by #1433

Comments

@ospfranco
Copy link
Contributor

ospfranco commented Jun 1, 2024

I seem to have hit this issue:

rustls/hyper-rustls#187

Here a user tried to connect to a turso remote database on Android:

OP-Engineering/op-sqlite#102 (comment)

The proposed solution is using a different API which has been made available only on Rust:

#789

On rust the open_remote_with_connector function has been exposed, which does not use root certificates but webpki. I guess I would also need the same function exposed to the C bindings.

@haaawk
Copy link
Contributor

haaawk commented Jun 1, 2024

This is what you have to do to get this working on Android:

let https = hyper_rustls::HttpsConnectorBuilder::new()
                    .with_webpki_roots()
                    .https_or_http()
                    .enable_http1()
                    .build();
            Builder::new_remote_replica(db_file, url, auth_token)
                    .connector(https)
                    .build()
                    .await

@haaawk
Copy link
Contributor

haaawk commented Jun 1, 2024

I guess I could expose a new C function just for Android that would do the above internally.

@haaawk
Copy link
Contributor

haaawk commented Jun 1, 2024

You should be able to use libql_open_sync_with_webpki and libsql_open_remote_with_webpki introduced in #1433

@ospfranco
Copy link
Contributor Author

awesome. thanks!

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

Successfully merging a pull request may close this issue.

2 participants