@react-pdf-kit/viewer 2.5.0-beta.2 → 2.5.0-beta.4
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.
|
@@ -172,7 +172,7 @@ E.isArrayBuffer = function(e) {
|
|
|
172
172
|
E.isArrayBufferView = function(e) {
|
|
173
173
|
return e && E.isArrayBuffer(e.buffer) && e.byteLength !== void 0;
|
|
174
174
|
};
|
|
175
|
-
function
|
|
175
|
+
function er(e) {
|
|
176
176
|
if (!(e === 8 || e === 16 || e === 24 || e === 32))
|
|
177
177
|
throw new Error("Only 8, 16, 24, or 32 bits supported: " + e);
|
|
178
178
|
}
|
|
@@ -253,7 +253,7 @@ E.ByteStringBuffer.prototype.putInt32Le = function(e) {
|
|
|
253
253
|
);
|
|
254
254
|
};
|
|
255
255
|
E.ByteStringBuffer.prototype.putInt = function(e, t) {
|
|
256
|
-
|
|
256
|
+
er(t);
|
|
257
257
|
var a = "";
|
|
258
258
|
do
|
|
259
259
|
t -= 8, a += String.fromCharCode(e >> t & 255);
|
|
@@ -294,7 +294,7 @@ E.ByteStringBuffer.prototype.getInt32Le = function() {
|
|
|
294
294
|
return this.read += 4, e;
|
|
295
295
|
};
|
|
296
296
|
E.ByteStringBuffer.prototype.getInt = function(e) {
|
|
297
|
-
|
|
297
|
+
er(e);
|
|
298
298
|
var t = 0;
|
|
299
299
|
do
|
|
300
300
|
t = (t << 8) + this.data.charCodeAt(this.read++), e -= 8;
|
|
@@ -439,14 +439,14 @@ E.DataBuffer.prototype.putInt32Le = function(e) {
|
|
|
439
439
|
return this.accommodate(4), this.data.setInt32(this.write, e, !0), this.write += 4, this;
|
|
440
440
|
};
|
|
441
441
|
E.DataBuffer.prototype.putInt = function(e, t) {
|
|
442
|
-
|
|
442
|
+
er(t), this.accommodate(t / 8);
|
|
443
443
|
do
|
|
444
444
|
t -= 8, this.data.setInt8(this.write++, e >> t & 255);
|
|
445
445
|
while (t > 0);
|
|
446
446
|
return this;
|
|
447
447
|
};
|
|
448
448
|
E.DataBuffer.prototype.putSignedInt = function(e, t) {
|
|
449
|
-
return
|
|
449
|
+
return er(t), this.accommodate(t / 8), e < 0 && (e += 2 << t - 1), this.putInt(e, t);
|
|
450
450
|
};
|
|
451
451
|
E.DataBuffer.prototype.getByte = function() {
|
|
452
452
|
return this.data.getInt8(this.read++);
|
|
@@ -476,7 +476,7 @@ E.DataBuffer.prototype.getInt32Le = function() {
|
|
|
476
476
|
return this.read += 4, e;
|
|
477
477
|
};
|
|
478
478
|
E.DataBuffer.prototype.getInt = function(e) {
|
|
479
|
-
|
|
479
|
+
er(e);
|
|
480
480
|
var t = 0;
|
|
481
481
|
do
|
|
482
482
|
t = (t << 8) + this.data.getInt8(this.read++), e -= 8;
|
|
@@ -804,7 +804,7 @@ var ra = function(e, t, a) {
|
|
|
804
804
|
}
|
|
805
805
|
}, Xi = function(e, t) {
|
|
806
806
|
ra(e, t, null);
|
|
807
|
-
},
|
|
807
|
+
}, Er = function(e, t, a) {
|
|
808
808
|
var r = null;
|
|
809
809
|
typeof a > "u" && (a = ["web", "flash"]);
|
|
810
810
|
var i, s = !1, n = null;
|
|
@@ -828,16 +828,16 @@ var ra = function(e, t, a) {
|
|
|
828
828
|
return r;
|
|
829
829
|
};
|
|
830
830
|
E.setItem = function(e, t, a, r, i) {
|
|
831
|
-
|
|
831
|
+
Er(Qi, arguments, i);
|
|
832
832
|
};
|
|
833
833
|
E.getItem = function(e, t, a, r) {
|
|
834
|
-
return
|
|
834
|
+
return Er(zi, arguments, r);
|
|
835
835
|
};
|
|
836
836
|
E.removeItem = function(e, t, a, r) {
|
|
837
|
-
|
|
837
|
+
Er(Yi, arguments, r);
|
|
838
838
|
};
|
|
839
839
|
E.clearItems = function(e, t, a) {
|
|
840
|
-
|
|
840
|
+
Er(Xi, arguments, a);
|
|
841
841
|
};
|
|
842
842
|
E.isEmpty = function(e) {
|
|
843
843
|
for (var t in e)
|
|
@@ -1082,7 +1082,7 @@ j.cbc.prototype.start = function(e) {
|
|
|
1082
1082
|
throw new Error("Invalid IV parameter.");
|
|
1083
1083
|
this._iv = this._prev.slice(0);
|
|
1084
1084
|
} else if ("iv" in e)
|
|
1085
|
-
this._iv =
|
|
1085
|
+
this._iv = xr(e.iv, this.blockSize), this._prev = this._iv.slice(0);
|
|
1086
1086
|
else
|
|
1087
1087
|
throw new Error("Invalid IV parameter.");
|
|
1088
1088
|
};
|
|
@@ -1122,7 +1122,7 @@ j.cfb = function(e) {
|
|
|
1122
1122
|
j.cfb.prototype.start = function(e) {
|
|
1123
1123
|
if (!("iv" in e))
|
|
1124
1124
|
throw new Error("Invalid IV parameter.");
|
|
1125
|
-
this._iv =
|
|
1125
|
+
this._iv = xr(e.iv, this.blockSize), this._inBlock = this._iv.slice(0), this._partialBytes = 0;
|
|
1126
1126
|
};
|
|
1127
1127
|
j.cfb.prototype.encrypt = function(e, t, a) {
|
|
1128
1128
|
var r = e.length();
|
|
@@ -1182,7 +1182,7 @@ j.ofb = function(e) {
|
|
|
1182
1182
|
j.ofb.prototype.start = function(e) {
|
|
1183
1183
|
if (!("iv" in e))
|
|
1184
1184
|
throw new Error("Invalid IV parameter.");
|
|
1185
|
-
this._iv =
|
|
1185
|
+
this._iv = xr(e.iv, this.blockSize), this._inBlock = this._iv.slice(0), this._partialBytes = 0;
|
|
1186
1186
|
};
|
|
1187
1187
|
j.ofb.prototype.encrypt = function(e, t, a) {
|
|
1188
1188
|
var r = e.length();
|
|
@@ -1217,7 +1217,7 @@ j.ctr = function(e) {
|
|
|
1217
1217
|
j.ctr.prototype.start = function(e) {
|
|
1218
1218
|
if (!("iv" in e))
|
|
1219
1219
|
throw new Error("Invalid IV parameter.");
|
|
1220
|
-
this._iv =
|
|
1220
|
+
this._iv = xr(e.iv, this.blockSize), this._inBlock = this._iv.slice(0), this._partialBytes = 0;
|
|
1221
1221
|
};
|
|
1222
1222
|
j.ctr.prototype.encrypt = function(e, t, a) {
|
|
1223
1223
|
var r = e.length();
|
|
@@ -1239,7 +1239,7 @@ j.ctr.prototype.encrypt = function(e, t, a) {
|
|
|
1239
1239
|
r - this._partialBytes
|
|
1240
1240
|
)), this._partialBytes = 0;
|
|
1241
1241
|
}
|
|
1242
|
-
|
|
1242
|
+
Sr(this._inBlock);
|
|
1243
1243
|
};
|
|
1244
1244
|
j.ctr.prototype.decrypt = j.ctr.prototype.encrypt;
|
|
1245
1245
|
j.gcm = function(e) {
|
|
@@ -1270,7 +1270,7 @@ j.gcm.prototype.start = function(e) {
|
|
|
1270
1270
|
[0, 0].concat(Pr(r * 8))
|
|
1271
1271
|
);
|
|
1272
1272
|
}
|
|
1273
|
-
this._inBlock = this._j0.slice(0),
|
|
1273
|
+
this._inBlock = this._j0.slice(0), Sr(this._inBlock), this._partialBytes = 0, a = xe.util.createBuffer(a), this._aDataLength = Pr(a.length() * 8);
|
|
1274
1274
|
var i = a.length() % this.blockSize;
|
|
1275
1275
|
for (i && a.fillWithByte(0, this.blockSize - i), this._s = [0, 0, 0, 0]; a.length() > 0; )
|
|
1276
1276
|
this._s = this.ghash(this._hashSubkey, this._s, [
|
|
@@ -1311,13 +1311,13 @@ j.gcm.prototype.encrypt = function(e, t, a) {
|
|
|
1311
1311
|
r - this._partialBytes
|
|
1312
1312
|
)), this._partialBytes = 0;
|
|
1313
1313
|
}
|
|
1314
|
-
this._s = this.ghash(this._hashSubkey, this._s, this._outBlock),
|
|
1314
|
+
this._s = this.ghash(this._hashSubkey, this._s, this._outBlock), Sr(this._inBlock);
|
|
1315
1315
|
};
|
|
1316
1316
|
j.gcm.prototype.decrypt = function(e, t, a) {
|
|
1317
1317
|
var r = e.length();
|
|
1318
1318
|
if (r < this.blockSize && !(a && r > 0))
|
|
1319
1319
|
return !0;
|
|
1320
|
-
this.cipher.encrypt(this._inBlock, this._outBlock),
|
|
1320
|
+
this.cipher.encrypt(this._inBlock, this._outBlock), Sr(this._inBlock), this._hashBlock[0] = e.getInt32(), this._hashBlock[1] = e.getInt32(), this._hashBlock[2] = e.getInt32(), this._hashBlock[3] = e.getInt32(), this._s = this.ghash(this._hashSubkey, this._s, this._hashBlock);
|
|
1321
1321
|
for (var i = 0; i < this._ints; ++i)
|
|
1322
1322
|
t.putInt32(this._outBlock[i] ^ this._hashBlock[i]);
|
|
1323
1323
|
r < this.blockSize ? this._cipherLength += r % this.blockSize : this._cipherLength += this.blockSize;
|
|
@@ -1385,7 +1385,7 @@ j.gcm.prototype.generateSubHashTable = function(e, t) {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
return i;
|
|
1387
1387
|
};
|
|
1388
|
-
function
|
|
1388
|
+
function xr(e, t) {
|
|
1389
1389
|
if (typeof e == "string" && (e = xe.util.createBuffer(e)), xe.util.isArray(e) && e.length > 4) {
|
|
1390
1390
|
var a = e;
|
|
1391
1391
|
e = xe.util.createBuffer();
|
|
@@ -1403,7 +1403,7 @@ function Sr(e, t) {
|
|
|
1403
1403
|
}
|
|
1404
1404
|
return e;
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1406
|
+
function Sr(e) {
|
|
1407
1407
|
e[e.length - 1] = e[e.length - 1] + 1 & 4294967295;
|
|
1408
1408
|
}
|
|
1409
1409
|
function Pr(e) {
|
|
@@ -1412,7 +1412,7 @@ function Pr(e) {
|
|
|
1412
1412
|
var ue = z;
|
|
1413
1413
|
ue.aes = ue.aes || {};
|
|
1414
1414
|
ue.aes.startEncrypting = function(e, t, a, r) {
|
|
1415
|
-
var i =
|
|
1415
|
+
var i = Tr({
|
|
1416
1416
|
key: e,
|
|
1417
1417
|
output: a,
|
|
1418
1418
|
decrypt: !1,
|
|
@@ -1421,7 +1421,7 @@ ue.aes.startEncrypting = function(e, t, a, r) {
|
|
|
1421
1421
|
return i.start(t), i;
|
|
1422
1422
|
};
|
|
1423
1423
|
ue.aes.createEncryptionCipher = function(e, t) {
|
|
1424
|
-
return
|
|
1424
|
+
return Tr({
|
|
1425
1425
|
key: e,
|
|
1426
1426
|
output: null,
|
|
1427
1427
|
decrypt: !1,
|
|
@@ -1429,7 +1429,7 @@ ue.aes.createEncryptionCipher = function(e, t) {
|
|
|
1429
1429
|
});
|
|
1430
1430
|
};
|
|
1431
1431
|
ue.aes.startDecrypting = function(e, t, a, r) {
|
|
1432
|
-
var i =
|
|
1432
|
+
var i = Tr({
|
|
1433
1433
|
key: e,
|
|
1434
1434
|
output: a,
|
|
1435
1435
|
decrypt: !0,
|
|
@@ -1438,7 +1438,7 @@ ue.aes.startDecrypting = function(e, t, a, r) {
|
|
|
1438
1438
|
return i.start(t), i;
|
|
1439
1439
|
};
|
|
1440
1440
|
ue.aes.createDecryptionCipher = function(e, t) {
|
|
1441
|
-
return
|
|
1441
|
+
return Tr({
|
|
1442
1442
|
key: e,
|
|
1443
1443
|
output: null,
|
|
1444
1444
|
decrypt: !0,
|
|
@@ -1532,8 +1532,8 @@ function Wa(e, t) {
|
|
|
1532
1532
|
if (f === 0 || f === o - kt)
|
|
1533
1533
|
y[f] = a[x], y[f + 1] = a[x + 3], y[f + 2] = a[x + 2], y[f + 3] = a[x + 1];
|
|
1534
1534
|
else
|
|
1535
|
-
for (var
|
|
1536
|
-
u = a[x +
|
|
1535
|
+
for (var T = 0; T < kt; ++T)
|
|
1536
|
+
u = a[x + T], y[f + (3 & -T)] = l[Fe[u >>> 24]] ^ c[Fe[u >>> 16 & 255]] ^ v[Fe[u >>> 8 & 255]] ^ C[Fe[u & 255]];
|
|
1537
1537
|
a = y;
|
|
1538
1538
|
}
|
|
1539
1539
|
return a;
|
|
@@ -1541,13 +1541,13 @@ function Wa(e, t) {
|
|
|
1541
1541
|
function Or(e, t, a, r) {
|
|
1542
1542
|
var i = e.length / 4 - 1, s, n, o, f, u;
|
|
1543
1543
|
r ? (s = tt[0], n = tt[1], o = tt[2], f = tt[3], u = Vr) : (s = Nt[0], n = Nt[1], o = Nt[2], f = Nt[3], u = Fe);
|
|
1544
|
-
var l, c, v, C, y, x,
|
|
1544
|
+
var l, c, v, C, y, x, T;
|
|
1545
1545
|
l = t[0] ^ e[0], c = t[r ? 3 : 1] ^ e[1], v = t[2] ^ e[2], C = t[r ? 1 : 3] ^ e[3];
|
|
1546
|
-
for (var I = 3,
|
|
1547
|
-
y = s[l >>> 24] ^ n[c >>> 16 & 255] ^ o[v >>> 8 & 255] ^ f[C & 255] ^ e[++I], x = s[c >>> 24] ^ n[v >>> 16 & 255] ^ o[C >>> 8 & 255] ^ f[l & 255] ^ e[++I],
|
|
1546
|
+
for (var I = 3, B = 1; B < i; ++B)
|
|
1547
|
+
y = s[l >>> 24] ^ n[c >>> 16 & 255] ^ o[v >>> 8 & 255] ^ f[C & 255] ^ e[++I], x = s[c >>> 24] ^ n[v >>> 16 & 255] ^ o[C >>> 8 & 255] ^ f[l & 255] ^ e[++I], T = s[v >>> 24] ^ n[C >>> 16 & 255] ^ o[l >>> 8 & 255] ^ f[c & 255] ^ e[++I], C = s[C >>> 24] ^ n[l >>> 16 & 255] ^ o[c >>> 8 & 255] ^ f[v & 255] ^ e[++I], l = y, c = x, v = T;
|
|
1548
1548
|
a[0] = u[l >>> 24] << 24 ^ u[c >>> 16 & 255] << 16 ^ u[v >>> 8 & 255] << 8 ^ u[C & 255] ^ e[++I], a[r ? 3 : 1] = u[c >>> 24] << 24 ^ u[v >>> 16 & 255] << 16 ^ u[C >>> 8 & 255] << 8 ^ u[l & 255] ^ e[++I], a[2] = u[v >>> 24] << 24 ^ u[C >>> 16 & 255] << 16 ^ u[l >>> 8 & 255] << 8 ^ u[c & 255] ^ e[++I], a[r ? 1 : 3] = u[C >>> 24] << 24 ^ u[l >>> 16 & 255] << 16 ^ u[c >>> 8 & 255] << 8 ^ u[v & 255] ^ e[++I];
|
|
1549
1549
|
}
|
|
1550
|
-
function
|
|
1550
|
+
function Tr(e) {
|
|
1551
1551
|
e = e || {};
|
|
1552
1552
|
var t = (e.mode || "CBC").toUpperCase(), a = "AES-" + t, r;
|
|
1553
1553
|
e.decrypt ? r = ue.cipher.createDecipher(a, e.key) : r = ue.cipher.createCipher(a, e.key);
|
|
@@ -1644,7 +1644,6 @@ R("2.5.4.13", "description");
|
|
|
1644
1644
|
R("2.5.4.15", "businessCategory");
|
|
1645
1645
|
R("2.5.4.17", "postalCode");
|
|
1646
1646
|
R("2.5.4.42", "givenName");
|
|
1647
|
-
R("2.5.4.65", "pseudonym");
|
|
1648
1647
|
R("1.3.6.1.4.1.311.60.2.1.2", "jurisdictionOfIncorporationStateOrProvinceName");
|
|
1649
1648
|
R("1.3.6.1.4.1.311.60.2.1.3", "jurisdictionOfIncorporationCountryName");
|
|
1650
1649
|
R("2.16.840.1.113730.1.1", "nsCertType");
|
|
@@ -1811,14 +1810,14 @@ U.fromDer = function(e, t) {
|
|
|
1811
1810
|
parseAllBytes: !0,
|
|
1812
1811
|
decodeBitStrings: !0
|
|
1813
1812
|
}), "strict" in t || (t.strict = !0), "parseAllBytes" in t || (t.parseAllBytes = !0), "decodeBitStrings" in t || (t.decodeBitStrings = !0), "maxDepth" in t || (t.maxDepth = U.maxDepth), typeof e == "string" && (e = fe.util.createBuffer(e));
|
|
1814
|
-
var a = e.length(), r =
|
|
1813
|
+
var a = e.length(), r = or(e, e.length(), 0, t);
|
|
1815
1814
|
if (t.parseAllBytes && e.length() !== 0) {
|
|
1816
1815
|
var i = new Error("Unparsed DER bytes remain after ASN.1 parsing.");
|
|
1817
1816
|
throw i.byteCount = a, i.remaining = e.length(), i;
|
|
1818
1817
|
}
|
|
1819
1818
|
return r;
|
|
1820
1819
|
};
|
|
1821
|
-
function
|
|
1820
|
+
function or(e, t, a, r) {
|
|
1822
1821
|
if (a >= r.maxDepth)
|
|
1823
1822
|
throw new Error("ASN.1 parsing error: Max depth exceeded.");
|
|
1824
1823
|
var i;
|
|
@@ -1843,11 +1842,11 @@ function ur(e, t, a, r) {
|
|
|
1843
1842
|
e.getBytes(2), t -= 2;
|
|
1844
1843
|
break;
|
|
1845
1844
|
}
|
|
1846
|
-
i = e.length(), l.push(
|
|
1845
|
+
i = e.length(), l.push(or(e, t, a + 1, r)), t -= i - e.length();
|
|
1847
1846
|
}
|
|
1848
1847
|
else
|
|
1849
1848
|
for (; f > 0; )
|
|
1850
|
-
i = e.length(), l.push(
|
|
1849
|
+
i = e.length(), l.push(or(e, f, a + 1, r)), t -= i - e.length(), f -= i - e.length();
|
|
1851
1850
|
if (l === void 0 && n === U.Class.UNIVERSAL && o === U.Type.BITSTRING && (c = e.bytes(f)), l === void 0 && r.decodeBitStrings && n === U.Class.UNIVERSAL && // FIXME: OCTET STRINGs not yet supported here
|
|
1852
1851
|
// .. other parts of forge expect to decode OCTET STRINGs manually
|
|
1853
1852
|
o === U.Type.BITSTRING && f > 1) {
|
|
@@ -1855,14 +1854,14 @@ function ur(e, t, a, r) {
|
|
|
1855
1854
|
if (o === U.Type.BITSTRING && (Xt(e, t, 1), x = e.getByte(), t--), x === 0)
|
|
1856
1855
|
try {
|
|
1857
1856
|
i = e.length();
|
|
1858
|
-
var
|
|
1857
|
+
var T = {
|
|
1859
1858
|
// enforce strict mode to avoid parsing ASN.1 from plain data
|
|
1860
1859
|
strict: !0,
|
|
1861
1860
|
decodeBitStrings: !0
|
|
1862
|
-
}, I =
|
|
1863
|
-
t -=
|
|
1864
|
-
var
|
|
1865
|
-
|
|
1861
|
+
}, I = or(e, t, a + 1, T), B = i - e.length();
|
|
1862
|
+
t -= B, o == U.Type.BITSTRING && B++;
|
|
1863
|
+
var b = I.tagClass;
|
|
1864
|
+
B === f && (b === U.Class.UNIVERSAL || b === U.Class.CONTEXT_SPECIFIC) && (l = [I]);
|
|
1866
1865
|
} catch {
|
|
1867
1866
|
}
|
|
1868
1867
|
l === void 0 && (e.read = C, t = y);
|
|
@@ -2182,9 +2181,9 @@ U.prettyPrint = function(e, t, a) {
|
|
|
2182
2181
|
}
|
|
2183
2182
|
return r;
|
|
2184
2183
|
};
|
|
2185
|
-
var
|
|
2186
|
-
|
|
2187
|
-
|
|
2184
|
+
var lr = z;
|
|
2185
|
+
lr.md = lr.md || {};
|
|
2186
|
+
lr.md.algorithms = lr.md.algorithms || {};
|
|
2188
2187
|
var ct = z, ji = ct.hmac = ct.hmac || {};
|
|
2189
2188
|
ji.create = function() {
|
|
2190
2189
|
var e = null, t = null, a = null, r = null, i = {};
|
|
@@ -2277,9 +2276,9 @@ ja.create = function() {
|
|
|
2277
2276
|
return c.putInt32Le(l.h0), c.putInt32Le(l.h1), c.putInt32Le(l.h2), c.putInt32Le(l.h3), c;
|
|
2278
2277
|
}, r;
|
|
2279
2278
|
};
|
|
2280
|
-
var Kr = null,
|
|
2279
|
+
var Kr = null, ur = null, Wt = null, Pt = null, $a = !1;
|
|
2281
2280
|
function $i() {
|
|
2282
|
-
Kr = String.fromCharCode(128), Kr += nt.util.fillString(String.fromCharCode(0), 64),
|
|
2281
|
+
Kr = String.fromCharCode(128), Kr += nt.util.fillString(String.fromCharCode(0), 64), ur = [
|
|
2283
2282
|
0,
|
|
2284
2283
|
1,
|
|
2285
2284
|
2,
|
|
@@ -2419,15 +2418,15 @@ function Ta(e, t, a) {
|
|
|
2419
2418
|
for (i = e.h0, s = e.h1, n = e.h2, o = e.h3, l = 0; l < 16; ++l)
|
|
2420
2419
|
t[l] = a.getInt32Le(), f = o ^ s & (n ^ o), r = i + f + Pt[l] + t[l], u = Wt[l], i = o, o = n, n = s, s += r << u | r >>> 32 - u;
|
|
2421
2420
|
for (; l < 32; ++l)
|
|
2422
|
-
f = n ^ o & (s ^ n), r = i + f + Pt[l] + t[
|
|
2421
|
+
f = n ^ o & (s ^ n), r = i + f + Pt[l] + t[ur[l]], u = Wt[l], i = o, o = n, n = s, s += r << u | r >>> 32 - u;
|
|
2423
2422
|
for (; l < 48; ++l)
|
|
2424
|
-
f = s ^ n ^ o, r = i + f + Pt[l] + t[
|
|
2423
|
+
f = s ^ n ^ o, r = i + f + Pt[l] + t[ur[l]], u = Wt[l], i = o, o = n, n = s, s += r << u | r >>> 32 - u;
|
|
2425
2424
|
for (; l < 64; ++l)
|
|
2426
|
-
f = n ^ (s | ~o), r = i + f + Pt[l] + t[
|
|
2425
|
+
f = n ^ (s | ~o), r = i + f + Pt[l] + t[ur[l]], u = Wt[l], i = o, o = n, n = s, s += r << u | r >>> 32 - u;
|
|
2427
2426
|
e.h0 = e.h0 + i | 0, e.h1 = e.h1 + s | 0, e.h2 = e.h2 + n | 0, e.h3 = e.h3 + o | 0, c -= 64;
|
|
2428
2427
|
}
|
|
2429
2428
|
}
|
|
2430
|
-
var
|
|
2429
|
+
var cr = z, Za = cr.pem = cr.pem || {};
|
|
2431
2430
|
Za.encode = function(e, t) {
|
|
2432
2431
|
t = t || {};
|
|
2433
2432
|
var a = "-----BEGIN " + e.type + `-----\r
|
|
@@ -2435,11 +2434,11 @@ Za.encode = function(e, t) {
|
|
|
2435
2434
|
if (e.procType && (r = {
|
|
2436
2435
|
name: "Proc-Type",
|
|
2437
2436
|
values: [String(e.procType.version), e.procType.type]
|
|
2438
|
-
}, a +=
|
|
2437
|
+
}, a += ar(r)), e.contentDomain && (r = { name: "Content-Domain", values: [e.contentDomain] }, a += ar(r)), e.dekInfo && (r = { name: "DEK-Info", values: [e.dekInfo.algorithm] }, e.dekInfo.parameters && r.values.push(e.dekInfo.parameters), a += ar(r)), e.headers)
|
|
2439
2438
|
for (var i = 0; i < e.headers.length; ++i)
|
|
2440
|
-
a +=
|
|
2439
|
+
a += ar(e.headers[i]);
|
|
2441
2440
|
return e.procType && (a += `\r
|
|
2442
|
-
`), a +=
|
|
2441
|
+
`), a += cr.util.encode64(e.body, t.maxline || 64) + `\r
|
|
2443
2442
|
`, a += "-----END " + e.type + `-----\r
|
|
2444
2443
|
`, a;
|
|
2445
2444
|
};
|
|
@@ -2453,7 +2452,7 @@ Za.decode = function(e) {
|
|
|
2453
2452
|
contentDomain: null,
|
|
2454
2453
|
dekInfo: null,
|
|
2455
2454
|
headers: [],
|
|
2456
|
-
body:
|
|
2455
|
+
body: cr.util.decode64(s[3])
|
|
2457
2456
|
};
|
|
2458
2457
|
if (t.push(o), !!s[2]) {
|
|
2459
2458
|
for (var f = s[2].split(i), u = 0; s && u < f.length; ) {
|
|
@@ -2493,7 +2492,7 @@ Za.decode = function(e) {
|
|
|
2493
2492
|
throw new Error("Invalid PEM formatted message.");
|
|
2494
2493
|
return t;
|
|
2495
2494
|
};
|
|
2496
|
-
function
|
|
2495
|
+
function ar(e) {
|
|
2497
2496
|
for (var t = e.name + ": ", a = [], r = function(f, u) {
|
|
2498
2497
|
return " " + u;
|
|
2499
2498
|
}, i = 0; i < e.values.length; ++i)
|
|
@@ -2516,7 +2515,7 @@ function Zi(e) {
|
|
|
2516
2515
|
var ce = z;
|
|
2517
2516
|
ce.des = ce.des || {};
|
|
2518
2517
|
ce.des.startEncrypting = function(e, t, a, r) {
|
|
2519
|
-
var i =
|
|
2518
|
+
var i = Ir({
|
|
2520
2519
|
key: e,
|
|
2521
2520
|
output: a,
|
|
2522
2521
|
decrypt: !1,
|
|
@@ -2525,7 +2524,7 @@ ce.des.startEncrypting = function(e, t, a, r) {
|
|
|
2525
2524
|
return i.start(t), i;
|
|
2526
2525
|
};
|
|
2527
2526
|
ce.des.createEncryptionCipher = function(e, t) {
|
|
2528
|
-
return
|
|
2527
|
+
return Ir({
|
|
2529
2528
|
key: e,
|
|
2530
2529
|
output: null,
|
|
2531
2530
|
decrypt: !1,
|
|
@@ -2533,7 +2532,7 @@ ce.des.createEncryptionCipher = function(e, t) {
|
|
|
2533
2532
|
});
|
|
2534
2533
|
};
|
|
2535
2534
|
ce.des.startDecrypting = function(e, t, a, r) {
|
|
2536
|
-
var i =
|
|
2535
|
+
var i = Ir({
|
|
2537
2536
|
key: e,
|
|
2538
2537
|
output: a,
|
|
2539
2538
|
decrypt: !0,
|
|
@@ -2542,7 +2541,7 @@ ce.des.startDecrypting = function(e, t, a, r) {
|
|
|
2542
2541
|
return i.start(t), i;
|
|
2543
2542
|
};
|
|
2544
2543
|
ce.des.createDecryptionCipher = function(e, t) {
|
|
2545
|
-
return
|
|
2544
|
+
return Ir({
|
|
2546
2545
|
key: e,
|
|
2547
2546
|
output: null,
|
|
2548
2547
|
decrypt: !0,
|
|
@@ -2589,16 +2588,16 @@ function ft(e, t) {
|
|
|
2589
2588
|
}
|
|
2590
2589
|
var Ji = [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], en = [-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], tn = [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], rn = [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], an = [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], nn = [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], sn = [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], on = [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];
|
|
2591
2590
|
function un(e) {
|
|
2592
|
-
for (var t = [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], r = [0, 8, 2048, 2056, 16777216, 16777224, 16779264, 16779272, 0, 8, 2048, 2056, 16777216, 16777224, 16779264, 16779272], i = [0, 2097152, 134217728, 136314880, 8192, 2105344, 134225920, 136323072, 131072, 2228224, 134348800, 136445952, 139264, 2236416, 134356992, 136454144], s = [0, 262144, 16, 262160, 0, 262144, 16, 262160, 4096, 266240, 4112, 266256, 4096, 266240, 4112, 266256], n = [0, 1024, 32, 1056, 0, 1024, 32, 1056, 33554432, 33555456, 33554464, 33555488, 33554432, 33555456, 33554464, 33555488], o = [0, 268435456, 524288, 268959744, 2, 268435458, 524290, 268959746, 0, 268435456, 524288, 268959744, 2, 268435458, 524290, 268959746], f = [0, 65536, 2048, 67584, 536870912, 536936448, 536872960, 536938496, 131072, 196608, 133120, 198656, 537001984, 537067520, 537004032, 537069568], u = [0, 262144, 0, 262144, 2, 262146, 2, 262146, 33554432, 33816576, 33554432, 33816576, 33554434, 33816578, 33554434, 33816578], l = [0, 268435456, 8, 268435464, 0, 268435456, 8, 268435464, 1024, 268436480, 1032, 268436488, 1024, 268436480, 1032, 268436488], c = [0, 32, 0, 32, 1048576, 1048608, 1048576, 1048608, 8192, 8224, 8192, 8224, 1056768, 1056800, 1056768, 1056800], v = [0, 16777216, 512, 16777728, 2097152, 18874368, 2097664, 18874880, 67108864, 83886080, 67109376, 83886592, 69206016, 85983232, 69206528, 85983744], C = [0, 4096, 134217728, 134221824, 524288, 528384, 134742016, 134746112, 16, 4112, 134217744, 134221840, 524304, 528400, 134742032, 134746128], y = [0, 4, 256, 260, 0, 4, 256, 260, 1, 5, 257, 261, 1, 5, 257, 261], x = e.length() > 8 ? 3 : 1,
|
|
2591
|
+
for (var t = [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], r = [0, 8, 2048, 2056, 16777216, 16777224, 16779264, 16779272, 0, 8, 2048, 2056, 16777216, 16777224, 16779264, 16779272], i = [0, 2097152, 134217728, 136314880, 8192, 2105344, 134225920, 136323072, 131072, 2228224, 134348800, 136445952, 139264, 2236416, 134356992, 136454144], s = [0, 262144, 16, 262160, 0, 262144, 16, 262160, 4096, 266240, 4112, 266256, 4096, 266240, 4112, 266256], n = [0, 1024, 32, 1056, 0, 1024, 32, 1056, 33554432, 33555456, 33554464, 33555488, 33554432, 33555456, 33554464, 33555488], o = [0, 268435456, 524288, 268959744, 2, 268435458, 524290, 268959746, 0, 268435456, 524288, 268959744, 2, 268435458, 524290, 268959746], f = [0, 65536, 2048, 67584, 536870912, 536936448, 536872960, 536938496, 131072, 196608, 133120, 198656, 537001984, 537067520, 537004032, 537069568], u = [0, 262144, 0, 262144, 2, 262146, 2, 262146, 33554432, 33816576, 33554432, 33816576, 33554434, 33816578, 33554434, 33816578], l = [0, 268435456, 8, 268435464, 0, 268435456, 8, 268435464, 1024, 268436480, 1032, 268436488, 1024, 268436480, 1032, 268436488], c = [0, 32, 0, 32, 1048576, 1048608, 1048576, 1048608, 8192, 8224, 8192, 8224, 1056768, 1056800, 1056768, 1056800], v = [0, 16777216, 512, 16777728, 2097152, 18874368, 2097664, 18874880, 67108864, 83886080, 67109376, 83886592, 69206016, 85983232, 69206528, 85983744], C = [0, 4096, 134217728, 134221824, 524288, 528384, 134742016, 134746112, 16, 4112, 134217744, 134221840, 524304, 528400, 134742032, 134746128], y = [0, 4, 256, 260, 0, 4, 256, 260, 1, 5, 257, 261, 1, 5, 257, 261], x = e.length() > 8 ? 3 : 1, T = [], I = [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0], B = 0, b, V = 0; V < x; V++) {
|
|
2593
2592
|
var D = e.getInt32(), w = e.getInt32();
|
|
2594
|
-
|
|
2593
|
+
b = (D >>> 4 ^ w) & 252645135, w ^= b, D ^= b << 4, b = (w >>> -16 ^ D) & 65535, D ^= b, w ^= b << -16, b = (D >>> 2 ^ w) & 858993459, w ^= b, D ^= b << 2, b = (w >>> -16 ^ D) & 65535, D ^= b, w ^= b << -16, b = (D >>> 1 ^ w) & 1431655765, w ^= b, D ^= b << 1, b = (w >>> 8 ^ D) & 16711935, D ^= b, w ^= b << 8, b = (D >>> 1 ^ w) & 1431655765, w ^= b, D ^= b << 1, b = D << 8 | w >>> 20 & 240, D = w << 24 | w << 8 & 16711680 | w >>> 8 & 65280 | w >>> 24 & 240, w = b;
|
|
2595
2594
|
for (var G = 0; G < I.length; ++G) {
|
|
2596
2595
|
I[G] ? (D = D << 2 | D >>> 26, w = w << 2 | w >>> 26) : (D = D << 1 | D >>> 27, w = w << 1 | w >>> 27), D &= -15, w &= -15;
|
|
2597
2596
|
var Y = t[D >>> 28] | a[D >>> 24 & 15] | r[D >>> 20 & 15] | i[D >>> 16 & 15] | s[D >>> 12 & 15] | n[D >>> 8 & 15] | o[D >>> 4 & 15], re = f[w >>> 28] | u[w >>> 24 & 15] | l[w >>> 20 & 15] | c[w >>> 16 & 15] | v[w >>> 12 & 15] | C[w >>> 8 & 15] | y[w >>> 4 & 15];
|
|
2598
|
-
|
|
2597
|
+
b = (re >>> 16 ^ Y) & 65535, T[B++] = Y ^ b, T[B++] = re ^ b << 16;
|
|
2599
2598
|
}
|
|
2600
2599
|
}
|
|
2601
|
-
return
|
|
2600
|
+
return T;
|
|
2602
2601
|
}
|
|
2603
2602
|
function Ia(e, t, a, r) {
|
|
2604
2603
|
var i = e.length === 32 ? 3 : 9, s;
|
|
@@ -2614,7 +2613,7 @@ function Ia(e, t, a, r) {
|
|
|
2614
2613
|
}
|
|
2615
2614
|
o = o >>> 1 | o << 31, f = f >>> 1 | f << 31, n = (o >>> 1 ^ f) & 1431655765, f ^= n, o ^= n << 1, n = (f >>> 8 ^ o) & 16711935, o ^= n, f ^= n << 8, n = (f >>> 2 ^ o) & 858993459, o ^= n, f ^= n << 2, n = (o >>> 16 ^ f) & 65535, f ^= n, o ^= n << 16, n = (o >>> 4 ^ f) & 252645135, f ^= n, o ^= n << 4, a[0] = o, a[1] = f;
|
|
2616
2615
|
}
|
|
2617
|
-
function
|
|
2616
|
+
function Ir(e) {
|
|
2618
2617
|
e = e || {};
|
|
2619
2618
|
var t = (e.mode || "CBC").toUpperCase(), a = "DES-" + t, r;
|
|
2620
2619
|
e.decrypt ? r = ce.cipher.createDecipher(a, e.key) : r = ce.cipher.createCipher(a, e.key);
|
|
@@ -2632,13 +2631,13 @@ var Ke = z, cn = Ke.pkcs5 = Ke.pkcs5 || {}, lt;
|
|
|
2632
2631
|
Ke.util.isNodejs && !Ke.options.usePureJavaScript && (lt = sa);
|
|
2633
2632
|
Ke.pbkdf2 = cn.pbkdf2 = function(e, t, a, r, i, s) {
|
|
2634
2633
|
if (typeof i == "function" && (s = i, i = null), Ke.util.isNodejs && !Ke.options.usePureJavaScript && lt.pbkdf2 && (i === null || typeof i != "object") && (lt.pbkdf2Sync.length > 4 || !i || i === "sha1"))
|
|
2635
|
-
return typeof i != "string" && (i = "sha1"), e = Buffer.from(e, "binary"), t = Buffer.from(t, "binary"), s ? lt.pbkdf2Sync.length === 4 ? lt.pbkdf2(e, t, a, r, function(
|
|
2636
|
-
if (
|
|
2637
|
-
return s(
|
|
2634
|
+
return typeof i != "string" && (i = "sha1"), e = Buffer.from(e, "binary"), t = Buffer.from(t, "binary"), s ? lt.pbkdf2Sync.length === 4 ? lt.pbkdf2(e, t, a, r, function(b, V) {
|
|
2635
|
+
if (b)
|
|
2636
|
+
return s(b);
|
|
2638
2637
|
s(null, V.toString("binary"));
|
|
2639
|
-
}) : lt.pbkdf2(e, t, a, r, i, function(
|
|
2640
|
-
if (
|
|
2641
|
-
return s(
|
|
2638
|
+
}) : lt.pbkdf2(e, t, a, r, i, function(b, V) {
|
|
2639
|
+
if (b)
|
|
2640
|
+
return s(b);
|
|
2642
2641
|
s(null, V.toString("binary"));
|
|
2643
2642
|
}) : lt.pbkdf2Sync.length === 4 ? lt.pbkdf2Sync(e, t, a, r).toString("binary") : lt.pbkdf2Sync(e, t, a, r, i).toString("binary");
|
|
2644
2643
|
if ((typeof i > "u" || i === null) && (i = "sha1"), typeof i == "string") {
|
|
@@ -2659,21 +2658,21 @@ Ke.pbkdf2 = cn.pbkdf2 = function(e, t, a, r, i, s) {
|
|
|
2659
2658
|
if (!s) {
|
|
2660
2659
|
for (var x = 1; x <= f; ++x) {
|
|
2661
2660
|
l.start(null, null), l.update(t), l.update(Ke.util.int32ToBytes(x)), v = y = l.digest().getBytes();
|
|
2662
|
-
for (var
|
|
2661
|
+
for (var T = 2; T <= a; ++T)
|
|
2663
2662
|
l.start(null, null), l.update(y), C = l.digest().getBytes(), v = Ke.util.xorBytes(v, C, n), y = C;
|
|
2664
2663
|
c += x < f ? v : v.substr(0, u);
|
|
2665
2664
|
}
|
|
2666
2665
|
return c;
|
|
2667
2666
|
}
|
|
2668
|
-
var x = 1,
|
|
2667
|
+
var x = 1, T;
|
|
2669
2668
|
function I() {
|
|
2670
2669
|
if (x > f)
|
|
2671
2670
|
return s(null, c);
|
|
2672
|
-
l.start(null, null), l.update(t), l.update(Ke.util.int32ToBytes(x)), v = y = l.digest().getBytes(),
|
|
2671
|
+
l.start(null, null), l.update(t), l.update(Ke.util.int32ToBytes(x)), v = y = l.digest().getBytes(), T = 2, B();
|
|
2673
2672
|
}
|
|
2674
|
-
function
|
|
2675
|
-
if (
|
|
2676
|
-
return l.start(null, null), l.update(y), C = l.digest().getBytes(), v = Ke.util.xorBytes(v, C, n), y = C, ++
|
|
2673
|
+
function B() {
|
|
2674
|
+
if (T <= a)
|
|
2675
|
+
return l.start(null, null), l.update(y), C = l.digest().getBytes(), v = Ke.util.xorBytes(v, C, n), y = C, ++T, Ke.util.setImmediate(B);
|
|
2677
2676
|
c += x < f ? v : v.substr(0, u), ++x, I();
|
|
2678
2677
|
}
|
|
2679
2678
|
I();
|
|
@@ -2807,18 +2806,18 @@ function hn() {
|
|
|
2807
2806
|
], ei = !0;
|
|
2808
2807
|
}
|
|
2809
2808
|
function Aa(e, t, a) {
|
|
2810
|
-
for (var r, i, s, n, o, f, u, l, c, v, C, y, x,
|
|
2809
|
+
for (var r, i, s, n, o, f, u, l, c, v, C, y, x, T, I, B = a.length(); B >= 64; ) {
|
|
2811
2810
|
for (u = 0; u < 16; ++u)
|
|
2812
2811
|
t[u] = a.getInt32();
|
|
2813
2812
|
for (; u < 64; ++u)
|
|
2814
2813
|
r = t[u - 2], r = (r >>> 17 | r << 15) ^ (r >>> 19 | r << 13) ^ r >>> 10, i = t[u - 15], i = (i >>> 7 | i << 25) ^ (i >>> 18 | i << 14) ^ i >>> 3, t[u] = r + t[u - 7] + i + t[u - 16] | 0;
|
|
2815
|
-
for (l = e.h0, c = e.h1, v = e.h2, C = e.h3, y = e.h4, x = e.h5,
|
|
2816
|
-
n = (y >>> 6 | y << 26) ^ (y >>> 11 | y << 21) ^ (y >>> 25 | y << 7), o =
|
|
2817
|
-
e.h0 = e.h0 + l | 0, e.h1 = e.h1 + c | 0, e.h2 = e.h2 + v | 0, e.h3 = e.h3 + C | 0, e.h4 = e.h4 + y | 0, e.h5 = e.h5 + x | 0, e.h6 = e.h6 +
|
|
2814
|
+
for (l = e.h0, c = e.h1, v = e.h2, C = e.h3, y = e.h4, x = e.h5, T = e.h6, I = e.h7, u = 0; u < 64; ++u)
|
|
2815
|
+
n = (y >>> 6 | y << 26) ^ (y >>> 11 | y << 21) ^ (y >>> 25 | y << 7), o = T ^ y & (x ^ T), s = (l >>> 2 | l << 30) ^ (l >>> 13 | l << 19) ^ (l >>> 22 | l << 10), f = l & c | v & (l ^ c), r = I + n + o + ti[u] + t[u], i = s + f, I = T, T = x, x = y, y = C + r >>> 0, C = v, v = c, c = l, l = r + i >>> 0;
|
|
2816
|
+
e.h0 = e.h0 + l | 0, e.h1 = e.h1 + c | 0, e.h2 = e.h2 + v | 0, e.h3 = e.h3 + C | 0, e.h4 = e.h4 + y | 0, e.h5 = e.h5 + x | 0, e.h6 = e.h6 + T | 0, e.h7 = e.h7 + I | 0, B -= 64;
|
|
2818
2817
|
}
|
|
2819
2818
|
}
|
|
2820
|
-
var at = z,
|
|
2821
|
-
at.util.isNodejs && !at.options.usePureJavaScript && !process.versions["node-webkit"] && (
|
|
2819
|
+
var at = z, fr = null;
|
|
2820
|
+
at.util.isNodejs && !at.options.usePureJavaScript && !process.versions["node-webkit"] && (fr = sa);
|
|
2822
2821
|
var dn = at.prng = at.prng || {};
|
|
2823
2822
|
dn.create = function(e) {
|
|
2824
2823
|
for (var t = {
|
|
@@ -2838,18 +2837,18 @@ dn.create = function(e) {
|
|
|
2838
2837
|
if (!l)
|
|
2839
2838
|
return t.generateSync(u);
|
|
2840
2839
|
var c = t.plugin.cipher, v = t.plugin.increment, C = t.plugin.formatKey, y = t.plugin.formatSeed, x = at.util.createBuffer();
|
|
2841
|
-
t.key = null,
|
|
2842
|
-
function
|
|
2840
|
+
t.key = null, T();
|
|
2841
|
+
function T(I) {
|
|
2843
2842
|
if (I)
|
|
2844
2843
|
return l(I);
|
|
2845
2844
|
if (x.length() >= u)
|
|
2846
2845
|
return l(null, x.getBytes(u));
|
|
2847
2846
|
if (t.generated > 1048575 && (t.key = null), t.key === null)
|
|
2848
2847
|
return at.util.nextTick(function() {
|
|
2849
|
-
s(
|
|
2848
|
+
s(T);
|
|
2850
2849
|
});
|
|
2851
|
-
var
|
|
2852
|
-
t.generated +=
|
|
2850
|
+
var B = c(t.key, t.seed);
|
|
2851
|
+
t.generated += B.length, x.putBytes(B), t.key = C(c(t.key, v(t.seed))), t.seed = y(c(t.key, t.seed)), at.util.setImmediate(T);
|
|
2853
2852
|
}
|
|
2854
2853
|
}, t.generateSync = function(u) {
|
|
2855
2854
|
var l = t.plugin.cipher, c = t.plugin.increment, v = t.plugin.formatKey, C = t.plugin.formatSeed;
|
|
@@ -2898,29 +2897,29 @@ dn.create = function(e) {
|
|
|
2898
2897
|
var y = Math.max(1, Math.min(u - C.length(), 65536) / 4), x = new Uint32Array(Math.floor(y));
|
|
2899
2898
|
try {
|
|
2900
2899
|
l(x);
|
|
2901
|
-
for (var
|
|
2902
|
-
C.putInt32(x[
|
|
2900
|
+
for (var T = 0; T < x.length; ++T)
|
|
2901
|
+
C.putInt32(x[T]);
|
|
2903
2902
|
} catch (D) {
|
|
2904
2903
|
if (!(typeof QuotaExceededError < "u" && D instanceof QuotaExceededError))
|
|
2905
2904
|
throw D;
|
|
2906
2905
|
}
|
|
2907
2906
|
}
|
|
2908
2907
|
if (C.length() < u)
|
|
2909
|
-
for (var I,
|
|
2910
|
-
|
|
2911
|
-
for (var
|
|
2912
|
-
|
|
2908
|
+
for (var I, B, b, V = Math.floor(Math.random() * 65536); C.length() < u; ) {
|
|
2909
|
+
B = 16807 * (V & 65535), I = 16807 * (V >> 16), B += (I & 32767) << 16, B += I >> 15, B = (B & 2147483647) + (B >> 31), V = B & 4294967295;
|
|
2910
|
+
for (var T = 0; T < 3; ++T)
|
|
2911
|
+
b = V >>> (T << 3), b ^= Math.floor(Math.random() * 256), C.putByte(b & 255);
|
|
2913
2912
|
}
|
|
2914
2913
|
return C.getBytes(u);
|
|
2915
2914
|
}
|
|
2916
|
-
return
|
|
2917
|
-
|
|
2915
|
+
return fr ? (t.seedFile = function(u, l) {
|
|
2916
|
+
fr.randomBytes(u, function(c, v) {
|
|
2918
2917
|
if (c)
|
|
2919
2918
|
return l(c);
|
|
2920
2919
|
l(null, v.toString());
|
|
2921
2920
|
});
|
|
2922
2921
|
}, t.seedFileSync = function(u) {
|
|
2923
|
-
return
|
|
2922
|
+
return fr.randomBytes(u).toString();
|
|
2924
2923
|
}) : (t.seedFile = function(u, l) {
|
|
2925
2924
|
try {
|
|
2926
2925
|
l(null, f(u));
|
|
@@ -3008,7 +3007,7 @@ var me = z;
|
|
|
3008
3007
|
me.random.createInstance = i, me.random;
|
|
3009
3008
|
})(typeof jQuery < "u" ? jQuery : null);
|
|
3010
3009
|
})();
|
|
3011
|
-
var Ge = z,
|
|
3010
|
+
var Ge = z, Rr = [
|
|
3012
3011
|
217,
|
|
3013
3012
|
120,
|
|
3014
3013
|
249,
|
|
@@ -3275,9 +3274,9 @@ Ge.rc2.expandKey = function(e, t) {
|
|
|
3275
3274
|
typeof e == "string" && (e = Ge.util.createBuffer(e)), t = t || 128;
|
|
3276
3275
|
var a = e, r = e.length(), i = t, s = Math.ceil(i / 8), n = 255 >> (i & 7), o;
|
|
3277
3276
|
for (o = r; o < 128; o++)
|
|
3278
|
-
a.putByte(
|
|
3279
|
-
for (a.setAt(128 - s,
|
|
3280
|
-
a.setAt(o,
|
|
3277
|
+
a.putByte(Rr[a.at(o - 1) + a.at(o - r) & 255]);
|
|
3278
|
+
for (a.setAt(128 - s, Rr[a.at(128 - s) & n]), o = 127 - s; o >= 0; o--)
|
|
3279
|
+
a.setAt(o, Rr[a.at(o + 1) ^ a.at(o + s)]);
|
|
3281
3280
|
return a;
|
|
3282
3281
|
};
|
|
3283
3282
|
var ri = function(e, t, a) {
|
|
@@ -3300,12 +3299,12 @@ var ri = function(e, t, a) {
|
|
|
3300
3299
|
var v = function(y) {
|
|
3301
3300
|
var x = [];
|
|
3302
3301
|
for (u = 0; u < 4; u++) {
|
|
3303
|
-
var
|
|
3304
|
-
n !== null && (a ?
|
|
3302
|
+
var T = i.getInt16Le();
|
|
3303
|
+
n !== null && (a ? T ^= n.getInt16Le() : n.putInt16Le(T)), x.push(T & 65535);
|
|
3305
3304
|
}
|
|
3306
3305
|
l = a ? 0 : 63;
|
|
3307
3306
|
for (var I = 0; I < y.length; I++)
|
|
3308
|
-
for (var
|
|
3307
|
+
for (var B = 0; B < y[I][0]; B++)
|
|
3309
3308
|
y[I][1](x);
|
|
3310
3309
|
for (u = 0; u < 4; u++)
|
|
3311
3310
|
n !== null && (a ? n.putInt16Le(x[u]) : x[u] ^= n.getInt16Le()), s.putInt16Le(x[u]);
|
|
@@ -3353,15 +3352,15 @@ var ri = function(e, t, a) {
|
|
|
3353
3352
|
if (y)
|
|
3354
3353
|
x = y(8, i, !a);
|
|
3355
3354
|
else {
|
|
3356
|
-
var
|
|
3357
|
-
i.fillWithByte(
|
|
3355
|
+
var T = i.length() === 8 ? 8 : 8 - i.length();
|
|
3356
|
+
i.fillWithByte(T, T);
|
|
3358
3357
|
}
|
|
3359
3358
|
if (x && (r = !0, C.update()), !a && (x = i.length() === 0, x))
|
|
3360
3359
|
if (y)
|
|
3361
3360
|
x = y(8, s, !a);
|
|
3362
3361
|
else {
|
|
3363
|
-
var I = s.length(),
|
|
3364
|
-
|
|
3362
|
+
var I = s.length(), B = s.at(I - 1);
|
|
3363
|
+
B > I ? x = !1 : s.truncate(B);
|
|
3365
3364
|
}
|
|
3366
3365
|
return x;
|
|
3367
3366
|
}
|
|
@@ -3384,12 +3383,12 @@ Ge.rc2.createDecryptionCipher = function(e, t) {
|
|
|
3384
3383
|
var Hr = z;
|
|
3385
3384
|
Hr.jsbn = Hr.jsbn || {};
|
|
3386
3385
|
var ht;
|
|
3387
|
-
function
|
|
3386
|
+
function N(e, t, a) {
|
|
3388
3387
|
this.data = [], e != null && (typeof e == "number" ? this.fromNumber(e, t, a) : t == null && typeof e != "string" ? this.fromString(e, 256) : this.fromString(e, t));
|
|
3389
3388
|
}
|
|
3390
|
-
Hr.jsbn.BigInteger =
|
|
3391
|
-
function
|
|
3392
|
-
return new
|
|
3389
|
+
Hr.jsbn.BigInteger = N;
|
|
3390
|
+
function ee() {
|
|
3391
|
+
return new N(null);
|
|
3393
3392
|
}
|
|
3394
3393
|
function yn(e, t, a, r, i, s) {
|
|
3395
3394
|
for (; --s >= 0; ) {
|
|
@@ -3412,29 +3411,29 @@ function ba(e, t, a, r, i, s) {
|
|
|
3412
3411
|
}
|
|
3413
3412
|
return i;
|
|
3414
3413
|
}
|
|
3415
|
-
typeof navigator > "u" ? (
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3414
|
+
typeof navigator > "u" ? (N.prototype.am = ba, ht = 28) : navigator.appName == "Microsoft Internet Explorer" ? (N.prototype.am = gn, ht = 30) : navigator.appName != "Netscape" ? (N.prototype.am = yn, ht = 26) : (N.prototype.am = ba, ht = 28);
|
|
3415
|
+
N.prototype.DB = ht;
|
|
3416
|
+
N.prototype.DM = (1 << ht) - 1;
|
|
3417
|
+
N.prototype.DV = 1 << ht;
|
|
3419
3418
|
var oa = 52;
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
var Cn = "0123456789abcdefghijklmnopqrstuvwxyz",
|
|
3419
|
+
N.prototype.FV = Math.pow(2, oa);
|
|
3420
|
+
N.prototype.F1 = oa - ht;
|
|
3421
|
+
N.prototype.F2 = 2 * ht - oa;
|
|
3422
|
+
var Cn = "0123456789abcdefghijklmnopqrstuvwxyz", Ar = new Array(), Gt, je;
|
|
3424
3423
|
Gt = "0".charCodeAt(0);
|
|
3425
3424
|
for (je = 0; je <= 9; ++je)
|
|
3426
|
-
|
|
3425
|
+
Ar[Gt++] = je;
|
|
3427
3426
|
Gt = "a".charCodeAt(0);
|
|
3428
3427
|
for (je = 10; je < 36; ++je)
|
|
3429
|
-
|
|
3428
|
+
Ar[Gt++] = je;
|
|
3430
3429
|
Gt = "A".charCodeAt(0);
|
|
3431
3430
|
for (je = 10; je < 36; ++je)
|
|
3432
|
-
|
|
3431
|
+
Ar[Gt++] = je;
|
|
3433
3432
|
function _a(e) {
|
|
3434
3433
|
return Cn.charAt(e);
|
|
3435
3434
|
}
|
|
3436
3435
|
function ai(e, t) {
|
|
3437
|
-
var a =
|
|
3436
|
+
var a = Ar[e.charCodeAt(t)];
|
|
3438
3437
|
return a ?? -1;
|
|
3439
3438
|
}
|
|
3440
3439
|
function mn(e) {
|
|
@@ -3446,7 +3445,7 @@ function En(e) {
|
|
|
3446
3445
|
this.t = 1, this.s = e < 0 ? -1 : 0, e > 0 ? this.data[0] = e : e < -1 ? this.data[0] = e + this.DV : this.t = 0;
|
|
3447
3446
|
}
|
|
3448
3447
|
function Ct(e) {
|
|
3449
|
-
var t =
|
|
3448
|
+
var t = ee();
|
|
3450
3449
|
return t.fromInt(e), t;
|
|
3451
3450
|
}
|
|
3452
3451
|
function xn(e, t) {
|
|
@@ -3476,7 +3475,7 @@ function xn(e, t) {
|
|
|
3476
3475
|
}
|
|
3477
3476
|
i = !1, s == 0 ? this.data[this.t++] = n : s + a > this.DB ? (this.data[this.t - 1] |= (n & (1 << this.DB - s) - 1) << s, this.data[this.t++] = n >> this.DB - s) : this.data[this.t - 1] |= n << s, s += a, s >= this.DB && (s -= this.DB);
|
|
3478
3477
|
}
|
|
3479
|
-
a == 8 && e[0] & 128 && (this.s = -1, s > 0 && (this.data[this.t - 1] |= (1 << this.DB - s) - 1 << s)), this.clamp(), i &&
|
|
3478
|
+
a == 8 && e[0] & 128 && (this.s = -1, s > 0 && (this.data[this.t - 1] |= (1 << this.DB - s) - 1 << s)), this.clamp(), i && N.ZERO.subTo(this, this);
|
|
3480
3479
|
}
|
|
3481
3480
|
function Sn() {
|
|
3482
3481
|
for (var e = this.s & this.DM; this.t > 0 && this.data[this.t - 1] == e; )
|
|
@@ -3505,8 +3504,8 @@ function Tn(e) {
|
|
|
3505
3504
|
return i ? s : "0";
|
|
3506
3505
|
}
|
|
3507
3506
|
function In() {
|
|
3508
|
-
var e =
|
|
3509
|
-
return
|
|
3507
|
+
var e = ee();
|
|
3508
|
+
return N.ZERO.subTo(this, e), e;
|
|
3510
3509
|
}
|
|
3511
3510
|
function An() {
|
|
3512
3511
|
return this.s < 0 ? this.negate() : this;
|
|
@@ -3523,12 +3522,12 @@ function Bn(e) {
|
|
|
3523
3522
|
return t;
|
|
3524
3523
|
return 0;
|
|
3525
3524
|
}
|
|
3526
|
-
function
|
|
3525
|
+
function Br(e) {
|
|
3527
3526
|
var t = 1, a;
|
|
3528
3527
|
return (a = e >>> 16) != 0 && (e = a, t += 16), (a = e >> 8) != 0 && (e = a, t += 8), (a = e >> 4) != 0 && (e = a, t += 4), (a = e >> 2) != 0 && (e = a, t += 2), (a = e >> 1) != 0 && (e = a, t += 1), t;
|
|
3529
3528
|
}
|
|
3530
3529
|
function bn() {
|
|
3531
|
-
return this.t <= 0 ? 0 : this.DB * (this.t - 1) +
|
|
3530
|
+
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + Br(this.data[this.t - 1] ^ this.s & this.DM);
|
|
3532
3531
|
}
|
|
3533
3532
|
function _n(e, t) {
|
|
3534
3533
|
var a;
|
|
@@ -3584,7 +3583,7 @@ function Dn(e, t) {
|
|
|
3584
3583
|
t.data[i] = 0;
|
|
3585
3584
|
for (i = 0; i < r.t; ++i)
|
|
3586
3585
|
t.data[i + a.t] = a.am(0, r.data[i], t, i, 0, a.t);
|
|
3587
|
-
t.s = 0, t.clamp(), this.s != e.s &&
|
|
3586
|
+
t.s = 0, t.clamp(), this.s != e.s && N.ZERO.subTo(t, t);
|
|
3588
3587
|
}
|
|
3589
3588
|
function kn(e) {
|
|
3590
3589
|
for (var t = this.abs(), a = e.t = 2 * t.t; --a >= 0; )
|
|
@@ -3603,27 +3602,27 @@ function Un(e, t, a) {
|
|
|
3603
3602
|
t != null && t.fromInt(0), a != null && this.copyTo(a);
|
|
3604
3603
|
return;
|
|
3605
3604
|
}
|
|
3606
|
-
a == null && (a =
|
|
3607
|
-
var s =
|
|
3605
|
+
a == null && (a = ee());
|
|
3606
|
+
var s = ee(), n = this.s, o = e.s, f = this.DB - Br(r.data[r.t - 1]);
|
|
3608
3607
|
f > 0 ? (r.lShiftTo(f, s), i.lShiftTo(f, a)) : (r.copyTo(s), i.copyTo(a));
|
|
3609
3608
|
var u = s.t, l = s.data[u - 1];
|
|
3610
3609
|
if (l != 0) {
|
|
3611
|
-
var c = l * (1 << this.F1) + (u > 1 ? s.data[u - 2] >> this.F2 : 0), v = this.FV / c, C = (1 << this.F1) / c, y = 1 << this.F2, x = a.t,
|
|
3612
|
-
for (s.dlShiftTo(
|
|
3610
|
+
var c = l * (1 << this.F1) + (u > 1 ? s.data[u - 2] >> this.F2 : 0), v = this.FV / c, C = (1 << this.F1) / c, y = 1 << this.F2, x = a.t, T = x - u, I = t ?? ee();
|
|
3611
|
+
for (s.dlShiftTo(T, I), a.compareTo(I) >= 0 && (a.data[a.t++] = 1, a.subTo(I, a)), N.ONE.dlShiftTo(u, I), I.subTo(s, s); s.t < u; )
|
|
3613
3612
|
s.data[s.t++] = 0;
|
|
3614
|
-
for (; --
|
|
3615
|
-
var
|
|
3616
|
-
if ((a.data[x] += s.am(0,
|
|
3617
|
-
for (s.dlShiftTo(
|
|
3613
|
+
for (; --T >= 0; ) {
|
|
3614
|
+
var B = a.data[--x] == l ? this.DM : Math.floor(a.data[x] * v + (a.data[x - 1] + y) * C);
|
|
3615
|
+
if ((a.data[x] += s.am(0, B, a, T, 0, u)) < B)
|
|
3616
|
+
for (s.dlShiftTo(T, I), a.subTo(I, a); a.data[x] < --B; )
|
|
3618
3617
|
a.subTo(I, a);
|
|
3619
3618
|
}
|
|
3620
|
-
t != null && (a.drShiftTo(u, t), n != o &&
|
|
3619
|
+
t != null && (a.drShiftTo(u, t), n != o && N.ZERO.subTo(t, t)), a.t = u, a.clamp(), f > 0 && a.rShiftTo(f, a), n < 0 && N.ZERO.subTo(a, a);
|
|
3621
3620
|
}
|
|
3622
3621
|
}
|
|
3623
3622
|
}
|
|
3624
3623
|
function Pn(e) {
|
|
3625
|
-
var t =
|
|
3626
|
-
return this.abs().divRemTo(e, null, t), this.s < 0 && t.compareTo(
|
|
3624
|
+
var t = ee();
|
|
3625
|
+
return this.abs().divRemTo(e, null, t), this.s < 0 && t.compareTo(N.ZERO) > 0 && e.subTo(t, t), t;
|
|
3627
3626
|
}
|
|
3628
3627
|
function wt(e) {
|
|
3629
3628
|
this.m = e;
|
|
@@ -3661,11 +3660,11 @@ function Lt(e) {
|
|
|
3661
3660
|
this.m = e, this.mp = e.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << e.DB - 15) - 1, this.mt2 = 2 * e.t;
|
|
3662
3661
|
}
|
|
3663
3662
|
function Gn(e) {
|
|
3664
|
-
var t =
|
|
3665
|
-
return e.abs().dlShiftTo(this.m.t, t), t.divRemTo(this.m, null, t), e.s < 0 && t.compareTo(
|
|
3663
|
+
var t = ee();
|
|
3664
|
+
return e.abs().dlShiftTo(this.m.t, t), t.divRemTo(this.m, null, t), e.s < 0 && t.compareTo(N.ZERO) > 0 && this.m.subTo(t, t), t;
|
|
3666
3665
|
}
|
|
3667
3666
|
function qn(e) {
|
|
3668
|
-
var t =
|
|
3667
|
+
var t = ee();
|
|
3669
3668
|
return e.copyTo(t), this.reduce(t), t;
|
|
3670
3669
|
}
|
|
3671
3670
|
function Qn(e) {
|
|
@@ -3694,8 +3693,8 @@ function Xn() {
|
|
|
3694
3693
|
}
|
|
3695
3694
|
function Wn(e, t) {
|
|
3696
3695
|
if (e > 4294967295 || e < 1)
|
|
3697
|
-
return
|
|
3698
|
-
var a =
|
|
3696
|
+
return N.ONE;
|
|
3697
|
+
var a = ee(), r = ee(), i = t.convert(this), s = Br(e) - 1;
|
|
3699
3698
|
for (i.copyTo(a); --s >= 0; )
|
|
3700
3699
|
if (t.sqrTo(a, r), (e & 1 << s) > 0)
|
|
3701
3700
|
t.mulTo(r, i, a);
|
|
@@ -3709,32 +3708,32 @@ function jn(e, t) {
|
|
|
3709
3708
|
var a;
|
|
3710
3709
|
return e < 256 || t.isEven() ? a = new wt(t) : a = new Lt(t), this.exp(e, a);
|
|
3711
3710
|
}
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3711
|
+
N.prototype.copyTo = mn;
|
|
3712
|
+
N.prototype.fromInt = En;
|
|
3713
|
+
N.prototype.fromString = xn;
|
|
3714
|
+
N.prototype.clamp = Sn;
|
|
3715
|
+
N.prototype.dlShiftTo = _n;
|
|
3716
|
+
N.prototype.drShiftTo = Nn;
|
|
3717
|
+
N.prototype.lShiftTo = Rn;
|
|
3718
|
+
N.prototype.rShiftTo = wn;
|
|
3719
|
+
N.prototype.subTo = Ln;
|
|
3720
|
+
N.prototype.multiplyTo = Dn;
|
|
3721
|
+
N.prototype.squareTo = kn;
|
|
3722
|
+
N.prototype.divRemTo = Un;
|
|
3723
|
+
N.prototype.invDigit = Hn;
|
|
3724
|
+
N.prototype.isEven = Xn;
|
|
3725
|
+
N.prototype.exp = Wn;
|
|
3726
|
+
N.prototype.toString = Tn;
|
|
3727
|
+
N.prototype.negate = In;
|
|
3728
|
+
N.prototype.abs = An;
|
|
3729
|
+
N.prototype.compareTo = Bn;
|
|
3730
|
+
N.prototype.bitLength = bn;
|
|
3731
|
+
N.prototype.mod = Pn;
|
|
3732
|
+
N.prototype.modPowInt = jn;
|
|
3733
|
+
N.ZERO = Ct(0);
|
|
3734
|
+
N.ONE = Ct(1);
|
|
3736
3735
|
function $n() {
|
|
3737
|
-
var e =
|
|
3736
|
+
var e = ee();
|
|
3738
3737
|
return this.copyTo(e), e;
|
|
3739
3738
|
}
|
|
3740
3739
|
function Zn() {
|
|
@@ -3766,7 +3765,7 @@ function rs() {
|
|
|
3766
3765
|
function as(e) {
|
|
3767
3766
|
if (e == null && (e = 10), this.signum() == 0 || e < 2 || e > 36)
|
|
3768
3767
|
return "0";
|
|
3769
|
-
var t = this.chunkSize(e), a = Math.pow(e, t), r = Ct(a), i =
|
|
3768
|
+
var t = this.chunkSize(e), a = Math.pow(e, t), r = Ct(a), i = ee(), s = ee(), n = "";
|
|
3770
3769
|
for (this.divRemTo(r, i, s); i.signum() > 0; )
|
|
3771
3770
|
n = (a + s.intValue()).toString(e).substr(1) + n, i.divRemTo(r, i, s);
|
|
3772
3771
|
return s.intValue().toString(e) + n;
|
|
@@ -3781,15 +3780,15 @@ function is(e, t) {
|
|
|
3781
3780
|
}
|
|
3782
3781
|
n = t * n + f, ++s >= a && (this.dMultiply(r), this.dAddOffset(n, 0), s = 0, n = 0);
|
|
3783
3782
|
}
|
|
3784
|
-
s > 0 && (this.dMultiply(Math.pow(t, s)), this.dAddOffset(n, 0)), i &&
|
|
3783
|
+
s > 0 && (this.dMultiply(Math.pow(t, s)), this.dAddOffset(n, 0)), i && N.ZERO.subTo(this, this);
|
|
3785
3784
|
}
|
|
3786
3785
|
function ns(e, t, a) {
|
|
3787
3786
|
if (typeof t == "number")
|
|
3788
3787
|
if (e < 2)
|
|
3789
3788
|
this.fromInt(1);
|
|
3790
3789
|
else
|
|
3791
|
-
for (this.fromNumber(e, a), this.testBit(e - 1) || this.bitwiseTo(
|
|
3792
|
-
this.dAddOffset(2, 0), this.bitLength() > e && this.subTo(
|
|
3790
|
+
for (this.fromNumber(e, a), this.testBit(e - 1) || this.bitwiseTo(N.ONE.shiftLeft(e - 1), ua, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(t); )
|
|
3791
|
+
this.dAddOffset(2, 0), this.bitLength() > e && this.subTo(N.ONE.shiftLeft(e - 1), this);
|
|
3793
3792
|
else {
|
|
3794
3793
|
var r = new Array(), i = e & 7;
|
|
3795
3794
|
r.length = (e >> 3) + 1, t.nextBytes(r), i > 0 ? r[0] &= (1 << i) - 1 : r[0] = 0, this.fromString(r, 256);
|
|
@@ -3832,41 +3831,41 @@ function cs(e, t) {
|
|
|
3832
3831
|
return e & t;
|
|
3833
3832
|
}
|
|
3834
3833
|
function hs(e) {
|
|
3835
|
-
var t =
|
|
3834
|
+
var t = ee();
|
|
3836
3835
|
return this.bitwiseTo(e, cs, t), t;
|
|
3837
3836
|
}
|
|
3838
3837
|
function ua(e, t) {
|
|
3839
3838
|
return e | t;
|
|
3840
3839
|
}
|
|
3841
3840
|
function ds(e) {
|
|
3842
|
-
var t =
|
|
3841
|
+
var t = ee();
|
|
3843
3842
|
return this.bitwiseTo(e, ua, t), t;
|
|
3844
3843
|
}
|
|
3845
3844
|
function ii(e, t) {
|
|
3846
3845
|
return e ^ t;
|
|
3847
3846
|
}
|
|
3848
3847
|
function ps(e) {
|
|
3849
|
-
var t =
|
|
3848
|
+
var t = ee();
|
|
3850
3849
|
return this.bitwiseTo(e, ii, t), t;
|
|
3851
3850
|
}
|
|
3852
3851
|
function ni(e, t) {
|
|
3853
3852
|
return e & ~t;
|
|
3854
3853
|
}
|
|
3855
3854
|
function vs(e) {
|
|
3856
|
-
var t =
|
|
3855
|
+
var t = ee();
|
|
3857
3856
|
return this.bitwiseTo(e, ni, t), t;
|
|
3858
3857
|
}
|
|
3859
3858
|
function ys() {
|
|
3860
|
-
for (var e =
|
|
3859
|
+
for (var e = ee(), t = 0; t < this.t; ++t)
|
|
3861
3860
|
e.data[t] = this.DM & ~this.data[t];
|
|
3862
3861
|
return e.t = this.t, e.s = ~this.s, e;
|
|
3863
3862
|
}
|
|
3864
3863
|
function gs(e) {
|
|
3865
|
-
var t =
|
|
3864
|
+
var t = ee();
|
|
3866
3865
|
return e < 0 ? this.rShiftTo(-e, t) : this.lShiftTo(e, t), t;
|
|
3867
3866
|
}
|
|
3868
3867
|
function Cs(e) {
|
|
3869
|
-
var t =
|
|
3868
|
+
var t = ee();
|
|
3870
3869
|
return e < 0 ? this.lShiftTo(-e, t) : this.rShiftTo(e, t), t;
|
|
3871
3870
|
}
|
|
3872
3871
|
function ms(e) {
|
|
@@ -3896,7 +3895,7 @@ function Ts(e) {
|
|
|
3896
3895
|
return t >= this.t ? this.s != 0 : (this.data[t] & 1 << e % this.DB) != 0;
|
|
3897
3896
|
}
|
|
3898
3897
|
function Is(e, t) {
|
|
3899
|
-
var a =
|
|
3898
|
+
var a = N.ONE.shiftLeft(e);
|
|
3900
3899
|
return this.bitwiseTo(a, t, a), a;
|
|
3901
3900
|
}
|
|
3902
3901
|
function As(e) {
|
|
@@ -3923,37 +3922,33 @@ function _s(e, t) {
|
|
|
3923
3922
|
t.s = r < 0 ? -1 : 0, r > 0 ? t.data[a++] = r : r < -1 && (t.data[a++] = this.DV + r), t.t = a, t.clamp();
|
|
3924
3923
|
}
|
|
3925
3924
|
function Ns(e) {
|
|
3926
|
-
var t =
|
|
3925
|
+
var t = ee();
|
|
3927
3926
|
return this.addTo(e, t), t;
|
|
3928
3927
|
}
|
|
3929
3928
|
function Rs(e) {
|
|
3930
|
-
var t =
|
|
3929
|
+
var t = ee();
|
|
3931
3930
|
return this.subTo(e, t), t;
|
|
3932
3931
|
}
|
|
3933
3932
|
function ws(e) {
|
|
3934
|
-
var t =
|
|
3933
|
+
var t = ee();
|
|
3935
3934
|
return this.multiplyTo(e, t), t;
|
|
3936
3935
|
}
|
|
3937
|
-
function Ls() {
|
|
3938
|
-
var
|
|
3939
|
-
return this.squareTo(e), e;
|
|
3940
|
-
}
|
|
3941
|
-
function Ds(e) {
|
|
3942
|
-
var t = J();
|
|
3936
|
+
function Ls(e) {
|
|
3937
|
+
var t = ee();
|
|
3943
3938
|
return this.divRemTo(e, t, null), t;
|
|
3944
3939
|
}
|
|
3945
|
-
function
|
|
3946
|
-
var t =
|
|
3940
|
+
function Ds(e) {
|
|
3941
|
+
var t = ee();
|
|
3947
3942
|
return this.divRemTo(e, null, t), t;
|
|
3948
3943
|
}
|
|
3949
|
-
function
|
|
3950
|
-
var t =
|
|
3944
|
+
function ks(e) {
|
|
3945
|
+
var t = ee(), a = ee();
|
|
3951
3946
|
return this.divRemTo(e, t, a), new Array(t, a);
|
|
3952
3947
|
}
|
|
3953
|
-
function
|
|
3948
|
+
function Us(e) {
|
|
3954
3949
|
this.data[this.t] = this.am(0, e - 1, this, 0, 0, this.t), ++this.t, this.clamp();
|
|
3955
3950
|
}
|
|
3956
|
-
function
|
|
3951
|
+
function Ps(e, t) {
|
|
3957
3952
|
if (e != 0) {
|
|
3958
3953
|
for (; this.t <= t; )
|
|
3959
3954
|
this.data[this.t++] = 0;
|
|
@@ -3961,25 +3956,25 @@ function Vs(e, t) {
|
|
|
3961
3956
|
this.data[t] -= this.DV, ++t >= this.t && (this.data[this.t++] = 0), ++this.data[t];
|
|
3962
3957
|
}
|
|
3963
3958
|
}
|
|
3964
|
-
function
|
|
3959
|
+
function tr() {
|
|
3965
3960
|
}
|
|
3966
3961
|
function si(e) {
|
|
3967
3962
|
return e;
|
|
3968
3963
|
}
|
|
3969
|
-
function
|
|
3964
|
+
function Vs(e, t, a) {
|
|
3970
3965
|
e.multiplyTo(t, a);
|
|
3971
3966
|
}
|
|
3972
|
-
function
|
|
3967
|
+
function Os(e, t) {
|
|
3973
3968
|
e.squareTo(t);
|
|
3974
3969
|
}
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
function
|
|
3980
|
-
return this.exp(e, new
|
|
3970
|
+
tr.prototype.convert = si;
|
|
3971
|
+
tr.prototype.revert = si;
|
|
3972
|
+
tr.prototype.mulTo = Vs;
|
|
3973
|
+
tr.prototype.sqrTo = Os;
|
|
3974
|
+
function Fs(e) {
|
|
3975
|
+
return this.exp(e, new tr());
|
|
3981
3976
|
}
|
|
3982
|
-
function
|
|
3977
|
+
function Ks(e, t, a) {
|
|
3983
3978
|
var r = Math.min(this.t + e.t, t);
|
|
3984
3979
|
for (a.s = 0, a.t = r; r > 0; )
|
|
3985
3980
|
a.data[--r] = 0;
|
|
@@ -3990,7 +3985,7 @@ function Ms(e, t, a) {
|
|
|
3990
3985
|
this.am(0, e.data[r], a, r, 0, t - r);
|
|
3991
3986
|
a.clamp();
|
|
3992
3987
|
}
|
|
3993
|
-
function
|
|
3988
|
+
function Ms(e, t, a) {
|
|
3994
3989
|
--t;
|
|
3995
3990
|
var r = a.t = this.t + e.t - t;
|
|
3996
3991
|
for (a.s = 0; --r >= 0; )
|
|
@@ -4000,49 +3995,49 @@ function Hs(e, t, a) {
|
|
|
4000
3995
|
a.clamp(), a.drShiftTo(1, a);
|
|
4001
3996
|
}
|
|
4002
3997
|
function qt(e) {
|
|
4003
|
-
this.r2 =
|
|
3998
|
+
this.r2 = ee(), this.q3 = ee(), N.ONE.dlShiftTo(2 * e.t, this.r2), this.mu = this.r2.divide(e), this.m = e;
|
|
4004
3999
|
}
|
|
4005
|
-
function
|
|
4000
|
+
function Hs(e) {
|
|
4006
4001
|
if (e.s < 0 || e.t > 2 * this.m.t)
|
|
4007
4002
|
return e.mod(this.m);
|
|
4008
4003
|
if (e.compareTo(this.m) < 0)
|
|
4009
4004
|
return e;
|
|
4010
|
-
var t =
|
|
4005
|
+
var t = ee();
|
|
4011
4006
|
return e.copyTo(t), this.reduce(t), t;
|
|
4012
4007
|
}
|
|
4013
|
-
function
|
|
4008
|
+
function Gs(e) {
|
|
4014
4009
|
return e;
|
|
4015
4010
|
}
|
|
4016
|
-
function
|
|
4011
|
+
function qs(e) {
|
|
4017
4012
|
for (e.drShiftTo(this.m.t - 1, this.r2), e.t > this.m.t + 1 && (e.t = this.m.t + 1, e.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); e.compareTo(this.r2) < 0; )
|
|
4018
4013
|
e.dAddOffset(1, this.m.t + 1);
|
|
4019
4014
|
for (e.subTo(this.r2, e); e.compareTo(this.m) >= 0; )
|
|
4020
4015
|
e.subTo(this.m, e);
|
|
4021
4016
|
}
|
|
4022
|
-
function
|
|
4017
|
+
function Qs(e, t) {
|
|
4023
4018
|
e.squareTo(t), this.reduce(t);
|
|
4024
4019
|
}
|
|
4025
|
-
function
|
|
4020
|
+
function zs(e, t, a) {
|
|
4026
4021
|
e.multiplyTo(t, a), this.reduce(a);
|
|
4027
4022
|
}
|
|
4028
|
-
qt.prototype.convert =
|
|
4029
|
-
qt.prototype.revert =
|
|
4030
|
-
qt.prototype.reduce =
|
|
4031
|
-
qt.prototype.mulTo =
|
|
4032
|
-
qt.prototype.sqrTo =
|
|
4033
|
-
function
|
|
4023
|
+
qt.prototype.convert = Hs;
|
|
4024
|
+
qt.prototype.revert = Gs;
|
|
4025
|
+
qt.prototype.reduce = qs;
|
|
4026
|
+
qt.prototype.mulTo = zs;
|
|
4027
|
+
qt.prototype.sqrTo = Qs;
|
|
4028
|
+
function Ys(e, t) {
|
|
4034
4029
|
var a = e.bitLength(), r, i = Ct(1), s;
|
|
4035
4030
|
if (a <= 0)
|
|
4036
4031
|
return i;
|
|
4037
4032
|
a < 18 ? r = 1 : a < 48 ? r = 3 : a < 144 ? r = 4 : a < 768 ? r = 5 : r = 6, a < 8 ? s = new wt(t) : t.isEven() ? s = new qt(t) : s = new Lt(t);
|
|
4038
4033
|
var n = new Array(), o = 3, f = r - 1, u = (1 << r) - 1;
|
|
4039
4034
|
if (n[1] = s.convert(this), r > 1) {
|
|
4040
|
-
var l =
|
|
4035
|
+
var l = ee();
|
|
4041
4036
|
for (s.sqrTo(n[1], l); o <= u; )
|
|
4042
|
-
n[o] =
|
|
4037
|
+
n[o] = ee(), s.mulTo(l, n[o - 2], n[o]), o += 2;
|
|
4043
4038
|
}
|
|
4044
|
-
var c = e.t - 1, v, C = !0, y =
|
|
4045
|
-
for (a =
|
|
4039
|
+
var c = e.t - 1, v, C = !0, y = ee(), x;
|
|
4040
|
+
for (a = Br(e.data[c]) - 1; c >= 0; ) {
|
|
4046
4041
|
for (a >= f ? v = e.data[c] >> a - f & u : (v = (e.data[c] & (1 << a + 1) - 1) << f - a, c > 0 && (v |= e.data[c - 1] >> this.DB + a - f)), o = r; !(v & 1); )
|
|
4047
4042
|
v >>= 1, --o;
|
|
4048
4043
|
if ((a -= o) < 0 && (a += this.DB, --c), C)
|
|
@@ -4057,7 +4052,7 @@ function Xs(e, t) {
|
|
|
4057
4052
|
}
|
|
4058
4053
|
return s.revert(i);
|
|
4059
4054
|
}
|
|
4060
|
-
function
|
|
4055
|
+
function Xs(e) {
|
|
4061
4056
|
var t = this.s < 0 ? this.negate() : this.clone(), a = e.s < 0 ? e.negate() : e.clone();
|
|
4062
4057
|
if (t.compareTo(a) < 0) {
|
|
4063
4058
|
var r = t;
|
|
@@ -4070,7 +4065,7 @@ function Ws(e) {
|
|
|
4070
4065
|
(i = t.getLowestSetBit()) > 0 && t.rShiftTo(i, t), (i = a.getLowestSetBit()) > 0 && a.rShiftTo(i, a), t.compareTo(a) >= 0 ? (t.subTo(a, t), t.rShiftTo(1, t)) : (a.subTo(t, a), a.rShiftTo(1, a));
|
|
4071
4066
|
return s > 0 && a.lShiftTo(s, a), a;
|
|
4072
4067
|
}
|
|
4073
|
-
function
|
|
4068
|
+
function Ws(e) {
|
|
4074
4069
|
if (e <= 0)
|
|
4075
4070
|
return 0;
|
|
4076
4071
|
var t = this.DV % e, a = this.s < 0 ? e - 1 : 0;
|
|
@@ -4082,12 +4077,10 @@ function js(e) {
|
|
|
4082
4077
|
a = (t * a + this.data[r]) % e;
|
|
4083
4078
|
return a;
|
|
4084
4079
|
}
|
|
4085
|
-
function
|
|
4086
|
-
if (this.signum() == 0)
|
|
4087
|
-
return B.ZERO;
|
|
4080
|
+
function js(e) {
|
|
4088
4081
|
var t = e.isEven();
|
|
4089
4082
|
if (this.isEven() && t || e.signum() == 0)
|
|
4090
|
-
return
|
|
4083
|
+
return N.ZERO;
|
|
4091
4084
|
for (var a = e.clone(), r = this.clone(), i = Ct(1), s = Ct(0), n = Ct(0), o = Ct(1); a.signum() != 0; ) {
|
|
4092
4085
|
for (; a.isEven(); )
|
|
4093
4086
|
a.rShiftTo(1, a), t ? ((!i.isEven() || !s.isEven()) && (i.addTo(this, i), s.subTo(e, s)), i.rShiftTo(1, i)) : s.isEven() || s.subTo(e, s), s.rShiftTo(1, s);
|
|
@@ -4095,8 +4088,8 @@ function $s(e) {
|
|
|
4095
4088
|
r.rShiftTo(1, r), t ? ((!n.isEven() || !o.isEven()) && (n.addTo(this, n), o.subTo(e, o)), n.rShiftTo(1, n)) : o.isEven() || o.subTo(e, o), o.rShiftTo(1, o);
|
|
4096
4089
|
a.compareTo(r) >= 0 ? (a.subTo(r, a), t && i.subTo(n, i), s.subTo(o, s)) : (r.subTo(a, r), t && n.subTo(i, n), o.subTo(s, o));
|
|
4097
4090
|
}
|
|
4098
|
-
if (r.compareTo(
|
|
4099
|
-
return
|
|
4091
|
+
if (r.compareTo(N.ONE) != 0)
|
|
4092
|
+
return N.ZERO;
|
|
4100
4093
|
if (o.compareTo(e) >= 0)
|
|
4101
4094
|
return o.subtract(e);
|
|
4102
4095
|
if (o.signum() < 0)
|
|
@@ -4105,8 +4098,8 @@ function $s(e) {
|
|
|
4105
4098
|
return o;
|
|
4106
4099
|
return o.signum() < 0 ? o.add(e) : o;
|
|
4107
4100
|
}
|
|
4108
|
-
var et = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509
|
|
4109
|
-
function
|
|
4101
|
+
var et = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509], $s = (1 << 26) / et[et.length - 1];
|
|
4102
|
+
function Zs(e) {
|
|
4110
4103
|
var t, a = this.abs();
|
|
4111
4104
|
if (a.t == 1 && a.data[0] <= et[et.length - 1]) {
|
|
4112
4105
|
for (t = 0; t < et.length; ++t)
|
|
@@ -4117,7 +4110,7 @@ function Js(e) {
|
|
|
4117
4110
|
if (a.isEven())
|
|
4118
4111
|
return !1;
|
|
4119
4112
|
for (t = 1; t < et.length; ) {
|
|
4120
|
-
for (var r = et[t], i = t + 1; i < et.length && r <
|
|
4113
|
+
for (var r = et[t], i = t + 1; i < et.length && r < $s; )
|
|
4121
4114
|
r *= et[i++];
|
|
4122
4115
|
for (r = a.modInt(r); t < i; )
|
|
4123
4116
|
if (r % et[t++] == 0)
|
|
@@ -4125,18 +4118,18 @@ function Js(e) {
|
|
|
4125
4118
|
}
|
|
4126
4119
|
return a.millerRabin(e);
|
|
4127
4120
|
}
|
|
4128
|
-
function
|
|
4129
|
-
var t = this.subtract(
|
|
4121
|
+
function Js(e) {
|
|
4122
|
+
var t = this.subtract(N.ONE), a = t.getLowestSetBit();
|
|
4130
4123
|
if (a <= 0)
|
|
4131
4124
|
return !1;
|
|
4132
|
-
for (var r = t.shiftRight(a), i =
|
|
4125
|
+
for (var r = t.shiftRight(a), i = e0(), s, n = 0; n < e; ++n) {
|
|
4133
4126
|
do
|
|
4134
|
-
s = new
|
|
4135
|
-
while (s.compareTo(
|
|
4127
|
+
s = new N(this.bitLength(), i);
|
|
4128
|
+
while (s.compareTo(N.ONE) <= 0 || s.compareTo(t) >= 0);
|
|
4136
4129
|
var o = s.modPow(r, this);
|
|
4137
|
-
if (o.compareTo(
|
|
4130
|
+
if (o.compareTo(N.ONE) != 0 && o.compareTo(t) != 0) {
|
|
4138
4131
|
for (var f = 1; f++ < a && o.compareTo(t) != 0; )
|
|
4139
|
-
if (o = o.modPowInt(2, this), o.compareTo(
|
|
4132
|
+
if (o = o.modPowInt(2, this), o.compareTo(N.ONE) == 0)
|
|
4140
4133
|
return !1;
|
|
4141
4134
|
if (o.compareTo(t) != 0)
|
|
4142
4135
|
return !1;
|
|
@@ -4144,7 +4137,7 @@ function e0(e) {
|
|
|
4144
4137
|
}
|
|
4145
4138
|
return !0;
|
|
4146
4139
|
}
|
|
4147
|
-
function
|
|
4140
|
+
function e0() {
|
|
4148
4141
|
return {
|
|
4149
4142
|
// x is an array to fill with bytes
|
|
4150
4143
|
nextBytes: function(e) {
|
|
@@ -4153,57 +4146,56 @@ function t0() {
|
|
|
4153
4146
|
}
|
|
4154
4147
|
};
|
|
4155
4148
|
}
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
B.prototype.square = Ls;
|
|
4149
|
+
N.prototype.chunkSize = ts;
|
|
4150
|
+
N.prototype.toRadix = as;
|
|
4151
|
+
N.prototype.fromRadix = is;
|
|
4152
|
+
N.prototype.fromNumber = ns;
|
|
4153
|
+
N.prototype.bitwiseTo = ls;
|
|
4154
|
+
N.prototype.changeBit = Is;
|
|
4155
|
+
N.prototype.addTo = _s;
|
|
4156
|
+
N.prototype.dMultiply = Us;
|
|
4157
|
+
N.prototype.dAddOffset = Ps;
|
|
4158
|
+
N.prototype.multiplyLowerTo = Ks;
|
|
4159
|
+
N.prototype.multiplyUpperTo = Ms;
|
|
4160
|
+
N.prototype.modInt = Ws;
|
|
4161
|
+
N.prototype.millerRabin = Js;
|
|
4162
|
+
N.prototype.clone = $n;
|
|
4163
|
+
N.prototype.intValue = Zn;
|
|
4164
|
+
N.prototype.byteValue = Jn;
|
|
4165
|
+
N.prototype.shortValue = es;
|
|
4166
|
+
N.prototype.signum = rs;
|
|
4167
|
+
N.prototype.toByteArray = ss;
|
|
4168
|
+
N.prototype.equals = os;
|
|
4169
|
+
N.prototype.min = us;
|
|
4170
|
+
N.prototype.max = fs;
|
|
4171
|
+
N.prototype.and = hs;
|
|
4172
|
+
N.prototype.or = ds;
|
|
4173
|
+
N.prototype.xor = ps;
|
|
4174
|
+
N.prototype.andNot = vs;
|
|
4175
|
+
N.prototype.not = ys;
|
|
4176
|
+
N.prototype.shiftLeft = gs;
|
|
4177
|
+
N.prototype.shiftRight = Cs;
|
|
4178
|
+
N.prototype.getLowestSetBit = Es;
|
|
4179
|
+
N.prototype.bitCount = Ss;
|
|
4180
|
+
N.prototype.testBit = Ts;
|
|
4181
|
+
N.prototype.setBit = As;
|
|
4182
|
+
N.prototype.clearBit = Bs;
|
|
4183
|
+
N.prototype.flipBit = bs;
|
|
4184
|
+
N.prototype.add = Ns;
|
|
4185
|
+
N.prototype.subtract = Rs;
|
|
4186
|
+
N.prototype.multiply = ws;
|
|
4187
|
+
N.prototype.divide = Ls;
|
|
4188
|
+
N.prototype.remainder = Ds;
|
|
4189
|
+
N.prototype.divideAndRemainder = ks;
|
|
4190
|
+
N.prototype.modPow = Ys;
|
|
4191
|
+
N.prototype.modInverse = js;
|
|
4192
|
+
N.prototype.pow = Fs;
|
|
4193
|
+
N.prototype.gcd = Xs;
|
|
4194
|
+
N.prototype.isProbablePrime = Zs;
|
|
4203
4195
|
var ot = z, oi = ot.sha1 = ot.sha1 || {};
|
|
4204
4196
|
ot.md.sha1 = ot.md.algorithms.sha1 = oi;
|
|
4205
4197
|
oi.create = function() {
|
|
4206
|
-
ui ||
|
|
4198
|
+
ui || t0();
|
|
4207
4199
|
var e = null, t = ot.util.createBuffer(), a = new Array(80), r = {
|
|
4208
4200
|
algorithm: "sha1",
|
|
4209
4201
|
blockLength: 64,
|
|
@@ -4254,7 +4246,7 @@ oi.create = function() {
|
|
|
4254
4246
|
}, r;
|
|
4255
4247
|
};
|
|
4256
4248
|
var Gr = null, ui = !1;
|
|
4257
|
-
function
|
|
4249
|
+
function t0() {
|
|
4258
4250
|
Gr = String.fromCharCode(128), Gr += ot.util.fillString(String.fromCharCode(0), 64), ui = !0;
|
|
4259
4251
|
}
|
|
4260
4252
|
function Na(e, t, a) {
|
|
@@ -4293,31 +4285,31 @@ fi.encode_rsa_oaep = function(e, t, a) {
|
|
|
4293
4285
|
var u = new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");
|
|
4294
4286
|
throw u.seedLength = i.length, u.digestLength = s.digestLength, u;
|
|
4295
4287
|
}
|
|
4296
|
-
var x =
|
|
4297
|
-
return "\0" +
|
|
4288
|
+
var x = hr(i, o - s.digestLength - 1, n), T = ut.util.xorBytes(y, x, y.length), I = hr(T, s.digestLength, n), B = ut.util.xorBytes(i, I, i.length);
|
|
4289
|
+
return "\0" + B + T;
|
|
4298
4290
|
};
|
|
4299
4291
|
fi.decode_rsa_oaep = function(e, t, a) {
|
|
4300
4292
|
var r, i, s;
|
|
4301
4293
|
typeof a == "string" ? (r = a, i = arguments[3] || void 0) : a && (r = a.label || void 0, i = a.md || void 0, a.mgf1 && a.mgf1.md && (s = a.mgf1.md));
|
|
4302
4294
|
var n = Math.ceil(e.n.bitLength() / 8);
|
|
4303
4295
|
if (t.length !== n) {
|
|
4304
|
-
var
|
|
4305
|
-
throw
|
|
4296
|
+
var T = new Error("RSAES-OAEP encoded message length is invalid.");
|
|
4297
|
+
throw T.length = t.length, T.expectedLength = n, T;
|
|
4306
4298
|
}
|
|
4307
4299
|
if (i === void 0 ? i = ut.md.sha1.create() : i.start(), s || (s = i), n < 2 * i.digestLength + 2)
|
|
4308
4300
|
throw new Error("RSAES-OAEP key is too short for the hash function.");
|
|
4309
4301
|
r || (r = ""), i.update(r, "raw");
|
|
4310
|
-
for (var o = i.digest().getBytes(), f = t.charAt(0), u = t.substring(1, i.digestLength + 1), l = t.substring(1 + i.digestLength), c =
|
|
4311
|
-
|
|
4312
|
-
for (var
|
|
4313
|
-
var D = y.charCodeAt(V), w = D & 1 ^ 1, G =
|
|
4314
|
-
|
|
4302
|
+
for (var o = i.digest().getBytes(), f = t.charAt(0), u = t.substring(1, i.digestLength + 1), l = t.substring(1 + i.digestLength), c = hr(l, i.digestLength, s), v = ut.util.xorBytes(u, c, u.length), C = hr(v, n - i.digestLength - 1, s), y = ut.util.xorBytes(l, C, l.length), x = y.substring(0, i.digestLength), T = f !== "\0", I = 0; I < i.digestLength; ++I)
|
|
4303
|
+
T |= o.charAt(I) !== x.charAt(I);
|
|
4304
|
+
for (var B = 1, b = i.digestLength, V = i.digestLength; V < y.length; V++) {
|
|
4305
|
+
var D = y.charCodeAt(V), w = D & 1 ^ 1, G = B ? 65534 : 0;
|
|
4306
|
+
T |= D & G, B = B & w, b += B;
|
|
4315
4307
|
}
|
|
4316
|
-
if (
|
|
4308
|
+
if (T || y.charCodeAt(b) !== 1)
|
|
4317
4309
|
throw new Error("Invalid RSAES-OAEP padding.");
|
|
4318
|
-
return y.substring(
|
|
4310
|
+
return y.substring(b + 1);
|
|
4319
4311
|
};
|
|
4320
|
-
function
|
|
4312
|
+
function hr(e, t, a) {
|
|
4321
4313
|
a || (a = ut.md.sha1.create());
|
|
4322
4314
|
for (var r = "", i = Math.ceil(t / a.digestLength), s = 0; s < i; ++s) {
|
|
4323
4315
|
var n = String.fromCharCode(
|
|
@@ -4345,51 +4337,51 @@ var pt = z;
|
|
|
4345
4337
|
typeof v == "function" && (C = v, v = {}), v = v || {};
|
|
4346
4338
|
var y = v.algorithm || "PRIMEINC";
|
|
4347
4339
|
typeof y == "string" && (y = { name: y }), y.options = y.options || {};
|
|
4348
|
-
var x = v.prng || pt.random,
|
|
4340
|
+
var x = v.prng || pt.random, T = {
|
|
4349
4341
|
// x is an array to fill with bytes
|
|
4350
4342
|
nextBytes: function(I) {
|
|
4351
|
-
for (var
|
|
4352
|
-
I[
|
|
4343
|
+
for (var B = x.getBytesSync(I.length), b = 0; b < I.length; ++b)
|
|
4344
|
+
I[b] = B.charCodeAt(b);
|
|
4353
4345
|
}
|
|
4354
4346
|
};
|
|
4355
4347
|
if (y.name === "PRIMEINC")
|
|
4356
|
-
return s(c,
|
|
4348
|
+
return s(c, T, y.options, C);
|
|
4357
4349
|
throw new Error("Invalid prime generation algorithm: " + y.name);
|
|
4358
4350
|
};
|
|
4359
4351
|
function s(c, v, C, y) {
|
|
4360
4352
|
return "workers" in C ? f(c, v, C, y) : n(c, v, C, y);
|
|
4361
4353
|
}
|
|
4362
4354
|
function n(c, v, C, y) {
|
|
4363
|
-
var x = u(c, v),
|
|
4355
|
+
var x = u(c, v), T = 0, I = l(x.bitLength());
|
|
4364
4356
|
"millerRabinTests" in C && (I = C.millerRabinTests);
|
|
4365
|
-
var
|
|
4366
|
-
"maxBlockTime" in C && (
|
|
4357
|
+
var B = 10;
|
|
4358
|
+
"maxBlockTime" in C && (B = C.maxBlockTime), o(x, c, v, T, I, B, y);
|
|
4367
4359
|
}
|
|
4368
|
-
function o(c, v, C, y, x,
|
|
4369
|
-
var
|
|
4360
|
+
function o(c, v, C, y, x, T, I) {
|
|
4361
|
+
var B = +/* @__PURE__ */ new Date();
|
|
4370
4362
|
do {
|
|
4371
4363
|
if (c.bitLength() > v && (c = u(v, C)), c.isProbablePrime(x))
|
|
4372
4364
|
return I(null, c);
|
|
4373
4365
|
c.dAddOffset(a[y++ % 8], 0);
|
|
4374
|
-
} while (
|
|
4366
|
+
} while (T < 0 || +/* @__PURE__ */ new Date() - B < T);
|
|
4375
4367
|
pt.util.setImmediate(function() {
|
|
4376
|
-
o(c, v, C, y, x,
|
|
4368
|
+
o(c, v, C, y, x, T, I);
|
|
4377
4369
|
});
|
|
4378
4370
|
}
|
|
4379
4371
|
function f(c, v, C, y) {
|
|
4380
4372
|
if (typeof Worker > "u")
|
|
4381
4373
|
return n(c, v, C, y);
|
|
4382
|
-
var x = u(c, v),
|
|
4383
|
-
if (
|
|
4374
|
+
var x = u(c, v), T = C.workers, I = C.workLoad || 100, B = I * 30 / 8, b = C.workerScript || "forge/prime.worker.js";
|
|
4375
|
+
if (T === -1)
|
|
4384
4376
|
return pt.util.estimateCores(function(D, w) {
|
|
4385
|
-
D && (w = 2),
|
|
4377
|
+
D && (w = 2), T = w - 1, V();
|
|
4386
4378
|
});
|
|
4387
4379
|
V();
|
|
4388
4380
|
function V() {
|
|
4389
|
-
|
|
4390
|
-
for (var D = [], w = 0; w <
|
|
4391
|
-
D[w] = new Worker(
|
|
4392
|
-
for (var w = 0; w <
|
|
4381
|
+
T = Math.max(1, T);
|
|
4382
|
+
for (var D = [], w = 0; w < T; ++w)
|
|
4383
|
+
D[w] = new Worker(b);
|
|
4384
|
+
for (var w = 0; w < T; ++w)
|
|
4393
4385
|
D[w].addEventListener("message", Y);
|
|
4394
4386
|
var G = !1;
|
|
4395
4387
|
function Y(re) {
|
|
@@ -4405,7 +4397,7 @@ var pt = z;
|
|
|
4405
4397
|
re.target.postMessage({
|
|
4406
4398
|
hex: he,
|
|
4407
4399
|
workLoad: I
|
|
4408
|
-
}), x.dAddOffset(
|
|
4400
|
+
}), x.dAddOffset(B, 0);
|
|
4409
4401
|
}
|
|
4410
4402
|
}
|
|
4411
4403
|
}
|
|
@@ -4419,191 +4411,191 @@ var pt = z;
|
|
|
4419
4411
|
}
|
|
4420
4412
|
})();
|
|
4421
4413
|
var K = z;
|
|
4422
|
-
if (typeof
|
|
4423
|
-
var
|
|
4424
|
-
var qr = K.util.isNodejs ? sa : null,
|
|
4414
|
+
if (typeof J > "u")
|
|
4415
|
+
var J = K.jsbn.BigInteger;
|
|
4416
|
+
var qr = K.util.isNodejs ? sa : null, S = K.asn1, $e = K.util;
|
|
4425
4417
|
K.pki = K.pki || {};
|
|
4426
4418
|
K.pki.rsa = K.rsa = K.rsa || {};
|
|
4427
|
-
var q = K.pki,
|
|
4419
|
+
var q = K.pki, r0 = [6, 4, 2, 4, 2, 4, 6, 2], a0 = {
|
|
4428
4420
|
// PrivateKeyInfo
|
|
4429
4421
|
name: "PrivateKeyInfo",
|
|
4430
|
-
tagClass:
|
|
4431
|
-
type:
|
|
4422
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4423
|
+
type: S.Type.SEQUENCE,
|
|
4432
4424
|
constructed: !0,
|
|
4433
4425
|
value: [{
|
|
4434
4426
|
// Version (INTEGER)
|
|
4435
4427
|
name: "PrivateKeyInfo.version",
|
|
4436
|
-
tagClass:
|
|
4437
|
-
type:
|
|
4428
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4429
|
+
type: S.Type.INTEGER,
|
|
4438
4430
|
constructed: !1,
|
|
4439
4431
|
capture: "privateKeyVersion"
|
|
4440
4432
|
}, {
|
|
4441
4433
|
// privateKeyAlgorithm
|
|
4442
4434
|
name: "PrivateKeyInfo.privateKeyAlgorithm",
|
|
4443
|
-
tagClass:
|
|
4444
|
-
type:
|
|
4435
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4436
|
+
type: S.Type.SEQUENCE,
|
|
4445
4437
|
constructed: !0,
|
|
4446
4438
|
value: [{
|
|
4447
4439
|
name: "AlgorithmIdentifier.algorithm",
|
|
4448
|
-
tagClass:
|
|
4449
|
-
type:
|
|
4440
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4441
|
+
type: S.Type.OID,
|
|
4450
4442
|
constructed: !1,
|
|
4451
4443
|
capture: "privateKeyOid"
|
|
4452
4444
|
}]
|
|
4453
4445
|
}, {
|
|
4454
4446
|
// PrivateKey
|
|
4455
4447
|
name: "PrivateKeyInfo",
|
|
4456
|
-
tagClass:
|
|
4457
|
-
type:
|
|
4448
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4449
|
+
type: S.Type.OCTETSTRING,
|
|
4458
4450
|
constructed: !1,
|
|
4459
4451
|
capture: "privateKey"
|
|
4460
4452
|
}]
|
|
4461
|
-
},
|
|
4453
|
+
}, i0 = {
|
|
4462
4454
|
// RSAPrivateKey
|
|
4463
4455
|
name: "RSAPrivateKey",
|
|
4464
|
-
tagClass:
|
|
4465
|
-
type:
|
|
4456
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4457
|
+
type: S.Type.SEQUENCE,
|
|
4466
4458
|
constructed: !0,
|
|
4467
4459
|
value: [{
|
|
4468
4460
|
// Version (INTEGER)
|
|
4469
4461
|
name: "RSAPrivateKey.version",
|
|
4470
|
-
tagClass:
|
|
4471
|
-
type:
|
|
4462
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4463
|
+
type: S.Type.INTEGER,
|
|
4472
4464
|
constructed: !1,
|
|
4473
4465
|
capture: "privateKeyVersion"
|
|
4474
4466
|
}, {
|
|
4475
4467
|
// modulus (n)
|
|
4476
4468
|
name: "RSAPrivateKey.modulus",
|
|
4477
|
-
tagClass:
|
|
4478
|
-
type:
|
|
4469
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4470
|
+
type: S.Type.INTEGER,
|
|
4479
4471
|
constructed: !1,
|
|
4480
4472
|
capture: "privateKeyModulus"
|
|
4481
4473
|
}, {
|
|
4482
4474
|
// publicExponent (e)
|
|
4483
4475
|
name: "RSAPrivateKey.publicExponent",
|
|
4484
|
-
tagClass:
|
|
4485
|
-
type:
|
|
4476
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4477
|
+
type: S.Type.INTEGER,
|
|
4486
4478
|
constructed: !1,
|
|
4487
4479
|
capture: "privateKeyPublicExponent"
|
|
4488
4480
|
}, {
|
|
4489
4481
|
// privateExponent (d)
|
|
4490
4482
|
name: "RSAPrivateKey.privateExponent",
|
|
4491
|
-
tagClass:
|
|
4492
|
-
type:
|
|
4483
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4484
|
+
type: S.Type.INTEGER,
|
|
4493
4485
|
constructed: !1,
|
|
4494
4486
|
capture: "privateKeyPrivateExponent"
|
|
4495
4487
|
}, {
|
|
4496
4488
|
// prime1 (p)
|
|
4497
4489
|
name: "RSAPrivateKey.prime1",
|
|
4498
|
-
tagClass:
|
|
4499
|
-
type:
|
|
4490
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4491
|
+
type: S.Type.INTEGER,
|
|
4500
4492
|
constructed: !1,
|
|
4501
4493
|
capture: "privateKeyPrime1"
|
|
4502
4494
|
}, {
|
|
4503
4495
|
// prime2 (q)
|
|
4504
4496
|
name: "RSAPrivateKey.prime2",
|
|
4505
|
-
tagClass:
|
|
4506
|
-
type:
|
|
4497
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4498
|
+
type: S.Type.INTEGER,
|
|
4507
4499
|
constructed: !1,
|
|
4508
4500
|
capture: "privateKeyPrime2"
|
|
4509
4501
|
}, {
|
|
4510
4502
|
// exponent1 (d mod (p-1))
|
|
4511
4503
|
name: "RSAPrivateKey.exponent1",
|
|
4512
|
-
tagClass:
|
|
4513
|
-
type:
|
|
4504
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4505
|
+
type: S.Type.INTEGER,
|
|
4514
4506
|
constructed: !1,
|
|
4515
4507
|
capture: "privateKeyExponent1"
|
|
4516
4508
|
}, {
|
|
4517
4509
|
// exponent2 (d mod (q-1))
|
|
4518
4510
|
name: "RSAPrivateKey.exponent2",
|
|
4519
|
-
tagClass:
|
|
4520
|
-
type:
|
|
4511
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4512
|
+
type: S.Type.INTEGER,
|
|
4521
4513
|
constructed: !1,
|
|
4522
4514
|
capture: "privateKeyExponent2"
|
|
4523
4515
|
}, {
|
|
4524
4516
|
// coefficient ((inverse of q) mod p)
|
|
4525
4517
|
name: "RSAPrivateKey.coefficient",
|
|
4526
|
-
tagClass:
|
|
4527
|
-
type:
|
|
4518
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4519
|
+
type: S.Type.INTEGER,
|
|
4528
4520
|
constructed: !1,
|
|
4529
4521
|
capture: "privateKeyCoefficient"
|
|
4530
4522
|
}]
|
|
4531
|
-
},
|
|
4523
|
+
}, n0 = {
|
|
4532
4524
|
// RSAPublicKey
|
|
4533
4525
|
name: "RSAPublicKey",
|
|
4534
|
-
tagClass:
|
|
4535
|
-
type:
|
|
4526
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4527
|
+
type: S.Type.SEQUENCE,
|
|
4536
4528
|
constructed: !0,
|
|
4537
4529
|
value: [{
|
|
4538
4530
|
// modulus (n)
|
|
4539
4531
|
name: "RSAPublicKey.modulus",
|
|
4540
|
-
tagClass:
|
|
4541
|
-
type:
|
|
4532
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4533
|
+
type: S.Type.INTEGER,
|
|
4542
4534
|
constructed: !1,
|
|
4543
4535
|
capture: "publicKeyModulus"
|
|
4544
4536
|
}, {
|
|
4545
4537
|
// publicExponent (e)
|
|
4546
4538
|
name: "RSAPublicKey.exponent",
|
|
4547
|
-
tagClass:
|
|
4548
|
-
type:
|
|
4539
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4540
|
+
type: S.Type.INTEGER,
|
|
4549
4541
|
constructed: !1,
|
|
4550
4542
|
capture: "publicKeyExponent"
|
|
4551
4543
|
}]
|
|
4552
|
-
},
|
|
4544
|
+
}, s0 = K.pki.rsa.publicKeyValidator = {
|
|
4553
4545
|
name: "SubjectPublicKeyInfo",
|
|
4554
|
-
tagClass:
|
|
4555
|
-
type:
|
|
4546
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4547
|
+
type: S.Type.SEQUENCE,
|
|
4556
4548
|
constructed: !0,
|
|
4557
4549
|
captureAsn1: "subjectPublicKeyInfo",
|
|
4558
4550
|
value: [{
|
|
4559
4551
|
name: "SubjectPublicKeyInfo.AlgorithmIdentifier",
|
|
4560
|
-
tagClass:
|
|
4561
|
-
type:
|
|
4552
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4553
|
+
type: S.Type.SEQUENCE,
|
|
4562
4554
|
constructed: !0,
|
|
4563
4555
|
value: [{
|
|
4564
4556
|
name: "AlgorithmIdentifier.algorithm",
|
|
4565
|
-
tagClass:
|
|
4566
|
-
type:
|
|
4557
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4558
|
+
type: S.Type.OID,
|
|
4567
4559
|
constructed: !1,
|
|
4568
4560
|
capture: "publicKeyOid"
|
|
4569
4561
|
}]
|
|
4570
4562
|
}, {
|
|
4571
4563
|
// subjectPublicKey
|
|
4572
4564
|
name: "SubjectPublicKeyInfo.subjectPublicKey",
|
|
4573
|
-
tagClass:
|
|
4574
|
-
type:
|
|
4565
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4566
|
+
type: S.Type.BITSTRING,
|
|
4575
4567
|
constructed: !1,
|
|
4576
4568
|
value: [{
|
|
4577
4569
|
// RSAPublicKey
|
|
4578
4570
|
name: "SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",
|
|
4579
|
-
tagClass:
|
|
4580
|
-
type:
|
|
4571
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4572
|
+
type: S.Type.SEQUENCE,
|
|
4581
4573
|
constructed: !0,
|
|
4582
4574
|
optional: !0,
|
|
4583
4575
|
captureAsn1: "rsaPublicKey"
|
|
4584
4576
|
}]
|
|
4585
4577
|
}]
|
|
4586
|
-
},
|
|
4578
|
+
}, o0 = {
|
|
4587
4579
|
name: "DigestInfo",
|
|
4588
|
-
tagClass:
|
|
4589
|
-
type:
|
|
4580
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4581
|
+
type: S.Type.SEQUENCE,
|
|
4590
4582
|
constructed: !0,
|
|
4591
4583
|
value: [{
|
|
4592
4584
|
name: "DigestInfo.DigestAlgorithm",
|
|
4593
|
-
tagClass:
|
|
4594
|
-
type:
|
|
4585
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4586
|
+
type: S.Type.SEQUENCE,
|
|
4595
4587
|
constructed: !0,
|
|
4596
4588
|
value: [{
|
|
4597
4589
|
name: "DigestInfo.DigestAlgorithm.algorithmIdentifier",
|
|
4598
|
-
tagClass:
|
|
4599
|
-
type:
|
|
4590
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4591
|
+
type: S.Type.OID,
|
|
4600
4592
|
constructed: !1,
|
|
4601
4593
|
capture: "algorithmIdentifier"
|
|
4602
4594
|
}, {
|
|
4603
4595
|
// NULL parameters
|
|
4604
4596
|
name: "DigestInfo.DigestAlgorithm.parameters",
|
|
4605
|
-
tagClass:
|
|
4606
|
-
type:
|
|
4597
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4598
|
+
type: S.Type.NULL,
|
|
4607
4599
|
// captured only to check existence for md2 and md5
|
|
4608
4600
|
capture: "parameters",
|
|
4609
4601
|
optional: !0,
|
|
@@ -4612,12 +4604,12 @@ var q = K.pki, a0 = [6, 4, 2, 4, 2, 4, 6, 2], i0 = {
|
|
|
4612
4604
|
}, {
|
|
4613
4605
|
// digest
|
|
4614
4606
|
name: "DigestInfo.digest",
|
|
4615
|
-
tagClass:
|
|
4616
|
-
type:
|
|
4607
|
+
tagClass: S.Class.UNIVERSAL,
|
|
4608
|
+
type: S.Type.OCTETSTRING,
|
|
4617
4609
|
constructed: !1,
|
|
4618
4610
|
capture: "digest"
|
|
4619
4611
|
}]
|
|
4620
|
-
},
|
|
4612
|
+
}, u0 = function(e) {
|
|
4621
4613
|
var t;
|
|
4622
4614
|
if (e.algorithm in q.oids)
|
|
4623
4615
|
t = q.oids[e.algorithm];
|
|
@@ -4625,48 +4617,48 @@ var q = K.pki, a0 = [6, 4, 2, 4, 2, 4, 6, 2], i0 = {
|
|
|
4625
4617
|
var a = new Error("Unknown message digest algorithm.");
|
|
4626
4618
|
throw a.algorithm = e.algorithm, a;
|
|
4627
4619
|
}
|
|
4628
|
-
var r =
|
|
4629
|
-
|
|
4630
|
-
|
|
4620
|
+
var r = S.oidToDer(t).getBytes(), i = S.create(
|
|
4621
|
+
S.Class.UNIVERSAL,
|
|
4622
|
+
S.Type.SEQUENCE,
|
|
4631
4623
|
!0,
|
|
4632
4624
|
[]
|
|
4633
|
-
), s =
|
|
4634
|
-
|
|
4635
|
-
|
|
4625
|
+
), s = S.create(
|
|
4626
|
+
S.Class.UNIVERSAL,
|
|
4627
|
+
S.Type.SEQUENCE,
|
|
4636
4628
|
!0,
|
|
4637
4629
|
[]
|
|
4638
4630
|
);
|
|
4639
|
-
s.value.push(
|
|
4640
|
-
|
|
4641
|
-
|
|
4631
|
+
s.value.push(S.create(
|
|
4632
|
+
S.Class.UNIVERSAL,
|
|
4633
|
+
S.Type.OID,
|
|
4642
4634
|
!1,
|
|
4643
4635
|
r
|
|
4644
|
-
)), s.value.push(
|
|
4645
|
-
|
|
4646
|
-
|
|
4636
|
+
)), s.value.push(S.create(
|
|
4637
|
+
S.Class.UNIVERSAL,
|
|
4638
|
+
S.Type.NULL,
|
|
4647
4639
|
!1,
|
|
4648
4640
|
""
|
|
4649
4641
|
));
|
|
4650
|
-
var n =
|
|
4651
|
-
|
|
4652
|
-
|
|
4642
|
+
var n = S.create(
|
|
4643
|
+
S.Class.UNIVERSAL,
|
|
4644
|
+
S.Type.OCTETSTRING,
|
|
4653
4645
|
!1,
|
|
4654
4646
|
e.digest().getBytes()
|
|
4655
4647
|
);
|
|
4656
|
-
return i.value.push(s), i.value.push(n),
|
|
4648
|
+
return i.value.push(s), i.value.push(n), S.toDer(i).getBytes();
|
|
4657
4649
|
}, li = function(e, t, a) {
|
|
4658
4650
|
if (a)
|
|
4659
4651
|
return e.modPow(t.e, t.n);
|
|
4660
4652
|
if (!t.p || !t.q)
|
|
4661
4653
|
return e.modPow(t.d, t.n);
|
|
4662
|
-
t.dP || (t.dP = t.d.mod(t.p.subtract(
|
|
4654
|
+
t.dP || (t.dP = t.d.mod(t.p.subtract(J.ONE))), t.dQ || (t.dQ = t.d.mod(t.q.subtract(J.ONE))), t.qInv || (t.qInv = t.q.modInverse(t.p));
|
|
4663
4655
|
var r;
|
|
4664
4656
|
do
|
|
4665
|
-
r = new
|
|
4657
|
+
r = new J(
|
|
4666
4658
|
K.util.bytesToHex(K.random.getBytes(t.n.bitLength() / 8)),
|
|
4667
4659
|
16
|
|
4668
4660
|
);
|
|
4669
|
-
while (r.compareTo(t.n) >= 0 || !r.gcd(t.n).equals(
|
|
4661
|
+
while (r.compareTo(t.n) >= 0 || !r.gcd(t.n).equals(J.ONE));
|
|
4670
4662
|
e = e.multiply(r.modPow(t.e, t.n)).mod(t.n);
|
|
4671
4663
|
for (var i = e.mod(t.p).modPow(t.dP, t.p), s = e.mod(t.q).modPow(t.dQ, t.q); i.compareTo(s) < 0; )
|
|
4672
4664
|
i = i.add(t.p);
|
|
@@ -4676,7 +4668,7 @@ var q = K.pki, a0 = [6, 4, 2, 4, 2, 4, 6, 2], i0 = {
|
|
|
4676
4668
|
q.rsa.encrypt = function(e, t, a) {
|
|
4677
4669
|
var r = a, i, s = Math.ceil(t.n.bitLength() / 8);
|
|
4678
4670
|
a !== !1 && a !== !0 ? (r = a === 2, i = ci(e, t, a)) : (i = K.util.createBuffer(), i.putBytes(e));
|
|
4679
|
-
for (var n = new
|
|
4671
|
+
for (var n = new J(i.toHex(), 16), o = li(n, t, r), f = o.toString(16), u = K.util.createBuffer(), l = s - Math.ceil(f.length / 2); l > 0; )
|
|
4680
4672
|
u.putByte(0), --l;
|
|
4681
4673
|
return u.putBytes(K.util.hexToBytes(f)), u.getBytes();
|
|
4682
4674
|
};
|
|
@@ -4686,12 +4678,12 @@ q.rsa.decrypt = function(e, t, a, r) {
|
|
|
4686
4678
|
var s = new Error("Encrypted message length is invalid.");
|
|
4687
4679
|
throw s.length = e.length, s.expected = i, s;
|
|
4688
4680
|
}
|
|
4689
|
-
var n = new
|
|
4681
|
+
var n = new J(K.util.createBuffer(e).toHex(), 16);
|
|
4690
4682
|
if (n.compareTo(t.n) >= 0)
|
|
4691
4683
|
throw new Error("Encrypted message is invalid.");
|
|
4692
4684
|
for (var o = li(n, t, a), f = o.toString(16), u = K.util.createBuffer(), l = i - Math.ceil(f.length / 2); l > 0; )
|
|
4693
4685
|
u.putByte(0), --l;
|
|
4694
|
-
return u.putBytes(K.util.hexToBytes(f)), r !== !1 ?
|
|
4686
|
+
return u.putBytes(K.util.hexToBytes(f)), r !== !1 ? dr(u.getBytes(), t, a) : u.getBytes();
|
|
4695
4687
|
};
|
|
4696
4688
|
q.rsa.createKeyPairGenerationState = function(e, t, a) {
|
|
4697
4689
|
typeof e == "string" && (e = parseInt(e, 10)), e = e || 2048, a = a || {};
|
|
@@ -4709,7 +4701,7 @@ q.rsa.createKeyPairGenerationState = function(e, t, a) {
|
|
|
4709
4701
|
bits: e,
|
|
4710
4702
|
rng: i,
|
|
4711
4703
|
eInt: t || 65537,
|
|
4712
|
-
e: new
|
|
4704
|
+
e: new J(null),
|
|
4713
4705
|
p: null,
|
|
4714
4706
|
q: null,
|
|
4715
4707
|
qBits: e >> 1,
|
|
@@ -4724,26 +4716,26 @@ q.rsa.createKeyPairGenerationState = function(e, t, a) {
|
|
|
4724
4716
|
};
|
|
4725
4717
|
q.rsa.stepKeyPairGenerationState = function(e, t) {
|
|
4726
4718
|
"algorithm" in e || (e.algorithm = "PRIMEINC");
|
|
4727
|
-
var a = new
|
|
4719
|
+
var a = new J(null);
|
|
4728
4720
|
a.fromInt(30);
|
|
4729
4721
|
for (var r = 0, i = function(c, v) {
|
|
4730
4722
|
return c | v;
|
|
4731
4723
|
}, s = +/* @__PURE__ */ new Date(), n, o = 0; e.keys === null && (t <= 0 || o < t); ) {
|
|
4732
4724
|
if (e.state === 0) {
|
|
4733
4725
|
var f = e.p === null ? e.pBits : e.qBits, u = f - 1;
|
|
4734
|
-
e.pqState === 0 ? (e.num = new
|
|
4735
|
-
|
|
4726
|
+
e.pqState === 0 ? (e.num = new J(f, e.rng), e.num.testBit(u) || e.num.bitwiseTo(
|
|
4727
|
+
J.ONE.shiftLeft(u),
|
|
4736
4728
|
i,
|
|
4737
4729
|
e.num
|
|
4738
4730
|
), e.num.dAddOffset(31 - e.num.mod(a).byteValue(), 0), r = 0, ++e.pqState) : e.pqState === 1 ? e.num.bitLength() > f ? e.pqState = 0 : e.num.isProbablePrime(
|
|
4739
|
-
|
|
4740
|
-
) ? ++e.pqState : e.num.dAddOffset(
|
|
4731
|
+
l0(e.num.bitLength())
|
|
4732
|
+
) ? ++e.pqState : e.num.dAddOffset(r0[r++ % 8], 0) : e.pqState === 2 ? e.pqState = e.num.subtract(J.ONE).gcd(e.e).compareTo(J.ONE) === 0 ? 3 : 0 : e.pqState === 3 && (e.pqState = 0, e.p === null ? e.p = e.num : e.q = e.num, e.p !== null && e.q !== null && ++e.state, e.num = null);
|
|
4741
4733
|
} else if (e.state === 1)
|
|
4742
4734
|
e.p.compareTo(e.q) < 0 && (e.num = e.p, e.p = e.q, e.q = e.num), ++e.state;
|
|
4743
4735
|
else if (e.state === 2)
|
|
4744
|
-
e.p1 = e.p.subtract(
|
|
4736
|
+
e.p1 = e.p.subtract(J.ONE), e.q1 = e.q.subtract(J.ONE), e.phi = e.p1.multiply(e.q1), ++e.state;
|
|
4745
4737
|
else if (e.state === 3)
|
|
4746
|
-
e.phi.gcd(e.e).compareTo(
|
|
4738
|
+
e.phi.gcd(e.e).compareTo(J.ONE) === 0 ? ++e.state : (e.p = null, e.q = null, e.state = 0);
|
|
4747
4739
|
else if (e.state === 4)
|
|
4748
4740
|
e.n = e.p.multiply(e.q), e.n.bitLength() === e.bits ? ++e.state : (e.q = null, e.state = 0);
|
|
4749
4741
|
else if (e.state === 5) {
|
|
@@ -4805,7 +4797,7 @@ q.rsa.generateKeyPair = function(e, t, a, r) {
|
|
|
4805
4797
|
}).then(function(o) {
|
|
4806
4798
|
if (o) {
|
|
4807
4799
|
var f = q.privateKeyFromAsn1(
|
|
4808
|
-
|
|
4800
|
+
S.fromDer(K.util.createBuffer(o))
|
|
4809
4801
|
);
|
|
4810
4802
|
r(null, {
|
|
4811
4803
|
privateKey: f,
|
|
@@ -4827,7 +4819,7 @@ q.rsa.generateKeyPair = function(e, t, a, r) {
|
|
|
4827
4819
|
);
|
|
4828
4820
|
u.oncomplete = function(l) {
|
|
4829
4821
|
var c = l.target.result, v = q.privateKeyFromAsn1(
|
|
4830
|
-
|
|
4822
|
+
S.fromDer(K.util.createBuffer(c))
|
|
4831
4823
|
);
|
|
4832
4824
|
r(null, {
|
|
4833
4825
|
privateKey: v,
|
|
@@ -4863,7 +4855,7 @@ q.rsa.generateKeyPair = function(e, t, a, r) {
|
|
|
4863
4855
|
var n = q.rsa.createKeyPairGenerationState(e, t, a);
|
|
4864
4856
|
if (!r)
|
|
4865
4857
|
return q.rsa.stepKeyPairGenerationState(n, 0), n.keys;
|
|
4866
|
-
|
|
4858
|
+
f0(n, a, r);
|
|
4867
4859
|
};
|
|
4868
4860
|
q.setRsaPublicKey = q.rsa.setPublicKey = function(e, t) {
|
|
4869
4861
|
var a = {
|
|
@@ -4893,21 +4885,20 @@ q.setRsaPublicKey = q.rsa.setPublicKey = function(e, t) {
|
|
|
4893
4885
|
return q.rsa.encrypt(n, a, !0);
|
|
4894
4886
|
}, a.verify = function(r, i, s, n) {
|
|
4895
4887
|
typeof s == "string" ? s = s.toUpperCase() : s === void 0 && (s = "RSASSA-PKCS1-V1_5"), n === void 0 && (n = {
|
|
4896
|
-
_parseAllDigestBytes: !0
|
|
4897
|
-
|
|
4898
|
-
}), "_parseAllDigestBytes" in n || (n._parseAllDigestBytes = !0), "_skipPaddingChecks" in n || (n._skipPaddingChecks = !1), s === "RSASSA-PKCS1-V1_5" ? s = {
|
|
4888
|
+
_parseAllDigestBytes: !0
|
|
4889
|
+
}), "_parseAllDigestBytes" in n || (n._parseAllDigestBytes = !0), s === "RSASSA-PKCS1-V1_5" ? s = {
|
|
4899
4890
|
verify: function(f, u) {
|
|
4900
|
-
u =
|
|
4901
|
-
var l =
|
|
4891
|
+
u = dr(u, a, !0);
|
|
4892
|
+
var l = S.fromDer(u, {
|
|
4902
4893
|
parseAllBytes: n._parseAllDigestBytes
|
|
4903
4894
|
}), c = {}, v = [];
|
|
4904
|
-
if (!
|
|
4895
|
+
if (!S.validate(l, o0, c, v)) {
|
|
4905
4896
|
var C = new Error(
|
|
4906
4897
|
"ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value."
|
|
4907
4898
|
);
|
|
4908
4899
|
throw C.errors = v, C;
|
|
4909
4900
|
}
|
|
4910
|
-
var y =
|
|
4901
|
+
var y = S.derToOid(c.algorithmIdentifier);
|
|
4911
4902
|
if (!(y === K.oids.md2 || y === K.oids.md5 || y === K.oids.sha1 || y === K.oids.sha224 || y === K.oids.sha256 || y === K.oids.sha384 || y === K.oids.sha512 || y === K.oids["sha512-224"] || y === K.oids["sha512-256"])) {
|
|
4912
4903
|
var C = new Error(
|
|
4913
4904
|
"Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier."
|
|
@@ -4922,7 +4913,7 @@ q.setRsaPublicKey = q.rsa.setPublicKey = function(e, t) {
|
|
|
4922
4913
|
}
|
|
4923
4914
|
} : (s === "NONE" || s === "NULL" || s === null) && (s = {
|
|
4924
4915
|
verify: function(f, u) {
|
|
4925
|
-
return u =
|
|
4916
|
+
return u = dr(u, a, !0), f === u;
|
|
4926
4917
|
}
|
|
4927
4918
|
});
|
|
4928
4919
|
var o = q.rsa.decrypt(i, a, !0, !1);
|
|
@@ -4944,7 +4935,7 @@ q.setRsaPrivateKey = q.rsa.setPrivateKey = function(e, t, a, r, i, s, n, o) {
|
|
|
4944
4935
|
typeof l == "string" ? l = l.toUpperCase() : l === void 0 && (l = "RSAES-PKCS1-V1_5");
|
|
4945
4936
|
var v = q.rsa.decrypt(u, f, !1, !1);
|
|
4946
4937
|
if (l === "RSAES-PKCS1-V1_5")
|
|
4947
|
-
l = { decode:
|
|
4938
|
+
l = { decode: dr };
|
|
4948
4939
|
else if (l === "RSA-OAEP" || l === "RSAES-OAEP")
|
|
4949
4940
|
l = {
|
|
4950
4941
|
decode: function(C, y) {
|
|
@@ -4960,7 +4951,7 @@ q.setRsaPrivateKey = q.rsa.setPrivateKey = function(e, t, a, r, i, s, n, o) {
|
|
|
4960
4951
|
return l.decode(v, f, !1);
|
|
4961
4952
|
}, f.sign = function(u, l) {
|
|
4962
4953
|
var c = !1;
|
|
4963
|
-
typeof l == "string" && (l = l.toUpperCase()), l === void 0 || l === "RSASSA-PKCS1-V1_5" ? (l = { encode:
|
|
4954
|
+
typeof l == "string" && (l = l.toUpperCase()), l === void 0 || l === "RSASSA-PKCS1-V1_5" ? (l = { encode: u0 }, c = 1) : (l === "NONE" || l === "NULL" || l === null) && (l = { encode: function() {
|
|
4964
4955
|
return u;
|
|
4965
4956
|
} }, c = 1);
|
|
4966
4957
|
var v = l.encode(u, f.n.bitLength());
|
|
@@ -4968,113 +4959,113 @@ q.setRsaPrivateKey = q.rsa.setPrivateKey = function(e, t, a, r, i, s, n, o) {
|
|
|
4968
4959
|
}, f;
|
|
4969
4960
|
};
|
|
4970
4961
|
q.wrapRsaPrivateKey = function(e) {
|
|
4971
|
-
return
|
|
4962
|
+
return S.create(S.Class.UNIVERSAL, S.Type.SEQUENCE, !0, [
|
|
4972
4963
|
// version (0)
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4964
|
+
S.create(
|
|
4965
|
+
S.Class.UNIVERSAL,
|
|
4966
|
+
S.Type.INTEGER,
|
|
4976
4967
|
!1,
|
|
4977
|
-
|
|
4968
|
+
S.integerToDer(0).getBytes()
|
|
4978
4969
|
),
|
|
4979
4970
|
// privateKeyAlgorithm
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4971
|
+
S.create(S.Class.UNIVERSAL, S.Type.SEQUENCE, !0, [
|
|
4972
|
+
S.create(
|
|
4973
|
+
S.Class.UNIVERSAL,
|
|
4974
|
+
S.Type.OID,
|
|
4984
4975
|
!1,
|
|
4985
|
-
|
|
4976
|
+
S.oidToDer(q.oids.rsaEncryption).getBytes()
|
|
4986
4977
|
),
|
|
4987
|
-
|
|
4978
|
+
S.create(S.Class.UNIVERSAL, S.Type.NULL, !1, "")
|
|
4988
4979
|
]),
|
|
4989
4980
|
// PrivateKey
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4981
|
+
S.create(
|
|
4982
|
+
S.Class.UNIVERSAL,
|
|
4983
|
+
S.Type.OCTETSTRING,
|
|
4993
4984
|
!1,
|
|
4994
|
-
|
|
4985
|
+
S.toDer(e).getBytes()
|
|
4995
4986
|
)
|
|
4996
4987
|
]);
|
|
4997
4988
|
};
|
|
4998
4989
|
q.privateKeyFromAsn1 = function(e) {
|
|
4999
4990
|
var t = {}, a = [];
|
|
5000
|
-
if (
|
|
4991
|
+
if (S.validate(e, a0, t, a) && (e = S.fromDer(K.util.createBuffer(t.privateKey))), t = {}, a = [], !S.validate(e, i0, t, a)) {
|
|
5001
4992
|
var r = new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");
|
|
5002
4993
|
throw r.errors = a, r;
|
|
5003
4994
|
}
|
|
5004
4995
|
var i, s, n, o, f, u, l, c;
|
|
5005
4996
|
return i = K.util.createBuffer(t.privateKeyModulus).toHex(), s = K.util.createBuffer(t.privateKeyPublicExponent).toHex(), n = K.util.createBuffer(t.privateKeyPrivateExponent).toHex(), o = K.util.createBuffer(t.privateKeyPrime1).toHex(), f = K.util.createBuffer(t.privateKeyPrime2).toHex(), u = K.util.createBuffer(t.privateKeyExponent1).toHex(), l = K.util.createBuffer(t.privateKeyExponent2).toHex(), c = K.util.createBuffer(t.privateKeyCoefficient).toHex(), q.setRsaPrivateKey(
|
|
5006
|
-
new
|
|
5007
|
-
new
|
|
5008
|
-
new
|
|
5009
|
-
new
|
|
5010
|
-
new
|
|
5011
|
-
new
|
|
5012
|
-
new
|
|
5013
|
-
new
|
|
4997
|
+
new J(i, 16),
|
|
4998
|
+
new J(s, 16),
|
|
4999
|
+
new J(n, 16),
|
|
5000
|
+
new J(o, 16),
|
|
5001
|
+
new J(f, 16),
|
|
5002
|
+
new J(u, 16),
|
|
5003
|
+
new J(l, 16),
|
|
5004
|
+
new J(c, 16)
|
|
5014
5005
|
);
|
|
5015
5006
|
};
|
|
5016
5007
|
q.privateKeyToAsn1 = q.privateKeyToRSAPrivateKey = function(e) {
|
|
5017
|
-
return
|
|
5008
|
+
return S.create(S.Class.UNIVERSAL, S.Type.SEQUENCE, !0, [
|
|
5018
5009
|
// version (0 = only 2 primes, 1 multiple primes)
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5010
|
+
S.create(
|
|
5011
|
+
S.Class.UNIVERSAL,
|
|
5012
|
+
S.Type.INTEGER,
|
|
5022
5013
|
!1,
|
|
5023
|
-
|
|
5014
|
+
S.integerToDer(0).getBytes()
|
|
5024
5015
|
),
|
|
5025
5016
|
// modulus (n)
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5017
|
+
S.create(
|
|
5018
|
+
S.Class.UNIVERSAL,
|
|
5019
|
+
S.Type.INTEGER,
|
|
5029
5020
|
!1,
|
|
5030
5021
|
rt(e.n)
|
|
5031
5022
|
),
|
|
5032
5023
|
// publicExponent (e)
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5024
|
+
S.create(
|
|
5025
|
+
S.Class.UNIVERSAL,
|
|
5026
|
+
S.Type.INTEGER,
|
|
5036
5027
|
!1,
|
|
5037
5028
|
rt(e.e)
|
|
5038
5029
|
),
|
|
5039
5030
|
// privateExponent (d)
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5031
|
+
S.create(
|
|
5032
|
+
S.Class.UNIVERSAL,
|
|
5033
|
+
S.Type.INTEGER,
|
|
5043
5034
|
!1,
|
|
5044
5035
|
rt(e.d)
|
|
5045
5036
|
),
|
|
5046
5037
|
// privateKeyPrime1 (p)
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5038
|
+
S.create(
|
|
5039
|
+
S.Class.UNIVERSAL,
|
|
5040
|
+
S.Type.INTEGER,
|
|
5050
5041
|
!1,
|
|
5051
5042
|
rt(e.p)
|
|
5052
5043
|
),
|
|
5053
5044
|
// privateKeyPrime2 (q)
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5045
|
+
S.create(
|
|
5046
|
+
S.Class.UNIVERSAL,
|
|
5047
|
+
S.Type.INTEGER,
|
|
5057
5048
|
!1,
|
|
5058
5049
|
rt(e.q)
|
|
5059
5050
|
),
|
|
5060
5051
|
// privateKeyExponent1 (dP)
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5052
|
+
S.create(
|
|
5053
|
+
S.Class.UNIVERSAL,
|
|
5054
|
+
S.Type.INTEGER,
|
|
5064
5055
|
!1,
|
|
5065
5056
|
rt(e.dP)
|
|
5066
5057
|
),
|
|
5067
5058
|
// privateKeyExponent2 (dQ)
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5059
|
+
S.create(
|
|
5060
|
+
S.Class.UNIVERSAL,
|
|
5061
|
+
S.Type.INTEGER,
|
|
5071
5062
|
!1,
|
|
5072
5063
|
rt(e.dQ)
|
|
5073
5064
|
),
|
|
5074
5065
|
// coefficient (qInv)
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5066
|
+
S.create(
|
|
5067
|
+
S.Class.UNIVERSAL,
|
|
5068
|
+
S.Type.INTEGER,
|
|
5078
5069
|
!1,
|
|
5079
5070
|
rt(e.qInv)
|
|
5080
5071
|
)
|
|
@@ -5082,57 +5073,57 @@ q.privateKeyToAsn1 = q.privateKeyToRSAPrivateKey = function(e) {
|
|
|
5082
5073
|
};
|
|
5083
5074
|
q.publicKeyFromAsn1 = function(e) {
|
|
5084
5075
|
var t = {}, a = [];
|
|
5085
|
-
if (
|
|
5086
|
-
var r =
|
|
5076
|
+
if (S.validate(e, s0, t, a)) {
|
|
5077
|
+
var r = S.derToOid(t.publicKeyOid);
|
|
5087
5078
|
if (r !== q.oids.rsaEncryption) {
|
|
5088
5079
|
var i = new Error("Cannot read public key. Unknown OID.");
|
|
5089
5080
|
throw i.oid = r, i;
|
|
5090
5081
|
}
|
|
5091
5082
|
e = t.rsaPublicKey;
|
|
5092
5083
|
}
|
|
5093
|
-
if (a = [], !
|
|
5084
|
+
if (a = [], !S.validate(e, n0, t, a)) {
|
|
5094
5085
|
var i = new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");
|
|
5095
5086
|
throw i.errors = a, i;
|
|
5096
5087
|
}
|
|
5097
5088
|
var s = K.util.createBuffer(t.publicKeyModulus).toHex(), n = K.util.createBuffer(t.publicKeyExponent).toHex();
|
|
5098
5089
|
return q.setRsaPublicKey(
|
|
5099
|
-
new
|
|
5100
|
-
new
|
|
5090
|
+
new J(s, 16),
|
|
5091
|
+
new J(n, 16)
|
|
5101
5092
|
);
|
|
5102
5093
|
};
|
|
5103
5094
|
q.publicKeyToAsn1 = q.publicKeyToSubjectPublicKeyInfo = function(e) {
|
|
5104
|
-
return
|
|
5095
|
+
return S.create(S.Class.UNIVERSAL, S.Type.SEQUENCE, !0, [
|
|
5105
5096
|
// AlgorithmIdentifier
|
|
5106
|
-
|
|
5097
|
+
S.create(S.Class.UNIVERSAL, S.Type.SEQUENCE, !0, [
|
|
5107
5098
|
// algorithm
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5099
|
+
S.create(
|
|
5100
|
+
S.Class.UNIVERSAL,
|
|
5101
|
+
S.Type.OID,
|
|
5111
5102
|
!1,
|
|
5112
|
-
|
|
5103
|
+
S.oidToDer(q.oids.rsaEncryption).getBytes()
|
|
5113
5104
|
),
|
|
5114
5105
|
// parameters (null)
|
|
5115
|
-
|
|
5106
|
+
S.create(S.Class.UNIVERSAL, S.Type.NULL, !1, "")
|
|
5116
5107
|
]),
|
|
5117
5108
|
// subjectPublicKey
|
|
5118
|
-
|
|
5109
|
+
S.create(S.Class.UNIVERSAL, S.Type.BITSTRING, !1, [
|
|
5119
5110
|
q.publicKeyToRSAPublicKey(e)
|
|
5120
5111
|
])
|
|
5121
5112
|
]);
|
|
5122
5113
|
};
|
|
5123
5114
|
q.publicKeyToRSAPublicKey = function(e) {
|
|
5124
|
-
return
|
|
5115
|
+
return S.create(S.Class.UNIVERSAL, S.Type.SEQUENCE, !0, [
|
|
5125
5116
|
// modulus (n)
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5117
|
+
S.create(
|
|
5118
|
+
S.Class.UNIVERSAL,
|
|
5119
|
+
S.Type.INTEGER,
|
|
5129
5120
|
!1,
|
|
5130
5121
|
rt(e.n)
|
|
5131
5122
|
),
|
|
5132
5123
|
// publicExponent (e)
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5124
|
+
S.create(
|
|
5125
|
+
S.Class.UNIVERSAL,
|
|
5126
|
+
S.Type.INTEGER,
|
|
5136
5127
|
!1,
|
|
5137
5128
|
rt(e.e)
|
|
5138
5129
|
)
|
|
@@ -5158,43 +5149,38 @@ function ci(e, t, a) {
|
|
|
5158
5149
|
}
|
|
5159
5150
|
return r.putByte(0), r.putBytes(e), r;
|
|
5160
5151
|
}
|
|
5161
|
-
function
|
|
5162
|
-
var
|
|
5163
|
-
if (
|
|
5152
|
+
function dr(e, t, a, r) {
|
|
5153
|
+
var i = Math.ceil(t.n.bitLength() / 8), s = K.util.createBuffer(e), n = s.getByte(), o = s.getByte();
|
|
5154
|
+
if (n !== 0 || a && o !== 0 && o !== 1 || !a && o != 2 || a && o === 0 && typeof r > "u")
|
|
5164
5155
|
throw new Error("Encryption block is invalid.");
|
|
5165
|
-
var
|
|
5166
|
-
if (
|
|
5167
|
-
|
|
5168
|
-
for (var
|
|
5169
|
-
if (
|
|
5156
|
+
var f = 0;
|
|
5157
|
+
if (o === 0) {
|
|
5158
|
+
f = i - 3 - r;
|
|
5159
|
+
for (var u = 0; u < f; ++u)
|
|
5160
|
+
if (s.getByte() !== 0)
|
|
5170
5161
|
throw new Error("Encryption block is invalid.");
|
|
5171
|
-
} else if (
|
|
5172
|
-
for (
|
|
5173
|
-
if (
|
|
5174
|
-
--
|
|
5162
|
+
} else if (o === 1)
|
|
5163
|
+
for (f = 0; s.length() > 1; ) {
|
|
5164
|
+
if (s.getByte() !== 255) {
|
|
5165
|
+
--s.read;
|
|
5175
5166
|
break;
|
|
5176
5167
|
}
|
|
5177
|
-
++
|
|
5168
|
+
++f;
|
|
5178
5169
|
}
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
if (n.getByte() === 0) {
|
|
5184
|
-
--n.read;
|
|
5170
|
+
else if (o === 2)
|
|
5171
|
+
for (f = 0; s.length() > 1; ) {
|
|
5172
|
+
if (s.getByte() === 0) {
|
|
5173
|
+
--s.read;
|
|
5185
5174
|
break;
|
|
5186
5175
|
}
|
|
5187
|
-
++
|
|
5176
|
+
++f;
|
|
5188
5177
|
}
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
}
|
|
5192
|
-
var c = n.getByte();
|
|
5193
|
-
if (c !== 0 || u !== s - 3 - n.length())
|
|
5178
|
+
var l = s.getByte();
|
|
5179
|
+
if (l !== 0 || f !== i - 3 - s.length())
|
|
5194
5180
|
throw new Error("Encryption block is invalid.");
|
|
5195
|
-
return
|
|
5181
|
+
return s.getBytes();
|
|
5196
5182
|
}
|
|
5197
|
-
function
|
|
5183
|
+
function f0(e, t, a) {
|
|
5198
5184
|
typeof t == "function" && (a = t, t = {}), t = t || {};
|
|
5199
5185
|
var r = {
|
|
5200
5186
|
algorithm: {
|
|
@@ -5226,15 +5212,15 @@ function l0(e, t, a) {
|
|
|
5226
5212
|
var u = e.p;
|
|
5227
5213
|
e.p = e.q, e.q = u;
|
|
5228
5214
|
}
|
|
5229
|
-
if (e.p.subtract(
|
|
5215
|
+
if (e.p.subtract(J.ONE).gcd(e.e).compareTo(J.ONE) !== 0) {
|
|
5230
5216
|
e.p = null, i();
|
|
5231
5217
|
return;
|
|
5232
5218
|
}
|
|
5233
|
-
if (e.q.subtract(
|
|
5219
|
+
if (e.q.subtract(J.ONE).gcd(e.e).compareTo(J.ONE) !== 0) {
|
|
5234
5220
|
e.q = null, s(e.qBits, n);
|
|
5235
5221
|
return;
|
|
5236
5222
|
}
|
|
5237
|
-
if (e.p1 = e.p.subtract(
|
|
5223
|
+
if (e.p1 = e.p.subtract(J.ONE), e.q1 = e.q.subtract(J.ONE), e.phi = e.p1.multiply(e.q1), e.phi.gcd(e.e).compareTo(J.ONE) !== 0) {
|
|
5238
5224
|
e.p = e.q = null, i();
|
|
5239
5225
|
return;
|
|
5240
5226
|
}
|
|
@@ -5266,7 +5252,7 @@ function rt(e) {
|
|
|
5266
5252
|
(a.charCodeAt(0) === 0 && !(a.charCodeAt(1) & 128) || // leading 0xFF for negative integer
|
|
5267
5253
|
a.charCodeAt(0) === 255 && (a.charCodeAt(1) & 128) === 128) ? a.substr(1) : a;
|
|
5268
5254
|
}
|
|
5269
|
-
function
|
|
5255
|
+
function l0(e) {
|
|
5270
5256
|
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;
|
|
5271
5257
|
}
|
|
5272
5258
|
function Ra(e) {
|
|
@@ -5284,11 +5270,11 @@ function Da(e) {
|
|
|
5284
5270
|
return a;
|
|
5285
5271
|
}
|
|
5286
5272
|
var O = z;
|
|
5287
|
-
if (typeof
|
|
5288
|
-
var
|
|
5273
|
+
if (typeof c0 > "u")
|
|
5274
|
+
var c0 = O.jsbn.BigInteger;
|
|
5289
5275
|
var A = O.asn1, Q = O.pki = O.pki || {};
|
|
5290
5276
|
Q.pbe = O.pbe = O.pbe || {};
|
|
5291
|
-
var At = Q.oids,
|
|
5277
|
+
var At = Q.oids, h0 = {
|
|
5292
5278
|
name: "EncryptedPrivateKeyInfo",
|
|
5293
5279
|
tagClass: A.Class.UNIVERSAL,
|
|
5294
5280
|
type: A.Type.SEQUENCE,
|
|
@@ -5319,7 +5305,7 @@ var At = Q.oids, d0 = {
|
|
|
5319
5305
|
constructed: !1,
|
|
5320
5306
|
capture: "encryptedData"
|
|
5321
5307
|
}]
|
|
5322
|
-
},
|
|
5308
|
+
}, d0 = {
|
|
5323
5309
|
name: "PBES2Algorithms",
|
|
5324
5310
|
tagClass: A.Class.UNIVERSAL,
|
|
5325
5311
|
type: A.Type.SEQUENCE,
|
|
@@ -5394,7 +5380,7 @@ var At = Q.oids, d0 = {
|
|
|
5394
5380
|
capture: "encIv"
|
|
5395
5381
|
}]
|
|
5396
5382
|
}]
|
|
5397
|
-
},
|
|
5383
|
+
}, p0 = {
|
|
5398
5384
|
name: "pkcs-12PbeParams",
|
|
5399
5385
|
tagClass: A.Class.UNIVERSAL,
|
|
5400
5386
|
type: A.Type.SEQUENCE,
|
|
@@ -5435,9 +5421,9 @@ Q.encryptPrivateKeyInfo = function(e, t, a) {
|
|
|
5435
5421
|
var v = new Error("Cannot encrypt private key. Unknown encryption algorithm.");
|
|
5436
5422
|
throw v.algorithm = a.algorithm, v;
|
|
5437
5423
|
}
|
|
5438
|
-
var C = "hmacWith" + a.prfAlgorithm.toUpperCase(), y = di(C), x = O.pkcs5.pbkdf2(t, r, i, n, y),
|
|
5439
|
-
I.start(
|
|
5440
|
-
var
|
|
5424
|
+
var C = "hmacWith" + a.prfAlgorithm.toUpperCase(), y = di(C), x = O.pkcs5.pbkdf2(t, r, i, n, y), T = O.random.getBytesSync(u), I = c(x);
|
|
5425
|
+
I.start(T), I.update(A.toDer(e)), I.finish(), f = I.output.getBytes();
|
|
5426
|
+
var B = v0(r, s, n, C);
|
|
5441
5427
|
o = A.create(
|
|
5442
5428
|
A.Class.UNIVERSAL,
|
|
5443
5429
|
A.Type.SEQUENCE,
|
|
@@ -5459,7 +5445,7 @@ Q.encryptPrivateKeyInfo = function(e, t, a) {
|
|
|
5459
5445
|
A.oidToDer(At.pkcs5PBKDF2).getBytes()
|
|
5460
5446
|
),
|
|
5461
5447
|
// PBKDF2-params
|
|
5462
|
-
|
|
5448
|
+
B
|
|
5463
5449
|
]),
|
|
5464
5450
|
// encryptionScheme
|
|
5465
5451
|
A.create(A.Class.UNIVERSAL, A.Type.SEQUENCE, !0, [
|
|
@@ -5474,7 +5460,7 @@ Q.encryptPrivateKeyInfo = function(e, t, a) {
|
|
|
5474
5460
|
A.Class.UNIVERSAL,
|
|
5475
5461
|
A.Type.OCTETSTRING,
|
|
5476
5462
|
!1,
|
|
5477
|
-
|
|
5463
|
+
T
|
|
5478
5464
|
)
|
|
5479
5465
|
])
|
|
5480
5466
|
])
|
|
@@ -5482,8 +5468,8 @@ Q.encryptPrivateKeyInfo = function(e, t, a) {
|
|
|
5482
5468
|
);
|
|
5483
5469
|
} else if (a.algorithm === "3des") {
|
|
5484
5470
|
n = 24;
|
|
5485
|
-
var
|
|
5486
|
-
I.start(
|
|
5471
|
+
var b = new O.util.ByteBuffer(r), x = Q.pbe.generatePkcs12Key(t, b, 1, i, n), T = Q.pbe.generatePkcs12Key(t, b, 2, i, n), I = O.des.createEncryptionCipher(x);
|
|
5472
|
+
I.start(T), I.update(A.toDer(e)), I.finish(), f = I.output.getBytes(), o = A.create(
|
|
5487
5473
|
A.Class.UNIVERSAL,
|
|
5488
5474
|
A.Type.SEQUENCE,
|
|
5489
5475
|
!0,
|
|
@@ -5527,7 +5513,7 @@ Q.encryptPrivateKeyInfo = function(e, t, a) {
|
|
|
5527
5513
|
};
|
|
5528
5514
|
Q.decryptPrivateKeyInfo = function(e, t) {
|
|
5529
5515
|
var a = null, r = {}, i = [];
|
|
5530
|
-
if (!A.validate(e,
|
|
5516
|
+
if (!A.validate(e, h0, r, i)) {
|
|
5531
5517
|
var s = new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");
|
|
5532
5518
|
throw s.errors = i, s;
|
|
5533
5519
|
}
|
|
@@ -5660,17 +5646,17 @@ Q.pbe.generatePkcs12Key = function(e, t, a, r, i, s) {
|
|
|
5660
5646
|
}
|
|
5661
5647
|
var v = c.length(), C = t.length(), y = new O.util.ByteBuffer();
|
|
5662
5648
|
y.fillWithByte(a, u);
|
|
5663
|
-
var x = u * Math.ceil(C / u),
|
|
5649
|
+
var x = u * Math.ceil(C / u), T = new O.util.ByteBuffer();
|
|
5664
5650
|
for (o = 0; o < x; o++)
|
|
5665
|
-
|
|
5666
|
-
var I = u * Math.ceil(v / u),
|
|
5651
|
+
T.putByte(t.at(o % C));
|
|
5652
|
+
var I = u * Math.ceil(v / u), B = new O.util.ByteBuffer();
|
|
5667
5653
|
for (o = 0; o < I; o++)
|
|
5668
|
-
|
|
5669
|
-
var
|
|
5670
|
-
|
|
5654
|
+
B.putByte(c.at(o % v));
|
|
5655
|
+
var b = T;
|
|
5656
|
+
b.putBuffer(B);
|
|
5671
5657
|
for (var V = Math.ceil(i / f), D = 1; D <= V; D++) {
|
|
5672
5658
|
var w = new O.util.ByteBuffer();
|
|
5673
|
-
w.putBytes(y.bytes()), w.putBytes(
|
|
5659
|
+
w.putBytes(y.bytes()), w.putBytes(b.bytes());
|
|
5674
5660
|
for (var G = 0; G < r; G++)
|
|
5675
5661
|
s.start(), s.update(w.getBytes()), w = s.digest();
|
|
5676
5662
|
var Y = new O.util.ByteBuffer();
|
|
@@ -5678,12 +5664,12 @@ Q.pbe.generatePkcs12Key = function(e, t, a, r, i, s) {
|
|
|
5678
5664
|
Y.putByte(w.at(o % f));
|
|
5679
5665
|
var re = Math.ceil(C / u) + Math.ceil(v / u), ae = new O.util.ByteBuffer();
|
|
5680
5666
|
for (n = 0; n < re; n++) {
|
|
5681
|
-
var ie = new O.util.ByteBuffer(
|
|
5667
|
+
var ie = new O.util.ByteBuffer(b.getBytes(u)), he = 511;
|
|
5682
5668
|
for (o = Y.length() - 1; o >= 0; o--)
|
|
5683
5669
|
he = he >> 8, he += Y.at(o) + ie.at(o), ie.setAt(o, he & 255);
|
|
5684
5670
|
ae.putBuffer(ie);
|
|
5685
5671
|
}
|
|
5686
|
-
|
|
5672
|
+
b = ae, l.putBuffer(w);
|
|
5687
5673
|
}
|
|
5688
5674
|
return l.truncate(l.length() - i), l;
|
|
5689
5675
|
};
|
|
@@ -5705,7 +5691,7 @@ Q.pbe.getCipher = function(e, t, a) {
|
|
|
5705
5691
|
};
|
|
5706
5692
|
Q.pbe.getCipherForPBES2 = function(e, t, a) {
|
|
5707
5693
|
var r = {}, i = [];
|
|
5708
|
-
if (!A.validate(t,
|
|
5694
|
+
if (!A.validate(t, d0, r, i)) {
|
|
5709
5695
|
var s = new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");
|
|
5710
5696
|
throw s.errors = i, s;
|
|
5711
5697
|
}
|
|
@@ -5748,7 +5734,7 @@ Q.pbe.getCipherForPBES2 = function(e, t, a) {
|
|
|
5748
5734
|
};
|
|
5749
5735
|
Q.pbe.getCipherForPKCS12PBE = function(e, t, a) {
|
|
5750
5736
|
var r = {}, i = [];
|
|
5751
|
-
if (!A.validate(t,
|
|
5737
|
+
if (!A.validate(t, p0, r, i)) {
|
|
5752
5738
|
var s = new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");
|
|
5753
5739
|
throw s.errors = i, s;
|
|
5754
5740
|
}
|
|
@@ -5760,9 +5746,9 @@ Q.pbe.getCipherForPKCS12PBE = function(e, t, a) {
|
|
|
5760
5746
|
f = 24, u = 8, l = O.des.startDecrypting;
|
|
5761
5747
|
break;
|
|
5762
5748
|
case Q.oids["pbewithSHAAnd40BitRC2-CBC"]:
|
|
5763
|
-
f = 5, u = 8, l = function(x,
|
|
5749
|
+
f = 5, u = 8, l = function(x, T) {
|
|
5764
5750
|
var I = O.rc2.createDecryptionCipher(x, 40);
|
|
5765
|
-
return I.start(
|
|
5751
|
+
return I.start(T, null), I;
|
|
5766
5752
|
};
|
|
5767
5753
|
break;
|
|
5768
5754
|
default:
|
|
@@ -5829,7 +5815,7 @@ function di(e) {
|
|
|
5829
5815
|
throw new Error("Unknown hash algorithm: " + e);
|
|
5830
5816
|
return t[e].create();
|
|
5831
5817
|
}
|
|
5832
|
-
function
|
|
5818
|
+
function v0(e, t, a, r) {
|
|
5833
5819
|
var i = A.create(A.Class.UNIVERSAL, A.Type.SEQUENCE, !0, [
|
|
5834
5820
|
// salt
|
|
5835
5821
|
A.create(
|
|
@@ -5985,7 +5971,7 @@ Qt.encryptedDataValidator = {
|
|
|
5985
5971
|
capture: "version"
|
|
5986
5972
|
}].concat(vi)
|
|
5987
5973
|
};
|
|
5988
|
-
var
|
|
5974
|
+
var y0 = {
|
|
5989
5975
|
name: "SignerInfo",
|
|
5990
5976
|
tagClass: P.Class.UNIVERSAL,
|
|
5991
5977
|
type: P.Type.SEQUENCE,
|
|
@@ -6100,7 +6086,7 @@ Qt.signedDataValidator = {
|
|
|
6100
6086
|
type: P.Type.SET,
|
|
6101
6087
|
capture: "signerInfos",
|
|
6102
6088
|
optional: !0,
|
|
6103
|
-
value: [
|
|
6089
|
+
value: [y0]
|
|
6104
6090
|
}
|
|
6105
6091
|
]
|
|
6106
6092
|
};
|
|
@@ -6161,8 +6147,8 @@ Qt.recipientInfoValidator = {
|
|
|
6161
6147
|
};
|
|
6162
6148
|
var Rt = z;
|
|
6163
6149
|
Rt.mgf = Rt.mgf || {};
|
|
6164
|
-
var
|
|
6165
|
-
|
|
6150
|
+
var g0 = Rt.mgf.mgf1 = Rt.mgf1 = Rt.mgf1 || {};
|
|
6151
|
+
g0.create = function(e) {
|
|
6166
6152
|
var t = {
|
|
6167
6153
|
/**
|
|
6168
6154
|
* Generate mask of specified length.
|
|
@@ -6181,11 +6167,11 @@ C0.create = function(e) {
|
|
|
6181
6167
|
};
|
|
6182
6168
|
return t;
|
|
6183
6169
|
};
|
|
6184
|
-
var
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
var Bt = z,
|
|
6188
|
-
|
|
6170
|
+
var pr = z;
|
|
6171
|
+
pr.mgf = pr.mgf || {};
|
|
6172
|
+
pr.mgf.mgf1 = pr.mgf1;
|
|
6173
|
+
var Bt = z, C0 = Bt.pss = Bt.pss || {};
|
|
6174
|
+
C0.create = function(e) {
|
|
6189
6175
|
arguments.length === 3 && (e = {
|
|
6190
6176
|
md: arguments[0],
|
|
6191
6177
|
mgf: arguments[1],
|
|
@@ -6211,36 +6197,36 @@ m0.create = function(e) {
|
|
|
6211
6197
|
i === null ? y = n.getBytesSync(s) : y = i.bytes();
|
|
6212
6198
|
var x = new Bt.util.ByteBuffer();
|
|
6213
6199
|
x.fillWithByte(0, 8), x.putBytes(C), x.putBytes(y), t.start(), t.update(x.getBytes());
|
|
6214
|
-
var
|
|
6200
|
+
var T = t.digest().getBytes(), I = new Bt.util.ByteBuffer();
|
|
6215
6201
|
I.fillWithByte(0, v - s - r - 2), I.putByte(1), I.putBytes(y);
|
|
6216
|
-
var
|
|
6217
|
-
for (l = 0; l <
|
|
6218
|
-
D += String.fromCharCode(
|
|
6202
|
+
var B = I.getBytes(), b = v - r - 1, V = a.generate(T, b), D = "";
|
|
6203
|
+
for (l = 0; l < b; l++)
|
|
6204
|
+
D += String.fromCharCode(B.charCodeAt(l) ^ V.charCodeAt(l));
|
|
6219
6205
|
var w = 65280 >> 8 * v - c & 255;
|
|
6220
|
-
return D = String.fromCharCode(D.charCodeAt(0) & ~w) + D.substr(1), D +
|
|
6206
|
+
return D = String.fromCharCode(D.charCodeAt(0) & ~w) + D.substr(1), D + T + String.fromCharCode(188);
|
|
6221
6207
|
}, o.verify = function(f, u, l) {
|
|
6222
6208
|
var c, v = l - 1, C = Math.ceil(v / 8);
|
|
6223
6209
|
if (u = u.substr(-C), C < r + s + 2)
|
|
6224
6210
|
throw new Error("Inconsistent parameters to PSS signature verification.");
|
|
6225
6211
|
if (u.charCodeAt(C - 1) !== 188)
|
|
6226
6212
|
throw new Error("Encoded message does not end in 0xBC.");
|
|
6227
|
-
var y = C - r - 1, x = u.substr(0, y),
|
|
6213
|
+
var y = C - r - 1, x = u.substr(0, y), T = u.substr(y, r), I = 65280 >> 8 * C - v & 255;
|
|
6228
6214
|
if (x.charCodeAt(0) & I)
|
|
6229
6215
|
throw new Error("Bits beyond keysize not zero as expected.");
|
|
6230
|
-
var
|
|
6216
|
+
var B = a.generate(T, y), b = "";
|
|
6231
6217
|
for (c = 0; c < y; c++)
|
|
6232
|
-
|
|
6233
|
-
|
|
6218
|
+
b += String.fromCharCode(x.charCodeAt(c) ^ B.charCodeAt(c));
|
|
6219
|
+
b = String.fromCharCode(b.charCodeAt(0) & ~I) + b.substr(1);
|
|
6234
6220
|
var V = C - r - s - 2;
|
|
6235
6221
|
for (c = 0; c < V; c++)
|
|
6236
|
-
if (
|
|
6222
|
+
if (b.charCodeAt(c) !== 0)
|
|
6237
6223
|
throw new Error("Leftmost octets not zero as expected");
|
|
6238
|
-
if (
|
|
6224
|
+
if (b.charCodeAt(V) !== 1)
|
|
6239
6225
|
throw new Error("Inconsistent PSS signature, 0x01 marker not found");
|
|
6240
|
-
var D =
|
|
6226
|
+
var D = b.substr(-s), w = new Bt.util.ByteBuffer();
|
|
6241
6227
|
w.fillWithByte(0, 8), w.putBytes(f), w.putBytes(D), t.start(), t.update(w.getBytes());
|
|
6242
6228
|
var G = t.digest().getBytes();
|
|
6243
|
-
return
|
|
6229
|
+
return T === G;
|
|
6244
6230
|
}, o;
|
|
6245
6231
|
};
|
|
6246
6232
|
var M = z, h = M.asn1, L = M.pki = M.pki || {}, Z = L.oids, de = {};
|
|
@@ -6258,7 +6244,7 @@ de.OU = Z.organizationalUnitName;
|
|
|
6258
6244
|
de.organizationalUnitName = "OU";
|
|
6259
6245
|
de.E = Z.emailAddress;
|
|
6260
6246
|
de.emailAddress = "E";
|
|
6261
|
-
var yi = M.pki.rsa.publicKeyValidator,
|
|
6247
|
+
var yi = M.pki.rsa.publicKeyValidator, m0 = {
|
|
6262
6248
|
name: "Certificate",
|
|
6263
6249
|
tagClass: h.Class.UNIVERSAL,
|
|
6264
6250
|
type: h.Type.SEQUENCE,
|
|
@@ -6438,7 +6424,7 @@ var yi = M.pki.rsa.publicKeyValidator, E0 = {
|
|
|
6438
6424
|
constructed: !1,
|
|
6439
6425
|
captureBitStringValue: "certSignature"
|
|
6440
6426
|
}]
|
|
6441
|
-
},
|
|
6427
|
+
}, E0 = {
|
|
6442
6428
|
name: "rsapss",
|
|
6443
6429
|
tagClass: h.Class.UNIVERSAL,
|
|
6444
6430
|
type: h.Type.SEQUENCE,
|
|
@@ -6520,7 +6506,7 @@ var yi = M.pki.rsa.publicKeyValidator, E0 = {
|
|
|
6520
6506
|
capture: "trailer"
|
|
6521
6507
|
}]
|
|
6522
6508
|
}]
|
|
6523
|
-
},
|
|
6509
|
+
}, x0 = {
|
|
6524
6510
|
name: "CertificationRequestInfo",
|
|
6525
6511
|
tagClass: h.Class.UNIVERSAL,
|
|
6526
6512
|
type: h.Type.SEQUENCE,
|
|
@@ -6570,14 +6556,14 @@ var yi = M.pki.rsa.publicKeyValidator, E0 = {
|
|
|
6570
6556
|
}]
|
|
6571
6557
|
}
|
|
6572
6558
|
]
|
|
6573
|
-
},
|
|
6559
|
+
}, S0 = {
|
|
6574
6560
|
name: "CertificationRequest",
|
|
6575
6561
|
tagClass: h.Class.UNIVERSAL,
|
|
6576
6562
|
type: h.Type.SEQUENCE,
|
|
6577
6563
|
constructed: !0,
|
|
6578
6564
|
captureAsn1: "csr",
|
|
6579
6565
|
value: [
|
|
6580
|
-
|
|
6566
|
+
x0,
|
|
6581
6567
|
{
|
|
6582
6568
|
// AlgorithmIdentifier (signature algorithm)
|
|
6583
6569
|
name: "CertificationRequest.signatureAlgorithm",
|
|
@@ -6635,7 +6621,7 @@ function St(e, t) {
|
|
|
6635
6621
|
r = e.attributes[i], (t.type && t.type === r.type || t.name && t.name === r.name || t.shortName && t.shortName === r.shortName) && (a = r);
|
|
6636
6622
|
return a;
|
|
6637
6623
|
}
|
|
6638
|
-
var
|
|
6624
|
+
var vr = function(e, t, a) {
|
|
6639
6625
|
var r = {};
|
|
6640
6626
|
if (e !== Z["RSASSA-PSS"])
|
|
6641
6627
|
return r;
|
|
@@ -6652,12 +6638,12 @@ var yr = function(e, t, a) {
|
|
|
6652
6638
|
saltLength: 20
|
|
6653
6639
|
});
|
|
6654
6640
|
var i = {}, s = [];
|
|
6655
|
-
if (!h.validate(t,
|
|
6641
|
+
if (!h.validate(t, E0, i, s)) {
|
|
6656
6642
|
var n = new Error("Cannot read RSASSA-PSS parameter block.");
|
|
6657
6643
|
throw n.errors = s, n;
|
|
6658
6644
|
}
|
|
6659
6645
|
return i.hashOid !== void 0 && (r.hash = r.hash || {}, r.hash.algorithmOid = h.derToOid(i.hashOid)), i.maskGenOid !== void 0 && (r.mgf = r.mgf || {}, r.mgf.algorithmOid = h.derToOid(i.maskGenOid), r.mgf.hash = r.mgf.hash || {}, r.mgf.hash.algorithmOid = h.derToOid(i.maskGenHashOid)), i.saltLength !== void 0 && (r.saltLength = i.saltLength.charCodeAt(0)), r;
|
|
6660
|
-
},
|
|
6646
|
+
}, br = function(e) {
|
|
6661
6647
|
switch (Z[e.signatureOid]) {
|
|
6662
6648
|
case "sha1WithRSAEncryption":
|
|
6663
6649
|
case "sha1WithRSASignature":
|
|
@@ -6845,7 +6831,7 @@ L.createCertificate = function() {
|
|
|
6845
6831
|
}
|
|
6846
6832
|
var n = t.md;
|
|
6847
6833
|
if (n === null) {
|
|
6848
|
-
n =
|
|
6834
|
+
n = br({
|
|
6849
6835
|
signatureOid: t.signatureOid,
|
|
6850
6836
|
type: "certificate"
|
|
6851
6837
|
});
|
|
@@ -6884,7 +6870,7 @@ L.createCertificate = function() {
|
|
|
6884
6870
|
};
|
|
6885
6871
|
L.certificateFromAsn1 = function(e, t) {
|
|
6886
6872
|
var a = {}, r = [];
|
|
6887
|
-
if (!h.validate(e,
|
|
6873
|
+
if (!h.validate(e, m0, a, r)) {
|
|
6888
6874
|
var i = new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");
|
|
6889
6875
|
throw i.errors = r, i;
|
|
6890
6876
|
}
|
|
@@ -6894,11 +6880,11 @@ L.certificateFromAsn1 = function(e, t) {
|
|
|
6894
6880
|
var n = L.createCertificate();
|
|
6895
6881
|
n.version = a.certVersion ? a.certVersion.charCodeAt(0) : 0;
|
|
6896
6882
|
var o = M.util.createBuffer(a.certSerialNumber);
|
|
6897
|
-
n.serialNumber = o.toHex(), n.signatureOid = M.asn1.derToOid(a.certSignatureOid), n.signatureParameters =
|
|
6883
|
+
n.serialNumber = o.toHex(), n.signatureOid = M.asn1.derToOid(a.certSignatureOid), n.signatureParameters = vr(
|
|
6898
6884
|
n.signatureOid,
|
|
6899
6885
|
a.certSignatureParams,
|
|
6900
6886
|
!0
|
|
6901
|
-
), n.siginfo.algorithmOid = M.asn1.derToOid(a.certinfoSignatureOid), n.siginfo.parameters =
|
|
6887
|
+
), n.siginfo.algorithmOid = M.asn1.derToOid(a.certinfoSignatureOid), n.siginfo.parameters = vr(
|
|
6902
6888
|
n.siginfo.algorithmOid,
|
|
6903
6889
|
a.certinfoSignatureParams,
|
|
6904
6890
|
!1
|
|
@@ -6913,7 +6899,7 @@ L.certificateFromAsn1 = function(e, t) {
|
|
|
6913
6899
|
if (f.length < 2)
|
|
6914
6900
|
throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
|
|
6915
6901
|
if (n.validity.notBefore = f[0], n.validity.notAfter = f[1], n.tbsCertificate = a.tbsCertificate, t) {
|
|
6916
|
-
n.md =
|
|
6902
|
+
n.md = br({
|
|
6917
6903
|
signatureOid: n.signatureOid,
|
|
6918
6904
|
type: "certificate"
|
|
6919
6905
|
});
|
|
@@ -6988,7 +6974,7 @@ L.certificateExtensionFromAsn1 = function(e) {
|
|
|
6988
6974
|
};
|
|
6989
6975
|
L.certificationRequestFromAsn1 = function(e, t) {
|
|
6990
6976
|
var a = {}, r = [];
|
|
6991
|
-
if (!h.validate(e,
|
|
6977
|
+
if (!h.validate(e, S0, a, r)) {
|
|
6992
6978
|
var i = new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");
|
|
6993
6979
|
throw i.errors = r, i;
|
|
6994
6980
|
}
|
|
@@ -6996,16 +6982,16 @@ L.certificationRequestFromAsn1 = function(e, t) {
|
|
|
6996
6982
|
if (s !== L.oids.rsaEncryption)
|
|
6997
6983
|
throw new Error("Cannot read public key. OID is not RSA.");
|
|
6998
6984
|
var n = L.createCertificationRequest();
|
|
6999
|
-
if (n.version = a.csrVersion ? a.csrVersion.charCodeAt(0) : 0, n.signatureOid = M.asn1.derToOid(a.csrSignatureOid), n.signatureParameters =
|
|
6985
|
+
if (n.version = a.csrVersion ? a.csrVersion.charCodeAt(0) : 0, n.signatureOid = M.asn1.derToOid(a.csrSignatureOid), n.signatureParameters = vr(
|
|
7000
6986
|
n.signatureOid,
|
|
7001
6987
|
a.csrSignatureParams,
|
|
7002
6988
|
!0
|
|
7003
|
-
), n.siginfo.algorithmOid = M.asn1.derToOid(a.csrSignatureOid), n.siginfo.parameters =
|
|
6989
|
+
), n.siginfo.algorithmOid = M.asn1.derToOid(a.csrSignatureOid), n.siginfo.parameters = vr(
|
|
7004
6990
|
n.siginfo.algorithmOid,
|
|
7005
6991
|
a.csrSignatureParams,
|
|
7006
6992
|
!1
|
|
7007
6993
|
), n.signature = a.csrSignature, n.certificationRequestInfo = a.certificationRequestInfo, t) {
|
|
7008
|
-
n.md =
|
|
6994
|
+
n.md = br({
|
|
7009
6995
|
signatureOid: n.signatureOid,
|
|
7010
6996
|
type: "certification request"
|
|
7011
6997
|
});
|
|
@@ -7055,7 +7041,7 @@ L.createCertificationRequest = function() {
|
|
|
7055
7041
|
}, e.verify = function() {
|
|
7056
7042
|
var t = !1, a = e.md;
|
|
7057
7043
|
if (a === null) {
|
|
7058
|
-
a =
|
|
7044
|
+
a = br({
|
|
7059
7045
|
signatureOid: e.signatureOid,
|
|
7060
7046
|
type: "certification request"
|
|
7061
7047
|
});
|
|
@@ -7253,7 +7239,7 @@ function Ci(e, t) {
|
|
|
7253
7239
|
h.Type.SEQUENCE,
|
|
7254
7240
|
!0,
|
|
7255
7241
|
[]
|
|
7256
|
-
),
|
|
7242
|
+
), T = h.create(
|
|
7257
7243
|
h.Class.CONTEXT_SPECIFIC,
|
|
7258
7244
|
0,
|
|
7259
7245
|
!0,
|
|
@@ -7270,7 +7256,7 @@ function Ci(e, t) {
|
|
|
7270
7256
|
}
|
|
7271
7257
|
} else
|
|
7272
7258
|
u.type === 8 && (u.oid ? n = h.oidToDer(h.oidToDer(u.oid)) : n = h.oidToDer(n));
|
|
7273
|
-
|
|
7259
|
+
T.value.push(h.create(
|
|
7274
7260
|
h.Class.CONTEXT_SPECIFIC,
|
|
7275
7261
|
u.type,
|
|
7276
7262
|
!1,
|
|
@@ -7281,7 +7267,7 @@ function Ci(e, t) {
|
|
|
7281
7267
|
h.Class.CONTEXT_SPECIFIC,
|
|
7282
7268
|
0,
|
|
7283
7269
|
!0,
|
|
7284
|
-
[
|
|
7270
|
+
[T]
|
|
7285
7271
|
)), o.push(x);
|
|
7286
7272
|
}
|
|
7287
7273
|
if (typeof e.value > "u") {
|
|
@@ -7334,7 +7320,7 @@ function fa(e, t) {
|
|
|
7334
7320
|
return h.create(h.Class.UNIVERSAL, h.Type.NULL, !1, "");
|
|
7335
7321
|
}
|
|
7336
7322
|
}
|
|
7337
|
-
function
|
|
7323
|
+
function T0(e) {
|
|
7338
7324
|
var t = h.create(h.Class.CONTEXT_SPECIFIC, 0, !0, []);
|
|
7339
7325
|
if (e.attributes.length === 0)
|
|
7340
7326
|
return t;
|
|
@@ -7365,9 +7351,9 @@ function I0(e) {
|
|
|
7365
7351
|
}
|
|
7366
7352
|
return t;
|
|
7367
7353
|
}
|
|
7368
|
-
var
|
|
7354
|
+
var I0 = /* @__PURE__ */ new Date("1950-01-01T00:00:00Z"), A0 = /* @__PURE__ */ new Date("2050-01-01T00:00:00Z");
|
|
7369
7355
|
function Ua(e) {
|
|
7370
|
-
return e >=
|
|
7356
|
+
return e >= I0 && e < A0 ? h.create(
|
|
7371
7357
|
h.Class.UNIVERSAL,
|
|
7372
7358
|
h.Type.UTCTIME,
|
|
7373
7359
|
!1,
|
|
@@ -7461,7 +7447,7 @@ L.getCertificationRequestInfo = function(e) {
|
|
|
7461
7447
|
// SubjectPublicKeyInfo
|
|
7462
7448
|
L.publicKeyToAsn1(e.publicKey),
|
|
7463
7449
|
// attributes
|
|
7464
|
-
|
|
7450
|
+
T0(e)
|
|
7465
7451
|
]);
|
|
7466
7452
|
return t;
|
|
7467
7453
|
};
|
|
@@ -7675,29 +7661,26 @@ L.verifyCertificateChain = function(e, t, a) {
|
|
|
7675
7661
|
});
|
|
7676
7662
|
}
|
|
7677
7663
|
if (n === null && (!s || t.length === 0 && (!u || l))) {
|
|
7678
|
-
var
|
|
7679
|
-
if (I !== null && (!I.keyCertSign ||
|
|
7664
|
+
var T = f.getExtension("basicConstraints"), I = f.getExtension("keyUsage");
|
|
7665
|
+
if (I !== null && (!I.keyCertSign || T === null) && (n = {
|
|
7680
7666
|
message: "Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",
|
|
7681
7667
|
error: L.certificateError.bad_certificate
|
|
7682
|
-
}), n === null &&
|
|
7683
|
-
message: "Certificate is missing basicConstraints extension and cannot be used as a CA.",
|
|
7684
|
-
error: L.certificateError.bad_certificate
|
|
7685
|
-
}), n === null && S !== null && !S.cA && (n = {
|
|
7668
|
+
}), n === null && T !== null && !T.cA && (n = {
|
|
7686
7669
|
message: "Certificate basicConstraints indicates the certificate is not a CA.",
|
|
7687
7670
|
error: L.certificateError.bad_certificate
|
|
7688
|
-
}), n === null && I !== null && "pathLenConstraint" in
|
|
7689
|
-
var
|
|
7690
|
-
|
|
7671
|
+
}), n === null && I !== null && "pathLenConstraint" in T) {
|
|
7672
|
+
var B = o - 1;
|
|
7673
|
+
B > T.pathLenConstraint && (n = {
|
|
7691
7674
|
message: "Certificate basicConstraints pathLenConstraint violated.",
|
|
7692
7675
|
error: L.certificateError.bad_certificate
|
|
7693
7676
|
});
|
|
7694
7677
|
}
|
|
7695
7678
|
}
|
|
7696
|
-
var
|
|
7679
|
+
var b = n === null ? !0 : n.error, V = a.verify ? a.verify(b, o, r) : b;
|
|
7697
7680
|
if (V === !0)
|
|
7698
7681
|
n = null;
|
|
7699
7682
|
else
|
|
7700
|
-
throw
|
|
7683
|
+
throw b === !0 && (n = {
|
|
7701
7684
|
message: "The application rejected the certificate.",
|
|
7702
7685
|
error: L.certificateError.bad_certificate
|
|
7703
7686
|
}), (V || V === 0) && (typeof V == "object" && !M.util.isArray(V) ? (V.message && (n.message = V.message), V.error && (n.error = V.error)) : typeof V == "string" && (n.error = V)), n;
|
|
@@ -7705,7 +7688,7 @@ L.verifyCertificateChain = function(e, t, a) {
|
|
|
7705
7688
|
} while (t.length > 0);
|
|
7706
7689
|
return !0;
|
|
7707
7690
|
};
|
|
7708
|
-
var oe = z, g = oe.asn1, X = oe.pki,
|
|
7691
|
+
var oe = z, g = oe.asn1, X = oe.pki, Jt = oe.pkcs12 = oe.pkcs12 || {}, mi = {
|
|
7709
7692
|
name: "ContentInfo",
|
|
7710
7693
|
tagClass: g.Class.UNIVERSAL,
|
|
7711
7694
|
type: g.Type.SEQUENCE,
|
|
@@ -7723,7 +7706,7 @@ var oe = z, g = oe.asn1, X = oe.pki, er = oe.pkcs12 = oe.pkcs12 || {}, mi = {
|
|
|
7723
7706
|
constructed: !0,
|
|
7724
7707
|
captureAsn1: "content"
|
|
7725
7708
|
}]
|
|
7726
|
-
},
|
|
7709
|
+
}, B0 = {
|
|
7727
7710
|
name: "PFX",
|
|
7728
7711
|
tagClass: g.Class.UNIVERSAL,
|
|
7729
7712
|
type: g.Type.SEQUENCE,
|
|
@@ -7791,7 +7774,7 @@ var oe = z, g = oe.asn1, X = oe.pki, er = oe.pkcs12 = oe.pkcs12 || {}, mi = {
|
|
|
7791
7774
|
}]
|
|
7792
7775
|
}
|
|
7793
7776
|
]
|
|
7794
|
-
},
|
|
7777
|
+
}, b0 = {
|
|
7795
7778
|
name: "SafeBag",
|
|
7796
7779
|
tagClass: g.Class.UNIVERSAL,
|
|
7797
7780
|
type: g.Type.SEQUENCE,
|
|
@@ -7815,7 +7798,7 @@ var oe = z, g = oe.asn1, X = oe.pki, er = oe.pkcs12 = oe.pkcs12 || {}, mi = {
|
|
|
7815
7798
|
optional: !0,
|
|
7816
7799
|
capture: "bagAttributes"
|
|
7817
7800
|
}]
|
|
7818
|
-
},
|
|
7801
|
+
}, _0 = {
|
|
7819
7802
|
name: "Attribute",
|
|
7820
7803
|
tagClass: g.Class.UNIVERSAL,
|
|
7821
7804
|
type: g.Type.SEQUENCE,
|
|
@@ -7833,7 +7816,7 @@ var oe = z, g = oe.asn1, X = oe.pki, er = oe.pkcs12 = oe.pkcs12 || {}, mi = {
|
|
|
7833
7816
|
constructed: !0,
|
|
7834
7817
|
capture: "values"
|
|
7835
7818
|
}]
|
|
7836
|
-
},
|
|
7819
|
+
}, N0 = {
|
|
7837
7820
|
name: "CertBag",
|
|
7838
7821
|
tagClass: g.Class.UNIVERSAL,
|
|
7839
7822
|
type: g.Type.SEQUENCE,
|
|
@@ -7873,10 +7856,10 @@ function zt(e, t, a, r) {
|
|
|
7873
7856
|
}
|
|
7874
7857
|
return i;
|
|
7875
7858
|
}
|
|
7876
|
-
|
|
7859
|
+
Jt.pkcs12FromAsn1 = function(e, t, a) {
|
|
7877
7860
|
typeof t == "string" ? (a = t, t = !0) : t === void 0 && (t = !0);
|
|
7878
7861
|
var r = {}, i = [];
|
|
7879
|
-
if (!g.validate(e,
|
|
7862
|
+
if (!g.validate(e, B0, r, i)) {
|
|
7880
7863
|
var s = new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");
|
|
7881
7864
|
throw s.errors = s, s;
|
|
7882
7865
|
}
|
|
@@ -7896,23 +7879,23 @@ er.pkcs12FromAsn1 = function(e, t, a) {
|
|
|
7896
7879
|
* attribute was given but a bag type, the map key will be the
|
|
7897
7880
|
* bag type.
|
|
7898
7881
|
*/
|
|
7899
|
-
getBags: function(
|
|
7900
|
-
var I = {},
|
|
7901
|
-
return "localKeyId" in
|
|
7882
|
+
getBags: function(T) {
|
|
7883
|
+
var I = {}, B;
|
|
7884
|
+
return "localKeyId" in T ? B = T.localKeyId : "localKeyIdHex" in T && (B = oe.util.hexToBytes(T.localKeyIdHex)), B === void 0 && !("friendlyName" in T) && "bagType" in T && (I[T.bagType] = zt(
|
|
7902
7885
|
n.safeContents,
|
|
7903
7886
|
null,
|
|
7904
7887
|
null,
|
|
7905
|
-
|
|
7906
|
-
)),
|
|
7888
|
+
T.bagType
|
|
7889
|
+
)), B !== void 0 && (I.localKeyId = zt(
|
|
7907
7890
|
n.safeContents,
|
|
7908
7891
|
"localKeyId",
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
)), "friendlyName" in
|
|
7892
|
+
B,
|
|
7893
|
+
T.bagType
|
|
7894
|
+
)), "friendlyName" in T && (I.friendlyName = zt(
|
|
7912
7895
|
n.safeContents,
|
|
7913
7896
|
"friendlyName",
|
|
7914
|
-
|
|
7915
|
-
|
|
7897
|
+
T.friendlyName,
|
|
7898
|
+
T.bagType
|
|
7916
7899
|
)), I;
|
|
7917
7900
|
},
|
|
7918
7901
|
/**
|
|
@@ -7925,11 +7908,11 @@ er.pkcs12FromAsn1 = function(e, t, a) {
|
|
|
7925
7908
|
*
|
|
7926
7909
|
* @return an array of bags with matching friendlyName attribute.
|
|
7927
7910
|
*/
|
|
7928
|
-
getBagsByFriendlyName: function(
|
|
7911
|
+
getBagsByFriendlyName: function(T, I) {
|
|
7929
7912
|
return zt(
|
|
7930
7913
|
n.safeContents,
|
|
7931
7914
|
"friendlyName",
|
|
7932
|
-
|
|
7915
|
+
T,
|
|
7933
7916
|
I
|
|
7934
7917
|
);
|
|
7935
7918
|
},
|
|
@@ -7943,11 +7926,11 @@ er.pkcs12FromAsn1 = function(e, t, a) {
|
|
|
7943
7926
|
*
|
|
7944
7927
|
* @return an array of bags with matching localKeyId attribute.
|
|
7945
7928
|
*/
|
|
7946
|
-
getBagsByLocalKeyId: function(
|
|
7929
|
+
getBagsByLocalKeyId: function(T, I) {
|
|
7947
7930
|
return zt(
|
|
7948
7931
|
n.safeContents,
|
|
7949
7932
|
"localKeyId",
|
|
7950
|
-
|
|
7933
|
+
T,
|
|
7951
7934
|
I
|
|
7952
7935
|
);
|
|
7953
7936
|
}
|
|
@@ -7984,7 +7967,7 @@ er.pkcs12FromAsn1 = function(e, t, a) {
|
|
|
7984
7967
|
}
|
|
7985
7968
|
if (f === null)
|
|
7986
7969
|
throw new Error("PKCS#12 uses unsupported MAC algorithm: " + l);
|
|
7987
|
-
var c = new oe.util.ByteBuffer(r.macSalt), v = "macIterations" in r ? parseInt(oe.util.bytesToHex(r.macIterations), 16) : 1, C =
|
|
7970
|
+
var c = new oe.util.ByteBuffer(r.macSalt), v = "macIterations" in r ? parseInt(oe.util.bytesToHex(r.macIterations), 16) : 1, C = Jt.generateKey(
|
|
7988
7971
|
a,
|
|
7989
7972
|
c,
|
|
7990
7973
|
3,
|
|
@@ -7998,7 +7981,7 @@ er.pkcs12FromAsn1 = function(e, t, a) {
|
|
|
7998
7981
|
throw new Error("PKCS#12 MAC could not be verified. Invalid password?");
|
|
7999
7982
|
} else if (Array.isArray(e.value) && e.value.length > 2)
|
|
8000
7983
|
throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");
|
|
8001
|
-
return
|
|
7984
|
+
return R0(n, o.value, t, a), n;
|
|
8002
7985
|
};
|
|
8003
7986
|
function la(e) {
|
|
8004
7987
|
if (e.composed || e.constructed) {
|
|
@@ -8008,7 +7991,7 @@ function la(e) {
|
|
|
8008
7991
|
}
|
|
8009
7992
|
return e;
|
|
8010
7993
|
}
|
|
8011
|
-
function
|
|
7994
|
+
function R0(e, t, a, r) {
|
|
8012
7995
|
if (t = g.fromDer(t, a), t.tagClass !== g.Class.UNIVERSAL || t.type !== g.Type.SEQUENCE || t.constructed !== !0)
|
|
8013
7996
|
throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
|
|
8014
7997
|
for (var i = 0; i < t.value.length; i++) {
|
|
@@ -8027,16 +8010,16 @@ function w0(e, t, a, r) {
|
|
|
8027
8010
|
l = la(c).value;
|
|
8028
8011
|
break;
|
|
8029
8012
|
case X.oids.encryptedData:
|
|
8030
|
-
l =
|
|
8013
|
+
l = w0(c, r), u.encrypted = !0;
|
|
8031
8014
|
break;
|
|
8032
8015
|
default:
|
|
8033
8016
|
var f = new Error("Unsupported PKCS#12 contentType.");
|
|
8034
8017
|
throw f.contentType = g.derToOid(n.contentType), f;
|
|
8035
8018
|
}
|
|
8036
|
-
u.safeBags =
|
|
8019
|
+
u.safeBags = L0(l, a, r), e.safeContents.push(u);
|
|
8037
8020
|
}
|
|
8038
8021
|
}
|
|
8039
|
-
function
|
|
8022
|
+
function w0(e, t) {
|
|
8040
8023
|
var a = {}, r = [];
|
|
8041
8024
|
if (!g.validate(
|
|
8042
8025
|
e,
|
|
@@ -8060,7 +8043,7 @@ function L0(e, t) {
|
|
|
8060
8043
|
throw new Error("Failed to decrypt PKCS#12 SafeContents.");
|
|
8061
8044
|
return n.output.getBytes();
|
|
8062
8045
|
}
|
|
8063
|
-
function
|
|
8046
|
+
function L0(e, t, a) {
|
|
8064
8047
|
if (!t && e.length === 0)
|
|
8065
8048
|
return [];
|
|
8066
8049
|
if (e = g.fromDer(e, t), e.tagClass !== g.Class.UNIVERSAL || e.type !== g.Type.SEQUENCE || e.constructed !== !0)
|
|
@@ -8069,13 +8052,13 @@ function D0(e, t, a) {
|
|
|
8069
8052
|
);
|
|
8070
8053
|
for (var r = [], i = 0; i < e.value.length; i++) {
|
|
8071
8054
|
var s = e.value[i], n = {}, o = [];
|
|
8072
|
-
if (!g.validate(s,
|
|
8055
|
+
if (!g.validate(s, b0, n, o)) {
|
|
8073
8056
|
var f = new Error("Cannot read SafeBag.");
|
|
8074
8057
|
throw f.errors = o, f;
|
|
8075
8058
|
}
|
|
8076
8059
|
var u = {
|
|
8077
8060
|
type: g.derToOid(n.bagId),
|
|
8078
|
-
attributes:
|
|
8061
|
+
attributes: D0(n.bagAttributes)
|
|
8079
8062
|
};
|
|
8080
8063
|
r.push(u);
|
|
8081
8064
|
var l, c, v = n.bagValue.value[0];
|
|
@@ -8093,7 +8076,7 @@ function D0(e, t, a) {
|
|
|
8093
8076
|
}
|
|
8094
8077
|
continue;
|
|
8095
8078
|
case X.oids.certBag:
|
|
8096
|
-
l =
|
|
8079
|
+
l = N0, c = function() {
|
|
8097
8080
|
if (g.derToOid(n.certId) !== X.oids.x509Certificate) {
|
|
8098
8081
|
var y = new Error(
|
|
8099
8082
|
"Unsupported certificate type, only X.509 supported."
|
|
@@ -8120,12 +8103,12 @@ function D0(e, t, a) {
|
|
|
8120
8103
|
}
|
|
8121
8104
|
return r;
|
|
8122
8105
|
}
|
|
8123
|
-
function
|
|
8106
|
+
function D0(e) {
|
|
8124
8107
|
var t = {};
|
|
8125
8108
|
if (e !== void 0)
|
|
8126
8109
|
for (var a = 0; a < e.length; ++a) {
|
|
8127
8110
|
var r = {}, i = [];
|
|
8128
|
-
if (!g.validate(e[a],
|
|
8111
|
+
if (!g.validate(e[a], _0, r, i)) {
|
|
8129
8112
|
var s = new Error("Cannot read PKCS#12 BagAttribute.");
|
|
8130
8113
|
throw s.errors = i, s;
|
|
8131
8114
|
}
|
|
@@ -8138,7 +8121,7 @@ function k0(e) {
|
|
|
8138
8121
|
}
|
|
8139
8122
|
return t;
|
|
8140
8123
|
}
|
|
8141
|
-
|
|
8124
|
+
Jt.toPkcs12Asn1 = function(e, t, a, r) {
|
|
8142
8125
|
r = r || {}, r.saltSize = r.saltSize || 8, r.count = r.count || 2048, r.algorithm = r.algorithm || r.encAlgorithm || "aes128", "useMac" in r || (r.useMac = !0), "localKeyId" in r || (r.localKeyId = null), "generateLocalKeyId" in r || (r.generateLocalKeyId = !0);
|
|
8143
8126
|
var i = r.localKeyId, s;
|
|
8144
8127
|
if (i !== null)
|
|
@@ -8233,7 +8216,7 @@ er.toPkcs12Asn1 = function(e, t, a, r) {
|
|
|
8233
8216
|
c.push(x);
|
|
8234
8217
|
}
|
|
8235
8218
|
if (c.length > 0) {
|
|
8236
|
-
var
|
|
8219
|
+
var T = g.create(
|
|
8237
8220
|
g.Class.UNIVERSAL,
|
|
8238
8221
|
g.Type.SEQUENCE,
|
|
8239
8222
|
!0,
|
|
@@ -8255,17 +8238,17 @@ er.toPkcs12Asn1 = function(e, t, a, r) {
|
|
|
8255
8238
|
g.Class.UNIVERSAL,
|
|
8256
8239
|
g.Type.OCTETSTRING,
|
|
8257
8240
|
!1,
|
|
8258
|
-
g.toDer(
|
|
8241
|
+
g.toDer(T).getBytes()
|
|
8259
8242
|
)
|
|
8260
8243
|
])
|
|
8261
8244
|
])
|
|
8262
8245
|
);
|
|
8263
8246
|
u.push(I);
|
|
8264
8247
|
}
|
|
8265
|
-
var
|
|
8248
|
+
var B = null;
|
|
8266
8249
|
if (e !== null) {
|
|
8267
|
-
var
|
|
8268
|
-
a === null ?
|
|
8250
|
+
var b = X.wrapRsaPrivateKey(X.privateKeyToAsn1(e));
|
|
8251
|
+
a === null ? B = g.create(g.Class.UNIVERSAL, g.Type.SEQUENCE, !0, [
|
|
8269
8252
|
// bagId
|
|
8270
8253
|
g.create(
|
|
8271
8254
|
g.Class.UNIVERSAL,
|
|
@@ -8276,11 +8259,11 @@ er.toPkcs12Asn1 = function(e, t, a, r) {
|
|
|
8276
8259
|
// bagValue
|
|
8277
8260
|
g.create(g.Class.CONTEXT_SPECIFIC, 0, !0, [
|
|
8278
8261
|
// PrivateKeyInfo
|
|
8279
|
-
|
|
8262
|
+
b
|
|
8280
8263
|
]),
|
|
8281
8264
|
// bagAttributes (OPTIONAL)
|
|
8282
8265
|
s
|
|
8283
|
-
]) :
|
|
8266
|
+
]) : B = g.create(g.Class.UNIVERSAL, g.Type.SEQUENCE, !0, [
|
|
8284
8267
|
// bagId
|
|
8285
8268
|
g.create(
|
|
8286
8269
|
g.Class.UNIVERSAL,
|
|
@@ -8291,12 +8274,12 @@ er.toPkcs12Asn1 = function(e, t, a, r) {
|
|
|
8291
8274
|
// bagValue
|
|
8292
8275
|
g.create(g.Class.CONTEXT_SPECIFIC, 0, !0, [
|
|
8293
8276
|
// EncryptedPrivateKeyInfo
|
|
8294
|
-
X.encryptPrivateKeyInfo(
|
|
8277
|
+
X.encryptPrivateKeyInfo(b, a, r)
|
|
8295
8278
|
]),
|
|
8296
8279
|
// bagAttributes (OPTIONAL)
|
|
8297
8280
|
s
|
|
8298
8281
|
]);
|
|
8299
|
-
var V = g.create(g.Class.UNIVERSAL, g.Type.SEQUENCE, !0, [
|
|
8282
|
+
var V = g.create(g.Class.UNIVERSAL, g.Type.SEQUENCE, !0, [B]), D = (
|
|
8300
8283
|
// PKCS#7 ContentInfo
|
|
8301
8284
|
g.create(g.Class.UNIVERSAL, g.Type.SEQUENCE, !0, [
|
|
8302
8285
|
// contentType
|
|
@@ -8329,7 +8312,7 @@ er.toPkcs12Asn1 = function(e, t, a, r) {
|
|
|
8329
8312
|
if (r.useMac) {
|
|
8330
8313
|
var o = oe.md.sha1.create(), Y = new oe.util.ByteBuffer(
|
|
8331
8314
|
oe.random.getBytes(r.saltSize)
|
|
8332
|
-
), re = r.count, e =
|
|
8315
|
+
), re = r.count, e = Jt.generateKey(a, Y, 3, re, 20), ae = oe.hmac.create();
|
|
8333
8316
|
ae.start(o, e), ae.update(g.toDer(w).getBytes());
|
|
8334
8317
|
var ie = ae.getMac();
|
|
8335
8318
|
G = g.create(g.Class.UNIVERSAL, g.Type.SEQUENCE, !0, [
|
|
@@ -8402,7 +8385,7 @@ er.toPkcs12Asn1 = function(e, t, a, r) {
|
|
|
8402
8385
|
G
|
|
8403
8386
|
]);
|
|
8404
8387
|
};
|
|
8405
|
-
|
|
8388
|
+
Jt.generateKey = oe.pbe.generatePkcs12Key;
|
|
8406
8389
|
var Tt = z, ca = Tt.asn1, Mt = Tt.pki = Tt.pki || {};
|
|
8407
8390
|
Mt.pemToDer = function(e) {
|
|
8408
8391
|
var t = Tt.pem.decode(e)[0];
|
|
@@ -8435,43 +8418,43 @@ Mt.privateKeyInfoToPem = function(e, t) {
|
|
|
8435
8418
|
};
|
|
8436
8419
|
return Tt.pem.encode(a, { maxline: t });
|
|
8437
8420
|
};
|
|
8438
|
-
var
|
|
8439
|
-
var i =
|
|
8421
|
+
var _ = z, _r = function(e, t, a, r) {
|
|
8422
|
+
var i = _.util.createBuffer(), s = e.length >> 1, n = s + (e.length & 1), o = e.substr(0, n), f = e.substr(s, n), u = _.util.createBuffer(), l = _.hmac.create();
|
|
8440
8423
|
a = t + a;
|
|
8441
8424
|
var c = Math.ceil(r / 16), v = Math.ceil(r / 20);
|
|
8442
8425
|
l.start("MD5", o);
|
|
8443
|
-
var C =
|
|
8426
|
+
var C = _.util.createBuffer();
|
|
8444
8427
|
u.putBytes(a);
|
|
8445
8428
|
for (var y = 0; y < c; ++y)
|
|
8446
8429
|
l.start(null, null), l.update(u.getBytes()), u.putBuffer(l.digest()), l.start(null, null), l.update(u.bytes() + a), C.putBuffer(l.digest());
|
|
8447
8430
|
l.start("SHA1", f);
|
|
8448
|
-
var x =
|
|
8431
|
+
var x = _.util.createBuffer();
|
|
8449
8432
|
u.clear(), u.putBytes(a);
|
|
8450
8433
|
for (var y = 0; y < v; ++y)
|
|
8451
8434
|
l.start(null, null), l.update(u.getBytes()), u.putBuffer(l.digest()), l.start(null, null), l.update(u.bytes() + a), x.putBuffer(l.digest());
|
|
8452
|
-
return i.putBytes(
|
|
8435
|
+
return i.putBytes(_.util.xorBytes(
|
|
8453
8436
|
C.getBytes(),
|
|
8454
8437
|
x.getBytes(),
|
|
8455
8438
|
r
|
|
8456
8439
|
)), i;
|
|
8457
|
-
},
|
|
8458
|
-
var r =
|
|
8440
|
+
}, k0 = function(e, t, a) {
|
|
8441
|
+
var r = _.hmac.create();
|
|
8459
8442
|
r.start("SHA1", e);
|
|
8460
|
-
var i =
|
|
8443
|
+
var i = _.util.createBuffer();
|
|
8461
8444
|
return i.putInt32(t[0]), i.putInt32(t[1]), i.putByte(a.type), i.putByte(a.version.major), i.putByte(a.version.minor), i.putInt16(a.length), i.putBytes(a.fragment.bytes()), r.update(i.getBytes()), r.digest().getBytes();
|
|
8462
|
-
},
|
|
8445
|
+
}, U0 = function(e, t, a) {
|
|
8463
8446
|
var r = !1;
|
|
8464
8447
|
try {
|
|
8465
8448
|
var i = e.deflate(t.fragment.getBytes());
|
|
8466
|
-
t.fragment =
|
|
8449
|
+
t.fragment = _.util.createBuffer(i), t.length = i.length, r = !0;
|
|
8467
8450
|
} catch {
|
|
8468
8451
|
}
|
|
8469
8452
|
return r;
|
|
8470
|
-
},
|
|
8453
|
+
}, P0 = function(e, t, a) {
|
|
8471
8454
|
var r = !1;
|
|
8472
8455
|
try {
|
|
8473
8456
|
var i = e.inflate(t.fragment.getBytes());
|
|
8474
|
-
t.fragment =
|
|
8457
|
+
t.fragment = _.util.createBuffer(i), t.length = i.length, r = !0;
|
|
8475
8458
|
} catch {
|
|
8476
8459
|
}
|
|
8477
8460
|
return r;
|
|
@@ -8491,7 +8474,7 @@ var N = z, Nr = function(e, t, a, r) {
|
|
|
8491
8474
|
a = e.getInt32();
|
|
8492
8475
|
break;
|
|
8493
8476
|
}
|
|
8494
|
-
return
|
|
8477
|
+
return _.util.createBuffer(e.getBytes(a));
|
|
8495
8478
|
}, We = function(e, t, a) {
|
|
8496
8479
|
e.putInt(a.length(), t << 3), e.putBuffer(a);
|
|
8497
8480
|
}, p = {};
|
|
@@ -8636,7 +8619,7 @@ p.parseHelloMessage = function(e, t, a) {
|
|
|
8636
8619
|
major: s.getByte(),
|
|
8637
8620
|
minor: s.getByte()
|
|
8638
8621
|
},
|
|
8639
|
-
random:
|
|
8622
|
+
random: _.util.createBuffer(s.getBytes(32)),
|
|
8640
8623
|
session_id: ze(s, 1),
|
|
8641
8624
|
extensions: []
|
|
8642
8625
|
}, i ? (r.cipher_suite = s.getBytes(2), r.compression_method = s.getByte()) : (r.cipher_suites = ze(s, 2), r.compression_methods = ze(s, 1)), n = a - (n - s.length()), n > 0) {
|
|
@@ -8671,7 +8654,7 @@ p.parseHelloMessage = function(e, t, a) {
|
|
|
8671
8654
|
if (i)
|
|
8672
8655
|
e.session.cipherSuite = p.getCipherSuite(r.cipher_suite);
|
|
8673
8656
|
else
|
|
8674
|
-
for (var v =
|
|
8657
|
+
for (var v = _.util.createBuffer(r.cipher_suites.bytes()); v.length() > 0 && (e.session.cipherSuite = p.getCipherSuite(v.getBytes(2)), e.session.cipherSuite === null); )
|
|
8675
8658
|
;
|
|
8676
8659
|
if (e.session.cipherSuite === null)
|
|
8677
8660
|
return e.error(e, {
|
|
@@ -8681,7 +8664,7 @@ p.parseHelloMessage = function(e, t, a) {
|
|
|
8681
8664
|
level: p.Alert.Level.fatal,
|
|
8682
8665
|
description: p.Alert.Description.handshake_failure
|
|
8683
8666
|
},
|
|
8684
|
-
cipherSuite:
|
|
8667
|
+
cipherSuite: _.util.bytesToHex(r.cipher_suite)
|
|
8685
8668
|
});
|
|
8686
8669
|
i ? e.session.compressionMethod = r.compression_method : e.session.compressionMethod = p.CompressionMethod.none;
|
|
8687
8670
|
}
|
|
@@ -8724,21 +8707,21 @@ p.handleServerHello = function(e, t, a) {
|
|
|
8724
8707
|
});
|
|
8725
8708
|
e.session.version = e.version;
|
|
8726
8709
|
var i = r.session_id.bytes();
|
|
8727
|
-
i.length > 0 && i === e.session.id ? (e.expect = Ei, e.session.resuming = !0, e.session.sp.server_random = r.random.bytes()) : (e.expect =
|
|
8710
|
+
i.length > 0 && i === e.session.id ? (e.expect = Ei, e.session.resuming = !0, e.session.sp.server_random = r.random.bytes()) : (e.expect = O0, e.session.resuming = !1, p.createSecurityParameters(e, r)), e.session.id = i, e.process();
|
|
8728
8711
|
}
|
|
8729
8712
|
};
|
|
8730
8713
|
p.handleClientHello = function(e, t, a) {
|
|
8731
8714
|
var r = p.parseHelloMessage(e, t, a);
|
|
8732
8715
|
if (!e.fail) {
|
|
8733
8716
|
var i = r.session_id.bytes(), s = null;
|
|
8734
|
-
if (e.sessionCache && (s = e.sessionCache.getSession(i), s === null ? i = "" : (s.version.major !== r.version.major || s.version.minor > r.version.minor) && (s = null, i = "")), i.length === 0 && (i =
|
|
8717
|
+
if (e.sessionCache && (s = e.sessionCache.getSession(i), s === null ? i = "" : (s.version.major !== r.version.major || s.version.minor > r.version.minor) && (s = null, i = "")), i.length === 0 && (i = _.random.getBytes(32)), e.session.id = i, e.session.clientHelloVersion = r.version, e.session.sp = {}, s)
|
|
8735
8718
|
e.version = e.session.version = s.version, e.session.sp = s.sp;
|
|
8736
8719
|
else {
|
|
8737
8720
|
for (var n, o = 1; o < p.SupportedVersions.length && (n = p.SupportedVersions[o], !(n.minor <= r.version.minor)); ++o)
|
|
8738
8721
|
;
|
|
8739
8722
|
e.version = { major: n.major, minor: n.minor }, e.session.version = e.version;
|
|
8740
8723
|
}
|
|
8741
|
-
s !== null ? (e.expect = ha, e.session.resuming = !0, e.session.sp.client_random = r.random.bytes()) : (e.expect = e.verifyClient !== !1 ?
|
|
8724
|
+
s !== null ? (e.expect = ha, e.session.resuming = !0, e.session.sp.client_random = r.random.bytes()) : (e.expect = e.verifyClient !== !1 ? Q0 : Qr, e.session.resuming = !1, p.createSecurityParameters(e, r)), e.open = !0, p.queue(e, p.createRecord(e, {
|
|
8742
8725
|
type: p.ContentType.handshake,
|
|
8743
8726
|
data: p.createServerHello(e)
|
|
8744
8727
|
})), e.session.resuming ? (p.queue(e, p.createRecord(e, {
|
|
@@ -8777,7 +8760,7 @@ p.handleCertificate = function(e, t, a) {
|
|
|
8777
8760
|
}, s, n, o = [];
|
|
8778
8761
|
try {
|
|
8779
8762
|
for (; i.certificate_list.length() > 0; )
|
|
8780
|
-
s = ze(i.certificate_list, 3), n =
|
|
8763
|
+
s = ze(i.certificate_list, 3), n = _.asn1.fromDer(s), s = _.pki.certificateFromAsn1(n, !0), o.push(s);
|
|
8781
8764
|
} catch (u) {
|
|
8782
8765
|
return e.error(e, {
|
|
8783
8766
|
message: "Could not parse certificate list.",
|
|
@@ -8809,7 +8792,7 @@ p.handleServerKeyExchange = function(e, t, a) {
|
|
|
8809
8792
|
description: p.Alert.Description.unsupported_certificate
|
|
8810
8793
|
}
|
|
8811
8794
|
});
|
|
8812
|
-
e.expect =
|
|
8795
|
+
e.expect = F0, e.process();
|
|
8813
8796
|
};
|
|
8814
8797
|
p.handleClientKeyExchange = function(e, t, a) {
|
|
8815
8798
|
if (a < 48)
|
|
@@ -8826,7 +8809,7 @@ p.handleClientKeyExchange = function(e, t, a) {
|
|
|
8826
8809
|
}, s = null;
|
|
8827
8810
|
if (e.getPrivateKey)
|
|
8828
8811
|
try {
|
|
8829
|
-
s = e.getPrivateKey(e, e.session.serverCertificate), s =
|
|
8812
|
+
s = e.getPrivateKey(e, e.session.serverCertificate), s = _.pki.privateKeyFromPem(s);
|
|
8830
8813
|
} catch (f) {
|
|
8831
8814
|
e.error(e, {
|
|
8832
8815
|
message: "Could not get private key.",
|
|
@@ -8854,9 +8837,9 @@ p.handleClientKeyExchange = function(e, t, a) {
|
|
|
8854
8837
|
if (o.major !== n.pre_master_secret.charCodeAt(0) || o.minor !== n.pre_master_secret.charCodeAt(1))
|
|
8855
8838
|
throw new Error("TLS version rollback attack detected.");
|
|
8856
8839
|
} catch {
|
|
8857
|
-
n.pre_master_secret =
|
|
8840
|
+
n.pre_master_secret = _.random.getBytes(48);
|
|
8858
8841
|
}
|
|
8859
|
-
e.expect = ha, e.session.clientCertificate !== null && (e.expect =
|
|
8842
|
+
e.expect = ha, e.session.clientCertificate !== null && (e.expect = z0), e.process();
|
|
8860
8843
|
};
|
|
8861
8844
|
p.handleCertificateRequest = function(e, t, a) {
|
|
8862
8845
|
if (a < 3)
|
|
@@ -8872,7 +8855,7 @@ p.handleCertificateRequest = function(e, t, a) {
|
|
|
8872
8855
|
certificate_types: ze(r, 1),
|
|
8873
8856
|
certificate_authorities: ze(r, 2)
|
|
8874
8857
|
};
|
|
8875
|
-
e.session.certificateRequest = i, e.expect =
|
|
8858
|
+
e.session.certificateRequest = i, e.expect = K0, e.process();
|
|
8876
8859
|
};
|
|
8877
8860
|
p.handleCertificateVerify = function(e, t, a) {
|
|
8878
8861
|
if (a < 2)
|
|
@@ -8890,7 +8873,7 @@ p.handleCertificateVerify = function(e, t, a) {
|
|
|
8890
8873
|
r.read += 4;
|
|
8891
8874
|
var s = {
|
|
8892
8875
|
signature: ze(r, 2).getBytes()
|
|
8893
|
-
}, n =
|
|
8876
|
+
}, n = _.util.createBuffer();
|
|
8894
8877
|
n.putBuffer(e.session.md5.digest()), n.putBuffer(e.session.sha1.digest()), n = n.getBytes();
|
|
8895
8878
|
try {
|
|
8896
8879
|
var o = e.session.clientCertificate;
|
|
@@ -8929,7 +8912,7 @@ p.handleServerHelloDone = function(e, t, a) {
|
|
|
8929
8912
|
}
|
|
8930
8913
|
}, i = 0, s = e.verify(e, r.alert.description, i, []);
|
|
8931
8914
|
if (s !== !0)
|
|
8932
|
-
return (s || s === 0) && (typeof s == "object" && !
|
|
8915
|
+
return (s || s === 0) && (typeof s == "object" && !_.util.isArray(s) ? (s.message && (r.message = s.message), s.alert && (r.alert.description = s.alert)) : typeof s == "number" && (r.alert.description = s)), e.error(e, r);
|
|
8933
8916
|
}
|
|
8934
8917
|
e.session.certificateRequest !== null && (t = p.createRecord(e, {
|
|
8935
8918
|
type: p.ContentType.handshake,
|
|
@@ -8937,7 +8920,7 @@ p.handleServerHelloDone = function(e, t, a) {
|
|
|
8937
8920
|
}), p.queue(e, t)), t = p.createRecord(e, {
|
|
8938
8921
|
type: p.ContentType.handshake,
|
|
8939
8922
|
data: p.createClientKeyExchange(e)
|
|
8940
|
-
}), p.queue(e, t), e.expect =
|
|
8923
|
+
}), p.queue(e, t), e.expect = G0;
|
|
8941
8924
|
var n = function(o, f) {
|
|
8942
8925
|
o.session.certificateRequest !== null && o.session.clientCertificate !== null && p.queue(o, p.createRecord(o, {
|
|
8943
8926
|
type: p.ContentType.handshake,
|
|
@@ -8965,7 +8948,7 @@ p.handleChangeCipherSpec = function(e, t) {
|
|
|
8965
8948
|
}
|
|
8966
8949
|
});
|
|
8967
8950
|
var a = e.entity === p.ConnectionEnd.client;
|
|
8968
|
-
(e.session.resuming && a || !e.session.resuming && !a) && (e.state.pending = p.createConnectionState(e)), e.state.current.read = e.state.pending.read, (!e.session.resuming && a || e.session.resuming && !a) && (e.state.pending = null), e.expect = a ?
|
|
8951
|
+
(e.session.resuming && a || !e.session.resuming && !a) && (e.state.pending = p.createConnectionState(e)), e.state.current.read = e.state.pending.read, (!e.session.resuming && a || e.session.resuming && !a) && (e.state.pending = null), e.expect = a ? M0 : Y0, e.process();
|
|
8969
8952
|
};
|
|
8970
8953
|
p.handleFinished = function(e, t, a) {
|
|
8971
8954
|
var r = t.fragment;
|
|
@@ -8973,8 +8956,8 @@ p.handleFinished = function(e, t, a) {
|
|
|
8973
8956
|
var i = r.bytes();
|
|
8974
8957
|
r.read += 4;
|
|
8975
8958
|
var s = t.fragment.getBytes();
|
|
8976
|
-
r =
|
|
8977
|
-
var n = e.entity === p.ConnectionEnd.client, o = n ? "server finished" : "client finished", f = e.session.sp, u = 12, l =
|
|
8959
|
+
r = _.util.createBuffer(), r.putBuffer(e.session.md5.digest()), r.putBuffer(e.session.sha1.digest());
|
|
8960
|
+
var n = e.entity === p.ConnectionEnd.client, o = n ? "server finished" : "client finished", f = e.session.sp, u = 12, l = _r;
|
|
8978
8961
|
if (r = l(f.master_secret, o, r.getBytes(), u), r.getBytes() !== s)
|
|
8979
8962
|
return e.error(e, {
|
|
8980
8963
|
message: "Invalid verify_data in Finished message.",
|
|
@@ -8990,7 +8973,7 @@ p.handleFinished = function(e, t, a) {
|
|
|
8990
8973
|
})), e.state.current.write = e.state.pending.write, e.state.pending = null, p.queue(e, p.createRecord(e, {
|
|
8991
8974
|
type: p.ContentType.handshake,
|
|
8992
8975
|
data: p.createFinished(e)
|
|
8993
|
-
}))), e.expect = n ?
|
|
8976
|
+
}))), e.expect = n ? H0 : X0, e.handshaking = !1, ++e.handshakes, e.peerCertificate = n ? e.session.serverCertificate : e.session.clientCertificate, p.flush(e), e.isConnected = !0, e.connected(e), e.process();
|
|
8994
8977
|
};
|
|
8995
8978
|
p.handleAlert = function(e, t) {
|
|
8996
8979
|
var a = t.fragment, r = {
|
|
@@ -9084,10 +9067,10 @@ p.handleAlert = function(e, t) {
|
|
|
9084
9067
|
p.handleHandshake = function(e, t) {
|
|
9085
9068
|
var a = t.fragment, r = a.getByte(), i = a.getInt24();
|
|
9086
9069
|
if (i > a.length())
|
|
9087
|
-
return e.fragmented = t, t.fragment =
|
|
9070
|
+
return e.fragmented = t, t.fragment = _.util.createBuffer(), a.read -= 4, e.process();
|
|
9088
9071
|
e.fragmented = null, a.read -= 4;
|
|
9089
9072
|
var s = a.bytes(i + 4);
|
|
9090
|
-
a.read += 4, r in
|
|
9073
|
+
a.read += 4, r in yr[e.entity][e.expect] ? (e.entity === p.ConnectionEnd.server && !e.open && !e.fail && (e.handshaking = !0, e.session = {
|
|
9091
9074
|
version: null,
|
|
9092
9075
|
extensions: {
|
|
9093
9076
|
server_name: {
|
|
@@ -9098,9 +9081,9 @@ p.handleHandshake = function(e, t) {
|
|
|
9098
9081
|
compressionMethod: null,
|
|
9099
9082
|
serverCertificate: null,
|
|
9100
9083
|
clientCertificate: null,
|
|
9101
|
-
md5:
|
|
9102
|
-
sha1:
|
|
9103
|
-
}), r !== p.HandshakeType.hello_request && r !== p.HandshakeType.certificate_verify && r !== p.HandshakeType.finished && (e.session.md5.update(s), e.session.sha1.update(s)),
|
|
9084
|
+
md5: _.md.md5.create(),
|
|
9085
|
+
sha1: _.md.sha1.create()
|
|
9086
|
+
}), r !== p.HandshakeType.hello_request && r !== p.HandshakeType.certificate_verify && r !== p.HandshakeType.finished && (e.session.md5.update(s), e.session.sha1.update(s)), yr[e.entity][e.expect][r](e, t, i)) : p.handleUnexpected(e, t);
|
|
9104
9087
|
};
|
|
9105
9088
|
p.handleApplicationData = function(e, t) {
|
|
9106
9089
|
e.data.putBuffer(t.fragment), e.dataReady(e), e.process();
|
|
@@ -9120,11 +9103,11 @@ p.handleHeartbeat = function(e, t) {
|
|
|
9120
9103
|
} else if (r === p.HeartbeatMessageType.heartbeat_response) {
|
|
9121
9104
|
if (s !== e.expectedHeartbeatPayload)
|
|
9122
9105
|
return e.process();
|
|
9123
|
-
e.heartbeatReceived && e.heartbeatReceived(e,
|
|
9106
|
+
e.heartbeatReceived && e.heartbeatReceived(e, _.util.createBuffer(s));
|
|
9124
9107
|
}
|
|
9125
9108
|
e.process();
|
|
9126
9109
|
};
|
|
9127
|
-
var
|
|
9110
|
+
var V0 = 0, O0 = 1, Pa = 2, F0 = 3, K0 = 4, Ei = 5, M0 = 6, H0 = 7, G0 = 8, q0 = 0, Q0 = 1, Qr = 2, z0 = 3, ha = 4, Y0 = 5, X0 = 6, d = p.handleUnexpected, xi = p.handleChangeCipherSpec, Te = p.handleAlert, Me = p.handleHandshake, Si = p.handleApplicationData, Ie = p.handleHeartbeat, da = [];
|
|
9128
9111
|
da[p.ConnectionEnd.client] = [
|
|
9129
9112
|
// CC,AL,HS,AD,HB
|
|
9130
9113
|
/*SHE*/
|
|
@@ -9165,19 +9148,19 @@ da[p.ConnectionEnd.server] = [
|
|
|
9165
9148
|
/*CER*/
|
|
9166
9149
|
[d, Te, Me, d, Ie]
|
|
9167
9150
|
];
|
|
9168
|
-
var vt = p.handleHelloRequest,
|
|
9169
|
-
|
|
9151
|
+
var vt = p.handleHelloRequest, W0 = p.handleServerHello, Ti = p.handleCertificate, Va = p.handleServerKeyExchange, wr = p.handleCertificateRequest, ir = p.handleServerHelloDone, Ii = p.handleFinished, yr = [];
|
|
9152
|
+
yr[p.ConnectionEnd.client] = [
|
|
9170
9153
|
// HR,01,SH,03,04,05,06,07,08,09,10,SC,SK,CR,HD,15,CK,17,18,19,FI
|
|
9171
9154
|
/*SHE*/
|
|
9172
|
-
[d, d,
|
|
9155
|
+
[d, d, W0, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d],
|
|
9173
9156
|
/*SCE*/
|
|
9174
|
-
[vt, d, d, d, d, d, d, d, d, d, d, Ti, Va,
|
|
9157
|
+
[vt, d, d, d, d, d, d, d, d, d, d, Ti, Va, wr, ir, d, d, d, d, d, d],
|
|
9175
9158
|
/*SKE*/
|
|
9176
|
-
[vt, d, d, d, d, d, d, d, d, d, d, d, Va,
|
|
9159
|
+
[vt, d, d, d, d, d, d, d, d, d, d, d, Va, wr, ir, d, d, d, d, d, d],
|
|
9177
9160
|
/*SCR*/
|
|
9178
|
-
[vt, d, d, d, d, d, d, d, d, d, d, d, d,
|
|
9161
|
+
[vt, d, d, d, d, d, d, d, d, d, d, d, d, wr, ir, d, d, d, d, d, d],
|
|
9179
9162
|
/*SHD*/
|
|
9180
|
-
[vt, d, d, d, d, d, d, d, d, d, d, d, d, d,
|
|
9163
|
+
[vt, d, d, d, d, d, d, d, d, d, d, d, d, d, ir, d, d, d, d, d, d],
|
|
9181
9164
|
/*SCC*/
|
|
9182
9165
|
[vt, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d],
|
|
9183
9166
|
/*SFI*/
|
|
@@ -9187,17 +9170,17 @@ gr[p.ConnectionEnd.client] = [
|
|
|
9187
9170
|
/*SER*/
|
|
9188
9171
|
[vt, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d]
|
|
9189
9172
|
];
|
|
9190
|
-
var
|
|
9191
|
-
|
|
9173
|
+
var j0 = p.handleClientHello, $0 = p.handleClientKeyExchange, Z0 = p.handleCertificateVerify;
|
|
9174
|
+
yr[p.ConnectionEnd.server] = [
|
|
9192
9175
|
// 01,CH,02,03,04,05,06,07,08,09,10,CC,12,13,14,CV,CK,17,18,19,FI
|
|
9193
9176
|
/*CHE*/
|
|
9194
|
-
[d,
|
|
9177
|
+
[d, j0, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d],
|
|
9195
9178
|
/*CCE*/
|
|
9196
9179
|
[d, d, d, d, d, d, d, d, d, d, d, Ti, d, d, d, d, d, d, d, d, d],
|
|
9197
9180
|
/*CKE*/
|
|
9198
|
-
[d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d,
|
|
9181
|
+
[d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, $0, d, d, d, d],
|
|
9199
9182
|
/*CCV*/
|
|
9200
|
-
[d, d, d, d, d, d, d, d, d, d, d, d, d, d, d,
|
|
9183
|
+
[d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, Z0, d, d, d, d, d],
|
|
9201
9184
|
/*CCC*/
|
|
9202
9185
|
[d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d],
|
|
9203
9186
|
/*CFI*/
|
|
@@ -9208,7 +9191,7 @@ gr[p.ConnectionEnd.server] = [
|
|
|
9208
9191
|
[d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d, d]
|
|
9209
9192
|
];
|
|
9210
9193
|
p.generateKeys = function(e, t) {
|
|
9211
|
-
var a =
|
|
9194
|
+
var a = _r, r = t.client_random + t.server_random;
|
|
9212
9195
|
e.session.resuming || (t.master_secret = a(
|
|
9213
9196
|
t.pre_master_secret,
|
|
9214
9197
|
"master secret",
|
|
@@ -9291,7 +9274,7 @@ p.createConnectionState = function(e) {
|
|
|
9291
9274
|
case p.CompressionMethod.none:
|
|
9292
9275
|
break;
|
|
9293
9276
|
case p.CompressionMethod.deflate:
|
|
9294
|
-
r.read.compressFunction =
|
|
9277
|
+
r.read.compressFunction = P0, r.write.compressFunction = U0;
|
|
9295
9278
|
break;
|
|
9296
9279
|
default:
|
|
9297
9280
|
throw new Error("Unsupported compression algorithm.");
|
|
@@ -9300,8 +9283,8 @@ p.createConnectionState = function(e) {
|
|
|
9300
9283
|
return r;
|
|
9301
9284
|
};
|
|
9302
9285
|
p.createRandom = function() {
|
|
9303
|
-
var e = /* @__PURE__ */ new Date(), t = +e + e.getTimezoneOffset() * 6e4, a =
|
|
9304
|
-
return a.putInt32(t), a.putBytes(
|
|
9286
|
+
var e = /* @__PURE__ */ new Date(), t = +e + e.getTimezoneOffset() * 6e4, a = _.util.createBuffer();
|
|
9287
|
+
return a.putInt32(t), a.putBytes(_.random.getBytes(28)), a;
|
|
9305
9288
|
};
|
|
9306
9289
|
p.createRecord = function(e, t) {
|
|
9307
9290
|
if (!t.data)
|
|
@@ -9318,7 +9301,7 @@ p.createRecord = function(e, t) {
|
|
|
9318
9301
|
return a;
|
|
9319
9302
|
};
|
|
9320
9303
|
p.createAlert = function(e, t) {
|
|
9321
|
-
var a =
|
|
9304
|
+
var a = _.util.createBuffer();
|
|
9322
9305
|
return a.putByte(t.level), a.putByte(t.description), p.createRecord(e, {
|
|
9323
9306
|
type: p.ContentType.alert,
|
|
9324
9307
|
data: a
|
|
@@ -9329,19 +9312,19 @@ p.createClientHello = function(e) {
|
|
|
9329
9312
|
major: e.version.major,
|
|
9330
9313
|
minor: e.version.minor
|
|
9331
9314
|
};
|
|
9332
|
-
for (var t =
|
|
9315
|
+
for (var t = _.util.createBuffer(), a = 0; a < e.cipherSuites.length; ++a) {
|
|
9333
9316
|
var r = e.cipherSuites[a];
|
|
9334
9317
|
t.putByte(r.id[0]), t.putByte(r.id[1]);
|
|
9335
9318
|
}
|
|
9336
|
-
var i = t.length(), s =
|
|
9319
|
+
var i = t.length(), s = _.util.createBuffer();
|
|
9337
9320
|
s.putByte(p.CompressionMethod.none);
|
|
9338
|
-
var n = s.length(), o =
|
|
9321
|
+
var n = s.length(), o = _.util.createBuffer();
|
|
9339
9322
|
if (e.virtualHost) {
|
|
9340
|
-
var f =
|
|
9323
|
+
var f = _.util.createBuffer();
|
|
9341
9324
|
f.putByte(0), f.putByte(0);
|
|
9342
|
-
var u =
|
|
9343
|
-
u.putByte(0), We(u, 2,
|
|
9344
|
-
var l =
|
|
9325
|
+
var u = _.util.createBuffer();
|
|
9326
|
+
u.putByte(0), We(u, 2, _.util.createBuffer(e.virtualHost));
|
|
9327
|
+
var l = _.util.createBuffer();
|
|
9345
9328
|
We(l, 2, u), We(f, 2, l), o.putBuffer(f);
|
|
9346
9329
|
}
|
|
9347
9330
|
var c = o.length();
|
|
@@ -9351,16 +9334,16 @@ p.createClientHello = function(e) {
|
|
|
9351
9334
|
4 + 28 + // random time and random bytes
|
|
9352
9335
|
2 + i + // cipher suites vector
|
|
9353
9336
|
1 + n + // compression methods vector
|
|
9354
|
-
c, y =
|
|
9355
|
-
return y.putByte(p.HandshakeType.client_hello), y.putInt24(C), y.putByte(e.version.major), y.putByte(e.version.minor), y.putBytes(e.session.sp.client_random), We(y, 1,
|
|
9337
|
+
c, y = _.util.createBuffer();
|
|
9338
|
+
return y.putByte(p.HandshakeType.client_hello), y.putInt24(C), y.putByte(e.version.major), y.putByte(e.version.minor), y.putBytes(e.session.sp.client_random), We(y, 1, _.util.createBuffer(v)), We(y, 2, t), We(y, 1, s), c > 0 && We(y, 2, o), y;
|
|
9356
9339
|
};
|
|
9357
9340
|
p.createServerHello = function(e) {
|
|
9358
9341
|
var t = e.session.id, a = t.length + 1 + // session ID vector
|
|
9359
9342
|
2 + // version (major + minor)
|
|
9360
9343
|
4 + 28 + // random time and random bytes
|
|
9361
9344
|
2 + // chosen cipher suite
|
|
9362
|
-
1, r =
|
|
9363
|
-
return r.putByte(p.HandshakeType.server_hello), r.putInt24(a), r.putByte(e.version.major), r.putByte(e.version.minor), r.putBytes(e.session.sp.server_random), We(r, 1,
|
|
9345
|
+
1, r = _.util.createBuffer();
|
|
9346
|
+
return r.putByte(p.HandshakeType.server_hello), r.putInt24(a), r.putByte(e.version.major), r.putByte(e.version.minor), r.putBytes(e.session.sp.server_random), We(r, 1, _.util.createBuffer(t)), r.putByte(e.session.cipherSuite.id[0]), r.putByte(e.session.cipherSuite.id[1]), r.putByte(e.session.compressionMethod), r;
|
|
9364
9347
|
};
|
|
9365
9348
|
p.createCertificate = function(e) {
|
|
9366
9349
|
var t = e.entity === p.ConnectionEnd.client, a = null;
|
|
@@ -9368,24 +9351,24 @@ p.createCertificate = function(e) {
|
|
|
9368
9351
|
var r;
|
|
9369
9352
|
t ? r = e.session.certificateRequest : r = e.session.extensions.server_name.serverNameList, a = e.getCertificate(e, r);
|
|
9370
9353
|
}
|
|
9371
|
-
var i =
|
|
9354
|
+
var i = _.util.createBuffer();
|
|
9372
9355
|
if (a !== null)
|
|
9373
9356
|
try {
|
|
9374
|
-
|
|
9357
|
+
_.util.isArray(a) || (a = [a]);
|
|
9375
9358
|
for (var s = null, n = 0; n < a.length; ++n) {
|
|
9376
|
-
var o =
|
|
9359
|
+
var o = _.pem.decode(a[n])[0];
|
|
9377
9360
|
if (o.type !== "CERTIFICATE" && o.type !== "X509 CERTIFICATE" && o.type !== "TRUSTED CERTIFICATE") {
|
|
9378
9361
|
var f = new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');
|
|
9379
9362
|
throw f.headerType = o.type, f;
|
|
9380
9363
|
}
|
|
9381
9364
|
if (o.procType && o.procType.type === "ENCRYPTED")
|
|
9382
9365
|
throw new Error("Could not convert certificate from PEM; PEM is encrypted.");
|
|
9383
|
-
var u =
|
|
9384
|
-
s === null && (s =
|
|
9385
|
-
var l =
|
|
9366
|
+
var u = _.util.createBuffer(o.body);
|
|
9367
|
+
s === null && (s = _.asn1.fromDer(u.bytes(), !1));
|
|
9368
|
+
var l = _.util.createBuffer();
|
|
9386
9369
|
We(l, 3, u), i.putBuffer(l);
|
|
9387
9370
|
}
|
|
9388
|
-
a =
|
|
9371
|
+
a = _.pki.certificateFromAsn1(s), t ? e.session.clientCertificate = a : e.session.serverCertificate = a;
|
|
9389
9372
|
} catch (C) {
|
|
9390
9373
|
return e.error(e, {
|
|
9391
9374
|
message: "Could not send certificate list.",
|
|
@@ -9397,30 +9380,30 @@ p.createCertificate = function(e) {
|
|
|
9397
9380
|
}
|
|
9398
9381
|
});
|
|
9399
9382
|
}
|
|
9400
|
-
var c = 3 + i.length(), v =
|
|
9383
|
+
var c = 3 + i.length(), v = _.util.createBuffer();
|
|
9401
9384
|
return v.putByte(p.HandshakeType.certificate), v.putInt24(c), We(v, 3, i), v;
|
|
9402
9385
|
};
|
|
9403
9386
|
p.createClientKeyExchange = function(e) {
|
|
9404
|
-
var t =
|
|
9405
|
-
t.putByte(e.session.clientHelloVersion.major), t.putByte(e.session.clientHelloVersion.minor), t.putBytes(
|
|
9387
|
+
var t = _.util.createBuffer();
|
|
9388
|
+
t.putByte(e.session.clientHelloVersion.major), t.putByte(e.session.clientHelloVersion.minor), t.putBytes(_.random.getBytes(46));
|
|
9406
9389
|
var a = e.session.sp;
|
|
9407
9390
|
a.pre_master_secret = t.getBytes();
|
|
9408
9391
|
var r = e.session.serverCertificate.publicKey;
|
|
9409
9392
|
t = r.encrypt(a.pre_master_secret);
|
|
9410
|
-
var i = t.length + 2, s =
|
|
9393
|
+
var i = t.length + 2, s = _.util.createBuffer();
|
|
9411
9394
|
return s.putByte(p.HandshakeType.client_key_exchange), s.putInt24(i), s.putInt16(t.length), s.putBytes(t), s;
|
|
9412
9395
|
};
|
|
9413
9396
|
p.createServerKeyExchange = function(e) {
|
|
9414
|
-
var t =
|
|
9397
|
+
var t = _.util.createBuffer();
|
|
9415
9398
|
return t;
|
|
9416
9399
|
};
|
|
9417
9400
|
p.getClientSignature = function(e, t) {
|
|
9418
|
-
var a =
|
|
9401
|
+
var a = _.util.createBuffer();
|
|
9419
9402
|
a.putBuffer(e.session.md5.digest()), a.putBuffer(e.session.sha1.digest()), a = a.getBytes(), e.getSignature = e.getSignature || function(r, i, s) {
|
|
9420
9403
|
var n = null;
|
|
9421
9404
|
if (r.getPrivateKey)
|
|
9422
9405
|
try {
|
|
9423
|
-
n = r.getPrivateKey(r, r.session.clientCertificate), n =
|
|
9406
|
+
n = r.getPrivateKey(r, r.session.clientCertificate), n = _.pki.privateKeyFromPem(n);
|
|
9424
9407
|
} catch (o) {
|
|
9425
9408
|
r.error(r, {
|
|
9426
9409
|
message: "Could not get private key.",
|
|
@@ -9443,42 +9426,42 @@ p.getClientSignature = function(e, t) {
|
|
|
9443
9426
|
}, e.getSignature(e, a, t);
|
|
9444
9427
|
};
|
|
9445
9428
|
p.createCertificateVerify = function(e, t) {
|
|
9446
|
-
var a = t.length + 2, r =
|
|
9429
|
+
var a = t.length + 2, r = _.util.createBuffer();
|
|
9447
9430
|
return r.putByte(p.HandshakeType.certificate_verify), r.putInt24(a), r.putInt16(t.length), r.putBytes(t), r;
|
|
9448
9431
|
};
|
|
9449
9432
|
p.createCertificateRequest = function(e) {
|
|
9450
|
-
var t =
|
|
9433
|
+
var t = _.util.createBuffer();
|
|
9451
9434
|
t.putByte(1);
|
|
9452
|
-
var a =
|
|
9435
|
+
var a = _.util.createBuffer();
|
|
9453
9436
|
for (var r in e.caStore.certs) {
|
|
9454
|
-
var i = e.caStore.certs[r], s =
|
|
9437
|
+
var i = e.caStore.certs[r], s = _.pki.distinguishedNameToAsn1(i.subject), n = _.asn1.toDer(s);
|
|
9455
9438
|
a.putInt16(n.length()), a.putBuffer(n);
|
|
9456
9439
|
}
|
|
9457
|
-
var o = 1 + t.length() + 2 + a.length(), f =
|
|
9440
|
+
var o = 1 + t.length() + 2 + a.length(), f = _.util.createBuffer();
|
|
9458
9441
|
return f.putByte(p.HandshakeType.certificate_request), f.putInt24(o), We(f, 1, t), We(f, 2, a), f;
|
|
9459
9442
|
};
|
|
9460
9443
|
p.createServerHelloDone = function(e) {
|
|
9461
|
-
var t =
|
|
9444
|
+
var t = _.util.createBuffer();
|
|
9462
9445
|
return t.putByte(p.HandshakeType.server_hello_done), t.putInt24(0), t;
|
|
9463
9446
|
};
|
|
9464
9447
|
p.createChangeCipherSpec = function() {
|
|
9465
|
-
var e =
|
|
9448
|
+
var e = _.util.createBuffer();
|
|
9466
9449
|
return e.putByte(1), e;
|
|
9467
9450
|
};
|
|
9468
9451
|
p.createFinished = function(e) {
|
|
9469
|
-
var t =
|
|
9452
|
+
var t = _.util.createBuffer();
|
|
9470
9453
|
t.putBuffer(e.session.md5.digest()), t.putBuffer(e.session.sha1.digest());
|
|
9471
|
-
var a = e.entity === p.ConnectionEnd.client, r = e.session.sp, i = 12, s =
|
|
9454
|
+
var a = e.entity === p.ConnectionEnd.client, r = e.session.sp, i = 12, s = _r, n = a ? "client finished" : "server finished";
|
|
9472
9455
|
t = s(r.master_secret, n, t.getBytes(), i);
|
|
9473
|
-
var o =
|
|
9456
|
+
var o = _.util.createBuffer();
|
|
9474
9457
|
return o.putByte(p.HandshakeType.finished), o.putInt24(t.length()), o.putBuffer(t), o;
|
|
9475
9458
|
};
|
|
9476
9459
|
p.createHeartbeat = function(e, t, a) {
|
|
9477
9460
|
typeof a > "u" && (a = t.length);
|
|
9478
|
-
var r =
|
|
9461
|
+
var r = _.util.createBuffer();
|
|
9479
9462
|
r.putByte(e), r.putInt16(a), r.putBytes(t);
|
|
9480
9463
|
var i = r.length(), s = Math.max(16, i - a - 3);
|
|
9481
|
-
return r.putBytes(
|
|
9464
|
+
return r.putBytes(_.random.getBytes(s)), r;
|
|
9482
9465
|
};
|
|
9483
9466
|
p.queue = function(e, t) {
|
|
9484
9467
|
if (t && !(t.fragment.length() === 0 && (t.type === p.ContentType.handshake || t.type === p.ContentType.alert || t.type === p.ContentType.change_cipher_spec))) {
|
|
@@ -9494,11 +9477,11 @@ p.queue = function(e, t) {
|
|
|
9494
9477
|
for (var i = t.fragment.bytes(); i.length > p.MaxFragment; )
|
|
9495
9478
|
r.push(p.createRecord(e, {
|
|
9496
9479
|
type: t.type,
|
|
9497
|
-
data:
|
|
9480
|
+
data: _.util.createBuffer(i.slice(0, p.MaxFragment))
|
|
9498
9481
|
})), i = i.slice(p.MaxFragment);
|
|
9499
9482
|
i.length > 0 && r.push(p.createRecord(e, {
|
|
9500
9483
|
type: t.type,
|
|
9501
|
-
data:
|
|
9484
|
+
data: _.util.createBuffer(i)
|
|
9502
9485
|
}));
|
|
9503
9486
|
}
|
|
9504
9487
|
for (var s = 0; s < r.length && !e.fail; ++s) {
|
|
@@ -9514,43 +9497,43 @@ p.flush = function(e) {
|
|
|
9514
9497
|
}
|
|
9515
9498
|
return e.records = [], e.tlsDataReady(e);
|
|
9516
9499
|
};
|
|
9517
|
-
var
|
|
9500
|
+
var Lr = function(e) {
|
|
9518
9501
|
switch (e) {
|
|
9519
9502
|
case !0:
|
|
9520
9503
|
return !0;
|
|
9521
|
-
case
|
|
9504
|
+
case _.pki.certificateError.bad_certificate:
|
|
9522
9505
|
return p.Alert.Description.bad_certificate;
|
|
9523
|
-
case
|
|
9506
|
+
case _.pki.certificateError.unsupported_certificate:
|
|
9524
9507
|
return p.Alert.Description.unsupported_certificate;
|
|
9525
|
-
case
|
|
9508
|
+
case _.pki.certificateError.certificate_revoked:
|
|
9526
9509
|
return p.Alert.Description.certificate_revoked;
|
|
9527
|
-
case
|
|
9510
|
+
case _.pki.certificateError.certificate_expired:
|
|
9528
9511
|
return p.Alert.Description.certificate_expired;
|
|
9529
|
-
case
|
|
9512
|
+
case _.pki.certificateError.certificate_unknown:
|
|
9530
9513
|
return p.Alert.Description.certificate_unknown;
|
|
9531
|
-
case
|
|
9514
|
+
case _.pki.certificateError.unknown_ca:
|
|
9532
9515
|
return p.Alert.Description.unknown_ca;
|
|
9533
9516
|
default:
|
|
9534
9517
|
return p.Alert.Description.bad_certificate;
|
|
9535
9518
|
}
|
|
9536
|
-
},
|
|
9519
|
+
}, J0 = function(e) {
|
|
9537
9520
|
switch (e) {
|
|
9538
9521
|
case !0:
|
|
9539
9522
|
return !0;
|
|
9540
9523
|
case p.Alert.Description.bad_certificate:
|
|
9541
|
-
return
|
|
9524
|
+
return _.pki.certificateError.bad_certificate;
|
|
9542
9525
|
case p.Alert.Description.unsupported_certificate:
|
|
9543
|
-
return
|
|
9526
|
+
return _.pki.certificateError.unsupported_certificate;
|
|
9544
9527
|
case p.Alert.Description.certificate_revoked:
|
|
9545
|
-
return
|
|
9528
|
+
return _.pki.certificateError.certificate_revoked;
|
|
9546
9529
|
case p.Alert.Description.certificate_expired:
|
|
9547
|
-
return
|
|
9530
|
+
return _.pki.certificateError.certificate_expired;
|
|
9548
9531
|
case p.Alert.Description.certificate_unknown:
|
|
9549
|
-
return
|
|
9532
|
+
return _.pki.certificateError.certificate_unknown;
|
|
9550
9533
|
case p.Alert.Description.unknown_ca:
|
|
9551
|
-
return
|
|
9534
|
+
return _.pki.certificateError.unknown_ca;
|
|
9552
9535
|
default:
|
|
9553
|
-
return
|
|
9536
|
+
return _.pki.certificateError.bad_certificate;
|
|
9554
9537
|
}
|
|
9555
9538
|
};
|
|
9556
9539
|
p.verifyCertificateChain = function(e, t) {
|
|
@@ -9559,30 +9542,30 @@ p.verifyCertificateChain = function(e, t) {
|
|
|
9559
9542
|
for (var r in e.verifyOptions)
|
|
9560
9543
|
a[r] = e.verifyOptions[r];
|
|
9561
9544
|
a.verify = function(s, n, o) {
|
|
9562
|
-
var f =
|
|
9545
|
+
var f = Lr(s), u = e.verify(e, s, n, o);
|
|
9563
9546
|
if (u !== !0) {
|
|
9564
|
-
if (typeof u == "object" && !
|
|
9547
|
+
if (typeof u == "object" && !_.util.isArray(u)) {
|
|
9565
9548
|
var l = new Error("The application rejected the certificate.");
|
|
9566
9549
|
throw l.send = !0, l.alert = {
|
|
9567
9550
|
level: p.Alert.Level.fatal,
|
|
9568
9551
|
description: p.Alert.Description.bad_certificate
|
|
9569
9552
|
}, u.message && (l.message = u.message), u.alert && (l.alert.description = u.alert), l;
|
|
9570
9553
|
}
|
|
9571
|
-
u !== s && (u =
|
|
9554
|
+
u !== s && (u = J0(u));
|
|
9572
9555
|
}
|
|
9573
9556
|
return u;
|
|
9574
|
-
},
|
|
9557
|
+
}, _.pki.verifyCertificateChain(e.caStore, t, a);
|
|
9575
9558
|
} catch (s) {
|
|
9576
9559
|
var i = s;
|
|
9577
|
-
(typeof i != "object" ||
|
|
9560
|
+
(typeof i != "object" || _.util.isArray(i)) && (i = {
|
|
9578
9561
|
send: !0,
|
|
9579
9562
|
alert: {
|
|
9580
9563
|
level: p.Alert.Level.fatal,
|
|
9581
|
-
description:
|
|
9564
|
+
description: Lr(s)
|
|
9582
9565
|
}
|
|
9583
9566
|
}), "send" in i || (i.send = !0), "alert" in i || (i.alert = {
|
|
9584
9567
|
level: p.Alert.Level.fatal,
|
|
9585
|
-
description:
|
|
9568
|
+
description: Lr(i.error)
|
|
9586
9569
|
}), e.error(e, i);
|
|
9587
9570
|
}
|
|
9588
9571
|
return !e.fail;
|
|
@@ -9597,7 +9580,7 @@ p.createSessionCache = function(e, t) {
|
|
|
9597
9580
|
a.order.length <= t ? a.order.push(r) : delete e[r];
|
|
9598
9581
|
a.getSession = function(i) {
|
|
9599
9582
|
var s = null, n = null;
|
|
9600
|
-
if (i ? n =
|
|
9583
|
+
if (i ? n = _.util.bytesToHex(i) : a.order.length > 0 && (n = a.order[0]), n !== null && n in a.cache) {
|
|
9601
9584
|
s = a.cache[n], delete a.cache[n];
|
|
9602
9585
|
for (var o in a.order)
|
|
9603
9586
|
if (a.order[o] === n) {
|
|
@@ -9611,7 +9594,7 @@ p.createSessionCache = function(e, t) {
|
|
|
9611
9594
|
var n = a.order.shift();
|
|
9612
9595
|
delete a.cache[n];
|
|
9613
9596
|
}
|
|
9614
|
-
var n =
|
|
9597
|
+
var n = _.util.bytesToHex(i);
|
|
9615
9598
|
a.order.push(n), a.cache[n] = s;
|
|
9616
9599
|
};
|
|
9617
9600
|
}
|
|
@@ -9619,7 +9602,7 @@ p.createSessionCache = function(e, t) {
|
|
|
9619
9602
|
};
|
|
9620
9603
|
p.createConnection = function(e) {
|
|
9621
9604
|
var t = null;
|
|
9622
|
-
e.caStore ?
|
|
9605
|
+
e.caStore ? _.util.isArray(e.caStore) ? t = _.pki.createCaStore(e.caStore) : t = e.caStore : t = _.pki.createCaStore();
|
|
9623
9606
|
var a = e.cipherSuites || null;
|
|
9624
9607
|
if (a === null) {
|
|
9625
9608
|
a = [];
|
|
@@ -9643,9 +9626,9 @@ p.createConnection = function(e) {
|
|
|
9643
9626
|
getCertificate: e.getCertificate || null,
|
|
9644
9627
|
getPrivateKey: e.getPrivateKey || null,
|
|
9645
9628
|
getSignature: e.getSignature || null,
|
|
9646
|
-
input:
|
|
9647
|
-
tlsData:
|
|
9648
|
-
data:
|
|
9629
|
+
input: _.util.createBuffer(),
|
|
9630
|
+
tlsData: _.util.createBuffer(),
|
|
9631
|
+
data: _.util.createBuffer(),
|
|
9649
9632
|
tlsDataReady: e.tlsDataReady,
|
|
9650
9633
|
dataReady: e.dataReady,
|
|
9651
9634
|
heartbeatReceived: e.heartbeatReceived,
|
|
@@ -9662,7 +9645,7 @@ p.createConnection = function(e) {
|
|
|
9662
9645
|
n.version = { major: p.Version.major, minor: p.Version.minor }, n.record = null, n.session = null, n.peerCertificate = null, n.state = {
|
|
9663
9646
|
pending: null,
|
|
9664
9647
|
current: null
|
|
9665
|
-
}, n.expect = n.entity === p.ConnectionEnd.client ?
|
|
9648
|
+
}, n.expect = n.entity === p.ConnectionEnd.client ? V0 : q0, n.fragmented = null, n.records = [], n.open = !1, n.handshakes = 0, n.handshaking = !1, n.isConnected = !1, n.fail = !(l || typeof l > "u"), n.input.clear(), n.tlsData.clear(), n.data.clear(), n.state.current = p.createConnectionState(n);
|
|
9666
9649
|
}, n.reset();
|
|
9667
9650
|
var o = function(l, c) {
|
|
9668
9651
|
var v = c.type - p.ContentType.change_cipher_spec, C = da[l.entity][l.expect];
|
|
@@ -9679,7 +9662,7 @@ p.createConnection = function(e) {
|
|
|
9679
9662
|
minor: v.getByte()
|
|
9680
9663
|
},
|
|
9681
9664
|
length: v.getInt16(),
|
|
9682
|
-
fragment:
|
|
9665
|
+
fragment: _.util.createBuffer(),
|
|
9683
9666
|
ready: !1
|
|
9684
9667
|
};
|
|
9685
9668
|
var y = l.record.version.major === l.version.major;
|
|
@@ -9734,8 +9717,8 @@ p.createConnection = function(e) {
|
|
|
9734
9717
|
certificateRequest: null,
|
|
9735
9718
|
clientCertificate: null,
|
|
9736
9719
|
sp: {},
|
|
9737
|
-
md5:
|
|
9738
|
-
sha1:
|
|
9720
|
+
md5: _.md.md5.create(),
|
|
9721
|
+
sha1: _.md.sha1.create()
|
|
9739
9722
|
}, c && (n.version = c.version, n.session.sp = c.sp), n.session.sp.client_random = p.createRandom().getBytes(), n.open = !0, p.queue(n, p.createRecord(n, {
|
|
9740
9723
|
type: p.ContentType.handshake,
|
|
9741
9724
|
data: p.createClientHello(n)
|
|
@@ -9747,10 +9730,10 @@ p.createConnection = function(e) {
|
|
|
9747
9730
|
}, n.prepare = function(l) {
|
|
9748
9731
|
return p.queue(n, p.createRecord(n, {
|
|
9749
9732
|
type: p.ContentType.application_data,
|
|
9750
|
-
data:
|
|
9733
|
+
data: _.util.createBuffer(l)
|
|
9751
9734
|
})), p.flush(n);
|
|
9752
9735
|
}, n.prepareHeartbeatRequest = function(l, c) {
|
|
9753
|
-
return l instanceof
|
|
9736
|
+
return l instanceof _.util.ByteBuffer && (l = l.bytes()), typeof c > "u" && (c = l.length), n.expectedHeartbeatPayload = l, p.queue(n, p.createRecord(n, {
|
|
9754
9737
|
type: p.ContentType.heartbeat,
|
|
9755
9738
|
data: p.createHeartbeat(
|
|
9756
9739
|
p.HeartbeatMessageType.heartbeat_request,
|
|
@@ -9773,13 +9756,13 @@ p.createConnection = function(e) {
|
|
|
9773
9756
|
})), p.flush(n)), n.closed(n)), n.reset(l);
|
|
9774
9757
|
}, n;
|
|
9775
9758
|
};
|
|
9776
|
-
|
|
9777
|
-
for (var
|
|
9778
|
-
typeof p[
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9759
|
+
_.tls = _.tls || {};
|
|
9760
|
+
for (var Dr in p)
|
|
9761
|
+
typeof p[Dr] != "function" && (_.tls[Dr] = p[Dr]);
|
|
9762
|
+
_.tls.prf_tls1 = _r;
|
|
9763
|
+
_.tls.hmac_sha1 = k0;
|
|
9764
|
+
_.tls.createSessionCache = p.createSessionCache;
|
|
9765
|
+
_.tls.createConnection = p.createConnection;
|
|
9783
9766
|
var xt = z, Je = xt.tls;
|
|
9784
9767
|
Je.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA = {
|
|
9785
9768
|
id: [0, 47],
|
|
@@ -9807,24 +9790,24 @@ function Ai(e, t, a) {
|
|
|
9807
9790
|
init: !1,
|
|
9808
9791
|
cipher: xt.cipher.createCipher("AES-CBC", r ? a.keys.client_write_key : a.keys.server_write_key),
|
|
9809
9792
|
iv: r ? a.keys.client_write_IV : a.keys.server_write_IV
|
|
9810
|
-
}, e.read.cipherFunction =
|
|
9793
|
+
}, e.read.cipherFunction = ao, e.write.cipherFunction = eo, e.read.macLength = e.write.macLength = a.mac_length, e.read.macFunction = e.write.macFunction = Je.hmac_sha1;
|
|
9811
9794
|
}
|
|
9812
|
-
function
|
|
9795
|
+
function eo(e, t) {
|
|
9813
9796
|
var a = !1, r = t.macFunction(t.macKey, t.sequenceNumber, e);
|
|
9814
9797
|
e.fragment.putBytes(r), t.updateSequenceNumber();
|
|
9815
9798
|
var i;
|
|
9816
9799
|
e.version.minor === Je.Versions.TLS_1_0.minor ? i = t.cipherState.init ? null : t.cipherState.iv : i = xt.random.getBytesSync(16), t.cipherState.init = !0;
|
|
9817
9800
|
var s = t.cipherState.cipher;
|
|
9818
|
-
return s.start({ iv: i }), e.version.minor >= Je.Versions.TLS_1_1.minor && s.output.putBytes(i), s.update(e.fragment), s.finish(
|
|
9801
|
+
return s.start({ iv: i }), e.version.minor >= Je.Versions.TLS_1_1.minor && s.output.putBytes(i), s.update(e.fragment), s.finish(to) && (e.fragment = s.output, e.length = e.fragment.length(), a = !0), a;
|
|
9819
9802
|
}
|
|
9820
|
-
function
|
|
9803
|
+
function to(e, t, a) {
|
|
9821
9804
|
if (!a) {
|
|
9822
9805
|
var r = e - t.length() % e;
|
|
9823
9806
|
t.fillWithByte(r - 1, r);
|
|
9824
9807
|
}
|
|
9825
9808
|
return !0;
|
|
9826
9809
|
}
|
|
9827
|
-
function
|
|
9810
|
+
function ro(e, t, a) {
|
|
9828
9811
|
var r = !0;
|
|
9829
9812
|
if (a) {
|
|
9830
9813
|
for (var i = t.length(), s = t.last(), n = i - 1 - s; n < i - 1; ++n)
|
|
@@ -9833,41 +9816,41 @@ function ao(e, t, a) {
|
|
|
9833
9816
|
}
|
|
9834
9817
|
return r;
|
|
9835
9818
|
}
|
|
9836
|
-
function
|
|
9819
|
+
function ao(e, t) {
|
|
9837
9820
|
var a = !1, r;
|
|
9838
9821
|
e.version.minor === Je.Versions.TLS_1_0.minor ? r = t.cipherState.init ? null : t.cipherState.iv : r = e.fragment.getBytes(16), t.cipherState.init = !0;
|
|
9839
9822
|
var i = t.cipherState.cipher;
|
|
9840
|
-
i.start({ iv: r }), i.update(e.fragment), a = i.finish(
|
|
9823
|
+
i.start({ iv: r }), i.update(e.fragment), a = i.finish(ro);
|
|
9841
9824
|
var s = t.macLength, n = xt.random.getBytesSync(s), o = i.output.length();
|
|
9842
9825
|
o >= s ? (e.fragment = i.output.getBytes(o - s), n = i.output.getBytes(s)) : e.fragment = i.output.getBytes(), e.fragment = xt.util.createBuffer(e.fragment), e.length = e.fragment.length();
|
|
9843
9826
|
var f = t.macFunction(t.macKey, t.sequenceNumber, e);
|
|
9844
|
-
return t.updateSequenceNumber(), a =
|
|
9827
|
+
return t.updateSequenceNumber(), a = io(t.macKey, n, f) && a, a;
|
|
9845
9828
|
}
|
|
9846
|
-
function
|
|
9829
|
+
function io(e, t, a) {
|
|
9847
9830
|
var r = xt.hmac.create();
|
|
9848
9831
|
return r.start("SHA1", e), r.update(t), t = r.digest().getBytes(), r.start(null, null), r.update(a), a = r.digest().getBytes(), t === a;
|
|
9849
9832
|
}
|
|
9850
|
-
var le = z,
|
|
9851
|
-
le.md.sha512 = le.md.algorithms.sha512 =
|
|
9833
|
+
var le = z, rr = le.sha512 = le.sha512 || {};
|
|
9834
|
+
le.md.sha512 = le.md.algorithms.sha512 = rr;
|
|
9852
9835
|
var Bi = le.sha384 = le.sha512.sha384 = le.sha512.sha384 || {};
|
|
9853
9836
|
Bi.create = function() {
|
|
9854
|
-
return
|
|
9837
|
+
return rr.create("SHA-384");
|
|
9855
9838
|
};
|
|
9856
9839
|
le.md.sha384 = le.md.algorithms.sha384 = Bi;
|
|
9857
9840
|
le.sha512.sha256 = le.sha512.sha256 || {
|
|
9858
9841
|
create: function() {
|
|
9859
|
-
return
|
|
9842
|
+
return rr.create("SHA-512/256");
|
|
9860
9843
|
}
|
|
9861
9844
|
};
|
|
9862
9845
|
le.md["sha512/256"] = le.md.algorithms["sha512/256"] = le.sha512.sha256;
|
|
9863
9846
|
le.sha512.sha224 = le.sha512.sha224 || {
|
|
9864
9847
|
create: function() {
|
|
9865
|
-
return
|
|
9848
|
+
return rr.create("SHA-512/224");
|
|
9866
9849
|
}
|
|
9867
9850
|
};
|
|
9868
9851
|
le.md["sha512/224"] = le.md.algorithms["sha512/224"] = le.sha512.sha224;
|
|
9869
|
-
|
|
9870
|
-
if (bi ||
|
|
9852
|
+
rr.create = function(e) {
|
|
9853
|
+
if (bi || no(), typeof e > "u" && (e = "SHA-512"), !(e in bt))
|
|
9871
9854
|
throw new Error("Invalid SHA-512 algorithm: " + e);
|
|
9872
9855
|
for (var t = bt[e], a = null, r = le.util.createBuffer(), i = new Array(80), s = 0; s < 80; ++s)
|
|
9873
9856
|
i[s] = new Array(2);
|
|
@@ -9921,15 +9904,15 @@ ar.create = function(e) {
|
|
|
9921
9904
|
for (var x = new Array(a.length), y = 0; y < a.length; ++y)
|
|
9922
9905
|
x[y] = a[y].slice(0);
|
|
9923
9906
|
Oa(x, i, f);
|
|
9924
|
-
var
|
|
9907
|
+
var T = le.util.createBuffer(), I;
|
|
9925
9908
|
e === "SHA-512" ? I = x.length : e === "SHA-384" ? I = x.length - 2 : I = x.length - 4;
|
|
9926
9909
|
for (var y = 0; y < I; ++y)
|
|
9927
|
-
|
|
9928
|
-
return
|
|
9910
|
+
T.putInt32(x[y][0]), (y !== I - 1 || e !== "SHA-512/224") && T.putInt32(x[y][1]);
|
|
9911
|
+
return T;
|
|
9929
9912
|
}, o;
|
|
9930
9913
|
};
|
|
9931
9914
|
var zr = null, bi = !1, Yr = null, bt = null;
|
|
9932
|
-
function
|
|
9915
|
+
function no() {
|
|
9933
9916
|
zr = String.fromCharCode(128), zr += le.util.fillString(String.fromCharCode(0), 128), Yr = [
|
|
9934
9917
|
[1116352408, 3609767458],
|
|
9935
9918
|
[1899447441, 602891725],
|
|
@@ -10050,7 +10033,7 @@ function so() {
|
|
|
10050
10033
|
], bi = !0;
|
|
10051
10034
|
}
|
|
10052
10035
|
function Oa(e, t, a) {
|
|
10053
|
-
for (var r, i, s, n, o, f, u, l, c, v, C, y, x,
|
|
10036
|
+
for (var r, i, s, n, o, f, u, l, c, v, C, y, x, T, I, B, b, V, D, w, G, Y, re, ae, ie, he, Qe, Xe, ne, pe, F, It, Dt, ve, ye, Ce = a.length(); Ce >= 128; ) {
|
|
10054
10037
|
for (ne = 0; ne < 16; ++ne)
|
|
10055
10038
|
t[ne][0] = a.getInt32() >>> 0, t[ne][1] = a.getInt32() >>> 0;
|
|
10056
10039
|
for (; ne < 80; ++ne)
|
|
@@ -10063,20 +10046,20 @@ function Oa(e, t, a) {
|
|
|
10063
10046
|
pe >>> 7) >>> 0, n = ((pe << 31 | F >>> 1) ^ // ROTR 1
|
|
10064
10047
|
(pe << 24 | F >>> 8) ^ // ROTR 8
|
|
10065
10048
|
(pe << 25 | F >>> 7)) >>> 0, Dt = t[ne - 7], ye = t[ne - 16], F = i + Dt[1] + n + ye[1], t[ne][0] = r + Dt[0] + s + ye[0] + (F / 4294967296 >>> 0) >>> 0, t[ne][1] = F >>> 0;
|
|
10066
|
-
for (x = e[0][0],
|
|
10049
|
+
for (x = e[0][0], T = e[0][1], I = e[1][0], B = e[1][1], b = e[2][0], V = e[2][1], D = e[3][0], w = e[3][1], G = e[4][0], Y = e[4][1], re = e[5][0], ae = e[5][1], ie = e[6][0], he = e[6][1], Qe = e[7][0], Xe = e[7][1], ne = 0; ne < 80; ++ne)
|
|
10067
10050
|
u = ((G >>> 14 | Y << 18) ^ // ROTR 14
|
|
10068
10051
|
(G >>> 18 | Y << 14) ^ // ROTR 18
|
|
10069
10052
|
(Y >>> 9 | G << 23)) >>> 0, l = ((G << 18 | Y >>> 14) ^ // ROTR 14
|
|
10070
10053
|
(G << 14 | Y >>> 18) ^ // ROTR 18
|
|
10071
|
-
(Y << 23 | G >>> 9)) >>> 0, c = (ie ^ G & (re ^ ie)) >>> 0, v = (he ^ Y & (ae ^ he)) >>> 0, o = ((x >>> 28 |
|
|
10072
|
-
(
|
|
10073
|
-
(
|
|
10074
|
-
(
|
|
10075
|
-
(
|
|
10076
|
-
F = e[0][1] +
|
|
10054
|
+
(Y << 23 | G >>> 9)) >>> 0, c = (ie ^ G & (re ^ ie)) >>> 0, v = (he ^ Y & (ae ^ he)) >>> 0, o = ((x >>> 28 | T << 4) ^ // ROTR 28
|
|
10055
|
+
(T >>> 2 | x << 30) ^ // ROTR 34/(swap + ROTR 2)
|
|
10056
|
+
(T >>> 7 | x << 25)) >>> 0, f = ((x << 4 | T >>> 28) ^ // ROTR 28
|
|
10057
|
+
(T << 30 | x >>> 2) ^ // ROTR 34/(swap + ROTR 2)
|
|
10058
|
+
(T << 25 | x >>> 7)) >>> 0, C = (x & I | b & (x ^ I)) >>> 0, y = (T & B | V & (T ^ B)) >>> 0, F = Xe + l + v + Yr[ne][1] + t[ne][1], r = Qe + u + c + Yr[ne][0] + t[ne][0] + (F / 4294967296 >>> 0) >>> 0, i = F >>> 0, F = f + y, s = o + C + (F / 4294967296 >>> 0) >>> 0, n = F >>> 0, Qe = ie, Xe = he, ie = re, he = ae, re = G, ae = Y, F = w + i, G = D + r + (F / 4294967296 >>> 0) >>> 0, Y = F >>> 0, D = b, w = V, b = I, V = B, I = x, B = T, F = i + n, x = r + s + (F / 4294967296 >>> 0) >>> 0, T = F >>> 0;
|
|
10059
|
+
F = e[0][1] + T, e[0][0] = e[0][0] + x + (F / 4294967296 >>> 0) >>> 0, e[0][1] = F >>> 0, F = e[1][1] + B, e[1][0] = e[1][0] + I + (F / 4294967296 >>> 0) >>> 0, e[1][1] = F >>> 0, F = e[2][1] + V, e[2][0] = e[2][0] + b + (F / 4294967296 >>> 0) >>> 0, e[2][1] = F >>> 0, F = e[3][1] + w, e[3][0] = e[3][0] + D + (F / 4294967296 >>> 0) >>> 0, e[3][1] = F >>> 0, F = e[4][1] + Y, e[4][0] = e[4][0] + G + (F / 4294967296 >>> 0) >>> 0, e[4][1] = F >>> 0, F = e[5][1] + ae, e[5][0] = e[5][0] + re + (F / 4294967296 >>> 0) >>> 0, e[5][1] = F >>> 0, F = e[6][1] + he, e[6][0] = e[6][0] + ie + (F / 4294967296 >>> 0) >>> 0, e[6][1] = F >>> 0, F = e[7][1] + Xe, e[7][0] = e[7][0] + Qe + (F / 4294967296 >>> 0) >>> 0, e[7][1] = F >>> 0, Ce -= 128;
|
|
10077
10060
|
}
|
|
10078
10061
|
}
|
|
10079
|
-
var pa = {},
|
|
10062
|
+
var pa = {}, so = z, Ee = so.asn1;
|
|
10080
10063
|
pa.privateKeyValidator = {
|
|
10081
10064
|
// PrivateKeyInfo
|
|
10082
10065
|
name: "PrivateKeyInfo",
|
|
@@ -10160,9 +10143,9 @@ pa.publicKeyValidator = {
|
|
|
10160
10143
|
} */
|
|
10161
10144
|
]
|
|
10162
10145
|
};
|
|
10163
|
-
var Ae = z, _i = pa,
|
|
10164
|
-
if (typeof
|
|
10165
|
-
var
|
|
10146
|
+
var Ae = z, _i = pa, oo = _i.publicKeyValidator, uo = _i.privateKeyValidator;
|
|
10147
|
+
if (typeof fo > "u")
|
|
10148
|
+
var fo = Ae.jsbn.BigInteger;
|
|
10166
10149
|
var Xr = Ae.util.ByteBuffer, qe = typeof Buffer > "u" ? Uint8Array : Buffer;
|
|
10167
10150
|
Ae.pki = Ae.pki || {};
|
|
10168
10151
|
Ae.pki.ed25519 = Ae.ed25519 = Ae.ed25519 || {};
|
|
@@ -10190,10 +10173,10 @@ W.generateKeyPair = function(e) {
|
|
|
10190
10173
|
t = dt({ message: t, encoding: "binary" });
|
|
10191
10174
|
for (var a = new qe(W.constants.PUBLIC_KEY_BYTE_LENGTH), r = new qe(W.constants.PRIVATE_KEY_BYTE_LENGTH), i = 0; i < 32; ++i)
|
|
10192
10175
|
r[i] = t[i];
|
|
10193
|
-
return
|
|
10176
|
+
return po(a, r), { publicKey: a, privateKey: r };
|
|
10194
10177
|
};
|
|
10195
10178
|
W.privateKeyFromAsn1 = function(e) {
|
|
10196
|
-
var t = {}, a = [], r = Ae.asn1.validate(e,
|
|
10179
|
+
var t = {}, a = [], r = Ae.asn1.validate(e, uo, t, a);
|
|
10197
10180
|
if (!r) {
|
|
10198
10181
|
var i = new Error("Invalid Key.");
|
|
10199
10182
|
throw i.errors = a, i;
|
|
@@ -10208,7 +10191,7 @@ W.privateKeyFromAsn1 = function(e) {
|
|
|
10208
10191
|
return { privateKeyBytes: f };
|
|
10209
10192
|
};
|
|
10210
10193
|
W.publicKeyFromAsn1 = function(e) {
|
|
10211
|
-
var t = {}, a = [], r = Ae.asn1.validate(e,
|
|
10194
|
+
var t = {}, a = [], r = Ae.asn1.validate(e, oo, t, a);
|
|
10212
10195
|
if (!r) {
|
|
10213
10196
|
var i = new Error("Invalid Key.");
|
|
10214
10197
|
throw i.errors = a, i;
|
|
@@ -10254,7 +10237,7 @@ W.sign = function(e) {
|
|
|
10254
10237
|
var i = new qe(
|
|
10255
10238
|
W.constants.SIGN_BYTE_LENGTH + t.length
|
|
10256
10239
|
);
|
|
10257
|
-
|
|
10240
|
+
vo(i, t, t.length, a);
|
|
10258
10241
|
for (var s = new qe(W.constants.SIGN_BYTE_LENGTH), n = 0; n < s.length; ++n)
|
|
10259
10242
|
s[n] = i[n];
|
|
10260
10243
|
return s;
|
|
@@ -10287,7 +10270,7 @@ W.verify = function(e) {
|
|
|
10287
10270
|
i[n] = a[n];
|
|
10288
10271
|
for (n = 0; n < t.length; ++n)
|
|
10289
10272
|
i[n + W.constants.SIGN_BYTE_LENGTH] = t[n];
|
|
10290
|
-
return
|
|
10273
|
+
return yo(s, i, i.length, r) >= 0;
|
|
10291
10274
|
};
|
|
10292
10275
|
function dt(e) {
|
|
10293
10276
|
var t = e.message;
|
|
@@ -10313,7 +10296,7 @@ function dt(e) {
|
|
|
10313
10296
|
r[i] = t.at(i);
|
|
10314
10297
|
return r;
|
|
10315
10298
|
}
|
|
10316
|
-
var Wr = H(),
|
|
10299
|
+
var Wr = H(), gr = H([1]), lo = H([
|
|
10317
10300
|
30883,
|
|
10318
10301
|
4953,
|
|
10319
10302
|
19914,
|
|
@@ -10330,7 +10313,7 @@ var Wr = H(), Cr = H([1]), co = H([
|
|
|
10330
10313
|
11119,
|
|
10331
10314
|
27886,
|
|
10332
10315
|
20995
|
|
10333
|
-
]),
|
|
10316
|
+
]), co = H([
|
|
10334
10317
|
61785,
|
|
10335
10318
|
9906,
|
|
10336
10319
|
39828,
|
|
@@ -10381,7 +10364,7 @@ var Wr = H(), Cr = H([1]), co = H([
|
|
|
10381
10364
|
26214,
|
|
10382
10365
|
26214,
|
|
10383
10366
|
26214
|
|
10384
|
-
]),
|
|
10367
|
+
]), kr = new Float64Array([
|
|
10385
10368
|
237,
|
|
10386
10369
|
211,
|
|
10387
10370
|
245,
|
|
@@ -10414,7 +10397,7 @@ var Wr = H(), Cr = H([1]), co = H([
|
|
|
10414
10397
|
0,
|
|
10415
10398
|
0,
|
|
10416
10399
|
16
|
|
10417
|
-
]),
|
|
10400
|
+
]), ho = H([
|
|
10418
10401
|
41136,
|
|
10419
10402
|
18958,
|
|
10420
10403
|
6951,
|
|
@@ -10432,7 +10415,7 @@ var Wr = H(), Cr = H([1]), co = H([
|
|
|
10432
10415
|
9344,
|
|
10433
10416
|
11139
|
|
10434
10417
|
]);
|
|
10435
|
-
function
|
|
10418
|
+
function $t(e, t) {
|
|
10436
10419
|
var a = Ae.md.sha512.create(), r = new Xr(e);
|
|
10437
10420
|
a.update(r.getBytes(t), "binary");
|
|
10438
10421
|
var i = a.digest().getBytes();
|
|
@@ -10442,24 +10425,24 @@ function Zt(e, t) {
|
|
|
10442
10425
|
s[n] = i.charCodeAt(n);
|
|
10443
10426
|
return s;
|
|
10444
10427
|
}
|
|
10445
|
-
function
|
|
10446
|
-
var a = [H(), H(), H(), H()], r, i =
|
|
10428
|
+
function po(e, t) {
|
|
10429
|
+
var a = [H(), H(), H(), H()], r, i = $t(t, 32);
|
|
10447
10430
|
for (i[0] &= 248, i[31] &= 127, i[31] |= 64, ya(a, i), va(e, a), r = 0; r < 32; ++r)
|
|
10448
10431
|
t[r + 32] = e[r];
|
|
10449
10432
|
return 0;
|
|
10450
10433
|
}
|
|
10451
|
-
function
|
|
10452
|
-
var i, s, n = new Float64Array(64), o = [H(), H(), H(), H()], f =
|
|
10434
|
+
function vo(e, t, a, r) {
|
|
10435
|
+
var i, s, n = new Float64Array(64), o = [H(), H(), H(), H()], f = $t(r, 32);
|
|
10453
10436
|
f[0] &= 248, f[31] &= 127, f[31] |= 64;
|
|
10454
10437
|
var u = a + 64;
|
|
10455
10438
|
for (i = 0; i < a; ++i)
|
|
10456
10439
|
e[64 + i] = t[i];
|
|
10457
10440
|
for (i = 0; i < 32; ++i)
|
|
10458
10441
|
e[32 + i] = f[32 + i];
|
|
10459
|
-
var l =
|
|
10442
|
+
var l = $t(e.subarray(32), a + 32);
|
|
10460
10443
|
for (jr(l), ya(o, l), va(e, o), i = 32; i < 64; ++i)
|
|
10461
10444
|
e[i] = r[i];
|
|
10462
|
-
var c =
|
|
10445
|
+
var c = $t(e, a + 64);
|
|
10463
10446
|
for (jr(c), i = 32; i < 64; ++i)
|
|
10464
10447
|
n[i] = 0;
|
|
10465
10448
|
for (i = 0; i < 32; ++i)
|
|
@@ -10469,15 +10452,15 @@ function yo(e, t, a, r) {
|
|
|
10469
10452
|
n[i + s] += c[i] * f[s];
|
|
10470
10453
|
return Ni(e.subarray(32), n), u;
|
|
10471
10454
|
}
|
|
10472
|
-
function
|
|
10455
|
+
function yo(e, t, a, r) {
|
|
10473
10456
|
var i, s, n = new qe(32), o = [H(), H(), H(), H()], f = [H(), H(), H(), H()];
|
|
10474
|
-
if (s = -1, a < 64 ||
|
|
10457
|
+
if (s = -1, a < 64 || go(f, r))
|
|
10475
10458
|
return -1;
|
|
10476
10459
|
for (i = 0; i < a; ++i)
|
|
10477
10460
|
e[i] = t[i];
|
|
10478
10461
|
for (i = 0; i < 32; ++i)
|
|
10479
10462
|
e[i + 32] = r[i];
|
|
10480
|
-
var u =
|
|
10463
|
+
var u = $t(e, a);
|
|
10481
10464
|
if (jr(u), Li(o, f, u), ya(f, t.subarray(32)), $r(o, f), va(n, o), a -= 64, Ri(t, 0, n, 0)) {
|
|
10482
10465
|
for (i = 0; i < a; ++i)
|
|
10483
10466
|
e[i] = 0;
|
|
@@ -10487,27 +10470,17 @@ function go(e, t, a, r) {
|
|
|
10487
10470
|
e[i] = t[i + 64];
|
|
10488
10471
|
return s = a, s;
|
|
10489
10472
|
}
|
|
10490
|
-
function Co(e, t) {
|
|
10491
|
-
var a;
|
|
10492
|
-
for (a = 31; a >= 0; --a) {
|
|
10493
|
-
if (e[t + a] < $t[a])
|
|
10494
|
-
return !0;
|
|
10495
|
-
if (e[t + a] > $t[a])
|
|
10496
|
-
return !1;
|
|
10497
|
-
}
|
|
10498
|
-
return !1;
|
|
10499
|
-
}
|
|
10500
10473
|
function Ni(e, t) {
|
|
10501
10474
|
var a, r, i, s;
|
|
10502
10475
|
for (r = 63; r >= 32; --r) {
|
|
10503
10476
|
for (a = 0, i = r - 32, s = r - 12; i < s; ++i)
|
|
10504
|
-
t[i] += a - 16 * t[r] *
|
|
10477
|
+
t[i] += a - 16 * t[r] * kr[i - (r - 32)], a = t[i] + 128 >> 8, t[i] -= a * 256;
|
|
10505
10478
|
t[i] += a, t[r] = 0;
|
|
10506
10479
|
}
|
|
10507
10480
|
for (a = 0, i = 0; i < 32; ++i)
|
|
10508
|
-
t[i] += a - (t[31] >> 4) *
|
|
10481
|
+
t[i] += a - (t[31] >> 4) * kr[i], a = t[i] >> 8, t[i] &= 255;
|
|
10509
10482
|
for (i = 0; i < 32; ++i)
|
|
10510
|
-
t[i] -= a *
|
|
10483
|
+
t[i] -= a * kr[i];
|
|
10511
10484
|
for (r = 0; r < 32; ++r)
|
|
10512
10485
|
t[r + 1] += t[r] >> 8, e[r] = t[r] & 255;
|
|
10513
10486
|
}
|
|
@@ -10518,7 +10491,7 @@ function jr(e) {
|
|
|
10518
10491
|
}
|
|
10519
10492
|
function $r(e, t) {
|
|
10520
10493
|
var a = H(), r = H(), i = H(), s = H(), n = H(), o = H(), f = H(), u = H(), l = H();
|
|
10521
|
-
Vt(a, e[1], e[0]), Vt(l, t[1], t[0]), se(a, a, l), Ut(r, e[0], e[1]), Ut(l, t[0], t[1]), se(r, r, l), se(i, e[3], t[3]), se(i, i,
|
|
10494
|
+
Vt(a, e[1], e[0]), Vt(l, t[1], t[0]), se(a, a, l), Ut(r, e[0], e[1]), Ut(l, t[0], t[1]), se(r, r, l), se(i, e[3], t[3]), se(i, i, co), se(s, e[2], t[2]), Ut(s, s, s), Vt(n, r, a), Vt(o, s, i), Ut(f, s, i), Ut(u, r, a), se(e[0], n, o), se(e[1], u, f), se(e[2], f, o), se(e[3], n, u);
|
|
10522
10495
|
}
|
|
10523
10496
|
function Ma(e, t, a) {
|
|
10524
10497
|
for (var r = 0; r < 4; ++r)
|
|
@@ -10526,9 +10499,9 @@ function Ma(e, t, a) {
|
|
|
10526
10499
|
}
|
|
10527
10500
|
function va(e, t) {
|
|
10528
10501
|
var a = H(), r = H(), i = H();
|
|
10529
|
-
|
|
10502
|
+
xo(i, t[2]), se(a, t[0], i), se(r, t[1], i), Cr(e, r), e[31] ^= wi(a) << 7;
|
|
10530
10503
|
}
|
|
10531
|
-
function
|
|
10504
|
+
function Cr(e, t) {
|
|
10532
10505
|
var a, r, i, s = H(), n = H();
|
|
10533
10506
|
for (a = 0; a < 16; ++a)
|
|
10534
10507
|
n[a] = t[a];
|
|
@@ -10540,17 +10513,17 @@ function mr(e, t) {
|
|
|
10540
10513
|
for (a = 0; a < 16; a++)
|
|
10541
10514
|
e[2 * a] = n[a] & 255, e[2 * a + 1] = n[a] >> 8;
|
|
10542
10515
|
}
|
|
10543
|
-
function
|
|
10516
|
+
function go(e, t) {
|
|
10544
10517
|
var a = H(), r = H(), i = H(), s = H(), n = H(), o = H(), f = H();
|
|
10545
|
-
return mt(e[2],
|
|
10518
|
+
return mt(e[2], gr), Co(e[1], t), _t(i, e[1]), se(s, i, lo), Vt(i, i, e[2]), Ut(s, e[2], s), _t(n, s), _t(o, n), se(f, o, n), se(a, f, i), se(a, a, s), mo(a, a), se(a, a, i), se(a, a, s), se(a, a, s), se(e[0], a, s), _t(r, e[0]), se(r, r, s), Ha(r, i) && se(e[0], e[0], ho), _t(r, e[0]), se(r, r, s), Ha(r, i) ? -1 : (wi(e[0]) === t[31] >> 7 && Vt(e[0], Wr, e[0]), se(e[3], e[0], e[1]), 0);
|
|
10546
10519
|
}
|
|
10547
|
-
function
|
|
10520
|
+
function Co(e, t) {
|
|
10548
10521
|
var a;
|
|
10549
10522
|
for (a = 0; a < 16; ++a)
|
|
10550
10523
|
e[a] = t[2 * a] + (t[2 * a + 1] << 8);
|
|
10551
10524
|
e[15] &= 32767;
|
|
10552
10525
|
}
|
|
10553
|
-
function
|
|
10526
|
+
function mo(e, t) {
|
|
10554
10527
|
var a = H(), r;
|
|
10555
10528
|
for (r = 0; r < 16; ++r)
|
|
10556
10529
|
a[r] = t[r];
|
|
@@ -10561,12 +10534,12 @@ function xo(e, t) {
|
|
|
10561
10534
|
}
|
|
10562
10535
|
function Ha(e, t) {
|
|
10563
10536
|
var a = new qe(32), r = new qe(32);
|
|
10564
|
-
return
|
|
10537
|
+
return Cr(a, e), Cr(r, t), Ri(a, 0, r, 0);
|
|
10565
10538
|
}
|
|
10566
10539
|
function Ri(e, t, a, r) {
|
|
10567
|
-
return
|
|
10540
|
+
return Eo(e, t, a, r, 32);
|
|
10568
10541
|
}
|
|
10569
|
-
function
|
|
10542
|
+
function Eo(e, t, a, r, i) {
|
|
10570
10543
|
var s, n = 0;
|
|
10571
10544
|
for (s = 0; s < i; ++s)
|
|
10572
10545
|
n |= e[t + s] ^ a[r + s];
|
|
@@ -10574,23 +10547,23 @@ function So(e, t, a, r, i) {
|
|
|
10574
10547
|
}
|
|
10575
10548
|
function wi(e) {
|
|
10576
10549
|
var t = new qe(32);
|
|
10577
|
-
return
|
|
10550
|
+
return Cr(t, e), t[0] & 1;
|
|
10578
10551
|
}
|
|
10579
10552
|
function Li(e, t, a) {
|
|
10580
10553
|
var r, i;
|
|
10581
|
-
for (mt(e[0], Wr), mt(e[1],
|
|
10554
|
+
for (mt(e[0], Wr), mt(e[1], gr), mt(e[2], gr), mt(e[3], Wr), i = 255; i >= 0; --i)
|
|
10582
10555
|
r = a[i / 8 | 0] >> (i & 7) & 1, Ma(e, t, r), $r(t, e), $r(e, e), Ma(e, t, r);
|
|
10583
10556
|
}
|
|
10584
10557
|
function ya(e, t) {
|
|
10585
10558
|
var a = [H(), H(), H(), H()];
|
|
10586
|
-
mt(a[0], Fa), mt(a[1], Ka), mt(a[2],
|
|
10559
|
+
mt(a[0], Fa), mt(a[1], Ka), mt(a[2], gr), se(a[3], Fa, Ka), Li(e, a, t);
|
|
10587
10560
|
}
|
|
10588
10561
|
function mt(e, t) {
|
|
10589
10562
|
var a;
|
|
10590
10563
|
for (a = 0; a < 16; a++)
|
|
10591
10564
|
e[a] = t[a] | 0;
|
|
10592
10565
|
}
|
|
10593
|
-
function
|
|
10566
|
+
function xo(e, t) {
|
|
10594
10567
|
var a = H(), r;
|
|
10595
10568
|
for (r = 0; r < 16; ++r)
|
|
10596
10569
|
a[r] = t[r];
|
|
@@ -10628,8 +10601,8 @@ function _t(e, t) {
|
|
|
10628
10601
|
se(e, t, t);
|
|
10629
10602
|
}
|
|
10630
10603
|
function se(e, t, a) {
|
|
10631
|
-
var r, i, s = 0, n = 0, o = 0, f = 0, u = 0, l = 0, c = 0, v = 0, C = 0, y = 0, x = 0,
|
|
10632
|
-
r = t[0], s += r * ve, n += r * ye, o += r * Ce, f += r * Be, u += r * be, l += r * _e, c += r * Ne, v += r * Re, C += r * we, y += r * Le, x += r * De,
|
|
10604
|
+
var r, i, s = 0, n = 0, o = 0, f = 0, u = 0, l = 0, c = 0, v = 0, C = 0, y = 0, x = 0, T = 0, I = 0, B = 0, b = 0, V = 0, D = 0, w = 0, G = 0, Y = 0, re = 0, ae = 0, ie = 0, he = 0, Qe = 0, Xe = 0, ne = 0, pe = 0, F = 0, It = 0, Dt = 0, ve = a[0], ye = a[1], Ce = a[2], Be = a[3], be = a[4], _e = a[5], Ne = a[6], Re = a[7], we = a[8], Le = a[9], De = a[10], ke = a[11], Ue = a[12], Pe = a[13], Ve = a[14], Oe = a[15];
|
|
10605
|
+
r = t[0], s += r * ve, n += r * ye, o += r * Ce, f += r * Be, u += r * be, l += r * _e, c += r * Ne, v += r * Re, C += r * we, y += r * Le, x += r * De, T += r * ke, I += r * Ue, B += r * Pe, b += r * Ve, V += r * Oe, r = t[1], n += r * ve, o += r * ye, f += r * Ce, u += r * Be, l += r * be, c += r * _e, v += r * Ne, C += r * Re, y += r * we, x += r * Le, T += r * De, I += r * ke, B += r * Ue, b += r * Pe, V += r * Ve, D += r * Oe, r = t[2], o += r * ve, f += r * ye, u += r * Ce, l += r * Be, c += r * be, v += r * _e, C += r * Ne, y += r * Re, x += r * we, T += r * Le, I += r * De, B += r * ke, b += r * Ue, V += r * Pe, D += r * Ve, w += r * Oe, r = t[3], f += r * ve, u += r * ye, l += r * Ce, c += r * Be, v += r * be, C += r * _e, y += r * Ne, x += r * Re, T += r * we, I += r * Le, B += r * De, b += r * ke, V += r * Ue, D += r * Pe, w += r * Ve, G += r * Oe, r = t[4], u += r * ve, l += r * ye, c += r * Ce, v += r * Be, C += r * be, y += r * _e, x += r * Ne, T += r * Re, I += r * we, B += r * Le, b += r * De, V += r * ke, D += r * Ue, w += r * Pe, G += r * Ve, Y += r * Oe, r = t[5], l += r * ve, c += r * ye, v += r * Ce, C += r * Be, y += r * be, x += r * _e, T += r * Ne, I += r * Re, B += r * we, b += r * Le, V += r * De, D += r * ke, w += r * Ue, G += r * Pe, Y += r * Ve, re += r * Oe, r = t[6], c += r * ve, v += r * ye, C += r * Ce, y += r * Be, x += r * be, T += r * _e, I += r * Ne, B += r * Re, b += r * we, V += r * Le, D += r * De, w += r * ke, G += r * Ue, Y += r * Pe, re += r * Ve, ae += r * Oe, r = t[7], v += r * ve, C += r * ye, y += r * Ce, x += r * Be, T += r * be, I += r * _e, B += r * Ne, b += r * Re, V += r * we, D += r * Le, w += r * De, G += r * ke, Y += r * Ue, re += r * Pe, ae += r * Ve, ie += r * Oe, r = t[8], C += r * ve, y += r * ye, x += r * Ce, T += r * Be, I += r * be, B += r * _e, b += r * Ne, V += r * Re, D += r * we, w += r * Le, G += r * De, Y += r * ke, re += r * Ue, ae += r * Pe, ie += r * Ve, he += r * Oe, r = t[9], y += r * ve, x += r * ye, T += r * Ce, I += r * Be, B += r * be, b += r * _e, V += r * Ne, D += r * Re, w += r * we, G += r * Le, Y += r * De, re += r * ke, ae += r * Ue, ie += r * Pe, he += r * Ve, Qe += r * Oe, r = t[10], x += r * ve, T += r * ye, I += r * Ce, B += r * Be, b += r * be, V += r * _e, D += r * Ne, w += r * Re, G += r * we, Y += r * Le, re += r * De, ae += r * ke, ie += r * Ue, he += r * Pe, Qe += r * Ve, Xe += r * Oe, r = t[11], T += r * ve, I += r * ye, B += r * Ce, b += r * Be, V += r * be, D += r * _e, w += r * Ne, G += r * Re, Y += r * we, re += r * Le, ae += r * De, ie += r * ke, he += r * Ue, Qe += r * Pe, Xe += r * Ve, ne += r * Oe, r = t[12], I += r * ve, B += r * ye, b += r * Ce, V += r * Be, D += r * be, w += r * _e, G += r * Ne, Y += r * Re, re += r * we, ae += r * Le, ie += r * De, he += r * ke, Qe += r * Ue, Xe += r * Pe, ne += r * Ve, pe += r * Oe, r = t[13], B += r * ve, b += r * ye, V += r * Ce, D += r * Be, w += r * be, G += r * _e, Y += r * Ne, re += r * Re, ae += r * we, ie += r * Le, he += r * De, Qe += r * ke, Xe += r * Ue, ne += r * Pe, pe += r * Ve, F += r * Oe, r = t[14], b += r * ve, V += r * ye, D += r * Ce, w += r * Be, G += r * be, Y += r * _e, re += r * Ne, ae += r * Re, ie += r * we, he += r * Le, Qe += r * De, Xe += r * ke, ne += r * Ue, pe += r * Pe, F += r * Ve, It += r * Oe, r = t[15], V += r * ve, D += r * ye, w += r * Ce, G += r * Be, Y += r * be, re += r * _e, ae += r * Ne, ie += r * Re, he += r * we, Qe += r * Le, Xe += r * De, ne += r * ke, pe += r * Ue, F += r * Pe, It += r * Ve, Dt += r * Oe, s += 38 * D, n += 38 * w, o += 38 * G, f += 38 * Y, u += 38 * re, l += 38 * ae, c += 38 * ie, v += 38 * he, C += 38 * Qe, y += 38 * Xe, x += 38 * ne, T += 38 * pe, I += 38 * F, B += 38 * It, b += 38 * Dt, i = 1, r = s + i + 65535, i = Math.floor(r / 65536), s = r - i * 65536, r = n + i + 65535, i = Math.floor(r / 65536), n = r - i * 65536, r = o + i + 65535, i = Math.floor(r / 65536), o = r - i * 65536, r = f + i + 65535, i = Math.floor(r / 65536), f = r - i * 65536, r = u + i + 65535, i = Math.floor(r / 65536), u = r - i * 65536, r = l + i + 65535, i = Math.floor(r / 65536), l = r - i * 65536, r = c + i + 65535, i = Math.floor(r / 65536), c = r - i * 65536, r = v + i + 65535, i = Math.floor(r / 65536), v = r - i * 65536, r = C + i + 65535, i = Math.floor(r / 65536), C = r - i * 65536, r = y + i + 65535, i = Math.floor(r / 65536), y = r - i * 65536, r = x + i + 65535, i = Math.floor(r / 65536), x = r - i * 65536, r = T + i + 65535, i = Math.floor(r / 65536), T = r - i * 65536, r = I + i + 65535, i = Math.floor(r / 65536), I = r - i * 65536, r = B + i + 65535, i = Math.floor(r / 65536), B = r - i * 65536, r = b + i + 65535, i = Math.floor(r / 65536), b = r - i * 65536, r = V + i + 65535, i = Math.floor(r / 65536), V = r - i * 65536, s += i - 1 + 37 * (i - 1), i = 1, r = s + i + 65535, i = Math.floor(r / 65536), s = r - i * 65536, r = n + i + 65535, i = Math.floor(r / 65536), n = r - i * 65536, r = o + i + 65535, i = Math.floor(r / 65536), o = r - i * 65536, r = f + i + 65535, i = Math.floor(r / 65536), f = r - i * 65536, r = u + i + 65535, i = Math.floor(r / 65536), u = r - i * 65536, r = l + i + 65535, i = Math.floor(r / 65536), l = r - i * 65536, r = c + i + 65535, i = Math.floor(r / 65536), c = r - i * 65536, r = v + i + 65535, i = Math.floor(r / 65536), v = r - i * 65536, r = C + i + 65535, i = Math.floor(r / 65536), C = r - i * 65536, r = y + i + 65535, i = Math.floor(r / 65536), y = r - i * 65536, r = x + i + 65535, i = Math.floor(r / 65536), x = r - i * 65536, r = T + i + 65535, i = Math.floor(r / 65536), T = r - i * 65536, r = I + i + 65535, i = Math.floor(r / 65536), I = r - i * 65536, r = B + i + 65535, i = Math.floor(r / 65536), B = r - i * 65536, r = b + i + 65535, i = Math.floor(r / 65536), b = r - i * 65536, r = V + i + 65535, i = Math.floor(r / 65536), V = r - i * 65536, s += i - 1 + 37 * (i - 1), e[0] = s, e[1] = n, e[2] = o, e[3] = f, e[4] = u, e[5] = l, e[6] = c, e[7] = v, e[8] = C, e[9] = y, e[10] = x, e[11] = T, e[12] = I, e[13] = B, e[14] = b, e[15] = V;
|
|
10633
10606
|
}
|
|
10634
10607
|
var Ye = z;
|
|
10635
10608
|
Ye.kem = Ye.kem || {};
|
|
@@ -10683,30 +10656,30 @@ $.log.levels = [
|
|
|
10683
10656
|
"verbose",
|
|
10684
10657
|
"max"
|
|
10685
10658
|
];
|
|
10686
|
-
var
|
|
10659
|
+
var mr = {}, Zr = [], Zt = null;
|
|
10687
10660
|
$.log.LEVEL_LOCKED = 2;
|
|
10688
10661
|
$.log.NO_LEVEL_CHECK = 4;
|
|
10689
10662
|
$.log.INTERPOLATE = 8;
|
|
10690
10663
|
for (var Et = 0; Et < $.log.levels.length; ++Et) {
|
|
10691
10664
|
var qa = $.log.levels[Et];
|
|
10692
|
-
|
|
10665
|
+
mr[qa] = {
|
|
10693
10666
|
index: Et,
|
|
10694
10667
|
name: qa.toUpperCase()
|
|
10695
10668
|
};
|
|
10696
10669
|
}
|
|
10697
10670
|
$.log.logMessage = function(e) {
|
|
10698
|
-
for (var t =
|
|
10671
|
+
for (var t = mr[e.level].index, a = 0; a < Zr.length; ++a) {
|
|
10699
10672
|
var r = Zr[a];
|
|
10700
10673
|
if (r.flags & $.log.NO_LEVEL_CHECK)
|
|
10701
10674
|
r.f(e);
|
|
10702
10675
|
else {
|
|
10703
|
-
var i =
|
|
10676
|
+
var i = mr[r.level].index;
|
|
10704
10677
|
t <= i && r.f(r, e);
|
|
10705
10678
|
}
|
|
10706
10679
|
}
|
|
10707
10680
|
};
|
|
10708
10681
|
$.log.prepareStandard = function(e) {
|
|
10709
|
-
"standard" in e || (e.standard =
|
|
10682
|
+
"standard" in e || (e.standard = mr[e.level].name + //' ' + +message.timestamp +
|
|
10710
10683
|
" [" + e.category + "] " + e.message);
|
|
10711
10684
|
};
|
|
10712
10685
|
$.log.prepareFull = function(e) {
|
|
@@ -10762,7 +10735,7 @@ $.log.addLogger = function(e) {
|
|
|
10762
10735
|
if (typeof console < "u" && "log" in console) {
|
|
10763
10736
|
var Yt;
|
|
10764
10737
|
if (console.error && console.warn && console.info && console.debug) {
|
|
10765
|
-
var
|
|
10738
|
+
var So = {
|
|
10766
10739
|
error: console.error,
|
|
10767
10740
|
warning: console.warn,
|
|
10768
10741
|
info: console.info,
|
|
@@ -10770,7 +10743,7 @@ if (typeof console < "u" && "log" in console) {
|
|
|
10770
10743
|
verbose: console.debug
|
|
10771
10744
|
}, ga = function(e, t) {
|
|
10772
10745
|
$.log.prepareStandard(t);
|
|
10773
|
-
var a =
|
|
10746
|
+
var a = So[t.level], r = [t.standard];
|
|
10774
10747
|
r = r.concat(t.arguments.slice()), a.apply(console, r);
|
|
10775
10748
|
};
|
|
10776
10749
|
Yt = $.log.makeLogger(ga);
|
|
@@ -10780,23 +10753,23 @@ if (typeof console < "u" && "log" in console) {
|
|
|
10780
10753
|
};
|
|
10781
10754
|
Yt = $.log.makeLogger(ga);
|
|
10782
10755
|
}
|
|
10783
|
-
$.log.setLevel(Yt, "debug"), $.log.addLogger(Yt),
|
|
10756
|
+
$.log.setLevel(Yt, "debug"), $.log.addLogger(Yt), Zt = Yt;
|
|
10784
10757
|
} else
|
|
10785
10758
|
console = {
|
|
10786
10759
|
log: function() {
|
|
10787
10760
|
}
|
|
10788
10761
|
};
|
|
10789
|
-
if (
|
|
10790
|
-
var
|
|
10791
|
-
if (
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
),
|
|
10795
|
-
var
|
|
10796
|
-
|
|
10762
|
+
if (Zt !== null && typeof window < "u" && window.location) {
|
|
10763
|
+
var nr = new URL(window.location.href).searchParams;
|
|
10764
|
+
if (nr.has("console.level") && $.log.setLevel(
|
|
10765
|
+
Zt,
|
|
10766
|
+
nr.get("console.level").slice(-1)[0]
|
|
10767
|
+
), nr.has("console.lock")) {
|
|
10768
|
+
var To = nr.get("console.lock").slice(-1)[0];
|
|
10769
|
+
To == "true" && $.log.lock(Zt);
|
|
10797
10770
|
}
|
|
10798
10771
|
}
|
|
10799
|
-
$.log.consoleLogger =
|
|
10772
|
+
$.log.consoleLogger = Zt;
|
|
10800
10773
|
var k = z, m = k.asn1, He = k.pkcs7 = k.pkcs7 || {};
|
|
10801
10774
|
He.messageFromPem = function(e) {
|
|
10802
10775
|
var t = k.pem.decode(e)[0];
|
|
@@ -11121,7 +11094,7 @@ He.createSignedData = function() {
|
|
|
11121
11094
|
}
|
|
11122
11095
|
l.signature = l.key.sign(l.md, "RSASSA-PKCS1-V1_5");
|
|
11123
11096
|
}
|
|
11124
|
-
e.signerInfos =
|
|
11097
|
+
e.signerInfos = No(e.signers);
|
|
11125
11098
|
}
|
|
11126
11099
|
};
|
|
11127
11100
|
He.createEncryptedData = function() {
|
|
@@ -11166,7 +11139,7 @@ He.createEnvelopedData = function() {
|
|
|
11166
11139
|
*/
|
|
11167
11140
|
fromAsn1: function(t) {
|
|
11168
11141
|
var a = Ca(e, t, He.asn1.envelopedDataValidator);
|
|
11169
|
-
e.recipients =
|
|
11142
|
+
e.recipients = Bo(a.recipientInfos.value);
|
|
11170
11143
|
},
|
|
11171
11144
|
toAsn1: function() {
|
|
11172
11145
|
return m.create(m.Class.UNIVERSAL, m.Type.SEQUENCE, !0, [
|
|
@@ -11192,14 +11165,14 @@ He.createEnvelopedData = function() {
|
|
|
11192
11165
|
m.Class.UNIVERSAL,
|
|
11193
11166
|
m.Type.SET,
|
|
11194
11167
|
!0,
|
|
11195
|
-
|
|
11168
|
+
bo(e.recipients)
|
|
11196
11169
|
),
|
|
11197
11170
|
// EncryptedContentInfo
|
|
11198
11171
|
m.create(
|
|
11199
11172
|
m.Class.UNIVERSAL,
|
|
11200
11173
|
m.Type.SEQUENCE,
|
|
11201
11174
|
!0,
|
|
11202
|
-
|
|
11175
|
+
Ro(e.encryptedContent)
|
|
11203
11176
|
)
|
|
11204
11177
|
])
|
|
11205
11178
|
])
|
|
@@ -11326,7 +11299,7 @@ He.createEnvelopedData = function() {
|
|
|
11326
11299
|
}
|
|
11327
11300
|
}, e;
|
|
11328
11301
|
};
|
|
11329
|
-
function
|
|
11302
|
+
function Io(e) {
|
|
11330
11303
|
var t = {}, a = [];
|
|
11331
11304
|
if (!m.validate(e, He.asn1.recipientInfoValidator, t, a)) {
|
|
11332
11305
|
var r = new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");
|
|
@@ -11343,7 +11316,7 @@ function Bo(e) {
|
|
|
11343
11316
|
}
|
|
11344
11317
|
};
|
|
11345
11318
|
}
|
|
11346
|
-
function
|
|
11319
|
+
function Ao(e) {
|
|
11347
11320
|
return m.create(m.Class.UNIVERSAL, m.Type.SEQUENCE, !0, [
|
|
11348
11321
|
// Version
|
|
11349
11322
|
m.create(
|
|
@@ -11385,17 +11358,17 @@ function bo(e) {
|
|
|
11385
11358
|
)
|
|
11386
11359
|
]);
|
|
11387
11360
|
}
|
|
11388
|
-
function
|
|
11361
|
+
function Bo(e) {
|
|
11389
11362
|
for (var t = [], a = 0; a < e.length; ++a)
|
|
11390
|
-
t.push(
|
|
11363
|
+
t.push(Io(e[a]));
|
|
11391
11364
|
return t;
|
|
11392
11365
|
}
|
|
11393
|
-
function
|
|
11366
|
+
function bo(e) {
|
|
11394
11367
|
for (var t = [], a = 0; a < e.length; ++a)
|
|
11395
|
-
t.push(
|
|
11368
|
+
t.push(Ao(e[a]));
|
|
11396
11369
|
return t;
|
|
11397
11370
|
}
|
|
11398
|
-
function
|
|
11371
|
+
function _o(e) {
|
|
11399
11372
|
var t = m.create(m.Class.UNIVERSAL, m.Type.SEQUENCE, !0, [
|
|
11400
11373
|
// version
|
|
11401
11374
|
m.create(
|
|
@@ -11453,9 +11426,9 @@ function Ro(e) {
|
|
|
11453
11426
|
}
|
|
11454
11427
|
return t;
|
|
11455
11428
|
}
|
|
11456
|
-
function
|
|
11429
|
+
function No(e) {
|
|
11457
11430
|
for (var t = [], a = 0; a < e.length; ++a)
|
|
11458
|
-
t.push(
|
|
11431
|
+
t.push(_o(e[a]));
|
|
11459
11432
|
return t;
|
|
11460
11433
|
}
|
|
11461
11434
|
function Jr(e) {
|
|
@@ -11506,7 +11479,7 @@ function Jr(e) {
|
|
|
11506
11479
|
])
|
|
11507
11480
|
]);
|
|
11508
11481
|
}
|
|
11509
|
-
function
|
|
11482
|
+
function Ro(e) {
|
|
11510
11483
|
return [
|
|
11511
11484
|
// ContentType, always Data for the moment
|
|
11512
11485
|
m.create(
|
|
@@ -11605,8 +11578,8 @@ function Ui(e) {
|
|
|
11605
11578
|
e.content = t.output;
|
|
11606
11579
|
}
|
|
11607
11580
|
}
|
|
11608
|
-
var ge = z,
|
|
11609
|
-
|
|
11581
|
+
var ge = z, Nr = ge.ssh = ge.ssh || {};
|
|
11582
|
+
Nr.privateKeyToPutty = function(e, t, a) {
|
|
11610
11583
|
a = a || "", t = t || "";
|
|
11611
11584
|
var r = "ssh-rsa", i = t === "" ? "none" : "aes256-cbc", s = "PuTTY-User-Key-File-2: " + r + `\r
|
|
11612
11585
|
`;
|
|
@@ -11626,10 +11599,10 @@ Rr.privateKeyToPutty = function(e, t, a) {
|
|
|
11626
11599
|
else {
|
|
11627
11600
|
var c = u.length() + 16 - 1;
|
|
11628
11601
|
c -= c % 16;
|
|
11629
|
-
var v =
|
|
11602
|
+
var v = sr(u.bytes());
|
|
11630
11603
|
v.truncate(v.length() - c + u.length()), u.putBuffer(v);
|
|
11631
11604
|
var C = ge.util.createBuffer();
|
|
11632
|
-
C.putBuffer(
|
|
11605
|
+
C.putBuffer(sr("\0\0\0\0", t)), C.putBuffer(sr("\0\0\0", t));
|
|
11633
11606
|
var y = ge.aes.createEncryptionCipher(C.truncate(8), "CBC");
|
|
11634
11607
|
y.start(ge.util.createBuffer().fillWithByte(0, 16)), y.update(u.copy()), y.finish();
|
|
11635
11608
|
var x = y.output;
|
|
@@ -11638,27 +11611,27 @@ Rr.privateKeyToPutty = function(e, t, a) {
|
|
|
11638
11611
|
f = Math.floor(l.length / 66) + 1, s += `\r
|
|
11639
11612
|
Private-Lines: ` + f + `\r
|
|
11640
11613
|
`, s += l;
|
|
11641
|
-
var
|
|
11614
|
+
var T = sr("putty-private-key-file-mac-key", t), I = ge.util.createBuffer();
|
|
11642
11615
|
Ot(I, r), Ot(I, i), Ot(I, a), I.putInt32(n.length()), I.putBuffer(n), I.putInt32(u.length()), I.putBuffer(u);
|
|
11643
|
-
var
|
|
11644
|
-
return
|
|
11645
|
-
Private-MAC: ` +
|
|
11616
|
+
var B = ge.hmac.create();
|
|
11617
|
+
return B.start("sha1", T), B.update(I.bytes()), s += `\r
|
|
11618
|
+
Private-MAC: ` + B.digest().toHex() + `\r
|
|
11646
11619
|
`, s;
|
|
11647
11620
|
};
|
|
11648
|
-
|
|
11621
|
+
Nr.publicKeyToOpenSSH = function(e, t) {
|
|
11649
11622
|
var a = "ssh-rsa";
|
|
11650
11623
|
t = t || "";
|
|
11651
11624
|
var r = ge.util.createBuffer();
|
|
11652
11625
|
return Ot(r, a), it(r, e.e), it(r, e.n), a + " " + ge.util.encode64(r.bytes()) + " " + t;
|
|
11653
11626
|
};
|
|
11654
|
-
|
|
11627
|
+
Nr.privateKeyToOpenSSH = function(e, t) {
|
|
11655
11628
|
return t ? ge.pki.encryptRsaPrivateKey(
|
|
11656
11629
|
e,
|
|
11657
11630
|
t,
|
|
11658
11631
|
{ legacy: !0, algorithm: "aes128" }
|
|
11659
11632
|
) : ge.pki.privateKeyToPem(e);
|
|
11660
11633
|
};
|
|
11661
|
-
|
|
11634
|
+
Nr.getPublicKeyFingerprint = function(e, t) {
|
|
11662
11635
|
t = t || {};
|
|
11663
11636
|
var a = t.md || ge.md.md5.create(), r = "ssh-rsa", i = ge.util.createBuffer();
|
|
11664
11637
|
Ot(i, r), it(i, e.e), it(i, e.n), a.start(), a.update(i.getBytes());
|
|
@@ -11683,16 +11656,16 @@ function it(e, t) {
|
|
|
11683
11656
|
function Ot(e, t) {
|
|
11684
11657
|
e.putInt32(t.length), e.putString(t);
|
|
11685
11658
|
}
|
|
11686
|
-
function
|
|
11659
|
+
function sr() {
|
|
11687
11660
|
for (var e = ge.md.sha1.create(), t = arguments.length, a = 0; a < t; ++a)
|
|
11688
11661
|
e.update(arguments[a]);
|
|
11689
11662
|
return e.digest();
|
|
11690
11663
|
}
|
|
11691
11664
|
var Pi = z;
|
|
11692
|
-
const
|
|
11665
|
+
const wo = /* @__PURE__ */ Fi(Pi), Lo = /* @__PURE__ */ Vi({
|
|
11693
11666
|
__proto__: null,
|
|
11694
|
-
default:
|
|
11667
|
+
default: wo
|
|
11695
11668
|
}, [Pi]);
|
|
11696
11669
|
export {
|
|
11697
|
-
|
|
11670
|
+
Lo as i
|
|
11698
11671
|
};
|