Trait SslStore

Source
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§

Source

fn get_file_certificates(path: &Path) -> Result<Vec<C>, ConfigError>

Method to read certificates from its path. Get all certificates in subfolders

Source

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();
Source

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.

Implementors§

Source§

impl SslStore<X509, X509Store> for Store

Available on crate feature config-openssl only.