@blamejs/pki 0.8.59 → 0.8.61
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 +57 -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 +26 -18
- package/lib/cmp-build.js +35 -33
- package/lib/cmp-session.js +19 -9
- package/lib/cms-decrypt.js +37 -23
- package/lib/cms-digest.js +2 -3
- package/lib/cms-encrypt.js +38 -33
- package/lib/cms-sign.js +65 -43
- package/lib/cms-verify.js +8 -4
- package/lib/composite-kem.js +28 -29
- package/lib/crl-sign.js +24 -17
- package/lib/crmf-sign.js +11 -17
- package/lib/csr-sign.js +5 -2
- package/lib/ct.js +38 -25
- package/lib/est.js +12 -9
- package/lib/guard-bytes.js +5 -1
- package/lib/guard-crypto.js +506 -14
- 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/guard-secret.js +3 -2
- package/lib/hpke.js +34 -27
- package/lib/http-digest.js +5 -7
- package/lib/http-transport.js +12 -3
- package/lib/inspect.js +10 -2
- package/lib/jose.js +3 -1
- package/lib/key.js +41 -29
- package/lib/lint.js +236 -152
- package/lib/mime.js +9 -5
- package/lib/ocsp.js +26 -24
- package/lib/path-validate.js +43 -13
- package/lib/pbes2.js +12 -9
- package/lib/pkcs11-uri.js +3 -1
- package/lib/pkcs12-build.js +19 -17
- package/lib/pki-build.js +17 -13
- package/lib/possession.js +3 -1
- package/lib/rc2.js +6 -2
- package/lib/revocation-fetch.js +78 -19
- package/lib/scep.js +21 -14
- 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 +7 -4
- package/lib/shbs.js +10 -9
- package/lib/sign-scheme.js +2 -2
- package/lib/sigstore.js +9 -9
- package/lib/smime.js +19 -16
- package/lib/tlog.js +20 -13
- package/lib/tuf.js +7 -4
- package/lib/validator-cose.js +2 -2
- package/lib/validator-keydesc.js +4 -1
- package/lib/validator-tls.js +7 -2
- package/lib/webauthn-mds.js +3 -7
- package/lib/webauthn.js +4 -11
- package/lib/webcrypto.js +70 -49
- package/lib/x509-sign.js +20 -15
- package/package.json +1 -1
- package/sbom.cdx.json +6 -6
package/lib/est.js
CHANGED
|
@@ -73,6 +73,9 @@ var crmfFmt = require("./schema-crmf");
|
|
|
73
73
|
var frameworkError = require("./framework-error");
|
|
74
74
|
var guard = require("./guard-all");
|
|
75
75
|
var intrinsic = require("./guard-intrinsic");
|
|
76
|
+
/** @internal The append every list here is built with: `push` stores at the index and a store
|
|
77
|
+
* consults a setter inherited there, which takes the element being appended. */
|
|
78
|
+
var _push = intrinsic.append;
|
|
76
79
|
var _charCodeAt = intrinsic.uncurry(String.prototype.charCodeAt);
|
|
77
80
|
var _strSlice = intrinsic.uncurry(String.prototype.slice);
|
|
78
81
|
var _toLowerCase = intrinsic.uncurry(String.prototype.toLowerCase);
|
|
@@ -423,7 +426,7 @@ function findIssuedCert(certs, target) {
|
|
|
423
426
|
|
|
424
427
|
function _recipientKeyIds(recipientInfos, kind) {
|
|
425
428
|
var ids = [];
|
|
426
|
-
function push(v) { if (Buffer.isBuffer(v)) ids
|
|
429
|
+
function push(v) { if (Buffer.isBuffer(v)) _push(ids,v); }
|
|
427
430
|
(recipientInfos || []).forEach(function (r) {
|
|
428
431
|
if (kind !== "symmetric") {
|
|
429
432
|
if (r.rid) push(r.rid.subjectKeyIdentifier);
|
|
@@ -439,7 +442,7 @@ function _recipientKeyIds(recipientInfos, kind) {
|
|
|
439
442
|
|
|
440
443
|
function _recipientIssuerSerials(recipientInfos) {
|
|
441
444
|
var out = [];
|
|
442
|
-
function push(rid) { if (rid && rid.issuer && Buffer.isBuffer(rid.issuer.bytes) && rid.serialNumber != null) out
|
|
445
|
+
function push(rid) { if (rid && rid.issuer && Buffer.isBuffer(rid.issuer.bytes) && rid.serialNumber != null) _push(out,{ issuer: rid.issuer.bytes, serialNumber: rid.serialNumber }); }
|
|
443
446
|
(recipientInfos || []).forEach(function (r) {
|
|
444
447
|
push(r.rid);
|
|
445
448
|
if (r.kemri) push(r.kemri.rid);
|
|
@@ -758,7 +761,7 @@ function smimeCapabilitiesAttr(capabilities) {
|
|
|
758
761
|
if (!Array.isArray(capabilities) || capabilities.length === 0) throw E("est/bad-input", "smimeCapabilitiesAttr requires a non-empty capability list");
|
|
759
762
|
var caps = capabilities.map(function (c) {
|
|
760
763
|
var seq = [asn1.build.oid(c.capabilityID)];
|
|
761
|
-
if (c.parameters !== undefined && c.parameters !== null) seq
|
|
764
|
+
if (c.parameters !== undefined && c.parameters !== null) _push(seq,Buffer.isBuffer(c.parameters) ? c.parameters : asn1.build.oid(c.parameters));
|
|
762
765
|
return asn1.build.sequence(seq);
|
|
763
766
|
});
|
|
764
767
|
return _attr(OID_SMIME_CAPABILITIES, [asn1.build.sequence(caps)]);
|
|
@@ -780,7 +783,7 @@ function buildEnrollAttributes(csrattrsParsed) {
|
|
|
780
783
|
if (plan.keyType) throw E("est/ambiguous-key-type", "a non-template CsrAttrs response must carry exactly one key-type attribute (RFC 9908 sec. 3.2)");
|
|
781
784
|
plan.keyType = { type: it.name, curve: it.curve || null, keySize: it.keySize || null, values: it.values || [] };
|
|
782
785
|
}
|
|
783
|
-
else plan.unhandled
|
|
786
|
+
else _push(plan.unhandled,{ kind: it.kind, oid: it.oid, name: it.name });
|
|
784
787
|
}
|
|
785
788
|
return plan;
|
|
786
789
|
}
|
|
@@ -1217,7 +1220,7 @@ function _correlateIssued(bag, wanted, arm) {
|
|
|
1217
1220
|
function _allMatching(bag, key) {
|
|
1218
1221
|
var rest = bag.slice(), out = [], hit;
|
|
1219
1222
|
while ((hit = findIssuedCert(rest, key)) !== null) {
|
|
1220
|
-
out
|
|
1223
|
+
_push(out,hit);
|
|
1221
1224
|
rest = rest.filter(function (c) { return c !== hit; });
|
|
1222
1225
|
}
|
|
1223
1226
|
return out;
|
|
@@ -1240,7 +1243,7 @@ function _requestedPublicKeys(der) {
|
|
|
1240
1243
|
try {
|
|
1241
1244
|
if (r.certificationRequestBytes) {
|
|
1242
1245
|
var spki = csr.parse(r.certificationRequestBytes).subjectPublicKeyInfo;
|
|
1243
|
-
if (spki && Buffer.isBuffer(spki.bytes)) out
|
|
1246
|
+
if (spki && Buffer.isBuffer(spki.bytes)) _push(out,spki.bytes);
|
|
1244
1247
|
if (out.length === before) _unreadableArm();
|
|
1245
1248
|
return;
|
|
1246
1249
|
}
|
|
@@ -1251,7 +1254,7 @@ function _requestedPublicKeys(der) {
|
|
|
1251
1254
|
var pk = (tmpl && tmpl.publicKey) ||
|
|
1252
1255
|
(msg0 && msg0.popo && msg0.popo.poposkInput && msg0.popo.poposkInput.publicKey);
|
|
1253
1256
|
var pkBytes = Buffer.isBuffer(pk) ? pk : (pk && pk.bytes);
|
|
1254
|
-
if (Buffer.isBuffer(pkBytes)) out
|
|
1257
|
+
if (Buffer.isBuffer(pkBytes)) _push(out,pkBytes);
|
|
1255
1258
|
if (out.length === before) _unreadableArm();
|
|
1256
1259
|
}
|
|
1257
1260
|
} catch (e) {
|
|
@@ -1299,7 +1302,7 @@ function _requestBinding(der) {
|
|
|
1299
1302
|
var paths = [];
|
|
1300
1303
|
intrinsic.forEach([body.requests, body.controls, body.cmsSequence, body.otherMsgs], function (list) {
|
|
1301
1304
|
(list || []).forEach(function (el) {
|
|
1302
|
-
if (el && el.bodyPartID != null) { ids
|
|
1305
|
+
if (el && el.bodyPartID != null) { _push(ids,el.bodyPartID); _push(paths,[el.bodyPartID]); }
|
|
1303
1306
|
});
|
|
1304
1307
|
});
|
|
1305
1308
|
_collectNestedPaths(body.cmsSequence, [], paths, 0);
|
|
@@ -1344,7 +1347,7 @@ function _collectNestedPaths(list, prefix, out, depth) {
|
|
|
1344
1347
|
if (!inner || inner.kind !== "pkiData") return;
|
|
1345
1348
|
var path = prefix.concat([el.bodyPartID]);
|
|
1346
1349
|
intrinsic.forEach([inner.requests, inner.controls, inner.cmsSequence, inner.otherMsgs], function (l) {
|
|
1347
|
-
(l || []).forEach(function (e2) { if (e2 && e2.bodyPartID != null) out
|
|
1350
|
+
(l || []).forEach(function (e2) { if (e2 && e2.bodyPartID != null) _push(out,path.concat([e2.bodyPartID])); });
|
|
1348
1351
|
});
|
|
1349
1352
|
_collectNestedPaths(inner.cmsSequence, path, out, depth + 1);
|
|
1350
1353
|
});
|
package/lib/guard-bytes.js
CHANGED
|
@@ -446,7 +446,11 @@ function _deep(v, ErrorClass, code, label, cap, depth, collect, work) {
|
|
|
446
446
|
var element;
|
|
447
447
|
try { element = v[k]; }
|
|
448
448
|
catch (e) { throw _raise(ErrorClass, code, label + ": reading element " + k + " threw", e); }
|
|
449
|
-
|
|
449
|
+
/** @internal The copy's slot is DEFINED, not stored at. The indices walked here are the ones
|
|
450
|
+
* the source holds of its own, so they can skip: a store at an index this copy has no own
|
|
451
|
+
* property at walks the prototype chain for a setter, which would take the copied element at
|
|
452
|
+
* the toolkit's own door for caller byte structures. */
|
|
453
|
+
_defineProperty(arr, k, { value: _deep(element, ErrorClass, code, label, cap, depth + 1, collect, work), writable: true, enumerable: true, configurable: true });
|
|
450
454
|
});
|
|
451
455
|
arr.length = vCount;
|
|
452
456
|
_copyNamed(v, arr, ErrorClass, code, label, cap, depth, collect, work);
|