@kernelift/ai-chat 2.1.4 → 2.1.6
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 +12 -0
- package/README.md +28 -27
- package/dist/ai-chat.css +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +1052 -1037
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -282,9 +282,9 @@ function Bt(t) {
|
|
|
282
282
|
function mi(t, e, a = {}) {
|
|
283
283
|
var p;
|
|
284
284
|
const S = t.getFullYear(), C = t.getMonth(), c = t.getDate(), r = t.getHours(), g = t.getMinutes(), u = t.getSeconds(), I = t.getMilliseconds(), D = t.getDay(), E = (p = a.customMeridiem) !== null && p !== void 0 ? p : vi, l = (A) => {
|
|
285
|
-
var
|
|
286
|
-
return (
|
|
287
|
-
},
|
|
285
|
+
var v;
|
|
286
|
+
return (v = A.split(" ")[1]) !== null && v !== void 0 ? v : "";
|
|
287
|
+
}, y = {
|
|
288
288
|
Yo: () => Bt(S),
|
|
289
289
|
YY: () => String(S).slice(-2),
|
|
290
290
|
YYYY: () => S,
|
|
@@ -322,9 +322,9 @@ function mi(t, e, a = {}) {
|
|
|
322
322
|
zzz: () => l(t.toLocaleDateString(We(a.locales), { timeZoneName: "shortOffset" })),
|
|
323
323
|
zzzz: () => l(t.toLocaleDateString(We(a.locales), { timeZoneName: "longOffset" }))
|
|
324
324
|
};
|
|
325
|
-
return e.replace(yi, (A,
|
|
325
|
+
return e.replace(yi, (A, v) => {
|
|
326
326
|
var s, h;
|
|
327
|
-
return (s =
|
|
327
|
+
return (s = v ?? ((h = y[A]) === null || h === void 0 ? void 0 : h.call(y))) !== null && s !== void 0 ? s : A;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
function Ai(t, e, a) {
|
|
@@ -356,7 +356,7 @@ function Zr(...t) {
|
|
|
356
356
|
}, ([r, g, u, I]) => {
|
|
357
357
|
if (a(), !r?.length || !g?.length || !u?.length) return;
|
|
358
358
|
const D = si(I) ? { ...I } : I;
|
|
359
|
-
e.push(...r.flatMap((E) => g.flatMap((l) => u.map((
|
|
359
|
+
e.push(...r.flatMap((E) => g.flatMap((l) => u.map((y) => p(E, l, y, D)))));
|
|
360
360
|
}, { flush: "post" }), c = () => {
|
|
361
361
|
C(), a();
|
|
362
362
|
};
|
|
@@ -410,32 +410,32 @@ function Lt(t, e, a, p = {}) {
|
|
|
410
410
|
var S;
|
|
411
411
|
const { flush: C = "pre", deep: c = !0, listenToStorageChanges: r = !0, writeDefaults: g = !0, mergeDefaults: u = !1, shallow: I, window: D = Kt, eventFilter: E, onError: l = (Q) => {
|
|
412
412
|
console.error(Q);
|
|
413
|
-
}, initOnMounted:
|
|
413
|
+
}, initOnMounted: y } = p, A = (I ? On : pt)(typeof e == "function" ? e() : e), v = _e(() => We(t));
|
|
414
414
|
if (!a) try {
|
|
415
415
|
a = Si("getDefaultStorage", () => Kt?.localStorage)();
|
|
416
416
|
} catch (Q) {
|
|
417
417
|
l(Q);
|
|
418
418
|
}
|
|
419
419
|
if (!a) return A;
|
|
420
|
-
const s = We(e), h = Bi(s),
|
|
420
|
+
const s = We(e), h = Bi(s), m = (S = p.serializer) !== null && S !== void 0 ? S : bi[h], { pause: b, resume: N } = hi(A, (Q) => P(Q), {
|
|
421
421
|
flush: C,
|
|
422
422
|
deep: c,
|
|
423
423
|
eventFilter: E
|
|
424
424
|
});
|
|
425
|
-
bt(
|
|
425
|
+
bt(v, () => O(), { flush: C });
|
|
426
426
|
let d = !1;
|
|
427
427
|
const i = (Q) => {
|
|
428
|
-
|
|
428
|
+
y && !d || O(Q);
|
|
429
429
|
}, n = (Q) => {
|
|
430
|
-
|
|
430
|
+
y && !d || M(Q);
|
|
431
431
|
};
|
|
432
|
-
D && r && (a instanceof Storage ? Zr(D, "storage", i, { passive: !0 }) : Zr(D, Wr, n)),
|
|
432
|
+
D && r && (a instanceof Storage ? Zr(D, "storage", i, { passive: !0 }) : Zr(D, Wr, n)), y ? gi(() => {
|
|
433
433
|
d = !0, O();
|
|
434
434
|
}) : O();
|
|
435
435
|
function k(Q, G) {
|
|
436
436
|
if (D) {
|
|
437
437
|
const z = {
|
|
438
|
-
key:
|
|
438
|
+
key: v.value,
|
|
439
439
|
oldValue: Q,
|
|
440
440
|
newValue: G,
|
|
441
441
|
storageArea: a
|
|
@@ -445,28 +445,28 @@ function Lt(t, e, a, p = {}) {
|
|
|
445
445
|
}
|
|
446
446
|
function P(Q) {
|
|
447
447
|
try {
|
|
448
|
-
const G = a.getItem(
|
|
448
|
+
const G = a.getItem(v.value);
|
|
449
449
|
if (Q == null)
|
|
450
|
-
k(G, null), a.removeItem(
|
|
450
|
+
k(G, null), a.removeItem(v.value);
|
|
451
451
|
else {
|
|
452
|
-
const z =
|
|
453
|
-
G !== z && (a.setItem(
|
|
452
|
+
const z = m.write(Q);
|
|
453
|
+
G !== z && (a.setItem(v.value, z), k(G, z));
|
|
454
454
|
}
|
|
455
455
|
} catch (G) {
|
|
456
456
|
l(G);
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
function V(Q) {
|
|
460
|
-
const G = Q ? Q.newValue : a.getItem(
|
|
460
|
+
const G = Q ? Q.newValue : a.getItem(v.value);
|
|
461
461
|
if (G == null)
|
|
462
|
-
return g && s != null && a.setItem(
|
|
462
|
+
return g && s != null && a.setItem(v.value, m.write(s)), s;
|
|
463
463
|
if (!Q && u) {
|
|
464
|
-
const z =
|
|
464
|
+
const z = m.read(G);
|
|
465
465
|
return typeof u == "function" ? u(z, s) : h === "object" && !Array.isArray(z) ? {
|
|
466
466
|
...s,
|
|
467
467
|
...z
|
|
468
468
|
} : z;
|
|
469
|
-
} else return typeof G != "string" ? G :
|
|
469
|
+
} else return typeof G != "string" ? G : m.read(G);
|
|
470
470
|
}
|
|
471
471
|
function O(Q) {
|
|
472
472
|
if (!(Q && Q.storageArea !== a)) {
|
|
@@ -474,10 +474,10 @@ function Lt(t, e, a, p = {}) {
|
|
|
474
474
|
A.value = s;
|
|
475
475
|
return;
|
|
476
476
|
}
|
|
477
|
-
if (!(Q && Q.key !==
|
|
477
|
+
if (!(Q && Q.key !== v.value)) {
|
|
478
478
|
b();
|
|
479
479
|
try {
|
|
480
|
-
const G =
|
|
480
|
+
const G = m.write(A.value);
|
|
481
481
|
(Q === void 0 || Q?.newValue !== G) && (A.value = V(Q));
|
|
482
482
|
} catch (G) {
|
|
483
483
|
l(G);
|
|
@@ -629,23 +629,26 @@ const Ti = { class: "kernelift-chat-sidebar" }, ki = { class: "kernelift-chat-si
|
|
|
629
629
|
}),
|
|
630
630
|
emits: /* @__PURE__ */ At(["send", "cancel"], ["update:modelValue", "update:enableThink", "update:enableNet"]),
|
|
631
631
|
setup(t, { emit: e }) {
|
|
632
|
-
Fa((
|
|
633
|
-
|
|
634
|
-
|
|
632
|
+
Fa((y) => ({
|
|
633
|
+
a5be4432: r.value,
|
|
634
|
+
v4cd2046c: g.value
|
|
635
635
|
}));
|
|
636
636
|
const a = t, p = parseFloat(getComputedStyle(document.documentElement).fontSize), S = gt(t, "modelValue"), C = gt(t, "enableThink"), c = gt(t, "enableNet"), r = _e(() => (a.inputHeight + 52) / p + "rem"), g = _e(() => a.inputHeight / p + "rem"), u = e;
|
|
637
637
|
function I() {
|
|
638
638
|
a.loading ? u("cancel") : u("send", S.value);
|
|
639
639
|
}
|
|
640
|
-
function D() {
|
|
641
|
-
|
|
640
|
+
function D(y) {
|
|
641
|
+
y.key === "Enter" && !y.shiftKey && (y.preventDefault(), !a.loading && S.value.trim() && u("send", S.value));
|
|
642
642
|
}
|
|
643
643
|
function E() {
|
|
644
|
+
C.value = !C.value;
|
|
645
|
+
}
|
|
646
|
+
function l() {
|
|
644
647
|
c.value = !c.value;
|
|
645
648
|
}
|
|
646
|
-
return (
|
|
649
|
+
return (y, A) => (he(), ye("div", Hi, [
|
|
647
650
|
ie("div", xi, [
|
|
648
|
-
ce(
|
|
651
|
+
ce(y.$slots, "textarea", {
|
|
649
652
|
height: t.inputHeight,
|
|
650
653
|
execute: I,
|
|
651
654
|
state: {
|
|
@@ -654,27 +657,28 @@ const Ti = { class: "kernelift-chat-sidebar" }, ki = { class: "kernelift-chat-si
|
|
|
654
657
|
}
|
|
655
658
|
}, () => [
|
|
656
659
|
at(ie("textarea", {
|
|
657
|
-
"onUpdate:modelValue":
|
|
660
|
+
"onUpdate:modelValue": A[0] || (A[0] = (v) => S.value = v),
|
|
658
661
|
rows: "5",
|
|
659
662
|
cols: "30",
|
|
660
663
|
style: { resize: "none" },
|
|
661
|
-
class: "kernelift-chat-sender__input"
|
|
662
|
-
|
|
664
|
+
class: "kernelift-chat-sender__input",
|
|
665
|
+
onKeydown: D
|
|
666
|
+
}, null, 544), [
|
|
663
667
|
[Pn, S.value]
|
|
664
668
|
])
|
|
665
669
|
], !0),
|
|
666
670
|
ie("div", zi, [
|
|
667
671
|
ie("div", Fi, [
|
|
668
|
-
ce(
|
|
672
|
+
ce(y.$slots, "think-button", {
|
|
669
673
|
state: { hasThinking: t.hasThinking, enableThink: C.value },
|
|
670
|
-
execute:
|
|
674
|
+
execute: E
|
|
671
675
|
}, () => [
|
|
672
676
|
t.hasThinking ? (he(), ye("button", {
|
|
673
677
|
key: 0,
|
|
674
678
|
class: $e(["kernelift-chat-sender__tool-btn", {
|
|
675
679
|
active: C.value
|
|
676
680
|
}]),
|
|
677
|
-
onClick:
|
|
681
|
+
onClick: E
|
|
678
682
|
}, [
|
|
679
683
|
at(ie("span", qi, null, 512), [
|
|
680
684
|
[ot, t.loading]
|
|
@@ -682,16 +686,16 @@ const Ti = { class: "kernelift-chat-sidebar" }, ki = { class: "kernelift-chat-si
|
|
|
682
686
|
Mt(" " + et(t.i18n?.chat?.button?.think ?? "深度思考"), 1)
|
|
683
687
|
], 2)) : Ze("", !0)
|
|
684
688
|
], !0),
|
|
685
|
-
ce(
|
|
689
|
+
ce(y.$slots, "net-button", {
|
|
686
690
|
state: { hasNetSearch: t.hasNetSearch, enableNet: c.value },
|
|
687
|
-
execute:
|
|
691
|
+
execute: l
|
|
688
692
|
}, () => [
|
|
689
693
|
t.hasNetSearch ? (he(), ye("button", {
|
|
690
694
|
key: 0,
|
|
691
695
|
class: $e(["kernelift-chat-sender__tool-btn", {
|
|
692
696
|
active: c.value
|
|
693
697
|
}]),
|
|
694
|
-
onClick:
|
|
698
|
+
onClick: l
|
|
695
699
|
}, [
|
|
696
700
|
at(ie("span", Yi, null, 512), [
|
|
697
701
|
[ot, t.loading]
|
|
@@ -699,12 +703,12 @@ const Ti = { class: "kernelift-chat-sidebar" }, ki = { class: "kernelift-chat-si
|
|
|
699
703
|
Mt(" " + et(t.i18n?.chat?.button?.net ?? "联网搜索"), 1)
|
|
700
704
|
], 2)) : Ze("", !0)
|
|
701
705
|
], !0),
|
|
702
|
-
ce(
|
|
706
|
+
ce(y.$slots, "tools", {
|
|
703
707
|
value: S.value,
|
|
704
708
|
loading: t.loading
|
|
705
709
|
}, void 0, !0)
|
|
706
710
|
]),
|
|
707
|
-
ce(
|
|
711
|
+
ce(y.$slots, "send-button", {
|
|
708
712
|
execute: I,
|
|
709
713
|
state: {
|
|
710
714
|
loading: t.loading,
|
|
@@ -729,7 +733,7 @@ const Ti = { class: "kernelift-chat-sidebar" }, ki = { class: "kernelift-chat-si
|
|
|
729
733
|
])
|
|
730
734
|
]));
|
|
731
735
|
}
|
|
732
|
-
}), _i = /* @__PURE__ */ kt(Wi, [["__scopeId", "data-v-
|
|
736
|
+
}), _i = /* @__PURE__ */ kt(Wi, [["__scopeId", "data-v-fbd61ff8"]]), $i = { class: "kernelift-chat-header" }, es = /* @__PURE__ */ Dt({
|
|
733
737
|
__name: "chat-header",
|
|
734
738
|
props: {
|
|
735
739
|
record: {}
|
|
@@ -924,7 +928,7 @@ function ve() {
|
|
|
924
928
|
}, window.addEventListener("message", i, !0);
|
|
925
929
|
}
|
|
926
930
|
if (typeof MutationObserver < "u") {
|
|
927
|
-
var
|
|
931
|
+
var m = Date.now(), b = !0, N = document.createElement("div"), h = [];
|
|
928
932
|
new MutationObserver(function() {
|
|
929
933
|
var n = h.slice();
|
|
930
934
|
h.length = 0, n.forEach(function(k) {
|
|
@@ -933,7 +937,7 @@ function ve() {
|
|
|
933
937
|
}).observe(N, { attributes: !0 });
|
|
934
938
|
var d = a.setImmediate;
|
|
935
939
|
a.setImmediate = function(n) {
|
|
936
|
-
Date.now() -
|
|
940
|
+
Date.now() - m > 15 ? (m = Date.now(), d(n)) : (h.push(n), h.length === 1 && N.setAttribute("a", b = !b));
|
|
937
941
|
};
|
|
938
942
|
}
|
|
939
943
|
a.nextTick = a.setImmediate;
|
|
@@ -962,8 +966,8 @@ function ve() {
|
|
|
962
966
|
try {
|
|
963
967
|
this.data = String.fromCharCode.apply(null, h);
|
|
964
968
|
} catch {
|
|
965
|
-
for (var
|
|
966
|
-
this.putByte(h[
|
|
969
|
+
for (var m = 0; m < h.length; ++m)
|
|
970
|
+
this.putByte(h[m]);
|
|
967
971
|
}
|
|
968
972
|
}
|
|
969
973
|
else (s instanceof S || typeof s == "object" && typeof s.data == "string" && typeof s.read == "number") && (this.data = s.data, this.read = s.read);
|
|
@@ -981,9 +985,9 @@ function ve() {
|
|
|
981
985
|
return this.putBytes(String.fromCharCode(s));
|
|
982
986
|
}, a.ByteStringBuffer.prototype.fillWithByte = function(s, h) {
|
|
983
987
|
s = String.fromCharCode(s);
|
|
984
|
-
for (var
|
|
985
|
-
h & 1 && (
|
|
986
|
-
return this.data =
|
|
988
|
+
for (var m = this.data; h > 0; )
|
|
989
|
+
h & 1 && (m += s), h >>>= 1, h > 0 && (s += s);
|
|
990
|
+
return this.data = m, this._optimizeConstructedString(h), this;
|
|
987
991
|
}, a.ByteStringBuffer.prototype.putBytes = function(s) {
|
|
988
992
|
return this.data += s, this._optimizeConstructedString(s.length), this;
|
|
989
993
|
}, a.ByteStringBuffer.prototype.putString = function(s) {
|
|
@@ -1014,11 +1018,11 @@ function ve() {
|
|
|
1014
1018
|
);
|
|
1015
1019
|
}, a.ByteStringBuffer.prototype.putInt = function(s, h) {
|
|
1016
1020
|
p(h);
|
|
1017
|
-
var
|
|
1021
|
+
var m = "";
|
|
1018
1022
|
do
|
|
1019
|
-
h -= 8,
|
|
1023
|
+
h -= 8, m += String.fromCharCode(s >> h & 255);
|
|
1020
1024
|
while (h > 0);
|
|
1021
|
-
return this.putBytes(
|
|
1025
|
+
return this.putBytes(m);
|
|
1022
1026
|
}, a.ByteStringBuffer.prototype.putSignedInt = function(s, h) {
|
|
1023
1027
|
return s < 0 && (s += 2 << h - 1), this.putInt(s, h);
|
|
1024
1028
|
}, a.ByteStringBuffer.prototype.putBuffer = function(s) {
|
|
@@ -1051,8 +1055,8 @@ function ve() {
|
|
|
1051
1055
|
while (s > 0);
|
|
1052
1056
|
return h;
|
|
1053
1057
|
}, a.ByteStringBuffer.prototype.getSignedInt = function(s) {
|
|
1054
|
-
var h = this.getInt(s),
|
|
1055
|
-
return h >=
|
|
1058
|
+
var h = this.getInt(s), m = 2 << s - 2;
|
|
1059
|
+
return h >= m && (h -= m << 1), h;
|
|
1056
1060
|
}, a.ByteStringBuffer.prototype.getBytes = function(s) {
|
|
1057
1061
|
var h;
|
|
1058
1062
|
return s ? (s = Math.min(this.length(), s), h = this.data.slice(this.read, this.read + s), this.read += s) : s === 0 ? h = "" : (h = this.read === 0 ? this.data : this.data.slice(this.read), this.clear()), h;
|
|
@@ -1076,8 +1080,8 @@ function ve() {
|
|
|
1076
1080
|
return this.data = this.data.substr(this.read, h), this.read = 0, this;
|
|
1077
1081
|
}, a.ByteStringBuffer.prototype.toHex = function() {
|
|
1078
1082
|
for (var s = "", h = this.read; h < this.data.length; ++h) {
|
|
1079
|
-
var
|
|
1080
|
-
|
|
1083
|
+
var m = this.data.charCodeAt(h);
|
|
1084
|
+
m < 16 && (s += "0"), s += m.toString(16);
|
|
1081
1085
|
}
|
|
1082
1086
|
return s;
|
|
1083
1087
|
}, a.ByteStringBuffer.prototype.toString = function() {
|
|
@@ -1085,9 +1089,9 @@ function ve() {
|
|
|
1085
1089
|
};
|
|
1086
1090
|
function c(s, h) {
|
|
1087
1091
|
h = h || {}, this.read = h.readOffset || 0, this.growSize = h.growSize || 1024;
|
|
1088
|
-
var
|
|
1089
|
-
if (
|
|
1090
|
-
|
|
1092
|
+
var m = a.isArrayBuffer(s), b = a.isArrayBufferView(s);
|
|
1093
|
+
if (m || b) {
|
|
1094
|
+
m ? this.data = new DataView(s) : this.data = new DataView(s.buffer, s.byteOffset, s.byteLength), this.write = "writeOffset" in h ? h.writeOffset : this.data.byteLength;
|
|
1091
1095
|
return;
|
|
1092
1096
|
}
|
|
1093
1097
|
this.data = new DataView(new ArrayBuffer(0)), this.write = 0, s != null && this.putBytes(s), "writeOffset" in h && (this.write = h.writeOffset);
|
|
@@ -1100,37 +1104,37 @@ function ve() {
|
|
|
1100
1104
|
if (this.length() >= s)
|
|
1101
1105
|
return this;
|
|
1102
1106
|
h = Math.max(h || this.growSize, s);
|
|
1103
|
-
var
|
|
1107
|
+
var m = new Uint8Array(
|
|
1104
1108
|
this.data.buffer,
|
|
1105
1109
|
this.data.byteOffset,
|
|
1106
1110
|
this.data.byteLength
|
|
1107
1111
|
), b = new Uint8Array(this.length() + h);
|
|
1108
|
-
return b.set(
|
|
1112
|
+
return b.set(m), this.data = new DataView(b.buffer), this;
|
|
1109
1113
|
}, a.DataBuffer.prototype.putByte = function(s) {
|
|
1110
1114
|
return this.accommodate(1), this.data.setUint8(this.write++, s), this;
|
|
1111
1115
|
}, a.DataBuffer.prototype.fillWithByte = function(s, h) {
|
|
1112
1116
|
this.accommodate(h);
|
|
1113
|
-
for (var
|
|
1117
|
+
for (var m = 0; m < h; ++m)
|
|
1114
1118
|
this.data.setUint8(s);
|
|
1115
1119
|
return this;
|
|
1116
1120
|
}, a.DataBuffer.prototype.putBytes = function(s, h) {
|
|
1117
1121
|
if (a.isArrayBufferView(s)) {
|
|
1118
|
-
var
|
|
1122
|
+
var m = new Uint8Array(s.buffer, s.byteOffset, s.byteLength), b = m.byteLength - m.byteOffset;
|
|
1119
1123
|
this.accommodate(b);
|
|
1120
1124
|
var N = new Uint8Array(this.data.buffer, this.write);
|
|
1121
|
-
return N.set(
|
|
1125
|
+
return N.set(m), this.write += b, this;
|
|
1122
1126
|
}
|
|
1123
1127
|
if (a.isArrayBuffer(s)) {
|
|
1124
|
-
var
|
|
1125
|
-
this.accommodate(
|
|
1128
|
+
var m = new Uint8Array(s);
|
|
1129
|
+
this.accommodate(m.byteLength);
|
|
1126
1130
|
var N = new Uint8Array(this.data.buffer);
|
|
1127
|
-
return N.set(
|
|
1131
|
+
return N.set(m, this.write), this.write += m.byteLength, this;
|
|
1128
1132
|
}
|
|
1129
1133
|
if (s instanceof a.DataBuffer || typeof s == "object" && typeof s.read == "number" && typeof s.write == "number" && a.isArrayBufferView(s.data)) {
|
|
1130
|
-
var
|
|
1131
|
-
this.accommodate(
|
|
1134
|
+
var m = new Uint8Array(s.data.byteLength, s.read, s.length());
|
|
1135
|
+
this.accommodate(m.byteLength);
|
|
1132
1136
|
var N = new Uint8Array(s.data.byteLength, this.write);
|
|
1133
|
-
return N.set(
|
|
1137
|
+
return N.set(m), this.write += m.byteLength, this;
|
|
1134
1138
|
}
|
|
1135
1139
|
if (s instanceof a.ByteStringBuffer && (s = s.data, h = "binary"), h = h || "binary", typeof s == "string") {
|
|
1136
1140
|
var d;
|
|
@@ -1197,8 +1201,8 @@ function ve() {
|
|
|
1197
1201
|
while (s > 0);
|
|
1198
1202
|
return h;
|
|
1199
1203
|
}, a.DataBuffer.prototype.getSignedInt = function(s) {
|
|
1200
|
-
var h = this.getInt(s),
|
|
1201
|
-
return h >=
|
|
1204
|
+
var h = this.getInt(s), m = 2 << s - 2;
|
|
1205
|
+
return h >= m && (h -= m << 1), h;
|
|
1202
1206
|
}, a.DataBuffer.prototype.getBytes = function(s) {
|
|
1203
1207
|
var h;
|
|
1204
1208
|
return s ? (s = Math.min(this.length(), s), h = this.data.slice(this.read, this.read + s), this.read += s) : s === 0 ? h = "" : (h = this.read === 0 ? this.data : this.data.slice(this.read), this.clear()), h;
|
|
@@ -1224,8 +1228,8 @@ function ve() {
|
|
|
1224
1228
|
return this.write = Math.max(0, this.length() - s), this.read = Math.min(this.read, this.write), this;
|
|
1225
1229
|
}, a.DataBuffer.prototype.toHex = function() {
|
|
1226
1230
|
for (var s = "", h = this.read; h < this.data.byteLength; ++h) {
|
|
1227
|
-
var
|
|
1228
|
-
|
|
1231
|
+
var m = this.data.getUint8(h);
|
|
1232
|
+
m < 16 && (s += "0"), s += m.toString(16);
|
|
1229
1233
|
}
|
|
1230
1234
|
return s;
|
|
1231
1235
|
}, a.DataBuffer.prototype.toString = function(s) {
|
|
@@ -1244,17 +1248,17 @@ function ve() {
|
|
|
1244
1248
|
}, a.createBuffer = function(s, h) {
|
|
1245
1249
|
return h = h || "raw", s !== void 0 && h === "utf8" && (s = a.encodeUtf8(s)), new a.ByteBuffer(s);
|
|
1246
1250
|
}, a.fillString = function(s, h) {
|
|
1247
|
-
for (var
|
|
1248
|
-
h & 1 && (
|
|
1249
|
-
return
|
|
1250
|
-
}, a.xorBytes = function(s, h,
|
|
1251
|
-
for (var b = "", N = "", d = "", i = 0, n = 0;
|
|
1251
|
+
for (var m = ""; h > 0; )
|
|
1252
|
+
h & 1 && (m += s), h >>>= 1, h > 0 && (s += s);
|
|
1253
|
+
return m;
|
|
1254
|
+
}, a.xorBytes = function(s, h, m) {
|
|
1255
|
+
for (var b = "", N = "", d = "", i = 0, n = 0; m > 0; --m, ++i)
|
|
1252
1256
|
N = s.charCodeAt(i) ^ h.charCodeAt(i), n >= 10 && (b += d, d = "", n = 0), d += String.fromCharCode(N), ++n;
|
|
1253
1257
|
return b += d, b;
|
|
1254
1258
|
}, a.hexToBytes = function(s) {
|
|
1255
|
-
var h = "",
|
|
1256
|
-
for (s.length & !0 && (
|
|
1257
|
-
h += String.fromCharCode(parseInt(s.substr(
|
|
1259
|
+
var h = "", m = 0;
|
|
1260
|
+
for (s.length & !0 && (m = 1, h += String.fromCharCode(parseInt(s[0], 16))); m < s.length; m += 2)
|
|
1261
|
+
h += String.fromCharCode(parseInt(s.substr(m, 2), 16));
|
|
1258
1262
|
return h;
|
|
1259
1263
|
}, a.bytesToHex = function(s) {
|
|
1260
1264
|
return a.createBuffer(s).toHex();
|
|
@@ -1356,14 +1360,14 @@ function ve() {
|
|
|
1356
1360
|
51
|
|
1357
1361
|
], u = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
1358
1362
|
a.encode64 = function(s, h) {
|
|
1359
|
-
for (var
|
|
1360
|
-
N = s.charCodeAt(n++), d = s.charCodeAt(n++), i = s.charCodeAt(n++),
|
|
1361
|
-
`,
|
|
1362
|
-
return b +=
|
|
1363
|
+
for (var m = "", b = "", N, d, i, n = 0; n < s.length; )
|
|
1364
|
+
N = s.charCodeAt(n++), d = s.charCodeAt(n++), i = s.charCodeAt(n++), m += r.charAt(N >> 2), m += r.charAt((N & 3) << 4 | d >> 4), isNaN(d) ? m += "==" : (m += r.charAt((d & 15) << 2 | i >> 6), m += isNaN(i) ? "=" : r.charAt(i & 63)), h && m.length > h && (b += m.substr(0, h) + `\r
|
|
1365
|
+
`, m = m.substr(h));
|
|
1366
|
+
return b += m, b;
|
|
1363
1367
|
}, a.decode64 = function(s) {
|
|
1364
1368
|
s = s.replace(/[^A-Za-z0-9\+\/\=]/g, "");
|
|
1365
|
-
for (var h = "",
|
|
1366
|
-
|
|
1369
|
+
for (var h = "", m, b, N, d, i = 0; i < s.length; )
|
|
1370
|
+
m = g[s.charCodeAt(i++) - 43], b = g[s.charCodeAt(i++) - 43], N = g[s.charCodeAt(i++) - 43], d = g[s.charCodeAt(i++) - 43], h += String.fromCharCode(m << 2 | b >> 4), N !== 64 && (h += String.fromCharCode((b & 15) << 4 | N >> 2), d !== 64 && (h += String.fromCharCode((N & 3) << 6 | d)));
|
|
1367
1371
|
return h;
|
|
1368
1372
|
}, a.encodeUtf8 = function(s) {
|
|
1369
1373
|
return unescape(encodeURIComponent(s));
|
|
@@ -1380,30 +1384,30 @@ function ve() {
|
|
|
1380
1384
|
}
|
|
1381
1385
|
}, a.binary.raw.encode = function(s) {
|
|
1382
1386
|
return String.fromCharCode.apply(null, s);
|
|
1383
|
-
}, a.binary.raw.decode = function(s, h,
|
|
1387
|
+
}, a.binary.raw.decode = function(s, h, m) {
|
|
1384
1388
|
var b = h;
|
|
1385
|
-
b || (b = new Uint8Array(s.length)),
|
|
1386
|
-
for (var N =
|
|
1389
|
+
b || (b = new Uint8Array(s.length)), m = m || 0;
|
|
1390
|
+
for (var N = m, d = 0; d < s.length; ++d)
|
|
1387
1391
|
b[N++] = s.charCodeAt(d);
|
|
1388
|
-
return h ? N -
|
|
1389
|
-
}, a.binary.hex.encode = a.bytesToHex, a.binary.hex.decode = function(s, h,
|
|
1392
|
+
return h ? N - m : b;
|
|
1393
|
+
}, a.binary.hex.encode = a.bytesToHex, a.binary.hex.decode = function(s, h, m) {
|
|
1390
1394
|
var b = h;
|
|
1391
|
-
b || (b = new Uint8Array(Math.ceil(s.length / 2))),
|
|
1392
|
-
var N = 0, d =
|
|
1395
|
+
b || (b = new Uint8Array(Math.ceil(s.length / 2))), m = m || 0;
|
|
1396
|
+
var N = 0, d = m;
|
|
1393
1397
|
for (s.length & 1 && (N = 1, b[d++] = parseInt(s[0], 16)); N < s.length; N += 2)
|
|
1394
1398
|
b[d++] = parseInt(s.substr(N, 2), 16);
|
|
1395
|
-
return h ? d -
|
|
1399
|
+
return h ? d - m : b;
|
|
1396
1400
|
}, a.binary.base64.encode = function(s, h) {
|
|
1397
|
-
for (var
|
|
1398
|
-
N = s[n++], d = s[n++], i = s[n++],
|
|
1399
|
-
`,
|
|
1400
|
-
return b +=
|
|
1401
|
-
}, a.binary.base64.decode = function(s, h,
|
|
1401
|
+
for (var m = "", b = "", N, d, i, n = 0; n < s.byteLength; )
|
|
1402
|
+
N = s[n++], d = s[n++], i = s[n++], m += r.charAt(N >> 2), m += r.charAt((N & 3) << 4 | d >> 4), isNaN(d) ? m += "==" : (m += r.charAt((d & 15) << 2 | i >> 6), m += isNaN(i) ? "=" : r.charAt(i & 63)), h && m.length > h && (b += m.substr(0, h) + `\r
|
|
1403
|
+
`, m = m.substr(h));
|
|
1404
|
+
return b += m, b;
|
|
1405
|
+
}, a.binary.base64.decode = function(s, h, m) {
|
|
1402
1406
|
var b = h;
|
|
1403
|
-
b || (b = new Uint8Array(Math.ceil(s.length / 4) * 3)), s = s.replace(/[^A-Za-z0-9\+\/\=]/g, ""),
|
|
1404
|
-
for (var N, d, i, n, k = 0, P =
|
|
1407
|
+
b || (b = new Uint8Array(Math.ceil(s.length / 4) * 3)), s = s.replace(/[^A-Za-z0-9\+\/\=]/g, ""), m = m || 0;
|
|
1408
|
+
for (var N, d, i, n, k = 0, P = m; k < s.length; )
|
|
1405
1409
|
N = g[s.charCodeAt(k++) - 43], d = g[s.charCodeAt(k++) - 43], i = g[s.charCodeAt(k++) - 43], n = g[s.charCodeAt(k++) - 43], b[P++] = N << 2 | d >> 4, i !== 64 && (b[P++] = (d & 15) << 4 | i >> 2, n !== 64 && (b[P++] = (i & 3) << 6 | n));
|
|
1406
|
-
return h ? P -
|
|
1410
|
+
return h ? P - m : b.subarray(0, P);
|
|
1407
1411
|
}, a.binary.base58.encode = function(s, h) {
|
|
1408
1412
|
return a.binary.baseN.encode(s, u, h);
|
|
1409
1413
|
}, a.binary.base58.decode = function(s, h) {
|
|
@@ -1411,67 +1415,67 @@ function ve() {
|
|
|
1411
1415
|
}, a.text = {
|
|
1412
1416
|
utf8: {},
|
|
1413
1417
|
utf16: {}
|
|
1414
|
-
}, a.text.utf8.encode = function(s, h,
|
|
1418
|
+
}, a.text.utf8.encode = function(s, h, m) {
|
|
1415
1419
|
s = a.encodeUtf8(s);
|
|
1416
1420
|
var b = h;
|
|
1417
|
-
b || (b = new Uint8Array(s.length)),
|
|
1418
|
-
for (var N =
|
|
1421
|
+
b || (b = new Uint8Array(s.length)), m = m || 0;
|
|
1422
|
+
for (var N = m, d = 0; d < s.length; ++d)
|
|
1419
1423
|
b[N++] = s.charCodeAt(d);
|
|
1420
|
-
return h ? N -
|
|
1424
|
+
return h ? N - m : b;
|
|
1421
1425
|
}, a.text.utf8.decode = function(s) {
|
|
1422
1426
|
return a.decodeUtf8(String.fromCharCode.apply(null, s));
|
|
1423
|
-
}, a.text.utf16.encode = function(s, h,
|
|
1427
|
+
}, a.text.utf16.encode = function(s, h, m) {
|
|
1424
1428
|
var b = h;
|
|
1425
1429
|
b || (b = new Uint8Array(s.length * 2));
|
|
1426
1430
|
var N = new Uint16Array(b.buffer);
|
|
1427
|
-
|
|
1428
|
-
for (var d =
|
|
1431
|
+
m = m || 0;
|
|
1432
|
+
for (var d = m, i = m, n = 0; n < s.length; ++n)
|
|
1429
1433
|
N[i++] = s.charCodeAt(n), d += 2;
|
|
1430
|
-
return h ? d -
|
|
1434
|
+
return h ? d - m : b;
|
|
1431
1435
|
}, a.text.utf16.decode = function(s) {
|
|
1432
1436
|
return String.fromCharCode.apply(null, new Uint16Array(s.buffer));
|
|
1433
|
-
}, a.deflate = function(s, h,
|
|
1434
|
-
if (h = a.decode64(s.deflate(a.encode64(h)).rval),
|
|
1437
|
+
}, a.deflate = function(s, h, m) {
|
|
1438
|
+
if (h = a.decode64(s.deflate(a.encode64(h)).rval), m) {
|
|
1435
1439
|
var b = 2, N = h.charCodeAt(1);
|
|
1436
1440
|
N & 32 && (b = 6), h = h.substring(b, h.length - 4);
|
|
1437
1441
|
}
|
|
1438
1442
|
return h;
|
|
1439
|
-
}, a.inflate = function(s, h,
|
|
1443
|
+
}, a.inflate = function(s, h, m) {
|
|
1440
1444
|
var b = s.inflate(a.encode64(h)).rval;
|
|
1441
1445
|
return b === null ? null : a.decode64(b);
|
|
1442
1446
|
};
|
|
1443
|
-
var I = function(s, h,
|
|
1447
|
+
var I = function(s, h, m) {
|
|
1444
1448
|
if (!s)
|
|
1445
1449
|
throw new Error("WebStorage not available.");
|
|
1446
1450
|
var b;
|
|
1447
|
-
if (
|
|
1451
|
+
if (m === null ? b = s.removeItem(h) : (m = a.encode64(JSON.stringify(m)), b = s.setItem(h, m)), typeof b < "u" && b.rval !== !0) {
|
|
1448
1452
|
var N = new Error(b.error.message);
|
|
1449
1453
|
throw N.id = b.error.id, N.name = b.error.name, N;
|
|
1450
1454
|
}
|
|
1451
1455
|
}, D = function(s, h) {
|
|
1452
1456
|
if (!s)
|
|
1453
1457
|
throw new Error("WebStorage not available.");
|
|
1454
|
-
var
|
|
1458
|
+
var m = s.getItem(h);
|
|
1455
1459
|
if (s.init)
|
|
1456
|
-
if (
|
|
1457
|
-
if (
|
|
1458
|
-
var b = new Error(
|
|
1459
|
-
throw b.id =
|
|
1460
|
+
if (m.rval === null) {
|
|
1461
|
+
if (m.error) {
|
|
1462
|
+
var b = new Error(m.error.message);
|
|
1463
|
+
throw b.id = m.error.id, b.name = m.error.name, b;
|
|
1460
1464
|
}
|
|
1461
|
-
|
|
1465
|
+
m = null;
|
|
1462
1466
|
} else
|
|
1463
|
-
|
|
1464
|
-
return
|
|
1465
|
-
}, E = function(s, h,
|
|
1467
|
+
m = m.rval;
|
|
1468
|
+
return m !== null && (m = JSON.parse(a.decode64(m))), m;
|
|
1469
|
+
}, E = function(s, h, m, b) {
|
|
1466
1470
|
var N = D(s, h);
|
|
1467
|
-
N === null && (N = {}), N[
|
|
1468
|
-
}, l = function(s, h,
|
|
1471
|
+
N === null && (N = {}), N[m] = b, I(s, h, N);
|
|
1472
|
+
}, l = function(s, h, m) {
|
|
1469
1473
|
var b = D(s, h);
|
|
1470
|
-
return b !== null && (b =
|
|
1471
|
-
},
|
|
1474
|
+
return b !== null && (b = m in b ? b[m] : null), b;
|
|
1475
|
+
}, y = function(s, h, m) {
|
|
1472
1476
|
var b = D(s, h);
|
|
1473
|
-
if (b !== null &&
|
|
1474
|
-
delete b[
|
|
1477
|
+
if (b !== null && m in b) {
|
|
1478
|
+
delete b[m];
|
|
1475
1479
|
var N = !0;
|
|
1476
1480
|
for (var d in b) {
|
|
1477
1481
|
N = !1;
|
|
@@ -1481,12 +1485,12 @@ function ve() {
|
|
|
1481
1485
|
}
|
|
1482
1486
|
}, A = function(s, h) {
|
|
1483
1487
|
I(s, h, null);
|
|
1484
|
-
},
|
|
1488
|
+
}, v = function(s, h, m) {
|
|
1485
1489
|
var b = null;
|
|
1486
|
-
typeof
|
|
1490
|
+
typeof m > "u" && (m = ["web", "flash"]);
|
|
1487
1491
|
var N, d = !1, i = null;
|
|
1488
|
-
for (var n in
|
|
1489
|
-
N =
|
|
1492
|
+
for (var n in m) {
|
|
1493
|
+
N = m[n];
|
|
1490
1494
|
try {
|
|
1491
1495
|
if (N === "flash" || N === "both") {
|
|
1492
1496
|
if (h[0] === null)
|
|
@@ -1504,23 +1508,23 @@ function ve() {
|
|
|
1504
1508
|
throw i;
|
|
1505
1509
|
return b;
|
|
1506
1510
|
};
|
|
1507
|
-
return a.setItem = function(s, h,
|
|
1508
|
-
|
|
1509
|
-
}, a.getItem = function(s, h,
|
|
1510
|
-
return
|
|
1511
|
-
}, a.removeItem = function(s, h,
|
|
1512
|
-
|
|
1513
|
-
}, a.clearItems = function(s, h,
|
|
1514
|
-
|
|
1511
|
+
return a.setItem = function(s, h, m, b, N) {
|
|
1512
|
+
v(E, arguments, N);
|
|
1513
|
+
}, a.getItem = function(s, h, m, b) {
|
|
1514
|
+
return v(l, arguments, b);
|
|
1515
|
+
}, a.removeItem = function(s, h, m, b) {
|
|
1516
|
+
v(y, arguments, b);
|
|
1517
|
+
}, a.clearItems = function(s, h, m) {
|
|
1518
|
+
v(A, arguments, m);
|
|
1515
1519
|
}, a.isEmpty = function(s) {
|
|
1516
1520
|
for (var h in s)
|
|
1517
1521
|
if (s.hasOwnProperty(h))
|
|
1518
1522
|
return !1;
|
|
1519
1523
|
return !0;
|
|
1520
1524
|
}, a.format = function(s) {
|
|
1521
|
-
for (var h = /%./g,
|
|
1525
|
+
for (var h = /%./g, m, b, N = 0, d = [], i = 0; m = h.exec(s); ) {
|
|
1522
1526
|
b = s.substring(i, h.lastIndex - 2), b.length > 0 && d.push(b), i = h.lastIndex;
|
|
1523
|
-
var n =
|
|
1527
|
+
var n = m[0][1];
|
|
1524
1528
|
switch (n) {
|
|
1525
1529
|
case "s":
|
|
1526
1530
|
case "o":
|
|
@@ -1537,8 +1541,8 @@ function ve() {
|
|
|
1537
1541
|
}
|
|
1538
1542
|
}
|
|
1539
1543
|
return d.push(s.substring(i)), d.join("");
|
|
1540
|
-
}, a.formatNumber = function(s, h,
|
|
1541
|
-
var N = s, d = isNaN(h = Math.abs(h)) ? 2 : h, i =
|
|
1544
|
+
}, a.formatNumber = function(s, h, m, b) {
|
|
1545
|
+
var N = s, d = isNaN(h = Math.abs(h)) ? 2 : h, i = m === void 0 ? "," : m, n = b === void 0 ? "." : b, k = N < 0 ? "-" : "", P = parseInt(N = Math.abs(+N || 0).toFixed(d), 10) + "", V = P.length > 3 ? P.length % 3 : 0;
|
|
1542
1546
|
return k + (V ? P.substr(0, V) + n : "") + P.substr(V).replace(/(\d{3})(?=\d)/g, "$1" + n) + (d ? i + Math.abs(N - P).toFixed(d).slice(2) : "");
|
|
1543
1547
|
}, a.formatSize = function(s) {
|
|
1544
1548
|
return s >= 1073741824 ? s = a.formatNumber(s / 1073741824, 2, ".", "") + " GiB" : s >= 1048576 ? s = a.formatNumber(s / 1048576, 2, ".", "") + " MiB" : s >= 1024 ? s = a.formatNumber(s / 1024, 0) + " KiB" : s = a.formatNumber(s, 0) + " bytes", s;
|
|
@@ -1547,8 +1551,8 @@ function ve() {
|
|
|
1547
1551
|
}, a.bytesFromIPv4 = function(s) {
|
|
1548
1552
|
if (s = s.split("."), s.length !== 4)
|
|
1549
1553
|
return null;
|
|
1550
|
-
for (var h = a.createBuffer(),
|
|
1551
|
-
var b = parseInt(s[
|
|
1554
|
+
for (var h = a.createBuffer(), m = 0; m < s.length; ++m) {
|
|
1555
|
+
var b = parseInt(s[m], 10);
|
|
1552
1556
|
if (isNaN(b))
|
|
1553
1557
|
return null;
|
|
1554
1558
|
h.putByte(b);
|
|
@@ -1559,9 +1563,9 @@ function ve() {
|
|
|
1559
1563
|
s = s.split(":").filter(function(i) {
|
|
1560
1564
|
return i.length === 0 && ++h, !0;
|
|
1561
1565
|
});
|
|
1562
|
-
for (var
|
|
1566
|
+
for (var m = (8 - s.length + h) * 2, b = a.createBuffer(), N = 0; N < 8; ++N) {
|
|
1563
1567
|
if (!s[N] || s[N].length === 0) {
|
|
1564
|
-
b.fillWithByte(0,
|
|
1568
|
+
b.fillWithByte(0, m), m = 0;
|
|
1565
1569
|
continue;
|
|
1566
1570
|
}
|
|
1567
1571
|
var d = a.hexToBytes(s[N]);
|
|
@@ -1573,23 +1577,23 @@ function ve() {
|
|
|
1573
1577
|
}, a.bytesToIPv4 = function(s) {
|
|
1574
1578
|
if (s.length !== 4)
|
|
1575
1579
|
return null;
|
|
1576
|
-
for (var h = [],
|
|
1577
|
-
h.push(s.charCodeAt(
|
|
1580
|
+
for (var h = [], m = 0; m < s.length; ++m)
|
|
1581
|
+
h.push(s.charCodeAt(m));
|
|
1578
1582
|
return h.join(".");
|
|
1579
1583
|
}, a.bytesToIPv6 = function(s) {
|
|
1580
1584
|
if (s.length !== 16)
|
|
1581
1585
|
return null;
|
|
1582
|
-
for (var h = [],
|
|
1586
|
+
for (var h = [], m = [], b = 0, N = 0; N < s.length; N += 2) {
|
|
1583
1587
|
for (var d = a.bytesToHex(s[N] + s[N + 1]); d[0] === "0" && d !== "0"; )
|
|
1584
1588
|
d = d.substr(1);
|
|
1585
1589
|
if (d === "0") {
|
|
1586
|
-
var i =
|
|
1587
|
-
!i || n !== i.end + 1 ?
|
|
1590
|
+
var i = m[m.length - 1], n = h.length;
|
|
1591
|
+
!i || n !== i.end + 1 ? m.push({ start: n, end: n }) : (i.end = n, i.end - i.start > m[b].end - m[b].start && (b = m.length - 1));
|
|
1588
1592
|
}
|
|
1589
1593
|
h.push(d);
|
|
1590
1594
|
}
|
|
1591
|
-
if (
|
|
1592
|
-
var k =
|
|
1595
|
+
if (m.length > 0) {
|
|
1596
|
+
var k = m[b];
|
|
1593
1597
|
k.end - k.start > 0 && (h.splice(k.start, k.end - k.start + 1, ""), k.start === 0 && h.unshift(""), k.end === 7 && h.push(""));
|
|
1594
1598
|
}
|
|
1595
1599
|
return h.join(":");
|
|
@@ -1602,7 +1606,7 @@ function ve() {
|
|
|
1602
1606
|
return a.cores = 1, h(null, a.cores);
|
|
1603
1607
|
if (typeof Blob > "u")
|
|
1604
1608
|
return a.cores = 2, h(null, a.cores);
|
|
1605
|
-
var
|
|
1609
|
+
var m = URL.createObjectURL(new Blob([
|
|
1606
1610
|
"(",
|
|
1607
1611
|
(function() {
|
|
1608
1612
|
self.addEventListener("message", function(i) {
|
|
@@ -1618,7 +1622,7 @@ function ve() {
|
|
|
1618
1622
|
var P = Math.floor(i.reduce(function(V, O) {
|
|
1619
1623
|
return V + O;
|
|
1620
1624
|
}, 0) / i.length);
|
|
1621
|
-
return a.cores = Math.max(1, P), URL.revokeObjectURL(
|
|
1625
|
+
return a.cores = Math.max(1, P), URL.revokeObjectURL(m), h(null, a.cores);
|
|
1622
1626
|
}
|
|
1623
1627
|
N(k, function(V, O) {
|
|
1624
1628
|
i.push(d(k, O)), b(i, n - 1, k);
|
|
@@ -1626,7 +1630,7 @@ function ve() {
|
|
|
1626
1630
|
}
|
|
1627
1631
|
function N(i, n) {
|
|
1628
1632
|
for (var k = [], P = [], V = 0; V < i; ++V) {
|
|
1629
|
-
var O = new Worker(
|
|
1633
|
+
var O = new Worker(m);
|
|
1630
1634
|
O.addEventListener("message", function(M) {
|
|
1631
1635
|
if (P.push(M.data), P.length === i) {
|
|
1632
1636
|
for (var Q = 0; Q < i; ++Q)
|
|
@@ -1993,8 +1997,8 @@ function Za() {
|
|
|
1993
1997
|
return c[0] ^= r[0], c[1] ^= r[1], c[2] ^= r[2], c[3] ^= r[3], this.tableMultiply(c);
|
|
1994
1998
|
}, e.gcm.prototype.generateHashTable = function(C, c) {
|
|
1995
1999
|
for (var r = 8 / c, g = 4 * r, u = 16 * r, I = new Array(u), D = 0; D < u; ++D) {
|
|
1996
|
-
var E = [0, 0, 0, 0], l = D / g | 0,
|
|
1997
|
-
E[l] = 1 << c - 1 <<
|
|
2000
|
+
var E = [0, 0, 0, 0], l = D / g | 0, y = (g - 1 - D % g) * c;
|
|
2001
|
+
E[l] = 1 << c - 1 << y, I[D] = this.generateSubHashTable(this.multiply(E, C), c);
|
|
1998
2002
|
}
|
|
1999
2003
|
return I;
|
|
2000
2004
|
}, e.gcm.prototype.generateSubHashTable = function(C, c) {
|
|
@@ -2015,8 +2019,8 @@ function Za() {
|
|
|
2015
2019
|
I *= 2;
|
|
2016
2020
|
}
|
|
2017
2021
|
for (u[0] = [0, 0, 0, 0], I = g + 1; I < r; ++I) {
|
|
2018
|
-
var
|
|
2019
|
-
u[I] = [C[0] ^
|
|
2022
|
+
var y = u[I ^ g];
|
|
2023
|
+
u[I] = [C[0] ^ y[0], C[1] ^ y[1], C[2] ^ y[2], C[3] ^ y[3]];
|
|
2020
2024
|
}
|
|
2021
2025
|
return u;
|
|
2022
2026
|
};
|
|
@@ -2051,108 +2055,108 @@ function Rt() {
|
|
|
2051
2055
|
if (na) return sr;
|
|
2052
2056
|
na = 1;
|
|
2053
2057
|
var t = pe();
|
|
2054
|
-
Hr(), Za(), ve(), sr = t.aes = t.aes || {}, t.aes.startEncrypting = function(l,
|
|
2058
|
+
Hr(), Za(), ve(), sr = t.aes = t.aes || {}, t.aes.startEncrypting = function(l, y, A, v) {
|
|
2055
2059
|
var s = E({
|
|
2056
2060
|
key: l,
|
|
2057
2061
|
output: A,
|
|
2058
2062
|
decrypt: !1,
|
|
2059
|
-
mode:
|
|
2063
|
+
mode: v
|
|
2060
2064
|
});
|
|
2061
|
-
return s.start(
|
|
2062
|
-
}, t.aes.createEncryptionCipher = function(l,
|
|
2065
|
+
return s.start(y), s;
|
|
2066
|
+
}, t.aes.createEncryptionCipher = function(l, y) {
|
|
2063
2067
|
return E({
|
|
2064
2068
|
key: l,
|
|
2065
2069
|
output: null,
|
|
2066
2070
|
decrypt: !1,
|
|
2067
|
-
mode:
|
|
2071
|
+
mode: y
|
|
2068
2072
|
});
|
|
2069
|
-
}, t.aes.startDecrypting = function(l,
|
|
2073
|
+
}, t.aes.startDecrypting = function(l, y, A, v) {
|
|
2070
2074
|
var s = E({
|
|
2071
2075
|
key: l,
|
|
2072
2076
|
output: A,
|
|
2073
2077
|
decrypt: !0,
|
|
2074
|
-
mode:
|
|
2078
|
+
mode: v
|
|
2075
2079
|
});
|
|
2076
|
-
return s.start(
|
|
2077
|
-
}, t.aes.createDecryptionCipher = function(l,
|
|
2080
|
+
return s.start(y), s;
|
|
2081
|
+
}, t.aes.createDecryptionCipher = function(l, y) {
|
|
2078
2082
|
return E({
|
|
2079
2083
|
key: l,
|
|
2080
2084
|
output: null,
|
|
2081
2085
|
decrypt: !0,
|
|
2082
|
-
mode:
|
|
2086
|
+
mode: y
|
|
2083
2087
|
});
|
|
2084
|
-
}, t.aes.Algorithm = function(l,
|
|
2088
|
+
}, t.aes.Algorithm = function(l, y) {
|
|
2085
2089
|
a || u();
|
|
2086
2090
|
var A = this;
|
|
2087
|
-
A.name = l, A.mode = new
|
|
2091
|
+
A.name = l, A.mode = new y({
|
|
2088
2092
|
blockSize: 16,
|
|
2089
2093
|
cipher: {
|
|
2090
|
-
encrypt: function(
|
|
2091
|
-
return D(A._w,
|
|
2094
|
+
encrypt: function(v, s) {
|
|
2095
|
+
return D(A._w, v, s, !1);
|
|
2092
2096
|
},
|
|
2093
|
-
decrypt: function(
|
|
2094
|
-
return D(A._w,
|
|
2097
|
+
decrypt: function(v, s) {
|
|
2098
|
+
return D(A._w, v, s, !0);
|
|
2095
2099
|
}
|
|
2096
2100
|
}
|
|
2097
2101
|
}), A._init = !1;
|
|
2098
2102
|
}, t.aes.Algorithm.prototype.initialize = function(l) {
|
|
2099
2103
|
if (!this._init) {
|
|
2100
|
-
var
|
|
2101
|
-
if (typeof
|
|
2102
|
-
|
|
2103
|
-
else if (t.util.isArray(
|
|
2104
|
-
A =
|
|
2105
|
-
for (var
|
|
2106
|
-
|
|
2107
|
-
}
|
|
2108
|
-
if (!t.util.isArray(
|
|
2109
|
-
A =
|
|
2104
|
+
var y = l.key, A;
|
|
2105
|
+
if (typeof y == "string" && (y.length === 16 || y.length === 24 || y.length === 32))
|
|
2106
|
+
y = t.util.createBuffer(y);
|
|
2107
|
+
else if (t.util.isArray(y) && (y.length === 16 || y.length === 24 || y.length === 32)) {
|
|
2108
|
+
A = y, y = t.util.createBuffer();
|
|
2109
|
+
for (var v = 0; v < A.length; ++v)
|
|
2110
|
+
y.putByte(A[v]);
|
|
2111
|
+
}
|
|
2112
|
+
if (!t.util.isArray(y)) {
|
|
2113
|
+
A = y, y = [];
|
|
2110
2114
|
var s = A.length();
|
|
2111
2115
|
if (s === 16 || s === 24 || s === 32) {
|
|
2112
2116
|
s = s >>> 2;
|
|
2113
|
-
for (var
|
|
2114
|
-
|
|
2117
|
+
for (var v = 0; v < s; ++v)
|
|
2118
|
+
y.push(A.getInt32());
|
|
2115
2119
|
}
|
|
2116
2120
|
}
|
|
2117
|
-
if (!t.util.isArray(
|
|
2121
|
+
if (!t.util.isArray(y) || !(y.length === 4 || y.length === 6 || y.length === 8))
|
|
2118
2122
|
throw new Error("Invalid key parameter.");
|
|
2119
|
-
var h = this.mode.name,
|
|
2120
|
-
this._w = I(
|
|
2123
|
+
var h = this.mode.name, m = ["CFB", "OFB", "CTR", "GCM"].indexOf(h) !== -1;
|
|
2124
|
+
this._w = I(y, l.decrypt && !m), this._init = !0;
|
|
2121
2125
|
}
|
|
2122
|
-
}, t.aes._expandKey = function(l,
|
|
2123
|
-
return a || u(), I(l,
|
|
2126
|
+
}, t.aes._expandKey = function(l, y) {
|
|
2127
|
+
return a || u(), I(l, y);
|
|
2124
2128
|
}, t.aes._updateBlock = D, e("AES-ECB", t.cipher.modes.ecb), e("AES-CBC", t.cipher.modes.cbc), e("AES-CFB", t.cipher.modes.cfb), e("AES-OFB", t.cipher.modes.ofb), e("AES-CTR", t.cipher.modes.ctr), e("AES-GCM", t.cipher.modes.gcm);
|
|
2125
|
-
function e(l,
|
|
2129
|
+
function e(l, y) {
|
|
2126
2130
|
var A = function() {
|
|
2127
|
-
return new t.aes.Algorithm(l,
|
|
2131
|
+
return new t.aes.Algorithm(l, y);
|
|
2128
2132
|
};
|
|
2129
2133
|
t.cipher.registerAlgorithm(l, A);
|
|
2130
2134
|
}
|
|
2131
2135
|
var a = !1, p = 4, S, C, c, r, g;
|
|
2132
2136
|
function u() {
|
|
2133
2137
|
a = !0, c = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54];
|
|
2134
|
-
for (var l = new Array(256),
|
|
2135
|
-
l[
|
|
2138
|
+
for (var l = new Array(256), y = 0; y < 128; ++y)
|
|
2139
|
+
l[y] = y << 1, l[y + 128] = y + 128 << 1 ^ 283;
|
|
2136
2140
|
S = new Array(256), C = new Array(256), r = new Array(4), g = new Array(4);
|
|
2137
|
-
for (var
|
|
2138
|
-
r[
|
|
2139
|
-
for (var A = 0,
|
|
2140
|
-
b =
|
|
2141
|
+
for (var y = 0; y < 4; ++y)
|
|
2142
|
+
r[y] = new Array(256), g[y] = new Array(256);
|
|
2143
|
+
for (var A = 0, v = 0, s, h, m, b, N, d, i, y = 0; y < 256; ++y) {
|
|
2144
|
+
b = v ^ v << 1 ^ v << 2 ^ v << 3 ^ v << 4, b = b >> 8 ^ b & 255 ^ 99, S[A] = b, C[b] = A, N = l[b], s = l[A], h = l[s], m = l[h], d = N << 24 ^ // 2
|
|
2141
2145
|
b << 16 ^ // 1
|
|
2142
2146
|
b << 8 ^ // 1
|
|
2143
|
-
(b ^ N), i = (s ^ h ^
|
|
2144
|
-
(A ^
|
|
2145
|
-
(A ^ h ^
|
|
2146
|
-
(A ^ s ^
|
|
2147
|
+
(b ^ N), i = (s ^ h ^ m) << 24 ^ // E (14)
|
|
2148
|
+
(A ^ m) << 16 ^ // 9
|
|
2149
|
+
(A ^ h ^ m) << 8 ^ // D (13)
|
|
2150
|
+
(A ^ s ^ m);
|
|
2147
2151
|
for (var n = 0; n < 4; ++n)
|
|
2148
2152
|
r[n][A] = d, g[n][b] = i, d = d << 24 | d >>> 8, i = i << 24 | i >>> 8;
|
|
2149
|
-
A === 0 ? A =
|
|
2153
|
+
A === 0 ? A = v = 1 : (A = s ^ l[l[l[s ^ m]]], v ^= l[l[v]]);
|
|
2150
2154
|
}
|
|
2151
2155
|
}
|
|
2152
|
-
function I(l,
|
|
2153
|
-
for (var A = l.slice(0),
|
|
2154
|
-
|
|
2155
|
-
if (
|
|
2156
|
+
function I(l, y) {
|
|
2157
|
+
for (var A = l.slice(0), v, s = 1, h = A.length, m = h + 6 + 1, b = p * m, N = h; N < b; ++N)
|
|
2158
|
+
v = A[N - 1], N % h === 0 ? (v = S[v >>> 16 & 255] << 24 ^ S[v >>> 8 & 255] << 16 ^ S[v & 255] << 8 ^ S[v >>> 24] ^ c[s] << 24, s++) : h > 6 && N % h === 4 && (v = S[v >>> 24] << 24 ^ S[v >>> 16 & 255] << 16 ^ S[v >>> 8 & 255] << 8 ^ S[v & 255]), A[N] = A[N - h] ^ v;
|
|
2159
|
+
if (y) {
|
|
2156
2160
|
var d, i = g[0], n = g[1], k = g[2], P = g[3], V = A.slice(0);
|
|
2157
2161
|
b = A.length;
|
|
2158
2162
|
for (var N = 0, O = b - p; N < b; N += p, O -= p)
|
|
@@ -2165,24 +2169,24 @@ function Rt() {
|
|
|
2165
2169
|
}
|
|
2166
2170
|
return A;
|
|
2167
2171
|
}
|
|
2168
|
-
function D(l,
|
|
2169
|
-
var s = l.length / 4 - 1, h,
|
|
2170
|
-
|
|
2172
|
+
function D(l, y, A, v) {
|
|
2173
|
+
var s = l.length / 4 - 1, h, m, b, N, d;
|
|
2174
|
+
v ? (h = g[0], m = g[1], b = g[2], N = g[3], d = C) : (h = r[0], m = r[1], b = r[2], N = r[3], d = S);
|
|
2171
2175
|
var i, n, k, P, V, O, M;
|
|
2172
|
-
i =
|
|
2176
|
+
i = y[0] ^ l[0], n = y[v ? 3 : 1] ^ l[1], k = y[2] ^ l[2], P = y[v ? 1 : 3] ^ l[3];
|
|
2173
2177
|
for (var Q = 3, G = 1; G < s; ++G)
|
|
2174
|
-
V = h[i >>> 24] ^
|
|
2175
|
-
A[0] = d[i >>> 24] << 24 ^ d[n >>> 16 & 255] << 16 ^ d[k >>> 8 & 255] << 8 ^ d[P & 255] ^ l[++Q], A[
|
|
2178
|
+
V = h[i >>> 24] ^ m[n >>> 16 & 255] ^ b[k >>> 8 & 255] ^ N[P & 255] ^ l[++Q], O = h[n >>> 24] ^ m[k >>> 16 & 255] ^ b[P >>> 8 & 255] ^ N[i & 255] ^ l[++Q], M = h[k >>> 24] ^ m[P >>> 16 & 255] ^ b[i >>> 8 & 255] ^ N[n & 255] ^ l[++Q], P = h[P >>> 24] ^ m[i >>> 16 & 255] ^ b[n >>> 8 & 255] ^ N[k & 255] ^ l[++Q], i = V, n = O, k = M;
|
|
2179
|
+
A[0] = d[i >>> 24] << 24 ^ d[n >>> 16 & 255] << 16 ^ d[k >>> 8 & 255] << 8 ^ d[P & 255] ^ l[++Q], A[v ? 3 : 1] = d[n >>> 24] << 24 ^ d[k >>> 16 & 255] << 16 ^ d[P >>> 8 & 255] << 8 ^ d[i & 255] ^ l[++Q], A[2] = d[k >>> 24] << 24 ^ d[P >>> 16 & 255] << 16 ^ d[i >>> 8 & 255] << 8 ^ d[n & 255] ^ l[++Q], A[v ? 1 : 3] = d[P >>> 24] << 24 ^ d[i >>> 16 & 255] << 16 ^ d[n >>> 8 & 255] << 8 ^ d[k & 255] ^ l[++Q];
|
|
2176
2180
|
}
|
|
2177
2181
|
function E(l) {
|
|
2178
2182
|
l = l || {};
|
|
2179
|
-
var
|
|
2180
|
-
l.decrypt ?
|
|
2181
|
-
var s =
|
|
2182
|
-
return
|
|
2183
|
+
var y = (l.mode || "CBC").toUpperCase(), A = "AES-" + y, v;
|
|
2184
|
+
l.decrypt ? v = t.cipher.createDecipher(A, l.key) : v = t.cipher.createCipher(A, l.key);
|
|
2185
|
+
var s = v.start;
|
|
2186
|
+
return v.start = function(h, m) {
|
|
2183
2187
|
var b = null;
|
|
2184
|
-
|
|
2185
|
-
},
|
|
2188
|
+
m instanceof t.util.ByteBuffer && (b = m, m = {}), m = m || {}, m.output = b, m.iv = h, s.call(v, m);
|
|
2189
|
+
}, v;
|
|
2186
2190
|
}
|
|
2187
2191
|
return sr;
|
|
2188
2192
|
}
|
|
@@ -2331,31 +2335,31 @@ function yt() {
|
|
|
2331
2335
|
r--;
|
|
2332
2336
|
var E = D & 192, l = D & 31;
|
|
2333
2337
|
I = c.length();
|
|
2334
|
-
var
|
|
2335
|
-
if (r -= I - c.length(),
|
|
2338
|
+
var y = p(c, r);
|
|
2339
|
+
if (r -= I - c.length(), y !== void 0 && y > r) {
|
|
2336
2340
|
if (u.strict) {
|
|
2337
2341
|
var A = new Error("Too few bytes to read ASN.1 value.");
|
|
2338
|
-
throw A.available = c.length(), A.remaining = r, A.requested =
|
|
2342
|
+
throw A.available = c.length(), A.remaining = r, A.requested = y, A;
|
|
2339
2343
|
}
|
|
2340
|
-
|
|
2344
|
+
y = r;
|
|
2341
2345
|
}
|
|
2342
|
-
var
|
|
2346
|
+
var v, s, h = (D & 32) === 32;
|
|
2343
2347
|
if (h)
|
|
2344
|
-
if (
|
|
2348
|
+
if (v = [], y === void 0)
|
|
2345
2349
|
for (; ; ) {
|
|
2346
2350
|
if (a(c, r, 2), c.bytes(2) === "\0\0") {
|
|
2347
2351
|
c.getBytes(2), r -= 2;
|
|
2348
2352
|
break;
|
|
2349
2353
|
}
|
|
2350
|
-
I = c.length(),
|
|
2354
|
+
I = c.length(), v.push(S(c, r, g + 1, u)), r -= I - c.length();
|
|
2351
2355
|
}
|
|
2352
2356
|
else
|
|
2353
|
-
for (;
|
|
2354
|
-
I = c.length(),
|
|
2355
|
-
if (
|
|
2357
|
+
for (; y > 0; )
|
|
2358
|
+
I = c.length(), v.push(S(c, y, g + 1, u)), r -= I - c.length(), y -= I - c.length();
|
|
2359
|
+
if (v === void 0 && E === e.Class.UNIVERSAL && l === e.Type.BITSTRING && (s = c.bytes(y)), v === void 0 && u.decodeBitStrings && E === e.Class.UNIVERSAL && // FIXME: OCTET STRINGs not yet supported here
|
|
2356
2360
|
// .. other parts of forge expect to decode OCTET STRINGs manually
|
|
2357
|
-
l === e.Type.BITSTRING &&
|
|
2358
|
-
var
|
|
2361
|
+
l === e.Type.BITSTRING && y > 1) {
|
|
2362
|
+
var m = c.read, b = r, N = 0;
|
|
2359
2363
|
if (l === e.Type.BITSTRING && (a(c, r, 1), N = c.getByte(), r--), N === 0)
|
|
2360
2364
|
try {
|
|
2361
2365
|
I = c.length();
|
|
@@ -2366,27 +2370,27 @@ function yt() {
|
|
|
2366
2370
|
}, i = S(c, r, g + 1, d), n = I - c.length();
|
|
2367
2371
|
r -= n, l == e.Type.BITSTRING && n++;
|
|
2368
2372
|
var k = i.tagClass;
|
|
2369
|
-
n ===
|
|
2373
|
+
n === y && (k === e.Class.UNIVERSAL || k === e.Class.CONTEXT_SPECIFIC) && (v = [i]);
|
|
2370
2374
|
} catch {
|
|
2371
2375
|
}
|
|
2372
|
-
|
|
2376
|
+
v === void 0 && (c.read = m, r = b);
|
|
2373
2377
|
}
|
|
2374
|
-
if (
|
|
2375
|
-
if (
|
|
2378
|
+
if (v === void 0) {
|
|
2379
|
+
if (y === void 0) {
|
|
2376
2380
|
if (u.strict)
|
|
2377
2381
|
throw new Error("Non-constructed ASN.1 object of indefinite length.");
|
|
2378
|
-
|
|
2382
|
+
y = r;
|
|
2379
2383
|
}
|
|
2380
2384
|
if (l === e.Type.BMPSTRING)
|
|
2381
|
-
for (
|
|
2382
|
-
a(c, r, 2),
|
|
2385
|
+
for (v = ""; y > 0; y -= 2)
|
|
2386
|
+
a(c, r, 2), v += String.fromCharCode(c.getInt16()), r -= 2;
|
|
2383
2387
|
else
|
|
2384
|
-
|
|
2388
|
+
v = c.getBytes(y), r -= y;
|
|
2385
2389
|
}
|
|
2386
2390
|
var P = s === void 0 ? null : {
|
|
2387
2391
|
bitStringContents: s
|
|
2388
2392
|
};
|
|
2389
|
-
return e.create(E, l, h,
|
|
2393
|
+
return e.create(E, l, h, v, P);
|
|
2390
2394
|
}
|
|
2391
2395
|
e.toDer = function(c) {
|
|
2392
2396
|
var r = t.util.createBuffer(), g = c.tagClass | c.type, u = t.util.createBuffer(), I = !1;
|
|
@@ -2423,8 +2427,8 @@ function yt() {
|
|
|
2423
2427
|
do
|
|
2424
2428
|
E = D & 127, D = D >>> 7, u || (E |= 128), I.push(E), u = !1;
|
|
2425
2429
|
while (D > 0);
|
|
2426
|
-
for (var
|
|
2427
|
-
g.putByte(I[
|
|
2430
|
+
for (var y = I.length - 1; y >= 0; --y)
|
|
2431
|
+
g.putByte(I[y]);
|
|
2428
2432
|
}
|
|
2429
2433
|
return g;
|
|
2430
2434
|
}, e.derToOid = function(c) {
|
|
@@ -2440,23 +2444,23 @@ function yt() {
|
|
|
2440
2444
|
g = g >= 50 ? 1900 + g : 2e3 + g;
|
|
2441
2445
|
var u = parseInt(c.substr(2, 2), 10) - 1, I = parseInt(c.substr(4, 2), 10), D = parseInt(c.substr(6, 2), 10), E = parseInt(c.substr(8, 2), 10), l = 0;
|
|
2442
2446
|
if (c.length > 11) {
|
|
2443
|
-
var
|
|
2444
|
-
|
|
2447
|
+
var y = c.charAt(10), A = 10;
|
|
2448
|
+
y !== "+" && y !== "-" && (l = parseInt(c.substr(10, 2), 10), A += 2);
|
|
2445
2449
|
}
|
|
2446
|
-
if (r.setUTCFullYear(g, u, I), r.setUTCHours(D, E, l, 0), A && (
|
|
2447
|
-
var
|
|
2448
|
-
h *= 6e4,
|
|
2450
|
+
if (r.setUTCFullYear(g, u, I), r.setUTCHours(D, E, l, 0), A && (y = c.charAt(A), y === "+" || y === "-")) {
|
|
2451
|
+
var v = parseInt(c.substr(A + 1, 2), 10), s = parseInt(c.substr(A + 4, 2), 10), h = v * 60 + s;
|
|
2452
|
+
h *= 6e4, y === "+" ? r.setTime(+r - h) : r.setTime(+r + h);
|
|
2449
2453
|
}
|
|
2450
2454
|
return r;
|
|
2451
2455
|
}, e.generalizedTimeToDate = function(c) {
|
|
2452
|
-
var r = /* @__PURE__ */ new Date(), g = parseInt(c.substr(0, 4), 10), u = parseInt(c.substr(4, 2), 10) - 1, I = parseInt(c.substr(6, 2), 10), D = parseInt(c.substr(8, 2), 10), E = parseInt(c.substr(10, 2), 10), l = parseInt(c.substr(12, 2), 10),
|
|
2453
|
-
c.charAt(c.length - 1) === "Z" && (
|
|
2456
|
+
var r = /* @__PURE__ */ new Date(), g = parseInt(c.substr(0, 4), 10), u = parseInt(c.substr(4, 2), 10) - 1, I = parseInt(c.substr(6, 2), 10), D = parseInt(c.substr(8, 2), 10), E = parseInt(c.substr(10, 2), 10), l = parseInt(c.substr(12, 2), 10), y = 0, A = 0, v = !1;
|
|
2457
|
+
c.charAt(c.length - 1) === "Z" && (v = !0);
|
|
2454
2458
|
var s = c.length - 5, h = c.charAt(s);
|
|
2455
2459
|
if (h === "+" || h === "-") {
|
|
2456
|
-
var
|
|
2457
|
-
A =
|
|
2460
|
+
var m = parseInt(c.substr(s + 1, 2), 10), b = parseInt(c.substr(s + 4, 2), 10);
|
|
2461
|
+
A = m * 60 + b, A *= 6e4, h === "+" && (A *= -1), v = !0;
|
|
2458
2462
|
}
|
|
2459
|
-
return c.charAt(14) === "." && (
|
|
2463
|
+
return c.charAt(14) === "." && (y = parseFloat(c.substr(14), 10) * 1e3), v ? (r.setUTCFullYear(g, u, I), r.setUTCHours(D, E, l, y), r.setTime(+r + A)) : (r.setFullYear(g, u, I), r.setHours(D, E, l, y)), r;
|
|
2460
2464
|
}, e.dateToUtcTime = function(c) {
|
|
2461
2465
|
if (typeof c == "string")
|
|
2462
2466
|
return c;
|
|
@@ -2618,8 +2622,8 @@ function yt() {
|
|
|
2618
2622
|
u += I + "Sub values: " + E + l;
|
|
2619
2623
|
} else {
|
|
2620
2624
|
if (u += I + "Value: ", c.type === e.Type.OID) {
|
|
2621
|
-
var
|
|
2622
|
-
u +=
|
|
2625
|
+
var y = e.derToOid(c.value);
|
|
2626
|
+
u += y, t.pki && t.pki.oids && y in t.pki.oids && (u += " (" + t.pki.oids[y] + ") ");
|
|
2623
2627
|
}
|
|
2624
2628
|
if (c.type === e.Type.INTEGER)
|
|
2625
2629
|
try {
|
|
@@ -2637,11 +2641,11 @@ function yt() {
|
|
|
2637
2641
|
else if (c.type === e.Type.UTF8)
|
|
2638
2642
|
try {
|
|
2639
2643
|
u += t.util.decodeUtf8(c.value);
|
|
2640
|
-
} catch (
|
|
2641
|
-
if (
|
|
2644
|
+
} catch (v) {
|
|
2645
|
+
if (v.message === "URI malformed")
|
|
2642
2646
|
u += "0x" + t.util.bytesToHex(c.value) + " (malformed UTF8)";
|
|
2643
2647
|
else
|
|
2644
|
-
throw
|
|
2648
|
+
throw v;
|
|
2645
2649
|
}
|
|
2646
2650
|
else c.type === e.Type.PRINTABLESTRING || c.type === e.Type.IA5String ? u += c.value : C.test(c.value) ? u += "0x" + t.util.bytesToHex(c.value) : c.value.length === 0 ? u += "[null]" : u += c.value;
|
|
2647
2651
|
}
|
|
@@ -2726,7 +2730,7 @@ function xr() {
|
|
|
2726
2730
|
};
|
|
2727
2731
|
return E.start = function() {
|
|
2728
2732
|
E.messageLength = 0, E.fullMessageLength = E.messageLength64 = [];
|
|
2729
|
-
for (var l = E.messageLengthSize / 4,
|
|
2733
|
+
for (var l = E.messageLengthSize / 4, y = 0; y < l; ++y)
|
|
2730
2734
|
E.fullMessageLength.push(0);
|
|
2731
2735
|
return I = t.util.createBuffer(), u = {
|
|
2732
2736
|
h0: 1732584193,
|
|
@@ -2734,29 +2738,29 @@ function xr() {
|
|
|
2734
2738
|
h2: 2562383102,
|
|
2735
2739
|
h3: 271733878
|
|
2736
2740
|
}, E;
|
|
2737
|
-
}, E.start(), E.update = function(l,
|
|
2738
|
-
|
|
2741
|
+
}, E.start(), E.update = function(l, y) {
|
|
2742
|
+
y === "utf8" && (l = t.util.encodeUtf8(l));
|
|
2739
2743
|
var A = l.length;
|
|
2740
2744
|
E.messageLength += A, A = [A / 4294967296 >>> 0, A >>> 0];
|
|
2741
|
-
for (var
|
|
2742
|
-
E.fullMessageLength[
|
|
2745
|
+
for (var v = E.fullMessageLength.length - 1; v >= 0; --v)
|
|
2746
|
+
E.fullMessageLength[v] += A[1], A[1] = A[0] + (E.fullMessageLength[v] / 4294967296 >>> 0), E.fullMessageLength[v] = E.fullMessageLength[v] >>> 0, A[0] = A[1] / 4294967296 >>> 0;
|
|
2743
2747
|
return I.putBytes(l), g(u, D, I), (I.read > 2048 || I.length() === 0) && I.compact(), E;
|
|
2744
2748
|
}, E.digest = function() {
|
|
2745
2749
|
var l = t.util.createBuffer();
|
|
2746
2750
|
l.putBytes(I.bytes());
|
|
2747
|
-
var
|
|
2751
|
+
var y = E.fullMessageLength[E.fullMessageLength.length - 1] + E.messageLengthSize, A = y & E.blockLength - 1;
|
|
2748
2752
|
l.putBytes(a.substr(0, E.blockLength - A));
|
|
2749
|
-
for (var
|
|
2750
|
-
|
|
2751
|
-
var
|
|
2753
|
+
for (var v, s = 0, h = E.fullMessageLength.length - 1; h >= 0; --h)
|
|
2754
|
+
v = E.fullMessageLength[h] * 8 + s, s = v / 4294967296 >>> 0, l.putInt32Le(v >>> 0);
|
|
2755
|
+
var m = {
|
|
2752
2756
|
h0: u.h0,
|
|
2753
2757
|
h1: u.h1,
|
|
2754
2758
|
h2: u.h2,
|
|
2755
2759
|
h3: u.h3
|
|
2756
2760
|
};
|
|
2757
|
-
g(
|
|
2761
|
+
g(m, D, l);
|
|
2758
2762
|
var b = t.util.createBuffer();
|
|
2759
|
-
return b.putInt32Le(
|
|
2763
|
+
return b.putInt32Le(m.h0), b.putInt32Le(m.h1), b.putInt32Le(m.h2), b.putInt32Le(m.h3), b;
|
|
2760
2764
|
}, E;
|
|
2761
2765
|
};
|
|
2762
2766
|
var a = null, p = null, S = null, C = null, c = !1;
|
|
@@ -2897,16 +2901,16 @@ function xr() {
|
|
|
2897
2901
|
c = !0;
|
|
2898
2902
|
}
|
|
2899
2903
|
function g(u, I, D) {
|
|
2900
|
-
for (var E, l,
|
|
2901
|
-
for (l = u.h0,
|
|
2902
|
-
I[
|
|
2903
|
-
for (;
|
|
2904
|
-
s = A ^
|
|
2905
|
-
for (;
|
|
2906
|
-
s =
|
|
2907
|
-
for (;
|
|
2908
|
-
s = A ^ (
|
|
2909
|
-
u.h0 = u.h0 + l | 0, u.h1 = u.h1 +
|
|
2904
|
+
for (var E, l, y, A, v, s, h, m, b = D.length(); b >= 64; ) {
|
|
2905
|
+
for (l = u.h0, y = u.h1, A = u.h2, v = u.h3, m = 0; m < 16; ++m)
|
|
2906
|
+
I[m] = D.getInt32Le(), s = v ^ y & (A ^ v), E = l + s + C[m] + I[m], h = S[m], l = v, v = A, A = y, y += E << h | E >>> 32 - h;
|
|
2907
|
+
for (; m < 32; ++m)
|
|
2908
|
+
s = A ^ v & (y ^ A), E = l + s + C[m] + I[p[m]], h = S[m], l = v, v = A, A = y, y += E << h | E >>> 32 - h;
|
|
2909
|
+
for (; m < 48; ++m)
|
|
2910
|
+
s = y ^ A ^ v, E = l + s + C[m] + I[p[m]], h = S[m], l = v, v = A, A = y, y += E << h | E >>> 32 - h;
|
|
2911
|
+
for (; m < 64; ++m)
|
|
2912
|
+
s = A ^ (y | ~v), E = l + s + C[m] + I[p[m]], h = S[m], l = v, v = A, A = y, y += E << h | E >>> 32 - h;
|
|
2913
|
+
u.h0 = u.h0 + l | 0, u.h1 = u.h1 + y | 0, u.h2 = u.h2 + A | 0, u.h3 = u.h3 + v | 0, b -= 64;
|
|
2910
2914
|
}
|
|
2911
2915
|
}
|
|
2912
2916
|
return pr.exports;
|
|
@@ -2946,15 +2950,15 @@ function Ot() {
|
|
|
2946
2950
|
};
|
|
2947
2951
|
if (C.push(D), !!u[2]) {
|
|
2948
2952
|
for (var E = u[2].split(g), l = 0; u && l < E.length; ) {
|
|
2949
|
-
for (var
|
|
2950
|
-
var
|
|
2951
|
-
if (!/\s/.test(
|
|
2953
|
+
for (var y = E[l].replace(/\s+$/, ""), A = l + 1; A < E.length; ++A) {
|
|
2954
|
+
var v = E[A];
|
|
2955
|
+
if (!/\s/.test(v[0]))
|
|
2952
2956
|
break;
|
|
2953
|
-
|
|
2957
|
+
y += v, l = A;
|
|
2954
2958
|
}
|
|
2955
|
-
if (u =
|
|
2956
|
-
for (var s = { name: u[1], values: [] }, h = u[2].split(","),
|
|
2957
|
-
s.values.push(p(h[
|
|
2959
|
+
if (u = y.match(r), u) {
|
|
2960
|
+
for (var s = { name: u[1], values: [] }, h = u[2].split(","), m = 0; m < h.length; ++m)
|
|
2961
|
+
s.values.push(p(h[m]));
|
|
2958
2962
|
if (D.procType)
|
|
2959
2963
|
if (!D.contentDomain && s.name === "Content-Domain")
|
|
2960
2964
|
D.contentDomain = h[0] || "";
|
|
@@ -3008,99 +3012,99 @@ function Jt() {
|
|
|
3008
3012
|
if (fa) return gr;
|
|
3009
3013
|
fa = 1;
|
|
3010
3014
|
var t = pe();
|
|
3011
|
-
Hr(), Za(), ve(), gr = t.des = t.des || {}, t.des.startEncrypting = function(l,
|
|
3015
|
+
Hr(), Za(), ve(), gr = t.des = t.des || {}, t.des.startEncrypting = function(l, y, A, v) {
|
|
3012
3016
|
var s = E({
|
|
3013
3017
|
key: l,
|
|
3014
3018
|
output: A,
|
|
3015
3019
|
decrypt: !1,
|
|
3016
|
-
mode:
|
|
3020
|
+
mode: v || (y === null ? "ECB" : "CBC")
|
|
3017
3021
|
});
|
|
3018
|
-
return s.start(
|
|
3019
|
-
}, t.des.createEncryptionCipher = function(l,
|
|
3022
|
+
return s.start(y), s;
|
|
3023
|
+
}, t.des.createEncryptionCipher = function(l, y) {
|
|
3020
3024
|
return E({
|
|
3021
3025
|
key: l,
|
|
3022
3026
|
output: null,
|
|
3023
3027
|
decrypt: !1,
|
|
3024
|
-
mode:
|
|
3028
|
+
mode: y
|
|
3025
3029
|
});
|
|
3026
|
-
}, t.des.startDecrypting = function(l,
|
|
3030
|
+
}, t.des.startDecrypting = function(l, y, A, v) {
|
|
3027
3031
|
var s = E({
|
|
3028
3032
|
key: l,
|
|
3029
3033
|
output: A,
|
|
3030
3034
|
decrypt: !0,
|
|
3031
|
-
mode:
|
|
3035
|
+
mode: v || (y === null ? "ECB" : "CBC")
|
|
3032
3036
|
});
|
|
3033
|
-
return s.start(
|
|
3034
|
-
}, t.des.createDecryptionCipher = function(l,
|
|
3037
|
+
return s.start(y), s;
|
|
3038
|
+
}, t.des.createDecryptionCipher = function(l, y) {
|
|
3035
3039
|
return E({
|
|
3036
3040
|
key: l,
|
|
3037
3041
|
output: null,
|
|
3038
3042
|
decrypt: !0,
|
|
3039
|
-
mode:
|
|
3043
|
+
mode: y
|
|
3040
3044
|
});
|
|
3041
|
-
}, t.des.Algorithm = function(l,
|
|
3045
|
+
}, t.des.Algorithm = function(l, y) {
|
|
3042
3046
|
var A = this;
|
|
3043
|
-
A.name = l, A.mode = new
|
|
3047
|
+
A.name = l, A.mode = new y({
|
|
3044
3048
|
blockSize: 8,
|
|
3045
3049
|
cipher: {
|
|
3046
|
-
encrypt: function(
|
|
3047
|
-
return D(A._keys,
|
|
3050
|
+
encrypt: function(v, s) {
|
|
3051
|
+
return D(A._keys, v, s, !1);
|
|
3048
3052
|
},
|
|
3049
|
-
decrypt: function(
|
|
3050
|
-
return D(A._keys,
|
|
3053
|
+
decrypt: function(v, s) {
|
|
3054
|
+
return D(A._keys, v, s, !0);
|
|
3051
3055
|
}
|
|
3052
3056
|
}
|
|
3053
3057
|
}), A._init = !1;
|
|
3054
3058
|
}, t.des.Algorithm.prototype.initialize = function(l) {
|
|
3055
3059
|
if (!this._init) {
|
|
3056
|
-
var
|
|
3057
|
-
if (this.name.indexOf("3DES") === 0 &&
|
|
3058
|
-
throw new Error("Invalid Triple-DES key size: " +
|
|
3059
|
-
this._keys = I(
|
|
3060
|
+
var y = t.util.createBuffer(l.key);
|
|
3061
|
+
if (this.name.indexOf("3DES") === 0 && y.length() !== 24)
|
|
3062
|
+
throw new Error("Invalid Triple-DES key size: " + y.length() * 8);
|
|
3063
|
+
this._keys = I(y), this._init = !0;
|
|
3060
3064
|
}
|
|
3061
3065
|
}, e("DES-ECB", t.cipher.modes.ecb), e("DES-CBC", t.cipher.modes.cbc), e("DES-CFB", t.cipher.modes.cfb), e("DES-OFB", t.cipher.modes.ofb), e("DES-CTR", t.cipher.modes.ctr), e("3DES-ECB", t.cipher.modes.ecb), e("3DES-CBC", t.cipher.modes.cbc), e("3DES-CFB", t.cipher.modes.cfb), e("3DES-OFB", t.cipher.modes.ofb), e("3DES-CTR", t.cipher.modes.ctr);
|
|
3062
|
-
function e(l,
|
|
3066
|
+
function e(l, y) {
|
|
3063
3067
|
var A = function() {
|
|
3064
|
-
return new t.des.Algorithm(l,
|
|
3068
|
+
return new t.des.Algorithm(l, y);
|
|
3065
3069
|
};
|
|
3066
3070
|
t.cipher.registerAlgorithm(l, A);
|
|
3067
3071
|
}
|
|
3068
3072
|
var a = [16843776, 0, 65536, 16843780, 16842756, 66564, 4, 65536, 1024, 16843776, 16843780, 1024, 16778244, 16842756, 16777216, 4, 1028, 16778240, 16778240, 66560, 66560, 16842752, 16842752, 16778244, 65540, 16777220, 16777220, 65540, 0, 1028, 66564, 16777216, 65536, 16843780, 4, 16842752, 16843776, 16777216, 16777216, 1024, 16842756, 65536, 66560, 16777220, 1024, 4, 16778244, 66564, 16843780, 65540, 16842752, 16778244, 16777220, 1028, 66564, 16843776, 1028, 16778240, 16778240, 0, 65540, 66560, 0, 16842756], p = [-2146402272, -2147450880, 32768, 1081376, 1048576, 32, -2146435040, -2147450848, -2147483616, -2146402272, -2146402304, -2147483648, -2147450880, 1048576, 32, -2146435040, 1081344, 1048608, -2147450848, 0, -2147483648, 32768, 1081376, -2146435072, 1048608, -2147483616, 0, 1081344, 32800, -2146402304, -2146435072, 32800, 0, 1081376, -2146435040, 1048576, -2147450848, -2146435072, -2146402304, 32768, -2146435072, -2147450880, 32, -2146402272, 1081376, 32, 32768, -2147483648, 32800, -2146402304, 1048576, -2147483616, 1048608, -2147450848, -2147483616, 1048608, 1081344, 0, -2147450880, 32800, -2147483648, -2146435040, -2146402272, 1081344], S = [520, 134349312, 0, 134348808, 134218240, 0, 131592, 134218240, 131080, 134217736, 134217736, 131072, 134349320, 131080, 134348800, 520, 134217728, 8, 134349312, 512, 131584, 134348800, 134348808, 131592, 134218248, 131584, 131072, 134218248, 8, 134349320, 512, 134217728, 134349312, 134217728, 131080, 520, 131072, 134349312, 134218240, 0, 512, 131080, 134349320, 134218240, 134217736, 512, 0, 134348808, 134218248, 131072, 134217728, 134349320, 8, 131592, 131584, 134217736, 134348800, 134218248, 520, 134348800, 131592, 8, 134348808, 131584], C = [8396801, 8321, 8321, 128, 8396928, 8388737, 8388609, 8193, 0, 8396800, 8396800, 8396929, 129, 0, 8388736, 8388609, 1, 8192, 8388608, 8396801, 128, 8388608, 8193, 8320, 8388737, 1, 8320, 8388736, 8192, 8396928, 8396929, 129, 8388736, 8388609, 8396800, 8396929, 129, 0, 0, 8396800, 8320, 8388736, 8388737, 1, 8396801, 8321, 8321, 128, 8396929, 129, 1, 8192, 8388609, 8193, 8396928, 8388737, 8193, 8320, 8388608, 8396801, 128, 8388608, 8192, 8396928], c = [256, 34078976, 34078720, 1107296512, 524288, 256, 1073741824, 34078720, 1074266368, 524288, 33554688, 1074266368, 1107296512, 1107820544, 524544, 1073741824, 33554432, 1074266112, 1074266112, 0, 1073742080, 1107820800, 1107820800, 33554688, 1107820544, 1073742080, 0, 1107296256, 34078976, 33554432, 1107296256, 524544, 524288, 1107296512, 256, 33554432, 1073741824, 34078720, 1107296512, 1074266368, 33554688, 1073741824, 1107820544, 34078976, 1074266368, 256, 33554432, 1107820544, 1107820800, 524544, 1107296256, 1107820800, 34078720, 0, 1074266112, 1107296256, 524544, 33554688, 1073742080, 524288, 0, 1074266112, 34078976, 1073742080], r = [536870928, 541065216, 16384, 541081616, 541065216, 16, 541081616, 4194304, 536887296, 4210704, 4194304, 536870928, 4194320, 536887296, 536870912, 16400, 0, 4194320, 536887312, 16384, 4210688, 536887312, 16, 541065232, 541065232, 0, 4210704, 541081600, 16400, 4210688, 541081600, 536870912, 536887296, 16, 541065232, 4210688, 541081616, 4194304, 16400, 536870928, 4194304, 536887296, 536870912, 16400, 536870928, 541081616, 4210688, 541065216, 4210704, 541081600, 0, 541065232, 16, 16384, 541065216, 4210704, 16384, 4194320, 536887312, 0, 541081600, 536870912, 4194320, 536887312], g = [2097152, 69206018, 67110914, 0, 2048, 67110914, 2099202, 69208064, 69208066, 2097152, 0, 67108866, 2, 67108864, 69206018, 2050, 67110912, 2099202, 2097154, 67110912, 67108866, 69206016, 69208064, 2097154, 69206016, 2048, 2050, 69208066, 2099200, 2, 67108864, 2099200, 67108864, 2099200, 2097152, 67110914, 67110914, 69206018, 69206018, 2, 2097154, 67108864, 67110912, 2097152, 69208064, 2050, 2099202, 69208064, 2050, 67108866, 69208066, 69206016, 2099200, 0, 2, 69208066, 0, 2099202, 69206016, 2048, 67108866, 67110912, 2048, 2097154], u = [268439616, 4096, 262144, 268701760, 268435456, 268439616, 64, 268435456, 262208, 268697600, 268701760, 266240, 268701696, 266304, 4096, 64, 268697600, 268435520, 268439552, 4160, 266240, 262208, 268697664, 268701696, 4160, 0, 0, 268697664, 268435520, 268439552, 266304, 262144, 266304, 262144, 268701696, 4096, 64, 268697664, 4096, 266304, 268439552, 64, 268435520, 268697600, 268697664, 268435456, 262144, 268439616, 0, 268701760, 262208, 268435520, 268697600, 268439552, 268439616, 0, 268701760, 266240, 266240, 4160, 4160, 262208, 268435456, 268701696];
|
|
3069
3073
|
function I(l) {
|
|
3070
|
-
for (var
|
|
3074
|
+
for (var y = [0, 4, 536870912, 536870916, 65536, 65540, 536936448, 536936452, 512, 516, 536871424, 536871428, 66048, 66052, 536936960, 536936964], A = [0, 1, 1048576, 1048577, 67108864, 67108865, 68157440, 68157441, 256, 257, 1048832, 1048833, 67109120, 67109121, 68157696, 68157697], v = [0, 8, 2048, 2056, 16777216, 16777224, 16779264, 16779272, 0, 8, 2048, 2056, 16777216, 16777224, 16779264, 16779272], s = [0, 2097152, 134217728, 136314880, 8192, 2105344, 134225920, 136323072, 131072, 2228224, 134348800, 136445952, 139264, 2236416, 134356992, 136454144], h = [0, 262144, 16, 262160, 0, 262144, 16, 262160, 4096, 266240, 4112, 266256, 4096, 266240, 4112, 266256], m = [0, 1024, 32, 1056, 0, 1024, 32, 1056, 33554432, 33555456, 33554464, 33555488, 33554432, 33555456, 33554464, 33555488], b = [0, 268435456, 524288, 268959744, 2, 268435458, 524290, 268959746, 0, 268435456, 524288, 268959744, 2, 268435458, 524290, 268959746], N = [0, 65536, 2048, 67584, 536870912, 536936448, 536872960, 536938496, 131072, 196608, 133120, 198656, 537001984, 537067520, 537004032, 537069568], d = [0, 262144, 0, 262144, 2, 262146, 2, 262146, 33554432, 33816576, 33554432, 33816576, 33554434, 33816578, 33554434, 33816578], i = [0, 268435456, 8, 268435464, 0, 268435456, 8, 268435464, 1024, 268436480, 1032, 268436488, 1024, 268436480, 1032, 268436488], n = [0, 32, 0, 32, 1048576, 1048608, 1048576, 1048608, 8192, 8224, 8192, 8224, 1056768, 1056800, 1056768, 1056800], k = [0, 16777216, 512, 16777728, 2097152, 18874368, 2097664, 18874880, 67108864, 83886080, 67109376, 83886592, 69206016, 85983232, 69206528, 85983744], P = [0, 4096, 134217728, 134221824, 524288, 528384, 134742016, 134746112, 16, 4112, 134217744, 134221840, 524304, 528400, 134742032, 134746128], V = [0, 4, 256, 260, 0, 4, 256, 260, 1, 5, 257, 261, 1, 5, 257, 261], O = l.length() > 8 ? 3 : 1, M = [], Q = [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0], G = 0, z, J = 0; J < O; J++) {
|
|
3071
3075
|
var $ = l.getInt32(), re = l.getInt32();
|
|
3072
3076
|
z = ($ >>> 4 ^ re) & 252645135, re ^= z, $ ^= z << 4, z = (re >>> -16 ^ $) & 65535, $ ^= z, re ^= z << -16, z = ($ >>> 2 ^ re) & 858993459, re ^= z, $ ^= z << 2, z = (re >>> -16 ^ $) & 65535, $ ^= z, re ^= z << -16, z = ($ >>> 1 ^ re) & 1431655765, re ^= z, $ ^= z << 1, z = (re >>> 8 ^ $) & 16711935, $ ^= z, re ^= z << 8, z = ($ >>> 1 ^ re) & 1431655765, re ^= z, $ ^= z << 1, z = $ << 8 | re >>> 20 & 240, $ = re << 24 | re << 8 & 16711680 | re >>> 8 & 65280 | re >>> 24 & 240, re = z;
|
|
3073
|
-
for (var
|
|
3074
|
-
Q[
|
|
3075
|
-
var se =
|
|
3077
|
+
for (var Z = 0; Z < Q.length; ++Z) {
|
|
3078
|
+
Q[Z] ? ($ = $ << 2 | $ >>> 26, re = re << 2 | re >>> 26) : ($ = $ << 1 | $ >>> 27, re = re << 1 | re >>> 27), $ &= -15, re &= -15;
|
|
3079
|
+
var se = y[$ >>> 28] | A[$ >>> 24 & 15] | v[$ >>> 20 & 15] | s[$ >>> 16 & 15] | h[$ >>> 12 & 15] | m[$ >>> 8 & 15] | b[$ >>> 4 & 15], de = N[re >>> 28] | d[re >>> 24 & 15] | i[re >>> 20 & 15] | n[re >>> 16 & 15] | k[re >>> 12 & 15] | P[re >>> 8 & 15] | V[re >>> 4 & 15];
|
|
3076
3080
|
z = (de >>> 16 ^ se) & 65535, M[G++] = se ^ z, M[G++] = de ^ z << 16;
|
|
3077
3081
|
}
|
|
3078
3082
|
}
|
|
3079
3083
|
return M;
|
|
3080
3084
|
}
|
|
3081
|
-
function D(l,
|
|
3085
|
+
function D(l, y, A, v) {
|
|
3082
3086
|
var s = l.length === 32 ? 3 : 9, h;
|
|
3083
|
-
s === 3 ? h =
|
|
3084
|
-
var
|
|
3085
|
-
|
|
3087
|
+
s === 3 ? h = v ? [30, -2, -2] : [0, 32, 2] : h = v ? [94, 62, -2, 32, 64, 2, 30, -2, -2] : [0, 32, 2, 62, 30, -2, 64, 96, 2];
|
|
3088
|
+
var m, b = y[0], N = y[1];
|
|
3089
|
+
m = (b >>> 4 ^ N) & 252645135, N ^= m, b ^= m << 4, m = (b >>> 16 ^ N) & 65535, N ^= m, b ^= m << 16, m = (N >>> 2 ^ b) & 858993459, b ^= m, N ^= m << 2, m = (N >>> 8 ^ b) & 16711935, b ^= m, N ^= m << 8, m = (b >>> 1 ^ N) & 1431655765, N ^= m, b ^= m << 1, b = b << 1 | b >>> 31, N = N << 1 | N >>> 31;
|
|
3086
3090
|
for (var d = 0; d < s; d += 3) {
|
|
3087
3091
|
for (var i = h[d + 1], n = h[d + 2], k = h[d]; k != i; k += n) {
|
|
3088
3092
|
var P = N ^ l[k], V = (N >>> 4 | N << 28) ^ l[k + 1];
|
|
3089
|
-
|
|
3093
|
+
m = b, b = N, N = m ^ (p[P >>> 24 & 63] | C[P >>> 16 & 63] | r[P >>> 8 & 63] | u[P & 63] | a[V >>> 24 & 63] | S[V >>> 16 & 63] | c[V >>> 8 & 63] | g[V & 63]);
|
|
3090
3094
|
}
|
|
3091
|
-
|
|
3095
|
+
m = b, b = N, N = m;
|
|
3092
3096
|
}
|
|
3093
|
-
b = b >>> 1 | b << 31, N = N >>> 1 | N << 31,
|
|
3097
|
+
b = b >>> 1 | b << 31, N = N >>> 1 | N << 31, m = (b >>> 1 ^ N) & 1431655765, N ^= m, b ^= m << 1, m = (N >>> 8 ^ b) & 16711935, b ^= m, N ^= m << 8, m = (N >>> 2 ^ b) & 858993459, b ^= m, N ^= m << 2, m = (b >>> 16 ^ N) & 65535, N ^= m, b ^= m << 16, m = (b >>> 4 ^ N) & 252645135, N ^= m, b ^= m << 4, A[0] = b, A[1] = N;
|
|
3094
3098
|
}
|
|
3095
3099
|
function E(l) {
|
|
3096
3100
|
l = l || {};
|
|
3097
|
-
var
|
|
3098
|
-
l.decrypt ?
|
|
3099
|
-
var s =
|
|
3100
|
-
return
|
|
3101
|
+
var y = (l.mode || "CBC").toUpperCase(), A = "DES-" + y, v;
|
|
3102
|
+
l.decrypt ? v = t.cipher.createDecipher(A, l.key) : v = t.cipher.createCipher(A, l.key);
|
|
3103
|
+
var s = v.start;
|
|
3104
|
+
return v.start = function(h, m) {
|
|
3101
3105
|
var b = null;
|
|
3102
|
-
|
|
3103
|
-
},
|
|
3106
|
+
m instanceof t.util.ByteBuffer && (b = m, m = {}), m = m || {}, m.output = b, m.iv = h, s.call(v, m);
|
|
3107
|
+
}, v;
|
|
3104
3108
|
}
|
|
3105
3109
|
return gr;
|
|
3106
3110
|
}
|
|
@@ -3140,26 +3144,26 @@ function Fr() {
|
|
|
3140
3144
|
}
|
|
3141
3145
|
var D = Math.ceil(c / u), E = c - (D - 1) * u, l = t.hmac.create();
|
|
3142
3146
|
l.start(r, p);
|
|
3143
|
-
var
|
|
3147
|
+
var y = "", A, v, s;
|
|
3144
3148
|
if (!g) {
|
|
3145
3149
|
for (var h = 1; h <= D; ++h) {
|
|
3146
3150
|
l.start(null, null), l.update(S), l.update(t.util.int32ToBytes(h)), A = s = l.digest().getBytes();
|
|
3147
|
-
for (var
|
|
3148
|
-
l.start(null, null), l.update(s),
|
|
3149
|
-
|
|
3151
|
+
for (var m = 2; m <= C; ++m)
|
|
3152
|
+
l.start(null, null), l.update(s), v = l.digest().getBytes(), A = t.util.xorBytes(A, v, u), s = v;
|
|
3153
|
+
y += h < D ? A : A.substr(0, E);
|
|
3150
3154
|
}
|
|
3151
|
-
return
|
|
3155
|
+
return y;
|
|
3152
3156
|
}
|
|
3153
|
-
var h = 1,
|
|
3157
|
+
var h = 1, m;
|
|
3154
3158
|
function b() {
|
|
3155
3159
|
if (h > D)
|
|
3156
|
-
return g(null,
|
|
3157
|
-
l.start(null, null), l.update(S), l.update(t.util.int32ToBytes(h)), A = s = l.digest().getBytes(),
|
|
3160
|
+
return g(null, y);
|
|
3161
|
+
l.start(null, null), l.update(S), l.update(t.util.int32ToBytes(h)), A = s = l.digest().getBytes(), m = 2, N();
|
|
3158
3162
|
}
|
|
3159
3163
|
function N() {
|
|
3160
|
-
if (
|
|
3161
|
-
return l.start(null, null), l.update(s),
|
|
3162
|
-
|
|
3164
|
+
if (m <= C)
|
|
3165
|
+
return l.start(null, null), l.update(s), v = l.digest().getBytes(), A = t.util.xorBytes(A, v, u), s = v, ++m, t.util.setImmediate(N);
|
|
3166
|
+
y += h < D ? A : A.substr(0, E), ++h, b();
|
|
3163
3167
|
}
|
|
3164
3168
|
b();
|
|
3165
3169
|
}, yr;
|
|
@@ -3202,17 +3206,17 @@ function Wa() {
|
|
|
3202
3206
|
E === "utf8" && (D = t.util.encodeUtf8(D));
|
|
3203
3207
|
var l = D.length;
|
|
3204
3208
|
I.messageLength += l, l = [l / 4294967296 >>> 0, l >>> 0];
|
|
3205
|
-
for (var
|
|
3206
|
-
I.fullMessageLength[
|
|
3209
|
+
for (var y = I.fullMessageLength.length - 1; y >= 0; --y)
|
|
3210
|
+
I.fullMessageLength[y] += l[1], l[1] = l[0] + (I.fullMessageLength[y] / 4294967296 >>> 0), I.fullMessageLength[y] = I.fullMessageLength[y] >>> 0, l[0] = l[1] / 4294967296 >>> 0;
|
|
3207
3211
|
return g.putBytes(D), c(r, u, g), (g.read > 2048 || g.length() === 0) && g.compact(), I;
|
|
3208
3212
|
}, I.digest = function() {
|
|
3209
3213
|
var D = t.util.createBuffer();
|
|
3210
3214
|
D.putBytes(g.bytes());
|
|
3211
3215
|
var E = I.fullMessageLength[I.fullMessageLength.length - 1] + I.messageLengthSize, l = E & I.blockLength - 1;
|
|
3212
3216
|
D.putBytes(a.substr(0, I.blockLength - l));
|
|
3213
|
-
for (var
|
|
3214
|
-
|
|
3215
|
-
D.putInt32(
|
|
3217
|
+
for (var y, A, v = I.fullMessageLength[0] * 8, s = 0; s < I.fullMessageLength.length - 1; ++s)
|
|
3218
|
+
y = I.fullMessageLength[s + 1] * 8, A = y / 4294967296 >>> 0, v += A, D.putInt32(v >>> 0), v = y >>> 0;
|
|
3219
|
+
D.putInt32(v);
|
|
3216
3220
|
var h = {
|
|
3217
3221
|
h0: r.h0,
|
|
3218
3222
|
h1: r.h1,
|
|
@@ -3224,8 +3228,8 @@ function Wa() {
|
|
|
3224
3228
|
h7: r.h7
|
|
3225
3229
|
};
|
|
3226
3230
|
c(h, u, D);
|
|
3227
|
-
var
|
|
3228
|
-
return
|
|
3231
|
+
var m = t.util.createBuffer();
|
|
3232
|
+
return m.putInt32(h.h0), m.putInt32(h.h1), m.putInt32(h.h2), m.putInt32(h.h3), m.putInt32(h.h4), m.putInt32(h.h5), m.putInt32(h.h6), m.putInt32(h.h7), m;
|
|
3229
3233
|
}, I;
|
|
3230
3234
|
};
|
|
3231
3235
|
var a = null, p = !1, S = null;
|
|
@@ -3298,14 +3302,14 @@ function Wa() {
|
|
|
3298
3302
|
], p = !0;
|
|
3299
3303
|
}
|
|
3300
3304
|
function c(r, g, u) {
|
|
3301
|
-
for (var I, D, E, l,
|
|
3302
|
-
for (
|
|
3303
|
-
g[
|
|
3304
|
-
for (;
|
|
3305
|
-
I = g[
|
|
3306
|
-
for (s = r.h0, h = r.h1,
|
|
3307
|
-
l = (N >>> 6 | N << 26) ^ (N >>> 11 | N << 21) ^ (N >>> 25 | N << 7),
|
|
3308
|
-
r.h0 = r.h0 + s | 0, r.h1 = r.h1 + h | 0, r.h2 = r.h2 +
|
|
3305
|
+
for (var I, D, E, l, y, A, v, s, h, m, b, N, d, i, n, k = u.length(); k >= 64; ) {
|
|
3306
|
+
for (v = 0; v < 16; ++v)
|
|
3307
|
+
g[v] = u.getInt32();
|
|
3308
|
+
for (; v < 64; ++v)
|
|
3309
|
+
I = g[v - 2], I = (I >>> 17 | I << 15) ^ (I >>> 19 | I << 13) ^ I >>> 10, D = g[v - 15], D = (D >>> 7 | D << 25) ^ (D >>> 18 | D << 14) ^ D >>> 3, g[v] = I + g[v - 7] + D + g[v - 16] | 0;
|
|
3310
|
+
for (s = r.h0, h = r.h1, m = r.h2, b = r.h3, N = r.h4, d = r.h5, i = r.h6, n = r.h7, v = 0; v < 64; ++v)
|
|
3311
|
+
l = (N >>> 6 | N << 26) ^ (N >>> 11 | N << 21) ^ (N >>> 25 | N << 7), y = i ^ N & (d ^ i), E = (s >>> 2 | s << 30) ^ (s >>> 13 | s << 19) ^ (s >>> 22 | s << 10), A = s & h | m & (s ^ h), I = n + l + y + S[v] + g[v], D = E + A, n = i, i = d, d = N, N = b + I >>> 0, b = m, m = h, h = s, s = I + D >>> 0;
|
|
3312
|
+
r.h0 = r.h0 + s | 0, r.h1 = r.h1 + h | 0, r.h2 = r.h2 + m | 0, r.h3 = r.h3 + b | 0, r.h4 = r.h4 + N | 0, r.h5 = r.h5 + d | 0, r.h6 = r.h6 + i | 0, r.h7 = r.h7 + n | 0, k -= 64;
|
|
3309
3313
|
}
|
|
3310
3314
|
}
|
|
3311
3315
|
return vr.exports;
|
|
@@ -3336,27 +3340,27 @@ function _a() {
|
|
|
3336
3340
|
S.pools = c, S.pool = 0, S.generate = function(E, l) {
|
|
3337
3341
|
if (!l)
|
|
3338
3342
|
return S.generateSync(E);
|
|
3339
|
-
var
|
|
3340
|
-
S.key = null,
|
|
3341
|
-
function
|
|
3343
|
+
var y = S.plugin.cipher, A = S.plugin.increment, v = S.plugin.formatKey, s = S.plugin.formatSeed, h = t.util.createBuffer();
|
|
3344
|
+
S.key = null, m();
|
|
3345
|
+
function m(b) {
|
|
3342
3346
|
if (b)
|
|
3343
3347
|
return l(b);
|
|
3344
3348
|
if (h.length() >= E)
|
|
3345
3349
|
return l(null, h.getBytes(E));
|
|
3346
3350
|
if (S.generated > 1048575 && (S.key = null), S.key === null)
|
|
3347
3351
|
return t.util.nextTick(function() {
|
|
3348
|
-
g(
|
|
3352
|
+
g(m);
|
|
3349
3353
|
});
|
|
3350
|
-
var N =
|
|
3351
|
-
S.generated += N.length, h.putBytes(N), S.key =
|
|
3354
|
+
var N = y(S.key, S.seed);
|
|
3355
|
+
S.generated += N.length, h.putBytes(N), S.key = v(y(S.key, A(S.seed))), S.seed = s(y(S.key, S.seed)), t.util.setImmediate(m);
|
|
3352
3356
|
}
|
|
3353
3357
|
}, S.generateSync = function(E) {
|
|
3354
|
-
var l = S.plugin.cipher,
|
|
3358
|
+
var l = S.plugin.cipher, y = S.plugin.increment, A = S.plugin.formatKey, v = S.plugin.formatSeed;
|
|
3355
3359
|
S.key = null;
|
|
3356
3360
|
for (var s = t.util.createBuffer(); s.length() < E; ) {
|
|
3357
3361
|
S.generated > 1048575 && (S.key = null), S.key === null && u();
|
|
3358
3362
|
var h = l(S.key, S.seed);
|
|
3359
|
-
S.generated += h.length, s.putBytes(h), S.key = A(l(S.key,
|
|
3363
|
+
S.generated += h.length, s.putBytes(h), S.key = A(l(S.key, y(S.seed))), S.seed = v(l(S.key, S.seed));
|
|
3360
3364
|
}
|
|
3361
3365
|
return s.getBytes(E);
|
|
3362
3366
|
};
|
|
@@ -3364,9 +3368,9 @@ function _a() {
|
|
|
3364
3368
|
if (S.pools[0].messageLength >= 32)
|
|
3365
3369
|
return I(), E();
|
|
3366
3370
|
var l = 32 - S.pools[0].messageLength << 5;
|
|
3367
|
-
S.seedFile(l, function(
|
|
3368
|
-
if (
|
|
3369
|
-
return E(
|
|
3371
|
+
S.seedFile(l, function(y, A) {
|
|
3372
|
+
if (y)
|
|
3373
|
+
return E(y);
|
|
3370
3374
|
S.collect(A), I(), E();
|
|
3371
3375
|
});
|
|
3372
3376
|
}
|
|
@@ -3380,42 +3384,42 @@ function _a() {
|
|
|
3380
3384
|
S.reseeds = S.reseeds === 4294967295 ? 0 : S.reseeds + 1;
|
|
3381
3385
|
var E = S.plugin.md.create();
|
|
3382
3386
|
E.update(S.keyBytes);
|
|
3383
|
-
for (var l = 1,
|
|
3384
|
-
S.reseeds % l === 0 && (E.update(S.pools[
|
|
3387
|
+
for (var l = 1, y = 0; y < 32; ++y)
|
|
3388
|
+
S.reseeds % l === 0 && (E.update(S.pools[y].digest().getBytes()), S.pools[y].start()), l = l << 1;
|
|
3385
3389
|
S.keyBytes = E.digest().getBytes(), E.start(), E.update(S.keyBytes);
|
|
3386
3390
|
var A = E.digest().getBytes();
|
|
3387
3391
|
S.key = S.plugin.formatKey(S.keyBytes), S.seed = S.plugin.formatSeed(A), S.generated = 0;
|
|
3388
3392
|
}
|
|
3389
3393
|
function D(E) {
|
|
3390
|
-
var l = null,
|
|
3394
|
+
var l = null, y = t.util.globalScope, A = y.crypto || y.msCrypto;
|
|
3391
3395
|
A && A.getRandomValues && (l = function(n) {
|
|
3392
3396
|
return A.getRandomValues(n);
|
|
3393
3397
|
});
|
|
3394
|
-
var
|
|
3398
|
+
var v = t.util.createBuffer();
|
|
3395
3399
|
if (l)
|
|
3396
|
-
for (;
|
|
3397
|
-
var s = Math.max(1, Math.min(E -
|
|
3400
|
+
for (; v.length() < E; ) {
|
|
3401
|
+
var s = Math.max(1, Math.min(E - v.length(), 65536) / 4), h = new Uint32Array(Math.floor(s));
|
|
3398
3402
|
try {
|
|
3399
3403
|
l(h);
|
|
3400
|
-
for (var
|
|
3401
|
-
|
|
3404
|
+
for (var m = 0; m < h.length; ++m)
|
|
3405
|
+
v.putInt32(h[m]);
|
|
3402
3406
|
} catch (n) {
|
|
3403
3407
|
if (!(typeof QuotaExceededError < "u" && n instanceof QuotaExceededError))
|
|
3404
3408
|
throw n;
|
|
3405
3409
|
}
|
|
3406
3410
|
}
|
|
3407
|
-
if (
|
|
3408
|
-
for (var b, N, d, i = Math.floor(Math.random() * 65536);
|
|
3411
|
+
if (v.length() < E)
|
|
3412
|
+
for (var b, N, d, i = Math.floor(Math.random() * 65536); v.length() < E; ) {
|
|
3409
3413
|
N = 16807 * (i & 65535), b = 16807 * (i >> 16), N += (b & 32767) << 16, N += b >> 15, N = (N & 2147483647) + (N >> 31), i = N & 4294967295;
|
|
3410
|
-
for (var
|
|
3411
|
-
d = i >>> (
|
|
3414
|
+
for (var m = 0; m < 3; ++m)
|
|
3415
|
+
d = i >>> (m << 3), d ^= Math.floor(Math.random() * 256), v.putByte(d & 255);
|
|
3412
3416
|
}
|
|
3413
|
-
return
|
|
3417
|
+
return v.getBytes(E);
|
|
3414
3418
|
}
|
|
3415
3419
|
return e ? (S.seedFile = function(E, l) {
|
|
3416
|
-
e.randomBytes(E, function(
|
|
3417
|
-
if (
|
|
3418
|
-
return l(
|
|
3420
|
+
e.randomBytes(E, function(y, A) {
|
|
3421
|
+
if (y)
|
|
3422
|
+
return l(y);
|
|
3419
3423
|
l(null, A.toString());
|
|
3420
3424
|
});
|
|
3421
3425
|
}, S.seedFileSync = function(E) {
|
|
@@ -3423,30 +3427,30 @@ function _a() {
|
|
|
3423
3427
|
}) : (S.seedFile = function(E, l) {
|
|
3424
3428
|
try {
|
|
3425
3429
|
l(null, D(E));
|
|
3426
|
-
} catch (
|
|
3427
|
-
l(
|
|
3430
|
+
} catch (y) {
|
|
3431
|
+
l(y);
|
|
3428
3432
|
}
|
|
3429
3433
|
}, S.seedFileSync = D), S.collect = function(E) {
|
|
3430
|
-
for (var l = E.length,
|
|
3431
|
-
S.pools[S.pool].update(E.substr(
|
|
3434
|
+
for (var l = E.length, y = 0; y < l; ++y)
|
|
3435
|
+
S.pools[S.pool].update(E.substr(y, 1)), S.pool = S.pool === 31 ? 0 : S.pool + 1;
|
|
3432
3436
|
}, S.collectInt = function(E, l) {
|
|
3433
|
-
for (var
|
|
3434
|
-
|
|
3435
|
-
S.collect(
|
|
3437
|
+
for (var y = "", A = 0; A < l; A += 8)
|
|
3438
|
+
y += String.fromCharCode(E >> A & 255);
|
|
3439
|
+
S.collect(y);
|
|
3436
3440
|
}, S.registerWorker = function(E) {
|
|
3437
3441
|
if (E === self)
|
|
3438
|
-
S.seedFile = function(
|
|
3439
|
-
function
|
|
3442
|
+
S.seedFile = function(y, A) {
|
|
3443
|
+
function v(s) {
|
|
3440
3444
|
var h = s.data;
|
|
3441
|
-
h.forge && h.forge.prng && (self.removeEventListener("message",
|
|
3445
|
+
h.forge && h.forge.prng && (self.removeEventListener("message", v), A(h.forge.prng.err, h.forge.prng.bytes));
|
|
3442
3446
|
}
|
|
3443
|
-
self.addEventListener("message",
|
|
3447
|
+
self.addEventListener("message", v), self.postMessage({ forge: { prng: { needed: y } } });
|
|
3444
3448
|
};
|
|
3445
3449
|
else {
|
|
3446
|
-
var l = function(
|
|
3447
|
-
var A =
|
|
3448
|
-
A.forge && A.forge.prng && S.seedFile(A.forge.prng.needed, function(
|
|
3449
|
-
E.postMessage({ forge: { prng: { err:
|
|
3450
|
+
var l = function(y) {
|
|
3451
|
+
var A = y.data;
|
|
3452
|
+
A.forge && A.forge.prng && S.seedFile(A.forge.prng.needed, function(v, s) {
|
|
3453
|
+
E.postMessage({ forge: { prng: { err: v, bytes: s } } });
|
|
3450
3454
|
});
|
|
3451
3455
|
};
|
|
3452
3456
|
E.addEventListener("message", l);
|
|
@@ -3479,8 +3483,8 @@ function dt() {
|
|
|
3479
3483
|
}, a.md = t.md.sha256;
|
|
3480
3484
|
function C() {
|
|
3481
3485
|
var E = t.prng.create(a);
|
|
3482
|
-
return E.getBytes = function(l,
|
|
3483
|
-
return E.generate(l,
|
|
3486
|
+
return E.getBytes = function(l, y) {
|
|
3487
|
+
return E.generate(l, y);
|
|
3484
3488
|
}, E.getBytesSync = function(l) {
|
|
3485
3489
|
return E.generate(l);
|
|
3486
3490
|
}, E;
|
|
@@ -3791,19 +3795,19 @@ function $a() {
|
|
|
3791
3795
|
return g;
|
|
3792
3796
|
};
|
|
3793
3797
|
var C = function(c, r, g) {
|
|
3794
|
-
var u = !1, I = null, D = null, E = null, l,
|
|
3798
|
+
var u = !1, I = null, D = null, E = null, l, y, A, v, s = [];
|
|
3795
3799
|
for (c = t.rc2.expandKey(c, r), A = 0; A < 64; A++)
|
|
3796
3800
|
s.push(c.getInt16Le());
|
|
3797
3801
|
g ? (l = function(b) {
|
|
3798
3802
|
for (A = 0; A < 4; A++)
|
|
3799
|
-
b[A] += s[
|
|
3800
|
-
},
|
|
3803
|
+
b[A] += s[v] + (b[(A + 3) % 4] & b[(A + 2) % 4]) + (~b[(A + 3) % 4] & b[(A + 1) % 4]), b[A] = p(b[A], a[A]), v++;
|
|
3804
|
+
}, y = function(b) {
|
|
3801
3805
|
for (A = 0; A < 4; A++)
|
|
3802
3806
|
b[A] += s[b[(A + 3) % 4] & 63];
|
|
3803
3807
|
}) : (l = function(b) {
|
|
3804
3808
|
for (A = 3; A >= 0; A--)
|
|
3805
|
-
b[A] = S(b[A], a[A]), b[A] -= s[
|
|
3806
|
-
},
|
|
3809
|
+
b[A] = S(b[A], a[A]), b[A] -= s[v] + (b[(A + 3) % 4] & b[(A + 2) % 4]) + (~b[(A + 3) % 4] & b[(A + 1) % 4]), v--;
|
|
3810
|
+
}, y = function(b) {
|
|
3807
3811
|
for (A = 3; A >= 0; A--)
|
|
3808
3812
|
b[A] -= s[b[(A + 3) % 4] & 63];
|
|
3809
3813
|
});
|
|
@@ -3813,14 +3817,14 @@ function $a() {
|
|
|
3813
3817
|
var d = I.getInt16Le();
|
|
3814
3818
|
E !== null && (g ? d ^= E.getInt16Le() : E.putInt16Le(d)), N.push(d & 65535);
|
|
3815
3819
|
}
|
|
3816
|
-
|
|
3820
|
+
v = g ? 0 : 63;
|
|
3817
3821
|
for (var i = 0; i < b.length; i++)
|
|
3818
3822
|
for (var n = 0; n < b[i][0]; n++)
|
|
3819
3823
|
b[i][1](N);
|
|
3820
3824
|
for (A = 0; A < 4; A++)
|
|
3821
3825
|
E !== null && (g ? E.putInt16Le(N[A]) : N[A] ^= E.getInt16Le()), D.putInt16Le(N[A]);
|
|
3822
|
-
},
|
|
3823
|
-
return
|
|
3826
|
+
}, m = null;
|
|
3827
|
+
return m = {
|
|
3824
3828
|
/**
|
|
3825
3829
|
* Starts or restarts the encryption or decryption process, whichever
|
|
3826
3830
|
* was previously configured.
|
|
@@ -3832,7 +3836,7 @@ function $a() {
|
|
|
3832
3836
|
* @param output the output the buffer to write to, null to create one.
|
|
3833
3837
|
*/
|
|
3834
3838
|
start: function(b, N) {
|
|
3835
|
-
b && typeof b == "string" && (b = t.util.createBuffer(b)), u = !1, I = t.util.createBuffer(), D = N || new t.util.createBuffer(), E = b,
|
|
3839
|
+
b && typeof b == "string" && (b = t.util.createBuffer(b)), u = !1, I = t.util.createBuffer(), D = N || new t.util.createBuffer(), E = b, m.output = D;
|
|
3836
3840
|
},
|
|
3837
3841
|
/**
|
|
3838
3842
|
* Updates the next block.
|
|
@@ -3843,9 +3847,9 @@ function $a() {
|
|
|
3843
3847
|
for (u || I.putBuffer(b); I.length() >= 8; )
|
|
3844
3848
|
h([
|
|
3845
3849
|
[5, l],
|
|
3846
|
-
[1,
|
|
3850
|
+
[1, y],
|
|
3847
3851
|
[6, l],
|
|
3848
|
-
[1,
|
|
3852
|
+
[1, y],
|
|
3849
3853
|
[5, l]
|
|
3850
3854
|
]);
|
|
3851
3855
|
},
|
|
@@ -3866,7 +3870,7 @@ function $a() {
|
|
|
3866
3870
|
var d = I.length() === 8 ? 8 : 8 - I.length();
|
|
3867
3871
|
I.fillWithByte(d, d);
|
|
3868
3872
|
}
|
|
3869
|
-
if (N && (u = !0,
|
|
3873
|
+
if (N && (u = !0, m.update()), !g && (N = I.length() === 0, N))
|
|
3870
3874
|
if (b)
|
|
3871
3875
|
N = b(8, D, !g);
|
|
3872
3876
|
else {
|
|
@@ -3875,7 +3879,7 @@ function $a() {
|
|
|
3875
3879
|
}
|
|
3876
3880
|
return N;
|
|
3877
3881
|
}
|
|
3878
|
-
},
|
|
3882
|
+
}, m;
|
|
3879
3883
|
};
|
|
3880
3884
|
return t.rc2.startEncrypting = function(c, r, g) {
|
|
3881
3885
|
var u = t.rc2.createEncryptionCipher(c, 128);
|
|
@@ -3903,22 +3907,22 @@ function Zt() {
|
|
|
3903
3907
|
function p() {
|
|
3904
3908
|
return new a(null);
|
|
3905
3909
|
}
|
|
3906
|
-
function S(B, R, L, H, Y,
|
|
3907
|
-
for (; --
|
|
3910
|
+
function S(B, R, L, H, Y, W) {
|
|
3911
|
+
for (; --W >= 0; ) {
|
|
3908
3912
|
var ne = R * this.data[B++] + L.data[H] + Y;
|
|
3909
3913
|
Y = Math.floor(ne / 67108864), L.data[H++] = ne & 67108863;
|
|
3910
3914
|
}
|
|
3911
3915
|
return Y;
|
|
3912
3916
|
}
|
|
3913
|
-
function C(B, R, L, H, Y,
|
|
3914
|
-
for (var ne = R & 32767, ae = R >> 15; --
|
|
3917
|
+
function C(B, R, L, H, Y, W) {
|
|
3918
|
+
for (var ne = R & 32767, ae = R >> 15; --W >= 0; ) {
|
|
3915
3919
|
var Ae = this.data[B] & 32767, xe = this.data[B++] >> 15, it = ae * Ae + xe * ne;
|
|
3916
3920
|
Ae = ne * Ae + ((it & 32767) << 15) + L.data[H] + (Y & 1073741823), Y = (Ae >>> 30) + (it >>> 15) + ae * xe + (Y >>> 30), L.data[H++] = Ae & 1073741823;
|
|
3917
3921
|
}
|
|
3918
3922
|
return Y;
|
|
3919
3923
|
}
|
|
3920
|
-
function c(B, R, L, H, Y,
|
|
3921
|
-
for (var ne = R & 16383, ae = R >> 14; --
|
|
3924
|
+
function c(B, R, L, H, Y, W) {
|
|
3925
|
+
for (var ne = R & 16383, ae = R >> 14; --W >= 0; ) {
|
|
3922
3926
|
var Ae = this.data[B] & 16383, xe = this.data[B++] >> 14, it = ae * Ae + xe * ne;
|
|
3923
3927
|
Ae = ne * Ae + ((it & 16383) << 14) + L.data[H] + Y, Y = (Ae >> 28) + (it >> 14) + ae * xe, L.data[H++] = Ae & 268435455;
|
|
3924
3928
|
}
|
|
@@ -3938,14 +3942,14 @@ function Zt() {
|
|
|
3938
3942
|
var L = u[B.charCodeAt(R)];
|
|
3939
3943
|
return L ?? -1;
|
|
3940
3944
|
}
|
|
3941
|
-
function
|
|
3945
|
+
function y(B) {
|
|
3942
3946
|
for (var R = this.t - 1; R >= 0; --R) B.data[R] = this.data[R];
|
|
3943
3947
|
B.t = this.t, B.s = this.s;
|
|
3944
3948
|
}
|
|
3945
3949
|
function A(B) {
|
|
3946
3950
|
this.t = 1, this.s = B < 0 ? -1 : 0, B > 0 ? this.data[0] = B : B < -1 ? this.data[0] = B + this.DV : this.t = 0;
|
|
3947
3951
|
}
|
|
3948
|
-
function
|
|
3952
|
+
function v(B) {
|
|
3949
3953
|
var R = p();
|
|
3950
3954
|
return R.fromInt(B), R;
|
|
3951
3955
|
}
|
|
@@ -3962,20 +3966,20 @@ function Zt() {
|
|
|
3962
3966
|
return;
|
|
3963
3967
|
}
|
|
3964
3968
|
this.t = 0, this.s = 0;
|
|
3965
|
-
for (var H = B.length, Y = !1,
|
|
3969
|
+
for (var H = B.length, Y = !1, W = 0; --H >= 0; ) {
|
|
3966
3970
|
var ne = L == 8 ? B[H] & 255 : l(B, H);
|
|
3967
3971
|
if (ne < 0) {
|
|
3968
3972
|
B.charAt(H) == "-" && (Y = !0);
|
|
3969
3973
|
continue;
|
|
3970
3974
|
}
|
|
3971
|
-
Y = !1,
|
|
3975
|
+
Y = !1, W == 0 ? this.data[this.t++] = ne : W + L > this.DB ? (this.data[this.t - 1] |= (ne & (1 << this.DB - W) - 1) << W, this.data[this.t++] = ne >> this.DB - W) : this.data[this.t - 1] |= ne << W, W += L, W >= this.DB && (W -= this.DB);
|
|
3972
3976
|
}
|
|
3973
|
-
L == 8 && (B[0] & 128) != 0 && (this.s = -1,
|
|
3977
|
+
L == 8 && (B[0] & 128) != 0 && (this.s = -1, W > 0 && (this.data[this.t - 1] |= (1 << this.DB - W) - 1 << W)), this.clamp(), Y && a.ZERO.subTo(this, this);
|
|
3974
3978
|
}
|
|
3975
3979
|
function h() {
|
|
3976
3980
|
for (var B = this.s & this.DM; this.t > 0 && this.data[this.t - 1] == B; ) --this.t;
|
|
3977
3981
|
}
|
|
3978
|
-
function
|
|
3982
|
+
function m(B) {
|
|
3979
3983
|
if (this.s < 0) return "-" + this.negate().toString(B);
|
|
3980
3984
|
var R;
|
|
3981
3985
|
if (B == 16) R = 4;
|
|
@@ -3984,11 +3988,11 @@ function Zt() {
|
|
|
3984
3988
|
else if (B == 32) R = 5;
|
|
3985
3989
|
else if (B == 4) R = 2;
|
|
3986
3990
|
else return this.toRadix(B);
|
|
3987
|
-
var L = (1 << R) - 1, H, Y = !1,
|
|
3991
|
+
var L = (1 << R) - 1, H, Y = !1, W = "", ne = this.t, ae = this.DB - ne * this.DB % R;
|
|
3988
3992
|
if (ne-- > 0)
|
|
3989
|
-
for (ae < this.DB && (H = this.data[ne] >> ae) > 0 && (Y = !0,
|
|
3990
|
-
ae < R ? (H = (this.data[ne] & (1 << ae) - 1) << R - ae, H |= this.data[--ne] >> (ae += this.DB - R)) : (H = this.data[ne] >> (ae -= R) & L, ae <= 0 && (ae += this.DB, --ne)), H > 0 && (Y = !0), Y && (
|
|
3991
|
-
return Y ?
|
|
3993
|
+
for (ae < this.DB && (H = this.data[ne] >> ae) > 0 && (Y = !0, W = E(H)); ne >= 0; )
|
|
3994
|
+
ae < R ? (H = (this.data[ne] & (1 << ae) - 1) << R - ae, H |= this.data[--ne] >> (ae += this.DB - R)) : (H = this.data[ne] >> (ae -= R) & L, ae <= 0 && (ae += this.DB, --ne)), H > 0 && (Y = !0), Y && (W += E(H));
|
|
3995
|
+
return Y ? W : "0";
|
|
3992
3996
|
}
|
|
3993
3997
|
function b() {
|
|
3994
3998
|
var B = p();
|
|
@@ -4023,11 +4027,11 @@ function Zt() {
|
|
|
4023
4027
|
R.t = Math.max(this.t - B, 0), R.s = this.s;
|
|
4024
4028
|
}
|
|
4025
4029
|
function V(B, R) {
|
|
4026
|
-
var L = B % this.DB, H = this.DB - L, Y = (1 << H) - 1,
|
|
4030
|
+
var L = B % this.DB, H = this.DB - L, Y = (1 << H) - 1, W = Math.floor(B / this.DB), ne = this.s << L & this.DM, ae;
|
|
4027
4031
|
for (ae = this.t - 1; ae >= 0; --ae)
|
|
4028
|
-
R.data[ae +
|
|
4029
|
-
for (ae =
|
|
4030
|
-
R.data[
|
|
4032
|
+
R.data[ae + W + 1] = this.data[ae] >> H | ne, ne = (this.data[ae] & Y) << L;
|
|
4033
|
+
for (ae = W - 1; ae >= 0; --ae) R.data[ae] = 0;
|
|
4034
|
+
R.data[W] = ne, R.t = this.t + W + 1, R.s = this.s, R.clamp();
|
|
4031
4035
|
}
|
|
4032
4036
|
function O(B, R) {
|
|
4033
4037
|
R.s = this.s;
|
|
@@ -4036,11 +4040,11 @@ function Zt() {
|
|
|
4036
4040
|
R.t = 0;
|
|
4037
4041
|
return;
|
|
4038
4042
|
}
|
|
4039
|
-
var H = B % this.DB, Y = this.DB - H,
|
|
4043
|
+
var H = B % this.DB, Y = this.DB - H, W = (1 << H) - 1;
|
|
4040
4044
|
R.data[0] = this.data[L] >> H;
|
|
4041
4045
|
for (var ne = L + 1; ne < this.t; ++ne)
|
|
4042
|
-
R.data[ne - L - 1] |= (this.data[ne] &
|
|
4043
|
-
H > 0 && (R.data[this.t - L - 1] |= (this.s &
|
|
4046
|
+
R.data[ne - L - 1] |= (this.data[ne] & W) << Y, R.data[ne - L] = this.data[ne] >> H;
|
|
4047
|
+
H > 0 && (R.data[this.t - L - 1] |= (this.s & W) << Y), R.t = this.t - L, R.clamp();
|
|
4044
4048
|
}
|
|
4045
4049
|
function M(B, R) {
|
|
4046
4050
|
for (var L = 0, H = 0, Y = Math.min(B.t, this.t); L < Y; )
|
|
@@ -4079,16 +4083,16 @@ function Zt() {
|
|
|
4079
4083
|
return;
|
|
4080
4084
|
}
|
|
4081
4085
|
L == null && (L = p());
|
|
4082
|
-
var
|
|
4083
|
-
Ae > 0 ? (H.lShiftTo(Ae,
|
|
4084
|
-
var xe =
|
|
4086
|
+
var W = p(), ne = this.s, ae = B.s, Ae = this.DB - i(H.data[H.t - 1]);
|
|
4087
|
+
Ae > 0 ? (H.lShiftTo(Ae, W), Y.lShiftTo(Ae, L)) : (H.copyTo(W), Y.copyTo(L));
|
|
4088
|
+
var xe = W.t, it = W.data[xe - 1];
|
|
4085
4089
|
if (it != 0) {
|
|
4086
|
-
var rt = it * (1 << this.F1) + (xe > 1 ?
|
|
4087
|
-
for (
|
|
4090
|
+
var rt = it * (1 << this.F1) + (xe > 1 ? W.data[xe - 2] >> this.F2 : 0), mt = this.FV / rt, Ht = (1 << this.F1) / rt, ct = 1 << this.F2, ft = L.t, xt = ft - xe, It = R ?? p();
|
|
4091
|
+
for (W.dlShiftTo(xt, It), L.compareTo(It) >= 0 && (L.data[L.t++] = 1, L.subTo(It, L)), a.ONE.dlShiftTo(xe, It), It.subTo(W, W); W.t < xe; ) W.data[W.t++] = 0;
|
|
4088
4092
|
for (; --xt >= 0; ) {
|
|
4089
4093
|
var _t = L.data[--ft] == it ? this.DM : Math.floor(L.data[ft] * mt + (L.data[ft - 1] + ct) * Ht);
|
|
4090
|
-
if ((L.data[ft] +=
|
|
4091
|
-
for (
|
|
4094
|
+
if ((L.data[ft] += W.am(0, _t, L, xt, 0, xe)) < _t)
|
|
4095
|
+
for (W.dlShiftTo(xt, It), L.subTo(It, L); L.data[ft] < --_t; ) L.subTo(It, L);
|
|
4092
4096
|
}
|
|
4093
4097
|
R != null && (L.drShiftTo(xe, R), ne != ae && a.ZERO.subTo(R, R)), L.t = xe, L.clamp(), Ae > 0 && L.rShiftTo(Ae, L), ne < 0 && a.ZERO.subTo(L, L);
|
|
4094
4098
|
}
|
|
@@ -4104,7 +4108,7 @@ function Zt() {
|
|
|
4104
4108
|
function re(B) {
|
|
4105
4109
|
return B.s < 0 || B.compareTo(this.m) >= 0 ? B.mod(this.m) : B;
|
|
4106
4110
|
}
|
|
4107
|
-
function
|
|
4111
|
+
function Z(B) {
|
|
4108
4112
|
return B;
|
|
4109
4113
|
}
|
|
4110
4114
|
function se(B) {
|
|
@@ -4116,7 +4120,7 @@ function Zt() {
|
|
|
4116
4120
|
function me(B, R) {
|
|
4117
4121
|
B.squareTo(R), this.reduce(R);
|
|
4118
4122
|
}
|
|
4119
|
-
$.prototype.convert = re, $.prototype.revert =
|
|
4123
|
+
$.prototype.convert = re, $.prototype.revert = Z, $.prototype.reduce = se, $.prototype.mulTo = de, $.prototype.sqrTo = me;
|
|
4120
4124
|
function _() {
|
|
4121
4125
|
if (this.t < 1) return 0;
|
|
4122
4126
|
var B = this.data[0];
|
|
@@ -4157,9 +4161,9 @@ function Zt() {
|
|
|
4157
4161
|
}
|
|
4158
4162
|
function o(B, R) {
|
|
4159
4163
|
if (B > 4294967295 || B < 1) return a.ONE;
|
|
4160
|
-
var L = p(), H = p(), Y = R.convert(this),
|
|
4161
|
-
for (Y.copyTo(L); --
|
|
4162
|
-
if (R.sqrTo(L, H), (B & 1 <<
|
|
4164
|
+
var L = p(), H = p(), Y = R.convert(this), W = i(B) - 1;
|
|
4165
|
+
for (Y.copyTo(L); --W >= 0; )
|
|
4166
|
+
if (R.sqrTo(L, H), (B & 1 << W) > 0) R.mulTo(H, Y, L);
|
|
4163
4167
|
else {
|
|
4164
4168
|
var ne = L;
|
|
4165
4169
|
L = H, H = ne;
|
|
@@ -4170,7 +4174,7 @@ function Zt() {
|
|
|
4170
4174
|
var L;
|
|
4171
4175
|
return B < 256 || R.isEven() ? L = new $(R) : L = new ue(R), this.exp(B, L);
|
|
4172
4176
|
}
|
|
4173
|
-
a.prototype.copyTo =
|
|
4177
|
+
a.prototype.copyTo = y, a.prototype.fromInt = A, a.prototype.fromString = s, a.prototype.clamp = h, a.prototype.dlShiftTo = k, a.prototype.drShiftTo = P, a.prototype.lShiftTo = V, a.prototype.rShiftTo = O, a.prototype.subTo = M, a.prototype.multiplyTo = Q, a.prototype.squareTo = G, a.prototype.divRemTo = z, a.prototype.invDigit = _, a.prototype.isEven = U, a.prototype.exp = o, a.prototype.toString = m, a.prototype.negate = b, a.prototype.abs = N, a.prototype.compareTo = d, a.prototype.bitLength = n, a.prototype.mod = J, a.prototype.modPowInt = T, a.ZERO = v(0), a.ONE = v(1);
|
|
4174
4178
|
function j() {
|
|
4175
4179
|
var B = p();
|
|
4176
4180
|
return this.copyTo(B), B;
|
|
@@ -4199,22 +4203,22 @@ function Zt() {
|
|
|
4199
4203
|
}
|
|
4200
4204
|
function ee(B) {
|
|
4201
4205
|
if (B == null && (B = 10), this.signum() == 0 || B < 2 || B > 36) return "0";
|
|
4202
|
-
var R = this.chunkSize(B), L = Math.pow(B, R), H =
|
|
4203
|
-
for (this.divRemTo(H, Y,
|
|
4204
|
-
ne = (L +
|
|
4205
|
-
return
|
|
4206
|
+
var R = this.chunkSize(B), L = Math.pow(B, R), H = v(L), Y = p(), W = p(), ne = "";
|
|
4207
|
+
for (this.divRemTo(H, Y, W); Y.signum() > 0; )
|
|
4208
|
+
ne = (L + W.intValue()).toString(B).substr(1) + ne, Y.divRemTo(H, Y, W);
|
|
4209
|
+
return W.intValue().toString(B) + ne;
|
|
4206
4210
|
}
|
|
4207
4211
|
function oe(B, R) {
|
|
4208
4212
|
this.fromInt(0), R == null && (R = 10);
|
|
4209
|
-
for (var L = this.chunkSize(R), H = Math.pow(R, L), Y = !1,
|
|
4213
|
+
for (var L = this.chunkSize(R), H = Math.pow(R, L), Y = !1, W = 0, ne = 0, ae = 0; ae < B.length; ++ae) {
|
|
4210
4214
|
var Ae = l(B, ae);
|
|
4211
4215
|
if (Ae < 0) {
|
|
4212
4216
|
B.charAt(ae) == "-" && this.signum() == 0 && (Y = !0);
|
|
4213
4217
|
continue;
|
|
4214
4218
|
}
|
|
4215
|
-
ne = R * ne + Ae, ++
|
|
4219
|
+
ne = R * ne + Ae, ++W >= L && (this.dMultiply(H), this.dAddOffset(ne, 0), W = 0, ne = 0);
|
|
4216
4220
|
}
|
|
4217
|
-
|
|
4221
|
+
W > 0 && (this.dMultiply(Math.pow(R, W)), this.dAddOffset(ne, 0)), Y && a.ZERO.subTo(this, this);
|
|
4218
4222
|
}
|
|
4219
4223
|
function ge(B, R, L) {
|
|
4220
4224
|
if (typeof R == "number")
|
|
@@ -4246,13 +4250,13 @@ function Zt() {
|
|
|
4246
4250
|
return this.compareTo(B) > 0 ? this : B;
|
|
4247
4251
|
}
|
|
4248
4252
|
function Se(B, R, L) {
|
|
4249
|
-
var H, Y,
|
|
4250
|
-
for (H = 0; H <
|
|
4253
|
+
var H, Y, W = Math.min(B.t, this.t);
|
|
4254
|
+
for (H = 0; H < W; ++H) L.data[H] = R(this.data[H], B.data[H]);
|
|
4251
4255
|
if (B.t < this.t) {
|
|
4252
|
-
for (Y = B.s & this.DM, H =
|
|
4256
|
+
for (Y = B.s & this.DM, H = W; H < this.t; ++H) L.data[H] = R(this.data[H], Y);
|
|
4253
4257
|
L.t = this.t;
|
|
4254
4258
|
} else {
|
|
4255
|
-
for (Y = this.s & this.DM, H =
|
|
4259
|
+
for (Y = this.s & this.DM, H = W; H < B.t; ++H) L.data[H] = R(Y, B.data[H]);
|
|
4256
4260
|
L.t = B.t;
|
|
4257
4261
|
}
|
|
4258
4262
|
L.s = R(this.s, B.s), L.clamp();
|
|
@@ -4436,14 +4440,14 @@ function Zt() {
|
|
|
4436
4440
|
}
|
|
4437
4441
|
wt.prototype.convert = hn, wt.prototype.revert = gn, wt.prototype.reduce = yn, wt.prototype.mulTo = mn, wt.prototype.sqrTo = vn;
|
|
4438
4442
|
function An(B, R) {
|
|
4439
|
-
var L = B.bitLength(), H, Y =
|
|
4443
|
+
var L = B.bitLength(), H, Y = v(1), W;
|
|
4440
4444
|
if (L <= 0) return Y;
|
|
4441
|
-
L < 18 ? H = 1 : L < 48 ? H = 3 : L < 144 ? H = 4 : L < 768 ? H = 5 : H = 6, L < 8 ?
|
|
4445
|
+
L < 18 ? H = 1 : L < 48 ? H = 3 : L < 144 ? H = 4 : L < 768 ? H = 5 : H = 6, L < 8 ? W = new $(R) : R.isEven() ? W = new wt(R) : W = new ue(R);
|
|
4442
4446
|
var ne = new Array(), ae = 3, Ae = H - 1, xe = (1 << H) - 1;
|
|
4443
|
-
if (ne[1] =
|
|
4447
|
+
if (ne[1] = W.convert(this), H > 1) {
|
|
4444
4448
|
var it = p();
|
|
4445
|
-
for (
|
|
4446
|
-
ne[ae] = p(),
|
|
4449
|
+
for (W.sqrTo(ne[1], it); ae <= xe; )
|
|
4450
|
+
ne[ae] = p(), W.mulTo(it, ne[ae - 2], ne[ae]), ae += 2;
|
|
4447
4451
|
}
|
|
4448
4452
|
var rt = B.t - 1, mt, Ht = !0, ct = p(), ft;
|
|
4449
4453
|
for (L = i(B.data[rt]) - 1; rt >= 0; ) {
|
|
@@ -4453,13 +4457,13 @@ function Zt() {
|
|
|
4453
4457
|
ne[mt].copyTo(Y), Ht = !1;
|
|
4454
4458
|
else {
|
|
4455
4459
|
for (; ae > 1; )
|
|
4456
|
-
|
|
4457
|
-
ae > 0 ?
|
|
4460
|
+
W.sqrTo(Y, ct), W.sqrTo(ct, Y), ae -= 2;
|
|
4461
|
+
ae > 0 ? W.sqrTo(Y, ct) : (ft = Y, Y = ct, ct = ft), W.mulTo(ct, ne[mt], Y);
|
|
4458
4462
|
}
|
|
4459
4463
|
for (; rt >= 0 && (B.data[rt] & 1 << L) == 0; )
|
|
4460
|
-
|
|
4464
|
+
W.sqrTo(Y, ct), ft = Y, Y = ct, ct = ft, --L < 0 && (L = this.DB - 1, --rt);
|
|
4461
4465
|
}
|
|
4462
|
-
return
|
|
4466
|
+
return W.revert(Y);
|
|
4463
4467
|
}
|
|
4464
4468
|
function Cn(B) {
|
|
4465
4469
|
var R = this.s < 0 ? this.negate() : this.clone(), L = B.s < 0 ? B.negate() : B.clone();
|
|
@@ -4467,11 +4471,11 @@ function Zt() {
|
|
|
4467
4471
|
var H = R;
|
|
4468
4472
|
R = L, L = H;
|
|
4469
4473
|
}
|
|
4470
|
-
var Y = R.getLowestSetBit(),
|
|
4471
|
-
if (
|
|
4472
|
-
for (Y <
|
|
4474
|
+
var Y = R.getLowestSetBit(), W = L.getLowestSetBit();
|
|
4475
|
+
if (W < 0) return R;
|
|
4476
|
+
for (Y < W && (W = Y), W > 0 && (R.rShiftTo(W, R), L.rShiftTo(W, L)); R.signum() > 0; )
|
|
4473
4477
|
(Y = R.getLowestSetBit()) > 0 && R.rShiftTo(Y, R), (Y = L.getLowestSetBit()) > 0 && L.rShiftTo(Y, L), R.compareTo(L) >= 0 ? (R.subTo(L, R), R.rShiftTo(1, R)) : (L.subTo(R, L), L.rShiftTo(1, L));
|
|
4474
|
-
return
|
|
4478
|
+
return W > 0 && L.lShiftTo(W, L), L;
|
|
4475
4479
|
}
|
|
4476
4480
|
function En(B) {
|
|
4477
4481
|
if (B <= 0) return 0;
|
|
@@ -4484,12 +4488,12 @@ function Zt() {
|
|
|
4484
4488
|
function In(B) {
|
|
4485
4489
|
var R = B.isEven();
|
|
4486
4490
|
if (this.isEven() && R || B.signum() == 0) return a.ZERO;
|
|
4487
|
-
for (var L = B.clone(), H = this.clone(), Y =
|
|
4491
|
+
for (var L = B.clone(), H = this.clone(), Y = v(1), W = v(0), ne = v(0), ae = v(1); L.signum() != 0; ) {
|
|
4488
4492
|
for (; L.isEven(); )
|
|
4489
|
-
L.rShiftTo(1, L), R ? ((!Y.isEven() || !
|
|
4493
|
+
L.rShiftTo(1, L), R ? ((!Y.isEven() || !W.isEven()) && (Y.addTo(this, Y), W.subTo(B, W)), Y.rShiftTo(1, Y)) : W.isEven() || W.subTo(B, W), W.rShiftTo(1, W);
|
|
4490
4494
|
for (; H.isEven(); )
|
|
4491
4495
|
H.rShiftTo(1, H), R ? ((!ne.isEven() || !ae.isEven()) && (ne.addTo(this, ne), ae.subTo(B, ae)), ne.rShiftTo(1, ne)) : ae.isEven() || ae.subTo(B, ae), ae.rShiftTo(1, ae);
|
|
4492
|
-
L.compareTo(H) >= 0 ? (L.subTo(H, L), R && Y.subTo(ne, Y),
|
|
4496
|
+
L.compareTo(H) >= 0 ? (L.subTo(H, L), R && Y.subTo(ne, Y), W.subTo(ae, W)) : (H.subTo(L, H), R && ne.subTo(Y, ne), ae.subTo(W, ae));
|
|
4493
4497
|
}
|
|
4494
4498
|
if (H.compareTo(a.ONE) != 0) return a.ZERO;
|
|
4495
4499
|
if (ae.compareTo(B) >= 0) return ae.subtract(B);
|
|
@@ -4515,11 +4519,11 @@ function Zt() {
|
|
|
4515
4519
|
function bn(B) {
|
|
4516
4520
|
var R = this.subtract(a.ONE), L = R.getLowestSetBit();
|
|
4517
4521
|
if (L <= 0) return !1;
|
|
4518
|
-
for (var H = R.shiftRight(L), Y = Tn(),
|
|
4522
|
+
for (var H = R.shiftRight(L), Y = Tn(), W, ne = 0; ne < B; ++ne) {
|
|
4519
4523
|
do
|
|
4520
|
-
|
|
4521
|
-
while (
|
|
4522
|
-
var ae =
|
|
4524
|
+
W = new a(this.bitLength(), Y);
|
|
4525
|
+
while (W.compareTo(a.ONE) <= 0 || W.compareTo(R) >= 0);
|
|
4526
|
+
var ae = W.modPow(H, this);
|
|
4523
4527
|
if (ae.compareTo(a.ONE) != 0 && ae.compareTo(R) != 0) {
|
|
4524
4528
|
for (var Ae = 1; Ae++ < L && ae.compareTo(R) != 0; )
|
|
4525
4529
|
if (ae = ae.modPowInt(2, this), ae.compareTo(a.ONE) == 0) return !1;
|
|
@@ -4582,8 +4586,8 @@ function jt() {
|
|
|
4582
4586
|
I.putBytes(r.bytes());
|
|
4583
4587
|
var D = u.fullMessageLength[u.fullMessageLength.length - 1] + u.messageLengthSize, E = D & u.blockLength - 1;
|
|
4584
4588
|
I.putBytes(a.substr(0, u.blockLength - E));
|
|
4585
|
-
for (var l,
|
|
4586
|
-
l = u.fullMessageLength[
|
|
4589
|
+
for (var l, y, A = u.fullMessageLength[0] * 8, v = 0; v < u.fullMessageLength.length - 1; ++v)
|
|
4590
|
+
l = u.fullMessageLength[v + 1] * 8, y = l / 4294967296 >>> 0, A += y, I.putInt32(A >>> 0), A = l >>> 0;
|
|
4587
4591
|
I.putInt32(A);
|
|
4588
4592
|
var s = {
|
|
4589
4593
|
h0: c.h0,
|
|
@@ -4602,20 +4606,20 @@ function jt() {
|
|
|
4602
4606
|
a = "", a += t.util.fillString("\0", 64), p = !0;
|
|
4603
4607
|
}
|
|
4604
4608
|
function C(c, r, g) {
|
|
4605
|
-
for (var u, I, D, E, l,
|
|
4606
|
-
for (I = c.h0, D = c.h1, E = c.h2, l = c.h3,
|
|
4607
|
-
u = g.getInt32(), r[
|
|
4608
|
-
for (;
|
|
4609
|
-
u = r[
|
|
4610
|
-
for (;
|
|
4611
|
-
u = r[
|
|
4612
|
-
for (;
|
|
4613
|
-
u = r[
|
|
4614
|
-
for (;
|
|
4615
|
-
u = r[
|
|
4616
|
-
for (;
|
|
4617
|
-
u = r[
|
|
4618
|
-
c.h0 = c.h0 + I | 0, c.h1 = c.h1 + D | 0, c.h2 = c.h2 + E | 0, c.h3 = c.h3 + l | 0, c.h4 = c.h4 +
|
|
4609
|
+
for (var u, I, D, E, l, y, A, v, s = g.length(); s >= 64; ) {
|
|
4610
|
+
for (I = c.h0, D = c.h1, E = c.h2, l = c.h3, y = c.h4, v = 0; v < 16; ++v)
|
|
4611
|
+
u = g.getInt32(), r[v] = u, A = l ^ D & (E ^ l), u = (I << 5 | I >>> 27) + A + y + 1518500249 + u, y = l, l = E, E = (D << 30 | D >>> 2) >>> 0, D = I, I = u;
|
|
4612
|
+
for (; v < 20; ++v)
|
|
4613
|
+
u = r[v - 3] ^ r[v - 8] ^ r[v - 14] ^ r[v - 16], u = u << 1 | u >>> 31, r[v] = u, A = l ^ D & (E ^ l), u = (I << 5 | I >>> 27) + A + y + 1518500249 + u, y = l, l = E, E = (D << 30 | D >>> 2) >>> 0, D = I, I = u;
|
|
4614
|
+
for (; v < 32; ++v)
|
|
4615
|
+
u = r[v - 3] ^ r[v - 8] ^ r[v - 14] ^ r[v - 16], u = u << 1 | u >>> 31, r[v] = u, A = D ^ E ^ l, u = (I << 5 | I >>> 27) + A + y + 1859775393 + u, y = l, l = E, E = (D << 30 | D >>> 2) >>> 0, D = I, I = u;
|
|
4616
|
+
for (; v < 40; ++v)
|
|
4617
|
+
u = r[v - 6] ^ r[v - 16] ^ r[v - 28] ^ r[v - 32], u = u << 2 | u >>> 30, r[v] = u, A = D ^ E ^ l, u = (I << 5 | I >>> 27) + A + y + 1859775393 + u, y = l, l = E, E = (D << 30 | D >>> 2) >>> 0, D = I, I = u;
|
|
4618
|
+
for (; v < 60; ++v)
|
|
4619
|
+
u = r[v - 6] ^ r[v - 16] ^ r[v - 28] ^ r[v - 32], u = u << 2 | u >>> 30, r[v] = u, A = D & E | l & (D ^ E), u = (I << 5 | I >>> 27) + A + y + 2400959708 + u, y = l, l = E, E = (D << 30 | D >>> 2) >>> 0, D = I, I = u;
|
|
4620
|
+
for (; v < 80; ++v)
|
|
4621
|
+
u = r[v - 6] ^ r[v - 16] ^ r[v - 28] ^ r[v - 32], u = u << 2 | u >>> 30, r[v] = u, A = D ^ E ^ l, u = (I << 5 | I >>> 27) + A + y + 3395469782 + u, y = l, l = E, E = (D << 30 | D >>> 2) >>> 0, D = I, I = u;
|
|
4622
|
+
c.h0 = c.h0 + I | 0, c.h1 = c.h1 + D | 0, c.h2 = c.h2 + E | 0, c.h3 = c.h3 + l | 0, c.h4 = c.h4 + y | 0, s -= 64;
|
|
4619
4623
|
}
|
|
4620
4624
|
}
|
|
4621
4625
|
return Ir.exports;
|
|
@@ -4636,17 +4640,17 @@ function en() {
|
|
|
4636
4640
|
throw E.length = S.length, E.maxLength = D, E;
|
|
4637
4641
|
}
|
|
4638
4642
|
c || (c = ""), g.update(c, "raw");
|
|
4639
|
-
for (var l = g.digest(),
|
|
4640
|
-
|
|
4641
|
-
var s = l.getBytes() +
|
|
4643
|
+
for (var l = g.digest(), y = "", A = D - S.length, v = 0; v < A; v++)
|
|
4644
|
+
y += "\0";
|
|
4645
|
+
var s = l.getBytes() + y + "" + S;
|
|
4642
4646
|
if (!r)
|
|
4643
4647
|
r = t.random.getBytes(g.digestLength);
|
|
4644
4648
|
else if (r.length !== g.digestLength) {
|
|
4645
4649
|
var E = new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");
|
|
4646
4650
|
throw E.seedLength = r.length, E.digestLength = g.digestLength, E;
|
|
4647
4651
|
}
|
|
4648
|
-
var h = a(r, I - g.digestLength - 1, u),
|
|
4649
|
-
return "\0" + N +
|
|
4652
|
+
var h = a(r, I - g.digestLength - 1, u), m = t.util.xorBytes(s, h, s.length), b = a(m, g.digestLength, u), N = t.util.xorBytes(r, b, r.length);
|
|
4653
|
+
return "\0" + N + m;
|
|
4650
4654
|
}, e.decode_rsa_oaep = function(p, S, C) {
|
|
4651
4655
|
var c, r, g;
|
|
4652
4656
|
typeof C == "string" ? (c = C, r = arguments[3] || void 0) : C && (c = C.label || void 0, r = C.md || void 0, C.mgf1 && C.mgf1.md && (g = C.mgf1.md));
|
|
@@ -4658,8 +4662,8 @@ function en() {
|
|
|
4658
4662
|
if (r === void 0 ? r = t.md.sha1.create() : r.start(), g || (g = r), u < 2 * r.digestLength + 2)
|
|
4659
4663
|
throw new Error("RSAES-OAEP key is too short for the hash function.");
|
|
4660
4664
|
c || (c = ""), r.update(c, "raw");
|
|
4661
|
-
for (var D = r.digest().getBytes(), E = S.charAt(0), l = S.substring(1, r.digestLength + 1),
|
|
4662
|
-
I |= D.charAt(b) !==
|
|
4665
|
+
for (var D = r.digest().getBytes(), E = S.charAt(0), l = S.substring(1, r.digestLength + 1), y = S.substring(1 + r.digestLength), A = a(y, r.digestLength, g), v = t.util.xorBytes(l, A, l.length), s = a(v, u - r.digestLength - 1, g), h = t.util.xorBytes(y, s, y.length), m = h.substring(0, r.digestLength), I = E !== "\0", b = 0; b < r.digestLength; ++b)
|
|
4666
|
+
I |= D.charAt(b) !== m.charAt(b);
|
|
4663
4667
|
for (var N = 1, d = r.digestLength, i = r.digestLength; i < h.length; i++) {
|
|
4664
4668
|
var n = h.charCodeAt(i), k = n & 1 ^ 1, P = N ? 65534 : 0;
|
|
4665
4669
|
I |= n & P, N = N & k, d += N;
|
|
@@ -4698,45 +4702,45 @@ function tn() {
|
|
|
4698
4702
|
var C = function(E, l) {
|
|
4699
4703
|
return E | l;
|
|
4700
4704
|
};
|
|
4701
|
-
e.generateProbablePrime = function(E, l,
|
|
4702
|
-
typeof l == "function" && (
|
|
4705
|
+
e.generateProbablePrime = function(E, l, y) {
|
|
4706
|
+
typeof l == "function" && (y = l, l = {}), l = l || {};
|
|
4703
4707
|
var A = l.algorithm || "PRIMEINC";
|
|
4704
4708
|
typeof A == "string" && (A = { name: A }), A.options = A.options || {};
|
|
4705
|
-
var
|
|
4709
|
+
var v = l.prng || t.random, s = {
|
|
4706
4710
|
// x is an array to fill with bytes
|
|
4707
4711
|
nextBytes: function(h) {
|
|
4708
|
-
for (var
|
|
4709
|
-
h[b] =
|
|
4712
|
+
for (var m = v.getBytesSync(h.length), b = 0; b < h.length; ++b)
|
|
4713
|
+
h[b] = m.charCodeAt(b);
|
|
4710
4714
|
}
|
|
4711
4715
|
};
|
|
4712
4716
|
if (A.name === "PRIMEINC")
|
|
4713
|
-
return c(E, s, A.options,
|
|
4717
|
+
return c(E, s, A.options, y);
|
|
4714
4718
|
throw new Error("Invalid prime generation algorithm: " + A.name);
|
|
4715
4719
|
};
|
|
4716
|
-
function c(E, l,
|
|
4717
|
-
return "workers" in
|
|
4720
|
+
function c(E, l, y, A) {
|
|
4721
|
+
return "workers" in y ? u(E, l, y, A) : r(E, l, y, A);
|
|
4718
4722
|
}
|
|
4719
|
-
function r(E, l,
|
|
4720
|
-
var
|
|
4721
|
-
"millerRabinTests" in
|
|
4722
|
-
var
|
|
4723
|
-
"maxBlockTime" in
|
|
4723
|
+
function r(E, l, y, A) {
|
|
4724
|
+
var v = I(E, l), s = 0, h = D(v.bitLength());
|
|
4725
|
+
"millerRabinTests" in y && (h = y.millerRabinTests);
|
|
4726
|
+
var m = 10;
|
|
4727
|
+
"maxBlockTime" in y && (m = y.maxBlockTime), g(v, E, l, s, h, m, A);
|
|
4724
4728
|
}
|
|
4725
|
-
function g(E, l,
|
|
4726
|
-
var
|
|
4729
|
+
function g(E, l, y, A, v, s, h) {
|
|
4730
|
+
var m = +/* @__PURE__ */ new Date();
|
|
4727
4731
|
do {
|
|
4728
|
-
if (E.bitLength() > l && (E = I(l,
|
|
4732
|
+
if (E.bitLength() > l && (E = I(l, y)), E.isProbablePrime(v))
|
|
4729
4733
|
return h(null, E);
|
|
4730
4734
|
E.dAddOffset(p[A++ % 8], 0);
|
|
4731
|
-
} while (s < 0 || +/* @__PURE__ */ new Date() -
|
|
4735
|
+
} while (s < 0 || +/* @__PURE__ */ new Date() - m < s);
|
|
4732
4736
|
t.util.setImmediate(function() {
|
|
4733
|
-
g(E, l,
|
|
4737
|
+
g(E, l, y, A, v, s, h);
|
|
4734
4738
|
});
|
|
4735
4739
|
}
|
|
4736
|
-
function u(E, l,
|
|
4740
|
+
function u(E, l, y, A) {
|
|
4737
4741
|
if (typeof Worker > "u")
|
|
4738
|
-
return r(E, l,
|
|
4739
|
-
var
|
|
4742
|
+
return r(E, l, y, A);
|
|
4743
|
+
var v = I(E, l), s = y.workers, h = y.workLoad || 100, m = h * 30 / 8, b = y.workerScript || "forge/prime.worker.js";
|
|
4740
4744
|
if (s === -1)
|
|
4741
4745
|
return t.util.estimateCores(function(d, i) {
|
|
4742
4746
|
d && (i = 2), s = i - 1, N();
|
|
@@ -4757,19 +4761,19 @@ function tn() {
|
|
|
4757
4761
|
d[O].terminate();
|
|
4758
4762
|
return n = !0, A(null, new a(V.prime, 16));
|
|
4759
4763
|
}
|
|
4760
|
-
|
|
4761
|
-
var M =
|
|
4764
|
+
v.bitLength() > E && (v = I(E, l));
|
|
4765
|
+
var M = v.toString(16);
|
|
4762
4766
|
P.target.postMessage({
|
|
4763
4767
|
hex: M,
|
|
4764
4768
|
workLoad: h
|
|
4765
|
-
}),
|
|
4769
|
+
}), v.dAddOffset(m, 0);
|
|
4766
4770
|
}
|
|
4767
4771
|
}
|
|
4768
4772
|
}
|
|
4769
4773
|
}
|
|
4770
4774
|
function I(E, l) {
|
|
4771
|
-
var
|
|
4772
|
-
return
|
|
4775
|
+
var y = new a(E, l), A = E - 1;
|
|
4776
|
+
return y.testBit(A) || y.bitwiseTo(a.ONE.shiftLeft(A), C, y), y.dAddOffset(31 - y.mod(S).byteValue(), 0), y;
|
|
4773
4777
|
}
|
|
4774
4778
|
function D(E) {
|
|
4775
4779
|
return E <= 100 ? 27 : E <= 150 ? 18 : E <= 200 ? 15 : E <= 250 ? 12 : E <= 300 ? 9 : E <= 350 ? 8 : E <= 400 ? 7 : E <= 500 ? 6 : E <= 600 ? 5 : E <= 800 ? 4 : E <= 1250 ? 3 : 2;
|
|
@@ -5036,7 +5040,7 @@ function Wt() {
|
|
|
5036
5040
|
};
|
|
5037
5041
|
C.rsa.encrypt = function(i, n, k) {
|
|
5038
5042
|
var P = k, V, O = Math.ceil(n.n.bitLength() / 8);
|
|
5039
|
-
k !== !1 && k !== !0 ? (P = k === 2, V =
|
|
5043
|
+
k !== !1 && k !== !0 ? (P = k === 2, V = y(i, n, k)) : (V = t.util.createBuffer(), V.putBytes(i));
|
|
5040
5044
|
for (var M = new e(V.toHex(), 16), Q = l(M, n, P), G = Q.toString(16), z = t.util.createBuffer(), J = O - Math.ceil(G.length / 2); J > 0; )
|
|
5041
5045
|
z.putByte(0), --J;
|
|
5042
5046
|
return z.putBytes(t.util.hexToBytes(G)), z.getBytes();
|
|
@@ -5126,7 +5130,7 @@ function Wt() {
|
|
|
5126
5130
|
}, C.rsa.generateKeyPair = function(i, n, k, P) {
|
|
5127
5131
|
if (arguments.length === 1 ? typeof i == "object" ? (k = i, i = void 0) : typeof i == "function" && (P = i, i = void 0) : arguments.length === 2 ? typeof i == "number" ? typeof n == "function" ? (P = n, n = void 0) : typeof n != "number" && (k = n, n = void 0) : (k = i, P = n, i = void 0, n = void 0) : arguments.length === 3 && (typeof n == "number" ? typeof k == "function" && (P = k, k = void 0) : (P = k, k = n, n = void 0)), k = k || {}, i === void 0 && (i = k.bits || 2048), n === void 0 && (n = k.e || 65537), !t.options.usePureJavaScript && !k.prng && i >= 256 && i <= 16384 && (n === 65537 || n === 3)) {
|
|
5128
5132
|
if (P) {
|
|
5129
|
-
if (
|
|
5133
|
+
if (m("generateKeyPair"))
|
|
5130
5134
|
return a.generateKeyPair("rsa", {
|
|
5131
5135
|
modulusLength: i,
|
|
5132
5136
|
publicExponent: n,
|
|
@@ -5198,7 +5202,7 @@ function Wt() {
|
|
|
5198
5202
|
};
|
|
5199
5203
|
return;
|
|
5200
5204
|
}
|
|
5201
|
-
} else if (
|
|
5205
|
+
} else if (m("generateKeyPairSync")) {
|
|
5202
5206
|
var O = a.generateKeyPairSync("rsa", {
|
|
5203
5207
|
modulusLength: i,
|
|
5204
5208
|
publicExponent: n,
|
|
@@ -5220,7 +5224,7 @@ function Wt() {
|
|
|
5220
5224
|
var M = C.rsa.createKeyPairGenerationState(i, n, k);
|
|
5221
5225
|
if (!P)
|
|
5222
5226
|
return C.rsa.stepKeyPairGenerationState(M, 0), M.keys;
|
|
5223
|
-
|
|
5227
|
+
v(M, k, P);
|
|
5224
5228
|
}, C.setRsaPublicKey = C.rsa.setPublicKey = function(i, n) {
|
|
5225
5229
|
var k = {
|
|
5226
5230
|
n: i,
|
|
@@ -5230,7 +5234,7 @@ function Wt() {
|
|
|
5230
5234
|
if (typeof V == "string" ? V = V.toUpperCase() : V === void 0 && (V = "RSAES-PKCS1-V1_5"), V === "RSAES-PKCS1-V1_5")
|
|
5231
5235
|
V = {
|
|
5232
5236
|
encode: function(Q, G, z) {
|
|
5233
|
-
return
|
|
5237
|
+
return y(Q, G, 2).getBytes();
|
|
5234
5238
|
}
|
|
5235
5239
|
};
|
|
5236
5240
|
else if (V === "RSA-OAEP" || V === "RSAES-OAEP")
|
|
@@ -5257,17 +5261,17 @@ function Wt() {
|
|
|
5257
5261
|
parseAllBytes: M._parseAllDigestBytes
|
|
5258
5262
|
}), $ = {}, re = [];
|
|
5259
5263
|
if (!p.validate(J, D, $, re)) {
|
|
5260
|
-
var
|
|
5264
|
+
var Z = new Error(
|
|
5261
5265
|
"ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value."
|
|
5262
5266
|
);
|
|
5263
|
-
throw
|
|
5267
|
+
throw Z.errors = re, Z;
|
|
5264
5268
|
}
|
|
5265
5269
|
var se = p.derToOid($.algorithmIdentifier);
|
|
5266
5270
|
if (!(se === t.oids.md2 || se === t.oids.md5 || se === t.oids.sha1 || se === t.oids.sha224 || se === t.oids.sha256 || se === t.oids.sha384 || se === t.oids.sha512 || se === t.oids["sha512-224"] || se === t.oids["sha512-256"])) {
|
|
5267
|
-
var
|
|
5271
|
+
var Z = new Error(
|
|
5268
5272
|
"Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier."
|
|
5269
5273
|
);
|
|
5270
|
-
throw
|
|
5274
|
+
throw Z.oid = se, Z;
|
|
5271
5275
|
}
|
|
5272
5276
|
if ((se === t.oids.md2 || se === t.oids.md5) && !("parameters" in $))
|
|
5273
5277
|
throw new Error(
|
|
@@ -5301,13 +5305,13 @@ function Wt() {
|
|
|
5301
5305
|
J = { decode: A };
|
|
5302
5306
|
else if (J === "RSA-OAEP" || J === "RSAES-OAEP")
|
|
5303
5307
|
J = {
|
|
5304
|
-
decode: function(
|
|
5305
|
-
return t.pkcs1.decode_rsa_oaep(se,
|
|
5308
|
+
decode: function(Z, se) {
|
|
5309
|
+
return t.pkcs1.decode_rsa_oaep(se, Z, $);
|
|
5306
5310
|
}
|
|
5307
5311
|
};
|
|
5308
5312
|
else if (["RAW", "NONE", "NULL", null].indexOf(J) !== -1)
|
|
5309
|
-
J = { decode: function(
|
|
5310
|
-
return
|
|
5313
|
+
J = { decode: function(Z) {
|
|
5314
|
+
return Z;
|
|
5311
5315
|
} };
|
|
5312
5316
|
else
|
|
5313
5317
|
throw new Error('Unsupported encryption scheme: "' + J + '".');
|
|
@@ -5486,7 +5490,7 @@ function Wt() {
|
|
|
5486
5490
|
)
|
|
5487
5491
|
]);
|
|
5488
5492
|
};
|
|
5489
|
-
function
|
|
5493
|
+
function y(i, n, k) {
|
|
5490
5494
|
var P = t.util.createBuffer(), V = Math.ceil(n.n.bitLength() / 8);
|
|
5491
5495
|
if (i.length > V - 11) {
|
|
5492
5496
|
var O = new Error("Message is too long for PKCS#1 v1.5 padding.");
|
|
@@ -5537,7 +5541,7 @@ function Wt() {
|
|
|
5537
5541
|
throw new Error("Encryption block is invalid.");
|
|
5538
5542
|
return O.getBytes();
|
|
5539
5543
|
}
|
|
5540
|
-
function
|
|
5544
|
+
function v(i, n, k) {
|
|
5541
5545
|
typeof n == "function" && (k = n, n = {}), n = n || {};
|
|
5542
5546
|
var P = {
|
|
5543
5547
|
algorithm: {
|
|
@@ -5612,7 +5616,7 @@ function Wt() {
|
|
|
5612
5616
|
function h(i) {
|
|
5613
5617
|
return i <= 100 ? 27 : i <= 150 ? 18 : i <= 200 ? 15 : i <= 250 ? 12 : i <= 300 ? 9 : i <= 350 ? 8 : i <= 400 ? 7 : i <= 500 ? 6 : i <= 600 ? 5 : i <= 800 ? 4 : i <= 1250 ? 3 : 2;
|
|
5614
5618
|
}
|
|
5615
|
-
function
|
|
5619
|
+
function m(i) {
|
|
5616
5620
|
return t.util.isNodejs && typeof a[i] == "function";
|
|
5617
5621
|
}
|
|
5618
5622
|
function b(i) {
|
|
@@ -5762,12 +5766,12 @@ function rn() {
|
|
|
5762
5766
|
capture: "iterations"
|
|
5763
5767
|
}]
|
|
5764
5768
|
};
|
|
5765
|
-
p.encryptPrivateKeyInfo = function(E, l,
|
|
5766
|
-
|
|
5767
|
-
var A = t.random.getBytesSync(
|
|
5768
|
-
if (
|
|
5769
|
+
p.encryptPrivateKeyInfo = function(E, l, y) {
|
|
5770
|
+
y = y || {}, y.saltSize = y.saltSize || 8, y.count = y.count || 2048, y.algorithm = y.algorithm || "aes128", y.prfAlgorithm = y.prfAlgorithm || "sha1";
|
|
5771
|
+
var A = t.random.getBytesSync(y.saltSize), v = y.count, s = a.integerToDer(v), h, m, b;
|
|
5772
|
+
if (y.algorithm.indexOf("aes") === 0 || y.algorithm === "des") {
|
|
5769
5773
|
var N, d, i;
|
|
5770
|
-
switch (
|
|
5774
|
+
switch (y.algorithm) {
|
|
5771
5775
|
case "aes128":
|
|
5772
5776
|
h = 16, N = 16, d = S["aes128-CBC"], i = t.aes.createEncryptionCipher;
|
|
5773
5777
|
break;
|
|
@@ -5782,12 +5786,12 @@ function rn() {
|
|
|
5782
5786
|
break;
|
|
5783
5787
|
default:
|
|
5784
5788
|
var n = new Error("Cannot encrypt private key. Unknown encryption algorithm.");
|
|
5785
|
-
throw n.algorithm =
|
|
5789
|
+
throw n.algorithm = y.algorithm, n;
|
|
5786
5790
|
}
|
|
5787
|
-
var k = "hmacWith" +
|
|
5791
|
+
var k = "hmacWith" + y.prfAlgorithm.toUpperCase(), P = I(k), V = t.pkcs5.pbkdf2(l, A, v, h, P), O = t.random.getBytesSync(N), M = i(V);
|
|
5788
5792
|
M.start(O), M.update(a.toDer(E)), M.finish(), b = M.output.getBytes();
|
|
5789
5793
|
var Q = D(A, s, h, k);
|
|
5790
|
-
|
|
5794
|
+
m = a.create(
|
|
5791
5795
|
a.Class.UNIVERSAL,
|
|
5792
5796
|
a.Type.SEQUENCE,
|
|
5793
5797
|
!0,
|
|
@@ -5829,10 +5833,10 @@ function rn() {
|
|
|
5829
5833
|
])
|
|
5830
5834
|
]
|
|
5831
5835
|
);
|
|
5832
|
-
} else if (
|
|
5836
|
+
} else if (y.algorithm === "3des") {
|
|
5833
5837
|
h = 24;
|
|
5834
|
-
var G = new t.util.ByteBuffer(A), V = p.pbe.generatePkcs12Key(l, G, 1,
|
|
5835
|
-
M.start(O), M.update(a.toDer(E)), M.finish(), b = M.output.getBytes(),
|
|
5838
|
+
var G = new t.util.ByteBuffer(A), V = p.pbe.generatePkcs12Key(l, G, 1, v, h), O = p.pbe.generatePkcs12Key(l, G, 2, v, h), M = t.des.createEncryptionCipher(V);
|
|
5839
|
+
M.start(O), M.update(a.toDer(E)), M.finish(), b = M.output.getBytes(), m = a.create(
|
|
5836
5840
|
a.Class.UNIVERSAL,
|
|
5837
5841
|
a.Type.SEQUENCE,
|
|
5838
5842
|
!0,
|
|
@@ -5859,11 +5863,11 @@ function rn() {
|
|
|
5859
5863
|
);
|
|
5860
5864
|
} else {
|
|
5861
5865
|
var n = new Error("Cannot encrypt private key. Unknown encryption algorithm.");
|
|
5862
|
-
throw n.algorithm =
|
|
5866
|
+
throw n.algorithm = y.algorithm, n;
|
|
5863
5867
|
}
|
|
5864
5868
|
var z = a.create(a.Class.UNIVERSAL, a.Type.SEQUENCE, !0, [
|
|
5865
5869
|
// encryptionAlgorithm
|
|
5866
|
-
|
|
5870
|
+
m,
|
|
5867
5871
|
// encryptedData
|
|
5868
5872
|
a.create(
|
|
5869
5873
|
a.Class.UNIVERSAL,
|
|
@@ -5874,55 +5878,55 @@ function rn() {
|
|
|
5874
5878
|
]);
|
|
5875
5879
|
return z;
|
|
5876
5880
|
}, p.decryptPrivateKeyInfo = function(E, l) {
|
|
5877
|
-
var
|
|
5878
|
-
if (!a.validate(E, C, A,
|
|
5881
|
+
var y = null, A = {}, v = [];
|
|
5882
|
+
if (!a.validate(E, C, A, v)) {
|
|
5879
5883
|
var s = new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");
|
|
5880
|
-
throw s.errors =
|
|
5884
|
+
throw s.errors = v, s;
|
|
5881
5885
|
}
|
|
5882
|
-
var h = a.derToOid(A.encryptionOid),
|
|
5883
|
-
return
|
|
5886
|
+
var h = a.derToOid(A.encryptionOid), m = p.pbe.getCipher(h, A.encryptionParams, l), b = t.util.createBuffer(A.encryptedData);
|
|
5887
|
+
return m.update(b), m.finish() && (y = a.fromDer(m.output)), y;
|
|
5884
5888
|
}, p.encryptedPrivateKeyToPem = function(E, l) {
|
|
5885
|
-
var
|
|
5889
|
+
var y = {
|
|
5886
5890
|
type: "ENCRYPTED PRIVATE KEY",
|
|
5887
5891
|
body: a.toDer(E).getBytes()
|
|
5888
5892
|
};
|
|
5889
|
-
return t.pem.encode(
|
|
5893
|
+
return t.pem.encode(y, { maxline: l });
|
|
5890
5894
|
}, p.encryptedPrivateKeyFromPem = function(E) {
|
|
5891
5895
|
var l = t.pem.decode(E)[0];
|
|
5892
5896
|
if (l.type !== "ENCRYPTED PRIVATE KEY") {
|
|
5893
|
-
var
|
|
5894
|
-
throw
|
|
5897
|
+
var y = new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');
|
|
5898
|
+
throw y.headerType = l.type, y;
|
|
5895
5899
|
}
|
|
5896
5900
|
if (l.procType && l.procType.type === "ENCRYPTED")
|
|
5897
5901
|
throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");
|
|
5898
5902
|
return a.fromDer(l.body);
|
|
5899
|
-
}, p.encryptRsaPrivateKey = function(E, l,
|
|
5900
|
-
if (
|
|
5903
|
+
}, p.encryptRsaPrivateKey = function(E, l, y) {
|
|
5904
|
+
if (y = y || {}, !y.legacy) {
|
|
5901
5905
|
var A = p.wrapRsaPrivateKey(p.privateKeyToAsn1(E));
|
|
5902
|
-
return A = p.encryptPrivateKeyInfo(A, l,
|
|
5906
|
+
return A = p.encryptPrivateKeyInfo(A, l, y), p.encryptedPrivateKeyToPem(A);
|
|
5903
5907
|
}
|
|
5904
|
-
var
|
|
5905
|
-
switch (
|
|
5908
|
+
var v, s, h, m;
|
|
5909
|
+
switch (y.algorithm) {
|
|
5906
5910
|
case "aes128":
|
|
5907
|
-
|
|
5911
|
+
v = "AES-128-CBC", h = 16, s = t.random.getBytesSync(16), m = t.aes.createEncryptionCipher;
|
|
5908
5912
|
break;
|
|
5909
5913
|
case "aes192":
|
|
5910
|
-
|
|
5914
|
+
v = "AES-192-CBC", h = 24, s = t.random.getBytesSync(16), m = t.aes.createEncryptionCipher;
|
|
5911
5915
|
break;
|
|
5912
5916
|
case "aes256":
|
|
5913
|
-
|
|
5917
|
+
v = "AES-256-CBC", h = 32, s = t.random.getBytesSync(16), m = t.aes.createEncryptionCipher;
|
|
5914
5918
|
break;
|
|
5915
5919
|
case "3des":
|
|
5916
|
-
|
|
5920
|
+
v = "DES-EDE3-CBC", h = 24, s = t.random.getBytesSync(8), m = t.des.createEncryptionCipher;
|
|
5917
5921
|
break;
|
|
5918
5922
|
case "des":
|
|
5919
|
-
|
|
5923
|
+
v = "DES-CBC", h = 8, s = t.random.getBytesSync(8), m = t.des.createEncryptionCipher;
|
|
5920
5924
|
break;
|
|
5921
5925
|
default:
|
|
5922
|
-
var b = new Error('Could not encrypt RSA private key; unsupported encryption algorithm "' +
|
|
5923
|
-
throw b.algorithm =
|
|
5926
|
+
var b = new Error('Could not encrypt RSA private key; unsupported encryption algorithm "' + y.algorithm + '".');
|
|
5927
|
+
throw b.algorithm = y.algorithm, b;
|
|
5924
5928
|
}
|
|
5925
|
-
var N = t.pbe.opensslDeriveBytes(l, s.substr(0, 8), h), d =
|
|
5929
|
+
var N = t.pbe.opensslDeriveBytes(l, s.substr(0, 8), h), d = m(N);
|
|
5926
5930
|
d.start(s), d.update(a.toDer(p.privateKeyToAsn1(E))), d.finish();
|
|
5927
5931
|
var i = {
|
|
5928
5932
|
type: "RSA PRIVATE KEY",
|
|
@@ -5931,17 +5935,17 @@ function rn() {
|
|
|
5931
5935
|
type: "ENCRYPTED"
|
|
5932
5936
|
},
|
|
5933
5937
|
dekInfo: {
|
|
5934
|
-
algorithm:
|
|
5938
|
+
algorithm: v,
|
|
5935
5939
|
parameters: t.util.bytesToHex(s).toUpperCase()
|
|
5936
5940
|
},
|
|
5937
5941
|
body: d.output.getBytes()
|
|
5938
5942
|
};
|
|
5939
5943
|
return t.pem.encode(i);
|
|
5940
5944
|
}, p.decryptRsaPrivateKey = function(E, l) {
|
|
5941
|
-
var
|
|
5945
|
+
var y = null, A = t.pem.decode(E)[0];
|
|
5942
5946
|
if (A.type !== "ENCRYPTED PRIVATE KEY" && A.type !== "PRIVATE KEY" && A.type !== "RSA PRIVATE KEY") {
|
|
5943
|
-
var
|
|
5944
|
-
throw
|
|
5947
|
+
var v = new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');
|
|
5948
|
+
throw v.headerType = v, v;
|
|
5945
5949
|
}
|
|
5946
5950
|
if (A.procType && A.procType.type === "ENCRYPTED") {
|
|
5947
5951
|
var s, h;
|
|
@@ -5977,19 +5981,19 @@ function rn() {
|
|
|
5977
5981
|
};
|
|
5978
5982
|
break;
|
|
5979
5983
|
default:
|
|
5980
|
-
var
|
|
5981
|
-
throw
|
|
5984
|
+
var v = new Error('Could not decrypt private key; unsupported encryption algorithm "' + A.dekInfo.algorithm + '".');
|
|
5985
|
+
throw v.algorithm = A.dekInfo.algorithm, v;
|
|
5982
5986
|
}
|
|
5983
|
-
var
|
|
5984
|
-
if (N.start(
|
|
5985
|
-
|
|
5987
|
+
var m = t.util.hexToBytes(A.dekInfo.parameters), b = t.pbe.opensslDeriveBytes(l, m.substr(0, 8), s), N = h(b);
|
|
5988
|
+
if (N.start(m), N.update(t.util.createBuffer(A.body)), N.finish())
|
|
5989
|
+
y = N.output.getBytes();
|
|
5986
5990
|
else
|
|
5987
|
-
return
|
|
5991
|
+
return y;
|
|
5988
5992
|
} else
|
|
5989
|
-
|
|
5990
|
-
return A.type === "ENCRYPTED PRIVATE KEY" ?
|
|
5991
|
-
}, p.pbe.generatePkcs12Key = function(E, l,
|
|
5992
|
-
var h,
|
|
5993
|
+
y = A.body;
|
|
5994
|
+
return A.type === "ENCRYPTED PRIVATE KEY" ? y = p.decryptPrivateKeyInfo(a.fromDer(y), l) : y = a.fromDer(y), y !== null && (y = p.privateKeyFromAsn1(y)), y;
|
|
5995
|
+
}, p.pbe.generatePkcs12Key = function(E, l, y, A, v, s) {
|
|
5996
|
+
var h, m;
|
|
5993
5997
|
if (typeof s > "u" || s === null) {
|
|
5994
5998
|
if (!("sha1" in t.md))
|
|
5995
5999
|
throw new Error('"sha1" hash algorithm unavailable.');
|
|
@@ -5997,45 +6001,45 @@ function rn() {
|
|
|
5997
6001
|
}
|
|
5998
6002
|
var b = s.digestLength, N = s.blockLength, d = new t.util.ByteBuffer(), i = new t.util.ByteBuffer();
|
|
5999
6003
|
if (E != null) {
|
|
6000
|
-
for (
|
|
6001
|
-
i.putInt16(E.charCodeAt(
|
|
6004
|
+
for (m = 0; m < E.length; m++)
|
|
6005
|
+
i.putInt16(E.charCodeAt(m));
|
|
6002
6006
|
i.putInt16(0);
|
|
6003
6007
|
}
|
|
6004
6008
|
var n = i.length(), k = l.length(), P = new t.util.ByteBuffer();
|
|
6005
|
-
P.fillWithByte(
|
|
6009
|
+
P.fillWithByte(y, N);
|
|
6006
6010
|
var V = N * Math.ceil(k / N), O = new t.util.ByteBuffer();
|
|
6007
|
-
for (
|
|
6008
|
-
O.putByte(l.at(
|
|
6011
|
+
for (m = 0; m < V; m++)
|
|
6012
|
+
O.putByte(l.at(m % k));
|
|
6009
6013
|
var M = N * Math.ceil(n / N), Q = new t.util.ByteBuffer();
|
|
6010
|
-
for (
|
|
6011
|
-
Q.putByte(i.at(
|
|
6014
|
+
for (m = 0; m < M; m++)
|
|
6015
|
+
Q.putByte(i.at(m % n));
|
|
6012
6016
|
var G = O;
|
|
6013
6017
|
G.putBuffer(Q);
|
|
6014
|
-
for (var z = Math.ceil(
|
|
6018
|
+
for (var z = Math.ceil(v / b), J = 1; J <= z; J++) {
|
|
6015
6019
|
var $ = new t.util.ByteBuffer();
|
|
6016
6020
|
$.putBytes(P.bytes()), $.putBytes(G.bytes());
|
|
6017
6021
|
for (var re = 0; re < A; re++)
|
|
6018
6022
|
s.start(), s.update($.getBytes()), $ = s.digest();
|
|
6019
|
-
var
|
|
6020
|
-
for (
|
|
6021
|
-
|
|
6023
|
+
var Z = new t.util.ByteBuffer();
|
|
6024
|
+
for (m = 0; m < N; m++)
|
|
6025
|
+
Z.putByte($.at(m % b));
|
|
6022
6026
|
var se = Math.ceil(k / N) + Math.ceil(n / N), de = new t.util.ByteBuffer();
|
|
6023
6027
|
for (h = 0; h < se; h++) {
|
|
6024
6028
|
var me = new t.util.ByteBuffer(G.getBytes(N)), _ = 511;
|
|
6025
|
-
for (
|
|
6026
|
-
_ = _ >> 8, _ +=
|
|
6029
|
+
for (m = Z.length() - 1; m >= 0; m--)
|
|
6030
|
+
_ = _ >> 8, _ += Z.at(m) + me.at(m), me.setAt(m, _ & 255);
|
|
6027
6031
|
de.putBuffer(me);
|
|
6028
6032
|
}
|
|
6029
6033
|
G = de, d.putBuffer($);
|
|
6030
6034
|
}
|
|
6031
|
-
return d.truncate(d.length() -
|
|
6032
|
-
}, p.pbe.getCipher = function(E, l,
|
|
6035
|
+
return d.truncate(d.length() - v), d;
|
|
6036
|
+
}, p.pbe.getCipher = function(E, l, y) {
|
|
6033
6037
|
switch (E) {
|
|
6034
6038
|
case p.oids.pkcs5PBES2:
|
|
6035
|
-
return p.pbe.getCipherForPBES2(E, l,
|
|
6039
|
+
return p.pbe.getCipherForPBES2(E, l, y);
|
|
6036
6040
|
case p.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:
|
|
6037
6041
|
case p.oids["pbewithSHAAnd40BitRC2-CBC"]:
|
|
6038
|
-
return p.pbe.getCipherForPKCS12PBE(E, l,
|
|
6042
|
+
return p.pbe.getCipherForPKCS12PBE(E, l, y);
|
|
6039
6043
|
default:
|
|
6040
6044
|
var A = new Error("Cannot read encrypted PBE data block. Unsupported OID.");
|
|
6041
6045
|
throw A.oid = E, A.supportedOids = [
|
|
@@ -6044,11 +6048,11 @@ function rn() {
|
|
|
6044
6048
|
"pbewithSHAAnd40BitRC2-CBC"
|
|
6045
6049
|
], A;
|
|
6046
6050
|
}
|
|
6047
|
-
}, p.pbe.getCipherForPBES2 = function(E, l,
|
|
6048
|
-
var A = {},
|
|
6049
|
-
if (!a.validate(l, c, A,
|
|
6051
|
+
}, p.pbe.getCipherForPBES2 = function(E, l, y) {
|
|
6052
|
+
var A = {}, v = [];
|
|
6053
|
+
if (!a.validate(l, c, A, v)) {
|
|
6050
6054
|
var s = new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");
|
|
6051
|
-
throw s.errors =
|
|
6055
|
+
throw s.errors = v, s;
|
|
6052
6056
|
}
|
|
6053
6057
|
if (E = a.derToOid(A.kdfOid), E !== p.oids.pkcs5PBKDF2) {
|
|
6054
6058
|
var s = new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");
|
|
@@ -6064,8 +6068,8 @@ function rn() {
|
|
|
6064
6068
|
"desCBC"
|
|
6065
6069
|
], s;
|
|
6066
6070
|
}
|
|
6067
|
-
var h = A.kdfSalt,
|
|
6068
|
-
|
|
6071
|
+
var h = A.kdfSalt, m = t.util.createBuffer(A.kdfIterationCount);
|
|
6072
|
+
m = m.getInt(m.length() << 3);
|
|
6069
6073
|
var b, N;
|
|
6070
6074
|
switch (p.oids[E]) {
|
|
6071
6075
|
case "aes128-CBC":
|
|
@@ -6084,16 +6088,16 @@ function rn() {
|
|
|
6084
6088
|
b = 8, N = t.des.createDecryptionCipher;
|
|
6085
6089
|
break;
|
|
6086
6090
|
}
|
|
6087
|
-
var d = u(A.prfOid), i = t.pkcs5.pbkdf2(
|
|
6091
|
+
var d = u(A.prfOid), i = t.pkcs5.pbkdf2(y, h, m, b, d), n = A.encIv, k = N(i);
|
|
6088
6092
|
return k.start(n), k;
|
|
6089
|
-
}, p.pbe.getCipherForPKCS12PBE = function(E, l,
|
|
6090
|
-
var A = {},
|
|
6091
|
-
if (!a.validate(l, r, A,
|
|
6093
|
+
}, p.pbe.getCipherForPKCS12PBE = function(E, l, y) {
|
|
6094
|
+
var A = {}, v = [];
|
|
6095
|
+
if (!a.validate(l, r, A, v)) {
|
|
6092
6096
|
var s = new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");
|
|
6093
|
-
throw s.errors =
|
|
6097
|
+
throw s.errors = v, s;
|
|
6094
6098
|
}
|
|
6095
|
-
var h = t.util.createBuffer(A.salt),
|
|
6096
|
-
|
|
6099
|
+
var h = t.util.createBuffer(A.salt), m = t.util.createBuffer(A.iterations);
|
|
6100
|
+
m = m.getInt(m.length() << 3);
|
|
6097
6101
|
var b, N, d;
|
|
6098
6102
|
switch (E) {
|
|
6099
6103
|
case p.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:
|
|
@@ -6109,20 +6113,20 @@ function rn() {
|
|
|
6109
6113
|
var s = new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");
|
|
6110
6114
|
throw s.oid = E, s;
|
|
6111
6115
|
}
|
|
6112
|
-
var i = u(A.prfOid), n = p.pbe.generatePkcs12Key(
|
|
6116
|
+
var i = u(A.prfOid), n = p.pbe.generatePkcs12Key(y, h, 1, m, b, i);
|
|
6113
6117
|
i.start();
|
|
6114
|
-
var k = p.pbe.generatePkcs12Key(
|
|
6118
|
+
var k = p.pbe.generatePkcs12Key(y, h, 2, m, N, i);
|
|
6115
6119
|
return d(n, k);
|
|
6116
|
-
}, p.pbe.opensslDeriveBytes = function(E, l,
|
|
6120
|
+
}, p.pbe.opensslDeriveBytes = function(E, l, y, A) {
|
|
6117
6121
|
if (typeof A > "u" || A === null) {
|
|
6118
6122
|
if (!("md5" in t.md))
|
|
6119
6123
|
throw new Error('"md5" hash algorithm unavailable.');
|
|
6120
6124
|
A = t.md.md5.create();
|
|
6121
6125
|
}
|
|
6122
6126
|
l === null && (l = "");
|
|
6123
|
-
for (var
|
|
6124
|
-
|
|
6125
|
-
return
|
|
6127
|
+
for (var v = [g(A, E + l)], s = 16, h = 1; s < y; ++h, s += 16)
|
|
6128
|
+
v.push(g(A, v[h - 1] + E + l));
|
|
6129
|
+
return v.join("").substr(0, y);
|
|
6126
6130
|
};
|
|
6127
6131
|
function g(E, l) {
|
|
6128
6132
|
return E.start().update(l).digest().getBytes();
|
|
@@ -6132,14 +6136,14 @@ function rn() {
|
|
|
6132
6136
|
if (!E)
|
|
6133
6137
|
l = "hmacWithSHA1";
|
|
6134
6138
|
else if (l = p.oids[a.derToOid(E)], !l) {
|
|
6135
|
-
var
|
|
6136
|
-
throw
|
|
6139
|
+
var y = new Error("Unsupported PRF OID.");
|
|
6140
|
+
throw y.oid = E, y.supported = [
|
|
6137
6141
|
"hmacWithSHA1",
|
|
6138
6142
|
"hmacWithSHA224",
|
|
6139
6143
|
"hmacWithSHA256",
|
|
6140
6144
|
"hmacWithSHA384",
|
|
6141
6145
|
"hmacWithSHA512"
|
|
6142
|
-
],
|
|
6146
|
+
], y;
|
|
6143
6147
|
}
|
|
6144
6148
|
return I(l);
|
|
6145
6149
|
}
|
|
@@ -6155,21 +6159,21 @@ function rn() {
|
|
|
6155
6159
|
E = E.substr(8).toLowerCase();
|
|
6156
6160
|
break;
|
|
6157
6161
|
default:
|
|
6158
|
-
var
|
|
6159
|
-
throw
|
|
6162
|
+
var y = new Error("Unsupported PRF algorithm.");
|
|
6163
|
+
throw y.algorithm = E, y.supported = [
|
|
6160
6164
|
"hmacWithSHA1",
|
|
6161
6165
|
"hmacWithSHA224",
|
|
6162
6166
|
"hmacWithSHA256",
|
|
6163
6167
|
"hmacWithSHA384",
|
|
6164
6168
|
"hmacWithSHA512"
|
|
6165
|
-
],
|
|
6169
|
+
], y;
|
|
6166
6170
|
}
|
|
6167
6171
|
if (!l || !(E in l))
|
|
6168
6172
|
throw new Error("Unknown hash algorithm: " + E);
|
|
6169
6173
|
return l[E].create();
|
|
6170
6174
|
}
|
|
6171
|
-
function D(E, l,
|
|
6172
|
-
var
|
|
6175
|
+
function D(E, l, y, A) {
|
|
6176
|
+
var v = a.create(a.Class.UNIVERSAL, a.Type.SEQUENCE, !0, [
|
|
6173
6177
|
// salt
|
|
6174
6178
|
a.create(
|
|
6175
6179
|
a.Class.UNIVERSAL,
|
|
@@ -6185,13 +6189,13 @@ function rn() {
|
|
|
6185
6189
|
l.getBytes()
|
|
6186
6190
|
)
|
|
6187
6191
|
]);
|
|
6188
|
-
return A !== "hmacWithSHA1" &&
|
|
6192
|
+
return A !== "hmacWithSHA1" && v.value.push(
|
|
6189
6193
|
// key length
|
|
6190
6194
|
a.create(
|
|
6191
6195
|
a.Class.UNIVERSAL,
|
|
6192
6196
|
a.Type.INTEGER,
|
|
6193
6197
|
!1,
|
|
6194
|
-
t.util.hexToBytes(
|
|
6198
|
+
t.util.hexToBytes(y.toString(16))
|
|
6195
6199
|
),
|
|
6196
6200
|
// AlgorithmIdentifier
|
|
6197
6201
|
a.create(a.Class.UNIVERSAL, a.Type.SEQUENCE, !0, [
|
|
@@ -6205,7 +6209,7 @@ function rn() {
|
|
|
6205
6209
|
// parameters (null)
|
|
6206
6210
|
a.create(a.Class.UNIVERSAL, a.Type.NULL, !1, "")
|
|
6207
6211
|
])
|
|
6208
|
-
),
|
|
6212
|
+
), v;
|
|
6209
6213
|
}
|
|
6210
6214
|
return Br;
|
|
6211
6215
|
}
|
|
@@ -6564,33 +6568,33 @@ function qr() {
|
|
|
6564
6568
|
throw new Error("Given salt length does not match length of given salt.");
|
|
6565
6569
|
var g = a.prng || t.random, u = {};
|
|
6566
6570
|
return u.encode = function(I, D) {
|
|
6567
|
-
var E, l = D - 1,
|
|
6568
|
-
if (
|
|
6571
|
+
var E, l = D - 1, y = Math.ceil(l / 8), A = I.digest().getBytes();
|
|
6572
|
+
if (y < C + r + 2)
|
|
6569
6573
|
throw new Error("Message is too long to encrypt.");
|
|
6570
|
-
var
|
|
6571
|
-
c === null ?
|
|
6574
|
+
var v;
|
|
6575
|
+
c === null ? v = g.getBytesSync(r) : v = c.bytes();
|
|
6572
6576
|
var s = new t.util.ByteBuffer();
|
|
6573
|
-
s.fillWithByte(0, 8), s.putBytes(A), s.putBytes(
|
|
6574
|
-
var h = p.digest().getBytes(),
|
|
6575
|
-
|
|
6576
|
-
var b =
|
|
6577
|
+
s.fillWithByte(0, 8), s.putBytes(A), s.putBytes(v), p.start(), p.update(s.getBytes());
|
|
6578
|
+
var h = p.digest().getBytes(), m = new t.util.ByteBuffer();
|
|
6579
|
+
m.fillWithByte(0, y - r - C - 2), m.putByte(1), m.putBytes(v);
|
|
6580
|
+
var b = m.getBytes(), N = y - C - 1, d = S.generate(h, N), i = "";
|
|
6577
6581
|
for (E = 0; E < N; E++)
|
|
6578
6582
|
i += String.fromCharCode(b.charCodeAt(E) ^ d.charCodeAt(E));
|
|
6579
|
-
var n = 65280 >> 8 *
|
|
6583
|
+
var n = 65280 >> 8 * y - l & 255;
|
|
6580
6584
|
return i = String.fromCharCode(i.charCodeAt(0) & ~n) + i.substr(1), i + h + "¼";
|
|
6581
6585
|
}, u.verify = function(I, D, E) {
|
|
6582
|
-
var l,
|
|
6586
|
+
var l, y = E - 1, A = Math.ceil(y / 8);
|
|
6583
6587
|
if (D = D.substr(-A), A < C + r + 2)
|
|
6584
6588
|
throw new Error("Inconsistent parameters to PSS signature verification.");
|
|
6585
6589
|
if (D.charCodeAt(A - 1) !== 188)
|
|
6586
6590
|
throw new Error("Encoded message does not end in 0xBC.");
|
|
6587
|
-
var
|
|
6588
|
-
if ((s.charCodeAt(0) &
|
|
6591
|
+
var v = A - C - 1, s = D.substr(0, v), h = D.substr(v, C), m = 65280 >> 8 * A - y & 255;
|
|
6592
|
+
if ((s.charCodeAt(0) & m) !== 0)
|
|
6589
6593
|
throw new Error("Bits beyond keysize not zero as expected.");
|
|
6590
|
-
var b = S.generate(h,
|
|
6591
|
-
for (l = 0; l <
|
|
6594
|
+
var b = S.generate(h, v), N = "";
|
|
6595
|
+
for (l = 0; l < v; l++)
|
|
6592
6596
|
N += String.fromCharCode(s.charCodeAt(l) ^ b.charCodeAt(l));
|
|
6593
|
-
N = String.fromCharCode(N.charCodeAt(0) & ~
|
|
6597
|
+
N = String.fromCharCode(N.charCodeAt(0) & ~m) + N.substr(1);
|
|
6594
6598
|
var d = A - C - r - 2;
|
|
6595
6599
|
for (l = 0; l < d; l++)
|
|
6596
6600
|
if (N.charCodeAt(l) !== 0)
|
|
@@ -7165,7 +7169,7 @@ function Yr() {
|
|
|
7165
7169
|
A(i), d.issuer.attributes = i, delete d.issuer.uniqueId, n && (d.issuer.uniqueId = n), d.issuer.hash = null;
|
|
7166
7170
|
}, d.setExtensions = function(i) {
|
|
7167
7171
|
for (var n = 0; n < i.length; ++n)
|
|
7168
|
-
|
|
7172
|
+
v(i[n], { cert: d });
|
|
7169
7173
|
d.extensions = i;
|
|
7170
7174
|
}, d.getExtension = function(i) {
|
|
7171
7175
|
typeof i == "string" && (i = { name: i });
|
|
@@ -7267,16 +7271,16 @@ function Yr() {
|
|
|
7267
7271
|
O.md.update(G.getBytes());
|
|
7268
7272
|
}
|
|
7269
7273
|
var z = t.md.sha1.create(), J = e.toDer(n.certIssuer);
|
|
7270
|
-
z.update(J.getBytes()), O.issuer.getField = function(
|
|
7271
|
-
return I(O.issuer,
|
|
7272
|
-
}, O.issuer.addField = function(
|
|
7273
|
-
A([
|
|
7274
|
+
z.update(J.getBytes()), O.issuer.getField = function(Z) {
|
|
7275
|
+
return I(O.issuer, Z);
|
|
7276
|
+
}, O.issuer.addField = function(Z) {
|
|
7277
|
+
A([Z]), O.issuer.attributes.push(Z);
|
|
7274
7278
|
}, O.issuer.attributes = a.RDNAttributesAsArray(n.certIssuer), n.certIssuerUniqueId && (O.issuer.uniqueId = n.certIssuerUniqueId), O.issuer.hash = z.digest().toHex();
|
|
7275
7279
|
var $ = t.md.sha1.create(), re = e.toDer(n.certSubject);
|
|
7276
|
-
return $.update(re.getBytes()), O.subject.getField = function(
|
|
7277
|
-
return I(O.subject,
|
|
7278
|
-
}, O.subject.addField = function(
|
|
7279
|
-
A([
|
|
7280
|
+
return $.update(re.getBytes()), O.subject.getField = function(Z) {
|
|
7281
|
+
return I(O.subject, Z);
|
|
7282
|
+
}, O.subject.addField = function(Z) {
|
|
7283
|
+
A([Z]), O.subject.attributes.push(Z);
|
|
7280
7284
|
}, O.subject.attributes = a.RDNAttributesAsArray(n.certSubject), n.certSubjectUniqueId && (O.subject.uniqueId = n.certSubjectUniqueId), O.subject.hash = $.digest().toHex(), n.certExtensions ? O.extensions = a.certificateExtensionsFromAsn1(n.certExtensions) : O.extensions = [], O.publicKey = a.publicKeyFromAsn1(n.subjectPublicKeyInfo), O;
|
|
7281
7285
|
}, a.certificateExtensionsFromAsn1 = function(d) {
|
|
7282
7286
|
for (var i = [], n = 0; n < d.value.length; ++n)
|
|
@@ -7416,7 +7420,7 @@ function Yr() {
|
|
|
7416
7420
|
})), i;
|
|
7417
7421
|
}, d;
|
|
7418
7422
|
};
|
|
7419
|
-
function
|
|
7423
|
+
function y(d) {
|
|
7420
7424
|
for (var i = e.create(
|
|
7421
7425
|
e.Class.UNIVERSAL,
|
|
7422
7426
|
e.Type.SEQUENCE,
|
|
@@ -7454,7 +7458,7 @@ function Yr() {
|
|
|
7454
7458
|
i.value = [];
|
|
7455
7459
|
for (var P = 0; P < i.extensions.length; ++P)
|
|
7456
7460
|
i.value.push(a.certificateExtensionToAsn1(
|
|
7457
|
-
|
|
7461
|
+
v(i.extensions[P])
|
|
7458
7462
|
));
|
|
7459
7463
|
}
|
|
7460
7464
|
if (typeof i.value > "u") {
|
|
@@ -7463,7 +7467,7 @@ function Yr() {
|
|
|
7463
7467
|
}
|
|
7464
7468
|
}
|
|
7465
7469
|
}
|
|
7466
|
-
function
|
|
7470
|
+
function v(d, i) {
|
|
7467
7471
|
if (i = i || {}, typeof d.name > "u" && d.id && d.id in a.oids && (d.name = a.oids[d.id]), typeof d.id > "u")
|
|
7468
7472
|
if (d.name && d.name in a.oids)
|
|
7469
7473
|
d.id = a.oids[d.name];
|
|
@@ -7579,7 +7583,7 @@ function Yr() {
|
|
|
7579
7583
|
if (d.authorityCertIssuer) {
|
|
7580
7584
|
var re = [
|
|
7581
7585
|
e.create(e.Class.CONTEXT_SPECIFIC, 4, !0, [
|
|
7582
|
-
|
|
7586
|
+
y(d.authorityCertIssuer === !0 ? i.cert.issuer : d.authorityCertIssuer)
|
|
7583
7587
|
])
|
|
7584
7588
|
];
|
|
7585
7589
|
M.push(
|
|
@@ -7587,9 +7591,9 @@ function Yr() {
|
|
|
7587
7591
|
);
|
|
7588
7592
|
}
|
|
7589
7593
|
if (d.serialNumber) {
|
|
7590
|
-
var
|
|
7594
|
+
var Z = t.util.hexToBytes(d.serialNumber === !0 ? i.cert.serialNumber : d.serialNumber);
|
|
7591
7595
|
M.push(
|
|
7592
|
-
e.create(e.Class.CONTEXT_SPECIFIC, 2, !1,
|
|
7596
|
+
e.create(e.Class.CONTEXT_SPECIFIC, 2, !1, Z)
|
|
7593
7597
|
);
|
|
7594
7598
|
}
|
|
7595
7599
|
} else if (d.name === "cRLDistributionPoints") {
|
|
@@ -7710,9 +7714,9 @@ function Yr() {
|
|
|
7710
7714
|
}
|
|
7711
7715
|
return i;
|
|
7712
7716
|
}
|
|
7713
|
-
var
|
|
7717
|
+
var m = /* @__PURE__ */ new Date("1950-01-01T00:00:00Z"), b = /* @__PURE__ */ new Date("2050-01-01T00:00:00Z");
|
|
7714
7718
|
function N(d) {
|
|
7715
|
-
return d >=
|
|
7719
|
+
return d >= m && d < b ? e.create(
|
|
7716
7720
|
e.Class.UNIVERSAL,
|
|
7717
7721
|
e.Type.UTCTIME,
|
|
7718
7722
|
!1,
|
|
@@ -7759,14 +7763,14 @@ function Yr() {
|
|
|
7759
7763
|
)
|
|
7760
7764
|
]),
|
|
7761
7765
|
// issuer
|
|
7762
|
-
|
|
7766
|
+
y(d.issuer),
|
|
7763
7767
|
// validity
|
|
7764
7768
|
e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
7765
7769
|
i,
|
|
7766
7770
|
n
|
|
7767
7771
|
]),
|
|
7768
7772
|
// subject
|
|
7769
|
-
|
|
7773
|
+
y(d.subject),
|
|
7770
7774
|
// SubjectPublicKeyInfo
|
|
7771
7775
|
a.publicKeyToAsn1(d.publicKey)
|
|
7772
7776
|
]);
|
|
@@ -7801,7 +7805,7 @@ function Yr() {
|
|
|
7801
7805
|
e.integerToDer(d.version).getBytes()
|
|
7802
7806
|
),
|
|
7803
7807
|
// subject
|
|
7804
|
-
|
|
7808
|
+
y(d.subject),
|
|
7805
7809
|
// SubjectPublicKeyInfo
|
|
7806
7810
|
a.publicKeyToAsn1(d.publicKey),
|
|
7807
7811
|
// attributes
|
|
@@ -7809,7 +7813,7 @@ function Yr() {
|
|
|
7809
7813
|
]);
|
|
7810
7814
|
return i;
|
|
7811
7815
|
}, a.distinguishedNameToAsn1 = function(d) {
|
|
7812
|
-
return
|
|
7816
|
+
return y(d);
|
|
7813
7817
|
}, a.certificateToAsn1 = function(d) {
|
|
7814
7818
|
var i = d.tbsCertificate || a.getTBSCertificate(d);
|
|
7815
7819
|
return e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
@@ -7944,7 +7948,7 @@ function Yr() {
|
|
|
7944
7948
|
function k(O) {
|
|
7945
7949
|
if (!O.hash) {
|
|
7946
7950
|
var M = t.md.sha1.create();
|
|
7947
|
-
O.attributes = a.RDNAttributesAsArray(
|
|
7951
|
+
O.attributes = a.RDNAttributesAsArray(y(O), M), O.hash = M.digest().toHex();
|
|
7948
7952
|
}
|
|
7949
7953
|
}
|
|
7950
7954
|
if (d)
|
|
@@ -8003,8 +8007,8 @@ function Yr() {
|
|
|
8003
8007
|
for (var re = {
|
|
8004
8008
|
keyUsage: !0,
|
|
8005
8009
|
basicConstraints: !0
|
|
8006
|
-
},
|
|
8007
|
-
var se = Q.extensions[
|
|
8010
|
+
}, Z = 0; O === null && Z < Q.extensions.length; ++Z) {
|
|
8011
|
+
var se = Q.extensions[Z];
|
|
8008
8012
|
se.critical && !(se.name in re) && (O = {
|
|
8009
8013
|
message: "Certificate has an unsupported critical extension.",
|
|
8010
8014
|
error: a.certificateError.unsupported_certificate
|
|
@@ -8198,24 +8202,24 @@ function sn() {
|
|
|
8198
8202
|
}]
|
|
8199
8203
|
}]
|
|
8200
8204
|
};
|
|
8201
|
-
function u(A,
|
|
8202
|
-
for (var
|
|
8205
|
+
function u(A, v, s, h) {
|
|
8206
|
+
for (var m = [], b = 0; b < A.length; b++)
|
|
8203
8207
|
for (var N = 0; N < A[b].safeBags.length; N++) {
|
|
8204
8208
|
var d = A[b].safeBags[N];
|
|
8205
8209
|
if (!(h !== void 0 && d.type !== h)) {
|
|
8206
|
-
if (
|
|
8207
|
-
|
|
8210
|
+
if (v === null) {
|
|
8211
|
+
m.push(d);
|
|
8208
8212
|
continue;
|
|
8209
8213
|
}
|
|
8210
|
-
d.attributes[
|
|
8214
|
+
d.attributes[v] !== void 0 && d.attributes[v].indexOf(s) >= 0 && m.push(d);
|
|
8211
8215
|
}
|
|
8212
8216
|
}
|
|
8213
|
-
return
|
|
8217
|
+
return m;
|
|
8214
8218
|
}
|
|
8215
|
-
p.pkcs12FromAsn1 = function(A,
|
|
8216
|
-
typeof
|
|
8217
|
-
var h = {},
|
|
8218
|
-
if (!e.validate(A, C, h,
|
|
8219
|
+
p.pkcs12FromAsn1 = function(A, v, s) {
|
|
8220
|
+
typeof v == "string" ? (s = v, v = !0) : v === void 0 && (v = !0);
|
|
8221
|
+
var h = {}, m = [];
|
|
8222
|
+
if (!e.validate(A, C, h, m)) {
|
|
8219
8223
|
var b = new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");
|
|
8220
8224
|
throw b.errors = b, b;
|
|
8221
8225
|
}
|
|
@@ -8336,21 +8340,21 @@ function sn() {
|
|
|
8336
8340
|
if (Q.getBytes() !== h.macDigest)
|
|
8337
8341
|
throw new Error("PKCS#12 MAC could not be verified. Invalid password?");
|
|
8338
8342
|
}
|
|
8339
|
-
return D(N, d.value,
|
|
8343
|
+
return D(N, d.value, v, s), N;
|
|
8340
8344
|
};
|
|
8341
8345
|
function I(A) {
|
|
8342
8346
|
if (A.composed || A.constructed) {
|
|
8343
|
-
for (var
|
|
8344
|
-
|
|
8345
|
-
A.composed = A.constructed = !1, A.value =
|
|
8347
|
+
for (var v = t.util.createBuffer(), s = 0; s < A.value.length; ++s)
|
|
8348
|
+
v.putBytes(A.value[s].value);
|
|
8349
|
+
A.composed = A.constructed = !1, A.value = v.getBytes();
|
|
8346
8350
|
}
|
|
8347
8351
|
return A;
|
|
8348
8352
|
}
|
|
8349
|
-
function D(A,
|
|
8350
|
-
if (
|
|
8353
|
+
function D(A, v, s, h) {
|
|
8354
|
+
if (v = e.fromDer(v, s), v.tagClass !== e.Class.UNIVERSAL || v.type !== e.Type.SEQUENCE || v.constructed !== !0)
|
|
8351
8355
|
throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
|
|
8352
|
-
for (var
|
|
8353
|
-
var b =
|
|
8356
|
+
for (var m = 0; m < v.value.length; m++) {
|
|
8357
|
+
var b = v.value[m], N = {}, d = [];
|
|
8354
8358
|
if (!e.validate(b, S, N, d)) {
|
|
8355
8359
|
var i = new Error("Cannot read ContentInfo.");
|
|
8356
8360
|
throw i.errors = d, i;
|
|
@@ -8374,7 +8378,7 @@ function sn() {
|
|
|
8374
8378
|
n.safeBags = l(k, s, h), A.safeContents.push(n);
|
|
8375
8379
|
}
|
|
8376
8380
|
}
|
|
8377
|
-
function E(A,
|
|
8381
|
+
function E(A, v) {
|
|
8378
8382
|
var s = {}, h = [];
|
|
8379
8383
|
if (!e.validate(
|
|
8380
8384
|
A,
|
|
@@ -8382,38 +8386,38 @@ function sn() {
|
|
|
8382
8386
|
s,
|
|
8383
8387
|
h
|
|
8384
8388
|
)) {
|
|
8385
|
-
var
|
|
8386
|
-
throw
|
|
8389
|
+
var m = new Error("Cannot read EncryptedContentInfo.");
|
|
8390
|
+
throw m.errors = h, m;
|
|
8387
8391
|
}
|
|
8388
8392
|
var b = e.derToOid(s.contentType);
|
|
8389
8393
|
if (b !== a.oids.data) {
|
|
8390
|
-
var
|
|
8394
|
+
var m = new Error(
|
|
8391
8395
|
"PKCS#12 EncryptedContentInfo ContentType is not Data."
|
|
8392
8396
|
);
|
|
8393
|
-
throw
|
|
8397
|
+
throw m.oid = b, m;
|
|
8394
8398
|
}
|
|
8395
8399
|
b = e.derToOid(s.encAlgorithm);
|
|
8396
|
-
var N = a.pbe.getCipher(b, s.encParameter,
|
|
8400
|
+
var N = a.pbe.getCipher(b, s.encParameter, v), d = I(s.encryptedContentAsn1), i = t.util.createBuffer(d.value);
|
|
8397
8401
|
if (N.update(i), !N.finish())
|
|
8398
8402
|
throw new Error("Failed to decrypt PKCS#12 SafeContents.");
|
|
8399
8403
|
return N.output.getBytes();
|
|
8400
8404
|
}
|
|
8401
|
-
function l(A,
|
|
8402
|
-
if (!
|
|
8405
|
+
function l(A, v, s) {
|
|
8406
|
+
if (!v && A.length === 0)
|
|
8403
8407
|
return [];
|
|
8404
|
-
if (A = e.fromDer(A,
|
|
8408
|
+
if (A = e.fromDer(A, v), A.tagClass !== e.Class.UNIVERSAL || A.type !== e.Type.SEQUENCE || A.constructed !== !0)
|
|
8405
8409
|
throw new Error(
|
|
8406
8410
|
"PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag."
|
|
8407
8411
|
);
|
|
8408
|
-
for (var h = [],
|
|
8409
|
-
var b = A.value[
|
|
8412
|
+
for (var h = [], m = 0; m < A.value.length; m++) {
|
|
8413
|
+
var b = A.value[m], N = {}, d = [];
|
|
8410
8414
|
if (!e.validate(b, c, N, d)) {
|
|
8411
8415
|
var i = new Error("Cannot read SafeBag.");
|
|
8412
8416
|
throw i.errors = d, i;
|
|
8413
8417
|
}
|
|
8414
8418
|
var n = {
|
|
8415
8419
|
type: e.derToOid(N.bagId),
|
|
8416
|
-
attributes:
|
|
8420
|
+
attributes: y(N.bagAttributes)
|
|
8417
8421
|
};
|
|
8418
8422
|
h.push(n);
|
|
8419
8423
|
var k, P, V = N.bagValue.value[0];
|
|
@@ -8440,7 +8444,7 @@ function sn() {
|
|
|
8440
8444
|
);
|
|
8441
8445
|
throw M.oid = e.derToOid(N.certId), M;
|
|
8442
8446
|
}
|
|
8443
|
-
var Q = e.fromDer(N.cert,
|
|
8447
|
+
var Q = e.fromDer(N.cert, v);
|
|
8444
8448
|
try {
|
|
8445
8449
|
n.cert = a.certificateFromAsn1(Q, !0);
|
|
8446
8450
|
} catch {
|
|
@@ -8460,39 +8464,39 @@ function sn() {
|
|
|
8460
8464
|
}
|
|
8461
8465
|
return h;
|
|
8462
8466
|
}
|
|
8463
|
-
function
|
|
8464
|
-
var
|
|
8467
|
+
function y(A) {
|
|
8468
|
+
var v = {};
|
|
8465
8469
|
if (A !== void 0)
|
|
8466
8470
|
for (var s = 0; s < A.length; ++s) {
|
|
8467
|
-
var h = {},
|
|
8468
|
-
if (!e.validate(A[s], r, h,
|
|
8471
|
+
var h = {}, m = [];
|
|
8472
|
+
if (!e.validate(A[s], r, h, m)) {
|
|
8469
8473
|
var b = new Error("Cannot read PKCS#12 BagAttribute.");
|
|
8470
|
-
throw b.errors =
|
|
8474
|
+
throw b.errors = m, b;
|
|
8471
8475
|
}
|
|
8472
8476
|
var N = e.derToOid(h.oid);
|
|
8473
8477
|
if (a.oids[N] !== void 0) {
|
|
8474
|
-
|
|
8478
|
+
v[a.oids[N]] = [];
|
|
8475
8479
|
for (var d = 0; d < h.values.length; ++d)
|
|
8476
|
-
|
|
8480
|
+
v[a.oids[N]].push(h.values[d].value);
|
|
8477
8481
|
}
|
|
8478
8482
|
}
|
|
8479
|
-
return
|
|
8483
|
+
return v;
|
|
8480
8484
|
}
|
|
8481
|
-
return p.toPkcs12Asn1 = function(A,
|
|
8485
|
+
return p.toPkcs12Asn1 = function(A, v, s, h) {
|
|
8482
8486
|
h = h || {}, h.saltSize = h.saltSize || 8, h.count = h.count || 2048, h.algorithm = h.algorithm || h.encAlgorithm || "aes128", "useMac" in h || (h.useMac = !0), "localKeyId" in h || (h.localKeyId = null), "generateLocalKeyId" in h || (h.generateLocalKeyId = !0);
|
|
8483
|
-
var
|
|
8484
|
-
if (
|
|
8485
|
-
|
|
8487
|
+
var m = h.localKeyId, b;
|
|
8488
|
+
if (m !== null)
|
|
8489
|
+
m = t.util.hexToBytes(m);
|
|
8486
8490
|
else if (h.generateLocalKeyId)
|
|
8487
|
-
if (
|
|
8488
|
-
var N = t.util.isArray(
|
|
8491
|
+
if (v) {
|
|
8492
|
+
var N = t.util.isArray(v) ? v[0] : v;
|
|
8489
8493
|
typeof N == "string" && (N = a.certificateFromPem(N));
|
|
8490
8494
|
var d = t.md.sha1.create();
|
|
8491
|
-
d.update(e.toDer(a.certificateToAsn1(N)).getBytes()),
|
|
8495
|
+
d.update(e.toDer(a.certificateToAsn1(N)).getBytes()), m = d.digest().getBytes();
|
|
8492
8496
|
} else
|
|
8493
|
-
|
|
8497
|
+
m = t.random.getBytes(20);
|
|
8494
8498
|
var i = [];
|
|
8495
|
-
|
|
8499
|
+
m !== null && i.push(
|
|
8496
8500
|
// localKeyID
|
|
8497
8501
|
e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
8498
8502
|
// attrId
|
|
@@ -8508,7 +8512,7 @@ function sn() {
|
|
|
8508
8512
|
e.Class.UNIVERSAL,
|
|
8509
8513
|
e.Type.OCTETSTRING,
|
|
8510
8514
|
!1,
|
|
8511
|
-
|
|
8515
|
+
m
|
|
8512
8516
|
)
|
|
8513
8517
|
])
|
|
8514
8518
|
])
|
|
@@ -8534,10 +8538,10 @@ function sn() {
|
|
|
8534
8538
|
])
|
|
8535
8539
|
), i.length > 0 && (b = e.create(e.Class.UNIVERSAL, e.Type.SET, !0, i));
|
|
8536
8540
|
var n = [], k = [];
|
|
8537
|
-
|
|
8541
|
+
v !== null && (t.util.isArray(v) ? k = v : k = [v]);
|
|
8538
8542
|
for (var P = [], V = 0; V < k.length; ++V) {
|
|
8539
|
-
|
|
8540
|
-
var O = V === 0 ? b : void 0, M = a.certificateToAsn1(
|
|
8543
|
+
v = k[V], typeof v == "string" && (v = a.certificateFromPem(v));
|
|
8544
|
+
var O = V === 0 ? b : void 0, M = a.certificateToAsn1(v), Q = e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
8541
8545
|
// bagId
|
|
8542
8546
|
e.create(
|
|
8543
8547
|
e.Class.UNIVERSAL,
|
|
@@ -8636,7 +8640,7 @@ function sn() {
|
|
|
8636
8640
|
// bagAttributes (OPTIONAL)
|
|
8637
8641
|
b
|
|
8638
8642
|
]);
|
|
8639
|
-
var re = e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [J]),
|
|
8643
|
+
var re = e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [J]), Z = (
|
|
8640
8644
|
// PKCS#7 ContentInfo
|
|
8641
8645
|
e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
8642
8646
|
// contentType
|
|
@@ -8658,7 +8662,7 @@ function sn() {
|
|
|
8658
8662
|
])
|
|
8659
8663
|
])
|
|
8660
8664
|
);
|
|
8661
|
-
n.push(
|
|
8665
|
+
n.push(Z);
|
|
8662
8666
|
}
|
|
8663
8667
|
var se = e.create(
|
|
8664
8668
|
e.Class.UNIVERSAL,
|
|
@@ -9065,7 +9069,7 @@ function un() {
|
|
|
9065
9069
|
;
|
|
9066
9070
|
f.version = { major: K.major, minor: K.minor }, f.session.version = f.version;
|
|
9067
9071
|
}
|
|
9068
|
-
j !== null ? (f.expect = N, f.session.resuming = !0, f.session.sp.client_random = o.random.bytes()) : (f.expect = f.verifyClient !== !1 ? h :
|
|
9072
|
+
j !== null ? (f.expect = N, f.session.resuming = !0, f.session.sp.client_random = o.random.bytes()) : (f.expect = f.verifyClient !== !1 ? h : m, f.session.resuming = !1, r.createSecurityParameters(f, o)), f.open = !0, r.queue(f, r.createRecord(f, {
|
|
9069
9073
|
type: r.ContentType.handshake,
|
|
9070
9074
|
data: r.createServerHello(f)
|
|
9071
9075
|
})), f.session.resuming ? (r.queue(f, r.createRecord(f, {
|
|
@@ -9123,7 +9127,7 @@ function un() {
|
|
|
9123
9127
|
level: r.Alert.Level.fatal,
|
|
9124
9128
|
description: r.Alert.Description.illegal_parameter
|
|
9125
9129
|
}
|
|
9126
|
-
}) : q.length === 0 ? f.expect = F ? I :
|
|
9130
|
+
}) : q.length === 0 ? f.expect = F ? I : m : (F ? f.session.serverCertificate = q[0] : f.session.clientCertificate = q[0], r.verifyCertificateChain(f, q) && (f.expect = F ? I : m)), f.process();
|
|
9127
9131
|
}, r.handleServerKeyExchange = function(f, w, U) {
|
|
9128
9132
|
if (U > 0)
|
|
9129
9133
|
return f.error(f, {
|
|
@@ -9258,7 +9262,7 @@ function un() {
|
|
|
9258
9262
|
}), r.queue(f, w)), w = r.createRecord(f, {
|
|
9259
9263
|
type: r.ContentType.handshake,
|
|
9260
9264
|
data: r.createClientKeyExchange(f)
|
|
9261
|
-
}), r.queue(f, w), f.expect =
|
|
9265
|
+
}), r.queue(f, w), f.expect = v;
|
|
9262
9266
|
var K = function(q, F) {
|
|
9263
9267
|
q.session.certificateRequest !== null && q.session.clientCertificate !== null && r.queue(q, r.createRecord(q, {
|
|
9264
9268
|
type: r.ContentType.handshake,
|
|
@@ -9285,7 +9289,7 @@ function un() {
|
|
|
9285
9289
|
}
|
|
9286
9290
|
});
|
|
9287
9291
|
var U = f.entity === r.ConnectionEnd.client;
|
|
9288
|
-
(f.session.resuming && U || !f.session.resuming && !U) && (f.state.pending = r.createConnectionState(f)), f.state.current.read = f.state.pending.read, (!f.session.resuming && U || f.session.resuming && !U) && (f.state.pending = null), f.expect = U ?
|
|
9292
|
+
(f.session.resuming && U || !f.session.resuming && !U) && (f.state.pending = r.createConnectionState(f)), f.state.current.read = f.state.pending.read, (!f.session.resuming && U || f.session.resuming && !U) && (f.state.pending = null), f.expect = U ? y : d, f.process();
|
|
9289
9293
|
}, r.handleFinished = function(f, w, U) {
|
|
9290
9294
|
var o = w.fragment;
|
|
9291
9295
|
o.read -= 4;
|
|
@@ -9439,7 +9443,7 @@ function un() {
|
|
|
9439
9443
|
}
|
|
9440
9444
|
f.process();
|
|
9441
9445
|
};
|
|
9442
|
-
var g = 0, u = 1, I = 2, D = 3, E = 4, l = 5,
|
|
9446
|
+
var g = 0, u = 1, I = 2, D = 3, E = 4, l = 5, y = 6, A = 7, v = 8, s = 0, h = 1, m = 2, b = 3, N = 4, d = 5, i = 6, n = r.handleUnexpected, k = r.handleChangeCipherSpec, P = r.handleAlert, V = r.handleHandshake, O = r.handleApplicationData, M = r.handleHeartbeat, Q = [];
|
|
9443
9447
|
Q[r.ConnectionEnd.client] = [
|
|
9444
9448
|
// CC,AL,HS,AD,HB
|
|
9445
9449
|
/*SHE*/
|
|
@@ -9479,19 +9483,19 @@ function un() {
|
|
|
9479
9483
|
/*CER*/
|
|
9480
9484
|
[n, P, V, n, M]
|
|
9481
9485
|
];
|
|
9482
|
-
var G = r.handleHelloRequest, z = r.handleServerHello, J = r.handleCertificate, $ = r.handleServerKeyExchange, re = r.handleCertificateRequest,
|
|
9486
|
+
var G = r.handleHelloRequest, z = r.handleServerHello, J = r.handleCertificate, $ = r.handleServerKeyExchange, re = r.handleCertificateRequest, Z = r.handleServerHelloDone, se = r.handleFinished, de = [];
|
|
9483
9487
|
de[r.ConnectionEnd.client] = [
|
|
9484
9488
|
// HR,01,SH,03,04,05,06,07,08,09,10,SC,SK,CR,HD,15,CK,17,18,19,FI
|
|
9485
9489
|
/*SHE*/
|
|
9486
9490
|
[n, n, z, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n],
|
|
9487
9491
|
/*SCE*/
|
|
9488
|
-
[G, n, n, n, n, n, n, n, n, n, n, J, $, re,
|
|
9492
|
+
[G, n, n, n, n, n, n, n, n, n, n, J, $, re, Z, n, n, n, n, n, n],
|
|
9489
9493
|
/*SKE*/
|
|
9490
|
-
[G, n, n, n, n, n, n, n, n, n, n, n, $, re,
|
|
9494
|
+
[G, n, n, n, n, n, n, n, n, n, n, n, $, re, Z, n, n, n, n, n, n],
|
|
9491
9495
|
/*SCR*/
|
|
9492
|
-
[G, n, n, n, n, n, n, n, n, n, n, n, n, re,
|
|
9496
|
+
[G, n, n, n, n, n, n, n, n, n, n, n, n, re, Z, n, n, n, n, n, n],
|
|
9493
9497
|
/*SHD*/
|
|
9494
|
-
[G, n, n, n, n, n, n, n, n, n, n, n, n, n,
|
|
9498
|
+
[G, n, n, n, n, n, n, n, n, n, n, n, n, n, Z, n, n, n, n, n, n],
|
|
9495
9499
|
/*SCC*/
|
|
9496
9500
|
[G, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n, n],
|
|
9497
9501
|
/*SFI*/
|
|
@@ -10122,8 +10126,8 @@ function cs() {
|
|
|
10122
10126
|
function C(g, u, I) {
|
|
10123
10127
|
var D = !0;
|
|
10124
10128
|
if (I) {
|
|
10125
|
-
for (var E = u.length(), l = u.last(),
|
|
10126
|
-
D = D && u.at(
|
|
10129
|
+
for (var E = u.length(), l = u.last(), y = E - 1 - l; y < E - 1; ++y)
|
|
10130
|
+
D = D && u.at(y) == l;
|
|
10127
10131
|
D && u.truncate(l + 1);
|
|
10128
10132
|
}
|
|
10129
10133
|
return D;
|
|
@@ -10133,10 +10137,10 @@ function cs() {
|
|
|
10133
10137
|
g.version.minor === e.Versions.TLS_1_0.minor ? D = u.cipherState.init ? null : u.cipherState.iv : D = g.fragment.getBytes(16), u.cipherState.init = !0;
|
|
10134
10138
|
var E = u.cipherState.cipher;
|
|
10135
10139
|
E.start({ iv: D }), E.update(g.fragment), I = E.finish(C);
|
|
10136
|
-
var l = u.macLength,
|
|
10137
|
-
A >= l ? (g.fragment = E.output.getBytes(A - l),
|
|
10138
|
-
var
|
|
10139
|
-
return u.updateSequenceNumber(), I = r(u.macKey,
|
|
10140
|
+
var l = u.macLength, y = t.random.getBytesSync(l), A = E.output.length();
|
|
10141
|
+
A >= l ? (g.fragment = E.output.getBytes(A - l), y = E.output.getBytes(l)) : g.fragment = E.output.getBytes(), g.fragment = t.util.createBuffer(g.fragment), g.length = g.fragment.length();
|
|
10142
|
+
var v = u.macFunction(u.macKey, u.sequenceNumber, g);
|
|
10143
|
+
return u.updateSequenceNumber(), I = r(u.macKey, y, v) && I, I;
|
|
10140
10144
|
}
|
|
10141
10145
|
function r(g, u, I) {
|
|
10142
10146
|
var D = t.hmac.create();
|
|
@@ -10166,8 +10170,8 @@ function ln() {
|
|
|
10166
10170
|
}, t.md["sha512/224"] = t.md.algorithms["sha512/224"] = t.sha512.sha224, e.create = function(u) {
|
|
10167
10171
|
if (S || r(), typeof u > "u" && (u = "SHA-512"), !(u in c))
|
|
10168
10172
|
throw new Error("Invalid SHA-512 algorithm: " + u);
|
|
10169
|
-
for (var I = c[u], D = null, E = t.util.createBuffer(), l = new Array(80),
|
|
10170
|
-
l[
|
|
10173
|
+
for (var I = c[u], D = null, E = t.util.createBuffer(), l = new Array(80), y = 0; y < 80; ++y)
|
|
10174
|
+
l[y] = new Array(2);
|
|
10171
10175
|
var A = 64;
|
|
10172
10176
|
switch (u) {
|
|
10173
10177
|
case "SHA-384":
|
|
@@ -10180,7 +10184,7 @@ function ln() {
|
|
|
10180
10184
|
A = 28;
|
|
10181
10185
|
break;
|
|
10182
10186
|
}
|
|
10183
|
-
var
|
|
10187
|
+
var v = {
|
|
10184
10188
|
// SHA-512 => sha512
|
|
10185
10189
|
algorithm: u.replace("-", "").toLowerCase(),
|
|
10186
10190
|
blockLength: 128,
|
|
@@ -10192,28 +10196,28 @@ function ln() {
|
|
|
10192
10196
|
// size of message length in bytes
|
|
10193
10197
|
messageLengthSize: 16
|
|
10194
10198
|
};
|
|
10195
|
-
return
|
|
10196
|
-
|
|
10197
|
-
for (var s =
|
|
10198
|
-
|
|
10199
|
+
return v.start = function() {
|
|
10200
|
+
v.messageLength = 0, v.fullMessageLength = v.messageLength128 = [];
|
|
10201
|
+
for (var s = v.messageLengthSize / 4, h = 0; h < s; ++h)
|
|
10202
|
+
v.fullMessageLength.push(0);
|
|
10199
10203
|
E = t.util.createBuffer(), D = new Array(I.length);
|
|
10200
10204
|
for (var h = 0; h < I.length; ++h)
|
|
10201
10205
|
D[h] = I[h].slice(0);
|
|
10202
|
-
return
|
|
10203
|
-
},
|
|
10206
|
+
return v;
|
|
10207
|
+
}, v.start(), v.update = function(s, h) {
|
|
10204
10208
|
h === "utf8" && (s = t.util.encodeUtf8(s));
|
|
10205
|
-
var
|
|
10206
|
-
|
|
10207
|
-
for (var b =
|
|
10208
|
-
|
|
10209
|
-
return E.putBytes(s), g(D, l, E), (E.read > 2048 || E.length() === 0) && E.compact(),
|
|
10210
|
-
},
|
|
10209
|
+
var m = s.length;
|
|
10210
|
+
v.messageLength += m, m = [m / 4294967296 >>> 0, m >>> 0];
|
|
10211
|
+
for (var b = v.fullMessageLength.length - 1; b >= 0; --b)
|
|
10212
|
+
v.fullMessageLength[b] += m[1], m[1] = m[0] + (v.fullMessageLength[b] / 4294967296 >>> 0), v.fullMessageLength[b] = v.fullMessageLength[b] >>> 0, m[0] = m[1] / 4294967296 >>> 0;
|
|
10213
|
+
return E.putBytes(s), g(D, l, E), (E.read > 2048 || E.length() === 0) && E.compact(), v;
|
|
10214
|
+
}, v.digest = function() {
|
|
10211
10215
|
var s = t.util.createBuffer();
|
|
10212
10216
|
s.putBytes(E.bytes());
|
|
10213
|
-
var h =
|
|
10214
|
-
s.putBytes(p.substr(0,
|
|
10215
|
-
for (var b, N, d =
|
|
10216
|
-
b =
|
|
10217
|
+
var h = v.fullMessageLength[v.fullMessageLength.length - 1] + v.messageLengthSize, m = h & v.blockLength - 1;
|
|
10218
|
+
s.putBytes(p.substr(0, v.blockLength - m));
|
|
10219
|
+
for (var b, N, d = v.fullMessageLength[0] * 8, i = 0; i < v.fullMessageLength.length - 1; ++i)
|
|
10220
|
+
b = v.fullMessageLength[i + 1] * 8, N = b / 4294967296 >>> 0, d += N, s.putInt32(d >>> 0), d = b >>> 0;
|
|
10217
10221
|
s.putInt32(d);
|
|
10218
10222
|
for (var n = new Array(D.length), i = 0; i < D.length; ++i)
|
|
10219
10223
|
n[i] = D[i].slice(0);
|
|
@@ -10223,7 +10227,7 @@ function ln() {
|
|
|
10223
10227
|
for (var i = 0; i < P; ++i)
|
|
10224
10228
|
k.putInt32(n[i][0]), (i !== P - 1 || u !== "SHA-512/224") && k.putInt32(n[i][1]);
|
|
10225
10229
|
return k;
|
|
10226
|
-
},
|
|
10230
|
+
}, v;
|
|
10227
10231
|
};
|
|
10228
10232
|
var p = null, S = !1, C = null, c = null;
|
|
10229
10233
|
function r() {
|
|
@@ -10347,7 +10351,7 @@ function ln() {
|
|
|
10347
10351
|
], S = !0;
|
|
10348
10352
|
}
|
|
10349
10353
|
function g(u, I, D) {
|
|
10350
|
-
for (var E, l,
|
|
10354
|
+
for (var E, l, y, A, v, s, h, m, b, N, d, i, n, k, P, V, O, M, Q, G, z, J, $, re, Z, se, de, me, _, ue, te, ze, fe, f, w, U = D.length(); U >= 128; ) {
|
|
10351
10355
|
for (_ = 0; _ < 16; ++_)
|
|
10352
10356
|
I[_][0] = D.getInt32() >>> 0, I[_][1] = D.getInt32() >>> 0;
|
|
10353
10357
|
for (; _ < 80; ++_)
|
|
@@ -10355,22 +10359,22 @@ function ln() {
|
|
|
10355
10359
|
(te >>> 29 | ue << 3) ^ // ROTR 61/(swap + ROTR 29)
|
|
10356
10360
|
ue >>> 6) >>> 0, l = ((ue << 13 | te >>> 19) ^ // ROTR 19
|
|
10357
10361
|
(te << 3 | ue >>> 29) ^ // ROTR 61/(swap + ROTR 29)
|
|
10358
|
-
(ue << 26 | te >>> 6)) >>> 0, f = I[_ - 15], ue = f[0], te = f[1],
|
|
10362
|
+
(ue << 26 | te >>> 6)) >>> 0, f = I[_ - 15], ue = f[0], te = f[1], y = ((ue >>> 1 | te << 31) ^ // ROTR 1
|
|
10359
10363
|
(ue >>> 8 | te << 24) ^ // ROTR 8
|
|
10360
10364
|
ue >>> 7) >>> 0, A = ((ue << 31 | te >>> 1) ^ // ROTR 1
|
|
10361
10365
|
(ue << 24 | te >>> 8) ^ // ROTR 8
|
|
10362
|
-
(ue << 25 | te >>> 7)) >>> 0, fe = I[_ - 7], w = I[_ - 16], te = l + fe[1] + A + w[1], I[_][0] = E + fe[0] +
|
|
10363
|
-
for (n = u[0][0], k = u[0][1], P = u[1][0], V = u[1][1], O = u[2][0], M = u[2][1], Q = u[3][0], G = u[3][1], z = u[4][0], J = u[4][1], $ = u[5][0], re = u[5][1],
|
|
10366
|
+
(ue << 25 | te >>> 7)) >>> 0, fe = I[_ - 7], w = I[_ - 16], te = l + fe[1] + A + w[1], I[_][0] = E + fe[0] + y + w[0] + (te / 4294967296 >>> 0) >>> 0, I[_][1] = te >>> 0;
|
|
10367
|
+
for (n = u[0][0], k = u[0][1], P = u[1][0], V = u[1][1], O = u[2][0], M = u[2][1], Q = u[3][0], G = u[3][1], z = u[4][0], J = u[4][1], $ = u[5][0], re = u[5][1], Z = u[6][0], se = u[6][1], de = u[7][0], me = u[7][1], _ = 0; _ < 80; ++_)
|
|
10364
10368
|
h = ((z >>> 14 | J << 18) ^ // ROTR 14
|
|
10365
10369
|
(z >>> 18 | J << 14) ^ // ROTR 18
|
|
10366
|
-
(J >>> 9 | z << 23)) >>> 0,
|
|
10370
|
+
(J >>> 9 | z << 23)) >>> 0, m = ((z << 18 | J >>> 14) ^ // ROTR 14
|
|
10367
10371
|
(z << 14 | J >>> 18) ^ // ROTR 18
|
|
10368
|
-
(J << 23 | z >>> 9)) >>> 0, b = (
|
|
10372
|
+
(J << 23 | z >>> 9)) >>> 0, b = (Z ^ z & ($ ^ Z)) >>> 0, N = (se ^ J & (re ^ se)) >>> 0, v = ((n >>> 28 | k << 4) ^ // ROTR 28
|
|
10369
10373
|
(k >>> 2 | n << 30) ^ // ROTR 34/(swap + ROTR 2)
|
|
10370
10374
|
(k >>> 7 | n << 25)) >>> 0, s = ((n << 4 | k >>> 28) ^ // ROTR 28
|
|
10371
10375
|
(k << 30 | n >>> 2) ^ // ROTR 34/(swap + ROTR 2)
|
|
10372
|
-
(k << 25 | n >>> 7)) >>> 0, d = (n & P | O & (n ^ P)) >>> 0, i = (k & V | M & (k ^ V)) >>> 0, te = me +
|
|
10373
|
-
te = u[0][1] + k, u[0][0] = u[0][0] + n + (te / 4294967296 >>> 0) >>> 0, u[0][1] = te >>> 0, te = u[1][1] + V, u[1][0] = u[1][0] + P + (te / 4294967296 >>> 0) >>> 0, u[1][1] = te >>> 0, te = u[2][1] + M, u[2][0] = u[2][0] + O + (te / 4294967296 >>> 0) >>> 0, u[2][1] = te >>> 0, te = u[3][1] + G, u[3][0] = u[3][0] + Q + (te / 4294967296 >>> 0) >>> 0, u[3][1] = te >>> 0, te = u[4][1] + J, u[4][0] = u[4][0] + z + (te / 4294967296 >>> 0) >>> 0, u[4][1] = te >>> 0, te = u[5][1] + re, u[5][0] = u[5][0] + $ + (te / 4294967296 >>> 0) >>> 0, u[5][1] = te >>> 0, te = u[6][1] + se, u[6][0] = u[6][0] +
|
|
10376
|
+
(k << 25 | n >>> 7)) >>> 0, d = (n & P | O & (n ^ P)) >>> 0, i = (k & V | M & (k ^ V)) >>> 0, te = me + m + N + C[_][1] + I[_][1], E = de + h + b + C[_][0] + I[_][0] + (te / 4294967296 >>> 0) >>> 0, l = te >>> 0, te = s + i, y = v + d + (te / 4294967296 >>> 0) >>> 0, A = te >>> 0, de = Z, me = se, Z = $, se = re, $ = z, re = J, te = G + l, z = Q + E + (te / 4294967296 >>> 0) >>> 0, J = te >>> 0, Q = O, G = M, O = P, M = V, P = n, V = k, te = l + A, n = E + y + (te / 4294967296 >>> 0) >>> 0, k = te >>> 0;
|
|
10377
|
+
te = u[0][1] + k, u[0][0] = u[0][0] + n + (te / 4294967296 >>> 0) >>> 0, u[0][1] = te >>> 0, te = u[1][1] + V, u[1][0] = u[1][0] + P + (te / 4294967296 >>> 0) >>> 0, u[1][1] = te >>> 0, te = u[2][1] + M, u[2][0] = u[2][0] + O + (te / 4294967296 >>> 0) >>> 0, u[2][1] = te >>> 0, te = u[3][1] + G, u[3][0] = u[3][0] + Q + (te / 4294967296 >>> 0) >>> 0, u[3][1] = te >>> 0, te = u[4][1] + J, u[4][0] = u[4][0] + z + (te / 4294967296 >>> 0) >>> 0, u[4][1] = te >>> 0, te = u[5][1] + re, u[5][0] = u[5][0] + $ + (te / 4294967296 >>> 0) >>> 0, u[5][1] = te >>> 0, te = u[6][1] + se, u[6][0] = u[6][0] + Z + (te / 4294967296 >>> 0) >>> 0, u[6][1] = te >>> 0, te = u[7][1] + me, u[7][0] = u[7][0] + de + (te / 4294967296 >>> 0) >>> 0, u[7][1] = te >>> 0, U -= 128;
|
|
10374
10378
|
}
|
|
10375
10379
|
}
|
|
10376
10380
|
return Dr.exports;
|
|
@@ -10554,7 +10558,7 @@ function ps() {
|
|
|
10554
10558
|
var T = new c(
|
|
10555
10559
|
r.constants.SIGN_BYTE_LENGTH + w.length
|
|
10556
10560
|
);
|
|
10557
|
-
|
|
10561
|
+
m(T, w, w.length, U);
|
|
10558
10562
|
for (var j = new c(r.constants.SIGN_BYTE_LENGTH), K = 0; K < j.length; ++K)
|
|
10559
10563
|
j[K] = T[K];
|
|
10560
10564
|
return j;
|
|
@@ -10663,7 +10667,7 @@ function ps() {
|
|
|
10663
10667
|
52590,
|
|
10664
10668
|
14035,
|
|
10665
10669
|
8553
|
|
10666
|
-
]),
|
|
10670
|
+
]), y = _([
|
|
10667
10671
|
26200,
|
|
10668
10672
|
26214,
|
|
10669
10673
|
26214,
|
|
@@ -10713,7 +10717,7 @@ function ps() {
|
|
|
10713
10717
|
0,
|
|
10714
10718
|
0,
|
|
10715
10719
|
16
|
|
10716
|
-
]),
|
|
10720
|
+
]), v = _([
|
|
10717
10721
|
41136,
|
|
10718
10722
|
18958,
|
|
10719
10723
|
6951,
|
|
@@ -10747,7 +10751,7 @@ function ps() {
|
|
|
10747
10751
|
w[o + 32] = f[o];
|
|
10748
10752
|
return 0;
|
|
10749
10753
|
}
|
|
10750
|
-
function
|
|
10754
|
+
function m(f, w, U, o) {
|
|
10751
10755
|
var T, j, K = new Float64Array(64), q = [_(), _(), _(), _()], F = s(o, 32);
|
|
10752
10756
|
F[0] &= 248, F[31] &= 127, F[31] |= 64;
|
|
10753
10757
|
var X = U + 64;
|
|
@@ -10831,7 +10835,7 @@ function ps() {
|
|
|
10831
10835
|
}
|
|
10832
10836
|
function V(f, w) {
|
|
10833
10837
|
var U = _(), o = _(), T = _(), j = _(), K = _(), q = _(), F = _();
|
|
10834
|
-
return
|
|
10838
|
+
return Z(f[2], I), O(f[1], w), ze(T, f[1]), fe(j, T, D), te(T, T, f[2]), ue(j, f[2], j), ze(K, j), ze(q, K), fe(F, q, K), fe(U, F, T), fe(U, U, j), M(U, U), fe(U, U, T), fe(U, U, j), fe(U, U, j), fe(f[0], U, j), ze(o, f[0]), fe(o, o, j), Q(o, T) && fe(f[0], f[0], v), ze(o, f[0]), fe(o, o, j), Q(o, T) ? -1 : (J(f[0]) === w[31] >> 7 && te(f[0], u, f[0]), fe(f[3], f[0], f[1]), 0);
|
|
10835
10839
|
}
|
|
10836
10840
|
function O(f, w) {
|
|
10837
10841
|
var U;
|
|
@@ -10867,14 +10871,14 @@ function ps() {
|
|
|
10867
10871
|
}
|
|
10868
10872
|
function $(f, w, U) {
|
|
10869
10873
|
var o, T;
|
|
10870
|
-
for (
|
|
10874
|
+
for (Z(f[0], u), Z(f[1], I), Z(f[2], I), Z(f[3], u), T = 255; T >= 0; --T)
|
|
10871
10875
|
o = U[T / 8 | 0] >> (T & 7) & 1, n(f, w, o), i(w, f), i(f, f), n(f, w, o);
|
|
10872
10876
|
}
|
|
10873
10877
|
function re(f, w) {
|
|
10874
10878
|
var U = [_(), _(), _(), _()];
|
|
10875
|
-
|
|
10879
|
+
Z(U[0], l), Z(U[1], y), Z(U[2], I), fe(U[3], l, y), $(f, U, w);
|
|
10876
10880
|
}
|
|
10877
|
-
function
|
|
10881
|
+
function Z(f, w) {
|
|
10878
10882
|
var U;
|
|
10879
10883
|
for (U = 0; U < 16; U++)
|
|
10880
10884
|
f[U] = w[U] | 0;
|
|
@@ -10990,13 +10994,13 @@ function hs() {
|
|
|
10990
10994
|
};
|
|
10991
10995
|
}
|
|
10992
10996
|
t.log.logMessage = function(E) {
|
|
10993
|
-
for (var l = e[E.level].index,
|
|
10994
|
-
var A = a[
|
|
10997
|
+
for (var l = e[E.level].index, y = 0; y < a.length; ++y) {
|
|
10998
|
+
var A = a[y];
|
|
10995
10999
|
if (A.flags & t.log.NO_LEVEL_CHECK)
|
|
10996
11000
|
A.f(E);
|
|
10997
11001
|
else {
|
|
10998
|
-
var
|
|
10999
|
-
l <=
|
|
11002
|
+
var v = e[A.level].index;
|
|
11003
|
+
l <= v && A.f(A, E);
|
|
11000
11004
|
}
|
|
11001
11005
|
}
|
|
11002
11006
|
}, t.log.prepareStandard = function(E) {
|
|
@@ -11012,13 +11016,13 @@ function hs() {
|
|
|
11012
11016
|
};
|
|
11013
11017
|
for (var c = ["error", "warning", "info", "debug", "verbose"], S = 0; S < c.length; ++S)
|
|
11014
11018
|
(function(l) {
|
|
11015
|
-
t.log[l] = function(
|
|
11016
|
-
var
|
|
11019
|
+
t.log[l] = function(y, A) {
|
|
11020
|
+
var v = Array.prototype.slice.call(arguments).slice(2), s = {
|
|
11017
11021
|
timestamp: /* @__PURE__ */ new Date(),
|
|
11018
11022
|
level: l,
|
|
11019
|
-
category:
|
|
11023
|
+
category: y,
|
|
11020
11024
|
message: A,
|
|
11021
|
-
arguments:
|
|
11025
|
+
arguments: v
|
|
11022
11026
|
/*standard*/
|
|
11023
11027
|
/*full*/
|
|
11024
11028
|
/*fullMessage*/
|
|
@@ -11033,16 +11037,16 @@ function hs() {
|
|
|
11033
11037
|
};
|
|
11034
11038
|
return t.log.setLevel(l, "none"), l;
|
|
11035
11039
|
}, t.log.setLevel = function(E, l) {
|
|
11036
|
-
var
|
|
11040
|
+
var y = !1;
|
|
11037
11041
|
if (E && !(E.flags & t.log.LEVEL_LOCKED))
|
|
11038
11042
|
for (var A = 0; A < t.log.levels.length; ++A) {
|
|
11039
|
-
var
|
|
11040
|
-
if (l ==
|
|
11041
|
-
E.level = l,
|
|
11043
|
+
var v = t.log.levels[A];
|
|
11044
|
+
if (l == v) {
|
|
11045
|
+
E.level = l, y = !0;
|
|
11042
11046
|
break;
|
|
11043
11047
|
}
|
|
11044
11048
|
}
|
|
11045
|
-
return
|
|
11049
|
+
return y;
|
|
11046
11050
|
}, t.log.lock = function(E, l) {
|
|
11047
11051
|
typeof l > "u" || l ? E.flags |= t.log.LEVEL_LOCKED : E.flags &= ~t.log.LEVEL_LOCKED;
|
|
11048
11052
|
}, t.log.addLogger = function(E) {
|
|
@@ -11058,13 +11062,13 @@ function hs() {
|
|
|
11058
11062
|
verbose: console.debug
|
|
11059
11063
|
}, u = function(E, l) {
|
|
11060
11064
|
t.log.prepareStandard(l);
|
|
11061
|
-
var
|
|
11062
|
-
A = A.concat(l.arguments.slice()),
|
|
11065
|
+
var y = g[l.level], A = [l.standard];
|
|
11066
|
+
A = A.concat(l.arguments.slice()), y.apply(console, A);
|
|
11063
11067
|
};
|
|
11064
11068
|
r = t.log.makeLogger(u);
|
|
11065
11069
|
} else {
|
|
11066
|
-
var u = function(l,
|
|
11067
|
-
t.log.prepareStandardFull(
|
|
11070
|
+
var u = function(l, y) {
|
|
11071
|
+
t.log.prepareStandardFull(y), console.log(y.standardFull);
|
|
11068
11072
|
};
|
|
11069
11073
|
r = t.log.makeLogger(u);
|
|
11070
11074
|
}
|
|
@@ -11098,28 +11102,28 @@ function ys() {
|
|
|
11098
11102
|
Rt(), yt(), Jt(), Ut(), Ot(), an(), dt(), ve(), Yr();
|
|
11099
11103
|
var e = t.asn1, a = Kr.exports = t.pkcs7 = t.pkcs7 || {};
|
|
11100
11104
|
a.messageFromPem = function(l) {
|
|
11101
|
-
var
|
|
11102
|
-
if (
|
|
11105
|
+
var y = t.pem.decode(l)[0];
|
|
11106
|
+
if (y.type !== "PKCS7") {
|
|
11103
11107
|
var A = new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');
|
|
11104
|
-
throw A.headerType =
|
|
11108
|
+
throw A.headerType = y.type, A;
|
|
11105
11109
|
}
|
|
11106
|
-
if (
|
|
11110
|
+
if (y.procType && y.procType.type === "ENCRYPTED")
|
|
11107
11111
|
throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");
|
|
11108
|
-
var
|
|
11109
|
-
return a.messageFromAsn1(
|
|
11110
|
-
}, a.messageToPem = function(l,
|
|
11112
|
+
var v = e.fromDer(y.body);
|
|
11113
|
+
return a.messageFromAsn1(v);
|
|
11114
|
+
}, a.messageToPem = function(l, y) {
|
|
11111
11115
|
var A = {
|
|
11112
11116
|
type: "PKCS7",
|
|
11113
11117
|
body: e.toDer(l.toAsn1()).getBytes()
|
|
11114
11118
|
};
|
|
11115
|
-
return t.pem.encode(A, { maxline:
|
|
11119
|
+
return t.pem.encode(A, { maxline: y });
|
|
11116
11120
|
}, a.messageFromAsn1 = function(l) {
|
|
11117
|
-
var
|
|
11118
|
-
if (!e.validate(l, a.asn1.contentInfoValidator,
|
|
11119
|
-
var
|
|
11120
|
-
throw
|
|
11121
|
+
var y = {}, A = [];
|
|
11122
|
+
if (!e.validate(l, a.asn1.contentInfoValidator, y, A)) {
|
|
11123
|
+
var v = new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");
|
|
11124
|
+
throw v.errors = A, v;
|
|
11121
11125
|
}
|
|
11122
|
-
var s = e.derToOid(
|
|
11126
|
+
var s = e.derToOid(y.contentType), h;
|
|
11123
11127
|
switch (s) {
|
|
11124
11128
|
case t.pki.oids.envelopedData:
|
|
11125
11129
|
h = a.createEnvelopedData();
|
|
@@ -11133,7 +11137,7 @@ function ys() {
|
|
|
11133
11137
|
default:
|
|
11134
11138
|
throw new Error("Cannot read PKCS#7 message. ContentType with OID " + s + " is not (yet) supported.");
|
|
11135
11139
|
}
|
|
11136
|
-
return h.fromAsn1(
|
|
11140
|
+
return h.fromAsn1(y.content.value[0]), h;
|
|
11137
11141
|
}, a.createSignedData = function() {
|
|
11138
11142
|
var l = null;
|
|
11139
11143
|
return l = {
|
|
@@ -11147,16 +11151,16 @@ function ys() {
|
|
|
11147
11151
|
digestAlgorithmIdentifiers: [],
|
|
11148
11152
|
contentInfo: null,
|
|
11149
11153
|
signerInfos: [],
|
|
11150
|
-
fromAsn1: function(
|
|
11151
|
-
if (D(l,
|
|
11154
|
+
fromAsn1: function(v) {
|
|
11155
|
+
if (D(l, v, a.asn1.signedDataValidator), l.certificates = [], l.crls = [], l.digestAlgorithmIdentifiers = [], l.contentInfo = null, l.signerInfos = [], l.rawCapture.certificates)
|
|
11152
11156
|
for (var s = l.rawCapture.certificates.value, h = 0; h < s.length; ++h)
|
|
11153
11157
|
l.certificates.push(t.pki.certificateFromAsn1(s[h]));
|
|
11154
11158
|
},
|
|
11155
11159
|
toAsn1: function() {
|
|
11156
11160
|
l.contentInfo || l.sign();
|
|
11157
|
-
for (var
|
|
11158
|
-
|
|
11159
|
-
var h = [],
|
|
11161
|
+
for (var v = [], s = 0; s < l.certificates.length; ++s)
|
|
11162
|
+
v.push(t.pki.certificateToAsn1(l.certificates[s]));
|
|
11163
|
+
var h = [], m = e.create(e.Class.CONTEXT_SPECIFIC, 0, !0, [
|
|
11160
11164
|
e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
11161
11165
|
// Version
|
|
11162
11166
|
e.create(
|
|
@@ -11176,11 +11180,11 @@ function ys() {
|
|
|
11176
11180
|
l.contentInfo
|
|
11177
11181
|
])
|
|
11178
11182
|
]);
|
|
11179
|
-
return
|
|
11180
|
-
e.create(e.Class.CONTEXT_SPECIFIC, 0, !0,
|
|
11181
|
-
), h.length > 0 &&
|
|
11183
|
+
return v.length > 0 && m.value[0].value.push(
|
|
11184
|
+
e.create(e.Class.CONTEXT_SPECIFIC, 0, !0, v)
|
|
11185
|
+
), h.length > 0 && m.value[0].value.push(
|
|
11182
11186
|
e.create(e.Class.CONTEXT_SPECIFIC, 1, !0, h)
|
|
11183
|
-
),
|
|
11187
|
+
), m.value[0].value.push(
|
|
11184
11188
|
e.create(
|
|
11185
11189
|
e.Class.UNIVERSAL,
|
|
11186
11190
|
e.Type.SET,
|
|
@@ -11200,7 +11204,7 @@ function ys() {
|
|
|
11200
11204
|
e.oidToDer(l.type).getBytes()
|
|
11201
11205
|
),
|
|
11202
11206
|
// [0] SignedData
|
|
11203
|
-
|
|
11207
|
+
m
|
|
11204
11208
|
]
|
|
11205
11209
|
);
|
|
11206
11210
|
},
|
|
@@ -11244,19 +11248,19 @@ function ys() {
|
|
|
11244
11248
|
* [authenticatedAttributes] an optional array of attributes
|
|
11245
11249
|
* to also sign along with the content.
|
|
11246
11250
|
*/
|
|
11247
|
-
addSigner: function(
|
|
11248
|
-
var s =
|
|
11249
|
-
if (
|
|
11250
|
-
var
|
|
11251
|
-
typeof
|
|
11251
|
+
addSigner: function(v) {
|
|
11252
|
+
var s = v.issuer, h = v.serialNumber;
|
|
11253
|
+
if (v.certificate) {
|
|
11254
|
+
var m = v.certificate;
|
|
11255
|
+
typeof m == "string" && (m = t.pki.certificateFromPem(m)), s = m.issuer.attributes, h = m.serialNumber;
|
|
11252
11256
|
}
|
|
11253
|
-
var b =
|
|
11257
|
+
var b = v.key;
|
|
11254
11258
|
if (!b)
|
|
11255
11259
|
throw new Error(
|
|
11256
11260
|
"Could not add PKCS#7 signer; no private key specified."
|
|
11257
11261
|
);
|
|
11258
11262
|
typeof b == "string" && (b = t.pki.privateKeyFromPem(b));
|
|
11259
|
-
var N =
|
|
11263
|
+
var N = v.digestAlgorithm || t.pki.oids.sha1;
|
|
11260
11264
|
switch (N) {
|
|
11261
11265
|
case t.pki.oids.sha1:
|
|
11262
11266
|
case t.pki.oids.sha256:
|
|
@@ -11269,7 +11273,7 @@ function ys() {
|
|
|
11269
11273
|
"Could not add PKCS#7 signer; unknown message digest algorithm: " + N
|
|
11270
11274
|
);
|
|
11271
11275
|
}
|
|
11272
|
-
var d =
|
|
11276
|
+
var d = v.authenticatedAttributes || [];
|
|
11273
11277
|
if (d.length > 0) {
|
|
11274
11278
|
for (var i = !1, n = !1, k = 0; k < d.length; ++k) {
|
|
11275
11279
|
var P = d[k];
|
|
@@ -11304,8 +11308,8 @@ function ys() {
|
|
|
11304
11308
|
* @param options Options to apply when signing:
|
|
11305
11309
|
* [detached] boolean. If signing should be done in detached mode. Defaults to false.
|
|
11306
11310
|
*/
|
|
11307
|
-
sign: function(
|
|
11308
|
-
if (
|
|
11311
|
+
sign: function(v) {
|
|
11312
|
+
if (v = v || {}, (typeof l.content != "object" || l.contentInfo === null) && (l.contentInfo = e.create(
|
|
11309
11313
|
e.Class.UNIVERSAL,
|
|
11310
11314
|
e.Type.SEQUENCE,
|
|
11311
11315
|
!0,
|
|
@@ -11320,7 +11324,7 @@ function ys() {
|
|
|
11320
11324
|
]
|
|
11321
11325
|
), "content" in l)) {
|
|
11322
11326
|
var s;
|
|
11323
|
-
l.content instanceof t.util.ByteBuffer ? s = l.content.bytes() : typeof l.content == "string" && (s = t.util.encodeUtf8(l.content)),
|
|
11327
|
+
l.content instanceof t.util.ByteBuffer ? s = l.content.bytes() : typeof l.content == "string" && (s = t.util.encodeUtf8(l.content)), v.detached ? l.detachedContent = e.create(e.Class.UNIVERSAL, e.Type.OCTETSTRING, !1, s) : l.contentInfo.value.push(
|
|
11324
11328
|
// [0] EXPLICIT content
|
|
11325
11329
|
e.create(e.Class.CONTEXT_SPECIFIC, 0, !0, [
|
|
11326
11330
|
e.create(
|
|
@@ -11333,7 +11337,7 @@ function ys() {
|
|
|
11333
11337
|
);
|
|
11334
11338
|
}
|
|
11335
11339
|
if (l.signers.length !== 0) {
|
|
11336
|
-
var h =
|
|
11340
|
+
var h = y();
|
|
11337
11341
|
A(h);
|
|
11338
11342
|
}
|
|
11339
11343
|
},
|
|
@@ -11345,25 +11349,25 @@ function ys() {
|
|
|
11345
11349
|
*
|
|
11346
11350
|
* @param cert the certificate to add.
|
|
11347
11351
|
*/
|
|
11348
|
-
addCertificate: function(
|
|
11349
|
-
typeof
|
|
11352
|
+
addCertificate: function(v) {
|
|
11353
|
+
typeof v == "string" && (v = t.pki.certificateFromPem(v)), l.certificates.push(v);
|
|
11350
11354
|
},
|
|
11351
11355
|
/**
|
|
11352
11356
|
* Add a certificate revokation list.
|
|
11353
11357
|
*
|
|
11354
11358
|
* @param crl the certificate revokation list to add.
|
|
11355
11359
|
*/
|
|
11356
|
-
addCertificateRevokationList: function(
|
|
11360
|
+
addCertificateRevokationList: function(v) {
|
|
11357
11361
|
throw new Error("PKCS#7 CRL support not yet implemented.");
|
|
11358
11362
|
}
|
|
11359
11363
|
}, l;
|
|
11360
|
-
function
|
|
11361
|
-
for (var
|
|
11362
|
-
var h = l.signers[s],
|
|
11363
|
-
|
|
11364
|
+
function y() {
|
|
11365
|
+
for (var v = {}, s = 0; s < l.signers.length; ++s) {
|
|
11366
|
+
var h = l.signers[s], m = h.digestAlgorithm;
|
|
11367
|
+
m in v || (v[m] = t.md[t.pki.oids[m]].create()), h.authenticatedAttributes.length === 0 ? h.md = v[m] : h.md = t.md[t.pki.oids[m]].create();
|
|
11364
11368
|
}
|
|
11365
11369
|
l.digestAlgorithmIdentifiers = [];
|
|
11366
|
-
for (var
|
|
11370
|
+
for (var m in v)
|
|
11367
11371
|
l.digestAlgorithmIdentifiers.push(
|
|
11368
11372
|
// AlgorithmIdentifier
|
|
11369
11373
|
e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
@@ -11372,24 +11376,24 @@ function ys() {
|
|
|
11372
11376
|
e.Class.UNIVERSAL,
|
|
11373
11377
|
e.Type.OID,
|
|
11374
11378
|
!1,
|
|
11375
|
-
e.oidToDer(
|
|
11379
|
+
e.oidToDer(m).getBytes()
|
|
11376
11380
|
),
|
|
11377
11381
|
// parameters (null)
|
|
11378
11382
|
e.create(e.Class.UNIVERSAL, e.Type.NULL, !1, "")
|
|
11379
11383
|
])
|
|
11380
11384
|
);
|
|
11381
|
-
return
|
|
11385
|
+
return v;
|
|
11382
11386
|
}
|
|
11383
|
-
function A(
|
|
11387
|
+
function A(v) {
|
|
11384
11388
|
var s;
|
|
11385
11389
|
if (l.detachedContent ? s = l.detachedContent : (s = l.contentInfo.value[1], s = s.value[0]), !s)
|
|
11386
11390
|
throw new Error(
|
|
11387
11391
|
"Could not sign PKCS#7 message; there is no content to sign."
|
|
11388
11392
|
);
|
|
11389
|
-
var h = e.derToOid(l.contentInfo.value[0].value),
|
|
11390
|
-
|
|
11391
|
-
for (var b in
|
|
11392
|
-
|
|
11393
|
+
var h = e.derToOid(l.contentInfo.value[0].value), m = e.toDer(s);
|
|
11394
|
+
m.getByte(), e.getBerValueLength(m), m = m.getBytes();
|
|
11395
|
+
for (var b in v)
|
|
11396
|
+
v[b].start().update(m);
|
|
11393
11397
|
for (var N = /* @__PURE__ */ new Date(), d = 0; d < l.signers.length; ++d) {
|
|
11394
11398
|
var i = l.signers[d];
|
|
11395
11399
|
if (i.authenticatedAttributes.length === 0) {
|
|
@@ -11411,9 +11415,9 @@ function ys() {
|
|
|
11411
11415
|
[]
|
|
11412
11416
|
), k = 0; k < i.authenticatedAttributes.length; ++k) {
|
|
11413
11417
|
var P = i.authenticatedAttributes[k];
|
|
11414
|
-
P.type === t.pki.oids.messageDigest ? P.value =
|
|
11418
|
+
P.type === t.pki.oids.messageDigest ? P.value = v[i.digestAlgorithm].digest() : P.type === t.pki.oids.signingTime && (P.value || (P.value = N)), n.value.push(u(P)), i.authenticatedAttributesAsn1.value.push(u(P));
|
|
11415
11419
|
}
|
|
11416
|
-
|
|
11420
|
+
m = e.toDer(n).getBytes(), i.md.start().update(m);
|
|
11417
11421
|
}
|
|
11418
11422
|
i.signature = i.key.sign(i.md, "RSASSA-PKCS1-V1_5");
|
|
11419
11423
|
}
|
|
@@ -11432,16 +11436,16 @@ function ys() {
|
|
|
11432
11436
|
*
|
|
11433
11437
|
* @param obj The ASN.1 representation of the EncryptedData content block
|
|
11434
11438
|
*/
|
|
11435
|
-
fromAsn1: function(
|
|
11436
|
-
D(l,
|
|
11439
|
+
fromAsn1: function(y) {
|
|
11440
|
+
D(l, y, a.asn1.encryptedDataValidator);
|
|
11437
11441
|
},
|
|
11438
11442
|
/**
|
|
11439
11443
|
* Decrypt encrypted content
|
|
11440
11444
|
*
|
|
11441
11445
|
* @param key The (symmetric) key as a byte buffer
|
|
11442
11446
|
*/
|
|
11443
|
-
decrypt: function(
|
|
11444
|
-
|
|
11447
|
+
decrypt: function(y) {
|
|
11448
|
+
y !== void 0 && (l.encryptedContent.key = y), E(l);
|
|
11445
11449
|
}
|
|
11446
11450
|
}, l;
|
|
11447
11451
|
}, a.createEnvelopedData = function() {
|
|
@@ -11458,8 +11462,8 @@ function ys() {
|
|
|
11458
11462
|
*
|
|
11459
11463
|
* @param obj the ASN.1 representation of the EnvelopedData content block.
|
|
11460
11464
|
*/
|
|
11461
|
-
fromAsn1: function(
|
|
11462
|
-
var A = D(l,
|
|
11465
|
+
fromAsn1: function(y) {
|
|
11466
|
+
var A = D(l, y, a.asn1.envelopedDataValidator);
|
|
11463
11467
|
l.recipients = C(A.recipientInfos.value);
|
|
11464
11468
|
},
|
|
11465
11469
|
toAsn1: function() {
|
|
@@ -11506,16 +11510,16 @@ function ys() {
|
|
|
11506
11510
|
*
|
|
11507
11511
|
* @return the recipient object.
|
|
11508
11512
|
*/
|
|
11509
|
-
findRecipient: function(
|
|
11510
|
-
for (var A =
|
|
11511
|
-
var s = l.recipients[
|
|
11512
|
-
if (s.serialNumber ===
|
|
11513
|
-
for (var
|
|
11513
|
+
findRecipient: function(y) {
|
|
11514
|
+
for (var A = y.issuer.attributes, v = 0; v < l.recipients.length; ++v) {
|
|
11515
|
+
var s = l.recipients[v], h = s.issuer;
|
|
11516
|
+
if (s.serialNumber === y.serialNumber && h.length === A.length) {
|
|
11517
|
+
for (var m = !0, b = 0; b < A.length; ++b)
|
|
11514
11518
|
if (h[b].type !== A[b].type || h[b].value !== A[b].value) {
|
|
11515
|
-
|
|
11519
|
+
m = !1;
|
|
11516
11520
|
break;
|
|
11517
11521
|
}
|
|
11518
|
-
if (
|
|
11522
|
+
if (m)
|
|
11519
11523
|
return s;
|
|
11520
11524
|
}
|
|
11521
11525
|
}
|
|
@@ -11527,16 +11531,16 @@ function ys() {
|
|
|
11527
11531
|
* @param recipient The recipient object related to the private key
|
|
11528
11532
|
* @param privKey The (RSA) private key object
|
|
11529
11533
|
*/
|
|
11530
|
-
decrypt: function(
|
|
11531
|
-
if (l.encryptedContent.key === void 0 &&
|
|
11532
|
-
switch (
|
|
11534
|
+
decrypt: function(y, A) {
|
|
11535
|
+
if (l.encryptedContent.key === void 0 && y !== void 0 && A !== void 0)
|
|
11536
|
+
switch (y.encryptedContent.algorithm) {
|
|
11533
11537
|
case t.pki.oids.rsaEncryption:
|
|
11534
11538
|
case t.pki.oids.desCBC:
|
|
11535
|
-
var
|
|
11536
|
-
l.encryptedContent.key = t.util.createBuffer(
|
|
11539
|
+
var v = A.decrypt(y.encryptedContent.content);
|
|
11540
|
+
l.encryptedContent.key = t.util.createBuffer(v);
|
|
11537
11541
|
break;
|
|
11538
11542
|
default:
|
|
11539
|
-
throw new Error("Unsupported asymmetric cipher, OID " +
|
|
11543
|
+
throw new Error("Unsupported asymmetric cipher, OID " + y.encryptedContent.algorithm);
|
|
11540
11544
|
}
|
|
11541
11545
|
E(l);
|
|
11542
11546
|
},
|
|
@@ -11545,17 +11549,17 @@ function ys() {
|
|
|
11545
11549
|
*
|
|
11546
11550
|
* @param cert The certificate of the entity to add.
|
|
11547
11551
|
*/
|
|
11548
|
-
addRecipient: function(
|
|
11552
|
+
addRecipient: function(y) {
|
|
11549
11553
|
l.recipients.push({
|
|
11550
11554
|
version: 0,
|
|
11551
|
-
issuer:
|
|
11552
|
-
serialNumber:
|
|
11555
|
+
issuer: y.issuer.attributes,
|
|
11556
|
+
serialNumber: y.serialNumber,
|
|
11553
11557
|
encryptedContent: {
|
|
11554
11558
|
// We simply assume rsaEncryption here, since forge.pki only
|
|
11555
11559
|
// supports RSA so far. If the PKI module supports other
|
|
11556
11560
|
// ciphers one day, we need to modify this one as well.
|
|
11557
11561
|
algorithm: t.pki.oids.rsaEncryption,
|
|
11558
|
-
key:
|
|
11562
|
+
key: y.publicKey
|
|
11559
11563
|
}
|
|
11560
11564
|
});
|
|
11561
11565
|
},
|
|
@@ -11572,37 +11576,37 @@ function ys() {
|
|
|
11572
11576
|
* @param [key] The key to be used for symmetric encryption.
|
|
11573
11577
|
* @param [cipher] The OID of the symmetric cipher to use.
|
|
11574
11578
|
*/
|
|
11575
|
-
encrypt: function(
|
|
11579
|
+
encrypt: function(y, A) {
|
|
11576
11580
|
if (l.encryptedContent.content === void 0) {
|
|
11577
|
-
A = A || l.encryptedContent.algorithm,
|
|
11578
|
-
var
|
|
11581
|
+
A = A || l.encryptedContent.algorithm, y = y || l.encryptedContent.key;
|
|
11582
|
+
var v, s, h;
|
|
11579
11583
|
switch (A) {
|
|
11580
11584
|
case t.pki.oids["aes128-CBC"]:
|
|
11581
|
-
|
|
11585
|
+
v = 16, s = 16, h = t.aes.createEncryptionCipher;
|
|
11582
11586
|
break;
|
|
11583
11587
|
case t.pki.oids["aes192-CBC"]:
|
|
11584
|
-
|
|
11588
|
+
v = 24, s = 16, h = t.aes.createEncryptionCipher;
|
|
11585
11589
|
break;
|
|
11586
11590
|
case t.pki.oids["aes256-CBC"]:
|
|
11587
|
-
|
|
11591
|
+
v = 32, s = 16, h = t.aes.createEncryptionCipher;
|
|
11588
11592
|
break;
|
|
11589
11593
|
case t.pki.oids["des-EDE3-CBC"]:
|
|
11590
|
-
|
|
11594
|
+
v = 24, s = 8, h = t.des.createEncryptionCipher;
|
|
11591
11595
|
break;
|
|
11592
11596
|
default:
|
|
11593
11597
|
throw new Error("Unsupported symmetric cipher, OID " + A);
|
|
11594
11598
|
}
|
|
11595
|
-
if (
|
|
11596
|
-
|
|
11597
|
-
else if (
|
|
11598
|
-
throw new Error("Symmetric key has wrong length; got " +
|
|
11599
|
-
l.encryptedContent.algorithm = A, l.encryptedContent.key =
|
|
11599
|
+
if (y === void 0)
|
|
11600
|
+
y = t.util.createBuffer(t.random.getBytes(v));
|
|
11601
|
+
else if (y.length() != v)
|
|
11602
|
+
throw new Error("Symmetric key has wrong length; got " + y.length() + " bytes, expected " + v + ".");
|
|
11603
|
+
l.encryptedContent.algorithm = A, l.encryptedContent.key = y, l.encryptedContent.parameter = t.util.createBuffer(
|
|
11600
11604
|
t.random.getBytes(s)
|
|
11601
11605
|
);
|
|
11602
|
-
var
|
|
11603
|
-
if (
|
|
11606
|
+
var m = h(y);
|
|
11607
|
+
if (m.start(l.encryptedContent.parameter.copy()), m.update(l.content), !m.finish())
|
|
11604
11608
|
throw new Error("Symmetric encryption failed.");
|
|
11605
|
-
l.encryptedContent.content =
|
|
11609
|
+
l.encryptedContent.content = m.output;
|
|
11606
11610
|
}
|
|
11607
11611
|
for (var b = 0; b < l.recipients.length; ++b) {
|
|
11608
11612
|
var N = l.recipients[b];
|
|
@@ -11621,19 +11625,19 @@ function ys() {
|
|
|
11621
11625
|
}, l;
|
|
11622
11626
|
};
|
|
11623
11627
|
function p(l) {
|
|
11624
|
-
var
|
|
11625
|
-
if (!e.validate(l, a.asn1.recipientInfoValidator,
|
|
11626
|
-
var
|
|
11627
|
-
throw
|
|
11628
|
+
var y = {}, A = [];
|
|
11629
|
+
if (!e.validate(l, a.asn1.recipientInfoValidator, y, A)) {
|
|
11630
|
+
var v = new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");
|
|
11631
|
+
throw v.errors = A, v;
|
|
11628
11632
|
}
|
|
11629
11633
|
return {
|
|
11630
|
-
version:
|
|
11631
|
-
issuer: t.pki.RDNAttributesAsArray(
|
|
11632
|
-
serialNumber: t.util.createBuffer(
|
|
11634
|
+
version: y.version.charCodeAt(0),
|
|
11635
|
+
issuer: t.pki.RDNAttributesAsArray(y.issuer),
|
|
11636
|
+
serialNumber: t.util.createBuffer(y.serial).toHex(),
|
|
11633
11637
|
encryptedContent: {
|
|
11634
|
-
algorithm: e.derToOid(
|
|
11635
|
-
parameter:
|
|
11636
|
-
content:
|
|
11638
|
+
algorithm: e.derToOid(y.encAlgorithm),
|
|
11639
|
+
parameter: y.encParameter ? y.encParameter.value : void 0,
|
|
11640
|
+
content: y.encKey
|
|
11637
11641
|
}
|
|
11638
11642
|
};
|
|
11639
11643
|
}
|
|
@@ -11680,17 +11684,17 @@ function ys() {
|
|
|
11680
11684
|
]);
|
|
11681
11685
|
}
|
|
11682
11686
|
function C(l) {
|
|
11683
|
-
for (var
|
|
11684
|
-
|
|
11685
|
-
return
|
|
11687
|
+
for (var y = [], A = 0; A < l.length; ++A)
|
|
11688
|
+
y.push(p(l[A]));
|
|
11689
|
+
return y;
|
|
11686
11690
|
}
|
|
11687
11691
|
function c(l) {
|
|
11688
|
-
for (var
|
|
11689
|
-
|
|
11690
|
-
return
|
|
11692
|
+
for (var y = [], A = 0; A < l.length; ++A)
|
|
11693
|
+
y.push(S(l[A]));
|
|
11694
|
+
return y;
|
|
11691
11695
|
}
|
|
11692
11696
|
function r(l) {
|
|
11693
|
-
var
|
|
11697
|
+
var y = e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
11694
11698
|
// version
|
|
11695
11699
|
e.create(
|
|
11696
11700
|
e.Class.UNIVERSAL,
|
|
@@ -11723,7 +11727,7 @@ function ys() {
|
|
|
11723
11727
|
e.create(e.Class.UNIVERSAL, e.Type.NULL, !1, "")
|
|
11724
11728
|
])
|
|
11725
11729
|
]);
|
|
11726
|
-
if (l.authenticatedAttributesAsn1 &&
|
|
11730
|
+
if (l.authenticatedAttributesAsn1 && y.value.push(l.authenticatedAttributesAsn1), y.value.push(e.create(e.Class.UNIVERSAL, e.Type.SEQUENCE, !0, [
|
|
11727
11731
|
// algorithm
|
|
11728
11732
|
e.create(
|
|
11729
11733
|
e.Class.UNIVERSAL,
|
|
@@ -11733,53 +11737,53 @@ function ys() {
|
|
|
11733
11737
|
),
|
|
11734
11738
|
// parameters (null)
|
|
11735
11739
|
e.create(e.Class.UNIVERSAL, e.Type.NULL, !1, "")
|
|
11736
|
-
])),
|
|
11740
|
+
])), y.value.push(e.create(
|
|
11737
11741
|
e.Class.UNIVERSAL,
|
|
11738
11742
|
e.Type.OCTETSTRING,
|
|
11739
11743
|
!1,
|
|
11740
11744
|
l.signature
|
|
11741
11745
|
)), l.unauthenticatedAttributes.length > 0) {
|
|
11742
|
-
for (var A = e.create(e.Class.CONTEXT_SPECIFIC, 1, !0, []),
|
|
11743
|
-
var s = l.unauthenticatedAttributes[
|
|
11746
|
+
for (var A = e.create(e.Class.CONTEXT_SPECIFIC, 1, !0, []), v = 0; v < l.unauthenticatedAttributes.length; ++v) {
|
|
11747
|
+
var s = l.unauthenticatedAttributes[v];
|
|
11744
11748
|
A.values.push(u(s));
|
|
11745
11749
|
}
|
|
11746
|
-
|
|
11750
|
+
y.value.push(A);
|
|
11747
11751
|
}
|
|
11748
|
-
return
|
|
11752
|
+
return y;
|
|
11749
11753
|
}
|
|
11750
11754
|
function g(l) {
|
|
11751
|
-
for (var
|
|
11752
|
-
|
|
11753
|
-
return
|
|
11755
|
+
for (var y = [], A = 0; A < l.length; ++A)
|
|
11756
|
+
y.push(r(l[A]));
|
|
11757
|
+
return y;
|
|
11754
11758
|
}
|
|
11755
11759
|
function u(l) {
|
|
11756
|
-
var
|
|
11760
|
+
var y;
|
|
11757
11761
|
if (l.type === t.pki.oids.contentType)
|
|
11758
|
-
|
|
11762
|
+
y = e.create(
|
|
11759
11763
|
e.Class.UNIVERSAL,
|
|
11760
11764
|
e.Type.OID,
|
|
11761
11765
|
!1,
|
|
11762
11766
|
e.oidToDer(l.value).getBytes()
|
|
11763
11767
|
);
|
|
11764
11768
|
else if (l.type === t.pki.oids.messageDigest)
|
|
11765
|
-
|
|
11769
|
+
y = e.create(
|
|
11766
11770
|
e.Class.UNIVERSAL,
|
|
11767
11771
|
e.Type.OCTETSTRING,
|
|
11768
11772
|
!1,
|
|
11769
11773
|
l.value.bytes()
|
|
11770
11774
|
);
|
|
11771
11775
|
else if (l.type === t.pki.oids.signingTime) {
|
|
11772
|
-
var A = /* @__PURE__ */ new Date("1950-01-01T00:00:00Z"),
|
|
11776
|
+
var A = /* @__PURE__ */ new Date("1950-01-01T00:00:00Z"), v = /* @__PURE__ */ new Date("2050-01-01T00:00:00Z"), s = l.value;
|
|
11773
11777
|
if (typeof s == "string") {
|
|
11774
11778
|
var h = Date.parse(s);
|
|
11775
11779
|
isNaN(h) ? s.length === 13 ? s = e.utcTimeToDate(s) : s = e.generalizedTimeToDate(s) : s = new Date(h);
|
|
11776
11780
|
}
|
|
11777
|
-
s >= A && s <
|
|
11781
|
+
s >= A && s < v ? y = e.create(
|
|
11778
11782
|
e.Class.UNIVERSAL,
|
|
11779
11783
|
e.Type.UTCTIME,
|
|
11780
11784
|
!1,
|
|
11781
11785
|
e.dateToUtcTime(s)
|
|
11782
|
-
) :
|
|
11786
|
+
) : y = e.create(
|
|
11783
11787
|
e.Class.UNIVERSAL,
|
|
11784
11788
|
e.Type.GENERALIZEDTIME,
|
|
11785
11789
|
!1,
|
|
@@ -11796,7 +11800,7 @@ function ys() {
|
|
|
11796
11800
|
),
|
|
11797
11801
|
e.create(e.Class.UNIVERSAL, e.Type.SET, !0, [
|
|
11798
11802
|
// AttributeValue
|
|
11799
|
-
|
|
11803
|
+
y
|
|
11800
11804
|
])
|
|
11801
11805
|
]);
|
|
11802
11806
|
}
|
|
@@ -11837,66 +11841,66 @@ function ys() {
|
|
|
11837
11841
|
])
|
|
11838
11842
|
];
|
|
11839
11843
|
}
|
|
11840
|
-
function D(l,
|
|
11841
|
-
var
|
|
11842
|
-
if (!e.validate(
|
|
11844
|
+
function D(l, y, A) {
|
|
11845
|
+
var v = {}, s = [];
|
|
11846
|
+
if (!e.validate(y, A, v, s)) {
|
|
11843
11847
|
var h = new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");
|
|
11844
11848
|
throw h.errors = h, h;
|
|
11845
11849
|
}
|
|
11846
|
-
var
|
|
11847
|
-
if (
|
|
11850
|
+
var m = e.derToOid(v.contentType);
|
|
11851
|
+
if (m !== t.pki.oids.data)
|
|
11848
11852
|
throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");
|
|
11849
|
-
if (
|
|
11853
|
+
if (v.encryptedContent) {
|
|
11850
11854
|
var b = "";
|
|
11851
|
-
if (t.util.isArray(
|
|
11852
|
-
for (var N = 0; N <
|
|
11853
|
-
if (
|
|
11855
|
+
if (t.util.isArray(v.encryptedContent))
|
|
11856
|
+
for (var N = 0; N < v.encryptedContent.length; ++N) {
|
|
11857
|
+
if (v.encryptedContent[N].type !== e.Type.OCTETSTRING)
|
|
11854
11858
|
throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");
|
|
11855
|
-
b +=
|
|
11859
|
+
b += v.encryptedContent[N].value;
|
|
11856
11860
|
}
|
|
11857
11861
|
else
|
|
11858
|
-
b =
|
|
11862
|
+
b = v.encryptedContent;
|
|
11859
11863
|
l.encryptedContent = {
|
|
11860
|
-
algorithm: e.derToOid(
|
|
11861
|
-
parameter: t.util.createBuffer(
|
|
11864
|
+
algorithm: e.derToOid(v.encAlgorithm),
|
|
11865
|
+
parameter: t.util.createBuffer(v.encParameter.value),
|
|
11862
11866
|
content: t.util.createBuffer(b)
|
|
11863
11867
|
};
|
|
11864
11868
|
}
|
|
11865
|
-
if (
|
|
11869
|
+
if (v.content) {
|
|
11866
11870
|
var b = "";
|
|
11867
|
-
if (t.util.isArray(
|
|
11868
|
-
for (var N = 0; N <
|
|
11869
|
-
if (
|
|
11871
|
+
if (t.util.isArray(v.content))
|
|
11872
|
+
for (var N = 0; N < v.content.length; ++N) {
|
|
11873
|
+
if (v.content[N].type !== e.Type.OCTETSTRING)
|
|
11870
11874
|
throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");
|
|
11871
|
-
b +=
|
|
11875
|
+
b += v.content[N].value;
|
|
11872
11876
|
}
|
|
11873
11877
|
else
|
|
11874
|
-
b =
|
|
11878
|
+
b = v.content;
|
|
11875
11879
|
l.content = t.util.createBuffer(b);
|
|
11876
11880
|
}
|
|
11877
|
-
return l.version =
|
|
11881
|
+
return l.version = v.version.charCodeAt(0), l.rawCapture = v, v;
|
|
11878
11882
|
}
|
|
11879
11883
|
function E(l) {
|
|
11880
11884
|
if (l.encryptedContent.key === void 0)
|
|
11881
11885
|
throw new Error("Symmetric key not available.");
|
|
11882
11886
|
if (l.content === void 0) {
|
|
11883
|
-
var
|
|
11887
|
+
var y;
|
|
11884
11888
|
switch (l.encryptedContent.algorithm) {
|
|
11885
11889
|
case t.pki.oids["aes128-CBC"]:
|
|
11886
11890
|
case t.pki.oids["aes192-CBC"]:
|
|
11887
11891
|
case t.pki.oids["aes256-CBC"]:
|
|
11888
|
-
|
|
11892
|
+
y = t.aes.createDecryptionCipher(l.encryptedContent.key);
|
|
11889
11893
|
break;
|
|
11890
11894
|
case t.pki.oids.desCBC:
|
|
11891
11895
|
case t.pki.oids["des-EDE3-CBC"]:
|
|
11892
|
-
|
|
11896
|
+
y = t.des.createDecryptionCipher(l.encryptedContent.key);
|
|
11893
11897
|
break;
|
|
11894
11898
|
default:
|
|
11895
11899
|
throw new Error("Unsupported symmetric cipher, OID " + l.encryptedContent.algorithm);
|
|
11896
11900
|
}
|
|
11897
|
-
if (
|
|
11901
|
+
if (y.start(l.encryptedContent.parameter), y.update(l.encryptedContent.content), !y.finish())
|
|
11898
11902
|
throw new Error("Symmetric decryption failed.");
|
|
11899
|
-
l.content =
|
|
11903
|
+
l.content = y.output;
|
|
11900
11904
|
}
|
|
11901
11905
|
}
|
|
11902
11906
|
return Kr.exports;
|
|
@@ -11920,28 +11924,28 @@ function vs() {
|
|
|
11920
11924
|
var E = t.util.encode64(D.bytes(), 64), l = Math.floor(E.length / 66) + 1;
|
|
11921
11925
|
I += "Public-Lines: " + l + `\r
|
|
11922
11926
|
`, I += E;
|
|
11923
|
-
var
|
|
11924
|
-
a(
|
|
11927
|
+
var y = t.util.createBuffer();
|
|
11928
|
+
a(y, C.d), a(y, C.p), a(y, C.q), a(y, C.qInv);
|
|
11925
11929
|
var A;
|
|
11926
11930
|
if (!c)
|
|
11927
|
-
A = t.util.encode64(
|
|
11931
|
+
A = t.util.encode64(y.bytes(), 64);
|
|
11928
11932
|
else {
|
|
11929
|
-
var
|
|
11930
|
-
|
|
11931
|
-
var s = S(
|
|
11932
|
-
s.truncate(s.length() -
|
|
11933
|
+
var v = y.length() + 16 - 1;
|
|
11934
|
+
v -= v % 16;
|
|
11935
|
+
var s = S(y.bytes());
|
|
11936
|
+
s.truncate(s.length() - v + y.length()), y.putBuffer(s);
|
|
11933
11937
|
var h = t.util.createBuffer();
|
|
11934
11938
|
h.putBuffer(S("\0\0\0\0", c)), h.putBuffer(S("\0\0\0", c));
|
|
11935
|
-
var
|
|
11936
|
-
|
|
11937
|
-
var b =
|
|
11939
|
+
var m = t.aes.createEncryptionCipher(h.truncate(8), "CBC");
|
|
11940
|
+
m.start(t.util.createBuffer().fillWithByte(0, 16)), m.update(y.copy()), m.finish();
|
|
11941
|
+
var b = m.output;
|
|
11938
11942
|
b.truncate(16), A = t.util.encode64(b.bytes(), 64);
|
|
11939
11943
|
}
|
|
11940
11944
|
l = Math.floor(A.length / 66) + 1, I += `\r
|
|
11941
11945
|
Private-Lines: ` + l + `\r
|
|
11942
11946
|
`, I += A;
|
|
11943
11947
|
var N = S("putty-private-key-file-mac-key", c), d = t.util.createBuffer();
|
|
11944
|
-
p(d, g), p(d, u), p(d, r), d.putInt32(D.length()), d.putBuffer(D), d.putInt32(
|
|
11948
|
+
p(d, g), p(d, u), p(d, r), d.putInt32(D.length()), d.putBuffer(D), d.putInt32(y.length()), d.putBuffer(y);
|
|
11945
11949
|
var i = t.hmac.create();
|
|
11946
11950
|
return i.start("sha1", N), i.update(d.bytes()), I += `\r
|
|
11947
11951
|
Private-MAC: ` + i.digest().toHex() + `\r
|
|
@@ -12054,14 +12058,14 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12054
12058
|
emits: /* @__PURE__ */ At(["send", "cancel", "clear", "change-record", "change-collapse", "change-theme", "change-aside-width", "click-logo", "bubble-event", "close-workspace", "scroll-bottom"], ["update:messages", "update:modelValue", "update:loading", "update:record-id"]),
|
|
12055
12059
|
setup(t, { expose: e, emit: a }) {
|
|
12056
12060
|
Fa((F) => ({
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12061
|
+
e2ee7b30: F.primaryColor,
|
|
12062
|
+
v67c64912: r.value,
|
|
12063
|
+
fe7d23ee: C.value[0],
|
|
12064
|
+
fe7d23b0: C.value[1],
|
|
12065
|
+
fe7d2372: C.value[2],
|
|
12066
|
+
fe7d2334: C.value[3],
|
|
12067
|
+
fe7d22f6: C.value[4],
|
|
12068
|
+
v431e17ba: j.value
|
|
12065
12069
|
}));
|
|
12066
12070
|
const p = t, S = parseFloat(getComputedStyle(document.documentElement).fontSize), C = _e(() => as(p.primaryColor, 5, 0.8, 4));
|
|
12067
12071
|
function c(F) {
|
|
@@ -12069,14 +12073,14 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12069
12073
|
const X = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(F);
|
|
12070
12074
|
return X ? `${parseInt(X[1] ?? "0", 16)}, ${parseInt(X[2] ?? "0", 16)}, ${parseInt(X[3] ?? "0", 16)}` : "0, 0, 0";
|
|
12071
12075
|
}
|
|
12072
|
-
const r = _e(() => c(p.primaryColor)), g = _e(() => p.records || []), u = gt(t, "messages"), I = gt(t, "modelValue"), D = gt(t, "loading"), E = pt(null), l = gt(t, "record-id"),
|
|
12076
|
+
const r = _e(() => c(p.primaryColor)), g = _e(() => p.records || []), u = gt(t, "messages"), I = gt(t, "modelValue"), D = gt(t, "loading"), E = pt(null), l = gt(t, "record-id"), y = Lt(p.uuid + "__kl-ai-chat_enable-chat", p.enableNet), A = Lt(p.uuid + "__kl-ai-chat_enable-think", p.enableThink), v = a, s = (F) => {
|
|
12073
12077
|
const X = !E.value;
|
|
12074
|
-
D.value = !0,
|
|
12078
|
+
D.value = !0, v("send", F, A.value, y.value, X);
|
|
12075
12079
|
}, h = () => {
|
|
12076
|
-
D.value = !1,
|
|
12080
|
+
D.value = !1, v("cancel");
|
|
12077
12081
|
};
|
|
12078
|
-
function
|
|
12079
|
-
E.value = F, l.value = F?.id,
|
|
12082
|
+
function m(F) {
|
|
12083
|
+
E.value = F, l.value = F?.id, Z.value && _(!1), v("change-record", F);
|
|
12080
12084
|
}
|
|
12081
12085
|
bt(
|
|
12082
12086
|
() => l.value,
|
|
@@ -12119,7 +12123,7 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12119
12123
|
bt(
|
|
12120
12124
|
() => O.value,
|
|
12121
12125
|
(F) => {
|
|
12122
|
-
|
|
12126
|
+
v("change-aside-width", F);
|
|
12123
12127
|
}
|
|
12124
12128
|
);
|
|
12125
12129
|
const z = (F) => {
|
|
@@ -12135,68 +12139,73 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12135
12139
|
};
|
|
12136
12140
|
function re() {
|
|
12137
12141
|
const F = window.innerWidth;
|
|
12138
|
-
|
|
12142
|
+
Z.value = F <= 768, Z.value && (de.value = !1, se.value = !0);
|
|
12139
12143
|
}
|
|
12140
12144
|
jr(() => {
|
|
12141
|
-
p.defaultRecordId &&
|
|
12145
|
+
p.defaultRecordId && m(
|
|
12142
12146
|
g.value.find((F) => F.id === p.defaultRecordId)
|
|
12143
12147
|
), re(), document.addEventListener("mousemove", J), document.addEventListener("mouseup", $), window.addEventListener("resize", re);
|
|
12144
12148
|
}), za(() => {
|
|
12145
12149
|
document.removeEventListener("mousemove", J), document.removeEventListener("mouseup", $), window.removeEventListener("resize", re), i && (clearTimeout(i), i = null);
|
|
12146
12150
|
});
|
|
12147
|
-
const
|
|
12151
|
+
const Z = pt(typeof window < "u" ? window.innerWidth <= 768 : !1), se = Lt(p.uuid + "__kl-ai-chat_collapse", p.defaultCollapse), de = Lt(p.uuid + "__kl-ai-chat_show-aside", !0);
|
|
12152
|
+
Z.value && (se.value = !0, de.value = !1);
|
|
12153
|
+
const me = pt(!1);
|
|
12148
12154
|
function _(F) {
|
|
12149
12155
|
if (F === se.value) return;
|
|
12150
|
-
me.value = !0, se.value = F, de.value = !F,
|
|
12156
|
+
me.value = !0, se.value = F, de.value = !F, v("change-collapse", F);
|
|
12151
12157
|
const X = setTimeout(() => {
|
|
12152
12158
|
me.value = !1, clearTimeout(X);
|
|
12153
12159
|
}, 200);
|
|
12154
12160
|
}
|
|
12155
12161
|
function ue(F) {
|
|
12156
|
-
|
|
12162
|
+
v("change-theme", F);
|
|
12157
12163
|
}
|
|
12158
12164
|
function te(F, X) {
|
|
12159
|
-
|
|
12165
|
+
v("bubble-event", F, X);
|
|
12160
12166
|
}
|
|
12161
12167
|
function ze() {
|
|
12162
|
-
|
|
12168
|
+
v("close-workspace");
|
|
12163
12169
|
}
|
|
12164
12170
|
function fe(F) {
|
|
12165
12171
|
I.value = F;
|
|
12166
12172
|
}
|
|
12167
12173
|
function f() {
|
|
12168
|
-
E.value = null, l.value = void 0, u.value = [],
|
|
12174
|
+
E.value = null, l.value = void 0, u.value = [], Z.value && _(!1), v("clear");
|
|
12169
12175
|
}
|
|
12170
12176
|
function w() {
|
|
12171
|
-
|
|
12177
|
+
Z.value && !se.value && _(!0);
|
|
12172
12178
|
}
|
|
12173
12179
|
const U = _e(() => ({
|
|
12174
12180
|
"kernelift-chat-container__aside--transition": !M.value,
|
|
12175
|
-
"mobile-aside":
|
|
12181
|
+
"mobile-aside": Z.value
|
|
12176
12182
|
})), o = _e(() => {
|
|
12177
12183
|
const F = {
|
|
12178
|
-
width:
|
|
12184
|
+
width: Z.value ? "100%" : se.value ? "0px" : `${O.value}px`,
|
|
12179
12185
|
zIndex: se.value && !me.value ? -1 : 99,
|
|
12180
12186
|
opacity: se.value ? 0 : 1,
|
|
12181
|
-
transform: se.value && !
|
|
12187
|
+
transform: se.value && !Z.value ? "translateX(-100%)" : "translateX(0%)"
|
|
12182
12188
|
};
|
|
12183
|
-
return
|
|
12189
|
+
return Z.value ? F.backgroundColor = se.value ? "transparent" : "#1b1b1b56" : F.backgroundColor = "var(--kl-background-color, #fff)", F;
|
|
12184
12190
|
}), T = _e(() => {
|
|
12185
12191
|
const F = {
|
|
12186
|
-
width:
|
|
12187
|
-
transform: se.value &&
|
|
12192
|
+
width: Z.value ? "80%" : "100%",
|
|
12193
|
+
transform: se.value && Z.value ? "translateX(-100%)" : "translateX(0%)",
|
|
12188
12194
|
backgroundColor: "var(--kl-background-color, #fff)"
|
|
12189
12195
|
};
|
|
12190
|
-
return
|
|
12196
|
+
return Z.value && (F.transition = "all 0.2s ease"), F;
|
|
12191
12197
|
}), j = _e(() => `calc(100% - ${(p.showSender ? p.inputHeight + 52 : 0) / S}rem - ${(p.showSender && p.hasSenderTools ? 40 : 0) / S}rem - 2rem)`), K = _e(() => ((p.showSender ? p.inputHeight + 52 : 0) + (p.showSender && p.hasSenderTools ? 40 : 0)) / S + "rem"), q = _e(() => (p.markdownClassName || "") + (p.themeMode === "dark" ? " dark" : ""));
|
|
12192
12198
|
return e({
|
|
12199
|
+
isMobile: Z,
|
|
12200
|
+
collapse: se,
|
|
12201
|
+
asideWidth: O,
|
|
12193
12202
|
scrollToBottom: P
|
|
12194
12203
|
}), (F, X) => (he(), ye("div", {
|
|
12195
12204
|
class: $e(["kernelift-chat-container", {
|
|
12196
12205
|
dark: t.themeMode === "dark"
|
|
12197
12206
|
}])
|
|
12198
12207
|
}, [
|
|
12199
|
-
ce(F.$slots, "left-aside", { mobile:
|
|
12208
|
+
ce(F.$slots, "left-aside", { mobile: Z.value }, void 0, !0),
|
|
12200
12209
|
ie("div", Cs, [
|
|
12201
12210
|
ie("aside", {
|
|
12202
12211
|
class: $e(["kernelift-chat-container__aside", U.value]),
|
|
@@ -12205,7 +12214,7 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12205
12214
|
}, [
|
|
12206
12215
|
ce(F.$slots, "aside", {
|
|
12207
12216
|
record: E.value,
|
|
12208
|
-
mobile:
|
|
12217
|
+
mobile: Z.value
|
|
12209
12218
|
}, () => [
|
|
12210
12219
|
Tt(Gi, {
|
|
12211
12220
|
modelValue: E.value,
|
|
@@ -12218,35 +12227,35 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12218
12227
|
i18n: t.i18n,
|
|
12219
12228
|
"has-theme-mode": t.hasThemeMode,
|
|
12220
12229
|
onClear: f,
|
|
12221
|
-
onChange:
|
|
12222
|
-
onClickLogo: X[1] || (X[1] = (x) =>
|
|
12223
|
-
onScrollBottom: X[2] || (X[2] = (x) =>
|
|
12230
|
+
onChange: m,
|
|
12231
|
+
onClickLogo: X[1] || (X[1] = (x) => v("click-logo")),
|
|
12232
|
+
onScrollBottom: X[2] || (X[2] = (x) => v("scroll-bottom")),
|
|
12224
12233
|
onChangeCollapse: _,
|
|
12225
12234
|
onChangeTheme: ue
|
|
12226
12235
|
}, {
|
|
12227
12236
|
logo: Ye(() => [
|
|
12228
|
-
ce(F.$slots, "logo", { mobile:
|
|
12237
|
+
ce(F.$slots, "logo", { mobile: Z.value }, void 0, !0)
|
|
12229
12238
|
]),
|
|
12230
12239
|
footer: Ye(() => [
|
|
12231
12240
|
ce(F.$slots, "record-footer", {
|
|
12232
12241
|
record: E.value,
|
|
12233
|
-
mobile:
|
|
12242
|
+
mobile: Z.value
|
|
12234
12243
|
}, void 0, !0)
|
|
12235
12244
|
]),
|
|
12236
12245
|
"new-chat-button": Ye(({ execute: x }) => [
|
|
12237
12246
|
ce(F.$slots, "new-chat-button", {
|
|
12238
|
-
mobile:
|
|
12247
|
+
mobile: Z.value,
|
|
12239
12248
|
execute: x
|
|
12240
12249
|
}, void 0, !0)
|
|
12241
12250
|
]),
|
|
12242
12251
|
"record-dropdown": Ye(() => [
|
|
12243
|
-
ce(F.$slots, "record-dropdown", { mobile:
|
|
12252
|
+
ce(F.$slots, "record-dropdown", { mobile: Z.value }, void 0, !0)
|
|
12244
12253
|
]),
|
|
12245
12254
|
_: 3
|
|
12246
12255
|
}, 8, ["modelValue", "style", "data", "theme-mode", "collapse", "actions", "i18n", "has-theme-mode"])
|
|
12247
12256
|
], !0)
|
|
12248
12257
|
], 6),
|
|
12249
|
-
!st(se) && !
|
|
12258
|
+
!st(se) && !Z.value ? (he(), ye("div", {
|
|
12250
12259
|
key: 0,
|
|
12251
12260
|
class: "kernelift-chat-container__resize-handle",
|
|
12252
12261
|
onMousedown: z
|
|
@@ -12258,25 +12267,25 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12258
12267
|
}, [
|
|
12259
12268
|
ie("div", {
|
|
12260
12269
|
class: $e(["kernelift-chat-container__chat-area", {
|
|
12261
|
-
"kernelift-chat-container__chat-area--full": !t.showWorkspace,
|
|
12262
|
-
"kernelift-chat-container__chat-area--half": t.showWorkspace
|
|
12270
|
+
"kernelift-chat-container__chat-area--full": !t.showWorkspace || Z.value,
|
|
12271
|
+
"kernelift-chat-container__chat-area--half": t.showWorkspace && !Z.value
|
|
12263
12272
|
}])
|
|
12264
12273
|
}, [
|
|
12265
12274
|
t.hasHeader ? (he(), ye("header", Es, [
|
|
12266
12275
|
ce(F.$slots, "header", {
|
|
12267
12276
|
record: E.value,
|
|
12268
|
-
mobile:
|
|
12277
|
+
mobile: Z.value
|
|
12269
12278
|
}, () => [
|
|
12270
12279
|
at(Tt(ts, { record: E.value }, null, 8, ["record"]), [
|
|
12271
|
-
[ot, !
|
|
12280
|
+
[ot, !Z.value]
|
|
12272
12281
|
])
|
|
12273
12282
|
], !0),
|
|
12274
12283
|
st(se) ? (he(), ye("div", Is, [
|
|
12275
12284
|
ie("div", {
|
|
12276
12285
|
class: "kernelift-chat-container__logo",
|
|
12277
|
-
onClick: X[3] || (X[3] = (x) =>
|
|
12286
|
+
onClick: X[3] || (X[3] = (x) => v("click-logo"))
|
|
12278
12287
|
}, [
|
|
12279
|
-
ce(F.$slots, "header-logo", { mobile:
|
|
12288
|
+
ce(F.$slots, "header-logo", { mobile: Z.value }, () => [
|
|
12280
12289
|
X[10] || (X[10] = ie("img", {
|
|
12281
12290
|
src: Xa,
|
|
12282
12291
|
class: "kernelift-chat-container__logo-img"
|
|
@@ -12330,37 +12339,37 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12330
12339
|
header: Ye(() => [
|
|
12331
12340
|
ce(F.$slots, "bubble-header", {
|
|
12332
12341
|
data: x,
|
|
12333
|
-
mobile:
|
|
12342
|
+
mobile: Z.value
|
|
12334
12343
|
}, void 0, !0)
|
|
12335
12344
|
]),
|
|
12336
12345
|
footer: Ye(() => [
|
|
12337
12346
|
ce(F.$slots, "bubble-footer", {
|
|
12338
12347
|
data: x,
|
|
12339
|
-
mobile:
|
|
12348
|
+
mobile: Z.value
|
|
12340
12349
|
}, void 0, !0)
|
|
12341
12350
|
]),
|
|
12342
12351
|
"bubble-event": Ye(() => [
|
|
12343
12352
|
ce(F.$slots, "bubble-event", {
|
|
12344
12353
|
data: x,
|
|
12345
|
-
mobile:
|
|
12354
|
+
mobile: Z.value
|
|
12346
12355
|
}, void 0, !0)
|
|
12347
12356
|
]),
|
|
12348
12357
|
"content-header": Ye(() => [
|
|
12349
12358
|
ce(F.$slots, "bubble-content-header", {
|
|
12350
12359
|
data: x,
|
|
12351
|
-
mobile:
|
|
12360
|
+
mobile: Z.value
|
|
12352
12361
|
}, void 0, !0)
|
|
12353
12362
|
]),
|
|
12354
12363
|
"content-footer": Ye(() => [
|
|
12355
12364
|
ce(F.$slots, "bubble-content-footer", {
|
|
12356
12365
|
data: x,
|
|
12357
|
-
mobile:
|
|
12366
|
+
mobile: Z.value
|
|
12358
12367
|
}, void 0, !0)
|
|
12359
12368
|
]),
|
|
12360
12369
|
"thinking-header": Ye(() => [
|
|
12361
12370
|
ce(F.$slots, "bubble-thinking-header", {
|
|
12362
12371
|
data: x,
|
|
12363
|
-
mobile:
|
|
12372
|
+
mobile: Z.value
|
|
12364
12373
|
}, void 0, !0)
|
|
12365
12374
|
]),
|
|
12366
12375
|
_: 2
|
|
@@ -12378,7 +12387,7 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12378
12387
|
"markdown-class": q.value
|
|
12379
12388
|
}, {
|
|
12380
12389
|
content: Ye(() => [
|
|
12381
|
-
ce(F.$slots, "bubble-loading-content", { mobile:
|
|
12390
|
+
ce(F.$slots, "bubble-loading-content", { mobile: Z.value }, () => [
|
|
12382
12391
|
ie("div", {
|
|
12383
12392
|
class: $e(["kernelift-chat-container__loading-text", q.value])
|
|
12384
12393
|
}, [
|
|
@@ -12391,11 +12400,11 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12391
12400
|
}, 8, ["model-value", "i18n", "theme-mode", "markdown-class"])) : Ze("", !0)
|
|
12392
12401
|
])
|
|
12393
12402
|
], 544)) : (he(), ye("div", Us, [
|
|
12394
|
-
ce(F.$slots, "empty", { mobile:
|
|
12403
|
+
ce(F.$slots, "empty", { mobile: Z.value }, () => [
|
|
12395
12404
|
ie("div", Ns, et(t.i18n?.chat?.empty ?? "请开始你的对话"), 1)
|
|
12396
12405
|
], !0)
|
|
12397
12406
|
])),
|
|
12398
|
-
b.value?.length && !
|
|
12407
|
+
b.value?.length && !Z.value && !I.value ? (he(), ye("div", ws, [
|
|
12399
12408
|
(he(!0), ye(Mr, null, Qr(b.value, (x) => (he(), ye("div", {
|
|
12400
12409
|
key: x,
|
|
12401
12410
|
class: "kernelift-chat-container__next-tip",
|
|
@@ -12412,14 +12421,14 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12412
12421
|
}, [
|
|
12413
12422
|
ie("div", Os, [
|
|
12414
12423
|
t.hasSenderTools && t.showSender ? (he(), ye("div", Ps, [
|
|
12415
|
-
ce(F.$slots, "sender-tools", { mobile:
|
|
12424
|
+
ce(F.$slots, "sender-tools", { mobile: Z.value }, void 0, !0)
|
|
12416
12425
|
])) : Ze("", !0),
|
|
12417
12426
|
t.showSender ? (he(), $t(_i, {
|
|
12418
12427
|
key: 1,
|
|
12419
12428
|
modelValue: I.value,
|
|
12420
12429
|
"onUpdate:modelValue": X[6] || (X[6] = (x) => I.value = x),
|
|
12421
|
-
"enable-net": st(
|
|
12422
|
-
"onUpdate:enableNet": X[7] || (X[7] = (x) => Xr(
|
|
12430
|
+
"enable-net": st(y),
|
|
12431
|
+
"onUpdate:enableNet": X[7] || (X[7] = (x) => Xr(y) ? y.value = x : null),
|
|
12423
12432
|
"enable-think": st(A),
|
|
12424
12433
|
"onUpdate:enableThink": X[8] || (X[8] = (x) => Xr(A) ? A.value = x : null),
|
|
12425
12434
|
"has-net-search": t.hasNetSearch,
|
|
@@ -12434,30 +12443,30 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12434
12443
|
ce(F.$slots, "sender-footer-tools", {
|
|
12435
12444
|
value: x,
|
|
12436
12445
|
loading: ee,
|
|
12437
|
-
enableNet: st(
|
|
12446
|
+
enableNet: st(y),
|
|
12438
12447
|
enableThink: st(A),
|
|
12439
|
-
mobile:
|
|
12448
|
+
mobile: Z.value
|
|
12440
12449
|
}, void 0, !0)
|
|
12441
12450
|
]),
|
|
12442
12451
|
"send-button": Ye(({ execute: x, state: ee }) => [
|
|
12443
12452
|
ce(F.$slots, "send-button", {
|
|
12444
12453
|
execute: x,
|
|
12445
12454
|
state: ee,
|
|
12446
|
-
mobile:
|
|
12455
|
+
mobile: Z.value
|
|
12447
12456
|
}, void 0, !0)
|
|
12448
12457
|
]),
|
|
12449
12458
|
"think-button": Ye(({ execute: x, state: ee }) => [
|
|
12450
12459
|
ce(F.$slots, "think-button", {
|
|
12451
12460
|
state: ee,
|
|
12452
12461
|
execute: x,
|
|
12453
|
-
mobile:
|
|
12462
|
+
mobile: Z.value
|
|
12454
12463
|
}, void 0, !0)
|
|
12455
12464
|
]),
|
|
12456
12465
|
"net-button": Ye(({ execute: x, state: ee }) => [
|
|
12457
12466
|
ce(F.$slots, "net-button", {
|
|
12458
12467
|
state: ee,
|
|
12459
12468
|
execute: x,
|
|
12460
|
-
mobile:
|
|
12469
|
+
mobile: Z.value
|
|
12461
12470
|
}, void 0, !0)
|
|
12462
12471
|
]),
|
|
12463
12472
|
textarea: Ye(({ execute: x, state: ee, height: oe }) => [
|
|
@@ -12465,13 +12474,13 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12465
12474
|
execute: x,
|
|
12466
12475
|
state: ee,
|
|
12467
12476
|
height: oe,
|
|
12468
|
-
mobile:
|
|
12477
|
+
mobile: Z.value
|
|
12469
12478
|
}, void 0, !0)
|
|
12470
12479
|
]),
|
|
12471
12480
|
_: 3
|
|
12472
12481
|
}, 8, ["modelValue", "enable-net", "enable-think", "has-net-search", "has-thinking", "input-height", "loading", "i18n"])) : Ze("", !0),
|
|
12473
12482
|
ie("div", Ls, [
|
|
12474
|
-
ce(F.$slots, "footer", { mobile:
|
|
12483
|
+
ce(F.$slots, "footer", { mobile: Z.value }, () => [
|
|
12475
12484
|
Mt(et(t.i18n?.chat?.note ?? "内容由AI生成,无法确保准确性和完整性,仅供参考"), 1)
|
|
12476
12485
|
], !0)
|
|
12477
12486
|
])
|
|
@@ -12481,7 +12490,7 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12481
12490
|
t.showWorkspace ? (he(), ye("div", {
|
|
12482
12491
|
key: 0,
|
|
12483
12492
|
class: $e(["kernelift-chat-container__workspace", {
|
|
12484
|
-
"mobile-workspace":
|
|
12493
|
+
"mobile-workspace": Z.value
|
|
12485
12494
|
}])
|
|
12486
12495
|
}, [
|
|
12487
12496
|
ie("div", Ks, [
|
|
@@ -12492,22 +12501,23 @@ const As = { button: { think: "深度思考", net: "联网搜索", copy: "复制
|
|
|
12492
12501
|
]),
|
|
12493
12502
|
ce(F.$slots, "workspace", {
|
|
12494
12503
|
record: E.value,
|
|
12495
|
-
mobile:
|
|
12504
|
+
mobile: Z.value
|
|
12496
12505
|
}, void 0, !0)
|
|
12497
12506
|
], 2)) : Ze("", !0)
|
|
12498
12507
|
], 2)
|
|
12499
12508
|
])
|
|
12500
12509
|
], 2));
|
|
12501
12510
|
}
|
|
12502
|
-
}), Hs = /* @__PURE__ */ kt(Vs, [["__scopeId", "data-v-
|
|
12511
|
+
}), Hs = /* @__PURE__ */ kt(Vs, [["__scopeId", "data-v-241a4d4c"]]);
|
|
12503
12512
|
class xs {
|
|
12504
12513
|
controller;
|
|
12505
12514
|
buffer;
|
|
12506
12515
|
token;
|
|
12507
12516
|
baseUrl;
|
|
12508
12517
|
method = "GET";
|
|
12509
|
-
|
|
12510
|
-
|
|
12518
|
+
trimData;
|
|
12519
|
+
constructor(e, a, p = "GET", S = !0) {
|
|
12520
|
+
this.controller = new AbortController(), this.buffer = "", this.token = e, this.baseUrl = a || "", this.method = p, this.trimData = S;
|
|
12511
12521
|
}
|
|
12512
12522
|
async connect(e, a, p) {
|
|
12513
12523
|
try {
|
|
@@ -12556,7 +12566,12 @@ class xs {
|
|
|
12556
12566
|
e.split(`
|
|
12557
12567
|
`).forEach((C) => {
|
|
12558
12568
|
const c = C.trim();
|
|
12559
|
-
|
|
12569
|
+
if (c.startsWith("event:"))
|
|
12570
|
+
p = c.replace("event:", "").trim();
|
|
12571
|
+
else if (c.startsWith("data:")) {
|
|
12572
|
+
const r = c.replace("data:", "");
|
|
12573
|
+
S += this.trimData ? r.trim() : r;
|
|
12574
|
+
}
|
|
12560
12575
|
});
|
|
12561
12576
|
try {
|
|
12562
12577
|
this.dispatchEvent(
|