JFLib

netio/roots.rs#

Source: lib/netio/roots.rs

roots -- the system's certificate authorities for TLS clients of public servers

  verify_system(chain, host, extra, ocsp, now) -> Result<(), Refused>
       Windows, macOS, iOS: the system checks the chain (plat::certs: its roots and policy,
       the extra CAs under the same policy, the stapled OCSP response), then netio the leaf
       once more (x509::check_leaf: its name, usage and extensions, and a key netio takes:
       the same rules on every system); Linux: a path to one of the bundle's CAs
       (verify_chain), else, where it finds none, to one of the extra CAs.  The stapled
       response goes to Windows' and Apple's checks; verify_system itself does not check it
       (Linux takes none): the TLS client does (tls/conn.rs check_staple, by
       ClientConfig::revocation), another caller with x509::ocsp::check
  verify_system_chain(chain, host, extra, ocsp, now) -> Result<Vec<Cert>, Refused>
       verify_system, and the path the system trusts: the leaf first, up to the root or extra
       CA (Windows' and Apple's own path, a root the server left out included -- what a TLSA
       record of usage PKIX-TA may name, RFC 7671 5.4; Linux, Android: the path x509 builds
       to the bundle, else to an extra CA).  netio's check of the leaf after the system's yes
       as for verify_system; a certificate of the system's path netio cannot read is left out
  verify_system_roots(chain, host, roots, now)
       the same with only these CAs trusted, nothing fetched: the system's checks against a
       PKI of one's own (tools/limbo_check.py --system); an empty host checks no name
  system_anchors()
       the bundle's CAs (Linux: plat::certs::root_bundle; macOS: /etc/ssl/cert.pem, where a
       stapled response's issuer is looked for), parsed once and again when the bundle
       changed (looked at once a minute at most); reload(): look again at the next check
  Refused { reason, text }, Reason (UnknownCa, Expired, Name, Revoked, Usage, Other):
       plat::certs's

Re-exports: plat::certs::{Reason, Refused}

  • fn reload() read the bundle again at the next check, not only after a minute (a program that has just set SSL_CERT_FILE or SSL_CERT_DIR, or updated the bundle itself)

  • fn system_anchors() -> Arc<Vec<Cert>> the CA certificates of the system bundle (empty on Windows and iOS: the system decides there)

  • fn verify_system(chain: &[Cert], host: &str, extra: &[Cert], ocsp: Option<&[u8]>, now: i64) -> Result<(), Refused> a server chain (leaf first) against the system's trust for this host name and the extra CAs (a company CA: the system's policy holds for them too; on Linux they count where the bundle gives no path), with the stapled OCSP response the server sent. Windows and Apple read that response; this function does not check it -- the TLS client does (tls/conn.rs check_staple), another caller with x509::ocsp::check

  • fn verify_system_chain(chain: &[Cert], host: &str, extra: &[Cert], ocsp: Option<&[u8]>, now: i64) -> Result<Vec<Cert>, Refused> verify_system, and the path the system trusts (leaf first, up to the root or extra CA; a root the server left out included): Windows' and Apple's own, on Linux the path to the bundle (or to an extra CA)

  • fn verify_system_roots(chain: &[Cert], host: &str, roots: &[Cert], now: i64) -> Result<(), Refused> a server chain against only these CAs, with the system's checks (Linux: verify_chain's); an empty host checks no name

Source: docs/API.md in the JFLib repository.