pub struct RustlsConnectorConfig { /* private fields */ }Expand description
Configuration helper for RustlsConnector
Implementations§
Source§impl RustlsConnectorConfig
impl RustlsConnectorConfig
Sourcepub fn new_with_webpki_root_certs() -> Self
pub fn new_with_webpki_root_certs() -> Self
Create a new RustlsConnectorConfig using the webpki-root-certs (requires webpki-root-certs feature enabled)
Sourcepub fn new_with_platform_verifier() -> Self
pub fn new_with_platform_verifier() -> Self
Create a new RustlsConnectorConfig using the rustls-platform-verifier mechanism (requires platform-verifier feature enabled)
Sourcepub fn new_with_native_certs() -> Result<Self>
pub fn new_with_native_certs() -> Result<Self>
Create a new RustlsConnectorConfig using the system certs (requires native-certs feature enabled)
§Errors
Returns an error if we fail to load the native certs.
Sourcepub fn add_parsable_certificates(
&mut self,
der_certs: Vec<CertificateDer<'static>>,
)
pub fn add_parsable_certificates( &mut self, der_certs: Vec<CertificateDer<'static>>, )
Queue the given DER-encoded certificates as additional roots.
Parsing is deferred until the connector is built. Certificates that fail to parse are then skipped in a best-effort fashion, because large collections of root certificates often include ancient or syntactically invalid certificates.
The one exception is with_platform_verifier: the platform
verifier rejects unparsable extra roots outright, so a single bad certificate makes
building the connector fail.
Sourcepub fn with_parsable_certificates(
self,
der_certs: Vec<CertificateDer<'static>>,
) -> Self
pub fn with_parsable_certificates( self, der_certs: Vec<CertificateDer<'static>>, ) -> Self
Queue the given DER-encoded certificates as additional roots.
Chainable variant of add_parsable_certificates; see it
for the parsing semantics.
Sourcepub fn with_webpki_root_certs(self) -> Self
pub fn with_webpki_root_certs(self) -> Self
Add certs from webpki-root-certs (requires webpki-root-certs feature enabled)
Sourcepub fn with_platform_verifier(self) -> Self
pub fn with_platform_verifier(self) -> Self
Use the rustls-platform-verifier mechanism (requires platform-verifier feature enabled)
Sourcepub fn with_native_certs(self) -> Result<Self>
pub fn with_native_certs(self) -> Result<Self>
Add the system certs (requires native-certs feature enabled)
§Errors
Returns an error if we fail to load the native certs.
Sourcepub fn connector_with_no_client_auth(self) -> Result<RustlsConnector>
pub fn connector_with_no_client_auth(self) -> Result<RustlsConnector>
Create a new RustlsConnector from this config and no client certificate
§Errors
Returns an error if we fail to init our verifier or if no valid root certificate could be loaded
§Panics
Panics if rustls cannot determine a crypto provider, i.e. if no process-level default has been installed and the enabled crate features select zero or more than one provider.
Sourcepub fn connector_with_single_cert(
self,
cert_chain: Vec<CertificateDer<'static>>,
key_der: PrivateKeyDer<'static>,
) -> Result<RustlsConnector>
pub fn connector_with_single_cert( self, cert_chain: Vec<CertificateDer<'static>>, key_der: PrivateKeyDer<'static>, ) -> Result<RustlsConnector>
Create a new RustlsConnector from this config and the given client certificate
cert_chain is a vector of DER-encoded certificates. key_der is a DER-encoded RSA, ECDSA, or Ed25519 private key.
§Errors
Returns an error if we fail to init our verifier, if no valid root certificate could be loaded, or if key_der is invalid.
§Panics
Panics if rustls cannot determine a crypto provider, i.e. if no process-level default has been installed and the enabled crate features select zero or more than one provider.
Trait Implementations§
Source§impl Clone for RustlsConnectorConfig
impl Clone for RustlsConnectorConfig
Source§fn clone(&self) -> RustlsConnectorConfig
fn clone(&self) -> RustlsConnectorConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more