trz_gateway_common/security_configuration/trusted_store/
empty.rs1use std::convert::Infallible;
2use std::sync::Arc;
3use std::sync::OnceLock;
4
5use openssl::x509::store::X509Store;
6use openssl::x509::store::X509StoreBuilder;
7
8use super::TrustedStoreConfig;
9
10pub struct EmptyTrustedStoreConfig;
12
13impl TrustedStoreConfig for EmptyTrustedStoreConfig {
14 type Error = Infallible;
15
16 fn root_certificates(&self) -> Result<Arc<X509Store>, Self::Error> {
17 static EMPTY: OnceLock<Arc<X509Store>> = OnceLock::new();
18 Ok(EMPTY
19 .get_or_init(|| {
20 X509StoreBuilder::new()
21 .expect("X509StoreBuilder::new()")
22 .build()
23 .into()
24 })
25 .clone())
26 }
27}