diff --git a/agents/MeshAgentOSXPackager.zip b/agents/MeshAgentOSXPackager.zip index 04121d9d..e21ec2db 100644 Binary files a/agents/MeshAgentOSXPackager.zip and b/agents/MeshAgentOSXPackager.zip differ diff --git a/agents/meshcore.js b/agents/meshcore.js index af8dca97..b05c0b99 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -631,7 +631,7 @@ function createMeshCore(agent) { this.removeAllListeners('data'); this.on('data', onTunnelControlData); //this.write('MeshCore Terminal Hello'); - if (process.platform != 'win32') { this.httprequest.process.stdin.write("stty erase ^H\nalias ls='ls --color=auto'\nclear\n"); } + if (process.platform == 'linux') { this.httprequest.process.stdin.write("stty erase ^H\nalias ls='ls --color=auto'\nclear\n"); } } else if (this.httprequest.protocol == 2) { // Remote desktop using native pipes diff --git a/agents/modules_meshcmd/service-host.js b/agents/modules_meshcmd/service-host.js index 7bfe0e49..a4098391 100644 --- a/agents/modules_meshcmd/service-host.js +++ b/agents/modules_meshcmd/service-host.js @@ -187,9 +187,9 @@ function serviceHost(serviceName) console.log(e); process.exit(); } - if (process.platform == 'win32') + if (process.platform == 'win32' || process.platform == 'darwin') { - // Only do this on Windows, becuase Linux is async... It'll complete later + // Only do this on Windows/MacOS, becuase Linux is async... It'll complete later console.log(this._ServiceOptions.name + ' installed'); process.exit(); } @@ -207,9 +207,9 @@ function serviceHost(serviceName) console.log(e); process.exit(); } - if (process.platform == 'win32') + if (process.platform == 'win32' || process.platform == 'darwin') { - // Only do this on Windows, becuase Linux is async... It'll complete later + // Only do this on Windows/MacOS, becuase Linux is async... It'll complete later console.log(this._ServiceOptions.name + ' uninstalled'); process.exit(); } @@ -251,138 +251,141 @@ function serviceHost(serviceName) }); return; } - - var moduleName = this._ServiceOptions ? this._ServiceOptions.name : process.execPath.substring(1 + process.execPath.lastIndexOf('/')); - - for (var i = 0; i < process.argv.length; ++i) + else if (process.platform == 'linux') { - switch(process.argv[i]) - { - case 'start': - case '-d': - var child = require('child_process').execFile(process.execPath, [moduleName], { type: require('child_process').SpawnTypes.DETACHED }); - var pstream = null; - try - { - pstream = require('fs').createWriteStream('/var/run/' + moduleName + '.pid', { flags: 'w' }); - } - catch(e) - { - } - if (pstream == null) - { - pstream = require('fs').createWriteStream('.' + moduleName + '.pid', { flags: 'w' }); - } - pstream.end(child.pid.toString()); + var moduleName = this._ServiceOptions ? this._ServiceOptions.name : process.execPath.substring(1 + process.execPath.lastIndexOf('/')); - console.log(moduleName + ' started!'); - process.exit(); - break; - case 'stop': - case '-s': - var pid = null; - try - { - pid = parseInt(require('fs').readFileSync('/var/run/' + moduleName + '.pid', { flags: 'r' })); - require('fs').unlinkSync('/var/run/' + moduleName + '.pid'); - } - catch(e) - { - } - if(pid == null) - { - try - { - pid = parseInt(require('fs').readFileSync('.' + moduleName + '.pid', { flags: 'r' })); - require('fs').unlinkSync('.' + moduleName + '.pid'); + for (var i = 0; i < process.argv.length; ++i) { + switch (process.argv[i]) { + case 'start': + case '-d': + var child = require('child_process').execFile(process.execPath, [moduleName], { type: require('child_process').SpawnTypes.DETACHED }); + var pstream = null; + try { + pstream = require('fs').createWriteStream('/var/run/' + moduleName + '.pid', { flags: 'w' }); } - catch(e) - { + catch (e) { } - } + if (pstream == null) { + pstream = require('fs').createWriteStream('.' + moduleName + '.pid', { flags: 'w' }); + } + pstream.end(child.pid.toString()); - if(pid) - { - process.kill(pid); - console.log(moduleName + ' stopped'); + console.log(moduleName + ' started!'); + process.exit(); + break; + case 'stop': + case '-s': + var pid = null; + try { + pid = parseInt(require('fs').readFileSync('/var/run/' + moduleName + '.pid', { flags: 'r' })); + require('fs').unlinkSync('/var/run/' + moduleName + '.pid'); + } + catch (e) { + } + if (pid == null) { + try { + pid = parseInt(require('fs').readFileSync('.' + moduleName + '.pid', { flags: 'r' })); + require('fs').unlinkSync('.' + moduleName + '.pid'); + } + catch (e) { + } + } + + if (pid) { + process.kill(pid); + console.log(moduleName + ' stopped'); + } + else { + console.log(moduleName + ' not running'); + } + process.exit(); + break; + } + } + + if (serviceOperation == 0) { + // This is non-windows, so we need to check how this binary was started to determine if this was a service start + + // Start by checking if we were started with start/stop + var pid = null; + try { + pid = parseInt(require('fs').readFileSync('/var/run/' + moduleName + '.pid', { flags: 'r' })); + } + catch (e) { + } + if (pid == null) { + try { + pid = parseInt(require('fs').readFileSync('.' + moduleName + '.pid', { flags: 'r' })); } - else - { - console.log(moduleName + ' not running'); + catch (e) { } - process.exit(); - break; + } + + if (pid != null && pid == process.pid) { + this.emit('serviceStart'); + } + else { + // Now we need to check if we were started with systemd + if (require('process-manager').getProcessInfo(1).Name == 'systemd') { + this._checkpid = require('child_process').execFile('/bin/sh', ['sh'], { type: require('child_process').SpawnTypes.TERM }); + this._checkpid.result = ''; + this._checkpid.parent = this; + this._checkpid.on('exit', function onCheckPIDExit() { + var lines = this.result.split('\r\n'); + for (i in lines) { + if (lines[i].startsWith(' Main PID:')) { + var tokens = lines[i].split(' '); + if (parseInt(tokens[3]) == process.pid) { + this.parent.emit('serviceStart'); + } + else { + this.parent.emit('normalStart'); + } + delete this.parent._checkpid; + return; + } + } + this.parent.emit('normalStart'); + delete this.parent._checkpid; + }); + this._checkpid.stdout.on('data', function (chunk) { this.parent.result += chunk.toString(); }); + this._checkpid.stdin.write("systemctl status " + moduleName + " | grep 'Main PID:'\n"); + this._checkpid.stdin.write('exit\n'); + } + else { + // This isn't even a systemd platform, so this couldn't have been a service start + this.emit('normalStart'); + } + } } } - - if(serviceOperation == 0) + else if(process.platform == 'darwin') { - // This is non-windows, so we need to check how this binary was started to determine if this was a service start + // First let's fetch all the PIDs of running services + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('launchctl list\nexit\n'); + child.waitExit(); - // Start by checking if we were started with start/stop - var pid = null; - try + var lines = child.stdout.str.split('\n'); + var tokens, i; + var p = {}; + for (i = 1; i < lines.length; ++i) { - pid = parseInt(require('fs').readFileSync('/var/run/' + moduleName + '.pid', { flags: 'r' })); + tokens = lines[i].split('\t'); + if (tokens[0] && tokens[0] != '-') { p[tokens[0]] = tokens[0]; } } - catch (e) - { - } - if (pid == null) - { - try - { - pid = parseInt(require('fs').readFileSync('.' + moduleName + '.pid', { flags: 'r' })); - } - catch (e) - { - } - } - - if (pid != null && pid == process.pid) + + if(p[process.pid.toString()]) { + // We are a service! this.emit('serviceStart'); } else { - // Now we need to check if we were started with systemd - if (require('process-manager').getProcessInfo(1).Name == 'systemd') - { - this._checkpid = require('child_process').execFile('/bin/sh', ['sh'], { type: require('child_process').SpawnTypes.TERM }); - this._checkpid.result = ''; - this._checkpid.parent = this; - this._checkpid.on('exit', function onCheckPIDExit() - { - var lines = this.result.split('\r\n'); - for (i in lines) - { - if(lines[i].startsWith(' Main PID:')) - { - var tokens = lines[i].split(' '); - if (parseInt(tokens[3]) == process.pid) - { - this.parent.emit('serviceStart'); - } - else - { - this.parent.emit('normalStart'); - } - delete this.parent._checkpid; - return; - } - } - this.parent.emit('normalStart'); - delete this.parent._checkpid; - }); - this._checkpid.stdout.on('data', function (chunk) { this.parent.result += chunk.toString(); }); - this._checkpid.stdin.write("systemctl status " + moduleName + " | grep 'Main PID:'\n"); - this._checkpid.stdin.write('exit\n'); - } - else - { - // This isn't even a systemd platform, so this couldn't have been a service start - this.emit('normalStart'); - } + this.emit('normalStart'); } } }; diff --git a/agents/modules_meshcmd/service-manager.js b/agents/modules_meshcmd/service-manager.js index ee6689ed..7c3092b9 100644 --- a/agents/modules_meshcmd/service-manager.js +++ b/agents/modules_meshcmd/service-manager.js @@ -214,6 +214,13 @@ function serviceManager() throw ('could not find service: ' + name); } } + else + { + this.isAdmin = function isAdmin() + { + return (require('user-sessions').isRoot()); + } + } this.installService = function installService(options) { if (process.platform == 'win32') @@ -273,6 +280,8 @@ function serviceManager() } if(process.platform == 'linux') { + if (!this.isAdmin()) { throw ('Installing as Service, requires root'); } + switch (this.getServiceType()) { case 'init': @@ -311,14 +320,70 @@ function serviceManager() break; } } + if(process.platform == 'darwin') + { + if (!this.isAdmin()) { throw ('Installing as Service, requires root'); } + + // Mac OS + var stdoutpath = (options.stdout ? ('StandardOutPath\n' + options.stdout + '') : ''); + var autoStart = (options.startType == 'AUTO_START' ? '' : ''); + var params = ' ProgramArguments\n'; + params += ' \n'; + params += (' /usr/local/mesh_services/' + options.name + '/' + options.name + '\n'); + if(options.parameters) + { + for(var itm in options.parameters) + { + params += (' ' + options.parameters[itm] + '\n'); + } + } + params += ' \n'; + + var plist = '\n'; + plist += '\n'; + plist += '\n'; + plist += ' \n'; + plist += ' Label\n'; + plist += (' ' + options.name + '\n'); + plist += (params + '\n'); + plist += ' WorkingDirectory\n'; + plist += (' /usr/local/mesh_services/' + options.name + '\n'); + plist += (stdoutpath + '\n'); + plist += ' RunAtLoad\n'; + plist += (autoStart + '\n'); + plist += ' \n'; + plist += ''; + + if (!require('fs').existsSync('/usr/local/mesh_services')) { require('fs').mkdirSync('/usr/local/mesh_services'); } + if (!require('fs').existsSync('/Library/LaunchDaemons/' + options.name + '.plist')) + { + if (!require('fs').existsSync('/usr/local/mesh_services/' + options.name)) { require('fs').mkdirSync('/usr/local/mesh_services/' + options.name); } + if (options.binary) + { + require('fs').writeFileSync('/usr/local/mesh_services/' + options.name + '/' + options.name, options.binary); + } + else + { + require('fs').copyFileSync(options.servicePath, '/usr/local/mesh_services/' + options.name + '/' + options.name); + } + require('fs').writeFileSync('/Library/LaunchDaemons/' + options.name + '.plist', plist); + var m = require('fs').statSync('/usr/local/mesh_services/' + options.name + '/' + options.name).mode; + m |= (require('fs').CHMOD_MODES.S_IXUSR | require('fs').CHMOD_MODES.S_IXGRP); + require('fs').chmodSync('/usr/local/mesh_services/' + options.name + '/' + options.name, m); + } + else + { + throw ('Service: ' + options.name + ' already exists'); + } + } } this.uninstallService = function uninstallService(name) { + if (!this.isAdmin()) { throw ('Uninstalling a service, requires admin'); } + if (typeof (name) == 'object') { name = name.name; } if (process.platform == 'win32') { - if (!this.isAdmin()) { throw ('Uninstalling a service, requires admin'); } - var service = this.getService(name); if (service.status.state == undefined || service.status.state == 'STOPPED') { @@ -388,6 +453,39 @@ function serviceManager() break; } } + else if(process.platform == 'darwin') + { + if (require('fs').existsSync('/Library/LaunchDaemons/' + name + '.plist')) + { + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.on('data', function (chunk) { }); + child.stdin.write('launchctl stop ' + name + '\n'); + child.stdin.write('launchctl unload /Library/LaunchDaemons/' + name + '.plist\n'); + child.stdin.write('exit\n'); + child.waitExit(); + + try + { + require('fs').unlinkSync('/usr/local/mesh_services/' + name + '/' + name); + require('fs').unlinkSync('/Library/LaunchDaemons/' + name + '.plist'); + } + catch(e) + { + throw ('Error uninstalling service: ' + name + ' => ' + e); + } + + try + { + require('fs').rmdirSync('/usr/local/mesh_services/' + name); + } + catch(e) + {} + } + else + { + throw ('Service: ' + name + ' does not exist'); + } + } } if(process.platform == 'linux') { diff --git a/agents/modules_meshcmd/user-sessions.js b/agents/modules_meshcmd/user-sessions.js index 877d4b30..bbe1d613 100644 --- a/agents/modules_meshcmd/user-sessions.js +++ b/agents/modules_meshcmd/user-sessions.js @@ -78,12 +78,20 @@ function UserSessions() this._marshal = require('_GenericMarshal'); this._kernel32 = this._marshal.CreateNativeProxy('Kernel32.dll'); this._kernel32.CreateMethod('GetLastError'); - this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll'); - this._wts.CreateMethod('WTSEnumerateSessionsA'); - this._wts.CreateMethod('WTSQuerySessionInformationA'); - this._wts.CreateMethod('WTSRegisterSessionNotification'); - this._wts.CreateMethod('WTSUnRegisterSessionNotification'); - this._wts.CreateMethod('WTSFreeMemory'); + + try + { + this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll'); + this._wts.CreateMethod('WTSEnumerateSessionsA'); + this._wts.CreateMethod('WTSQuerySessionInformationA'); + this._wts.CreateMethod('WTSRegisterSessionNotification'); + this._wts.CreateMethod('WTSUnRegisterSessionNotification'); + this._wts.CreateMethod('WTSFreeMemory'); + } + catch(exc) + { + } + this._user32 = this._marshal.CreateNativeProxy('user32.dll'); this._user32.CreateMethod('RegisterPowerSettingNotification'); this._user32.CreateMethod('UnregisterPowerSettingNotification'); @@ -203,7 +211,7 @@ function UserSessions() this.immediate = setImmediate(function (self) { // Now that we have a window handle, we can register it to receive Windows Messages - self.parent._wts.WTSRegisterSessionNotification(self.parent.hwnd, NOTIFY_FOR_ALL_SESSIONS); + if (self.parent._wts) { self.parent._wts.WTSRegisterSessionNotification(self.parent.hwnd, NOTIFY_FOR_ALL_SESSIONS); } self.parent._user32.ACDC_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_ACDC_POWER_SOURCE, 0); self.parent._user32.BATT_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_BATTERY_PERCENTAGE_REMAINING, 0); self.parent._user32.DISP_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_CONSOLE_DISPLAY_STATE, 0); @@ -307,6 +315,38 @@ function UserSessions() { this.user_session.emit('changed'); }); + this._users = function _users() + { + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('awk -F: \'($3 >= 0) {printf "%s:%s\\n", $1, $3}\' /etc/passwd\nexit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var ret = {}, tokens; + for (var ln in lines) + { + tokens = lines[ln].split(':'); + if (tokens[0]) { ret[tokens[0]] = tokens[1]; } + } + return (ret); + } + this._uids = function _uids() { + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('awk -F: \'($3 >= 0) {printf "%s:%s\\n", $1, $3}\' /etc/passwd\nexit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var ret = {}, tokens; + for (var ln in lines) { + tokens = lines[ln].split(':'); + if (tokens[0]) { ret[tokens[1]] = tokens[0]; } + } + return (ret); + } this.Self = function Self() { var promise = require('promise'); @@ -501,6 +541,43 @@ function UserSessions() } else if(process.platform == 'darwin') { + this._users = function () + { + var child = require('child_process').execFile('/usr/bin/dscl', ['dscl', '.', 'list', '/Users', 'UniqueID']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('exit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var tokens, i; + var users = {}; + + for (i = 0; i < lines.length; ++i) { + tokens = lines[i].split(' '); + if (tokens[0]) { users[tokens[0]] = tokens[tokens.length - 1]; } + } + + return (users); + } + this._uids = function () { + var child = require('child_process').execFile('/usr/bin/dscl', ['dscl', '.', 'list', '/Users', 'UniqueID']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('exit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var tokens, i; + var users = {}; + + for (i = 0; i < lines.length; ++i) { + tokens = lines[i].split(' '); + if (tokens[0]) { users[tokens[tokens.length - 1]] = tokens[0]; } + } + + return (users); + } this._idTable = function() { var table = {}; @@ -559,6 +636,48 @@ function UserSessions() if (cb) { cb.call(this, users); } } } + + if(process.platform == 'linux' || process.platform == 'darwin') + { + this._self = function _self() + { + var child = require('child_process').execFile('/usr/bin/id', ['id', '-u']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.waitExit(); + return (parseInt(child.stdout.str)); + } + this.isRoot = function isRoot() + { + return (this._self() == 0); + } + this.consoleUid = function consoleUid() + { + var checkstr = process.platform == 'darwin' ? 'console' : ':0'; + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('who\nexit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var tokens, i, j; + for (i in lines) + { + tokens = lines[i].split(' '); + for (j = 1; j < tokens.length; ++j) + { + if (tokens[j].length > 0 && tokens[j] == checkstr) + { + return (parseInt(this._users()[tokens[0]])); + } + } + } + throw ('nobody logged into console'); + } + } + + } function showActiveOnly(source) { diff --git a/agents/modules_meshcore/user-sessions.js b/agents/modules_meshcore/user-sessions.js index 877d4b30..bbe1d613 100644 --- a/agents/modules_meshcore/user-sessions.js +++ b/agents/modules_meshcore/user-sessions.js @@ -78,12 +78,20 @@ function UserSessions() this._marshal = require('_GenericMarshal'); this._kernel32 = this._marshal.CreateNativeProxy('Kernel32.dll'); this._kernel32.CreateMethod('GetLastError'); - this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll'); - this._wts.CreateMethod('WTSEnumerateSessionsA'); - this._wts.CreateMethod('WTSQuerySessionInformationA'); - this._wts.CreateMethod('WTSRegisterSessionNotification'); - this._wts.CreateMethod('WTSUnRegisterSessionNotification'); - this._wts.CreateMethod('WTSFreeMemory'); + + try + { + this._wts = this._marshal.CreateNativeProxy('Wtsapi32.dll'); + this._wts.CreateMethod('WTSEnumerateSessionsA'); + this._wts.CreateMethod('WTSQuerySessionInformationA'); + this._wts.CreateMethod('WTSRegisterSessionNotification'); + this._wts.CreateMethod('WTSUnRegisterSessionNotification'); + this._wts.CreateMethod('WTSFreeMemory'); + } + catch(exc) + { + } + this._user32 = this._marshal.CreateNativeProxy('user32.dll'); this._user32.CreateMethod('RegisterPowerSettingNotification'); this._user32.CreateMethod('UnregisterPowerSettingNotification'); @@ -203,7 +211,7 @@ function UserSessions() this.immediate = setImmediate(function (self) { // Now that we have a window handle, we can register it to receive Windows Messages - self.parent._wts.WTSRegisterSessionNotification(self.parent.hwnd, NOTIFY_FOR_ALL_SESSIONS); + if (self.parent._wts) { self.parent._wts.WTSRegisterSessionNotification(self.parent.hwnd, NOTIFY_FOR_ALL_SESSIONS); } self.parent._user32.ACDC_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_ACDC_POWER_SOURCE, 0); self.parent._user32.BATT_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_BATTERY_PERCENTAGE_REMAINING, 0); self.parent._user32.DISP_H = self.parent._user32.RegisterPowerSettingNotification(self.parent.hwnd, GUID_CONSOLE_DISPLAY_STATE, 0); @@ -307,6 +315,38 @@ function UserSessions() { this.user_session.emit('changed'); }); + this._users = function _users() + { + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('awk -F: \'($3 >= 0) {printf "%s:%s\\n", $1, $3}\' /etc/passwd\nexit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var ret = {}, tokens; + for (var ln in lines) + { + tokens = lines[ln].split(':'); + if (tokens[0]) { ret[tokens[0]] = tokens[1]; } + } + return (ret); + } + this._uids = function _uids() { + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('awk -F: \'($3 >= 0) {printf "%s:%s\\n", $1, $3}\' /etc/passwd\nexit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var ret = {}, tokens; + for (var ln in lines) { + tokens = lines[ln].split(':'); + if (tokens[0]) { ret[tokens[1]] = tokens[0]; } + } + return (ret); + } this.Self = function Self() { var promise = require('promise'); @@ -501,6 +541,43 @@ function UserSessions() } else if(process.platform == 'darwin') { + this._users = function () + { + var child = require('child_process').execFile('/usr/bin/dscl', ['dscl', '.', 'list', '/Users', 'UniqueID']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('exit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var tokens, i; + var users = {}; + + for (i = 0; i < lines.length; ++i) { + tokens = lines[i].split(' '); + if (tokens[0]) { users[tokens[0]] = tokens[tokens.length - 1]; } + } + + return (users); + } + this._uids = function () { + var child = require('child_process').execFile('/usr/bin/dscl', ['dscl', '.', 'list', '/Users', 'UniqueID']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('exit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var tokens, i; + var users = {}; + + for (i = 0; i < lines.length; ++i) { + tokens = lines[i].split(' '); + if (tokens[0]) { users[tokens[tokens.length - 1]] = tokens[0]; } + } + + return (users); + } this._idTable = function() { var table = {}; @@ -559,6 +636,48 @@ function UserSessions() if (cb) { cb.call(this, users); } } } + + if(process.platform == 'linux' || process.platform == 'darwin') + { + this._self = function _self() + { + var child = require('child_process').execFile('/usr/bin/id', ['id', '-u']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.waitExit(); + return (parseInt(child.stdout.str)); + } + this.isRoot = function isRoot() + { + return (this._self() == 0); + } + this.consoleUid = function consoleUid() + { + var checkstr = process.platform == 'darwin' ? 'console' : ':0'; + var child = require('child_process').execFile('/bin/sh', ['sh']); + child.stdout.str = ''; + child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); + child.stdin.write('who\nexit\n'); + child.waitExit(); + + var lines = child.stdout.str.split('\n'); + var tokens, i, j; + for (i in lines) + { + tokens = lines[i].split(' '); + for (j = 1; j < tokens.length; ++j) + { + if (tokens[j].length > 0 && tokens[j] == checkstr) + { + return (parseInt(this._users()[tokens[0]])); + } + } + } + throw ('nobody logged into console'); + } + } + + } function showActiveOnly(source) { diff --git a/package.json b/package.json index 702f9a5a..ebe26c06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.2.3-a", + "version": "0.2.3-c", "keywords": [ "Remote Management", "Intel AMT", diff --git a/public/commander.htm b/public/commander.htm index 6dccd598..129b7afc 100644 --- a/public/commander.htm +++ b/public/commander.htm @@ -32,38 +32,38 @@ d));a=d;break;case 43:if(8>b.amtaccumulator.length)break;a=8;break;case 65:if(8> a.length+"): "+rstr2hex(a));if(null!=b.socket&&b.socket.readyState==WebSocket.OPEN){for(var d=new Uint8Array(a.length),f=0;f'+a.InstanceID+"";var c="",b;for(b in a)if(a.hasOwnProperty(b)){c+='';if(a[b].ReferenceParameters){var c=c+"",c=c+(""+a[b].Address+""+a[b].ReferenceParameters.ResourceURI+""),l=a[b].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(l))for(var h= 0;h"+l[h].Value+"";else c+=""+l.Value+"";c+=""}else c+=a[b];c+=""}return c+""}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('
"+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='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+ -E+''+x+"",F='');null!=m&&(m=""+m+"");"PushWithAck"==c?c="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==c&&(c="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push"); -a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe"+k.Address+""+a+""+k.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+l(D)+w+'
'+b+""+m+""+F+"";k.PerformAjax(a+"
",d,h, +h+">
"+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='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken'+ +F+''+w+"",C='');null!=m&&(m=""+m+"");"PushWithAck"==c?c="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==c&&(c="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push"); +a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe"+k.Address+""+a+""+k.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+l(E)+y+'
'+b+""+m+""+C+"";k.PerformAjax(a+"",d,h, 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"+k.Address+""+a+""+k.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous"+l(h)+"";k.PerformAjax(a+"",c,b,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')}; -k.ExecPut=function(a,c,b,d,h,g){g="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+k.Address+""+a+""+k.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+l(g)+"";if(a&&null!=c){var D=k.GetNameFromUrl(a);a="';for(var m in c)if(c.hasOwnProperty(m)&& -0!==m.indexOf("__")&&0!==m.indexOf("@")&&null!=c[m]&&"function"!==typeof c[m])if("object"===typeof c[m]&&c[m].ReferenceParameters){a+=""+c[m].Address+""+c[m].ReferenceParameters.ResourceURI+"";var E=c[m].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(E))for(var x=0;x"+E[x].Value+"";else a+=""+E.Value+""; -a+=""}else if(Array.isArray(c[m]))for(x=0;x"+c[m][x].toString()+"";else a+=""+c[m].toString()+"";c=a+("")}else c="";k.PerformAjax(g+c+"",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"+k.Address+""+a+""+k.NextMessageId++ + -"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+l(g)+"';for(var m in c)a+=""+c[m]+"";k.PerformAjax(a+"",b,d,h)};k.ExecDelete=function(a,c,b,d,h){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+k.Address+""+a+""+k.NextMessageId++ + +k.ExecPut=function(a,c,b,d,h,g){g="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put"+k.Address+""+a+""+k.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60.000S"+l(g)+"";if(a&&null!=c){var E=k.GetNameFromUrl(a);a="';for(var m in c)if(c.hasOwnProperty(m)&& +0!==m.indexOf("__")&&0!==m.indexOf("@")&&null!=c[m]&&"function"!==typeof c[m])if("object"===typeof c[m]&&c[m].ReferenceParameters){a+=""+c[m].Address+""+c[m].ReferenceParameters.ResourceURI+"";var F=c[m].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(F))for(var w=0;w"+F[w].Value+"";else a+=""+F.Value+""; +a+=""}else if(Array.isArray(c[m]))for(w=0;w"+c[m][w].toString()+"";else a+=""+c[m].toString()+"";c=a+("")}else c="";k.PerformAjax(g+c+"",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"+k.Address+""+a+""+k.NextMessageId++ + +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+l(g)+"';for(var m in c)a+=""+c[m]+"";k.PerformAjax(a+"",b,d,h)};k.ExecDelete=function(a,c,b,d,h){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"+k.Address+""+a+""+k.NextMessageId++ + "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+l(c)+"";k.PerformAjax(a,b,d,h)};k.ExecGet=function(a,c,b,l){k.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get"+k.Address+""+a+""+k.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S", -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+=""+b[E][x]+"";else m+=""+b[E]+"";k.ExecMethodXml(a,c,m,l,h,g,d)};k.ExecMethodXml=function(a,c,b,d,h,g,D){k.PerformAjax(a+"/"+c+""+k.Address+""+a+""+k.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ -l(D)+"'+b+"",d,h,g)};k.ExecEnum=function(a,c,b,l){k.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+k.Address+""+a+""+k.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', +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+=""+b[F][w]+"";else m+=""+b[F]+"";k.ExecMethodXml(a,c,m,l,h,g,d)};k.ExecMethodXml=function(a,c,b,d,h,g,E){k.PerformAjax(a+"/"+c+""+k.Address+""+a+""+k.NextMessageId++ +"http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S"+ +l(E)+"'+b+"",d,h,g)};k.ExecEnum=function(a,c,b,l){k.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"+k.Address+""+a+""+k.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S', c,b,l)};k.ExecPull=function(a,c,b,l,h){k.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull"+k.Address+""+a+""+k.NextMessageId++ +'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymousPT60S'+c+"", 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=e.MaxActiveEnumsCount||0==e.PendingEnums.length?b():(a=e.PendingEnums.shift(), -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]), -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!= -a&&(y=ReadIntX(a,0),0y)){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); +function AmtStackCreateService(a){function b(){var a=e.GetPendingActions();u=e.MaxActiveEnumsCount||0==e.PendingEnums.length?b():(a=e.PendingEnums.shift(), +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]), +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!= +a&&(z=ReadIntX(a,0),0z)){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); 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]&& 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 "+ 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."; -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(0Local",h=5);3==c.InitiatorType&&(c.Initiator="KVM Default Port",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]); -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, -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), -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, -h){e.ActiveEnumsCountLocal",h=5);3==c.InitiatorType&&(c.Initiator="KVM Default Port",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]); +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, +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), +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, +h){e.ActiveEnumsCounthttp://schemas.xmlsoap.org/ws/2004/08/addressinghttp://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystemCIM_ComputerSystemManagedSystem', null,null,c)};e.SetBootConfigRole=function(a,c){e.CIM_BootService_SetBootConfigRole('
http://schemas.xmlsoap.org/ws/2004/08/addressing
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSettingIntel(r) AMT: Boot Configuration 0', 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 "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", "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= 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= -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", -"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}, -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= -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= -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= -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", -"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", -{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", +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", +"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", +"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", +{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", +"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", +"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= +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", +"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", {_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, 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)}; 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 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, [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(";"), 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(";"), -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(";"); +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(";"); 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", 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", 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 function referenceToXml(a,b){if(void 0===b||null===b)return null;var c="/wsman"+b.__resourceUri+"",d;for(d in b)b.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof b[d]||"object"===typeof b[d]||Array.isArray(b[d])||(c+=''+b[d].toString()+""));return c+("")} function GetSidString(a){for(var b="S-"+a.charCodeAt(0)+"-"+a.charCodeAt(7),c=2;ca.length||"s"!=a[0]&&"S"!=a[0])return null;for(var b=1;b>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); var l=c;l||(l=new Uint8Array(a.length));for(var h=b=b||0,g=0;g");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 [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>>1,d=Array(b);d[l]=a.slice(0);for(var e=l>>>1;0>=1;for(e=2;ec;++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^ -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>>16&255]<<24^D[l>>>8&255]<<16^D[l&255]<<8^D[l>>>24]^E[d]<<24,d++):6>>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>>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>>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]^ -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): +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^ +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>>16&255]<<24^E[l>>>8&255]<<16^E[l&255]<<8^E[l>>>24]^F[d]<<24,d++):6>>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>>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>>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]^ +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): 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= 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= b;for(var b=c.util.createBuffer(),h=0;h>>=2,h=0;ha.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()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()=g.length())d.putByte(g.length()&127);else{e=g.length();a="";do a+=String.fromCharCode(e&255),e>>>=8;while(0>>=7,d||(m|=128),g.push(m),d=!1;while(0b[a].length&&(c+="0"),c+=b[a];return c+"Z"};b.dateToGeneralizedTime=function(a){if("string"=== +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(11b[a].length&&(c+="0"),c+=b[a];return c+"Z"};b.dateToGeneralizedTime=function(a){if("string"=== 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;ab[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> 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(32a;++a)g[a]=Math.floor(4294967296* -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<>>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<>>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<>>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<>>32-C;a.h0=a.h0+e|0;a.h1=a.h1+k|0;a.h2=a.h2+f|0;a.h3= -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>>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>>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= +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<>>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<>>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<>>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<>>32-D;a.h0=a.h0+e|0;a.h1=a.h1+k|0;a.h2=a.h2+f|0;a.h3= +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>>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>>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= !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;kn;++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> +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> 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>>> -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= -0;v.fullMessageLength=v.messageLength64=[];for(var b=v.messageLengthSize/4,g=0;g>>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]>>>= -0,u[0]=u[1]/4294967296>>>0;d.putBytes(e);b(a,g,d);(2048>>0,w+=u,m.putInt32(w>>>0),w=f;f={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3, +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= +0;v.fullMessageLength=v.messageLength64=[];for(var b=v.messageLengthSize/4,g=0;g>>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]>>>= +0,u[0]=u[1]/4294967296>>>0;d.putBytes(e);b(a,g,d);(2048>>0,y+=u,m.putInt32(y>>>0),y=f;f={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3, 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= -!0;for(var k=0;kv;++v)c[v]=d.getInt32(); -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-= +!0;for(var k=0;kv;++v)c[v]=d.getInt32(); +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-= 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, 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, -messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var b=m.messageLengthSize/4,e=0;e>>0,u>>>0],F=m.fullMessageLength.length- -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>>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= +messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var b=m.messageLengthSize/4,e=0;e>>0,u>>>0],C=m.fullMessageLength.length- +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>>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= {}),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;kN;++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], -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& -(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]= +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], +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& +(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]= 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")}; 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], [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 [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, 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, 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], -[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/ -4,b=0;b>>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>>0,m+=h,d.putInt32(m>>>0),m=g;g=Array(e.length);for(G=0;GC;++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/ +4,b=0;b>>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>>0,m+=h,d.putInt32(m>>>0),m=g;g=Array(e.length);for(G=0;G>>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>>4|z<<28)^a[r+1];c=k; -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= +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>>4|x<<28)^a[r+1];c=k; +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= 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, 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, 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], 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, -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>>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>>26,H=H<<2|H>>>26):(I=I<<1|I>>>27,H=H<<1|H>>>27); -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", +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>>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>>26,H=H<<2|H>>>26):(I=I<<1|I>>>27,H=H<<1|H>>>27); +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", 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, 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, -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, -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, +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, 524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080, 524288,0,1074266112,34078976,1073742080],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, -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, -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, +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, +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, 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;kF)return m(null,y);p.start(null, -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+=r4294967295*w){a=Error("Derived key is too long."); -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+=rC)return m(null,z);p.start(null, +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+=r4294967295*y){a=Error("Derived key is too long."); +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+=rb;++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= c.util.createBuffer();if(b)for(;g.length()>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()), -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));1048575m;++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>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}}})})})}; 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>(f&7),v;for(v=g;128>v;v++)e.putByte(b[e.at(v- -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<>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]= -(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)); -c.push(b&65535)}A=e?0:63;for(b=0;bp;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}; +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<>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]= +(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)); +c.push(b&65535)}A=e?0:63;for(b=0;bp;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}; 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|| {};if(b.defined.rc2)return b.rc2;b.defined.rc2=!0;for(var k=0;k>=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, -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(); -this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<>=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(); +this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<=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= -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>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}; +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>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}; b.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0a?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):this.data[this.t-1]|=f<=this.DB&&(e-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0>d|g,g=(this.data[h]&l)<=this.t)c.t=0;else{var d=a%this.DB,l=this.DB-d,e=(1<>d;for(var g= b+1;g>d;0>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;b>=this.DB;d-=a.s}c.s=0>d?-1:0;-1>d?c.data[b++]=this.DV+d:0=c.DV&&(a.data[b+c.t]-=c.DV,a.data[b+c.t+1]=1)}0=e.t)){var g=this.abs();if(g.t>this.F2:0),q=this.FV/y,y=(1<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- +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>this.F2:0),q=this.FV/z,z=(1<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- (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 0a)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<this.s)return"-"+this.negate().toString(a);if(16==a)a= 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<>g)&&(d=!0,l="0123456789abcdefghijklmnopqrstuvwxyz".charAt(b));0<=e;)g>(g+=this.DB-a)):(b=this.data[e]>>(g-=a)&c,0>=g&&(g+=this.DB,--e)),0this.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&&0a||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- -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, +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- +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, 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||36y?"-"==a.charAt(m)&&0==this.signum()&&(e=!0):(f=c*f+y,++g>=d&&(this.dMultiply(l),this.dAddOffset(f,0),f=g=0))}0a)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]=0z?"-"==a.charAt(m)&&0==this.signum()&&(e=!0):(f=c*f+z,++g>=d&&(this.dMultiply(l),this.dAddOffset(f,0),f=g=0))}0a)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>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;b>=this.DB;d+=a.s}c.s=0>d?-1:0;0d&&(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++]= 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=a)return 0;var c=this.DV%a,b=0>this.s?a-1:0;if(0=d)return!1;for(var l=c.shiftRight(d),e=z(),g,h=0;h=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++=a)return 0;var c=this.DV%a,b=0>this.s?a-1:0;if(0=d)return!1;for(var l=c.shiftRight(d),e=x(),g,h=0;h=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++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)<>24};b.prototype.shortValue= 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>b)!=(this.s&this.DM)>>b&&(c[l++]=d|this.s<b?(d=(this.data[a]&(1<>(b+=this.DB-8)):(d=this.data[a]>>(b-=8)&255,0>=b&&(b+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==l&& -(this.s&128)!=(d&128)&&++l,0this.compareTo(a)?this:a};b.prototype.max=function(a){return 0this.compareTo(a)?this:a};b.prototype.max=function(a){return 0a?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>=16,b+=16); -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?0!=this.s:0!=(this.data[c]&1<>=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?0!=this.s:0!=(this.data[c]&1<=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<=y?u=a.data[z]>>b-y&q:(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); -if(n)f[u].copyTo(e),n=!1;else{for(;1--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, +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<=z?u=a.data[x]>>b-z&q:(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); +if(n)f[u].copyTo(e),n=!1;else{for(;1--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, 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, -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;bthis.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>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(); -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>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(); +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;ga&&(h=f(a,b));if(h.isProbablePrime(m))return g(null,h);h.dAddOffset(p[k++%8],0)}while(0>z||+new Date-Ga&&(m=f(a,b));k=m.toString(16);l.target.postMessage({hex:k,workLoad:z}); -m.dAddOffset(n,0)}}C=Math.max(1,C);for(var d=[],l=0;la&&(h=f(a,b));if(h.isProbablePrime(m))return g(null,h);h.dAddOffset(p[k++%8],0)}while(0>x||+new Date-Ga&&(m=f(a,b));k=m.toString(16);l.target.postMessage({hex:k,workLoad:x}); +m.dAddOffset(n,0)}}D=Math.max(1,D);for(var d=[],l=0;l=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), b=0;bd-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= 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)): (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: 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, -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", +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", 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", -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, -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, +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, +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, 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]; -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, +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, 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= -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>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&& (0>=c||fg?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, 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 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, 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", "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, -[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."), +[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."), 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, 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, -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."), +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."), 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, !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|| {};b.defined=b.defined||{};if(b.defined.rsa)return b.rsa;b.defined.rsa=!0;for(var f=0;f>=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", +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= +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>=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", "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"]&& 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; 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 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>8*w-x&255;A=String.fromCharCode(A.charCodeAt(0)&~x)+A.substr(1); -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>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>8*r-w&255;A=String.fromCharCode(A.charCodeAt(0)&~w)+A.substr(1); +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>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;nf.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime."); 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."), 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]. 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=0m.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&&0g.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}); 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(0b.version.minor)d=null,e="";0===e.length&&(e=c.random.getBytes(32));a.session.id=e;a.session.clientHelloVersion= -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;eb.version.minor)d=null,e="";0===e.length&&(e=c.random.getBytes(32));a.session.id=e;a.session.clientHelloVersion= +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;ed)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(;0d)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}});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}}); -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, +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, 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()); -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(0d.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+ 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)): 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!== -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, -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], +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, +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], [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, 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= 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(0a.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;da.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(;dn?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} 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()}; -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= -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= -(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= -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, +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= +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= +(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= +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, 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); "undefined"!==typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs}); -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= +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= null,currentView=0,LoadingHtml="
Loading...
",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(" "), StatusStrs=["Disconnected","Connecting...","Setup...","Connected"],scriptstate,t,t2,rsepass=null; function startup(){var a=document.getElementsByTagName("input");for(t=0;t" 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; function PullRemoteAccess(){var a="*AMT_EnvironmentDetectionSettingData AMT_ManagementPresenceRemoteSAP AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule *AMT_UserInitiatedConnectionService AMT_MPSUsernamePassword".split(" ");11n&&(n="0"+n),b+= -", at "+f+":"+n+" daily")}a+=TableEntry("Periodic connection",addLinkConditional(b,'editMpsPolicy("Periodic")',xxAccountAdminName));a+=TableEnd();a=a+"
"+TableStart2();a+="
Manage Intel® AMT remote management servers.

