code wiki / (root) / nx_x509_trust_store.nx

nx_x509_trust_store.nx

buildroot/runtime/nx_x509_trust_store.nx

5892 B158 linesdepth 4pulls 5 transitivereach 526 importersview sourcekind tooltopic x509
docsdependenciesstructsconstsfunctions

about

nx_x509_trust_store.nx -- trust anchor store + subject-DN lookup. Phase 0b §I.4 piece 9 of the chain-walker arc. Provides the data structure + lookup helper for cert chain validation's trust-anchor input. Model: A trust store holds an array of TrustAnchor entries. Each entry pairs a subject DN (full DER-encoded Name SEQUENCE bytes, byte-equality matchable) with a parsed X509Cert struct + its backing DER buffer that the chain walker uses as the "root" cert. Lookup: given the LAST cert in a peer's presented chain (the one signed by a CA), find its issuer DN, then search the store for a TrustAnchor whose subject DN byte-equals that issuer DN. If found -> caller has its trust anchor. If not -> chain terminates outside the trust store (UNTRUSTED). Why subject-DN-keyed lookup: - RFC 5280 §6.1.1 says the trust anchor is identified by its issuer DN matching the next cert's subject DN. - Indexing by full DER bytes (vs. parsing into a canonical form first) keeps the primitive sovereign + simple. Real CAs emit byte-equal DN encodings in matched pairs. - For multi-megabyte CA bundles a hash-table or binary tree would be needed; current linear scan is adequate for the Mozilla NSS bundle (~150 roots) at qemu speed. Public API: struct TrustAnchor { buf: *u8, DER cert buffer cert: *X509Cert, already-parsed cert } trust_store_alloc(max_n) -> *TrustStore trust_store_add(store, buf, cert) -> verdict trust_store_lookup_by_subject(store, dn_buf, dn_off, dn_len) -> *TrustAnchor (or NULL if not found) trust_store_count(store) -> i64 Sealed verdict enum for the add path:

dependencies 3 imports · 368 importers

nx_syscalls.nx nx_x509.nx nx_x509_dn_match.nx nx_x509_trust_store.nx _dlr_probe.nx _h2_fetch_google.nx _h2_fetch_rumble.nx _h2_multistream_curl_daemon.nx _h2_probe_imgsearch.nx _h2_probe_imgsearch_ua.nx _h2_reach_probe.nx _h2_serve_curl_daemon.nx _h2_serve_loopback_gate.nx _uj_probe.nx

diagram shows first 10 each side; +0 more imports, +358 more importers in the complete lists below.

imports: nx_syscalls.nxnx_x509.nxnx_x509_dn_match.nx

imported by: _dlr_probe.nx_h2_fetch_google.nx_h2_fetch_rumble.nx_h2_multistream_curl_daemon.nx_h2_probe_imgsearch.nx_h2_probe_imgsearch_ua.nx_h2_reach_probe.nx_h2_serve_curl_daemon.nx_h2_serve_loopback_gate.nx_uj_probe.nx_wt_probe_one.nxnishi.nxnx_access_research_fetch.nxnx_acme_directory_live.nxnx_acme_directory_live_real_ca_test.nxnx_acme_dns01_propagation_gate.nxnx_acme_http.nxnx_adnet_research_fetch.nxnx_agentcap_sota_fetch.nxnx_apertus_smallfiles.nxnx_apertus_tree_fetch.nxnx_api_sota_fetch.nxnx_apimcp_research_fetch.nxnx_app_monitor.nxnx_archive_capture_demo.nxnx_archive_daemon.nxnx_archive_live.nxnx_archive_media_fetch.nxnx_archive_site_viewer.nxnx_archive_viewer.nxnx_archive_xcapture_fetch.nxnx_asr_research_fetch.nxnx_aw_verify_gate.nxnx_award_ui_research_fetch.nxnx_barcheck.nxnx_battery_research_fetch.nxnx_bench_fetch.nxnx_bench_warc.nxnx_bf_live.nxnx_brand_exceed_research_fetch.nxnx_brand_research_fetch.nxnx_browse.nxnx_browser.nxnx_browser_fetch.nxnx_browser_fetch_probe.nxnx_browser_own_site_live_test.nxnx_bulk_index.nxnx_cad_verify_gate.nxnx_cadtwin_research.nxnx_cadtwin_research2.nxnx_cc_datahost_probe.nxnx_cc_ingest.nxnx_cc_record_fetch.nxnx_cc_warc_fetch.nxnx_cdnaccess_research_fetch.nxnx_cert_autorenew.nxnx_cf_access_probe.nxnx_chain_pipeline_real_test.nxnx_chrome_fetch_probe.nxnx_claim_verify.nxnx_clean_serve_daemon.nxnx_cleanview.nxnx_cleanwatch_serve.nxnx_click_test.nxnx_cms_tls_gate.nxnx_codec_research_fetch.nxnx_commoncrawl_probe.nxnx_commoncrawl_query.nxnx_compare_instrument_verify.nxnx_compare_registry_assemble.nxnx_connect_live_verify.nxnx_connect_research_fetch.nxnx_corpus_fetch.nxnx_crawl_https.nxnx_crawl_preserve.nxnx_crawl_web.nxnx_crew_live_verify.nxnx_dev_api_build_probe.nxnx_dev_api_live_check.nxnx_diora_live_reach.nxnx_dist_verify.nxnx_dlperf_research_fetch.nxnx_dm_research_fetch.nxnx_dmn_research_fetch.nxnx_doc_research_fetch.nxnx_docpub_research_fetch.nxnx_doctor_research_fetch.nxnx_download_research_fetch.nxnx_dr_research_fetch.nxnx_eco_research_fetch.nxnx_eda_tooling_research_fetch.nxnx_edge_probe.nxnx_edge_watchdog.nxnx_effbench_research_fetch.nxnx_elara_ref_fetch.nxnx_emit_sota_fetch.nxnx_entity_card.nxnx_entity_media.nxnx_entity_seeds.nxnx_ereader_sota_fetch.nx +268 more (shown cap 100 declared)

structs

81struct TrustAnchor
89struct TrustStore

consts

72const NX_TRUST_STORE_OK: i64 = 1
73const NX_TRUST_STORE_FULL: i64 = 2
74const NX_TRUST_STORE_BAD: i64 = 3
75const NX_TRUST_STORE_VERDICT_N: i64 = 4

functions

95func nx_trust_store_verdict_is_valid(v: i64) -> i64
called by 1: main
102func trust_store_alloc(max_n: i64) -> *TrustStore
114func trust_store_count(store: *TrustStore) -> i64
called by 215: mainmainmainmainmainmain+209
120func trust_store_add(store: *TrustStore, buf: *u8, cert: *X509Cert) -> i64
138func trust_store_lookup_by_subject(
156func main() -> i64