[−][src]Module libtls::config
TLS configuration for connections.
Tls
clients and servers are configured with the Config
configuration context and its helper funtions.
Example
use libtls::{config::{self, Config}, error}; fn tls_server_config() -> error::Result<Config> { let mut tls_config = Config::new()?; let valid_cert = include_bytes!("../tests/eccert.crt"); let valid_key = include_bytes!("../tests/eccert.key"); // Sets the key pair and wipes the private key file from memory afterwards let res = tls_config.set_keypair_mem(valid_cert, valid_key); config::unload_file(valid_key.to_vec()); res?; // The following examples are all set by default and it is not // not required to set them. tls_config.set_ciphers("secure")?; tls_config.set_protocols(libtls::TLS_PROTOCOLS_DEFAULT)?; tls_config.prefer_ciphers_server(); tls_config.verify(); Ok(tls_config) }
Structs
Builder |
|
Config | The TLS configuration context for |
Functions
default_ca_cert_file | Return path of the default CA file. |
load_file | Load a certificate or key file. |
parse_protocols | Parse protocol string. |
unload_file | Securely unload file that was loaded into memory. |
Type Definitions
TlsConfig | Deprecated The TLS configuration context for |
TlsConfigBuilder | Deprecated
|