How to use a custom ClientCertResolver?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 170
- Forks
- 43
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 10
Description
I'd like to be able to use a custom ClientCertResolver from C code that uses rustls-ffi to perform TLS. I currently have a resolver that implements ClientCertResolver that works fine with rustls inside of Rust code, but I can't see any way to use that within C code via rustls-ffi. Am I missing something that would make this work?
I've thought a little bit about how this sort of option might be exposed, and it seems like it might be a little complicated to make a good API for this. My thoughts are:
- expose enough symbols on the rust side from
rustls-ffithat it can be included as a library in another rust project, where that project exports a functionrustls_result mylibrary_rustls_client_config_builder_set_custom_resolver(*rustls_client_config_builder builder); - expose a
struct rustls_client_cert_resolveron the rust side that lets you convert adyn ClientCertResolverinto a type that can be understood in C code fromrustls-ffi, and can be used like this:
rustls_client_cert_resolver resolver = mylibrary_custom_cert_resolver();
rustls_client_config_builder_set_client_cert_resolver(resolver);
Any opinions on this? I'm happy to send a PR if there are any reasonable options.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the rustls-ffi C API around rustls_client_config_builder and the Rust ClientCertResolver type. Compare the two proposed ways to expose a custom resolver, then define a safe, usable API whose completion criteria include invoking a custom resolver from C and documenting its usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- cryptography, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100