@blamejs/pki 0.5.39 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,7 +4,29 @@ All notable changes to `@blamejs/pki` are documented here. The format
4
4
  follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this
5
5
  project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## v0.5.39 — 2026-08-30
7
+ ## v0.6.1 — 2026-08-30
8
+
9
+ pki.ct verifies all of a certificate's SCTs against a trusted log-list and renders a certificate-level Certificate Transparency verdict, and pki.path.validate gains an optional CT gate.
10
+
11
+ ### Added
12
+
13
+ - pki.ct.verifySctList(entry, list, logList, opts?) renders a certificate-level Certificate Transparency verdict (RFC 6962 sec. 3.3) over the set of SCTs a certificate carries, rather than one SCT at a time. It verifies each SCT against the trusted log-list through the same signature check pki.ct.verifySct applies, and reports how many distinct trusted logs verified an SCT (validScts, so a duplicated SCT cannot inflate the count), from how many distinct trusted log operators (operatorCount and operators), and whether that meets the CT policy. The policy is minScts and minOperators, both defaulting to the RFC floor of one valid SCT; the distinct-operator requirement is a browser CT policy layered on top of the RFC, so the caller sets the threshold and the verdict surfaces the counts. A policy shortfall is a verdict (policyOk: false), not an error, and a per-SCT trust or signature failure is recorded in its result row rather than sinking the verdict; only a mis-shaped entry, list, logList, or opts throws a typed CtError.
14
+ - pki.ct.x509CertEntry(cert, issuer) reconstructs the precertificate log entry from a final certificate that carries embedded SCTs (RFC 6962 sec. 3.2), the piece the embedded-SCT verification path needs end to end. It removes the signedCertificateTimestampList extension from the certificate's TBSCertificate by byte surgery, leaving every other byte of the CA-signed structure intact, and computes issuerKeyHash as SHA-256 of the issuer's SubjectPublicKeyInfo. The returned entry feeds pki.ct.verifySctList or pki.ct.reconstructSignedData directly.
15
+ - pki.path.validate accepts an optional Certificate Transparency gate: pass ctLogList (a pki.ct.parseLogList result) and ctPolicy ({ minScts, minOperators }) to verify the target certificate's embedded SCTs against the trusted log-list as part of path validation. The verdict carries a ct check on the target certificate's checks; a target that declares a CT policy but carries no SCT-list extension fails closed, and an SCT dated after the validation time (opts.time) is rejected rather than counted (RFC 6962 sec. 5.2, a client rejects a future-dated SCT). Callers that pass neither option are unaffected.
16
+
17
+ ## v0.6.0 — 2026-08-30
18
+
19
+ The toolkit's public APIs graduate to stable, and pki.ocsp.verifyRequest verifies a signed OCSP request for responder implementers.
20
+
21
+ ### Added
22
+
23
+ - pki.ocsp.verifyRequest(request, opts?) verifies a signed OCSP request (RFC 6960 sec. 4.1.1) for a responder implementer. It checks the requestor's signature over the exact tbsRequest under the public key of the requestor certificate embedded in the request, or supplied through opts.certs when the request carries none, using the same signature engine pki.ocsp.verify applies to a response. The verdict is { signed, signatureValid, signerCert, signerCerts, certs, signerSubject, requestorName, requestList, requestExtensions, version, reason }. Signing a request is optional under RFC 6960, so an unsigned request reports signed:false rather than an error, and signatureValid speaks only to the cryptographic check. Because the request's certificate field is unordered and a key may appear under an expired certificate beside its renewal, signerCerts lists every certificate whose key verified the signature, while certs is every parseable certificate the request carried, including intermediates that do not sign; the responder passes certs as the candidate pool to pki.path.build to discover and validate a trusted path to a signerCerts entry, confirms that certificate asserts digitalSignature keyUsage (RFC 5280 sec. 4.2.1.3, since it signed the request), then binds its subject to the identity expected, rather than depending on the position of the single signerCert.
24
+
25
+ ### Changed
26
+
27
+ - The public APIs that previously carried an experimental status are now stable and covered by the stable-upgrade policy: a deprecation warning ships at least one minor release before any removal, and a minor release makes no silent breaking change. The graduation bar is a settled governing standard, a wire format proven correct, and a frozen public surface. Where a surface graduates without fully meeting that bar, the relaxation is named here. On interop: pki.tls certificate compression (RFC 8879), pki.ocsp.verifyRequest, and the CMC surface (pki.cmc and pki.schema.cmc, RFC 5272) have no independent implementation in the interop harness, so their own decoders are their only cross-check. On the shared network transport: the EST (pki.est), ACME (pki.acme), and networked CMP (pki.cmp) clients and pki.path.build's opt-in AIA fetching compose the shared node:https transport (pki.transport), whose fail-closed contract still gains requirements as each client composes it. On the governing standard: pki.schema.c509 tracks the draft-ietf-cose-cbor-encoded-cert Internet-Draft, Certificate Transparency tracks the Experimental RFC 6962 (the standardized CT v2 is RFC 9162), composite post-quantum signature support tracks the LAMPS composite-signature drafts, and Sigstore bundle verification tracks the evolving Sigstore bundle spec rather than a settled RFC. On surface stability: pki.lint ships a representative CA/Browser Forum Baseline Requirements subset that will gain rules over time, pki.webauthn.verifyAssertion's verdict shape is frozen as of this release and grows only additively, and pki.hpke wires the classical DHKEM modes with the post-quantum modes added later. In each case the public surface is stable, and any change a later standard revision, an added rule, or continued transport hardening requires is handled under the deprecation policy.
28
+
29
+ ## v0.5.39 — 2026-08-29
8
30
 
