mozilla_root_ca/
native_tls.rs

1use crate::*;
2
3extern crate native_tls;
4use native_tls::Certificate;
5
6pub fn native_tls_certificate_list() -> &'static [Certificate; PEM_LIST_LEN] {
7    #[cfg(not(feature="std"))]
8    {
9        use lazy_static::lazy_static;
10
11        lazy_static! {
12            static ref LIST: [Certificate; PEM_LIST_LEN] = gen_cert_list();
13        }
14
15        &*LIST
16    }
17
18    #[cfg(feature="std")]
19    {
20        use once_cell::sync::Lazy;
21
22        static LIST: Lazy<[Certificate; PEM_LIST_LEN]> = Lazy::new(gen_cert_list);
23
24        &*LIST
25    }
26}
27
28fn gen_cert_list() -> [Certificate; PEM_LIST_LEN] {
29    core::array::from_fn(|i| {
30        Certificate::from_pem(PEM_LIST[i].as_bytes()).unwrap()
31    })
32}