@blamejs/pki 0.5.6 → 0.5.8
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 +419 -378
- package/MIGRATING.md +65 -0
- package/README.md +12 -12
- package/lib/acme.js +31 -31
- package/lib/asn1-der.js +10 -10
- package/lib/attrcert-sign.js +24 -20
- package/lib/byte-reader.js +6 -6
- package/lib/byte-writer.js +5 -5
- package/lib/cbor-det.js +27 -24
- package/lib/cmc-build.js +104 -104
- package/lib/cmc-verify.js +108 -32
- package/lib/cmp-build.js +31 -26
- package/lib/cmp-session.js +74 -72
- package/lib/cmp-verify.js +72 -58
- package/lib/cms-compress.js +8 -9
- package/lib/cms-decrypt.js +92 -76
- package/lib/cms-encrypt.js +33 -34
- package/lib/cms-sign.js +100 -54
- package/lib/cms-verify.js +141 -82
- package/lib/composite-sig.js +13 -13
- package/lib/constants.js +4 -4
- package/lib/crl-sign.js +31 -25
- package/lib/crl-verify.js +7 -6
- package/lib/crmf-sign.js +19 -15
- package/lib/csr-sign.js +13 -9
- package/lib/ct.js +37 -37
- package/lib/edwards-point.js +7 -7
- package/lib/est.js +103 -59
- package/lib/framework-error.js +5 -5
- package/lib/guard-all.js +3 -3
- package/lib/guard-async.js +4 -4
- package/lib/guard-bytes.js +378 -15
- package/lib/guard-compress.js +17 -17
- package/lib/guard-crypto.js +1 -1
- package/lib/guard-encoding.js +15 -15
- package/lib/guard-header.js +3 -3
- package/lib/guard-identifier.js +16 -16
- package/lib/guard-json.js +15 -15
- package/lib/guard-limits.js +7 -7
- package/lib/guard-name.js +81 -16
- package/lib/guard-parsed.js +144 -75
- package/lib/guard-range.js +19 -19
- package/lib/guard-secret.js +11 -10
- package/lib/guard-text.js +6 -6
- package/lib/guard-time.js +10 -10
- package/lib/hpke.js +18 -17
- package/lib/http-digest.js +35 -35
- package/lib/http-retry-after.js +13 -13
- package/lib/http-transport.js +20 -19
- package/lib/inspect.js +53 -53
- package/lib/ip-utils.js +2 -2
- package/lib/jose.js +13 -13
- package/lib/key.js +16 -16
- package/lib/lint.js +51 -51
- package/lib/merkle.js +51 -36
- package/lib/mime.js +18 -18
- package/lib/ocsp-verify.js +10 -10
- package/lib/ocsp.js +32 -20
- package/lib/oid.js +29 -29
- package/lib/path-validate.js +114 -113
- package/lib/pbes2.js +16 -16
- package/lib/pkcs12-build.js +71 -56
- package/lib/pki-build.js +23 -22
- package/lib/rc2.js +1 -1
- package/lib/rfc3339.js +5 -5
- package/lib/schema-all.js +31 -31
- package/lib/schema-attrcert.js +12 -12
- package/lib/schema-c509.js +144 -142
- package/lib/schema-cmc.js +58 -58
- package/lib/schema-cmp.js +43 -43
- package/lib/schema-cms.js +169 -36
- package/lib/schema-crl.js +7 -7
- package/lib/schema-crmf.js +28 -28
- package/lib/schema-csr.js +12 -12
- package/lib/schema-csrattrs.js +16 -16
- package/lib/schema-engine.js +18 -18
- package/lib/schema-ocsp.js +15 -15
- package/lib/schema-pkcs12.js +20 -20
- package/lib/schema-pkcs8.js +2 -2
- package/lib/schema-pkix.js +131 -126
- package/lib/schema-smime.js +19 -19
- package/lib/schema-tsp.js +12 -12
- package/lib/schema-x509.js +3 -3
- package/lib/shbs.js +18 -18
- package/lib/sign-scheme.js +19 -16
- package/lib/sigstore.js +10 -11
- package/lib/sleep.js +1 -1
- package/lib/smime.js +308 -96
- package/lib/tls-cert-compress.js +18 -18
- package/lib/trust.js +27 -27
- package/lib/tsp-sign.js +22 -18
- package/lib/validator-all.js +1 -1
- package/lib/validator-attcert.js +1 -1
- package/lib/validator-cose.js +43 -44
- package/lib/validator-keydesc.js +3 -3
- package/lib/validator-sig.js +13 -13
- package/lib/validator-tls.js +11 -11
- package/lib/validator-tpm.js +21 -20
- package/lib/webauthn-mds.js +67 -67
- package/lib/webauthn.js +34 -34
- package/lib/webcrypto.js +15 -15
- package/lib/x509-sign.js +24 -15
- package/package.json +3 -2
- package/sbom.cdx.json +6 -6
package/lib/ocsp.js
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
* (`pki.ocsp.verify`). Parsing lives in `pki.schema.ocsp`; revocation during path validation is
|
|
13
13
|
* `pki.path.ocspChecker`. Signing rides the shared sign-scheme registry (the same classical +
|
|
14
14
|
* post-quantum set `pki.cms.sign` uses), so a response is signed under RSA / ECDSA / EdDSA /
|
|
15
|
-
* ML-DSA / SLH-DSA per the responder key. Verification composes the
|
|
16
|
-
* authorization
|
|
15
|
+
* ML-DSA / SLH-DSA per the responder key. Verification composes the same hardened responder-
|
|
16
|
+
* authorization, signature and currency gates `pki.path.ocspChecker` runs; there is no weaker
|
|
17
17
|
* second verify path. Fail-closed: `verify` returns a `"unknown"` verdict (never a silent accept)
|
|
18
|
-
* for any unmet gate, with
|
|
18
|
+
* for any unmet gate, with one scoped exception: a request-nonce mismatch downgrades only a
|
|
19
19
|
* `good` to `"unknown"`, leaving a signed, current, authorized `revoked` reported as `revoked`
|
|
20
20
|
* with `nonceMatched: false` (see `verify`). Malformed input throws a typed `OcspError`.
|
|
21
21
|
* @spec RFC 6960, RFC 9654, RFC 5019
|
|
@@ -45,8 +45,8 @@ function _err(code, message, cause) { return new OcspError(code, message, cause)
|
|
|
45
45
|
function _signE(kind, message, cause) { return new OcspError("ocsp/" + kind, message, cause); }
|
|
46
46
|
|
|
47
47
|
// CertID / responder-ID hash algorithm name -> WebCrypto digest name. SHA-1 is the RFC 5019 interop
|
|
48
|
-
// default for the CertID
|
|
49
|
-
// lookup, so SHAttered does not bar it
|
|
48
|
+
// default for the CertID identity hash (not a signature; collision resistance is irrelevant to the
|
|
49
|
+
// lookup, so SHAttered does not bar it, the same deliberate split path-validate makes).
|
|
50
50
|
var HASH_WC = { sha1: "SHA-1", sha256: "SHA-256", sha384: "SHA-384", sha512: "SHA-512" };
|
|
51
51
|
// A CRLReason name -> its enumerated value (RFC 5280 sec. 5.3.1), reverse of pki.C.NAMES.CRL_REASON.
|
|
52
52
|
var REASON_CODE = {};
|
|
@@ -73,7 +73,7 @@ function _certOf(arg, what) {
|
|
|
73
73
|
// The response, always parsed from the bytes the caller handed over. See verify's own comment for
|
|
74
74
|
// why an object cannot be accepted here: the three parts of a signature check would come from three
|
|
75
75
|
// independently-chosen properties. The claim is detected on any of the parsed-response fields, so a
|
|
76
|
-
// caller who passes one is told what happened
|
|
76
|
+
// caller who passes one is told what happened, never given a byte-parse fault about its type.
|
|
77
77
|
var _RESPONSE_CLAIM = ["responseStatus", "basicResponse", "tbsResponseDataBytes"];
|
|
78
78
|
function _responseFromBytes(response) {
|
|
79
79
|
return guard.parsed.fromTrustedSource(response, "ocspResponse", _RESPONSE_CLAIM, function (bytes) {
|
|
@@ -83,8 +83,7 @@ function _responseFromBytes(response) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
function _toDer(input, what) {
|
|
86
|
-
if (Buffer.isBuffer(input)) return input;
|
|
87
|
-
if (input instanceof Uint8Array) return Buffer.from(input);
|
|
86
|
+
if (Buffer.isBuffer(input) || input instanceof Uint8Array) return guard.bytes.snapshot(input, OcspError, "ocsp/bad-input", what || "input");
|
|
88
87
|
if (typeof input === "string") { try { return ocspSchema.pemDecode(input); } catch (e) { throw _err("ocsp/bad-input", (what || "input") + " PEM could not be decoded", e); } }
|
|
89
88
|
throw _err("ocsp/bad-input", (what || "input") + " must be a DER Buffer, Uint8Array, or PEM string");
|
|
90
89
|
}
|
|
@@ -133,11 +132,11 @@ function _buildCertID(cert, issuer, hashName) {
|
|
|
133
132
|
* `opts.pem` is set.
|
|
134
133
|
*
|
|
135
134
|
* @opts
|
|
136
|
-
* hashAlgorithm `"sha1"` (default) / `"sha256"` / `"sha384"` / `"sha512"
|
|
135
|
+
* hashAlgorithm `"sha1"` (default) / `"sha256"` / `"sha384"` / `"sha512"`; the CertID identity hash.
|
|
137
136
|
* nonce `true` for a fresh 32-octet CSPRNG nonce (RFC 9654), or a caller Buffer (1..128 octets).
|
|
138
137
|
* requestorName a Name (RDN array) placed in the [1] requestorName as a directoryName.
|
|
139
138
|
* signer `{ cert, key }` to sign the request (requires requestorName).
|
|
140
|
-
* profile `"lightweight"
|
|
139
|
+
* profile `"lightweight"`: one Request, SHA-1 CertID, nonce-only extensions (RFC 5019).
|
|
141
140
|
* pem emit a PEM `OCSP REQUEST` string instead of DER.
|
|
142
141
|
* @example
|
|
143
142
|
* var ca = await pki.key.generate("Ed25519");
|
|
@@ -152,6 +151,15 @@ function _buildCertID(cert, issuer, hashName) {
|
|
|
152
151
|
* var der = await pki.ocsp.buildRequest({ cert: leafDer, issuer: caDer }, { nonce: true });
|
|
153
152
|
*/
|
|
154
153
|
function buildRequest(query, opts) {
|
|
154
|
+
// Both arguments copied at entry and released when the call settles -- see the note on the same
|
|
155
|
+
// call in x509-sign. The request is assembled across several promise turns (each CertID is a
|
|
156
|
+
// hash), and opts carries byte fields -- the nonce and requestorName -- that reach the encoding.
|
|
157
|
+
return guard.bytes.fixedCall(OcspError, "ocsp/bad-input", [
|
|
158
|
+
[query, "the OCSP request query"], [opts, "pki.ocsp.buildRequest options"],
|
|
159
|
+
], _buildRequest);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function _buildRequest(query, opts) {
|
|
155
163
|
opts = opts || {};
|
|
156
164
|
var lightweight = opts.profile === "lightweight";
|
|
157
165
|
var hashName = opts.hashAlgorithm || "sha1";
|
|
@@ -201,7 +209,7 @@ function buildRequest(query, opts) {
|
|
|
201
209
|
}
|
|
202
210
|
function _emitReq(der, opts) { return opts.pem ? ocspSchema.pemEncode(der, "OCSP REQUEST") : der; }
|
|
203
211
|
function _nameDer(name) {
|
|
204
|
-
if (Buffer.isBuffer(name)) return name;
|
|
212
|
+
if (Buffer.isBuffer(name)) return guard.bytes.snapshot(name, OcspError, "ocsp/bad-input", "requestorName");
|
|
205
213
|
if (name && name.bytes) return name.bytes; // a parsed Name
|
|
206
214
|
throw _err("ocsp/bad-input", "requestorName must be a DER Name Buffer or a parsed Name");
|
|
207
215
|
}
|
|
@@ -210,8 +218,7 @@ function _nameDer(name) {
|
|
|
210
218
|
// a parsed certificate does not retain its full DER encoding, and re-encoding it would risk
|
|
211
219
|
// byte drift from the signed original, so a parsed cert is rejected rather than reconstructed.
|
|
212
220
|
function _normCertDer(cert, what) {
|
|
213
|
-
if (Buffer.isBuffer(cert)) return cert;
|
|
214
|
-
if (cert instanceof Uint8Array) return Buffer.from(cert);
|
|
221
|
+
if (Buffer.isBuffer(cert) || cert instanceof Uint8Array) return guard.bytes.snapshot(cert, OcspError, "ocsp/bad-input", what || "a certificate");
|
|
215
222
|
if (typeof cert === "string") { try { return x509.pemDecode(cert); } catch (e) { throw _err("ocsp/bad-input", (what || "a certificate") + " PEM could not be decoded", e); } }
|
|
216
223
|
if (cert && cert.tbsBytes && cert.subjectPublicKeyInfo) {
|
|
217
224
|
throw _err("ocsp/bad-input", (what || "a certificate") + " to embed must be supplied as DER bytes or a PEM string, not a parsed certificate (the parser does not retain the full DER encoding needed to embed it verbatim)");
|
|
@@ -231,7 +238,7 @@ function _normCertDer(cert, what) {
|
|
|
231
238
|
* responderID, an optional producedAt, and one or more per-certificate responses; `responder` is the
|
|
232
239
|
* `{ cert, key }` signing the response (the issuing CA directly, or a CA-issued delegate bearing
|
|
233
240
|
* id-kp-OCSPSigning + id-pkix-ocsp-nocheck). The signature is computed over the exact ResponseData
|
|
234
|
-
* DER (RFC 6960 sec. 4.2.1
|
|
241
|
+
* DER (RFC 6960 sec. 4.2.1: no CMS wrapper, no signed attributes). The responder certificate is
|
|
235
242
|
* embedded in `certs [0]` so a relying party can find it. Returns the response DER, or PEM.
|
|
236
243
|
*
|
|
237
244
|
* @opts
|
|
@@ -259,7 +266,11 @@ function _normCertDer(cert, what) {
|
|
|
259
266
|
// Documented `-> Promise`, so a fault leaves as a REJECTION (guard-async); the checks stay
|
|
260
267
|
// synchronous because they read the responder's mutable cert and key.
|
|
261
268
|
function sign(responseData, responder, opts) {
|
|
262
|
-
|
|
269
|
+
// Every caller-owned argument copied at entry and released when the call settles -- see the note
|
|
270
|
+
// on the same call in x509-sign.
|
|
271
|
+
return guard.bytes.fixedCall(OcspError, "ocsp/bad-input", [
|
|
272
|
+
[responseData, "the OCSP responseData"], [responder, "the responder"], [opts, "pki.ocsp.sign options"],
|
|
273
|
+
], _sign);
|
|
263
274
|
}
|
|
264
275
|
|
|
265
276
|
function _sign(responseData, responder, opts) {
|
|
@@ -438,15 +449,15 @@ function buildErrorResponse(status) {
|
|
|
438
449
|
* an AUTHORIZED responder (the issuing CA directly, or a CA-issued delegate bearing id-kp-OCSPSigning
|
|
439
450
|
* + id-pkix-ocsp-nocheck), verifies the signature over `tbsResponseData`, matches the CertID triple
|
|
440
451
|
* to the target certificate under the CertID's own hashAlgorithm, checks currency
|
|
441
|
-
* (`thisUpdate`/`nextUpdate`), and
|
|
442
|
-
* nonce echoes it. This runs the
|
|
452
|
+
* (`thisUpdate`/`nextUpdate`), and, when `opts.requestNonce` is supplied, confirms the response
|
|
453
|
+
* nonce echoes it. This runs the same hardened gates `pki.path.ocspChecker` does. Fail-closed: an
|
|
443
454
|
* unauthorized, stale, or CertID-mismatched response is a `"unknown"` verdict (never a silent
|
|
444
455
|
* accept); a malformed response's parse fault surfaces as the parser's `ocsp/*` / `asn1/*`.
|
|
445
456
|
*
|
|
446
|
-
* The request-nonce check is reported, and downgrades `good`
|
|
457
|
+
* The request-nonce check is reported, and downgrades `good` alone. Every verdict carries
|
|
447
458
|
* `nonceMatched` (true / false / null when the client sent no nonce). An unmatched nonce turns a
|
|
448
459
|
* `good` into `"unknown"`, because a response that is not an answer to this request cannot be relied
|
|
449
|
-
* on to say the certificate is still fine. It does
|
|
460
|
+
* on to say the certificate is still fine. It does not touch `revoked`: revocation does not go stale
|
|
450
461
|
* the way non-revocation does, so discarding a signed, current, authorized `revoked` because it was
|
|
451
462
|
* replayed would hand a soft-failing caller the very certificate the responder refused. A replayed
|
|
452
463
|
* `revoked` is therefore reported as `revoked` with `nonceMatched: false`.
|
|
@@ -509,7 +520,8 @@ function verify(response, opts) {
|
|
|
509
520
|
// A client that sent a nonce binds it (RFC 9654 / RFC 5019 sec. 4): a missing or mismatched
|
|
510
521
|
// response nonce fails the verdict closed, even if the status/signature were otherwise good.
|
|
511
522
|
var respNonce = _responseNonce(parsed);
|
|
512
|
-
var reqNonce = Buffer.isBuffer(opts.requestNonce)
|
|
523
|
+
var reqNonce = (Buffer.isBuffer(opts.requestNonce) || opts.requestNonce instanceof Uint8Array)
|
|
524
|
+
? guard.bytes.snapshot(opts.requestNonce, OcspError, "ocsp/bad-input", "opts.requestNonce") : null;
|
|
513
525
|
var matched = respNonce != null && reqNonce != null && guard.crypto.constantTimeEqual(respNonce, reqNonce);
|
|
514
526
|
var out = Object.assign({}, verdict, { nonceMatched: matched });
|
|
515
527
|
// The downgrade applies to `good` ONLY. `unknown` is the closed direction for a
|
package/lib/oid.js
CHANGED
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
* OID strings and their human names, plus arc conversion and DER
|
|
14
14
|
* encode/decode convenience. Every algorithm, attribute type, and
|
|
15
15
|
* extension in PKI is named by an OID, and resolving them through one
|
|
16
|
-
* registry
|
|
17
|
-
* codebase
|
|
16
|
+
* registry, instead of scattering magic dotted strings across the
|
|
17
|
+
* codebase, is what lets a new algorithm be a data entry instead of a
|
|
18
18
|
* code change.
|
|
19
19
|
*
|
|
20
20
|
* The seed set is declared by FAMILY: an OID belongs to a class with a
|
|
21
|
-
* shared base arc (the "starting variable"
|
|
21
|
+
* shared base arc (the "starting variable": `2.5.4` for the RFC 5280
|
|
22
22
|
* attribute types, `2.5.29` for the extensions, `2.16.840.1.101.3.4` for
|
|
23
23
|
* the NIST algorithms), and each member names only its trailing arc. The
|
|
24
24
|
* full OID is derived from base + leaf at load, so the arc hierarchy that
|
|
@@ -48,7 +48,7 @@ function _oidError(c, m) { return new OidError(c, m); }
|
|
|
48
48
|
// trailing arc (number) or a short arc array for a multi-level leaf; the full
|
|
49
49
|
// arc is derived at load via base.concat(leaf). Declaring by family means no
|
|
50
50
|
// dotted-decimal OID literal appears in this source at all, and adding a
|
|
51
|
-
// member is one `name: leaf` line under its class
|
|
51
|
+
// member is one `name: leaf` line under its class, with no base to re-type.
|
|
52
52
|
var FAMILIES = {
|
|
53
53
|
// RFC 5280 attribute types.
|
|
54
54
|
attributeType: { base: [2, 5, 4], of: {
|
|
@@ -142,7 +142,7 @@ var FAMILIES = {
|
|
|
142
142
|
// The gaps are the specification's own: 12/13/14 (identityProof/popLinkRandom/popLinkWitness's
|
|
143
143
|
// superseded siblings are retained below where RFC 6402 kept them) and 20 are unassigned in
|
|
144
144
|
// RFC 5272 Appendix A. V2 forms exist because RFC 6402 replaced the originals to fix a hash
|
|
145
|
-
// agility gap
|
|
145
|
+
// agility gap. Both are registered, since a v1 message is still legal to receive.
|
|
146
146
|
idCmc: { base: [1, 3, 6, 1, 5, 5, 7, 7], of: {
|
|
147
147
|
"id-cmc-statusInfo": 1, "id-cmc-identification": 2, "id-cmc-identityProof": 3,
|
|
148
148
|
"id-cmc-dataReturn": 4, "id-cmc-transactionId": 5, "id-cmc-senderNonce": 6,
|
|
@@ -155,7 +155,7 @@ var FAMILIES = {
|
|
|
155
155
|
"id-cmc-authData": 27, "id-cmc-batchRequests": 28, "id-cmc-batchResponses": 29,
|
|
156
156
|
"id-cmc-publishCert": 30, "id-cmc-modCertTemplate": 31, "id-cmc-controlProcessed": 32,
|
|
157
157
|
// ---------------------------------------------------------------------
|
|
158
|
-
// 33 / 34
|
|
158
|
+
// 33 / 34: the specification assigns these two OIDs both ways, and no
|
|
159
159
|
// erratum resolves it. Counted across every place either document states an
|
|
160
160
|
// assignment, it is not an even split:
|
|
161
161
|
//
|
|
@@ -167,7 +167,7 @@ var FAMILIES = {
|
|
|
167
167
|
// rfc6402.txt:1228 / :1245 RFC 6402 Appendix A.1 (1988 module)
|
|
168
168
|
//
|
|
169
169
|
// identityProofV2 = 33, popLinkWitnessV2 = 34
|
|
170
|
-
// rfc6402.txt:1938 / :1949 RFC 6402 Appendix A.2 (2008 module)
|
|
170
|
+
// rfc6402.txt:1938 / :1949 RFC 6402 Appendix A.2 (2008 module) alone
|
|
171
171
|
//
|
|
172
172
|
// The rows below therefore follow the base specification's normative body
|
|
173
173
|
// text and its module, which RFC 6402's own 1988 module agrees with. The
|
|
@@ -202,7 +202,7 @@ var FAMILIES = {
|
|
|
202
202
|
cabfPolicy: { base: [2, 23, 140, 1], of: {
|
|
203
203
|
"ev-guidelines": 1, "domain-validated": [2, 1], "organization-validated": [2, 2], "individual-validated": [2, 3] } },
|
|
204
204
|
|
|
205
|
-
// id-cp-ipAddr-asNumber (RFC 3779 / RFC 8360) on the id-pkix 14 arc
|
|
205
|
+
// id-cp-ipAddr-asNumber (RFC 3779 / RFC 8360) on the id-pkix 14 arc: the RPKI resource-certificate
|
|
206
206
|
// policy OIDs (sec. 8.9 ints 7-8).
|
|
207
207
|
idCp: { base: [1, 3, 6, 1, 5, 5, 7, 14], of: { "id-cp-ipAddr-asNumber": 2, "id-cp-ipAddr-asNumber-v2": 3 } },
|
|
208
208
|
|
|
@@ -217,14 +217,14 @@ var FAMILIES = {
|
|
|
217
217
|
"id-rspRole-ds-tls-v2": 6, "id-rspRole-ds-tls": [0, 0, 2, 0],
|
|
218
218
|
"id-rspRole-ds-auth-v2": 7, "id-rspRole-ds-auth": [0, 0, 2, 1] } },
|
|
219
219
|
|
|
220
|
-
// id-qt policy qualifiers (RFC 5280 sec. 4.2.1.4) on the id-pkix 2 arc
|
|
220
|
+
// id-qt policy qualifiers (RFC 5280 sec. 4.2.1.4) on the id-pkix 2 arc, which is the C509 sec. 8.10 registry.
|
|
221
221
|
pkixQt: { base: [1, 3, 6, 1, 5, 5, 7, 2], of: { cps: 1, unotice: 2 } },
|
|
222
222
|
|
|
223
223
|
// OCSP (RFC 6960) on the id-pkix-ocsp arc (= id-ad-ocsp). id-pkix-ocsp-basic is
|
|
224
224
|
// the ResponseBytes.responseType this build decodes; id-pkix-ocsp-nonce (sec. 4.4.1)
|
|
225
225
|
// names the nonce extension; the remaining members name the other OCSP extensions
|
|
226
|
-
// (CRL references, acceptable-response-types,
|
|
227
|
-
// preferred-signature-algorithms, extended-revoke
|
|
226
|
+
// of RFC 6960 sec. 4.4 and RFC 9654 (CRL references, acceptable-response-types,
|
|
227
|
+
// archive-cutoff, service-locator, preferred-signature-algorithms, extended-revoke).
|
|
228
228
|
ocsp: { base: [1, 3, 6, 1, 5, 5, 7, 48, 1], of: {
|
|
229
229
|
ocspBasic: 1, ocspNonce: 2, ocspCrl: 3, ocspResponse: 4, ocspNoCheck: 5,
|
|
230
230
|
ocspArchiveCutoff: 6, ocspServiceLocator: 7, ocspPrefSigAlgs: 8, ocspExtendedRevoke: 9 } },
|
|
@@ -232,13 +232,13 @@ var FAMILIES = {
|
|
|
232
232
|
// CRMF (RFC 4211) registration controls (sec. 6) and registration info (sec. 7) on the
|
|
233
233
|
// id-pkip arc (id-pkix 5). id-regCtrl (id-pkip 1) names the control types a
|
|
234
234
|
// CertRequest carries; id-regInfo (id-pkip 2) names the registration-info types.
|
|
235
|
-
// The parser surfaces each control/info value
|
|
235
|
+
// The parser surfaces each control/info value raw, keyed by these names.
|
|
236
236
|
regCtrl: { base: [1, 3, 6, 1, 5, 5, 7, 5, 1], of: {
|
|
237
237
|
regToken: 1, authenticator: 2, pkiPublicationInfo: 3, pkiArchiveOptions: 4, oldCertID: 5, protocolEncrKey: 6 } },
|
|
238
238
|
regInfo: { base: [1, 3, 6, 1, 5, 5, 7, 5, 2], of: { utf8Pairs: 1, certReq: 2 } },
|
|
239
239
|
|
|
240
|
-
// PKIX extended key purposes (id-kp, RFC 5280 sec. 4.2.1.12). timeStamping is required
|
|
241
|
-
//
|
|
240
|
+
// PKIX extended key purposes (id-kp, RFC 5280 sec. 4.2.1.12). timeStamping is required,
|
|
241
|
+
// critical, and sole on an RFC 3161 TSA signing certificate (sec. 2.3). The SSH
|
|
242
242
|
// (RFC 6187), CMC (RFC 6402), and Bundle Security (RFC 9174) purposes complete the C509
|
|
243
243
|
// Extended Key Usages registry (draft-ietf-cose-cbor-encoded-cert sec. 8.12).
|
|
244
244
|
pkixKp: { base: [1, 3, 6, 1, 5, 5, 7, 3], of: {
|
|
@@ -255,14 +255,14 @@ var FAMILIES = {
|
|
|
255
255
|
// Google Certificate Transparency (RFC 6962) on the 1.3.6.1.4.1.11129.2.4 arc:
|
|
256
256
|
// the SCT-list X.509 extension (sec. 3.3), the precertificate poison (sec. 3.1), the
|
|
257
257
|
// precert-signing EKU (sec. 3.1, naming only), and the OCSP-delivered SCT list
|
|
258
|
-
// (sec. 3.3). The SCT payload itself is TLS presentation language,
|
|
259
|
-
//
|
|
258
|
+
// (sec. 3.3). The SCT payload itself is TLS presentation language, so it is parsed
|
|
259
|
+
// by lib/ct.js (pki.ct) and never routed through the DER schema engine.
|
|
260
260
|
ct: { base: [1, 3, 6, 1, 4, 1, 11129, 2, 4], of: {
|
|
261
261
|
signedCertificateTimestampList: 2, precertificatePoison: 3,
|
|
262
262
|
precertificateSigningCert: 4, ocspSignedCertificateTimestampList: 5 } },
|
|
263
263
|
|
|
264
264
|
// Fulcio (Sigstore) X.509 certificate-extension arc. `.1.1`-`.1.6` are the
|
|
265
|
-
// DEPRECATED members whose values are
|
|
265
|
+
// DEPRECATED members whose values are raw UTF-8 strings (no DER wrapping);
|
|
266
266
|
// `.1.7` is the OtherName SAN type; `.1.8` onward are DER-encoded ASN.1
|
|
267
267
|
// UTF8String -- the decode MUST honor the raw-vs-DER split by member.
|
|
268
268
|
fulcio: { base: [1, 3, 6, 1, 4, 1, 57264, 1], of: {
|
|
@@ -287,7 +287,7 @@ var FAMILIES = {
|
|
|
287
287
|
data: 1, signedData: 2, envelopedData: 3, signedAndEnvelopedData: 4,
|
|
288
288
|
digestedData: 5, encryptedData: 6 } },
|
|
289
289
|
|
|
290
|
-
// PKCS#9 attribute types
|
|
290
|
+
// PKCS#9 attribute types, including the CMS signed-attribute OIDs (RFC 5652 sec. 11)
|
|
291
291
|
// and the PKCS#12 bag attributes friendlyName / localKeyId (RFC 7292 sec. 4.2).
|
|
292
292
|
pkcs9: { base: [1, 2, 840, 113549, 1, 9], of: {
|
|
293
293
|
emailAddress: 1, contentType: 3, messageDigest: 4, signingTime: 5,
|
|
@@ -320,9 +320,9 @@ var FAMILIES = {
|
|
|
320
320
|
pkcs12BagTypes: { base: [1, 2, 840, 113549, 1, 12, 10, 1], of: {
|
|
321
321
|
keyBag: 1, pkcs8ShroudedKeyBag: 2, certBag: 3, crlBag: 4, secretBag: 5, safeContentsBag: 6 } },
|
|
322
322
|
|
|
323
|
-
// PKCS#12 password-based encryption schemes (RFC 7292 Appendix C)
|
|
324
|
-
// PBE identifiers still emitted by deployed exporters; recognized so
|
|
325
|
-
// shrouded bag's algorithm resolves to a name, never decrypted here.
|
|
323
|
+
// PKCS#12 password-based encryption schemes (RFC 7292 Appendix C). These legacy
|
|
324
|
+
// PBE identifiers are still emitted by deployed exporters; they are recognized so
|
|
325
|
+
// a shrouded bag's algorithm resolves to a name, never decrypted here.
|
|
326
326
|
pkcs12Pbe: { base: [1, 2, 840, 113549, 1, 12, 1], of: {
|
|
327
327
|
pbeWithSHAAnd128BitRC4: 1, pbeWithSHAAnd40BitRC4: 2,
|
|
328
328
|
"pbeWithSHAAnd3-KeyTripleDES-CBC": 3, "pbeWithSHAAnd2-KeyTripleDES-CBC": 4,
|
|
@@ -354,7 +354,7 @@ var FAMILIES = {
|
|
|
354
354
|
hkdfWithSha256: 28, hkdfWithSha384: 29, hkdfWithSha512: 30, cekHkdfSha256: 31 } },
|
|
355
355
|
|
|
356
356
|
// RFC 5753 ephemeral-static ECDH key-agreement schemes -- the keyEncryptionAlgorithm OID of a
|
|
357
|
-
// kari, whose PARAMETER is the KeyWrapAlgorithm (so these are
|
|
357
|
+
// kari, whose PARAMETER is the KeyWrapAlgorithm (so these are not params-absent). The X9.63 KDF
|
|
358
358
|
// variants: stdDH (SECG arc 1.3.132.1.11) + cofactorDH (1.3.132.1.14) for SHA-224/256/384/512,
|
|
359
359
|
// and the SHA-1 KDF pair on the ANSI-X9.63 arc (the OpenSSL default).
|
|
360
360
|
secgStdDH: { base: [1, 3, 132, 1, 11], of: {
|
|
@@ -371,9 +371,9 @@ var FAMILIES = {
|
|
|
371
371
|
// id-alg-hss-lms-hashsig OID above (RFC 9708 / RFC 9802 share it).
|
|
372
372
|
pkixAlg: { base: [1, 3, 6, 1, 5, 5, 7, 6], of: {
|
|
373
373
|
// id-alg-noSignature (RFC 6402 sec. 2.4, {id-pkix id-alg(6) 2}): the CMC
|
|
374
|
-
// "signature" algorithm for a request whose signer has no key yet
|
|
374
|
+
// "signature" algorithm for a request whose signer has no key yet; the
|
|
375
375
|
// SignerInfo carries a MAC-based proof instead. Registered so a decoder can
|
|
376
|
-
//
|
|
376
|
+
// name it and refuse it deliberately.
|
|
377
377
|
"id-alg-noSignature": 2,
|
|
378
378
|
"id-alg-xmss-hashsig": 34, "id-alg-xmssmt-hashsig": 35,
|
|
379
379
|
// Composite ML-DSA signature algorithms (draft-ietf-lamps-pq-composite-sigs
|
|
@@ -413,8 +413,8 @@ var FAMILIES = {
|
|
|
413
413
|
signingCertificate: 12, timeStampToken: 14, decryptKeyID: 37, signingCertificateV2: 47,
|
|
414
414
|
// id-aa-cmc-unsignedData (RFC 6402 sec. 2.7, {id-aa 34}): the CMC unsigned
|
|
415
415
|
// attribute that carries body parts too large to sit inside the signed
|
|
416
|
-
// PKIData
|
|
417
|
-
// untrusted data
|
|
416
|
+
// PKIData. It is unsigned by design, so a consumer must treat its contents
|
|
417
|
+
// as untrusted data.
|
|
418
418
|
cmcUnsignedData: 34,
|
|
419
419
|
asymmDecryptKeyID: 54, certificationRequestInfoTemplate: 61, extensionReqTemplate: 62 } },
|
|
420
420
|
|
|
@@ -538,7 +538,7 @@ function _assertEncodable(dotted, who) {
|
|
|
538
538
|
// X.660 encodability: the root arc is 0..2 and, under roots 0 and 1, the
|
|
539
539
|
// second arc is 0..39 (the first two arcs pack into a single octet as
|
|
540
540
|
// 40*X+Y). An OID outside these bounds can never be DER-encoded, so a
|
|
541
|
-
// registration carrying one fails at config time
|
|
541
|
+
// registration carrying one fails at config time, before anything tries to use it.
|
|
542
542
|
function _assertEncodableArcs(arcs, who) {
|
|
543
543
|
if (arcs.length < 2) {
|
|
544
544
|
throw new OidError("oid/bad-input", who + ": an OID must have at least 2 arcs");
|
|
@@ -616,8 +616,8 @@ function register(dotted, n) {
|
|
|
616
616
|
* (the starting variable a class of OIDs has in common) and `members` maps
|
|
617
617
|
* each name to its trailing arc -- a number, or a short arc array for a
|
|
618
618
|
* multi-level leaf. Each full OID is derived as `base` followed by the leaf,
|
|
619
|
-
* so a family is declared as its hierarchy
|
|
620
|
-
*
|
|
619
|
+
* so a family is declared as its hierarchy and no full path is re-spelled.
|
|
620
|
+
* This is the primitive the built-in seed set itself is built from.
|
|
621
621
|
*
|
|
622
622
|
* @opts
|
|
623
623
|
* base: number[], // the shared arc prefix, e.g. [1,3,6,1,4,1,99999]
|