pub struct TlsConfig { /* private fields */ }Expand description
Certificate, key and client-auth policy of an HTTPS server; cheap to clone, clones share the (reloadable) configuration
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn from_pem(chain_pem: &[u8], key_pem: &[u8]) -> Result<Self>
pub fn from_pem(chain_pem: &[u8], key_pem: &[u8]) -> Result<Self>
From PEM text: the certificate chain (leaf first) and one private key (PKCS#8, PKCS#1 or SEC1)
Sourcepub fn from_pem_files(
cert_path: impl AsRef<Path>,
key_path: impl AsRef<Path>,
) -> Result<Self>
pub fn from_pem_files( cert_path: impl AsRef<Path>, key_path: impl AsRef<Path>, ) -> Result<Self>
From PEM files, which reload reads again later
Sourcepub fn client_auth(self, ca_pem: &[u8], required: bool) -> Result<Self>
pub fn client_auth(self, ca_pem: &[u8], required: bool) -> Result<Self>
Ask clients for a certificate signed by one of the CAs in ca_pem
With required, connections without a valid certificate fail the
handshake. Without it, clients may connect anonymously and handlers
decide per route (Request::client_certificate is None then);
a certificate that is presented but not trusted is always rejected.
Sourcepub fn handshake_timeout(self, timeout: Duration) -> Self
pub fn handshake_timeout(self, timeout: Duration) -> Self
Time allowed for the TLS handshake (default 10 s)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TlsConfig
impl RefUnwindSafe for TlsConfig
impl Send for TlsConfig
impl Sync for TlsConfig
impl Unpin for TlsConfig
impl UnsafeUnpin for TlsConfig
impl UnwindSafe for TlsConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more