Module platform_verifier
crypto and native-certs and std only.Expand description
Verify TLS server certificates with the operating system’s own verifier, in a tls-implementation agnostic way.
Where native_certs reads a snapshot of the platform trust store into
memory, a PlatformVerifier hands every presented chain to the platform
verifier and lets it decide. That honours enterprise trust settings, the
platform’s distrust decisions and revocation policy, and keeps working
where reading the trust store is restricted, such as inside a sandboxed
Apple network extension.
Supported on Apple platforms (Security framework), Windows (CryptoAPI) and
Android (the platform X509TrustManager). Other platforms have no such
verifier: PlatformVerifier::IS_AVAILABLE is false there and
verification fails with PlatformVerifyErrorKind::Unavailable.
The TLS backend remains responsible for the handshake signatures; this module only validates the certificate chain and server identity, and returns the chain the platform built so callers can inspect it.
On Android the verifier reads the process JavaVM through ndk-context.
Native activities initialize it automatically; other embedders initialize
ndk-context themselves, preferably with an Application context. In an app,
default trust follows Network Security Config. Additional roots are separate
application authority: they are tried only after a missing-anchor failure
and do not inherit Network Security Config pins. Explicit platform rejections
(including pin failures) are never overridden by additional roots.
Revocation follows the platform’s capabilities. Windows checks the leaf and soft-fails unavailable revocation information. Android API 24+ does the same, fetching only for system-rooted chains unless a staple is supplied; API 23 has no supplementary revocation check. For a chain with an issuer, a supplied Android staple must validate; malformed or invalid staples are rejected. Apple uses Security framework policy. These checks do not promise hard-fail revocation or revocation of every CA.
Native verification may fetch intermediates or revocation data and cannot be cancelled after it starts. Applications must bound connection concurrency and size executor blocking pools for this work, especially when peers can choose upstream destinations. A timeout alone does not bound native work.
Structs§
- Platform
Verifier - A TLS server certificate verifier backed by the operating system.
- Platform
Verify Error - Error returned by
PlatformVerifier::verify_server_chain.
Enums§
- Platform
Verify Error Kind - Why the platform verifier rejected a certificate chain.