From be576cf343b845bf49248e4ce9f408a9af1777f7 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Mon, 10 Apr 2017 09:14:57 +0200 Subject: [PATCH 01/22] * [FIX] Some fixes for Internet Explorer * [MOD] Bump build number --- inc/SP/Util/Util.class.php | 2 +- inc/themes/material-blue/js/app-theme.js | 2 +- inc/themes/material-blue/js/app-theme.min.js | 2 +- js/app-requests.js | 16 ++++++++++++---- js/app-requests.min.js | 12 ++++-------- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 71b20f48..3ae20bf6 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17040401; + $build = 17041001; $version = [2, 1, 5]; if ($normalized === true) { diff --git a/inc/themes/material-blue/js/app-theme.js b/inc/themes/material-blue/js/app-theme.js index 4c8dd054..24dd9f08 100644 --- a/inc/themes/material-blue/js/app-theme.js +++ b/inc/themes/material-blue/js/app-theme.js @@ -413,7 +413,7 @@ sysPass.Theme = function (Common) { } }); - if ($tagsSelect.selectedOptions.length > 0) { + if ($tagsSelect.selectedIndex > 0) { $showFilter.trigger("click"); } }, diff --git a/inc/themes/material-blue/js/app-theme.min.js b/inc/themes/material-blue/js/app-theme.min.js index 72b25893..5f4edfdb 100644 --- a/inc/themes/material-blue/js/app-theme.min.js +++ b/inc/themes/material-blue/js/app-theme.min.js @@ -15,6 +15,6 @@ $('");b.parent().next("i").on("click",function(){b.trigger("dateIconClick")});b.on("change",function(){var c;c=moment.tz(b.val(),a.config().TIMEZONE).format("X");b.parent().find("input[name='passworddatechange_unix']").val(c)})})};return{passwordDetect:l,password:g,viewsTriggers:{main:function(){var a= document.querySelector(".mdl-layout");$(".mdl-layout__drawer").find("a").click(function(){a.MaterialLayout.toggleDrawer()})},search:function(){var b=$("#frmSearch"),c=$("#res-content");b.find("button.btn-clear").on("click",function(a){$(".icon-searchfav").find("i").removeClass("mdl-color-text--amber-A200")});b.find(".icon-searchfav").on("click",function(){var c=$(this).find("i"),d=b.find("input[name='searchfav']");0==d.val()?(c.addClass("mdl-color-text--amber-A200"),c.attr("title",a.config().LANG[53]), d.val(1)):(c.removeClass("mdl-color-text--amber-A200"),c.attr("title",a.config().LANG[52]),d.val(0));b.submit()});var d=b.find("#tags")[0],e=b.find(".search-filters-tags"),k=b.find("i.show-filter");c.on("click","#data-search-header .sort-down,#data-search-header .sort-up",function(){var b=$(this);b.parent().find("a").addClass("filterOn");a.appActions().account.sort(b)}).on("click","#search-rows i.icon-favorite",function(){var b=$(this);a.appActions().account.savefavorite(b,function(){"on"===b.data("status")? -(b.addClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[50]),b.html("star")):(b.removeClass("mdl-color-text--amber-A100"),b.attr("title",a.config().LANG[49]),b.html("star_border"))})}).on("click","#search-rows span.tag",function(){e.is(":hidden")&&k.trigger("click");d.selectize.addItem($(this).data("tag-id"))});k.on("click",function(){var a=$(this);e.is(":hidden")?(e.slideDown("slow"),a.html(a.data("icon-up"))):(e.slideUp("slow"),a.html(a.data("icon-down")))});0'),c=$('
  • '),e=$('');a.forEach(function(a){var d=e.clone();d.append('person');d.append(a);a=c.clone().append(d);b.append(a)});return b},tabs:{add:function(a, c,d,e){a=$(a);var b="";1===e&&(a.parent().find("#tabs-"+c).addClass("is-active"),b="is-active");a.append(''+d+"")}}}}}; diff --git a/js/app-requests.js b/js/app-requests.js index 07644d59..d9a6799d 100644 --- a/js/app-requests.js +++ b/js/app-requests.js @@ -106,6 +106,16 @@ sysPass.Requests = function (Common) { return Object.create(requestOpts); }; + /** + * Devolver la URL para peticiones Ajax + * + * @param url + * @returns {*} + */ + var getUrl = function (url) { + return (url.indexOf("http") === 0 && url.indexOf("https") === 0) ? Common.config().APP_ROOT + url : url; + }; + /** * Llama a una acción mediante AJAX * @@ -116,11 +126,9 @@ sysPass.Requests = function (Common) { var getActionCall = function (opts, callbackOk, callbackError) { log.info("getActionCall"); - var url = (!opts.url.startsWith("http", 0) && !opts.url.startsWith("https", 0)) ? Common.config().APP_ROOT + opts.url : opts.url; - return $.ajax({ dataType: opts.type, - url: url, + url: getUrl(opts.url), method: opts.method, async: opts.async, data: opts.data, @@ -178,7 +186,7 @@ sysPass.Requests = function (Common) { * @param callbackEnd */ var getActionEvent = function (opts, callbackProgress, callbackEnd) { - var url = (!opts.url.startsWith("http", 0) && !opts.url.startsWith("https", 0)) ? Common.config().APP_ROOT + opts.url : opts.url; + var url = getUrl(opts.url); url += "?" + $.param(opts.data); var source = new EventSource(url); diff --git a/js/app-requests.min.js b/js/app-requests.min.js index f224254e..9835c7b9 100644 --- a/js/app-requests.min.js +++ b/js/app-requests.min.js @@ -1,8 +1,4 @@ -var $jscomp={scope:{},checkStringArgs:function(b,c,a){if(null==b)throw new TypeError("The 'this' value for String.prototype."+a+" must not be null or undefined");if(c instanceof RegExp)throw new TypeError("First argument to String.prototype."+a+" must not be a regular expression");return b+""}}; -$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,c,a){if(a.get||a.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[c]=a.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this); -$jscomp.polyfill=function(b,c,a,d){if(c){a=$jscomp.global;b=b.split(".");for(d=0;d=f}},"es6-impl","es3"); -sysPass.Requests=function(b){var c=b.log,a=[],d={type:"json",url:"",method:"post",callback:"",async:!0,data:"",cache:!1,processData:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:0,addHistory:!1,hash:"",useLoading:!0,useFullLoading:!1};Object.seal(d);var e={get:function(){return a},add:function(b){var f=""===b.hash?SparkMD5.hash(JSON.stringify(b),!1):b.hash;if(0"+e+f+"

    ",c.error(d),"html"===a.type&&$("#content").html(b.msg.html.error(e)),b.msg.error(d)):g()},complete:function(){!0===a.useLoading&&b.appTheme().loading.hide();b.appTheme().ajax.complete()}})}, -getActionEvent:function(a,d,e){var f=a.url.startsWith("http",0)||a.url.startsWith("https",0)?a.url:b.config().APP_ROOT+a.url,f=f+("?"+$.param(a.data)),g=new EventSource(f);g.addEventListener("message",function(a){a=JSON.parse(a.data);c.debug(a);1===a.end?(c.info("getActionEvent:Ending"),g.close(),"function"===typeof e&&e(a)):"function"===typeof d&&d(a)});g.addEventListener("error",function(a){c.error("getActionEvent:Error occured");g.close()});return g},history:e}}; +sysPass.Requests=function(c){var d=c.log,b=[],g={type:"json",url:"",method:"post",callback:"",async:!0,data:"",cache:!1,processData:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:0,addHistory:!1,hash:"",useLoading:!0,useFullLoading:!1};Object.seal(g);var k={get:function(){return b},add:function(a){var h=""===a.hash?SparkMD5.hash(JSON.stringify(a),!1):a.hash;if(0"+n+e+"

    ",d.error(b),"html"===a.type&&$("#content").html(c.msg.html.error(n)),c.msg.error(b)):m()},complete:function(){!0===a.useLoading&&c.appTheme().loading.hide();c.appTheme().ajax.complete()}})}, +getActionEvent:function(a,b,c){var f=l(a.url),f=f+("?"+$.param(a.data)),e=new EventSource(f);e.addEventListener("message",function(a){a=JSON.parse(a.data);d.debug(a);1===a.end?(d.info("getActionEvent:Ending"),e.close(),"function"===typeof c&&c(a)):"function"===typeof b&&b(a)});e.addEventListener("error",function(a){d.error("getActionEvent:Error occured");e.close()});return e},history:k}}; From 9cd5d67379aebf878588790e1de25030fa3b46cb Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Tue, 11 Apr 2017 08:42:22 +0200 Subject: [PATCH 02/22] * [FIX] Try to fix Javascript issue. Related #532 --- js/app-requests.js | 2 +- js/app-requests.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/app-requests.js b/js/app-requests.js index d9a6799d..14e67dde 100644 --- a/js/app-requests.js +++ b/js/app-requests.js @@ -113,7 +113,7 @@ sysPass.Requests = function (Common) { * @returns {*} */ var getUrl = function (url) { - return (url.indexOf("http") === 0 && url.indexOf("https") === 0) ? Common.config().APP_ROOT + url : url; + return (url.indexOf("http") === -1 && url.indexOf("https") === -1) ? Common.config().APP_ROOT + url : url; }; /** diff --git a/js/app-requests.min.js b/js/app-requests.min.js index 9835c7b9..674fe52a 100644 --- a/js/app-requests.min.js +++ b/js/app-requests.min.js @@ -1,4 +1,4 @@ sysPass.Requests=function(c){var d=c.log,b=[],g={type:"json",url:"",method:"post",callback:"",async:!0,data:"",cache:!1,processData:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:0,addHistory:!1,hash:"",useLoading:!0,useFullLoading:!1};Object.seal(g);var k={get:function(){return b},add:function(a){var h=""===a.hash?SparkMD5.hash(JSON.stringify(a),!1):a.hash;if(0"+n+e+"

    ",d.error(b),"html"===a.type&&$("#content").html(c.msg.html.error(n)),c.msg.error(b)):m()},complete:function(){!0===a.useLoading&&c.appTheme().loading.hide();c.appTheme().ajax.complete()}})}, getActionEvent:function(a,b,c){var f=l(a.url),f=f+("?"+$.param(a.data)),e=new EventSource(f);e.addEventListener("message",function(a){a=JSON.parse(a.data);d.debug(a);1===a.end?(d.info("getActionEvent:Ending"),e.close(),"function"===typeof c&&c(a)):"function"===typeof b&&b(a)});e.addEventListener("error",function(a){d.error("getActionEvent:Error occured");e.close()});return e},history:k}}; From 33ddd7de71ec4683b76c972f5022a91c1b785aeb Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Wed, 12 Apr 2017 08:39:25 +0200 Subject: [PATCH 03/22] * [MOD] Bump build number --- inc/SP/Util/Util.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 3ae20bf6..6c6131ca 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041001; + $build = 17041201; $version = [2, 1, 5]; if ($normalized === true) { From 67a88c6bcd7a5346662a8c1c3ed8709baaaec4c2 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Thu, 13 Apr 2017 12:26:03 +0200 Subject: [PATCH 04/22] * [FIX] Fixed wrong key length when submitted from login form, it was cutted down to 80 characters. #519 Thanks to @derStephan for feedback and testing --- inc/SP/Account/AccountCrypt.class.php | 4 +- inc/SP/Controller/LoginController.class.php | 36 +- inc/SP/Core/Upgrade/Crypt.class.php | 4 +- inc/SP/Mgmt/Users/UserPass.class.php | 43 +- inc/SP/Util/Util.class.php | 4 +- inc/themes/material-blue/js/app-theme.min.js | 2 +- .../js/mdl-jquery-modal-dialog.min.js | 2 +- inc/themes/material-blue/views/main/login.inc | 6 +- js/app-actions.min.js | 2 +- js/app-main.min.js | 2 +- js/app-triggers.min.js | 2 +- js/clipboard.min.js | 31 +- js/jquery-3.2.0.min.js | 2 +- js/jquery-migrate-3.0.0.min.js | 2 +- js/jsencrypt.js | 7734 +++++++++-------- js/selectize.min.js | 2 +- 16 files changed, 4089 insertions(+), 3789 deletions(-) diff --git a/inc/SP/Account/AccountCrypt.class.php b/inc/SP/Account/AccountCrypt.class.php index ed31390a..455137a7 100644 --- a/inc/SP/Account/AccountCrypt.class.php +++ b/inc/SP/Account/AccountCrypt.class.php @@ -100,7 +100,9 @@ class AccountCrypt if ($demoEnabled) { $accountsOk[] = $account->account_id; continue; - } elseif ($LogMessage->getDetailsCounter() >= 100) { + } + + if ($LogMessage->getDetailsCounter() >= 100) { $Log->writeLog(false, true); } diff --git a/inc/SP/Controller/LoginController.class.php b/inc/SP/Controller/LoginController.class.php index 21fd3911..a54895bf 100644 --- a/inc/SP/Controller/LoginController.class.php +++ b/inc/SP/Controller/LoginController.class.php @@ -263,7 +263,9 @@ class LoginController $this->addTracking(); throw new AuthException(SPException::SP_INFO, __('Usuario deshabilitado', false), '', self::STATUS_USER_DISABLED); - } elseif ($this->UserData->isUserIsChangePass()) { + } + + if ($this->UserData->isUserIsChangePass()) { $hash = Util::generateRandomBytes(16); $UserPassRecoverData = new UserPassRecoverData(); @@ -308,9 +310,9 @@ class LoginController $this->addTracking(); throw new AuthException(SPException::SP_INFO, __('Clave maestra incorrecta', false), '', self::STATUS_INVALID_MASTER_PASS); - } else { - $this->LogMessage->addDescription(__('Clave maestra actualizada', false)); } + + $this->LogMessage->addDescription(__('Clave maestra actualizada', false)); } else if ($oldPass) { if (!UserPass::updateMasterPassFromOldPass($oldPass, $this->UserData)) { $this->LogMessage->addDescription(__('Clave maestra incorrecta', false)); @@ -318,9 +320,9 @@ class LoginController $this->addTracking(); throw new AuthException(SPException::SP_INFO, __('Clave maestra incorrecta', false), '', self::STATUS_INVALID_MASTER_PASS); - } else { - $this->LogMessage->addDescription(__('Clave maestra actualizada', false)); } + + $this->LogMessage->addDescription(__('Clave maestra actualizada', false)); } else { switch (UserPass::loadUserMPass($this->UserData)) { case UserPass::MPASS_CHECKOLD: @@ -452,19 +454,23 @@ class LoginController $this->addTracking(); throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INVALID_LOGIN); - } elseif ($LdapAuthData->getStatusCode() === 701) { + } + + if ($LdapAuthData->getStatusCode() === 701) { $this->LogMessage->addDescription(__('Cuenta expirada', false)); throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_USER_DISABLED); - } else if ($LdapAuthData->getStatusCode() === 702) { + } + + if ($LdapAuthData->getStatusCode() === 702) { $this->LogMessage->addDescription(__('El usuario no tiene grupos asociados', false)); throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_USER_DISABLED); - } else { - $this->LogMessage->addDescription(__('Error interno', false)); - - throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INTERNAL_ERROR); } + + $this->LogMessage->addDescription(__('Error interno', false)); + + throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INTERNAL_ERROR); } $this->UserData->setUserName($LdapAuthData->getName()); @@ -511,7 +517,9 @@ class LoginController $this->addTracking(); throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INVALID_LOGIN); - } elseif ($AuthData->getAuthenticated() === 1) { + } + + if ($AuthData->getAuthenticated() === 1) { $this->LogMessage->addDetails(__('Tipo', false), __FUNCTION__); } @@ -537,7 +545,9 @@ class LoginController $this->addTracking(); throw new AuthException(SPException::SP_INFO, $this->LogMessage->getDescription(), '', self::STATUS_INVALID_LOGIN); - } elseif ($AuthData->getAuthenticated() === 1) { + } + + if ($AuthData->getAuthenticated() === 1) { $this->LogMessage->addDetails(__('Tipo', false), __FUNCTION__); } } diff --git a/inc/SP/Core/Upgrade/Crypt.class.php b/inc/SP/Core/Upgrade/Crypt.class.php index b1bd2dc8..4b6a5eca 100644 --- a/inc/SP/Core/Upgrade/Crypt.class.php +++ b/inc/SP/Core/Upgrade/Crypt.class.php @@ -59,7 +59,9 @@ class Crypt if (!DB::beginTransaction()) { throw new SPException(SPException::SP_ERROR, __('No es posible iniciar una transacción', false)); - } elseif (!self::migrateHash($masterPass)) { + } + + if (!self::migrateHash($masterPass)) { throw new SPException(SPException::SP_INFO, __('Clave maestra incorrecta', false)); } diff --git a/inc/SP/Mgmt/Users/UserPass.class.php b/inc/SP/Mgmt/Users/UserPass.class.php index 056430f3..024cfc9f 100644 --- a/inc/SP/Mgmt/Users/UserPass.class.php +++ b/inc/SP/Mgmt/Users/UserPass.class.php @@ -167,29 +167,36 @@ class UserPass extends UserBase || empty($UserData->getUserMKey()) ) { return self::MPASS_NOTSET; - } elseif ($UserData->getUserLastUpdateMPass() < ConfigDB::getValue('lastupdatempass')) { + } + + if ($UserData->getUserLastUpdateMPass() < ConfigDB::getValue('lastupdatempass')) { return self::MPASS_CHANGED; - } elseif ($UserData->isUserIsMigrate() === 1) { + } + + if ($UserData->isUserIsMigrate() === 1) { return UpgradeUser::upgradeMasterKey($UserData) ? self::MPASS_OK : self::MPASS_WRONG; - } elseif ($key === null && $UserData->isUserIsChangedPass() === 1) { + } + + if ($key === null && $UserData->isUserIsChangedPass() === 1 + ) { return self::MPASS_CHECKOLD; - } else { - try { - $securedKey = Crypt::unlockSecuredKey($UserData->getUserMKey(), self::getKey($UserData, $key)); - $userMPass = Crypt::decrypt($UserData->getUserMPass(), $securedKey, self::getKey($UserData, $key)); + } - // Comprobamos el hash de la clave del usuario con la guardada - if (Hash::checkHashKey($userMPass, $configHashMPass)) { - self::$gotMPass = true; - self::$clearUserMPass = $userMPass; + try { + $securedKey = Crypt::unlockSecuredKey($UserData->getUserMKey(), self::getKey($UserData, $key)); + $userMPass = Crypt::decrypt($UserData->getUserMPass(), $securedKey, self::getKey($UserData, $key)); - CryptSession::saveSessionKey($userMPass); + // Comprobamos el hash de la clave del usuario con la guardada + if (Hash::checkHashKey($userMPass, $configHashMPass)) { + self::$gotMPass = true; + self::$clearUserMPass = $userMPass; - return self::MPASS_OK; - } - } catch (WrongKeyOrModifiedCiphertextException $e) { - return self::MPASS_CHECKOLD; + CryptSession::saveSessionKey($userMPass); + + return self::MPASS_OK; } + } catch (WrongKeyOrModifiedCiphertextException $e) { + return self::MPASS_CHECKOLD; } return self::MPASS_WRONG; @@ -226,7 +233,9 @@ class UserPass extends UserBase if ($configHashMPass === false) { return self::MPASS_NOTSET; - } elseif (null === $configHashMPass) { + } + + if (null === $configHashMPass) { $configHashMPass = Hash::hashKey($userMPass); ConfigDB::setValue('masterPwd', $configHashMPass); } diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 6c6131ca..606969c0 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,8 +407,8 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041201; - $version = [2, 1, 5]; + $build = 17041301; + $version = [2, 1, 6]; if ($normalized === true) { return [implode('', $version), $build]; diff --git a/inc/themes/material-blue/js/app-theme.min.js b/inc/themes/material-blue/js/app-theme.min.js index 5f4edfdb..e2632cb8 100644 --- a/inc/themes/material-blue/js/app-theme.min.js +++ b/inc/themes/material-blue/js/app-theme.min.js @@ -1,5 +1,5 @@ var $jscomp={scope:{},findInternal:function(a,f,c){a instanceof String&&(a=String(a));for(var g=a.length,h=0;h"); a.passwordData.complexity.numbers&&(d+="1234567890");a.passwordData.complexity.chars&&(d+="abcdefghijklmnopqrstuvwxyz",a.passwordData.complexity.uppercase&&(d+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"));for(;m++<=a.passwordData.complexity.numlength;)e+=d.charAt(Math.floor(Math.random()*(d.length-1)+0));$("#viewPass").attr("title",e);var c=zxcvbn(e);a.passwordData.passLength=e.length;b?(m=b.parent(),d=$("#"+b.attr("id")+"R"),a.outputResult(c,b),b=new MaterialTextfield,m.find("input:password").val(e),m.addClass(b.CssClasses_.IS_DIRTY).removeClass(b.CssClasses_.IS_INVALID), diff --git a/inc/themes/material-blue/js/mdl-jquery-modal-dialog.min.js b/inc/themes/material-blue/js/mdl-jquery-modal-dialog.min.js index 2b790245..5beaadd1 100644 --- a/inc/themes/material-blue/js/mdl-jquery-modal-dialog.min.js +++ b/inc/themes/material-blue/js/mdl-jquery-modal-dialog.min.js @@ -1,5 +1,5 @@ var $jscomp={scope:{},findInternal:function(b,a,d){b instanceof String&&(b=String(b));for(var c=b.length,e=0;e
    ').appendTo("body"); var d=$("#"+a.id),c=d.find(".mdl-card");null!=a.contentStyle&&c.css(a.contentStyle);null!=a.title&&$("
    "+a.title+"
    ").appendTo(c);null!=a.text&&$(a.text).appendTo(c);if(a.neutral||a.negative||a.positive){var e=$('
    ');if(a.neutral){a.neutral=$.extend({id:"neutral",title:"Neutral",onClick:null},a.neutral);var f=$('");f.click(function(c){c.preventDefault(); diff --git a/inc/themes/material-blue/views/main/login.inc b/inc/themes/material-blue/views/main/login.inc index 9a36fa26..1b7d73ee 100644 --- a/inc/themes/material-blue/views/main/login.inc +++ b/inc/themes/material-blue/views/main/login.inc @@ -21,7 +21,7 @@
    @@ -33,7 +33,7 @@
    + maxlength="255" autocomplete="off">
    @@ -44,7 +44,7 @@
    + maxlength="255" autocomplete="off">
    diff --git a/js/app-actions.min.js b/js/app-actions.min.js index 54e125d2..805a38de 100644 --- a/js/app-actions.min.js +++ b/js/app-actions.min.js @@ -1,5 +1,5 @@ var $jscomp={scope:{},findInternal:function(c,d,k){c instanceof String&&(c=String(c));for(var f=c.length,g=0;ga;a++)f.call(this,this._deferreds[a]);this._deferreds=null}function l(a,b,c,d){this.onFulfilled="function"==typeof a?a:null;this.onRejected="function"==typeof b?b:null;this.resolve=c;this.reject=d}function p(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(n){d||(d= -!0,c(n))}}var r=a.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},q=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};a.prototype["catch"]=function(a){return this.then(null,a)};a.prototype.then=function(b,c){var d=this;return new a(function(a,e){f.call(d,new l(b,c,a,e))})};a.all=function(){var b=Array.prototype.slice.call(1===arguments.length&&q(arguments[0])?arguments[0]:arguments);return new a(function(a,c){function d(f, -h){try{if(h&&("object"==typeof h||"function"==typeof h)){var g=h.then;if("function"==typeof g)return void g.call(h,function(a){d(f,a)},c)}b[f]=h;0===--e&&a(b)}catch(t){c(t)}}if(0===b.length)return a([]);for(var e=b.length,f=0;fd;d++)b[d].then(a,c)})}; -"undefined"!=typeof module&&module.exports?module.exports=a:b.Promise||(b.Promise=a)}(this),c.copy=function(b){return new Promise(function(c,a){if("string"!==typeof b&&!("text/plain"in b))throw Error("You must provide a text/plain type.");window.clipboardData.setData("Text","string"===typeof b?b:b["text/plain"])?c():a(Error("Copying was rejected."))})},c.paste=function(){return new Promise(function(b,c){var a=window.clipboardData.getData("Text");a?b(a):c(Error("Pasting was rejected."))})});return c}); +(function(e,c){"undefined"!==typeof module?module.exports=c():"function"===typeof define&&"object"===typeof define.amd?define(c):this[e]=c()})("clipboard",function(){if("undefined"===typeof document||!document.addEventListener)return null;var e={};e.copy=function(){function c(){d=!1;b=null;g&&window.getSelection().removeAllRanges();g=!1}var d=!1,b=null,g=!1;document.addEventListener("copy",function(c){if(d){for(var f in b)c.clipboardData.setData(f,b[f]);c.preventDefault()}});return function(f){return new Promise(function(e, +k){function h(b){try{if(document.execCommand("copy"))c(),e();else{if(b)throw c(),Error("Unable to copy. Perhaps it's not available in your browser?");var d=document.getSelection();if(!document.queryCommandEnabled("copy")&&d.isCollapsed){var f=document.createRange();f.selectNodeContents(document.body);d.removeAllRanges();d.addRange(f);g=!0}h(!0)}}catch(a){c(),k(a)}}d=!0;b="string"===typeof f?{"text/plain":f}:f instanceof Node?{"text/html":(new XMLSerializer).serializeToString(f)}:f;h(!1)})}}();e.paste= +function(){var c=!1,d,b;document.addEventListener("paste",function(g){if(c){c=!1;g.preventDefault();var f=d;d=null;f(g.clipboardData.getData(b))}});return function(g){return new Promise(function(f,e){c=!0;d=f;b=g||"text/plain";try{document.execCommand("paste")||(c=!1,e(Error("Unable to paste. Pasting only works in Internet Explorer at the moment.")))}catch(k){c=!1,e(Error(k))}})}}();e.isSupported=function(){var c=0a;a++)e.call(this,this._deferreds[a]);this._deferreds=null}function n(a,b,c,d){this.onFulfilled="function"==typeof a?a:null;this.onRejected="function"==typeof b?b:null;this.resolve=c;this.reject=d}function m(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(l){d||(d= +!0,c(l))}}var p=b.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},q=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};b.prototype["catch"]=function(a){return this.then(null,a)};b.prototype.then=function(a,c){var d=this;return new b(function(b,f){e.call(d,new n(a,c,b,f))})};b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&q(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(e, +g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(e,a)},c)}a[e]=g;0===--f&&b(a)}catch(t){c(t)}}if(0===a.length)return b([]);for(var f=a.length,e=0;ed;d++)a[d].then(b,c)})}; +"undefined"!=typeof module&&module.exports?module.exports=b:c.Promise||(c.Promise=b)}(this),e.copy=function(c){return new Promise(function(d,b){if("string"!==typeof c&&!("text/plain"in c))throw Error("You must provide a text/plain type.");window.clipboardData.setData("Text","string"===typeof c?c:c["text/plain"])?d():b(Error("Copying was rejected."))})},e.paste=function(){return new Promise(function(c,d){var b=window.clipboardData.getData("Text");b?c(b):d(Error("Pasting was rejected."))})});return e}); diff --git a/js/jquery-3.2.0.min.js b/js/jquery-3.2.0.min.js index 3b62c7f9..c9aa9336 100644 --- a/js/jquery-3.2.0.min.js +++ b/js/jquery-3.2.0.min.js @@ -1,5 +1,5 @@ var $jscomp={scope:{},findInternal:function(p,t,K){p instanceof String&&(p=String(p));for(var F=p.length,D=0;D= 0) { - var v = x*this[i++]+w[j]+c; - c = Math.floor(v/0x4000000); - w[j++] = v&0x3ffffff; - } - return c; -} + function am1(i, x, w, j, c, n) { + while (--n >= 0) { + var v = x * this[i++] + w[j] + c; + c = Math.floor(v / 0x4000000); + w[j++] = v & 0x3ffffff; + } + return c; + } + // am2 avoids a big mult-and-extract completely. // Max digit bits should be <= 30 because we do bitwise ops // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) -function am2(i,x,w,j,c,n) { - var xl = x&0x7fff, xh = x>>15; - while(--n >= 0) { - var l = this[i]&0x7fff; - var h = this[i++]>>15; - var m = xh*l+h*xl; - l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); - c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); - w[j++] = l&0x3fffffff; - } - return c; -} + function am2(i, x, w, j, c, n) { + var xl = x & 0x7fff, xh = x >> 15; + while (--n >= 0) { + var l = this[i] & 0x7fff; + var h = this[i++] >> 15; + var m = xh * l + h * xl; + l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff); + c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30); + w[j++] = l & 0x3fffffff; + } + return c; + } + // Alternately, set max digit bits to 28 since some // browsers slow down when dealing with 32-bit numbers. -function am3(i,x,w,j,c,n) { - var xl = x&0x3fff, xh = x>>14; - while(--n >= 0) { - var l = this[i]&0x3fff; - var h = this[i++]>>14; - var m = xh*l+h*xl; - l = xl*l+((m&0x3fff)<<14)+w[j]+c; - c = (l>>28)+(m>>14)+xh*h; - w[j++] = l&0xfffffff; - } - return c; -} -if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { - BigInteger.prototype.am = am2; - dbits = 30; -} -else if(j_lm && (navigator.appName != "Netscape")) { - BigInteger.prototype.am = am1; - dbits = 26; -} -else { // Mozilla/Netscape seems to prefer am3 - BigInteger.prototype.am = am3; - dbits = 28; -} + function am3(i, x, w, j, c, n) { + var xl = x & 0x3fff, xh = x >> 14; + while (--n >= 0) { + var l = this[i] & 0x3fff; + var h = this[i++] >> 14; + var m = xh * l + h * xl; + l = xl * l + ((m & 0x3fff) << 14) + w[j] + c; + c = (l >> 28) + (m >> 14) + xh * h; + w[j++] = l & 0xfffffff; + } + return c; + } -BigInteger.prototype.DB = dbits; -BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i]; - r.t = this.t; - r.s = this.s; -} + function bnpCopyTo(r) { + for (var i = this.t - 1; i >= 0; --i) r[i] = this[i]; + r.t = this.t; + r.s = this.s; + } // (protected) set from integer value x, -DV <= x < DV -function bnpFromInt(x) { - this.t = 1; - this.s = (x<0)?-1:0; - if(x > 0) this[0] = x; - else if(x < -1) this[0] = x+this.DV; - else this.t = 0; -} + function bnpFromInt(x) { + this.t = 1; + this.s = (x < 0) ? -1 : 0; + if (x > 0) this[0] = x; + else if (x < -1) this[0] = x + this.DV; + else this.t = 0; + } // return bigint initialized to value -function nbv(i) { var r = nbi(); r.fromInt(i); return r; } + function nbv(i) { + var r = nbi(); + r.fromInt(i); + return r; + } // (protected) set from string and radix -function bnpFromString(s,b) { - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 256) k = 8; // byte array - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else { this.fromRadix(s,b); return; } - this.t = 0; - this.s = 0; - var i = s.length, mi = false, sh = 0; - while(--i >= 0) { - var x = (k==8)?s[i]&0xff:intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-") mi = true; - continue; + function bnpFromString(s, b) { + var k; + if (b == 16) k = 4; + else if (b == 8) k = 3; + else if (b == 256) k = 8; // byte array + else if (b == 2) k = 1; + else if (b == 32) k = 5; + else if (b == 4) k = 2; + else { + this.fromRadix(s, b); + return; + } + this.t = 0; + this.s = 0; + var i = s.length, mi = false, sh = 0; + while (--i >= 0) { + var x = (k == 8) ? s[i] & 0xff : intAt(s, i); + if (x < 0) { + if (s.charAt(i) == "-") mi = true; + continue; + } + mi = false; + if (sh == 0) + this[this.t++] = x; + else if (sh + k > this.DB) { + this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh; + this[this.t++] = (x >> (this.DB - sh)); + } + else + this[this.t - 1] |= x << sh; + sh += k; + if (sh >= this.DB) sh -= this.DB; + } + if (k == 8 && (s[0] & 0x80) != 0) { + this.s = -1; + if (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh; + } + this.clamp(); + if (mi) BigInteger.ZERO.subTo(this, this); } - mi = false; - if(sh == 0) - this[this.t++] = x; - else if(sh+k > this.DB) { - this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); - } - else - this[this.t-1] |= x<= this.DB) sh -= this.DB; - } - if(k == 8 && (s[0]&0x80) != 0) { - this.s = -1; - if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t; -} + function bnpClamp() { + var c = this.s & this.DM; + while (this.t > 0 && this[this.t - 1] == c) --this.t; + } // (public) return string representation in given radix -function bnToString(b) { - if(this.s < 0) return "-"+this.negate().toString(b); - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else return this.toRadix(b); - var km = (1< 0) { - if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } - while(i >= 0) { - if(p < k) { - d = (this[i]&((1<>(p+=this.DB-k); - } - else { - d = (this[i]>>(p-=k))&km; - if(p <= 0) { p += this.DB; --i; } - } - if(d > 0) m = true; - if(m) r += int2char(d); + function bnToString(b) { + if (this.s < 0) return "-" + this.negate().toString(b); + var k; + if (b == 16) k = 4; + else if (b == 8) k = 3; + else if (b == 2) k = 1; + else if (b == 32) k = 5; + else if (b == 4) k = 2; + else return this.toRadix(b); + var km = (1 << k) - 1, d, m = false, r = "", i = this.t; + var p = this.DB - (i * this.DB) % k; + if (i-- > 0) { + if (p < this.DB && (d = this[i] >> p) > 0) { + m = true; + r = int2char(d); + } + while (i >= 0) { + if (p < k) { + d = (this[i] & ((1 << p) - 1)) << (k - p); + d |= this[--i] >> (p += this.DB - k); + } + else { + d = (this[i] >> (p -= k)) & km; + if (p <= 0) { + p += this.DB; + --i; + } + } + if (d > 0) m = true; + if (m) r += int2char(d); + } + } + return m ? r : "0"; } - } - return m?r:"0"; -} // (public) -this -function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } + function bnNegate() { + var r = nbi(); + BigInteger.ZERO.subTo(this, r); + return r; + } // (public) |this| -function bnAbs() { return (this.s<0)?this.negate():this; } + function bnAbs() { + return (this.s < 0) ? this.negate() : this; + } // (public) return + if this > a, - if this < a, 0 if equal -function bnCompareTo(a) { - var r = this.s-a.s; - if(r != 0) return r; - var i = this.t; - r = i-a.t; - if(r != 0) return (this.s<0)?-r:r; - while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; - return 0; -} + function bnCompareTo(a) { + var r = this.s - a.s; + if (r != 0) return r; + var i = this.t; + r = i - a.t; + if (r != 0) return (this.s < 0) ? -r : r; + while (--i >= 0) if ((r = this[i] - a[i]) != 0) return r; + return 0; + } // returns bit length of the integer x -function nbits(x) { - var r = 1, t; - if((t=x>>>16) != 0) { x = t; r += 16; } - if((t=x>>8) != 0) { x = t; r += 8; } - if((t=x>>4) != 0) { x = t; r += 4; } - if((t=x>>2) != 0) { x = t; r += 2; } - if((t=x>>1) != 0) { x = t; r += 1; } - return r; -} + function nbits(x) { + var r = 1, t; + if ((t = x >>> 16) != 0) { + x = t; + r += 16; + } + if ((t = x >> 8) != 0) { + x = t; + r += 8; + } + if ((t = x >> 4) != 0) { + x = t; + r += 4; + } + if ((t = x >> 2) != 0) { + x = t; + r += 2; + } + if ((t = x >> 1) != 0) { + x = t; + r += 1; + } + return r; + } // (public) return the number of bits in "this" -function bnBitLength() { - if(this.t <= 0) return 0; - return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); -} + function bnBitLength() { + if (this.t <= 0) return 0; + return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM)); + } // (protected) r = this << n*DB -function bnpDLShiftTo(n,r) { - var i; - for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; - for(i = n-1; i >= 0; --i) r[i] = 0; - r.t = this.t+n; - r.s = this.s; -} + function bnpDLShiftTo(n, r) { + var i; + for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]; + for (i = n - 1; i >= 0; --i) r[i] = 0; + r.t = this.t + n; + r.s = this.s; + } // (protected) r = this >> n*DB -function bnpDRShiftTo(n,r) { - for(var i = n; i < this.t; ++i) r[i-n] = this[i]; - r.t = Math.max(this.t-n,0); - r.s = this.s; -} + function bnpDRShiftTo(n, r) { + for (var i = n; i < this.t; ++i) r[i - n] = this[i]; + r.t = Math.max(this.t - n, 0); + r.s = this.s; + } // (protected) r = this << n -function bnpLShiftTo(n,r) { - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<= 0; --i) { - r[i+ds+1] = (this[i]>>cbs)|c; - c = (this[i]&bm)<= 0; --i) r[i] = 0; - r[ds] = c; - r.t = this.t+ds+1; - r.s = this.s; - r.clamp(); -} + function bnpLShiftTo(n, r) { + var bs = n % this.DB; + var cbs = this.DB - bs; + var bm = (1 << cbs) - 1; + var ds = Math.floor(n / this.DB), c = (this.s << bs) & this.DM, i; + for (i = this.t - 1; i >= 0; --i) { + r[i + ds + 1] = (this[i] >> cbs) | c; + c = (this[i] & bm) << bs; + } + for (i = ds - 1; i >= 0; --i) r[i] = 0; + r[ds] = c; + r.t = this.t + ds + 1; + r.s = this.s; + r.clamp(); + } // (protected) r = this >> n -function bnpRShiftTo(n,r) { - r.s = this.s; - var ds = Math.floor(n/this.DB); - if(ds >= this.t) { r.t = 0; return; } - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<>bs; - for(var i = ds+1; i < this.t; ++i) { - r[i-ds-1] |= (this[i]&bm)<>bs; - } - if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<= this.t) { + r.t = 0; + return; + } + var bs = n % this.DB; + var cbs = this.DB - bs; + var bm = (1 << bs) - 1; + r[0] = this[ds] >> bs; + for (var i = ds + 1; i < this.t; ++i) { + r[i - ds - 1] |= (this[i] & bm) << cbs; + r[i - ds] = this[i] >> bs; + } + if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs; + r.t = this.t - ds; + r.clamp(); + } // (protected) r = this - a -function bnpSubTo(a,r) { - var i = 0, c = 0, m = Math.min(a.t,this.t); - while(i < m) { - c += this[i]-a[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - if(a.t < this.t) { - c -= a.s; - while(i < this.t) { - c += this[i]; - r[i++] = c&this.DM; - c >>= this.DB; + function bnpSubTo(a, r) { + var i = 0, c = 0, m = Math.min(a.t, this.t); + while (i < m) { + c += this[i] - a[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + if (a.t < this.t) { + c -= a.s; + while (i < this.t) { + c += this[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while (i < a.t) { + c -= a[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + c -= a.s; + } + r.s = (c < 0) ? -1 : 0; + if (c < -1) r[i++] = this.DV + c; + else if (c > 0) r[i++] = c; + r.t = i; + r.clamp(); } - c += this.s; - } - else { - c += this.s; - while(i < a.t) { - c -= a[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c -= a.s; - } - r.s = (c<0)?-1:0; - if(c < -1) r[i++] = this.DV+c; - else if(c > 0) r[i++] = c; - r.t = i; - r.clamp(); -} // (protected) r = this * a, r != this,a (HAC 14.12) // "this" should be the larger one if appropriate. -function bnpMultiplyTo(a,r) { - var x = this.abs(), y = a.abs(); - var i = x.t; - r.t = i+y.t; - while(--i >= 0) r[i] = 0; - for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); - r.s = 0; - r.clamp(); - if(this.s != a.s) BigInteger.ZERO.subTo(r,r); -} + function bnpMultiplyTo(a, r) { + var x = this.abs(), y = a.abs(); + var i = x.t; + r.t = i + y.t; + while (--i >= 0) r[i] = 0; + for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t); + r.s = 0; + r.clamp(); + if (this.s != a.s) BigInteger.ZERO.subTo(r, r); + } // (protected) r = this^2, r != this (HAC 14.16) -function bnpSquareTo(r) { - var x = this.abs(); - var i = r.t = 2*x.t; - while(--i >= 0) r[i] = 0; - for(i = 0; i < x.t-1; ++i) { - var c = x.am(i,x[i],r,2*i,0,1); - if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { - r[i+x.t] -= x.DV; - r[i+x.t+1] = 1; + function bnpSquareTo(r) { + var x = this.abs(); + var i = r.t = 2 * x.t; + while (--i >= 0) r[i] = 0; + for (i = 0; i < x.t - 1; ++i) { + var c = x.am(i, x[i], r, 2 * i, 0, 1); + if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) { + r[i + x.t] -= x.DV; + r[i + x.t + 1] = 1; + } + } + if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1); + r.s = 0; + r.clamp(); } - } - if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); - r.s = 0; - r.clamp(); -} // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) // r != q, this != m. q or r may be null. -function bnpDivRemTo(m,q,r) { - var pm = m.abs(); - if(pm.t <= 0) return; - var pt = this.abs(); - if(pt.t < pm.t) { - if(q != null) q.fromInt(0); - if(r != null) this.copyTo(r); - return; - } - if(r == null) r = nbi(); - var y = nbi(), ts = this.s, ms = m.s; - var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus - if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } - else { pm.copyTo(y); pt.copyTo(r); } - var ys = y.t; - var y0 = y[ys-1]; - if(y0 == 0) return; - var yt = y0*(1<1)?y[ys-2]>>this.F2:0); - var d1 = this.FV/yt, d2 = (1<= 0) { - r[r.t++] = 1; - r.subTo(t,r); - } - BigInteger.ONE.dlShiftTo(ys,t); - t.subTo(y,y); // "negative" y so we can replace sub with am later - while(y.t < ys) y[y.t++] = 0; - while(--j >= 0) { - // Estimate quotient digit - var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); - if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out - y.dlShiftTo(j,t); - r.subTo(t,r); - while(r[i] < --qd) r.subTo(t,r); + function bnpDivRemTo(m, q, r) { + var pm = m.abs(); + if (pm.t <= 0) return; + var pt = this.abs(); + if (pt.t < pm.t) { + if (q != null) q.fromInt(0); + if (r != null) this.copyTo(r); + return; + } + if (r == null) r = nbi(); + var y = nbi(), ts = this.s, ms = m.s; + var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus + if (nsh > 0) { + pm.lShiftTo(nsh, y); + pt.lShiftTo(nsh, r); + } + else { + pm.copyTo(y); + pt.copyTo(r); + } + var ys = y.t; + var y0 = y[ys - 1]; + if (y0 == 0) return; + var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0); + var d1 = this.FV / yt, d2 = (1 << this.F1) / yt, e = 1 << this.F2; + var i = r.t, j = i - ys, t = (q == null) ? nbi() : q; + y.dlShiftTo(j, t); + if (r.compareTo(t) >= 0) { + r[r.t++] = 1; + r.subTo(t, r); + } + BigInteger.ONE.dlShiftTo(ys, t); + t.subTo(y, y); // "negative" y so we can replace sub with am later + while (y.t < ys) y[y.t++] = 0; + while (--j >= 0) { + // Estimate quotient digit + var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2); + if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out + y.dlShiftTo(j, t); + r.subTo(t, r); + while (r[i] < --qd) r.subTo(t, r); + } + } + if (q != null) { + r.drShiftTo(ys, q); + if (ts != ms) BigInteger.ZERO.subTo(q, q); + } + r.t = ys; + r.clamp(); + if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder + if (ts < 0) BigInteger.ZERO.subTo(r, r); } - } - if(q != null) { - r.drShiftTo(ys,q); - if(ts != ms) BigInteger.ZERO.subTo(q,q); - } - r.t = ys; - r.clamp(); - if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder - if(ts < 0) BigInteger.ZERO.subTo(r,r); -} // (public) this mod a -function bnMod(a) { - var r = nbi(); - this.abs().divRemTo(a,null,r); - if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); - return r; -} + function bnMod(a) { + var r = nbi(); + this.abs().divRemTo(a, null, r); + if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r); + return r; + } // Modular reduction using "classic" algorithm -function Classic(m) { this.m = m; } -function cConvert(x) { - if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); - else return x; -} -function cRevert(x) { return x; } -function cReduce(x) { x.divRemTo(this.m,null,x); } -function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } -function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + function Classic(m) { + this.m = m; + } -Classic.prototype.convert = cConvert; -Classic.prototype.revert = cRevert; -Classic.prototype.reduce = cReduce; -Classic.prototype.mulTo = cMulTo; -Classic.prototype.sqrTo = cSqrTo; + function cConvert(x) { + if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); + else return x; + } + + function cRevert(x) { + return x; + } + + function cReduce(x) { + x.divRemTo(this.m, null, x); + } + + function cMulTo(x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); + } + + function cSqrTo(x, r) { + x.squareTo(r); + this.reduce(r); + } + + Classic.prototype.convert = cConvert; + Classic.prototype.revert = cRevert; + Classic.prototype.reduce = cReduce; + Classic.prototype.mulTo = cMulTo; + Classic.prototype.sqrTo = cSqrTo; // (protected) return "-1/this % 2^DB"; useful for Mont. reduction // justification: @@ -436,131 +504,146 @@ Classic.prototype.sqrTo = cSqrTo; // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. // JS multiply "overflows" differently from C/C++, so care is needed here. -function bnpInvDigit() { - if(this.t < 1) return 0; - var x = this[0]; - if((x&1) == 0) return 0; - var y = x&3; // y == 1/x mod 2^2 - y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 - y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 - y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 - // last step - calculate inverse mod DV directly; - // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints - y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits - // we really want the negative inverse, and -DV < y < DV - return (y>0)?this.DV-y:-y; -} + function bnpInvDigit() { + if (this.t < 1) return 0; + var x = this[0]; + if ((x & 1) == 0) return 0; + var y = x & 3; // y == 1/x mod 2^2 + y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4 + y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8 + y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16 + // last step - calculate inverse mod DV directly; + // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints + y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits + // we really want the negative inverse, and -DV < y < DV + return (y > 0) ? this.DV - y : -y; + } // Montgomery reduction -function Montgomery(m) { - this.m = m; - this.mp = m.invDigit(); - this.mpl = this.mp&0x7fff; - this.mph = this.mp>>15; - this.um = (1<<(m.DB-15))-1; - this.mt2 = 2*m.t; -} + function Montgomery(m) { + this.m = m; + this.mp = m.invDigit(); + this.mpl = this.mp & 0x7fff; + this.mph = this.mp >> 15; + this.um = (1 << (m.DB - 15)) - 1; + this.mt2 = 2 * m.t; + } // xR mod m -function montConvert(x) { - var r = nbi(); - x.abs().dlShiftTo(this.m.t,r); - r.divRemTo(this.m,null,r); - if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); - return r; -} + function montConvert(x) { + var r = nbi(); + x.abs().dlShiftTo(this.m.t, r); + r.divRemTo(this.m, null, r); + if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r); + return r; + } // x/R mod m -function montRevert(x) { - var r = nbi(); - x.copyTo(r); - this.reduce(r); - return r; -} + function montRevert(x) { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + } // x = x/R mod m (HAC 14.32) -function montReduce(x) { - while(x.t <= this.mt2) // pad x so am has enough room later - x[x.t++] = 0; - for(var i = 0; i < this.m.t; ++i) { - // faster way of calculating u0 = x[i]*mp mod DV - var j = x[i]&0x7fff; - var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; - // use am to combine the multiply-shift-add into one call - j = i+this.m.t; - x[j] += this.m.am(0,u0,x,i,0,this.m.t); - // propagate carry - while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } - } - x.clamp(); - x.drShiftTo(this.m.t,x); - if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); -} + function montReduce(x) { + while (x.t <= this.mt2) // pad x so am has enough room later + x[x.t++] = 0; + for (var i = 0; i < this.m.t; ++i) { + // faster way of calculating u0 = x[i]*mp mod DV + var j = x[i] & 0x7fff; + var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM; + // use am to combine the multiply-shift-add into one call + j = i + this.m.t; + x[j] += this.m.am(0, u0, x, i, 0, this.m.t); + // propagate carry + while (x[j] >= x.DV) { + x[j] -= x.DV; + x[++j]++; + } + } + x.clamp(); + x.drShiftTo(this.m.t, x); + if (x.compareTo(this.m) >= 0) x.subTo(this.m, x); + } // r = "x^2/R mod m"; x != r -function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + function montSqrTo(x, r) { + x.squareTo(r); + this.reduce(r); + } // r = "xy/R mod m"; x,y != r -function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + function montMulTo(x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); + } -Montgomery.prototype.convert = montConvert; -Montgomery.prototype.revert = montRevert; -Montgomery.prototype.reduce = montReduce; -Montgomery.prototype.mulTo = montMulTo; -Montgomery.prototype.sqrTo = montSqrTo; + Montgomery.prototype.convert = montConvert; + Montgomery.prototype.revert = montRevert; + Montgomery.prototype.reduce = montReduce; + Montgomery.prototype.mulTo = montMulTo; + Montgomery.prototype.sqrTo = montSqrTo; // (protected) true iff this is even -function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } + function bnpIsEven() { + return ((this.t > 0) ? (this[0] & 1) : this.s) == 0; + } // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) -function bnpExp(e,z) { - if(e > 0xffffffff || e < 1) return BigInteger.ONE; - var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; - g.copyTo(r); - while(--i >= 0) { - z.sqrTo(r,r2); - if((e&(1< 0) z.mulTo(r2,g,r); - else { var t = r; r = r2; r2 = t; } - } - return z.revert(r); -} + function bnpExp(e, z) { + if (e > 0xffffffff || e < 1) return BigInteger.ONE; + var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e) - 1; + g.copyTo(r); + while (--i >= 0) { + z.sqrTo(r, r2); + if ((e & (1 << i)) > 0) z.mulTo(r2, g, r); + else { + var t = r; + r = r2; + r2 = t; + } + } + return z.revert(r); + } // (public) this^e % m, 0 <= e < 2^32 -function bnModPowInt(e,m) { - var z; - if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); - return this.exp(e,z); -} + function bnModPowInt(e, m) { + var z; + if (e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); + return this.exp(e, z); + } // protected -BigInteger.prototype.copyTo = bnpCopyTo; -BigInteger.prototype.fromInt = bnpFromInt; -BigInteger.prototype.fromString = bnpFromString; -BigInteger.prototype.clamp = bnpClamp; -BigInteger.prototype.dlShiftTo = bnpDLShiftTo; -BigInteger.prototype.drShiftTo = bnpDRShiftTo; -BigInteger.prototype.lShiftTo = bnpLShiftTo; -BigInteger.prototype.rShiftTo = bnpRShiftTo; -BigInteger.prototype.subTo = bnpSubTo; -BigInteger.prototype.multiplyTo = bnpMultiplyTo; -BigInteger.prototype.squareTo = bnpSquareTo; -BigInteger.prototype.divRemTo = bnpDivRemTo; -BigInteger.prototype.invDigit = bnpInvDigit; -BigInteger.prototype.isEven = bnpIsEven; -BigInteger.prototype.exp = bnpExp; + BigInteger.prototype.copyTo = bnpCopyTo; + BigInteger.prototype.fromInt = bnpFromInt; + BigInteger.prototype.fromString = bnpFromString; + BigInteger.prototype.clamp = bnpClamp; + BigInteger.prototype.dlShiftTo = bnpDLShiftTo; + BigInteger.prototype.drShiftTo = bnpDRShiftTo; + BigInteger.prototype.lShiftTo = bnpLShiftTo; + BigInteger.prototype.rShiftTo = bnpRShiftTo; + BigInteger.prototype.subTo = bnpSubTo; + BigInteger.prototype.multiplyTo = bnpMultiplyTo; + BigInteger.prototype.squareTo = bnpSquareTo; + BigInteger.prototype.divRemTo = bnpDivRemTo; + BigInteger.prototype.invDigit = bnpInvDigit; + BigInteger.prototype.isEven = bnpIsEven; + BigInteger.prototype.exp = bnpExp; // public -BigInteger.prototype.toString = bnToString; -BigInteger.prototype.negate = bnNegate; -BigInteger.prototype.abs = bnAbs; -BigInteger.prototype.compareTo = bnCompareTo; -BigInteger.prototype.bitLength = bnBitLength; -BigInteger.prototype.mod = bnMod; -BigInteger.prototype.modPowInt = bnModPowInt; + BigInteger.prototype.toString = bnToString; + BigInteger.prototype.negate = bnNegate; + BigInteger.prototype.abs = bnAbs; + BigInteger.prototype.compareTo = bnCompareTo; + BigInteger.prototype.bitLength = bnBitLength; + BigInteger.prototype.mod = bnMod; + BigInteger.prototype.modPowInt = bnModPowInt; // "constants" -BigInteger.ZERO = nbv(0); -BigInteger.ONE = nbv(1); + BigInteger.ZERO = nbv(0); + BigInteger.ONE = nbv(1); // Copyright (c) 2005-2009 Tom Wu // All Rights Reserved. @@ -572,643 +655,795 @@ BigInteger.ONE = nbv(1); // Version 1.2: square() API, isProbablePrime fix // (public) -function bnClone() { var r = nbi(); this.copyTo(r); return r; } + function bnClone() { + var r = nbi(); + this.copyTo(r); + return r; + } // (public) return value as integer -function bnIntValue() { - if(this.s < 0) { - if(this.t == 1) return this[0]-this.DV; - else if(this.t == 0) return -1; - } - else if(this.t == 1) return this[0]; - else if(this.t == 0) return 0; - // assumes 16 < DB < 32 - return ((this[1]&((1<<(32-this.DB))-1))<>24; } + function bnByteValue() { + return (this.t == 0) ? this.s : (this[0] << 24) >> 24; + } // (public) return value as short (assumes DB>=16) -function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } + function bnShortValue() { + return (this.t == 0) ? this.s : (this[0] << 16) >> 16; + } // (protected) return x s.t. r^x < DV -function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } + function bnpChunkSize(r) { + return Math.floor(Math.LN2 * this.DB / Math.log(r)); + } // (public) 0 if this == 0, 1 if this > 0 -function bnSigNum() { - if(this.s < 0) return -1; - else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; - else return 1; -} + function bnSigNum() { + if (this.s < 0) return -1; + else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; + else return 1; + } // (protected) convert to radix string -function bnpToRadix(b) { - if(b == null) b = 10; - if(this.signum() == 0 || b < 2 || b > 36) return "0"; - var cs = this.chunkSize(b); - var a = Math.pow(b,cs); - var d = nbv(a), y = nbi(), z = nbi(), r = ""; - this.divRemTo(d,y,z); - while(y.signum() > 0) { - r = (a+z.intValue()).toString(b).substr(1) + r; - y.divRemTo(d,y,z); - } - return z.intValue().toString(b) + r; -} + function bnpToRadix(b) { + if (b == null) b = 10; + if (this.signum() == 0 || b < 2 || b > 36) return "0"; + var cs = this.chunkSize(b); + var a = Math.pow(b, cs); + var d = nbv(a), y = nbi(), z = nbi(), r = ""; + this.divRemTo(d, y, z); + while (y.signum() > 0) { + r = (a + z.intValue()).toString(b).substr(1) + r; + y.divRemTo(d, y, z); + } + return z.intValue().toString(b) + r; + } // (protected) convert from radix string -function bnpFromRadix(s,b) { - this.fromInt(0); - if(b == null) b = 10; - var cs = this.chunkSize(b); - var d = Math.pow(b,cs), mi = false, j = 0, w = 0; - for(var i = 0; i < s.length; ++i) { - var x = intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-" && this.signum() == 0) mi = true; - continue; + function bnpFromRadix(s, b) { + this.fromInt(0); + if (b == null) b = 10; + var cs = this.chunkSize(b); + var d = Math.pow(b, cs), mi = false, j = 0, w = 0; + for (var i = 0; i < s.length; ++i) { + var x = intAt(s, i); + if (x < 0) { + if (s.charAt(i) == "-" && this.signum() == 0) mi = true; + continue; + } + w = b * w + x; + if (++j >= cs) { + this.dMultiply(d); + this.dAddOffset(w, 0); + j = 0; + w = 0; + } + } + if (j > 0) { + this.dMultiply(Math.pow(b, j)); + this.dAddOffset(w, 0); + } + if (mi) BigInteger.ZERO.subTo(this, this); } - w = b*w+x; - if(++j >= cs) { - this.dMultiply(d); - this.dAddOffset(w,0); - j = 0; - w = 0; - } - } - if(j > 0) { - this.dMultiply(Math.pow(b,j)); - this.dAddOffset(w,0); - } - if(mi) BigInteger.ZERO.subTo(this,this); -} // (protected) alternate constructor -function bnpFromNumber(a,b,c) { - if("number" == typeof b) { - // new BigInteger(int,int,RNG) - if(a < 2) this.fromInt(1); - else { - this.fromNumber(a,c); - if(!this.testBit(a-1)) // force MSB set - this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); - if(this.isEven()) this.dAddOffset(1,0); // force odd - while(!this.isProbablePrime(b)) { - this.dAddOffset(2,0); - if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); - } + function bnpFromNumber(a, b, c) { + if ("number" == typeof b) { + // new BigInteger(int,int,RNG) + if (a < 2) this.fromInt(1); + else { + this.fromNumber(a, c); + if (!this.testBit(a - 1)) // force MSB set + this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this); + if (this.isEven()) this.dAddOffset(1, 0); // force odd + while (!this.isProbablePrime(b)) { + this.dAddOffset(2, 0); + if (this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a - 1), this); + } + } + } + else { + // new BigInteger(int,RNG) + var x = new Array(), t = a & 7; + x.length = (a >> 3) + 1; + b.nextBytes(x); + if (t > 0) x[0] &= ((1 << t) - 1); else x[0] = 0; + this.fromString(x, 256); + } } - } - else { - // new BigInteger(int,RNG) - var x = new Array(), t = a&7; - x.length = (a>>3)+1; - b.nextBytes(x); - if(t > 0) x[0] &= ((1< 0) { - if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p) - r[k++] = d|(this.s<<(this.DB-p)); - while(i >= 0) { - if(p < 8) { - d = (this[i]&((1<>(p+=this.DB-8); - } - else { - d = (this[i]>>(p-=8))&0xff; - if(p <= 0) { p += this.DB; --i; } - } - if((d&0x80) != 0) d |= -256; - if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; - if(k > 0 || d != this.s) r[k++] = d; + function bnToByteArray() { + var i = this.t, r = new Array(); + r[0] = this.s; + var p = this.DB - (i * this.DB) % 8, d, k = 0; + if (i-- > 0) { + if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) + r[k++] = d | (this.s << (this.DB - p)); + while (i >= 0) { + if (p < 8) { + d = (this[i] & ((1 << p) - 1)) << (8 - p); + d |= this[--i] >> (p += this.DB - 8); + } + else { + d = (this[i] >> (p -= 8)) & 0xff; + if (p <= 0) { + p += this.DB; + --i; + } + } + if ((d & 0x80) != 0) d |= -256; + if (k == 0 && (this.s & 0x80) != (d & 0x80)) ++k; + if (k > 0 || d != this.s) r[k++] = d; + } + } + return r; } - } - return r; -} -function bnEquals(a) { return(this.compareTo(a)==0); } -function bnMin(a) { return(this.compareTo(a)<0)?this:a; } -function bnMax(a) { return(this.compareTo(a)>0)?this:a; } + function bnEquals(a) { + return (this.compareTo(a) == 0); + } + + function bnMin(a) { + return (this.compareTo(a) < 0) ? this : a; + } + + function bnMax(a) { + return (this.compareTo(a) > 0) ? this : a; + } // (protected) r = this op a (bitwise) -function bnpBitwiseTo(a,op,r) { - var i, f, m = Math.min(a.t,this.t); - for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]); - if(a.t < this.t) { - f = a.s&this.DM; - for(i = m; i < this.t; ++i) r[i] = op(this[i],f); - r.t = this.t; - } - else { - f = this.s&this.DM; - for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); - r.t = a.t; - } - r.s = op(this.s,a.s); - r.clamp(); -} + function bnpBitwiseTo(a, op, r) { + var i, f, m = Math.min(a.t, this.t); + for (i = 0; i < m; ++i) r[i] = op(this[i], a[i]); + if (a.t < this.t) { + f = a.s & this.DM; + for (i = m; i < this.t; ++i) r[i] = op(this[i], f); + r.t = this.t; + } + else { + f = this.s & this.DM; + for (i = m; i < a.t; ++i) r[i] = op(f, a[i]); + r.t = a.t; + } + r.s = op(this.s, a.s); + r.clamp(); + } // (public) this & a -function op_and(x,y) { return x&y; } -function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } + function op_and(x, y) { + return x & y; + } + + function bnAnd(a) { + var r = nbi(); + this.bitwiseTo(a, op_and, r); + return r; + } // (public) this | a -function op_or(x,y) { return x|y; } -function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } + function op_or(x, y) { + return x | y; + } + + function bnOr(a) { + var r = nbi(); + this.bitwiseTo(a, op_or, r); + return r; + } // (public) this ^ a -function op_xor(x,y) { return x^y; } -function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } + function op_xor(x, y) { + return x ^ y; + } + + function bnXor(a) { + var r = nbi(); + this.bitwiseTo(a, op_xor, r); + return r; + } // (public) this & ~a -function op_andnot(x,y) { return x&~y; } -function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } + function op_andnot(x, y) { + return x & ~y; + } + + function bnAndNot(a) { + var r = nbi(); + this.bitwiseTo(a, op_andnot, r); + return r; + } // (public) ~this -function bnNot() { - var r = nbi(); - for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; - r.t = this.t; - r.s = ~this.s; - return r; -} + function bnNot() { + var r = nbi(); + for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i]; + r.t = this.t; + r.s = ~this.s; + return r; + } // (public) this << n -function bnShiftLeft(n) { - var r = nbi(); - if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); - return r; -} + function bnShiftLeft(n) { + var r = nbi(); + if (n < 0) this.rShiftTo(-n, r); else this.lShiftTo(n, r); + return r; + } // (public) this >> n -function bnShiftRight(n) { - var r = nbi(); - if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); - return r; -} + function bnShiftRight(n) { + var r = nbi(); + if (n < 0) this.lShiftTo(-n, r); else this.rShiftTo(n, r); + return r; + } // return index of lowest 1-bit in x, x < 2^31 -function lbit(x) { - if(x == 0) return -1; - var r = 0; - if((x&0xffff) == 0) { x >>= 16; r += 16; } - if((x&0xff) == 0) { x >>= 8; r += 8; } - if((x&0xf) == 0) { x >>= 4; r += 4; } - if((x&3) == 0) { x >>= 2; r += 2; } - if((x&1) == 0) ++r; - return r; -} + function lbit(x) { + if (x == 0) return -1; + var r = 0; + if ((x & 0xffff) == 0) { + x >>= 16; + r += 16; + } + if ((x & 0xff) == 0) { + x >>= 8; + r += 8; + } + if ((x & 0xf) == 0) { + x >>= 4; + r += 4; + } + if ((x & 3) == 0) { + x >>= 2; + r += 2; + } + if ((x & 1) == 0) ++r; + return r; + } // (public) returns index of lowest 1-bit (or -1 if none) -function bnGetLowestSetBit() { - for(var i = 0; i < this.t; ++i) - if(this[i] != 0) return i*this.DB+lbit(this[i]); - if(this.s < 0) return this.t*this.DB; - return -1; -} + function bnGetLowestSetBit() { + for (var i = 0; i < this.t; ++i) + if (this[i] != 0) return i * this.DB + lbit(this[i]); + if (this.s < 0) return this.t * this.DB; + return -1; + } // return number of 1 bits in x -function cbit(x) { - var r = 0; - while(x != 0) { x &= x-1; ++r; } - return r; -} + function cbit(x) { + var r = 0; + while (x != 0) { + x &= x - 1; + ++r; + } + return r; + } // (public) return number of set bits -function bnBitCount() { - var r = 0, x = this.s&this.DM; - for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); - return r; -} + function bnBitCount() { + var r = 0, x = this.s & this.DM; + for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x); + return r; + } // (public) true iff nth bit is set -function bnTestBit(n) { - var j = Math.floor(n/this.DB); - if(j >= this.t) return(this.s!=0); - return((this[j]&(1<<(n%this.DB)))!=0); -} + function bnTestBit(n) { + var j = Math.floor(n / this.DB); + if (j >= this.t) return (this.s != 0); + return ((this[j] & (1 << (n % this.DB))) != 0); + } // (protected) this op (1<>= this.DB; - } - if(a.t < this.t) { - c += a.s; - while(i < this.t) { - c += this[i]; - r[i++] = c&this.DM; - c >>= this.DB; + function bnpAddTo(a, r) { + var i = 0, c = 0, m = Math.min(a.t, this.t); + while (i < m) { + c += this[i] + a[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + if (a.t < this.t) { + c += a.s; + while (i < this.t) { + c += this[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while (i < a.t) { + c += a[i]; + r[i++] = c & this.DM; + c >>= this.DB; + } + c += a.s; + } + r.s = (c < 0) ? -1 : 0; + if (c > 0) r[i++] = c; + else if (c < -1) r[i++] = this.DV + c; + r.t = i; + r.clamp(); } - c += this.s; - } - else { - c += this.s; - while(i < a.t) { - c += a[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c += a.s; - } - r.s = (c<0)?-1:0; - if(c > 0) r[i++] = c; - else if(c < -1) r[i++] = this.DV+c; - r.t = i; - r.clamp(); -} // (public) this + a -function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } + function bnAdd(a) { + var r = nbi(); + this.addTo(a, r); + return r; + } // (public) this - a -function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } + function bnSubtract(a) { + var r = nbi(); + this.subTo(a, r); + return r; + } // (public) this * a -function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } + function bnMultiply(a) { + var r = nbi(); + this.multiplyTo(a, r); + return r; + } // (public) this^2 -function bnSquare() { var r = nbi(); this.squareTo(r); return r; } + function bnSquare() { + var r = nbi(); + this.squareTo(r); + return r; + } // (public) this / a -function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } + function bnDivide(a) { + var r = nbi(); + this.divRemTo(a, r, null); + return r; + } // (public) this % a -function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } + function bnRemainder(a) { + var r = nbi(); + this.divRemTo(a, null, r); + return r; + } // (public) [this/a,this%a] -function bnDivideAndRemainder(a) { - var q = nbi(), r = nbi(); - this.divRemTo(a,q,r); - return new Array(q,r); -} + function bnDivideAndRemainder(a) { + var q = nbi(), r = nbi(); + this.divRemTo(a, q, r); + return new Array(q, r); + } // (protected) this *= n, this >= 0, 1 < n < DV -function bnpDMultiply(n) { - this[this.t] = this.am(0,n-1,this,0,0,this.t); - ++this.t; - this.clamp(); -} + function bnpDMultiply(n) { + this[this.t] = this.am(0, n - 1, this, 0, 0, this.t); + ++this.t; + this.clamp(); + } // (protected) this += n << w words, this >= 0 -function bnpDAddOffset(n,w) { - if(n == 0) return; - while(this.t <= w) this[this.t++] = 0; - this[w] += n; - while(this[w] >= this.DV) { - this[w] -= this.DV; - if(++w >= this.t) this[this.t++] = 0; - ++this[w]; - } -} + function bnpDAddOffset(n, w) { + if (n == 0) return; + while (this.t <= w) this[this.t++] = 0; + this[w] += n; + while (this[w] >= this.DV) { + this[w] -= this.DV; + if (++w >= this.t) this[this.t++] = 0; + ++this[w]; + } + } // A "null" reducer -function NullExp() {} -function nNop(x) { return x; } -function nMulTo(x,y,r) { x.multiplyTo(y,r); } -function nSqrTo(x,r) { x.squareTo(r); } + function NullExp() { + } -NullExp.prototype.convert = nNop; -NullExp.prototype.revert = nNop; -NullExp.prototype.mulTo = nMulTo; -NullExp.prototype.sqrTo = nSqrTo; + function nNop(x) { + return x; + } + + function nMulTo(x, y, r) { + x.multiplyTo(y, r); + } + + function nSqrTo(x, r) { + x.squareTo(r); + } + + NullExp.prototype.convert = nNop; + NullExp.prototype.revert = nNop; + NullExp.prototype.mulTo = nMulTo; + NullExp.prototype.sqrTo = nSqrTo; // (public) this^e -function bnPow(e) { return this.exp(e,new NullExp()); } + function bnPow(e) { + return this.exp(e, new NullExp()); + } // (protected) r = lower n words of "this * a", a.t <= n // "this" should be the larger one if appropriate. -function bnpMultiplyLowerTo(a,n,r) { - var i = Math.min(this.t+a.t,n); - r.s = 0; // assumes a,this >= 0 - r.t = i; - while(i > 0) r[--i] = 0; - var j; - for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); - for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); - r.clamp(); -} + function bnpMultiplyLowerTo(a, n, r) { + var i = Math.min(this.t + a.t, n); + r.s = 0; // assumes a,this >= 0 + r.t = i; + while (i > 0) r[--i] = 0; + var j; + for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t); + for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i); + r.clamp(); + } // (protected) r = "this * a" without lower n words, n > 0 // "this" should be the larger one if appropriate. -function bnpMultiplyUpperTo(a,n,r) { - --n; - var i = r.t = this.t+a.t-n; - r.s = 0; // assumes a,this >= 0 - while(--i >= 0) r[i] = 0; - for(i = Math.max(n-this.t,0); i < a.t; ++i) - r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); - r.clamp(); - r.drShiftTo(1,r); -} + function bnpMultiplyUpperTo(a, n, r) { + --n; + var i = r.t = this.t + a.t - n; + r.s = 0; // assumes a,this >= 0 + while (--i >= 0) r[i] = 0; + for (i = Math.max(n - this.t, 0); i < a.t; ++i) + r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n); + r.clamp(); + r.drShiftTo(1, r); + } // Barrett modular reduction -function Barrett(m) { - // setup Barrett - this.r2 = nbi(); - this.q3 = nbi(); - BigInteger.ONE.dlShiftTo(2*m.t,this.r2); - this.mu = this.r2.divide(m); - this.m = m; -} + function Barrett(m) { + // setup Barrett + this.r2 = nbi(); + this.q3 = nbi(); + BigInteger.ONE.dlShiftTo(2 * m.t, this.r2); + this.mu = this.r2.divide(m); + this.m = m; + } -function barrettConvert(x) { - if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); - else if(x.compareTo(this.m) < 0) return x; - else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } -} + function barrettConvert(x) { + if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m); + else if (x.compareTo(this.m) < 0) return x; + else { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + } + } -function barrettRevert(x) { return x; } + function barrettRevert(x) { + return x; + } // x = x mod m (HAC 14.42) -function barrettReduce(x) { - x.drShiftTo(this.m.t-1,this.r2); - if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } - this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); - this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); - while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); - x.subTo(this.r2,x); - while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); -} + function barrettReduce(x) { + x.drShiftTo(this.m.t - 1, this.r2); + if (x.t > this.m.t + 1) { + x.t = this.m.t + 1; + x.clamp(); + } + this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); + this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); + while (x.compareTo(this.r2) < 0) x.dAddOffset(1, this.m.t + 1); + x.subTo(this.r2, x); + while (x.compareTo(this.m) >= 0) x.subTo(this.m, x); + } // r = x^2 mod m; x != r -function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + function barrettSqrTo(x, r) { + x.squareTo(r); + this.reduce(r); + } // r = x*y mod m; x,y != r -function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + function barrettMulTo(x, y, r) { + x.multiplyTo(y, r); + this.reduce(r); + } -Barrett.prototype.convert = barrettConvert; -Barrett.prototype.revert = barrettRevert; -Barrett.prototype.reduce = barrettReduce; -Barrett.prototype.mulTo = barrettMulTo; -Barrett.prototype.sqrTo = barrettSqrTo; + Barrett.prototype.convert = barrettConvert; + Barrett.prototype.revert = barrettRevert; + Barrett.prototype.reduce = barrettReduce; + Barrett.prototype.mulTo = barrettMulTo; + Barrett.prototype.sqrTo = barrettSqrTo; // (public) this^e % m (HAC 14.85) -function bnModPow(e,m) { - var i = e.bitLength(), k, r = nbv(1), z; - if(i <= 0) return r; - else if(i < 18) k = 1; - else if(i < 48) k = 3; - else if(i < 144) k = 4; - else if(i < 768) k = 5; - else k = 6; - if(i < 8) - z = new Classic(m); - else if(m.isEven()) - z = new Barrett(m); - else - z = new Montgomery(m); + function bnModPow(e, m) { + var i = e.bitLength(), k, r = nbv(1), z; + if (i <= 0) return r; + else if (i < 18) k = 1; + else if (i < 48) k = 3; + else if (i < 144) k = 4; + else if (i < 768) k = 5; + else k = 6; + if (i < 8) + z = new Classic(m); + else if (m.isEven()) + z = new Barrett(m); + else + z = new Montgomery(m); - // precomputation - var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { - var g2 = nbi(); - z.sqrTo(g[1],g2); - while(n <= km) { - g[n] = nbi(); - z.mulTo(g2,g[n-2],g[n]); - n += 2; - } - } + // precomputation + var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1; + g[1] = z.convert(this); + if (k > 1) { + var g2 = nbi(); + z.sqrTo(g[1], g2); + while (n <= km) { + g[n] = nbi(); + z.mulTo(g2, g[n - 2], g[n]); + n += 2; + } + } - var j = e.t-1, w, is1 = true, r2 = nbi(), t; - i = nbits(e[j])-1; - while(j >= 0) { - if(i >= k1) w = (e[j]>>(i-k1))&km; - else { - w = (e[j]&((1<<(i+1))-1))<<(k1-i); - if(j > 0) w |= e[j-1]>>(this.DB+i-k1); - } + var j = e.t - 1, w, is1 = true, r2 = nbi(), t; + i = nbits(e[j]) - 1; + while (j >= 0) { + if (i >= k1) w = (e[j] >> (i - k1)) & km; + else { + w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i); + if (j > 0) w |= e[j - 1] >> (this.DB + i - k1); + } - n = k; - while((w&1) == 0) { w >>= 1; --n; } - if((i -= n) < 0) { i += this.DB; --j; } - if(is1) { // ret == 1, don't bother squaring or multiplying it - g[w].copyTo(r); - is1 = false; - } - else { - while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } - if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } - z.mulTo(r2,g[w],r); - } + n = k; + while ((w & 1) == 0) { + w >>= 1; + --n; + } + if ((i -= n) < 0) { + i += this.DB; + --j; + } + if (is1) { // ret == 1, don't bother squaring or multiplying it + g[w].copyTo(r); + is1 = false; + } + else { + while (n > 1) { + z.sqrTo(r, r2); + z.sqrTo(r2, r); + n -= 2; + } + if (n > 0) z.sqrTo(r, r2); else { + t = r; + r = r2; + r2 = t; + } + z.mulTo(r2, g[w], r); + } - while(j >= 0 && (e[j]&(1<= 0 && (e[j] & (1 << i)) == 0) { + z.sqrTo(r, r2); + t = r; + r = r2; + r2 = t; + if (--i < 0) { + i = this.DB - 1; + --j; + } + } + } + return z.revert(r); } - } - return z.revert(r); -} // (public) gcd(this,a) (HAC 14.54) -function bnGCD(a) { - var x = (this.s<0)?this.negate():this.clone(); - var y = (a.s<0)?a.negate():a.clone(); - if(x.compareTo(y) < 0) { var t = x; x = y; y = t; } - var i = x.getLowestSetBit(), g = y.getLowestSetBit(); - if(g < 0) return x; - if(i < g) g = i; - if(g > 0) { - x.rShiftTo(g,x); - y.rShiftTo(g,y); - } - while(x.signum() > 0) { - if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); - if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); - if(x.compareTo(y) >= 0) { - x.subTo(y,x); - x.rShiftTo(1,x); + function bnGCD(a) { + var x = (this.s < 0) ? this.negate() : this.clone(); + var y = (a.s < 0) ? a.negate() : a.clone(); + if (x.compareTo(y) < 0) { + var t = x; + x = y; + y = t; + } + var i = x.getLowestSetBit(), g = y.getLowestSetBit(); + if (g < 0) return x; + if (i < g) g = i; + if (g > 0) { + x.rShiftTo(g, x); + y.rShiftTo(g, y); + } + while (x.signum() > 0) { + if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x); + if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y); + if (x.compareTo(y) >= 0) { + x.subTo(y, x); + x.rShiftTo(1, x); + } + else { + y.subTo(x, y); + y.rShiftTo(1, y); + } + } + if (g > 0) y.lShiftTo(g, y); + return y; } - else { - y.subTo(x,y); - y.rShiftTo(1,y); - } - } - if(g > 0) y.lShiftTo(g,y); - return y; -} // (protected) this % n, n < 2^26 -function bnpModInt(n) { - if(n <= 0) return 0; - var d = this.DV%n, r = (this.s<0)?n-1:0; - if(this.t > 0) - if(d == 0) r = this[0]%n; - else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; - return r; -} + function bnpModInt(n) { + if (n <= 0) return 0; + var d = this.DV % n, r = (this.s < 0) ? n - 1 : 0; + if (this.t > 0) + if (d == 0) r = this[0] % n; + else for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n; + return r; + } // (public) 1/this % m (HAC 14.61) -function bnModInverse(m) { - var ac = m.isEven(); - if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; - var u = m.clone(), v = this.clone(); - var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); - while(u.signum() != 0) { - while(u.isEven()) { - u.rShiftTo(1,u); - if(ac) { - if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } - a.rShiftTo(1,a); - } - else if(!b.isEven()) b.subTo(m,b); - b.rShiftTo(1,b); + function bnModInverse(m) { + var ac = m.isEven(); + if ((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; + var u = m.clone(), v = this.clone(); + var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); + while (u.signum() != 0) { + while (u.isEven()) { + u.rShiftTo(1, u); + if (ac) { + if (!a.isEven() || !b.isEven()) { + a.addTo(this, a); + b.subTo(m, b); + } + a.rShiftTo(1, a); + } + else if (!b.isEven()) b.subTo(m, b); + b.rShiftTo(1, b); + } + while (v.isEven()) { + v.rShiftTo(1, v); + if (ac) { + if (!c.isEven() || !d.isEven()) { + c.addTo(this, c); + d.subTo(m, d); + } + c.rShiftTo(1, c); + } + else if (!d.isEven()) d.subTo(m, d); + d.rShiftTo(1, d); + } + if (u.compareTo(v) >= 0) { + u.subTo(v, u); + if (ac) a.subTo(c, a); + b.subTo(d, b); + } + else { + v.subTo(u, v); + if (ac) c.subTo(a, c); + d.subTo(b, d); + } + } + if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; + if (d.compareTo(m) >= 0) return d.subtract(m); + if (d.signum() < 0) d.addTo(m, d); else return d; + if (d.signum() < 0) return d.add(m); else return d; } - while(v.isEven()) { - v.rShiftTo(1,v); - if(ac) { - if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } - c.rShiftTo(1,c); - } - else if(!d.isEven()) d.subTo(m,d); - d.rShiftTo(1,d); - } - if(u.compareTo(v) >= 0) { - u.subTo(v,u); - if(ac) a.subTo(c,a); - b.subTo(d,b); - } - else { - v.subTo(u,v); - if(ac) c.subTo(a,c); - d.subTo(b,d); - } - } - if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; - if(d.compareTo(m) >= 0) return d.subtract(m); - if(d.signum() < 0) d.addTo(m,d); else return d; - if(d.signum() < 0) return d.add(m); else return d; -} -var lowprimes = [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,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; -var lplim = (1<<26)/lowprimes[lowprimes.length-1]; + var lowprimes = [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, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]; + var lplim = (1 << 26) / lowprimes[lowprimes.length - 1]; // (public) test primality with certainty >= 1-.5^t -function bnIsProbablePrime(t) { - var i, x = this.abs(); - if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) { - for(i = 0; i < lowprimes.length; ++i) - if(x[0] == lowprimes[i]) return true; - return false; - } - if(x.isEven()) return false; - i = 1; - while(i < lowprimes.length) { - var m = lowprimes[i], j = i+1; - while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; - m = x.modInt(m); - while(i < j) if(m%lowprimes[i++] == 0) return false; - } - return x.millerRabin(t); -} + function bnIsProbablePrime(t) { + var i, x = this.abs(); + if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) { + for (i = 0; i < lowprimes.length; ++i) + if (x[0] == lowprimes[i]) return true; + return false; + } + if (x.isEven()) return false; + i = 1; + while (i < lowprimes.length) { + var m = lowprimes[i], j = i + 1; + while (j < lowprimes.length && m < lplim) m *= lowprimes[j++]; + m = x.modInt(m); + while (i < j) if (m % lowprimes[i++] == 0) return false; + } + return x.millerRabin(t); + } // (protected) true if probably prime (HAC 4.24, Miller-Rabin) -function bnpMillerRabin(t) { - var n1 = this.subtract(BigInteger.ONE); - var k = n1.getLowestSetBit(); - if(k <= 0) return false; - var r = n1.shiftRight(k); - t = (t+1)>>1; - if(t > lowprimes.length) t = lowprimes.length; - var a = nbi(); - for(var i = 0; i < t; ++i) { - //Pick bases at random, instead of starting at 2 - a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); - var y = a.modPow(r,this); - if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { - var j = 1; - while(j++ < k && y.compareTo(n1) != 0) { - y = y.modPowInt(2,this); - if(y.compareTo(BigInteger.ONE) == 0) return false; - } - if(y.compareTo(n1) != 0) return false; + function bnpMillerRabin(t) { + var n1 = this.subtract(BigInteger.ONE); + var k = n1.getLowestSetBit(); + if (k <= 0) return false; + var r = n1.shiftRight(k); + t = (t + 1) >> 1; + if (t > lowprimes.length) t = lowprimes.length; + var a = nbi(); + for (var i = 0; i < t; ++i) { + //Pick bases at random, instead of starting at 2 + a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]); + var y = a.modPow(r, this); + if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { + var j = 1; + while (j++ < k && y.compareTo(n1) != 0) { + y = y.modPowInt(2, this); + if (y.compareTo(BigInteger.ONE) == 0) return false; + } + if (y.compareTo(n1) != 0) return false; + } + } + return true; } - } - return true; -} // protected -BigInteger.prototype.chunkSize = bnpChunkSize; -BigInteger.prototype.toRadix = bnpToRadix; -BigInteger.prototype.fromRadix = bnpFromRadix; -BigInteger.prototype.fromNumber = bnpFromNumber; -BigInteger.prototype.bitwiseTo = bnpBitwiseTo; -BigInteger.prototype.changeBit = bnpChangeBit; -BigInteger.prototype.addTo = bnpAddTo; -BigInteger.prototype.dMultiply = bnpDMultiply; -BigInteger.prototype.dAddOffset = bnpDAddOffset; -BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; -BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; -BigInteger.prototype.modInt = bnpModInt; -BigInteger.prototype.millerRabin = bnpMillerRabin; + BigInteger.prototype.chunkSize = bnpChunkSize; + BigInteger.prototype.toRadix = bnpToRadix; + BigInteger.prototype.fromRadix = bnpFromRadix; + BigInteger.prototype.fromNumber = bnpFromNumber; + BigInteger.prototype.bitwiseTo = bnpBitwiseTo; + BigInteger.prototype.changeBit = bnpChangeBit; + BigInteger.prototype.addTo = bnpAddTo; + BigInteger.prototype.dMultiply = bnpDMultiply; + BigInteger.prototype.dAddOffset = bnpDAddOffset; + BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; + BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; + BigInteger.prototype.modInt = bnpModInt; + BigInteger.prototype.millerRabin = bnpMillerRabin; // public -BigInteger.prototype.clone = bnClone; -BigInteger.prototype.intValue = bnIntValue; -BigInteger.prototype.byteValue = bnByteValue; -BigInteger.prototype.shortValue = bnShortValue; -BigInteger.prototype.signum = bnSigNum; -BigInteger.prototype.toByteArray = bnToByteArray; -BigInteger.prototype.equals = bnEquals; -BigInteger.prototype.min = bnMin; -BigInteger.prototype.max = bnMax; -BigInteger.prototype.and = bnAnd; -BigInteger.prototype.or = bnOr; -BigInteger.prototype.xor = bnXor; -BigInteger.prototype.andNot = bnAndNot; -BigInteger.prototype.not = bnNot; -BigInteger.prototype.shiftLeft = bnShiftLeft; -BigInteger.prototype.shiftRight = bnShiftRight; -BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; -BigInteger.prototype.bitCount = bnBitCount; -BigInteger.prototype.testBit = bnTestBit; -BigInteger.prototype.setBit = bnSetBit; -BigInteger.prototype.clearBit = bnClearBit; -BigInteger.prototype.flipBit = bnFlipBit; -BigInteger.prototype.add = bnAdd; -BigInteger.prototype.subtract = bnSubtract; -BigInteger.prototype.multiply = bnMultiply; -BigInteger.prototype.divide = bnDivide; -BigInteger.prototype.remainder = bnRemainder; -BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; -BigInteger.prototype.modPow = bnModPow; -BigInteger.prototype.modInverse = bnModInverse; -BigInteger.prototype.pow = bnPow; -BigInteger.prototype.gcd = bnGCD; -BigInteger.prototype.isProbablePrime = bnIsProbablePrime; + BigInteger.prototype.clone = bnClone; + BigInteger.prototype.intValue = bnIntValue; + BigInteger.prototype.byteValue = bnByteValue; + BigInteger.prototype.shortValue = bnShortValue; + BigInteger.prototype.signum = bnSigNum; + BigInteger.prototype.toByteArray = bnToByteArray; + BigInteger.prototype.equals = bnEquals; + BigInteger.prototype.min = bnMin; + BigInteger.prototype.max = bnMax; + BigInteger.prototype.and = bnAnd; + BigInteger.prototype.or = bnOr; + BigInteger.prototype.xor = bnXor; + BigInteger.prototype.andNot = bnAndNot; + BigInteger.prototype.not = bnNot; + BigInteger.prototype.shiftLeft = bnShiftLeft; + BigInteger.prototype.shiftRight = bnShiftRight; + BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; + BigInteger.prototype.bitCount = bnBitCount; + BigInteger.prototype.testBit = bnTestBit; + BigInteger.prototype.setBit = bnSetBit; + BigInteger.prototype.clearBit = bnClearBit; + BigInteger.prototype.flipBit = bnFlipBit; + BigInteger.prototype.add = bnAdd; + BigInteger.prototype.subtract = bnSubtract; + BigInteger.prototype.multiply = bnMultiply; + BigInteger.prototype.divide = bnDivide; + BigInteger.prototype.remainder = bnRemainder; + BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; + BigInteger.prototype.modPow = bnModPow; + BigInteger.prototype.modInverse = bnModInverse; + BigInteger.prototype.pow = bnPow; + BigInteger.prototype.gcd = bnGCD; + BigInteger.prototype.isProbablePrime = bnIsProbablePrime; // JSBN-specific extension -BigInteger.prototype.square = bnSquare; + BigInteger.prototype.square = bnSquare; // BigInteger interfaces not implemented in jsbn: @@ -1221,218 +1456,219 @@ BigInteger.prototype.square = bnSquare; // prng4.js - uses Arcfour as a PRNG -function Arcfour() { - this.i = 0; - this.j = 0; - this.S = new Array(); -} + function Arcfour() { + this.i = 0; + this.j = 0; + this.S = new Array(); + } // Initialize arcfour context from key, an array of ints, each from [0..255] -function ARC4init(key) { - var i, j, t; - for(i = 0; i < 256; ++i) - this.S[i] = i; - j = 0; - for(i = 0; i < 256; ++i) { - j = (j + this.S[i] + key[i % key.length]) & 255; - t = this.S[i]; - this.S[i] = this.S[j]; - this.S[j] = t; - } - this.i = 0; - this.j = 0; -} + function ARC4init(key) { + var i, j, t; + for (i = 0; i < 256; ++i) + this.S[i] = i; + j = 0; + for (i = 0; i < 256; ++i) { + j = (j + this.S[i] + key[i % key.length]) & 255; + t = this.S[i]; + this.S[i] = this.S[j]; + this.S[j] = t; + } + this.i = 0; + this.j = 0; + } -function ARC4next() { - var t; - this.i = (this.i + 1) & 255; - this.j = (this.j + this.S[this.i]) & 255; - t = this.S[this.i]; - this.S[this.i] = this.S[this.j]; - this.S[this.j] = t; - return this.S[(t + this.S[this.i]) & 255]; -} + function ARC4next() { + var t; + this.i = (this.i + 1) & 255; + this.j = (this.j + this.S[this.i]) & 255; + t = this.S[this.i]; + this.S[this.i] = this.S[this.j]; + this.S[this.j] = t; + return this.S[(t + this.S[this.i]) & 255]; + } -Arcfour.prototype.init = ARC4init; -Arcfour.prototype.next = ARC4next; + Arcfour.prototype.init = ARC4init; + Arcfour.prototype.next = ARC4next; // Plug in your RNG constructor here -function prng_newstate() { - return new Arcfour(); -} + function prng_newstate() { + return new Arcfour(); + } // Pool size must be a multiple of 4 and greater than 32. // An array of bytes the size of the pool will be passed to init() -var rng_psize = 256; + var rng_psize = 256; // Random number generator - requires a PRNG backend, e.g. prng4.js -var rng_state; -var rng_pool; -var rng_pptr; + var rng_state; + var rng_pool; + var rng_pptr; // Initialize the pool with junk if needed. -if(rng_pool == null) { - rng_pool = new Array(); - rng_pptr = 0; - var t; - if(window.crypto && window.crypto.getRandomValues) { - // Extract entropy (2048 bits) from RNG if available - var z = new Uint32Array(256); - window.crypto.getRandomValues(z); - for (t = 0; t < z.length; ++t) - rng_pool[rng_pptr++] = z[t] & 255; - } + if (rng_pool == null) { + rng_pool = new Array(); + rng_pptr = 0; + var t; + if (window.crypto && window.crypto.getRandomValues) { + // Extract entropy (2048 bits) from RNG if available + var z = new Uint32Array(256); + window.crypto.getRandomValues(z); + for (t = 0; t < z.length; ++t) + rng_pool[rng_pptr++] = z[t] & 255; + } + + // Use mouse events for entropy, if we do not have enough entropy by the time + // we need it, entropy will be generated by Math.random. + var onMouseMoveListener = function (ev) { + this.count = this.count || 0; + if (this.count >= 256 || rng_pptr >= rng_psize) { + if (window.removeEventListener) + window.removeEventListener("mousemove", onMouseMoveListener, false); + else if (window.detachEvent) + window.detachEvent("onmousemove", onMouseMoveListener); + return; + } + try { + var mouseCoordinates = ev.x + ev.y; + rng_pool[rng_pptr++] = mouseCoordinates & 255; + this.count += 1; + } catch (e) { + // Sometimes Firefox will deny permission to access event properties for some reason. Ignore. + } + }; + if (window.addEventListener) + window.addEventListener("mousemove", onMouseMoveListener, false); + else if (window.attachEvent) + window.attachEvent("onmousemove", onMouseMoveListener); - // Use mouse events for entropy, if we do not have enough entropy by the time - // we need it, entropy will be generated by Math.random. - var onMouseMoveListener = function(ev) { - this.count = this.count || 0; - if (this.count >= 256 || rng_pptr >= rng_psize) { - if (window.removeEventListener) - window.removeEventListener("mousemove", onMouseMoveListener, false); - else if (window.detachEvent) - window.detachEvent("onmousemove", onMouseMoveListener); - return; } - try { - var mouseCoordinates = ev.x + ev.y; - rng_pool[rng_pptr++] = mouseCoordinates & 255; - this.count += 1; - } catch (e) { - // Sometimes Firefox will deny permission to access event properties for some reason. Ignore. + + function rng_get_byte() { + if (rng_state == null) { + rng_state = prng_newstate(); + // At this point, we may not have collected enough entropy. If not, fall back to Math.random + while (rng_pptr < rng_psize) { + var random = Math.floor(65536 * Math.random()); + rng_pool[rng_pptr++] = random & 255; + } + rng_state.init(rng_pool); + for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) + rng_pool[rng_pptr] = 0; + rng_pptr = 0; + } + // TODO: allow reseeding after first request + return rng_state.next(); } - }; - if (window.addEventListener) - window.addEventListener("mousemove", onMouseMoveListener, false); - else if (window.attachEvent) - window.attachEvent("onmousemove", onMouseMoveListener); -} - -function rng_get_byte() { - if(rng_state == null) { - rng_state = prng_newstate(); - // At this point, we may not have collected enough entropy. If not, fall back to Math.random - while (rng_pptr < rng_psize) { - var random = Math.floor(65536 * Math.random()); - rng_pool[rng_pptr++] = random & 255; + function rng_get_bytes(ba) { + var i; + for (i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); } - rng_state.init(rng_pool); - for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) - rng_pool[rng_pptr] = 0; - rng_pptr = 0; - } - // TODO: allow reseeding after first request - return rng_state.next(); -} -function rng_get_bytes(ba) { - var i; - for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); -} + function SecureRandom() { + } -function SecureRandom() {} - -SecureRandom.prototype.nextBytes = rng_get_bytes; + SecureRandom.prototype.nextBytes = rng_get_bytes; // Depends on jsbn.js and rng.js // Version 1.1: support utf-8 encoding in pkcs1pad2 // convert a (hex) string to a bignum object -function parseBigInt(str,r) { - return new BigInteger(str,r); -} + function parseBigInt(str, r) { + return new BigInteger(str, r); + } -function linebrk(s,n) { - var ret = ""; - var i = 0; - while(i + n < s.length) { - ret += s.substring(i,i+n) + "\n"; - i += n; - } - return ret + s.substring(i,s.length); -} + function linebrk(s, n) { + var ret = ""; + var i = 0; + while (i + n < s.length) { + ret += s.substring(i, i + n) + "\n"; + i += n; + } + return ret + s.substring(i, s.length); + } -function byte2Hex(b) { - if(b < 0x10) - return "0" + b.toString(16); - else - return b.toString(16); -} + function byte2Hex(b) { + if (b < 0x10) + return "0" + b.toString(16); + else + return b.toString(16); + } // PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint -function pkcs1pad2(s,n) { - if(n < s.length + 11) { // TODO: fix for utf-8 - console.error("Message too long for RSA"); - return null; - } - var ba = new Array(); - var i = s.length - 1; - while(i >= 0 && n > 0) { - var c = s.charCodeAt(i--); - if(c < 128) { // encode using utf-8 - ba[--n] = c; + function pkcs1pad2(s, n) { + if (n < s.length + 11) { // TODO: fix for utf-8 + console.error("Message too long for RSA"); + return null; + } + var ba = new Array(); + var i = s.length - 1; + while (i >= 0 && n > 0) { + var c = s.charCodeAt(i--); + if (c < 128) { // encode using utf-8 + ba[--n] = c; + } + else if ((c > 127) && (c < 2048)) { + ba[--n] = (c & 63) | 128; + ba[--n] = (c >> 6) | 192; + } + else { + ba[--n] = (c & 63) | 128; + ba[--n] = ((c >> 6) & 63) | 128; + ba[--n] = (c >> 12) | 224; + } + } + ba[--n] = 0; + var rng = new SecureRandom(); + var x = new Array(); + while (n > 2) { // random non-zero pad + x[0] = 0; + while (x[0] == 0) rng.nextBytes(x); + ba[--n] = x[0]; + } + ba[--n] = 2; + ba[--n] = 0; + return new BigInteger(ba); } - else if((c > 127) && (c < 2048)) { - ba[--n] = (c & 63) | 128; - ba[--n] = (c >> 6) | 192; - } - else { - ba[--n] = (c & 63) | 128; - ba[--n] = ((c >> 6) & 63) | 128; - ba[--n] = (c >> 12) | 224; - } - } - ba[--n] = 0; - var rng = new SecureRandom(); - var x = new Array(); - while(n > 2) { // random non-zero pad - x[0] = 0; - while(x[0] == 0) rng.nextBytes(x); - ba[--n] = x[0]; - } - ba[--n] = 2; - ba[--n] = 0; - return new BigInteger(ba); -} // "empty" RSA key constructor -function RSAKey() { - this.n = null; - this.e = 0; - this.d = null; - this.p = null; - this.q = null; - this.dmp1 = null; - this.dmq1 = null; - this.coeff = null; -} + function RSAKey() { + this.n = null; + this.e = 0; + this.d = null; + this.p = null; + this.q = null; + this.dmp1 = null; + this.dmq1 = null; + this.coeff = null; + } // Set the public key fields N and e from hex strings -function RSASetPublic(N,E) { - if(N != null && E != null && N.length > 0 && E.length > 0) { - this.n = parseBigInt(N,16); - this.e = parseInt(E,16); - } - else - console.error("Invalid RSA public key"); -} + function RSASetPublic(N, E) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + } + else + console.error("Invalid RSA public key"); + } // Perform raw public operation on "x": return x^e (mod n) -function RSADoPublic(x) { - return x.modPowInt(this.e, this.n); -} + function RSADoPublic(x) { + return x.modPowInt(this.e, this.n); + } // Return the PKCS#1 RSA encryption of "text" as an even-length hex string -function RSAEncrypt(text) { - var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3); - if(m == null) return null; - var c = this.doPublic(m); - if(c == null) return null; - var h = c.toString(16); - if((h.length & 1) == 0) return h; else return "0" + h; -} + function RSAEncrypt(text) { + var m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3); + if (m == null) return null; + var c = this.doPublic(m); + if (c == null) return null; + var h = c.toString(16); + if ((h.length & 1) == 0) return h; else return "0" + h; + } // Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string //function RSAEncryptB64(text) { @@ -1441,11 +1677,11 @@ function RSAEncrypt(text) { //} // protected -RSAKey.prototype.doPublic = RSADoPublic; + RSAKey.prototype.doPublic = RSADoPublic; // public -RSAKey.prototype.setPublic = RSASetPublic; -RSAKey.prototype.encrypt = RSAEncrypt; + RSAKey.prototype.setPublic = RSASetPublic; + RSAKey.prototype.encrypt = RSAEncrypt; //RSAKey.prototype.encrypt_b64 = RSAEncryptB64; // Depends on rsa.js and jsbn2.js @@ -1453,116 +1689,116 @@ RSAKey.prototype.encrypt = RSAEncrypt; // Version 1.1: support utf-8 decoding in pkcs1unpad2 // Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext -function pkcs1unpad2(d,n) { - var b = d.toByteArray(); - var i = 0; - while(i < b.length && b[i] == 0) ++i; - if(b.length-i != n-1 || b[i] != 2) - return null; - ++i; - while(b[i] != 0) - if(++i >= b.length) return null; - var ret = ""; - while(++i < b.length) { - var c = b[i] & 255; - if(c < 128) { // utf-8 decode - ret += String.fromCharCode(c); + function pkcs1unpad2(d, n) { + var b = d.toByteArray(); + var i = 0; + while (i < b.length && b[i] == 0) ++i; + if (b.length - i != n - 1 || b[i] != 2) + return null; + ++i; + while (b[i] != 0) + if (++i >= b.length) return null; + var ret = ""; + while (++i < b.length) { + var c = b[i] & 255; + if (c < 128) { // utf-8 decode + ret += String.fromCharCode(c); + } + else if ((c > 191) && (c < 224)) { + ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63)); + ++i; + } + else { + ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63)); + i += 2; + } + } + return ret; } - else if((c > 191) && (c < 224)) { - ret += String.fromCharCode(((c & 31) << 6) | (b[i+1] & 63)); - ++i; - } - else { - ret += String.fromCharCode(((c & 15) << 12) | ((b[i+1] & 63) << 6) | (b[i+2] & 63)); - i += 2; - } - } - return ret; -} // Set the private key fields N, e, and d from hex strings -function RSASetPrivate(N,E,D) { - if(N != null && E != null && N.length > 0 && E.length > 0) { - this.n = parseBigInt(N,16); - this.e = parseInt(E,16); - this.d = parseBigInt(D,16); - } - else - console.error("Invalid RSA private key"); -} + function RSASetPrivate(N, E, D) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + this.d = parseBigInt(D, 16); + } + else + console.error("Invalid RSA private key"); + } // Set the private key fields N, e, d and CRT params from hex strings -function RSASetPrivateEx(N,E,D,P,Q,DP,DQ,C) { - if(N != null && E != null && N.length > 0 && E.length > 0) { - this.n = parseBigInt(N,16); - this.e = parseInt(E,16); - this.d = parseBigInt(D,16); - this.p = parseBigInt(P,16); - this.q = parseBigInt(Q,16); - this.dmp1 = parseBigInt(DP,16); - this.dmq1 = parseBigInt(DQ,16); - this.coeff = parseBigInt(C,16); - } - else - console.error("Invalid RSA private key"); -} + function RSASetPrivateEx(N, E, D, P, Q, DP, DQ, C) { + if (N != null && E != null && N.length > 0 && E.length > 0) { + this.n = parseBigInt(N, 16); + this.e = parseInt(E, 16); + this.d = parseBigInt(D, 16); + this.p = parseBigInt(P, 16); + this.q = parseBigInt(Q, 16); + this.dmp1 = parseBigInt(DP, 16); + this.dmq1 = parseBigInt(DQ, 16); + this.coeff = parseBigInt(C, 16); + } + else + console.error("Invalid RSA private key"); + } // Generate a new random private key B bits long, using public expt E -function RSAGenerate(B,E) { - var rng = new SecureRandom(); - var qs = B>>1; - this.e = parseInt(E,16); - var ee = new BigInteger(E,16); - for(;;) { - for(;;) { - this.p = new BigInteger(B-qs,1,rng); - if(this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) break; + function RSAGenerate(B, E) { + var rng = new SecureRandom(); + var qs = B >> 1; + this.e = parseInt(E, 16); + var ee = new BigInteger(E, 16); + for (; ;) { + for (; ;) { + this.p = new BigInteger(B - qs, 1, rng); + if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) break; + } + for (; ;) { + this.q = new BigInteger(qs, 1, rng); + if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) break; + } + if (this.p.compareTo(this.q) <= 0) { + var t = this.p; + this.p = this.q; + this.q = t; + } + var p1 = this.p.subtract(BigInteger.ONE); + var q1 = this.q.subtract(BigInteger.ONE); + var phi = p1.multiply(q1); + if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { + this.n = this.p.multiply(this.q); + this.d = ee.modInverse(phi); + this.dmp1 = this.d.mod(p1); + this.dmq1 = this.d.mod(q1); + this.coeff = this.q.modInverse(this.p); + break; + } + } } - for(;;) { - this.q = new BigInteger(qs,1,rng); - if(this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) break; - } - if(this.p.compareTo(this.q) <= 0) { - var t = this.p; - this.p = this.q; - this.q = t; - } - var p1 = this.p.subtract(BigInteger.ONE); - var q1 = this.q.subtract(BigInteger.ONE); - var phi = p1.multiply(q1); - if(phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { - this.n = this.p.multiply(this.q); - this.d = ee.modInverse(phi); - this.dmp1 = this.d.mod(p1); - this.dmq1 = this.d.mod(q1); - this.coeff = this.q.modInverse(this.p); - break; - } - } -} // Perform raw private operation on "x": return x^d (mod n) -function RSADoPrivate(x) { - if(this.p == null || this.q == null) - return x.modPow(this.d, this.n); + function RSADoPrivate(x) { + if (this.p == null || this.q == null) + return x.modPow(this.d, this.n); - // TODO: re-calculate any missing CRT params - var xp = x.mod(this.p).modPow(this.dmp1, this.p); - var xq = x.mod(this.q).modPow(this.dmq1, this.q); + // TODO: re-calculate any missing CRT params + var xp = x.mod(this.p).modPow(this.dmp1, this.p); + var xq = x.mod(this.q).modPow(this.dmq1, this.q); - while(xp.compareTo(xq) < 0) - xp = xp.add(this.p); - return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq); -} + while (xp.compareTo(xq) < 0) + xp = xp.add(this.p); + return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq); + } // Return the PKCS#1 RSA decryption of "ctext". // "ctext" is an even-length hex string and the output is a plain string. -function RSADecrypt(ctext) { - var c = parseBigInt(ctext, 16); - var m = this.doPrivate(c); - if(m == null) return null; - return pkcs1unpad2(m, (this.n.bitLength()+7)>>3); -} + function RSADecrypt(ctext) { + var c = parseBigInt(ctext, 16); + var m = this.doPrivate(c); + if (m == null) return null; + return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3); + } // Return the PKCS#1 RSA decryption of "ctext". // "ctext" is a Base64-encoded string and the output is a plain string. @@ -1572,13 +1808,13 @@ function RSADecrypt(ctext) { //} // protected -RSAKey.prototype.doPrivate = RSADoPrivate; + RSAKey.prototype.doPrivate = RSADoPrivate; // public -RSAKey.prototype.setPrivate = RSASetPrivate; -RSAKey.prototype.setPrivateEx = RSASetPrivateEx; -RSAKey.prototype.generate = RSAGenerate; -RSAKey.prototype.decrypt = RSADecrypt; + RSAKey.prototype.setPrivate = RSASetPrivate; + RSAKey.prototype.setPrivateEx = RSASetPrivateEx; + RSAKey.prototype.generate = RSAGenerate; + RSAKey.prototype.decrypt = RSADecrypt; //RSAKey.prototype.b64_decrypt = RSAB64Decrypt; // Copyright (c) 2011 Kevin M Burns Jr. @@ -1592,546 +1828,558 @@ RSAKey.prototype.decrypt = RSADecrypt; // // --- -(function(){ + (function () { // Generate a new random private key B bits long, using public expt E -var RSAGenerateAsync = function (B, E, callback) { - //var rng = new SeededRandom(); - var rng = new SecureRandom(); - var qs = B >> 1; - this.e = parseInt(E, 16); - var ee = new BigInteger(E, 16); - var rsa = this; - // These functions have non-descript names because they were originally for(;;) loops. - // I don't know about cryptography to give them better names than loop1-4. - var loop1 = function() { - var loop4 = function() { - if (rsa.p.compareTo(rsa.q) <= 0) { - var t = rsa.p; - rsa.p = rsa.q; - rsa.q = t; - } - var p1 = rsa.p.subtract(BigInteger.ONE); - var q1 = rsa.q.subtract(BigInteger.ONE); - var phi = p1.multiply(q1); - if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { - rsa.n = rsa.p.multiply(rsa.q); - rsa.d = ee.modInverse(phi); - rsa.dmp1 = rsa.d.mod(p1); - rsa.dmq1 = rsa.d.mod(q1); - rsa.coeff = rsa.q.modInverse(rsa.p); - setTimeout(function(){callback()},0); // escape - } else { - setTimeout(loop1,0); - } - }; - var loop3 = function() { - rsa.q = nbi(); - rsa.q.fromNumberAsync(qs, 1, rng, function(){ - rsa.q.subtract(BigInteger.ONE).gcda(ee, function(r){ - if (r.compareTo(BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) { - setTimeout(loop4,0); - } else { - setTimeout(loop3,0); + var RSAGenerateAsync = function (B, E, callback) { + //var rng = new SeededRandom(); + var rng = new SecureRandom(); + var qs = B >> 1; + this.e = parseInt(E, 16); + var ee = new BigInteger(E, 16); + var rsa = this; + // These functions have non-descript names because they were originally for(;;) loops. + // I don't know about cryptography to give them better names than loop1-4. + var loop1 = function () { + var loop4 = function () { + if (rsa.p.compareTo(rsa.q) <= 0) { + var t = rsa.p; + rsa.p = rsa.q; + rsa.q = t; } - }); - }); - }; - var loop2 = function() { - rsa.p = nbi(); - rsa.p.fromNumberAsync(B - qs, 1, rng, function(){ - rsa.p.subtract(BigInteger.ONE).gcda(ee, function(r){ - if (r.compareTo(BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) { - setTimeout(loop3,0); + var p1 = rsa.p.subtract(BigInteger.ONE); + var q1 = rsa.q.subtract(BigInteger.ONE); + var phi = p1.multiply(q1); + if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { + rsa.n = rsa.p.multiply(rsa.q); + rsa.d = ee.modInverse(phi); + rsa.dmp1 = rsa.d.mod(p1); + rsa.dmq1 = rsa.d.mod(q1); + rsa.coeff = rsa.q.modInverse(rsa.p); + setTimeout(function () { + callback() + }, 0); // escape } else { - setTimeout(loop2,0); + setTimeout(loop1, 0); } - }); - }); + }; + var loop3 = function () { + rsa.q = nbi(); + rsa.q.fromNumberAsync(qs, 1, rng, function () { + rsa.q.subtract(BigInteger.ONE).gcda(ee, function (r) { + if (r.compareTo(BigInteger.ONE) == 0 && rsa.q.isProbablePrime(10)) { + setTimeout(loop4, 0); + } else { + setTimeout(loop3, 0); + } + }); + }); + }; + var loop2 = function () { + rsa.p = nbi(); + rsa.p.fromNumberAsync(B - qs, 1, rng, function () { + rsa.p.subtract(BigInteger.ONE).gcda(ee, function (r) { + if (r.compareTo(BigInteger.ONE) == 0 && rsa.p.isProbablePrime(10)) { + setTimeout(loop3, 0); + } else { + setTimeout(loop2, 0); + } + }); + }); + }; + setTimeout(loop2, 0); + }; + setTimeout(loop1, 0); }; - setTimeout(loop2,0); - }; - setTimeout(loop1,0); -}; -RSAKey.prototype.generateAsync = RSAGenerateAsync; + RSAKey.prototype.generateAsync = RSAGenerateAsync; // Public API method -var bnGCDAsync = function (a, callback) { - var x = (this.s < 0) ? this.negate() : this.clone(); - var y = (a.s < 0) ? a.negate() : a.clone(); - if (x.compareTo(y) < 0) { - var t = x; - x = y; - y = t; - } - var i = x.getLowestSetBit(), - g = y.getLowestSetBit(); - if (g < 0) { - callback(x); - return; - } - if (i < g) g = i; - if (g > 0) { - x.rShiftTo(g, x); - y.rShiftTo(g, y); - } - // Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen. - var gcda1 = function() { - if ((i = x.getLowestSetBit()) > 0){ x.rShiftTo(i, x); } - if ((i = y.getLowestSetBit()) > 0){ y.rShiftTo(i, y); } - if (x.compareTo(y) >= 0) { - x.subTo(y, x); - x.rShiftTo(1, x); - } else { - y.subTo(x, y); - y.rShiftTo(1, y); - } - if(!(x.signum() > 0)) { - if (g > 0) y.lShiftTo(g, y); - setTimeout(function(){callback(y)},0); // escape - } else { - setTimeout(gcda1,0); - } - }; - setTimeout(gcda1,10); -}; -BigInteger.prototype.gcda = bnGCDAsync; + var bnGCDAsync = function (a, callback) { + var x = (this.s < 0) ? this.negate() : this.clone(); + var y = (a.s < 0) ? a.negate() : a.clone(); + if (x.compareTo(y) < 0) { + var t = x; + x = y; + y = t; + } + var i = x.getLowestSetBit(), + g = y.getLowestSetBit(); + if (g < 0) { + callback(x); + return; + } + if (i < g) g = i; + if (g > 0) { + x.rShiftTo(g, x); + y.rShiftTo(g, y); + } + // Workhorse of the algorithm, gets called 200 - 800 times per 512 bit keygen. + var gcda1 = function () { + if ((i = x.getLowestSetBit()) > 0) { + x.rShiftTo(i, x); + } + if ((i = y.getLowestSetBit()) > 0) { + y.rShiftTo(i, y); + } + if (x.compareTo(y) >= 0) { + x.subTo(y, x); + x.rShiftTo(1, x); + } else { + y.subTo(x, y); + y.rShiftTo(1, y); + } + if (!(x.signum() > 0)) { + if (g > 0) y.lShiftTo(g, y); + setTimeout(function () { + callback(y) + }, 0); // escape + } else { + setTimeout(gcda1, 0); + } + }; + setTimeout(gcda1, 10); + }; + BigInteger.prototype.gcda = bnGCDAsync; // (protected) alternate constructor -var bnpFromNumberAsync = function (a,b,c,callback) { - if("number" == typeof b) { - if(a < 2) { - this.fromInt(1); - } else { - this.fromNumber(a,c); - if(!this.testBit(a-1)){ - this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); - } - if(this.isEven()) { - this.dAddOffset(1,0); - } - var bnp = this; - var bnpfn1 = function(){ - bnp.dAddOffset(2,0); - if(bnp.bitLength() > a) bnp.subTo(BigInteger.ONE.shiftLeft(a-1),bnp); - if(bnp.isProbablePrime(b)) { - setTimeout(function(){callback()},0); // escape - } else { - setTimeout(bnpfn1,0); + var bnpFromNumberAsync = function (a, b, c, callback) { + if ("number" == typeof b) { + if (a < 2) { + this.fromInt(1); + } else { + this.fromNumber(a, c); + if (!this.testBit(a - 1)) { + this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this); + } + if (this.isEven()) { + this.dAddOffset(1, 0); + } + var bnp = this; + var bnpfn1 = function () { + bnp.dAddOffset(2, 0); + if (bnp.bitLength() > a) bnp.subTo(BigInteger.ONE.shiftLeft(a - 1), bnp); + if (bnp.isProbablePrime(b)) { + setTimeout(function () { + callback() + }, 0); // escape + } else { + setTimeout(bnpfn1, 0); + } + }; + setTimeout(bnpfn1, 0); + } + } else { + var x = new Array(), t = a & 7; + x.length = (a >> 3) + 1; + b.nextBytes(x); + if (t > 0) x[0] &= ((1 << t) - 1); else x[0] = 0; + this.fromString(x, 256); + } + }; + BigInteger.prototype.fromNumberAsync = bnpFromNumberAsync; + + })(); + var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + var b64pad = "="; + + function hex2b64(h) { + var i; + var c; + var ret = ""; + for (i = 0; i + 3 <= h.length; i += 3) { + c = parseInt(h.substring(i, i + 3), 16); + ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63); } - }; - setTimeout(bnpfn1,0); + if (i + 1 == h.length) { + c = parseInt(h.substring(i, i + 1), 16); + ret += b64map.charAt(c << 2); + } + else if (i + 2 == h.length) { + c = parseInt(h.substring(i, i + 2), 16); + ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4); + } + while ((ret.length & 3) > 0) ret += b64pad; + return ret; } - } else { - var x = new Array(), t = a&7; - x.length = (a>>3)+1; - b.nextBytes(x); - if(t > 0) x[0] &= ((1<> 6) + b64map.charAt(c & 63); - } - if(i+1 == h.length) { - c = parseInt(h.substring(i,i+1),16); - ret += b64map.charAt(c << 2); - } - else if(i+2 == h.length) { - c = parseInt(h.substring(i,i+2),16); - ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4); - } - while((ret.length & 3) > 0) ret += b64pad; - return ret; -} // convert a base64 string to hex -function b64tohex(s) { - var ret = "" - var i; - var k = 0; // b64 state, 0-3 - var slop; - for(i = 0; i < s.length; ++i) { - if(s.charAt(i) == b64pad) break; - v = b64map.indexOf(s.charAt(i)); - if(v < 0) continue; - if(k == 0) { - ret += int2char(v >> 2); - slop = v & 3; - k = 1; + function b64tohex(s) { + var ret = "" + var i; + var k = 0; // b64 state, 0-3 + var slop; + for (i = 0; i < s.length; ++i) { + if (s.charAt(i) == b64pad) break; + v = b64map.indexOf(s.charAt(i)); + if (v < 0) continue; + if (k == 0) { + ret += int2char(v >> 2); + slop = v & 3; + k = 1; + } + else if (k == 1) { + ret += int2char((slop << 2) | (v >> 4)); + slop = v & 0xf; + k = 2; + } + else if (k == 2) { + ret += int2char(slop); + ret += int2char(v >> 2); + slop = v & 3; + k = 3; + } + else { + ret += int2char((slop << 2) | (v >> 4)); + ret += int2char(v & 0xf); + k = 0; + } + } + if (k == 1) + ret += int2char(slop << 2); + return ret; } - else if(k == 1) { - ret += int2char((slop << 2) | (v >> 4)); - slop = v & 0xf; - k = 2; - } - else if(k == 2) { - ret += int2char(slop); - ret += int2char(v >> 2); - slop = v & 3; - k = 3; - } - else { - ret += int2char((slop << 2) | (v >> 4)); - ret += int2char(v & 0xf); - k = 0; - } - } - if(k == 1) - ret += int2char(slop << 2); - return ret; -} // convert a base64 string to a byte/number array -function b64toBA(s) { - //piggyback on b64tohex for now, optimize later - var h = b64tohex(s); - var i; - var a = new Array(); - for(i = 0; 2*i < h.length; ++i) { - a[i] = parseInt(h.substring(2*i,2*i+2),16); - } - return a; -} - -/*! asn1-1.0.2.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license - */ - -var JSX = JSX || {}; -JSX.env = JSX.env || {}; - -var L = JSX, OP = Object.prototype, FUNCTION_TOSTRING = '[object Function]',ADD = ["toString", "valueOf"]; - -JSX.env.parseUA = function(agent) { - - var numberify = function(s) { - var c = 0; - return parseFloat(s.replace(/\./g, function() { - return (c++ == 1) ? '' : '.'; - })); - }, - - nav = navigator, - o = { - ie: 0, - opera: 0, - gecko: 0, - webkit: 0, - chrome: 0, - mobile: null, - air: 0, - ipad: 0, - iphone: 0, - ipod: 0, - ios: null, - android: 0, - webos: 0, - caja: nav && nav.cajaVersion, - secure: false, - os: null - - }, - - ua = agent || (navigator && navigator.userAgent), - loc = window && window.location, - href = loc && loc.href, - m; - - o.secure = href && (href.toLowerCase().indexOf("https") === 0); - - if (ua) { - - if ((/windows|win32/i).test(ua)) { - o.os = 'windows'; - } else if ((/macintosh/i).test(ua)) { - o.os = 'macintosh'; - } else if ((/rhino/i).test(ua)) { - o.os = 'rhino'; + function b64toBA(s) { + //piggyback on b64tohex for now, optimize later + var h = b64tohex(s); + var i; + var a = new Array(); + for (i = 0; 2 * i < h.length; ++i) { + a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16); } - if ((/KHTML/).test(ua)) { - o.webkit = 1; - } - m = ua.match(/AppleWebKit\/([^\s]*)/); - if (m && m[1]) { - o.webkit = numberify(m[1]); - if (/ Mobile\//.test(ua)) { - o.mobile = 'Apple'; // iPhone or iPod Touch - m = ua.match(/OS ([^\s]*)/); - if (m && m[1]) { - m = numberify(m[1].replace('_', '.')); - } - o.ios = m; - o.ipad = o.ipod = o.iphone = 0; - m = ua.match(/iPad|iPod|iPhone/); - if (m && m[0]) { - o[m[0].toLowerCase()] = o.ios; - } - } else { - m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/); - if (m) { - o.mobile = m[0]; - } - if (/webOS/.test(ua)) { - o.mobile = 'WebOS'; - m = ua.match(/webOS\/([^\s]*);/); - if (m && m[1]) { - o.webos = numberify(m[1]); - } - } - if (/ Android/.test(ua)) { - o.mobile = 'Android'; - m = ua.match(/Android ([^\s]*);/); - if (m && m[1]) { - o.android = numberify(m[1]); - } - } + return a; + } + + /*! asn1-1.0.2.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license + */ + + var JSX = JSX || {}; + JSX.env = JSX.env || {}; + + var L = JSX, OP = Object.prototype, FUNCTION_TOSTRING = '[object Function]', ADD = ["toString", "valueOf"]; + + JSX.env.parseUA = function (agent) { + + var numberify = function (s) { + var c = 0; + return parseFloat(s.replace(/\./g, function () { + return (c++ == 1) ? '' : '.'; + })); + }, + + nav = navigator, + o = { + ie: 0, + opera: 0, + gecko: 0, + webkit: 0, + chrome: 0, + mobile: null, + air: 0, + ipad: 0, + iphone: 0, + ipod: 0, + ios: null, + android: 0, + webos: 0, + caja: nav && nav.cajaVersion, + secure: false, + os: null + + }, + + ua = agent || (navigator && navigator.userAgent), + loc = window && window.location, + href = loc && loc.href, + m; + + o.secure = href && (href.toLowerCase().indexOf("https") === 0); + + if (ua) { + + if ((/windows|win32/i).test(ua)) { + o.os = 'windows'; + } else if ((/macintosh/i).test(ua)) { + o.os = 'macintosh'; + } else if ((/rhino/i).test(ua)) { + o.os = 'rhino'; } - m = ua.match(/Chrome\/([^\s]*)/); - if (m && m[1]) { - o.chrome = numberify(m[1]); // Chrome - } else { - m = ua.match(/AdobeAIR\/([^\s]*)/); - if (m) { - o.air = m[0]; // Adobe AIR 1.0 or better - } + if ((/KHTML/).test(ua)) { + o.webkit = 1; } - } - if (!o.webkit) { - m = ua.match(/Opera[\s\/]([^\s]*)/); + m = ua.match(/AppleWebKit\/([^\s]*)/); if (m && m[1]) { - o.opera = numberify(m[1]); - m = ua.match(/Version\/([^\s]*)/); - if (m && m[1]) { - o.opera = numberify(m[1]); // opera 10+ - } - m = ua.match(/Opera Mini[^;]*/); - if (m) { - o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 - } - } else { // not opera or webkit - m = ua.match(/MSIE\s([^;]*)/); - if (m && m[1]) { - o.ie = numberify(m[1]); - } else { // not opera, webkit, or ie - m = ua.match(/Gecko\/([^\s]*)/); + o.webkit = numberify(m[1]); + if (/ Mobile\//.test(ua)) { + o.mobile = 'Apple'; // iPhone or iPod Touch + m = ua.match(/OS ([^\s]*)/); + if (m && m[1]) { + m = numberify(m[1].replace('_', '.')); + } + o.ios = m; + o.ipad = o.ipod = o.iphone = 0; + m = ua.match(/iPad|iPod|iPhone/); + if (m && m[0]) { + o[m[0].toLowerCase()] = o.ios; + } + } else { + m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/); if (m) { - o.gecko = 1; // Gecko detected, look for revision - m = ua.match(/rv:([^\s\)]*)/); + o.mobile = m[0]; + } + if (/webOS/.test(ua)) { + o.mobile = 'WebOS'; + m = ua.match(/webOS\/([^\s]*);/); if (m && m[1]) { - o.gecko = numberify(m[1]); + o.webos = numberify(m[1]); + } + } + if (/ Android/.test(ua)) { + o.mobile = 'Android'; + m = ua.match(/Android ([^\s]*);/); + if (m && m[1]) { + o.android = numberify(m[1]); + } + } + } + m = ua.match(/Chrome\/([^\s]*)/); + if (m && m[1]) { + o.chrome = numberify(m[1]); // Chrome + } else { + m = ua.match(/AdobeAIR\/([^\s]*)/); + if (m) { + o.air = m[0]; // Adobe AIR 1.0 or better + } + } + } + if (!o.webkit) { + m = ua.match(/Opera[\s\/]([^\s]*)/); + if (m && m[1]) { + o.opera = numberify(m[1]); + m = ua.match(/Version\/([^\s]*)/); + if (m && m[1]) { + o.opera = numberify(m[1]); // opera 10+ + } + m = ua.match(/Opera Mini[^;]*/); + if (m) { + o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 + } + } else { // not opera or webkit + m = ua.match(/MSIE\s([^;]*)/); + if (m && m[1]) { + o.ie = numberify(m[1]); + } else { // not opera, webkit, or ie + m = ua.match(/Gecko\/([^\s]*)/); + if (m) { + o.gecko = 1; // Gecko detected, look for revision + m = ua.match(/rv:([^\s\)]*)/); + if (m && m[1]) { + o.gecko = numberify(m[1]); + } } } } } } - } - return o; -}; + return o; + }; -JSX.env.ua = JSX.env.parseUA(); + JSX.env.ua = JSX.env.parseUA(); -JSX.isFunction = function(o) { - return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING; -}; + JSX.isFunction = function (o) { + return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING; + }; -JSX._IEEnumFix = (JSX.env.ua.ie) ? function(r, s) { - var i, fname, f; - for (i=0;iMIT License - */ - -/** - * kjur's class library name space - *

    - * This name space provides following name spaces: - *

      - *
    • {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
    • - *
    • {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
    • - *
    • {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature - * class and utilities
    • - *
    - *

    - * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2. - * @name KJUR - * @namespace kjur's class library name space - */ -if (typeof KJUR == "undefined" || !KJUR) KJUR = {}; - -/** - * kjur's ASN.1 class library name space - *

    - * This is ITU-T X.690 ASN.1 DER encoder class library and - * class structure and methods is very similar to - * org.bouncycastle.asn1 package of - * well known BouncyCaslte Cryptography Library. - * - *

    PROVIDING ASN.1 PRIMITIVES

    - * Here are ASN.1 DER primitive classes. - *
      - *
    • {@link KJUR.asn1.DERBoolean}
    • - *
    • {@link KJUR.asn1.DERInteger}
    • - *
    • {@link KJUR.asn1.DERBitString}
    • - *
    • {@link KJUR.asn1.DEROctetString}
    • - *
    • {@link KJUR.asn1.DERNull}
    • - *
    • {@link KJUR.asn1.DERObjectIdentifier}
    • - *
    • {@link KJUR.asn1.DERUTF8String}
    • - *
    • {@link KJUR.asn1.DERNumericString}
    • - *
    • {@link KJUR.asn1.DERPrintableString}
    • - *
    • {@link KJUR.asn1.DERTeletexString}
    • - *
    • {@link KJUR.asn1.DERIA5String}
    • - *
    • {@link KJUR.asn1.DERUTCTime}
    • - *
    • {@link KJUR.asn1.DERGeneralizedTime}
    • - *
    • {@link KJUR.asn1.DERSequence}
    • - *
    • {@link KJUR.asn1.DERSet}
    • - *
    - * - *

    OTHER ASN.1 CLASSES

    - *
      - *
    • {@link KJUR.asn1.ASN1Object}
    • - *
    • {@link KJUR.asn1.DERAbstractString}
    • - *
    • {@link KJUR.asn1.DERAbstractTime}
    • - *
    • {@link KJUR.asn1.DERAbstractStructured}
    • - *
    • {@link KJUR.asn1.DERTaggedObject}
    • - *
    - *

    - * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2. - * @name KJUR.asn1 - * @namespace - */ -if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {}; - -/** - * ASN1 utilities class - * @name KJUR.asn1.ASN1Util - * @classs ASN1 utilities class - * @since asn1 1.0.2 - */ -KJUR.asn1.ASN1Util = new function() { - this.integerToByteHex = function(i) { - var h = i.toString(16); - if ((h.length % 2) == 1) h = '0' + h; - return h; + } : function () { }; - this.bigIntToMinTwosComplementsHex = function(bigIntegerValue) { - var h = bigIntegerValue.toString(16); - if (h.substr(0, 1) != '-') { - if (h.length % 2 == 1) { - h = '0' + h; - } else { - if (! h.match(/^[0-7]/)) { - h = '00' + h; - } - } - } else { - var hPos = h.substr(1); - var xorLen = hPos.length; - if (xorLen % 2 == 1) { - xorLen += 1; - } else { - if (! h.match(/^[0-7]/)) { - xorLen += 2; - } - } - var hMask = ''; - for (var i = 0; i < xorLen; i++) { - hMask += 'f'; - } - var biMask = new BigInteger(hMask, 16); - var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE); - h = biNeg.toString(16).replace(/^-/, ''); - } - return h; + + JSX.extend = function (subc, superc, overrides) { + if (!superc || !subc) { + throw new Error("extend failed, please check that " + + "all dependencies are included."); + } + var F = function () { + }, i; + F.prototype = superc.prototype; + subc.prototype = new F(); + subc.prototype.constructor = subc; + subc.superclass = superc.prototype; + if (superc.prototype.constructor == OP.constructor) { + superc.prototype.constructor = superc; + } + + if (overrides) { + for (i in overrides) { + if (L.hasOwnProperty(overrides, i)) { + subc.prototype[i] = overrides[i]; + } + } + + L._IEEnumFix(subc.prototype, overrides); + } }; - /** - * get PEM string from hexadecimal data and header string - * @name getPEMStringFromHex - * @memberOf KJUR.asn1.ASN1Util - * @function - * @param {String} dataHex hexadecimal string of PEM body - * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY') - * @return {String} PEM formatted string of input data - * @description - * @example - * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY'); - * // value of pem will be: - * -----BEGIN PRIVATE KEY----- - * YWFh - * -----END PRIVATE KEY----- + + /* + * asn1.js - ASN.1 DER encoder classes + * + * Copyright (c) 2013 Kenji Urushima (kenji.urushima@gmail.com) + * + * This software is licensed under the terms of the MIT License. + * http://kjur.github.com/jsrsasign/license + * + * The above copyright and license notice shall be + * included in all copies or substantial portions of the Software. */ - this.getPEMStringFromHex = function(dataHex, pemHeader) { - var dataWA = CryptoJS.enc.Hex.parse(dataHex); - var dataB64 = CryptoJS.enc.Base64.stringify(dataWA); - var pemBody = dataB64.replace(/(.{64})/g, "$1\r\n"); - pemBody = pemBody.replace(/\r\n$/, ''); - return "-----BEGIN " + pemHeader + "-----\r\n" + - pemBody + - "\r\n-----END " + pemHeader + "-----\r\n"; + + /** + * @fileOverview + * @name asn1-1.0.js + * @author Kenji Urushima kenji.urushima@gmail.com + * @version 1.0.2 (2013-May-30) + * @since 2.1 + * @license MIT License + */ + + /** + * kjur's class library name space + *

    + * This name space provides following name spaces: + *

      + *
    • {@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder
    • + *
    • {@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL
    • + *
    • {@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature + * class and utilities
    • + *
    + *

    + * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2. + * @name KJUR + * @namespace kjur's class library name space + */ + if (typeof KJUR == "undefined" || !KJUR) KJUR = {}; + + /** + * kjur's ASN.1 class library name space + *

    + * This is ITU-T X.690 ASN.1 DER encoder class library and + * class structure and methods is very similar to + * org.bouncycastle.asn1 package of + * well known BouncyCaslte Cryptography Library. + * + *

    PROVIDING ASN.1 PRIMITIVES

    + * Here are ASN.1 DER primitive classes. + *
      + *
    • {@link KJUR.asn1.DERBoolean}
    • + *
    • {@link KJUR.asn1.DERInteger}
    • + *
    • {@link KJUR.asn1.DERBitString}
    • + *
    • {@link KJUR.asn1.DEROctetString}
    • + *
    • {@link KJUR.asn1.DERNull}
    • + *
    • {@link KJUR.asn1.DERObjectIdentifier}
    • + *
    • {@link KJUR.asn1.DERUTF8String}
    • + *
    • {@link KJUR.asn1.DERNumericString}
    • + *
    • {@link KJUR.asn1.DERPrintableString}
    • + *
    • {@link KJUR.asn1.DERTeletexString}
    • + *
    • {@link KJUR.asn1.DERIA5String}
    • + *
    • {@link KJUR.asn1.DERUTCTime}
    • + *
    • {@link KJUR.asn1.DERGeneralizedTime}
    • + *
    • {@link KJUR.asn1.DERSequence}
    • + *
    • {@link KJUR.asn1.DERSet}
    • + *
    + * + *

    OTHER ASN.1 CLASSES

    + *
      + *
    • {@link KJUR.asn1.ASN1Object}
    • + *
    • {@link KJUR.asn1.DERAbstractString}
    • + *
    • {@link KJUR.asn1.DERAbstractTime}
    • + *
    • {@link KJUR.asn1.DERAbstractStructured}
    • + *
    • {@link KJUR.asn1.DERTaggedObject}
    • + *
    + *

    + * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2. + * @name KJUR.asn1 + * @namespace + */ + if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) KJUR.asn1 = {}; + + /** + * ASN1 utilities class + * @name KJUR.asn1.ASN1Util + * @classs ASN1 utilities class + * @since asn1 1.0.2 + */ + KJUR.asn1.ASN1Util = new function () { + this.integerToByteHex = function (i) { + var h = i.toString(16); + if ((h.length % 2) == 1) h = '0' + h; + return h; + }; + this.bigIntToMinTwosComplementsHex = function (bigIntegerValue) { + var h = bigIntegerValue.toString(16); + if (h.substr(0, 1) != '-') { + if (h.length % 2 == 1) { + h = '0' + h; + } else { + if (!h.match(/^[0-7]/)) { + h = '00' + h; + } + } + } else { + var hPos = h.substr(1); + var xorLen = hPos.length; + if (xorLen % 2 == 1) { + xorLen += 1; + } else { + if (!h.match(/^[0-7]/)) { + xorLen += 2; + } + } + var hMask = ''; + for (var i = 0; i < xorLen; i++) { + hMask += 'f'; + } + var biMask = new BigInteger(hMask, 16); + var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE); + h = biNeg.toString(16).replace(/^-/, ''); + } + return h; + }; + /** + * get PEM string from hexadecimal data and header string + * @name getPEMStringFromHex + * @memberOf KJUR.asn1.ASN1Util + * @function + * @param {String} dataHex hexadecimal string of PEM body + * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY') + * @return {String} PEM formatted string of input data + * @description + * @example + * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY'); + * // value of pem will be: + * -----BEGIN PRIVATE KEY----- + * YWFh + * -----END PRIVATE KEY----- + */ + this.getPEMStringFromHex = function (dataHex, pemHeader) { + var dataWA = CryptoJS.enc.Hex.parse(dataHex); + var dataB64 = CryptoJS.enc.Base64.stringify(dataWA); + var pemBody = dataB64.replace(/(.{64})/g, "$1\r\n"); + pemBody = pemBody.replace(/\r\n$/, ''); + return "-----BEGIN " + pemHeader + "-----\r\n" + + pemBody + + "\r\n-----END " + pemHeader + "-----\r\n"; + }; }; -}; // ******************************************************************** // Abstract ASN.1 Classes @@ -2139,305 +2387,305 @@ KJUR.asn1.ASN1Util = new function() { // ******************************************************************** -/** - * base class for ASN.1 DER encoder object - * @name KJUR.asn1.ASN1Object - * @class base class for ASN.1 DER encoder object - * @property {Boolean} isModified flag whether internal data was changed - * @property {String} hTLV hexadecimal string of ASN.1 TLV - * @property {String} hT hexadecimal string of ASN.1 TLV tag(T) - * @property {String} hL hexadecimal string of ASN.1 TLV length(L) - * @property {String} hV hexadecimal string of ASN.1 TLV value(V) - * @description - */ -KJUR.asn1.ASN1Object = function() { - var isModified = true; - var hTLV = null; - var hT = '00' - var hL = '00'; - var hV = ''; - /** - * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V) - * @name getLengthHexFromValue - * @memberOf KJUR.asn1.ASN1Object - * @function - * @return {String} hexadecimal string of ASN.1 TLV length(L) + * base class for ASN.1 DER encoder object + * @name KJUR.asn1.ASN1Object + * @class base class for ASN.1 DER encoder object + * @property {Boolean} isModified flag whether internal data was changed + * @property {String} hTLV hexadecimal string of ASN.1 TLV + * @property {String} hT hexadecimal string of ASN.1 TLV tag(T) + * @property {String} hL hexadecimal string of ASN.1 TLV length(L) + * @property {String} hV hexadecimal string of ASN.1 TLV value(V) + * @description */ - this.getLengthHexFromValue = function() { - if (typeof this.hV == "undefined" || this.hV == null) { - throw "this.hV is null or undefined."; - } - if (this.hV.length % 2 == 1) { - throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV; - } - var n = this.hV.length / 2; - var hN = n.toString(16); - if (hN.length % 2 == 1) { - hN = "0" + hN; - } - if (n < 128) { - return hN; - } else { - var hNlen = hN.length / 2; - if (hNlen > 15) { - throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16); - } - var head = 128 + hNlen; - return head.toString(16) + hN; - } - }; + KJUR.asn1.ASN1Object = function () { + var isModified = true; + var hTLV = null; + var hT = '00' + var hL = '00'; + var hV = ''; - /** - * get hexadecimal string of ASN.1 TLV bytes - * @name getEncodedHex - * @memberOf KJUR.asn1.ASN1Object - * @function - * @return {String} hexadecimal string of ASN.1 TLV - */ - this.getEncodedHex = function() { - if (this.hTLV == null || this.isModified) { - this.hV = this.getFreshValueHex(); - this.hL = this.getLengthHexFromValue(); - this.hTLV = this.hT + this.hL + this.hV; - this.isModified = false; - //console.error("first time: " + this.hTLV); - } - return this.hTLV; - }; + /** + * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V) + * @name getLengthHexFromValue + * @memberOf KJUR.asn1.ASN1Object + * @function + * @return {String} hexadecimal string of ASN.1 TLV length(L) + */ + this.getLengthHexFromValue = function () { + if (typeof this.hV == "undefined" || this.hV == null) { + throw "this.hV is null or undefined."; + } + if (this.hV.length % 2 == 1) { + throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV; + } + var n = this.hV.length / 2; + var hN = n.toString(16); + if (hN.length % 2 == 1) { + hN = "0" + hN; + } + if (n < 128) { + return hN; + } else { + var hNlen = hN.length / 2; + if (hNlen > 15) { + throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16); + } + var head = 128 + hNlen; + return head.toString(16) + hN; + } + }; - /** - * get hexadecimal string of ASN.1 TLV value(V) bytes - * @name getValueHex - * @memberOf KJUR.asn1.ASN1Object - * @function - * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes - */ - this.getValueHex = function() { - this.getEncodedHex(); - return this.hV; - } + /** + * get hexadecimal string of ASN.1 TLV bytes + * @name getEncodedHex + * @memberOf KJUR.asn1.ASN1Object + * @function + * @return {String} hexadecimal string of ASN.1 TLV + */ + this.getEncodedHex = function () { + if (this.hTLV == null || this.isModified) { + this.hV = this.getFreshValueHex(); + this.hL = this.getLengthHexFromValue(); + this.hTLV = this.hT + this.hL + this.hV; + this.isModified = false; + //console.error("first time: " + this.hTLV); + } + return this.hTLV; + }; - this.getFreshValueHex = function() { - return ''; + /** + * get hexadecimal string of ASN.1 TLV value(V) bytes + * @name getValueHex + * @memberOf KJUR.asn1.ASN1Object + * @function + * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes + */ + this.getValueHex = function () { + this.getEncodedHex(); + return this.hV; + } + + this.getFreshValueHex = function () { + return ''; + }; }; -}; // == BEGIN DERAbstractString ================================================ -/** - * base class for ASN.1 DER string classes - * @name KJUR.asn1.DERAbstractString - * @class base class for ASN.1 DER string classes - * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) - * @property {String} s internal string of value - * @extends KJUR.asn1.ASN1Object - * @description - *
    - * As for argument 'params' for constructor, you can specify one of - * following properties: - *
      - *
    • str - specify initial ASN.1 value(V) by a string
    • - *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • - *
    - * NOTE: 'params' can be omitted. - */ -KJUR.asn1.DERAbstractString = function(params) { - KJUR.asn1.DERAbstractString.superclass.constructor.call(this); - var s = null; - var hV = null; - /** - * get string value of this string object - * @name getString - * @memberOf KJUR.asn1.DERAbstractString - * @function - * @return {String} string value of this string object + * base class for ASN.1 DER string classes + * @name KJUR.asn1.DERAbstractString + * @class base class for ASN.1 DER string classes + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @property {String} s internal string of value + * @extends KJUR.asn1.ASN1Object + * @description + *
    + * As for argument 'params' for constructor, you can specify one of + * following properties: + *
      + *
    • str - specify initial ASN.1 value(V) by a string
    • + *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • + *
    + * NOTE: 'params' can be omitted. */ - this.getString = function() { - return this.s; - }; + KJUR.asn1.DERAbstractString = function (params) { + KJUR.asn1.DERAbstractString.superclass.constructor.call(this); + var s = null; + var hV = null; - /** - * set value by a string - * @name setString - * @memberOf KJUR.asn1.DERAbstractString - * @function - * @param {String} newS value by a string to set - */ - this.setString = function(newS) { - this.hTLV = null; - this.isModified = true; - this.s = newS; - this.hV = stohex(this.s); - }; + /** + * get string value of this string object + * @name getString + * @memberOf KJUR.asn1.DERAbstractString + * @function + * @return {String} string value of this string object + */ + this.getString = function () { + return this.s; + }; - /** - * set value by a hexadecimal string - * @name setStringHex - * @memberOf KJUR.asn1.DERAbstractString - * @function - * @param {String} newHexString value by a hexadecimal string to set - */ - this.setStringHex = function(newHexString) { - this.hTLV = null; - this.isModified = true; - this.s = null; - this.hV = newHexString; - }; + /** + * set value by a string + * @name setString + * @memberOf KJUR.asn1.DERAbstractString + * @function + * @param {String} newS value by a string to set + */ + this.setString = function (newS) { + this.hTLV = null; + this.isModified = true; + this.s = newS; + this.hV = stohex(this.s); + }; - this.getFreshValueHex = function() { - return this.hV; - }; + /** + * set value by a hexadecimal string + * @name setStringHex + * @memberOf KJUR.asn1.DERAbstractString + * @function + * @param {String} newHexString value by a hexadecimal string to set + */ + this.setStringHex = function (newHexString) { + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = newHexString; + }; - if (typeof params != "undefined") { - if (typeof params['str'] != "undefined") { - this.setString(params['str']); - } else if (typeof params['hex'] != "undefined") { - this.setStringHex(params['hex']); - } - } -}; -JSX.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object); + this.getFreshValueHex = function () { + return this.hV; + }; + + if (typeof params != "undefined") { + if (typeof params['str'] != "undefined") { + this.setString(params['str']); + } else if (typeof params['hex'] != "undefined") { + this.setStringHex(params['hex']); + } + } + }; + JSX.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object); // == END DERAbstractString ================================================ // == BEGIN DERAbstractTime ================================================== -/** - * base class for ASN.1 DER Generalized/UTCTime class - * @name KJUR.asn1.DERAbstractTime - * @class base class for ASN.1 DER Generalized/UTCTime class - * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) - * @extends KJUR.asn1.ASN1Object - * @description - * @see KJUR.asn1.ASN1Object - superclass - */ -KJUR.asn1.DERAbstractTime = function(params) { - KJUR.asn1.DERAbstractTime.superclass.constructor.call(this); - var s = null; - var date = null; - - // --- PRIVATE METHODS -------------------- - this.localDateToUTC = function(d) { - utc = d.getTime() + (d.getTimezoneOffset() * 60000); - var utcDate = new Date(utc); - return utcDate; - }; - - this.formatDate = function(dateObject, type) { - var pad = this.zeroPadding; - var d = this.localDateToUTC(dateObject); - var year = String(d.getFullYear()); - if (type == 'utc') year = year.substr(2, 2); - var month = pad(String(d.getMonth() + 1), 2); - var day = pad(String(d.getDate()), 2); - var hour = pad(String(d.getHours()), 2); - var min = pad(String(d.getMinutes()), 2); - var sec = pad(String(d.getSeconds()), 2); - return year + month + day + hour + min + sec + 'Z'; - }; - - this.zeroPadding = function(s, len) { - if (s.length >= len) return s; - return new Array(len - s.length + 1).join('0') + s; - }; - - // --- PUBLIC METHODS -------------------- /** - * get string value of this string object - * @name getString - * @memberOf KJUR.asn1.DERAbstractTime - * @function - * @return {String} string value of this time object + * base class for ASN.1 DER Generalized/UTCTime class + * @name KJUR.asn1.DERAbstractTime + * @class base class for ASN.1 DER Generalized/UTCTime class + * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) + * @extends KJUR.asn1.ASN1Object + * @description + * @see KJUR.asn1.ASN1Object - superclass */ - this.getString = function() { - return this.s; - }; + KJUR.asn1.DERAbstractTime = function (params) { + KJUR.asn1.DERAbstractTime.superclass.constructor.call(this); + var s = null; + var date = null; - /** - * set value by a string - * @name setString - * @memberOf KJUR.asn1.DERAbstractTime - * @function - * @param {String} newS value by a string to set such like "130430235959Z" - */ - this.setString = function(newS) { - this.hTLV = null; - this.isModified = true; - this.s = newS; - this.hV = stohex(this.s); - }; + // --- PRIVATE METHODS -------------------- + this.localDateToUTC = function (d) { + utc = d.getTime() + (d.getTimezoneOffset() * 60000); + var utcDate = new Date(utc); + return utcDate; + }; - /** - * set value by a Date object - * @name setByDateValue - * @memberOf KJUR.asn1.DERAbstractTime - * @function - * @param {Integer} year year of date (ex. 2013) - * @param {Integer} month month of date between 1 and 12 (ex. 12) - * @param {Integer} day day of month - * @param {Integer} hour hours of date - * @param {Integer} min minutes of date - * @param {Integer} sec seconds of date - */ - this.setByDateValue = function(year, month, day, hour, min, sec) { - var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0)); - this.setByDate(dateObject); - }; + this.formatDate = function (dateObject, type) { + var pad = this.zeroPadding; + var d = this.localDateToUTC(dateObject); + var year = String(d.getFullYear()); + if (type == 'utc') year = year.substr(2, 2); + var month = pad(String(d.getMonth() + 1), 2); + var day = pad(String(d.getDate()), 2); + var hour = pad(String(d.getHours()), 2); + var min = pad(String(d.getMinutes()), 2); + var sec = pad(String(d.getSeconds()), 2); + return year + month + day + hour + min + sec + 'Z'; + }; - this.getFreshValueHex = function() { - return this.hV; + this.zeroPadding = function (s, len) { + if (s.length >= len) return s; + return new Array(len - s.length + 1).join('0') + s; + }; + + // --- PUBLIC METHODS -------------------- + /** + * get string value of this string object + * @name getString + * @memberOf KJUR.asn1.DERAbstractTime + * @function + * @return {String} string value of this time object + */ + this.getString = function () { + return this.s; + }; + + /** + * set value by a string + * @name setString + * @memberOf KJUR.asn1.DERAbstractTime + * @function + * @param {String} newS value by a string to set such like "130430235959Z" + */ + this.setString = function (newS) { + this.hTLV = null; + this.isModified = true; + this.s = newS; + this.hV = stohex(this.s); + }; + + /** + * set value by a Date object + * @name setByDateValue + * @memberOf KJUR.asn1.DERAbstractTime + * @function + * @param {Integer} year year of date (ex. 2013) + * @param {Integer} month month of date between 1 and 12 (ex. 12) + * @param {Integer} day day of month + * @param {Integer} hour hours of date + * @param {Integer} min minutes of date + * @param {Integer} sec seconds of date + */ + this.setByDateValue = function (year, month, day, hour, min, sec) { + var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0)); + this.setByDate(dateObject); + }; + + this.getFreshValueHex = function () { + return this.hV; + }; }; -}; -JSX.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object); + JSX.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object); // == END DERAbstractTime ================================================== // == BEGIN DERAbstractStructured ============================================ -/** - * base class for ASN.1 DER structured class - * @name KJUR.asn1.DERAbstractStructured - * @class base class for ASN.1 DER structured class - * @property {Array} asn1Array internal array of ASN1Object - * @extends KJUR.asn1.ASN1Object - * @description - * @see KJUR.asn1.ASN1Object - superclass - */ -KJUR.asn1.DERAbstractStructured = function(params) { - KJUR.asn1.DERAbstractString.superclass.constructor.call(this); - var asn1Array = null; - /** - * set value by array of ASN1Object - * @name setByASN1ObjectArray - * @memberOf KJUR.asn1.DERAbstractStructured - * @function - * @param {array} asn1ObjectArray array of ASN1Object to set + * base class for ASN.1 DER structured class + * @name KJUR.asn1.DERAbstractStructured + * @class base class for ASN.1 DER structured class + * @property {Array} asn1Array internal array of ASN1Object + * @extends KJUR.asn1.ASN1Object + * @description + * @see KJUR.asn1.ASN1Object - superclass */ - this.setByASN1ObjectArray = function(asn1ObjectArray) { - this.hTLV = null; - this.isModified = true; - this.asn1Array = asn1ObjectArray; - }; + KJUR.asn1.DERAbstractStructured = function (params) { + KJUR.asn1.DERAbstractString.superclass.constructor.call(this); + var asn1Array = null; - /** - * append an ASN1Object to internal array - * @name appendASN1Object - * @memberOf KJUR.asn1.DERAbstractStructured - * @function - * @param {ASN1Object} asn1Object to add - */ - this.appendASN1Object = function(asn1Object) { - this.hTLV = null; - this.isModified = true; - this.asn1Array.push(asn1Object); - }; + /** + * set value by array of ASN1Object + * @name setByASN1ObjectArray + * @memberOf KJUR.asn1.DERAbstractStructured + * @function + * @param {array} asn1ObjectArray array of ASN1Object to set + */ + this.setByASN1ObjectArray = function (asn1ObjectArray) { + this.hTLV = null; + this.isModified = true; + this.asn1Array = asn1ObjectArray; + }; - this.asn1Array = new Array(); - if (typeof params != "undefined") { - if (typeof params['array'] != "undefined") { - this.asn1Array = params['array']; - } - } -}; -JSX.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object); + /** + * append an ASN1Object to internal array + * @name appendASN1Object + * @memberOf KJUR.asn1.DERAbstractStructured + * @function + * @param {ASN1Object} asn1Object to add + */ + this.appendASN1Object = function (asn1Object) { + this.hTLV = null; + this.isModified = true; + this.asn1Array.push(asn1Object); + }; + + this.asn1Array = new Array(); + if (typeof params != "undefined") { + if (typeof params['array'] != "undefined") { + this.asn1Array = params['array']; + } + } + }; + JSX.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object); // ******************************************************************** @@ -2445,719 +2693,719 @@ JSX.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object); // ******************************************************************** // ******************************************************************** -/** - * class for ASN.1 DER Boolean - * @name KJUR.asn1.DERBoolean - * @class class for ASN.1 DER Boolean - * @extends KJUR.asn1.ASN1Object - * @description - * @see KJUR.asn1.ASN1Object - superclass - */ -KJUR.asn1.DERBoolean = function() { - KJUR.asn1.DERBoolean.superclass.constructor.call(this); - this.hT = "01"; - this.hTLV = "0101ff"; -}; -JSX.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object); + /** + * class for ASN.1 DER Boolean + * @name KJUR.asn1.DERBoolean + * @class class for ASN.1 DER Boolean + * @extends KJUR.asn1.ASN1Object + * @description + * @see KJUR.asn1.ASN1Object - superclass + */ + KJUR.asn1.DERBoolean = function () { + KJUR.asn1.DERBoolean.superclass.constructor.call(this); + this.hT = "01"; + this.hTLV = "0101ff"; + }; + JSX.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object); // ******************************************************************** -/** - * class for ASN.1 DER Integer - * @name KJUR.asn1.DERInteger - * @class class for ASN.1 DER Integer - * @extends KJUR.asn1.ASN1Object - * @description - *
    - * As for argument 'params' for constructor, you can specify one of - * following properties: - *
      - *
    • int - specify initial ASN.1 value(V) by integer value
    • - *
    • bigint - specify initial ASN.1 value(V) by BigInteger object
    • - *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • - *
    - * NOTE: 'params' can be omitted. - */ -KJUR.asn1.DERInteger = function(params) { - KJUR.asn1.DERInteger.superclass.constructor.call(this); - this.hT = "02"; - /** - * set value by Tom Wu's BigInteger object - * @name setByBigInteger - * @memberOf KJUR.asn1.DERInteger - * @function - * @param {BigInteger} bigIntegerValue to set - */ - this.setByBigInteger = function(bigIntegerValue) { - this.hTLV = null; - this.isModified = true; - this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); - }; - - /** - * set value by integer value - * @name setByInteger - * @memberOf KJUR.asn1.DERInteger - * @function - * @param {Integer} integer value to set - */ - this.setByInteger = function(intValue) { - var bi = new BigInteger(String(intValue), 10); - this.setByBigInteger(bi); - }; - - /** - * set value by integer value - * @name setValueHex - * @memberOf KJUR.asn1.DERInteger - * @function - * @param {String} hexadecimal string of integer value + * class for ASN.1 DER Integer + * @name KJUR.asn1.DERInteger + * @class class for ASN.1 DER Integer + * @extends KJUR.asn1.ASN1Object * @description *
    - * NOTE: Value shall be represented by minimum octet length of - * two's complement representation. + * As for argument 'params' for constructor, you can specify one of + * following properties: + *
      + *
    • int - specify initial ASN.1 value(V) by integer value
    • + *
    • bigint - specify initial ASN.1 value(V) by BigInteger object
    • + *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • + *
    + * NOTE: 'params' can be omitted. */ - this.setValueHex = function(newHexString) { - this.hV = newHexString; - }; + KJUR.asn1.DERInteger = function (params) { + KJUR.asn1.DERInteger.superclass.constructor.call(this); + this.hT = "02"; - this.getFreshValueHex = function() { - return this.hV; - }; + /** + * set value by Tom Wu's BigInteger object + * @name setByBigInteger + * @memberOf KJUR.asn1.DERInteger + * @function + * @param {BigInteger} bigIntegerValue to set + */ + this.setByBigInteger = function (bigIntegerValue) { + this.hTLV = null; + this.isModified = true; + this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue); + }; - if (typeof params != "undefined") { - if (typeof params['bigint'] != "undefined") { - this.setByBigInteger(params['bigint']); - } else if (typeof params['int'] != "undefined") { - this.setByInteger(params['int']); - } else if (typeof params['hex'] != "undefined") { - this.setValueHex(params['hex']); - } - } -}; -JSX.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object); + /** + * set value by integer value + * @name setByInteger + * @memberOf KJUR.asn1.DERInteger + * @function + * @param {Integer} integer value to set + */ + this.setByInteger = function (intValue) { + var bi = new BigInteger(String(intValue), 10); + this.setByBigInteger(bi); + }; + + /** + * set value by integer value + * @name setValueHex + * @memberOf KJUR.asn1.DERInteger + * @function + * @param {String} hexadecimal string of integer value + * @description + *
    + * NOTE: Value shall be represented by minimum octet length of + * two's complement representation. + */ + this.setValueHex = function (newHexString) { + this.hV = newHexString; + }; + + this.getFreshValueHex = function () { + return this.hV; + }; + + if (typeof params != "undefined") { + if (typeof params['bigint'] != "undefined") { + this.setByBigInteger(params['bigint']); + } else if (typeof params['int'] != "undefined") { + this.setByInteger(params['int']); + } else if (typeof params['hex'] != "undefined") { + this.setValueHex(params['hex']); + } + } + }; + JSX.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object); // ******************************************************************** -/** - * class for ASN.1 DER encoded BitString primitive - * @name KJUR.asn1.DERBitString - * @class class for ASN.1 DER encoded BitString primitive - * @extends KJUR.asn1.ASN1Object - * @description - *
    - * As for argument 'params' for constructor, you can specify one of - * following properties: - *
      - *
    • bin - specify binary string (ex. '10111')
    • - *
    • array - specify array of boolean (ex. [true,false,true,true])
    • - *
    • hex - specify hexadecimal string of ASN.1 value(V) including unused bits
    • - *
    - * NOTE: 'params' can be omitted. - */ -KJUR.asn1.DERBitString = function(params) { - KJUR.asn1.DERBitString.superclass.constructor.call(this); - this.hT = "03"; - /** - * set ASN.1 value(V) by a hexadecimal string including unused bits - * @name setHexValueIncludingUnusedBits - * @memberOf KJUR.asn1.DERBitString - * @function - * @param {String} newHexStringIncludingUnusedBits - */ - this.setHexValueIncludingUnusedBits = function(newHexStringIncludingUnusedBits) { - this.hTLV = null; - this.isModified = true; - this.hV = newHexStringIncludingUnusedBits; - }; - - /** - * set ASN.1 value(V) by unused bit and hexadecimal string of value - * @name setUnusedBitsAndHexValue - * @memberOf KJUR.asn1.DERBitString - * @function - * @param {Integer} unusedBits - * @param {String} hValue - */ - this.setUnusedBitsAndHexValue = function(unusedBits, hValue) { - if (unusedBits < 0 || 7 < unusedBits) { - throw "unused bits shall be from 0 to 7: u = " + unusedBits; - } - var hUnusedBits = "0" + unusedBits; - this.hTLV = null; - this.isModified = true; - this.hV = hUnusedBits + hValue; - }; - - /** - * set ASN.1 DER BitString by binary string - * @name setByBinaryString - * @memberOf KJUR.asn1.DERBitString - * @function - * @param {String} binaryString binary value string (i.e. '10111') + * class for ASN.1 DER encoded BitString primitive + * @name KJUR.asn1.DERBitString + * @class class for ASN.1 DER encoded BitString primitive + * @extends KJUR.asn1.ASN1Object * @description - * Its unused bits will be calculated automatically by length of - * 'binaryValue'.
    - * NOTE: Trailing zeros '0' will be ignored. + *
    + * As for argument 'params' for constructor, you can specify one of + * following properties: + *
      + *
    • bin - specify binary string (ex. '10111')
    • + *
    • array - specify array of boolean (ex. [true,false,true,true])
    • + *
    • hex - specify hexadecimal string of ASN.1 value(V) including unused bits
    • + *
    + * NOTE: 'params' can be omitted. */ - this.setByBinaryString = function(binaryString) { - binaryString = binaryString.replace(/0+$/, ''); - var unusedBits = 8 - binaryString.length % 8; - if (unusedBits == 8) unusedBits = 0; - for (var i = 0; i <= unusedBits; i++) { - binaryString += '0'; - } - var h = ''; - for (var i = 0; i < binaryString.length - 1; i += 8) { - var b = binaryString.substr(i, 8); - var x = parseInt(b, 2).toString(16); - if (x.length == 1) x = '0' + x; - h += x; - } - this.hTLV = null; - this.isModified = true; - this.hV = '0' + unusedBits + h; - }; + KJUR.asn1.DERBitString = function (params) { + KJUR.asn1.DERBitString.superclass.constructor.call(this); + this.hT = "03"; + /** + * set ASN.1 value(V) by a hexadecimal string including unused bits + * @name setHexValueIncludingUnusedBits + * @memberOf KJUR.asn1.DERBitString + * @function + * @param {String} newHexStringIncludingUnusedBits + */ + this.setHexValueIncludingUnusedBits = function (newHexStringIncludingUnusedBits) { + this.hTLV = null; + this.isModified = true; + this.hV = newHexStringIncludingUnusedBits; + }; + + /** + * set ASN.1 value(V) by unused bit and hexadecimal string of value + * @name setUnusedBitsAndHexValue + * @memberOf KJUR.asn1.DERBitString + * @function + * @param {Integer} unusedBits + * @param {String} hValue + */ + this.setUnusedBitsAndHexValue = function (unusedBits, hValue) { + if (unusedBits < 0 || 7 < unusedBits) { + throw "unused bits shall be from 0 to 7: u = " + unusedBits; + } + var hUnusedBits = "0" + unusedBits; + this.hTLV = null; + this.isModified = true; + this.hV = hUnusedBits + hValue; + }; + + /** + * set ASN.1 DER BitString by binary string + * @name setByBinaryString + * @memberOf KJUR.asn1.DERBitString + * @function + * @param {String} binaryString binary value string (i.e. '10111') + * @description + * Its unused bits will be calculated automatically by length of + * 'binaryValue'.
    + * NOTE: Trailing zeros '0' will be ignored. + */ + this.setByBinaryString = function (binaryString) { + binaryString = binaryString.replace(/0+$/, ''); + var unusedBits = 8 - binaryString.length % 8; + if (unusedBits == 8) unusedBits = 0; + for (var i = 0; i <= unusedBits; i++) { + binaryString += '0'; + } + var h = ''; + for (var i = 0; i < binaryString.length - 1; i += 8) { + var b = binaryString.substr(i, 8); + var x = parseInt(b, 2).toString(16); + if (x.length == 1) x = '0' + x; + h += x; + } + this.hTLV = null; + this.isModified = true; + this.hV = '0' + unusedBits + h; + }; + + /** + * set ASN.1 TLV value(V) by an array of boolean + * @name setByBooleanArray + * @memberOf KJUR.asn1.DERBitString + * @function + * @param {array} booleanArray array of boolean (ex. [true, false, true]) + * @description + * NOTE: Trailing falses will be ignored. + */ + this.setByBooleanArray = function (booleanArray) { + var s = ''; + for (var i = 0; i < booleanArray.length; i++) { + if (booleanArray[i] == true) { + s += '1'; + } else { + s += '0'; + } + } + this.setByBinaryString(s); + }; + + /** + * generate an array of false with specified length + * @name newFalseArray + * @memberOf KJUR.asn1.DERBitString + * @function + * @param {Integer} nLength length of array to generate + * @return {array} array of boolean faluse + * @description + * This static method may be useful to initialize boolean array. + */ + this.newFalseArray = function (nLength) { + var a = new Array(nLength); + for (var i = 0; i < nLength; i++) { + a[i] = false; + } + return a; + }; + + this.getFreshValueHex = function () { + return this.hV; + }; + + if (typeof params != "undefined") { + if (typeof params['hex'] != "undefined") { + this.setHexValueIncludingUnusedBits(params['hex']); + } else if (typeof params['bin'] != "undefined") { + this.setByBinaryString(params['bin']); + } else if (typeof params['array'] != "undefined") { + this.setByBooleanArray(params['array']); + } + } + }; + JSX.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); + +// ******************************************************************** /** - * set ASN.1 TLV value(V) by an array of boolean - * @name setByBooleanArray - * @memberOf KJUR.asn1.DERBitString - * @function - * @param {array} booleanArray array of boolean (ex. [true, false, true]) + * class for ASN.1 DER OctetString + * @name KJUR.asn1.DEROctetString + * @class class for ASN.1 DER OctetString + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString * @description - * NOTE: Trailing falses will be ignored. + * @see KJUR.asn1.DERAbstractString - superclass */ - this.setByBooleanArray = function(booleanArray) { - var s = ''; - for (var i = 0; i < booleanArray.length; i++) { - if (booleanArray[i] == true) { - s += '1'; - } else { - s += '0'; - } - } - this.setByBinaryString(s); + KJUR.asn1.DEROctetString = function (params) { + KJUR.asn1.DEROctetString.superclass.constructor.call(this, params); + this.hT = "04"; }; + JSX.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); +// ******************************************************************** /** - * generate an array of false with specified length - * @name newFalseArray - * @memberOf KJUR.asn1.DERBitString - * @function - * @param {Integer} nLength length of array to generate - * @return {array} array of boolean faluse + * class for ASN.1 DER Null + * @name KJUR.asn1.DERNull + * @class class for ASN.1 DER Null + * @extends KJUR.asn1.ASN1Object * @description - * This static method may be useful to initialize boolean array. + * @see KJUR.asn1.ASN1Object - superclass */ - this.newFalseArray = function(nLength) { - var a = new Array(nLength); - for (var i = 0; i < nLength; i++) { - a[i] = false; - } - return a; + KJUR.asn1.DERNull = function () { + KJUR.asn1.DERNull.superclass.constructor.call(this); + this.hT = "05"; + this.hTLV = "0500"; }; - - this.getFreshValueHex = function() { - return this.hV; - }; - - if (typeof params != "undefined") { - if (typeof params['hex'] != "undefined") { - this.setHexValueIncludingUnusedBits(params['hex']); - } else if (typeof params['bin'] != "undefined") { - this.setByBinaryString(params['bin']); - } else if (typeof params['array'] != "undefined") { - this.setByBooleanArray(params['array']); - } - } -}; -JSX.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); + JSX.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); // ******************************************************************** -/** - * class for ASN.1 DER OctetString - * @name KJUR.asn1.DEROctetString - * @class class for ASN.1 DER OctetString - * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) - * @extends KJUR.asn1.DERAbstractString - * @description - * @see KJUR.asn1.DERAbstractString - superclass - */ -KJUR.asn1.DEROctetString = function(params) { - KJUR.asn1.DEROctetString.superclass.constructor.call(this, params); - this.hT = "04"; -}; -JSX.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); - -// ******************************************************************** -/** - * class for ASN.1 DER Null - * @name KJUR.asn1.DERNull - * @class class for ASN.1 DER Null - * @extends KJUR.asn1.ASN1Object - * @description - * @see KJUR.asn1.ASN1Object - superclass - */ -KJUR.asn1.DERNull = function() { - KJUR.asn1.DERNull.superclass.constructor.call(this); - this.hT = "05"; - this.hTLV = "0500"; -}; -JSX.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); - -// ******************************************************************** -/** - * class for ASN.1 DER ObjectIdentifier - * @name KJUR.asn1.DERObjectIdentifier - * @class class for ASN.1 DER ObjectIdentifier - * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'}) - * @extends KJUR.asn1.ASN1Object - * @description - *
    - * As for argument 'params' for constructor, you can specify one of - * following properties: - *
      - *
    • oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
    • - *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • - *
    - * NOTE: 'params' can be omitted. - */ -KJUR.asn1.DERObjectIdentifier = function(params) { - var itox = function(i) { - var h = i.toString(16); - if (h.length == 1) h = '0' + h; - return h; - }; - var roidtox = function(roid) { - var h = ''; - var bi = new BigInteger(roid, 10); - var b = bi.toString(2); - var padLen = 7 - b.length % 7; - if (padLen == 7) padLen = 0; - var bPad = ''; - for (var i = 0; i < padLen; i++) bPad += '0'; - b = bPad + b; - for (var i = 0; i < b.length - 1; i += 7) { - var b8 = b.substr(i, 7); - if (i != b.length - 7) b8 = '1' + b8; - h += itox(parseInt(b8, 2)); - } - return h; - } - - KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); - this.hT = "06"; - /** - * set value by a hexadecimal string - * @name setValueHex - * @memberOf KJUR.asn1.DERObjectIdentifier - * @function - * @param {String} newHexString hexadecimal value of OID bytes - */ - this.setValueHex = function(newHexString) { - this.hTLV = null; - this.isModified = true; - this.s = null; - this.hV = newHexString; - }; - - /** - * set value by a OID string - * @name setValueOidString - * @memberOf KJUR.asn1.DERObjectIdentifier - * @function - * @param {String} oidString OID string (ex. 2.5.4.13) - */ - this.setValueOidString = function(oidString) { - if (! oidString.match(/^[0-9.]+$/)) { - throw "malformed oid string: " + oidString; - } - var h = ''; - var a = oidString.split('.'); - var i0 = parseInt(a[0]) * 40 + parseInt(a[1]); - h += itox(i0); - a.splice(0, 2); - for (var i = 0; i < a.length; i++) { - h += roidtox(a[i]); - } - this.hTLV = null; - this.isModified = true; - this.s = null; - this.hV = h; - }; - - /** - * set value by a OID name - * @name setValueName - * @memberOf KJUR.asn1.DERObjectIdentifier - * @function - * @param {String} oidName OID name (ex. 'serverAuth') - * @since 1.0.1 + * class for ASN.1 DER ObjectIdentifier + * @name KJUR.asn1.DERObjectIdentifier + * @class class for ASN.1 DER ObjectIdentifier + * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'}) + * @extends KJUR.asn1.ASN1Object * @description - * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'. - * Otherwise raise error. + *
    + * As for argument 'params' for constructor, you can specify one of + * following properties: + *
      + *
    • oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)
    • + *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • + *
    + * NOTE: 'params' can be omitted. */ - this.setValueName = function(oidName) { - if (typeof KJUR.asn1.x509.OID.name2oidList[oidName] != "undefined") { - var oid = KJUR.asn1.x509.OID.name2oidList[oidName]; - this.setValueOidString(oid); - } else { - throw "DERObjectIdentifier oidName undefined: " + oidName; - } + KJUR.asn1.DERObjectIdentifier = function (params) { + var itox = function (i) { + var h = i.toString(16); + if (h.length == 1) h = '0' + h; + return h; + }; + var roidtox = function (roid) { + var h = ''; + var bi = new BigInteger(roid, 10); + var b = bi.toString(2); + var padLen = 7 - b.length % 7; + if (padLen == 7) padLen = 0; + var bPad = ''; + for (var i = 0; i < padLen; i++) bPad += '0'; + b = bPad + b; + for (var i = 0; i < b.length - 1; i += 7) { + var b8 = b.substr(i, 7); + if (i != b.length - 7) b8 = '1' + b8; + h += itox(parseInt(b8, 2)); + } + return h; + } + + KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); + this.hT = "06"; + + /** + * set value by a hexadecimal string + * @name setValueHex + * @memberOf KJUR.asn1.DERObjectIdentifier + * @function + * @param {String} newHexString hexadecimal value of OID bytes + */ + this.setValueHex = function (newHexString) { + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = newHexString; + }; + + /** + * set value by a OID string + * @name setValueOidString + * @memberOf KJUR.asn1.DERObjectIdentifier + * @function + * @param {String} oidString OID string (ex. 2.5.4.13) + */ + this.setValueOidString = function (oidString) { + if (!oidString.match(/^[0-9.]+$/)) { + throw "malformed oid string: " + oidString; + } + var h = ''; + var a = oidString.split('.'); + var i0 = parseInt(a[0]) * 40 + parseInt(a[1]); + h += itox(i0); + a.splice(0, 2); + for (var i = 0; i < a.length; i++) { + h += roidtox(a[i]); + } + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = h; + }; + + /** + * set value by a OID name + * @name setValueName + * @memberOf KJUR.asn1.DERObjectIdentifier + * @function + * @param {String} oidName OID name (ex. 'serverAuth') + * @since 1.0.1 + * @description + * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'. + * Otherwise raise error. + */ + this.setValueName = function (oidName) { + if (typeof KJUR.asn1.x509.OID.name2oidList[oidName] != "undefined") { + var oid = KJUR.asn1.x509.OID.name2oidList[oidName]; + this.setValueOidString(oid); + } else { + throw "DERObjectIdentifier oidName undefined: " + oidName; + } + }; + + this.getFreshValueHex = function () { + return this.hV; + }; + + if (typeof params != "undefined") { + if (typeof params['oid'] != "undefined") { + this.setValueOidString(params['oid']); + } else if (typeof params['hex'] != "undefined") { + this.setValueHex(params['hex']); + } else if (typeof params['name'] != "undefined") { + this.setValueName(params['name']); + } + } }; - - this.getFreshValueHex = function() { - return this.hV; - }; - - if (typeof params != "undefined") { - if (typeof params['oid'] != "undefined") { - this.setValueOidString(params['oid']); - } else if (typeof params['hex'] != "undefined") { - this.setValueHex(params['hex']); - } else if (typeof params['name'] != "undefined") { - this.setValueName(params['name']); - } - } -}; -JSX.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); + JSX.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); // ******************************************************************** -/** - * class for ASN.1 DER UTF8String - * @name KJUR.asn1.DERUTF8String - * @class class for ASN.1 DER UTF8String - * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) - * @extends KJUR.asn1.DERAbstractString - * @description - * @see KJUR.asn1.DERAbstractString - superclass - */ -KJUR.asn1.DERUTF8String = function(params) { - KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params); - this.hT = "0c"; -}; -JSX.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); - -// ******************************************************************** -/** - * class for ASN.1 DER NumericString - * @name KJUR.asn1.DERNumericString - * @class class for ASN.1 DER NumericString - * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) - * @extends KJUR.asn1.DERAbstractString - * @description - * @see KJUR.asn1.DERAbstractString - superclass - */ -KJUR.asn1.DERNumericString = function(params) { - KJUR.asn1.DERNumericString.superclass.constructor.call(this, params); - this.hT = "12"; -}; -JSX.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); - -// ******************************************************************** -/** - * class for ASN.1 DER PrintableString - * @name KJUR.asn1.DERPrintableString - * @class class for ASN.1 DER PrintableString - * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) - * @extends KJUR.asn1.DERAbstractString - * @description - * @see KJUR.asn1.DERAbstractString - superclass - */ -KJUR.asn1.DERPrintableString = function(params) { - KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params); - this.hT = "13"; -}; -JSX.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); - -// ******************************************************************** -/** - * class for ASN.1 DER TeletexString - * @name KJUR.asn1.DERTeletexString - * @class class for ASN.1 DER TeletexString - * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) - * @extends KJUR.asn1.DERAbstractString - * @description - * @see KJUR.asn1.DERAbstractString - superclass - */ -KJUR.asn1.DERTeletexString = function(params) { - KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params); - this.hT = "14"; -}; -JSX.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); - -// ******************************************************************** -/** - * class for ASN.1 DER IA5String - * @name KJUR.asn1.DERIA5String - * @class class for ASN.1 DER IA5String - * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) - * @extends KJUR.asn1.DERAbstractString - * @description - * @see KJUR.asn1.DERAbstractString - superclass - */ -KJUR.asn1.DERIA5String = function(params) { - KJUR.asn1.DERIA5String.superclass.constructor.call(this, params); - this.hT = "16"; -}; -JSX.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); - -// ******************************************************************** -/** - * class for ASN.1 DER UTCTime - * @name KJUR.asn1.DERUTCTime - * @class class for ASN.1 DER UTCTime - * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) - * @extends KJUR.asn1.DERAbstractTime - * @description - *
    - * As for argument 'params' for constructor, you can specify one of - * following properties: - *
      - *
    • str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
    • - *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • - *
    • date - specify Date object.
    • - *
    - * NOTE: 'params' can be omitted. - *

    EXAMPLES

    - * @example - * var d1 = new KJUR.asn1.DERUTCTime(); - * d1.setString('130430125959Z'); - * - * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); - * - * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); - */ -KJUR.asn1.DERUTCTime = function(params) { - KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params); - this.hT = "17"; - /** - * set value by a Date object - * @name setByDate - * @memberOf KJUR.asn1.DERUTCTime - * @function - * @param {Date} dateObject Date object to set ASN.1 value(V) + * class for ASN.1 DER UTF8String + * @name KJUR.asn1.DERUTF8String + * @class class for ASN.1 DER UTF8String + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass */ - this.setByDate = function(dateObject) { - this.hTLV = null; - this.isModified = true; - this.date = dateObject; - this.s = this.formatDate(this.date, 'utc'); - this.hV = stohex(this.s); + KJUR.asn1.DERUTF8String = function (params) { + KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params); + this.hT = "0c"; }; - - if (typeof params != "undefined") { - if (typeof params['str'] != "undefined") { - this.setString(params['str']); - } else if (typeof params['hex'] != "undefined") { - this.setStringHex(params['hex']); - } else if (typeof params['date'] != "undefined") { - this.setByDate(params['date']); - } - } -}; -JSX.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); + JSX.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); // ******************************************************************** -/** - * class for ASN.1 DER GeneralizedTime - * @name KJUR.asn1.DERGeneralizedTime - * @class class for ASN.1 DER GeneralizedTime - * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'}) - * @extends KJUR.asn1.DERAbstractTime - * @description - *
    - * As for argument 'params' for constructor, you can specify one of - * following properties: - *
      - *
    • str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
    • - *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • - *
    • date - specify Date object.
    • - *
    - * NOTE: 'params' can be omitted. - */ -KJUR.asn1.DERGeneralizedTime = function(params) { - KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params); - this.hT = "18"; - /** - * set value by a Date object - * @name setByDate - * @memberOf KJUR.asn1.DERGeneralizedTime - * @function - * @param {Date} dateObject Date object to set ASN.1 value(V) + * class for ASN.1 DER NumericString + * @name KJUR.asn1.DERNumericString + * @class class for ASN.1 DER NumericString + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ + KJUR.asn1.DERNumericString = function (params) { + KJUR.asn1.DERNumericString.superclass.constructor.call(this, params); + this.hT = "12"; + }; + JSX.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); + +// ******************************************************************** + /** + * class for ASN.1 DER PrintableString + * @name KJUR.asn1.DERPrintableString + * @class class for ASN.1 DER PrintableString + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ + KJUR.asn1.DERPrintableString = function (params) { + KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params); + this.hT = "13"; + }; + JSX.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); + +// ******************************************************************** + /** + * class for ASN.1 DER TeletexString + * @name KJUR.asn1.DERTeletexString + * @class class for ASN.1 DER TeletexString + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ + KJUR.asn1.DERTeletexString = function (params) { + KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params); + this.hT = "14"; + }; + JSX.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); + +// ******************************************************************** + /** + * class for ASN.1 DER IA5String + * @name KJUR.asn1.DERIA5String + * @class class for ASN.1 DER IA5String + * @param {Array} params associative array of parameters (ex. {'str': 'aaa'}) + * @extends KJUR.asn1.DERAbstractString + * @description + * @see KJUR.asn1.DERAbstractString - superclass + */ + KJUR.asn1.DERIA5String = function (params) { + KJUR.asn1.DERIA5String.superclass.constructor.call(this, params); + this.hT = "16"; + }; + JSX.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); + +// ******************************************************************** + /** + * class for ASN.1 DER UTCTime + * @name KJUR.asn1.DERUTCTime + * @class class for ASN.1 DER UTCTime + * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'}) + * @extends KJUR.asn1.DERAbstractTime + * @description + *
    + * As for argument 'params' for constructor, you can specify one of + * following properties: + *
      + *
    • str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')
    • + *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • + *
    • date - specify Date object.
    • + *
    + * NOTE: 'params' can be omitted. + *

    EXAMPLES

    * @example - * When you specify UTC time, use 'Date.UTC' method like this:
    - * var o = new DERUTCTime(); - * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 - * o.setByDate(date); + * var d1 = new KJUR.asn1.DERUTCTime(); + * d1.setString('130430125959Z'); + * + * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'}); + * + * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))}); */ - this.setByDate = function(dateObject) { - this.hTLV = null; - this.isModified = true; - this.date = dateObject; - this.s = this.formatDate(this.date, 'gen'); - this.hV = stohex(this.s); - }; + KJUR.asn1.DERUTCTime = function (params) { + KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params); + this.hT = "17"; - if (typeof params != "undefined") { - if (typeof params['str'] != "undefined") { - this.setString(params['str']); - } else if (typeof params['hex'] != "undefined") { - this.setStringHex(params['hex']); - } else if (typeof params['date'] != "undefined") { - this.setByDate(params['date']); - } - } -}; -JSX.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); + /** + * set value by a Date object + * @name setByDate + * @memberOf KJUR.asn1.DERUTCTime + * @function + * @param {Date} dateObject Date object to set ASN.1 value(V) + */ + this.setByDate = function (dateObject) { + this.hTLV = null; + this.isModified = true; + this.date = dateObject; + this.s = this.formatDate(this.date, 'utc'); + this.hV = stohex(this.s); + }; + + if (typeof params != "undefined") { + if (typeof params['str'] != "undefined") { + this.setString(params['str']); + } else if (typeof params['hex'] != "undefined") { + this.setStringHex(params['hex']); + } else if (typeof params['date'] != "undefined") { + this.setByDate(params['date']); + } + } + }; + JSX.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); // ******************************************************************** -/** - * class for ASN.1 DER Sequence - * @name KJUR.asn1.DERSequence - * @class class for ASN.1 DER Sequence - * @extends KJUR.asn1.DERAbstractStructured - * @description - *
    - * As for argument 'params' for constructor, you can specify one of - * following properties: - *
      - *
    • array - specify array of ASN1Object to set elements of content
    • - *
    - * NOTE: 'params' can be omitted. - */ -KJUR.asn1.DERSequence = function(params) { - KJUR.asn1.DERSequence.superclass.constructor.call(this, params); - this.hT = "30"; - this.getFreshValueHex = function() { - var h = ''; - for (var i = 0; i < this.asn1Array.length; i++) { - var asn1Obj = this.asn1Array[i]; - h += asn1Obj.getEncodedHex(); - } - this.hV = h; - return this.hV; - }; -}; -JSX.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); - -// ******************************************************************** -/** - * class for ASN.1 DER Set - * @name KJUR.asn1.DERSet - * @class class for ASN.1 DER Set - * @extends KJUR.asn1.DERAbstractStructured - * @description - *
    - * As for argument 'params' for constructor, you can specify one of - * following properties: - *
      - *
    • array - specify array of ASN1Object to set elements of content
    • - *
    - * NOTE: 'params' can be omitted. - */ -KJUR.asn1.DERSet = function(params) { - KJUR.asn1.DERSet.superclass.constructor.call(this, params); - this.hT = "31"; - this.getFreshValueHex = function() { - var a = new Array(); - for (var i = 0; i < this.asn1Array.length; i++) { - var asn1Obj = this.asn1Array[i]; - a.push(asn1Obj.getEncodedHex()); - } - a.sort(); - this.hV = a.join(''); - return this.hV; - }; -}; -JSX.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); - -// ******************************************************************** -/** - * class for ASN.1 DER TaggedObject - * @name KJUR.asn1.DERTaggedObject - * @class class for ASN.1 DER TaggedObject - * @extends KJUR.asn1.ASN1Object - * @description - *
    - * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object. - * For example, if you find '[1]' tag in a ASN.1 dump, - * 'tagNoHex' will be 'a1'. - *
    - * As for optional argument 'params' for constructor, you can specify *ANY* of - * following properties: - *
      - *
    • explicit - specify true if this is explicit tag otherwise false - * (default is 'true').
    • - *
    • tag - specify tag (default is 'a0' which means [0])
    • - *
    • obj - specify ASN1Object which is tagged
    • - *
    - * @example - * d1 = new KJUR.asn1.DERUTF8String({'str':'a'}); - * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1}); - * hex = d2.getEncodedHex(); - */ -KJUR.asn1.DERTaggedObject = function(params) { - KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); - this.hT = "a0"; - this.hV = ''; - this.isExplicit = true; - this.asn1Object = null; - /** - * set value by an ASN1Object - * @name setString - * @memberOf KJUR.asn1.DERTaggedObject - * @function - * @param {Boolean} isExplicitFlag flag for explicit/implicit tag - * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag - * @param {ASN1Object} asn1Object ASN.1 to encapsulate + * class for ASN.1 DER GeneralizedTime + * @name KJUR.asn1.DERGeneralizedTime + * @class class for ASN.1 DER GeneralizedTime + * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'}) + * @extends KJUR.asn1.DERAbstractTime + * @description + *
    + * As for argument 'params' for constructor, you can specify one of + * following properties: + *
      + *
    • str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')
    • + *
    • hex - specify initial ASN.1 value(V) by a hexadecimal string
    • + *
    • date - specify Date object.
    • + *
    + * NOTE: 'params' can be omitted. */ - this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) { - this.hT = tagNoHex; - this.isExplicit = isExplicitFlag; - this.asn1Object = asn1Object; - if (this.isExplicit) { - this.hV = this.asn1Object.getEncodedHex(); - this.hTLV = null; - this.isModified = true; - } else { - this.hV = null; - this.hTLV = asn1Object.getEncodedHex(); - this.hTLV = this.hTLV.replace(/^../, tagNoHex); - this.isModified = false; - } - }; + KJUR.asn1.DERGeneralizedTime = function (params) { + KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params); + this.hT = "18"; - this.getFreshValueHex = function() { - return this.hV; - }; + /** + * set value by a Date object + * @name setByDate + * @memberOf KJUR.asn1.DERGeneralizedTime + * @function + * @param {Date} dateObject Date object to set ASN.1 value(V) + * @example + * When you specify UTC time, use 'Date.UTC' method like this:
    + * var o = new DERUTCTime(); + * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59 + * o.setByDate(date); + */ + this.setByDate = function (dateObject) { + this.hTLV = null; + this.isModified = true; + this.date = dateObject; + this.s = this.formatDate(this.date, 'gen'); + this.hV = stohex(this.s); + }; - if (typeof params != "undefined") { - if (typeof params['tag'] != "undefined") { - this.hT = params['tag']; - } - if (typeof params['explicit'] != "undefined") { - this.isExplicit = params['explicit']; - } - if (typeof params['obj'] != "undefined") { - this.asn1Object = params['obj']; - this.setASN1Object(this.isExplicit, this.hT, this.asn1Object); - } - } -}; -JSX.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); + if (typeof params != "undefined") { + if (typeof params['str'] != "undefined") { + this.setString(params['str']); + } else if (typeof params['hex'] != "undefined") { + this.setStringHex(params['hex']); + } else if (typeof params['date'] != "undefined") { + this.setByDate(params['date']); + } + } + }; + JSX.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); + +// ******************************************************************** + /** + * class for ASN.1 DER Sequence + * @name KJUR.asn1.DERSequence + * @class class for ASN.1 DER Sequence + * @extends KJUR.asn1.DERAbstractStructured + * @description + *
    + * As for argument 'params' for constructor, you can specify one of + * following properties: + *
      + *
    • array - specify array of ASN1Object to set elements of content
    • + *
    + * NOTE: 'params' can be omitted. + */ + KJUR.asn1.DERSequence = function (params) { + KJUR.asn1.DERSequence.superclass.constructor.call(this, params); + this.hT = "30"; + this.getFreshValueHex = function () { + var h = ''; + for (var i = 0; i < this.asn1Array.length; i++) { + var asn1Obj = this.asn1Array[i]; + h += asn1Obj.getEncodedHex(); + } + this.hV = h; + return this.hV; + }; + }; + JSX.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); + +// ******************************************************************** + /** + * class for ASN.1 DER Set + * @name KJUR.asn1.DERSet + * @class class for ASN.1 DER Set + * @extends KJUR.asn1.DERAbstractStructured + * @description + *
    + * As for argument 'params' for constructor, you can specify one of + * following properties: + *
      + *
    • array - specify array of ASN1Object to set elements of content
    • + *
    + * NOTE: 'params' can be omitted. + */ + KJUR.asn1.DERSet = function (params) { + KJUR.asn1.DERSet.superclass.constructor.call(this, params); + this.hT = "31"; + this.getFreshValueHex = function () { + var a = new Array(); + for (var i = 0; i < this.asn1Array.length; i++) { + var asn1Obj = this.asn1Array[i]; + a.push(asn1Obj.getEncodedHex()); + } + a.sort(); + this.hV = a.join(''); + return this.hV; + }; + }; + JSX.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); + +// ******************************************************************** + /** + * class for ASN.1 DER TaggedObject + * @name KJUR.asn1.DERTaggedObject + * @class class for ASN.1 DER TaggedObject + * @extends KJUR.asn1.ASN1Object + * @description + *
    + * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object. + * For example, if you find '[1]' tag in a ASN.1 dump, + * 'tagNoHex' will be 'a1'. + *
    + * As for optional argument 'params' for constructor, you can specify *ANY* of + * following properties: + *
      + *
    • explicit - specify true if this is explicit tag otherwise false + * (default is 'true').
    • + *
    • tag - specify tag (default is 'a0' which means [0])
    • + *
    • obj - specify ASN1Object which is tagged
    • + *
    + * @example + * d1 = new KJUR.asn1.DERUTF8String({'str':'a'}); + * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1}); + * hex = d2.getEncodedHex(); + */ + KJUR.asn1.DERTaggedObject = function (params) { + KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); + this.hT = "a0"; + this.hV = ''; + this.isExplicit = true; + this.asn1Object = null; + + /** + * set value by an ASN1Object + * @name setString + * @memberOf KJUR.asn1.DERTaggedObject + * @function + * @param {Boolean} isExplicitFlag flag for explicit/implicit tag + * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag + * @param {ASN1Object} asn1Object ASN.1 to encapsulate + */ + this.setASN1Object = function (isExplicitFlag, tagNoHex, asn1Object) { + this.hT = tagNoHex; + this.isExplicit = isExplicitFlag; + this.asn1Object = asn1Object; + if (this.isExplicit) { + this.hV = this.asn1Object.getEncodedHex(); + this.hTLV = null; + this.isModified = true; + } else { + this.hV = null; + this.hTLV = asn1Object.getEncodedHex(); + this.hTLV = this.hTLV.replace(/^../, tagNoHex); + this.isModified = false; + } + }; + + this.getFreshValueHex = function () { + return this.hV; + }; + + if (typeof params != "undefined") { + if (typeof params['tag'] != "undefined") { + this.hT = params['tag']; + } + if (typeof params['explicit'] != "undefined") { + this.isExplicit = params['explicit']; + } + if (typeof params['obj'] != "undefined") { + this.asn1Object = params['obj']; + this.setASN1Object(this.isExplicit, this.hT, this.asn1Object); + } + } + }; + JSX.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); // Hex JavaScript decoder // Copyright (c) 2008-2013 Lapo Luchini // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. -// +// // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR @@ -3166,63 +3414,63 @@ JSX.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ -(function (undefined) { -"use strict"; + /*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ + (function (undefined) { + "use strict"; -var Hex = {}, - decoder; + var Hex = {}, + decoder; -Hex.decode = function(a) { - var i; - if (decoder === undefined) { - var hex = "0123456789ABCDEF", - ignore = " \f\n\r\t\u00A0\u2028\u2029"; - decoder = []; - for (i = 0; i < 16; ++i) - decoder[hex.charAt(i)] = i; - hex = hex.toLowerCase(); - for (i = 10; i < 16; ++i) - decoder[hex.charAt(i)] = i; - for (i = 0; i < ignore.length; ++i) - decoder[ignore.charAt(i)] = -1; - } - var out = [], - bits = 0, - char_count = 0; - for (i = 0; i < a.length; ++i) { - var c = a.charAt(i); - if (c == '=') - break; - c = decoder[c]; - if (c == -1) - continue; - if (c === undefined) - throw 'Illegal character at offset ' + i; - bits |= c; - if (++char_count >= 2) { - out[out.length] = bits; - bits = 0; - char_count = 0; - } else { - bits <<= 4; - } - } - if (char_count) - throw "Hex encoding incomplete: 4 bits missing"; - return out; -}; + Hex.decode = function (a) { + var i; + if (decoder === undefined) { + var hex = "0123456789ABCDEF", + ignore = " \f\n\r\t\u00A0\u2028\u2029"; + decoder = []; + for (i = 0; i < 16; ++i) + decoder[hex.charAt(i)] = i; + hex = hex.toLowerCase(); + for (i = 10; i < 16; ++i) + decoder[hex.charAt(i)] = i; + for (i = 0; i < ignore.length; ++i) + decoder[ignore.charAt(i)] = -1; + } + var out = [], + bits = 0, + char_count = 0; + for (i = 0; i < a.length; ++i) { + var c = a.charAt(i); + if (c == '=') + break; + c = decoder[c]; + if (c == -1) + continue; + if (c === undefined) + throw 'Illegal character at offset ' + i; + bits |= c; + if (++char_count >= 2) { + out[out.length] = bits; + bits = 0; + char_count = 0; + } else { + bits <<= 4; + } + } + if (char_count) + throw "Hex encoding incomplete: 4 bits missing"; + return out; + }; // export globals -window.Hex = Hex; -})(); + window.Hex = Hex; + })(); // Base64 JavaScript decoder // Copyright (c) 2008-2013 Lapo Luchini // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. -// +// // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR @@ -3231,84 +3479,84 @@ window.Hex = Hex; // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ -(function (undefined) { -"use strict"; + /*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ + (function (undefined) { + "use strict"; -var Base64 = {}, - decoder; + var Base64 = {}, + decoder; -Base64.decode = function (a) { - var i; - if (decoder === undefined) { - var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", - ignore = "= \f\n\r\t\u00A0\u2028\u2029"; - decoder = []; - for (i = 0; i < 64; ++i) - decoder[b64.charAt(i)] = i; - for (i = 0; i < ignore.length; ++i) - decoder[ignore.charAt(i)] = -1; - } - var out = []; - var bits = 0, char_count = 0; - for (i = 0; i < a.length; ++i) { - var c = a.charAt(i); - if (c == '=') - break; - c = decoder[c]; - if (c == -1) - continue; - if (c === undefined) - throw 'Illegal character at offset ' + i; - bits |= c; - if (++char_count >= 4) { - out[out.length] = (bits >> 16); - out[out.length] = (bits >> 8) & 0xFF; - out[out.length] = bits & 0xFF; - bits = 0; - char_count = 0; - } else { - bits <<= 6; - } - } - switch (char_count) { - case 1: - throw "Base64 encoding incomplete: at least 2 bits missing"; - case 2: - out[out.length] = (bits >> 10); - break; - case 3: - out[out.length] = (bits >> 16); - out[out.length] = (bits >> 8) & 0xFF; - break; - } - return out; -}; + Base64.decode = function (a) { + var i; + if (decoder === undefined) { + var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", + ignore = "= \f\n\r\t\u00A0\u2028\u2029"; + decoder = []; + for (i = 0; i < 64; ++i) + decoder[b64.charAt(i)] = i; + for (i = 0; i < ignore.length; ++i) + decoder[ignore.charAt(i)] = -1; + } + var out = []; + var bits = 0, char_count = 0; + for (i = 0; i < a.length; ++i) { + var c = a.charAt(i); + if (c == '=') + break; + c = decoder[c]; + if (c == -1) + continue; + if (c === undefined) + throw 'Illegal character at offset ' + i; + bits |= c; + if (++char_count >= 4) { + out[out.length] = (bits >> 16); + out[out.length] = (bits >> 8) & 0xFF; + out[out.length] = bits & 0xFF; + bits = 0; + char_count = 0; + } else { + bits <<= 6; + } + } + switch (char_count) { + case 1: + throw "Base64 encoding incomplete: at least 2 bits missing"; + case 2: + out[out.length] = (bits >> 10); + break; + case 3: + out[out.length] = (bits >> 16); + out[out.length] = (bits >> 8) & 0xFF; + break; + } + return out; + }; -Base64.re = /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/; -Base64.unarmor = function (a) { - var m = Base64.re.exec(a); - if (m) { - if (m[1]) - a = m[1]; - else if (m[2]) - a = m[2]; - else - throw "RegExp out of sync"; - } - return Base64.decode(a); -}; + Base64.re = /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/; + Base64.unarmor = function (a) { + var m = Base64.re.exec(a); + if (m) { + if (m[1]) + a = m[1]; + else if (m[2]) + a = m[2]; + else + throw "RegExp out of sync"; + } + return Base64.decode(a); + }; // export globals -window.Base64 = Base64; -})(); + window.Base64 = Base64; + })(); // ASN.1 JavaScript decoder // Copyright (c) 2008-2013 Lapo Luchini // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission notice appear in all copies. -// +// // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR @@ -3317,633 +3565,675 @@ window.Base64 = Base64; // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ -/*global oids */ -(function (undefined) { -"use strict"; + /*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */ + /*global oids */ + (function (undefined) { + "use strict"; -var hardLimit = 100, - ellipsis = "\u2026", - DOM = { - tag: function (tagName, className) { - var t = document.createElement(tagName); - t.className = className; - return t; - }, - text: function (str) { - return document.createTextNode(str); - } - }; - -function Stream(enc, pos) { - if (enc instanceof Stream) { - this.enc = enc.enc; - this.pos = enc.pos; - } else { - this.enc = enc; - this.pos = pos; - } -} -Stream.prototype.get = function (pos) { - if (pos === undefined) - pos = this.pos++; - if (pos >= this.enc.length) - throw 'Requesting byte offset ' + pos + ' on a stream of length ' + this.enc.length; - return this.enc[pos]; -}; -Stream.prototype.hexDigits = "0123456789ABCDEF"; -Stream.prototype.hexByte = function (b) { - return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF); -}; -Stream.prototype.hexDump = function (start, end, raw) { - var s = ""; - for (var i = start; i < end; ++i) { - s += this.hexByte(this.get(i)); - if (raw !== true) - switch (i & 0xF) { - case 0x7: s += " "; break; - case 0xF: s += "\n"; break; - default: s += " "; - } - } - return s; -}; -Stream.prototype.parseStringISO = function (start, end) { - var s = ""; - for (var i = start; i < end; ++i) - s += String.fromCharCode(this.get(i)); - return s; -}; -Stream.prototype.parseStringUTF = function (start, end) { - var s = ""; - for (var i = start; i < end; ) { - var c = this.get(i++); - if (c < 128) - s += String.fromCharCode(c); - else if ((c > 191) && (c < 224)) - s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F)); - else - s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F)); - } - return s; -}; -Stream.prototype.parseStringBMP = function (start, end) { - var str = "" - for (var i = start; i < end; i += 2) { - var high_byte = this.get(i); - var low_byte = this.get(i + 1); - str += String.fromCharCode( (high_byte << 8) + low_byte ); - } - - return str; -}; -Stream.prototype.reTime = /^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/; -Stream.prototype.parseTime = function (start, end) { - var s = this.parseStringISO(start, end), - m = this.reTime.exec(s); - if (!m) - return "Unrecognized time: " + s; - s = m[1] + "-" + m[2] + "-" + m[3] + " " + m[4]; - if (m[5]) { - s += ":" + m[5]; - if (m[6]) { - s += ":" + m[6]; - if (m[7]) - s += "." + m[7]; - } - } - if (m[8]) { - s += " UTC"; - if (m[8] != 'Z') { - s += m[8]; - if (m[9]) - s += ":" + m[9]; - } - } - return s; -}; -Stream.prototype.parseInteger = function (start, end) { - //TODO support negative numbers - var len = end - start; - if (len > 4) { - len <<= 3; - var s = this.get(start); - if (s === 0) - len -= 8; - else - while (s < 128) { - s <<= 1; - --len; - } - return "(" + len + " bit)"; - } - var n = 0; - for (var i = start; i < end; ++i) - n = (n << 8) | this.get(i); - return n; -}; -Stream.prototype.parseBitString = function (start, end) { - var unusedBit = this.get(start), - lenBit = ((end - start - 1) << 3) - unusedBit, - s = "(" + lenBit + " bit)"; - if (lenBit <= 20) { - var skip = unusedBit; - s += " "; - for (var i = end - 1; i > start; --i) { - var b = this.get(i); - for (var j = skip; j < 8; ++j) - s += (b >> j) & 1 ? "1" : "0"; - skip = 0; - } - } - return s; -}; -Stream.prototype.parseOctetString = function (start, end) { - var len = end - start, - s = "(" + len + " byte) "; - if (len > hardLimit) - end = start + hardLimit; - for (var i = start; i < end; ++i) - s += this.hexByte(this.get(i)); //TODO: also try Latin1? - if (len > hardLimit) - s += ellipsis; - return s; -}; -Stream.prototype.parseOID = function (start, end) { - var s = '', - n = 0, - bits = 0; - for (var i = start; i < end; ++i) { - var v = this.get(i); - n = (n << 7) | (v & 0x7F); - bits += 7; - if (!(v & 0x80)) { // finished - if (s === '') { - var m = n < 80 ? n < 40 ? 0 : 1 : 2; - s = m + "." + (n - m * 40); - } else - s += "." + ((bits >= 31) ? "bigint" : n); - n = bits = 0; - } - } - return s; -}; - -function ASN1(stream, header, length, tag, sub) { - this.stream = stream; - this.header = header; - this.length = length; - this.tag = tag; - this.sub = sub; -} -ASN1.prototype.typeName = function () { - if (this.tag === undefined) - return "unknown"; - var tagClass = this.tag >> 6, - tagConstructed = (this.tag >> 5) & 1, - tagNumber = this.tag & 0x1F; - switch (tagClass) { - case 0: // universal - switch (tagNumber) { - case 0x00: return "EOC"; - case 0x01: return "BOOLEAN"; - case 0x02: return "INTEGER"; - case 0x03: return "BIT_STRING"; - case 0x04: return "OCTET_STRING"; - case 0x05: return "NULL"; - case 0x06: return "OBJECT_IDENTIFIER"; - case 0x07: return "ObjectDescriptor"; - case 0x08: return "EXTERNAL"; - case 0x09: return "REAL"; - case 0x0A: return "ENUMERATED"; - case 0x0B: return "EMBEDDED_PDV"; - case 0x0C: return "UTF8String"; - case 0x10: return "SEQUENCE"; - case 0x11: return "SET"; - case 0x12: return "NumericString"; - case 0x13: return "PrintableString"; // ASCII subset - case 0x14: return "TeletexString"; // aka T61String - case 0x15: return "VideotexString"; - case 0x16: return "IA5String"; // ASCII - case 0x17: return "UTCTime"; - case 0x18: return "GeneralizedTime"; - case 0x19: return "GraphicString"; - case 0x1A: return "VisibleString"; // ASCII subset - case 0x1B: return "GeneralString"; - case 0x1C: return "UniversalString"; - case 0x1E: return "BMPString"; - default: return "Universal_" + tagNumber.toString(16); - } - case 1: return "Application_" + tagNumber.toString(16); - case 2: return "[" + tagNumber + "]"; // Context - case 3: return "Private_" + tagNumber.toString(16); - } -}; -ASN1.prototype.reSeemsASCII = /^[ -~]+$/; -ASN1.prototype.content = function () { - if (this.tag === undefined) - return null; - var tagClass = this.tag >> 6, - tagNumber = this.tag & 0x1F, - content = this.posContent(), - len = Math.abs(this.length); - if (tagClass !== 0) { // universal - if (this.sub !== null) - return "(" + this.sub.length + " elem)"; - //TODO: TRY TO PARSE ASCII STRING - var s = this.stream.parseStringISO(content, content + Math.min(len, hardLimit)); - if (this.reSeemsASCII.test(s)) - return s.substring(0, 2 * hardLimit) + ((s.length > 2 * hardLimit) ? ellipsis : ""); - else - return this.stream.parseOctetString(content, content + len); - } - switch (tagNumber) { - case 0x01: // BOOLEAN - return (this.stream.get(content) === 0) ? "false" : "true"; - case 0x02: // INTEGER - return this.stream.parseInteger(content, content + len); - case 0x03: // BIT_STRING - return this.sub ? "(" + this.sub.length + " elem)" : - this.stream.parseBitString(content, content + len); - case 0x04: // OCTET_STRING - return this.sub ? "(" + this.sub.length + " elem)" : - this.stream.parseOctetString(content, content + len); - //case 0x05: // NULL - case 0x06: // OBJECT_IDENTIFIER - return this.stream.parseOID(content, content + len); - //case 0x07: // ObjectDescriptor - //case 0x08: // EXTERNAL - //case 0x09: // REAL - //case 0x0A: // ENUMERATED - //case 0x0B: // EMBEDDED_PDV - case 0x10: // SEQUENCE - case 0x11: // SET - return "(" + this.sub.length + " elem)"; - case 0x0C: // UTF8String - return this.stream.parseStringUTF(content, content + len); - case 0x12: // NumericString - case 0x13: // PrintableString - case 0x14: // TeletexString - case 0x15: // VideotexString - case 0x16: // IA5String - //case 0x19: // GraphicString - case 0x1A: // VisibleString - //case 0x1B: // GeneralString - //case 0x1C: // UniversalString - return this.stream.parseStringISO(content, content + len); - case 0x1E: // BMPString - return this.stream.parseStringBMP(content, content + len); - case 0x17: // UTCTime - case 0x18: // GeneralizedTime - return this.stream.parseTime(content, content + len); - } - return null; -}; -ASN1.prototype.toString = function () { - return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + ((this.sub === null) ? 'null' : this.sub.length) + "]"; -}; -ASN1.prototype.print = function (indent) { - if (indent === undefined) indent = ''; - document.writeln(indent + this); - if (this.sub !== null) { - indent += ' '; - for (var i = 0, max = this.sub.length; i < max; ++i) - this.sub[i].print(indent); - } -}; -ASN1.prototype.toPrettyString = function (indent) { - if (indent === undefined) indent = ''; - var s = indent + this.typeName() + " @" + this.stream.pos; - if (this.length >= 0) - s += "+"; - s += this.length; - if (this.tag & 0x20) - s += " (constructed)"; - else if (((this.tag == 0x03) || (this.tag == 0x04)) && (this.sub !== null)) - s += " (encapsulates)"; - s += "\n"; - if (this.sub !== null) { - indent += ' '; - for (var i = 0, max = this.sub.length; i < max; ++i) - s += this.sub[i].toPrettyString(indent); - } - return s; -}; -ASN1.prototype.toDOM = function () { - var node = DOM.tag("div", "node"); - node.asn1 = this; - var head = DOM.tag("div", "head"); - var s = this.typeName().replace(/_/g, " "); - head.innerHTML = s; - var content = this.content(); - if (content !== null) { - content = String(content).replace(/"; - s += "Length: " + this.header + "+"; - if (this.length >= 0) - s += this.length; - else - s += (-this.length) + " (undefined)"; - if (this.tag & 0x20) - s += "
    (constructed)"; - else if (((this.tag == 0x03) || (this.tag == 0x04)) && (this.sub !== null)) - s += "
    (encapsulates)"; - //TODO if (this.tag == 0x03) s += "Unused bits: " - if (content !== null) { - s += "
    Value:
    " + content + ""; - if ((typeof oids === 'object') && (this.tag == 0x06)) { - var oid = oids[content]; - if (oid) { - if (oid.d) s += "
    " + oid.d; - if (oid.c) s += "
    " + oid.c; - if (oid.w) s += "
    (warning!)"; - } - } - } - value.innerHTML = s; - node.appendChild(value); - var sub = DOM.tag("div", "sub"); - if (this.sub !== null) { - for (var i = 0, max = this.sub.length; i < max; ++i) - sub.appendChild(this.sub[i].toDOM()); - } - node.appendChild(sub); - head.onclick = function () { - node.className = (node.className == "node collapsed") ? "node" : "node collapsed"; - }; - return node; -}; -ASN1.prototype.posStart = function () { - return this.stream.pos; -}; -ASN1.prototype.posContent = function () { - return this.stream.pos + this.header; -}; -ASN1.prototype.posEnd = function () { - return this.stream.pos + this.header + Math.abs(this.length); -}; -ASN1.prototype.fakeHover = function (current) { - this.node.className += " hover"; - if (current) - this.head.className += " hover"; -}; -ASN1.prototype.fakeOut = function (current) { - var re = / ?hover/; - this.node.className = this.node.className.replace(re, ""); - if (current) - this.head.className = this.head.className.replace(re, ""); -}; -ASN1.prototype.toHexDOM_sub = function (node, className, stream, start, end) { - if (start >= end) - return; - var sub = DOM.tag("span", className); - sub.appendChild(DOM.text( - stream.hexDump(start, end))); - node.appendChild(sub); -}; -ASN1.prototype.toHexDOM = function (root) { - var node = DOM.tag("span", "hex"); - if (root === undefined) root = node; - this.head.hexNode = node; - this.head.onmouseover = function () { this.hexNode.className = "hexCurrent"; }; - this.head.onmouseout = function () { this.hexNode.className = "hex"; }; - node.asn1 = this; - node.onmouseover = function () { - var current = !root.selected; - if (current) { - root.selected = this.asn1; - this.className = "hexCurrent"; - } - this.asn1.fakeHover(current); - }; - node.onmouseout = function () { - var current = (root.selected == this.asn1); - this.asn1.fakeOut(current); - if (current) { - root.selected = null; - this.className = "hex"; - } - }; - this.toHexDOM_sub(node, "tag", this.stream, this.posStart(), this.posStart() + 1); - this.toHexDOM_sub(node, (this.length >= 0) ? "dlen" : "ulen", this.stream, this.posStart() + 1, this.posContent()); - if (this.sub === null) - node.appendChild(DOM.text( - this.stream.hexDump(this.posContent(), this.posEnd()))); - else if (this.sub.length > 0) { - var first = this.sub[0]; - var last = this.sub[this.sub.length - 1]; - this.toHexDOM_sub(node, "intro", this.stream, this.posContent(), first.posStart()); - for (var i = 0, max = this.sub.length; i < max; ++i) - node.appendChild(this.sub[i].toHexDOM(root)); - this.toHexDOM_sub(node, "outro", this.stream, last.posEnd(), this.posEnd()); - } - return node; -}; -ASN1.prototype.toHexString = function (root) { - return this.stream.hexDump(this.posStart(), this.posEnd(), true); -}; -ASN1.decodeLength = function (stream) { - var buf = stream.get(), - len = buf & 0x7F; - if (len == buf) - return len; - if (len > 3) - throw "Length over 24 bits not supported at position " + (stream.pos - 1); - if (len === 0) - return -1; // undefined - buf = 0; - for (var i = 0; i < len; ++i) - buf = (buf << 8) | stream.get(); - return buf; -}; -ASN1.hasContent = function (tag, len, stream) { - if (tag & 0x20) // constructed - return true; - if ((tag < 0x03) || (tag > 0x04)) - return false; - var p = new Stream(stream); - if (tag == 0x03) p.get(); // BitString unused bits, must be in [0, 7] - var subTag = p.get(); - if ((subTag >> 6) & 0x01) // not (universal or context) - return false; - try { - var subLength = ASN1.decodeLength(p); - return ((p.pos - stream.pos) + subLength == len); - } catch (exception) { - return false; - } -}; -ASN1.decode = function (stream) { - if (!(stream instanceof Stream)) - stream = new Stream(stream, 0); - var streamStart = new Stream(stream), - tag = stream.get(), - len = ASN1.decodeLength(stream), - header = stream.pos - streamStart.pos, - sub = null; - if (ASN1.hasContent(tag, len, stream)) { - // it has content, so we decode it - var start = stream.pos; - if (tag == 0x03) stream.get(); // skip BitString unused bits, must be in [0, 7] - sub = []; - if (len >= 0) { - // definite length - var end = start + len; - while (stream.pos < end) - sub[sub.length] = ASN1.decode(stream); - if (stream.pos != end) - throw "Content size is not correct for container starting at offset " + start; - } else { - // undefined length - try { - for (;;) { - var s = ASN1.decode(stream); - if (s.tag === 0) - break; - sub[sub.length] = s; + var hardLimit = 100, + ellipsis = "\u2026", + DOM = { + tag: function (tagName, className) { + var t = document.createElement(tagName); + t.className = className; + return t; + }, + text: function (str) { + return document.createTextNode(str); } - len = start - stream.pos; - } catch (e) { - throw "Exception while decoding undefined length content: " + e; + }; + + function Stream(enc, pos) { + if (enc instanceof Stream) { + this.enc = enc.enc; + this.pos = enc.pos; + } else { + this.enc = enc; + this.pos = pos; } } - } else - stream.pos += len; // skip content - return new ASN1(streamStart, header, len, tag, sub); -}; -ASN1.test = function () { - var test = [ - { value: [0x27], expected: 0x27 }, - { value: [0x81, 0xC9], expected: 0xC9 }, - { value: [0x83, 0xFE, 0xDC, 0xBA], expected: 0xFEDCBA } - ]; - for (var i = 0, max = test.length; i < max; ++i) { - var pos = 0, - stream = new Stream(test[i].value, 0), - res = ASN1.decodeLength(stream); - if (res != test[i].expected) - document.write("In test[" + i + "] expected " + test[i].expected + " got " + res + "\n"); - } -}; + + Stream.prototype.get = function (pos) { + if (pos === undefined) + pos = this.pos++; + if (pos >= this.enc.length) + throw 'Requesting byte offset ' + pos + ' on a stream of length ' + this.enc.length; + return this.enc[pos]; + }; + Stream.prototype.hexDigits = "0123456789ABCDEF"; + Stream.prototype.hexByte = function (b) { + return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF); + }; + Stream.prototype.hexDump = function (start, end, raw) { + var s = ""; + for (var i = start; i < end; ++i) { + s += this.hexByte(this.get(i)); + if (raw !== true) + switch (i & 0xF) { + case 0x7: + s += " "; + break; + case 0xF: + s += "\n"; + break; + default: + s += " "; + } + } + return s; + }; + Stream.prototype.parseStringISO = function (start, end) { + var s = ""; + for (var i = start; i < end; ++i) + s += String.fromCharCode(this.get(i)); + return s; + }; + Stream.prototype.parseStringUTF = function (start, end) { + var s = ""; + for (var i = start; i < end;) { + var c = this.get(i++); + if (c < 128) + s += String.fromCharCode(c); + else if ((c > 191) && (c < 224)) + s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F)); + else + s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F)); + } + return s; + }; + Stream.prototype.parseStringBMP = function (start, end) { + var str = "" + for (var i = start; i < end; i += 2) { + var high_byte = this.get(i); + var low_byte = this.get(i + 1); + str += String.fromCharCode((high_byte << 8) + low_byte); + } + + return str; + }; + Stream.prototype.reTime = /^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/; + Stream.prototype.parseTime = function (start, end) { + var s = this.parseStringISO(start, end), + m = this.reTime.exec(s); + if (!m) + return "Unrecognized time: " + s; + s = m[1] + "-" + m[2] + "-" + m[3] + " " + m[4]; + if (m[5]) { + s += ":" + m[5]; + if (m[6]) { + s += ":" + m[6]; + if (m[7]) + s += "." + m[7]; + } + } + if (m[8]) { + s += " UTC"; + if (m[8] != 'Z') { + s += m[8]; + if (m[9]) + s += ":" + m[9]; + } + } + return s; + }; + Stream.prototype.parseInteger = function (start, end) { + //TODO support negative numbers + var len = end - start; + if (len > 4) { + len <<= 3; + var s = this.get(start); + if (s === 0) + len -= 8; + else + while (s < 128) { + s <<= 1; + --len; + } + return "(" + len + " bit)"; + } + var n = 0; + for (var i = start; i < end; ++i) + n = (n << 8) | this.get(i); + return n; + }; + Stream.prototype.parseBitString = function (start, end) { + var unusedBit = this.get(start), + lenBit = ((end - start - 1) << 3) - unusedBit, + s = "(" + lenBit + " bit)"; + if (lenBit <= 20) { + var skip = unusedBit; + s += " "; + for (var i = end - 1; i > start; --i) { + var b = this.get(i); + for (var j = skip; j < 8; ++j) + s += (b >> j) & 1 ? "1" : "0"; + skip = 0; + } + } + return s; + }; + Stream.prototype.parseOctetString = function (start, end) { + var len = end - start, + s = "(" + len + " byte) "; + if (len > hardLimit) + end = start + hardLimit; + for (var i = start; i < end; ++i) + s += this.hexByte(this.get(i)); //TODO: also try Latin1? + if (len > hardLimit) + s += ellipsis; + return s; + }; + Stream.prototype.parseOID = function (start, end) { + var s = '', + n = 0, + bits = 0; + for (var i = start; i < end; ++i) { + var v = this.get(i); + n = (n << 7) | (v & 0x7F); + bits += 7; + if (!(v & 0x80)) { // finished + if (s === '') { + var m = n < 80 ? n < 40 ? 0 : 1 : 2; + s = m + "." + (n - m * 40); + } else + s += "." + ((bits >= 31) ? "bigint" : n); + n = bits = 0; + } + } + return s; + }; + + function ASN1(stream, header, length, tag, sub) { + this.stream = stream; + this.header = header; + this.length = length; + this.tag = tag; + this.sub = sub; + } + + ASN1.prototype.typeName = function () { + if (this.tag === undefined) + return "unknown"; + var tagClass = this.tag >> 6, + tagConstructed = (this.tag >> 5) & 1, + tagNumber = this.tag & 0x1F; + switch (tagClass) { + case 0: // universal + switch (tagNumber) { + case 0x00: + return "EOC"; + case 0x01: + return "BOOLEAN"; + case 0x02: + return "INTEGER"; + case 0x03: + return "BIT_STRING"; + case 0x04: + return "OCTET_STRING"; + case 0x05: + return "NULL"; + case 0x06: + return "OBJECT_IDENTIFIER"; + case 0x07: + return "ObjectDescriptor"; + case 0x08: + return "EXTERNAL"; + case 0x09: + return "REAL"; + case 0x0A: + return "ENUMERATED"; + case 0x0B: + return "EMBEDDED_PDV"; + case 0x0C: + return "UTF8String"; + case 0x10: + return "SEQUENCE"; + case 0x11: + return "SET"; + case 0x12: + return "NumericString"; + case 0x13: + return "PrintableString"; // ASCII subset + case 0x14: + return "TeletexString"; // aka T61String + case 0x15: + return "VideotexString"; + case 0x16: + return "IA5String"; // ASCII + case 0x17: + return "UTCTime"; + case 0x18: + return "GeneralizedTime"; + case 0x19: + return "GraphicString"; + case 0x1A: + return "VisibleString"; // ASCII subset + case 0x1B: + return "GeneralString"; + case 0x1C: + return "UniversalString"; + case 0x1E: + return "BMPString"; + default: + return "Universal_" + tagNumber.toString(16); + } + case 1: + return "Application_" + tagNumber.toString(16); + case 2: + return "[" + tagNumber + "]"; // Context + case 3: + return "Private_" + tagNumber.toString(16); + } + }; + ASN1.prototype.reSeemsASCII = /^[ -~]+$/; + ASN1.prototype.content = function () { + if (this.tag === undefined) + return null; + var tagClass = this.tag >> 6, + tagNumber = this.tag & 0x1F, + content = this.posContent(), + len = Math.abs(this.length); + if (tagClass !== 0) { // universal + if (this.sub !== null) + return "(" + this.sub.length + " elem)"; + //TODO: TRY TO PARSE ASCII STRING + var s = this.stream.parseStringISO(content, content + Math.min(len, hardLimit)); + if (this.reSeemsASCII.test(s)) + return s.substring(0, 2 * hardLimit) + ((s.length > 2 * hardLimit) ? ellipsis : ""); + else + return this.stream.parseOctetString(content, content + len); + } + switch (tagNumber) { + case 0x01: // BOOLEAN + return (this.stream.get(content) === 0) ? "false" : "true"; + case 0x02: // INTEGER + return this.stream.parseInteger(content, content + len); + case 0x03: // BIT_STRING + return this.sub ? "(" + this.sub.length + " elem)" : + this.stream.parseBitString(content, content + len); + case 0x04: // OCTET_STRING + return this.sub ? "(" + this.sub.length + " elem)" : + this.stream.parseOctetString(content, content + len); + //case 0x05: // NULL + case 0x06: // OBJECT_IDENTIFIER + return this.stream.parseOID(content, content + len); + //case 0x07: // ObjectDescriptor + //case 0x08: // EXTERNAL + //case 0x09: // REAL + //case 0x0A: // ENUMERATED + //case 0x0B: // EMBEDDED_PDV + case 0x10: // SEQUENCE + case 0x11: // SET + return "(" + this.sub.length + " elem)"; + case 0x0C: // UTF8String + return this.stream.parseStringUTF(content, content + len); + case 0x12: // NumericString + case 0x13: // PrintableString + case 0x14: // TeletexString + case 0x15: // VideotexString + case 0x16: // IA5String + //case 0x19: // GraphicString + case 0x1A: // VisibleString + //case 0x1B: // GeneralString + //case 0x1C: // UniversalString + return this.stream.parseStringISO(content, content + len); + case 0x1E: // BMPString + return this.stream.parseStringBMP(content, content + len); + case 0x17: // UTCTime + case 0x18: // GeneralizedTime + return this.stream.parseTime(content, content + len); + } + return null; + }; + ASN1.prototype.toString = function () { + return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + ((this.sub === null) ? 'null' : this.sub.length) + "]"; + }; + ASN1.prototype.print = function (indent) { + if (indent === undefined) indent = ''; + document.writeln(indent + this); + if (this.sub !== null) { + indent += ' '; + for (var i = 0, max = this.sub.length; i < max; ++i) + this.sub[i].print(indent); + } + }; + ASN1.prototype.toPrettyString = function (indent) { + if (indent === undefined) indent = ''; + var s = indent + this.typeName() + " @" + this.stream.pos; + if (this.length >= 0) + s += "+"; + s += this.length; + if (this.tag & 0x20) + s += " (constructed)"; + else if (((this.tag == 0x03) || (this.tag == 0x04)) && (this.sub !== null)) + s += " (encapsulates)"; + s += "\n"; + if (this.sub !== null) { + indent += ' '; + for (var i = 0, max = this.sub.length; i < max; ++i) + s += this.sub[i].toPrettyString(indent); + } + return s; + }; + ASN1.prototype.toDOM = function () { + var node = DOM.tag("div", "node"); + node.asn1 = this; + var head = DOM.tag("div", "head"); + var s = this.typeName().replace(/_/g, " "); + head.innerHTML = s; + var content = this.content(); + if (content !== null) { + content = String(content).replace(/"; + s += "Length: " + this.header + "+"; + if (this.length >= 0) + s += this.length; + else + s += (-this.length) + " (undefined)"; + if (this.tag & 0x20) + s += "
    (constructed)"; + else if (((this.tag == 0x03) || (this.tag == 0x04)) && (this.sub !== null)) + s += "
    (encapsulates)"; + //TODO if (this.tag == 0x03) s += "Unused bits: " + if (content !== null) { + s += "
    Value:
    " + content + ""; + if ((typeof oids === 'object') && (this.tag == 0x06)) { + var oid = oids[content]; + if (oid) { + if (oid.d) s += "
    " + oid.d; + if (oid.c) s += "
    " + oid.c; + if (oid.w) s += "
    (warning!)"; + } + } + } + value.innerHTML = s; + node.appendChild(value); + var sub = DOM.tag("div", "sub"); + if (this.sub !== null) { + for (var i = 0, max = this.sub.length; i < max; ++i) + sub.appendChild(this.sub[i].toDOM()); + } + node.appendChild(sub); + head.onclick = function () { + node.className = (node.className == "node collapsed") ? "node" : "node collapsed"; + }; + return node; + }; + ASN1.prototype.posStart = function () { + return this.stream.pos; + }; + ASN1.prototype.posContent = function () { + return this.stream.pos + this.header; + }; + ASN1.prototype.posEnd = function () { + return this.stream.pos + this.header + Math.abs(this.length); + }; + ASN1.prototype.fakeHover = function (current) { + this.node.className += " hover"; + if (current) + this.head.className += " hover"; + }; + ASN1.prototype.fakeOut = function (current) { + var re = / ?hover/; + this.node.className = this.node.className.replace(re, ""); + if (current) + this.head.className = this.head.className.replace(re, ""); + }; + ASN1.prototype.toHexDOM_sub = function (node, className, stream, start, end) { + if (start >= end) + return; + var sub = DOM.tag("span", className); + sub.appendChild(DOM.text( + stream.hexDump(start, end))); + node.appendChild(sub); + }; + ASN1.prototype.toHexDOM = function (root) { + var node = DOM.tag("span", "hex"); + if (root === undefined) root = node; + this.head.hexNode = node; + this.head.onmouseover = function () { + this.hexNode.className = "hexCurrent"; + }; + this.head.onmouseout = function () { + this.hexNode.className = "hex"; + }; + node.asn1 = this; + node.onmouseover = function () { + var current = !root.selected; + if (current) { + root.selected = this.asn1; + this.className = "hexCurrent"; + } + this.asn1.fakeHover(current); + }; + node.onmouseout = function () { + var current = (root.selected == this.asn1); + this.asn1.fakeOut(current); + if (current) { + root.selected = null; + this.className = "hex"; + } + }; + this.toHexDOM_sub(node, "tag", this.stream, this.posStart(), this.posStart() + 1); + this.toHexDOM_sub(node, (this.length >= 0) ? "dlen" : "ulen", this.stream, this.posStart() + 1, this.posContent()); + if (this.sub === null) + node.appendChild(DOM.text( + this.stream.hexDump(this.posContent(), this.posEnd()))); + else if (this.sub.length > 0) { + var first = this.sub[0]; + var last = this.sub[this.sub.length - 1]; + this.toHexDOM_sub(node, "intro", this.stream, this.posContent(), first.posStart()); + for (var i = 0, max = this.sub.length; i < max; ++i) + node.appendChild(this.sub[i].toHexDOM(root)); + this.toHexDOM_sub(node, "outro", this.stream, last.posEnd(), this.posEnd()); + } + return node; + }; + ASN1.prototype.toHexString = function (root) { + return this.stream.hexDump(this.posStart(), this.posEnd(), true); + }; + ASN1.decodeLength = function (stream) { + var buf = stream.get(), + len = buf & 0x7F; + if (len == buf) + return len; + if (len > 3) + throw "Length over 24 bits not supported at position " + (stream.pos - 1); + if (len === 0) + return -1; // undefined + buf = 0; + for (var i = 0; i < len; ++i) + buf = (buf << 8) | stream.get(); + return buf; + }; + ASN1.hasContent = function (tag, len, stream) { + if (tag & 0x20) // constructed + return true; + if ((tag < 0x03) || (tag > 0x04)) + return false; + var p = new Stream(stream); + if (tag == 0x03) p.get(); // BitString unused bits, must be in [0, 7] + var subTag = p.get(); + if ((subTag >> 6) & 0x01) // not (universal or context) + return false; + try { + var subLength = ASN1.decodeLength(p); + return ((p.pos - stream.pos) + subLength == len); + } catch (exception) { + return false; + } + }; + ASN1.decode = function (stream) { + if (!(stream instanceof Stream)) + stream = new Stream(stream, 0); + var streamStart = new Stream(stream), + tag = stream.get(), + len = ASN1.decodeLength(stream), + header = stream.pos - streamStart.pos, + sub = null; + if (ASN1.hasContent(tag, len, stream)) { + // it has content, so we decode it + var start = stream.pos; + if (tag == 0x03) stream.get(); // skip BitString unused bits, must be in [0, 7] + sub = []; + if (len >= 0) { + // definite length + var end = start + len; + while (stream.pos < end) + sub[sub.length] = ASN1.decode(stream); + if (stream.pos != end) + throw "Content size is not correct for container starting at offset " + start; + } else { + // undefined length + try { + for (; ;) { + var s = ASN1.decode(stream); + if (s.tag === 0) + break; + sub[sub.length] = s; + } + len = start - stream.pos; + } catch (e) { + throw "Exception while decoding undefined length content: " + e; + } + } + } else + stream.pos += len; // skip content + return new ASN1(streamStart, header, len, tag, sub); + }; + ASN1.test = function () { + var test = [ + {value: [0x27], expected: 0x27}, + {value: [0x81, 0xC9], expected: 0xC9}, + {value: [0x83, 0xFE, 0xDC, 0xBA], expected: 0xFEDCBA} + ]; + for (var i = 0, max = test.length; i < max; ++i) { + var pos = 0, + stream = new Stream(test[i].value, 0), + res = ASN1.decodeLength(stream); + if (res != test[i].expected) + document.write("In test[" + i + "] expected " + test[i].expected + " got " + res + "\n"); + } + }; // export globals -window.ASN1 = ASN1; -})(); -/** - * Retrieve the hexadecimal value (as a string) of the current ASN.1 element - * @returns {string} - * @public - */ -ASN1.prototype.getHexStringValue = function () { - var hexString = this.toHexString(); - var offset = this.header * 2; - var length = this.length * 2; - return hexString.substr(offset, length); -}; + window.ASN1 = ASN1; + })(); + /** + * Retrieve the hexadecimal value (as a string) of the current ASN.1 element + * @returns {string} + * @public + */ + ASN1.prototype.getHexStringValue = function () { + var hexString = this.toHexString(); + var offset = this.header * 2; + var length = this.length * 2; + return hexString.substr(offset, length); + }; -/** - * Method to parse a pem encoded string containing both a public or private key. - * The method will translate the pem encoded string in a der encoded string and - * will parse private key and public key parameters. This method accepts public key - * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1). - * - * @todo Check how many rsa formats use the same format of pkcs #1. - * - * The format is defined as: - * PublicKeyInfo ::= SEQUENCE { + /** + * Method to parse a pem encoded string containing both a public or private key. + * The method will translate the pem encoded string in a der encoded string and + * will parse private key and public key parameters. This method accepts public key + * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1). + * + * @todo Check how many rsa formats use the same format of pkcs #1. + * + * The format is defined as: + * PublicKeyInfo ::= SEQUENCE { * algorithm AlgorithmIdentifier, * PublicKey BIT STRING * } - * Where AlgorithmIdentifier is: - * AlgorithmIdentifier ::= SEQUENCE { + * Where AlgorithmIdentifier is: + * AlgorithmIdentifier ::= SEQUENCE { * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1) * } - * and PublicKey is a SEQUENCE encapsulated in a BIT STRING - * RSAPublicKey ::= SEQUENCE { + * and PublicKey is a SEQUENCE encapsulated in a BIT STRING + * RSAPublicKey ::= SEQUENCE { * modulus INTEGER, -- n * publicExponent INTEGER -- e * } - * it's possible to examine the structure of the keys obtained from openssl using - * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/ - * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer - * @private - */ -RSAKey.prototype.parseKey = function (pem) { - try { - var modulus = 0; - var public_exponent = 0; - var reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/; - var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem); - var asn1 = ASN1.decode(der); + * it's possible to examine the structure of the keys obtained from openssl using + * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/ + * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer + * @private + */ + RSAKey.prototype.parseKey = function (pem) { + try { + var modulus = 0; + var public_exponent = 0; + var reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/; + var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem); + var asn1 = ASN1.decode(der); - //Fixes a bug with OpenSSL 1.0+ private keys - if(asn1.sub.length === 3){ - asn1 = asn1.sub[2].sub[0]; - } - if (asn1.sub.length === 9) { + //Fixes a bug with OpenSSL 1.0+ private keys + if (asn1.sub.length === 3) { + asn1 = asn1.sub[2].sub[0]; + } + if (asn1.sub.length === 9) { - // Parse the private key. - modulus = asn1.sub[1].getHexStringValue(); //bigint - this.n = parseBigInt(modulus, 16); + // Parse the private key. + modulus = asn1.sub[1].getHexStringValue(); //bigint + this.n = parseBigInt(modulus, 16); - public_exponent = asn1.sub[2].getHexStringValue(); //int - this.e = parseInt(public_exponent, 16); + public_exponent = asn1.sub[2].getHexStringValue(); //int + this.e = parseInt(public_exponent, 16); - var private_exponent = asn1.sub[3].getHexStringValue(); //bigint - this.d = parseBigInt(private_exponent, 16); + var private_exponent = asn1.sub[3].getHexStringValue(); //bigint + this.d = parseBigInt(private_exponent, 16); - var prime1 = asn1.sub[4].getHexStringValue(); //bigint - this.p = parseBigInt(prime1, 16); + var prime1 = asn1.sub[4].getHexStringValue(); //bigint + this.p = parseBigInt(prime1, 16); - var prime2 = asn1.sub[5].getHexStringValue(); //bigint - this.q = parseBigInt(prime2, 16); + var prime2 = asn1.sub[5].getHexStringValue(); //bigint + this.q = parseBigInt(prime2, 16); - var exponent1 = asn1.sub[6].getHexStringValue(); //bigint - this.dmp1 = parseBigInt(exponent1, 16); + var exponent1 = asn1.sub[6].getHexStringValue(); //bigint + this.dmp1 = parseBigInt(exponent1, 16); - var exponent2 = asn1.sub[7].getHexStringValue(); //bigint - this.dmq1 = parseBigInt(exponent2, 16); + var exponent2 = asn1.sub[7].getHexStringValue(); //bigint + this.dmq1 = parseBigInt(exponent2, 16); - var coefficient = asn1.sub[8].getHexStringValue(); //bigint - this.coeff = parseBigInt(coefficient, 16); + var coefficient = asn1.sub[8].getHexStringValue(); //bigint + this.coeff = parseBigInt(coefficient, 16); - } - else if (asn1.sub.length === 2) { + } + else if (asn1.sub.length === 2) { - // Parse the public key. - var bit_string = asn1.sub[1]; - var sequence = bit_string.sub[0]; + // Parse the public key. + var bit_string = asn1.sub[1]; + var sequence = bit_string.sub[0]; - modulus = sequence.sub[0].getHexStringValue(); - this.n = parseBigInt(modulus, 16); - public_exponent = sequence.sub[1].getHexStringValue(); - this.e = parseInt(public_exponent, 16); + modulus = sequence.sub[0].getHexStringValue(); + this.n = parseBigInt(modulus, 16); + public_exponent = sequence.sub[1].getHexStringValue(); + this.e = parseInt(public_exponent, 16); - } - else { - return false; - } - return true; - } - catch (ex) { - return false; - } -}; + } + else { + return false; + } + return true; + } + catch (ex) { + return false; + } + }; -/** - * Translate rsa parameters in a hex encoded string representing the rsa key. - * - * The translation follow the ASN.1 notation : - * RSAPrivateKey ::= SEQUENCE { + /** + * Translate rsa parameters in a hex encoded string representing the rsa key. + * + * The translation follow the ASN.1 notation : + * RSAPrivateKey ::= SEQUENCE { * version Version, * modulus INTEGER, -- n * publicExponent INTEGER, -- e @@ -3954,399 +4244,399 @@ RSAKey.prototype.parseKey = function (pem) { * exponent2 INTEGER, -- d mod (q-1) * coefficient INTEGER, -- (inverse of q) mod p * } - * @returns {string} DER Encoded String representing the rsa private key - * @private - */ -RSAKey.prototype.getPrivateBaseKey = function () { - var options = { - 'array': [ - new KJUR.asn1.DERInteger({'int': 0}), - new KJUR.asn1.DERInteger({'bigint': this.n}), - new KJUR.asn1.DERInteger({'int': this.e}), - new KJUR.asn1.DERInteger({'bigint': this.d}), - new KJUR.asn1.DERInteger({'bigint': this.p}), - new KJUR.asn1.DERInteger({'bigint': this.q}), - new KJUR.asn1.DERInteger({'bigint': this.dmp1}), - new KJUR.asn1.DERInteger({'bigint': this.dmq1}), - new KJUR.asn1.DERInteger({'bigint': this.coeff}) - ] - }; - var seq = new KJUR.asn1.DERSequence(options); - return seq.getEncodedHex(); -}; + * @returns {string} DER Encoded String representing the rsa private key + * @private + */ + RSAKey.prototype.getPrivateBaseKey = function () { + var options = { + 'array': [ + new KJUR.asn1.DERInteger({'int': 0}), + new KJUR.asn1.DERInteger({'bigint': this.n}), + new KJUR.asn1.DERInteger({'int': this.e}), + new KJUR.asn1.DERInteger({'bigint': this.d}), + new KJUR.asn1.DERInteger({'bigint': this.p}), + new KJUR.asn1.DERInteger({'bigint': this.q}), + new KJUR.asn1.DERInteger({'bigint': this.dmp1}), + new KJUR.asn1.DERInteger({'bigint': this.dmq1}), + new KJUR.asn1.DERInteger({'bigint': this.coeff}) + ] + }; + var seq = new KJUR.asn1.DERSequence(options); + return seq.getEncodedHex(); + }; -/** - * base64 (pem) encoded version of the DER encoded representation - * @returns {string} pem encoded representation without header and footer - * @public - */ -RSAKey.prototype.getPrivateBaseKeyB64 = function () { - return hex2b64(this.getPrivateBaseKey()); -}; + /** + * base64 (pem) encoded version of the DER encoded representation + * @returns {string} pem encoded representation without header and footer + * @public + */ + RSAKey.prototype.getPrivateBaseKeyB64 = function () { + return hex2b64(this.getPrivateBaseKey()); + }; -/** - * Translate rsa parameters in a hex encoded string representing the rsa public key. - * The representation follow the ASN.1 notation : - * PublicKeyInfo ::= SEQUENCE { + /** + * Translate rsa parameters in a hex encoded string representing the rsa public key. + * The representation follow the ASN.1 notation : + * PublicKeyInfo ::= SEQUENCE { * algorithm AlgorithmIdentifier, * PublicKey BIT STRING * } - * Where AlgorithmIdentifier is: - * AlgorithmIdentifier ::= SEQUENCE { + * Where AlgorithmIdentifier is: + * AlgorithmIdentifier ::= SEQUENCE { * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1) * } - * and PublicKey is a SEQUENCE encapsulated in a BIT STRING - * RSAPublicKey ::= SEQUENCE { + * and PublicKey is a SEQUENCE encapsulated in a BIT STRING + * RSAPublicKey ::= SEQUENCE { * modulus INTEGER, -- n * publicExponent INTEGER -- e * } - * @returns {string} DER Encoded String representing the rsa public key - * @private - */ -RSAKey.prototype.getPublicBaseKey = function () { - var options = { - 'array': [ - new KJUR.asn1.DERObjectIdentifier({'oid': '1.2.840.113549.1.1.1'}), //RSA Encryption pkcs #1 oid - new KJUR.asn1.DERNull() - ] - }; - var first_sequence = new KJUR.asn1.DERSequence(options); + * @returns {string} DER Encoded String representing the rsa public key + * @private + */ + RSAKey.prototype.getPublicBaseKey = function () { + var options = { + 'array': [ + new KJUR.asn1.DERObjectIdentifier({'oid': '1.2.840.113549.1.1.1'}), //RSA Encryption pkcs #1 oid + new KJUR.asn1.DERNull() + ] + }; + var first_sequence = new KJUR.asn1.DERSequence(options); - options = { - 'array': [ - new KJUR.asn1.DERInteger({'bigint': this.n}), - new KJUR.asn1.DERInteger({'int': this.e}) - ] - }; - var second_sequence = new KJUR.asn1.DERSequence(options); + options = { + 'array': [ + new KJUR.asn1.DERInteger({'bigint': this.n}), + new KJUR.asn1.DERInteger({'int': this.e}) + ] + }; + var second_sequence = new KJUR.asn1.DERSequence(options); - options = { - 'hex': '00' + second_sequence.getEncodedHex() - }; - var bit_string = new KJUR.asn1.DERBitString(options); + options = { + 'hex': '00' + second_sequence.getEncodedHex() + }; + var bit_string = new KJUR.asn1.DERBitString(options); - options = { - 'array': [ - first_sequence, - bit_string - ] - }; - var seq = new KJUR.asn1.DERSequence(options); - return seq.getEncodedHex(); -}; + options = { + 'array': [ + first_sequence, + bit_string + ] + }; + var seq = new KJUR.asn1.DERSequence(options); + return seq.getEncodedHex(); + }; -/** - * base64 (pem) encoded version of the DER encoded representation - * @returns {string} pem encoded representation without header and footer - * @public - */ -RSAKey.prototype.getPublicBaseKeyB64 = function () { - return hex2b64(this.getPublicBaseKey()); -}; + /** + * base64 (pem) encoded version of the DER encoded representation + * @returns {string} pem encoded representation without header and footer + * @public + */ + RSAKey.prototype.getPublicBaseKeyB64 = function () { + return hex2b64(this.getPublicBaseKey()); + }; -/** - * wrap the string in block of width chars. The default value for rsa keys is 64 - * characters. - * @param {string} str the pem encoded string without header and footer - * @param {Number} [width=64] - the length the string has to be wrapped at - * @returns {string} - * @private - */ -RSAKey.prototype.wordwrap = function (str, width) { - width = width || 64; - if (!str) { - return str; - } - var regex = '(.{1,' + width + '})( +|$\n?)|(.{1,' + width + '})'; - return str.match(RegExp(regex, 'g')).join('\n'); -}; + /** + * wrap the string in block of width chars. The default value for rsa keys is 64 + * characters. + * @param {string} str the pem encoded string without header and footer + * @param {Number} [width=64] - the length the string has to be wrapped at + * @returns {string} + * @private + */ + RSAKey.prototype.wordwrap = function (str, width) { + width = width || 64; + if (!str) { + return str; + } + var regex = '(.{1,' + width + '})( +|$\n?)|(.{1,' + width + '})'; + return str.match(RegExp(regex, 'g')).join('\n'); + }; -/** - * Retrieve the pem encoded private key - * @returns {string} the pem encoded private key with header/footer - * @public - */ -RSAKey.prototype.getPrivateKey = function () { - var key = "-----BEGIN RSA PRIVATE KEY-----\n"; - key += this.wordwrap(this.getPrivateBaseKeyB64()) + "\n"; - key += "-----END RSA PRIVATE KEY-----"; - return key; -}; + /** + * Retrieve the pem encoded private key + * @returns {string} the pem encoded private key with header/footer + * @public + */ + RSAKey.prototype.getPrivateKey = function () { + var key = "-----BEGIN RSA PRIVATE KEY-----\n"; + key += this.wordwrap(this.getPrivateBaseKeyB64()) + "\n"; + key += "-----END RSA PRIVATE KEY-----"; + return key; + }; -/** - * Retrieve the pem encoded public key - * @returns {string} the pem encoded public key with header/footer - * @public - */ -RSAKey.prototype.getPublicKey = function () { - var key = "-----BEGIN PUBLIC KEY-----\n"; - key += this.wordwrap(this.getPublicBaseKeyB64()) + "\n"; - key += "-----END PUBLIC KEY-----"; - return key; -}; + /** + * Retrieve the pem encoded public key + * @returns {string} the pem encoded public key with header/footer + * @public + */ + RSAKey.prototype.getPublicKey = function () { + var key = "-----BEGIN PUBLIC KEY-----\n"; + key += this.wordwrap(this.getPublicBaseKeyB64()) + "\n"; + key += "-----END PUBLIC KEY-----"; + return key; + }; -/** - * Check if the object contains the necessary parameters to populate the rsa modulus - * and public exponent parameters. - * @param {Object} [obj={}] - An object that may contain the two public key - * parameters - * @returns {boolean} true if the object contains both the modulus and the public exponent - * properties (n and e) - * @todo check for types of n and e. N should be a parseable bigInt object, E should - * be a parseable integer number - * @private - */ -RSAKey.prototype.hasPublicKeyProperty = function (obj) { - obj = obj || {}; - return ( - obj.hasOwnProperty('n') && - obj.hasOwnProperty('e') - ); -}; + /** + * Check if the object contains the necessary parameters to populate the rsa modulus + * and public exponent parameters. + * @param {Object} [obj={}] - An object that may contain the two public key + * parameters + * @returns {boolean} true if the object contains both the modulus and the public exponent + * properties (n and e) + * @todo check for types of n and e. N should be a parseable bigInt object, E should + * be a parseable integer number + * @private + */ + RSAKey.prototype.hasPublicKeyProperty = function (obj) { + obj = obj || {}; + return ( + obj.hasOwnProperty('n') && + obj.hasOwnProperty('e') + ); + }; -/** - * Check if the object contains ALL the parameters of an RSA key. - * @param {Object} [obj={}] - An object that may contain nine rsa key - * parameters - * @returns {boolean} true if the object contains all the parameters needed - * @todo check for types of the parameters all the parameters but the public exponent - * should be parseable bigint objects, the public exponent should be a parseable integer number - * @private - */ -RSAKey.prototype.hasPrivateKeyProperty = function (obj) { - obj = obj || {}; - return ( - obj.hasOwnProperty('n') && - obj.hasOwnProperty('e') && - obj.hasOwnProperty('d') && - obj.hasOwnProperty('p') && - obj.hasOwnProperty('q') && - obj.hasOwnProperty('dmp1') && - obj.hasOwnProperty('dmq1') && - obj.hasOwnProperty('coeff') - ); -}; + /** + * Check if the object contains ALL the parameters of an RSA key. + * @param {Object} [obj={}] - An object that may contain nine rsa key + * parameters + * @returns {boolean} true if the object contains all the parameters needed + * @todo check for types of the parameters all the parameters but the public exponent + * should be parseable bigint objects, the public exponent should be a parseable integer number + * @private + */ + RSAKey.prototype.hasPrivateKeyProperty = function (obj) { + obj = obj || {}; + return ( + obj.hasOwnProperty('n') && + obj.hasOwnProperty('e') && + obj.hasOwnProperty('d') && + obj.hasOwnProperty('p') && + obj.hasOwnProperty('q') && + obj.hasOwnProperty('dmp1') && + obj.hasOwnProperty('dmq1') && + obj.hasOwnProperty('coeff') + ); + }; -/** - * Parse the properties of obj in the current rsa object. Obj should AT LEAST - * include the modulus and public exponent (n, e) parameters. - * @param {Object} obj - the object containing rsa parameters - * @private - */ -RSAKey.prototype.parsePropertiesFrom = function (obj) { - this.n = obj.n; - this.e = obj.e; + /** + * Parse the properties of obj in the current rsa object. Obj should AT LEAST + * include the modulus and public exponent (n, e) parameters. + * @param {Object} obj - the object containing rsa parameters + * @private + */ + RSAKey.prototype.parsePropertiesFrom = function (obj) { + this.n = obj.n; + this.e = obj.e; - if (obj.hasOwnProperty('d')) { - this.d = obj.d; - this.p = obj.p; - this.q = obj.q; - this.dmp1 = obj.dmp1; - this.dmq1 = obj.dmq1; - this.coeff = obj.coeff; - } -}; + if (obj.hasOwnProperty('d')) { + this.d = obj.d; + this.p = obj.p; + this.q = obj.q; + this.dmp1 = obj.dmp1; + this.dmq1 = obj.dmq1; + this.coeff = obj.coeff; + } + }; -/** - * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object. - * This object is just a decorator for parsing the key parameter - * @param {string|Object} key - The key in string format, or an object containing - * the parameters needed to build a RSAKey object. - * @constructor - */ -var JSEncryptRSAKey = function (key) { - // Call the super constructor. - RSAKey.call(this); - // If a key key was provided. - if (key) { - // If this is a string... - if (typeof key === 'string') { - this.parseKey(key); - } - else if ( - this.hasPrivateKeyProperty(key) || - this.hasPublicKeyProperty(key) - ) { - // Set the values for the key. - this.parsePropertiesFrom(key); - } - } -}; + /** + * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object. + * This object is just a decorator for parsing the key parameter + * @param {string|Object} key - The key in string format, or an object containing + * the parameters needed to build a RSAKey object. + * @constructor + */ + var JSEncryptRSAKey = function (key) { + // Call the super constructor. + RSAKey.call(this); + // If a key key was provided. + if (key) { + // If this is a string... + if (typeof key === 'string') { + this.parseKey(key); + } + else if ( + this.hasPrivateKeyProperty(key) || + this.hasPublicKeyProperty(key) + ) { + // Set the values for the key. + this.parsePropertiesFrom(key); + } + } + }; // Derive from RSAKey. -JSEncryptRSAKey.prototype = new RSAKey(); + JSEncryptRSAKey.prototype = new RSAKey(); // Reset the contructor. -JSEncryptRSAKey.prototype.constructor = JSEncryptRSAKey; + JSEncryptRSAKey.prototype.constructor = JSEncryptRSAKey; -/** - * - * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour - * possible parameters are: - * - default_key_size {number} default: 1024 the key size in bit - * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent - * - log {boolean} default: false whether log warn/error or not - * @constructor - */ -var JSEncrypt = function (options) { - options = options || {}; - this.default_key_size = parseInt(options.default_key_size) || 1024; - this.default_public_exponent = options.default_public_exponent || '010001'; //65537 default openssl public exponent for rsa key type - this.log = options.log || false; - // The private and public key. - this.key = null; -}; + /** + * + * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour + * possible parameters are: + * - default_key_size {number} default: 1024 the key size in bit + * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent + * - log {boolean} default: false whether log warn/error or not + * @constructor + */ + var JSEncrypt = function (options) { + options = options || {}; + this.default_key_size = parseInt(options.default_key_size) || 1024; + this.default_public_exponent = options.default_public_exponent || '010001'; //65537 default openssl public exponent for rsa key type + this.log = options.log || false; + // The private and public key. + this.key = null; + }; -/** - * Method to set the rsa key parameter (one method is enough to set both the public - * and the private key, since the private key contains the public key paramenters) - * Log a warning if logs are enabled - * @param {Object|string} key the pem encoded string or an object (with or without header/footer) - * @public - */ -JSEncrypt.prototype.setKey = function (key) { - if (this.log && this.key) { - console.warn('A key was already set, overriding existing.'); - } - this.key = new JSEncryptRSAKey(key); -}; + /** + * Method to set the rsa key parameter (one method is enough to set both the public + * and the private key, since the private key contains the public key paramenters) + * Log a warning if logs are enabled + * @param {Object|string} key the pem encoded string or an object (with or without header/footer) + * @public + */ + JSEncrypt.prototype.setKey = function (key) { + if (this.log && this.key) { + console.warn('A key was already set, overriding existing.'); + } + this.key = new JSEncryptRSAKey(key); + }; -/** - * Proxy method for setKey, for api compatibility - * @see setKey - * @public - */ -JSEncrypt.prototype.setPrivateKey = function (privkey) { - // Create the key. - this.setKey(privkey); -}; + /** + * Proxy method for setKey, for api compatibility + * @see setKey + * @public + */ + JSEncrypt.prototype.setPrivateKey = function (privkey) { + // Create the key. + this.setKey(privkey); + }; -/** - * Proxy method for setKey, for api compatibility - * @see setKey - * @public - */ -JSEncrypt.prototype.setPublicKey = function (pubkey) { - // Sets the public key. - this.setKey(pubkey); -}; + /** + * Proxy method for setKey, for api compatibility + * @see setKey + * @public + */ + JSEncrypt.prototype.setPublicKey = function (pubkey) { + // Sets the public key. + this.setKey(pubkey); + }; -/** - * Proxy method for RSAKey object's decrypt, decrypt the string using the private - * components of the rsa key object. Note that if the object was not set will be created - * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor - * @param {string} string base64 encoded crypted string to decrypt - * @return {string} the decrypted string - * @public - */ -JSEncrypt.prototype.decrypt = function (string) { - // Return the decrypted string. - try { - return this.getKey().decrypt(b64tohex(string)); - } - catch (ex) { - return false; - } -}; + /** + * Proxy method for RSAKey object's decrypt, decrypt the string using the private + * components of the rsa key object. Note that if the object was not set will be created + * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor + * @param {string} string base64 encoded crypted string to decrypt + * @return {string} the decrypted string + * @public + */ + JSEncrypt.prototype.decrypt = function (string) { + // Return the decrypted string. + try { + return this.getKey().decrypt(b64tohex(string)); + } + catch (ex) { + return false; + } + }; -/** - * Proxy method for RSAKey object's encrypt, encrypt the string using the public - * components of the rsa key object. Note that if the object was not set will be created - * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor - * @param {string} string the string to encrypt - * @return {string} the encrypted string encoded in base64 - * @public - */ -JSEncrypt.prototype.encrypt = function (string) { - // Return the encrypted string. - try { - return hex2b64(this.getKey().encrypt(string)); - } - catch (ex) { - return false; - } -}; + /** + * Proxy method for RSAKey object's encrypt, encrypt the string using the public + * components of the rsa key object. Note that if the object was not set will be created + * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor + * @param {string} string the string to encrypt + * @return {string} the encrypted string encoded in base64 + * @public + */ + JSEncrypt.prototype.encrypt = function (string) { + // Return the encrypted string. + try { + return hex2b64(this.getKey().encrypt(string)); + } + catch (ex) { + return false; + } + }; -/** - * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object - * will be created and returned - * @param {callback} [cb] the callback to be called if we want the key to be generated - * in an async fashion - * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object - * @public - */ -JSEncrypt.prototype.getKey = function (cb) { - // Only create new if it does not exist. - if (!this.key) { - // Get a new private key. - this.key = new JSEncryptRSAKey(); - if (cb && {}.toString.call(cb) === '[object Function]') { - this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb); - return; - } - // Generate the key. - this.key.generate(this.default_key_size, this.default_public_exponent); - } - return this.key; -}; + /** + * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object + * will be created and returned + * @param {callback} [cb] the callback to be called if we want the key to be generated + * in an async fashion + * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object + * @public + */ + JSEncrypt.prototype.getKey = function (cb) { + // Only create new if it does not exist. + if (!this.key) { + // Get a new private key. + this.key = new JSEncryptRSAKey(); + if (cb && {}.toString.call(cb) === '[object Function]') { + this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb); + return; + } + // Generate the key. + this.key.generate(this.default_key_size, this.default_public_exponent); + } + return this.key; + }; -/** - * Returns the pem encoded representation of the private key - * If the key doesn't exists a new key will be created - * @returns {string} pem encoded representation of the private key WITH header and footer - * @public - */ -JSEncrypt.prototype.getPrivateKey = function () { - // Return the private representation of this key. - return this.getKey().getPrivateKey(); -}; + /** + * Returns the pem encoded representation of the private key + * If the key doesn't exists a new key will be created + * @returns {string} pem encoded representation of the private key WITH header and footer + * @public + */ + JSEncrypt.prototype.getPrivateKey = function () { + // Return the private representation of this key. + return this.getKey().getPrivateKey(); + }; -/** - * Returns the pem encoded representation of the private key - * If the key doesn't exists a new key will be created - * @returns {string} pem encoded representation of the private key WITHOUT header and footer - * @public - */ -JSEncrypt.prototype.getPrivateKeyB64 = function () { - // Return the private representation of this key. - return this.getKey().getPrivateBaseKeyB64(); -}; + /** + * Returns the pem encoded representation of the private key + * If the key doesn't exists a new key will be created + * @returns {string} pem encoded representation of the private key WITHOUT header and footer + * @public + */ + JSEncrypt.prototype.getPrivateKeyB64 = function () { + // Return the private representation of this key. + return this.getKey().getPrivateBaseKeyB64(); + }; -/** - * Returns the pem encoded representation of the public key - * If the key doesn't exists a new key will be created - * @returns {string} pem encoded representation of the public key WITH header and footer - * @public - */ -JSEncrypt.prototype.getPublicKey = function () { - // Return the private representation of this key. - return this.getKey().getPublicKey(); -}; + /** + * Returns the pem encoded representation of the public key + * If the key doesn't exists a new key will be created + * @returns {string} pem encoded representation of the public key WITH header and footer + * @public + */ + JSEncrypt.prototype.getPublicKey = function () { + // Return the private representation of this key. + return this.getKey().getPublicKey(); + }; -/** - * Returns the pem encoded representation of the public key - * If the key doesn't exists a new key will be created - * @returns {string} pem encoded representation of the public key WITHOUT header and footer - * @public - */ -JSEncrypt.prototype.getPublicKeyB64 = function () { - // Return the private representation of this key. - return this.getKey().getPublicBaseKeyB64(); -}; + /** + * Returns the pem encoded representation of the public key + * If the key doesn't exists a new key will be created + * @returns {string} pem encoded representation of the public key WITHOUT header and footer + * @public + */ + JSEncrypt.prototype.getPublicKeyB64 = function () { + // Return the private representation of this key. + return this.getKey().getPublicBaseKeyB64(); + }; -JSEncrypt.version = '2.3.0'; -exports.JSEncrypt = JSEncrypt; + JSEncrypt.version = '2.3.0'; + exports.JSEncrypt = JSEncrypt; })(JSEncryptExports); (function (global, factory) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = factory; - } else if (typeof define === 'function' && define.amd) { - define(factory); - } else { - global.JSEncrypt = factory; - } + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = factory; + } else if (typeof define === 'function' && define.amd) { + define(factory); + } else { + global.JSEncrypt = factory; + } }(this, JSEncryptExports.JSEncrypt)); \ No newline at end of file diff --git a/js/selectize.min.js b/js/selectize.min.js index 6f3851ec..a2fada1c 100644 --- a/js/selectize.min.js +++ b/js/selectize.min.js @@ -1,5 +1,5 @@ var $jscomp={scope:{},findInternal:function(c,h,d){c instanceof String&&(c=String(c));for(var p=c.length,l=0;l Date: Thu, 13 Apr 2017 14:33:01 +0200 Subject: [PATCH 05/22] * [FIX] Fixed "Invalid action" when an exception is thrown and the security token is not refreshed. Related #519 * [FIX] Fixed untranslated notice string when master key is changed. --- .../Controller/ItemShowController.class.php | 9 ++-- .../Controller/NoticeShowController.class.php | 2 + .../NoticesSearchController.class.php | 3 +- inc/SP/Controller/WikiController.class.php | 2 + inc/SP/Util/Util.class.php | 2 +- js/app-actions.js | 4 +- js/app-actions.min.js | 48 +++++++++---------- js/app-main.js | 3 ++ js/app-main.min.js | 44 ++++++++--------- js/app-requests.js | 6 ++- js/app-requests.min.js | 8 ++-- 11 files changed, 72 insertions(+), 59 deletions(-) diff --git a/inc/SP/Controller/ItemShowController.class.php b/inc/SP/Controller/ItemShowController.class.php index 6a83567f..3adc52f4 100644 --- a/inc/SP/Controller/ItemShowController.class.php +++ b/inc/SP/Controller/ItemShowController.class.php @@ -245,6 +245,8 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite $this->JsonResponse->setDescription($e->getMessage()); } + $this->JsonResponse->setCsrf($this->view->sk); + Json::returnJson($this->JsonResponse); } @@ -512,8 +514,10 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite if (!$Acl->isShowViewPass()) { throw new ItemException(__('No tiene permisos para acceder a esta cuenta', false)); - } elseif (!UserPass::checkUserUpdateMPass(Session::getUserData()->getUserId())) { - throw new ItemException(__('Clave maestra actualizada', false) . '
    ' . __('Reinicie la sesión para cambiarla', false)); + } + + if (!UserPass::checkUserUpdateMPass(Session::getUserData()->getUserId())) { + throw new ItemException(__('Clave maestra actualizada') . '
    ' . __('Reinicie la sesión para cambiarla')); } $key = CryptSession::getSessionKey(); @@ -558,7 +562,6 @@ class ItemShowController extends ControllerBase implements ActionsInterface, Ite 'useimage' => $useImage ]; - $this->JsonResponse->setCsrf($this->view->sk); $this->JsonResponse->setData($data); } diff --git a/inc/SP/Controller/NoticeShowController.class.php b/inc/SP/Controller/NoticeShowController.class.php index e05fd474..405d9eb1 100644 --- a/inc/SP/Controller/NoticeShowController.class.php +++ b/inc/SP/Controller/NoticeShowController.class.php @@ -109,6 +109,8 @@ class NoticeShowController extends ControllerBase implements ActionsInterface, I $this->JsonResponse->setDescription($e->getMessage()); } + $this->JsonResponse->setCsrf($this->view->sk); + Json::returnJson($this->JsonResponse); } diff --git a/inc/SP/Controller/NoticesSearchController.class.php b/inc/SP/Controller/NoticesSearchController.class.php index ffd44a97..f31f59d2 100644 --- a/inc/SP/Controller/NoticesSearchController.class.php +++ b/inc/SP/Controller/NoticesSearchController.class.php @@ -99,12 +99,13 @@ class NoticesSearchController extends GridItemsSearchController implements Actio $this->invalidAction(); } - $this->JsonResponse->setCsrf($this->view->sk); $this->JsonResponse->setData(['html' => $this->render()]); } catch (\Exception $e) { $this->JsonResponse->setDescription($e->getMessage()); } + $this->JsonResponse->setCsrf($this->view->sk); + Json::returnJson($this->JsonResponse); } diff --git a/inc/SP/Controller/WikiController.class.php b/inc/SP/Controller/WikiController.class.php index f175a75d..ed6335c3 100644 --- a/inc/SP/Controller/WikiController.class.php +++ b/inc/SP/Controller/WikiController.class.php @@ -85,6 +85,8 @@ class WikiController extends ControllerBase implements ActionsInterface $this->JsonResponse->setDescription($e->getMessage()); } + $this->JsonResponse->setCsrf($this->view->sk); + Json::returnJson($this->JsonResponse); } diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 606969c0..5e502983 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041301; + $build = 17041302; $version = [2, 1, 6]; if ($normalized === true) { diff --git a/js/app-actions.js b/js/app-actions.js index 5650a913..b58d49b4 100644 --- a/js/app-actions.js +++ b/js/app-actions.js @@ -288,7 +288,7 @@ sysPass.Actions = function (Common) { opts.data = { actionId: $obj.data("action-id"), itemId: $obj.data("item-id"), - sk: $obj.data("sk"), + sk: Common.sk.get(), isAjax: 1 }; @@ -1094,8 +1094,6 @@ sysPass.Actions = function (Common) { log.info("appMgmt:show"); if ($obj.data("item-dst") || $obj.data("activetab") === undefined) { - log.info($obj.data("activetab")); - appMgmt.refreshTab = false; } diff --git a/js/app-actions.min.js b/js/app-actions.min.js index 805a38de..f296805a 100644 --- a/js/app-actions.min.js +++ b/js/app-actions.min.js @@ -19,27 +19,27 @@ g({actionId:a.data("action-id"),itemId:a.data("item-id")},"account")},savefavori var b=c.appRequests().getRequestOpts();b.url=f.account.request;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a)})},menu:function(a){a.hide();a.parent().children(".actions-optional").show(250)},sort:function(a){d.info("account:sort");var c=$("#frmSearch");c.find('input[name="skey"]').val(a.data("key"));c.find('input[name="sorder"]').val(a.data("dir"));c.find('input[name="start"]').val(a.data("start"));m.search()},editpass:function(a){d.info("account:editpass");var c=a.data("parent-id"); g({actionId:a.data("action-id"),itemId:0==c?a.data("item-id"):c},"account")},restore:function(a){d.info("account:restore");m.save(a)},getfiles:function(a){d.info("account:getfiles");var b=c.appRequests().getRequestOpts();b.method="get";b.type="html";b.url=f.account.getFiles;b.data={id:a.data("item-id"),del:a.data("delete"),sk:c.sk.get()};c.appRequests().getActionCall(b,function(c){a.html(c)})},search:function(a){d.info("account:search");var b=$("#frmSearch");b.find("input[name='sk']").val(c.sk.get()); b.find("input[name='skey']").val();b.find("input[name='sorder']").val();void 0!==a&&b.find("input[name='start']").val(0);a=c.appRequests().getRequestOpts();a.url=f.account.search;a.method="get";a.data=b.serialize();c.appRequests().getActionCall(a,function(a){10===a.status&&c.msg.out(a);c.sk.set(a.sk);$("#res-content").empty().html(a.html)})},save:function(a){d.info("account:save");var b=c.appRequests().getRequestOpts();b.url=f.account.save;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a); -void 0!==a.data.itemId&&void 0!==a.data.nextActionId&&g({actionId:a.data.nextActionId,itemId:a.data.itemId},"account")})}},n={refreshTab:!0,show:function(a){d.info("appMgmt:show");if(a.data("item-dst")||void 0===a.data("activetab"))d.info(a.data("activetab")),n.refreshTab=!1;var b=c.appRequests().getRequestOpts();b.url=f.appMgmt.show;b.method="get";b.data={itemId:a.data("item-id"),actionId:a.data("action-id"),activeTab:a.data("activetab"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!== -b.status?c.msg.out(b):l(a,b.data.html)})},"delete":function(a){d.info("appMgmt:delete");var b='

    '+c.config().LANG[12]+"

    ",e=a.data("selection"),h=[];if(e&&($(e).find(".is-selected").each(function(a,c){var b=$(this);h.push(b.data("item-id"))}),0===h.length))return;mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault(); -b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data={itemId:e?h:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){c.msg.out(b);a.data("nextaction-id")&&g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})}}})},save:function(a){d.info("appMgmt:save");var b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data=a.serialize();c.appRequests().getActionCall(b,function(b){c.msg.out(b);0===b.status&&(b=a.data("activetab"), -!0===n.refreshTab&&void 0!==b&&g({actionId:a.data("nextaction-id"),itemId:b}),$.magnificPopup.close())})},search:function(a){d.info("appMgmt:search");var b=$(a.data("target")),e=c.appRequests().getRequestOpts();e.url=f.appMgmt.search;e.method="get";e.data=a.serialize();c.appRequests().getActionCall(e,function(a){0===a.status?b.html(a.data.html):b.html(c.msg.html.error(a.description));c.sk.set(a.csrf)})},nav:function(a){d.info("appMgmt:nav");var b=$("#"+a.data("action-form"));b.find("[name='start']").val(a.data("start")); -b.find("[name='count']").val(a.data("count"));b.find("[name='sk']").val(c.sk.get());n.search(b)},ldapSync:function(a){d.info("appMgmt:ldapSync");var b='

    '+c.config().LANG[57]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data={actionId:a.data("action-id"), -sk:c.sk.get(),isAjax:1,ldap_loginattribute:$("#ldap_loginattribute").val(),ldap_ads:$("#ldap_ads").prop("checked")};c.appRequests().getActionCall(b,function(a){c.msg.out(a)})}}})}};return{doAction:g,appMgmt:n,account:m,file:{view:function(a){d.info("file:view");var b=c.appRequests().getRequestOpts();b.url=f.file;b.type="html";b.data={fileId:a.data("item-id"),sk:c.sk.get(),actionId:a.data("action-id")};c.appRequests().getActionCall(b,function(b){void 0!==b.status&&1===b.status?c.msg.out(b):b?r(a,b): -c.msg.error(c.config().LANG[14])})},download:function(a){d.info("file:download");a={fileId:a.data("item-id"),sk:c.sk.get(),actionId:a.data("action-id")};$.fileDownload(c.config().APP_ROOT+f.file,{httpMethod:"POST",data:a})},"delete":function(a){d.info("file:delete");var b='

    '+c.config().LANG[15]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43], -onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.file;b.data={fileId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get()};c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&(a=$("#list-account-files"),m.getfiles(a))})}}})}},checks:{ldap:function(a){d.info("checks:ldap");a=$(a.data("src"));a.find("[name='sk']").val(c.sk.get());var b=c.appRequests().getRequestOpts();b.url=f.checks;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a); -var b=$("#ldap-results");b.find(".list-wrap").html(c.appTheme().html.getList(a.data));b.show("slow")})},wiki:function(a){d.info("checks:wiki");a=$(a.data("src"));a.find("[name='sk']").val(c.sk.get());var b=c.appRequests().getRequestOpts();b.url=f.checks;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&$("#dokuWikiResCheck").html(a.data)})}},config:{save:function(a){d.info("config:save");var b=c.appRequests().getRequestOpts();b.url=f.config.save;b.data=a.serialize(); -"masterpass"===a.data("type")&&(b.useFullLoading=!0);c.appRequests().getActionCall(b,function(b){c.msg.out(b);0===b.status&&(void 0!==a.data("nextaction-id")?g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")}):void 0!==a.data("reload")&&setTimeout(function(){c.redirect("index.php")},2E3))})},masterpass:function(a){var b='

    '+c.config().LANG[59]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(b){b.preventDefault(); -c.msg.error(c.config().LANG[44]);a.find(":input[type=password]").val("")}},positive:{title:c.config().LANG[43],onClick:function(b){b=a.find("input[name='useTask']");var e=$("#taskStatus");e.empty().html(c.config().LANG[62]);if(0
    ";mdlDialog().show({text:e,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.appRequests().getActionCall(b,function(a){c.msg.out(a)})}},positive:{title:c.config().LANG[43],onClick:function(e){e.preventDefault(); -b.data.notify=1;c.appRequests().getActionCall(b,function(b){c.msg.out(b);g({actionId:a.data("nextaction-id"),itemId:a.data("item-id")})})}}})},refresh:function(a){d.info("link:refresh");var b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")},e=c.appRequests().getRequestOpts();e.url=f.link;e.data=b;c.appRequests().getActionCall(e,function(b){c.msg.out(b);0===b.status&&g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})}},eventlog:{nav:function(a){if(void 0=== -a.data("start"))return!1;var b=c.appRequests().getRequestOpts();b.url=f.eventlog;b.method="get";b.type="html";b.data={actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1,start:a.data("start"),count:a.data("count"),current:a.data("current")};c.appRequests().getActionCall(b,function(a){$("#content").html(a);c.scrollUp()})},clear:function(a){var b='

    '+c.config().LANG[20]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault(); -c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault();b=c.appRequests().getRequestOpts();b.url=f.eventlog;b.method="get";b.data={clear:1,sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){c.msg.out(b);0==b.status&&g({actionId:a.data("nextaction-id")})})}}})}},ajaxUrl:f,plugin:{toggle:function(a){d.info("plugin:enable");a={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")};var b= -c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data=a;c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&setTimeout(function(){c.redirect("index.php")},2E3)})},reset:function(a){d.info("plugin:reset");var b='

    '+c.config().LANG[58]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault(); -b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")};var e=c.appRequests().getRequestOpts();e.url=f.appMgmt.save;e.data=b;c.appRequests().getActionCall(e,function(a){c.msg.out(a)})}}})}},notice:{check:function(a){d.info("notice:check");var b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get()},e=c.appRequests().getRequestOpts();e.url=f.appMgmt.save;e.data=b;c.appRequests().getActionCall(e,function(b){c.msg.out(b);0===b.status&&g({actionId:a.data("nextaction-id"), -itemId:a.data("activetab")})})},search:function(a){d.info("notice:search");var b=$(a.data("target")),e=c.appRequests().getRequestOpts();e.url=f.notice.search;e.method="get";e.data=a.serialize();c.appRequests().getActionCall(e,function(a){0===a.status?b.html(a.data.html):b.html(c.msg.html.error(a.description));c.sk.set(a.csrf)})},show:function(a){d.info("notice:show");var b=c.appRequests().getRequestOpts();b.url=f.notice.show;b.method="get";b.data={itemId:a.data("item-id"),actionId:a.data("action-id"), -activeTab:a.data("activetab"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!==b.status?c.msg.out(b):l(a,b.data.html)})}},wiki:{show:function(a){d.info("wiki:show");var b=c.appRequests().getRequestOpts();b.url=f.wiki.show;b.method="get";b.data={pageName:a.data("pagename"),actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!==b.status?c.msg.out(b):l(a,b.data.html)})}},items:p}}; +void 0!==a.data.itemId&&void 0!==a.data.nextActionId&&g({actionId:a.data.nextActionId,itemId:a.data.itemId},"account")})}},n={refreshTab:!0,show:function(a){d.info("appMgmt:show");if(a.data("item-dst")||void 0===a.data("activetab"))n.refreshTab=!1;var b=c.appRequests().getRequestOpts();b.url=f.appMgmt.show;b.method="get";b.data={itemId:a.data("item-id"),actionId:a.data("action-id"),activeTab:a.data("activetab"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!==b.status?c.msg.out(b): +l(a,b.data.html)})},"delete":function(a){d.info("appMgmt:delete");var b='

    '+c.config().LANG[12]+"

    ",e=a.data("selection"),h=[];if(e&&($(e).find(".is-selected").each(function(a,c){var b=$(this);h.push(b.data("item-id"))}),0===h.length))return;mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault();b=c.appRequests().getRequestOpts(); +b.url=f.appMgmt.save;b.data={itemId:e?h:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){c.msg.out(b);a.data("nextaction-id")&&g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})}}})},save:function(a){d.info("appMgmt:save");var b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data=a.serialize();c.appRequests().getActionCall(b,function(b){c.msg.out(b);0===b.status&&(b=a.data("activetab"),!0===n.refreshTab&&void 0!== +b&&g({actionId:a.data("nextaction-id"),itemId:b}),$.magnificPopup.close())})},search:function(a){d.info("appMgmt:search");var b=$(a.data("target")),e=c.appRequests().getRequestOpts();e.url=f.appMgmt.search;e.method="get";e.data=a.serialize();c.appRequests().getActionCall(e,function(a){0===a.status?b.html(a.data.html):b.html(c.msg.html.error(a.description));c.sk.set(a.csrf)})},nav:function(a){d.info("appMgmt:nav");var b=$("#"+a.data("action-form"));b.find("[name='start']").val(a.data("start"));b.find("[name='count']").val(a.data("count")); +b.find("[name='sk']").val(c.sk.get());n.search(b)},ldapSync:function(a){d.info("appMgmt:ldapSync");var b='

    '+c.config().LANG[57]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data={actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1,ldap_loginattribute:$("#ldap_loginattribute").val(), +ldap_ads:$("#ldap_ads").prop("checked")};c.appRequests().getActionCall(b,function(a){c.msg.out(a)})}}})}};return{doAction:g,appMgmt:n,account:m,file:{view:function(a){d.info("file:view");var b=c.appRequests().getRequestOpts();b.url=f.file;b.type="html";b.data={fileId:a.data("item-id"),sk:c.sk.get(),actionId:a.data("action-id")};c.appRequests().getActionCall(b,function(b){void 0!==b.status&&1===b.status?c.msg.out(b):b?r(a,b):c.msg.error(c.config().LANG[14])})},download:function(a){d.info("file:download"); +a={fileId:a.data("item-id"),sk:c.sk.get(),actionId:a.data("action-id")};$.fileDownload(c.config().APP_ROOT+f.file,{httpMethod:"POST",data:a})},"delete":function(a){d.info("file:delete");var b='

    '+c.config().LANG[15]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b=c.appRequests().getRequestOpts();b.url=f.file; +b.data={fileId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get()};c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&(a=$("#list-account-files"),m.getfiles(a))})}}})}},checks:{ldap:function(a){d.info("checks:ldap");a=$(a.data("src"));a.find("[name='sk']").val(c.sk.get());var b=c.appRequests().getRequestOpts();b.url=f.checks;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a);var b=$("#ldap-results");b.find(".list-wrap").html(c.appTheme().html.getList(a.data)); +b.show("slow")})},wiki:function(a){d.info("checks:wiki");a=$(a.data("src"));a.find("[name='sk']").val(c.sk.get());var b=c.appRequests().getRequestOpts();b.url=f.checks;b.data=a.serialize();c.appRequests().getActionCall(b,function(a){c.msg.out(a);0===a.status&&$("#dokuWikiResCheck").html(a.data)})}},config:{save:function(a){d.info("config:save");var b=c.appRequests().getRequestOpts();b.url=f.config.save;b.data=a.serialize();"masterpass"===a.data("type")&&(b.useFullLoading=!0);c.appRequests().getActionCall(b, +function(b){c.msg.out(b);0===b.status&&(void 0!==a.data("nextaction-id")?g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")}):void 0!==a.data("reload")&&setTimeout(function(){c.redirect("index.php")},2E3))})},masterpass:function(a){var b='

    '+c.config().LANG[59]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(b){b.preventDefault();c.msg.error(c.config().LANG[44]);a.find(":input[type=password]").val("")}},positive:{title:c.config().LANG[43], +onClick:function(b){b=a.find("input[name='useTask']");var e=$("#taskStatus");e.empty().html(c.config().LANG[62]);if(0";mdlDialog().show({text:e,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.appRequests().getActionCall(b,function(a){c.msg.out(a)})}},positive:{title:c.config().LANG[43],onClick:function(e){e.preventDefault();b.data.notify=1;c.appRequests().getActionCall(b,function(b){c.msg.out(b);g({actionId:a.data("nextaction-id"), +itemId:a.data("item-id")})})}}})},refresh:function(a){d.info("link:refresh");var b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")},e=c.appRequests().getRequestOpts();e.url=f.link;e.data=b;c.appRequests().getActionCall(e,function(b){c.msg.out(b);0===b.status&&g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})}},eventlog:{nav:function(a){if(void 0===a.data("start"))return!1;var b=c.appRequests().getRequestOpts();b.url=f.eventlog;b.method= +"get";b.type="html";b.data={actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1,start:a.data("start"),count:a.data("count"),current:a.data("current")};c.appRequests().getActionCall(b,function(a){$("#content").html(a);c.scrollUp()})},clear:function(a){var b='

    '+c.config().LANG[20]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault(); +b=c.appRequests().getRequestOpts();b.url=f.eventlog;b.method="get";b.data={clear:1,sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){c.msg.out(b);0==b.status&&g({actionId:a.data("nextaction-id")})})}}})}},ajaxUrl:f,plugin:{toggle:function(a){d.info("plugin:enable");a={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")};var b=c.appRequests().getRequestOpts();b.url=f.appMgmt.save;b.data=a;c.appRequests().getActionCall(b,function(a){c.msg.out(a); +0===a.status&&setTimeout(function(){c.redirect("index.php")},2E3)})},reset:function(a){d.info("plugin:reset");var b='

    '+c.config().LANG[58]+"

    ";mdlDialog().show({text:b,negative:{title:c.config().LANG[44],onClick:function(a){a.preventDefault();c.msg.error(c.config().LANG[44])}},positive:{title:c.config().LANG[43],onClick:function(b){b.preventDefault();b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get(),activeTab:a.data("activetab")};var e= +c.appRequests().getRequestOpts();e.url=f.appMgmt.save;e.data=b;c.appRequests().getActionCall(e,function(a){c.msg.out(a)})}}})}},notice:{check:function(a){d.info("notice:check");var b={itemId:a.data("item-id"),actionId:a.data("action-id"),sk:c.sk.get()},e=c.appRequests().getRequestOpts();e.url=f.appMgmt.save;e.data=b;c.appRequests().getActionCall(e,function(b){c.msg.out(b);0===b.status&&g({actionId:a.data("nextaction-id"),itemId:a.data("activetab")})})},search:function(a){d.info("notice:search");var b= +$(a.data("target")),e=c.appRequests().getRequestOpts();e.url=f.notice.search;e.method="get";e.data=a.serialize();c.appRequests().getActionCall(e,function(a){0===a.status?b.html(a.data.html):b.html(c.msg.html.error(a.description));c.sk.set(a.csrf)})},show:function(a){d.info("notice:show");var b=c.appRequests().getRequestOpts();b.url=f.notice.show;b.method="get";b.data={itemId:a.data("item-id"),actionId:a.data("action-id"),activeTab:a.data("activetab"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b, +function(b){0!==b.status?c.msg.out(b):l(a,b.data.html)})}},wiki:{show:function(a){d.info("wiki:show");var b=c.appRequests().getRequestOpts();b.url=f.wiki.show;b.method="get";b.data={pageName:a.data("pagename"),actionId:a.data("action-id"),sk:c.sk.get(),isAjax:1};c.appRequests().getActionCall(b,function(b){0!==b.status?c.msg.out(b):l(a,b.data.html)})}},items:p}}; diff --git a/js/app-main.js b/js/app-main.js index be7acce3..f443591e 100644 --- a/js/app-main.js +++ b/js/app-main.js @@ -337,6 +337,7 @@ sysPass.Main = function () { // Objeto para leer/escribir el token de seguridad var sk = { + current: "", get: function () { log.info("sk:get"); return $("#container").attr("data-sk"); @@ -344,6 +345,8 @@ sysPass.Main = function () { set: function (sk) { log.info("sk:set"); $("#container").attr("data-sk", sk); + + sk.current = sk; } }; diff --git a/js/app-main.min.js b/js/app-main.min.js index 5c3db432..9578d107 100644 --- a/js/app-main.min.js +++ b/js/app-main.min.js @@ -1,23 +1,23 @@ -var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,f,g){if(g.get||g.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[f]=g.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; -$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(a){return $jscomp.SYMBOL_PREFIX+(a||"")+$jscomp.symbolCounter_++}; -$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(a){var f=0;return $jscomp.iteratorPrototype(function(){return f"+b.messages.join("
    "));switch(a){case 0:k.ok(d);break;case 1:case 2:case 4:k.error(d); -break;case 3:k.warn(d);break;case 10:l.main.logout();break;case 100:k.ok(d);k.sticky(d);break;case 101:k.error(d);k.sticky(d);break;default:k.error(d)}}},html:{error:function(b){return'

    Oops...
    '+a.LANG[1]+"
    "+b+"

    "}}};Object.freeze(k);var x=function(){h.info("getEnvironment");var b=window.location.pathname.split("/");a.APP_ROOT=window.location.protocol+"//"+window.location.host+function(){for(var a="",e=1;e<=b.length-2;e++)a+="/"+b[e];return a}();var e=m.getRequestOpts(); -e.url="/ajax/ajax_getEnvironment.php";e.method="get";e.useLoading=!1;e.data={isAjax:1};return m.getActionCall(e,function(b){a.LANG=b.lang;a.PK=b.pk;a.CHECK_UPDATES=b.check_updates;a.CRYPT.setPublicKey(b.pk);a.TIMEZONE=b.timezone;a.LOCALE=b.locale;a.DEBUG=b.debug;a.MAX_FILE_SIZE=parseInt(b.max_file_size);a.COOKIES_ENABLED=b.cookies_enabled;Object.freeze(a)})},q={get:function(){h.info("sk:get");return $("#container").attr("data-sk")},set:function(b){h.info("sk:set");$("#container").attr("data-sk",b)}}, -y=function(){var b=$("#container");if(!b.hasClass("content-no-auto-resize")){var a=$("#content").height()+200;b.css("height",a)}},z=function(){$("html, body").animate({scrollTop:0},"slow")},A=function(b){for(var a=[],d,c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),f=0;fa.MAX_FILE_SIZE)k.error(a.LANG[18]+"
    "+r.name+" (Max: "+a.MAX_FILE_SIZE+")");else{var c;a:{c=r.name;for(var g=b.data("files-ext").toLowerCase().split(","),h=0;h<=g.length;h++)if(-1!==c.indexOf(g[h])){c= -!0;break a}c=!1}c?f(e[d]):k.error(a.LANG[19]+"
    "+r.name)}}},g=function(a){var b=$("#fileUploadForm");!1===a&&b.hide();a=b.find("input[type='file']");a.on("change",function(){"function"===typeof d.beforeSendAction&&d.beforeSendAction();c(this.files)});return a};window.File&&window.FileList&&window.FileReader?function(){h.info("fileUpload:init");var a=g(!1);b.on("dragover dragenter",function(a){h.info("fileUpload:drag");a.stopPropagation();a.preventDefault()});b.on("drop",function(a){h.info("fileUpload:drop"); -a.stopPropagation();a.preventDefault();"function"===typeof d.beforeSendAction&&d.beforeSendAction();c(a.originalEvent.dataTransfer.files)});b.on("click",function(){a.click()})}():g(!0);return d},D=function(a){h.info("checkPassLevel");f.passLength=a.val().length;v(zxcvbn(a.val()),a)},v=function(b,e){h.info("outputResult");var d=$(".passLevel-"+e.attr("id")),c=b.score;d.show();d.removeClass("weak good strong strongest");0===f.passLength?d.attr("title","").empty():f.passLengtha.secondary?a.calc=a.main/a.rel:a.maina.secondary&&(a.main*=a.factor,g(a));return a},k=function(){f.main=b;f.secondary=d;var e=g(f);a.css({width:e.main,height:e.calc});c.width= +var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(b,f,g){if(g.get||g.set)throw new TypeError("ES3 does not support getters and setters.");b!=Array.prototype&&b!=Object.prototype&&(b[f]=g.value)};$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; +$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(b){return $jscomp.SYMBOL_PREFIX+(b||"")+$jscomp.symbolCounter_++}; +$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var b=$jscomp.global.Symbol.iterator;b||(b=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[b]&&$jscomp.defineProperty(Array.prototype,b,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(b){var f=0;return $jscomp.iteratorPrototype(function(){return f"+a.messages.join("
    "));switch(b){case 0:k.ok(d);break;case 1:case 2:case 4:k.error(d); +break;case 3:k.warn(d);break;case 10:l.main.logout();break;case 100:k.ok(d);k.sticky(d);break;case 101:k.error(d);k.sticky(d);break;default:k.error(d)}}},html:{error:function(a){return'

    Oops...
    '+b.LANG[1]+"
    "+a+"

    "}}};Object.freeze(k);var x=function(){h.info("getEnvironment");var a=window.location.pathname.split("/");b.APP_ROOT=window.location.protocol+"//"+window.location.host+function(){for(var b="",e=1;e<=a.length-2;e++)b+="/"+a[e];return b}();var e=m.getRequestOpts(); +e.url="/ajax/ajax_getEnvironment.php";e.method="get";e.useLoading=!1;e.data={isAjax:1};return m.getActionCall(e,function(a){b.LANG=a.lang;b.PK=a.pk;b.CHECK_UPDATES=a.check_updates;b.CRYPT.setPublicKey(a.pk);b.TIMEZONE=a.timezone;b.LOCALE=a.locale;b.DEBUG=a.debug;b.MAX_FILE_SIZE=parseInt(a.max_file_size);b.COOKIES_ENABLED=a.cookies_enabled;Object.freeze(b)})},q={current:"",get:function(){h.info("sk:get");return $("#container").attr("data-sk")},set:function(a){h.info("sk:set");$("#container").attr("data-sk", +a);a.current=a}},y=function(){var a=$("#container");if(!a.hasClass("content-no-auto-resize")){var b=$("#content").height()+200;a.css("height",b)}},z=function(){$("html, body").animate({scrollTop:0},"slow")},A=function(a){for(var b=[],d,c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),f=0;fb.MAX_FILE_SIZE)k.error(b.LANG[18]+"
    "+r.name+" (Max: "+b.MAX_FILE_SIZE+")");else{var c;a:{c=r.name;for(var g=a.data("files-ext").toLowerCase().split(","),h=0;h<=g.length;h++)if(-1!==c.indexOf(g[h])){c= +!0;break a}c=!1}c?f(e[d]):k.error(b.LANG[19]+"
    "+r.name)}}},g=function(a){var b=$("#fileUploadForm");!1===a&&b.hide();a=b.find("input[type='file']");a.on("change",function(){"function"===typeof d.beforeSendAction&&d.beforeSendAction();c(this.files)});return a};window.File&&window.FileList&&window.FileReader?function(){h.info("fileUpload:init");var b=g(!1);a.on("dragover dragenter",function(a){h.info("fileUpload:drag");a.stopPropagation();a.preventDefault()});a.on("drop",function(a){h.info("fileUpload:drop"); +a.stopPropagation();a.preventDefault();"function"===typeof d.beforeSendAction&&d.beforeSendAction();c(a.originalEvent.dataTransfer.files)});a.on("click",function(){b.click()})}():g(!0);return d},D=function(a){h.info("checkPassLevel");f.passLength=a.val().length;v(zxcvbn(a.val()),a)},v=function(a,e){h.info("outputResult");var d=$(".passLevel-"+e.attr("id")),c=a.score;d.show();d.removeClass("weak good strong strongest");0===f.passLength?d.attr("title","").empty():f.passLengtha.secondary?a.calc=a.main/a.rel:a.maina.secondary&&(a.main*=a.factor,g(a));return a},k=function(){f.main=b;f.secondary=d;var e=g(f);a.css({width:e.main,height:e.calc});c.width= e.main;c.height=e.calc},l=function(){f.main=d;f.secondary=b;var e=g(f);a.css({width:e.calc,height:e.main});c.width=e.calc;c.height=e.main};c.width>b?k():c.height>d&&(h.info("height"),l());return c},E=function(){var a=document.createElement("div");return function(b){b&&"string"===typeof b&&(b=b.replace(/]*>([\S\s]*?)<\/script>/gmi,""),b=b.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi,""),a.innerHTML=b,b=a.textContent,a.textContent="");return b}}();return function(){h.info("init");p={actions:function(){return l}, -triggers:function(){return c},theme:function(){return g},sk:q,msg:k,log:h,passwordData:f,outputResult:v,checkPassLevel:D,encryptFormValue:u,fileUpload:C,redirect:t,scrollUp:z,setContentSize:y};n=$.extend({log:h,config:function(){return a},appTheme:function(){return g},appActions:function(){return l},appTriggers:function(){return c},appRequests:function(){return m},evalAction:H,resizeImage:I},p);Object.freeze(p);Object.freeze(n);c=sysPass.Triggers(n);l=sysPass.Actions(n);m=sysPass.Requests(n);"function"=== -typeof sysPass.Theme&&(g=sysPass.Theme(n));x().then(function(){""!==a.PK&&G();!0===a.CHECK_UPDATES&&l.main.getUpdates();!1===a.COOKIES_ENABLED&&k.sticky(a.LANG[64]);F();w();B()});return p}()}; +triggers:function(){return c},theme:function(){return g},sk:q,msg:k,log:h,passwordData:f,outputResult:v,checkPassLevel:D,encryptFormValue:u,fileUpload:C,redirect:t,scrollUp:z,setContentSize:y};n=$.extend({log:h,config:function(){return b},appTheme:function(){return g},appActions:function(){return l},appTriggers:function(){return c},appRequests:function(){return m},evalAction:H,resizeImage:I},p);Object.freeze(p);Object.freeze(n);c=sysPass.Triggers(n);l=sysPass.Actions(n);m=sysPass.Requests(n);"function"=== +typeof sysPass.Theme&&(g=sysPass.Theme(n));x().then(function(){""!==b.PK&&G();!0===b.CHECK_UPDATES&&l.main.getUpdates();!1===b.COOKIES_ENABLED&&k.sticky(b.LANG[64]);F();w();B()});return p}()}; diff --git a/js/app-requests.js b/js/app-requests.js index 14e67dde..7026f938 100644 --- a/js/app-requests.js +++ b/js/app-requests.js @@ -169,11 +169,15 @@ sysPass.Requests = function (Common) { callbackError(); } }, - complete: function () { + complete: function (response) { if (opts.useLoading === true) { Common.appTheme().loading.hide(); } + if (opts.type === "json" && response.responseJSON.csrf !== undefined && response.responseJSON.csrf !== "") { + Common.sk.set(response.responseJSON.csrf); + } + Common.appTheme().ajax.complete(); } }); diff --git a/js/app-requests.min.js b/js/app-requests.min.js index 674fe52a..7d321588 100644 --- a/js/app-requests.min.js +++ b/js/app-requests.min.js @@ -1,4 +1,4 @@ -sysPass.Requests=function(c){var d=c.log,b=[],g={type:"json",url:"",method:"post",callback:"",async:!0,data:"",cache:!1,processData:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:0,addHistory:!1,hash:"",useLoading:!0,useFullLoading:!1};Object.seal(g);var k={get:function(){return b},add:function(a){var h=""===a.hash?SparkMD5.hash(JSON.stringify(a),!1):a.hash;if(0"+n+e+"

    ",d.error(b),"html"===a.type&&$("#content").html(c.msg.html.error(n)),c.msg.error(b)):m()},complete:function(){!0===a.useLoading&&c.appTheme().loading.hide();c.appTheme().ajax.complete()}})}, -getActionEvent:function(a,b,c){var f=l(a.url),f=f+("?"+$.param(a.data)),e=new EventSource(f);e.addEventListener("message",function(a){a=JSON.parse(a.data);d.debug(a);1===a.end?(d.info("getActionEvent:Ending"),e.close(),"function"===typeof c&&c(a)):"function"===typeof b&&b(a)});e.addEventListener("error",function(a){d.error("getActionEvent:Error occured");e.close()});return e},history:k}}; +sysPass.Requests=function(c){var d=c.log,b=[],g={type:"json",url:"",method:"post",callback:"",async:!0,data:"",cache:!1,processData:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",timeout:0,addHistory:!1,hash:"",useLoading:!0,useFullLoading:!1};Object.seal(g);var h={get:function(){return b},add:function(a){var c=""===a.hash?SparkMD5.hash(JSON.stringify(a),!1):a.hash;if(0"+m+e+"

    ",d.error(b),"html"===a.type&&$("#content").html(c.msg.html.error(m)),c.msg.error(b)):l()},complete:function(b){!0===a.useLoading&&c.appTheme().loading.hide();"json"===a.type&&void 0!==b.responseJSON.csrf&& +""!==b.responseJSON.csrf&&c.sk.set(b.responseJSON.csrf);c.appTheme().ajax.complete()}})},getActionEvent:function(a,b,c){var f=k(a.url),f=f+("?"+$.param(a.data)),e=new EventSource(f);e.addEventListener("message",function(a){a=JSON.parse(a.data);d.debug(a);1===a.end?(d.info("getActionEvent:Ending"),e.close(),"function"===typeof c&&c(a)):"function"===typeof b&&b(a)});e.addEventListener("error",function(a){d.error("getActionEvent:Error occured");e.close()});return e},history:h}}; From b60f8d03a875eca26c3d17eca9258779ffa6751c Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Thu, 13 Apr 2017 21:03:19 +0200 Subject: [PATCH 06/22] * [MOD] Set default user's preferences on demo mode --- inc/SP/Controller/LoginController.class.php | 8 +++++++- inc/SP/Core/Language.class.php | 4 +--- inc/SP/Core/UI/Theme.class.php | 4 +--- inc/SP/DataModel/UserPreferencesData.class.php | 4 ++-- inc/SP/Util/Util.class.php | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/inc/SP/Controller/LoginController.class.php b/inc/SP/Controller/LoginController.class.php index a54895bf..2b8756e9 100644 --- a/inc/SP/Controller/LoginController.class.php +++ b/inc/SP/Controller/LoginController.class.php @@ -46,6 +46,7 @@ use SP\Core\SessionUtil; use SP\DataModel\TrackData; use SP\DataModel\UserLoginData; use SP\DataModel\UserPassRecoverData; +use SP\DataModel\UserPreferencesData; use SP\Http\JsonResponse; use SP\Http\Request; use SP\Log\Log; @@ -385,10 +386,15 @@ class LoginController */ protected function loadUserPreferences() { + if (Checks::demoIsEnabled()) { + Session::setUserPreferences(new UserPreferencesData()); + } else { + Session::setUserPreferences($this->UserData->getUserPreferences()); + } + Language::setLanguage(true); DiFactory::getTheme()->initTheme(true); - Session::setUserPreferences($this->UserData->getUserPreferences()); Session::setSessionType(Session::SESSION_INTERACTIVE); Session::setAuthCompleted(true); diff --git a/inc/SP/Core/Language.class.php b/inc/SP/Core/Language.class.php index 948bde77..4587b554 100644 --- a/inc/SP/Core/Language.class.php +++ b/inc/SP/Core/Language.class.php @@ -93,9 +93,7 @@ class Language */ private function getUserLang() { - $userId = Session::getUserData()->getUserId(); - - return ($userId > 0) ? UserPreferences::getItem()->getById($userId)->getLang() : ''; + return (Session::getUserData()->getUserId() > 0) ? Session::getUserPreferences()->getLang() : ''; } /** diff --git a/inc/SP/Core/UI/Theme.class.php b/inc/SP/Core/UI/Theme.class.php index 3d7ee56f..0ce0587b 100644 --- a/inc/SP/Core/UI/Theme.class.php +++ b/inc/SP/Core/UI/Theme.class.php @@ -101,9 +101,7 @@ class Theme implements ThemeInterface */ protected function getUserTheme() { - $userId = Session::getUserData()->getUserId(); - - return ($userId > 0) ? UserPreferences::getItem()->getById($userId)->getTheme() : ''; + return (Session::getUserData()->getUserId() > 0) ? Session::getUserPreferences()->getTheme() : ''; } /** diff --git a/inc/SP/DataModel/UserPreferencesData.class.php b/inc/SP/DataModel/UserPreferencesData.class.php index cb280ad3..ebb1a334 100644 --- a/inc/SP/DataModel/UserPreferencesData.class.php +++ b/inc/SP/DataModel/UserPreferencesData.class.php @@ -231,11 +231,11 @@ class UserPreferencesData * @return void * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep */ - function __wakeup() + public function __wakeup() { // Para realizar la conversión de nombre de propiedades que empiezan por _ foreach (get_object_vars($this) as $name => $value) { - if (substr($name, 0, 1) === '_') { + if (strpos($name, '_') === 0) { $newName = substr($name, 1); $this->$newName = $value; diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 5e502983..7e4cab06 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041302; + $build = 17041303; $version = [2, 1, 6]; if ($normalized === true) { From a6de46ab3a2a3ec58f4c0ef4f54446cccb7f1dc0 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Thu, 13 Apr 2017 21:19:24 +0200 Subject: [PATCH 07/22] * [MOD] UI tweaks. Box border is remove, it uses a shadow instead. --- inc/SP/Util/Util.class.php | 2 +- inc/themes/material-blue/css/styles.css | 6 ++++-- inc/themes/material-blue/css/styles.css.map | 2 +- inc/themes/material-blue/css/styles.min.css | 2 +- inc/themes/material-blue/css/styles.scss | 5 +++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 7e4cab06..23eb0820 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041303; + $build = 17041304; $version = [2, 1, 6]; if ($normalized === true) { diff --git a/inc/themes/material-blue/css/styles.css b/inc/themes/material-blue/css/styles.css index 0073ad96..2f457697 100644 --- a/inc/themes/material-blue/css/styles.css +++ b/inc/themes/material-blue/css/styles.css @@ -271,9 +271,11 @@ pre, code, samp, kbd { #content .data { width: 100%; padding: 10px; - border: 1px solid #c9c9c9; margin: 0 auto; - background-color: #f9f9f9; } + background-color: #fff; + -webkit-box-shadow: 2px 2px 3px -3px rgba(0, 0, 0, 0.14); + -moz-box-shadow: 2px 2px 3px -3px rgba(0, 0, 0, 0.14); + box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.14); } #content .data #history-icon { position: relative; top: 5em; diff --git a/inc/themes/material-blue/css/styles.css.map b/inc/themes/material-blue/css/styles.css.map index 34efef32..85842aa9 100644 --- a/inc/themes/material-blue/css/styles.css.map +++ b/inc/themes/material-blue/css/styles.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AAAA,UAAW;EACT,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;EACV,UAAU,EAAE,IAAI;EAChB,gBAAgB,EAAE,OAAO;EACzB,KAAK,EAAE,IAAI;EACX,SAAS,EAAE,IAAI;EACf,WAAW,EAAE,MAAM;EACnB,UAAU,EAAE,UAAU;;AAGxB,CAAE;EACA,WAAW,ECZA,6CAAgB;EDa3B,UAAU,EAAE,OAAO;EACnB,iBAAkB;IAChB,UAAU,EAAE,OAAO;;AAIvB,KAAM;EACJ,SAAS,EAAE,IAAI;EACf,cAAc,EAAE,CAAC;EACjB,QAAG;IACD,aAAa,EAAE,qBAAqB;IACpC,cAAc,EAAE,MAAM;IACtB,cAAM;MACJ,KAAK,EAAE,IAAI;MACX,MAAM,EAAE,IAAI;EAGhB,QAAG;IAUD,MAAM,EAAE,IAAI;IATZ,YAAM;MACJ,gBAAgB,EAAE,OAAO;IAE3B,qCAAwB;MACtB,aAAa,EAAE,4BAA4B;IAE7C,uCAA0B;MACxB,gBAAgB,EAAE,OAAO;EAI7B,QAAG;IACD,OAAO,EAAE,GAAG;IACZ,mBAAa;MACX,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O;IACL,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,MAAM;IAChB,aAAa,EAAE,QAAQ;IACvB,gBAAgB,EAAE,QAAQ;EAE5B,iCAAgB;IACd,OAAO,EAAE,gBAAgB", "sources": ["_elements.scss","_base.scss","styles.scss","_login.scss"], "names": [], "file": "styles.css" diff --git a/inc/themes/material-blue/css/styles.min.css b/inc/themes/material-blue/css/styles.min.css index ba6c3729..25e5c7fb 100644 --- a/inc/themes/material-blue/css/styles.min.css +++ b/inc/themes/material-blue/css/styles.min.css @@ -1 +1 @@ -html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal;box-sizing:border-box}*{font-family:"Roboto Regular",Verdana,Tahoma,sans-serif;box-sizing:inherit}*:before,*:after{box-sizing:inherit}table{font-size:11px;border-spacing:0}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr{height:20px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9!important}table tr.even:hover,table tr.odd:hover{background-color:#e8ff99}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;margin:0}input.inputImg,img.inputImg{background-color:transparent!important;width:24px!important;height:24px!important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px;resize:none}select.files{width:250px}input.spinner{width:5em}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent!important;width:16px!important;height:16px!important;margin:0 5px 0 5px;border:0;vertical-align:middle}i{cursor:pointer}form .form-field{display:flex;justify-content:space-between}form .form-field>label{min-width:12em;padding:.5em 0;font-size:16px;align-self:center}form .form-field>div{width:100%;align-self:center}a{text-decoration:none;color:#536dfe}a:visited{text-decoration:none;color:#536dfe}a:hover,a:active,a:focus{text-decoration:none;cursor:pointer}pre,code,samp,kbd{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:1em;direction:ltr;text-align:left;background-color:#fbfaf9;color:#333;box-shadow:inset 0 0 .3em #ccc;border-radius:2px}#nojs{width:80%;text-align:center;vertical-align:middle;margin:10px auto;padding:3px;background-color:#ef5350;color:white;font-weight:bold;font-size:14px}#wrap{height:auto!important;min-height:100%;width:100%;background-color:#f5f5f5}#wrap-loading{position:fixed;z-index:9999;top:50%;left:50%;padding:1em;background-color:rgba(255,255,255,0.8);display:none;border-radius:5px!important;-moz-border-radius:5px!important;-webkit-border-radius:5px!important}#wrap-loading.overlay-full{top:0;left:0;width:100%;height:100%;background-color:rgba(255,255,255,0.5)}#wrap-loading.overlay-full #loading{position:absolute;top:50%;left:50%}#wrap-loading.overlay-full #taskStatus{display:block}#wrap-loading #taskStatus{display:none;position:absolute;left:0;top:55%;width:100%;text-align:center;color:white;background-color:rgba(0,0,0,0.5);padding:1em 0}#container{margin:auto;width:100%}#container.login{padding-top:5%}#container.error,#container.install,#container.passreset{width:100%}#container .logo{height:64px}#container #actions-bar{z-index:100;display:flex;justify-content:space-between;position:fixed;border:0 none;top:0;left:0;width:100%;padding:1em 0;background-color:transparent}#container #actions-bar-icons{flex-grow:1;text-align:center}#container #actions-bar-logo{display:none;padding:0 .5em}#container #actions-bar-logo img{display:inline-block;width:50px;opacity:.75}#container #content{width:95%;margin:2em auto 8em auto}#container #content.public-link{width:70%;min-height:0;margin:5em auto}#content td.descField,#box-popup td.descField{text-align:right;padding-right:20px;width:25%;border-right:1px solid #d9d9d9;color:#999;font-size:12px;font-weight:bold}#content td.valField,#box-popup td.valField{padding-left:1em;width:100%}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:none;width:100%;color:#607d8b;font-size:12px}#content .pager{width:100%;margin-top:15px;padding:.5em;vertical-align:middle;font-size:11px;color:#999;background-color:#fcfcfc}#content .pager img{margin-left:5px;vertical-align:middle}#content .pager a{margin-left:5px;font-size:12px;color:#999}#content .pager>div{display:inline-block;width:49%}#content .pager .pager-left{text-align:left}#content .pager .pager-right{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleNormal{background-color:#607d8b;color:#fff}#content .data-container{width:75%;margin:0 auto}#content fieldset.data{margin:2em auto}#content fieldset.data>legend{color:#607d8b;padding:0 .5em;font-size:1.5em}#content fieldset.data>div{display:none}#content fieldset.data>div table{width:100%}#content .data{width:100%;padding:10px;border:1px solid #c9c9c9;margin:0 auto;background-color:#f9f9f9}#content .data #history-icon{position:relative;top:5em;right:2em}#content .data td{text-align:left}#content .data td.descField{text-align:right}#content .data select{min-width:210px}#content .data .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .dropzone{width:30em;padding:1em;border:2px dashed #26a69a;text-align:center}#content .data .dropzone img{vertical-align:middle}#content .data .file-upload{display:none}#content .data .account-permissions{width:100%}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content span.tag{margin:0 3px 3px 0;padding:.2em;background:#5c6bc0;color:#fff;border:0 solid transparent;border-radius:3px!important;-moz-border-radius:3px!important;-webkit-border-radius:3px!important}#content .extra-info{margin-top:20px}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff8e1;color:#ffca28;font-weight:bold}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#5c6bc0}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{display:inline-block;padding:.2em .5em;font-weight:bold;letter-spacing:.2em;color:#fff;text-align:center}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{display:flex;flex-wrap:wrap;justify-content:flex-start;margin:0}#content .data-header-minimal li{display:inline-flex;min-width:10em;font-weight:normal;letter-spacing:normal}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-table{width:100%}#content .data-table td:first-of-type,#content .data-table th:first-of-type{width:5em}#content .data-table thead th{background-color:#607d8b;color:#fff}#content .data-table tbody td.cell-data{text-align:left}#content .data-table tbody td.cell-nodata{padding:0 .5em;text-align:left}#content .data-table tbody td.cell-actions{text-align:right}#content .data-table tbody td.cell-actions i{opacity:.5}#content .data-table tbody td.cell-actions i:hover{opacity:1}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0;background-color:#fcfcfc}#content .data-rows li{float:left;display:block;padding:1em;color:#696969;text-align:center;min-height:2em}#content .data-rows li.cell-nodata{padding:1em 0;min-height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;min-height:2em;padding:1em 0;text-align:left;background-color:#fcfcfc;width:15em}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img{width:24px;height:24px;margin:0 .5em}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #searchbox{background-color:#fcfcfc;vertical-align:middle;position:relative;height:auto;padding:.5em 1em;margin-bottom:2em}#content #searchbox form{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;text-align:left}#content #searchbox .search-filters>*{margin:0 .5em}#content #searchbox .search-filters .filter-buttons{display:inline-block}#content #searchbox .search-filters .filter-slider{width:10em}#content #searchbox .search-filters-tags{display:none;flex-grow:2}#content .btn-clear{opacity:.35;filter:alpha(opacity=35)}#content .btn-clear:hover{opacity:1;filter:alpha(opacity=100)}#content .actions-optional{display:none}#content .error{width:350px;padding:15px;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#box-popup .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .list-wrap ul,#box-popup .list-wrap ul{list-style-type:none;margin:0;padding:0}#content .data .list-wrap li,#box-popup .list-wrap li{display:flex;background:#f2f2f2;padding:.5em;font-size:1em;margin-bottom:.5em}#content .data .list-wrap li:hover,#box-popup .list-wrap li:hover{background:#e8eaf6;color:#000}#content .data .list-wrap div.files-item-info,#box-popup .list-wrap div.files-item-info{flex-grow:2}#content .data .list-wrap div.files-item-info img,#box-popup .list-wrap div.files-item-info img{margin:0 .5em}#content .data .list-wrap div.files-item-actions,#box-popup .list-wrap div.files-item-actions{padding:.3em 0}#box-popup{min-width:30em;max-width:60em;margin:5em auto;padding:0;background-color:#fff}#box-popup.box-password-view{min-width:30em;max-width:35em}#box-popup>h2{position:relative;width:100%;font-size:18px;color:#fff;background-color:#607d8b;margin:0;padding:.5em 0;line-height:1em}#box-popup>h2 .btn-popup-close{display:none;position:absolute;right:.5em;top:.2em}#box-popup>table{width:100%;padding-bottom:1em}#box-popup select{width:220px}#box-popup #resFancyAccion{display:none}#box-popup #resCheck{display:inline-block;width:80%;height:4em;padding:1em 0}#box-popup.image{background-color:transparent;max-width:100%;margin:0 auto;border-radius:0!important;-moz-border-radius:0!important;-webkit-border-radius:0!important}#box-popup.image img{width:auto;margin:0 auto}#box-popup.image>div.title{background-color:#607d8b;color:#fff;padding:.5em}#box-popup.help{min-height:100px;background-color:#f5f5f5}#box-popup.help p{font-size:14px;text-align:justify;line-height:2em}#box-complexity>div{text-align:justify;line-height:1.5em;margin-top:1em}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:#fff8e1;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.popup-data{width:100%;min-width:400px;border:0;text-align:left;margin:0;padding:1em .5em}.popup-data .descField{min-width:100px}footer{display:flex;justify-content:space-between;position:fixed;bottom:0;z-index:100;width:100%;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:1em;-webkit-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);-moz-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14)}footer .footer-parts{display:flex;justify-content:space-between}footer #footer-left{width:50%;margin:0 1em}footer #footer-right{width:50%;margin:0 1em;justify-content:flex-end;text-align:right}footer #updates{min-width:10em;text-align:center;cursor:pointer}footer #status{margin:0 1em}footer #status>div{display:inline-block}footer #status .status-info{padding:.5em}footer #session{text-align:left;color:#999;font-size:.8em}footer a{color:#b9b9b9}footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round,.round5{border-radius:5px!important;-moz-border-radius:5px!important;-webkit-border-radius:5px!important}.midround{border-radius:0 0 10px 10px!important;-moz-border-radius:0 0 10px 10px!important;-webkit-border-radius:0 0 10px 10px!important}.midroundup{border-radius:10px 10px 0 0!important;-moz-border-radius:10px 10px 0 0!important;-webkit-border-radius:10px 10px 0 0!important}.fullround{border-radius:50%!important;-moz-border-radius:50%!important;-webkit-border-radius:50%!important}.iconMini{width:16px!important;height:16px!important;vertical-align:middle}.hide{display:none!important}.btn-checks{padding:5px;margin:.2em 0;width:30em;border-bottom:1px solid #c9c9c9}.shadow{-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}.noRes{width:60%;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-grey{background-color:#607d8b;color:#fff;min-height:2em}.no-background{background:none!important}.action-in-box{padding:1em;text-align:right}.action-in-box ul{list-style:none;margin:0;padding:0}.tab-data{margin:2em auto 0;width:75%}.item-actions{margin:1em auto}.tab-actions{margin:2em 0}.item-actions>ul,.tab-actions>ul{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;list-style:none;margin:0;padding:0}.item-actions>ul>li,.tab-actions>ul>li{width:auto;min-width:2em;margin-left:.5em}.item-actions>ul>li.datagrid-action-search,.tab-actions>ul>li.datagrid-action-search{min-width:5em}.item-actions>ul>li.datagrid-action-search form,.tab-actions>ul>li.datagrid-action-search form{width:100%}.fullWidth{max-width:100%!important}.filter-on{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;padding:.3em 1em}.global-on{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;padding:.3em 1em}.opacity50{filter:alpha(opacity=50);opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strongest:hover{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strong{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.strong:hover{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.good{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.good:hover{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.weak{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}.passLevel.weak:hover{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}.dialog-text,.dialog-user-text,.dialog-pass-text{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;padding:.5em;text-align:center;min-width:200px}.dialog-user-text{border-bottom:#d9d9d9 1px solid;color:#a9a9a9}.dialog-pass-text{border:transparent 1px solid;letter-spacing:.2em}.dialog-buttons{text-align:center;padding:.5em;border-top:1px solid #c9c9c9;line-height:2.5em}.dialog-clip-copy{color:#26a69a;background-color:#e0f2f1}.help-box{display:none;background-color:#fff!important;color:#607d8b}.help-box>*{font-weight:bold}.help-text{text-align:justify;line-height:1.5em;margin-top:1em}.tooltip{width:300px;max-width:300px;background-color:#777;color:#fff;z-index:101}.cursor-pointer{cursor:pointer}.password-actions{display:inline-block;width:12em}.password-actions>span,.password-actions i{margin-right:.6em}.custom-input-color{width:3em;height:1em;display:inline-block}.account-pass-image{height:32px;width:auto}.select-box{min-width:20em}fieldset.warning{padding:8px;border-radius:5px;color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}fieldset.warning legend{color:#ef5350!important}fieldset.warning a{color:#ef5350!important;font-weight:bold}#actions{width:100%;line-height:2em;margin-bottom:5em}#actions #logo{display:flex;width:100%;margin-bottom:30px;color:#607d8b;align-items:center;background:url("../imgs/logo_full_bg.png") left no-repeat;background-size:auto 150px;height:150px}#actions #page-title{width:100%;color:#607d8b;text-align:center}#actions #page-title h1{font-weight:bold;font-size:24px;letter-spacing:3px}#actions ul.errors{max-width:40vw;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:3px;padding:1em .5em}#actions ul.errors>li.msg-critical{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}#actions ul.errors>li.msg-warning{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;color:#555}#actions ul.errors>li.msg-ok{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#actions ul.errors>li>p.hint{color:#555;font-size:12px}#actions ul.errors>li>p.hint i{margin-right:.5em}#actions form{width:450px;margin:0 auto;text-align:left}#actions form fieldset{margin-bottom:2em}#actions form fieldset legend{width:100%;color:#fff;font-size:14px;font-weight:bold;text-align:center;background-color:#607d8b;margin:1em 0;letter-spacing:.2em;padding:.2em 0}#actions div.buttons{margin-top:2em;text-align:center}.center{text-align:center!important}.right{text-align:right!important}.left{text-align:left!important}.opacity50{opacity:.5!important}#login-container{width:40em;margin:0 auto;background:transparent url("../imgs/logo_full_bg.png") no-repeat top left;background-size:auto 10em}#login-container #boxSpacer{height:11em;background-color:transparent}#login-container #boxLogin{position:relative;margin:0 auto;width:100%;min-height:14em;padding:1em;background-color:#fff}#login-container #boxLogin #boxData{height:100%;min-height:14em;text-align:left;background-color:transparent}#login-container #boxLogin #boxData i{margin-right:.5em;opacity:.5}#login-container #boxLogin #boxData .extra-hidden{display:none}#login-container #boxLogin #boxButton{position:absolute;top:2em;right:2em}#login-container #boxLogin #boxActions{width:100%;text-align:right}#login-container #boxLogin #boxActions a{color:#c9c9c9}#login-container #boxLogout{margin-top:4em;width:100%}#login-container #boxLogout>div{margin:0 auto;width:250px;font-size:14px;padding:.5em;text-align:center;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#login-container #boxUpdated{width:350px;margin:3em auto;font-size:14px;text-align:center;padding:.5em;color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#login-container #demo-info{margin:3em auto;color:#c9c9c9;border-top:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:.5em}#login-container #demo-info ul{display:flex;justify-content:space-around;list-style:none}#login-container #demo-info ul li span{margin:0 2em}@media screen and (max-width:1000px){#content #searchbox .search-filters>*{margin:.5em 1em .5em 0}#content .data-container #title,#content .tab-data #title{width:90%}footer{display:none;justify-content:space-between;flex-wrap:wrap}footer .footer-parts{justify-content:space-between;flex-wrap:wrap}footer #footer-left,footer #footer-right{width:100%}footer .footer-parts>div{width:100%;padding:.5em 0}}@media screen and (max-width:600px){#content input,#box-popup input{width:100%}#content .mdl-textfield,#box-popup .mdl-textfield{width:100%}#content td.descField,#box-popup td.descField{display:none}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:block}#content #searchbox .mdl-textfield{width:90%}#content #searchbox .search-text{width:90%}#content #searchbox .search-filters .selectize-control{width:100%}#content .data-container,#content .tab-data{width:100%}#content .data-container #title,#content .tab-data #title{width:90%}#content .data-container .selectize-control,#content .tab-data .selectize-control{width:100%}#box-popup h2>.btn-popup-close{display:inline-block}.mdl-data-table{table-layout:fixed;width:100%}.table-responsive td,.table-responsive th{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.table-responsive .cell-actions i{display:block!important}} \ No newline at end of file +html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal;box-sizing:border-box}*{font-family:"Roboto Regular",Verdana,Tahoma,sans-serif;box-sizing:inherit}*:before,*:after{box-sizing:inherit}table{font-size:11px;border-spacing:0}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr{height:20px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9 !important}table tr.even:hover,table tr.odd:hover{background-color:#e8ff99}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;margin:0}input.inputImg,img.inputImg{background-color:transparent !important;width:24px !important;height:24px !important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px;resize:none}select.files{width:250px}input.spinner{width:5em}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent !important;width:16px !important;height:16px !important;margin:0 5px 0 5px;border:0;vertical-align:middle}i{cursor:pointer}form .form-field{display:flex;justify-content:space-between}form .form-field>label{min-width:12em;padding:.5em 0;font-size:16px;align-self:center}form .form-field>div{width:100%;align-self:center}a{text-decoration:none;color:#536dfe}a:visited{text-decoration:none;color:#536dfe}a:hover,a:active,a:focus{text-decoration:none;cursor:pointer}pre,code,samp,kbd{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:1em;direction:ltr;text-align:left;background-color:#fbfaf9;color:#333;box-shadow:inset 0 0 .3em #ccc;border-radius:2px}#nojs{width:80%;text-align:center;vertical-align:middle;margin:10px auto;padding:3px;background-color:#ef5350;color:white;font-weight:bold;font-size:14px}#wrap{height:auto !important;min-height:100%;width:100%;background-color:#f5f5f5}#wrap-loading{position:fixed;z-index:9999;top:50%;left:50%;padding:1em;background-color:rgba(255,255,255,0.8);display:none;border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}#wrap-loading.overlay-full{top:0;left:0;width:100%;height:100%;background-color:rgba(255,255,255,0.5)}#wrap-loading.overlay-full #loading{position:absolute;top:50%;left:50%}#wrap-loading.overlay-full #taskStatus{display:block}#wrap-loading #taskStatus{display:none;position:absolute;left:0;top:55%;width:100%;text-align:center;color:white;background-color:rgba(0,0,0,0.5);padding:1em 0}#container{margin:auto;width:100%}#container.login{padding-top:5%}#container.error,#container.install,#container.passreset{width:100%}#container .logo{height:64px}#container #actions-bar{z-index:100;display:flex;justify-content:space-between;position:fixed;border:0 none;top:0;left:0;width:100%;padding:1em 0;background-color:transparent}#container #actions-bar-icons{flex-grow:1;text-align:center}#container #actions-bar-logo{display:none;padding:0 .5em}#container #actions-bar-logo img{display:inline-block;width:50px;opacity:.75}#container #content{width:95%;margin:2em auto 8em auto}#container #content.public-link{width:70%;min-height:0;margin:5em auto}#content td.descField,#box-popup td.descField{text-align:right;padding-right:20px;width:25%;border-right:1px solid #d9d9d9;color:#999;font-size:12px;font-weight:bold}#content td.valField,#box-popup td.valField{padding-left:1em;width:100%}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:none;width:100%;color:#607d8b;font-size:12px}#content .pager{width:100%;margin-top:15px;padding:.5em;vertical-align:middle;font-size:11px;color:#999;background-color:#fcfcfc}#content .pager img{margin-left:5px;vertical-align:middle}#content .pager a{margin-left:5px;font-size:12px;color:#999}#content .pager>div{display:inline-block;width:49%}#content .pager .pager-left{text-align:left}#content .pager .pager-right{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleNormal{background-color:#607d8b;color:#fff}#content .data-container{width:75%;margin:0 auto}#content fieldset.data{margin:2em auto}#content fieldset.data>legend{color:#607d8b;padding:0 .5em;font-size:1.5em}#content fieldset.data>div{display:none}#content fieldset.data>div table{width:100%}#content .data{width:100%;padding:10px;margin:0 auto;background-color:#fff;-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}#content .data #history-icon{position:relative;top:5em;right:2em}#content .data td{text-align:left}#content .data td.descField{text-align:right}#content .data select{min-width:210px}#content .data .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .dropzone{width:30em;padding:1em;border:2px dashed #26a69a;text-align:center}#content .data .dropzone img{vertical-align:middle}#content .data .file-upload{display:none}#content .data .account-permissions{width:100%}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content span.tag{margin:0 3px 3px 0;padding:.2em;background:#5c6bc0;color:#fff;border:0 solid transparent;border-radius:3px !important;-moz-border-radius:3px !important;-webkit-border-radius:3px !important}#content .extra-info{margin-top:20px}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff8e1;color:#ffca28;font-weight:bold}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#5c6bc0}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{display:inline-block;padding:.2em .5em;font-weight:bold;letter-spacing:.2em;color:#fff;text-align:center}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{display:flex;flex-wrap:wrap;justify-content:flex-start;margin:0}#content .data-header-minimal li{display:inline-flex;min-width:10em;font-weight:normal;letter-spacing:normal}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-table{width:100%}#content .data-table td:first-of-type,#content .data-table th:first-of-type{width:5em}#content .data-table thead th{background-color:#607d8b;color:#fff}#content .data-table tbody td.cell-data{text-align:left}#content .data-table tbody td.cell-nodata{padding:0 .5em;text-align:left}#content .data-table tbody td.cell-actions{text-align:right}#content .data-table tbody td.cell-actions i{opacity:.5}#content .data-table tbody td.cell-actions i:hover{opacity:1}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0;background-color:#fcfcfc}#content .data-rows li{float:left;display:block;padding:1em;color:#696969;text-align:center;min-height:2em}#content .data-rows li.cell-nodata{padding:1em 0;min-height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;min-height:2em;padding:1em 0;text-align:left;background-color:#fcfcfc;width:15em}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img{width:24px;height:24px;margin:0 .5em}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #searchbox{background-color:#fcfcfc;vertical-align:middle;position:relative;height:auto;padding:.5em 1em;margin-bottom:2em}#content #searchbox form{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;text-align:left}#content #searchbox .search-filters>*{margin:0 .5em}#content #searchbox .search-filters .filter-buttons{display:inline-block}#content #searchbox .search-filters .filter-slider{width:10em}#content #searchbox .search-filters-tags{display:none;flex-grow:2}#content .btn-clear{opacity:.35;filter:alpha(opacity=35)}#content .btn-clear:hover{opacity:1;filter:alpha(opacity=100)}#content .actions-optional{display:none}#content .error{width:350px;padding:15px;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#box-popup .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .list-wrap ul,#box-popup .list-wrap ul{list-style-type:none;margin:0;padding:0}#content .data .list-wrap li,#box-popup .list-wrap li{display:flex;background:#f2f2f2;padding:.5em;font-size:1em;margin-bottom:.5em}#content .data .list-wrap li:hover,#box-popup .list-wrap li:hover{background:#e8eaf6;color:#000}#content .data .list-wrap div.files-item-info,#box-popup .list-wrap div.files-item-info{flex-grow:2}#content .data .list-wrap div.files-item-info img,#box-popup .list-wrap div.files-item-info img{margin:0 .5em}#content .data .list-wrap div.files-item-actions,#box-popup .list-wrap div.files-item-actions{padding:.3em 0}#box-popup{min-width:30em;max-width:60em;margin:5em auto;padding:0;background-color:#fff}#box-popup.box-password-view{min-width:30em;max-width:35em}#box-popup>h2{position:relative;width:100%;font-size:18px;color:#fff;background-color:#607d8b;margin:0;padding:.5em 0;line-height:1em}#box-popup>h2 .btn-popup-close{display:none;position:absolute;right:.5em;top:.2em}#box-popup>table{width:100%;padding-bottom:1em}#box-popup select{width:220px}#box-popup #resFancyAccion{display:none}#box-popup #resCheck{display:inline-block;width:80%;height:4em;padding:1em 0}#box-popup.image{background-color:transparent;max-width:100%;margin:0 auto;border-radius:0 !important;-moz-border-radius:0 !important;-webkit-border-radius:0 !important}#box-popup.image img{width:auto;margin:0 auto}#box-popup.image>div.title{background-color:#607d8b;color:#fff;padding:.5em}#box-popup.help{min-height:100px;background-color:#f5f5f5}#box-popup.help p{font-size:14px;text-align:justify;line-height:2em}#box-complexity>div{text-align:justify;line-height:1.5em;margin-top:1em}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:#fff8e1;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.popup-data{width:100%;min-width:400px;border:0;text-align:left;margin:0;padding:1em .5em}.popup-data .descField{min-width:100px}footer{display:flex;justify-content:space-between;position:fixed;bottom:0;z-index:100;width:100%;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:1em;-webkit-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);-moz-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14)}footer .footer-parts{display:flex;justify-content:space-between}footer #footer-left{width:50%;margin:0 1em}footer #footer-right{width:50%;margin:0 1em;justify-content:flex-end;text-align:right}footer #updates{min-width:10em;text-align:center;cursor:pointer}footer #status{margin:0 1em}footer #status>div{display:inline-block}footer #status .status-info{padding:.5em}footer #session{text-align:left;color:#999;font-size:.8em}footer a{color:#b9b9b9}footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round,.round5{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.midround{border-radius:0 0 10px 10px !important;-moz-border-radius:0 0 10px 10px !important;-webkit-border-radius:0 0 10px 10px !important}.midroundup{border-radius:10px 10px 0 0 !important;-moz-border-radius:10px 10px 0 0 !important;-webkit-border-radius:10px 10px 0 0 !important}.fullround{border-radius:50% !important;-moz-border-radius:50% !important;-webkit-border-radius:50% !important}.iconMini{width:16px !important;height:16px !important;vertical-align:middle}.hide{display:none !important}.btn-checks{padding:5px;margin:.2em 0;width:30em;border-bottom:1px solid #c9c9c9}.shadow{-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}.noRes{width:60%;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-grey{background-color:#607d8b;color:#fff;min-height:2em}.no-background{background:none !important}.action-in-box{padding:1em;text-align:right}.action-in-box ul{list-style:none;margin:0;padding:0}.tab-data{margin:2em auto 0;width:75%}.item-actions{margin:1em auto}.tab-actions{margin:2em 0}.item-actions>ul,.tab-actions>ul{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;list-style:none;margin:0;padding:0}.item-actions>ul>li,.tab-actions>ul>li{width:auto;min-width:2em;margin-left:.5em}.item-actions>ul>li.datagrid-action-search,.tab-actions>ul>li.datagrid-action-search{min-width:5em}.item-actions>ul>li.datagrid-action-search form,.tab-actions>ul>li.datagrid-action-search form{width:100%}.fullWidth{max-width:100% !important}.filter-on{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;padding:.3em 1em}.global-on{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;padding:.3em 1em}.opacity50{filter:alpha(opacity=50);opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strongest:hover{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strong{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.strong:hover{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.good{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.good:hover{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.weak{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}.passLevel.weak:hover{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}.dialog-text,.dialog-user-text,.dialog-pass-text{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;padding:.5em;text-align:center;min-width:200px}.dialog-user-text{border-bottom:#d9d9d9 1px solid;color:#a9a9a9}.dialog-pass-text{border:transparent 1px solid;letter-spacing:.2em}.dialog-buttons{text-align:center;padding:.5em;border-top:1px solid #c9c9c9;line-height:2.5em}.dialog-clip-copy{color:#26a69a;background-color:#e0f2f1}.help-box{display:none;background-color:#fff !important;color:#607d8b}.help-box>*{font-weight:bold}.help-text{text-align:justify;line-height:1.5em;margin-top:1em}.tooltip{width:300px;max-width:300px;background-color:#777;color:#fff;z-index:101}.cursor-pointer{cursor:pointer}.password-actions{display:inline-block;width:12em}.password-actions>span,.password-actions i{margin-right:.6em}.custom-input-color{width:3em;height:1em;display:inline-block}.account-pass-image{height:32px;width:auto}.select-box{min-width:20em}fieldset.warning{padding:8px;border-radius:5px;color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}fieldset.warning legend{color:#ef5350 !important}fieldset.warning a{color:#ef5350 !important;font-weight:bold}#actions{width:100%;line-height:2em;margin-bottom:5em}#actions #logo{display:flex;width:100%;margin-bottom:30px;color:#607d8b;align-items:center;background:url("../imgs/logo_full_bg.png") left no-repeat;background-size:auto 150px;height:150px}#actions #page-title{width:100%;color:#607d8b;text-align:center}#actions #page-title h1{font-weight:bold;font-size:24px;letter-spacing:3px}#actions ul.errors{max-width:40vw;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:3px;padding:1em .5em}#actions ul.errors>li.msg-critical{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}#actions ul.errors>li.msg-warning{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;color:#555}#actions ul.errors>li.msg-ok{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#actions ul.errors>li>p.hint{color:#555;font-size:12px}#actions ul.errors>li>p.hint i{margin-right:.5em}#actions form{width:450px;margin:0 auto;text-align:left}#actions form fieldset{margin-bottom:2em}#actions form fieldset legend{width:100%;color:#fff;font-size:14px;font-weight:bold;text-align:center;background-color:#607d8b;margin:1em 0;letter-spacing:.2em;padding:.2em 0}#actions div.buttons{margin-top:2em;text-align:center}.center{text-align:center !important}.right{text-align:right !important}.left{text-align:left !important}.opacity50{opacity:.5 !important}#login-container{width:40em;margin:0 auto;background:transparent url("../imgs/logo_full_bg.png") no-repeat top left;background-size:auto 10em}#login-container #boxSpacer{height:11em;background-color:transparent}#login-container #boxLogin{position:relative;margin:0 auto;width:100%;min-height:14em;padding:1em;background-color:#fff}#login-container #boxLogin #boxData{height:100%;min-height:14em;text-align:left;background-color:transparent}#login-container #boxLogin #boxData i{margin-right:.5em;opacity:.5}#login-container #boxLogin #boxData .extra-hidden{display:none}#login-container #boxLogin #boxButton{position:absolute;top:2em;right:2em}#login-container #boxLogin #boxActions{width:100%;text-align:right}#login-container #boxLogin #boxActions a{color:#c9c9c9}#login-container #boxLogout{margin-top:4em;width:100%}#login-container #boxLogout>div{margin:0 auto;width:250px;font-size:14px;padding:.5em;text-align:center;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#login-container #boxUpdated{width:350px;margin:3em auto;font-size:14px;text-align:center;padding:.5em;color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#login-container #demo-info{margin:3em auto;color:#c9c9c9;border-top:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:.5em}#login-container #demo-info ul{display:flex;justify-content:space-around;list-style:none}#login-container #demo-info ul li span{margin:0 2em}@media screen and (max-width:1000px){#content #searchbox .search-filters>*{margin:.5em 1em .5em 0}#content .data-container #title,#content .tab-data #title{width:90%}footer{display:none;justify-content:space-between;flex-wrap:wrap}footer .footer-parts{justify-content:space-between;flex-wrap:wrap}footer #footer-left,footer #footer-right{width:100%}footer .footer-parts>div{width:100%;padding:.5em 0}}@media screen and (max-width:600px){#content input,#box-popup input{width:100%}#content .mdl-textfield,#box-popup .mdl-textfield{width:100%}#content td.descField,#box-popup td.descField{display:none}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:block}#content #searchbox .mdl-textfield{width:90%}#content #searchbox .search-text{width:90%}#content #searchbox .search-filters .selectize-control{width:100%}#content .data-container,#content .tab-data{width:100%}#content .data-container #title,#content .tab-data #title{width:90%}#content .data-container .selectize-control,#content .tab-data .selectize-control{width:100%}#box-popup h2>.btn-popup-close{display:inline-block}.mdl-data-table{table-layout:fixed;width:100%}.table-responsive td,.table-responsive th{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.table-responsive .cell-actions i{display:block !important}} \ No newline at end of file diff --git a/inc/themes/material-blue/css/styles.scss b/inc/themes/material-blue/css/styles.scss index aeb6d4fd..f8a391ab 100644 --- a/inc/themes/material-blue/css/styles.scss +++ b/inc/themes/material-blue/css/styles.scss @@ -195,9 +195,10 @@ .data { width: 100%; padding: 10px; - border: 1px solid #c9c9c9; + //border: 1px solid #d9d9d9; margin: 0 auto; - background-color: #f9f9f9; + background-color: #fff; + @include box-shadow(); #history-icon { position: relative; top: 5em; From 4ec365a7b9bef5a986fcd67b5a235d1322199e26 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Fri, 14 Apr 2017 10:36:15 +0200 Subject: [PATCH 08/22] * [MOD] Passwords string that need hashing (not related to accounts password) and its length greater than 72 characters, are now hashed using SHA256 and then BCRYPT. A message is shown in syspass.log file. --- inc/SP/Core/Crypt/Hash.class.php | 29 +++++++++++++++++++++++++++-- inc/SP/Util/Util.class.php | 2 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/inc/SP/Core/Crypt/Hash.class.php b/inc/SP/Core/Crypt/Hash.class.php index fc08cd68..5f5b97b9 100644 --- a/inc/SP/Core/Crypt/Hash.class.php +++ b/inc/SP/Core/Crypt/Hash.class.php @@ -31,6 +31,11 @@ namespace SP\Core\Crypt; */ class Hash { + /** + * Longitud máxima aceptada para hashing + */ + const MAX_KEY_LENGTH = 72; + /** * Comprobar el hash de una clave. * @@ -41,7 +46,27 @@ class Hash */ public static function checkHashKey($key, $hash) { - return password_verify($key, $hash); + return password_verify(self::getKey($key), $hash); + } + + /** + * Devolver la clave preparada. Se crea un hash si supera la longitud máxima. + * + * @param string $key + * @param bool $isCheck Indica si la operación es de comprobación o no + * @return string + */ + private static function getKey(&$key, $isCheck = true) + { + if (mb_strlen($key) > Hash::MAX_KEY_LENGTH) { + $key = hash('sha256', $key); + + if ($isCheck === false) { + debugLog('[INFO] Password string shortened using SHA256 and then BCRYPT'); + } + } + + return $key; } /** @@ -52,6 +77,6 @@ class Hash */ public static function hashKey($key) { - return password_hash($key, PASSWORD_BCRYPT); + return password_hash(self::getKey($key, false), PASSWORD_BCRYPT); } } \ No newline at end of file diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 23eb0820..5179a587 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041304; + $build = 17041401; $version = [2, 1, 6]; if ($normalized === true) { From cf28348c4ee3f2a362d91aa230d78a9603e05e16 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Fri, 14 Apr 2017 13:54:18 +0200 Subject: [PATCH 09/22] * [FIX] Related #540. Set the LDAP server port when it's set within the hostname. Thanks to @bitking for the feedback. --- inc/SP/Auth/Ldap/LdapBase.class.php | 18 +++++++++++++++++- inc/SP/Util/Util.class.php | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/inc/SP/Auth/Ldap/LdapBase.class.php b/inc/SP/Auth/Ldap/LdapBase.class.php index 143c4178..ed0d7d58 100644 --- a/inc/SP/Auth/Ldap/LdapBase.class.php +++ b/inc/SP/Auth/Ldap/LdapBase.class.php @@ -62,6 +62,10 @@ abstract class LdapBase implements LdapInterface, AuthInterface * @var string */ protected $server; + /** + * @var int + */ + protected $serverPort; /** * @var string */ @@ -161,7 +165,7 @@ abstract class LdapBase implements LdapInterface, AuthInterface @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); } - $this->ldapHandler = @ldap_connect($this->server); + $this->ldapHandler = @ldap_connect($this->server, $this->serverPort); // Conexión al servidor LDAP if (!is_resource($this->ldapHandler)) { @@ -320,6 +324,7 @@ abstract class LdapBase implements LdapInterface, AuthInterface public function setServer($server) { $this->server = $server; + $this->serverPort = $this->getServerPort(); } /** @@ -437,6 +442,7 @@ abstract class LdapBase implements LdapInterface, AuthInterface { $this->searchBase = Config::getConfig()->getLdapBase(); $this->server = $this->pickServer(); + $this->serverPort = $this->getServerPort(); $this->bindDn = Config::getConfig()->getLdapBindUser(); $this->bindPass = Config::getConfig()->getLdapBindPass(); $this->group = Config::getConfig()->getLdapGroup(); @@ -454,6 +460,16 @@ abstract class LdapBase implements LdapInterface, AuthInterface return true; } + /** + * Devolver el puerto del servidor si está establecido + * + * @return int + */ + protected function getServerPort() + { + return preg_match('/[\d\.]+:(\d+)/', $this->server, $port) ? $port[1] : 389; + } + /** * Obtener el servidor de LDAP a utilizar * diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 5179a587..6b068413 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,8 +407,8 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041401; - $version = [2, 1, 6]; + $build = 17041402; + $version = [2, 1, 7]; if ($normalized === true) { return [implode('', $version), $build]; From 7dad1b1fcb63e050d5350698c402812da2c70767 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Tue, 18 Apr 2017 17:20:29 +0200 Subject: [PATCH 10/22] * [FIX] Solves #533. Fixed capitalized multibyte characters that weren't encoded properly. Thanks to @NickWoo33 for the feedback. --- ajax/ajax_filesMgmt.php | 4 ++-- inc/SP/Controller/MainController.class.php | 4 ++-- inc/SP/Http/Response.class.php | 17 +++++++++++++++-- inc/SP/Import/FileImport.class.php | 2 +- inc/SP/Import/XmlImport.class.php | 2 +- inc/SP/Mgmt/Files/FileUtil.class.php | 2 +- inc/SP/Util/Json.class.php | 4 ++-- inc/themes/material-blue/css/styles.min.css | 2 +- .../material-blue/views/accountsearch/rows.inc | 4 ++-- .../material-blue/views/eventlog/eventlog.inc | 2 +- js/app-actions.min.js | 2 +- js/app-main.min.js | 2 +- 12 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ajax/ajax_filesMgmt.php b/ajax/ajax_filesMgmt.php index 315c9c51..214469c9 100644 --- a/ajax/ajax_filesMgmt.php +++ b/ajax/ajax_filesMgmt.php @@ -90,7 +90,7 @@ if ($actionId === ActionsInterface::ACTION_ACC_FILES_UPLOAD) { if ($FileData->getAccfileName() !== '') { // Comprobamos la extensión del archivo - $FileData->setAccfileExtension(strtoupper(pathinfo($FileData->getAccfileName(), PATHINFO_EXTENSION))); + $FileData->setAccfileExtension(mb_strtoupper(pathinfo($FileData->getAccfileName(), PATHINFO_EXTENSION))); if (!in_array($FileData->getAccfileExtension(), $allowedExts)) { $LogMessage->addDescription(__('Tipo de archivo no soportado', false)); @@ -186,7 +186,7 @@ if ($actionId === ActionsInterface::ACTION_ACC_FILES_UPLOAD) { exit('
    ' . $FileData->getAccfileName() . '
    '); // } elseif ( strtoupper($fileExt) == "PDF" ){ // echo ''; - } elseif (strtoupper($FileData->getAccfileExtension()) === 'TXT') { + } elseif (mb_strtoupper($FileData->getAccfileExtension()) === 'TXT') { exit('
    ' . htmlentities($FileData->getAccfileContent()) . '
    '); } else { exit(); diff --git a/inc/SP/Controller/MainController.class.php b/inc/SP/Controller/MainController.class.php index c0aeb892..519ea098 100644 --- a/inc/SP/Controller/MainController.class.php +++ b/inc/SP/Controller/MainController.class.php @@ -238,8 +238,8 @@ class MainController extends ControllerBase implements ActionsInterface $this->view->assign('userType', $userType); $this->view->assign('userId', $this->UserData->getUserId()); - $this->view->assign('userLogin', strtoupper($this->UserData->getUserLogin())); - $this->view->assign('userName', $this->UserData->getUserName() ?: strtoupper($this->view->userLogin)); + $this->view->assign('userLogin', mb_strtoupper($this->UserData->getUserLogin())); + $this->view->assign('userName', $this->UserData->getUserName() ?: mb_strtoupper($this->view->userLogin)); $this->view->assign('userGroup', $this->UserData->getUsergroupName()); $this->view->assign('showPassIcon', !(Config::getConfig()->isLdapEnabled() && $this->UserData->isUserIsLdap())); $this->view->assign('userNotices', count(Notice::getItem()->getAllActiveForUser())); diff --git a/inc/SP/Http/Response.class.php b/inc/SP/Http/Response.class.php index bfee2f91..4f984126 100644 --- a/inc/SP/Http/Response.class.php +++ b/inc/SP/Http/Response.class.php @@ -24,6 +24,7 @@ namespace SP\Http; +use SP\Core\Exceptions\SPException; use SP\Util\Json; defined('APP_ROOT') || die(); @@ -83,8 +84,20 @@ class Response $json = $data; } - header('Content-type: application/json'); - exit(Json::getJson($json)); + header('Content-type: application/json; charset=utf-8'); + + try { + exit(Json::getJson($json)); + } catch (SPException $e) { + $data['status'] = 1; + $data['description'] = __($e->getMessage()); + + if (isset($data['html'])) { + $data['html'] = __($e->getMessage()); + } + + exit(json_encode($data)); + } } /** diff --git a/inc/SP/Import/FileImport.class.php b/inc/SP/Import/FileImport.class.php index 36632326..d5b2fdcb 100644 --- a/inc/SP/Import/FileImport.class.php +++ b/inc/SP/Import/FileImport.class.php @@ -89,7 +89,7 @@ class FileImport if ($fileData['name']) { // Comprobamos la extensión del archivo - $fileExtension = strtoupper(pathinfo($fileData['name'], PATHINFO_EXTENSION)); + $fileExtension = mb_strtoupper(pathinfo($fileData['name'], PATHINFO_EXTENSION)); if ($fileExtension !== 'CSV' && $fileExtension !== 'XML') { throw new SPException( diff --git a/inc/SP/Import/XmlImport.class.php b/inc/SP/Import/XmlImport.class.php index b1eb87e3..99949b42 100644 --- a/inc/SP/Import/XmlImport.class.php +++ b/inc/SP/Import/XmlImport.class.php @@ -96,7 +96,7 @@ class XmlImport implements ImportInterface $this->Import->setXmlDOM($XmlFileImport->getXmlDOM()); $this->Import->setLogMessage($this->LogMessage); - $this->LogMessage->addDescription(sprintf(__('Formato detectado: %s'), strtoupper($format))); + $this->LogMessage->addDescription(sprintf(__('Formato detectado: %s'), mb_strtoupper($format))); $this->Import->doImport(); } diff --git a/inc/SP/Mgmt/Files/FileUtil.class.php b/inc/SP/Mgmt/Files/FileUtil.class.php index dba7b904..dc5bf555 100644 --- a/inc/SP/Mgmt/Files/FileUtil.class.php +++ b/inc/SP/Mgmt/Files/FileUtil.class.php @@ -110,6 +110,6 @@ class FileUtil */ public static function isImage(FileData $FileData) { - return in_array(strtoupper($FileData->getAccfileExtension()), FileUtil::$imageExtensions); + return in_array(mb_strtoupper($FileData->getAccfileExtension()), FileUtil::$imageExtensions); } } \ No newline at end of file diff --git a/inc/SP/Util/Json.class.php b/inc/SP/Util/Json.class.php index f89b80e6..5046f90a 100644 --- a/inc/SP/Util/Json.class.php +++ b/inc/SP/Util/Json.class.php @@ -43,7 +43,7 @@ class Json */ public static function returnJson(JsonResponse $JsonResponse) { - header('Content-type: application/json'); + header('Content-type: application/json; charset=utf-8'); try { exit(self::getJson($JsonResponse)); @@ -65,7 +65,7 @@ class Json */ public static function getJson($data) { - $json = json_encode($data); + $json = json_encode($data, JSON_PARTIAL_OUTPUT_ON_ERROR); if ($json === false) { throw new SPException(SPException::SP_CRITICAL, __('Error de codificación', false), json_last_error_msg()); diff --git a/inc/themes/material-blue/css/styles.min.css b/inc/themes/material-blue/css/styles.min.css index 25e5c7fb..f97b35de 100644 --- a/inc/themes/material-blue/css/styles.min.css +++ b/inc/themes/material-blue/css/styles.min.css @@ -1 +1 @@ -html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal;box-sizing:border-box}*{font-family:"Roboto Regular",Verdana,Tahoma,sans-serif;box-sizing:inherit}*:before,*:after{box-sizing:inherit}table{font-size:11px;border-spacing:0}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr{height:20px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9 !important}table tr.even:hover,table tr.odd:hover{background-color:#e8ff99}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;margin:0}input.inputImg,img.inputImg{background-color:transparent !important;width:24px !important;height:24px !important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px;resize:none}select.files{width:250px}input.spinner{width:5em}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent !important;width:16px !important;height:16px !important;margin:0 5px 0 5px;border:0;vertical-align:middle}i{cursor:pointer}form .form-field{display:flex;justify-content:space-between}form .form-field>label{min-width:12em;padding:.5em 0;font-size:16px;align-self:center}form .form-field>div{width:100%;align-self:center}a{text-decoration:none;color:#536dfe}a:visited{text-decoration:none;color:#536dfe}a:hover,a:active,a:focus{text-decoration:none;cursor:pointer}pre,code,samp,kbd{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:1em;direction:ltr;text-align:left;background-color:#fbfaf9;color:#333;box-shadow:inset 0 0 .3em #ccc;border-radius:2px}#nojs{width:80%;text-align:center;vertical-align:middle;margin:10px auto;padding:3px;background-color:#ef5350;color:white;font-weight:bold;font-size:14px}#wrap{height:auto !important;min-height:100%;width:100%;background-color:#f5f5f5}#wrap-loading{position:fixed;z-index:9999;top:50%;left:50%;padding:1em;background-color:rgba(255,255,255,0.8);display:none;border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}#wrap-loading.overlay-full{top:0;left:0;width:100%;height:100%;background-color:rgba(255,255,255,0.5)}#wrap-loading.overlay-full #loading{position:absolute;top:50%;left:50%}#wrap-loading.overlay-full #taskStatus{display:block}#wrap-loading #taskStatus{display:none;position:absolute;left:0;top:55%;width:100%;text-align:center;color:white;background-color:rgba(0,0,0,0.5);padding:1em 0}#container{margin:auto;width:100%}#container.login{padding-top:5%}#container.error,#container.install,#container.passreset{width:100%}#container .logo{height:64px}#container #actions-bar{z-index:100;display:flex;justify-content:space-between;position:fixed;border:0 none;top:0;left:0;width:100%;padding:1em 0;background-color:transparent}#container #actions-bar-icons{flex-grow:1;text-align:center}#container #actions-bar-logo{display:none;padding:0 .5em}#container #actions-bar-logo img{display:inline-block;width:50px;opacity:.75}#container #content{width:95%;margin:2em auto 8em auto}#container #content.public-link{width:70%;min-height:0;margin:5em auto}#content td.descField,#box-popup td.descField{text-align:right;padding-right:20px;width:25%;border-right:1px solid #d9d9d9;color:#999;font-size:12px;font-weight:bold}#content td.valField,#box-popup td.valField{padding-left:1em;width:100%}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:none;width:100%;color:#607d8b;font-size:12px}#content .pager{width:100%;margin-top:15px;padding:.5em;vertical-align:middle;font-size:11px;color:#999;background-color:#fcfcfc}#content .pager img{margin-left:5px;vertical-align:middle}#content .pager a{margin-left:5px;font-size:12px;color:#999}#content .pager>div{display:inline-block;width:49%}#content .pager .pager-left{text-align:left}#content .pager .pager-right{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleNormal{background-color:#607d8b;color:#fff}#content .data-container{width:75%;margin:0 auto}#content fieldset.data{margin:2em auto}#content fieldset.data>legend{color:#607d8b;padding:0 .5em;font-size:1.5em}#content fieldset.data>div{display:none}#content fieldset.data>div table{width:100%}#content .data{width:100%;padding:10px;margin:0 auto;background-color:#fff;-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}#content .data #history-icon{position:relative;top:5em;right:2em}#content .data td{text-align:left}#content .data td.descField{text-align:right}#content .data select{min-width:210px}#content .data .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .dropzone{width:30em;padding:1em;border:2px dashed #26a69a;text-align:center}#content .data .dropzone img{vertical-align:middle}#content .data .file-upload{display:none}#content .data .account-permissions{width:100%}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content span.tag{margin:0 3px 3px 0;padding:.2em;background:#5c6bc0;color:#fff;border:0 solid transparent;border-radius:3px !important;-moz-border-radius:3px !important;-webkit-border-radius:3px !important}#content .extra-info{margin-top:20px}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff8e1;color:#ffca28;font-weight:bold}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#5c6bc0}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{display:inline-block;padding:.2em .5em;font-weight:bold;letter-spacing:.2em;color:#fff;text-align:center}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{display:flex;flex-wrap:wrap;justify-content:flex-start;margin:0}#content .data-header-minimal li{display:inline-flex;min-width:10em;font-weight:normal;letter-spacing:normal}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-table{width:100%}#content .data-table td:first-of-type,#content .data-table th:first-of-type{width:5em}#content .data-table thead th{background-color:#607d8b;color:#fff}#content .data-table tbody td.cell-data{text-align:left}#content .data-table tbody td.cell-nodata{padding:0 .5em;text-align:left}#content .data-table tbody td.cell-actions{text-align:right}#content .data-table tbody td.cell-actions i{opacity:.5}#content .data-table tbody td.cell-actions i:hover{opacity:1}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0;background-color:#fcfcfc}#content .data-rows li{float:left;display:block;padding:1em;color:#696969;text-align:center;min-height:2em}#content .data-rows li.cell-nodata{padding:1em 0;min-height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;min-height:2em;padding:1em 0;text-align:left;background-color:#fcfcfc;width:15em}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img{width:24px;height:24px;margin:0 .5em}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #searchbox{background-color:#fcfcfc;vertical-align:middle;position:relative;height:auto;padding:.5em 1em;margin-bottom:2em}#content #searchbox form{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;text-align:left}#content #searchbox .search-filters>*{margin:0 .5em}#content #searchbox .search-filters .filter-buttons{display:inline-block}#content #searchbox .search-filters .filter-slider{width:10em}#content #searchbox .search-filters-tags{display:none;flex-grow:2}#content .btn-clear{opacity:.35;filter:alpha(opacity=35)}#content .btn-clear:hover{opacity:1;filter:alpha(opacity=100)}#content .actions-optional{display:none}#content .error{width:350px;padding:15px;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#box-popup .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .list-wrap ul,#box-popup .list-wrap ul{list-style-type:none;margin:0;padding:0}#content .data .list-wrap li,#box-popup .list-wrap li{display:flex;background:#f2f2f2;padding:.5em;font-size:1em;margin-bottom:.5em}#content .data .list-wrap li:hover,#box-popup .list-wrap li:hover{background:#e8eaf6;color:#000}#content .data .list-wrap div.files-item-info,#box-popup .list-wrap div.files-item-info{flex-grow:2}#content .data .list-wrap div.files-item-info img,#box-popup .list-wrap div.files-item-info img{margin:0 .5em}#content .data .list-wrap div.files-item-actions,#box-popup .list-wrap div.files-item-actions{padding:.3em 0}#box-popup{min-width:30em;max-width:60em;margin:5em auto;padding:0;background-color:#fff}#box-popup.box-password-view{min-width:30em;max-width:35em}#box-popup>h2{position:relative;width:100%;font-size:18px;color:#fff;background-color:#607d8b;margin:0;padding:.5em 0;line-height:1em}#box-popup>h2 .btn-popup-close{display:none;position:absolute;right:.5em;top:.2em}#box-popup>table{width:100%;padding-bottom:1em}#box-popup select{width:220px}#box-popup #resFancyAccion{display:none}#box-popup #resCheck{display:inline-block;width:80%;height:4em;padding:1em 0}#box-popup.image{background-color:transparent;max-width:100%;margin:0 auto;border-radius:0 !important;-moz-border-radius:0 !important;-webkit-border-radius:0 !important}#box-popup.image img{width:auto;margin:0 auto}#box-popup.image>div.title{background-color:#607d8b;color:#fff;padding:.5em}#box-popup.help{min-height:100px;background-color:#f5f5f5}#box-popup.help p{font-size:14px;text-align:justify;line-height:2em}#box-complexity>div{text-align:justify;line-height:1.5em;margin-top:1em}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:#fff8e1;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.popup-data{width:100%;min-width:400px;border:0;text-align:left;margin:0;padding:1em .5em}.popup-data .descField{min-width:100px}footer{display:flex;justify-content:space-between;position:fixed;bottom:0;z-index:100;width:100%;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:1em;-webkit-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);-moz-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14)}footer .footer-parts{display:flex;justify-content:space-between}footer #footer-left{width:50%;margin:0 1em}footer #footer-right{width:50%;margin:0 1em;justify-content:flex-end;text-align:right}footer #updates{min-width:10em;text-align:center;cursor:pointer}footer #status{margin:0 1em}footer #status>div{display:inline-block}footer #status .status-info{padding:.5em}footer #session{text-align:left;color:#999;font-size:.8em}footer a{color:#b9b9b9}footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round,.round5{border-radius:5px !important;-moz-border-radius:5px !important;-webkit-border-radius:5px !important}.midround{border-radius:0 0 10px 10px !important;-moz-border-radius:0 0 10px 10px !important;-webkit-border-radius:0 0 10px 10px !important}.midroundup{border-radius:10px 10px 0 0 !important;-moz-border-radius:10px 10px 0 0 !important;-webkit-border-radius:10px 10px 0 0 !important}.fullround{border-radius:50% !important;-moz-border-radius:50% !important;-webkit-border-radius:50% !important}.iconMini{width:16px !important;height:16px !important;vertical-align:middle}.hide{display:none !important}.btn-checks{padding:5px;margin:.2em 0;width:30em;border-bottom:1px solid #c9c9c9}.shadow{-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}.noRes{width:60%;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-grey{background-color:#607d8b;color:#fff;min-height:2em}.no-background{background:none !important}.action-in-box{padding:1em;text-align:right}.action-in-box ul{list-style:none;margin:0;padding:0}.tab-data{margin:2em auto 0;width:75%}.item-actions{margin:1em auto}.tab-actions{margin:2em 0}.item-actions>ul,.tab-actions>ul{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;list-style:none;margin:0;padding:0}.item-actions>ul>li,.tab-actions>ul>li{width:auto;min-width:2em;margin-left:.5em}.item-actions>ul>li.datagrid-action-search,.tab-actions>ul>li.datagrid-action-search{min-width:5em}.item-actions>ul>li.datagrid-action-search form,.tab-actions>ul>li.datagrid-action-search form{width:100%}.fullWidth{max-width:100% !important}.filter-on{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;padding:.3em 1em}.global-on{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;padding:.3em 1em}.opacity50{filter:alpha(opacity=50);opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strongest:hover{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strong{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.strong:hover{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.good{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.good:hover{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.weak{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}.passLevel.weak:hover{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}.dialog-text,.dialog-user-text,.dialog-pass-text{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;padding:.5em;text-align:center;min-width:200px}.dialog-user-text{border-bottom:#d9d9d9 1px solid;color:#a9a9a9}.dialog-pass-text{border:transparent 1px solid;letter-spacing:.2em}.dialog-buttons{text-align:center;padding:.5em;border-top:1px solid #c9c9c9;line-height:2.5em}.dialog-clip-copy{color:#26a69a;background-color:#e0f2f1}.help-box{display:none;background-color:#fff !important;color:#607d8b}.help-box>*{font-weight:bold}.help-text{text-align:justify;line-height:1.5em;margin-top:1em}.tooltip{width:300px;max-width:300px;background-color:#777;color:#fff;z-index:101}.cursor-pointer{cursor:pointer}.password-actions{display:inline-block;width:12em}.password-actions>span,.password-actions i{margin-right:.6em}.custom-input-color{width:3em;height:1em;display:inline-block}.account-pass-image{height:32px;width:auto}.select-box{min-width:20em}fieldset.warning{padding:8px;border-radius:5px;color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}fieldset.warning legend{color:#ef5350 !important}fieldset.warning a{color:#ef5350 !important;font-weight:bold}#actions{width:100%;line-height:2em;margin-bottom:5em}#actions #logo{display:flex;width:100%;margin-bottom:30px;color:#607d8b;align-items:center;background:url("../imgs/logo_full_bg.png") left no-repeat;background-size:auto 150px;height:150px}#actions #page-title{width:100%;color:#607d8b;text-align:center}#actions #page-title h1{font-weight:bold;font-size:24px;letter-spacing:3px}#actions ul.errors{max-width:40vw;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:3px;padding:1em .5em}#actions ul.errors>li.msg-critical{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}#actions ul.errors>li.msg-warning{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;color:#555}#actions ul.errors>li.msg-ok{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#actions ul.errors>li>p.hint{color:#555;font-size:12px}#actions ul.errors>li>p.hint i{margin-right:.5em}#actions form{width:450px;margin:0 auto;text-align:left}#actions form fieldset{margin-bottom:2em}#actions form fieldset legend{width:100%;color:#fff;font-size:14px;font-weight:bold;text-align:center;background-color:#607d8b;margin:1em 0;letter-spacing:.2em;padding:.2em 0}#actions div.buttons{margin-top:2em;text-align:center}.center{text-align:center !important}.right{text-align:right !important}.left{text-align:left !important}.opacity50{opacity:.5 !important}#login-container{width:40em;margin:0 auto;background:transparent url("../imgs/logo_full_bg.png") no-repeat top left;background-size:auto 10em}#login-container #boxSpacer{height:11em;background-color:transparent}#login-container #boxLogin{position:relative;margin:0 auto;width:100%;min-height:14em;padding:1em;background-color:#fff}#login-container #boxLogin #boxData{height:100%;min-height:14em;text-align:left;background-color:transparent}#login-container #boxLogin #boxData i{margin-right:.5em;opacity:.5}#login-container #boxLogin #boxData .extra-hidden{display:none}#login-container #boxLogin #boxButton{position:absolute;top:2em;right:2em}#login-container #boxLogin #boxActions{width:100%;text-align:right}#login-container #boxLogin #boxActions a{color:#c9c9c9}#login-container #boxLogout{margin-top:4em;width:100%}#login-container #boxLogout>div{margin:0 auto;width:250px;font-size:14px;padding:.5em;text-align:center;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#login-container #boxUpdated{width:350px;margin:3em auto;font-size:14px;text-align:center;padding:.5em;color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#login-container #demo-info{margin:3em auto;color:#c9c9c9;border-top:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:.5em}#login-container #demo-info ul{display:flex;justify-content:space-around;list-style:none}#login-container #demo-info ul li span{margin:0 2em}@media screen and (max-width:1000px){#content #searchbox .search-filters>*{margin:.5em 1em .5em 0}#content .data-container #title,#content .tab-data #title{width:90%}footer{display:none;justify-content:space-between;flex-wrap:wrap}footer .footer-parts{justify-content:space-between;flex-wrap:wrap}footer #footer-left,footer #footer-right{width:100%}footer .footer-parts>div{width:100%;padding:.5em 0}}@media screen and (max-width:600px){#content input,#box-popup input{width:100%}#content .mdl-textfield,#box-popup .mdl-textfield{width:100%}#content td.descField,#box-popup td.descField{display:none}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:block}#content #searchbox .mdl-textfield{width:90%}#content #searchbox .search-text{width:90%}#content #searchbox .search-filters .selectize-control{width:100%}#content .data-container,#content .tab-data{width:100%}#content .data-container #title,#content .tab-data #title{width:90%}#content .data-container .selectize-control,#content .tab-data .selectize-control{width:100%}#box-popup h2>.btn-popup-close{display:inline-block}.mdl-data-table{table-layout:fixed;width:100%}.table-responsive td,.table-responsive th{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.table-responsive .cell-actions i{display:block !important}} \ No newline at end of file +html,body{margin:0;padding:0;text-align:left;background-color:#f5f5f5;color:#555;font-size:12px;font-weight:normal;box-sizing:border-box}*{font-family:"Roboto Regular",Verdana,Tahoma,sans-serif;box-sizing:inherit}*:before,*:after{box-sizing:inherit}table{font-size:11px;border-spacing:0}table th{border-bottom:2px solid transparent;vertical-align:middle}table th .icon{width:24px;height:24px}table tr{height:20px}table tr.odd{background-color:#f9f9f9}table tr.even>td,table tr.odd>td{border-bottom:1px solid #d9d9d9!important}table tr.even:hover,table tr.odd:hover{background-color:#e8ff99}table td{padding:3px}table td.txtCliente{font-weight:bold;text-align:center}form{font-size:11px;margin:0}input.inputImg,img.inputImg{background-color:transparent!important;width:24px!important;height:24px!important;border:0;vertical-align:middle;margin:0 .5em}input.txtFile{width:200px}input.txtLong{width:300px}textarea{width:350px;resize:none}select.files{width:250px}input.spinner{width:5em}img{margin:0;padding:0;border:0;cursor:pointer}img.inputImgMini{background-color:transparent!important;width:16px!important;height:16px!important;margin:0 5px 0 5px;border:0;vertical-align:middle}i{cursor:pointer}form .form-field{display:flex;justify-content:space-between}form .form-field>label{min-width:12em;padding:.5em 0;font-size:16px;align-self:center}form .form-field>div{width:100%;align-self:center}a{text-decoration:none;color:#536dfe}a:visited{text-decoration:none;color:#536dfe}a:hover,a:active,a:focus{text-decoration:none;cursor:pointer}pre,code,samp,kbd{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;font-size:1em;direction:ltr;text-align:left;background-color:#fbfaf9;color:#333;box-shadow:inset 0 0 .3em #ccc;border-radius:2px}#nojs{width:80%;text-align:center;vertical-align:middle;margin:10px auto;padding:3px;background-color:#ef5350;color:white;font-weight:bold;font-size:14px}#wrap{height:auto!important;min-height:100%;width:100%;background-color:#f5f5f5}#wrap-loading{position:fixed;z-index:9999;top:50%;left:50%;padding:1em;background-color:rgba(255,255,255,0.8);display:none;border-radius:5px!important;-moz-border-radius:5px!important;-webkit-border-radius:5px!important}#wrap-loading.overlay-full{top:0;left:0;width:100%;height:100%;background-color:rgba(255,255,255,0.5)}#wrap-loading.overlay-full #loading{position:absolute;top:50%;left:50%}#wrap-loading.overlay-full #taskStatus{display:block}#wrap-loading #taskStatus{display:none;position:absolute;left:0;top:55%;width:100%;text-align:center;color:white;background-color:rgba(0,0,0,0.5);padding:1em 0}#container{margin:auto;width:100%}#container.login{padding-top:5%}#container.error,#container.install,#container.passreset{width:100%}#container .logo{height:64px}#container #actions-bar{z-index:100;display:flex;justify-content:space-between;position:fixed;border:0 none;top:0;left:0;width:100%;padding:1em 0;background-color:transparent}#container #actions-bar-icons{flex-grow:1;text-align:center}#container #actions-bar-logo{display:none;padding:0 .5em}#container #actions-bar-logo img{display:inline-block;width:50px;opacity:.75}#container #content{width:95%;margin:2em auto 8em auto}#container #content.public-link{width:70%;min-height:0;margin:5em auto}#content td.descField,#box-popup td.descField{text-align:right;padding-right:20px;width:25%;border-right:1px solid #d9d9d9;color:#999;font-size:12px;font-weight:bold}#content td.valField,#box-popup td.valField{padding-left:1em;width:100%}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:none;width:100%;color:#607d8b;font-size:12px}#content .pager{width:100%;margin-top:15px;padding:.5em;vertical-align:middle;font-size:11px;color:#999;background-color:#fcfcfc}#content .pager img{margin-left:5px;vertical-align:middle}#content .pager a{margin-left:5px;font-size:12px;color:#999}#content .pager>div{display:inline-block;width:49%}#content .pager .pager-left{text-align:left}#content .pager .pager-right{text-align:right}#content #title{width:50%;padding:7px;margin:auto;background-color:#d9d9d9;color:#fff;font-size:17px;letter-spacing:.3em;text-align:center}#content #title.titleNormal{background-color:#607d8b;color:#fff}#content .data-container{width:75%;margin:0 auto}#content fieldset.data{margin:2em auto}#content fieldset.data>legend{color:#607d8b;padding:0 .5em;font-size:1.5em}#content fieldset.data>div{display:none}#content fieldset.data>div table{width:100%}#content .data{width:100%;padding:10px;margin:0 auto;background-color:#fff;-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}#content .data #history-icon{position:relative;top:5em;right:2em}#content .data td{text-align:left}#content .data td.descField{text-align:right}#content .data select{min-width:210px}#content .data .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .dropzone{width:30em;padding:1em;border:2px dashed #26a69a;text-align:center}#content .data .dropzone img{vertical-align:middle}#content .data .file-upload{display:none}#content .data .account-permissions{width:100%}#content .data .account-permissions fieldset{border:1px solid #c9c9c9;padding:1em}#content .data .account-permissions legend{font-weight:bold;color:#999;padding:.2em 0}#content .data .account-permissions fieldset>span{font-weight:bold;color:#999;padding:.2em 0;display:inline-block;width:100px;text-align:right}#content span.tag{margin:0 3px 3px 0;padding:.2em;background:#5c6bc0;color:#fff;border:0 solid transparent;border-radius:3px!important;-moz-border-radius:3px!important;-webkit-border-radius:3px!important}#content .extra-info{margin-top:20px}#content #tabs fieldset{border:1px solid #c9c9c9}#content #tabs #frmConfig label{float:left}#content .tblConfig{margin-bottom:2em}#content .tblConfig td.descField{width:35%;font-size:11px;font-weight:bold}#content .tblConfig td.rowHeader{padding:5px 0 5px 0;background-color:#f5f5f5;text-align:center;font-weight:bold;border-top:15px solid #f9f9f9;border-bottom:3px solid #a9c1d7;letter-spacing:.5em;color:#696969}#content .tblConfig input.checkbox{width:15px;text-align:left;padding:0}#content .tblConfig .option-disabled{text-align:center;background-color:#fff8e1;color:#ffca28;font-weight:bold}#content h2{width:100%;height:1.5em;font-size:18px;color:white;background-color:#a9c1d7;margin:0;padding-top:.1em}#content .section{margin-top:2.5em;border-bottom:1px solid #d9d9d9;text-align:left;font-size:14px;font-weight:bold;color:#5c6bc0}#content .row_even>td{background-color:#f5f5f5}#content .row_odd>td{background-color:white}#content .data-header ul{list-style:none;width:100%;margin:0 0 10px 0;padding:0}#content .data-header li{display:inline-block;padding:.2em .5em;font-weight:bold;letter-spacing:.2em;color:#fff;text-align:center}#content .data-header li a{color:#777}#content .data-header li img{float:right;width:24px;height:24px;vertical-align:middle}#content .data-header-minimal{border-bottom:1px solid #dfdfdf}#content .data-header-minimal ul{display:flex;flex-wrap:wrap;justify-content:flex-start;margin:0}#content .data-header-minimal li{display:inline-flex;min-width:10em;font-weight:normal;letter-spacing:normal}#content .data-header-minimal li a{color:#b9b9b9;padding:.3em .8em}#content .data-table{width:100%}#content .data-table td:first-of-type,#content .data-table th:first-of-type{width:5em}#content .data-table thead th{background-color:#607d8b;color:#fff}#content .data-table tbody td.cell-data{text-align:left}#content .data-table tbody td.cell-nodata{padding:0 .5em;text-align:left}#content .data-table tbody td.cell-actions{text-align:right}#content .data-table tbody td.cell-actions i{opacity:.5}#content .data-table tbody td.cell-actions i:hover{opacity:1}#content .data-rows ul{display:table;list-style:none;width:100%;margin:0 0 10px 0;padding:0;background-color:#fcfcfc}#content .data-rows li{float:left;display:block;padding:1em;color:#696969;text-align:center;min-height:2em}#content .data-rows li.cell-nodata{padding:1em 0;min-height:2em;text-align:left}#content .data-rows li.cell-actions{float:right;min-height:2em;padding:1em 0;text-align:left;background-color:#fcfcfc;width:15em}#content .data-rows li.cell-nodata img,#content .data-rows li.cell-actions img{width:24px;height:24px;margin:0 .5em}#content #resEventLog .data{width:100%}#content #resEventLog thead{text-align:center}#content #resEventLog tbody{width:100%;height:500px;overflow:auto}#content #resEventLog td{border-bottom:1px solid #d9d9d9}#content #resEventLog .cell{text-align:center}#content #resEventLog .cell-description{width:60%}#content #searchbox{background-color:#fcfcfc;vertical-align:middle;position:relative;height:auto;padding:.5em 1em;margin-bottom:2em}#content #searchbox form{display:flex;flex-wrap:wrap;justify-content:flex-start;align-items:center;text-align:left}#content #searchbox .search-filters>*{margin:0 .5em}#content #searchbox .search-filters .filter-buttons{display:inline-block}#content #searchbox .search-filters .filter-slider{width:10em}#content #searchbox .search-filters-tags{display:none;flex-grow:2}#content .btn-clear{opacity:.35;filter:alpha(opacity=35)}#content .btn-clear:hover{opacity:1;filter:alpha(opacity=100)}#content .actions-optional{display:none}#content .error{width:350px;padding:15px;margin:0 auto;text-align:center;font-size:16px;line-height:1.5em;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#box-popup .list-wrap{max-height:10em;overflow:auto;padding:.5em;margin:1em 0}#content .data .list-wrap ul,#box-popup .list-wrap ul{list-style-type:none;margin:0;padding:0}#content .data .list-wrap li,#box-popup .list-wrap li{display:flex;background:#f2f2f2;padding:.5em;font-size:1em;margin-bottom:.5em}#content .data .list-wrap li:hover,#box-popup .list-wrap li:hover{background:#e8eaf6;color:#000}#content .data .list-wrap div.files-item-info,#box-popup .list-wrap div.files-item-info{flex-grow:2}#content .data .list-wrap div.files-item-info img,#box-popup .list-wrap div.files-item-info img{margin:0 .5em}#content .data .list-wrap div.files-item-actions,#box-popup .list-wrap div.files-item-actions{padding:.3em 0}#box-popup{min-width:30em;max-width:60em;margin:5em auto;padding:0;background-color:#fff}#box-popup.box-password-view{min-width:30em;max-width:35em}#box-popup>h2{position:relative;width:100%;font-size:18px;color:#fff;background-color:#607d8b;margin:0;padding:.5em 0;line-height:1em}#box-popup>h2 .btn-popup-close{display:none;position:absolute;right:.5em;top:.2em}#box-popup>table{width:100%;padding-bottom:1em}#box-popup select{width:220px}#box-popup #resFancyAccion{display:none}#box-popup #resCheck{display:inline-block;width:80%;height:4em;padding:1em 0}#box-popup.image{background-color:transparent;max-width:100%;margin:0 auto;border-radius:0!important;-moz-border-radius:0!important;-webkit-border-radius:0!important}#box-popup.image img{width:auto;margin:0 auto}#box-popup.image>div.title{background-color:#607d8b;color:#fff;padding:.5em}#box-popup.help{min-height:100px;background-color:#f5f5f5}#box-popup.help p{font-size:14px;text-align:justify;line-height:2em}#box-complexity>div{text-align:justify;line-height:1.5em;margin-top:1em}#debug{float:left;text-align:left}#debuginfo{width:100%;min-height:10em;padding:1em;background-color:#fff8e1;text-align:left;line-height:1.5em}#debuginfo H3{text-align:center}.popup-data{width:100%;min-width:400px;border:0;text-align:left;margin:0;padding:1em .5em}.popup-data .descField{min-width:100px}footer{display:flex;justify-content:space-between;position:fixed;bottom:0;z-index:100;width:100%;padding:.5em 0;background-color:#f5f5f5;color:#b9b9b9;font-size:1em;-webkit-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);-moz-box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14);box-shadow:0 -3px 2px -2px rgba(0,0,0,0.14)}footer .footer-parts{display:flex;justify-content:space-between}footer #footer-left{width:50%;margin:0 1em}footer #footer-right{width:50%;margin:0 1em;justify-content:flex-end;text-align:right}footer #updates{min-width:10em;text-align:center;cursor:pointer}footer #status{margin:0 1em}footer #status>div{display:inline-block}footer #status .status-info{padding:.5em}footer #session{text-align:left;color:#999;font-size:.8em}footer a{color:#b9b9b9}footer a:visited{color:#b9b9b9}footer #project a:hover{color:#a9c1d7;border-bottom:1px solid #a9c1d7}footer #updates a:hover{color:#a9c1d7}footer img{border:0;width:16px;height:16px;vertical-align:middle}.round,.round5{border-radius:5px!important;-moz-border-radius:5px!important;-webkit-border-radius:5px!important}.midround{border-radius:0 0 10px 10px!important;-moz-border-radius:0 0 10px 10px!important;-webkit-border-radius:0 0 10px 10px!important}.midroundup{border-radius:10px 10px 0 0!important;-moz-border-radius:10px 10px 0 0!important;-webkit-border-radius:10px 10px 0 0!important}.fullround{border-radius:50%!important;-moz-border-radius:50%!important;-webkit-border-radius:50%!important}.iconMini{width:16px!important;height:16px!important;vertical-align:middle}.hide{display:none!important}.btn-checks{padding:5px;margin:.2em 0;width:30em;border-bottom:1px solid #c9c9c9}.shadow{-webkit-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);-moz-box-shadow:2px 2px 3px -3px rgba(0,0,0,0.14);box-shadow:1px 1px 2px rgba(0,0,0,0.14)}.noRes{width:60%;padding:15px;background-color:#f9f9f9;color:#a9a9a9;border:#c9c9c9 1px solid;margin:20px auto;text-align:center;font-size:16px}.header-grey{background-color:#607d8b;color:#fff;min-height:2em}.no-background{background:none!important}.action-in-box{padding:1em;text-align:right}.action-in-box ul{list-style:none;margin:0;padding:0}.tab-data{margin:2em auto 0;width:75%}.item-actions{margin:1em auto}.tab-actions{margin:2em 0}.item-actions>ul,.tab-actions>ul{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;list-style:none;margin:0;padding:0}.item-actions>ul>li,.tab-actions>ul>li{width:auto;min-width:2em;margin-left:.5em}.item-actions>ul>li.datagrid-action-search,.tab-actions>ul>li.datagrid-action-search{min-width:5em}.item-actions>ul>li.datagrid-action-search form,.tab-actions>ul>li.datagrid-action-search form{width:100%}.fullWidth{max-width:100%!important}.filter-on{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;padding:.3em 1em}.global-on{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;padding:.3em 1em}.opacity50{filter:alpha(opacity=50);opacity:.5}.custom-combobox{position:relative;display:inline-block}.custom-combobox input{width:80%}.custom-combobox-toggle{position:absolute;top:0;bottom:0;margin-left:-1px;padding:0;*height:1.7em;*top:.1em}.custom-combobox-input{margin:0;padding:.3em}.passLevel{width:20px;height:20px;display:inline-block;position:relative;top:2px}.passLevel.strongest{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strongest:hover{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a;font-weight:bold}.passLevel.strong{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.strong:hover{color:#2196f3;background-color:#e3f2fd;border:1px solid #2196f3;font-weight:bold}.passLevel.good{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.good:hover{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;font-weight:bold}.passLevel.weak{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}.passLevel.weak:hover{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350;font-weight:bold}#alert #alert-text{margin:15px auto;font-size:14px;font-weight:bold}#alert #alert-pass{width:50%;padding:10px;margin:15px auto;border:1px solid #c9c9c9;color:#555;font-weight:bold}.dialog-text,.dialog-user-text,.dialog-pass-text{font-family:Consolas,"Andale Mono WT","Andale Mono","Bitstream Vera Sans Mono","Nimbus Mono L",Monaco,"Courier New",monospace;padding:.5em;text-align:center;min-width:200px}.dialog-user-text{border-bottom:#d9d9d9 1px solid;color:#a9a9a9}.dialog-pass-text{border:transparent 1px solid;letter-spacing:.2em}.dialog-buttons{text-align:center;padding:.5em;border-top:1px solid #c9c9c9;line-height:2.5em}.dialog-clip-copy{color:#26a69a;background-color:#e0f2f1}.help-box{display:none;background-color:#fff!important;color:#607d8b}.help-box>*{font-weight:bold}.help-text{text-align:justify;line-height:1.5em;margin-top:1em}.tooltip{width:300px;max-width:300px;background-color:#777;color:#fff;z-index:101}.cursor-pointer{cursor:pointer}.password-actions{display:inline-block;width:12em}.password-actions>span,.password-actions i{margin-right:.6em}.custom-input-color{width:3em;height:1em;display:inline-block}.account-pass-image{height:32px;width:auto}.select-box{min-width:20em}fieldset.warning{padding:8px;border-radius:5px;color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}fieldset.warning legend{color:#ef5350!important}fieldset.warning a{color:#ef5350!important;font-weight:bold}#actions{width:100%;line-height:2em;margin-bottom:5em}#actions #logo{display:flex;width:100%;margin-bottom:30px;color:#607d8b;align-items:center;background:url("../imgs/logo_full_bg.png") left no-repeat;background-size:auto 150px;height:150px}#actions #page-title{width:100%;color:#607d8b;text-align:center}#actions #page-title h1{font-weight:bold;font-size:24px;letter-spacing:3px}#actions ul.errors{max-width:40vw;margin:0 auto;list-style:none;font-size:14px;text-align:left}#actions ul.errors>li{margin:1.5em auto;border-radius:3px;padding:1em .5em}#actions ul.errors>li.msg-critical{color:#ef5350;background-color:#ffebee;border:1px solid #ef5350}#actions ul.errors>li.msg-warning{color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28;color:#555}#actions ul.errors>li.msg-ok{color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#actions ul.errors>li>p.hint{color:#555;font-size:12px}#actions ul.errors>li>p.hint i{margin-right:.5em}#actions form{width:450px;margin:0 auto;text-align:left}#actions form fieldset{margin-bottom:2em}#actions form fieldset legend{width:100%;color:#fff;font-size:14px;font-weight:bold;text-align:center;background-color:#607d8b;margin:1em 0;letter-spacing:.2em;padding:.2em 0}#actions div.buttons{margin-top:2em;text-align:center}.center{text-align:center!important}.right{text-align:right!important}.left{text-align:left!important}.opacity50{opacity:.5!important}#login-container{width:40em;margin:0 auto;background:transparent url("../imgs/logo_full_bg.png") no-repeat top left;background-size:auto 10em}#login-container #boxSpacer{height:11em;background-color:transparent}#login-container #boxLogin{position:relative;margin:0 auto;width:100%;min-height:14em;padding:1em;background-color:#fff}#login-container #boxLogin #boxData{height:100%;min-height:14em;text-align:left;background-color:transparent}#login-container #boxLogin #boxData i{margin-right:.5em;opacity:.5}#login-container #boxLogin #boxData .extra-hidden{display:none}#login-container #boxLogin #boxButton{position:absolute;top:2em;right:2em}#login-container #boxLogin #boxActions{width:100%;text-align:right}#login-container #boxLogin #boxActions a{color:#c9c9c9}#login-container #boxLogout{margin-top:4em;width:100%}#login-container #boxLogout>div{margin:0 auto;width:250px;font-size:14px;padding:.5em;text-align:center;color:#ffca28;background-color:#fff8e1;border:1px solid #ffca28}#login-container #boxUpdated{width:350px;margin:3em auto;font-size:14px;text-align:center;padding:.5em;color:#26a69a;background-color:#e0f2f1;border:1px solid #26a69a}#login-container #demo-info{margin:3em auto;color:#c9c9c9;border-top:1px solid #d9d9d9;border-bottom:1px solid #d9d9d9;padding:.5em}#login-container #demo-info ul{display:flex;justify-content:space-around;list-style:none}#login-container #demo-info ul li span{margin:0 2em}@media screen and (max-width:1000px){#content #searchbox .search-filters>*{margin:.5em 1em .5em 0}#content .data-container #title,#content .tab-data #title{width:90%}footer{display:none;justify-content:space-between;flex-wrap:wrap}footer .footer-parts{justify-content:space-between;flex-wrap:wrap}footer #footer-left,footer #footer-right{width:100%}footer .footer-parts>div{width:100%;padding:.5em 0}}@media screen and (max-width:600px){#content input,#box-popup input{width:100%}#content .mdl-textfield,#box-popup .mdl-textfield{width:100%}#content td.descField,#box-popup td.descField{display:none}#content td.valField .lowres-title,#box-popup td.valField .lowres-title{display:block}#content #searchbox .mdl-textfield{width:90%}#content #searchbox .search-text{width:90%}#content #searchbox .search-filters .selectize-control{width:100%}#content .data-container,#content .tab-data{width:100%}#content .data-container #title,#content .tab-data #title{width:90%}#content .data-container .selectize-control,#content .tab-data .selectize-control{width:100%}#box-popup h2>.btn-popup-close{display:inline-block}.mdl-data-table{table-layout:fixed;width:100%}.table-responsive td,.table-responsive th{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}.table-responsive .cell-actions i{display:block!important}} \ No newline at end of file diff --git a/inc/themes/material-blue/views/accountsearch/rows.inc b/inc/themes/material-blue/views/accountsearch/rows.inc index 0c9186d4..0ae1a1db 100644 --- a/inc/themes/material-blue/views/accountsearch/rows.inc +++ b/inc/themes/material-blue/views/accountsearch/rows.inc @@ -24,7 +24,7 @@ title=""> getCustomerName()[0]); ?> + class="mdl-chip__contact mdl-color-text--white">getCustomerName(), 0, 1)); ?> getShortCustomerName(); ?> @@ -32,7 +32,7 @@ getCustomerName()[0]); ?> + class="mdl-chip__contact mdl-color-text--white">getCustomerName(), 0, 1)); ?> getShortCustomerName(); ?> diff --git a/inc/themes/material-blue/views/eventlog/eventlog.inc b/inc/themes/material-blue/views/eventlog/eventlog.inc index cbb52d1a..d2f80ed5 100644 --- a/inc/themes/material-blue/views/eventlog/eventlog.inc +++ b/inc/themes/material-blue/views/eventlog/eventlog.inc @@ -57,7 +57,7 @@ log_action); ?> - log_login); ?> + log_login); ?> log_ipAddress) : $log->log_ipAddress; ?> diff --git a/js/app-actions.min.js b/js/app-actions.min.js index f296805a..c91cb233 100644 --- a/js/app-actions.min.js +++ b/js/app-actions.min.js @@ -1,5 +1,5 @@ var $jscomp={scope:{},findInternal:function(c,d,k){c instanceof String&&(c=String(c));for(var f=c.length,g=0;g Date: Tue, 18 Apr 2017 17:27:39 +0200 Subject: [PATCH 11/22] * [MOD] Bump build number --- inc/SP/Util/Util.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 6b068413..d7022277 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041402; + $build = 17041801; $version = [2, 1, 7]; if ($normalized === true) { From 6ac05206ba99234c93dae90e200a6db29ca41c85 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Wed, 19 Apr 2017 11:31:42 +0200 Subject: [PATCH 12/22] * [FIX] Fixes #543. Fix missing accounts Id in group accesses table. Thanks to @Goatmaster for the feedback. --- inc/SP/Core/Upgrade/Account.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inc/SP/Core/Upgrade/Account.class.php b/inc/SP/Core/Upgrade/Account.class.php index 51acff15..01538346 100644 --- a/inc/SP/Core/Upgrade/Account.class.php +++ b/inc/SP/Core/Upgrade/Account.class.php @@ -57,6 +57,12 @@ class Account DB::getQuery($Data); + $query = /** @lang SQL */ + 'DELETE FROM accGroups WHERE accgroup_accountId NOT IN (SELECT account_id FROM accounts) OR accgroup_accountId IS NULL'; + $Data->setQuery($query); + + DB::getQuery($Data); + DB::endTransaction(); return true; From 33013b0afe97c454b5f033cc5e86a73aeca51bff Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Thu, 20 Apr 2017 08:49:25 +0200 Subject: [PATCH 13/22] * [MOD] Code tweaks --- inc/Base.php | 57 +--------- inc/BaseFunctions.php | 104 ++++++++++++++++++ inc/SP/Controller/ControllerBase.class.php | 2 +- inc/SP/Core/Init.class.php | 47 ++++---- inc/SP/Core/Upgrade/Crypt.class.php | 2 +- inc/SP/Storage/DB.class.php | 2 +- inc/SP/Util/Util.class.php | 13 ++- .../views/accountsearch/rows.inc | 4 +- 8 files changed, 139 insertions(+), 92 deletions(-) create mode 100644 inc/BaseFunctions.php diff --git a/inc/Base.php b/inc/Base.php index 2dc8b1f0..cb0027bd 100644 --- a/inc/Base.php +++ b/inc/Base.php @@ -46,7 +46,7 @@ define('DEBUG', false); // @see https://github.com/paragonie/random_compat/tree/v2.0.4#random_compat require_once EXTENSIONS_PATH . DIRECTORY_SEPARATOR . 'random_compat' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'random.php'; -require 'SplClassLoader.php'; +require __DIR__ . DIRECTORY_SEPARATOR . 'SplClassLoader.php'; $ClassLoader = new SplClassLoader('SP'); $ClassLoader->setFileExtension('.class.php'); @@ -59,60 +59,11 @@ $ClassLoader->addExcluded('SP\\Mgmt\\CustomFieldDef'); $ClassLoader->addExcluded('SP\\PublicLink'); $ClassLoader->register(); +require __DIR__ . DIRECTORY_SEPARATOR . 'BaseFunctions.php'; + // Empezar a calcular el tiempo y memoria utilizados $memInit = memory_get_usage(); -$timeStart = Init::microtime_float(); - -/** - * Función para enviar mensajes al log de errores - * - * @param mixed $data - * @param bool $printLastCaller - */ -function debugLog($data, $printLastCaller = false) -{ - if (!error_log(date('Y-m-d H:i:s') . ' - ' . print_r($data, true) . PHP_EOL, 3, LOG_FILE)) { - error_log(print_r($data, true)); - } - - if ($printLastCaller === true) { - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - $n = count($backtrace); - - for ($i = 1; $i <= $n - 1; $i++) { - $class = isset($backtrace[$i]['class']) ? $backtrace[$i]['class'] : ''; - $line = sprintf('Caller %d: %s\%s', $i, $class, $backtrace[$i]['function']); - - if (!error_log($line . PHP_EOL, 3, LOG_FILE)) { - error_log($line); - } - } - } -} - -/** - * Alias gettext function - * - * @param string $string - * @param bool $tranlate Si es necesario traducir - * @return string - */ -function __($string, $tranlate = true) -{ - return $tranlate === true && $string !== '' && strlen($string) < 4096 ? gettext($string) : $string; -} - -/** - * Alias para obtener las locales de un dominio - * - * @param $domain - * @param $message - * @return string - */ -function _t($domain, $message) -{ - return dgettext($domain, $message); -} +$timeStart = microtime_float(); // Inicializar sysPass Init::start(); diff --git a/inc/BaseFunctions.php b/inc/BaseFunctions.php new file mode 100644 index 00000000..d4815c0c --- /dev/null +++ b/inc/BaseFunctions.php @@ -0,0 +1,104 @@ +. + */ + +/** + * Función para enviar mensajes al log de errores + * + * @param mixed $data + * @param bool $printLastCaller + */ +function debugLog($data, $printLastCaller = false) +{ + $useOwn = true; + $line = date('Y-m-d H:i:s') . ' - ' . print_r($data, true) . PHP_EOL; + + if (!error_log($line, 3, LOG_FILE)) { + $useOwn = false; + error_log(print_r($data, true)); + } + + if ($printLastCaller === true) { + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + $n = count($backtrace); + + for ($i = 1; $i <= $n - 1; $i++) { + $class = isset($backtrace[$i]['class']) ? $backtrace[$i]['class'] : ''; + $btLine = sprintf('Caller %d: %s\%s' . PHP_EOL, $i, $class, $backtrace[$i]['function']); + + if ($useOwn === true) { + error_log($btLine, 3, LOG_FILE); + } else { + error_log($btLine); + } + } + } +} + +/** + * Alias gettext function + * + * @param string $message + * @param bool $translate Si es necesario traducir + * @return string + */ +function __($message, $translate = true) +{ + return $translate === true && $message !== '' && mb_strlen($message) < 4096 ? gettext($message) : $message; +} + +/** + * Alias para obtener las locales de un dominio + * + * @param string $domain + * @param string $message + * @param bool $translate + * @return string + */ +function _t($domain, $message, $translate = true) +{ + return $translate === true && $message !== '' && mb_strlen($message) < 4096 ? dgettext($domain, $message) : $message; +} + +/** + * Capitalización de cadenas multi byte + * + * @param $string + * @return string + */ +function mb_ucfirst($string) +{ + return mb_strtoupper(mb_substr($string, 0, 1)); +} + +/** + * Devuelve el tiempo actual en coma flotante. + * Esta función se utiliza para calcular el tiempo de renderizado con coma flotante + * + * @returns float con el tiempo actual + */ +function microtime_float() +{ + list($usec, $sec) = explode(' ', microtime()); + return ((float)$usec + (float)$sec); +} \ No newline at end of file diff --git a/inc/SP/Controller/ControllerBase.class.php b/inc/SP/Controller/ControllerBase.class.php index ad402cbe..e9665f6e 100644 --- a/inc/SP/Controller/ControllerBase.class.php +++ b/inc/SP/Controller/ControllerBase.class.php @@ -192,7 +192,7 @@ abstract class ControllerBase $this->view->addTemplate('debug', 'common'); - $this->view->assign('time', Init::microtime_float() - $this->view->timeStart); + $this->view->assign('time', microtime_float() - $this->view->timeStart); $this->view->assign('memInit', $memInit / 1000); $this->view->assign('memEnd', memory_get_usage() / 1000); } diff --git a/inc/SP/Core/Init.class.php b/inc/SP/Core/Init.class.php index 8e7c3920..d3049fed 100644 --- a/inc/SP/Core/Init.class.php +++ b/inc/SP/Core/Init.class.php @@ -244,6 +244,7 @@ class Init if (isset($_SERVER['HTTP_XAUTHORIZATION']) && !isset($_SERVER['HTTP_AUTHORIZATION'])) { $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['HTTP_XAUTHORIZATION']; } + // Establecer las cabeceras de autentificación para apache+php-cgi if (isset($_SERVER['HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['HTTP_AUTHORIZATION'], $matches) @@ -252,6 +253,7 @@ class Init $_SERVER['PHP_AUTH_USER'] = strip_tags($name); $_SERVER['PHP_AUTH_PW'] = strip_tags($password); } + // Establecer las cabeceras de autentificación para que apache+php-cgi funcione si la variable es renombrada por apache if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches) @@ -281,7 +283,7 @@ class Init } if (!file_exists(LOG_FILE) && touch(LOG_FILE) && chmod(LOG_FILE, 0600)) { - error_log('Setup log file: ' . LOG_FILE); + debugLog('Setup log file: ' . LOG_FILE); } } @@ -364,8 +366,8 @@ class Init private static function startSession($encrypt = false) { // Evita que javascript acceda a las cookies de sesion de PHP - @ini_set('session.cookie_httponly', '1'); - @ini_set('session.save_handler', 'files'); + ini_set('session.cookie_httponly', '1'); + ini_set('session.save_handler', 'files'); if ($encrypt === true) { $Key = SecureKeyCookie::getKey(); @@ -537,6 +539,7 @@ class Init * Esta función comprueba si la aplicación está instalada. Si no lo está, redirige al instalador. * * @throws \SP\Core\Exceptions\SPException + * @throws \Defuse\Crypto\Exception\BadFormatException */ private static function checkInstalled() { @@ -548,20 +551,20 @@ class Init $url = $protocol . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . self::$WEBROOT . '/index.php'; header("Location: $url"); exit(); - } else { - if (Session::getAuthCompleted()) { - session_destroy(); - - self::start(); - return; - } - - // Comprobar si sysPass está instalada o en modo mantenimiento - $Controller = new MainController(); - $Controller->getInstaller(); - $Controller->view(); - exit(); } + + if (Session::getAuthCompleted()) { + session_destroy(); + + self::start(); + return; + } + + // Comprobar si sysPass está instalada o en modo mantenimiento + $Controller = new MainController(); + $Controller->getInstaller(); + $Controller->view(); + exit(); } } @@ -786,16 +789,4 @@ class Init return false; } - - /** - * Devuelve el tiempo actual en coma flotante. - * Esta función se utiliza para calcular el tiempo de renderizado con coma flotante - * - * @returns float con el tiempo actual - */ - public static function microtime_float() - { - list($usec, $sec) = explode(' ', microtime()); - return ((float)$usec + (float)$sec); - } } \ No newline at end of file diff --git a/inc/SP/Core/Upgrade/Crypt.class.php b/inc/SP/Core/Upgrade/Crypt.class.php index 4b6a5eca..9be05e19 100644 --- a/inc/SP/Core/Upgrade/Crypt.class.php +++ b/inc/SP/Core/Upgrade/Crypt.class.php @@ -73,7 +73,7 @@ class Crypt throw new SPException(SPException::SP_ERROR, __('No es posible finalizar una transacción', false)); } - debugLog('Total time: ' . (Init::microtime_float() - $timeStart)); + debugLog('Total time: ' . (microtime_float() - $timeStart)); return true; } catch (\Exception $e) { diff --git a/inc/SP/Storage/DB.class.php b/inc/SP/Storage/DB.class.php index 0b8aa6be..135124e2 100644 --- a/inc/SP/Storage/DB.class.php +++ b/inc/SP/Storage/DB.class.php @@ -286,7 +286,7 @@ class DB $LogMessage->addDescription(sprintf('%s (%s)', $e->getMessage(), $e->getCode())); $LogMessage->addDetails('SQL', DBUtil::escape($query)); - debugLog($LogMessage->getDescription(), true); + debugLog($LogMessage->getDescription(true), true); debugLog($LogMessage->getDetails()); // Solo registrar eventos de ls BD si no son consultas del registro de eventos diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index d7022277..07f59a89 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17041801; + $build = 17042001; $version = [2, 1, 7]; if ($normalized === true) { @@ -568,6 +568,7 @@ class Util * * @param string $class Class name * @param string|object $object + * @param string $srcClass Nombre de la clase serializada * @return mixed * @link http://blog.jasny.net/articles/a-dark-corner-of-php-class-casting/ */ @@ -580,19 +581,19 @@ class Util if (get_class($object) === '__PHP_Incomplete_Class') { // Elimina el nombre de la clase en los métodos privados if ($srcClass !== null) { - $replace = preg_replace_callback( - '/:\d+:"\x00' . preg_quote($srcClass) . '\x00(\w+)"/', + $replaceSrc = preg_replace_callback( + '/:\d+:"\x00' . preg_quote($srcClass, '/') . '\x00(\w+)"/', function ($matches) { return ':' . strlen($matches[1]) . ':"' . $matches[1] . '"'; }, serialize($object) ); - - $replace = preg_replace('/^O:\d+:"[^"]++"/', 'O:' . strlen($class) . ':"' . $class . '"', $replace); } else { - $replace = preg_replace('/^O:\d+:"[^"]++"/', 'O:' . strlen($class) . ':"' . $class . '"', serialize($object)); + $replaceSrc = serialize($object); } + $replace = preg_replace('/^O:\d+:"[^"]++"/', 'O:' . strlen($class) . ':"' . $class . '"', $replaceSrc); + return unserialize($replace); } diff --git a/inc/themes/material-blue/views/accountsearch/rows.inc b/inc/themes/material-blue/views/accountsearch/rows.inc index 0ae1a1db..98832b63 100644 --- a/inc/themes/material-blue/views/accountsearch/rows.inc +++ b/inc/themes/material-blue/views/accountsearch/rows.inc @@ -24,7 +24,7 @@ title=""> getCustomerName(), 0, 1)); ?> + class="mdl-chip__contact mdl-color-text--white">getCustomerName()); ?> getShortCustomerName(); ?> @@ -32,7 +32,7 @@ getCustomerName(), 0, 1)); ?> + class="mdl-chip__contact mdl-color-text--white">getCustomerName()); ?> getShortCustomerName(); ?> From ee95f70b88fca20c1c872c6396780474475b3b96 Mon Sep 17 00:00:00 2001 From: nuxsmin Date: Thu, 20 Apr 2017 10:23:15 +0200 Subject: [PATCH 14/22] * [MOD] Try to fix search form behavior when submitting. A listener has been added to catch the "enter" key. Related #525, #502, #493 --- inc/SP/Util/Util.class.php | 2 +- .../views/accountsearch/searchbox.inc | 2 -- js/app-triggers.js | 8 ++++++++ js/app-triggers.min.js | 20 +++++++++---------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 07f59a89..aad8a886 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -407,7 +407,7 @@ class Util */ public static function getVersion($retBuild = false, $normalized = false) { - $build = 17042001; + $build = 17042002; $version = [2, 1, 7]; if ($normalized === true) { diff --git a/inc/themes/material-blue/views/accountsearch/searchbox.inc b/inc/themes/material-blue/views/accountsearch/searchbox.inc index 755e52c7..b1adc8cb 100644 --- a/inc/themes/material-blue/views/accountsearch/searchbox.inc +++ b/inc/themes/material-blue/views/accountsearch/searchbox.inc @@ -109,8 +109,6 @@ - -