Read the system CA bundle from well-known paths. Returns the PEM contents of the first non-empty bundle found, or an empty string if none of the well-known paths exist. Call once and pass the result to both [`write_ca_files`] and [`build_upstream_client_config`].
()
| 291 | /// string if none of the well-known paths exist. Call once and pass the result |
| 292 | /// to both [`write_ca_files`] and [`build_upstream_client_config`]. |
| 293 | pub fn read_system_ca_bundle() -> String { |
| 294 | for path in SYSTEM_CA_PATHS { |
| 295 | if let Ok(contents) = std::fs::read_to_string(path) |
| 296 | && !contents.is_empty() |
| 297 | { |
| 298 | return contents; |
| 299 | } |
| 300 | } |
| 301 | // No system bundle found — combined file will contain only the sandbox CA. |
| 302 | // This is acceptable since the proxy uses webpki-roots independently. |
| 303 | String::new() |
| 304 | } |
| 305 | |
| 306 | /// Parse PEM certificates from a file into DER-encoded certificates. |
| 307 | pub fn parse_pem_certs(path: &Path) -> Result<Vec<CertificateDer<'static>>> { |
no test coverage detected