Skip to main content

tls_config_from_pem

Function tls_config_from_pem 

Source
pub fn tls_config_from_pem(
    extra_roots_pem: Option<&[u8]>,
    client_identity_pem: Option<(&[u8], &[u8])>,
) -> ClientTlsConfig
Available on crate features grpc-tls and grpc only.
Expand description

A gRPC TLS configuration from PEM, keeping the default roots.

The roots a client trusts by default, plus every certificate in extra_roots_pem, and the client certificate chain and private key in client_identity_pem (mutual TLS).

The gRPC counterpart of tls::tls_config_from_pem, which validates the same bytes: use that first to refuse a PEM that does not parse. A configuration given to ClientBuilder::with_grpc_tls_config or GrpcTransportConfig::with_tls_config is exact, so one built here keeps the default roots by starting from them.