pub struct OpenSSLConfig { /* private fields */ }tls-openssl only.Expand description
OpenSSL configuration.
Implementations§
Source§impl OpenSSLConfig
impl OpenSSLConfig
Sourcepub fn from_acceptor(acceptor: Arc<SslAcceptor>) -> Self
pub fn from_acceptor(acceptor: Arc<SslAcceptor>) -> Self
Create config from Arc<SslAcceptor>.
Sourcepub fn from_der(cert: &[u8], key: &[u8]) -> Result<Self, OpenSSLError>
pub fn from_der(cert: &[u8], key: &[u8]) -> Result<Self, OpenSSLError>
This helper will establish a TLS server based on strong cipher suites from a DER-encoded certificate and key.
Sourcepub fn from_pem(cert: &[u8], key: &[u8]) -> Result<Self, OpenSSLError>
pub fn from_pem(cert: &[u8], key: &[u8]) -> Result<Self, OpenSSLError>
This helper will establish a TLS server based on strong cipher suites from a PEM-formatted certificate and key.
Sourcepub fn from_pem_file(
cert: impl AsRef<Path>,
key: impl AsRef<Path>,
) -> Result<Self, OpenSSLError>
pub fn from_pem_file( cert: impl AsRef<Path>, key: impl AsRef<Path>, ) -> Result<Self, OpenSSLError>
This helper will establish a TLS server based on strong cipher suites from a PEM-formatted certificate and key.
Sourcepub fn from_pem_chain_file(
chain: impl AsRef<Path>,
key: impl AsRef<Path>,
) -> Result<Self, OpenSSLError>
pub fn from_pem_chain_file( chain: impl AsRef<Path>, key: impl AsRef<Path>, ) -> Result<Self, OpenSSLError>
This helper will establish a TLS server based on strong cipher suites from a PEM-formatted certificate chain and key.
Sourcepub fn get_inner(&self) -> Arc<SslAcceptor>
pub fn get_inner(&self) -> Arc<SslAcceptor>
Get inner Arc<SslAcceptor>.
Sourcepub fn reload_from_acceptor(&self, acceptor: Arc<SslAcceptor>)
pub fn reload_from_acceptor(&self, acceptor: Arc<SslAcceptor>)
Reload acceptor from Arc<SslAcceptor>.
Sourcepub fn reload_from_der(
&self,
cert: &[u8],
key: &[u8],
) -> Result<(), OpenSSLError>
pub fn reload_from_der( &self, cert: &[u8], key: &[u8], ) -> Result<(), OpenSSLError>
Reload acceptor from a DER-encoded certificate and key.
Sourcepub fn reload_from_pem(
&self,
cert: &[u8],
key: &[u8],
) -> Result<(), OpenSSLError>
pub fn reload_from_pem( &self, cert: &[u8], key: &[u8], ) -> Result<(), OpenSSLError>
Reload acceptor from a PEM-formatted certificate and key.
Sourcepub fn reload_from_pem_file(
&self,
cert: impl AsRef<Path>,
key: impl AsRef<Path>,
) -> Result<(), OpenSSLError>
pub fn reload_from_pem_file( &self, cert: impl AsRef<Path>, key: impl AsRef<Path>, ) -> Result<(), OpenSSLError>
Reload acceptor from a PEM-formatted certificate and key.
Sourcepub fn reload_from_pem_chain_file(
&self,
chain: impl AsRef<Path>,
key: impl AsRef<Path>,
) -> Result<(), OpenSSLError>
pub fn reload_from_pem_chain_file( &self, chain: impl AsRef<Path>, key: impl AsRef<Path>, ) -> Result<(), OpenSSLError>
Reload acceptor from a PEM-formatted certificate chain and key.
Trait Implementations§
Source§impl Clone for OpenSSLConfig
impl Clone for OpenSSLConfig
Source§fn clone(&self) -> OpenSSLConfig
fn clone(&self) -> OpenSSLConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpenSSLConfig
impl Debug for OpenSSLConfig
Source§impl TryFrom<SslAcceptorBuilder> for OpenSSLConfig
impl TryFrom<SslAcceptorBuilder> for OpenSSLConfig
Source§fn try_from(tls_builder: SslAcceptorBuilder) -> Result<Self, Self::Error>
fn try_from(tls_builder: SslAcceptorBuilder) -> Result<Self, Self::Error>
Build the OpenSSLConfig from an SslAcceptorBuilder. This allows precise
control over the settings that will be used by OpenSSL in this server.
§Example
use axum_server::tls_openssl::OpenSSLConfig;
use openssl::ssl::{SslAcceptor, SslMethod};
use std::convert::TryFrom;
#[tokio::main]
async fn main() {
let mut tls_builder = SslAcceptor::mozilla_modern_v5(SslMethod::tls())
.unwrap();
// Set configurations like set_certificate_chain_file or
// set_private_key_file.
// let tls_builder.set_ ... ;
let _config = OpenSSLConfig::try_from(tls_builder);
}Auto Trait Implementations§
impl Freeze for OpenSSLConfig
impl RefUnwindSafe for OpenSSLConfig
impl Send for OpenSSLConfig
impl Sync for OpenSSLConfig
impl Unpin for OpenSSLConfig
impl UnsafeUnpin for OpenSSLConfig
impl UnwindSafe for OpenSSLConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more