@blamejs/pki 0.8.10 → 0.8.12
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 +33 -0
- package/README.md +6 -6
- package/lib/attrcert-sign.js +14 -15
- package/lib/constants.js +5 -0
- package/lib/guard-parsed.js +1 -1
- package/lib/inspect.js +59 -0
- package/lib/lint.js +3 -3
- package/lib/path-validate.js +227 -97
- package/lib/schema-all.js +10 -5
- package/lib/schema-attrcert.js +108 -13
- package/lib/schema-crl.js +136 -38
- package/lib/schema-crmf.js +91 -6
- package/lib/schema-csr.js +116 -5
- package/lib/schema-pkix.js +494 -4
- package/lib/schema-x509.js +97 -3
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,39 @@ 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.8.12 — 2026-09-23
|
|
8
|
+
|
|
9
|
+
A certification path whose policies map to each other validates instead of exhausting the policy-node budget.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- The `pki.path.validate` result carries `validPolicyGraph` where it carried `validPolicyTree`, and the structure it holds is a graph rather than a tree. It is `{ nodes }`, a flat list linked by index, each entry `{ id, depth, validPolicy, qualifierSet, expectedPolicySet, parents, children }`, where `parents` and `children` hold the ids of other entries and the root is id 0. A caller that walked `.children` from a root and read `.parent` reads the list and follows ids instead. The list is flat because a graph handed back as a root to walk re-expands into the exponential structure the moment anything recurses into every child, `JSON.stringify` included.
|
|
14
|
+
- `C.LIMITS.PATH_MAX_POLICY_NODES` is unchanged at 4096 and still fails closed with `path/policy-tree-cap`, and `opts.maxPolicyNodes` still tightens it. What it bounds has changed with the structure: the graph grows with the number of distinct policies and mappings the path actually carries, so the cap is reached by a path that names that many policies, not by a path that names a few and is several certificates long. A single certificate carrying 4096 distinct policies still reaches it.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `pki.path.validate` accepts a conforming certification path whose certificate policies map to each other across several levels. Such a path was refused with `path/policy-tree-cap` once its policy tree exceeded `maxPolicyNodes`, which the tree reached at six certificates carrying four mutually mapped policies. Certificate policies are now processed as the RFC 9618 `valid_policy_graph`, whose size is linear in the policies and mappings on the path rather than exponential in its length.
|
|
19
|
+
- `userConstrainedPolicySet` reports the policies of the nodes whose only parent is the `anyPolicy` node, which is what RFC 5280 section 6.1.5 (g)(iii)(1) and RFC 9618 section 5.5 step (g)(2) both define it as. It reported the policies of the deepest nodes instead. The two answers differ wherever a policy mapping is in play: for a chain where an issuer domain policy is mapped to a subject domain policy, the set now names the issuer domain policy, which is the domain the relying party asked about and the reason mapping exists.
|
|
20
|
+
|
|
21
|
+
## v0.8.11 — 2026-09-23
|
|
22
|
+
|
|
23
|
+
What a certificate, CRL, request or attribute certificate asserts in its extensions is read in one call.
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- `pki.schema.x509.decodeExtensions(certOrBytes, opts?)` and `pki.schema.x509.decodeExtension(ext, opts?)` return a certificate's extensions as decoded records. Each row is `{ oid, name, critical, value, scope, index, containerIndex, state, decoded, code, profile }`. `state` is `"decoded"`, `"unrecognized"` for an identifier no decoder is registered for, or `"undecodable"` for a value that is not the structure its identifier names; `code` carries the typed error in that last arm. `value` is the raw extnValue octets in every arm, for a caller recomputing a hash or comparing an encoding. Read `state` rather than testing `decoded`, because a valid `ocspNoCheck` decodes to null.
|
|
28
|
+
- The same pair on `pki.schema.crl`, `pki.schema.csr`, `pki.schema.attrcert` and `pki.schema.crmf`. The CRL table spans the CRL's own extensions and every revoked entry's in one array, each row naming its scope and, for an entry, its position in `containerIndex`. `pki.schema.crl.decodeExtension` takes a required `opts.scope` of `"crl"`, `"crl-entry"` or `"ocsp-single"`, since RFC 6960 section 4.4.5 carries a CRL entry extension into an OCSP SingleResponse and the same identifier means different things at those three scopes.
|
|
29
|
+
- `pki.schema.csr.decodeExtensions` refuses a request carrying more than one `extensionRequest` attribute with `csr/ambiguous-extension-request`, because nothing states which of them a CA should honor. Pass `groups: true` to read each attribute separately, as `[{ attributeIndex, extensions }]`.
|
|
30
|
+
- Both verbs report what they find and refuse nothing on the strength of it. An extension against the criticality its RFC fixes still decodes, and the deviation is reported on `profile` with the clause that fixes it. An unrecognized critical extension comes back as a row, whatever `opts.strict` says. RFC 5280 section 4.2's rule about one belongs to the relying party, and the two facts that rule needs, `critical` and `state`, are on the row.
|
|
31
|
+
- The certificate extension table decodes the RFC 3779 address and AS number blocks (`ipAddrBlocks`, `autonomousSysIds`) and the RFC 8360 identifiers for the same syntax, plus the RFC 7633 TLS feature extension. `pki.inspect.certificate` renders all five. An AS number and a TLS feature are read as the `INTEGER` each type declares, so both come back as a `BigInt` and a value outside its registry's width is reported rather than refused.
|
|
32
|
+
- The CRL extension table decodes the issuing distribution point and the delta CRL indicator, along with the authority key identifier, issuer alternative name, freshest CRL and authority information access that RFC 5280 section 5.2 profiles, and the certificate issuer at entry scope.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- `pki.schema.crl.parse` puts the raw extnValue octets on every extension record as `valueBytes`, beside the `value` it already carried. The three extensions the CRL parse decodes in place, `cRLNumber`, `reasonCode` and `invalidityDate`, previously left a caller no way back to the bytes those values came from.
|
|
37
|
+
- Every signer that validates a pre-encoded extension now validates a pre-encoded `ipAddrBlocks`, `autonomousSysIds` or `tlsFeature` too, and refuses one whose value is not the structure its identifier names. A certificate carrying such a value can still be read: the refusal is on the writing side.
|
|
38
|
+
- `pki.attrcert.sign` and `pki.schema.attrcert.decodeExtensions` read the criticality RFC 5755 fixes from one table, so the signer's refusal names the section it refuses under where its message previously cited the RFC alone.
|
|
39
|
+
|
|
7
40
|
## v0.8.10 — 2026-09-23
|
|
8
41
|
|
|
9
42
|
A certificate's names are read the same way wherever the toolkit reads them.
|
package/README.md
CHANGED
|
@@ -243,16 +243,16 @@ comment blocks, is at [pkijs.com](https://pkijs.com).
|
|
|
243
243
|
| `pki.webcrypto` | A W3C `SubtleCrypto` engine over `node:crypto` — `sign`/`verify`/`encrypt`/`decrypt`/`deriveBits`/`digest`/`generateKey`/`importKey`/`exportKey` across RSA, ECDSA, ECDH, Ed25519/Ed448, AES, HMAC, HKDF, PBKDF2 and SHA, plus post-quantum ML-DSA-44/65/87, SLH-DSA, and ML-KEM-512/768/1024 key generation with certificate and PKCS#8 import. The RFC 9935 seed / expandedKey / both private-key CHOICE is validated fail-closed, so an OpenSSL-legacy bare seed or an internally inconsistent key is rejected with a typed error. `encapsulateBits` and `decapsulateBits` are the ML-KEM key-establishment pair the CMS `KEMRecipientInfo` arm rides on, with the FIPS 203 §7.3 ciphertext-length check enforced here so a direct caller inherits it. Cross-implementation use is undefined in the specification, so a `CryptoKey` from a different WebCrypto implementation is refused here with a typed fault naming its origin; the `pki.*` verbs adopt such a key instead, whether it came from the platform or from a separately installed copy of this toolkit |
|
|
244
244
|
| `pki.tls` | RFC 8879 certificate compression and the RFC 8446 §4.4.2 Certificate message it carries (RFC 8446 is obsoleted by RFC 9846), which is the handshake's largest payload. `decompressCertificate` decodes a `CompressedCertificate` and returns the algorithm, the declared uncompressed length, the recovered message raw, and its per-entry certificate DER. Decompression carries the two-sided bound §5 requires: capped at the message's own declared length so a bomb is refused mid-stream, then compared to that declaration exactly, which catches the under-length direction a cap alone cannot see. An algorithm outside the RFC 8879 registry, one the runtime cannot decompress, or one the receiver never advertised is refused before any decompressor is handed the bytes; an empty compressed body is a framing violation (`tls/bad-framing`); and trailing bytes, after the message or after the compressed frame, are refused (`tls/trailing-data`), so one chain has exactly one encoding. `compressCertificate` is the inverse and round-trips its own output before returning. `parseCertificateMessage` decodes the RFC 8446 §4.4.2 message on its own, surfacing each entry's certificate DER ready for `pki.schema.x509.parse` alongside its raw extensions; a separate extension negotiates `certificate_type`, so it is declared, never guessed. All three registered algorithms (zlib, brotli, zstd) are implemented, each offered only where the running Node decompresses it safely — one whose decompressor answers a truncated frame with a short result instead of a fault is dropped at startup rather than advertised with a truncation it cannot detect. Structure only: no handshake is spoken and no certificate verified — `decompressCertificate`, `compressCertificate`, `parseCertificateMessage` |
|
|
245
245
|
| `pki.schema` | The schema family. `parse` detects which PKI format a DER or PEM input encodes and routes it to the right parser; `all` enumerates the registered formats; `pem.decodeBundle` reads every object in a multi-object PEM file (a `fullchain.pem`, a `ca-certificates.crt`, a key beside its certificate), carrying each object's label, DER and offset into the text, with explanatory text around the blocks read as text and the file bounded in both the number of objects and the bytes they decode to; `pem.encodeBundle` writes that list back; `pki.schema.pkcs1` reads and writes the RFC 8017 `RSA PRIVATE KEY` and `RSA PUBLIC KEY` encodings, with every component relation the specification states checked; `pki.schema.sec1` reads and writes the RFC 5915 `EC PRIVATE KEY` encoding, holding the scalar to its curve's width and the parameters field to a named curve; the engine and per-format members are grouped here |
|
|
246
|
-
| `pki.schema.x509` | Certificates (RFC 5280) parsed into structured, validated fields. Each extension is surfaced by name with its `extnValue` bytes; the shared extension decoders that read those bytes are what `pki.lint.certificate`, `pki.inspect` and `pki.path.validate` consume, and they cover the RFC 3739 / ETSI EN 319 412-5 qualified-certificate `qcStatements` (EU-qualified declaration, reliance limit, QSCD flag, certificate type, retention, PDS URLs, country of qualification), the Microsoft Active Directory Certificate Services enrollment extensions (certificate template, CA version, previous-CA-certificate hash, application policies), subject information access, subject directory attributes, and the RFC 6960 OCSP no-check responder marker. Unknown statements stay opaque, fail-closed Fail-closed — `parse`, `pemDecode`, `pemEncode` |
|
|
246
|
+
| `pki.schema.x509` | Certificates (RFC 5280) parsed into structured, validated fields. Each extension is surfaced by name with its `extnValue` bytes; the shared extension decoders that read those bytes are what `pki.lint.certificate`, `pki.inspect` and `pki.path.validate` consume, and they cover the RFC 3739 / ETSI EN 319 412-5 qualified-certificate `qcStatements` (EU-qualified declaration, reliance limit, QSCD flag, certificate type, retention, PDS URLs, country of qualification), the Microsoft Active Directory Certificate Services enrollment extensions (certificate template, CA version, previous-CA-certificate hash, application policies), subject information access, subject directory attributes, and the RFC 6960 OCSP no-check responder marker. Unknown statements stay opaque, fail-closed. `decodeExtensions` is the read door onto that table: it returns one row per extension carrying the decoded value, the raw `extnValue` octets, and a `state` of `decoded`, `unrecognized` or `undecodable`, so a reader can tell an extension nothing decodes from one whose value does not read. The RFC 3779 address and AS number blocks, their RFC 8360 identifiers, and the RFC 7633 TLS feature extension decode here too Fail-closed — `parse`, `pemDecode`, `pemEncode`, `decodeExtensions`, `decodeExtension` |
|
|
247
247
|
| `pki.schema.c509` | C509 certificates (draft-ietf-cose-cbor-encoded-cert), the compact CBOR profile of X.509, decoded fail-closed under deterministic CBOR. `encode` is the byte-exact inverse: a DER X.509 v3 certificate forward-transforms to a compact type-3 C509 whose reconstruction reproduces the original DER byte for byte, so the original signature still verifies. A `parse` result re-emits its native array in canonical deterministic CBOR, with the registry integer shorthands, the C509 compressions, and the compact draft-20 per-extension value forms: the scalar extensions (keyUsage, basicConstraints, extended key usage, subject key identifier, inhibitAnyPolicy, OCSP No Check, TLS Feature), the general-name-bearing extensions (subjectAltName, issuer alternative name, name constraints, CRL distribution points, freshest CRL, authority and subject information access, and the full authority key identifier) over one shared GeneralNames codec, certificate policies with their CPS-URI and UserNotice qualifiers, policy mappings and policy constraints, subject directory attributes, and the RFC 3779 resource-delegation extensions (IP address blocks and AS identifiers) with their RFC 8360 v2 twins, whose addresses ride either the delta-coded integer form or the byte-string form the specification mandates once an address exceeds eight octets. A value the compact form cannot carry exactly falls back to the byte-string form with its bytes intact; a certificate outside the invertible set throws a typed `C509Error`. Called explicitly, since it is CBOR rather than DER and so is not auto-routed |
|
|
248
|
-
| `pki.schema.crl` | X.509 CRLs (RFC 5280 §5): revoked serials with real-`Date` revocation times, named and partly decoded extensions Fail-closed — `parse`, `pemDecode`, `pemEncode` |
|
|
249
|
-
| `pki.schema.csr` | PKCS#10 certification requests (RFC 2986): subject DN, public key, requested attributes, signature Fail-closed — `parse`, `pemDecode`, `pemEncode` |
|
|
248
|
+
| `pki.schema.crl` | X.509 CRLs (RFC 5280 §5): revoked serials with real-`Date` revocation times, named and partly decoded extensions, each record carrying the raw `extnValue` octets as `valueBytes`. `decodeExtensions` returns the CRL's own extensions and every revoked entry's in one array, each row naming the scope it was read at, and covers the whole §5.2 and §5.3 profile including the issuing distribution point and the delta CRL indicator. `decodeExtension` takes the scope explicitly, since RFC 6960 §4.4.5 carries a CRL entry extension into an OCSP response Fail-closed — `parse`, `pemDecode`, `pemEncode`, `decodeExtensions`, `decodeExtension` |
|
|
249
|
+
| `pki.schema.csr` | PKCS#10 certification requests (RFC 2986): subject DN, public key, requested attributes, signature. `decodeExtensions` is what a CA reads to see what a request asked for, returning the rows of its one `extensionRequest` attribute; a request carrying more than one is refused, and `groups: true` reads each separately Fail-closed — `parse`, `pemDecode`, `pemEncode`, `decodeExtensions`, `decodeExtension` |
|
|
250
250
|
| `pki.schema.pkcs8` | PKCS#8 private keys (RFC 5208 / 5958): algorithm, raw key bytes, attributes, optional public key. Encrypted keys are recognized but not decrypted. Fail-closed — `parse`, `parseEncrypted`, `pemDecode`, `pemEncode` |
|
|
251
251
|
| `pki.schema.cms` | CMS (RFC 5652 / 5083 / 9629): SignedData (§5, signer infos plus raw signed-attribute bytes for external verification), EnvelopedData (§6, all five RecipientInfo kinds including RFC 5753 key agreement and RFC 9629 KEM recipients with ML-KEM validation), EncryptedData (§8), AuthenticatedData (§9, MAC surface plus raw `authAttrsBytes`), and AuthEnvelopedData (RFC 5083, with RFC 5084 AES-GCM/CCM parameter validation). §11 attribute placement is enforced, countersignatures validate recursively, certificates and CRLs are validated against the closed CHOICE sets and kept raw, and every result is tagged `contentTypeName` Fail-closed — `parse`, `pemDecode`, `pemEncode` |
|
|
252
252
|
| `pki.schema.ocsp` | OCSP requests and responses (RFC 6960): per-certificate status (good, revoked, unknown), responder identity, raw tbs bytes for external verification, certificates kept raw. A response's nonce, and a single response's archive cutoff (§4.4.4) and CRL reference (§4.4.2), are decoded onto their extension entries by name; a malformed one is refused. Non-basic response types are recognized but not decoded. Fail-closed — `parseRequest`, `parseResponse`, `pemDecode`, `pemEncode` |
|
|
253
253
|
| `pki.schema.tsp` | RFC 3161 timestamp requests, responses, and tokens: the TimeStampReq a client sends (imprint, requested policy, nonce, certReq), the TSTInfo payload (imprint, genTime with sub-second precision, serial, nonce, accuracy), the status-to-token coupling, and the token wrapper composed over CMS with the single-signer rule. Fail-closed — `parse`, `parseRequest`, `parseResponse`, `parseTstInfo`, `parseToken`, `pemDecode`, `pemEncode` |
|
|
254
|
-
| `pki.schema.attrcert` | Attribute certificates (RFC 5755): holder and issuer identities as validated GeneralNames, the validity window as real `Date`s, and the privilege attributes and extensions decoded to structured values (role, clearance, service and access identity, group, charging identity; audit identity, target and proxy information, no-rev-avail, AA controls), with the raw signed region for a verifier. Unknown types stay opaque, and the obsolete v1 form is recognized and deferred Fail-closed — `parse`, `pemDecode`, `pemEncode` |
|
|
255
|
-
| `pki.schema.crmf` | Certificate request messages (RFC 4211) — the CMP and EST enrollment body. The requested-certificate template (subject, public key, validity, extensions), proof of possession, and registration controls, with the raw `CertRequest` region surfaced for the caller to hash. Names are dual-accepted, IMPLICIT and EXPLICIT. This toolkit ships no proof-of-possession verifier yet, so confirming that a requester holds the key it asks to have certified remains the CA's own step Fail-closed — `parse`, `pemDecode`, `pemEncode` |
|
|
254
|
+
| `pki.schema.attrcert` | Attribute certificates (RFC 5755): holder and issuer identities as validated GeneralNames, the validity window as real `Date`s, and the privilege attributes and extensions decoded to structured values (role, clearance, service and access identity, group, charging identity; audit identity, target and proxy information, no-rev-avail, AA controls), with the raw signed region for a verifier. Unknown types stay opaque, and the obsolete v1 form is recognized and deferred. `decodeExtensions` returns the same row shape the other formats return, reporting the criticality RFC 5755 fixes for each extension it profiles Fail-closed — `parse`, `pemDecode`, `pemEncode`, `decodeExtensions`, `decodeExtension` |
|
|
255
|
+
| `pki.schema.crmf` | Certificate request messages (RFC 4211) — the CMP and EST enrollment body. The requested-certificate template (subject, public key, validity, extensions), proof of possession, and registration controls, with the raw `CertRequest` region surfaced for the caller to hash. Names are dual-accepted, IMPLICIT and EXPLICIT. This toolkit ships no proof-of-possession verifier yet, so confirming that a requester holds the key it asks to have certified remains the CA's own step. `decodeExtensions` reads the extensions every message's template asks for, each row naming its message Fail-closed — `parse`, `pemDecode`, `pemEncode`, `decodeExtensions`, `decodeExtension` |
|
|
256
256
|
| `pki.schema.pkcs12` | PKCS#12 (PFX) stores (RFC 7292) from DER, BER, or PEM: key bags via the PKCS#8 parser, shrouded keys with the algorithm surfaced and the ciphertext opaque, cert / CRL / secret bags raw and byte-exact, encrypted and enveloped safes structurally via CMS, `friendlyName` and `localKeyId` decoded, and the exact MAC byte range (`macedBytes`) plus RFC 9579 PBMAC1 recognition for external verification. BER is accepted exactly where §4.1 requires it Fail-closed — `parse`, `pemDecode`, `pemEncode` |
|
|
257
257
|
| `pki.schema.cmp` | CMP messages (RFC 9810): the header (version, sender and recipient including the anonymous NULL-DN, nonces, transaction id, general info), the 27-arm body (certificate requests via the CRMF parser, an encrypted certificate's EnvelopedData via CMS, response / revocation / confirmation / error / support / polling arms structural, the rest raw), and the exact `headerBytes` and `bodyBytes` slices an external verifier reconstructs the protected part from. The CMP-before-OCSP dispatch order is enforced Fail-closed — `parse`, `pemDecode`, `pemEncode` |
|
|
258
258
|
| `pki.schema.csrattrs` | EST CSR Attributes (`CsrAttrs`, RFC 8951 §3.5 / RFC 9908) — the `AttrOrOID` items a server sends to shape an enrollment: bare OIDs, attributes with raw values, and decoded views of the RFC 9908 meaningful types (extension requests, EC and RSA key-type conventions, the certification-request-info template). Unknown types are surfaced raw; structure and the RFC 9908 semantic MUSTs are fail-closed — `parse` |
|
|
@@ -265,7 +265,7 @@ comment blocks, is at [pkijs.com](https://pkijs.com).
|
|
|
265
265
|
| `pki.cmc` | Build and interpret CMC messages (RFC 5272, obsoleted by RFC 10002). `build(spec, signer)` assembles a Full PKI Request across all three request arms (PKCS#10, CRMF, other) and carries it either way RFC 5272 §3.2 allows: `{ cert, key }` signs it, while `{ mac: { identifier, secret } }` authenticates it under a shared secret for a client that holds no key yet, using the PasswordRecipientInfo that section requires and deriving the key from the identifier followed by the secret. A key that cannot sign for itself proves possession another way: `spec.popChallenge` answers the authority's encrypted challenge (RFC 5272 §6.7), decrypting the proof value, confirming it hashes to the witness the challenge carries, and returning the MAC the authority asked for, with `cmc/pop-failed` when the value is not the one issued. A signed request goes through `pki.cms.sign` under `id-cct-PKIData`. A PKCS#10 (`tcr`) request is verified against its own proof-of-possession before signing, so a request whose self-signature does not verify under its subject public key is refused rather than signed into a message a CA would reject. Body-part identifiers are unique across the whole message and never the reserved 0; a caller's clash is refused rather than renumbered, since a control may already reference it. An Identity Proof V2 witness is computed over the `reqSequence` bytes exactly as emitted (§6.2.1 step 1) rather than a re-serialization, a POP Link Witness is emitted only alongside the POP Link Random control §6.3.1.1 requires beside it, and a renewal carries neither Identification nor Identity Proof in either version. `verify(response, sent)` takes what the CA returned plus the state the client retained and reduces it to one terminal outcome: `issued`, `pending`, `confirm-required`, `pop-required`, or `rejected`. It binds the exchange first — Transaction Identifier, the Sender and Recipient Nonce echo compared in constant time and by full value so a truncation cannot match, and the Data Return echo — with each check applying only if the client sent that half, and, once sent, an absent or differing echo being a refusal, which is the replay defense. `bodyPartIDs` extends the same rule to what the response is about: a status reporting on a body part the request never sent is refused, which the transaction and nonce cannot catch, because a server can echo both correctly while answering about a different message. Several status controls are permitted and the worst governs, so a failure cannot hide behind an earlier success; the absence of any status control is success, per §6.1.2. The carrier's signature must verify (§3.2.1.3.4): a conforming SignedData carries its own signer certificate, so the ordinary build-then-verify flow needs nothing extra and the verdict reports `signatureVerified: true`. Where the signer is found nowhere the posture is fail-closed with a named opt-out — supply `certs` with the responder's certificate, or `allowUnverified: true`, in which case the verdict reports `signatureVerified: false`. Doing neither is refused, the opt-out never excuses a signature that is present and wrong, and a carrier with no signer at all is refused outright. The response's own `cmsSequence` and `otherMsgs` come back raw, since a request whose only arm was the other-message form has no certificate to return and §4.1 puts its answer there. Nothing is trusted: issued certificates are read from the CMS certificate bag (§4.2) and surfaced raw for `pki.path.validate`, and a Publish Trust Anchors control is surfaced with `trusted: false` rather than added to a store — `build`, `verify` |
|
|
266
266
|
| `pki.schema.cmc` | Decode CMC messages (RFC 5272 as updated by RFC 6402, the pair obsoleted by RFC 10002 / 10003 / 10004): 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` |
|
|
267
267
|
| `pki.schema.engine` | The declarative ASN.1 structure-schema engine every format parser composes — `walk`, `encode`, `embeddedDer`, and the schema combinators |
|
|
268
|
-
| `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
|
|
268
|
+
| `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 policies, processed as the RFC 9618 `valid_policy_graph` in place of the RFC 5280 §6.1 policy tree. The graph holds one node per depth and policy identifier and gives it several parents where the tree made a separate node under each, so its size is linear in the policies and mappings on the path rather than exponential in the path length: a six-certificate chain whose policies map to each other needs 25 nodes where the tree needed 5461, and chains the tree could not hold inside `maxPolicyNodes` now validate. 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. `fetchingChecker(opts)` is the checker that goes and gets what it needs: it reads the cRLDistributionPoints and id-ad-ocsp locations out of the certificate and asks for them over `opts.transport`, OCSP first and a CRL after (RFC 5019 §3.1). It is off unless an operator builds it and passes it, so the default validation touches no network, and it runs during `validate` and not during `build`, because §3.2 has a status check requested only after the chain signatures are validated. A distribution point is fetched only as a `fullName` carrying a URI whose scheme this client speaks; ldap, ftp, a `nameRelativeToCRLIssuer` and a point naming a cRLIssuer and no location are counted as skips, so a certificate naming nothing fetchable reads as that rather than as a failed fetch. Nothing is trusted by having been fetched: a CRL goes to `crlChecker` and a response to `verifyOcspResponse`, and the structure a body parses as is decided by which extension named the URL, so a Content-Type mismatch is reported and never selects a parser. Every fault is an undetermined status carrying its reason and `check` throws nothing, which is what leaves `softFail` able to waive one. Plaintext `http` is accepted by default, these being signed objects the toolkit verifies, with `allowPlaintextHttp: false` to narrow it; the SSRF guards hold either way (no private, loopback or link-local destination, no redirect following, a response-size cap, a per-certificate URL cap, a total fetch count, and a wall-clock deadline across the validation). A verified response is cached in process on its CertID and responder URL and a CRL on its request URL and issuer name, with reuse decided from the signed thisUpdate and nextUpdate alone. Pure and re-entrant — `validate`, `build`, `crlChecker`, `ocspChecker`, `fetchingChecker` |
|
|
269
269
|
| `pki.identity` | Service identity (RFC 9525, which obsoletes RFC 6125). `match(cert, references, opts)` says whether a certificate presents a name the client was trying to reach, which is a separate answer from whether it chains: §1.2 has an application need both, and `pki.path.validate` takes `opts.identity` to run them together and report each. A reference identity is a domain name (DNS-ID), a textual IP address or a 4- or 16-octet `BufferSource` (IP-ID), `{ type: "srv", service: "_imap", value: "example.com" }` (SRV-ID, RFC 4985), or `{ type: "uri", scheme: "https", value: "www.example.com" }` (URI-ID). A record carries its service type and its domain together, so no comparison can pair the service of one reference with the domain of another (§6.5). The subject `commonName` is never read, under any option or fallback, including when the certificate carries no subjectAltName at all (§2). Names are compared label by label under an ASCII-only fold with one trailing dot normalized on both sides; an A-label is compared as the ASCII it is and never decoded, so a reference carrying a character outside ASCII is refused rather than guessed at, this toolkit shipping no IDNA implementation. An IP-ID is compared octet for octet against an `iPAddress` entry, never against a `dNSName` holding the same address as text, and no prefix or mask applies (§6.2, §6.4). Wildcards are on and `opts.wildcards: false` turns them off, which §3 requires stating either way: one wildcard, the whole of the left-most label, reaching exactly one reference label, and a presented name failing those rules is ignored with the search continuing rather than refusing the certificate (§6.3). A wildcard spanning an administrative boundary such as `*.co.uk` is out of scope as it is in §7.1, since no public-suffix list ships here. The verdict names which reference matched, so a caller can use it as the validated identity (§6.6), and lists every entry that was skipped with the reason — `match` |
|
|
270
270
|
| `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. `parseDn(dn)` reads a distinguished-name string into `{ rdns, dn, bytes }`, the inverse of the `dn` every parsed name carries, with `bytes` being the raw Name DER `spec.subject` and `spec.issuer` take. 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; the AKI optionally naming the issuing certificate by name and serial; both emitted without being named, the SKI on every certificate and the AKI on every certificate that is not self-signed, which is what RFC 5280 §4.2.1.1 and §4.2.1.2 place on the issuing CA, and `false` declines each only where the RFC allows the omission), subject alternative names, certificate policies with their RFC 5280 section 4.2.1.4 qualifiers (a CPS pointer and a user notice), name constraints, authority information access, CRL distribution points, the freshest CRL, issuer alternative names, the policy machinery path validation acts on (policy constraints, inhibit anyPolicy, policy mappings), the RFC 3739 qualified-certificate statements including the ETSI EN 319 412-5 set, the RFC 6962 certificate-transparency pair (the precertificate poison and the embedded SCT list), the Active Directory Certificate Services enrollment extensions (certificate template, legacy template name, CA version, previous-CA-certificate hash, application policies), subject information access, subject directory attributes, and the RFC 6960 OCSP no-check responder marker, from the spec. That is every extension the shared certificate-extension decoders read, so any certificate `pki.lint.certificate` and `pki.inspect` can read in full the toolkit can also issue; any other extension is taken 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. `extension(name, value, opts)` encodes one Extension DER from the same plain value form, for the pre-encoded array form on the certificate, CSR, and CRL signers: the criticality follows what the signer emits, `opts.critical` reaches only the extensions whose criticality is the issuer's choice, and an unregistered dotted OID takes its extnValue as bytes. Parsing stays at `pki.schema.x509.parse` — `sign`, `randomSerial`, `extension`, `parseDn` |
|
|
271
271
|
| `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, the RFC 3739 qualified-certificate statements, the Microsoft certificate template and application policies, subject information access, subject directory attributes, or an array of pre-encoded Extension DER; an extension the issuing CA assigns, such as the authority key identifier or the OCSP no-check marker, is refused by name rather than requested), 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` |
|
package/lib/attrcert-sign.js
CHANGED
|
@@ -69,18 +69,17 @@ var ATTR_OID_NAME = intrinsic.assign(intrinsic.create(null), {
|
|
|
69
69
|
role: "role", clearance: "clearance", group: "group", chargingIdentity: "chargingIdentity",
|
|
70
70
|
accessIdentity: "accessIdentity", authenticationInfo: "authenticationInfo",
|
|
71
71
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Object.keys(EXT_META).forEach(function (k) { REQUIRED_CRITICALITY[O(EXT_META[k].name)] = EXT_META[k].critical; });
|
|
72
|
+
/** @internal The criticality each extension must carry is the schema module's table, so the shape
|
|
73
|
+
* this signer refuses to write and the deviation the extension door reports are one row set. What
|
|
74
|
+
* stays here is the friendly option name each extension is written under. */
|
|
75
|
+
var REQUIRED_CRITICALITY = attrcert.extensionCriticality(oid);
|
|
76
|
+
var EXT_META = intrinsic.create(null);
|
|
77
|
+
intrinsic.forEach([
|
|
78
|
+
["auditIdentity", "acAuditIdentity"], ["targetInformation", "targetInformation"],
|
|
79
|
+
["noRevAvail", "noRevAvail"], ["aaControls", "aaControls"], ["acProxying", "acProxying"],
|
|
80
|
+
["authorityKeyIdentifier", "authorityKeyIdentifier"], ["cRLDistributionPoints", "cRLDistributionPoints"],
|
|
81
|
+
["authorityInfoAccess", "authorityInfoAccess"],
|
|
82
|
+
], function (r) { EXT_META[r[0]] = { name: r[1], critical: REQUIRED_CRITICALITY[O(r[1])].critical }; });
|
|
84
83
|
var OID_AKI = O("authorityKeyIdentifier"), OID_OCSP = O("ocsp");
|
|
85
84
|
|
|
86
85
|
/** @internal RFC 5755 sets rules on the issuer that its parser reads past and its verifier does
|
|
@@ -442,9 +441,9 @@ function _buildExtensions(extSpec, ctx) {
|
|
|
442
441
|
var extnId = asn1.read.oid(n.children[0]);
|
|
443
442
|
if (seenA[extnId]) throw _err("attrcert/bad-input", "duplicate extension " + extnId + " (RFC 5755 sec. 4.2.9)");
|
|
444
443
|
seenA[extnId] = true;
|
|
445
|
-
var
|
|
446
|
-
if (
|
|
447
|
-
throw _err("attrcert/bad-input", "pre-encoded " + (oid.name(extnId) || extnId) + " extension must be marked " + (
|
|
444
|
+
var fixed = intrinsic.hasOwn(REQUIRED_CRITICALITY, extnId) ? REQUIRED_CRITICALITY[extnId] : null;
|
|
445
|
+
if (fixed !== null && (n.children.length === 3) !== fixed.critical) {
|
|
446
|
+
throw _err("attrcert/bad-input", "pre-encoded " + (oid.name(extnId) || extnId) + " extension must be marked " + (fixed.critical ? "critical" : "non-critical") + " (" + fixed.citation + ")");
|
|
448
447
|
}
|
|
449
448
|
var extnValue = asn1.read.octetString(n.children[n.children.length - 1]);
|
|
450
449
|
var decoded;
|
package/lib/constants.js
CHANGED
|
@@ -244,6 +244,11 @@ var NAMES = Object.assign(Object.create(null), {
|
|
|
244
244
|
"8": "removeFromCRL", "9": "privilegeWithdrawn", "10": "aACompromise",
|
|
245
245
|
},
|
|
246
246
|
OCSP_STATUS: { "0": "successful", "1": "malformedRequest", "2": "internalError", "3": "tryLater", "5": "sigRequired", "6": "unauthorized" },
|
|
247
|
+
/** @internal The TLS ExtensionType values RFC 7633 sec. 4 names for the TLS feature extension. A
|
|
248
|
+
* value outside this table is printed as its number. */
|
|
249
|
+
TLS_FEATURE: { "5": "status_request", "17": "status_request_v2" },
|
|
250
|
+
/** @internal The IANA Address Family Numbers RFC 3779 sec. 2.2.3.3 names. */
|
|
251
|
+
ADDRESS_FAMILY: { "1": "IPv4", "2": "IPv6" },
|
|
247
252
|
OBJECT_DIGEST_TYPE: { "0": "publicKey", "1": "publicKeyCert", "2": "otherObjectTypes" },
|
|
248
253
|
ALGORITHM: {
|
|
249
254
|
rsaEncryption: "rsaEncryption", rsassaPss: "rsassaPss", rsaesOaep: "rsaesOaep", ecPublicKey: "id-ecPublicKey",
|
package/lib/guard-parsed.js
CHANGED
|
@@ -60,7 +60,7 @@ function _isExtensionEntry(e) {
|
|
|
60
60
|
|
|
61
61
|
function _isCrlExtensionEntry(e) {
|
|
62
62
|
return !!e && typeof e.oid === "string" && _isOptName(e.name) &&
|
|
63
|
-
typeof e.critical === "boolean" && e.value !== undefined;
|
|
63
|
+
typeof e.critical === "boolean" && e.value !== undefined && _isBuffer(e.valueBytes);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// @enforced-by guard-shape-reinlined -- shares the `accept` shape below: any door
|
package/lib/inspect.js
CHANGED
|
@@ -134,6 +134,31 @@ function _keyBlock(spki, pad) {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
|
|
137
|
+
var TLS_FEATURE_NAMES = NAMES.TLS_FEATURE;
|
|
138
|
+
var AFI_NAMES = NAMES.ADDRESS_FAMILY;
|
|
139
|
+
var ipUtils = require("./ip-utils");
|
|
140
|
+
/** @internal An RFC 3779 IPAddress is a BIT STRING carrying only the leading bits of the address.
|
|
141
|
+
* What the bits it does not carry stand for depends on where the address sits: RFC 3779 sec. 2.1.2
|
|
142
|
+
* makes them zero in a range's `min` and ONE in its `max`, so a max written out zero-filled names
|
|
143
|
+
* a different address from the one the range ends at. `fillOnes` selects the rule, and it applies
|
|
144
|
+
* to the unused bits inside the last present octet as well as to the octets left off entirely. */
|
|
145
|
+
var AFI_OCTETS = Object.assign(Object.create(null), { 1: 4, 2: 16 });
|
|
146
|
+
function _ipAddressText(afi, addr, fillOnes) {
|
|
147
|
+
var width = AFI_OCTETS[afi];
|
|
148
|
+
if (!width || addr.bytes.length > width) return addr.bytes.toString("hex");
|
|
149
|
+
var padded = Buffer.alloc(width, fillOnes ? 0xff : 0x00);
|
|
150
|
+
addr.bytes.copy(padded, 0, 0, addr.bytes.length);
|
|
151
|
+
if (addr.unusedBits > 0 && addr.bytes.length > 0) {
|
|
152
|
+
var last = addr.bytes.length - 1;
|
|
153
|
+
var keep = (0xff << addr.unusedBits) & 0xff;
|
|
154
|
+
padded[last] = fillOnes ? (padded[last] | (~keep & 0xff)) : (padded[last] & keep);
|
|
155
|
+
}
|
|
156
|
+
return ipUtils.textFromOctets(padded) || padded.toString("hex");
|
|
157
|
+
}
|
|
158
|
+
/** @internal A prefix names a block, so it is written as its address and its length in bits. A
|
|
159
|
+
* range endpoint names one address and carries no length. */
|
|
160
|
+
function _ipPrefix(afi, addr) { return _ipAddressText(afi, addr, false) + "/" + addr.prefixLength; }
|
|
161
|
+
|
|
137
162
|
var EXT_LABEL = NAMES.EXTENSION;
|
|
138
163
|
var KU_LABEL = NAMES.KEY_USAGE;
|
|
139
164
|
var EKU_LABEL = NAMES.EXT_KEY_USAGE;
|
|
@@ -388,8 +413,42 @@ var EXT_RENDERERS = Object.assign(Object.create(null), {
|
|
|
388
413
|
}
|
|
389
414
|
return akiLines.length ? akiLines.join("\n") : inner + "keyid:(none)";
|
|
390
415
|
},
|
|
416
|
+
/** @internal RFC 7633 sec. 6 carries TLS ExtensionType values, so each is named from the registry
|
|
417
|
+
* where the toolkit knows it and printed as its number where it does not. */
|
|
418
|
+
tlsFeature: function (decoded, inner) {
|
|
419
|
+
return (decoded.features || []).map(function (f) {
|
|
420
|
+
var text = String(f);
|
|
421
|
+
var name = TLS_FEATURE_NAMES[text];
|
|
422
|
+
return inner + (name ? name + " (" + text + ")" : text);
|
|
423
|
+
}).join("\n") || inner + "(none)";
|
|
424
|
+
},
|
|
425
|
+
ipAddrBlocks: function (decoded, inner) {
|
|
426
|
+
return (decoded.families || []).map(function (f) {
|
|
427
|
+
var head = inner + (AFI_NAMES[f.afi] || "AFI " + f.afi) + (f.safi === null ? "" : " SAFI " + f.safi) + ":";
|
|
428
|
+
if (f.inherit) return head + " inherit";
|
|
429
|
+
var rows = (f.addressesOrRanges || []).map(function (r) {
|
|
430
|
+
if (r.kind === "addressPrefix") return inner + " " + _ipPrefix(f.afi, r.addressPrefix);
|
|
431
|
+
return inner + " " + _ipAddressText(f.afi, r.min, false) + " to " + _ipAddressText(f.afi, r.max, true);
|
|
432
|
+
});
|
|
433
|
+
return head + (rows.length ? "\n" + rows.join("\n") : " (none)");
|
|
434
|
+
}).join("\n") || inner + "(none)";
|
|
435
|
+
},
|
|
436
|
+
autonomousSysIds: function (decoded, inner) {
|
|
437
|
+
var lines = [];
|
|
438
|
+
[["asnum", decoded.asnum], ["rdi", decoded.rdi]].forEach(function (pair) {
|
|
439
|
+
if (pair[1] === null) return;
|
|
440
|
+
if (pair[1].inherit) { lines.push(inner + pair[0] + ": inherit"); return; }
|
|
441
|
+
lines.push(inner + pair[0] + ":");
|
|
442
|
+
(pair[1].asIdsOrRanges || []).forEach(function (r) {
|
|
443
|
+
lines.push(inner + " " + (r.kind === "id" ? String(r.id) : String(r.min) + " to " + String(r.max)));
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
return lines.length ? lines.join("\n") : inner + "(none)";
|
|
447
|
+
},
|
|
391
448
|
});
|
|
392
449
|
EXT_RENDERERS.msApplicationPolicies = EXT_RENDERERS.certificatePolicies;
|
|
450
|
+
EXT_RENDERERS.ipAddrBlocksV2 = EXT_RENDERERS.ipAddrBlocks;
|
|
451
|
+
EXT_RENDERERS.autonomousSysIdsV2 = EXT_RENDERERS.autonomousSysIds;
|
|
393
452
|
|
|
394
453
|
|
|
395
454
|
function _renderExtValue(ext, decoded, inner) {
|
package/lib/lint.js
CHANGED
|
@@ -1416,10 +1416,10 @@ var OID_REASON_CODE = oid.byName("reasonCode");
|
|
|
1416
1416
|
* references itself and refuses a malformed one, so an entry for any of those would be dead. */
|
|
1417
1417
|
var OCSP_SINGLE_VALUE_READER = Object.create(null);
|
|
1418
1418
|
OCSP_SINGLE_VALUE_READER[OID_REASON_CODE] = function (bytes) {
|
|
1419
|
-
crlSchema.
|
|
1419
|
+
crlSchema.decodeExt({ oid: OID_REASON_CODE, name: "reasonCode", critical: false, value: bytes });
|
|
1420
1420
|
};
|
|
1421
1421
|
OCSP_SINGLE_VALUE_READER[oid.byName("invalidityDate")] = function (bytes) {
|
|
1422
|
-
crlSchema.
|
|
1422
|
+
crlSchema.decodeExt({ oid: oid.byName("invalidityDate"), name: "invalidityDate", critical: false, value: bytes });
|
|
1423
1423
|
};
|
|
1424
1424
|
OCSP_SINGLE_VALUE_READER[oid.byName("certificateIssuer")] = CRL_ENTRY_VALUE_READER[oid.byName("certificateIssuer")];
|
|
1425
1425
|
var OCSP_RESPONSE_VALUE_READER = Object.create(null);
|
|
@@ -1444,7 +1444,7 @@ function _singleReasonCode(sr) {
|
|
|
1444
1444
|
var e = _extIn(_ocspSingleExts(sr), OID_REASON_CODE);
|
|
1445
1445
|
if (!e || !Buffer.isBuffer(e.value)) return null;
|
|
1446
1446
|
// allow:swallow-unverified a value the CRL reader refuses carries no reason; the value-syntax row reports it
|
|
1447
|
-
try { return crlSchema.
|
|
1447
|
+
try { return crlSchema.decodeExt(e).value; }
|
|
1448
1448
|
catch (_e) { return null; }
|
|
1449
1449
|
}
|
|
1450
1450
|
/** @internal RFC 6960 sec. 2.2 gives a "revoked" answer for a non-issued certificate a fixed shape:
|