First working MacOS mesh agent
Ylian Saint-Hilaire committed
Nov 14, 2018 at 15:44 UTC
35245805fba3c0cbde4eaf8d4c9be234a99c5222
10 files changed
+676
-328
agents/MeshAgentOSXPackager.zip
Binary files a/agents/MeshAgentOSXPackager.zip and b/agents/MeshAgentOSXPackager.zip differ
agents/meshcore.js
+1
-1
@@ -631,7 +631,7 @@ function createMeshCore(agent) {
631
this.removeAllListeners('data');
632
this.on('data', onTunnelControlData);
633
//this.write('MeshCore Terminal Hello');
634
- if (process.platform != 'win32') { this.httprequest.process.stdin.write("stty erase ^H\nalias ls='ls --color=auto'\nclear\n"); }
634
+ if (process.platform == 'linux') { this.httprequest.process.stdin.write("stty erase ^H\nalias ls='ls --color=auto'\nclear\n"); }
635
} else if (this.httprequest.protocol == 2)
636
{
637
// Remote desktop using native pipes
agents/modules_meshcmd/service-host.js
+121
-118
@@ -187,9 +187,9 @@ function serviceHost(serviceName)
187
console.log(e);
188
process.exit();
189
}
190
- if (process.platform == 'win32')
190
+ if (process.platform == 'win32' || process.platform == 'darwin')
191
{
192
- // Only do this on Windows, becuase Linux is async... It'll complete later
192
+ // Only do this on Windows/MacOS, becuase Linux is async... It'll complete later
193
console.log(this._ServiceOptions.name + ' installed');
194
process.exit();
195
}
@@ -207,9 +207,9 @@ function serviceHost(serviceName)
207
console.log(e);
208
process.exit();
209
}
210
- if (process.platform == 'win32')
210
+ if (process.platform == 'win32' || process.platform == 'darwin')
211
{
212
- // Only do this on Windows, becuase Linux is async... It'll complete later
212
+ // Only do this on Windows/MacOS, becuase Linux is async... It'll complete later
213
console.log(this._ServiceOptions.name + ' uninstalled');
214
process.exit();
215
}
@@ -251,138 +251,141 @@ function serviceHost(serviceName)
251
});
252
return;
253
}
254
-
255
- var moduleName = this._ServiceOptions ? this._ServiceOptions.name : process.execPath.substring(1 + process.execPath.lastIndexOf('/'));
256
-
257
- for (var i = 0; i < process.argv.length; ++i)
254
+ else if (process.platform == 'linux')
255
{
259
- switch(process.argv[i])
260
- {
261
- case 'start':
262
- case '-d':
263
- var child = require('child_process').execFile(process.execPath, [moduleName], { type: require('child_process').SpawnTypes.DETACHED });
264
- var pstream = null;
265
- try
266
- {
267
- pstream = require('fs').createWriteStream('/var/run/' + moduleName + '.pid', { flags: 'w' });
268
- }
269
- catch(e)
270
- {
271
- }
272
- if (pstream == null)
273
- {
274
- pstream = require('fs').createWriteStream('.' + moduleName + '.pid', { flags: 'w' });
275
- }
276
- pstream.end(child.pid.toString());
256
+ var moduleName = this._ServiceOptions ? this._ServiceOptions.name : process.execPath.substring(1 + process.execPath.lastIndexOf('/'));
257
+
258
+ for (var i = 0; i < process.argv.length; ++i) {
259
+ switch (process.argv[i]) {
260
+ case 'start':
261
+ case '-d':
262
+ var child = require('child_process').execFile(process.execPath, [moduleName], { type: require('child_process').SpawnTypes.DETACHED });
263
+ var pstream = null;
264
+ try {
265
+ pstream = require('fs').createWriteStream('/var/run/' + moduleName + '.pid', { flags: 'w' });
266
+ }
267
+ catch (e) {
268
+ }
269
+ if (pstream == null) {
270
+ pstream = require('fs').createWriteStream('.' + moduleName + '.pid', { flags: 'w' });
271
+ }
272
+ pstream.end(child.pid.toString());
273
278
- console.log(moduleName + ' started!');
279
- process.exit();
280
- break;
281
- case 'stop':
282
- case '-s':
283
- var pid = null;
284
- try
285
- {
286
- pid = parseInt(require('fs').readFileSync('/var/run/' + moduleName + '.pid', { flags: 'r' }));
287
- require('fs').unlinkSync('/var/run/' + moduleName + '.pid');
288
- }
289
- catch(e)
290
- {
291
- }
292
- if(pid == null)
293
- {
294
- try
295
- {
296
- pid = parseInt(require('fs').readFileSync('.' + moduleName + '.pid', { flags: 'r' }));
297
- require('fs').unlinkSync('.' + moduleName + '.pid');
274
+ console.log(moduleName + ' started!');
275
+ process.exit();
276
+ break;
277
+ case 'stop':
278
+ case '-s':
279
+ var pid = null;
280
+ try {
281
+ pid = parseInt(require('fs').readFileSync('/var/run/' + moduleName + '.pid', { flags: 'r' }));
282
+ require('fs').unlinkSync('/var/run/' + moduleName + '.pid');
283
}
299
- catch(e)
300
- {
284
+ catch (e) {
285
+ }
286
+ if (pid == null) {
287
+ try {
288
+ pid = parseInt(require('fs').readFileSync('.' + moduleName + '.pid', { flags: 'r' }));
289
+ require('fs').unlinkSync('.' + moduleName + '.pid');
290
+ }
291
+ catch (e) {
292
+ }
293
}
294
+
295
+ if (pid) {
296
+ process.kill(pid);
297
+ console.log(moduleName + ' stopped');
298
+ }
299
+ else {
300
+ console.log(moduleName + ' not running');
301
+ }
302
+ process.exit();
303
+ break;
304
+ }
305
+ }
306
+
307
+ if (serviceOperation == 0) {
308
+ // This is non-windows, so we need to check how this binary was started to determine if this was a service start
309
+
310
+ // Start by checking if we were started with start/stop
311
+ var pid = null;
312
+ try {
313
+ pid = parseInt(require('fs').readFileSync('/var/run/' + moduleName + '.pid', { flags: 'r' }));
314
+ }
315
+ catch (e) {
316
+ }
317
+ if (pid == null) {
318
+ try {
319
+ pid = parseInt(require('fs').readFileSync('.' + moduleName + '.pid', { flags: 'r' }));
320
+ }
321
+ catch (e) {
322
}
323
+ }
324
304
- if(pid)
305
- {
306
- process.kill(pid);
307
- console.log(moduleName + ' stopped');
325
+ if (pid != null && pid == process.pid) {
326
+ this.emit('serviceStart');
327
+ }
328
+ else {
329
+ // Now we need to check if we were started with systemd
330
+ if (require('process-manager').getProcessInfo(1).Name == 'systemd') {
331
+ this._checkpid = require('child_process').execFile('/bin/sh', ['sh'], { type: require('child_process').SpawnTypes.TERM });
332
+ this._checkpid.result = '';
333
+ this._checkpid.parent = this;
334
+ this._checkpid.on('exit', function onCheckPIDExit() {
335
+ var lines = this.result.split('\r\n');
336
+ for (i in lines) {
337
+ if (lines[i].startsWith(' Main PID:')) {
338
+ var tokens = lines[i].split(' ');
339
+ if (parseInt(tokens[3]) == process.pid) {
340
+ this.parent.emit('serviceStart');
341
+ }
342
+ else {
343
+ this.parent.emit('normalStart');
344
+ }
345
+ delete this.parent._checkpid;
346
+ return;
347
+ }
348
+ }
349
+ this.parent.emit('normalStart');
350
+ delete this.parent._checkpid;
351
+ });
352
+ this._checkpid.stdout.on('data', function (chunk) { this.parent.result += chunk.toString(); });
353
+ this._checkpid.stdin.write("systemctl status " + moduleName + " | grep 'Main PID:'\n");
354
+ this._checkpid.stdin.write('exit\n');
355
}
309
- else
310
- {
311
- console.log(moduleName + ' not running');
356
+ else {
357
+ // This isn't even a systemd platform, so this couldn't have been a service start
358
+ this.emit('normalStart');
359
}
313
- process.exit();
314
- break;
360
+ }
361
}
362
}
317
-
318
- if(serviceOperation == 0)
363
+ else if(process.platform == 'darwin')
364
{
320
- // This is non-windows, so we need to check how this binary was started to determine if this was a service start
321
-
322
- // Start by checking if we were started with start/stop
323
- var pid = null;
324
- try
365
+ // First let's fetch all the PIDs of running services
366
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
367
+ child.stdout.str = '';
368
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
369
+ child.stdin.write('launchctl list\nexit\n');
370
+ child.waitExit();
371
+
372
+ var lines = child.stdout.str.split('\n');
373
+ var tokens, i;
374
+ var p = {};
375
+ for (i = 1; i < lines.length; ++i)
376
{
326
- pid = parseInt(require('fs').readFileSync('/var/run/' + moduleName + '.pid', { flags: 'r' }));
377
+ tokens = lines[i].split('\t');
378
+ if (tokens[0] && tokens[0] != '-') { p[tokens[0]] = tokens[0]; }
379
}
328
- catch (e)
329
- {
330
- }
331
- if (pid == null)
332
- {
333
- try
334
- {
335
- pid = parseInt(require('fs').readFileSync('.' + moduleName + '.pid', { flags: 'r' }));
336
- }
337
- catch (e)
338
- {
339
- }
340
- }
341
-
342
- if (pid != null && pid == process.pid)
380
+
381
+ if(p[process.pid.toString()])
382
{
383
+ // We are a service!
384
this.emit('serviceStart');
385
}
386
else
387
{
348
- // Now we need to check if we were started with systemd
349
- if (require('process-manager').getProcessInfo(1).Name == 'systemd')
350
- {
351
- this._checkpid = require('child_process').execFile('/bin/sh', ['sh'], { type: require('child_process').SpawnTypes.TERM });
352
- this._checkpid.result = '';
353
- this._checkpid.parent = this;
354
- this._checkpid.on('exit', function onCheckPIDExit()
355
- {
356
- var lines = this.result.split('\r\n');
357
- for (i in lines)
358
- {
359
- if(lines[i].startsWith(' Main PID:'))
360
- {
361
- var tokens = lines[i].split(' ');
362
- if (parseInt(tokens[3]) == process.pid)
363
- {
364
- this.parent.emit('serviceStart');
365
- }
366
- else
367
- {
368
- this.parent.emit('normalStart');
369
- }
370
- delete this.parent._checkpid;
371
- return;
372
- }
373
- }
374
- this.parent.emit('normalStart');
375
- delete this.parent._checkpid;
376
- });
377
- this._checkpid.stdout.on('data', function (chunk) { this.parent.result += chunk.toString(); });
378
- this._checkpid.stdin.write("systemctl status " + moduleName + " | grep 'Main PID:'\n");
379
- this._checkpid.stdin.write('exit\n');
380
- }
381
- else
382
- {
383
- // This isn't even a systemd platform, so this couldn't have been a service start
384
- this.emit('normalStart');
385
- }
388
+ this.emit('normalStart');
389
}
390
}
391
};
agents/modules_meshcmd/service-manager.js
+100
-2
@@ -214,6 +214,13 @@ function serviceManager()
214
throw ('could not find service: ' + name);
215
}
216
}
217
+ else
218
+ {
219
+ this.isAdmin = function isAdmin()
220
+ {
221
+ return (require('user-sessions').isRoot());
222
+ }
223
+ }
224
this.installService = function installService(options)
225
{
226
if (process.platform == 'win32')
@@ -273,6 +280,8 @@ function serviceManager()
280
}
281
if(process.platform == 'linux')
282
{
283
+ if (!this.isAdmin()) { throw ('Installing as Service, requires root'); }
284
+
285
switch (this.getServiceType())
286
{
287
case 'init':
@@ -311,14 +320,70 @@ function serviceManager()
320
break;
321
}
322
}
323
+ if(process.platform == 'darwin')
324
+ {
325
+ if (!this.isAdmin()) { throw ('Installing as Service, requires root'); }
326
+
327
+ // Mac OS
328
+ var stdoutpath = (options.stdout ? ('<key>StandardOutPath</key>\n<string>' + options.stdout + '</string>') : '');
329
+ var autoStart = (options.startType == 'AUTO_START' ? '<true/>' : '<false/>');
330
+ var params = ' <key>ProgramArguments</key>\n';
331
+ params += ' <array>\n';
332
+ params += (' <string>/usr/local/mesh_services/' + options.name + '/' + options.name + '</string>\n');
333
+ if(options.parameters)
334
+ {
335
+ for(var itm in options.parameters)
336
+ {
337
+ params += (' <string>' + options.parameters[itm] + '</string>\n');
338
+ }
339
+ }
340
+ params += ' </array>\n';
341
+
342
+ var plist = '<?xml version="1.0" encoding="UTF-8"?>\n';
343
+ plist += '<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n';
344
+ plist += '<plist version="1.0">\n';
345
+ plist += ' <dict>\n';
346
+ plist += ' <key>Label</key>\n';
347
+ plist += (' <string>' + options.name + '</string>\n');
348
+ plist += (params + '\n');
349
+ plist += ' <key>WorkingDirectory</key>\n';
350
+ plist += (' <string>/usr/local/mesh_services/' + options.name + '</string>\n');
351
+ plist += (stdoutpath + '\n');
352
+ plist += ' <key>RunAtLoad</key>\n';
353
+ plist += (autoStart + '\n');
354
+ plist += ' </dict>\n';
355
+ plist += '</plist>';
356
+
357
+ if (!require('fs').existsSync('/usr/local/mesh_services')) { require('fs').mkdirSync('/usr/local/mesh_services'); }
358
+ if (!require('fs').existsSync('/Library/LaunchDaemons/' + options.name + '.plist'))
359
+ {
360
+ if (!require('fs').existsSync('/usr/local/mesh_services/' + options.name)) { require('fs').mkdirSync('/usr/local/mesh_services/' + options.name); }
361
+ if (options.binary)
362
+ {
363
+ require('fs').writeFileSync('/usr/local/mesh_services/' + options.name + '/' + options.name, options.binary);
364
+ }
365
+ else
366
+ {
367
+ require('fs').copyFileSync(options.servicePath, '/usr/local/mesh_services/' + options.name + '/' + options.name);
368
+ }
369
+ require('fs').writeFileSync('/Library/LaunchDaemons/' + options.name + '.plist', plist);
370
+ var m = require('fs').statSync('/usr/local/mesh_services/' + options.name + '/' + options.name).mode;
371
+ m |= (require('fs').CHMOD_MODES.S_IXUSR | require('fs').CHMOD_MODES.S_IXGRP);
372
+ require('fs').chmodSync('/usr/local/mesh_services/' + options.name + '/' + options.name, m);
373
+ }
374
+ else
375
+ {
376
+ throw ('Service: ' + options.name + ' already exists');
377
+ }
378
+ }
379
}
380
this.uninstallService = function uninstallService(name)
381
{
382
+ if (!this.isAdmin()) { throw ('Uninstalling a service, requires admin'); }
383
+
384
if (typeof (name) == 'object') { name = name.name; }
385
if (process.platform == 'win32')
386
{
320
- if (!this.isAdmin()) { throw ('Uninstalling a service, requires admin'); }
321
-
387
var service = this.getService(name);
388
if (service.status.state == undefined || service.status.state == 'STOPPED')
389
{
@@ -388,6 +453,39 @@ function serviceManager()
453
break;
454
}
455
}
456
+ else if(process.platform == 'darwin')
457
+ {
458
+ if (require('fs').existsSync('/Library/LaunchDaemons/' + name + '.plist'))
459
+ {
460
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
461
+ child.stdout.on('data', function (chunk) { });
462
+ child.stdin.write('launchctl stop ' + name + '\n');
463
+ child.stdin.write('launchctl unload /Library/LaunchDaemons/' + name + '.plist\n');
464
+ child.stdin.write('exit\n');
465
+ child.waitExit();
466
+
467
+ try
468
+ {
469
+ require('fs').unlinkSync('/usr/local/mesh_services/' + name + '/' + name);
470
+ require('fs').unlinkSync('/Library/LaunchDaemons/' + name + '.plist');
471
+ }
472
+ catch(e)
473
+ {
474
+ throw ('Error uninstalling service: ' + name + ' => ' + e);
475
+ }
476
+
477
+ try
478
+ {
479
+ require('fs').rmdirSync('/usr/local/mesh_services/' + name);
480
+ }
481
+ catch(e)
482
+ {}
483
+ }
484
+ else
485
+ {
486
+ throw ('Service: ' + name + ' does not exist');
487
+ }
488
+ }
489
}
490
if(process.platform == 'linux')
491
{
agents/modules_meshcmd/user-sessions.js
+126
-7
@@ -78,12 +78,20 @@ function UserSessions()
78
this._marshal = require('_GenericMarshal');
79
this._kernel32 = this._marshal.CreateNativeProxy('Kernel32.dll');
80
this._kernel32.CreateMethod('GetLastError');
81
- this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll');
82
- this._wts.CreateMethod('WTSEnumerateSessionsA');
83
- this._wts.CreateMethod('WTSQuerySessionInformationA');
84
- this._wts.CreateMethod('WTSRegisterSessionNotification');
85
- this._wts.CreateMethod('WTSUnRegisterSessionNotification');
86
- this._wts.CreateMethod('WTSFreeMemory');
81
+
82
+ try
83
+ {
84
+ this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll');
85
+ this._wts.CreateMethod('WTSEnumerateSessionsA');
86
+ this._wts.CreateMethod('WTSQuerySessionInformationA');
87
+ this._wts.CreateMethod('WTSRegisterSessionNotification');
88
+ this._wts.CreateMethod('WTSUnRegisterSessionNotification');
89
+ this._wts.CreateMethod('WTSFreeMemory');
90
+ }
91
+ catch(exc)
92
+ {
93
+ }
94
+
95
this._user32 = this._marshal.CreateNativeProxy('user32.dll');
96
this._user32.CreateMethod('RegisterPowerSettingNotification');
97
this._user32.CreateMethod('UnregisterPowerSettingNotification');
@@ -203,7 +211,7 @@ function UserSessions()
211
this.immediate = setImmediate(function (self)
212
{
213
// Now that we have a window handle, we can register it to receive Windows Messages
206
- self.parent._wts.WTSRegisterSessionNotification(self.parent.hwnd, NOTIFY_FOR_ALL_SESSIONS);
214
+ if (self.parent._wts) { self.parent._wts.WTSRegisterSessionNotification(self.parent.hwnd, NOTIFY_FOR_ALL_SESSIONS); }
215
self.parent._user32.ACDC_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_ACDC_POWER_SOURCE, 0);
216
self.parent._user32.BATT_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_BATTERY_PERCENTAGE_REMAINING, 0);
217
self.parent._user32.DISP_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_CONSOLE_DISPLAY_STATE, 0);
@@ -307,6 +315,38 @@ function UserSessions()
315
{
316
this.user_session.emit('changed');
317
});
318
+ this._users = function _users()
319
+ {
320
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
321
+ child.stdout.str = '';
322
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
323
+ child.stdin.write('awk -F: \'($3 >= 0) {printf "%s:%s\\n", $1, $3}\' /etc/passwd\nexit\n');
324
+ child.waitExit();
325
+
326
+ var lines = child.stdout.str.split('\n');
327
+ var ret = {}, tokens;
328
+ for (var ln in lines)
329
+ {
330
+ tokens = lines[ln].split(':');
331
+ if (tokens[0]) { ret[tokens[0]] = tokens[1]; }
332
+ }
333
+ return (ret);
334
+ }
335
+ this._uids = function _uids() {
336
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
337
+ child.stdout.str = '';
338
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
339
+ child.stdin.write('awk -F: \'($3 >= 0) {printf "%s:%s\\n", $1, $3}\' /etc/passwd\nexit\n');
340
+ child.waitExit();
341
+
342
+ var lines = child.stdout.str.split('\n');
343
+ var ret = {}, tokens;
344
+ for (var ln in lines) {
345
+ tokens = lines[ln].split(':');
346
+ if (tokens[0]) { ret[tokens[1]] = tokens[0]; }
347
+ }
348
+ return (ret);
349
+ }
350
this.Self = function Self()
351
{
352
var promise = require('promise');
@@ -501,6 +541,43 @@ function UserSessions()
541
}
542
else if(process.platform == 'darwin')
543
{
544
+ this._users = function ()
545
+ {
546
+ var child = require('child_process').execFile('/usr/bin/dscl', ['dscl', '.', 'list', '/Users', 'UniqueID']);
547
+ child.stdout.str = '';
548
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
549
+ child.stdin.write('exit\n');
550
+ child.waitExit();
551
+
552
+ var lines = child.stdout.str.split('\n');
553
+ var tokens, i;
554
+ var users = {};
555
+
556
+ for (i = 0; i < lines.length; ++i) {
557
+ tokens = lines[i].split(' ');
558
+ if (tokens[0]) { users[tokens[0]] = tokens[tokens.length - 1]; }
559
+ }
560
+
561
+ return (users);
562
+ }
563
+ this._uids = function () {
564
+ var child = require('child_process').execFile('/usr/bin/dscl', ['dscl', '.', 'list', '/Users', 'UniqueID']);
565
+ child.stdout.str = '';
566
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
567
+ child.stdin.write('exit\n');
568
+ child.waitExit();
569
+
570
+ var lines = child.stdout.str.split('\n');
571
+ var tokens, i;
572
+ var users = {};
573
+
574
+ for (i = 0; i < lines.length; ++i) {
575
+ tokens = lines[i].split(' ');
576
+ if (tokens[0]) { users[tokens[tokens.length - 1]] = tokens[0]; }
577
+ }
578
+
579
+ return (users);
580
+ }
581
this._idTable = function()
582
{
583
var table = {};
@@ -559,6 +636,48 @@ function UserSessions()
636
if (cb) { cb.call(this, users); }
637
}
638
}
639
+
640
+ if(process.platform == 'linux' || process.platform == 'darwin')
641
+ {
642
+ this._self = function _self()
643
+ {
644
+ var child = require('child_process').execFile('/usr/bin/id', ['id', '-u']);
645
+ child.stdout.str = '';
646
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
647
+ child.waitExit();
648
+ return (parseInt(child.stdout.str));
649
+ }
650
+ this.isRoot = function isRoot()
651
+ {
652
+ return (this._self() == 0);
653
+ }
654
+ this.consoleUid = function consoleUid()
655
+ {
656
+ var checkstr = process.platform == 'darwin' ? 'console' : ':0';
657
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
658
+ child.stdout.str = '';
659
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
660
+ child.stdin.write('who\nexit\n');
661
+ child.waitExit();
662
+
663
+ var lines = child.stdout.str.split('\n');
664
+ var tokens, i, j;
665
+ for (i in lines)
666
+ {
667
+ tokens = lines[i].split(' ');
668
+ for (j = 1; j < tokens.length; ++j)
669
+ {
670
+ if (tokens[j].length > 0 && tokens[j] == checkstr)
671
+ {
672
+ return (parseInt(this._users()[tokens[0]]));
673
+ }
674
+ }
675
+ }
676
+ throw ('nobody logged into console');
677
+ }
678
+ }
679
+
680
+
681
}
682
function showActiveOnly(source)
683
{
agents/modules_meshcore/user-sessions.js
+126
-7
@@ -78,12 +78,20 @@ function UserSessions()
78
this._marshal = require('_GenericMarshal');
79
this._kernel32 = this._marshal.CreateNativeProxy('Kernel32.dll');
80
this._kernel32.CreateMethod('GetLastError');
81
- this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll');
82
- this._wts.CreateMethod('WTSEnumerateSessionsA');
83
- this._wts.CreateMethod('WTSQuerySessionInformationA');
84
- this._wts.CreateMethod('WTSRegisterSessionNotification');
85
- this._wts.CreateMethod('WTSUnRegisterSessionNotification');
86
- this._wts.CreateMethod('WTSFreeMemory');
81
+
82
+ try
83
+ {
84
+ this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll');
85
+ this._wts.CreateMethod('WTSEnumerateSessionsA');
86
+ this._wts.CreateMethod('WTSQuerySessionInformationA');
87
+ this._wts.CreateMethod('WTSRegisterSessionNotification');
88
+ this._wts.CreateMethod('WTSUnRegisterSessionNotification');
89
+ this._wts.CreateMethod('WTSFreeMemory');
90
+ }
91
+ catch(exc)
92
+ {
93
+ }
94
+
95
this._user32 = this._marshal.CreateNativeProxy('user32.dll');
96
this._user32.CreateMethod('RegisterPowerSettingNotification');
97
this._user32.CreateMethod('UnregisterPowerSettingNotification');
@@ -203,7 +211,7 @@ function UserSessions()
211
this.immediate = setImmediate(function (self)
212
{
213
// Now that we have a window handle, we can register it to receive Windows Messages
206
- self.parent._wts.WTSRegisterSessionNotification(self.parent.hwnd, NOTIFY_FOR_ALL_SESSIONS);
214
+ if (self.parent._wts) { self.parent._wts.WTSRegisterSessionNotification(self.parent.hwnd, NOTIFY_FOR_ALL_SESSIONS); }
215
self.parent._user32.ACDC_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_ACDC_POWER_SOURCE, 0);
216
self.parent._user32.BATT_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_BATTERY_PERCENTAGE_REMAINING, 0);
217
self.parent._user32.DISP_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_CONSOLE_DISPLAY_STATE, 0);
@@ -307,6 +315,38 @@ function UserSessions()
315
{
316
this.user_session.emit('changed');
317
});
318
+ this._users = function _users()
319
+ {
320
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
321
+ child.stdout.str = '';
322
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
323
+ child.stdin.write('awk -F: \'($3 >= 0) {printf "%s:%s\\n", $1, $3}\' /etc/passwd\nexit\n');
324
+ child.waitExit();
325
+
326
+ var lines = child.stdout.str.split('\n');
327
+ var ret = {}, tokens;
328
+ for (var ln in lines)
329
+ {
330
+ tokens = lines[ln].split(':');
331
+ if (tokens[0]) { ret[tokens[0]] = tokens[1]; }
332
+ }
333
+ return (ret);
334
+ }
335
+ this._uids = function _uids() {
336
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
337
+ child.stdout.str = '';
338
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
339
+ child.stdin.write('awk -F: \'($3 >= 0) {printf "%s:%s\\n", $1, $3}\' /etc/passwd\nexit\n');
340
+ child.waitExit();
341
+
342
+ var lines = child.stdout.str.split('\n');
343
+ var ret = {}, tokens;
344
+ for (var ln in lines) {
345
+ tokens = lines[ln].split(':');
346
+ if (tokens[0]) { ret[tokens[1]] = tokens[0]; }
347
+ }
348
+ return (ret);
349
+ }
350
this.Self = function Self()
351
{
352
var promise = require('promise');
@@ -501,6 +541,43 @@ function UserSessions()
541
}
542
else if(process.platform == 'darwin')
543
{
544
+ this._users = function ()
545
+ {
546
+ var child = require('child_process').execFile('/usr/bin/dscl', ['dscl', '.', 'list', '/Users', 'UniqueID']);
547
+ child.stdout.str = '';
548
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
549
+ child.stdin.write('exit\n');
550
+ child.waitExit();
551
+
552
+ var lines = child.stdout.str.split('\n');
553
+ var tokens, i;
554
+ var users = {};
555
+
556
+ for (i = 0; i < lines.length; ++i) {
557
+ tokens = lines[i].split(' ');
558
+ if (tokens[0]) { users[tokens[0]] = tokens[tokens.length - 1]; }
559
+ }
560
+
561
+ return (users);
562
+ }
563
+ this._uids = function () {
564
+ var child = require('child_process').execFile('/usr/bin/dscl', ['dscl', '.', 'list', '/Users', 'UniqueID']);
565
+ child.stdout.str = '';
566
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
567
+ child.stdin.write('exit\n');
568
+ child.waitExit();
569
+
570
+ var lines = child.stdout.str.split('\n');
571
+ var tokens, i;
572
+ var users = {};
573
+
574
+ for (i = 0; i < lines.length; ++i) {
575
+ tokens = lines[i].split(' ');
576
+ if (tokens[0]) { users[tokens[tokens.length - 1]] = tokens[0]; }
577
+ }
578
+
579
+ return (users);
580
+ }
581
this._idTable = function()
582
{
583
var table = {};
@@ -559,6 +636,48 @@ function UserSessions()
636
if (cb) { cb.call(this, users); }
637
}
638
}
639
+
640
+ if(process.platform == 'linux' || process.platform == 'darwin')
641
+ {
642
+ this._self = function _self()
643
+ {
644
+ var child = require('child_process').execFile('/usr/bin/id', ['id', '-u']);
645
+ child.stdout.str = '';
646
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
647
+ child.waitExit();
648
+ return (parseInt(child.stdout.str));
649
+ }
650
+ this.isRoot = function isRoot()
651
+ {
652
+ return (this._self() == 0);
653
+ }
654
+ this.consoleUid = function consoleUid()
655
+ {
656
+ var checkstr = process.platform == 'darwin' ? 'console' : ':0';
657
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
658
+ child.stdout.str = '';
659
+ child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
660
+ child.stdin.write('who\nexit\n');
661
+ child.waitExit();
662
+
663
+ var lines = child.stdout.str.split('\n');
664
+ var tokens, i, j;
665
+ for (i in lines)
666
+ {
667
+ tokens = lines[i].split(' ');
668
+ for (j = 1; j < tokens.length; ++j)
669
+ {
670
+ if (tokens[j].length > 0 && tokens[j] == checkstr)
671
+ {
672
+ return (parseInt(this._users()[tokens[0]]));
673
+ }
674
+ }
675
+ }
676
+ throw ('nobody logged into console');
677
+ }
678
+ }
679
+
680
+
681
}
682
function showActiveOnly(source)
683
{
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.2.3-a",
3
+ "version": "0.2.3-c",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
public/commander.htm
+188
-186
@@ -32,38 +32,38 @@ d));a=d;break;case 43:if(8>b.amtaccumulator.length)break;a=8;break;case 65:if(8>
32
a.length+"): "+rstr2hex(a));if(null!=b.socket&&b.socket.readyState==WebSocket.OPEN){for(var d=new Uint8Array(a.length),f=0;f<a.length;++f)d[f]=a.charCodeAt(f);b.socket.send(d.buffer)}};b.Send=function(a){null!=b.socket&&1==b.connectstate&&(1==b.protocol?b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(a.length)+a):b.xxSend(a))};b.xxSendAmtKeepAlive=function(){null!=b.socket&&b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";
33
b.xxRandomNonce=function(a){for(var d="",f=0;f<a;f++)d+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*b.xxRandomNonceX.length));return d};b.xxOnSocketClosed=function(){urlvars&&urlvars.redirtrace&&console.log("REDIR-CLOSED");b.Stop()};b.xxStateChange=function(a){if(b.State!=a&&(b.State=a,b.m.xxStateChange(b.State),null!=b.onStateChanged))b.onStateChanged(b,b.State)};b.Stop=function(){b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";null!=b.socket&&(b.socket.close(),b.socket=null);null!=
34
b.amtkeepalivetimer&&(clearInterval(b.amtkeepalivetimer),b.amtkeepalivetimer=null)};b.RedirectStartSol=String.fromCharCode(16,0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b},WsmanStackCreateService=function(a,b,c,d,f,n){function p(a){for(var c,b={},l=0;l<a.childNodes.length;l++){var h=a.childNodes[l];c=null==h.childElementCount||0==h.childElementCount?h.textContent:p(h);"true"==c&&(c=!0);"false"==
35
-c&&(c=!1);parseInt(c)+""===c&&(c=parseInt(c));var g=c;if(null!=h.attributes&&0<h.attributes.length)for(g={Value:c},c=0;c<h.attributes.length;c++)g["@"+h.attributes[c].name]=h.attributes[c].value;b[h.localName]instanceof Array?b[h.localName].push(g):b[h.localName]=null==b[h.localName]?g:[b[h.localName],g]}return b}function r(a){if(!a)return"";var c=" ",b;for(b in a)a.hasOwnProperty(b)&&0===b.indexOf("@")&&(c+=b.substring(1)+'="'+a[b]+'" ');return c}function l(a){if(!a)return"";if("string"==typeof a)return a;
35
+c&&(c=!1);parseInt(c)+""===c&&(c=parseInt(c));var g=c;if(null!=h.attributes&&0<h.attributes.length)for(g={Value:c},c=0;c<h.attributes.length;c++)g["@"+h.attributes[c].name]=h.attributes[c].value;b[h.localName]instanceof Array?b[h.localName].push(g):b[h.localName]=null==b[h.localName]?g:[b[h.localName],g]}return b}function r(a){if(!a)return"";var c="",b;for(b in a)a.hasOwnProperty(b)&&0===b.indexOf("@")&&(c+=" "+b.substring(1)+'="'+a[b]+'"');return c}function l(a){if(!a)return"";if("string"==typeof a)return a;
36
if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";var c="<w:SelectorSet>",b;for(b in a)if(a.hasOwnProperty(b)){c+='<w:Selector Name="'+b+'">';if(a[b].ReferenceParameters){var c=c+"<a:EndpointReference>",c=c+("<a:Address>"+a[b].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+a[b].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>"),l=a[b].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(l))for(var h=
37
0;h<l.length;h++)c+="<w:Selector"+r(l[h])+">"+l[h].Value+"</w:Selector>";else c+="<w:Selector"+r(l)+">"+l.Value+"</w:Selector>";c+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else c+=a[b];c+="</w:Selector>"}return c+"</w:SelectorSet>"}var k={NextMessageId:1,Address:"/wsman"};k.comm=CreateWsmanComm(a,b,c,d,f,n);k.PerformAjax=function(a,c,b,l,h){null==h&&(h="");k.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+
38
-h+"><Header><a:Action>"+a,function(a,b,l){200!=b?c(k,null,{Header:{HttpError:b}},b,l):(a=k.ParseWsman(a))&&null!=a?c(k,a.Header.ResourceURI,a,200,l):c(k,null,{Header:{HttpError:b}},601,l)},b,l)};k.CancelAllQueries=function(a){k.comm.CancelAllQueries(a)};k.GetNameFromUrl=function(a){var c=a.lastIndexOf("/");return-1==c?a:a.substring(c+1)};k.ExecSubscribe=function(a,c,b,d,h,g,D,m,E,x){var w="",F="";m="";null!=E&&null!=x&&(w='<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>'+
39
-E+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+x+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",F='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=m&&(m="<a:ReferenceParameters><m:arg>"+m+"</m:arg></a:ReferenceParameters>");"PushWithAck"==c?c="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==c&&(c="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");
40
-a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+l(D)+w+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+c+'"><e:NotifyTo><a:Address>'+b+"</a:Address>"+m+"</e:NotifyTo>"+F+"</e:Delivery></e:Subscribe>";k.PerformAjax(a+"</Body></Envelope>",d,h,
38
+h+"><Header><a:Action>"+a,function(a,b,l){200!=b?c(k,null,{Header:{HttpError:b}},b,l):(a=k.ParseWsman(a))&&null!=a?c(k,a.Header.ResourceURI,a,200,l):c(k,null,{Header:{HttpError:b}},601,l)},b,l)};k.CancelAllQueries=function(a){k.comm.CancelAllQueries(a)};k.GetNameFromUrl=function(a){var c=a.lastIndexOf("/");return-1==c?a:a.substring(c+1)};k.ExecSubscribe=function(a,c,b,d,h,g,E,m,F,w){var y="",C="";m="";null!=F&&null!=w&&(y='<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>'+
39
+F+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+w+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",C='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=m&&(m="<a:ReferenceParameters><m:arg>"+m+"</m:arg></a:ReferenceParameters>");"PushWithAck"==c?c="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==c&&(c="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");
40
+a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+l(E)+y+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+c+'"><e:NotifyTo><a:Address>'+b+"</a:Address>"+m+"</e:NotifyTo>"+C+"</e:Delivery></e:Subscribe>";k.PerformAjax(a+"</Body></Envelope>",d,h,
41
g,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};k.ExecUnSubscribe=function(a,c,b,d,h){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+l(h)+"</Header><Body><e:Unsubscribe/>";k.PerformAjax(a+"</Body></Envelope>",c,b,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};
42
-k.ExecPut=function(a,c,b,d,h,g){g="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+l(g)+"</Header><Body>";if(a&&null!=c){var D=k.GetNameFromUrl(a);a="<r:"+D+' xmlns:r="'+a+'">';for(var m in c)if(c.hasOwnProperty(m)&&
43
-0!==m.indexOf("__")&&0!==m.indexOf("@")&&null!=c[m]&&"function"!==typeof c[m])if("object"===typeof c[m]&&c[m].ReferenceParameters){a+="<r:"+m+"><a:Address>"+c[m].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+c[m].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var E=c[m].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(E))for(var x=0;x<E.length;x++)a+="<w:Selector"+r(E[x])+">"+E[x].Value+"</w:Selector>";else a+="<w:Selector"+r(E)+">"+E.Value+"</w:Selector>";
44
-a+="</w:SelectorSet></a:ReferenceParameters></r:"+m+">"}else if(Array.isArray(c[m]))for(x=0;x<c[m].length;x++)a+="<r:"+m+">"+c[m][x].toString()+"</r:"+m+">";else a+="<r:"+m+">"+c[m].toString()+"</r:"+m+">";c=a+("</r:"+D+">")}else c="";k.PerformAjax(g+c+"</Body></Envelope>",b,d,h)};k.ExecCreate=function(a,c,b,d,h,g){var D=k.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +
45
-"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+l(g)+"</Header><Body><g:"+D+' xmlns:g="'+a+'">';for(var m in c)a+="<g:"+m+">"+c[m]+"</g:"+m+">";k.PerformAjax(a+"</g:"+D+"></Body></Envelope>",b,d,h)};k.ExecDelete=function(a,c,b,d,h){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +
42
+k.ExecPut=function(a,c,b,d,h,g){g="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+l(g)+"</Header><Body>";if(a&&null!=c){var E=k.GetNameFromUrl(a);a="<r:"+E+' xmlns:r="'+a+'">';for(var m in c)if(c.hasOwnProperty(m)&&
43
+0!==m.indexOf("__")&&0!==m.indexOf("@")&&null!=c[m]&&"function"!==typeof c[m])if("object"===typeof c[m]&&c[m].ReferenceParameters){a+="<r:"+m+"><a:Address>"+c[m].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+c[m].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var F=c[m].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(F))for(var w=0;w<F.length;w++)a+="<w:Selector"+r(F[w])+">"+F[w].Value+"</w:Selector>";else a+="<w:Selector"+r(F)+">"+F.Value+"</w:Selector>";
44
+a+="</w:SelectorSet></a:ReferenceParameters></r:"+m+">"}else if(Array.isArray(c[m]))for(w=0;w<c[m].length;w++)a+="<r:"+m+">"+c[m][w].toString()+"</r:"+m+">";else a+="<r:"+m+">"+c[m].toString()+"</r:"+m+">";c=a+("</r:"+E+">")}else c="";k.PerformAjax(g+c+"</Body></Envelope>",b,d,h)};k.ExecCreate=function(a,c,b,d,h,g){var E=k.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +
45
+"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+l(g)+"</Header><Body><g:"+E+' xmlns:g="'+a+'">';for(var m in c)a+="<g:"+m+">"+c[m]+"</g:"+m+">";k.PerformAjax(a+"</g:"+E+"></Body></Envelope>",b,d,h)};k.ExecDelete=function(a,c,b,d,h){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +
46
"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+l(c)+"</Header><Body /></Envelope>";k.PerformAjax(a,b,d,h)};k.ExecGet=function(a,c,b,l){k.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",
47
-c,b,l)};k.ExecMethod=function(a,c,b,l,h,g,d){var m="",E;for(E in b)if(null!=b[E])if(Array.isArray(b[E]))for(var x in b[E])m+="<r:"+E+">"+b[E][x]+"</r:"+E+">";else m+="<r:"+E+">"+b[E]+"</r:"+E+">";k.ExecMethodXml(a,c,m,l,h,g,d)};k.ExecMethodXml=function(a,c,b,d,h,g,D){k.PerformAjax(a+"/"+c+"</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
48
-l(D)+"</Header><Body><r:"+c+'_INPUT xmlns:r="'+a+'">'+b+"</r:"+c+"_INPUT></Body></Envelope>",d,h,g)};k.ExecEnum=function(a,c,b,l){k.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',
47
+c,b,l)};k.ExecMethod=function(a,c,b,l,h,g,d){var m="",F;for(F in b)if(null!=b[F])if(Array.isArray(b[F]))for(var w in b[F])m+="<r:"+F+">"+b[F][w]+"</r:"+F+">";else m+="<r:"+F+">"+b[F]+"</r:"+F+">";k.ExecMethodXml(a,c,m,l,h,g,d)};k.ExecMethodXml=function(a,c,b,d,h,g,E){k.PerformAjax(a+"/"+c+"</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
48
+l(E)+"</Header><Body><r:"+c+'_INPUT xmlns:r="'+a+'">'+b+"</r:"+c+"_INPUT></Body></Envelope>",d,h,g)};k.ExecEnum=function(a,c,b,l){k.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',
49
c,b,l)};k.ExecPull=function(a,c,b,l,h){k.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+k.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+k.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+c+"</EnumerationContext></Pull></Body></Envelope>",
50
b,l,h)};k.ParseWsman=function(a){try{if(!a.childNodes){var c=a;if(window.DOMParser)a=(new DOMParser).parseFromString(c,"text/xml");else{var b=new ActiveXObject("Microsoft.XMLDOM");b.async=!1;b.loadXML(c);a=b}}var c={Header:{}},l=a.getElementsByTagName("Header")[0],h;l||(l=a.getElementsByTagName("a:Header")[0]);if(!l)return null;for(b=0;b<l.childNodes.length;b++){var g=l.childNodes[b];c.Header[g.localName]=g.textContent}var d=a.getElementsByTagName("Body")[0];d||(d=a.getElementsByTagName("a:Body")[0]);
51
if(!d)return null;0<d.childNodes.length&&(h=d.childNodes[0].localName,h.indexOf("_OUTPUT")==h.length-7&&(h=h.substring(0,h.length-7)),c.Header.Method=h,c.Body=p(d.childNodes[0]));return c}catch(m){return console.log("Unable to parse XML: "+a),null}};return k};
52
-function AmtStackCreateService(a){function b(){var a=e.GetPendingActions();u<a&&(u=a);null!=e.onProcessChanged&&B!=a&&(B=a,e.onProcessChanged(a,u));0==a&&(u=0)}function c(a,c,b,l,g,h,y){200!=g?(b(e,a,null,g,h),f(1)):null!=c&&"EnumerateResponse"==c.Header.Method&&c.Body.EnumerationContext?e.wsman.ExecPull(l,c.Body.EnumerationContext,function(c,l,g,x){d(a,g,b,l,[],x,h,y)}):(b(e,a,null,603,h),f(1))}function d(a,c,l,g,h,m,y,k){if(200!=m)l(e,a,null,m,y),f(1);else if(null==c||"PullResponse"!=c.Header.Method)l(e,
53
-a,null,604,y),f(1);else{for(var v in c.Body.Items)if(c.Body.Items[v]instanceof Array)for(var u in c.Body.Items[v])"function"!=typeof c.Body.Items[v][u]&&h.push(c.Body.Items[v][u]);else"function"!=typeof c.Body.Items[v]&&h.push(c.Body.Items[v]);c.Body.EnumerationContext?e.wsman.ExecPull(g,c.Body.EnumerationContext,function(c,b,g,x){d(a,g,l,b,h,x,y,1)}):(f(1),l(e,a,h,m,y),b())}}function f(a){e.ActiveEnumsCount-=a;e.ActiveEnumsCount>=e.MaxActiveEnumsCount||0==e.PendingEnums.length?b():(a=e.PendingEnums.shift(),
54
-e.Enum(a[0],a[1],a[2]),f(0))}function n(a,c,l,g,h,d,y){e.PendingBatchOperations-=2;var m=c.shift(),k=e.Enum;"*"==m[0]&&(k=e.Get,m=m.substring(1));k(m,function(h,m,k,A,C){C[2][m]={response:null==k?null:k.Body,responses:k,status:A};0==C[1].length||401==A||1!=d&&200!=A&&400!=A?(e.PendingBatchOperations-=2*c.length,b(),l(e,a,C[2],A,g)):(b(),n(a,c,l,g,C[2],y))},[a,c,h],y);b()}function p(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),
55
-function(c,b,l,g){null==l||200!=g?a.callback(e,a.name,null,g,a.tag):(a.responses[l.Header.Method]=l,p(a))},a.pri),a.current++);b()}function r(a,c,b,g,h){if(200!=g||"0"!=b.Body.ReturnValue)h[0](e,null,h[2]);else e.AMT_MessageLog_GetRecords(b.Body.IterationIdentifier,390,l,h)}function l(a,c,b,g,h){if(200!=g||"0"!=b.Body.ReturnValue)h[0](e,null,h[2]);else{var d,y,m;c=h[2];g=new Date;var v=b.Body.RecordArray;"string"===typeof v&&(b.Body.RecordArray=[b.Body.RecordArray]);for(d in v){a=null;try{a=window.atob(v[d])}catch(u){}if(null!=
56
-a&&(y=ReadIntX(a,0),0<y&&4294967295>y)){m={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),EventData:[],Time:new Date(1E3*(y+60*g.getTimezoneOffset()))};for(y=13;21>y;y++)m.EventData.push(a.charCodeAt(y));m.EntityStr=D[m.Entity];m.Desc=k(m.EventSensorType,m.EventOffset,m.EventData,m.Entity);
52
+function AmtStackCreateService(a){function b(){var a=e.GetPendingActions();u<a&&(u=a);null!=e.onProcessChanged&&B!=a&&(B=a,e.onProcessChanged(a,u));0==a&&(u=0)}function c(a,c,b,l,g,h,z){200!=g?(b(e,a,null,g,h),f(1)):null!=c&&"EnumerateResponse"==c.Header.Method&&c.Body.EnumerationContext?e.wsman.ExecPull(l,c.Body.EnumerationContext,function(c,l,g,w){d(a,g,b,l,[],w,h,z)}):(b(e,a,null,603,h),f(1))}function d(a,c,l,g,h,m,z,k){if(200!=m)l(e,a,null,m,z),f(1);else if(null==c||"PullResponse"!=c.Header.Method)l(e,
53
+a,null,604,z),f(1);else{for(var v in c.Body.Items)if(c.Body.Items[v]instanceof Array)for(var u in c.Body.Items[v])"function"!=typeof c.Body.Items[v][u]&&h.push(c.Body.Items[v][u]);else"function"!=typeof c.Body.Items[v]&&h.push(c.Body.Items[v]);c.Body.EnumerationContext?e.wsman.ExecPull(g,c.Body.EnumerationContext,function(c,b,g,w){d(a,g,l,b,h,w,z,1)}):(f(1),l(e,a,h,m,z),b())}}function f(a){e.ActiveEnumsCount-=a;e.ActiveEnumsCount>=e.MaxActiveEnumsCount||0==e.PendingEnums.length?b():(a=e.PendingEnums.shift(),
54
+e.Enum(a[0],a[1],a[2]),f(0))}function n(a,c,l,g,h,d,z){e.PendingBatchOperations-=2;var m=c.shift(),k=e.Enum;"*"==m[0]&&(k=e.Get,m=m.substring(1));k(m,function(h,m,k,A,D){D[2][m]={response:null==k?null:k.Body,responses:k,status:A};0==D[1].length||401==A||1!=d&&200!=A&&400!=A?(e.PendingBatchOperations-=2*c.length,b(),l(e,a,D[2],A,g)):(b(),n(a,c,l,g,D[2],z))},[a,c,h],z);b()}function p(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),
55
+function(c,b,l,g){null==l||200!=g?a.callback(e,a.name,null,g,a.tag):(a.responses[l.Header.Method]=l,p(a))},a.pri),a.current++);b()}function r(a,c,b,g,h){if(200!=g||"0"!=b.Body.ReturnValue)h[0](e,null,h[2]);else e.AMT_MessageLog_GetRecords(b.Body.IterationIdentifier,390,l,h)}function l(a,c,b,g,h){if(200!=g||"0"!=b.Body.ReturnValue)h[0](e,null,h[2]);else{var d,z,m;c=h[2];g=new Date;var v=b.Body.RecordArray;"string"===typeof v&&(b.Body.RecordArray=[b.Body.RecordArray]);for(d in v){a=null;try{a=window.atob(v[d])}catch(u){}if(null!=
56
+a&&(z=ReadIntX(a,0),0<z&&4294967295>z)){m={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),EventData:[],Time:new Date(1E3*(z+60*g.getTimezoneOffset()))};for(z=13;21>z;z++)m.EventData.push(a.charCodeAt(z));m.EntityStr=E[m.Entity];m.Desc=k(m.EventSensorType,m.EventOffset,m.EventData,m.Entity);
57
m.EntityStr||(m.EntityStr="Unknown");c.push(m)}}if(1!=b.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(b.Body.IterationIdentifier,390,l,[h[0],c,h[2]]);else h[0](e,c,h[2])}}function k(a,c,b,l){if(15==a)return 235==b[0]?"Invalid Data":0==c?h[b[1]]:g[b[1]];if(18==a&&170==b[0])return"Agent watchdog "+char2hex(b[4])+char2hex(b[3])+char2hex(b[2])+char2hex(b[1])+"-"+char2hex(b[6])+char2hex(b[5])+"-... changed to "+e.WatchdogCurrentStates[b[7]];if(5==a&&0==c)return"Case intrusion";if(192==a&&0==c&&170==b[0]&&
58
48==b[1]){if(0==b[2])return"A remote Serial Over LAN session was established.";if(1==b[2])return"Remote Serial Over LAN session finished. User control was restored.";if(2==b[2])return"A remote IDE-Redirection session was established.";if(3==b[2])return"Remote IDE-Redirection session finished. User control was restored."}if(36==a)return a=(b[1]<<24)+(b[2]<<16)+(b[3]<<8)+b[4],c="#"+b[0],170==b[0]&&(c="wired"),4294967293==a?"All received packet filter was matched on "+c+" interface.":4294967292==a?"All outbound packet filter was matched on "+
59
c+" interface.":4294967290==a?"Spoofed packet filter was matched on "+c+" interface.":"Filter "+a+" was matched on "+c+" interface.";if(192==a)return 0==b[2]?"Security policy invoked. Some or all network traffic (TX) was stopped.":2==b[2]?"Security policy invoked. Some or all network traffic (RX) was stopped.":"Security policy invoked.";if(193==a){if(170==b[0]&&48==b[1]&&0==b[2]&&0==b[3])return"User request for remote connection.";if(170==b[0]&&32==b[1]&&3==b[2]&&1==b[3])return"EAC error: attempt to get posture while NAC in Intel\ufffd AMT is disabled.";
60
-if(170==b[0]&&32==b[1]&&4==b[2]&&0==b[3])return"Certificate revoked. "}return 6==a?"Authentication failed "+(b[1]+(b[2]<<8))+" times. The system may be under attack.":30==a?"No bootable media":32==a?"Operating system lockup or power interrupt":35==a?"System boot failure":37==a?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+a}function v(a,c,b,l,g){if(200!=l)g[0](e,[],l);else{var h,y,d=g[1],k=new Date,u;if(0<b.Body.RecordsReturned)for(y in b.Body.EventRecords=
61
-MakeToArray(b.Body.EventRecords),b.Body.EventRecords){a=null;try{a=window.atob(b.Body.EventRecords[y])}catch(B){console.log(B+" "+b.Body.EventRecords[y])}c={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};c.AuditApp=m[c.AuditAppID];c.Event=m[100*c.AuditAppID+c.EventID];c.Event||(c.Event="#"+c.EventID);0==c.InitiatorType&&(h=a.charCodeAt(5),c.Initiator=a.substring(6,6+h),h=6+h);1==c.InitiatorType&&(c.KerberosUserInDomain=ReadInt(a,5),h=a.charCodeAt(9),c.Initiator=GetSidString(a.substring(10,
62
-10+h)),h=10+h);2==c.InitiatorType&&(c.Initiator="<i>Local</i>",h=5);3==c.InitiatorType&&(c.Initiator="<i>KVM Default Port</i>",h=5);u=ReadInt(a,h);c.Time=new Date(1E3*(u+60*k.getTimezoneOffset()));h+=4;c.MCLocationType=a.charCodeAt(h++);u=a.charCodeAt(h++);c.NetAddress=a.substring(h,h+u);h+=u;u=a.charCodeAt(h++);c.Ex=a.substring(h,h+u);c.ExStr=e.GetAuditLogExtendedDataStr(100*c.AuditAppID+c.EventID,c.Ex);d.push(c)}if(b.Body.TotalRecordCount>d.length)e.AMT_AuditLog_ReadRecords(d.length+1,v,[g[0],d]);
63
-else g[0](e,d,l)}}var e={};e.wsman=a;e.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var u=0,B=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,
64
-c,l,h,g,d,y,m,k,v){e.wsman.ExecSubscribe(e.CompleteName(a),c,l,function(c,l,w,y){b();h(e,a,w,y,g)},0,d,y,m,k,v);b()};e.UnSubscribe=function(a,c,l,h,g){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(h,g,d,m){b();c(e,a,d,m,l)},0,h,g);b()};e.Get=function(a,c,l,h){e.wsman.ExecGet(e.CompleteName(a),function(h,g,y,d){b();c(e,a,y,d,l)},0,h);b()};e.Put=function(a,c,l,h,g,d){e.wsman.ExecPut(e.CompleteName(a),c,function(c,g,d,m){b();l(e,a,d,m,h)},0,g,d);b()};e.Create=function(a,c,l,h,g){e.wsman.ExecCreate(e.CompleteName(a),
65
-c,function(c,g,d,m){b();l(e,a,d,m,h)},0,g);b()};e.Delete=function(a,c,l,h,g){e.wsman.ExecDelete(e.CompleteName(a),c,function(c,g,d,m){b();l(e,a,d,m,h)},0,g);b()};e.Exec=function(a,c,l,h,g,d,y){e.wsman.ExecMethod(e.CompleteName(a),c,l,function(c,l,w,d){b();h(e,a,e.CompleteExecResponse(w),d,g)},0,d,y);b()};e.ExecWithXml=function(a,c,l,h,g,d,y){e.wsman.ExecMethodXml(e.CompleteName(a),c,execArgumentsToXml(l),function(c,l,w,d){b();h(e,a,e.CompleteExecResponse(w),d,g)},0,d,y);b()};e.Enum=function(a,l,w,
66
-h){e.ActiveEnumsCount<e.MaxActiveEnumsCount?(e.ActiveEnumsCount++,e.wsman.ExecEnum(e.CompleteName(a),function(w,h,g,d,m){b();c(a,g,l,h,d,m)},w,h)):e.PendingEnums.push([a,l,w,h]);b()};e.BatchEnum=function(a,c,l,h,g,d){e.PendingBatchOperations+=2*c.length;n(a,Clone(c),l,h,{},g,d);b()};e.BatchGet=function(a,c,l,h,g){p({name:a,names:c,callback:l,current:0,responses:{},tag:h,pri:g});b()};e.CompleteName=function(a){if(0==a.indexOf("AMT_"))return e.pfx[0]+a;if(0==a.indexOf("CIM_"))return e.pfx[1]+a;if(0==
60
+if(170==b[0]&&32==b[1]&&4==b[2]&&0==b[3])return"Certificate revoked. "}return 6==a?"Authentication failed "+(b[1]+(b[2]<<8))+" times. The system may be under attack.":30==a?"No bootable media":32==a?"Operating system lockup or power interrupt":35==a?"System boot failure":37==a?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+a}function v(a,c,b,l,g){if(200!=l)g[0](e,[],l);else{var h,d,k=g[1],x=new Date,u;if(0<b.Body.RecordsReturned)for(d in b.Body.EventRecords=
61
+MakeToArray(b.Body.EventRecords),b.Body.EventRecords){a=null;try{a=window.atob(b.Body.EventRecords[d])}catch(B){console.log(B+" "+b.Body.EventRecords[d])}c={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};c.AuditApp=m[c.AuditAppID];c.Event=m[100*c.AuditAppID+c.EventID];c.Event||(c.Event="#"+c.EventID);0==c.InitiatorType&&(h=a.charCodeAt(5),c.Initiator=a.substring(6,6+h),h=6+h);1==c.InitiatorType&&(c.KerberosUserInDomain=ReadInt(a,5),h=a.charCodeAt(9),c.Initiator=GetSidString(a.substring(10,
62
+10+h)),h=10+h);2==c.InitiatorType&&(c.Initiator="<i>Local</i>",h=5);3==c.InitiatorType&&(c.Initiator="<i>KVM Default Port</i>",h=5);u=ReadInt(a,h);c.Time=new Date(1E3*(u+60*x.getTimezoneOffset()));h+=4;c.MCLocationType=a.charCodeAt(h++);u=a.charCodeAt(h++);c.NetAddress=a.substring(h,h+u);h+=u;u=a.charCodeAt(h++);c.Ex=a.substring(h,h+u);c.ExStr=e.GetAuditLogExtendedDataStr(100*c.AuditAppID+c.EventID,c.Ex);k.push(c)}if(b.Body.TotalRecordCount>k.length)e.AMT_AuditLog_ReadRecords(k.length+1,v,[g[0],k]);
63
+else g[0](e,k,l)}}var e={};e.wsman=a;e.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var u=0,B=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,
64
+c,l,h,g,d,z,m,k,v){e.wsman.ExecSubscribe(e.CompleteName(a),c,l,function(c,l,y,d){b();h(e,a,y,d,g)},0,d,z,m,k,v);b()};e.UnSubscribe=function(a,c,l,h,g){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(h,g,d,m){b();c(e,a,d,m,l)},0,h,g);b()};e.Get=function(a,c,l,h){e.wsman.ExecGet(e.CompleteName(a),function(h,g,d,m){b();c(e,a,d,m,l)},0,h);b()};e.Put=function(a,c,l,h,g,d){e.wsman.ExecPut(e.CompleteName(a),c,function(c,g,d,m){b();l(e,a,d,m,h)},0,g,d);b()};e.Create=function(a,c,l,h,g){e.wsman.ExecCreate(e.CompleteName(a),
65
+c,function(c,g,d,m){b();l(e,a,d,m,h)},0,g);b()};e.Delete=function(a,c,l,h,g){e.wsman.ExecDelete(e.CompleteName(a),c,function(c,g,d,m){b();l(e,a,d,m,h)},0,g);b()};e.Exec=function(a,c,l,h,g,d,z){e.wsman.ExecMethod(e.CompleteName(a),c,l,function(c,l,y,d){b();h(e,a,e.CompleteExecResponse(y),d,g)},0,d,z);b()};e.ExecWithXml=function(a,c,l,h,g,d,z){e.wsman.ExecMethodXml(e.CompleteName(a),c,execArgumentsToXml(l),function(c,l,y,d){b();h(e,a,e.CompleteExecResponse(y),d,g)},0,d,z);b()};e.Enum=function(a,l,y,
66
+h){e.ActiveEnumsCount<e.MaxActiveEnumsCount?(e.ActiveEnumsCount++,e.wsman.ExecEnum(e.CompleteName(a),function(y,h,g,d,m){b();c(a,g,l,h,d,m)},y,h)):e.PendingEnums.push([a,l,y,h]);b()};e.BatchEnum=function(a,c,l,h,g,d){e.PendingBatchOperations+=2*c.length;n(a,Clone(c),l,h,{},g,d);b()};e.BatchGet=function(a,c,l,h,g){p({name:a,names:c,callback:l,current:0,responses:{},tag:h,pri:g});b()};e.CompleteName=function(a){if(0==a.indexOf("AMT_"))return e.pfx[0]+a;if(0==a.indexOf("CIM_"))return e.pfx[1]+a;if(0==
67
a.indexOf("IPS_"))return e.pfx[2]+a};e.CompleteExecResponse=function(a){a&&null!=a&&a.Body&&void 0!=a.Body.ReturnValue&&(a.Body.ReturnValueStr=e.AmtStatusToStr(a.Body.ReturnValue));return a};e.RequestPowerStateChange=function(a,c){e.CIM_PowerManagementService_RequestPowerStateChange(a,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',
68
null,null,c)};e.SetBootConfigRole=function(a,c){e.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',
69
a,c)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,c){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},c)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,c){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},c)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,c,b,l,h,g,
@@ -82,14 +82,14 @@ function(a,c,b){e.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:a,T
82
"PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:c,RecordNumber:b},l)};e.AMT_MessageLog_PositionToFirstRecord=function(a,c){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,c)};e.AMT_MessageLog_FreezeLog=function(a,c){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},c)};e.AMT_PublicKeyManagementService_AddCRL=function(a,c,b){e.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:a,SerialNumbers:c},b)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,c){e.Exec("AMT_PublicKeyManagementService",
83
"ResetCRLList",{_method_dummy:a},c)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,c){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},c)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,c){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},c)};e.AMT_PublicKeyManagementService_AddKey=function(a,c){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},c)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=
84
function(a,c,b,l){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:c,Usage:b},l)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,c,b,l){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:c,NullSignedCertificateRequest:b},l)};e.AMT_PublicKeyManagementService_GenerateKeyPair=function(a,c,b){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:c},b)};e.AMT_RedirectionService_RequestStateChange=
85
-function(a,c){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},c)};e.AMT_RedirectionService_TerminateSession=function(a,c){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},c)};e.AMT_RemoteAccessService_AddMpServer=function(a,c,b,l,h,g,d,m,k){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:c,Port:b,AuthMethod:l,Certificate:h,Username:g,Password:d,CN:m},k)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,c,b,l,h){e.Exec("AMT_RemoteAccessService",
86
-"AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:c,ExtendedData:b,MpServer:l},h)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,c){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,c){e.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,c){e.Exec("AMT_SetupAndConfigurationService","Unprovision",{ProvisioningMode:a},
87
-c)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,c){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,c){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,c){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",{Duration:a},c)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=
88
-function(a,c){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},c)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,c,b){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:c},b)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=
89
-function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout=function(a){e.Exec("AMT_SystemDefensePolicy","GetTimeout",{},a)};e.AMT_SystemDefensePolicy_SetTimeout=function(a,c){e.Exec("AMT_SystemDefensePolicy","SetTimeout",{Timeout:a},c)};e.AMT_SystemDefensePolicy_UpdateStatistics=
90
-function(a,c,b,l,h,g){e.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:c},b,l,h,g)};e.AMT_SystemPowerScheme_SetPowerScheme=function(a,c,b){e.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,b,0,{InstanceID:c})};e.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(a,c){e.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,c)};e.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=function(a,c,b,l,h){e.Exec("AMT_TimeSynchronizationService",
91
-"SetHighAccuracyTimeSynch",{Ta0:a,Tm1:c,Tm2:b},l,h)};e.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,c,b){e.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_WebUIService_RequestStateChange=function(a,c,b){e.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,c,b,l,h,g){e.ExecWithXml("AMT_WiFiPortConfigurationService","AddWiFiSettings",
92
-{WiFiEndpoint:a,WiFiEndpointSettingsInput:c,IEEE8021xSettingsInput:b,ClientCredential:l,CACredential:h},g)};e.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,c,b,l,h,g){e.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:c,IEEE8021xSettingsInput:b,ClientCredential:l,CACredential:h},g)};e.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,c){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",
85
+function(a,c){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},c)};e.AMT_RedirectionService_TerminateSession=function(a,c){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},c)};e.AMT_RemoteAccessService_AddMpServer=function(a,c,b,l,h,g,d,m,k){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:c,Port:b,AuthMethod:l,Certificate:h,Username:g,Password:d,CN:m},k)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,c,b,l,h,g){e.Exec("AMT_RemoteAccessService",
86
+"AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:c,ExtendedData:b,MpServer:l,InternalMpServer:h},g)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,c){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,c){e.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,c){e.Exec("AMT_SetupAndConfigurationService",
87
+"Unprovision",{ProvisioningMode:a},c)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,c){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,c){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,c){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",
88
+{Duration:a},c)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,c){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},c)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,c,b){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:c},b)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService",
89
+"GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout=function(a){e.Exec("AMT_SystemDefensePolicy","GetTimeout",{},a)};e.AMT_SystemDefensePolicy_SetTimeout=function(a,c){e.Exec("AMT_SystemDefensePolicy",
90
+"SetTimeout",{Timeout:a},c)};e.AMT_SystemDefensePolicy_UpdateStatistics=function(a,c,b,l,h,g){e.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:c},b,l,h,g)};e.AMT_SystemPowerScheme_SetPowerScheme=function(a,c,b){e.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,b,0,{InstanceID:c})};e.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(a,c){e.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,c)};e.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=
91
+function(a,c,b,l,h){e.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:c,Tm2:b},l,h)};e.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,c,b){e.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_WebUIService_RequestStateChange=function(a,c,b){e.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,c,b,l,h,g){e.ExecWithXml("AMT_WiFiPortConfigurationService",
92
+"AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:c,IEEE8021xSettingsInput:b,ClientCredential:l,CACredential:h},g)};e.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,c,b,l,h,g){e.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:c,IEEE8021xSettingsInput:b,ClientCredential:l,CACredential:h},g)};e.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,c){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",
93
{_method_dummy:a},c)};e.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(a,c){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:a},c)};e.CIM_Account_RequestStateChange=function(a,c,b){e.Exec("CIM_Account","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_AccountManagementService_CreateAccount=function(a,c,b){e.Exec("CIM_AccountManagementService","CreateAccount",{System:a,AccountTemplate:c},b)};e.CIM_BootConfigSetting_ChangeBootOrder=function(a,
94
c){e.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:a},c)};e.CIM_BootService_SetBootConfigRole=function(a,c,b){e.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:a,Role:c},b,0,1)};e.CIM_Card_ConnectorPower=function(a,c,b){e.Exec("CIM_Card","ConnectorPower",{Connector:a,PoweredOn:c},b)};e.CIM_Card_IsCompatible=function(a,c){e.Exec("CIM_Card","IsCompatible",{ElementToCheck:a},c)};e.CIM_Chassis_IsCompatible=function(a,c){e.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:a},c)};
95
e.CIM_Fan_SetSpeed=function(a,c){e.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:a},c)};e.CIM_KVMRedirectionSAP_RequestStateChange=function(a,c,b){e.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:a},b)};e.CIM_MediaAccessDevice_LockMedia=function(a,c){e.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:a},c)};e.CIM_MediaAccessDevice_SetPowerState=function(a,c,b){e.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:a,Time:c},b)};e.CIM_MediaAccessDevice_Reset=function(a){e.Exec("CIM_MediaAccessDevice",
@@ -116,7 +116,7 @@ TimeoutPeriod:c},b)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,c,b,l
116
2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};e.GetMessageLog=function(a,c){e.AMT_MessageLog_PositionToFirstRecord(r,
117
[a,c,[]])};var h="Unspecified.;No system memory is physically installed in the system.;No usable system memory, all installed memory has experienced an unrecoverable failure.;Unrecoverable hard-disk/ATAPI/IDE device failure.;Unrecoverable system-board failure.;Unrecoverable diskette subsystem failure.;Unrecoverable hard-disk controller failure.;Unrecoverable PS/2 or USB keyboard failure.;Removable boot media not found.;Unrecoverable video controller failure.;No video device detected.;Firmware (BIOS) ROM corruption detected.;CPU voltage mismatch (processors that share same supply have mismatched voltage requirements);CPU speed matching failure".split(";"),
118
g="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;User-initiated system setup;USB resource configuration;PCI resource configuration;Option ROM initialization;Video initialization;Cache initialization;SM Bus initialization;Keyboard controller initialization;Embedded controller/management controller initialization;Docking station attachment;Enabling docking station;Docking station ejection;Disabling docking station;Calling operating system wake-up vector;Starting operating system boot process;Baseboard or motherboard initialization;reserved;Floppy initialization;Keyboard test;Pointing device test;Primary processor initialization".split(";"),
119
-D="Unspecified;Other;Unknown;Processor;Disk;Peripheral;System management module;System board;Memory module;Processor module;Power supply;Add in card;Front panel board;Back panel board;Power system board;Drive backplane;System internal expansion board;Other system board;Processor board;Power unit;Power module;Power management board;Chassis back panel board;System chassis;Sub chassis;Other chassis board;Disk drive bay;Peripheral bay;Device bay;Fan cooling;Cooling unit;Cable interconnect;Memory device;System management software;BIOS;Intel(r) ME;System bus;Group;Intel(r) ME;External environment;Battery;Processing blade;Connectivity switch;Processor/memory module;I/O module;Processor I/O module;Management controller firmware;IPMI channel;PCI bus;PCI express bus;SCSI bus;SATA/SAS bus;Processor front side bus".split(";");
119
+E="Unspecified;Other;Unknown;Processor;Disk;Peripheral;System management module;System board;Memory module;Processor module;Power supply;Add in card;Front panel board;Back panel board;Power system board;Drive backplane;System internal expansion board;Other system board;Processor board;Power unit;Power module;Power management board;Chassis back panel board;System chassis;Sub chassis;Other chassis board;Disk drive bay;Peripheral bay;Device bay;Fan cooling;Cooling unit;Cable interconnect;Memory device;System management software;BIOS;Intel(r) ME;System bus;Group;Intel(r) ME;External environment;Battery;Processing blade;Connectivity switch;Processor/memory module;I/O module;Processor I/O module;Management controller firmware;IPMI channel;PCI bus;PCI express bus;SCSI bus;SATA/SAS bus;Processor front side bus".split(";");
120
e.RealmNames=";;Redirection;;Hardware Asset;Remote Control;Storage;Event Manager;Storage Admin;Agent Presence Local;Agent Presence Remote;Circuit Breaker;Network Time;General Information;Firmware Update;EIT;LocalUN;Endpoint Access Control;Endpoint Access Control Admin;Event Log Reader;Audit Log;ACL Realm;;;Local System".split(";");e.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};var m={16:"Security Admin",17:"RCO",18:"Redirection Manager",19:"Firmware Update Manager",
121
20:"Security Audit Log",21:"Network Time",22:"Network Administration",23:"Storage Administration",24:"Event Manager",25:"Circuit Breaker Manager",26:"Agent Presence Manager",27:"Wireless Configuration",28:"EAC",29:"KVM",30:"User Opt-In Events",32:"Screen Blanking",33:"Watchdog Events",1600:"Provisioning Started",1601:"Provisioning Completed",1602:"ACL Entry Added",1603:"ACL Entry Modified",1604:"ACL Entry Removed",1605:"ACL Access with Invalid Credentials",1606:"ACL Entry State",1607:"TLS State Changed",
122
1608:"TLS Server Certificate Set",1609:"TLS Server Certificate Remove",1610:"TLS Trusted Root Certificate Added",1611:"TLS Trusted Root Certificate Removed",1612:"TLS Preshared Key Set",1613:"Kerberos Settings Modified",1614:"Kerberos Master Key Modified",1615:"Flash Wear out Counters Reset",1616:"Power Package Modified",1617:"Set Realm Authentication Mode",1618:"Upgrade Client to Admin Control Mode",1619:"Unprovisioning Started",1700:"Performed Power Up",1701:"Performed Power Down",1702:"Performed Power Cycle",
@@ -131,12 +131,12 @@ function instanceToXml(a,b){if(void 0===b||null===b)return null;var c=!!b.__name
131
function referenceToXml(a,b){if(void 0===b||null===b)return null;var c="<r:"+a+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+b.__resourceUri+"</w:ResourceURI><w:SelectorSet>",d;for(d in b)b.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof b[d]||"object"===typeof b[d]||Array.isArray(b[d])||(c+='<w:Selector Name="'+d+'">'+b[d].toString()+"</w:Selector>"));return c+("</w:SelectorSet></a:ReferenceParameters></r:"+a+">")}
132
function GetSidString(a){for(var b="S-"+a.charCodeAt(0)+"-"+a.charCodeAt(7),c=2;c<a.length/4;c++)b+="-"+ReadIntX(a,4*c);return b}
133
function GetSidByteArray(a){if(!a||null==a)return null;a=a.split("-");if(4>a.length||"s"!=a[0]&&"S"!=a[0])return null;for(var b=1;b<a.length;b++){var c=parseInt(a[b]);if(c!=a[b])return null;a[b]=c}c=String.fromCharCode(a[1])+String.fromCharCode(a.length-3)+ShortToStr(Math.floor(a[2]/Math.pow(2,32)))+IntToStr(a[2]&65535);for(b=3;b<a.length;b++)c+=IntToStrX(a[b]);return c}
134
-(function(a,b){"function"===typeof define&&define.amd?define([],b):a.forge=b()})(this,function(){var a,b,c;(function(d){function f(a,c){var b,l,h,g,w,d,e,k,v,u=c&&c.split("/"),B=m.map,D=B&&B["*"]||{};if(a&&"."===a.charAt(0))if(c){u=u.slice(0,u.length-1);a=a.split("/");w=a.length-1;m.nodeIdCompat&&F.test(a[w])&&(a[w]=a[w].replace(F,""));a=u.concat(a);for(w=0;w<a.length;w+=1)if(b=a[w],"."===b)a.splice(w,1),--w;else if(".."===b)if(1!==w||".."!==a[2]&&".."!==a[0])0<w&&(a.splice(w-1,2),w-=2);else break;
135
-a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((u||D)&&B){b=a.split("/");for(w=b.length;0<w;--w){l=b.slice(0,w).join("/");if(u)for(v=u.length;0<v;--v)if(h=B[u.slice(0,v).join("/")])if(h=h[l]){g=h;d=w;break}if(g)break;!e&&D&&D[l]&&(e=D[l],k=w)}!g&&e&&(g=e,d=k);g&&(b.splice(0,d,g),a=b.join("/"))}return a}function n(a,c){return function(){return u.apply(d,w.call(arguments,0).concat([a,c]))}}function p(a){return function(c){return f(c,a)}}function r(a){return function(c){g[a]=c}}function l(a){if(x.call(D,
136
-a)){var c=D[a];delete D[a];E[a]=!0;e.apply(d,c)}if(!x.call(g,a)&&!x.call(E,a))throw Error("No "+a);return g[a]}function k(a){var c,b=a?a.indexOf("!"):-1;-1<b&&(c=a.substring(0,b),a=a.substring(b+1,a.length));return[c,a]}function v(a){return function(){return m&&m.config&&m.config[a]||{}}}var e,u,B,h,g={},D={},m={},E={},x=Object.prototype.hasOwnProperty,w=[].slice,F=/\.js$/;B=function(a,c){var b,h=k(a),g=h[0];a=h[1];g&&(g=f(g,c),b=l(g));g?a=b&&b.normalize?b.normalize(a,p(c)):f(a,c):(a=f(a,c),h=k(a),
137
-g=h[0],a=h[1],g&&(b=l(g)));return{f:g?g+"!"+a:a,n:a,pr:g,p:b}};h={require:function(a){return n(a)},exports:function(a){var c=g[a];return"undefined"!==typeof c?c:g[a]={}},module:function(a){return{id:a,uri:"",exports:g[a],config:v(a)}}};e=function(a,c,b,w){var m,e,k,v,F=[];e=typeof b;var u;w=w||a;if("undefined"===e||"function"===e){c=!c.length&&b.length?["require","exports","module"]:c;for(v=0;v<c.length;v+=1)if(k=B(c[v],w),e=k.f,"require"===e)F[v]=h.require(a);else if("exports"===e)F[v]=h.exports(a),
138
-u=!0;else if("module"===e)m=F[v]=h.module(a);else if(x.call(g,e)||x.call(D,e)||x.call(E,e))F[v]=l(e);else if(k.p)k.p.load(k.n,n(w,!0),r(e),{}),F[v]=g[e];else throw Error(a+" missing "+e);c=b?b.apply(g[a],F):void 0;a&&(m&&m.exports!==d&&m.exports!==g[a]?g[a]=m.exports:c===d&&u||(g[a]=c))}else a&&(g[a]=b)};a=b=u=function(a,c,b,g,w){if("string"===typeof a)return h[a]?h[a](c):l(B(a,c).f);if(!a.splice){m=a;m.deps&&u(m.deps,m.callback);if(!c)return;c.splice?(a=c,c=b,b=null):a=d}c=c||function(){};"function"===
139
-typeof b&&(b=g,g=w);g?e(d,a,c,b):setTimeout(function(){e(d,a,c,b)},4);return u};u.config=function(a){return u(a)};a._defined=g;c=function(a,c,b){c.splice||(b=c,c=[]);x.call(g,a)||x.call(D,a)||(D[a]=[a,c,b])};c.amd={jQuery:!0}})();c("node_modules/almond/almond",function(){});(function(){function a(c){function b(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(d.isArrayBuffer(a)||d.isArrayBufferView(a)){a=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,a)}catch(c){for(var l=
134
+(function(a,b){"function"===typeof define&&define.amd?define([],b):a.forge=b()})(this,function(){var a,b,c;(function(d){function f(a,c){var b,l,h,g,d,y,e,k,v,u=c&&c.split("/"),B=m.map,E=B&&B["*"]||{};if(a&&"."===a.charAt(0))if(c){u=u.slice(0,u.length-1);a=a.split("/");d=a.length-1;m.nodeIdCompat&&C.test(a[d])&&(a[d]=a[d].replace(C,""));a=u.concat(a);for(d=0;d<a.length;d+=1)if(b=a[d],"."===b)a.splice(d,1),--d;else if(".."===b)if(1!==d||".."!==a[2]&&".."!==a[0])0<d&&(a.splice(d-1,2),d-=2);else break;
135
+a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((u||E)&&B){b=a.split("/");for(d=b.length;0<d;--d){l=b.slice(0,d).join("/");if(u)for(v=u.length;0<v;--v)if(h=B[u.slice(0,v).join("/")])if(h=h[l]){g=h;y=d;break}if(g)break;!e&&E&&E[l]&&(e=E[l],k=d)}!g&&e&&(g=e,y=k);g&&(b.splice(0,y,g),a=b.join("/"))}return a}function n(a,c){return function(){return u.apply(d,y.call(arguments,0).concat([a,c]))}}function p(a){return function(c){return f(c,a)}}function r(a){return function(c){g[a]=c}}function l(a){if(w.call(E,
136
+a)){var c=E[a];delete E[a];F[a]=!0;e.apply(d,c)}if(!w.call(g,a)&&!w.call(F,a))throw Error("No "+a);return g[a]}function k(a){var c,b=a?a.indexOf("!"):-1;-1<b&&(c=a.substring(0,b),a=a.substring(b+1,a.length));return[c,a]}function v(a){return function(){return m&&m.config&&m.config[a]||{}}}var e,u,B,h,g={},E={},m={},F={},w=Object.prototype.hasOwnProperty,y=[].slice,C=/\.js$/;B=function(a,c){var b,h=k(a),g=h[0];a=h[1];g&&(g=f(g,c),b=l(g));g?a=b&&b.normalize?b.normalize(a,p(c)):f(a,c):(a=f(a,c),h=k(a),
137
+g=h[0],a=h[1],g&&(b=l(g)));return{f:g?g+"!"+a:a,n:a,pr:g,p:b}};h={require:function(a){return n(a)},exports:function(a){var c=g[a];return"undefined"!==typeof c?c:g[a]={}},module:function(a){return{id:a,uri:"",exports:g[a],config:v(a)}}};e=function(a,c,b,y){var m,e,k,v,C=[];e=typeof b;var u;y=y||a;if("undefined"===e||"function"===e){c=!c.length&&b.length?["require","exports","module"]:c;for(v=0;v<c.length;v+=1)if(k=B(c[v],y),e=k.f,"require"===e)C[v]=h.require(a);else if("exports"===e)C[v]=h.exports(a),
138
+u=!0;else if("module"===e)m=C[v]=h.module(a);else if(w.call(g,e)||w.call(E,e)||w.call(F,e))C[v]=l(e);else if(k.p)k.p.load(k.n,n(y,!0),r(e),{}),C[v]=g[e];else throw Error(a+" missing "+e);c=b?b.apply(g[a],C):void 0;a&&(m&&m.exports!==d&&m.exports!==g[a]?g[a]=m.exports:c===d&&u||(g[a]=c))}else a&&(g[a]=b)};a=b=u=function(a,c,b,g,y){if("string"===typeof a)return h[a]?h[a](c):l(B(a,c).f);if(!a.splice){m=a;m.deps&&u(m.deps,m.callback);if(!c)return;c.splice?(a=c,c=b,b=null):a=d}c=c||function(){};"function"===
139
+typeof b&&(b=g,g=y);g?e(d,a,c,b):setTimeout(function(){e(d,a,c,b)},4);return u};u.config=function(a){return u(a)};a._defined=g;c=function(a,c,b){c.splice||(b=c,c=[]);w.call(g,a)||w.call(E,a)||(E[a]=[a,c,b])};c.amd={jQuery:!0}})();c("node_modules/almond/almond",function(){});(function(){function a(c){function b(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(d.isArrayBuffer(a)||d.isArrayBufferView(a)){a=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,a)}catch(c){for(var l=
140
0;l<a.length;++l)this.putByte(a[l])}}else if(a instanceof b||"object"===typeof a&&"string"===typeof a.data&&"number"===typeof a.read)this.data=a.data,this.read=a.read;this._constructedStringLength=0}var d=c.util=c.util||{};(function(){if("undefined"!==typeof process&&process.nextTick)d.nextTick=process.nextTick,d.setImmediate="function"===typeof setImmediate?setImmediate:d.nextTick;else if("function"===typeof setImmediate)d.setImmediate=setImmediate,d.nextTick=function(a){return setImmediate(a)};
141
else{d.setImmediate=function(a){setTimeout(a,0)};if("undefined"!==typeof window&&"function"===typeof window.postMessage){var a=[];d.setImmediate=function(c){a.push(c);1===a.length&&window.postMessage("forge.setImmediate","*")};window.addEventListener("message",function(c){c.source===window&&"forge.setImmediate"===c.data&&(c.stopPropagation(),c=a.slice(),a.length=0,c.forEach(function(a){a()}))},!0)}if("undefined"!==typeof MutationObserver){var c=Date.now(),b=!0,l=document.createElement("div"),a=[];
142
(new MutationObserver(function(){var c=a.slice();a.length=0;c.forEach(function(a){a()})})).observe(l,{attributes:!0});var h=d.setImmediate;d.setImmediate=function(d){15<Date.now()-c?(c=Date.now(),h(d)):(a.push(d),1===a.length&&l.setAttribute("a",b=!b))}}d.nextTick=d.setImmediate}})();d.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};d.isArrayBuffer=function(a){return"undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer};d.isArrayBufferView=function(a){return a&&
@@ -172,10 +172,10 @@ function(a,c){for(var b="",l="",d,h,g,m=0;m<a.byteLength;)d=a[m++],h=a[m++],g=a[
172
c)+"\r\n",b=b.substr(c));return l+b};d.binary.base64.decode=function(a,c,b){var l=c;l||(l=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");b=b||0;for(var d,h,g,m,k=0,u=b;k<a.length;)d=e[a.charCodeAt(k++)-43],h=e[a.charCodeAt(k++)-43],g=e[a.charCodeAt(k++)-43],m=e[a.charCodeAt(k++)-43],l[u++]=d<<2|h>>4,64!==g&&(l[u++]=(h&15)<<4|g>>2,64!==m&&(l[u++]=(g&3)<<6|m));return c?u-b:l.subarray(0,u)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(a,c,b){a=d.encodeUtf8(a);
173
var l=c;l||(l=new Uint8Array(a.length));for(var h=b=b||0,g=0;g<a.length;++g)l[h++]=a.charCodeAt(g);return c?h-b:l};d.text.utf8.decode=function(a){return d.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,c,b){var l=c;l||(l=new Uint8Array(2*a.length));for(var d=new Uint16Array(l.buffer),h=b=b||0,g=b,m=0;m<a.length;++m)d[g++]=a.charCodeAt(m),h+=2;return c?h-b:l};d.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};d.deflate=function(a,
174
c,b){c=d.decode64(a.deflate(d.encode64(c)).rval);b&&(a=2,c.charCodeAt(1)&32&&(a=6),c=c.substring(a,c.length-4));return c};d.inflate=function(a,c,b){a=a.inflate(d.encode64(c)).rval;return null===a?null:d.decode64(a)};var u=function(a,c,b){if(!a)throw Error("WebStorage not available.");null===b?a=a.removeItem(c):(b=d.encode64(JSON.stringify(b)),a=a.setItem(c,b));if("undefined"!==typeof a&&!0!==a.rval)throw c=Error(a.error.message),c.id=a.error.id,c.name=a.error.name,c;},B=function(a,c){if(!a)throw Error("WebStorage not available.");
175
-var b=a.getItem(c);if(a.init)if(null===b.rval){if(b.error){var l=Error(b.error.message);l.id=b.error.id;l.name=b.error.name;throw l;}b=null}else b=b.rval;null!==b&&(b=JSON.parse(d.decode64(b)));return b},h=function(a,c,b,l){var d=B(a,c);null===d&&(d={});d[b]=l;u(a,c,d)},g=function(a,c,b){a=B(a,c);null!==a&&(a=b in a?a[b]:null);return a},D=function(a,c,b){var l=B(a,c);if(null!==l&&b in l){delete l[b];b=!0;for(var d in l){b=!1;break}b&&(l=null);u(a,c,l)}},m=function(a,c){u(a,c,null)},f=function(a,c,
176
-b){var l=null;"undefined"===typeof b&&(b=["web","flash"]);var d,h=!1,g=null,m;for(m in b){d=b[m];try{if("flash"===d||"both"===d){if(null===c[0])throw Error("Flash local storage not available.");l=a.apply(this,c);h="flash"===d}if("web"===d||"both"===d)c[0]=localStorage,l=a.apply(this,c),h=!0}catch(e){g=e}if(h)break}if(!h)throw g;return l};d.setItem=function(a,c,b,l,d){f(h,arguments,d)};d.getItem=function(a,c,b,l){return f(g,arguments,l)};d.removeItem=function(a,c,b,l){f(D,arguments,l)};d.clearItems=
177
-function(a,c,b){f(m,arguments,b)};d.parseUrl=function(a){var c=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;c.lastIndex=0;c=c.exec(a);if(a=null===c?null:{full:a,scheme:c[1],host:c[2],port:c[3],path:c[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var x=null;d.getQueryVariables=function(a){var c=function(a){var c=
178
-{};a=a.split("&");for(var b=0;b<a.length;b++){var l=a[b].indexOf("="),d;0<l?(d=a[b].substring(0,l),l=a[b].substring(l+1)):(d=a[b],l=null);d in c||(c[d]=[]);d in Object.prototype||null===l||c[d].push(unescape(l))}return c};"undefined"===typeof a?(null===x&&(x="undefined"!==typeof window&&window.location&&window.location.search?c(window.location.search.substring(1)):{}),a=x):a=c(a);return a};d.parseFragment=function(a){var c=a,b="",l=a.indexOf("?");0<l&&(c=a.substring(0,l),b=a.substring(l+1));a=c.split("/");
175
+var b=a.getItem(c);if(a.init)if(null===b.rval){if(b.error){var l=Error(b.error.message);l.id=b.error.id;l.name=b.error.name;throw l;}b=null}else b=b.rval;null!==b&&(b=JSON.parse(d.decode64(b)));return b},h=function(a,c,b,l){var d=B(a,c);null===d&&(d={});d[b]=l;u(a,c,d)},g=function(a,c,b){a=B(a,c);null!==a&&(a=b in a?a[b]:null);return a},E=function(a,c,b){var l=B(a,c);if(null!==l&&b in l){delete l[b];b=!0;for(var d in l){b=!1;break}b&&(l=null);u(a,c,l)}},m=function(a,c){u(a,c,null)},f=function(a,c,
176
+b){var l=null;"undefined"===typeof b&&(b=["web","flash"]);var d,h=!1,g=null,m;for(m in b){d=b[m];try{if("flash"===d||"both"===d){if(null===c[0])throw Error("Flash local storage not available.");l=a.apply(this,c);h="flash"===d}if("web"===d||"both"===d)c[0]=localStorage,l=a.apply(this,c),h=!0}catch(e){g=e}if(h)break}if(!h)throw g;return l};d.setItem=function(a,c,b,l,d){f(h,arguments,d)};d.getItem=function(a,c,b,l){return f(g,arguments,l)};d.removeItem=function(a,c,b,l){f(E,arguments,l)};d.clearItems=
177
+function(a,c,b){f(m,arguments,b)};d.parseUrl=function(a){var c=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;c.lastIndex=0;c=c.exec(a);if(a=null===c?null:{full:a,scheme:c[1],host:c[2],port:c[3],path:c[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var w=null;d.getQueryVariables=function(a){var c=function(a){var c=
178
+{};a=a.split("&");for(var b=0;b<a.length;b++){var l=a[b].indexOf("="),d;0<l?(d=a[b].substring(0,l),l=a[b].substring(l+1)):(d=a[b],l=null);d in c||(c[d]=[]);d in Object.prototype||null===l||c[d].push(unescape(l))}return c};"undefined"===typeof a?(null===w&&(w="undefined"!==typeof window&&window.location&&window.location.search?c(window.location.search.substring(1)):{}),a=w):a=c(a);return a};d.parseFragment=function(a){var c=a,b="",l=a.indexOf("?");0<l&&(c=a.substring(0,l),b=a.substring(l+1));a=c.split("/");
179
0<a.length&&""===a[0]&&a.shift();l=""===b?{}:d.getQueryVariables(b);return{pathString:c,queryString:b,path:a,query:l}};d.makeRequest=function(a){var c=d.parseFragment(a),b={path:c.pathString,query:c.queryString,getPath:function(a){return"undefined"===typeof a?c.path:c.path[a]},getQuery:function(a,b){var l;"undefined"===typeof a?l=c.query:(l=c.query[a])&&"undefined"!==typeof b&&(l=l[b]);return l},getQueryLast:function(a,c){var l=b.getQuery(a);return l?l[l.length-1]:c}};return b};d.makeLink=function(a,
180
c,b){a=jQuery.isArray(a)?a.join("/"):a;c=jQuery.param(c||{});b=b||"";return a+(0<c.length?"?"+c:"")+(0<b.length?"#"+b:"")};d.setPath=function(a,c,b){if("object"===typeof a&&null!==a)for(var l=0,d=c.length;l<d;){var h=c[l++];if(l==d)a[h]=b;else{var g=h in a;if(!g||g&&"object"!==typeof a[h]||g&&null===a[h])a[h]={};a=a[h]}}};d.getPath=function(a,c,b){for(var l=0,d=c.length,h=!0;h&&l<d&&"object"===typeof a&&null!==a;){var g=c[l++];(h=g in a)&&(a=a[g])}return h?a:b};d.deletePath=function(a,c){if("object"===
181
typeof a&&null!==a)for(var b=0,l=c.length;b<l;){var d=c[b++];if(b==l)delete a[d];else{if(!(d in a)||"object"!==typeof a[d]||null===a[d])break;a=a[d]}}};d.isEmpty=function(a){for(var c in a)if(a.hasOwnProperty(c))return!1;return!0};d.format=function(a){var c=/%./g,b,l,d=0,h=[];for(l=0;b=c.exec(a);)switch(l=a.substring(l,c.lastIndex-2),0<l.length&&h.push(l),l=c.lastIndex,b=b[0][1],b){case "s":case "o":d<arguments.length?h.push(arguments[d++ +1]):h.push("<?>");break;case "%":h.push("%");break;default:h.push("<#"+
@@ -217,14 +217,14 @@ this._ints;++m)this.tag.putInt32(this._s[m]^k[m]);this.tag.truncate(this.tag.len
217
[0,0,0,0],b=0;32>b;++b){var l=this._m[b][a[b/8|0]>>>4*(7-b%8)&15];c[0]^=l[0];c[1]^=l[1];c[2]^=l[2];c[3]^=l[3]}return c};u.gcm.prototype.ghash=function(a,c,b){c[0]^=b[0];c[1]^=b[1];c[2]^=b[2];c[3]^=b[3];return this.tableMultiply(c)};u.gcm.prototype.generateHashTable=function(a,c){for(var b=8/c,l=4*b,b=16*b,d=Array(b),e=0;e<b;++e){var k=[0,0,0,0];k[e/l|0]=1<<c-1<<(l-1-e%l)*c;d[e]=this.generateSubHashTable(this.multiply(k,a),c)}return d};u.gcm.prototype.generateSubHashTable=function(a,c){var b=1<<c,
218
l=b>>>1,d=Array(b);d[l]=a.slice(0);for(var e=l>>>1;0<e;)this.pow(d[2*e],d[e]=[]),e>>=1;for(e=2;e<l;){for(var k=1;k<e;++k){var u=d[e],f=d[k];d[e+k]=[u[0]^f[0],u[1]^f[1],u[2]^f[2],u[3]^f[3]]}e*=2}d[0]=[0,0,0,0];for(e=l+1;e<b;++e)k=d[e^l],d[e]=[a[0]^k[0],a[1]^k[1],a[2]^k[2],a[3]^k[3]];return d}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=
219
n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.cipherModes)return b.cipherModes;b.defined.cipherModes=!0;for(var k=0;k<e.length;++k)e[k](b);return b.cipherModes}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/cipherModes",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,
220
-0))})})();(function(){function a(c){function b(a,d){c.cipher.registerAlgorithm(a,function(){return new c.aes.Algorithm(a,d)})}function d(){h=!0;E=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),c=0;128>c;++c)a[c]=c<<1,a[c+128]=c+128<<1^283;D=Array(256);m=Array(256);x=Array(4);w=Array(4);for(c=0;4>c;++c)x[c]=Array(256),w[c]=Array(256);for(var b=0,l=0,g,e,k,u,q,c=0;256>c;++c){u=l^l<<1^l<<2^l<<3^l<<4;u=u>>8^u&255^99;D[b]=u;m[u]=b;q=a[u];g=a[b];e=a[g];k=a[e];q^=q<<24^u<<16^u<<8^u;e=(g^e^k)<<24^(b^
221
-k)<<16^(b^e^k)<<8^b^g^k;for(var f=0;4>f;++f)x[f][b]=q,w[f][u]=e,q=q<<24|q>>>8,e=e<<24|e>>>8;0===b?b=l=1:(b=g^a[a[a[g^k]]],l^=a[a[l]])}}function e(a,c){for(var b=a.slice(0),l,d=1,h=b.length,e=g*(h+6+1),k=h;k<e;++k)l=b[k-1],0===k%h?(l=D[l>>>16&255]<<24^D[l>>>8&255]<<16^D[l&255]<<8^D[l>>>24]^E[d]<<24,d++):6<h&&4===k%h&&(l=D[l>>>24]<<24^D[l>>>16&255]<<16^D[l>>>8&255]<<8^D[l&255]),b[k]=b[k-h]^l;if(c){for(var d=w[0],h=w[1],m=w[2],u=w[3],f=b.slice(0),e=b.length,k=0,x=e-g;k<e;k+=g,x-=g)if(0===k||k===e-g)f[k]=
222
-b[x],f[k+1]=b[x+3],f[k+2]=b[x+2],f[k+3]=b[x+1];else for(var v=0;v<g;++v)l=b[x+v],f[k+(3&-v)]=d[D[l>>>24]]^h[D[l>>>16&255]]^m[D[l>>>8&255]]^u[D[l&255]];b=f}return b}function u(a,c,b,l){var d=a.length/4-1,h,g,e,k,u;l?(h=w[0],g=w[1],e=w[2],k=w[3],u=m):(h=x[0],g=x[1],e=x[2],k=x[3],u=D);var f,v,B,E,n,p;f=c[0]^a[0];v=c[l?3:1]^a[1];B=c[2]^a[2];c=c[l?1:3]^a[3];for(var r=3,S=1;S<d;++S)E=h[f>>>24]^g[v>>>16&255]^e[B>>>8&255]^k[c&255]^a[++r],n=h[v>>>24]^g[B>>>16&255]^e[c>>>8&255]^k[f&255]^a[++r],p=h[B>>>24]^
223
-g[c>>>16&255]^e[f>>>8&255]^k[v&255]^a[++r],c=h[c>>>24]^g[f>>>16&255]^e[v>>>8&255]^k[B&255]^a[++r],f=E,v=n,B=p;b[0]=u[f>>>24]<<24^u[v>>>16&255]<<16^u[B>>>8&255]<<8^u[c&255]^a[++r];b[l?3:1]=u[v>>>24]<<24^u[B>>>16&255]<<16^u[c>>>8&255]<<8^u[f&255]^a[++r];b[2]=u[B>>>24]<<24^u[c>>>16&255]<<16^u[f>>>8&255]<<8^u[v&255]^a[++r];b[l?1:3]=u[c>>>24]<<24^u[f>>>16&255]<<16^u[v>>>8&255]<<8^u[B&255]^a[++r]}function f(a){a=a||{};var b="AES-"+(a.mode||"CBC").toUpperCase(),d;d=a.decrypt?c.cipher.createDecipher(b,a.key):
220
+0))})})();(function(){function a(c){function b(a,d){c.cipher.registerAlgorithm(a,function(){return new c.aes.Algorithm(a,d)})}function d(){h=!0;F=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),c=0;128>c;++c)a[c]=c<<1,a[c+128]=c+128<<1^283;E=Array(256);m=Array(256);w=Array(4);y=Array(4);for(c=0;4>c;++c)w[c]=Array(256),y[c]=Array(256);for(var b=0,l=0,g,e,k,u,f,c=0;256>c;++c){u=l^l<<1^l<<2^l<<3^l<<4;u=u>>8^u&255^99;E[b]=u;m[u]=b;f=a[u];g=a[b];e=a[g];k=a[e];f^=f<<24^u<<16^u<<8^u;e=(g^e^k)<<24^(b^
221
+k)<<16^(b^e^k)<<8^b^g^k;for(var v=0;4>v;++v)w[v][b]=f,y[v][u]=e,f=f<<24|f>>>8,e=e<<24|e>>>8;0===b?b=l=1:(b=g^a[a[a[g^k]]],l^=a[a[l]])}}function e(a,c){for(var b=a.slice(0),l,d=1,h=b.length,e=g*(h+6+1),k=h;k<e;++k)l=b[k-1],0===k%h?(l=E[l>>>16&255]<<24^E[l>>>8&255]<<16^E[l&255]<<8^E[l>>>24]^F[d]<<24,d++):6<h&&4===k%h&&(l=E[l>>>24]<<24^E[l>>>16&255]<<16^E[l>>>8&255]<<8^E[l&255]),b[k]=b[k-h]^l;if(c){for(var d=y[0],h=y[1],m=y[2],u=y[3],f=b.slice(0),e=b.length,k=0,v=e-g;k<e;k+=g,v-=g)if(0===k||k===e-g)f[k]=
222
+b[v],f[k+1]=b[v+3],f[k+2]=b[v+2],f[k+3]=b[v+1];else for(var w=0;w<g;++w)l=b[v+w],f[k+(3&-w)]=d[E[l>>>24]]^h[E[l>>>16&255]]^m[E[l>>>8&255]]^u[E[l&255]];b=f}return b}function u(a,c,b,l){var d=a.length/4-1,h,g,e,k,u;l?(h=y[0],g=y[1],e=y[2],k=y[3],u=m):(h=w[0],g=w[1],e=w[2],k=w[3],u=E);var f,v,B,F,n,p;f=c[0]^a[0];v=c[l?3:1]^a[1];B=c[2]^a[2];c=c[l?1:3]^a[3];for(var r=3,S=1;S<d;++S)F=h[f>>>24]^g[v>>>16&255]^e[B>>>8&255]^k[c&255]^a[++r],n=h[v>>>24]^g[B>>>16&255]^e[c>>>8&255]^k[f&255]^a[++r],p=h[B>>>24]^
223
+g[c>>>16&255]^e[f>>>8&255]^k[v&255]^a[++r],c=h[c>>>24]^g[f>>>16&255]^e[v>>>8&255]^k[B&255]^a[++r],f=F,v=n,B=p;b[0]=u[f>>>24]<<24^u[v>>>16&255]<<16^u[B>>>8&255]<<8^u[c&255]^a[++r];b[l?3:1]=u[v>>>24]<<24^u[B>>>16&255]<<16^u[c>>>8&255]<<8^u[f&255]^a[++r];b[2]=u[B>>>24]<<24^u[c>>>16&255]<<16^u[f>>>8&255]<<8^u[v&255]^a[++r];b[l?1:3]=u[c>>>24]<<24^u[f>>>16&255]<<16^u[v>>>8&255]<<8^u[B&255]^a[++r]}function f(a){a=a||{};var b="AES-"+(a.mode||"CBC").toUpperCase(),d;d=a.decrypt?c.cipher.createDecipher(b,a.key):
224
c.cipher.createCipher(b,a.key);var h=d.start;d.start=function(a,b){var g=null;b instanceof c.util.ByteBuffer&&(g=b,b={});b=b||{};b.output=g;b.iv=a;h.call(d,b)};return d}c.aes=c.aes||{};c.aes.startEncrypting=function(a,c,b,l){a=f({key:a,output:b,decrypt:!1,mode:l});a.start(c);return a};c.aes.createEncryptionCipher=function(a,c){return f({key:a,output:null,decrypt:!1,mode:c})};c.aes.startDecrypting=function(a,c,b,l){a=f({key:a,output:b,decrypt:!0,mode:l});a.start(c);return a};c.aes.createDecryptionCipher=
225
function(a,c){return f({key:a,output:null,decrypt:!0,mode:c})};c.aes.Algorithm=function(a,c){h||d();var b=this;b.name=a;b.mode=new c({blockSize:16,cipher:{encrypt:function(a,c){return u(b._w,a,c,!1)},decrypt:function(a,c){return u(b._w,a,c,!0)}}});b._init=!1};c.aes.Algorithm.prototype.initialize=function(a){if(!this._init){var b=a.key,d;if("string"===typeof b&&(16===b.length||24===b.length||32===b.length))b=c.util.createBuffer(b);else if(c.util.isArray(b)&&(16===b.length||24===b.length||32===b.length)){d=
226
b;for(var b=c.util.createBuffer(),h=0;h<d.length;++h)b.putByte(d[h])}if(!c.util.isArray(b)){d=b;var b=[],g=d.length();if(16===g||24===g||32===g)for(g>>>=2,h=0;h<g;++h)b.push(d.getInt32())}if(!c.util.isArray(b)||4!==b.length&&6!==b.length&&8!==b.length)throw Error("Invalid key parameter.");d=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=e(b,a.decrypt&&!d);this._init=!0}};c.aes._expandKey=function(a,c){h||d();return e(a,c)};c.aes._updateBlock=u;b("AES-ECB",c.cipher.modes.ecb);b("AES-CBC",
227
-c.cipher.modes.cbc);b("AES-CFB",c.cipher.modes.cfb);b("AES-OFB",c.cipher.modes.ofb);b("AES-CTR",c.cipher.modes.ctr);b("AES-GCM",c.cipher.modes.gcm);var h=!1,g=4,D,m,E,x,w}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.aes)return b.aes;b.defined.aes=
227
+c.cipher.modes.cbc);b("AES-CFB",c.cipher.modes.cfb);b("AES-OFB",c.cipher.modes.ofb);b("AES-CTR",c.cipher.modes.ctr);b("AES-GCM",c.cipher.modes.gcm);var h=!1,g=4,E,m,F,w,y}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.aes)return b.aes;b.defined.aes=
228
!0;for(var k=0;k<e.length;++k)e[k](b);return b.aes}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/aes",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.pki=c.pki||{};c=c.pki.oids=c.oids=c.oids||{};c["1.2.840.113549.1.1.1"]="rsaEncryption";
229
c.rsaEncryption="1.2.840.113549.1.1.1";c["1.2.840.113549.1.1.4"]="md5WithRSAEncryption";c.md5WithRSAEncryption="1.2.840.113549.1.1.4";c["1.2.840.113549.1.1.5"]="sha1WithRSAEncryption";c.sha1WithRSAEncryption="1.2.840.113549.1.1.5";c["1.2.840.113549.1.1.7"]="RSAES-OAEP";c["RSAES-OAEP"]="1.2.840.113549.1.1.7";c["1.2.840.113549.1.1.8"]="mgf1";c.mgf1="1.2.840.113549.1.1.8";c["1.2.840.113549.1.1.9"]="pSpecified";c.pSpecified="1.2.840.113549.1.1.9";c["1.2.840.113549.1.1.10"]="RSASSA-PSS";c["RSASSA-PSS"]=
230
"1.2.840.113549.1.1.10";c["1.2.840.113549.1.1.11"]="sha256WithRSAEncryption";c.sha256WithRSAEncryption="1.2.840.113549.1.1.11";c["1.2.840.113549.1.1.12"]="sha384WithRSAEncryption";c.sha384WithRSAEncryption="1.2.840.113549.1.1.12";c["1.2.840.113549.1.1.13"]="sha512WithRSAEncryption";c.sha512WithRSAEncryption="1.2.840.113549.1.1.13";c["1.3.14.3.2.7"]="desCBC";c.desCBC="1.3.14.3.2.7";c["1.3.14.3.2.26"]="sha1";c.sha1="1.3.14.3.2.26";c["2.16.840.1.101.3.4.2.1"]="sha256";c.sha256="2.16.840.1.101.3.4.2.1";
@@ -242,45 +242,45 @@ c["2.5.29.33"]="policyMappings";c["2.5.29.34"]="policyConstraints";c["2.5.29.35"
242
c.emailProtection="1.3.6.1.5.5.7.3.4";c["1.3.6.1.5.5.7.3.8"]="timeStamping";c.timeStamping="1.3.6.1.5.5.7.3.8"}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.oids)return b.oids;b.defined.oids=!0;for(var k=0;k<e.length;++k)e[k](b);return b.oids}},
243
r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/oids",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var b=c.asn1=c.asn1||{};b.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};b.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,
244
ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};b.create=function(a,b,d,g){if(c.util.isArray(g)){for(var e=[],m=0;m<g.length;++m)void 0!==g[m]&&e.push(g[m]);g=e}return{tagClass:a,type:b,constructed:d,composed:d||c.util.isArray(g),value:g}};var d=b.getBerValueLength=function(a){var c=a.getByte();if(128!==c)return c&128?a.getInt((c&127)<<3):c};b.fromDer=function(a,e){void 0===e&&(e=!0);
245
-"string"===typeof a&&(a=c.util.createBuffer(a));if(2>a.length()){var h=Error("Too few bytes to parse DER.");h.bytes=a.length();throw h;}var g=a.getByte(),h=g&192,f=g&31,m=d(a);if(a.length()<m){if(e)throw h=Error("Too few bytes to read ASN.1 value."),h.detail=a.length()+" < "+m,h;m=a.length()}var E,x=32===(g&32);E=x;if(!E&&h===b.Class.UNIVERSAL&&f===b.Type.BITSTRING&&1<m){var w=a.read;if(0===a.getByte()&&(g=a.getByte(),g&=192,g===b.Class.UNIVERSAL||g===b.Class.CONTEXT_SPECIFIC))try{if(E=d(a)===m-(a.read-
246
-w))++w,--m}catch(F){}a.read=w}if(E)if(E=[],void 0===m)for(;;){if(a.bytes(2)===String.fromCharCode(0,0)){a.getBytes(2);break}E.push(b.fromDer(a,e))}else for(w=a.length();0<m;)E.push(b.fromDer(a,e)),m-=w-a.length(),w=a.length();else{if(void 0===m){if(e)throw Error("Non-constructed ASN.1 object of indefinite length.");m=a.length()}if(f===b.Type.BMPSTRING)for(E="",w=0;w<m;w+=2)E+=String.fromCharCode(a.getInt16());else E=a.getBytes(m)}return b.create(h,f,x,E)};b.toDer=function(a){var d=c.util.createBuffer(),
245
+"string"===typeof a&&(a=c.util.createBuffer(a));if(2>a.length()){var h=Error("Too few bytes to parse DER.");h.bytes=a.length();throw h;}var g=a.getByte(),h=g&192,f=g&31,m=d(a);if(a.length()<m){if(e)throw h=Error("Too few bytes to read ASN.1 value."),h.detail=a.length()+" < "+m,h;m=a.length()}var F,w=32===(g&32);F=w;if(!F&&h===b.Class.UNIVERSAL&&f===b.Type.BITSTRING&&1<m){var y=a.read;if(0===a.getByte()&&(g=a.getByte(),g&=192,g===b.Class.UNIVERSAL||g===b.Class.CONTEXT_SPECIFIC))try{if(F=d(a)===m-(a.read-
246
+y))++y,--m}catch(C){}a.read=y}if(F)if(F=[],void 0===m)for(;;){if(a.bytes(2)===String.fromCharCode(0,0)){a.getBytes(2);break}F.push(b.fromDer(a,e))}else for(y=a.length();0<m;)F.push(b.fromDer(a,e)),m-=y-a.length(),y=a.length();else{if(void 0===m){if(e)throw Error("Non-constructed ASN.1 object of indefinite length.");m=a.length()}if(f===b.Type.BMPSTRING)for(F="",y=0;y<m;y+=2)F+=String.fromCharCode(a.getInt16());else F=a.getBytes(m)}return b.create(h,f,w,F)};b.toDer=function(a){var d=c.util.createBuffer(),
247
h=a.tagClass|a.type,g=c.util.createBuffer();if(a.composed){a.constructed?h|=32:g.putByte(0);for(var e=0;e<a.value.length;++e)void 0!==a.value[e]&&g.putBuffer(b.toDer(a.value[e]))}else if(a.type===b.Type.BMPSTRING)for(e=0;e<a.value.length;++e)g.putInt16(a.value.charCodeAt(e));else g.putBytes(a.value);d.putByte(h);if(127>=g.length())d.putByte(g.length()&127);else{e=g.length();a="";do a+=String.fromCharCode(e&255),e>>>=8;while(0<e);d.putByte(a.length|128);for(e=a.length-1;0<=e;--e)d.putByte(a.charCodeAt(e))}d.putBuffer(g);
248
return d};b.oidToDer=function(a){a=a.split(".");var b=c.util.createBuffer();b.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var d,g,e,m,k=2;k<a.length;++k){d=!0;g=[];e=parseInt(a[k],10);do m=e&127,e>>>=7,d||(m|=128),g.push(m),d=!1;while(0<e);for(d=g.length-1;0<=d;--d)b.putByte(g[d])}return b};b.derToOid=function(a){var b;"string"===typeof a&&(a=c.util.createBuffer(a));var d=a.getByte();b=Math.floor(d/40)+"."+d%40;for(var g=0;0<a.length();)d=a.getByte(),g<<=7,d&128?g+=d&127:(b+="."+(g+d),g=0);
249
-return b};b.utcTimeToDate=function(a){var c=new Date,b=parseInt(a.substr(0,2),10),b=50<=b?1900+b:2E3+b,d=parseInt(a.substr(2,2),10)-1,l=parseInt(a.substr(4,2),10),e=parseInt(a.substr(6,2),10),k=parseInt(a.substr(8,2),10),f=0;if(11<a.length){var w=a.charAt(10),v=10;"+"!==w&&"-"!==w&&(f=parseInt(a.substr(10,2),10),v+=2)}c.setUTCFullYear(b,d,l);c.setUTCHours(e,k,f,0);v&&(w=a.charAt(v),"+"===w||"-"===w)&&(b=parseInt(a.substr(v+1,2),10),a=parseInt(a.substr(v+4,2),10),a=6E4*(60*b+a),"+"===w?c.setTime(+c-
250
-a):c.setTime(+c+a));return c};b.generalizedTimeToDate=function(a){var c=new Date,b=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,l=parseInt(a.substr(6,2),10),e=parseInt(a.substr(8,2),10),k=parseInt(a.substr(10,2),10),f=parseInt(a.substr(12,2),10),w=0,v=0,A=!1;"Z"===a.charAt(a.length-1)&&(A=!0);var J=a.length-5,y=a.charAt(J);if("+"===y||"-"===y)v=parseInt(a.substr(J+1,2),10),J=parseInt(a.substr(J+4,2),10),v=6E4*(60*v+J),"+"===y&&(v*=-1),A=!0;"."===a.charAt(14)&&(w=1E3*parseFloat(a.substr(14),
251
-10));A?(c.setUTCFullYear(b,d,l),c.setUTCHours(e,k,f,w),c.setTime(+c+v)):(c.setFullYear(b,d,l),c.setHours(e,k,f,w));return c};b.dateToUtcTime=function(a){if("string"===typeof a)return a;var c="",b=[];b.push((""+a.getUTCFullYear()).substr(2));b.push(""+(a.getUTCMonth()+1));b.push(""+a.getUTCDate());b.push(""+a.getUTCHours());b.push(""+a.getUTCMinutes());b.push(""+a.getUTCSeconds());for(a=0;a<b.length;++a)2>b[a].length&&(c+="0"),c+=b[a];return c+"Z"};b.dateToGeneralizedTime=function(a){if("string"===
249
+return b};b.utcTimeToDate=function(a){var c=new Date,b=parseInt(a.substr(0,2),10),b=50<=b?1900+b:2E3+b,d=parseInt(a.substr(2,2),10)-1,l=parseInt(a.substr(4,2),10),e=parseInt(a.substr(6,2),10),k=parseInt(a.substr(8,2),10),f=0;if(11<a.length){var v=a.charAt(10),C=10;"+"!==v&&"-"!==v&&(f=parseInt(a.substr(10,2),10),C+=2)}c.setUTCFullYear(b,d,l);c.setUTCHours(e,k,f,0);C&&(v=a.charAt(C),"+"===v||"-"===v)&&(b=parseInt(a.substr(C+1,2),10),a=parseInt(a.substr(C+4,2),10),a=6E4*(60*b+a),"+"===v?c.setTime(+c-
250
+a):c.setTime(+c+a));return c};b.generalizedTimeToDate=function(a){var c=new Date,b=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,l=parseInt(a.substr(6,2),10),e=parseInt(a.substr(8,2),10),k=parseInt(a.substr(10,2),10),f=parseInt(a.substr(12,2),10),v=0,C=0,A=!1;"Z"===a.charAt(a.length-1)&&(A=!0);var n=a.length-5,z=a.charAt(n);if("+"===z||"-"===z)C=parseInt(a.substr(n+1,2),10),n=parseInt(a.substr(n+4,2),10),C=6E4*(60*C+n),"+"===z&&(C*=-1),A=!0;"."===a.charAt(14)&&(v=1E3*parseFloat(a.substr(14),
251
+10));A?(c.setUTCFullYear(b,d,l),c.setUTCHours(e,k,f,v),c.setTime(+c+C)):(c.setFullYear(b,d,l),c.setHours(e,k,f,v));return c};b.dateToUtcTime=function(a){if("string"===typeof a)return a;var c="",b=[];b.push((""+a.getUTCFullYear()).substr(2));b.push(""+(a.getUTCMonth()+1));b.push(""+a.getUTCDate());b.push(""+a.getUTCHours());b.push(""+a.getUTCMinutes());b.push(""+a.getUTCSeconds());for(a=0;a<b.length;++a)2>b[a].length&&(c+="0"),c+=b[a];return c+"Z"};b.dateToGeneralizedTime=function(a){if("string"===
252
typeof a)return a;var c="",b=[];b.push(""+a.getUTCFullYear());b.push(""+(a.getUTCMonth()+1));b.push(""+a.getUTCDate());b.push(""+a.getUTCHours());b.push(""+a.getUTCMinutes());b.push(""+a.getUTCSeconds());for(a=0;a<b.length;++a)2>b[a].length&&(c+="0"),c+=b[a];return c+"Z"};b.integerToDer=function(a){var b=c.util.createBuffer();if(-128<=a&&128>a)return b.putSignedInt(a,8);if(-32768<=a&&32768>a)return b.putSignedInt(a,16);if(-8388608<=a&&8388608>a)return b.putSignedInt(a,24);if(-2147483648<=a&&2147483648>
253
a)return b.putSignedInt(a,32);b=Error("Integer too large; max is 32-bits.");b.integer=a;throw b;};b.derToInteger=function(a){"string"===typeof a&&(a=c.util.createBuffer(a));var b=8*a.length();if(32<b)throw Error("Integer too large; max is 32-bits.");return a.getSignedInt(b)};b.validate=function(a,d,h,g){var e=!1;if(a.tagClass!==d.tagClass&&"undefined"!==typeof d.tagClass||a.type!==d.type&&"undefined"!==typeof d.type)g&&(a.tagClass!==d.tagClass&&g.push("["+d.name+'] Expected tag class "'+d.tagClass+
254
'", got "'+a.tagClass+'"'),a.type!==d.type&&g.push("["+d.name+'] Expected type "'+d.type+'", got "'+a.type+'"'));else if(a.constructed===d.constructed||"undefined"===typeof d.constructed){e=!0;if(d.value&&c.util.isArray(d.value))for(var m=0,f=0;e&&f<d.value.length;++f)e=d.value[f].optional||!1,a.value[m]&&((e=b.validate(a.value[m],d.value[f],h,g))?++m:d.value[f].optional&&(e=!0)),!e&&g&&g.push("["+d.name+'] Tag class "'+d.tagClass+'", type "'+d.type+'" expected value length "'+d.value.length+'", got "'+
255
a.value.length+'"');e&&h&&(d.capture&&(h[d.capture]=a.value),d.captureAsn1&&(h[d.captureAsn1]=a))}else g&&g.push("["+d.name+'] Expected constructed "'+d.constructed+'", got "'+a.constructed+'"');return e};var e=/[^\\u0000-\\u00ff]/;b.prettyPrint=function(a,d,h){var g="";d=d||0;h=h||2;0<d&&(g+="\n");for(var f="",m=0;m<d*h;++m)f+=" ";g+=f+"Tag: ";switch(a.tagClass){case b.Class.UNIVERSAL:g+="Universal:";break;case b.Class.APPLICATION:g+="Application:";break;case b.Class.CONTEXT_SPECIFIC:g+="Context-Specific:";
256
break;case b.Class.PRIVATE:g+="Private:"}if(a.tagClass===b.Class.UNIVERSAL)switch(g+=a.type,a.type){case b.Type.NONE:g+=" (None)";break;case b.Type.BOOLEAN:g+=" (Boolean)";break;case b.Type.BITSTRING:g+=" (Bit string)";break;case b.Type.INTEGER:g+=" (Integer)";break;case b.Type.OCTETSTRING:g+=" (Octet string)";break;case b.Type.NULL:g+=" (Null)";break;case b.Type.OID:g+=" (Object Identifier)";break;case b.Type.ODESC:g+=" (Object Descriptor)";break;case b.Type.EXTERNAL:g+=" (External or Instance of)";
257
break;case b.Type.REAL:g+=" (Real)";break;case b.Type.ENUMERATED:g+=" (Enumerated)";break;case b.Type.EMBEDDED:g+=" (Embedded PDV)";break;case b.Type.UTF8:g+=" (UTF8)";break;case b.Type.ROID:g+=" (Relative Object Identifier)";break;case b.Type.SEQUENCE:g+=" (Sequence)";break;case b.Type.SET:g+=" (Set)";break;case b.Type.PRINTABLESTRING:g+=" (Printable String)";break;case b.Type.IA5String:g+=" (IA5String (ASCII))";break;case b.Type.UTCTIME:g+=" (UTC time)";break;case b.Type.GENERALIZEDTIME:g+=" (Generalized time)";
258
-break;case b.Type.BMPSTRING:g+=" (BMP String)"}else g+=a.type;g=g+"\n"+(f+"Constructed: "+a.constructed+"\n");if(a.composed){for(var v=0,x="",m=0;m<a.value.length;++m)void 0!==a.value[m]&&(v+=1,x+=b.prettyPrint(a.value[m],d+1,h),m+1<a.value.length&&(x+=","));g+=f+"Sub values: "+v+x}else if(g+=f+"Value: ",a.type===b.Type.OID&&(d=b.derToOid(a.value),g+=d,c.pki&&c.pki.oids&&d in c.pki.oids&&(g+=" ("+c.pki.oids[d]+") ")),a.type===b.Type.INTEGER)try{g+=b.derToInteger(a.value)}catch(w){g+="0x"+c.util.bytesToHex(a.value)}else a.type===
258
+break;case b.Type.BMPSTRING:g+=" (BMP String)"}else g+=a.type;g=g+"\n"+(f+"Constructed: "+a.constructed+"\n");if(a.composed){for(var v=0,w="",m=0;m<a.value.length;++m)void 0!==a.value[m]&&(v+=1,w+=b.prettyPrint(a.value[m],d+1,h),m+1<a.value.length&&(w+=","));g+=f+"Sub values: "+v+w}else if(g+=f+"Value: ",a.type===b.Type.OID&&(d=b.derToOid(a.value),g+=d,c.pki&&c.pki.oids&&d in c.pki.oids&&(g+=" ("+c.pki.oids[d]+") ")),a.type===b.Type.INTEGER)try{g+=b.derToInteger(a.value)}catch(y){g+="0x"+c.util.bytesToHex(a.value)}else a.type===
259
b.Type.OCTETSTRING?(e.test(a.value)||(g+="("+a.value+") "),g+="0x"+c.util.bytesToHex(a.value)):g=a.type===b.Type.UTF8?g+c.util.decodeUtf8(a.value):a.type===b.Type.PRINTABLESTRING||a.type===b.Type.IA5String?g+a.value:e.test(a.value)?g+("0x"+c.util.bytesToHex(a.value)):0===a.value.length?g+"[null]":g+a.value;return g}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,
260
b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.asn1)return b.asn1;b.defined.asn1=!0;for(var k=0;k<e.length;++k)e[k](b);return b.asn1}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/asn1",["require","module","./util","./oids"],function(){p.apply(null,Array.prototype.slice.call(arguments,
261
0))})})();(function(){function a(c){function b(){f=String.fromCharCode(128);f+=c.util.fillString(String.fromCharCode(0),64);B=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9];h=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];g=Array(64);for(var a=0;64>a;++a)g[a]=Math.floor(4294967296*
262
-Math.abs(Math.sin(a+1)));D=!0}function d(a,c,b){for(var l,e,k,f,y,C,z,v=b.length();64<=v;){e=a.h0;k=a.h1;f=a.h2;y=a.h3;for(z=0;16>z;++z)c[z]=b.getInt32Le(),l=y^k&(f^y),l=e+l+g[z]+c[z],C=h[z],e=y,y=f,f=k,k+=l<<C|l>>>32-C;for(;32>z;++z)l=f^y&(k^f),l=e+l+g[z]+c[B[z]],C=h[z],e=y,y=f,f=k,k+=l<<C|l>>>32-C;for(;48>z;++z)l=k^f^y,l=e+l+g[z]+c[B[z]],C=h[z],e=y,y=f,f=k,k+=l<<C|l>>>32-C;for(;64>z;++z)l=f^(k|~y),l=e+l+g[z]+c[B[z]],C=h[z],e=y,y=f,f=k,k+=l<<C|l>>>32-C;a.h0=a.h0+e|0;a.h1=a.h1+k|0;a.h2=a.h2+f|0;a.h3=
263
-a.h3+y|0;v-=64}}var e=c.md5=c.md5||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.md5=c.md.algorithms.md5=e;e.create=function(){D||b();var a=null,h=c.util.createBuffer(),g=Array(16),e={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){e.messageLength=0;e.fullMessageLength=e.messageLength64=[];for(var b=e.messageLengthSize/4,d=0;d<b;++d)e.fullMessageLength.push(0);h=c.util.createBuffer();a={h0:1732584193,h1:4023233417,
264
-h2:2562383102,h3:271733878};return e}};e.start();e.update=function(b,k){"utf8"===k&&(b=c.util.encodeUtf8(b));var f=b.length;e.messageLength+=f;for(var f=[f/4294967296>>>0,f>>>0],y=e.fullMessageLength.length-1;0<=y;--y)e.fullMessageLength[y]+=f[1],f[1]=f[0]+(e.fullMessageLength[y]/4294967296>>>0),e.fullMessageLength[y]>>>=0,f[0]=f[1]/4294967296>>>0;h.putBytes(b);d(a,g,h);(2048<h.read||0===h.length())&&h.compact();return e};e.digest=function(){var b=c.util.createBuffer();b.putBytes(h.bytes());b.putBytes(f.substr(0,
265
-e.blockLength-(e.fullMessageLength[e.fullMessageLength.length-1]+e.messageLengthSize&e.blockLength-1)));for(var k,D=0,y=e.fullMessageLength.length-1;0<=y;--y)k=8*e.fullMessageLength[y]+D,D=k/4294967296>>>0,b.putInt32Le(k>>>0);k={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3};d(k,g,b);b=c.util.createBuffer();b.putInt32Le(k.h0);b.putInt32Le(k.h1);b.putInt32Le(k.h2);b.putInt32Le(k.h3);return b};return e};var f=null,B=null,h=null,g=null,D=!1}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=
262
+Math.abs(Math.sin(a+1)));E=!0}function d(a,c,b){for(var l,e,k,f,z,D,x,v=b.length();64<=v;){e=a.h0;k=a.h1;f=a.h2;z=a.h3;for(x=0;16>x;++x)c[x]=b.getInt32Le(),l=z^k&(f^z),l=e+l+g[x]+c[x],D=h[x],e=z,z=f,f=k,k+=l<<D|l>>>32-D;for(;32>x;++x)l=f^z&(k^f),l=e+l+g[x]+c[B[x]],D=h[x],e=z,z=f,f=k,k+=l<<D|l>>>32-D;for(;48>x;++x)l=k^f^z,l=e+l+g[x]+c[B[x]],D=h[x],e=z,z=f,f=k,k+=l<<D|l>>>32-D;for(;64>x;++x)l=f^(k|~z),l=e+l+g[x]+c[B[x]],D=h[x],e=z,z=f,f=k,k+=l<<D|l>>>32-D;a.h0=a.h0+e|0;a.h1=a.h1+k|0;a.h2=a.h2+f|0;a.h3=
263
+a.h3+z|0;v-=64}}var e=c.md5=c.md5||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.md5=c.md.algorithms.md5=e;e.create=function(){E||b();var a=null,h=c.util.createBuffer(),g=Array(16),e={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){e.messageLength=0;e.fullMessageLength=e.messageLength64=[];for(var b=e.messageLengthSize/4,d=0;d<b;++d)e.fullMessageLength.push(0);h=c.util.createBuffer();a={h0:1732584193,h1:4023233417,
264
+h2:2562383102,h3:271733878};return e}};e.start();e.update=function(b,k){"utf8"===k&&(b=c.util.encodeUtf8(b));var f=b.length;e.messageLength+=f;for(var f=[f/4294967296>>>0,f>>>0],z=e.fullMessageLength.length-1;0<=z;--z)e.fullMessageLength[z]+=f[1],f[1]=f[0]+(e.fullMessageLength[z]/4294967296>>>0),e.fullMessageLength[z]>>>=0,f[0]=f[1]/4294967296>>>0;h.putBytes(b);d(a,g,h);(2048<h.read||0===h.length())&&h.compact();return e};e.digest=function(){var b=c.util.createBuffer();b.putBytes(h.bytes());b.putBytes(f.substr(0,
265
+e.blockLength-(e.fullMessageLength[e.fullMessageLength.length-1]+e.messageLengthSize&e.blockLength-1)));for(var k,E=0,z=e.fullMessageLength.length-1;0<=z;--z)k=8*e.fullMessageLength[z]+E,E=k/4294967296>>>0,b.putInt32Le(k>>>0);k={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3};d(k,g,b);b=c.util.createBuffer();b.putInt32Le(k.h0);b.putInt32Le(k.h1);b.putInt32Le(k.h2);b.putInt32Le(k.h3);return b};return e};var f=null,B=null,h=null,g=null,E=!1}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=
266
!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.md5)return b.md5;b.defined.md5=!0;for(var k=0;k<e.length;++k)e[k](b);return b.md5}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,
267
-0))};c("js/md5",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var l,e,k,f,v,u,A,n,y=d.length();64<=y;){e=a.h0;k=a.h1;f=a.h2;v=a.h3;u=a.h4;for(n=0;16>n;++n)l=d.getInt32(),c[n]=l,A=v^k&(f^v),l=(e<<5|e>>>27)+A+u+1518500249+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;for(;20>n;++n)l=c[n-3]^c[n-8]^c[n-14]^c[n-16],l=l<<1|l>>>31,c[n]=l,A=v^k&(f^v),l=(e<<5|e>>>27)+A+u+1518500249+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;for(;32>
267
+0))};c("js/md5",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var l,e,k,f,v,u,A,n,z=d.length();64<=z;){e=a.h0;k=a.h1;f=a.h2;v=a.h3;u=a.h4;for(n=0;16>n;++n)l=d.getInt32(),c[n]=l,A=v^k&(f^v),l=(e<<5|e>>>27)+A+u+1518500249+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;for(;20>n;++n)l=c[n-3]^c[n-8]^c[n-14]^c[n-16],l=l<<1|l>>>31,c[n]=l,A=v^k&(f^v),l=(e<<5|e>>>27)+A+u+1518500249+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;for(;32>
268
n;++n)l=c[n-3]^c[n-8]^c[n-14]^c[n-16],l=l<<1|l>>>31,c[n]=l,A=k^f^v,l=(e<<5|e>>>27)+A+u+1859775393+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;for(;40>n;++n)l=c[n-6]^c[n-16]^c[n-28]^c[n-32],l=l<<2|l>>>30,c[n]=l,A=k^f^v,l=(e<<5|e>>>27)+A+u+1859775393+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;for(;60>n;++n)l=c[n-6]^c[n-16]^c[n-28]^c[n-32],l=l<<2|l>>>30,c[n]=l,A=k&f|v&(k^f),l=(e<<5|e>>>27)+A+u+2400959708+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;for(;80>n;++n)l=c[n-6]^c[n-16]^c[n-28]^c[n-32],l=l<<2|l>>>30,c[n]=l,A=k^f^v,l=(e<<5|e>>>
269
-27)+A+u+3395469782+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;a.h0=a.h0+e|0;a.h1=a.h1+k|0;a.h2=a.h2+f|0;a.h3=a.h3+v|0;a.h4=a.h4+u|0;y-=64}}var d=c.sha1=c.sha1||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.sha1=c.md.algorithms.sha1=d;d.create=function(){f||(e=String.fromCharCode(128),e+=c.util.fillString(String.fromCharCode(0),64),f=!0);var a=null,d=c.util.createBuffer(),g=Array(80),v={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){v.messageLength=
270
-0;v.fullMessageLength=v.messageLength64=[];for(var b=v.messageLengthSize/4,g=0;g<b;++g)v.fullMessageLength.push(0);d=c.util.createBuffer();a={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return v}};v.start();v.update=function(e,f){"utf8"===f&&(e=c.util.encodeUtf8(e));var u=e.length;v.messageLength+=u;for(var u=[u/4294967296>>>0,u>>>0],w=v.fullMessageLength.length-1;0<=w;--w)v.fullMessageLength[w]+=u[1],u[1]=u[0]+(v.fullMessageLength[w]/4294967296>>>0),v.fullMessageLength[w]>>>=
271
-0,u[0]=u[1]/4294967296>>>0;d.putBytes(e);b(a,g,d);(2048<d.read||0===d.length())&&d.compact();return v};v.digest=function(){var m=c.util.createBuffer();m.putBytes(d.bytes());m.putBytes(e.substr(0,v.blockLength-(v.fullMessageLength[v.fullMessageLength.length-1]+v.messageLengthSize&v.blockLength-1)));c.util.createBuffer();for(var f,u,w=8*v.fullMessageLength[0],F=0;F<v.fullMessageLength.length;++F)f=8*v.fullMessageLength[F+1],u=f/4294967296>>>0,w+=u,m.putInt32(w>>>0),w=f;f={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,
269
+27)+A+u+3395469782+l,u=v,v=f,f=k<<30|k>>>2,k=e,e=l;a.h0=a.h0+e|0;a.h1=a.h1+k|0;a.h2=a.h2+f|0;a.h3=a.h3+v|0;a.h4=a.h4+u|0;z-=64}}var d=c.sha1=c.sha1||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.sha1=c.md.algorithms.sha1=d;d.create=function(){f||(e=String.fromCharCode(128),e+=c.util.fillString(String.fromCharCode(0),64),f=!0);var a=null,d=c.util.createBuffer(),g=Array(80),v={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){v.messageLength=
270
+0;v.fullMessageLength=v.messageLength64=[];for(var b=v.messageLengthSize/4,g=0;g<b;++g)v.fullMessageLength.push(0);d=c.util.createBuffer();a={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return v}};v.start();v.update=function(e,f){"utf8"===f&&(e=c.util.encodeUtf8(e));var u=e.length;v.messageLength+=u;for(var u=[u/4294967296>>>0,u>>>0],y=v.fullMessageLength.length-1;0<=y;--y)v.fullMessageLength[y]+=u[1],u[1]=u[0]+(v.fullMessageLength[y]/4294967296>>>0),v.fullMessageLength[y]>>>=
271
+0,u[0]=u[1]/4294967296>>>0;d.putBytes(e);b(a,g,d);(2048<d.read||0===d.length())&&d.compact();return v};v.digest=function(){var m=c.util.createBuffer();m.putBytes(d.bytes());m.putBytes(e.substr(0,v.blockLength-(v.fullMessageLength[v.fullMessageLength.length-1]+v.messageLengthSize&v.blockLength-1)));c.util.createBuffer();for(var f,u,y=8*v.fullMessageLength[0],C=0;C<v.fullMessageLength.length;++C)f=8*v.fullMessageLength[C+1],u=f/4294967296>>>0,y+=u,m.putInt32(y>>>0),y=f;f={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,
272
h4:a.h4};b(f,g,m);m=c.util.createBuffer();m.putInt32(f.h0);m.putInt32(f.h1);m.putInt32(f.h2);m.putInt32(f.h3);m.putInt32(f.h4);return m};return v};var e=null,f=!1}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.sha1)return b.sha1;b.defined.sha1=
273
-!0;for(var k=0;k<e.length;++k)e[k](b);return b.sha1}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/sha1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var l,e,k,f,v,u,J,y,C,z,G,p,q,r=d.length();64<=r;){for(v=0;16>v;++v)c[v]=d.getInt32();
274
-for(;64>v;++v)l=c[v-2],l=(l>>>17|l<<15)^(l>>>19|l<<13)^l>>>10,e=c[v-15],e=(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3,c[v]=l+c[v-7]+e+c[v-16]|0;u=a.h0;J=a.h1;y=a.h2;C=a.h3;z=a.h4;G=a.h5;p=a.h6;q=a.h7;for(v=0;64>v;++v)l=(z>>>6|z<<26)^(z>>>11|z<<21)^(z>>>25|z<<7),k=p^z&(G^p),e=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),f=u&J|y&(u^J),l=q+l+k+n[v]+c[v],e+=f,q=p,p=G,G=z,z=C+l|0,C=y,y=J,J=u,u=l+e|0;a.h0=a.h0+u|0;a.h1=a.h1+J|0;a.h2=a.h2+y|0;a.h3=a.h3+C|0;a.h4=a.h4+z|0;a.h5=a.h5+G|0;a.h6=a.h6+p|0;a.h7=a.h7+q|0;r-=
273
+!0;for(var k=0;k<e.length;++k)e[k](b);return b.sha1}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/sha1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var l,e,k,f,v,u,L,z,D,x,G,p,q,r=d.length();64<=r;){for(v=0;16>v;++v)c[v]=d.getInt32();
274
+for(;64>v;++v)l=c[v-2],l=(l>>>17|l<<15)^(l>>>19|l<<13)^l>>>10,e=c[v-15],e=(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3,c[v]=l+c[v-7]+e+c[v-16]|0;u=a.h0;L=a.h1;z=a.h2;D=a.h3;x=a.h4;G=a.h5;p=a.h6;q=a.h7;for(v=0;64>v;++v)l=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),k=p^x&(G^p),e=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),f=u&L|z&(u^L),l=q+l+k+n[v]+c[v],e+=f,q=p,p=G,G=x,x=D+l|0,D=z,z=L,L=u,u=l+e|0;a.h0=a.h0+u|0;a.h1=a.h1+L|0;a.h2=a.h2+z|0;a.h3=a.h3+D|0;a.h4=a.h4+x|0;a.h5=a.h5+G|0;a.h6=a.h6+p|0;a.h7=a.h7+q|0;r-=
275
64}}var d=c.sha256=c.sha256||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.sha256=c.md.algorithms.sha256=d;d.create=function(){f||(e=String.fromCharCode(128),e+=c.util.fillString(String.fromCharCode(0),64),n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,
276
2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],f=!0);var a=null,d=c.util.createBuffer(),v=Array(64),m={algorithm:"sha256",blockLength:64,digestLength:32,
277
-messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var b=m.messageLengthSize/4,e=0;e<b;++e)m.fullMessageLength.push(0);d=c.util.createBuffer();a={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return m}};m.start();m.update=function(e,f){"utf8"===f&&(e=c.util.encodeUtf8(e));var u=e.length;m.messageLength+=u;for(var u=[u/4294967296>>>0,u>>>0],F=m.fullMessageLength.length-
278
-1;0<=F;--F)m.fullMessageLength[F]+=u[1],u[1]=u[0]+(m.fullMessageLength[F]/4294967296>>>0),m.fullMessageLength[F]>>>=0,u[0]=u[1]/4294967296>>>0;d.putBytes(e);b(a,v,d);(2048<d.read||0===d.length())&&d.compact();return m};m.digest=function(){var f=c.util.createBuffer();f.putBytes(d.bytes());f.putBytes(e.substr(0,m.blockLength-(m.fullMessageLength[m.fullMessageLength.length-1]+m.messageLengthSize&m.blockLength-1)));c.util.createBuffer();for(var u,w,F=8*m.fullMessageLength[0],n=0;n<m.fullMessageLength.length;++n)u=
279
-8*m.fullMessageLength[n+1],w=u/4294967296>>>0,F+=w,f.putInt32(F>>>0),F=u;u={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,h4:a.h4,h5:a.h5,h6:a.h6,h7:a.h7};b(u,v,f);f=c.util.createBuffer();f.putInt32(u.h0);f.putInt32(u.h1);f.putInt32(u.h2);f.putInt32(u.h3);f.putInt32(u.h4);f.putInt32(u.h5);f.putInt32(u.h6);f.putInt32(u.h7);return f};return m};var e=null,f=!1,n=null}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge=
277
+messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var b=m.messageLengthSize/4,e=0;e<b;++e)m.fullMessageLength.push(0);d=c.util.createBuffer();a={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return m}};m.start();m.update=function(e,f){"utf8"===f&&(e=c.util.encodeUtf8(e));var u=e.length;m.messageLength+=u;for(var u=[u/4294967296>>>0,u>>>0],C=m.fullMessageLength.length-
278
+1;0<=C;--C)m.fullMessageLength[C]+=u[1],u[1]=u[0]+(m.fullMessageLength[C]/4294967296>>>0),m.fullMessageLength[C]>>>=0,u[0]=u[1]/4294967296>>>0;d.putBytes(e);b(a,v,d);(2048<d.read||0===d.length())&&d.compact();return m};m.digest=function(){var f=c.util.createBuffer();f.putBytes(d.bytes());f.putBytes(e.substr(0,m.blockLength-(m.fullMessageLength[m.fullMessageLength.length-1]+m.messageLengthSize&m.blockLength-1)));c.util.createBuffer();for(var u,y,C=8*m.fullMessageLength[0],n=0;n<m.fullMessageLength.length;++n)u=
279
+8*m.fullMessageLength[n+1],y=u/4294967296>>>0,C+=y,f.putInt32(C>>>0),C=u;u={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,h4:a.h4,h5:a.h5,h6:a.h6,h7:a.h7};b(u,v,f);f=c.util.createBuffer();f.putInt32(u.h0);f.putInt32(u.h1);f.putInt32(u.h2);f.putInt32(u.h3);f.putInt32(u.h4);f.putInt32(u.h5);f.putInt32(u.h6);f.putInt32(u.h7);return f};return m};var e=null,f=!1,n=null}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge=
280
{}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.sha256)return b.sha256;b.defined.sha256=!0;for(var k=0;k<e.length;++k)e[k](b);return b.sha256}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/sha256",["require","module","./util"],function(){p.apply(null,
281
-Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var l,e,g,k,f,y,C,z,u,v,q,n,B,K,P,L,p,r,T,S,V,R,I,H,N,Y=d.length();128<=Y;){for(N=0;16>N;++N)c[N][0]=d.getInt32()>>>0,c[N][1]=d.getInt32()>>>0;for(;80>N;++N)f=c[N-2],u=f[0],f=f[1],l=((u>>>19|f<<13)^(f>>>29|u<<3)^u>>>6)>>>0,e=((u<<13|f>>>19)^(f<<3|u>>>29)^(u<<26|f>>>6))>>>0,f=c[N-15],u=f[0],f=f[1],g=((u>>>1|f<<31)^(u>>>8|f<<24)^u>>>7)>>>0,k=((u<<31|f>>>1)^(u<<24|f>>>8)^(u<<25|f>>>7))>>>0,u=c[N-7],v=c[N-16],
282
-f=e+u[1]+k+v[1],c[N][0]=l+u[0]+g+v[0]+(f/4294967296>>>0)>>>0,c[N][1]=f>>>0;u=a[0][0];v=a[0][1];q=a[1][0];n=a[1][1];B=a[2][0];K=a[2][1];P=a[3][0];L=a[3][1];p=a[4][0];r=a[4][1];T=a[5][0];S=a[5][1];V=a[6][0];R=a[6][1];I=a[7][0];H=a[7][1];for(N=0;80>N;++N)l=((p>>>14|r<<18)^(p>>>18|r<<14)^(r>>>9|p<<23))>>>0,f=((p<<18|r>>>14)^(p<<14|r>>>18)^(r<<23|p>>>9))>>>0,e=(V^p&(T^V))>>>0,y=(R^r&(S^R))>>>0,g=((u>>>28|v<<4)^(v>>>2|u<<30)^(v>>>7|u<<25))>>>0,k=((u<<4|v>>>28)^(v<<30|u>>>2)^(v<<25|u>>>7))>>>0,C=(u&q|B&
283
-(u^q))>>>0,z=(v&n|K&(v^n))>>>0,f=H+f+y+h[N][1]+c[N][1],l=I+l+e+h[N][0]+c[N][0]+(f/4294967296>>>0)>>>0,e=f>>>0,f=k+z,g=g+C+(f/4294967296>>>0)>>>0,k=f>>>0,I=V,H=R,V=T,R=S,T=p,S=r,f=L+e,p=P+l+(f/4294967296>>>0)>>>0,r=f>>>0,P=B,L=K,B=q,K=n,q=u,n=v,f=e+k,u=l+g+(f/4294967296>>>0)>>>0,v=f>>>0;f=a[0][1]+v;a[0][0]=a[0][0]+u+(f/4294967296>>>0)>>>0;a[0][1]=f>>>0;f=a[1][1]+n;a[1][0]=a[1][0]+q+(f/4294967296>>>0)>>>0;a[1][1]=f>>>0;f=a[2][1]+K;a[2][0]=a[2][0]+B+(f/4294967296>>>0)>>>0;a[2][1]=f>>>0;f=a[3][1]+L;a[3][0]=
281
+Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var l,e,g,k,f,z,D,x,u,v,q,n,B,J,P,K,p,r,T,S,V,R,I,H,N,Y=d.length();128<=Y;){for(N=0;16>N;++N)c[N][0]=d.getInt32()>>>0,c[N][1]=d.getInt32()>>>0;for(;80>N;++N)f=c[N-2],u=f[0],f=f[1],l=((u>>>19|f<<13)^(f>>>29|u<<3)^u>>>6)>>>0,e=((u<<13|f>>>19)^(f<<3|u>>>29)^(u<<26|f>>>6))>>>0,f=c[N-15],u=f[0],f=f[1],g=((u>>>1|f<<31)^(u>>>8|f<<24)^u>>>7)>>>0,k=((u<<31|f>>>1)^(u<<24|f>>>8)^(u<<25|f>>>7))>>>0,u=c[N-7],v=c[N-16],
282
+f=e+u[1]+k+v[1],c[N][0]=l+u[0]+g+v[0]+(f/4294967296>>>0)>>>0,c[N][1]=f>>>0;u=a[0][0];v=a[0][1];q=a[1][0];n=a[1][1];B=a[2][0];J=a[2][1];P=a[3][0];K=a[3][1];p=a[4][0];r=a[4][1];T=a[5][0];S=a[5][1];V=a[6][0];R=a[6][1];I=a[7][0];H=a[7][1];for(N=0;80>N;++N)l=((p>>>14|r<<18)^(p>>>18|r<<14)^(r>>>9|p<<23))>>>0,f=((p<<18|r>>>14)^(p<<14|r>>>18)^(r<<23|p>>>9))>>>0,e=(V^p&(T^V))>>>0,z=(R^r&(S^R))>>>0,g=((u>>>28|v<<4)^(v>>>2|u<<30)^(v>>>7|u<<25))>>>0,k=((u<<4|v>>>28)^(v<<30|u>>>2)^(v<<25|u>>>7))>>>0,D=(u&q|B&
283
+(u^q))>>>0,x=(v&n|J&(v^n))>>>0,f=H+f+z+h[N][1]+c[N][1],l=I+l+e+h[N][0]+c[N][0]+(f/4294967296>>>0)>>>0,e=f>>>0,f=k+x,g=g+D+(f/4294967296>>>0)>>>0,k=f>>>0,I=V,H=R,V=T,R=S,T=p,S=r,f=K+e,p=P+l+(f/4294967296>>>0)>>>0,r=f>>>0,P=B,K=J,B=q,J=n,q=u,n=v,f=e+k,u=l+g+(f/4294967296>>>0)>>>0,v=f>>>0;f=a[0][1]+v;a[0][0]=a[0][0]+u+(f/4294967296>>>0)>>>0;a[0][1]=f>>>0;f=a[1][1]+n;a[1][0]=a[1][0]+q+(f/4294967296>>>0)>>>0;a[1][1]=f>>>0;f=a[2][1]+J;a[2][0]=a[2][0]+B+(f/4294967296>>>0)>>>0;a[2][1]=f>>>0;f=a[3][1]+K;a[3][0]=
284
a[3][0]+P+(f/4294967296>>>0)>>>0;a[3][1]=f>>>0;f=a[4][1]+r;a[4][0]=a[4][0]+p+(f/4294967296>>>0)>>>0;a[4][1]=f>>>0;f=a[5][1]+S;a[5][0]=a[5][0]+T+(f/4294967296>>>0)>>>0;a[5][1]=f>>>0;f=a[6][1]+R;a[6][0]=a[6][0]+V+(f/4294967296>>>0)>>>0;a[6][1]=f>>>0;f=a[7][1]+H;a[7][0]=a[7][0]+I+(f/4294967296>>>0)>>>0;a[7][1]=f>>>0;Y-=128}}var d=c.sha512=c.sha512||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.sha512=c.md.algorithms.sha512=d;var e=c.sha384=c.sha512.sha384=c.sha512.sha384||{};e.create=function(){return d.create("SHA-384")};
285
c.md.sha384=c.md.algorithms.sha384=e;c.sha512.sha256=c.sha512.sha256||{create:function(){return d.create("SHA-512/256")}};c.md["sha512/256"]=c.md.algorithms["sha512/256"]=c.sha512.sha256;c.sha512.sha224=c.sha512.sha224||{create:function(){return d.create("SHA-512/224")}};c.md["sha512/224"]=c.md.algorithms["sha512/224"]=c.sha512.sha224;d.create=function(a){n||(f=String.fromCharCode(128),f+=c.util.fillString(String.fromCharCode(0),128),h=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],
286
[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,
@@ -288,9 +288,9 @@ c.md.sha384=c.md.algorithms.sha384=e;c.sha512.sha256=c.sha512.sha256||{create:fu
288
[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,
289
4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],g={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],"SHA-384":[[3418070365,
290
3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],"SHA-512/256":[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],"SHA-512/224":[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],
291
-[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},n=!0);"undefined"===typeof a&&(a="SHA-512");if(!(a in g))throw Error("Invalid SHA-512 algorithm: "+a);for(var d=g[a],e=null,v=c.util.createBuffer(),w=Array(80),F=0;80>F;++F)w[F]=Array(2);var A={algorithm:a.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength=0;A.fullMessageLength=A.messageLength128=[];for(var a=A.messageLengthSize/
292
-4,b=0;b<a;++b)A.fullMessageLength.push(0);v=c.util.createBuffer();e=Array(d.length);for(b=0;b<d.length;++b)e[b]=d[b].slice(0);return A}};A.start();A.update=function(a,d){"utf8"===d&&(a=c.util.encodeUtf8(a));var g=a.length;A.messageLength+=g;for(var g=[g/4294967296>>>0,g>>>0],h=A.fullMessageLength.length-1;0<=h;--h)A.fullMessageLength[h]+=g[1],g[1]=g[0]+(A.fullMessageLength[h]/4294967296>>>0),A.fullMessageLength[h]>>>=0,g[0]=g[1]/4294967296>>>0;v.putBytes(a);b(e,w,v);(2048<v.read||0===v.length())&&
293
-v.compact();return A};A.digest=function(){var d=c.util.createBuffer();d.putBytes(v.bytes());d.putBytes(f.substr(0,A.blockLength-(A.fullMessageLength[A.fullMessageLength.length-1]+A.messageLengthSize&A.blockLength-1)));c.util.createBuffer();for(var g,h,m=8*A.fullMessageLength[0],G=0;G<A.fullMessageLength.length;++G)g=8*A.fullMessageLength[G+1],h=g/4294967296>>>0,m+=h,d.putInt32(m>>>0),m=g;g=Array(e.length);for(G=0;G<e.length;++G)g[G]=e[G].slice(0);b(g,w,d);d=c.util.createBuffer();h="SHA-512"===a?g.length:
291
+[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},n=!0);"undefined"===typeof a&&(a="SHA-512");if(!(a in g))throw Error("Invalid SHA-512 algorithm: "+a);for(var d=g[a],e=null,v=c.util.createBuffer(),y=Array(80),C=0;80>C;++C)y[C]=Array(2);var A={algorithm:a.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){A.messageLength=0;A.fullMessageLength=A.messageLength128=[];for(var a=A.messageLengthSize/
292
+4,b=0;b<a;++b)A.fullMessageLength.push(0);v=c.util.createBuffer();e=Array(d.length);for(b=0;b<d.length;++b)e[b]=d[b].slice(0);return A}};A.start();A.update=function(a,d){"utf8"===d&&(a=c.util.encodeUtf8(a));var g=a.length;A.messageLength+=g;for(var g=[g/4294967296>>>0,g>>>0],h=A.fullMessageLength.length-1;0<=h;--h)A.fullMessageLength[h]+=g[1],g[1]=g[0]+(A.fullMessageLength[h]/4294967296>>>0),A.fullMessageLength[h]>>>=0,g[0]=g[1]/4294967296>>>0;v.putBytes(a);b(e,y,v);(2048<v.read||0===v.length())&&
293
+v.compact();return A};A.digest=function(){var d=c.util.createBuffer();d.putBytes(v.bytes());d.putBytes(f.substr(0,A.blockLength-(A.fullMessageLength[A.fullMessageLength.length-1]+A.messageLengthSize&A.blockLength-1)));c.util.createBuffer();for(var g,h,m=8*A.fullMessageLength[0],G=0;G<A.fullMessageLength.length;++G)g=8*A.fullMessageLength[G+1],h=g/4294967296>>>0,m+=h,d.putInt32(m>>>0),m=g;g=Array(e.length);for(G=0;G<e.length;++G)g[G]=e[G].slice(0);b(g,y,d);d=c.util.createBuffer();h="SHA-512"===a?g.length:
294
"SHA-384"===a?g.length-2:g.length-4;for(G=0;G<h;++G)d.putInt32(g[G][0]),G===h-1&&"SHA-512/224"===a||d.putInt32(g[G][1]);return d};return A};var f=null,n=!1,h=null,g=null}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.sha512)return b.sha512;b.defined.sha512=
295
!0;for(var k=0;k<e.length;++k)e[k](b);return b.sha512}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/sha512",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.md=c.md||{};c.md.algorithms={md5:c.md5,sha1:c.sha1,sha256:c.sha256};c.md.md5=c.md5;c.md.sha1=c.sha1;
296
c.md.sha256=c.sha256}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.md)return b.md;b.defined.md=!0;for(var k=0;k<e.length;++k)e[k](b);return b.md}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,
@@ -300,98 +300,98 @@ update:function(c){a.update(c)},getMac:function(){var c=a.digest().bytes();a.sta
300
0;k<e.length;++k)e[k](b);return b.hmac}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/hmac",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a){for(var c=a.name+": ",d=[],l=function(a,c){return" "+c},g=0;g<a.values.length;++g)d.push(a.values[g].replace(/^(\S+\r\n)/,
301
l));c+=d.join(",")+"\r\n";d=0;a=-1;for(g=0;g<c.length;++g,++d)if(65<d&&-1!==a)d=c[a],","===d?(++a,c=c.substr(0,a)+"\r\n "+c.substr(a)):c=c.substr(0,a)+"\r\n"+d+c.substr(a+1),d=g-a-1,a=-1,++g;else if(" "===c[g]||"\t"===c[g]||","===c[g])a=g;return c}var d=c.pem=c.pem||{};d.encode=function(a,d){d=d||{};var f="-----BEGIN "+a.type+"-----\r\n",h;a.procType&&(h={name:"Proc-Type",values:[String(a.procType.version),a.procType.type]},f+=b(h));a.contentDomain&&(h={name:"Content-Domain",values:[a.contentDomain]},
302
f+=b(h));a.dekInfo&&(h={name:"DEK-Info",values:[a.dekInfo.algorithm]},a.dekInfo.parameters&&h.values.push(a.dekInfo.parameters),f+=b(h));if(a.headers)for(h=0;h<a.headers.length;++h)f+=b(a.headers[h]);a.procType&&(f+="\r\n");f+=c.util.encode64(a.body,d.maxline||64)+"\r\n";return f+="-----END "+a.type+"-----\r\n"};d.decode=function(a){for(var b=[],d=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,h=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,
303
-g=/\r?\n/,k;;){k=d.exec(a);if(!k)break;var f={type:k[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:c.util.decode64(k[3])};b.push(f);if(k[2]){for(var v=k[2].split(g),x=0;k&&x<v.length;){k=v[x].replace(/\s+$/,"");for(var w=x+1;w<v.length;++w){var n=v[w];if(!/\s/.test(n[0]))break;k+=n;x=w}if(k=k.match(h)){for(var w={name:k[1],values:[]},n=k[2].split(","),A=0;A<n.length;++A)w.values.push(n[A].replace(/^\s+/,""));if(f.procType)if(f.contentDomain||"Content-Domain"!==w.name)if(f.dekInfo||
304
-"DEK-Info"!==w.name)f.headers.push(w);else{if(0===w.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');f.dekInfo={algorithm:n[0],parameters:n[1]||null}}else f.contentDomain=n[0]||"";else{if("Proc-Type"!==w.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==w.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');f.procType={version:n[0],
305
-type:n[1]}}}++x}if("ENCRYPTED"===f.procType&&!f.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===b.length)throw Error("Invalid PEM formatted message.");return b}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);
303
+g=/\r?\n/,k;;){k=d.exec(a);if(!k)break;var f={type:k[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:c.util.decode64(k[3])};b.push(f);if(k[2]){for(var v=k[2].split(g),w=0;k&&w<v.length;){k=v[w].replace(/\s+$/,"");for(var y=w+1;y<v.length;++y){var n=v[y];if(!/\s/.test(n[0]))break;k+=n;w=y}if(k=k.match(h)){for(var y={name:k[1],values:[]},n=k[2].split(","),A=0;A<n.length;++A)y.values.push(n[A].replace(/^\s+/,""));if(f.procType)if(f.contentDomain||"Content-Domain"!==y.name)if(f.dekInfo||
304
+"DEK-Info"!==y.name)f.headers.push(y);else{if(0===y.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');f.dekInfo={algorithm:n[0],parameters:n[1]||null}}else f.contentDomain=n[0]||"";else{if("Proc-Type"!==y.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');f.procType={version:n[0],
305
+type:n[1]}}}++w}if("ENCRYPTED"===f.procType&&!f.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===b.length)throw Error("Invalid PEM formatted message.");return b}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);
306
b=b||{};b.defined=b.defined||{};if(b.defined.pem)return b.pem;b.defined.pem=!0;for(var k=0;k<e.length;++k)e[k](b);return b.pem}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pem",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,d){c.cipher.registerAlgorithm(a,
307
-function(){return new c.des.Algorithm(a,d)})}function d(a,c,b,l){var e=32===a.length?3:9;l=3===e?l?[30,-2,-2]:[0,32,2]:l?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var k=c[0],z=c[1];c=(k>>>4^z)&252645135;z^=c;k^=c<<4;c=(k>>>16^z)&65535;z^=c;k^=c<<16;c=(z>>>2^k)&858993459;k^=c;z^=c<<2;c=(z>>>8^k)&16711935;k^=c;z^=c<<8;c=(k>>>1^z)&1431655765;for(var z=z^c,k=k^c<<1,k=k<<1|k>>>31,z=z<<1|z>>>31,v=0;v<e;v+=3){for(var p=l[v+1],q=l[v+2],r=l[v];r!=p;r+=q){var M=z^a[r],K=(z>>>4|z<<28)^a[r+1];c=k;
308
-k=z;z=c^(n[M>>>24&63]|g[M>>>16&63]|m[M>>>8&63]|x[M&63]|f[K>>>24&63]|h[K>>>16&63]|D[K>>>8&63]|E[K&63])}c=k;k=z;z=c}k=k>>>1|k<<31;z=z>>>1|z<<31;c=(k>>>1^z)&1431655765;z^=c;k^=c<<1;c=(z>>>8^k)&16711935;k^=c;z^=c<<8;c=(z>>>2^k)&858993459;k^=c;z^=c<<2;c=(k>>>16^z)&65535;z^=c;k^=c<<16;c=(k>>>4^z)&252645135;b[0]=k^c<<4;b[1]=z^c}function e(a){a=a||{};var b="DES-"+(a.mode||"CBC").toUpperCase(),d;d=a.decrypt?c.cipher.createDecipher(b,a.key):c.cipher.createCipher(b,a.key);var g=d.start;d.start=function(a,b){var e=
307
+function(){return new c.des.Algorithm(a,d)})}function d(a,c,b,l){var e=32===a.length?3:9;l=3===e?l?[30,-2,-2]:[0,32,2]:l?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var k=c[0],x=c[1];c=(k>>>4^x)&252645135;x^=c;k^=c<<4;c=(k>>>16^x)&65535;x^=c;k^=c<<16;c=(x>>>2^k)&858993459;k^=c;x^=c<<2;c=(x>>>8^k)&16711935;k^=c;x^=c<<8;c=(k>>>1^x)&1431655765;for(var x=x^c,k=k^c<<1,k=k<<1|k>>>31,x=x<<1|x>>>31,v=0;v<e;v+=3){for(var p=l[v+1],q=l[v+2],r=l[v];r!=p;r+=q){var M=x^a[r],J=(x>>>4|x<<28)^a[r+1];c=k;
308
+k=x;x=c^(n[M>>>24&63]|g[M>>>16&63]|m[M>>>8&63]|w[M&63]|f[J>>>24&63]|h[J>>>16&63]|E[J>>>8&63]|F[J&63])}c=k;k=x;x=c}k=k>>>1|k<<31;x=x>>>1|x<<31;c=(k>>>1^x)&1431655765;x^=c;k^=c<<1;c=(x>>>8^k)&16711935;k^=c;x^=c<<8;c=(x>>>2^k)&858993459;k^=c;x^=c<<2;c=(k>>>16^x)&65535;x^=c;k^=c<<16;c=(k>>>4^x)&252645135;b[0]=k^c<<4;b[1]=x^c}function e(a){a=a||{};var b="DES-"+(a.mode||"CBC").toUpperCase(),d;d=a.decrypt?c.cipher.createDecipher(b,a.key):c.cipher.createCipher(b,a.key);var g=d.start;d.start=function(a,b){var e=
309
null;b instanceof c.util.ByteBuffer&&(e=b,b={});b=b||{};b.output=e;b.iv=a;g.call(d,b)};return d}c.des=c.des||{};c.des.startEncrypting=function(a,c,b,d){a=e({key:a,output:b,decrypt:!1,mode:d||(null===c?"ECB":"CBC")});a.start(c);return a};c.des.createEncryptionCipher=function(a,c){return e({key:a,output:null,decrypt:!1,mode:c})};c.des.startDecrypting=function(a,c,b,d){a=e({key:a,output:b,decrypt:!0,mode:d||(null===c?"ECB":"CBC")});a.start(c);return a};c.des.createDecryptionCipher=function(a,c){return e({key:a,
310
output:null,decrypt:!0,mode:c})};c.des.Algorithm=function(a,c){var b=this;b.name=a;b.mode=new c({blockSize:8,cipher:{encrypt:function(a,c){return d(b._keys,a,c,!1)},decrypt:function(a,c){return d(b._keys,a,c,!0)}}});b._init=!1};c.des.Algorithm.prototype.initialize=function(a){if(!this._init){a=c.util.createBuffer(a.key);if(0===this.name.indexOf("3DES")&&24!==a.length())throw Error("Invalid Triple-DES key size: "+8*a.length());for(var b=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,
311
516,536871424,536871428,66048,66052,536936960,536936964],d=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],g=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],e=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],
312
k=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],f=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],m=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],q=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],u=[0,268435456,8,268435464,0,268435456,
313
-8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],v=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],K=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],x=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],n=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],D=8<a.length()?3:
314
-1,E=[],B=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],p=0,r,R=0;R<D;R++){var I=a.getInt32(),H=a.getInt32();r=(I>>>4^H)&252645135;H^=r;I^=r<<4;r=(H>>>-16^I)&65535;I^=r;H^=r<<-16;r=(I>>>2^H)&858993459;H^=r;I^=r<<2;r=(H>>>-16^I)&65535;I^=r;H^=r<<-16;r=(I>>>1^H)&1431655765;H^=r;I^=r<<1;r=(H>>>8^I)&16711935;I^=r;H^=r<<8;r=(I>>>1^H)&1431655765;H^=r;I^=r<<1;r=I<<8|H>>>20&240;for(var I=H<<24|H<<8&16711680|H>>>8&65280|H>>>24&240,H=r,N=0;N<B.length;++N){B[N]?(I=I<<2|I>>>26,H=H<<2|H>>>26):(I=I<<1|I>>>27,H=H<<1|H>>>27);
315
-var I=I&-15,H=H&-15,Y=b[I>>>28]|d[I>>>24&15]|g[I>>>20&15]|e[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|f[I>>>4&15],Z=m[H>>>28]|q[H>>>24&15]|u[H>>>20&15]|v[H>>>16&15]|K[H>>>12&15]|x[H>>>8&15]|n[H>>>4&15];r=(Z>>>16^Y)&65535;E[p++]=Y^r;E[p++]=Z^r<<16}}this._keys=E;this._init=!0}};b("DES-ECB",c.cipher.modes.ecb);b("DES-CBC",c.cipher.modes.cbc);b("DES-CFB",c.cipher.modes.cfb);b("DES-OFB",c.cipher.modes.ofb);b("DES-CTR",c.cipher.modes.ctr);b("3DES-ECB",c.cipher.modes.ecb);b("3DES-CBC",c.cipher.modes.cbc);b("3DES-CFB",
313
+8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],v=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],J=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],w=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],n=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],E=8<a.length()?3:
314
+1,F=[],B=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],p=0,r,R=0;R<E;R++){var I=a.getInt32(),H=a.getInt32();r=(I>>>4^H)&252645135;H^=r;I^=r<<4;r=(H>>>-16^I)&65535;I^=r;H^=r<<-16;r=(I>>>2^H)&858993459;H^=r;I^=r<<2;r=(H>>>-16^I)&65535;I^=r;H^=r<<-16;r=(I>>>1^H)&1431655765;H^=r;I^=r<<1;r=(H>>>8^I)&16711935;I^=r;H^=r<<8;r=(I>>>1^H)&1431655765;H^=r;I^=r<<1;r=I<<8|H>>>20&240;for(var I=H<<24|H<<8&16711680|H>>>8&65280|H>>>24&240,H=r,N=0;N<B.length;++N){B[N]?(I=I<<2|I>>>26,H=H<<2|H>>>26):(I=I<<1|I>>>27,H=H<<1|H>>>27);
315
+var I=I&-15,H=H&-15,Y=b[I>>>28]|d[I>>>24&15]|g[I>>>20&15]|e[I>>>16&15]|h[I>>>12&15]|k[I>>>8&15]|f[I>>>4&15],Z=m[H>>>28]|q[H>>>24&15]|u[H>>>20&15]|v[H>>>16&15]|J[H>>>12&15]|w[H>>>8&15]|n[H>>>4&15];r=(Z>>>16^Y)&65535;F[p++]=Y^r;F[p++]=Z^r<<16}}this._keys=F;this._init=!0}};b("DES-ECB",c.cipher.modes.ecb);b("DES-CBC",c.cipher.modes.cbc);b("DES-CFB",c.cipher.modes.cfb);b("DES-OFB",c.cipher.modes.ofb);b("DES-CTR",c.cipher.modes.ctr);b("3DES-ECB",c.cipher.modes.ecb);b("3DES-CBC",c.cipher.modes.cbc);b("3DES-CFB",
316
c.cipher.modes.cfb);b("3DES-OFB",c.cipher.modes.ofb);b("3DES-CTR",c.cipher.modes.ctr);var f=[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,
317
0,65540,66560,0,16842756],n=[-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,
318
-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],h=[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,
319
-8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],g=[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],D=[256,34078976,34078720,1107296512,
319
+8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],g=[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],E=[256,34078976,34078720,1107296512,
320
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,
321
524288,0,1074266112,34078976,1073742080],m=[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,
322
-4194320,536887312,0,541081600,536870912,4194320,536887312],E=[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,
323
-67108866,67110912,2048,2097154],x=[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,
322
+4194320,536887312,0,541081600,536870912,4194320,536887312],F=[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,
323
+67108866,67110912,2048,2097154],w=[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,
324
268435456,268701696]}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.des)return b.des;b.defined.des=!0;for(var k=0;k<e.length;++k)e[k](b);return b.des}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,
325
-Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/des",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var d=c.pkcs5=c.pkcs5||{},f="undefined"!==typeof process&&process.versions&&process.versions.node,e;f&&!c.disableNativeCode&&(e=b("crypto"));c.pbkdf2=d.pbkdf2=function(a,b,d,g,k,m){function n(){if(r>F)return m(null,y);p.start(null,
326
-null);p.update(b);p.update(c.util.int32ToBytes(r));C=G=p.digest().getBytes();q=2;x()}function x(){if(q<=d)return p.start(null,null),p.update(G),z=p.digest().getBytes(),C=c.util.xorBytes(C,z,w),G=z,++q,c.util.setImmediate(x);y+=r<F?C:C.substr(0,A);++r;n()}"function"===typeof k&&(m=k,k=null);if(f&&!c.disableNativeCode&&e.pbkdf2&&(null===k||"object"!==typeof k)&&(4<e.pbkdf2Sync.length||!k||"sha1"===k))return"string"!==typeof k&&(k="sha1"),b=new Buffer(b,"binary"),m?4===e.pbkdf2Sync.length?e.pbkdf2(a,
327
-b,d,g,function(a,c){if(a)return m(a);m(null,c.toString("binary"))}):e.pbkdf2(a,b,d,g,k,function(a,c){if(a)return m(a);m(null,c.toString("binary"))}):4===e.pbkdf2Sync.length?e.pbkdf2Sync(a,b,d,g).toString("binary"):e.pbkdf2Sync(a,b,d,g,k).toString("binary");if("undefined"===typeof k||null===k)k=c.md.sha1.create();if("string"===typeof k){if(!(k in c.md.algorithms))throw Error("Unknown hash algorithm: "+k);k=c.md[k].create()}var w=k.digestLength;if(g>4294967295*w){a=Error("Derived key is too long.");
328
-if(m)return m(a);throw a;}var F=Math.ceil(g/w),A=g-(F-1)*w,p=c.hmac.create();p.start(k,a);var y="",C,z,G;if(!m){for(var r=1;r<=F;++r){p.start(null,null);p.update(b);p.update(c.util.int32ToBytes(r));C=G=p.digest().getBytes();for(var q=2;q<=d;++q)p.start(null,null),p.update(G),z=p.digest().getBytes(),C=c.util.xorBytes(C,z,w),G=z;y+=r<F?C:C.substr(0,A)}return y}r=1;n()}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===
325
+Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/des",["require","module","./cipher","./cipherModes","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var d=c.pkcs5=c.pkcs5||{},f="undefined"!==typeof process&&process.versions&&process.versions.node,e;f&&!c.disableNativeCode&&(e=b("crypto"));c.pbkdf2=d.pbkdf2=function(a,b,d,g,k,m){function n(){if(r>C)return m(null,z);p.start(null,
326
+null);p.update(b);p.update(c.util.int32ToBytes(r));D=G=p.digest().getBytes();q=2;w()}function w(){if(q<=d)return p.start(null,null),p.update(G),x=p.digest().getBytes(),D=c.util.xorBytes(D,x,y),G=x,++q,c.util.setImmediate(w);z+=r<C?D:D.substr(0,A);++r;n()}"function"===typeof k&&(m=k,k=null);if(f&&!c.disableNativeCode&&e.pbkdf2&&(null===k||"object"!==typeof k)&&(4<e.pbkdf2Sync.length||!k||"sha1"===k))return"string"!==typeof k&&(k="sha1"),b=new Buffer(b,"binary"),m?4===e.pbkdf2Sync.length?e.pbkdf2(a,
327
+b,d,g,function(a,c){if(a)return m(a);m(null,c.toString("binary"))}):e.pbkdf2(a,b,d,g,k,function(a,c){if(a)return m(a);m(null,c.toString("binary"))}):4===e.pbkdf2Sync.length?e.pbkdf2Sync(a,b,d,g).toString("binary"):e.pbkdf2Sync(a,b,d,g,k).toString("binary");if("undefined"===typeof k||null===k)k=c.md.sha1.create();if("string"===typeof k){if(!(k in c.md.algorithms))throw Error("Unknown hash algorithm: "+k);k=c.md[k].create()}var y=k.digestLength;if(g>4294967295*y){a=Error("Derived key is too long.");
328
+if(m)return m(a);throw a;}var C=Math.ceil(g/y),A=g-(C-1)*y,p=c.hmac.create();p.start(k,a);var z="",D,x,G;if(!m){for(var r=1;r<=C;++r){p.start(null,null);p.update(b);p.update(c.util.int32ToBytes(r));D=G=p.digest().getBytes();for(var q=2;q<=d;++q)p.start(null,null),p.update(G),x=p.digest().getBytes(),D=c.util.xorBytes(D,x,y),G=x;z+=r<C?D:D.substr(0,A)}return z}r=1;n()}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===
329
typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pbkdf2)return b.pbkdf2;b.defined.pbkdf2=!0;for(var k=0;k<e.length;++k)e[k](b);return b.pbkdf2}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pbkdf2",["require","module",
330
"./hmac","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var d="undefined"!==typeof process&&process.versions&&process.versions.node,f=null;c.disableNativeCode||!d||process.versions["node-webkit"]||(f=b("crypto"));(c.prng=c.prng||{}).create=function(a){function b(a){if(32<=g.pools[0].messageLength)return d(),a();g.seedFile(32-g.pools[0].messageLength<<5,function(c,b){if(c)return a(c);g.collect(b);d();a()})}function d(){var a=g.plugin.md.create();
331
a.update(g.pools[0].digest().getBytes());g.pools[0].start();for(var c=1,b=1;32>b;++b)c=31===c?2147483648:c<<2,0===c%g.reseeds&&(a.update(g.pools[b].digest().getBytes()),g.pools[b].start());c=a.digest().getBytes();a.start();a.update(c);a=a.digest().getBytes();g.key=g.plugin.formatKey(c);g.seed=g.plugin.formatSeed(a);g.reseeds=4294967295===g.reseeds?0:g.reseeds+1;g.generated=0}function h(a){var b=null;if("undefined"!==typeof window){var d=window.crypto||window.msCrypto;d&&d.getRandomValues&&(b=function(a){return d.getRandomValues(a)})}var g=
332
c.util.createBuffer();if(b)for(;g.length()<a;){var e=Math.max(1,Math.min(a-g.length(),65536)/4),h=new Uint32Array(Math.floor(e));try{for(b(h),e=0;e<h.length;++e)g.putInt32(h[e])}catch(k){if(!("undefined"!==typeof QuotaExceededError&&k instanceof QuotaExceededError))throw k;}}if(g.length()<a)for(b=Math.floor(65536*Math.random());g.length()<a;)for(e=16807*(b&65535),b=16807*(b>>16),e+=(b&32767)<<16,e+=b>>15,e=(e&2147483647)+(e>>31),b=e&4294967295,e=0;3>e;++e)h=b>>>(e<<3),h^=Math.floor(256*Math.random()),
333
-g.putByte(String.fromCharCode(h&255));return g.getBytes(a)}var g={plugin:a,key:null,seed:null,time:null,reseeds:0,generated:0};a=a.md;for(var k=Array(32),m=0;32>m;++m)k[m]=a.create();g.pools=k;g.pool=0;g.generate=function(a,d){function e(z){if(z)return d(z);if(C.length()>=a)return d(null,C.getBytes(a));1048575<g.generated&&(g.key=null);if(null===g.key)return c.util.nextTick(function(){b(e)});z=h(g.key,g.seed);g.generated+=z.length;C.putBytes(z);g.key=f(h(g.key,k(g.seed)));g.seed=m(h(g.key,g.seed));
334
-c.util.setImmediate(e)}if(!d)return g.generateSync(a);var h=g.plugin.cipher,k=g.plugin.increment,f=g.plugin.formatKey,m=g.plugin.formatSeed,C=c.util.createBuffer();g.key=null;e()};g.generateSync=function(a){var b=g.plugin.cipher,e=g.plugin.increment,h=g.plugin.formatKey,k=g.plugin.formatSeed;g.key=null;for(var f=c.util.createBuffer();f.length()<a;){1048575<g.generated&&(g.key=null);null===g.key&&(32<=g.pools[0].messageLength||g.collect(g.seedFileSync(32-g.pools[0].messageLength<<5)),d());var m=b(g.key,
333
+g.putByte(String.fromCharCode(h&255));return g.getBytes(a)}var g={plugin:a,key:null,seed:null,time:null,reseeds:0,generated:0};a=a.md;for(var k=Array(32),m=0;32>m;++m)k[m]=a.create();g.pools=k;g.pool=0;g.generate=function(a,d){function e(x){if(x)return d(x);if(D.length()>=a)return d(null,D.getBytes(a));1048575<g.generated&&(g.key=null);if(null===g.key)return c.util.nextTick(function(){b(e)});x=h(g.key,g.seed);g.generated+=x.length;D.putBytes(x);g.key=f(h(g.key,k(g.seed)));g.seed=m(h(g.key,g.seed));
334
+c.util.setImmediate(e)}if(!d)return g.generateSync(a);var h=g.plugin.cipher,k=g.plugin.increment,f=g.plugin.formatKey,m=g.plugin.formatSeed,D=c.util.createBuffer();g.key=null;e()};g.generateSync=function(a){var b=g.plugin.cipher,e=g.plugin.increment,h=g.plugin.formatKey,k=g.plugin.formatSeed;g.key=null;for(var f=c.util.createBuffer();f.length()<a;){1048575<g.generated&&(g.key=null);null===g.key&&(32<=g.pools[0].messageLength||g.collect(g.seedFileSync(32-g.pools[0].messageLength<<5)),d());var m=b(g.key,
335
g.seed);g.generated+=m.length;f.putBytes(m);g.key=h(b(g.key,e(g.seed)));g.seed=k(b(g.key,g.seed))}return f.getBytes(a)};f?(g.seedFile=function(a,c){f.randomBytes(a,function(a,b){if(a)return c(a);c(null,b.toString())})},g.seedFileSync=function(a){return f.randomBytes(a).toString()}):(g.seedFile=function(a,c){try{c(null,h(a))}catch(b){c(b)}},g.seedFileSync=h);g.collect=function(a){for(var c=a.length,b=0;b<c;++b)g.pools[g.pool].update(a.substr(b,1)),g.pool=31===g.pool?0:g.pool+1};g.collectInt=function(a,
336
c){for(var b="",d=0;d<c;d+=8)b+=String.fromCharCode(a>>d&255);g.collect(b)};g.registerWorker=function(a){a===self?g.seedFile=function(a,c){function b(a){a=a.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",b),c(a.forge.prng.err,a.forge.prng.bytes))}self.addEventListener("message",b);self.postMessage({forge:{prng:{needed:a}}})}:a.addEventListener("message",function(c){c=c.data;c.forge&&c.forge.prng&&g.seedFile(c.forge.prng.needed,function(c,b){a.postMessage({forge:{prng:{err:c,bytes:b}}})})})};
337
return g}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.prng)return b.prng;b.defined.prng=!0;for(var k=0;k<e.length;++k)e[k](b);return b.prng}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,
338
0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/prng",["require","module","./md","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.random&&c.random.getBytes||function(a){function b(){var a=c.prng.create(d);a.getBytes=function(c,b){return a.generate(c,b)};a.getBytesSync=function(c){return a.generate(c)};return a}var d={},f=Array(4),n=c.util.createBuffer();d.formatKey=function(a){var b=c.util.createBuffer(a);a=Array(4);
339
a[0]=b.getInt32();a[1]=b.getInt32();a[2]=b.getInt32();a[3]=b.getInt32();return c.aes._expandKey(a,!1)};d.formatSeed=function(a){var b=c.util.createBuffer(a);a=Array(4);a[0]=b.getInt32();a[1]=b.getInt32();a[2]=b.getInt32();a[3]=b.getInt32();return a};d.cipher=function(a,b){c.aes._updateBlock(a,b,f,!1);n.putInt32(f[0]);n.putInt32(f[1]);n.putInt32(f[2]);n.putInt32(f[3]);return n.getBytes()};d.increment=function(a){++a[3];return a};d.md=c.md.sha256;var h=b(),g="undefined"!==typeof process&&process.versions&&
340
-process.versions.node,D=null;if("undefined"!==typeof window){var m=window.crypto||window.msCrypto;m&&m.getRandomValues&&(D=function(a){return m.getRandomValues(a)})}if(c.disableNativeCode||!g&&!D){h.collectInt(+new Date,32);if("undefined"!==typeof navigator){var g="",E;for(E in navigator)try{"string"==typeof navigator[E]&&(g+=navigator[E])}catch(x){}h.collect(g);g=null}a&&(a().mousemove(function(a){h.collectInt(a.clientX,16);h.collectInt(a.clientY,16)}),a().keypress(function(a){h.collectInt(a.charCode,
341
-8)}))}if(c.random)for(E in h)c.random[E]=h[E];else c.random=h;c.random.createInstance=b}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.random)return b.random;b.defined.random=!0;for(var k=0;k<e.length;++k)e[k](b);
340
+process.versions.node,E=null;if("undefined"!==typeof window){var m=window.crypto||window.msCrypto;m&&m.getRandomValues&&(E=function(a){return m.getRandomValues(a)})}if(c.disableNativeCode||!g&&!E){h.collectInt(+new Date,32);if("undefined"!==typeof navigator){var g="",F;for(F in navigator)try{"string"==typeof navigator[F]&&(g+=navigator[F])}catch(w){}h.collect(g);g=null}a&&(a().mousemove(function(a){h.collectInt(a.clientX,16);h.collectInt(a.clientY,16)}),a().keypress(function(a){h.collectInt(a.charCode,
341
+8)}))}if(c.random)for(F in h)c.random[F]=h[F];else c.random=h;c.random.createInstance=b}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.random)return b.random;b.defined.random=!0;for(var k=0;k<e.length;++k)e[k](b);
342
return b.random}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/random","require module ./aes ./md ./prng ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var b=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,
343
139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,
344
175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],d=[1,2,3,5];c.rc2=c.rc2||{};c.rc2.expandKey=function(a,d){"string"===typeof a&&(a=c.util.createBuffer(a));d=d||128;var e=a,g=a.length(),f=d,m=Math.ceil(f/8),f=255>>(f&7),v;for(v=g;128>v;v++)e.putByte(b[e.at(v-
345
-1)+e.at(v-g)&255]);e.setAt(128-m,b[e.at(128-m)&f]);for(v=127-m;0<=v;v--)e.setAt(v,b[e.at(v+1)^e.at(v+m)]);return e};var e=function(a,b,e){var g=!1,k=null,f=null,n=null,x,w,p,A,r=[];a=c.rc2.expandKey(a,b);for(p=0;64>p;p++)r.push(a.getInt16Le());e?(x=function(a){for(p=0;4>p;p++){a[p]+=r[A]+(a[(p+3)%4]&a[(p+2)%4])+(~a[(p+3)%4]&a[(p+1)%4]);var c=a[p],b=d[p];a[p]=c<<b&65535|(c&65535)>>16-b;A++}},w=function(a){for(p=0;4>p;p++)a[p]+=r[a[(p+3)%4]&63]}):(x=function(a){for(p=3;0<=p;p--){var c=a[p],b=d[p];a[p]=
346
-(c&65535)>>b|c<<16-b&65535;a[p]-=r[A]+(a[(p+3)%4]&a[(p+2)%4])+(~a[(p+3)%4]&a[(p+1)%4]);A--}},w=function(a){for(p=3;0<=p;p--)a[p]-=r[a[(p+3)%4]&63]});var y=null;return y={start:function(a,b){a&&"string"===typeof a&&(a=c.util.createBuffer(a));g=!1;k=c.util.createBuffer();f=b||new c.util.createBuffer;n=a;y.output=f},update:function(a){for(g||k.putBuffer(a);8<=k.length();){a=[[5,x],[1,w],[6,x],[1,w],[5,x]];var c=[];for(p=0;4>p;p++){var b=k.getInt16Le();null!==n&&(e?b^=n.getInt16Le():n.putInt16Le(b));
347
-c.push(b&65535)}A=e?0:63;for(b=0;b<a.length;b++)for(var d=0;d<a[b][0];d++)a[b][1](c);for(p=0;4>p;p++)null!==n&&(e?n.putInt16Le(c[p]):c[p]^=n.getInt16Le()),f.putInt16Le(c[p])}},finish:function(a){var c=!0;if(e)if(a)c=a(8,k,!e);else{var b=8===k.length()?8:8-k.length();k.fillWithByte(b,b)}c&&(g=!0,y.update());!e&&(c=0===k.length())&&(a?c=a(8,f,!e):(a=f.length(),b=f.at(a-1),b>a?c=!1:f.truncate(b)));return c}}};c.rc2.startEncrypting=function(a,b,d){a=c.rc2.createEncryptionCipher(a,128);a.start(b,d);return a};
345
+1)+e.at(v-g)&255]);e.setAt(128-m,b[e.at(128-m)&f]);for(v=127-m;0<=v;v--)e.setAt(v,b[e.at(v+1)^e.at(v+m)]);return e};var e=function(a,b,e){var g=!1,k=null,f=null,n=null,w,y,p,A,r=[];a=c.rc2.expandKey(a,b);for(p=0;64>p;p++)r.push(a.getInt16Le());e?(w=function(a){for(p=0;4>p;p++){a[p]+=r[A]+(a[(p+3)%4]&a[(p+2)%4])+(~a[(p+3)%4]&a[(p+1)%4]);var c=a[p],b=d[p];a[p]=c<<b&65535|(c&65535)>>16-b;A++}},y=function(a){for(p=0;4>p;p++)a[p]+=r[a[(p+3)%4]&63]}):(w=function(a){for(p=3;0<=p;p--){var c=a[p],b=d[p];a[p]=
346
+(c&65535)>>b|c<<16-b&65535;a[p]-=r[A]+(a[(p+3)%4]&a[(p+2)%4])+(~a[(p+3)%4]&a[(p+1)%4]);A--}},y=function(a){for(p=3;0<=p;p--)a[p]-=r[a[(p+3)%4]&63]});var z=null;return z={start:function(a,b){a&&"string"===typeof a&&(a=c.util.createBuffer(a));g=!1;k=c.util.createBuffer();f=b||new c.util.createBuffer;n=a;z.output=f},update:function(a){for(g||k.putBuffer(a);8<=k.length();){a=[[5,w],[1,y],[6,w],[1,y],[5,w]];var c=[];for(p=0;4>p;p++){var b=k.getInt16Le();null!==n&&(e?b^=n.getInt16Le():n.putInt16Le(b));
347
+c.push(b&65535)}A=e?0:63;for(b=0;b<a.length;b++)for(var d=0;d<a[b][0];d++)a[b][1](c);for(p=0;4>p;p++)null!==n&&(e?n.putInt16Le(c[p]):c[p]^=n.getInt16Le()),f.putInt16Le(c[p])}},finish:function(a){var c=!0;if(e)if(a)c=a(8,k,!e);else{var b=8===k.length()?8:8-k.length();k.fillWithByte(b,b)}c&&(g=!0,z.update());!e&&(c=0===k.length())&&(a?c=a(8,f,!e):(a=f.length(),b=f.at(a-1),b>a?c=!1:f.truncate(b)));return c}}};c.rc2.startEncrypting=function(a,b,d){a=c.rc2.createEncryptionCipher(a,128);a.start(b,d);return a};
348
c.rc2.createEncryptionCipher=function(a,c){return e(a,c,!0)};c.rc2.startDecrypting=function(a,b,d){a=c.rc2.createDecryptionCipher(a,128);a.start(b,d);return a};c.rc2.createDecryptionCipher=function(a,c){return e(a,c,!1)}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||
349
{};if(b.defined.rc2)return b.rc2;b.defined.rc2=!0;for(var k=0;k<e.length;++k)e[k](b);return b.rc2}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/rc2",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){this.data=[];null!=a&&("number"==typeof a?
350
this.fromNumber(a,c,d):null==c&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,c))}function d(){return new b(null)}function e(a,c,b,d,l,g){for(;0<=--g;){var e=c*this.data[a++]+b.data[d]+l;l=Math.floor(e/67108864);b.data[d++]=e&67108863}return l}function f(a,c,b,d,l,g){var e=c&32767;for(c>>=15;0<=--g;){var h=this.data[a]&32767,k=this.data[a++]>>15,m=c*h+k*e,h=e*h+((m&32767)<<15)+b.data[d]+(l&1073741823);l=(h>>>30)+(m>>>15)+c*k+(l>>>30);b.data[d++]=h&1073741823}return l}function n(a,c,
351
-b,d,l,e){var g=c&16383;for(c>>=14;0<=--e;){var h=this.data[a]&16383,f=this.data[a++]>>14,k=c*h+f*g,h=g*h+((k&16383)<<14)+b.data[d]+l;l=(h>>28)+(k>>14)+c*f;b.data[d++]=h&268435455}return l}function h(a,c){var b=X[a.charCodeAt(c)];return null==b?-1:b}function g(a){var c=d();c.fromInt(a);return c}function p(a){var c=1,b;0!=(b=a>>>16)&&(a=b,c+=16);0!=(b=a>>8)&&(a=b,c+=8);0!=(b=a>>4)&&(a=b,c+=4);0!=(b=a>>2)&&(a=b,c+=2);0!=a>>1&&(c+=1);return c}function m(a){this.m=a}function E(a){this.m=a;this.mp=a.invDigit();
352
-this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function x(a,c){return a&c}function w(a,c){return a|c}function r(a,c){return a^c}function A(a,c){return a&~c}function J(){}function y(a){return a}function C(a){this.r2=d();this.q3=d();b.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function z(){return{nextBytes:function(a){for(var c=0;c<a.length;++c)a[c]=Math.floor(256*Math.random())}}}var G;"undefined"===typeof navigator?(b.prototype.am=n,G=28):"Microsoft Internet Explorer"==
351
+b,d,l,g){var e=c&16383;for(c>>=14;0<=--g;){var h=this.data[a]&16383,f=this.data[a++]>>14,k=c*h+f*e,h=e*h+((k&16383)<<14)+b.data[d]+l;l=(h>>28)+(k>>14)+c*f;b.data[d++]=h&268435455}return l}function h(a,c){var b=X[a.charCodeAt(c)];return null==b?-1:b}function g(a){var c=d();c.fromInt(a);return c}function p(a){var c=1,b;0!=(b=a>>>16)&&(a=b,c+=16);0!=(b=a>>8)&&(a=b,c+=8);0!=(b=a>>4)&&(a=b,c+=4);0!=(b=a>>2)&&(a=b,c+=2);0!=a>>1&&(c+=1);return c}function m(a){this.m=a}function F(a){this.m=a;this.mp=a.invDigit();
352
+this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function w(a,c){return a&c}function y(a,c){return a|c}function r(a,c){return a^c}function A(a,c){return a&~c}function L(){}function z(a){return a}function D(a){this.r2=d();this.q3=d();b.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function x(){return{nextBytes:function(a){for(var c=0;c<a.length;++c)a[c]=Math.floor(256*Math.random())}}}var G;"undefined"===typeof navigator?(b.prototype.am=n,G=28):"Microsoft Internet Explorer"==
353
navigator.appName?(b.prototype.am=f,G=30):"Netscape"!=navigator.appName?(b.prototype.am=e,G=26):(b.prototype.am=n,G=28);b.prototype.DB=G;b.prototype.DM=(1<<G)-1;b.prototype.DV=1<<G;b.prototype.FV=Math.pow(2,52);b.prototype.F1=52-G;b.prototype.F2=2*G-52;var X=[],q;G=48;for(q=0;9>=q;++q)X[G++]=q;G=97;for(q=10;36>q;++q)X[G++]=q;G=65;for(q=10;36>q;++q)X[G++]=q;m.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};m.prototype.revert=function(a){return a};m.prototype.reduce=
354
-function(a){a.divRemTo(this.m,null,a)};m.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};m.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};E.prototype.convert=function(a){var c=d();a.abs().dlShiftTo(this.m.t,c);c.divRemTo(this.m,null,c);0>a.s&&0<c.compareTo(b.ZERO)&&this.m.subTo(c,c);return c};E.prototype.revert=function(a){var c=d();a.copyTo(c);this.reduce(c);return c};E.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var c=0;c<this.m.t;++c){var b=
355
-a.data[c]&32767,d=b*this.mpl+((b*this.mph+(a.data[c]>>15)*this.mpl&this.um)<<15)&a.DM,b=c+this.m.t;for(a.data[b]+=this.m.am(0,d,a,c,0,this.m.t);a.data[b]>=a.DV;)a.data[b]-=a.DV,a.data[++b]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};E.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};E.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};b.prototype.copyTo=function(a){for(var c=this.t-1;0<=c;--c)a.data[c]=this.data[c];a.t=this.t;a.s=this.s};
354
+function(a){a.divRemTo(this.m,null,a)};m.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};m.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};F.prototype.convert=function(a){var c=d();a.abs().dlShiftTo(this.m.t,c);c.divRemTo(this.m,null,c);0>a.s&&0<c.compareTo(b.ZERO)&&this.m.subTo(c,c);return c};F.prototype.revert=function(a){var c=d();a.copyTo(c);this.reduce(c);return c};F.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var c=0;c<this.m.t;++c){var b=
355
+a.data[c]&32767,d=b*this.mpl+((b*this.mph+(a.data[c]>>15)*this.mpl&this.um)<<15)&a.DM,b=c+this.m.t;for(a.data[b]+=this.m.am(0,d,a,c,0,this.m.t);a.data[b]>=a.DV;)a.data[b]-=a.DV,a.data[++b]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};F.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};F.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};b.prototype.copyTo=function(a){for(var c=this.t-1;0<=c;--c)a.data[c]=this.data[c];a.t=this.t;a.s=this.s};
356
b.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};b.prototype.fromString=function(a,c){var d;if(16==c)d=4;else if(8==c)d=3;else if(256==c)d=8;else if(2==c)d=1;else if(32==c)d=5;else if(4==c)d=2;else{this.fromRadix(a,c);return}this.s=this.t=0;for(var l=a.length,g=!1,e=0;0<=--l;){var f=8==d?a[l]&255:h(a,l);0>f?"-"==a.charAt(l)&&(g=!0):(g=!1,0==e?this.data[this.t++]=f:e+d>this.DB?(this.data[this.t-1]|=(f&(1<<this.DB-e)-1)<<e,this.data[this.t++]=
357
f>>this.DB-e):this.data[this.t-1]|=f<<e,e+=d,e>=this.DB&&(e-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<e&&(this.data[this.t-1]|=(1<<this.DB-e)-1<<e));this.clamp();g&&b.ZERO.subTo(this,this)};b.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};b.prototype.dlShiftTo=function(a,c){var b;for(b=this.t-1;0<=b;--b)c.data[b+a]=this.data[b];for(b=a-1;0<=b;--b)c.data[b]=0;c.t=this.t+a;c.s=this.s};b.prototype.drShiftTo=function(a,c){for(var b=a;b<this.t;++b)c.data[b-
358
a]=this.data[b];c.t=Math.max(this.t-a,0);c.s=this.s};b.prototype.lShiftTo=function(a,c){var b=a%this.DB,d=this.DB-b,l=(1<<d)-1,e=Math.floor(a/this.DB),g=this.s<<b&this.DM,h;for(h=this.t-1;0<=h;--h)c.data[h+e+1]=this.data[h]>>d|g,g=(this.data[h]&l)<<b;for(h=e-1;0<=h;--h)c.data[h]=0;c.data[e]=g;c.t=this.t+e+1;c.s=this.s;c.clamp()};b.prototype.rShiftTo=function(a,c){c.s=this.s;var b=Math.floor(a/this.DB);if(b>=this.t)c.t=0;else{var d=a%this.DB,l=this.DB-d,e=(1<<d)-1;c.data[0]=this.data[b]>>d;for(var g=
359
b+1;g<this.t;++g)c.data[g-b-1]|=(this.data[g]&e)<<l,c.data[g-b]=this.data[g]>>d;0<d&&(c.data[this.t-b-1]|=(this.s&e)<<l);c.t=this.t-b;c.clamp()}};b.prototype.subTo=function(a,c){for(var b=0,d=0,l=Math.min(a.t,this.t);b<l;)d+=this.data[b]-a.data[b],c.data[b++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;b<this.t;)d+=this.data[b],c.data[b++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;b<a.t;)d-=a.data[b],c.data[b++]=d&this.DM,d>>=this.DB;d-=a.s}c.s=0>d?-1:0;-1>d?c.data[b++]=this.DV+d:0<d&&
360
(c.data[b++]=d);c.t=b;c.clamp()};b.prototype.multiplyTo=function(a,c){var d=this.abs(),l=a.abs(),e=d.t;for(c.t=e+l.t;0<=--e;)c.data[e]=0;for(e=0;e<l.t;++e)c.data[e+d.t]=d.am(0,l.data[e],c,e,0,d.t);c.s=0;c.clamp();this.s!=a.s&&b.ZERO.subTo(c,c)};b.prototype.squareTo=function(a){for(var c=this.abs(),b=a.t=2*c.t;0<=--b;)a.data[b]=0;for(b=0;b<c.t-1;++b){var d=c.am(b,c.data[b],a,2*b,0,1);(a.data[b+c.t]+=c.am(b+1,2*c.data[b],a,2*b+1,d,c.t-b-1))>=c.DV&&(a.data[b+c.t]-=c.DV,a.data[b+c.t+1]=1)}0<a.t&&(a.data[a.t-
361
-1]+=c.am(b,c.data[b],a,2*b,0,1));a.s=0;a.clamp()};b.prototype.divRemTo=function(a,c,l){var e=a.abs();if(!(0>=e.t)){var g=this.abs();if(g.t<e.t)null!=c&&c.fromInt(0),null!=l&&this.copyTo(l);else{null==l&&(l=d());var h=d(),f=this.s;a=a.s;var m=this.DB-p(e.data[e.t-1]);0<m?(e.lShiftTo(m,h),g.lShiftTo(m,l)):(e.copyTo(h),g.copyTo(l));e=h.t;g=h.data[e-1];if(0!=g){var y=g*(1<<this.F1)+(1<e?h.data[e-2]>>this.F2:0),q=this.FV/y,y=(1<<this.F1)/y,z=1<<this.F2,C=l.t,u=C-e,n=null==c?d():c;h.dlShiftTo(u,n);0<=l.compareTo(n)&&
362
-(l.data[l.t++]=1,l.subTo(n,l));b.ONE.dlShiftTo(e,n);for(n.subTo(h,h);h.t<e;)h.data[h.t++]=0;for(;0<=--u;){var x=l.data[--C]==g?this.DM:Math.floor(l.data[C]*q+(l.data[C-1]+z)*y);if((l.data[C]+=h.am(0,x,l,u,0,e))<x)for(h.dlShiftTo(u,n),l.subTo(n,l);l.data[C]<--x;)l.subTo(n,l)}null!=c&&(l.drShiftTo(e,c),f!=a&&b.ZERO.subTo(c,c));l.t=e;l.clamp();0<m&&l.rShiftTo(m,l);0>f&&b.ZERO.subTo(l,l)}}}};b.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var c=a&3,c=c*(2-
361
+1]+=c.am(b,c.data[b],a,2*b,0,1));a.s=0;a.clamp()};b.prototype.divRemTo=function(a,c,l){var e=a.abs();if(!(0>=e.t)){var g=this.abs();if(g.t<e.t)null!=c&&c.fromInt(0),null!=l&&this.copyTo(l);else{null==l&&(l=d());var h=d(),f=this.s;a=a.s;var m=this.DB-p(e.data[e.t-1]);0<m?(e.lShiftTo(m,h),g.lShiftTo(m,l)):(e.copyTo(h),g.copyTo(l));e=h.t;g=h.data[e-1];if(0!=g){var z=g*(1<<this.F1)+(1<e?h.data[e-2]>>this.F2:0),q=this.FV/z,z=(1<<this.F1)/z,x=1<<this.F2,D=l.t,u=D-e,n=null==c?d():c;h.dlShiftTo(u,n);0<=l.compareTo(n)&&
362
+(l.data[l.t++]=1,l.subTo(n,l));b.ONE.dlShiftTo(e,n);for(n.subTo(h,h);h.t<e;)h.data[h.t++]=0;for(;0<=--u;){var w=l.data[--D]==g?this.DM:Math.floor(l.data[D]*q+(l.data[D-1]+x)*z);if((l.data[D]+=h.am(0,w,l,u,0,e))<w)for(h.dlShiftTo(u,n),l.subTo(n,l);l.data[D]<--w;)l.subTo(n,l)}null!=c&&(l.drShiftTo(e,c),f!=a&&b.ZERO.subTo(c,c));l.t=e;l.clamp();0<m&&l.rShiftTo(m,l);0>f&&b.ZERO.subTo(l,l)}}}};b.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var c=a&3,c=c*(2-
363
(a&15)*c)&15,c=c*(2-(a&255)*c)&255,c=c*(2-((a&65535)*c&65535))&65535,c=c*(2-a*c%this.DV)%this.DV;return 0<c?this.DV-c:-c};b.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};b.prototype.exp=function(a,c){if(4294967295<a||1>a)return b.ONE;var l=d(),e=d(),g=c.convert(this),h=p(a)-1;for(g.copyTo(l);0<=--h;)if(c.sqrTo(l,e),0<(a&1<<h))c.mulTo(e,g,l);else var f=l,l=e,e=f;return c.revert(l)};b.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
364
4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var c=(1<<a)-1,b,d=!1,l="",e=this.t,g=this.DB-e*this.DB%a;if(0<e--)for(g<this.DB&&0<(b=this.data[e]>>g)&&(d=!0,l="0123456789abcdefghijklmnopqrstuvwxyz".charAt(b));0<=e;)g<a?(b=(this.data[e]&(1<<g)-1)<<a-g,b|=this.data[--e]>>(g+=this.DB-a)):(b=this.data[e]>>(g-=a)&c,0>=g&&(g+=this.DB,--e)),0<b&&(d=!0),d&&(l+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(b));return d?l:"0"};b.prototype.negate=function(){var a=
365
d();b.ZERO.subTo(this,a);return a};b.prototype.abs=function(){return 0>this.s?this.negate():this};b.prototype.compareTo=function(a){var c=this.s-a.s;if(0!=c)return c;var b=this.t,c=b-a.t;if(0!=c)return 0>this.s?-c:c;for(;0<=--b;)if(0!=(c=this.data[b]-a.data[b]))return c;return 0};b.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)};b.prototype.mod=function(a){var c=d();this.abs().divRemTo(a,null,c);0>this.s&&0<c.compareTo(b.ZERO)&&a.subTo(c,
366
-c);return c};b.prototype.modPowInt=function(a,c){var b;b=256>a||c.isEven()?new m(c):new E(c);return this.exp(a,b)};b.ZERO=g(0);b.ONE=g(1);J.prototype.convert=y;J.prototype.revert=y;J.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b)};J.prototype.sqrTo=function(a,c){a.squareTo(c)};C.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var c=d();a.copyTo(c);this.reduce(c);return c};C.prototype.revert=function(a){return a};C.prototype.reduce=function(a){a.drShiftTo(this.m.t-
367
-1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};C.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};C.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};var O=[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,
366
+c);return c};b.prototype.modPowInt=function(a,c){var b;b=256>a||c.isEven()?new m(c):new F(c);return this.exp(a,b)};b.ZERO=g(0);b.ONE=g(1);L.prototype.convert=z;L.prototype.revert=z;L.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b)};L.prototype.sqrTo=function(a,c){a.squareTo(c)};D.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var c=d();a.copyTo(c);this.reduce(c);return c};D.prototype.revert=function(a){return a};D.prototype.reduce=function(a){a.drShiftTo(this.m.t-
367
+1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};D.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};D.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};var O=[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,
368
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],M=67108864/O[O.length-1];b.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};b.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var c=this.chunkSize(a),c=Math.pow(a,
369
-c),b=g(c),l=d(),e=d(),h="";for(this.divRemTo(b,l,e);0<l.signum();)h=(c+e.intValue()).toString(a).substr(1)+h,l.divRemTo(b,l,e);return e.intValue().toString(a)+h};b.prototype.fromRadix=function(a,c){this.fromInt(0);null==c&&(c=10);for(var d=this.chunkSize(c),l=Math.pow(c,d),e=!1,g=0,f=0,m=0;m<a.length;++m){var y=h(a,m);0>y?"-"==a.charAt(m)&&0==this.signum()&&(e=!0):(f=c*f+y,++g>=d&&(this.dMultiply(l),this.dAddOffset(f,0),f=g=0))}0<g&&(this.dMultiply(Math.pow(c,g)),this.dAddOffset(f,0));e&&b.ZERO.subTo(this,
370
-this)};b.prototype.fromNumber=function(a,c,d){if("number"==typeof c)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(b.ONE.shiftLeft(a-1),w,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(c);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(b.ONE.shiftLeft(a-1),this);else{d=[];var l=a&7;d.length=(a>>3)+1;c.nextBytes(d);d[0]=0<l?d[0]&(1<<l)-1:0;this.fromString(d,256)}};b.prototype.bitwiseTo=function(a,c,b){var d,l,e=Math.min(a.t,this.t);for(d=
369
+c),b=g(c),l=d(),e=d(),h="";for(this.divRemTo(b,l,e);0<l.signum();)h=(c+e.intValue()).toString(a).substr(1)+h,l.divRemTo(b,l,e);return e.intValue().toString(a)+h};b.prototype.fromRadix=function(a,c){this.fromInt(0);null==c&&(c=10);for(var d=this.chunkSize(c),l=Math.pow(c,d),e=!1,g=0,f=0,m=0;m<a.length;++m){var z=h(a,m);0>z?"-"==a.charAt(m)&&0==this.signum()&&(e=!0):(f=c*f+z,++g>=d&&(this.dMultiply(l),this.dAddOffset(f,0),f=g=0))}0<g&&(this.dMultiply(Math.pow(c,g)),this.dAddOffset(f,0));e&&b.ZERO.subTo(this,
370
+this)};b.prototype.fromNumber=function(a,c,d){if("number"==typeof c)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(b.ONE.shiftLeft(a-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(c);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(b.ONE.shiftLeft(a-1),this);else{d=[];var l=a&7;d.length=(a>>3)+1;c.nextBytes(d);d[0]=0<l?d[0]&(1<<l)-1:0;this.fromString(d,256)}};b.prototype.bitwiseTo=function(a,c,b){var d,l,e=Math.min(a.t,this.t);for(d=
371
0;d<e;++d)b.data[d]=c(this.data[d],a.data[d]);if(a.t<this.t){l=a.s&this.DM;for(d=e;d<this.t;++d)b.data[d]=c(this.data[d],l);b.t=this.t}else{l=this.s&this.DM;for(d=e;d<a.t;++d)b.data[d]=c(l,a.data[d]);b.t=a.t}b.s=c(this.s,a.s);b.clamp()};b.prototype.changeBit=function(a,c){var d=b.ONE.shiftLeft(a);this.bitwiseTo(d,c,d);return d};b.prototype.addTo=function(a,c){for(var b=0,d=0,l=Math.min(a.t,this.t);b<l;)d+=this.data[b]+a.data[b],c.data[b++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;b<this.t;)d+=
372
this.data[b],c.data[b++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;b<a.t;)d+=a.data[b],c.data[b++]=d&this.DM,d>>=this.DB;d+=a.s}c.s=0>d?-1:0;0<d?c.data[b++]=d:-1>d&&(c.data[b++]=this.DV+d);c.t=b;c.clamp()};b.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};b.prototype.dAddOffset=function(a,c){if(0!=a){for(;this.t<=c;)this.data[this.t++]=0;for(this.data[c]+=a;this.data[c]>=this.DV;)this.data[c]-=this.DV,++c>=this.t&&(this.data[this.t++]=
373
0),++this.data[c]}};b.prototype.multiplyLowerTo=function(a,c,b){var d=Math.min(this.t+a.t,c);b.s=0;for(b.t=d;0<d;)b.data[--d]=0;var l;for(l=b.t-this.t;d<l;++d)b.data[d+this.t]=this.am(0,a.data[d],b,d,0,this.t);for(l=Math.min(a.t,c);d<l;++d)this.am(0,a.data[d],b,d,0,c-d);b.clamp()};b.prototype.multiplyUpperTo=function(a,c,b){--c;var d=b.t=this.t+a.t-c;for(b.s=0;0<=--d;)b.data[d]=0;for(d=Math.max(c-this.t,0);d<a.t;++d)b.data[this.t+d-c]=this.am(c-d,a.data[d],b,0,0,this.t+d-c);b.clamp();b.drShiftTo(1,
374
-b)};b.prototype.modInt=function(a){if(0>=a)return 0;var c=this.DV%a,b=0>this.s?a-1:0;if(0<this.t)if(0==c)b=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)b=(c*b+this.data[d])%a;return b};b.prototype.millerRabin=function(a){var c=this.subtract(b.ONE),d=c.getLowestSetBit();if(0>=d)return!1;for(var l=c.shiftRight(d),e=z(),g,h=0;h<a;++h){do g=new b(this.bitLength(),e);while(0>=g.compareTo(b.ONE)||0<=g.compareTo(c));g=g.modPow(l,this);if(0!=g.compareTo(b.ONE)&&0!=g.compareTo(c)){for(var f=1;f++<d&&0!=
374
+b)};b.prototype.modInt=function(a){if(0>=a)return 0;var c=this.DV%a,b=0>this.s?a-1:0;if(0<this.t)if(0==c)b=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)b=(c*b+this.data[d])%a;return b};b.prototype.millerRabin=function(a){var c=this.subtract(b.ONE),d=c.getLowestSetBit();if(0>=d)return!1;for(var l=c.shiftRight(d),e=x(),g,h=0;h<a;++h){do g=new b(this.bitLength(),e);while(0>=g.compareTo(b.ONE)||0<=g.compareTo(c));g=g.modPow(l,this);if(0!=g.compareTo(b.ONE)&&0!=g.compareTo(c)){for(var f=1;f++<d&&0!=
375
g.compareTo(c);)if(g=g.modPowInt(2,this),0==g.compareTo(b.ONE))return!1;if(0!=g.compareTo(c))return!1}}return!0};b.prototype.clone=function(){var a=d();this.copyTo(a);return a};b.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};b.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};b.prototype.shortValue=
376
function(){return 0==this.t?this.s:this.data[0]<<16>>16};b.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};b.prototype.toByteArray=function(){var a=this.t,c=[];c[0]=this.s;var b=this.DB-a*this.DB%8,d,l=0;if(0<a--)for(b<this.DB&&(d=this.data[a]>>b)!=(this.s&this.DM)>>b&&(c[l++]=d|this.s<<this.DB-b);0<=a;)if(8>b?(d=(this.data[a]&(1<<b)-1)<<8-b,d|=this.data[--a]>>(b+=this.DB-8)):(d=this.data[a]>>(b-=8)&255,0>=b&&(b+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==l&&
377
-(this.s&128)!=(d&128)&&++l,0<l||d!=this.s)c[l++]=d;return c};b.prototype.equals=function(a){return 0==this.compareTo(a)};b.prototype.min=function(a){return 0>this.compareTo(a)?this:a};b.prototype.max=function(a){return 0<this.compareTo(a)?this:a};b.prototype.and=function(a){var c=d();this.bitwiseTo(a,x,c);return c};b.prototype.or=function(a){var c=d();this.bitwiseTo(a,w,c);return c};b.prototype.xor=function(a){var c=d();this.bitwiseTo(a,r,c);return c};b.prototype.andNot=function(a){var c=d();this.bitwiseTo(a,
377
+(this.s&128)!=(d&128)&&++l,0<l||d!=this.s)c[l++]=d;return c};b.prototype.equals=function(a){return 0==this.compareTo(a)};b.prototype.min=function(a){return 0>this.compareTo(a)?this:a};b.prototype.max=function(a){return 0<this.compareTo(a)?this:a};b.prototype.and=function(a){var c=d();this.bitwiseTo(a,w,c);return c};b.prototype.or=function(a){var c=d();this.bitwiseTo(a,y,c);return c};b.prototype.xor=function(a){var c=d();this.bitwiseTo(a,r,c);return c};b.prototype.andNot=function(a){var c=d();this.bitwiseTo(a,
378
A,c);return c};b.prototype.not=function(){for(var a=d(),c=0;c<this.t;++c)a.data[c]=this.DM&~this.data[c];a.t=this.t;a.s=~this.s;return a};b.prototype.shiftLeft=function(a){var c=d();0>a?this.rShiftTo(-a,c):this.lShiftTo(a,c);return c};b.prototype.shiftRight=function(a){var c=d();0>a?this.lShiftTo(-a,c):this.rShiftTo(a,c);return c};b.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var c=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var b=0;0==(a&65535)&&(a>>=16,b+=16);
379
-0==(a&255)&&(a>>=8,b+=8);0==(a&15)&&(a>>=4,b+=4);0==(a&3)&&(a>>=2,b+=2);0==(a&1)&&++b;a=b}return c+a}return 0>this.s?this.t*this.DB:-1};b.prototype.bitCount=function(){for(var a=0,c=this.s&this.DM,b=0;b<this.t;++b){for(var d=this.data[b]^c,l=0;0!=d;)d&=d-1,++l;a+=l}return a};b.prototype.testBit=function(a){var c=Math.floor(a/this.DB);return c>=this.t?0!=this.s:0!=(this.data[c]&1<<a%this.DB)};b.prototype.setBit=function(a){return this.changeBit(a,w)};b.prototype.clearBit=function(a){return this.changeBit(a,
379
+0==(a&255)&&(a>>=8,b+=8);0==(a&15)&&(a>>=4,b+=4);0==(a&3)&&(a>>=2,b+=2);0==(a&1)&&++b;a=b}return c+a}return 0>this.s?this.t*this.DB:-1};b.prototype.bitCount=function(){for(var a=0,c=this.s&this.DM,b=0;b<this.t;++b){for(var d=this.data[b]^c,l=0;0!=d;)d&=d-1,++l;a+=l}return a};b.prototype.testBit=function(a){var c=Math.floor(a/this.DB);return c>=this.t?0!=this.s:0!=(this.data[c]&1<<a%this.DB)};b.prototype.setBit=function(a){return this.changeBit(a,y)};b.prototype.clearBit=function(a){return this.changeBit(a,
380
A)};b.prototype.flipBit=function(a){return this.changeBit(a,r)};b.prototype.add=function(a){var c=d();this.addTo(a,c);return c};b.prototype.subtract=function(a){var c=d();this.subTo(a,c);return c};b.prototype.multiply=function(a){var c=d();this.multiplyTo(a,c);return c};b.prototype.divide=function(a){var c=d();this.divRemTo(a,c,null);return c};b.prototype.remainder=function(a){var c=d();this.divRemTo(a,null,c);return c};b.prototype.divideAndRemainder=function(a){var c=d(),b=d();this.divRemTo(a,c,
381
-b);return[c,b]};b.prototype.modPow=function(a,c){var b=a.bitLength(),l,e=g(1),h;if(0>=b)return e;l=18>b?1:48>b?3:144>b?4:768>b?5:6;h=8>b?new m(c):c.isEven()?new C(c):new E(c);var f=[],k=3,y=l-1,q=(1<<l)-1;f[1]=h.convert(this);if(1<l)for(b=d(),h.sqrTo(f[1],b);k<=q;)f[k]=d(),h.mulTo(b,f[k-2],f[k]),k+=2;for(var z=a.t-1,u,n=!0,x=d(),b=p(a.data[z])-1;0<=z;){b>=y?u=a.data[z]>>b-y&q:(u=(a.data[z]&(1<<b+1)-1)<<y-b,0<z&&(u|=a.data[z-1]>>this.DB+b-y));for(k=l;0==(u&1);)u>>=1,--k;0>(b-=k)&&(b+=this.DB,--z);
382
-if(n)f[u].copyTo(e),n=!1;else{for(;1<k;)h.sqrTo(e,x),h.sqrTo(x,e),k-=2;0<k?h.sqrTo(e,x):(k=e,e=x,x=k);h.mulTo(x,f[u],e)}for(;0<=z&&0==(a.data[z]&1<<b);)h.sqrTo(e,x),k=e,e=x,x=k,0>--b&&(b=this.DB-1,--z)}return h.revert(e)};b.prototype.modInverse=function(a){var c=a.isEven();if(this.isEven()&&c||0==a.signum())return b.ZERO;for(var d=a.clone(),l=this.clone(),e=g(1),h=g(0),f=g(0),m=g(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),c?(e.isEven()&&h.isEven()||(e.addTo(this,e),h.subTo(a,h)),e.rShiftTo(1,
381
+b);return[c,b]};b.prototype.modPow=function(a,c){var b=a.bitLength(),l,e=g(1),h;if(0>=b)return e;l=18>b?1:48>b?3:144>b?4:768>b?5:6;h=8>b?new m(c):c.isEven()?new D(c):new F(c);var f=[],k=3,z=l-1,q=(1<<l)-1;f[1]=h.convert(this);if(1<l)for(b=d(),h.sqrTo(f[1],b);k<=q;)f[k]=d(),h.mulTo(b,f[k-2],f[k]),k+=2;for(var x=a.t-1,u,n=!0,w=d(),b=p(a.data[x])-1;0<=x;){b>=z?u=a.data[x]>>b-z&q:(u=(a.data[x]&(1<<b+1)-1)<<z-b,0<x&&(u|=a.data[x-1]>>this.DB+b-z));for(k=l;0==(u&1);)u>>=1,--k;0>(b-=k)&&(b+=this.DB,--x);
382
+if(n)f[u].copyTo(e),n=!1;else{for(;1<k;)h.sqrTo(e,w),h.sqrTo(w,e),k-=2;0<k?h.sqrTo(e,w):(k=e,e=w,w=k);h.mulTo(w,f[u],e)}for(;0<=x&&0==(a.data[x]&1<<b);)h.sqrTo(e,w),k=e,e=w,w=k,0>--b&&(b=this.DB-1,--x)}return h.revert(e)};b.prototype.modInverse=function(a){var c=a.isEven();if(this.isEven()&&c||0==a.signum())return b.ZERO;for(var d=a.clone(),l=this.clone(),e=g(1),h=g(0),f=g(0),m=g(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),c?(e.isEven()&&h.isEven()||(e.addTo(this,e),h.subTo(a,h)),e.rShiftTo(1,
383
e)):h.isEven()||h.subTo(a,h),h.rShiftTo(1,h);for(;l.isEven();)l.rShiftTo(1,l),c?(f.isEven()&&m.isEven()||(f.addTo(this,f),m.subTo(a,m)),f.rShiftTo(1,f)):m.isEven()||m.subTo(a,m),m.rShiftTo(1,m);0<=d.compareTo(l)?(d.subTo(l,d),c&&e.subTo(f,e),h.subTo(m,h)):(l.subTo(d,l),c&&f.subTo(e,f),m.subTo(h,m))}if(0!=l.compareTo(b.ONE))return b.ZERO;if(0<=m.compareTo(a))return m.subtract(a);if(0>m.signum())m.addTo(a,m);else return m;return 0>m.signum()?m.add(a):m};b.prototype.pow=function(a){return this.exp(a,
384
-new J)};b.prototype.gcd=function(a){var c=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>c.compareTo(a)){var b=c,c=a;a=b}var b=c.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return c;b<d&&(d=b);0<d&&(c.rShiftTo(d,c),a.rShiftTo(d,a));for(;0<c.signum();)0<(b=c.getLowestSetBit())&&c.rShiftTo(b,c),0<(b=a.getLowestSetBit())&&a.rShiftTo(b,a),0<=c.compareTo(a)?(c.subTo(a,c),c.rShiftTo(1,c)):(a.subTo(c,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};b.prototype.isProbablePrime=
384
+new L)};b.prototype.gcd=function(a){var c=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>c.compareTo(a)){var b=c,c=a;a=b}var b=c.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return c;b<d&&(d=b);0<d&&(c.rShiftTo(d,c),a.rShiftTo(d,a));for(;0<c.signum();)0<(b=c.getLowestSetBit())&&c.rShiftTo(b,c),0<(b=a.getLowestSetBit())&&a.rShiftTo(b,a),0<=c.compareTo(a)?(c.subTo(a,c),c.rShiftTo(1,c)):(a.subTo(c,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};b.prototype.isProbablePrime=
385
function(a){var c,b=this.abs();if(1==b.t&&b.data[0]<=O[O.length-1]){for(c=0;c<O.length;++c)if(b.data[0]==O[c])return!0;return!1}if(b.isEven())return!1;for(c=1;c<O.length;){for(var d=O[c],l=c+1;l<O.length&&d<M;)d*=O[l++];for(d=b.modInt(d);c<l;)if(0==d%O[c++])return!1}return b.millerRabin(a)};c.jsbn=c.jsbn||{};c.jsbn.BigInteger=b}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,
386
p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.jsbn)return b.jsbn;b.defined.jsbn=!0;for(var f=0;f<e.length;++f)e[f](b);return b.jsbn}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/jsbn",["require","module"],function(){p.apply(null,Array.prototype.slice.call(arguments,
387
-0))})})();(function(){function a(c){function b(a,d,f){f||(f=c.md.sha1.create());for(var h="",g=Math.ceil(d/f.digestLength),k=0;k<g;++k){var m=String.fromCharCode(k>>24&255,k>>16&255,k>>8&255,k&255);f.start();f.update(a+m);h+=f.digest().getBytes()}return h.substring(0,d)}var d=c.pkcs1=c.pkcs1||{};d.encode_rsa_oaep=function(a,d,f,h,g){var v,m,n,x;"string"===typeof f?(v=f,m=h||void 0,n=g||void 0):f&&(v=f.label||void 0,m=f.seed||void 0,n=f.md||void 0,f.mgf1&&f.mgf1.md&&(x=f.mgf1.md));n?n.start():n=c.md.sha1.create();
388
-x||(x=n);a=Math.ceil(a.n.bitLength()/8);f=a-2*n.digestLength-2;if(d.length>f)throw x=Error("RSAES-OAEP input message length is too long."),x.length=d.length,x.maxLength=f,x;v||(v="");n.update(v,"raw");v=n.digest();h="";f-=d.length;for(g=0;g<f;g++)h+="\x00";d=v.getBytes()+h+"\u0001"+d;if(!m)m=c.random.getBytes(n.digestLength);else if(m.length!==n.digestLength)throw x=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),x.seedLength=m.length,x.digestLength=n.digestLength,
389
-x;a=b(m,a-n.digestLength-1,x);d=c.util.xorBytes(d,a,d.length);n=b(d,n.digestLength,x);return"\x00"+c.util.xorBytes(m,n,m.length)+d};d.decode_rsa_oaep=function(a,d,f,h){var g,v,m;"string"===typeof f?(g=f,v=h||void 0):f&&(g=f.label||void 0,v=f.md||void 0,f.mgf1&&f.mgf1.md&&(m=f.mgf1.md));f=Math.ceil(a.n.bitLength()/8);if(d.length!==f)throw m=Error("RSAES-OAEP encoded message length is invalid."),m.length=d.length,m.expectedLength=f,m;void 0===v?v=c.md.sha1.create():v.start();m||(m=v);if(f<2*v.digestLength+
387
+0))})})();(function(){function a(c){function b(a,d,f){f||(f=c.md.sha1.create());for(var h="",g=Math.ceil(d/f.digestLength),k=0;k<g;++k){var m=String.fromCharCode(k>>24&255,k>>16&255,k>>8&255,k&255);f.start();f.update(a+m);h+=f.digest().getBytes()}return h.substring(0,d)}var d=c.pkcs1=c.pkcs1||{};d.encode_rsa_oaep=function(a,d,f,h,g){var v,m,n,w;"string"===typeof f?(v=f,m=h||void 0,n=g||void 0):f&&(v=f.label||void 0,m=f.seed||void 0,n=f.md||void 0,f.mgf1&&f.mgf1.md&&(w=f.mgf1.md));n?n.start():n=c.md.sha1.create();
388
+w||(w=n);a=Math.ceil(a.n.bitLength()/8);f=a-2*n.digestLength-2;if(d.length>f)throw w=Error("RSAES-OAEP input message length is too long."),w.length=d.length,w.maxLength=f,w;v||(v="");n.update(v,"raw");v=n.digest();h="";f-=d.length;for(g=0;g<f;g++)h+="\x00";d=v.getBytes()+h+"\u0001"+d;if(!m)m=c.random.getBytes(n.digestLength);else if(m.length!==n.digestLength)throw w=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),w.seedLength=m.length,w.digestLength=n.digestLength,
389
+w;a=b(m,a-n.digestLength-1,w);d=c.util.xorBytes(d,a,d.length);n=b(d,n.digestLength,w);return"\x00"+c.util.xorBytes(m,n,m.length)+d};d.decode_rsa_oaep=function(a,d,f,h){var g,v,m;"string"===typeof f?(g=f,v=h||void 0):f&&(g=f.label||void 0,v=f.md||void 0,f.mgf1&&f.mgf1.md&&(m=f.mgf1.md));f=Math.ceil(a.n.bitLength()/8);if(d.length!==f)throw m=Error("RSAES-OAEP encoded message length is invalid."),m.length=d.length,m.expectedLength=f,m;void 0===v?v=c.md.sha1.create():v.start();m||(m=v);if(f<2*v.digestLength+
390
2)throw Error("RSAES-OAEP key is too short for the hash function.");g||(g="");v.update(g,"raw");g=v.digest().getBytes();a=d.charAt(0);h=d.substring(1,v.digestLength+1);d=d.substring(1+v.digestLength);var n=b(d,v.digestLength,m);h=c.util.xorBytes(h,n,h.length);m=b(h,f-v.digestLength-1,m);d=c.util.xorBytes(d,m,d.length);f=d.substring(0,v.digestLength);m="\x00"!==a;for(a=0;a<v.digestLength;++a)m|=g.charAt(a)!==f.charAt(a);g=1;for(v=a=v.digestLength;v<d.length;v++)f=d.charCodeAt(v),h=f&1^1,m|=f&(g?65534:
391
0),g&=h,a+=g;if(m||1!==d.charCodeAt(a))throw Error("Invalid RSAES-OAEP padding.");return d.substring(a+1)}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pkcs1)return b.pkcs1;b.defined.pkcs1=!0;for(var f=0;f<e.length;++f)e[f](b);return b.pkcs1}},
392
r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pkcs1",["require","module","./util","./random","./sha1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,l,g){return"workers"in l?e(a,c,l,g):d(a,c,l,g)}function d(a,b,e,g){var h=f(a,b),k=0,m=n(h.bitLength());"millerRabinTests"in
393
-e&&(m=e.millerRabinTests);var z=10;"maxBlockTime"in e&&(z=e.maxBlockTime);var G=+new Date;do{h.bitLength()>a&&(h=f(a,b));if(h.isProbablePrime(m))return g(null,h);h.dAddOffset(p[k++%8],0)}while(0>z||+new Date-G<z);c.util.setImmediate(function(){d(a,b,e,g)})}function e(a,b,e,h){function k(){function c(l){if(!v){--e;var k=l.data;if(k.found){for(l=0;l<d.length;++l)d[l].terminate();v=!0;return h(null,new g(k.prime,16))}m.bitLength()>a&&(m=f(a,b));k=m.toString(16);l.target.postMessage({hex:k,workLoad:z});
394
-m.dAddOffset(n,0)}}C=Math.max(1,C);for(var d=[],l=0;l<C;++l)d[l]=new Worker(p);for(var e=C,l=0;l<C;++l)d[l].addEventListener("message",c);var v=!1}if("undefined"===typeof Worker)return d(a,b,e,h);var m=f(a,b),C=e.workers,z=e.workLoad||100,n=30*z/8,p=e.workerScript||"forge/prime.worker.js";if(-1===C)return c.util.estimateCores(function(a,c){a&&(c=2);C=c-1;k()});k()}function f(a,c){var b=new g(a,c),d=a-1;b.testBit(d)||b.bitwiseTo(g.ONE.shiftLeft(d),r,b);b.dAddOffset(31-b.mod(m).byteValue(),0);return b}
393
+e&&(m=e.millerRabinTests);var x=10;"maxBlockTime"in e&&(x=e.maxBlockTime);var G=+new Date;do{h.bitLength()>a&&(h=f(a,b));if(h.isProbablePrime(m))return g(null,h);h.dAddOffset(p[k++%8],0)}while(0>x||+new Date-G<x);c.util.setImmediate(function(){d(a,b,e,g)})}function e(a,b,e,h){function k(){function c(l){if(!v){--e;var k=l.data;if(k.found){for(l=0;l<d.length;++l)d[l].terminate();v=!0;return h(null,new g(k.prime,16))}m.bitLength()>a&&(m=f(a,b));k=m.toString(16);l.target.postMessage({hex:k,workLoad:x});
394
+m.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],l=0;l<D;++l)d[l]=new Worker(p);for(var e=D,l=0;l<D;++l)d[l].addEventListener("message",c);var v=!1}if("undefined"===typeof Worker)return d(a,b,e,h);var m=f(a,b),D=e.workers,x=e.workLoad||100,n=30*x/8,p=e.workerScript||"forge/prime.worker.js";if(-1===D)return c.util.estimateCores(function(a,c){a&&(c=2);D=c-1;k()});k()}function f(a,c){var b=new g(a,c),d=a-1;b.testBit(d)||b.bitwiseTo(g.ONE.shiftLeft(d),r,b);b.dAddOffset(31-b.mod(m).byteValue(),0);return b}
395
function n(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!c.prime){var h=c.prime=c.prime||{},g=c.jsbn.BigInteger,p=[6,4,2,4,2,4,6,2],m=new g(null);m.fromInt(30);var r=function(a,c){return a|c};h.generateProbablePrime=function(a,d,e){"function"===typeof d&&(e=d,d={});d=d||{};var g=d.algorithm||"PRIMEINC";"string"===typeof g&&(g={name:g});g.options=g.options||{};var h=d.prng||c.random;d={nextBytes:function(a){for(var c=h.getBytesSync(a.length),
396
b=0;b<a.length;++b)a[b]=c.charCodeAt(b)}};if("PRIMEINC"===g.name)return b(a,d,g.options,e);throw Error("Invalid prime generation algorithm: "+g.name);}}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.prime)return b.prime;b.defined.prime=!0;for(var f=
397
0;f<e.length;++f)e[f](b);return b.prime}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/prime",["require","module","./util","./jsbn","./random"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,d,e){var g=c.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(a.length>d-11)throw g=
@@ -400,15 +400,15 @@ typeof g)throw Error("Encryption block is invalid.");e=0;if(0===f)for(e=b-3-g,g=
400
a.q);g(a.qBits,f)})}function g(a,b){c.prime.generateProbablePrime(a,k,b)}function f(c,b){if(c)return d(c);a.q=b;if(0>a.p.compareTo(a.q)){var l=a.p;a.p=a.q;a.q=l}0!==a.p.subtract(h.ONE).gcd(a.e).compareTo(h.ONE)?(a.p=null,e()):0!==a.q.subtract(h.ONE).gcd(a.e).compareTo(h.ONE)?(a.q=null,g(a.qBits,f)):(a.p1=a.p.subtract(h.ONE),a.q1=a.q.subtract(h.ONE),a.phi=a.p1.multiply(a.q1),0!==a.phi.gcd(a.e).compareTo(h.ONE)?(a.p=a.q=null,e()):(a.n=a.p.multiply(a.q),a.n.bitLength()!==a.bits?(a.q=null,g(a.qBits,f)):
401
(l=a.e.modInverse(a.phi),a.keys={privateKey:p.rsa.setPrivateKey(a.n,a.e,l,a.p,a.q,l.mod(a.p1),l.mod(a.q1),a.q.modInverse(a.p)),publicKey:p.rsa.setPublicKey(a.n,a.e)},d(null,a.keys))))}"function"===typeof b&&(d=b,b={});b=b||{};var k={algorithm:{name:b.algorithm||"PRIMEINC",options:{workers:b.workers||2,workLoad:b.workLoad||100,workerScript:b.workerScript}}};"prng"in b&&(k.prng=b.prng);e()}function f(a){a=a.toString(16);"8"<=a[0]&&(a="00"+a);return c.util.hexToBytes(a)}function n(a){return 100>=a?27:
402
150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if("undefined"===typeof h)var h=c.jsbn.BigInteger;var g=c.asn1;c.pki=c.pki||{};c.pki.rsa=c.rsa=c.rsa||{};var p=c.pki,m=[6,4,2,4,2,4,6,2],r={name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:g.Class.UNIVERSAL,
403
-type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},x={name:"RSAPrivateKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",
403
+type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},w={name:"RSAPrivateKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",
404
tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",
405
-tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},w={name:"RSAPublicKey",tagClass:g.Class.UNIVERSAL,
406
-type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},F=c.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,
405
+tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},y={name:"RSAPublicKey",tagClass:g.Class.UNIVERSAL,
406
+type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},C=c.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,
407
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},A=function(a){var c;if(a.algorithm in p.oids)c=p.oids[a.algorithm];
408
-else throw c=Error("Unknown message digest algorithm."),c.algorithm=a.algorithm,c;var b=g.oidToDer(c).getBytes();c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);var d=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);d.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,b));d.value.push(g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,""));a=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,a.digest().getBytes());c.value.push(d);c.value.push(a);return g.toDer(c).getBytes()},J=function(a,b,d){if(d)return a.modPow(b.e,
408
+else throw c=Error("Unknown message digest algorithm."),c.algorithm=a.algorithm,c;var b=g.oidToDer(c).getBytes();c=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);var d=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);d.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,b));d.value.push(g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,""));a=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,a.digest().getBytes());c.value.push(d);c.value.push(a);return g.toDer(c).getBytes()},L=function(a,b,d){if(d)return a.modPow(b.e,
409
b.n);if(!b.p||!b.q)return a.modPow(b.d,b.n);b.dP||(b.dP=b.d.mod(b.p.subtract(h.ONE)));b.dQ||(b.dQ=b.d.mod(b.q.subtract(h.ONE)));b.qInv||(b.qInv=b.q.modInverse(b.p));do d=new h(c.util.bytesToHex(c.random.getBytes(b.n.bitLength()/8)),16);while(0<=d.compareTo(b.n)||!d.gcd(b.n).equals(h.ONE));a=a.multiply(d.modPow(b.e,b.n)).mod(b.n);var e=a.mod(b.p).modPow(b.dP,b.p);for(a=a.mod(b.q).modPow(b.dQ,b.q);0>e.compareTo(a);)e=e.add(b.p);a=e.subtract(a).multiply(b.qInv).mod(b.p).multiply(b.q).add(a);return a=
410
-a.multiply(d.modInverse(b.n)).mod(b.n)};p.rsa.encrypt=function(a,d,e){var g=e,f=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=b(a,d,e)):(e=c.util.createBuffer(),e.putBytes(a));a=new h(e.toHex(),16);d=J(a,d,g).toString(16);g=c.util.createBuffer();for(f-=Math.ceil(d.length/2);0<f;)g.putByte(0),--f;g.putBytes(c.util.hexToBytes(d));return g.getBytes()};p.rsa.decrypt=function(a,b,e,g){var f=Math.ceil(b.n.bitLength()/8);if(a.length!==f)throw b=Error("Encrypted message length is invalid."),b.length=
411
-a.length,b.expected=f,b;a=new h(c.util.createBuffer(a).toHex(),16);if(0<=a.compareTo(b.n))throw Error("Encrypted message is invalid.");a=J(a,b,e).toString(16);for(var k=c.util.createBuffer(),f=f-Math.ceil(a.length/2);0<f;)k.putByte(0),--f;k.putBytes(c.util.hexToBytes(a));return!1!==g?d(k.getBytes(),b,e):k.getBytes()};p.rsa.createKeyPairGenerationState=function(a,b,d){"string"===typeof a&&(a=parseInt(a,10));a=a||2048;d=d||{};var e=d.prng||c.random,g={nextBytes:function(a){for(var c=e.getBytesSync(a.length),
410
+a.multiply(d.modInverse(b.n)).mod(b.n)};p.rsa.encrypt=function(a,d,e){var g=e,f=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(g=2===e,e=b(a,d,e)):(e=c.util.createBuffer(),e.putBytes(a));a=new h(e.toHex(),16);d=L(a,d,g).toString(16);g=c.util.createBuffer();for(f-=Math.ceil(d.length/2);0<f;)g.putByte(0),--f;g.putBytes(c.util.hexToBytes(d));return g.getBytes()};p.rsa.decrypt=function(a,b,e,g){var f=Math.ceil(b.n.bitLength()/8);if(a.length!==f)throw b=Error("Encrypted message length is invalid."),b.length=
411
+a.length,b.expected=f,b;a=new h(c.util.createBuffer(a).toHex(),16);if(0<=a.compareTo(b.n))throw Error("Encrypted message is invalid.");a=L(a,b,e).toString(16);for(var k=c.util.createBuffer(),f=f-Math.ceil(a.length/2);0<f;)k.putByte(0),--f;k.putBytes(c.util.hexToBytes(a));return!1!==g?d(k.getBytes(),b,e):k.getBytes()};p.rsa.createKeyPairGenerationState=function(a,b,d){"string"===typeof a&&(a=parseInt(a,10));a=a||2048;d=d||{};var e=d.prng||c.random,g={nextBytes:function(a){for(var c=e.getBytesSync(a.length),
412
b=0;b<a.length;++b)a[b]=c.charCodeAt(b)}};d=d.algorithm||"PRIMEINC";if("PRIMEINC"===d)a={algorithm:d,state:0,bits:a,rng:g,eInt:b||65537,e:new h(null),p:null,q:null,qBits:a>>1,pBits:a-(a>>1),pqState:0,num:null,keys:null},a.e.fromInt(a.eInt);else throw Error("Invalid key generation algorithm: "+d);return a};p.rsa.stepKeyPairGenerationState=function(a,c){"algorithm"in a||(a.algorithm="PRIMEINC");var b=new h(null);b.fromInt(30);for(var d=0,l=function(a,c){return a|c},e=+new Date,g,f=0;null===a.keys&&
413
(0>=c||f<c);){if(0===a.state){g=null===a.p?a.pBits:a.qBits;var k=g-1;0===a.pqState?(a.num=new h(g,a.rng),a.num.testBit(k)||a.num.bitwiseTo(h.ONE.shiftLeft(k),l,a.num),a.num.dAddOffset(31-a.num.mod(b).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>g?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(m[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(h.ONE).gcd(a.e).compareTo(h.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
414
null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(h.ONE),a.q1=a.q.subtract(h.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(h.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(g=a.e.modInverse(a.phi),a.keys={privateKey:p.rsa.setPrivateKey(a.n,a.e,g,a.p,a.q,
@@ -417,10 +417,10 @@ b||{};void 0===a&&(a=b.bits||2048);void 0===c&&(c=b.e||65537);var l=p.rsa.create
417
a,e)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(d))d={encode:function(a){return a}};else if("string"===typeof d)throw Error('Unsupported encryption scheme: "'+d+'".');a=d.encode(a,h,!0);return p.rsa.encrypt(a,h,!0)},verify:function(a,c,b){"string"===typeof b?b=b.toUpperCase():void 0===b&&(b="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===b)b={verify:function(a,c){c=d(c,h,!0);var b=g.fromDer(c);return a===b.value[1].value}};else if("NONE"===b||"NULL"===b||null===b)b={verify:function(a,c){c=d(c,
418
h,!0);return a===c}};c=p.rsa.decrypt(c,h,!0,!1);return b.verify(a,c,h.n.bitLength())}};return h};p.setRsaPrivateKey=p.rsa.setPrivateKey=function(a,b,e,g,h,f,k,m){var u={n:a,e:b,d:e,p:g,q:h,dP:f,dQ:k,qInv:m,decrypt:function(a,b,e){"string"===typeof b?b=b.toUpperCase():void 0===b&&(b="RSAES-PKCS1-V1_5");a=p.rsa.decrypt(a,u,!1,!1);if("RSAES-PKCS1-V1_5"===b)b={decode:d};else if("RSA-OAEP"===b||"RSAES-OAEP"===b)b={decode:function(a,b){return c.pkcs1.decode_rsa_oaep(b,a,e)}};else if(-1!==["RAW","NONE",
419
"NULL",null].indexOf(b))b={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+b+'".');return b.decode(a,u,!1)},sign:function(a,c){var b=!1;"string"===typeof c&&(c=c.toUpperCase());if(void 0===c||"RSASSA-PKCS1-V1_5"===c)c={encode:A},b=1;else if("NONE"===c||"NULL"===c||null===c)c={encode:function(){return a}},b=1;var d=c.encode(a,u.n.bitLength());return p.rsa.encrypt(d,u,b)}};return u};p.wrapRsaPrivateKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,
420
-[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(p.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(a).getBytes())])};p.privateKeyFromAsn1=function(a){var b={},d=[];g.validate(a,r,b,d)&&(a=g.fromDer(c.util.createBuffer(b.privateKey)));b={};d=[];if(!g.validate(a,x,b,d))throw b=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
420
+[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(p.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(a).getBytes())])};p.privateKeyFromAsn1=function(a){var b={},d=[];g.validate(a,r,b,d)&&(a=g.fromDer(c.util.createBuffer(b.privateKey)));b={};d=[];if(!g.validate(a,w,b,d))throw b=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
421
b.errors=d,b;var e,f,k,m,u,d=c.util.createBuffer(b.privateKeyModulus).toHex();a=c.util.createBuffer(b.privateKeyPublicExponent).toHex();e=c.util.createBuffer(b.privateKeyPrivateExponent).toHex();f=c.util.createBuffer(b.privateKeyPrime1).toHex();k=c.util.createBuffer(b.privateKeyPrime2).toHex();m=c.util.createBuffer(b.privateKeyExponent1).toHex();u=c.util.createBuffer(b.privateKeyExponent2).toHex();b=c.util.createBuffer(b.privateKeyCoefficient).toHex();return p.setRsaPrivateKey(new h(d,16),new h(a,
422
16),new h(e,16),new h(f,16),new h(k,16),new h(m,16),new h(u,16),new h(b,16))};p.privateKeyToAsn1=p.privateKeyToRSAPrivateKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.p)),g.create(g.Class.UNIVERSAL,
423
-g.Type.INTEGER,!1,f(a.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.qInv))])};p.publicKeyFromAsn1=function(a){var b={},d=[];if(g.validate(a,F,b,d)){d=g.derToOid(b.publicKeyOid);if(d!==p.oids.rsaEncryption)throw b=Error("Cannot read public key. Unknown OID."),b.oid=d,b;a=b.rsaPublicKey}d=[];if(!g.validate(a,w,b,d))throw b=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
423
+g.Type.INTEGER,!1,f(a.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.qInv))])};p.publicKeyFromAsn1=function(a){var b={},d=[];if(g.validate(a,C,b,d)){d=g.derToOid(b.publicKeyOid);if(d!==p.oids.rsaEncryption)throw b=Error("Cannot read public key. Unknown OID."),b.oid=d,b;a=b.rsaPublicKey}d=[];if(!g.validate(a,y,b,d))throw b=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
424
b.errors=d,b;d=c.util.createBuffer(b.publicKeyModulus).toHex();b=c.util.createBuffer(b.publicKeyExponent).toHex();return p.setRsaPublicKey(new h(d,16),new h(b,16))};p.publicKeyToAsn1=p.publicKeyToSubjectPublicKeyInfo=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(p.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,
425
!1,[p.publicKeyToRSAPublicKey(a)])])};p.publicKeyToRSAPublicKey=function(a){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,f(a.e))])}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||
426
{};b.defined=b.defined||{};if(b.defined.rsa)return b.rsa;b.defined.rsa=!0;for(var f=0;f<e.length;++f)e[f](b);return b.rsa}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/rsa","require module ./asn1 ./jsbn ./oids ./pkcs1 ./prime ./random ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,
@@ -428,20 +428,20 @@ c){return a.start().update(c).digest().getBytes()}if("undefined"===typeof d)var
428
{name:"AlgorithmIdentifier.parameters",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},g={name:"PBES2Algorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",
429
tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,onstructed:!0,capture:"kdfIterationCount"}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:e.Class.UNIVERSAL,
430
type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},p={name:"pkcs-12PbeParams",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"salt"},
431
-{name:"pkcs-12PbeParams.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"iterations"}]};f.encryptPrivateKeyInfo=function(a,b,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var g=c.random.getBytesSync(d.saltSize),h=d.count,k=e.integerToDer(h),v;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var y,C;switch(d.algorithm){case "aes128":y=v=16;d=n["aes128-CBC"];C=c.aes.createEncryptionCipher;break;case "aes192":v=24;
432
-y=16;d=n["aes192-CBC"];C=c.aes.createEncryptionCipher;break;case "aes256":v=32;y=16;d=n["aes256-CBC"];C=c.aes.createEncryptionCipher;break;case "des":y=v=8;d=n.desCBC;C=c.des.createEncryptionCipher;break;default:throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;}var z=c.pkcs5.pbkdf2(b,g,h,v);b=c.random.getBytesSync(y);h=C(z);h.start(b);h.update(e.toDer(a));h.finish();a=h.output.getBytes();g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,
431
+{name:"pkcs-12PbeParams.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"iterations"}]};f.encryptPrivateKeyInfo=function(a,b,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var g=c.random.getBytesSync(d.saltSize),h=d.count,k=e.integerToDer(h),v;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var z,D;switch(d.algorithm){case "aes128":z=v=16;d=n["aes128-CBC"];D=c.aes.createEncryptionCipher;break;case "aes192":v=24;
432
+z=16;d=n["aes192-CBC"];D=c.aes.createEncryptionCipher;break;case "aes256":v=32;z=16;d=n["aes256-CBC"];D=c.aes.createEncryptionCipher;break;case "des":z=v=8;d=n.desCBC;D=c.des.createEncryptionCipher;break;default:throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;}var x=c.pkcs5.pbkdf2(b,g,h,v);b=c.random.getBytesSync(z);h=D(x);h.start(b);h.update(e.toDer(a));h.finish();a=h.output.getBytes();g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,
433
e.Type.OID,!1,e.oidToDer(n.pkcs5PBES2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.pkcs5PBKDF2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,g),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,k.getBytes())])]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d).getBytes()),e.create(e.Class.UNIVERSAL,
434
-e.Type.OCTETSTRING,!1,b)])])])}else if("3des"===d.algorithm)v=24,d=new c.util.ByteBuffer(g),z=f.pbe.generatePkcs12Key(b,d,1,h,v),b=f.pbe.generatePkcs12Key(b,d,2,h,v),h=c.des.createEncryptionCipher(z),h.start(b),h.update(e.toDer(a)),h.finish(),a=h.output.getBytes(),g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,
434
+e.Type.OCTETSTRING,!1,b)])])])}else if("3des"===d.algorithm)v=24,d=new c.util.ByteBuffer(g),x=f.pbe.generatePkcs12Key(b,d,1,h,v),b=f.pbe.generatePkcs12Key(b,d,2,h,v),h=c.des.createEncryptionCipher(x),h.start(b),h.update(e.toDer(a)),h.finish(),a=h.output.getBytes(),g=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,
435
!1,g),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,k.getBytes())])]);else throw g=Error("Cannot encrypt private key. Unknown encryption algorithm."),g.algorithm=d.algorithm,g;return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[g,e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,a)])};f.decryptPrivateKeyInfo=function(a,b){var d=null,g={},k=[];if(!e.validate(a,h,g,k))throw d=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;k=e.derToOid(g.encryptionOid);
436
k=f.pbe.getCipher(k,g.encryptionParams,b);g=c.util.createBuffer(g.encryptedData);k.update(g);k.finish()&&(d=e.fromDer(k.output));return d};f.encryptedPrivateKeyToPem=function(a,b){var d={type:"ENCRYPTED PRIVATE KEY",body:e.toDer(a).getBytes()};return c.pem.encode(d,{maxline:b})};f.encryptedPrivateKeyFromPem=function(a){a=c.pem.decode(a)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var b=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');b.headerType=
437
a.type;throw b;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return e.fromDer(a.body)};f.encryptRsaPrivateKey=function(a,b,d){d=d||{};if(!d.legacy)return a=f.wrapRsaPrivateKey(f.privateKeyToAsn1(a)),a=f.encryptPrivateKeyInfo(a,b,d),f.encryptedPrivateKeyToPem(a);var g,h,k;switch(d.algorithm){case "aes128":d="AES-128-CBC";h=16;g=c.random.getBytesSync(16);k=c.aes.createEncryptionCipher;break;case "aes192":d="AES-192-CBC";
438
h=24;g=c.random.getBytesSync(16);k=c.aes.createEncryptionCipher;break;case "aes256":d="AES-256-CBC";h=32;g=c.random.getBytesSync(16);k=c.aes.createEncryptionCipher;break;case "3des":d="DES-EDE3-CBC";h=24;g=c.random.getBytesSync(8);k=c.des.createEncryptionCipher;break;case "des":d="DES-CBC";h=8;g=c.random.getBytesSync(8);k=c.des.createEncryptionCipher;break;default:throw a=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+d.algorithm+'".'),a.algorithm=d.algorithm,a;}b=c.pbe.opensslDeriveBytes(b,
439
g.substr(0,8),h);b=k(b);b.start(g);b.update(e.toDer(f.privateKeyToAsn1(a)));b.finish();a={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:d,parameters:c.util.bytesToHex(g).toUpperCase()},body:b.output.getBytes()};return c.pem.encode(a)};f.decryptRsaPrivateKey=function(a,b){var d=null,g=c.pem.decode(a)[0];if("ENCRYPTED PRIVATE KEY"!==g.type&&"PRIVATE KEY"!==g.type&&"RSA PRIVATE KEY"!==g.type)throw d=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'),
440
d.headerType=d,d;if(g.procType&&"ENCRYPTED"===g.procType.type){var h,k;switch(g.dekInfo.algorithm){case "DES-CBC":h=8;k=c.des.createDecryptionCipher;break;case "DES-EDE3-CBC":h=24;k=c.des.createDecryptionCipher;break;case "AES-128-CBC":h=16;k=c.aes.createDecryptionCipher;break;case "AES-192-CBC":h=24;k=c.aes.createDecryptionCipher;break;case "AES-256-CBC":h=32;k=c.aes.createDecryptionCipher;break;case "RC2-40-CBC":h=5;k=function(a){return c.rc2.createDecryptionCipher(a,40)};break;case "RC2-64-CBC":h=
441
-8;k=function(a){return c.rc2.createDecryptionCipher(a,64)};break;case "RC2-128-CBC":h=16;k=function(a){return c.rc2.createDecryptionCipher(a,128)};break;default:throw d=Error('Could not decrypt private key; unsupported encryption algorithm "'+g.dekInfo.algorithm+'".'),d.algorithm=g.dekInfo.algorithm,d;}var v=c.util.hexToBytes(g.dekInfo.parameters);h=c.pbe.opensslDeriveBytes(b,v.substr(0,8),h);k=k(h);k.start(v);k.update(c.util.createBuffer(g.body));if(k.finish())d=k.output.getBytes();else return d}else d=
442
-g.body;d="ENCRYPTED PRIVATE KEY"===g.type?f.decryptPrivateKeyInfo(e.fromDer(d),b):e.fromDer(d);null!==d&&(d=f.privateKeyFromAsn1(d));return d};f.pbe.generatePkcs12Key=function(a,b,d,g,e,h){var f,k;if("undefined"===typeof h||null===h)h=c.md.sha1.create();var v=h.digestLength,n=h.blockLength,u=new c.util.ByteBuffer,p=new c.util.ByteBuffer;if(null!==a&&void 0!==a){for(k=0;k<a.length;k++)p.putInt16(a.charCodeAt(k));p.putInt16(0)}a=p.length();var q=b.length(),r=new c.util.ByteBuffer;r.fillWithByte(d,n);
443
-var D=n*Math.ceil(q/n);d=new c.util.ByteBuffer;for(k=0;k<D;k++)d.putByte(b.at(k%q));D=n*Math.ceil(a/n);b=new c.util.ByteBuffer;for(k=0;k<D;k++)b.putByte(p.at(k%a));p=d;p.putBuffer(b);b=Math.ceil(e/v);for(d=1;d<=b;d++){D=new c.util.ByteBuffer;D.putBytes(r.bytes());D.putBytes(p.bytes());for(k=0;k<g;k++)h.start(),h.update(D.getBytes()),D=h.digest();var B=new c.util.ByteBuffer;for(k=0;k<n;k++)B.putByte(D.at(k%v));var P=Math.ceil(q/n)+Math.ceil(a/n),L=new c.util.ByteBuffer;for(f=0;f<P;f++){var W=new c.util.ByteBuffer(p.getBytes(n)),
444
-U=511;for(k=B.length()-1;0<=k;k--)U>>=8,U+=B.at(k)+W.at(k),W.setAt(k,U&255);L.putBuffer(W)}p=L;u.putBuffer(D)}u.truncate(u.length()-e);return u};f.pbe.getCipher=function(a,c,b){switch(a){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(a,c,b);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(a,c,b);default:throw c=Error("Cannot read encrypted PBE data block. Unsupported OID."),c.oid=a,c.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
441
+8;k=function(a){return c.rc2.createDecryptionCipher(a,64)};break;case "RC2-128-CBC":h=16;k=function(a){return c.rc2.createDecryptionCipher(a,128)};break;default:throw d=Error('Could not decrypt private key; unsupported encryption algorithm "'+g.dekInfo.algorithm+'".'),d.algorithm=g.dekInfo.algorithm,d;}var n=c.util.hexToBytes(g.dekInfo.parameters);h=c.pbe.opensslDeriveBytes(b,n.substr(0,8),h);k=k(h);k.start(n);k.update(c.util.createBuffer(g.body));if(k.finish())d=k.output.getBytes();else return d}else d=
442
+g.body;d="ENCRYPTED PRIVATE KEY"===g.type?f.decryptPrivateKeyInfo(e.fromDer(d),b):e.fromDer(d);null!==d&&(d=f.privateKeyFromAsn1(d));return d};f.pbe.generatePkcs12Key=function(a,b,d,g,e,h){var f,k;if("undefined"===typeof h||null===h)h=c.md.sha1.create();var n=h.digestLength,v=h.blockLength,u=new c.util.ByteBuffer,p=new c.util.ByteBuffer;if(null!==a&&void 0!==a){for(k=0;k<a.length;k++)p.putInt16(a.charCodeAt(k));p.putInt16(0)}a=p.length();var q=b.length(),r=new c.util.ByteBuffer;r.fillWithByte(d,v);
443
+var E=v*Math.ceil(q/v);d=new c.util.ByteBuffer;for(k=0;k<E;k++)d.putByte(b.at(k%q));E=v*Math.ceil(a/v);b=new c.util.ByteBuffer;for(k=0;k<E;k++)b.putByte(p.at(k%a));p=d;p.putBuffer(b);b=Math.ceil(e/n);for(d=1;d<=b;d++){E=new c.util.ByteBuffer;E.putBytes(r.bytes());E.putBytes(p.bytes());for(k=0;k<g;k++)h.start(),h.update(E.getBytes()),E=h.digest();var B=new c.util.ByteBuffer;for(k=0;k<v;k++)B.putByte(E.at(k%n));var P=Math.ceil(q/v)+Math.ceil(a/v),K=new c.util.ByteBuffer;for(f=0;f<P;f++){var W=new c.util.ByteBuffer(p.getBytes(v)),
444
+U=511;for(k=B.length()-1;0<=k;k--)U>>=8,U+=B.at(k)+W.at(k),W.setAt(k,U&255);K.putBuffer(W)}p=K;u.putBuffer(E)}u.truncate(u.length()-e);return u};f.pbe.getCipher=function(a,c,b){switch(a){case f.oids.pkcs5PBES2:return f.pbe.getCipherForPBES2(a,c,b);case f.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case f.oids["pbewithSHAAnd40BitRC2-CBC"]:return f.pbe.getCipherForPKCS12PBE(a,c,b);default:throw c=Error("Cannot read encrypted PBE data block. Unsupported OID."),c.oid=a,c.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
445
"pbewithSHAAnd40BitRC2-CBC"],c;}};f.pbe.getCipherForPBES2=function(a,b,d){var h={};a=[];if(!e.validate(b,g,h,a)){var k=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");k.errors=a;throw k;}a=e.derToOid(h.kdfOid);if(a!==f.oids.pkcs5PBKDF2)throw k=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),k.oid=a,k.supportedOids=["pkcs5PBKDF2"],k;a=e.derToOid(h.encOid);if(a!==f.oids["aes128-CBC"]&&
446
a!==f.oids["aes192-CBC"]&&a!==f.oids["aes256-CBC"]&&a!==f.oids["des-EDE3-CBC"]&&a!==f.oids.desCBC)throw k=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),k.oid=a,k.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],k;b=h.kdfSalt;var v=c.util.createBuffer(h.kdfIterationCount),v=v.getInt(v.length()<<3),n;switch(f.oids[a]){case "aes128-CBC":n=16;k=c.aes.createDecryptionCipher;break;case "aes192-CBC":n=24;k=c.aes.createDecryptionCipher;break;
447
case "aes256-CBC":n=32;k=c.aes.createDecryptionCipher;break;case "des-EDE3-CBC":n=24;k=c.des.createDecryptionCipher;break;case "desCBC":n=8,k=c.des.createDecryptionCipher}a=c.pkcs5.pbkdf2(d,b,v,n);h=h.encIv;k=k(a);k.start(h);return k};f.pbe.getCipherForPKCS12PBE=function(a,b,d){var g={},h=[];if(!e.validate(b,p,g,h))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=h,d;var h=c.util.createBuffer(g.salt),g=c.util.createBuffer(g.iterations),
@@ -463,10 +463,10 @@ typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){va
463
module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.mgf1)return b.mgf1;b.defined.mgf1=!0;for(var f=0;f<e.length;++f)e[f](b);return b.mgf1}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,
464
Array.prototype.slice.call(arguments,0))};c("js/mgf1",["require","module","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.mgf=c.mgf||{};c.mgf.mgf1=c.mgf1}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||
465
{};if(b.defined.mgf)return b.mgf;b.defined.mgf=!0;for(var f=0;f<e.length;++f)e[f](b);return b.mgf}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/mgf",["require","module","./mgf1"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){(c.pss=c.pss||{}).create=function(a){3===arguments.length&&
466
-(a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var b=a.md,d=a.mgf,f=b.digestLength,n=a.salt||null;"string"===typeof n&&(n=c.util.createBuffer(n));var h;if("saltLength"in a)h=a.saltLength;else if(null!==n)h=n.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==n&&n.length()!==h)throw Error("Given salt length does not match length of given salt.");var g=a.prng||c.random;return{encode:function(a,k){var p,x=k-1,w=Math.ceil(x/8),r=a.digest().getBytes();
467
-if(w<f+h+2)throw Error("Message is too long to encrypt.");var A;A=null===n?g.getBytesSync(h):n.bytes();p=new c.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(r);p.putBytes(A);b.start();b.update(p.getBytes());r=b.digest().getBytes();p=new c.util.ByteBuffer;p.fillWithByte(0,w-h-f-2);p.putByte(1);p.putBytes(A);var J=p.getBytes(),y=w-f-1,C=d.generate(r,y);A="";for(p=0;p<y;p++)A+=String.fromCharCode(J.charCodeAt(p)^C.charCodeAt(p));x=65280>>8*w-x&255;A=String.fromCharCode(A.charCodeAt(0)&~x)+A.substr(1);
468
-return A+r+String.fromCharCode(188)},verify:function(a,g,k){var n;n=k-1;k=Math.ceil(n/8);g=g.substr(-k);if(k<f+h+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(k-1))throw Error("Encoded message does not end in 0xBC.");var p=k-f-1,r=g.substr(0,p);g=g.substr(p,f);var A=65280>>8*k-n&255;if(0!==(r.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var B=d.generate(g,p),y="";for(n=0;n<p;n++)y+=String.fromCharCode(r.charCodeAt(n)^B.charCodeAt(n));
469
-y=String.fromCharCode(y.charCodeAt(0)&~A)+y.substr(1);k=k-f-h-2;for(n=0;n<k;n++)if(0!==y.charCodeAt(n))throw Error("Leftmost octets not zero as expected");if(1!==y.charCodeAt(k))throw Error("Inconsistent PSS signature, 0x01 marker not found");k=y.substr(-h);p=new c.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(a);p.putBytes(k);b.start();b.update(p.getBytes());a=b.digest().getBytes();return g===a}}}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,
466
+(a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var b=a.md,d=a.mgf,f=b.digestLength,n=a.salt||null;"string"===typeof n&&(n=c.util.createBuffer(n));var h;if("saltLength"in a)h=a.saltLength;else if(null!==n)h=n.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==n&&n.length()!==h)throw Error("Given salt length does not match length of given salt.");var g=a.prng||c.random;return{encode:function(a,k){var p,w=k-1,r=Math.ceil(w/8),C=a.digest().getBytes();
467
+if(r<f+h+2)throw Error("Message is too long to encrypt.");var A;A=null===n?g.getBytesSync(h):n.bytes();p=new c.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(C);p.putBytes(A);b.start();b.update(p.getBytes());C=b.digest().getBytes();p=new c.util.ByteBuffer;p.fillWithByte(0,r-h-f-2);p.putByte(1);p.putBytes(A);var L=p.getBytes(),z=r-f-1,D=d.generate(C,z);A="";for(p=0;p<z;p++)A+=String.fromCharCode(L.charCodeAt(p)^D.charCodeAt(p));w=65280>>8*r-w&255;A=String.fromCharCode(A.charCodeAt(0)&~w)+A.substr(1);
468
+return A+C+String.fromCharCode(188)},verify:function(a,g,k){var n;n=k-1;k=Math.ceil(n/8);g=g.substr(-k);if(k<f+h+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==g.charCodeAt(k-1))throw Error("Encoded message does not end in 0xBC.");var p=k-f-1,r=g.substr(0,p);g=g.substr(p,f);var A=65280>>8*k-n&255;if(0!==(r.charCodeAt(0)&A))throw Error("Bits beyond keysize not zero as expected.");var B=d.generate(g,p),z="";for(n=0;n<p;n++)z+=String.fromCharCode(r.charCodeAt(n)^B.charCodeAt(n));
469
+z=String.fromCharCode(z.charCodeAt(0)&~A)+z.substr(1);k=k-f-h-2;for(n=0;n<k;n++)if(0!==z.charCodeAt(n))throw Error("Leftmost octets not zero as expected");if(1!==z.charCodeAt(k))throw Error("Inconsistent PSS signature, 0x01 marker not found");k=z.substr(-h);p=new c.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(a);p.putBytes(k);b.start();b.update(p.getBytes());a=b.digest().getBytes();return g===a}}}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,
470
module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pss)return b.pss;b.defined.pss=!0;for(var f=0;f<e.length;++f)e[f](b);return b.pss}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pss",
471
["require","module","./random","./util"],function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c){"string"===typeof c&&(c={shortName:c});for(var d=null,g,e=0;null===d&&e<a.attributes.length;++e)g=a.attributes[e],c.type&&c.type===g.type?d=g:c.name&&c.name===g.name?d=g:c.shortName&&c.shortName===g.shortName&&(d=g);return d}function d(a){var b=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),e;a=a.attributes;for(var h=0;h<a.length;++h){e=a[h];
472
var f=e.value,k=g.Type.PRINTABLESTRING;"valueTagClass"in e&&(k=e.valueTagClass,k===g.Type.UTF8&&(f=c.util.encodeUtf8(f)));e=g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e.type).getBytes()),g.create(g.Class.UNIVERSAL,k,!1,f)])]);b.value.push(e)}return b}function e(a){for(var c,b=0;b<a.length;++b){c=a[b];"undefined"===typeof c.name&&(c.type&&c.type in p.oids?c.name=p.oids[c.type]:c.shortName&&c.shortName in
@@ -479,22 +479,22 @@ null===d)throw d=Error('Extension "ip" value is not a valid IPv4 or IPv6 address
479
d.extension=a,d;return a}function n(a,c){switch(a){case m["RSASSA-PSS"]:var b=[];void 0!==c.hash.algorithmOid&&b.push(g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(c.hash.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])]));void 0!==c.mgf.algorithmOid&&b.push(g.create(g.Class.CONTEXT_SPECIFIC,1,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,
480
!1,g.oidToDer(c.mgf.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(c.mgf.hash.algorithmOid).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")])])]));void 0!==c.saltLength&&b.push(g.create(g.Class.CONTEXT_SPECIFIC,2,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(c.saltLength).getBytes())]));return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,b);default:return g.create(g.Class.UNIVERSAL,g.Type.NULL,
481
!1,"")}}function h(a){var b=g.create(g.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===a.attributes.length)return b;a=a.attributes;for(var d=0;d<a.length;++d){var e=a[d],h=e.value,f=g.Type.UTF8;"valueTagClass"in e&&(f=e.valueTagClass);f===g.Type.UTF8&&(h=c.util.encodeUtf8(h));var k=!1;"valueConstructed"in e&&(k=e.valueConstructed);e=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(e.type).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SET,!0,[g.create(g.Class.UNIVERSAL,
482
-f,k,h)])]);b.value.push(e)}return b}var g=c.asn1,p=c.pki=c.pki||{},m=p.oids,r={};r.CN=m.commonName;r.commonName="CN";r.C=m.countryName;r.countryName="C";r.L=m.localityName;r.localityName="L";r.ST=m.stateOrProvinceName;r.stateOrProvinceName="ST";r.O=m.organizationName;r.organizationName="O";r.OU=m.organizationalUnitName;r.organizationalUnitName="OU";r.E=m.emailAddress;r.emailAddress="E";var x=c.pki.rsa.publicKeyValidator,w={name:"Certificate",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,
482
+f,k,h)])]);b.value.push(e)}return b}var g=c.asn1,p=c.pki=c.pki||{},m=p.oids,r={};r.CN=m.commonName;r.commonName="CN";r.C=m.countryName;r.countryName="C";r.L=m.localityName;r.localityName="L";r.ST=m.stateOrProvinceName;r.stateOrProvinceName="ST";r.O=m.organizationName;r.organizationName="O";r.OU=m.organizationalUnitName;r.organizationalUnitName="OU";r.E=m.emailAddress;r.emailAddress="E";var w=c.pki.rsa.publicKeyValidator,y={name:"Certificate",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,
483
value:[{name:"Certificate.TBSCertificate",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,
484
capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,
485
constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:g.Class.UNIVERSAL,type:g.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:g.Class.UNIVERSAL,type:g.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},
486
-{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:g.Class.UNIVERSAL,type:g.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:g.Class.UNIVERSAL,type:g.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},x,{name:"Certificate.TBSCertificate.issuerUniqueID",
486
+{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:g.Class.UNIVERSAL,type:g.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:g.Class.UNIVERSAL,type:g.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},w,{name:"Certificate.TBSCertificate.issuerUniqueID",
487
tagClass:g.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:g.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certSubjectUniqueId"}]},
488
{name:"Certificate.TBSCertificate.extensions",tagClass:g.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},
489
-{name:"Certificate.signatureValue",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},F={name:"rsapss",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,
489
+{name:"Certificate.signatureValue",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},C={name:"rsapss",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,
490
type:g.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:g.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:g.Class.UNIVERSAL,
491
type:g.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:g.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:g.Class.UNIVERSAL,type:g.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:g.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",
492
tagClass:g.Class.UNIVERSAL,type:g.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},A={name:"CertificationRequest",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
493
-tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},x,{name:"CertificationRequestInfo.attributes",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
493
+tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},w,{name:"CertificationRequestInfo.attributes",tagClass:g.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
494
tagClass:g.Class.UNIVERSAL,type:g.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:g.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:g.Class.UNIVERSAL,
495
type:g.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};p.RDNAttributesAsArray=function(a,c){for(var b=[],d,e,h,l=0;l<a.value.length;++l){d=a.value[l];for(var f=0;f<d.value.length;++f)h={},e=d.value[f],h.type=g.derToOid(e.value[0].value),h.value=e.value[1].value,h.valueTagClass=e.value[1].type,h.type in m&&(h.name=m[h.type],h.name in r&&(h.shortName=r[h.name])),c&&(c.update(h.type),c.update(h.value)),b.push(h)}return b};p.CRIAttributesAsArray=function(a){for(var c=[],b=0;b<a.length;++b)for(var d=
496
-a[b],e=g.derToOid(d.value[0].value),d=d.value[1].value,h=0;h<d.length;++h){var l={};l.type=e;l.value=d[h].value;l.valueTagClass=d[h].type;l.type in m&&(l.name=m[l.type],l.name in r&&(l.shortName=r[l.name]));if(l.type===m.extensionRequest){l.extensions=[];for(var f=0;f<l.value.length;++f)l.extensions.push(p.certificateExtensionFromAsn1(l.value[f]))}c.push(l)}return c};var J=function(a,c,b){var d={};if(a!==m["RSASSA-PSS"])return d;b&&(d={hash:{algorithmOid:m.sha1},mgf:{algorithmOid:m.mgf1,hash:{algorithmOid:m.sha1}},
497
-saltLength:20});b={};a=[];if(!g.validate(c,F,b,a))throw c=Error("Cannot read RSASSA-PSS parameter block."),c.errors=a,c;void 0!==b.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=g.derToOid(b.hashOid));void 0!==b.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=g.derToOid(b.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=g.derToOid(b.maskGenHashOid));void 0!==b.saltLength&&(d.saltLength=b.saltLength.charCodeAt(0));return d};p.certificateFromPem=function(a,b,d){a=c.pem.decode(a)[0];if("CERTIFICATE"!==
496
+a[b],e=g.derToOid(d.value[0].value),d=d.value[1].value,h=0;h<d.length;++h){var l={};l.type=e;l.value=d[h].value;l.valueTagClass=d[h].type;l.type in m&&(l.name=m[l.type],l.name in r&&(l.shortName=r[l.name]));if(l.type===m.extensionRequest){l.extensions=[];for(var f=0;f<l.value.length;++f)l.extensions.push(p.certificateExtensionFromAsn1(l.value[f]))}c.push(l)}return c};var L=function(a,c,b){var d={};if(a!==m["RSASSA-PSS"])return d;b&&(d={hash:{algorithmOid:m.sha1},mgf:{algorithmOid:m.mgf1,hash:{algorithmOid:m.sha1}},
497
+saltLength:20});b={};a=[];if(!g.validate(c,C,b,a))throw c=Error("Cannot read RSASSA-PSS parameter block."),c.errors=a,c;void 0!==b.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=g.derToOid(b.hashOid));void 0!==b.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=g.derToOid(b.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=g.derToOid(b.maskGenHashOid));void 0!==b.saltLength&&(d.saltLength=b.saltLength.charCodeAt(0));return d};p.certificateFromPem=function(a,b,d){a=c.pem.decode(a)[0];if("CERTIFICATE"!==
498
a.type&&"X509 CERTIFICATE"!==a.type&&"TRUSTED CERTIFICATE"!==a.type)throw b=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),b.headerType=a.type,b;if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=g.fromDer(a.body,d);return p.certificateFromAsn1(d,b)};p.certificateToPem=function(a,b){var d={type:"CERTIFICATE",body:g.toDer(p.certificateToAsn1(a)).getBytes()};
499
return c.pem.encode(d,{maxline:b})};p.publicKeyFromPem=function(a){a=c.pem.decode(a)[0];if("PUBLIC KEY"!==a.type&&"RSA PUBLIC KEY"!==a.type){var b=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');b.headerType=a.type;throw b;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");a=g.fromDer(a.body);return p.publicKeyFromAsn1(a)};p.publicKeyToPem=function(a,b){var d={type:"PUBLIC KEY",
500
body:g.toDer(p.publicKeyToAsn1(a)).getBytes()};return c.pem.encode(d,{maxline:b})};p.publicKeyToRSAPublicKeyPem=function(a,b){var d={type:"RSA PUBLIC KEY",body:g.toDer(p.publicKeyToRSAPublicKey(a)).getBytes()};return c.pem.encode(d,{maxline:b})};p.getPublicKeyFingerprint=function(a,b){b=b||{};var d=b.md||c.md.sha1.create(),e;switch(b.type||"RSAPublicKey"){case "RSAPublicKey":e=g.toDer(p.publicKeyToRSAPublicKey(a)).getBytes();break;case "SubjectPublicKeyInfo":e=g.toDer(p.publicKeyToAsn1(a)).getBytes();
@@ -507,8 +507,8 @@ e.expectedIssuer=b.issuer.attributes;e.actualIssuer=d.attributes;throw e;}e=b.md
507
e.signatureOid=b.signatureOid,e;var h=b.tbsCertificate||p.getTBSCertificate(b),h=g.toDer(h);e.update(h.getBytes())}if(null!==e){var f;switch(b.signatureOid){case m.sha1WithRSAEncryption:f=void 0;break;case m["RSASSA-PSS"]:d=m[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===d||void 0===c.md[d])throw e=Error("Unsupported MGF hash function."),e.oid=b.signatureParameters.mgf.hash.algorithmOid,e.name=d,e;f=m[b.signatureParameters.mgf.algorithmOid];if(void 0===f||void 0===c.mgf[f])throw e=Error("Unsupported MGF function."),
508
e.oid=b.signatureParameters.mgf.algorithmOid,e.name=f,e;f=c.mgf[f].create(c.md[d].create());d=m[b.signatureParameters.hash.algorithmOid];if(void 0===d||void 0===c.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:b.signatureParameters.hash.algorithmOid,name:d};f=c.pss.create(c.md[d].create(),f,b.signatureParameters.saltLength)}d=a.publicKey.verify(e.digest().getBytes(),b.signature,f)}return d};a.isIssuer=function(c){var b=!1,d=a.issuer;c=c.subject;if(d.hash&&c.hash)b=d.hash===c.hash;
509
else if(d.attributes.length===c.attributes.length)for(var b=!0,e,g,h=0;b&&h<d.attributes.length;++h)if(e=d.attributes[h],g=c.attributes[h],e.type!==g.type||e.value!==g.value)b=!1;return b};a.issued=function(c){return c.isIssuer(a)};a.generateSubjectKeyIdentifier=function(){return p.getPublicKeyFingerprint(a.publicKey,{type:"RSAPublicKey"})};a.verifySubjectKeyIdentifier=function(){for(var b=m.subjectKeyIdentifier,d=0;d<a.extensions.length;++d){var e=a.extensions[d];if(e.id===b)return b=a.generateSubjectKeyIdentifier().getBytes(),
510
-c.util.hexToBytes(e.subjectKeyIdentifier)===b}return!1};return a};p.certificateFromAsn1=function(a,d){var h={},f=[];if(!g.validate(a,w,h,f))throw h=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),h.errors=f,h;if("string"!==typeof h.certSignature){for(var f="\x00",n=0;n<h.certSignature.length;++n)f+=g.toDer(h.certSignature[n]).getBytes();h.certSignature=f}f=g.derToOid(h.publicKeyOid);if(f!==p.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");
511
-var q=p.createCertificate();q.version=h.certVersion?h.certVersion.charCodeAt(0):0;f=c.util.createBuffer(h.certSerialNumber);q.serialNumber=f.toHex();q.signatureOid=c.asn1.derToOid(h.certSignatureOid);q.signatureParameters=J(q.signatureOid,h.certSignatureParams,!0);q.siginfo.algorithmOid=c.asn1.derToOid(h.certinfoSignatureOid);q.siginfo.parameters=J(q.siginfo.algorithmOid,h.certinfoSignatureParams,!1);f=c.util.createBuffer(h.certSignature);++f.read;q.signature=f.getBytes();f=[];void 0!==h.certValidity1UTCTime&&
510
+c.util.hexToBytes(e.subjectKeyIdentifier)===b}return!1};return a};p.certificateFromAsn1=function(a,d){var h={},f=[];if(!g.validate(a,y,h,f))throw h=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),h.errors=f,h;if("string"!==typeof h.certSignature){for(var f="\x00",n=0;n<h.certSignature.length;++n)f+=g.toDer(h.certSignature[n]).getBytes();h.certSignature=f}f=g.derToOid(h.publicKeyOid);if(f!==p.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");
511
+var q=p.createCertificate();q.version=h.certVersion?h.certVersion.charCodeAt(0):0;f=c.util.createBuffer(h.certSerialNumber);q.serialNumber=f.toHex();q.signatureOid=c.asn1.derToOid(h.certSignatureOid);q.signatureParameters=L(q.signatureOid,h.certSignatureParams,!0);q.siginfo.algorithmOid=c.asn1.derToOid(h.certinfoSignatureOid);q.siginfo.parameters=L(q.siginfo.algorithmOid,h.certinfoSignatureParams,!1);f=c.util.createBuffer(h.certSignature);++f.read;q.signature=f.getBytes();f=[];void 0!==h.certValidity1UTCTime&&
512
f.push(g.utcTimeToDate(h.certValidity1UTCTime));void 0!==h.certValidity2GeneralizedTime&&f.push(g.generalizedTimeToDate(h.certValidity2GeneralizedTime));void 0!==h.certValidity3UTCTime&&f.push(g.utcTimeToDate(h.certValidity3UTCTime));void 0!==h.certValidity4GeneralizedTime&&f.push(g.generalizedTimeToDate(h.certValidity4GeneralizedTime));if(2<f.length)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(2>f.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
513
q.validity.notBefore=f[0];q.validity.notAfter=f[1];q.tbsCertificate=h.tbsCertificate;if(d){q.md=null;if(q.signatureOid in m)switch(f=m[q.signatureOid],f){case "sha1WithRSAEncryption":q.md=c.md.sha1.create();break;case "md5WithRSAEncryption":q.md=c.md.md5.create();break;case "sha256WithRSAEncryption":q.md=c.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=c.md.sha512.create();break;case "RSASSA-PSS":q.md=c.md.sha256.create()}if(null===q.md)throw h=Error("Could not compute certificate digest. Unknown signature OID."),
514
h.signatureOid=q.signatureOid,h;f=g.toDer(q.tbsCertificate);q.md.update(f.getBytes())}f=c.md.sha1.create();q.issuer.getField=function(a){return b(q.issuer,a)};q.issuer.addField=function(a){e([a]);q.issuer.attributes.push(a)};q.issuer.attributes=p.RDNAttributesAsArray(h.certIssuer,f);h.certIssuerUniqueId&&(q.issuer.uniqueId=h.certIssuerUniqueId);q.issuer.hash=f.digest().toHex();f=c.md.sha1.create();q.subject.getField=function(a){return b(q.subject,a)};q.subject.addField=function(a){e([a]);q.subject.attributes.push(a)};
@@ -517,7 +517,7 @@ function(a){var b={};b.id=g.derToOid(a.value[0].value);b.critical=!1;a.value[1].
517
8===(d&8);b.keyCertSign=4===(d&4);b.cRLSign=2===(d&2);b.encipherOnly=1===(d&1);b.decipherOnly=128===(e&128)}else if("basicConstraints"===b.name)a=g.fromDer(b.value),b.cA=0<a.value.length&&a.value[0].type===g.Type.BOOLEAN?0!==a.value[0].value.charCodeAt(0):!1,d=null,0<a.value.length&&a.value[0].type===g.Type.INTEGER?d=a.value[0].value:1<a.value.length&&(d=a.value[1].value),null!==d&&(b.pathLenConstraint=g.derToInteger(d));else if("extKeyUsage"===b.name)for(a=g.fromDer(b.value),d=0;d<a.value.length;++d)e=
518
g.derToOid(a.value[d].value),e in m?b[m[e]]=!0:b[e]=!0;else if("nsCertType"===b.name)a=g.fromDer(b.value),d=0,1<a.value.length&&(d=a.value.charCodeAt(1)),b.client=128===(d&128),b.server=64===(d&64),b.email=32===(d&32),b.objsign=16===(d&16),b.reserved=8===(d&8),b.sslCA=4===(d&4),b.emailCA=2===(d&2),b.objCA=1===(d&1);else if("subjectAltName"===b.name||"issuerAltName"===b.name)for(b.altNames=[],a=g.fromDer(b.value),e=0;e<a.value.length;++e){var d=a.value[e],h={type:d.type,value:d.value};b.altNames.push(h);
519
switch(d.type){case 7:h.ip=c.util.bytesToIP(d.value);break;case 8:h.oid=g.derToOid(d.value)}}else"subjectKeyIdentifier"===b.name&&(a=g.fromDer(b.value),b.subjectKeyIdentifier=c.util.bytesToHex(a.value));return b};p.certificationRequestFromAsn1=function(a,d){var h={},f=[];if(!g.validate(a,A,h,f))throw h=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),h.errors=f,h;if("string"!==typeof h.csrSignature){for(var f="\x00",n=0;n<h.csrSignature.length;++n)f+=
520
-g.toDer(h.csrSignature[n]).getBytes();h.csrSignature=f}f=g.derToOid(h.publicKeyOid);if(f!==p.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var q=p.createCertificationRequest();q.version=h.csrVersion?h.csrVersion.charCodeAt(0):0;q.signatureOid=c.asn1.derToOid(h.csrSignatureOid);q.signatureParameters=J(q.signatureOid,h.csrSignatureParams,!0);q.siginfo.algorithmOid=c.asn1.derToOid(h.csrSignatureOid);q.siginfo.parameters=J(q.siginfo.algorithmOid,h.csrSignatureParams,!1);f=
520
+g.toDer(h.csrSignature[n]).getBytes();h.csrSignature=f}f=g.derToOid(h.publicKeyOid);if(f!==p.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var q=p.createCertificationRequest();q.version=h.csrVersion?h.csrVersion.charCodeAt(0):0;q.signatureOid=c.asn1.derToOid(h.csrSignatureOid);q.signatureParameters=L(q.signatureOid,h.csrSignatureParams,!0);q.siginfo.algorithmOid=c.asn1.derToOid(h.csrSignatureOid);q.siginfo.parameters=L(q.siginfo.algorithmOid,h.csrSignatureParams,!1);f=
521
c.util.createBuffer(h.csrSignature);++f.read;q.signature=f.getBytes();q.certificationRequestInfo=h.certificationRequestInfo;if(d){q.md=null;if(q.signatureOid in m)switch(f=m[q.signatureOid],f){case "sha1WithRSAEncryption":q.md=c.md.sha1.create();break;case "md5WithRSAEncryption":q.md=c.md.md5.create();break;case "sha256WithRSAEncryption":q.md=c.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=c.md.sha512.create();break;case "RSASSA-PSS":q.md=c.md.sha256.create()}if(null===q.md)throw h=
522
Error("Could not compute certification request digest. Unknown signature OID."),h.signatureOid=q.signatureOid,h;f=g.toDer(q.certificationRequestInfo);q.md.update(f.getBytes())}f=c.md.sha1.create();q.subject.getField=function(a){return b(q.subject,a)};q.subject.addField=function(a){e([a]);q.subject.attributes.push(a)};q.subject.attributes=p.RDNAttributesAsArray(h.certificationRequestInfoSubject,f);q.subject.hash=f.digest().toHex();q.publicKey=p.publicKeyFromAsn1(h.subjectPublicKeyInfo);q.getAttribute=
523
function(a){return b(q,a)};q.addAttribute=function(a){e([a]);q.attributes.push(a)};q.attributes=p.CRIAttributesAsArray(h.certificationRequestInfoAttributes||[]);return q};p.createCertificationRequest=function(){var a={version:0,signatureOid:null,signature:null,siginfo:{}};a.siginfo.algorithmOid=null;a.subject={};a.subject.getField=function(c){return b(a.subject,c)};a.subject.addField=function(c){e([c]);a.subject.attributes.push(c)};a.subject.attributes=[];a.subject.hash=null;a.publicKey=null;a.attributes=
@@ -534,26 +534,26 @@ p.getCertificationRequestInfo(a);return g.create(g.Class.UNIVERSAL,g.Type.SEQUEN
534
null}var e={certs:{},getIssuer:function(a){return b(a.issuer)},addCertificate:function(a){"string"===typeof a&&(a=c.pki.certificateFromPem(a));if(!a.subject.hash){var b=c.md.sha1.create();a.subject.attributes=p.RDNAttributesAsArray(d(a.subject),b);a.subject.hash=b.digest().toHex()}a.subject.hash in e.certs?(b=e.certs[a.subject.hash],c.util.isArray(b)||(b=[b]),b.push(a)):e.certs[a.subject.hash]=a},hasCertificate:function(a){var d=b(a.subject);if(!d)return!1;c.util.isArray(d)||(d=[d]);a=g.toDer(p.certificateToAsn1(a)).getBytes();
535
for(var e=0;e<d.length;++e){var h=g.toDer(p.certificateToAsn1(d[e])).getBytes();if(a===h)return!0}return!1}};if(a)for(var h=0;h<a.length;++h)e.addCertificate(a[h]);return e};p.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};
536
p.verifyCertificateChain=function(a,b,d){b=b.slice(0);var e=b.slice(0),h=new Date,g=!0,f=null,k=0;do{var m=b.shift(),n=null,u=!1;if(h<m.validity.notBefore||h>m.validity.notAfter)f={message:"Certificate is not valid yet or has expired.",error:p.certificateError.certificate_expired,notBefore:m.validity.notBefore,notAfter:m.validity.notAfter,now:h};if(null===f){n=b[0]||a.getIssuer(m);null===n&&m.isIssuer(m)&&(u=!0,n=m);if(n){var v=n;c.util.isArray(v)||(v=[v]);for(var r=!1;!r&&0<v.length;){n=v.shift();
537
-try{r=n.verify(m)}catch(w){}}r||(f={message:"Certificate signature is invalid.",error:p.certificateError.bad_certificate})}null!==f||n&&!u||a.hasCertificate(m)||(f={message:"Certificate is not trusted.",error:p.certificateError.unknown_ca})}null===f&&n&&!m.isIssuer(n)&&(f={message:"Certificate issuer is invalid.",error:p.certificateError.bad_certificate});if(null===f)for(v={keyUsage:!0,basicConstraints:!0},r=0;null===f&&r<m.extensions.length;++r){var x=m.extensions[r];!x.critical||x.name in v||(f=
537
+try{r=n.verify(m)}catch(w){}}r||(f={message:"Certificate signature is invalid.",error:p.certificateError.bad_certificate})}null!==f||n&&!u||a.hasCertificate(m)||(f={message:"Certificate is not trusted.",error:p.certificateError.unknown_ca})}null===f&&n&&!m.isIssuer(n)&&(f={message:"Certificate issuer is invalid.",error:p.certificateError.bad_certificate});if(null===f)for(v={keyUsage:!0,basicConstraints:!0},r=0;null===f&&r<m.extensions.length;++r){var y=m.extensions[r];!y.critical||y.name in v||(f=
538
{message:"Certificate has an unsupported critical extension.",error:p.certificateError.unsupported_certificate})}null!==f||g&&(0!==b.length||n&&!u)||(g=m.getExtension("basicConstraints"),m=m.getExtension("keyUsage"),null!==m&&(m.keyCertSign&&null!==g||(f={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.",error:p.certificateError.bad_certificate})),
539
null!==f||null===g||g.cA||(f={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:p.certificateError.bad_certificate}),null===f&&null!==m&&"pathLenConstraint"in g&&k-1>g.pathLenConstraint&&(f={message:"Certificate basicConstraints pathLenConstraint violated.",error:p.certificateError.bad_certificate}));m=null===f?!0:f.error;g=d?d(m,k,e):m;if(!0===g)f=null;else{!0===m&&(f={message:"The application rejected the certificate.",error:p.certificateError.bad_certificate});
540
if(g||0===g)"object"!==typeof g||c.util.isArray(g)?"string"===typeof g&&(f.error=g):(g.message&&(f.message=g.message),g.error&&(f.error=g.error));throw f;}g=!1;++k}while(0<b.length);return!0}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var f=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,p=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.x509)return b.x509;
541
b.defined.x509=!0;for(var f=0;f<e.length;++f)e[f](b);return b.pki}},r=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(f)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/x509","require module ./aes ./asn1 ./des ./md ./mgf ./oids ./pem ./pss ./rsa ./util".split(" "),function(){p.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d,e){for(var g=
542
[],h=0;h<a.length;h++)for(var f=0;f<a[h].safeBags.length;f++){var l=a[h].safeBags[f];if(void 0===e||l.type===e)null===c?g.push(l):void 0!==l.attributes[c]&&0<=l.attributes[c].indexOf(d)&&g.push(l)}return g}function d(a){if(a.composed||a.constructed){for(var b=c.util.createBuffer(),e=0;e<a.value.length;++e)b.putBytes(a.value[e].value);a.composed=a.constructed=!1;a.value=b.getBytes()}return a}function e(a,b,e,k){b=h.fromDer(b,e);if(b.tagClass!==h.Class.UNIVERSAL||b.type!==h.Type.SEQUENCE||!0!==b.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
543
-for(var n=0;n<b.value.length;n++){var p={},r=[];if(!h.validate(b.value[n],m,p,r))throw a=Error("Cannot read ContentInfo."),a.errors=r,a;var r={encrypted:!1},q=null,q=p.content.value[0];switch(h.derToOid(p.contentType)){case g.oids.data:if(q.tagClass!==h.Class.UNIVERSAL||q.type!==h.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");q=d(q).value;break;case g.oids.encryptedData:var w=k,p={},x=[];if(!h.validate(q,c.pkcs7.asn1.encryptedDataValidator,p,x))throw a=Error("Cannot read EncryptedContentInfo."),
544
-a.errors=x,a;q=h.derToOid(p.contentType);if(q!==g.oids.data)throw a=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),a.oid=q,a;q=h.derToOid(p.encAlgorithm);q=g.pbe.getCipher(q,p.encParameter,w);p=d(p.encryptedContentAsn1);p=c.util.createBuffer(p.value);q.update(p);if(!q.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");q=q.output.getBytes();r.encrypted=!0;break;default:throw a=Error("Unsupported PKCS#12 contentType."),a.contentType=h.derToOid(p.contentType),a;}r.safeBags=
545
-f(q,e,k);a.safeContents.push(r)}}function f(a,c,b){if(!c&&0===a.length)return[];a=h.fromDer(a,c);if(a.tagClass!==h.Class.UNIVERSAL||a.type!==h.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var l={},k=[];if(!h.validate(a.value[e],x,l,k))throw a=Error("Cannot read SafeBag."),a.errors=k,a;var m={type:h.derToOid(l.bagId),attributes:n(l.bagAttributes)};d.push(m);var p,u,v=l.bagValue.value[0];switch(m.type){case g.oids.pkcs8ShroudedKeyBag:if(v=
546
-g.decryptPrivateKeyInfo(v,b),null===v)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case g.oids.keyBag:try{m.key=g.privateKeyFromAsn1(v)}catch(r){m.key=null,m.asn1=v}continue;case g.oids.certBag:p=F;u=function(){if(h.derToOid(l.certId)!==g.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=h.derToOid(l.certId);throw a;}a=h.fromDer(l.cert,c);try{m.cert=g.certificateFromAsn1(a,!0)}catch(b){m.cert=null,m.asn1=a}};break;default:throw a=
547
-Error("Unsupported PKCS#12 SafeBag type."),a.oid=m.type,a;}if(void 0!==p&&!h.validate(v,p,l,k))throw a=Error("Cannot read PKCS#12 "+p.name),a.errors=k,a;u()}return d}function n(a){var c={};if(void 0!==a)for(var b=0;b<a.length;++b){var d={},e=[];if(!h.validate(a[b],w,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=h.derToOid(d.oid);if(void 0!==g.oids[e]){c[g.oids[e]]=[];for(var f=0;f<d.values.length;++f)c[g.oids[e]].push(d.values[f].value)}}return c}var h=c.asn1,g=c.pki,p=c.pkcs12=
543
+for(var n=0;n<b.value.length;n++){var p={},r=[];if(!h.validate(b.value[n],m,p,r))throw a=Error("Cannot read ContentInfo."),a.errors=r,a;var r={encrypted:!1},q=null,q=p.content.value[0];switch(h.derToOid(p.contentType)){case g.oids.data:if(q.tagClass!==h.Class.UNIVERSAL||q.type!==h.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");q=d(q).value;break;case g.oids.encryptedData:var w=k,p={},y=[];if(!h.validate(q,c.pkcs7.asn1.encryptedDataValidator,p,y))throw a=Error("Cannot read EncryptedContentInfo."),
544
+a.errors=y,a;q=h.derToOid(p.contentType);if(q!==g.oids.data)throw a=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),a.oid=q,a;q=h.derToOid(p.encAlgorithm);q=g.pbe.getCipher(q,p.encParameter,w);p=d(p.encryptedContentAsn1);p=c.util.createBuffer(p.value);q.update(p);if(!q.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");q=q.output.getBytes();r.encrypted=!0;break;default:throw a=Error("Unsupported PKCS#12 contentType."),a.contentType=h.derToOid(p.contentType),a;}r.safeBags=
545
+f(q,e,k);a.safeContents.push(r)}}function f(a,c,b){if(!c&&0===a.length)return[];a=h.fromDer(a,c);if(a.tagClass!==h.Class.UNIVERSAL||a.type!==h.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var l={},k=[];if(!h.validate(a.value[e],w,l,k))throw a=Error("Cannot read SafeBag."),a.errors=k,a;var m={type:h.derToOid(l.bagId),attributes:n(l.bagAttributes)};d.push(m);var p,u,v=l.bagValue.value[0];switch(m.type){case g.oids.pkcs8ShroudedKeyBag:if(v=
546
+g.decryptPrivateKeyInfo(v,b),null===v)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case g.oids.keyBag:try{m.key=g.privateKeyFromAsn1(v)}catch(r){m.key=null,m.asn1=v}continue;case g.oids.certBag:p=C;u=function(){if(h.derToOid(l.certId)!==g.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=h.derToOid(l.certId);throw a;}a=h.fromDer(l.cert,c);try{m.cert=g.certificateFromAsn1(a,!0)}catch(b){m.cert=null,m.asn1=a}};break;default:throw a=
547
+Error("Unsupported PKCS#12 SafeBag type."),a.oid=m.type,a;}if(void 0!==p&&!h.validate(v,p,l,k))throw a=Error("Cannot read PKCS#12 "+p.name),a.errors=k,a;u()}return d}function n(a){var c={};if(void 0!==a)for(var b=0;b<a.length;++b){var d={},e=[];if(!h.validate(a[b],y,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=h.derToOid(d.oid);if(void 0!==g.oids[e]){c[g.oids[e]]=[];for(var f=0;f<d.values.length;++f)c[g.oids[e]].push(d.values[f].value)}}return c}var h=c.asn1,g=c.pki,p=c.pkcs12=
548
c.pkcs12||{},m={name:"ContentInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:h.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},r={name:"PFX",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"version"},
549
m,{name:"PFX.macData",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",
550
-tagClass:h.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},x={name:"SafeBag",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,
551
-value:[{name:"SafeBag.bagId",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:h.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},w={name:"Attribute",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,
552
-capture:"oid"},{name:"Attribute.attrValues",tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0,capture:"values"}]},F={name:"CertBag",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:h.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:h.Class.UNIVERSAL,type:h.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};
550
+tagClass:h.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},w={name:"SafeBag",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,
551
+value:[{name:"SafeBag.bagId",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:h.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},y={name:"Attribute",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,
552
+capture:"oid"},{name:"Attribute.attrValues",tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0,capture:"values"}]},C={name:"CertBag",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:h.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:h.Class.UNIVERSAL,type:h.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};
553
p.pkcs12FromAsn1=function(a,f,m){"string"===typeof f?(m=f,f=!0):void 0===f&&(f=!0);var n={};if(!h.validate(a,r,n,[]))throw f=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),f.errors=f,f;var u={version:n.version.charCodeAt(0),safeContents:[],getBags:function(a){var d={},e;"localKeyId"in a?e=a.localKeyId:"localKeyIdHex"in a&&(e=c.util.hexToBytes(a.localKeyIdHex));void 0===e&&!("friendlyName"in a)&&"bagType"in a&&(d[a.bagType]=b(u.safeContents,null,null,a.bagType));void 0!==e&&
554
(d.localKeyId=b(u.safeContents,"localKeyId",e,a.bagType));"friendlyName"in a&&(d.friendlyName=b(u.safeContents,"friendlyName",a.friendlyName,a.bagType));return d},getBagsByFriendlyName:function(a,c){return b(u.safeContents,"friendlyName",a,c)},getBagsByLocalKeyId:function(a,c){return b(u.safeContents,"localKeyId",a,c)}};if(3!==n.version.charCodeAt(0))throw f=Error("PKCS#12 PFX of version other than 3 not supported."),f.version=n.version.charCodeAt(0),f;if(h.derToOid(n.contentType)!==g.oids.data)throw f=
555
-Error("Only PKCS#12 PFX in password integrity mode supported."),f.oid=h.derToOid(n.contentType),f;a=n.content.value[0];if(a.tagClass!==h.Class.UNIVERSAL||a.type!==h.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");a=d(a);if(n.mac){var w=null,x=0,q=h.derToOid(n.macAlgorithm);switch(q){case g.oids.sha1:w=c.md.sha1.create();x=20;break;case g.oids.sha256:w=c.md.sha256.create();x=32;break;case g.oids.sha384:w=c.md.sha384.create();x=48;break;case g.oids.sha512:w=c.md.sha512.create();
556
-x=64;break;case g.oids.md5:w=c.md.md5.create(),x=16}if(null===w)throw Error("PKCS#12 uses unsupported MAC algorithm: "+q);var q=new c.util.ByteBuffer(n.macSalt),B="macIterations"in n?parseInt(c.util.bytesToHex(n.macIterations),16):1,x=p.generateKey(m,q,3,B,x,w),q=c.hmac.create();q.start(w,x);q.update(a.value);if(q.getMac().getBytes()!==n.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(u,a.value,f,m);return u};p.toPkcs12Asn1=function(a,b,d,e){e=e||{};e.saltSize=e.saltSize||
555
+Error("Only PKCS#12 PFX in password integrity mode supported."),f.oid=h.derToOid(n.contentType),f;a=n.content.value[0];if(a.tagClass!==h.Class.UNIVERSAL||a.type!==h.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");a=d(a);if(n.mac){var w=null,y=0,q=h.derToOid(n.macAlgorithm);switch(q){case g.oids.sha1:w=c.md.sha1.create();y=20;break;case g.oids.sha256:w=c.md.sha256.create();y=32;break;case g.oids.sha384:w=c.md.sha384.create();y=48;break;case g.oids.sha512:w=c.md.sha512.create();
556
+y=64;break;case g.oids.md5:w=c.md.md5.create(),y=16}if(null===w)throw Error("PKCS#12 uses unsupported MAC algorithm: "+q);var q=new c.util.ByteBuffer(n.macSalt),B="macIterations"in n?parseInt(c.util.bytesToHex(n.macIterations),16):1,y=p.generateKey(m,q,3,B,y,w),q=c.hmac.create();q.start(w,y);q.update(a.value);if(q.getMac().getBytes()!==n.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(u,a.value,f,m);return u};p.toPkcs12Asn1=function(a,b,d,e){e=e||{};e.saltSize=e.saltSize||
557
8;e.count=e.count||2048;e.algorithm=e.algorithm||e.encAlgorithm||"aes128";"useMac"in e||(e.useMac=!0);"localKeyId"in e||(e.localKeyId=null);"generateLocalKeyId"in e||(e.generateLocalKeyId=!0);var f=e.localKeyId,k;if(null!==f)f=c.util.hexToBytes(f);else if(e.generateLocalKeyId)if(b){var m=c.util.isArray(b)?b[0]:b;"string"===typeof m&&(m=g.certificateFromPem(m));f=c.md.sha1.create();f.update(h.toDer(g.certificateToAsn1(m)).getBytes());f=f.digest().getBytes()}else f=c.random.getBytes(20);m=[];null!==
558
f&&m.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(g.oids.localKeyId).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,f)])]));"friendlyName"in e&&m.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(g.oids.friendlyName).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.BMPSTRING,!1,e.friendlyName)])]));
559
0<m.length&&(k=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,m));f=[];m=[];null!==b&&(m=c.util.isArray(b)?b:[b]);for(var n=[],u=0;u<m.length;++u){b=m[u];"string"===typeof b&&(b=g.certificateFromPem(b));var v=0===u?k:void 0;b=g.certificateToAsn1(b);b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(g.oids.certBag).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(g.oids.x509Certificate).getBytes()),
@@ -578,30 +578,30 @@ f(b,1));k=d-(k-b.length());if(0<k){for(d=f(b,2);0<d.length();)e.extensions.push(
578
send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.protocol_version}});if(g)a.session.cipherSuite=h.getCipherSuite(e.cipher_suite);else for(d=c.util.createBuffer(e.cipher_suites.bytes());0<d.length()&&(a.session.cipherSuite=h.getCipherSuite(d.getBytes(2)),null===a.session.cipherSuite););if(null===a.session.cipherSuite)return a.error(a,{message:"No cipher suites in common.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.handshake_failure},cipherSuite:c.util.bytesToHex(e.cipher_suite)});
579
a.session.compressionMethod=g?e.compression_method:h.CompressionMethod.none}return e};h.createSecurityParameters=function(a,c){var b=a.entity===h.ConnectionEnd.client,d=c.random.bytes(),e=b?a.session.sp.client_random:d,b=b?d:h.createRandom().getBytes();a.session.sp={entity:a.entity,prf_algorithm:h.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,
580
compression_algorithm:a.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:e,server_random:b}};h.handleServerHello=function(a,c,b){c=h.parseHelloMessage(a,c,b);if(!a.fail){if(c.version.minor<=a.version.minor)a.version.minor=c.version.minor;else return a.error(a,{message:"Incompatible TLS version.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.protocol_version}});a.session.version=a.version;b=c.session_id.bytes();0<b.length&&b===a.session.id?
581
-(a.expect=x,a.session.resuming=!0,a.session.sp.server_random=c.random.bytes()):(a.expect=g,a.session.resuming=!1,h.createSecurityParameters(a,c));a.session.id=b;a.process()}};h.handleClientHello=function(a,b,d){b=h.parseHelloMessage(a,b,d);if(!a.fail){var e=b.session_id.bytes();d=null;if(a.sessionCache)if(d=a.sessionCache.getSession(e),null===d)e="";else if(d.version.major!==b.version.major||d.version.minor>b.version.minor)d=null,e="";0===e.length&&(e=c.random.getBytes(32));a.session.id=e;a.session.clientHelloVersion=
582
-b.version;a.session.sp={};if(d)a.version=a.session.version=d.version,a.session.sp=d.sp;else{for(var g,e=1;e<h.SupportedVersions.length&&!(g=h.SupportedVersions[e],g.minor<=b.version.minor);++e);a.version={major:g.major,minor:g.minor};a.session.version=a.version}null!==d?(a.expect=z,a.session.resuming=!0,a.session.sp.client_random=b.random.bytes()):(a.expect=!1!==a.verifyClient?J:y,a.session.resuming=!1,h.createSecurityParameters(a,b));a.open=!0;h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,
581
+(a.expect=w,a.session.resuming=!0,a.session.sp.server_random=c.random.bytes()):(a.expect=g,a.session.resuming=!1,h.createSecurityParameters(a,c));a.session.id=b;a.process()}};h.handleClientHello=function(a,b,d){b=h.parseHelloMessage(a,b,d);if(!a.fail){var e=b.session_id.bytes();d=null;if(a.sessionCache)if(d=a.sessionCache.getSession(e),null===d)e="";else if(d.version.major!==b.version.major||d.version.minor>b.version.minor)d=null,e="";0===e.length&&(e=c.random.getBytes(32));a.session.id=e;a.session.clientHelloVersion=
582
+b.version;a.session.sp={};if(d)a.version=a.session.version=d.version,a.session.sp=d.sp;else{for(var g,e=1;e<h.SupportedVersions.length&&!(g=h.SupportedVersions[e],g.minor<=b.version.minor);++e);a.version={major:g.major,minor:g.minor};a.session.version=a.version}null!==d?(a.expect=x,a.session.resuming=!0,a.session.sp.client_random=b.random.bytes()):(a.expect=!1!==a.verifyClient?L:z,a.session.resuming=!1,h.createSecurityParameters(a,b));a.open=!0;h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,
583
data:h.createServerHello(a)}));a.session.resuming?(h.queue(a,h.createRecord(a,{type:h.ContentType.change_cipher_spec,data:h.createChangeCipherSpec()})),a.state.pending=h.createConnectionState(a),a.state.current.write=a.state.pending.write,h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createFinished(a)}))):(h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createCertificate(a)})),a.fail||(h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createServerKeyExchange(a)})),
584
!1!==a.verifyClient&&h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createCertificateRequest(a)})),h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createServerHelloDone(a)}))));h.flush(a);a.process()}};h.handleCertificate=function(a,b,d){if(3>d)return a.error(a,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});d=f(b.fragment,3);var e,g;b=[];try{for(;0<d.length();)e=
585
-f(d,3),g=c.asn1.fromDer(e),e=c.pki.certificateFromAsn1(g,!0),b.push(e)}catch(k){return a.error(a,{message:"Could not parse certificate list.",cause:k,send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.bad_certificate}})}e=a.entity===h.ConnectionEnd.client;!e&&!0!==a.verifyClient||0!==b.length?0===b.length?a.expect=e?p:y:(e?a.session.serverCertificate=b[0]:a.session.clientCertificate=b[0],h.verifyCertificateChain(a,b)&&(a.expect=e?p:y)):a.error(a,{message:e?"No server certificate provided.":
585
+f(d,3),g=c.asn1.fromDer(e),e=c.pki.certificateFromAsn1(g,!0),b.push(e)}catch(k){return a.error(a,{message:"Could not parse certificate list.",cause:k,send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.bad_certificate}})}e=a.entity===h.ConnectionEnd.client;!e&&!0!==a.verifyClient||0!==b.length?0===b.length?a.expect=e?p:z:(e?a.session.serverCertificate=b[0]:a.session.clientCertificate=b[0],h.verifyCertificateChain(a,b)&&(a.expect=e?p:z)):a.error(a,{message:e?"No server certificate provided.":
586
"No client certificate provided.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});a.process()};h.handleServerKeyExchange=function(a,c,b){if(0<b)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unsupported_certificate}});a.expect=m;a.process()};h.handleClientKeyExchange=function(a,b,d){if(48>d)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",
587
send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.unsupported_certificate}});b=f(b.fragment,2).getBytes();d=null;if(a.getPrivateKey)try{d=a.getPrivateKey(a,a.session.serverCertificate),d=c.pki.privateKeyFromPem(d)}catch(e){a.error(a,{message:"Could not get private key.",cause:e,send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}})}if(null===d)return a.error(a,{message:"No private key set.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.internal_error}});
588
-try{var g=a.session.sp;g.pre_master_secret=d.decrypt(b);var k=a.session.clientHelloVersion;if(k.major!==g.pre_master_secret.charCodeAt(0)||k.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=c.random.getBytes(48)}a.expect=z;null!==a.session.clientCertificate&&(a.expect=C);a.process()};h.handleCertificateRequest=function(a,c,b){if(3>b)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,
588
+try{var g=a.session.sp;g.pre_master_secret=d.decrypt(b);var k=a.session.clientHelloVersion;if(k.major!==g.pre_master_secret.charCodeAt(0)||k.minor!==g.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){g.pre_master_secret=c.random.getBytes(48)}a.expect=x;null!==a.session.clientCertificate&&(a.expect=D);a.process()};h.handleCertificateRequest=function(a,c,b){if(3>b)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,
589
description:h.Alert.Description.illegal_parameter}});c=c.fragment;c={certificate_types:f(c,1),certificate_authorities:f(c,2)};a.session.certificateRequest=c;a.expect=r;a.process()};h.handleCertificateVerify=function(a,b,d){if(2>d)return a.error(a,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});d=b.fragment;d.read-=4;b=d.bytes();d.read+=4;d=f(d,2).getBytes();var e=c.util.createBuffer();e.putBuffer(a.session.md5.digest());
590
-e.putBuffer(a.session.sha1.digest());e=e.getBytes();try{if(!a.session.clientCertificate.publicKey.verify(e,d,"NONE"))throw Error("CertificateVerify signature does not match.");a.session.md5.update(b);a.session.sha1.update(b)}catch(g){return a.error(a,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.handshake_failure}})}a.expect=z;a.process()};h.handleServerHelloDone=function(a,b,d){if(0<d)return a.error(a,{message:"Invalid ServerHelloDone message. Invalid length.",
590
+e.putBuffer(a.session.sha1.digest());e=e.getBytes();try{if(!a.session.clientCertificate.publicKey.verify(e,d,"NONE"))throw Error("CertificateVerify signature does not match.");a.session.md5.update(b);a.session.sha1.update(b)}catch(g){return a.error(a,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.handshake_failure}})}a.expect=x;a.process()};h.handleServerHelloDone=function(a,b,d){if(0<d)return a.error(a,{message:"Invalid ServerHelloDone message. Invalid length.",
591
send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.record_overflow}});if(null===a.serverCertificate&&(b={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.insufficient_security}},d=a.verify(a,b.alert.description,0,[]),!0!==d)){if(d||0===d)"object"!==typeof d||c.util.isArray(d)?"number"===typeof d&&(b.alert.description=d):(d.message&&(b.message=d.message),d.alert&&(b.alert.description=d.alert));
592
return a.error(a,b)}null!==a.session.certificateRequest&&(b=h.createRecord(a,{type:h.ContentType.handshake,data:h.createCertificate(a)}),h.queue(a,b));b=h.createRecord(a,{type:h.ContentType.handshake,data:h.createClientKeyExchange(a)});h.queue(a,b);a.expect=A;b=function(a,c){null!==a.session.certificateRequest&&null!==a.session.clientCertificate&&h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createCertificateVerify(a,c)}));h.queue(a,h.createRecord(a,{type:h.ContentType.change_cipher_spec,
593
-data:h.createChangeCipherSpec()}));a.state.pending=h.createConnectionState(a);a.state.current.write=a.state.pending.write;h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createFinished(a)}));a.expect=x;h.flush(a);a.process()};if(null===a.session.certificateRequest||null===a.session.clientCertificate)return b(a,null);h.getClientSignature(a,b)};h.handleChangeCipherSpec=function(a,c){if(1!==c.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,
594
-alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});var b=a.entity===h.ConnectionEnd.client;if(a.session.resuming&&b||!a.session.resuming&&!b)a.state.pending=h.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&b||a.session.resuming&&!b)a.state.pending=null;a.expect=b?w:G;a.process()};h.handleFinished=function(a,d,e){e=d.fragment;e.read-=4;var g=e.bytes();e.read+=4;d=d.fragment.getBytes();e=c.util.createBuffer();e.putBuffer(a.session.md5.digest());
593
+data:h.createChangeCipherSpec()}));a.state.pending=h.createConnectionState(a);a.state.current.write=a.state.pending.write;h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createFinished(a)}));a.expect=w;h.flush(a);a.process()};if(null===a.session.certificateRequest||null===a.session.clientCertificate)return b(a,null);h.getClientSignature(a,b)};h.handleChangeCipherSpec=function(a,c){if(1!==c.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,
594
+alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.illegal_parameter}});var b=a.entity===h.ConnectionEnd.client;if(a.session.resuming&&b||!a.session.resuming&&!b)a.state.pending=h.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&b||a.session.resuming&&!b)a.state.pending=null;a.expect=b?y:G;a.process()};h.handleFinished=function(a,d,e){e=d.fragment;e.read-=4;var g=e.bytes();e.read+=4;d=d.fragment.getBytes();e=c.util.createBuffer();e.putBuffer(a.session.md5.digest());
595
e.putBuffer(a.session.sha1.digest());var f=a.entity===h.ConnectionEnd.client;e=b(a.session.sp.master_secret,f?"server finished":"client finished",e.getBytes(),12);if(e.getBytes()!==d)return a.error(a,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:h.Alert.Level.fatal,description:h.Alert.Description.decrypt_error}});a.session.md5.update(g);a.session.sha1.update(g);if(a.session.resuming&&f||!a.session.resuming&&!f)h.queue(a,h.createRecord(a,{type:h.ContentType.change_cipher_spec,
596
-data:h.createChangeCipherSpec()})),a.state.current.write=a.state.pending.write,a.state.pending=null,h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createFinished(a)}));a.expect=f?F:X;a.handshaking=!1;++a.handshakes;a.peerCertificate=f?a.session.serverCertificate:a.session.clientCertificate;h.flush(a);a.isConnected=!0;a.connected(a);a.process()};h.handleAlert=function(a,c){var b=c.fragment,b={level:b.getByte(),description:b.getByte()},d;switch(b.description){case h.Alert.Description.close_notify:d=
596
+data:h.createChangeCipherSpec()})),a.state.current.write=a.state.pending.write,a.state.pending=null,h.queue(a,h.createRecord(a,{type:h.ContentType.handshake,data:h.createFinished(a)}));a.expect=f?C:X;a.handshaking=!1;++a.handshakes;a.peerCertificate=f?a.session.serverCertificate:a.session.clientCertificate;h.flush(a);a.isConnected=!0;a.connected(a);a.process()};h.handleAlert=function(a,c){var b=c.fragment,b={level:b.getByte(),description:b.getByte()},d;switch(b.description){case h.Alert.Description.close_notify:d=
597
"Connection closed.";break;case h.Alert.Description.unexpected_message:d="Unexpected message.";break;case h.Alert.Description.bad_record_mac:d="Bad record MAC.";break;case h.Alert.Description.decryption_failed:d="Decryption failed.";break;case h.Alert.Description.record_overflow:d="Record overflow.";break;case h.Alert.Description.decompression_failure:d="Decompression failed.";break;case h.Alert.Description.handshake_failure:d="Handshake failure.";break;case h.Alert.Description.bad_certificate:d=
598
"Bad certificate.";break;case h.Alert.Description.unsupported_certificate:d="Unsupported certificate.";break;case h.Alert.Description.certificate_revoked:d="Certificate revoked.";break;case h.Alert.Description.certificate_expired:d="Certificate expired.";break;case h.Alert.Description.certificate_unknown:d="Certificate unknown.";break;case h.Alert.Description.illegal_parameter:d="Illegal parameter.";break;case h.Alert.Description.unknown_ca:d="Unknown certificate authority.";break;case h.Alert.Description.access_denied:d=
599
"Access denied.";break;case h.Alert.Description.decode_error:d="Decode error.";break;case h.Alert.Description.decrypt_error:d="Decrypt error.";break;case h.Alert.Description.export_restriction:d="Export restriction.";break;case h.Alert.Description.protocol_version:d="Unsupported protocol version.";break;case h.Alert.Description.insufficient_security:d="Insufficient security.";break;case h.Alert.Description.internal_error:d="Internal error.";break;case h.Alert.Description.user_canceled:d="User canceled.";
600
break;case h.Alert.Description.no_renegotiation:d="Renegotiation not supported.";break;default:d="Unknown error."}if(b.description===h.Alert.Description.close_notify)return a.close();a.error(a,{message:d,send:!1,origin:a.entity===h.ConnectionEnd.client?"server":"client",alert:b});a.process()};h.handleHandshake=function(a,b){var d=b.fragment,e=d.getByte(),g=d.getInt24();if(g>d.length())return a.fragmented=b,b.fragment=c.util.createBuffer(),d.read-=4,a.process();a.fragmented=null;d.read-=4;var f=d.bytes(g+
601
4);d.read+=4;e in T[a.entity][a.expect]?(a.entity!==h.ConnectionEnd.server||a.open||a.fail||(a.handshaking=!0,a.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:c.md.md5.create(),sha1:c.md.sha1.create()}),e!==h.HandshakeType.hello_request&&e!==h.HandshakeType.certificate_verify&&e!==h.HandshakeType.finished&&(a.session.md5.update(f),a.session.sha1.update(f)),T[a.entity][a.expect][e](a,b,g)):
602
h.handleUnexpected(a,b)};h.handleApplicationData=function(a,c){a.data.putBuffer(c.fragment);a.dataReady(a);a.process()};h.handleHeartbeat=function(a,b){var d=b.fragment,e=d.getByte(),g=d.getInt16(),d=d.getBytes(g);if(e===h.HeartbeatMessageType.heartbeat_request){if(a.handshaking||g>d.length)return a.process();h.queue(a,h.createRecord(a,{type:h.ContentType.heartbeat,data:h.createHeartbeat(h.HeartbeatMessageType.heartbeat_response,d)}));h.flush(a)}else if(e===h.HeartbeatMessageType.heartbeat_response){if(d!==
603
-a.expectedHeartbeatPayload)return a.process();a.heartbeatReceived&&a.heartbeatReceived(a,c.util.createBuffer(d))}a.process()};var g=1,p=2,m=3,r=4,x=5,w=6,F=7,A=8,J=1,y=2,C=3,z=4,G=5,X=6,q=h.handleUnexpected,O=h.handleChangeCipherSpec,M=h.handleAlert,K=h.handleHandshake,P=h.handleApplicationData,L=h.handleHeartbeat,W=[];W[h.ConnectionEnd.client]=[[q,M,K,q,L],[q,M,K,q,L],[q,M,K,q,L],[q,M,K,q,L],[q,M,K,q,L],[O,M,q,q,L],[q,M,K,q,L],[q,M,K,P,L],[q,M,K,q,L]];W[h.ConnectionEnd.server]=[[q,M,K,q,L],[q,M,
604
-K,q,L],[q,M,K,q,L],[q,M,K,q,L],[O,M,q,q,L],[q,M,K,q,L],[q,M,K,P,L],[q,M,K,q,L]];var O=h.handleHelloRequest,M=h.handleCertificate,K=h.handleServerKeyExchange,P=h.handleCertificateRequest,L=h.handleServerHelloDone,U=h.handleFinished,T=[];T[h.ConnectionEnd.client]=[[q,q,h.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,M,K,P,L,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,q,K,P,L,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,q,q,P,L,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,q,q,q,L,q,q,q,q,q,q],
603
+a.expectedHeartbeatPayload)return a.process();a.heartbeatReceived&&a.heartbeatReceived(a,c.util.createBuffer(d))}a.process()};var g=1,p=2,m=3,r=4,w=5,y=6,C=7,A=8,L=1,z=2,D=3,x=4,G=5,X=6,q=h.handleUnexpected,O=h.handleChangeCipherSpec,M=h.handleAlert,J=h.handleHandshake,P=h.handleApplicationData,K=h.handleHeartbeat,W=[];W[h.ConnectionEnd.client]=[[q,M,J,q,K],[q,M,J,q,K],[q,M,J,q,K],[q,M,J,q,K],[q,M,J,q,K],[O,M,q,q,K],[q,M,J,q,K],[q,M,J,P,K],[q,M,J,q,K]];W[h.ConnectionEnd.server]=[[q,M,J,q,K],[q,M,
604
+J,q,K],[q,M,J,q,K],[q,M,J,q,K],[O,M,q,q,K],[q,M,J,q,K],[q,M,J,P,K],[q,M,J,q,K]];var O=h.handleHelloRequest,M=h.handleCertificate,J=h.handleServerKeyExchange,P=h.handleCertificateRequest,K=h.handleServerHelloDone,U=h.handleFinished,T=[];T[h.ConnectionEnd.client]=[[q,q,h.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,M,J,P,K,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,q,J,P,K,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,q,q,P,K,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,q,q,q,K,q,q,q,q,q,q],
605
[O,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,U],[O,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[O,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];T[h.ConnectionEnd.server]=[[q,h.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,M,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,h.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,h.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,
606
q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,U],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];h.generateKeys=function(a,c){var d=c.client_random+c.server_random;a.session.resuming||(c.master_secret=b(c.pre_master_secret,"master secret",d,48).bytes(),c.pre_master_secret=null);var d=c.server_random+c.client_random,e=2*c.mac_key_length+2*c.enc_key_length,g=a.version.major===h.Versions.TLS_1_0.major&&a.version.minor===h.Versions.TLS_1_0.minor;g&&(e+=2*c.fixed_iv_length);d=
607
b(c.master_secret,"key expansion",d,e);e={client_write_MAC_key:d.getBytes(c.mac_key_length),server_write_MAC_key:d.getBytes(c.mac_key_length),client_write_key:d.getBytes(c.enc_key_length),server_write_key:d.getBytes(c.enc_key_length)};g&&(e.client_write_IV=d.getBytes(c.fixed_iv_length),e.server_write_IV=d.getBytes(c.fixed_iv_length));return e};h.createConnectionState=function(a){var c=a.entity===h.ConnectionEnd.client,b=function(){var a={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,
@@ -674,7 +674,7 @@ g);}b=b.authenticatedAttributes||[];if(0<b.length){for(var h=!1,k=!1,m=0;m<b.len
674
signatureAlgorithm:c.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:b,unauthenticatedAttributes:[]})},sign:function(){if("object"!==typeof a.content||null===a.contentInfo)if(a.contentInfo=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(c.pki.oids.data).getBytes())]),"content"in a){var b;a.content instanceof c.util.ByteBuffer?b=a.content.bytes():"string"===typeof a.content&&(b=c.util.encodeUtf8(a.content));a.contentInfo.value.push(m.create(m.Class.CONTEXT_SPECIFIC,
675
0,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,b)]))}if(0!==a.signers.length){b={};for(var d=0;d<a.signers.length;++d){var e=a.signers[d],g=e.digestAlgorithm;g in b||(b[g]=c.md[c.pki.oids[g]].create());e.md=0===e.authenticatedAttributes.length?b[g]:c.md[c.pki.oids[g]].create()}a.digestAlgorithmIdentifiers=[];for(g in b)a.digestAlgorithmIdentifiers.push(m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(g).getBytes()),m.create(m.Class.UNIVERSAL,
676
m.Type.NULL,!1,"")]));if(2>a.contentInfo.value.length)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var g=m.derToOid(a.contentInfo.value[0].value),d=a.contentInfo.value[1],d=d.value[0],h=m.toDer(d);h.getByte();m.getBerValueLength(h);var h=h.getBytes(),k;for(k in b)b[k].start().update(h);k=new Date;for(d=0;d<a.signers.length;++d){e=a.signers[d];if(0===e.authenticatedAttributes.length){if(g!==c.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");
677
-}else{e.authenticatedAttributesAsn1=m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=m.create(m.Class.UNIVERSAL,m.Type.SET,!0,[]),p=0;p<e.authenticatedAttributes.length;++p){var r=e.authenticatedAttributes[p];r.type===c.pki.oids.messageDigest?r.value=b[e.digestAlgorithm].digest():r.type!==c.pki.oids.signingTime||r.value||(r.value=k);h.value.push(n(r));e.authenticatedAttributesAsn1.value.push(n(r))}h=m.toDer(h).getBytes();e.md.start().update(h)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}b=
677
+}else{e.authenticatedAttributesAsn1=m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var h=m.create(m.Class.UNIVERSAL,m.Type.SET,!0,[]),p=0;p<e.authenticatedAttributes.length;++p){var v=e.authenticatedAttributes[p];v.type===c.pki.oids.messageDigest?v.value=b[e.digestAlgorithm].digest():v.type!==c.pki.oids.signingTime||v.value||(v.value=k);h.value.push(n(v));e.authenticatedAttributesAsn1.value.push(n(v))}h=m.toDer(h).getBytes();e.md.start().update(h)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}b=
678
a;g=a.signers;k=[];for(d=0;d<g.length;++d)k.push(f(g[d]));b.signerInfos=k}},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.");},addCertificate:function(b){"string"===typeof b&&(b=c.pki.certificateFromPem(b));a.certificates.push(b)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.");}}};r.createEncryptedData=function(){var a=null;return a={type:c.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:c.pki.oids["aes256-CBC"]},
679
fromAsn1:function(c){g(a,c,r.asn1.encryptedDataValidator)},decrypt:function(c){void 0!==c&&(a.encryptedContent.key=c);p(a)}}};r.createEnvelopedData=function(){var a=null;return a={type:c.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:c.pki.oids["aes256-CBC"]},fromAsn1:function(c){var d=g(a,c,r.asn1.envelopedDataValidator);c=a;for(var d=d.recipientInfos.value,e=[],f=0;f<d.length;++f)e.push(b(d[f]));c.recipients=e},toAsn1:function(){return m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,
680
!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(a.type).getBytes()),m.create(m.Class.CONTEXT_SPECIFIC,0,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,m.integerToDer(a.version).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SET,!0,e(a.recipients)),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,h(a.encryptedContent))])])])},findRecipient:function(c){for(var b=c.issuer.attributes,d=0;d<a.recipients.length;++d){var e=a.recipients[d],f=e.issuer;if(e.serialNumber===
@@ -726,13 +726,13 @@ v[u]);e=ShortToStr(l)+ShortToStr(e.length+4)+e;c+=e}}}for(r in n){d=n[r][0].toUp
726
function script_decompile(a,b){var c="",d=6,f={};if(0<=b)d=b;else{if(6>a.length)return"# Invalid script length";var n=ReadInt(a,0),p=ReadShort(a,4);if(612182341!=n)return"# Invalid binary script: "+n;if(1!=p)return"# Invalid script version"}for(;d<a.length;){var n=ReadShort(a,d),p=ReadShort(a,d+2),r=ReadShort(a,d+4),l=d+6,k="";0<=b||(c+=":label"+(d-6)+"\n");for(var v=0;v<r;v++){var e=ReadShort(a,l),u=a.substring(l+2,l+2+e),B=u.charCodeAt(0);0==B?k+=" "+u.substring(1):1==B?k+=' "'+u.substring(1)+'"':
727
2==B?k+=" "+ReadInt(u,1):3==B&&(u=ReadInt(u,1),B=f[u],B||(B=":label"+u,f[B]=u),k+=" "+B);l+=2+e}c=1E4>n?c+(script_functionTable1[n]+k+"\n"):2E4<=n?c+(script_functionTable3[n-2E4]+k+"\n"):c+(script_functionTable2[n-1E4]+k+"\n");d+=p;if(0<=b)return c}d=c.split("\n");c="";for(v in d)n=d[v],":"!=n[0]?c+=n+"\n":f[n]&&(c+=n+"\n");return c}
728
var saveAs=saveAs||function(a){if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var b=a.document.createElementNS("http://www.w3.org/1999/xhtml","a"),c="download"in b,d=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),f=a.webkitRequestFileSystem,n=a.requestFileSystem||f||a.mozRequestFileSystem,p=function(b){(a.setImmediate||a.setTimeout)(function(){throw b;},0)},r=0,l=function(b){var c=function(){"string"===typeof b?(a.URL||a.webkitURL||a).revokeObjectURL(b):b.remove()};
729
-a.chrome?c():setTimeout(c,500)},k=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(f){p(f)}}},v=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},e=function(e,h,g){g||(e=v(e));var p=this;g=e.type;var m=!1,u,x,w=function(){k(p,["writestart","progress","write","writeend"])},F=function(){if(x&&d&&"undefined"!==typeof FileReader){var b=
730
-new FileReader;b.onloadend=function(){var a=b.result;x.location.href="data:attachment/file"+a.slice(a.search(/[,;]/));p.readyState=p.DONE;w()};b.readAsDataURL(e);p.readyState=p.INIT}else{if(m||!u)u=(a.URL||a.webkitURL||a).createObjectURL(e);x?x.location.href=u:void 0==a.open(u,"_blank")&&d&&(a.location.href=u);p.readyState=p.DONE;w();l(u)}},A=function(a){return function(){if(p.readyState!==p.DONE)return a.apply(this,arguments)}},J={create:!0,exclusive:!1},y;p.readyState=p.INIT;h||(h="download");if(c)u=
731
-(a.URL||a.webkitURL||a).createObjectURL(e),b.href=u,b.download=h,setTimeout(function(){var a=new MouseEvent("click");b.dispatchEvent(a);w();l(u);p.readyState=p.DONE});else{a.chrome&&g&&"application/octet-stream"!==g&&(y=e.slice||e.webkitSlice,e=y.call(e,0,e.size,"application/octet-stream"),m=!0);f&&"download"!==h&&(h+=".download");if("application/octet-stream"===g||f)x=a;n?(r+=e.size,n(a.TEMPORARY,r,A(function(a){a.root.getDirectory("saved",J,A(function(a){var b=function(){a.getFile(h,J,A(function(a){a.createWriter(A(function(b){b.onwriteend=
732
-function(b){x.location.href=a.toURL();p.readyState=p.DONE;k(p,"writeend",b);l(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&F()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=p["on"+a]});b.write(e);p.abort=function(){b.abort();p.readyState=p.DONE};p.readyState=p.WRITING}),F)}),F)};a.getFile(h,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():F()}))}),F)}),F)):F()}},u=e.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,
729
+a.chrome?c():setTimeout(c,500)},k=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(f){p(f)}}},v=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},e=function(e,h,g){g||(e=v(e));var p=this;g=e.type;var m=!1,u,w,y=function(){k(p,["writestart","progress","write","writeend"])},C=function(){if(w&&d&&"undefined"!==typeof FileReader){var b=
730
+new FileReader;b.onloadend=function(){var a=b.result;w.location.href="data:attachment/file"+a.slice(a.search(/[,;]/));p.readyState=p.DONE;y()};b.readAsDataURL(e);p.readyState=p.INIT}else{if(m||!u)u=(a.URL||a.webkitURL||a).createObjectURL(e);w?w.location.href=u:void 0==a.open(u,"_blank")&&d&&(a.location.href=u);p.readyState=p.DONE;y();l(u)}},A=function(a){return function(){if(p.readyState!==p.DONE)return a.apply(this,arguments)}},L={create:!0,exclusive:!1},z;p.readyState=p.INIT;h||(h="download");if(c)u=
731
+(a.URL||a.webkitURL||a).createObjectURL(e),b.href=u,b.download=h,setTimeout(function(){var a=new MouseEvent("click");b.dispatchEvent(a);y();l(u);p.readyState=p.DONE});else{a.chrome&&g&&"application/octet-stream"!==g&&(z=e.slice||e.webkitSlice,e=z.call(e,0,e.size,"application/octet-stream"),m=!0);f&&"download"!==h&&(h+=".download");if("application/octet-stream"===g||f)w=a;n?(r+=e.size,n(a.TEMPORARY,r,A(function(a){a.root.getDirectory("saved",L,A(function(a){var b=function(){a.getFile(h,L,A(function(a){a.createWriter(A(function(b){b.onwriteend=
732
+function(b){w.location.href=a.toURL();p.readyState=p.DONE;k(p,"writeend",b);l(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&C()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=p["on"+a]});b.write(e);p.abort=function(){b.abort();p.readyState=p.DONE};p.readyState=p.WRITING}),C)}),C)};a.getFile(h,{create:!1},A(function(a){a.remove();b()}),A(function(a){a.code===a.NOT_FOUND_ERR?b():C()}))}),C)}),C)):C()}},u=e.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,
733
b,c){c||(a=v(a));return navigator.msSaveOrOpenBlob(a,b||"download")};u.abort=function(){this.readyState=this.DONE;k(this,"abort")};u.readyState=u.INIT=0;u.WRITING=1;u.DONE=2;u.error=u.onwritestart=u.onprogress=u.onwrite=u.onabort=u.onerror=u.onwriteend=null;return function(a,b,c){return new e(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content);
734
"undefined"!==typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});
735
-var version="0.6.9",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_PolicyCondition CIM_PolicyInSystem CIM_PolicyRule CIM_PolicyRuleInSystem CIM_PolicySet CIM_PolicySetAppliesToElement CIM_PolicySetInSystem CIM_PowerManagementCapabilities CIM_PowerManagementService CIM_PowerSupply CIM_Privilege CIM_PrivilegeManagementCapabilities CIM_PrivilegeManagementService CIM_ProcessIndication CIM_Processor CIM_ProtocolEndpoint CIM_ProvidesServiceToElement CIM_Realizes CIM_RecordForLog CIM_RecordLog CIM_RedirectionService CIM_ReferencedProfile CIM_RegisteredProfile CIM_RemoteAccessAvailableToElement CIM_RemoteIdentity CIM_RemotePort CIM_RemoteServiceAccessPoint CIM_Role CIM_RoleBasedAuthorizationService CIM_RoleBasedManagementCapabilities CIM_RoleLimitedToTarget CIM_SAPAvailableForElement CIM_SecurityService CIM_Sensor CIM_Service CIM_ServiceAccessBySAP CIM_ServiceAccessPoint CIM_ServiceAffectsElement CIM_ServiceAvailableToElement CIM_ServiceSAPDependency CIM_ServiceServiceDependency CIM_SettingData CIM_SharedCredential CIM_SoftwareElement CIM_SoftwareFeature CIM_SoftwareFeatureSoftwareElements CIM_SoftwareIdentity CIM_StatisticalData CIM_StorageExtent CIM_System CIM_SystemBIOS CIM_SystemComponent CIM_SystemDevice CIM_SystemPackaging CIM_UseOfLog CIM_Watchdog CIM_WiFiEndpoint CIM_WiFiEndpointCapabilities CIM_WiFiEndpointSettings CIM_WiFiPort CIM_WiFiPortCapabilities IPS_AdminProvisioningRecord IPS_ClientProvisioningRecord IPS_HostBasedSetupService IPS_HostIPSettings IPS_HTTPProxyService IPS_HTTPProxyAccessPoint IPS_IderSessionUsingPort IPS_IPv6PortSettings IPS_KVMRedirectionSettingData IPS_KvmSessionUsingPort IPS_ManualProvisioningRecord IPS_OptInService IPS_ProvisioningAuditRecord IPS_ProvisioningRecordLog IPS_RasSessionUsingPort IPS_ScreenConfigurationService IPS_ScreenSettingData IPS_SecIOService IPS_SessionUsingPort IPS_SolSessionUsingPort IPS_TLSProvisioningRecord IPS_WatchDogAction".split(" "),disconnecturl=
735
+var version="0.7.3",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_PolicyCondition CIM_PolicyInSystem CIM_PolicyRule CIM_PolicyRuleInSystem CIM_PolicySet CIM_PolicySetAppliesToElement CIM_PolicySetInSystem CIM_PowerManagementCapabilities CIM_PowerManagementService CIM_PowerSupply CIM_Privilege CIM_PrivilegeManagementCapabilities CIM_PrivilegeManagementService CIM_ProcessIndication CIM_Processor CIM_ProtocolEndpoint CIM_ProvidesServiceToElement CIM_Realizes CIM_RecordForLog CIM_RecordLog CIM_RedirectionService CIM_ReferencedProfile CIM_RegisteredProfile CIM_RemoteAccessAvailableToElement CIM_RemoteIdentity CIM_RemotePort CIM_RemoteServiceAccessPoint CIM_Role CIM_RoleBasedAuthorizationService CIM_RoleBasedManagementCapabilities CIM_RoleLimitedToTarget CIM_SAPAvailableForElement CIM_SecurityService CIM_Sensor CIM_Service CIM_ServiceAccessBySAP CIM_ServiceAccessPoint CIM_ServiceAffectsElement CIM_ServiceAvailableToElement CIM_ServiceSAPDependency CIM_ServiceServiceDependency CIM_SettingData CIM_SharedCredential CIM_SoftwareElement CIM_SoftwareFeature CIM_SoftwareFeatureSoftwareElements CIM_SoftwareIdentity CIM_StatisticalData CIM_StorageExtent CIM_System CIM_SystemBIOS CIM_SystemComponent CIM_SystemDevice CIM_SystemPackaging CIM_UseOfLog CIM_Watchdog CIM_WiFiEndpoint CIM_WiFiEndpointCapabilities CIM_WiFiEndpointSettings CIM_WiFiPort CIM_WiFiPortCapabilities IPS_AdminProvisioningRecord IPS_ClientProvisioningRecord IPS_HostBasedSetupService IPS_HostIPSettings IPS_HTTPProxyService IPS_HTTPProxyAccessPoint IPS_IderSessionUsingPort IPS_IPv6PortSettings IPS_KVMRedirectionSettingData IPS_KvmSessionUsingPort IPS_ManualProvisioningRecord IPS_OptInService IPS_ProvisioningAuditRecord IPS_ProvisioningRecordLog IPS_RasSessionUsingPort IPS_ScreenConfigurationService IPS_ScreenSettingData IPS_SecIOService IPS_SessionUsingPort IPS_SolSessionUsingPort IPS_TLSProvisioningRecord IPS_WatchDogAction".split(" "),disconnecturl=
736
null,currentView=0,LoadingHtml="<div style=text-align:center;padding-top:20px>Loading...<div>",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,currentMeshNode=null,webcompilerfeatures="AgentPresence Alarms AuditLog Certificates ComputerSelectorToolbar EventLog EventSubscriptions FileSaver HardwareInfo Look-MeshCentral Mode-MeshCentral2 NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Scripting Scripting-Editor Storage SystemDefense VersionWarning Wireless WsmanBrowser".split(" "),
737
StatusStrs=["Disconnected","Connecting...","Setup...","Connected"],scriptstate,t,t2,rsepass=null;
738
function startup(){var a=document.getElementsByTagName("input");for(t=0;t<a.length;t++)a[t].id&&(window[a[t].id]=a[t]);urlvars=getUrlVars();for(var b in AllWsman)a=document.createElement("option"),a.text=AllWsman[b],a.id="WSB-"+AllWsman[b],Q(22).add(a);document.addEventListener("dragover",haltEvent,!1);document.addEventListener("dragleave",haltEvent,!1);document.addEventListener("drop",documentFileSelectHandler,!1);Q("p16").addEventListener("dragover",haltEvent,!1);Q("p16").addEventListener("dragleave",
@@ -941,23 +941,25 @@ function browserResponse(a,b,c,d){QE(23,!0);a="";for(var f in c)b=c[f],a+="<h2>"
941
function wsmanFilter(){var a=c0.value.toLowerCase(),b;for(b in AllWsman)QV("WSB-"+AllWsman[b],""==a||0<=AllWsman[b].toLowerCase().indexOf(a))}var xxRemoteAccess=null,xxEnvironementDetection=null,xxCiraServers=null,xxUserInitiatedCira=null,xxUserInitiatedEnabledState={32768:"Disabled",32769:"BIOS enabled",32770:"OS enable",32771:"BIOS & OS enabled"},xxRemoteAccessCredentiaLinks=null,xxMPSUserPass=null,xxPolicies=null;
942
function PullRemoteAccess(){var a="*AMT_EnvironmentDetectionSettingData AMT_ManagementPresenceRemoteSAP AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule *AMT_UserInitiatedConnectionService AMT_MPSUsernamePassword".split(" ");11<amtversion&&a.push("*IPS_HTTPProxyService","IPS_HTTPProxyAccessPoint");amtstack.BatchEnum(null,a,processRemote1)}
943
function processRemote1(a,b,c,d){if(400!=d&&!errcheck(d,a)&&void 0!=c.AMT_UserInitiatedConnectionService&&void 0!=c.AMT_UserInitiatedConnectionService.response){QV("go17",!0);xxRemoteAccess=c;xxEnvironementDetection=c.AMT_EnvironmentDetectionSettingData.response;xxEnvironementDetection.DetectionStrings=MakeToArray(xxEnvironementDetection.DetectionStrings);xxCiraServers=c.AMT_ManagementPresenceRemoteSAP.responses;xxUserInitiatedCira=c.AMT_UserInitiatedConnectionService.response;xxRemoteAccessCredentiaLinks=
944
-c.AMT_RemoteAccessCredentialContext.responses;xxMPSUserPass=c.AMT_MPSUsernamePassword.responses;xxPolicies={User:[],Alert:[],Periodic:[]};for(var f in c.AMT_RemoteAccessPolicyAppliesToMPS.responses)b=c.AMT_RemoteAccessPolicyAppliesToMPS.responses[f],a=getItem(xxCiraServers,"Name",getItem(b.ManagedElement.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value),b=getItem(b.PolicySet.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyRuleName").Value.split(" ")[0],xxPolicies[b].push(a);
945
-updateRemoteAccess()}}
944
+c.AMT_RemoteAccessCredentialContext.responses;xxMPSUserPass=c.AMT_MPSUsernamePassword.responses;xxPolicies={User:[],Alert:[],Periodic:[]};for(var f in c.AMT_RemoteAccessPolicyAppliesToMPS.responses)b=c.AMT_RemoteAccessPolicyAppliesToMPS.responses[f],a=Clone(getItem(xxCiraServers,"Name",getItem(b.ManagedElement.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value)),a.MpsType=b.MpsType,b=getItem(b.PolicySet.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyRuleName").Value.split(" ")[0],
945
+xxPolicies[b].push(a);updateRemoteAccess()}}
946
function updateRemoteAccess(){if(null!=xxEnvironementDetection){var a,b="Disabled",c=xxRemoteAccess.IPS_HTTPProxyService&&xxRemoteAccess.IPS_HTTPProxyAccessPoint;xxEnvironementDetection.DetectionStrings&&0<xxEnvironementDetection.DetectionStrings.length&&(b="Enabled, "+xxEnvironementDetection.DetectionStrings.length+" domain"+(1<xxEnvironementDetection.DetectionStrings.length?"s":""));a=""+TableStart();a+=TableEntry("Environment detection",addLink(b,"editEnvironmentDetection()"));a+=TableEntry("User initiation options",
947
-addLinkConditional(xxUserInitiatedEnabledState[xxUserInitiatedCira.EnabledState],"editUserInitiatedCira()",xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.User.length){var b="",d;for(d in xxPolicies.User)0<b.length&&(b+=", "),b+=xxPolicies.User[d].AccessInfo}a+=TableEntry("User initiated connection",addLinkConditional(b,'editMpsPolicy("User")',xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.Alert.length)for(d in b="",xxPolicies.Alert)0<b.length&&(b+=", "),b+=xxPolicies.Alert[d].AccessInfo;
948
-a+=TableEntry("Alert initiated connection",addLinkConditional(b,'editMpsPolicy("Alert")',xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.Periodic.length)for(d in b="",xxPolicies.Periodic)0<b.length&&(b+=", "),b+=xxPolicies.Periodic[d].AccessInfo;var f=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName","Periodic");if(f){var n=atob(f.ExtendedData);0==ReadInt(n,0)&&(b+=", each "+ReadInt(n,4)+" seconds");1==ReadInt(n,0)&&(f=ReadInt(n,4),n=ReadInt(n,8),10>n&&(n="0"+n),b+=
949
-", at "+f+":"+n+" daily")}a+=TableEntry("Periodic connection",addLinkConditional(b,'editMpsPolicy("Periodic")',xxAccountAdminName));a+=TableEnd();a=a+"<br>"+TableStart2();a+="<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT remote management servers.<br><br>";if(0==xxCiraServers.length)a+="<div style=padding-left:15px><br><i>No remote servers found.</i></div><br>";else for(d in xxCiraServers)b=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(b+=", "+xxCiraServers[d].CN),a+="<div class=itemBar onclick=showServerDetails("+
950
-d+")><div style=padding-top:3px><b>"+xxCiraServers[d].AccessInfo+"</b>"+EscapeHtml(b)+"</div></div>";if(c)if(a+="<br>Manage HTTP proxies used for management connections.<br><br>",b=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==b.length)a+="<div style=padding-left:15px><br><i>No proxies configured.</i></div><br>";else for(d in b)a+="<div class=itemBar onclick=showProxyDetails("+d+")><div style=padding-top:3px><b>"+EscapeHtml(b[d].AccessInfo)+":"+b[d].Port+"</b> / "+EscapeHtml(b[d].NetworkDnsSuffix)+
951
-"</div></div>";d="";xxAccountAdminName&&(d=AddButton("Add Server...","AddRemoteAccessServer()"),c&&(d+=AddButton("Add Proxy...","AddRemoteAccessProxy()")));a+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(28,a)}}var xxEditMpsPolicyType;
952
-function editMpsPolicy(a){var b="",c=xxEditMpsPolicyType=a;"User"==c&&(c="User Initiated");var d=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",c),b=b+"<div style=height:26px><select id=d2server1 style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=-1>(None)",f;for(f in xxCiraServers)b+="<option value="+f+""+(xxPolicies[a][0]&&xxPolicies[a][0].Name==xxCiraServers[f].Name?" selected":"")+">"+xxCiraServers[f].AccessInfo;b+="</select><div>Primary server</div></div>";
953
-if(1<xxCiraServers.length){b+="<div style=height:26px><select id=d2server2 style=float:right;width:206px onchange=editMpsPolicyUpdate()>";b+="<option value=-1>(None)";for(f in xxCiraServers)b+="<option value="+f+""+(xxPolicies[a][1]&&xxPolicies[a][1].Name==xxCiraServers[f].Name?" selected":"")+">"+xxCiraServers[f].AccessInfo;b+="</select><div>Secondary server</div></div>"}c=0;d&&(c=d.TunnelLifeTime);b+="<div style=height:26px><input id=d2lifetime style=float:right;width:200px onchange=editMpsPolicyUpdate() value="+
954
-c+">";b+="<div>Tunnel lifetime (Seconds)</div></div>";"Periodic"==a&&(f=0,c=3600,d&&(d=atob(d.ExtendedData),f=ReadInt(d,0),c=ReadInt(d,4),1==f&&(d=ReadInt(d,8),10>d&&(d="0"+d),c+=":"+d)),b+="<div style=height:26px><select id=d2ttype style=float:right;width:206px onchange=editMpsPolicyUpdate()>",b+="<option value=0"+(0==f?" selected":"")+">Periodic, time interval<option value=1"+(1==f?" selected":"")+">Time of day, once a day",b+="</select><div>Trigger type</div></div><div style=height:26px><input id=d2timer style=float:right;width:200px onkeyup=editMpsPolicyUpdate() value="+
955
-c+"><div id=ttypelabel></div></div>");setDialogMode(11,a+" Connection",3,editMpsPolicyOk,b);editMpsPolicyUpdate()}
956
-function editMpsPolicyUpdate(){var a=1>=xxCiraServers.length||-1==Q("d2server1").value||Q("d2server1").value!=Q("d2server2").value;if(1==a&&"Periodic"==xxEditMpsPolicyType&&1==Q("d2ttype").value){var b=Q("d2timer").value.split(":");if(2!=b.length)a=!1;else{var c=parseInt(b[0]),b=parseInt(b[1]);if(0>c||23<c||0>b||59<b)a=!1}}QE("c37",a);1<xxCiraServers.length&&QE("d2server2",-1!=Q("d2server1").value);"Periodic"==xxEditMpsPolicyType&&(QE("d2timer",-1!=Q("d2server1").value),QH("ttypelabel",
957
-0==Q("d2ttype").value?"Trigger interval (Seconds)":"Time of day (HH:MM)"),QE("d2ttype",-1!=Q("d2server1").value));QE("d2lifetime",-1!=Q("d2server1").value)}function editMpsPolicyOk(){var a=xxEditMpsPolicyType;"User"==a&&(a="User Initiated");getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",a)?amtstack.Delete("AMT_RemoteAccessPolicyRule",{PolicyRuleName:a},editMpsPolicyOk2):editMpsPolicyOk2()}
958
-function editMpsPolicyOk2(a,b,c,d){-1==Q("d2server1").value?PullRemoteAccess():(a=0,"Alert"==xxEditMpsPolicyType&&(a=1),"Periodic"==xxEditMpsPolicyType&&(a=2),b=null,2==a&&(b=Q("d2ttype").value,c=IntToStr(Q("d2timer").value),1==b&&(c=Q("d2timer").value.split(":"),c=IntToStr(parseInt(c[0]))+IntToStr(parseInt(c[1]))),b=btoa(IntToStr(b)+c)),c=[],0<=Q("d2server1").value&&c.push('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
959
-xxCiraServers[Q("d2server1").value].Name+"</Selector></SelectorSet></ReferenceParameters>"),0<=Q("d2server1").value&&1<xxCiraServers.length&&0<=Q("d2server2").value&&c.push('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
960
-xxCiraServers[Q("d2server2").value].Name+"</Selector></SelectorSet></ReferenceParameters>"),amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(a,Q("d2lifetime").value,b,c,PullRemoteAccess))}var editEnvironmentDetectionTmp;
947
+addLinkConditional(xxUserInitiatedEnabledState[xxUserInitiatedCira.EnabledState],"editUserInitiatedCira()",xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.User.length){var b="",d;for(d in xxPolicies.User)0<b.length&&(b+=", "),b+=xxPolicies.User[d].AccessInfo,1==xxPolicies.User[d].MpsType&&(b+=" (CILA)")}a+=TableEntry("User initiated connection",addLinkConditional(b,'editMpsPolicy("User")',xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.Alert.length)for(d in b="",xxPolicies.Alert)0<b.length&&
948
+(b+=", "),b+=xxPolicies.Alert[d].AccessInfo,1==xxPolicies.Alert[d].MpsType&&(b+=" (CILA)");a+=TableEntry("Alert initiated connection",addLinkConditional(b,'editMpsPolicy("Alert")',xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.Periodic.length)for(d in b="",xxPolicies.Periodic)0<b.length&&(b+=", "),b+=xxPolicies.Periodic[d].AccessInfo,1==xxPolicies.Periodic[d].MpsType&&(b+=" (CILA)");var f=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName","Periodic");if(f){var n=atob(f.ExtendedData);
949
+0==ReadInt(n,0)&&(b+=", each "+ReadInt(n,4)+" seconds");1==ReadInt(n,0)&&(f=ReadInt(n,4),n=ReadInt(n,8),10>n&&(n="0"+n),b+=", at "+f+":"+n+" daily")}a+=TableEntry("Periodic connection",addLinkConditional(b,'editMpsPolicy("Periodic")',xxAccountAdminName));a+=TableEnd();a=a+"<br>"+TableStart2();a+="<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT remote management servers.<br><br>";if(0==xxCiraServers.length)a+="<div style=padding-left:15px><br><i>No remote servers found.</i></div><br>";
950
+else for(d in xxCiraServers)b=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(b+=", "+xxCiraServers[d].CN),a+="<div class=itemBar onclick=showServerDetails("+d+")><div style=padding-top:3px><b>"+xxCiraServers[d].AccessInfo+"</b>"+EscapeHtml(b)+"</div></div>";if(c)if(a+="<br>Manage HTTP proxies used for management connections.<br><br>",b=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==b.length)a+="<div style=padding-left:15px><br><i>No proxies configured.</i></div><br>";else for(d in b)a+="<div class=itemBar onclick=showProxyDetails("+
951
+d+")><div style=padding-top:3px><b>"+EscapeHtml(b[d].AccessInfo)+":"+b[d].Port+"</b> / "+EscapeHtml(b[d].NetworkDnsSuffix)+"</div></div>";d="";xxAccountAdminName&&(d=AddButton("Add Server...","AddRemoteAccessServer()"),c&&(d+=AddButton("Add Proxy...","AddRemoteAccessProxy()")));a+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(28,a)}}var xxEditMpsPolicyType;
952
+function editMpsPolicy(a){var b="",c=11<amtversion||11==amtversion&&6<=amtversion,d=xxEditMpsPolicyType=a;"User"==d&&(d="User Initiated");var d=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",d),b=b+"<div style=height:26px><select id=d2server1 style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=-1>(None)",f;for(f in xxCiraServers)b+="<option value="+f+""+(xxPolicies[a][0]&&xxPolicies[a][0].Name==xxCiraServers[f].Name?" selected":"")+">"+xxCiraServers[f].AccessInfo;
953
+b+="</select><div>Primary server</div></div>";c&&(b+="<div style=height:26px><select id=d2server1cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - External<option value=1"+(xxPolicies[a][0]&&1==xxPolicies[a][0].MpsType?" selected":"")+">CILA - Internal</select><div>Primary MPS Type</div></div>");if(1<xxCiraServers.length){b+="<div style=height:26px><select id=d2server2 style=float:right;width:206px onchange=editMpsPolicyUpdate()>";b+="<option value=-1>(None)";
954
+for(f in xxCiraServers)b+="<option value="+f+""+(xxPolicies[a][1]&&xxPolicies[a][1].Name==xxCiraServers[f].Name?" selected":"")+">"+xxCiraServers[f].AccessInfo;b+="</select><div>Secondary server</div></div>";c&&(b+="<div style=height:26px><select id=d2server2cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - External<option value=1"+(xxPolicies[a][1]&&1==xxPolicies[a][1].MpsType?" selected":"")+">CILA - Internal</select><div>Secondary MPS Type</div></div>")}f=
955
+0;d&&(f=d.TunnelLifeTime);b+="<div style=height:26px><input id=d2lifetime style=float:right;width:200px onchange=editMpsPolicyUpdate() value="+f+">";b+="<div>Tunnel lifetime (Seconds)</div></div>";"Periodic"==a&&(c=0,f=3600,d&&(d=atob(d.ExtendedData),c=ReadInt(d,0),f=ReadInt(d,4),1==c&&(d=ReadInt(d,8),10>d&&(d="0"+d),f+=":"+d)),b+="<div style=height:26px><select id=d2ttype style=float:right;width:206px onchange=editMpsPolicyUpdate()>",b+="<option value=0"+(0==c?" selected":"")+">Periodic, time interval<option value=1"+
956
+(1==c?" selected":"")+">Time of day, once a day",b+="</select><div>Trigger type</div></div><div style=height:26px><input id=d2timer style=float:right;width:200px onkeyup=editMpsPolicyUpdate() value="+f+"><div id=ttypelabel></div></div>");setDialogMode(11,a+" Connection",3,editMpsPolicyOk,b);editMpsPolicyUpdate()}
957
+function editMpsPolicyUpdate(){var a=11<amtversion||11==amtversion&&6<=amtversion,b=1>=xxCiraServers.length||-1==Q("d2server1").value||Q("d2server1").value!=Q("d2server2").value;if(1==b&&"Periodic"==xxEditMpsPolicyType&&1==Q("d2ttype").value){var c=Q("d2timer").value.split(":");if(2!=c.length)b=!1;else{var d=parseInt(c[0]),c=parseInt(c[1]);if(0>d||23<d||0>c||59<c)b=!1}}QE("c37",b);1<xxCiraServers.length&&QE("d2server2",-1!=Q("d2server1").value);"Periodic"==xxEditMpsPolicyType&&(QE("d2timer",
958
+-1!=Q("d2server1").value),QH("ttypelabel",0==Q("d2ttype").value?"Trigger interval (Seconds)":"Time of day (HH:MM)"),QE("d2ttype",-1!=Q("d2server1").value));QE("d2lifetime",-1!=Q("d2server1").value);a&&(QE("d2server1cira",-1<Q("d2server1").value),1<xxCiraServers.length&&QE("d2server2cira",-1<Q("d2server1").value&&-1<Q("d2server2").value))}
959
+function editMpsPolicyOk(){var a=xxEditMpsPolicyType;"User"==a&&(a="User Initiated");getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",a)?amtstack.Delete("AMT_RemoteAccessPolicyRule",{PolicyRuleName:a},editMpsPolicyOk2):editMpsPolicyOk2()}
960
+function editMpsPolicyOk2(a,b,c,d){a=11<amtversion||11==amtversion&&6<=amtversion;if(-1==Q("d2server1").value)PullRemoteAccess();else{b=0;"Alert"==xxEditMpsPolicyType&&(b=1);"Periodic"==xxEditMpsPolicyType&&(b=2);c=null;2==b&&(c=Q("d2ttype").value,d=IntToStr(Q("d2timer").value),1==c&&(d=Q("d2timer").value.split(":"),d=IntToStr(parseInt(d[0]))+IntToStr(parseInt(d[1]))),c=btoa(IntToStr(c)+d));var f,n;0<=Q("d2server1").value&&(f='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
961
+xxCiraServers[Q("d2server1").value].Name+"</Selector></SelectorSet></ReferenceParameters>");0<=Q("d2server1").value&&1<xxCiraServers.length&&0<=Q("d2server2").value&&(n='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
962
+xxCiraServers[Q("d2server2").value].Name+"</Selector></SelectorSet></ReferenceParameters>");d=[];var p=[];a?f&&(0==Q("d2server1cira").value?d.push(f):p.push(f),n&&(0==Q("d2server2cira").value?d.push(n):p.push(n))):f&&(d.push(f),n&&d.push(n));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(b,Q("d2lifetime").value,c,d,p,PullRemoteAccess)}}var editEnvironmentDetectionTmp;
963
function editEnvironmentDetection(a){1!=a&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var b="";xxAccountAdminName&&(b+="Enter up to 4 intranet domain suffix. If the computer is outside these domains, Intel® AMT local ports will be closed and remote server connections will be active.<br><br>");0==editEnvironmentDetectionTmp.length&&(b+="<i>No intranet domains, Environemnt detection disabled.</i><br>");for(var c in editEnvironmentDetectionTmp)b+=
964
"<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Remove","editEnvironmentDetectionRemove("+c+")")+"</div><div style=padding-top:3px;max-width:260px;overflow:hidden title='"+editEnvironmentDetectionTmp[c]+"'><b>"+editEnvironmentDetectionTmp[c]+"</b></div></div>";xxAccountAdminName&&4>editEnvironmentDetectionTmp.length&&(b+="<br><input id=edInput placeholder=intranet.org style=width:276px onkeyup=edInputChg() maxlength=63><input type=button id=edAdd value=Add style=width:80px;margin-left:5px onclick=editEnvironmentDetectionAdd()>");
965
1==a?QH(39,b):setDialogMode(11,"Environment Detection",xxAccountAdminName?3:1,editEnvironmentDetectionDlg,b);edInputChg()}function editEnvironmentDetectionDlg(){if(xxAccountAdminName){var a=Clone(xxEnvironementDetection);a.DetectionStrings=editEnvironmentDetectionTmp;amtstack.Put("AMT_EnvironmentDetectionSettingData",a,editEnvironmentDetectionDlg2,0,1)}}
@@ -1107,7 +1109,7 @@ function goiFrame(a,b,c){if(!xxdialogMode){go(b);if(1==a.shiftKey||0==Q(13).src.
1109
function portsFromHost(a,b){var c=decodeURIComponent(a).split(":"),d=0==b?16992:16993,f=0==b?16994:16995;1<c.length&&(d=parseInt(c[1]));2<c.length&&(f=parseInt(c[2]));return{host:c[0],http:d,redir:f}}function addLink(a,b){return"<a style=cursor:pointer;color:blue onclick='"+b+"'>♦ "+a+"</a>"}function addLinkConditional(a,b,c){return c?addLink(a,b):a}function haltEvent(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}
1110
function addOption(a,b,c){var d=document.createElement("option");d.text=b;d.value=c;Q(a).add(d)}function addDisabledOption(a,b,c){var d=document.createElement("option");d.text=b;d.value=c;d.disabled=1;Q(a).add(d)}function passwordcheck(a){if(8>a.length)return!1;var b=0,c=0,d=0,f=0,n;for(n in a){var p=a.charCodeAt(n);64<p&&91>p?b=1:96<p&&123>p?c=1:47<p&&58>p?d=1:f=1}return 4==b+c+d+f}
1111
function methodcheck(a){return a&&null!=a&&a.Body&&0!=a.Body.ReturnValue?(messagebox("Call Error",a.Header.Method+": "+(a.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}function TableStart2(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}
1110
-function TableEntry(a,b){return"<tr><td class=r1><p>"+a+"<td class=r1>"+b}function FullTable(a,b){var c=TableStart();for(i in a)i&&a[i]&&(c+=TableEntry(i,a[i]));return c+TableEnd(b)}function TableEnd(a){return"<tr><td colspan=2><p>"+(a?a:"")+"</table>"}function AddButton(a,b){return"<input type=button value='"+a+"' onclick='"+b+"' style=margin:4px>"}function AddButton2(a,b){return"<input type=button value='"+a+"' onclick='"+b+"'>"}
1112
+function TableEntry(a,b){return"<tr><td class=r1><p>"+a+"<td class=r1>"+b}function FullTable(a,b){var c=TableStart();for(i in a)i&&a[i]&&(c+=TableEntry(i,a[i]));return c+TableEnd(b)}function TableEnd(a){return"<tr><td colspan=2><p>"+(a?a:"")+"</table>"}function AddButton(a,b){return"<input type=button value='"+a+"' onclick='"+b+"' style=margin:4px>"}function AddButton2(a,b,c){return"<input type=button value='"+a+"' onclick='"+b+"' "+c+">"}
1113
function AddRefreshButton(a){return"<input type=button name=refreshbtn value=Refresh onclick='refreshButtons(false);"+a+"' style=margin:4px "+(0==refreshButtonsState?"disabled":"")+">"}function MoreStart(){return'<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>▼ More</a><div id=morexxx2 style=display:none><br><hr>'}
1114
function MoreEnd(){return'<a style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>▲ Less</a></div>'}function getSelectedOptions(a){for(var b=[],c,d=0,f=a.options.length;d<f;d++)c=a.options[d],c.selected&&b.push(c.value);return b}function getInstance(a,b){for(var c in a)if(a[c].InstanceID==b)return a[c];return null}function getItem(a,b,c){for(var d in a)if(a[d][b]==c)return a[d];return null}
1115
function guidToStr(a){return a.substring(6,8)+a.substring(4,6)+a.substring(2,4)+a.substring(0,2)+"-"+a.substring(10,12)+a.substring(8,10)+"-"+a.substring(14,16)+a.substring(12,14)+"-"+a.substring(16,20)+"-"+a.substring(20)}function getUrlVars(){for(var a,b=[],c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),d=0;d<c.length;d++)a=c[d].indexOf("="),0<a&&(b[c[d].substring(0,a)]=c[d].substring(a+1,c[d].length));return b}
views/default.handlebars
+5
-1
@@ -1936,6 +1936,10 @@
1936
for (var i in multiDesktop) {
1937
// If a device is no longer viewed, disconnect it.
1938
if (multiDesktop[i].xxdelete == true) { multiDesktop[i].Stop(); delete multiDesktop[i]; }
1939
+ else if (debugmode && multiDesktop[i].m && multiDesktop[i].m.onScreenSizeChange) {
1940
+ // Adjust screen size change (JOKO) - This is not good.
1941
+ multiDesktop[i].m.onScreenSizeChange();
1942
+ }
1943
}
1944
deskAdjust();
1945
} else {
@@ -2197,7 +2201,7 @@
2201
2202
// OSX agent install
2203
x += "<div id=agins_osx style=display:none>To add a new computer to device group \"" + EscapeHtml(mesh.name) + "\", download the mesh agent and install it the computer to manage. This agent installer has server and mesh information embedded within it.<br /><br />";
2200
- x += addHtmlValue('Mesh Agent', '<a href="meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '" target="_blank" title="64bit version of OSX Mesh Agent">OSX Agent (64bit) - TEST BUILD</a>');
2204
+ x += addHtmlValue('Mesh Agent', '<a href="meshosxagent?id=16&meshid=' + meshid.split('/')[2] + '" target="_blank" title="64bit version of OSX Mesh Agent">OSX Agent (64bit)</a>');
2205
x += "</div>";
2206
2207
// Windows agent uninstall
webserver.js
+8
-5
@@ -1682,12 +1682,13 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1682
// Skip all folder entries
1683
zipfile.readEntry();
1684
} else {
1685
- if (entry.fileName == 'Meshcentral_MeshAgent.mpkg/Contents/distribution.dist') {
1685
+ if (entry.fileName == 'MeshAgent.mpkg/Contents/distribution.dist') {
1686
// This is a special file entry, we need to fix it.
1687
zipfile.openReadStream(entry, function (err, readStream) {
1688
readStream.on("data", function (data) { if (readStream.xxdata) { readStream.xxdata += data; } else { readStream.xxdata = data; } });
1689
readStream.on("end", function () {
1690
- var welcomemsg = 'Welcome to the MeshCentral agent for OSX\\\n\\\nThis installer will install the mesh agent for "' + mesh.name + '" and allow the administrator to remotely monitor and control this computer over the internet. For more information, go to info.meshcentral.com.\\\n\\\nThis software is provided under Apache 2.0 license.\\\n';
1690
+ var meshname = mesh.name.split(']').join('').split('[').join(''); // We can't have ']]' in the string since it will terminate the CDATA.
1691
+ var welcomemsg = 'Welcome to the MeshCentral agent for MacOS\n\nThis installer will install the mesh agent for "' + meshname + '" and allow the administrator to remotely monitor and control this computer over the internet. For more information, go to https://www.meshcommander.com/meshcentral2.\n\nThis software is provided under Apache 2.0 license.\n';
1692
var installsize = Math.floor((argentInfo.size + meshsettings.length) / 1024);
1693
archive.append(readStream.xxdata.toString().split('###WELCOMEMSG###').join(welcomemsg).split('###INSTALLSIZE###').join(installsize), { name: entry.fileName });
1694
zipfile.readEntry();
@@ -1697,15 +1698,17 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1698
// Normal file entry
1699
zipfile.openReadStream(entry, function (err, readStream) {
1700
if (err) { throw err; }
1700
- archive.append(readStream, { name: entry.fileName });
1701
+ var options = { name: entry.fileName };
1702
+ if (entry.fileName.endsWith('postflight') || entry.fileName.endsWith('Uninstall.command')) { options.mode = 493; }
1703
+ archive.append(readStream, options);
1704
readStream.on('end', function () { zipfile.readEntry(); });
1705
});
1706
}
1707
}
1708
});
1709
zipfile.on("end", function () {
1707
- archive.file(argentInfo.path, { name: "Meshcentral_MeshAgent.mpkg/Contents/Packages/meshagentosx64.pkg/Contents/meshagent_osx64.bin" });
1708
- archive.append(meshsettings, { name: "Meshcentral_MeshAgent.mpkg/Contents/Packages/meshagentosx64.pkg/Contents/meshagent_osx64.msh" });
1710
+ archive.file(argentInfo.path, { name: "MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64.bin" });
1711
+ archive.append(meshsettings, { name: "MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64.msh" });
1712
archive.finalize();
1713
});
1714
});