pub trait SslStore<C, S> {
// Required methods
fn get_file_certificates(path: &Path) -> Result<Vec<C>, ConfigError>;
fn get_store(&self) -> Result<S, ConfigError>;
fn get_certs(&self) -> Result<HashMap<String, C>, ConfigError>;
}
Available on crate feature
config
only.Expand description
Trait to define an SSL store with custom SSL objects
Required Methods§
Sourcefn get_file_certificates(path: &Path) -> Result<Vec<C>, ConfigError>
fn get_file_certificates(path: &Path) -> Result<Vec<C>, ConfigError>
Method to read certificates from its path. Get all certificates in subfolders
Sourcefn get_store(&self) -> Result<S, ConfigError>
fn get_store(&self) -> Result<S, ConfigError>
Method to get a cert store
use prosa_utils::config::ssl::{Store, SslStore};
let store = Store::File { path: "./target".into() };
let ssl_store = store.get_store().unwrap();
Sourcefn get_certs(&self) -> Result<HashMap<String, C>, ConfigError>
fn get_certs(&self) -> Result<HashMap<String, C>, ConfigError>
Method to get all OpenSSL certificate with their names as key
use prosa_utils::config::ssl::{Store, SslStore};
let store = Store::File { path: "./target".into() };
let certs_map = store.get_certs().unwrap();
// No cert in target
assert!(certs_map.is_empty());
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.