wintrust
Portable Rust catalog trust.
[]
= "0.2.0"
The implementation includes CMS/CTL,
RustCrypto signatures, pinned certificate chains, publisher authorization,
timestamps, signed CRL/OCSP status, bounded online acquisition and PE/CAB/XML SIP
hashes. windows-uup uses this crate and keeps compatibility module re-exports.
Functions use snake_case. Windows spellings are direct pub use aliases of the
same function items:
| Rust function | Windows alias |
|---|---|
win_verify_trust |
WinVerifyTrust |
crypt_cat_admin_acquire_context2 |
CryptCATAdminAcquireContext2 |
crypt_cat_admin_calc_hash_from_file_handle2 |
CryptCATAdminCalcHashFromFileHandle2 |
crypt_cat_admin_release_context |
CryptCATAdminReleaseContext |
These are safe Rust APIs with explicit policy and SIP format. They return
Result, reports and owned digest bytes, rather than C pointers or HRESULTs.
They do not export a Windows DLL ABI, accept arbitrary Windows provider actions,
or consult the host catalog database. Contexts are owned Rust values and also
release automatically on drop. File hashing preserves the original seek position
on success and verification errors.
use Path;
use ;
let verifier = load?;
let report = WinVerifyTrust?;
assert!;
# Ok::
The default implementation is Rust on all platforms. Feature native-reference
enables the separate Windows oracle at catalog_trust::verify_catalog_member;
it never changes win_verify_trust or its alias. The default dependency graph
contains no HTTP client. Enable online explicitly for bounded CRL/OCSP
acquisition using Rustls; online policies fail during loading without that feature.
New callers should use portable::ValidatedVerifier::load or
portable::VerifierBuilder. Runtime policy and pinned evidence have read-only
accessors, configuration and certificate DER are validated during construction,
and an omitted evaluation time is captured once when the verifier is built.
PortablePolicy remains the versioned JSON input. The mutable PortableVerifier
and Windows-name aliases remain available for source compatibility.
ctl::parse inspects exact CTL bytes independently of catalog SIP member rules.
It preserves borrowed entry identifiers and encodings, typed purpose/algorithm
OIDs, sequence identifiers, update times, and unknown attributes. Parse results
make no authentication or AuthRoot/Disallowed authorization claim.
See policy and limits.
Synthetic test fixtures originate from the independently signed fixture set in
windows-uup/tests/fixtures/catalog/revocation; its regeneration script discards
private keys. The root and policy in tests/fixtures are for tests only.
Windows naming references: context acquisition and file hashing.
Migration from 0.1
CRL/OCSP acquisition is now optional. Applications using PortableRevocationPolicy::Online
must enable wintrust = { version = "0.2.0", features = ["online"] }.
Offline parsing and verification require no HTTP client. Existing function names,
mutable-verifier compatibility APIs and Windows-name aliases remain available.
New integrations should prefer the immutable runtime verifier.
The published package includes synthetic test fixtures only. Microsoft-origin catalogs, manifests, certificates and cache-only CTL audit tests remain in the source repository, outside the registry archive. Run the repository suite for those interoperability regressions.
Development
Run cargo test --all-features --locked and
cargo clippy --all-targets --all-features --locked -- -D warnings.
The native-reference oracle runs only on Windows.
Extracted from CaddyGlow/windows-uup at commit
63e832067678635809405a9fd8c7820db0904f4e, including the working-tree
portable verifier changes present during extraction. The MIT copyright
notice is preserved in LICENSE.
Catalog parser fuzzing is maintained in fuzz.