@blamejs/pki 0.5.39 → 0.6.0
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 +13 -1
- package/README.md +6 -5
- package/lib/acme.js +23 -23
- package/lib/cmc-verify.js +2 -2
- package/lib/cmp-build.js +2 -2
- package/lib/cmp-session.js +1 -1
- package/lib/ct.js +9 -9
- package/lib/est.js +11 -11
- package/lib/hpke.js +4 -4
- package/lib/http-transport.js +1 -1
- package/lib/lint.js +3 -3
- package/lib/ocsp-request-verify.js +28 -0
- package/lib/ocsp.js +156 -0
- package/lib/path-validate.js +6 -1
- package/lib/schema-c509.js +2 -2
- package/lib/schema-cmc.js +3 -3
- package/lib/sigstore.js +3 -3
- package/lib/webauthn.js +3 -3
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,19 @@ 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.
|
|
7
|
+
## v0.6.0 — 2026-08-30
|
|
8
|
+
|
|
9
|
+
The toolkit's public APIs graduate to stable, and pki.ocsp.verifyRequest verifies a signed OCSP request for responder implementers.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- 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.
|
|
18
|
+
|
|
19
|
+
## v0.5.39 — 2026-08-29
|
|
8
20
|
|
|
9
21
|
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
22
|
|
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
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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,7 +241,7 @@ 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.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` |
|
|
244
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`. 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` |
|
|
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` |
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1184
|
+
* @status stable
|
|
1185
1185
|
* @spec RFC 9811, RFC 8615
|
|
1186
1186
|
* @related pki.cmp.transfer
|
|
1187
1187
|
*
|
package/lib/cmp-session.js
CHANGED
|
@@ -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
|
|
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
|
*
|
package/lib/ct.js
CHANGED
|
@@ -154,7 +154,7 @@ function _parseSct(r, sctLen) {
|
|
|
154
154
|
* @primitive pki.ct.parseSctList
|
|
155
155
|
* @signature pki.ct.parseSctList(extValue) -> { scts, unknownScts, all }
|
|
156
156
|
* @since 0.1.20
|
|
157
|
-
* @status
|
|
157
|
+
* @status stable
|
|
158
158
|
* @spec RFC 6962, RFC 5246, RFC 8446
|
|
159
159
|
* @related pki.ct.reconstructSignedData, pki.ct.encodeSctList, pki.schema.x509.parse
|
|
160
160
|
*
|
|
@@ -252,7 +252,7 @@ function _u24Bytes(n) {
|
|
|
252
252
|
* @primitive pki.ct.reconstructSignedData
|
|
253
253
|
* @signature pki.ct.reconstructSignedData(entry, sct) -> Buffer
|
|
254
254
|
* @since 0.1.20
|
|
255
|
-
* @status
|
|
255
|
+
* @status stable
|
|
256
256
|
* @spec RFC 6962
|
|
257
257
|
* @related pki.ct.parseSctList
|
|
258
258
|
*
|
|
@@ -378,7 +378,7 @@ function _spkiAlg(spki) {
|
|
|
378
378
|
* @primitive pki.ct.verifySct
|
|
379
379
|
* @signature pki.ct.verifySct(entry, sct, logPublicKey) -> Promise<boolean>
|
|
380
380
|
* @since 0.2.12
|
|
381
|
-
* @status
|
|
381
|
+
* @status stable
|
|
382
382
|
* @spec RFC 6962
|
|
383
383
|
* @defends sct-signature-forgery (CWE-347)
|
|
384
384
|
* @related pki.ct.parseSctList, pki.ct.reconstructSignedData
|
|
@@ -498,7 +498,7 @@ function _encodeSctBody(sct) {
|
|
|
498
498
|
* @primitive pki.ct.encodeSctList
|
|
499
499
|
* @signature pki.ct.encodeSctList(scts) -> Buffer
|
|
500
500
|
* @since 0.2.24
|
|
501
|
-
* @status
|
|
501
|
+
* @status stable
|
|
502
502
|
* @spec RFC 6962, RFC 5246
|
|
503
503
|
* @related pki.ct.parseSctList, pki.ct.signSct
|
|
504
504
|
*
|
|
@@ -573,7 +573,7 @@ function _logKeyMaterial(logKey) {
|
|
|
573
573
|
* @primitive pki.ct.signSct
|
|
574
574
|
* @signature pki.ct.signSct(entry, logKey, opts?) -> Promise<sct>
|
|
575
575
|
* @since 0.2.24
|
|
576
|
-
* @status
|
|
576
|
+
* @status stable
|
|
577
577
|
* @spec RFC 6962
|
|
578
578
|
* @related pki.ct.verifySct, pki.ct.reconstructSignedData, pki.ct.encodeSctList
|
|
579
579
|
*
|
|
@@ -723,7 +723,7 @@ function _logsAgree(a, b) {
|
|
|
723
723
|
* @primitive pki.ct.parseLogList
|
|
724
724
|
* @signature pki.ct.parseLogList(json, opts?) -> { logs, byLogId, version, timestamp }
|
|
725
725
|
* @since 0.2.28
|
|
726
|
-
* @status
|
|
726
|
+
* @status stable
|
|
727
727
|
* @spec RFC 6962
|
|
728
728
|
* @related pki.ct.verifySctWithLogList, pki.ct.verifySct
|
|
729
729
|
*
|
|
@@ -815,7 +815,7 @@ function _resolveNotAfter(entry, opts) {
|
|
|
815
815
|
* @primitive pki.ct.verifySctWithLogList
|
|
816
816
|
* @signature pki.ct.verifySctWithLogList(entry, sct, logList, opts?) -> Promise<boolean>
|
|
817
817
|
* @since 0.2.28
|
|
818
|
-
* @status
|
|
818
|
+
* @status stable
|
|
819
819
|
* @spec RFC 6962
|
|
820
820
|
* @related pki.ct.parseLogList, pki.ct.verifySct
|
|
821
821
|
*
|
|
@@ -878,7 +878,7 @@ async function verifySctWithLogList(entry, sct, logList, opts) {
|
|
|
878
878
|
* @primitive pki.ct.verifyLogListSignature
|
|
879
879
|
* @signature pki.ct.verifyLogListSignature(json, signature, publicKey) -> Promise<boolean>
|
|
880
880
|
* @since 0.2.29
|
|
881
|
-
* @status
|
|
881
|
+
* @status stable
|
|
882
882
|
* @spec RFC 6962, RFC 8017
|
|
883
883
|
* @related pki.ct.parseLogList, pki.ct.verifySct
|
|
884
884
|
*
|
|
@@ -1019,7 +1019,7 @@ function _fetchBody(transport, url, req, label) {
|
|
|
1019
1019
|
* @primitive pki.ct.fetchLogList
|
|
1020
1020
|
* @signature pki.ct.fetchLogList(opts) -> Promise<{ logs, byLogId, version, timestamp, raw, status, contentType, tls }>
|
|
1021
1021
|
* @since 0.3.21
|
|
1022
|
-
* @status
|
|
1022
|
+
* @status stable
|
|
1023
1023
|
* @spec RFC 6962
|
|
1024
1024
|
* @related pki.ct.parseLogList, pki.ct.verifyLogListSignature, pki.ct.verifySctWithLogList
|
|
1025
1025
|
*
|
package/lib/est.js
CHANGED
|
@@ -162,7 +162,7 @@ function _knownOpts(opts, known, verb) {
|
|
|
162
162
|
* @primitive pki.est.transferDecode
|
|
163
163
|
* @signature pki.est.transferDecode(body) -> Buffer
|
|
164
164
|
* @since 0.1.24
|
|
165
|
-
* @status
|
|
165
|
+
* @status stable
|
|
166
166
|
* @spec RFC 8951, RFC 4648
|
|
167
167
|
* @related pki.est.transferEncode
|
|
168
168
|
*
|
|
@@ -200,7 +200,7 @@ function transferDecode(body) {
|
|
|
200
200
|
* @primitive pki.est.transferEncode
|
|
201
201
|
* @signature pki.est.transferEncode(der) -> string
|
|
202
202
|
* @since 0.1.24
|
|
203
|
-
* @status
|
|
203
|
+
* @status stable
|
|
204
204
|
* @spec RFC 8951, RFC 4648
|
|
205
205
|
* @related pki.est.transferDecode
|
|
206
206
|
*
|
|
@@ -389,7 +389,7 @@ function splitMultipartMixed(body, contentType) {
|
|
|
389
389
|
* @primitive pki.est.parseCertsOnly
|
|
390
390
|
* @signature pki.est.parseCertsOnly(der) -> { certificates, crls }
|
|
391
391
|
* @since 0.1.24
|
|
392
|
-
* @status
|
|
392
|
+
* @status stable
|
|
393
393
|
* @spec RFC 7030, RFC 5272, RFC 5652
|
|
394
394
|
* @related pki.est.findIssuedCert, pki.schema.cms.parse
|
|
395
395
|
*
|
|
@@ -695,7 +695,7 @@ var NOT_IMPLEMENTED_OPS = { fullcmc: 1 };
|
|
|
695
695
|
* @primitive pki.est.classifyResponse
|
|
696
696
|
* @signature pki.est.classifyResponse(status, headers, body, opts?) -> verdict
|
|
697
697
|
* @since 0.1.24
|
|
698
|
-
* @status
|
|
698
|
+
* @status stable
|
|
699
699
|
* @spec RFC 7030, RFC 8951
|
|
700
700
|
* @related pki.est.paths, pki.est.parseCertsOnly
|
|
701
701
|
*
|
|
@@ -796,7 +796,7 @@ function classifyResponse(status, headers, body, opts) {
|
|
|
796
796
|
* @primitive pki.est.paths
|
|
797
797
|
* @signature pki.est.paths(baseUrl, opts?) -> { cacerts, simpleenroll, ... }
|
|
798
798
|
* @since 0.1.24
|
|
799
|
-
* @status
|
|
799
|
+
* @status stable
|
|
800
800
|
* @spec RFC 7030
|
|
801
801
|
* @related pki.est.classifyResponse
|
|
802
802
|
*
|
|
@@ -1310,7 +1310,7 @@ function _certsResult(op, res, opts, csrSpki) {
|
|
|
1310
1310
|
* @primitive pki.est.fullcmc
|
|
1311
1311
|
* @signature pki.est.fullcmc(baseUrl, request, opts?) -> Promise<verdict | { retry, retryAfterSeconds }>
|
|
1312
1312
|
* @since 0.4.16
|
|
1313
|
-
* @status
|
|
1313
|
+
* @status stable
|
|
1314
1314
|
* @spec RFC 7030, RFC 8951, RFC 5273, RFC 5272
|
|
1315
1315
|
* @related pki.cmc.build, pki.cmc.verify, pki.est.simpleenroll
|
|
1316
1316
|
*
|
|
@@ -2024,7 +2024,7 @@ function _enroll(op, baseUrl, csrInput, opts) {
|
|
|
2024
2024
|
* @primitive pki.est.cacerts
|
|
2025
2025
|
* @signature pki.est.cacerts(baseUrl, opts?) -> Promise<{ certificates, crls } | { retry, retryAfterSeconds }>
|
|
2026
2026
|
* @since 0.3.16
|
|
2027
|
-
* @status
|
|
2027
|
+
* @status stable
|
|
2028
2028
|
* @spec RFC 7030, RFC 8951
|
|
2029
2029
|
* @related pki.est.simpleenroll, pki.transport.https
|
|
2030
2030
|
*
|
|
@@ -2068,7 +2068,7 @@ function cacerts(baseUrl, opts) {
|
|
|
2068
2068
|
* @primitive pki.est.simpleenroll
|
|
2069
2069
|
* @signature pki.est.simpleenroll(baseUrl, csr, opts?) -> Promise<{ certificate, chain, certificates } | { retry, retryAfterSeconds }>
|
|
2070
2070
|
* @since 0.3.16
|
|
2071
|
-
* @status
|
|
2071
|
+
* @status stable
|
|
2072
2072
|
* @spec RFC 7030, RFC 5272
|
|
2073
2073
|
* @related pki.csr.sign, pki.est.simplereenroll, pki.est.cacerts
|
|
2074
2074
|
*
|
|
@@ -2106,7 +2106,7 @@ function simpleenroll(baseUrl, csrInput, opts) {
|
|
|
2106
2106
|
* @primitive pki.est.simplereenroll
|
|
2107
2107
|
* @signature pki.est.simplereenroll(baseUrl, csr, opts?) -> Promise<{ certificate, chain, certificates } | { retry, retryAfterSeconds }>
|
|
2108
2108
|
* @since 0.3.16
|
|
2109
|
-
* @status
|
|
2109
|
+
* @status stable
|
|
2110
2110
|
* @spec RFC 7030
|
|
2111
2111
|
* @related pki.est.simpleenroll, pki.est.reenrollGuard
|
|
2112
2112
|
*
|
|
@@ -2285,7 +2285,7 @@ async function _serverkeygenResult(res, opts, derived) {
|
|
|
2285
2285
|
* @primitive pki.est.serverkeygen
|
|
2286
2286
|
* @signature pki.est.serverkeygen(baseUrl, csr, opts?) -> Promise<{ certificates, privateKey } | { certificates, encryptedKey } | { retry, retryAfterSeconds, retryAfterDate }>
|
|
2287
2287
|
* @since 0.3.28
|
|
2288
|
-
* @status
|
|
2288
|
+
* @status stable
|
|
2289
2289
|
* @spec RFC 7030, RFC 8951
|
|
2290
2290
|
* @related pki.est.simpleenroll, pki.est.parseServerKeygenResponse
|
|
2291
2291
|
*
|
|
@@ -2364,7 +2364,7 @@ function _csrattrsResult(res, opts) {
|
|
|
2364
2364
|
* @primitive pki.est.csrattrs
|
|
2365
2365
|
* @signature pki.est.csrattrs(baseUrl, opts?) -> Promise<{ available: true, attrs, plan } | { available: false, attrs: null }>
|
|
2366
2366
|
* @since 0.3.28
|
|
2367
|
-
* @status
|
|
2367
|
+
* @status stable
|
|
2368
2368
|
* @spec RFC 7030, RFC 8951, RFC 9908
|
|
2369
2369
|
* @related pki.est.simpleenroll, pki.est.buildEnrollAttributes
|
|
2370
2370
|
*
|
package/lib/hpke.js
CHANGED
|
@@ -455,7 +455,7 @@ var suites = {
|
|
|
455
455
|
* @primitive pki.hpke.setupS
|
|
456
456
|
* @signature pki.hpke.setupS(suiteIds, recipientPublicKey, opts?) -> { enc, context }
|
|
457
457
|
* @since 0.2.2
|
|
458
|
-
* @status
|
|
458
|
+
* @status stable
|
|
459
459
|
* @spec RFC 9180
|
|
460
460
|
* @related pki.hpke.setupR, pki.hpke.seal
|
|
461
461
|
*
|
|
@@ -495,7 +495,7 @@ function _setupS(ids, pkR, opts) {
|
|
|
495
495
|
* @primitive pki.hpke.setupR
|
|
496
496
|
* @signature pki.hpke.setupR(suiteIds, enc, recipientPrivateKey, opts?) -> context
|
|
497
497
|
* @since 0.2.2
|
|
498
|
-
* @status
|
|
498
|
+
* @status stable
|
|
499
499
|
* @spec RFC 9180
|
|
500
500
|
* @related pki.hpke.setupS, pki.hpke.open
|
|
501
501
|
*
|
|
@@ -538,7 +538,7 @@ function _setupR(ids, enc, skR, opts) {
|
|
|
538
538
|
* @primitive pki.hpke.seal
|
|
539
539
|
* @signature pki.hpke.seal(suiteIds, recipientPublicKey, opts, aad, pt) -> { enc, ct }
|
|
540
540
|
* @since 0.2.2
|
|
541
|
-
* @status
|
|
541
|
+
* @status stable
|
|
542
542
|
* @spec RFC 9180
|
|
543
543
|
* @related pki.hpke.open, pki.hpke.setupS
|
|
544
544
|
*
|
|
@@ -574,7 +574,7 @@ function seal(ids, pkR, opts, aad, pt) {
|
|
|
574
574
|
* @primitive pki.hpke.open
|
|
575
575
|
* @signature pki.hpke.open(suiteIds, enc, recipientPrivateKey, opts, aad, ct) -> pt
|
|
576
576
|
* @since 0.2.2
|
|
577
|
-
* @status
|
|
577
|
+
* @status stable
|
|
578
578
|
* @spec RFC 9180
|
|
579
579
|
* @related pki.hpke.seal, pki.hpke.setupR
|
|
580
580
|
*
|
package/lib/http-transport.js
CHANGED
|
@@ -245,7 +245,7 @@ function _classifyError(e, C) {
|
|
|
245
245
|
* @primitive pki.transport.https
|
|
246
246
|
* @signature pki.transport.https(defaults?) -> transport
|
|
247
247
|
* @since 0.3.16
|
|
248
|
-
* @status
|
|
248
|
+
* @status stable
|
|
249
249
|
* @spec RFC 7030, RFC 8996
|
|
250
250
|
* @defends tls-downgrade (CWE-757), server-impersonation (CWE-297), response-flooding (CWE-770), ssrf (CWE-918)
|
|
251
251
|
* @related pki.est.cacerts, pki.est.simpleenroll
|
package/lib/lint.js
CHANGED
|
@@ -714,7 +714,7 @@ function _applyThreshold(report, severity) {
|
|
|
714
714
|
* @primitive pki.lint.certificate
|
|
715
715
|
* @signature pki.lint.certificate(input, opts?) -> LintReport
|
|
716
716
|
* @since 0.2.10
|
|
717
|
-
* @status
|
|
717
|
+
* @status stable
|
|
718
718
|
* @spec RFC 5280, CA/Browser Forum TLS BR
|
|
719
719
|
* @related pki.schema.x509.parse, pki.inspect.certificate, pki.path.validate
|
|
720
720
|
*
|
|
@@ -772,7 +772,7 @@ function certificate(input, opts) {
|
|
|
772
772
|
* @primitive pki.lint.rules
|
|
773
773
|
* @signature pki.lint.rules(profile?) -> [{id, severity, source, citation}]
|
|
774
774
|
* @since 0.2.10
|
|
775
|
-
* @status
|
|
775
|
+
* @status stable
|
|
776
776
|
* @spec RFC 5280, CA/Browser Forum TLS BR
|
|
777
777
|
*
|
|
778
778
|
* Enumerate the rule registry (all rules, or one profile's). Each entry exposes its
|
|
@@ -790,7 +790,7 @@ function rules(profile) {
|
|
|
790
790
|
* @primitive pki.lint.profiles
|
|
791
791
|
* @signature pki.lint.profiles() -> [string]
|
|
792
792
|
* @since 0.2.10
|
|
793
|
-
* @status
|
|
793
|
+
* @status stable
|
|
794
794
|
* @spec RFC 5280, CA/Browser Forum TLS BR
|
|
795
795
|
*
|
|
796
796
|
* List the known lint-profile names.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (c) blamejs contributors
|
|
3
|
+
"use strict";
|
|
4
|
+
//
|
|
5
|
+
// @internal -- the single signature seam for an inbound signed OCSPRequest (RFC 6960 sec. 4.1.1),
|
|
6
|
+
// composed by pki.ocsp.verifyRequest. It routes the request-signature check through the same
|
|
7
|
+
// certification-path signature engine (its EdDSA low-order-point and algorithm-confusion gates
|
|
8
|
+
// included) that pki.ocsp.verify uses for a response and pki.crl.verify / pki.cms.verify use for
|
|
9
|
+
// theirs, so no second, weaker verifier of an untrusted request can drift. The producing side runs
|
|
10
|
+
// its own check over what it just signed (pki.ocsp.buildRequest's signer path); this is the
|
|
11
|
+
// different question a responder asks about a request someone else produced. The slot, the wiring
|
|
12
|
+
// assertion and the octet-alignment refusal are the shared seam (lib/verify-seam.js). It is not
|
|
13
|
+
// wired into index.js and is reached only by require.
|
|
14
|
+
|
|
15
|
+
var frameworkError = require("./framework-error");
|
|
16
|
+
var seam = require("./verify-seam");
|
|
17
|
+
|
|
18
|
+
var _seam = seam.makeSeam("ocsp-request-verify", frameworkError.OcspError, "ocsp/bad-input");
|
|
19
|
+
|
|
20
|
+
// Verify a signed OCSPRequest's signature over its exact tbsRequest bytes under the SPKI of the
|
|
21
|
+
// requestor certificate the request carries (RFC 6960 sec. 4.1.1). Unlike a CSR there is no
|
|
22
|
+
// self-signature: the verifying key is the requestor's, identified to the responder by
|
|
23
|
+
// requestorName and proven by the certificate embedded in (or supplied alongside) the request.
|
|
24
|
+
function verifyRequestSignature(signatureAlgorithm, signature, signerSpkiBytes, tbsRequestBytes) {
|
|
25
|
+
return _seam.verify(signatureAlgorithm, signature, signerSpkiBytes, tbsRequestBytes);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = { setEngine: _seam.setEngine, verifyRequestSignature: verifyRequestSignature };
|
package/lib/ocsp.js
CHANGED
|
@@ -32,6 +32,7 @@ var ocspSchema = require("./schema-ocsp");
|
|
|
32
32
|
var pathValidate = require("./path-validate");
|
|
33
33
|
var signScheme = require("./sign-scheme");
|
|
34
34
|
var ocspVerify = require("./ocsp-verify");
|
|
35
|
+
var ocspRequestVerify = require("./ocsp-request-verify"); // path-validate (required above) injects its signature engine into this seam at load
|
|
35
36
|
var webcrypto = require("./webcrypto");
|
|
36
37
|
var subtle = webcrypto.webcrypto.subtle;
|
|
37
38
|
var guard = require("./guard-all");
|
|
@@ -579,9 +580,164 @@ function _responseNonce(parsed) {
|
|
|
579
580
|
return null;
|
|
580
581
|
}
|
|
581
582
|
|
|
583
|
+
var _VERIFY_REQUEST_OPTS = { certs: 1 };
|
|
584
|
+
// Parsed from BYTES so the signature, the algorithm that verifies it and the tbsRequest it covers
|
|
585
|
+
// are bound to one byte string, the same discipline pki.ocsp.verify follows for a response. A
|
|
586
|
+
// BufferSource is SNAPSHOT first: parseRequest surfaces tbsRequest / signature / embedded certs as
|
|
587
|
+
// views into it, and the signature check awaits, so without a copy a caller could mutate the buffer
|
|
588
|
+
// mid-verification and be judged on bytes other than the parser read. A PEM string decodes to a
|
|
589
|
+
// fresh buffer already; parseRequest owns that decode and a non-bytes input is its typed refusal.
|
|
590
|
+
function _requestFromBytes(request) {
|
|
591
|
+
if (guard.bytes.isByteSource(request)) request = guard.bytes.snapshotSource(request, OcspError, "ocsp/bad-input", "the OCSP request");
|
|
592
|
+
return ocspSchema.parseRequest(request);
|
|
593
|
+
}
|
|
594
|
+
function _reqVerdict(parsed, extra) {
|
|
595
|
+
return {
|
|
596
|
+
signed: extra.signed, signatureValid: extra.signatureValid,
|
|
597
|
+
signerCert: extra.signerCert != null ? extra.signerCert : null,
|
|
598
|
+
signerCerts: extra.signerCerts != null ? extra.signerCerts : [],
|
|
599
|
+
certs: extra.certs != null ? extra.certs : [],
|
|
600
|
+
signerSubject: extra.signerSubject != null ? extra.signerSubject : null,
|
|
601
|
+
requestorName: parsed.requestorName, requestList: parsed.requestList,
|
|
602
|
+
requestExtensions: parsed.requestExtensions, version: parsed.version,
|
|
603
|
+
reason: extra.reason != null ? extra.reason : null,
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
// Collect EVERY candidate certificate whose key verified the request signature. RFC 6960 sec. 4.1.1
|
|
607
|
+
// certs is an unordered SEQUENCE OF Certificate, and several may share the signing key (an expired
|
|
608
|
+
// certificate carried beside its renewal), so all matches are surfaced rather than one
|
|
609
|
+
// position-dependent pick: the responder builds a trusted path to one of them to select a usable
|
|
610
|
+
// one, and no valid match is hidden behind an unusable one that happened to appear first. `strict` separates the
|
|
611
|
+
// responder's own opts.certs (a malformed entry is its config error, a typed throw) from the
|
|
612
|
+
// request's untrusted embedded certs (a malformed one is skipped, never fatal).
|
|
613
|
+
async function _findRequestSigners(candidates, strict, parsed, sig, sigBits) {
|
|
614
|
+
var parsedList = [];
|
|
615
|
+
for (var i = 0; i < candidates.length; i++) {
|
|
616
|
+
try { parsedList.push({ der: candidates[i], cert: x509.parse(candidates[i]) }); }
|
|
617
|
+
catch (e) { if (strict) throw _err("ocsp/bad-signer-cert", "an opts.certs entry does not parse as an X.509 certificate", e); }
|
|
618
|
+
}
|
|
619
|
+
// The certs surfaced for path building are the PARSEABLE ones: a malformed embedded entry (skipped
|
|
620
|
+
// above rather than fatal) is excluded so it is never handed to pki.path.build as a candidate.
|
|
621
|
+
var parseable = parsedList.map(function (p) { return p.der; });
|
|
622
|
+
// signerCerts is every candidate whose key VERIFIES the request signature, identified by the
|
|
623
|
+
// verification itself rather than by comparing encoded key bytes. A request carries one signature
|
|
624
|
+
// under one key, but that key can appear across several certificates in the unordered certs field
|
|
625
|
+
// (an expired certificate beside its renewal), and the one key can be encoded differently between
|
|
626
|
+
// them -- rsaEncryption with NULL versus absent parameters, an EC point compressed versus
|
|
627
|
+
// uncompressed -- so a byte comparison would drop a genuine match, while a coincidental byte match
|
|
628
|
+
// under a different algorithm would be a false one. Verifying each candidate answers both exactly,
|
|
629
|
+
// through the algorithm-confusion gate (RFC 9814 sec. 4) in the shared engine. The work is bounded:
|
|
630
|
+
// the parser already caps the certificate count at OCSP_MAX_CERTS, and the engine returns false
|
|
631
|
+
// (never throws) for a candidate whose key does not match the signature, so a non-signer is skipped
|
|
632
|
+
// rather than aborting the verdict.
|
|
633
|
+
var matches = [];
|
|
634
|
+
for (var j = 0; j < parsedList.length; j++) {
|
|
635
|
+
if (await ocspRequestVerify.verifyRequestSignature(sig.signatureAlgorithm, sigBits, parsedList[j].cert.subjectPublicKeyInfo.bytes, parsed.tbsRequestBytes)) {
|
|
636
|
+
matches.push({ der: parsedList[j].der, subject: parsedList[j].cert.subject });
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return { matches: matches, parseable: parseable };
|
|
640
|
+
}
|
|
641
|
+
// The verdict from `_findRequestSigners`: signerCerts is every match (so the caller's trust decision
|
|
642
|
+
// does not depend on ordering), signerCert / signerSubject the first for the common single-signer
|
|
643
|
+
// case. `certs` is every PARSEABLE certificate the request carried (or opts.certs supplied), so the
|
|
644
|
+
// responder has the intermediates it needs to chain a signer to an anchor -- those do not sign the
|
|
645
|
+
// request, so they never appear in signerCerts. No match is signatureValid:false with the reason.
|
|
646
|
+
function _signerVerdict(parsed, found, failReason) {
|
|
647
|
+
if (!found.matches.length) return _reqVerdict(parsed, { signed: true, signatureValid: false, certs: found.parseable, reason: failReason });
|
|
648
|
+
return _reqVerdict(parsed, {
|
|
649
|
+
signed: true, signatureValid: true, signerCert: found.matches[0].der,
|
|
650
|
+
signerCerts: found.matches.map(function (m) { return m.der; }), certs: found.parseable,
|
|
651
|
+
signerSubject: { dn: found.matches[0].subject.dn, rdns: found.matches[0].subject.rdns }, reason: null,
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
/**
|
|
656
|
+
* @primitive pki.ocsp.verifyRequest
|
|
657
|
+
* @signature pki.ocsp.verifyRequest(request, opts?) -> Promise<{ signed, signatureValid, signerCert, signerCerts, certs, signerSubject, requestorName, requestList, requestExtensions, version, reason }>
|
|
658
|
+
* @since 0.6.0
|
|
659
|
+
* @status stable
|
|
660
|
+
* @spec RFC 6960
|
|
661
|
+
* @related pki.ocsp.buildRequest, pki.ocsp.verify, pki.schema.ocsp.parseRequest, pki.csr.verify
|
|
662
|
+
*
|
|
663
|
+
* The responder-side counterpart to `pki.ocsp.buildRequest`: verify a client's signed OCSP request
|
|
664
|
+
* (RFC 6960 sec. 4.1.1). Signing a request is OPTIONAL, so an unsigned request is not an error; it is
|
|
665
|
+
* reported with `signed: false` and authenticates no requestor. For a signed request the requestor's
|
|
666
|
+
* signature over the exact `tbsRequest` is checked under the public key of the requestor certificate
|
|
667
|
+
* the request carries, through the same certification-path signature engine `pki.ocsp.verify` uses
|
|
668
|
+
* for a response (with its EdDSA low-order-point and algorithm-confusion gates). `request` is DER
|
|
669
|
+
* `Buffer` / `Uint8Array` or a PEM `OCSP REQUEST` string, parsed from bytes so the signature, its
|
|
670
|
+
* algorithm and the covered `tbsRequest` are one byte string and cannot be split.
|
|
671
|
+
*
|
|
672
|
+
* `signatureValid` means only that a certificate's key made this signature over this request. It
|
|
673
|
+
* says nothing about whether that certificate is trusted: `signerCerts` is every certificate the
|
|
674
|
+
* request carries whose key verified the signature (RFC 6960 sec. 4.1.1 certs is unordered, and a
|
|
675
|
+
* key may appear under an expired certificate beside its renewal), so the responder builds a trusted
|
|
676
|
+
* path to one of them rather than depend on ordering. `signerCert` and the decoded `signerSubject`
|
|
677
|
+
* are the first of those, the common single-signer case. `certs` is every parseable certificate the
|
|
678
|
+
* request carried (or opts.certs supplied), including intermediates that do not sign and so are absent
|
|
679
|
+
* from `signerCerts`: the responder passes it as the `opts.candidates` pool to `pki.path.build`, which
|
|
680
|
+
* discovers and validates the ordered path from a `signerCerts` entry (leaf) up to a trust anchor.
|
|
681
|
+
* The responder then confirms that certificate is authorized to sign the request -- its `keyUsage`,
|
|
682
|
+
* where present, must assert `digitalSignature` (RFC 5280 sec. 4.2.1.3, since the certificate signed
|
|
683
|
+
* the request) -- and compares its subject to the `requestorName` it expects. The decoded
|
|
684
|
+
* `requestList`, `requestExtensions` and `version` are
|
|
685
|
+
* returned so the CertIDs being asked about need no re-parse.
|
|
686
|
+
*
|
|
687
|
+
* @opts
|
|
688
|
+
* - `certs` An array of certificates (DER `Buffer` / `Uint8Array` or PEM strings) supplying the
|
|
689
|
+
* requestor certificate when the request omits its own `certs` (RFC 6960 lets them
|
|
690
|
+
* travel out of band); every entry whose key verifies is surfaced in `signerCerts`,
|
|
691
|
+
* and is ignored when the request embeds its own certificates.
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* var pair = await pki.key.generate("Ed25519");
|
|
695
|
+
* var key = await pki.key.export(pair.privateKey), spki = await pki.key.export(pair.publicKey);
|
|
696
|
+
* var caDer = await pki.x509.sign({ subject: "OCSP CA", subjectPublicKey: spki,
|
|
697
|
+
* notBefore: new Date("2026-01-01T00:00:00Z"), notAfter: new Date("2027-01-01T00:00:00Z") }, { key: key });
|
|
698
|
+
* var request = await pki.ocsp.buildRequest({ cert: caDer, issuer: caDer },
|
|
699
|
+
* { signer: { cert: caDer, key: key }, requestorName: pki.schema.x509.parse(caDer).subject.bytes });
|
|
700
|
+
* var v = await pki.ocsp.verifyRequest(request);
|
|
701
|
+
* // v.signed && v.signatureValid -> for a signerCerts entry, pki.path.build(entry, { candidates:
|
|
702
|
+
* // v.certs, trustAnchors, time }) discovers and validates the path (several signerCerts may share
|
|
703
|
+
* // the key, e.g. an expired one beside its renewal); confirm that entry's keyUsage asserts
|
|
704
|
+
* // digitalSignature, then bind its subject to the requestor you expect before honoring v.requestList.
|
|
705
|
+
*/
|
|
706
|
+
async function verifyRequest(request, opts) {
|
|
707
|
+
opts = guard.identifier.optionsObject(opts, _err, "ocsp/bad-input", "pki.ocsp.verifyRequest options");
|
|
708
|
+
guard.identifier.assertKnownKeys(opts, _VERIFY_REQUEST_OPTS, _err, "ocsp/bad-input",
|
|
709
|
+
"pki.ocsp.verifyRequest has an unknown option (out-of-band requestor certificates are `certs`): ");
|
|
710
|
+
var parsed = _requestFromBytes(request);
|
|
711
|
+
var sig = parsed.optionalSignature;
|
|
712
|
+
if (sig == null) {
|
|
713
|
+
return _reqVerdict(parsed, { signed: false, signatureValid: false,
|
|
714
|
+
reason: "the OCSP request is unsigned (RFC 6960 sec. 4.1.1 makes optionalSignature OPTIONAL); no requestor is authenticated" });
|
|
715
|
+
}
|
|
716
|
+
// sig.signature is the raw signature the parser already refused unless octet-aligned; the seam
|
|
717
|
+
// re-checks alignment, so it is handed the BIT STRING shape the seam verifies.
|
|
718
|
+
var sigBits = { unusedBits: 0, bytes: sig.signature };
|
|
719
|
+
// Prefer the certificates the request carries; fall back to opts.certs only when it carries none.
|
|
720
|
+
if (sig.certs.length) {
|
|
721
|
+
return _signerVerdict(parsed, await _findRequestSigners(sig.certs, false, parsed, sig, sigBits),
|
|
722
|
+
"the OCSP request signature does not verify over tbsRequest under any certificate the request carries (RFC 6960 sec. 4.1.1)");
|
|
723
|
+
}
|
|
724
|
+
var suppliedCerts = [];
|
|
725
|
+
if (opts.certs != null) {
|
|
726
|
+
var list = pkiBuild.reqDenseArray(opts.certs, "opts.certs", _err, "ocsp/bad-input");
|
|
727
|
+
for (var i = 0; i < list.length; i++) suppliedCerts.push(_normCertDer(list[i], "an opts.certs entry"));
|
|
728
|
+
}
|
|
729
|
+
if (!suppliedCerts.length) {
|
|
730
|
+
return _reqVerdict(parsed, { signed: true, signatureValid: false,
|
|
731
|
+
reason: "the signed OCSP request carries no certificate and opts.certs was not supplied, so its signature cannot be verified" });
|
|
732
|
+
}
|
|
733
|
+
return _signerVerdict(parsed, await _findRequestSigners(suppliedCerts, true, parsed, sig, sigBits),
|
|
734
|
+
"the OCSP request signature does not verify over tbsRequest under any opts.certs entry");
|
|
735
|
+
}
|
|
736
|
+
|
|
582
737
|
module.exports = {
|
|
583
738
|
buildRequest: buildRequest,
|
|
584
739
|
sign: sign,
|
|
585
740
|
buildErrorResponse: buildErrorResponse,
|
|
586
741
|
verify: verify,
|
|
742
|
+
verifyRequest: verifyRequest,
|
|
587
743
|
};
|
package/lib/path-validate.js
CHANGED
|
@@ -44,6 +44,7 @@ var crlVerify = require("./crl-verify");
|
|
|
44
44
|
var csrVerify = require("./csr-verify");
|
|
45
45
|
var crmfVerify = require("./crmf-verify");
|
|
46
46
|
var attrcertVerify = require("./attrcert-verify");
|
|
47
|
+
var ocspRequestVerify = require("./ocsp-request-verify");
|
|
47
48
|
var cmpVerify = require("./cmp-verify");
|
|
48
49
|
var cmsVerify = require("./cms-verify");
|
|
49
50
|
var cmpSession = require("./cmp-session");
|
|
@@ -2369,6 +2370,10 @@ crmfVerify.setEngine(_verifyWithSpki);
|
|
|
2369
2370
|
// same way.
|
|
2370
2371
|
attrcertVerify.setEngine(_verifyWithSpki);
|
|
2371
2372
|
|
|
2373
|
+
// And for a signed OCSPRequest (RFC 6960 sec. 4.1.1), so pki.ocsp.verifyRequest checks a requestor's
|
|
2374
|
+
// signature through the same one engine that verifies a response, never a second, weaker request path.
|
|
2375
|
+
ocspRequestVerify.setEngine(_verifyWithSpki);
|
|
2376
|
+
|
|
2372
2377
|
// ---- the OCSP revocation checker (RFC 6960) -------------------------------
|
|
2373
2378
|
|
|
2374
2379
|
// The OCSP response-verification core (responder authorization + CertID binding + currency +
|
|
@@ -3346,7 +3351,7 @@ async function _fetchAiaIssuers(current, aia) {
|
|
|
3346
3351
|
* @primitive pki.path.build
|
|
3347
3352
|
* @signature pki.path.build(leaf, opts) -> Promise<{ valid, path, trustAnchor, result, candidatesConsidered, aiaFetches }>
|
|
3348
3353
|
* @since 0.3.7
|
|
3349
|
-
* @status
|
|
3354
|
+
* @status stable
|
|
3350
3355
|
* @spec RFC 4158, RFC 5280
|
|
3351
3356
|
* @related pki.path.validate, pki.schema.x509.parse, pki.trust.parseCertdata
|
|
3352
3357
|
*
|
package/lib/schema-c509.js
CHANGED
|
@@ -2014,7 +2014,7 @@ function _reconstructDer(r, sigNode) {
|
|
|
2014
2014
|
* @primitive pki.schema.c509.parse
|
|
2015
2015
|
* @signature pki.schema.c509.parse(bytes) -> { certificateType, serialNumber, serialNumberHex, ... }
|
|
2016
2016
|
* @since 0.2.30
|
|
2017
|
-
* @status
|
|
2017
|
+
* @status stable
|
|
2018
2018
|
* @spec draft-ietf-cose-cbor-encoded-cert, RFC 8949, RFC 9090, RFC 5280
|
|
2019
2019
|
*
|
|
2020
2020
|
* Decode a C509 certificate (draft-ietf-cose-cbor-encoded-cert) from its deterministic-CBOR bytes.
|
|
@@ -2274,7 +2274,7 @@ function _encodeC509Array(r) {
|
|
|
2274
2274
|
* @primitive pki.schema.c509.encode
|
|
2275
2275
|
* @signature pki.schema.c509.encode(input[, opts]) -> Buffer
|
|
2276
2276
|
* @since 0.3.4
|
|
2277
|
-
* @status
|
|
2277
|
+
* @status stable
|
|
2278
2278
|
* @spec draft-ietf-cose-cbor-encoded-cert, RFC 8949, RFC 9090
|
|
2279
2279
|
* @related pki.schema.c509.parse
|
|
2280
2280
|
*
|
package/lib/schema-cmc.js
CHANGED
|
@@ -667,7 +667,7 @@ function _finishBody(body, where) {
|
|
|
667
667
|
* @primitive pki.schema.cmc.parsePkiData
|
|
668
668
|
* @signature pki.schema.cmc.parsePkiData(der) -> parsed
|
|
669
669
|
* @since 0.4.16
|
|
670
|
-
* @status
|
|
670
|
+
* @status stable
|
|
671
671
|
* @spec RFC 5272 sec. 3.2.1
|
|
672
672
|
* @related pki.schema.cmc.parse, pki.schema.cmc.parsePkiResponse
|
|
673
673
|
*
|
|
@@ -695,7 +695,7 @@ function parsePkiData(input) {
|
|
|
695
695
|
* @primitive pki.schema.cmc.parsePkiResponse
|
|
696
696
|
* @signature pki.schema.cmc.parsePkiResponse(der) -> parsed
|
|
697
697
|
* @since 0.4.16
|
|
698
|
-
* @status
|
|
698
|
+
* @status stable
|
|
699
699
|
* @spec RFC 5272 sec. 4.2.1
|
|
700
700
|
* @related pki.schema.cmc.parse, pki.schema.cmc.parsePkiData
|
|
701
701
|
*
|
|
@@ -721,7 +721,7 @@ function parsePkiResponse(input) {
|
|
|
721
721
|
* @primitive pki.schema.cmc.parse
|
|
722
722
|
* @signature pki.schema.cmc.parse(input) -> parsed
|
|
723
723
|
* @since 0.4.16
|
|
724
|
-
* @status
|
|
724
|
+
* @status stable
|
|
725
725
|
* @spec RFC 5272, RFC 6402
|
|
726
726
|
* @defends cmc-status-confusion (CWE-20)
|
|
727
727
|
* @related pki.schema.cmc.parsePkiData, pki.schema.cmc.parsePkiResponse, pki.cms.verify
|
package/lib/sigstore.js
CHANGED
|
@@ -104,7 +104,7 @@ function _jsonParse(input, code, label) {
|
|
|
104
104
|
* @primitive pki.sigstore.pae
|
|
105
105
|
* @signature pki.sigstore.pae(payloadType, payloadBytes) -> Buffer
|
|
106
106
|
* @since 0.2.3
|
|
107
|
-
* @status
|
|
107
|
+
* @status stable
|
|
108
108
|
* @spec DSSE
|
|
109
109
|
* @related pki.sigstore.verifyBundle
|
|
110
110
|
*
|
|
@@ -150,7 +150,7 @@ function _b64(s, label) {
|
|
|
150
150
|
* @primitive pki.sigstore.parseBundle
|
|
151
151
|
* @signature pki.sigstore.parseBundle(input) -> bundle
|
|
152
152
|
* @since 0.2.3
|
|
153
|
-
* @status
|
|
153
|
+
* @status stable
|
|
154
154
|
* @spec Sigstore bundle v0.3
|
|
155
155
|
* @related pki.sigstore.verifyBundle
|
|
156
156
|
*
|
|
@@ -637,7 +637,7 @@ function _statement(payload, payloadType, expectedPredicate) {
|
|
|
637
637
|
* @primitive pki.sigstore.verifyBundle
|
|
638
638
|
* @signature pki.sigstore.verifyBundle(bundle, opts) -> Promise<result>
|
|
639
639
|
* @since 0.2.3
|
|
640
|
-
* @status
|
|
640
|
+
* @status stable
|
|
641
641
|
* @spec DSSE, Sigstore bundle v0.3, RFC 9162, SLSA provenance v1
|
|
642
642
|
* @related pki.sigstore.parseBundle, pki.sigstore.pae
|
|
643
643
|
*
|
package/lib/webauthn.js
CHANGED
|
@@ -1939,7 +1939,7 @@ var CLIENT_DATA_TYPE = Object.assign(Object.create(null), { "webauthn.create": 1
|
|
|
1939
1939
|
* @primitive pki.webauthn.parseClientData
|
|
1940
1940
|
* @signature pki.webauthn.parseClientData(bytes, opts?) -> { type, challenge, origin, crossOrigin, topOrigin, checked }
|
|
1941
1941
|
* @since 0.5.0
|
|
1942
|
-
* @status
|
|
1942
|
+
* @status stable
|
|
1943
1943
|
* @spec W3C WebAuthn Level 3 sec. 5.8.1 / 7.1 / 7.2
|
|
1944
1944
|
* @defends webauthn-ceremony-confusion (CWE-345)
|
|
1945
1945
|
* @related pki.webauthn.verify, pki.webauthn.verifyAssertion
|
|
@@ -2126,7 +2126,7 @@ var _CLIENT_DATA_OPTS = Object.assign(Object.create(null), {
|
|
|
2126
2126
|
* @primitive pki.webauthn.parseAuthenticatorData
|
|
2127
2127
|
* @signature pki.webauthn.parseAuthenticatorData(bytes) -> { rpIdHash, flags, signCount, aaguid, credentialId, credentialPublicKey, credentialPublicKeyBytes, extensions }
|
|
2128
2128
|
* @since 0.5.0
|
|
2129
|
-
* @status
|
|
2129
|
+
* @status stable
|
|
2130
2130
|
* @spec W3C WebAuthn Level 3 sec. 6.1
|
|
2131
2131
|
* @related pki.webauthn.verifyAssertion, pki.webauthn.parseAttestationObject
|
|
2132
2132
|
*
|
|
@@ -2164,7 +2164,7 @@ var _ASSERT_OPTS = Object.assign(Object.create(null), {
|
|
|
2164
2164
|
* @primitive pki.webauthn.verifyAssertion
|
|
2165
2165
|
* @signature pki.webauthn.verifyAssertion(input) -> Promise<{ signatureVerified, signCount, signCountChecked, flags, rpIdHash, extensions, bindingChecked, clientData }>
|
|
2166
2166
|
* @since 0.5.0
|
|
2167
|
-
* @status
|
|
2167
|
+
* @status stable
|
|
2168
2168
|
* @spec W3C WebAuthn Level 3 sec. 7.2
|
|
2169
2169
|
* @defends webauthn-assertion-forgery (CWE-347)
|
|
2170
2170
|
* @related pki.webauthn.parseAuthenticatorData, pki.webauthn.verify
|
package/package.json
CHANGED
package/sbom.cdx.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.5",
|
|
5
|
-
"serialNumber": "urn:uuid:
|
|
5
|
+
"serialNumber": "urn:uuid:9aa382b4-23a6-46b3-b0c6-809ac7fb8e71",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-08-
|
|
8
|
+
"timestamp": "2026-08-30T09:44:19.627Z",
|
|
9
9
|
"lifecycles": [
|
|
10
10
|
{
|
|
11
11
|
"phase": "build"
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
}
|
|
20
20
|
],
|
|
21
21
|
"component": {
|
|
22
|
-
"bom-ref": "@blamejs/pki@0.
|
|
22
|
+
"bom-ref": "@blamejs/pki@0.6.0",
|
|
23
23
|
"type": "application",
|
|
24
24
|
"name": "pki",
|
|
25
|
-
"version": "0.
|
|
25
|
+
"version": "0.6.0",
|
|
26
26
|
"scope": "required",
|
|
27
27
|
"author": "blamejs contributors",
|
|
28
28
|
"description": "Pure-JavaScript PKI toolkit that owns its stack — X.509, ASN.1/DER, CMS, PQC-first.",
|
|
29
|
-
"purl": "pkg:npm/%40blamejs/pki@0.
|
|
29
|
+
"purl": "pkg:npm/%40blamejs/pki@0.6.0",
|
|
30
30
|
"properties": [],
|
|
31
31
|
"externalReferences": [
|
|
32
32
|
{
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"components": [],
|
|
55
55
|
"dependencies": [
|
|
56
56
|
{
|
|
57
|
-
"ref": "@blamejs/pki@0.
|
|
57
|
+
"ref": "@blamejs/pki@0.6.0",
|
|
58
58
|
"dependsOn": []
|
|
59
59
|
}
|
|
60
60
|
]
|