@blamejs/pki 0.8.59 → 0.8.60

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/lib/acme.js +15 -7
  3. package/lib/alt-sig.js +3 -1
  4. package/lib/asn1-der.js +82 -34
  5. package/lib/attrcert-sign.js +19 -16
  6. package/lib/byte-writer.js +63 -13
  7. package/lib/cbor-det.js +9 -3
  8. package/lib/cmc-build.js +12 -9
  9. package/lib/cmp-build.js +35 -33
  10. package/lib/cmp-session.js +19 -9
  11. package/lib/cms-decrypt.js +22 -8
  12. package/lib/cms-encrypt.js +23 -17
  13. package/lib/cms-sign.js +65 -43
  14. package/lib/cms-verify.js +8 -4
  15. package/lib/crl-sign.js +24 -17
  16. package/lib/csr-sign.js +5 -2
  17. package/lib/ct.js +27 -16
  18. package/lib/est.js +12 -9
  19. package/lib/guard-bytes.js +5 -1
  20. package/lib/guard-der.js +6 -1
  21. package/lib/guard-intrinsic.js +12 -4
  22. package/lib/guard-list.js +64 -0
  23. package/lib/guard-name.js +1 -1
  24. package/lib/hpke.js +10 -3
  25. package/lib/http-transport.js +12 -3
  26. package/lib/inspect.js +10 -2
  27. package/lib/jose.js +3 -1
  28. package/lib/lint.js +236 -152
  29. package/lib/mime.js +9 -5
  30. package/lib/ocsp.js +25 -22
  31. package/lib/path-validate.js +43 -13
  32. package/lib/pbes2.js +6 -2
  33. package/lib/pkcs11-uri.js +3 -1
  34. package/lib/pkcs12-build.js +14 -11
  35. package/lib/pki-build.js +14 -10
  36. package/lib/possession.js +3 -1
  37. package/lib/rc2.js +6 -2
  38. package/lib/revocation-fetch.js +78 -19
  39. package/lib/scep.js +14 -6
  40. package/lib/schema-attrcert.js +4 -2
  41. package/lib/schema-c509.js +94 -78
  42. package/lib/schema-cmc.js +5 -2
  43. package/lib/schema-cmp.js +6 -3
  44. package/lib/schema-cms.js +7 -4
  45. package/lib/schema-crl.js +1 -1
  46. package/lib/schema-crmf.js +1 -1
  47. package/lib/schema-csr.js +3 -3
  48. package/lib/schema-engine.js +36 -18
  49. package/lib/schema-pkcs1.js +7 -3
  50. package/lib/schema-pkcs12.js +9 -6
  51. package/lib/schema-pkix.js +19 -3
  52. package/lib/schema-sec1.js +4 -1
  53. package/lib/schema-tsp.js +4 -1
  54. package/lib/shbs.js +7 -3
  55. package/lib/smime.js +18 -14
  56. package/lib/tlog.js +17 -11
  57. package/lib/tuf.js +3 -1
  58. package/lib/validator-keydesc.js +4 -1
  59. package/lib/validator-tls.js +7 -2
  60. package/lib/webcrypto.js +9 -3
  61. package/lib/x509-sign.js +20 -15
  62. package/package.json +1 -1
  63. package/sbom.cdx.json +6 -6
package/lib/x509-sign.js CHANGED
@@ -22,6 +22,11 @@ var x509 = require("./schema-x509");
22
22
  var signScheme = require("./sign-scheme");
23
23
  var guard = require("./guard-all");
24
24
  var intrinsic = require("./guard-intrinsic");
25
+ /** @internal The append every list here is built with. `push` STORES at the index, and a store walks
26
+ * the prototype chain for a setter, so an accessor inherited at an array index receives each element
27
+ * as it is appended and the index reads back whatever its getter answers. These lists become the
28
+ * bytes that get signed. */
29
+ var _push = intrinsic.append;
25
30
  var _isArray = intrinsic.isArray, _bufferEquals = intrinsic.bufferEquals, _isBuffer = intrinsic.isBuffer;
26
31
  var _arrSlice = intrinsic.arraySlice, _promiseResolve = intrinsic.uncurry(intrinsic.promiseResolve);
