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 · 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);
}