File tree 1 file changed +17
-0
lines changed
rustls-platform-verifier/src
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,23 @@ pub fn tls_config() -> ClientConfig {
65
65
. with_no_client_auth ( )
66
66
}
67
67
68
+ /// Attempts to construct a `rustls` configuration that verifies TLS certificates in the best way
69
+ /// for the underlying OS platform, using the provided
70
+ /// [`CryptoProvider`][rustls:crypto::CryptoProvider].
71
+ ///
72
+ /// # Errors
73
+ ///
74
+ /// Propagates any error returned by [`rustls::ConfigBuilder::with_safe_default_protocol_versions`]
75
+ pub fn tls_config_with_provider (
76
+ provider : Arc < rustls:: crypto:: CryptoProvider > ,
77
+ ) -> Result < ClientConfig , rustls:: Error > {
78
+ Ok ( ClientConfig :: builder_with_provider ( provider. clone ( ) )
79
+ . with_safe_default_protocol_versions ( ) ?
80
+ . dangerous ( )
81
+ . with_custom_certificate_verifier ( Arc :: new ( Verifier :: new ( ) . with_provider ( provider) ) )
82
+ . with_no_client_auth ( ) )
83
+ }
84
+
68
85
/// Exposed for debugging certificate issues with standalone tools.
69
86
///
70
87
/// This is not intended for production use, you should use [tls_config] instead.
You can’t perform that action at this time.
0 commit comments