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-ffi that it can be included as a library in another rust project, where that project exports a function rustls_result mylibrary_rustls_client_config_builder_set_custom_resolver(*rustls_client_config_builder builder);
- expose a
struct rustls_client_cert_resolver on the rust side that lets you convert a dyn ClientCertResolver into a type that can be understood in C code from rustls-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.
I'd like to be able to use a custom
ClientCertResolverfrom C code that usesrustls-ffito perform TLS. I currently have a resolver that implementsClientCertResolverthat works fine withrustlsinside of Rust code, but I can't see any way to use that within C code viarustls-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:
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);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:Any opinions on this? I'm happy to send a PR if there are any reasonable options.