@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/schema-c509.js
CHANGED
|
@@ -22,6 +22,11 @@ var x509 = require("./schema-x509");
|
|
|
22
22
|
var pkix = require("./schema-pkix");
|
|
23
23
|
var schema = require("./schema-engine");
|
|
24
24
|
var guard = require("./guard-all");
|
|
25
|
+
/** @internal The append every list in this module is built with. `push` STORES at the index, and a
|
|
26
|
+
* store walks the prototype chain for a setter, so an accessor inherited at an array index receives
|
|
27
|
+
* each element as it is appended and the index then reads back whatever its getter answers. This one
|
|
28
|
+
* defines the index on the array itself. */
|
|
29
|
+
var _push = guard.list.append;
|
|
25
30
|
var constants = require("./constants");
|
|
26
31
|
var frameworkError = require("./framework-error");
|
|
27
32
|
var validator = require("./validator-all");
|
|
@@ -346,8 +351,8 @@ function _name509(node, isSubject, isNative) {
|
|
|
346
351
|
var vv = v.text !== undefined ? v.text : (v.hex !== undefined ? v.hex : _macToEui64String(v.eui64));
|
|
347
352
|
var rdn = { type: tname, value: vv, printable: ti < 0 };
|
|
348
353
|
_assertAttrValue(rdn);
|
|
349
|
-
rdns
|
|
350
|
-
parts
|
|
354
|
+
_push(rdns,rdn);
|
|
355
|
+
_push(parts,_shortName(tname) + "=" + guard.name.escapeDnValue(vv));
|
|
351
356
|
}
|
|
352
357
|
if (!isNative && rdns.length === 1 && rdns[0].type === "commonName" && !rdns[0].printable) {
|
|
353
358
|
throw _err("c509/bad-name", "a Name holding a single +1 commonName must be encoded as a bare SpecialText, not an array (draft sec. 3.1.4)");
|
|
@@ -431,7 +436,7 @@ function _generalNamesToDer(node, isNative) {
|
|
|
431
436
|
var kids = node.children;
|
|
432
437
|
if (kids.length === 0 || kids.length % 2 !== 0) throw _err("c509/bad-extensions", "a GeneralNames array must be non-empty (int, value) pairs (sec. 3.3)");
|
|
433
438
|
var out = [];
|
|
434
|
-
for (var i = 0; i + 1 < kids.length; i += 2) out
|
|
439
|
+
for (var i = 0; i + 1 < kids.length; i += 2) _push(out,_generalNameToDer(Number(_cborIntVal(kids[i], "a GeneralName type")), kids[i + 1], false, isNative));
|
|
435
440
|
return out;
|
|
436
441
|
}
|
|
437
442
|
function _generalNamesFromDer(gnNodes, ctx) {
|
|
@@ -439,7 +444,7 @@ function _generalNamesFromDer(gnNodes, ctx) {
|
|
|
439
444
|
for (var i = 0; i < gnNodes.length; i++) {
|
|
440
445
|
var pair = _generalNameFromDer(schema.walk(GN_LEAF, gnNodes[i], schema.withResources(NS, ctx)), false, ctx);
|
|
441
446
|
if (pair == null) return null;
|
|
442
|
-
out
|
|
447
|
+
_push(out,pair[0]); _push(out,pair[1]);
|
|
443
448
|
}
|
|
444
449
|
return out;
|
|
445
450
|
}
|
|
@@ -535,13 +540,24 @@ function _ipSeqToInt(seq) {
|
|
|
535
540
|
var head = Buffer.from([seq[0] + 1]);
|
|
536
541
|
return BigInt("0x" + Buffer.concat([head, seq.subarray(1)]).toString("hex"));
|
|
537
542
|
}
|
|
543
|
+
/** @internal The octets are counted and then written into the output from its end. Prepending STORES
|
|
544
|
+
* at an index, and a store walks the prototype chain for a setter, so an accessor inherited at an
|
|
545
|
+
* array index took each octet and left the list reading back its getter's value: the leading octet
|
|
546
|
+
* is both the prefix length this checks for range and the byte the result carries, so the check and
|
|
547
|
+
* the emitted address were both decided by the accessor. A typed array handles its own
|
|
548
|
+
* integer-indexed writes and consults no prototype accessor. */
|
|
538
549
|
function _ipIntToSeq(n) {
|
|
539
550
|
if (n < 1n) return null;
|
|
540
|
-
var
|
|
541
|
-
for (var v = n; v > 0n; v >>= 8n)
|
|
542
|
-
if (
|
|
551
|
+
var count = 0;
|
|
552
|
+
for (var v = n; v > 0n; v >>= 8n) count++;
|
|
553
|
+
if (count > 9) return null;
|
|
554
|
+
var head = Number((n >> BigInt(8 * (count - 1))) & 0xffn);
|
|
555
|
+
if (head < 1 || head > 8) return null;
|
|
556
|
+
var out = Buffer.alloc(count);
|
|
557
|
+
var t = n;
|
|
558
|
+
for (var i = count - 1; i >= 0; i--) { out[i] = Number(t & 0xffn); t >>= 8n; }
|
|
543
559
|
out[0] -= 1;
|
|
544
|
-
return
|
|
560
|
+
return out;
|
|
545
561
|
}
|
|
546
562
|
var _IP_WIDTH = Object.assign(Object.create(null), { 1: 4, 2: 16 });
|
|
547
563
|
|
|
@@ -639,18 +655,18 @@ function _ipChoiceToDer(items, afi) {
|
|
|
639
655
|
if (it.majorType === 4) {
|
|
640
656
|
if (!it.children || it.children.length !== 2) throw _err("c509/bad-extensions", "an IPAddress range must be exactly [min, max]");
|
|
641
657
|
var lo = absolute(it.children[0]), hi = absolute(it.children[1]);
|
|
642
|
-
seqs
|
|
658
|
+
_push(seqs,lo); _push(seqs,hi);
|
|
643
659
|
var rlo = _ipLow(lo, width), rhi = _ipHigh(hi, width);
|
|
644
660
|
{
|
|
645
661
|
if (_ipRangeIsPrefix(rlo, rhi)) throw _err("c509/bad-extensions", "an address range that is exactly a prefix must use the prefix form (RFC 3779 sec. 2.2.3.7)");
|
|
646
|
-
bounds
|
|
662
|
+
_push(bounds,{ lo: rlo, hi: rhi });
|
|
647
663
|
}
|
|
648
|
-
out
|
|
664
|
+
_push(out,b.sequence([b.bitString(lo.subarray(1), lo[0]), b.bitString(hi.subarray(1), hi[0])]));
|
|
649
665
|
} else {
|
|
650
666
|
var pfx = absolute(it);
|
|
651
|
-
seqs
|
|
652
|
-
bounds
|
|
653
|
-
out
|
|
667
|
+
_push(seqs,pfx);
|
|
668
|
+
_push(bounds,{ lo: _ipLow(pfx, width), hi: _ipHigh(pfx, width) });
|
|
669
|
+
_push(out,b.bitString(pfx.subarray(1), pfx[0]));
|
|
654
670
|
}
|
|
655
671
|
}
|
|
656
672
|
if (sawBytes && sawInt) throw _err("c509/bad-extensions", "an IPAddressFamily must use one address form throughout (sec. 3.3)");
|
|
@@ -680,8 +696,8 @@ function _ipChoiceFromDer(ch, afi) {
|
|
|
680
696
|
pair = [Buffer.concat([Buffer.from([lo.unusedBits]), lo.bytes]),
|
|
681
697
|
Buffer.concat([Buffer.from([hi.unusedBits]), hi.bytes])];
|
|
682
698
|
} else return null;
|
|
683
|
-
groups
|
|
684
|
-
for (var k = 0; k < pair.length; k++) flat
|
|
699
|
+
_push(groups,pair);
|
|
700
|
+
for (var k = 0; k < pair.length; k++) _push(flat,pair[k]);
|
|
685
701
|
}
|
|
686
702
|
var width = _IP_WIDTH[afi];
|
|
687
703
|
if (!width) return null;
|
|
@@ -691,7 +707,7 @@ function _ipChoiceFromDer(ch, afi) {
|
|
|
691
707
|
if (bg[0].length - 1 > width || bg[bg.length - 1].length - 1 > width) return null;
|
|
692
708
|
var blo = _ipLow(bg[0], width), bhi = _ipHigh(bg[bg.length - 1], width);
|
|
693
709
|
if (bg.length === 2 && _ipRangeIsPrefix(blo, bhi)) return null;
|
|
694
|
-
bounds
|
|
710
|
+
_push(bounds,{ lo: blo, hi: bhi });
|
|
695
711
|
}
|
|
696
712
|
for (var r = 0; r < bounds.length; r++) {
|
|
697
713
|
if (_ipOctCmp(bounds[r].lo, bounds[r].hi) > 0) return null;
|
|
@@ -701,7 +717,7 @@ function _ipChoiceFromDer(ch, afi) {
|
|
|
701
717
|
var out = [];
|
|
702
718
|
if (useBytes) {
|
|
703
719
|
groups.forEach(function (p) {
|
|
704
|
-
out
|
|
720
|
+
_push(out,p.length === 1 ? cbor.build.byteString(p[0])
|
|
705
721
|
: cbor.build.array([cbor.build.byteString(p[0]), cbor.build.byteString(p[1])]));
|
|
706
722
|
});
|
|
707
723
|
return cbor.build.array(out);
|
|
@@ -719,12 +735,12 @@ function _ipChoiceFromDer(ch, afi) {
|
|
|
719
735
|
if (grp.length === 1) {
|
|
720
736
|
var one = delta(grp[0]);
|
|
721
737
|
if (!one) return null;
|
|
722
|
-
out
|
|
738
|
+
_push(out,one);
|
|
723
739
|
} else {
|
|
724
740
|
var dlo = delta(grp[0]);
|
|
725
741
|
var dhi = dlo ? delta(grp[1]) : null;
|
|
726
742
|
if (!dlo || !dhi) return null;
|
|
727
|
-
out
|
|
743
|
+
_push(out,cbor.build.array([dlo, dhi]));
|
|
728
744
|
}
|
|
729
745
|
}
|
|
730
746
|
return cbor.build.array(out);
|
|
@@ -742,7 +758,7 @@ function _subtreesToDer(node, isNative) {
|
|
|
742
758
|
var kids = node.children;
|
|
743
759
|
if (kids.length === 0 || kids.length % 2 !== 0) throw _err("c509/bad-extensions", "a GeneralSubtrees array must be non-empty (int, value) pairs");
|
|
744
760
|
var out = [];
|
|
745
|
-
for (var i = 0; i + 1 < kids.length; i += 2) out
|
|
761
|
+
for (var i = 0; i + 1 < kids.length; i += 2) _push(out,b.sequence([_generalNameToDer(Number(_cborIntVal(kids[i], "a GeneralSubtree base type")), kids[i + 1], true, isNative)]));
|
|
746
762
|
return Buffer.concat(out);
|
|
747
763
|
}
|
|
748
764
|
function _subtreesFromDer(subtreeNodes, ctx) {
|
|
@@ -753,7 +769,7 @@ function _subtreesFromDer(subtreeNodes, ctx) {
|
|
|
753
769
|
if (st.tagClass !== "universal" || st.tagNumber !== asn1.TAGS.SEQUENCE || !st.children || st.children.length !== 1) return null;
|
|
754
770
|
var pair = _generalNameFromDer(schema.walk(GN_LEAF_SUBTREE, st.children[0], schema.withResources(NS, ctx)), true, ctx);
|
|
755
771
|
if (pair == null) return null;
|
|
756
|
-
out
|
|
772
|
+
_push(out,pair[0]); _push(out,pair[1]);
|
|
757
773
|
}
|
|
758
774
|
return out;
|
|
759
775
|
}
|
|
@@ -832,8 +848,8 @@ function _dpToDer(dpNode, isNative) {
|
|
|
832
848
|
uris = fullName.children.map(function (u) { return b.contextPrimitive(6, _ia5Bytes(u, 6)); });
|
|
833
849
|
} else throw _err("c509/bad-extensions", "a DistributionPoint fullName must be a URI text or an array of URIs");
|
|
834
850
|
var fields = [b.explicit(0, b.contextConstructed(0, Buffer.concat(uris)))];
|
|
835
|
-
if (!_isCborNull(reasons)) fields
|
|
836
|
-
if (!_isCborNull(crlIssuer)) fields
|
|
851
|
+
if (!_isCborNull(reasons)) _push(fields,_reasonsBitsToDer(Number(_cborUint(reasons, "cRLDistributionPoints reasons"))));
|
|
852
|
+
if (!_isCborNull(crlIssuer)) _push(fields,b.contextConstructed(2, b.explicit(4, _reconName(_name509(crlIssuer, true, isNative)))));
|
|
837
853
|
return b.sequence(fields);
|
|
838
854
|
}
|
|
839
855
|
function _dpFromDer(dp, ctx) {
|
|
@@ -851,7 +867,7 @@ function _dpFromDer(dp, ctx) {
|
|
|
851
867
|
for (var j = 0; j < dpn.children.length; j++) {
|
|
852
868
|
var mm = dpn.children[j];
|
|
853
869
|
if (mm.tagClass !== "context" || mm.tagNumber !== 6) return null;
|
|
854
|
-
fullNameUris
|
|
870
|
+
_push(fullNameUris,schema.walk(GN_LEAF, mm, NS).value);
|
|
855
871
|
}
|
|
856
872
|
} else if (f.tagNumber === 1) {
|
|
857
873
|
var bs;
|
|
@@ -930,8 +946,8 @@ function _extValueToDer(name, node, isNative) {
|
|
|
930
946
|
case "nameConstraints": {
|
|
931
947
|
if (node.majorType !== 4 || !node.children || node.children.length !== 2) throw _err("c509/bad-extensions", "a nameConstraints value must be a 2-element CBOR array [ permitted, excluded ] (sec. 3.3)");
|
|
932
948
|
var ncFields = [];
|
|
933
|
-
if (!_isCborNull(node.children[0])) ncFields
|
|
934
|
-
if (!_isCborNull(node.children[1])) ncFields
|
|
949
|
+
if (!_isCborNull(node.children[0])) _push(ncFields,b.contextConstructed(0, _subtreesToDer(node.children[0], isNative)));
|
|
950
|
+
if (!_isCborNull(node.children[1])) _push(ncFields,b.contextConstructed(1, _subtreesToDer(node.children[1], isNative)));
|
|
935
951
|
if (ncFields.length === 0) throw _err("c509/bad-extensions", "nameConstraints must contain permittedSubtrees or excludedSubtrees (RFC 5280 sec. 4.2.1.10)");
|
|
936
952
|
return b.sequence(ncFields);
|
|
937
953
|
}
|
|
@@ -941,7 +957,7 @@ function _extValueToDer(name, node, isNative) {
|
|
|
941
957
|
var aiaKids = node.children;
|
|
942
958
|
if (aiaKids.length === 0 || aiaKids.length % 2 !== 0) throw _err("c509/bad-extensions", "an " + name + " array must be non-empty (accessMethod, uri) pairs (sec. 3.3)");
|
|
943
959
|
var descs = [];
|
|
944
|
-
for (var ai = 0; ai + 1 < aiaKids.length; ai += 2) descs
|
|
960
|
+
for (var ai = 0; ai + 1 < aiaKids.length; ai += 2) _push(descs,b.sequence([b.oid(_accessMethodOid(aiaKids[ai])), b.contextPrimitive(6, _ia5Bytes(aiaKids[ai + 1], 6))]));
|
|
945
961
|
return b.sequence(descs);
|
|
946
962
|
}
|
|
947
963
|
case "cRLDistributionPoints":
|
|
@@ -962,7 +978,7 @@ function _extValueToDer(name, node, isNative) {
|
|
|
962
978
|
if (!_isCborNull(safiNode)) {
|
|
963
979
|
var safi = _cborUint(safiNode, "an IPAddrBlocks SAFI");
|
|
964
980
|
if (safi > 0xffn) throw _err("c509/bad-extensions", "an IPAddrBlocks SAFI must fit one octet (RFC 3779 sec. 2.2.3.3)");
|
|
965
|
-
famBytes
|
|
981
|
+
_push(famBytes,Number(safi));
|
|
966
982
|
}
|
|
967
983
|
var famOct = Buffer.from(famBytes);
|
|
968
984
|
if (prevFam !== null && _famOctCmp(prevFam, famOct) >= 0) {
|
|
@@ -971,14 +987,14 @@ function _extValueToDer(name, node, isNative) {
|
|
|
971
987
|
prevFam = famOct;
|
|
972
988
|
var choice = ipKids[fi + 2], famFields = [b.octetString(famOct)];
|
|
973
989
|
if (_isCborNull(choice)) {
|
|
974
|
-
famFields
|
|
990
|
+
_push(famFields,b.nullValue());
|
|
975
991
|
} else {
|
|
976
992
|
if (choice.majorType !== 4 || !choice.children || choice.children.length === 0) {
|
|
977
993
|
throw _err("c509/bad-extensions", "an IPAddrBlocks address choice must be null (inherit) or a non-empty CBOR array");
|
|
978
994
|
}
|
|
979
|
-
famFields
|
|
995
|
+
_push(famFields,b.sequence(_ipChoiceToDer(choice.children, Number(afi))));
|
|
980
996
|
}
|
|
981
|
-
families
|
|
997
|
+
_push(families,b.sequence(famFields));
|
|
982
998
|
}
|
|
983
999
|
return b.sequence(families);
|
|
984
1000
|
}
|
|
@@ -996,13 +1012,13 @@ function _extValueToDer(name, node, isNative) {
|
|
|
996
1012
|
var amin = _asDelta(it.children[0], asPrev), amax = _asDelta(it.children[1], amin);
|
|
997
1013
|
if (amax <= amin) throw _err("c509/bad-extensions", "an ASIdentifiers range must be ascending (RFC 3779 sec. 3.2.3.6)");
|
|
998
1014
|
if (asPrevHigh !== null && amin <= asPrevHigh + 1n) throw _err("c509/bad-extensions", "ASIdentifiers must be sorted, non-overlapping and maximally merged (RFC 3779 sec. 3.2.3.4)");
|
|
999
|
-
asDers
|
|
1015
|
+
_push(asDers,b.sequence([b.integer(amin), b.integer(amax)]));
|
|
1000
1016
|
asPrev = amax;
|
|
1001
1017
|
asPrevHigh = amax;
|
|
1002
1018
|
} else {
|
|
1003
1019
|
var aid = _asDelta(it, asPrev);
|
|
1004
1020
|
if (asPrevHigh !== null && aid <= asPrevHigh + 1n) throw _err("c509/bad-extensions", "ASIdentifiers must be sorted, non-overlapping and maximally merged (RFC 3779 sec. 3.2.3.4)");
|
|
1005
|
-
asDers
|
|
1021
|
+
_push(asDers,b.integer(aid));
|
|
1006
1022
|
asPrev = aid;
|
|
1007
1023
|
asPrevHigh = aid;
|
|
1008
1024
|
}
|
|
@@ -1024,10 +1040,10 @@ function _extValueToDer(name, node, isNative) {
|
|
|
1024
1040
|
if (quals.children.length) {
|
|
1025
1041
|
if (quals.children.length % 2 !== 0) throw _err("c509/bad-extensions", "a policyQualifiers array must be (policyQualifierId, qualifier) pairs");
|
|
1026
1042
|
var pqDers = [];
|
|
1027
|
-
for (var qk = 0; qk + 1 < quals.children.length; qk += 2) pqDers
|
|
1028
|
-
polFields
|
|
1043
|
+
for (var qk = 0; qk + 1 < quals.children.length; qk += 2) _push(pqDers,_qualifierToDer(quals.children[qk], quals.children[qk + 1]));
|
|
1044
|
+
_push(polFields,b.sequence(pqDers));
|
|
1029
1045
|
}
|
|
1030
|
-
polInfos
|
|
1046
|
+
_push(polInfos,b.sequence(polFields));
|
|
1031
1047
|
}
|
|
1032
1048
|
return b.sequence(polInfos);
|
|
1033
1049
|
}
|
|
@@ -1036,14 +1052,14 @@ function _extValueToDer(name, node, isNative) {
|
|
|
1036
1052
|
var pmKids = node.children;
|
|
1037
1053
|
if (pmKids.length === 0 || pmKids.length % 2 !== 0) throw _err("c509/bad-extensions", "a policyMappings array must be non-empty (issuerDomainPolicy, subjectDomainPolicy) pairs (sec. 3.3)");
|
|
1038
1054
|
var maps = [];
|
|
1039
|
-
for (var mi = 0; mi + 1 < pmKids.length; mi += 2) maps
|
|
1055
|
+
for (var mi = 0; mi + 1 < pmKids.length; mi += 2) _push(maps,b.sequence([b.oid(_policyIdToDerOid(pmKids[mi])), b.oid(_policyIdToDerOid(pmKids[mi + 1]))]));
|
|
1040
1056
|
return b.sequence(maps);
|
|
1041
1057
|
}
|
|
1042
1058
|
case "policyConstraints": {
|
|
1043
1059
|
if (node.majorType !== 4 || !node.children || node.children.length !== 2) throw _err("c509/bad-extensions", "a policyConstraints value must be a 2-element CBOR array [ requireExplicitPolicy, inhibitPolicyMapping ] (sec. 3.3)");
|
|
1044
1060
|
var pcFields = [], repN = node.children[0], ipmN = node.children[1];
|
|
1045
|
-
if (!_isCborNull(repN)) pcFields
|
|
1046
|
-
if (!_isCborNull(ipmN)) pcFields
|
|
1061
|
+
if (!_isCborNull(repN)) _push(pcFields,b.implicit(0, b.integer(_boundCount(_cborUint(repN, "a policyConstraints requireExplicitPolicy"), "a policyConstraints requireExplicitPolicy"))));
|
|
1062
|
+
if (!_isCborNull(ipmN)) _push(pcFields,b.implicit(1, b.integer(_boundCount(_cborUint(ipmN, "a policyConstraints inhibitPolicyMapping"), "a policyConstraints inhibitPolicyMapping"))));
|
|
1047
1063
|
if (pcFields.length === 0) throw _err("c509/bad-extensions", "policyConstraints must contain requireExplicitPolicy or inhibitPolicyMapping (RFC 5280 sec. 4.2.1.11)");
|
|
1048
1064
|
return b.sequence(pcFields);
|
|
1049
1065
|
}
|
|
@@ -1141,8 +1157,8 @@ function _extValueFromDer(name, der, ctx) {
|
|
|
1141
1157
|
var aiaLoc = d.children[1];
|
|
1142
1158
|
if (aiaLoc.tagClass !== "context" || aiaLoc.tagNumber !== 6) return null;
|
|
1143
1159
|
var methodDotted = asn1.read.oid(d.children[0]), mint = IA_TO_INT[methodDotted];
|
|
1144
|
-
aiaOut
|
|
1145
|
-
aiaOut
|
|
1160
|
+
_push(aiaOut,mint !== undefined ? cbor.build.int(BigInt(mint)) : _oidCbor(methodDotted));
|
|
1161
|
+
_push(aiaOut,cbor.build.textString(schema.walk(GN_LEAF, aiaLoc, NS).value));
|
|
1146
1162
|
}
|
|
1147
1163
|
return cbor.build.array(aiaOut);
|
|
1148
1164
|
}
|
|
@@ -1151,7 +1167,7 @@ function _extValueFromDer(name, der, ctx) {
|
|
|
1151
1167
|
var dps = node.children || [];
|
|
1152
1168
|
if (node.tagClass !== "universal" || node.tagNumber !== asn1.TAGS.SEQUENCE || dps.length < 1) return null;
|
|
1153
1169
|
var dpResults = [];
|
|
1154
|
-
for (var dpi = 0; dpi < dps.length; dpi++) { var dpr = _dpFromDer(dps[dpi], ctx); if (dpr == null) return null; dpResults
|
|
1170
|
+
for (var dpi = 0; dpi < dps.length; dpi++) { var dpr = _dpFromDer(dps[dpi], ctx); if (dpr == null) return null; _push(dpResults,dpr); }
|
|
1155
1171
|
if (dpResults.length === 1 && dpResults[0].oneUri != null && dpResults[0].noReasons && dpResults[0].noIssuer) return cbor.build.textString(dpResults[0].oneUri);
|
|
1156
1172
|
return cbor.build.array(dpResults.map(function (r) { return r.triple; }));
|
|
1157
1173
|
}
|
|
@@ -1167,13 +1183,13 @@ function _extValueFromDer(name, der, ctx) {
|
|
|
1167
1183
|
if (prevFamOct !== null && _famOctCmp(prevFamOct, famOct) >= 0) return null;
|
|
1168
1184
|
prevFamOct = famOct;
|
|
1169
1185
|
var afiVal = (famOct[0] << 8) | famOct[1];
|
|
1170
|
-
ipOut
|
|
1171
|
-
ipOut
|
|
1186
|
+
_push(ipOut,cbor.build.uint(BigInt(afiVal)));
|
|
1187
|
+
_push(ipOut,famOct.length === 3 ? cbor.build.uint(BigInt(famOct[2])) : cbor.build.nullValue());
|
|
1172
1188
|
var ch = fam.children[1];
|
|
1173
|
-
if (_isUniversal(ch, asn1.TAGS.NULL)) { ipOut
|
|
1189
|
+
if (_isUniversal(ch, asn1.TAGS.NULL)) { _push(ipOut,cbor.build.nullValue()); continue; }
|
|
1174
1190
|
var chOut = _ipChoiceFromDer(ch, afiVal);
|
|
1175
1191
|
if (!chOut) return null;
|
|
1176
|
-
ipOut
|
|
1192
|
+
_push(ipOut,chOut);
|
|
1177
1193
|
}
|
|
1178
1194
|
return cbor.build.array(ipOut);
|
|
1179
1195
|
}
|
|
@@ -1199,10 +1215,10 @@ function _extValueFromDer(name, der, ctx) {
|
|
|
1199
1215
|
} else return null;
|
|
1200
1216
|
if (asPrevHigh !== null && elLo <= asPrevHigh + 1n) return null;
|
|
1201
1217
|
if (el.tagNumber === asn1.TAGS.INTEGER) {
|
|
1202
|
-
asOut
|
|
1218
|
+
_push(asOut,cbor.build.int(asPrevOut === null ? elLo : elLo - asPrevOut));
|
|
1203
1219
|
asPrevOut = elLo;
|
|
1204
1220
|
} else {
|
|
1205
|
-
asOut
|
|
1221
|
+
_push(asOut,cbor.build.array([
|
|
1206
1222
|
cbor.build.int(asPrevOut === null ? elLo : elLo - asPrevOut),
|
|
1207
1223
|
cbor.build.int(elHi - elLo),
|
|
1208
1224
|
]));
|
|
@@ -1218,7 +1234,7 @@ function _extValueFromDer(name, der, ctx) {
|
|
|
1218
1234
|
for (var pli = 0; pli < node.children.length; pli++) {
|
|
1219
1235
|
var pol = node.children[pli];
|
|
1220
1236
|
if (pol.tagClass !== "universal" || pol.tagNumber !== asn1.TAGS.SEQUENCE || !pol.children || pol.children.length < 1 || pol.children.length > 2) return null;
|
|
1221
|
-
cpOut
|
|
1237
|
+
_push(cpOut,_policyIdFromDer(asn1.read.oid(pol.children[0])));
|
|
1222
1238
|
var qArr = [];
|
|
1223
1239
|
if (pol.children.length === 2) {
|
|
1224
1240
|
var qseq = pol.children[1];
|
|
@@ -1228,10 +1244,10 @@ function _extValueFromDer(name, der, ctx) {
|
|
|
1228
1244
|
if (pq.tagClass !== "universal" || pq.tagNumber !== asn1.TAGS.SEQUENCE || !pq.children || pq.children.length !== 2) return null;
|
|
1229
1245
|
var qpair = _qualifierFromDer(pq);
|
|
1230
1246
|
if (qpair == null) return null;
|
|
1231
|
-
qArr
|
|
1247
|
+
_push(qArr,qpair[0]); _push(qArr,qpair[1]);
|
|
1232
1248
|
}
|
|
1233
1249
|
}
|
|
1234
|
-
cpOut
|
|
1250
|
+
_push(cpOut,cbor.build.array(qArr));
|
|
1235
1251
|
}
|
|
1236
1252
|
return cbor.build.array(cpOut);
|
|
1237
1253
|
}
|
|
@@ -1241,8 +1257,8 @@ function _extValueFromDer(name, der, ctx) {
|
|
|
1241
1257
|
for (var pm = 0; pm < node.children.length; pm++) {
|
|
1242
1258
|
var mp = node.children[pm];
|
|
1243
1259
|
if (mp.tagClass !== "universal" || mp.tagNumber !== asn1.TAGS.SEQUENCE || !mp.children || mp.children.length !== 2) return null;
|
|
1244
|
-
pmOut
|
|
1245
|
-
pmOut
|
|
1260
|
+
_push(pmOut,_policyIdFromDer(asn1.read.oid(mp.children[0])));
|
|
1261
|
+
_push(pmOut,_policyIdFromDer(asn1.read.oid(mp.children[1])));
|
|
1246
1262
|
}
|
|
1247
1263
|
return cbor.build.array(pmOut);
|
|
1248
1264
|
}
|
|
@@ -1304,18 +1320,18 @@ function _sdaToDer(node, isNative) {
|
|
|
1304
1320
|
for (var vi = 0; vi < valuesNode.children.length; vi++) {
|
|
1305
1321
|
var vn = valuesNode.children[vi];
|
|
1306
1322
|
if (vn.majorType !== 3) throw _err("c509/bad-extensions", "a subjectDirectoryAttributes int-form attribute value must be a CBOR text string (a non-string value requires the ~oid form)");
|
|
1307
|
-
try { vals
|
|
1323
|
+
try { _push(vals,_reconAttrValue({ type: tname, value: cbor.read.textString(vn), printable: ti < 0 })); }
|
|
1308
1324
|
catch (e) { throw _err("c509/bad-extensions", "a subjectDirectoryAttributes " + tname + " value is not valid for its string type", e); }
|
|
1309
1325
|
}
|
|
1310
|
-
attrs
|
|
1326
|
+
_push(attrs,b.sequence([b.oid(oid.byName(tname)), _derSetInDeclaredOrder(vals)]));
|
|
1311
1327
|
} else if (typeNode.majorType === 2) {
|
|
1312
1328
|
var dotted = _oidName(typeNode, "c509/bad-extensions", "a subjectDirectoryAttributes attribute type").oid;
|
|
1313
1329
|
for (var vj = 0; vj < valuesNode.children.length; vj++) {
|
|
1314
1330
|
var vb = valuesNode.children[vj];
|
|
1315
1331
|
if (vb.majorType !== 2) throw _err("c509/bad-extensions", "a ~oid-form subjectDirectoryAttributes value must be a CBOR byte string (a raw DER AttributeValue)");
|
|
1316
|
-
vals
|
|
1332
|
+
_push(vals,b.raw(_requireStrictDerTlv(vb.content, "c509/bad-extensions", "a ~oid-form subjectDirectoryAttributes AttributeValue")));
|
|
1317
1333
|
}
|
|
1318
|
-
attrs
|
|
1334
|
+
_push(attrs,b.sequence([b.oid(dotted), _derSetInDeclaredOrder(vals)]));
|
|
1319
1335
|
} else {
|
|
1320
1336
|
throw _err("c509/bad-extensions", "a subjectDirectoryAttributes attribute type must be a CBOR integer (sec. 8.6) or a ~oid");
|
|
1321
1337
|
}
|
|
@@ -1330,7 +1346,7 @@ function _sdaTryIntForm(tint, name, valueNodes) {
|
|
|
1330
1346
|
var mails = [];
|
|
1331
1347
|
for (i = 0; i < valueNodes.length; i++) {
|
|
1332
1348
|
if (valueNodes[i].tagClass !== "universal" || valueNodes[i].tagNumber !== asn1.TAGS.IA5_STRING) return null;
|
|
1333
|
-
mails
|
|
1349
|
+
_push(mails,cbor.build.textString(asn1.read.string(valueNodes[i])));
|
|
1334
1350
|
}
|
|
1335
1351
|
return { sign: 1, values: mails };
|
|
1336
1352
|
}
|
|
@@ -1342,7 +1358,7 @@ function _sdaTryIntForm(tint, name, valueNodes) {
|
|
|
1342
1358
|
else return null;
|
|
1343
1359
|
if (sign === 0) sign = s;
|
|
1344
1360
|
else if (sign !== s) return null;
|
|
1345
|
-
out
|
|
1361
|
+
_push(out,cbor.build.textString(asn1.read.string(vn)));
|
|
1346
1362
|
}
|
|
1347
1363
|
return { sign: sign, values: out };
|
|
1348
1364
|
}
|
|
@@ -1361,11 +1377,11 @@ function _sdaFromDer(node) {
|
|
|
1361
1377
|
var tint = canonAttr === undefined ? undefined : ATTR_TO_INT[canonAttr];
|
|
1362
1378
|
var intForm = _sdaTryIntForm(tint, nm, setNode.children);
|
|
1363
1379
|
if (intForm != null) {
|
|
1364
|
-
out
|
|
1365
|
-
out
|
|
1380
|
+
_push(out,cbor.build.int(BigInt(intForm.sign < 0 ? -tint : tint)));
|
|
1381
|
+
_push(out,cbor.build.array(intForm.values));
|
|
1366
1382
|
} else {
|
|
1367
|
-
out
|
|
1368
|
-
out
|
|
1383
|
+
_push(out,_oidCbor(dotted));
|
|
1384
|
+
_push(out,cbor.build.array(setNode.children.map(function (v) { return cbor.build.byteString(v.bytes); })));
|
|
1369
1385
|
}
|
|
1370
1386
|
}
|
|
1371
1387
|
return cbor.build.array(out);
|
|
@@ -1439,7 +1455,7 @@ function _extensions(node, isNative, ctx) {
|
|
|
1439
1455
|
}
|
|
1440
1456
|
_assertSpecificExtension(extOid, valContent, isNative, ctx);
|
|
1441
1457
|
}
|
|
1442
|
-
out
|
|
1458
|
+
_push(out,{ name: name, oid: extOid, critical: critical, value: valContent || null });
|
|
1443
1459
|
}
|
|
1444
1460
|
return out;
|
|
1445
1461
|
}
|
|
@@ -1448,7 +1464,7 @@ function _extensions(node, isNative, ctx) {
|
|
|
1448
1464
|
function _macToEui64String(buf) {
|
|
1449
1465
|
var bytes = buf.length === 6 ? Buffer.concat([buf.subarray(0, 3), Buffer.from([0xff, 0xfe]), buf.subarray(3)]) : buf;
|
|
1450
1466
|
var s = [];
|
|
1451
|
-
for (var i = 0; i < bytes.length; i++) { var h = bytes[i].toString(16).toUpperCase(); if (h.length < 2) h = "0" + h; s
|
|
1467
|
+
for (var i = 0; i < bytes.length; i++) { var h = bytes[i].toString(16).toUpperCase(); if (h.length < 2) h = "0" + h; _push(s, h); }
|
|
1452
1468
|
return s.join("-");
|
|
1453
1469
|
}
|
|
1454
1470
|
|
|
@@ -1516,8 +1532,8 @@ function _reconExtensions(exts) {
|
|
|
1516
1532
|
else if (Buffer.isBuffer(ext.value)) extnValue = ext.value;
|
|
1517
1533
|
else throw _err("c509/non-invertible", "extension " + ext.name + " has no reconstructable value in the covered set");
|
|
1518
1534
|
var fields = [b.oid(ext.oid || oid.byName(ext.name))];
|
|
1519
|
-
if (ext.critical) fields
|
|
1520
|
-
fields
|
|
1535
|
+
if (ext.critical) _push(fields,b.boolean(true));
|
|
1536
|
+
_push(fields,b.octetString(extnValue));
|
|
1521
1537
|
return b.sequence(fields);
|
|
1522
1538
|
});
|
|
1523
1539
|
return b.explicit(3, b.sequence(items));
|
|
@@ -1526,7 +1542,7 @@ function _reconExtensions(exts) {
|
|
|
1526
1542
|
function _reconAlgId(alg) {
|
|
1527
1543
|
var fields = [b.oid(alg.oid)];
|
|
1528
1544
|
if (alg.parameters && alg.parameters.length) {
|
|
1529
|
-
fields
|
|
1545
|
+
_push(fields,b.raw(_requireStrictDerTlv(alg.parameters, "c509/non-invertible", "algorithm parameters")));
|
|
1530
1546
|
}
|
|
1531
1547
|
return b.sequence(fields);
|
|
1532
1548
|
}
|
|
@@ -1547,7 +1563,7 @@ function _reconstructDer(r, sigNode) {
|
|
|
1547
1563
|
subjectName,
|
|
1548
1564
|
_reconSpki(r.subjectPublicKeyAlgorithm, r.subjectPublicKey, r.rsaPublicKey),
|
|
1549
1565
|
];
|
|
1550
|
-
if (r.extensions.length) tbsFields
|
|
1566
|
+
if (r.extensions.length) _push(tbsFields,_reconExtensions(r.extensions));
|
|
1551
1567
|
var tbs = b.sequence(tbsFields);
|
|
1552
1568
|
if (String(r.signatureAlgorithm.name || "").toLowerCase().indexOf("ecdsa") !== 0) {
|
|
1553
1569
|
throw _err("c509/non-invertible", "type-3 signature reconstruction covers only ECDSA; got " + r.signatureAlgorithm.name);
|
|
@@ -1751,8 +1767,8 @@ function _encName(name, isSubject) {
|
|
|
1751
1767
|
rdns.forEach(function (rdn) {
|
|
1752
1768
|
var ai = ATTR_TO_INT[rdn.type];
|
|
1753
1769
|
if (ai === undefined) throw _err("c509/bad-name", "attribute type " + _describe(rdn.type) + " has no C509 registry int");
|
|
1754
|
-
items
|
|
1755
|
-
items
|
|
1770
|
+
_push(items,cbor.build.int(BigInt(rdn.printable ? -ai : ai)));
|
|
1771
|
+
_push(items,_encSpecialText(rdn));
|
|
1756
1772
|
});
|
|
1757
1773
|
return cbor.build.array(items);
|
|
1758
1774
|
}
|
|
@@ -1806,14 +1822,14 @@ function _encExtensions(exts, isNative) {
|
|
|
1806
1822
|
var ei = extName == null ? undefined : EXT_TO_INT[extName];
|
|
1807
1823
|
var compact = (ei !== undefined && Buffer.isBuffer(ext.value)) ? _tryCompactExtValue(extName, ext.value, isNative) : null;
|
|
1808
1824
|
if (compact != null) {
|
|
1809
|
-
items
|
|
1810
|
-
items
|
|
1825
|
+
_push(items,cbor.build.int(BigInt(ext.critical ? -ei : ei)));
|
|
1826
|
+
_push(items,compact);
|
|
1811
1827
|
} else {
|
|
1812
1828
|
if (!extDotted) throw _err("c509/bad-input", "an extension must carry an OID or a name in the OID registry, got " + _describe(ext.name));
|
|
1813
|
-
items
|
|
1829
|
+
_push(items,cbor.build.byteString(asn1.encodeOidContent(extDotted)));
|
|
1814
1830
|
if (!Buffer.isBuffer(ext.value)) throw _err("c509/non-invertible", "extension " + (ext.oid || ext.name) + " has no byte-string value to encode");
|
|
1815
1831
|
var bs = cbor.build.byteString(ext.value);
|
|
1816
|
-
items
|
|
1832
|
+
_push(items,ext.critical ? cbor.build.array([bs]) : bs);
|
|
1817
1833
|
}
|
|
1818
1834
|
});
|
|
1819
1835
|
return cbor.build.array(items);
|
|
@@ -1927,8 +1943,8 @@ function _c509NameFromDer(nameBytes, ctx) {
|
|
|
1927
1943
|
var isIa5 = valNode.tagClass === "universal" && valNode.tagNumber === asn1.TAGS.IA5_STRING;
|
|
1928
1944
|
if ((attrName === "emailAddress") !== isIa5) throw _err("c509/non-invertible", "attribute " + attrName + " carries a " + (isIa5 ? "IA5String" : "non-IA5String") + " value the C509 sec. 8.6 int form cannot represent");
|
|
1929
1945
|
var eui = attrName === "commonName" ? _euiFromCn(value) : null;
|
|
1930
|
-
if (eui) rdns
|
|
1931
|
-
else rdns
|
|
1946
|
+
if (eui) _push(rdns,{ type: attrName, value: value, eui64: eui });
|
|
1947
|
+
else _push(rdns,{ type: attrName, value: value, printable: valNode.tagNumber === asn1.TAGS.PRINTABLE_STRING });
|
|
1932
1948
|
});
|
|
1933
1949
|
return { rdns: rdns };
|
|
1934
1950
|
}
|
package/lib/schema-cmc.js
CHANGED
|
@@ -45,6 +45,9 @@ var cms = require("./schema-cms");
|
|
|
45
45
|
var csr = require("./schema-csr");
|
|
46
46
|
var crmf = require("./schema-crmf");
|
|
47
47
|
var guard = require("./guard-all");
|
|
48
|
+
/** @internal The append this module's lists are built with: `push` stores at the index and a store
|
|
49
|
+
* consults a setter inherited there, which takes the element being appended. */
|
|
50
|
+
var _push = guard.list.append;
|
|
48
51
|
var frameworkError = require("./framework-error");
|
|
49
52
|
|
|
50
53
|
var CmcError = frameworkError.CmcError;
|
|
@@ -623,7 +626,7 @@ function _collectStatuses(controls, ctx) {
|
|
|
623
626
|
if (c.values.length !== 1) {
|
|
624
627
|
throw E("cmc/bad-status-info", "a CMC status control carries exactly one AttributeValue, got " + c.values.length);
|
|
625
628
|
}
|
|
626
|
-
out
|
|
629
|
+
_push(out, parseStatusInfo(c.values[0], version, c.bodyPartID, ctx));
|
|
627
630
|
}
|
|
628
631
|
return out;
|
|
629
632
|
}
|
|
@@ -636,7 +639,7 @@ function _finishBody(body, where, ctx) {
|
|
|
636
639
|
return c.attrType !== OID_STATUS_INFO && c.attrType !== OID_STATUS_INFO_V2 && c.attrName === null;
|
|
637
640
|
});
|
|
638
641
|
var ids = [];
|
|
639
|
-
function collect(list) { for (var j = 0; j < list.length; j++) ids
|
|
642
|
+
function collect(list) { for (var j = 0; j < list.length; j++) _push(ids, list[j].bodyPartID); }
|
|
640
643
|
collect(body.controls);
|
|
641
644
|
collect(body.requests);
|
|
642
645
|
collect(body.cmsSequence);
|
package/lib/schema-cmp.js
CHANGED
|
@@ -43,6 +43,9 @@ var cms = require("./schema-cms.js");
|
|
|
43
43
|
var crmf = require("./schema-crmf.js");
|
|
44
44
|
var frameworkError = require("./framework-error.js");
|
|
45
45
|
var guard = require("./guard-all.js");
|
|
46
|
+
/** @internal The append this module's lists are built with: `push` stores at the index and a store
|
|
47
|
+
* consults a setter inherited there, which takes the element being appended. */
|
|
48
|
+
var _push = guard.list.append;
|
|
46
49
|
var constants = require("./constants");
|
|
47
50
|
|
|
48
51
|
var CmpError = frameworkError.CmpError;
|
|
@@ -85,7 +88,7 @@ var PKI_FAILURE_INFO = schema.decode(function (n, ctx) {
|
|
|
85
88
|
schema.assertMinimalNamedBits(bs.unusedBits, bs.bytes, function (m) { throw ctx.E("cmp/bad-fail-info", m); });
|
|
86
89
|
var bits = [];
|
|
87
90
|
for (var i = 0; i < total; i++) {
|
|
88
|
-
if ((bs.bytes[i >> 3] >> (7 - (i % 8))) & 1) bits
|
|
91
|
+
if ((bs.bytes[i >> 3] >> (7 - (i % 8))) & 1) _push(bits, i < FAIL_INFO_NAMES.length ? FAIL_INFO_NAMES[i] : i);
|
|
89
92
|
}
|
|
90
93
|
return { bits: bits, raw: bs };
|
|
91
94
|
});
|
|
@@ -578,11 +581,11 @@ var PKI_MESSAGE = schema.seq([
|
|
|
578
581
|
var ckps = [];
|
|
579
582
|
if (body.decoded && body.decoded.response) {
|
|
580
583
|
for (var r = 0; r < body.decoded.response.length; r++) {
|
|
581
|
-
if (body.decoded.response[r].certifiedKeyPair) ckps
|
|
584
|
+
if (body.decoded.response[r].certifiedKeyPair) _push(ckps, body.decoded.response[r].certifiedKeyPair);
|
|
582
585
|
}
|
|
583
586
|
}
|
|
584
587
|
if (body.decoded && body.decoded.keyPairHist) {
|
|
585
|
-
for (var kh = 0; kh < body.decoded.keyPairHist.length; kh++) ckps
|
|
588
|
+
for (var kh = 0; kh < body.decoded.keyPairHist.length; kh++) _push(ckps, body.decoded.keyPairHist[kh]);
|
|
586
589
|
}
|
|
587
590
|
for (var ck = 0; ck < ckps.length; ck++) {
|
|
588
591
|
var usesEnveloped =
|
package/lib/schema-cms.js
CHANGED
|
@@ -53,6 +53,9 @@ var asn1 = require("./asn1-der");
|
|
|
53
53
|
var schema = require("./schema-engine");
|
|
54
54
|
var pkix = require("./schema-pkix");
|
|
55
55
|
var guard = require("./guard-all");
|
|
56
|
+
/** @internal The append this module's lists are built with: `push` stores at the index and a store
|
|
57
|
+
* consults a setter inherited there, which takes the element being appended. */
|
|
58
|
+
var _push = guard.list.append;
|
|
56
59
|
var oid = require("./oid");
|
|
57
60
|
/** @internal The OCSP response schema, for the RFC 5940 `crls` arm. `schema-ocsp` requires neither
|
|
58
61
|
* this module nor anything that reaches it, so this is an ordinary top-of-file require. */
|
|
@@ -595,7 +598,7 @@ function algorithmProtectionReport(attrs, digestAlgorithm, armName, armIdentifie
|
|
|
595
598
|
" (RFC 6211 sec. 3)" };
|
|
596
599
|
return out;
|
|
597
600
|
}
|
|
598
|
-
out.compared
|
|
601
|
+
_push(out.compared, "digestAlgorithm");
|
|
599
602
|
var wantsMacArm = armName === "macAlgorithm";
|
|
600
603
|
var arm = wantsMacArm ? value.macAlgorithm : value.signatureAlgorithm;
|
|
601
604
|
var other = wantsMacArm ? value.signatureAlgorithm : value.macAlgorithm;
|
|
@@ -615,7 +618,7 @@ function algorithmProtectionReport(attrs, digestAlgorithm, armName, armIdentifie
|
|
|
615
618
|
", or their parameters differ (RFC 6211 sec. 3)" };
|
|
616
619
|
return out;
|
|
617
620
|
}
|
|
618
|
-
out.compared
|
|
621
|
+
_push(out.compared, armName);
|
|
619
622
|
return out;
|
|
620
623
|
}
|
|
621
624
|
|
|
@@ -1527,7 +1530,7 @@ function taggedParameterFields(params, maxTag) {
|
|
|
1527
1530
|
!Array.isArray(f.children) || f.children.length !== 1) return null;
|
|
1528
1531
|
last = f.tagNumber;
|
|
1529
1532
|
if (!Buffer.isBuffer(f.children[0].bytes)) return null;
|
|
1530
|
-
out
|
|
1533
|
+
_push(out, { tag: f.tagNumber, node: f.children[0], bytes: f.children[0].bytes });
|
|
1531
1534
|
}
|
|
1532
1535
|
return out;
|
|
1533
1536
|
}
|
|
@@ -1547,7 +1550,7 @@ function _paramKeyWithoutDefaults(params, rows) {
|
|
|
1547
1550
|
if (rows[r].tag === fields[i].tag) { defaulted = rows[r].value.equals(fields[i].bytes); break; }
|
|
1548
1551
|
}
|
|
1549
1552
|
if (defaulted) continue;
|
|
1550
|
-
parts
|
|
1553
|
+
_push(parts, String(fields[i].tag) + ":" + fields[i].bytes.toString("hex"));
|
|
1551
1554
|
}
|
|
1552
1555
|
return parts.join(",");
|
|
1553
1556
|
}
|
package/lib/schema-crl.js
CHANGED
|
@@ -292,7 +292,7 @@ var DOOR = pkix.extensionDoor({
|
|
|
292
292
|
var out = [{ list: rawRecords(crl.crlExtensions), scope: "crl" }];
|
|
293
293
|
var revoked = crl.revokedCertificates || [];
|
|
294
294
|
for (var i = 0; i < revoked.length; i++) {
|
|
295
|
-
intrinsic.
|
|
295
|
+
intrinsic.append(out, { list: rawRecords(revoked[i].crlEntryExtensions), scope: "crl-entry", containerIndex: i });
|
|
296
296
|
}
|
|
297
297
|
return out;
|
|
298
298
|
},
|
package/lib/schema-crmf.js
CHANGED
|
@@ -451,7 +451,7 @@ var DOOR = pkix.extensionDoor({
|
|
|
451
451
|
var out = [];
|
|
452
452
|
for (var i = 0; i < messages.length; i++) {
|
|
453
453
|
var template = messages[i].certReq && messages[i].certReq.certTemplate;
|
|
454
|
-
intrinsic.
|
|
454
|
+
intrinsic.append(out, { list: (template && template.extensions) || [], scope: "crmf-template", containerIndex: i });
|
|
455
455
|
}
|
|
456
456
|
return out;
|
|
457
457
|
},
|
package/lib/schema-csr.js
CHANGED
|
@@ -298,7 +298,7 @@ var DOOR = pkix.extensionDoor({
|
|
|
298
298
|
var out = [];
|
|
299
299
|
for (var i = 0; i < attrs.length; i++) {
|
|
300
300
|
if (attrs[i].type !== OID_EXTENSION_REQUEST) continue;
|
|
301
|
-
intrinsic.
|
|
301
|
+
intrinsic.append(out, { list: attrs[i].extensions || [], scope: "csr-requested", containerIndex: i });
|
|
302
302
|
}
|
|
303
303
|
if (!read.groups && out.length > 1) {
|
|
304
304
|
throw _err("csr/ambiguous-extension-request", "this request carries " + out.length +
|
|
@@ -312,9 +312,9 @@ var DOOR = pkix.extensionDoor({
|
|
|
312
312
|
for (var s = 0; s < segments.length; s++) {
|
|
313
313
|
var g = { attributeIndex: segments[s].containerIndex, extensions: [] };
|
|
314
314
|
byIndex[segments[s].containerIndex] = g;
|
|
315
|
-
intrinsic.
|
|
315
|
+
intrinsic.append(out, g);
|
|
316
316
|
}
|
|
317
|
-
for (var r = 0; r < rows.length; r++) intrinsic.
|
|
317
|
+
for (var r = 0; r < rows.length; r++) intrinsic.append(byIndex[rows[r].containerIndex].extensions, rows[r]);
|
|
318
318
|
return out;
|
|
319
319
|
},
|
|
320
320
|
});
|