diff --git a/Cargo.toml b/Cargo.toml index d1b9abb..f2ef063 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ log = "0.4" octets = "0.3" quiche = { version = "0.24", features = ["qlog"] } ring = "0.17" +openssl-probe = "0.1.6" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "2.0" diff --git a/src/client/mod.rs b/src/client/mod.rs index 52c2497..dcd7e76 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -64,6 +64,25 @@ impl PsqClient { qconfig.verify_peer(!ignore_cert); + // Probe for the CA certificate location and configure qconfig with it. + if !ignore_cert { + let probe_result = openssl_probe::probe(); + if let Some(cert_dir) = probe_result.cert_dir { + qconfig + .load_verify_locations_from_directory( + cert_dir.as_path().to_str().expect("valid cert dir"), + ) + .expect("loading cert dir"); + } + if let Some(cert_file) = probe_result.cert_file { + qconfig + .load_verify_locations_from_file( + cert_file.as_path().to_str().expect("valid cert file"), + ) + .expect("loading cert file"); + } + } + qconfig .set_application_protos(quiche::h3::APPLICATION_PROTOCOL) .unwrap();