You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rustls 0.22.0 introduces custom crypto providers (see #1509).
This allows plugging in different crypto providers.
While there are examples already on how to use rustls circumventing the built-in tls feature, and they can be easily extended to utilize a custom crypto provider, it would be very convenient if one were able to simply pass the provider to the Server/ClientTlsConfig structs.
Supporting custom providers enables a simple path to using tonic in environments where for example FIPS certification of the crypto libraries is required by plugging in a rustls fips-compliant crypto provider.
let builder = ServerConfig::builder().with_safe_defaults();
I propose moving the current code in the new methods to a with_opt_provider constructor, changing these methods to accepting an optional reference to a crypto provider and when this is given calling ::builder_with_provider() with the provided provider, thus enabling the provider.
The new constructors than continues to provide the same API and can simply call with_opt_provider, providing None for the optional provider.
Additionally, enabling to specify the provider in ServerTlsConfig / ClientTlsConfig (a rustls_provider() method) would then allow to expose this to the user as part of the tls feature by calling with_opt_provider in tls_acceptor / tls_connector
Alternatives
Directly accept the optional provider on the new methods. Drawback, API changes.
The text was updated successfully, but these errors were encountered:
Feature Request
Crates
tonic crate in the transport module
Motivation
rustls 0.22.0 introduces custom crypto providers (see #1509).
This allows plugging in different crypto providers.
While there are examples already on how to use rustls circumventing the built-in
tls
feature, and they can be easily extended to utilize a custom crypto provider, it would be very convenient if one were able to simply pass the provider to the Server/ClientTlsConfig structs.Supporting custom providers enables a simple path to using tonic in environments where for example FIPS certification of the crypto libraries is required by plugging in a rustls fips-compliant crypto provider.
Proposal
Here is an example for a client to utilize a custom provider: https://github.com/rustls/rustls/blob/main/provider-example/examples/client.rs
In essence, the
TlsConnector
andTlsAcceptor
today call:ClientConfig::builder()
andServerConfig::builder()
, see:tonic/tonic/src/transport/service/tls.rs
Line 35 in 522a8d7
tonic/tonic/src/transport/service/tls.rs
Line 110 in 522a8d7
I propose moving the current code in the
new
methods to awith_opt_provider
constructor, changing these methods to accepting an optional reference to a crypto provider and when this is given calling::builder_with_provider()
with the provided provider, thus enabling the provider.The
new
constructors than continues to provide the same API and can simply callwith_opt_provider
, providingNone
for the optional provider.Additionally, enabling to specify the provider in
ServerTlsConfig
/ClientTlsConfig
(arustls_provider()
method) would then allow to expose this to the user as part of thetls
feature by callingwith_opt_provider
intls_acceptor
/tls_connector
Alternatives
Directly accept the optional provider on the
new
methods. Drawback, API changes.The text was updated successfully, but these errors were encountered: