Build certificate path (discovery to a trust anchor, signatures NOT checked)
build_certificate_pathDiscovers which intermediate certificates a chain needs by building a structural path from a leaf certificate to your trust anchors. It reports the path found without verifying signatures.
Instructions
Path discovery only (RFC 5280 §6 path building): walks from leaf through the untrusted candidates to one of YOUR trustAnchors under the structural rules evaluated at at (validity, basic constraints, key usage, name constraints, the policy inputs; purposes steer discovery but the leaf's extended key usage is judged by verify_certificate_chain, not here) and reports the path it found, leaf first up to the anchor. NO signature is verified: the engine marks every link PKI_REASON_SIGNATURE_NOT_CHECKED, so valid is always false and the verdict of this tool is found (a path reached an anchor, structuralReasons empty); the leaf alone with PKI_REASON_NO_TRUST_ANCHOR when none did. Use it to learn which intermediates a chain needs, then validate_certificate_path (ordered path, signatures) or verify_certificate_chain (the full verdict with revocation). Never isError for a negative result. Pin at for a reproducible, cacheable result. Token-frugal: verbosity:'summary' (found, structuralReasonCodes, pathLength).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| at | No | The instant the verdict is evaluated at. An ISO 8601 date-time (UTC unless zoned; e.g. 2027-01-01T00:00:00Z), epoch milliseconds as digits, or 'now'. Omitted: PKINATIVE_MCP_AT when the operator pinned it, else the wall clock (a clock-dependent result is never cached). | |
| leaf | Yes | The end-entity certificate to start from: exactly one of pem / derBase64 / path. | |
| fields | No | Dot-paths to keep after verbosity (arrays map over elements); unmatched paths land in _meta.unmatchedFields. | |
| limits | No | Raise pkinative's 22 named security bounds for this call (trusted input only; absent keys keep the engine defaults). A value above an operator ceiling (PKINATIVE_MCP_MAX_INPUT_BYTES, PKINATIVE_MCP_MAX_KDF_ITERATIONS, PKINATIVE_MCP_MAX_PATHS_EXPLORED) is LIMIT_CEILING_EXCEEDED; describe_engine lists the defaults and the ceilings. | |
| policy | No | RFC 5280 §6.1.1 policy inputs. | |
| strict | No | Escalate the first engine warning to a PKI_STRICT_DIAGNOSTIC error instead of listing it in diagnostics[]. | |
| pemMode | No | 'strict' (RFC 7468 exactly, default) or 'lax' (tolerates whitespace, line length and RFC 1421 headers). | strict |
| purposes | No | Extended key usages the leaf must allow: serverAuth, clientAuth, codeSigning, emailProtection, timeStamping, ocspSigning, any, or a dotted OID. | |
| verbosity | No | 'summary' keeps the scalar fields only (token-frugal). | full |
| candidates | No | Untrusted intermediate certificates the path may use (every PEM block of every item is taken). Optional; the certificates embedded in a CMS message are also candidates. | |
| trustAnchors | Yes | Trust anchors (root certificates you trust) (every PEM block of every item is taken). At least one is required: a verdict is relative to the anchors you name. | |
| encodingRules | No | 'der' (strict X.690 DER, default) or 'ber' (indefinite / non-minimal lengths and constructed strings, as legacy CMS producers write). | der |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | The path found, leaf first, up to (and including) the trust anchor; the leaf alone (with the reason) when no anchor was reached. | |
| found | No | A path from the leaf to one of the trust anchors was found and passes the structural rules (structuralReasons empty). This is the verdict of THIS tool; the signatures are not checked. | |
| valid | No | The engine verdict — always false here, because no signature was verified (PKI_REASON_SIGNATURE_NOT_CHECKED on every link). Read `found`. | |
| reasons | No | Why the verdict is negative (empty when valid): the engine PKI_REASON_* codes, each with the standard it cites and the path of the offending element. A reason is returned, never thrown. | |
| explored | No | Candidate paths explored (bounded by limits.maxPathsExplored). | |
| pathLength | No | ||
| diagnostics | No | Non-fatal concerns the engine raised (PKI_DIAG_*, de-duplicated, at most 200; explain_code explains one). | |
| evaluatedAt | No | The ISO instant used — re-pass it as `at` to reproduce the result. | |
| reasonCodes | No | ||
| diagnosticCount | No | ||
| diagnosticCounts | No | Occurrences per diagnostic code. | |
| evaluatedAtSource | No | ||
| signaturesChecked | No | Always false: run validate_certificate_path or verify_certificate_chain for the signatures. | |
| structuralReasons | No | reasons[] without the PKI_REASON_SIGNATURE_NOT_CHECKED markers: what actually stopped the walk (empty when found). | |
| diagnosticsTruncated | No | true when distinct diagnostics beyond the 200 listed were dropped. | |
| structuralReasonCodes | No |