vendor: 10,748 bytes, lines 1-416
1(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["chunk-vendors~189652d8"],{ 2 3/***/ "20f65": 4/***/ (function(module, exports, __webpack_require__) { 5 6var decoders = exports; 7 8decoders.der = __webpack_require__("cfbd"); 9decoders.pem = __webpack_require__("8df7"); 10 11 12/***/ }), 13 14/***/ "343e": 15/***/ (function(module, exports, __webpack_require__) { 16 17var encoders = exports; 18 19encoders.der = __webpack_require__("3768"); 20encoders.pem = __webpack_require__("85b3"); 21 22 23/***/ }), 24 25/***/ "3768": 26/***/ (function(module, exports, __webpack_require__) { 27 28var inherits = __webpack_require__("3fb5"); 29var Buffer = __webpack_require__("b639").Buffer; 30 31var asn1 = __webpack_require__("7f7a"); 32var base = asn1.base; 33 34// Import DER constants 35var der = asn1.constants.der; 36 37function DEREncoder(entity) { 38 this.enc = 'der'; 39 this.name = entity.name; 40 this.entity = entity; 41 42 // Construct base tree 43 this.tree = new DERNode(); 44 this.tree._init(entity.body); 45}; 46module.exports = DEREncoder; 47 48DEREncoder.prototype.encode = function encode(data, reporter) { 49 return this.tree._encode(data, reporter).join(); 50}; 51 52// Tree methods 53 54function DERNode(parent) { 55 base.Node.call(this, 'der', parent); 56} 57inherits(DERNode, base.Node); 58 59DERNode.prototype._encodeComposite = function encodeComposite(tag, 60 primitive, 61 cls, 62 content) { 63 var encodedTag = encodeTag(tag, primitive, cls, this.reporter); 64 65 // Short form 66 if (content.length < 0x80) { 67 var header = new Buffer(2); 68 header[0] = encodedTag; 69 header[1] = content.length; 70 return this._createEncoderBuffer([ header, content ]); 71 } 72 73 // Long form 74 // Count octets required to store length 75 var lenOctets = 1; 76 for (var i = content.length; i >= 0x100; i >>= 8) 77 lenOctets++; 78 79 var header = new Buffer(1 + 1 + lenOctets); 80 header[0] = encodedTag; 81 header[1] = 0x80 | lenOctets; 82 83 for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) 84 header[i] = j & 0xff; 85 86 return this._createEncoderBuffer([ header, content ]); 87}; 88 89DERNode.prototype._encodeStr = function encodeStr(str, tag) { 90 if (tag === 'bitstr') { 91 return this._createEncoderBuffer([ str.unused | 0, str.data ]); 92 } else if (tag === 'bmpstr') { 93 var buf = new Buffer(str.length * 2); 94 for (var i = 0; i < str.length; i++) { 95 buf.writeUInt16BE(str.charCodeAt(i), i * 2); 96 } 97 return this._createEncoderBuffer(buf); 98 } else if (tag === 'numstr') { 99 if (!this._isNumstr(str)) { 100 return this.reporter.error('Encoding of string type: numstr supports ' + 101 'only digits and space'); 102 } 103 return this._createEncoderBuffer(str); 104 } else if (tag === 'printstr') { 105 if (!this._isPrintstr(str)) { 106 return this.reporter.error('Encoding of string type: printstr supports ' + 107 'only latin upper and lower case letters, ' + 108 'digits, space, apostrophe, left and rigth ' + 109 'parenthesis, plus sign, comma, hyphen, ' + 110 'dot, slash, colon, equal sign, ' + 111 'question mark'); 112 } 113 return this._createEncoderBuffer(str); 114 } else if (/str$/.test(tag)) { 115 return this._createEncoderBuffer(str); 116 } else if (tag === 'objDesc') { 117 return this._createEncoderBuffer(str); 118 } else { 119 return this.reporter.error('Encoding of string type: ' + tag + 120 ' unsupported'); 121 } 122}; 123 124DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) { 125 if (typeof id === 'string') { 126 if (!values) 127 return this.reporter.error('string objid given, but no values map found'); 128 if (!values.hasOwnProperty(id)) 129 return this.reporter.error('objid not found in values map'); 130 id = values[id].split(/[\s\.]+/g); 131 for (var i = 0; i < id.length; i++) 132 id[i] |= 0; 133 } else if (Array.isArray(id)) { 134 id = id.slice(); 135 for (var i = 0; i < id.length; i++) 136 id[i] |= 0; 137 } 138 139 if (!Array.isArray(id)) { 140 return this.reporter.error('objid() should be either array or string, ' + 141 'got: ' + JSON.stringify(id)); 142 } 143 144 if (!relative) { 145 if (id[1] >= 40) 146 return this.reporter.error('Second objid identifier OOB'); 147 id.splice(0, 2, id[0] * 40 + id[1]); 148 } 149 150 // Count number of octets 151 var size = 0; 152 for (var i = 0; i < id.length; i++) { 153 var ident = id[i]; 154 for (size++; ident >= 0x80; ident >>= 7) 155 size++; 156 } 157 158 var objid = new Buffer(size); 159 var offset = objid.length - 1; 160 for (var i = id.length - 1; i >= 0; i--) { 161 var ident = id[i]; 162 objid[offset--] = ident & 0x7f; 163 while ((ident >>= 7) > 0) 164 objid[offset--] = 0x80 | (ident & 0x7f); 165 } 166 167 return this._createEncoderBuffer(objid); 168}; 169 170function two(num) { 171 if (num < 10) 172 return '0' + num; 173 else 174 return num; 175} 176 177DERNode.prototype._encodeTime = function encodeTime(time, tag) { 178 var str; 179 var date = new Date(time); 180 181 if (tag === 'gentime') { 182 str = [ 183 two(date.getFullYear()), 184 two(date.getUTCMonth() + 1), 185 two(date.getUTCDate()), 186 two(date.getUTCHours()), 187 two(date.getUTCMinutes()), 188 two(date.getUTCSeconds()), 189 'Z' 190 ].join(''); 191 } else if (tag === 'utctime') { 192 str = [ 193 two(date.getFullYear() % 100), 194 two(date.getUTCMonth() + 1), 195 two(date.getUTCDate()), 196 two(date.getUTCHours()), 197 two(date.getUTCMinutes()), 198 two(date.getUTCSeconds()), 199 'Z' 200 ].join(''); 201 } else { 202 this.reporter.error('Encoding ' + tag + ' time is not supported yet'); 203 } 204 205 return this._encodeStr(str, 'octstr'); 206}; 207 208DERNode.prototype._encodeNull = function encodeNull() { 209 return this._createEncoderBuffer(''); 210}; 211 212DERNode.prototype._encodeInt = function encodeInt(num, values) { 213 if (typeof num === 'string') { 214 if (!values) 215 return this.reporter.error('String int or enum given, but no values map'); 216 if (!values.hasOwnProperty(num)) { 217 return this.reporter.error('Values map doesn\'t contain: ' + 218 JSON.stringify(num)); 219 } 220 num = values[num]; 221 } 222 223 // Bignum, assume big endian 224 if (typeof num !== 'number' && !Buffer.isBuffer(num)) { 225 var numArray = num.toArray(); 226 if (!num.sign && numArray[0] & 0x80) { 227 numArray.unshift(0); 228 } 229 num = new Buffer(numArray); 230 } 231 232 if (Buffer.isBuffer(num)) { 233 var size = num.length; 234 if (num.length === 0) 235 size++; 236 237 var out = new Buffer(size); 238 num.copy(out); 239 if (num.length === 0) 240 out[0] = 0 241 return this._createEncoderBuffer(out); 242 } 243 244 if (num < 0x80) 245 return this._createEncoderBuffer(num); 246 247 if (num < 0x100) 248 return this._createEncoderBuffer([0, num]); 249 250 var size = 1; 251 for (var i = num; i >= 0x100; i >>= 8) 252 size++; 253 254 var out = new Array(size); 255 for (var i = out.length - 1; i >= 0; i--) { 256 out[i] = num & 0xff; 257 num >>= 8; 258 } 259 if(out[0] & 0x80) { 260 out.unshift(0); 261 } 262 263 return this._createEncoderBuffer(new Buffer(out)); 264}; 265 266DERNode.prototype._encodeBool = function encodeBool(value) { 267 return this._createEncoderBuffer(value ? 0xff : 0); 268}; 269 270DERNode.prototype._use = function use(entity, obj) { 271 if (typeof entity === 'function') 272 entity = entity(obj); 273 return entity._getEncoder('der').tree; 274}; 275 276DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) { 277 var state = this._baseState; 278 var i; 279 if (state['default'] === null) 280 return false; 281 282 var data = dataBuffer.join(); 283 if (state.defaultBuffer === undefined) 284 state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join(); 285 286 if (data.length !== state.defaultBuffer.length) 287 return false; 288 289 for (i=0; i < data.length; i++) 290 if (data[i] !== state.defaultBuffer[i]) 291 return false; 292 293 return true; 294}; 295 296// Utility methods 297 298function encodeTag(tag, primitive, cls, reporter) { 299 var res; 300 301 if (tag === 'seqof') 302 tag = 'seq'; 303 else if (tag === 'setof') 304 tag = 'set'; 305 306 if (der.tagByName.hasOwnProperty(tag)) 307 res = der.tagByName[tag]; 308 else if (typeof tag === 'number' && (tag | 0) === tag) 309 res = tag; 310 else 311 return reporter.error('Unknown tag: ' + tag); 312 313 if (res >= 0x1f) 314 return reporter.error('Multi-octet tag encoding unsupported'); 315 316 if (!primitive) 317 res |= 0x20; 318 319 res |= (der.tagClassByName[cls || 'universal'] << 6); 320 321 return res; 322} 323 324 325/***/ }), 326 327/***/ "85b3": 328/***/ (function(module, exports, __webpack_require__) { 329 330var inherits = __webpack_require__("3fb5"); 331 332var DEREncoder = __webpack_require__("3768"); 333 334function PEMEncoder(entity) { 335 DEREncoder.call(this, entity); 336 this.enc = 'pem'; 337}; 338inherits(PEMEncoder, DEREncoder); 339module.exports = PEMEncoder; 340 341PEMEncoder.prototype.encode = function encode(data, options) { 342 var buf = DEREncoder.prototype.encode.call(this, data); 343 344 var p = buf.toString('base64'); 345 var out = [ '-----BEGIN ' + options.label + '-----' ]; 346 for (var i = 0; i < p.length; i += 64) 347 out.push(p.slice(i, i + 64)); 348 out.push('-----END ' + options.label + '-----'); 349 return out.join('\n'); 350}; 351 352 353/***/ }), 354 355/***/ "8df7": 356/***/ (function(module, exports, __webpack_require__) { 357 358var inherits = __webpack_require__("3fb5"); 359var Buffer = __webpack_require__("b639").Buffer; 360 361var DERDecoder = __webpack_require__("cfbd"); 362 363function PEMDecoder(entity) { 364 DERDecoder.call(this, entity); 365 this.enc = 'pem'; 366}; 367inherits(PEMDecoder, DERDecoder); 368module.exports = PEMDecoder; 369 370PEMDecoder.prototype.decode = function decode(data, options) { 371 var lines = data.toString().split(/[\r\n]+/g); 372 373 var label = options.label.toUpperCase(); 374 375 var re = /^-----(BEGIN|END) ([^-]+)-----$/; 376 var start = -1; 377 var end = -1; 378 for (var i = 0; i < lines.length; i++) { 379 var match = lines[i].match(re); 380 if (match === null) 381 continue; 382 383 if (match[2] !== label) 384 continue; 385 386 if (start === -1) { 387 if (match[1] !== 'BEGIN') 388 break; 389 start = i; 390 } else { 391 if (match[1] !== 'END') 392 break; 393 end = i; 394 break; 395 } 396 } 397 if (start === -1 || end === -1) 398 throw new Error('PEM section not found for: ' + label); 399 400 var base64 = lines.slice(start + 1, end).join(''); 401 // Remove excessive symbols 402 base64.replace(/[^a-z0-9\+\/=]+/gi, ''); 403 404 var input = new Buffer(base64, 'base64'); 405 return DERDecoder.prototype.decode.call(this, input, options); 406}; 407 408 409/***/ }), 410 411/***/ "cfbd": 412/***/ (function(module, exports, __webpack_require__) { 413 414var inherits = __webpack_require__("3fb5"); 415 416var asn1 = __webpack_require__("7f7a"
vendor: 7,981 bytes, lines 416-740
416); 417var base = asn1.base; 418var bignum = asn1.bignum; 419 420// Import DER constants 421var der = asn1.constants.der; 422 423function DERDecoder(entity) { 424 this.enc = 'der'; 425 this.name = entity.name; 426 this.entity = entity; 427 428 // Construct base tree 429 this.tree = new DERNode(); 430 this.tree._init(entity.body); 431}; 432module.exports = DERDecoder; 433 434DERDecoder.prototype.decode = function decode(data, options) { 435 if (!(data instanceof base.DecoderBuffer)) 436 data = new base.DecoderBuffer(data, options); 437 438 return this.tree._decode(data, options); 439}; 440 441// Tree methods 442 443function DERNode(parent) { 444 base.Node.call(this, 'der', parent); 445} 446inherits(DERNode, base.Node); 447 448DERNode.prototype._peekTag = function peekTag(buffer, tag, any) { 449 if (buffer.isEmpty()) 450 return false; 451 452 var state = buffer.save(); 453 var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"'); 454 if (buffer.isError(decodedTag)) 455 return decodedTag; 456 457 buffer.restore(state); 458 459 return decodedTag.tag === tag || decodedTag.tagStr === tag || 460 (decodedTag.tagStr + 'of') === tag || any; 461}; 462 463DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) { 464 var decodedTag = derDecodeTag(buffer, 465 'Failed to decode tag of "' + tag + '"'); 466 if (buffer.isError(decodedTag)) 467 return decodedTag; 468 469 var len = derDecodeLen(buffer, 470 decodedTag.primitive, 471 'Failed to get length of "' + tag + '"'); 472 473 // Failure 474 if (buffer.isError(len)) 475 return len; 476 477 if (!any && 478 decodedTag.tag !== tag && 479 decodedTag.tagStr !== tag && 480 decodedTag.tagStr + 'of' !== tag) { 481 return buffer.error('Failed to match tag: "' + tag + '"'); 482 } 483 484 if (decodedTag.primitive || len !== null) 485 return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); 486 487 // Indefinite length... find END tag 488 var state = buffer.save(); 489 var res = this._skipUntilEnd( 490 buffer, 491 'Failed to skip indefinite length body: "' + this.tag + '"'); 492 if (buffer.isError(res)) 493 return res; 494 495 len = buffer.offset - state.offset; 496 buffer.restore(state); 497 return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); 498}; 499 500DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) { 501 while (true) { 502 var tag = derDecodeTag(buffer, fail); 503 if (buffer.isError(tag)) 504 return tag; 505 var len = derDecodeLen(buffer, tag.primitive, fail); 506 if (buffer.isError(len)) 507 return len; 508 509 var res; 510 if (tag.primitive || len !== null) 511 res = buffer.skip(len) 512 else 513 res = this._skipUntilEnd(buffer, fail); 514 515 // Failure 516 if (buffer.isError(res)) 517 return res; 518 519 if (tag.tagStr === 'end') 520 break; 521 } 522}; 523 524DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder, 525 options) { 526 var result = []; 527 while (!buffer.isEmpty()) { 528 var possibleEnd = this._peekTag(buffer, 'end'); 529 if (buffer.isError(possibleEnd)) 530 return possibleEnd; 531 532 var res = decoder.decode(buffer, 'der', options); 533 if (buffer.isError(res) && possibleEnd) 534 break; 535 result.push(res); 536 } 537 return result; 538}; 539 540DERNode.prototype._decodeStr = function decodeStr(buffer, tag) { 541 if (tag === 'bitstr') { 542 var unused = buffer.readUInt8(); 543 if (buffer.isError(unused)) 544 return unused; 545 return { unused: unused, data: buffer.raw() }; 546 } else if (tag === 'bmpstr') { 547 var raw = buffer.raw(); 548 if (raw.length % 2 === 1) 549 return buffer.error('Decoding of string type: bmpstr length mismatch'); 550 551 var str = ''; 552 for (var i = 0; i < raw.length / 2; i++) { 553 str += String.fromCharCode(raw.readUInt16BE(i * 2)); 554 } 555 return str; 556 } else if (tag === 'numstr') { 557 var numstr = buffer.raw().toString('ascii'); 558 if (!this._isNumstr(numstr)) { 559 return buffer.error('Decoding of string type: ' + 560 'numstr unsupported characters'); 561 } 562 return numstr; 563 } else if (tag === 'octstr') { 564 return buffer.raw(); 565 } else if (tag === 'objDesc') { 566 return buffer.raw(); 567 } else if (tag === 'printstr') { 568 var printstr = buffer.raw().toString('ascii'); 569 if (!this._isPrintstr(printstr)) { 570 return buffer.error('Decoding of string type: ' + 571 'printstr unsupported characters'); 572 } 573 return printstr; 574 } else if (/str$/.test(tag)) { 575 return buffer.raw().toString(); 576 } else { 577 return buffer.error('Decoding of string type: ' + tag + ' unsupported'); 578 } 579}; 580 581DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) { 582 var result; 583 var identifiers = []; 584 var ident = 0; 585 while (!buffer.isEmpty()) { 586 var subident = buffer.readUInt8(); 587 ident <<= 7; 588 ident |= subident & 0x7f; 589 if ((subident & 0x80) === 0) { 590 identifiers.push(ident); 591 ident = 0; 592 } 593 } 594 if (subident & 0x80) 595 identifiers.push(ident); 596 597 var first = (identifiers[0] / 40) | 0; 598 var second = identifiers[0] % 40; 599 600 if (relative) 601 result = identifiers; 602 else 603 result = [first, second].concat(identifiers.slice(1)); 604 605 if (values) { 606 var tmp = values[result.join(' ')]; 607 if (tmp === undefined) 608 tmp = values[result.join('.')]; 609 if (tmp !== undefined) 610 result = tmp; 611 } 612 613 return result; 614}; 615 616DERNode.prototype._decodeTime = function decodeTime(buffer, tag) { 617 var str = buffer.raw().toString(); 618 if (tag === 'gentime') { 619 var year = str.slice(0, 4) | 0; 620 var mon = str.slice(4, 6) | 0; 621 var day = str.slice(6, 8) | 0; 622 var hour = str.slice(8, 10) | 0; 623 var min = str.slice(10, 12) | 0; 624 var sec = str.slice(12, 14) | 0; 625 } else if (tag === 'utctime') { 626 var year = str.slice(0, 2) | 0; 627 var mon = str.slice(2, 4) | 0; 628 var day = str.slice(4, 6) | 0; 629 var hour = str.slice(6, 8) | 0; 630 var min = str.slice(8, 10) | 0; 631 var sec = str.slice(10, 12) | 0; 632 if (year < 70) 633 year = 2000 + year; 634 else 635 year = 1900 + year; 636 } else { 637 return buffer.error('Decoding ' + tag + ' time is not supported yet'); 638 } 639 640 return Date.UTC(year, mon - 1, day, hour, min, sec, 0); 641}; 642 643DERNode.prototype._decodeNull = function decodeNull(buffer) { 644 return null; 645}; 646 647DERNode.prototype._decodeBool = function decodeBool(buffer) { 648 var res = buffer.readUInt8(); 649 if (buffer.isError(res)) 650 return res; 651 else 652 return res !== 0; 653}; 654 655DERNode.prototype._decodeInt = function decodeInt(buffer, values) { 656 // Bigint, return as it is (assume big endian) 657 var raw = buffer.raw(); 658 var res = new bignum(raw); 659 660 if (values) 661 res = values[res.toString(10)] || res; 662 663 return res; 664}; 665 666DERNode.prototype._use = function use(entity, obj) { 667 if (typeof entity === 'function') 668 entity = entity(obj); 669 return entity._getDecoder('der').tree; 670}; 671 672// Utility methods 673 674function derDecodeTag(buf, fail) { 675 var tag = buf.readUInt8(fail); 676 if (buf.isError(tag)) 677 return tag; 678 679 var cls = der.tagClass[tag >> 6]; 680 var primitive = (tag & 0x20) === 0; 681 682 // Multi-octet tag - load 683 if ((tag & 0x1f) === 0x1f) { 684 var oct = tag; 685 tag = 0; 686 while ((oct & 0x80) === 0x80) { 687 oct = buf.readUInt8(fail); 688 if (buf.isError(oct)) 689 return oct; 690 691 tag <<= 7; 692 tag |= oct & 0x7f; 693 } 694 } else { 695 tag &= 0x1f; 696 } 697 var tagStr = der.tag[tag]; 698 699 return { 700 cls: cls, 701 primitive: primitive, 702 tag: tag, 703 tagStr: tagStr 704 }; 705} 706 707function derDecodeLen(buf, primitive, fail) { 708 var len = buf.readUInt8(fail); 709 if (buf.isError(len)) 710 return len; 711 712 // Indefinite form 713 if (!primitive && len === 0x80) 714 return null; 715 716 // Definite form 717 if ((len & 0x80) === 0) { 718 // Short form 719 return len; 720 } 721 722 // Long form 723 var num = len & 0x7f; 724 if (num > 4) 725 return buf.error('length octect is too long'); 726 727 len = 0; 728 for (var i = 0; i < num; i++) { 729 len <<= 8; 730 var j = buf.readUInt8(fail); 731 if (buf.isError(j)) 732 return j; 733 len |= j; 734 } 735 736 return len; 737} 738 739 740/***/ })
740 741 742}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.