Make loading system certificates from the Keychain on macOS an opt-out feature (#2377)

This commit is contained in:
yhirose
2026-02-22 19:18:40 -05:00
committed by GitHub
parent 7c33fd47bf
commit c2002f6e06
6 changed files with 54 additions and 36 deletions

View File

@@ -79,7 +79,7 @@ cpp-httplib supports multiple TLS backends through an abstraction layer:
> **Mbed TLS / wolfSSL limitation:** `get_ca_certs()` and `get_ca_names()` only reflect CA certificates loaded via `load_ca_cert_store()` or `load_ca_cert_store(pem, size)`. Certificates loaded through `set_ca_cert_path()` or system certificates (`load_system_certs`) are not enumerable with these backends.
> [!TIP]
> For macOS: cpp-httplib can use system certs with `CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN`. `CoreFoundation` and `Security` should be linked with `-framework`.
> For macOS: cpp-httplib automatically loads system certs from the Keychain when a TLS backend is enabled. `CoreFoundation` and `Security` must be linked with `-framework`. To disable this, define `CPPHTTPLIB_DISABLE_MACOSX_AUTOMATIC_ROOT_CERTIFICATES`.
```c++
// Use either OpenSSL, Mbed TLS, or wolfSSL