";if(0==xxCiraServers.length)a+="

No remote servers found.

";else for(d in xxCiraServers)b=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(b+=", "+xxCiraServers[d].CN),a+="
"+xxCiraServers[d].AccessInfo+""+EscapeHtml(b)+"
";if(c)if(a+="
Manage HTTP proxies used for management connections.

",b=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==b.length)a+="

No proxies configured.

";else for(d in b)a+="
"+EscapeHtml(b[d].AccessInfo)+":"+b[d].Port+" / "+EscapeHtml(b[d].NetworkDnsSuffix)+ -"
";d="";xxAccountAdminName&&(d=AddButton("Add Server...","AddRemoteAccessServer()"),c&&(d+=AddButton("Add Proxy...","AddRemoteAccessProxy()")));a+="
"+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(28,a)}}var xxEditMpsPolicyType; -function editMpsPolicy(a){var b="",c=xxEditMpsPolicyType=a;"User"==c&&(c="User Initiated");var d=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",c),b=b+"
Primary server
"; -if(1
Secondary server
"}c=0;d&&(c=d.TunnelLifeTime);b+="
";b+="
Tunnel lifetime (Seconds)
";"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+="
Trigger type
");setDialogMode(11,a+" Connection",3,editMpsPolicyOk,b);editMpsPolicyUpdate()} -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||23b||59http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ -xxCiraServers[Q("d2server1").value].Name+""),0<=Q("d2server1").value&&1http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ -xxCiraServers[Q("d2server2").value].Name+""),amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(a,Q("d2lifetime").value,b,c,PullRemoteAccess))}var editEnvironmentDetectionTmp; +addLinkConditional(xxUserInitiatedEnabledState[xxUserInitiatedCira.EnabledState],"editUserInitiatedCira()",xxAccountAdminName));b="None";if(0n&&(n="0"+n),b+=", at "+f+":"+n+" daily")}a+=TableEntry("Periodic connection",addLinkConditional(b,'editMpsPolicy("Periodic")',xxAccountAdminName));a+=TableEnd();a=a+"
"+TableStart2();a+="
Manage Intel® AMT remote management servers.

