Skip to content

How to use a custom ClientCertResolver? #252

Description

@kaisq

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:

  1. 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);
  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions