7989 lines
557 KiB
HTML
7989 lines
557 KiB
HTML
<!doctype html>
|
||
<html>
|
||
<head>
|
||
<!--
|
||
Notice of Copyrights and Licenses:
|
||
***********************************
|
||
The bitaddress.org project, software and embedded resources are copyright bitaddress.org (pointbiz).
|
||
The bitaddress.org name and logo are not part of the open source license.
|
||
|
||
Portions of the all-in-one HTML document contain JavaScript codes that are the copyrights of others.
|
||
The individual copyrights are included throughout the document along with their licenses.
|
||
Included JavaScript libraries are separated with HTML script tags.
|
||
|
||
Summary of JavaScript functions with a redistributable license:
|
||
JavaScript function License
|
||
******************* ***************
|
||
window.Crypto BSD License
|
||
window.SecureRandom BSD License
|
||
window.EllipticCurve BSD License
|
||
window.BigInteger BSD License
|
||
window.QRCode MIT License
|
||
window.Bitcoin MIT License
|
||
window.Crypto_scrypt MIT License
|
||
|
||
The bitaddress.org software is available under The MIT License (MIT)
|
||
Copyright (c) 2011-2016 bitaddress.org (pointbiz)
|
||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
||
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject
|
||
to the following conditions:
|
||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||
portions of the Software.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
|
||
GitHub Repository: https://github.com/SmartCash/PaperWalletGenerator
|
||
-->
|
||
|
||
<title>smartcash.cc</title>
|
||
<link rel="icon" href="https://smartcash.cc/wp-content/uploads/2017/08/smartfavi.ico" type="image/x-icon">
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
<script type="text/javascript">
|
||
if((location.href).match("http://brainwallet.smartcash.cc")) {
|
||
// location.href = "https://brainwallet.smartcash.cc";
|
||
}
|
||
var hash_keccak = function(s) { return CryptoJS.SHA3(s, { outputLength: 256, asBytes: true }); }
|
||
var hash_sha256 = function(s) { return CryptoJS.SHA256(s, { asBytes: true }); }
|
||
var hash_ripemd160 = function(s) { return CryptoJS.RIPEMD160(s, { asBytes: true }); }
|
||
var create_keypair = function() {
|
||
var keypair = KEYUTIL.generateKeypair("EC", "secp256k1");
|
||
return {prvKey: keypair.prvKeyObj.prvKeyHex, pubKey: keypair.pubKeyObj.pubKeyHex};
|
||
}
|
||
function wordArrayToByteArray(wordArray) {
|
||
var words = wordArray.words;
|
||
var sigBytes = wordArray.sigBytes;
|
||
var u8 = new Uint8Array(sigBytes);
|
||
for (var i = 0; i < sigBytes; i++) {
|
||
var byte = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
||
u8[i]=byte;
|
||
}
|
||
return u8;
|
||
}
|
||
var prvKey_to_WIF = function(prvKey, compressed) {
|
||
prvKey = compressed ? prvKey+'01' : prvKey;
|
||
var baby = CryptoJS.enc.Hex.parse(prvKey);
|
||
var version = CryptoJS.enc.Hex.parse('BF');
|
||
var child = version.concat(baby);
|
||
var teenager = hash_keccak(child);
|
||
var checksum = CryptoJS.lib.WordArray.create(teenager.words.slice(0, 4), 4);
|
||
var adult = child.concat(checksum);
|
||
var bytes = wordArrayToByteArray(adult);
|
||
return bs58_encode(bytes);
|
||
}
|
||
var create_address = function(pubkey) {
|
||
var key = CryptoJS.enc.Hex.parse(pubkey);
|
||
var baby = hash_sha256(key);
|
||
var child = hash_ripemd160(baby);
|
||
var version = CryptoJS.enc.Hex.parse('3F');
|
||
version.concat(child);
|
||
var teenager = version;
|
||
var adult = hash_keccak(teenager);
|
||
var checksum = CryptoJS.lib.WordArray.create(adult.words.slice(0, 4), 4);
|
||
var pensioner = teenager;
|
||
pensioner.concat(checksum);
|
||
var bytes = wordArrayToByteArray(pensioner);
|
||
return bs58_encode(bytes);
|
||
}
|
||
function toggleClass(element, className){
|
||
if (!element || !className){ return; }
|
||
var classString = element.className, nameIndex = classString.indexOf(className);
|
||
if (nameIndex == -1) { classString += ' ' + className; }
|
||
else { classString = classString.substr(0, nameIndex) + classString.substr(nameIndex+className.length); }
|
||
element.className = classString;
|
||
}
|
||
function toggleSingelArt(hide) {
|
||
var SingleArt = document.getElementById('SingleArt');
|
||
toggleClass(SingleArt, 'removeImage');
|
||
}
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*
|
||
* jsrsasign 4.2.2 (c) 2010-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
/*
|
||
yahoo-min.js
|
||
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
|
||
Code licensed under the BSD License:
|
||
http://developer.yahoo.com/yui/license.html
|
||
version: 2.9.0
|
||
*/
|
||
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var b=arguments,g=null,e,c,f;for(e=0;e<b.length;e=e+1){f=(""+b[e]).split(".");g=YAHOO;for(c=(f[0]=="YAHOO")?1:0;c<f.length;c=c+1){g[f[c]]=g[f[c]]||{};g=g[f[c]];}}return g;};YAHOO.log=function(d,a,c){var b=YAHOO.widget.Logger;if(b&&b.log){return b.log(d,a,c);}else{return false;}};YAHOO.register=function(a,f,e){var k=YAHOO.env.modules,c,j,h,g,d;if(!k[a]){k[a]={versions:[],builds:[]};}c=k[a];j=e.version;h=e.build;g=YAHOO.env.listeners;c.name=a;c.version=j;c.build=h;c.versions.push(j);c.builds.push(h);c.mainClass=f;for(d=0;d<g.length;d=d+1){g[d](c);}if(f){f.VERSION=j;f.BUILD=h;}else{YAHOO.log("mainClass is undefined for module "+a,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(a){return YAHOO.env.modules[a]||null;};YAHOO.env.parseUA=function(d){var e=function(i){var j=0;return parseFloat(i.replace(/\./g,function(){return(j++==1)?"":".";}));},h=navigator,g={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:h&&h.cajaVersion,secure:false,os:null},c=d||(navigator&&navigator.userAgent),f=window&&window.location,b=f&&f.href,a;g.secure=b&&(b.toLowerCase().indexOf("https")===0);if(c){if((/windows|win32/i).test(c)){g.os="windows";}else{if((/macintosh/i).test(c)){g.os="macintosh";}else{if((/rhino/i).test(c)){g.os="rhino";}}}if((/KHTML/).test(c)){g.webkit=1;}a=c.match(/AppleWebKit\/([^\s]*)/);if(a&&a[1]){g.webkit=e(a[1]);if(/ Mobile\//.test(c)){g.mobile="Apple";a=c.match(/OS ([^\s]*)/);if(a&&a[1]){a=e(a[1].replace("_","."));}g.ios=a;g.ipad=g.ipod=g.iphone=0;a=c.match(/iPad|iPod|iPhone/);if(a&&a[0]){g[a[0].toLowerCase()]=g.ios;}}else{a=c.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);if(a){g.mobile=a[0];}if(/webOS/.test(c)){g.mobile="WebOS";a=c.match(/webOS\/([^\s]*);/);if(a&&a[1]){g.webos=e(a[1]);}}if(/ Android/.test(c)){g.mobile="Android";a=c.match(/Android ([^\s]*);/);if(a&&a[1]){g.android=e(a[1]);}}}a=c.match(/Chrome\/([^\s]*)/);if(a&&a[1]){g.chrome=e(a[1]);}else{a=c.match(/AdobeAIR\/([^\s]*)/);if(a){g.air=a[0];}}}if(!g.webkit){a=c.match(/Opera[\s\/]([^\s]*)/);if(a&&a[1]){g.opera=e(a[1]);a=c.match(/Version\/([^\s]*)/);if(a&&a[1]){g.opera=e(a[1]);}a=c.match(/Opera Mini[^;]*/);if(a){g.mobile=a[0];}}else{a=c.match(/MSIE\s([^;]*)/);if(a&&a[1]){g.ie=e(a[1]);}else{a=c.match(/Gecko\/([^\s]*)/);if(a){g.gecko=1;a=c.match(/rv:([^\s\)]*)/);if(a&&a[1]){g.gecko=e(a[1]);}}}}}}return g;};YAHOO.env.ua=YAHOO.env.parseUA();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var b=YAHOO_config.listener,a=YAHOO.env.listeners,d=true,c;if(b){for(c=0;c<a.length;c++){if(a[c]==b){d=false;break;}}if(d){a.push(b);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var f=YAHOO.lang,a=Object.prototype,c="[object Array]",h="[object Function]",i="[object Object]",b=[],g={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`"},d=["toString","valueOf"],e={isArray:function(j){return a.toString.apply(j)===c;},isBoolean:function(j){return typeof j==="boolean";},isFunction:function(j){return(typeof j==="function")||a.toString.apply(j)===h;},isNull:function(j){return j===null;},isNumber:function(j){return typeof j==="number"&&isFinite(j);},isObject:function(j){return(j&&(typeof j==="object"||f.isFunction(j)))||false;},isString:function(j){return typeof j==="string";},isUndefined:function(j){return typeof j==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(l,k){var j,n,m;for(j=0;j<d.length;j=j+1){n=d[j];m=k[n];if(f.isFunction(m)&&m!=a[n]){l[n]=m;}}}:function(){},escapeHTML:function(j){return j.replace(/[&<>"'\/`]/g,function(k){return g[k];});},extend:function(m,n,l){if(!n||!m){throw new Error("extend failed, please check that "+"all dependencies are included.");}var k=function(){},j;k.prototype=n.prototype;m.prototype=new k();m.prototype.constructor=m;m.superclass=n.prototype;if(n.prototype.constructor==a.constructor){n.prototype.constructor=n;}if(l){for(j in l){if(f.hasOwnProperty(l,j)){m.prototype[j]=l[j];}}f._IEEnumFix(m.prototype,l);}},augmentObject:function(n,m){if(!m||!n){throw new Error("Absorb failed, verify dependencies.");}var j=arguments,l,o,k=j[2];if(k&&k!==true){for(l=2;l<j.length;l=l+1){n[j[l]]=m[j[l]];}}else{for(o in m){if(k||!(o in n)){n[o]=m[o];}}f._IEEnumFix(n,m);}return n;},augmentProto:function(m,l){if(!l||!m){throw new Error("Augment failed, verify dependencies.");}var j=[m.prototype,l.prototype],k;for(k=2;k<arguments.length;k=k+1){j.push(arguments[k]);}f.augmentObject.apply(this,j);return m;},dump:function(j,p){var l,n,r=[],t="{...}",k="f(){...}",q=", ",m=" => ";if(!f.isObject(j)){return j+"";}else{if(j instanceof Date||("nodeType" in j&&"tagName" in j)){return j;}else{if(f.isFunction(j)){return k;}}}p=(f.isNumber(p))?p:3;if(f.isArray(j)){r.push("[");for(l=0,n=j.length;l<n;l=l+1){if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}if(r.length>1){r.pop();}r.push("]");}else{r.push("{");for(l in j){if(f.hasOwnProperty(j,l)){r.push(l+m);if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}}if(r.length>1){r.pop();}r.push("}");}return r.join("");},substitute:function(x,y,E,l){var D,C,B,G,t,u,F=[],p,z=x.length,A="dump",r=" ",q="{",m="}",n,w;for(;;){D=x.lastIndexOf(q,z);if(D<0){break;}C=x.indexOf(m,D);if(D+1>C){break;}p=x.substring(D+1,C);G=p;u=null;B=G.indexOf(r);if(B>-1){u=G.substring(B+1);G=G.substring(0,B);}t=y[G];if(E){t=E(G,t,u);}if(f.isObject(t)){if(f.isArray(t)){t=f.dump(t,parseInt(u,10));}else{u=u||"";n=u.indexOf(A);if(n>-1){u=u.substring(4);}w=t.toString();if(w===i||n>-1){t=f.dump(t,parseInt(u,10));}else{t=w;}}}else{if(!f.isString(t)&&!f.isNumber(t)){t="~-"+F.length+"-~";F[F.length]=p;}}x=x.substring(0,D)+t+x.substring(C+1);if(l===false){z=D-1;}}for(D=F.length-1;D>=0;D=D-1){x=x.replace(new RegExp("~-"+D+"-~"),"{"+F[D]+"}","g");}return x;},trim:function(j){try{return j.replace(/^\s+|\s+$/g,"");}catch(k){return j;
|
||
}},merge:function(){var n={},k=arguments,j=k.length,m;for(m=0;m<j;m=m+1){f.augmentObject(n,k[m],true);}return n;},later:function(t,k,u,n,p){t=t||0;k=k||{};var l=u,s=n,q,j;if(f.isString(u)){l=k[u];}if(!l){throw new TypeError("method undefined");}if(!f.isUndefined(n)&&!f.isArray(s)){s=[n];}q=function(){l.apply(k,s||b);};j=(p)?setInterval(q,t):setTimeout(q,t);return{interval:p,cancel:function(){if(this.interval){clearInterval(j);}else{clearTimeout(j);}}};},isValue:function(j){return(f.isObject(j)||f.isString(j)||f.isNumber(j)||f.isBoolean(j));}};f.hasOwnProperty=(a.hasOwnProperty)?function(j,k){return j&&j.hasOwnProperty&&j.hasOwnProperty(k);}:function(j,k){return !f.isUndefined(j[k])&&j.constructor.prototype[k]!==j[k];};e.augmentObject(f,e,true);YAHOO.util.Lang=f;f.augment=f.augmentProto;YAHOO.augment=f.augmentProto;YAHOO.extend=f.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.9.0",build:"2800"});
|
||
/*! CryptoJS v3.1.2 core-fix.js
|
||
* code.google.com/p/crypto-js
|
||
* (c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
* code.google.com/p/crypto-js/wiki/License
|
||
* THIS IS FIX of 'core.js' to fix Hmac issue.
|
||
* https://code.google.com/p/crypto-js/issues/detail?id=84
|
||
* https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js
|
||
*/
|
||
var CryptoJS=CryptoJS||(function(e,g){var a={};var b=a.lib={};var j=b.Base=(function(){function n(){}return{extend:function(p){n.prototype=this;var o=new n();if(p){o.mixIn(p)}if(!o.hasOwnProperty("init")){o.init=function(){o.$super.init.apply(this,arguments)}}o.init.prototype=o;o.$super=this;return o},create:function(){var o=this.extend();o.init.apply(o,arguments);return o},init:function(){},mixIn:function(p){for(var o in p){if(p.hasOwnProperty(o)){this[o]=p[o]}}if(p.hasOwnProperty("toString")){this.toString=p.toString}},clone:function(){return this.init.prototype.extend(this)}}}());var l=b.WordArray=j.extend({init:function(o,n){o=this.words=o||[];if(n!=g){this.sigBytes=n}else{this.sigBytes=o.length*4}},toString:function(n){return(n||h).stringify(this)},concat:function(t){var q=this.words;var p=t.words;var n=this.sigBytes;var s=t.sigBytes;this.clamp();if(n%4){for(var r=0;r<s;r++){var o=(p[r>>>2]>>>(24-(r%4)*8))&255;q[(n+r)>>>2]|=o<<(24-((n+r)%4)*8)}}else{for(var r=0;r<s;r+=4){q[(n+r)>>>2]=p[r>>>2]}}this.sigBytes+=s;return this},clamp:function(){var o=this.words;var n=this.sigBytes;o[n>>>2]&=4294967295<<(32-(n%4)*8);o.length=e.ceil(n/4)},clone:function(){var n=j.clone.call(this);n.words=this.words.slice(0);return n},random:function(p){var o=[];for(var n=0;n<p;n+=4){o.push((e.random()*4294967296)|0)}return new l.init(o,p)}});var m=a.enc={};var h=m.Hex={stringify:function(p){var r=p.words;var o=p.sigBytes;var q=[];for(var n=0;n<o;n++){var s=(r[n>>>2]>>>(24-(n%4)*8))&255;q.push((s>>>4).toString(16));q.push((s&15).toString(16))}return q.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o<n;o+=2){q[o>>>3]|=parseInt(p.substr(o,2),16)<<(24-(o%8)*4)}return new l.init(q,n/2)}};var d=m.Latin1={stringify:function(q){var r=q.words;var p=q.sigBytes;var n=[];for(var o=0;o<p;o++){var s=(r[o>>>2]>>>(24-(o%4)*8))&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o<n;o++){q[o>>>2]|=(p.charCodeAt(o)&255)<<(24-(o%4)*8)}return new l.init(q,n)}};var c=m.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch(o){throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}};var i=b.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new l.init();this._nDataBytes=0},_append:function(n){if(typeof n=="string"){n=c.parse(n)}this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(w){var q=this._data;var x=q.words;var n=q.sigBytes;var t=this.blockSize;var v=t*4;var u=n/v;if(w){u=e.ceil(u)}else{u=e.max((u|0)-this._minBufferSize,0)}var s=u*t;var r=e.min(s*4,n);if(s){for(var p=0;p<s;p+=t){this._doProcessBlock(x,p)}var o=x.splice(0,s);q.sigBytes-=r}return new l.init(o,r)},clone:function(){var n=j.clone.call(this);n._data=this._data.clone();return n},_minBufferSize:0});var f=b.Hasher=i.extend({cfg:j.extend(),init:function(n){this.cfg=this.cfg.extend(n);this.reset()},reset:function(){i.reset.call(this);this._doReset()},update:function(n){this._append(n);this._process();return this},finalize:function(n){if(n){this._append(n)}var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(n){return function(p,o){return new n.init(o).finalize(p)}},_createHmacHelper:function(n){return function(p,o){return new k.HMAC.init(n,o).finalize(p)}}});var k=a.algo={};return a}(Math));/*
|
||
CryptoJS v3.1.2 x64-core-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(g){var a=CryptoJS,f=a.lib,e=f.Base,h=f.WordArray,a=a.x64={};a.Word=e.extend({init:function(b,c){this.high=b;this.low=c}});a.WordArray=e.extend({init:function(b,c){b=this.words=b||[];this.sigBytes=c!=g?c:8*b.length},toX32:function(){for(var b=this.words,c=b.length,a=[],d=0;d<c;d++){var e=b[d];a.push(e.high);a.push(e.low)}return h.create(a,this.sigBytes)},clone:function(){for(var b=e.clone.call(this),c=b.words=this.words.slice(0),a=c.length,d=0;d<a;d++)c[d]=c[d].clone();return b}})})();
|
||
/*
|
||
CryptoJS v3.1.2 hmac-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d<c;d++)h[d]^=1549556828,j[d]^=909522486;f.sigBytes=g.sigBytes=e;this.reset()},reset:function(){var a=this._hasher;a.reset();a.update(this._iKey)},update:function(a){this._hasher.update(a);return this},finalize:function(a){var b=
|
||
this._hasher;a=b.finalize(a);b.reset();return b.finalize(this._oKey.clone().concat(a))}})})();
|
||
/*
|
||
CryptoJS v3.1.2 sha256-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(k){for(var g=CryptoJS,h=g.lib,v=h.WordArray,j=h.Hasher,h=g.algo,s=[],t=[],u=function(q){return 4294967296*(q-(q|0))|0},l=2,b=0;64>b;){var d;a:{d=l;for(var w=k.sqrt(d),r=2;r<=w;r++)if(!(d%r)){d=!1;break a}d=!0}d&&(8>b&&(s[b]=u(k.pow(l,0.5))),t[b]=u(k.pow(l,1/3)),b++);l++}var n=[],h=h.SHA256=j.extend({_doReset:function(){this._hash=new v.init(s.slice(0))},_doProcessBlock:function(q,h){for(var a=this._hash.words,c=a[0],d=a[1],b=a[2],k=a[3],f=a[4],g=a[5],j=a[6],l=a[7],e=0;64>e;e++){if(16>e)n[e]=
|
||
q[h+e]|0;else{var m=n[e-15],p=n[e-2];n[e]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+n[e-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+n[e-16]}m=l+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&g^~f&j)+t[e]+n[e];p=((c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22))+(c&d^c&b^d&b);l=j;j=g;g=f;f=k+m|0;k=b;b=d;d=c;c=m+p|0}a[0]=a[0]+c|0;a[1]=a[1]+d|0;a[2]=a[2]+b|0;a[3]=a[3]+k|0;a[4]=a[4]+f|0;a[5]=a[5]+g|0;a[6]=a[6]+j|0;a[7]=a[7]+l|0},_doFinalize:function(){var d=this._data,b=d.words,a=8*this._nDataBytes,c=8*d.sigBytes;
|
||
b[c>>>5]|=128<<24-c%32;b[(c+64>>>9<<4)+14]=k.floor(a/4294967296);b[(c+64>>>9<<4)+15]=a;d.sigBytes=4*b.length;this._process();return this._hash},clone:function(){var b=j.clone.call(this);b._hash=this._hash.clone();return b}});g.SHA256=j._createHelper(h);g.HmacSHA256=j._createHmacHelper(h)})(Math);
|
||
/*
|
||
CryptoJS v3.1.2 sha224-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){var b=CryptoJS,d=b.lib.WordArray,a=b.algo,c=a.SHA256,a=a.SHA224=c.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=c._doFinalize.call(this);a.sigBytes-=4;return a}});b.SHA224=c._createHelper(a);b.HmacSHA224=c._createHmacHelper(a)})();
|
||
/*
|
||
CryptoJS v3.1.2 sha512-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){function a(){return d.create.apply(d,arguments)}for(var n=CryptoJS,r=n.lib.Hasher,e=n.x64,d=e.Word,T=e.WordArray,e=n.algo,ea=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),
|
||
a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,
|
||
2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),
|
||
a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,
|
||
3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],v=[],w=0;80>w;w++)v[w]=a();e=e.SHA512=r.extend({_doReset:function(){this._hash=new T.init([new d.init(1779033703,4089235720),new d.init(3144134277,2227873595),new d.init(1013904242,4271175723),new d.init(2773480762,1595750129),new d.init(1359893119,2917565137),new d.init(2600822924,725511199),new d.init(528734635,4215389547),new d.init(1541459225,327033209)])},_doProcessBlock:function(a,d){for(var f=this._hash.words,
|
||
F=f[0],e=f[1],n=f[2],r=f[3],G=f[4],H=f[5],I=f[6],f=f[7],w=F.high,J=F.low,X=e.high,K=e.low,Y=n.high,L=n.low,Z=r.high,M=r.low,$=G.high,N=G.low,aa=H.high,O=H.low,ba=I.high,P=I.low,ca=f.high,Q=f.low,k=w,g=J,z=X,x=K,A=Y,y=L,U=Z,B=M,l=$,h=N,R=aa,C=O,S=ba,D=P,V=ca,E=Q,m=0;80>m;m++){var s=v[m];if(16>m)var j=s.high=a[d+2*m]|0,b=s.low=a[d+2*m+1]|0;else{var j=v[m-15],b=j.high,p=j.low,j=(b>>>1|p<<31)^(b>>>8|p<<24)^b>>>7,p=(p>>>1|b<<31)^(p>>>8|b<<24)^(p>>>7|b<<25),u=v[m-2],b=u.high,c=u.low,u=(b>>>19|c<<13)^(b<<
|
||
3|c>>>29)^b>>>6,c=(c>>>19|b<<13)^(c<<3|b>>>29)^(c>>>6|b<<26),b=v[m-7],W=b.high,t=v[m-16],q=t.high,t=t.low,b=p+b.low,j=j+W+(b>>>0<p>>>0?1:0),b=b+c,j=j+u+(b>>>0<c>>>0?1:0),b=b+t,j=j+q+(b>>>0<t>>>0?1:0);s.high=j;s.low=b}var W=l&R^~l&S,t=h&C^~h&D,s=k&z^k&A^z&A,T=g&x^g&y^x&y,p=(k>>>28|g<<4)^(k<<30|g>>>2)^(k<<25|g>>>7),u=(g>>>28|k<<4)^(g<<30|k>>>2)^(g<<25|k>>>7),c=ea[m],fa=c.high,da=c.low,c=E+((h>>>14|l<<18)^(h>>>18|l<<14)^(h<<23|l>>>9)),q=V+((l>>>14|h<<18)^(l>>>18|h<<14)^(l<<23|h>>>9))+(c>>>0<E>>>0?1:
|
||
0),c=c+t,q=q+W+(c>>>0<t>>>0?1:0),c=c+da,q=q+fa+(c>>>0<da>>>0?1:0),c=c+b,q=q+j+(c>>>0<b>>>0?1:0),b=u+T,s=p+s+(b>>>0<u>>>0?1:0),V=S,E=D,S=R,D=C,R=l,C=h,h=B+c|0,l=U+q+(h>>>0<B>>>0?1:0)|0,U=A,B=y,A=z,y=x,z=k,x=g,g=c+b|0,k=q+s+(g>>>0<c>>>0?1:0)|0}J=F.low=J+g;F.high=w+k+(J>>>0<g>>>0?1:0);K=e.low=K+x;e.high=X+z+(K>>>0<x>>>0?1:0);L=n.low=L+y;n.high=Y+A+(L>>>0<y>>>0?1:0);M=r.low=M+B;r.high=Z+U+(M>>>0<B>>>0?1:0);N=G.low=N+h;G.high=$+l+(N>>>0<h>>>0?1:0);O=H.low=O+C;H.high=aa+R+(O>>>0<C>>>0?1:0);P=I.low=P+D;
|
||
I.high=ba+S+(P>>>0<D>>>0?1:0);Q=f.low=Q+E;f.high=ca+V+(Q>>>0<E>>>0?1:0)},_doFinalize:function(){var a=this._data,d=a.words,f=8*this._nDataBytes,e=8*a.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+128>>>10<<5)+30]=Math.floor(f/4294967296);d[(e+128>>>10<<5)+31]=f;a.sigBytes=4*d.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});n.SHA512=r._createHelper(e);n.HmacSHA512=r._createHmacHelper(e)})();
|
||
/*
|
||
CryptoJS v3.1.2 sha384-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){var c=CryptoJS,a=c.x64,b=a.Word,e=a.WordArray,a=c.algo,d=a.SHA512,a=a.SHA384=d.extend({_doReset:function(){this._hash=new e.init([new b.init(3418070365,3238371032),new b.init(1654270250,914150663),new b.init(2438529370,812702999),new b.init(355462360,4144912697),new b.init(1731405415,4290775857),new b.init(2394180231,1750603025),new b.init(3675008525,1694076839),new b.init(1203062813,3204075428)])},_doFinalize:function(){var a=d._doFinalize.call(this);a.sigBytes-=16;return a}});c.SHA384=
|
||
d._createHelper(a);c.HmacSHA384=d._createHmacHelper(a)})();
|
||
/*
|
||
CryptoJS v3.1.2 md5-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(E){function h(a,f,g,j,p,h,k){a=a+(f&g|~f&j)+p+k;return(a<<h|a>>>32-h)+f}function k(a,f,g,j,p,h,k){a=a+(f&j|g&~j)+p+k;return(a<<h|a>>>32-h)+f}function l(a,f,g,j,h,k,l){a=a+(f^g^j)+h+l;return(a<<k|a>>>32-k)+f}function n(a,f,g,j,h,k,l){a=a+(g^(f|~j))+h+l;return(a<<k|a>>>32-k)+f}for(var r=CryptoJS,q=r.lib,F=q.WordArray,s=q.Hasher,q=r.algo,a=[],t=0;64>t;t++)a[t]=4294967296*E.abs(E.sin(t+1))|0;q=q.MD5=s.extend({_doReset:function(){this._hash=new F.init([1732584193,4023233417,2562383102,271733878])},
|
||
_doProcessBlock:function(m,f){for(var g=0;16>g;g++){var j=f+g,p=m[j];m[j]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}var g=this._hash.words,j=m[f+0],p=m[f+1],q=m[f+2],r=m[f+3],s=m[f+4],t=m[f+5],u=m[f+6],v=m[f+7],w=m[f+8],x=m[f+9],y=m[f+10],z=m[f+11],A=m[f+12],B=m[f+13],C=m[f+14],D=m[f+15],b=g[0],c=g[1],d=g[2],e=g[3],b=h(b,c,d,e,j,7,a[0]),e=h(e,b,c,d,p,12,a[1]),d=h(d,e,b,c,q,17,a[2]),c=h(c,d,e,b,r,22,a[3]),b=h(b,c,d,e,s,7,a[4]),e=h(e,b,c,d,t,12,a[5]),d=h(d,e,b,c,u,17,a[6]),c=h(c,d,e,b,v,22,a[7]),
|
||
b=h(b,c,d,e,w,7,a[8]),e=h(e,b,c,d,x,12,a[9]),d=h(d,e,b,c,y,17,a[10]),c=h(c,d,e,b,z,22,a[11]),b=h(b,c,d,e,A,7,a[12]),e=h(e,b,c,d,B,12,a[13]),d=h(d,e,b,c,C,17,a[14]),c=h(c,d,e,b,D,22,a[15]),b=k(b,c,d,e,p,5,a[16]),e=k(e,b,c,d,u,9,a[17]),d=k(d,e,b,c,z,14,a[18]),c=k(c,d,e,b,j,20,a[19]),b=k(b,c,d,e,t,5,a[20]),e=k(e,b,c,d,y,9,a[21]),d=k(d,e,b,c,D,14,a[22]),c=k(c,d,e,b,s,20,a[23]),b=k(b,c,d,e,x,5,a[24]),e=k(e,b,c,d,C,9,a[25]),d=k(d,e,b,c,r,14,a[26]),c=k(c,d,e,b,w,20,a[27]),b=k(b,c,d,e,B,5,a[28]),e=k(e,b,
|
||
c,d,q,9,a[29]),d=k(d,e,b,c,v,14,a[30]),c=k(c,d,e,b,A,20,a[31]),b=l(b,c,d,e,t,4,a[32]),e=l(e,b,c,d,w,11,a[33]),d=l(d,e,b,c,z,16,a[34]),c=l(c,d,e,b,C,23,a[35]),b=l(b,c,d,e,p,4,a[36]),e=l(e,b,c,d,s,11,a[37]),d=l(d,e,b,c,v,16,a[38]),c=l(c,d,e,b,y,23,a[39]),b=l(b,c,d,e,B,4,a[40]),e=l(e,b,c,d,j,11,a[41]),d=l(d,e,b,c,r,16,a[42]),c=l(c,d,e,b,u,23,a[43]),b=l(b,c,d,e,x,4,a[44]),e=l(e,b,c,d,A,11,a[45]),d=l(d,e,b,c,D,16,a[46]),c=l(c,d,e,b,q,23,a[47]),b=n(b,c,d,e,j,6,a[48]),e=n(e,b,c,d,v,10,a[49]),d=n(d,e,b,c,
|
||
C,15,a[50]),c=n(c,d,e,b,t,21,a[51]),b=n(b,c,d,e,A,6,a[52]),e=n(e,b,c,d,r,10,a[53]),d=n(d,e,b,c,y,15,a[54]),c=n(c,d,e,b,p,21,a[55]),b=n(b,c,d,e,w,6,a[56]),e=n(e,b,c,d,D,10,a[57]),d=n(d,e,b,c,u,15,a[58]),c=n(c,d,e,b,B,21,a[59]),b=n(b,c,d,e,s,6,a[60]),e=n(e,b,c,d,z,10,a[61]),d=n(d,e,b,c,q,15,a[62]),c=n(c,d,e,b,x,21,a[63]);g[0]=g[0]+b|0;g[1]=g[1]+c|0;g[2]=g[2]+d|0;g[3]=g[3]+e|0},_doFinalize:function(){var a=this._data,f=a.words,g=8*this._nDataBytes,j=8*a.sigBytes;f[j>>>5]|=128<<24-j%32;var h=E.floor(g/
|
||
4294967296);f[(j+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;f[(j+64>>>9<<4)+14]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;a.sigBytes=4*(f.length+1);this._process();a=this._hash;f=a.words;for(g=0;4>g;g++)j=f[g],f[g]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360;return a},clone:function(){var a=s.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=s._createHelper(q);r.HmacMD5=s._createHmacHelper(q)})(Math);
|
||
/*
|
||
CryptoJS v3.1.2 enc-base64-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a<f;a+=3)for(var d=(e[a>>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g<f;g++)b.push(c.charAt(d>>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d<
|
||
e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
|
||
/*
|
||
CryptoJS v3.1.2 cipher-core-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
CryptoJS.lib.Cipher||function(u){var g=CryptoJS,f=g.lib,k=f.Base,l=f.WordArray,q=f.BufferedBlockAlgorithm,r=g.enc.Base64,v=g.algo.EvpKDF,n=f.Cipher=q.extend({cfg:k.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c);this._xformMode=a;this._key=b;this.reset()},reset:function(){q.reset.call(this);this._doReset()},process:function(a){this._append(a);
|
||
return this._process()},finalize:function(a){a&&this._append(a);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(a){return{encrypt:function(b,c,d){return("string"==typeof c?s:j).encrypt(a,b,c,d)},decrypt:function(b,c,d){return("string"==typeof c?s:j).decrypt(a,b,c,d)}}}});f.StreamCipher=n.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var m=g.mode={},t=function(a,b,c){var d=this._iv;d?this._iv=u:d=this._prevBlock;for(var e=
|
||
0;e<c;e++)a[b+e]^=d[e]},h=(f.BlockCipherMode=k.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a;this._iv=b}})).extend();h.Encryptor=h.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize;t.call(this,a,b,d);c.encryptBlock(a,b);this._prevBlock=a.slice(b,b+d)}});h.Decryptor=h.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=a.slice(b,b+d);c.decryptBlock(a,
|
||
b);t.call(this,a,b,d);this._prevBlock=e}});m=m.CBC=h;h=(g.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,c=c-a.sigBytes%c,d=c<<24|c<<16|c<<8|c,e=[],f=0;f<c;f+=4)e.push(d);c=l.create(e,c);a.concat(c)},unpad:function(a){a.sigBytes-=a.words[a.sigBytes-1>>>2]&255}};f.BlockCipher=n.extend({cfg:n.cfg.extend({mode:m,padding:h}),reset:function(){n.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;
|
||
this._mode=c.call(a,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var p=f.CipherParams=k.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),m=(g.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;
|
||
return(a?l.create([1398893684,1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=l.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return p.create({ciphertext:a,salt:c})}},j=f.SerializableCipher=k.extend({cfg:k.extend({format:m}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return p.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding,
|
||
blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),g=(g.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=l.random(8));a=v.create({keySize:b+c}).compute(a,d);c=l.create(a.words.slice(b),4*c);a.sigBytes=4*b;return p.create({key:a,iv:c,salt:d})}},s=f.PasswordBasedCipher=j.extend({cfg:j.cfg.extend({kdf:g}),encrypt:function(a,
|
||
b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=c.iv;a=j.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return j.decrypt.call(this,a,b,c.key,d)}})}();
|
||
/*
|
||
CryptoJS v3.1.2 aes-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){for(var q=CryptoJS,x=q.lib.BlockCipher,r=q.algo,j=[],y=[],z=[],A=[],B=[],C=[],s=[],u=[],v=[],w=[],g=[],k=0;256>k;k++)g[k]=128>k?k<<1:k<<1^283;for(var n=0,l=0,k=0;256>k;k++){var f=l^l<<1^l<<2^l<<3^l<<4,f=f>>>8^f&255^99;j[n]=f;y[f]=n;var t=g[n],D=g[t],E=g[D],b=257*g[f]^16843008*f;z[n]=b<<24|b>>>8;A[n]=b<<16|b>>>16;B[n]=b<<8|b>>>24;C[n]=b;b=16843009*E^65537*D^257*t^16843008*n;s[f]=b<<24|b>>>8;u[f]=b<<16|b>>>16;v[f]=b<<8|b>>>24;w[f]=b;n?(n=t^g[g[g[E^t]]],l^=g[g[l]]):n=l=1}var F=[0,1,2,4,8,
|
||
16,32,64,128,27,54],r=r.AES=x.extend({_doReset:function(){for(var c=this._key,e=c.words,a=c.sigBytes/4,c=4*((this._nRounds=a+6)+1),b=this._keySchedule=[],h=0;h<c;h++)if(h<a)b[h]=e[h];else{var d=b[h-1];h%a?6<a&&4==h%a&&(d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255]):(d=d<<8|d>>>24,d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255],d^=F[h/a|0]<<24);b[h]=b[h-a]^d}e=this._invKeySchedule=[];for(a=0;a<c;a++)h=c-a,d=a%4?b[h]:b[h-4],e[a]=4>a||4>=h?d:s[j[d>>>24]]^u[j[d>>>16&255]]^v[j[d>>>
|
||
8&255]]^w[j[d&255]]},encryptBlock:function(c,e){this._doCryptBlock(c,e,this._keySchedule,z,A,B,C,j)},decryptBlock:function(c,e){var a=c[e+1];c[e+1]=c[e+3];c[e+3]=a;this._doCryptBlock(c,e,this._invKeySchedule,s,u,v,w,y);a=c[e+1];c[e+1]=c[e+3];c[e+3]=a},_doCryptBlock:function(c,e,a,b,h,d,j,m){for(var n=this._nRounds,f=c[e]^a[0],g=c[e+1]^a[1],k=c[e+2]^a[2],p=c[e+3]^a[3],l=4,t=1;t<n;t++)var q=b[f>>>24]^h[g>>>16&255]^d[k>>>8&255]^j[p&255]^a[l++],r=b[g>>>24]^h[k>>>16&255]^d[p>>>8&255]^j[f&255]^a[l++],s=
|
||
b[k>>>24]^h[p>>>16&255]^d[f>>>8&255]^j[g&255]^a[l++],p=b[p>>>24]^h[f>>>16&255]^d[g>>>8&255]^j[k&255]^a[l++],f=q,g=r,k=s;q=(m[f>>>24]<<24|m[g>>>16&255]<<16|m[k>>>8&255]<<8|m[p&255])^a[l++];r=(m[g>>>24]<<24|m[k>>>16&255]<<16|m[p>>>8&255]<<8|m[f&255])^a[l++];s=(m[k>>>24]<<24|m[p>>>16&255]<<16|m[f>>>8&255]<<8|m[g&255])^a[l++];p=(m[p>>>24]<<24|m[f>>>16&255]<<16|m[g>>>8&255]<<8|m[k&255])^a[l++];c[e]=q;c[e+1]=r;c[e+2]=s;c[e+3]=p},keySize:8});q.AES=x._createHelper(r)})();
|
||
/*
|
||
CryptoJS v3.1.2 tripledes-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){function j(b,c){var a=(this._lBlock>>>b^this._rBlock)&c;this._rBlock^=a;this._lBlock^=a<<b}function l(b,c){var a=(this._rBlock>>>b^this._lBlock)&c;this._lBlock^=a;this._rBlock^=a<<b}var h=CryptoJS,e=h.lib,n=e.WordArray,e=e.BlockCipher,g=h.algo,q=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],p=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,
|
||
55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],r=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],s=[{"0":8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,
|
||
2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,
|
||
1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{"0":1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,
|
||
75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,
|
||
276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{"0":260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,
|
||
14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,
|
||
17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{"0":2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,
|
||
98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,
|
||
1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{"0":128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,
|
||
10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,
|
||
83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{"0":268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,
|
||
2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{"0":1048576,
|
||
16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,
|
||
496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{"0":134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,
|
||
2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,
|
||
2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],t=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],m=g.DES=e.extend({_doReset:function(){for(var b=this._key.words,c=[],a=0;56>a;a++){var f=q[a]-1;c[a]=b[f>>>5]>>>31-f%32&1}b=this._subKeys=[];for(f=0;16>f;f++){for(var d=b[f]=[],e=r[f],a=0;24>a;a++)d[a/6|0]|=c[(p[a]-1+e)%28]<<31-a%6,d[4+(a/6|0)]|=c[28+(p[a+24]-1+e)%28]<<31-a%6;d[0]=d[0]<<1|d[0]>>>31;for(a=1;7>a;a++)d[a]>>>=
|
||
4*(a-1)+3;d[7]=d[7]<<5|d[7]>>>27}c=this._invSubKeys=[];for(a=0;16>a;a++)c[a]=b[15-a]},encryptBlock:function(b,c){this._doCryptBlock(b,c,this._subKeys)},decryptBlock:function(b,c){this._doCryptBlock(b,c,this._invSubKeys)},_doCryptBlock:function(b,c,a){this._lBlock=b[c];this._rBlock=b[c+1];j.call(this,4,252645135);j.call(this,16,65535);l.call(this,2,858993459);l.call(this,8,16711935);j.call(this,1,1431655765);for(var f=0;16>f;f++){for(var d=a[f],e=this._lBlock,h=this._rBlock,g=0,k=0;8>k;k++)g|=s[k][((h^
|
||
d[k])&t[k])>>>0];this._lBlock=h;this._rBlock=e^g}a=this._lBlock;this._lBlock=this._rBlock;this._rBlock=a;j.call(this,1,1431655765);l.call(this,8,16711935);l.call(this,2,858993459);j.call(this,16,65535);j.call(this,4,252645135);b[c]=this._lBlock;b[c+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});h.DES=e._createHelper(m);g=g.TripleDES=e.extend({_doReset:function(){var b=this._key.words;this._des1=m.createEncryptor(n.create(b.slice(0,2)));this._des2=m.createEncryptor(n.create(b.slice(2,4)));this._des3=
|
||
m.createEncryptor(n.create(b.slice(4,6)))},encryptBlock:function(b,c){this._des1.encryptBlock(b,c);this._des2.decryptBlock(b,c);this._des3.encryptBlock(b,c)},decryptBlock:function(b,c){this._des3.decryptBlock(b,c);this._des2.encryptBlock(b,c);this._des1.decryptBlock(b,c)},keySize:6,ivSize:2,blockSize:2});h.TripleDES=e._createHelper(g)})();
|
||
/*
|
||
CryptoJS v3.1.2 sha1-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){var k=CryptoJS,b=k.lib,m=b.WordArray,l=b.Hasher,d=[],b=k.algo.SHA1=l.extend({_doReset:function(){this._hash=new m.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(n,p){for(var a=this._hash.words,e=a[0],f=a[1],h=a[2],j=a[3],b=a[4],c=0;80>c;c++){if(16>c)d[c]=n[p+c]|0;else{var g=d[c-3]^d[c-8]^d[c-14]^d[c-16];d[c]=g<<1|g>>>31}g=(e<<5|e>>>27)+b+d[c];g=20>c?g+((f&h|~f&j)+1518500249):40>c?g+((f^h^j)+1859775393):60>c?g+((f&h|f&j|h&j)-1894007588):g+((f^h^
|
||
j)-899497514);b=j;j=h;h=f<<30|f>>>2;f=e;e=g}a[0]=a[0]+e|0;a[1]=a[1]+f|0;a[2]=a[2]+h|0;a[3]=a[3]+j|0;a[4]=a[4]+b|0},_doFinalize:function(){var b=this._data,d=b.words,a=8*this._nDataBytes,e=8*b.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=Math.floor(a/4294967296);d[(e+64>>>9<<4)+15]=a;b.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var b=l.clone.call(this);b._hash=this._hash.clone();return b}});k.SHA1=l._createHelper(b);k.HmacSHA1=l._createHmacHelper(b)})();
|
||
/*
|
||
CryptoJS v3.1.2 ripemd160-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
/*
|
||
|
||
(c) 2012 by Cedric Mesnil. All rights reserved.
|
||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||
|
||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||
*/
|
||
(function(){var q=CryptoJS,d=q.lib,n=d.WordArray,p=d.Hasher,d=q.algo,x=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),z=n.create([11,14,15,12,
|
||
5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),B=n.create([0,1518500249,1859775393,2400959708,2840853838]),C=n.create([1352829926,1548603684,1836072691,
|
||
2053994217,0]),d=d.RIPEMD160=p.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,v){for(var b=0;16>b;b++){var c=v+b,f=e[c];e[c]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}var c=this._hash.words,f=B.words,d=C.words,n=x.words,q=y.words,p=z.words,w=A.words,t,g,h,j,r,u,k,l,m,s;u=t=c[0];k=g=c[1];l=h=c[2];m=j=c[3];s=r=c[4];for(var a,b=0;80>b;b+=1)a=t+e[v+n[b]]|0,a=16>b?a+((g^h^j)+f[0]):32>b?a+((g&h|~g&j)+f[1]):48>b?
|
||
a+(((g|~h)^j)+f[2]):64>b?a+((g&j|h&~j)+f[3]):a+((g^(h|~j))+f[4]),a|=0,a=a<<p[b]|a>>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<<w[b]|a>>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes;
|
||
d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math);
|
||
/*
|
||
CryptoJS v3.1.2 pbkdf2-min.js
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function(){var b=CryptoJS,a=b.lib,d=a.Base,m=a.WordArray,a=b.algo,q=a.HMAC,l=a.PBKDF2=d.extend({cfg:d.extend({keySize:4,hasher:a.SHA1,iterations:1}),init:function(a){this.cfg=this.cfg.extend(a)},compute:function(a,b){for(var c=this.cfg,f=q.create(c.hasher,a),g=m.create(),d=m.create([1]),l=g.words,r=d.words,n=c.keySize,c=c.iterations;l.length<n;){var h=f.update(b).finalize(d);f.reset();for(var j=h.words,s=j.length,k=h,p=1;p<c;p++){k=f.finalize(k);f.reset();for(var t=k.words,e=0;e<s;e++)j[e]^=t[e]}g.concat(h);
|
||
r[0]++}g.sigBytes=4*n;return g}});b.PBKDF2=function(a,b,c){return l.create(c).compute(a,b)}})();
|
||
|
||
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*/
|
||
var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b64pad="=";function hex2b64(d){var b;var e;var a="";for(b=0;b+3<=d.length;b+=3){e=parseInt(d.substring(b,b+3),16);a+=b64map.charAt(e>>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e<f.length;++e){if(f.charAt(e)==b64pad){break}a=b64map.indexOf(f.charAt(e));if(a<0){continue}if(b==0){d+=int2char(a>>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c<d.length;++c){b[c]=parseInt(d.substring(2*c,2*c+2),16)}return b};
|
||
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*/
|
||
var dbits;var canary=244837814094590;var j_lm=((canary&16777215)==15715070);function BigInteger(e,d,f){if(e!=null){if("number"==typeof e){this.fromNumber(e,d,f)}else{if(d==null&&"string"!=typeof e){this.fromString(e,256)}else{this.fromString(e,d)}}}}function nbi(){return new BigInteger(null)}function am1(f,a,b,e,h,g){while(--g>=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}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{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<<dbits)-1);BigInteger.prototype.DV=(1<<dbits);var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP);BigInteger.prototype.F1=BI_FP-dbits;BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz";var BI_RC=new Array();var rr,vv;rr="0".charCodeAt(0);for(vv=0;vv<=9;++vv){BI_RC[rr++]=vv}rr="a".charCodeAt(0);for(vv=10;vv<36;++vv){BI_RC[rr++]=vv}rr="A".charCodeAt(0);for(vv=10;vv<36;++vv){BI_RC[rr++]=vv}function int2char(a){return BI_RM.charAt(a)}function intAt(b,a){var d=BI_RC[b.charCodeAt(a)];return(d==null)?-1:d}function bnpCopyTo(b){for(var a=this.t-1;a>=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<<f;this[this.t++]=(a>>(this.DB-f))}else{this[this.t-1]|=a<<f}}f+=e;if(f>=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<<f}}this.clamp();if(d){BigInteger.ZERO.subTo(this,this)}}function bnpClamp(){var a=this.s&this.DM;while(this.t>0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<<e)-1,l,a=false,h="",f=this.t;var j=this.DB-(f*this.DB)%e;if(f-->0){if(j<this.DB&&(l=this[f]>>j)>0){a=true;h=int2char(l)}while(f>=0){if(j<e){l=(this[f]&((1<<j)-1))<<(e-j);l|=this[--f]>>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a<this.t;++a){b[a-c]=this[a]}b.t=Math.max(this.t-c,0);b.s=this.s}function bnpLShiftTo(j,e){var b=j%this.DB;var a=this.DB-b;var g=(1<<a)-1;var f=Math.floor(j/this.DB),h=(this.s<<b)&this.DM,d;for(d=this.t-1;d>=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<<b}for(d=f-1;d>=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<<b)-1;d[0]=this[e]>>b;for(var c=e+1;c<this.t;++c){d[c-e-1]|=(this[c]&f)<<a;d[c-e]=this[c]>>b}if(b>0){d[this.t-e-1]|=(this.s&f)<<a}d.t=this.t-e;d.clamp()}function bnpSubTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e<b){g+=this[e]-d[e];f[e++]=g&this.DM;g>>=this.DB}if(d.t<this.t){g-=d.s;while(e<this.t){g+=this[e];f[e++]=g&this.DM;g>>=this.DB}g+=this.s}else{g+=this.s;while(e<d.t){g-=d[e];f[e++]=g&this.DM;g>>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d<f.t;++d){e[d+b.t]=b.am(0,f[d],e,d,0,b.t)}e.s=0;e.clamp();if(this.s!=c.s){BigInteger.ZERO.subTo(e,e)}}function bnpSquareTo(d){var a=this.abs();var b=d.t=2*a.t;while(--b>=0){d[b]=0}for(b=0;b<a.t-1;++b){var e=a.am(b,a[b],d,2*b,0,1);if((d[b+a.t]+=a.am(b+1,2*a[b],d,2*b+1,e,a.t-b-1))>=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t<w.t){if(h!=null){h.fromInt(0)}if(g!=null){this.copyTo(g)}return}if(g==null){g=nbi()}var d=nbi(),a=this.s,l=n.s;var v=this.DB-nbits(w[w.t-1]);if(v>0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<<this.F1)+((p>1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<<this.F1)/o,x=1<<this.F2;var u=g.t,s=u-p,f=(h==null)?nbi():h;d.dlShiftTo(s,f);if(g.compareTo(f)>=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t<p){d[d.t++]=0}while(--s>=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))<c){d.dlShiftTo(s,f);g.subTo(f,g);while(g[u]<--c){g.subTo(f,g)}}}if(h!=null){g.drShiftTo(p,h);if(a!=l){BigInteger.ZERO.subTo(h,h)}}g.t=p;g.clamp();if(v>0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c<this.m.t;++c){var b=a[c]&32767;var d=(b*this.mpl+(((b*this.mph+(a[c]>>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<<c))>0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}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.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.ZERO=nbv(0);BigInteger.ONE=nbv(1);
|
||
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*/
|
||
function bnClone(){var a=nbi();this.copyTo(a);return a}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}}}return((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0]}function bnByteValue(){return(this.t==0)?this.s:(this[0]<<24)>>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}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 bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c<m.length;++c){var k=intAt(m,c);if(k<0){if(m.charAt(c)=="-"&&this.signum()==0){e=true}continue}l=h*l+k;if(++a>=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<<g)-1)}else{d[0]=0}this.fromString(d,256)}}function bnToByteArray(){var b=this.t,c=new Array();c[0]=this.s;var e=this.DB-(b*this.DB)%8,f,a=0;if(b-->0){if(e<this.DB&&(f=this[b]>>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<<e)-1))<<(8-e);f|=this[--b]>>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d<b;++d){e[d]=h(this[d],c[d])}if(c.t<this.t){g=c.s&this.DM;for(d=b;d<this.t;++d){e[d]=h(this[d],g)}e.t=this.t}else{g=this.s&this.DM;for(d=b;d<c.t;++d){e[d]=h(g,c[d])}e.t=c.t}e.s=h(this.s,c.s);e.clamp()}function op_and(a,b){return a&b}function bnAnd(b){var c=nbi();this.bitwiseTo(b,op_and,c);return c}function op_or(a,b){return a|b}function bnOr(b){var c=nbi();this.bitwiseTo(b,op_or,c);return c}function op_xor(a,b){return a^b}function bnXor(b){var c=nbi();this.bitwiseTo(b,op_xor,c);return c}function op_andnot(a,b){return a&~b}function bnAndNot(b){var c=nbi();this.bitwiseTo(b,op_andnot,c);return c}function bnNot(){var b=nbi();for(var a=0;a<this.t;++a){b[a]=this.DM&~this[a]}b.t=this.t;b.s=~this.s;return b}function bnShiftLeft(b){var a=nbi();if(b<0){this.rShiftTo(-b,a)}else{this.lShiftTo(b,a)}return a}function bnShiftRight(b){var a=nbi();if(b<0){this.lShiftTo(-b,a)}else{this.rShiftTo(b,a)}return a}function lbit(a){if(a==0){return -1}var b=0;if((a&65535)==0){a>>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a<this.t;++a){if(this[a]!=0){return a*this.DB+lbit(this[a])}}if(this.s<0){return this.t*this.DB}return -1}function cbit(a){var b=0;while(a!=0){a&=a-1;++b}return b}function bnBitCount(){var c=0,a=this.s&this.DM;for(var b=0;b<this.t;++b){c+=cbit(this[b]^a)}return c}function bnTestBit(b){var a=Math.floor(b/this.DB);if(a>=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e<b){g+=this[e]+d[e];f[e++]=g&this.DM;g>>=this.DB}if(d.t<this.t){g+=d.s;while(e<this.t){g+=this[e];f[e++]=g&this.DM;g>>=this.DB}g+=this.s}else{g+=this.s;while(e<d.t){g+=d[e];f[e++]=g&this.DM;g>>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d<c;++d){e[d+this.t]=this.am(0,b[d],e,d,0,this.t)}for(c=Math.min(b.t,f);d<c;++d){this.am(0,b[d],e,d,0,f-d)}e.clamp()}function bnpMultiplyUpperTo(b,e,d){--e;var c=d.t=this.t+b.t-e;d.s=0;while(--c>=0){d[c]=0}for(c=Math.max(e-this.t,0);c<b.t;++c){d[this.t+c-e]=this.am(e-c,b[c],d,0,0,this.t+c-e)}d.clamp();d.drShiftTo(1,d)}function Barrett(a){this.r2=nbi();this.q3=nbi();BigInteger.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function barrettConvert(a){if(a.s<0||a.t>2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<<h)-1;p[1]=v.convert(this);if(h>1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<<o))==0){v.sqrTo(b,c);y=b;b=c;c=y;if(--o<0){o=this.DB-1;--l}}}return v.revert(b)}function bnGCD(c){var b=(this.s<0)?this.negate():this.clone();var h=(c.s<0)?c.negate():c.clone();if(b.compareTo(h)<0){var e=b;b=h;h=e}var d=b.getLowestSetBit(),f=h.getLowestSetBit();if(f<0){return b}if(d<f){f=d}if(f>0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}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];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d<lowprimes.length;++d){if(b[0]==lowprimes[d]){return true}}return false}if(b.isEven()){return false}d=1;while(d<lowprimes.length){var a=lowprimes[d],c=d+1;while(c<lowprimes.length&&a<lplim){a*=lowprimes[c++]}a=b.modInt(a);while(d<c){if(a%lowprimes[d++]==0){return false}}}return b.millerRabin(e)}function bnpMillerRabin(f){var g=this.subtract(BigInteger.ONE);var c=g.getLowestSetBit();if(c<=0){return false}var h=g.shiftRight(c);f=(f+1)>>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e<f;++e){b.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var l=b.modPow(h,this);if(l.compareTo(BigInteger.ONE)!=0&&l.compareTo(g)!=0){var d=1;while(d++<c&&l.compareTo(g)!=0){l=l.modPowInt(2,this);if(l.compareTo(BigInteger.ONE)==0){return false}}if(l.compareTo(g)!=0){return false}}}return true}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.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.square=bnSquare;
|
||
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*/
|
||
function Arcfour(){this.i=0;this.j=0;this.S=new Array()}function ARC4init(d){var c,a,b;for(c=0;c<256;++c){this.S[c]=c}a=0;for(c=0;c<256;++c){a=(a+this.S[c]+d[c%d.length])&255;b=this.S[c];this.S[c]=this.S[a];this.S[a]=b}this.i=0;this.j=0}function ARC4next(){var a;this.i=(this.i+1)&255;this.j=(this.j+this.S[this.i])&255;a=this.S[this.i];this.S[this.i]=this.S[this.j];this.S[this.j]=a;return this.S[(a+this.S[this.i])&255]}Arcfour.prototype.init=ARC4init;Arcfour.prototype.next=ARC4next;function prng_newstate(){return new Arcfour()}var rng_psize=256;
|
||
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*/
|
||
var rng_state;var rng_pool;var rng_pptr;function rng_seed_int(a){rng_pool[rng_pptr++]^=a&255;rng_pool[rng_pptr++]^=(a>>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(navigator.appName=="Netscape"&&navigator.appVersion<"5"&&window.crypto){var z=window.crypto.random(32);for(t=0;t<z.length;++t){rng_pool[rng_pptr++]=z.charCodeAt(t)&255}}while(rng_pptr<rng_psize){t=Math.floor(65536*Math.random());rng_pool[rng_pptr++]=t>>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr){rng_pool[rng_pptr]=0}rng_pptr=0}return rng_state.next()}function rng_get_bytes(b){var a;for(a=0;a<b.length;++a){b[a]=rng_get_byte()}}function SecureRandom(){}SecureRandom.prototype.nextBytes=rng_get_bytes;
|
||
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*/
|
||
function parseBigInt(b,a){return new BigInteger(b,a)}function linebrk(c,d){var a="";var b=0;while(b+d<c.length){a+=c.substring(b,b+d)+"\n";b+=d}return a+c.substring(b,c.length)}function byte2Hex(a){if(a<16){return"0"+a.toString(16)}else{return a.toString(16)}}function pkcs1pad2(e,h){if(h<e.length+11){alert("Message too long for RSA");return null}var g=new Array();var d=e.length-1;while(d>=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length<a){b+=e(String.fromCharCode.apply(String,c.concat([(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}var SHA1_SIZE=20;function oaep_pad(l,a,c){if(l.length+2*SHA1_SIZE+2>a){throw"Message too long for RSA"}var h="",d;for(d=0;d<a-l.length-2*SHA1_SIZE-2;d+=1){h+="\x00"}var e=rstr_sha1("")+h+"\x01"+l;var f=new Array(SHA1_SIZE);new SecureRandom().nextBytes(f);var g=oaep_mgf1_arr(f,e.length,c||rstr_sha1);var k=[];for(d=0;d<e.length;d+=1){k[d]=e.charCodeAt(d)^g.charCodeAt(d)}var j=oaep_mgf1_arr(k,f.length,rstr_sha1);var b=[0];for(d=0;d<f.length;d+=1){b[d+1]=f[d]^j.charCodeAt(d)}return new BigInteger(b.concat(k))}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 RSASetPublic(b,a){this.isPublic=true;if(typeof b!=="string"){this.n=b;this.e=a}else{if(b!=null&&a!=null&&b.length>0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{alert("Invalid RSA public key")}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(e,d){var a=oaep_pad(e,(this.n.bitLength()+7)>>3,d);if(a==null){return null}var f=this.doPublic(a);if(f==null){return null}var b=f.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA";
|
||
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*/
|
||
function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f<a.length&&a[f]==0){++f}if(a.length-f!=j-1||a[f]!=2){return null}++f;while(a[f]!=0){if(++f>=a.length){return null}}var e="";while(++f<a.length){var h=a[f]&255;if(h<128){e+=String.fromCharCode(h)}else{if((h>191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length<a){b+=e(c+String.fromCharCode.apply(String,[(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}var SHA1_SIZE=20;function oaep_unpad(l,b,e){l=l.toByteArray();var f;for(f=0;f<l.length;f+=1){l[f]&=255}while(l.length<b){l.unshift(0)}l=String.fromCharCode.apply(String,l);if(l.length<2*SHA1_SIZE+2){throw"Cipher too short"}var c=l.substr(1,SHA1_SIZE);var o=l.substr(SHA1_SIZE+1);var m=oaep_mgf1_str(o,SHA1_SIZE,e||rstr_sha1);var h=[],f;for(f=0;f<c.length;f+=1){h[f]=c.charCodeAt(f)^m.charCodeAt(f)}var j=oaep_mgf1_str(String.fromCharCode.apply(String,h),l.length-SHA1_SIZE,rstr_sha1);var g=[];for(f=0;f<o.length;f+=1){g[f]=o.charCodeAt(f)^j.charCodeAt(f)}g=String.fromCharCode.apply(String,g);if(g.substr(0,SHA1_SIZE)!==rstr_sha1("")){throw"Hash mismatch"}g=g.substr(SHA1_SIZE);var a=g.indexOf("\x01");var k=(a!=-1)?g.substr(0,a).lastIndexOf("\x00"):-1;if(k+1!=a){throw"Malformed data"}return g.substr(a+1)}function RSASetPrivate(c,a,b){this.isPrivate=true;if(typeof c!=="string"){this.n=c;this.e=a;this.d=b}else{if(c!=null&&a!=null&&c.length>0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(d,b){var e=parseBigInt(d,16);var a=this.doPrivate(e);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP;
|
||
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
*/
|
||
function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex;
|
||
/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
|
||
*/
|
||
ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(f<g.length){g=g.slice(g.length-f)}else{while(f>g.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true};
|
||
/*! asn1-1.0.6.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d<e;d++){g+="f"}var c=new BigInteger(g,16);var b=c.xor(j).add(BigInteger.ONE);f=b.toString(16).replace(/^-/,"")}return f};this.getPEMStringFromHex=function(a,b){var c=KJUR.asn1;var f=CryptoJS.enc.Hex.parse(a);var d=CryptoJS.enc.Base64.stringify(f);var e=d.replace(/(.{64})/g,"$1\r\n");e=e.replace(/\r\n$/,"");return"-----BEGIN "+b+"-----\r\n"+e+"\r\n-----END "+b+"-----\r\n"};this.newObject=function(b){var g=KJUR.asn1;var k=Object.keys(b);if(k.length!=1){throw"key of param shall be only one."}var j=k[0];if(":bool:int:bitstr:octstr:null:oid:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+j+":")==-1){throw"undefined key: "+j}if(j=="bool"){return new g.DERBoolean(b[j])}if(j=="int"){return new g.DERInteger(b[j])}if(j=="bitstr"){return new g.DERBitString(b[j])}if(j=="octstr"){return new g.DEROctetString(b[j])}if(j=="null"){return new g.DERNull(b[j])}if(j=="oid"){return new g.DERObjectIdentifier(b[j])}if(j=="utf8str"){return new g.DERUTF8String(b[j])}if(j=="numstr"){return new g.DERNumericString(b[j])}if(j=="prnstr"){return new g.DERPrintableString(b[j])}if(j=="telstr"){return new g.DERTeletexString(b[j])}if(j=="ia5str"){return new g.DERIA5String(b[j])}if(j=="utctime"){return new g.DERUTCTime(b[j])}if(j=="gentime"){return new g.DERGeneralizedTime(b[j])}if(j=="seq"){var m=b[j];var h=[];for(var e=0;e<m.length;e++){var l=g.ASN1Util.newObject(m[e]);h.push(l)}return new g.DERSequence({array:h})}if(j=="set"){var m=b[j];var h=[];for(var e=0;e<m.length;e++){var l=g.ASN1Util.newObject(m[e]);h.push(l)}return new g.DERSet({array:h})}if(j=="tag"){var c=b[j];if(Object.prototype.toString.call(c)==="[object Array]"&&c.length==3){var d=g.ASN1Util.newObject(c[2]);return new g.DERTaggedObject({tag:c[0],explicit:c[1],obj:d})}else{var f={};if(c.explicit!==undefined){f.explicit=c.explicit}if(c.tag!==undefined){f.tag=c.tag}if(c.obj===undefined){throw"obj shall be specified for 'tag'."}f.obj=g.ASN1Util.newObject(c.obj);return new g.DERTaggedObject(f)}}};this.jsonToASN1HEX=function(b){var a=this.newObject(b);return a.getEncodedHex()}};KJUR.asn1.ASN1Object=function(){var c=true;var b=null;var d="00";var e="00";var a="";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="+a.length+",v="+this.hV}var i=this.hV.length/2;var h=i.toString(16);if(h.length%2==1){h="0"+h}if(i<128){return h}else{var g=h.length/2;if(g>15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};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}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(a){KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(b){this.hTLV=null;this.isModified=true;this.hV=b};this.setUnusedBitsAndHexValue=function(b,d){if(b<0||7<b){throw"unused bits shall be from 0 to 7: u = "+b}var c="0"+b;this.hTLV=null;this.isModified=true;this.hV=c+d};this.setByBinaryString=function(e){e=e.replace(/0+$/,"");var f=8-e.length%8;if(f==8){f=0}for(var g=0;g<=f;g++){e+="0"}var j="";for(var g=0;g<e.length-1;g+=8){var d=e.substr(g,8);var c=parseInt(d,2).toString(16);if(c.length==1){c="0"+c}j+=c}this.hTLV=null;this.isModified=true;this.hV="0"+f+j};this.setByBooleanArray=function(d){var c="";for(var b=0;b<d.length;b++){if(d[b]==true){c+="1"}else{c+="0"}}this.setByBinaryString(c)};this.newFalseArray=function(d){var b=new Array(d);for(var c=0;c<d;c++){b[c]=false}return b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a=="string"&&a.toLowerCase().match(/^[0-9a-f]+$/)){this.setHexValueIncludingUnusedBits(a)}else{if(typeof a.hex!="undefined"){this.setHexValueIncludingUnusedBits(a.hex)}else{if(typeof a.bin!="undefined"){this.setByBinaryString(a.bin)}else{if(typeof a.array!="undefined"){this.setByBooleanArray(a.array)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object);KJUR.asn1.DEROctetString=function(a){KJUR.asn1.DEROctetString.superclass.constructor.call(this,a);this.hT="04"};YAHOO.lang.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString);KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this);this.hT="05";this.hTLV="0500"};YAHOO.lang.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object);KJUR.asn1.DERObjectIdentifier=function(c){var b=function(d){var e=d.toString(16);if(e.length==1){e="0"+e}return e};var a=function(k){var j="";var e=new BigInteger(k,10);var d=e.toString(2);var f=7-d.length%7;if(f==7){f=0}var m="";for(var g=0;g<f;g++){m+="0"}d=m+d;for(var g=0;g<d.length-1;g+=7){var l=d.substr(g,7);if(g!=d.length-7){l="1"+l}j+=b(parseInt(l,2))}return j};KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);this.hT="06";this.setValueHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.setValueOidString=function(f){if(!f.match(/^[0-9.]+$/)){throw"malformed oid string: "+f}var g="";var d=f.split(".");var j=parseInt(d[0])*40+parseInt(d[1]);g+=b(j);d.splice(0,2);for(var e=0;e<d.length;e++){g+=a(d[e])}this.hTLV=null;this.isModified=true;this.s=null;this.hV=g};this.setValueName=function(e){if(typeof KJUR.asn1.x509.OID.name2oidList[e]!="undefined"){var d=KJUR.asn1.x509.OID.name2oidList[e];this.setValueOidString(d)}else{throw"DERObjectIdentifier oidName undefined: "+e}};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"&&c.match(/^[0-2].[0-9.]+$/)){this.setValueOidString(c)}else{if(KJUR.asn1.x509.OID.name2oidList[c]!==undefined){this.setValueOidString(KJUR.asn1.x509.OID.name2oidList[c])}else{if(typeof c.oid!="undefined"){this.setValueOidString(c.oid)}else{if(typeof c.hex!="undefined"){this.setValueHex(c.hex)}else{if(typeof c.name!="undefined"){this.setValueName(c.name)}}}}}}};YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.DERUTF8String=function(a){KJUR.asn1.DERUTF8String.superclass.constructor.call(this,a);this.hT="0c"};YAHOO.lang.extend(KJUR.asn1.DERUTF8String,KJUR.asn1.DERAbstractString);KJUR.asn1.DERNumericString=function(a){KJUR.asn1.DERNumericString.superclass.constructor.call(this,a);this.hT="12"};YAHOO.lang.extend(KJUR.asn1.DERNumericString,KJUR.asn1.DERAbstractString);KJUR.asn1.DERPrintableString=function(a){KJUR.asn1.DERPrintableString.superclass.constructor.call(this,a);this.hT="13"};YAHOO.lang.extend(KJUR.asn1.DERPrintableString,KJUR.asn1.DERAbstractString);KJUR.asn1.DERTeletexString=function(a){KJUR.asn1.DERTeletexString.superclass.constructor.call(this,a);this.hT="14"};YAHOO.lang.extend(KJUR.asn1.DERTeletexString,KJUR.asn1.DERAbstractString);KJUR.asn1.DERIA5String=function(a){KJUR.asn1.DERIA5String.superclass.constructor.call(this,a);this.hT="16"};YAHOO.lang.extend(KJUR.asn1.DERIA5String,KJUR.asn1.DERAbstractString);KJUR.asn1.DERUTCTime=function(a){KJUR.asn1.DERUTCTime.superclass.constructor.call(this,a);this.hT="17";this.setByDate=function(b){this.hTLV=null;this.isModified=true;this.date=b;this.s=this.formatDate(this.date,"utc");this.hV=stohex(this.s)};this.getFreshValueHex=function(){if(typeof this.date=="undefined"&&typeof this.s=="undefined"){this.date=new Date();this.s=this.formatDate(this.date,"utc");this.hV=stohex(this.s)}return this.hV};if(typeof a!="undefined"){if(typeof a.str!="undefined"){this.setString(a.str)}else{if(typeof a=="string"&&a.match(/^[0-9]{12}Z$/)){this.setString(a)}else{if(typeof a.hex!="undefined"){this.setStringHex(a.hex)}else{if(typeof a.date!="undefined"){this.setByDate(a.date)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERUTCTime,KJUR.asn1.DERAbstractTime);KJUR.asn1.DERGeneralizedTime=function(a){KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this,a);this.hT="18";this.withMillis=false;this.setByDate=function(b){this.hTLV=null;this.isModified=true;this.date=b;this.s=this.formatDate(this.date,"gen",this.withMillis);this.hV=stohex(this.s)};this.getFreshValueHex=function(){if(typeof this.date=="undefined"&&typeof this.s=="undefined"){this.date=new Date();this.s=this.formatDate(this.date,"gen",this.withMillis);this.hV=stohex(this.s)}return this.hV};if(typeof a!="undefined"){if(typeof a.str!="undefined"){this.setString(a.str)}else{if(typeof a=="string"&&a.match(/^[0-9]{14}Z$/)){this.setString(a)}else{if(typeof a.hex!="undefined"){this.setStringHex(a.hex)}else{if(typeof a.date!="undefined"){this.setByDate(a.date)}else{if(a.millis===true){this.withMillis=true}}}}}}};YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime,KJUR.asn1.DERAbstractTime);KJUR.asn1.DERSequence=function(a){KJUR.asn1.DERSequence.superclass.constructor.call(this,a);this.hT="30";this.getFreshValueHex=function(){var c="";for(var b=0;b<this.asn1Array.length;b++){var d=this.asn1Array[b];c+=d.getEncodedHex()}this.hV=c;return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERSequence,KJUR.asn1.DERAbstractStructured);KJUR.asn1.DERSet=function(a){KJUR.asn1.DERSet.superclass.constructor.call(this,a);this.hT="31";this.sortFlag=true;this.getFreshValueHex=function(){var b=new Array();for(var c=0;c<this.asn1Array.length;c++){var d=this.asn1Array[c];b.push(d.getEncodedHex())}if(this.sortFlag==true){b.sort()}this.hV=b.join("");return this.hV};if(typeof a!="undefined"){if(typeof a.sortflag!="undefined"&&a.sortflag==false){this.sortFlag=false}}};YAHOO.lang.extend(KJUR.asn1.DERSet,KJUR.asn1.DERAbstractStructured);KJUR.asn1.DERTaggedObject=function(a){KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);this.hT="a0";this.hV="";this.isExplicit=true;this.asn1Object=null;this.setASN1Object=function(b,c,d){this.hT=c;this.isExplicit=b;this.asn1Object=d;if(this.isExplicit){this.hV=this.asn1Object.getEncodedHex();this.hTLV=null;this.isModified=true}else{this.hV=null;this.hTLV=d.getEncodedHex();this.hTLV=this.hTLV.replace(/^../,c);this.isModified=false}};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.tag!="undefined"){this.hT=a.tag}if(typeof a.explicit!="undefined"){this.isExplicit=a.explicit}if(typeof a.obj!="undefined"){this.asn1Object=a.obj;this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)}}};YAHOO.lang.extend(KJUR.asn1.DERTaggedObject,KJUR.asn1.ASN1Object);
|
||
/*! asn1hex-1.1.5.js (c) 2012-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
var ASN1HEX=new function(){this.getByteLengthOfL_AtObj=function(b,c){if(b.substring(c+2,c+3)!="8"){return 1}var a=parseInt(b.substring(c+3,c+4));if(a==0){return -1}if(0<a&&a<10){return a+1}return -2};this.getHexOfL_AtObj=function(b,c){var a=this.getByteLengthOfL_AtObj(b,c);if(a<1){return""}return b.substring(c+2,c+2+a*2)};this.getIntOfL_AtObj=function(c,d){var b=this.getHexOfL_AtObj(c,d);if(b==""){return -1}var a;if(parseInt(b.substring(0,1))<8){a=new BigInteger(b,16)}else{a=new BigInteger(b.substring(2),16)}return a.intValue()};this.getStartPosOfV_AtObj=function(b,c){var a=this.getByteLengthOfL_AtObj(b,c);if(a<0){return a}return c+(a+1)*2};this.getHexOfV_AtObj=function(c,d){var b=this.getStartPosOfV_AtObj(c,d);var a=this.getIntOfL_AtObj(c,d);return c.substring(b,b+a*2)};this.getHexOfTLV_AtObj=function(c,e){var b=c.substr(e,2);var d=this.getHexOfL_AtObj(c,e);var a=this.getHexOfV_AtObj(c,e);return b+d+a};this.getPosOfNextSibling_AtObj=function(c,d){var b=this.getStartPosOfV_AtObj(c,d);var a=this.getIntOfL_AtObj(c,d);return b+a*2};this.getPosArrayOfChildren_AtObj=function(f,j){var c=new Array();var i=this.getStartPosOfV_AtObj(f,j);c.push(i);var b=this.getIntOfL_AtObj(f,j);var g=i;var d=0;while(1){var e=this.getPosOfNextSibling_AtObj(f,g);if(e==null||(e-i>=(b*2))){break}if(d>=200){break}c.push(e);g=e;d++}return c};this.getNthChildIndex_AtObj=function(d,b,e){var c=this.getPosArrayOfChildren_AtObj(d,b);return c[e]};this.getDecendantIndexByNthList=function(e,d,c){if(c.length==0){return d}var f=c.shift();var b=this.getPosArrayOfChildren_AtObj(e,d);return this.getDecendantIndexByNthList(e,b[f],c)};this.getDecendantHexTLVByNthList=function(d,c,b){var a=this.getDecendantIndexByNthList(d,c,b);return this.getHexOfTLV_AtObj(d,a)};this.getDecendantHexVByNthList=function(d,c,b){var a=this.getDecendantIndexByNthList(d,c,b);return this.getHexOfV_AtObj(d,a)}};ASN1HEX.getVbyList=function(d,c,b,e){var a=this.getDecendantIndexByNthList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(e!==undefined){if(d.substr(a,2)!=e){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+e}}return this.getHexOfV_AtObj(d,a)};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g<m.length/2;g++){k.push(parseInt(m.substr(g*2,2),16))}var j=[];var d="";for(var g=0;g<k.length;g++){if(k[g]&128){d=d+h((k[g]&127).toString(2),7)}else{d=d+h((k[g]&127).toString(2),7);j.push(new String(parseInt(d,2)));d=""}}var n=l.join(".");if(j.length>0){n=n+"."+j.join(".")}return n};
|
||
/*! asn1x509-1.0.9.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.x509=="undefined"||!KJUR.asn1.x509){KJUR.asn1.x509={}}KJUR.asn1.x509.Certificate=function(g){KJUR.asn1.x509.Certificate.superclass.constructor.call(this);var b=null;var d=null;var f=null;var c=null;var a=null;var e=null;this.setRsaPrvKeyByPEMandPass=function(i,k){var h=PKCS5PKEY.getDecryptedKeyHex(i,k);var j=new RSAKey();j.readPrivateKeyFromASN1HexString(h);this.prvKey=j};this.sign=function(){this.asn1SignatureAlg=this.asn1TBSCert.asn1SignatureAlg;sig=new KJUR.crypto.Signature({alg:"SHA1withRSA"});sig.init(this.prvKey);sig.updateHex(this.asn1TBSCert.getEncodedHex());this.hexSig=sig.sign();this.asn1Sig=new KJUR.asn1.DERBitString({hex:"00"+this.hexSig});var h=new KJUR.asn1.DERSequence({array:[this.asn1TBSCert,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=h.getEncodedHex();this.isModified=false};this.setSignatureHex=function(h){this.asn1SignatureAlg=this.asn1TBSCert.asn1SignatureAlg;this.hexSig=h;this.asn1Sig=new KJUR.asn1.DERBitString({hex:"00"+this.hexSig});var i=new KJUR.asn1.DERSequence({array:[this.asn1TBSCert,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=i.getEncodedHex();this.isModified=false};this.getEncodedHex=function(){if(this.isModified==false&&this.hTLV!=null){return this.hTLV}throw"not signed yet"};this.getPEMString=function(){var j=this.getEncodedHex();var h=CryptoJS.enc.Hex.parse(j);var i=CryptoJS.enc.Base64.stringify(h);var k=i.replace(/(.{64})/g,"$1\r\n");return"-----BEGIN CERTIFICATE-----\r\n"+k+"\r\n-----END CERTIFICATE-----\r\n"};if(typeof g!="undefined"){if(typeof g.tbscertobj!="undefined"){this.asn1TBSCert=g.tbscertobj}if(typeof g.prvkeyobj!="undefined"){this.prvKey=g.prvkeyobj}else{if(typeof g.rsaprvkey!="undefined"){this.prvKey=g.rsaprvkey}else{if((typeof g.rsaprvpem!="undefined")&&(typeof g.rsaprvpas!="undefined")){this.setRsaPrvKeyByPEMandPass(g.rsaprvpem,g.rsaprvpas)}}}}};YAHOO.lang.extend(KJUR.asn1.x509.Certificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.TBSCertificate=function(a){KJUR.asn1.x509.TBSCertificate.superclass.constructor.call(this);this._initialize=function(){this.asn1Array=new Array();this.asn1Version=new KJUR.asn1.DERTaggedObject({obj:new KJUR.asn1.DERInteger({"int":2})});this.asn1SerialNumber=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1NotBefore=null;this.asn1NotAfter=null;this.asn1Subject=null;this.asn1SubjPKey=null;this.extensionsArray=new Array()};this.setSerialNumberByParam=function(b){this.asn1SerialNumber=new KJUR.asn1.DERInteger(b)};this.setSignatureAlgByParam=function(b){this.asn1SignatureAlg=new KJUR.asn1.x509.AlgorithmIdentifier(b)};this.setIssuerByParam=function(b){this.asn1Issuer=new KJUR.asn1.x509.X500Name(b)};this.setNotBeforeByParam=function(b){this.asn1NotBefore=new KJUR.asn1.x509.Time(b)};this.setNotAfterByParam=function(b){this.asn1NotAfter=new KJUR.asn1.x509.Time(b)};this.setSubjectByParam=function(b){this.asn1Subject=new KJUR.asn1.x509.X500Name(b)};this.setSubjectPublicKeyByParam=function(b){this.asn1SubjPKey=new KJUR.asn1.x509.SubjectPublicKeyInfo(b)};this.setSubjectPublicKeyByGetKey=function(c){var b=KEYUTIL.getKey(c);this.asn1SubjPKey=new KJUR.asn1.x509.SubjectPublicKeyInfo(b)};this.appendExtension=function(b){this.extensionsArray.push(b)};this.appendExtensionByName=function(d,b){if(d.toLowerCase()=="basicconstraints"){var c=new KJUR.asn1.x509.BasicConstraints(b);this.appendExtension(c)}else{if(d.toLowerCase()=="keyusage"){var c=new KJUR.asn1.x509.KeyUsage(b);this.appendExtension(c)}else{if(d.toLowerCase()=="crldistributionpoints"){var c=new KJUR.asn1.x509.CRLDistributionPoints(b);this.appendExtension(c)}else{if(d.toLowerCase()=="extkeyusage"){var c=new KJUR.asn1.x509.ExtKeyUsage(b);this.appendExtension(c)}else{if(d.toLowerCase()=="authoritykeyidentifier"){var c=new KJUR.asn1.x509.AuthorityKeyIdentifier(b);this.appendExtension(c)}else{throw"unsupported extension name: "+d}}}}}};this.getEncodedHex=function(){if(this.asn1NotBefore==null||this.asn1NotAfter==null){throw"notBefore and/or notAfter not set"}var c=new KJUR.asn1.DERSequence({array:[this.asn1NotBefore,this.asn1NotAfter]});this.asn1Array=new Array();this.asn1Array.push(this.asn1Version);this.asn1Array.push(this.asn1SerialNumber);this.asn1Array.push(this.asn1SignatureAlg);this.asn1Array.push(this.asn1Issuer);this.asn1Array.push(c);this.asn1Array.push(this.asn1Subject);this.asn1Array.push(this.asn1SubjPKey);if(this.extensionsArray.length>0){var d=new KJUR.asn1.DERSequence({array:this.extensionsArray});var b=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a3",obj:d});this.asn1Array.push(b)}var e=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=e.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(b){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var a=null;this.getEncodedHex=function(){var f=new KJUR.asn1.DERObjectIdentifier({oid:this.oid});var e=new KJUR.asn1.DEROctetString({hex:this.getExtnValueHex()});var d=new Array();d.push(f);if(this.critical){d.push(new KJUR.asn1.DERBoolean())}d.push(e);var c=new KJUR.asn1.DERSequence({array:d});return c.getEncodedHex()};this.critical=false;if(typeof b!="undefined"){if(typeof b.critical!="undefined"){this.critical=b.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(a){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence({array:b})};this.setByOneURI=function(e){var b=new KJUR.asn1.x509.GeneralNames([{uri:e}]);var d=new KJUR.asn1.x509.DistributionPointName(b);var c=new KJUR.asn1.x509.DistributionPoint({dpobj:d});this.setByDPArray([c])};this.oid="2.5.29.31";if(typeof a!="undefined"){if(typeof a.array!="undefined"){this.setByDPArray(a.array)}else{if(typeof a.uri!="undefined"){this.setByOneURI(a.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(a){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,a);this.setPurposeArray=function(b){this.asn1ExtnValue=new KJUR.asn1.DERSequence();for(var c=0;c<b.length;c++){var d=new KJUR.asn1.DERObjectIdentifier(b[c]);this.asn1ExtnValue.appendASN1Object(d)}};this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.37";if(typeof a!="undefined"){if(typeof a.array!="undefined"){this.setPurposeArray(a.array)}}};YAHOO.lang.extend(KJUR.asn1.x509.ExtKeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.AuthorityKeyIdentifier=function(a){KJUR.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,a);this.asn1KID=null;this.asn1CertIssuer=null;this.asn1CertSN=null;this.getExtnValueHex=function(){var c=new Array();if(this.asn1KID){c.push(new KJUR.asn1.DERTaggedObject({explicit:false,tag:"80",obj:this.asn1KID}))}if(this.asn1CertIssuer){c.push(new KJUR.asn1.DERTaggedObject({explicit:false,tag:"a1",obj:this.asn1CertIssuer}))}if(this.asn1CertSN){c.push(new KJUR.asn1.DERTaggedObject({explicit:false,tag:"82",obj:this.asn1CertSN}))}var b=new KJUR.asn1.DERSequence({array:c});this.asn1ExtnValue=b;return this.asn1ExtnValue.getEncodedHex()};this.setKIDByParam=function(b){this.asn1KID=new KJUR.asn1.DEROctetString(b)};this.setCertIssuerByParam=function(b){this.asn1CertIssuer=new KJUR.asn1.x509.X500Name(b)};this.setCertSNByParam=function(b){this.asn1CertSN=new KJUR.asn1.DERInteger(b)};this.oid="2.5.29.35";if(typeof a!="undefined"){if(typeof a.kid!="undefined"){this.setKIDByParam(a.kid)}if(typeof a.issuer!="undefined"){this.setCertIssuerByParam(a.issuer)}if(typeof a.sn!="undefined"){this.setCertSNByParam(a.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.AuthorityKeyIdentifier,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRL=function(f){KJUR.asn1.x509.CRL.superclass.constructor.call(this);var a=null;var c=null;var e=null;var b=null;var d=null;this.setRsaPrvKeyByPEMandPass=function(h,j){var g=PKCS5PKEY.getDecryptedKeyHex(h,j);var i=new RSAKey();i.readPrivateKeyFromASN1HexString(g);this.rsaPrvKey=i};this.sign=function(){this.asn1SignatureAlg=this.asn1TBSCertList.asn1SignatureAlg;sig=new KJUR.crypto.Signature({alg:"SHA1withRSA",prov:"cryptojs/jsrsa"});sig.initSign(this.rsaPrvKey);sig.updateHex(this.asn1TBSCertList.getEncodedHex());this.hexSig=sig.sign();this.asn1Sig=new KJUR.asn1.DERBitString({hex:"00"+this.hexSig});var g=new KJUR.asn1.DERSequence({array:[this.asn1TBSCertList,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=g.getEncodedHex();this.isModified=false};this.getEncodedHex=function(){if(this.isModified==false&&this.hTLV!=null){return this.hTLV}throw"not signed yet"};this.getPEMString=function(){var i=this.getEncodedHex();var g=CryptoJS.enc.Hex.parse(i);var h=CryptoJS.enc.Base64.stringify(g);var j=h.replace(/(.{64})/g,"$1\r\n");return"-----BEGIN X509 CRL-----\r\n"+j+"\r\n-----END X509 CRL-----\r\n"};if(typeof f!="undefined"){if(typeof f.tbsobj!="undefined"){this.asn1TBSCertList=f.tbsobj}if(typeof f.rsaprvkey!="undefined"){this.rsaPrvKey=f.rsaprvkey}if((typeof f.rsaprvpem!="undefined")&&(typeof f.rsaprvpas!="undefined")){this.setRsaPrvKeyByPEMandPass(f.rsaprvpem,f.rsaprvpas)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRL,KJUR.asn1.ASN1Object);KJUR.asn1.x509.TBSCertList=function(b){KJUR.asn1.x509.TBSCertList.superclass.constructor.call(this);var a=null;this.setSignatureAlgByParam=function(c){this.asn1SignatureAlg=new KJUR.asn1.x509.AlgorithmIdentifier(c)};this.setIssuerByParam=function(c){this.asn1Issuer=new KJUR.asn1.x509.X500Name(c)};this.setThisUpdateByParam=function(c){this.asn1ThisUpdate=new KJUR.asn1.x509.Time(c)};this.setNextUpdateByParam=function(c){this.asn1NextUpdate=new KJUR.asn1.x509.Time(c)};this.addRevokedCert=function(c,d){var f={};if(c!=undefined&&c!=null){f.sn=c}if(d!=undefined&&d!=null){f.time=d}var e=new KJUR.asn1.x509.CRLEntry(f);this.aRevokedCert.push(e)};this.getEncodedHex=function(){this.asn1Array=new Array();if(this.asn1Version!=null){this.asn1Array.push(this.asn1Version)}this.asn1Array.push(this.asn1SignatureAlg);this.asn1Array.push(this.asn1Issuer);this.asn1Array.push(this.asn1ThisUpdate);if(this.asn1NextUpdate!=null){this.asn1Array.push(this.asn1NextUpdate)}if(this.aRevokedCert.length>0){var c=new KJUR.asn1.DERSequence({array:this.aRevokedCert});this.asn1Array.push(c)}var d=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=d.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(c){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var b=null;var a=null;this.setCertSerial=function(d){this.sn=new KJUR.asn1.DERInteger(d)};this.setRevocationDate=function(d){this.time=new KJUR.asn1.x509.Time(d)};this.getEncodedHex=function(){var d=new KJUR.asn1.DERSequence({array:[this.sn,this.time]});this.TLV=d.getEncodedHex();return this.TLV};if(typeof c!="undefined"){if(typeof c.time!="undefined"){this.setRevocationDate(c.time)}if(typeof c.sn!="undefined"){this.setCertSerial(c.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(b){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();this.setByString=function(c){var d=c.split("/");d.shift();for(var e=0;e<d.length;e++){this.asn1Array.push(new KJUR.asn1.x509.RDN({str:d[e]}))}};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var c=new KJUR.asn1.DERSequence({array:this.asn1Array});this.hTLV=c.getEncodedHex();return this.hTLV};if(typeof b!="undefined"){if(typeof b.str!="undefined"){this.setByString(b.str)}if(typeof b.certissuer!="undefined"){var a=new X509();a.hex=X509.pemToHex(b.certissuer);this.hTLV=a.getIssuerHex()}if(typeof b.certsubject!="undefined"){var a=new X509();a.hex=X509.pemToHex(b.certsubject);this.hTLV=a.getSubjectHex()}}};YAHOO.lang.extend(KJUR.asn1.x509.X500Name,KJUR.asn1.ASN1Object);KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.getEncodedHex=function(){var b=new KJUR.asn1.DERSet({array:this.asn1Array});this.TLV=b.getEncodedHex();return this.TLV};if(typeof a!="undefined"){if(typeof a.str!="undefined"){this.addByString(a.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.RDN,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AttributeTypeAndValue=function(b){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var d=null;var c=null;var a="utf8";this.setByString=function(e){if(e.match(/^([^=]+)=(.+)$/)){this.setByAttrTypeAndValueStr(RegExp.$1,RegExp.$2)}else{throw"malformed attrTypeAndValueStr: "+e}};this.setByAttrTypeAndValueStr=function(g,f){this.typeObj=KJUR.asn1.x509.OID.atype2obj(g);var e=a;if(g=="C"){e="prn"}this.valueObj=this.getValueObj(e,f)};this.getValueObj=function(f,e){if(f=="utf8"){return new KJUR.asn1.DERUTF8String({str:e})}if(f=="prn"){return new KJUR.asn1.DERPrintableString({str:e})}if(f=="tel"){return new KJUR.asn1.DERTeletexString({str:e})}if(f=="ia5"){return new KJUR.asn1.DERIA5String({str:e})}throw"unsupported directory string type: type="+f+" value="+e};this.getEncodedHex=function(){var e=new KJUR.asn1.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=e.getEncodedHex();return this.TLV};if(typeof b!="undefined"){if(typeof b.str!="undefined"){this.setByString(b.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(d){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var b=null;var c=null;var a=null;this.setRSAKey=function(e){if(!RSAKey.prototype.isPrototypeOf(e)){throw"argument is not RSAKey instance"}this.rsaKey=e;var g=new KJUR.asn1.DERInteger({bigint:e.n});var f=new KJUR.asn1.DERInteger({"int":e.e});var i=new KJUR.asn1.DERSequence({array:[g,f]});var h=i.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+h})};this.setRSAPEM=function(g){if(g.match(/-----BEGIN PUBLIC KEY-----/)){var n=g;n=n.replace(/^-----[^-]+-----/,"");n=n.replace(/-----[^-]+-----\s*$/,"");var m=n.replace(/\s+/g,"");var f=CryptoJS.enc.Base64.parse(m);var i=CryptoJS.enc.Hex.stringify(f);var k=_rsapem_getHexValueArrayOfChildrenFromHex(i);var h=k[1];var l=h.substr(2);var e=_rsapem_getHexValueArrayOfChildrenFromHex(l);var j=new RSAKey();j.setPublic(e[0],e[1]);this.setRSAKey(j)}else{throw"key not supported"}};this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var e=new KJUR.asn1.DERSequence({array:[this.asn1AlgId,this.asn1SubjPKey]});return e};this.getEncodedHex=function(){var e=this.getASN1Object();this.hTLV=e.getEncodedHex();return this.hTLV};this._setRSAKey=function(e){var g=KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.n}},{"int":{"int":e.e}}]});var f=g.getEncodedHex();this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+f})};this._setEC=function(e){var f=new KJUR.asn1.DERObjectIdentifier({name:e.curveName});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"ecPublicKey",asn1params:f});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+e.pubKeyHex})};this._setDSA=function(e){var f=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":{bigint:e.p}},{"int":{bigint:e.q}},{"int":{bigint:e.g}}]});this.asn1AlgId=new KJUR.asn1.x509.AlgorithmIdentifier({name:"dsa",asn1params:f});var g=new KJUR.asn1.DERInteger({bigint:e.y});this.asn1SubjPKey=new KJUR.asn1.DERBitString({hex:"00"+g.getEncodedHex()})};if(typeof d!="undefined"){if(typeof RSAKey!="undefined"&&d instanceof RSAKey){this._setRSAKey(d)}else{if(typeof KJUR.crypto.ECDSA!="undefined"&&d instanceof KJUR.crypto.ECDSA){this._setEC(d)}else{if(typeof KJUR.crypto.DSA!="undefined"&&d instanceof KJUR.crypto.DSA){this._setDSA(d)}else{if(typeof d.rsakey!="undefined"){this.setRSAKey(d.rsakey)}else{if(typeof d.rsapem!="undefined"){this.setRSAPEM(d.rsapem)}}}}}}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(c){KJUR.asn1.x509.Time.superclass.constructor.call(this);var b=null;var a=null;this.setTimeParams=function(d){this.timeParams=d};this.getEncodedHex=function(){var d=null;if(this.timeParams!=null){if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime(this.timeParams)}else{d=new KJUR.asn1.DERGeneralizedTime(this.timeParams)}}else{if(this.type=="utc"){d=new KJUR.asn1.DERUTCTime()}else{d=new KJUR.asn1.DERGeneralizedTime()}}this.TLV=d.getEncodedHex();return this.TLV};this.type="utc";if(typeof c!="undefined"){if(typeof c.type!="undefined"){this.type=c.type}else{if(typeof c.str!="undefined"){if(c.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(c.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=c}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(e){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);var a=null;var d=null;var b=null;var c=false;this.getEncodedHex=function(){if(this.nameAlg==null&&this.asn1Alg==null){throw"algorithm not specified"}if(this.nameAlg!=null&&this.asn1Alg==null){this.asn1Alg=KJUR.asn1.x509.OID.name2obj(this.nameAlg)}var f=[this.asn1Alg];if(!this.paramEmpty){f.push(this.asn1Params)}var g=new KJUR.asn1.DERSequence({array:f});this.hTLV=g.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){this.nameAlg=e.name}if(typeof e.asn1params!="undefined"){this.asn1Params=e.asn1params}if(typeof e.paramempty!="undefined"){this.paramEmpty=e.paramempty}}if(this.asn1Params==null){this.asn1Params=new KJUR.asn1.DERNull()}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(d){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var c=null;var b=null;var a={rfc822:"81",dns:"82",uri:"86"};this.setByParam=function(g){var f=null;var e=null;if(typeof g.rfc822!="undefined"){this.type="rfc822";e=new KJUR.asn1.DERIA5String({str:g[this.type]})}if(typeof g.dns!="undefined"){this.type="dns";e=new KJUR.asn1.DERIA5String({str:g[this.type]})}if(typeof g.uri!="undefined"){this.type="uri";e=new KJUR.asn1.DERIA5String({str:g[this.type]})}if(this.type==null){throw"unsupported type in params="+g}this.asn1Obj=new KJUR.asn1.DERTaggedObject({explicit:false,tag:a[this.type],obj:e})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(typeof d!="undefined"){this.setByParam(d)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(b){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null;this.setByParamArray=function(e){for(var c=0;c<e.length;c++){var d=new KJUR.asn1.x509.GeneralName(e[c]);this.asn1Array.push(d)}};this.getEncodedHex=function(){var c=new KJUR.asn1.DERSequence({array:this.asn1Array});return c.getEncodedHex()};this.asn1Array=new Array();if(typeof b!="undefined"){this.setByParamArray(b)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralNames,KJUR.asn1.ASN1Object);KJUR.asn1.x509.DistributionPointName=function(b){KJUR.asn1.x509.DistributionPointName.superclass.constructor.call(this);var e=null;var c=null;var a=null;var d=null;this.getEncodedHex=function(){if(this.type!="full"){throw"currently type shall be 'full': "+this.type}this.asn1Obj=new KJUR.asn1.DERTaggedObject({explicit:false,tag:this.tag,obj:this.asn1V});this.hTLV=this.asn1Obj.getEncodedHex();return this.hTLV};if(typeof b!="undefined"){if(KJUR.asn1.x509.GeneralNames.prototype.isPrototypeOf(b)){this.type="full";this.tag="a0";this.asn1V=b}else{throw"This class supports GeneralNames only as argument"}}};YAHOO.lang.extend(KJUR.asn1.x509.DistributionPointName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.DistributionPoint=function(b){KJUR.asn1.x509.DistributionPoint.superclass.constructor.call(this);var a=null;this.getEncodedHex=function(){var c=new KJUR.asn1.DERSequence();if(this.asn1DP!=null){var d=new KJUR.asn1.DERTaggedObject({explicit:true,tag:"a0",obj:this.asn1DP});c.appendASN1Object(d)}this.hTLV=c.getEncodedHex();return this.hTLV};if(typeof b!="undefined"){if(typeof b.dpobj!="undefined"){this.asn1DP=b.dpobj}}};YAHOO.lang.extend(KJUR.asn1.x509.DistributionPoint,KJUR.asn1.ASN1Object);KJUR.asn1.x509.OID=new function(a){this.atype2oidList={C:"2.5.4.6",O:"2.5.4.10",OU:"2.5.4.11",ST:"2.5.4.8",L:"2.5.4.7",CN:"2.5.4.3",DN:"2.5.4.49",DC:"0.9.2342.19200300.100.1.25",};this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",subjectKeyIdentifier:"2.5.29.14",countryName:"2.5.4.6",organization:"2.5.4.10",organizationalUnit:"2.5.4.11",stateOrProvinceName:"2.5.4.8",locality:"2.5.4.7",commonName:"2.5.4.3",keyUsage:"2.5.29.15",basicConstraints:"2.5.29.19",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",authorityKeyIdentifier:"2.5.29.35",extKeyUsage:"2.5.29.37",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",ecPublicKey:"1.2.840.10045.2.1",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",};this.objCache={};this.name2obj=function(b){if(typeof this.objCache[b]!="undefined"){return this.objCache[b]}if(typeof this.name2oidList[b]=="undefined"){throw"Name of ObjectIdentifier not defined: "+b}var c=this.name2oidList[b];var d=new KJUR.asn1.DERObjectIdentifier({oid:c});this.objCache[b]=d;return d};this.atype2obj=function(b){if(typeof this.objCache[b]!="undefined"){return this.objCache[b]}if(typeof this.atype2oidList[b]=="undefined"){throw"AttributeType name undefined: "+b}var c=this.atype2oidList[b];var d=new KJUR.asn1.DERObjectIdentifier({oid:c});this.objCache[b]=d;return d}};KJUR.asn1.x509.OID.oid2name=function(b){var c=KJUR.asn1.x509.OID.name2oidList;for(var a in c){if(c[a]==b){return a}}return""};KJUR.asn1.x509.X509Util=new function(){this.getPKCS8PubKeyPEMfromRSAKey=function(i){var h=null;var f=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(i.n);var j=KJUR.asn1.ASN1Util.integerToByteHex(i.e);var a=new KJUR.asn1.DERInteger({hex:f});var g=new KJUR.asn1.DERInteger({hex:j});var l=new KJUR.asn1.DERSequence({array:[a,g]});var c=l.getEncodedHex();var d=new KJUR.asn1.x509.AlgorithmIdentifier({name:"rsaEncryption"});var b=new KJUR.asn1.DERBitString({hex:"00"+c});var k=new KJUR.asn1.DERSequence({array:[d,b]});var e=k.getEncodedHex();var h=KJUR.asn1.ASN1Util.getPEMStringFromHex(e,"PUBLIC KEY");return h}};KJUR.asn1.x509.X509Util.newCertPEM=function(f){var c=KJUR.asn1.x509;var e=new c.TBSCertificate();if(f.serial!==undefined){e.setSerialNumberByParam(f.serial)}else{throw"serial number undefined."}if(typeof f.sigalg.name=="string"){e.setSignatureAlgByParam(f.sigalg)}else{throw"unproper signature algorithm name"}if(f.issuer!==undefined){e.setIssuerByParam(f.issuer)}else{throw"issuer name undefined."}if(f.notbefore!==undefined){e.setNotBeforeByParam(f.notbefore)}else{throw"notbefore undefined."}if(f.notafter!==undefined){e.setNotAfterByParam(f.notafter)}else{throw"notafter undefined."}if(f.subject!==undefined){e.setSubjectByParam(f.subject)}else{throw"subject name undefined."}if(f.sbjpubkey!==undefined){e.setSubjectPublicKeyByGetKey(f.sbjpubkey)}else{throw"subject public key undefined."}if(f.ext!==undefined&&f.ext.length!==undefined){for(var b=0;b<f.ext.length;b++){for(key in f.ext[b]){e.appendExtensionByName(key,f.ext[b][key])}}}if(f.cakey===undefined&&f.sighex===undefined){throw"param cakey and sighex undefined."}var d=null;var a=null;if(f.cakey){d=KEYUTIL.getKey.apply(null,f.cakey);a=new c.Certificate({tbscertobj:e,prvkeyobj:d});a.sign()}if(f.sighex){a=new c.Certificate({tbscertobj:e});a.setSignatureHex(f.sighex)}return a.getPEMString()};
|
||
/*! asn1cms-1.0.2.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.cms=="undefined"||!KJUR.asn1.cms){KJUR.asn1.cms={}}KJUR.asn1.cms.Attribute=function(b){KJUR.asn1.cms.Attribute.superclass.constructor.call(this);var a=[];this.getEncodedHex=function(){var f,e,c;f=new KJUR.asn1.DERObjectIdentifier({oid:this.attrTypeOid});e=new KJUR.asn1.DERSet({array:this.valueList});try{e.getEncodedHex()}catch(d){throw"fail valueSet.getEncodedHex in Attribute(1)/"+d}c=new KJUR.asn1.DERSequence({array:[f,e]});try{this.hTLV=c.getEncodedHex()}catch(d){throw"failed seq.getEncodedHex in Attribute(2)/"+d}return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.Attribute,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentType=function(b){KJUR.asn1.cms.ContentType.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.3";var a=null;if(typeof b!="undefined"){var a=new KJUR.asn1.DERObjectIdentifier(b);this.valueList=[a]}};YAHOO.lang.extend(KJUR.asn1.cms.ContentType,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.MessageDigest=function(e){KJUR.asn1.cms.MessageDigest.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.4";if(typeof e!="undefined"){if(e.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo&&typeof e.hashAlg=="string"){var b=e.eciObj.eContentValueHex;var a=e.hashAlg;var c=KJUR.crypto.Util.hashHex(b,a);var d=new KJUR.asn1.DEROctetString({hex:c});d.getEncodedHex();this.valueList=[d]}else{var d=new KJUR.asn1.DEROctetString(e);d.getEncodedHex();this.valueList=[d]}}};YAHOO.lang.extend(KJUR.asn1.cms.MessageDigest,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.SigningTime=function(c){KJUR.asn1.cms.SigningTime.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.5";if(typeof c!="undefined"){var a=new KJUR.asn1.x509.Time(c);try{a.getEncodedHex()}catch(b){throw"SigningTime.getEncodedHex() failed/"+b}this.valueList=[a]}};YAHOO.lang.extend(KJUR.asn1.cms.SigningTime,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.SigningCertificate=function(d){KJUR.asn1.cms.SigningCertificate.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.12";var a=KJUR.asn1;var c=KJUR.asn1.cms;var b=KJUR.crypto;this.setCerts=function(l){var j=[];for(var h=0;h<l.length;h++){var f=KEYUTIL.getHexFromPEM(l[h]);var e=b.Util.hashHex(f,"sha1");var m=new a.DEROctetString({hex:e});m.getEncodedHex();var k=new c.IssuerAndSerialNumber({cert:l[h]});k.getEncodedHex();var n=new a.DERSequence({array:[m,k]});n.getEncodedHex();j.push(n)}var g=new a.DERSequence({array:j});g.getEncodedHex();this.valueList=[g]};if(typeof d!="undefined"){if(typeof d.array=="object"){this.setCerts(d.array)}}};YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificate,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.SigningCertificateV2=function(e){KJUR.asn1.cms.SigningCertificateV2.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.47";var b=KJUR.asn1;var f=KJUR.asn1.x509;var d=KJUR.asn1.cms;var c=KJUR.crypto;this.setCerts=function(p,h){var n=[];for(var l=0;l<p.length;l++){var j=KEYUTIL.getHexFromPEM(p[l]);var r=[];if(h!="sha256"){r.push(new f.AlgorithmIdentifier({name:h}))}var g=c.Util.hashHex(j,h);var q=new b.DEROctetString({hex:g});q.getEncodedHex();r.push(q);var m=new d.IssuerAndSerialNumber({cert:p[l]});m.getEncodedHex();r.push(m);var o=new b.DERSequence({array:r});o.getEncodedHex();n.push(o)}var k=new b.DERSequence({array:n});k.getEncodedHex();this.valueList=[k]};if(typeof e!="undefined"){if(typeof e.array=="object"){var a="sha256";if(typeof e.hashAlg=="string"){a=e.hashAlg}this.setCerts(e.array,a)}}};YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificateV2,KJUR.asn1.cms.Attribute);KJUR.asn1.cms.IssuerAndSerialNumber=function(c){KJUR.asn1.cms.IssuerAndSerialNumber.superclass.constructor.call(this);var e=null;var b=null;var a=KJUR.asn1;var d=a.x509;this.setByCertPEM=function(i){var g=KEYUTIL.getHexFromPEM(i);var f=new X509();f.hex=g;var j=f.getIssuerHex();this.dIssuer=new d.X500Name();this.dIssuer.hTLV=j;var h=f.getSerialNumberHex();this.dSerial=new a.DERInteger({hex:h})};this.getEncodedHex=function(){var f=new KJUR.asn1.DERSequence({array:[this.dIssuer,this.dSerial]});this.hTLV=f.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c=="string"&&c.indexOf("-----BEGIN ")!=-1){this.setByCertPEM(c)}if(c.issuer&&c.serial){if(c.issuer instanceof KJUR.asn1.x509.X500Name){this.dIssuer=c.issuer}else{this.dIssuer=new KJUR.asn1.x509.X500Name(c.issuer)}if(c.serial instanceof KJUR.asn1.DERInteger){this.dSerial=c.serial}else{this.dSerial=new KJUR.asn1.DERInteger(c.serial)}}if(typeof c.cert=="string"){this.setByCertPEM(c.cert)}}};YAHOO.lang.extend(KJUR.asn1.cms.IssuerAndSerialNumber,KJUR.asn1.ASN1Object);KJUR.asn1.cms.AttributeList=function(a){KJUR.asn1.cms.AttributeList.superclass.constructor.call(this);this.list=new Array();this.sortFlag=true;this.add=function(b){if(b instanceof KJUR.asn1.cms.Attribute){this.list.push(b)}};this.length=function(){return this.list.length};this.clear=function(){this.list=new Array();this.hTLV=null;this.hV=null};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var b=new KJUR.asn1.DERSet({array:this.list,sortflag:this.sortFlag});this.hTLV=b.getEncodedHex();return this.hTLV};if(typeof a!="undefined"){if(typeof a.sortflag!="undefined"&&a.sortflag==false){this.sortFlag=false}}};YAHOO.lang.extend(KJUR.asn1.cms.AttributeList,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignerInfo=function(c){KJUR.asn1.cms.SignerInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.dSignerIdentifier=null;this.dDigestAlgorithm=null;this.dSignedAttrs=new b.AttributeList();this.dSigAlg=null;this.dSig=null;this.dUnsignedAttrs=new b.AttributeList();this.setSignerIdentifier=function(f){if(typeof f=="string"&&f.indexOf("CERTIFICATE")!=-1&&f.indexOf("BEGIN")!=-1&&f.indexOf("END")!=-1){var e=f;this.dSignerIdentifier=new b.IssuerAndSerialNumber({cert:f})}};this.setForContentAndHash=function(e){if(typeof e!="undefined"){if(e.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo){this.dSignedAttrs.add(new b.ContentType({oid:"1.2.840.113549.1.7.1"}));this.dSignedAttrs.add(new b.MessageDigest({eciObj:e.eciObj,hashAlg:e.hashAlg}))}if(typeof e.sdObj!="undefined"&&e.sdObj instanceof KJUR.asn1.cms.SignedData){if(e.sdObj.digestAlgNameList.join(":").indexOf(e.hashAlg)==-1){e.sdObj.digestAlgNameList.push(e.hashAlg)}}if(typeof e.hashAlg=="string"){this.dDigestAlgorithm=new d.AlgorithmIdentifier({name:e.hashAlg})}}};this.sign=function(j,f){this.dSigAlg=new d.AlgorithmIdentifier({name:f});var g=this.dSignedAttrs.getEncodedHex();var e=KEYUTIL.getKey(j);var i=new KJUR.crypto.Signature({alg:f});i.init(e);i.updateHex(g);var h=i.sign();this.dSig=new a.DEROctetString({hex:h})};this.addUnsigned=function(e){this.hTLV=null;this.dUnsignedAttrs.hTLV=null;this.dUnsignedAttrs.add(e)};this.getEncodedHex=function(){if(this.dSignedAttrs instanceof KJUR.asn1.cms.AttributeList&&this.dSignedAttrs.length()==0){throw"SignedAttrs length = 0 (empty)"}var e=new a.DERTaggedObject({obj:this.dSignedAttrs,tag:"a0",explicit:false});var h=null;if(this.dUnsignedAttrs.length()>0){h=new a.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var g=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,e,this.dSigAlg,this.dSig,];if(h!=null){g.push(h)}var f=new a.DERSequence({array:g});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(c){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dEContentType=new a.DERObjectIdentifier({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(e){if(e.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new a.DERObjectIdentifier({oid:e})}else{this.dEContentType=new a.DERObjectIdentifier({name:e})}};this.setContentValue=function(e){if(typeof e!="undefined"){if(typeof e.hex=="string"){this.eContentValueHex=e.hex}else{if(typeof e.str=="string"){this.eContentValueHex=utf8tohex(e.str)}}}};this.setContentValueHex=function(e){this.eContentValueHex=e};this.setContentValueStr=function(e){this.eContentValueHex=utf8tohex(e)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var g=new a.DEROctetString({hex:this.eContentValueHex});this.dEContent=new a.DERTaggedObject({obj:g,tag:"a0",explicit:true});var e=[this.dEContentType];if(!this.isDetached){e.push(this.dEContent)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(c){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dContentType=null;this.dContent=null;this.setContentType=function(e){if(typeof e=="string"){this.dContentType=d.OID.name2obj(e)}};this.getEncodedHex=function(){var f=new a.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:true});var e=new a.DERSequence({array:[this.dContentType,f]});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(c.type){this.setContentType(c.type)}if(c.obj&&c.obj instanceof a.ASN1Object){this.dContent=c.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(c){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cms;var d=KJUR.asn1.x509;this.dCMSVersion=new a.DERInteger({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new b.EncapsulatedContentInfo();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new b.SignerInfo()];this.addCertificatesByPEM=function(e){var f=KEYUTIL.getHexFromPEM(e);var g=new a.ASN1Object();g.hTLV=f;this.certificateList.push(g)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var k=[];for(var j=0;j<this.digestAlgNameList.length;j++){var h=this.digestAlgNameList[j];var m=new d.AlgorithmIdentifier({name:h});k.push(m)}this.dDigestAlgs=new a.DERSet({array:k})}var e=[this.dCMSVersion,this.dDigestAlgs,this.dEncapContentInfo];if(this.dCerts==null){if(this.certificateList.length>0){var l=new a.DERSet({array:this.certificateList});this.dCerts=new a.DERTaggedObject({obj:l,tag:"a0",explicit:false})}}if(this.dCerts!=null){e.push(this.dCerts)}var g=new a.DERSet({array:this.signerInfoList});e.push(g);var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var e=new b.ContentInfo({type:"signed-data",obj:this});return e};this.getContentInfoEncodedHex=function(){var e=this.getContentInfo();var f=e.getEncodedHex();return f};this.getPEM=function(){var e=this.getContentInfoEncodedHex();var f=a.ASN1Util.getPEMStringFromHex(e,"CMS");return f}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(a){var h=KJUR.asn1.cms;var g=KJUR.asn1.cades;var f=new h.SignedData();f.dEncapContentInfo.setContentValue(a.content);if(typeof a.certs=="object"){for(var b=0;b<a.certs.length;b++){f.addCertificatesByPEM(a.certs[b])}}f.signerInfoList=[];for(var b=0;b<a.signerInfos.length;b++){var d=a.signerInfos[b];var c=new h.SignerInfo();c.setSignerIdentifier(d.signerCert);c.setForContentAndHash({sdObj:f,eciObj:f.dEncapContentInfo,hashAlg:d.hashAlg});for(attrName in d.sAttr){var j=d.sAttr[attrName];if(attrName=="SigningTime"){var e=new h.SigningTime(j);c.dSignedAttrs.add(e)}if(attrName=="SigningCertificate"){var e=new h.SigningCertificate(j);c.dSignedAttrs.add(e)}if(attrName=="SigningCertificateV2"){var e=new h.SigningCertificateV2(j);c.dSignedAttrs.add(e)}if(attrName=="SignaturePolicyIdentifier"){var e=new g.SignaturePolicyIdentifier(j);c.dSignedAttrs.add(e)}}c.sign(d.signerPrvKey,d.sigAlg);f.signerInfoList.push(c)}return f};
|
||
/*! asn1tsp-1.0.1.js (c) 2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.tsp=="undefined"||!KJUR.asn1.tsp){KJUR.asn1.tsp={}}KJUR.asn1.tsp.Accuracy=function(b){KJUR.asn1.tsp.Accuracy.superclass.constructor.call(this);var a=KJUR.asn1;this.seconds=null;this.millis=null;this.micros=null;this.getEncodedHex=function(){var e=null;var g=null;var i=null;var c=[];if(this.seconds!=null){e=new a.DERInteger({"int":this.seconds});c.push(e)}if(this.millis!=null){var h=new a.DERInteger({"int":this.millis});g=new a.DERTaggedObject({obj:h,tag:"80",explicit:false});c.push(g)}if(this.micros!=null){var f=new a.DERInteger({"int":this.micros});i=new a.DERTaggedObject({obj:f,tag:"81",explicit:false});c.push(i)}var d=new a.DERSequence({array:c});this.hTLV=d.getEncodedHex();return this.hTLV};if(typeof b!="undefined"){if(typeof b.seconds=="number"){this.seconds=b.seconds}if(typeof b.millis=="number"){this.millis=b.millis}if(typeof b.micros=="number"){this.micros=b.micros}}};YAHOO.lang.extend(KJUR.asn1.tsp.Accuracy,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.MessageImprint=function(b){KJUR.asn1.tsp.MessageImprint.superclass.constructor.call(this);var a=KJUR.asn1;var c=KJUR.asn1.x509;this.dHashAlg=null;this.dHashValue=null;this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}var d=new a.DERSequence({array:[this.dHashAlg,this.dHashValue]});return d.getEncodedHex()};if(typeof b!="undefined"){if(typeof b.hashAlg=="string"){this.dHashAlg=new c.AlgorithmIdentifier({name:b.hashAlg})}if(typeof b.hashValue=="string"){this.dHashValue=new a.DEROctetString({hex:b.hashValue})}}};YAHOO.lang.extend(KJUR.asn1.tsp.MessageImprint,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TimeStampReq=function(c){KJUR.asn1.tsp.TimeStampReq.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;this.dVersion=new a.DERInteger({"int":1});this.dMessageImprint=null;this.dPolicy=null;this.dNonce=null;this.certReq=true;this.setMessageImprint=function(d){if(d instanceof KJUR.asn1.tsp.MessageImprint){this.dMessageImprint=d;return}if(typeof d=="object"){this.dMessageImprint=new b.MessageImprint(d)}};this.getEncodedHex=function(){if(this.dMessageImprint==null){throw"messageImprint shall be specified"}var d=[this.dVersion,this.dMessageImprint];if(this.dPolicy!=null){d.push(this.dPolicy)}if(this.dNonce!=null){d.push(this.dNonce)}if(this.certReq){d.push(new a.DERBoolean())}var e=new a.DERSequence({array:d});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c.mi=="object"){this.setMessageImprint(c.mi)}if(typeof c.policy=="object"){this.dPolicy=new a.DERObjectIdentifier(c.policy)}if(typeof c.nonce=="object"){this.dNonce=new a.DERInteger(c.nonce)}if(typeof c.certreq=="boolean"){this.certReq=c.certreq}}};YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampReq,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TSTInfo=function(c){KJUR.asn1.tsp.TSTInfo.superclass.constructor.call(this);var a=KJUR.asn1;var d=KJUR.asn1.x509;var b=KJUR.asn1.tsp;this.dVersion=new a.DERInteger({"int":1});this.dPolicy=null;this.dMessageImprint=null;this.dSerialNumber=null;this.dGenTime=null;this.dAccuracy=null;this.dOrdering=null;this.dNonce=null;this.dTsa=null;this.getEncodedHex=function(){var e=[this.dVersion];if(this.dPolicy==null){throw"policy shall be specified."}e.push(this.dPolicy);if(this.dMessageImprint==null){throw"messageImprint shall be specified."}e.push(this.dMessageImprint);if(this.dSerialNumber==null){throw"serialNumber shall be specified."}e.push(this.dSerialNumber);if(this.dGenTime==null){throw"genTime shall be specified."}e.push(this.dGenTime);if(this.dAccuracy!=null){e.push(this.dAccuracy)}if(this.dOrdering!=null){e.push(this.dOrdering)}if(this.dNonce!=null){e.push(this.dNonce)}if(this.dTsa!=null){e.push(this.dTsa)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c.policy=="string"){if(!c.policy.match(/^[0-9.]+$/)){throw"policy shall be oid like 0.1.4.134"}this.dPolicy=new a.DERObjectIdentifier({oid:c.policy})}if(typeof c.messageImprint!="undefined"){this.dMessageImprint=new b.MessageImprint(c.messageImprint)}if(typeof c.serialNumber!="undefined"){this.dSerialNumber=new a.DERInteger(c.serialNumber)}if(typeof c.genTime!="undefined"){this.dGenTime=new a.DERGeneralizedTime(c.genTime)}if(typeof c.accuracy!="undefind"){this.dAccuracy=new b.Accuracy(c.accuracy)}if(typeof c.ordering!="undefined"&&c.ordering==true){this.dOrdering=new a.DERBoolean()}if(typeof c.nonce!="undefined"){this.dNonce=new a.DERInteger(c.nonce)}if(typeof c.tsa!="undefined"){this.dTsa=new d.X500Name(c.tsa)}}};YAHOO.lang.extend(KJUR.asn1.tsp.TSTInfo,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.TimeStampResp=function(c){KJUR.asn1.tsp.TimeStampResp.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;this.dStatus=null;this.dTST=null;this.getEncodedHex=function(){if(this.dStatus==null){throw"status shall be specified"}var d=[this.dStatus];if(this.dTST!=null){d.push(this.dTST)}var e=new a.DERSequence({array:d});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c.status=="object"){this.dStatus=new b.PKIStatusInfo(c.status)}if(typeof c.tst!="undefined"&&c.tst instanceof KJUR.asn1.ASN1Object){this.dTST=c.tst.getContentInfo()}}};YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampResp,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatusInfo=function(c){KJUR.asn1.tsp.PKIStatusInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;this.dStatus=null;this.dStatusString=null;this.dFailureInfo=null;this.getEncodedHex=function(){if(this.dStatus==null){throw"status shall be specified"}var d=[this.dStatus];if(this.dStatusString!=null){d.push(this.dStatusString)}if(this.dFailureInfo!=null){d.push(this.dFailureInfo)}var e=new a.DERSequence({array:d});this.hTLV=e.getEncodedHex();return this.hTLV};if(typeof c!="undefined"){if(typeof c.status=="object"){this.dStatus=new b.PKIStatus(c.status)}if(typeof c.statstr=="object"){this.dStatusString=new b.PKIFreeText({array:c.statstr})}if(typeof c.failinfo=="object"){this.dFailureInfo=new b.PKIFailureInfo(c.failinfo)}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatusInfo,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatus=function(e){KJUR.asn1.tsp.PKIStatus.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;var d=null;this.getEncodedHex=function(){this.hTLV=this.dStatus.getEncodedHex();return this.hTLV};if(typeof e!="undefined"){if(typeof e.name!="undefined"){var c=b.PKIStatus.valueList;if(typeof c[e.name]=="undefined"){throw"name undefined: "+e.name}this.dStatus=new a.DERInteger({"int":c[e.name]})}else{this.dStatus=new a.DERInteger(e)}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatus,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIStatus.valueList={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};KJUR.asn1.tsp.PKIFreeText=function(b){KJUR.asn1.tsp.PKIFreeText.superclass.constructor.call(this);var a=KJUR.asn1;this.textList=[];this.getEncodedHex=function(){var c=[];for(var e=0;e<this.textList.length;e++){c.push(new a.DERUTF8String({str:this.textList[e]}))}var d=new a.DERSequence({array:c});this.hTLV=d.getEncodedHex();return this.hTLV};if(typeof b!="undefined"){if(typeof b.array=="object"){this.textList=b.array}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIFreeText,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIFailureInfo=function(d){KJUR.asn1.tsp.PKIFailureInfo.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.tsp;this.value=null;this.getEncodedHex=function(){if(this.value==null){throw"value shall be specified"}var e=new Number(this.value).toString(2);var f=new a.DERBitString();f.setByBinaryString(e);this.hTLV=f.getEncodedHex();return this.hTLV};if(typeof d!="undefined"){if(typeof d.name=="string"){var c=b.PKIFailureInfo.valueList;if(typeof c[d.name]=="undefined"){throw"name undefined: "+d.name}this.value=c[d.name]}else{if(typeof d["int"]=="number"){this.value=d["int"]}}}};YAHOO.lang.extend(KJUR.asn1.tsp.PKIFailureInfo,KJUR.asn1.ASN1Object);KJUR.asn1.tsp.PKIFailureInfo.valueList={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};KJUR.asn1.tsp.AbstractTSAAdapter=function(a){this.getTSTHex=function(c,b){throw"not implemented yet"}};KJUR.asn1.tsp.SimpleTSAAdapter=function(a){KJUR.asn1.tsp.SimpleTSAAdapter.superclass.constructor.call(this);this.params=null;this.serial=0;this.getTSTHex=function(c,b){var e=KJUR.crypto.Util.hashHex(c,b);this.params.tstInfo.messageImprint={hashAlg:b,hashValue:e};this.params.tstInfo.serialNumber={"int":this.serial++};var d=Math.floor(Math.random()*1000000000);this.params.tstInfo.nonce={"int":d};var f=KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params);return f.getContentInfoEncodedHex()};if(typeof a!="undefined"){this.params=a}};YAHOO.lang.extend(KJUR.asn1.tsp.SimpleTSAAdapter,KJUR.asn1.tsp.AbstractTSAAdapter);KJUR.asn1.tsp.FixedTSAAdapter=function(a){KJUR.asn1.tsp.FixedTSAAdapter.superclass.constructor.call(this);this.params=null;this.getTSTHex=function(c,b){var d=KJUR.crypto.Util.hashHex(c,b);this.params.tstInfo.messageImprint={hashAlg:b,hashValue:d};var e=KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params);return e.getContentInfoEncodedHex()};if(typeof a!="undefined"){this.params=a}};YAHOO.lang.extend(KJUR.asn1.tsp.FixedTSAAdapter,KJUR.asn1.tsp.AbstractTSAAdapter);KJUR.asn1.tsp.TSPUtil=new function(){};KJUR.asn1.tsp.TSPUtil.newTimeStampToken=function(b){var j=KJUR.asn1.cms;var a=KJUR.asn1.tsp;var g=new j.SignedData();var e=new a.TSTInfo(b.tstInfo);var f=e.getEncodedHex();g.dEncapContentInfo.setContentValue({hex:f});g.dEncapContentInfo.setContentType("tstinfo");if(typeof b.certs=="object"){for(var c=0;c<b.certs.length;c++){g.addCertificatesByPEM(b.certs[c])}}var d=g.signerInfoList[0];d.setSignerIdentifier(b.signerCert);d.setForContentAndHash({sdObj:g,eciObj:g.dEncapContentInfo,hashAlg:b.hashAlg});var h=new j.SigningCertificate({array:[b.signerCert]});d.dSignedAttrs.add(h);d.sign(b.signerPrvKey,b.sigAlg);return g};KJUR.asn1.tsp.TSPUtil.parseTimeStampReq=function(d){var f={};f.certreq=false;var h=ASN1HEX.getPosArrayOfChildren_AtObj(d,0);if(h.length<2){throw"TimeStampReq must have at least 2 items"}var c=ASN1HEX.getHexOfTLV_AtObj(d,h[1]);f.mi=KJUR.asn1.tsp.TSPUtil.parseMessageImprint(c);for(var e=2;e<h.length;e++){var b=h[e];var a=d.substr(b,2);if(a=="06"){var g=ASN1HEX.getHexOfV_AtObj(d,b);f.policy=ASN1HEX.hextooidstr(g)}if(a=="02"){f.nonce=ASN1HEX.getHexOfV_AtObj(d,b)}if(a=="01"){f.certreq=true}}return f};KJUR.asn1.tsp.TSPUtil.parseMessageImprint=function(c){var h={};if(c.substr(0,2)!="30"){throw"head of messageImprint hex shall be '30'"}var a=ASN1HEX.getPosArrayOfChildren_AtObj(c,0);var i=ASN1HEX.getDecendantIndexByNthList(c,0,[0,0]);var d=ASN1HEX.getHexOfV_AtObj(c,i);var e=ASN1HEX.hextooidstr(d);var g=KJUR.asn1.x509.OID.oid2name(e);if(g==""){throw"hashAlg name undefined: "+e}var b=g;var f=ASN1HEX.getDecendantIndexByNthList(c,0,[1]);h.hashAlg=b;h.hashValue=ASN1HEX.getHexOfV_AtObj(c,f);return h};
|
||
/*! asn1cades-1.0.0.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}if(typeof KJUR.asn1.cades=="undefined"||!KJUR.asn1.cades){KJUR.asn1.cades={}}KJUR.asn1.cades.SignaturePolicyIdentifier=function(e){KJUR.asn1.cades.SignaturePolicyIdentifier.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.15";var b=KJUR.asn1;var d=KJUR.asn1.cades;if(typeof e!="undefined"){if(typeof e.oid=="string"&&typeof e.hash=="object"){var f=new b.DERObjectIdentifier({oid:e.oid});var a=new d.OtherHashAlgAndValue(e.hash);var c=new b.DERSequence({array:[f,a]});this.valueList=[c]}}};YAHOO.lang.extend(KJUR.asn1.cades.SignaturePolicyIdentifier,KJUR.asn1.cms.Attribute);KJUR.asn1.cades.OtherHashAlgAndValue=function(b){KJUR.asn1.cades.OtherHashAlgAndValue.superclass.constructor.call(this);var a=KJUR.asn1;var c=KJUR.asn1.x509;this.dAlg=null;this.dHash=null;this.getEncodedHex=function(){var d=new a.DERSequence({array:[this.dAlg,this.dHash]});this.hTLV=d.getEncodedHex();return this.hTLV};if(typeof b!="undefined"){if(typeof b.alg=="string"&&typeof b.hash=="string"){this.dAlg=new c.AlgorithmIdentifier({name:b.alg});this.dHash=new a.DEROctetString({hex:b.hash})}}};YAHOO.lang.extend(KJUR.asn1.cades.OtherHashAlgAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.cades.SignatureTimeStamp=function(c){KJUR.asn1.cades.SignatureTimeStamp.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.14";this.tstHex=null;var a=KJUR.asn1;if(typeof c!="undefined"){if(typeof c.res!="undefined"){if(typeof c.res=="string"&&c.res.match(/^[0-9A-Fa-f]+$/)){}else{if(c.res instanceof KJUR.asn1.ASN1Object){}else{throw"res param shall be ASN1Object or hex string"}}}if(typeof c.tst!="undefined"){if(typeof c.tst=="string"&&c.tst.match(/^[0-9A-Fa-f]+$/)){var b=new a.ASN1Object();this.tstHex=c.tst;b.hTLV=this.tstHex;b.getEncodedHex();this.valueList=[b]}else{if(c.tst instanceof KJUR.asn1.ASN1Object){}else{throw"tst param shall be ASN1Object or hex string"}}}}};YAHOO.lang.extend(KJUR.asn1.cades.SignatureTimeStamp,KJUR.asn1.cms.Attribute);KJUR.asn1.cades.CompleteCertificateRefs=function(c){KJUR.asn1.cades.CompleteCertificateRefs.superclass.constructor.call(this);this.attrTypeOid="1.2.840.113549.1.9.16.2.21";var a=KJUR.asn1;var b=KJUR.asn1.cades;this.setByArray=function(d){this.valueList=[];for(var e=0;e<d.length;e++){var f=new b.OtherCertID(d[e]);this.valueList.push(f)}};if(typeof c!="undefined"){if(typeof c=="object"&&typeof c.length=="number"){this.setByArray(c)}}};YAHOO.lang.extend(KJUR.asn1.cades.CompleteCertificateRefs,KJUR.asn1.cms.Attribute);KJUR.asn1.cades.OtherCertID=function(d){KJUR.asn1.cades.OtherCertID.superclass.constructor.call(this);var a=KJUR.asn1;var c=KJUR.asn1.cms;var b=KJUR.asn1.cades;this.hasIssuerSerial=true;this.dOtherCertHash=null;this.dIssuerSerial=null;this.setByCertPEM=function(e){this.dOtherCertHash=new b.OtherHash(e);if(this.hasIssuerSerial){this.dIssuerSerial=new c.IssuerAndSerialNumber(e)}};this.getEncodedHex=function(){if(this.hTLV!=null){return this.hTLV}if(this.dOtherCertHash==null){throw"otherCertHash not set"}var e=[this.dOtherCertHash];if(this.dIssuerSerial!=null){e.push(this.dIssuerSerial)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(typeof d!="undefined"){if(typeof d=="string"&&d.indexOf("-----BEGIN ")!=-1){this.setByCertPEM(d)}if(typeof d=="object"){if(d.hasis===false){this.hasIssuerSerial=false}if(typeof d.cert=="string"){this.setByCertPEM(d.cert)}}}};YAHOO.lang.extend(KJUR.asn1.cades.OtherCertID,KJUR.asn1.ASN1Object);KJUR.asn1.cades.OtherHash=function(c){KJUR.asn1.cades.OtherHash.superclass.constructor.call(this);var a=KJUR.asn1;var b=KJUR.asn1.cades;this.alg="sha256";this.dOtherHash=null;this.setByCertPEM=function(d){if(d.indexOf("-----BEGIN ")==-1){throw"certPEM not to seem PEM format"}var e=X509.pemToHex(d);var f=KJUR.crypto.Util.hashHex(e,this.alg);this.dOtherHash=new b.OtherHashAlgAndValue({alg:this.alg,hash:f})};this.getEncodedHex=function(){if(this.dOtherHash==null){throw"OtherHash not set"}return this.dOtherHash.getEncodedHex()};if(typeof c!="undefined"){if(typeof c=="string"){if(c.indexOf("-----BEGIN ")!=-1){this.setByCertPEM(c)}else{if(c.match(/^[0-9A-Fa-f]+$/)){this.dOtherHash=new a.DEROctetString({hex:c})}else{throw"unsupported string value for params"}}}else{if(typeof c=="object"){if(typeof c.cert=="string"){if(typeof c.alg=="string"){this.alg=c.alg}this.setByCertPEM(c.cert)}else{this.dOtherHash=new b.OtherHashAlgAndValue(c)}}}}};YAHOO.lang.extend(KJUR.asn1.cades.OtherHash,KJUR.asn1.ASN1Object);KJUR.asn1.cades.CAdESUtil=new function(){};KJUR.asn1.cades.CAdESUtil.addSigTS=function(c,b,a){};KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(d){var q=KJUR.asn1;var p=KJUR.asn1.cms;var c=KJUR.asn1.cades.CAdESUtil;var a={};if(ASN1HEX.getDecendantHexTLVByNthList(d,0,[0])!="06092a864886f70d010702"){throw"hex is not CMS SignedData"}var s=ASN1HEX.getDecendantIndexByNthList(d,0,[1,0]);var b=ASN1HEX.getPosArrayOfChildren_AtObj(d,s);if(b.length<4){throw"num of SignedData elem shall be 4 at least"}var f=b.shift();a.version=ASN1HEX.getHexOfTLV_AtObj(d,f);var l=b.shift();a.algs=ASN1HEX.getHexOfTLV_AtObj(d,l);var m=b.shift();a.encapcontent=ASN1HEX.getHexOfTLV_AtObj(d,m);a.certs=null;a.revs=null;a.si=[];var n=b.shift();if(d.substr(n,2)=="a0"){a.certs=ASN1HEX.getHexOfTLV_AtObj(d,n);n=b.shift()}if(d.substr(n,2)=="a1"){a.revs=ASN1HEX.getHexOfTLV_AtObj(d,n);n=b.shift()}var k=n;if(d.substr(k,2)!="31"){throw"Can't find signerInfos"}var j=ASN1HEX.getPosArrayOfChildren_AtObj(d,k);for(var h=0;h<j.length;h++){var o=j[h];var e=c.parseSignerInfoForAddingUnsigned(d,o,h);a.si[h]=e}var g=null;a.obj=new p.SignedData();g=new q.ASN1Object();g.hTLV=a.version;a.obj.dCMSVersion=g;g=new q.ASN1Object();g.hTLV=a.algs;a.obj.dDigestAlgs=g;g=new q.ASN1Object();g.hTLV=a.encapcontent;a.obj.dEncapContentInfo=g;g=new q.ASN1Object();g.hTLV=a.certs;a.obj.dCerts=g;a.obj.signerInfoList=[];for(var h=0;h<a.si.length;h++){a.obj.signerInfoList.push(a.si[h].obj)}return a};KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(d,k,a){var m=KJUR.asn1;var l=KJUR.asn1.cms;var b={};var e=ASN1HEX.getPosArrayOfChildren_AtObj(d,k);if(e.length!=6){throw"not supported items for SignerInfo (!=6)"}var f=e.shift();b.version=ASN1HEX.getHexOfTLV_AtObj(d,f);var n=e.shift();b.si=ASN1HEX.getHexOfTLV_AtObj(d,n);var h=e.shift();b.digalg=ASN1HEX.getHexOfTLV_AtObj(d,h);var c=e.shift();b.sattrs=ASN1HEX.getHexOfTLV_AtObj(d,c);var i=e.shift();b.sigalg=ASN1HEX.getHexOfTLV_AtObj(d,i);var j=e.shift();b.sig=ASN1HEX.getHexOfTLV_AtObj(d,j);b.sigval=ASN1HEX.getHexOfV_AtObj(d,j);var g=null;b.obj=new l.SignerInfo();g=new m.ASN1Object();g.hTLV=b.version;b.obj.dCMSVersion=g;g=new m.ASN1Object();g.hTLV=b.si;b.obj.dSignerIdentifier=g;g=new m.ASN1Object();g.hTLV=b.digalg;b.obj.dDigestAlgorithm=g;g=new m.ASN1Object();g.hTLV=b.sattrs;b.obj.dSignedAttrs=g;g=new m.ASN1Object();g.hTLV=b.sigalg;b.obj.dSigAlg=g;g=new m.ASN1Object();g.hTLV=b.sig;b.obj.dSig=g;b.obj.dUnsignedAttrs=new l.AttributeList();return b};
|
||
/*! base64x-1.1.3 (c) 2012-2014 Kenji Urushima | kjur.github.com/jsjws/license
|
||
*/
|
||
function Base64x(){}function stoBA(d){var b=new Array();for(var c=0;c<d.length;c++){b[c]=d.charCodeAt(c)}return b}function BAtos(b){var d="";for(var c=0;c<b.length;c++){d=d+String.fromCharCode(b[c])}return d}function BAtohex(b){var e="";for(var d=0;d<b.length;d++){var c=b[d].toString(16);if(c.length==1){c="0"+c}e=e+c}return e}function stohex(a){return BAtohex(stoBA(a))}function stob64(a){return hex2b64(stohex(a))}function stob64u(a){return b64tob64u(hex2b64(stohex(a)))}function b64utos(a){return BAtos(b64toBA(b64utob64(a)))}function b64tob64u(a){a=a.replace(/\=/g,"");a=a.replace(/\+/g,"-");a=a.replace(/\//g,"_");return a}function b64utob64(a){if(a.length%4==2){a=a+"=="}else{if(a.length%4==3){a=a+"="}}a=a.replace(/-/g,"+");a=a.replace(/_/g,"/");return a}function hextob64u(a){return b64tob64u(hex2b64(a))}function b64utohex(a){return b64tohex(b64utob64(a))}var utf8tob64u,b64utoutf8;if(typeof Buffer==="function"){utf8tob64u=function(a){return b64tob64u(new Buffer(a,"utf8").toString("base64"))};b64utoutf8=function(a){return new Buffer(b64utob64(a),"base64").toString("utf8")}}else{utf8tob64u=function(a){return hextob64u(uricmptohex(encodeURIComponentAll(a)))};b64utoutf8=function(a){return decodeURIComponent(hextouricmp(b64utohex(a)))}}function utf8tob64(a){return hex2b64(uricmptohex(encodeURIComponentAll(a)))}function b64toutf8(a){return decodeURIComponent(hextouricmp(b64tohex(a)))}function utf8tohex(a){return uricmptohex(encodeURIComponentAll(a))}function hextoutf8(a){return decodeURIComponent(hextouricmp(a))}function hextorstr(c){var b="";for(var a=0;a<c.length-1;a+=2){b+=String.fromCharCode(parseInt(c.substr(a,2),16))}return b}function rstrtohex(c){var a="";for(var b=0;b<c.length;b++){a+=("0"+c.charCodeAt(b).toString(16)).slice(-2)}return a}function hextob64(a){return hex2b64(a)}function hextob64nl(b){var a=hextob64(b);var c=a.replace(/(.{64})/g,"$1\r\n");c=c.replace(/\r\n$/,"");return c}function b64nltohex(b){var a=b.replace(/[^0-9A-Za-z\/+=]*/g,"");var c=b64tohex(a);return c}function uricmptohex(a){return a.replace(/%/g,"")}function hextouricmp(a){return a.replace(/(..)/g,"%$1")}function encodeURIComponentAll(a){var d=encodeURIComponent(a);var b="";for(var c=0;c<d.length;c++){if(d[c]=="%"){b=b+d.substr(c,3);c=c+2}else{b=b+"%"+stohex(d[c])}}return b}function newline_toUnix(a){a=a.replace(/\r\n/mg,"\n");return a}function newline_toDos(a){a=a.replace(/\r\n/mg,"\n");a=a.replace(/\n/mg,"\r\n");return a};
|
||
/*! crypto-1.1.5.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414",};this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa",};this.CRYPTOJSMESSAGEDIGESTNAME={md5:"CryptoJS.algo.MD5",sha1:"CryptoJS.algo.SHA1",sha224:"CryptoJS.algo.SHA224",sha256:"CryptoJS.algo.SHA256",sha384:"CryptoJS.algo.SHA384",sha512:"CryptoJS.algo.SHA512",ripemd160:"CryptoJS.algo.RIPEMD160"};this.getDigestInfoHex=function(a,b){if(typeof this.DIGESTINFOHEAD[b]=="undefined"){throw"alg not supported in Util.DIGESTINFOHEAD: "+b}return this.DIGESTINFOHEAD[b]+a};this.getPaddedDigestInfoHex=function(h,a,j){var c=this.getDigestInfoHex(h,a);var d=j/4;if(c.length+22>d){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f<l;f+=2){g+="ff"}var e=b+g+k;return e};this.hashString=function(a,c){var b=new KJUR.crypto.MessageDigest({alg:c});return b.digestString(a)};this.hashHex=function(b,c){var a=new KJUR.crypto.MessageDigest({alg:c});return a.digestHex(b)};this.sha1=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha1",prov:"cryptojs"});return b.digestString(a)};this.sha256=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return b.digestString(a)};this.sha256Hex=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return b.digestHex(a)};this.sha512=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return b.digestString(a)};this.sha512Hex=function(a){var b=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return b.digestHex(a)};this.md5=function(a){var b=new KJUR.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return b.digestString(a)};this.ripemd160=function(a){var b=new KJUR.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return b.digestString(a)};this.getCryptoJSMDByName=function(a){}};KJUR.crypto.MessageDigest=function(params){var md=null;var algName=null;var provName=null;this.setAlgAndProvider=function(alg,prov){if(alg!=null&&prov===undefined){prov=KJUR.crypto.Util.DEFAULTPROVIDER[alg]}if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(alg)!=-1&&prov=="cryptojs"){try{this.md=eval(KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[alg]).create()}catch(ex){throw"setAlgAndProvider hash alg set fail alg="+alg+"/"+ex}this.updateString=function(str){this.md.update(str)};this.updateHex=function(hex){var wHex=CryptoJS.enc.Hex.parse(hex);this.md.update(wHex)};this.digest=function(){var hash=this.md.finalize();return hash.toString(CryptoJS.enc.Hex)};this.digestString=function(str){this.updateString(str);return this.digest()};this.digestHex=function(hex){this.updateHex(hex);return this.digest()}}if(":sha256:".indexOf(alg)!=-1&&prov=="sjcl"){try{this.md=new sjcl.hash.sha256()}catch(ex){throw"setAlgAndProvider hash alg set fail alg="+alg+"/"+ex}this.updateString=function(str){this.md.update(str)};this.updateHex=function(hex){var baHex=sjcl.codec.hex.toBits(hex);this.md.update(baHex)};this.digest=function(){var hash=this.md.finalize();return sjcl.codec.hex.fromBits(hash)};this.digestString=function(str){this.updateString(str);return this.digest()};this.digestHex=function(hex){this.updateHex(hex);return this.digest()}}};this.updateString=function(str){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName};this.updateHex=function(hex){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName};this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName};this.digestString=function(str){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName};this.digestHex=function(hex){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName};if(params!==undefined){if(params.alg!==undefined){this.algName=params.alg;if(params.prov===undefined){this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]}this.setAlgAndProvider(this.algName,this.provName)}}};KJUR.crypto.Mac=function(params){var mac=null;var pass=null;var algName=null;var provName=null;var algProv=null;this.setAlgAndProvider=function(alg,prov){if(alg==null){alg="hmacsha1"}alg=alg.toLowerCase();if(alg.substr(0,4)!="hmac"){throw"setAlgAndProvider unsupported HMAC alg: "+alg}if(prov===undefined){prov=KJUR.crypto.Util.DEFAULTPROVIDER[alg]}this.algProv=alg+"/"+prov;var hashAlg=alg.substr(4);if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(hashAlg)!=-1&&prov=="cryptojs"){try{var mdObj=eval(KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[hashAlg]);this.mac=CryptoJS.algo.HMAC.create(mdObj,this.pass)}catch(ex){throw"setAlgAndProvider hash alg set fail hashAlg="+hashAlg+"/"+ex}this.updateString=function(str){this.mac.update(str)};this.updateHex=function(hex){var wHex=CryptoJS.enc.Hex.parse(hex);this.mac.update(wHex)};this.doFinal=function(){var hash=this.mac.finalize();return hash.toString(CryptoJS.enc.Hex)};this.doFinalString=function(str){this.updateString(str);return this.doFinal()};this.doFinalHex=function(hex){this.updateHex(hex);return this.doFinal()}}};this.updateString=function(str){throw"updateString(str) not supported for this alg/prov: "+this.algProv};this.updateHex=function(hex){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv};this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv};this.doFinalString=function(str){throw"digestString(str) not supported for this alg/prov: "+this.algProv};this.doFinalHex=function(hex){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv};if(params!==undefined){if(params.pass!==undefined){this.pass=params.pass}if(params.alg!==undefined){this.algName=params.alg;if(params.prov===undefined){this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]}this.setAlgAndProvider(this.algName,this.provName)}}};KJUR.crypto.Signature=function(o){var q=null;var n=null;var r=null;var c=null;var l=null;var d=null;var k=null;var h=null;var p=null;var e=null;var b=-1;var g=null;var j=null;var a=null;var i=null;var f=null;this._setAlgNames=function(){if(this.algName.match(/^(.+)with(.+)$/)){this.mdAlgName=RegExp.$1.toLowerCase();this.pubkeyAlgName=RegExp.$2.toLowerCase()}};this._zeroPaddingOfSignature=function(x,w){var v="";var t=w/4-x.length;for(var u=0;u<t;u++){v=v+"0"}return v+x};this.setAlgAndProvider=function(u,t){this._setAlgNames();if(t!="cryptojs/jsrsa"){throw"provider not supported: "+t}if(":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)!=-1){try{this.md=new KJUR.crypto.MessageDigest({alg:this.mdAlgName})}catch(s){throw"setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+s}this.init=function(w,x){var y=null;try{if(x===undefined){y=KEYUTIL.getKey(w)}else{y=KEYUTIL.getKey(w,x)}}catch(v){throw"init failed:"+v}if(y.isPrivate===true){this.prvKey=y;this.state="SIGN"}else{if(y.isPublic===true){this.pubKey=y;this.state="VERIFY"}else{throw"init failed.:"+y}}};this.initSign=function(v){if(typeof v.ecprvhex=="string"&&typeof v.eccurvename=="string"){this.ecprvhex=v.ecprvhex;this.eccurvename=v.eccurvename}else{this.prvKey=v}this.state="SIGN"};this.initVerifyByPublicKey=function(v){if(typeof v.ecpubhex=="string"&&typeof v.eccurvename=="string"){this.ecpubhex=v.ecpubhex;this.eccurvename=v.eccurvename}else{if(v instanceof KJUR.crypto.ECDSA){this.pubKey=v}else{if(v instanceof RSAKey){this.pubKey=v}}}this.state="VERIFY"};this.initVerifyByCertificatePEM=function(v){var w=new X509();w.readCertPEM(v);this.pubKey=w.subjectPublicKeyRSA;this.state="VERIFY"};this.updateString=function(v){this.md.updateString(v)};this.updateHex=function(v){this.md.updateHex(v)};this.sign=function(){this.sHashHex=this.md.digest();if(typeof this.ecprvhex!="undefined"&&typeof this.eccurvename!="undefined"){var v=new KJUR.crypto.ECDSA({curve:this.eccurvename});this.hSign=v.signHex(this.sHashHex,this.ecprvhex)}else{if(this.pubkeyAlgName=="rsaandmgf1"){this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen)}else{if(this.pubkeyAlgName=="rsa"){this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName)}else{if(this.prvKey instanceof KJUR.crypto.ECDSA){this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}else{if(this.prvKey instanceof KJUR.crypto.DSA){this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}else{throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}}}}return this.hSign};this.signString=function(v){this.updateString(v);this.sign()};this.signHex=function(v){this.updateHex(v);this.sign()};this.verify=function(v){this.sHashHex=this.md.digest();if(typeof this.ecpubhex!="undefined"&&typeof this.eccurvename!="undefined"){var w=new KJUR.crypto.ECDSA({curve:this.eccurvename});return w.verifyHex(this.sHashHex,v,this.ecpubhex)}else{if(this.pubkeyAlgName=="rsaandmgf1"){return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,v,this.mdAlgName,this.pssSaltLen)}else{if(this.pubkeyAlgName=="rsa"){return this.pubKey.verifyWithMessageHash(this.sHashHex,v)}else{if(this.pubKey instanceof KJUR.crypto.ECDSA){return this.pubKey.verifyWithMessageHash(this.sHashHex,v)}else{if(this.pubKey instanceof KJUR.crypto.DSA){return this.pubKey.verifyWithMessageHash(this.sHashHex,v)}else{throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}}}}}}};this.init=function(s,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName};this.initVerifyByPublicKey=function(s){throw"initVerifyByPublicKey(rsaPubKeyy) not supported for this alg:prov="+this.algProvName};this.initVerifyByCertificatePEM=function(s){throw"initVerifyByCertificatePEM(certPEM) not supported for this alg:prov="+this.algProvName};this.initSign=function(s){throw"initSign(prvKey) not supported for this alg:prov="+this.algProvName};this.updateString=function(s){throw"updateString(str) not supported for this alg:prov="+this.algProvName};this.updateHex=function(s){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName};this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName};this.signString=function(s){throw"digestString(str) not supported for this alg:prov="+this.algProvName};this.signHex=function(s){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName};this.verify=function(s){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName};this.initParams=o;if(o!==undefined){if(o.alg!==undefined){this.algName=o.alg;if(o.prov===undefined){this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]}else{this.provName=o.prov}this.algProvName=this.algName+":"+this.provName;this.setAlgAndProvider(this.algName,this.provName);this._setAlgNames()}if(o.psssaltlen!==undefined){this.pssSaltLen=o.psssaltlen}if(o.prvkeypem!==undefined){if(o.prvkeypas!==undefined){throw"both prvkeypem and prvkeypas parameters not supported"}else{try{var q=new RSAKey();q.readPrivateKeyFromPEMString(o.prvkeypem);this.initSign(q)}catch(m){throw"fatal error to load pem private key: "+m}}}}};KJUR.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA",}};
|
||
/*! ecdsa-modified-1.0.4.js (c) Stephan Thomas, Kenji Urushima | github.com/bitcoinjs/bitcoinjs-lib/blob/master/LICENSE
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECDSA=function(h){var e="secp256r1";var g=null;var b=null;var f=null;var a=new SecureRandom();var d=null;this.type="EC";function c(s,o,r,n){var j=Math.max(o.bitLength(),n.bitLength());var t=s.add2D(r);var q=s.curve.getInfinity();for(var p=j-1;p>=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(c){if(c.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var b=ASN1HEX.getPosArrayOfChildren_AtObj(c,0);if(b.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var g=b[0];var f=b[1];if(c.substr(g,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(c.substr(f,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var e=ASN1HEX.getHexOfV_AtObj(c,g);var d=ASN1HEX.getHexOfV_AtObj(c,f);return{r:e,s:d}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(e,c){var b=new KJUR.asn1.DERInteger({bigint:e});var a=new KJUR.asn1.DERInteger({bigint:c});var d=new KJUR.asn1.DERSequence({array:[b,a]});return d.getEncodedHex()};
|
||
/*! ecparam-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v<u.length;v++){c[u[v]]=A}}};KJUR.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field");KJUR.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field");KJUR.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field");KJUR.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]);KJUR.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]);KJUR.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]);KJUR.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]);KJUR.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]);KJUR.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]);KJUR.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);
|
||
/*! dsa-modified-1.0.1.js (c) Recurity Labs GmbH, Kenji Urushimma | github.com/openpgpjs/openpgpjs/blob/master/LICENSE
|
||
*/
|
||
if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.DSA=function(){this.p=null;this.q=null;this.g=null;this.y=null;this.x=null;this.type="DSA";this.setPrivate=function(z,w,v,A,u){this.isPrivate=true;this.p=z;this.q=w;this.g=v;this.y=A;this.x=u};this.setPublic=function(w,v,u,z){this.isPublic=true;this.p=w;this.q=v;this.g=u;this.y=z;this.x=null};this.signWithMessageHash=function(z){var v=this.p;var u=this.q;var C=this.g;var D=this.y;var E=this.x;var A=z.substr(0,u.bitLength()/4);var B=new BigInteger(z,16);var w=n(BigInteger.ONE.add(BigInteger.ONE),u.subtract(BigInteger.ONE));var G=(C.modPow(w,v)).mod(u);var F=(w.modInverse(u).multiply(B.add(E.multiply(G)))).mod(u);var H=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:G}},{"int":{bigint:F}}]});return H};this.verifyWithMessageHash=function(C,B){var z=this.p;var u=this.q;var G=this.g;var H=this.y;var E=this.parseASN1Signature(B);var K=E[0];var J=E[1];var C=C.substr(0,u.bitLength()/4);var D=new BigInteger(C,16);if(BigInteger.ZERO.compareTo(K)>0||K.compareTo(u)>0||BigInteger.ZERO.compareTo(J)>0||J.compareTo(u)>0){throw"invalid DSA signature"}var I=J.modInverse(u);var A=D.multiply(I).mod(u);var v=K.multiply(I).mod(u);var F=G.modPow(A,z).multiply(H.modPow(v,z)).mod(z).mod(u);return F.compareTo(K)==0};this.parseASN1Signature=function(u){try{var y=new BigInteger(ASN1HEX.getVbyList(u,0,[0],"02"),16);var v=new BigInteger(ASN1HEX.getVbyList(u,0,[1],"02"),16);return[y,v]}catch(w){throw"malformed DSA signature"}};function d(E,w,B,v,u,C){var z=KJUR.crypto.Util.hashString(w,E.toLowerCase());var z=z.substr(0,u.bitLength()/4);var A=new BigInteger(z,16);var y=n(BigInteger.ONE.add(BigInteger.ONE),u.subtract(BigInteger.ONE));var F=(B.modPow(y,v)).mod(u);var D=(y.modInverse(u).multiply(A.add(C.multiply(F)))).mod(u);var G=new Array();G[0]=F;G[1]=D;return G}function r(v){var u=openpgp.config.config.prefer_hash_algorithm;switch(Math.round(v.bitLength()/8)){case 20:if(u!=2&&u>11&&u!=10&&u<8){return 2}return u;case 28:if(u>11&&u<8){return 11}return u;case 32:if(u>10&&u<8){return 8}return u;default:util.print_debug("DSA select hash algorithm: returning null for an unknown length of q");return null}}this.select_hash_algorithm=r;function m(I,K,J,B,z,u,F,G){var C=KJUR.crypto.Util.hashString(B,I.toLowerCase());var C=C.substr(0,u.bitLength()/4);var D=new BigInteger(C,16);if(BigInteger.ZERO.compareTo(K)>0||K.compareTo(u)>0||BigInteger.ZERO.compareTo(J)>0||J.compareTo(u)>0){util.print_error("invalid DSA Signature");return null}var H=J.modInverse(u);var A=D.multiply(H).mod(u);var v=K.multiply(H).mod(u);var E=F.modPow(A,z).multiply(G.modPow(v,z)).mod(z).mod(u);return E.compareTo(K)==0}function a(z){var A=new BigInteger(z,primeCenterie);var y=j(q,512);var u=t(p,q,z);var v;do{v=new BigInteger(q.bitCount(),rand)}while(x.compareTo(BigInteger.ZERO)!=1&&x.compareTo(q)!=-1);var w=g.modPow(x,p);return{x:v,q:A,p:y,g:u,y:w}}function j(y,z,w){if(z%64!=0){return false}var u;var v;do{u=w(bitcount,true);v=u.subtract(BigInteger.ONE);u=u.subtract(v.remainder(y))}while(!u.isProbablePrime(primeCenterie)||u.bitLength()!=l);return u}function t(B,z,A,w){var u=B.subtract(BigInteger.ONE);var y=u.divide(z);var v;do{v=w(A)}while(v.compareTo(u)!=-1&&v.compareTo(BigInteger.ONE)!=1);return v.modPow(y,B)}function o(w,y,u){var v;do{v=u(y,false)}while(v.compareTo(w)!=-1&&v.compareTo(BigInteger.ZERO)!=1);return v}function i(v,w){k=o(v);var u=g.modPow(k,w).mod(v);return u}function h(B,w,y,v,z,u){var A=B(v);s=(w.modInverse(z).multiply(A.add(u.multiply(y)))).mod(z);return s}this.sign=d;this.verify=m;function n(w,u){if(u.compareTo(w)<=0){return}var v=u.subtract(w);var y=e(v.bitLength());while(y>v){y=e(v.bitLength())}return w.add(y)}function e(w){if(w<0){return null}var u=Math.floor((w+7)/8);var v=c(u);if(w%8>0){v=String.fromCharCode((Math.pow(2,w%8)-1)&v.charCodeAt(0))+v.substring(1)}return new BigInteger(f(v),16)}function c(w){var u="";for(var v=0;v<w;v++){u+=String.fromCharCode(b())}return u}function b(){var u=new Uint32Array(1);window.crypto.getRandomValues(u);return u[0]&255}function f(y){if(y==null){return""}var v=[];var w=y.length;var z=0;var u;while(z<w){u=y[z++].charCodeAt().toString(16);while(u.length<2){u="0"+u}v.push(""+u)}return v.join("")}this.getRandomBigIntegerInRange=n;this.getRandomBigInteger=e;this.getRandomBytes=c};
|
||
/*! pkcs5pkey-1.0.6.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
var PKCS5PKEY=function(){var c=function(n,p,o){return i(CryptoJS.AES,n,p,o)};var d=function(n,p,o){return i(CryptoJS.TripleDES,n,p,o)};var i=function(q,v,s,o){var p=CryptoJS.enc.Hex.parse(v);var u=CryptoJS.enc.Hex.parse(s);var n=CryptoJS.enc.Hex.parse(o);var r={};r.key=u;r.iv=n;r.ciphertext=p;var t=q.decrypt(r,u,{iv:n});return CryptoJS.enc.Hex.stringify(t)};var j=function(n,p,o){return e(CryptoJS.AES,n,p,o)};var m=function(n,p,o){return e(CryptoJS.TripleDES,n,p,o)};var e=function(s,x,v,p){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(v);var o=CryptoJS.enc.Hex.parse(p);var n={};var u=s.encrypt(r,w,{iv:o});var q=CryptoJS.enc.Hex.parse(u.toString());var t=CryptoJS.enc.Base64.stringify(q);return t};var g={"AES-256-CBC":{proc:c,eproc:j,keylen:32,ivlen:16},"AES-192-CBC":{proc:c,eproc:j,keylen:24,ivlen:16},"AES-128-CBC":{proc:c,eproc:j,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:d,eproc:m,keylen:24,ivlen:8}};var b=function(n){return g[n]["proc"]};var k=function(n){var p=CryptoJS.lib.WordArray.random(n);var o=CryptoJS.enc.Hex.stringify(p);return o};var l=function(q){var r={};if(q.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){r.cipher=RegExp.$1;r.ivsalt=RegExp.$2}if(q.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){r.type=RegExp.$1}var p=-1;var t=0;if(q.indexOf("\r\n\r\n")!=-1){p=q.indexOf("\r\n\r\n");t=2}if(q.indexOf("\n\n")!=-1){p=q.indexOf("\n\n");t=1}var o=q.indexOf("-----END");if(p!=-1&&o!=-1){var n=q.substring(p+t*2,o-t);n=n.replace(/\s+/g,"");r.data=n}return r};var h=function(o,w,n){var t=n.substring(0,16);var r=CryptoJS.enc.Hex.parse(t);var p=CryptoJS.enc.Utf8.parse(w);var s=g[o]["keylen"]+g[o]["ivlen"];var v="";var u=null;for(;;){var q=CryptoJS.algo.MD5.create();if(u!=null){q.update(u)}q.update(p);q.update(r);u=q.finalize();v=v+CryptoJS.enc.Hex.stringify(u);if(v.length>=s*2){break}}var x={};x.keyhex=v.substr(0,g[o]["keylen"]*2);x.ivhex=v.substr(g[o]["keylen"]*2,g[o]["ivlen"]*2);return x};var a=function(n,t,p,u){var q=CryptoJS.enc.Base64.parse(n);var o=CryptoJS.enc.Hex.stringify(q);var s=g[t]["proc"];var r=s(o,p,u);return r};var f=function(n,q,o,s){var p=g[q]["eproc"];var r=p(n,o,s);return r};return{version:"1.0.5",getHexFromPEM:function(o,r){var p=o;if(p.indexOf("BEGIN "+r)==-1){throw"can't find PEM header: "+r}p=p.replace("-----BEGIN "+r+"-----","");p=p.replace("-----END "+r+"-----","");var q=p.replace(/\s+/g,"");var n=b64tohex(q);return n},getDecryptedKeyHexByKeyIV:function(o,r,q,p){var n=b(r);return n(o,q,p)},parsePKCS5PEM:function(n){return l(n)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(o,n,p){return h(o,n,p)},decryptKeyB64:function(n,p,o,q){return a(n,p,o,q)},getDecryptedKeyHex:function(w,v){var o=l(w);var r=o.type;var p=o.cipher;var n=o.ivsalt;var q=o.data;var u=h(p,v,n);var t=u.keyhex;var s=a(q,p,t,n);return s},getRSAKeyFromEncryptedPKCS5PEM:function(p,o){var q=this.getDecryptedKeyHex(p,o);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(q);return n},getEryptedPKCS5PEMFromPrvKeyHex:function(q,x,r,p){var n="";if(typeof r=="undefined"||r==null){r="AES-256-CBC"}if(typeof g[r]=="undefined"){throw"PKCS5PKEY unsupported algorithm: "+r}if(typeof p=="undefined"||p==null){var t=g[r]["ivlen"];var s=k(t);p=s.toUpperCase()}var w=h(r,x,p);var v=w.keyhex;var u=f(q,r,v,p);var o=u.replace(/(.{64})/g,"$1\r\n");var n="-----BEGIN RSA PRIVATE KEY-----\r\n";n+="Proc-Type: 4,ENCRYPTED\r\n";n+="DEK-Info: "+r+","+p+"\r\n";n+="\r\n";n+=o;n+="\r\n-----END RSA PRIVATE KEY-----\r\n";return n},getEryptedPKCS5PEMFromRSAKey:function(C,D,o,s){var A=new KJUR.asn1.DERInteger({"int":0});var v=new KJUR.asn1.DERInteger({bigint:C.n});var z=new KJUR.asn1.DERInteger({"int":C.e});var B=new KJUR.asn1.DERInteger({bigint:C.d});var t=new KJUR.asn1.DERInteger({bigint:C.p});var r=new KJUR.asn1.DERInteger({bigint:C.q});var y=new KJUR.asn1.DERInteger({bigint:C.dmp1});var u=new KJUR.asn1.DERInteger({bigint:C.dmq1});var x=new KJUR.asn1.DERInteger({bigint:C.coeff});var E=new KJUR.asn1.DERSequence({array:[A,v,z,B,t,r,y,u,x]});var w=E.getEncodedHex();return this.getEryptedPKCS5PEMFromPrvKeyHex(w,D,o,s)},newEncryptedPKCS5PEM:function(n,o,r,s){if(typeof o=="undefined"||o==null){o=1024}if(typeof r=="undefined"||r==null){r="10001"}var p=new RSAKey();p.generate(o,r);var q=null;if(typeof s=="undefined"||s==null){q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n)}else{q=this.getEncryptedPKCS5PEMFromRSAKey(pkey,n,s)}return q},getRSAKeyFromPlainPKCS8PEM:function(p){if(p.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var o=this.getHexFromPEM(p,"PRIVATE KEY");var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getRSAKeyFromPlainPKCS8Hex:function(q){var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"outer DERSequence shall have 3 elements: "+p.length}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);if(o!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+o}var o=ASN1HEX.getHexOfTLV_AtObj(q,p[1]);var r=ASN1HEX.getHexOfTLV_AtObj(q,p[2]);var s=ASN1HEX.getHexOfV_AtObj(r,0);var n=new RSAKey();n.readPrivateKeyFromASN1HexString(s);return n},parseHexOfEncryptedPKCS8:function(u){var q={};var p=ASN1HEX.getPosArrayOfChildren_AtObj(u,0);if(p.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+p.length}q.ciphertext=ASN1HEX.getHexOfV_AtObj(u,p[1]);var w=ASN1HEX.getPosArrayOfChildren_AtObj(u,p[0]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+w.length}if(ASN1HEX.getHexOfV_AtObj(u,w[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(u,w[1]);if(w.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+n.length}var o=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[1]);if(o.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+o.length}if(ASN1HEX.getHexOfV_AtObj(u,o[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}q.encryptionSchemeAlg="TripleDES";q.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(u,o[1]);var r=ASN1HEX.getPosArrayOfChildren_AtObj(u,n[0]);if(r.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+r.length}if(ASN1HEX.getHexOfV_AtObj(u,r[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var v=ASN1HEX.getPosArrayOfChildren_AtObj(u,r[1]);if(v.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+v.length}q.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(u,v[0]);var s=ASN1HEX.getHexOfV_AtObj(u,v[1]);try{q.pbkdf2Iter=parseInt(s,16)}catch(t){throw"malformed format pbkdf2Iter: "+s}return q},getPBKDF2KeyHexFromParam:function(s,n){var r=CryptoJS.enc.Hex.parse(s.pbkdf2Salt);var o=s.pbkdf2Iter;var q=CryptoJS.PBKDF2(n,r,{keySize:192/32,iterations:o});var p=CryptoJS.enc.Hex.stringify(q);return p},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(v,w){var p=this.getHexFromPEM(v,"ENCRYPTED PRIVATE KEY");var n=this.parseHexOfEncryptedPKCS8(p);var s=PKCS5PKEY.getPBKDF2KeyHexFromParam(n,w);var t={};t.ciphertext=CryptoJS.enc.Hex.parse(n.ciphertext);var r=CryptoJS.enc.Hex.parse(s);var q=CryptoJS.enc.Hex.parse(n.encryptionSchemeIV);var u=CryptoJS.TripleDES.decrypt(t,r,{iv:q});var o=CryptoJS.enc.Hex.stringify(u);return o},getRSAKeyFromEncryptedPKCS8PEM:function(q,p){var o=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,p);var n=this.getRSAKeyFromPlainPKCS8Hex(o);return n},getKeyFromEncryptedPKCS8PEM:function(q,o){var n=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(q,o);var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},parsePlainPrivatePKCS8Hex:function(q){var o={};o.algparam=null;if(q.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(q.substr(p[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,p[1]);if(n.length!=2){throw"malformed PKCS8 private key(code:004)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}o.keyidx=ASN1HEX.getStartPosOfV_AtObj(q,p[2]);return o},getKeyFromPlainPrivatePKCS8PEM:function(o){var n=this.getHexFromPEM(o,"PRIVATE KEY");var p=this.getKeyFromPlainPrivatePKCS8Hex(n);return p},getKeyFromPlainPrivatePKCS8Hex:function(n){var p=this.parsePlainPrivatePKCS8Hex(n);if(p.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(n,p);var o=p.key;var q=new RSAKey();q.setPrivateEx(o.n,o.e,o.d,o.p,o.q,o.dp,o.dq,o.co);return q}else{if(p.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(n,p);if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var r=KJUR.crypto.OID.oidhex2name[p.algparam];var q=new KJUR.crypto.ECDSA({curve:r,prv:p.key});return q}else{throw"unsupported private key algorithm"}}},getRSAKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getRSAKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8PEM:function(o){var p=this.getHexFromPEM(o,"PUBLIC KEY");var n=this.getKeyFromPublicPKCS8Hex(p);return n},getKeyFromPublicPKCS8Hex:function(o){var n=this.parsePublicPKCS8Hex(o);if(n.algoid=="2a864886f70d010101"){var r=this.parsePublicRawRSAKeyHex(n.key);var p=new RSAKey();p.setPublic(r.n,r.e);return p}else{if(n.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[n.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+n.algparam}var q=KJUR.crypto.OID.oidhex2name[n.algparam];var p=new KJUR.crypto.ECDSA({curve:q,pub:n.key});return p}else{throw"unsupported public key algorithm"}}},parsePublicRawRSAKeyHex:function(p){var n={};if(p.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var o=ASN1HEX.getPosArrayOfChildren_AtObj(p,0);if(o.length!=2){throw"malformed RSA key(code:002)"}if(p.substr(o[0],2)!="02"){throw"malformed RSA key(code:003)"}n.n=ASN1HEX.getHexOfV_AtObj(p,o[0]);if(p.substr(o[1],2)!="02"){throw"malformed RSA key(code:004)"}n.e=ASN1HEX.getHexOfV_AtObj(p,o[1]);return n},parsePrivateRawRSAKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed RSA private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=9){throw"malformed RSA private key(code:002)"}q.key={};q.key.n=ASN1HEX.getHexOfV_AtObj(o,n[1]);q.key.e=ASN1HEX.getHexOfV_AtObj(o,n[2]);q.key.d=ASN1HEX.getHexOfV_AtObj(o,n[3]);q.key.p=ASN1HEX.getHexOfV_AtObj(o,n[4]);q.key.q=ASN1HEX.getHexOfV_AtObj(o,n[5]);q.key.dp=ASN1HEX.getHexOfV_AtObj(o,n[6]);q.key.dq=ASN1HEX.getHexOfV_AtObj(o,n[7]);q.key.co=ASN1HEX.getHexOfV_AtObj(o,n[8])},parsePrivateRawECKeyHexAtObj:function(o,q){var p=q.keyidx;if(o.substr(p,2)!="30"){throw"malformed ECC private key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(o,p);if(n.length!=3){throw"malformed ECC private key(code:002)"}if(o.substr(n[1],2)!="04"){throw"malformed ECC private key(code:003)"}q.key=ASN1HEX.getHexOfV_AtObj(o,n[1])},parsePublicPKCS8Hex:function(q){var o={};o.algparam=null;var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,0);if(p.length!=2){throw"outer DERSequence shall have 2 elements: "+p.length}var r=p[0];if(q.substr(r,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var n=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(n.length!=2){throw"malformed PKCS8 public key(code:002)"}if(q.substr(n[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}o.algoid=ASN1HEX.getHexOfV_AtObj(q,n[0]);if(q.substr(n[1],2)=="06"){o.algparam=ASN1HEX.getHexOfV_AtObj(q,n[1])}if(q.substr(p[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}o.key=ASN1HEX.getHexOfV_AtObj(q,p[1]).substr(2);return o},getRSAKeyFromPublicPKCS8Hex:function(r){var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"outer DERSequence shall have 2 elements: "+q.length}var p=ASN1HEX.getHexOfTLV_AtObj(r,q[0]);if(p!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(r.substr(q[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var t=ASN1HEX.getStartPosOfV_AtObj(r,q[1])+2;if(r.substr(t,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var n=ASN1HEX.getPosArrayOfChildren_AtObj(r,t);if(n.length!=2){throw"inner DERSequence shall have 2 elements: "+n.length}if(r.substr(n[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(r.substr(n[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var u=ASN1HEX.getHexOfV_AtObj(r,n[0]);var s=ASN1HEX.getHexOfV_AtObj(r,n[1]);var o=new RSAKey();o.setPublic(u,s);return o},}}();
|
||
/*! keyutil-1.0.7.js (c) 2013-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(t){var u={};if(t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))){u.cipher=RegExp.$1;u.ivsalt=RegExp.$2}if(t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))){u.type=RegExp.$1}var r=-1;var v=0;if(t.indexOf("\r\n\r\n")!=-1){r=t.indexOf("\r\n\r\n");v=2}if(t.indexOf("\n\n")!=-1){r=t.indexOf("\n\n");v=1}var q=t.indexOf("-----END");if(r!=-1&&q!=-1){var p=t.substring(r+v*2,q-v);p=p.replace(/\s+/g,"");u.data=p}return u};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",getHexFromPEM:function(q,u){var r=q;if(r.indexOf("-----BEGIN ")==-1){throw"can't find PEM header: "+u}if(typeof u=="string"&&u!=""){r=r.replace("-----BEGIN "+u+"-----","");r=r.replace("-----END "+u+"-----","")}else{r=r.replace(/-----BEGIN [^-]+-----/,"");r=r.replace(/-----END [^-]+-----/,"")}var t=r.replace(/\s+/g,"");var p=b64tohex(t);return p},getDecryptedKeyHexByKeyIV:function(q,t,s,r){var p=c(t);return p(q,s,r)},parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getRSAKeyFromEncryptedPKCS5PEM:function(r,q){var s=this.getDecryptedKeyHex(r,q);var p=new RSAKey();p.readPrivateKeyFromASN1HexString(s);return p},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},getEncryptedPKCS5PEMFromRSAKey:function(D,E,r,t){var B=new KJUR.asn1.DERInteger({"int":0});var w=new KJUR.asn1.DERInteger({bigint:D.n});var A=new KJUR.asn1.DERInteger({"int":D.e});var C=new KJUR.asn1.DERInteger({bigint:D.d});var u=new KJUR.asn1.DERInteger({bigint:D.p});var s=new KJUR.asn1.DERInteger({bigint:D.q});var z=new KJUR.asn1.DERInteger({bigint:D.dmp1});var v=new KJUR.asn1.DERInteger({bigint:D.dmq1});var y=new KJUR.asn1.DERInteger({bigint:D.coeff});var F=new KJUR.asn1.DERSequence({array:[B,w,A,C,u,s,z,v,y]});var x=F.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",x,E,r,t)},newEncryptedPKCS5PEM:function(p,q,t,u){if(typeof q=="undefined"||q==null){q=1024}if(typeof t=="undefined"||t==null){t="10001"}var r=new RSAKey();r.generate(q,t);var s=null;if(typeof u=="undefined"||u==null){s=this.getEncryptedPKCS5PEMFromRSAKey(r,p)}else{s=this.getEncryptedPKCS5PEMFromRSAKey(r,p,u)}return s},getRSAKeyFromPlainPKCS8PEM:function(r){if(r.match(/ENCRYPTED/)){throw"pem shall be not ENCRYPTED"}var q=this.getHexFromPEM(r,"PRIVATE KEY");var p=this.getRSAKeyFromPlainPKCS8Hex(q);return p},getRSAKeyFromPlainPKCS8Hex:function(s){var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=3){throw"outer DERSequence shall have 3 elements: "+r.length}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[1]);if(q!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+q}var q=ASN1HEX.getHexOfTLV_AtObj(s,r[1]);var t=ASN1HEX.getHexOfTLV_AtObj(s,r[2]);var u=ASN1HEX.getHexOfV_AtObj(t,0);var p=new RSAKey();p.readPrivateKeyFromASN1HexString(u);return p},parseHexOfEncryptedPKCS8:function(w){var s={};var r=ASN1HEX.getPosArrayOfChildren_AtObj(w,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}s.ciphertext=ASN1HEX.getHexOfV_AtObj(w,r[1]);var y=ASN1HEX.getPosArrayOfChildren_AtObj(w,r[0]);if(y.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+y.length}if(ASN1HEX.getHexOfV_AtObj(w,y[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(w,y[1]);if(y.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=ASN1HEX.getPosArrayOfChildren_AtObj(w,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(ASN1HEX.getHexOfV_AtObj(w,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}s.encryptionSchemeAlg="TripleDES";s.encryptionSchemeIV=ASN1HEX.getHexOfV_AtObj(w,q[1]);var t=ASN1HEX.getPosArrayOfChildren_AtObj(w,p[0]);if(t.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+t.length}if(ASN1HEX.getHexOfV_AtObj(w,t[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=ASN1HEX.getPosArrayOfChildren_AtObj(w,t[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}s.pbkdf2Salt=ASN1HEX.getHexOfV_AtObj(w,x[0]);var u=ASN1HEX.getHexOfV_AtObj(w,x[1]);try{s.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return s},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=this.getHexFromPEM(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getRSAKeyFromEncryptedPKCS8PEM:function(s,r){var q=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s,r);var p=this.getRSAKeyFromPlainPKCS8Hex(q);return p},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=ASN1HEX.getHexOfV_AtObj(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=ASN1HEX.getHexOfV_AtObj(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=ASN1HEX.getStartPosOfV_AtObj(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=this.getHexFromPEM(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var w=this.parsePlainPrivatePKCS8Hex(p);if(w.algoid=="2a864886f70d010101"){this.parsePrivateRawRSAKeyHexAtObj(p,w);var u=w.key;var z=new RSAKey();z.setPrivateEx(u.n,u.e,u.d,u.p,u.q,u.dp,u.dq,u.co);return z}else{if(w.algoid=="2a8648ce3d0201"){this.parsePrivateRawECKeyHexAtObj(p,w);if(KJUR.crypto.OID.oidhex2name[w.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+w.algparam}var v=KJUR.crypto.OID.oidhex2name[w.algparam];var z=new KJUR.crypto.ECDSA({curve:v});z.setPublicKeyHex(w.pubkey);z.setPrivateKeyHex(w.key);z.isPublic=false;return z}else{if(w.algoid=="2a8648ce380401"){var t=ASN1HEX.getVbyList(p,0,[1,1,0],"02");var s=ASN1HEX.getVbyList(p,0,[1,1,1],"02");var y=ASN1HEX.getVbyList(p,0,[1,1,2],"02");var B=ASN1HEX.getVbyList(p,0,[2,0],"02");var r=new BigInteger(t,16);var q=new BigInteger(s,16);var x=new BigInteger(y,16);var A=new BigInteger(B,16);var z=new KJUR.crypto.DSA();z.setPrivate(r,q,x,null,A);return z}else{throw"unsupported private key algorithm"}}}},getRSAKeyFromPublicPKCS8PEM:function(q){var r=this.getHexFromPEM(q,"PUBLIC KEY");var p=this.getRSAKeyFromPublicPKCS8Hex(r);return p},getKeyFromPublicPKCS8PEM:function(q){var r=this.getHexFromPEM(q,"PUBLIC KEY");var p=this.getKeyFromPublicPKCS8Hex(r);return p},getKeyFromPublicPKCS8Hex:function(q){var p=this.parsePublicPKCS8Hex(q);if(p.algoid=="2a864886f70d010101"){var u=this.parsePublicRawRSAKeyHex(p.key);var r=new RSAKey();r.setPublic(u.n,u.e);return r}else{if(p.algoid=="2a8648ce3d0201"){if(KJUR.crypto.OID.oidhex2name[p.algparam]===undefined){throw"KJUR.crypto.OID.oidhex2name undefined: "+p.algparam}var s=KJUR.crypto.OID.oidhex2name[p.algparam];var r=new KJUR.crypto.ECDSA({curve:s,pub:p.key});return r}else{if(p.algoid=="2a8648ce380401"){var t=p.algparam;var v=ASN1HEX.getHexOfV_AtObj(p.key,0);var r=new KJUR.crypto.DSA();r.setPublic(new BigInteger(t.p,16),new BigInteger(t.q,16),new BigInteger(t.g,16),new BigInteger(v,16));return r}else{throw"unsupported public key algorithm"}}}},parsePublicRawRSAKeyHex:function(r){var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=ASN1HEX.getPosArrayOfChildren_AtObj(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=ASN1HEX.getHexOfV_AtObj(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=ASN1HEX.getHexOfV_AtObj(r,q[1]);return p},parsePrivateRawRSAKeyHexAtObj:function(q,s){var r=s.keyidx;if(q.substr(r,2)!="30"){throw"malformed RSA private key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(q,r);if(p.length!=9){throw"malformed RSA private key(code:002)"}s.key={};s.key.n=ASN1HEX.getHexOfV_AtObj(q,p[1]);s.key.e=ASN1HEX.getHexOfV_AtObj(q,p[2]);s.key.d=ASN1HEX.getHexOfV_AtObj(q,p[3]);s.key.p=ASN1HEX.getHexOfV_AtObj(q,p[4]);s.key.q=ASN1HEX.getHexOfV_AtObj(q,p[5]);s.key.dp=ASN1HEX.getHexOfV_AtObj(q,p[6]);s.key.dq=ASN1HEX.getHexOfV_AtObj(q,p[7]);s.key.co=ASN1HEX.getHexOfV_AtObj(q,p[8])},parsePrivateRawECKeyHexAtObj:function(p,t){var q=t.keyidx;var r=ASN1HEX.getVbyList(p,q,[1],"04");var s=ASN1HEX.getVbyList(p,q,[2,0],"03").substr(2);t.key=r;t.pubkey=s},parsePublicPKCS8Hex:function(s){var q={};q.algparam=null;var r=ASN1HEX.getPosArrayOfChildren_AtObj(s,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var t=r[0];if(s.substr(t,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=ASN1HEX.getPosArrayOfChildren_AtObj(s,t);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=ASN1HEX.getHexOfV_AtObj(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=ASN1HEX.getHexOfV_AtObj(s,p[1])}else{if(s.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=ASN1HEX.getVbyList(s,p[1],[0],"02");q.algparam.q=ASN1HEX.getVbyList(s,p[1],[1],"02");q.algparam.g=ASN1HEX.getVbyList(s,p[1],[2],"02")}}if(s.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=ASN1HEX.getHexOfV_AtObj(s,r[1]).substr(2);return q},getRSAKeyFromPublicPKCS8Hex:function(t){var s=ASN1HEX.getPosArrayOfChildren_AtObj(t,0);if(s.length!=2){throw"outer DERSequence shall have 2 elements: "+s.length}var r=ASN1HEX.getHexOfTLV_AtObj(t,s[0]);if(r!="300d06092a864886f70d0101010500"){throw"PKCS8 AlgorithmId is not rsaEncryption"}if(t.substr(s[1],2)!="03"){throw"PKCS8 Public Key is not BITSTRING encapslated."}var v=ASN1HEX.getStartPosOfV_AtObj(t,s[1])+2;if(t.substr(v,2)!="30"){throw"PKCS8 Public Key is not SEQUENCE."}var p=ASN1HEX.getPosArrayOfChildren_AtObj(t,v);if(p.length!=2){throw"inner DERSequence shall have 2 elements: "+p.length}if(t.substr(p[0],2)!="02"){throw"N is not ASN.1 INTEGER"}if(t.substr(p[1],2)!="02"){throw"E is not ASN.1 INTEGER"}var w=ASN1HEX.getHexOfV_AtObj(t,p[0]);var u=ASN1HEX.getHexOfV_AtObj(t,p[1]);var q=new RSAKey();q.setPublic(w,u);return q},}}();KEYUTIL.getKey=function(c,o,i){if(typeof RSAKey!="undefined"&&c instanceof RSAKey){return c}if(typeof KJUR.crypto.ECDSA!="undefined"&&c instanceof KJUR.crypto.ECDSA){return c}if(typeof KJUR.crypto.DSA!="undefined"&&c instanceof KJUR.crypto.DSA){return c}if(c.xy!==undefined&&c.curve!==undefined){return new KJUR.crypto.ECDSA({prv:c.xy,curve:c.curve})}if(c.n!==undefined&&c.e!==undefined&&c.d!==undefined&&c.p!==undefined&&c.q!==undefined&&c.dp!==undefined&&c.dq!==undefined&&c.co!==undefined){var n=new RSAKey();n.setPrivateEx(c.n,c.e,c.d,c.p,c.q,c.dp,c.dq,c.co);return n}if(c.p!==undefined&&c.q!==undefined&&c.g!==undefined&&c.y!==undefined&&c.x!==undefined){var n=new KJUR.crypto.DSA();n.setPrivate(c.p,c.q,c.g,c.y,c.x);return n}if(c.d!==undefined&&c.curve!==undefined){return new KJUR.crypto.ECDSA({pub:c.d,curve:c.curve})}if(c.n!==undefined&&c.e){var n=new RSAKey();n.setPublic(c.n,c.e);return n}if(c.p!==undefined&&c.q!==undefined&&c.g!==undefined&&c.y!==undefined&&c.x===undefined){var n=new KJUR.crypto.DSA();n.setPublic(c.p,c.q,c.g,c.y);return n}if(c.indexOf("-END CERTIFICATE-",0)!=-1||c.indexOf("-END X509 CERTIFICATE-",0)!=-1||c.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(c)}if(i==="pkcs8pub"){return KEYUTIL.getKeyFromPublicPKCS8Hex(c)}if(c.indexOf("-END PUBLIC KEY-")!=-1){return KEYUTIL.getKeyFromPublicPKCS8PEM(c)}if(i==="pkcs5prv"){var n=new RSAKey();n.readPrivateKeyFromASN1HexString(c);return n}if(i==="pkcs5prv"){var n=new RSAKey();n.readPrivateKeyFromASN1HexString(c);return n}if(c.indexOf("-END RSA PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")==-1){var n=new RSAKey();n.readPrivateKeyFromPEMString(c);return n}if(c.indexOf("-END DSA PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")==-1){var m=this.getHexFromPEM(c,"DSA PRIVATE KEY");var b=ASN1HEX.getVbyList(m,0,[1],"02");var a=ASN1HEX.getVbyList(m,0,[2],"02");var e=ASN1HEX.getVbyList(m,0,[3],"02");var k=ASN1HEX.getVbyList(m,0,[4],"02");var l=ASN1HEX.getVbyList(m,0,[5],"02");var n=new KJUR.crypto.DSA();n.setPrivate(new BigInteger(b,16),new BigInteger(a,16),new BigInteger(e,16),new BigInteger(k,16),new BigInteger(l,16));return n}if(c.indexOf("-END PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(c)}if(c.indexOf("-END RSA PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")!=-1){return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(c,o)}if(c.indexOf("-END EC PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")!=-1){var m=KEYUTIL.getDecryptedKeyHex(c,o);var n=ASN1HEX.getVbyList(m,0,[1],"04");var j=ASN1HEX.getVbyList(m,0,[2,0],"06");var d=ASN1HEX.getVbyList(m,0,[3,0],"03").substr(2);var h="";if(KJUR.crypto.OID.oidhex2name[j]!==undefined){h=KJUR.crypto.OID.oidhex2name[j]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+j}var f=new KJUR.crypto.ECDSA({name:h});f.setPublicKeyHex(d);f.setPrivateKeyHex(n);f.isPublic=false;return f}if(c.indexOf("-END DSA PRIVATE KEY-")!=-1&&c.indexOf("4,ENCRYPTED")!=-1){var m=KEYUTIL.getDecryptedKeyHex(c,o);var b=ASN1HEX.getVbyList(m,0,[1],"02");var a=ASN1HEX.getVbyList(m,0,[2],"02");var e=ASN1HEX.getVbyList(m,0,[3],"02");var k=ASN1HEX.getVbyList(m,0,[4],"02");var l=ASN1HEX.getVbyList(m,0,[5],"02");var n=new KJUR.crypto.DSA();n.setPrivate(new BigInteger(b,16),new BigInteger(a,16),new BigInteger(e,16),new BigInteger(k,16),new BigInteger(l,16));return n}if(c.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return KEYUTIL.getKeyFromEncryptedPKCS8PEM(c,o)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(a,r,o,g,j){var v=KJUR.asn1;var u=KJUR.crypto;function p(s){var w=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return w}function q(w){var s=KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:w.prvKeyHex}},{tag:["a0",true,{oid:{name:w.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+w.pubKeyHex}}]}]});return s}function n(s){var w=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return w}if(((typeof RSAKey!="undefined"&&a instanceof RSAKey)||(typeof u.DSA!="undefined"&&a instanceof u.DSA)||(typeof u.ECDSA!="undefined"&&a instanceof u.ECDSA))&&a.isPublic==true&&(r===undefined||r=="PKCS8PUB")){var t=new KJUR.asn1.x509.SubjectPublicKeyInfo(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"PUBLIC KEY")}if(r=="PKCS1PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&(o===undefined||o==null)&&a.isPrivate==true){var t=p(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"RSA PRIVATE KEY")}if(r=="PKCS1PRV"&&typeof RSAKey!="undefined"&&a instanceof KJUR.crypto.ECDSA&&(o===undefined||o==null)&&a.isPrivate==true){var f=new KJUR.asn1.DERObjectIdentifier({name:a.curveName});var l=f.getEncodedHex();var e=q(a);var k=e.getEncodedHex();var i="";i+=v.ASN1Util.getPEMStringFromHex(l,"EC PARAMETERS");i+=v.ASN1Util.getPEMStringFromHex(k,"EC PRIVATE KEY");return i}if(r=="PKCS1PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&(o===undefined||o==null)&&a.isPrivate==true){var t=n(a);var m=t.getEncodedHex();return v.ASN1Util.getPEMStringFromHex(m,"DSA PRIVATE KEY")}if(r=="PKCS5PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=p(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",m,o,g)}if(r=="PKCS5PRV"&&typeof KJUR.crypto.ECDSA!="undefined"&&a instanceof KJUR.crypto.ECDSA&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=q(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",m,o,g)}if(r=="PKCS5PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&(o!==undefined&&o!=null)&&a.isPrivate==true){var t=n(a);var m=t.getEncodedHex();if(g===undefined){g="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",m,o,g)}var h=function(w,s){var y=b(w,s);var x=new KJUR.asn1.ASN1Util.newObject({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:y.pbkdf2Salt}},{"int":y.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:y.encryptionSchemeIV}}]}]}]},{octstr:{hex:y.ciphertext}}]});return x.getEncodedHex()};var b=function(D,E){var x=100;var C=CryptoJS.lib.WordArray.random(8);var B="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var y=CryptoJS.PBKDF2(E,C,{keySize:192/32,iterations:x});var z=CryptoJS.enc.Hex.parse(D);var A=CryptoJS.TripleDES.encrypt(z,y,{iv:s})+"";var w={};w.ciphertext=A;w.pbkdf2Salt=CryptoJS.enc.Hex.stringify(C);w.pbkdf2Iter=x;w.encryptionSchemeAlg=B;w.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return w};if(r=="PKCS8PRV"&&typeof RSAKey!="undefined"&&a instanceof RSAKey&&a.isPrivate==true){var d=p(a);var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}if(r=="PKCS8PRV"&&typeof KJUR.crypto.ECDSA!="undefined"&&a instanceof KJUR.crypto.ECDSA&&a.isPrivate==true){var d=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:a.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+a.pubKeyHex}}]}]});var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:a.curveName}}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}if(r=="PKCS8PRV"&&typeof KJUR.crypto.DSA!="undefined"&&a instanceof KJUR.crypto.DSA&&a.isPrivate==true){var d=new KJUR.asn1.DERInteger({bigint:a.x});var c=d.getEncodedHex();var t=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:a.p}},{"int":{bigint:a.q}},{"int":{bigint:a.g}}]}]},{octstr:{hex:c}}]});var m=t.getEncodedHex();if(o===undefined||o==null){return v.ASN1Util.getPEMStringFromHex(m,"PRIVATE KEY")}else{var k=h(m,o);return v.ASN1Util.getPEMStringFromHex(k,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=KEYUTIL.getHexFromPEM(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(c){var b={};var e=c;if(e.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var d=ASN1HEX.getPosArrayOfChildren_AtObj(e,0);if(d.length<1){throw"malformed CSR(code:002)"}if(e.substr(d[0],2)!="30"){throw"malformed CSR(code:003)"}var a=ASN1HEX.getPosArrayOfChildren_AtObj(e,d[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=ASN1HEX.getHexOfTLV_AtObj(e,a[2]);return b};
|
||
/*! rsapem-1.1.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
function _rsapem_pemToBase64(b){var a=b;a=a.replace("-----BEGIN RSA PRIVATE KEY-----","");a=a.replace("-----END RSA PRIVATE KEY-----","");a=a.replace(/[ \n]+/g,"");return a}function _rsapem_getPosArrayOfChildrenFromHex(d){var j=new Array();var k=ASN1HEX.getStartPosOfV_AtObj(d,0);var f=ASN1HEX.getPosOfNextSibling_AtObj(d,k);var h=ASN1HEX.getPosOfNextSibling_AtObj(d,f);var b=ASN1HEX.getPosOfNextSibling_AtObj(d,h);var l=ASN1HEX.getPosOfNextSibling_AtObj(d,b);var e=ASN1HEX.getPosOfNextSibling_AtObj(d,l);var g=ASN1HEX.getPosOfNextSibling_AtObj(d,e);var c=ASN1HEX.getPosOfNextSibling_AtObj(d,g);var i=ASN1HEX.getPosOfNextSibling_AtObj(d,c);j.push(k,f,h,b,l,e,g,c,i);return j}function _rsapem_getHexValueArrayOfChildrenFromHex(i){var o=_rsapem_getPosArrayOfChildrenFromHex(i);var r=ASN1HEX.getHexOfV_AtObj(i,o[0]);var f=ASN1HEX.getHexOfV_AtObj(i,o[1]);var j=ASN1HEX.getHexOfV_AtObj(i,o[2]);var k=ASN1HEX.getHexOfV_AtObj(i,o[3]);var c=ASN1HEX.getHexOfV_AtObj(i,o[4]);var b=ASN1HEX.getHexOfV_AtObj(i,o[5]);var h=ASN1HEX.getHexOfV_AtObj(i,o[6]);var g=ASN1HEX.getHexOfV_AtObj(i,o[7]);var l=ASN1HEX.getHexOfV_AtObj(i,o[8]);var m=new Array();m.push(r,f,j,k,c,b,h,g,l);return m}function _rsapem_readPrivateKeyFromASN1HexString(c){var b=_rsapem_getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}function _rsapem_readPrivateKeyFromPEMString(e){var c=_rsapem_pemToBase64(e);var d=b64tohex(c);var b=_rsapem_getHexValueArrayOfChildrenFromHex(d);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}RSAKey.prototype.readPrivateKeyFromPEMString=_rsapem_readPrivateKeyFromPEMString;RSAKey.prototype.readPrivateKeyFromASN1HexString=_rsapem_readPrivateKeyFromASN1HexString;
|
||
/*! rsasign-1.2.7.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b<a;b++){c=c+"0"}return c+e}function _rsasign_signString(d,a){var b=function(e){return KJUR.crypto.Util.hashString(e,a)};var c=b(d);return this.signWithMessageHash(c,a)}function _rsasign_signWithMessageHash(e,c){var f=KJUR.crypto.Util.getPaddedDigestInfoHex(e,c,this.n.bitLength());var b=parseBigInt(f,16);var d=this.doPrivate(b);var a=d.toString(16);return _zeroPaddingOfSignature(a,this.n.bitLength())}function _rsasign_signStringWithSHA1(a){return _rsasign_signString.call(this,a,"sha1")}function _rsasign_signStringWithSHA256(a){return _rsasign_signString.call(this,a,"sha256")}function pss_mgf1_str(c,a,e){var b="",d=0;while(b.length<a){b+=hextorstr(e(rstrtohex(c+String.fromCharCode.apply(String,[(d&4278190080)>>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}function _rsasign_signStringPSS(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)}function _rsasign_signWithMessageHashPSS(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d<c-k-g-2;d+=1){j[d]=0}var e=String.fromCharCode.apply(String,j)+"\x01"+f;var h=pss_mgf1_str(n,e.length,o);var q=[];for(d=0;d<e.length;d+=1){q[d]=e.charCodeAt(d)^h.charCodeAt(d)}var p=(65280>>(8*c-m))&255;q[0]&=~p;for(d=0;d<g;d++){q.push(n.charCodeAt(d))}q.push(188);return _zeroPaddingOfSignature(this.doPrivate(new BigInteger(q)).toString(16),this.n.bitLength())}function _rsasign_getDecryptSignatureBI(a,d,c){var b=new RSAKey();b.setPublic(d,c);var e=b.doPublic(a);return e}function _rsasign_getHexDigestInfoFromSig(a,c,b){var e=_rsasign_getDecryptSignatureBI(a,c,b);var d=e.toString(16).replace(/^1f+00/,"");return d}function _rsasign_getAlgNameAndHashFromHexDisgestInfo(f){for(var e in KJUR.crypto.Util.DIGESTINFOHEAD){var d=KJUR.crypto.Util.DIGESTINFOHEAD[e];var b=d.length;if(f.substring(0,b)==d){var c=[e,f.substring(b)];return c}}return[]}function _rsasign_verifySignatureWithArgs(f,b,g,j){var e=_rsasign_getHexDigestInfoFromSig(b,g,j);var h=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(h.length==0){return false}var d=h[0];var i=h[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(i==c)}function _rsasign_verifyHexSignatureForMessage(c,b){var d=parseBigInt(c,16);var a=_rsasign_verifySignatureWithArgs(b,d,this.n.toString(16),this.e.toString(16));return a}function _rsasign_verifyString(f,j){j=j.replace(_RE_HEXDECONLY,"");j=j.replace(/[ \n]+/g,"");var b=parseBigInt(j,16);if(b.bitLength()>this.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)}function _rsasign_verifyWithMessageHash(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)}function _rsasign_verifyStringPSS(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)}function _rsasign_verifyWithMessageHashPSS(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q<a.length;q+=1){a[q]&=255}while(a.length<m){a.unshift(0)}if(a[m-1]!==188){throw"encoded message does not end in 0xbc"}a=String.fromCharCode.apply(String,a);var d=a.substr(0,m-h-1);var e=a.substr(d.length,h);var p=(65280>>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q<d.length;q+=1){o[q]=d.charCodeAt(q)^n.charCodeAt(q)}o[0]&=~p;var b=m-h-c-2;for(q=0;q<b;q+=1){if(o[q]!==0){throw"leftmost octets not zero"}}if(o[b]!==1){throw"0x01 marker not found"}return e===hextorstr(r(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+j+String.fromCharCode.apply(String,o.slice(-c)))))}RSAKey.prototype.signWithMessageHash=_rsasign_signWithMessageHash;RSAKey.prototype.signString=_rsasign_signString;RSAKey.prototype.signStringWithSHA1=_rsasign_signStringWithSHA1;RSAKey.prototype.signStringWithSHA256=_rsasign_signStringWithSHA256;RSAKey.prototype.sign=_rsasign_signString;RSAKey.prototype.signWithSHA1=_rsasign_signStringWithSHA1;RSAKey.prototype.signWithSHA256=_rsasign_signStringWithSHA256;RSAKey.prototype.signWithMessageHashPSS=_rsasign_signWithMessageHashPSS;RSAKey.prototype.signStringPSS=_rsasign_signStringPSS;RSAKey.prototype.signPSS=_rsasign_signStringPSS;RSAKey.SALT_LEN_HLEN=-1;RSAKey.SALT_LEN_MAX=-2;RSAKey.prototype.verifyWithMessageHash=_rsasign_verifyWithMessageHash;RSAKey.prototype.verifyString=_rsasign_verifyString;RSAKey.prototype.verifyHexSignatureForMessage=_rsasign_verifyHexSignatureForMessage;RSAKey.prototype.verify=_rsasign_verifyString;RSAKey.prototype.verifyHexSignatureForByteArrayMessage=_rsasign_verifyHexSignatureForMessage;RSAKey.prototype.verifyWithMessageHashPSS=_rsasign_verifyWithMessageHashPSS;RSAKey.prototype.verifyStringPSS=_rsasign_verifyStringPSS;RSAKey.prototype.verifyPSS=_rsasign_verifyStringPSS;RSAKey.SALT_LEN_RECOVER=-2;
|
||
/*! x509-1.1.3.js (c) 2012-2014 Kenji Urushima | kjur.github.com/jsrsasign/license
|
||
*/
|
||
function X509(){this.subjectPublicKeyRSA=null;this.subjectPublicKeyRSA_hN=null;this.subjectPublicKeyRSA_hE=null;this.hex=null;this.getSerialNumberHex=function(){return ASN1HEX.getDecendantHexVByNthList(this.hex,0,[0,1])};this.getIssuerHex=function(){return ASN1HEX.getDecendantHexTLVByNthList(this.hex,0,[0,3])};this.getIssuerString=function(){return X509.hex2dn(ASN1HEX.getDecendantHexTLVByNthList(this.hex,0,[0,3]))};this.getSubjectHex=function(){return ASN1HEX.getDecendantHexTLVByNthList(this.hex,0,[0,5])};this.getSubjectString=function(){return X509.hex2dn(ASN1HEX.getDecendantHexTLVByNthList(this.hex,0,[0,5]))};this.getNotBefore=function(){var a=ASN1HEX.getDecendantHexVByNthList(this.hex,0,[0,4,0]);a=a.replace(/(..)/g,"%$1");a=decodeURIComponent(a);return a};this.getNotAfter=function(){var a=ASN1HEX.getDecendantHexVByNthList(this.hex,0,[0,4,1]);a=a.replace(/(..)/g,"%$1");a=decodeURIComponent(a);return a};this.readCertPEM=function(c){var e=X509.pemToHex(c);var b=X509.getPublicKeyHexArrayFromCertHex(e);var d=new RSAKey();d.setPublic(b[0],b[1]);this.subjectPublicKeyRSA=d;this.subjectPublicKeyRSA_hN=b[0];this.subjectPublicKeyRSA_hE=b[1];this.hex=e};this.readCertPEMWithoutRSAInit=function(c){var d=X509.pemToHex(c);var b=X509.getPublicKeyHexArrayFromCertHex(d);this.subjectPublicKeyRSA.setPublic(b[0],b[1]);this.subjectPublicKeyRSA_hN=b[0];this.subjectPublicKeyRSA_hE=b[1];this.hex=d}}X509.pemToBase64=function(a){var b=a;b=b.replace("-----BEGIN CERTIFICATE-----","");b=b.replace("-----END CERTIFICATE-----","");b=b.replace(/[ \n]+/g,"");return b};X509.pemToHex=function(a){var c=X509.pemToBase64(a);var b=b64tohex(c);return b};X509.getSubjectPublicKeyPosFromCertHex=function(f){var e=X509.getSubjectPublicKeyInfoPosFromCertHex(f);if(e==-1){return -1}var b=ASN1HEX.getPosArrayOfChildren_AtObj(f,e);if(b.length!=2){return -1}var d=b[1];if(f.substring(d,d+2)!="03"){return -1}var c=ASN1HEX.getStartPosOfV_AtObj(f,d);if(f.substring(c,c+2)!="00"){return -1}return c+2};X509.getSubjectPublicKeyInfoPosFromCertHex=function(d){var c=ASN1HEX.getStartPosOfV_AtObj(d,0);var b=ASN1HEX.getPosArrayOfChildren_AtObj(d,c);if(b.length<1){return -1}if(d.substring(b[0],b[0]+10)=="a003020102"){if(b.length<6){return -1}return b[6]}else{if(b.length<5){return -1}return b[5]}};X509.getPublicKeyHexArrayFromCertHex=function(f){var e=X509.getSubjectPublicKeyPosFromCertHex(f);var b=ASN1HEX.getPosArrayOfChildren_AtObj(f,e);if(b.length!=2){return[]}var d=ASN1HEX.getHexOfV_AtObj(f,b[0]);var c=ASN1HEX.getHexOfV_AtObj(f,b[1]);if(d!=null&&c!=null){return[d,c]}else{return[]}};X509.getHexTbsCertificateFromCert=function(b){var a=ASN1HEX.getStartPosOfV_AtObj(b,0);return a};X509.getPublicKeyHexArrayFromCertPEM=function(c){var d=X509.pemToHex(c);var b=X509.getPublicKeyHexArrayFromCertHex(d);return b};X509.hex2dn=function(e){var f="";var c=ASN1HEX.getPosArrayOfChildren_AtObj(e,0);for(var d=0;d<c.length;d++){var b=ASN1HEX.getHexOfTLV_AtObj(e,c[d]);f=f+"/"+X509.hex2rdn(b)}return f};X509.hex2rdn=function(a){var f=ASN1HEX.getDecendantHexTLVByNthList(a,0,[0,0]);var e=ASN1HEX.getDecendantHexVByNthList(a,0,[0,1]);var c="";try{c=X509.DN_ATTRHEX[f]}catch(b){c=f}e=e.replace(/(..)/g,"%$1");var d=decodeURIComponent(e);return c+"="+d};X509.DN_ATTRHEX={"0603550406":"C","060355040a":"O","060355040b":"OU","0603550403":"CN","0603550405":"SN","0603550408":"ST","0603550407":"L",};X509.getPublicKeyFromCertPEM=function(f){var c=X509.getPublicKeyInfoPropOfCertPEM(f);if(c.algoid=="2a864886f70d010101"){var i=KEYUTIL.parsePublicRawRSAKeyHex(c.keyhex);var j=new RSAKey();j.setPublic(i.n,i.e);return j}else{if(c.algoid=="2a8648ce3d0201"){var e=KJUR.crypto.OID.oidhex2name[c.algparam];var j=new KJUR.crypto.ECDSA({curve:e,info:c.keyhex});j.setPublicKeyHex(c.keyhex);return j}else{if(c.algoid=="2a8648ce380401"){var b=ASN1HEX.getVbyList(c.algparam,0,[0],"02");var a=ASN1HEX.getVbyList(c.algparam,0,[1],"02");var d=ASN1HEX.getVbyList(c.algparam,0,[2],"02");var h=ASN1HEX.getHexOfV_AtObj(c.keyhex,0);h=h.substr(2);var j=new KJUR.crypto.DSA();j.setPublic(new BigInteger(b,16),new BigInteger(a,16),new BigInteger(d,16),new BigInteger(h,16));return j}else{throw"unsupported key"}}}};X509.getPublicKeyInfoPropOfCertPEM=function(e){var c={};c.algparam=null;var g=X509.pemToHex(e);var d=ASN1HEX.getPosArrayOfChildren_AtObj(g,0);if(d.length!=3){throw"malformed X.509 certificate PEM (code:001)"}if(g.substr(d[0],2)!="30"){throw"malformed X.509 certificate PEM (code:002)"}var b=ASN1HEX.getPosArrayOfChildren_AtObj(g,d[0]);if(b.length<7){throw"malformed X.509 certificate PEM (code:003)"}var h=ASN1HEX.getPosArrayOfChildren_AtObj(g,b[6]);if(h.length!=2){throw"malformed X.509 certificate PEM (code:004)"}var f=ASN1HEX.getPosArrayOfChildren_AtObj(g,h[0]);if(f.length!=2){throw"malformed X.509 certificate PEM (code:005)"}c.algoid=ASN1HEX.getHexOfV_AtObj(g,f[0]);if(g.substr(f[1],2)=="06"){c.algparam=ASN1HEX.getHexOfV_AtObj(g,f[1])}else{if(g.substr(f[1],2)=="30"){c.algparam=ASN1HEX.getHexOfTLV_AtObj(g,f[1])}}if(g.substr(h[1],2)!="03"){throw"malformed X.509 certificate PEM (code:006)"}var a=ASN1HEX.getHexOfV_AtObj(g,h[1]);c.keyhex=a.substr(2);return c};
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*
|
||
CryptoJS v3.1.2
|
||
code.google.com/p/crypto-js
|
||
(c) 2009-2013 by Jeff Mott. All rights reserved.
|
||
code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
var CryptoJS=CryptoJS||function(v,p){var d={},u=d.lib={},r=function(){},f=u.Base={extend:function(a){r.prototype=this;var b=new r;a&&b.mixIn(a);b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
|
||
s=u.WordArray=f.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=p?b:4*a.length},toString:function(a){return(a||y).stringify(this)},concat:function(a){var b=this.words,c=a.words,j=this.sigBytes;a=a.sigBytes;this.clamp();if(j%4)for(var n=0;n<a;n++)b[j+n>>>2]|=(c[n>>>2]>>>24-8*(n%4)&255)<<24-8*((j+n)%4);else if(65535<c.length)for(n=0;n<a;n+=4)b[j+n>>>2]=c[n>>>2];else b.push.apply(b,c);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<
|
||
32-8*(b%4);a.length=v.ceil(b/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],c=0;c<a;c+=4)b.push(4294967296*v.random()|0);return new s.init(b,a)}}),x=d.enc={},y=x.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],j=0;j<a;j++){var n=b[j>>>2]>>>24-8*(j%4)&255;c.push((n>>>4).toString(16));c.push((n&15).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],j=0;j<b;j+=2)c[j>>>3]|=parseInt(a.substr(j,
|
||
2),16)<<24-4*(j%8);return new s.init(c,b/2)}},e=x.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],j=0;j<a;j++)c.push(String.fromCharCode(b[j>>>2]>>>24-8*(j%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],j=0;j<b;j++)c[j>>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new s.init(c,b)}},q=x.Utf8={stringify:function(a){try{return decodeURIComponent(escape(e.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return e.parse(unescape(encodeURIComponent(a)))}},
|
||
t=u.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new s.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=q.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,c=b.words,j=b.sigBytes,n=this.blockSize,e=j/(4*n),e=a?v.ceil(e):v.max((e|0)-this._minBufferSize,0);a=e*n;j=v.min(4*a,j);if(a){for(var f=0;f<a;f+=n)this._doProcessBlock(c,f);f=c.splice(0,a);b.sigBytes-=j}return new s.init(f,j)},clone:function(){var a=f.clone.call(this);
|
||
a._data=this._data.clone();return a},_minBufferSize:0});u.Hasher=t.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){t.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return(new a.init(c)).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return(new w.HMAC.init(a,
|
||
c)).finalize(b)}}});var w=d.algo={};return d}(Math);
|
||
(function(v){var p=CryptoJS,d=p.lib,u=d.Base,r=d.WordArray,p=p.x64={};p.Word=u.extend({init:function(f,s){this.high=f;this.low=s}});p.WordArray=u.extend({init:function(f,s){f=this.words=f||[];this.sigBytes=s!=v?s:8*f.length},toX32:function(){for(var f=this.words,s=f.length,d=[],p=0;p<s;p++){var e=f[p];d.push(e.high);d.push(e.low)}return r.create(d,this.sigBytes)},clone:function(){for(var f=u.clone.call(this),d=f.words=this.words.slice(0),p=d.length,r=0;r<p;r++)d[r]=d[r].clone();return f}})})();
|
||
(function(v){for(var p=CryptoJS,d=p.lib,u=d.WordArray,r=d.Hasher,f=p.x64.Word,d=p.algo,s=[],x=[],y=[],e=1,q=0,t=0;24>t;t++){s[e+5*q]=(t+1)*(t+2)/2%64;var w=(2*e+3*q)%5,e=q%5,q=w}for(e=0;5>e;e++)for(q=0;5>q;q++)x[e+5*q]=q+5*((2*e+3*q)%5);e=1;for(q=0;24>q;q++){for(var a=w=t=0;7>a;a++){if(e&1){var b=(1<<a)-1;32>b?w^=1<<b:t^=1<<b-32}e=e&128?e<<1^113:e<<1}y[q]=f.create(t,w)}for(var c=[],e=0;25>e;e++)c[e]=f.create();d=d.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var a=this._state=
|
||
[],b=0;25>b;b++)a[b]=new f.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(a,b){for(var e=this._state,f=this.blockSize/2,h=0;h<f;h++){var l=a[b+2*h],m=a[b+2*h+1],l=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360,m=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360,g=e[h];g.high^=m;g.low^=l}for(f=0;24>f;f++){for(h=0;5>h;h++){for(var d=l=0,k=0;5>k;k++)g=e[h+5*k],l^=g.high,d^=g.low;g=c[h];g.high=l;g.low=d}for(h=0;5>h;h++){g=c[(h+4)%5];l=c[(h+1)%5];m=l.high;k=l.low;l=g.high^
|
||
(m<<1|k>>>31);d=g.low^(k<<1|m>>>31);for(k=0;5>k;k++)g=e[h+5*k],g.high^=l,g.low^=d}for(m=1;25>m;m++)g=e[m],h=g.high,g=g.low,k=s[m],32>k?(l=h<<k|g>>>32-k,d=g<<k|h>>>32-k):(l=g<<k-32|h>>>64-k,d=h<<k-32|g>>>64-k),g=c[x[m]],g.high=l,g.low=d;g=c[0];h=e[0];g.high=h.high;g.low=h.low;for(h=0;5>h;h++)for(k=0;5>k;k++)m=h+5*k,g=e[m],l=c[m],m=c[(h+1)%5+5*k],d=c[(h+2)%5+5*k],g.high=l.high^~m.high&d.high,g.low=l.low^~m.low&d.low;g=e[0];h=y[f];g.high^=h.high;g.low^=h.low}},_doFinalize:function(){var a=this._data,
|
||
b=a.words,c=8*a.sigBytes,e=32*this.blockSize;b[c>>>5]|=1<<24-c%32;b[(v.ceil((c+1)/e)*e>>>5)-1]|=128;a.sigBytes=4*b.length;this._process();for(var a=this._state,b=this.cfg.outputLength/8,c=b/8,e=[],h=0;h<c;h++){var d=a[h],f=d.high,d=d.low,f=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360,d=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;e.push(d);e.push(f)}return new u.init(e,b)},clone:function(){for(var a=r.clone.call(this),b=a._state=this._state.slice(0),c=0;25>c;c++)b[c]=b[c].clone();return a}});
|
||
p.SHA3=r._createHelper(d);p.HmacSHA3=r._createHmacHelper(d)})(Math);
|
||
</script>
|
||
<script type="text/javascript">
|
||
// Base58 encoding/decoding
|
||
// Originally written by Mike Hearn for BitcoinJ
|
||
// Copyright (c) 2011 Google Inc
|
||
// Ported to JavaScript by Stefan Thomas
|
||
// Merged Buffer refactorings from base58-native by Stephen Pair
|
||
// Copyright (c) 2013 BitPay Inc
|
||
|
||
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
||
var ALPHABET_MAP = {}
|
||
for(var i = 0; i < ALPHABET.length; i++) {
|
||
ALPHABET_MAP[ALPHABET.charAt(i)] = i
|
||
}
|
||
var BASE = 58
|
||
|
||
function bs58_encode(buffer) {
|
||
if (buffer.length === 0) return ''
|
||
|
||
var i, j, digits = [0]
|
||
for (i = 0; i < buffer.length; i++) {
|
||
for (j = 0; j < digits.length; j++) digits[j] <<= 8
|
||
digits[digits.length - 1] += buffer[i]
|
||
|
||
var carry = 0
|
||
for (j = digits.length - 1; j >= 0; j--){
|
||
digits[j] += carry
|
||
carry = (digits[j] / BASE) | 0
|
||
digits[j] %= BASE
|
||
}
|
||
|
||
while (carry) {
|
||
digits.unshift(carry)
|
||
carry = (digits[0] / BASE) | 0
|
||
digits[0] %= BASE
|
||
}
|
||
}
|
||
|
||
// deal with leading zeros
|
||
for (i = 0; i < buffer.length - 1 && buffer[i] == 0; i++) digits.unshift(0)
|
||
|
||
return digits.map(function(digit) { return ALPHABET[digit] }).join('')
|
||
}
|
||
|
||
function bs58_decode(string) {
|
||
if (string.length === 0) return 0
|
||
|
||
var input = string.split('').map(function(c){
|
||
//assert.notEqual(ALPHABET_MAP[c], undefined, 'Non-base58 character')
|
||
return ALPHABET_MAP[c]
|
||
})
|
||
|
||
var i, j, bytes = [0]
|
||
for (i = 0; i < input.length; i++) {
|
||
for (j = 0; j < bytes.length; j++) bytes[j] *= BASE
|
||
bytes[bytes.length - 1] += input[i]
|
||
|
||
var carry = 0
|
||
for (j = bytes.length - 1; j >= 0; j--){
|
||
bytes[j] += carry
|
||
carry = bytes[j] >> 8
|
||
bytes[j] &= 0xff
|
||
}
|
||
|
||
while (carry) {
|
||
bytes.unshift(carry)
|
||
carry = bytes[0] >> 8
|
||
bytes[0] &= 0xff
|
||
}
|
||
}
|
||
|
||
// deal with leading zeros
|
||
for (i = 0; i < input.length - 1 && input[i] == 0; i++) bytes.unshift(0)
|
||
|
||
return bytes
|
||
}
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*!
|
||
* Crypto-JS v2.5.4 Crypto.js
|
||
* http://code.google.com/p/crypto-js/
|
||
* Copyright (c) 2009-2013, Jeff Mott. All rights reserved.
|
||
* http://code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
if (typeof Crypto == "undefined" || !Crypto.util) {
|
||
(function () {
|
||
|
||
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||
|
||
// Global Crypto object
|
||
var Crypto = window.Crypto = {};
|
||
|
||
// Crypto utilities
|
||
var util = Crypto.util = {
|
||
|
||
// Bit-wise rotate left
|
||
rotl: function (n, b) {
|
||
return (n << b) | (n >>> (32 - b));
|
||
},
|
||
|
||
// Bit-wise rotate right
|
||
rotr: function (n, b) {
|
||
return (n << (32 - b)) | (n >>> b);
|
||
},
|
||
|
||
// Swap big-endian to little-endian and vice versa
|
||
endian: function (n) {
|
||
|
||
// If number given, swap endian
|
||
if (n.constructor == Number) {
|
||
return util.rotl(n, 8) & 0x00FF00FF |
|
||
util.rotl(n, 24) & 0xFF00FF00;
|
||
}
|
||
|
||
// Else, assume array and swap all items
|
||
for (var i = 0; i < n.length; i++)
|
||
n[i] = util.endian(n[i]);
|
||
return n;
|
||
|
||
},
|
||
|
||
// Generate an array of any length of random bytes
|
||
randomBytes: function (n) {
|
||
for (var bytes = []; n > 0; n--)
|
||
bytes.push(Math.floor(Math.random() * 256));
|
||
return bytes;
|
||
},
|
||
|
||
// Convert a byte array to big-endian 32-bit words
|
||
bytesToWords: function (bytes) {
|
||
for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
|
||
words[b >>> 5] |= (bytes[i] & 0xFF) << (24 - b % 32);
|
||
return words;
|
||
},
|
||
|
||
// Convert big-endian 32-bit words to a byte array
|
||
wordsToBytes: function (words) {
|
||
for (var bytes = [], b = 0; b < words.length * 32; b += 8)
|
||
bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
|
||
return bytes;
|
||
},
|
||
|
||
// Convert a byte array to a hex string
|
||
bytesToHex: function (bytes) {
|
||
for (var hex = [], i = 0; i < bytes.length; i++) {
|
||
hex.push((bytes[i] >>> 4).toString(16));
|
||
hex.push((bytes[i] & 0xF).toString(16));
|
||
}
|
||
return hex.join("");
|
||
},
|
||
|
||
// Convert a hex string to a byte array
|
||
hexToBytes: function (hex) {
|
||
for (var bytes = [], c = 0; c < hex.length; c += 2)
|
||
bytes.push(parseInt(hex.substr(c, 2), 16));
|
||
return bytes;
|
||
},
|
||
|
||
// Convert a byte array to a base-64 string
|
||
bytesToBase64: function (bytes) {
|
||
for (var base64 = [], i = 0; i < bytes.length; i += 3) {
|
||
var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
|
||
for (var j = 0; j < 4; j++) {
|
||
if (i * 8 + j * 6 <= bytes.length * 8)
|
||
base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
|
||
else base64.push("=");
|
||
}
|
||
}
|
||
|
||
return base64.join("");
|
||
},
|
||
|
||
// Convert a base-64 string to a byte array
|
||
base64ToBytes: function (base64) {
|
||
// Remove non-base-64 characters
|
||
base64 = base64.replace(/[^A-Z0-9+\/]/ig, "");
|
||
|
||
for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) {
|
||
if (imod4 == 0) continue;
|
||
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2)) |
|
||
(base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
|
||
}
|
||
|
||
return bytes;
|
||
}
|
||
|
||
};
|
||
|
||
// Crypto character encodings
|
||
var charenc = Crypto.charenc = {};
|
||
|
||
// UTF-8 encoding
|
||
var UTF8 = charenc.UTF8 = {
|
||
|
||
// Convert a string to a byte array
|
||
stringToBytes: function (str) {
|
||
return Binary.stringToBytes(unescape(encodeURIComponent(str)));
|
||
},
|
||
|
||
// Convert a byte array to a string
|
||
bytesToString: function (bytes) {
|
||
return decodeURIComponent(escape(Binary.bytesToString(bytes)));
|
||
}
|
||
|
||
};
|
||
|
||
// Binary encoding
|
||
var Binary = charenc.Binary = {
|
||
|
||
// Convert a string to a byte array
|
||
stringToBytes: function (str) {
|
||
for (var bytes = [], i = 0; i < str.length; i++)
|
||
bytes.push(str.charCodeAt(i) & 0xFF);
|
||
return bytes;
|
||
},
|
||
|
||
// Convert a byte array to a string
|
||
bytesToString: function (bytes) {
|
||
for (var str = [], i = 0; i < bytes.length; i++)
|
||
str.push(String.fromCharCode(bytes[i]));
|
||
return str.join("");
|
||
}
|
||
|
||
};
|
||
|
||
})();
|
||
}
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*!
|
||
* Crypto-JS v2.5.4 SHA256.js
|
||
* http://code.google.com/p/crypto-js/
|
||
* Copyright (c) 2009-2013, Jeff Mott. All rights reserved.
|
||
* http://code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function () {
|
||
|
||
// Shortcuts
|
||
var C = Crypto,
|
||
util = C.util,
|
||
charenc = C.charenc,
|
||
UTF8 = charenc.UTF8,
|
||
Binary = charenc.Binary;
|
||
|
||
// Constants
|
||
var K = [0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
|
||
0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
|
||
0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
|
||
0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
|
||
0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
|
||
0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
|
||
0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
|
||
0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
|
||
0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
|
||
0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
|
||
0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
|
||
0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
|
||
0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
|
||
0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
|
||
0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
|
||
0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2];
|
||
|
||
// Public API
|
||
var SHA256 = C.SHA256 = function (message, options) {
|
||
var digestbytes = util.wordsToBytes(SHA256._sha256(message));
|
||
return options && options.asBytes ? digestbytes :
|
||
options && options.asString ? Binary.bytesToString(digestbytes) :
|
||
util.bytesToHex(digestbytes);
|
||
};
|
||
|
||
// The core
|
||
SHA256._sha256 = function (message) {
|
||
|
||
// Convert to byte array
|
||
if (message.constructor == String) message = UTF8.stringToBytes(message);
|
||
/* else, assume byte array already */
|
||
|
||
var m = util.bytesToWords(message),
|
||
l = message.length * 8,
|
||
H = [0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
|
||
0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19],
|
||
w = [],
|
||
a, b, c, d, e, f, g, h, i, j,
|
||
t1, t2;
|
||
|
||
// Padding
|
||
m[l >> 5] |= 0x80 << (24 - l % 32);
|
||
m[((l + 64 >> 9) << 4) + 15] = l;
|
||
|
||
for (var i = 0; i < m.length; i += 16) {
|
||
|
||
a = H[0];
|
||
b = H[1];
|
||
c = H[2];
|
||
d = H[3];
|
||
e = H[4];
|
||
f = H[5];
|
||
g = H[6];
|
||
h = H[7];
|
||
|
||
for (var j = 0; j < 64; j++) {
|
||
|
||
if (j < 16) w[j] = m[j + i];
|
||
else {
|
||
|
||
var gamma0x = w[j - 15],
|
||
gamma1x = w[j - 2],
|
||
gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
|
||
((gamma0x << 14) | (gamma0x >>> 18)) ^
|
||
(gamma0x >>> 3),
|
||
gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
|
||
((gamma1x << 13) | (gamma1x >>> 19)) ^
|
||
(gamma1x >>> 10);
|
||
|
||
w[j] = gamma0 + (w[j - 7] >>> 0) +
|
||
gamma1 + (w[j - 16] >>> 0);
|
||
|
||
}
|
||
|
||
var ch = e & f ^ ~e & g,
|
||
maj = a & b ^ a & c ^ b & c,
|
||
sigma0 = ((a << 30) | (a >>> 2)) ^
|
||
((a << 19) | (a >>> 13)) ^
|
||
((a << 10) | (a >>> 22)),
|
||
sigma1 = ((e << 26) | (e >>> 6)) ^
|
||
((e << 21) | (e >>> 11)) ^
|
||
((e << 7) | (e >>> 25));
|
||
|
||
|
||
t1 = (h >>> 0) + sigma1 + ch + (K[j]) + (w[j] >>> 0);
|
||
t2 = sigma0 + maj;
|
||
|
||
h = g;
|
||
g = f;
|
||
f = e;
|
||
e = (d + t1) >>> 0;
|
||
d = c;
|
||
c = b;
|
||
b = a;
|
||
a = (t1 + t2) >>> 0;
|
||
|
||
}
|
||
|
||
H[0] += a;
|
||
H[1] += b;
|
||
H[2] += c;
|
||
H[3] += d;
|
||
H[4] += e;
|
||
H[5] += f;
|
||
H[6] += g;
|
||
H[7] += h;
|
||
|
||
}
|
||
|
||
return H;
|
||
|
||
};
|
||
|
||
// Package private blocksize
|
||
SHA256._blocksize = 16;
|
||
|
||
SHA256._digestsize = 32;
|
||
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*!
|
||
* Crypto-JS v2.5.4 PBKDF2.js
|
||
* http://code.google.com/p/crypto-js/
|
||
* Copyright (c) 2009-2013, Jeff Mott. All rights reserved.
|
||
* http://code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function () {
|
||
|
||
// Shortcuts
|
||
var C = Crypto,
|
||
util = C.util,
|
||
charenc = C.charenc,
|
||
UTF8 = charenc.UTF8,
|
||
Binary = charenc.Binary;
|
||
|
||
C.PBKDF2 = function (password, salt, keylen, options) {
|
||
|
||
// Convert to byte arrays
|
||
if (password.constructor == String) password = UTF8.stringToBytes(password);
|
||
if (salt.constructor == String) salt = UTF8.stringToBytes(salt);
|
||
/* else, assume byte arrays already */
|
||
|
||
// Defaults
|
||
var hasher = options && options.hasher || C.SHA1,
|
||
iterations = options && options.iterations || 1;
|
||
|
||
// Pseudo-random function
|
||
function PRF(password, salt) {
|
||
return C.HMAC(hasher, salt, password, { asBytes: true });
|
||
}
|
||
|
||
// Generate key
|
||
var derivedKeyBytes = [],
|
||
blockindex = 1;
|
||
while (derivedKeyBytes.length < keylen) {
|
||
var block = PRF(password, salt.concat(util.wordsToBytes([blockindex])));
|
||
for (var u = block, i = 1; i < iterations; i++) {
|
||
u = PRF(password, u);
|
||
for (var j = 0; j < block.length; j++) block[j] ^= u[j];
|
||
}
|
||
derivedKeyBytes = derivedKeyBytes.concat(block);
|
||
blockindex++;
|
||
}
|
||
|
||
// Truncate excess bytes
|
||
derivedKeyBytes.length = keylen;
|
||
|
||
return options && options.asBytes ? derivedKeyBytes :
|
||
options && options.asString ? Binary.bytesToString(derivedKeyBytes) :
|
||
util.bytesToHex(derivedKeyBytes);
|
||
|
||
};
|
||
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*!
|
||
* Crypto-JS v2.5.4 HMAC.js
|
||
* http://code.google.com/p/crypto-js/
|
||
* Copyright (c) 2009-2013, Jeff Mott. All rights reserved.
|
||
* http://code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function () {
|
||
|
||
// Shortcuts
|
||
var C = Crypto,
|
||
util = C.util,
|
||
charenc = C.charenc,
|
||
UTF8 = charenc.UTF8,
|
||
Binary = charenc.Binary;
|
||
|
||
C.HMAC = function (hasher, message, key, options) {
|
||
|
||
// Convert to byte arrays
|
||
if (message.constructor == String) message = UTF8.stringToBytes(message);
|
||
if (key.constructor == String) key = UTF8.stringToBytes(key);
|
||
/* else, assume byte arrays already */
|
||
|
||
// Allow arbitrary length keys
|
||
if (key.length > hasher._blocksize * 4)
|
||
key = hasher(key, { asBytes: true });
|
||
|
||
// XOR keys with pad constants
|
||
var okey = key.slice(0),
|
||
ikey = key.slice(0);
|
||
for (var i = 0; i < hasher._blocksize * 4; i++) {
|
||
okey[i] ^= 0x5C;
|
||
ikey[i] ^= 0x36;
|
||
}
|
||
|
||
var hmacbytes = hasher(okey.concat(hasher(ikey.concat(message), { asBytes: true })), { asBytes: true });
|
||
|
||
return options && options.asBytes ? hmacbytes :
|
||
options && options.asString ? Binary.bytesToString(hmacbytes) :
|
||
util.bytesToHex(hmacbytes);
|
||
|
||
};
|
||
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*!
|
||
* Crypto-JS v2.5.4 AES.js
|
||
* http://code.google.com/p/crypto-js/
|
||
* Copyright (c) 2009-2013, Jeff Mott. All rights reserved.
|
||
* http://code.google.com/p/crypto-js/wiki/License
|
||
*/
|
||
(function () {
|
||
|
||
// Shortcuts
|
||
var C = Crypto,
|
||
util = C.util,
|
||
charenc = C.charenc,
|
||
UTF8 = charenc.UTF8;
|
||
|
||
// Precomputed SBOX
|
||
var SBOX = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
|
||
0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd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xa9,
|
||
0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
|
||
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6,
|
||
0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
|
||
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
|
||
0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
|
||
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94,
|
||
0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
|
||
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
|
||
0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16];
|
||
|
||
// Compute inverse SBOX lookup table
|
||
for (var INVSBOX = [], i = 0; i < 256; i++) INVSBOX[SBOX[i]] = i;
|
||
|
||
// Compute multiplication in GF(2^8) lookup tables
|
||
var MULT2 = [],
|
||
MULT3 = [],
|
||
MULT9 = [],
|
||
MULTB = [],
|
||
MULTD = [],
|
||
MULTE = [];
|
||
|
||
function xtime(a, b) {
|
||
for (var result = 0, i = 0; i < 8; i++) {
|
||
if (b & 1) result ^= a;
|
||
var hiBitSet = a & 0x80;
|
||
a = (a << 1) & 0xFF;
|
||
if (hiBitSet) a ^= 0x1b;
|
||
b >>>= 1;
|
||
}
|
||
return result;
|
||
}
|
||
|
||
for (var i = 0; i < 256; i++) {
|
||
MULT2[i] = xtime(i, 2);
|
||
MULT3[i] = xtime(i, 3);
|
||
MULT9[i] = xtime(i, 9);
|
||
MULTB[i] = xtime(i, 0xB);
|
||
MULTD[i] = xtime(i, 0xD);
|
||
MULTE[i] = xtime(i, 0xE);
|
||
}
|
||
|
||
// Precomputed RCon lookup
|
||
var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
|
||
|
||
// Inner state
|
||
var state = [[], [], [], []],
|
||
keylength,
|
||
nrounds,
|
||
keyschedule;
|
||
|
||
var AES = C.AES = {
|
||
|
||
/**
|
||
* Public API
|
||
*/
|
||
|
||
encrypt: function (message, password, options) {
|
||
|
||
options = options || {};
|
||
|
||
// Determine mode
|
||
var mode = options.mode || new C.mode.OFB;
|
||
|
||
// Allow mode to override options
|
||
if (mode.fixOptions) mode.fixOptions(options);
|
||
|
||
var
|
||
|
||
// Convert to bytes if message is a string
|
||
m = (
|
||
message.constructor == String ?
|
||
UTF8.stringToBytes(message) :
|
||
message
|
||
),
|
||
|
||
// Generate random IV
|
||
iv = options.iv || util.randomBytes(AES._blocksize * 4),
|
||
|
||
// Generate key
|
||
k = (
|
||
password.constructor == String ?
|
||
// Derive key from pass-phrase
|
||
C.PBKDF2(password, iv, 32, { asBytes: true }) :
|
||
// else, assume byte array representing cryptographic key
|
||
password
|
||
);
|
||
|
||
// Encrypt
|
||
AES._init(k);
|
||
mode.encrypt(AES, m, iv);
|
||
|
||
// Return ciphertext
|
||
m = options.iv ? m : iv.concat(m);
|
||
return (options && options.asBytes) ? m : util.bytesToBase64(m);
|
||
|
||
},
|
||
|
||
decrypt: function (ciphertext, password, options) {
|
||
|
||
options = options || {};
|
||
|
||
// Determine mode
|
||
var mode = options.mode || new C.mode.OFB;
|
||
|
||
// Allow mode to override options
|
||
if (mode.fixOptions) mode.fixOptions(options);
|
||
|
||
var
|
||
|
||
// Convert to bytes if ciphertext is a string
|
||
c = (
|
||
ciphertext.constructor == String ?
|
||
util.base64ToBytes(ciphertext) :
|
||
ciphertext
|
||
),
|
||
|
||
// Separate IV and message
|
||
iv = options.iv || c.splice(0, AES._blocksize * 4),
|
||
|
||
// Generate key
|
||
k = (
|
||
password.constructor == String ?
|
||
// Derive key from pass-phrase
|
||
C.PBKDF2(password, iv, 32, { asBytes: true }) :
|
||
// else, assume byte array representing cryptographic key
|
||
password
|
||
);
|
||
|
||
// Decrypt
|
||
AES._init(k);
|
||
mode.decrypt(AES, c, iv);
|
||
|
||
// Return plaintext
|
||
return (options && options.asBytes) ? c : UTF8.bytesToString(c);
|
||
|
||
},
|
||
|
||
|
||
/**
|
||
* Package private methods and properties
|
||
*/
|
||
|
||
_blocksize: 4,
|
||
|
||
_encryptblock: function (m, offset) {
|
||
|
||
// Set input
|
||
for (var row = 0; row < AES._blocksize; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] = m[offset + col * 4 + row];
|
||
}
|
||
|
||
// Add round key
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] ^= keyschedule[col][row];
|
||
}
|
||
|
||
for (var round = 1; round < nrounds; round++) {
|
||
|
||
// Sub bytes
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] = SBOX[state[row][col]];
|
||
}
|
||
|
||
// Shift rows
|
||
state[1].push(state[1].shift());
|
||
state[2].push(state[2].shift());
|
||
state[2].push(state[2].shift());
|
||
state[3].unshift(state[3].pop());
|
||
|
||
// Mix columns
|
||
for (var col = 0; col < 4; col++) {
|
||
|
||
var s0 = state[0][col],
|
||
s1 = state[1][col],
|
||
s2 = state[2][col],
|
||
s3 = state[3][col];
|
||
|
||
state[0][col] = MULT2[s0] ^ MULT3[s1] ^ s2 ^ s3;
|
||
state[1][col] = s0 ^ MULT2[s1] ^ MULT3[s2] ^ s3;
|
||
state[2][col] = s0 ^ s1 ^ MULT2[s2] ^ MULT3[s3];
|
||
state[3][col] = MULT3[s0] ^ s1 ^ s2 ^ MULT2[s3];
|
||
|
||
}
|
||
|
||
// Add round key
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] ^= keyschedule[round * 4 + col][row];
|
||
}
|
||
|
||
}
|
||
|
||
// Sub bytes
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] = SBOX[state[row][col]];
|
||
}
|
||
|
||
// Shift rows
|
||
state[1].push(state[1].shift());
|
||
state[2].push(state[2].shift());
|
||
state[2].push(state[2].shift());
|
||
state[3].unshift(state[3].pop());
|
||
|
||
// Add round key
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] ^= keyschedule[nrounds * 4 + col][row];
|
||
}
|
||
|
||
// Set output
|
||
for (var row = 0; row < AES._blocksize; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
m[offset + col * 4 + row] = state[row][col];
|
||
}
|
||
|
||
},
|
||
|
||
_decryptblock: function (c, offset) {
|
||
|
||
// Set input
|
||
for (var row = 0; row < AES._blocksize; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] = c[offset + col * 4 + row];
|
||
}
|
||
|
||
// Add round key
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] ^= keyschedule[nrounds * 4 + col][row];
|
||
}
|
||
|
||
for (var round = 1; round < nrounds; round++) {
|
||
|
||
// Inv shift rows
|
||
state[1].unshift(state[1].pop());
|
||
state[2].push(state[2].shift());
|
||
state[2].push(state[2].shift());
|
||
state[3].push(state[3].shift());
|
||
|
||
// Inv sub bytes
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] = INVSBOX[state[row][col]];
|
||
}
|
||
|
||
// Add round key
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] ^= keyschedule[(nrounds - round) * 4 + col][row];
|
||
}
|
||
|
||
// Inv mix columns
|
||
for (var col = 0; col < 4; col++) {
|
||
|
||
var s0 = state[0][col],
|
||
s1 = state[1][col],
|
||
s2 = state[2][col],
|
||
s3 = state[3][col];
|
||
|
||
state[0][col] = MULTE[s0] ^ MULTB[s1] ^ MULTD[s2] ^ MULT9[s3];
|
||
state[1][col] = MULT9[s0] ^ MULTE[s1] ^ MULTB[s2] ^ MULTD[s3];
|
||
state[2][col] = MULTD[s0] ^ MULT9[s1] ^ MULTE[s2] ^ MULTB[s3];
|
||
state[3][col] = MULTB[s0] ^ MULTD[s1] ^ MULT9[s2] ^ MULTE[s3];
|
||
|
||
}
|
||
|
||
}
|
||
|
||
// Inv shift rows
|
||
state[1].unshift(state[1].pop());
|
||
state[2].push(state[2].shift());
|
||
state[2].push(state[2].shift());
|
||
state[3].push(state[3].shift());
|
||
|
||
// Inv sub bytes
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] = INVSBOX[state[row][col]];
|
||
}
|
||
|
||
// Add round key
|
||
for (var row = 0; row < 4; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
state[row][col] ^= keyschedule[col][row];
|
||
}
|
||
|
||
// Set output
|
||
for (var row = 0; row < AES._blocksize; row++) {
|
||
for (var col = 0; col < 4; col++)
|
||
c[offset + col * 4 + row] = state[row][col];
|
||
}
|
||
|
||
},
|
||
|
||
|
||
/**
|
||
* Private methods
|
||
*/
|
||
|
||
_init: function (k) {
|
||
keylength = k.length / 4;
|
||
nrounds = keylength + 6;
|
||
AES._keyexpansion(k);
|
||
},
|
||
|
||
// Generate a key schedule
|
||
_keyexpansion: function (k) {
|
||
|
||
keyschedule = [];
|
||
|
||
for (var row = 0; row < keylength; row++) {
|
||
keyschedule[row] = [
|
||
k[row * 4],
|
||
k[row * 4 + 1],
|
||
k[row * 4 + 2],
|
||
k[row * 4 + 3]
|
||
];
|
||
}
|
||
|
||
for (var row = keylength; row < AES._blocksize * (nrounds + 1); row++) {
|
||
|
||
var temp = [
|
||
keyschedule[row - 1][0],
|
||
keyschedule[row - 1][1],
|
||
keyschedule[row - 1][2],
|
||
keyschedule[row - 1][3]
|
||
];
|
||
|
||
if (row % keylength == 0) {
|
||
|
||
// Rot word
|
||
temp.push(temp.shift());
|
||
|
||
// Sub word
|
||
temp[0] = SBOX[temp[0]];
|
||
temp[1] = SBOX[temp[1]];
|
||
temp[2] = SBOX[temp[2]];
|
||
temp[3] = SBOX[temp[3]];
|
||
|
||
temp[0] ^= RCON[row / keylength];
|
||
|
||
} else if (keylength > 6 && row % keylength == 4) {
|
||
|
||
// Sub word
|
||
temp[0] = SBOX[temp[0]];
|
||
temp[1] = SBOX[temp[1]];
|
||
temp[2] = SBOX[temp[2]];
|
||
temp[3] = SBOX[temp[3]];
|
||
|
||
}
|
||
|
||
keyschedule[row] = [
|
||
keyschedule[row - keylength][0] ^ temp[0],
|
||
keyschedule[row - keylength][1] ^ temp[1],
|
||
keyschedule[row - keylength][2] ^ temp[2],
|
||
keyschedule[row - keylength][3] ^ temp[3]
|
||
];
|
||
|
||
}
|
||
|
||
}
|
||
|
||
};
|
||
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*!
|
||
* Crypto-JS 2.5.4 BlockModes.js
|
||
* contribution from Simon Greatrix
|
||
*/
|
||
|
||
(function (C) {
|
||
|
||
// Create pad namespace
|
||
var C_pad = C.pad = {};
|
||
|
||
// Calculate the number of padding bytes required.
|
||
function _requiredPadding(cipher, message) {
|
||
var blockSizeInBytes = cipher._blocksize * 4;
|
||
var reqd = blockSizeInBytes - message.length % blockSizeInBytes;
|
||
return reqd;
|
||
}
|
||
|
||
// Remove padding when the final byte gives the number of padding bytes.
|
||
var _unpadLength = function (cipher, message, alg, padding) {
|
||
var pad = message.pop();
|
||
if (pad == 0) {
|
||
throw new Error("Invalid zero-length padding specified for " + alg
|
||
+ ". Wrong cipher specification or key used?");
|
||
}
|
||
var maxPad = cipher._blocksize * 4;
|
||
if (pad > maxPad) {
|
||
throw new Error("Invalid padding length of " + pad
|
||
+ " specified for " + alg
|
||
+ ". Wrong cipher specification or key used?");
|
||
}
|
||
for (var i = 1; i < pad; i++) {
|
||
var b = message.pop();
|
||
if (padding != undefined && padding != b) {
|
||
throw new Error("Invalid padding byte of 0x" + b.toString(16)
|
||
+ " specified for " + alg
|
||
+ ". Wrong cipher specification or key used?");
|
||
}
|
||
}
|
||
};
|
||
|
||
// No-operation padding, used for stream ciphers
|
||
C_pad.NoPadding = {
|
||
pad: function (cipher, message) { },
|
||
unpad: function (cipher, message) { }
|
||
};
|
||
|
||
// Zero Padding.
|
||
//
|
||
// If the message is not an exact number of blocks, the final block is
|
||
// completed with 0x00 bytes. There is no unpadding.
|
||
C_pad.ZeroPadding = {
|
||
pad: function (cipher, message) {
|
||
var blockSizeInBytes = cipher._blocksize * 4;
|
||
var reqd = message.length % blockSizeInBytes;
|
||
if (reqd != 0) {
|
||
for (reqd = blockSizeInBytes - reqd; reqd > 0; reqd--) {
|
||
message.push(0x00);
|
||
}
|
||
}
|
||
},
|
||
|
||
unpad: function (cipher, message) {
|
||
while (message[message.length - 1] == 0) {
|
||
message.pop();
|
||
}
|
||
}
|
||
};
|
||
|
||
// ISO/IEC 7816-4 padding.
|
||
//
|
||
// Pads the plain text with an 0x80 byte followed by as many 0x00
|
||
// bytes are required to complete the block.
|
||
C_pad.iso7816 = {
|
||
pad: function (cipher, message) {
|
||
var reqd = _requiredPadding(cipher, message);
|
||
message.push(0x80);
|
||
for (; reqd > 1; reqd--) {
|
||
message.push(0x00);
|
||
}
|
||
},
|
||
|
||
unpad: function (cipher, message) {
|
||
var padLength;
|
||
for (padLength = cipher._blocksize * 4; padLength > 0; padLength--) {
|
||
var b = message.pop();
|
||
if (b == 0x80) return;
|
||
if (b != 0x00) {
|
||
throw new Error("ISO-7816 padding byte must be 0, not 0x" + b.toString(16) + ". Wrong cipher specification or key used?");
|
||
}
|
||
}
|
||
throw new Error("ISO-7816 padded beyond cipher block size. Wrong cipher specification or key used?");
|
||
}
|
||
};
|
||
|
||
// ANSI X.923 padding
|
||
//
|
||
// The final block is padded with zeros except for the last byte of the
|
||
// last block which contains the number of padding bytes.
|
||
C_pad.ansix923 = {
|
||
pad: function (cipher, message) {
|
||
var reqd = _requiredPadding(cipher, message);
|
||
for (var i = 1; i < reqd; i++) {
|
||
message.push(0x00);
|
||
}
|
||
message.push(reqd);
|
||
},
|
||
|
||
unpad: function (cipher, message) {
|
||
_unpadLength(cipher, message, "ANSI X.923", 0);
|
||
}
|
||
};
|
||
|
||
// ISO 10126
|
||
//
|
||
// The final block is padded with random bytes except for the last
|
||
// byte of the last block which contains the number of padding bytes.
|
||
C_pad.iso10126 = {
|
||
pad: function (cipher, message) {
|
||
var reqd = _requiredPadding(cipher, message);
|
||
for (var i = 1; i < reqd; i++) {
|
||
message.push(Math.floor(Math.random() * 256));
|
||
}
|
||
message.push(reqd);
|
||
},
|
||
|
||
unpad: function (cipher, message) {
|
||
_unpadLength(cipher, message, "ISO 10126", undefined);
|
||
}
|
||
};
|
||
|
||
// PKCS7 padding
|
||
//
|
||
// PKCS7 is described in RFC 5652. Padding is in whole bytes. The
|
||
// value of each added byte is the number of bytes that are added,
|
||
// i.e. N bytes, each of value N are added.
|
||
C_pad.pkcs7 = {
|
||
pad: function (cipher, message) {
|
||
var reqd = _requiredPadding(cipher, message);
|
||
for (var i = 0; i < reqd; i++) {
|
||
message.push(reqd);
|
||
}
|
||
},
|
||
|
||
unpad: function (cipher, message) {
|
||
_unpadLength(cipher, message, "PKCS 7", message[message.length - 1]);
|
||
}
|
||
};
|
||
|
||
// Create mode namespace
|
||
var C_mode = C.mode = {};
|
||
|
||
/**
|
||
* Mode base "class".
|
||
*/
|
||
var Mode = C_mode.Mode = function (padding) {
|
||
if (padding) {
|
||
this._padding = padding;
|
||
}
|
||
};
|
||
|
||
Mode.prototype = {
|
||
encrypt: function (cipher, m, iv) {
|
||
this._padding.pad(cipher, m);
|
||
this._doEncrypt(cipher, m, iv);
|
||
},
|
||
|
||
decrypt: function (cipher, m, iv) {
|
||
this._doDecrypt(cipher, m, iv);
|
||
this._padding.unpad(cipher, m);
|
||
},
|
||
|
||
// Default padding
|
||
_padding: C_pad.iso7816
|
||
};
|
||
|
||
|
||
/**
|
||
* Electronic Code Book mode.
|
||
*
|
||
* ECB applies the cipher directly against each block of the input.
|
||
*
|
||
* ECB does not require an initialization vector.
|
||
*/
|
||
var ECB = C_mode.ECB = function () {
|
||
// Call parent constructor
|
||
Mode.apply(this, arguments);
|
||
};
|
||
|
||
// Inherit from Mode
|
||
var ECB_prototype = ECB.prototype = new Mode;
|
||
|
||
// Concrete steps for Mode template
|
||
ECB_prototype._doEncrypt = function (cipher, m, iv) {
|
||
var blockSizeInBytes = cipher._blocksize * 4;
|
||
// Encrypt each block
|
||
for (var offset = 0; offset < m.length; offset += blockSizeInBytes) {
|
||
cipher._encryptblock(m, offset);
|
||
}
|
||
};
|
||
ECB_prototype._doDecrypt = function (cipher, c, iv) {
|
||
var blockSizeInBytes = cipher._blocksize * 4;
|
||
// Decrypt each block
|
||
for (var offset = 0; offset < c.length; offset += blockSizeInBytes) {
|
||
cipher._decryptblock(c, offset);
|
||
}
|
||
};
|
||
|
||
// ECB never uses an IV
|
||
ECB_prototype.fixOptions = function (options) {
|
||
options.iv = [];
|
||
};
|
||
|
||
|
||
/**
|
||
* Cipher block chaining
|
||
*
|
||
* The first block is XORed with the IV. Subsequent blocks are XOR with the
|
||
* previous cipher output.
|
||
*/
|
||
var CBC = C_mode.CBC = function () {
|
||
// Call parent constructor
|
||
Mode.apply(this, arguments);
|
||
};
|
||
|
||
// Inherit from Mode
|
||
var CBC_prototype = CBC.prototype = new Mode;
|
||
|
||
// Concrete steps for Mode template
|
||
CBC_prototype._doEncrypt = function (cipher, m, iv) {
|
||
var blockSizeInBytes = cipher._blocksize * 4;
|
||
|
||
// Encrypt each block
|
||
for (var offset = 0; offset < m.length; offset += blockSizeInBytes) {
|
||
if (offset == 0) {
|
||
// XOR first block using IV
|
||
for (var i = 0; i < blockSizeInBytes; i++)
|
||
m[i] ^= iv[i];
|
||
} else {
|
||
// XOR this block using previous crypted block
|
||
for (var i = 0; i < blockSizeInBytes; i++)
|
||
m[offset + i] ^= m[offset + i - blockSizeInBytes];
|
||
}
|
||
// Encrypt block
|
||
cipher._encryptblock(m, offset);
|
||
}
|
||
};
|
||
CBC_prototype._doDecrypt = function (cipher, c, iv) {
|
||
var blockSizeInBytes = cipher._blocksize * 4;
|
||
|
||
// At the start, the previously crypted block is the IV
|
||
var prevCryptedBlock = iv;
|
||
|
||
// Decrypt each block
|
||
for (var offset = 0; offset < c.length; offset += blockSizeInBytes) {
|
||
// Save this crypted block
|
||
var thisCryptedBlock = c.slice(offset, offset + blockSizeInBytes);
|
||
// Decrypt block
|
||
cipher._decryptblock(c, offset);
|
||
// XOR decrypted block using previous crypted block
|
||
for (var i = 0; i < blockSizeInBytes; i++) {
|
||
c[offset + i] ^= prevCryptedBlock[i];
|
||
}
|
||
prevCryptedBlock = thisCryptedBlock;
|
||
}
|
||
};
|
||
|
||
|
||
/**
|
||
* Cipher feed back
|
||
*
|
||
* The cipher output is XORed with the plain text to produce the cipher output,
|
||
* which is then fed back into the cipher to produce a bit pattern to XOR the
|
||
* next block with.
|
||
*
|
||
* This is a stream cipher mode and does not require padding.
|
||
*/
|
||
var CFB = C_mode.CFB = function () {
|
||
// Call parent constructor
|
||
Mode.apply(this, arguments);
|
||
};
|
||
|
||
// Inherit from Mode
|
||
var CFB_prototype = CFB.prototype = new Mode;
|
||
|
||
// Override padding
|
||
CFB_prototype._padding = C_pad.NoPadding;
|
||
|
||
// Concrete steps for Mode template
|
||
CFB_prototype._doEncrypt = function (cipher, m, iv) {
|
||
var blockSizeInBytes = cipher._blocksize * 4,
|
||
keystream = iv.slice(0);
|
||
|
||
// Encrypt each byte
|
||
for (var i = 0; i < m.length; i++) {
|
||
|
||
var j = i % blockSizeInBytes;
|
||
if (j == 0) cipher._encryptblock(keystream, 0);
|
||
|
||
m[i] ^= keystream[j];
|
||
keystream[j] = m[i];
|
||
}
|
||
};
|
||
CFB_prototype._doDecrypt = function (cipher, c, iv) {
|
||
var blockSizeInBytes = cipher._blocksize * 4,
|
||
keystream = iv.slice(0);
|
||
|
||
// Encrypt each byte
|
||
for (var i = 0; i < c.length; i++) {
|
||
|
||
var j = i % blockSizeInBytes;
|
||
if (j == 0) cipher._encryptblock(keystream, 0);
|
||
|
||
var b = c[i];
|
||
c[i] ^= keystream[j];
|
||
keystream[j] = b;
|
||
}
|
||
};
|
||
|
||
|
||
/**
|
||
* Output feed back
|
||
*
|
||
* The cipher repeatedly encrypts its own output. The output is XORed with the
|
||
* plain text to produce the cipher text.
|
||
*
|
||
* This is a stream cipher mode and does not require padding.
|
||
*/
|
||
var OFB = C_mode.OFB = function () {
|
||
// Call parent constructor
|
||
Mode.apply(this, arguments);
|
||
};
|
||
|
||
// Inherit from Mode
|
||
var OFB_prototype = OFB.prototype = new Mode;
|
||
|
||
// Override padding
|
||
OFB_prototype._padding = C_pad.NoPadding;
|
||
|
||
// Concrete steps for Mode template
|
||
OFB_prototype._doEncrypt = function (cipher, m, iv) {
|
||
|
||
var blockSizeInBytes = cipher._blocksize * 4,
|
||
keystream = iv.slice(0);
|
||
|
||
// Encrypt each byte
|
||
for (var i = 0; i < m.length; i++) {
|
||
|
||
// Generate keystream
|
||
if (i % blockSizeInBytes == 0)
|
||
cipher._encryptblock(keystream, 0);
|
||
|
||
// Encrypt byte
|
||
m[i] ^= keystream[i % blockSizeInBytes];
|
||
|
||
}
|
||
};
|
||
OFB_prototype._doDecrypt = OFB_prototype._doEncrypt;
|
||
|
||
/**
|
||
* Counter
|
||
* @author Gergely Risko
|
||
*
|
||
* After every block the last 4 bytes of the IV is increased by one
|
||
* with carry and that IV is used for the next block.
|
||
*
|
||
* This is a stream cipher mode and does not require padding.
|
||
*/
|
||
var CTR = C_mode.CTR = function () {
|
||
// Call parent constructor
|
||
Mode.apply(this, arguments);
|
||
};
|
||
|
||
// Inherit from Mode
|
||
var CTR_prototype = CTR.prototype = new Mode;
|
||
|
||
// Override padding
|
||
CTR_prototype._padding = C_pad.NoPadding;
|
||
|
||
CTR_prototype._doEncrypt = function (cipher, m, iv) {
|
||
var blockSizeInBytes = cipher._blocksize * 4;
|
||
var counter = iv.slice(0);
|
||
|
||
for (var i = 0; i < m.length; ) {
|
||
// do not lose iv
|
||
var keystream = counter.slice(0);
|
||
|
||
// Generate keystream for next block
|
||
cipher._encryptblock(keystream, 0);
|
||
|
||
// XOR keystream with block
|
||
for (var j = 0; i < m.length && j < blockSizeInBytes; j++, i++) {
|
||
m[i] ^= keystream[j];
|
||
}
|
||
|
||
// Increase counter
|
||
if (++(counter[blockSizeInBytes - 1]) == 256) {
|
||
counter[blockSizeInBytes - 1] = 0;
|
||
if (++(counter[blockSizeInBytes - 2]) == 256) {
|
||
counter[blockSizeInBytes - 2] = 0;
|
||
if (++(counter[blockSizeInBytes - 3]) == 256) {
|
||
counter[blockSizeInBytes - 3] = 0;
|
||
++(counter[blockSizeInBytes - 4]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
CTR_prototype._doDecrypt = CTR_prototype._doEncrypt;
|
||
|
||
})(Crypto);
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*!
|
||
* Crypto-JS v2.0.0 RIPEMD-160
|
||
* http://code.google.com/p/crypto-js/
|
||
* Copyright (c) 2009, Jeff Mott. All rights reserved.
|
||
* http://code.google.com/p/crypto-js/wiki/License
|
||
*
|
||
* A JavaScript implementation of the RIPEMD-160 Algorithm
|
||
* Version 2.2 Copyright Jeremy Lin, Paul Johnston 2000 - 2009.
|
||
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
||
* Distributed under the BSD License
|
||
* See http://pajhome.org.uk/crypt/md5 for details.
|
||
* Also http://www.ocf.berkeley.edu/~jjlin/jsotp/
|
||
* Ported to Crypto-JS by Stefan Thomas.
|
||
*/
|
||
|
||
(function () {
|
||
// Shortcuts
|
||
var C = Crypto,
|
||
util = C.util,
|
||
charenc = C.charenc,
|
||
UTF8 = charenc.UTF8,
|
||
Binary = charenc.Binary;
|
||
|
||
// Convert a byte array to little-endian 32-bit words
|
||
util.bytesToLWords = function (bytes) {
|
||
|
||
var output = Array(bytes.length >> 2);
|
||
for (var i = 0; i < output.length; i++)
|
||
output[i] = 0;
|
||
for (var i = 0; i < bytes.length * 8; i += 8)
|
||
output[i >> 5] |= (bytes[i / 8] & 0xFF) << (i % 32);
|
||
return output;
|
||
};
|
||
|
||
// Convert little-endian 32-bit words to a byte array
|
||
util.lWordsToBytes = function (words) {
|
||
var output = [];
|
||
for (var i = 0; i < words.length * 32; i += 8)
|
||
output.push((words[i >> 5] >>> (i % 32)) & 0xff);
|
||
return output;
|
||
};
|
||
|
||
// Public API
|
||
var RIPEMD160 = C.RIPEMD160 = function (message, options) {
|
||
var digestbytes = util.lWordsToBytes(RIPEMD160._rmd160(message));
|
||
return options && options.asBytes ? digestbytes :
|
||
options && options.asString ? Binary.bytesToString(digestbytes) :
|
||
util.bytesToHex(digestbytes);
|
||
};
|
||
|
||
// The core
|
||
RIPEMD160._rmd160 = function (message) {
|
||
// Convert to byte array
|
||
if (message.constructor == String) message = UTF8.stringToBytes(message);
|
||
|
||
var x = util.bytesToLWords(message),
|
||
len = message.length * 8;
|
||
|
||
/* append padding */
|
||
x[len >> 5] |= 0x80 << (len % 32);
|
||
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
||
|
||
var h0 = 0x67452301;
|
||
var h1 = 0xefcdab89;
|
||
var h2 = 0x98badcfe;
|
||
var h3 = 0x10325476;
|
||
var h4 = 0xc3d2e1f0;
|
||
|
||
for (var i = 0; i < x.length; i += 16) {
|
||
var T;
|
||
var A1 = h0, B1 = h1, C1 = h2, D1 = h3, E1 = h4;
|
||
var A2 = h0, B2 = h1, C2 = h2, D2 = h3, E2 = h4;
|
||
for (var j = 0; j <= 79; ++j) {
|
||
T = safe_add(A1, rmd160_f(j, B1, C1, D1));
|
||
T = safe_add(T, x[i + rmd160_r1[j]]);
|
||
T = safe_add(T, rmd160_K1(j));
|
||
T = safe_add(bit_rol(T, rmd160_s1[j]), E1);
|
||
A1 = E1; E1 = D1; D1 = bit_rol(C1, 10); C1 = B1; B1 = T;
|
||
T = safe_add(A2, rmd160_f(79 - j, B2, C2, D2));
|
||
T = safe_add(T, x[i + rmd160_r2[j]]);
|
||
T = safe_add(T, rmd160_K2(j));
|
||
T = safe_add(bit_rol(T, rmd160_s2[j]), E2);
|
||
A2 = E2; E2 = D2; D2 = bit_rol(C2, 10); C2 = B2; B2 = T;
|
||
}
|
||
T = safe_add(h1, safe_add(C1, D2));
|
||
h1 = safe_add(h2, safe_add(D1, E2));
|
||
h2 = safe_add(h3, safe_add(E1, A2));
|
||
h3 = safe_add(h4, safe_add(A1, B2));
|
||
h4 = safe_add(h0, safe_add(B1, C2));
|
||
h0 = T;
|
||
}
|
||
return [h0, h1, h2, h3, h4];
|
||
}
|
||
|
||
function rmd160_f(j, x, y, z) {
|
||
return (0 <= j && j <= 15) ? (x ^ y ^ z) :
|
||
(16 <= j && j <= 31) ? (x & y) | (~x & z) :
|
||
(32 <= j && j <= 47) ? (x | ~y) ^ z :
|
||
(48 <= j && j <= 63) ? (x & z) | (y & ~z) :
|
||
(64 <= j && j <= 79) ? x ^ (y | ~z) :
|
||
"rmd160_f: j out of range";
|
||
}
|
||
function rmd160_K1(j) {
|
||
return (0 <= j && j <= 15) ? 0x00000000 :
|
||
(16 <= j && j <= 31) ? 0x5a827999 :
|
||
(32 <= j && j <= 47) ? 0x6ed9eba1 :
|
||
(48 <= j && j <= 63) ? 0x8f1bbcdc :
|
||
(64 <= j && j <= 79) ? 0xa953fd4e :
|
||
"rmd160_K1: j out of range";
|
||
}
|
||
function rmd160_K2(j) {
|
||
return (0 <= j && j <= 15) ? 0x50a28be6 :
|
||
(16 <= j && j <= 31) ? 0x5c4dd124 :
|
||
(32 <= j && j <= 47) ? 0x6d703ef3 :
|
||
(48 <= j && j <= 63) ? 0x7a6d76e9 :
|
||
(64 <= j && j <= 79) ? 0x00000000 :
|
||
"rmd160_K2: j out of range";
|
||
}
|
||
var rmd160_r1 = [
|
||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
|
||
3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
|
||
1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
|
||
4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
|
||
];
|
||
var rmd160_r2 = [
|
||
5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
|
||
6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
|
||
15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
|
||
8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
|
||
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
|
||
];
|
||
var rmd160_s1 = [
|
||
11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
|
||
7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
|
||
11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
|
||
11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
|
||
9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
|
||
];
|
||
var rmd160_s2 = [
|
||
8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
|
||
9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
|
||
9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
|
||
15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
|
||
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
|
||
];
|
||
|
||
/*
|
||
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
||
* to work around bugs in some JS interpreters.
|
||
*/
|
||
function safe_add(x, y) {
|
||
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
|
||
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
||
return (msw << 16) | (lsw & 0xFFFF);
|
||
}
|
||
|
||
/*
|
||
* Bitwise rotate a 32-bit number to the left.
|
||
*/
|
||
function bit_rol(num, cnt) {
|
||
return (num << cnt) | (num >>> (32 - cnt));
|
||
}
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*!
|
||
* Random number generator with ArcFour PRNG
|
||
*
|
||
* NOTE: For best results, put code like
|
||
* <body onclick='SecureRandom.seedTime();' onkeypress='SecureRandom.seedTime();'>
|
||
* in your main HTML document.
|
||
*
|
||
* Copyright Tom Wu, bitaddress.org BSD License.
|
||
* http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE
|
||
*/
|
||
(function () {
|
||
|
||
// Constructor function of Global SecureRandom object
|
||
var sr = window.SecureRandom = function () { };
|
||
|
||
// Properties
|
||
sr.state;
|
||
sr.pool;
|
||
sr.pptr;
|
||
sr.poolCopyOnInit;
|
||
|
||
// 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()
|
||
sr.poolSize = 256;
|
||
|
||
// --- object methods ---
|
||
|
||
// public method
|
||
// ba: byte array
|
||
sr.prototype.nextBytes = function (ba) {
|
||
var i;
|
||
if (window.crypto && window.crypto.getRandomValues && window.Uint8Array) {
|
||
try {
|
||
var rvBytes = new Uint8Array(ba.length);
|
||
window.crypto.getRandomValues(rvBytes);
|
||
for (i = 0; i < ba.length; ++i)
|
||
ba[i] = sr.getByte() ^ rvBytes[i];
|
||
return;
|
||
} catch (e) {
|
||
alert(e);
|
||
}
|
||
}
|
||
for (i = 0; i < ba.length; ++i) ba[i] = sr.getByte();
|
||
};
|
||
|
||
|
||
// --- static methods ---
|
||
|
||
// Mix in the current time (w/milliseconds) into the pool
|
||
// NOTE: this method should be called from body click/keypress event handlers to increase entropy
|
||
sr.seedTime = function () {
|
||
sr.seedInt(new Date().getTime());
|
||
}
|
||
|
||
sr.getByte = function () {
|
||
if (sr.state == null) {
|
||
sr.seedTime();
|
||
sr.state = sr.ArcFour(); // Plug in your RNG constructor here
|
||
sr.state.init(sr.pool);
|
||
sr.poolCopyOnInit = [];
|
||
for (sr.pptr = 0; sr.pptr < sr.pool.length; ++sr.pptr)
|
||
sr.poolCopyOnInit[sr.pptr] = sr.pool[sr.pptr];
|
||
sr.pptr = 0;
|
||
}
|
||
// TODO: allow reseeding after first request
|
||
return sr.state.next();
|
||
}
|
||
|
||
// Mix in a 32-bit integer into the pool
|
||
sr.seedInt = function (x) {
|
||
sr.seedInt8(x);
|
||
sr.seedInt8((x >> 8));
|
||
sr.seedInt8((x >> 16));
|
||
sr.seedInt8((x >> 24));
|
||
}
|
||
|
||
// Mix in a 16-bit integer into the pool
|
||
sr.seedInt16 = function (x) {
|
||
sr.seedInt8(x);
|
||
sr.seedInt8((x >> 8));
|
||
}
|
||
|
||
// Mix in a 8-bit integer into the pool
|
||
sr.seedInt8 = function (x) {
|
||
sr.pool[sr.pptr++] ^= x & 255;
|
||
if (sr.pptr >= sr.poolSize) sr.pptr -= sr.poolSize;
|
||
}
|
||
|
||
// Arcfour is a PRNG
|
||
sr.ArcFour = function () {
|
||
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 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;
|
||
|
||
return new Arcfour();
|
||
};
|
||
|
||
|
||
// Initialize the pool with junk if needed.
|
||
if (sr.pool == null) {
|
||
sr.pool = new Array();
|
||
sr.pptr = 0;
|
||
var t;
|
||
if (window.crypto && window.crypto.getRandomValues && window.Uint8Array) {
|
||
try {
|
||
// Use webcrypto if available
|
||
var ua = new Uint8Array(sr.poolSize);
|
||
window.crypto.getRandomValues(ua);
|
||
for (t = 0; t < sr.poolSize; ++t)
|
||
sr.pool[sr.pptr++] = ua[t];
|
||
} catch (e) { alert(e); }
|
||
}
|
||
while (sr.pptr < sr.poolSize) { // extract some randomness from Math.random()
|
||
t = Math.floor(65536 * Math.random());
|
||
sr.pool[sr.pptr++] = t >>> 8;
|
||
sr.pool[sr.pptr++] = t & 255;
|
||
}
|
||
sr.pptr = Math.floor(sr.poolSize * Math.random());
|
||
sr.seedTime();
|
||
// entropy
|
||
var entropyStr = "";
|
||
// screen size and color depth: ~4.8 to ~5.4 bits
|
||
entropyStr += (window.screen.height * window.screen.width * window.screen.colorDepth);
|
||
entropyStr += (window.screen.availHeight * window.screen.availWidth * window.screen.pixelDepth);
|
||
// time zone offset: ~4 bits
|
||
var dateObj = new Date();
|
||
var timeZoneOffset = dateObj.getTimezoneOffset();
|
||
entropyStr += timeZoneOffset;
|
||
// user agent: ~8.3 to ~11.6 bits
|
||
entropyStr += navigator.userAgent;
|
||
// browser plugin details: ~16.2 to ~21.8 bits
|
||
var pluginsStr = "";
|
||
for (var i = 0; i < navigator.plugins.length; i++) {
|
||
pluginsStr += navigator.plugins[i].name + " " + navigator.plugins[i].filename + " " + navigator.plugins[i].description + " " + navigator.plugins[i].version + ", ";
|
||
}
|
||
var mimeTypesStr = "";
|
||
for (var i = 0; i < navigator.mimeTypes.length; i++) {
|
||
mimeTypesStr += navigator.mimeTypes[i].description + " " + navigator.mimeTypes[i].type + " " + navigator.mimeTypes[i].suffixes + ", ";
|
||
}
|
||
entropyStr += pluginsStr + mimeTypesStr;
|
||
// cookies and storage: 1 bit
|
||
entropyStr += navigator.cookieEnabled + typeof (sessionStorage) + typeof (localStorage);
|
||
// language: ~7 bit
|
||
entropyStr += navigator.language;
|
||
// history: ~2 bit
|
||
entropyStr += window.history.length;
|
||
// location
|
||
entropyStr += window.location;
|
||
|
||
var entropyBytes = Crypto.SHA256(entropyStr, { asBytes: true });
|
||
for (var i = 0 ; i < entropyBytes.length ; i++) {
|
||
sr.seedInt8(entropyBytes[i]);
|
||
}
|
||
}
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
//https://raw.github.com/bitcoinjs/bitcoinjs-lib/faa10f0f6a1fff0b9a99fffb9bc30cee33b17212/src/ecdsa.js
|
||
/*!
|
||
* Basic Javascript Elliptic Curve implementation
|
||
* Ported loosely from BouncyCastle's Java EC code
|
||
* Only Fp curves implemented for now
|
||
*
|
||
* Copyright Tom Wu, bitaddress.org BSD License.
|
||
* http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE
|
||
*/
|
||
(function () {
|
||
|
||
// Constructor function of Global EllipticCurve object
|
||
var ec = window.EllipticCurve = function () { };
|
||
|
||
|
||
// ----------------
|
||
// ECFieldElementFp constructor
|
||
// q instanceof BigInteger
|
||
// x instanceof BigInteger
|
||
ec.FieldElementFp = function (q, x) {
|
||
this.x = x;
|
||
// TODO if(x.compareTo(q) >= 0) error
|
||
this.q = q;
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.equals = function (other) {
|
||
if (other == this) return true;
|
||
return (this.q.equals(other.q) && this.x.equals(other.x));
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.toBigInteger = function () {
|
||
return this.x;
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.negate = function () {
|
||
return new ec.FieldElementFp(this.q, this.x.negate().mod(this.q));
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.add = function (b) {
|
||
return new ec.FieldElementFp(this.q, this.x.add(b.toBigInteger()).mod(this.q));
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.subtract = function (b) {
|
||
return new ec.FieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q));
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.multiply = function (b) {
|
||
return new ec.FieldElementFp(this.q, this.x.multiply(b.toBigInteger()).mod(this.q));
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.square = function () {
|
||
return new ec.FieldElementFp(this.q, this.x.square().mod(this.q));
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.divide = function (b) {
|
||
return new ec.FieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q));
|
||
};
|
||
|
||
ec.FieldElementFp.prototype.getByteLength = function () {
|
||
return Math.floor((this.toBigInteger().bitLength() + 7) / 8);
|
||
};
|
||
|
||
// D.1.4 91
|
||
/**
|
||
* return a sqrt root - the routine verifies that the calculation
|
||
* returns the right value - if none exists it returns null.
|
||
*
|
||
* Copyright (c) 2000 - 2011 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
||
* Ported to JavaScript by bitaddress.org
|
||
*/
|
||
ec.FieldElementFp.prototype.sqrt = function () {
|
||
if (!this.q.testBit(0)) throw new Error("even value of q");
|
||
|
||
// p mod 4 == 3
|
||
if (this.q.testBit(1)) {
|
||
// z = g^(u+1) + p, p = 4u + 3
|
||
var z = new ec.FieldElementFp(this.q, this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE), this.q));
|
||
return z.square().equals(this) ? z : null;
|
||
}
|
||
|
||
// p mod 4 == 1
|
||
var qMinusOne = this.q.subtract(BigInteger.ONE);
|
||
var legendreExponent = qMinusOne.shiftRight(1);
|
||
if (!(this.x.modPow(legendreExponent, this.q).equals(BigInteger.ONE))) return null;
|
||
var u = qMinusOne.shiftRight(2);
|
||
var k = u.shiftLeft(1).add(BigInteger.ONE);
|
||
var Q = this.x;
|
||
var fourQ = Q.shiftLeft(2).mod(this.q);
|
||
var U, V;
|
||
|
||
do {
|
||
var rand = new SecureRandom();
|
||
var P;
|
||
do {
|
||
P = new BigInteger(this.q.bitLength(), rand);
|
||
}
|
||
while (P.compareTo(this.q) >= 0 || !(P.multiply(P).subtract(fourQ).modPow(legendreExponent, this.q).equals(qMinusOne)));
|
||
|
||
var result = ec.FieldElementFp.fastLucasSequence(this.q, P, Q, k);
|
||
|
||
U = result[0];
|
||
V = result[1];
|
||
if (V.multiply(V).mod(this.q).equals(fourQ)) {
|
||
// Integer division by 2, mod q
|
||
if (V.testBit(0)) {
|
||
V = V.add(this.q);
|
||
}
|
||
V = V.shiftRight(1);
|
||
return new ec.FieldElementFp(this.q, V);
|
||
}
|
||
}
|
||
while (U.equals(BigInteger.ONE) || U.equals(qMinusOne));
|
||
|
||
return null;
|
||
};
|
||
|
||
/*
|
||
* Copyright (c) 2000 - 2011 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
||
* Ported to JavaScript by bitaddress.org
|
||
*/
|
||
ec.FieldElementFp.fastLucasSequence = function (p, P, Q, k) {
|
||
// TODO Research and apply "common-multiplicand multiplication here"
|
||
|
||
var n = k.bitLength();
|
||
var s = k.getLowestSetBit();
|
||
var Uh = BigInteger.ONE;
|
||
var Vl = BigInteger.TWO;
|
||
var Vh = P;
|
||
var Ql = BigInteger.ONE;
|
||
var Qh = BigInteger.ONE;
|
||
|
||
for (var j = n - 1; j >= s + 1; --j) {
|
||
Ql = Ql.multiply(Qh).mod(p);
|
||
if (k.testBit(j)) {
|
||
Qh = Ql.multiply(Q).mod(p);
|
||
Uh = Uh.multiply(Vh).mod(p);
|
||
Vl = Vh.multiply(Vl).subtract(P.multiply(Ql)).mod(p);
|
||
Vh = Vh.multiply(Vh).subtract(Qh.shiftLeft(1)).mod(p);
|
||
}
|
||
else {
|
||
Qh = Ql;
|
||
Uh = Uh.multiply(Vl).subtract(Ql).mod(p);
|
||
Vh = Vh.multiply(Vl).subtract(P.multiply(Ql)).mod(p);
|
||
Vl = Vl.multiply(Vl).subtract(Ql.shiftLeft(1)).mod(p);
|
||
}
|
||
}
|
||
|
||
Ql = Ql.multiply(Qh).mod(p);
|
||
Qh = Ql.multiply(Q).mod(p);
|
||
Uh = Uh.multiply(Vl).subtract(Ql).mod(p);
|
||
Vl = Vh.multiply(Vl).subtract(P.multiply(Ql)).mod(p);
|
||
Ql = Ql.multiply(Qh).mod(p);
|
||
|
||
for (var j = 1; j <= s; ++j) {
|
||
Uh = Uh.multiply(Vl).mod(p);
|
||
Vl = Vl.multiply(Vl).subtract(Ql.shiftLeft(1)).mod(p);
|
||
Ql = Ql.multiply(Ql).mod(p);
|
||
}
|
||
|
||
return [Uh, Vl];
|
||
};
|
||
|
||
// ----------------
|
||
// ECPointFp constructor
|
||
ec.PointFp = function (curve, x, y, z, compressed) {
|
||
this.curve = curve;
|
||
this.x = x;
|
||
this.y = y;
|
||
// Projective coordinates: either zinv == null or z * zinv == 1
|
||
// z and zinv are just BigIntegers, not fieldElements
|
||
if (z == null) {
|
||
this.z = BigInteger.ONE;
|
||
}
|
||
else {
|
||
this.z = z;
|
||
}
|
||
this.zinv = null;
|
||
// compression flag
|
||
this.compressed = !!compressed;
|
||
};
|
||
|
||
ec.PointFp.prototype.getX = function () {
|
||
if (this.zinv == null) {
|
||
this.zinv = this.z.modInverse(this.curve.q);
|
||
}
|
||
var r = this.x.toBigInteger().multiply(this.zinv);
|
||
this.curve.reduce(r);
|
||
return this.curve.fromBigInteger(r);
|
||
};
|
||
|
||
ec.PointFp.prototype.getY = function () {
|
||
if (this.zinv == null) {
|
||
this.zinv = this.z.modInverse(this.curve.q);
|
||
}
|
||
var r = this.y.toBigInteger().multiply(this.zinv);
|
||
this.curve.reduce(r);
|
||
return this.curve.fromBigInteger(r);
|
||
};
|
||
|
||
ec.PointFp.prototype.equals = function (other) {
|
||
if (other == this) return true;
|
||
if (this.isInfinity()) return other.isInfinity();
|
||
if (other.isInfinity()) return this.isInfinity();
|
||
var u, v;
|
||
// u = Y2 * Z1 - Y1 * Z2
|
||
u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q);
|
||
if (!u.equals(BigInteger.ZERO)) return false;
|
||
// v = X2 * Z1 - X1 * Z2
|
||
v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q);
|
||
return v.equals(BigInteger.ZERO);
|
||
};
|
||
|
||
ec.PointFp.prototype.isInfinity = function () {
|
||
if ((this.x == null) && (this.y == null)) return true;
|
||
return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO);
|
||
};
|
||
|
||
ec.PointFp.prototype.negate = function () {
|
||
return new ec.PointFp(this.curve, this.x, this.y.negate(), this.z);
|
||
};
|
||
|
||
ec.PointFp.prototype.add = function (b) {
|
||
if (this.isInfinity()) return b;
|
||
if (b.isInfinity()) return this;
|
||
|
||
// u = Y2 * Z1 - Y1 * Z2
|
||
var u = b.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(b.z)).mod(this.curve.q);
|
||
// v = X2 * Z1 - X1 * Z2
|
||
var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q);
|
||
|
||
|
||
if (BigInteger.ZERO.equals(v)) {
|
||
if (BigInteger.ZERO.equals(u)) {
|
||
return this.twice(); // this == b, so double
|
||
}
|
||
return this.curve.getInfinity(); // this = -b, so infinity
|
||
}
|
||
|
||
var THREE = new BigInteger("3");
|
||
var x1 = this.x.toBigInteger();
|
||
var y1 = this.y.toBigInteger();
|
||
var x2 = b.x.toBigInteger();
|
||
var y2 = b.y.toBigInteger();
|
||
|
||
var v2 = v.square();
|
||
var v3 = v2.multiply(v);
|
||
var x1v2 = x1.multiply(v2);
|
||
var zu2 = u.square().multiply(this.z);
|
||
|
||
// x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
|
||
var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q);
|
||
// y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
|
||
var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.q);
|
||
// z3 = v^3 * z1 * z2
|
||
var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q);
|
||
|
||
return new ec.PointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
|
||
};
|
||
|
||
ec.PointFp.prototype.twice = function () {
|
||
if (this.isInfinity()) return this;
|
||
if (this.y.toBigInteger().signum() == 0) return this.curve.getInfinity();
|
||
|
||
// TODO: optimized handling of constants
|
||
var THREE = new BigInteger("3");
|
||
var x1 = this.x.toBigInteger();
|
||
var y1 = this.y.toBigInteger();
|
||
|
||
var y1z1 = y1.multiply(this.z);
|
||
var y1sqz1 = y1z1.multiply(y1).mod(this.curve.q);
|
||
var a = this.curve.a.toBigInteger();
|
||
|
||
// w = 3 * x1^2 + a * z1^2
|
||
var w = x1.square().multiply(THREE);
|
||
if (!BigInteger.ZERO.equals(a)) {
|
||
w = w.add(this.z.square().multiply(a));
|
||
}
|
||
w = w.mod(this.curve.q);
|
||
//this.curve.reduce(w);
|
||
// x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
|
||
var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.q);
|
||
// y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
|
||
var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.square().multiply(w)).mod(this.curve.q);
|
||
// z3 = 8 * (y1 * z1)^3
|
||
var z3 = y1z1.square().multiply(y1z1).shiftLeft(3).mod(this.curve.q);
|
||
|
||
return new ec.PointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3);
|
||
};
|
||
|
||
// Simple NAF (Non-Adjacent Form) multiplication algorithm
|
||
// TODO: modularize the multiplication algorithm
|
||
ec.PointFp.prototype.multiply = function (k) {
|
||
if (this.isInfinity()) return this;
|
||
if (k.signum() == 0) return this.curve.getInfinity();
|
||
|
||
var e = k;
|
||
var h = e.multiply(new BigInteger("3"));
|
||
|
||
var neg = this.negate();
|
||
var R = this;
|
||
|
||
var i;
|
||
for (i = h.bitLength() - 2; i > 0; --i) {
|
||
R = R.twice();
|
||
|
||
var hBit = h.testBit(i);
|
||
var eBit = e.testBit(i);
|
||
|
||
if (hBit != eBit) {
|
||
R = R.add(hBit ? this : neg);
|
||
}
|
||
}
|
||
|
||
return R;
|
||
};
|
||
|
||
// Compute this*j + x*k (simultaneous multiplication)
|
||
ec.PointFp.prototype.multiplyTwo = function (j, x, k) {
|
||
var i;
|
||
if (j.bitLength() > k.bitLength())
|
||
i = j.bitLength() - 1;
|
||
else
|
||
i = k.bitLength() - 1;
|
||
|
||
var R = this.curve.getInfinity();
|
||
var both = this.add(x);
|
||
while (i >= 0) {
|
||
R = R.twice();
|
||
if (j.testBit(i)) {
|
||
if (k.testBit(i)) {
|
||
R = R.add(both);
|
||
}
|
||
else {
|
||
R = R.add(this);
|
||
}
|
||
}
|
||
else {
|
||
if (k.testBit(i)) {
|
||
R = R.add(x);
|
||
}
|
||
}
|
||
--i;
|
||
}
|
||
|
||
return R;
|
||
};
|
||
|
||
// patched by bitaddress.org and Casascius for use with Bitcoin.ECKey
|
||
// patched by coretechs to support compressed public keys
|
||
ec.PointFp.prototype.getEncoded = function (compressed) {
|
||
var x = this.getX().toBigInteger();
|
||
var y = this.getY().toBigInteger();
|
||
var len = 32; // integerToBytes will zero pad if integer is less than 32 bytes. 32 bytes length is required by the Bitcoin protocol.
|
||
var enc = ec.integerToBytes(x, len);
|
||
|
||
// when compressed prepend byte depending if y point is even or odd
|
||
if (compressed) {
|
||
if (y.isEven()) {
|
||
enc.unshift(0x02);
|
||
}
|
||
else {
|
||
enc.unshift(0x03);
|
||
}
|
||
}
|
||
else {
|
||
enc.unshift(0x04);
|
||
enc = enc.concat(ec.integerToBytes(y, len)); // uncompressed public key appends the bytes of the y point
|
||
}
|
||
return enc;
|
||
};
|
||
|
||
ec.PointFp.decodeFrom = function (curve, enc) {
|
||
var type = enc[0];
|
||
var dataLen = enc.length - 1;
|
||
|
||
// Extract x and y as byte arrays
|
||
var xBa = enc.slice(1, 1 + dataLen / 2);
|
||
var yBa = enc.slice(1 + dataLen / 2, 1 + dataLen);
|
||
|
||
// Prepend zero byte to prevent interpretation as negative integer
|
||
xBa.unshift(0);
|
||
yBa.unshift(0);
|
||
|
||
// Convert to BigIntegers
|
||
var x = new BigInteger(xBa);
|
||
var y = new BigInteger(yBa);
|
||
|
||
// Return point
|
||
return new ec.PointFp(curve, curve.fromBigInteger(x), curve.fromBigInteger(y));
|
||
};
|
||
|
||
ec.PointFp.prototype.add2D = function (b) {
|
||
if (this.isInfinity()) return b;
|
||
if (b.isInfinity()) return this;
|
||
|
||
if (this.x.equals(b.x)) {
|
||
if (this.y.equals(b.y)) {
|
||
// this = b, i.e. this must be doubled
|
||
return this.twice();
|
||
}
|
||
// this = -b, i.e. the result is the point at infinity
|
||
return this.curve.getInfinity();
|
||
}
|
||
|
||
var x_x = b.x.subtract(this.x);
|
||
var y_y = b.y.subtract(this.y);
|
||
var gamma = y_y.divide(x_x);
|
||
|
||
var x3 = gamma.square().subtract(this.x).subtract(b.x);
|
||
var y3 = gamma.multiply(this.x.subtract(x3)).subtract(this.y);
|
||
|
||
return new ec.PointFp(this.curve, x3, y3);
|
||
};
|
||
|
||
ec.PointFp.prototype.twice2D = function () {
|
||
if (this.isInfinity()) return this;
|
||
if (this.y.toBigInteger().signum() == 0) {
|
||
// if y1 == 0, then (x1, y1) == (x1, -y1)
|
||
// and hence this = -this and thus 2(x1, y1) == infinity
|
||
return this.curve.getInfinity();
|
||
}
|
||
|
||
var TWO = this.curve.fromBigInteger(BigInteger.valueOf(2));
|
||
var THREE = this.curve.fromBigInteger(BigInteger.valueOf(3));
|
||
var gamma = this.x.square().multiply(THREE).add(this.curve.a).divide(this.y.multiply(TWO));
|
||
|
||
var x3 = gamma.square().subtract(this.x.multiply(TWO));
|
||
var y3 = gamma.multiply(this.x.subtract(x3)).subtract(this.y);
|
||
|
||
return new ec.PointFp(this.curve, x3, y3);
|
||
};
|
||
|
||
ec.PointFp.prototype.multiply2D = function (k) {
|
||
if (this.isInfinity()) return this;
|
||
if (k.signum() == 0) return this.curve.getInfinity();
|
||
|
||
var e = k;
|
||
var h = e.multiply(new BigInteger("3"));
|
||
|
||
var neg = this.negate();
|
||
var R = this;
|
||
|
||
var i;
|
||
for (i = h.bitLength() - 2; i > 0; --i) {
|
||
R = R.twice();
|
||
|
||
var hBit = h.testBit(i);
|
||
var eBit = e.testBit(i);
|
||
|
||
if (hBit != eBit) {
|
||
R = R.add2D(hBit ? this : neg);
|
||
}
|
||
}
|
||
|
||
return R;
|
||
};
|
||
|
||
ec.PointFp.prototype.isOnCurve = function () {
|
||
var x = this.getX().toBigInteger();
|
||
var y = this.getY().toBigInteger();
|
||
var a = this.curve.getA().toBigInteger();
|
||
var b = this.curve.getB().toBigInteger();
|
||
var n = this.curve.getQ();
|
||
var lhs = y.multiply(y).mod(n);
|
||
var rhs = x.multiply(x).multiply(x).add(a.multiply(x)).add(b).mod(n);
|
||
return lhs.equals(rhs);
|
||
};
|
||
|
||
ec.PointFp.prototype.toString = function () {
|
||
return '(' + this.getX().toBigInteger().toString() + ',' + this.getY().toBigInteger().toString() + ')';
|
||
};
|
||
|
||
/**
|
||
* Validate an elliptic curve point.
|
||
*
|
||
* See SEC 1, section 3.2.2.1: Elliptic Curve Public Key Validation Primitive
|
||
*/
|
||
ec.PointFp.prototype.validate = function () {
|
||
var n = this.curve.getQ();
|
||
|
||
// Check Q != O
|
||
if (this.isInfinity()) {
|
||
throw new Error("Point is at infinity.");
|
||
}
|
||
|
||
// Check coordinate bounds
|
||
var x = this.getX().toBigInteger();
|
||
var y = this.getY().toBigInteger();
|
||
if (x.compareTo(BigInteger.ONE) < 0 || x.compareTo(n.subtract(BigInteger.ONE)) > 0) {
|
||
throw new Error('x coordinate out of bounds');
|
||
}
|
||
if (y.compareTo(BigInteger.ONE) < 0 || y.compareTo(n.subtract(BigInteger.ONE)) > 0) {
|
||
throw new Error('y coordinate out of bounds');
|
||
}
|
||
|
||
// Check y^2 = x^3 + ax + b (mod n)
|
||
if (!this.isOnCurve()) {
|
||
throw new Error("Point is not on the curve.");
|
||
}
|
||
|
||
// Check nQ = 0 (Q is a scalar multiple of G)
|
||
if (this.multiply(n).isInfinity()) {
|
||
// TODO: This check doesn't work - fix.
|
||
throw new Error("Point is not a scalar multiple of G.");
|
||
}
|
||
|
||
return true;
|
||
};
|
||
|
||
|
||
|
||
|
||
// ----------------
|
||
// ECCurveFp constructor
|
||
ec.CurveFp = function (q, a, b) {
|
||
this.q = q;
|
||
this.a = this.fromBigInteger(a);
|
||
this.b = this.fromBigInteger(b);
|
||
this.infinity = new ec.PointFp(this, null, null);
|
||
this.reducer = new Barrett(this.q);
|
||
}
|
||
|
||
ec.CurveFp.prototype.getQ = function () {
|
||
return this.q;
|
||
};
|
||
|
||
ec.CurveFp.prototype.getA = function () {
|
||
return this.a;
|
||
};
|
||
|
||
ec.CurveFp.prototype.getB = function () {
|
||
return this.b;
|
||
};
|
||
|
||
ec.CurveFp.prototype.equals = function (other) {
|
||
if (other == this) return true;
|
||
return (this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b));
|
||
};
|
||
|
||
ec.CurveFp.prototype.getInfinity = function () {
|
||
return this.infinity;
|
||
};
|
||
|
||
ec.CurveFp.prototype.fromBigInteger = function (x) {
|
||
return new ec.FieldElementFp(this.q, x);
|
||
};
|
||
|
||
ec.CurveFp.prototype.reduce = function (x) {
|
||
this.reducer.reduce(x);
|
||
};
|
||
|
||
// for now, work with hex strings because they're easier in JS
|
||
// compressed support added by bitaddress.org
|
||
ec.CurveFp.prototype.decodePointHex = function (s) {
|
||
var firstByte = parseInt(s.substr(0, 2), 16);
|
||
switch (firstByte) { // first byte
|
||
case 0:
|
||
return this.infinity;
|
||
case 2: // compressed
|
||
case 3: // compressed
|
||
var yTilde = firstByte & 1;
|
||
var xHex = s.substr(2, s.length - 2);
|
||
var X1 = new BigInteger(xHex, 16);
|
||
return this.decompressPoint(yTilde, X1);
|
||
case 4: // uncompressed
|
||
case 6: // hybrid
|
||
case 7: // hybrid
|
||
var len = (s.length - 2) / 2;
|
||
var xHex = s.substr(2, len);
|
||
var yHex = s.substr(len + 2, len);
|
||
|
||
return new ec.PointFp(this,
|
||
this.fromBigInteger(new BigInteger(xHex, 16)),
|
||
this.fromBigInteger(new BigInteger(yHex, 16)));
|
||
|
||
default: // unsupported
|
||
return null;
|
||
}
|
||
};
|
||
|
||
ec.CurveFp.prototype.encodePointHex = function (p) {
|
||
if (p.isInfinity()) return "00";
|
||
var xHex = p.getX().toBigInteger().toString(16);
|
||
var yHex = p.getY().toBigInteger().toString(16);
|
||
var oLen = this.getQ().toString(16).length;
|
||
if ((oLen % 2) != 0) oLen++;
|
||
while (xHex.length < oLen) {
|
||
xHex = "0" + xHex;
|
||
}
|
||
while (yHex.length < oLen) {
|
||
yHex = "0" + yHex;
|
||
}
|
||
return "04" + xHex + yHex;
|
||
};
|
||
|
||
/*
|
||
* Copyright (c) 2000 - 2011 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
||
* Ported to JavaScript by bitaddress.org
|
||
*
|
||
* Number yTilde
|
||
* BigInteger X1
|
||
*/
|
||
ec.CurveFp.prototype.decompressPoint = function (yTilde, X1) {
|
||
var x = this.fromBigInteger(X1);
|
||
var alpha = x.multiply(x.square().add(this.getA())).add(this.getB());
|
||
var beta = alpha.sqrt();
|
||
// if we can't find a sqrt we haven't got a point on the curve - run!
|
||
if (beta == null) throw new Error("Invalid point compression");
|
||
var betaValue = beta.toBigInteger();
|
||
var bit0 = betaValue.testBit(0) ? 1 : 0;
|
||
if (bit0 != yTilde) {
|
||
// Use the other root
|
||
beta = this.fromBigInteger(this.getQ().subtract(betaValue));
|
||
}
|
||
return new ec.PointFp(this, x, beta, null, true);
|
||
};
|
||
|
||
|
||
ec.fromHex = function (s) { return new BigInteger(s, 16); };
|
||
|
||
ec.integerToBytes = function (i, len) {
|
||
var bytes = i.toByteArrayUnsigned();
|
||
if (len < bytes.length) {
|
||
bytes = bytes.slice(bytes.length - len);
|
||
} else while (len > bytes.length) {
|
||
bytes.unshift(0);
|
||
}
|
||
return bytes;
|
||
};
|
||
|
||
|
||
// Named EC curves
|
||
// ----------------
|
||
// X9ECParameters constructor
|
||
ec.X9Parameters = function (curve, g, n, h) {
|
||
this.curve = curve;
|
||
this.g = g;
|
||
this.n = n;
|
||
this.h = h;
|
||
}
|
||
ec.X9Parameters.prototype.getCurve = function () { return this.curve; };
|
||
ec.X9Parameters.prototype.getG = function () { return this.g; };
|
||
ec.X9Parameters.prototype.getN = function () { return this.n; };
|
||
ec.X9Parameters.prototype.getH = function () { return this.h; };
|
||
|
||
// secp256k1 is the Curve used by Bitcoin
|
||
ec.secNamedCurves = {
|
||
// used by Bitcoin
|
||
"secp256k1": function () {
|
||
// p = 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
|
||
var p = ec.fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F");
|
||
var a = BigInteger.ZERO;
|
||
var b = ec.fromHex("7");
|
||
var n = ec.fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141");
|
||
var h = BigInteger.ONE;
|
||
var curve = new ec.CurveFp(p, a, b);
|
||
var G = curve.decodePointHex("04"
|
||
+ "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798"
|
||
+ "483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8");
|
||
return new ec.X9Parameters(curve, G, n, h);
|
||
}
|
||
};
|
||
|
||
// secp256k1 called by Bitcoin's ECKEY
|
||
ec.getSECCurveByName = function (name) {
|
||
if (ec.secNamedCurves[name] == undefined) return null;
|
||
return ec.secNamedCurves[name]();
|
||
}
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
// secrets.js - by Alexander Stetsyuk - released under MIT License
|
||
(function(exports, global){
|
||
var defaults = {
|
||
bits: 8, // default number of bits
|
||
radix: 16, // work with HEX by default
|
||
minBits: 3,
|
||
maxBits: 20, // this permits 1,048,575 shares, though going this high is NOT recommended in JS!
|
||
|
||
bytesPerChar: 2,
|
||
maxBytesPerChar: 6, // Math.pow(256,7) > Math.pow(2,53)
|
||
|
||
// Primitive polynomials (in decimal form) for Galois Fields GF(2^n), for 2 <= n <= 30
|
||
// The index of each term in the array corresponds to the n for that polynomial
|
||
// i.e. to get the polynomial for n=16, use primitivePolynomials[16]
|
||
primitivePolynomials: [null,null,1,3,3,5,3,3,29,17,9,5,83,27,43,3,45,9,39,39,9,5,3,33,27,9,71,39,9,5,83],
|
||
|
||
// warning for insecure PRNG
|
||
warning: 'WARNING:\nA secure random number generator was not found.\nUsing Math.random(), which is NOT cryptographically strong!'
|
||
};
|
||
|
||
// Protected settings object
|
||
var config = {};
|
||
|
||
/** @expose **/
|
||
exports.getConfig = function(){
|
||
return {
|
||
'bits': config.bits,
|
||
'unsafePRNG': config.unsafePRNG
|
||
};
|
||
};
|
||
|
||
function init(bits){
|
||
if(bits && (typeof bits !== 'number' || bits%1 !== 0 || bits<defaults.minBits || bits>defaults.maxBits)){
|
||
throw new Error('Number of bits must be an integer between ' + defaults.minBits + ' and ' + defaults.maxBits + ', inclusive.')
|
||
}
|
||
|
||
config.radix = defaults.radix;
|
||
config.bits = bits || defaults.bits;
|
||
config.size = Math.pow(2, config.bits);
|
||
config.max = config.size - 1;
|
||
|
||
// Construct the exp and log tables for multiplication.
|
||
var logs = [], exps = [], x = 1, primitive = defaults.primitivePolynomials[config.bits];
|
||
for(var i=0; i<config.size; i++){
|
||
exps[i] = x;
|
||
logs[x] = i;
|
||
x <<= 1;
|
||
if(x >= config.size){
|
||
x ^= primitive;
|
||
x &= config.max;
|
||
}
|
||
}
|
||
|
||
config.logs = logs;
|
||
config.exps = exps;
|
||
};
|
||
|
||
/** @expose **/
|
||
exports.init = init;
|
||
|
||
function isInited(){
|
||
if(!config.bits || !config.size || !config.max || !config.logs || !config.exps || config.logs.length !== config.size || config.exps.length !== config.size){
|
||
return false;
|
||
}
|
||
return true;
|
||
};
|
||
|
||
// Returns a pseudo-random number generator of the form function(bits){}
|
||
// which should output a random string of 1's and 0's of length `bits`
|
||
function getRNG(){
|
||
var randomBits, crypto;
|
||
|
||
function construct(bits, arr, radix, size){
|
||
var str = '',
|
||
i = 0,
|
||
len = arr.length-1;
|
||
while( i<len || (str.length < bits) ){
|
||
str += padLeft(parseInt(arr[i], radix).toString(2), size);
|
||
i++;
|
||
}
|
||
str = str.substr(-bits);
|
||
if( (str.match(/0/g)||[]).length === str.length){ // all zeros?
|
||
return null;
|
||
}else{
|
||
return str;
|
||
}
|
||
}
|
||
|
||
// node.js crypto.randomBytes()
|
||
if(typeof require === 'function' && (crypto=require('crypto')) && (randomBits=crypto['randomBytes'])){
|
||
return function(bits){
|
||
var bytes = Math.ceil(bits/8),
|
||
str = null;
|
||
|
||
while( str === null ){
|
||
str = construct(bits, randomBits(bytes).toString('hex'), 16, 4);
|
||
}
|
||
return str;
|
||
}
|
||
}
|
||
|
||
// browsers with window.crypto.getRandomValues()
|
||
if(global['crypto'] && typeof global['crypto']['getRandomValues'] === 'function' && typeof global['Uint32Array'] === 'function'){
|
||
crypto = global['crypto'];
|
||
return function(bits){
|
||
var elems = Math.ceil(bits/32),
|
||
str = null,
|
||
arr = new global['Uint32Array'](elems);
|
||
|
||
while( str === null ){
|
||
crypto['getRandomValues'](arr);
|
||
str = construct(bits, arr, 10, 32);
|
||
}
|
||
|
||
return str;
|
||
}
|
||
}
|
||
|
||
// A totally insecure RNG!!! (except in Safari)
|
||
// Will produce a warning every time it is called.
|
||
config.unsafePRNG = true;
|
||
warn();
|
||
|
||
var bitsPerNum = 32;
|
||
var max = Math.pow(2,bitsPerNum)-1;
|
||
return function(bits){
|
||
var elems = Math.ceil(bits/bitsPerNum);
|
||
var arr = [], str=null;
|
||
while(str===null){
|
||
for(var i=0; i<elems; i++){
|
||
arr[i] = Math.floor(Math.random() * max + 1);
|
||
}
|
||
str = construct(bits, arr, 10, bitsPerNum);
|
||
}
|
||
return str;
|
||
};
|
||
};
|
||
|
||
// Warn about using insecure rng.
|
||
// Called when Math.random() is being used.
|
||
function warn(){
|
||
global['console']['warn'](defaults.warning);
|
||
if(typeof global['alert'] === 'function' && config.alert){
|
||
global['alert'](defaults.warning);
|
||
}
|
||
}
|
||
|
||
// Set the PRNG to use. If no RNG function is supplied, pick a default using getRNG()
|
||
/** @expose **/
|
||
exports.setRNG = function(rng, alert){
|
||
if(!isInited()){
|
||
this.init();
|
||
}
|
||
config.unsafePRNG=false;
|
||
rng = rng || getRNG();
|
||
|
||
// test the RNG (5 times)
|
||
if(typeof rng !== 'function' || typeof rng(config.bits) !== 'string' || !parseInt(rng(config.bits),2) || rng(config.bits).length > config.bits || rng(config.bits).length < config.bits){
|
||
throw new Error("Random number generator is invalid. Supply an RNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's.")
|
||
}else{
|
||
config.rng = rng;
|
||
}
|
||
config.alert = !!alert;
|
||
|
||
return !!config.unsafePRNG;
|
||
};
|
||
|
||
function isSetRNG(){
|
||
return typeof config.rng === 'function';
|
||
};
|
||
|
||
// Generates a random bits-length number string using the PRNG
|
||
/** @expose **/
|
||
exports.random = function(bits){
|
||
if(!isSetRNG()){
|
||
this.setRNG();
|
||
}
|
||
|
||
if(typeof bits !== 'number' || bits%1 !== 0 || bits < 2){
|
||
throw new Error('Number of bits must be an integer greater than 1.')
|
||
}
|
||
|
||
if(config.unsafePRNG){
|
||
warn();
|
||
}
|
||
return bin2hex(config.rng(bits));
|
||
}
|
||
|
||
// Divides a `secret` number String str expressed in radix `inputRadix` (optional, default 16)
|
||
// into `numShares` shares, each expressed in radix `outputRadix` (optional, default to `inputRadix`),
|
||
// requiring `threshold` number of shares to reconstruct the secret.
|
||
// Optionally, zero-pads the secret to a length that is a multiple of padLength before sharing.
|
||
/** @expose **/
|
||
exports.share = function(secret, numShares, threshold, padLength, withoutPrefix){
|
||
if(!isInited()){
|
||
this.init();
|
||
}
|
||
if(!isSetRNG()){
|
||
this.setRNG();
|
||
}
|
||
|
||
padLength = padLength || 0;
|
||
|
||
if(typeof secret !== 'string'){
|
||
throw new Error('Secret must be a string.');
|
||
}
|
||
if(typeof numShares !== 'number' || numShares%1 !== 0 || numShares < 2){
|
||
throw new Error('Number of shares must be an integer between 2 and 2^bits-1 (' + config.max + '), inclusive.')
|
||
}
|
||
if(numShares > config.max){
|
||
var neededBits = Math.ceil(Math.log(numShares +1)/Math.LN2);
|
||
throw new Error('Number of shares must be an integer between 2 and 2^bits-1 (' + config.max + '), inclusive. To create ' + numShares + ' shares, use at least ' + neededBits + ' bits.')
|
||
}
|
||
if(typeof threshold !== 'number' || threshold%1 !== 0 || threshold < 2){
|
||
throw new Error('Threshold number of shares must be an integer between 2 and 2^bits-1 (' + config.max + '), inclusive.');
|
||
}
|
||
if(threshold > config.max){
|
||
var neededBits = Math.ceil(Math.log(threshold +1)/Math.LN2);
|
||
throw new Error('Threshold number of shares must be an integer between 2 and 2^bits-1 (' + config.max + '), inclusive. To use a threshold of ' + threshold + ', use at least ' + neededBits + ' bits.');
|
||
}
|
||
if(typeof padLength !== 'number' || padLength%1 !== 0 ){
|
||
throw new Error('Zero-pad length must be an integer greater than 1.');
|
||
}
|
||
|
||
if(config.unsafePRNG){
|
||
warn();
|
||
}
|
||
|
||
secret = '1' + hex2bin(secret); // append a 1 so that we can preserve the correct number of leading zeros in our secret
|
||
secret = split(secret, padLength);
|
||
var x = new Array(numShares), y = new Array(numShares);
|
||
for(var i=0, len = secret.length; i<len; i++){
|
||
var subShares = this._getShares(secret[i], numShares, threshold);
|
||
for(var j=0; j<numShares; j++){
|
||
x[j] = x[j] || subShares[j].x.toString(config.radix);
|
||
y[j] = padLeft(subShares[j].y.toString(2)) + (y[j] ? y[j] : '');
|
||
}
|
||
}
|
||
var padding = config.max.toString(config.radix).length;
|
||
if(withoutPrefix){
|
||
for(var i=0; i<numShares; i++){
|
||
x[i] = bin2hex(y[i]);
|
||
}
|
||
}else{
|
||
for(var i=0; i<numShares; i++){
|
||
x[i] = config.bits.toString(36).toUpperCase() + padLeft(x[i],padding) + bin2hex(y[i]);
|
||
}
|
||
}
|
||
|
||
return x;
|
||
};
|
||
|
||
// This is the basic polynomial generation and evaluation function
|
||
// for a `config.bits`-length secret (NOT an arbitrary length)
|
||
// Note: no error-checking at this stage! If `secrets` is NOT
|
||
// a NUMBER less than 2^bits-1, the output will be incorrect!
|
||
/** @expose **/
|
||
exports._getShares = function(secret, numShares, threshold){
|
||
var shares = [];
|
||
var coeffs = [secret];
|
||
|
||
for(var i=1; i<threshold; i++){
|
||
coeffs[i] = parseInt(config.rng(config.bits),2);
|
||
}
|
||
for(var i=1, len = numShares+1; i<len; i++){
|
||
shares[i-1] = {
|
||
x: i,
|
||
y: horner(i, coeffs)
|
||
}
|
||
}
|
||
return shares;
|
||
};
|
||
|
||
// Polynomial evaluation at `x` using Horner's Method
|
||
// TODO: this can possibly be sped up using other methods
|
||
// NOTE: fx=fx * x + coeff[i] -> exp(log(fx) + log(x)) + coeff[i],
|
||
// so if fx===0, just set fx to coeff[i] because
|
||
// using the exp/log form will result in incorrect value
|
||
function horner(x, coeffs){
|
||
var logx = config.logs[x];
|
||
var fx = 0;
|
||
for(var i=coeffs.length-1; i>=0; i--){
|
||
if(fx === 0){
|
||
fx = coeffs[i];
|
||
continue;
|
||
}
|
||
fx = config.exps[ (logx + config.logs[fx]) % config.max ] ^ coeffs[i];
|
||
}
|
||
return fx;
|
||
};
|
||
|
||
function inArray(arr,val){
|
||
for(var i = 0,len=arr.length; i < len; i++) {
|
||
if(arr[i] === val){
|
||
return true;
|
||
}
|
||
}
|
||
return false;
|
||
};
|
||
|
||
function processShare(share){
|
||
|
||
var bits = parseInt(share[0], 36);
|
||
if(bits && (typeof bits !== 'number' || bits%1 !== 0 || bits<defaults.minBits || bits>defaults.maxBits)){
|
||
throw new Error('Number of bits must be an integer between ' + defaults.minBits + ' and ' + defaults.maxBits + ', inclusive.')
|
||
}
|
||
|
||
var max = Math.pow(2, bits) - 1;
|
||
var idLength = max.toString(config.radix).length;
|
||
|
||
var id = parseInt(share.substr(1, idLength), config.radix);
|
||
if(typeof id !== 'number' || id%1 !== 0 || id<1 || id>max){
|
||
throw new Error('Share id must be an integer between 1 and ' + config.max + ', inclusive.');
|
||
}
|
||
share = share.substr(idLength + 1);
|
||
if(!share.length){
|
||
throw new Error('Invalid share: zero-length share.')
|
||
}
|
||
return {
|
||
'bits': bits,
|
||
'id': id,
|
||
'value': share
|
||
};
|
||
};
|
||
|
||
/** @expose **/
|
||
exports._processShare = processShare;
|
||
|
||
// Protected method that evaluates the Lagrange interpolation
|
||
// polynomial at x=`at` for individual config.bits-length
|
||
// segments of each share in the `shares` Array.
|
||
// Each share is expressed in base `inputRadix`. The output
|
||
// is expressed in base `outputRadix'
|
||
function combine(at, shares){
|
||
var setBits, share, x = [], y = [], result = '', idx;
|
||
|
||
for(var i=0, len = shares.length; i<len; i++){
|
||
share = processShare(shares[i]);
|
||
if(typeof setBits === 'undefined'){
|
||
setBits = share['bits'];
|
||
}else if(share['bits'] !== setBits){
|
||
throw new Error('Mismatched shares: Different bit settings.')
|
||
}
|
||
|
||
if(config.bits !== setBits){
|
||
init(setBits);
|
||
}
|
||
|
||
if(inArray(x, share['id'])){ // repeated x value?
|
||
continue;
|
||
}
|
||
|
||
idx = x.push(share['id']) - 1;
|
||
share = split(hex2bin(share['value']));
|
||
for(var j=0, len2 = share.length; j<len2; j++){
|
||
y[j] = y[j] || [];
|
||
y[j][idx] = share[j];
|
||
}
|
||
}
|
||
|
||
for(var i=0, len=y.length; i<len; i++){
|
||
result = padLeft(lagrange(at, x, y[i]).toString(2)) + result;
|
||
}
|
||
|
||
if(at===0){// reconstructing the secret
|
||
var idx = result.indexOf('1'); //find the first 1
|
||
return bin2hex(result.slice(idx+1));
|
||
}else{// generating a new share
|
||
return bin2hex(result);
|
||
}
|
||
};
|
||
|
||
// Combine `shares` Array into the original secret
|
||
/** @expose **/
|
||
exports.combine = function(shares){
|
||
return combine(0, shares);
|
||
};
|
||
|
||
// Generate a new share with id `id` (a number between 1 and 2^bits-1)
|
||
// `id` can be a Number or a String in the default radix (16)
|
||
/** @expose **/
|
||
exports.newShare = function(id, shares){
|
||
if(typeof id === 'string'){
|
||
id = parseInt(id, config.radix);
|
||
}
|
||
|
||
var share = processShare(shares[0]);
|
||
var max = Math.pow(2, share['bits']) - 1;
|
||
|
||
if(typeof id !== 'number' || id%1 !== 0 || id<1 || id>max){
|
||
throw new Error('Share id must be an integer between 1 and ' + config.max + ', inclusive.');
|
||
}
|
||
|
||
var padding = max.toString(config.radix).length;
|
||
return config.bits.toString(36).toUpperCase() + padLeft(id.toString(config.radix), padding) + combine(id, shares);
|
||
};
|
||
|
||
// Evaluate the Lagrange interpolation polynomial at x = `at`
|
||
// using x and y Arrays that are of the same length, with
|
||
// corresponding elements constituting points on the polynomial.
|
||
function lagrange(at, x, y){
|
||
var sum = 0,
|
||
product,
|
||
i, j;
|
||
|
||
for(var i=0, len = x.length; i<len; i++){
|
||
if(!y[i]){
|
||
continue;
|
||
}
|
||
|
||
product = config.logs[y[i]];
|
||
for(var j=0; j<len; j++){
|
||
if(i === j){ continue; }
|
||
if(at === x[j]){ // happens when computing a share that is in the list of shares used to compute it
|
||
product = -1; // fix for a zero product term, after which the sum should be sum^0 = sum, not sum^1
|
||
break;
|
||
}
|
||
product = ( product + config.logs[at ^ x[j]] - config.logs[x[i] ^ x[j]] + config.max/* to make sure it's not negative */ ) % config.max;
|
||
}
|
||
|
||
sum = product === -1 ? sum : sum ^ config.exps[product]; // though exps[-1]= undefined and undefined ^ anything = anything in chrome, this behavior may not hold everywhere, so do the check
|
||
}
|
||
return sum;
|
||
};
|
||
|
||
/** @expose **/
|
||
exports._lagrange = lagrange;
|
||
|
||
// Splits a number string `bits`-length segments, after first
|
||
// optionally zero-padding it to a length that is a multiple of `padLength.
|
||
// Returns array of integers (each less than 2^bits-1), with each element
|
||
// representing a `bits`-length segment of the input string from right to left,
|
||
// i.e. parts[0] represents the right-most `bits`-length segment of the input string.
|
||
function split(str, padLength){
|
||
if(padLength){
|
||
str = padLeft(str, padLength)
|
||
}
|
||
var parts = [];
|
||
for(var i=str.length; i>config.bits; i-=config.bits){
|
||
parts.push(parseInt(str.slice(i-config.bits, i), 2));
|
||
}
|
||
parts.push(parseInt(str.slice(0, i), 2));
|
||
return parts;
|
||
};
|
||
|
||
// Pads a string `str` with zeros on the left so that its length is a multiple of `bits`
|
||
function padLeft(str, bits){
|
||
bits = bits || config.bits
|
||
var missing = str.length % bits;
|
||
return (missing ? new Array(bits - missing + 1).join('0') : '') + str;
|
||
};
|
||
|
||
function hex2bin(str){
|
||
var bin = '', num;
|
||
for(var i=str.length - 1; i>=0; i--){
|
||
num = parseInt(str[i], 16)
|
||
if(isNaN(num)){
|
||
throw new Error('Invalid hex character.')
|
||
}
|
||
bin = padLeft(num.toString(2), 4) + bin;
|
||
}
|
||
return bin;
|
||
}
|
||
|
||
function bin2hex(str){
|
||
var hex = '', num;
|
||
str = padLeft(str, 4);
|
||
for(var i=str.length; i>=4; i-=4){
|
||
num = parseInt(str.slice(i-4, i), 2);
|
||
if(isNaN(num)){
|
||
throw new Error('Invalid binary character.')
|
||
}
|
||
hex = num.toString(16) + hex;
|
||
}
|
||
return hex;
|
||
}
|
||
|
||
// Converts a given UTF16 character string to the HEX representation.
|
||
// Each character of the input string is represented by
|
||
// `bytesPerChar` bytes in the output string.
|
||
/** @expose **/
|
||
exports.str2hex = function(str, bytesPerChar){
|
||
if(typeof str !== 'string'){
|
||
throw new Error('Input must be a character string.');
|
||
}
|
||
bytesPerChar = bytesPerChar || defaults.bytesPerChar;
|
||
|
||
if(typeof bytesPerChar !== 'number' || bytesPerChar%1 !== 0 || bytesPerChar<1 || bytesPerChar > defaults.maxBytesPerChar){
|
||
throw new Error('Bytes per character must be an integer between 1 and ' + defaults.maxBytesPerChar + ', inclusive.')
|
||
}
|
||
|
||
var hexChars = 2*bytesPerChar;
|
||
var max = Math.pow(16, hexChars) - 1;
|
||
var out = '', num;
|
||
for(var i=0, len=str.length; i<len; i++){
|
||
num = str[i].charCodeAt();
|
||
if(isNaN(num)){
|
||
throw new Error('Invalid character: ' + str[i]);
|
||
}else if(num > max){
|
||
var neededBytes = Math.ceil(Math.log(num+1)/Math.log(256));
|
||
throw new Error('Invalid character code (' + num +'). Maximum allowable is 256^bytes-1 (' + max + '). To convert this character, use at least ' + neededBytes + ' bytes.')
|
||
}else{
|
||
out = padLeft(num.toString(16), hexChars) + out;
|
||
}
|
||
}
|
||
return out;
|
||
};
|
||
|
||
// Converts a given HEX number string to a UTF16 character string.
|
||
/** @expose **/
|
||
exports.hex2str = function(str, bytesPerChar){
|
||
if(typeof str !== 'string'){
|
||
throw new Error('Input must be a hexadecimal string.');
|
||
}
|
||
bytesPerChar = bytesPerChar || defaults.bytesPerChar;
|
||
|
||
if(typeof bytesPerChar !== 'number' || bytesPerChar%1 !== 0 || bytesPerChar<1 || bytesPerChar > defaults.maxBytesPerChar){
|
||
throw new Error('Bytes per character must be an integer between 1 and ' + defaults.maxBytesPerChar + ', inclusive.')
|
||
}
|
||
|
||
var hexChars = 2*bytesPerChar;
|
||
var out = '';
|
||
str = padLeft(str, hexChars);
|
||
for(var i=0, len = str.length; i<len; i+=hexChars){
|
||
out = String.fromCharCode(parseInt(str.slice(i, i+hexChars),16)) + out;
|
||
}
|
||
return out;
|
||
};
|
||
|
||
// by default, initialize without an RNG
|
||
exports.init();
|
||
})(typeof module !== 'undefined' && module['exports'] ? module['exports'] : (window['secrets'] = {}), typeof GLOBAL !== 'undefined' ? GLOBAL : window );
|
||
</script>
|
||
<script type="text/javascript">
|
||
// Upstream 'BigInteger' here:
|
||
// Original Author: http://www-cs-students.stanford.edu/~tjw/jsbn/
|
||
// Follows 'jsbn' on Github: https://github.com/jasondavies/jsbn
|
||
// Review and Testing: https://github.com/cryptocoinjs/bigi/
|
||
/*!
|
||
* Basic JavaScript BN library - subset useful for RSA encryption. v1.4
|
||
*
|
||
* Copyright (c) 2005 Tom Wu
|
||
* All Rights Reserved.
|
||
* BSD License
|
||
* http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE
|
||
*
|
||
* Copyright Stephan Thomas
|
||
* Copyright pointbiz
|
||
*/
|
||
|
||
(function () {
|
||
|
||
// (public) Constructor function of Global BigInteger object
|
||
var BigInteger = window.BigInteger = function BigInteger(a, b, c) {
|
||
if (!(this instanceof BigInteger))
|
||
return new BigInteger(a, b, c);
|
||
|
||
if (a != null)
|
||
if ("number" == typeof a) this.fromNumber(a, b, c);
|
||
else if (b == null && "string" != typeof a) this.fromString(a, 256);
|
||
else this.fromString(a, b);
|
||
};
|
||
|
||
// Bits per digit
|
||
var dbits;
|
||
|
||
// JavaScript engine analysis
|
||
var canary = 0xdeadbeefcafe;
|
||
var j_lm = ((canary & 0xffffff) == 0xefcafe);
|
||
|
||
// return new, unset BigInteger
|
||
function nbi() { return new BigInteger(null); }
|
||
|
||
// am: Compute w_j += (x*this_i), propagate carries,
|
||
// c is initial carry, returns final carry.
|
||
// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
|
||
// We need to select the fastest one that works in this environment.
|
||
|
||
// am1: use a single mult and divide to get the high bits,
|
||
// max digit bits should be 26 because
|
||
// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
|
||
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;
|
||
}
|
||
// 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;
|
||
}
|
||
|
||
BigInteger.prototype.DB = dbits;
|
||
BigInteger.prototype.DM = ((1 << dbits) - 1);
|
||
BigInteger.prototype.DV = (1 << dbits);
|
||
|
||
var BI_FP = 52;
|
||
BigInteger.prototype.FV = Math.pow(2, BI_FP);
|
||
BigInteger.prototype.F1 = BI_FP - dbits;
|
||
BigInteger.prototype.F2 = 2 * dbits - BI_FP;
|
||
|
||
// Digit conversions
|
||
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||
var BI_RC = new Array();
|
||
var rr, vv;
|
||
rr = "0".charCodeAt(0);
|
||
for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
|
||
rr = "a".charCodeAt(0);
|
||
for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
||
rr = "A".charCodeAt(0);
|
||
for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
||
|
||
function int2char(n) { return BI_RM.charAt(n); }
|
||
function intAt(s, i) {
|
||
var c = BI_RC[s.charCodeAt(i)];
|
||
return (c == null) ? -1 : c;
|
||
}
|
||
|
||
|
||
|
||
// return bigint initialized to value
|
||
function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
|
||
|
||
|
||
// 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;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// (protected) copy this to r
|
||
BigInteger.prototype.copyTo = function (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
|
||
BigInteger.prototype.fromInt = function (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;
|
||
};
|
||
|
||
// (protected) set from string and radix
|
||
BigInteger.prototype.fromString = function (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);
|
||
};
|
||
|
||
|
||
// (protected) clamp off excess high words
|
||
BigInteger.prototype.clamp = function () {
|
||
var c = this.s & this.DM;
|
||
while (this.t > 0 && this[this.t - 1] == c) --this.t;
|
||
};
|
||
|
||
// (protected) r = this << n*DB
|
||
BigInteger.prototype.dlShiftTo = function (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
|
||
BigInteger.prototype.drShiftTo = function (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
|
||
BigInteger.prototype.lShiftTo = function (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
|
||
BigInteger.prototype.rShiftTo = function (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) - 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
|
||
BigInteger.prototype.subTo = function (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();
|
||
};
|
||
|
||
|
||
// (protected) r = this * a, r != this,a (HAC 14.12)
|
||
// "this" should be the larger one if appropriate.
|
||
BigInteger.prototype.multiplyTo = function (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)
|
||
BigInteger.prototype.squareTo = function (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();
|
||
};
|
||
|
||
|
||
|
||
// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
|
||
// r != q, this != m. q or r may be null.
|
||
BigInteger.prototype.divRemTo = function (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);
|
||
};
|
||
|
||
|
||
// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
|
||
// justification:
|
||
// xy == 1 (mod m)
|
||
// xy = 1+km
|
||
// xy(2-xy) = (1+km)(1-km)
|
||
// x[y(2-xy)] = 1-k^2m^2
|
||
// x[y(2-xy)] == 1 (mod m^2)
|
||
// 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.
|
||
BigInteger.prototype.invDigit = function () {
|
||
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;
|
||
};
|
||
|
||
|
||
// (protected) true iff this is even
|
||
BigInteger.prototype.isEven = function () { 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)
|
||
BigInteger.prototype.exp = function (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) return string representation in given radix
|
||
BigInteger.prototype.toString = function (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";
|
||
};
|
||
|
||
|
||
// (public) -this
|
||
BigInteger.prototype.negate = function () { var r = nbi(); BigInteger.ZERO.subTo(this, r); return r; };
|
||
|
||
// (public) |this|
|
||
BigInteger.prototype.abs = function () { return (this.s < 0) ? this.negate() : this; };
|
||
|
||
// (public) return + if this > a, - if this < a, 0 if equal
|
||
BigInteger.prototype.compareTo = function (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;
|
||
}
|
||
|
||
// (public) return the number of bits in "this"
|
||
BigInteger.prototype.bitLength = function () {
|
||
if (this.t <= 0) return 0;
|
||
return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));
|
||
};
|
||
|
||
// (public) this mod a
|
||
BigInteger.prototype.mod = function (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;
|
||
}
|
||
|
||
// (public) this^e % m, 0 <= e < 2^32
|
||
BigInteger.prototype.modPowInt = function (e, m) {
|
||
var z;
|
||
if (e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
|
||
return this.exp(e, z);
|
||
};
|
||
|
||
// "constants"
|
||
BigInteger.ZERO = nbv(0);
|
||
BigInteger.ONE = nbv(1);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
// Copyright (c) 2005-2009 Tom Wu
|
||
// All Rights Reserved.
|
||
// See "LICENSE" for details.
|
||
// Extended JavaScript BN functions, required for RSA private ops.
|
||
// Version 1.1: new BigInteger("0", 10) returns "proper" zero
|
||
// Version 1.2: square() API, isProbablePrime fix
|
||
|
||
|
||
// 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;
|
||
}
|
||
|
||
// return number of 1 bits in x
|
||
function cbit(x) {
|
||
var r = 0;
|
||
while (x != 0) { x &= x - 1; ++r; }
|
||
return r;
|
||
}
|
||
|
||
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];
|
||
|
||
|
||
|
||
// (protected) return x s.t. r^x < DV
|
||
BigInteger.prototype.chunkSize = function (r) { return Math.floor(Math.LN2 * this.DB / Math.log(r)); };
|
||
|
||
// (protected) convert to radix string
|
||
BigInteger.prototype.toRadix = function (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
|
||
BigInteger.prototype.fromRadix = function (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);
|
||
};
|
||
|
||
// (protected) alternate constructor
|
||
BigInteger.prototype.fromNumber = function (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);
|
||
}
|
||
};
|
||
|
||
// (protected) r = this op a (bitwise)
|
||
BigInteger.prototype.bitwiseTo = function (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();
|
||
};
|
||
|
||
// (protected) this op (1<<n)
|
||
BigInteger.prototype.changeBit = function (n, op) {
|
||
var r = BigInteger.ONE.shiftLeft(n);
|
||
this.bitwiseTo(r, op, r);
|
||
return r;
|
||
};
|
||
|
||
// (protected) r = this + a
|
||
BigInteger.prototype.addTo = function (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();
|
||
};
|
||
|
||
// (protected) this *= n, this >= 0, 1 < n < DV
|
||
BigInteger.prototype.dMultiply = function (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
|
||
BigInteger.prototype.dAddOffset = function (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];
|
||
}
|
||
};
|
||
|
||
// (protected) r = lower n words of "this * a", a.t <= n
|
||
// "this" should be the larger one if appropriate.
|
||
BigInteger.prototype.multiplyLowerTo = function (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.
|
||
BigInteger.prototype.multiplyUpperTo = function (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);
|
||
};
|
||
|
||
// (protected) this % n, n < 2^26
|
||
BigInteger.prototype.modInt = function (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;
|
||
};
|
||
|
||
|
||
// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
|
||
BigInteger.prototype.millerRabin = function (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;
|
||
};
|
||
|
||
|
||
|
||
// (public)
|
||
BigInteger.prototype.clone = function () { var r = nbi(); this.copyTo(r); return r; };
|
||
|
||
// (public) return value as integer
|
||
BigInteger.prototype.intValue = function () {
|
||
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)) << this.DB) | this[0];
|
||
};
|
||
|
||
|
||
// (public) return value as byte
|
||
BigInteger.prototype.byteValue = function () { return (this.t == 0) ? this.s : (this[0] << 24) >> 24; };
|
||
|
||
// (public) return value as short (assumes DB>=16)
|
||
BigInteger.prototype.shortValue = function () { return (this.t == 0) ? this.s : (this[0] << 16) >> 16; };
|
||
|
||
// (public) 0 if this == 0, 1 if this > 0
|
||
BigInteger.prototype.signum = function () {
|
||
if (this.s < 0) return -1;
|
||
else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0;
|
||
else return 1;
|
||
};
|
||
|
||
|
||
// (public) convert to bigendian byte array
|
||
BigInteger.prototype.toByteArray = function () {
|
||
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;
|
||
};
|
||
|
||
BigInteger.prototype.equals = function (a) { return (this.compareTo(a) == 0); };
|
||
BigInteger.prototype.min = function (a) { return (this.compareTo(a) < 0) ? this : a; };
|
||
BigInteger.prototype.max = function (a) { return (this.compareTo(a) > 0) ? this : a; };
|
||
|
||
// (public) this & a
|
||
function op_and(x, y) { return x & y; }
|
||
BigInteger.prototype.and = function (a) { var r = nbi(); this.bitwiseTo(a, op_and, r); return r; };
|
||
|
||
// (public) this | a
|
||
function op_or(x, y) { return x | y; }
|
||
BigInteger.prototype.or = function (a) { var r = nbi(); this.bitwiseTo(a, op_or, r); return r; };
|
||
|
||
// (public) this ^ a
|
||
function op_xor(x, y) { return x ^ y; }
|
||
BigInteger.prototype.xor = function (a) { var r = nbi(); this.bitwiseTo(a, op_xor, r); return r; };
|
||
|
||
// (public) this & ~a
|
||
function op_andnot(x, y) { return x & ~y; }
|
||
BigInteger.prototype.andNot = function (a) { var r = nbi(); this.bitwiseTo(a, op_andnot, r); return r; };
|
||
|
||
// (public) ~this
|
||
BigInteger.prototype.not = function () {
|
||
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
|
||
BigInteger.prototype.shiftLeft = function (n) {
|
||
var r = nbi();
|
||
if (n < 0) this.rShiftTo(-n, r); else this.lShiftTo(n, r);
|
||
return r;
|
||
};
|
||
|
||
// (public) this >> n
|
||
BigInteger.prototype.shiftRight = function (n) {
|
||
var r = nbi();
|
||
if (n < 0) this.lShiftTo(-n, r); else this.rShiftTo(n, r);
|
||
return r;
|
||
};
|
||
|
||
// (public) returns index of lowest 1-bit (or -1 if none)
|
||
BigInteger.prototype.getLowestSetBit = function () {
|
||
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;
|
||
};
|
||
|
||
// (public) return number of set bits
|
||
BigInteger.prototype.bitCount = function () {
|
||
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
|
||
BigInteger.prototype.testBit = function (n) {
|
||
var j = Math.floor(n / this.DB);
|
||
if (j >= this.t) return (this.s != 0);
|
||
return ((this[j] & (1 << (n % this.DB))) != 0);
|
||
};
|
||
|
||
// (public) this | (1<<n)
|
||
BigInteger.prototype.setBit = function (n) { return this.changeBit(n, op_or); };
|
||
// (public) this & ~(1<<n)
|
||
BigInteger.prototype.clearBit = function (n) { return this.changeBit(n, op_andnot); };
|
||
// (public) this ^ (1<<n)
|
||
BigInteger.prototype.flipBit = function (n) { return this.changeBit(n, op_xor); };
|
||
// (public) this + a
|
||
BigInteger.prototype.add = function (a) { var r = nbi(); this.addTo(a, r); return r; };
|
||
// (public) this - a
|
||
BigInteger.prototype.subtract = function (a) { var r = nbi(); this.subTo(a, r); return r; };
|
||
// (public) this * a
|
||
BigInteger.prototype.multiply = function (a) { var r = nbi(); this.multiplyTo(a, r); return r; };
|
||
// (public) this / a
|
||
BigInteger.prototype.divide = function (a) { var r = nbi(); this.divRemTo(a, r, null); return r; };
|
||
// (public) this % a
|
||
BigInteger.prototype.remainder = function (a) { var r = nbi(); this.divRemTo(a, null, r); return r; };
|
||
// (public) [this/a,this%a]
|
||
BigInteger.prototype.divideAndRemainder = function (a) {
|
||
var q = nbi(), r = nbi();
|
||
this.divRemTo(a, q, r);
|
||
return new Array(q, r);
|
||
};
|
||
|
||
// (public) this^e % m (HAC 14.85)
|
||
BigInteger.prototype.modPow = function (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 << 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);
|
||
}
|
||
|
||
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 << i)) == 0) {
|
||
z.sqrTo(r, r2); t = r; r = r2; r2 = t;
|
||
if (--i < 0) { i = this.DB - 1; --j; }
|
||
}
|
||
}
|
||
return z.revert(r);
|
||
};
|
||
|
||
// (public) 1/this % m (HAC 14.61)
|
||
BigInteger.prototype.modInverse = function (m) {
|
||
var ac = m.isEven();
|
||
if (this.signum() === 0) throw new Error('division by zero');
|
||
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;
|
||
while (d.compareTo(m) >= 0) d.subTo(m, d);
|
||
while (d.signum() < 0) d.addTo(m, d);
|
||
return d;
|
||
};
|
||
|
||
|
||
// (public) this^e
|
||
BigInteger.prototype.pow = function (e) { return this.exp(e, new NullExp()); };
|
||
|
||
// (public) gcd(this,a) (HAC 14.54)
|
||
BigInteger.prototype.gcd = function (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;
|
||
};
|
||
|
||
// (public) test primality with certainty >= 1-.5^t
|
||
BigInteger.prototype.isProbablePrime = function (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);
|
||
};
|
||
|
||
|
||
// JSBN-specific extension
|
||
|
||
// (public) this^2
|
||
BigInteger.prototype.square = function () { var r = nbi(); this.squareTo(r); return r; };
|
||
|
||
|
||
// NOTE: BigInteger interfaces not implemented in jsbn:
|
||
// BigInteger(int signum, byte[] magnitude)
|
||
// double doubleValue()
|
||
// float floatValue()
|
||
// int hashCode()
|
||
// long longValue()
|
||
// static BigInteger valueOf(long val)
|
||
|
||
|
||
|
||
// Copyright Stephan Thomas (start) --- //
|
||
// https://raw.github.com/bitcoinjs/bitcoinjs-lib/07f9d55ccb6abd962efb6befdd37671f85ea4ff9/src/util.js
|
||
// BigInteger monkey patching
|
||
BigInteger.valueOf = nbv;
|
||
|
||
/**
|
||
* Returns a byte array representation of the big integer.
|
||
*
|
||
* This returns the absolute of the contained value in big endian
|
||
* form. A value of zero results in an empty array.
|
||
*/
|
||
BigInteger.prototype.toByteArrayUnsigned = function () {
|
||
var ba = this.abs().toByteArray();
|
||
if (ba.length) {
|
||
if (ba[0] == 0) {
|
||
ba = ba.slice(1);
|
||
}
|
||
return ba.map(function (v) {
|
||
return (v < 0) ? v + 256 : v;
|
||
});
|
||
} else {
|
||
// Empty array, nothing to do
|
||
return ba;
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Turns a byte array into a big integer.
|
||
*
|
||
* This function will interpret a byte array as a big integer in big
|
||
* endian notation and ignore leading zeros.
|
||
*/
|
||
BigInteger.fromByteArrayUnsigned = function (ba) {
|
||
if (!ba.length) {
|
||
return ba.valueOf(0);
|
||
} else if (ba[0] & 0x80) {
|
||
// Prepend a zero so the BigInteger class doesn't mistake this
|
||
// for a negative integer.
|
||
return new BigInteger([0].concat(ba));
|
||
} else {
|
||
return new BigInteger(ba);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Converts big integer to signed byte representation.
|
||
*
|
||
* The format for this value uses a the most significant bit as a sign
|
||
* bit. If the most significant bit is already occupied by the
|
||
* absolute value, an extra byte is prepended and the sign bit is set
|
||
* there.
|
||
*
|
||
* Examples:
|
||
*
|
||
* 0 => 0x00
|
||
* 1 => 0x01
|
||
* -1 => 0x81
|
||
* 127 => 0x7f
|
||
* -127 => 0xff
|
||
* 128 => 0x0080
|
||
* -128 => 0x8080
|
||
* 255 => 0x00ff
|
||
* -255 => 0x80ff
|
||
* 16300 => 0x3fac
|
||
* -16300 => 0xbfac
|
||
* 62300 => 0x00f35c
|
||
* -62300 => 0x80f35c
|
||
*/
|
||
BigInteger.prototype.toByteArraySigned = function () {
|
||
var val = this.abs().toByteArrayUnsigned();
|
||
var neg = this.compareTo(BigInteger.ZERO) < 0;
|
||
|
||
if (neg) {
|
||
if (val[0] & 0x80) {
|
||
val.unshift(0x80);
|
||
} else {
|
||
val[0] |= 0x80;
|
||
}
|
||
} else {
|
||
if (val[0] & 0x80) {
|
||
val.unshift(0x00);
|
||
}
|
||
}
|
||
|
||
return val;
|
||
};
|
||
|
||
/**
|
||
* Parse a signed big integer byte representation.
|
||
*
|
||
* For details on the format please see BigInteger.toByteArraySigned.
|
||
*/
|
||
BigInteger.fromByteArraySigned = function (ba) {
|
||
// Check for negative value
|
||
if (ba[0] & 0x80) {
|
||
// Remove sign bit
|
||
ba[0] &= 0x7f;
|
||
|
||
return BigInteger.fromByteArrayUnsigned(ba).negate();
|
||
} else {
|
||
return BigInteger.fromByteArrayUnsigned(ba);
|
||
}
|
||
};
|
||
// Copyright Stephan Thomas (end) --- //
|
||
|
||
|
||
|
||
|
||
// ****** REDUCTION ******* //
|
||
|
||
// Modular reduction using "classic" algorithm
|
||
var Classic = window.Classic = function Classic(m) { this.m = m; }
|
||
Classic.prototype.convert = function (x) {
|
||
if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
|
||
else return x;
|
||
};
|
||
Classic.prototype.revert = function (x) { return x; };
|
||
Classic.prototype.reduce = function (x) { x.divRemTo(this.m, null, x); };
|
||
Classic.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); this.reduce(r); };
|
||
Classic.prototype.sqrTo = function (x, r) { x.squareTo(r); this.reduce(r); };
|
||
|
||
|
||
|
||
|
||
|
||
// Montgomery reduction
|
||
var Montgomery = window.Montgomery = 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
|
||
Montgomery.prototype.convert = function (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
|
||
Montgomery.prototype.revert = function (x) {
|
||
var r = nbi();
|
||
x.copyTo(r);
|
||
this.reduce(r);
|
||
return r;
|
||
};
|
||
// x = x/R mod m (HAC 14.32)
|
||
Montgomery.prototype.reduce = function (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 = "xy/R mod m"; x,y != r
|
||
Montgomery.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); this.reduce(r); };
|
||
// r = "x^2/R mod m"; x != r
|
||
Montgomery.prototype.sqrTo = function (x, r) { x.squareTo(r); this.reduce(r); };
|
||
|
||
|
||
|
||
|
||
|
||
// A "null" reducer
|
||
var NullExp = window.NullExp = function NullExp() { }
|
||
NullExp.prototype.convert = function (x) { return x; };
|
||
NullExp.prototype.revert = function (x) { return x; };
|
||
NullExp.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); };
|
||
NullExp.prototype.sqrTo = function (x, r) { x.squareTo(r); };
|
||
|
||
|
||
|
||
|
||
|
||
// Barrett modular reduction
|
||
var Barrett = window.Barrett = 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;
|
||
}
|
||
Barrett.prototype.convert = function (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; }
|
||
};
|
||
Barrett.prototype.revert = function (x) { return x; };
|
||
// x = x mod m (HAC 14.42)
|
||
Barrett.prototype.reduce = function (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*y mod m; x,y != r
|
||
Barrett.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); this.reduce(r); };
|
||
// r = x^2 mod m; x != r
|
||
Barrett.prototype.sqrTo = function (x, r) { x.squareTo(r); this.reduce(r); };
|
||
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
//---------------------------------------------------------------------
|
||
// QRCode for JavaScript
|
||
//
|
||
// Copyright (c) 2009 Kazuhiko Arase
|
||
//
|
||
// URL: http://www.d-project.com/
|
||
//
|
||
// Licensed under the MIT license:
|
||
// http://www.opensource.org/licenses/mit-license.php
|
||
//
|
||
// The word "QR Code" is registered trademark of
|
||
// DENSO WAVE INCORPORATED
|
||
// http://www.denso-wave.com/qrcode/faqpatent-e.html
|
||
//
|
||
//---------------------------------------------------------------------
|
||
|
||
(function () {
|
||
//---------------------------------------------------------------------
|
||
// QRCode
|
||
//---------------------------------------------------------------------
|
||
|
||
var QRCode = window.QRCode = function (typeNumber, errorCorrectLevel) {
|
||
this.typeNumber = typeNumber;
|
||
this.errorCorrectLevel = errorCorrectLevel;
|
||
this.modules = null;
|
||
this.moduleCount = 0;
|
||
this.dataCache = null;
|
||
this.dataList = new Array();
|
||
}
|
||
|
||
QRCode.prototype = {
|
||
|
||
addData: function (data) {
|
||
var newData = new QRCode.QR8bitByte(data);
|
||
this.dataList.push(newData);
|
||
this.dataCache = null;
|
||
},
|
||
|
||
isDark: function (row, col) {
|
||
if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
|
||
throw new Error(row + "," + col);
|
||
}
|
||
return this.modules[row][col];
|
||
},
|
||
|
||
getModuleCount: function () {
|
||
return this.moduleCount;
|
||
},
|
||
|
||
make: function () {
|
||
this.makeImpl(false, this.getBestMaskPattern());
|
||
},
|
||
|
||
makeImpl: function (test, maskPattern) {
|
||
|
||
this.moduleCount = this.typeNumber * 4 + 17;
|
||
this.modules = new Array(this.moduleCount);
|
||
|
||
for (var row = 0; row < this.moduleCount; row++) {
|
||
|
||
this.modules[row] = new Array(this.moduleCount);
|
||
|
||
for (var col = 0; col < this.moduleCount; col++) {
|
||
this.modules[row][col] = null; //(col + row) % 3;
|
||
}
|
||
}
|
||
|
||
this.setupPositionProbePattern(0, 0);
|
||
this.setupPositionProbePattern(this.moduleCount - 7, 0);
|
||
this.setupPositionProbePattern(0, this.moduleCount - 7);
|
||
this.setupPositionAdjustPattern();
|
||
this.setupTimingPattern();
|
||
this.setupTypeInfo(test, maskPattern);
|
||
|
||
if (this.typeNumber >= 7) {
|
||
this.setupTypeNumber(test);
|
||
}
|
||
|
||
if (this.dataCache == null) {
|
||
this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
|
||
}
|
||
|
||
this.mapData(this.dataCache, maskPattern);
|
||
},
|
||
|
||
setupPositionProbePattern: function (row, col) {
|
||
|
||
for (var r = -1; r <= 7; r++) {
|
||
|
||
if (row + r <= -1 || this.moduleCount <= row + r) continue;
|
||
|
||
for (var c = -1; c <= 7; c++) {
|
||
|
||
if (col + c <= -1 || this.moduleCount <= col + c) continue;
|
||
|
||
if ((0 <= r && r <= 6 && (c == 0 || c == 6))
|
||
|| (0 <= c && c <= 6 && (r == 0 || r == 6))
|
||
|| (2 <= r && r <= 4 && 2 <= c && c <= 4)) {
|
||
this.modules[row + r][col + c] = true;
|
||
} else {
|
||
this.modules[row + r][col + c] = false;
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
getBestMaskPattern: function () {
|
||
|
||
var minLostPoint = 0;
|
||
var pattern = 0;
|
||
|
||
for (var i = 0; i < 8; i++) {
|
||
|
||
this.makeImpl(true, i);
|
||
|
||
var lostPoint = QRCode.Util.getLostPoint(this);
|
||
|
||
if (i == 0 || minLostPoint > lostPoint) {
|
||
minLostPoint = lostPoint;
|
||
pattern = i;
|
||
}
|
||
}
|
||
|
||
return pattern;
|
||
},
|
||
|
||
createMovieClip: function (target_mc, instance_name, depth) {
|
||
|
||
var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
|
||
var cs = 1;
|
||
|
||
this.make();
|
||
|
||
for (var row = 0; row < this.modules.length; row++) {
|
||
|
||
var y = row * cs;
|
||
|
||
for (var col = 0; col < this.modules[row].length; col++) {
|
||
|
||
var x = col * cs;
|
||
var dark = this.modules[row][col];
|
||
|
||
if (dark) {
|
||
qr_mc.beginFill(0, 100);
|
||
qr_mc.moveTo(x, y);
|
||
qr_mc.lineTo(x + cs, y);
|
||
qr_mc.lineTo(x + cs, y + cs);
|
||
qr_mc.lineTo(x, y + cs);
|
||
qr_mc.endFill();
|
||
}
|
||
}
|
||
}
|
||
|
||
return qr_mc;
|
||
},
|
||
|
||
setupTimingPattern: function () {
|
||
|
||
for (var r = 8; r < this.moduleCount - 8; r++) {
|
||
if (this.modules[r][6] != null) {
|
||
continue;
|
||
}
|
||
this.modules[r][6] = (r % 2 == 0);
|
||
}
|
||
|
||
for (var c = 8; c < this.moduleCount - 8; c++) {
|
||
if (this.modules[6][c] != null) {
|
||
continue;
|
||
}
|
||
this.modules[6][c] = (c % 2 == 0);
|
||
}
|
||
},
|
||
|
||
setupPositionAdjustPattern: function () {
|
||
|
||
var pos = QRCode.Util.getPatternPosition(this.typeNumber);
|
||
|
||
for (var i = 0; i < pos.length; i++) {
|
||
|
||
for (var j = 0; j < pos.length; j++) {
|
||
|
||
var row = pos[i];
|
||
var col = pos[j];
|
||
|
||
if (this.modules[row][col] != null) {
|
||
continue;
|
||
}
|
||
|
||
for (var r = -2; r <= 2; r++) {
|
||
|
||
for (var c = -2; c <= 2; c++) {
|
||
|
||
if (r == -2 || r == 2 || c == -2 || c == 2
|
||
|| (r == 0 && c == 0)) {
|
||
this.modules[row + r][col + c] = true;
|
||
} else {
|
||
this.modules[row + r][col + c] = false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
setupTypeNumber: function (test) {
|
||
|
||
var bits = QRCode.Util.getBCHTypeNumber(this.typeNumber);
|
||
|
||
for (var i = 0; i < 18; i++) {
|
||
var mod = (!test && ((bits >> i) & 1) == 1);
|
||
this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
|
||
}
|
||
|
||
for (var i = 0; i < 18; i++) {
|
||
var mod = (!test && ((bits >> i) & 1) == 1);
|
||
this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
|
||
}
|
||
},
|
||
|
||
setupTypeInfo: function (test, maskPattern) {
|
||
|
||
var data = (this.errorCorrectLevel << 3) | maskPattern;
|
||
var bits = QRCode.Util.getBCHTypeInfo(data);
|
||
|
||
// vertical
|
||
for (var i = 0; i < 15; i++) {
|
||
|
||
var mod = (!test && ((bits >> i) & 1) == 1);
|
||
|
||
if (i < 6) {
|
||
this.modules[i][8] = mod;
|
||
} else if (i < 8) {
|
||
this.modules[i + 1][8] = mod;
|
||
} else {
|
||
this.modules[this.moduleCount - 15 + i][8] = mod;
|
||
}
|
||
}
|
||
|
||
// horizontal
|
||
for (var i = 0; i < 15; i++) {
|
||
|
||
var mod = (!test && ((bits >> i) & 1) == 1);
|
||
|
||
if (i < 8) {
|
||
this.modules[8][this.moduleCount - i - 1] = mod;
|
||
} else if (i < 9) {
|
||
this.modules[8][15 - i - 1 + 1] = mod;
|
||
} else {
|
||
this.modules[8][15 - i - 1] = mod;
|
||
}
|
||
}
|
||
|
||
// fixed module
|
||
this.modules[this.moduleCount - 8][8] = (!test);
|
||
|
||
},
|
||
|
||
mapData: function (data, maskPattern) {
|
||
|
||
var inc = -1;
|
||
var row = this.moduleCount - 1;
|
||
var bitIndex = 7;
|
||
var byteIndex = 0;
|
||
|
||
for (var col = this.moduleCount - 1; col > 0; col -= 2) {
|
||
|
||
if (col == 6) col--;
|
||
|
||
while (true) {
|
||
|
||
for (var c = 0; c < 2; c++) {
|
||
|
||
if (this.modules[row][col - c] == null) {
|
||
|
||
var dark = false;
|
||
|
||
if (byteIndex < data.length) {
|
||
dark = (((data[byteIndex] >>> bitIndex) & 1) == 1);
|
||
}
|
||
|
||
var mask = QRCode.Util.getMask(maskPattern, row, col - c);
|
||
|
||
if (mask) {
|
||
dark = !dark;
|
||
}
|
||
|
||
this.modules[row][col - c] = dark;
|
||
bitIndex--;
|
||
|
||
if (bitIndex == -1) {
|
||
byteIndex++;
|
||
bitIndex = 7;
|
||
}
|
||
}
|
||
}
|
||
|
||
row += inc;
|
||
|
||
if (row < 0 || this.moduleCount <= row) {
|
||
row -= inc;
|
||
inc = -inc;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
};
|
||
|
||
QRCode.PAD0 = 0xEC;
|
||
QRCode.PAD1 = 0x11;
|
||
|
||
QRCode.createData = function (typeNumber, errorCorrectLevel, dataList) {
|
||
|
||
var rsBlocks = QRCode.RSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
|
||
|
||
var buffer = new QRCode.BitBuffer();
|
||
|
||
for (var i = 0; i < dataList.length; i++) {
|
||
var data = dataList[i];
|
||
buffer.put(data.mode, 4);
|
||
buffer.put(data.getLength(), QRCode.Util.getLengthInBits(data.mode, typeNumber));
|
||
data.write(buffer);
|
||
}
|
||
|
||
// calc num max data.
|
||
var totalDataCount = 0;
|
||
for (var i = 0; i < rsBlocks.length; i++) {
|
||
totalDataCount += rsBlocks[i].dataCount;
|
||
}
|
||
|
||
if (buffer.getLengthInBits() > totalDataCount * 8) {
|
||
throw new Error("code length overflow. ("
|
||
+ buffer.getLengthInBits()
|
||
+ ">"
|
||
+ totalDataCount * 8
|
||
+ ")");
|
||
}
|
||
|
||
// end code
|
||
if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
|
||
buffer.put(0, 4);
|
||
}
|
||
|
||
// padding
|
||
while (buffer.getLengthInBits() % 8 != 0) {
|
||
buffer.putBit(false);
|
||
}
|
||
|
||
// padding
|
||
while (true) {
|
||
|
||
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
||
break;
|
||
}
|
||
buffer.put(QRCode.PAD0, 8);
|
||
|
||
if (buffer.getLengthInBits() >= totalDataCount * 8) {
|
||
break;
|
||
}
|
||
buffer.put(QRCode.PAD1, 8);
|
||
}
|
||
|
||
return QRCode.createBytes(buffer, rsBlocks);
|
||
};
|
||
|
||
QRCode.createBytes = function (buffer, rsBlocks) {
|
||
|
||
var offset = 0;
|
||
|
||
var maxDcCount = 0;
|
||
var maxEcCount = 0;
|
||
|
||
var dcdata = new Array(rsBlocks.length);
|
||
var ecdata = new Array(rsBlocks.length);
|
||
|
||
for (var r = 0; r < rsBlocks.length; r++) {
|
||
|
||
var dcCount = rsBlocks[r].dataCount;
|
||
var ecCount = rsBlocks[r].totalCount - dcCount;
|
||
|
||
maxDcCount = Math.max(maxDcCount, dcCount);
|
||
maxEcCount = Math.max(maxEcCount, ecCount);
|
||
|
||
dcdata[r] = new Array(dcCount);
|
||
|
||
for (var i = 0; i < dcdata[r].length; i++) {
|
||
dcdata[r][i] = 0xff & buffer.buffer[i + offset];
|
||
}
|
||
offset += dcCount;
|
||
|
||
var rsPoly = QRCode.Util.getErrorCorrectPolynomial(ecCount);
|
||
var rawPoly = new QRCode.Polynomial(dcdata[r], rsPoly.getLength() - 1);
|
||
|
||
var modPoly = rawPoly.mod(rsPoly);
|
||
ecdata[r] = new Array(rsPoly.getLength() - 1);
|
||
for (var i = 0; i < ecdata[r].length; i++) {
|
||
var modIndex = i + modPoly.getLength() - ecdata[r].length;
|
||
ecdata[r][i] = (modIndex >= 0) ? modPoly.get(modIndex) : 0;
|
||
}
|
||
|
||
}
|
||
|
||
var totalCodeCount = 0;
|
||
for (var i = 0; i < rsBlocks.length; i++) {
|
||
totalCodeCount += rsBlocks[i].totalCount;
|
||
}
|
||
|
||
var data = new Array(totalCodeCount);
|
||
var index = 0;
|
||
|
||
for (var i = 0; i < maxDcCount; i++) {
|
||
for (var r = 0; r < rsBlocks.length; r++) {
|
||
if (i < dcdata[r].length) {
|
||
data[index++] = dcdata[r][i];
|
||
}
|
||
}
|
||
}
|
||
|
||
for (var i = 0; i < maxEcCount; i++) {
|
||
for (var r = 0; r < rsBlocks.length; r++) {
|
||
if (i < ecdata[r].length) {
|
||
data[index++] = ecdata[r][i];
|
||
}
|
||
}
|
||
}
|
||
|
||
return data;
|
||
|
||
};
|
||
|
||
//---------------------------------------------------------------------
|
||
// QR8bitByte
|
||
//---------------------------------------------------------------------
|
||
QRCode.QR8bitByte = function (data) {
|
||
this.mode = QRCode.Mode.MODE_8BIT_BYTE;
|
||
this.data = data;
|
||
}
|
||
|
||
QRCode.QR8bitByte.prototype = {
|
||
getLength: function (buffer) {
|
||
return this.data.length;
|
||
},
|
||
|
||
write: function (buffer) {
|
||
for (var i = 0; i < this.data.length; i++) {
|
||
// not JIS ...
|
||
buffer.put(this.data.charCodeAt(i), 8);
|
||
}
|
||
}
|
||
};
|
||
|
||
|
||
//---------------------------------------------------------------------
|
||
// QRMode
|
||
//---------------------------------------------------------------------
|
||
QRCode.Mode = {
|
||
MODE_NUMBER: 1 << 0,
|
||
MODE_ALPHA_NUM: 1 << 1,
|
||
MODE_8BIT_BYTE: 1 << 2,
|
||
MODE_KANJI: 1 << 3
|
||
};
|
||
|
||
//---------------------------------------------------------------------
|
||
// QRErrorCorrectLevel
|
||
//---------------------------------------------------------------------
|
||
QRCode.ErrorCorrectLevel = {
|
||
L: 1,
|
||
M: 0,
|
||
Q: 3,
|
||
H: 2
|
||
};
|
||
|
||
|
||
//---------------------------------------------------------------------
|
||
// QRMaskPattern
|
||
//---------------------------------------------------------------------
|
||
QRCode.MaskPattern = {
|
||
PATTERN000: 0,
|
||
PATTERN001: 1,
|
||
PATTERN010: 2,
|
||
PATTERN011: 3,
|
||
PATTERN100: 4,
|
||
PATTERN101: 5,
|
||
PATTERN110: 6,
|
||
PATTERN111: 7
|
||
};
|
||
|
||
//---------------------------------------------------------------------
|
||
// QRUtil
|
||
//---------------------------------------------------------------------
|
||
|
||
QRCode.Util = {
|
||
|
||
PATTERN_POSITION_TABLE: [
|
||
[],
|
||
[6, 18],
|
||
[6, 22],
|
||
[6, 26],
|
||
[6, 30],
|
||
[6, 34],
|
||
[6, 22, 38],
|
||
[6, 24, 42],
|
||
[6, 26, 46],
|
||
[6, 28, 50],
|
||
[6, 30, 54],
|
||
[6, 32, 58],
|
||
[6, 34, 62],
|
||
[6, 26, 46, 66],
|
||
[6, 26, 48, 70],
|
||
[6, 26, 50, 74],
|
||
[6, 30, 54, 78],
|
||
[6, 30, 56, 82],
|
||
[6, 30, 58, 86],
|
||
[6, 34, 62, 90],
|
||
[6, 28, 50, 72, 94],
|
||
[6, 26, 50, 74, 98],
|
||
[6, 30, 54, 78, 102],
|
||
[6, 28, 54, 80, 106],
|
||
[6, 32, 58, 84, 110],
|
||
[6, 30, 58, 86, 114],
|
||
[6, 34, 62, 90, 118],
|
||
[6, 26, 50, 74, 98, 122],
|
||
[6, 30, 54, 78, 102, 126],
|
||
[6, 26, 52, 78, 104, 130],
|
||
[6, 30, 56, 82, 108, 134],
|
||
[6, 34, 60, 86, 112, 138],
|
||
[6, 30, 58, 86, 114, 142],
|
||
[6, 34, 62, 90, 118, 146],
|
||
[6, 30, 54, 78, 102, 126, 150],
|
||
[6, 24, 50, 76, 102, 128, 154],
|
||
[6, 28, 54, 80, 106, 132, 158],
|
||
[6, 32, 58, 84, 110, 136, 162],
|
||
[6, 26, 54, 82, 110, 138, 166],
|
||
[6, 30, 58, 86, 114, 142, 170]
|
||
],
|
||
|
||
G15: (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0),
|
||
G18: (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0),
|
||
G15_MASK: (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1),
|
||
|
||
getBCHTypeInfo: function (data) {
|
||
var d = data << 10;
|
||
while (QRCode.Util.getBCHDigit(d) - QRCode.Util.getBCHDigit(QRCode.Util.G15) >= 0) {
|
||
d ^= (QRCode.Util.G15 << (QRCode.Util.getBCHDigit(d) - QRCode.Util.getBCHDigit(QRCode.Util.G15)));
|
||
}
|
||
return ((data << 10) | d) ^ QRCode.Util.G15_MASK;
|
||
},
|
||
|
||
getBCHTypeNumber: function (data) {
|
||
var d = data << 12;
|
||
while (QRCode.Util.getBCHDigit(d) - QRCode.Util.getBCHDigit(QRCode.Util.G18) >= 0) {
|
||
d ^= (QRCode.Util.G18 << (QRCode.Util.getBCHDigit(d) - QRCode.Util.getBCHDigit(QRCode.Util.G18)));
|
||
}
|
||
return (data << 12) | d;
|
||
},
|
||
|
||
getBCHDigit: function (data) {
|
||
|
||
var digit = 0;
|
||
|
||
while (data != 0) {
|
||
digit++;
|
||
data >>>= 1;
|
||
}
|
||
|
||
return digit;
|
||
},
|
||
|
||
getPatternPosition: function (typeNumber) {
|
||
return QRCode.Util.PATTERN_POSITION_TABLE[typeNumber - 1];
|
||
},
|
||
|
||
getMask: function (maskPattern, i, j) {
|
||
|
||
switch (maskPattern) {
|
||
|
||
case QRCode.MaskPattern.PATTERN000: return (i + j) % 2 == 0;
|
||
case QRCode.MaskPattern.PATTERN001: return i % 2 == 0;
|
||
case QRCode.MaskPattern.PATTERN010: return j % 3 == 0;
|
||
case QRCode.MaskPattern.PATTERN011: return (i + j) % 3 == 0;
|
||
case QRCode.MaskPattern.PATTERN100: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
|
||
case QRCode.MaskPattern.PATTERN101: return (i * j) % 2 + (i * j) % 3 == 0;
|
||
case QRCode.MaskPattern.PATTERN110: return ((i * j) % 2 + (i * j) % 3) % 2 == 0;
|
||
case QRCode.MaskPattern.PATTERN111: return ((i * j) % 3 + (i + j) % 2) % 2 == 0;
|
||
|
||
default:
|
||
throw new Error("bad maskPattern:" + maskPattern);
|
||
}
|
||
},
|
||
|
||
getErrorCorrectPolynomial: function (errorCorrectLength) {
|
||
|
||
var a = new QRCode.Polynomial([1], 0);
|
||
|
||
for (var i = 0; i < errorCorrectLength; i++) {
|
||
a = a.multiply(new QRCode.Polynomial([1, QRCode.Math.gexp(i)], 0));
|
||
}
|
||
|
||
return a;
|
||
},
|
||
|
||
getLengthInBits: function (mode, type) {
|
||
|
||
if (1 <= type && type < 10) {
|
||
|
||
// 1 - 9
|
||
|
||
switch (mode) {
|
||
case QRCode.Mode.MODE_NUMBER: return 10;
|
||
case QRCode.Mode.MODE_ALPHA_NUM: return 9;
|
||
case QRCode.Mode.MODE_8BIT_BYTE: return 8;
|
||
case QRCode.Mode.MODE_KANJI: return 8;
|
||
default:
|
||
throw new Error("mode:" + mode);
|
||
}
|
||
|
||
} else if (type < 27) {
|
||
|
||
// 10 - 26
|
||
|
||
switch (mode) {
|
||
case QRCode.Mode.MODE_NUMBER: return 12;
|
||
case QRCode.Mode.MODE_ALPHA_NUM: return 11;
|
||
case QRCode.Mode.MODE_8BIT_BYTE: return 16;
|
||
case QRCode.Mode.MODE_KANJI: return 10;
|
||
default:
|
||
throw new Error("mode:" + mode);
|
||
}
|
||
|
||
} else if (type < 41) {
|
||
|
||
// 27 - 40
|
||
|
||
switch (mode) {
|
||
case QRCode.Mode.MODE_NUMBER: return 14;
|
||
case QRCode.Mode.MODE_ALPHA_NUM: return 13;
|
||
case QRCode.Mode.MODE_8BIT_BYTE: return 16;
|
||
case QRCode.Mode.MODE_KANJI: return 12;
|
||
default:
|
||
throw new Error("mode:" + mode);
|
||
}
|
||
|
||
} else {
|
||
throw new Error("type:" + type);
|
||
}
|
||
},
|
||
|
||
getLostPoint: function (qrCode) {
|
||
|
||
var moduleCount = qrCode.getModuleCount();
|
||
|
||
var lostPoint = 0;
|
||
|
||
// LEVEL1
|
||
|
||
for (var row = 0; row < moduleCount; row++) {
|
||
|
||
for (var col = 0; col < moduleCount; col++) {
|
||
|
||
var sameCount = 0;
|
||
var dark = qrCode.isDark(row, col);
|
||
|
||
for (var r = -1; r <= 1; r++) {
|
||
|
||
if (row + r < 0 || moduleCount <= row + r) {
|
||
continue;
|
||
}
|
||
|
||
for (var c = -1; c <= 1; c++) {
|
||
|
||
if (col + c < 0 || moduleCount <= col + c) {
|
||
continue;
|
||
}
|
||
|
||
if (r == 0 && c == 0) {
|
||
continue;
|
||
}
|
||
|
||
if (dark == qrCode.isDark(row + r, col + c)) {
|
||
sameCount++;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (sameCount > 5) {
|
||
lostPoint += (3 + sameCount - 5);
|
||
}
|
||
}
|
||
}
|
||
|
||
// LEVEL2
|
||
|
||
for (var row = 0; row < moduleCount - 1; row++) {
|
||
for (var col = 0; col < moduleCount - 1; col++) {
|
||
var count = 0;
|
||
if (qrCode.isDark(row, col)) count++;
|
||
if (qrCode.isDark(row + 1, col)) count++;
|
||
if (qrCode.isDark(row, col + 1)) count++;
|
||
if (qrCode.isDark(row + 1, col + 1)) count++;
|
||
if (count == 0 || count == 4) {
|
||
lostPoint += 3;
|
||
}
|
||
}
|
||
}
|
||
|
||
// LEVEL3
|
||
|
||
for (var row = 0; row < moduleCount; row++) {
|
||
for (var col = 0; col < moduleCount - 6; col++) {
|
||
if (qrCode.isDark(row, col)
|
||
&& !qrCode.isDark(row, col + 1)
|
||
&& qrCode.isDark(row, col + 2)
|
||
&& qrCode.isDark(row, col + 3)
|
||
&& qrCode.isDark(row, col + 4)
|
||
&& !qrCode.isDark(row, col + 5)
|
||
&& qrCode.isDark(row, col + 6)) {
|
||
lostPoint += 40;
|
||
}
|
||
}
|
||
}
|
||
|
||
for (var col = 0; col < moduleCount; col++) {
|
||
for (var row = 0; row < moduleCount - 6; row++) {
|
||
if (qrCode.isDark(row, col)
|
||
&& !qrCode.isDark(row + 1, col)
|
||
&& qrCode.isDark(row + 2, col)
|
||
&& qrCode.isDark(row + 3, col)
|
||
&& qrCode.isDark(row + 4, col)
|
||
&& !qrCode.isDark(row + 5, col)
|
||
&& qrCode.isDark(row + 6, col)) {
|
||
lostPoint += 40;
|
||
}
|
||
}
|
||
}
|
||
|
||
// LEVEL4
|
||
|
||
var darkCount = 0;
|
||
|
||
for (var col = 0; col < moduleCount; col++) {
|
||
for (var row = 0; row < moduleCount; row++) {
|
||
if (qrCode.isDark(row, col)) {
|
||
darkCount++;
|
||
}
|
||
}
|
||
}
|
||
|
||
var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
|
||
lostPoint += ratio * 10;
|
||
|
||
return lostPoint;
|
||
}
|
||
|
||
};
|
||
|
||
|
||
//---------------------------------------------------------------------
|
||
// QRMath
|
||
//---------------------------------------------------------------------
|
||
|
||
QRCode.Math = {
|
||
|
||
glog: function (n) {
|
||
|
||
if (n < 1) {
|
||
throw new Error("glog(" + n + ")");
|
||
}
|
||
|
||
return QRCode.Math.LOG_TABLE[n];
|
||
},
|
||
|
||
gexp: function (n) {
|
||
|
||
while (n < 0) {
|
||
n += 255;
|
||
}
|
||
|
||
while (n >= 256) {
|
||
n -= 255;
|
||
}
|
||
|
||
return QRCode.Math.EXP_TABLE[n];
|
||
},
|
||
|
||
EXP_TABLE: new Array(256),
|
||
|
||
LOG_TABLE: new Array(256)
|
||
|
||
};
|
||
|
||
for (var i = 0; i < 8; i++) {
|
||
QRCode.Math.EXP_TABLE[i] = 1 << i;
|
||
}
|
||
for (var i = 8; i < 256; i++) {
|
||
QRCode.Math.EXP_TABLE[i] = QRCode.Math.EXP_TABLE[i - 4]
|
||
^ QRCode.Math.EXP_TABLE[i - 5]
|
||
^ QRCode.Math.EXP_TABLE[i - 6]
|
||
^ QRCode.Math.EXP_TABLE[i - 8];
|
||
}
|
||
for (var i = 0; i < 255; i++) {
|
||
QRCode.Math.LOG_TABLE[QRCode.Math.EXP_TABLE[i]] = i;
|
||
}
|
||
|
||
//---------------------------------------------------------------------
|
||
// QRPolynomial
|
||
//---------------------------------------------------------------------
|
||
|
||
QRCode.Polynomial = function (num, shift) {
|
||
|
||
if (num.length == undefined) {
|
||
throw new Error(num.length + "/" + shift);
|
||
}
|
||
|
||
var offset = 0;
|
||
|
||
while (offset < num.length && num[offset] == 0) {
|
||
offset++;
|
||
}
|
||
|
||
this.num = new Array(num.length - offset + shift);
|
||
for (var i = 0; i < num.length - offset; i++) {
|
||
this.num[i] = num[i + offset];
|
||
}
|
||
}
|
||
|
||
QRCode.Polynomial.prototype = {
|
||
|
||
get: function (index) {
|
||
return this.num[index];
|
||
},
|
||
|
||
getLength: function () {
|
||
return this.num.length;
|
||
},
|
||
|
||
multiply: function (e) {
|
||
|
||
var num = new Array(this.getLength() + e.getLength() - 1);
|
||
|
||
for (var i = 0; i < this.getLength(); i++) {
|
||
for (var j = 0; j < e.getLength(); j++) {
|
||
num[i + j] ^= QRCode.Math.gexp(QRCode.Math.glog(this.get(i)) + QRCode.Math.glog(e.get(j)));
|
||
}
|
||
}
|
||
|
||
return new QRCode.Polynomial(num, 0);
|
||
},
|
||
|
||
mod: function (e) {
|
||
|
||
if (this.getLength() - e.getLength() < 0) {
|
||
return this;
|
||
}
|
||
|
||
var ratio = QRCode.Math.glog(this.get(0)) - QRCode.Math.glog(e.get(0));
|
||
|
||
var num = new Array(this.getLength());
|
||
|
||
for (var i = 0; i < this.getLength(); i++) {
|
||
num[i] = this.get(i);
|
||
}
|
||
|
||
for (var i = 0; i < e.getLength(); i++) {
|
||
num[i] ^= QRCode.Math.gexp(QRCode.Math.glog(e.get(i)) + ratio);
|
||
}
|
||
|
||
// recursive call
|
||
return new QRCode.Polynomial(num, 0).mod(e);
|
||
}
|
||
};
|
||
|
||
//---------------------------------------------------------------------
|
||
// QRRSBlock
|
||
//---------------------------------------------------------------------
|
||
|
||
QRCode.RSBlock = function (totalCount, dataCount) {
|
||
this.totalCount = totalCount;
|
||
this.dataCount = dataCount;
|
||
}
|
||
|
||
QRCode.RSBlock.RS_BLOCK_TABLE = [
|
||
|
||
// L
|
||
// M
|
||
// Q
|
||
// H
|
||
|
||
// 1
|
||
[1, 26, 19],
|
||
[1, 26, 16],
|
||
[1, 26, 13],
|
||
[1, 26, 9],
|
||
|
||
// 2
|
||
[1, 44, 34],
|
||
[1, 44, 28],
|
||
[1, 44, 22],
|
||
[1, 44, 16],
|
||
|
||
// 3
|
||
[1, 70, 55],
|
||
[1, 70, 44],
|
||
[2, 35, 17],
|
||
[2, 35, 13],
|
||
|
||
// 4
|
||
[1, 100, 80],
|
||
[2, 50, 32],
|
||
[2, 50, 24],
|
||
[4, 25, 9],
|
||
|
||
// 5
|
||
[1, 134, 108],
|
||
[2, 67, 43],
|
||
[2, 33, 15, 2, 34, 16],
|
||
[2, 33, 11, 2, 34, 12],
|
||
|
||
// 6
|
||
[2, 86, 68],
|
||
[4, 43, 27],
|
||
[4, 43, 19],
|
||
[4, 43, 15],
|
||
|
||
// 7
|
||
[2, 98, 78],
|
||
[4, 49, 31],
|
||
[2, 32, 14, 4, 33, 15],
|
||
[4, 39, 13, 1, 40, 14],
|
||
|
||
// 8
|
||
[2, 121, 97],
|
||
[2, 60, 38, 2, 61, 39],
|
||
[4, 40, 18, 2, 41, 19],
|
||
[4, 40, 14, 2, 41, 15],
|
||
|
||
// 9
|
||
[2, 146, 116],
|
||
[3, 58, 36, 2, 59, 37],
|
||
[4, 36, 16, 4, 37, 17],
|
||
[4, 36, 12, 4, 37, 13],
|
||
|
||
// 10
|
||
[2, 86, 68, 2, 87, 69],
|
||
[4, 69, 43, 1, 70, 44],
|
||
[6, 43, 19, 2, 44, 20],
|
||
[6, 43, 15, 2, 44, 16]
|
||
|
||
];
|
||
|
||
QRCode.RSBlock.getRSBlocks = function (typeNumber, errorCorrectLevel) {
|
||
|
||
var rsBlock = QRCode.RSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
|
||
|
||
if (rsBlock == undefined) {
|
||
throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
|
||
}
|
||
|
||
var length = rsBlock.length / 3;
|
||
|
||
var list = new Array();
|
||
|
||
for (var i = 0; i < length; i++) {
|
||
|
||
var count = rsBlock[i * 3 + 0];
|
||
var totalCount = rsBlock[i * 3 + 1];
|
||
var dataCount = rsBlock[i * 3 + 2];
|
||
|
||
for (var j = 0; j < count; j++) {
|
||
list.push(new QRCode.RSBlock(totalCount, dataCount));
|
||
}
|
||
}
|
||
|
||
return list;
|
||
};
|
||
|
||
QRCode.RSBlock.getRsBlockTable = function (typeNumber, errorCorrectLevel) {
|
||
|
||
switch (errorCorrectLevel) {
|
||
case QRCode.ErrorCorrectLevel.L:
|
||
return QRCode.RSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
|
||
case QRCode.ErrorCorrectLevel.M:
|
||
return QRCode.RSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
|
||
case QRCode.ErrorCorrectLevel.Q:
|
||
return QRCode.RSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
|
||
case QRCode.ErrorCorrectLevel.H:
|
||
return QRCode.RSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
|
||
default:
|
||
return undefined;
|
||
}
|
||
};
|
||
|
||
//---------------------------------------------------------------------
|
||
// QRBitBuffer
|
||
//---------------------------------------------------------------------
|
||
|
||
QRCode.BitBuffer = function () {
|
||
this.buffer = new Array();
|
||
this.length = 0;
|
||
}
|
||
|
||
QRCode.BitBuffer.prototype = {
|
||
|
||
get: function (index) {
|
||
var bufIndex = Math.floor(index / 8);
|
||
return ((this.buffer[bufIndex] >>> (7 - index % 8)) & 1) == 1;
|
||
},
|
||
|
||
put: function (num, length) {
|
||
for (var i = 0; i < length; i++) {
|
||
this.putBit(((num >>> (length - i - 1)) & 1) == 1);
|
||
}
|
||
},
|
||
|
||
getLengthInBits: function () {
|
||
return this.length;
|
||
},
|
||
|
||
putBit: function (bit) {
|
||
|
||
var bufIndex = Math.floor(this.length / 8);
|
||
if (this.buffer.length <= bufIndex) {
|
||
this.buffer.push(0);
|
||
}
|
||
|
||
if (bit) {
|
||
this.buffer[bufIndex] |= (0x80 >>> (this.length % 8));
|
||
}
|
||
|
||
this.length++;
|
||
}
|
||
};
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*
|
||
Copyright (c) 2011 Stefan Thomas
|
||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
*/
|
||
|
||
//https://raw.github.com/bitcoinjs/bitcoinjs-lib/1a7fc9d063f864058809d06ef4542af40be3558f/src/bitcoin.js
|
||
(function (exports) {
|
||
var Bitcoin = exports;
|
||
})(
|
||
'object' === typeof module ? module.exports : (window.Bitcoin = {})
|
||
);
|
||
</script>
|
||
<script type="text/javascript">
|
||
//https://raw.github.com/bitcoinjs/bitcoinjs-lib/c952aaeb3ee472e3776655b8ea07299ebed702c7/src/base58.js
|
||
(function (Bitcoin) {
|
||
Bitcoin.Base58 = {
|
||
alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",
|
||
validRegex: /^[1-9A-HJ-NP-Za-km-z]+$/,
|
||
base: BigInteger.valueOf(58),
|
||
|
||
/**
|
||
* Convert a byte array to a base58-encoded string.
|
||
*
|
||
* Written by Mike Hearn for BitcoinJ.
|
||
* Copyright (c) 2011 Google Inc.
|
||
*
|
||
* Ported to JavaScript by Stefan Thomas.
|
||
*/
|
||
encode: function (input) {
|
||
var bi = BigInteger.fromByteArrayUnsigned(input);
|
||
var chars = [];
|
||
|
||
while (bi.compareTo(B58.base) >= 0) {
|
||
var mod = bi.mod(B58.base);
|
||
chars.unshift(B58.alphabet[mod.intValue()]);
|
||
bi = bi.subtract(mod).divide(B58.base);
|
||
}
|
||
chars.unshift(B58.alphabet[bi.intValue()]);
|
||
|
||
// Convert leading zeros too.
|
||
for (var i = 0; i < input.length; i++) {
|
||
if (input[i] == 0x00) {
|
||
chars.unshift(B58.alphabet[0]);
|
||
} else break;
|
||
}
|
||
|
||
return chars.join('');
|
||
},
|
||
|
||
/**
|
||
* Convert a base58-encoded string to a byte array.
|
||
*
|
||
* Written by Mike Hearn for BitcoinJ.
|
||
* Copyright (c) 2011 Google Inc.
|
||
*
|
||
* Ported to JavaScript by Stefan Thomas.
|
||
*/
|
||
decode: function (input) {
|
||
var bi = BigInteger.valueOf(0);
|
||
var leadingZerosNum = 0;
|
||
for (var i = input.length - 1; i >= 0; i--) {
|
||
var alphaIndex = B58.alphabet.indexOf(input[i]);
|
||
if (alphaIndex < 0) {
|
||
throw "Invalid character";
|
||
}
|
||
bi = bi.add(BigInteger.valueOf(alphaIndex)
|
||
.multiply(B58.base.pow(input.length - 1 - i)));
|
||
|
||
// This counts leading zero bytes
|
||
if (input[i] == "1") leadingZerosNum++;
|
||
else leadingZerosNum = 0;
|
||
}
|
||
var bytes = bi.toByteArrayUnsigned();
|
||
|
||
// Add leading zeros
|
||
while (leadingZerosNum-- > 0) bytes.unshift(0);
|
||
|
||
return bytes;
|
||
}
|
||
};
|
||
|
||
var B58 = Bitcoin.Base58;
|
||
})(
|
||
'undefined' != typeof Bitcoin ? Bitcoin : module.exports
|
||
);
|
||
</script>
|
||
<script type="text/javascript">
|
||
//https://raw.github.com/bitcoinjs/bitcoinjs-lib/09e8c6e184d6501a0c2c59d73ca64db5c0d3eb95/src/address.js
|
||
Bitcoin.Address = function (bytes) {
|
||
this.hash = bytes;
|
||
this.version = Bitcoin.Address.networkVersion;
|
||
};
|
||
|
||
Bitcoin.Address.networkVersion = 0x3F; // mainnet
|
||
|
||
/**
|
||
* Serialize this object as a standard Bitcoin address.
|
||
*
|
||
* Returns the address as a base58-encoded string in the standardized format.
|
||
*/
|
||
Bitcoin.Address.prototype.toString = function () {
|
||
// Get a copy of the hash
|
||
var hash = (this.hash).toString().toLowerCase();
|
||
return create_address(hash);
|
||
};
|
||
|
||
Bitcoin.Address.prototype.getHashBase64 = function () {
|
||
return Crypto.util.bytesToBase64(this.hash);
|
||
};
|
||
|
||
/**
|
||
* Parse a Bitcoin address contained in a string.
|
||
*/
|
||
Bitcoin.Address.decodeString = function (string) {
|
||
var bytes = Bitcoin.Base58.decode(string);
|
||
var hash = bytes.slice(0, 21);
|
||
var checksum = Crypto.SHA256(Crypto.SHA256(hash, { asBytes: true }), { asBytes: true });
|
||
|
||
if (checksum[0] != bytes[21] ||
|
||
checksum[1] != bytes[22] ||
|
||
checksum[2] != bytes[23] ||
|
||
checksum[3] != bytes[24]) {
|
||
throw "Checksum validation failed!";
|
||
}
|
||
|
||
var version = hash.shift();
|
||
|
||
if (version != 0) {
|
||
throw "Version " + version + " not supported!";
|
||
}
|
||
|
||
return hash;
|
||
};
|
||
</script>
|
||
<script type="text/javascript">
|
||
//https://raw.github.com/bitcoinjs/bitcoinjs-lib/e90780d3d3b8fc0d027d2bcb38b80479902f223e/src/ecdsa.js
|
||
Bitcoin.ECDSA = (function () {
|
||
var ecparams = EllipticCurve.getSECCurveByName("secp256k1");
|
||
var rng = new SecureRandom();
|
||
|
||
var P_OVER_FOUR = null;
|
||
|
||
function implShamirsTrick(P, k, Q, l) {
|
||
var m = Math.max(k.bitLength(), l.bitLength());
|
||
var Z = P.add2D(Q);
|
||
var R = P.curve.getInfinity();
|
||
|
||
for (var i = m - 1; i >= 0; --i) {
|
||
R = R.twice2D();
|
||
|
||
R.z = BigInteger.ONE;
|
||
|
||
if (k.testBit(i)) {
|
||
if (l.testBit(i)) {
|
||
R = R.add2D(Z);
|
||
} else {
|
||
R = R.add2D(P);
|
||
}
|
||
} else {
|
||
if (l.testBit(i)) {
|
||
R = R.add2D(Q);
|
||
}
|
||
}
|
||
}
|
||
|
||
return R;
|
||
};
|
||
|
||
var ECDSA = {
|
||
getBigRandom: function (limit) {
|
||
return new BigInteger(limit.bitLength(), rng)
|
||
.mod(limit.subtract(BigInteger.ONE))
|
||
.add(BigInteger.ONE);
|
||
},
|
||
sign: function (hash, priv) {
|
||
var d = priv;
|
||
var n = ecparams.getN();
|
||
var e = BigInteger.fromByteArrayUnsigned(hash);
|
||
|
||
do {
|
||
var k = ECDSA.getBigRandom(n);
|
||
var G = ecparams.getG();
|
||
var Q = G.multiply(k);
|
||
var r = Q.getX().toBigInteger().mod(n);
|
||
} while (r.compareTo(BigInteger.ZERO) <= 0);
|
||
|
||
var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n);
|
||
|
||
return ECDSA.serializeSig(r, s);
|
||
},
|
||
|
||
verify: function (hash, sig, pubkey) {
|
||
var r, s;
|
||
if (Bitcoin.Util.isArray(sig)) {
|
||
var obj = ECDSA.parseSig(sig);
|
||
r = obj.r;
|
||
s = obj.s;
|
||
} else if ("object" === typeof sig && sig.r && sig.s) {
|
||
r = sig.r;
|
||
s = sig.s;
|
||
} else {
|
||
throw "Invalid value for signature";
|
||
}
|
||
|
||
var Q;
|
||
if (pubkey instanceof ec.PointFp) {
|
||
Q = pubkey;
|
||
} else if (Bitcoin.Util.isArray(pubkey)) {
|
||
Q = EllipticCurve.PointFp.decodeFrom(ecparams.getCurve(), pubkey);
|
||
} else {
|
||
throw "Invalid format for pubkey value, must be byte array or ec.PointFp";
|
||
}
|
||
var e = BigInteger.fromByteArrayUnsigned(hash);
|
||
|
||
return ECDSA.verifyRaw(e, r, s, Q);
|
||
},
|
||
|
||
verifyRaw: function (e, r, s, Q) {
|
||
var n = ecparams.getN();
|
||
var G = ecparams.getG();
|
||
|
||
if (r.compareTo(BigInteger.ONE) < 0 ||
|
||
r.compareTo(n) >= 0)
|
||
return false;
|
||
|
||
if (s.compareTo(BigInteger.ONE) < 0 ||
|
||
s.compareTo(n) >= 0)
|
||
return false;
|
||
|
||
var c = s.modInverse(n);
|
||
|
||
var u1 = e.multiply(c).mod(n);
|
||
var u2 = r.multiply(c).mod(n);
|
||
|
||
// TODO(!!!): For some reason Shamir's trick isn't working with
|
||
// signed message verification!? Probably an implementation
|
||
// error!
|
||
//var point = implShamirsTrick(G, u1, Q, u2);
|
||
var point = G.multiply(u1).add(Q.multiply(u2));
|
||
|
||
var v = point.getX().toBigInteger().mod(n);
|
||
|
||
return v.equals(r);
|
||
},
|
||
|
||
/**
|
||
* Serialize a signature into DER format.
|
||
*
|
||
* Takes two BigIntegers representing r and s and returns a byte array.
|
||
*/
|
||
serializeSig: function (r, s) {
|
||
var rBa = r.toByteArraySigned();
|
||
var sBa = s.toByteArraySigned();
|
||
|
||
var sequence = [];
|
||
sequence.push(0x02); // INTEGER
|
||
sequence.push(rBa.length);
|
||
sequence = sequence.concat(rBa);
|
||
|
||
sequence.push(0x02); // INTEGER
|
||
sequence.push(sBa.length);
|
||
sequence = sequence.concat(sBa);
|
||
|
||
sequence.unshift(sequence.length);
|
||
sequence.unshift(0x30); // SEQUENCE
|
||
|
||
return sequence;
|
||
},
|
||
|
||
/**
|
||
* Parses a byte array containing a DER-encoded signature.
|
||
*
|
||
* This function will return an object of the form:
|
||
*
|
||
* {
|
||
* r: BigInteger,
|
||
* s: BigInteger
|
||
* }
|
||
*/
|
||
parseSig: function (sig) {
|
||
var cursor;
|
||
if (sig[0] != 0x30)
|
||
throw new Error("Signature not a valid DERSequence");
|
||
|
||
cursor = 2;
|
||
if (sig[cursor] != 0x02)
|
||
throw new Error("First element in signature must be a DERInteger"); ;
|
||
var rBa = sig.slice(cursor + 2, cursor + 2 + sig[cursor + 1]);
|
||
|
||
cursor += 2 + sig[cursor + 1];
|
||
if (sig[cursor] != 0x02)
|
||
throw new Error("Second element in signature must be a DERInteger");
|
||
var sBa = sig.slice(cursor + 2, cursor + 2 + sig[cursor + 1]);
|
||
|
||
cursor += 2 + sig[cursor + 1];
|
||
|
||
//if (cursor != sig.length)
|
||
// throw new Error("Extra bytes in signature");
|
||
|
||
var r = BigInteger.fromByteArrayUnsigned(rBa);
|
||
var s = BigInteger.fromByteArrayUnsigned(sBa);
|
||
|
||
return { r: r, s: s };
|
||
},
|
||
|
||
parseSigCompact: function (sig) {
|
||
if (sig.length !== 65) {
|
||
throw "Signature has the wrong length";
|
||
}
|
||
|
||
// Signature is prefixed with a type byte storing three bits of
|
||
// information.
|
||
var i = sig[0] - 27;
|
||
if (i < 0 || i > 7) {
|
||
throw "Invalid signature type";
|
||
}
|
||
|
||
var n = ecparams.getN();
|
||
var r = BigInteger.fromByteArrayUnsigned(sig.slice(1, 33)).mod(n);
|
||
var s = BigInteger.fromByteArrayUnsigned(sig.slice(33, 65)).mod(n);
|
||
|
||
return { r: r, s: s, i: i };
|
||
},
|
||
|
||
/**
|
||
* Recover a public key from a signature.
|
||
*
|
||
* See SEC 1: Elliptic Curve Cryptography, section 4.1.6, "Public
|
||
* Key Recovery Operation".
|
||
*
|
||
* http://www.secg.org/download/aid-780/sec1-v2.pdf
|
||
*/
|
||
recoverPubKey: function (r, s, hash, i) {
|
||
// The recovery parameter i has two bits.
|
||
i = i & 3;
|
||
|
||
// The less significant bit specifies whether the y coordinate
|
||
// of the compressed point is even or not.
|
||
var isYEven = i & 1;
|
||
|
||
// The more significant bit specifies whether we should use the
|
||
// first or second candidate key.
|
||
var isSecondKey = i >> 1;
|
||
|
||
var n = ecparams.getN();
|
||
var G = ecparams.getG();
|
||
var curve = ecparams.getCurve();
|
||
var p = curve.getQ();
|
||
var a = curve.getA().toBigInteger();
|
||
var b = curve.getB().toBigInteger();
|
||
|
||
// We precalculate (p + 1) / 4 where p is if the field order
|
||
if (!P_OVER_FOUR) {
|
||
P_OVER_FOUR = p.add(BigInteger.ONE).divide(BigInteger.valueOf(4));
|
||
}
|
||
|
||
// 1.1 Compute x
|
||
var x = isSecondKey ? r.add(n) : r;
|
||
|
||
// 1.3 Convert x to point
|
||
var alpha = x.multiply(x).multiply(x).add(a.multiply(x)).add(b).mod(p);
|
||
var beta = alpha.modPow(P_OVER_FOUR, p);
|
||
|
||
var xorOdd = beta.isEven() ? (i % 2) : ((i + 1) % 2);
|
||
// If beta is even, but y isn't or vice versa, then convert it,
|
||
// otherwise we're done and y == beta.
|
||
var y = (beta.isEven() ? !isYEven : isYEven) ? beta : p.subtract(beta);
|
||
|
||
// 1.4 Check that nR is at infinity
|
||
var R = new EllipticCurve.PointFp(curve,
|
||
curve.fromBigInteger(x),
|
||
curve.fromBigInteger(y));
|
||
R.validate();
|
||
|
||
// 1.5 Compute e from M
|
||
var e = BigInteger.fromByteArrayUnsigned(hash);
|
||
var eNeg = BigInteger.ZERO.subtract(e).mod(n);
|
||
|
||
// 1.6 Compute Q = r^-1 (sR - eG)
|
||
var rInv = r.modInverse(n);
|
||
var Q = implShamirsTrick(R, s, G, eNeg).multiply(rInv);
|
||
|
||
Q.validate();
|
||
if (!ECDSA.verifyRaw(e, r, s, Q)) {
|
||
throw "Pubkey recovery unsuccessful";
|
||
}
|
||
|
||
var pubKey = new Bitcoin.ECKey();
|
||
pubKey.pub = Q;
|
||
return pubKey;
|
||
},
|
||
|
||
/**
|
||
* Calculate pubkey extraction parameter.
|
||
*
|
||
* When extracting a pubkey from a signature, we have to
|
||
* distinguish four different cases. Rather than putting this
|
||
* burden on the verifier, Bitcoin includes a 2-bit value with the
|
||
* signature.
|
||
*
|
||
* This function simply tries all four cases and returns the value
|
||
* that resulted in a successful pubkey recovery.
|
||
*/
|
||
calcPubkeyRecoveryParam: function (address, r, s, hash) {
|
||
for (var i = 0; i < 4; i++) {
|
||
try {
|
||
var pubkey = Bitcoin.ECDSA.recoverPubKey(r, s, hash, i);
|
||
if (pubkey.getBitcoinAddress().toString() == address) {
|
||
return i;
|
||
}
|
||
} catch (e) { }
|
||
}
|
||
throw "Unable to find valid recovery factor";
|
||
}
|
||
};
|
||
|
||
return ECDSA;
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
Bitcoin.KeyPool = (function () {
|
||
var KeyPool = function () {
|
||
this.keyArray = [];
|
||
|
||
this.push = function (item) {
|
||
if (item == null || item.priv == null) return;
|
||
var doAdd = true;
|
||
// prevent duplicates from being added to the array
|
||
for (var index in this.keyArray) {
|
||
var currentItem = this.keyArray[index];
|
||
if (currentItem != null && currentItem.priv != null && item.getBitcoinAddress() == currentItem.getBitcoinAddress()) {
|
||
doAdd = false;
|
||
break;
|
||
}
|
||
}
|
||
if (doAdd) this.keyArray.push(item);
|
||
};
|
||
|
||
this.reset = function () {
|
||
this.keyArray = [];
|
||
};
|
||
|
||
this.getArray = function () {
|
||
// copy array
|
||
return this.keyArray.slice(0);
|
||
};
|
||
|
||
this.setArray = function (ka) {
|
||
this.keyArray = ka;
|
||
};
|
||
|
||
this.length = function () {
|
||
return this.keyArray.length;
|
||
};
|
||
|
||
this.toString = function () {
|
||
var keyPoolString = "# = " + this.length() + "\n";
|
||
var pool = this.getArray();
|
||
for (var index in pool) {
|
||
var item = pool[index];
|
||
if (Bitcoin.Util.hasMethods(item, 'getBitcoinAddress', 'toString')) {
|
||
if (item != null) {
|
||
keyPoolString += "\"" + item.getBitcoinAddress() + "\"" + ", \"" + item.toString("wif") + "\"\n";
|
||
}
|
||
}
|
||
}
|
||
|
||
return keyPoolString;
|
||
};
|
||
|
||
return this;
|
||
};
|
||
|
||
return new KeyPool();
|
||
})();
|
||
|
||
Bitcoin.Bip38Key = (function () {
|
||
var Bip38 = function (address, encryptedKey) {
|
||
this.address = address;
|
||
this.priv = encryptedKey;
|
||
};
|
||
|
||
Bip38.prototype.getBitcoinAddress = function () {
|
||
return this.address;
|
||
};
|
||
|
||
Bip38.prototype.toString = function () {
|
||
return this.priv;
|
||
};
|
||
|
||
return Bip38;
|
||
})();
|
||
|
||
//https://raw.github.com/pointbiz/bitcoinjs-lib/9b2f94a028a7bc9bed94e0722563e9ff1d8e8db8/src/eckey.js
|
||
Bitcoin.ECKey = (function () {
|
||
var ECDSA = Bitcoin.ECDSA;
|
||
var KeyPool = Bitcoin.KeyPool;
|
||
var ecparams = EllipticCurve.getSECCurveByName("secp256k1");
|
||
|
||
var ECKey = function (input) {
|
||
if (!input) {
|
||
// Generate new key
|
||
var n = ecparams.getN();
|
||
this.priv = ECDSA.getBigRandom(n);
|
||
} else if (input instanceof BigInteger) {
|
||
// Input is a private key value
|
||
this.priv = input;
|
||
} else if (Bitcoin.Util.isArray(input)) {
|
||
// Prepend zero byte to prevent interpretation as negative integer
|
||
this.priv = BigInteger.fromByteArrayUnsigned(input);
|
||
} else if ("string" == typeof input) {
|
||
var bytes = null;
|
||
try{
|
||
if (ECKey.isWalletImportFormat(input)) {
|
||
bytes = ECKey.decodeWalletImportFormat(input);
|
||
} else if (ECKey.isCompressedWalletImportFormat(input)) {
|
||
bytes = ECKey.decodeCompressedWalletImportFormat(input);
|
||
this.compressed = true;
|
||
} else if (ECKey.isMiniFormat(input)) {
|
||
bytes = Crypto.SHA256(input, { asBytes: true });
|
||
} else if (ECKey.isHexFormat(input)) {
|
||
bytes = Crypto.util.hexToBytes(input);
|
||
} else if (ECKey.isBase64Format(input)) {
|
||
bytes = Crypto.util.base64ToBytes(input);
|
||
}
|
||
} catch (exc1) {
|
||
this.setError(exc1);
|
||
}
|
||
|
||
if (ECKey.isBase6Format(input)) {
|
||
this.priv = new BigInteger(input, 6);
|
||
} else if (bytes == null || bytes.length != 32) {
|
||
this.priv = null;
|
||
} else {
|
||
// Prepend zero byte to prevent interpretation as negative integer
|
||
this.priv = BigInteger.fromByteArrayUnsigned(bytes);
|
||
}
|
||
}
|
||
|
||
this.compressed = (this.compressed == undefined) ? !!ECKey.compressByDefault : this.compressed;
|
||
try {
|
||
// check not zero
|
||
if (this.priv != null && BigInteger.ZERO.compareTo(this.priv) == 0) this.setError("Error: BigInteger equal to zero.");
|
||
// valid range [0x1, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140])
|
||
var hexKeyRangeLimit = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140";
|
||
var rangeLimitBytes = Crypto.util.hexToBytes(hexKeyRangeLimit);
|
||
var limitBigInt = BigInteger.fromByteArrayUnsigned(rangeLimitBytes);
|
||
if (this.priv != null && limitBigInt.compareTo(this.priv) < 0) this.setError("Error: BigInteger outside of curve range.")
|
||
|
||
if (this.priv != null) {
|
||
KeyPool.push(this);
|
||
}
|
||
} catch (exc2) {
|
||
this.setError(exc2);
|
||
}
|
||
};
|
||
|
||
ECKey.privateKeyPrefix = 0xBF; // mainnet 0x80 testnet 0xEF
|
||
|
||
/**
|
||
* Whether public keys should be returned compressed by default.
|
||
*/
|
||
ECKey.compressByDefault = false;
|
||
|
||
/**
|
||
* Set whether the public key should be returned compressed or not.
|
||
*/
|
||
ECKey.prototype.setError = function (err) {
|
||
this.error = err;
|
||
this.priv = null;
|
||
return this;
|
||
};
|
||
|
||
/**
|
||
* Set whether the public key should be returned compressed or not.
|
||
*/
|
||
ECKey.prototype.setCompressed = function (v) {
|
||
this.compressed = !!v;
|
||
if (this.pubPoint) this.pubPoint.compressed = this.compressed;
|
||
return this;
|
||
};
|
||
|
||
/*
|
||
* Return public key as a byte array in DER encoding
|
||
*/
|
||
ECKey.prototype.getPub = function () {
|
||
if (this.compressed) {
|
||
if (this.pubComp) return this.pubComp;
|
||
return this.pubComp = this.getPubPoint().getEncoded(1);
|
||
} else {
|
||
if (this.pubUncomp) return this.pubUncomp;
|
||
return this.pubUncomp = this.getPubPoint().getEncoded(0);
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Return public point as ECPoint object.
|
||
*/
|
||
ECKey.prototype.getPubPoint = function () {
|
||
if (!this.pubPoint) {
|
||
this.pubPoint = ecparams.getG().multiply(this.priv);
|
||
this.pubPoint.compressed = this.compressed;
|
||
}
|
||
return this.pubPoint;
|
||
};
|
||
|
||
ECKey.prototype.getPubKeyHex = function () {
|
||
if (this.compressed) {
|
||
if (this.pubKeyHexComp) return this.pubKeyHexComp;
|
||
return this.pubKeyHexComp = Crypto.util.bytesToHex(this.getPub()).toString().toUpperCase();
|
||
} else {
|
||
if (this.pubKeyHexUncomp) return this.pubKeyHexUncomp;
|
||
return this.pubKeyHexUncomp = Crypto.util.bytesToHex(this.getPub()).toString().toUpperCase();
|
||
}
|
||
};
|
||
|
||
/**
|
||
* Get the pubKeyHash for this key.
|
||
*
|
||
* This is calculated as RIPE160(SHA256([encoded pubkey])) and returned as
|
||
* a byte array.
|
||
*/
|
||
ECKey.prototype.getPubKeyHash = function () {
|
||
if (this.compressed) {
|
||
if (this.pubKeyHashComp) return this.pubKeyHashComp;
|
||
return this.pubKeyHashComp = Bitcoin.Util.sha256ripe160(this.getPub());
|
||
} else {
|
||
if (this.pubKeyHashUncomp) return this.pubKeyHashUncomp;
|
||
return this.pubKeyHashUncomp = Bitcoin.Util.sha256ripe160(this.getPub());
|
||
}
|
||
};
|
||
|
||
ECKey.prototype.getBitcoinAddress = function () {
|
||
var hash = this.getPubKeyHex();
|
||
var addr = new Bitcoin.Address(hash);
|
||
return addr.toString();
|
||
};
|
||
|
||
/*
|
||
* Takes a public point as a hex string or byte array
|
||
*/
|
||
ECKey.prototype.setPub = function (pub) {
|
||
// byte array
|
||
if (Bitcoin.Util.isArray(pub)) {
|
||
pub = Crypto.util.bytesToHex(pub).toString().toUpperCase();
|
||
}
|
||
var ecPoint = ecparams.getCurve().decodePointHex(pub);
|
||
this.setCompressed(ecPoint.compressed);
|
||
this.pubPoint = ecPoint;
|
||
return this;
|
||
};
|
||
|
||
// Sipa Private Key Wallet Import Format
|
||
ECKey.prototype.getBitcoinWalletImportFormat = function () {
|
||
var bytes = this.getBitcoinHexFormat().toLowerCase();
|
||
return prvKey_to_WIF(bytes, this.compressed);
|
||
};
|
||
|
||
// Private Key Hex Format
|
||
ECKey.prototype.getBitcoinHexFormat = function () {
|
||
return Crypto.util.bytesToHex(this.getBitcoinPrivateKeyByteArray()).toString().toUpperCase();
|
||
};
|
||
|
||
// Private Key Base64 Format
|
||
ECKey.prototype.getBitcoinBase64Format = function () {
|
||
return Crypto.util.bytesToBase64(this.getBitcoinPrivateKeyByteArray());
|
||
};
|
||
|
||
ECKey.prototype.getBitcoinPrivateKeyByteArray = function () {
|
||
if (this.priv == null) return null;
|
||
// Get a copy of private key as a byte array
|
||
var bytes = this.priv.toByteArrayUnsigned();
|
||
// zero pad if private key is less than 32 bytes
|
||
while (bytes.length < 32) bytes.unshift(0x00);
|
||
return bytes;
|
||
};
|
||
|
||
ECKey.prototype.toString = function (format) {
|
||
format = format || "";
|
||
if (format.toString().toLowerCase() == "base64" || format.toString().toLowerCase() == "b64") {
|
||
return this.getBitcoinBase64Format();
|
||
}
|
||
// Wallet Import Format
|
||
else if (format.toString().toLowerCase() == "wif") {
|
||
return this.getBitcoinWalletImportFormat();
|
||
}
|
||
else {
|
||
return this.getBitcoinHexFormat();
|
||
}
|
||
};
|
||
|
||
ECKey.prototype.sign = function (hash) {
|
||
return ECDSA.sign(hash, this.priv);
|
||
};
|
||
|
||
ECKey.prototype.verify = function (hash, sig) {
|
||
return ECDSA.verify(hash, sig, this.getPub());
|
||
};
|
||
|
||
/**
|
||
* Parse a wallet import format private key contained in a string.
|
||
*/
|
||
ECKey.decodeWalletImportFormat = function (privStr) {
|
||
var bytes = Bitcoin.Base58.decode(privStr);
|
||
var hash = bytes.slice(0, 33);
|
||
var checksum = Crypto.SHA256(Crypto.SHA256(hash, { asBytes: true }), { asBytes: true });
|
||
if (checksum[0] != bytes[33] ||
|
||
checksum[1] != bytes[34] ||
|
||
checksum[2] != bytes[35] ||
|
||
checksum[3] != bytes[36]) {
|
||
throw "Checksum validation failed!";
|
||
}
|
||
var version = hash.shift();
|
||
if (version != ECKey.privateKeyPrefix) {
|
||
throw "Version " + version + " not supported!";
|
||
}
|
||
return hash;
|
||
};
|
||
|
||
/**
|
||
* Parse a compressed wallet import format private key contained in a string.
|
||
*/
|
||
ECKey.decodeCompressedWalletImportFormat = function (privStr) {
|
||
var bytes = Bitcoin.Base58.decode(privStr);
|
||
var hash = bytes.slice(0, 34);
|
||
var checksum = Crypto.SHA256(Crypto.SHA256(hash, { asBytes: true }), { asBytes: true });
|
||
if (checksum[0] != bytes[34] ||
|
||
checksum[1] != bytes[35] ||
|
||
checksum[2] != bytes[36] ||
|
||
checksum[3] != bytes[37]) {
|
||
throw "Checksum validation failed!";
|
||
}
|
||
var version = hash.shift();
|
||
if (version != ECKey.privateKeyPrefix) {
|
||
throw "Version " + version + " not supported!";
|
||
}
|
||
hash.pop();
|
||
return hash;
|
||
};
|
||
|
||
// 64 characters [0-9A-F]
|
||
ECKey.isHexFormat = function (key) {
|
||
key = key.toString();
|
||
return /^[A-Fa-f0-9]{64}$/.test(key);
|
||
};
|
||
|
||
// 51 characters base58, always starts with a '5'
|
||
ECKey.isWalletImportFormat = function (key) {
|
||
key = key.toString();
|
||
return (ECKey.privateKeyPrefix == 0xBF) ?
|
||
(/^7[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{50}$/.test(key)) :
|
||
(/^6[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{50}$/.test(key));
|
||
};
|
||
|
||
// 52 characters base58
|
||
ECKey.isCompressedWalletImportFormat = function (key) {
|
||
key = key.toString();
|
||
return (ECKey.privateKeyPrefix == 0xBF) ?
|
||
(/^V[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(key)) :
|
||
(/^T[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(key));
|
||
};
|
||
|
||
// 44 characters
|
||
ECKey.isBase64Format = function (key) {
|
||
key = key.toString();
|
||
return (/^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=+\/]{44}$/.test(key));
|
||
};
|
||
|
||
// 99 characters, 1=1, if using dice convert 6 to 0
|
||
ECKey.isBase6Format = function (key) {
|
||
key = key.toString();
|
||
return (/^[012345]{99}$/.test(key));
|
||
};
|
||
|
||
// 22, 26 or 30 characters, always starts with an 'S'
|
||
ECKey.isMiniFormat = function (key) {
|
||
key = key.toString();
|
||
var validChars22 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21}$/.test(key);
|
||
var validChars26 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{25}$/.test(key);
|
||
var validChars30 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{29}$/.test(key);
|
||
var testBytes = Crypto.SHA256(key + "?", { asBytes: true });
|
||
|
||
return ((testBytes[0] === 0x00 || testBytes[0] === 0x01) && (validChars22 || validChars26 || validChars30));
|
||
};
|
||
|
||
return ECKey;
|
||
})();
|
||
</script>
|
||
<script type="text/javascript">
|
||
//https://raw.github.com/bitcoinjs/bitcoinjs-lib/09e8c6e184d6501a0c2c59d73ca64db5c0d3eb95/src/util.js
|
||
// Bitcoin utility functions
|
||
Bitcoin.Util = {
|
||
/**
|
||
* Cross-browser compatibility version of Array.isArray.
|
||
*/
|
||
isArray: Array.isArray || function (o) {
|
||
return Object.prototype.toString.call(o) === '[object Array]';
|
||
},
|
||
/**
|
||
* Create an array of a certain length filled with a specific value.
|
||
*/
|
||
makeFilledArray: function (len, val) {
|
||
var array = [];
|
||
var i = 0;
|
||
while (i < len) {
|
||
array[i++] = val;
|
||
}
|
||
return array;
|
||
},
|
||
/**
|
||
* Turn an integer into a "var_int".
|
||
*
|
||
* "var_int" is a variable length integer used by Bitcoin's binary format.
|
||
*
|
||
* Returns a byte array.
|
||
*/
|
||
numToVarInt: function (i) {
|
||
if (i < 0xfd) {
|
||
// unsigned char
|
||
return [i];
|
||
} else if (i <= 1 << 16) {
|
||
// unsigned short (LE)
|
||
return [0xfd, i >>> 8, i & 255];
|
||
} else if (i <= 1 << 32) {
|
||
// unsigned int (LE)
|
||
return [0xfe].concat(Crypto.util.wordsToBytes([i]));
|
||
} else {
|
||
// unsigned long long (LE)
|
||
return [0xff].concat(Crypto.util.wordsToBytes([i >>> 32, i]));
|
||
}
|
||
},
|
||
/**
|
||
* Parse a Bitcoin value byte array, returning a BigInteger.
|
||
*/
|
||
valueToBigInt: function (valueBuffer) {
|
||
if (valueBuffer instanceof BigInteger) return valueBuffer;
|
||
|
||
// Prepend zero byte to prevent interpretation as negative integer
|
||
return BigInteger.fromByteArrayUnsigned(valueBuffer);
|
||
},
|
||
/**
|
||
* Format a Bitcoin value as a string.
|
||
*
|
||
* Takes a BigInteger or byte-array and returns that amount of Bitcoins in a
|
||
* nice standard formatting.
|
||
*
|
||
* Examples:
|
||
* 12.3555
|
||
* 0.1234
|
||
* 900.99998888
|
||
* 34.00
|
||
*/
|
||
formatValue: function (valueBuffer) {
|
||
var value = this.valueToBigInt(valueBuffer).toString();
|
||
var integerPart = value.length > 8 ? value.substr(0, value.length - 8) : '0';
|
||
var decimalPart = value.length > 8 ? value.substr(value.length - 8) : value;
|
||
while (decimalPart.length < 8) decimalPart = "0" + decimalPart;
|
||
decimalPart = decimalPart.replace(/0*$/, '');
|
||
while (decimalPart.length < 2) decimalPart += "0";
|
||
return integerPart + "." + decimalPart;
|
||
},
|
||
/**
|
||
* Parse a floating point string as a Bitcoin value.
|
||
*
|
||
* Keep in mind that parsing user input is messy. You should always display
|
||
* the parsed value back to the user to make sure we understood his input
|
||
* correctly.
|
||
*/
|
||
parseValue: function (valueString) {
|
||
// TODO: Detect other number formats (e.g. comma as decimal separator)
|
||
var valueComp = valueString.split('.');
|
||
var integralPart = valueComp[0];
|
||
var fractionalPart = valueComp[1] || "0";
|
||
while (fractionalPart.length < 8) fractionalPart += "0";
|
||
fractionalPart = fractionalPart.replace(/^0+/g, '');
|
||
var value = BigInteger.valueOf(parseInt(integralPart));
|
||
value = value.multiply(BigInteger.valueOf(100000000));
|
||
value = value.add(BigInteger.valueOf(parseInt(fractionalPart)));
|
||
return value;
|
||
},
|
||
/**
|
||
* Calculate RIPEMD160(SHA256(data)).
|
||
*
|
||
* Takes an arbitrary byte array as inputs and returns the hash as a byte
|
||
* array.
|
||
*/
|
||
sha256ripe160: function (data) {
|
||
return Crypto.RIPEMD160(Crypto.SHA256(data, { asBytes: true }), { asBytes: true });
|
||
},
|
||
// double sha256
|
||
dsha256: function (data) {
|
||
return Crypto.SHA256(Crypto.SHA256(data, { asBytes: true }), { asBytes: true });
|
||
},
|
||
// duck typing method
|
||
hasMethods: function(obj /*, method list as strings */){
|
||
var i = 1, methodName;
|
||
while((methodName = arguments[i++])){
|
||
if(typeof obj[methodName] != 'function') {
|
||
return false;
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
};
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*
|
||
* Copyright (c) 2010-2011 Intalio Pte, All Rights Reserved
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to deal
|
||
* in the Software without restriction, including without limitation the rights
|
||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
* copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in
|
||
* all copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||
* THE SOFTWARE.
|
||
*/
|
||
// https://github.com/cheongwy/node-scrypt-js
|
||
(function () {
|
||
|
||
var MAX_VALUE = 2147483647;
|
||
var workerUrl = null;
|
||
|
||
//function scrypt(byte[] passwd, byte[] salt, int N, int r, int p, int dkLen)
|
||
/*
|
||
* N = Cpu cost
|
||
* r = Memory cost
|
||
* p = parallelization cost
|
||
*
|
||
*/
|
||
window.Crypto_scrypt = function (passwd, salt, N, r, p, dkLen, callback) {
|
||
if (N == 0 || (N & (N - 1)) != 0) throw Error("N must be > 0 and a power of 2");
|
||
|
||
if (N > MAX_VALUE / 128 / r) throw Error("Parameter N is too large");
|
||
if (r > MAX_VALUE / 128 / p) throw Error("Parameter r is too large");
|
||
|
||
var PBKDF2_opts = { iterations: 1, hasher: Crypto.SHA256, asBytes: true };
|
||
|
||
var B = Crypto.PBKDF2(passwd, salt, p * 128 * r, PBKDF2_opts);
|
||
|
||
try {
|
||
var i = 0;
|
||
var worksDone = 0;
|
||
var makeWorker = function () {
|
||
if (!workerUrl) {
|
||
var code = '(' + scryptCore.toString() + ')()';
|
||
var blob;
|
||
try {
|
||
blob = new Blob([code], { type: "text/javascript" });
|
||
} catch (e) {
|
||
window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;
|
||
blob = new BlobBuilder();
|
||
blob.append(code);
|
||
blob = blob.getBlob("text/javascript");
|
||
}
|
||
workerUrl = URL.createObjectURL(blob);
|
||
}
|
||
var worker = new Worker(workerUrl);
|
||
worker.onmessage = function (event) {
|
||
var Bi = event.data[0], Bslice = event.data[1];
|
||
worksDone++;
|
||
|
||
if (i < p) {
|
||
worker.postMessage([N, r, p, B, i++]);
|
||
}
|
||
|
||
var length = Bslice.length, destPos = Bi * 128 * r, srcPos = 0;
|
||
while (length--) {
|
||
B[destPos++] = Bslice[srcPos++];
|
||
}
|
||
|
||
if (worksDone == p) {
|
||
callback(Crypto.PBKDF2(passwd, B, dkLen, PBKDF2_opts));
|
||
}
|
||
};
|
||
return worker;
|
||
};
|
||
var workers = [makeWorker(), makeWorker()];
|
||
workers[0].postMessage([N, r, p, B, i++]);
|
||
if (p > 1) {
|
||
workers[1].postMessage([N, r, p, B, i++]);
|
||
}
|
||
} catch (e) {
|
||
window.setTimeout(function () {
|
||
scryptCore();
|
||
callback(Crypto.PBKDF2(passwd, B, dkLen, PBKDF2_opts));
|
||
}, 0);
|
||
}
|
||
|
||
// using this function to enclose everything needed to create a worker (but also invokable directly for synchronous use)
|
||
function scryptCore() {
|
||
var XY = [], V = [];
|
||
|
||
if (typeof B === 'undefined') {
|
||
onmessage = function (event) {
|
||
var data = event.data;
|
||
var N = data[0], r = data[1], p = data[2], B = data[3], i = data[4];
|
||
|
||
var Bslice = [];
|
||
arraycopy32(B, i * 128 * r, Bslice, 0, 128 * r);
|
||
smix(Bslice, 0, r, N, V, XY);
|
||
|
||
postMessage([i, Bslice]);
|
||
};
|
||
} else {
|
||
for (var i = 0; i < p; i++) {
|
||
smix(B, i * 128 * r, r, N, V, XY);
|
||
}
|
||
}
|
||
|
||
function smix(B, Bi, r, N, V, XY) {
|
||
var Xi = 0;
|
||
var Yi = 128 * r;
|
||
var i;
|
||
|
||
arraycopy32(B, Bi, XY, Xi, Yi);
|
||
|
||
for (i = 0; i < N; i++) {
|
||
arraycopy32(XY, Xi, V, i * Yi, Yi);
|
||
blockmix_salsa8(XY, Xi, Yi, r);
|
||
}
|
||
|
||
for (i = 0; i < N; i++) {
|
||
var j = integerify(XY, Xi, r) & (N - 1);
|
||
blockxor(V, j * Yi, XY, Xi, Yi);
|
||
blockmix_salsa8(XY, Xi, Yi, r);
|
||
}
|
||
|
||
arraycopy32(XY, Xi, B, Bi, Yi);
|
||
}
|
||
|
||
function blockmix_salsa8(BY, Bi, Yi, r) {
|
||
var X = [];
|
||
var i;
|
||
|
||
arraycopy32(BY, Bi + (2 * r - 1) * 64, X, 0, 64);
|
||
|
||
for (i = 0; i < 2 * r; i++) {
|
||
blockxor(BY, i * 64, X, 0, 64);
|
||
salsa20_8(X);
|
||
arraycopy32(X, 0, BY, Yi + (i * 64), 64);
|
||
}
|
||
|
||
for (i = 0; i < r; i++) {
|
||
arraycopy32(BY, Yi + (i * 2) * 64, BY, Bi + (i * 64), 64);
|
||
}
|
||
|
||
for (i = 0; i < r; i++) {
|
||
arraycopy32(BY, Yi + (i * 2 + 1) * 64, BY, Bi + (i + r) * 64, 64);
|
||
}
|
||
}
|
||
|
||
function R(a, b) {
|
||
return (a << b) | (a >>> (32 - b));
|
||
}
|
||
|
||
function salsa20_8(B) {
|
||
var B32 = new Array(32);
|
||
var x = new Array(32);
|
||
var i;
|
||
|
||
for (i = 0; i < 16; i++) {
|
||
B32[i] = (B[i * 4 + 0] & 0xff) << 0;
|
||
B32[i] |= (B[i * 4 + 1] & 0xff) << 8;
|
||
B32[i] |= (B[i * 4 + 2] & 0xff) << 16;
|
||
B32[i] |= (B[i * 4 + 3] & 0xff) << 24;
|
||
}
|
||
|
||
arraycopy(B32, 0, x, 0, 16);
|
||
|
||
for (i = 8; i > 0; i -= 2) {
|
||
x[4] ^= R(x[0] + x[12], 7); x[8] ^= R(x[4] + x[0], 9);
|
||
x[12] ^= R(x[8] + x[4], 13); x[0] ^= R(x[12] + x[8], 18);
|
||
x[9] ^= R(x[5] + x[1], 7); x[13] ^= R(x[9] + x[5], 9);
|
||
x[1] ^= R(x[13] + x[9], 13); x[5] ^= R(x[1] + x[13], 18);
|
||
x[14] ^= R(x[10] + x[6], 7); x[2] ^= R(x[14] + x[10], 9);
|
||
x[6] ^= R(x[2] + x[14], 13); x[10] ^= R(x[6] + x[2], 18);
|
||
x[3] ^= R(x[15] + x[11], 7); x[7] ^= R(x[3] + x[15], 9);
|
||
x[11] ^= R(x[7] + x[3], 13); x[15] ^= R(x[11] + x[7], 18);
|
||
x[1] ^= R(x[0] + x[3], 7); x[2] ^= R(x[1] + x[0], 9);
|
||
x[3] ^= R(x[2] + x[1], 13); x[0] ^= R(x[3] + x[2], 18);
|
||
x[6] ^= R(x[5] + x[4], 7); x[7] ^= R(x[6] + x[5], 9);
|
||
x[4] ^= R(x[7] + x[6], 13); x[5] ^= R(x[4] + x[7], 18);
|
||
x[11] ^= R(x[10] + x[9], 7); x[8] ^= R(x[11] + x[10], 9);
|
||
x[9] ^= R(x[8] + x[11], 13); x[10] ^= R(x[9] + x[8], 18);
|
||
x[12] ^= R(x[15] + x[14], 7); x[13] ^= R(x[12] + x[15], 9);
|
||
x[14] ^= R(x[13] + x[12], 13); x[15] ^= R(x[14] + x[13], 18);
|
||
}
|
||
|
||
for (i = 0; i < 16; ++i) B32[i] = x[i] + B32[i];
|
||
|
||
for (i = 0; i < 16; i++) {
|
||
var bi = i * 4;
|
||
B[bi + 0] = (B32[i] >> 0 & 0xff);
|
||
B[bi + 1] = (B32[i] >> 8 & 0xff);
|
||
B[bi + 2] = (B32[i] >> 16 & 0xff);
|
||
B[bi + 3] = (B32[i] >> 24 & 0xff);
|
||
}
|
||
}
|
||
|
||
function blockxor(S, Si, D, Di, len) {
|
||
var i = len >> 6;
|
||
while (i--) {
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
D[Di++] ^= S[Si++]; D[Di++] ^= S[Si++];
|
||
}
|
||
}
|
||
|
||
function integerify(B, bi, r) {
|
||
var n;
|
||
|
||
bi += (2 * r - 1) * 64;
|
||
|
||
n = (B[bi + 0] & 0xff) << 0;
|
||
n |= (B[bi + 1] & 0xff) << 8;
|
||
n |= (B[bi + 2] & 0xff) << 16;
|
||
n |= (B[bi + 3] & 0xff) << 24;
|
||
|
||
return n;
|
||
}
|
||
|
||
function arraycopy(src, srcPos, dest, destPos, length) {
|
||
while (length--) {
|
||
dest[destPos++] = src[srcPos++];
|
||
}
|
||
}
|
||
|
||
function arraycopy32(src, srcPos, dest, destPos, length) {
|
||
var i = length >> 5;
|
||
while (i--) {
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++];
|
||
}
|
||
}
|
||
} // scryptCore
|
||
}; // window.Crypto_scrypt
|
||
})();
|
||
</script>
|
||
<style type="text/css">
|
||
.more { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDEvMDIvMTLltnQyAAAB1UlEQVQ4jYWTS04bQRCGv3q0x8gMYJCwknCGLDgLVwiH4grhLFaUXdhkQ0A8pBg/FOLpnmbhMYzxRKlNS1Vdf/31V5XknGnb+eXJCBjzbzu9OLu+azu845Opysej4wHmshF4uJ2TUrb3CV0gIBAKRboC5C2vdkDE9fdty6/xDegvXz+NgDbFUejZ+PjDgExmtpxS9vYwMe5u5iyX8RRoa5Ic+C4qx9KUN1MGu4E618yqJ5axAp44KA7ZL3eYzp/HKdVIw7WK8d6BuDvcod9TQlBEIOXEdPlElSoUJabIIs4Z7h9yNDwgqOMayLXw7epHVIBggrsgspZPUBQyiCgugRQji7TAVDF1XB2TlQoOYCqovkmpopS9fcoiM3ue0rOCYf8IU8NklWxiiOQ3EPXtWagIqo6KYWYEc4IGvMViA6RrnCJKVS9B8ypRHG1YKNa0Ur+C+MPt/I2BKWVZUO4FgvQ47PcptEDF+T2Z8TiZUMWIyGtpd+Bze5VTSqP57O/4YG+AN/RXbSiPkwmL5z/be/L+mM4vT2JKeUW7EXD1erMz/Lo4u77f0K9DDhdA1XG11jh9vWBb99Z9gAg5QZ2hzpmUa0RSW4f/gqSY0s3Vz+tufEjvHS8Tg6BXC7qVbQAAAABJRU5ErkJggg==)
|
||
no-repeat left center; width: 17px; height: 17px; display: inline-block; float: right; cursor: pointer; }
|
||
.less { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAARCAYAAAA7bUf6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK6wAACusBgosNWgAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDEvMDIvMTLltnQyAAABuklEQVQ4ja2US25TQRBFT336OSEY5ESyBfEakNiLt0AW5S2QvQQxAiZIYBwSz/yByH7dxcB2bPMME+hJS/W5fetWVUtE8K/HfzdcXfdfqsr4onuGuRz4Jrdzcg6Gg9HfQYAxAqmlSMMlQJO5/oliE4AtQLcR++btZQ+wPVsvVXbTfXFGEMyWU9rVM0yMu/Gc5bJ+DdztxWcH3otKVzbPmyq5LnwfzSgEBMxlhqJEBFWVKKUgG66rur53oH7aOeWkUlJSRCBHZracssorlLXttHpCpzonaYukjmsiivDu08daAZIJ7oLIVg9BUQgQUVwSua5Z5AWmiqnj6pisVXAAU0F1J6WK0q6e024Fs4cplbXonFxgapisk00MkdiBqDd7oSKoOiqGmZHMSZrwPRYHIMfaKaKsyhI01oni6IaFYptSyiOIT27nOwaq5FyQrUAIC/nBhK+UErRSos55z4878CrneJyTnHOvquymf3mOb+hvy/jw+QuLh5/NORkORvsGrq77dc6xpr0RcH07y3oF8G04GN0f6HdEDhdA1XG1vXb6dsAa+3Z8AREiQwkoEeQoiBzocHDkf/wnvwC5IpRVsUDNUgAAAABJRU5ErkJggg==)
|
||
no-repeat left center; width: 17px; height: 17px; display: inline-block; float: right; }
|
||
a { position: relative; z-index: 20; }
|
||
.right { text-align: right; }
|
||
.walletarea { display: none; border: 2px solid #f4b517; }
|
||
hr { margin: 20px 0; border-top: 2px dashed #008000; }
|
||
.keyarea { height: 110px; text-align: left; position: relative; padding: 5px; }
|
||
.keyarea .public { float: left; }
|
||
.keyarea .pubaddress { display: inline-block; height: 40px; padding: 0 0 0 10px; float: left; }
|
||
.keyarea .privwif { margin: 0; float: right; text-align: right; padding: 0 20px 0 0; position: relative; }
|
||
.keyarea .label { font-weight: bold; }
|
||
.keyarea .output { display: block; font-family: monospace; font-size: 1.25em; }
|
||
.keyarea .qrcode_public { display: inline-block; float: left; }
|
||
.keyarea .qrcode_private { display: inline-block; position: relative; top: 28px; float: right; }
|
||
.pubkeyhex { word-wrap: break-word; }
|
||
.keyarea .public .pubaddress .output, .keyarea .private .privwif .output { text-align: center; }
|
||
#SinglePubAddressBG { background-color: white; width: 305px; }
|
||
#SinglePrivWifBG { background-color: white; width: 470px; left: 90px; }
|
||
.keyarea .public .qrcode_public canvas, .keyarea .private .qrcode_private canvas { background-color: white; padding: 2px; }
|
||
.imageSingle { width: 806px; height: 237px; top: -2px; left: 0px; display: block; float: left; overflow: hidden; position: absolute; z-index: -1; }
|
||
.removeImage { visibility: hidden; }
|
||
body { font-family: Arial; }
|
||
body, html { height: 99%; }
|
||
.faqs ol { padding: 0 0 0 25px; }
|
||
.faqs li { padding: 3px 0; }
|
||
.question { padding: 10px 15px; text-align: left; cursor: pointer; }
|
||
.question:hover, .expandable:hover { color: #77777A; }
|
||
.answer { padding: 0 15px 10px 25px; text-align: left; display: none; font-size: 80%; }
|
||
.faq { border: 0; border-top: 2px solid #f4b517; }
|
||
.button { margin-left: 5px; margin-right: 5px; }
|
||
input[type=checkbox] { position: relative; z-index: 20; }
|
||
|
||
#wallets { clear: both; }
|
||
#btcaddress, #btcprivwif, #detailaddress, #detailaddresscomp, #detailprivwif, #detailprivwifcomp { font-family: monospace; font-size: 1.25em; }
|
||
#seedpoolarea { display: none; }
|
||
#seedpooldisplay { font-family: monospace; font-size: 1em; width: 640px; padding: 15px 5px; word-wrap: break-word; }
|
||
.seedpoint { width: 6px; height: 6px; display: block; border-radius: 3px; background-color: #f4b517; position: absolute; z-index: 10; }
|
||
#generate { font-family: monospace; font-size: 1.25em; height: 305px; text-align: left; position: relative; padding: 5px; border: 2px solid #f4b517; clear: both; }
|
||
#generate span { padding: 5px 5px 0 5px; }
|
||
#generatekeyinput { position: relative; z-index: 20; }
|
||
#keyarea { height: 250px; }
|
||
#keyarea .pubaddress { float: none; display: block; padding: 0; height: auto; }
|
||
#keyarea .label { text-decoration: none; }
|
||
#keyarea .privwif { float: none; text-align: right; position: relative; padding: 0; }
|
||
#keyarea .qrcode_public { float: none; display: block; padding: 13px 11px 11px 11px; }
|
||
#keyarea .qrcode_private { float: none; display: block; top: 0; text-align: right; padding: 13px 11px 11px 11px; }
|
||
#keyarea .private { width: 30%; display: table-cell; }
|
||
#keyarea .public { width: 30%; display: table-cell; }
|
||
#singlearea { font-size: 90%; }
|
||
#singlesecret { position: relative; top: -130px; float: right; right: 200px; color: 000000; font-weight: bolder; font-size: 200%; }
|
||
#singleshare { position: relative; top: -110px; float: left; left: 160px; color: #000000; font-weight: bolder; font-size: 200%; }
|
||
#singlesafety { text-align: left; padding: 5px; border-top: 2px solid #f4b517; top: -25px; position: relative; }
|
||
|
||
#main { position: relative; text-align: center; margin: 0px auto; width: 808px; }
|
||
#logo { width: 583px; height: 164px; }
|
||
|
||
#paperarea { min-height: 120px; display: none; }
|
||
#paperarea .keyarea { border: 2px solid #f4b517; border-top: 0; }
|
||
#paperarea .keyarea.art { display: block; height: auto; border: 0; font-family: Ubuntu, Arial; padding: 0; margin: 0; }
|
||
#paperarea .artwallet .papersvg { width: 486px; height: 261px; border: 0; margin: 0; padding: 0; left: 0; }
|
||
#paperarea .artwallet .qrcode_public { top: 52px; left: 17px; z-index: 100; margin: 0; float: none; display: block; position: absolute; background-color: #FFFFFF;
|
||
padding: 5px 5px 2px 5px; }
|
||
#paperarea .artwallet .qrcode_private { top: 104px; left: 360px; z-index: 100; margin: 0; float: none; display: block; position: absolute; background-color: #FFFFFF;
|
||
padding: 5px 5px 2px 5px; }
|
||
#paperarea .artwallet .btcaddress
|
||
{
|
||
position: absolute; top: 240px; left: 139px; z-index: 100; font-size: 10px; background-color: transparent;
|
||
font-weight:bold; color: #000000; margin: 0;
|
||
-webkit-transform-origin:top left; -webkit-transform:rotate(-90deg);
|
||
-moz-transform-origin:top left; -moz-transform:rotate(-90deg);
|
||
-ms-transform-origin:top left; -ms-transform:rotate(-90deg);
|
||
-o-transform-origin:top left; -o-transform:rotate(-90deg);
|
||
transform-origin:top left; transform:rotate(-90deg);
|
||
}
|
||
#paperarea .artwallet .btcprivwif
|
||
{
|
||
position: absolute; top: 257px; left: 346px; z-index: 100; font-size: 7px; background-color: transparent;
|
||
font-weight:bold; color: #000000; margin: 0;
|
||
-webkit-transform-origin:top left; -webkit-transform:rotate(-90deg);
|
||
-moz-transform-origin:top left; -moz-transform:rotate(-90deg);
|
||
-ms-transform-origin:top left; -ms-transform:rotate(-90deg);
|
||
-o-transform-origin:top left; -o-transform:rotate(-90deg);
|
||
transform-origin:top left; transform:rotate(-90deg);
|
||
}
|
||
#paperarea .artwallet .btcencryptedkey
|
||
{
|
||
position: absolute; top: 174px; left: 332px; z-index: 100; font-size: 8px; background-color: transparent;
|
||
font-weight:bold; color: #000000; margin: 0;
|
||
-webkit-transform-origin:top left; -webkit-transform:rotate(-90deg);
|
||
-moz-transform-origin:top left; -moz-transform:rotate(-90deg);
|
||
-ms-transform-origin:top left; -ms-transform:rotate(-90deg);
|
||
-o-transform-origin:top left; -o-transform:rotate(-90deg);
|
||
transform-origin:top left; transform:rotate(-90deg);
|
||
}
|
||
#bulkarea .body { padding: 5px 0 0 0; }
|
||
#bulkarea .format { font-style: italic; font-size: 90%; }
|
||
#bulktextarea { font-size: 90%; width: 98%; margin: 4px 0 0 0; }
|
||
#brainarea .keyarea { visibility: hidden; min-height: 110px; }
|
||
#brainview { margin-left: 5px; }
|
||
#detailkeyarea { padding: 10px; }
|
||
#detailarea { margin: 0; text-align: left; }
|
||
#detailarea .notes { text-align: left; font-size: 80%; padding: 0 0 20px 0; }
|
||
#detailarea .pubqr .item .label { text-decoration: none; }
|
||
#detailarea .pubqr .item { float: left; margin: 10px 0; position: relative; }
|
||
#detailarea .pubqr .item.right { float: right; position: relative; top: 0; }
|
||
#detailarea .privqr .item .label { text-decoration: none; }
|
||
#detailarea .privqr .item { float: left; margin: 0; position: relative; }
|
||
#detailarea .privqr .item.right { float: right; position: relative; }
|
||
#detailarea .item { margin: 10px 0; position: relative; font-size: 90%; padding: 1px 0; }
|
||
#detailarea .item.clear { clear: both; padding-top: 10px; }
|
||
#detailarea .label { display: block; font-weight: bold; }
|
||
#detailarea .output { display: block; font-family: monospace; font-size: 1.25em; }
|
||
#detailarea #detailqrcodepublic { position: relative; float: left; margin: 0 10px 0 0; padding: 13px 11px 11px 11px; }
|
||
#detailarea #detailqrcodepubliccomp { position: relative; float: right; margin: 0 0 0 10px; padding: 13px 11px 11px 11px; }
|
||
#detailarea #detailqrcodeprivate { position: relative; float: left; margin: 0 10px 0 0; padding: 13px 11px 11px 11px; }
|
||
#detailarea #detailqrcodeprivatecomp { position: relative; float: right; margin: 0 0 0 10px; padding: 13px 11px 11px 11px; }
|
||
#detailarea #detailqrcodeprivatebip38 { position: relative; margin: 0 10px 0 0; padding: 13px 11px 11px 11px; }
|
||
#detailpubkey { width: 590px; }
|
||
#detailbip38commands { display: none; padding-top: 5px; }
|
||
#detailbip38toggle { padding-top: 5px; }
|
||
#vanityarea { text-align: left; }
|
||
#vanityarea .label { text-decoration: underline; }
|
||
#vanityarea .output { font-family: monospace; font-size: 1.25em; display: block; }
|
||
#vanityarea .notes { text-align: left; font-size: 80%; padding: 0 0 20px 0; }
|
||
#vanitystep1area { display: none; text-align: left; position: relative; padding: 15px; border-bottom: 2px solid #f4b517; }
|
||
#vanitystep1label { padding-left: 5px; }
|
||
#vanitystep2area { border-top: 2px solid #f4b517; display: block; padding: 15px; }
|
||
#vanitystep2inputs { padding: 0 15px 10px 15px; }
|
||
#vanitycalc { margin-top: 5px; }
|
||
|
||
#splitarea { text-align: left; }
|
||
#splitarea span { padding: 0; }
|
||
#splitcommands { padding: 10px 15px; text-align: left; }
|
||
#combinecommands { padding: 10px 15px; }
|
||
#splitstep1area { display: none; text-align: left; position: relative; padding: 0; border-bottom: 2px solid #f4b517; }
|
||
.splitsharerow { border-bottom: 2px solid #f4b517; padding: 15px; }
|
||
.splitsharerow:last-child { border-bottom: 0; }
|
||
#combinelabelprivatekey { text-decoration: underline; }
|
||
#splitarea .output { display: block; font-family: monospace; font-size: 1.25em; }
|
||
#splitarea span.output { display: inline; }
|
||
#splitstep2area { padding: 10px 15px; }
|
||
|
||
.englishjson { text-align: center; padding: 40px 0 20px 0; }
|
||
.unittests { text-align: center; }
|
||
.unittests div { width: 894px; font-family: monospace; text-align: left; margin: auto; padding: 5px; border: 1px solid black; }
|
||
#testnet { display: none; background-color: Orange; color: #000000; border-radius: 5px; font-weight: bold; padding: 10px 0; margin: 0 auto 20px auto; }
|
||
#busyblock { position: fixed; display: none; background: url("data:image/gif;base64,R0lGODlhIAAgAPUAAP///wAAAKqqqoSEhGBgYExMTD4+PkhISFZWVnBwcI6OjqCgoGZmZjQ0NDIyMjg4OEJCQnR0dKampq6urmpqajAwMLCwsCoqKlxcXJSUlCYmJiIiIoiIiJiYmH5+flJSUnp6eh4eHiAgIBwcHJycnBYWFrq6uhISErS0tL6+vs7OztLS0tjY2MjIyMTExOLi4uzs7Obm5vDw8Pb29vz8/Nzc3AQEBAAAAAoKCgAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJBwAAACwAAAAAIAAgAAAG/0CAcEicDBCOS8lBbDqfgAUidDqVSlaoliggbEbX8Amy3S4MoXQ6fC1DM5eNeh0+uJ0Lx0YuWj8IEQoKd0UQGhsaIooGGYRQFBcakocRjlALFReRGhcDllAMFZmalZ9OAg0VDqofpk8Dqw0ODo2uTQSzDQ12tk0FD8APCb1NBsYGDxzERMcGEB3LQ80QtdEHEAfZg9EACNnZHtwACd8FBOIKBwXqCAvcAgXxCAjD3BEF8xgE28sS8wj6CLi7Q2PLAAz6GDBIQMLNjIJaLDBIuBCEAhRQYMh4WEYCgY8JIoDwoGCBhRQqVrBg8SIGjBkcAUDEQ2GhyAEcMnSQYMFEC0QVLDXCpEFUiwAQIUEMGJCBhEkTLoC2hPFyhhsLGW4K6rBAAIoUP1m6hOEIK04FGRY8jaryBdlPJgQscLpg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IBJkykcJGihQoWL0SOXEKCAAZVDCoZRADhgUOGDhIsoHBhE2ROGFMEUABKgCWIAQMUdFiQ1IQLFTdDcrEwQGWCBEOzHn2JwquLFTXcCBhwNsFVox1ILJiwdEUlCwsUDOCQdasFE1yCAAA7AAAAAAAAAAAA") #ccc no-repeat center; opacity: 0.4; width: 100%; height: 100%; top: 0; left: 0; z-index: 5000; }
|
||
#busyblock.busy { display: block; }
|
||
.hide { display: none; }
|
||
.show { display: block; }
|
||
|
||
@media screen
|
||
{
|
||
#tagline { margin: 0 0 15px 0; font-style: italic; }
|
||
.menu
|
||
{
|
||
text-align: left; margin: 0; padding: 0; display: block;
|
||
background-color: #f4b517; /* # 009900 # 53c100 */
|
||
border-top-left-radius: 5px; border-top-right-radius: 5px;
|
||
}
|
||
.menu .tab
|
||
{
|
||
position: relative; display: inline-block; border: 0px solid red;
|
||
margin: 0; list-style: none; z-index: 110;
|
||
top: 1px; padding: 10px 20px; width: 770px; /* 120px */ text-align: center;
|
||
}
|
||
.menu .tab.selected
|
||
{
|
||
cursor: default;
|
||
background-color: #FFF; margin: 6px 16px; padding: 4px; border-radius: 5px;
|
||
}
|
||
|
||
.pagebreak { height: 50px; }
|
||
.commands { border-bottom: 2px solid #f4b517; padding: 10px 2px; margin-bottom: 0; }
|
||
.commands .row { padding: 0 0; text-align: left; }
|
||
.commands .row.extra { padding-top: 6px; }
|
||
.commands span { padding: 0 10px; }
|
||
.commands span.print { float: right; position: relative; z-index: 20; }
|
||
.commands span.right { float: right; }
|
||
.expandable { padding: 10px 15px; text-align: left; cursor: pointer; }
|
||
|
||
#menu { visibility: visible; font-size: 90%; }
|
||
#culturemenu { text-align: center; padding: 0 10px 5px 10px; margin-bottom: 3px; font-size: 90%; }
|
||
#culturemenu span { padding: 3px; }
|
||
#culturemenu .selected { text-decoration: none; color: #000000; }
|
||
.culturemenurow { padding: 2px 0; }
|
||
|
||
#braincommands .row .label { width: 200px; display: inline-block; }
|
||
#braincommands .notes { font-size: 80%; display: block; padding: 5px 10px; }
|
||
#brainpassphrase { width: 280px; position: relative; z-index: 20; }
|
||
#brainpassphraseconfirm { width: 280px; position: relative; z-index: 20; }
|
||
#brainpassphraseshow { position: relative; z-index: 20; }
|
||
#brainview { position: relative; z-index: 20; }
|
||
#brainwarning { }
|
||
#detailcommands { padding: 10px 0; }
|
||
#detailcommands span { padding: 0 10px; }
|
||
#detailprivkey { width: 460px; position: relative; z-index: 20; }
|
||
#detailprivkeypassphrase { width: 250px; position: relative; z-index: 20; }
|
||
#detailcommands .button { position: relative; z-index: 20; }
|
||
#detailbip38encryptspan { display: none; }
|
||
.paper .commands { border: 2px solid #f4b517; }
|
||
#bulkstartindex, #paperlimit, #paperlimitperpage { width: 35px; }
|
||
#bulklimit { width: 45px; }
|
||
|
||
.footer { font-size: 90%; clear: both; width: 770px; padding: 10px 0 10px 0; margin: 50px auto auto auto; }
|
||
.footer div span.item { padding: 10px; }
|
||
.footer .authorbtc { float: left; width: 470px; }
|
||
.footer .authorbtc span.item { text-align: left; display: block; padding: 0 20px; }
|
||
.footer .authorbtc div { position: relative; z-index: 100; }
|
||
.footer .authorpgp { position: relative; }
|
||
.footer .authorpgp span.item { text-align: right; display: block; padding: 0 20px; }
|
||
.footer .copyright { font-size: 80%; clear: both; padding: 5px 0; }
|
||
.footer .copyright span { padding: 10px 2px; }
|
||
.footer .tooltip { display: none; text-align: left; border: 2px solid green; background-color: #FFFFF6; margin: 5px; padding: 10px; top: 0px; position: relative; }
|
||
.footer .statusgood { color: green; font-weight: bold; }
|
||
.footer .statuswarn { color: orange; font-weight: bold; }
|
||
.footer .statusbad { color: red; font-weight: bold; }
|
||
.footer .statusicon { background-color: none; font-size: 120%; padding: 1px 2px; }
|
||
.footer .statusicon:hover { background-color: green; cursor: pointer; }
|
||
}
|
||
@media print
|
||
{
|
||
#main { width: auto; }
|
||
#singlearea { border: 0; }
|
||
#singlesafety { border: 0; }
|
||
#paperarea .keyarea:first-child { border-top: 2px solid #f4b517; }
|
||
#paperarea .keyarea.art:first-child { border: 0; }
|
||
.pagebreak { height: 1px; }
|
||
.paper #logo { display: none; }
|
||
.menu, .footer, .commands, #tagline, #faqs, #culturemenu { display: none; }
|
||
#detailprivwif { width: 285px; word-wrap: break-word; }
|
||
#detailprivwifcomp { width: 310px; word-wrap: break-word; text-align: right; }
|
||
#detailarea .privqr .item.right { width: 310px; }
|
||
#detailarea .privqr .item { width: 285px; }
|
||
#detailarea .notes { display: none; }
|
||
#seedpoolarea { display: none; }
|
||
.faq { display: none; }
|
||
}
|
||
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
||
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
||
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
|
||
@-webkit-keyframes fadeOut { from { opacity:1; } to { opacity:0; } }
|
||
@-moz-keyframes fadeOut { from { opacity:1; } to { opacity:0; } }
|
||
@keyframes fadeOut { from { opacity:1; } to { opacity:0; } }
|
||
.fade-in {
|
||
opacity: 0;
|
||
-webkit-animation: fadeIn ease-in 1;
|
||
-moz-animation: fadeIn ease-in 1;
|
||
animation: fadeIn ease-in 1;
|
||
-webkit-animation-fill-mode: forwards;
|
||
-moz-animation-fill-mode: forwards;
|
||
animation-fill-mode: forwards;
|
||
-webkit-animation-duration: 1s;
|
||
-moz-animation-duration: 1s;
|
||
animation-duration: 1s;
|
||
}
|
||
.fade-out {
|
||
opacity: 0;
|
||
-webkit-animation: fadeOut ease-out 1;
|
||
-moz-animation: fadeOut ease-out 1;
|
||
animation: fadeOut ease-out 1;
|
||
-webkit-animation-fill-mode: backwards;
|
||
-moz-animation-fill-mode: backwards;
|
||
animation-fill-mode: backwards;
|
||
-webkit-animation-duration: 1s;
|
||
-moz-animation-duration: 1s;
|
||
animation-duration: 1s;
|
||
}
|
||
#warningModal {
|
||
display: none;
|
||
position: fixed;
|
||
z-index: 120;
|
||
left: 0;
|
||
top: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
overflow: auto;
|
||
background-color: rgb(0,0,0);
|
||
background-color: rgba(0,0,0,0.6);
|
||
}
|
||
.modal-content {
|
||
background-color: #fefefe;
|
||
margin: 15% auto;
|
||
padding: 20px;
|
||
border: 1px solid #888;
|
||
width: 80%;
|
||
border-radius: 10px;
|
||
}
|
||
.close {
|
||
color: #aaa;
|
||
float: right;
|
||
font-size: 28px;
|
||
font-weight: bold;
|
||
position: relative;
|
||
top: -20px;
|
||
right: 0px;
|
||
}
|
||
.close:hover,
|
||
.close:focus {
|
||
color: black;
|
||
text-decoration: none;
|
||
cursor: pointer;
|
||
}
|
||
hr {
|
||
border-width: 0px;
|
||
background-color: #f4b517;
|
||
height: 2px;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div id="busyblock"></div>
|
||
<div id="warningModal" class="modal fade-in">
|
||
<div class="modal-content">
|
||
<p>WARNING! <span class="close" onclick="closeModal()">×</span></p>
|
||
<hr>
|
||
<p>Before using the SmartCash brain wallet, please take the time to read this guide to make sure you understand the risk and select a hard to crack and yet easy to remember mnemonic passphrase. <a href="https://en.bitcoin.it/wiki/Brainwallet" target="_blank">https://en.bitcoin.it/wiki/Brainwallet</a></p>
|
||
<hr>
|
||
</div>
|
||
</div>
|
||
<div id="main">
|
||
<img alt="smartcash.cc" title="smartcash.cc" id="logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA/gAAAE2CAYAAADVpjl6AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGA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V3KGJPX+9daE/YOHWynnHKKeu211wo692PHjjUvvvjiQS1TJ510klq/fr3e0xQT13VHAyOstYOyAr4H7LTWbu7s7HzbVnY1NTXOwIED7ZIlSw6oTNXX16t0Or3P8xmex1GjRhU0OqDI96N7enryLpuO4+B5nuno6Dhsn9QzZ85UO3fu1Hua3zx58uThjuOMVEoNstaWZc2J7bHWbgM2dnZ27sw97phjjtFbtmxRkUikZO5L+TrxxBPVG2+8off1XJo0adLASCQSNnwMwB8WHT6TPKVUd3B9bUsmk3scmVRbW+sMGDDAdnd32+xF40pdTU2NMsbo6upq89hjj9mc8jLEcZzRQcNHuEuBBbqCBTo3rFmzJp19TENDg06lUmr48OFm4cKFB3QeKioqnH1d1+HzJhqNHtRGhFmzZqnNmzfraDTK3rammzx58nCt9TCl1CCl1IBwYcPgGkwBXcaYrZ2dnZv28j050WjUrlixoiSuv1mzZulCpuBZaym1TpgDrR9IwJeALyTgHxEBP1dlZaUOH2JaaxzHKbhyePrpp6tkMqnDrXO01rY/Vh4WolTU19frVCqltNbk22saNoANHjzYdnV12ba2NnkyHYFqamq053lKKcWkSZN2m1K1r2OMMcpay6BBg2wqlbItLS2HTfmpra3VmUxGheEwFouZp556yhZwPe5q5AJwHMe2trYeFs8k13W11loppYjH4+bJJ5/c73mZOXOm3rZtmzLGMGbMGBPMWT+iVVVVaWutCkNhoaNdKisrnWAeP4Btb2+XOk8pVs0PQsCXRfaEEAfd3h5K06dPV8OHD+eNN95QkcjutyvP8xg/frzdtm0bixcvtkEFQ4beiyNW7jDfadOmqR07dqhoNBouNIcxhgkTJth169bR2NhoZZskAf7q6eGf29raqKqqUuPHj+fNN99U2YtEZTIZRo0aZV955RWbfczhKLeRua2tDYDZs2erDRs2qLKysl3XVbiwWTqdZsyYMXbTpk27Fp09HM9NIpHYrby4rqsmTpzI2rVrdysvPT09DBs2zC5evNiGW8oFx8tFx563P6yurlajRo1i/fr1KhrdfQmITCbD+PHj7fr161m5cqUttTUbROmQgC+EKFnLli3b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cQIX/9iOafNieBsC4K+Bwzzt71b0WG45Z4UD/y+h57i9rNvB24Bfo7sZy+EBHwhhBBCCCEBX+zTIPz5+Z8F6gs9eECZ4vxzo1x7eTkzKjUYeH2b4We/SfPDn6R4fV1RZWc9/jz7u4AO+YqEkIAvhBBCCCEk4Iv8VQGXBz8jCj04NlnzucvLmDRBc/sPU7y8qKiR9B7wIP48+5fkKxFCAr4QQgghhJCAL4o3G7gB+BBFzM8vi1DscPxXgJuAR/EX1BNCSMAXQgghhBAS8MWBfjXAR/EX4ju+j39XEn8o/t3ANjn1QkjAF0IIIYQQEvBF7xsDXAJciT+EvzdtBe4Lgn2jnGohJOALIYQQQggJ+KLvVQHXBmF/WC+83l+A7wHPyakVQgK+EEIIIYSQgC/638nA14EzgGgRx7+Kv+3d75F59hIQhRBCCCGEEBLwxUGlgU8CXwSOyfOYTuCn+MPx18kplIAvhBBCCCGEkIAvSscE/CH71wR/3pNu4FfAXGCJnDIJ+EIIIYQQQggJ+KJ0NQDXBWE/HLZvgaeAbwPP4O9vLyTgCyGEEEIIISTgi0PAu4H/BCYDN+OvkN8lp0UCvhBCCCGEEEICvjj0xPBX2V8mp0ICvhBCCCGEEOIICvhCCCGEEEIIIYToP1pOgRBCCCGEEEIIIQFfCCGEEEIIIYQQEvCFEEIIIYQQQgghAV8IIYQQQgghhBAS8IUQQgghhBBCCAn4QgghhBBCCCGEkIAvhBBCCCGEEEIICfhCCCGEEEIIIYSQgC+EEEIIIYQQQkjAF0IIIYQQQgghhAR8IYQQQgghhBBCSMAXQgghhBBCCCGEBHwhhBBCCCGEEEICvhBCCCGEEEIIISTgCyGEEEIIIYQQQgK+EEIIIYQQQgghJOALIYQQQgghhBCHr/9/AGlRopaNwJPzAAAAAElFTkSuQmCC" />
|
||
<div id="tagline">Open Source JavaScript Client-Side SmartCash Wallet Generator</div>
|
||
<div id="seedpoolarea"><textarea rows="16" cols="62" id="seedpool"></textarea></div>
|
||
<div id="testnet"></div>
|
||
<ul class="menu" id="menu">
|
||
<li class="tab" id="brainwallet">Brain Wallet
|
||
</ul>
|
||
|
||
<div id="wallets">
|
||
<div id="brainarea" class="walletarea">
|
||
<div id="braincommands" class="commands">
|
||
<div class="row">
|
||
<span id="brainlabelenterpassphrase" class="label"><label for="brainpassphrase">Enter Passphrase: </label></span>
|
||
<input tabindex="1" type="password" id="brainpassphrase" value="" onfocus="this.select();" onkeypress="if (event.keyCode == 13) ninja.wallets.brainwallet.view();" />
|
||
<span><label id="brainlabelshow" for="brainpassphraseshow">Show?</label> <input type="checkbox" id="brainpassphraseshow" onchange="ninja.wallets.brainwallet.showToggle(this);" /></span>
|
||
<span class="print"><input type="button" name="print" id="brainprint" value="Print" onclick="window.print();" /></span>
|
||
</div>
|
||
<div class="row extra">
|
||
<span class="label" id="brainlabelconfirm"><label for="brainpassphraseconfirm">Confirm Passphrase: </label></span>
|
||
<input tabindex="2" type="password" id="brainpassphraseconfirm" value="" onfocus="this.select();" onkeypress="if (event.keyCode == 13) ninja.wallets.brainwallet.view();" />
|
||
|
||
<span id="brainalgorithm" class="notes right">Algorithm: SHA256(passphrase)</span>
|
||
</div>
|
||
<div class ="row extra">
|
||
<span><label tabindex="3" id="brainlabelcompressed" for="braincompressed">Compressed address?</label> <input type="checkbox" id="braincompressed" checked/></span>
|
||
<span><input tabindex="4" type="button" id="brainview" value="View" onclick="ninja.wallets.brainwallet.view();" /></span>
|
||
</div>
|
||
<div class="row extra"><span id="brainwarning"></span></div>
|
||
</div>
|
||
<div id="brainkeyarea" class="keyarea">
|
||
<div class="public">
|
||
<div id="brainqrcodepublic" class="qrcode_public"></div>
|
||
<div class="pubaddress">
|
||
<span class="label" id="brainlabelbitcoinaddress">SmartCash Address:</span>
|
||
<span class="output" id="brainbtcaddress"></span>
|
||
</div>
|
||
</div>
|
||
<div class="private">
|
||
<div id="brainqrcodeprivate" class="qrcode_private"></div>
|
||
<div class="privwif">
|
||
<span class="label" id="brainlabelprivatekey">Private Key (Wallet Import Format):</span>
|
||
<span class="output" id="brainbtcprivwif"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div id="footer" class="footer">
|
||
<div class="tooltips">
|
||
<div class="tooltip" id="statuscryptogood">
|
||
<span class="statusgood" id="statuslabelcryptogood">✔ Good!</span>
|
||
<span id="statuslabelcryptogood1">Your browser can generate cryptographically random keys using window.crypto.getRandomValues</span>
|
||
<br /><br /><input type="button" value="OK" class="button" id="statusokcryptogood" onclick="document.getElementById('statuscryptogood').style.display = 'none';" />
|
||
</div>
|
||
<div class="tooltip" id="statuscryptobad">
|
||
<span class="statusbad" id="statuslabelcryptobad">× Oh no!</span>
|
||
<span id="statuslabelcryptobad1">Your browser does NOT support window.crypto.getRandomValues. You should use a more modern browser with this generator to increase the security of the keys generated.</span>
|
||
<br /><br /><input type="button" value="OK" class="button" id="statusokcryptobad" onclick="document.getElementById('statuscryptobad').style.display = 'none';" />
|
||
</div>
|
||
<div class="tooltip" id="statusunittestsgood">
|
||
<span class="statusgood" id="statuslabelunittestsgood">✔ Good!</span>
|
||
<span id="statuslabelunittestsgood1">All synchronous unit tests passed.</span>
|
||
<br /><br /><input type="button" value="OK" class="button" id="statusokunittestsgood" onclick="document.getElementById('statusunittestsgood').style.display = 'none';" />
|
||
</div>
|
||
<div class="tooltip" id="statusunittestsbad">
|
||
<span class="statusbad" id="statuslabelunittestsbad">× Oh no!</span>
|
||
<span id="statuslabelunittestsbad1">Some synchronous unit tests DID NOT pass. You should find another browser to use with this generator.</span>
|
||
<br /><br /><input type="button" value="OK" class="button" id="statusokunittestsbad" onclick="document.getElementById('statusunittestsbad').style.display = 'none';" />
|
||
</div>
|
||
<div class="tooltip" id="statusprotocolgood">
|
||
<span class="statusgood" id="statuslabelprotocolgood">✔ Good!</span>
|
||
<span id="statuslabelprotocolgood1">You are running this generator from your local computer. <br />Tip: Double check you are offline by trying </span>
|
||
<a href="http://www.google.com" target="_blank">www.google.com</a>
|
||
<br /><br /><input type="button" value="OK" class="button" id="statusokprotocolgood" onclick="document.getElementById('statusprotocolgood').style.display = 'none';" />
|
||
</div>
|
||
<div class="tooltip" id="statusprotocolbad">
|
||
<span class="statuswarn" id="statuslabelprotocolbad">⚠ Think twice!</span>
|
||
<span id="statuslabelprotocolbad1">You appear to be running this generator online from a live website. For valuable wallets it is recommended to</span>
|
||
<a id="statuslabelprotocolbad2" href="https://github.com/SmartCash/PaperWalletGenerator/archive/master.zip">download</a>
|
||
<span id="statuslabelprotocolbad3">the zip file from GitHub and run this generator offline as a local html file.</span>
|
||
<br /><br /><input type="button" value="OK" class="button" id="statusokprotocolbad" onclick="document.getElementById('statusprotocolbad').style.display = 'none';" />
|
||
</div>
|
||
<div class="tooltip" id="statuskeypoolgood">
|
||
<span id="statuslabelkeypool1">This is a log of all the SmartCash Addresses and Private Keys you generated during your current session. Reloading the page will create a new session.</span>
|
||
<textarea rows="20" cols="102" id="keypooltextarea"></textarea>
|
||
|
||
<br /><br />
|
||
<input type="button" value="Refresh" class="button" id="statuskeypoolrefresh" onclick="ninja.status.showKeyPool();" />
|
||
<input type="button" value="OK" class="button" id="statusokkeypool" onclick="document.getElementById('statuskeypoolgood').style.display = 'none';" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="authorbtc">
|
||
<div>
|
||
<span class="item">
|
||
<span class="statusicon" id="statusprotocol" onclick="ninja.status.showProtocol();">...</span>
|
||
<span class="statusicon" id="statuscrypto" onclick="ninja.status.showCrypto();">...</span>
|
||
<span class="statusicon" id="statusunittests" onclick="ninja.status.showUnitTests();" style="display: none;">...</span>
|
||
<span class="statusicon" id="statuskeypool" onclick="ninja.status.showKeyPool();">≣</span>
|
||
</span>
|
||
<span class="item" id="footerlabeltranslatedby"></span>
|
||
<span class="item"><a href="https://github.com/SmartCash/PaperWalletGenerator" target="_blank" id="footerlabelgithub">GitHub Repository</a>
|
||
(<a href="https://github.com/SmartCash/PaperWalletGenerator/archive/master.zip" target="_blank" id="footerlabelgithubzip">zip</a>)</span>
|
||
</div>
|
||
</div>
|
||
<div class="authorpgp">
|
||
</div>
|
||
<div class="copyright">
|
||
<span id="footerlabelcopyright1">Copyright smartcash.cc.</span>
|
||
<span id="footerlabelcopyright2">JavaScript copyrights are included in the source.</span>
|
||
<span id="footerlabelnowarranty">No warranty.</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<script type="text/javascript">
|
||
function setCookie(cname, cvalue, exdays) {
|
||
var d = new Date();
|
||
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||
var expires = "expires="+ d.toUTCString();
|
||
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
|
||
}
|
||
function getCookie(cname) {
|
||
var name = cname + "=";
|
||
var decodedCookie = decodeURIComponent(document.cookie);
|
||
var ca = decodedCookie.split(';');
|
||
for(var i = 0; i <ca.length; i++) {
|
||
var c = ca[i];
|
||
while (c.charAt(0) == ' ') {
|
||
c = c.substring(1);
|
||
}
|
||
if (c.indexOf(name) == 0) {
|
||
return c.substring(name.length, c.length);
|
||
}
|
||
}
|
||
return "";
|
||
}
|
||
var HasReadWarning = getCookie('read');
|
||
var modal = document.getElementById('warningModal');
|
||
var span = document.getElementsByClassName("close")[0];
|
||
if (HasReadWarning !== "yes") {
|
||
modal.style.display = "block";
|
||
}
|
||
span.onclick = function() {
|
||
toggleClass(modal, 'fade-out');
|
||
setTimeout(function(){ modal.style.display = "none"; }, 1000);
|
||
setCookie('read', 'yes', 365);
|
||
|
||
}
|
||
window.onclick = function(event) {
|
||
if (event.target == modal) {
|
||
toggleClass(modal, 'fade-out');
|
||
setTimeout(function(){ modal.style.display = "none"; }, 1000);
|
||
setCookie('read', 'yes', 365);
|
||
}
|
||
}
|
||
</script>
|
||
<script type="text/javascript">
|
||
var ninja = { wallets: {} };
|
||
|
||
ninja.privateKey = {
|
||
isPrivateKey: function (key) {
|
||
return (
|
||
Bitcoin.ECKey.isWalletImportFormat(key) ||
|
||
Bitcoin.ECKey.isCompressedWalletImportFormat(key) ||
|
||
Bitcoin.ECKey.isHexFormat(key) ||
|
||
Bitcoin.ECKey.isBase64Format(key) ||
|
||
Bitcoin.ECKey.isMiniFormat(key)
|
||
);
|
||
},
|
||
getECKeyFromAdding: function (privKey1, privKey2) {
|
||
var n = EllipticCurve.getSECCurveByName("secp256k1").getN();
|
||
var ecKey1 = new Bitcoin.ECKey(privKey1);
|
||
var ecKey2 = new Bitcoin.ECKey(privKey2);
|
||
// if both keys are the same return null
|
||
if (ecKey1.getBitcoinHexFormat() == ecKey2.getBitcoinHexFormat()) return null;
|
||
if (ecKey1 == null || ecKey2 == null) return null;
|
||
var combinedPrivateKey = new Bitcoin.ECKey(ecKey1.priv.add(ecKey2.priv).mod(n));
|
||
// compressed when both keys are compressed
|
||
if (ecKey1.compressed && ecKey2.compressed) combinedPrivateKey.setCompressed(true);
|
||
return combinedPrivateKey;
|
||
},
|
||
getECKeyFromMultiplying: function (privKey1, privKey2) {
|
||
var n = EllipticCurve.getSECCurveByName("secp256k1").getN();
|
||
var ecKey1 = new Bitcoin.ECKey(privKey1);
|
||
var ecKey2 = new Bitcoin.ECKey(privKey2);
|
||
// if both keys are the same return null
|
||
if (ecKey1.getBitcoinHexFormat() == ecKey2.getBitcoinHexFormat()) return null;
|
||
if (ecKey1 == null || ecKey2 == null) return null;
|
||
var combinedPrivateKey = new Bitcoin.ECKey(ecKey1.priv.multiply(ecKey2.priv).mod(n));
|
||
// compressed when both keys are compressed
|
||
if (ecKey1.compressed && ecKey2.compressed) combinedPrivateKey.setCompressed(true);
|
||
return combinedPrivateKey;
|
||
},
|
||
// 58 base58 characters starting with 6P
|
||
isBIP38Format: function (key) {
|
||
key = key.toString();
|
||
return (/^6P[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{56}$/.test(key));
|
||
},
|
||
BIP38EncryptedKeyToByteArrayAsync: function (base58Encrypted, passphrase, callback) {
|
||
var hex;
|
||
try {
|
||
hex = Bitcoin.Base58.decode(base58Encrypted);
|
||
} catch (e) {
|
||
callback(new Error(ninja.translator.get("detailalertnotvalidprivatekey")));
|
||
return;
|
||
}
|
||
|
||
// 43 bytes: 2 bytes prefix, 37 bytes payload, 4 bytes checksum
|
||
if (hex.length != 43) {
|
||
callback(new Error(ninja.translator.get("detailalertnotvalidprivatekey")));
|
||
return;
|
||
}
|
||
// first byte is always 0x01
|
||
else if (hex[0] != 0x01) {
|
||
callback(new Error(ninja.translator.get("detailalertnotvalidprivatekey")));
|
||
return;
|
||
}
|
||
|
||
var expChecksum = hex.slice(-4);
|
||
hex = hex.slice(0, -4);
|
||
var checksum = Bitcoin.Util.dsha256(hex);
|
||
if (checksum[0] != expChecksum[0] || checksum[1] != expChecksum[1] || checksum[2] != expChecksum[2] || checksum[3] != expChecksum[3]) {
|
||
callback(new Error(ninja.translator.get("detailalertnotvalidprivatekey")));
|
||
return;
|
||
}
|
||
|
||
var isCompPoint = false;
|
||
var isECMult = false;
|
||
var hasLotSeq = false;
|
||
// second byte for non-EC-multiplied key
|
||
if (hex[1] == 0x42) {
|
||
// key should use compression
|
||
if (hex[2] == 0xe0) {
|
||
isCompPoint = true;
|
||
}
|
||
// key should NOT use compression
|
||
else if (hex[2] != 0xc0) {
|
||
callback(new Error(ninja.translator.get("detailalertnotvalidprivatekey")));
|
||
return;
|
||
}
|
||
}
|
||
// second byte for EC-multiplied key
|
||
else if (hex[1] == 0x43) {
|
||
isECMult = true;
|
||
isCompPoint = (hex[2] & 0x20) != 0;
|
||
hasLotSeq = (hex[2] & 0x04) != 0;
|
||
if ((hex[2] & 0x24) != hex[2]) {
|
||
callback(new Error(ninja.translator.get("detailalertnotvalidprivatekey")));
|
||
return;
|
||
}
|
||
}
|
||
else {
|
||
callback(new Error(ninja.translator.get("detailalertnotvalidprivatekey")));
|
||
return;
|
||
}
|
||
|
||
var decrypted;
|
||
var AES_opts = { mode: new Crypto.mode.ECB(Crypto.pad.NoPadding), asBytes: true };
|
||
|
||
var verifyHashAndReturn = function () {
|
||
var tmpkey = new Bitcoin.ECKey(decrypted); // decrypted using closure
|
||
var base58AddrText = tmpkey.setCompressed(isCompPoint).getBitcoinAddress(); // isCompPoint using closure
|
||
checksum = Bitcoin.Util.dsha256(base58AddrText); // checksum using closure
|
||
|
||
if (checksum[0] != hex[3] || checksum[1] != hex[4] || checksum[2] != hex[5] || checksum[3] != hex[6]) {
|
||
callback(new Error(ninja.translator.get("bip38alertincorrectpassphrase"))); // callback using closure
|
||
return;
|
||
}
|
||
callback(tmpkey.getBitcoinPrivateKeyByteArray()); // callback using closure
|
||
};
|
||
|
||
if (!isECMult) {
|
||
var addresshash = hex.slice(3, 7);
|
||
Crypto_scrypt(passphrase, addresshash, 16384, 8, 8, 64, function (derivedBytes) {
|
||
var k = derivedBytes.slice(32, 32 + 32);
|
||
decrypted = Crypto.AES.decrypt(hex.slice(7, 7 + 32), k, AES_opts);
|
||
for (var x = 0; x < 32; x++) decrypted[x] ^= derivedBytes[x];
|
||
verifyHashAndReturn(); //TODO: pass in 'decrypted' as a param
|
||
});
|
||
}
|
||
else {
|
||
var ownerentropy = hex.slice(7, 7 + 8);
|
||
var ownersalt = !hasLotSeq ? ownerentropy : ownerentropy.slice(0, 4);
|
||
Crypto_scrypt(passphrase, ownersalt, 16384, 8, 8, 32, function (prefactorA) {
|
||
var passfactor;
|
||
if (!hasLotSeq) { // hasLotSeq using closure
|
||
passfactor = prefactorA;
|
||
} else {
|
||
var prefactorB = prefactorA.concat(ownerentropy); // ownerentropy using closure
|
||
passfactor = Bitcoin.Util.dsha256(prefactorB);
|
||
}
|
||
// remove this ECKey from the pool (because user does not see it)
|
||
var userKeyPool = Bitcoin.KeyPool.getArray();
|
||
var kp = new Bitcoin.ECKey(passfactor);
|
||
var passpoint = kp.setCompressed(true).getPub();
|
||
Bitcoin.KeyPool.setArray(userKeyPool);
|
||
var encryptedpart2 = hex.slice(23, 23 + 16);
|
||
|
||
var addresshashplusownerentropy = hex.slice(3, 3 + 12);
|
||
Crypto_scrypt(passpoint, addresshashplusownerentropy, 1024, 1, 1, 64, function (derived) {
|
||
var k = derived.slice(32);
|
||
|
||
var unencryptedpart2 = Crypto.AES.decrypt(encryptedpart2, k, AES_opts);
|
||
for (var i = 0; i < 16; i++) { unencryptedpart2[i] ^= derived[i + 16]; }
|
||
|
||
var encryptedpart1 = hex.slice(15, 15 + 8).concat(unencryptedpart2.slice(0, 0 + 8));
|
||
var unencryptedpart1 = Crypto.AES.decrypt(encryptedpart1, k, AES_opts);
|
||
for (var i = 0; i < 16; i++) { unencryptedpart1[i] ^= derived[i]; }
|
||
|
||
var seedb = unencryptedpart1.slice(0, 0 + 16).concat(unencryptedpart2.slice(8, 8 + 8));
|
||
|
||
var factorb = Bitcoin.Util.dsha256(seedb);
|
||
|
||
var ps = EllipticCurve.getSECCurveByName("secp256k1");
|
||
var privateKey = BigInteger.fromByteArrayUnsigned(passfactor).multiply(BigInteger.fromByteArrayUnsigned(factorb)).remainder(ps.getN());
|
||
|
||
decrypted = privateKey.toByteArrayUnsigned();
|
||
verifyHashAndReturn();
|
||
});
|
||
});
|
||
}
|
||
},
|
||
BIP38PrivateKeyToEncryptedKeyAsync: function (base58Key, passphrase, compressed, callback) {
|
||
var privKey = new Bitcoin.ECKey(base58Key);
|
||
var privKeyBytes = privKey.getBitcoinPrivateKeyByteArray();
|
||
var address = privKey.setCompressed(compressed).getBitcoinAddress();
|
||
|
||
// compute sha256(sha256(address)) and take first 4 bytes
|
||
var salt = Bitcoin.Util.dsha256(address).slice(0, 4);
|
||
|
||
// derive key using scrypt
|
||
var AES_opts = { mode: new Crypto.mode.ECB(Crypto.pad.NoPadding), asBytes: true };
|
||
|
||
Crypto_scrypt(passphrase, salt, 16384, 8, 8, 64, function (derivedBytes) {
|
||
for (var i = 0; i < 32; ++i) {
|
||
privKeyBytes[i] ^= derivedBytes[i];
|
||
}
|
||
|
||
// 0x01 0x42 + flagbyte + salt + encryptedhalf1 + encryptedhalf2
|
||
var flagByte = compressed ? 0xe0 : 0xc0;
|
||
var encryptedKey = [0x01, 0x42, flagByte].concat(salt);
|
||
encryptedKey = encryptedKey.concat(Crypto.AES.encrypt(privKeyBytes, derivedBytes.slice(32), AES_opts));
|
||
encryptedKey = encryptedKey.concat(Bitcoin.Util.dsha256(encryptedKey).slice(0, 4));
|
||
callback(Bitcoin.Base58.encode(encryptedKey));
|
||
});
|
||
},
|
||
BIP38GenerateIntermediatePointAsync: function (passphrase, lotNum, sequenceNum, callback) {
|
||
var noNumbers = lotNum === null || sequenceNum === null;
|
||
var rng = new SecureRandom();
|
||
var ownerEntropy, ownerSalt;
|
||
|
||
if (noNumbers) {
|
||
ownerSalt = ownerEntropy = new Array(8);
|
||
rng.nextBytes(ownerEntropy);
|
||
}
|
||
else {
|
||
// 1) generate 4 random bytes
|
||
ownerSalt = new Array(4);
|
||
|
||
rng.nextBytes(ownerSalt);
|
||
|
||
// 2) Encode the lot and sequence numbers as a 4 byte quantity (big-endian):
|
||
// lotnumber * 4096 + sequencenumber. Call these four bytes lotsequence.
|
||
var lotSequence = BigInteger(4096 * lotNum + sequenceNum).toByteArrayUnsigned();
|
||
|
||
// 3) Concatenate ownersalt + lotsequence and call this ownerentropy.
|
||
var ownerEntropy = ownerSalt.concat(lotSequence);
|
||
}
|
||
|
||
|
||
// 4) Derive a key from the passphrase using scrypt
|
||
Crypto_scrypt(passphrase, ownerSalt, 16384, 8, 8, 32, function (prefactor) {
|
||
// Take SHA256(SHA256(prefactor + ownerentropy)) and call this passfactor
|
||
var passfactorBytes = noNumbers ? prefactor : Bitcoin.Util.dsha256(prefactor.concat(ownerEntropy));
|
||
var passfactor = BigInteger.fromByteArrayUnsigned(passfactorBytes);
|
||
|
||
// 5) Compute the elliptic curve point G * passfactor, and convert the result to compressed notation (33 bytes)
|
||
var ellipticCurve = EllipticCurve.getSECCurveByName("secp256k1");
|
||
var passpoint = ellipticCurve.getG().multiply(passfactor).getEncoded(1);
|
||
|
||
// 6) Convey ownersalt and passpoint to the party generating the keys, along with a checksum to ensure integrity.
|
||
// magic bytes "2C E9 B3 E1 FF 39 E2 51" followed by ownerentropy, and then passpoint
|
||
var magicBytes = [0x2C, 0xE9, 0xB3, 0xE1, 0xFF, 0x39, 0xE2, 0x51];
|
||
if (noNumbers) magicBytes[7] = 0x53;
|
||
|
||
var intermediate = magicBytes.concat(ownerEntropy).concat(passpoint);
|
||
|
||
// base58check encode
|
||
intermediate = intermediate.concat(Bitcoin.Util.dsha256(intermediate).slice(0, 4));
|
||
callback(Bitcoin.Base58.encode(intermediate));
|
||
});
|
||
},
|
||
BIP38GenerateECAddressAsync: function (intermediate, compressed, callback) {
|
||
// decode IPS
|
||
var x = Bitcoin.Base58.decode(intermediate);
|
||
//if(x.slice(49, 4) !== Bitcoin.Util.dsha256(x.slice(0,49)).slice(0,4)) {
|
||
// callback({error: 'Invalid intermediate passphrase string'});
|
||
//}
|
||
var noNumbers = (x[7] === 0x53);
|
||
var ownerEntropy = x.slice(8, 8 + 8);
|
||
var passpoint = x.slice(16, 16 + 33);
|
||
|
||
// 1) Set flagbyte.
|
||
// set bit 0x20 for compressed key
|
||
// set bit 0x04 if ownerentropy contains a value for lotsequence
|
||
var flagByte = (compressed ? 0x20 : 0x00) | (noNumbers ? 0x00 : 0x04);
|
||
|
||
|
||
// 2) Generate 24 random bytes, call this seedb.
|
||
var seedB = new Array(24);
|
||
var rng = new SecureRandom();
|
||
rng.nextBytes(seedB);
|
||
|
||
// Take SHA256(SHA256(seedb)) to yield 32 bytes, call this factorb.
|
||
var factorB = Bitcoin.Util.dsha256(seedB);
|
||
|
||
// 3) ECMultiply passpoint by factorb. Use the resulting EC point as a public key and hash it into a Bitcoin
|
||
// address using either compressed or uncompressed public key methodology (specify which methodology is used
|
||
// inside flagbyte). This is the generated Bitcoin address, call it generatedaddress.
|
||
var ec = EllipticCurve.getSECCurveByName("secp256k1").getCurve();
|
||
var generatedPoint = ec.decodePointHex(ninja.publicKey.getHexFromByteArray(passpoint));
|
||
var generatedBytes = generatedPoint.multiply(BigInteger.fromByteArrayUnsigned(factorB)).getEncoded(compressed);
|
||
var generatedAddress = (new Bitcoin.Address(Bitcoin.Util.sha256ripe160(generatedBytes))).toString();
|
||
|
||
// 4) Take the first four bytes of SHA256(SHA256(generatedaddress)) and call it addresshash.
|
||
var addressHash = Bitcoin.Util.dsha256(generatedAddress).slice(0, 4);
|
||
|
||
// 5) Now we will encrypt seedb. Derive a second key from passpoint using scrypt
|
||
Crypto_scrypt(passpoint, addressHash.concat(ownerEntropy), 1024, 1, 1, 64, function (derivedBytes) {
|
||
// 6) Do AES256Encrypt(seedb[0...15]] xor derivedhalf1[0...15], derivedhalf2), call the 16-byte result encryptedpart1
|
||
for (var i = 0; i < 16; ++i) {
|
||
seedB[i] ^= derivedBytes[i];
|
||
}
|
||
var AES_opts = { mode: new Crypto.mode.ECB(Crypto.pad.NoPadding), asBytes: true };
|
||
var encryptedPart1 = Crypto.AES.encrypt(seedB.slice(0, 16), derivedBytes.slice(32), AES_opts);
|
||
|
||
// 7) Do AES256Encrypt((encryptedpart1[8...15] + seedb[16...23]) xor derivedhalf1[16...31], derivedhalf2), call the 16-byte result encryptedseedb.
|
||
var message2 = encryptedPart1.slice(8, 8 + 8).concat(seedB.slice(16, 16 + 8));
|
||
for (var i = 0; i < 16; ++i) {
|
||
message2[i] ^= derivedBytes[i + 16];
|
||
}
|
||
var encryptedSeedB = Crypto.AES.encrypt(message2, derivedBytes.slice(32), AES_opts);
|
||
|
||
// 0x01 0x43 + flagbyte + addresshash + ownerentropy + encryptedpart1[0...7] + encryptedpart2
|
||
var encryptedKey = [0x01, 0x43, flagByte].concat(addressHash).concat(ownerEntropy).concat(encryptedPart1.slice(0, 8)).concat(encryptedSeedB);
|
||
|
||
// base58check encode
|
||
encryptedKey = encryptedKey.concat(Bitcoin.Util.dsha256(encryptedKey).slice(0, 4));
|
||
callback(generatedAddress, Bitcoin.Base58.encode(encryptedKey));
|
||
});
|
||
}
|
||
};
|
||
|
||
ninja.publicKey = {
|
||
isPublicKeyHexFormat: function (key) {
|
||
key = key.toString();
|
||
return ninja.publicKey.isUncompressedPublicKeyHexFormat(key) || ninja.publicKey.isCompressedPublicKeyHexFormat(key);
|
||
},
|
||
// 130 characters [0-9A-F] starts with 04
|
||
isUncompressedPublicKeyHexFormat: function (key) {
|
||
key = key.toString();
|
||
return /^04[A-Fa-f0-9]{128}$/.test(key);
|
||
},
|
||
// 66 characters [0-9A-F] starts with 02 or 03
|
||
isCompressedPublicKeyHexFormat: function (key) {
|
||
key = key.toString();
|
||
return /^0[2-3][A-Fa-f0-9]{64}$/.test(key);
|
||
},
|
||
getBitcoinAddressFromByteArray: function (pubKeyByteArray) {
|
||
var pubKeyHash = Bitcoin.Util.sha256ripe160(pubKeyByteArray);
|
||
var addr = new Bitcoin.Address(pubKeyHash);
|
||
return addr.toString();
|
||
},
|
||
getHexFromByteArray: function (pubKeyByteArray) {
|
||
return Crypto.util.bytesToHex(pubKeyByteArray).toString().toUpperCase();
|
||
},
|
||
getByteArrayFromAdding: function (pubKeyHex1, pubKeyHex2) {
|
||
var ecparams = EllipticCurve.getSECCurveByName("secp256k1");
|
||
var curve = ecparams.getCurve();
|
||
var ecPoint1 = curve.decodePointHex(pubKeyHex1);
|
||
var ecPoint2 = curve.decodePointHex(pubKeyHex2);
|
||
// if both points are the same return null
|
||
if (ecPoint1.equals(ecPoint2)) return null;
|
||
var compressed = (ecPoint1.compressed && ecPoint2.compressed);
|
||
var pubKey = ecPoint1.add(ecPoint2).getEncoded(compressed);
|
||
return pubKey;
|
||
},
|
||
getByteArrayFromMultiplying: function (pubKeyHex, ecKey) {
|
||
var ecparams = EllipticCurve.getSECCurveByName("secp256k1");
|
||
var ecPoint = ecparams.getCurve().decodePointHex(pubKeyHex);
|
||
var compressed = (ecPoint.compressed && ecKey.compressed);
|
||
// if both points are the same return null
|
||
ecKey.setCompressed(false);
|
||
if (ecPoint.equals(ecKey.getPubPoint())) {
|
||
return null;
|
||
}
|
||
var bigInt = ecKey.priv;
|
||
var pubKey = ecPoint.multiply(bigInt).getEncoded(compressed);
|
||
return pubKey;
|
||
},
|
||
// used by unit test
|
||
getDecompressedPubKeyHex: function (pubKeyHexComp) {
|
||
var ecparams = EllipticCurve.getSECCurveByName("secp256k1");
|
||
var ecPoint = ecparams.getCurve().decodePointHex(pubKeyHexComp);
|
||
var pubByteArray = ecPoint.getEncoded(0);
|
||
var pubHexUncompressed = ninja.publicKey.getHexFromByteArray(pubByteArray);
|
||
return pubHexUncompressed;
|
||
}
|
||
};
|
||
</script>
|
||
<script type="text/javascript">
|
||
(function (ninja) {
|
||
var qrC = ninja.qrCode = {
|
||
// determine which type number is big enough for the input text length
|
||
getTypeNumber: function (text) {
|
||
var lengthCalculation = text.length * 8 + 12; // length as calculated by the QRCode
|
||
if (lengthCalculation < 72) { return 1; }
|
||
else if (lengthCalculation < 128) { return 2; }
|
||
else if (lengthCalculation < 208) { return 3; }
|
||
else if (lengthCalculation < 288) { return 4; }
|
||
else if (lengthCalculation < 368) { return 5; }
|
||
else if (lengthCalculation < 480) { return 6; }
|
||
else if (lengthCalculation < 528) { return 7; }
|
||
else if (lengthCalculation < 688) { return 8; }
|
||
else if (lengthCalculation < 800) { return 9; }
|
||
else if (lengthCalculation < 976) { return 10; }
|
||
return null;
|
||
},
|
||
|
||
createCanvas: function (text, sizeMultiplier) {
|
||
sizeMultiplier = (sizeMultiplier == undefined) ? 2 : sizeMultiplier; // default 2
|
||
// create the qrcode itself
|
||
var typeNumber = qrC.getTypeNumber(text);
|
||
var qrcode = new QRCode(typeNumber, QRCode.ErrorCorrectLevel.H);
|
||
qrcode.addData(text);
|
||
qrcode.make();
|
||
var width = qrcode.getModuleCount() * sizeMultiplier;
|
||
var height = qrcode.getModuleCount() * sizeMultiplier;
|
||
// create canvas element
|
||
var canvas = document.createElement('canvas');
|
||
var scale = 10.0;
|
||
canvas.width = width * scale;
|
||
canvas.height = height * scale;
|
||
canvas.style.width = width + 'px';
|
||
canvas.style.height = height + 'px';
|
||
var ctx = canvas.getContext('2d');
|
||
ctx.scale(scale, scale);
|
||
// compute tileW/tileH based on width/height
|
||
var tileW = width / qrcode.getModuleCount();
|
||
var tileH = height / qrcode.getModuleCount();
|
||
// draw in the canvas
|
||
for (var row = 0; row < qrcode.getModuleCount() ; row++) {
|
||
for (var col = 0; col < qrcode.getModuleCount() ; col++) {
|
||
ctx.fillStyle = qrcode.isDark(row, col) ? "#000000" : "#ffffff";
|
||
ctx.fillRect(col * tileW, row * tileH, tileW, tileH);
|
||
}
|
||
}
|
||
// return just built canvas
|
||
return canvas;
|
||
},
|
||
|
||
// show QRCodes with canvas
|
||
// parameter: keyValuePair
|
||
// example: { "id1": "string1", "id2": "string2"}
|
||
// "id1" is the id of a div element where you want a QRCode inserted.
|
||
// "string1" is the string you want encoded into the QRCode.
|
||
showQrCode: function (keyValuePair, sizeMultiplier) {
|
||
for (var key in keyValuePair) {
|
||
var value = keyValuePair[key];
|
||
try {
|
||
if (document.getElementById(key)) {
|
||
document.getElementById(key).innerHTML = "";
|
||
document.getElementById(key).appendChild(qrC.createCanvas(value, sizeMultiplier));
|
||
}
|
||
}
|
||
catch (e) { }
|
||
}
|
||
}
|
||
};
|
||
})(ninja);
|
||
</script>
|
||
<script type="text/javascript">
|
||
(function (ninja) {
|
||
var status = ninja.status = function() {
|
||
var cryptoCase = "";
|
||
if (window.crypto && window.crypto.getRandomValues) {
|
||
document.getElementById("statuscrypto").innerHTML = "✔"; //✔
|
||
cryptoCase = "good";
|
||
}
|
||
else {
|
||
document.getElementById("statuscrypto").innerHTML = "×"; //×
|
||
cryptoCase = "bad";
|
||
}
|
||
|
||
var protocolCase = "";
|
||
switch (window.location.protocol) {
|
||
case 'file:':
|
||
document.getElementById("statusprotocol").innerHTML = "✔"; //✔
|
||
protocolCase = "good";
|
||
break;
|
||
case 'http:':
|
||
case 'https:':
|
||
document.getElementById("statusprotocol").innerHTML = "⚠"; //⚠
|
||
protocolCase = "bad";
|
||
break;
|
||
default:
|
||
}
|
||
|
||
var showCrypto = function () {
|
||
document.getElementById('statuscrypto' + cryptoCase).style.display = 'block';
|
||
};
|
||
|
||
var showProtocol = function () {
|
||
document.getElementById('statusprotocol' + protocolCase).style.display = 'block';
|
||
};
|
||
|
||
|
||
var showKeyPool = function () {
|
||
document.getElementById('statuskeypoolgood').style.display = 'block';
|
||
document.getElementById("keypooltextarea").value = Bitcoin.KeyPool.toString();
|
||
};
|
||
|
||
return {
|
||
showCrypto: showCrypto, showProtocol: showProtocol, showKeyPool: showKeyPool
|
||
};
|
||
}();
|
||
})(ninja);
|
||
|
||
ninja.tab = {
|
||
select: function (walletTab) {
|
||
// detect type: normally an HtmlElement/object but when string then get the element
|
||
if (typeof walletTab === 'string') {
|
||
walletTab = document.getElementById(walletTab);
|
||
}
|
||
var walletType = walletTab.getAttribute("id");
|
||
|
||
if (walletTab.className.indexOf("selected") == -1) {
|
||
// unselect all tabs
|
||
for (var wType in ninja.wallets) {
|
||
document.getElementById(wType).className = "tab";
|
||
ninja.wallets[wType].close();
|
||
}
|
||
|
||
// don't open tab if entropy still being collected
|
||
// exceptions: brainwallet detailwallet
|
||
if (ninja.seeder.isStillSeeding == false || walletType == "brainwallet" || walletType == "detailwallet") {
|
||
walletTab.className += " selected";
|
||
document.getElementById("generate").style.display = "none";
|
||
ninja.wallets[walletTab.getAttribute("id")].open();
|
||
}
|
||
else if (ninja.seeder.isStillSeeding == true && !(walletType == "brainwallet" || walletType == "detailwallet")) {
|
||
document.getElementById("generate").style.display = "block";
|
||
}
|
||
}
|
||
},
|
||
|
||
whichIsOpen: function () {
|
||
var isOpen;
|
||
for (var wType in ninja.wallets) {
|
||
isOpen = ninja.wallets[wType].isOpen();
|
||
if (isOpen) {
|
||
return wType;
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
|
||
};
|
||
|
||
ninja.getQueryString = function () {
|
||
var result = {}, queryString = location.search.substring(1), re = /([^&=]+)=([^&]*)/g, m;
|
||
while (m = re.exec(queryString)) {
|
||
result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
|
||
}
|
||
return result;
|
||
};
|
||
|
||
// use when passing an Array of Functions
|
||
ninja.runSerialized = function (functions, onComplete) {
|
||
onComplete = onComplete || function () { };
|
||
|
||
if (functions.length === 0) onComplete();
|
||
else {
|
||
// run the first function, and make it call this
|
||
// function when finished with the rest of the list
|
||
var f = functions.shift();
|
||
f(function () { ninja.runSerialized(functions, onComplete); });
|
||
}
|
||
};
|
||
|
||
ninja.forSerialized = function (initial, max, whatToDo, onComplete) {
|
||
onComplete = onComplete || function () { };
|
||
|
||
if (initial === max) { onComplete(); }
|
||
else {
|
||
// same idea as runSerialized
|
||
whatToDo(initial, function () { ninja.forSerialized(++initial, max, whatToDo, onComplete); });
|
||
}
|
||
};
|
||
|
||
// use when passing an Object (dictionary) of Functions
|
||
ninja.foreachSerialized = function (collection, whatToDo, onComplete) {
|
||
var keys = [];
|
||
for (var name in collection) {
|
||
keys.push(name);
|
||
}
|
||
ninja.forSerialized(0, keys.length, function (i, callback) {
|
||
whatToDo(keys[i], callback);
|
||
}, onComplete);
|
||
};
|
||
</script>
|
||
<script type="text/javascript">
|
||
(function (wallets, translator, privateKey) {
|
||
var bulk = wallets.bulkwallet = {
|
||
isOpen: function () {
|
||
return (document.getElementById("bulkwallet").className.indexOf("selected") != -1);
|
||
},
|
||
|
||
open: function () {
|
||
document.getElementById("bulkarea").style.display = "block";
|
||
// show a default CSV list if the text area is empty
|
||
if (document.getElementById("bulktextarea").value == "") {
|
||
// return control of the thread to the browser to render the tab switch UI then build a default CSV list
|
||
setTimeout(function () { bulk.buildCSV(3, 1, document.getElementById("bulkcompressed").checked); }, 200);
|
||
}
|
||
|
||
document.getElementById("bulkpassphrase").disabled = !document.getElementById("bulkencrypt").checked;
|
||
},
|
||
|
||
close: function () {
|
||
document.getElementById("bulkarea").style.display = "none";
|
||
},
|
||
|
||
// use this function to bulk generate addresses
|
||
// rowLimit: number of Bitcoin Addresses to generate
|
||
// startIndex: add this number to the row index for output purposes
|
||
// returns:
|
||
// index,bitcoinAddress,privateKeyWif
|
||
buildCSV: function (rowLimit, startIndex, compressedAddrs, passphrase) {
|
||
document.getElementById("bulktextarea").value = translator.get("bulkgeneratingaddresses") + rowLimit;
|
||
bulk.csv = [];
|
||
bulk.csvRowLimit = rowLimit;
|
||
bulk.csvRowsRemaining = rowLimit;
|
||
bulk.csvStartIndex = --startIndex;
|
||
bulk.compressedAddrs = !!compressedAddrs;
|
||
if (bulk.encrypt) {
|
||
if (passphrase == "") {
|
||
alert(translator.get("bip38alertpassphraserequired"));
|
||
return;
|
||
}
|
||
document.getElementById("busyblock").className = "busy";
|
||
privateKey.BIP38GenerateIntermediatePointAsync(passphrase, null, null, function (intermediate) {
|
||
bulk.intermediatePoint = intermediate;
|
||
document.getElementById("busyblock").className = "";
|
||
setTimeout(bulk.batchCSV, 0);
|
||
});
|
||
}
|
||
else {
|
||
setTimeout(bulk.batchCSV, 0);
|
||
}
|
||
},
|
||
|
||
csv: [],
|
||
csvRowsRemaining: null, // use to keep track of how many rows are left to process when building a large CSV array
|
||
csvRowLimit: 0,
|
||
csvStartIndex: 0,
|
||
|
||
batchCSV: function () {
|
||
if (bulk.csvRowsRemaining > 0) {
|
||
bulk.csvRowsRemaining--;
|
||
|
||
if (bulk.encrypt) {
|
||
privateKey.BIP38GenerateECAddressAsync(bulk.intermediatePoint, bulk.compressedAddrs, function (address, encryptedKey) {
|
||
Bitcoin.KeyPool.push(new Bitcoin.Bip38Key(address, encryptedKey));
|
||
|
||
bulk.csv.push((bulk.csvRowLimit - bulk.csvRowsRemaining + bulk.csvStartIndex)
|
||
+ ",\"" + address + "\",\"" + encryptedKey
|
||
+ "\"");
|
||
document.getElementById("bulktextarea").value = translator.get("bulkgeneratingaddresses") + bulk.csvRowsRemaining;
|
||
|
||
// release thread to browser to render UI
|
||
setTimeout(bulk.batchCSV, 0);
|
||
|
||
});
|
||
}
|
||
else {
|
||
var key = new Bitcoin.ECKey(false);
|
||
key.setCompressed(bulk.compressedAddrs);
|
||
bulk.csv.push((bulk.csvRowLimit - bulk.csvRowsRemaining + bulk.csvStartIndex)
|
||
+ ",\"" + key.getBitcoinAddress() + "\",\"" + key.toString("wif")
|
||
//+ "\",\"" + key.toString("wifcomp") // uncomment these lines to add different private key formats to the CSV
|
||
//+ "\",\"" + key.getBitcoinHexFormat()
|
||
//+ "\",\"" + key.toString("base64")
|
||
+ "\"");
|
||
document.getElementById("bulktextarea").value = translator.get("bulkgeneratingaddresses") + bulk.csvRowsRemaining;
|
||
|
||
// release thread to browser to render UI
|
||
setTimeout(bulk.batchCSV, 0);
|
||
}
|
||
}
|
||
// processing is finished so put CSV in text area
|
||
else if (bulk.csvRowsRemaining === 0) {
|
||
document.getElementById("bulktextarea").value = bulk.csv.join("\n");
|
||
}
|
||
},
|
||
|
||
openCloseFaq: function (faqNum) {
|
||
// do close
|
||
if (document.getElementById("bulka" + faqNum).style.display == "block") {
|
||
document.getElementById("bulka" + faqNum).style.display = "none";
|
||
document.getElementById("bulke" + faqNum).setAttribute("class", "more");
|
||
}
|
||
// do open
|
||
else {
|
||
document.getElementById("bulka" + faqNum).style.display = "block";
|
||
document.getElementById("bulke" + faqNum).setAttribute("class", "less");
|
||
}
|
||
},
|
||
|
||
toggleEncrypt: function (element) {
|
||
// enable/disable passphrase textbox
|
||
document.getElementById("bulkpassphrase").disabled = !element.checked;
|
||
bulk.encrypt = element.checked;
|
||
}
|
||
};
|
||
})(ninja.wallets, ninja.translator, ninja.privateKey);
|
||
</script>
|
||
<script type="text/javascript">
|
||
ninja.wallets.brainwallet = {
|
||
isOpen: function () {
|
||
return (document.getElementById("brainwallet").className.indexOf("selected") != -1);
|
||
},
|
||
|
||
open: function () {
|
||
document.getElementById("brainarea").style.display = "block";
|
||
document.getElementById("brainpassphrase").focus();
|
||
document.getElementById("brainwarning").innerHTML = ninja.translator.get("brainalertpassphrasewarning");
|
||
},
|
||
|
||
close: function () {
|
||
document.getElementById("brainarea").style.display = "none";
|
||
},
|
||
|
||
minPassphraseLength: 15,
|
||
|
||
view: function () {
|
||
var key = document.getElementById("brainpassphrase").value.toString()
|
||
document.getElementById("brainpassphrase").value = key;
|
||
var keyConfirm = document.getElementById("brainpassphraseconfirm").value.toString()
|
||
document.getElementById("brainpassphraseconfirm").value = keyConfirm;
|
||
|
||
if (key == keyConfirm || document.getElementById("brainpassphraseshow").checked) {
|
||
// enforce a minimum passphrase length
|
||
if (key.length >= ninja.wallets.brainwallet.minPassphraseLength) {
|
||
var bytes = Crypto.SHA256(key, { asBytes: true });
|
||
var btcKey = new Bitcoin.ECKey(bytes);
|
||
var isCompressed = document.getElementById("braincompressed").checked;
|
||
btcKey.setCompressed(isCompressed);
|
||
var bitcoinAddress = btcKey.getBitcoinAddress();
|
||
var privWif = btcKey.getBitcoinWalletImportFormat();
|
||
document.getElementById("brainbtcaddress").innerHTML = bitcoinAddress;
|
||
document.getElementById("brainbtcprivwif").innerHTML = privWif;
|
||
ninja.qrCode.showQrCode({
|
||
"brainqrcodepublic": bitcoinAddress,
|
||
"brainqrcodeprivate": privWif
|
||
});
|
||
document.getElementById("brainkeyarea").style.visibility = "visible";
|
||
}
|
||
else {
|
||
alert("The passphrase you entered is too short.\n\n" + "Warning: Choosing a strong passphrase is important to avoid brute force attempts to guess your passphrase and steal your SmartCash.");
|
||
ninja.wallets.brainwallet.clear();
|
||
}
|
||
}
|
||
else {
|
||
alert("The passphrase does not match the confirm passphrase.");
|
||
ninja.wallets.brainwallet.clear();
|
||
}
|
||
},
|
||
|
||
clear: function () {
|
||
document.getElementById("brainkeyarea").style.visibility = "hidden";
|
||
},
|
||
|
||
showToggle: function (element) {
|
||
if (element.checked) {
|
||
document.getElementById("brainpassphrase").setAttribute("type", "text");
|
||
document.getElementById("brainpassphraseconfirm").style.visibility = "hidden";
|
||
document.getElementById("brainlabelconfirm").style.visibility = "hidden";
|
||
}
|
||
else {
|
||
document.getElementById("brainpassphrase").setAttribute("type", "password");
|
||
document.getElementById("brainpassphraseconfirm").style.visibility = "visible";
|
||
document.getElementById("brainlabelconfirm").style.visibility = "visible";
|
||
}
|
||
}
|
||
};
|
||
</script>
|
||
<script type="text/javascript">
|
||
/*if (ninja.getQueryString()["showseedpool"] == "true" || ninja.getQueryString()["showseedpool"] == "1") {
|
||
document.getElementById("seedpoolarea").style.display = "block";
|
||
}*/
|
||
document.getElementById("brainarea").style.display = "block";
|
||
</script>
|
||
</body>
|
||
</html>
|