";if(0==xxCiraServers.length)a+="

No remote servers found.

"; +else for(d in xxCiraServers)b=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(b+=", "+xxCiraServers[d].CN),a+="
"+xxCiraServers[d].AccessInfo+""+EscapeHtml(b)+"
";if(c)if(a+="
Manage HTTP proxies used for management connections.

",b=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==b.length)a+="

No proxies configured.

";else for(d in b)a+="
"+EscapeHtml(b[d].AccessInfo)+":"+b[d].Port+" / "+EscapeHtml(b[d].NetworkDnsSuffix)+"
";d="";xxAccountAdminName&&(d=AddButton("Add Server...","AddRemoteAccessServer()"),c&&(d+=AddButton("Add Proxy...","AddRemoteAccessProxy()")));a+="
"+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(28,a)}}var xxEditMpsPolicyType; +function editMpsPolicy(a){var b="",c=11
Primary server
";c&&(b+="
Primary MPS Type
");if(1
Secondary server
";c&&(b+="
Secondary MPS Type
")}f= +0;d&&(f=d.TunnelLifeTime);b+="
";b+="
Tunnel lifetime (Seconds)
";"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+="
Trigger type
");setDialogMode(11,a+" Connection",3,editMpsPolicyOk,b);editMpsPolicyUpdate()} +function editMpsPolicyUpdate(){var a=11=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||23c||59http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ +xxCiraServers[Q("d2server1").value].Name+"");0<=Q("d2server1").value&&1http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymoushttp://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP'+ +xxCiraServers[Q("d2server2").value].Name+"");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; 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.

