Skip to content

[Feature proposal] Dynamic signing of TLS connection #2656

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

Open
FaustXVI opened this issue Apr 29, 2025 · 2 comments
Open

[Feature proposal] Dynamic signing of TLS connection #2656

FaustXVI opened this issue Apr 29, 2025 · 2 comments

Comments

@FaustXVI
Copy link

The actual need

Let's say we have a hardware token like a HSM, a Yubikey or any security token compatible with PKCS#11.

We could imagine using the key/certificate pair stored in the security token to secure the TLS connection. That way, on the other side of the connection, we are sure that we are talking to someone who has that unique security token.

The problem

The private key cannot be extracted from the security token (that's the whole purpose) so we can't give it to reqwest.

The solution

When creating a TLS connection, data needs to be signed by the security token. This means that, instead of giving a private key as an identity, we need to give a function that will sign the data. On step further would be to also allow a dynamic certificate.

The good news is that rustls already have this feature.
However, as you stated in #2569 and #605, exposing rustls API means risking breaking changes on a simple update.
A wrapper would do the trick but it doesn't seems that native_tls would support that feature.

Would having a feature for rustls only but without exposing rustls API be acceptable for you ?

@seanmonstar
Copy link
Owner

Maybe... Though, designing a callback/trait that is sufficiently forwards compatible is probably difficult here.

At the moment, I'd suggest use_preconfigured_tls().

@FaustXVI
Copy link
Author

FaustXVI commented Apr 29, 2025

Yeah, I thought of that too, but then I have to redo what you have done about the configuration and monitor any change made to that specific file in case any issue is present (and currently unknown) in the TLS configuration.
Doable, but not optimal.

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

2 participants