Struct hyper_serve::tls_openssl::OpenSSLConfig
source · 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 hyper_serve::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 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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)