");0==editEnvironmentDetectionTmp.length&&(b+="No intranet domains, Environemnt detection disabled.
");for(var c in editEnvironmentDetectionTmp)b+= "
"+AddButton2("Remove","editEnvironmentDetectionRemove("+c+")")+"
"+editEnvironmentDetectionTmp[c]+"
";xxAccountAdminName&&4>editEnvironmentDetectionTmp.length&&(b+="
"); 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. function portsFromHost(a,b){var c=decodeURIComponent(a).split(":"),d=0==b?16992:16993,f=0==b?16994:16995;1♦ "+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} 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);64p?b=1:96p?c=1:47p?d=1:f=1}return 4==b+c+d+f} 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"

"}function TableStart2(){return"

"} -function TableEntry(a,b){return"

"+a+"

"+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"

"+(a?a:"")+"

"}function AddButton(a,b){return""}function AddButton2(a,b){return""} +function TableEntry(a,b){return"

"+a+"

"+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"

"+(a?a:"")+"

"}function AddButton(a,b){return""}function AddButton2(a,b,c){return""} function AddRefreshButton(a){return""}function MoreStart(){return'▼ More'}function getSelectedOptions(a){for(var b=[],c,d=0,f=a.options.length;d
"; - x += addHtmlValue('Mesh Agent', 'OSX Agent (64bit) - TEST BUILD'); + x += addHtmlValue('Mesh Agent', 'OSX Agent (64bit)'); x += ""; // Windows agent uninstall diff --git a/webserver.js b/webserver.js index 1297bf38..f9bbff3f 100644 --- a/webserver.js +++ b/webserver.js @@ -1682,12 +1682,13 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { // Skip all folder entries zipfile.readEntry(); } else { - if (entry.fileName == 'Meshcentral_MeshAgent.mpkg/Contents/distribution.dist') { + if (entry.fileName == 'MeshAgent.mpkg/Contents/distribution.dist') { // This is a special file entry, we need to fix it. zipfile.openReadStream(entry, function (err, readStream) { readStream.on("data", function (data) { if (readStream.xxdata) { readStream.xxdata += data; } else { readStream.xxdata = data; } }); readStream.on("end", function () { - 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'; + var meshname = mesh.name.split(']').join('').split('[').join(''); // We can't have ']]' in the string since it will terminate the CDATA. + 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'; var installsize = Math.floor((argentInfo.size + meshsettings.length) / 1024); archive.append(readStream.xxdata.toString().split('###WELCOMEMSG###').join(welcomemsg).split('###INSTALLSIZE###').join(installsize), { name: entry.fileName }); zipfile.readEntry(); @@ -1697,15 +1698,17 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { // Normal file entry zipfile.openReadStream(entry, function (err, readStream) { if (err) { throw err; } - archive.append(readStream, { name: entry.fileName }); + var options = { name: entry.fileName }; + if (entry.fileName.endsWith('postflight') || entry.fileName.endsWith('Uninstall.command')) { options.mode = 493; } + archive.append(readStream, options); readStream.on('end', function () { zipfile.readEntry(); }); }); } } }); zipfile.on("end", function () { - archive.file(argentInfo.path, { name: "Meshcentral_MeshAgent.mpkg/Contents/Packages/meshagentosx64.pkg/Contents/meshagent_osx64.bin" }); - archive.append(meshsettings, { name: "Meshcentral_MeshAgent.mpkg/Contents/Packages/meshagentosx64.pkg/Contents/meshagent_osx64.msh" }); + archive.file(argentInfo.path, { name: "MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64.bin" }); + archive.append(meshsettings, { name: "MeshAgent.mpkg/Contents/Packages/internal.pkg/Contents/meshagent_osx64.msh" }); archive.finalize(); }); });