stats.json 360 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378
  1. {
  2. "errors": [
  3. "./lib/jsbn/rsa.ts\n[tsl] ERROR in /home/corax/source/jsencrypt/lib/jsbn/rsa.ts(11,10)\n TS6133: 'linebrk' is declared but its value is never read.",
  4. "./lib/jsbn/rsa.ts\n[tsl] ERROR in /home/corax/source/jsencrypt/lib/jsbn/rsa.ts(21,10)\n TS6133: 'byte2Hex' is declared but its value is never read."
  5. ],
  6. "warnings": [],
  7. "version": "3.10.0",
  8. "hash": "aec46fc65c33ce497959",
  9. "time": 1411,
  10. "publicPath": "",
  11. "assetsByChunkName": {
  12. "main": "bundle.js"
  13. },
  14. "assets": [
  15. {
  16. "name": "bundle.js",
  17. "size": 541848,
  18. "chunks": [
  19. 0
  20. ],
  21. "chunkNames": [
  22. "main"
  23. ],
  24. "emitted": true,
  25. "isOverSizeLimit": true
  26. }
  27. ],
  28. "filteredAssets": 0,
  29. "entrypoints": {
  30. "main": {
  31. "chunks": [
  32. 0
  33. ],
  34. "assets": [
  35. "bundle.js"
  36. ],
  37. "isOverSizeLimit": true
  38. }
  39. },
  40. "chunks": [
  41. {
  42. "id": 0,
  43. "rendered": true,
  44. "initial": true,
  45. "entry": true,
  46. "extraAsync": false,
  47. "size": 158532,
  48. "names": [
  49. "main"
  50. ],
  51. "files": [
  52. "bundle.js"
  53. ],
  54. "hash": "b6a3b215b0fe567a1af4",
  55. "parents": [],
  56. "modules": [
  57. {
  58. "id": 0,
  59. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/jsbn.ts",
  60. "name": "./lib/jsbn/jsbn.ts",
  61. "index": 5,
  62. "index2": 3,
  63. "size": 46027,
  64. "cacheable": true,
  65. "built": true,
  66. "optional": false,
  67. "prefetched": false,
  68. "chunks": [
  69. 0
  70. ],
  71. "assets": [],
  72. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  73. "issuerId": 4,
  74. "issuerName": "./src/jsencrypt.js",
  75. "profile": {
  76. "factory": 48,
  77. "building": 944,
  78. "dependencies": 1
  79. },
  80. "failed": false,
  81. "errors": 0,
  82. "warnings": 0,
  83. "reasons": [
  84. {
  85. "moduleId": 4,
  86. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  87. "module": "./src/jsencrypt.js",
  88. "moduleName": "./src/jsencrypt.js",
  89. "type": "harmony import",
  90. "userRequest": "../lib/jsbn/jsbn",
  91. "loc": "5:0-45"
  92. },
  93. {
  94. "moduleId": 7,
  95. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rsa.ts",
  96. "module": "./lib/jsbn/rsa.ts",
  97. "moduleName": "./lib/jsbn/rsa.ts",
  98. "type": "harmony import",
  99. "userRequest": "./jsbn",
  100. "loc": "4:0-49"
  101. },
  102. {
  103. "moduleId": 12,
  104. "moduleIdentifier": "/home/corax/source/jsencrypt/lib/jsrsasign/asn1-1.0.js",
  105. "module": "./lib/jsrsasign/asn1-1.0.js",
  106. "moduleName": "./lib/jsrsasign/asn1-1.0.js",
  107. "type": "harmony import",
  108. "userRequest": "../jsbn/jsbn",
  109. "loc": "4:0-40"
  110. }
  111. ],
  112. "usedExports": [
  113. "BigInteger",
  114. "parseBigInt"
  115. ],
  116. "providedExports": [
  117. "BigInteger",
  118. "Classic",
  119. "Montgomery",
  120. "nbi",
  121. "parseBigInt",
  122. "intAt",
  123. "nbv",
  124. "nbits"
  125. ],
  126. "optimizationBailout": [],
  127. "depth": 2,
  128. "source": "// Copyright (c) 2005 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n// Basic JavaScript BN library - subset useful for RSA encryption.\nimport { cbit, int2char, lbit, op_and, op_andnot, op_or, op_xor } from \"./util\";\n// Bits per digit\nvar dbits;\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = ((canary & 0xffffff) == 0xefcafe);\n//#region\nvar 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];\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\n//#endregion\n// (public) Constructor\nvar BigInteger = /** @class */ (function () {\n function BigInteger(a, b, c) {\n if (a != null)\n if (\"number\" == typeof a)\n this.fromNumber(a, b, c);\n else if (b == null && \"string\" != typeof a)\n this.fromString(a, 256);\n else\n this.fromString(a, b);\n }\n //#region PUBLIC\n // BigInteger.prototype.toString = bnToString;\n // (public) return string representation in given radix\n BigInteger.prototype.toString = function (b) {\n if (this.s < 0) {\n return \"-\" + this.negate().toString(b);\n }\n var k;\n if (b == 16)\n k = 4;\n else if (b == 8)\n k = 3;\n else if (b == 2)\n k = 1;\n else if (b == 32)\n k = 5;\n else if (b == 4)\n k = 2;\n else\n return this.toRadix(b);\n var km = (1 << k) - 1, d, m = false, r = \"\", i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0)\n m = true;\n if (m)\n r += int2char(d);\n }\n }\n return m ? r : \"0\";\n };\n // BigInteger.prototype.negate = bnNegate;\n // (public) -this\n BigInteger.prototype.negate = function () { var r = nbi(); BigInteger.ZERO.subTo(this, r); return r; };\n // BigInteger.prototype.abs = bnAbs;\n // (public) |this|\n BigInteger.prototype.abs = function () { return (this.s < 0) ? this.negate() : this; };\n // BigInteger.prototype.compareTo = bnCompareTo;\n // (public) return + if this > a, - if this < a, 0 if equal\n BigInteger.prototype.compareTo = function (a) {\n var r = this.s - a.s;\n if (r != 0)\n return r;\n var i = this.t;\n r = i - a.t;\n if (r != 0)\n return (this.s < 0) ? -r : r;\n while (--i >= 0)\n if ((r = this[i] - a[i]) != 0)\n return r;\n return 0;\n };\n // BigInteger.prototype.bitLength = bnBitLength;\n // (public) return the number of bits in \"this\"\n BigInteger.prototype.bitLength = function () {\n if (this.t <= 0)\n return 0;\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\n };\n // BigInteger.prototype.mod = bnMod;\n // (public) this mod a\n BigInteger.prototype.mod = function (a) {\n var r = nbi();\n this.abs().divRemTo(a, null, r);\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0)\n a.subTo(r, r);\n return r;\n };\n // BigInteger.prototype.modPowInt = bnModPowInt;\n // (public) this^e % m, 0 <= e < 2^32\n BigInteger.prototype.modPowInt = function (e, m) {\n var z;\n if (e < 256 || m.isEven())\n z = new Classic(m);\n else\n z = new Montgomery(m);\n return this.exp(e, z);\n };\n // BigInteger.prototype.clone = bnClone;\n // (public)\n BigInteger.prototype.clone = function () { var r = nbi(); this.copyTo(r); return r; };\n // BigInteger.prototype.intValue = bnIntValue;\n // (public) return value as integer\n BigInteger.prototype.intValue = function () {\n if (this.s < 0) {\n if (this.t == 1)\n return this[0] - this.DV;\n else if (this.t == 0)\n return -1;\n }\n else if (this.t == 1)\n return this[0];\n else if (this.t == 0)\n return 0;\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n };\n // BigInteger.prototype.byteValue = bnByteValue;\n // (public) return value as byte\n BigInteger.prototype.byteValue = function () { return (this.t == 0) ? this.s : (this[0] << 24) >> 24; };\n // BigInteger.prototype.shortValue = bnShortValue;\n // (public) return value as short (assumes DB>=16)\n BigInteger.prototype.shortValue = function () { return (this.t == 0) ? this.s : (this[0] << 16) >> 16; };\n // BigInteger.prototype.signum = bnSigNum;\n // (public) 0 if this == 0, 1 if this > 0\n BigInteger.prototype.signum = function () {\n if (this.s < 0)\n return -1;\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0))\n return 0;\n else\n return 1;\n };\n // BigInteger.prototype.toByteArray = bnToByteArray;\n // (public) convert to bigendian byte array\n BigInteger.prototype.toByteArray = function () {\n var i = this.t, r = new Array();\n r[0] = this.s;\n var p = this.DB - (i * this.DB) % 8, d, k = 0;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p)\n r[k++] = d | (this.s << (this.DB - p));\n while (i >= 0) {\n if (p < 8) {\n d = (this[i] & ((1 << p) - 1)) << (8 - p);\n d |= this[--i] >> (p += this.DB - 8);\n }\n else {\n d = (this[i] >> (p -= 8)) & 0xff;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if ((d & 0x80) != 0)\n d |= -256;\n if (k == 0 && (this.s & 0x80) != (d & 0x80))\n ++k;\n if (k > 0 || d != this.s)\n r[k++] = d;\n }\n }\n return r;\n };\n // BigInteger.prototype.equals = bnEquals;\n BigInteger.prototype.equals = function (a) { return (this.compareTo(a) == 0); };\n // BigInteger.prototype.min = bnMin;\n BigInteger.prototype.min = function (a) { return (this.compareTo(a) < 0) ? this : a; };\n // BigInteger.prototype.max = bnMax;\n BigInteger.prototype.max = function (a) { return (this.compareTo(a) > 0) ? this : a; };\n // BigInteger.prototype.and = bnAnd;\n BigInteger.prototype.and = function (a) { var r = nbi(); this.bitwiseTo(a, op_and, r); return r; };\n // BigInteger.prototype.or = bnOr;\n BigInteger.prototype.or = function (a) { var r = nbi(); this.bitwiseTo(a, op_or, r); return r; };\n // BigInteger.prototype.xor = bnXor;\n BigInteger.prototype.xor = function (a) { var r = nbi(); this.bitwiseTo(a, op_xor, r); return r; };\n // BigInteger.prototype.andNot = bnAndNot;\n BigInteger.prototype.andNot = function (a) { var r = nbi(); this.bitwiseTo(a, op_andnot, r); return r; };\n // BigInteger.prototype.not = bnNot;\n // (public) ~this\n BigInteger.prototype.not = function () {\n var r = nbi();\n for (var i = 0; i < this.t; ++i)\n r[i] = this.DM & ~this[i];\n r.t = this.t;\n r.s = ~this.s;\n return r;\n };\n // BigInteger.prototype.shiftLeft = bnShiftLeft;\n // (public) this << n\n BigInteger.prototype.shiftLeft = function (n) {\n var r = nbi();\n if (n < 0)\n this.rShiftTo(-n, r);\n else\n this.lShiftTo(n, r);\n return r;\n };\n // BigInteger.prototype.shiftRight = bnShiftRight;\n // (public) this >> n\n BigInteger.prototype.shiftRight = function (n) {\n var r = nbi();\n if (n < 0)\n this.lShiftTo(-n, r);\n else\n this.rShiftTo(n, r);\n return r;\n };\n // BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\n // (public) returns index of lowest 1-bit (or -1 if none)\n BigInteger.prototype.getLowestSetBit = function () {\n for (var i = 0; i < this.t; ++i)\n if (this[i] != 0)\n return i * this.DB + lbit(this[i]);\n if (this.s < 0)\n return this.t * this.DB;\n return -1;\n };\n // BigInteger.prototype.bitCount = bnBitCount;\n // (public) return number of set bits\n BigInteger.prototype.bitCount = function () {\n var r = 0, x = this.s & this.DM;\n for (var i = 0; i < this.t; ++i)\n r += cbit(this[i] ^ x);\n return r;\n };\n // BigInteger.prototype.testBit = bnTestBit;\n // (public) true iff nth bit is set\n BigInteger.prototype.testBit = function (n) {\n var j = Math.floor(n / this.DB);\n if (j >= this.t)\n return (this.s != 0);\n return ((this[j] & (1 << (n % this.DB))) != 0);\n };\n // BigInteger.prototype.setBit = bnSetBit;\n // (public) this | (1<<n)\n BigInteger.prototype.setBit = function (n) { return this.changeBit(n, op_or); };\n // BigInteger.prototype.clearBit = bnClearBit;\n // (public) this & ~(1<<n)\n BigInteger.prototype.clearBit = function (n) { return this.changeBit(n, op_andnot); };\n // BigInteger.prototype.flipBit = bnFlipBit;\n // (public) this ^ (1<<n)\n BigInteger.prototype.flipBit = function (n) { return this.changeBit(n, op_xor); };\n // BigInteger.prototype.add = bnAdd;\n // (public) this + a\n BigInteger.prototype.add = function (a) { var r = nbi(); this.addTo(a, r); return r; };\n // BigInteger.prototype.subtract = bnSubtract;\n // (public) this - a\n BigInteger.prototype.subtract = function (a) { var r = nbi(); this.subTo(a, r); return r; };\n // BigInteger.prototype.multiply = bnMultiply;\n // (public) this * a\n BigInteger.prototype.multiply = function (a) { var r = nbi(); this.multiplyTo(a, r); return r; };\n // BigInteger.prototype.divide = bnDivide;\n // (public) this / a\n BigInteger.prototype.divide = function (a) { var r = nbi(); this.divRemTo(a, r, null); return r; };\n // BigInteger.prototype.remainder = bnRemainder;\n // (public) this % a\n BigInteger.prototype.remainder = function (a) { var r = nbi(); this.divRemTo(a, null, r); return r; };\n // BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;\n // (public) [this/a,this%a]\n BigInteger.prototype.divideAndRemainder = function (a) {\n var q = nbi(), r = nbi();\n this.divRemTo(a, q, r);\n return new Array(q, r);\n };\n // BigInteger.prototype.modPow = bnModPow;\n // (public) this^e % m (HAC 14.85)\n BigInteger.prototype.modPow = function (e, m) {\n var i = e.bitLength(), k, r = nbv(1), z;\n if (i <= 0)\n return r;\n else if (i < 18)\n k = 1;\n else if (i < 48)\n k = 3;\n else if (i < 144)\n k = 4;\n else if (i < 768)\n k = 5;\n else\n k = 6;\n if (i < 8)\n z = new Classic(m);\n else if (m.isEven())\n z = new Barrett(m);\n else\n z = new Montgomery(m);\n // precomputation\n var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;\n g[1] = z.convert(this);\n if (k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1], g2);\n while (n <= km) {\n g[n] = nbi();\n z.mulTo(g2, g[n - 2], g[n]);\n n += 2;\n }\n }\n var j = e.t - 1, w, is1 = true, r2 = nbi(), t;\n i = nbits(e[j]) - 1;\n while (j >= 0) {\n if (i >= k1)\n w = (e[j] >> (i - k1)) & km;\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\n if (j > 0)\n w |= e[j - 1] >> (this.DB + i - k1);\n }\n n = k;\n while ((w & 1) == 0) {\n w >>= 1;\n --n;\n }\n if ((i -= n) < 0) {\n i += this.DB;\n --j;\n }\n if (is1) {\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while (n > 1) {\n z.sqrTo(r, r2);\n z.sqrTo(r2, r);\n n -= 2;\n }\n if (n > 0)\n z.sqrTo(r, r2);\n else {\n t = r;\n r = r2;\n r2 = t;\n }\n z.mulTo(r2, g[w], r);\n }\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\n z.sqrTo(r, r2);\n t = r;\n r = r2;\n r2 = t;\n if (--i < 0) {\n i = this.DB - 1;\n --j;\n }\n }\n }\n return z.revert(r);\n };\n // BigInteger.prototype.modInverse = bnModInverse;\n // (public) 1/this % m (HAC 14.61)\n BigInteger.prototype.modInverse = function (m) {\n var ac = m.isEven();\n if ((this.isEven() && ac) || m.signum() == 0)\n return BigInteger.ZERO;\n var u = m.clone(), v = this.clone();\n var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);\n while (u.signum() != 0) {\n while (u.isEven()) {\n u.rShiftTo(1, u);\n if (ac) {\n if (!a.isEven() || !b.isEven()) {\n a.addTo(this, a);\n b.subTo(m, b);\n }\n a.rShiftTo(1, a);\n }\n else if (!b.isEven())\n b.subTo(m, b);\n b.rShiftTo(1, b);\n }\n while (v.isEven()) {\n v.rShiftTo(1, v);\n if (ac) {\n if (!c.isEven() || !d.isEven()) {\n c.addTo(this, c);\n d.subTo(m, d);\n }\n c.rShiftTo(1, c);\n }\n else if (!d.isEven())\n d.subTo(m, d);\n d.rShiftTo(1, d);\n }\n if (u.compareTo(v) >= 0) {\n u.subTo(v, u);\n if (ac)\n a.subTo(c, a);\n b.subTo(d, b);\n }\n else {\n v.subTo(u, v);\n if (ac)\n c.subTo(a, c);\n d.subTo(b, d);\n }\n }\n if (v.compareTo(BigInteger.ONE) != 0)\n return BigInteger.ZERO;\n if (d.compareTo(m) >= 0)\n return d.subtract(m);\n if (d.signum() < 0)\n d.addTo(m, d);\n else\n return d;\n if (d.signum() < 0)\n return d.add(m);\n else\n return d;\n };\n // BigInteger.prototype.pow = bnPow;\n // (public) this^e\n BigInteger.prototype.pow = function (e) { return this.exp(e, new NullExp()); };\n // BigInteger.prototype.gcd = bnGCD;\n // (public) gcd(this,a) (HAC 14.54)\n BigInteger.prototype.gcd = function (a) {\n var x = (this.s < 0) ? this.negate() : this.clone();\n var y = (a.s < 0) ? a.negate() : a.clone();\n if (x.compareTo(y) < 0) {\n var t = x;\n x = y;\n y = t;\n }\n var i = x.getLowestSetBit(), g = y.getLowestSetBit();\n if (g < 0)\n return x;\n if (i < g)\n g = i;\n if (g > 0) {\n x.rShiftTo(g, x);\n y.rShiftTo(g, y);\n }\n while (x.signum() > 0) {\n if ((i = x.getLowestSetBit()) > 0)\n x.rShiftTo(i, x);\n if ((i = y.getLowestSetBit()) > 0)\n y.rShiftTo(i, y);\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x);\n x.rShiftTo(1, x);\n }\n else {\n y.subTo(x, y);\n y.rShiftTo(1, y);\n }\n }\n if (g > 0)\n y.lShiftTo(g, y);\n return y;\n };\n // BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n // (public) test primality with certainty >= 1-.5^t\n BigInteger.prototype.isProbablePrime = function (t) {\n var i, x = this.abs();\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\n for (i = 0; i < lowprimes.length; ++i)\n if (x[0] == lowprimes[i])\n return true;\n return false;\n }\n if (x.isEven())\n return false;\n i = 1;\n while (i < lowprimes.length) {\n var m = lowprimes[i], j = i + 1;\n while (j < lowprimes.length && m < lplim)\n m *= lowprimes[j++];\n m = x.modInt(m);\n while (i < j)\n if (m % lowprimes[i++] == 0)\n return false;\n }\n return x.millerRabin(t);\n };\n //#endregion PUBLIC\n //#region PROTECTED\n // BigInteger.prototype.copyTo = bnpCopyTo;\n // (protected) copy this to r\n BigInteger.prototype.copyTo = function (r) {\n for (var i = this.t - 1; i >= 0; --i)\n r[i] = this[i];\n r.t = this.t;\n r.s = this.s;\n };\n // BigInteger.prototype.fromInt = bnpFromInt;\n // (protected) set from integer value x, -DV <= x < DV\n BigInteger.prototype.fromInt = function (x) {\n this.t = 1;\n this.s = (x < 0) ? -1 : 0;\n if (x > 0)\n this[0] = x;\n else if (x < -1)\n this[0] = x + this.DV;\n else\n this.t = 0;\n };\n // BigInteger.prototype.fromString = bnpFromString;\n // (protected) set from string and radix\n BigInteger.prototype.fromString = function (s, b) {\n var k;\n if (b == 16)\n k = 4;\n else if (b == 8)\n k = 3;\n else if (b == 256)\n k = 8; // byte array\n else if (b == 2)\n k = 1;\n else if (b == 32)\n k = 5;\n else if (b == 4)\n k = 2;\n else {\n this.fromRadix(s, b);\n return;\n }\n this.t = 0;\n this.s = 0;\n var i = s.length, mi = false, sh = 0;\n while (--i >= 0) {\n var x = (k == 8) ? s[i] & 0xff : intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\")\n mi = true;\n continue;\n }\n mi = false;\n if (sh == 0)\n this[this.t++] = x;\n else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n this[this.t++] = (x >> (this.DB - sh));\n }\n else\n this[this.t - 1] |= x << sh;\n sh += k;\n if (sh >= this.DB)\n sh -= this.DB;\n }\n if (k == 8 && (s[0] & 0x80) != 0) {\n this.s = -1;\n if (sh > 0)\n this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n }\n this.clamp();\n if (mi)\n BigInteger.ZERO.subTo(this, this);\n };\n // BigInteger.prototype.clamp = bnpClamp;\n // (protected) clamp off excess high words\n BigInteger.prototype.clamp = function () {\n var c = this.s & this.DM;\n while (this.t > 0 && this[this.t - 1] == c)\n --this.t;\n };\n // BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\n // (protected) r = this << n*DB\n BigInteger.prototype.dlShiftTo = function (n, r) {\n var i;\n for (i = this.t - 1; i >= 0; --i)\n r[i + n] = this[i];\n for (i = n - 1; i >= 0; --i)\n r[i] = 0;\n r.t = this.t + n;\n r.s = this.s;\n };\n // BigInteger.prototype.drShiftTo = bnpDRShiftTo;\n // (protected) r = this >> n*DB\n BigInteger.prototype.drShiftTo = function (n, r) {\n for (var i = n; i < this.t; ++i)\n r[i - n] = this[i];\n r.t = Math.max(this.t - n, 0);\n r.s = this.s;\n };\n // BigInteger.prototype.lShiftTo = bnpLShiftTo;\n // (protected) r = this << n\n BigInteger.prototype.lShiftTo = function (n, r) {\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << cbs) - 1;\n var ds = Math.floor(n / this.DB), c = (this.s << bs) & this.DM, i;\n for (i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (this[i] >> cbs) | c;\n c = (this[i] & bm) << bs;\n }\n for (i = ds - 1; i >= 0; --i)\n r[i] = 0;\n r[ds] = c;\n r.t = this.t + ds + 1;\n r.s = this.s;\n r.clamp();\n };\n // BigInteger.prototype.rShiftTo = bnpRShiftTo;\n // (protected) r = this >> n\n BigInteger.prototype.rShiftTo = function (n, r) {\n r.s = this.s;\n var ds = Math.floor(n / this.DB);\n if (ds >= this.t) {\n r.t = 0;\n return;\n }\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << bs) - 1;\n r[0] = this[ds] >> bs;\n for (var i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs;\n r[i - ds] = this[i] >> bs;\n }\n if (bs > 0)\n r[this.t - ds - 1] |= (this.s & bm) << cbs;\n r.t = this.t - ds;\n r.clamp();\n };\n // BigInteger.prototype.subTo = bnpSubTo;\n // (protected) r = this - a\n BigInteger.prototype.subTo = function (a, r) {\n var i = 0, c = 0, m = Math.min(a.t, this.t);\n while (i < m) {\n c += this[i] - a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n if (a.t < this.t) {\n c -= a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c -= a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c < -1)\n r[i++] = this.DV + c;\n else if (c > 0)\n r[i++] = c;\n r.t = i;\n r.clamp();\n };\n // BigInteger.prototype.multiplyTo = bnpMultiplyTo;\n // (protected) r = this * a, r != this,a (HAC 14.12)\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyTo = function (a, r) {\n var x = this.abs(), y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n while (--i >= 0)\n r[i] = 0;\n for (i = 0; i < y.t; ++i)\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n r.s = 0;\n r.clamp();\n if (this.s != a.s)\n BigInteger.ZERO.subTo(r, r);\n };\n // BigInteger.prototype.squareTo = bnpSquareTo;\n // (protected) r = this^2, r != this (HAC 14.16)\n BigInteger.prototype.squareTo = function (r) {\n var x = this.abs();\n var i = r.t = 2 * x.t;\n while (--i >= 0)\n r[i] = 0;\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV;\n r[i + x.t + 1] = 1;\n }\n }\n if (r.t > 0)\n r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n r.s = 0;\n r.clamp();\n };\n // BigInteger.prototype.divRemTo = bnpDivRemTo;\n // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n // r != q, this != m. q or r may be null.\n BigInteger.prototype.divRemTo = function (m, q, r) {\n var pm = m.abs();\n if (pm.t <= 0)\n return;\n var pt = this.abs();\n if (pt.t < pm.t) {\n if (q != null)\n q.fromInt(0);\n if (r != null)\n this.copyTo(r);\n return;\n }\n if (r == null)\n r = nbi();\n var y = nbi(), ts = this.s, ms = m.s;\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y);\n pt.lShiftTo(nsh, r);\n }\n else {\n pm.copyTo(y);\n pt.copyTo(r);\n }\n var ys = y.t;\n var y0 = y[ys - 1];\n if (y0 == 0)\n return;\n var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\n var d1 = this.FV / yt, d2 = (1 << this.F1) / yt, e = 1 << this.F2;\n var i = r.t, j = i - ys, t = (q == null) ? nbi() : q;\n y.dlShiftTo(j, t);\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1;\n r.subTo(t, r);\n }\n BigInteger.ONE.dlShiftTo(ys, t);\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n while (y.t < ys)\n y[y.t++] = 0;\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n y.dlShiftTo(j, t);\n r.subTo(t, r);\n while (r[i] < --qd)\n r.subTo(t, r);\n }\n }\n if (q != null) {\n r.drShiftTo(ys, q);\n if (ts != ms)\n BigInteger.ZERO.subTo(q, q);\n }\n r.t = ys;\n r.clamp();\n if (nsh > 0)\n r.rShiftTo(nsh, r); // Denormalize remainder\n if (ts < 0)\n BigInteger.ZERO.subTo(r, r);\n };\n // BigInteger.prototype.invDigit = bnpInvDigit;\n // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n // justification:\n // xy == 1 (mod m)\n // xy = 1+km\n // xy(2-xy) = (1+km)(1-km)\n // x[y(2-xy)] = 1-k^2m^2\n // x[y(2-xy)] == 1 (mod m^2)\n // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n // JS multiply \"overflows\" differently from C/C++, so care is needed here.\n BigInteger.prototype.invDigit = function () {\n if (this.t < 1)\n return 0;\n var x = this[0];\n if ((x & 1) == 0)\n return 0;\n var y = x & 3; // y == 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y > 0) ? this.DV - y : -y;\n };\n // BigInteger.prototype.isEven = bnpIsEven;\n // (protected) true iff this is even\n BigInteger.prototype.isEven = function () { return ((this.t > 0) ? (this[0] & 1) : this.s) == 0; };\n // BigInteger.prototype.exp = bnpExp;\n // (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\n BigInteger.prototype.exp = function (e, z) {\n if (e > 0xffffffff || e < 1)\n return BigInteger.ONE;\n var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e) - 1;\n g.copyTo(r);\n while (--i >= 0) {\n z.sqrTo(r, r2);\n if ((e & (1 << i)) > 0)\n z.mulTo(r2, g, r);\n else {\n var t = r;\n r = r2;\n r2 = t;\n }\n }\n return z.revert(r);\n };\n // BigInteger.prototype.chunkSize = bnpChunkSize;\n // (protected) return x s.t. r^x < DV\n BigInteger.prototype.chunkSize = function (r) { return Math.floor(Math.LN2 * this.DB / Math.log(r)); };\n // BigInteger.prototype.toRadix = bnpToRadix;\n // (protected) convert to radix string\n BigInteger.prototype.toRadix = function (b) {\n if (b == null)\n b = 10;\n if (this.signum() == 0 || b < 2 || b > 36)\n return \"0\";\n var cs = this.chunkSize(b);\n var a = Math.pow(b, cs);\n var d = nbv(a), y = nbi(), z = nbi(), r = \"\";\n this.divRemTo(d, y, z);\n while (y.signum() > 0) {\n r = (a + z.intValue()).toString(b).substr(1) + r;\n y.divRemTo(d, y, z);\n }\n return z.intValue().toString(b) + r;\n };\n // BigInteger.prototype.fromRadix = bnpFromRadix;\n // (protected) convert from radix string\n BigInteger.prototype.fromRadix = function (s, b) {\n this.fromInt(0);\n if (b == null)\n b = 10;\n var cs = this.chunkSize(b);\n var d = Math.pow(b, cs), mi = false, j = 0, w = 0;\n for (var i = 0; i < s.length; ++i) {\n var x = intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\" && this.signum() == 0)\n mi = true;\n continue;\n }\n w = b * w + x;\n if (++j >= cs) {\n this.dMultiply(d);\n this.dAddOffset(w, 0);\n j = 0;\n w = 0;\n }\n }\n if (j > 0) {\n this.dMultiply(Math.pow(b, j));\n this.dAddOffset(w, 0);\n }\n if (mi)\n BigInteger.ZERO.subTo(this, this);\n };\n // BigInteger.prototype.fromNumber = bnpFromNumber;\n // (protected) alternate constructor\n BigInteger.prototype.fromNumber = function (a, b, c) {\n if (\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if (a < 2)\n this.fromInt(1);\n else {\n this.fromNumber(a, c);\n if (!this.testBit(a - 1))\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\n if (this.isEven())\n this.dAddOffset(1, 0); // force odd\n while (!this.isProbablePrime(b)) {\n this.dAddOffset(2, 0);\n if (this.bitLength() > a)\n this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\n }\n }\n }\n else {\n // new BigInteger(int,RNG)\n var x = new Array(), t = a & 7;\n x.length = (a >> 3) + 1;\n b.nextBytes(x);\n if (t > 0)\n x[0] &= ((1 << t) - 1);\n else\n x[0] = 0;\n this.fromString(x, 256);\n }\n };\n // BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\n // (protected) r = this op a (bitwise)\n BigInteger.prototype.bitwiseTo = function (a, op, r) {\n var i, f, m = Math.min(a.t, this.t);\n for (i = 0; i < m; ++i)\n r[i] = op(this[i], a[i]);\n if (a.t < this.t) {\n f = a.s & this.DM;\n for (i = m; i < this.t; ++i)\n r[i] = op(this[i], f);\n r.t = this.t;\n }\n else {\n f = this.s & this.DM;\n for (i = m; i < a.t; ++i)\n r[i] = op(f, a[i]);\n r.t = a.t;\n }\n r.s = op(this.s, a.s);\n r.clamp();\n };\n // BigInteger.prototype.changeBit = bnpChangeBit;\n // (protected) this op (1<<n)\n BigInteger.prototype.changeBit = function (n, op) {\n var r = BigInteger.ONE.shiftLeft(n);\n this.bitwiseTo(r, op, r);\n return r;\n };\n // BigInteger.prototype.addTo = bnpAddTo;\n // (protected) r = this + a\n BigInteger.prototype.addTo = function (a, r) {\n var i = 0, c = 0, m = Math.min(a.t, this.t);\n while (i < m) {\n c += this[i] + a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n if (a.t < this.t) {\n c += a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c += a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c > 0)\n r[i++] = c;\n else if (c < -1)\n r[i++] = this.DV + c;\n r.t = i;\n r.clamp();\n };\n // BigInteger.prototype.dMultiply = bnpDMultiply;\n // (protected) this *= n, this >= 0, 1 < n < DV\n BigInteger.prototype.dMultiply = function (n) {\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\n ++this.t;\n this.clamp();\n };\n // BigInteger.prototype.dAddOffset = bnpDAddOffset;\n // (protected) this += n << w words, this >= 0\n BigInteger.prototype.dAddOffset = function (n, w) {\n if (n == 0)\n return;\n while (this.t <= w)\n this[this.t++] = 0;\n this[w] += n;\n while (this[w] >= this.DV) {\n this[w] -= this.DV;\n if (++w >= this.t)\n this[this.t++] = 0;\n ++this[w];\n }\n };\n // BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\n // (protected) r = lower n words of \"this * a\", a.t <= n\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyLowerTo = function (a, n, r) {\n var i = Math.min(this.t + a.t, n);\n r.s = 0; // assumes a,this >= 0\n r.t = i;\n while (i > 0)\n r[--i] = 0;\n var j;\n for (j = r.t - this.t; i < j; ++i)\n r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\n for (j = Math.min(a.t, n); i < j; ++i)\n this.am(0, a[i], r, i, 0, n - i);\n r.clamp();\n };\n // BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\n // (protected) r = \"this * a\" without lower n words, n > 0\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyUpperTo = function (a, n, r) {\n --n;\n var i = r.t = this.t + a.t - n;\n r.s = 0; // assumes a,this >= 0\n while (--i >= 0)\n r[i] = 0;\n for (i = Math.max(n - this.t, 0); i < a.t; ++i)\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\n r.clamp();\n r.drShiftTo(1, r);\n };\n // BigInteger.prototype.modInt = bnpModInt;\n // (protected) this % n, n < 2^26\n BigInteger.prototype.modInt = function (n) {\n if (n <= 0)\n return 0;\n var d = this.DV % n, r = (this.s < 0) ? n - 1 : 0;\n if (this.t > 0)\n if (d == 0)\n r = this[0] % n;\n else\n for (var i = this.t - 1; i >= 0; --i)\n r = (d * r + this[i]) % n;\n return r;\n };\n // BigInteger.prototype.millerRabin = bnpMillerRabin;\n // (protected) true if probably prime (HAC 4.24, Miller-Rabin)\n BigInteger.prototype.millerRabin = function (t) {\n var n1 = this.subtract(BigInteger.ONE);\n var k = n1.getLowestSetBit();\n if (k <= 0)\n return false;\n var r = n1.shiftRight(k);\n t = (t + 1) >> 1;\n if (t > lowprimes.length)\n t = lowprimes.length;\n var a = nbi();\n for (var i = 0; i < t; ++i) {\n //Pick bases at random, instead of starting at 2\n a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\n var y = a.modPow(r, this);\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1;\n while (j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2, this);\n if (y.compareTo(BigInteger.ONE) == 0)\n return false;\n }\n if (y.compareTo(n1) != 0)\n return false;\n }\n }\n return true;\n };\n //BigInteger.prototype.square = bnSquare;\n // (public) this^2\n BigInteger.prototype.square = function () { var r = nbi(); this.squareTo(r); return r; };\n return BigInteger;\n}());\nexport { BigInteger };\n//#region REDUCERS\n//#region NullExp\nvar NullExp = /** @class */ (function () {\n function NullExp() {\n }\n // NullExp.prototype.convert = nNop;\n NullExp.prototype.convert = function (x) { return x; };\n // NullExp.prototype.revert = nNop;\n NullExp.prototype.revert = function (x) { return x; };\n // NullExp.prototype.mulTo = nMulTo;\n NullExp.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); };\n // NullExp.prototype.sqrTo = nSqrTo;\n NullExp.prototype.nSqrTo = function (x, r) { x.squareTo(r); };\n return NullExp;\n}());\n// Modular reduction using \"classic\" algorithm\nvar Classic = /** @class */ (function () {\n function Classic(m) {\n this.m = m;\n }\n // Classic.prototype.convert = cConvert;\n Classic.prototype.convert = function (x) {\n if (x.s < 0 || x.compareTo(this.m) >= 0)\n return x.mod(this.m);\n else\n return x;\n };\n // Classic.prototype.revert = cRevert;\n Classic.prototype.revert = function (x) {\n return x;\n };\n // Classic.prototype.reduce = cReduce;\n Classic.prototype.reduce = function (x) {\n x.divRemTo(this.m, null, x);\n };\n // Classic.prototype.mulTo = cMulTo;\n Classic.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n };\n // Classic.prototype.sqrTo = cSqrTo;\n Classic.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n this.reduce(r);\n };\n return Classic;\n}());\nexport { Classic };\n//#endregion\n//#region Montgomery\n// Montgomery reduction\nvar Montgomery = /** @class */ (function () {\n function Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp & 0x7fff;\n this.mph = this.mp >> 15;\n this.um = (1 << (m.DB - 15)) - 1;\n this.mt2 = 2 * m.t;\n }\n // Montgomery.prototype.convert = montConvert;\n // xR mod m\n Montgomery.prototype.convert = function (x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t, r);\n r.divRemTo(this.m, null, r);\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0)\n this.m.subTo(r, r);\n return r;\n };\n // Montgomery.prototype.revert = montRevert;\n // x/R mod m\n Montgomery.prototype.revert = function (x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n };\n // Montgomery.prototype.reduce = montReduce;\n // x = x/R mod m (HAC 14.32)\n Montgomery.prototype.reduce = function (x) {\n while (x.t <= this.mt2)\n x[x.t++] = 0;\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t;\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n // propagate carry\n while (x[j] >= x.DV) {\n x[j] -= x.DV;\n x[++j]++;\n }\n }\n x.clamp();\n x.drShiftTo(this.m.t, x);\n if (x.compareTo(this.m) >= 0)\n x.subTo(this.m, x);\n };\n // Montgomery.prototype.mulTo = montMulTo;\n // r = \"xy/R mod m\"; x,y != r\n Montgomery.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); this.reduce(r); };\n // Montgomery.prototype.sqrTo = montSqrTo;\n // r = \"x^2/R mod m\"; x != r\n Montgomery.prototype.sqrTo = function (x, r) { x.squareTo(r); this.reduce(r); };\n return Montgomery;\n}());\nexport { Montgomery };\n//#endregion Montgomery\n//#region Barrett\n// Barrett modular reduction\nvar Barrett = /** @class */ (function () {\n function Barrett(m) {\n this.m = m;\n // setup Barrett\n this.r2 = nbi();\n this.q3 = nbi();\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\n this.mu = this.r2.divide(m);\n }\n // Barrett.prototype.convert = barrettConvert;\n Barrett.prototype.convert = function (x) {\n if (x.s < 0 || x.t > 2 * this.m.t)\n return x.mod(this.m);\n else if (x.compareTo(this.m) < 0)\n return x;\n else {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n }\n };\n // Barrett.prototype.revert = barrettRevert;\n Barrett.prototype.revert = function (x) { return x; };\n // Barrett.prototype.reduce = barrettReduce;\n // x = x mod m (HAC 14.42)\n Barrett.prototype.reduce = function (x) {\n x.drShiftTo(this.m.t - 1, this.r2);\n if (x.t > this.m.t + 1) {\n x.t = this.m.t + 1;\n x.clamp();\n }\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\n while (x.compareTo(this.r2) < 0)\n x.dAddOffset(1, this.m.t + 1);\n x.subTo(this.r2, x);\n while (x.compareTo(this.m) >= 0)\n x.subTo(this.m, x);\n };\n // Barrett.prototype.mulTo = barrettMulTo;\n // r = x*y mod m; x,y != r\n Barrett.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); this.reduce(r); };\n // Barrett.prototype.sqrTo = barrettSqrTo;\n // r = x^2 mod m; x != r\n Barrett.prototype.sqrTo = function (x, r) { x.squareTo(r); this.reduce(r); };\n return Barrett;\n}());\n//#endregion\n//#endregion REDUCERS\n// return new, unset BigInteger\nexport function nbi() { return new BigInteger(null); }\nexport function parseBigInt(str, r) {\n return new BigInteger(str, r);\n}\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c;\n c = Math.floor(v / 0x4000000);\n w[j++] = v & 0x3ffffff;\n }\n return c;\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff, xh = x >> 15;\n while (--n >= 0) {\n var l = this[i] & 0x7fff;\n var h = this[i++] >> 15;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n w[j++] = l & 0x3fffffff;\n }\n return c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff, xh = x >> 14;\n while (--n >= 0) {\n var l = this[i] & 0x3fff;\n var h = this[i++] >> 14;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n c = (l >> 28) + (m >> 14) + xh * h;\n w[j++] = l & 0xfffffff;\n }\n return c;\n}\nif (j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n BigInteger.prototype.am = am2;\n dbits = 30;\n}\nelse if (j_lm && (navigator.appName != \"Netscape\")) {\n BigInteger.prototype.am = am1;\n dbits = 26;\n}\nelse {\n BigInteger.prototype.am = am3;\n dbits = 28;\n}\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = ((1 << dbits) - 1);\nBigInteger.prototype.DV = (1 << dbits);\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n// Digit conversions\nvar BI_RC = new Array();\nvar rr, vv;\nrr = \"0\".charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv)\n BI_RC[rr++] = vv;\nrr = \"a\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv)\n BI_RC[rr++] = vv;\nrr = \"A\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv)\n BI_RC[rr++] = vv;\nexport function intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)];\n return (c == null) ? -1 : c;\n}\n// return bigint initialized to value\nexport function nbv(i) { var r = nbi(); r.fromInt(i); return r; }\n// returns bit length of the integer x\nexport function nbits(x) {\n var r = 1, t;\n if ((t = x >>> 16) != 0) {\n x = t;\n r += 16;\n }\n if ((t = x >> 8) != 0) {\n x = t;\n r += 8;\n }\n if ((t = x >> 4) != 0) {\n x = t;\n r += 4;\n }\n if ((t = x >> 2) != 0) {\n x = t;\n r += 2;\n }\n if ((t = x >> 1) != 0) {\n x = t;\n r += 1;\n }\n return r;\n}\n// protected\n// public\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n"
  129. },
  130. {
  131. "id": 1,
  132. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/util.ts",
  133. "name": "./lib/jsbn/util.ts",
  134. "index": 6,
  135. "index2": 2,
  136. "size": 1045,
  137. "cacheable": true,
  138. "built": true,
  139. "optional": false,
  140. "prefetched": false,
  141. "chunks": [
  142. 0
  143. ],
  144. "assets": [],
  145. "issuer": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/base64.ts",
  146. "issuerId": 2,
  147. "issuerName": "./lib/jsbn/base64.ts",
  148. "profile": {
  149. "factory": 156,
  150. "building": 20
  151. },
  152. "failed": false,
  153. "errors": 0,
  154. "warnings": 0,
  155. "reasons": [
  156. {
  157. "moduleId": 0,
  158. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/jsbn.ts",
  159. "module": "./lib/jsbn/jsbn.ts",
  160. "moduleName": "./lib/jsbn/jsbn.ts",
  161. "type": "harmony import",
  162. "userRequest": "./util",
  163. "loc": "5:0-80"
  164. },
  165. {
  166. "moduleId": 2,
  167. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/base64.ts",
  168. "module": "./lib/jsbn/base64.ts",
  169. "moduleName": "./lib/jsbn/base64.ts",
  170. "type": "harmony import",
  171. "userRequest": "./util",
  172. "loc": "1:0-34"
  173. }
  174. ],
  175. "usedExports": [
  176. "cbit",
  177. "int2char",
  178. "lbit",
  179. "op_and",
  180. "op_andnot",
  181. "op_or",
  182. "op_xor"
  183. ],
  184. "providedExports": [
  185. "int2char",
  186. "op_and",
  187. "op_or",
  188. "op_xor",
  189. "op_andnot",
  190. "lbit",
  191. "cbit"
  192. ],
  193. "optimizationBailout": [],
  194. "depth": 3,
  195. "source": "var BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nexport function int2char(n) {\n return BI_RM.charAt(n);\n}\n//#region BIT_OPERATIONS\n// (public) this & a\nexport function op_and(x, y) {\n return x & y;\n}\n// (public) this | a\nexport function op_or(x, y) {\n return x | y;\n}\n// (public) this ^ a\nexport function op_xor(x, y) {\n return x ^ y;\n}\n// (public) this & ~a\nexport function op_andnot(x, y) {\n return x & ~y;\n}\n// return index of lowest 1-bit in x, x < 2^31\nexport function lbit(x) {\n if (x == 0)\n return -1;\n var r = 0;\n if ((x & 0xffff) == 0) {\n x >>= 16;\n r += 16;\n }\n if ((x & 0xff) == 0) {\n x >>= 8;\n r += 8;\n }\n if ((x & 0xf) == 0) {\n x >>= 4;\n r += 4;\n }\n if ((x & 3) == 0) {\n x >>= 2;\n r += 2;\n }\n if ((x & 1) == 0)\n ++r;\n return r;\n}\n// return number of 1 bits in x\nexport function cbit(x) {\n var r = 0;\n while (x != 0) {\n x &= x - 1;\n ++r;\n }\n return r;\n}\n//#endregion BIT_OPERATIONS \n"
  196. },
  197. {
  198. "id": 2,
  199. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/base64.ts",
  200. "name": "./lib/jsbn/base64.ts",
  201. "index": 12,
  202. "index2": 10,
  203. "size": 1966,
  204. "cacheable": true,
  205. "built": true,
  206. "optional": false,
  207. "prefetched": false,
  208. "chunks": [
  209. 0
  210. ],
  211. "assets": [],
  212. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  213. "issuerId": 4,
  214. "issuerName": "./src/jsencrypt.js",
  215. "profile": {
  216. "factory": 48,
  217. "building": 789
  218. },
  219. "failed": false,
  220. "errors": 0,
  221. "warnings": 0,
  222. "reasons": [
  223. {
  224. "moduleId": 4,
  225. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  226. "module": "./src/jsencrypt.js",
  227. "moduleName": "./src/jsencrypt.js",
  228. "type": "harmony import",
  229. "userRequest": "../lib/jsbn/base64",
  230. "loc": "7:0-43"
  231. },
  232. {
  233. "moduleId": 4,
  234. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  235. "module": "./src/jsencrypt.js",
  236. "moduleName": "./src/jsencrypt.js",
  237. "type": "harmony import",
  238. "userRequest": "../lib/jsbn/base64",
  239. "loc": "8:0-44"
  240. }
  241. ],
  242. "usedExports": [
  243. "b64tohex",
  244. "hex2b64"
  245. ],
  246. "providedExports": [
  247. "hex2b64",
  248. "b64tohex",
  249. "b64toBA"
  250. ],
  251. "optimizationBailout": [],
  252. "depth": 2,
  253. "source": "import { int2char } from \"./util\";\nvar b64map = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar b64pad = \"=\";\nexport function hex2b64(h) {\n var i;\n var c;\n var ret = \"\";\n for (i = 0; i + 3 <= h.length; i += 3) {\n c = parseInt(h.substring(i, i + 3), 16);\n ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);\n }\n if (i + 1 == h.length) {\n c = parseInt(h.substring(i, i + 1), 16);\n ret += b64map.charAt(c << 2);\n }\n else if (i + 2 == h.length) {\n c = parseInt(h.substring(i, i + 2), 16);\n ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);\n }\n while ((ret.length & 3) > 0)\n ret += b64pad;\n return ret;\n}\n// convert a base64 string to hex\nexport function b64tohex(s) {\n var ret = \"\";\n var i;\n var k = 0; // b64 state, 0-3\n var slop;\n for (i = 0; i < s.length; ++i) {\n if (s.charAt(i) == b64pad)\n break;\n var v = b64map.indexOf(s.charAt(i));\n if (v < 0)\n continue;\n if (k == 0) {\n ret += int2char(v >> 2);\n slop = v & 3;\n k = 1;\n }\n else if (k == 1) {\n ret += int2char((slop << 2) | (v >> 4));\n slop = v & 0xf;\n k = 2;\n }\n else if (k == 2) {\n ret += int2char(slop);\n ret += int2char(v >> 2);\n slop = v & 3;\n k = 3;\n }\n else {\n ret += int2char((slop << 2) | (v >> 4));\n ret += int2char(v & 0xf);\n k = 0;\n }\n }\n if (k == 1)\n ret += int2char(slop << 2);\n return ret;\n}\n// convert a base64 string to a byte/number array\nexport function b64toBA(s) {\n //piggyback on b64tohex for now, optimize later\n var h = b64tohex(s);\n var i;\n var a = new Array();\n for (i = 0; 2 * i < h.length; ++i) {\n a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);\n }\n return a;\n}\n"
  254. },
  255. {
  256. "id": 3,
  257. "identifier": "/home/corax/source/jsencrypt/test/test.rsa.js",
  258. "name": "./test/test.rsa.js",
  259. "index": 0,
  260. "index2": 12,
  261. "size": 12539,
  262. "cacheable": true,
  263. "built": true,
  264. "optional": false,
  265. "prefetched": false,
  266. "chunks": [
  267. 0
  268. ],
  269. "assets": [],
  270. "issuer": null,
  271. "issuerId": null,
  272. "issuerName": null,
  273. "profile": {
  274. "factory": 16,
  275. "building": 17
  276. },
  277. "failed": false,
  278. "errors": 0,
  279. "warnings": 0,
  280. "reasons": [],
  281. "usedExports": true,
  282. "providedExports": [],
  283. "optimizationBailout": [],
  284. "depth": 0,
  285. "source": "import {JSEncrypt} from \"../src/jsencrypt\";\n\nvar keySizes = [128, 256, 512, 1024, 2048];\n\nvar pbkeys = [\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MCwwDQYJKoZIhvcNAQEBBQADGwAwGAIRAMfE82X6tlpNK7Bxbhg6nEECAwEAAQ==\\n\" +\n \"-----END PUBLIC KEY-----\",\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MDwwDQYJKoZIhvcNAQEBBQADKwAwKAIhAMLw0mRGv5KF+P0LsgNvfrM5AJdVBWqr\\n\" +\n \"Q6Bf2gES5gwPAgMBAAE=\\n\" +\n \"-----END PUBLIC KEY-----\",\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKEpu21RDTXxEly55HdkVV9SlFL3Hgpl\\n\" +\n \"i6+IohAsnaqFnApsKi1R7fAd3tBLmeHV2tlxYIogtxpzfpcc+QBVDx8CAwEAAQ==\\n\" +\n \"-----END PUBLIC KEY-----\",\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5LO5xVlO9g4PL1xdWudnihIAP\\n\" +\n \"bMsixr396bIbBIwKBul98UWQ3UALbqByq2bXVuoIbl48UokxOVstenGCyyo026NF\\n\" +\n \"h3Fg6Cnvj9ptvbmqk2i3eTOBrt+e26Z1sepsnQL5OojiVIbrWwS6v1pFCXpnnLLv\\n\" +\n \"yy6GPt/kftbhazH3oQIDAQAB\\n\" +\n \"-----END PUBLIC KEY-----\",\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtKrsFSnzYl19m5wTwYdu\\n\" +\n \"/r1UVZJV+zkAFud6+XTInAy8HbCR9n59H9+54P+Af/fUE6rvEPc4H09Z63vQzIGM\\n\" +\n \"iL6GlqzMmptv/KRDIhj7Mk3MXomvEVfUsXrz5IpO0lf6NSeGhz4PGZUkHZ30VRx3\\n\" +\n \"Jd/a0KIhgftZHxzmMsh8iB/n781B18pCP2eOPTF+5gRCaW+0fVPBlb/mBlg8MJrd\\n\" +\n \"ScGCAReQ9NfTq8slJ0aO1NWaaRRANPQcCMljnTIK1ssyXBaSHKfoWeGx141mWMRx\\n\" +\n \"/LxyZ13Zc3lqgmICiKFqMrQl5UeV1IUXYpj5hO9f60LGpZVHDqqo/JdF3+VAheaf\\n\" +\n \"QwIDAQAB\\n\" +\n \"-----END PUBLIC KEY-----\"\n];\n\nvar prkeys = [\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MGMCAQACEQDHxPNl+rZaTSuwcW4YOpxBAgMBAAECEQCqk6mhsmpyv17fK1dPeD3h\\n\" +\n \"AgkA9Lo1aGRom0sCCQDQ+JpqE6KDIwIJAKstyIfBnA3rAggOsWwqCTdkAQIIOP95\\n\" +\n \"RV9y2iQ=\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\",\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MIGqAgEAAiEAwvDSZEa/koX4/QuyA29+szkAl1UFaqtDoF/aARLmDA8CAwEAAQIh\\n\" +\n \"AME2Z5Ez/hR/7PUBboKxM2U7hSaavytvocBdQjLvOUWhAhEA8HgiLHRk9KjJ2hp0\\n\" +\n \"5q3BfQIRAM+H7dYUXRnKXjYoqiKueXsCEGnaaCirf/lXB6vzs3wMBr0CEHT2Xwzw\\n\" +\n \"nSgT7dUIRhsVylECEFQRGFtZcKRmL8lqTBwECWI=\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\",\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MIIBOQIBAAJBAKEpu21RDTXxEly55HdkVV9SlFL3Hgpli6+IohAsnaqFnApsKi1R\\n\" +\n \"7fAd3tBLmeHV2tlxYIogtxpzfpcc+QBVDx8CAwEAAQJAFn0VS07JEiLelhPWfpaA\\n\" +\n \"lzmVuvICvh6nXEormygupBGiIPSXfIsTFid26yxt9wu4JHeRF0lq+Ozo55XpBQED\\n\" +\n \"4QIhAM0E7ikuEa2bDsR2hQJhIz3SvzzyhE5dJcqFjRtKtMQvAiEAyT0C0gUyqCdN\\n\" +\n \"YuRON1T7FUffarMdQXR+8tgRkhoCeBECID+ZKfAoVF+QXDJhub0VOQNyntRfPt+4\\n\" +\n \"UYLTjwRKVm0NAiBuOCtuSoiHTxd0naU1aycmbboxn67bZeoOKkfdZL+LcQIgK6Xh\\n\" +\n \"1wb9I/sNYv9ByJEGBNJRwtUEZrk5babLEdkUq90=\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\",\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MIICXgIBAAKBgQC5LO5xVlO9g4PL1xdWudnihIAPbMsixr396bIbBIwKBul98UWQ\\n\" +\n \"3UALbqByq2bXVuoIbl48UokxOVstenGCyyo026NFh3Fg6Cnvj9ptvbmqk2i3eTOB\\n\" +\n \"rt+e26Z1sepsnQL5OojiVIbrWwS6v1pFCXpnnLLvyy6GPt/kftbhazH3oQIDAQAB\\n\" +\n \"AoGAA+EiGbPCS10e/L1D2uhH3UwDVs9jrhXV0yT7Oz+sI2WjrKTKXU+VUOf/aoeW\\n\" +\n \"vvouKwEM7lyYTTSzaU+AY0oYVzv7HN9hWoVwi0NoPpd4V1RFfFb4+4DmXh+NZS7E\\n\" +\n \"DX9+WY435Yc9Qj7uHoc8EoRk3QfWaZTXd69b/9tS4Yy/tnECQQDxHsSe7Qxd+6tf\\n\" +\n \"/f4eO+bENCxIMbPU8GPWQCvq9eT9Av2I0LTTchmlhG1TSatq62zq+Unef8M/IOBs\\n\" +\n \"j5z3issdAkEAxJpYiuAVXulViUOLdS3QX72owIQLxpFBAKQ9cPTafqc47ms4Swy2\\n\" +\n \"FCa4MZfTJXrDX5pur+PNeP/ce6xZN5DzVQJBAJI1kgy8uU8UGKswnTNAJ4K6EFAG\\n\" +\n \"s4Ff82orp3XmfWBeu9aGl9/PxHV1g8WJWoSPFZC2cXCWEJLrIKszun7wjpECQQCs\\n\" +\n \"Z+mjh1RWUepHn+rozE9B1jDo+iLVc8V8CYszxhThIkWjlnTcI358d2PpYYmxAVHZ\\n\" +\n \"QbU1G2CxbjZsYbwvJTatAkEAspmMlIyKWgrQkLJ4rbPespMJCGe6VYharl1Qc5CF\\n\" +\n \"/2SgKSCuLfhA/Cur0nO3dxt6XJijk/r3+j+8L/m+wqud+A==\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\",\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MIIEpAIBAAKCAQEAtKrsFSnzYl19m5wTwYdu/r1UVZJV+zkAFud6+XTInAy8HbCR\\n\" +\n \"9n59H9+54P+Af/fUE6rvEPc4H09Z63vQzIGMiL6GlqzMmptv/KRDIhj7Mk3MXomv\\n\" +\n \"EVfUsXrz5IpO0lf6NSeGhz4PGZUkHZ30VRx3Jd/a0KIhgftZHxzmMsh8iB/n781B\\n\" +\n \"18pCP2eOPTF+5gRCaW+0fVPBlb/mBlg8MJrdScGCAReQ9NfTq8slJ0aO1NWaaRRA\\n\" +\n \"NPQcCMljnTIK1ssyXBaSHKfoWeGx141mWMRx/LxyZ13Zc3lqgmICiKFqMrQl5UeV\\n\" +\n \"1IUXYpj5hO9f60LGpZVHDqqo/JdF3+VAheafQwIDAQABAoIBAQCS/++PWM7bXk5x\\n\" +\n \"apD4ioXZZ5tS9PpYqoxUFoyMpGUF86asUZqyAUE1ygen9rxLYw5/4jkaiMx1TU9Q\\n\" +\n \"tzGw9Eewi7Veq8LemVKJMe4dtE3PJFYBJe34IorAzdXcQlzX8RV4YmynZetLWXpF\\n\" +\n \"Ttwa1Ept2rJjx0eURzrAgfcbot0Qs+c8bB0qnGC67PoL3DyYg8vX5PDmiiA2VZMG\\n\" +\n \"EylVQS09toJn5ReaKCtjxJb/XFQjBeSP0xLjvZZftGDJgpwmmi7Sy/zAZoF4+7wf\\n\" +\n \"8nihXk4ZfYC+beBj5U9pcUcs6LdNobUofWFRLSjueseRQBI0sKUslr3Ye4zhkrWM\\n\" +\n \"CDnsSxBhAoGBANi0spS/Mc6xH1189mR7dJV9gy7KkGxheAstwCJr7WzbXqglhFm2\\n\" +\n \"SvY9hrpE9OYWir5EqX6jM6VipSobTn0RpCsYUC/J1ISMyEA5UkPLP4jHQw6UUDN2\\n\" +\n \"1fNAXffEyuju5ShP9Mk2unZstlUweKlFF7d1k7YAzWDIKnF6bOL06YC9AoGBANVt\\n\" +\n \"XM4OH0zw8M97W04WwYGoa5s1Y5JYc4RMV200cr3iONVfLZgSP8thP1qPuoMM3OJg\\n\" +\n \"Bqe6MRmo/VXhgVvpke04ZJ83LSz/SoqfVRNwxuCHqp3beJQPxrAp1d/L7Ey7f41U\\n\" +\n \"QBE8pibFb8bbgOTUW5iyZbg7lLS8nghsn+BqYp//AoGBAJO/574o+YGOG+92wttR\\n\" +\n \"nPRLhgSCEaQDdIBSqhwN7+v3SXtlUO6FrmhjHJelaj/yAJinYdS42v6Y2jlyMrpt\\n\" +\n \"K7xCMHHUrzPMdL/tFRyp1+Ce0yZ+kov0Kv1V1nuWzi2wq8cndKM30Dvr9QjyKmJm\\n\" +\n \"fDwWSyadN2oUL3P9X34CM64VAoGAbajAW1skN/tAL8r48dl9WWo4x8mZvJLX36z9\\n\" +\n \"6q1dGzVF8FPz8EPIJW51B8n7keQlBedC5CElo0KRz/OK7LfI87La+Hd4LbuKCEmv\\n\" +\n \"g8qZVLpALtWaUbD9bHxCWLfFVPOtqOcV+AVKdXdSZEFaK7j0yzM2Un/Ce07CgB+X\\n\" +\n \"0c23mO8CgYAOqnUR/uPIzkvj/eIbO7pnhHoKZ4Ji2TrIBqjskzaFd0Tox9i3SWKa\\n\" +\n \"cRdQciRIT1wkMdywnHFrJT1rwYXxcgfQXAku/vnYqAfvIzY7TyoL3pWX55O0Zrs7\\n\" +\n \"05R9mA5TZmzUU9m/PzUrRjasOGYSKkCz4Y2qGlrKI3H0aE+p+R56kQ==\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\"\n];\n\nkeySizes.forEach(function(keySize, index){\n \n var jse = new JSEncrypt({default_key_size:keySize});\n var openssl_public_key = pbkeys[index];\n var openssl_private_key = prkeys[index];\n \n describe('JSEncrypt - '+keySize+' bit', function(){\n //this.timeout(0); //Timout for test cases, zero means infinite. Needed for key sizes > 1024\n \n describe('#getKey()', function(){\n \n it('should be '+keySize+' bit long', function () {\n \n var key = jse.getKey();\n var length = key.n.bitLength();\n length = length%2===0 ? length: length+1;\n expect(length).to.equal(keySize);\n\n });\n \n });\n\n describe('#encrypt() | #decrypt()', function(){\n \n //Tom Wu's RSA Object use paddingpkcs #1, type 2\n var maxLength = (((jse.getKey().n.bitLength()+7)>>3)-11);\n var maxLengthBit = maxLength << 3;\n \n it('should encrypt/decrypt up to '+maxLengthBit+' bit', function () {\n\n var test = [];\n for (var i=0; i<maxLength;i++)\n test.push('a');\n test = test.join('');\n\n var encrypted = jse.encrypt(test);\n expect(encrypted).to.be.ok();\n\n var decrypted = jse.decrypt(encrypted);\n expect(decrypted).to.be(test);\n\n });\n\n it('should fail to encrypt more than '+maxLengthBit+' bit', function(){\n \n var test = [];\n for (var i=0; i<(maxLength+1);i++)\n test.push('a');\n test = test.join('');\n\n var encrypted = jse.encrypt(test);\n expect(encrypted).to.not.be.ok();\n \n });\n\n });\n \n describe('#getPublicKey()', function(){\n \n var pkey = jse.getPublicKey();\n \n it('should be a non-empty string', function(){\n \n expect(pkey).to.be.a('string');\n expect(pkey).to.not.be.empty();\n \n });\n \n it('should contain public header and footer and be wrapped at 64 chars', function(){\n //For small bit keys, the public key may contain only one line\n var regex = /-----BEGIN PUBLIC KEY-----\\n((.{64}\\n)+(.{1,64}\\n)?)|(.{1,64}\\n)-----END PUBLIC KEY-----/;\n expect(pkey).to.match(regex);\n\n });\n \n });\n \n describe('#getPrivateKey()', function(){\n \n var pkey = jse.getPrivateKey();\n \n it('should be a non-empty string', function(){\n \n expect(pkey).to.be.a('string');\n expect(pkey).to.not.be.empty();\n \n });\n \n it('should contain private header and footer and be wrapped at 64 chars', function(){\n \n var regex = /-----BEGIN RSA PRIVATE KEY-----\\n(.{64}\\n)+(.{1,64}\\n)?-----END RSA PRIVATE KEY-----/;\n expect(pkey).to.match(regex);\n \n });\n \n });\n \n describe('#getPublicKeyB64()', function(){\n \n var pkey = jse.getPublicKeyB64();\n \n it('should be a non-empty string', function(){\n \n expect(pkey).to.be.a('string');\n expect(pkey).to.not.be.empty();\n \n });\n \n it('should not contain public header and footer,one line, base64 encoded', function(){\n \n //regex to match base64 encoded string, reference:\n //http://stackoverflow.com/a/5885097/1446321\n var regex = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/;\n expect(pkey).to.match(regex);\n \n });\n \n });\n \n describe('#getPrivateKeyB64()', function(){\n \n var pkey = jse.getPrivateKeyB64();\n \n it('should be a non-empty string', function(){\n \n expect(pkey).to.be.a('string');\n expect(pkey).to.not.be.empty();\n \n });\n \n it('should not contain private header and footer,one line, base64 encoded', function(){\n \n //regex to match base64 encoded string, reference:\n //http://stackoverflow.com/a/5885097/1446321\n var regex = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/;\n expect(pkey).to.match(regex);\n \n });\n \n });\n \n describe('#setPrivateKey()', function(){\n \n var tmp = new JSEncrypt();\n tmp.setPrivateKey(openssl_private_key);\n \n it('should correctly set the private key parameters',function(){\n \n var params = ['n', 'e', 'd', 'p', 'q', 'dmp1', 'dmq1', 'coeff'];\n expect(tmp.key).to.be.ok();\n expect(tmp.key).to.have.keys(params);\n params.forEach(function(value,index){\n expect(tmp.key[value]).to.be.ok();\n });\n \n });\n \n it('should both encrypt and decrypt',function(){\n \n var test = 'test';\n var enc = tmp.encrypt(test);\n expect(enc).to.be.ok();\n var dec = tmp.decrypt(enc);\n expect(dec).to.be(test);\n \n });\n \n });\n \n describe('#setPublicKey()', function(){\n \n var tmp = new JSEncrypt();\n tmp.setPublicKey(openssl_public_key);\n \n it('should correctly set the public key parameters',function(){\n \n var pub_params = ['n', 'e'];\n var priv_params = ['d', 'p', 'q', 'dmp1', 'dmq1', 'coeff'];\n expect(tmp.key).to.be.ok();\n expect(tmp.key).to.have.keys(pub_params);\n pub_params.forEach(function(value,index){\n expect(tmp.key[value]).to.be.ok();\n });\n priv_params.forEach(function(value,index){\n expect(tmp.key[value]).to.not.be.ok();\n });\n \n });\n \n it('should only encrypt',function(){\n \n var test = 'test';\n var enc = tmp.encrypt(test);\n var dec = tmp.decrypt(enc);\n expect(enc).to.be.ok();\n expect(dec).to.not.be.ok();\n \n });\n \n });\n \n });\n \n});\n\n"
  286. },
  287. {
  288. "id": 4,
  289. "identifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  290. "name": "./src/jsencrypt.js",
  291. "index": 1,
  292. "index2": 11,
  293. "size": 16124,
  294. "cacheable": true,
  295. "built": true,
  296. "optional": false,
  297. "prefetched": false,
  298. "chunks": [
  299. 0
  300. ],
  301. "assets": [],
  302. "issuer": "/home/corax/source/jsencrypt/test/test.rsa.js",
  303. "issuerId": 3,
  304. "issuerName": "./test/test.rsa.js",
  305. "profile": {
  306. "factory": 2,
  307. "building": 11
  308. },
  309. "failed": false,
  310. "errors": 0,
  311. "warnings": 0,
  312. "reasons": [
  313. {
  314. "moduleId": 3,
  315. "moduleIdentifier": "/home/corax/source/jsencrypt/test/test.rsa.js",
  316. "module": "./test/test.rsa.js",
  317. "moduleName": "./test/test.rsa.js",
  318. "type": "harmony import",
  319. "userRequest": "../src/jsencrypt",
  320. "loc": "1:0-43"
  321. }
  322. ],
  323. "usedExports": [
  324. "JSEncrypt"
  325. ],
  326. "providedExports": [
  327. "JSEncrypt"
  328. ],
  329. "optimizationBailout": [],
  330. "depth": 1,
  331. "source": "import {ASN1} from \"../lib/asn1js/asn1\";\nimport {RSAKey} from \"../lib/jsbn/rsa\";\nimport {Base64} from \"../lib/asn1js/base64\";\nimport {Hex} from \"../lib/asn1js/hex\";\nimport {parseBigInt} from \"../lib/jsbn/jsbn\";\nimport {KJUR} from \"../lib/jsrsasign/asn1-1.0\";\nimport {hex2b64} from \"../lib/jsbn/base64\";\nimport {b64tohex} from \"../lib/jsbn/base64\";\n\n/**\n * Retrieve the hexadecimal value (as a string) of the current ASN.1 element\n * @returns {string}\n * @public\n */\nASN1.prototype.getHexStringValue = function () {\n var hexString = this.toHexString();\n var offset = this.header * 2;\n var length = this.length * 2;\n return hexString.substr(offset, length);\n};\n\n/**\n * Method to parse a pem encoded string containing both a public or private key.\n * The method will translate the pem encoded string in a der encoded string and\n * will parse private key and public key parameters. This method accepts public key\n * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).\n *\n * @todo Check how many rsa formats use the same format of pkcs #1.\n *\n * The format is defined as:\n * PublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * PublicKey BIT STRING\n * }\n * Where AlgorithmIdentifier is:\n * AlgorithmIdentifier ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\n * }\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n * it's possible to examine the structure of the keys obtained from openssl using\n * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/\n * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer\n * @private\n */\nRSAKey.prototype.parseKey = function (pem) {\n try {\n var modulus = 0;\n var public_exponent = 0;\n var reHex = /^\\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\\s*)+$/;\n var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);\n var asn1 = ASN1.decode(der);\n\n //Fixes a bug with OpenSSL 1.0+ private keys\n if(asn1.sub.length === 3){\n asn1 = asn1.sub[2].sub[0];\n }\n if (asn1.sub.length === 9) {\n\n // Parse the private key.\n modulus = asn1.sub[1].getHexStringValue(); //bigint\n this.n = parseBigInt(modulus, 16);\n\n public_exponent = asn1.sub[2].getHexStringValue(); //int\n this.e = parseInt(public_exponent, 16);\n\n var private_exponent = asn1.sub[3].getHexStringValue(); //bigint\n this.d = parseBigInt(private_exponent, 16);\n\n var prime1 = asn1.sub[4].getHexStringValue(); //bigint\n this.p = parseBigInt(prime1, 16);\n\n var prime2 = asn1.sub[5].getHexStringValue(); //bigint\n this.q = parseBigInt(prime2, 16);\n\n var exponent1 = asn1.sub[6].getHexStringValue(); //bigint\n this.dmp1 = parseBigInt(exponent1, 16);\n\n var exponent2 = asn1.sub[7].getHexStringValue(); //bigint\n this.dmq1 = parseBigInt(exponent2, 16);\n\n var coefficient = asn1.sub[8].getHexStringValue(); //bigint\n this.coeff = parseBigInt(coefficient, 16);\n\n }\n else if (asn1.sub.length === 2) {\n\n // Parse the public key.\n var bit_string = asn1.sub[1];\n var sequence = bit_string.sub[0];\n\n modulus = sequence.sub[0].getHexStringValue();\n this.n = parseBigInt(modulus, 16);\n public_exponent = sequence.sub[1].getHexStringValue();\n this.e = parseInt(public_exponent, 16);\n\n }\n else {\n return false;\n }\n return true;\n }\n catch (ex) {\n return false;\n }\n};\n\n/**\n * Translate rsa parameters in a hex encoded string representing the rsa key.\n *\n * The translation follow the ASN.1 notation :\n * RSAPrivateKey ::= SEQUENCE {\n * version Version,\n * modulus INTEGER, -- n\n * publicExponent INTEGER, -- e\n * privateExponent INTEGER, -- d\n * prime1 INTEGER, -- p\n * prime2 INTEGER, -- q\n * exponent1 INTEGER, -- d mod (p1)\n * exponent2 INTEGER, -- d mod (q-1)\n * coefficient INTEGER, -- (inverse of q) mod p\n * }\n * @returns {string} DER Encoded String representing the rsa private key\n * @private\n */\nRSAKey.prototype.getPrivateBaseKey = function () {\n var options = {\n 'array': [\n new KJUR.asn1.DERInteger({'int': 0}),\n new KJUR.asn1.DERInteger({'bigint': this.n}),\n new KJUR.asn1.DERInteger({'int': this.e}),\n new KJUR.asn1.DERInteger({'bigint': this.d}),\n new KJUR.asn1.DERInteger({'bigint': this.p}),\n new KJUR.asn1.DERInteger({'bigint': this.q}),\n new KJUR.asn1.DERInteger({'bigint': this.dmp1}),\n new KJUR.asn1.DERInteger({'bigint': this.dmq1}),\n new KJUR.asn1.DERInteger({'bigint': this.coeff})\n ]\n };\n var seq = new KJUR.asn1.DERSequence(options);\n return seq.getEncodedHex();\n};\n\n/**\n * base64 (pem) encoded version of the DER encoded representation\n * @returns {string} pem encoded representation without header and footer\n * @public\n */\nRSAKey.prototype.getPrivateBaseKeyB64 = function () {\n return hex2b64(this.getPrivateBaseKey());\n};\n\n/**\n * Translate rsa parameters in a hex encoded string representing the rsa public key.\n * The representation follow the ASN.1 notation :\n * PublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * PublicKey BIT STRING\n * }\n * Where AlgorithmIdentifier is:\n * AlgorithmIdentifier ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\n * }\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n * @returns {string} DER Encoded String representing the rsa public key\n * @private\n */\nRSAKey.prototype.getPublicBaseKey = function () {\n var options = {\n 'array': [\n new KJUR.asn1.DERObjectIdentifier({'oid': '1.2.840.113549.1.1.1'}), //RSA Encryption pkcs #1 oid\n new KJUR.asn1.DERNull()\n ]\n };\n var first_sequence = new KJUR.asn1.DERSequence(options);\n\n options = {\n 'array': [\n new KJUR.asn1.DERInteger({'bigint': this.n}),\n new KJUR.asn1.DERInteger({'int': this.e})\n ]\n };\n var second_sequence = new KJUR.asn1.DERSequence(options);\n\n options = {\n 'hex': '00' + second_sequence.getEncodedHex()\n };\n var bit_string = new KJUR.asn1.DERBitString(options);\n\n options = {\n 'array': [\n first_sequence,\n bit_string\n ]\n };\n var seq = new KJUR.asn1.DERSequence(options);\n return seq.getEncodedHex();\n};\n\n/**\n * base64 (pem) encoded version of the DER encoded representation\n * @returns {string} pem encoded representation without header and footer\n * @public\n */\nRSAKey.prototype.getPublicBaseKeyB64 = function () {\n return hex2b64(this.getPublicBaseKey());\n};\n\n/**\n * wrap the string in block of width chars. The default value for rsa keys is 64\n * characters.\n * @param {string} str the pem encoded string without header and footer\n * @param {Number} [width=64] - the length the string has to be wrapped at\n * @returns {string}\n * @private\n */\nRSAKey.prototype.wordwrap = function (str, width) {\n width = width || 64;\n if (!str) {\n return str;\n }\n var regex = '(.{1,' + width + '})( +|$\\n?)|(.{1,' + width + '})';\n return str.match(RegExp(regex, 'g')).join('\\n');\n};\n\n/**\n * Retrieve the pem encoded private key\n * @returns {string} the pem encoded private key with header/footer\n * @public\n */\nRSAKey.prototype.getPrivateKey = function () {\n var key = \"-----BEGIN RSA PRIVATE KEY-----\\n\";\n key += this.wordwrap(this.getPrivateBaseKeyB64()) + \"\\n\";\n key += \"-----END RSA PRIVATE KEY-----\";\n return key;\n};\n\n/**\n * Retrieve the pem encoded public key\n * @returns {string} the pem encoded public key with header/footer\n * @public\n */\nRSAKey.prototype.getPublicKey = function () {\n var key = \"-----BEGIN PUBLIC KEY-----\\n\";\n key += this.wordwrap(this.getPublicBaseKeyB64()) + \"\\n\";\n key += \"-----END PUBLIC KEY-----\";\n return key;\n};\n\n/**\n * Check if the object contains the necessary parameters to populate the rsa modulus\n * and public exponent parameters.\n * @param {Object} [obj={}] - An object that may contain the two public key\n * parameters\n * @returns {boolean} true if the object contains both the modulus and the public exponent\n * properties (n and e)\n * @todo check for types of n and e. N should be a parseable bigInt object, E should\n * be a parseable integer number\n * @private\n */\nRSAKey.prototype.hasPublicKeyProperty = function (obj) {\n obj = obj || {};\n return (\n obj.hasOwnProperty('n') &&\n obj.hasOwnProperty('e')\n );\n};\n\n/**\n * Check if the object contains ALL the parameters of an RSA key.\n * @param {Object} [obj={}] - An object that may contain nine rsa key\n * parameters\n * @returns {boolean} true if the object contains all the parameters needed\n * @todo check for types of the parameters all the parameters but the public exponent\n * should be parseable bigint objects, the public exponent should be a parseable integer number\n * @private\n */\nRSAKey.prototype.hasPrivateKeyProperty = function (obj) {\n obj = obj || {};\n return (\n obj.hasOwnProperty('n') &&\n obj.hasOwnProperty('e') &&\n obj.hasOwnProperty('d') &&\n obj.hasOwnProperty('p') &&\n obj.hasOwnProperty('q') &&\n obj.hasOwnProperty('dmp1') &&\n obj.hasOwnProperty('dmq1') &&\n obj.hasOwnProperty('coeff')\n );\n};\n\n/**\n * Parse the properties of obj in the current rsa object. Obj should AT LEAST\n * include the modulus and public exponent (n, e) parameters.\n * @param {Object} obj - the object containing rsa parameters\n * @private\n */\nRSAKey.prototype.parsePropertiesFrom = function (obj) {\n this.n = obj.n;\n this.e = obj.e;\n\n if (obj.hasOwnProperty('d')) {\n this.d = obj.d;\n this.p = obj.p;\n this.q = obj.q;\n this.dmp1 = obj.dmp1;\n this.dmq1 = obj.dmq1;\n this.coeff = obj.coeff;\n }\n};\n\n/**\n * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.\n * This object is just a decorator for parsing the key parameter\n * @param {string|Object} key - The key in string format, or an object containing\n * the parameters needed to build a RSAKey object.\n * @constructor\n */\nclass JSEncryptRSAKey extends RSAKey {\n constructor(key) {\n super();\n // Call the super constructor.\n // RSAKey.call(this);\n // If a key key was provided.\n if (key) {\n // If this is a string...\n if (typeof key === 'string') {\n this.parseKey(key);\n }\n else if (\n this.hasPrivateKeyProperty(key) ||\n this.hasPublicKeyProperty(key)\n ) {\n // Set the values for the key.\n this.parsePropertiesFrom(key);\n }\n }\n }\n}\n\n// Derive from RSAKey.\n// JSEncryptRSAKey.prototype = new RSAKey();\n\n// Reset the contructor.\n// JSEncryptRSAKey.prototype.constructor = JSEncryptRSAKey;\n\n\n/**\n *\n * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour\n * possible parameters are:\n * - default_key_size {number} default: 1024 the key size in bit\n * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent\n * - log {boolean} default: false whether log warn/error or not\n * @constructor\n */\nexport class JSEncrypt {\n constructor(options) {\n options = options || {};\n this.default_key_size = parseInt(options.default_key_size) || 1024;\n this.default_public_exponent = options.default_public_exponent || '010001'; //65537 default openssl public exponent for rsa key type\n this.log = options.log || false;\n // The private and public key.\n this.key = null;\n };\n}\n\n/**\n * Method to set the rsa key parameter (one method is enough to set both the public\n * and the private key, since the private key contains the public key paramenters)\n * Log a warning if logs are enabled\n * @param {Object|string} key the pem encoded string or an object (with or without header/footer)\n * @public\n */\nJSEncrypt.prototype.setKey = function (key) {\n if (this.log && this.key) {\n console.warn('A key was already set, overriding existing.');\n }\n this.key = new JSEncryptRSAKey(key);\n};\n\n/**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\nJSEncrypt.prototype.setPrivateKey = function (privkey) {\n // Create the key.\n this.setKey(privkey);\n};\n\n/**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\nJSEncrypt.prototype.setPublicKey = function (pubkey) {\n // Sets the public key.\n this.setKey(pubkey);\n};\n\n/**\n * Proxy method for RSAKey object's decrypt, decrypt the string using the private\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} string base64 encoded crypted string to decrypt\n * @return {string} the decrypted string\n * @public\n */\nJSEncrypt.prototype.decrypt = function (string) {\n // Return the decrypted string.\n try {\n return this.getKey().decrypt(b64tohex(string));\n }\n catch (ex) {\n return false;\n }\n};\n\n/**\n * Proxy method for RSAKey object's encrypt, encrypt the string using the public\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} string the string to encrypt\n * @return {string} the encrypted string encoded in base64\n * @public\n */\nJSEncrypt.prototype.encrypt = function (string) {\n // Return the encrypted string.\n try {\n return hex2b64(this.getKey().encrypt(string));\n }\n catch (ex) {\n return false;\n }\n};\n\n/**\n * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object\n * will be created and returned\n * @param {callback} [cb] the callback to be called if we want the key to be generated\n * in an async fashion\n * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object\n * @public\n */\nJSEncrypt.prototype.getKey = function (cb) {\n // Only create new if it does not exist.\n if (!this.key) {\n // Get a new private key.\n this.key = new JSEncryptRSAKey();\n if (cb && {}.toString.call(cb) === '[object Function]') {\n this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);\n return;\n }\n // Generate the key.\n this.key.generate(this.default_key_size, this.default_public_exponent);\n }\n return this.key;\n};\n\n/**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITH header and footer\n * @public\n */\nJSEncrypt.prototype.getPrivateKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateKey();\n};\n\n/**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITHOUT header and footer\n * @public\n */\nJSEncrypt.prototype.getPrivateKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateBaseKeyB64();\n};\n\n\n/**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITH header and footer\n * @public\n */\nJSEncrypt.prototype.getPublicKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicKey();\n};\n\n/**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITHOUT header and footer\n * @public\n */\nJSEncrypt.prototype.getPublicKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicBaseKeyB64();\n};\n\n"
  332. },
  333. {
  334. "id": 5,
  335. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/asn1.ts",
  336. "name": "./lib/asn1js/asn1.ts",
  337. "index": 2,
  338. "index2": 1,
  339. "size": 19813,
  340. "cacheable": true,
  341. "built": true,
  342. "optional": false,
  343. "prefetched": false,
  344. "chunks": [
  345. 0
  346. ],
  347. "assets": [],
  348. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  349. "issuerId": 4,
  350. "issuerName": "./src/jsencrypt.js",
  351. "profile": {
  352. "factory": 33,
  353. "building": 707
  354. },
  355. "failed": false,
  356. "errors": 0,
  357. "warnings": 0,
  358. "reasons": [
  359. {
  360. "moduleId": 4,
  361. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  362. "module": "./src/jsencrypt.js",
  363. "moduleName": "./src/jsencrypt.js",
  364. "type": "harmony import",
  365. "userRequest": "../lib/asn1js/asn1",
  366. "loc": "1:0-40"
  367. }
  368. ],
  369. "usedExports": [
  370. "ASN1"
  371. ],
  372. "providedExports": [
  373. "Stream",
  374. "ASN1"
  375. ],
  376. "optimizationBailout": [],
  377. "depth": 2,
  378. "source": "// ASN.1 JavaScript decoder\n// Copyright (c) 2008-2014 Lapo Luchini <lapo@lapo.it>\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\n/*global oids */\nimport { Int10 } from \"./int10\";\nvar ellipsis = \"\\u2026\";\nvar reTimeS = /^(\\d\\d)(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])([01]\\d|2[0-3])(?:([0-5]\\d)(?:([0-5]\\d)(?:[.,](\\d{1,3}))?)?)?(Z|[-+](?:[0]\\d|1[0-2])([0-5]\\d)?)?$/;\nvar reTimeL = /^(\\d\\d\\d\\d)(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])([01]\\d|2[0-3])(?:([0-5]\\d)(?:([0-5]\\d)(?:[.,](\\d{1,3}))?)?)?(Z|[-+](?:[0]\\d|1[0-2])([0-5]\\d)?)?$/;\nfunction stringCut(str, len) {\n if (str.length > len) {\n str = str.substring(0, len) + ellipsis;\n }\n return str;\n}\nvar Stream = /** @class */ (function () {\n function Stream(enc, pos) {\n this.hexDigits = \"0123456789ABCDEF\";\n if (enc instanceof Stream) {\n this.enc = enc.enc;\n this.pos = enc.pos;\n }\n else {\n // enc should be an array or a binary string\n this.enc = enc;\n this.pos = pos;\n }\n }\n Stream.prototype.get = function (pos) {\n if (pos === undefined) {\n pos = this.pos++;\n }\n if (pos >= this.enc.length) {\n throw new Error(\"Requesting byte offset \" + pos + \" on a stream of length \" + this.enc.length);\n }\n return (\"string\" === typeof this.enc) ? this.enc.charCodeAt(pos) : this.enc[pos];\n };\n Stream.prototype.hexByte = function (b) {\n return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF);\n };\n Stream.prototype.hexDump = function (start, end, raw) {\n var s = \"\";\n for (var i = start; i < end; ++i) {\n s += this.hexByte(this.get(i));\n if (raw !== true) {\n switch (i & 0xF) {\n case 0x7:\n s += \" \";\n break;\n case 0xF:\n s += \"\\n\";\n break;\n default:\n s += \" \";\n }\n }\n }\n return s;\n };\n Stream.prototype.isASCII = function (start, end) {\n for (var i = start; i < end; ++i) {\n var c = this.get(i);\n if (c < 32 || c > 176) {\n return false;\n }\n }\n return true;\n };\n Stream.prototype.parseStringISO = function (start, end) {\n var s = \"\";\n for (var i = start; i < end; ++i) {\n s += String.fromCharCode(this.get(i));\n }\n return s;\n };\n Stream.prototype.parseStringUTF = function (start, end) {\n var s = \"\";\n for (var i = start; i < end;) {\n var c = this.get(i++);\n if (c < 128) {\n s += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F));\n }\n else {\n s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F));\n }\n }\n return s;\n };\n Stream.prototype.parseStringBMP = function (start, end) {\n var str = \"\";\n var hi;\n var lo;\n for (var i = start; i < end;) {\n hi = this.get(i++);\n lo = this.get(i++);\n str += String.fromCharCode((hi << 8) | lo);\n }\n return str;\n };\n Stream.prototype.parseTime = function (start, end, shortYear) {\n var s = this.parseStringISO(start, end);\n var m = (shortYear ? reTimeS : reTimeL).exec(s);\n if (!m) {\n return \"Unrecognized time: \" + s;\n }\n if (shortYear) {\n // to avoid querying the timer, use the fixed range [1970, 2069]\n // it will conform with ITU X.400 [-10, +40] sliding window until 2030\n m[1] = +m[1];\n m[1] += (+m[1] < 70) ? 2000 : 1900;\n }\n s = m[1] + \"-\" + m[2] + \"-\" + m[3] + \" \" + m[4];\n if (m[5]) {\n s += \":\" + m[5];\n if (m[6]) {\n s += \":\" + m[6];\n if (m[7]) {\n s += \".\" + m[7];\n }\n }\n }\n if (m[8]) {\n s += \" UTC\";\n if (m[8] != \"Z\") {\n s += m[8];\n if (m[9]) {\n s += \":\" + m[9];\n }\n }\n }\n return s;\n };\n Stream.prototype.parseInteger = function (start, end) {\n var v = this.get(start);\n var neg = (v > 127);\n var pad = neg ? 255 : 0;\n var len;\n var s = \"\";\n // skip unuseful bits (not allowed in DER)\n while (v == pad && ++start < end) {\n v = this.get(start);\n }\n len = end - start;\n if (len === 0) {\n return neg ? -1 : 0;\n }\n // show bit length of huge integers\n if (len > 4) {\n s = v;\n len <<= 3;\n while (((+s ^ pad) & 0x80) == 0) {\n s = +s << 1;\n --len;\n }\n s = \"(\" + len + \" bit)\\n\";\n }\n // decode the integer\n if (neg) {\n v = v - 256;\n }\n var n = new Int10(v);\n for (var i = start + 1; i < end; ++i) {\n n.mulAdd(256, this.get(i));\n }\n return s + n.toString();\n };\n Stream.prototype.parseBitString = function (start, end, maxLength) {\n var unusedBit = this.get(start);\n var lenBit = ((end - start - 1) << 3) - unusedBit;\n var intro = \"(\" + lenBit + \" bit)\\n\";\n var s = \"\";\n for (var i = start + 1; i < end; ++i) {\n var b = this.get(i);\n var skip = (i == end - 1) ? unusedBit : 0;\n for (var j = 7; j >= skip; --j) {\n s += (b >> j) & 1 ? \"1\" : \"0\";\n }\n if (s.length > maxLength) {\n return intro + stringCut(s, maxLength);\n }\n }\n return intro + s;\n };\n Stream.prototype.parseOctetString = function (start, end, maxLength) {\n if (this.isASCII(start, end)) {\n return stringCut(this.parseStringISO(start, end), maxLength);\n }\n var len = end - start;\n var s = \"(\" + len + \" byte)\\n\";\n maxLength /= 2; // we work in bytes\n if (len > maxLength) {\n end = start + maxLength;\n }\n for (var i = start; i < end; ++i) {\n s += this.hexByte(this.get(i));\n }\n if (len > maxLength) {\n s += ellipsis;\n }\n return s;\n };\n Stream.prototype.parseOID = function (start, end, maxLength) {\n var s = \"\";\n var n = new Int10();\n var bits = 0;\n for (var i = start; i < end; ++i) {\n var v = this.get(i);\n n.mulAdd(128, v & 0x7F);\n bits += 7;\n if (!(v & 0x80)) {\n if (s === \"\") {\n n = n.simplify();\n if (n instanceof Int10) {\n n.sub(80);\n s = \"2.\" + n.toString();\n }\n else {\n var m = n < 80 ? n < 40 ? 0 : 1 : 2;\n s = m + \".\" + (n - m * 40);\n }\n }\n else {\n s += \".\" + n.toString();\n }\n if (s.length > maxLength) {\n return stringCut(s, maxLength);\n }\n n = new Int10();\n bits = 0;\n }\n }\n if (bits > 0) {\n s += \".incomplete\";\n }\n return s;\n };\n return Stream;\n}());\nexport { Stream };\nvar ASN1 = /** @class */ (function () {\n function ASN1(stream, header, length, tag, sub) {\n if (!(tag instanceof ASN1Tag)) {\n throw new Error(\"Invalid tag value.\");\n }\n this.stream = stream;\n this.header = header;\n this.length = length;\n this.tag = tag;\n this.sub = sub;\n }\n ASN1.prototype.typeName = function () {\n switch (this.tag.tagClass) {\n case 0:// universal\n switch (this.tag.tagNumber) {\n case 0x00:\n return \"EOC\";\n case 0x01:\n return \"BOOLEAN\";\n case 0x02:\n return \"INTEGER\";\n case 0x03:\n return \"BIT_STRING\";\n case 0x04:\n return \"OCTET_STRING\";\n case 0x05:\n return \"NULL\";\n case 0x06:\n return \"OBJECT_IDENTIFIER\";\n case 0x07:\n return \"ObjectDescriptor\";\n case 0x08:\n return \"EXTERNAL\";\n case 0x09:\n return \"REAL\";\n case 0x0A:\n return \"ENUMERATED\";\n case 0x0B:\n return \"EMBEDDED_PDV\";\n case 0x0C:\n return \"UTF8String\";\n case 0x10:\n return \"SEQUENCE\";\n case 0x11:\n return \"SET\";\n case 0x12:\n return \"NumericString\";\n case 0x13:\n return \"PrintableString\"; // ASCII subset\n case 0x14:\n return \"TeletexString\"; // aka T61String\n case 0x15:\n return \"VideotexString\";\n case 0x16:\n return \"IA5String\"; // ASCII\n case 0x17:\n return \"UTCTime\";\n case 0x18:\n return \"GeneralizedTime\";\n case 0x19:\n return \"GraphicString\";\n case 0x1A:\n return \"VisibleString\"; // ASCII subset\n case 0x1B:\n return \"GeneralString\";\n case 0x1C:\n return \"UniversalString\";\n case 0x1E:\n return \"BMPString\";\n }\n return \"Universal_\" + this.tag.tagNumber.toString();\n case 1:\n return \"Application_\" + this.tag.tagNumber.toString();\n case 2:\n return \"[\" + this.tag.tagNumber.toString() + \"]\"; // Context\n case 3:\n return \"Private_\" + this.tag.tagNumber.toString();\n }\n };\n ASN1.prototype.content = function (maxLength) {\n if (this.tag === undefined) {\n return null;\n }\n if (maxLength === undefined) {\n maxLength = Infinity;\n }\n var content = this.posContent();\n var len = Math.abs(this.length);\n if (!this.tag.isUniversal()) {\n if (this.sub !== null) {\n return \"(\" + this.sub.length + \" elem)\";\n }\n return this.stream.parseOctetString(content, content + len, maxLength);\n }\n switch (this.tag.tagNumber) {\n case 0x01:// BOOLEAN\n return (this.stream.get(content) === 0) ? \"false\" : \"true\";\n case 0x02:// INTEGER\n return this.stream.parseInteger(content, content + len);\n case 0x03:// BIT_STRING\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\n this.stream.parseBitString(content, content + len, maxLength);\n case 0x04:// OCTET_STRING\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\n this.stream.parseOctetString(content, content + len, maxLength);\n // case 0x05: // NULL\n case 0x06:// OBJECT_IDENTIFIER\n return this.stream.parseOID(content, content + len, maxLength);\n // case 0x07: // ObjectDescriptor\n // case 0x08: // EXTERNAL\n // case 0x09: // REAL\n // case 0x0A: // ENUMERATED\n // case 0x0B: // EMBEDDED_PDV\n case 0x10: // SEQUENCE\n case 0x11:// SET\n if (this.sub !== null) {\n return \"(\" + this.sub.length + \" elem)\";\n }\n else {\n return \"(no elem)\";\n }\n case 0x0C:// UTF8String\n return stringCut(this.stream.parseStringUTF(content, content + len), maxLength);\n case 0x12: // NumericString\n case 0x13: // PrintableString\n case 0x14: // TeletexString\n case 0x15: // VideotexString\n case 0x16: // IA5String\n // case 0x19: // GraphicString\n case 0x1A:// VisibleString\n // case 0x1B: // GeneralString\n // case 0x1C: // UniversalString\n return stringCut(this.stream.parseStringISO(content, content + len), maxLength);\n case 0x1E:// BMPString\n return stringCut(this.stream.parseStringBMP(content, content + len), maxLength);\n case 0x17: // UTCTime\n case 0x18:// GeneralizedTime\n return this.stream.parseTime(content, content + len, (this.tag.tagNumber == 0x17));\n }\n return null;\n };\n ASN1.prototype.toString = function () {\n return this.typeName() + \"@\" + this.stream.pos + \"[header:\" + this.header + \",length:\" + this.length + \",sub:\" + ((this.sub === null) ? \"null\" : this.sub.length) + \"]\";\n };\n ASN1.prototype.toPrettyString = function (indent) {\n if (indent === undefined) {\n indent = \"\";\n }\n var s = indent + this.typeName() + \" @\" + this.stream.pos;\n if (this.length >= 0) {\n s += \"+\";\n }\n s += this.length;\n if (this.tag.tagConstructed) {\n s += \" (constructed)\";\n }\n else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null)) {\n s += \" (encapsulates)\";\n }\n s += \"\\n\";\n if (this.sub !== null) {\n indent += \" \";\n for (var i = 0, max = this.sub.length; i < max; ++i) {\n s += this.sub[i].toPrettyString(indent);\n }\n }\n return s;\n };\n ASN1.prototype.posStart = function () {\n return this.stream.pos;\n };\n ASN1.prototype.posContent = function () {\n return this.stream.pos + this.header;\n };\n ASN1.prototype.posEnd = function () {\n return this.stream.pos + this.header + Math.abs(this.length);\n };\n ASN1.prototype.toHexString = function () {\n return this.stream.hexDump(this.posStart(), this.posEnd(), true);\n };\n ASN1.decodeLength = function (stream) {\n var buf = stream.get();\n var len = buf & 0x7F;\n if (len == buf) {\n return len;\n }\n // no reason to use Int10, as it would be a huge buffer anyways\n if (len > 6) {\n throw new Error(\"Length over 48 bits not supported at position \" + (stream.pos - 1));\n }\n if (len === 0) {\n return null;\n } // undefined\n buf = 0;\n for (var i = 0; i < len; ++i) {\n buf = (buf * 256) + stream.get();\n }\n return buf;\n };\n ASN1.decode = function (stream) {\n if (!(stream instanceof Stream)) {\n stream = new Stream(stream, 0);\n }\n var streamStart = new Stream(stream);\n var tag = new ASN1Tag(stream);\n var len = ASN1.decodeLength(stream);\n var start = stream.pos;\n var header = start - streamStart.pos;\n var sub = null;\n var getSub = function () {\n var ret = [];\n if (len !== null) {\n // definite length\n var end = start + len;\n while (stream.pos < end) {\n ret[ret.length] = ASN1.decode(stream);\n }\n if (stream.pos != end) {\n throw new Error(\"Content size is not correct for container starting at offset \" + start);\n }\n }\n else {\n // undefined length\n try {\n for (;;) {\n var s = ASN1.decode(stream);\n if (s.tag.isEOC()) {\n break;\n }\n ret[ret.length] = s;\n }\n len = start - stream.pos; // undefined lengths are represented as negative values\n }\n catch (e) {\n throw new Error(\"Exception while decoding undefined length content: \" + e);\n }\n }\n return ret;\n };\n if (tag.tagConstructed) {\n // must have valid content\n sub = getSub();\n }\n else if (tag.isUniversal() && ((tag.tagNumber == 0x03) || (tag.tagNumber == 0x04))) {\n // sometimes BitString and OctetString are used to encapsulate ASN.1\n try {\n if (tag.tagNumber == 0x03) {\n if (stream.get() != 0) {\n throw new Error(\"BIT STRINGs with unused bits cannot encapsulate.\");\n }\n }\n sub = getSub();\n for (var i = 0; i < sub.length; ++i) {\n if (sub[i].tag.isEOC()) {\n throw new Error(\"EOC is not supposed to be actual content.\");\n }\n }\n }\n catch (e) {\n // but silently ignore when they don't\n sub = null;\n }\n }\n if (sub === null) {\n if (len === null) {\n throw new Error(\"We can't skip over an invalid tag with undefined length at offset \" + start);\n }\n stream.pos = start + Math.abs(len);\n }\n return new ASN1(streamStart, header, len, tag, sub);\n };\n return ASN1;\n}());\nexport { ASN1 };\nvar ASN1Tag = /** @class */ (function () {\n function ASN1Tag(stream) {\n var buf = stream.get();\n this.tagClass = buf >> 6;\n this.tagConstructed = ((buf & 0x20) !== 0);\n this.tagNumber = buf & 0x1F;\n if (this.tagNumber == 0x1F) {\n var n = new Int10();\n do {\n buf = stream.get();\n n.mulAdd(128, buf & 0x7F);\n } while (buf & 0x80);\n this.tagNumber = n.simplify();\n }\n }\n ASN1Tag.prototype.isUniversal = function () {\n return this.tagClass === 0x00;\n };\n ASN1Tag.prototype.isEOC = function () {\n return this.tagClass === 0x00 && this.tagNumber === 0x00;\n };\n return ASN1Tag;\n}());\n"
  379. },
  380. {
  381. "id": 6,
  382. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/int10.ts",
  383. "name": "./lib/asn1js/int10.ts",
  384. "index": 3,
  385. "index2": 0,
  386. "size": 2793,
  387. "cacheable": true,
  388. "built": true,
  389. "optional": false,
  390. "prefetched": false,
  391. "chunks": [
  392. 0
  393. ],
  394. "assets": [],
  395. "issuer": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/asn1.ts",
  396. "issuerId": 5,
  397. "issuerName": "./lib/asn1js/asn1.ts",
  398. "profile": {
  399. "factory": 253,
  400. "building": 30
  401. },
  402. "failed": false,
  403. "errors": 0,
  404. "warnings": 0,
  405. "reasons": [
  406. {
  407. "moduleId": 5,
  408. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/asn1.ts",
  409. "module": "./lib/asn1js/asn1.ts",
  410. "moduleName": "./lib/asn1js/asn1.ts",
  411. "type": "harmony import",
  412. "userRequest": "./int10",
  413. "loc": "16:0-32"
  414. }
  415. ],
  416. "usedExports": [
  417. "Int10"
  418. ],
  419. "providedExports": [
  420. "Int10"
  421. ],
  422. "optimizationBailout": [],
  423. "depth": 3,
  424. "source": "// Big integer base-10 printing library\n// Copyright (c) 2014 Lapo Luchini <lapo@lapo.it>\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar max = 10000000000000; // biggest integer that can still fit 2^53 when multiplied by 256\nvar Int10 = /** @class */ (function () {\n function Int10(value) {\n this.buf = [+value || 0];\n }\n Int10.prototype.mulAdd = function (m, c) {\n // assert(m <= 256)\n var b = this.buf;\n var l = b.length;\n var i;\n var t;\n for (i = 0; i < l; ++i) {\n t = b[i] * m + c;\n if (t < max) {\n c = 0;\n }\n else {\n c = 0 | (t / max);\n t -= c * max;\n }\n b[i] = t;\n }\n if (c > 0) {\n b[i] = c;\n }\n };\n Int10.prototype.sub = function (c) {\n // assert(m <= 256)\n var b = this.buf;\n var l = b.length;\n var i;\n var t;\n for (i = 0; i < l; ++i) {\n t = b[i] - c;\n if (t < 0) {\n t += max;\n c = 1;\n }\n else {\n c = 0;\n }\n b[i] = t;\n }\n while (b[b.length - 1] === 0) {\n b.pop();\n }\n };\n Int10.prototype.toString = function (base) {\n if ((base || 10) != 10) {\n throw new Error(\"only base 10 is supported\");\n }\n var b = this.buf;\n var s = b[b.length - 1].toString();\n for (var i = b.length - 2; i >= 0; --i) {\n s += (max + b[i]).toString().substring(1);\n }\n return s;\n };\n Int10.prototype.valueOf = function () {\n var b = this.buf;\n var v = 0;\n for (var i = b.length - 1; i >= 0; --i) {\n v = v * max + b[i];\n }\n return v;\n };\n Int10.prototype.simplify = function () {\n var b = this.buf;\n return (b.length == 1) ? b[0] : this;\n };\n return Int10;\n}());\nexport { Int10 };\n"
  425. },
  426. {
  427. "id": 7,
  428. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rsa.ts",
  429. "name": "./lib/jsbn/rsa.ts",
  430. "index": 4,
  431. "index2": 6,
  432. "size": 7707,
  433. "cacheable": true,
  434. "built": true,
  435. "optional": false,
  436. "prefetched": false,
  437. "chunks": [
  438. 0
  439. ],
  440. "assets": [],
  441. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  442. "issuerId": 4,
  443. "issuerName": "./src/jsencrypt.js",
  444. "profile": {
  445. "factory": 48,
  446. "building": 780,
  447. "dependencies": 0
  448. },
  449. "failed": false,
  450. "errors": 2,
  451. "warnings": 0,
  452. "reasons": [
  453. {
  454. "moduleId": 4,
  455. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  456. "module": "./src/jsencrypt.js",
  457. "moduleName": "./src/jsencrypt.js",
  458. "type": "harmony import",
  459. "userRequest": "../lib/jsbn/rsa",
  460. "loc": "2:0-39"
  461. }
  462. ],
  463. "usedExports": [
  464. "RSAKey"
  465. ],
  466. "providedExports": [
  467. "RSAKey"
  468. ],
  469. "optimizationBailout": [],
  470. "depth": 2,
  471. "source": "// Depends on jsbn.js and rng.js\n// Version 1.1: support utf-8 encoding in pkcs1pad2\n// convert a (hex) string to a bignum object\nimport { BigInteger, parseBigInt } from \"./jsbn\";\nimport { SecureRandom } from \"./rng\";\nfunction linebrk(s, n) {\n var ret = \"\";\n var i = 0;\n while (i + n < s.length) {\n ret += s.substring(i, i + n) + \"\\n\";\n i += n;\n }\n return ret + s.substring(i, s.length);\n}\nfunction byte2Hex(b) {\n if (b < 0x10)\n return \"0\" + b.toString(16);\n else\n return b.toString(16);\n}\n// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint\nfunction pkcs1pad2(s, n) {\n if (n < s.length + 11) {\n console.error(\"Message too long for RSA\");\n return null;\n }\n var ba = new Array();\n var i = s.length - 1;\n while (i >= 0 && n > 0) {\n var c = s.charCodeAt(i--);\n if (c < 128) {\n ba[--n] = c;\n }\n else if ((c > 127) && (c < 2048)) {\n ba[--n] = (c & 63) | 128;\n ba[--n] = (c >> 6) | 192;\n }\n else {\n ba[--n] = (c & 63) | 128;\n ba[--n] = ((c >> 6) & 63) | 128;\n ba[--n] = (c >> 12) | 224;\n }\n }\n ba[--n] = 0;\n var rng = new SecureRandom();\n var x = new Array();\n while (n > 2) {\n x[0] = 0;\n while (x[0] == 0)\n rng.nextBytes(x);\n ba[--n] = x[0];\n }\n ba[--n] = 2;\n ba[--n] = 0;\n return new BigInteger(ba);\n}\n// \"empty\" RSA key constructor\nvar RSAKey = /** @class */ (function () {\n function RSAKey() {\n this.n = null;\n this.e = 0;\n this.d = null;\n this.p = null;\n this.q = null;\n this.dmp1 = null;\n this.dmq1 = null;\n this.coeff = null;\n }\n //#region PROTECTED\n // protected\n // RSAKey.prototype.doPublic = RSADoPublic;\n // Perform raw public operation on \"x\": return x^e (mod n)\n RSAKey.prototype.doPublic = function (x) {\n return x.modPowInt(this.e, this.n);\n };\n // RSAKey.prototype.doPrivate = RSADoPrivate;\n // Perform raw private operation on \"x\": return x^d (mod n)\n RSAKey.prototype.doPrivate = function (x) {\n if (this.p == null || this.q == null)\n return x.modPow(this.d, this.n);\n // TODO: re-calculate any missing CRT params\n var xp = x.mod(this.p).modPow(this.dmp1, this.p);\n var xq = x.mod(this.q).modPow(this.dmq1, this.q);\n while (xp.compareTo(xq) < 0)\n xp = xp.add(this.p);\n return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);\n };\n //#endregion PROTECTED\n //#region PUBLIC\n // RSAKey.prototype.setPublic = RSASetPublic;\n // Set the public key fields N and e from hex strings\n RSAKey.prototype.setPublic = function (N, E) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n }\n else\n console.error(\"Invalid RSA public key\");\n };\n // RSAKey.prototype.encrypt = RSAEncrypt;\n // Return the PKCS#1 RSA encryption of \"text\" as an even-length hex string\n RSAKey.prototype.encrypt = function (text) {\n var m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3);\n if (m == null)\n return null;\n var c = this.doPublic(m);\n if (c == null)\n return null;\n var h = c.toString(16);\n if ((h.length & 1) == 0)\n return h;\n else\n return \"0\" + h;\n };\n // RSAKey.prototype.setPrivate = RSASetPrivate;\n // Set the private key fields N, e, and d from hex strings\n RSAKey.prototype.setPrivate = function (N, E, D) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n this.d = parseBigInt(D, 16);\n }\n else {\n console.error(\"Invalid RSA private key\");\n }\n };\n // RSAKey.prototype.setPrivateEx = RSASetPrivateEx;\n // Set the private key fields N, e, d and CRT params from hex strings\n RSAKey.prototype.setPrivateEx = function (N, E, D, P, Q, DP, DQ, C) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n this.d = parseBigInt(D, 16);\n this.p = parseBigInt(P, 16);\n this.q = parseBigInt(Q, 16);\n this.dmp1 = parseBigInt(DP, 16);\n this.dmq1 = parseBigInt(DQ, 16);\n this.coeff = parseBigInt(C, 16);\n }\n else {\n console.error(\"Invalid RSA private key\");\n }\n };\n // RSAKey.prototype.generate = RSAGenerate;\n // Generate a new random private key B bits long, using public expt E\n RSAKey.prototype.generate = function (B, E) {\n var rng = new SecureRandom();\n var qs = B >> 1;\n this.e = parseInt(E, 16);\n var ee = new BigInteger(E, 16);\n for (;;) {\n for (;;) {\n this.p = new BigInteger(B - qs, 1, rng);\n if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10))\n break;\n }\n for (;;) {\n this.q = new BigInteger(qs, 1, rng);\n if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10))\n break;\n }\n if (this.p.compareTo(this.q) <= 0) {\n var t = this.p;\n this.p = this.q;\n this.q = t;\n }\n var p1 = this.p.subtract(BigInteger.ONE);\n var q1 = this.q.subtract(BigInteger.ONE);\n var phi = p1.multiply(q1);\n if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {\n this.n = this.p.multiply(this.q);\n this.d = ee.modInverse(phi);\n this.dmp1 = this.d.mod(p1);\n this.dmq1 = this.d.mod(q1);\n this.coeff = this.q.modInverse(this.p);\n break;\n }\n }\n };\n // RSAKey.prototype.decrypt = RSADecrypt;\n // Return the PKCS#1 RSA decryption of \"ctext\".\n // \"ctext\" is an even-length hex string and the output is a plain string.\n RSAKey.prototype.decrypt = function (ctext) {\n var c = parseBigInt(ctext, 16);\n var m = this.doPrivate(c);\n if (m == null)\n return null;\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3);\n };\n return RSAKey;\n}());\nexport { RSAKey };\n// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext\nfunction pkcs1unpad2(d, n) {\n var b = d.toByteArray();\n var i = 0;\n while (i < b.length && b[i] == 0)\n ++i;\n if (b.length - i != n - 1 || b[i] != 2)\n return null;\n ++i;\n while (b[i] != 0)\n if (++i >= b.length)\n return null;\n var ret = \"\";\n while (++i < b.length) {\n var c = b[i] & 255;\n if (c < 128) {\n ret += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\n ++i;\n }\n else {\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\n i += 2;\n }\n }\n return ret;\n}\n// Return the PKCS#1 RSA encryption of \"text\" as a Base64-encoded string\n//function RSAEncryptB64(text) {\n// var h = this.encrypt(text);\n// if(h) return hex2b64(h); else return null;\n//}\n// public\n//RSAKey.prototype.encrypt_b64 = RSAEncryptB64;\n"
  472. },
  473. {
  474. "id": 8,
  475. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rng.ts",
  476. "name": "./lib/jsbn/rng.ts",
  477. "index": 7,
  478. "index2": 5,
  479. "size": 2618,
  480. "cacheable": true,
  481. "built": true,
  482. "optional": false,
  483. "prefetched": false,
  484. "chunks": [
  485. 0
  486. ],
  487. "assets": [],
  488. "issuer": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rsa.ts",
  489. "issuerId": 7,
  490. "issuerName": "./lib/jsbn/rsa.ts",
  491. "profile": {
  492. "factory": 165,
  493. "building": 16
  494. },
  495. "failed": false,
  496. "errors": 0,
  497. "warnings": 0,
  498. "reasons": [
  499. {
  500. "moduleId": 7,
  501. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rsa.ts",
  502. "module": "./lib/jsbn/rsa.ts",
  503. "moduleName": "./lib/jsbn/rsa.ts",
  504. "type": "harmony import",
  505. "userRequest": "./rng",
  506. "loc": "5:0-37"
  507. }
  508. ],
  509. "usedExports": [
  510. "SecureRandom"
  511. ],
  512. "providedExports": [
  513. "SecureRandom"
  514. ],
  515. "optimizationBailout": [],
  516. "depth": 3,
  517. "source": "// Random number generator - requires a PRNG backend, e.g. prng4.js\nimport { prng_newstate, rng_psize } from \"./prng4\";\nvar rng_state;\nvar rng_pool;\nvar rng_pptr;\n// Initialize the pool with junk if needed.\nif (rng_pool == null) {\n rng_pool = [];\n rng_pptr = 0;\n var t = void 0;\n if (window.crypto && window.crypto.getRandomValues) {\n // Extract entropy (2048 bits) from RNG if available\n var z = new Uint32Array(256);\n window.crypto.getRandomValues(z);\n for (t = 0; t < z.length; ++t) {\n rng_pool[rng_pptr++] = z[t] & 255;\n }\n }\n // Use mouse events for entropy, if we do not have enough entropy by the time\n // we need it, entropy will be generated by Math.random.\n var onMouseMoveListener_1 = function (ev) {\n this.count = this.count || 0;\n if (this.count >= 256 || rng_pptr >= rng_psize) {\n if (window.removeEventListener) {\n window.removeEventListener(\"mousemove\", onMouseMoveListener_1, false);\n }\n else if (window.detachEvent) {\n window.detachEvent(\"onmousemove\", onMouseMoveListener_1);\n }\n return;\n }\n try {\n var mouseCoordinates = ev.x + ev.y;\n rng_pool[rng_pptr++] = mouseCoordinates & 255;\n this.count += 1;\n }\n catch (e) {\n // Sometimes Firefox will deny permission to access event properties for some reason. Ignore.\n }\n };\n if (window.addEventListener) {\n window.addEventListener(\"mousemove\", onMouseMoveListener_1, false);\n }\n else if (window.attachEvent) {\n window.attachEvent(\"onmousemove\", onMouseMoveListener_1);\n }\n}\nfunction rng_get_byte() {\n if (rng_state == null) {\n rng_state = prng_newstate();\n // At this point, we may not have collected enough entropy. If not, fall back to Math.random\n while (rng_pptr < rng_psize) {\n var random = Math.floor(65536 * Math.random());\n rng_pool[rng_pptr++] = random & 255;\n }\n rng_state.init(rng_pool);\n for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) {\n rng_pool[rng_pptr] = 0;\n }\n rng_pptr = 0;\n }\n // TODO: allow reseeding after first request\n return rng_state.next();\n}\nvar SecureRandom = /** @class */ (function () {\n function SecureRandom() {\n }\n SecureRandom.prototype.nextBytes = function (ba) {\n for (var i = 0; i < ba.length; ++i) {\n ba[i] = rng_get_byte();\n }\n };\n return SecureRandom;\n}());\nexport { SecureRandom };\n"
  518. },
  519. {
  520. "id": 9,
  521. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/prng4.ts",
  522. "name": "./lib/jsbn/prng4.ts",
  523. "index": 8,
  524. "index2": 4,
  525. "size": 1320,
  526. "cacheable": true,
  527. "built": true,
  528. "optional": false,
  529. "prefetched": false,
  530. "chunks": [
  531. 0
  532. ],
  533. "assets": [],
  534. "issuer": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rng.ts",
  535. "issuerId": 8,
  536. "issuerName": "./lib/jsbn/rng.ts",
  537. "profile": {
  538. "factory": 14,
  539. "building": 4
  540. },
  541. "failed": false,
  542. "errors": 0,
  543. "warnings": 0,
  544. "reasons": [
  545. {
  546. "moduleId": 8,
  547. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rng.ts",
  548. "module": "./lib/jsbn/rng.ts",
  549. "moduleName": "./lib/jsbn/rng.ts",
  550. "type": "harmony import",
  551. "userRequest": "./prng4",
  552. "loc": "2:0-51"
  553. }
  554. ],
  555. "usedExports": [
  556. "prng_newstate",
  557. "rng_psize"
  558. ],
  559. "providedExports": [
  560. "Arcfour",
  561. "prng_newstate",
  562. "rng_psize"
  563. ],
  564. "optimizationBailout": [],
  565. "depth": 4,
  566. "source": "// prng4.js - uses Arcfour as a PRNG\nvar Arcfour = /** @class */ (function () {\n function Arcfour() {\n this.i = 0;\n this.j = 0;\n this.S = [];\n }\n //Arcfour.prototype.init = ARC4init;\n // Initialize arcfour context from key, an array of ints, each from [0..255]\n Arcfour.prototype.init = function (key) {\n var i, j, t;\n for (i = 0; i < 256; ++i)\n this.S[i] = i;\n j = 0;\n for (i = 0; i < 256; ++i) {\n j = (j + this.S[i] + key[i % key.length]) & 255;\n t = this.S[i];\n this.S[i] = this.S[j];\n this.S[j] = t;\n }\n this.i = 0;\n this.j = 0;\n };\n // Arcfour.prototype.next = ARC4next;\n Arcfour.prototype.next = function () {\n var t;\n this.i = (this.i + 1) & 255;\n this.j = (this.j + this.S[this.i]) & 255;\n t = this.S[this.i];\n this.S[this.i] = this.S[this.j];\n this.S[this.j] = t;\n return this.S[(t + this.S[this.i]) & 255];\n };\n return Arcfour;\n}());\nexport { Arcfour };\n// Plug in your RNG constructor here\nexport function prng_newstate() {\n return new Arcfour();\n}\n// Pool size must be a multiple of 4 and greater than 32.\n// An array of bytes the size of the pool will be passed to init()\nexport var rng_psize = 256;\n"
  567. },
  568. {
  569. "id": 10,
  570. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/base64.ts",
  571. "name": "./lib/asn1js/base64.ts",
  572. "index": 9,
  573. "index2": 7,
  574. "size": 2887,
  575. "cacheable": true,
  576. "built": true,
  577. "optional": false,
  578. "prefetched": false,
  579. "chunks": [
  580. 0
  581. ],
  582. "assets": [],
  583. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  584. "issuerId": 4,
  585. "issuerName": "./src/jsencrypt.js",
  586. "profile": {
  587. "factory": 47,
  588. "building": 703
  589. },
  590. "failed": false,
  591. "errors": 0,
  592. "warnings": 0,
  593. "reasons": [
  594. {
  595. "moduleId": 4,
  596. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  597. "module": "./src/jsencrypt.js",
  598. "moduleName": "./src/jsencrypt.js",
  599. "type": "harmony import",
  600. "userRequest": "../lib/asn1js/base64",
  601. "loc": "3:0-44"
  602. }
  603. ],
  604. "usedExports": [
  605. "Base64"
  606. ],
  607. "providedExports": [
  608. "Base64"
  609. ],
  610. "optimizationBailout": [],
  611. "depth": 2,
  612. "source": "// Base64 JavaScript decoder\n// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it>\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar decoder;\nexport var Base64 = {\n decode: function (a) {\n var i;\n if (decoder === undefined) {\n var b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\", ignore = \"= \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\n decoder = [];\n for (i = 0; i < 64; ++i)\n decoder[b64.charAt(i)] = i;\n for (i = 0; i < ignore.length; ++i)\n decoder[ignore.charAt(i)] = -1;\n }\n var out = [];\n var bits = 0, char_count = 0;\n for (i = 0; i < a.length; ++i) {\n var c = a.charAt(i);\n if (c == '=')\n break;\n c = decoder[c];\n if (c == -1)\n continue;\n if (c === undefined)\n throw 'Illegal character at offset ' + i;\n bits |= c;\n if (++char_count >= 4) {\n out[out.length] = (bits >> 16);\n out[out.length] = (bits >> 8) & 0xFF;\n out[out.length] = bits & 0xFF;\n bits = 0;\n char_count = 0;\n }\n else {\n bits <<= 6;\n }\n }\n switch (char_count) {\n case 1:\n throw \"Base64 encoding incomplete: at least 2 bits missing\";\n case 2:\n out[out.length] = (bits >> 10);\n break;\n case 3:\n out[out.length] = (bits >> 16);\n out[out.length] = (bits >> 8) & 0xFF;\n break;\n }\n return out;\n },\n re: /-----BEGIN [^-]+-----([A-Za-z0-9+\\/=\\s]+)-----END [^-]+-----|begin-base64[^\\n]+\\n([A-Za-z0-9+\\/=\\s]+)====/,\n unarmor: function (a) {\n var m = Base64.re.exec(a);\n if (m) {\n if (m[1])\n a = m[1];\n else if (m[2])\n a = m[2];\n else\n throw \"RegExp out of sync\";\n }\n return Base64.decode(a);\n }\n};\n"
  613. },
  614. {
  615. "id": 11,
  616. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/hex.ts",
  617. "name": "./lib/asn1js/hex.ts",
  618. "index": 10,
  619. "index2": 8,
  620. "size": 2303,
  621. "cacheable": true,
  622. "built": true,
  623. "optional": false,
  624. "prefetched": false,
  625. "chunks": [
  626. 0
  627. ],
  628. "assets": [],
  629. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  630. "issuerId": 4,
  631. "issuerName": "./src/jsencrypt.js",
  632. "profile": {
  633. "factory": 48,
  634. "building": 747
  635. },
  636. "failed": false,
  637. "errors": 0,
  638. "warnings": 0,
  639. "reasons": [
  640. {
  641. "moduleId": 4,
  642. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  643. "module": "./src/jsencrypt.js",
  644. "moduleName": "./src/jsencrypt.js",
  645. "type": "harmony import",
  646. "userRequest": "../lib/asn1js/hex",
  647. "loc": "4:0-38"
  648. }
  649. ],
  650. "usedExports": [
  651. "Hex"
  652. ],
  653. "providedExports": [
  654. "Hex"
  655. ],
  656. "optimizationBailout": [],
  657. "depth": 2,
  658. "source": "// Hex JavaScript decoder\n// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it>\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar decoder;\nexport var Hex = {\n decode: function (a) {\n var i;\n if (decoder === undefined) {\n var hex = \"0123456789ABCDEF\";\n var ignore = \" \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\n decoder = {};\n for (i = 0; i < 16; ++i) {\n decoder[hex.charAt(i)] = i;\n }\n hex = hex.toLowerCase();\n for (i = 10; i < 16; ++i) {\n decoder[hex.charAt(i)] = i;\n }\n for (i = 0; i < ignore.length; ++i) {\n decoder[ignore.charAt(i)] = -1;\n }\n }\n var out = [];\n var bits = 0;\n var char_count = 0;\n for (i = 0; i < a.length; ++i) {\n var c = a.charAt(i);\n if (c == \"=\") {\n break;\n }\n c = decoder[c];\n if (c == -1) {\n continue;\n }\n if (c === undefined) {\n throw new Error(\"Illegal character at offset \" + i);\n }\n bits |= c;\n if (++char_count >= 2) {\n out[out.length] = bits;\n bits = 0;\n char_count = 0;\n }\n else {\n bits <<= 4;\n }\n }\n if (char_count) {\n throw new Error(\"Hex encoding incomplete: 4 bits missing\");\n }\n return out;\n }\n};\n"
  659. },
  660. {
  661. "id": 12,
  662. "identifier": "/home/corax/source/jsencrypt/lib/jsrsasign/asn1-1.0.js",
  663. "name": "./lib/jsrsasign/asn1-1.0.js",
  664. "index": 11,
  665. "index2": 9,
  666. "size": 41390,
  667. "cacheable": true,
  668. "built": true,
  669. "optional": false,
  670. "prefetched": false,
  671. "chunks": [
  672. 0
  673. ],
  674. "assets": [],
  675. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  676. "issuerId": 4,
  677. "issuerName": "./src/jsencrypt.js",
  678. "profile": {
  679. "factory": 4,
  680. "building": 26,
  681. "dependencies": 18
  682. },
  683. "failed": false,
  684. "errors": 0,
  685. "warnings": 0,
  686. "reasons": [
  687. {
  688. "moduleId": 4,
  689. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  690. "module": "./src/jsencrypt.js",
  691. "moduleName": "./src/jsencrypt.js",
  692. "type": "harmony import",
  693. "userRequest": "../lib/jsrsasign/asn1-1.0",
  694. "loc": "6:0-47"
  695. }
  696. ],
  697. "usedExports": [
  698. "KJUR"
  699. ],
  700. "providedExports": [
  701. "JSX",
  702. "KJUR"
  703. ],
  704. "optimizationBailout": [],
  705. "depth": 2,
  706. "source": "/*! asn1-1.0.2.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license\n */\n\nimport {BigInteger} from \"../jsbn/jsbn\";\nexport const JSX = {};\nJSX.env = JSX.env || {};\n\nconst L = JSX, OP = Object.prototype, FUNCTION_TOSTRING = '[object Function]',ADD = [\"toString\", \"valueOf\"];\n\nJSX.env.parseUA = function(agent) {\n\n var numberify = function(s) {\n var c = 0;\n return parseFloat(s.replace(/\\./g, function() {\n return (c++ == 1) ? '' : '.';\n }));\n },\n\n nav = navigator,\n o = {\n ie: 0,\n opera: 0,\n gecko: 0,\n webkit: 0,\n chrome: 0,\n mobile: null,\n air: 0,\n ipad: 0,\n iphone: 0,\n ipod: 0,\n ios: null,\n android: 0,\n webos: 0,\n caja: nav && nav.cajaVersion,\n secure: false,\n os: null\n\n },\n\n ua = agent || (navigator && navigator.userAgent),\n loc = window && window.location,\n href = loc && loc.href,\n m;\n\n o.secure = href && (href.toLowerCase().indexOf(\"https\") === 0);\n\n if (ua) {\n\n if ((/windows|win32/i).test(ua)) {\n o.os = 'windows';\n } else if ((/macintosh/i).test(ua)) {\n o.os = 'macintosh';\n } else if ((/rhino/i).test(ua)) {\n o.os = 'rhino';\n }\n if ((/KHTML/).test(ua)) {\n o.webkit = 1;\n }\n m = ua.match(/AppleWebKit\\/([^\\s]*)/);\n if (m && m[1]) {\n o.webkit = numberify(m[1]);\n if (/ Mobile\\//.test(ua)) {\n o.mobile = 'Apple'; // iPhone or iPod Touch\n m = ua.match(/OS ([^\\s]*)/);\n if (m && m[1]) {\n m = numberify(m[1].replace('_', '.'));\n }\n o.ios = m;\n o.ipad = o.ipod = o.iphone = 0;\n m = ua.match(/iPad|iPod|iPhone/);\n if (m && m[0]) {\n o[m[0].toLowerCase()] = o.ios;\n }\n } else {\n m = ua.match(/NokiaN[^\\/]*|Android \\d\\.\\d|webOS\\/\\d\\.\\d/);\n if (m) {\n o.mobile = m[0];\n }\n if (/webOS/.test(ua)) {\n o.mobile = 'WebOS';\n m = ua.match(/webOS\\/([^\\s]*);/);\n if (m && m[1]) {\n o.webos = numberify(m[1]);\n }\n }\n if (/ Android/.test(ua)) {\n o.mobile = 'Android';\n m = ua.match(/Android ([^\\s]*);/);\n if (m && m[1]) {\n o.android = numberify(m[1]);\n }\n }\n }\n m = ua.match(/Chrome\\/([^\\s]*)/);\n if (m && m[1]) {\n o.chrome = numberify(m[1]); // Chrome\n } else {\n m = ua.match(/AdobeAIR\\/([^\\s]*)/);\n if (m) {\n o.air = m[0]; // Adobe AIR 1.0 or better\n }\n }\n }\n if (!o.webkit) {\n m = ua.match(/Opera[\\s\\/]([^\\s]*)/);\n if (m && m[1]) {\n o.opera = numberify(m[1]);\n m = ua.match(/Version\\/([^\\s]*)/);\n if (m && m[1]) {\n o.opera = numberify(m[1]); // opera 10+\n }\n m = ua.match(/Opera Mini[^;]*/);\n if (m) {\n o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316\n }\n } else { // not opera or webkit\n m = ua.match(/MSIE\\s([^;]*)/);\n if (m && m[1]) {\n o.ie = numberify(m[1]);\n } else { // not opera, webkit, or ie\n m = ua.match(/Gecko\\/([^\\s]*)/);\n if (m) {\n o.gecko = 1; // Gecko detected, look for revision\n m = ua.match(/rv:([^\\s\\)]*)/);\n if (m && m[1]) {\n o.gecko = numberify(m[1]);\n }\n }\n }\n }\n }\n }\n return o;\n};\n\nJSX.env.ua = JSX.env.parseUA();\n\nJSX.isFunction = function(o) {\n return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;\n};\n\nJSX._IEEnumFix = (JSX.env.ua.ie) ? function(r, s) {\n var i, fname, f;\n for (i=0;i<ADD.length;i=i+1) {\n\n fname = ADD[i];\n f = s[fname];\n\n if (L.isFunction(f) && f!=OP[fname]) {\n r[fname]=f;\n }\n }\n} : function(){};\n\nJSX.extend = function(subc, superc, overrides) {\n if (!superc||!subc) {\n throw new Error(\"extend failed, please check that \" +\n \"all dependencies are included.\");\n }\n var F = function() {}, i;\n F.prototype=superc.prototype;\n subc.prototype=new F();\n subc.prototype.constructor=subc;\n subc.superclass=superc.prototype;\n if (superc.prototype.constructor == OP.constructor) {\n superc.prototype.constructor=superc;\n }\n\n if (overrides) {\n for (i in overrides) {\n if (L.hasOwnProperty(overrides, i)) {\n subc.prototype[i]=overrides[i];\n }\n }\n\n L._IEEnumFix(subc.prototype, overrides);\n }\n};\n\n/*\n * asn1.js - ASN.1 DER encoder classes\n *\n * Copyright (c) 2013 Kenji Urushima (kenji.urushima@gmail.com)\n *\n * This software is licensed under the terms of the MIT License.\n * http://kjur.github.com/jsrsasign/license\n *\n * The above copyright and license notice shall be \n * included in all copies or substantial portions of the Software.\n */\n\n/**\n * @fileOverview\n * @name asn1-1.0.js\n * @author Kenji Urushima kenji.urushima@gmail.com\n * @version 1.0.2 (2013-May-30)\n * @since 2.1\n * @license <a href=\"http://kjur.github.io/jsrsasign/license/\">MIT License</a>\n */\n\n/** \n * kjur's class library name space\n * <p>\n * This name space provides following name spaces:\n * <ul>\n * <li>{@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder</li>\n * <li>{@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL</li>\n * <li>{@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature \n * class and utilities</li>\n * </ul>\n * </p> \n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\n * @name KJUR\n * @namespace kjur's class library name space\n */\n// if (typeof KJUR == \"undefined\" || !KJUR) KJUR = {};\nexport const KJUR = {};\n\n/**\n * kjur's ASN.1 class library name space\n * <p>\n * This is ITU-T X.690 ASN.1 DER encoder class library and\n * class structure and methods is very similar to \n * org.bouncycastle.asn1 package of \n * well known BouncyCaslte Cryptography Library.\n *\n * <h4>PROVIDING ASN.1 PRIMITIVES</h4>\n * Here are ASN.1 DER primitive classes.\n * <ul>\n * <li>{@link KJUR.asn1.DERBoolean}</li>\n * <li>{@link KJUR.asn1.DERInteger}</li>\n * <li>{@link KJUR.asn1.DERBitString}</li>\n * <li>{@link KJUR.asn1.DEROctetString}</li>\n * <li>{@link KJUR.asn1.DERNull}</li>\n * <li>{@link KJUR.asn1.DERObjectIdentifier}</li>\n * <li>{@link KJUR.asn1.DERUTF8String}</li>\n * <li>{@link KJUR.asn1.DERNumericString}</li>\n * <li>{@link KJUR.asn1.DERPrintableString}</li>\n * <li>{@link KJUR.asn1.DERTeletexString}</li>\n * <li>{@link KJUR.asn1.DERIA5String}</li>\n * <li>{@link KJUR.asn1.DERUTCTime}</li>\n * <li>{@link KJUR.asn1.DERGeneralizedTime}</li>\n * <li>{@link KJUR.asn1.DERSequence}</li>\n * <li>{@link KJUR.asn1.DERSet}</li>\n * </ul>\n *\n * <h4>OTHER ASN.1 CLASSES</h4>\n * <ul>\n * <li>{@link KJUR.asn1.ASN1Object}</li>\n * <li>{@link KJUR.asn1.DERAbstractString}</li>\n * <li>{@link KJUR.asn1.DERAbstractTime}</li>\n * <li>{@link KJUR.asn1.DERAbstractStructured}</li>\n * <li>{@link KJUR.asn1.DERTaggedObject}</li>\n * </ul>\n * </p>\n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\n * @name KJUR.asn1\n * @namespace\n */\nif (typeof KJUR.asn1 == \"undefined\" || !KJUR.asn1) KJUR.asn1 = {};\n\n/**\n * ASN1 utilities class\n * @name KJUR.asn1.ASN1Util\n * @classs ASN1 utilities class\n * @since asn1 1.0.2\n */\nKJUR.asn1.ASN1Util = new function() {\n this.integerToByteHex = function(i) {\n\tvar h = i.toString(16);\n\tif ((h.length % 2) == 1) h = '0' + h;\n\treturn h;\n };\n this.bigIntToMinTwosComplementsHex = function(bigIntegerValue) {\n\tvar h = bigIntegerValue.toString(16);\n\tif (h.substr(0, 1) != '-') {\n\t if (h.length % 2 == 1) {\n\t\th = '0' + h;\n\t } else {\n\t\tif (! h.match(/^[0-7]/)) {\n\t\t h = '00' + h;\n\t\t}\n\t }\n\t} else {\n\t var hPos = h.substr(1);\n\t var xorLen = hPos.length;\n\t if (xorLen % 2 == 1) {\n\t\txorLen += 1;\n\t } else {\n\t\tif (! h.match(/^[0-7]/)) {\n\t\t xorLen += 2;\n\t\t}\n\t }\n\t var hMask = '';\n\t for (var i = 0; i < xorLen; i++) {\n\t\thMask += 'f';\n\t }\n\t var biMask = new BigInteger(hMask, 16);\n\t var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE);\n\t h = biNeg.toString(16).replace(/^-/, '');\n\t}\n\treturn h;\n };\n /**\n * get PEM string from hexadecimal data and header string\n * @name getPEMStringFromHex\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {String} dataHex hexadecimal string of PEM body\n * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')\n * @return {String} PEM formatted string of input data\n * @description\n * @example\n * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');\n * // value of pem will be:\n * -----BEGIN PRIVATE KEY-----\n * YWFh\n * -----END PRIVATE KEY-----\n */\n this.getPEMStringFromHex = function(dataHex, pemHeader) {\n\tvar dataWA = CryptoJS.enc.Hex.parse(dataHex);\n\tvar dataB64 = CryptoJS.enc.Base64.stringify(dataWA);\n\tvar pemBody = dataB64.replace(/(.{64})/g, \"$1\\r\\n\");\n pemBody = pemBody.replace(/\\r\\n$/, '');\n\treturn \"-----BEGIN \" + pemHeader + \"-----\\r\\n\" + \n pemBody + \n \"\\r\\n-----END \" + pemHeader + \"-----\\r\\n\";\n };\n};\n\n// ********************************************************************\n// Abstract ASN.1 Classes\n// ********************************************************************\n\n// ********************************************************************\n\n/**\n * base class for ASN.1 DER encoder object\n * @name KJUR.asn1.ASN1Object\n * @class base class for ASN.1 DER encoder object\n * @property {Boolean} isModified flag whether internal data was changed\n * @property {String} hTLV hexadecimal string of ASN.1 TLV\n * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)\n * @property {String} hL hexadecimal string of ASN.1 TLV length(L)\n * @property {String} hV hexadecimal string of ASN.1 TLV value(V)\n * @description\n */\nKJUR.asn1.ASN1Object = function() {\n var isModified = true;\n var hTLV = null;\n var hT = '00'\n var hL = '00';\n var hV = '';\n\n /**\n * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)\n * @name getLengthHexFromValue\n * @memberOf KJUR.asn1.ASN1Object\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV length(L)\n */\n this.getLengthHexFromValue = function() {\n\tif (typeof this.hV == \"undefined\" || this.hV == null) {\n\t throw \"this.hV is null or undefined.\";\n\t}\n\tif (this.hV.length % 2 == 1) {\n\t throw \"value hex must be even length: n=\" + hV.length + \",v=\" + this.hV;\n\t}\n\tvar n = this.hV.length / 2;\n\tvar hN = n.toString(16);\n\tif (hN.length % 2 == 1) {\n\t hN = \"0\" + hN;\n\t}\n\tif (n < 128) {\n\t return hN;\n\t} else {\n\t var hNlen = hN.length / 2;\n\t if (hNlen > 15) {\n\t\tthrow \"ASN.1 length too long to represent by 8x: n = \" + n.toString(16);\n\t }\n\t var head = 128 + hNlen;\n\t return head.toString(16) + hN;\n\t}\n };\n\n /**\n * get hexadecimal string of ASN.1 TLV bytes\n * @name getEncodedHex\n * @memberOf KJUR.asn1.ASN1Object\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV\n */\n this.getEncodedHex = function() {\n\tif (this.hTLV == null || this.isModified) {\n\t this.hV = this.getFreshValueHex();\n\t this.hL = this.getLengthHexFromValue();\n\t this.hTLV = this.hT + this.hL + this.hV;\n\t this.isModified = false;\n\t //console.error(\"first time: \" + this.hTLV);\n\t}\n\treturn this.hTLV;\n };\n\n /**\n * get hexadecimal string of ASN.1 TLV value(V) bytes\n * @name getValueHex\n * @memberOf KJUR.asn1.ASN1Object\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes\n */\n this.getValueHex = function() {\n\tthis.getEncodedHex();\n\treturn this.hV;\n }\n\n this.getFreshValueHex = function() {\n\treturn '';\n };\n};\n\n// == BEGIN DERAbstractString ================================================\n/**\n * base class for ASN.1 DER string classes\n * @name KJUR.asn1.DERAbstractString\n * @class base class for ASN.1 DER string classes\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @property {String} s internal string of value\n * @extends KJUR.asn1.ASN1Object\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>str - specify initial ASN.1 value(V) by a string</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERAbstractString = function(params) {\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\n var s = null;\n var hV = null;\n\n /**\n * get string value of this string object\n * @name getString\n * @memberOf KJUR.asn1.DERAbstractString\n * @function\n * @return {String} string value of this string object\n */\n this.getString = function() {\n\treturn this.s;\n };\n\n /**\n * set value by a string\n * @name setString\n * @memberOf KJUR.asn1.DERAbstractString\n * @function\n * @param {String} newS value by a string to set\n */\n this.setString = function(newS) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = newS;\n\tthis.hV = stohex(this.s);\n };\n\n /**\n * set value by a hexadecimal string\n * @name setStringHex\n * @memberOf KJUR.asn1.DERAbstractString\n * @function\n * @param {String} newHexString value by a hexadecimal string to set\n */\n this.setStringHex = function(newHexString) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = null;\n\tthis.hV = newHexString;\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['str'] != \"undefined\") {\n\t this.setString(params['str']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setStringHex(params['hex']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);\n// == END DERAbstractString ================================================\n\n// == BEGIN DERAbstractTime ==================================================\n/**\n * base class for ASN.1 DER Generalized/UTCTime class\n * @name KJUR.asn1.DERAbstractTime\n * @class base class for ASN.1 DER Generalized/UTCTime class\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERAbstractTime = function(params) {\n KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);\n var s = null;\n var date = null;\n\n // --- PRIVATE METHODS --------------------\n this.localDateToUTC = function(d) {\n\tutc = d.getTime() + (d.getTimezoneOffset() * 60000);\n\tvar utcDate = new Date(utc);\n\treturn utcDate;\n };\n\n this.formatDate = function(dateObject, type) {\n\tvar pad = this.zeroPadding;\n\tvar d = this.localDateToUTC(dateObject);\n\tvar year = String(d.getFullYear());\n\tif (type == 'utc') year = year.substr(2, 2);\n\tvar month = pad(String(d.getMonth() + 1), 2);\n\tvar day = pad(String(d.getDate()), 2);\n\tvar hour = pad(String(d.getHours()), 2);\n\tvar min = pad(String(d.getMinutes()), 2);\n\tvar sec = pad(String(d.getSeconds()), 2);\n\treturn year + month + day + hour + min + sec + 'Z';\n };\n\n this.zeroPadding = function(s, len) {\n\tif (s.length >= len) return s;\n\treturn new Array(len - s.length + 1).join('0') + s;\n };\n\n // --- PUBLIC METHODS --------------------\n /**\n * get string value of this string object\n * @name getString\n * @memberOf KJUR.asn1.DERAbstractTime\n * @function\n * @return {String} string value of this time object\n */\n this.getString = function() {\n\treturn this.s;\n };\n\n /**\n * set value by a string\n * @name setString\n * @memberOf KJUR.asn1.DERAbstractTime\n * @function\n * @param {String} newS value by a string to set such like \"130430235959Z\"\n */\n this.setString = function(newS) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = newS;\n\tthis.hV = stohex(this.s);\n };\n\n /**\n * set value by a Date object\n * @name setByDateValue\n * @memberOf KJUR.asn1.DERAbstractTime\n * @function\n * @param {Integer} year year of date (ex. 2013)\n * @param {Integer} month month of date between 1 and 12 (ex. 12)\n * @param {Integer} day day of month\n * @param {Integer} hour hours of date\n * @param {Integer} min minutes of date\n * @param {Integer} sec seconds of date\n */\n this.setByDateValue = function(year, month, day, hour, min, sec) {\n\tvar dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));\n\tthis.setByDate(dateObject);\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n};\nJSX.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);\n// == END DERAbstractTime ==================================================\n\n// == BEGIN DERAbstractStructured ============================================\n/**\n * base class for ASN.1 DER structured class\n * @name KJUR.asn1.DERAbstractStructured\n * @class base class for ASN.1 DER structured class\n * @property {Array} asn1Array internal array of ASN1Object\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERAbstractStructured = function(params) {\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\n var asn1Array = null;\n\n /**\n * set value by array of ASN1Object\n * @name setByASN1ObjectArray\n * @memberOf KJUR.asn1.DERAbstractStructured\n * @function\n * @param {array} asn1ObjectArray array of ASN1Object to set\n */\n this.setByASN1ObjectArray = function(asn1ObjectArray) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.asn1Array = asn1ObjectArray;\n };\n\n /**\n * append an ASN1Object to internal array\n * @name appendASN1Object\n * @memberOf KJUR.asn1.DERAbstractStructured\n * @function\n * @param {ASN1Object} asn1Object to add\n */\n this.appendASN1Object = function(asn1Object) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.asn1Array.push(asn1Object);\n };\n\n this.asn1Array = new Array();\n if (typeof params != \"undefined\") {\n\tif (typeof params['array'] != \"undefined\") {\n\t this.asn1Array = params['array'];\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);\n\n\n// ********************************************************************\n// ASN.1 Object Classes\n// ********************************************************************\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Boolean\n * @name KJUR.asn1.DERBoolean\n * @class class for ASN.1 DER Boolean\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERBoolean = function() {\n KJUR.asn1.DERBoolean.superclass.constructor.call(this);\n this.hT = \"01\";\n this.hTLV = \"0101ff\";\n};\nJSX.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Integer\n * @name KJUR.asn1.DERInteger\n * @class class for ASN.1 DER Integer\n * @extends KJUR.asn1.ASN1Object\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>int - specify initial ASN.1 value(V) by integer value</li>\n * <li>bigint - specify initial ASN.1 value(V) by BigInteger object</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERInteger = function(params) {\n KJUR.asn1.DERInteger.superclass.constructor.call(this);\n this.hT = \"02\";\n\n /**\n * set value by Tom Wu's BigInteger object\n * @name setByBigInteger\n * @memberOf KJUR.asn1.DERInteger\n * @function\n * @param {BigInteger} bigIntegerValue to set\n */\n this.setByBigInteger = function(bigIntegerValue) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\n };\n\n /**\n * set value by integer value\n * @name setByInteger\n * @memberOf KJUR.asn1.DERInteger\n * @function\n * @param {Integer} integer value to set\n */\n this.setByInteger = function(intValue) {\n\tvar bi = new BigInteger(String(intValue), 10);\n\tthis.setByBigInteger(bi);\n };\n\n /**\n * set value by integer value\n * @name setValueHex\n * @memberOf KJUR.asn1.DERInteger\n * @function\n * @param {String} hexadecimal string of integer value\n * @description\n * <br/>\n * NOTE: Value shall be represented by minimum octet length of\n * two's complement representation.\n */\n this.setValueHex = function(newHexString) {\n\tthis.hV = newHexString;\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['bigint'] != \"undefined\") {\n\t this.setByBigInteger(params['bigint']);\n\t} else if (typeof params['int'] != \"undefined\") {\n\t this.setByInteger(params['int']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setValueHex(params['hex']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER encoded BitString primitive\n * @name KJUR.asn1.DERBitString\n * @class class for ASN.1 DER encoded BitString primitive\n * @extends KJUR.asn1.ASN1Object\n * @description \n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>bin - specify binary string (ex. '10111')</li>\n * <li>array - specify array of boolean (ex. [true,false,true,true])</li>\n * <li>hex - specify hexadecimal string of ASN.1 value(V) including unused bits</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERBitString = function(params) {\n KJUR.asn1.DERBitString.superclass.constructor.call(this);\n this.hT = \"03\";\n\n /**\n * set ASN.1 value(V) by a hexadecimal string including unused bits\n * @name setHexValueIncludingUnusedBits\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {String} newHexStringIncludingUnusedBits\n */\n this.setHexValueIncludingUnusedBits = function(newHexStringIncludingUnusedBits) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.hV = newHexStringIncludingUnusedBits;\n };\n\n /**\n * set ASN.1 value(V) by unused bit and hexadecimal string of value\n * @name setUnusedBitsAndHexValue\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {Integer} unusedBits\n * @param {String} hValue\n */\n this.setUnusedBitsAndHexValue = function(unusedBits, hValue) {\n\tif (unusedBits < 0 || 7 < unusedBits) {\n\t throw \"unused bits shall be from 0 to 7: u = \" + unusedBits;\n\t}\n\tvar hUnusedBits = \"0\" + unusedBits;\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.hV = hUnusedBits + hValue;\n };\n\n /**\n * set ASN.1 DER BitString by binary string\n * @name setByBinaryString\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {String} binaryString binary value string (i.e. '10111')\n * @description\n * Its unused bits will be calculated automatically by length of \n * 'binaryValue'. <br/>\n * NOTE: Trailing zeros '0' will be ignored.\n */\n this.setByBinaryString = function(binaryString) {\n\tbinaryString = binaryString.replace(/0+$/, '');\n\tvar unusedBits = 8 - binaryString.length % 8;\n\tif (unusedBits == 8) unusedBits = 0;\n\tfor (var i = 0; i <= unusedBits; i++) {\n\t binaryString += '0';\n\t}\n\tvar h = '';\n\tfor (var i = 0; i < binaryString.length - 1; i += 8) {\n\t var b = binaryString.substr(i, 8);\n\t var x = parseInt(b, 2).toString(16);\n\t if (x.length == 1) x = '0' + x;\n\t h += x; \n\t}\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.hV = '0' + unusedBits + h;\n };\n\n /**\n * set ASN.1 TLV value(V) by an array of boolean\n * @name setByBooleanArray\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {array} booleanArray array of boolean (ex. [true, false, true])\n * @description\n * NOTE: Trailing falses will be ignored.\n */\n this.setByBooleanArray = function(booleanArray) {\n\tvar s = '';\n\tfor (var i = 0; i < booleanArray.length; i++) {\n\t if (booleanArray[i] == true) {\n\t\ts += '1';\n\t } else {\n\t\ts += '0';\n\t }\n\t}\n\tthis.setByBinaryString(s);\n };\n\n /**\n * generate an array of false with specified length\n * @name newFalseArray\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {Integer} nLength length of array to generate\n * @return {array} array of boolean faluse\n * @description\n * This static method may be useful to initialize boolean array.\n */\n this.newFalseArray = function(nLength) {\n\tvar a = new Array(nLength);\n\tfor (var i = 0; i < nLength; i++) {\n\t a[i] = false;\n\t}\n\treturn a;\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['hex'] != \"undefined\") {\n\t this.setHexValueIncludingUnusedBits(params['hex']);\n\t} else if (typeof params['bin'] != \"undefined\") {\n\t this.setByBinaryString(params['bin']);\n\t} else if (typeof params['array'] != \"undefined\") {\n\t this.setByBooleanArray(params['array']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER OctetString\n * @name KJUR.asn1.DEROctetString\n * @class class for ASN.1 DER OctetString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DEROctetString = function(params) {\n KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);\n this.hT = \"04\";\n};\nJSX.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Null\n * @name KJUR.asn1.DERNull\n * @class class for ASN.1 DER Null\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERNull = function() {\n KJUR.asn1.DERNull.superclass.constructor.call(this);\n this.hT = \"05\";\n this.hTLV = \"0500\";\n};\nJSX.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER ObjectIdentifier\n * @name KJUR.asn1.DERObjectIdentifier\n * @class class for ASN.1 DER ObjectIdentifier\n * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})\n * @extends KJUR.asn1.ASN1Object\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERObjectIdentifier = function(params) {\n var itox = function(i) {\n\tvar h = i.toString(16);\n\tif (h.length == 1) h = '0' + h;\n\treturn h;\n };\n var roidtox = function(roid) {\n\tvar h = '';\n\tvar bi = new BigInteger(roid, 10);\n\tvar b = bi.toString(2);\n\tvar padLen = 7 - b.length % 7;\n\tif (padLen == 7) padLen = 0;\n\tvar bPad = '';\n\tfor (var i = 0; i < padLen; i++) bPad += '0';\n\tb = bPad + b;\n\tfor (var i = 0; i < b.length - 1; i += 7) {\n\t var b8 = b.substr(i, 7);\n\t if (i != b.length - 7) b8 = '1' + b8;\n\t h += itox(parseInt(b8, 2));\n\t}\n\treturn h;\n }\n\n KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);\n this.hT = \"06\";\n\n /**\n * set value by a hexadecimal string\n * @name setValueHex\n * @memberOf KJUR.asn1.DERObjectIdentifier\n * @function\n * @param {String} newHexString hexadecimal value of OID bytes\n */\n this.setValueHex = function(newHexString) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = null;\n\tthis.hV = newHexString;\n };\n\n /**\n * set value by a OID string\n * @name setValueOidString\n * @memberOf KJUR.asn1.DERObjectIdentifier\n * @function\n * @param {String} oidString OID string (ex. 2.5.4.13)\n */\n this.setValueOidString = function(oidString) {\n\tif (! oidString.match(/^[0-9.]+$/)) {\n\t throw \"malformed oid string: \" + oidString;\n\t}\n\tvar h = '';\n\tvar a = oidString.split('.');\n\tvar i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\n\th += itox(i0);\n\ta.splice(0, 2);\n\tfor (var i = 0; i < a.length; i++) {\n\t h += roidtox(a[i]);\n\t}\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = null;\n\tthis.hV = h;\n };\n\n /**\n * set value by a OID name\n * @name setValueName\n * @memberOf KJUR.asn1.DERObjectIdentifier\n * @function\n * @param {String} oidName OID name (ex. 'serverAuth')\n * @since 1.0.1\n * @description\n * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.\n * Otherwise raise error.\n */\n this.setValueName = function(oidName) {\n\tif (typeof KJUR.asn1.x509.OID.name2oidList[oidName] != \"undefined\") {\n\t var oid = KJUR.asn1.x509.OID.name2oidList[oidName];\n\t this.setValueOidString(oid);\n\t} else {\n\t throw \"DERObjectIdentifier oidName undefined: \" + oidName;\n\t}\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['oid'] != \"undefined\") {\n\t this.setValueOidString(params['oid']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setValueHex(params['hex']);\n\t} else if (typeof params['name'] != \"undefined\") {\n\t this.setValueName(params['name']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER UTF8String\n * @name KJUR.asn1.DERUTF8String\n * @class class for ASN.1 DER UTF8String\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERUTF8String = function(params) {\n KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);\n this.hT = \"0c\";\n};\nJSX.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER NumericString\n * @name KJUR.asn1.DERNumericString\n * @class class for ASN.1 DER NumericString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERNumericString = function(params) {\n KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);\n this.hT = \"12\";\n};\nJSX.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER PrintableString\n * @name KJUR.asn1.DERPrintableString\n * @class class for ASN.1 DER PrintableString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERPrintableString = function(params) {\n KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);\n this.hT = \"13\";\n};\nJSX.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER TeletexString\n * @name KJUR.asn1.DERTeletexString\n * @class class for ASN.1 DER TeletexString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERTeletexString = function(params) {\n KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);\n this.hT = \"14\";\n};\nJSX.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER IA5String\n * @name KJUR.asn1.DERIA5String\n * @class class for ASN.1 DER IA5String\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERIA5String = function(params) {\n KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);\n this.hT = \"16\";\n};\nJSX.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER UTCTime\n * @name KJUR.asn1.DERUTCTime\n * @class class for ASN.1 DER UTCTime\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\n * @extends KJUR.asn1.DERAbstractTime\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * <li>date - specify Date object.</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n * <h4>EXAMPLES</h4>\n * @example\n * var d1 = new KJUR.asn1.DERUTCTime();\n * d1.setString('130430125959Z');\n *\n * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});\n *\n * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});\n */\nKJUR.asn1.DERUTCTime = function(params) {\n KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);\n this.hT = \"17\";\n\n /**\n * set value by a Date object\n * @name setByDate\n * @memberOf KJUR.asn1.DERUTCTime\n * @function\n * @param {Date} dateObject Date object to set ASN.1 value(V)\n */\n this.setByDate = function(dateObject) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.date = dateObject;\n\tthis.s = this.formatDate(this.date, 'utc');\n\tthis.hV = stohex(this.s);\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['str'] != \"undefined\") {\n\t this.setString(params['str']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setStringHex(params['hex']);\n\t} else if (typeof params['date'] != \"undefined\") {\n\t this.setByDate(params['date']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER GeneralizedTime\n * @name KJUR.asn1.DERGeneralizedTime\n * @class class for ASN.1 DER GeneralizedTime\n * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})\n * @extends KJUR.asn1.DERAbstractTime\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * <li>date - specify Date object.</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERGeneralizedTime = function(params) {\n KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);\n this.hT = \"18\";\n\n /**\n * set value by a Date object\n * @name setByDate\n * @memberOf KJUR.asn1.DERGeneralizedTime\n * @function\n * @param {Date} dateObject Date object to set ASN.1 value(V)\n * @example\n * When you specify UTC time, use 'Date.UTC' method like this:<br/>\n * var o = new DERUTCTime();\n * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59\n * o.setByDate(date);\n */\n this.setByDate = function(dateObject) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.date = dateObject;\n\tthis.s = this.formatDate(this.date, 'gen');\n\tthis.hV = stohex(this.s);\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['str'] != \"undefined\") {\n\t this.setString(params['str']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setStringHex(params['hex']);\n\t} else if (typeof params['date'] != \"undefined\") {\n\t this.setByDate(params['date']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Sequence\n * @name KJUR.asn1.DERSequence\n * @class class for ASN.1 DER Sequence\n * @extends KJUR.asn1.DERAbstractStructured\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>array - specify array of ASN1Object to set elements of content</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERSequence = function(params) {\n KJUR.asn1.DERSequence.superclass.constructor.call(this, params);\n this.hT = \"30\";\n this.getFreshValueHex = function() {\n\tvar h = '';\n\tfor (var i = 0; i < this.asn1Array.length; i++) {\n\t var asn1Obj = this.asn1Array[i];\n\t h += asn1Obj.getEncodedHex();\n\t}\n\tthis.hV = h;\n\treturn this.hV;\n };\n};\nJSX.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Set\n * @name KJUR.asn1.DERSet\n * @class class for ASN.1 DER Set\n * @extends KJUR.asn1.DERAbstractStructured\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>array - specify array of ASN1Object to set elements of content</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERSet = function(params) {\n KJUR.asn1.DERSet.superclass.constructor.call(this, params);\n this.hT = \"31\";\n this.getFreshValueHex = function() {\n\tvar a = new Array();\n\tfor (var i = 0; i < this.asn1Array.length; i++) {\n\t var asn1Obj = this.asn1Array[i];\n\t a.push(asn1Obj.getEncodedHex());\n\t}\n\ta.sort();\n\tthis.hV = a.join('');\n\treturn this.hV;\n };\n};\nJSX.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER TaggedObject\n * @name KJUR.asn1.DERTaggedObject\n * @class class for ASN.1 DER TaggedObject\n * @extends KJUR.asn1.ASN1Object\n * @description\n * <br/>\n * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.\n * For example, if you find '[1]' tag in a ASN.1 dump, \n * 'tagNoHex' will be 'a1'.\n * <br/>\n * As for optional argument 'params' for constructor, you can specify *ANY* of\n * following properties:\n * <ul>\n * <li>explicit - specify true if this is explicit tag otherwise false \n * (default is 'true').</li>\n * <li>tag - specify tag (default is 'a0' which means [0])</li>\n * <li>obj - specify ASN1Object which is tagged</li>\n * </ul>\n * @example\n * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});\n * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});\n * hex = d2.getEncodedHex();\n */\nKJUR.asn1.DERTaggedObject = function(params) {\n KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);\n this.hT = \"a0\";\n this.hV = '';\n this.isExplicit = true;\n this.asn1Object = null;\n\n /**\n * set value by an ASN1Object\n * @name setString\n * @memberOf KJUR.asn1.DERTaggedObject\n * @function\n * @param {Boolean} isExplicitFlag flag for explicit/implicit tag\n * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag\n * @param {ASN1Object} asn1Object ASN.1 to encapsulate\n */\n this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) {\n\tthis.hT = tagNoHex;\n\tthis.isExplicit = isExplicitFlag;\n\tthis.asn1Object = asn1Object;\n\tif (this.isExplicit) {\n\t this.hV = this.asn1Object.getEncodedHex();\n\t this.hTLV = null;\n\t this.isModified = true;\n\t} else {\n\t this.hV = null;\n\t this.hTLV = asn1Object.getEncodedHex();\n\t this.hTLV = this.hTLV.replace(/^../, tagNoHex);\n\t this.isModified = false;\n\t}\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['tag'] != \"undefined\") {\n\t this.hT = params['tag'];\n\t}\n\tif (typeof params['explicit'] != \"undefined\") {\n\t this.isExplicit = params['explicit'];\n\t}\n\tif (typeof params['obj'] != \"undefined\") {\n\t this.asn1Object = params['obj'];\n\t this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);"
  707. }
  708. ],
  709. "filteredModules": 0,
  710. "origins": [
  711. {
  712. "moduleId": 3,
  713. "module": "/home/corax/source/jsencrypt/test/test.rsa.js",
  714. "moduleIdentifier": "/home/corax/source/jsencrypt/test/test.rsa.js",
  715. "moduleName": "./test/test.rsa.js",
  716. "loc": "",
  717. "name": "main",
  718. "reasons": []
  719. }
  720. ]
  721. }
  722. ],
  723. "modules": [
  724. {
  725. "id": 0,
  726. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/jsbn.ts",
  727. "name": "./lib/jsbn/jsbn.ts",
  728. "index": 5,
  729. "index2": 3,
  730. "size": 46027,
  731. "cacheable": true,
  732. "built": true,
  733. "optional": false,
  734. "prefetched": false,
  735. "chunks": [
  736. 0
  737. ],
  738. "assets": [],
  739. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  740. "issuerId": 4,
  741. "issuerName": "./src/jsencrypt.js",
  742. "profile": {
  743. "factory": 48,
  744. "building": 944,
  745. "dependencies": 1
  746. },
  747. "failed": false,
  748. "errors": 0,
  749. "warnings": 0,
  750. "reasons": [
  751. {
  752. "moduleId": 4,
  753. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  754. "module": "./src/jsencrypt.js",
  755. "moduleName": "./src/jsencrypt.js",
  756. "type": "harmony import",
  757. "userRequest": "../lib/jsbn/jsbn",
  758. "loc": "5:0-45"
  759. },
  760. {
  761. "moduleId": 7,
  762. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rsa.ts",
  763. "module": "./lib/jsbn/rsa.ts",
  764. "moduleName": "./lib/jsbn/rsa.ts",
  765. "type": "harmony import",
  766. "userRequest": "./jsbn",
  767. "loc": "4:0-49"
  768. },
  769. {
  770. "moduleId": 12,
  771. "moduleIdentifier": "/home/corax/source/jsencrypt/lib/jsrsasign/asn1-1.0.js",
  772. "module": "./lib/jsrsasign/asn1-1.0.js",
  773. "moduleName": "./lib/jsrsasign/asn1-1.0.js",
  774. "type": "harmony import",
  775. "userRequest": "../jsbn/jsbn",
  776. "loc": "4:0-40"
  777. }
  778. ],
  779. "usedExports": [
  780. "BigInteger",
  781. "parseBigInt"
  782. ],
  783. "providedExports": [
  784. "BigInteger",
  785. "Classic",
  786. "Montgomery",
  787. "nbi",
  788. "parseBigInt",
  789. "intAt",
  790. "nbv",
  791. "nbits"
  792. ],
  793. "optimizationBailout": [],
  794. "depth": 2,
  795. "source": "// Copyright (c) 2005 Tom Wu\n// All Rights Reserved.\n// See \"LICENSE\" for details.\n// Basic JavaScript BN library - subset useful for RSA encryption.\nimport { cbit, int2char, lbit, op_and, op_andnot, op_or, op_xor } from \"./util\";\n// Bits per digit\nvar dbits;\n// JavaScript engine analysis\nvar canary = 0xdeadbeefcafe;\nvar j_lm = ((canary & 0xffffff) == 0xefcafe);\n//#region\nvar 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];\nvar lplim = (1 << 26) / lowprimes[lowprimes.length - 1];\n//#endregion\n// (public) Constructor\nvar BigInteger = /** @class */ (function () {\n function BigInteger(a, b, c) {\n if (a != null)\n if (\"number\" == typeof a)\n this.fromNumber(a, b, c);\n else if (b == null && \"string\" != typeof a)\n this.fromString(a, 256);\n else\n this.fromString(a, b);\n }\n //#region PUBLIC\n // BigInteger.prototype.toString = bnToString;\n // (public) return string representation in given radix\n BigInteger.prototype.toString = function (b) {\n if (this.s < 0) {\n return \"-\" + this.negate().toString(b);\n }\n var k;\n if (b == 16)\n k = 4;\n else if (b == 8)\n k = 3;\n else if (b == 2)\n k = 1;\n else if (b == 32)\n k = 5;\n else if (b == 4)\n k = 2;\n else\n return this.toRadix(b);\n var km = (1 << k) - 1, d, m = false, r = \"\", i = this.t;\n var p = this.DB - (i * this.DB) % k;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) > 0) {\n m = true;\n r = int2char(d);\n }\n while (i >= 0) {\n if (p < k) {\n d = (this[i] & ((1 << p) - 1)) << (k - p);\n d |= this[--i] >> (p += this.DB - k);\n }\n else {\n d = (this[i] >> (p -= k)) & km;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if (d > 0)\n m = true;\n if (m)\n r += int2char(d);\n }\n }\n return m ? r : \"0\";\n };\n // BigInteger.prototype.negate = bnNegate;\n // (public) -this\n BigInteger.prototype.negate = function () { var r = nbi(); BigInteger.ZERO.subTo(this, r); return r; };\n // BigInteger.prototype.abs = bnAbs;\n // (public) |this|\n BigInteger.prototype.abs = function () { return (this.s < 0) ? this.negate() : this; };\n // BigInteger.prototype.compareTo = bnCompareTo;\n // (public) return + if this > a, - if this < a, 0 if equal\n BigInteger.prototype.compareTo = function (a) {\n var r = this.s - a.s;\n if (r != 0)\n return r;\n var i = this.t;\n r = i - a.t;\n if (r != 0)\n return (this.s < 0) ? -r : r;\n while (--i >= 0)\n if ((r = this[i] - a[i]) != 0)\n return r;\n return 0;\n };\n // BigInteger.prototype.bitLength = bnBitLength;\n // (public) return the number of bits in \"this\"\n BigInteger.prototype.bitLength = function () {\n if (this.t <= 0)\n return 0;\n return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM));\n };\n // BigInteger.prototype.mod = bnMod;\n // (public) this mod a\n BigInteger.prototype.mod = function (a) {\n var r = nbi();\n this.abs().divRemTo(a, null, r);\n if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0)\n a.subTo(r, r);\n return r;\n };\n // BigInteger.prototype.modPowInt = bnModPowInt;\n // (public) this^e % m, 0 <= e < 2^32\n BigInteger.prototype.modPowInt = function (e, m) {\n var z;\n if (e < 256 || m.isEven())\n z = new Classic(m);\n else\n z = new Montgomery(m);\n return this.exp(e, z);\n };\n // BigInteger.prototype.clone = bnClone;\n // (public)\n BigInteger.prototype.clone = function () { var r = nbi(); this.copyTo(r); return r; };\n // BigInteger.prototype.intValue = bnIntValue;\n // (public) return value as integer\n BigInteger.prototype.intValue = function () {\n if (this.s < 0) {\n if (this.t == 1)\n return this[0] - this.DV;\n else if (this.t == 0)\n return -1;\n }\n else if (this.t == 1)\n return this[0];\n else if (this.t == 0)\n return 0;\n // assumes 16 < DB < 32\n return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0];\n };\n // BigInteger.prototype.byteValue = bnByteValue;\n // (public) return value as byte\n BigInteger.prototype.byteValue = function () { return (this.t == 0) ? this.s : (this[0] << 24) >> 24; };\n // BigInteger.prototype.shortValue = bnShortValue;\n // (public) return value as short (assumes DB>=16)\n BigInteger.prototype.shortValue = function () { return (this.t == 0) ? this.s : (this[0] << 16) >> 16; };\n // BigInteger.prototype.signum = bnSigNum;\n // (public) 0 if this == 0, 1 if this > 0\n BigInteger.prototype.signum = function () {\n if (this.s < 0)\n return -1;\n else if (this.t <= 0 || (this.t == 1 && this[0] <= 0))\n return 0;\n else\n return 1;\n };\n // BigInteger.prototype.toByteArray = bnToByteArray;\n // (public) convert to bigendian byte array\n BigInteger.prototype.toByteArray = function () {\n var i = this.t, r = new Array();\n r[0] = this.s;\n var p = this.DB - (i * this.DB) % 8, d, k = 0;\n if (i-- > 0) {\n if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p)\n r[k++] = d | (this.s << (this.DB - p));\n while (i >= 0) {\n if (p < 8) {\n d = (this[i] & ((1 << p) - 1)) << (8 - p);\n d |= this[--i] >> (p += this.DB - 8);\n }\n else {\n d = (this[i] >> (p -= 8)) & 0xff;\n if (p <= 0) {\n p += this.DB;\n --i;\n }\n }\n if ((d & 0x80) != 0)\n d |= -256;\n if (k == 0 && (this.s & 0x80) != (d & 0x80))\n ++k;\n if (k > 0 || d != this.s)\n r[k++] = d;\n }\n }\n return r;\n };\n // BigInteger.prototype.equals = bnEquals;\n BigInteger.prototype.equals = function (a) { return (this.compareTo(a) == 0); };\n // BigInteger.prototype.min = bnMin;\n BigInteger.prototype.min = function (a) { return (this.compareTo(a) < 0) ? this : a; };\n // BigInteger.prototype.max = bnMax;\n BigInteger.prototype.max = function (a) { return (this.compareTo(a) > 0) ? this : a; };\n // BigInteger.prototype.and = bnAnd;\n BigInteger.prototype.and = function (a) { var r = nbi(); this.bitwiseTo(a, op_and, r); return r; };\n // BigInteger.prototype.or = bnOr;\n BigInteger.prototype.or = function (a) { var r = nbi(); this.bitwiseTo(a, op_or, r); return r; };\n // BigInteger.prototype.xor = bnXor;\n BigInteger.prototype.xor = function (a) { var r = nbi(); this.bitwiseTo(a, op_xor, r); return r; };\n // BigInteger.prototype.andNot = bnAndNot;\n BigInteger.prototype.andNot = function (a) { var r = nbi(); this.bitwiseTo(a, op_andnot, r); return r; };\n // BigInteger.prototype.not = bnNot;\n // (public) ~this\n BigInteger.prototype.not = function () {\n var r = nbi();\n for (var i = 0; i < this.t; ++i)\n r[i] = this.DM & ~this[i];\n r.t = this.t;\n r.s = ~this.s;\n return r;\n };\n // BigInteger.prototype.shiftLeft = bnShiftLeft;\n // (public) this << n\n BigInteger.prototype.shiftLeft = function (n) {\n var r = nbi();\n if (n < 0)\n this.rShiftTo(-n, r);\n else\n this.lShiftTo(n, r);\n return r;\n };\n // BigInteger.prototype.shiftRight = bnShiftRight;\n // (public) this >> n\n BigInteger.prototype.shiftRight = function (n) {\n var r = nbi();\n if (n < 0)\n this.lShiftTo(-n, r);\n else\n this.rShiftTo(n, r);\n return r;\n };\n // BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;\n // (public) returns index of lowest 1-bit (or -1 if none)\n BigInteger.prototype.getLowestSetBit = function () {\n for (var i = 0; i < this.t; ++i)\n if (this[i] != 0)\n return i * this.DB + lbit(this[i]);\n if (this.s < 0)\n return this.t * this.DB;\n return -1;\n };\n // BigInteger.prototype.bitCount = bnBitCount;\n // (public) return number of set bits\n BigInteger.prototype.bitCount = function () {\n var r = 0, x = this.s & this.DM;\n for (var i = 0; i < this.t; ++i)\n r += cbit(this[i] ^ x);\n return r;\n };\n // BigInteger.prototype.testBit = bnTestBit;\n // (public) true iff nth bit is set\n BigInteger.prototype.testBit = function (n) {\n var j = Math.floor(n / this.DB);\n if (j >= this.t)\n return (this.s != 0);\n return ((this[j] & (1 << (n % this.DB))) != 0);\n };\n // BigInteger.prototype.setBit = bnSetBit;\n // (public) this | (1<<n)\n BigInteger.prototype.setBit = function (n) { return this.changeBit(n, op_or); };\n // BigInteger.prototype.clearBit = bnClearBit;\n // (public) this & ~(1<<n)\n BigInteger.prototype.clearBit = function (n) { return this.changeBit(n, op_andnot); };\n // BigInteger.prototype.flipBit = bnFlipBit;\n // (public) this ^ (1<<n)\n BigInteger.prototype.flipBit = function (n) { return this.changeBit(n, op_xor); };\n // BigInteger.prototype.add = bnAdd;\n // (public) this + a\n BigInteger.prototype.add = function (a) { var r = nbi(); this.addTo(a, r); return r; };\n // BigInteger.prototype.subtract = bnSubtract;\n // (public) this - a\n BigInteger.prototype.subtract = function (a) { var r = nbi(); this.subTo(a, r); return r; };\n // BigInteger.prototype.multiply = bnMultiply;\n // (public) this * a\n BigInteger.prototype.multiply = function (a) { var r = nbi(); this.multiplyTo(a, r); return r; };\n // BigInteger.prototype.divide = bnDivide;\n // (public) this / a\n BigInteger.prototype.divide = function (a) { var r = nbi(); this.divRemTo(a, r, null); return r; };\n // BigInteger.prototype.remainder = bnRemainder;\n // (public) this % a\n BigInteger.prototype.remainder = function (a) { var r = nbi(); this.divRemTo(a, null, r); return r; };\n // BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;\n // (public) [this/a,this%a]\n BigInteger.prototype.divideAndRemainder = function (a) {\n var q = nbi(), r = nbi();\n this.divRemTo(a, q, r);\n return new Array(q, r);\n };\n // BigInteger.prototype.modPow = bnModPow;\n // (public) this^e % m (HAC 14.85)\n BigInteger.prototype.modPow = function (e, m) {\n var i = e.bitLength(), k, r = nbv(1), z;\n if (i <= 0)\n return r;\n else if (i < 18)\n k = 1;\n else if (i < 48)\n k = 3;\n else if (i < 144)\n k = 4;\n else if (i < 768)\n k = 5;\n else\n k = 6;\n if (i < 8)\n z = new Classic(m);\n else if (m.isEven())\n z = new Barrett(m);\n else\n z = new Montgomery(m);\n // precomputation\n var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;\n g[1] = z.convert(this);\n if (k > 1) {\n var g2 = nbi();\n z.sqrTo(g[1], g2);\n while (n <= km) {\n g[n] = nbi();\n z.mulTo(g2, g[n - 2], g[n]);\n n += 2;\n }\n }\n var j = e.t - 1, w, is1 = true, r2 = nbi(), t;\n i = nbits(e[j]) - 1;\n while (j >= 0) {\n if (i >= k1)\n w = (e[j] >> (i - k1)) & km;\n else {\n w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);\n if (j > 0)\n w |= e[j - 1] >> (this.DB + i - k1);\n }\n n = k;\n while ((w & 1) == 0) {\n w >>= 1;\n --n;\n }\n if ((i -= n) < 0) {\n i += this.DB;\n --j;\n }\n if (is1) {\n g[w].copyTo(r);\n is1 = false;\n }\n else {\n while (n > 1) {\n z.sqrTo(r, r2);\n z.sqrTo(r2, r);\n n -= 2;\n }\n if (n > 0)\n z.sqrTo(r, r2);\n else {\n t = r;\n r = r2;\n r2 = t;\n }\n z.mulTo(r2, g[w], r);\n }\n while (j >= 0 && (e[j] & (1 << i)) == 0) {\n z.sqrTo(r, r2);\n t = r;\n r = r2;\n r2 = t;\n if (--i < 0) {\n i = this.DB - 1;\n --j;\n }\n }\n }\n return z.revert(r);\n };\n // BigInteger.prototype.modInverse = bnModInverse;\n // (public) 1/this % m (HAC 14.61)\n BigInteger.prototype.modInverse = function (m) {\n var ac = m.isEven();\n if ((this.isEven() && ac) || m.signum() == 0)\n return BigInteger.ZERO;\n var u = m.clone(), v = this.clone();\n var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);\n while (u.signum() != 0) {\n while (u.isEven()) {\n u.rShiftTo(1, u);\n if (ac) {\n if (!a.isEven() || !b.isEven()) {\n a.addTo(this, a);\n b.subTo(m, b);\n }\n a.rShiftTo(1, a);\n }\n else if (!b.isEven())\n b.subTo(m, b);\n b.rShiftTo(1, b);\n }\n while (v.isEven()) {\n v.rShiftTo(1, v);\n if (ac) {\n if (!c.isEven() || !d.isEven()) {\n c.addTo(this, c);\n d.subTo(m, d);\n }\n c.rShiftTo(1, c);\n }\n else if (!d.isEven())\n d.subTo(m, d);\n d.rShiftTo(1, d);\n }\n if (u.compareTo(v) >= 0) {\n u.subTo(v, u);\n if (ac)\n a.subTo(c, a);\n b.subTo(d, b);\n }\n else {\n v.subTo(u, v);\n if (ac)\n c.subTo(a, c);\n d.subTo(b, d);\n }\n }\n if (v.compareTo(BigInteger.ONE) != 0)\n return BigInteger.ZERO;\n if (d.compareTo(m) >= 0)\n return d.subtract(m);\n if (d.signum() < 0)\n d.addTo(m, d);\n else\n return d;\n if (d.signum() < 0)\n return d.add(m);\n else\n return d;\n };\n // BigInteger.prototype.pow = bnPow;\n // (public) this^e\n BigInteger.prototype.pow = function (e) { return this.exp(e, new NullExp()); };\n // BigInteger.prototype.gcd = bnGCD;\n // (public) gcd(this,a) (HAC 14.54)\n BigInteger.prototype.gcd = function (a) {\n var x = (this.s < 0) ? this.negate() : this.clone();\n var y = (a.s < 0) ? a.negate() : a.clone();\n if (x.compareTo(y) < 0) {\n var t = x;\n x = y;\n y = t;\n }\n var i = x.getLowestSetBit(), g = y.getLowestSetBit();\n if (g < 0)\n return x;\n if (i < g)\n g = i;\n if (g > 0) {\n x.rShiftTo(g, x);\n y.rShiftTo(g, y);\n }\n while (x.signum() > 0) {\n if ((i = x.getLowestSetBit()) > 0)\n x.rShiftTo(i, x);\n if ((i = y.getLowestSetBit()) > 0)\n y.rShiftTo(i, y);\n if (x.compareTo(y) >= 0) {\n x.subTo(y, x);\n x.rShiftTo(1, x);\n }\n else {\n y.subTo(x, y);\n y.rShiftTo(1, y);\n }\n }\n if (g > 0)\n y.lShiftTo(g, y);\n return y;\n };\n // BigInteger.prototype.isProbablePrime = bnIsProbablePrime;\n // (public) test primality with certainty >= 1-.5^t\n BigInteger.prototype.isProbablePrime = function (t) {\n var i, x = this.abs();\n if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {\n for (i = 0; i < lowprimes.length; ++i)\n if (x[0] == lowprimes[i])\n return true;\n return false;\n }\n if (x.isEven())\n return false;\n i = 1;\n while (i < lowprimes.length) {\n var m = lowprimes[i], j = i + 1;\n while (j < lowprimes.length && m < lplim)\n m *= lowprimes[j++];\n m = x.modInt(m);\n while (i < j)\n if (m % lowprimes[i++] == 0)\n return false;\n }\n return x.millerRabin(t);\n };\n //#endregion PUBLIC\n //#region PROTECTED\n // BigInteger.prototype.copyTo = bnpCopyTo;\n // (protected) copy this to r\n BigInteger.prototype.copyTo = function (r) {\n for (var i = this.t - 1; i >= 0; --i)\n r[i] = this[i];\n r.t = this.t;\n r.s = this.s;\n };\n // BigInteger.prototype.fromInt = bnpFromInt;\n // (protected) set from integer value x, -DV <= x < DV\n BigInteger.prototype.fromInt = function (x) {\n this.t = 1;\n this.s = (x < 0) ? -1 : 0;\n if (x > 0)\n this[0] = x;\n else if (x < -1)\n this[0] = x + this.DV;\n else\n this.t = 0;\n };\n // BigInteger.prototype.fromString = bnpFromString;\n // (protected) set from string and radix\n BigInteger.prototype.fromString = function (s, b) {\n var k;\n if (b == 16)\n k = 4;\n else if (b == 8)\n k = 3;\n else if (b == 256)\n k = 8; // byte array\n else if (b == 2)\n k = 1;\n else if (b == 32)\n k = 5;\n else if (b == 4)\n k = 2;\n else {\n this.fromRadix(s, b);\n return;\n }\n this.t = 0;\n this.s = 0;\n var i = s.length, mi = false, sh = 0;\n while (--i >= 0) {\n var x = (k == 8) ? s[i] & 0xff : intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\")\n mi = true;\n continue;\n }\n mi = false;\n if (sh == 0)\n this[this.t++] = x;\n else if (sh + k > this.DB) {\n this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh;\n this[this.t++] = (x >> (this.DB - sh));\n }\n else\n this[this.t - 1] |= x << sh;\n sh += k;\n if (sh >= this.DB)\n sh -= this.DB;\n }\n if (k == 8 && (s[0] & 0x80) != 0) {\n this.s = -1;\n if (sh > 0)\n this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh;\n }\n this.clamp();\n if (mi)\n BigInteger.ZERO.subTo(this, this);\n };\n // BigInteger.prototype.clamp = bnpClamp;\n // (protected) clamp off excess high words\n BigInteger.prototype.clamp = function () {\n var c = this.s & this.DM;\n while (this.t > 0 && this[this.t - 1] == c)\n --this.t;\n };\n // BigInteger.prototype.dlShiftTo = bnpDLShiftTo;\n // (protected) r = this << n*DB\n BigInteger.prototype.dlShiftTo = function (n, r) {\n var i;\n for (i = this.t - 1; i >= 0; --i)\n r[i + n] = this[i];\n for (i = n - 1; i >= 0; --i)\n r[i] = 0;\n r.t = this.t + n;\n r.s = this.s;\n };\n // BigInteger.prototype.drShiftTo = bnpDRShiftTo;\n // (protected) r = this >> n*DB\n BigInteger.prototype.drShiftTo = function (n, r) {\n for (var i = n; i < this.t; ++i)\n r[i - n] = this[i];\n r.t = Math.max(this.t - n, 0);\n r.s = this.s;\n };\n // BigInteger.prototype.lShiftTo = bnpLShiftTo;\n // (protected) r = this << n\n BigInteger.prototype.lShiftTo = function (n, r) {\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << cbs) - 1;\n var ds = Math.floor(n / this.DB), c = (this.s << bs) & this.DM, i;\n for (i = this.t - 1; i >= 0; --i) {\n r[i + ds + 1] = (this[i] >> cbs) | c;\n c = (this[i] & bm) << bs;\n }\n for (i = ds - 1; i >= 0; --i)\n r[i] = 0;\n r[ds] = c;\n r.t = this.t + ds + 1;\n r.s = this.s;\n r.clamp();\n };\n // BigInteger.prototype.rShiftTo = bnpRShiftTo;\n // (protected) r = this >> n\n BigInteger.prototype.rShiftTo = function (n, r) {\n r.s = this.s;\n var ds = Math.floor(n / this.DB);\n if (ds >= this.t) {\n r.t = 0;\n return;\n }\n var bs = n % this.DB;\n var cbs = this.DB - bs;\n var bm = (1 << bs) - 1;\n r[0] = this[ds] >> bs;\n for (var i = ds + 1; i < this.t; ++i) {\n r[i - ds - 1] |= (this[i] & bm) << cbs;\n r[i - ds] = this[i] >> bs;\n }\n if (bs > 0)\n r[this.t - ds - 1] |= (this.s & bm) << cbs;\n r.t = this.t - ds;\n r.clamp();\n };\n // BigInteger.prototype.subTo = bnpSubTo;\n // (protected) r = this - a\n BigInteger.prototype.subTo = function (a, r) {\n var i = 0, c = 0, m = Math.min(a.t, this.t);\n while (i < m) {\n c += this[i] - a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n if (a.t < this.t) {\n c -= a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c -= a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c -= a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c < -1)\n r[i++] = this.DV + c;\n else if (c > 0)\n r[i++] = c;\n r.t = i;\n r.clamp();\n };\n // BigInteger.prototype.multiplyTo = bnpMultiplyTo;\n // (protected) r = this * a, r != this,a (HAC 14.12)\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyTo = function (a, r) {\n var x = this.abs(), y = a.abs();\n var i = x.t;\n r.t = i + y.t;\n while (--i >= 0)\n r[i] = 0;\n for (i = 0; i < y.t; ++i)\n r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);\n r.s = 0;\n r.clamp();\n if (this.s != a.s)\n BigInteger.ZERO.subTo(r, r);\n };\n // BigInteger.prototype.squareTo = bnpSquareTo;\n // (protected) r = this^2, r != this (HAC 14.16)\n BigInteger.prototype.squareTo = function (r) {\n var x = this.abs();\n var i = r.t = 2 * x.t;\n while (--i >= 0)\n r[i] = 0;\n for (i = 0; i < x.t - 1; ++i) {\n var c = x.am(i, x[i], r, 2 * i, 0, 1);\n if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {\n r[i + x.t] -= x.DV;\n r[i + x.t + 1] = 1;\n }\n }\n if (r.t > 0)\n r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);\n r.s = 0;\n r.clamp();\n };\n // BigInteger.prototype.divRemTo = bnpDivRemTo;\n // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)\n // r != q, this != m. q or r may be null.\n BigInteger.prototype.divRemTo = function (m, q, r) {\n var pm = m.abs();\n if (pm.t <= 0)\n return;\n var pt = this.abs();\n if (pt.t < pm.t) {\n if (q != null)\n q.fromInt(0);\n if (r != null)\n this.copyTo(r);\n return;\n }\n if (r == null)\n r = nbi();\n var y = nbi(), ts = this.s, ms = m.s;\n var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus\n if (nsh > 0) {\n pm.lShiftTo(nsh, y);\n pt.lShiftTo(nsh, r);\n }\n else {\n pm.copyTo(y);\n pt.copyTo(r);\n }\n var ys = y.t;\n var y0 = y[ys - 1];\n if (y0 == 0)\n return;\n var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0);\n var d1 = this.FV / yt, d2 = (1 << this.F1) / yt, e = 1 << this.F2;\n var i = r.t, j = i - ys, t = (q == null) ? nbi() : q;\n y.dlShiftTo(j, t);\n if (r.compareTo(t) >= 0) {\n r[r.t++] = 1;\n r.subTo(t, r);\n }\n BigInteger.ONE.dlShiftTo(ys, t);\n t.subTo(y, y); // \"negative\" y so we can replace sub with am later\n while (y.t < ys)\n y[y.t++] = 0;\n while (--j >= 0) {\n // Estimate quotient digit\n var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);\n if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {\n y.dlShiftTo(j, t);\n r.subTo(t, r);\n while (r[i] < --qd)\n r.subTo(t, r);\n }\n }\n if (q != null) {\n r.drShiftTo(ys, q);\n if (ts != ms)\n BigInteger.ZERO.subTo(q, q);\n }\n r.t = ys;\n r.clamp();\n if (nsh > 0)\n r.rShiftTo(nsh, r); // Denormalize remainder\n if (ts < 0)\n BigInteger.ZERO.subTo(r, r);\n };\n // BigInteger.prototype.invDigit = bnpInvDigit;\n // (protected) return \"-1/this % 2^DB\"; useful for Mont. reduction\n // justification:\n // xy == 1 (mod m)\n // xy = 1+km\n // xy(2-xy) = (1+km)(1-km)\n // x[y(2-xy)] = 1-k^2m^2\n // x[y(2-xy)] == 1 (mod m^2)\n // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2\n // should reduce x and y(2-xy) by m^2 at each step to keep size bounded.\n // JS multiply \"overflows\" differently from C/C++, so care is needed here.\n BigInteger.prototype.invDigit = function () {\n if (this.t < 1)\n return 0;\n var x = this[0];\n if ((x & 1) == 0)\n return 0;\n var y = x & 3; // y == 1/x mod 2^2\n y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4\n y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8\n y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16\n // last step - calculate inverse mod DV directly;\n // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints\n y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits\n // we really want the negative inverse, and -DV < y < DV\n return (y > 0) ? this.DV - y : -y;\n };\n // BigInteger.prototype.isEven = bnpIsEven;\n // (protected) true iff this is even\n BigInteger.prototype.isEven = function () { return ((this.t > 0) ? (this[0] & 1) : this.s) == 0; };\n // BigInteger.prototype.exp = bnpExp;\n // (protected) this^e, e < 2^32, doing sqr and mul with \"r\" (HAC 14.79)\n BigInteger.prototype.exp = function (e, z) {\n if (e > 0xffffffff || e < 1)\n return BigInteger.ONE;\n var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e) - 1;\n g.copyTo(r);\n while (--i >= 0) {\n z.sqrTo(r, r2);\n if ((e & (1 << i)) > 0)\n z.mulTo(r2, g, r);\n else {\n var t = r;\n r = r2;\n r2 = t;\n }\n }\n return z.revert(r);\n };\n // BigInteger.prototype.chunkSize = bnpChunkSize;\n // (protected) return x s.t. r^x < DV\n BigInteger.prototype.chunkSize = function (r) { return Math.floor(Math.LN2 * this.DB / Math.log(r)); };\n // BigInteger.prototype.toRadix = bnpToRadix;\n // (protected) convert to radix string\n BigInteger.prototype.toRadix = function (b) {\n if (b == null)\n b = 10;\n if (this.signum() == 0 || b < 2 || b > 36)\n return \"0\";\n var cs = this.chunkSize(b);\n var a = Math.pow(b, cs);\n var d = nbv(a), y = nbi(), z = nbi(), r = \"\";\n this.divRemTo(d, y, z);\n while (y.signum() > 0) {\n r = (a + z.intValue()).toString(b).substr(1) + r;\n y.divRemTo(d, y, z);\n }\n return z.intValue().toString(b) + r;\n };\n // BigInteger.prototype.fromRadix = bnpFromRadix;\n // (protected) convert from radix string\n BigInteger.prototype.fromRadix = function (s, b) {\n this.fromInt(0);\n if (b == null)\n b = 10;\n var cs = this.chunkSize(b);\n var d = Math.pow(b, cs), mi = false, j = 0, w = 0;\n for (var i = 0; i < s.length; ++i) {\n var x = intAt(s, i);\n if (x < 0) {\n if (s.charAt(i) == \"-\" && this.signum() == 0)\n mi = true;\n continue;\n }\n w = b * w + x;\n if (++j >= cs) {\n this.dMultiply(d);\n this.dAddOffset(w, 0);\n j = 0;\n w = 0;\n }\n }\n if (j > 0) {\n this.dMultiply(Math.pow(b, j));\n this.dAddOffset(w, 0);\n }\n if (mi)\n BigInteger.ZERO.subTo(this, this);\n };\n // BigInteger.prototype.fromNumber = bnpFromNumber;\n // (protected) alternate constructor\n BigInteger.prototype.fromNumber = function (a, b, c) {\n if (\"number\" == typeof b) {\n // new BigInteger(int,int,RNG)\n if (a < 2)\n this.fromInt(1);\n else {\n this.fromNumber(a, c);\n if (!this.testBit(a - 1))\n this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);\n if (this.isEven())\n this.dAddOffset(1, 0); // force odd\n while (!this.isProbablePrime(b)) {\n this.dAddOffset(2, 0);\n if (this.bitLength() > a)\n this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);\n }\n }\n }\n else {\n // new BigInteger(int,RNG)\n var x = new Array(), t = a & 7;\n x.length = (a >> 3) + 1;\n b.nextBytes(x);\n if (t > 0)\n x[0] &= ((1 << t) - 1);\n else\n x[0] = 0;\n this.fromString(x, 256);\n }\n };\n // BigInteger.prototype.bitwiseTo = bnpBitwiseTo;\n // (protected) r = this op a (bitwise)\n BigInteger.prototype.bitwiseTo = function (a, op, r) {\n var i, f, m = Math.min(a.t, this.t);\n for (i = 0; i < m; ++i)\n r[i] = op(this[i], a[i]);\n if (a.t < this.t) {\n f = a.s & this.DM;\n for (i = m; i < this.t; ++i)\n r[i] = op(this[i], f);\n r.t = this.t;\n }\n else {\n f = this.s & this.DM;\n for (i = m; i < a.t; ++i)\n r[i] = op(f, a[i]);\n r.t = a.t;\n }\n r.s = op(this.s, a.s);\n r.clamp();\n };\n // BigInteger.prototype.changeBit = bnpChangeBit;\n // (protected) this op (1<<n)\n BigInteger.prototype.changeBit = function (n, op) {\n var r = BigInteger.ONE.shiftLeft(n);\n this.bitwiseTo(r, op, r);\n return r;\n };\n // BigInteger.prototype.addTo = bnpAddTo;\n // (protected) r = this + a\n BigInteger.prototype.addTo = function (a, r) {\n var i = 0, c = 0, m = Math.min(a.t, this.t);\n while (i < m) {\n c += this[i] + a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n if (a.t < this.t) {\n c += a.s;\n while (i < this.t) {\n c += this[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += this.s;\n }\n else {\n c += this.s;\n while (i < a.t) {\n c += a[i];\n r[i++] = c & this.DM;\n c >>= this.DB;\n }\n c += a.s;\n }\n r.s = (c < 0) ? -1 : 0;\n if (c > 0)\n r[i++] = c;\n else if (c < -1)\n r[i++] = this.DV + c;\n r.t = i;\n r.clamp();\n };\n // BigInteger.prototype.dMultiply = bnpDMultiply;\n // (protected) this *= n, this >= 0, 1 < n < DV\n BigInteger.prototype.dMultiply = function (n) {\n this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);\n ++this.t;\n this.clamp();\n };\n // BigInteger.prototype.dAddOffset = bnpDAddOffset;\n // (protected) this += n << w words, this >= 0\n BigInteger.prototype.dAddOffset = function (n, w) {\n if (n == 0)\n return;\n while (this.t <= w)\n this[this.t++] = 0;\n this[w] += n;\n while (this[w] >= this.DV) {\n this[w] -= this.DV;\n if (++w >= this.t)\n this[this.t++] = 0;\n ++this[w];\n }\n };\n // BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;\n // (protected) r = lower n words of \"this * a\", a.t <= n\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyLowerTo = function (a, n, r) {\n var i = Math.min(this.t + a.t, n);\n r.s = 0; // assumes a,this >= 0\n r.t = i;\n while (i > 0)\n r[--i] = 0;\n var j;\n for (j = r.t - this.t; i < j; ++i)\n r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);\n for (j = Math.min(a.t, n); i < j; ++i)\n this.am(0, a[i], r, i, 0, n - i);\n r.clamp();\n };\n // BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;\n // (protected) r = \"this * a\" without lower n words, n > 0\n // \"this\" should be the larger one if appropriate.\n BigInteger.prototype.multiplyUpperTo = function (a, n, r) {\n --n;\n var i = r.t = this.t + a.t - n;\n r.s = 0; // assumes a,this >= 0\n while (--i >= 0)\n r[i] = 0;\n for (i = Math.max(n - this.t, 0); i < a.t; ++i)\n r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);\n r.clamp();\n r.drShiftTo(1, r);\n };\n // BigInteger.prototype.modInt = bnpModInt;\n // (protected) this % n, n < 2^26\n BigInteger.prototype.modInt = function (n) {\n if (n <= 0)\n return 0;\n var d = this.DV % n, r = (this.s < 0) ? n - 1 : 0;\n if (this.t > 0)\n if (d == 0)\n r = this[0] % n;\n else\n for (var i = this.t - 1; i >= 0; --i)\n r = (d * r + this[i]) % n;\n return r;\n };\n // BigInteger.prototype.millerRabin = bnpMillerRabin;\n // (protected) true if probably prime (HAC 4.24, Miller-Rabin)\n BigInteger.prototype.millerRabin = function (t) {\n var n1 = this.subtract(BigInteger.ONE);\n var k = n1.getLowestSetBit();\n if (k <= 0)\n return false;\n var r = n1.shiftRight(k);\n t = (t + 1) >> 1;\n if (t > lowprimes.length)\n t = lowprimes.length;\n var a = nbi();\n for (var i = 0; i < t; ++i) {\n //Pick bases at random, instead of starting at 2\n a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);\n var y = a.modPow(r, this);\n if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {\n var j = 1;\n while (j++ < k && y.compareTo(n1) != 0) {\n y = y.modPowInt(2, this);\n if (y.compareTo(BigInteger.ONE) == 0)\n return false;\n }\n if (y.compareTo(n1) != 0)\n return false;\n }\n }\n return true;\n };\n //BigInteger.prototype.square = bnSquare;\n // (public) this^2\n BigInteger.prototype.square = function () { var r = nbi(); this.squareTo(r); return r; };\n return BigInteger;\n}());\nexport { BigInteger };\n//#region REDUCERS\n//#region NullExp\nvar NullExp = /** @class */ (function () {\n function NullExp() {\n }\n // NullExp.prototype.convert = nNop;\n NullExp.prototype.convert = function (x) { return x; };\n // NullExp.prototype.revert = nNop;\n NullExp.prototype.revert = function (x) { return x; };\n // NullExp.prototype.mulTo = nMulTo;\n NullExp.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); };\n // NullExp.prototype.sqrTo = nSqrTo;\n NullExp.prototype.nSqrTo = function (x, r) { x.squareTo(r); };\n return NullExp;\n}());\n// Modular reduction using \"classic\" algorithm\nvar Classic = /** @class */ (function () {\n function Classic(m) {\n this.m = m;\n }\n // Classic.prototype.convert = cConvert;\n Classic.prototype.convert = function (x) {\n if (x.s < 0 || x.compareTo(this.m) >= 0)\n return x.mod(this.m);\n else\n return x;\n };\n // Classic.prototype.revert = cRevert;\n Classic.prototype.revert = function (x) {\n return x;\n };\n // Classic.prototype.reduce = cReduce;\n Classic.prototype.reduce = function (x) {\n x.divRemTo(this.m, null, x);\n };\n // Classic.prototype.mulTo = cMulTo;\n Classic.prototype.mulTo = function (x, y, r) {\n x.multiplyTo(y, r);\n this.reduce(r);\n };\n // Classic.prototype.sqrTo = cSqrTo;\n Classic.prototype.sqrTo = function (x, r) {\n x.squareTo(r);\n this.reduce(r);\n };\n return Classic;\n}());\nexport { Classic };\n//#endregion\n//#region Montgomery\n// Montgomery reduction\nvar Montgomery = /** @class */ (function () {\n function Montgomery(m) {\n this.m = m;\n this.mp = m.invDigit();\n this.mpl = this.mp & 0x7fff;\n this.mph = this.mp >> 15;\n this.um = (1 << (m.DB - 15)) - 1;\n this.mt2 = 2 * m.t;\n }\n // Montgomery.prototype.convert = montConvert;\n // xR mod m\n Montgomery.prototype.convert = function (x) {\n var r = nbi();\n x.abs().dlShiftTo(this.m.t, r);\n r.divRemTo(this.m, null, r);\n if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0)\n this.m.subTo(r, r);\n return r;\n };\n // Montgomery.prototype.revert = montRevert;\n // x/R mod m\n Montgomery.prototype.revert = function (x) {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n };\n // Montgomery.prototype.reduce = montReduce;\n // x = x/R mod m (HAC 14.32)\n Montgomery.prototype.reduce = function (x) {\n while (x.t <= this.mt2)\n x[x.t++] = 0;\n for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;\n // use am to combine the multiply-shift-add into one call\n j = i + this.m.t;\n x[j] += this.m.am(0, u0, x, i, 0, this.m.t);\n // propagate carry\n while (x[j] >= x.DV) {\n x[j] -= x.DV;\n x[++j]++;\n }\n }\n x.clamp();\n x.drShiftTo(this.m.t, x);\n if (x.compareTo(this.m) >= 0)\n x.subTo(this.m, x);\n };\n // Montgomery.prototype.mulTo = montMulTo;\n // r = \"xy/R mod m\"; x,y != r\n Montgomery.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); this.reduce(r); };\n // Montgomery.prototype.sqrTo = montSqrTo;\n // r = \"x^2/R mod m\"; x != r\n Montgomery.prototype.sqrTo = function (x, r) { x.squareTo(r); this.reduce(r); };\n return Montgomery;\n}());\nexport { Montgomery };\n//#endregion Montgomery\n//#region Barrett\n// Barrett modular reduction\nvar Barrett = /** @class */ (function () {\n function Barrett(m) {\n this.m = m;\n // setup Barrett\n this.r2 = nbi();\n this.q3 = nbi();\n BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);\n this.mu = this.r2.divide(m);\n }\n // Barrett.prototype.convert = barrettConvert;\n Barrett.prototype.convert = function (x) {\n if (x.s < 0 || x.t > 2 * this.m.t)\n return x.mod(this.m);\n else if (x.compareTo(this.m) < 0)\n return x;\n else {\n var r = nbi();\n x.copyTo(r);\n this.reduce(r);\n return r;\n }\n };\n // Barrett.prototype.revert = barrettRevert;\n Barrett.prototype.revert = function (x) { return x; };\n // Barrett.prototype.reduce = barrettReduce;\n // x = x mod m (HAC 14.42)\n Barrett.prototype.reduce = function (x) {\n x.drShiftTo(this.m.t - 1, this.r2);\n if (x.t > this.m.t + 1) {\n x.t = this.m.t + 1;\n x.clamp();\n }\n this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);\n this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);\n while (x.compareTo(this.r2) < 0)\n x.dAddOffset(1, this.m.t + 1);\n x.subTo(this.r2, x);\n while (x.compareTo(this.m) >= 0)\n x.subTo(this.m, x);\n };\n // Barrett.prototype.mulTo = barrettMulTo;\n // r = x*y mod m; x,y != r\n Barrett.prototype.mulTo = function (x, y, r) { x.multiplyTo(y, r); this.reduce(r); };\n // Barrett.prototype.sqrTo = barrettSqrTo;\n // r = x^2 mod m; x != r\n Barrett.prototype.sqrTo = function (x, r) { x.squareTo(r); this.reduce(r); };\n return Barrett;\n}());\n//#endregion\n//#endregion REDUCERS\n// return new, unset BigInteger\nexport function nbi() { return new BigInteger(null); }\nexport function parseBigInt(str, r) {\n return new BigInteger(str, r);\n}\n// am: Compute w_j += (x*this_i), propagate carries,\n// c is initial carry, returns final carry.\n// c < 3*dvalue, x < 2*dvalue, this_i < dvalue\n// We need to select the fastest one that works in this environment.\n// am1: use a single mult and divide to get the high bits,\n// max digit bits should be 26 because\n// max internal value = 2*dvalue^2-2*dvalue (< 2^53)\nfunction am1(i, x, w, j, c, n) {\n while (--n >= 0) {\n var v = x * this[i++] + w[j] + c;\n c = Math.floor(v / 0x4000000);\n w[j++] = v & 0x3ffffff;\n }\n return c;\n}\n// am2 avoids a big mult-and-extract completely.\n// Max digit bits should be <= 30 because we do bitwise ops\n// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)\nfunction am2(i, x, w, j, c, n) {\n var xl = x & 0x7fff, xh = x >> 15;\n while (--n >= 0) {\n var l = this[i] & 0x7fff;\n var h = this[i++] >> 15;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);\n c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);\n w[j++] = l & 0x3fffffff;\n }\n return c;\n}\n// Alternately, set max digit bits to 28 since some\n// browsers slow down when dealing with 32-bit numbers.\nfunction am3(i, x, w, j, c, n) {\n var xl = x & 0x3fff, xh = x >> 14;\n while (--n >= 0) {\n var l = this[i] & 0x3fff;\n var h = this[i++] >> 14;\n var m = xh * l + h * xl;\n l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;\n c = (l >> 28) + (m >> 14) + xh * h;\n w[j++] = l & 0xfffffff;\n }\n return c;\n}\nif (j_lm && (navigator.appName == \"Microsoft Internet Explorer\")) {\n BigInteger.prototype.am = am2;\n dbits = 30;\n}\nelse if (j_lm && (navigator.appName != \"Netscape\")) {\n BigInteger.prototype.am = am1;\n dbits = 26;\n}\nelse {\n BigInteger.prototype.am = am3;\n dbits = 28;\n}\nBigInteger.prototype.DB = dbits;\nBigInteger.prototype.DM = ((1 << dbits) - 1);\nBigInteger.prototype.DV = (1 << dbits);\nvar BI_FP = 52;\nBigInteger.prototype.FV = Math.pow(2, BI_FP);\nBigInteger.prototype.F1 = BI_FP - dbits;\nBigInteger.prototype.F2 = 2 * dbits - BI_FP;\n// Digit conversions\nvar BI_RC = new Array();\nvar rr, vv;\nrr = \"0\".charCodeAt(0);\nfor (vv = 0; vv <= 9; ++vv)\n BI_RC[rr++] = vv;\nrr = \"a\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv)\n BI_RC[rr++] = vv;\nrr = \"A\".charCodeAt(0);\nfor (vv = 10; vv < 36; ++vv)\n BI_RC[rr++] = vv;\nexport function intAt(s, i) {\n var c = BI_RC[s.charCodeAt(i)];\n return (c == null) ? -1 : c;\n}\n// return bigint initialized to value\nexport function nbv(i) { var r = nbi(); r.fromInt(i); return r; }\n// returns bit length of the integer x\nexport function nbits(x) {\n var r = 1, t;\n if ((t = x >>> 16) != 0) {\n x = t;\n r += 16;\n }\n if ((t = x >> 8) != 0) {\n x = t;\n r += 8;\n }\n if ((t = x >> 4) != 0) {\n x = t;\n r += 4;\n }\n if ((t = x >> 2) != 0) {\n x = t;\n r += 2;\n }\n if ((t = x >> 1) != 0) {\n x = t;\n r += 1;\n }\n return r;\n}\n// protected\n// public\n// \"constants\"\nBigInteger.ZERO = nbv(0);\nBigInteger.ONE = nbv(1);\n"
  796. },
  797. {
  798. "id": 1,
  799. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/util.ts",
  800. "name": "./lib/jsbn/util.ts",
  801. "index": 6,
  802. "index2": 2,
  803. "size": 1045,
  804. "cacheable": true,
  805. "built": true,
  806. "optional": false,
  807. "prefetched": false,
  808. "chunks": [
  809. 0
  810. ],
  811. "assets": [],
  812. "issuer": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/base64.ts",
  813. "issuerId": 2,
  814. "issuerName": "./lib/jsbn/base64.ts",
  815. "profile": {
  816. "factory": 156,
  817. "building": 20
  818. },
  819. "failed": false,
  820. "errors": 0,
  821. "warnings": 0,
  822. "reasons": [
  823. {
  824. "moduleId": 0,
  825. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/jsbn.ts",
  826. "module": "./lib/jsbn/jsbn.ts",
  827. "moduleName": "./lib/jsbn/jsbn.ts",
  828. "type": "harmony import",
  829. "userRequest": "./util",
  830. "loc": "5:0-80"
  831. },
  832. {
  833. "moduleId": 2,
  834. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/base64.ts",
  835. "module": "./lib/jsbn/base64.ts",
  836. "moduleName": "./lib/jsbn/base64.ts",
  837. "type": "harmony import",
  838. "userRequest": "./util",
  839. "loc": "1:0-34"
  840. }
  841. ],
  842. "usedExports": [
  843. "cbit",
  844. "int2char",
  845. "lbit",
  846. "op_and",
  847. "op_andnot",
  848. "op_or",
  849. "op_xor"
  850. ],
  851. "providedExports": [
  852. "int2char",
  853. "op_and",
  854. "op_or",
  855. "op_xor",
  856. "op_andnot",
  857. "lbit",
  858. "cbit"
  859. ],
  860. "optimizationBailout": [],
  861. "depth": 3,
  862. "source": "var BI_RM = \"0123456789abcdefghijklmnopqrstuvwxyz\";\nexport function int2char(n) {\n return BI_RM.charAt(n);\n}\n//#region BIT_OPERATIONS\n// (public) this & a\nexport function op_and(x, y) {\n return x & y;\n}\n// (public) this | a\nexport function op_or(x, y) {\n return x | y;\n}\n// (public) this ^ a\nexport function op_xor(x, y) {\n return x ^ y;\n}\n// (public) this & ~a\nexport function op_andnot(x, y) {\n return x & ~y;\n}\n// return index of lowest 1-bit in x, x < 2^31\nexport function lbit(x) {\n if (x == 0)\n return -1;\n var r = 0;\n if ((x & 0xffff) == 0) {\n x >>= 16;\n r += 16;\n }\n if ((x & 0xff) == 0) {\n x >>= 8;\n r += 8;\n }\n if ((x & 0xf) == 0) {\n x >>= 4;\n r += 4;\n }\n if ((x & 3) == 0) {\n x >>= 2;\n r += 2;\n }\n if ((x & 1) == 0)\n ++r;\n return r;\n}\n// return number of 1 bits in x\nexport function cbit(x) {\n var r = 0;\n while (x != 0) {\n x &= x - 1;\n ++r;\n }\n return r;\n}\n//#endregion BIT_OPERATIONS \n"
  863. },
  864. {
  865. "id": 2,
  866. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/base64.ts",
  867. "name": "./lib/jsbn/base64.ts",
  868. "index": 12,
  869. "index2": 10,
  870. "size": 1966,
  871. "cacheable": true,
  872. "built": true,
  873. "optional": false,
  874. "prefetched": false,
  875. "chunks": [
  876. 0
  877. ],
  878. "assets": [],
  879. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  880. "issuerId": 4,
  881. "issuerName": "./src/jsencrypt.js",
  882. "profile": {
  883. "factory": 48,
  884. "building": 789
  885. },
  886. "failed": false,
  887. "errors": 0,
  888. "warnings": 0,
  889. "reasons": [
  890. {
  891. "moduleId": 4,
  892. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  893. "module": "./src/jsencrypt.js",
  894. "moduleName": "./src/jsencrypt.js",
  895. "type": "harmony import",
  896. "userRequest": "../lib/jsbn/base64",
  897. "loc": "7:0-43"
  898. },
  899. {
  900. "moduleId": 4,
  901. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  902. "module": "./src/jsencrypt.js",
  903. "moduleName": "./src/jsencrypt.js",
  904. "type": "harmony import",
  905. "userRequest": "../lib/jsbn/base64",
  906. "loc": "8:0-44"
  907. }
  908. ],
  909. "usedExports": [
  910. "b64tohex",
  911. "hex2b64"
  912. ],
  913. "providedExports": [
  914. "hex2b64",
  915. "b64tohex",
  916. "b64toBA"
  917. ],
  918. "optimizationBailout": [],
  919. "depth": 2,
  920. "source": "import { int2char } from \"./util\";\nvar b64map = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar b64pad = \"=\";\nexport function hex2b64(h) {\n var i;\n var c;\n var ret = \"\";\n for (i = 0; i + 3 <= h.length; i += 3) {\n c = parseInt(h.substring(i, i + 3), 16);\n ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63);\n }\n if (i + 1 == h.length) {\n c = parseInt(h.substring(i, i + 1), 16);\n ret += b64map.charAt(c << 2);\n }\n else if (i + 2 == h.length) {\n c = parseInt(h.substring(i, i + 2), 16);\n ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4);\n }\n while ((ret.length & 3) > 0)\n ret += b64pad;\n return ret;\n}\n// convert a base64 string to hex\nexport function b64tohex(s) {\n var ret = \"\";\n var i;\n var k = 0; // b64 state, 0-3\n var slop;\n for (i = 0; i < s.length; ++i) {\n if (s.charAt(i) == b64pad)\n break;\n var v = b64map.indexOf(s.charAt(i));\n if (v < 0)\n continue;\n if (k == 0) {\n ret += int2char(v >> 2);\n slop = v & 3;\n k = 1;\n }\n else if (k == 1) {\n ret += int2char((slop << 2) | (v >> 4));\n slop = v & 0xf;\n k = 2;\n }\n else if (k == 2) {\n ret += int2char(slop);\n ret += int2char(v >> 2);\n slop = v & 3;\n k = 3;\n }\n else {\n ret += int2char((slop << 2) | (v >> 4));\n ret += int2char(v & 0xf);\n k = 0;\n }\n }\n if (k == 1)\n ret += int2char(slop << 2);\n return ret;\n}\n// convert a base64 string to a byte/number array\nexport function b64toBA(s) {\n //piggyback on b64tohex for now, optimize later\n var h = b64tohex(s);\n var i;\n var a = new Array();\n for (i = 0; 2 * i < h.length; ++i) {\n a[i] = parseInt(h.substring(2 * i, 2 * i + 2), 16);\n }\n return a;\n}\n"
  921. },
  922. {
  923. "id": 3,
  924. "identifier": "/home/corax/source/jsencrypt/test/test.rsa.js",
  925. "name": "./test/test.rsa.js",
  926. "index": 0,
  927. "index2": 12,
  928. "size": 12539,
  929. "cacheable": true,
  930. "built": true,
  931. "optional": false,
  932. "prefetched": false,
  933. "chunks": [
  934. 0
  935. ],
  936. "assets": [],
  937. "issuer": null,
  938. "issuerId": null,
  939. "issuerName": null,
  940. "profile": {
  941. "factory": 16,
  942. "building": 17
  943. },
  944. "failed": false,
  945. "errors": 0,
  946. "warnings": 0,
  947. "reasons": [],
  948. "usedExports": true,
  949. "providedExports": [],
  950. "optimizationBailout": [],
  951. "depth": 0,
  952. "source": "import {JSEncrypt} from \"../src/jsencrypt\";\n\nvar keySizes = [128, 256, 512, 1024, 2048];\n\nvar pbkeys = [\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MCwwDQYJKoZIhvcNAQEBBQADGwAwGAIRAMfE82X6tlpNK7Bxbhg6nEECAwEAAQ==\\n\" +\n \"-----END PUBLIC KEY-----\",\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MDwwDQYJKoZIhvcNAQEBBQADKwAwKAIhAMLw0mRGv5KF+P0LsgNvfrM5AJdVBWqr\\n\" +\n \"Q6Bf2gES5gwPAgMBAAE=\\n\" +\n \"-----END PUBLIC KEY-----\",\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKEpu21RDTXxEly55HdkVV9SlFL3Hgpl\\n\" +\n \"i6+IohAsnaqFnApsKi1R7fAd3tBLmeHV2tlxYIogtxpzfpcc+QBVDx8CAwEAAQ==\\n\" +\n \"-----END PUBLIC KEY-----\",\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5LO5xVlO9g4PL1xdWudnihIAP\\n\" +\n \"bMsixr396bIbBIwKBul98UWQ3UALbqByq2bXVuoIbl48UokxOVstenGCyyo026NF\\n\" +\n \"h3Fg6Cnvj9ptvbmqk2i3eTOBrt+e26Z1sepsnQL5OojiVIbrWwS6v1pFCXpnnLLv\\n\" +\n \"yy6GPt/kftbhazH3oQIDAQAB\\n\" +\n \"-----END PUBLIC KEY-----\",\n \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtKrsFSnzYl19m5wTwYdu\\n\" +\n \"/r1UVZJV+zkAFud6+XTInAy8HbCR9n59H9+54P+Af/fUE6rvEPc4H09Z63vQzIGM\\n\" +\n \"iL6GlqzMmptv/KRDIhj7Mk3MXomvEVfUsXrz5IpO0lf6NSeGhz4PGZUkHZ30VRx3\\n\" +\n \"Jd/a0KIhgftZHxzmMsh8iB/n781B18pCP2eOPTF+5gRCaW+0fVPBlb/mBlg8MJrd\\n\" +\n \"ScGCAReQ9NfTq8slJ0aO1NWaaRRANPQcCMljnTIK1ssyXBaSHKfoWeGx141mWMRx\\n\" +\n \"/LxyZ13Zc3lqgmICiKFqMrQl5UeV1IUXYpj5hO9f60LGpZVHDqqo/JdF3+VAheaf\\n\" +\n \"QwIDAQAB\\n\" +\n \"-----END PUBLIC KEY-----\"\n];\n\nvar prkeys = [\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MGMCAQACEQDHxPNl+rZaTSuwcW4YOpxBAgMBAAECEQCqk6mhsmpyv17fK1dPeD3h\\n\" +\n \"AgkA9Lo1aGRom0sCCQDQ+JpqE6KDIwIJAKstyIfBnA3rAggOsWwqCTdkAQIIOP95\\n\" +\n \"RV9y2iQ=\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\",\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MIGqAgEAAiEAwvDSZEa/koX4/QuyA29+szkAl1UFaqtDoF/aARLmDA8CAwEAAQIh\\n\" +\n \"AME2Z5Ez/hR/7PUBboKxM2U7hSaavytvocBdQjLvOUWhAhEA8HgiLHRk9KjJ2hp0\\n\" +\n \"5q3BfQIRAM+H7dYUXRnKXjYoqiKueXsCEGnaaCirf/lXB6vzs3wMBr0CEHT2Xwzw\\n\" +\n \"nSgT7dUIRhsVylECEFQRGFtZcKRmL8lqTBwECWI=\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\",\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MIIBOQIBAAJBAKEpu21RDTXxEly55HdkVV9SlFL3Hgpli6+IohAsnaqFnApsKi1R\\n\" +\n \"7fAd3tBLmeHV2tlxYIogtxpzfpcc+QBVDx8CAwEAAQJAFn0VS07JEiLelhPWfpaA\\n\" +\n \"lzmVuvICvh6nXEormygupBGiIPSXfIsTFid26yxt9wu4JHeRF0lq+Ozo55XpBQED\\n\" +\n \"4QIhAM0E7ikuEa2bDsR2hQJhIz3SvzzyhE5dJcqFjRtKtMQvAiEAyT0C0gUyqCdN\\n\" +\n \"YuRON1T7FUffarMdQXR+8tgRkhoCeBECID+ZKfAoVF+QXDJhub0VOQNyntRfPt+4\\n\" +\n \"UYLTjwRKVm0NAiBuOCtuSoiHTxd0naU1aycmbboxn67bZeoOKkfdZL+LcQIgK6Xh\\n\" +\n \"1wb9I/sNYv9ByJEGBNJRwtUEZrk5babLEdkUq90=\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\",\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MIICXgIBAAKBgQC5LO5xVlO9g4PL1xdWudnihIAPbMsixr396bIbBIwKBul98UWQ\\n\" +\n \"3UALbqByq2bXVuoIbl48UokxOVstenGCyyo026NFh3Fg6Cnvj9ptvbmqk2i3eTOB\\n\" +\n \"rt+e26Z1sepsnQL5OojiVIbrWwS6v1pFCXpnnLLvyy6GPt/kftbhazH3oQIDAQAB\\n\" +\n \"AoGAA+EiGbPCS10e/L1D2uhH3UwDVs9jrhXV0yT7Oz+sI2WjrKTKXU+VUOf/aoeW\\n\" +\n \"vvouKwEM7lyYTTSzaU+AY0oYVzv7HN9hWoVwi0NoPpd4V1RFfFb4+4DmXh+NZS7E\\n\" +\n \"DX9+WY435Yc9Qj7uHoc8EoRk3QfWaZTXd69b/9tS4Yy/tnECQQDxHsSe7Qxd+6tf\\n\" +\n \"/f4eO+bENCxIMbPU8GPWQCvq9eT9Av2I0LTTchmlhG1TSatq62zq+Unef8M/IOBs\\n\" +\n \"j5z3issdAkEAxJpYiuAVXulViUOLdS3QX72owIQLxpFBAKQ9cPTafqc47ms4Swy2\\n\" +\n \"FCa4MZfTJXrDX5pur+PNeP/ce6xZN5DzVQJBAJI1kgy8uU8UGKswnTNAJ4K6EFAG\\n\" +\n \"s4Ff82orp3XmfWBeu9aGl9/PxHV1g8WJWoSPFZC2cXCWEJLrIKszun7wjpECQQCs\\n\" +\n \"Z+mjh1RWUepHn+rozE9B1jDo+iLVc8V8CYszxhThIkWjlnTcI358d2PpYYmxAVHZ\\n\" +\n \"QbU1G2CxbjZsYbwvJTatAkEAspmMlIyKWgrQkLJ4rbPespMJCGe6VYharl1Qc5CF\\n\" +\n \"/2SgKSCuLfhA/Cur0nO3dxt6XJijk/r3+j+8L/m+wqud+A==\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\",\n \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"MIIEpAIBAAKCAQEAtKrsFSnzYl19m5wTwYdu/r1UVZJV+zkAFud6+XTInAy8HbCR\\n\" +\n \"9n59H9+54P+Af/fUE6rvEPc4H09Z63vQzIGMiL6GlqzMmptv/KRDIhj7Mk3MXomv\\n\" +\n \"EVfUsXrz5IpO0lf6NSeGhz4PGZUkHZ30VRx3Jd/a0KIhgftZHxzmMsh8iB/n781B\\n\" +\n \"18pCP2eOPTF+5gRCaW+0fVPBlb/mBlg8MJrdScGCAReQ9NfTq8slJ0aO1NWaaRRA\\n\" +\n \"NPQcCMljnTIK1ssyXBaSHKfoWeGx141mWMRx/LxyZ13Zc3lqgmICiKFqMrQl5UeV\\n\" +\n \"1IUXYpj5hO9f60LGpZVHDqqo/JdF3+VAheafQwIDAQABAoIBAQCS/++PWM7bXk5x\\n\" +\n \"apD4ioXZZ5tS9PpYqoxUFoyMpGUF86asUZqyAUE1ygen9rxLYw5/4jkaiMx1TU9Q\\n\" +\n \"tzGw9Eewi7Veq8LemVKJMe4dtE3PJFYBJe34IorAzdXcQlzX8RV4YmynZetLWXpF\\n\" +\n \"Ttwa1Ept2rJjx0eURzrAgfcbot0Qs+c8bB0qnGC67PoL3DyYg8vX5PDmiiA2VZMG\\n\" +\n \"EylVQS09toJn5ReaKCtjxJb/XFQjBeSP0xLjvZZftGDJgpwmmi7Sy/zAZoF4+7wf\\n\" +\n \"8nihXk4ZfYC+beBj5U9pcUcs6LdNobUofWFRLSjueseRQBI0sKUslr3Ye4zhkrWM\\n\" +\n \"CDnsSxBhAoGBANi0spS/Mc6xH1189mR7dJV9gy7KkGxheAstwCJr7WzbXqglhFm2\\n\" +\n \"SvY9hrpE9OYWir5EqX6jM6VipSobTn0RpCsYUC/J1ISMyEA5UkPLP4jHQw6UUDN2\\n\" +\n \"1fNAXffEyuju5ShP9Mk2unZstlUweKlFF7d1k7YAzWDIKnF6bOL06YC9AoGBANVt\\n\" +\n \"XM4OH0zw8M97W04WwYGoa5s1Y5JYc4RMV200cr3iONVfLZgSP8thP1qPuoMM3OJg\\n\" +\n \"Bqe6MRmo/VXhgVvpke04ZJ83LSz/SoqfVRNwxuCHqp3beJQPxrAp1d/L7Ey7f41U\\n\" +\n \"QBE8pibFb8bbgOTUW5iyZbg7lLS8nghsn+BqYp//AoGBAJO/574o+YGOG+92wttR\\n\" +\n \"nPRLhgSCEaQDdIBSqhwN7+v3SXtlUO6FrmhjHJelaj/yAJinYdS42v6Y2jlyMrpt\\n\" +\n \"K7xCMHHUrzPMdL/tFRyp1+Ce0yZ+kov0Kv1V1nuWzi2wq8cndKM30Dvr9QjyKmJm\\n\" +\n \"fDwWSyadN2oUL3P9X34CM64VAoGAbajAW1skN/tAL8r48dl9WWo4x8mZvJLX36z9\\n\" +\n \"6q1dGzVF8FPz8EPIJW51B8n7keQlBedC5CElo0KRz/OK7LfI87La+Hd4LbuKCEmv\\n\" +\n \"g8qZVLpALtWaUbD9bHxCWLfFVPOtqOcV+AVKdXdSZEFaK7j0yzM2Un/Ce07CgB+X\\n\" +\n \"0c23mO8CgYAOqnUR/uPIzkvj/eIbO7pnhHoKZ4Ji2TrIBqjskzaFd0Tox9i3SWKa\\n\" +\n \"cRdQciRIT1wkMdywnHFrJT1rwYXxcgfQXAku/vnYqAfvIzY7TyoL3pWX55O0Zrs7\\n\" +\n \"05R9mA5TZmzUU9m/PzUrRjasOGYSKkCz4Y2qGlrKI3H0aE+p+R56kQ==\\n\" +\n \"-----END RSA PRIVATE KEY-----\\n\"\n];\n\nkeySizes.forEach(function(keySize, index){\n \n var jse = new JSEncrypt({default_key_size:keySize});\n var openssl_public_key = pbkeys[index];\n var openssl_private_key = prkeys[index];\n \n describe('JSEncrypt - '+keySize+' bit', function(){\n //this.timeout(0); //Timout for test cases, zero means infinite. Needed for key sizes > 1024\n \n describe('#getKey()', function(){\n \n it('should be '+keySize+' bit long', function () {\n \n var key = jse.getKey();\n var length = key.n.bitLength();\n length = length%2===0 ? length: length+1;\n expect(length).to.equal(keySize);\n\n });\n \n });\n\n describe('#encrypt() | #decrypt()', function(){\n \n //Tom Wu's RSA Object use paddingpkcs #1, type 2\n var maxLength = (((jse.getKey().n.bitLength()+7)>>3)-11);\n var maxLengthBit = maxLength << 3;\n \n it('should encrypt/decrypt up to '+maxLengthBit+' bit', function () {\n\n var test = [];\n for (var i=0; i<maxLength;i++)\n test.push('a');\n test = test.join('');\n\n var encrypted = jse.encrypt(test);\n expect(encrypted).to.be.ok();\n\n var decrypted = jse.decrypt(encrypted);\n expect(decrypted).to.be(test);\n\n });\n\n it('should fail to encrypt more than '+maxLengthBit+' bit', function(){\n \n var test = [];\n for (var i=0; i<(maxLength+1);i++)\n test.push('a');\n test = test.join('');\n\n var encrypted = jse.encrypt(test);\n expect(encrypted).to.not.be.ok();\n \n });\n\n });\n \n describe('#getPublicKey()', function(){\n \n var pkey = jse.getPublicKey();\n \n it('should be a non-empty string', function(){\n \n expect(pkey).to.be.a('string');\n expect(pkey).to.not.be.empty();\n \n });\n \n it('should contain public header and footer and be wrapped at 64 chars', function(){\n //For small bit keys, the public key may contain only one line\n var regex = /-----BEGIN PUBLIC KEY-----\\n((.{64}\\n)+(.{1,64}\\n)?)|(.{1,64}\\n)-----END PUBLIC KEY-----/;\n expect(pkey).to.match(regex);\n\n });\n \n });\n \n describe('#getPrivateKey()', function(){\n \n var pkey = jse.getPrivateKey();\n \n it('should be a non-empty string', function(){\n \n expect(pkey).to.be.a('string');\n expect(pkey).to.not.be.empty();\n \n });\n \n it('should contain private header and footer and be wrapped at 64 chars', function(){\n \n var regex = /-----BEGIN RSA PRIVATE KEY-----\\n(.{64}\\n)+(.{1,64}\\n)?-----END RSA PRIVATE KEY-----/;\n expect(pkey).to.match(regex);\n \n });\n \n });\n \n describe('#getPublicKeyB64()', function(){\n \n var pkey = jse.getPublicKeyB64();\n \n it('should be a non-empty string', function(){\n \n expect(pkey).to.be.a('string');\n expect(pkey).to.not.be.empty();\n \n });\n \n it('should not contain public header and footer,one line, base64 encoded', function(){\n \n //regex to match base64 encoded string, reference:\n //http://stackoverflow.com/a/5885097/1446321\n var regex = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/;\n expect(pkey).to.match(regex);\n \n });\n \n });\n \n describe('#getPrivateKeyB64()', function(){\n \n var pkey = jse.getPrivateKeyB64();\n \n it('should be a non-empty string', function(){\n \n expect(pkey).to.be.a('string');\n expect(pkey).to.not.be.empty();\n \n });\n \n it('should not contain private header and footer,one line, base64 encoded', function(){\n \n //regex to match base64 encoded string, reference:\n //http://stackoverflow.com/a/5885097/1446321\n var regex = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/;\n expect(pkey).to.match(regex);\n \n });\n \n });\n \n describe('#setPrivateKey()', function(){\n \n var tmp = new JSEncrypt();\n tmp.setPrivateKey(openssl_private_key);\n \n it('should correctly set the private key parameters',function(){\n \n var params = ['n', 'e', 'd', 'p', 'q', 'dmp1', 'dmq1', 'coeff'];\n expect(tmp.key).to.be.ok();\n expect(tmp.key).to.have.keys(params);\n params.forEach(function(value,index){\n expect(tmp.key[value]).to.be.ok();\n });\n \n });\n \n it('should both encrypt and decrypt',function(){\n \n var test = 'test';\n var enc = tmp.encrypt(test);\n expect(enc).to.be.ok();\n var dec = tmp.decrypt(enc);\n expect(dec).to.be(test);\n \n });\n \n });\n \n describe('#setPublicKey()', function(){\n \n var tmp = new JSEncrypt();\n tmp.setPublicKey(openssl_public_key);\n \n it('should correctly set the public key parameters',function(){\n \n var pub_params = ['n', 'e'];\n var priv_params = ['d', 'p', 'q', 'dmp1', 'dmq1', 'coeff'];\n expect(tmp.key).to.be.ok();\n expect(tmp.key).to.have.keys(pub_params);\n pub_params.forEach(function(value,index){\n expect(tmp.key[value]).to.be.ok();\n });\n priv_params.forEach(function(value,index){\n expect(tmp.key[value]).to.not.be.ok();\n });\n \n });\n \n it('should only encrypt',function(){\n \n var test = 'test';\n var enc = tmp.encrypt(test);\n var dec = tmp.decrypt(enc);\n expect(enc).to.be.ok();\n expect(dec).to.not.be.ok();\n \n });\n \n });\n \n });\n \n});\n\n"
  953. },
  954. {
  955. "id": 4,
  956. "identifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  957. "name": "./src/jsencrypt.js",
  958. "index": 1,
  959. "index2": 11,
  960. "size": 16124,
  961. "cacheable": true,
  962. "built": true,
  963. "optional": false,
  964. "prefetched": false,
  965. "chunks": [
  966. 0
  967. ],
  968. "assets": [],
  969. "issuer": "/home/corax/source/jsencrypt/test/test.rsa.js",
  970. "issuerId": 3,
  971. "issuerName": "./test/test.rsa.js",
  972. "profile": {
  973. "factory": 2,
  974. "building": 11
  975. },
  976. "failed": false,
  977. "errors": 0,
  978. "warnings": 0,
  979. "reasons": [
  980. {
  981. "moduleId": 3,
  982. "moduleIdentifier": "/home/corax/source/jsencrypt/test/test.rsa.js",
  983. "module": "./test/test.rsa.js",
  984. "moduleName": "./test/test.rsa.js",
  985. "type": "harmony import",
  986. "userRequest": "../src/jsencrypt",
  987. "loc": "1:0-43"
  988. }
  989. ],
  990. "usedExports": [
  991. "JSEncrypt"
  992. ],
  993. "providedExports": [
  994. "JSEncrypt"
  995. ],
  996. "optimizationBailout": [],
  997. "depth": 1,
  998. "source": "import {ASN1} from \"../lib/asn1js/asn1\";\nimport {RSAKey} from \"../lib/jsbn/rsa\";\nimport {Base64} from \"../lib/asn1js/base64\";\nimport {Hex} from \"../lib/asn1js/hex\";\nimport {parseBigInt} from \"../lib/jsbn/jsbn\";\nimport {KJUR} from \"../lib/jsrsasign/asn1-1.0\";\nimport {hex2b64} from \"../lib/jsbn/base64\";\nimport {b64tohex} from \"../lib/jsbn/base64\";\n\n/**\n * Retrieve the hexadecimal value (as a string) of the current ASN.1 element\n * @returns {string}\n * @public\n */\nASN1.prototype.getHexStringValue = function () {\n var hexString = this.toHexString();\n var offset = this.header * 2;\n var length = this.length * 2;\n return hexString.substr(offset, length);\n};\n\n/**\n * Method to parse a pem encoded string containing both a public or private key.\n * The method will translate the pem encoded string in a der encoded string and\n * will parse private key and public key parameters. This method accepts public key\n * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).\n *\n * @todo Check how many rsa formats use the same format of pkcs #1.\n *\n * The format is defined as:\n * PublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * PublicKey BIT STRING\n * }\n * Where AlgorithmIdentifier is:\n * AlgorithmIdentifier ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\n * }\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n * it's possible to examine the structure of the keys obtained from openssl using\n * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/\n * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer\n * @private\n */\nRSAKey.prototype.parseKey = function (pem) {\n try {\n var modulus = 0;\n var public_exponent = 0;\n var reHex = /^\\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\\s*)+$/;\n var der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);\n var asn1 = ASN1.decode(der);\n\n //Fixes a bug with OpenSSL 1.0+ private keys\n if(asn1.sub.length === 3){\n asn1 = asn1.sub[2].sub[0];\n }\n if (asn1.sub.length === 9) {\n\n // Parse the private key.\n modulus = asn1.sub[1].getHexStringValue(); //bigint\n this.n = parseBigInt(modulus, 16);\n\n public_exponent = asn1.sub[2].getHexStringValue(); //int\n this.e = parseInt(public_exponent, 16);\n\n var private_exponent = asn1.sub[3].getHexStringValue(); //bigint\n this.d = parseBigInt(private_exponent, 16);\n\n var prime1 = asn1.sub[4].getHexStringValue(); //bigint\n this.p = parseBigInt(prime1, 16);\n\n var prime2 = asn1.sub[5].getHexStringValue(); //bigint\n this.q = parseBigInt(prime2, 16);\n\n var exponent1 = asn1.sub[6].getHexStringValue(); //bigint\n this.dmp1 = parseBigInt(exponent1, 16);\n\n var exponent2 = asn1.sub[7].getHexStringValue(); //bigint\n this.dmq1 = parseBigInt(exponent2, 16);\n\n var coefficient = asn1.sub[8].getHexStringValue(); //bigint\n this.coeff = parseBigInt(coefficient, 16);\n\n }\n else if (asn1.sub.length === 2) {\n\n // Parse the public key.\n var bit_string = asn1.sub[1];\n var sequence = bit_string.sub[0];\n\n modulus = sequence.sub[0].getHexStringValue();\n this.n = parseBigInt(modulus, 16);\n public_exponent = sequence.sub[1].getHexStringValue();\n this.e = parseInt(public_exponent, 16);\n\n }\n else {\n return false;\n }\n return true;\n }\n catch (ex) {\n return false;\n }\n};\n\n/**\n * Translate rsa parameters in a hex encoded string representing the rsa key.\n *\n * The translation follow the ASN.1 notation :\n * RSAPrivateKey ::= SEQUENCE {\n * version Version,\n * modulus INTEGER, -- n\n * publicExponent INTEGER, -- e\n * privateExponent INTEGER, -- d\n * prime1 INTEGER, -- p\n * prime2 INTEGER, -- q\n * exponent1 INTEGER, -- d mod (p1)\n * exponent2 INTEGER, -- d mod (q-1)\n * coefficient INTEGER, -- (inverse of q) mod p\n * }\n * @returns {string} DER Encoded String representing the rsa private key\n * @private\n */\nRSAKey.prototype.getPrivateBaseKey = function () {\n var options = {\n 'array': [\n new KJUR.asn1.DERInteger({'int': 0}),\n new KJUR.asn1.DERInteger({'bigint': this.n}),\n new KJUR.asn1.DERInteger({'int': this.e}),\n new KJUR.asn1.DERInteger({'bigint': this.d}),\n new KJUR.asn1.DERInteger({'bigint': this.p}),\n new KJUR.asn1.DERInteger({'bigint': this.q}),\n new KJUR.asn1.DERInteger({'bigint': this.dmp1}),\n new KJUR.asn1.DERInteger({'bigint': this.dmq1}),\n new KJUR.asn1.DERInteger({'bigint': this.coeff})\n ]\n };\n var seq = new KJUR.asn1.DERSequence(options);\n return seq.getEncodedHex();\n};\n\n/**\n * base64 (pem) encoded version of the DER encoded representation\n * @returns {string} pem encoded representation without header and footer\n * @public\n */\nRSAKey.prototype.getPrivateBaseKeyB64 = function () {\n return hex2b64(this.getPrivateBaseKey());\n};\n\n/**\n * Translate rsa parameters in a hex encoded string representing the rsa public key.\n * The representation follow the ASN.1 notation :\n * PublicKeyInfo ::= SEQUENCE {\n * algorithm AlgorithmIdentifier,\n * PublicKey BIT STRING\n * }\n * Where AlgorithmIdentifier is:\n * AlgorithmIdentifier ::= SEQUENCE {\n * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm\n * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)\n * }\n * and PublicKey is a SEQUENCE encapsulated in a BIT STRING\n * RSAPublicKey ::= SEQUENCE {\n * modulus INTEGER, -- n\n * publicExponent INTEGER -- e\n * }\n * @returns {string} DER Encoded String representing the rsa public key\n * @private\n */\nRSAKey.prototype.getPublicBaseKey = function () {\n var options = {\n 'array': [\n new KJUR.asn1.DERObjectIdentifier({'oid': '1.2.840.113549.1.1.1'}), //RSA Encryption pkcs #1 oid\n new KJUR.asn1.DERNull()\n ]\n };\n var first_sequence = new KJUR.asn1.DERSequence(options);\n\n options = {\n 'array': [\n new KJUR.asn1.DERInteger({'bigint': this.n}),\n new KJUR.asn1.DERInteger({'int': this.e})\n ]\n };\n var second_sequence = new KJUR.asn1.DERSequence(options);\n\n options = {\n 'hex': '00' + second_sequence.getEncodedHex()\n };\n var bit_string = new KJUR.asn1.DERBitString(options);\n\n options = {\n 'array': [\n first_sequence,\n bit_string\n ]\n };\n var seq = new KJUR.asn1.DERSequence(options);\n return seq.getEncodedHex();\n};\n\n/**\n * base64 (pem) encoded version of the DER encoded representation\n * @returns {string} pem encoded representation without header and footer\n * @public\n */\nRSAKey.prototype.getPublicBaseKeyB64 = function () {\n return hex2b64(this.getPublicBaseKey());\n};\n\n/**\n * wrap the string in block of width chars. The default value for rsa keys is 64\n * characters.\n * @param {string} str the pem encoded string without header and footer\n * @param {Number} [width=64] - the length the string has to be wrapped at\n * @returns {string}\n * @private\n */\nRSAKey.prototype.wordwrap = function (str, width) {\n width = width || 64;\n if (!str) {\n return str;\n }\n var regex = '(.{1,' + width + '})( +|$\\n?)|(.{1,' + width + '})';\n return str.match(RegExp(regex, 'g')).join('\\n');\n};\n\n/**\n * Retrieve the pem encoded private key\n * @returns {string} the pem encoded private key with header/footer\n * @public\n */\nRSAKey.prototype.getPrivateKey = function () {\n var key = \"-----BEGIN RSA PRIVATE KEY-----\\n\";\n key += this.wordwrap(this.getPrivateBaseKeyB64()) + \"\\n\";\n key += \"-----END RSA PRIVATE KEY-----\";\n return key;\n};\n\n/**\n * Retrieve the pem encoded public key\n * @returns {string} the pem encoded public key with header/footer\n * @public\n */\nRSAKey.prototype.getPublicKey = function () {\n var key = \"-----BEGIN PUBLIC KEY-----\\n\";\n key += this.wordwrap(this.getPublicBaseKeyB64()) + \"\\n\";\n key += \"-----END PUBLIC KEY-----\";\n return key;\n};\n\n/**\n * Check if the object contains the necessary parameters to populate the rsa modulus\n * and public exponent parameters.\n * @param {Object} [obj={}] - An object that may contain the two public key\n * parameters\n * @returns {boolean} true if the object contains both the modulus and the public exponent\n * properties (n and e)\n * @todo check for types of n and e. N should be a parseable bigInt object, E should\n * be a parseable integer number\n * @private\n */\nRSAKey.prototype.hasPublicKeyProperty = function (obj) {\n obj = obj || {};\n return (\n obj.hasOwnProperty('n') &&\n obj.hasOwnProperty('e')\n );\n};\n\n/**\n * Check if the object contains ALL the parameters of an RSA key.\n * @param {Object} [obj={}] - An object that may contain nine rsa key\n * parameters\n * @returns {boolean} true if the object contains all the parameters needed\n * @todo check for types of the parameters all the parameters but the public exponent\n * should be parseable bigint objects, the public exponent should be a parseable integer number\n * @private\n */\nRSAKey.prototype.hasPrivateKeyProperty = function (obj) {\n obj = obj || {};\n return (\n obj.hasOwnProperty('n') &&\n obj.hasOwnProperty('e') &&\n obj.hasOwnProperty('d') &&\n obj.hasOwnProperty('p') &&\n obj.hasOwnProperty('q') &&\n obj.hasOwnProperty('dmp1') &&\n obj.hasOwnProperty('dmq1') &&\n obj.hasOwnProperty('coeff')\n );\n};\n\n/**\n * Parse the properties of obj in the current rsa object. Obj should AT LEAST\n * include the modulus and public exponent (n, e) parameters.\n * @param {Object} obj - the object containing rsa parameters\n * @private\n */\nRSAKey.prototype.parsePropertiesFrom = function (obj) {\n this.n = obj.n;\n this.e = obj.e;\n\n if (obj.hasOwnProperty('d')) {\n this.d = obj.d;\n this.p = obj.p;\n this.q = obj.q;\n this.dmp1 = obj.dmp1;\n this.dmq1 = obj.dmq1;\n this.coeff = obj.coeff;\n }\n};\n\n/**\n * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.\n * This object is just a decorator for parsing the key parameter\n * @param {string|Object} key - The key in string format, or an object containing\n * the parameters needed to build a RSAKey object.\n * @constructor\n */\nclass JSEncryptRSAKey extends RSAKey {\n constructor(key) {\n super();\n // Call the super constructor.\n // RSAKey.call(this);\n // If a key key was provided.\n if (key) {\n // If this is a string...\n if (typeof key === 'string') {\n this.parseKey(key);\n }\n else if (\n this.hasPrivateKeyProperty(key) ||\n this.hasPublicKeyProperty(key)\n ) {\n // Set the values for the key.\n this.parsePropertiesFrom(key);\n }\n }\n }\n}\n\n// Derive from RSAKey.\n// JSEncryptRSAKey.prototype = new RSAKey();\n\n// Reset the contructor.\n// JSEncryptRSAKey.prototype.constructor = JSEncryptRSAKey;\n\n\n/**\n *\n * @param {Object} [options = {}] - An object to customize JSEncrypt behaviour\n * possible parameters are:\n * - default_key_size {number} default: 1024 the key size in bit\n * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent\n * - log {boolean} default: false whether log warn/error or not\n * @constructor\n */\nexport class JSEncrypt {\n constructor(options) {\n options = options || {};\n this.default_key_size = parseInt(options.default_key_size) || 1024;\n this.default_public_exponent = options.default_public_exponent || '010001'; //65537 default openssl public exponent for rsa key type\n this.log = options.log || false;\n // The private and public key.\n this.key = null;\n };\n}\n\n/**\n * Method to set the rsa key parameter (one method is enough to set both the public\n * and the private key, since the private key contains the public key paramenters)\n * Log a warning if logs are enabled\n * @param {Object|string} key the pem encoded string or an object (with or without header/footer)\n * @public\n */\nJSEncrypt.prototype.setKey = function (key) {\n if (this.log && this.key) {\n console.warn('A key was already set, overriding existing.');\n }\n this.key = new JSEncryptRSAKey(key);\n};\n\n/**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\nJSEncrypt.prototype.setPrivateKey = function (privkey) {\n // Create the key.\n this.setKey(privkey);\n};\n\n/**\n * Proxy method for setKey, for api compatibility\n * @see setKey\n * @public\n */\nJSEncrypt.prototype.setPublicKey = function (pubkey) {\n // Sets the public key.\n this.setKey(pubkey);\n};\n\n/**\n * Proxy method for RSAKey object's decrypt, decrypt the string using the private\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} string base64 encoded crypted string to decrypt\n * @return {string} the decrypted string\n * @public\n */\nJSEncrypt.prototype.decrypt = function (string) {\n // Return the decrypted string.\n try {\n return this.getKey().decrypt(b64tohex(string));\n }\n catch (ex) {\n return false;\n }\n};\n\n/**\n * Proxy method for RSAKey object's encrypt, encrypt the string using the public\n * components of the rsa key object. Note that if the object was not set will be created\n * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor\n * @param {string} string the string to encrypt\n * @return {string} the encrypted string encoded in base64\n * @public\n */\nJSEncrypt.prototype.encrypt = function (string) {\n // Return the encrypted string.\n try {\n return hex2b64(this.getKey().encrypt(string));\n }\n catch (ex) {\n return false;\n }\n};\n\n/**\n * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object\n * will be created and returned\n * @param {callback} [cb] the callback to be called if we want the key to be generated\n * in an async fashion\n * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object\n * @public\n */\nJSEncrypt.prototype.getKey = function (cb) {\n // Only create new if it does not exist.\n if (!this.key) {\n // Get a new private key.\n this.key = new JSEncryptRSAKey();\n if (cb && {}.toString.call(cb) === '[object Function]') {\n this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);\n return;\n }\n // Generate the key.\n this.key.generate(this.default_key_size, this.default_public_exponent);\n }\n return this.key;\n};\n\n/**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITH header and footer\n * @public\n */\nJSEncrypt.prototype.getPrivateKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateKey();\n};\n\n/**\n * Returns the pem encoded representation of the private key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the private key WITHOUT header and footer\n * @public\n */\nJSEncrypt.prototype.getPrivateKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPrivateBaseKeyB64();\n};\n\n\n/**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITH header and footer\n * @public\n */\nJSEncrypt.prototype.getPublicKey = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicKey();\n};\n\n/**\n * Returns the pem encoded representation of the public key\n * If the key doesn't exists a new key will be created\n * @returns {string} pem encoded representation of the public key WITHOUT header and footer\n * @public\n */\nJSEncrypt.prototype.getPublicKeyB64 = function () {\n // Return the private representation of this key.\n return this.getKey().getPublicBaseKeyB64();\n};\n\n"
  999. },
  1000. {
  1001. "id": 5,
  1002. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/asn1.ts",
  1003. "name": "./lib/asn1js/asn1.ts",
  1004. "index": 2,
  1005. "index2": 1,
  1006. "size": 19813,
  1007. "cacheable": true,
  1008. "built": true,
  1009. "optional": false,
  1010. "prefetched": false,
  1011. "chunks": [
  1012. 0
  1013. ],
  1014. "assets": [],
  1015. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1016. "issuerId": 4,
  1017. "issuerName": "./src/jsencrypt.js",
  1018. "profile": {
  1019. "factory": 33,
  1020. "building": 707
  1021. },
  1022. "failed": false,
  1023. "errors": 0,
  1024. "warnings": 0,
  1025. "reasons": [
  1026. {
  1027. "moduleId": 4,
  1028. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1029. "module": "./src/jsencrypt.js",
  1030. "moduleName": "./src/jsencrypt.js",
  1031. "type": "harmony import",
  1032. "userRequest": "../lib/asn1js/asn1",
  1033. "loc": "1:0-40"
  1034. }
  1035. ],
  1036. "usedExports": [
  1037. "ASN1"
  1038. ],
  1039. "providedExports": [
  1040. "Stream",
  1041. "ASN1"
  1042. ],
  1043. "optimizationBailout": [],
  1044. "depth": 2,
  1045. "source": "// ASN.1 JavaScript decoder\n// Copyright (c) 2008-2014 Lapo Luchini <lapo@lapo.it>\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\n/*global oids */\nimport { Int10 } from \"./int10\";\nvar ellipsis = \"\\u2026\";\nvar reTimeS = /^(\\d\\d)(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])([01]\\d|2[0-3])(?:([0-5]\\d)(?:([0-5]\\d)(?:[.,](\\d{1,3}))?)?)?(Z|[-+](?:[0]\\d|1[0-2])([0-5]\\d)?)?$/;\nvar reTimeL = /^(\\d\\d\\d\\d)(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])([01]\\d|2[0-3])(?:([0-5]\\d)(?:([0-5]\\d)(?:[.,](\\d{1,3}))?)?)?(Z|[-+](?:[0]\\d|1[0-2])([0-5]\\d)?)?$/;\nfunction stringCut(str, len) {\n if (str.length > len) {\n str = str.substring(0, len) + ellipsis;\n }\n return str;\n}\nvar Stream = /** @class */ (function () {\n function Stream(enc, pos) {\n this.hexDigits = \"0123456789ABCDEF\";\n if (enc instanceof Stream) {\n this.enc = enc.enc;\n this.pos = enc.pos;\n }\n else {\n // enc should be an array or a binary string\n this.enc = enc;\n this.pos = pos;\n }\n }\n Stream.prototype.get = function (pos) {\n if (pos === undefined) {\n pos = this.pos++;\n }\n if (pos >= this.enc.length) {\n throw new Error(\"Requesting byte offset \" + pos + \" on a stream of length \" + this.enc.length);\n }\n return (\"string\" === typeof this.enc) ? this.enc.charCodeAt(pos) : this.enc[pos];\n };\n Stream.prototype.hexByte = function (b) {\n return this.hexDigits.charAt((b >> 4) & 0xF) + this.hexDigits.charAt(b & 0xF);\n };\n Stream.prototype.hexDump = function (start, end, raw) {\n var s = \"\";\n for (var i = start; i < end; ++i) {\n s += this.hexByte(this.get(i));\n if (raw !== true) {\n switch (i & 0xF) {\n case 0x7:\n s += \" \";\n break;\n case 0xF:\n s += \"\\n\";\n break;\n default:\n s += \" \";\n }\n }\n }\n return s;\n };\n Stream.prototype.isASCII = function (start, end) {\n for (var i = start; i < end; ++i) {\n var c = this.get(i);\n if (c < 32 || c > 176) {\n return false;\n }\n }\n return true;\n };\n Stream.prototype.parseStringISO = function (start, end) {\n var s = \"\";\n for (var i = start; i < end; ++i) {\n s += String.fromCharCode(this.get(i));\n }\n return s;\n };\n Stream.prototype.parseStringUTF = function (start, end) {\n var s = \"\";\n for (var i = start; i < end;) {\n var c = this.get(i++);\n if (c < 128) {\n s += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n s += String.fromCharCode(((c & 0x1F) << 6) | (this.get(i++) & 0x3F));\n }\n else {\n s += String.fromCharCode(((c & 0x0F) << 12) | ((this.get(i++) & 0x3F) << 6) | (this.get(i++) & 0x3F));\n }\n }\n return s;\n };\n Stream.prototype.parseStringBMP = function (start, end) {\n var str = \"\";\n var hi;\n var lo;\n for (var i = start; i < end;) {\n hi = this.get(i++);\n lo = this.get(i++);\n str += String.fromCharCode((hi << 8) | lo);\n }\n return str;\n };\n Stream.prototype.parseTime = function (start, end, shortYear) {\n var s = this.parseStringISO(start, end);\n var m = (shortYear ? reTimeS : reTimeL).exec(s);\n if (!m) {\n return \"Unrecognized time: \" + s;\n }\n if (shortYear) {\n // to avoid querying the timer, use the fixed range [1970, 2069]\n // it will conform with ITU X.400 [-10, +40] sliding window until 2030\n m[1] = +m[1];\n m[1] += (+m[1] < 70) ? 2000 : 1900;\n }\n s = m[1] + \"-\" + m[2] + \"-\" + m[3] + \" \" + m[4];\n if (m[5]) {\n s += \":\" + m[5];\n if (m[6]) {\n s += \":\" + m[6];\n if (m[7]) {\n s += \".\" + m[7];\n }\n }\n }\n if (m[8]) {\n s += \" UTC\";\n if (m[8] != \"Z\") {\n s += m[8];\n if (m[9]) {\n s += \":\" + m[9];\n }\n }\n }\n return s;\n };\n Stream.prototype.parseInteger = function (start, end) {\n var v = this.get(start);\n var neg = (v > 127);\n var pad = neg ? 255 : 0;\n var len;\n var s = \"\";\n // skip unuseful bits (not allowed in DER)\n while (v == pad && ++start < end) {\n v = this.get(start);\n }\n len = end - start;\n if (len === 0) {\n return neg ? -1 : 0;\n }\n // show bit length of huge integers\n if (len > 4) {\n s = v;\n len <<= 3;\n while (((+s ^ pad) & 0x80) == 0) {\n s = +s << 1;\n --len;\n }\n s = \"(\" + len + \" bit)\\n\";\n }\n // decode the integer\n if (neg) {\n v = v - 256;\n }\n var n = new Int10(v);\n for (var i = start + 1; i < end; ++i) {\n n.mulAdd(256, this.get(i));\n }\n return s + n.toString();\n };\n Stream.prototype.parseBitString = function (start, end, maxLength) {\n var unusedBit = this.get(start);\n var lenBit = ((end - start - 1) << 3) - unusedBit;\n var intro = \"(\" + lenBit + \" bit)\\n\";\n var s = \"\";\n for (var i = start + 1; i < end; ++i) {\n var b = this.get(i);\n var skip = (i == end - 1) ? unusedBit : 0;\n for (var j = 7; j >= skip; --j) {\n s += (b >> j) & 1 ? \"1\" : \"0\";\n }\n if (s.length > maxLength) {\n return intro + stringCut(s, maxLength);\n }\n }\n return intro + s;\n };\n Stream.prototype.parseOctetString = function (start, end, maxLength) {\n if (this.isASCII(start, end)) {\n return stringCut(this.parseStringISO(start, end), maxLength);\n }\n var len = end - start;\n var s = \"(\" + len + \" byte)\\n\";\n maxLength /= 2; // we work in bytes\n if (len > maxLength) {\n end = start + maxLength;\n }\n for (var i = start; i < end; ++i) {\n s += this.hexByte(this.get(i));\n }\n if (len > maxLength) {\n s += ellipsis;\n }\n return s;\n };\n Stream.prototype.parseOID = function (start, end, maxLength) {\n var s = \"\";\n var n = new Int10();\n var bits = 0;\n for (var i = start; i < end; ++i) {\n var v = this.get(i);\n n.mulAdd(128, v & 0x7F);\n bits += 7;\n if (!(v & 0x80)) {\n if (s === \"\") {\n n = n.simplify();\n if (n instanceof Int10) {\n n.sub(80);\n s = \"2.\" + n.toString();\n }\n else {\n var m = n < 80 ? n < 40 ? 0 : 1 : 2;\n s = m + \".\" + (n - m * 40);\n }\n }\n else {\n s += \".\" + n.toString();\n }\n if (s.length > maxLength) {\n return stringCut(s, maxLength);\n }\n n = new Int10();\n bits = 0;\n }\n }\n if (bits > 0) {\n s += \".incomplete\";\n }\n return s;\n };\n return Stream;\n}());\nexport { Stream };\nvar ASN1 = /** @class */ (function () {\n function ASN1(stream, header, length, tag, sub) {\n if (!(tag instanceof ASN1Tag)) {\n throw new Error(\"Invalid tag value.\");\n }\n this.stream = stream;\n this.header = header;\n this.length = length;\n this.tag = tag;\n this.sub = sub;\n }\n ASN1.prototype.typeName = function () {\n switch (this.tag.tagClass) {\n case 0:// universal\n switch (this.tag.tagNumber) {\n case 0x00:\n return \"EOC\";\n case 0x01:\n return \"BOOLEAN\";\n case 0x02:\n return \"INTEGER\";\n case 0x03:\n return \"BIT_STRING\";\n case 0x04:\n return \"OCTET_STRING\";\n case 0x05:\n return \"NULL\";\n case 0x06:\n return \"OBJECT_IDENTIFIER\";\n case 0x07:\n return \"ObjectDescriptor\";\n case 0x08:\n return \"EXTERNAL\";\n case 0x09:\n return \"REAL\";\n case 0x0A:\n return \"ENUMERATED\";\n case 0x0B:\n return \"EMBEDDED_PDV\";\n case 0x0C:\n return \"UTF8String\";\n case 0x10:\n return \"SEQUENCE\";\n case 0x11:\n return \"SET\";\n case 0x12:\n return \"NumericString\";\n case 0x13:\n return \"PrintableString\"; // ASCII subset\n case 0x14:\n return \"TeletexString\"; // aka T61String\n case 0x15:\n return \"VideotexString\";\n case 0x16:\n return \"IA5String\"; // ASCII\n case 0x17:\n return \"UTCTime\";\n case 0x18:\n return \"GeneralizedTime\";\n case 0x19:\n return \"GraphicString\";\n case 0x1A:\n return \"VisibleString\"; // ASCII subset\n case 0x1B:\n return \"GeneralString\";\n case 0x1C:\n return \"UniversalString\";\n case 0x1E:\n return \"BMPString\";\n }\n return \"Universal_\" + this.tag.tagNumber.toString();\n case 1:\n return \"Application_\" + this.tag.tagNumber.toString();\n case 2:\n return \"[\" + this.tag.tagNumber.toString() + \"]\"; // Context\n case 3:\n return \"Private_\" + this.tag.tagNumber.toString();\n }\n };\n ASN1.prototype.content = function (maxLength) {\n if (this.tag === undefined) {\n return null;\n }\n if (maxLength === undefined) {\n maxLength = Infinity;\n }\n var content = this.posContent();\n var len = Math.abs(this.length);\n if (!this.tag.isUniversal()) {\n if (this.sub !== null) {\n return \"(\" + this.sub.length + \" elem)\";\n }\n return this.stream.parseOctetString(content, content + len, maxLength);\n }\n switch (this.tag.tagNumber) {\n case 0x01:// BOOLEAN\n return (this.stream.get(content) === 0) ? \"false\" : \"true\";\n case 0x02:// INTEGER\n return this.stream.parseInteger(content, content + len);\n case 0x03:// BIT_STRING\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\n this.stream.parseBitString(content, content + len, maxLength);\n case 0x04:// OCTET_STRING\n return this.sub ? \"(\" + this.sub.length + \" elem)\" :\n this.stream.parseOctetString(content, content + len, maxLength);\n // case 0x05: // NULL\n case 0x06:// OBJECT_IDENTIFIER\n return this.stream.parseOID(content, content + len, maxLength);\n // case 0x07: // ObjectDescriptor\n // case 0x08: // EXTERNAL\n // case 0x09: // REAL\n // case 0x0A: // ENUMERATED\n // case 0x0B: // EMBEDDED_PDV\n case 0x10: // SEQUENCE\n case 0x11:// SET\n if (this.sub !== null) {\n return \"(\" + this.sub.length + \" elem)\";\n }\n else {\n return \"(no elem)\";\n }\n case 0x0C:// UTF8String\n return stringCut(this.stream.parseStringUTF(content, content + len), maxLength);\n case 0x12: // NumericString\n case 0x13: // PrintableString\n case 0x14: // TeletexString\n case 0x15: // VideotexString\n case 0x16: // IA5String\n // case 0x19: // GraphicString\n case 0x1A:// VisibleString\n // case 0x1B: // GeneralString\n // case 0x1C: // UniversalString\n return stringCut(this.stream.parseStringISO(content, content + len), maxLength);\n case 0x1E:// BMPString\n return stringCut(this.stream.parseStringBMP(content, content + len), maxLength);\n case 0x17: // UTCTime\n case 0x18:// GeneralizedTime\n return this.stream.parseTime(content, content + len, (this.tag.tagNumber == 0x17));\n }\n return null;\n };\n ASN1.prototype.toString = function () {\n return this.typeName() + \"@\" + this.stream.pos + \"[header:\" + this.header + \",length:\" + this.length + \",sub:\" + ((this.sub === null) ? \"null\" : this.sub.length) + \"]\";\n };\n ASN1.prototype.toPrettyString = function (indent) {\n if (indent === undefined) {\n indent = \"\";\n }\n var s = indent + this.typeName() + \" @\" + this.stream.pos;\n if (this.length >= 0) {\n s += \"+\";\n }\n s += this.length;\n if (this.tag.tagConstructed) {\n s += \" (constructed)\";\n }\n else if ((this.tag.isUniversal() && ((this.tag.tagNumber == 0x03) || (this.tag.tagNumber == 0x04))) && (this.sub !== null)) {\n s += \" (encapsulates)\";\n }\n s += \"\\n\";\n if (this.sub !== null) {\n indent += \" \";\n for (var i = 0, max = this.sub.length; i < max; ++i) {\n s += this.sub[i].toPrettyString(indent);\n }\n }\n return s;\n };\n ASN1.prototype.posStart = function () {\n return this.stream.pos;\n };\n ASN1.prototype.posContent = function () {\n return this.stream.pos + this.header;\n };\n ASN1.prototype.posEnd = function () {\n return this.stream.pos + this.header + Math.abs(this.length);\n };\n ASN1.prototype.toHexString = function () {\n return this.stream.hexDump(this.posStart(), this.posEnd(), true);\n };\n ASN1.decodeLength = function (stream) {\n var buf = stream.get();\n var len = buf & 0x7F;\n if (len == buf) {\n return len;\n }\n // no reason to use Int10, as it would be a huge buffer anyways\n if (len > 6) {\n throw new Error(\"Length over 48 bits not supported at position \" + (stream.pos - 1));\n }\n if (len === 0) {\n return null;\n } // undefined\n buf = 0;\n for (var i = 0; i < len; ++i) {\n buf = (buf * 256) + stream.get();\n }\n return buf;\n };\n ASN1.decode = function (stream) {\n if (!(stream instanceof Stream)) {\n stream = new Stream(stream, 0);\n }\n var streamStart = new Stream(stream);\n var tag = new ASN1Tag(stream);\n var len = ASN1.decodeLength(stream);\n var start = stream.pos;\n var header = start - streamStart.pos;\n var sub = null;\n var getSub = function () {\n var ret = [];\n if (len !== null) {\n // definite length\n var end = start + len;\n while (stream.pos < end) {\n ret[ret.length] = ASN1.decode(stream);\n }\n if (stream.pos != end) {\n throw new Error(\"Content size is not correct for container starting at offset \" + start);\n }\n }\n else {\n // undefined length\n try {\n for (;;) {\n var s = ASN1.decode(stream);\n if (s.tag.isEOC()) {\n break;\n }\n ret[ret.length] = s;\n }\n len = start - stream.pos; // undefined lengths are represented as negative values\n }\n catch (e) {\n throw new Error(\"Exception while decoding undefined length content: \" + e);\n }\n }\n return ret;\n };\n if (tag.tagConstructed) {\n // must have valid content\n sub = getSub();\n }\n else if (tag.isUniversal() && ((tag.tagNumber == 0x03) || (tag.tagNumber == 0x04))) {\n // sometimes BitString and OctetString are used to encapsulate ASN.1\n try {\n if (tag.tagNumber == 0x03) {\n if (stream.get() != 0) {\n throw new Error(\"BIT STRINGs with unused bits cannot encapsulate.\");\n }\n }\n sub = getSub();\n for (var i = 0; i < sub.length; ++i) {\n if (sub[i].tag.isEOC()) {\n throw new Error(\"EOC is not supposed to be actual content.\");\n }\n }\n }\n catch (e) {\n // but silently ignore when they don't\n sub = null;\n }\n }\n if (sub === null) {\n if (len === null) {\n throw new Error(\"We can't skip over an invalid tag with undefined length at offset \" + start);\n }\n stream.pos = start + Math.abs(len);\n }\n return new ASN1(streamStart, header, len, tag, sub);\n };\n return ASN1;\n}());\nexport { ASN1 };\nvar ASN1Tag = /** @class */ (function () {\n function ASN1Tag(stream) {\n var buf = stream.get();\n this.tagClass = buf >> 6;\n this.tagConstructed = ((buf & 0x20) !== 0);\n this.tagNumber = buf & 0x1F;\n if (this.tagNumber == 0x1F) {\n var n = new Int10();\n do {\n buf = stream.get();\n n.mulAdd(128, buf & 0x7F);\n } while (buf & 0x80);\n this.tagNumber = n.simplify();\n }\n }\n ASN1Tag.prototype.isUniversal = function () {\n return this.tagClass === 0x00;\n };\n ASN1Tag.prototype.isEOC = function () {\n return this.tagClass === 0x00 && this.tagNumber === 0x00;\n };\n return ASN1Tag;\n}());\n"
  1046. },
  1047. {
  1048. "id": 6,
  1049. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/int10.ts",
  1050. "name": "./lib/asn1js/int10.ts",
  1051. "index": 3,
  1052. "index2": 0,
  1053. "size": 2793,
  1054. "cacheable": true,
  1055. "built": true,
  1056. "optional": false,
  1057. "prefetched": false,
  1058. "chunks": [
  1059. 0
  1060. ],
  1061. "assets": [],
  1062. "issuer": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/asn1.ts",
  1063. "issuerId": 5,
  1064. "issuerName": "./lib/asn1js/asn1.ts",
  1065. "profile": {
  1066. "factory": 253,
  1067. "building": 30
  1068. },
  1069. "failed": false,
  1070. "errors": 0,
  1071. "warnings": 0,
  1072. "reasons": [
  1073. {
  1074. "moduleId": 5,
  1075. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/asn1.ts",
  1076. "module": "./lib/asn1js/asn1.ts",
  1077. "moduleName": "./lib/asn1js/asn1.ts",
  1078. "type": "harmony import",
  1079. "userRequest": "./int10",
  1080. "loc": "16:0-32"
  1081. }
  1082. ],
  1083. "usedExports": [
  1084. "Int10"
  1085. ],
  1086. "providedExports": [
  1087. "Int10"
  1088. ],
  1089. "optimizationBailout": [],
  1090. "depth": 3,
  1091. "source": "// Big integer base-10 printing library\n// Copyright (c) 2014 Lapo Luchini <lapo@lapo.it>\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar max = 10000000000000; // biggest integer that can still fit 2^53 when multiplied by 256\nvar Int10 = /** @class */ (function () {\n function Int10(value) {\n this.buf = [+value || 0];\n }\n Int10.prototype.mulAdd = function (m, c) {\n // assert(m <= 256)\n var b = this.buf;\n var l = b.length;\n var i;\n var t;\n for (i = 0; i < l; ++i) {\n t = b[i] * m + c;\n if (t < max) {\n c = 0;\n }\n else {\n c = 0 | (t / max);\n t -= c * max;\n }\n b[i] = t;\n }\n if (c > 0) {\n b[i] = c;\n }\n };\n Int10.prototype.sub = function (c) {\n // assert(m <= 256)\n var b = this.buf;\n var l = b.length;\n var i;\n var t;\n for (i = 0; i < l; ++i) {\n t = b[i] - c;\n if (t < 0) {\n t += max;\n c = 1;\n }\n else {\n c = 0;\n }\n b[i] = t;\n }\n while (b[b.length - 1] === 0) {\n b.pop();\n }\n };\n Int10.prototype.toString = function (base) {\n if ((base || 10) != 10) {\n throw new Error(\"only base 10 is supported\");\n }\n var b = this.buf;\n var s = b[b.length - 1].toString();\n for (var i = b.length - 2; i >= 0; --i) {\n s += (max + b[i]).toString().substring(1);\n }\n return s;\n };\n Int10.prototype.valueOf = function () {\n var b = this.buf;\n var v = 0;\n for (var i = b.length - 1; i >= 0; --i) {\n v = v * max + b[i];\n }\n return v;\n };\n Int10.prototype.simplify = function () {\n var b = this.buf;\n return (b.length == 1) ? b[0] : this;\n };\n return Int10;\n}());\nexport { Int10 };\n"
  1092. },
  1093. {
  1094. "id": 7,
  1095. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rsa.ts",
  1096. "name": "./lib/jsbn/rsa.ts",
  1097. "index": 4,
  1098. "index2": 6,
  1099. "size": 7707,
  1100. "cacheable": true,
  1101. "built": true,
  1102. "optional": false,
  1103. "prefetched": false,
  1104. "chunks": [
  1105. 0
  1106. ],
  1107. "assets": [],
  1108. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1109. "issuerId": 4,
  1110. "issuerName": "./src/jsencrypt.js",
  1111. "profile": {
  1112. "factory": 48,
  1113. "building": 780,
  1114. "dependencies": 0
  1115. },
  1116. "failed": false,
  1117. "errors": 2,
  1118. "warnings": 0,
  1119. "reasons": [
  1120. {
  1121. "moduleId": 4,
  1122. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1123. "module": "./src/jsencrypt.js",
  1124. "moduleName": "./src/jsencrypt.js",
  1125. "type": "harmony import",
  1126. "userRequest": "../lib/jsbn/rsa",
  1127. "loc": "2:0-39"
  1128. }
  1129. ],
  1130. "usedExports": [
  1131. "RSAKey"
  1132. ],
  1133. "providedExports": [
  1134. "RSAKey"
  1135. ],
  1136. "optimizationBailout": [],
  1137. "depth": 2,
  1138. "source": "// Depends on jsbn.js and rng.js\n// Version 1.1: support utf-8 encoding in pkcs1pad2\n// convert a (hex) string to a bignum object\nimport { BigInteger, parseBigInt } from \"./jsbn\";\nimport { SecureRandom } from \"./rng\";\nfunction linebrk(s, n) {\n var ret = \"\";\n var i = 0;\n while (i + n < s.length) {\n ret += s.substring(i, i + n) + \"\\n\";\n i += n;\n }\n return ret + s.substring(i, s.length);\n}\nfunction byte2Hex(b) {\n if (b < 0x10)\n return \"0\" + b.toString(16);\n else\n return b.toString(16);\n}\n// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint\nfunction pkcs1pad2(s, n) {\n if (n < s.length + 11) {\n console.error(\"Message too long for RSA\");\n return null;\n }\n var ba = new Array();\n var i = s.length - 1;\n while (i >= 0 && n > 0) {\n var c = s.charCodeAt(i--);\n if (c < 128) {\n ba[--n] = c;\n }\n else if ((c > 127) && (c < 2048)) {\n ba[--n] = (c & 63) | 128;\n ba[--n] = (c >> 6) | 192;\n }\n else {\n ba[--n] = (c & 63) | 128;\n ba[--n] = ((c >> 6) & 63) | 128;\n ba[--n] = (c >> 12) | 224;\n }\n }\n ba[--n] = 0;\n var rng = new SecureRandom();\n var x = new Array();\n while (n > 2) {\n x[0] = 0;\n while (x[0] == 0)\n rng.nextBytes(x);\n ba[--n] = x[0];\n }\n ba[--n] = 2;\n ba[--n] = 0;\n return new BigInteger(ba);\n}\n// \"empty\" RSA key constructor\nvar RSAKey = /** @class */ (function () {\n function RSAKey() {\n this.n = null;\n this.e = 0;\n this.d = null;\n this.p = null;\n this.q = null;\n this.dmp1 = null;\n this.dmq1 = null;\n this.coeff = null;\n }\n //#region PROTECTED\n // protected\n // RSAKey.prototype.doPublic = RSADoPublic;\n // Perform raw public operation on \"x\": return x^e (mod n)\n RSAKey.prototype.doPublic = function (x) {\n return x.modPowInt(this.e, this.n);\n };\n // RSAKey.prototype.doPrivate = RSADoPrivate;\n // Perform raw private operation on \"x\": return x^d (mod n)\n RSAKey.prototype.doPrivate = function (x) {\n if (this.p == null || this.q == null)\n return x.modPow(this.d, this.n);\n // TODO: re-calculate any missing CRT params\n var xp = x.mod(this.p).modPow(this.dmp1, this.p);\n var xq = x.mod(this.q).modPow(this.dmq1, this.q);\n while (xp.compareTo(xq) < 0)\n xp = xp.add(this.p);\n return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq);\n };\n //#endregion PROTECTED\n //#region PUBLIC\n // RSAKey.prototype.setPublic = RSASetPublic;\n // Set the public key fields N and e from hex strings\n RSAKey.prototype.setPublic = function (N, E) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n }\n else\n console.error(\"Invalid RSA public key\");\n };\n // RSAKey.prototype.encrypt = RSAEncrypt;\n // Return the PKCS#1 RSA encryption of \"text\" as an even-length hex string\n RSAKey.prototype.encrypt = function (text) {\n var m = pkcs1pad2(text, (this.n.bitLength() + 7) >> 3);\n if (m == null)\n return null;\n var c = this.doPublic(m);\n if (c == null)\n return null;\n var h = c.toString(16);\n if ((h.length & 1) == 0)\n return h;\n else\n return \"0\" + h;\n };\n // RSAKey.prototype.setPrivate = RSASetPrivate;\n // Set the private key fields N, e, and d from hex strings\n RSAKey.prototype.setPrivate = function (N, E, D) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n this.d = parseBigInt(D, 16);\n }\n else {\n console.error(\"Invalid RSA private key\");\n }\n };\n // RSAKey.prototype.setPrivateEx = RSASetPrivateEx;\n // Set the private key fields N, e, d and CRT params from hex strings\n RSAKey.prototype.setPrivateEx = function (N, E, D, P, Q, DP, DQ, C) {\n if (N != null && E != null && N.length > 0 && E.length > 0) {\n this.n = parseBigInt(N, 16);\n this.e = parseInt(E, 16);\n this.d = parseBigInt(D, 16);\n this.p = parseBigInt(P, 16);\n this.q = parseBigInt(Q, 16);\n this.dmp1 = parseBigInt(DP, 16);\n this.dmq1 = parseBigInt(DQ, 16);\n this.coeff = parseBigInt(C, 16);\n }\n else {\n console.error(\"Invalid RSA private key\");\n }\n };\n // RSAKey.prototype.generate = RSAGenerate;\n // Generate a new random private key B bits long, using public expt E\n RSAKey.prototype.generate = function (B, E) {\n var rng = new SecureRandom();\n var qs = B >> 1;\n this.e = parseInt(E, 16);\n var ee = new BigInteger(E, 16);\n for (;;) {\n for (;;) {\n this.p = new BigInteger(B - qs, 1, rng);\n if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10))\n break;\n }\n for (;;) {\n this.q = new BigInteger(qs, 1, rng);\n if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10))\n break;\n }\n if (this.p.compareTo(this.q) <= 0) {\n var t = this.p;\n this.p = this.q;\n this.q = t;\n }\n var p1 = this.p.subtract(BigInteger.ONE);\n var q1 = this.q.subtract(BigInteger.ONE);\n var phi = p1.multiply(q1);\n if (phi.gcd(ee).compareTo(BigInteger.ONE) == 0) {\n this.n = this.p.multiply(this.q);\n this.d = ee.modInverse(phi);\n this.dmp1 = this.d.mod(p1);\n this.dmq1 = this.d.mod(q1);\n this.coeff = this.q.modInverse(this.p);\n break;\n }\n }\n };\n // RSAKey.prototype.decrypt = RSADecrypt;\n // Return the PKCS#1 RSA decryption of \"ctext\".\n // \"ctext\" is an even-length hex string and the output is a plain string.\n RSAKey.prototype.decrypt = function (ctext) {\n var c = parseBigInt(ctext, 16);\n var m = this.doPrivate(c);\n if (m == null)\n return null;\n return pkcs1unpad2(m, (this.n.bitLength() + 7) >> 3);\n };\n return RSAKey;\n}());\nexport { RSAKey };\n// Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext\nfunction pkcs1unpad2(d, n) {\n var b = d.toByteArray();\n var i = 0;\n while (i < b.length && b[i] == 0)\n ++i;\n if (b.length - i != n - 1 || b[i] != 2)\n return null;\n ++i;\n while (b[i] != 0)\n if (++i >= b.length)\n return null;\n var ret = \"\";\n while (++i < b.length) {\n var c = b[i] & 255;\n if (c < 128) {\n ret += String.fromCharCode(c);\n }\n else if ((c > 191) && (c < 224)) {\n ret += String.fromCharCode(((c & 31) << 6) | (b[i + 1] & 63));\n ++i;\n }\n else {\n ret += String.fromCharCode(((c & 15) << 12) | ((b[i + 1] & 63) << 6) | (b[i + 2] & 63));\n i += 2;\n }\n }\n return ret;\n}\n// Return the PKCS#1 RSA encryption of \"text\" as a Base64-encoded string\n//function RSAEncryptB64(text) {\n// var h = this.encrypt(text);\n// if(h) return hex2b64(h); else return null;\n//}\n// public\n//RSAKey.prototype.encrypt_b64 = RSAEncryptB64;\n"
  1139. },
  1140. {
  1141. "id": 8,
  1142. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rng.ts",
  1143. "name": "./lib/jsbn/rng.ts",
  1144. "index": 7,
  1145. "index2": 5,
  1146. "size": 2618,
  1147. "cacheable": true,
  1148. "built": true,
  1149. "optional": false,
  1150. "prefetched": false,
  1151. "chunks": [
  1152. 0
  1153. ],
  1154. "assets": [],
  1155. "issuer": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rsa.ts",
  1156. "issuerId": 7,
  1157. "issuerName": "./lib/jsbn/rsa.ts",
  1158. "profile": {
  1159. "factory": 165,
  1160. "building": 16
  1161. },
  1162. "failed": false,
  1163. "errors": 0,
  1164. "warnings": 0,
  1165. "reasons": [
  1166. {
  1167. "moduleId": 7,
  1168. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rsa.ts",
  1169. "module": "./lib/jsbn/rsa.ts",
  1170. "moduleName": "./lib/jsbn/rsa.ts",
  1171. "type": "harmony import",
  1172. "userRequest": "./rng",
  1173. "loc": "5:0-37"
  1174. }
  1175. ],
  1176. "usedExports": [
  1177. "SecureRandom"
  1178. ],
  1179. "providedExports": [
  1180. "SecureRandom"
  1181. ],
  1182. "optimizationBailout": [],
  1183. "depth": 3,
  1184. "source": "// Random number generator - requires a PRNG backend, e.g. prng4.js\nimport { prng_newstate, rng_psize } from \"./prng4\";\nvar rng_state;\nvar rng_pool;\nvar rng_pptr;\n// Initialize the pool with junk if needed.\nif (rng_pool == null) {\n rng_pool = [];\n rng_pptr = 0;\n var t = void 0;\n if (window.crypto && window.crypto.getRandomValues) {\n // Extract entropy (2048 bits) from RNG if available\n var z = new Uint32Array(256);\n window.crypto.getRandomValues(z);\n for (t = 0; t < z.length; ++t) {\n rng_pool[rng_pptr++] = z[t] & 255;\n }\n }\n // Use mouse events for entropy, if we do not have enough entropy by the time\n // we need it, entropy will be generated by Math.random.\n var onMouseMoveListener_1 = function (ev) {\n this.count = this.count || 0;\n if (this.count >= 256 || rng_pptr >= rng_psize) {\n if (window.removeEventListener) {\n window.removeEventListener(\"mousemove\", onMouseMoveListener_1, false);\n }\n else if (window.detachEvent) {\n window.detachEvent(\"onmousemove\", onMouseMoveListener_1);\n }\n return;\n }\n try {\n var mouseCoordinates = ev.x + ev.y;\n rng_pool[rng_pptr++] = mouseCoordinates & 255;\n this.count += 1;\n }\n catch (e) {\n // Sometimes Firefox will deny permission to access event properties for some reason. Ignore.\n }\n };\n if (window.addEventListener) {\n window.addEventListener(\"mousemove\", onMouseMoveListener_1, false);\n }\n else if (window.attachEvent) {\n window.attachEvent(\"onmousemove\", onMouseMoveListener_1);\n }\n}\nfunction rng_get_byte() {\n if (rng_state == null) {\n rng_state = prng_newstate();\n // At this point, we may not have collected enough entropy. If not, fall back to Math.random\n while (rng_pptr < rng_psize) {\n var random = Math.floor(65536 * Math.random());\n rng_pool[rng_pptr++] = random & 255;\n }\n rng_state.init(rng_pool);\n for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) {\n rng_pool[rng_pptr] = 0;\n }\n rng_pptr = 0;\n }\n // TODO: allow reseeding after first request\n return rng_state.next();\n}\nvar SecureRandom = /** @class */ (function () {\n function SecureRandom() {\n }\n SecureRandom.prototype.nextBytes = function (ba) {\n for (var i = 0; i < ba.length; ++i) {\n ba[i] = rng_get_byte();\n }\n };\n return SecureRandom;\n}());\nexport { SecureRandom };\n"
  1185. },
  1186. {
  1187. "id": 9,
  1188. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/prng4.ts",
  1189. "name": "./lib/jsbn/prng4.ts",
  1190. "index": 8,
  1191. "index2": 4,
  1192. "size": 1320,
  1193. "cacheable": true,
  1194. "built": true,
  1195. "optional": false,
  1196. "prefetched": false,
  1197. "chunks": [
  1198. 0
  1199. ],
  1200. "assets": [],
  1201. "issuer": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rng.ts",
  1202. "issuerId": 8,
  1203. "issuerName": "./lib/jsbn/rng.ts",
  1204. "profile": {
  1205. "factory": 14,
  1206. "building": 4
  1207. },
  1208. "failed": false,
  1209. "errors": 0,
  1210. "warnings": 0,
  1211. "reasons": [
  1212. {
  1213. "moduleId": 8,
  1214. "moduleIdentifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/jsbn/rng.ts",
  1215. "module": "./lib/jsbn/rng.ts",
  1216. "moduleName": "./lib/jsbn/rng.ts",
  1217. "type": "harmony import",
  1218. "userRequest": "./prng4",
  1219. "loc": "2:0-51"
  1220. }
  1221. ],
  1222. "usedExports": [
  1223. "prng_newstate",
  1224. "rng_psize"
  1225. ],
  1226. "providedExports": [
  1227. "Arcfour",
  1228. "prng_newstate",
  1229. "rng_psize"
  1230. ],
  1231. "optimizationBailout": [],
  1232. "depth": 4,
  1233. "source": "// prng4.js - uses Arcfour as a PRNG\nvar Arcfour = /** @class */ (function () {\n function Arcfour() {\n this.i = 0;\n this.j = 0;\n this.S = [];\n }\n //Arcfour.prototype.init = ARC4init;\n // Initialize arcfour context from key, an array of ints, each from [0..255]\n Arcfour.prototype.init = function (key) {\n var i, j, t;\n for (i = 0; i < 256; ++i)\n this.S[i] = i;\n j = 0;\n for (i = 0; i < 256; ++i) {\n j = (j + this.S[i] + key[i % key.length]) & 255;\n t = this.S[i];\n this.S[i] = this.S[j];\n this.S[j] = t;\n }\n this.i = 0;\n this.j = 0;\n };\n // Arcfour.prototype.next = ARC4next;\n Arcfour.prototype.next = function () {\n var t;\n this.i = (this.i + 1) & 255;\n this.j = (this.j + this.S[this.i]) & 255;\n t = this.S[this.i];\n this.S[this.i] = this.S[this.j];\n this.S[this.j] = t;\n return this.S[(t + this.S[this.i]) & 255];\n };\n return Arcfour;\n}());\nexport { Arcfour };\n// Plug in your RNG constructor here\nexport function prng_newstate() {\n return new Arcfour();\n}\n// Pool size must be a multiple of 4 and greater than 32.\n// An array of bytes the size of the pool will be passed to init()\nexport var rng_psize = 256;\n"
  1234. },
  1235. {
  1236. "id": 10,
  1237. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/base64.ts",
  1238. "name": "./lib/asn1js/base64.ts",
  1239. "index": 9,
  1240. "index2": 7,
  1241. "size": 2887,
  1242. "cacheable": true,
  1243. "built": true,
  1244. "optional": false,
  1245. "prefetched": false,
  1246. "chunks": [
  1247. 0
  1248. ],
  1249. "assets": [],
  1250. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1251. "issuerId": 4,
  1252. "issuerName": "./src/jsencrypt.js",
  1253. "profile": {
  1254. "factory": 47,
  1255. "building": 703
  1256. },
  1257. "failed": false,
  1258. "errors": 0,
  1259. "warnings": 0,
  1260. "reasons": [
  1261. {
  1262. "moduleId": 4,
  1263. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1264. "module": "./src/jsencrypt.js",
  1265. "moduleName": "./src/jsencrypt.js",
  1266. "type": "harmony import",
  1267. "userRequest": "../lib/asn1js/base64",
  1268. "loc": "3:0-44"
  1269. }
  1270. ],
  1271. "usedExports": [
  1272. "Base64"
  1273. ],
  1274. "providedExports": [
  1275. "Base64"
  1276. ],
  1277. "optimizationBailout": [],
  1278. "depth": 2,
  1279. "source": "// Base64 JavaScript decoder\n// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it>\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar decoder;\nexport var Base64 = {\n decode: function (a) {\n var i;\n if (decoder === undefined) {\n var b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\", ignore = \"= \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\n decoder = [];\n for (i = 0; i < 64; ++i)\n decoder[b64.charAt(i)] = i;\n for (i = 0; i < ignore.length; ++i)\n decoder[ignore.charAt(i)] = -1;\n }\n var out = [];\n var bits = 0, char_count = 0;\n for (i = 0; i < a.length; ++i) {\n var c = a.charAt(i);\n if (c == '=')\n break;\n c = decoder[c];\n if (c == -1)\n continue;\n if (c === undefined)\n throw 'Illegal character at offset ' + i;\n bits |= c;\n if (++char_count >= 4) {\n out[out.length] = (bits >> 16);\n out[out.length] = (bits >> 8) & 0xFF;\n out[out.length] = bits & 0xFF;\n bits = 0;\n char_count = 0;\n }\n else {\n bits <<= 6;\n }\n }\n switch (char_count) {\n case 1:\n throw \"Base64 encoding incomplete: at least 2 bits missing\";\n case 2:\n out[out.length] = (bits >> 10);\n break;\n case 3:\n out[out.length] = (bits >> 16);\n out[out.length] = (bits >> 8) & 0xFF;\n break;\n }\n return out;\n },\n re: /-----BEGIN [^-]+-----([A-Za-z0-9+\\/=\\s]+)-----END [^-]+-----|begin-base64[^\\n]+\\n([A-Za-z0-9+\\/=\\s]+)====/,\n unarmor: function (a) {\n var m = Base64.re.exec(a);\n if (m) {\n if (m[1])\n a = m[1];\n else if (m[2])\n a = m[2];\n else\n throw \"RegExp out of sync\";\n }\n return Base64.decode(a);\n }\n};\n"
  1280. },
  1281. {
  1282. "id": 11,
  1283. "identifier": "/home/corax/source/jsencrypt/node_modules/ts-loader/index.js??ref--0-0!/home/corax/source/jsencrypt/lib/asn1js/hex.ts",
  1284. "name": "./lib/asn1js/hex.ts",
  1285. "index": 10,
  1286. "index2": 8,
  1287. "size": 2303,
  1288. "cacheable": true,
  1289. "built": true,
  1290. "optional": false,
  1291. "prefetched": false,
  1292. "chunks": [
  1293. 0
  1294. ],
  1295. "assets": [],
  1296. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1297. "issuerId": 4,
  1298. "issuerName": "./src/jsencrypt.js",
  1299. "profile": {
  1300. "factory": 48,
  1301. "building": 747
  1302. },
  1303. "failed": false,
  1304. "errors": 0,
  1305. "warnings": 0,
  1306. "reasons": [
  1307. {
  1308. "moduleId": 4,
  1309. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1310. "module": "./src/jsencrypt.js",
  1311. "moduleName": "./src/jsencrypt.js",
  1312. "type": "harmony import",
  1313. "userRequest": "../lib/asn1js/hex",
  1314. "loc": "4:0-38"
  1315. }
  1316. ],
  1317. "usedExports": [
  1318. "Hex"
  1319. ],
  1320. "providedExports": [
  1321. "Hex"
  1322. ],
  1323. "optimizationBailout": [],
  1324. "depth": 2,
  1325. "source": "// Hex JavaScript decoder\n// Copyright (c) 2008-2013 Lapo Luchini <lapo@lapo.it>\n// Permission to use, copy, modify, and/or distribute this software for any\n// purpose with or without fee is hereby granted, provided that the above\n// copyright notice and this permission notice appear in all copies.\n// \n// THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n/*jshint browser: true, strict: true, immed: true, latedef: true, undef: true, regexdash: false */\nvar decoder;\nexport var Hex = {\n decode: function (a) {\n var i;\n if (decoder === undefined) {\n var hex = \"0123456789ABCDEF\";\n var ignore = \" \\f\\n\\r\\t\\u00A0\\u2028\\u2029\";\n decoder = {};\n for (i = 0; i < 16; ++i) {\n decoder[hex.charAt(i)] = i;\n }\n hex = hex.toLowerCase();\n for (i = 10; i < 16; ++i) {\n decoder[hex.charAt(i)] = i;\n }\n for (i = 0; i < ignore.length; ++i) {\n decoder[ignore.charAt(i)] = -1;\n }\n }\n var out = [];\n var bits = 0;\n var char_count = 0;\n for (i = 0; i < a.length; ++i) {\n var c = a.charAt(i);\n if (c == \"=\") {\n break;\n }\n c = decoder[c];\n if (c == -1) {\n continue;\n }\n if (c === undefined) {\n throw new Error(\"Illegal character at offset \" + i);\n }\n bits |= c;\n if (++char_count >= 2) {\n out[out.length] = bits;\n bits = 0;\n char_count = 0;\n }\n else {\n bits <<= 4;\n }\n }\n if (char_count) {\n throw new Error(\"Hex encoding incomplete: 4 bits missing\");\n }\n return out;\n }\n};\n"
  1326. },
  1327. {
  1328. "id": 12,
  1329. "identifier": "/home/corax/source/jsencrypt/lib/jsrsasign/asn1-1.0.js",
  1330. "name": "./lib/jsrsasign/asn1-1.0.js",
  1331. "index": 11,
  1332. "index2": 9,
  1333. "size": 41390,
  1334. "cacheable": true,
  1335. "built": true,
  1336. "optional": false,
  1337. "prefetched": false,
  1338. "chunks": [
  1339. 0
  1340. ],
  1341. "assets": [],
  1342. "issuer": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1343. "issuerId": 4,
  1344. "issuerName": "./src/jsencrypt.js",
  1345. "profile": {
  1346. "factory": 4,
  1347. "building": 26,
  1348. "dependencies": 18
  1349. },
  1350. "failed": false,
  1351. "errors": 0,
  1352. "warnings": 0,
  1353. "reasons": [
  1354. {
  1355. "moduleId": 4,
  1356. "moduleIdentifier": "/home/corax/source/jsencrypt/src/jsencrypt.js",
  1357. "module": "./src/jsencrypt.js",
  1358. "moduleName": "./src/jsencrypt.js",
  1359. "type": "harmony import",
  1360. "userRequest": "../lib/jsrsasign/asn1-1.0",
  1361. "loc": "6:0-47"
  1362. }
  1363. ],
  1364. "usedExports": [
  1365. "KJUR"
  1366. ],
  1367. "providedExports": [
  1368. "JSX",
  1369. "KJUR"
  1370. ],
  1371. "optimizationBailout": [],
  1372. "depth": 2,
  1373. "source": "/*! asn1-1.0.2.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license\n */\n\nimport {BigInteger} from \"../jsbn/jsbn\";\nexport const JSX = {};\nJSX.env = JSX.env || {};\n\nconst L = JSX, OP = Object.prototype, FUNCTION_TOSTRING = '[object Function]',ADD = [\"toString\", \"valueOf\"];\n\nJSX.env.parseUA = function(agent) {\n\n var numberify = function(s) {\n var c = 0;\n return parseFloat(s.replace(/\\./g, function() {\n return (c++ == 1) ? '' : '.';\n }));\n },\n\n nav = navigator,\n o = {\n ie: 0,\n opera: 0,\n gecko: 0,\n webkit: 0,\n chrome: 0,\n mobile: null,\n air: 0,\n ipad: 0,\n iphone: 0,\n ipod: 0,\n ios: null,\n android: 0,\n webos: 0,\n caja: nav && nav.cajaVersion,\n secure: false,\n os: null\n\n },\n\n ua = agent || (navigator && navigator.userAgent),\n loc = window && window.location,\n href = loc && loc.href,\n m;\n\n o.secure = href && (href.toLowerCase().indexOf(\"https\") === 0);\n\n if (ua) {\n\n if ((/windows|win32/i).test(ua)) {\n o.os = 'windows';\n } else if ((/macintosh/i).test(ua)) {\n o.os = 'macintosh';\n } else if ((/rhino/i).test(ua)) {\n o.os = 'rhino';\n }\n if ((/KHTML/).test(ua)) {\n o.webkit = 1;\n }\n m = ua.match(/AppleWebKit\\/([^\\s]*)/);\n if (m && m[1]) {\n o.webkit = numberify(m[1]);\n if (/ Mobile\\//.test(ua)) {\n o.mobile = 'Apple'; // iPhone or iPod Touch\n m = ua.match(/OS ([^\\s]*)/);\n if (m && m[1]) {\n m = numberify(m[1].replace('_', '.'));\n }\n o.ios = m;\n o.ipad = o.ipod = o.iphone = 0;\n m = ua.match(/iPad|iPod|iPhone/);\n if (m && m[0]) {\n o[m[0].toLowerCase()] = o.ios;\n }\n } else {\n m = ua.match(/NokiaN[^\\/]*|Android \\d\\.\\d|webOS\\/\\d\\.\\d/);\n if (m) {\n o.mobile = m[0];\n }\n if (/webOS/.test(ua)) {\n o.mobile = 'WebOS';\n m = ua.match(/webOS\\/([^\\s]*);/);\n if (m && m[1]) {\n o.webos = numberify(m[1]);\n }\n }\n if (/ Android/.test(ua)) {\n o.mobile = 'Android';\n m = ua.match(/Android ([^\\s]*);/);\n if (m && m[1]) {\n o.android = numberify(m[1]);\n }\n }\n }\n m = ua.match(/Chrome\\/([^\\s]*)/);\n if (m && m[1]) {\n o.chrome = numberify(m[1]); // Chrome\n } else {\n m = ua.match(/AdobeAIR\\/([^\\s]*)/);\n if (m) {\n o.air = m[0]; // Adobe AIR 1.0 or better\n }\n }\n }\n if (!o.webkit) {\n m = ua.match(/Opera[\\s\\/]([^\\s]*)/);\n if (m && m[1]) {\n o.opera = numberify(m[1]);\n m = ua.match(/Version\\/([^\\s]*)/);\n if (m && m[1]) {\n o.opera = numberify(m[1]); // opera 10+\n }\n m = ua.match(/Opera Mini[^;]*/);\n if (m) {\n o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316\n }\n } else { // not opera or webkit\n m = ua.match(/MSIE\\s([^;]*)/);\n if (m && m[1]) {\n o.ie = numberify(m[1]);\n } else { // not opera, webkit, or ie\n m = ua.match(/Gecko\\/([^\\s]*)/);\n if (m) {\n o.gecko = 1; // Gecko detected, look for revision\n m = ua.match(/rv:([^\\s\\)]*)/);\n if (m && m[1]) {\n o.gecko = numberify(m[1]);\n }\n }\n }\n }\n }\n }\n return o;\n};\n\nJSX.env.ua = JSX.env.parseUA();\n\nJSX.isFunction = function(o) {\n return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;\n};\n\nJSX._IEEnumFix = (JSX.env.ua.ie) ? function(r, s) {\n var i, fname, f;\n for (i=0;i<ADD.length;i=i+1) {\n\n fname = ADD[i];\n f = s[fname];\n\n if (L.isFunction(f) && f!=OP[fname]) {\n r[fname]=f;\n }\n }\n} : function(){};\n\nJSX.extend = function(subc, superc, overrides) {\n if (!superc||!subc) {\n throw new Error(\"extend failed, please check that \" +\n \"all dependencies are included.\");\n }\n var F = function() {}, i;\n F.prototype=superc.prototype;\n subc.prototype=new F();\n subc.prototype.constructor=subc;\n subc.superclass=superc.prototype;\n if (superc.prototype.constructor == OP.constructor) {\n superc.prototype.constructor=superc;\n }\n\n if (overrides) {\n for (i in overrides) {\n if (L.hasOwnProperty(overrides, i)) {\n subc.prototype[i]=overrides[i];\n }\n }\n\n L._IEEnumFix(subc.prototype, overrides);\n }\n};\n\n/*\n * asn1.js - ASN.1 DER encoder classes\n *\n * Copyright (c) 2013 Kenji Urushima (kenji.urushima@gmail.com)\n *\n * This software is licensed under the terms of the MIT License.\n * http://kjur.github.com/jsrsasign/license\n *\n * The above copyright and license notice shall be \n * included in all copies or substantial portions of the Software.\n */\n\n/**\n * @fileOverview\n * @name asn1-1.0.js\n * @author Kenji Urushima kenji.urushima@gmail.com\n * @version 1.0.2 (2013-May-30)\n * @since 2.1\n * @license <a href=\"http://kjur.github.io/jsrsasign/license/\">MIT License</a>\n */\n\n/** \n * kjur's class library name space\n * <p>\n * This name space provides following name spaces:\n * <ul>\n * <li>{@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder</li>\n * <li>{@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL</li>\n * <li>{@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature \n * class and utilities</li>\n * </ul>\n * </p> \n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\n * @name KJUR\n * @namespace kjur's class library name space\n */\n// if (typeof KJUR == \"undefined\" || !KJUR) KJUR = {};\nexport const KJUR = {};\n\n/**\n * kjur's ASN.1 class library name space\n * <p>\n * This is ITU-T X.690 ASN.1 DER encoder class library and\n * class structure and methods is very similar to \n * org.bouncycastle.asn1 package of \n * well known BouncyCaslte Cryptography Library.\n *\n * <h4>PROVIDING ASN.1 PRIMITIVES</h4>\n * Here are ASN.1 DER primitive classes.\n * <ul>\n * <li>{@link KJUR.asn1.DERBoolean}</li>\n * <li>{@link KJUR.asn1.DERInteger}</li>\n * <li>{@link KJUR.asn1.DERBitString}</li>\n * <li>{@link KJUR.asn1.DEROctetString}</li>\n * <li>{@link KJUR.asn1.DERNull}</li>\n * <li>{@link KJUR.asn1.DERObjectIdentifier}</li>\n * <li>{@link KJUR.asn1.DERUTF8String}</li>\n * <li>{@link KJUR.asn1.DERNumericString}</li>\n * <li>{@link KJUR.asn1.DERPrintableString}</li>\n * <li>{@link KJUR.asn1.DERTeletexString}</li>\n * <li>{@link KJUR.asn1.DERIA5String}</li>\n * <li>{@link KJUR.asn1.DERUTCTime}</li>\n * <li>{@link KJUR.asn1.DERGeneralizedTime}</li>\n * <li>{@link KJUR.asn1.DERSequence}</li>\n * <li>{@link KJUR.asn1.DERSet}</li>\n * </ul>\n *\n * <h4>OTHER ASN.1 CLASSES</h4>\n * <ul>\n * <li>{@link KJUR.asn1.ASN1Object}</li>\n * <li>{@link KJUR.asn1.DERAbstractString}</li>\n * <li>{@link KJUR.asn1.DERAbstractTime}</li>\n * <li>{@link KJUR.asn1.DERAbstractStructured}</li>\n * <li>{@link KJUR.asn1.DERTaggedObject}</li>\n * </ul>\n * </p>\n * NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.\n * @name KJUR.asn1\n * @namespace\n */\nif (typeof KJUR.asn1 == \"undefined\" || !KJUR.asn1) KJUR.asn1 = {};\n\n/**\n * ASN1 utilities class\n * @name KJUR.asn1.ASN1Util\n * @classs ASN1 utilities class\n * @since asn1 1.0.2\n */\nKJUR.asn1.ASN1Util = new function() {\n this.integerToByteHex = function(i) {\n\tvar h = i.toString(16);\n\tif ((h.length % 2) == 1) h = '0' + h;\n\treturn h;\n };\n this.bigIntToMinTwosComplementsHex = function(bigIntegerValue) {\n\tvar h = bigIntegerValue.toString(16);\n\tif (h.substr(0, 1) != '-') {\n\t if (h.length % 2 == 1) {\n\t\th = '0' + h;\n\t } else {\n\t\tif (! h.match(/^[0-7]/)) {\n\t\t h = '00' + h;\n\t\t}\n\t }\n\t} else {\n\t var hPos = h.substr(1);\n\t var xorLen = hPos.length;\n\t if (xorLen % 2 == 1) {\n\t\txorLen += 1;\n\t } else {\n\t\tif (! h.match(/^[0-7]/)) {\n\t\t xorLen += 2;\n\t\t}\n\t }\n\t var hMask = '';\n\t for (var i = 0; i < xorLen; i++) {\n\t\thMask += 'f';\n\t }\n\t var biMask = new BigInteger(hMask, 16);\n\t var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE);\n\t h = biNeg.toString(16).replace(/^-/, '');\n\t}\n\treturn h;\n };\n /**\n * get PEM string from hexadecimal data and header string\n * @name getPEMStringFromHex\n * @memberOf KJUR.asn1.ASN1Util\n * @function\n * @param {String} dataHex hexadecimal string of PEM body\n * @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')\n * @return {String} PEM formatted string of input data\n * @description\n * @example\n * var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');\n * // value of pem will be:\n * -----BEGIN PRIVATE KEY-----\n * YWFh\n * -----END PRIVATE KEY-----\n */\n this.getPEMStringFromHex = function(dataHex, pemHeader) {\n\tvar dataWA = CryptoJS.enc.Hex.parse(dataHex);\n\tvar dataB64 = CryptoJS.enc.Base64.stringify(dataWA);\n\tvar pemBody = dataB64.replace(/(.{64})/g, \"$1\\r\\n\");\n pemBody = pemBody.replace(/\\r\\n$/, '');\n\treturn \"-----BEGIN \" + pemHeader + \"-----\\r\\n\" + \n pemBody + \n \"\\r\\n-----END \" + pemHeader + \"-----\\r\\n\";\n };\n};\n\n// ********************************************************************\n// Abstract ASN.1 Classes\n// ********************************************************************\n\n// ********************************************************************\n\n/**\n * base class for ASN.1 DER encoder object\n * @name KJUR.asn1.ASN1Object\n * @class base class for ASN.1 DER encoder object\n * @property {Boolean} isModified flag whether internal data was changed\n * @property {String} hTLV hexadecimal string of ASN.1 TLV\n * @property {String} hT hexadecimal string of ASN.1 TLV tag(T)\n * @property {String} hL hexadecimal string of ASN.1 TLV length(L)\n * @property {String} hV hexadecimal string of ASN.1 TLV value(V)\n * @description\n */\nKJUR.asn1.ASN1Object = function() {\n var isModified = true;\n var hTLV = null;\n var hT = '00'\n var hL = '00';\n var hV = '';\n\n /**\n * get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)\n * @name getLengthHexFromValue\n * @memberOf KJUR.asn1.ASN1Object\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV length(L)\n */\n this.getLengthHexFromValue = function() {\n\tif (typeof this.hV == \"undefined\" || this.hV == null) {\n\t throw \"this.hV is null or undefined.\";\n\t}\n\tif (this.hV.length % 2 == 1) {\n\t throw \"value hex must be even length: n=\" + hV.length + \",v=\" + this.hV;\n\t}\n\tvar n = this.hV.length / 2;\n\tvar hN = n.toString(16);\n\tif (hN.length % 2 == 1) {\n\t hN = \"0\" + hN;\n\t}\n\tif (n < 128) {\n\t return hN;\n\t} else {\n\t var hNlen = hN.length / 2;\n\t if (hNlen > 15) {\n\t\tthrow \"ASN.1 length too long to represent by 8x: n = \" + n.toString(16);\n\t }\n\t var head = 128 + hNlen;\n\t return head.toString(16) + hN;\n\t}\n };\n\n /**\n * get hexadecimal string of ASN.1 TLV bytes\n * @name getEncodedHex\n * @memberOf KJUR.asn1.ASN1Object\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV\n */\n this.getEncodedHex = function() {\n\tif (this.hTLV == null || this.isModified) {\n\t this.hV = this.getFreshValueHex();\n\t this.hL = this.getLengthHexFromValue();\n\t this.hTLV = this.hT + this.hL + this.hV;\n\t this.isModified = false;\n\t //console.error(\"first time: \" + this.hTLV);\n\t}\n\treturn this.hTLV;\n };\n\n /**\n * get hexadecimal string of ASN.1 TLV value(V) bytes\n * @name getValueHex\n * @memberOf KJUR.asn1.ASN1Object\n * @function\n * @return {String} hexadecimal string of ASN.1 TLV value(V) bytes\n */\n this.getValueHex = function() {\n\tthis.getEncodedHex();\n\treturn this.hV;\n }\n\n this.getFreshValueHex = function() {\n\treturn '';\n };\n};\n\n// == BEGIN DERAbstractString ================================================\n/**\n * base class for ASN.1 DER string classes\n * @name KJUR.asn1.DERAbstractString\n * @class base class for ASN.1 DER string classes\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @property {String} s internal string of value\n * @extends KJUR.asn1.ASN1Object\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>str - specify initial ASN.1 value(V) by a string</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERAbstractString = function(params) {\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\n var s = null;\n var hV = null;\n\n /**\n * get string value of this string object\n * @name getString\n * @memberOf KJUR.asn1.DERAbstractString\n * @function\n * @return {String} string value of this string object\n */\n this.getString = function() {\n\treturn this.s;\n };\n\n /**\n * set value by a string\n * @name setString\n * @memberOf KJUR.asn1.DERAbstractString\n * @function\n * @param {String} newS value by a string to set\n */\n this.setString = function(newS) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = newS;\n\tthis.hV = stohex(this.s);\n };\n\n /**\n * set value by a hexadecimal string\n * @name setStringHex\n * @memberOf KJUR.asn1.DERAbstractString\n * @function\n * @param {String} newHexString value by a hexadecimal string to set\n */\n this.setStringHex = function(newHexString) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = null;\n\tthis.hV = newHexString;\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['str'] != \"undefined\") {\n\t this.setString(params['str']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setStringHex(params['hex']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);\n// == END DERAbstractString ================================================\n\n// == BEGIN DERAbstractTime ==================================================\n/**\n * base class for ASN.1 DER Generalized/UTCTime class\n * @name KJUR.asn1.DERAbstractTime\n * @class base class for ASN.1 DER Generalized/UTCTime class\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERAbstractTime = function(params) {\n KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);\n var s = null;\n var date = null;\n\n // --- PRIVATE METHODS --------------------\n this.localDateToUTC = function(d) {\n\tutc = d.getTime() + (d.getTimezoneOffset() * 60000);\n\tvar utcDate = new Date(utc);\n\treturn utcDate;\n };\n\n this.formatDate = function(dateObject, type) {\n\tvar pad = this.zeroPadding;\n\tvar d = this.localDateToUTC(dateObject);\n\tvar year = String(d.getFullYear());\n\tif (type == 'utc') year = year.substr(2, 2);\n\tvar month = pad(String(d.getMonth() + 1), 2);\n\tvar day = pad(String(d.getDate()), 2);\n\tvar hour = pad(String(d.getHours()), 2);\n\tvar min = pad(String(d.getMinutes()), 2);\n\tvar sec = pad(String(d.getSeconds()), 2);\n\treturn year + month + day + hour + min + sec + 'Z';\n };\n\n this.zeroPadding = function(s, len) {\n\tif (s.length >= len) return s;\n\treturn new Array(len - s.length + 1).join('0') + s;\n };\n\n // --- PUBLIC METHODS --------------------\n /**\n * get string value of this string object\n * @name getString\n * @memberOf KJUR.asn1.DERAbstractTime\n * @function\n * @return {String} string value of this time object\n */\n this.getString = function() {\n\treturn this.s;\n };\n\n /**\n * set value by a string\n * @name setString\n * @memberOf KJUR.asn1.DERAbstractTime\n * @function\n * @param {String} newS value by a string to set such like \"130430235959Z\"\n */\n this.setString = function(newS) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = newS;\n\tthis.hV = stohex(this.s);\n };\n\n /**\n * set value by a Date object\n * @name setByDateValue\n * @memberOf KJUR.asn1.DERAbstractTime\n * @function\n * @param {Integer} year year of date (ex. 2013)\n * @param {Integer} month month of date between 1 and 12 (ex. 12)\n * @param {Integer} day day of month\n * @param {Integer} hour hours of date\n * @param {Integer} min minutes of date\n * @param {Integer} sec seconds of date\n */\n this.setByDateValue = function(year, month, day, hour, min, sec) {\n\tvar dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));\n\tthis.setByDate(dateObject);\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n};\nJSX.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);\n// == END DERAbstractTime ==================================================\n\n// == BEGIN DERAbstractStructured ============================================\n/**\n * base class for ASN.1 DER structured class\n * @name KJUR.asn1.DERAbstractStructured\n * @class base class for ASN.1 DER structured class\n * @property {Array} asn1Array internal array of ASN1Object\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERAbstractStructured = function(params) {\n KJUR.asn1.DERAbstractString.superclass.constructor.call(this);\n var asn1Array = null;\n\n /**\n * set value by array of ASN1Object\n * @name setByASN1ObjectArray\n * @memberOf KJUR.asn1.DERAbstractStructured\n * @function\n * @param {array} asn1ObjectArray array of ASN1Object to set\n */\n this.setByASN1ObjectArray = function(asn1ObjectArray) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.asn1Array = asn1ObjectArray;\n };\n\n /**\n * append an ASN1Object to internal array\n * @name appendASN1Object\n * @memberOf KJUR.asn1.DERAbstractStructured\n * @function\n * @param {ASN1Object} asn1Object to add\n */\n this.appendASN1Object = function(asn1Object) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.asn1Array.push(asn1Object);\n };\n\n this.asn1Array = new Array();\n if (typeof params != \"undefined\") {\n\tif (typeof params['array'] != \"undefined\") {\n\t this.asn1Array = params['array'];\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);\n\n\n// ********************************************************************\n// ASN.1 Object Classes\n// ********************************************************************\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Boolean\n * @name KJUR.asn1.DERBoolean\n * @class class for ASN.1 DER Boolean\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERBoolean = function() {\n KJUR.asn1.DERBoolean.superclass.constructor.call(this);\n this.hT = \"01\";\n this.hTLV = \"0101ff\";\n};\nJSX.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Integer\n * @name KJUR.asn1.DERInteger\n * @class class for ASN.1 DER Integer\n * @extends KJUR.asn1.ASN1Object\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>int - specify initial ASN.1 value(V) by integer value</li>\n * <li>bigint - specify initial ASN.1 value(V) by BigInteger object</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERInteger = function(params) {\n KJUR.asn1.DERInteger.superclass.constructor.call(this);\n this.hT = \"02\";\n\n /**\n * set value by Tom Wu's BigInteger object\n * @name setByBigInteger\n * @memberOf KJUR.asn1.DERInteger\n * @function\n * @param {BigInteger} bigIntegerValue to set\n */\n this.setByBigInteger = function(bigIntegerValue) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);\n };\n\n /**\n * set value by integer value\n * @name setByInteger\n * @memberOf KJUR.asn1.DERInteger\n * @function\n * @param {Integer} integer value to set\n */\n this.setByInteger = function(intValue) {\n\tvar bi = new BigInteger(String(intValue), 10);\n\tthis.setByBigInteger(bi);\n };\n\n /**\n * set value by integer value\n * @name setValueHex\n * @memberOf KJUR.asn1.DERInteger\n * @function\n * @param {String} hexadecimal string of integer value\n * @description\n * <br/>\n * NOTE: Value shall be represented by minimum octet length of\n * two's complement representation.\n */\n this.setValueHex = function(newHexString) {\n\tthis.hV = newHexString;\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['bigint'] != \"undefined\") {\n\t this.setByBigInteger(params['bigint']);\n\t} else if (typeof params['int'] != \"undefined\") {\n\t this.setByInteger(params['int']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setValueHex(params['hex']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER encoded BitString primitive\n * @name KJUR.asn1.DERBitString\n * @class class for ASN.1 DER encoded BitString primitive\n * @extends KJUR.asn1.ASN1Object\n * @description \n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>bin - specify binary string (ex. '10111')</li>\n * <li>array - specify array of boolean (ex. [true,false,true,true])</li>\n * <li>hex - specify hexadecimal string of ASN.1 value(V) including unused bits</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERBitString = function(params) {\n KJUR.asn1.DERBitString.superclass.constructor.call(this);\n this.hT = \"03\";\n\n /**\n * set ASN.1 value(V) by a hexadecimal string including unused bits\n * @name setHexValueIncludingUnusedBits\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {String} newHexStringIncludingUnusedBits\n */\n this.setHexValueIncludingUnusedBits = function(newHexStringIncludingUnusedBits) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.hV = newHexStringIncludingUnusedBits;\n };\n\n /**\n * set ASN.1 value(V) by unused bit and hexadecimal string of value\n * @name setUnusedBitsAndHexValue\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {Integer} unusedBits\n * @param {String} hValue\n */\n this.setUnusedBitsAndHexValue = function(unusedBits, hValue) {\n\tif (unusedBits < 0 || 7 < unusedBits) {\n\t throw \"unused bits shall be from 0 to 7: u = \" + unusedBits;\n\t}\n\tvar hUnusedBits = \"0\" + unusedBits;\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.hV = hUnusedBits + hValue;\n };\n\n /**\n * set ASN.1 DER BitString by binary string\n * @name setByBinaryString\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {String} binaryString binary value string (i.e. '10111')\n * @description\n * Its unused bits will be calculated automatically by length of \n * 'binaryValue'. <br/>\n * NOTE: Trailing zeros '0' will be ignored.\n */\n this.setByBinaryString = function(binaryString) {\n\tbinaryString = binaryString.replace(/0+$/, '');\n\tvar unusedBits = 8 - binaryString.length % 8;\n\tif (unusedBits == 8) unusedBits = 0;\n\tfor (var i = 0; i <= unusedBits; i++) {\n\t binaryString += '0';\n\t}\n\tvar h = '';\n\tfor (var i = 0; i < binaryString.length - 1; i += 8) {\n\t var b = binaryString.substr(i, 8);\n\t var x = parseInt(b, 2).toString(16);\n\t if (x.length == 1) x = '0' + x;\n\t h += x; \n\t}\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.hV = '0' + unusedBits + h;\n };\n\n /**\n * set ASN.1 TLV value(V) by an array of boolean\n * @name setByBooleanArray\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {array} booleanArray array of boolean (ex. [true, false, true])\n * @description\n * NOTE: Trailing falses will be ignored.\n */\n this.setByBooleanArray = function(booleanArray) {\n\tvar s = '';\n\tfor (var i = 0; i < booleanArray.length; i++) {\n\t if (booleanArray[i] == true) {\n\t\ts += '1';\n\t } else {\n\t\ts += '0';\n\t }\n\t}\n\tthis.setByBinaryString(s);\n };\n\n /**\n * generate an array of false with specified length\n * @name newFalseArray\n * @memberOf KJUR.asn1.DERBitString\n * @function\n * @param {Integer} nLength length of array to generate\n * @return {array} array of boolean faluse\n * @description\n * This static method may be useful to initialize boolean array.\n */\n this.newFalseArray = function(nLength) {\n\tvar a = new Array(nLength);\n\tfor (var i = 0; i < nLength; i++) {\n\t a[i] = false;\n\t}\n\treturn a;\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['hex'] != \"undefined\") {\n\t this.setHexValueIncludingUnusedBits(params['hex']);\n\t} else if (typeof params['bin'] != \"undefined\") {\n\t this.setByBinaryString(params['bin']);\n\t} else if (typeof params['array'] != \"undefined\") {\n\t this.setByBooleanArray(params['array']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER OctetString\n * @name KJUR.asn1.DEROctetString\n * @class class for ASN.1 DER OctetString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DEROctetString = function(params) {\n KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);\n this.hT = \"04\";\n};\nJSX.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Null\n * @name KJUR.asn1.DERNull\n * @class class for ASN.1 DER Null\n * @extends KJUR.asn1.ASN1Object\n * @description\n * @see KJUR.asn1.ASN1Object - superclass\n */\nKJUR.asn1.DERNull = function() {\n KJUR.asn1.DERNull.superclass.constructor.call(this);\n this.hT = \"05\";\n this.hTLV = \"0500\";\n};\nJSX.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER ObjectIdentifier\n * @name KJUR.asn1.DERObjectIdentifier\n * @class class for ASN.1 DER ObjectIdentifier\n * @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})\n * @extends KJUR.asn1.ASN1Object\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERObjectIdentifier = function(params) {\n var itox = function(i) {\n\tvar h = i.toString(16);\n\tif (h.length == 1) h = '0' + h;\n\treturn h;\n };\n var roidtox = function(roid) {\n\tvar h = '';\n\tvar bi = new BigInteger(roid, 10);\n\tvar b = bi.toString(2);\n\tvar padLen = 7 - b.length % 7;\n\tif (padLen == 7) padLen = 0;\n\tvar bPad = '';\n\tfor (var i = 0; i < padLen; i++) bPad += '0';\n\tb = bPad + b;\n\tfor (var i = 0; i < b.length - 1; i += 7) {\n\t var b8 = b.substr(i, 7);\n\t if (i != b.length - 7) b8 = '1' + b8;\n\t h += itox(parseInt(b8, 2));\n\t}\n\treturn h;\n }\n\n KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);\n this.hT = \"06\";\n\n /**\n * set value by a hexadecimal string\n * @name setValueHex\n * @memberOf KJUR.asn1.DERObjectIdentifier\n * @function\n * @param {String} newHexString hexadecimal value of OID bytes\n */\n this.setValueHex = function(newHexString) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = null;\n\tthis.hV = newHexString;\n };\n\n /**\n * set value by a OID string\n * @name setValueOidString\n * @memberOf KJUR.asn1.DERObjectIdentifier\n * @function\n * @param {String} oidString OID string (ex. 2.5.4.13)\n */\n this.setValueOidString = function(oidString) {\n\tif (! oidString.match(/^[0-9.]+$/)) {\n\t throw \"malformed oid string: \" + oidString;\n\t}\n\tvar h = '';\n\tvar a = oidString.split('.');\n\tvar i0 = parseInt(a[0]) * 40 + parseInt(a[1]);\n\th += itox(i0);\n\ta.splice(0, 2);\n\tfor (var i = 0; i < a.length; i++) {\n\t h += roidtox(a[i]);\n\t}\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.s = null;\n\tthis.hV = h;\n };\n\n /**\n * set value by a OID name\n * @name setValueName\n * @memberOf KJUR.asn1.DERObjectIdentifier\n * @function\n * @param {String} oidName OID name (ex. 'serverAuth')\n * @since 1.0.1\n * @description\n * OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.\n * Otherwise raise error.\n */\n this.setValueName = function(oidName) {\n\tif (typeof KJUR.asn1.x509.OID.name2oidList[oidName] != \"undefined\") {\n\t var oid = KJUR.asn1.x509.OID.name2oidList[oidName];\n\t this.setValueOidString(oid);\n\t} else {\n\t throw \"DERObjectIdentifier oidName undefined: \" + oidName;\n\t}\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['oid'] != \"undefined\") {\n\t this.setValueOidString(params['oid']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setValueHex(params['hex']);\n\t} else if (typeof params['name'] != \"undefined\") {\n\t this.setValueName(params['name']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER UTF8String\n * @name KJUR.asn1.DERUTF8String\n * @class class for ASN.1 DER UTF8String\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERUTF8String = function(params) {\n KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);\n this.hT = \"0c\";\n};\nJSX.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER NumericString\n * @name KJUR.asn1.DERNumericString\n * @class class for ASN.1 DER NumericString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERNumericString = function(params) {\n KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);\n this.hT = \"12\";\n};\nJSX.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER PrintableString\n * @name KJUR.asn1.DERPrintableString\n * @class class for ASN.1 DER PrintableString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERPrintableString = function(params) {\n KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);\n this.hT = \"13\";\n};\nJSX.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER TeletexString\n * @name KJUR.asn1.DERTeletexString\n * @class class for ASN.1 DER TeletexString\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERTeletexString = function(params) {\n KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);\n this.hT = \"14\";\n};\nJSX.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER IA5String\n * @name KJUR.asn1.DERIA5String\n * @class class for ASN.1 DER IA5String\n * @param {Array} params associative array of parameters (ex. {'str': 'aaa'})\n * @extends KJUR.asn1.DERAbstractString\n * @description\n * @see KJUR.asn1.DERAbstractString - superclass\n */\nKJUR.asn1.DERIA5String = function(params) {\n KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);\n this.hT = \"16\";\n};\nJSX.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER UTCTime\n * @name KJUR.asn1.DERUTCTime\n * @class class for ASN.1 DER UTCTime\n * @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})\n * @extends KJUR.asn1.DERAbstractTime\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * <li>date - specify Date object.</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n * <h4>EXAMPLES</h4>\n * @example\n * var d1 = new KJUR.asn1.DERUTCTime();\n * d1.setString('130430125959Z');\n *\n * var d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});\n *\n * var d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});\n */\nKJUR.asn1.DERUTCTime = function(params) {\n KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);\n this.hT = \"17\";\n\n /**\n * set value by a Date object\n * @name setByDate\n * @memberOf KJUR.asn1.DERUTCTime\n * @function\n * @param {Date} dateObject Date object to set ASN.1 value(V)\n */\n this.setByDate = function(dateObject) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.date = dateObject;\n\tthis.s = this.formatDate(this.date, 'utc');\n\tthis.hV = stohex(this.s);\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['str'] != \"undefined\") {\n\t this.setString(params['str']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setStringHex(params['hex']);\n\t} else if (typeof params['date'] != \"undefined\") {\n\t this.setByDate(params['date']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER GeneralizedTime\n * @name KJUR.asn1.DERGeneralizedTime\n * @class class for ASN.1 DER GeneralizedTime\n * @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})\n * @extends KJUR.asn1.DERAbstractTime\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')</li>\n * <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>\n * <li>date - specify Date object.</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERGeneralizedTime = function(params) {\n KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);\n this.hT = \"18\";\n\n /**\n * set value by a Date object\n * @name setByDate\n * @memberOf KJUR.asn1.DERGeneralizedTime\n * @function\n * @param {Date} dateObject Date object to set ASN.1 value(V)\n * @example\n * When you specify UTC time, use 'Date.UTC' method like this:<br/>\n * var o = new DERUTCTime();\n * var date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59\n * o.setByDate(date);\n */\n this.setByDate = function(dateObject) {\n\tthis.hTLV = null;\n\tthis.isModified = true;\n\tthis.date = dateObject;\n\tthis.s = this.formatDate(this.date, 'gen');\n\tthis.hV = stohex(this.s);\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['str'] != \"undefined\") {\n\t this.setString(params['str']);\n\t} else if (typeof params['hex'] != \"undefined\") {\n\t this.setStringHex(params['hex']);\n\t} else if (typeof params['date'] != \"undefined\") {\n\t this.setByDate(params['date']);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Sequence\n * @name KJUR.asn1.DERSequence\n * @class class for ASN.1 DER Sequence\n * @extends KJUR.asn1.DERAbstractStructured\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>array - specify array of ASN1Object to set elements of content</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERSequence = function(params) {\n KJUR.asn1.DERSequence.superclass.constructor.call(this, params);\n this.hT = \"30\";\n this.getFreshValueHex = function() {\n\tvar h = '';\n\tfor (var i = 0; i < this.asn1Array.length; i++) {\n\t var asn1Obj = this.asn1Array[i];\n\t h += asn1Obj.getEncodedHex();\n\t}\n\tthis.hV = h;\n\treturn this.hV;\n };\n};\nJSX.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER Set\n * @name KJUR.asn1.DERSet\n * @class class for ASN.1 DER Set\n * @extends KJUR.asn1.DERAbstractStructured\n * @description\n * <br/>\n * As for argument 'params' for constructor, you can specify one of\n * following properties:\n * <ul>\n * <li>array - specify array of ASN1Object to set elements of content</li>\n * </ul>\n * NOTE: 'params' can be omitted.\n */\nKJUR.asn1.DERSet = function(params) {\n KJUR.asn1.DERSet.superclass.constructor.call(this, params);\n this.hT = \"31\";\n this.getFreshValueHex = function() {\n\tvar a = new Array();\n\tfor (var i = 0; i < this.asn1Array.length; i++) {\n\t var asn1Obj = this.asn1Array[i];\n\t a.push(asn1Obj.getEncodedHex());\n\t}\n\ta.sort();\n\tthis.hV = a.join('');\n\treturn this.hV;\n };\n};\nJSX.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);\n\n// ********************************************************************\n/**\n * class for ASN.1 DER TaggedObject\n * @name KJUR.asn1.DERTaggedObject\n * @class class for ASN.1 DER TaggedObject\n * @extends KJUR.asn1.ASN1Object\n * @description\n * <br/>\n * Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.\n * For example, if you find '[1]' tag in a ASN.1 dump, \n * 'tagNoHex' will be 'a1'.\n * <br/>\n * As for optional argument 'params' for constructor, you can specify *ANY* of\n * following properties:\n * <ul>\n * <li>explicit - specify true if this is explicit tag otherwise false \n * (default is 'true').</li>\n * <li>tag - specify tag (default is 'a0' which means [0])</li>\n * <li>obj - specify ASN1Object which is tagged</li>\n * </ul>\n * @example\n * d1 = new KJUR.asn1.DERUTF8String({'str':'a'});\n * d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});\n * hex = d2.getEncodedHex();\n */\nKJUR.asn1.DERTaggedObject = function(params) {\n KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);\n this.hT = \"a0\";\n this.hV = '';\n this.isExplicit = true;\n this.asn1Object = null;\n\n /**\n * set value by an ASN1Object\n * @name setString\n * @memberOf KJUR.asn1.DERTaggedObject\n * @function\n * @param {Boolean} isExplicitFlag flag for explicit/implicit tag\n * @param {Integer} tagNoHex hexadecimal string of ASN.1 tag\n * @param {ASN1Object} asn1Object ASN.1 to encapsulate\n */\n this.setASN1Object = function(isExplicitFlag, tagNoHex, asn1Object) {\n\tthis.hT = tagNoHex;\n\tthis.isExplicit = isExplicitFlag;\n\tthis.asn1Object = asn1Object;\n\tif (this.isExplicit) {\n\t this.hV = this.asn1Object.getEncodedHex();\n\t this.hTLV = null;\n\t this.isModified = true;\n\t} else {\n\t this.hV = null;\n\t this.hTLV = asn1Object.getEncodedHex();\n\t this.hTLV = this.hTLV.replace(/^../, tagNoHex);\n\t this.isModified = false;\n\t}\n };\n\n this.getFreshValueHex = function() {\n\treturn this.hV;\n };\n\n if (typeof params != \"undefined\") {\n\tif (typeof params['tag'] != \"undefined\") {\n\t this.hT = params['tag'];\n\t}\n\tif (typeof params['explicit'] != \"undefined\") {\n\t this.isExplicit = params['explicit'];\n\t}\n\tif (typeof params['obj'] != \"undefined\") {\n\t this.asn1Object = params['obj'];\n\t this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);\n\t}\n }\n};\nJSX.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);"
  1374. }
  1375. ],
  1376. "filteredModules": 0,
  1377. "children": []
  1378. }