@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.
- package/CHANGELOG.md +33 -0
- package/lib/acme.js +15 -7
- package/lib/alt-sig.js +3 -1
- package/lib/asn1-der.js +82 -34
- package/lib/attrcert-sign.js +19 -16
- package/lib/byte-writer.js +63 -13
- package/lib/cbor-det.js +9 -3
- package/lib/cmc-build.js +12 -9
- package/lib/cmp-build.js +35 -33
- package/lib/cmp-session.js +19 -9
- package/lib/cms-decrypt.js +22 -8
- package/lib/cms-encrypt.js +23 -17
- package/lib/cms-sign.js +65 -43
- package/lib/cms-verify.js +8 -4
- package/lib/crl-sign.js +24 -17
- package/lib/csr-sign.js +5 -2
- package/lib/ct.js +27 -16
- package/lib/est.js +12 -9
- package/lib/guard-bytes.js +5 -1
- package/lib/guard-der.js +6 -1
- package/lib/guard-intrinsic.js +12 -4
- package/lib/guard-list.js +64 -0
- package/lib/guard-name.js +1 -1
- package/lib/hpke.js +10 -3
- package/lib/http-transport.js +12 -3
- package/lib/inspect.js +10 -2
- package/lib/jose.js +3 -1
- package/lib/lint.js +236 -152
- package/lib/mime.js +9 -5
- package/lib/ocsp.js +25 -22
- package/lib/path-validate.js +43 -13
- package/lib/pbes2.js +6 -2
- package/lib/pkcs11-uri.js +3 -1
- package/lib/pkcs12-build.js +14 -11
- package/lib/pki-build.js +14 -10
- package/lib/possession.js +3 -1
- package/lib/rc2.js +6 -2
- package/lib/revocation-fetch.js +78 -19
- package/lib/scep.js +14 -6
- package/lib/schema-attrcert.js +4 -2
- package/lib/schema-c509.js +94 -78
- package/lib/schema-cmc.js +5 -2
- package/lib/schema-cmp.js +6 -3
- package/lib/schema-cms.js +7 -4
- package/lib/schema-crl.js +1 -1
- package/lib/schema-crmf.js +1 -1
- package/lib/schema-csr.js +3 -3
- package/lib/schema-engine.js +36 -18
- package/lib/schema-pkcs1.js +7 -3
- package/lib/schema-pkcs12.js +9 -6
- package/lib/schema-pkix.js +19 -3
- package/lib/schema-sec1.js +4 -1
- package/lib/schema-tsp.js +4 -1
- package/lib/shbs.js +7 -3
- package/lib/smime.js +18 -14
- package/lib/tlog.js +17 -11
- package/lib/tuf.js +3 -1
- package/lib/validator-keydesc.js +4 -1
- package/lib/validator-tls.js +7 -2
- package/lib/webcrypto.js +9 -3
- package/lib/x509-sign.js +20 -15
- package/package.json +1 -1
- 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
|
|
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
|
|
258
|
+
_push(out,_ext(O("authorityKeyIdentifier"), false, _extAki(akiF[0], akiF[1], akiF[2])));
|
|
254
259
|
}
|
|
255
|
-
if (ku != null) out
|
|
256
|
-
if (extSpec.extendedKeyUsage != null) out
|
|
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
|
|
264
|
+
_push(out,_ext(O("basicConstraints"), bc.critical !== false, _extBasicConstraints(bc)));
|
|
260
265
|
}
|
|
261
|
-
if (extSpec.subjectAltName != null) out
|
|
262
|
-
if (extSpec.certificatePolicies != null) out
|
|
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
|
|
792
|
-
tbsChildren
|
|
793
|
-
if (omitSignatureAlg !== true) tbsChildren
|
|
794
|
-
tbsChildren
|
|
795
|
-
tbsChildren
|
|
796
|
-
tbsChildren
|
|
797
|
-
tbsChildren
|
|
798
|
-
if (extList.length) tbsChildren
|
|
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
package/sbom.cdx.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
|
|
3
3
|
"bomFormat": "CycloneDX",
|
|
4
4
|
"specVersion": "1.5",
|
|
5
|
-
"serialNumber": "urn:uuid:
|
|
5
|
+
"serialNumber": "urn:uuid:a0bc3a87-4c9e-4598-95ba-7457dca63e87",
|
|
6
6
|
"version": 1,
|
|
7
7
|
"metadata": {
|
|
8
|
-
"timestamp": "2026-10-
|
|
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.
|
|
22
|
+
"bom-ref": "@blamejs/pki@0.8.60",
|
|
23
23
|
"type": "application",
|
|
24
24
|
"name": "pki",
|
|
25
|
-
"version": "0.8.
|
|
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.
|
|
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.
|
|
57
|
+
"ref": "@blamejs/pki@0.8.60",
|
|
58
58
|
"dependsOn": []
|
|
59
59
|
}
|
|
60
60
|
]
|