27
32
  /** @internal The RECEIVER for the captured `Promise.resolve`, captured too. `resolve` builds through
@@ -243,23 +248,23 @@ function _buildExtensions(extSpec, ctx) {
243
248
  if (skiVal === false) {
244
249
  if (caTrue) throw _err("x509/bad-input", "a CA certificate MUST carry a subjectKeyIdentifier, so subjectKeyIdentifier: false is refused when basicConstraints cA is TRUE (RFC 5280 sec. 4.2.1.2)");
245
250
  } else {
246
- out.push(_ext(O("subjectKeyIdentifier"), false, _extSki(_skiKeyId(skiVal, ctx.spki))));
251
+ _push(out,_ext(O("subjectKeyIdentifier"), false, _extSki(_skiKeyId(skiVal, ctx.spki))));
247
252
  }
248
253
  var akiVal = extSpec.authorityKeyIdentifier == null ? !ctx.selfSigned : extSpec.authorityKeyIdentifier;
249
254
  if (akiVal === false) {
250
255
  if (!ctx.selfSigned) throw _err("x509/bad-input", "the authorityKeyIdentifier keyIdentifier MUST be included in every certificate a CA generates other than a self-signed one, so authorityKeyIdentifier: false is refused here (RFC 5280 sec. 4.2.1.1)");
251
256
  } else {
252
257
  var akiF = _akiFields(akiVal, ctx);
253
- out.push(_ext(O("authorityKeyIdentifier"), false, _extAki(akiF[0], akiF[1], akiF[2])));
258
+ _push(out,_ext(O("authorityKeyIdentifier"), false, _extAki(akiF[0], akiF[1], akiF[2])));
254
259
  }
255
- if (ku != null) out.push(_ext(O("keyUsage"), extSpec.keyUsageCritical !== false, _extKeyUsage(ku)));
256
- if (extSpec.extendedKeyUsage != null) out.push(_ext(O("extKeyUsage"), !!extSpec.extendedKeyUsageCritical, _extExtKeyUsage(extSpec.extendedKeyUsage)));
260
+ if (ku != null) _push(out,_ext(O("keyUsage"), extSpec.keyUsageCritical !== false, _extKeyUsage(ku)));
261
+ if (extSpec.extendedKeyUsage != null) _push(out,_ext(O("extKeyUsage"), !!extSpec.extendedKeyUsageCritical, _extExtKeyUsage(extSpec.extendedKeyUsage)));
257
262
  if (bc != null) {
258
263
  if (bc.cA === true && bc.critical === false) throw _err("x509/bad-input", "a CA certificate's basicConstraints MUST be critical (RFC 5280 sec. 4.2.1.9)");
259
- out.push(_ext(O("basicConstraints"), bc.critical !== false, _extBasicConstraints(bc)));
264
+ _push(out,_ext(O("basicConstraints"), bc.critical !== false, _extBasicConstraints(bc)));
260
265
  }
261
- if (extSpec.subjectAltName != null) out.push(_ext(O("subjectAltName"), ctx.subjectEmpty, _extSan(extSpec.subjectAltName)));
262
- if (extSpec.certificatePolicies != null) out.push(_ext(O("certificatePolicies"), !!extSpec.certificatePoliciesCritical, _extCertPolicies(extSpec.certificatePolicies)));
266
+ if (extSpec.subjectAltName != null) _push(out,_ext(O("subjectAltName"), ctx.subjectEmpty, _extSan(extSpec.subjectAltName)));
267
+ if (extSpec.certificatePolicies != null) _push(out,_ext(O("certificatePolicies"), !!extSpec.certificatePoliciesCritical, _extCertPolicies(extSpec.certificatePolicies)));
263
268
  /** @internal Sections 4.2.2.1 and 4.2.1.15 fix these non-critical; sec. 4.2.1.13 states a SHOULD
264
269
  * and the toolkit issues the conforming form. */
265
270
  if (extSpec.authorityInfoAccess != null) guard.list.append(out, _ext(O("authorityInfoAccess"), false, _extAia(extSpec.authorityInfoAccess)));
@@ -788,14 +793,14 @@ function _sign(spec, issuer, opts) {
788
793
  * signature covers (draft-truskovsky-lamps-pq-hybrid-x509 sec. 4). */
789
794
  function tbsOver(extList, omitSignatureAlg) {
790
795
  var tbsChildren = [];
791
- if (version !== 1) tbsChildren.push(b.explicit(0, b.integer(BigInt(version - 1))));
792
- tbsChildren.push(serialTlv);
793
- if (omitSignatureAlg !== true) tbsChildren.push(scheme.sigAlgId);
794
- tbsChildren.push(issuerDer);
795
- tbsChildren.push(validityDer);
796
- tbsChildren.push(subjectDer);
797
- tbsChildren.push(b.raw(spki));
798
- if (extList.length) tbsChildren.push(b.explicit(3, b.sequence(extList)));
796
+ if (version !== 1) _push(tbsChildren,b.explicit(0, b.integer(BigInt(version - 1))));
797
+ _push(tbsChildren,serialTlv);
798
+ if (omitSignatureAlg !== true) _push(tbsChildren,scheme.sigAlgId);
799
+ _push(tbsChildren,issuerDer);
800
+ _push(tbsChildren,validityDer);
801
+ _push(tbsChildren,subjectDer);
802
+ _push(tbsChildren,b.raw(spki));
803
+ if (extList.length) _push(tbsChildren,b.explicit(3, b.sequence(extList)));
799
804
  return b.sequence(tbsChildren);
800
805
  }
801
806
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blamejs/pki",
3
- "version": "0.8.59",
3
+ "version": "0.8.60",
4
4
  "description": "Pure-JavaScript PKI toolkit that owns its stack — X.509, ASN.1/DER, CMS, PQC-first.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "blamejs contributors",
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:2b5749b0-053a-41de-947c-63a7a8df8028",
5
+ "serialNumber": "urn:uuid:a0bc3a87-4c9e-4598-95ba-7457dca63e87",
6
6
  "version": 1,
7
7
  "metadata": {
8
- "timestamp": "2026-10-07T05:12:27.182Z",
8
+ "timestamp": "2026-10-07T18:31:09.061Z",
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.8.59",
22
+ "bom-ref": "@blamejs/pki@0.8.60",
23
23
  "type": "application",
24
24
  "name": "pki",
25
- "version": "0.8.59",
25
+ "version": "0.8.60",
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.8.59",
29
+ "purl": "pkg:npm/%40blamejs/pki@0.8.60",
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.8.59",
57
+ "ref": "@blamejs/pki@0.8.60",
58
58
  "dependsOn": []
59
59
  }
60
60
  ]