@novnc/novnc 1.6.0-ga8dfd6a → 1.6.0-gd49d2b3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base64.js +1 -2
- package/lib/crypto/aes.js +143 -172
- package/lib/crypto/md5.js +6 -9
- package/lib/crypto/rsa.js +69 -85
- package/lib/decoders/h264.js +1 -2
- package/lib/decoders/hextile.js +1 -2
- package/lib/decoders/tight.js +1 -2
- package/lib/display.js +1 -2
- package/lib/input/keyboard.js +1 -2
- package/lib/input/util.js +1 -2
- package/lib/ra2.js +117 -126
- package/lib/rfb.js +17 -22
- package/lib/util/browser.js +35 -37
- package/lib/vendor/pako/lib/zlib/deflate.js +1 -2
- package/lib/vendor/pako/lib/zlib/inflate.js +1 -2
- package/lib/vendor/pako/lib/zlib/inftrees.js +1 -2
- package/lib/vendor/pako/lib/zlib/trees.js +1 -2
- package/lib/websock.js +1 -2
- package/package.json +1 -1
package/lib/base64.js
CHANGED
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var Log = _interopRequireWildcard(require("./util/logging.js"));
|
|
9
|
-
function
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
10
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
12
11
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
13
12
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
package/lib/crypto/aes.js
CHANGED
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.AESECBCipher = exports.AESEAXCipher = void 0;
|
|
7
7
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
-
function
|
|
8
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
9
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
9
10
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
10
11
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
11
12
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -28,19 +29,18 @@ var AESECBCipher = exports.AESECBCipher = /*#__PURE__*/function () {
|
|
|
28
29
|
}, {
|
|
29
30
|
key: "_importKey",
|
|
30
31
|
value: function () {
|
|
31
|
-
var _importKey2 = _asyncToGenerator(/*#__PURE__*/
|
|
32
|
-
return
|
|
33
|
-
while (1) switch (_context.
|
|
32
|
+
var _importKey2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(key, extractable, keyUsages) {
|
|
33
|
+
return _regenerator().w(function (_context) {
|
|
34
|
+
while (1) switch (_context.n) {
|
|
34
35
|
case 0:
|
|
35
|
-
_context.
|
|
36
|
+
_context.n = 1;
|
|
36
37
|
return window.crypto.subtle.importKey("raw", key, {
|
|
37
38
|
name: "AES-CBC"
|
|
38
39
|
}, extractable, keyUsages);
|
|
40
|
+
case 1:
|
|
41
|
+
this._key = _context.v;
|
|
39
42
|
case 2:
|
|
40
|
-
|
|
41
|
-
case 3:
|
|
42
|
-
case "end":
|
|
43
|
-
return _context.stop();
|
|
43
|
+
return _context.a(2);
|
|
44
44
|
}
|
|
45
45
|
}, _callee, this);
|
|
46
46
|
}));
|
|
@@ -52,44 +52,41 @@ var AESECBCipher = exports.AESECBCipher = /*#__PURE__*/function () {
|
|
|
52
52
|
}, {
|
|
53
53
|
key: "encrypt",
|
|
54
54
|
value: function () {
|
|
55
|
-
var _encrypt = _asyncToGenerator(/*#__PURE__*/
|
|
56
|
-
var x, n, i, y;
|
|
57
|
-
return
|
|
58
|
-
while (1) switch (_context2.
|
|
55
|
+
var _encrypt = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_algorithm, plaintext) {
|
|
56
|
+
var x, n, i, y, _t, _t2;
|
|
57
|
+
return _regenerator().w(function (_context2) {
|
|
58
|
+
while (1) switch (_context2.n) {
|
|
59
59
|
case 0:
|
|
60
60
|
x = new Uint8Array(plaintext);
|
|
61
61
|
if (!(x.length % 16 !== 0 || this._key === null)) {
|
|
62
|
-
_context2.
|
|
62
|
+
_context2.n = 1;
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
-
return _context2.
|
|
66
|
-
case
|
|
65
|
+
return _context2.a(2, null);
|
|
66
|
+
case 1:
|
|
67
67
|
n = x.length / 16;
|
|
68
68
|
i = 0;
|
|
69
|
-
case
|
|
69
|
+
case 2:
|
|
70
70
|
if (!(i < n)) {
|
|
71
|
-
_context2.
|
|
71
|
+
_context2.n = 5;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
_context2.
|
|
74
|
+
_t = Uint8Array;
|
|
75
|
+
_context2.n = 3;
|
|
76
76
|
return window.crypto.subtle.encrypt({
|
|
77
77
|
name: "AES-CBC",
|
|
78
78
|
iv: new Uint8Array(16)
|
|
79
79
|
}, this._key, x.slice(i * 16, i * 16 + 16));
|
|
80
|
-
case
|
|
81
|
-
|
|
82
|
-
y = new
|
|
80
|
+
case 3:
|
|
81
|
+
_t2 = _context2.v;
|
|
82
|
+
y = new _t(_t2).slice(0, 16);
|
|
83
83
|
x.set(y, i * 16);
|
|
84
|
-
case
|
|
84
|
+
case 4:
|
|
85
85
|
i++;
|
|
86
|
-
_context2.
|
|
86
|
+
_context2.n = 2;
|
|
87
87
|
break;
|
|
88
|
-
case
|
|
89
|
-
return _context2.
|
|
90
|
-
case 16:
|
|
91
|
-
case "end":
|
|
92
|
-
return _context2.stop();
|
|
88
|
+
case 5:
|
|
89
|
+
return _context2.a(2, x);
|
|
93
90
|
}
|
|
94
91
|
}, _callee2, this);
|
|
95
92
|
}));
|
|
@@ -101,19 +98,16 @@ var AESECBCipher = exports.AESECBCipher = /*#__PURE__*/function () {
|
|
|
101
98
|
}], [{
|
|
102
99
|
key: "importKey",
|
|
103
100
|
value: function () {
|
|
104
|
-
var _importKey3 = _asyncToGenerator(/*#__PURE__*/
|
|
101
|
+
var _importKey3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(key, _algorithm, extractable, keyUsages) {
|
|
105
102
|
var cipher;
|
|
106
|
-
return
|
|
107
|
-
while (1) switch (_context3.
|
|
103
|
+
return _regenerator().w(function (_context3) {
|
|
104
|
+
while (1) switch (_context3.n) {
|
|
108
105
|
case 0:
|
|
109
106
|
cipher = new AESECBCipher();
|
|
110
|
-
_context3.
|
|
107
|
+
_context3.n = 1;
|
|
111
108
|
return cipher._importKey(key, extractable, keyUsages);
|
|
112
|
-
case
|
|
113
|
-
return _context3.
|
|
114
|
-
case 4:
|
|
115
|
-
case "end":
|
|
116
|
-
return _context3.stop();
|
|
109
|
+
case 1:
|
|
110
|
+
return _context3.a(2, cipher);
|
|
117
111
|
}
|
|
118
112
|
}, _callee3);
|
|
119
113
|
}));
|
|
@@ -145,26 +139,23 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
145
139
|
}, {
|
|
146
140
|
key: "_encryptBlock",
|
|
147
141
|
value: function () {
|
|
148
|
-
var _encryptBlock2 = _asyncToGenerator(/*#__PURE__*/
|
|
142
|
+
var _encryptBlock2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(block) {
|
|
149
143
|
var encrypted;
|
|
150
|
-
return
|
|
151
|
-
while (1) switch (_context4.
|
|
144
|
+
return _regenerator().w(function (_context4) {
|
|
145
|
+
while (1) switch (_context4.n) {
|
|
152
146
|
case 0:
|
|
153
|
-
_context4.
|
|
147
|
+
_context4.n = 1;
|
|
154
148
|
return window.crypto.subtle.encrypt({
|
|
155
149
|
name: "AES-CBC",
|
|
156
150
|
iv: this._zeroBlock
|
|
157
151
|
}, this._cbcKey, block);
|
|
158
|
-
case
|
|
159
|
-
encrypted = _context4.
|
|
160
|
-
return _context4.
|
|
161
|
-
case 4:
|
|
162
|
-
case "end":
|
|
163
|
-
return _context4.stop();
|
|
152
|
+
case 1:
|
|
153
|
+
encrypted = _context4.v;
|
|
154
|
+
return _context4.a(2, new Uint8Array(encrypted).slice(0, 16));
|
|
164
155
|
}
|
|
165
156
|
}, _callee4, this);
|
|
166
157
|
}));
|
|
167
|
-
function _encryptBlock(
|
|
158
|
+
function _encryptBlock(_x0) {
|
|
168
159
|
return _encryptBlock2.apply(this, arguments);
|
|
169
160
|
}
|
|
170
161
|
return _encryptBlock;
|
|
@@ -172,15 +163,15 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
172
163
|
}, {
|
|
173
164
|
key: "_initCMAC",
|
|
174
165
|
value: function () {
|
|
175
|
-
var _initCMAC2 = _asyncToGenerator(/*#__PURE__*/
|
|
166
|
+
var _initCMAC2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
176
167
|
var k1, k2, v, i, lut;
|
|
177
|
-
return
|
|
178
|
-
while (1) switch (_context5.
|
|
168
|
+
return _regenerator().w(function (_context5) {
|
|
169
|
+
while (1) switch (_context5.n) {
|
|
179
170
|
case 0:
|
|
180
|
-
_context5.
|
|
171
|
+
_context5.n = 1;
|
|
181
172
|
return this._encryptBlock(this._zeroBlock);
|
|
182
|
-
case
|
|
183
|
-
k1 = _context5.
|
|
173
|
+
case 1:
|
|
174
|
+
k1 = _context5.v;
|
|
184
175
|
k2 = new Uint8Array(16);
|
|
185
176
|
v = k1[0] >>> 6;
|
|
186
177
|
for (i = 0; i < 15; i++) {
|
|
@@ -193,9 +184,8 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
193
184
|
k1[15] = k1[15] << 1 ^ lut[v >> 1];
|
|
194
185
|
this._k1 = k1;
|
|
195
186
|
this._k2 = k2;
|
|
196
|
-
case
|
|
197
|
-
|
|
198
|
-
return _context5.stop();
|
|
187
|
+
case 2:
|
|
188
|
+
return _context5.a(2);
|
|
199
189
|
}
|
|
200
190
|
}, _callee5, this);
|
|
201
191
|
}));
|
|
@@ -207,27 +197,24 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
207
197
|
}, {
|
|
208
198
|
key: "_encryptCTR",
|
|
209
199
|
value: function () {
|
|
210
|
-
var _encryptCTR2 = _asyncToGenerator(/*#__PURE__*/
|
|
200
|
+
var _encryptCTR2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(data, counter) {
|
|
211
201
|
var encrypted;
|
|
212
|
-
return
|
|
213
|
-
while (1) switch (_context6.
|
|
202
|
+
return _regenerator().w(function (_context6) {
|
|
203
|
+
while (1) switch (_context6.n) {
|
|
214
204
|
case 0:
|
|
215
|
-
_context6.
|
|
205
|
+
_context6.n = 1;
|
|
216
206
|
return window.crypto.subtle.encrypt({
|
|
217
207
|
name: "AES-CTR",
|
|
218
208
|
counter: counter,
|
|
219
209
|
length: 128
|
|
220
210
|
}, this._ctrKey, data);
|
|
221
|
-
case
|
|
222
|
-
encrypted = _context6.
|
|
223
|
-
return _context6.
|
|
224
|
-
case 4:
|
|
225
|
-
case "end":
|
|
226
|
-
return _context6.stop();
|
|
211
|
+
case 1:
|
|
212
|
+
encrypted = _context6.v;
|
|
213
|
+
return _context6.a(2, new Uint8Array(encrypted));
|
|
227
214
|
}
|
|
228
215
|
}, _callee6, this);
|
|
229
216
|
}));
|
|
230
|
-
function _encryptCTR(
|
|
217
|
+
function _encryptCTR(_x1, _x10) {
|
|
231
218
|
return _encryptCTR2.apply(this, arguments);
|
|
232
219
|
}
|
|
233
220
|
return _encryptCTR;
|
|
@@ -235,27 +222,24 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
235
222
|
}, {
|
|
236
223
|
key: "_decryptCTR",
|
|
237
224
|
value: function () {
|
|
238
|
-
var _decryptCTR2 = _asyncToGenerator(/*#__PURE__*/
|
|
225
|
+
var _decryptCTR2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(data, counter) {
|
|
239
226
|
var decrypted;
|
|
240
|
-
return
|
|
241
|
-
while (1) switch (_context7.
|
|
227
|
+
return _regenerator().w(function (_context7) {
|
|
228
|
+
while (1) switch (_context7.n) {
|
|
242
229
|
case 0:
|
|
243
|
-
_context7.
|
|
230
|
+
_context7.n = 1;
|
|
244
231
|
return window.crypto.subtle.decrypt({
|
|
245
232
|
name: "AES-CTR",
|
|
246
233
|
counter: counter,
|
|
247
234
|
length: 128
|
|
248
235
|
}, this._ctrKey, data);
|
|
249
|
-
case
|
|
250
|
-
decrypted = _context7.
|
|
251
|
-
return _context7.
|
|
252
|
-
case 4:
|
|
253
|
-
case "end":
|
|
254
|
-
return _context7.stop();
|
|
236
|
+
case 1:
|
|
237
|
+
decrypted = _context7.v;
|
|
238
|
+
return _context7.a(2, new Uint8Array(decrypted));
|
|
255
239
|
}
|
|
256
240
|
}, _callee7, this);
|
|
257
241
|
}));
|
|
258
|
-
function _decryptCTR(
|
|
242
|
+
function _decryptCTR(_x11, _x12) {
|
|
259
243
|
return _decryptCTR2.apply(this, arguments);
|
|
260
244
|
}
|
|
261
245
|
return _decryptCTR;
|
|
@@ -263,17 +247,17 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
263
247
|
}, {
|
|
264
248
|
key: "_computeCMAC",
|
|
265
249
|
value: function () {
|
|
266
|
-
var _computeCMAC2 = _asyncToGenerator(/*#__PURE__*/
|
|
250
|
+
var _computeCMAC2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(data, prefixBlock) {
|
|
267
251
|
var n, m, r, cbcData, i, _i, cbcEncrypted, mac;
|
|
268
|
-
return
|
|
269
|
-
while (1) switch (_context8.
|
|
252
|
+
return _regenerator().w(function (_context8) {
|
|
253
|
+
while (1) switch (_context8.n) {
|
|
270
254
|
case 0:
|
|
271
255
|
if (!(prefixBlock.length !== 16)) {
|
|
272
|
-
_context8.
|
|
256
|
+
_context8.n = 1;
|
|
273
257
|
break;
|
|
274
258
|
}
|
|
275
|
-
return _context8.
|
|
276
|
-
case
|
|
259
|
+
return _context8.a(2, null);
|
|
260
|
+
case 1:
|
|
277
261
|
n = Math.floor(data.length / 16);
|
|
278
262
|
m = Math.ceil(data.length / 16);
|
|
279
263
|
r = data.length - n * 16;
|
|
@@ -290,23 +274,20 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
290
274
|
cbcData[(n + 1) * 16 + _i] ^= this._k2[_i];
|
|
291
275
|
}
|
|
292
276
|
}
|
|
293
|
-
_context8.
|
|
277
|
+
_context8.n = 2;
|
|
294
278
|
return window.crypto.subtle.encrypt({
|
|
295
279
|
name: "AES-CBC",
|
|
296
280
|
iv: this._zeroBlock
|
|
297
281
|
}, this._cbcKey, cbcData);
|
|
298
|
-
case
|
|
299
|
-
cbcEncrypted = _context8.
|
|
282
|
+
case 2:
|
|
283
|
+
cbcEncrypted = _context8.v;
|
|
300
284
|
cbcEncrypted = new Uint8Array(cbcEncrypted);
|
|
301
285
|
mac = cbcEncrypted.slice(cbcEncrypted.length - 32, cbcEncrypted.length - 16);
|
|
302
|
-
return _context8.
|
|
303
|
-
case 15:
|
|
304
|
-
case "end":
|
|
305
|
-
return _context8.stop();
|
|
286
|
+
return _context8.a(2, mac);
|
|
306
287
|
}
|
|
307
288
|
}, _callee8, this);
|
|
308
289
|
}));
|
|
309
|
-
function _computeCMAC(
|
|
290
|
+
function _computeCMAC(_x13, _x14) {
|
|
310
291
|
return _computeCMAC2.apply(this, arguments);
|
|
311
292
|
}
|
|
312
293
|
return _computeCMAC;
|
|
@@ -314,32 +295,31 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
314
295
|
}, {
|
|
315
296
|
key: "_importKey",
|
|
316
297
|
value: function () {
|
|
317
|
-
var _importKey4 = _asyncToGenerator(/*#__PURE__*/
|
|
318
|
-
return
|
|
319
|
-
while (1) switch (_context9.
|
|
298
|
+
var _importKey4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(key) {
|
|
299
|
+
return _regenerator().w(function (_context9) {
|
|
300
|
+
while (1) switch (_context9.n) {
|
|
320
301
|
case 0:
|
|
321
302
|
this._rawKey = key;
|
|
322
|
-
_context9.
|
|
303
|
+
_context9.n = 1;
|
|
323
304
|
return window.crypto.subtle.importKey("raw", key, {
|
|
324
305
|
name: "AES-CTR"
|
|
325
306
|
}, false, ["encrypt", "decrypt"]);
|
|
326
|
-
case
|
|
327
|
-
this._ctrKey = _context9.
|
|
328
|
-
_context9.
|
|
307
|
+
case 1:
|
|
308
|
+
this._ctrKey = _context9.v;
|
|
309
|
+
_context9.n = 2;
|
|
329
310
|
return window.crypto.subtle.importKey("raw", key, {
|
|
330
311
|
name: "AES-CBC"
|
|
331
312
|
}, false, ["encrypt"]);
|
|
332
|
-
case
|
|
333
|
-
this._cbcKey = _context9.
|
|
334
|
-
_context9.
|
|
313
|
+
case 2:
|
|
314
|
+
this._cbcKey = _context9.v;
|
|
315
|
+
_context9.n = 3;
|
|
335
316
|
return this._initCMAC();
|
|
336
|
-
case
|
|
337
|
-
|
|
338
|
-
return _context9.stop();
|
|
317
|
+
case 3:
|
|
318
|
+
return _context9.a(2);
|
|
339
319
|
}
|
|
340
320
|
}, _callee9, this);
|
|
341
321
|
}));
|
|
342
|
-
function _importKey(
|
|
322
|
+
function _importKey(_x15) {
|
|
343
323
|
return _importKey4.apply(this, arguments);
|
|
344
324
|
}
|
|
345
325
|
return _importKey;
|
|
@@ -347,43 +327,40 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
347
327
|
}, {
|
|
348
328
|
key: "encrypt",
|
|
349
329
|
value: function () {
|
|
350
|
-
var _encrypt2 = _asyncToGenerator(/*#__PURE__*/
|
|
330
|
+
var _encrypt2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(algorithm, message) {
|
|
351
331
|
var ad, nonce, nCMAC, encrypted, adCMAC, mac, i, res;
|
|
352
|
-
return
|
|
353
|
-
while (1) switch (
|
|
332
|
+
return _regenerator().w(function (_context0) {
|
|
333
|
+
while (1) switch (_context0.n) {
|
|
354
334
|
case 0:
|
|
355
335
|
ad = algorithm.additionalData;
|
|
356
336
|
nonce = algorithm.iv;
|
|
357
|
-
|
|
337
|
+
_context0.n = 1;
|
|
358
338
|
return this._computeCMAC(nonce, this._prefixBlock0);
|
|
359
|
-
case
|
|
360
|
-
nCMAC =
|
|
361
|
-
|
|
339
|
+
case 1:
|
|
340
|
+
nCMAC = _context0.v;
|
|
341
|
+
_context0.n = 2;
|
|
362
342
|
return this._encryptCTR(message, nCMAC);
|
|
363
|
-
case
|
|
364
|
-
encrypted =
|
|
365
|
-
|
|
343
|
+
case 2:
|
|
344
|
+
encrypted = _context0.v;
|
|
345
|
+
_context0.n = 3;
|
|
366
346
|
return this._computeCMAC(ad, this._prefixBlock1);
|
|
367
|
-
case
|
|
368
|
-
adCMAC =
|
|
369
|
-
|
|
347
|
+
case 3:
|
|
348
|
+
adCMAC = _context0.v;
|
|
349
|
+
_context0.n = 4;
|
|
370
350
|
return this._computeCMAC(encrypted, this._prefixBlock2);
|
|
371
|
-
case
|
|
372
|
-
mac =
|
|
351
|
+
case 4:
|
|
352
|
+
mac = _context0.v;
|
|
373
353
|
for (i = 0; i < 16; i++) {
|
|
374
354
|
mac[i] ^= nCMAC[i] ^ adCMAC[i];
|
|
375
355
|
}
|
|
376
356
|
res = new Uint8Array(16 + encrypted.length);
|
|
377
357
|
res.set(encrypted);
|
|
378
358
|
res.set(mac, encrypted.length);
|
|
379
|
-
return
|
|
380
|
-
case 19:
|
|
381
|
-
case "end":
|
|
382
|
-
return _context10.stop();
|
|
359
|
+
return _context0.a(2, res);
|
|
383
360
|
}
|
|
384
|
-
},
|
|
361
|
+
}, _callee0, this);
|
|
385
362
|
}));
|
|
386
|
-
function encrypt(
|
|
363
|
+
function encrypt(_x16, _x17) {
|
|
387
364
|
return _encrypt2.apply(this, arguments);
|
|
388
365
|
}
|
|
389
366
|
return encrypt;
|
|
@@ -391,64 +368,61 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
391
368
|
}, {
|
|
392
369
|
key: "decrypt",
|
|
393
370
|
value: function () {
|
|
394
|
-
var _decrypt = _asyncToGenerator(/*#__PURE__*/
|
|
371
|
+
var _decrypt = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(algorithm, data) {
|
|
395
372
|
var encrypted, ad, nonce, mac, nCMAC, adCMAC, computedMac, i, _i2, res;
|
|
396
|
-
return
|
|
397
|
-
while (1) switch (
|
|
373
|
+
return _regenerator().w(function (_context1) {
|
|
374
|
+
while (1) switch (_context1.n) {
|
|
398
375
|
case 0:
|
|
399
376
|
encrypted = data.slice(0, data.length - 16);
|
|
400
377
|
ad = algorithm.additionalData;
|
|
401
378
|
nonce = algorithm.iv;
|
|
402
379
|
mac = data.slice(data.length - 16);
|
|
403
|
-
|
|
380
|
+
_context1.n = 1;
|
|
404
381
|
return this._computeCMAC(nonce, this._prefixBlock0);
|
|
405
|
-
case
|
|
406
|
-
nCMAC =
|
|
407
|
-
|
|
382
|
+
case 1:
|
|
383
|
+
nCMAC = _context1.v;
|
|
384
|
+
_context1.n = 2;
|
|
408
385
|
return this._computeCMAC(ad, this._prefixBlock1);
|
|
409
|
-
case
|
|
410
|
-
adCMAC =
|
|
411
|
-
|
|
386
|
+
case 2:
|
|
387
|
+
adCMAC = _context1.v;
|
|
388
|
+
_context1.n = 3;
|
|
412
389
|
return this._computeCMAC(encrypted, this._prefixBlock2);
|
|
413
|
-
case
|
|
414
|
-
computedMac =
|
|
390
|
+
case 3:
|
|
391
|
+
computedMac = _context1.v;
|
|
415
392
|
for (i = 0; i < 16; i++) {
|
|
416
393
|
computedMac[i] ^= nCMAC[i] ^ adCMAC[i];
|
|
417
394
|
}
|
|
418
395
|
if (!(computedMac.length !== mac.length)) {
|
|
419
|
-
|
|
396
|
+
_context1.n = 4;
|
|
420
397
|
break;
|
|
421
398
|
}
|
|
422
|
-
return
|
|
423
|
-
case
|
|
399
|
+
return _context1.a(2, null);
|
|
400
|
+
case 4:
|
|
424
401
|
_i2 = 0;
|
|
425
|
-
case
|
|
402
|
+
case 5:
|
|
426
403
|
if (!(_i2 < mac.length)) {
|
|
427
|
-
|
|
404
|
+
_context1.n = 7;
|
|
428
405
|
break;
|
|
429
406
|
}
|
|
430
407
|
if (!(computedMac[_i2] !== mac[_i2])) {
|
|
431
|
-
|
|
408
|
+
_context1.n = 6;
|
|
432
409
|
break;
|
|
433
410
|
}
|
|
434
|
-
return
|
|
435
|
-
case
|
|
411
|
+
return _context1.a(2, null);
|
|
412
|
+
case 6:
|
|
436
413
|
_i2++;
|
|
437
|
-
|
|
414
|
+
_context1.n = 5;
|
|
438
415
|
break;
|
|
439
|
-
case
|
|
440
|
-
|
|
416
|
+
case 7:
|
|
417
|
+
_context1.n = 8;
|
|
441
418
|
return this._decryptCTR(encrypted, nCMAC);
|
|
442
|
-
case
|
|
443
|
-
res =
|
|
444
|
-
return
|
|
445
|
-
case 27:
|
|
446
|
-
case "end":
|
|
447
|
-
return _context11.stop();
|
|
419
|
+
case 8:
|
|
420
|
+
res = _context1.v;
|
|
421
|
+
return _context1.a(2, res);
|
|
448
422
|
}
|
|
449
|
-
},
|
|
423
|
+
}, _callee1, this);
|
|
450
424
|
}));
|
|
451
|
-
function decrypt(
|
|
425
|
+
function decrypt(_x18, _x19) {
|
|
452
426
|
return _decrypt.apply(this, arguments);
|
|
453
427
|
}
|
|
454
428
|
return decrypt;
|
|
@@ -456,23 +430,20 @@ var AESEAXCipher = exports.AESEAXCipher = /*#__PURE__*/function () {
|
|
|
456
430
|
}], [{
|
|
457
431
|
key: "importKey",
|
|
458
432
|
value: function () {
|
|
459
|
-
var _importKey5 = _asyncToGenerator(/*#__PURE__*/
|
|
433
|
+
var _importKey5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(key, _algorithm, _extractable, _keyUsages) {
|
|
460
434
|
var cipher;
|
|
461
|
-
return
|
|
462
|
-
while (1) switch (
|
|
435
|
+
return _regenerator().w(function (_context10) {
|
|
436
|
+
while (1) switch (_context10.n) {
|
|
463
437
|
case 0:
|
|
464
438
|
cipher = new AESEAXCipher();
|
|
465
|
-
|
|
439
|
+
_context10.n = 1;
|
|
466
440
|
return cipher._importKey(key);
|
|
467
|
-
case
|
|
468
|
-
return
|
|
469
|
-
case 4:
|
|
470
|
-
case "end":
|
|
471
|
-
return _context12.stop();
|
|
441
|
+
case 1:
|
|
442
|
+
return _context10.a(2, cipher);
|
|
472
443
|
}
|
|
473
|
-
},
|
|
444
|
+
}, _callee10);
|
|
474
445
|
}));
|
|
475
|
-
function importKey(
|
|
446
|
+
function importKey(_x20, _x21, _x22, _x23) {
|
|
476
447
|
return _importKey5.apply(this, arguments);
|
|
477
448
|
}
|
|
478
449
|
return importKey;
|