@blamejs/pki 0.7.15 → 0.7.17
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 +25 -0
- package/README.md +1 -1
- package/lib/pki-build.js +183 -2
- package/lib/x509-sign.js +48 -1
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ 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.17 — 2026-09-11
|
|
8
|
+
|
|
9
|
+
The certificate-policy machinery can be issued from a plain spec.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- extensions.policyConstraints takes { requireExplicitPolicy, inhibitPolicyMapping } skip counts and extensions.inhibitAnyPolicy takes a bare skip count. RFC 5280 section 4.2.1.11 forbids an empty policy-constraints sequence, so naming neither field is refused, and both extensions are emitted critical, which sections 4.2.1.11 and 4.2.1.14 require. A skip count is held to the same bound the decoders read it back through, so a negative or non-integer value is refused with x509/bad-input or csr/bad-input.
|
|
14
|
+
- extensions.policyMappings takes a list of { issuerDomainPolicy, subjectDomainPolicy }, each naming a registered policy or a dotted OID. A mapping to or from anyPolicy is refused, which RFC 5280 section 4.2.1.5 forbids and which pki.path.validate applies at section 6.1.4(a). That section states a SHOULD for marking the extension critical. The validator processes the extension on an intermediate certificate, applying the mappings to the policy tree, and treats a critical one on the target certificate as unprocessed and rejects it. A spec does not say where the certificate will sit in a chain, so it is emitted non-critical unless policyMappingsCritical is set, the same shape certificatePolicies already uses.
|
|
15
|
+
- extensions.issuerAltName takes the GeneralName forms subjectAltName takes, including a bare string classified into its form, and is emitted non-critical (RFC 5280 section 4.2.1.7).
|
|
16
|
+
- All four are accepted on the pki.csr.sign extensionRequest object as well, so a request and an issued certificate are written the same way. OpenSSL reads each of them back in the release gates, including both policy-constraint skip counts.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- A spec that names an object identifier with a non-string value now raises the signer's own x509/bad-input or csr/bad-input rather than the OID registry's oid/bad-input. This reached certificatePolicies and extendedKeyUsage as well as the new policy mappings, so a caller branching on the documented signer code missed a malformed policy or key-purpose entry. A registered name and a dotted-decimal OID are unaffected, and the already-correct treatment of a lexically-dotted but out-of-range OID is unchanged.
|
|
21
|
+
|
|
22
|
+
## v0.7.16 — 2026-09-11
|
|
23
|
+
|
|
24
|
+
Where to fetch the issuer and the CRL can be named in a plain spec.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- extensions.authorityInfoAccess takes a list of { accessMethod, accessLocation } (RFC 5280 section 4.2.2.1). The method is a registered name such as "ocsp" or "caIssuers", or a dotted OID; the location is a GeneralName in either form the builder accepts, including a bare string classified into its form. An empty list, an unregistered method name, and an entry with no accessLocation are refused with x509/bad-input or csr/bad-input. The extension is emitted non-critical, which that clause requires.
|
|
29
|
+
- extensions.cRLDistributionPoints takes a list of distribution points (RFC 5280 section 4.2.1.13), and extensions.freshestCRL takes the same shape, which section 4.2.1.15 gives it. An entry is either a GeneralName standing for a single fullName, so a list of URL strings is the short form, or { fullName, reasons, cRLIssuer } for the full one. reasons names ReasonFlags bits, whose numbering is not the CRLReason numbering pki.crl.sign takes: section 5.3.1 numbers privilegeWithdrawn 9 and aACompromise 10, while section 4.2.1.13 gives them bits 7 and 8. A distribution point naming only reasons is refused, which section 4.2.1.13 requires, as is an empty list or an unknown reason name. Both are emitted non-critical.
|
|
30
|
+
- All three are accepted on the pki.csr.sign extensionRequest object as well, so a request and an issued certificate are written the same way.
|
|
31
|
+
|
|
7
32
|
## v0.7.15 — 2026-09-11
|
|
8
33
|
|
|
9
34
|
Name constraints can be issued from a plain spec.
|
package/README.md
CHANGED
|
@@ -231,7 +231,7 @@ comment blocks, is at [pkijs.com](https://pkijs.com).
|
|
|
231
231
|
| `pki.schema.cmc` | Decode CMC messages (RFC 5272 as updated by RFC 6402): a Full PKI Request (`PKIData`) or Full PKI Response (`PKIResponse`) riding inside a CMS SignedData, reached by the encapsulated content type (`id-cct-PKIData` / `id-cct-PKIResponse`). Controls are surfaced in wire order with their values raw, so an unrecognized one is data rather than a fault. Tagged requests decode across all three arms. The status verdicts (`CMCStatusInfo` v1 and `CMCStatusInfoV2`) are collected as an ordered list, and the RFC 6402 two-module `OtherStatusInfo` ambiguity — `pendInfo` and `extendedFailInfo` are both untagged SEQUENCEs in the 1988 module, told apart only by their first element — is resolved by inspection and refused when it cannot be told apart. Body-part identity is unique across the whole message rather than per sequence, 0 is reserved as the reference to the enclosing PKIData, and the `reqSequence` bytes are surfaced exactly as they appeared so an Identity Proof witness is computed over the wire bytes. A companion decoder for CMS content rather than an auto-routed format — `parse`, `parsePkiData`, `parsePkiResponse` |
|
|
232
232
|
| `pki.schema.engine` | The declarative ASN.1 structure-schema engine every format parser composes — `walk`, `encode`, `embeddedDer`, and the schema combinators |
|
|
233
233
|
| `pki.path` | Certification-path validation (RFC 5280 §6). `validate` runs the §6.1 state machine over an ordered path and a trust anchor: signature chaining across RSA, ECDSA, EdDSA, ML-DSA, SLH-DSA and hybrid composite ML-DSA (a composite is accepted only when both its post-quantum and traditional components verify), validity windows, name chaining, basic constraints and path length, key usage, name constraints, and the certificate-policy tree. It returns a structured verdict with per-check reason codes and enforces a `pki.trust` anchor's per-purpose distrust-after dates and delegator purposes through `checkPurpose` — an anchor that carries either one with no purpose named to select by is refused as a configuration fault rather than validated as though it carried none. The verdict says what was established. `revocationChecked` takes the weakest outcome on the path: `false` with no checker supplied, `"determined"` when every certificate got an explicit good or revoked answer, `"waived"` when `softFail` turned an undetermined one into a pass, and `"undetermined"` when one could not be answered at all — which includes a checker that throws, a fault `softFail` does not waive because `softFail` opts into an undetermined answer, not into a broken checker. `anchorConstraints` names the purpose the anchor was judged under and whether each of its two constraints applied. `crlChecker` supplies CRL-based revocation, covering partitioned and sharded CRLs, whose §6.3.3 Distribution Point ↔ IDP correspondence lets corresponding shards accumulate reason coverage until all eight revocation reasons are covered, and delta CRLs, merged onto the complete CRL they may be combined with (§5.2.4) so a held certificate its delta releases reads good, while a delta that merges with nothing still reports what it lists and still withholds good. `ocspChecker` supplies OCSP-based revocation (RFC 6960: CertID binding, responder authorization, signature, currency) over the same pluggable hook. `build(leaf, opts)` is the discovering complement (RFC 4158): from a leaf, an untrusted pool of candidate CA certificates, and a trust store, it finds the ordered leaf-to-anchor path `validate` accepts, using name chaining plus the RFC 4158 §3.5 sort hints (an AKI/SKI match, an anchor-adjacent issuer, CA plus keyCertSign, validity at the check time — ordering hints, never filters), a depth-first search with backtracking so the first accepted path wins, and a bounded search (chain-length cap, candidate-expansion cap, identity-tuple visited set) so a cross-certificate cycle or Bridge-CA fan-out terminates deterministically. Every accept flows through `validate`, and its verdict is cross-checked against `openssl verify`. Opt-in AIA `caIssuers` fetching (`opts.fetchAia: true`) discovers a missing intermediate from a certificate's Authority Information Access URL (§4.2.2.1) over `pki.transport`, triggered only on a pool miss and bounded against SSRF and amplification: HTTPS only, a total fetch budget that caps fetching silently rather than throwing, a per-cert URL cap, a build-wide URL dedupe, a response-size and certificate-count cap, no redirect following, and every fault a silent skip. The TLS trust (`opts.tls`) stays distinct from the PKI `trustAnchors`, and every fetched certificate remains untrusted pool material that still flows through `validate` (never a trust anchor). It is off by default, so the default build is byte-identical offline. An `opts.direction` of `"reverse"` searches from a trust anchor toward the leaf (RFC 4158 §3.1), narrower when the anchor set is small and the leaf's issuer options fan out, and `"auto"` picks the direction by first-hop fan-out; reverse building reuses the same pool, visited set, caps, and `validate` gate, so the direction changes only search order, and the anchor is excluded from the returned path. Reverse building is pool-only and does not combine with `fetchAia`. When `opts.userInitialPolicySet` names acceptable certificate-policy OIDs and more than one path validates, build returns the accepted path whose user-constrained policy set best satisfies that set (RFC 4158 §4) rather than the first accepted path, the ranking bounded by the same candidate cap and a malformed set refused with `path/bad-input`; an `anyPolicy` entry is unconstrained and returns the first accepted path. In a mesh of cross-certified domains, where many candidates chain by name to the same place, a candidate is ranked by how many leading relative distinguished names it shares with the name the search is heading for (§3.5.16 and the §3.5.19 reverse method), so a certificate in the target's own domain is tried before one from a cross-certified domain, and forward building sorts a candidate under every candidate that can complete the path when its path length constraint cannot cover the certificates already below it (§3.5.7), an ordering that outranks the other hints rather than competing with them. No candidate is removed and an unbounded search still reaches every path the pool holds; a bounded one spends `maxCandidatesConsidered` on whichever branches the order steers it to. Pure and re-entrant — `validate`, `build`, `crlChecker`, `ocspChecker` |
|
|
234
|
-
| `pki.x509` | Certificate issuance (RFC 5280 §4). `sign(spec, issuer, opts)` builds and signs a certificate from a `spec` of subject (a common-name string, an array of RDNs, or raw Name DER), the public key being certified, the validity window, an optional serial, and an optional `extensions` object. `randomSerial()` draws the same 20-octet CSPRNG serial the signer uses when the spec names none, so a serial can be reserved or logged before the certificate is issued. The `issuer` is a key alone (self-signed: issuer equals subject, signed with that key), a name plus public key plus key, or an issuing certificate plus key. The signature algorithm is resolved from the signing key through the shared registry, so RSA (PKCS#1 v1.5 or PSS via `opts.pss`), ECDSA P-256/384/521, Ed25519, Ed448, ML-DSA-44/65/87, the twelve SLH-DSA sets, and the composite arms all issue without a per-algorithm branch. It encodes basic constraints, key usage, extended key usage, subject and authority key identifiers (the SKI derived by SHA-1 of the subject key), subject alternative names, certificate policies, and
|
|
234
|
+
| `pki.x509` | Certificate issuance (RFC 5280 §4). `sign(spec, issuer, opts)` builds and signs a certificate from a `spec` of subject (a common-name string, an array of RDNs, or raw Name DER), the public key being certified, the validity window, an optional serial, and an optional `extensions` object. `randomSerial()` draws the same 20-octet CSPRNG serial the signer uses when the spec names none, so a serial can be reserved or logged before the certificate is issued. The `issuer` is a key alone (self-signed: issuer equals subject, signed with that key), a name plus public key plus key, or an issuing certificate plus key. The signature algorithm is resolved from the signing key through the shared registry, so RSA (PKCS#1 v1.5 or PSS via `opts.pss`), ECDSA P-256/384/521, Ed25519, Ed448, ML-DSA-44/65/87, the twelve SLH-DSA sets, and the composite arms all issue without a per-algorithm branch. It encodes basic constraints, key usage, extended key usage, subject and authority key identifiers (the SKI derived by SHA-1 of the subject key), subject alternative names, certificate policies, name constraints, authority information access, CRL distribution points, the freshest CRL, issuer alternative names, and the policy machinery path validation acts on (policy constraints, inhibit anyPolicy, policy mappings) from the spec, taking any other extension as pre-encoded DER. `extensions.nameConstraints` takes `{ permitted, excluded }` lists of GeneralName-form objects, restricting what the CA being issued may itself issue; each base is held to the rule for a constraint base, and the extension is emitted critical as §4.2.1.10 requires. It derives the version from the field set and enforces the serial bounds, the UTCTime/GeneralizedTime cutover, the DER default omissions, and the CA cross-field rules; a violation throws a typed `CertificateError`. Returns DER, or a PEM `CERTIFICATE` with `opts.pem`. Every arm is independently verified by OpenSSL. Parsing stays at `pki.schema.x509.parse` — `sign` |
|
|
235
235
|
| `pki.csr` | PKCS#10 certification-request issuance (RFC 2986 / RFC 2985). `sign(spec, key, opts)` builds and signs a `CertificationRequest` from a `spec` of subject (which may be empty), the public key being certified, an optional `extensionRequest` carrying the requested v3 extensions a CA copies into the issued certificate (subject alternative names, key usage, extended key usage, basic constraints, certificate policies, subject key identifier, or an array of pre-encoded Extension DER), and an optional `challengePassword`. `key` (or `{ key }`) is the subject's own private key: the request is self-signed to prove possession of the private half of `subjectPublicKey`, and that proof is verified before the request is returned, which is what `openssl req -verify` checks. The signature algorithm is resolved from the subject key, so RSA (PKCS#1 v1.5 or PSS via `opts.pss`), ECDSA, EdDSA, ML-DSA, SLH-DSA, and the composite arms all sign without a per-algorithm branch. Returns DER, or a PEM `CERTIFICATE REQUEST` with `opts.pem`; malformed input throws a typed `CsrError`. `verify(request)` asks the same question of a request someone else produced, over its exact signed `certificationRequestInfo` bytes under the `subjectPKInfo` inside them, through the one path-validation signature engine. It answers `{ verified, subject, subjectPublicKeyInfo, attributes, certificationRequestInfoBytes }`, all re-derived from the signed bytes, so a CA issues from the fields the signature covers rather than from the object it passed in. A `verified: true` says the producer held that private key and that the subject and requested extensions are the ones they signed; who they are is the enrollment protocol's question, not this one. Parsing stays at `pki.schema.csr.parse` — `sign`, `verify` |
|
|
236
236
|
| `pki.attrcert` | Attribute-certificate issuance (RFC 5755). `sign(spec, issuer, opts)` builds and signs an `AttributeCertificate` as an Attribute Authority: a `spec` of `holder` (exactly one of an entity name, a `baseCertificateID` reference, a `fromCertificate` binding, or an object digest), the validity window as GeneralizedTime, an optional serial (positive, at most 20 octets, randomly generated when omitted), the `attributes` (role, clearance, group, chargingIdentity, accessIdentity, authenticationInfo, or pre-encoded Attribute DER), and optional `extensions` (auditIdentity, targetInformation, noRevAvail, aaControls, acProxying, authorityKeyIdentifier, or pre-encoded Extension DER) each with its RFC 5755 criticality. An attribute certificate is never self-signed, so the `issuer` is the signing AA, supplied as `{ cert, key }` or `{ name, publicKey, key }`. The signature algorithm is resolved from the AA key, so RSA (PKCS#1 v1.5 or PSS via `opts.pss`), ECDSA, EdDSA, ML-DSA, SLH-DSA, and the composite arms all sign without a per-algorithm branch, and the signature is verified under the AA public key before the certificate is returned. Returns DER, or a PEM `ATTRIBUTE CERTIFICATE` with `opts.pem`; malformed input throws a typed `AttrCertError`. `verify(ac, issuer, opts)` is the receiving side, performing the RFC 5755 sec. 5 checks an attribute certificate and a named issuer can settle between them: the signature over the exact `AttributeCertificateInfo` bytes through the one path-validation signature engine, the AC naming the issuer this verifier trusts (compared as a distinguished name), the evaluation instant lying within the validity with equality at either bound succeeding as the section states, the sec. 4.3.2 targeting rule, and rejection of any critical extension this verb does not process (section 5 defines support as parsing the value AND rejecting where the value would reject, so `aaControls` and `acProxying`, whose constraints it does not evaluate, are refused when critical). It answers `{ verified, signatureValid, validityChecked, targetingChecked, holderBindingChecked, issuerPathChecked, holder, issuer, attributes, extensions, notBefore, notAfter, serialNumberHex, reason }` with the fields re-derived from the signed bytes; the holder's own certificate chain and the AC issuer's chain need certificates the verb is not given, so those slots report `false` rather than letting their absence read as a pass. Parsing stays at `pki.schema.attrcert.parse` — `sign`, `verify` |
|
|
237
237
|
| `pki.crmf` | Certificate-request-message issuance (RFC 4211). `build(spec, key, opts)` assembles a `CertReqMessages` from a `spec` of `certReqId` (default 0, with the RFC 9483 `-1` sentinel allowed), a `certTemplate` of the requested fields (`subject`, `publicKey` as the SPKI DER of the key being certified, `validity`, requested `extensions`, an optional `version` 2), optional `controls` and `regInfo` (regToken, authenticator, utf8Pairs, oldCertID, protocolEncrKey, or pre-encoded `AttributeTypeAndValue` DER), and an optional `pop` selector. `key` (or `{ key }`) is the requester's private key: the message carries a `POPOSigningKey` proof of possession signed with the private half of `certTemplate.publicKey` and verified before the message is returned, exactly as a PKCS#10 CSR proves possession. A complete template signs the `CertRequest`; an incomplete one signs a `POPOSigningKeyInput`. The signature algorithm is resolved from the requested public key, so RSA (PKCS#1 v1.5 or PSS via `opts.pss`), ECDSA, EdDSA, ML-DSA, SLH-DSA, and the composite arms all sign without a per-algorithm branch. `key` is optional for a `raVerified` proof. A key that cannot sign, which is where an ML-KEM enrollment sits, takes a `POPOPrivKey` proof instead (RFC 4211 sec. 4.2, sec. 4.3): `pop.type` of `keyEncipherment` or `keyAgreement` with `pop.method: 'subsequentMessage'` declares whether an encrypted certificate (`encrCert`) or a challenge (`challengeResp`) completes the proof over the enrolling protocol's next exchange, and `pop.method: 'encryptedKey'` encloses the requester's private key for the CA in a CMS `EnvelopedData` under `id-ct-encKeyWithID`, requiring `pop.privateKey`, `pop.recipients`, the `pop.identifier` sec. 4.2.1 makes mandatory, and `pop.archive: true` because RFC 9810 sec. 5.2.8.3.1 permits the method only where archival is intended. The enclosed key must be the private half of `certTemplate.publicKey`, or the proof demonstrates possession of a key the request never asked to have certified. The `thisMessage` and `dhMAC` alternatives the specification deprecates are refused with their successors named. `pop.method: 'agreeMAC'` completes the four: `pop.key` is the requester's finite-field Diffie-Hellman private key, as a PKCS#8 DER, a PEM `PRIVATE KEY` block or a `KeyObject`, and `pop.caCert` the authority's certificate it already holds; the two agree a static secret (RFC 2875 sec. 3), and the key derived from it MACs the DER `certReq` under `id-dhPop-static-HMAC-SHA1`. Either key may name its group in the PKCS#3 or the X9.42 encoding. `pop.key` must be the private half of `certTemplate.publicKey`, and the template must name both a subject and a public key. Pass an array of specs for a batch; the CA-assigned template fields are never emitted. Returns DER, or a PEM block with `opts.pem`; malformed input throws a typed `CrmfError`. `verifyPop(messages)` is the receiving side: for each `CertReqMsg` it verifies the `POPOSigningKey` signature over the bytes RFC 4211 sec. 4.1 names — the DER of `poposkInput` when present, of `certReq` when not — through the one path-validation signature engine, and answers `{ verified, messages: [{ verified, method, cryptographicallyVerified, certReqId, subject, subjectBound, publicKey, reason }] }` with the fields re-derived from the message's own bytes. Each verdict reports only what its preimage covers: `publicKey` is the key possession was proven for, and `subject` is the requested name when the `certReq` was signed. A `poposkInput` preimage covers the key and the sender alone, so any subject beside it is unsigned and is withheld with `subjectBound: false`. A `raVerified` proof is an RA's out-of-band assertion and a `keyEncipherment` or `keyAgreement` proof completes over a later exchange, so each is reported unverified with its `method` named instead of guessed. Parsing stays at `pki.schema.crmf.parse` — `build`, `verifyPop` |
|
package/lib/pki-build.js
CHANGED
|
@@ -249,6 +249,19 @@ var KU_BIT = intrinsic.assign(intrinsic.create(null), {
|
|
|
249
249
|
dataEncipherment: 3, keyAgreement: 4, keyCertSign: 5, cRLSign: 6, encipherOnly: 7, decipherOnly: 8,
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
+
/** @internal ReasonFlags bit positions (RFC 5280 sec. 4.2.1.13). These do NOT line up with the
|
|
253
|
+
* CRLReason ENUMERATED of sec. 5.3.1, which leaves 7 unused and numbers privilegeWithdrawn 9 and
|
|
254
|
+
* aACompromise 10; here they are bits 7 and 8. Bit 0 is named `unused` and is not settable, and
|
|
255
|
+
* unspecified and removeFromCRL have no bit at all. */
|
|
256
|
+
var REASON_FLAG_BIT = intrinsic.assign(intrinsic.create(null), {
|
|
257
|
+
keyCompromise: 1, cACompromise: 2, affiliationChanged: 3, superseded: 4,
|
|
258
|
+
cessationOfOperation: 5, certificateHold: 6, privilegeWithdrawn: 7, aACompromise: 8,
|
|
259
|
+
});
|
|
260
|
+
var AIA_KEYS = intrinsic.assign(intrinsic.create(null), { accessMethod: 1, accessLocation: 1 });
|
|
261
|
+
var PC_KEYS = intrinsic.assign(intrinsic.create(null), { requireExplicitPolicy: 1, inhibitPolicyMapping: 1 });
|
|
262
|
+
var PM_KEYS = intrinsic.assign(intrinsic.create(null), { issuerDomainPolicy: 1, subjectDomainPolicy: 1 });
|
|
263
|
+
var DP_KEYS = intrinsic.assign(intrinsic.create(null), { fullName: 1, reasons: 1, cRLIssuer: 1 });
|
|
264
|
+
|
|
252
265
|
/** @internal The serial a certificate gets when the caller names none: 20 CSPRNG octets read as a
|
|
253
266
|
* positive integer, the top of the range RFC 5280 sec. 4.1.2.2 allows. The top bit is cleared so the
|
|
254
267
|
* DER INTEGER carries no sign octet. A zero leading octet is drawn again. Substituting a fixed value
|
|
@@ -417,6 +430,13 @@ function makeBuilder(ctx) {
|
|
|
417
430
|
return b.namedBitString(positions);
|
|
418
431
|
}
|
|
419
432
|
function _resolveOid(n, label) {
|
|
433
|
+
/** @internal A fault in a producer spec is this module's, so the name is typed BEFORE the OID
|
|
434
|
+
* registry sees it: `oid.byName` raises its own oid/* error for a non-string, which names a
|
|
435
|
+
* different domain than the one a caller of this verb branches on. The dotted-but-invalid case
|
|
436
|
+
* is caught below for the same reason. */
|
|
437
|
+
if (typeof n !== "string" || !n.length) {
|
|
438
|
+
throw E("bad-input", "unknown " + label + " " + guard.text.showValue(n) + " (expected a registered name or a dotted-decimal OID)");
|
|
439
|
+
}
|
|
420
440
|
var dotted = O(n);
|
|
421
441
|
if (dotted != null) return dotted;
|
|
422
442
|
if (typeof n === "string" && _isDottedOid(n)) {
|
|
@@ -455,6 +475,156 @@ function makeBuilder(ctx) {
|
|
|
455
475
|
return b.contextConstructed(implicitTag, Buffer.concat(members));
|
|
456
476
|
}
|
|
457
477
|
function extSan(entries) { return encodeGeneralNames(entries); }
|
|
478
|
+
/** @internal A path-validation skip count: a BaseDistance the decoders read back through
|
|
479
|
+
* guard.range.uint31, so the builder is held to the same bound rather than a wider one. */
|
|
480
|
+
function skipCount(v, label) {
|
|
481
|
+
var code = ctx.prefix + "/bad-input";
|
|
482
|
+
return guard.range.uint31(guard.range.authoredInteger(v, rawErr, code, label), rawErr, code, label);
|
|
483
|
+
}
|
|
484
|
+
/** @internal PolicyConstraints (RFC 5280 sec. 4.2.1.11): requireExplicitPolicy [0] and
|
|
485
|
+
* inhibitPolicyMapping [1], both IMPLICIT SkipCerts. The clause forbids an empty sequence, so one
|
|
486
|
+
* of the two is required. Emitted critical by its caller, which the same clause requires. */
|
|
487
|
+
function extPolicyConstraints(spec) {
|
|
488
|
+
if (!spec || typeof spec !== "object" || _isArray(spec) || _isBufferChk(spec)) {
|
|
489
|
+
throw E("bad-input", "policyConstraints must be an object naming requireExplicitPolicy and/or inhibitPolicyMapping");
|
|
490
|
+
}
|
|
491
|
+
guard.identifier.assertKnownKeys(spec, PC_KEYS, E, "bad-input", function (k) {
|
|
492
|
+
return "unknown policyConstraints field " + _stringify(k) + " (accepted: requireExplicitPolicy, inhibitPolicyMapping)";
|
|
493
|
+
});
|
|
494
|
+
var fields = [];
|
|
495
|
+
if (spec.requireExplicitPolicy != null) {
|
|
496
|
+
guard.list.append(fields, b.implicit(0, b.integer(skipCount(spec.requireExplicitPolicy, "policyConstraints.requireExplicitPolicy"))));
|
|
497
|
+
}
|
|
498
|
+
if (spec.inhibitPolicyMapping != null) {
|
|
499
|
+
guard.list.append(fields, b.implicit(1, b.integer(skipCount(spec.inhibitPolicyMapping, "policyConstraints.inhibitPolicyMapping"))));
|
|
500
|
+
}
|
|
501
|
+
if (!fields.length) {
|
|
502
|
+
throw E("bad-input", "policyConstraints must name requireExplicitPolicy or inhibitPolicyMapping (RFC 5280 sec. 4.2.1.11 forbids an empty sequence)");
|
|
503
|
+
}
|
|
504
|
+
return b.sequence(fields);
|
|
505
|
+
}
|
|
506
|
+
/** @internal InhibitAnyPolicy (RFC 5280 sec. 4.2.1.14): a bare SkipCerts INTEGER. */
|
|
507
|
+
function extInhibitAnyPolicy(v) { return b.integer(skipCount(v, "inhibitAnyPolicy")); }
|
|
508
|
+
/** @internal PolicyMappings (RFC 5280 sec. 4.2.1.5): SEQUENCE SIZE (1..MAX) OF
|
|
509
|
+
* { issuerDomainPolicy, subjectDomainPolicy }. The clause forbids mapping either to or from
|
|
510
|
+
* anyPolicy, so neither side may name it. */
|
|
511
|
+
function extPolicyMappings(list) {
|
|
512
|
+
if (!_isArray(list) || !list.length) {
|
|
513
|
+
throw E("bad-input", "policyMappings must name at least one { issuerDomainPolicy, subjectDomainPolicy } (RFC 5280 sec. 4.2.1.5)");
|
|
514
|
+
}
|
|
515
|
+
var anyPolicy = O("anyPolicy");
|
|
516
|
+
var dense = reqDenseArray(list, "policyMappings");
|
|
517
|
+
return b.sequence(_mapIntrinsic(dense, function (m, i) {
|
|
518
|
+
var who = "policyMappings entry " + i;
|
|
519
|
+
if (!m || typeof m !== "object" || _isArray(m) || _isBufferChk(m)) {
|
|
520
|
+
throw E("bad-input", who + " must be an object { issuerDomainPolicy, subjectDomainPolicy }");
|
|
521
|
+
}
|
|
522
|
+
guard.identifier.assertKnownKeys(m, PM_KEYS, E, "bad-input", function (k) {
|
|
523
|
+
return "unknown " + who + " field " + _stringify(k) + " (accepted: issuerDomainPolicy, subjectDomainPolicy)";
|
|
524
|
+
});
|
|
525
|
+
if (m.issuerDomainPolicy == null || m.subjectDomainPolicy == null) {
|
|
526
|
+
throw E("bad-input", who + " requires both issuerDomainPolicy and subjectDomainPolicy");
|
|
527
|
+
}
|
|
528
|
+
var idp = _resolveOid(m.issuerDomainPolicy, who + " issuerDomainPolicy");
|
|
529
|
+
var sdp = _resolveOid(m.subjectDomainPolicy, who + " subjectDomainPolicy");
|
|
530
|
+
if (idp === anyPolicy || sdp === anyPolicy) {
|
|
531
|
+
throw E("bad-input", who + " must not map to or from anyPolicy (RFC 5280 sec. 4.2.1.5)");
|
|
532
|
+
}
|
|
533
|
+
return b.sequence([b.oid(idp), b.oid(sdp)]);
|
|
534
|
+
}));
|
|
535
|
+
}
|
|
536
|
+
/** @internal AuthorityInfoAccessSyntax (RFC 5280 sec. 4.2.2.1): SEQUENCE SIZE (1..MAX) OF
|
|
537
|
+
* AccessDescription { accessMethod OBJECT IDENTIFIER, accessLocation GeneralName }. */
|
|
538
|
+
function extAuthorityInfoAccess(list) {
|
|
539
|
+
if (!_isArray(list) || !list.length) {
|
|
540
|
+
throw E("bad-input", "authorityInfoAccess must name at least one { accessMethod, accessLocation } (RFC 5280 sec. 4.2.2.1)");
|
|
541
|
+
}
|
|
542
|
+
var dense = reqDenseArray(list, "authorityInfoAccess");
|
|
543
|
+
return b.sequence(_mapIntrinsic(dense, function (d, i) {
|
|
544
|
+
var who = "authorityInfoAccess entry " + i;
|
|
545
|
+
if (!d || typeof d !== "object" || _isArray(d) || _isBufferChk(d)) {
|
|
546
|
+
throw E("bad-input", who + " must be an object { accessMethod, accessLocation }");
|
|
547
|
+
}
|
|
548
|
+
guard.identifier.assertKnownKeys(d, AIA_KEYS, E, "bad-input", function (k) {
|
|
549
|
+
return "unknown " + who + " field " + _stringify(k) + " (accepted: accessMethod, accessLocation)";
|
|
550
|
+
});
|
|
551
|
+
if (d.accessLocation == null) throw E("bad-input", who + " requires an accessLocation GeneralName");
|
|
552
|
+
/** @internal A fault in the SPEC is this module's, so the name is typed here rather than left
|
|
553
|
+
* to the OID registry, whose own error names a different domain than the one a caller of this
|
|
554
|
+
* verb branches on. */
|
|
555
|
+
if (typeof d.accessMethod !== "string" || !d.accessMethod.length) {
|
|
556
|
+
throw E("bad-input", who + " requires an accessMethod naming a registered access method or a dotted-decimal OID");
|
|
557
|
+
}
|
|
558
|
+
return b.sequence([b.oid(_resolveOid(d.accessMethod, who + " accessMethod")), encodeGeneralName(d.accessLocation)]);
|
|
559
|
+
}));
|
|
560
|
+
}
|
|
561
|
+
/** @internal One DistributionPoint (RFC 5280 sec. 4.2.1.13). distributionPoint [0] wraps a
|
|
562
|
+
* DistributionPointName whose fullName is [0] IMPLICIT GeneralNames; reasons is [1] IMPLICIT
|
|
563
|
+
* ReasonFlags; cRLIssuer is [2] IMPLICIT GeneralNames. A DistributionPoint must not consist of
|
|
564
|
+
* only the reasons field, so one of the other two is required. An entry that names none of the
|
|
565
|
+
* three field names is a GeneralName standing for a single fullName. */
|
|
566
|
+
function distributionPoint(entry, what, idx) {
|
|
567
|
+
var who = what + " entry " + idx;
|
|
568
|
+
var spec = entry;
|
|
569
|
+
var isDpObject = !!entry && typeof entry === "object" && !_isArray(entry) && !_isBufferChk(entry) &&
|
|
570
|
+
guard.list.anyMatches(_objectKeys(entry), function (k) { return DP_KEYS[k] === 1; });
|
|
571
|
+
if (!isDpObject) spec = { fullName: [entry] };
|
|
572
|
+
guard.identifier.assertKnownKeys(spec, DP_KEYS, E, "bad-input", function (k) {
|
|
573
|
+
return "unknown " + who + " field " + _stringify(k) + " (accepted: fullName, reasons, cRLIssuer)";
|
|
574
|
+
});
|
|
575
|
+
if (spec.fullName == null && spec.cRLIssuer == null) {
|
|
576
|
+
throw E("bad-input", who + " must name a fullName or a cRLIssuer; a DistributionPoint must not consist of only the reasons field (RFC 5280 sec. 4.2.1.13)");
|
|
577
|
+
}
|
|
578
|
+
var fields = [];
|
|
579
|
+
if (spec.fullName != null) {
|
|
580
|
+
/** @internal [0] distributionPoint wraps [0] fullName, so the GeneralNames tag nests inside it. */
|
|
581
|
+
guard.list.append(fields, b.contextConstructed(0, encodeGeneralNames(reqDenseArray(spec.fullName, who + " fullName"), 0)));
|
|
582
|
+
}
|
|
583
|
+
if (spec.reasons != null) {
|
|
584
|
+
if (!_isArray(spec.reasons) || !spec.reasons.length) throw E("bad-input", who + " reasons must name at least one ReasonFlags bit");
|
|
585
|
+
var bits = _mapIntrinsic(reqDenseArray(spec.reasons, who + " reasons"), function (r) {
|
|
586
|
+
var bit = REASON_FLAG_BIT[guard.text.keyOf(r)];
|
|
587
|
+
if (bit == null) throw E("bad-input", who + " names an unknown CRL reason " + guard.text.showValue(r));
|
|
588
|
+
return bit;
|
|
589
|
+
});
|
|
590
|
+
guard.list.append(fields, b.implicit(1, b.namedBitString(bits)));
|
|
591
|
+
}
|
|
592
|
+
if (spec.cRLIssuer != null) {
|
|
593
|
+
/** @internal Sec. 4.2.1.13 requires cRLIssuer to carry the NAME of the CRL issuer, and a
|
|
594
|
+
* GeneralName carries an X.501 Name only as directoryName. The path validator compares only
|
|
595
|
+
* directoryName entries, so a cRLIssuer naming none matches no issuer and the distribution
|
|
596
|
+
* point would leave revocation undetermined rather than point at a CRL. */
|
|
597
|
+
var issuers = reqDenseArray(spec.cRLIssuer, who + " cRLIssuer");
|
|
598
|
+
/** @internal A Name with no RDNs names nobody, and pki.crl.sign refuses to issue a CRL under
|
|
599
|
+
* one, so an empty directoryName leaves the point matching no conforming CRL exactly as a
|
|
600
|
+
* missing one would. The name is encoded to ask, since a caller may write it as a string, an
|
|
601
|
+
* RDN array, or raw Name DER. */
|
|
602
|
+
var named = guard.list.anyMatches(issuers, function (e) {
|
|
603
|
+
if (!e || typeof e !== "object" || _isArray(e) || _isBufferChk(e) || e.directoryName == null) return false;
|
|
604
|
+
try {
|
|
605
|
+
return !isEmptyName(encodeName(e.directoryName));
|
|
606
|
+
} catch (_e) {
|
|
607
|
+
/** @internal A directoryName that cannot encode as a Name is not a usable issuer name, so
|
|
608
|
+
* it does not satisfy the requirement; the refusal below names the real fault. */
|
|
609
|
+
return false;
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
if (!named) {
|
|
613
|
+
throw E("bad-input", who + " cRLIssuer must name the CRL issuer as a non-empty directoryName (RFC 5280 sec. 4.2.1.13); a cRLIssuer carrying no usable directoryName matches no CRL issuer");
|
|
614
|
+
}
|
|
615
|
+
guard.list.append(fields, encodeGeneralNames(issuers, 2));
|
|
616
|
+
}
|
|
617
|
+
return b.sequence(fields);
|
|
618
|
+
}
|
|
619
|
+
/** @internal CRLDistributionPoints (RFC 5280 sec. 4.2.1.13). freshestCRL (sec. 4.2.1.15) states
|
|
620
|
+
* that the same syntax is used, so both route here. */
|
|
621
|
+
function extCrlDistributionPoints(list, what) {
|
|
622
|
+
if (!_isArray(list) || !list.length) {
|
|
623
|
+
throw E("bad-input", what + " must name at least one distribution point (RFC 5280 sec. 4.2.1.13)");
|
|
624
|
+
}
|
|
625
|
+
var dense = reqDenseArray(list, what);
|
|
626
|
+
return b.sequence(_mapIntrinsic(dense, function (e, i) { return distributionPoint(e, what, i); }));
|
|
627
|
+
}
|
|
458
628
|
/** @internal One GeneralSubtree (RFC 5280 sec. 4.2.1.10). Within this profile minimum is 0 and
|
|
459
629
|
* maximum is absent, so a subtree is its base alone. A base names a NAMESPACE rather than a
|
|
460
630
|
* subject, so it is held to the constraint-base rule: it may carry a leading dot, and an
|
|
@@ -588,7 +758,9 @@ function makeBuilder(ctx) {
|
|
|
588
758
|
var REQ_EXT_KEYS = {
|
|
589
759
|
subjectAltName: 1, keyUsage: 1, keyUsageCritical: 1, extendedKeyUsage: 1, extendedKeyUsageCritical: 1,
|
|
590
760
|
basicConstraints: 1, certificatePolicies: 1, certificatePoliciesCritical: 1, subjectKeyIdentifier: 1,
|
|
591
|
-
nameConstraints: 1,
|
|
761
|
+
nameConstraints: 1, authorityInfoAccess: 1, cRLDistributionPoints: 1, freshestCRL: 1,
|
|
762
|
+
policyConstraints: 1, inhibitAnyPolicy: 1, policyMappings: 1, policyMappingsCritical: 1,
|
|
763
|
+
issuerAltName: 1,
|
|
592
764
|
};
|
|
593
765
|
function requestedExtensions(extSpec, spki) {
|
|
594
766
|
var EXT_DECODERS = ctx.EXT_DECODERS;
|
|
@@ -627,6 +799,13 @@ function makeBuilder(ctx) {
|
|
|
627
799
|
if (extSpec.certificatePolicies != null) out.push(ext(O("certificatePolicies"), !!extSpec.certificatePoliciesCritical, extCertPolicies(extSpec.certificatePolicies)));
|
|
628
800
|
/** @internal RFC 5280 sec. 4.2.1.10 fixes this extension critical, in a request as in the certificate. */
|
|
629
801
|
if (extSpec.nameConstraints != null) guard.list.append(out, ext(O("nameConstraints"), true, extNameConstraints(extSpec.nameConstraints)));
|
|
802
|
+
if (extSpec.authorityInfoAccess != null) guard.list.append(out, ext(O("authorityInfoAccess"), false, extAuthorityInfoAccess(extSpec.authorityInfoAccess)));
|
|
803
|
+
if (extSpec.cRLDistributionPoints != null) guard.list.append(out, ext(O("cRLDistributionPoints"), false, extCrlDistributionPoints(extSpec.cRLDistributionPoints, "cRLDistributionPoints")));
|
|
804
|
+
if (extSpec.freshestCRL != null) guard.list.append(out, ext(O("freshestCRL"), false, extCrlDistributionPoints(extSpec.freshestCRL, "freshestCRL")));
|
|
805
|
+
if (extSpec.policyConstraints != null) guard.list.append(out, ext(O("policyConstraints"), true, extPolicyConstraints(extSpec.policyConstraints)));
|
|
806
|
+
if (extSpec.inhibitAnyPolicy != null) guard.list.append(out, ext(O("inhibitAnyPolicy"), true, extInhibitAnyPolicy(extSpec.inhibitAnyPolicy)));
|
|
807
|
+
if (extSpec.policyMappings != null) guard.list.append(out, ext(O("policyMappings"), !!extSpec.policyMappingsCritical, extPolicyMappings(extSpec.policyMappings)));
|
|
808
|
+
if (extSpec.issuerAltName != null) guard.list.append(out, ext(O("issuerAltName"), false, encodeGeneralNames(reqDenseArray(extSpec.issuerAltName, "issuerAltName"))));
|
|
630
809
|
if (!out.length) throw E("bad-input", "the requested extensions object must request at least one extension");
|
|
631
810
|
return b.sequence(out);
|
|
632
811
|
}
|
|
@@ -690,7 +869,9 @@ function makeBuilder(ctx) {
|
|
|
690
869
|
return {
|
|
691
870
|
E: E, code: code, KU_BIT: KU_BIT,
|
|
692
871
|
encodeName: encodeName, isEmptyName: isEmptyName, encodeGeneralName: encodeGeneralName,
|
|
693
|
-
extNameConstraints: extNameConstraints,
|
|
872
|
+
extNameConstraints: extNameConstraints, extAuthorityInfoAccess: extAuthorityInfoAccess,
|
|
873
|
+
extCrlDistributionPoints: extCrlDistributionPoints, extPolicyConstraints: extPolicyConstraints,
|
|
874
|
+
extInhibitAnyPolicy: extInhibitAnyPolicy, extPolicyMappings: extPolicyMappings,
|
|
694
875
|
encodeGeneralNames: encodeGeneralNames, serialInteger: serialInteger, timeDer: timeDer,
|
|
695
876
|
requestedExtensions: requestedExtensions,
|
|
696
877
|
extKeyUsage: extKeyUsage, extExtKeyUsage: extExtKeyUsage, validateBcSpec: validateBcSpec,
|
package/lib/x509-sign.js
CHANGED
|
@@ -51,6 +51,9 @@ var KNOWN_EXT_KEYS = intrinsic.assign(intrinsic.create(null), {
|
|
|
51
51
|
subjectKeyIdentifier: 1, authorityKeyIdentifier: 1, keyUsage: 1, keyUsageCritical: 1,
|
|
52
52
|
extendedKeyUsage: 1, extendedKeyUsageCritical: 1, basicConstraints: 1, subjectAltName: 1,
|
|
53
53
|
certificatePolicies: 1, certificatePoliciesCritical: 1, nameConstraints: 1,
|
|
54
|
+
authorityInfoAccess: 1, cRLDistributionPoints: 1, freshestCRL: 1,
|
|
55
|
+
policyConstraints: 1, inhibitAnyPolicy: 1, policyMappings: 1, policyMappingsCritical: 1,
|
|
56
|
+
issuerAltName: 1,
|
|
54
57
|
});
|
|
55
58
|
|
|
56
59
|
var _b = pkiBuild.makeBuilder({ ErrorClass: CertificateError, prefix: "x509", O: O, NS: NS, NAME_SCHEMA: NAME_SCHEMA, SPKI_SCHEMA: SPKI_SCHEMA, EXT_DECODERS: EXT_DECODERS });
|
|
@@ -60,7 +63,10 @@ var _encodeName = _b.encodeName, _isEmptyName = _b.isEmptyName, _reqDer = _b.req
|
|
|
60
63
|
_certLikeFromSpki = _b.certLikeFromSpki, _assertCertVerifies = _b.assertSignatureVerifies,
|
|
61
64
|
_ext = _b.ext, _extBasicConstraints = _b.extBasicConstraints, _validateBcSpec = _b.validateBcSpec,
|
|
62
65
|
_extKeyUsage = _b.extKeyUsage, _extExtKeyUsage = _b.extExtKeyUsage, _extSki = _b.extSki,
|
|
63
|
-
_extNameConstraints = _b.extNameConstraints,
|
|
66
|
+
_extNameConstraints = _b.extNameConstraints, _extAia = _b.extAuthorityInfoAccess,
|
|
67
|
+
_extCrlDp = _b.extCrlDistributionPoints, _extPolicyConstraints = _b.extPolicyConstraints,
|
|
68
|
+
_extInhibitAnyPolicy = _b.extInhibitAnyPolicy, _extPolicyMappings = _b.extPolicyMappings,
|
|
69
|
+
_encodeGeneralNames = _b.encodeGeneralNames, _reqDenseArray = _b.reqDenseArray,
|
|
64
70
|
_extAki = _b.extAki, _extSan = _b.extSan, _extCertPolicies = _b.extCertPolicies,
|
|
65
71
|
_skiKeyId = _b.skiKeyId, _spkiKeyId = _b.spkiKeyId, _serialInteger = _b.serialInteger;
|
|
66
72
|
|
|
@@ -141,6 +147,22 @@ function _buildExtensions(extSpec, ctx) {
|
|
|
141
147
|
}
|
|
142
148
|
if (extSpec.subjectAltName != null) out.push(_ext(O("subjectAltName"), ctx.subjectEmpty, _extSan(extSpec.subjectAltName)));
|
|
143
149
|
if (extSpec.certificatePolicies != null) out.push(_ext(O("certificatePolicies"), !!extSpec.certificatePoliciesCritical, _extCertPolicies(extSpec.certificatePolicies)));
|
|
150
|
+
/** @internal Sections 4.2.2.1 and 4.2.1.15 fix these non-critical; sec. 4.2.1.13 states a SHOULD
|
|
151
|
+
* and the toolkit issues the conforming form. */
|
|
152
|
+
if (extSpec.authorityInfoAccess != null) guard.list.append(out, _ext(O("authorityInfoAccess"), false, _extAia(extSpec.authorityInfoAccess)));
|
|
153
|
+
if (extSpec.cRLDistributionPoints != null) guard.list.append(out, _ext(O("cRLDistributionPoints"), false, _extCrlDp(extSpec.cRLDistributionPoints, "cRLDistributionPoints")));
|
|
154
|
+
if (extSpec.freshestCRL != null) guard.list.append(out, _ext(O("freshestCRL"), false, _extCrlDp(extSpec.freshestCRL, "freshestCRL")));
|
|
155
|
+
/** @internal Sections 4.2.1.11 and 4.2.1.14 fix these critical; sec. 4.2.1.5 states a SHOULD for
|
|
156
|
+
* policyMappings and sec. 4.2.1.7 a SHOULD for issuerAltName, and the toolkit issues the
|
|
157
|
+
* conforming form of each. */
|
|
158
|
+
if (extSpec.policyConstraints != null) guard.list.append(out, _ext(O("policyConstraints"), true, _extPolicyConstraints(extSpec.policyConstraints)));
|
|
159
|
+
if (extSpec.inhibitAnyPolicy != null) guard.list.append(out, _ext(O("inhibitAnyPolicy"), true, _extInhibitAnyPolicy(extSpec.inhibitAnyPolicy)));
|
|
160
|
+
/** @internal Sec. 4.2.1.5 states a SHOULD for marking policyMappings critical, and pki.path.validate
|
|
161
|
+
* does not process the extension, so a critical one is a certificate this toolkit's own validator
|
|
162
|
+
* must reject and pki.lint.certificate grades `unknown-critical-extension`. The default is the
|
|
163
|
+
* usable form and the knob reaches the SHOULD-conforming one, as certificatePolicies does. */
|
|
164
|
+
if (extSpec.policyMappings != null) guard.list.append(out, _ext(O("policyMappings"), !!extSpec.policyMappingsCritical, _extPolicyMappings(extSpec.policyMappings)));
|
|
165
|
+
if (extSpec.issuerAltName != null) guard.list.append(out, _ext(O("issuerAltName"), false, _encodeGeneralNames(_reqDenseArray(extSpec.issuerAltName, "issuerAltName"))));
|
|
144
166
|
if (extSpec.nameConstraints != null) {
|
|
145
167
|
if (!caTrue) throw _err("x509/bad-input", "nameConstraints appears only in a CA certificate, so it requires basicConstraints cA=TRUE (RFC 5280 sec. 4.2.1.10)");
|
|
146
168
|
guard.list.append(out, _ext(O("nameConstraints"), true, _extNameConstraints(extSpec.nameConstraints)));
|
|
@@ -236,6 +258,31 @@ function _hasCriticalSan(extSpec) {
|
|
|
236
258
|
* namespace is constrained. The extension is emitted critical, which RFC 5280 sec. 4.2.1.10 requires,
|
|
237
259
|
* and it appears only on a certificate whose `basicConstraints` sets `cA: true`.
|
|
238
260
|
*
|
|
261
|
+
* `extensions.authorityInfoAccess` names where to reach the issuer, as a list of
|
|
262
|
+
* `{ accessMethod, accessLocation }`. The method is a registered name (`"ocsp"`, `"caIssuers"`) or a
|
|
263
|
+
* dotted OID; the location is a `GeneralName` in either accepted form.
|
|
264
|
+
* `extensions.cRLDistributionPoints` names where to fetch the CRL, and `extensions.freshestCRL` the
|
|
265
|
+
* delta CRL, which RFC 5280 sec. 4.2.1.15 gives the same syntax. Each takes a list whose entries are
|
|
266
|
+
* either a `GeneralName` standing for a single `fullName`, or
|
|
267
|
+
* `{ fullName, reasons, cRLIssuer }` for the full form; `reasons` names RFC 5280 sec. 4.2.1.13
|
|
268
|
+
* ReasonFlags bits, whose numbering differs from the CRLReason values `pki.crl.sign` takes. A
|
|
269
|
+
* distribution point naming only `reasons` is refused, which that clause requires. All three are
|
|
270
|
+
* emitted non-critical.
|
|
271
|
+
*
|
|
272
|
+
* The policy machinery certification-path validation acts on is available the same way.
|
|
273
|
+
* `extensions.policyConstraints` takes `{ requireExplicitPolicy, inhibitPolicyMapping }` skip counts,
|
|
274
|
+
* at least one of which RFC 5280 sec. 4.2.1.11 requires; `extensions.inhibitAnyPolicy` takes a bare
|
|
275
|
+
* skip count (sec. 4.2.1.14); both are emitted critical, which those clauses require.
|
|
276
|
+
* `extensions.policyMappings` takes a list of `{ issuerDomainPolicy, subjectDomainPolicy }` naming
|
|
277
|
+
* registered policies or dotted OIDs, and refuses a mapping to or from `anyPolicy`, which sec.
|
|
278
|
+
* 4.2.1.5 forbids, the same rule `pki.path.validate` applies at sec. 6.1.4(a). That clause states a
|
|
279
|
+
* SHOULD for marking it critical. The validator processes the extension on an intermediate
|
|
280
|
+
* certificate, where sec. 6.1.4 applies the mappings to the policy tree, and treats a critical one on
|
|
281
|
+
* the TARGET certificate as unprocessed, rejecting it; `pki.lint.certificate` grades that case
|
|
282
|
+
* `unknown-critical-extension`. It is emitted non-critical unless `policyMappingsCritical` is set.
|
|
283
|
+
* `extensions.issuerAltName` takes the `GeneralName` forms `subjectAltName` takes and is emitted
|
|
284
|
+
* non-critical (sec. 4.2.1.7).
|
|
285
|
+
*
|
|
239
286
|
* @opts
|
|
240
287
|
* - `pem` (boolean) -- return a PEM `CERTIFICATE` string instead of DER.
|
|
241
288
|
* - `pss` (boolean) -- sign an RSA key with RSASSA-PSS instead of PKCS#1 v1.5.
|
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:651c3233-2b5b-41ed-b89d-e5fa54e6fd1f",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-09-
|
|
8
|
+
"timestamp": "2026-09-11T06:06:24.705Z",
|
|
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.7.
|
|
22
|
+
"bom-ref": "@blamejs/pki@0.7.17",
|
|
23
23
|
"type": "application",
|
|
24
24
|
"name": "pki",
|
|
25
|
-
"version": "0.7.
|
|
25
|
+
"version": "0.7.17",
|
|
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.7.
|
|
29
|
+
"purl": "pkg:npm/%40blamejs/pki@0.7.17",
|
|
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.7.
|
|
57
|
+
"ref": "@blamejs/pki@0.7.17",
|
|
58
58
|
"dependsOn": []
|
|
59
59
|
}
|
|
60
60
|
]
|