SslConfigContext

Trait SslConfigContext 

Source
pub trait SslConfigContext<C, S> {
    // Required methods
    fn init_tls_client_context(&self) -> Result<C, ConfigError>;
    fn init_tls_server_context(
        &self,
        host: Option<&str>,
    ) -> Result<S, ConfigError>;
}
Available on crate feature config only.
Expand description

Trait to define SSL configuration context for socket

Required Methods§

Source

fn init_tls_client_context(&self) -> Result<C, ConfigError>

Method to init an SSL context for a client socket

use prosa_utils::config::ssl::{Store, SslConfig, SslConfigContext as _};

let mut client_config = SslConfig::default();
client_config.set_store(Store::File { path: "./target".into() });
if let Ok(mut ssl_context_builder) = client_config.init_tls_client_context() {
    let ssl_context = ssl_context_builder.build();
}
Source

fn init_tls_server_context(&self, host: Option<&str>) -> Result<S, ConfigError>

Method to init an SSL context for a server socket

use prosa_utils::config::ssl::{SslConfig, SslConfigContext as _};

let server_config = SslConfig::new_pkcs12("server.pkcs12".into());
if let Ok(mut ssl_context_builder) = server_config.init_tls_server_context(None) {
    let ssl_context = ssl_context_builder.build();
}

Implementors§

Source§

impl SslConfigContext<SslConnectorBuilder, SslAcceptorBuilder> for SslConfig

Available on crate feature config-openssl only.