9
31
  pki.cmc.build and pki.cmp.build verify an embedded PKCS#10 request's proof-of-possession and refuse one whose self-signature does not verify.
10
32
 
package/README.md CHANGED
@@ -192,10 +192,11 @@ var ok = await subtle.verify({ name: "ML-DSA-65" }, kp.publicKey, sig, data); /
192
192
 
193
193
  ## What ships today
194
194
 
195
- Everything below is callable now; nothing is a stub. The core codec and the
196
- certificate-reading surface are stable under the deprecation policy; the rest
197
- carries a per-primitive `@status` on its wiki page, and
198
- [LTS-CALENDAR.md](LTS-CALENDAR.md) explains what experimental excludes. The
195
+ Everything below is callable now; nothing is a stub. The whole documented
196
+ surface is stable under the deprecation policy: a deprecation warning ships at
197
+ least one minor release before any removal, and a minor release makes no silent
198
+ breaking change. Each primitive's `@status` appears on its wiki page, and
199
+ [LTS-CALENDAR.md](LTS-CALENDAR.md) explains the status lifecycle. The
199
200
  table is an index — the per-function reference, generated from the source
200
201
  comment blocks, is at [pkijs.com](https://pkijs.com).
201
202
 
@@ -240,8 +241,8 @@ comment blocks, is at [pkijs.com](https://pkijs.com).
240
241
  | `pki.cms` | CMS signing, verification, encryption, and compression (RFC 5652). `sign(content, signers, opts)` produces a SignedData (§5), attached or detached, with one or many signers over RSA, RSASSA-PSS, ECDSA, EdDSA, the post-quantum ML-DSA-44/65/87 (RFC 9882) and SLH-DSA (all twelve FIPS 205 sets, RFC 9814), and composite ML-DSA pairing ML-DSA with a traditional RSA, ECDSA, or EdDSA key (accepted only when both components verify, draft-ietf-lamps-cms-composite-sigs). It builds the signed attributes (content-type, message-digest, signing-time) as canonical DER, signs the exact §5.4 preimage, and emits a DER `Buffer` or PEM. The content may also be an async iterable of byte chunks, which signs a large detached payload without holding it in memory: the payload is hashed incrementally under every signer's digest algorithm in one pass, and `verify` accepts the same streamed form as its `content` option. A signer may also be key-only — `{ key, spki, keyIdentifier }` with no certificate — which RFC 5272 §3.2 requires when a Full PKI Request's signer is the key of a certification request that request carries: the signer identifier takes the subjectKeyIdentifier form carrying the identifier the request declares, the signature scheme resolves from the request's own public key, and no certificate is embedded. `verify(input, opts)` parses a SignedData over the strict `pki.schema.cms` codec, locates each SignerInfo's signer certificate by its issuerAndSerialNumber or subjectKeyIdentifier, and checks the signature over the exact §5.4 preimage: with signed attributes present it confirms the message-digest attribute equals the content digest and verifies over the DER re-encoding of the SignedAttributes (the on-wire `[0]` tag replaced by a universal SET OF), and otherwise directly over the content. It returns a per-signer verdict with the matched signer certificate. `valid` and `trusted` are separate claims and neither implies the other: a SignedData carries its own certificates, so `valid` says the signature is sound under one of them and nothing about who signed, while `trusted` says every signer chained to a root named in `opts.trustAnchors`, validated through the same RFC 5280 path engine `pki.path.validate` uses. Without anchors there is nothing to chain to and `trusted` is `false`; anchors that cannot be read throw, rather than reading as untrusted. An unrecognized option is refused rather than ignored. `countersign(cms, signers, opts)` adds a countersignature (§11.4) — a `SignerInfo` over the countersigned SignerInfo's signature value, any signer algorithm, nestable, with the primary bytes preserved so it still verifies — attached as the id-countersignature unsigned attribute; `verify` returns each countersignature's verdict under `signers[i].countersignatures` and every unsigned attribute — including an RFC 3161 timestamp token, attachable via `sign`'s `unsignedAttributes` — under `signers[i].unsignedAttrs`, surfaced unauthenticated. `encrypt(content, recipients, opts)` produces an EnvelopedData, AuthEnvelopedData (AES-GCM, the authenticated default), or EncryptedData, with recipients auto-dispatched off the certificate key to key transport (RSAES-OAEP; v1.5 is never emitted), key agreement (ephemeral-static ECDH over P-256/384/521 with the X9.63 KDF, and X25519/X448 with HKDF), symmetric key wrap, password (PBKDF2 with RFC 3211 PWRI-KEK), or the post-quantum ML-KEM KEMRecipientInfo (RFC 9629/9936), wrapping one fresh content key for every recipient. The content may also be an async iterable of byte chunks, streamed through the AES-GCM or AES-CBC content cipher so a large plaintext is encrypted without being buffered whole; the ciphertext is assembled before the definite-length encryptedContent is emitted, byte-for-byte the buffered form. `decrypt(input, keyMaterial, opts)` recovers the content through the matching arm and returns it with an `authenticated` flag; every secret-dependent failure collapses to one uniform `cms/decrypt-failed` verdict (Bleichenbacher, EFAIL, and password-oracle freedom), and PKCS#1 v1.5 is decrypt-only under the RFC 3218 implicit-rejection countermeasure. With `opts.stream: true` the recovered `content` is an async iterable of plaintext chunks instead of a single Buffer, for a payload too large to hold whole; the authenticated modes (AuthEnvelopedData, AuthenticatedData, AES-GCM) verify integrity before the iterable yields, so a forged message throws before any plaintext is exposed, while a CBC EnvelopedData or EncryptedData yields the plaintext as the cipher produces it. Every key-establishment secret the toolkit allocates is wiped once used, on the failing path as well as the succeeding one: the KEM shared secret and its derived key-encryption key, the raw ECDH / X25519 / X448 agreement secret, a password-derived key-encryption key, and the content-encryption key itself, cleared once the message is complete since all recipients share it. Caller-supplied key material is never written to (best-effort; NIST SP 800-227 §4.2, RFC 9629 §7). `authenticate(content, recipients, opts)` produces an `id-ct-authData` (§9): cleartext content plus an HMAC-SHA-256/384/512 MAC, authenticated but not encrypted, with the fresh MAC key wrapped for every recipient through the same RecipientInfo model. The MAC covers the authenticated attributes (content-type and message-digest) re-tagged to the EXPLICIT SET OF (§9.2), or the content octets directly; `decrypt` recovers the MAC key, recomputes the MAC and independently the message-digest (§9.3), and releases the content only after both pass, with every secret-dependent failure collapsing to the uniform `cms/decrypt-failed`. `compress(content, opts)` and `decompress(input, opts)` produce and consume a CompressedData (RFC 3274; ZLIB, version 0, id-alg-zlibCompress); decompress bounds the uncompressed output at 16 MiB and stops before it is materialized, so a decompression bomb fails closed as `cms/decompress-too-large`. Compression is a size transform with no integrity or confidentiality (RFC 8551 §2.4.5). Fail-closed with typed `cms/*` errors — `sign`, `verify`, `countersign`, `encrypt`, `authenticate`, `decrypt`, `compress`, `decompress` |
241
242
  | `pki.smime` | S/MIME message assembly, verification, encryption, and compression over the CMS layer (RFC 8551). `sign(content, signers, opts)` wraps a MIME entity in either form: `multipart/signed`, where the content stays readable in any MUA and a detached CMS SignedData rides alongside as `application/pkcs7-signature` with a matching `micalg`, or `application/pkcs7-mime; smime-type=signed-data`, where the whole entity is a base64 CMS SignedData. The signed bytes are the entity's §3.1.1 canonical form with CRLF line endings, and `verify(message, opts)` unwraps both forms and recomputes over the same canonicalizer, so a transport that re-wraps line endings still verifies while a tampered part fails. `encrypt(content, recipients, opts)` envelopes a MIME entity as an opaque `application/pkcs7-mime` message and `decrypt(message, keyMaterial, opts)` opens one, as `smime-type=authEnveloped-data` (AES-GCM, confidentiality and integrity, the default) or `smime-type=enveloped-data` (AES-CBC, confidentiality only, so `decrypt` reports `authenticated: false`, the §3.3 no-integrity caveat). The `smime-type` is derived from the CMS body rather than the header, and decryption is fail-closed and oracle-free. The crypto is entirely `pki.cms.sign` / `verify` / `encrypt` / `decrypt`, so it is algorithm-agnostic: any RSA / RSASSA-PSS / ECDSA / EdDSA / ML-DSA / SLH-DSA signer and any RSA-OAEP / ECDH / X25519 / X448 / AES-KW / PBKDF2 / ML-KEM recipient carries through. As with `cms.verify`, `verify` returns the per-signer verdict plus the recovered content, and `valid` and `trusted` are separate claims: `valid` says the signature is sound under a certificate the message carried, `trusted` says every signer chained to a root named in `opts.trustAnchors`. Anchoring here is validated for email at both ends of the chain — the signer certificate must carry `emailProtection` (RFC 8551 §4.4.4) and the anchor's own trust metadata must permit that purpose, since a root can be distrusted for email while remaining a good TLS root. Override either with `requiredEku` / `checkPurpose`. `compress(content, opts)` and `decompress(message, opts)` add the opaque `application/pkcs7-mime; smime-type=compressed-data; name=smime.p7z` frame (§3.6, RFC 3274), a size transform with no integrity or confidentiality (§2.4.5), bounded against a bomb; the recovered content, which may itself be signed or enveloped, is returned for the caller to re-verify. Header protection (RFC 9788): `sign` and `encrypt` take `opts.protectHeaders`, which inlines the caller's `opts.headers` on the Cryptographic Payload root (its Content-Type gaining `hp="clear"` when signed or `hp="cipher"` when encrypted) so the CMS signature or encryption covers them, defeating a transport that rewrites or reads Subject, From, and the rest. `verify` and `decrypt` surface the authenticated inner set as `protectedHeaders` plus `headerProtection { present, mode, fromMismatch, confidential, legacy }`, so a tampered outer header cannot alter it and `fromMismatch` flags an outer From that disagrees. Encryption applies a Header Confidentiality Policy: the default `hcp_baseline` obscures the outer Subject to `[...]` and removes Comments and Keywords, so the real values live only in the ciphertext, and `decrypt` recovers them. Every emitted header routes through a fail-closed injection guard that rejects a CR, LF, or NUL value and a non-ftext name, and a malformed or contradictory `hp` wrap fails closed as `smime/bad-header-protection` rather than silently downgrading. The CMS crypto is unchanged. Inbound legacy RFC 8551 header protection is recognized opt-in: `verify` and `decrypt` with `opts.legacyHeaderProtection` detect a legacy `message/rfc822`-wrapped payload by the RFC 9788 §4.10.1 four-condition identification and surface the inner headers under `headerProtection.legacy = { headers, mode, fromMismatch, confidential }`, where `headers` is an ordered `[{ name, value }]` array retaining legally repeated fields such as `Received`. Those never appear in `protectedHeaders` and never set `present: true`. Because a legacy message is structurally indistinguishable from an ordinary forwarded `message/rfc822`, this is an explicit heuristic (§4.10.2, "no strong end-to-end guarantees"): a caller keying trust off `present` or `protectedHeaders` is never misled, and only one that explicitly reads `headerProtection.legacy.headers` and cross-checks `legacy.fromMismatch` consumes it. It is off by default, and a nested crypto layer, an inner `hp=`, a non-`message/rfc822` payload, or a duplicate Content-Type reports `legacy: null`. Bidirectionally interoperable with `openssl smime` and `openssl cms`. Fail-closed with typed `smime/*` errors — `sign`, `verify`, `encrypt`, `decrypt`, `compress`, `decompress` |
242
243
  | `pki.tsp` | Time-Stamp Protocol (RFC 3161). `sign(messageImprint, tsa, opts)` produces a TimeStampToken: a CMS SignedData over `pki.cms.sign` whose content is a `TSTInfo` carrying the timestamped message imprint, the TSA policy, a serial number, and `genTime` with optional accuracy, nonce, and ordering, plus the §2.4.2 signing-certificate attribute binding the token to the TSA certificate (SHA-2 imprints, any `pki.cms.sign` TSA key). `request` and `parseRequest` build and parse the TimeStampReq a client sends (imprint, requested policy, nonce, certReq); `response` and `parseResponse` handle the TimeStampResp a TSA returns, either a granted status wrapping a token or a rejection with PKIStatus and failure info, with the §2.4.2 status-to-token coupling enforced in both directions. `verify(token, data, opts)` verifies a token fail-closed: the CMS signature over the exact signed bytes, the message imprint recomputed from the data, the TSTInfo content type, the ESSCertID(V2) binding to the TSA certificate, the §2.3 critical timeStamping-only extendedKeyUsage, the request nonce when used, and, with a trust anchor supplied, full certification-path validation of the TSA certificate at the token's `genTime` — judged under the `timeStamping` purpose, so an anchor's own per-purpose trust metadata reaches the decision rather than sitting inert. It returns `{ valid, trusted, genTime, serialNumber, tstInfo, ... }`, where `trusted` is the separate claim that the authority chained to an anchor you named: without one there is nothing to chain to and it is `false`, which is the distinction a timestamp re-read years later turns on — `sign`, `request`, `parseRequest`, `response`, `parseResponse`, `verify` |
243
- | `pki.ocsp` | Online Certificate Status Protocol (RFC 6960), both the responder and relying-party surface. `buildRequest(query, opts)` builds an OCSPRequest for one or more `{ cert, issuer }` pairs, with the CertID hashed under SHA-1 by default per the RFC 5019 lightweight profile or under SHA-2, plus an optional RFC 9654 nonce and an optional requestor signature. `sign(responseData, responder, opts)` produces a signed BasicOCSPResponse over the exact `ResponseData` DER, from the issuing CA directly or a delegated responder, under any `pki.cms.sign` key including the post-quantum ML-DSA and SLH-DSA sets, with `good`, `revoked` (reason and time), or `unknown` per-certificate status. `buildErrorResponse(status)` produces the unsigned §2.3 error (`tryLater`, `unauthorized`, and the rest). `verify(response, opts)` verifies a response fail-closed against the same hardened gates `pki.path.ocspChecker` runs: the CertID binding, responder authorization (the issuing CA, or a CA-issued delegate bearing id-kp-OCSPSigning and id-pkix-ocsp-nocheck and passing the full out-of-path certificate gates), the signature over `tbsResponseDataBytes`, currency against `thisUpdate` and `nextUpdate`, and the request-nonce echo. It returns `{ status: "good" / "revoked" / "unknown", ... }` and never silently accepts. Transport-free — `buildRequest`, `sign`, `buildErrorResponse`, `verify` |
244
- | `pki.ct` | Certificate Transparency (RFC 6962). `parseSctList` decodes the `SignedCertificateTimestampList` a certificate or OCSP response carries, a TLS-presentation-language payload inside the §3.3 double DER wrap, into per-SCT log id, exact `timestamp` (BigInt), named signature algorithm, and raw signature. `reconstructSignedData` rebuilds the exact `digitally-signed` preimage, and `verifySct` verifies an SCT signature against a log's public key, routing an ECDSA signature through the strict DER-conformance gate and verifying through the crypto engine, resolving true or false and throwing a typed error on a structural fault. On the producing side, `encodeSctList` builds the extension value byte for byte as the exact inverse of `parseSctList`, and `signSct` performs a log's signing step. For trust, `parseLogList` ingests the CT log-list JSON into constraint-carrying trusted logs, recomputing each log's id as SHA-256 of its key and refusing a disagreeing id (a swapped key, §3.2) and decoding the state and temporal-interval constraints; `verifySctWithLogList` resolves the log key from an SCT's log id, enforces the state (usable, qualified, and readonly trusted; retired only before retirement; pending and rejected refused) and the temporal-interval window, then delegates the signature check to `verifySct`. `verifyLogListSignature(json, signature, publicKey)` verifies the detached `log_list.sig` over the raw log-list bytes against a caller-pinned signer key (RSASSA-PKCS1-v1.5/SHA-256 and an EC P-256 arm, with forgeable-key defenses failing closed), cross-checked against `openssl dgst`. `fetchLogList(opts)` turns that chain into a live client: it GETs the `log_list.json` and its detached `log_list.sig` over `pki.transport`, verifies the detached signature over the raw fetched bytes against a caller-pinned distributor key before parsing, so an unverified document is never parsed, read, cached, or surfaced, then ingests the same bytes through `parseLogList` and returns the trusted-log set plus the surfaced `version` and `timestamp`. The toolkit bakes in no vendor URL or key, TLS trust is explicit with `rejectUnauthorized` always on, each response is size-capped before the trust chain, and the transport is injectable so the whole path is testable offline — `parseSctList`, `reconstructSignedData`, `verifySct`, `encodeSctList`, `signSct`, `parseLogList`, `verifySctWithLogList`, `verifyLogListSignature`, `fetchLogList` |
244
+ | `pki.ocsp` | Online Certificate Status Protocol (RFC 6960), both the responder and relying-party surface. `buildRequest(query, opts)` builds an OCSPRequest for one or more `{ cert, issuer }` pairs, with the CertID hashed under SHA-1 by default per the RFC 5019 lightweight profile or under SHA-2, plus an optional RFC 9654 nonce and an optional requestor signature. `sign(responseData, responder, opts)` produces a signed BasicOCSPResponse over the exact `ResponseData` DER, from the issuing CA directly or a delegated responder, under any `pki.cms.sign` key including the post-quantum ML-DSA and SLH-DSA sets, with `good`, `revoked` (reason and time), or `unknown` per-certificate status. `buildErrorResponse(status)` produces the unsigned §2.3 error (`tryLater`, `unauthorized`, and the rest). `verify(response, opts)` verifies a response fail-closed against the same hardened gates `pki.path.ocspChecker` runs: the CertID binding, responder authorization (the issuing CA, or a CA-issued delegate bearing id-kp-OCSPSigning and id-pkix-ocsp-nocheck and passing the full out-of-path certificate gates), the signature over `tbsResponseDataBytes`, currency against `thisUpdate` and `nextUpdate`, and the request-nonce echo. It returns `{ status: "good" / "revoked" / "unknown", ... }` and never silently accepts. `verifyRequest(request, opts)` is the responder-side inverse of `buildRequest`: it verifies a client's signed request (RFC 6960 §4.1.1) under the requestor certificate the request carries, trying each embedded certificate since the field is unordered, and reports `signed`, `signatureValid`, every certificate whose key verified (`signerCerts`, so a key carried under an expired certificate beside its renewal is not hidden behind ordering) with the first one's decoded subject, the full embedded certificate bag (`certs`, including intermediates for path building), and the request's CertIDs; an unsigned request is reported with `signed: false` rather than refused. Transport-free — `buildRequest`, `sign`, `buildErrorResponse`, `verify`, `verifyRequest` |
245
+ | `pki.ct` | Certificate Transparency (RFC 6962). `parseSctList` decodes the `SignedCertificateTimestampList` a certificate or OCSP response carries, a TLS-presentation-language payload inside the §3.3 double DER wrap, into per-SCT log id, exact `timestamp` (BigInt), named signature algorithm, and raw signature. `reconstructSignedData` rebuilds the exact `digitally-signed` preimage, and `verifySct` verifies an SCT signature against a log's public key, routing an ECDSA signature through the strict DER-conformance gate and verifying through the crypto engine, resolving true or false and throwing a typed error on a structural fault. On the producing side, `encodeSctList` builds the extension value byte for byte as the exact inverse of `parseSctList`, and `signSct` performs a log's signing step. For trust, `parseLogList` ingests the CT log-list JSON into constraint-carrying trusted logs, recomputing each log's id as SHA-256 of its key and refusing a disagreeing id (a swapped key, §3.2) and decoding the state and temporal-interval constraints; `verifySctWithLogList` resolves the log key from an SCT's log id, enforces the state (usable, qualified, and readonly trusted; retired only before retirement; pending and rejected refused) and the temporal-interval window, then delegates the signature check to `verifySct`. `verifyLogListSignature(json, signature, publicKey)` verifies the detached `log_list.sig` over the raw log-list bytes against a caller-pinned signer key (RSASSA-PKCS1-v1.5/SHA-256 and an EC P-256 arm, with forgeable-key defenses failing closed), cross-checked against `openssl dgst`. `fetchLogList(opts)` turns that chain into a live client: it GETs the `log_list.json` and its detached `log_list.sig` over `pki.transport`, verifies the detached signature over the raw fetched bytes against a caller-pinned distributor key before parsing, so an unverified document is never parsed, read, cached, or surfaced, then ingests the same bytes through `parseLogList` and returns the trusted-log set plus the surfaced `version` and `timestamp`. Above the per-SCT layer, `verifySctList` renders a certificate-level verdict over every SCT a certificate carries (§3.3), reporting how many distinct trusted logs verified an SCT (so a duplicated SCT cannot inflate the count) and from how many distinct trusted operators against a caller's CT policy (`minScts` and `minOperators`, both defaulting to the RFC floor of one), where a policy shortfall is a verdict and a per-SCT failure is a recorded row rather than a thrown call; `x509CertEntry` reconstructs the precertificate log entry from a final certificate by removing the SCT-list extension from its TBSCertificate as byte surgery, so its embedded SCTs verify end to end (§3.2). The toolkit bakes in no vendor URL or key, TLS trust is explicit with `rejectUnauthorized` always on, each response is size-capped before the trust chain, and the transport is injectable so the whole path is testable offline — `parseSctList`, `reconstructSignedData`, `verifySct`, `encodeSctList`, `signSct`, `parseLogList`, `verifySctWithLogList`, `verifySctList`, `x509CertEntry`, `verifyLogListSignature`, `fetchLogList` |
245
246
  | `pki.merkle` | Merkle-tree proof verification (RFC 6962 / RFC 9162). `leafHash`, `nodeHash`, and `emptyRootHash` build the domain-separated (0x00 leaf, 0x01 node) SHA-256 tree hashes. `verifyInclusion` folds an audit proof back to a root, and `verifyConsistency` reconstructs both the old and new root, which is the append-only guarantee; each is constant-time-compared to a trusted checkpoint root. Fail-closed on bad geometry, sync hashing, transport-free — `leafHash`, `nodeHash`, `emptyRootHash`, `verifyInclusion`, `verifyConsistency` |
246
247
  | `pki.trust` | Mozilla and CCADB trust-store ingestion. `parseCertdata` reads the NSS `certdata.txt` object stream and `parseCcadbCsv` the CCADB CSV export, both into one constraint-carrying anchor shape: the per-purpose trust bits, where only `CKT_NSS_TRUSTED_DELEGATOR` grants, and the per-purpose distrust-after dates the bare root list omits. Certificate and trust objects pair by byte-exact issuer and serial rather than adjacency and are cross-checked against the parsed DER, so metadata cannot attach to the wrong root. `anchor()` hands an entry to `pki.path.validate({ trustAnchor, checkPurpose })`. Offline, fail-closed, bounded — `parseCertdata`, `parseCcadbCsv`, `anchor` |
247
248
  | `pki.shbs` | Stateful hash-based signature verification: HSS/LMS (RFC 8554), carried in X.509 by RFC 9802 and in CMS by RFC 9708, profiled by NIST SP 800-208 for CNSA 2.0 firmware signing. `verify` checks an HSS signature, where every level must pass, and `verifyLms` a single-tree LMS, over the raw public-key and signature blobs the parsers already surface. Pure public-input SHA-256 and SHAKE256 hashing, a data-driven typecode registry, and bounds-before-slice reads; a malformed blob throws a typed `ShbsError` while a well-formed but wrong signature returns `false`. Verification only by design, since stateful signing needs atomic one-time-key state that belongs in an HSM — `verify`, `verifyLms` |
package/lib/acme.js CHANGED
@@ -502,7 +502,7 @@ var TRANSITIONS = {
502
502
  * @primitive pki.acme.assertTransition
503
503
  * @signature pki.acme.assertTransition(kind, from, to) -> void
504
504
  * @since 0.1.25
505
- * @status experimental
505
+ * @status stable
506
506
  * @spec RFC 8555
507
507
  * @related pki.acme.validate
508
508
  *
@@ -534,7 +534,7 @@ var ERROR_NAMESPACE = "urn:ietf:params:acme:error:";
534
534
  * @primitive pki.acme.validateProblem
535
535
  * @signature pki.acme.validateProblem(obj) -> obj
536
536
  * @since 0.1.25
537
- * @status experimental
537
+ * @status stable
538
538
  * @spec RFC 8555, RFC 7807, RFC 9773
539
539
  * @related pki.acme.validate
540
540
  *
@@ -571,7 +571,7 @@ function validateProblem(obj) {
571
571
  * @primitive pki.acme.validate
572
572
  * @signature pki.acme.validate(kind, obj) -> obj
573
573
  * @since 0.1.25
574
- * @status experimental
574
+ * @status stable
575
575
  * @spec RFC 8555, RFC 9773
576
576
  * @related pki.acme.identify, pki.acme.validateProblem
577
577
  *
@@ -603,7 +603,7 @@ function validate(kind, obj) {
603
603
  * @primitive pki.acme.identify
604
604
  * @signature pki.acme.identify(obj) -> string
605
605
  * @since 0.1.25
606
- * @status experimental
606
+ * @status stable
607
607
  * @spec RFC 8555, RFC 9773
608
608
  * @related pki.acme.validate
609
609
  *
@@ -648,7 +648,7 @@ async function _sha256(bytes) { return Buffer.from(await subtle.digest("SHA-256"
648
648
  * @primitive pki.acme.keyAuthorization
649
649
  * @signature pki.acme.keyAuthorization(token, accountJwk) -> Promise<string>
650
650
  * @since 0.1.25
651
- * @status experimental
651
+ * @status stable
652
652
  * @spec RFC 8555, RFC 7638
653
653
  * @related pki.acme.http01, pki.acme.dns01, pki.acme.tlsAlpn01Extension
654
654
  *
@@ -673,7 +673,7 @@ async function keyAuthorization(token, accountJwk) {
673
673
  * @primitive pki.acme.http01
674
674
  * @signature pki.acme.http01(token, accountJwk) -> Promise<{ path, body }>
675
675
  * @since 0.1.25
676
- * @status experimental
676
+ * @status stable
677
677
  * @spec RFC 8555
678
678
  * @related pki.acme.keyAuthorization
679
679
  *
@@ -697,7 +697,7 @@ async function http01(token, accountJwk) {
697
697
  * @primitive pki.acme.dns01
698
698
  * @signature pki.acme.dns01(token, accountJwk, domain) -> Promise<{ name, value }>
699
699
  * @since 0.1.25
700
- * @status experimental
700
+ * @status stable
701
701
  * @spec RFC 8555
702
702
  * @related pki.acme.keyAuthorization
703
703
  *
@@ -732,7 +732,7 @@ var _extCtx = { E: function (c, m, cause) { return new AcmeError(c, m, cause); }
732
732
  * @primitive pki.acme.tlsAlpn01Extension
733
733
  * @signature pki.acme.tlsAlpn01Extension(token, accountJwk) -> Promise<Buffer>
734
734
  * @since 0.1.25
735
- * @status experimental
735
+ * @status stable
736
736
  * @spec RFC 8737
737
737
  * @related pki.acme.verifyTlsAlpn01
738
738
  *
@@ -768,7 +768,7 @@ function _readAcmeIdentifier(extnValue) {
768
768
  * @primitive pki.acme.verifyTlsAlpn01
769
769
  * @signature pki.acme.verifyTlsAlpn01(certDer, token, accountJwk, identifier) -> Promise<void>
770
770
  * @since 0.1.25
771
- * @status experimental
771
+ * @status stable
772
772
  * @spec RFC 8737, RFC 8738
773
773
  * @related pki.acme.tlsAlpn01Extension
774
774
  *
@@ -868,7 +868,7 @@ function _signOuter(o, payloadObj) {
868
868
  * @primitive pki.acme.postAsGet
869
869
  * @signature pki.acme.postAsGet(opts) -> Promise<object>
870
870
  * @since 0.1.25
871
- * @status experimental
871
+ * @status stable
872
872
  * @spec RFC 8555
873
873
  * @related pki.acme.newOrder
874
874
  *
@@ -912,7 +912,7 @@ function _assertContacts(contacts) {
912
912
  * @primitive pki.acme.newAccount
913
913
  * @signature pki.acme.newAccount(opts) -> Promise<object>
914
914
  * @since 0.1.25
915
- * @status experimental
915
+ * @status stable
916
916
  * @spec RFC 8555
917
917
  * @related pki.acme.externalAccountBinding
918
918
  *
@@ -955,7 +955,7 @@ var _HMAC_HASH = { HS256: "SHA-256", HS384: "SHA-384", HS512: "SHA-512" };
955
955
  * @primitive pki.acme.externalAccountBinding
956
956
  * @signature pki.acme.externalAccountBinding(opts) -> Promise<object>
957
957
  * @since 0.1.25
958
- * @status experimental
958
+ * @status stable
959
959
  * @spec RFC 8555
960
960
  * @related pki.acme.newAccount
961
961
  *
@@ -1019,7 +1019,7 @@ function _validateOrderIdentifier(id) {
1019
1019
  * @primitive pki.acme.newOrder
1020
1020
  * @signature pki.acme.newOrder(opts) -> Promise<object>
1021
1021
  * @since 0.1.25
1022
- * @status experimental
1022
+ * @status stable
1023
1023
  * @spec RFC 8555, RFC 9773
1024
1024
  * @related pki.acme.finalize, pki.acme.ariCertId
1025
1025
  *
@@ -1049,7 +1049,7 @@ function newOrder(o) {
1049
1049
  * @primitive pki.acme.newAuthz
1050
1050
  * @signature pki.acme.newAuthz(opts) -> flattened JWS
1051
1051
  * @since 0.3.29
1052
- * @status experimental
1052
+ * @status stable
1053
1053
  * @spec RFC 8555, RFC 8555 sec. 7.4.1
1054
1054
  * @related pki.acme.newOrder, pki.acme.client
1055
1055
  *
@@ -1288,7 +1288,7 @@ function _assertCsrIdentifiers(parsedCsr, identifiers) {
1288
1288
  * @primitive pki.acme.finalize
1289
1289
  * @signature pki.acme.finalize(opts) -> Promise<object>
1290
1290
  * @since 0.1.25
1291
- * @status experimental
1291
+ * @status stable
1292
1292
  * @spec RFC 8555
1293
1293
  * @related pki.acme.newOrder
1294
1294
  *
@@ -1326,7 +1326,7 @@ async function finalize(o) {
1326
1326
  * @primitive pki.acme.challengeResponse
1327
1327
  * @signature pki.acme.challengeResponse(opts) -> Promise<object>
1328
1328
  * @since 0.1.25
1329
- * @status experimental
1329
+ * @status stable
1330
1330
  * @spec RFC 8555
1331
1331
  * @related pki.acme.http01, pki.acme.dns01
1332
1332
  *
@@ -1356,7 +1356,7 @@ function challengeResponse(o) {
1356
1356
  * @primitive pki.acme.deactivate
1357
1357
  * @signature pki.acme.deactivate(opts) -> Promise<object>
1358
1358
  * @since 0.1.25
1359
- * @status experimental
1359
+ * @status stable
1360
1360
  * @spec RFC 8555
1361
1361
  * @related pki.acme.validate
1362
1362
  *
@@ -1382,7 +1382,7 @@ function deactivate(o) {
1382
1382
  * @primitive pki.acme.revokeCert
1383
1383
  * @signature pki.acme.revokeCert(opts) -> Promise<object>
1384
1384
  * @since 0.1.25
1385
- * @status experimental
1385
+ * @status stable
1386
1386
  * @spec RFC 8555, RFC 5280
1387
1387
  * @related pki.acme.ariCertId
1388
1388
  *
@@ -1428,7 +1428,7 @@ function revokeCert(o) {
1428
1428
  * @primitive pki.acme.keyChange
1429
1429
  * @signature pki.acme.keyChange(opts) -> Promise<object>
1430
1430
  * @since 0.1.25
1431
- * @status experimental
1431
+ * @status stable
1432
1432
  * @spec RFC 8555
1433
1433
  * @related pki.acme.newAccount
1434
1434
  *
@@ -1472,7 +1472,7 @@ async function keyChange(o) {
1472
1472
  * @primitive pki.acme.ariCertId
1473
1473
  * @signature pki.acme.ariCertId(certDer) -> string
1474
1474
  * @since 0.1.25
1475
- * @status experimental
1475
+ * @status stable
1476
1476
  * @spec RFC 9773
1477
1477
  * @related pki.acme.parseAriCertId, pki.acme.newOrder
1478
1478
  *
@@ -1510,7 +1510,7 @@ function ariCertId(certDer) {
1510
1510
  * @primitive pki.acme.parseAriCertId
1511
1511
  * @signature pki.acme.parseAriCertId(certId) -> { keyIdentifier, serial }
1512
1512
  * @since 0.1.25
1513
- * @status experimental
1513
+ * @status stable
1514
1514
  * @spec RFC 9773
1515
1515
  * @related pki.acme.ariCertId
1516
1516
  *
@@ -1536,7 +1536,7 @@ function parseAriCertId(certId) {
1536
1536
  * @primitive pki.acme.validateRenewalInfo
1537
1537
  * @signature pki.acme.validateRenewalInfo(obj) -> obj
1538
1538
  * @since 0.1.25
1539
- * @status experimental
1539
+ * @status stable
1540
1540
  * @spec RFC 9773
1541
1541
  * @related pki.acme.validate
1542
1542
  *
@@ -2173,7 +2173,7 @@ function _parseLinkAlternates(headers, base) {
2173
2173
  * @primitive pki.acme.client
2174
2174
  * @signature pki.acme.client(directoryUrl, opts) -> client
2175
2175
  * @since 0.3.18
2176
- * @status experimental
2176
+ * @status stable
2177
2177
  * @spec RFC 8555, RFC 8737, RFC 8738, RFC 9773
2178
2178
  * @related pki.acme.newOrder, pki.transport.https
2179
2179
  *
package/lib/cmc-verify.js CHANGED
@@ -282,7 +282,7 @@ function _governingStatus(statuses, outcome) {
282
282
  * @primitive pki.cmc.verify
283
283
  * @signature pki.cmc.verify(response, sent?) -> Promise<verdict>
284
284
  * @since 0.4.16
285
- * @status experimental
285
+ * @status stable
286
286
  * @spec RFC 5272, RFC 5273, RFC 6402
287
287
  * @defends cmc-response-replay (CWE-294)
288
288
  * @related pki.schema.cmc.parse, pki.path.validate, pki.cms.verify
@@ -688,7 +688,7 @@ function _shape(body, sent, signatureVerified, bound) {
688
688
  * @primitive pki.cmc.build
689
689
  * @signature pki.cmc.build(spec, signer, opts?) -> Promise<Buffer|string>
690
690
  * @since 0.4.16
691
- * @status experimental
691
+ * @status stable
692
692
  * @spec RFC 5272, RFC 6402
693
693
  * @defends enrollment-request-substitution (CWE-345)
694
694
  * @related pki.cmc.verify, pki.schema.cmc.parse, pki.cms.sign
package/lib/cmp-build.js CHANGED
@@ -1138,7 +1138,7 @@ function wellKnownUrl(base, opts) {
1138
1138
  * @primitive pki.cmp.transfer
1139
1139
  * @signature pki.cmp.transfer(url, message, opts?) -> Promise<{ response, responseBytes, status, contentType, tls }>
1140
1140
  * @since 0.3.19
1141
- * @status experimental
1141
+ * @status stable
1142
1142
  * @spec RFC 9811, RFC 9810
1143
1143
  * @related pki.cmp.build, pki.cmp.wellKnownUrl, pki.schema.cmp.parse, pki.transport.https
1144
1144
  *
@@ -1181,7 +1181,7 @@ function wellKnownUrl(base, opts) {
1181
1181
  * @primitive pki.cmp.wellKnownUrl
1182
1182
  * @signature pki.cmp.wellKnownUrl(base, opts?) -> string
1183
1183
  * @since 0.3.19
1184
- * @status experimental
1184
+ * @status stable
1185
1185
  * @spec RFC 9811, RFC 8615
1186
1186
  * @related pki.cmp.transfer
1187
1187
  *
@@ -390,7 +390,7 @@ function _certConfHash(certDer) {
390
390
  * @primitive pki.cmp.session
391
391
  * @signature pki.cmp.session(opts) -> session
392
392
  * @since 0.3.27
393
- * @status experimental
393
+ * @status stable
394
394
  * @spec RFC 9810, RFC 9811, RFC 9483
395
395
  * @related pki.cmp.build, pki.cmp.verify, pki.cmp.transfer
396
396
  *