mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 14:45:52 -05:00
1120 lines
569 KiB
HTML
1120 lines
569 KiB
HTML
<!DOCTYPE html><html style=height:100%><head><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="text/html;charset=utf-8" http-equiv=Content-Type><meta name=format-detection content="telephone=no"><link rel="icon" type=image/png href="data:image/png;base64,iVBORw0KGgo="><style>body{height:100%;max-height:100%;overflow:hidden;font-family:arial, helvetica, sans-serif;font-size:9pt;color:black;background:white;margin-top:0;margin-left:0;margin-right:0;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}li{margin:0;padding:0;}label{display:block;color:windowtext;background-color:window;margin:0;padding:0;width:100%;}label:hover{background-color:highlight;color:highlighttext;}a:visited{text-decoration:none;color:#04f;}a:link{text-decoration:none;color:#04f;}a:hover{color:#a32;}h1{font-size:11pt;font-weight:bold;color:black;margin-left:5px;margin-top:10px;margin-bottom:6px;}h2{font-size:9pt;font-weight:bold;color:black;margin-left:6px;margin-top:6px;margin-bottom:0;}p{margin-left:6px;margin-top:4px;margin-bottom:0;margin-right:2px;}td{font-size:9pt;}th{font-size:9pt;}th:hover{cursor:pointer;background:#aaa;}.header{position:fixed;top:0;left:0;right:0;height:24px;background:#c0c0c0;}.progressbar{position:fixed;top:24px;left:0;right:0;height:2px;background:#ff9e30;}.in{margin-left:40px;}.log{background:#bbbab5;}.log1{background:#bbbab5;}.log tbody tr:nth-child(odd){background:#e8eefe;}.fullcell{position:fixed;top:26px;right:0;bottom:0;left:0px;overflow:hidden;}.maincell{position:fixed;top:26px;right:0;bottom:0;left:156px;overflow:auto;padding-left:2px;vertical-align:top;}.navbar{position:fixed;top:26px;left:0;bottom:0;width:156px;border-right:2px solid #ff9e30;vertical-align:top;background:#72726f;background:linear-gradient(45deg, #72726f 0%,#a6a5a0 100%);}.nav1{padding:1px 0px 1px 8px;margin:0px;font-weight:bold;color:black;white-space:nowrap;cursor:pointer;}.nav2{margin-left:32px;margin-top:0;color:black;cursor:pointer;}.r{font-size:11pt;}.r0{background:white;}.r1{border-bottom:1px solid gray;text-align:left;}.r2{text-align:left;}.r3{border-bottom:1px solid gray;text-align:left;}.r3:hover{background-color:#83827b;cursor:pointer;}.spread{height:100%;width:100%;background-color:white;}.timer{border:1px solid #abcae1;background-color:#abcae1;}.tm{font-size:7pt;}.top1{font-size:14pt;font-weight:bold;color:white;margin-top:11px;}.top2{color:white;}.warn{font-weight:bold;color:#c00000;}.icon1{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAMISURBVHjadJPPb9t0GMY//rbJaEKSxoPFQQ1WxhQ7RaGoIDEpTBMqgk7iBvwNKJdJXDnssEMl7pMGfwOH9YBYh0AglYiBBNKa0cSGNpiRxs7aJE2aH7aTmkPXqTvwXt7L8z56pef5SEEQcHYMwyjWarX3rLr1tu3YOQAlpZhqVv1J1/VvNU0rn9VLpwbtdlspb5ZLNdNcuZBKF1NKmuS8DECn28axm7ScZlnP5b4vXinelmXZfmrQbreVjbsbN3r9YSmTLbA/Ps92K8FgFAbAdYcsLXRRk10af/9BPBa5vXpt9aYsy7YAKG+WS73+sJS+eJmKneZe5QWEiHHreoJb1xNEInHu/Bzw3cM45zNv0usPS+XNcglAGIZRrJnmSiZbYOtRhF93ZvHcHoPRlN3GkL4Ho5HHeOxRqbv8sHVM+uVFaqa5YhhGUVpfXw+6hwP86DJ3fgkzK44hOGZuLkH7KIQIxuw9dkk812Hqu0wmPh9djZIKG8wnogirbpFS0jy0YOqPcMcurjvh3Vc7fPHpHF9//iLLyja75p/sNWxazj73t9qklDRW3ULYjk1yXmb3Xw/P9fA9n35/AMD0yAIgGQ8zOtxnMhFM/ClG/YjkvIzt2Mye5un5Lr4HY9el5RwA2tOsY9FzCCFBICCYOdlPRigphU63jZKEwWDAweMDJt7kmXINBhOkIEAQQiLMpczzJzcpBaFmVRy7iZ4RdA/7TKcBknTymOd5APT6PiAhghlmpHO8ocdw7CZqVkXour7Ycppriwsuy7koEgKQANDy+dPCIokQkhTiciFG4aJPy2mu6bq+OKtpWlXPmZWGtc2H77yOhOD+gxE7//T45sdHzEjQ7Y0IgmPeKszxwdUwTuM39Fyuomla9bTKyY27Gx/3+sMvlYU8lXqI36sef+1UkCS4pMZZyuu89oqL09gmHot8snpt9StZljtnYUqWN8vv10yzcCGV/ux/YFrTc7lK8UrxnizLnWdoPINzvlarLVl1K2879ktPcN5Ts2pV1/UHmqZVz+r/GwBWYYCoNUz0KwAAAABJRU5ErkJggg==");}.icon2{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAIuSURBVHjalJNBTBNBFIb/2S4tlliFdLBNW0mktibaeivBm9eejFeDZw81kROXHj2SyIEDB65wI3iBI5iYmEjSREtIpI1tQdOm20KBdkuX3ZnnYUVq2Cb6kklm3vxv3vdm3oCI4DTazZ3p3HpM5NZjot3cmR6kY0QEJ9vdnNJcaoMP3xyB3vI2EunP4046xcl5WttK99olHn4URSA2AaNT5qe1rbST1pFgd3NKU93H/P6TJADg8GthIMU1gqODtZlep8QjiegfXzBuUxwdrM1cy9Z/IVIYSn4jpe1vx8jsviAABIBM/Tl9/5Sg/EZKk8JQ+mP+ImiUVjJGp8xDDycB2b1KIgSC0RCMTpk3SisZxxKkpXvqhaXs7aAfnhtukBBXKmFCHVLgj4yjXljKSkv3XDugXlyeM/QKDz24CxIWSJhXBKYJMk2MT3AYeoXXi8tzl3sqAFgXLV+zvJrxhzkUqwdxQQARZl+FbbqeXY7CGHjEj2Z5NcMnXy6o7tEzRkT4mX/7Tisuvok/joBJC5ACl8/LmAIov0EVBZIYvn35gUD89UI4mZ1lRrca2N9+lh8bPeG3RgCyTEBKgAi+1CEAoJ27B6gqGGMAY2idCbRORhvxp++TanVvviaMQ/g8XshzAxACIIn+/pLGOWAqYIoLAODzuKB1K7y6N19j+Y0U3fG3MCw6IMsCyM4Oxvob1l4ze84YQ5u8OD7jUNWhMXz4uI//tx4Syfjg3/iv9msAKbs79bi84QcAAAAASUVORK5CYII=");}.icon3{width:14px;height:15px;background-repeat:no-repeat;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAEZ0FNQQAAsY58+1GTAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAANGSURBVHjadJNNTBwFAIW//UFWfrbsgDuzBTvu0s6OWhHwYMhCOEAbSESC4dpL07TFg9GkxIRDjT3YhEBNPUjC0SbaJjVNQyJQaxtDpzYmlDYUOjuUrhspO0N0gQVWl/0ZD5ZmPfiSd3t5l/c+h23bFCsajR7Rdf1GPBbHtEwAJFFCDsqoqno0HA7/WJx37BUkk8k6bUYb0g2jxy8G6kQpgK9KAGB9I4llJlizEiuqokxE2iJfCIKw8qIgmUzWTU1OfZXaSve9KQep3tzA9fQJhfhvZHd3yfl85OUg26F6os9W8FaWXevq7vpIEIQVJ4A2ow2lttJ9LTU1hH64Tt1qHHv8a0rnH/LS4iPsK9/iixnUXr1Ck3cfqa10nzajDQG4o9HoEd0wet493Ij/zm18n3yMJxQivbND7Px58thUD3xI+egoBcMgd+FLlO73mTUWe5Ro9Jqrs7Nz2eUu9YbSacriT8lms5Q3NlLR3s6uaVJQFISRC1SUuFm9dInJ6WlCfpGMFPBub6eOueOxOMobb+H4+Ta/f3cZz927FPJ5hOPHqRkZgT/+xFniIjY6yveDg0gOB9l6BbHpBMbiPE7TMvFVCWSXl3DU7secnWXu9GniFy+ymctRIfhYHxvj6pkzBG2bA0Du8SN8VQKmZeLc2zOXybA2P8+mbeNpbydTWUmJ203etvGIInV+PxVA9t/pXvzALYkS6xtJqoRq/rJtqoNB/KdO8Up/P+atWxSA8t5e3vN6mT55kgOrq5TUH2J9I4kkSjjloIxlJiiEDiK2tREYHkbq7yd57x6XOzr4paMD59IS+7q7+WB8nPtuNyVN72CZCeSgjFNV1dY1K6H9fbiBDWk/uwsL5G7e5JuWFhTgVUBrbmZX11memyMgv0a64W3WrISmqmqrw7ZtJq5PfP4sYZ0Nl5ayPjJM4fECKdtGAF5+bt3pxBt+HWXwU37NZKgNiOd6ens+27uyNDU5dTa1lR44JAXwPHiA/fA++ScGTsB1UMHV1MxOQyOGmcBbWTbW1d11ThAEsxgmSZvRBnTD6PCLgcj/wKSpivJTpC0yJgiC+R8ai3CO6Lp+NB6Lt5qWqTzH2ZCD8h1VVW+Ew2GtOP/PAFZGexs+cGPjAAAAAElFTkSuQmCC");}.itemBar{padding:7px;min-height:20px;margin-top:4px;margin-right:8px;width:auto;border-radius:8px;background-color:#7e7d74;cursor:pointer;}.computeritem{cursor:pointer;width:auto;border-radius:5px;background-color:#a6a5a0;height:28px;margin:4px;padding:2px;}.computeritem:hover{background-color:#83827b;}.us{-webkit-touch-callout:initial;-webkit-user-select:auto;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}</style><body onunload="cleanup()"><div id=0 class=header><table id=1 cellpadding=0 cellspacing=0 style=width:100%;padding:0px;padding:0px;margin-top:0px><tr><td id=2 class=style6><div> <input type=button class=connectbutton id=xconnectbutton1 value=Connect onclick="connectButtonfunction(event, false)" onkeypress="return false" onkeydown="return false"> <span id=constatus></span></div></table><div class=progressbar><div id=3 style=height:2px;width:0%;background-color:red></div></div></div><div id=4 class=fullcell style=text-align:center;padding-top:100px;font-size:20px><span id=5>Disconnected</span></div><div id=6 style=height:100%;display:none><div id=7 class=navbar><br><p id=go1 class=nav1 onclick=go(1)><a>System Status</a><p id=go2 class=nav1 onclick=go(2)><a>Hardware Information</a><p id=go6 class=nav1 onclick=go(6)><a>Event Log</a><p id=go15 class=nav1 onclick=go(15)><a>Audit Log</a><p id=go21 class=nav1 onclick=go(21)><a>Storage</a><p id=go8 class=nav1 onclick=go(8)><a>Network Settings</a><p id=go17 class=nav1 onclick=go(17)><a>Internet Settings</a><p id=go16 class=nav1 onclick=go(16)><a>Security Settings</a><p id=go19 class=nav1 onclick=go(19)><a>Agent Presence</a><p id=go18 class=nav1 onclick=go(18)><a>System Defense</a><p id=go11 class=nav1 onclick=go(11)><a>User Accounts</a><p id=go22 class=nav1 onclick=go(22)><a>Subscriptions</a><p id=go23 class=nav1 onclick=go(23)><a>Wake Alarms</a><p id=go20 class=nav1 onclick=go(20)><a>Script Editor</a><p id=go12 class=nav1 onclick=go(12)><a>WSMAN Browser</a></div><div id=8 class=maincell><div id=9 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none;overflow:hidden><div style=float:right><input type=button value="Stop Script" onclick=script_Stop()></div><div style=font-size:16px;padding-top:2px;overflow:hidden> <b>Running Script</b><span style=overflow:hidden id=10></span></div></div><div id=11 style=height:21px;background:#8fac8d;padding:5px;margin-bottom:1px;display:none><div style=font-size:16px;float:right;cursor:pointer;padding-right:5px;padding-left:5px;padding-top:2px;font-size:15px onclick="QV(11, false)">✖</div><div style=font-size:14px;padding-top:2px> <b>This computer's firmware should be updated, <a style=cursor:pointer href="https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00075&languageid=en-fr" rel="noreferrer noopener" target="_blank"><u>please check here</u></a>.</b></div></div><div id=12 style=width:100%;height:100%><iframe id=13 style=width:100%;height:100%;border:0></iframe></div><div id=14 style=padding:8px;overflow-x:hidden><div id=p0><h1>Loading...</h1></div><div id=p1 style=display:none><h1>System Status</h1><span id=15></span></div><div id=p2 style=display:none><h1 style=margin-bottom:16px>Hardware Information</h1><span id=16></span></div><div id=p6 style=display:none><h1>Event Log</h1><span id=17></span><span id=18></span></div><div id=p8 style=display:none><h1>Network Settings</h1><span id=19></span><span id=20></span></div><div id=p11 style=display:none><h1>User Accounts</h1><span id=21></span></div><div id=p12 style=display:none><h1>WSMAN Browser</h1><div><table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><div style=padding:4px><select id=22 multiple="multiple" style=width:100%;height:120px></select></div><tr><td><input id=23 type=button value=Query style=margin:4px onclick=wsmanQuery()><input type=button value=Clear style=margin:4px onclick="QH(24, '')"><input id=c0 placeholder=Filter style=margin:4px onkeyup=wsmanFilter()></table></div><br><div class=us id=24></div></div><div id=p15 style=display:none><span id=25></span><h1>Audit Log</h1><span id=26></span></div><div id=p16 style=display:none><h1>Security Settings</h1><span id=27></span></div><div id=p17 style=display:none><h1>Internet Settings</h1><span id=28></span></div><div id=p18 style=display:none><h1>System Defense</h1><span id=29></span></div><div id=p19 style=display:none><h1>Agent Presence</h1><span id=30></span></div><div id=p20 style=display:none><h1>Script Editor</h1><div class=log1 style=padding:5px;border-radius:5px><div id=EditScriptStatus style=float:right;font-weight:bold;padding:5px>Stopped</div><div><input type=button value="View Editor" title="Switch to script line editor view" id=viewEditorButton onclick=scriptViewButton(0)><input type=button value="View Builder" title="Switch to block editor view" id=viewBuilderButton onclick=scriptViewButton(1)><input type=button value=New... title="Clear the script editor" onclick=script_newScriptDlg()><input type=button value=Load... title="Load a script from file" onclick=script_runScriptDlg()><input type=button value=Save... title="Save a script to file" onclick=script_saveScript(event)><input type=button value=Restart title="Compile the script and get ready to run it from the start" onclick=resetScriptButton()><input type=button value=Continue title="Run the script from the current execution point" onclick=runScriptButton()><input type=button value=Break title="Pause the execution of the script" onclick=breakScriptButton()><input type=button value=Step title="Execute one step of the script" onclick=stepScriptButton()></div></div><div id=scriptbuilder style=display:none><h2>Script Builder</h2><div style=padding:0;margin:0><div style=width:250px;height:400px;float:left;padding:0;margin:0;padding-right:3px><input id=blockfilter style="width:inherit;height:24px;padding:0;margin:0;border:1px solid gray;margin-bottom:1px" placeholder="Filter blocks..." onkeyup=script_fonfilterchanged()><div id=blocks style="width:inherit;height:373px;border:1px solid gray;overflow-y:scroll;padding:0;margin:0"></div></div><div id=scriptblocks style="width:auto;height:400px;padding:0;margin:0;border:1px solid gray;overflow-y:scroll" ondrop="script_fondrop(event, this)" onclick=script_fonclick(event)></div></div></div><div id=scripteditor><h2>Script</h2><textarea id=scriptarea style=width:100%;height:176px;resize:vertical;margin:0;padding:0;font-family:Arial,Helvetica,sans-serif spellcheck="false"></textarea><div style=display:none><br><h2>Compiled Script</h2><textarea id=compiledarea style=width:100%;height:16px;resize:vertical;margin:0;padding:0 spellcheck="false"></textarea><br></div><h2>Variables</h2><div id=variables style="width:100%;height:200px;resize:vertical;border:1px solid gray;overflow:scroll;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text"></div></div><h2>Console</h2><textarea id=console style=width:100%;height:80px;resize:vertical;margin:0;padding:0;user-select:text;-webkit-user-select:text;-khtml-user-select:text;-moz-user-select:text;-ms-user-select:text readonly=""></textarea></div><div id=p21 style=display:none><h1>Storage</h1><span id=31></span></div><div id=p22 style=display:none><h1>Event Subscriptions</h1><span id=32></span></div><div id=p23 style=display:none><h1>Wake Alarms</h1><span id=33></span></div></div></div></div><div id=dialog style="z-index:1000;background-color:#EEE;box-shadow:0px 0px 15px #666;font-family:Arial, Helvetica, sans-serif;border-radius:5px;position:fixed;overflow:auto;top:75px;width:400px;max-height:550px;display:none"><div style="width:100%;background-color:#003366;color:#FFF;border-radius:5px 5px 0 0"><div id=34 style=float:right;padding:1px;margin-right:5px;cursor:pointer;font-size:15px onclick=setDialogMode()>✖</div><div id=35 style=padding:5px></div><div style=width:100%;margin:6px></div></div><div style=margin-right:16px;margin-left:8px><div id=dialog1 style=margin:auto;text-align:center;margin:3px><div id=36 style=padding:10px></div></div><div id=dialog2 style=margin:auto;margin:3px><br><div style=height:26px><input id=d2username style=float:right;width:200px onkeyup=updateAccountDialog()><div>Username</div></div><div style=height:26px><input id=d2password1 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Password*</div></div><div style=height:26px><input id=d2password2 type=password autocomplete="off" style=float:right;width:200px onkeyup=updateAccountDialog()><div>Confirm Password</div></div><div id=37><div style=height:26px><select id=d2permission style=float:right;width:200px><option value=0>Local<option value=1>Network<option value=2>Any</select><div>Permission</div></div><div>Granted Permissions</div><ul id=38 style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0"></ul></div><div style=font-size:10px><br>*Minimum 8 characters with upper, lowercase, 0-9, and one of !@#$%^&*()+-</div></div><div id=dialog5 style=margin:auto;margin:3px><br><div style=height:26px><select id=d5actionSelect style=float:right;width:200px></select><div>Power Action</div></div><div><span style=color:red>Warning:</span>Some power actions may result in data loss and may disconnect the desktop, terminal or disk redirection sessions.</div></div><div id=dialog6 style=margin:auto;margin:3px><br><div style=height:26px><input id=d6ConsentText style=float:right;width:200px maxlength="6" onkeyup=consentChanged() onkeypress="return numbersOnly(event)"><div>Consent Code</div></div><div style=height:26px><select id=d6Display onchange=changeConsentDisplay() style=float:right;width:200px><option value=0>Primary display<option value=1>Secondary display<option id=d6ThirdDisplay value=2 style=display:none>Third display</select><div>Consent Display</div></div></div><div id=dialog8 style=display:table;margin:3px><div style="margin:3px 0 3px 0;padding-top:5px"><input id=c1 value=admin style=float:right;width:220px><div style=height:20px>Username</div></div><div style="margin:3px 0 3px 0"><input id=c2 type=password autocomplete="off" style=float:right;width:220px><div style=height:20px>Password</div></div></div><div id=dialog9 style=margin:auto;margin:3px><input type=checkbox id=c3>Redirection Port<br><div id=c4><input type=checkbox id=c5>KVM Remote Desktop<br></div><input type=checkbox id=c6>IDE-Redirection<br><input type=checkbox id=c7>Serial-over-LAN<br></div><div id=dialog10 style=margin:auto;margin:3px><input type=radio name=d10 id=c8 value=0>Not Required<br><input type=radio name=d10 id=c9 value=1>Required for KVM only<br><input type=radio name=d10 id=c10 value=4294967295>Always Required<br></div><div id=dialog11 style=margin:auto;margin:3px><div id=39></div></div><div id=dialog12 style=margin:auto;margin:3px><br><div style=height:26px><input id=c11 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">Profile Name</div></div><div style=height:26px><input id=c12 style=float:right;width:200px maxlength="32" onkeyup=updateWifiDialog() title="Maximum 32 characters"><div title="Maximum 32 characters">SSID</div></div><div style=height:26px><select id=c13 style=float:right;width:200px onclick=updateWifiDialog()></select><div>Priority</div></div><div style=height:26px><select id=c14 style=float:right;width:200px onclick=updateWifiDialog()><option value=6>WPA2 PSK<option value=4>WPA PSK</select><div>Authentication</div></div><div style=height:26px><select id=c15 style=float:right;width:200px onclick=updateWifiDialog()><option id=40 value=4>CCMP-AES<option id=41 value=3>TKIP-RC4<option id=42 value=2>WEP<option id=43 value=5>None</select><div>Encryption</div></div><div style=height:26px><input id=c16 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Password*</div></div><div style=height:26px><input id=c17 type=password style=float:right;width:200px maxlength="63" onkeyup=updateWifiDialog() title="Length between 8 and 63 characters"><div title="Length between 8 and 63 characters">Confirm Password</div></div></div><div id=dialog19 style=margin:auto;margin:3px>This will save the entire state of Intel® AMT for this machine into file. Passwords will not be saved, but some sensitive data may be included.<br><br><input id=c18 style=width:100% value=amtstate.json></div><div id=dialog20 style=margin:auto;margin:3px><input type=radio name=d20 id=d20a value=0>Disabled<br><input type=radio name=d20 id=d20b value=1>ICMP response<br><input type=radio name=d20 id=d20c value=2>RMCP response<br><input type=radio name=d20 id=d20d value=3>ICMP & RMCP response<br><br></div><div id=dialog21 style=margin:auto;margin:3px><input type=radio name=d21 id=d21o0 onclick=updateIPSetupDlg()><span id=d21l0></span><br><input type=radio name=d21 id=d21o1 onclick=updateIPSetupDlg()><span id=d21l1></span><br><div id=44><input type=radio name=d21 id=d21o2 onclick=updateIPSetupDlg()><span id=d21l2></span><br><br><div style=margin-left:20px><div style=height:26px><input id=c19 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>IP address</div></div><div style=height:26px id=45><input id=c20 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Subnet mark</div></div><div style=height:26px><input id=c21 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Gateway</div></div><div style=height:26px><input id=c22 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Primary DNS</div></div><div style=height:26px><input id=c23 onkeyup=updateIPSetupDlg() style=float:right;width:230px><div>Alternate DNS</div></div></div></div></div><div id=dialog23 style=margin:auto;margin:3px><br><div style=height:26px><select id=c24 style=float:right;width:200px onchange=showEditDnsDlgChange()><option value=0>Disabled<option value=1>Disabled, DHCP update<option value=2>Enabled</select><div>Dynamic DNS client</div></div><div style=height:26px><input id=c25 style=float:right;width:200px><div>Update Interval (minutes)</div></div><div style=height:26px><input id=c26 style=float:right;width:200px><div>TTL (seconds)</div></div><div style=font-size:10px><br>Defaut Interval is 1440 minutes, Default TTL is 900 seconds.</div></div><div id=dialog24 style=margin:auto;margin:3px><br><div style=height:26px><select id=c27 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=2>Power up<option value=5>Power cycle<option value=8>Power down<option value=10>Reset<option value=999>Set boot options</select><div>Remote Command</div></div><div style=height:80px><div id=c28 style="float:right;border:1px solid #666;width:200px;height:72px;overflow-y:scroll;background-color:white"><div id=d24dBiosPause><input type=checkbox id=d24BiosPause onchange=showAdvPowerDlgChange()>BIOS Pause<br></div><div id=d24dBiosSecureBoot><input type=checkbox id=d24BiosSecureBoot onchange=showAdvPowerDlgChange()>Enforce Secure Boot<br></div><div id=d24dBiosSetup><input type=checkbox id=d24BiosSetup onchange=showAdvPowerDlgChange()>BIOS Setup<br></div><div id=d24dForceProgressEvents><input type=checkbox id=d24ForceProgressEvents onchange=showAdvPowerDlgChange()>Force progress events<br></div><div id=d24dLockPowerButton><input type=checkbox id=d24LockPowerButton onchange=showAdvPowerDlgChange()>Lock power button<br></div><div id=d24dLockResetButton><input type=checkbox id=d24LockResetButton onchange=showAdvPowerDlgChange()>Lock reset button<br></div><div id=d24dLockSleepButton><input type=checkbox id=d24LockSleepButton onchange=showAdvPowerDlgChange()>Lock sleep button<br></div><div id=d24dLockKeyboard><input type=checkbox id=d24LockKeyboard onchange=showAdvPowerDlgChange()>Lock keyboard<br></div><div id=d24dUserPasswordBypass><input type=checkbox id=d24UserPasswordBypass onchange=showAdvPowerDlgChange()>BIOS password bypass<br></div><div id=d24dReflashBios><input type=checkbox id=d24ReflashBios onchange=showAdvPowerDlgChange()>Reflash BIOS<br></div><div id=d24dSafeMode><input type=checkbox id=d24SafeMode onchange=showAdvPowerDlgChange()>Safe mode<br></div><div id=d24dUseIDER><input type=checkbox id=d24UseIDER onchange=showAdvPowerDlgChange()>Use IDER<br></div><div id=d24dSerialOverLan><input type=checkbox id=d24SerialOverLan onchange=showAdvPowerDlgChange()>Serial-over-LAN<br></div><div id=d24dSecureErase><input type=checkbox id=d24SecureErase onchange=showAdvPowerDlgChange()>Intel® Remote Secure Erase<br></div></div><div>Boot Settings</div></div><div style=height:26px><select id=c29 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Force CD/DVD Boot<option value=2>Force PXE Boot<option value=3>Force Hard Disk Boot<option value=4>Force Diagnostic Boot</select><div>Boot Source</div></div><div style=height:26px><select id=c30 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>None<option value=1>Index 1<option value=2>Index 2<option value=3>Index 3<option value=3>Index 4</select><div>Boot Media Index</div></div><div style=height:26px id=idd_d24IDERBootDevice><select id=c31 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>Boot to floppy<option value=1>Boot to CDROM</select><div>IDER Boot Device</div></div><div style=height:26px><select id=c32 style=float:right;width:200px onchange=showAdvPowerDlgChange()><option value=0>System Default<option id=c33 value=1>Quiet<option id=c34 value=2>Verbose<option id=c35 value=3>Blank Screen</select><div>Verbocity</div></div><div style=height:26px id=idd_d24RSEPass><div style=float:right;width:200px><input type=password id=d24rsepass maxlength="32" style=float:right;width:100%></div><div>RSE Password</div></div></div><div id=dialog25 style=margin:auto;margin:3px><div style=text-align:left><div style=height:26px;margin-top:4px><input id=d25alarm_name style=float:right;width:180px maxlength="32" onkeyup=alertDialogUpdate()><div style=padding-top:4px>Alarm name</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_sdate style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Wake date (year-month-day)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_stime style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,58)"></div><div style=padding-top:4px>Wake time (hour:min:sec)</div></div><div style=height:26px;margin-top:4px><div style=float:right><input id=d25alarm_interval style=width:180px maxlength="10" onkeyup=alertDialogUpdate() onkeypress="return numbersOnly(event,45)"></div><div style=padding-top:4px>Interval (days-hours-min)</div></div><div style=height:26px;margin-top:4px><div style=float:right;width:180px><select id=d25alarm_doc style=width:100% onchange=showAdvPowerDlgChange()><option value=0>Keep alarm<option value=1>Delete on completion</select></div><div style=padding-top:4px>After wake</div></div></div></div></div><div style=padding:10px;margin-bottom:4px><input id=c36 type=button value=Cancel style=float:right;width:80px;margin-left:5px onclick=dialogclose(0)><input id=c37 type=button value=OK style=float:right;width:80px onclick=dialogclose(1)><div style=height:25px><input id=c38 type=button value=Delete style=width:80px;display:none onclick=dialogclose(2)></div></div></div><script>String.prototype.startsWith||(String.prototype.startsWith=function(a){return 0===this.lastIndexOf(a,0)});String.prototype.endsWith||(String.prototype.endsWith=function(a){return-1!==this.indexOf(a,this.length-a.length)});function Q(a){return document.getElementById(a)}function QS(a){try{return Q(a).style}catch(b){}}function QE(a,b){try{Q(a).disabled=!b}catch(c){}}function QV(a,b){try{QS(a).display=b?"":"none"}catch(c){}}function QA(a,b){Q(a).innerHTML+=b}function QH(a,b){Q(a).innerHTML=b}
|
|
function inputBoxFocus(a){Q(a).focus();var b=Q(a).value;Q(a).value="";Q(a).value=b}function ReadShort(a,b){return(a.charCodeAt(b)<<8)+a.charCodeAt(b+1)}function ReadShortX(a,b){return(a.charCodeAt(b+1)<<8)+a.charCodeAt(b)}function ReadInt(a,b){return 16777216*a.charCodeAt(b)+(a.charCodeAt(b+1)<<16)+(a.charCodeAt(b+2)<<8)+a.charCodeAt(b+3)}function ReadSInt(a,b){return(a.charCodeAt(b)<<24)+(a.charCodeAt(b+1)<<16)+(a.charCodeAt(b+2)<<8)+a.charCodeAt(b+3)}
|
|
function ReadIntX(a,b){return 16777216*a.charCodeAt(b+3)+(a.charCodeAt(b+2)<<16)+(a.charCodeAt(b+1)<<8)+a.charCodeAt(b)}function ShortToStr(a){return String.fromCharCode(a>>8&255,a&255)}function ShortToStrX(a){return String.fromCharCode(a&255,a>>8&255)}function IntToStr(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}function IntToStrX(a){return String.fromCharCode(a&255,a>>8&255,a>>16&255,a>>24&255)}function MakeToArray(a){return a&&null!=a&&"object"!=typeof a?[a]:a}
|
|
function SplitArray(a){return a.split(",")}function Clone(a){return JSON.parse(JSON.stringify(a))}function EscapeHtml(a){if("string"==typeof a)return a.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""").replace(/'/g,"'");if("boolean"==typeof a||"number"==typeof a)return a}function ArrayElementMove(a,b,c){a.splice(c,0,a.splice(b,1)[0])}
|
|
function ObjectToStringEx(a,b){var c="";if(0!=a&&(!a||null==a))return"(Null)";if(a instanceof Array)for(var d in a)c+="<br />"+gap(b)+"Item #"+d+": "+ObjectToStringEx(a[d],b+1);else if(a instanceof Object)for(d in a)c+="<br />"+gap(b)+d+" = "+ObjectToStringEx(a[d],b+1);else c+=EscapeHtml(a);return c}
|
|
function ObjectToStringEx2(a,b){var c="";if(0!=a&&(!a||null==a))return"(Null)";if(a instanceof Array)for(var d in a)c+="\r\n"+gap2(b)+"Item #"+d+": "+ObjectToStringEx2(a[d],b+1);else if(a instanceof Object)for(d in a)c+="\r\n"+gap2(b)+d+" = "+ObjectToStringEx2(a[d],b+1);else c+=EscapeHtml(a);return c}function gap(a){for(var b="",c=0;c<4*a;c++)b+=" ";return b}function gap2(a){for(var b="",c=0;c<4*a;c++)b+=" ";return b}function ObjectToString(a){return ObjectToStringEx(a,0)}
|
|
function ObjectToString2(a){return ObjectToStringEx2(a,0)}function hex2rstr(a){if("string"!=typeof a||0==a.length)return"";var b="";a=(""+a).match(/../g);for(var c;c=a.shift();)b+=String.fromCharCode("0x"+c);return b}function char2hex(a){return(a+256).toString(16).substr(-2).toUpperCase()}function rstr2hex(a){var b="",c;for(c=0;c<a.length;c++)b+=char2hex(a.charCodeAt(c));return b}function encode_utf8(a){return unescape(encodeURIComponent(a))}
|
|
function decode_utf8(a){return decodeURIComponent(escape(a))}function data2blob(a){for(var b=Array(a.length),c=0;c<a.length;c++)b[c]=a.charCodeAt(c);return new Blob([new Uint8Array(b)])}function random(a){return Math.floor(Math.random()*a)}function trademarks(a){return a.replace(/\(R\)/g,"®").replace(/\(TM\)/g,"™")}
|
|
var CreateWsmanComm=function(a,b,c,d,g){function n(){l.socketState=2;l.socketParseState=0;l.socketAccumulator="";l.socketHeader=null;l.socketData="";for(i in l.pendingAjaxCall)l.sendRequest(l.pendingAjaxCall[i][0],l.pendingAjaxCall[i][3],l.pendingAjaxCall[i][4])}function r(a){if("object"==typeof a.data)if(1==e)v.push(a.data);else if(w.readAsBinaryString)e=!0,w.readAsBinaryString(new Blob([a.data]));else if(w.readAsArrayBuffer)e=!0,w.readAsArrayBuffer(a.data);else{var b="";a=new Uint8Array(a.data);
|
|
for(var c=a.byteLength,m=0;m<c;m++)b+=String.fromCharCode(a[m]);u(b)}else u(a.data)}function u(a){if("object"===typeof a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,m=0;m<c;m++)b+=String.fromCharCode(a[m]);a=b}else if("string"!==typeof a)return;for(l.socketAccumulator+=a;;){if(0==l.socketParseState){a=l.socketAccumulator.indexOf("\r\n\r\n");if(0>a)break;l.socketHeader=l.socketAccumulator.substring(0,a).split("\r\n");if(null==l.amtVersion)for(m in l.socketHeader)0==l.socketHeader[m].indexOf("Server: Intel(R) Active Management Technology ")&&
|
|
(l.amtVersion=l.socketHeader[m].substring(46));l.socketAccumulator=l.socketAccumulator.substring(a+4);l.socketParseState=1;l.socketData="";l.socketXHeader={Directive:l.socketHeader[0].split(" ")};for(m in l.socketHeader)0!=m&&(a=l.socketHeader[m].indexOf(":"),l.socketXHeader[l.socketHeader[m].substring(0,a).toLowerCase()]=l.socketHeader[m].substring(a+2))}if(1==l.socketParseState){b=-1;if(void 0==l.socketXHeader.connection||"close"!=l.socketXHeader.connection.toLowerCase()||void 0!=l.socketXHeader["transfer-encoding"]&&
|
|
"chunked"==l.socketXHeader["transfer-encoding"].toLowerCase())if(void 0!=l.socketXHeader["content-length"]){b=parseInt(l.socketXHeader["content-length"]);if(l.socketAccumulator.length<b)break;a=l.socketAccumulator.substring(0,b);l.socketAccumulator=l.socketAccumulator.substring(b);l.socketData=a;b=0}else{c=l.socketAccumulator.indexOf("\r\n");if(0>c)break;b=parseInt(l.socketAccumulator.substring(0,c),16);if(isNaN(b)){l.websocket&&l.websocket.close();break}if(l.socketAccumulator.length<c+2+b+2)break;
|
|
a=l.socketAccumulator.substring(c+2,c+2+b);l.socketAccumulator=l.socketAccumulator.substring(c+2+b+2);l.socketData+=a}else b=0;0==b&&(c=l.socketXHeader,a=l.socketData,b=parseInt(c.Directive[1]),isNaN(b)&&(b=602),401==b&&3>++l.authcounter?l.challengeParams=l.parseDigest(c["www-authenticate"]):(c=l.pendingAjaxCall.shift(),l.authcounter=0,l.ActiveAjaxCount--,l.gotNextMessages(a,"success",{status:b},c),l.PerformNextAjax()),l.socketParseState=0,l.socketHeader=null)}}}function m(a){0==l.inDataCount&&(l.tlsv1only=
|
|
1-l.tlsv1only);l.socketState=0;null!=l.socket&&(l.socket.close(),l.socket=null);if(0<l.pendingAjaxCall.length){a=l.pendingAjaxCall.shift();var b=a[5];l.PerformAjaxExNodeJS2(a[0],a[1],a[2],a[3],a[4],--b)}}var l={PendingAjax:[],ActiveAjaxCount:0,MaxActiveAjaxCount:1,FailAllError:0,challengeParams:null,noncecounter:1,authcounter:0,socket:null,socketState:0};l.host=a;l.port=b;l.user=c;l.pass=d;l.tls=g;l.tlsv1only=0;l.cnonce=Math.random().toString(36).substring(7);l.inDataCount=0;l.amtVersion=null;l.PerformAjax=
|
|
function(a,b,c,m,e,F){l.ActiveAjaxCount<l.MaxActiveAjaxCount&&0==l.PendingAjax.length?l.PerformAjaxEx(a,b,c,e,F):1==m?l.PendingAjax.unshift([a,b,c,e,F]):l.PendingAjax.push([a,b,c,e,F])};l.PerformNextAjax=function(){if(!(l.ActiveAjaxCount>=l.MaxActiveAjaxCount||0==l.PendingAjax.length)){var a=l.PendingAjax.shift();l.PerformAjaxEx(a[0],a[1],a[2],a[3],a[4]);l.PerformNextAjax()}};l.PerformAjaxEx=function(a,b,c,m,e){if(0!=l.FailAllError)l.gotNextMessagesError({status:l.FailAllError},"error",null,[a,b,
|
|
c,m,e]);else return a||(a=""),l.ActiveAjaxCount++,l.PerformAjaxExNodeJS(a,b,c,m,e)};l.pendingAjaxCall=[];l.PerformAjaxExNodeJS=function(a,b,c,m,e){l.PerformAjaxExNodeJS2(a,b,c,m,e,3)};l.PerformAjaxExNodeJS2=function(a,b,c,m,e,F){0>=F||0!=l.FailAllError?(l.ActiveAjaxCount--,999!=l.FailAllError&&l.gotNextMessages(null,"error",{status:0==l.FailAllError?408:l.FailAllError},[a,b,c,m,e]),l.PerformNextAjax()):(l.pendingAjaxCall.push([a,b,c,m,e,F]),0==l.socketState?l.xxConnectHttpSocket():2==l.socketState&&
|
|
l.sendRequest(a,m,e))};l.sendRequest=function(a,b,c){b=b?b:"/wsman";c=c?c:"POST";var m=c+" "+b+" HTTP/1.1\r\n";null!=l.challengeParams&&(c=hex_md5(hex_md5(l.user+":"+l.challengeParams.realm+":"+l.pass)+":"+l.challengeParams.nonce+":"+l.noncecounter+":"+l.cnonce+":"+l.challengeParams.qop+":"+hex_md5(c+":"+b)),m+="Authorization: "+l.renderDigest({username:l.user,realm:l.challengeParams.realm,nonce:l.challengeParams.nonce,uri:b,qop:l.challengeParams.qop,response:c,nc:l.noncecounter++,cnonce:l.cnonce})+
|
|
"\r\n");a=m+="Host: "+l.host+":"+l.port+"\r\nContent-Length: "+a.length+"\r\n\r\n"+a;if(2==l.socketState&&null!=l.socket&&l.socket.readyState==WebSocket.OPEN){b=new Uint8Array(a.length);for(m=0;m<a.length;++m)b[m]=a.charCodeAt(m);try{l.socket.send(b.buffer)}catch(e){}}};l.parseDigest=function(a){a=a.substring(7).split(",");for(i in a)a[i]=a[i].trim();return a.reduce(function(a,b){var c=b.split("=");a[c[0]]=c[1].replace(/"/g,"");return a},{})};l.renderDigest=function(a){var b=[];for(i in a)b.push(i);
|
|
return"Digest "+b.reduce(function(b,c){return b+","+c+'="'+a[c]+'"'},"").substring(1)};l.xxConnectHttpSocket=function(){l.inDataCount=0;l.socketState=1;l.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=1&host="+l.host+"&port="+l.port+"&tls="+l.tls+"&tls1only="+l.tlsv1only+("*"==c?"&serverauth=1":"")+("undefined"===typeof d?"&serverauth=1&user="+c:""));l.socket.onopen=
|
|
n;l.socket.onmessage=r;l.socket.onclose=m};var w=new FileReader,e=!1,v=[];w.readAsBinaryString?w.onload=function(a){u(a.target.result);0==v.length?e=!1:w.readAsBinaryString(new Blob([v.shift()]))}:w.readAsArrayBuffer&&(w.onloadend=function(a){u(a.target.result);0==v.length?e=!1:w.readAsArrayBuffer(v.shift())});l.gotNextMessages=function(a,b,c,m){if(999!=l.FailAllError)if(0!=l.FailAllError)m[1](null,l.FailAllError,m[2]);else if(200!=c.status)m[1](null,c.status,m[2]);else m[1](a,200,m[2])};l.gotNextMessagesError=
|
|
function(a,b,c,m){if(999!=l.FailAllError)if(0!=l.FailAllError)m[1](null,l.FailAllError,m[2]);else m[1](l,null,{Header:{HttpError:a.status}},a.status,m[2])};l.CancelAllQueries=function(a){for(;0<l.PendingAjax.length;){var b=l.PendingAjax.shift();b[1](null,a,b[2])}null!=l.websocket&&(l.websocket.close(),l.websocket=null,l.socketState=0)};return l},CreateAmtRedirect=function(a){var b={};b.m=a;a.parent=b;b.State=0;b.socket=null;b.host=null;b.port=0;b.user=null;b.pass=null;b.authuri="/RedirectionService";
|
|
b.tlsv1only=0;b.connectstate=0;b.protocol=a.protocol;b.amtaccumulator="";b.amtsequence=1;b.amtkeepalivetimer=null;b.onStateChanged=null;b.Start=function(a,c,d,m,l){b.host=a;b.port=c;b.user=d;b.pass=m;b.connectstate=0;b.socket=new WebSocket(window.location.protocol.replace("http","ws")+"//"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"/webrelay.ashx?p=2&host="+a+"&port="+c+"&tls="+l+("*"==d?"&serverauth=1":"")+("undefined"===typeof m?"&serverauth=1&user="+
|
|
d:"")+"&tls1only="+b.tlsv1only);b.socket.onopen=b.xxOnSocketConnected;b.socket.onmessage=b.xxOnMessage;b.socket.onclose=b.xxOnSocketClosed;b.xxStateChange(1)};b.xxOnSocketConnected=function(){urlvars&&urlvars.redirtrace&&console.log("REDIR-CONNECT");b.xxStateChange(2);1==b.protocol&&b.xxSend(b.RedirectStartSol);2==b.protocol&&b.xxSend(b.RedirectStartKvm);3==b.protocol&&b.xxSend(b.RedirectStartIder)};var c=new FileReader,d=!1,g=[];c.readAsBinaryString?c.onload=function(a){b.xxOnSocketData(a.target.result);
|
|
0==g.length?d=!1:c.readAsBinaryString(new Blob([g.shift()]))}:c.readAsArrayBuffer&&(c.onloadend=function(a){b.xxOnSocketData(a.target.result);0==g.length?d=!1:c.readAsArrayBuffer(g.shift())});b.xxOnMessage=function(a){b.inDataCount++;if("object"==typeof a.data)if(1==d)g.push(a.data);else if(c.readAsBinaryString)d=!0,c.readAsBinaryString(new Blob([a.data]));else if(f.readAsArrayBuffer)d=!0,c.readAsArrayBuffer(a.data);else{var r="";a=new Uint8Array(a.data);for(var u=a.byteLength,m=0;m<u;m++)r+=String.fromCharCode(a[m]);
|
|
b.xxOnSocketData(r)}else b.xxOnSocketData(a.data)};b.xxOnSocketData=function(a){if(a&&-1!=b.connectstate){if("object"===typeof a){var c="",d=new Uint8Array(a),m=d.byteLength;for(a=0;a<m;a++)c+=String.fromCharCode(d[a]);a=c}else if("string"!==typeof a)return;if((2==b.protocol||3==b.protocol)&&1==b.connectstate)return b.m.ProcessData(a);b.amtaccumulator+=a;for(urlvars&&urlvars.redirtrace&&console.log("REDIR-RECV("+b.amtaccumulator.length+"): "+rstr2hex(b.amtaccumulator));1<=b.amtaccumulator.length;){a=
|
|
0;switch(b.amtaccumulator.charCodeAt(0)){case 17:if(4>b.amtaccumulator.length)return;switch(b.amtaccumulator.charCodeAt(1)){case 0:if(13>b.amtaccumulator.length)return;c=b.amtaccumulator.charCodeAt(12);if(b.amtaccumulator.length<13+c)return;b.xxSend(String.fromCharCode(19,0,0,0,0,0,0,0,0));a=13+c;break;default:b.Stop()}break;case 20:if(9>b.amtaccumulator.length)return;var l=ReadIntX(b.amtaccumulator,5);if(b.amtaccumulator.length<9+l)return;var m=b.amtaccumulator.charCodeAt(1),c=b.amtaccumulator.charCodeAt(4),
|
|
w=[];for(a=0;a<l;a++)w.push(b.amtaccumulator.charCodeAt(9+a));d=b.amtaccumulator.substring(9,9+l);a=9+l;if(0==c)0<=w.indexOf(4)?b.xxSend(String.fromCharCode(19,0,0,0,4)+IntToStrX(b.user.length+b.authuri.length+8)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0,0)):0<=w.indexOf(3)?b.xxSend(String.fromCharCode(19,0,0,0,3)+IntToStrX(b.user.length+b.authuri.length+7)+String.fromCharCode(b.user.length)+b.user+
|
|
String.fromCharCode(0,0)+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(0,0,0)):0<=w.indexOf(1)?b.xxSend(String.fromCharCode(19,0,0,0,1)+IntToStrX(b.user.length+b.pass.length+2)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(b.pass.length)+b.pass):b.Stop();else if(3!=c&&4!=c||1!=m)0==m?(1==b.protocol&&b.xxSend(String.fromCharCode(32,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+ShortToStrX(1E4)+ShortToStrX(100)+ShortToStrX(0)+
|
|
IntToStrX(0)),2==b.protocol&&b.xxSend(String.fromCharCode(64,0,0,0,0,0,0,0)),3==b.protocol&&(b.connectstate=1,b.xxStateChange(3))):b.Stop();else{var l=0,w=d.charCodeAt(l),m=d.substring(l+1,l+1+w),l=l+(w+1),e=d.charCodeAt(l),w=d.substring(l+1,l+1+e),l=l+(e+1),e=0,e=null,v=b.xxRandomNonce(32),E="";4==c&&(e=d.charCodeAt(l),e=d.substring(l+1,l+1+e),E="00000002:"+v+":"+e+":");d=hex_md5(hex_md5(b.user+":"+m+":"+b.pass)+":"+w+":"+E+hex_md5("POST:"+b.authuri));l=b.user.length+m.length+w.length+b.authuri.length+
|
|
v.length+8+d.length+7;4==c&&(l+=e.length+1);d=String.fromCharCode(19,0,0,0,c)+IntToStrX(l)+String.fromCharCode(b.user.length)+b.user+String.fromCharCode(m.length)+m+String.fromCharCode(w.length)+w+String.fromCharCode(b.authuri.length)+b.authuri+String.fromCharCode(v.length)+v+String.fromCharCode(8)+"00000002"+String.fromCharCode(d.length)+d;4==c&&(d+=String.fromCharCode(e.length)+e);b.xxSend(d)}break;case 33:if(23>b.amtaccumulator.length)break;a=23;b.xxSend(String.fromCharCode(39,0,0,0)+IntToStrX(b.amtsequence++)+
|
|
String.fromCharCode(0,0,27,0,0,0));1==b.protocol&&(b.amtkeepalivetimer=setInterval(b.xxSendAmtKeepAlive,2E3));b.connectstate=1;b.xxStateChange(3);break;case 41:if(10>b.amtaccumulator.length)break;a=10;break;case 42:if(10>b.amtaccumulator.length)break;c=10+((b.amtaccumulator.charCodeAt(9)&255)<<8)+(b.amtaccumulator.charCodeAt(8)&255);if(b.amtaccumulator.length<c)break;b.m.ProcessData(b.amtaccumulator.substring(10,c));a=c;break;case 43:if(8>b.amtaccumulator.length)break;a=8;break;case 65:if(8>b.amtaccumulator.length)break;
|
|
b.connectstate=1;b.m.Start();8<b.amtaccumulator.length&&b.m.ProcessData(b.amtaccumulator.substring(8));a=b.amtaccumulator.length;break;default:console.log("Unknown Intel AMT command: "+b.amtaccumulator.charCodeAt(0)+" acclen="+b.amtaccumulator.length);b.Stop();return}if(0==a)break;b.amtaccumulator=b.amtaccumulator.substring(a)}}};b.xxSend=function(a){urlvars&&urlvars.redirtrace&&console.log("REDIR-SEND("+a.length+"): "+rstr2hex(a));if(null!=b.socket&&b.socket.readyState==WebSocket.OPEN){for(var c=
|
|
new Uint8Array(a.length),d=0;d<a.length;++d)c[d]=a.charCodeAt(d);b.socket.send(c.buffer)}};b.Send=function(a){null!=b.socket&&1==b.connectstate&&(1==b.protocol?b.xxSend(String.fromCharCode(40,0,0,0)+IntToStrX(b.amtsequence++)+ShortToStrX(a.length)+a):b.xxSend(a))};b.xxSendAmtKeepAlive=function(){null!=b.socket&&b.xxSend(String.fromCharCode(43,0,0,0)+IntToStrX(b.amtsequence++))};b.xxRandomNonceX="abcdef0123456789";b.xxRandomNonce=function(a){for(var c="",d=0;d<a;d++)c+=b.xxRandomNonceX.charAt(Math.floor(Math.random()*
|
|
b.xxRandomNonceX.length));return c};b.xxOnSocketClosed=function(){urlvars&&urlvars.redirtrace&&console.log("REDIR-CLOSED");b.Stop()};b.xxStateChange=function(a){if(b.State!=a&&(b.State=a,b.m.xxStateChange(b.State),null!=b.onStateChanged))b.onStateChanged(b,b.State)};b.Stop=function(){b.xxStateChange(0);b.connectstate=-1;b.amtaccumulator="";null!=b.socket&&(b.socket.close(),b.socket=null);null!=b.amtkeepalivetimer&&(clearInterval(b.amtkeepalivetimer),b.amtkeepalivetimer=null)};b.RedirectStartSol=String.fromCharCode(16,
|
|
0,0,0,83,79,76,32);b.RedirectStartKvm=String.fromCharCode(16,1,0,0,75,86,77,82);b.RedirectStartIder=String.fromCharCode(16,0,0,0,73,68,69,82);return b},WsmanStackCreateService=function(a,b,c,d,g,n){function r(a){for(var c,b={},m=0;m<a.childNodes.length;m++){var k=a.childNodes[m];c=null==k.childElementCount||0==k.childElementCount?k.textContent:r(k);"true"==c&&(c=!0);"false"==c&&(c=!1);parseInt(c)+""===c&&(c=parseInt(c));var h=c;if(null!=k.attributes&&0<k.attributes.length)for(h={Value:c},c=0;c<k.attributes.length;c++)h["@"+
|
|
k.attributes[c].name]=k.attributes[c].value;b[k.localName]instanceof Array?b[k.localName].push(h):b[k.localName]=null==b[k.localName]?h:[b[k.localName],h]}return b}function u(a){if(!a)return"";var c="",b;for(b in a)a.hasOwnProperty(b)&&0===b.indexOf("@")&&(c+=" "+b.substring(1)+'="'+a[b]+'"');return c}function m(a){if(!a)return"";if("string"==typeof a)return a;if(a.InstanceID)return'<w:SelectorSet><w:Selector Name="InstanceID">'+a.InstanceID+"</w:Selector></w:SelectorSet>";var c="<w:SelectorSet>",
|
|
b;for(b in a)if(a.hasOwnProperty(b)){c+='<w:Selector Name="'+b+'">';if(a[b].ReferenceParameters){var c=c+"<a:EndpointReference>",c=c+("<a:Address>"+a[b].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+a[b].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>"),m=a[b].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(m))for(var k=0;k<m.length;k++)c+="<w:Selector"+u(m[k])+">"+m[k].Value+"</w:Selector>";else c+="<w:Selector"+u(m)+">"+m.Value+"</w:Selector>";c+="</w:SelectorSet></a:ReferenceParameters></a:EndpointReference>"}else c+=
|
|
a[b];c+="</w:Selector>"}return c+"</w:SelectorSet>"}var l={NextMessageId:1,Address:"/wsman"};l.comm=CreateWsmanComm(a,b,c,d,g,n);l.PerformAjax=function(a,c,b,m,k){null==k&&(k="");l.comm.PerformAjax('<?xml version="1.0" encoding="utf-8"?><Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns="http://www.w3.org/2003/05/soap-envelope" '+
|
|
k+"><Header><a:Action>"+a,function(a,b,m){200!=b?c(l,null,{Header:{HttpError:b}},b,m):(a=l.ParseWsman(a))&&null!=a?c(l,a.Header.ResourceURI,a,200,m):c(l,null,{Header:{HttpError:b}},601,m)},b,m)};l.CancelAllQueries=function(a){l.comm.CancelAllQueries(a)};l.GetNameFromUrl=function(a){var c=a.lastIndexOf("/");return-1==c?a:a.substring(c+1)};l.ExecSubscribe=function(a,c,b,d,k,h,C,p,F,y){var z="",A="";p="";null!=F&&null!=y&&(z='<t:IssuedTokens xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:se="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><t:RequestSecurityTokenResponse><t:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken</t:TokenType><t:RequestedSecurityToken><se:UsernameToken><se:Username>'+
|
|
F+'</se:Username><se:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#PasswordText">'+y+"</se:Password></se:UsernameToken></t:RequestedSecurityToken></t:RequestSecurityTokenResponse></t:IssuedTokens>",A='<w:Auth Profile="http://schemas.dmtf.org/wbem/wsman/1/wsman/secprofile/http/digest"/>');null!=p&&(p="<a:ReferenceParameters><m:arg>"+p+"</m:arg></a:ReferenceParameters>");"PushWithAck"==c?c="dmtf.org/wbem/wsman/1/wsman/PushWithAck":"Push"==c&&(c="xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push");
|
|
a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+m(C)+z+'</Header><Body><e:Subscribe><e:Delivery Mode="http://schemas.'+c+'"><e:NotifyTo><a:Address>'+b+"</a:Address>"+p+"</e:NotifyTo>"+A+"</e:Delivery></e:Subscribe>";l.PerformAjax(a+"</Body></Envelope>",d,k,
|
|
h,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:m="http://x.com"')};l.ExecUnSubscribe=function(a,c,b,d,k){a="http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo>"+m(k)+"</Header><Body><e:Unsubscribe/>";l.PerformAjax(a+"</Body></Envelope>",c,b,d,'xmlns:e="http://schemas.xmlsoap.org/ws/2004/08/eventing"')};
|
|
l.ExecPut=function(a,c,b,d,k,h){h="http://schemas.xmlsoap.org/ws/2004/09/transfer/Put</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60.000S</w:OperationTimeout>"+m(h)+"</Header><Body>";if(a&&null!=c){var C=l.GetNameFromUrl(a);a="<r:"+C+' xmlns:r="'+a+'">';for(var p in c)if(c.hasOwnProperty(p)&&
|
|
0!==p.indexOf("__")&&0!==p.indexOf("@")&&null!=c[p]&&"function"!==typeof c[p])if("object"===typeof c[p]&&c[p].ReferenceParameters){a+="<r:"+p+"><a:Address>"+c[p].Address+"</a:Address><a:ReferenceParameters><w:ResourceURI>"+c[p].ReferenceParameters.ResourceURI+"</w:ResourceURI><w:SelectorSet>";var F=c[p].ReferenceParameters.SelectorSet.Selector;if(Array.isArray(F))for(var y=0;y<F.length;y++)a+="<w:Selector"+u(F[y])+">"+F[y].Value+"</w:Selector>";else a+="<w:Selector"+u(F)+">"+F.Value+"</w:Selector>";
|
|
a+="</w:SelectorSet></a:ReferenceParameters></r:"+p+">"}else if(Array.isArray(c[p]))for(y=0;y<c[p].length;y++)a+="<r:"+p+">"+c[p][y].toString()+"</r:"+p+">";else a+="<r:"+p+">"+c[p].toString()+"</r:"+p+">";c=a+("</r:"+C+">")}else c="";l.PerformAjax(h+c+"</Body></Envelope>",b,d,k)};l.ExecCreate=function(a,c,b,d,k,h){var C=l.GetNameFromUrl(a);a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +
|
|
"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+m(h)+"</Header><Body><g:"+C+' xmlns:g="'+a+'">';for(var p in c)a+="<g:"+p+">"+c[p]+"</g:"+p+">";l.PerformAjax(a+"</g:"+C+"></Body></Envelope>",b,d,k)};l.ExecDelete=function(a,c,b,d,k){a="http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +
|
|
"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+m(c)+"</Header><Body /></Envelope>";l.PerformAjax(a,b,d,k)};l.ExecGet=function(a,c,b,m){l.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body /></Envelope>",
|
|
c,b,m)};l.ExecMethod=function(a,c,b,m,k,h,d){var p="",F;for(F in b)if(null!=b[F])if(Array.isArray(b[F]))for(var y in b[F])p+="<r:"+F+">"+b[F][y]+"</r:"+F+">";else p+="<r:"+F+">"+b[F]+"</r:"+F+">";l.ExecMethodXml(a,c,p,m,k,h,d)};l.ExecMethodXml=function(a,c,b,d,k,h,C){l.PerformAjax(a+"/"+c+"</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +"</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout>"+
|
|
m(C)+"</Header><Body><r:"+c+'_INPUT xmlns:r="'+a+'">'+b+"</r:"+c+"_INPUT></Body></Envelope>",d,k,h)};l.ExecEnum=function(a,c,b,m){l.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Enumerate xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration" /></Body></Envelope>',
|
|
c,b,m)};l.ExecPull=function(a,c,b,m,k){l.PerformAjax("http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action><a:To>"+l.Address+"</a:To><w:ResourceURI>"+a+"</w:ResourceURI><a:MessageID>"+l.NextMessageId++ +'</a:MessageID><a:ReplyTo><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address></a:ReplyTo><w:OperationTimeout>PT60S</w:OperationTimeout></Header><Body><Pull xmlns="http://schemas.xmlsoap.org/ws/2004/09/enumeration"><EnumerationContext>'+c+"</EnumerationContext></Pull></Body></Envelope>",
|
|
b,m,k)};l.ParseWsman=function(a){try{if(!a.childNodes){var c=a;if(window.DOMParser)a=(new DOMParser).parseFromString(c,"text/xml");else{var b=new ActiveXObject("Microsoft.XMLDOM");b.async=!1;b.loadXML(c);a=b}}var c={Header:{}},m=a.getElementsByTagName("Header")[0],k;m||(m=a.getElementsByTagName("a:Header")[0]);if(!m)return null;for(b=0;b<m.childNodes.length;b++){var h=m.childNodes[b];c.Header[h.localName]=h.textContent}var d=a.getElementsByTagName("Body")[0];d||(d=a.getElementsByTagName("a:Body")[0]);
|
|
if(!d)return null;0<d.childNodes.length&&(k=d.childNodes[0].localName,k.indexOf("_OUTPUT")==k.length-7&&(k=k.substring(0,k.length-7)),c.Header.Method=k,c.Body=r(d.childNodes[0]));return c}catch(p){return console.log("Unable to parse XML: "+a),null}};return l};
|
|
function AmtStackCreateService(a){function b(){var a=e.GetPendingActions();v<a&&(v=a);null!=e.onProcessChanged&&E!=a&&(E=a,e.onProcessChanged(a,v));0==a&&(v=0)}function c(a,c,b,m,h,k,x){200!=h?(b(e,a,null,h,k),g(1)):null!=c&&"EnumerateResponse"==c.Header.Method&&c.Body.EnumerationContext?e.wsman.ExecPull(m,c.Body.EnumerationContext,function(c,m,h,e){d(a,h,b,m,[],e,k,x)}):(b(e,a,null,603,k),g(1))}function d(a,c,m,h,k,p,x,l){if(200!=p)m(e,a,null,p,x),g(1);else if(null==c||"PullResponse"!=c.Header.Method)m(e,
|
|
a,null,604,x),g(1);else{for(var w in c.Body.Items)if(c.Body.Items[w]instanceof Array)for(var v in c.Body.Items[w])"function"!=typeof c.Body.Items[w][v]&&k.push(c.Body.Items[w][v]);else"function"!=typeof c.Body.Items[w]&&k.push(c.Body.Items[w]);c.Body.EnumerationContext?e.wsman.ExecPull(h,c.Body.EnumerationContext,function(c,b,h,e){d(a,h,m,b,k,e,x,1)}):(g(1),m(e,a,k,p,x),b())}}function g(a){e.ActiveEnumsCount-=a;e.ActiveEnumsCount>=e.MaxActiveEnumsCount||0==e.PendingEnums.length?b():(a=e.PendingEnums.shift(),
|
|
e.Enum(a[0],a[1],a[2]),g(0))}function n(a,c,m,h,k,d,x){e.PendingBatchOperations-=2;var p=c.shift(),l=e.Enum;"*"==p[0]&&(l=e.Get,p=p.substring(1));l(p,function(k,p,l,D,G){G[2][p]={response:null==l?null:l.Body,responses:l,status:D};0==G[1].length||401==D||1!=d&&200!=D&&400!=D?(e.PendingBatchOperations-=2*c.length,b(),m(e,a,G[2],D,h)):(b(),n(a,c,m,h,G[2],x))},[a,c,k],x);b()}function r(a){a.names.length<=a.current?a.callback(e,a.name,a.responses,200,a.tag):(e.wsman.ExecGet(e.CompleteName(a.names[a.current]),
|
|
function(c,b,m,h){null==m||200!=h?a.callback(e,a.name,null,h,a.tag):(a.responses[m.Header.Method]=m,r(a))},a.pri),a.current++);b()}function u(a,c,b,h,k){if(200!=h||"0"!=b.Body.ReturnValue)k[0](e,null,k[2]);else e.AMT_MessageLog_GetRecords(b.Body.IterationIdentifier,390,m,k)}function m(a,c,b,h,k){if(200!=h||"0"!=b.Body.ReturnValue)k[0](e,null,k[2]);else{var d,x,p;c=k[2];h=new Date;var w=b.Body.RecordArray;"string"===typeof w&&(b.Body.RecordArray=[b.Body.RecordArray]);for(d in w){a=null;try{a=window.atob(w[d])}catch(v){}if(null!=
|
|
a&&(x=ReadIntX(a,0),0<x&&4294967295>x)){p={DeviceAddress:a.charCodeAt(4),EventSensorType:a.charCodeAt(5),EventType:a.charCodeAt(6),EventOffset:a.charCodeAt(7),EventSourceType:a.charCodeAt(8),EventSeverity:a.charCodeAt(9),SensorNumber:a.charCodeAt(10),Entity:a.charCodeAt(11),EntityInstance:a.charCodeAt(12),EventData:[],Time:new Date(1E3*(x+60*h.getTimezoneOffset()))};for(x=13;21>x;x++)p.EventData.push(a.charCodeAt(x));p.EntityStr=C[p.Entity];p.Desc=l(p.EventSensorType,p.EventOffset,p.EventData,p.Entity);
|
|
p.EntityStr||(p.EntityStr="Unknown");c.push(p)}}if(1!=b.Body.NoMoreRecords)e.AMT_MessageLog_GetRecords(b.Body.IterationIdentifier,390,m,[k[0],c,k[2]]);else k[0](e,c,k[2])}}function l(a,c,b,m){if(15==a)return 235==b[0]?"Invalid Data":0==c?k[b[1]]:h[b[1]];if(18==a&&170==b[0])return"Agent watchdog "+char2hex(b[4])+char2hex(b[3])+char2hex(b[2])+char2hex(b[1])+"-"+char2hex(b[6])+char2hex(b[5])+"-... changed to "+e.WatchdogCurrentStates[b[7]];if(5==a&&0==c)return"Case intrusion";if(192==a&&0==c&&170==b[0]&&
|
|
48==b[1]){if(0==b[2])return"A remote Serial Over LAN session was established.";if(1==b[2])return"Remote Serial Over LAN session finished. User control was restored.";if(2==b[2])return"A remote IDE-Redirection session was established.";if(3==b[2])return"Remote IDE-Redirection session finished. User control was restored."}if(36==a)return a=(b[1]<<24)+(b[2]<<16)+(b[3]<<8)+b[4],c="#"+b[0],170==b[0]&&(c="wired"),4294967293==a?"All received packet filter was matched on "+c+" interface.":4294967292==a?"All outbound packet filter was matched on "+
|
|
c+" interface.":4294967290==a?"Spoofed packet filter was matched on "+c+" interface.":"Filter "+a+" was matched on "+c+" interface.";if(192==a)return 0==b[2]?"Security policy invoked. Some or all network traffic (TX) was stopped.":2==b[2]?"Security policy invoked. Some or all network traffic (RX) was stopped.":"Security policy invoked.";if(193==a){if(170==b[0]&&48==b[1]&&0==b[2]&&0==b[3])return"User request for remote connection.";if(170==b[0]&&32==b[1]&&3==b[2]&&1==b[3])return"EAC error: attempt to get posture while NAC in Intel\ufffd AMT is disabled.";
|
|
if(170==b[0]&&32==b[1]&&4==b[2]&&0==b[3])return"Certificate revoked. "}return 6==a?"Authentication failed "+(b[1]+(b[2]<<8))+" times. The system may be under attack.":30==a?"No bootable media":32==a?"Operating system lockup or power interrupt":35==a?"System boot failure":37==a?"System firmware started (at least one CPU is properly executing).":"Unknown Sensor Type #"+a}function w(a,c,b,m,h){if(200!=m)h[0](e,[],m);else{var k,d,l=h[1],B=new Date,v;if(0<b.Body.RecordsReturned)for(d in b.Body.EventRecords=
|
|
MakeToArray(b.Body.EventRecords),b.Body.EventRecords){a=null;try{a=window.atob(b.Body.EventRecords[d])}catch(E){console.log(E+" "+b.Body.EventRecords[d])}c={AuditAppID:ReadShort(a,0),EventID:ReadShort(a,2),InitiatorType:a.charCodeAt(4)};c.AuditApp=p[c.AuditAppID];c.Event=p[100*c.AuditAppID+c.EventID];c.Event||(c.Event="#"+c.EventID);0==c.InitiatorType&&(k=a.charCodeAt(5),c.Initiator=a.substring(6,6+k),k=6+k);1==c.InitiatorType&&(c.KerberosUserInDomain=ReadInt(a,5),k=a.charCodeAt(9),c.Initiator=GetSidString(a.substring(10,
|
|
10+k)),k=10+k);2==c.InitiatorType&&(c.Initiator="<i>Local</i>",k=5);3==c.InitiatorType&&(c.Initiator="<i>KVM Default Port</i>",k=5);v=ReadInt(a,k);c.Time=new Date(1E3*(v+60*B.getTimezoneOffset()));k+=4;c.MCLocationType=a.charCodeAt(k++);v=a.charCodeAt(k++);c.NetAddress=a.substring(k,k+v);k+=v;v=a.charCodeAt(k++);c.Ex=a.substring(k,k+v);c.ExStr=e.GetAuditLogExtendedDataStr(100*c.AuditAppID+c.EventID,c.Ex);l.push(c)}if(b.Body.TotalRecordCount>l.length)e.AMT_AuditLog_ReadRecords(l.length+1,w,[h[0],l]);
|
|
else h[0](e,l,m)}}var e={};e.wsman=a;e.pfx=["http://intel.com/wbem/wscim/1/amt-schema/1/","http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/","http://intel.com/wbem/wscim/1/ips-schema/1/"];e.PendingEnums=[];e.PendingBatchOperations=0;e.ActiveEnumsCount=0;e.MaxActiveEnumsCount=1;e.onProcessChanged=null;var v=0,E=0;e.GetPendingActions=function(){return 2*e.PendingEnums.length+e.ActiveEnumsCount+e.wsman.comm.PendingAjax.length+e.wsman.comm.ActiveAjaxCount+e.PendingBatchOperations};e.Subscribe=function(a,
|
|
c,m,h,k,d,x,p,l,w){e.wsman.ExecSubscribe(e.CompleteName(a),c,m,function(c,m,z,d){b();h(e,a,z,d,k)},0,d,x,p,l,w);b()};e.UnSubscribe=function(a,c,m,h,k){e.wsman.ExecUnSubscribe(e.CompleteName(a),function(h,k,d,p){b();c(e,a,d,p,m)},0,h,k);b()};e.Get=function(a,c,m,h){e.wsman.ExecGet(e.CompleteName(a),function(h,k,d,p){b();c(e,a,d,p,m)},0,h);b()};e.Put=function(a,c,m,h,k,d){e.wsman.ExecPut(e.CompleteName(a),c,function(c,k,d,p){b();m(e,a,d,p,h)},0,k,d);b()};e.Create=function(a,c,m,h,k){e.wsman.ExecCreate(e.CompleteName(a),
|
|
c,function(c,k,d,p){b();m(e,a,d,p,h)},0,k);b()};e.Delete=function(a,c,m,h,k){e.wsman.ExecDelete(e.CompleteName(a),c,function(c,k,d,p){b();m(e,a,d,p,h)},0,k);b()};e.Exec=function(a,c,m,h,k,d,x){e.wsman.ExecMethod(e.CompleteName(a),c,m,function(c,m,z,d){b();h(e,a,e.CompleteExecResponse(z),d,k)},0,d,x);b()};e.ExecWithXml=function(a,c,m,h,k,d,x){e.wsman.ExecMethodXml(e.CompleteName(a),c,execArgumentsToXml(m),function(c,m,z,d){b();h(e,a,e.CompleteExecResponse(z),d,k)},0,d,x);b()};e.Enum=function(a,m,z,
|
|
h){e.ActiveEnumsCount<e.MaxActiveEnumsCount?(e.ActiveEnumsCount++,e.wsman.ExecEnum(e.CompleteName(a),function(z,h,k,d,e){b();c(a,k,m,h,d,e)},z,h)):e.PendingEnums.push([a,m,z,h]);b()};e.BatchEnum=function(a,c,m,h,k,d){e.PendingBatchOperations+=2*c.length;n(a,Clone(c),m,h,{},k,d);b()};e.BatchGet=function(a,c,m,h,k){r({name:a,names:c,callback:m,current:0,responses:{},tag:h,pri:k});b()};e.CompleteName=function(a){if(0==a.indexOf("AMT_"))return e.pfx[0]+a;if(0==a.indexOf("CIM_"))return e.pfx[1]+a;if(0==
|
|
a.indexOf("IPS_"))return e.pfx[2]+a};e.CompleteExecResponse=function(a){a&&null!=a&&a.Body&&void 0!=a.Body.ReturnValue&&(a.Body.ReturnValueStr=e.AmtStatusToStr(a.Body.ReturnValue));return a};e.RequestPowerStateChange=function(a,c){e.CIM_PowerManagementService_RequestPowerStateChange(a,'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="CreationClassName">CIM_ComputerSystem</Selector><Selector Name="Name">ManagedSystem</Selector></SelectorSet></ReferenceParameters>',
|
|
null,null,c)};e.SetBootConfigRole=function(a,c){e.CIM_BootService_SetBootConfigRole('<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootConfigSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: Boot Configuration 0</Selector></SelectorSet></ReferenceParameters>',
|
|
a,c)};e.CancelAllQueries=function(a){e.wsman.CancelAllQueries(a)};e.AMT_AgentPresenceWatchdog_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdog","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdog_AssertPresence=function(a,c){e.Exec("AMT_AgentPresenceWatchdog","AssertPresence",{SequenceNumber:a},c)};e.AMT_AgentPresenceWatchdog_AssertShutdown=function(a,c){e.Exec("AMT_AgentPresenceWatchdog","AssertShutdown",{SequenceNumber:a},c)};e.AMT_AgentPresenceWatchdog_AddAction=function(a,c,b,m,h,k,
|
|
d,p,l){e.Exec("AMT_AgentPresenceWatchdog","AddAction",{OldState:a,NewState:c,EventOnTransition:b,ActionSd:m,ActionEac:h},k,d,p,l)};e.AMT_AgentPresenceWatchdog_DeleteAllActions=function(a,c,b,m){e.Exec("AMT_AgentPresenceWatchdog","DeleteAllActions",{},a,c,b,m)};e.AMT_AgentPresenceWatchdogAction_GetActionEac=function(a){e.Exec("AMT_AgentPresenceWatchdogAction","GetActionEac",{},a)};e.AMT_AgentPresenceWatchdogVA_RegisterAgent=function(a){e.Exec("AMT_AgentPresenceWatchdogVA","RegisterAgent",{},a)};e.AMT_AgentPresenceWatchdogVA_AssertPresence=
|
|
function(a,c){e.Exec("AMT_AgentPresenceWatchdogVA","AssertPresence",{SequenceNumber:a},c)};e.AMT_AgentPresenceWatchdogVA_AssertShutdown=function(a,c){e.Exec("AMT_AgentPresenceWatchdogVA","AssertShutdown",{SequenceNumber:a},c)};e.AMT_AgentPresenceWatchdogVA_AddAction=function(a,c,b,m,h,k){e.Exec("AMT_AgentPresenceWatchdogVA","AddAction",{OldState:a,NewState:c,EventOnTransition:b,ActionSd:m,ActionEac:h},k)};e.AMT_AgentPresenceWatchdogVA_DeleteAllActions=function(a,c){e.Exec("AMT_AgentPresenceWatchdogVA",
|
|
"DeleteAllActions",{_method_dummy:a},c)};e.AMT_AuditLog_ClearLog=function(a){e.Exec("AMT_AuditLog","ClearLog",{},a)};e.AMT_AuditLog_RequestStateChange=function(a,c,b){e.Exec("AMT_AuditLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_AuditLog_ReadRecords=function(a,c,b){e.Exec("AMT_AuditLog","ReadRecords",{StartIndex:a},c,b)};e.AMT_AuditLog_SetAuditLock=function(a,c,b,m){e.Exec("AMT_AuditLog","SetAuditLock",{LockTimeoutInSeconds:a,Flag:c,Handle:b},m)};e.AMT_AuditLog_ExportAuditLogSignature=
|
|
function(a,c){e.Exec("AMT_AuditLog","ExportAuditLogSignature",{SigningMechanism:a},c)};e.AMT_AuditLog_SetSigningKeyMaterial=function(a,c,b,m,h){e.Exec("AMT_AuditLog","SetSigningKeyMaterial",{SigningMechanismType:a,SigningKey:c,LengthOfCertificates:b,Certificates:m},h)};e.AMT_AuditPolicyRule_SetAuditPolicy=function(a,c,b,m,h){e.Exec("AMT_AuditPolicyRule","SetAuditPolicy",{Enable:a,AuditedAppID:c,EventID:b,PolicyType:m},h)};e.AMT_AuditPolicyRule_SetAuditPolicyBulk=function(a,c,b,m,h){e.Exec("AMT_AuditPolicyRule",
|
|
"SetAuditPolicyBulk",{Enable:a,AuditedAppID:c,EventID:b,PolicyType:m},h)};e.AMT_AuthorizationService_AddUserAclEntryEx=function(a,c,b,m,h,k){e.Exec("AMT_AuthorizationService","AddUserAclEntryEx",{DigestUsername:a,DigestPassword:c,KerberosUserSid:b,AccessPermission:m,Realms:h},k)};e.AMT_AuthorizationService_EnumerateUserAclEntries=function(a,c){e.Exec("AMT_AuthorizationService","EnumerateUserAclEntries",{StartIndex:a},c)};e.AMT_AuthorizationService_GetUserAclEntryEx=function(a,c,b){e.Exec("AMT_AuthorizationService",
|
|
"GetUserAclEntryEx",{Handle:a},c,b)};e.AMT_AuthorizationService_UpdateUserAclEntryEx=function(a,c,b,m,h,k,d){e.Exec("AMT_AuthorizationService","UpdateUserAclEntryEx",{Handle:a,DigestUsername:c,DigestPassword:b,KerberosUserSid:m,AccessPermission:h,Realms:k},d)};e.AMT_AuthorizationService_RemoveUserAclEntry=function(a,c){e.Exec("AMT_AuthorizationService","RemoveUserAclEntry",{Handle:a},c)};e.AMT_AuthorizationService_SetAdminAclEntryEx=function(a,c,b){e.Exec("AMT_AuthorizationService","SetAdminAclEntryEx",
|
|
{Username:a,DigestPassword:c},b)};e.AMT_AuthorizationService_GetAdminAclEntry=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntry",{},a)};e.AMT_AuthorizationService_GetAdminAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminAclEntryStatus",{},a)};e.AMT_AuthorizationService_GetAdminNetAclEntryStatus=function(a){e.Exec("AMT_AuthorizationService","GetAdminNetAclEntryStatus",{},a)};e.AMT_AuthorizationService_SetAclEnabledState=function(a,c,b,m){e.Exec("AMT_AuthorizationService",
|
|
"SetAclEnabledState",{Handle:a,Enabled:c},b,m)};e.AMT_AuthorizationService_GetAclEnabledState=function(a,c,b){e.Exec("AMT_AuthorizationService","GetAclEnabledState",{Handle:a},c,b)};e.AMT_EndpointAccessControlService_RequestStateChange=function(a,c,b){e.Exec("AMT_EndpointAccessControlService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_EndpointAccessControlService_GetPosture=function(a,c){e.Exec("AMT_EndpointAccessControlService","GetPosture",{PostureType:a},c)};e.AMT_EndpointAccessControlService_GetPostureHash=
|
|
function(a,c){e.Exec("AMT_EndpointAccessControlService","GetPostureHash",{PostureType:a},c)};e.AMT_EndpointAccessControlService_UpdatePostureState=function(a,c){e.Exec("AMT_EndpointAccessControlService","UpdatePostureState",{UpdateType:a},c)};e.AMT_EndpointAccessControlService_GetEacOptions=function(a){e.Exec("AMT_EndpointAccessControlService","GetEacOptions",{},a)};e.AMT_EndpointAccessControlService_SetEacOptions=function(a,c,b){e.Exec("AMT_EndpointAccessControlService","SetEacOptions",{EacVendors:a,
|
|
PostureHashAlgorithm:c},b)};e.AMT_EnvironmentDetectionSettingData_SetSystemDefensePolicy=function(a,c){e.Exec("AMT_EnvironmentDetectionSettingData","SetSystemDefensePolicy",{Policy:a},c)};e.AMT_EnvironmentDetectionSettingData_EnableVpnRouting=function(a,c){e.Exec("AMT_EnvironmentDetectionSettingData","EnableVpnRouting",{Enable:a},c)};e.AMT_EthernetPortSettings_SetLinkPreference=function(a,c,b){e.Exec("AMT_EthernetPortSettings","SetLinkPreference",{LinkPreference:a,Timeout:c},b)};e.AMT_HeuristicPacketFilterStatistics_ResetSelectedStats=
|
|
function(a,c){e.Exec("AMT_HeuristicPacketFilterStatistics","ResetSelectedStats",{SelectedStatistics:a},c)};e.AMT_KerberosSettingData_GetCredentialCacheState=function(a){e.Exec("AMT_KerberosSettingData","GetCredentialCacheState",{},a)};e.AMT_KerberosSettingData_SetCredentialCacheState=function(a,c){e.Exec("AMT_KerberosSettingData","SetCredentialCacheState",{Enable:a},c)};e.AMT_MessageLog_CancelIteration=function(a,c){e.Exec("AMT_MessageLog","CancelIteration",{IterationIdentifier:a},c)};e.AMT_MessageLog_RequestStateChange=
|
|
function(a,c,b){e.Exec("AMT_MessageLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_MessageLog_ClearLog=function(a){e.Exec("AMT_MessageLog","ClearLog",{},a)};e.AMT_MessageLog_GetRecords=function(a,c,b,m){e.Exec("AMT_MessageLog","GetRecords",{IterationIdentifier:a,MaxReadRecords:c},b,m)};e.AMT_MessageLog_GetRecord=function(a,c,b){e.Exec("AMT_MessageLog","GetRecord",{IterationIdentifier:a,PositionToNext:c},b)};e.AMT_MessageLog_PositionAtRecord=function(a,c,b,m){e.Exec("AMT_MessageLog",
|
|
"PositionAtRecord",{IterationIdentifier:a,MoveAbsolute:c,RecordNumber:b},m)};e.AMT_MessageLog_PositionToFirstRecord=function(a,c){e.Exec("AMT_MessageLog","PositionToFirstRecord",{},a,c)};e.AMT_MessageLog_FreezeLog=function(a,c){e.Exec("AMT_MessageLog","FreezeLog",{Freeze:a},c)};e.AMT_PublicKeyManagementService_AddCRL=function(a,c,b){e.Exec("AMT_PublicKeyManagementService","AddCRL",{Url:a,SerialNumbers:c},b)};e.AMT_PublicKeyManagementService_ResetCRLList=function(a,c){e.Exec("AMT_PublicKeyManagementService",
|
|
"ResetCRLList",{_method_dummy:a},c)};e.AMT_PublicKeyManagementService_AddCertificate=function(a,c){e.Exec("AMT_PublicKeyManagementService","AddCertificate",{CertificateBlob:a},c)};e.AMT_PublicKeyManagementService_AddTrustedRootCertificate=function(a,c){e.Exec("AMT_PublicKeyManagementService","AddTrustedRootCertificate",{CertificateBlob:a},c)};e.AMT_PublicKeyManagementService_AddKey=function(a,c){e.Exec("AMT_PublicKeyManagementService","AddKey",{KeyBlob:a},c)};e.AMT_PublicKeyManagementService_GeneratePKCS10Request=
|
|
function(a,c,b,m){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10Request",{KeyPair:a,DNName:c,Usage:b},m)};e.AMT_PublicKeyManagementService_GeneratePKCS10RequestEx=function(a,c,b,m){e.Exec("AMT_PublicKeyManagementService","GeneratePKCS10RequestEx",{KeyPair:a,SigningAlgorithm:c,NullSignedCertificateRequest:b},m)};e.AMT_PublicKeyManagementService_GenerateKeyPair=function(a,c,b){e.Exec("AMT_PublicKeyManagementService","GenerateKeyPair",{KeyAlgorithm:a,KeyLength:c},b)};e.AMT_RedirectionService_RequestStateChange=
|
|
function(a,c){e.Exec("AMT_RedirectionService","RequestStateChange",{RequestedState:a},c)};e.AMT_RedirectionService_TerminateSession=function(a,c){e.Exec("AMT_RedirectionService","TerminateSession",{SessionType:a},c)};e.AMT_RemoteAccessService_AddMpServer=function(a,c,b,m,h,k,d,p,l){e.Exec("AMT_RemoteAccessService","AddMpServer",{AccessInfo:a,InfoFormat:c,Port:b,AuthMethod:m,Certificate:h,Username:k,Password:d,CN:p},l)};e.AMT_RemoteAccessService_AddRemoteAccessPolicyRule=function(a,c,b,m,h,k){e.Exec("AMT_RemoteAccessService",
|
|
"AddRemoteAccessPolicyRule",{Trigger:a,TunnelLifeTime:c,ExtendedData:b,MpServer:m,InternalMpServer:h},k)};e.AMT_RemoteAccessService_CloseRemoteAccessConnection=function(a,c){e.Exec("AMT_RemoteAccessService","CloseRemoteAccessConnection",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_CommitChanges=function(a,c){e.Exec("AMT_SetupAndConfigurationService","CommitChanges",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_Unprovision=function(a,c){e.Exec("AMT_SetupAndConfigurationService",
|
|
"Unprovision",{ProvisioningMode:a},c)};e.AMT_SetupAndConfigurationService_PartialUnprovision=function(a,c){e.Exec("AMT_SetupAndConfigurationService","PartialUnprovision",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_ResetFlashWearOutProtection=function(a,c){e.Exec("AMT_SetupAndConfigurationService","ResetFlashWearOutProtection",{_method_dummy:a},c)};e.AMT_SetupAndConfigurationService_ExtendProvisioningPeriod=function(a,c){e.Exec("AMT_SetupAndConfigurationService","ExtendProvisioningPeriod",
|
|
{Duration:a},c)};e.AMT_SetupAndConfigurationService_SetMEBxPassword=function(a,c){e.Exec("AMT_SetupAndConfigurationService","SetMEBxPassword",{Password:a},c)};e.AMT_SetupAndConfigurationService_SetTLSPSK=function(a,c,b){e.Exec("AMT_SetupAndConfigurationService","SetTLSPSK",{PID:a,PPS:c},b)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecord=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecord",{},a)};e.AMT_SetupAndConfigurationService_GetUuid=function(a){e.Exec("AMT_SetupAndConfigurationService",
|
|
"GetUuid",{},a)};e.AMT_SetupAndConfigurationService_GetUnprovisionBlockingComponents=function(a){e.Exec("AMT_SetupAndConfigurationService","GetUnprovisionBlockingComponents",{},a)};e.AMT_SetupAndConfigurationService_GetProvisioningAuditRecordV2=function(a){e.Exec("AMT_SetupAndConfigurationService","GetProvisioningAuditRecordV2",{},a)};e.AMT_SystemDefensePolicy_GetTimeout=function(a){e.Exec("AMT_SystemDefensePolicy","GetTimeout",{},a)};e.AMT_SystemDefensePolicy_SetTimeout=function(a,c){e.Exec("AMT_SystemDefensePolicy",
|
|
"SetTimeout",{Timeout:a},c)};e.AMT_SystemDefensePolicy_UpdateStatistics=function(a,c,b,m,h,k){e.Exec("AMT_SystemDefensePolicy","UpdateStatistics",{NetworkInterface:a,ResetOnRead:c},b,m,h,k)};e.AMT_SystemPowerScheme_SetPowerScheme=function(a,c,b){e.Exec("AMT_SystemPowerScheme","SetPowerScheme",{},a,b,0,{InstanceID:c})};e.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch=function(a,c){e.Exec("AMT_TimeSynchronizationService","GetLowAccuracyTimeSynch",{},a,c)};e.AMT_TimeSynchronizationService_SetHighAccuracyTimeSynch=
|
|
function(a,c,b,m,h){e.Exec("AMT_TimeSynchronizationService","SetHighAccuracyTimeSynch",{Ta0:a,Tm1:c,Tm2:b},m,h)};e.AMT_UserInitiatedConnectionService_RequestStateChange=function(a,c,b){e.Exec("AMT_UserInitiatedConnectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_WebUIService_RequestStateChange=function(a,c,b){e.Exec("AMT_WebUIService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.AMT_WiFiPortConfigurationService_AddWiFiSettings=function(a,c,b,m,h,k){e.ExecWithXml("AMT_WiFiPortConfigurationService",
|
|
"AddWiFiSettings",{WiFiEndpoint:a,WiFiEndpointSettingsInput:c,IEEE8021xSettingsInput:b,ClientCredential:m,CACredential:h},k)};e.AMT_WiFiPortConfigurationService_UpdateWiFiSettings=function(a,c,b,m,h,k){e.ExecWithXml("AMT_WiFiPortConfigurationService","UpdateWiFiSettings",{WiFiEndpointSettings:a,WiFiEndpointSettingsInput:c,IEEE8021xSettingsInput:b,ClientCredential:m,CACredential:h},k)};e.AMT_WiFiPortConfigurationService_DeleteAllITProfiles=function(a,c){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllITProfiles",
|
|
{_method_dummy:a},c)};e.AMT_WiFiPortConfigurationService_DeleteAllUserProfiles=function(a,c){e.Exec("AMT_WiFiPortConfigurationService","DeleteAllUserProfiles",{_method_dummy:a},c)};e.CIM_Account_RequestStateChange=function(a,c,b){e.Exec("CIM_Account","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_AccountManagementService_CreateAccount=function(a,c,b){e.Exec("CIM_AccountManagementService","CreateAccount",{System:a,AccountTemplate:c},b)};e.CIM_BootConfigSetting_ChangeBootOrder=function(a,
|
|
c){e.Exec("CIM_BootConfigSetting","ChangeBootOrder",{Source:a},c)};e.CIM_BootService_SetBootConfigRole=function(a,c,b){e.Exec("CIM_BootService","SetBootConfigRole",{BootConfigSetting:a,Role:c},b,0,1)};e.CIM_Card_ConnectorPower=function(a,c,b){e.Exec("CIM_Card","ConnectorPower",{Connector:a,PoweredOn:c},b)};e.CIM_Card_IsCompatible=function(a,c){e.Exec("CIM_Card","IsCompatible",{ElementToCheck:a},c)};e.CIM_Chassis_IsCompatible=function(a,c){e.Exec("CIM_Chassis","IsCompatible",{ElementToCheck:a},c)};
|
|
e.CIM_Fan_SetSpeed=function(a,c){e.Exec("CIM_Fan","SetSpeed",{DesiredSpeed:a},c)};e.CIM_KVMRedirectionSAP_RequestStateChange=function(a,c,b){e.Exec("CIM_KVMRedirectionSAP","RequestStateChange",{RequestedState:a},b)};e.CIM_MediaAccessDevice_LockMedia=function(a,c){e.Exec("CIM_MediaAccessDevice","LockMedia",{Lock:a},c)};e.CIM_MediaAccessDevice_SetPowerState=function(a,c,b){e.Exec("CIM_MediaAccessDevice","SetPowerState",{PowerState:a,Time:c},b)};e.CIM_MediaAccessDevice_Reset=function(a){e.Exec("CIM_MediaAccessDevice",
|
|
"Reset",{},a)};e.CIM_MediaAccessDevice_EnableDevice=function(a,c){e.Exec("CIM_MediaAccessDevice","EnableDevice",{Enabled:a},c)};e.CIM_MediaAccessDevice_OnlineDevice=function(a,c){e.Exec("CIM_MediaAccessDevice","OnlineDevice",{Online:a},c)};e.CIM_MediaAccessDevice_QuiesceDevice=function(a,c){e.Exec("CIM_MediaAccessDevice","QuiesceDevice",{Quiesce:a},c)};e.CIM_MediaAccessDevice_SaveProperties=function(a){e.Exec("CIM_MediaAccessDevice","SaveProperties",{},a)};e.CIM_MediaAccessDevice_RestoreProperties=
|
|
function(a){e.Exec("CIM_MediaAccessDevice","RestoreProperties",{},a)};e.CIM_MediaAccessDevice_RequestStateChange=function(a,c,b){e.Exec("CIM_MediaAccessDevice","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_PhysicalFrame_IsCompatible=function(a,c){e.Exec("CIM_PhysicalFrame","IsCompatible",{ElementToCheck:a},c)};e.CIM_PhysicalPackage_IsCompatible=function(a,c){e.Exec("CIM_PhysicalPackage","IsCompatible",{ElementToCheck:a},c)};e.CIM_PowerManagementService_RequestPowerStateChange=
|
|
function(a,c,b,m,h){e.Exec("CIM_PowerManagementService","RequestPowerStateChange",{PowerState:a,ManagedElement:c,Time:b,TimeoutPeriod:m},h,0,1)};e.CIM_PowerSupply_SetPowerState=function(a,c,b){e.Exec("CIM_PowerSupply","SetPowerState",{PowerState:a,Time:c},b)};e.CIM_PowerSupply_Reset=function(a){e.Exec("CIM_PowerSupply","Reset",{},a)};e.CIM_PowerSupply_EnableDevice=function(a,c){e.Exec("CIM_PowerSupply","EnableDevice",{Enabled:a},c)};e.CIM_PowerSupply_OnlineDevice=function(a,c){e.Exec("CIM_PowerSupply",
|
|
"OnlineDevice",{Online:a},c)};e.CIM_PowerSupply_QuiesceDevice=function(a,c){e.Exec("CIM_PowerSupply","QuiesceDevice",{Quiesce:a},c)};e.CIM_PowerSupply_SaveProperties=function(a){e.Exec("CIM_PowerSupply","SaveProperties",{},a)};e.CIM_PowerSupply_RestoreProperties=function(a){e.Exec("CIM_PowerSupply","RestoreProperties",{},a)};e.CIM_PowerSupply_RequestStateChange=function(a,c,b){e.Exec("CIM_PowerSupply","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_Processor_SetPowerState=function(a,
|
|
c,b){e.Exec("CIM_Processor","SetPowerState",{PowerState:a,Time:c},b)};e.CIM_Processor_Reset=function(a){e.Exec("CIM_Processor","Reset",{},a)};e.CIM_Processor_EnableDevice=function(a,c){e.Exec("CIM_Processor","EnableDevice",{Enabled:a},c)};e.CIM_Processor_OnlineDevice=function(a,c){e.Exec("CIM_Processor","OnlineDevice",{Online:a},c)};e.CIM_Processor_QuiesceDevice=function(a,c){e.Exec("CIM_Processor","QuiesceDevice",{Quiesce:a},c)};e.CIM_Processor_SaveProperties=function(a){e.Exec("CIM_Processor","SaveProperties",
|
|
{},a)};e.CIM_Processor_RestoreProperties=function(a){e.Exec("CIM_Processor","RestoreProperties",{},a)};e.CIM_Processor_RequestStateChange=function(a,c,b){e.Exec("CIM_Processor","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_RecordLog_ClearLog=function(a){e.Exec("CIM_RecordLog","ClearLog",{},a)};e.CIM_RecordLog_RequestStateChange=function(a,c,b){e.Exec("CIM_RecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_RedirectionService_RequestStateChange=function(a,
|
|
c,b){e.Exec("CIM_RedirectionService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_Sensor_SetPowerState=function(a,c,b){e.Exec("CIM_Sensor","SetPowerState",{PowerState:a,Time:c},b)};e.CIM_Sensor_Reset=function(a){e.Exec("CIM_Sensor","Reset",{},a)};e.CIM_Sensor_EnableDevice=function(a,c){e.Exec("CIM_Sensor","EnableDevice",{Enabled:a},c)};e.CIM_Sensor_OnlineDevice=function(a,c){e.Exec("CIM_Sensor","OnlineDevice",{Online:a},c)};e.CIM_Sensor_QuiesceDevice=function(a,c){e.Exec("CIM_Sensor",
|
|
"QuiesceDevice",{Quiesce:a},c)};e.CIM_Sensor_SaveProperties=function(a){e.Exec("CIM_Sensor","SaveProperties",{},a)};e.CIM_Sensor_RestoreProperties=function(a){e.Exec("CIM_Sensor","RestoreProperties",{},a)};e.CIM_Sensor_RequestStateChange=function(a,c,b){e.Exec("CIM_Sensor","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_StatisticalData_ResetSelectedStats=function(a,c){e.Exec("CIM_StatisticalData","ResetSelectedStats",{SelectedStatistics:a},c)};e.CIM_Watchdog_KeepAlive=function(a){e.Exec("CIM_Watchdog",
|
|
"KeepAlive",{},a)};e.CIM_Watchdog_SetPowerState=function(a,c,b){e.Exec("CIM_Watchdog","SetPowerState",{PowerState:a,Time:c},b)};e.CIM_Watchdog_Reset=function(a){e.Exec("CIM_Watchdog","Reset",{},a)};e.CIM_Watchdog_EnableDevice=function(a,c){e.Exec("CIM_Watchdog","EnableDevice",{Enabled:a},c)};e.CIM_Watchdog_OnlineDevice=function(a,c){e.Exec("CIM_Watchdog","OnlineDevice",{Online:a},c)};e.CIM_Watchdog_QuiesceDevice=function(a,c){e.Exec("CIM_Watchdog","QuiesceDevice",{Quiesce:a},c)};e.CIM_Watchdog_SaveProperties=
|
|
function(a){e.Exec("CIM_Watchdog","SaveProperties",{},a)};e.CIM_Watchdog_RestoreProperties=function(a){e.Exec("CIM_Watchdog","RestoreProperties",{},a)};e.CIM_Watchdog_RequestStateChange=function(a,c,b){e.Exec("CIM_Watchdog","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.CIM_WiFiPort_SetPowerState=function(a,c,b){e.Exec("CIM_WiFiPort","SetPowerState",{PowerState:a,Time:c},b)};e.CIM_WiFiPort_Reset=function(a){e.Exec("CIM_WiFiPort","Reset",{},a)};e.CIM_WiFiPort_EnableDevice=function(a,
|
|
c){e.Exec("CIM_WiFiPort","EnableDevice",{Enabled:a},c)};e.CIM_WiFiPort_OnlineDevice=function(a,c){e.Exec("CIM_WiFiPort","OnlineDevice",{Online:a},c)};e.CIM_WiFiPort_QuiesceDevice=function(a,c){e.Exec("CIM_WiFiPort","QuiesceDevice",{Quiesce:a},c)};e.CIM_WiFiPort_SaveProperties=function(a){e.Exec("CIM_WiFiPort","SaveProperties",{},a)};e.CIM_WiFiPort_RestoreProperties=function(a){e.Exec("CIM_WiFiPort","RestoreProperties",{},a)};e.CIM_WiFiPort_RequestStateChange=function(a,c,b){e.Exec("CIM_WiFiPort",
|
|
"RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.IPS_HostBasedSetupService_Setup=function(a,c,b,m,h,k,d){e.Exec("IPS_HostBasedSetupService","Setup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:c,McNonce:b,Certificate:m,SigningAlgorithm:h,DigitalSignature:k},d)};e.IPS_HostBasedSetupService_AddNextCertInChain=function(a,c,b,m){e.Exec("IPS_HostBasedSetupService","AddNextCertInChain",{NextCertificate:a,IsLeafCertificate:c,IsRootCertificate:b},m)};e.IPS_HostBasedSetupService_AdminSetup=
|
|
function(a,c,b,m,h,k){e.Exec("IPS_HostBasedSetupService","AdminSetup",{NetAdminPassEncryptionType:a,NetworkAdminPassword:c,McNonce:b,SigningAlgorithm:m,DigitalSignature:h},k)};e.IPS_HostBasedSetupService_UpgradeClientToAdmin=function(a,c,b,m){e.Exec("IPS_HostBasedSetupService","UpgradeClientToAdmin",{McNonce:a,SigningAlgorithm:c,DigitalSignature:b},m)};e.IPS_HostBasedSetupService_DisableClientControlMode=function(a,c){e.Exec("IPS_HostBasedSetupService","DisableClientControlMode",{_method_dummy:a},
|
|
c)};e.IPS_KVMRedirectionSettingData_TerminateSession=function(a){e.Exec("IPS_KVMRedirectionSettingData","TerminateSession",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelRead=function(a){e.Exec("IPS_KVMRedirectionSettingData","DataChannelRead",{},a)};e.IPS_KVMRedirectionSettingData_DataChannelWrite=function(a,c){e.Exec("IPS_KVMRedirectionSettingData","DataChannelWrite",{DataMessage:a},c)};e.IPS_OptInService_StartOptIn=function(a){e.Exec("IPS_OptInService","StartOptIn",{},a)};e.IPS_OptInService_CancelOptIn=
|
|
function(a){e.Exec("IPS_OptInService","CancelOptIn",{},a)};e.IPS_OptInService_SendOptInCode=function(a,c){e.Exec("IPS_OptInService","SendOptInCode",{OptInCode:a},c)};e.IPS_OptInService_StartService=function(a){e.Exec("IPS_OptInService","StartService",{},a)};e.IPS_OptInService_StopService=function(a){e.Exec("IPS_OptInService","StopService",{},a)};e.IPS_OptInService_RequestStateChange=function(a,c,b){e.Exec("IPS_OptInService","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.IPS_ProvisioningRecordLog_RequestStateChange=
|
|
function(a,c,b){e.Exec("IPS_ProvisioningRecordLog","RequestStateChange",{RequestedState:a,TimeoutPeriod:c},b)};e.IPS_ProvisioningRecordLog_ClearLog=function(a,c){e.Exec("IPS_ProvisioningRecordLog","ClearLog",{_method_dummy:a},c)};e.IPS_ScreenConfigurationService_SetSessionState=function(a,c,b){e.Exec("IPS_ScreenConfigurationService","SetSessionState",{SessionState:a,ConsecutiveRebootsNum:c},b)};e.IPS_SecIOService_RequestStateChange=function(a,c,b){e.Exec("IPS_SecIOService","RequestStateChange",{RequestedState:a,
|
|
TimeoutPeriod:c},b)};e.IPS_HTTPProxyService_AddProxyAccessPoint=function(a,c,b,m,h){e.Exec("IPS_HTTPProxyService","AddProxyAccessPoint",{AccessInfo:a,InfoFormat:c,Port:b,NetworkDnsSuffix:m},h)};e.AmtStatusToStr=function(a){return e.AmtStatusCodes[a]?e.AmtStatusCodes[a]:"UNKNOWN_ERROR"};e.AmtStatusCodes={0:"SUCCESS",1:"INTERNAL_ERROR",2:"NOT_READY",3:"INVALID_PT_MODE",4:"INVALID_MESSAGE_LENGTH",5:"TABLE_FINGERPRINT_NOT_AVAILABLE",6:"INTEGRITY_CHECK_FAILED",7:"UNSUPPORTED_ISVS_VERSION",8:"APPLICATION_NOT_REGISTERED",
|
|
9:"INVALID_REGISTRATION_DATA",10:"APPLICATION_DOES_NOT_EXIST",11:"NOT_ENOUGH_STORAGE",12:"INVALID_NAME",13:"BLOCK_DOES_NOT_EXIST",14:"INVALID_BYTE_OFFSET",15:"INVALID_BYTE_COUNT",16:"NOT_PERMITTED",17:"NOT_OWNER",18:"BLOCK_LOCKED_BY_OTHER",19:"BLOCK_NOT_LOCKED",20:"INVALID_GROUP_PERMISSIONS",21:"GROUP_DOES_NOT_EXIST",22:"INVALID_MEMBER_COUNT",23:"MAX_LIMIT_REACHED",24:"INVALID_AUTH_TYPE",25:"AUTHENTICATION_FAILED",26:"INVALID_DHCP_MODE",27:"INVALID_IP_ADDRESS",28:"INVALID_DOMAIN_NAME",29:"UNSUPPORTED_VERSION",
|
|
30:"REQUEST_UNEXPECTED",31:"INVALID_TABLE_TYPE",32:"INVALID_PROVISIONING_STATE",33:"UNSUPPORTED_OBJECT",34:"INVALID_TIME",35:"INVALID_INDEX",36:"INVALID_PARAMETER",37:"INVALID_NETMASK",38:"FLASH_WRITE_LIMIT_EXCEEDED",39:"INVALID_IMAGE_LENGTH",40:"INVALID_IMAGE_SIGNATURE",41:"PROPOSE_ANOTHER_VERSION",42:"INVALID_PID_FORMAT",43:"INVALID_PPS_FORMAT",44:"BIST_COMMAND_BLOCKED",45:"CONNECTION_FAILED",46:"CONNECTION_TOO_MANY",47:"RNG_GENERATION_IN_PROGRESS",48:"RNG_NOT_READY",49:"CERTIFICATE_NOT_READY",
|
|
1024:"DISABLED_BY_POLICY",2048:"NETWORK_IF_ERROR_BASE",2049:"UNSUPPORTED_OEM_NUMBER",2050:"UNSUPPORTED_BOOT_OPTION",2051:"INVALID_COMMAND",2052:"INVALID_SPECIAL_COMMAND",2053:"INVALID_HANDLE",2054:"INVALID_PASSWORD",2055:"INVALID_REALM",2056:"STORAGE_ACL_ENTRY_IN_USE",2057:"DATA_MISSING",2058:"DUPLICATE",2059:"EVENTLOG_FROZEN",2060:"PKI_MISSING_KEYS",2061:"PKI_GENERATING_KEYS",2062:"INVALID_KEY",2063:"INVALID_CERT",2064:"CERT_KEY_NOT_MATCH",2065:"MAX_KERB_DOMAIN_REACHED",2066:"UNSUPPORTED",2067:"INVALID_PRIORITY",
|
|
2068:"NOT_FOUND",2069:"INVALID_CREDENTIALS",2070:"INVALID_PASSPHRASE",2072:"NO_ASSOCIATION",2075:"AUDIT_FAIL",2076:"BLOCKING_COMPONENT",2081:"USER_CONSENT_REQUIRED",4096:"APP_INTERNAL_ERROR",4097:"NOT_INITIALIZED",4098:"LIB_VERSION_UNSUPPORTED",4099:"INVALID_PARAM",4100:"RESOURCES",4101:"HARDWARE_ACCESS_ERROR",4102:"REQUESTOR_NOT_REGISTERED",4103:"NETWORK_ERROR",4104:"PARAM_BUFFER_TOO_SHORT",4105:"COM_NOT_INITIALIZED_IN_THREAD",4106:"URL_REQUIRED"};e.GetMessageLog=function(a,c){e.AMT_MessageLog_PositionToFirstRecord(u,
|
|
[a,c,[]])};var k="Unspecified.;No system memory is physically installed in the system.;No usable system memory, all installed memory has experienced an unrecoverable failure.;Unrecoverable hard-disk/ATAPI/IDE device failure.;Unrecoverable system-board failure.;Unrecoverable diskette subsystem failure.;Unrecoverable hard-disk controller failure.;Unrecoverable PS/2 or USB keyboard failure.;Removable boot media not found.;Unrecoverable video controller failure.;No video device detected.;Firmware (BIOS) ROM corruption detected.;CPU voltage mismatch (processors that share same supply have mismatched voltage requirements);CPU speed matching failure".split(";"),
|
|
h="Unspecified.;Memory initialization.;Starting hard-disk initialization and test;Secondary processor(s) initialization;User authentication;User-initiated system setup;USB resource configuration;PCI resource configuration;Option ROM initialization;Video initialization;Cache initialization;SM Bus initialization;Keyboard controller initialization;Embedded controller/management controller initialization;Docking station attachment;Enabling docking station;Docking station ejection;Disabling docking station;Calling operating system wake-up vector;Starting operating system boot process;Baseboard or motherboard initialization;reserved;Floppy initialization;Keyboard test;Pointing device test;Primary processor initialization".split(";"),
|
|
C="Unspecified;Other;Unknown;Processor;Disk;Peripheral;System management module;System board;Memory module;Processor module;Power supply;Add in card;Front panel board;Back panel board;Power system board;Drive backplane;System internal expansion board;Other system board;Processor board;Power unit;Power module;Power management board;Chassis back panel board;System chassis;Sub chassis;Other chassis board;Disk drive bay;Peripheral bay;Device bay;Fan cooling;Cooling unit;Cable interconnect;Memory device;System management software;BIOS;Intel(r) ME;System bus;Group;Intel(r) ME;External environment;Battery;Processing blade;Connectivity switch;Processor/memory module;I/O module;Processor I/O module;Management controller firmware;IPMI channel;PCI bus;PCI express bus;SCSI bus;SATA/SAS bus;Processor front side bus".split(";");
|
|
e.RealmNames=";;Redirection;;Hardware Asset;Remote Control;Storage;Event Manager;Storage Admin;Agent Presence Local;Agent Presence Remote;Circuit Breaker;Network Time;General Information;Firmware Update;EIT;LocalUN;Endpoint Access Control;Endpoint Access Control Admin;Event Log Reader;Audit Log;ACL Realm;;;Local System".split(";");e.WatchdogCurrentStates={1:"Not Started",2:"Stopped",4:"Running",8:"Expired",16:"Suspended"};var p={16:"Security Admin",17:"RCO",18:"Redirection Manager",19:"Firmware Update Manager",
|
|
20:"Security Audit Log",21:"Network Time",22:"Network Administration",23:"Storage Administration",24:"Event Manager",25:"Circuit Breaker Manager",26:"Agent Presence Manager",27:"Wireless Configuration",28:"EAC",29:"KVM",30:"User Opt-In Events",32:"Screen Blanking",33:"Watchdog Events",1600:"Provisioning Started",1601:"Provisioning Completed",1602:"ACL Entry Added",1603:"ACL Entry Modified",1604:"ACL Entry Removed",1605:"ACL Access with Invalid Credentials",1606:"ACL Entry State",1607:"TLS State Changed",
|
|
1608:"TLS Server Certificate Set",1609:"TLS Server Certificate Remove",1610:"TLS Trusted Root Certificate Added",1611:"TLS Trusted Root Certificate Removed",1612:"TLS Preshared Key Set",1613:"Kerberos Settings Modified",1614:"Kerberos Master Key Modified",1615:"Flash Wear out Counters Reset",1616:"Power Package Modified",1617:"Set Realm Authentication Mode",1618:"Upgrade Client to Admin Control Mode",1619:"Unprovisioning Started",1700:"Performed Power Up",1701:"Performed Power Down",1702:"Performed Power Cycle",
|
|
1703:"Performed Reset",1704:"Set Boot Options",1800:"IDER Session Opened",1801:"IDER Session Closed",1802:"IDER Enabled",1803:"IDER Disabled",1804:"SoL Session Opened",1805:"SoL Session Closed",1806:"SoL Enabled",1807:"SoL Disabled",1808:"KVM Session Started",1809:"KVM Session Ended",1810:"KVM Enabled",1811:"KVM Disabled",1812:"VNC Password Failed 3 Times",1900:"Firmware Updated",1901:"Firmware Update Failed",2E3:"Security Audit Log Cleared",2001:"Security Audit Policy Modified",2002:"Security Audit Log Disabled",
|
|
2003:"Security Audit Log Enabled",2004:"Security Audit Log Exported",2005:"Security Audit Log Recovered",2100:"Intel® ME Time Set",2200:"TCPIP Parameters Set",2201:"Host Name Set",2202:"Domain Name Set",2203:"VLAN Parameters Set",2204:"Link Policy Set",2205:"IPv6 Parameters Set",2300:"Global Storage Attributes Set",2301:"Storage EACL Modified",2302:"Storage FPACL Modified",2303:"Storage Write Operation",2400:"Alert Subscribed",2401:"Alert Unsubscribed",2402:"Event Log Cleared",2403:"Event Log Frozen",
|
|
2500:"CB Filter Added",2501:"CB Filter Removed",2502:"CB Policy Added",2503:"CB Policy Removed",2504:"CB Default Policy Set",2505:"CB Heuristics Option Set",2506:"CB Heuristics State Cleared",2600:"Agent Watchdog Added",2601:"Agent Watchdog Removed",2602:"Agent Watchdog Action Set",2700:"Wireless Profile Added",2701:"Wireless Profile Removed",2702:"Wireless Profile Updated",2800:"EAC Posture Signer SET",2801:"EAC Enabled",2802:"EAC Disabled",2803:"EAC Posture State",2804:"EAC Set Options",2900:"KVM Opt-in Enabled",
|
|
2901:"KVM Opt-in Disabled",2902:"KVM Password Changed",2903:"KVM Consent Succeeded",2904:"KVM Consent Failed",3E3:"Opt-In Policy Change",3001:"Send Consent Code Event",3002:"Start Opt-In Blocked Event"};e.GetAuditLogExtendedDataStr=function(a,c){if((1602==a||1604==a)&&0==c.charCodeAt(0))return c.substring(2,2+c.charCodeAt(1));if(1603==a)return 0==c.charCodeAt(1)?c.substring(3):null;if(1605==a)return["Invalid ME access","Invalid MEBx access"][c.charCodeAt(0)];if(1606==a){var b=["Disabled","Enabled"][c.charCodeAt(0)];
|
|
0==c.charCodeAt(1)&&(b+=", "+c.substring(3));return b}return 1607==a?"Remote "+["NoAuth","ServerAuth","MutualAuth"][c.charCodeAt(0)]+", Local "+["NoAuth","ServerAuth","MutualAuth"][c.charCodeAt(1)]:1617==a?e.RealmNames[ReadInt(c,0)]+", "+["NoAuth","Auth","Disabled"][c.charCodeAt(4)]:1619==a?["BIOS","MEBx","Local MEI","Local WSMAN","Remote WSAMN"][c.charCodeAt(0)]:1900==a?"From "+ReadShort(c,0)+"."+ReadShort(c,2)+"."+ReadShort(c,4)+"."+ReadShort(c,6)+" to "+ReadShort(c,8)+"."+ReadShort(c,10)+"."+ReadShort(c,
|
|
12)+"."+ReadShort(c,14):2100==a?(b=new Date,b.setTime(1E3*ReadInt(c,0)+6E4*(new Date).getTimezoneOffset()),b.toLocaleString()):3E3==a?"From "+["None","KVM","All"][c.charCodeAt(0)]+" to "+["None","KVM","All"][c.charCodeAt(1)]:3001==a?["Success","Failed 3 times"][c.charCodeAt(0)]:null};e.GetAuditLog=function(a){e.AMT_AuditLog_ReadRecords(1,w,[a,[]])};return e}function hex_md5(a){return forge.md.md5.create().update(a).digest().toHex()}function rstr_md5(a){return hex2rstr(hex_md5(a))}
|
|
function execArgumentsToXml(a){if(void 0===a||null===a)return null;var b="",c;for(c in a){var d=a[c];d&&(b="reference"===d.__parameterType?b+referenceToXml(c,d):b+instanceToXml(c,d))}return b}
|
|
function instanceToXml(a,b){if(void 0===b||null===b)return null;var c=!!b.__namespace,d=c?"<q:":"<",g=c?"</q:":"</",c="<r:"+a+(c?' xmlns:q="'+b.__namespace+'"':"")+">",n;for(n in b)b.hasOwnProperty(n)&&0!==n.indexOf("__")&&("function"===typeof b[n]||Array.isArray(b[n])||("object"===typeof b[n]?console.error("only convert one level down..."):c+=d+n+">"+b[n].toString()+g+n+">"));return c+("</r:"+a+">")}
|
|
function referenceToXml(a,b){if(void 0===b||null===b)return null;var c="<r:"+a+"><a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+b.__resourceUri+"</w:ResourceURI><w:SelectorSet>",d;for(d in b)b.hasOwnProperty(d)&&0!==d.indexOf("__")&&("function"===typeof b[d]||"object"===typeof b[d]||Array.isArray(b[d])||(c+='<w:Selector Name="'+d+'">'+b[d].toString()+"</w:Selector>"));return c+("</w:SelectorSet></a:ReferenceParameters></r:"+a+">")}
|
|
function GetSidString(a){for(var b="S-"+a.charCodeAt(0)+"-"+a.charCodeAt(7),c=2;c<a.length/4;c++)b+="-"+ReadIntX(a,4*c);return b}
|
|
function GetSidByteArray(a){if(!a||null==a)return null;a=a.split("-");if(4>a.length||"s"!=a[0]&&"S"!=a[0])return null;for(var b=1;b<a.length;b++){var c=parseInt(a[b]);if(c!=a[b])return null;a[b]=c}c=String.fromCharCode(a[1])+String.fromCharCode(a.length-3)+ShortToStr(Math.floor(a[2]/Math.pow(2,32)))+IntToStr(a[2]&65535);for(b=3;b<a.length;b++)c+=IntToStrX(a[b]);return c}
|
|
(function(a,b){"function"===typeof define&&define.amd?define([],b):a.forge=b()})(this,function(){var a,b,c;(function(d){function g(a,c){var b,m,h,k,d,z,e,l,w,v=c&&c.split("/"),E=p.map,C=E&&E["*"]||{};if(a&&"."===a.charAt(0))if(c){v=v.slice(0,v.length-1);a=a.split("/");d=a.length-1;p.nodeIdCompat&&A.test(a[d])&&(a[d]=a[d].replace(A,""));a=v.concat(a);for(d=0;d<a.length;d+=1)if(b=a[d],"."===b)a.splice(d,1),--d;else if(".."===b)if(1!==d||".."!==a[2]&&".."!==a[0])0<d&&(a.splice(d-1,2),d-=2);else break;
|
|
a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((v||C)&&E){b=a.split("/");for(d=b.length;0<d;--d){m=b.slice(0,d).join("/");if(v)for(w=v.length;0<w;--w)if(h=E[v.slice(0,w).join("/")])if(h=h[m]){k=h;z=d;break}if(k)break;!e&&C&&C[m]&&(e=C[m],l=d)}!k&&e&&(k=e,z=l);k&&(b.splice(0,z,k),a=b.join("/"))}return a}function n(a,c){return function(){return v.apply(d,z.call(arguments,0).concat([a,c]))}}function r(a){return function(c){return g(c,a)}}function u(a){return function(c){h[a]=c}}function m(a){if(y.call(C,
|
|
a)){var c=C[a];delete C[a];F[a]=!0;e.apply(d,c)}if(!y.call(h,a)&&!y.call(F,a))throw Error("No "+a);return h[a]}function l(a){var c,b=a?a.indexOf("!"):-1;-1<b&&(c=a.substring(0,b),a=a.substring(b+1,a.length));return[c,a]}function w(a){return function(){return p&&p.config&&p.config[a]||{}}}var e,v,E,k,h={},C={},p={},F={},y=Object.prototype.hasOwnProperty,z=[].slice,A=/\.js$/;E=function(a,c){var b,h=l(a),k=h[0];a=h[1];k&&(k=g(k,c),b=m(k));k?a=b&&b.normalize?b.normalize(a,r(c)):g(a,c):(a=g(a,c),h=l(a),
|
|
k=h[0],a=h[1],k&&(b=m(k)));return{f:k?k+"!"+a:a,n:a,pr:k,p:b}};k={require:function(a){return n(a)},exports:function(a){var c=h[a];return"undefined"!==typeof c?c:h[a]={}},module:function(a){return{id:a,uri:"",exports:h[a],config:w(a)}}};e=function(a,c,b,z){var e,p,l,w,A=[];p=typeof b;var v;z=z||a;if("undefined"===p||"function"===p){c=!c.length&&b.length?["require","exports","module"]:c;for(w=0;w<c.length;w+=1)if(l=E(c[w],z),p=l.f,"require"===p)A[w]=k.require(a);else if("exports"===p)A[w]=k.exports(a),
|
|
v=!0;else if("module"===p)e=A[w]=k.module(a);else if(y.call(h,p)||y.call(C,p)||y.call(F,p))A[w]=m(p);else if(l.p)l.p.load(l.n,n(z,!0),u(p),{}),A[w]=h[p];else throw Error(a+" missing "+p);c=b?b.apply(h[a],A):void 0;a&&(e&&e.exports!==d&&e.exports!==h[a]?h[a]=e.exports:c===d&&v||(h[a]=c))}else a&&(h[a]=b)};a=b=v=function(a,c,b,h,z){if("string"===typeof a)return k[a]?k[a](c):m(E(a,c).f);if(!a.splice){p=a;p.deps&&v(p.deps,p.callback);if(!c)return;c.splice?(a=c,c=b,b=null):a=d}c=c||function(){};"function"===
|
|
typeof b&&(b=h,h=z);h?e(d,a,c,b):setTimeout(function(){e(d,a,c,b)},4);return v};v.config=function(a){return v(a)};a._defined=h;c=function(a,c,b){c.splice||(b=c,c=[]);y.call(h,a)||y.call(C,a)||(C[a]=[a,c,b])};c.amd={jQuery:!0}})();c("node_modules/almond/almond",function(){});(function(){function a(c){function b(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(d.isArrayBuffer(a)||d.isArrayBufferView(a)){a=new Uint8Array(a);try{this.data=String.fromCharCode.apply(null,a)}catch(c){for(var m=
|
|
0;m<a.length;++m)this.putByte(a[m])}}else if(a instanceof b||"object"===typeof a&&"string"===typeof a.data&&"number"===typeof a.read)this.data=a.data,this.read=a.read;this._constructedStringLength=0}var d=c.util=c.util||{};(function(){if("undefined"!==typeof process&&process.nextTick)d.nextTick=process.nextTick,d.setImmediate="function"===typeof setImmediate?setImmediate:d.nextTick;else if("function"===typeof setImmediate)d.setImmediate=setImmediate,d.nextTick=function(a){return setImmediate(a)};
|
|
else{d.setImmediate=function(a){setTimeout(a,0)};if("undefined"!==typeof window&&"function"===typeof window.postMessage){var a=[];d.setImmediate=function(c){a.push(c);1===a.length&&window.postMessage("forge.setImmediate","*")};window.addEventListener("message",function(c){c.source===window&&"forge.setImmediate"===c.data&&(c.stopPropagation(),c=a.slice(),a.length=0,c.forEach(function(a){a()}))},!0)}if("undefined"!==typeof MutationObserver){var c=Date.now(),b=!0,m=document.createElement("div"),a=[];
|
|
(new MutationObserver(function(){var c=a.slice();a.length=0;c.forEach(function(a){a()})})).observe(m,{attributes:!0});var h=d.setImmediate;d.setImmediate=function(d){15<Date.now()-c?(c=Date.now(),h(d)):(a.push(d),1===a.length&&m.setAttribute("a",b=!b))}}d.nextTick=d.setImmediate}})();d.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};d.isArrayBuffer=function(a){return"undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer};d.isArrayBufferView=function(a){return a&&
|
|
d.isArrayBuffer(a.buffer)&&void 0!==a.byteLength};d.ByteBuffer=b;d.ByteStringBuffer=b;d.ByteStringBuffer.prototype._optimizeConstructedString=function(a){this._constructedStringLength+=a;4096<this._constructedStringLength&&(this.data.substr(0,1),this._constructedStringLength=0)};d.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};d.ByteStringBuffer.prototype.isEmpty=function(){return 0>=this.length()};d.ByteStringBuffer.prototype.putByte=function(a){return this.putBytes(String.fromCharCode(a))};
|
|
d.ByteStringBuffer.prototype.fillWithByte=function(a,c){a=String.fromCharCode(a);for(var b=this.data;0<c;)c&1&&(b+=a),c>>>=1,0<c&&(a+=a);this.data=b;this._optimizeConstructedString(c);return this};d.ByteStringBuffer.prototype.putBytes=function(a){this.data+=a;this._optimizeConstructedString(a.length);return this};d.ByteStringBuffer.prototype.putString=function(a){return this.putBytes(d.encodeUtf8(a))};d.ByteStringBuffer.prototype.putInt16=function(a){return this.putBytes(String.fromCharCode(a>>8&
|
|
255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt24=function(a){return this.putBytes(String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt32=function(a){return this.putBytes(String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt16Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>
|
|
8&255))};d.ByteStringBuffer.prototype.putInt24Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255))};d.ByteStringBuffer.prototype.putInt32Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>24&255))};d.ByteStringBuffer.prototype.putInt=function(a,c){var b="";do c-=8,b+=String.fromCharCode(a>>c&255);while(0<c);return this.putBytes(b)};
|
|
d.ByteStringBuffer.prototype.putSignedInt=function(a,c){0>a&&(a+=2<<c-1);return this.putInt(a,c)};d.ByteStringBuffer.prototype.putBuffer=function(a){return this.putBytes(a.getBytes())};d.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};d.ByteStringBuffer.prototype.getInt16=function(){var a=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);this.read+=2;return a};d.ByteStringBuffer.prototype.getInt24=function(){var a=this.data.charCodeAt(this.read)<<
|
|
16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);this.read+=3;return a};d.ByteStringBuffer.prototype.getInt32=function(){var a=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);this.read+=4;return a};d.ByteStringBuffer.prototype.getInt16Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;this.read+=2;return a};d.ByteStringBuffer.prototype.getInt24Le=
|
|
function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;this.read+=3;return a};d.ByteStringBuffer.prototype.getInt32Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;this.read+=4;return a};d.ByteStringBuffer.prototype.getInt=function(a){var c=0;do c=(c<<8)+this.data.charCodeAt(this.read++),a-=8;while(0<a);return c};d.ByteStringBuffer.prototype.getSignedInt=
|
|
function(a){var c=this.getInt(a);a=2<<a-2;c>=a&&(c-=a<<1);return c};d.ByteStringBuffer.prototype.getBytes=function(a){var c;a?(a=Math.min(this.length(),a),c=this.data.slice(this.read,this.read+a),this.read+=a):0===a?c="":(c=0===this.read?this.data:this.data.slice(this.read),this.clear());return c};d.ByteStringBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};d.ByteStringBuffer.prototype.at=function(a){return this.data.charCodeAt(this.read+
|
|
a)};d.ByteStringBuffer.prototype.setAt=function(a,c){this.data=this.data.substr(0,this.read+a)+String.fromCharCode(c)+this.data.substr(this.read+a+1);return this};d.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};d.ByteStringBuffer.prototype.copy=function(){var a=d.createBuffer(this.data);a.read=this.read;return a};d.ByteStringBuffer.prototype.compact=function(){0<this.read&&(this.data=this.data.slice(this.read),this.read=0);return this};d.ByteStringBuffer.prototype.clear=
|
|
function(){this.data="";this.read=0;return this};d.ByteStringBuffer.prototype.truncate=function(a){a=Math.max(0,this.length()-a);this.data=this.data.substr(this.read,a);this.read=0;return this};d.ByteStringBuffer.prototype.toHex=function(){for(var a="",c=this.read;c<this.data.length;++c){var b=this.data.charCodeAt(c);16>b&&(a+="0");a+=b.toString(16)}return a};d.ByteStringBuffer.prototype.toString=function(){return d.decodeUtf8(this.bytes())};d.DataBuffer=function(a,c){c=c||{};this.read=c.readOffset||
|
|
0;this.growSize=c.growSize||1024;var b=d.isArrayBuffer(a),m=d.isArrayBufferView(a);b||m?(this.data=b?new DataView(a):new DataView(a.buffer,a.byteOffset,a.byteLength),this.write="writeOffset"in c?c.writeOffset:this.data.byteLength):(this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==a&&void 0!==a&&this.putBytes(a),"writeOffset"in c&&(this.write=c.writeOffset))};d.DataBuffer.prototype.length=function(){return this.write-this.read};d.DataBuffer.prototype.isEmpty=function(){return 0>=this.length()};
|
|
d.DataBuffer.prototype.accommodate=function(a,c){if(this.length()>=a)return this;c=Math.max(c||this.growSize,a);var b=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),m=new Uint8Array(this.length()+c);m.set(b);this.data=new DataView(m.buffer);return this};d.DataBuffer.prototype.putByte=function(a){this.accommodate(1);this.data.setUint8(this.write++,a);return this};d.DataBuffer.prototype.fillWithByte=function(a,c){this.accommodate(c);for(var b=0;b<c;++b)this.data.setUint8(a);
|
|
return this};d.DataBuffer.prototype.putBytes=function(a,c){if(d.isArrayBufferView(a)){var b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),m=b.byteLength-b.byteOffset;this.accommodate(m);var h=new Uint8Array(this.data.buffer,this.write);h.set(b);this.write+=m;return this}if(d.isArrayBuffer(a))return b=new Uint8Array(a),this.accommodate(b.byteLength),h=new Uint8Array(this.data.buffer),h.set(b,this.write),this.write+=b.byteLength,this;if(a instanceof d.DataBuffer||"object"===typeof a&&"number"===
|
|
typeof a.read&&"number"===typeof a.write&&d.isArrayBufferView(a.data))return b=new Uint8Array(a.data.byteLength,a.read,a.length()),this.accommodate(b.byteLength),h=new Uint8Array(a.data.byteLength,this.write),h.set(b),this.write+=b.byteLength,this;a instanceof d.ByteStringBuffer&&(a=a.data,c="binary");c=c||"binary";if("string"===typeof a){if("hex"===c)return this.accommodate(Math.ceil(a.length/2)),b=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.hex.decode(a,b,this.write),this;if("base64"===
|
|
c)return this.accommodate(3*Math.ceil(a.length/4)),b=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.base64.decode(a,b,this.write),this;"utf8"===c&&(a=d.encodeUtf8(a),c="binary");if("binary"===c||"raw"===c)return this.accommodate(a.length),b=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.raw.decode(b),this;if("utf16"===c)return this.accommodate(2*a.length),b=new Uint16Array(this.data.buffer,this.write),this.write+=d.text.utf16.encode(b),this;throw Error("Invalid encoding: "+
|
|
c);}throw Error("Invalid parameter: "+a);};d.DataBuffer.prototype.putBuffer=function(a){this.putBytes(a);a.clear();return this};d.DataBuffer.prototype.putString=function(a){return this.putBytes(a,"utf16")};d.DataBuffer.prototype.putInt16=function(a){this.accommodate(2);this.data.setInt16(this.write,a);this.write+=2;return this};d.DataBuffer.prototype.putInt24=function(a){this.accommodate(3);this.data.setInt16(this.write,a>>8&65535);this.data.setInt8(this.write,a>>16&255);this.write+=3;return this};
|
|
d.DataBuffer.prototype.putInt32=function(a){this.accommodate(4);this.data.setInt32(this.write,a);this.write+=4;return this};d.DataBuffer.prototype.putInt16Le=function(a){this.accommodate(2);this.data.setInt16(this.write,a,!0);this.write+=2;return this};d.DataBuffer.prototype.putInt24Le=function(a){this.accommodate(3);this.data.setInt8(this.write,a>>16&255);this.data.setInt16(this.write,a>>8&65535,!0);this.write+=3;return this};d.DataBuffer.prototype.putInt32Le=function(a){this.accommodate(4);this.data.setInt32(this.write,
|
|
a,!0);this.write+=4;return this};d.DataBuffer.prototype.putInt=function(a,c){this.accommodate(c/8);do c-=8,this.data.setInt8(this.write++,a>>c&255);while(0<c);return this};d.DataBuffer.prototype.putSignedInt=function(a,c){this.accommodate(c/8);0>a&&(a+=2<<c-1);return this.putInt(a,c)};d.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};d.DataBuffer.prototype.getInt16=function(){var a=this.data.getInt16(this.read);this.read+=2;return a};d.DataBuffer.prototype.getInt24=
|
|
function(){var a=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);this.read+=3;return a};d.DataBuffer.prototype.getInt32=function(){var a=this.data.getInt32(this.read);this.read+=4;return a};d.DataBuffer.prototype.getInt16Le=function(){var a=this.data.getInt16(this.read,!0);this.read+=2;return a};d.DataBuffer.prototype.getInt24Le=function(){var a=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;this.read+=3;return a};d.DataBuffer.prototype.getInt32Le=function(){var a=
|
|
this.data.getInt32(this.read,!0);this.read+=4;return a};d.DataBuffer.prototype.getInt=function(a){var c=0;do c=(c<<8)+this.data.getInt8(this.read++),a-=8;while(0<a);return c};d.DataBuffer.prototype.getSignedInt=function(a){var c=this.getInt(a);a=2<<a-2;c>=a&&(c-=a<<1);return c};d.DataBuffer.prototype.getBytes=function(a){var c;a?(a=Math.min(this.length(),a),c=this.data.slice(this.read,this.read+a),this.read+=a):0===a?c="":(c=0===this.read?this.data:this.data.slice(this.read),this.clear());return c};
|
|
d.DataBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};d.DataBuffer.prototype.at=function(a){return this.data.getUint8(this.read+a)};d.DataBuffer.prototype.setAt=function(a,c){this.data.setUint8(a,c);return this};d.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};d.DataBuffer.prototype.copy=function(){return new d.DataBuffer(this)};d.DataBuffer.prototype.compact=function(){if(0<this.read){var a=
|
|
new Uint8Array(this.data.buffer,this.read),c=new Uint8Array(a.byteLength);c.set(a);this.data=new DataView(c);this.write-=this.read;this.read=0}return this};d.DataBuffer.prototype.clear=function(){this.data=new DataView(new ArrayBuffer(0));this.read=this.write=0;return this};d.DataBuffer.prototype.truncate=function(a){this.write=Math.max(0,this.length()-a);this.read=Math.min(this.read,this.write);return this};d.DataBuffer.prototype.toHex=function(){for(var a="",c=this.read;c<this.data.byteLength;++c){var b=
|
|
this.data.getUint8(c);16>b&&(a+="0");a+=b.toString(16)}return a};d.DataBuffer.prototype.toString=function(a){var c=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return d.binary.raw.encode(c);if("hex"===a)return d.binary.hex.encode(c);if("base64"===a)return d.binary.base64.encode(c);if("utf8"===a)return d.text.utf8.decode(c);if("utf16"===a)return d.text.utf16.decode(c);throw Error("Invalid encoding: "+a);};d.createBuffer=function(a,c){void 0!==a&&"utf8"===
|
|
(c||"raw")&&(a=d.encodeUtf8(a));return new d.ByteBuffer(a)};d.fillString=function(a,c){for(var b="";0<c;)c&1&&(b+=a),c>>>=1,0<c&&(a+=a);return b};d.xorBytes=function(a,c,b){for(var m="",d="",h="",k=0,e=0;0<b;--b,++k)d=a.charCodeAt(k)^c.charCodeAt(k),10<=e&&(m+=h,h="",e=0),h+=String.fromCharCode(d),++e;return m+h};d.hexToBytes=function(a){var c="",b=0;a.length&1&&(b=1,c+=String.fromCharCode(parseInt(a[0],16)));for(;b<a.length;b+=2)c+=String.fromCharCode(parseInt(a.substr(b,2),16));return c};d.bytesToHex=
|
|
function(a){return d.createBuffer(a).toHex()};d.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var e=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];d.encode64=function(a,c){for(var b="",m="",d,h,k,e=0;e<a.length;)d=
|
|
a.charCodeAt(e++),h=a.charCodeAt(e++),k=a.charCodeAt(e++),b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d>>2),b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|h>>4),isNaN(h)?b+="==":(b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((h&15)<<2|k>>6),b+=isNaN(k)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k&63)),c&&b.length>c&&(m+=b.substr(0,c)+"\r\n",b=b.substr(c));return m+
|
|
b};d.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c="",b,m,d,h,k=0;k<a.length;)b=e[a.charCodeAt(k++)-43],m=e[a.charCodeAt(k++)-43],d=e[a.charCodeAt(k++)-43],h=e[a.charCodeAt(k++)-43],c+=String.fromCharCode(b<<2|m>>4),64!==d&&(c+=String.fromCharCode((m&15)<<4|d>>2),64!==h&&(c+=String.fromCharCode((d&3)<<6|h)));return c};d.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};d.decodeUtf8=function(a){return decodeURIComponent(escape(a))};d.binary={raw:{},hex:{},base64:{}};
|
|
d.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};d.binary.raw.decode=function(a,c,b){var m=c;m||(m=new Uint8Array(a.length));for(var d=b=b||0,h=0;h<a.length;++h)m[d++]=a.charCodeAt(h);return c?d-b:m};d.binary.hex.encode=d.bytesToHex;d.binary.hex.decode=function(a,c,b){var m=c;m||(m=new Uint8Array(Math.ceil(a.length/2)));b=b||0;var d=0,h=b;a.length&1&&(d=1,m[h++]=parseInt(a[0],16));for(;d<a.length;d+=2)m[h++]=parseInt(a.substr(d,2),16);return c?h-b:m};d.binary.base64.encode=
|
|
function(a,c){for(var b="",m="",d,h,k,e=0;e<a.byteLength;)d=a[e++],h=a[e++],k=a[e++],b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d>>2),b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((d&3)<<4|h>>4),isNaN(h)?b+="==":(b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((h&15)<<2|k>>6),b+=isNaN(k)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k&63)),c&&b.length>c&&(m+=b.substr(0,
|
|
c)+"\r\n",b=b.substr(c));return m+b};d.binary.base64.decode=function(a,c,b){var m=c;m||(m=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");b=b||0;for(var d,h,k,p,l=0,v=b;l<a.length;)d=e[a.charCodeAt(l++)-43],h=e[a.charCodeAt(l++)-43],k=e[a.charCodeAt(l++)-43],p=e[a.charCodeAt(l++)-43],m[v++]=d<<2|h>>4,64!==k&&(m[v++]=(h&15)<<4|k>>2,64!==p&&(m[v++]=(k&3)<<6|p));return c?v-b:m.subarray(0,v)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(a,c,b){a=d.encodeUtf8(a);
|
|
var m=c;m||(m=new Uint8Array(a.length));for(var h=b=b||0,k=0;k<a.length;++k)m[h++]=a.charCodeAt(k);return c?h-b:m};d.text.utf8.decode=function(a){return d.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,c,b){var m=c;m||(m=new Uint8Array(2*a.length));for(var d=new Uint16Array(m.buffer),h=b=b||0,k=b,e=0;e<a.length;++e)d[k++]=a.charCodeAt(e),h+=2;return c?h-b:m};d.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};d.deflate=function(a,
|
|
c,b){c=d.decode64(a.deflate(d.encode64(c)).rval);b&&(a=2,c.charCodeAt(1)&32&&(a=6),c=c.substring(a,c.length-4));return c};d.inflate=function(a,c,b){a=a.inflate(d.encode64(c)).rval;return null===a?null:d.decode64(a)};var v=function(a,c,b){if(!a)throw Error("WebStorage not available.");null===b?a=a.removeItem(c):(b=d.encode64(JSON.stringify(b)),a=a.setItem(c,b));if("undefined"!==typeof a&&!0!==a.rval)throw c=Error(a.error.message),c.id=a.error.id,c.name=a.error.name,c;},E=function(a,c){if(!a)throw Error("WebStorage not available.");
|
|
var b=a.getItem(c);if(a.init)if(null===b.rval){if(b.error){var m=Error(b.error.message);m.id=b.error.id;m.name=b.error.name;throw m;}b=null}else b=b.rval;null!==b&&(b=JSON.parse(d.decode64(b)));return b},k=function(a,c,b,m){var d=E(a,c);null===d&&(d={});d[b]=m;v(a,c,d)},h=function(a,c,b){a=E(a,c);null!==a&&(a=b in a?a[b]:null);return a},C=function(a,c,b){var m=E(a,c);if(null!==m&&b in m){delete m[b];b=!0;for(var d in m){b=!1;break}b&&(m=null);v(a,c,m)}},p=function(a,c){v(a,c,null)},g=function(a,c,
|
|
b){var m=null;"undefined"===typeof b&&(b=["web","flash"]);var d,h=!1,k=null,e;for(e in b){d=b[e];try{if("flash"===d||"both"===d){if(null===c[0])throw Error("Flash local storage not available.");m=a.apply(this,c);h="flash"===d}if("web"===d||"both"===d)c[0]=localStorage,m=a.apply(this,c),h=!0}catch(p){k=p}if(h)break}if(!h)throw k;return m};d.setItem=function(a,c,b,m,d){g(k,arguments,d)};d.getItem=function(a,c,b,m){return g(h,arguments,m)};d.removeItem=function(a,c,b,m){g(C,arguments,m)};d.clearItems=
|
|
function(a,c,b){g(p,arguments,b)};d.parseUrl=function(a){var c=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;c.lastIndex=0;c=c.exec(a);if(a=null===c?null:{full:a,scheme:c[1],host:c[2],port:c[3],path:c[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var y=null;d.getQueryVariables=function(a){var c=function(a){var c=
|
|
{};a=a.split("&");for(var b=0;b<a.length;b++){var m=a[b].indexOf("="),d;0<m?(d=a[b].substring(0,m),m=a[b].substring(m+1)):(d=a[b],m=null);d in c||(c[d]=[]);d in Object.prototype||null===m||c[d].push(unescape(m))}return c};"undefined"===typeof a?(null===y&&(y="undefined"!==typeof window&&window.location&&window.location.search?c(window.location.search.substring(1)):{}),a=y):a=c(a);return a};d.parseFragment=function(a){var c=a,b="",m=a.indexOf("?");0<m&&(c=a.substring(0,m),b=a.substring(m+1));a=c.split("/");
|
|
0<a.length&&""===a[0]&&a.shift();m=""===b?{}:d.getQueryVariables(b);return{pathString:c,queryString:b,path:a,query:m}};d.makeRequest=function(a){var c=d.parseFragment(a),b={path:c.pathString,query:c.queryString,getPath:function(a){return"undefined"===typeof a?c.path:c.path[a]},getQuery:function(a,b){var m;"undefined"===typeof a?m=c.query:(m=c.query[a])&&"undefined"!==typeof b&&(m=m[b]);return m},getQueryLast:function(a,c){var m=b.getQuery(a);return m?m[m.length-1]:c}};return b};d.makeLink=function(a,
|
|
c,b){a=jQuery.isArray(a)?a.join("/"):a;c=jQuery.param(c||{});b=b||"";return a+(0<c.length?"?"+c:"")+(0<b.length?"#"+b:"")};d.setPath=function(a,c,b){if("object"===typeof a&&null!==a)for(var m=0,d=c.length;m<d;){var h=c[m++];if(m==d)a[h]=b;else{var k=h in a;if(!k||k&&"object"!==typeof a[h]||k&&null===a[h])a[h]={};a=a[h]}}};d.getPath=function(a,c,b){for(var m=0,d=c.length,h=!0;h&&m<d&&"object"===typeof a&&null!==a;){var k=c[m++];(h=k in a)&&(a=a[k])}return h?a:b};d.deletePath=function(a,c){if("object"===
|
|
typeof a&&null!==a)for(var b=0,m=c.length;b<m;){var d=c[b++];if(b==m)delete a[d];else{if(!(d in a)||"object"!==typeof a[d]||null===a[d])break;a=a[d]}}};d.isEmpty=function(a){for(var c in a)if(a.hasOwnProperty(c))return!1;return!0};d.format=function(a){var c=/%./g,b,m,d=0,h=[];for(m=0;b=c.exec(a);)switch(m=a.substring(m,c.lastIndex-2),0<m.length&&h.push(m),m=c.lastIndex,b=b[0][1],b){case "s":case "o":d<arguments.length?h.push(arguments[d++ +1]):h.push("<?>");break;case "%":h.push("%");break;default:h.push("<#"+
|
|
b+"?>")}h.push(a.substring(m));return h.join("")};d.formatNumber=function(a,c,b,m){var d=isNaN(c=Math.abs(c))?2:c;c=void 0===b?",":b;m=void 0===m?".":m;b=0>a?"-":"";var h=parseInt(a=Math.abs(+a||0).toFixed(d),10)+"",k=3<h.length?h.length%3:0;return b+(k?h.substr(0,k)+m:"")+h.substr(k).replace(/(\d{3})(?=\d)/g,"$1"+m)+(d?c+Math.abs(a-h).toFixed(d).slice(2):"")};d.formatSize=function(a){return a=1073741824<=a?d.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?d.formatNumber(a/1048576,2,".","")+
|
|
" MiB":1024<=a?d.formatNumber(a/1024,0)+" KiB":d.formatNumber(a,0)+" bytes"};d.bytesFromIP=function(a){return-1!==a.indexOf(".")?d.bytesFromIPv4(a):-1!==a.indexOf(":")?d.bytesFromIPv6(a):null};d.bytesFromIPv4=function(a){a=a.split(".");if(4!==a.length)return null;for(var c=d.createBuffer(),b=0;b<a.length;++b){var m=parseInt(a[b],10);if(isNaN(m))return null;c.putByte(m)}return c.getBytes()};d.bytesFromIPv6=function(a){var c=0;a=a.split(":").filter(function(a){0===a.length&&++c;return!0});for(var b=
|
|
2*(8-a.length+c),m=d.createBuffer(),h=0;8>h;++h)if(a[h]&&0!==a[h].length){var k=d.hexToBytes(a[h]);2>k.length&&m.putByte(0);m.putBytes(k)}else m.fillWithByte(0,b),b=0;return m.getBytes()};d.bytesToIP=function(a){return 4===a.length?d.bytesToIPv4(a):16===a.length?d.bytesToIPv6(a):null};d.bytesToIPv4=function(a){if(4!==a.length)return null;for(var c=[],b=0;b<a.length;++b)c.push(a.charCodeAt(b));return c.join(".")};d.bytesToIPv6=function(a){if(16!==a.length)return null;for(var c=[],b=[],m=0,h=0;h<a.length;h+=
|
|
2){for(var k=d.bytesToHex(a[h]+a[h+1]);"0"===k[0]&&"0"!==k;)k=k.substr(1);if("0"===k){var e=b[b.length-1],p=c.length;e&&p===e.end+1?(e.end=p,e.end-e.start>b[m].end-b[m].start&&(m=b.length-1)):b.push({start:p,end:p})}c.push(k)}0<b.length&&(a=b[m],0<a.end-a.start&&(c.splice(a.start,a.end-a.start+1,""),0===a.start&&c.unshift(""),7===a.end&&c.push("")));return c.join(":")};d.estimateCores=function(a,c){function b(a,e,p){if(0===e){var l=Math.floor(a.reduce(function(a,c){return a+c},0)/a.length);d.cores=
|
|
Math.max(1,l);URL.revokeObjectURL(k);return c(null,d.cores)}m(p,function(c,m){a.push(h(p,m));b(a,e-1,p)})}function m(a,c){for(var b=[],d=[],h=0;h<a;++h){var e=new Worker(k);e.addEventListener("message",function(m){d.push(m.data);if(d.length===a){for(m=0;m<a;++m)b[m].terminate();c(null,d)}});b.push(e)}for(h=0;h<a;++h)b[h].postMessage(h)}function h(a,c){for(var b=[],m=0;m<a;++m)for(var d=c[m],k=b[m]=[],e=0;e<a;++e)if(m!==e){var p=c[e];(d.st>p.st&&d.st<p.et||p.st>d.st&&p.st<d.et)&&k.push(e)}return b.reduce(function(a,
|
|
c){return Math.max(a,c.length)},0)}"function"===typeof a&&(c=a,a={});a=a||{};if("cores"in d&&!a.update)return c(null,d.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&0<navigator.hardwareConcurrency)return d.cores=navigator.hardwareConcurrency,c(null,d.cores);if("undefined"===typeof Worker)return d.cores=1,c(null,d.cores);if("undefined"===typeof Blob)return d.cores=2,c(null,d.cores);var k=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){a=
|
|
Date.now();for(var c=a+4;Date.now()<c;);self.postMessage({st:a,et:c})})}.toString(),")()"],{type:"application/javascript"}));b([],5,16)}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.util)return b.util;b.defined.util=!0;for(var l=0;l<e.length;++l)e[l](b);
|
|
return b.util}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/util",["require","module"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.cipher=c.cipher||{};c.cipher.algorithms=c.cipher.algorithms||{};c.cipher.createCipher=function(a,b){var d=a;"string"===typeof d&&(d=c.cipher.getAlgorithm(d))&&
|
|
(d=d());if(!d)throw Error("Unsupported algorithm: "+a);return new c.cipher.BlockCipher({algorithm:d,key:b,decrypt:!1})};c.cipher.createDecipher=function(a,b){var d=a;"string"===typeof d&&(d=c.cipher.getAlgorithm(d))&&(d=d());if(!d)throw Error("Unsupported algorithm: "+a);return new c.cipher.BlockCipher({algorithm:d,key:b,decrypt:!0})};c.cipher.registerAlgorithm=function(a,b){a=a.toUpperCase();c.cipher.algorithms[a]=b};c.cipher.getAlgorithm=function(a){a=a.toUpperCase();return a in c.cipher.algorithms?
|
|
c.cipher.algorithms[a]:null};var b=c.cipher.BlockCipher=function(a){this.algorithm=a.algorithm;this.mode=this.algorithm.mode;this.blockSize=this.mode.blockSize;this._finish=!1;this.output=this._input=null;this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt;this._decrypt=a.decrypt;this.algorithm.initialize(a)};b.prototype.start=function(a){a=a||{};var b={},d;for(d in a)b[d]=a[d];b.decrypt=this._decrypt;this._finish=!1;this._input=c.util.createBuffer();this.output=a.output||c.util.createBuffer();
|
|
this.mode.start(b)};b.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};b.prototype.finish=function(a){!a||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(c){return a(this.blockSize,c,!1)},this.mode.unpad=function(c){return a(this.blockSize,c,!0)});var c={};c.decrypt=this._decrypt;c.overflow=this._input.length()%this.blockSize;if(!this._decrypt&&this.mode.pad&&
|
|
!this.mode.pad(this._input,c))return!1;this._finish=!0;this.update();return this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,c)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,c)?!1:!0}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.cipher)return b.cipher;
|
|
b.defined.cipher=!0;for(var l=0;l<e.length;++l)e[l](b);return b.cipher}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/cipher",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a){"string"===typeof a&&(a=c.util.createBuffer(a));if(c.util.isArray(a)&&
|
|
4<a.length){var d=a;a=c.util.createBuffer();for(var h=0;h<d.length;++h)a.putByte(d[h])}c.util.isArray(a)||(a=[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()]);return a}function d(a){a[a.length-1]=a[a.length-1]+1&4294967295}function e(a){return[a/4294967296|0,a&4294967295]}c.cipher=c.cipher||{};var v=c.cipher.modes=c.cipher.modes||{};v.ecb=function(a){a=a||{};this.name="ECB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=
|
|
Array(this._ints)};v.ecb.prototype.start=function(a){};v.ecb.prototype.encrypt=function(a,c,b){if(a.length()<this.blockSize&&!(b&&0<a.length()))return!0;for(b=0;b<this._ints;++b)this._inBlock[b]=a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(b=0;b<this._ints;++b)c.putInt32(this._outBlock[b])};v.ecb.prototype.decrypt=function(a,c,b){if(a.length()<this.blockSize&&!(b&&0<a.length()))return!0;for(b=0;b<this._ints;++b)this._inBlock[b]=a.getInt32();this.cipher.decrypt(this._inBlock,
|
|
this._outBlock);for(b=0;b<this._ints;++b)c.putInt32(this._outBlock[b])};v.ecb.prototype.pad=function(a,c){var b=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(b,b);return!0};v.ecb.prototype.unpad=function(a,c){if(0<c.overflow)return!1;var b=a.length(),b=a.at(b-1);if(b>this.blockSize<<2)return!1;a.truncate(b);return!0};v.cbc=function(a){a=a||{};this.name="CBC";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);
|
|
this._outBlock=Array(this._ints)};v.cbc.prototype.start=function(a){if(null===a.iv){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in a)this._iv=b(a.iv),this._prev=this._iv.slice(0);else throw Error("Invalid IV parameter.");};v.cbc.prototype.encrypt=function(a,c,b){if(a.length()<this.blockSize&&!(b&&0<a.length()))return!0;for(b=0;b<this._ints;++b)this._inBlock[b]=this._prev[b]^a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(b=0;b<this._ints;++b)c.putInt32(this._outBlock[b]);
|
|
this._prev=this._outBlock};v.cbc.prototype.decrypt=function(a,c,b){if(a.length()<this.blockSize&&!(b&&0<a.length()))return!0;for(b=0;b<this._ints;++b)this._inBlock[b]=a.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(b=0;b<this._ints;++b)c.putInt32(this._prev[b]^this._outBlock[b]);this._prev=this._inBlock.slice(0)};v.cbc.prototype.pad=function(a,c){var b=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(b,b);return!0};v.cbc.prototype.unpad=function(a,
|
|
c){if(0<c.overflow)return!1;var b=a.length(),b=a.at(b-1);if(b>this.blockSize<<2)return!1;a.truncate(b);return!0};v.cfb=function(a){a=a||{};this.name="CFB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialBlock=Array(this._ints);this._partialOutput=c.util.createBuffer();this._partialBytes=0};v.cfb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=b(a.iv);this._inBlock=
|
|
this._iv.slice(0);this._partialBytes=0};v.cfb.prototype.encrypt=function(a,c,b){var m=a.length();if(0===m)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&m>=this.blockSize)for(var d=0;d<this._ints;++d)this._inBlock[d]=a.getInt32()^this._outBlock[d],c.putInt32(this._inBlock[d]);else{var e=(this.blockSize-m)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(d=0;d<this._ints;++d)this._partialBlock[d]=a.getInt32()^this._outBlock[d],this._partialOutput.putInt32(this._partialBlock[d]);
|
|
if(0<e)a.read-=this.blockSize;else for(d=0;d<this._ints;++d)this._inBlock[d]=this._partialBlock[d];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!b)return c.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;c.putBytes(this._partialOutput.getBytes(m-this._partialBytes));this._partialBytes=0}};v.cfb.prototype.decrypt=function(a,c,b){var m=a.length();if(0===m)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&
|
|
m>=this.blockSize)for(var d=0;d<this._ints;++d)this._inBlock[d]=a.getInt32(),c.putInt32(this._inBlock[d]^this._outBlock[d]);else{var e=(this.blockSize-m)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(d=0;d<this._ints;++d)this._partialBlock[d]=a.getInt32(),this._partialOutput.putInt32(this._partialBlock[d]^this._outBlock[d]);if(0<e)a.read-=this.blockSize;else for(d=0;d<this._ints;++d)this._inBlock[d]=this._partialBlock[d];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);
|
|
if(0<e&&!b)return c.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;c.putBytes(this._partialOutput.getBytes(m-this._partialBytes));this._partialBytes=0}};v.ofb=function(a){a=a||{};this.name="OFB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=c.util.createBuffer();this._partialBytes=0};v.ofb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");
|
|
this._iv=b(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};v.ofb.prototype.encrypt=function(a,c,b){var m=a.length();if(0===a.length())return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&m>=this.blockSize)for(var d=0;d<this._ints;++d)c.putInt32(a.getInt32()^this._outBlock[d]),this._inBlock[d]=this._outBlock[d];else{var e=(this.blockSize-m)%this.blockSize;0<e&&(e=this.blockSize-e);this._partialOutput.clear();for(d=0;d<this._ints;++d)this._partialOutput.putInt32(a.getInt32()^
|
|
this._outBlock[d]);if(0<e)a.read-=this.blockSize;else for(d=0;d<this._ints;++d)this._inBlock[d]=this._outBlock[d];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<e&&!b)return c.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=e,!0;c.putBytes(this._partialOutput.getBytes(m-this._partialBytes));this._partialBytes=0}};v.ofb.prototype.decrypt=v.ofb.prototype.encrypt;v.ctr=function(a){a=a||{};this.name="CTR";this.cipher=a.cipher;this.blockSize=
|
|
a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=c.util.createBuffer();this._partialBytes=0};v.ctr.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=b(a.iv);this._inBlock=this._iv.slice(0);this._partialBytes=0};v.ctr.prototype.encrypt=function(a,c,b){var m=a.length();if(0===m)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&m>=this.blockSize)for(var e=0;e<
|
|
this._ints;++e)c.putInt32(a.getInt32()^this._outBlock[e]);else{var l=(this.blockSize-m)%this.blockSize;0<l&&(l=this.blockSize-l);this._partialOutput.clear();for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);0<l&&(a.read-=this.blockSize);0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<l&&!b)return c.putBytes(this._partialOutput.getBytes(l-this._partialBytes)),this._partialBytes=l,!0;c.putBytes(this._partialOutput.getBytes(m-this._partialBytes));
|
|
this._partialBytes=0}d(this._inBlock)};v.ctr.prototype.decrypt=v.ctr.prototype.encrypt;v.gcm=function(a){a=a||{};this.name="GCM";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=Array(this._ints);this._partialOutput=c.util.createBuffer();this._partialBytes=0;this._R=3774873600};v.gcm.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");var b=c.util.createBuffer(a.iv);this._cipherLength=0;var h;
|
|
h="additionalData"in a?c.util.createBuffer(a.additionalData):c.util.createBuffer();this._tagLength="tagLength"in a?a.tagLength:128;this._tag=null;if(a.decrypt&&(this._tag=c.util.createBuffer(a.tag).getBytes(),this._tag.length!==this._tagLength/8))throw Error("Authentication tag does not match tag length.");this._hashBlock=Array(this._ints);this.tag=null;this._hashSubkey=Array(this._ints);this.cipher.encrypt([0,0,0,0],this._hashSubkey);this.componentBits=4;this._m=this.generateHashTable(this._hashSubkey,
|
|
this.componentBits);a=b.length();if(12===a)this._j0=[b.getInt32(),b.getInt32(),b.getInt32(),1];else{for(this._j0=[0,0,0,0];0<b.length();)this._j0=this.ghash(this._hashSubkey,this._j0,[b.getInt32(),b.getInt32(),b.getInt32(),b.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(e(8*a)))}this._inBlock=this._j0.slice(0);d(this._inBlock);this._partialBytes=0;h=c.util.createBuffer(h);this._aDataLength=e(8*h.length());(b=h.length()%this.blockSize)&&h.fillWithByte(0,this.blockSize-b);
|
|
for(this._s=[0,0,0,0];0<h.length();)this._s=this.ghash(this._hashSubkey,this._s,[h.getInt32(),h.getInt32(),h.getInt32(),h.getInt32()])};v.gcm.prototype.encrypt=function(a,c,b){var m=a.length();if(0===m)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&m>=this.blockSize){for(var e=0;e<this._ints;++e)c.putInt32(this._outBlock[e]^=a.getInt32());this._cipherLength+=this.blockSize}else{var l=(this.blockSize-m)%this.blockSize;0<l&&(l=this.blockSize-l);this._partialOutput.clear();
|
|
for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);if(0===l||b){b?(e=m%this.blockSize,this._cipherLength+=e,this._partialOutput.truncate(this.blockSize-e)):this._cipherLength+=this.blockSize;for(e=0;e<this._ints;++e)this._outBlock[e]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<l&&!b)return a.read-=this.blockSize,c.putBytes(this._partialOutput.getBytes(l-this._partialBytes)),
|
|
this._partialBytes=l,!0;c.putBytes(this._partialOutput.getBytes(m-this._partialBytes));this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock);d(this._inBlock)};v.gcm.prototype.decrypt=function(a,c,b){var m=a.length();if(m<this.blockSize&&!(b&&0<m))return!0;this.cipher.encrypt(this._inBlock,this._outBlock);d(this._inBlock);this._hashBlock[0]=a.getInt32();this._hashBlock[1]=a.getInt32();this._hashBlock[2]=a.getInt32();this._hashBlock[3]=a.getInt32();this._s=this.ghash(this._hashSubkey,
|
|
this._s,this._hashBlock);for(a=0;a<this._ints;++a)c.putInt32(this._outBlock[a]^this._hashBlock[a]);this._cipherLength=m<this.blockSize?this._cipherLength+m%this.blockSize:this._cipherLength+this.blockSize};v.gcm.prototype.afterFinish=function(a,b){var d=!0;b.decrypt&&b.overflow&&a.truncate(this.blockSize-b.overflow);this.tag=c.util.createBuffer();var l=this._aDataLength.concat(e(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,l);l=[];this.cipher.encrypt(this._j0,l);for(var p=0;p<
|
|
this._ints;++p)this.tag.putInt32(this._s[p]^l[p]);this.tag.truncate(this.tag.length()%(this._tagLength/8));b.decrypt&&this.tag.bytes()!==this._tag&&(d=!1);return d};v.gcm.prototype.multiply=function(a,c){for(var b=[0,0,0,0],m=c.slice(0),d=0;128>d;++d)a[d/32|0]&1<<31-d%32&&(b[0]^=m[0],b[1]^=m[1],b[2]^=m[2],b[3]^=m[3]),this.pow(m,m);return b};v.gcm.prototype.pow=function(a,c){for(var b=a[3]&1,m=3;0<m;--m)c[m]=a[m]>>>1|(a[m-1]&1)<<31;c[0]=a[0]>>>1;b&&(c[0]^=this._R)};v.gcm.prototype.tableMultiply=function(a){for(var c=
|
|
[0,0,0,0],b=0;32>b;++b){var m=this._m[b][a[b/8|0]>>>4*(7-b%8)&15];c[0]^=m[0];c[1]^=m[1];c[2]^=m[2];c[3]^=m[3]}return c};v.gcm.prototype.ghash=function(a,c,b){c[0]^=b[0];c[1]^=b[1];c[2]^=b[2];c[3]^=b[3];return this.tableMultiply(c)};v.gcm.prototype.generateHashTable=function(a,c){for(var b=8/c,m=4*b,b=16*b,d=Array(b),e=0;e<b;++e){var l=[0,0,0,0];l[e/m|0]=1<<c-1<<(m-1-e%m)*c;d[e]=this.generateSubHashTable(this.multiply(l,a),c)}return d};v.gcm.prototype.generateSubHashTable=function(a,c){var b=1<<c,
|
|
m=b>>>1,d=Array(b);d[m]=a.slice(0);for(var e=m>>>1;0<e;)this.pow(d[2*e],d[e]=[]),e>>=1;for(e=2;e<m;){for(var l=1;l<e;++l){var v=d[e],g=d[l];d[e+l]=[v[0]^g[0],v[1]^g[1],v[2]^g[2],v[3]^g[3]]}e*=2}d[0]=[0,0,0,0];for(e=m+1;e<b;++e)l=d[e^m],d[e]=[a[0]^l[0],a[1]^l[1],a[2]^l[2],a[3]^l[3]];return d}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=
|
|
n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.cipherModes)return b.cipherModes;b.defined.cipherModes=!0;for(var l=0;l<e.length;++l)e[l](b);return b.cipherModes}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/cipherModes",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,
|
|
0))})})();(function(){function a(c){function b(a,d){c.cipher.registerAlgorithm(a,function(){return new c.aes.Algorithm(a,d)})}function d(){k=!0;F=[0,1,2,4,8,16,32,64,128,27,54];for(var a=Array(256),c=0;128>c;++c)a[c]=c<<1,a[c+128]=c+128<<1^283;C=Array(256);p=Array(256);y=Array(4);z=Array(4);for(c=0;4>c;++c)y[c]=Array(256),z[c]=Array(256);for(var b=0,m=0,h,e,l,v,q,c=0;256>c;++c){v=m^m<<1^m<<2^m<<3^m<<4;v=v>>8^v&255^99;C[b]=v;p[v]=b;q=a[v];h=a[b];e=a[h];l=a[e];q^=q<<24^v<<16^v<<8^v;e=(h^e^l)<<24^(b^
|
|
l)<<16^(b^e^l)<<8^b^h^l;for(var g=0;4>g;++g)y[g][b]=q,z[g][v]=e,q=q<<24|q>>>8,e=e<<24|e>>>8;0===b?b=m=1:(b=h^a[a[a[h^l]]],m^=a[a[m]])}}function e(a,c){for(var b=a.slice(0),m,d=1,k=b.length,e=h*(k+6+1),l=k;l<e;++l)m=b[l-1],0===l%k?(m=C[m>>>16&255]<<24^C[m>>>8&255]<<16^C[m&255]<<8^C[m>>>24]^F[d]<<24,d++):6<k&&4===l%k&&(m=C[m>>>24]<<24^C[m>>>16&255]<<16^C[m>>>8&255]<<8^C[m&255]),b[l]=b[l-k]^m;if(c){for(var d=z[0],k=z[1],p=z[2],v=z[3],g=b.slice(0),e=b.length,l=0,w=e-h;l<e;l+=h,w-=h)if(0===l||l===e-h)g[l]=
|
|
b[w],g[l+1]=b[w+3],g[l+2]=b[w+2],g[l+3]=b[w+1];else for(var y=0;y<h;++y)m=b[w+y],g[l+(3&-y)]=d[C[m>>>24]]^k[C[m>>>16&255]]^p[C[m>>>8&255]]^v[C[m&255]];b=g}return b}function v(a,c,b,m){var d=a.length/4-1,h,k,e,l,v;m?(h=z[0],k=z[1],e=z[2],l=z[3],v=p):(h=y[0],k=y[1],e=y[2],l=y[3],v=C);var g,w,E,F,n,r;g=c[0]^a[0];w=c[m?3:1]^a[1];E=c[2]^a[2];c=c[m?1:3]^a[3];for(var u=3,U=1;U<d;++U)F=h[g>>>24]^k[w>>>16&255]^e[E>>>8&255]^l[c&255]^a[++u],n=h[w>>>24]^k[E>>>16&255]^e[c>>>8&255]^l[g&255]^a[++u],r=h[E>>>24]^
|
|
k[c>>>16&255]^e[g>>>8&255]^l[w&255]^a[++u],c=h[c>>>24]^k[g>>>16&255]^e[w>>>8&255]^l[E&255]^a[++u],g=F,w=n,E=r;b[0]=v[g>>>24]<<24^v[w>>>16&255]<<16^v[E>>>8&255]<<8^v[c&255]^a[++u];b[m?3:1]=v[w>>>24]<<24^v[E>>>16&255]<<16^v[c>>>8&255]<<8^v[g&255]^a[++u];b[2]=v[E>>>24]<<24^v[c>>>16&255]<<16^v[g>>>8&255]<<8^v[w&255]^a[++u];b[m?1:3]=v[c>>>24]<<24^v[g>>>16&255]<<16^v[w>>>8&255]<<8^v[E&255]^a[++u]}function g(a){a=a||{};var b="AES-"+(a.mode||"CBC").toUpperCase(),d;d=a.decrypt?c.cipher.createDecipher(b,a.key):
|
|
c.cipher.createCipher(b,a.key);var h=d.start;d.start=function(a,b){var k=null;b instanceof c.util.ByteBuffer&&(k=b,b={});b=b||{};b.output=k;b.iv=a;h.call(d,b)};return d}c.aes=c.aes||{};c.aes.startEncrypting=function(a,c,b,m){a=g({key:a,output:b,decrypt:!1,mode:m});a.start(c);return a};c.aes.createEncryptionCipher=function(a,c){return g({key:a,output:null,decrypt:!1,mode:c})};c.aes.startDecrypting=function(a,c,b,m){a=g({key:a,output:b,decrypt:!0,mode:m});a.start(c);return a};c.aes.createDecryptionCipher=
|
|
function(a,c){return g({key:a,output:null,decrypt:!0,mode:c})};c.aes.Algorithm=function(a,c){k||d();var b=this;b.name=a;b.mode=new c({blockSize:16,cipher:{encrypt:function(a,c){return v(b._w,a,c,!1)},decrypt:function(a,c){return v(b._w,a,c,!0)}}});b._init=!1};c.aes.Algorithm.prototype.initialize=function(a){if(!this._init){var b=a.key,d;if("string"===typeof b&&(16===b.length||24===b.length||32===b.length))b=c.util.createBuffer(b);else if(c.util.isArray(b)&&(16===b.length||24===b.length||32===b.length)){d=
|
|
b;for(var b=c.util.createBuffer(),h=0;h<d.length;++h)b.putByte(d[h])}if(!c.util.isArray(b)){d=b;var b=[],k=d.length();if(16===k||24===k||32===k)for(k>>>=2,h=0;h<k;++h)b.push(d.getInt32())}if(!c.util.isArray(b)||4!==b.length&&6!==b.length&&8!==b.length)throw Error("Invalid key parameter.");d=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=e(b,a.decrypt&&!d);this._init=!0}};c.aes._expandKey=function(a,c){k||d();return e(a,c)};c.aes._updateBlock=v;b("AES-ECB",c.cipher.modes.ecb);b("AES-CBC",
|
|
c.cipher.modes.cbc);b("AES-CFB",c.cipher.modes.cfb);b("AES-OFB",c.cipher.modes.ofb);b("AES-CTR",c.cipher.modes.ctr);b("AES-GCM",c.cipher.modes.gcm);var k=!1,h=4,C,p,F,y,z}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.aes)return b.aes;b.defined.aes=
|
|
!0;for(var l=0;l<e.length;++l)e[l](b);return b.aes}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/aes",["require","module","./cipher","./cipherModes","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.pki=c.pki||{};c=c.pki.oids=c.oids=c.oids||{};c["1.2.840.113549.1.1.1"]="rsaEncryption";
|
|
c.rsaEncryption="1.2.840.113549.1.1.1";c["1.2.840.113549.1.1.4"]="md5WithRSAEncryption";c.md5WithRSAEncryption="1.2.840.113549.1.1.4";c["1.2.840.113549.1.1.5"]="sha1WithRSAEncryption";c.sha1WithRSAEncryption="1.2.840.113549.1.1.5";c["1.2.840.113549.1.1.7"]="RSAES-OAEP";c["RSAES-OAEP"]="1.2.840.113549.1.1.7";c["1.2.840.113549.1.1.8"]="mgf1";c.mgf1="1.2.840.113549.1.1.8";c["1.2.840.113549.1.1.9"]="pSpecified";c.pSpecified="1.2.840.113549.1.1.9";c["1.2.840.113549.1.1.10"]="RSASSA-PSS";c["RSASSA-PSS"]=
|
|
"1.2.840.113549.1.1.10";c["1.2.840.113549.1.1.11"]="sha256WithRSAEncryption";c.sha256WithRSAEncryption="1.2.840.113549.1.1.11";c["1.2.840.113549.1.1.12"]="sha384WithRSAEncryption";c.sha384WithRSAEncryption="1.2.840.113549.1.1.12";c["1.2.840.113549.1.1.13"]="sha512WithRSAEncryption";c.sha512WithRSAEncryption="1.2.840.113549.1.1.13";c["1.3.14.3.2.7"]="desCBC";c.desCBC="1.3.14.3.2.7";c["1.3.14.3.2.26"]="sha1";c.sha1="1.3.14.3.2.26";c["2.16.840.1.101.3.4.2.1"]="sha256";c.sha256="2.16.840.1.101.3.4.2.1";
|
|
c["2.16.840.1.101.3.4.2.2"]="sha384";c.sha384="2.16.840.1.101.3.4.2.2";c["2.16.840.1.101.3.4.2.3"]="sha512";c.sha512="2.16.840.1.101.3.4.2.3";c["1.2.840.113549.2.5"]="md5";c.md5="1.2.840.113549.2.5";c["1.2.840.113549.1.7.1"]="data";c.data="1.2.840.113549.1.7.1";c["1.2.840.113549.1.7.2"]="signedData";c.signedData="1.2.840.113549.1.7.2";c["1.2.840.113549.1.7.3"]="envelopedData";c.envelopedData="1.2.840.113549.1.7.3";c["1.2.840.113549.1.7.4"]="signedAndEnvelopedData";c.signedAndEnvelopedData="1.2.840.113549.1.7.4";
|
|
c["1.2.840.113549.1.7.5"]="digestedData";c.digestedData="1.2.840.113549.1.7.5";c["1.2.840.113549.1.7.6"]="encryptedData";c.encryptedData="1.2.840.113549.1.7.6";c["1.2.840.113549.1.9.1"]="emailAddress";c.emailAddress="1.2.840.113549.1.9.1";c["1.2.840.113549.1.9.2"]="unstructuredName";c.unstructuredName="1.2.840.113549.1.9.2";c["1.2.840.113549.1.9.3"]="contentType";c.contentType="1.2.840.113549.1.9.3";c["1.2.840.113549.1.9.4"]="messageDigest";c.messageDigest="1.2.840.113549.1.9.4";c["1.2.840.113549.1.9.5"]=
|
|
"signingTime";c.signingTime="1.2.840.113549.1.9.5";c["1.2.840.113549.1.9.6"]="counterSignature";c.counterSignature="1.2.840.113549.1.9.6";c["1.2.840.113549.1.9.7"]="challengePassword";c.challengePassword="1.2.840.113549.1.9.7";c["1.2.840.113549.1.9.8"]="unstructuredAddress";c.unstructuredAddress="1.2.840.113549.1.9.8";c["1.2.840.113549.1.9.14"]="extensionRequest";c.extensionRequest="1.2.840.113549.1.9.14";c["1.2.840.113549.1.9.20"]="friendlyName";c.friendlyName="1.2.840.113549.1.9.20";c["1.2.840.113549.1.9.21"]=
|
|
"localKeyId";c.localKeyId="1.2.840.113549.1.9.21";c["1.2.840.113549.1.9.22.1"]="x509Certificate";c.x509Certificate="1.2.840.113549.1.9.22.1";c["1.2.840.113549.1.12.10.1.1"]="keyBag";c.keyBag="1.2.840.113549.1.12.10.1.1";c["1.2.840.113549.1.12.10.1.2"]="pkcs8ShroudedKeyBag";c.pkcs8ShroudedKeyBag="1.2.840.113549.1.12.10.1.2";c["1.2.840.113549.1.12.10.1.3"]="certBag";c.certBag="1.2.840.113549.1.12.10.1.3";c["1.2.840.113549.1.12.10.1.4"]="crlBag";c.crlBag="1.2.840.113549.1.12.10.1.4";c["1.2.840.113549.1.12.10.1.5"]=
|
|
"secretBag";c.secretBag="1.2.840.113549.1.12.10.1.5";c["1.2.840.113549.1.12.10.1.6"]="safeContentsBag";c.safeContentsBag="1.2.840.113549.1.12.10.1.6";c["1.2.840.113549.1.5.13"]="pkcs5PBES2";c.pkcs5PBES2="1.2.840.113549.1.5.13";c["1.2.840.113549.1.5.12"]="pkcs5PBKDF2";c.pkcs5PBKDF2="1.2.840.113549.1.5.12";c["1.2.840.113549.1.12.1.1"]="pbeWithSHAAnd128BitRC4";c.pbeWithSHAAnd128BitRC4="1.2.840.113549.1.12.1.1";c["1.2.840.113549.1.12.1.2"]="pbeWithSHAAnd40BitRC4";c.pbeWithSHAAnd40BitRC4="1.2.840.113549.1.12.1.2";
|
|
c["1.2.840.113549.1.12.1.3"]="pbeWithSHAAnd3-KeyTripleDES-CBC";c["pbeWithSHAAnd3-KeyTripleDES-CBC"]="1.2.840.113549.1.12.1.3";c["1.2.840.113549.1.12.1.4"]="pbeWithSHAAnd2-KeyTripleDES-CBC";c["pbeWithSHAAnd2-KeyTripleDES-CBC"]="1.2.840.113549.1.12.1.4";c["1.2.840.113549.1.12.1.5"]="pbeWithSHAAnd128BitRC2-CBC";c["pbeWithSHAAnd128BitRC2-CBC"]="1.2.840.113549.1.12.1.5";c["1.2.840.113549.1.12.1.6"]="pbewithSHAAnd40BitRC2-CBC";c["pbewithSHAAnd40BitRC2-CBC"]="1.2.840.113549.1.12.1.6";c["1.2.840.113549.3.7"]=
|
|
"des-EDE3-CBC";c["des-EDE3-CBC"]="1.2.840.113549.3.7";c["2.16.840.1.101.3.4.1.2"]="aes128-CBC";c["aes128-CBC"]="2.16.840.1.101.3.4.1.2";c["2.16.840.1.101.3.4.1.22"]="aes192-CBC";c["aes192-CBC"]="2.16.840.1.101.3.4.1.22";c["2.16.840.1.101.3.4.1.42"]="aes256-CBC";c["aes256-CBC"]="2.16.840.1.101.3.4.1.42";c["2.5.4.3"]="commonName";c.commonName="2.5.4.3";c["2.5.4.5"]="serialName";c.serialName="2.5.4.5";c["2.5.4.6"]="countryName";c.countryName="2.5.4.6";c["2.5.4.7"]="localityName";c.localityName="2.5.4.7";
|
|
c["2.5.4.8"]="stateOrProvinceName";c.stateOrProvinceName="2.5.4.8";c["2.5.4.10"]="organizationName";c.organizationName="2.5.4.10";c["2.5.4.11"]="organizationalUnitName";c.organizationalUnitName="2.5.4.11";c["2.16.840.1.113730.1.1"]="nsCertType";c.nsCertType="2.16.840.1.113730.1.1";c["2.5.29.1"]="authorityKeyIdentifier";c["2.5.29.2"]="keyAttributes";c["2.5.29.3"]="certificatePolicies";c["2.5.29.4"]="keyUsageRestriction";c["2.5.29.5"]="policyMapping";c["2.5.29.6"]="subtreesConstraint";c["2.5.29.7"]=
|
|
"subjectAltName";c["2.5.29.8"]="issuerAltName";c["2.5.29.9"]="subjectDirectoryAttributes";c["2.5.29.10"]="basicConstraints";c["2.5.29.11"]="nameConstraints";c["2.5.29.12"]="policyConstraints";c["2.5.29.13"]="basicConstraints";c["2.5.29.14"]="subjectKeyIdentifier";c.subjectKeyIdentifier="2.5.29.14";c["2.5.29.15"]="keyUsage";c.keyUsage="2.5.29.15";c["2.5.29.16"]="privateKeyUsagePeriod";c["2.5.29.17"]="subjectAltName";c.subjectAltName="2.5.29.17";c["2.5.29.18"]="issuerAltName";c.issuerAltName="2.5.29.18";
|
|
c["2.5.29.19"]="basicConstraints";c.basicConstraints="2.5.29.19";c["2.5.29.20"]="cRLNumber";c["2.5.29.21"]="cRLReason";c["2.5.29.22"]="expirationDate";c["2.5.29.23"]="instructionCode";c["2.5.29.24"]="invalidityDate";c["2.5.29.25"]="cRLDistributionPoints";c["2.5.29.26"]="issuingDistributionPoint";c["2.5.29.27"]="deltaCRLIndicator";c["2.5.29.28"]="issuingDistributionPoint";c["2.5.29.29"]="certificateIssuer";c["2.5.29.30"]="nameConstraints";c["2.5.29.31"]="cRLDistributionPoints";c["2.5.29.32"]="certificatePolicies";
|
|
c["2.5.29.33"]="policyMappings";c["2.5.29.34"]="policyConstraints";c["2.5.29.35"]="authorityKeyIdentifier";c["2.5.29.36"]="policyConstraints";c["2.5.29.37"]="extKeyUsage";c.extKeyUsage="2.5.29.37";c["2.5.29.46"]="freshestCRL";c["2.5.29.54"]="inhibitAnyPolicy";c["1.3.6.1.5.5.7.3.1"]="serverAuth";c.serverAuth="1.3.6.1.5.5.7.3.1";c["1.3.6.1.5.5.7.3.2"]="clientAuth";c.clientAuth="1.3.6.1.5.5.7.3.2";c["1.3.6.1.5.5.7.3.3"]="codeSigning";c.codeSigning="1.3.6.1.5.5.7.3.3";c["1.3.6.1.5.5.7.3.4"]="emailProtection";
|
|
c.emailProtection="1.3.6.1.5.5.7.3.4";c["1.3.6.1.5.5.7.3.8"]="timeStamping";c.timeStamping="1.3.6.1.5.5.7.3.8"}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.oids)return b.oids;b.defined.oids=!0;for(var l=0;l<e.length;++l)e[l](b);return b.oids}},
|
|
u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/oids",["require","module"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var b=c.asn1=c.asn1||{};b.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};b.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,
|
|
ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};b.create=function(a,b,d,h){if(c.util.isArray(h)){for(var e=[],l=0;l<h.length;++l)void 0!==h[l]&&e.push(h[l]);h=e}return{tagClass:a,type:b,constructed:d,composed:d||c.util.isArray(h),value:h}};var d=b.getBerValueLength=function(a){var c=a.getByte();if(128!==c)return c&128?a.getInt((c&127)<<3):c};b.fromDer=function(a,e){void 0===e&&(e=!0);
|
|
"string"===typeof a&&(a=c.util.createBuffer(a));if(2>a.length()){var k=Error("Too few bytes to parse DER.");k.bytes=a.length();throw k;}var h=a.getByte(),k=h&192,g=h&31,p=d(a);if(a.length()<p){if(e)throw k=Error("Too few bytes to read ASN.1 value."),k.detail=a.length()+" < "+p,k;p=a.length()}var F,y=32===(h&32);F=y;if(!F&&k===b.Class.UNIVERSAL&&g===b.Type.BITSTRING&&1<p){var z=a.read;if(0===a.getByte()&&(h=a.getByte(),h&=192,h===b.Class.UNIVERSAL||h===b.Class.CONTEXT_SPECIFIC))try{if(F=d(a)===p-(a.read-
|
|
z))++z,--p}catch(A){}a.read=z}if(F)if(F=[],void 0===p)for(;;){if(a.bytes(2)===String.fromCharCode(0,0)){a.getBytes(2);break}F.push(b.fromDer(a,e))}else for(z=a.length();0<p;)F.push(b.fromDer(a,e)),p-=z-a.length(),z=a.length();else{if(void 0===p){if(e)throw Error("Non-constructed ASN.1 object of indefinite length.");p=a.length()}if(g===b.Type.BMPSTRING)for(F="",z=0;z<p;z+=2)F+=String.fromCharCode(a.getInt16());else F=a.getBytes(p)}return b.create(k,g,y,F)};b.toDer=function(a){var d=c.util.createBuffer(),
|
|
k=a.tagClass|a.type,h=c.util.createBuffer();if(a.composed){a.constructed?k|=32:h.putByte(0);for(var e=0;e<a.value.length;++e)void 0!==a.value[e]&&h.putBuffer(b.toDer(a.value[e]))}else if(a.type===b.Type.BMPSTRING)for(e=0;e<a.value.length;++e)h.putInt16(a.value.charCodeAt(e));else h.putBytes(a.value);d.putByte(k);if(127>=h.length())d.putByte(h.length()&127);else{e=h.length();a="";do a+=String.fromCharCode(e&255),e>>>=8;while(0<e);d.putByte(a.length|128);for(e=a.length-1;0<=e;--e)d.putByte(a.charCodeAt(e))}d.putBuffer(h);
|
|
return d};b.oidToDer=function(a){a=a.split(".");var b=c.util.createBuffer();b.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var d,h,e,l,g=2;g<a.length;++g){d=!0;h=[];e=parseInt(a[g],10);do l=e&127,e>>>=7,d||(l|=128),h.push(l),d=!1;while(0<e);for(d=h.length-1;0<=d;--d)b.putByte(h[d])}return b};b.derToOid=function(a){var b;"string"===typeof a&&(a=c.util.createBuffer(a));var d=a.getByte();b=Math.floor(d/40)+"."+d%40;for(var h=0;0<a.length();)d=a.getByte(),h<<=7,d&128?h+=d&127:(b+="."+(h+d),h=0);
|
|
return b};b.utcTimeToDate=function(a){var c=new Date,b=parseInt(a.substr(0,2),10),b=50<=b?1900+b:2E3+b,d=parseInt(a.substr(2,2),10)-1,m=parseInt(a.substr(4,2),10),e=parseInt(a.substr(6,2),10),l=parseInt(a.substr(8,2),10),g=0;if(11<a.length){var w=a.charAt(10),A=10;"+"!==w&&"-"!==w&&(g=parseInt(a.substr(10,2),10),A+=2)}c.setUTCFullYear(b,d,m);c.setUTCHours(e,l,g,0);A&&(w=a.charAt(A),"+"===w||"-"===w)&&(b=parseInt(a.substr(A+1,2),10),a=parseInt(a.substr(A+4,2),10),a=6E4*(60*b+a),"+"===w?c.setTime(+c-
|
|
a):c.setTime(+c+a));return c};b.generalizedTimeToDate=function(a){var c=new Date,b=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,m=parseInt(a.substr(6,2),10),e=parseInt(a.substr(8,2),10),l=parseInt(a.substr(10,2),10),g=parseInt(a.substr(12,2),10),w=0,A=0,D=!1;"Z"===a.charAt(a.length-1)&&(D=!0);var N=a.length-5,x=a.charAt(N);if("+"===x||"-"===x)A=parseInt(a.substr(N+1,2),10),N=parseInt(a.substr(N+4,2),10),A=6E4*(60*A+N),"+"===x&&(A*=-1),D=!0;"."===a.charAt(14)&&(w=1E3*parseFloat(a.substr(14),
|
|
10));D?(c.setUTCFullYear(b,d,m),c.setUTCHours(e,l,g,w),c.setTime(+c+A)):(c.setFullYear(b,d,m),c.setHours(e,l,g,w));return c};b.dateToUtcTime=function(a){if("string"===typeof a)return a;var c="",b=[];b.push((""+a.getUTCFullYear()).substr(2));b.push(""+(a.getUTCMonth()+1));b.push(""+a.getUTCDate());b.push(""+a.getUTCHours());b.push(""+a.getUTCMinutes());b.push(""+a.getUTCSeconds());for(a=0;a<b.length;++a)2>b[a].length&&(c+="0"),c+=b[a];return c+"Z"};b.dateToGeneralizedTime=function(a){if("string"===
|
|
typeof a)return a;var c="",b=[];b.push(""+a.getUTCFullYear());b.push(""+(a.getUTCMonth()+1));b.push(""+a.getUTCDate());b.push(""+a.getUTCHours());b.push(""+a.getUTCMinutes());b.push(""+a.getUTCSeconds());for(a=0;a<b.length;++a)2>b[a].length&&(c+="0"),c+=b[a];return c+"Z"};b.integerToDer=function(a){var b=c.util.createBuffer();if(-128<=a&&128>a)return b.putSignedInt(a,8);if(-32768<=a&&32768>a)return b.putSignedInt(a,16);if(-8388608<=a&&8388608>a)return b.putSignedInt(a,24);if(-2147483648<=a&&2147483648>
|
|
a)return b.putSignedInt(a,32);b=Error("Integer too large; max is 32-bits.");b.integer=a;throw b;};b.derToInteger=function(a){"string"===typeof a&&(a=c.util.createBuffer(a));var b=8*a.length();if(32<b)throw Error("Integer too large; max is 32-bits.");return a.getSignedInt(b)};b.validate=function(a,d,e,h){var g=!1;if(a.tagClass!==d.tagClass&&"undefined"!==typeof d.tagClass||a.type!==d.type&&"undefined"!==typeof d.type)h&&(a.tagClass!==d.tagClass&&h.push("["+d.name+'] Expected tag class "'+d.tagClass+
|
|
'", got "'+a.tagClass+'"'),a.type!==d.type&&h.push("["+d.name+'] Expected type "'+d.type+'", got "'+a.type+'"'));else if(a.constructed===d.constructed||"undefined"===typeof d.constructed){g=!0;if(d.value&&c.util.isArray(d.value))for(var p=0,w=0;g&&w<d.value.length;++w)g=d.value[w].optional||!1,a.value[p]&&((g=b.validate(a.value[p],d.value[w],e,h))?++p:d.value[w].optional&&(g=!0)),!g&&h&&h.push("["+d.name+'] Tag class "'+d.tagClass+'", type "'+d.type+'" expected value length "'+d.value.length+'", got "'+
|
|
a.value.length+'"');g&&e&&(d.capture&&(e[d.capture]=a.value),d.captureAsn1&&(e[d.captureAsn1]=a))}else h&&h.push("["+d.name+'] Expected constructed "'+d.constructed+'", got "'+a.constructed+'"');return g};var e=/[^\\u0000-\\u00ff]/;b.prettyPrint=function(a,d,k){var h="";d=d||0;k=k||2;0<d&&(h+="\n");for(var g="",p=0;p<d*k;++p)g+=" ";h+=g+"Tag: ";switch(a.tagClass){case b.Class.UNIVERSAL:h+="Universal:";break;case b.Class.APPLICATION:h+="Application:";break;case b.Class.CONTEXT_SPECIFIC:h+="Context-Specific:";
|
|
break;case b.Class.PRIVATE:h+="Private:"}if(a.tagClass===b.Class.UNIVERSAL)switch(h+=a.type,a.type){case b.Type.NONE:h+=" (None)";break;case b.Type.BOOLEAN:h+=" (Boolean)";break;case b.Type.BITSTRING:h+=" (Bit string)";break;case b.Type.INTEGER:h+=" (Integer)";break;case b.Type.OCTETSTRING:h+=" (Octet string)";break;case b.Type.NULL:h+=" (Null)";break;case b.Type.OID:h+=" (Object Identifier)";break;case b.Type.ODESC:h+=" (Object Descriptor)";break;case b.Type.EXTERNAL:h+=" (External or Instance of)";
|
|
break;case b.Type.REAL:h+=" (Real)";break;case b.Type.ENUMERATED:h+=" (Enumerated)";break;case b.Type.EMBEDDED:h+=" (Embedded PDV)";break;case b.Type.UTF8:h+=" (UTF8)";break;case b.Type.ROID:h+=" (Relative Object Identifier)";break;case b.Type.SEQUENCE:h+=" (Sequence)";break;case b.Type.SET:h+=" (Set)";break;case b.Type.PRINTABLESTRING:h+=" (Printable String)";break;case b.Type.IA5String:h+=" (IA5String (ASCII))";break;case b.Type.UTCTIME:h+=" (UTC time)";break;case b.Type.GENERALIZEDTIME:h+=" (Generalized time)";
|
|
break;case b.Type.BMPSTRING:h+=" (BMP String)"}else h+=a.type;h=h+"\n"+(g+"Constructed: "+a.constructed+"\n");if(a.composed){for(var w=0,y="",p=0;p<a.value.length;++p)void 0!==a.value[p]&&(w+=1,y+=b.prettyPrint(a.value[p],d+1,k),p+1<a.value.length&&(y+=","));h+=g+"Sub values: "+w+y}else if(h+=g+"Value: ",a.type===b.Type.OID&&(d=b.derToOid(a.value),h+=d,c.pki&&c.pki.oids&&d in c.pki.oids&&(h+=" ("+c.pki.oids[d]+") ")),a.type===b.Type.INTEGER)try{h+=b.derToInteger(a.value)}catch(z){h+="0x"+c.util.bytesToHex(a.value)}else a.type===
|
|
b.Type.OCTETSTRING?(e.test(a.value)||(h+="("+a.value+") "),h+="0x"+c.util.bytesToHex(a.value)):h=a.type===b.Type.UTF8?h+c.util.decodeUtf8(a.value):a.type===b.Type.PRINTABLESTRING||a.type===b.Type.IA5String?h+a.value:e.test(a.value)?h+("0x"+c.util.bytesToHex(a.value)):0===a.value.length?h+"[null]":h+a.value;return h}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,
|
|
b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.asn1)return b.asn1;b.defined.asn1=!0;for(var l=0;l<e.length;++l)e[l](b);return b.asn1}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/asn1",["require","module","./util","./oids"],function(){r.apply(null,Array.prototype.slice.call(arguments,
|
|
0))})})();(function(){function a(c){function b(){g=String.fromCharCode(128);g+=c.util.fillString(String.fromCharCode(0),64);E=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9];k=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];h=Array(64);for(var a=0;64>a;++a)h[a]=Math.floor(4294967296*
|
|
Math.abs(Math.sin(a+1)));C=!0}function d(a,c,b){for(var m,e,l,g,x,G,B,w=b.length();64<=w;){e=a.h0;l=a.h1;g=a.h2;x=a.h3;for(B=0;16>B;++B)c[B]=b.getInt32Le(),m=x^l&(g^x),m=e+m+h[B]+c[B],G=k[B],e=x,x=g,g=l,l+=m<<G|m>>>32-G;for(;32>B;++B)m=g^x&(l^g),m=e+m+h[B]+c[E[B]],G=k[B],e=x,x=g,g=l,l+=m<<G|m>>>32-G;for(;48>B;++B)m=l^g^x,m=e+m+h[B]+c[E[B]],G=k[B],e=x,x=g,g=l,l+=m<<G|m>>>32-G;for(;64>B;++B)m=g^(l|~x),m=e+m+h[B]+c[E[B]],G=k[B],e=x,x=g,g=l,l+=m<<G|m>>>32-G;a.h0=a.h0+e|0;a.h1=a.h1+l|0;a.h2=a.h2+g|0;a.h3=
|
|
a.h3+x|0;w-=64}}var e=c.md5=c.md5||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.md5=c.md.algorithms.md5=e;e.create=function(){C||b();var a=null,h=c.util.createBuffer(),e=Array(16),k={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){k.messageLength=0;k.fullMessageLength=k.messageLength64=[];for(var b=k.messageLengthSize/4,d=0;d<b;++d)k.fullMessageLength.push(0);h=c.util.createBuffer();a={h0:1732584193,h1:4023233417,
|
|
h2:2562383102,h3:271733878};return k}};k.start();k.update=function(b,l){"utf8"===l&&(b=c.util.encodeUtf8(b));var g=b.length;k.messageLength+=g;for(var g=[g/4294967296>>>0,g>>>0],x=k.fullMessageLength.length-1;0<=x;--x)k.fullMessageLength[x]+=g[1],g[1]=g[0]+(k.fullMessageLength[x]/4294967296>>>0),k.fullMessageLength[x]>>>=0,g[0]=g[1]/4294967296>>>0;h.putBytes(b);d(a,e,h);(2048<h.read||0===h.length())&&h.compact();return k};k.digest=function(){var b=c.util.createBuffer();b.putBytes(h.bytes());b.putBytes(g.substr(0,
|
|
k.blockLength-(k.fullMessageLength[k.fullMessageLength.length-1]+k.messageLengthSize&k.blockLength-1)));for(var l,C=0,x=k.fullMessageLength.length-1;0<=x;--x)l=8*k.fullMessageLength[x]+C,C=l/4294967296>>>0,b.putInt32Le(l>>>0);l={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3};d(l,e,b);b=c.util.createBuffer();b.putInt32Le(l.h0);b.putInt32Le(l.h1);b.putInt32Le(l.h2);b.putInt32Le(l.h3);return b};return k};var g=null,E=null,k=null,h=null,C=!1}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=
|
|
!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.md5)return b.md5;b.defined.md5=!0;for(var l=0;l<e.length;++l)e[l](b);return b.md5}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,
|
|
0))};c("js/md5",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var m,e,l,g,w,v,D,n,x=d.length();64<=x;){e=a.h0;l=a.h1;g=a.h2;w=a.h3;v=a.h4;for(n=0;16>n;++n)m=d.getInt32(),c[n]=m,D=w^l&(g^w),m=(e<<5|e>>>27)+D+v+1518500249+m,v=w,w=g,g=l<<30|l>>>2,l=e,e=m;for(;20>n;++n)m=c[n-3]^c[n-8]^c[n-14]^c[n-16],m=m<<1|m>>>31,c[n]=m,D=w^l&(g^w),m=(e<<5|e>>>27)+D+v+1518500249+m,v=w,w=g,g=l<<30|l>>>2,l=e,e=m;for(;32>
|
|
n;++n)m=c[n-3]^c[n-8]^c[n-14]^c[n-16],m=m<<1|m>>>31,c[n]=m,D=l^g^w,m=(e<<5|e>>>27)+D+v+1859775393+m,v=w,w=g,g=l<<30|l>>>2,l=e,e=m;for(;40>n;++n)m=c[n-6]^c[n-16]^c[n-28]^c[n-32],m=m<<2|m>>>30,c[n]=m,D=l^g^w,m=(e<<5|e>>>27)+D+v+1859775393+m,v=w,w=g,g=l<<30|l>>>2,l=e,e=m;for(;60>n;++n)m=c[n-6]^c[n-16]^c[n-28]^c[n-32],m=m<<2|m>>>30,c[n]=m,D=l&g|w&(l^g),m=(e<<5|e>>>27)+D+v+2400959708+m,v=w,w=g,g=l<<30|l>>>2,l=e,e=m;for(;80>n;++n)m=c[n-6]^c[n-16]^c[n-28]^c[n-32],m=m<<2|m>>>30,c[n]=m,D=l^g^w,m=(e<<5|e>>>
|
|
27)+D+v+3395469782+m,v=w,w=g,g=l<<30|l>>>2,l=e,e=m;a.h0=a.h0+e|0;a.h1=a.h1+l|0;a.h2=a.h2+g|0;a.h3=a.h3+w|0;a.h4=a.h4+v|0;x-=64}}var d=c.sha1=c.sha1||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.sha1=c.md.algorithms.sha1=d;d.create=function(){g||(e=String.fromCharCode(128),e+=c.util.fillString(String.fromCharCode(0),64),g=!0);var a=null,d=c.util.createBuffer(),h=Array(80),w={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){w.messageLength=
|
|
0;w.fullMessageLength=w.messageLength64=[];for(var b=w.messageLengthSize/4,h=0;h<b;++h)w.fullMessageLength.push(0);d=c.util.createBuffer();a={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return w}};w.start();w.update=function(e,g){"utf8"===g&&(e=c.util.encodeUtf8(e));var v=e.length;w.messageLength+=v;for(var v=[v/4294967296>>>0,v>>>0],z=w.fullMessageLength.length-1;0<=z;--z)w.fullMessageLength[z]+=v[1],v[1]=v[0]+(w.fullMessageLength[z]/4294967296>>>0),w.fullMessageLength[z]>>>=
|
|
0,v[0]=v[1]/4294967296>>>0;d.putBytes(e);b(a,h,d);(2048<d.read||0===d.length())&&d.compact();return w};w.digest=function(){var p=c.util.createBuffer();p.putBytes(d.bytes());p.putBytes(e.substr(0,w.blockLength-(w.fullMessageLength[w.fullMessageLength.length-1]+w.messageLengthSize&w.blockLength-1)));c.util.createBuffer();for(var g,v,z=8*w.fullMessageLength[0],A=0;A<w.fullMessageLength.length;++A)g=8*w.fullMessageLength[A+1],v=g/4294967296>>>0,z+=v,p.putInt32(z>>>0),z=g;g={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,
|
|
h4:a.h4};b(g,h,p);p=c.util.createBuffer();p.putInt32(g.h0);p.putInt32(g.h1);p.putInt32(g.h2);p.putInt32(g.h3);p.putInt32(g.h4);return p};return w};var e=null,g=!1}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.sha1)return b.sha1;b.defined.sha1=
|
|
!0;for(var l=0;l<e.length;++l)e[l](b);return b.sha1}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/sha1",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var m,e,l,g,w,v,N,x,G,B,H,r,q,u=d.length();64<=u;){for(w=0;16>w;++w)c[w]=d.getInt32();
|
|
for(;64>w;++w)m=c[w-2],m=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,e=c[w-15],e=(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3,c[w]=m+c[w-7]+e+c[w-16]|0;v=a.h0;N=a.h1;x=a.h2;G=a.h3;B=a.h4;H=a.h5;r=a.h6;q=a.h7;for(w=0;64>w;++w)m=(B>>>6|B<<26)^(B>>>11|B<<21)^(B>>>25|B<<7),l=r^B&(H^r),e=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),g=v&N|x&(v^N),m=q+m+l+n[w]+c[w],e+=g,q=r,r=H,H=B,B=G+m|0,G=x,x=N,N=v,v=m+e|0;a.h0=a.h0+v|0;a.h1=a.h1+N|0;a.h2=a.h2+x|0;a.h3=a.h3+G|0;a.h4=a.h4+B|0;a.h5=a.h5+H|0;a.h6=a.h6+r|0;a.h7=a.h7+q|0;u-=
|
|
64}}var d=c.sha256=c.sha256||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.sha256=c.md.algorithms.sha256=d;d.create=function(){g||(e=String.fromCharCode(128),e+=c.util.fillString(String.fromCharCode(0),64),n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,
|
|
2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],g=!0);var a=null,d=c.util.createBuffer(),w=Array(64),p={algorithm:"sha256",blockLength:64,digestLength:32,
|
|
messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){p.messageLength=0;p.fullMessageLength=p.messageLength64=[];for(var b=p.messageLengthSize/4,e=0;e<b;++e)p.fullMessageLength.push(0);d=c.util.createBuffer();a={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};return p}};p.start();p.update=function(e,g){"utf8"===g&&(e=c.util.encodeUtf8(e));var v=e.length;p.messageLength+=v;for(var v=[v/4294967296>>>0,v>>>0],A=p.fullMessageLength.length-
|
|
1;0<=A;--A)p.fullMessageLength[A]+=v[1],v[1]=v[0]+(p.fullMessageLength[A]/4294967296>>>0),p.fullMessageLength[A]>>>=0,v[0]=v[1]/4294967296>>>0;d.putBytes(e);b(a,w,d);(2048<d.read||0===d.length())&&d.compact();return p};p.digest=function(){var g=c.util.createBuffer();g.putBytes(d.bytes());g.putBytes(e.substr(0,p.blockLength-(p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1)));c.util.createBuffer();for(var v,z,A=8*p.fullMessageLength[0],n=0;n<p.fullMessageLength.length;++n)v=
|
|
8*p.fullMessageLength[n+1],z=v/4294967296>>>0,A+=z,g.putInt32(A>>>0),A=v;v={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,h4:a.h4,h5:a.h5,h6:a.h6,h7:a.h7};b(v,w,g);g=c.util.createBuffer();g.putInt32(v.h0);g.putInt32(v.h1);g.putInt32(v.h2);g.putInt32(v.h3);g.putInt32(v.h4);g.putInt32(v.h5);g.putInt32(v.h6);g.putInt32(v.h7);return g};return p};var e=null,g=!1,n=null}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge=
|
|
{}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.sha256)return b.sha256;b.defined.sha256=!0;for(var l=0;l<e.length;++l)e[l](b);return b.sha256}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/sha256",["require","module","./util"],function(){r.apply(null,
|
|
Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){for(var m,e,h,l,g,x,G,w,v,n,q,E,r,K,S,L,R,u,V,U,X,T,J,I,O,Y=d.length();128<=Y;){for(O=0;16>O;++O)c[O][0]=d.getInt32()>>>0,c[O][1]=d.getInt32()>>>0;for(;80>O;++O)g=c[O-2],v=g[0],g=g[1],m=((v>>>19|g<<13)^(g>>>29|v<<3)^v>>>6)>>>0,e=((v<<13|g>>>19)^(g<<3|v>>>29)^(v<<26|g>>>6))>>>0,g=c[O-15],v=g[0],g=g[1],h=((v>>>1|g<<31)^(v>>>8|g<<24)^v>>>7)>>>0,l=((v<<31|g>>>1)^(v<<24|g>>>8)^(v<<25|g>>>7))>>>0,v=c[O-7],n=c[O-16],
|
|
g=e+v[1]+l+n[1],c[O][0]=m+v[0]+h+n[0]+(g/4294967296>>>0)>>>0,c[O][1]=g>>>0;v=a[0][0];n=a[0][1];q=a[1][0];E=a[1][1];r=a[2][0];K=a[2][1];S=a[3][0];L=a[3][1];R=a[4][0];u=a[4][1];V=a[5][0];U=a[5][1];X=a[6][0];T=a[6][1];J=a[7][0];I=a[7][1];for(O=0;80>O;++O)m=((R>>>14|u<<18)^(R>>>18|u<<14)^(u>>>9|R<<23))>>>0,g=((R<<18|u>>>14)^(R<<14|u>>>18)^(u<<23|R>>>9))>>>0,e=(X^R&(V^X))>>>0,x=(T^u&(U^T))>>>0,h=((v>>>28|n<<4)^(n>>>2|v<<30)^(n>>>7|v<<25))>>>0,l=((v<<4|n>>>28)^(n<<30|v>>>2)^(n<<25|v>>>7))>>>0,G=(v&q|r&
|
|
(v^q))>>>0,w=(n&E|K&(n^E))>>>0,g=I+g+x+k[O][1]+c[O][1],m=J+m+e+k[O][0]+c[O][0]+(g/4294967296>>>0)>>>0,e=g>>>0,g=l+w,h=h+G+(g/4294967296>>>0)>>>0,l=g>>>0,J=X,I=T,X=V,T=U,V=R,U=u,g=L+e,R=S+m+(g/4294967296>>>0)>>>0,u=g>>>0,S=r,L=K,r=q,K=E,q=v,E=n,g=e+l,v=m+h+(g/4294967296>>>0)>>>0,n=g>>>0;g=a[0][1]+n;a[0][0]=a[0][0]+v+(g/4294967296>>>0)>>>0;a[0][1]=g>>>0;g=a[1][1]+E;a[1][0]=a[1][0]+q+(g/4294967296>>>0)>>>0;a[1][1]=g>>>0;g=a[2][1]+K;a[2][0]=a[2][0]+r+(g/4294967296>>>0)>>>0;a[2][1]=g>>>0;g=a[3][1]+L;a[3][0]=
|
|
a[3][0]+S+(g/4294967296>>>0)>>>0;a[3][1]=g>>>0;g=a[4][1]+u;a[4][0]=a[4][0]+R+(g/4294967296>>>0)>>>0;a[4][1]=g>>>0;g=a[5][1]+U;a[5][0]=a[5][0]+V+(g/4294967296>>>0)>>>0;a[5][1]=g>>>0;g=a[6][1]+T;a[6][0]=a[6][0]+X+(g/4294967296>>>0)>>>0;a[6][1]=g>>>0;g=a[7][1]+I;a[7][0]=a[7][0]+J+(g/4294967296>>>0)>>>0;a[7][1]=g>>>0;Y-=128}}var d=c.sha512=c.sha512||{};c.md=c.md||{};c.md.algorithms=c.md.algorithms||{};c.md.sha512=c.md.algorithms.sha512=d;var e=c.sha384=c.sha512.sha384=c.sha512.sha384||{};e.create=function(){return d.create("SHA-384")};
|
|
c.md.sha384=c.md.algorithms.sha384=e;c.sha512.sha256=c.sha512.sha256||{create:function(){return d.create("SHA-512/256")}};c.md["sha512/256"]=c.md.algorithms["sha512/256"]=c.sha512.sha256;c.sha512.sha224=c.sha512.sha224||{create:function(){return d.create("SHA-512/224")}};c.md["sha512/224"]=c.md.algorithms["sha512/224"]=c.sha512.sha224;d.create=function(a){n||(g=String.fromCharCode(128),g+=c.util.fillString(String.fromCharCode(0),128),k=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],
|
|
[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,
|
|
3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],
|
|
[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,
|
|
4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],h={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],"SHA-384":[[3418070365,
|
|
3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],"SHA-512/256":[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],"SHA-512/224":[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],
|
|
[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},n=!0);"undefined"===typeof a&&(a="SHA-512");if(!(a in h))throw Error("Invalid SHA-512 algorithm: "+a);for(var d=h[a],e=null,w=c.util.createBuffer(),z=Array(80),A=0;80>A;++A)z[A]=Array(2);var D={algorithm:a.replace("-","").toLowerCase(),blockLength:128,digestLength:64,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){D.messageLength=0;D.fullMessageLength=D.messageLength128=[];for(var a=D.messageLengthSize/
|
|
4,b=0;b<a;++b)D.fullMessageLength.push(0);w=c.util.createBuffer();e=Array(d.length);for(b=0;b<d.length;++b)e[b]=d[b].slice(0);return D}};D.start();D.update=function(a,d){"utf8"===d&&(a=c.util.encodeUtf8(a));var h=a.length;D.messageLength+=h;for(var h=[h/4294967296>>>0,h>>>0],k=D.fullMessageLength.length-1;0<=k;--k)D.fullMessageLength[k]+=h[1],h[1]=h[0]+(D.fullMessageLength[k]/4294967296>>>0),D.fullMessageLength[k]>>>=0,h[0]=h[1]/4294967296>>>0;w.putBytes(a);b(e,z,w);(2048<w.read||0===w.length())&&
|
|
w.compact();return D};D.digest=function(){var d=c.util.createBuffer();d.putBytes(w.bytes());d.putBytes(g.substr(0,D.blockLength-(D.fullMessageLength[D.fullMessageLength.length-1]+D.messageLengthSize&D.blockLength-1)));c.util.createBuffer();for(var h,k,p=8*D.fullMessageLength[0],H=0;H<D.fullMessageLength.length;++H)h=8*D.fullMessageLength[H+1],k=h/4294967296>>>0,p+=k,d.putInt32(p>>>0),p=h;h=Array(e.length);for(H=0;H<e.length;++H)h[H]=e[H].slice(0);b(h,z,d);d=c.util.createBuffer();k="SHA-512"===a?h.length:
|
|
"SHA-384"===a?h.length-2:h.length-4;for(H=0;H<k;++H)d.putInt32(h[H][0]),H===k-1&&"SHA-512/224"===a||d.putInt32(h[H][1]);return d};return D};var g=null,n=!1,k=null,h=null}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.sha512)return b.sha512;b.defined.sha512=
|
|
!0;for(var l=0;l<e.length;++l)e[l](b);return b.sha512}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/sha512",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.md=c.md||{};c.md.algorithms={md5:c.md5,sha1:c.sha1,sha256:c.sha256};c.md.md5=c.md5;c.md.sha1=c.sha1;
|
|
c.md.sha256=c.sha256}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.md)return b.md;b.defined.md=!0;for(var l=0;l<e.length;++l)e[l](b);return b.md}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,
|
|
Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/md","require module ./md5 ./sha1 ./sha256 ./sha512".split(" "),function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){(c.hmac=c.hmac||{}).create=function(){var a=null,b=null,d=null,g={start:function(g,k){if(null!==g)if("string"===typeof g)if(g=g.toLowerCase(),g in c.md.algorithms)a=c.md.algorithms[g].create();else throw Error('Unknown hash algorithm "'+
|
|
g+'"');else a=g;if(null!==k){if("string"===typeof k)k=c.util.createBuffer(k);else if(c.util.isArray(k)){var h=k;k=c.util.createBuffer();for(var v=0;v<h.length;++v)k.putByte(h[v])}var p=k.length();p>a.blockLength&&(a.start(),a.update(k.bytes()),k=a.digest());b=c.util.createBuffer();d=c.util.createBuffer();p=k.length();for(v=0;v<p;++v)h=k.at(v),b.putByte(54^h),d.putByte(92^h);if(p<a.blockLength)for(h=a.blockLength-p,v=0;v<h;++v)b.putByte(54),d.putByte(92);b=b.bytes();d=d.bytes()}a.start();a.update(b)},
|
|
update:function(c){a.update(c)},getMac:function(){var c=a.digest().bytes();a.start();a.update(d);a.update(c);return a.digest()}};g.digest=g.getMac;return g}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.hmac)return b.hmac;b.defined.hmac=!0;for(var l=
|
|
0;l<e.length;++l)e[l](b);return b.hmac}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/hmac",["require","module","./md","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a){for(var c=a.name+": ",d=[],m=function(a,c){return" "+c},h=0;h<a.values.length;++h)d.push(a.values[h].replace(/^(\S+\r\n)/,
|
|
m));c+=d.join(",")+"\r\n";d=0;a=-1;for(h=0;h<c.length;++h,++d)if(65<d&&-1!==a)d=c[a],","===d?(++a,c=c.substr(0,a)+"\r\n "+c.substr(a)):c=c.substr(0,a)+"\r\n"+d+c.substr(a+1),d=h-a-1,a=-1,++h;else if(" "===c[h]||"\t"===c[h]||","===c[h])a=h;return c}var d=c.pem=c.pem||{};d.encode=function(a,d){d=d||{};var g="-----BEGIN "+a.type+"-----\r\n",k;a.procType&&(k={name:"Proc-Type",values:[String(a.procType.version),a.procType.type]},g+=b(k));a.contentDomain&&(k={name:"Content-Domain",values:[a.contentDomain]},
|
|
g+=b(k));a.dekInfo&&(k={name:"DEK-Info",values:[a.dekInfo.algorithm]},a.dekInfo.parameters&&k.values.push(a.dekInfo.parameters),g+=b(k));if(a.headers)for(k=0;k<a.headers.length;++k)g+=b(a.headers[k]);a.procType&&(g+="\r\n");g+=c.util.encode64(a.body,d.maxline||64)+"\r\n";return g+="-----END "+a.type+"-----\r\n"};d.decode=function(a){for(var b=[],d=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,k=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,
|
|
h=/\r?\n/,l;;){l=d.exec(a);if(!l)break;var g={type:l[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:c.util.decode64(l[3])};b.push(g);if(l[2]){for(var w=l[2].split(h),y=0;l&&y<w.length;){l=w[y].replace(/\s+$/,"");for(var z=y+1;z<w.length;++z){var n=w[z];if(!/\s/.test(n[0]))break;l+=n;y=z}if(l=l.match(k)){for(var z={name:l[1],values:[]},n=l[2].split(","),D=0;D<n.length;++D)z.values.push(n[D].replace(/^\s+/,""));if(g.procType)if(g.contentDomain||"Content-Domain"!==z.name)if(g.dekInfo||
|
|
"DEK-Info"!==z.name)g.headers.push(z);else{if(0===z.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');g.dekInfo={algorithm:n[0],parameters:n[1]||null}}else g.contentDomain=n[0]||"";else{if("Proc-Type"!==z.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==z.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');g.procType={version:n[0],
|
|
type:n[1]}}}++y}if("ENCRYPTED"===g.procType&&!g.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===b.length)throw Error("Invalid PEM formatted message.");return b}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);
|
|
b=b||{};b.defined=b.defined||{};if(b.defined.pem)return b.pem;b.defined.pem=!0;for(var l=0;l<e.length;++l)e[l](b);return b.pem}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pem",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,d){c.cipher.registerAlgorithm(a,
|
|
function(){return new c.des.Algorithm(a,d)})}function d(a,c,b,m){var e=32===a.length?3:9;m=3===e?m?[30,-2,-2]:[0,32,2]:m?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var l=c[0],B=c[1];c=(l>>>4^B)&252645135;B^=c;l^=c<<4;c=(l>>>16^B)&65535;B^=c;l^=c<<16;c=(B>>>2^l)&858993459;l^=c;B^=c<<2;c=(B>>>8^l)&16711935;l^=c;B^=c<<8;c=(l>>>1^B)&1431655765;for(var B=B^c,l=l^c<<1,l=l<<1|l>>>31,B=B<<1|B>>>31,w=0;w<e;w+=3){for(var r=m[w+1],q=m[w+2],u=m[w];u!=r;u+=q){var M=B^a[u],K=(B>>>4|B<<28)^a[u+1];c=l;
|
|
l=B;B=c^(n[M>>>24&63]|h[M>>>16&63]|p[M>>>8&63]|y[M&63]|g[K>>>24&63]|k[K>>>16&63]|C[K>>>8&63]|F[K&63])}c=l;l=B;B=c}l=l>>>1|l<<31;B=B>>>1|B<<31;c=(l>>>1^B)&1431655765;B^=c;l^=c<<1;c=(B>>>8^l)&16711935;l^=c;B^=c<<8;c=(B>>>2^l)&858993459;l^=c;B^=c<<2;c=(l>>>16^B)&65535;B^=c;l^=c<<16;c=(l>>>4^B)&252645135;b[0]=l^c<<4;b[1]=B^c}function e(a){a=a||{};var b="DES-"+(a.mode||"CBC").toUpperCase(),d;d=a.decrypt?c.cipher.createDecipher(b,a.key):c.cipher.createCipher(b,a.key);var h=d.start;d.start=function(a,b){var e=
|
|
null;b instanceof c.util.ByteBuffer&&(e=b,b={});b=b||{};b.output=e;b.iv=a;h.call(d,b)};return d}c.des=c.des||{};c.des.startEncrypting=function(a,c,b,d){a=e({key:a,output:b,decrypt:!1,mode:d||(null===c?"ECB":"CBC")});a.start(c);return a};c.des.createEncryptionCipher=function(a,c){return e({key:a,output:null,decrypt:!1,mode:c})};c.des.startDecrypting=function(a,c,b,d){a=e({key:a,output:b,decrypt:!0,mode:d||(null===c?"ECB":"CBC")});a.start(c);return a};c.des.createDecryptionCipher=function(a,c){return e({key:a,
|
|
output:null,decrypt:!0,mode:c})};c.des.Algorithm=function(a,c){var b=this;b.name=a;b.mode=new c({blockSize:8,cipher:{encrypt:function(a,c){return d(b._keys,a,c,!1)},decrypt:function(a,c){return d(b._keys,a,c,!0)}}});b._init=!1};c.des.Algorithm.prototype.initialize=function(a){if(!this._init){a=c.util.createBuffer(a.key);if(0===this.name.indexOf("3DES")&&24!==a.length())throw Error("Invalid Triple-DES key size: "+8*a.length());for(var b=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,
|
|
516,536871424,536871428,66048,66052,536936960,536936964],d=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],h=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],e=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],k=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],
|
|
l=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],g=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],p=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],q=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],v=[0,268435456,8,268435464,0,268435456,
|
|
8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],w=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],K=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],y=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],n=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],C=8<a.length()?3:
|
|
1,F=[],E=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],r=0,u,T=0;T<C;T++){var J=a.getInt32(),I=a.getInt32();u=(J>>>4^I)&252645135;I^=u;J^=u<<4;u=(I>>>-16^J)&65535;J^=u;I^=u<<-16;u=(J>>>2^I)&858993459;I^=u;J^=u<<2;u=(I>>>-16^J)&65535;J^=u;I^=u<<-16;u=(J>>>1^I)&1431655765;I^=u;J^=u<<1;u=(I>>>8^J)&16711935;J^=u;I^=u<<8;u=(J>>>1^I)&1431655765;I^=u;J^=u<<1;u=J<<8|I>>>20&240;for(var J=I<<24|I<<8&16711680|I>>>8&65280|I>>>24&240,I=u,O=0;O<E.length;++O){E[O]?(J=J<<2|J>>>26,I=I<<2|I>>>26):(J=J<<1|J>>>27,I=I<<1|I>>>27);
|
|
var J=J&-15,I=I&-15,Y=b[J>>>28]|d[J>>>24&15]|h[J>>>20&15]|e[J>>>16&15]|k[J>>>12&15]|l[J>>>8&15]|g[J>>>4&15],Z=p[I>>>28]|q[I>>>24&15]|v[I>>>20&15]|w[I>>>16&15]|K[I>>>12&15]|y[I>>>8&15]|n[I>>>4&15];u=(Z>>>16^Y)&65535;F[r++]=Y^u;F[r++]=Z^u<<16}}this._keys=F;this._init=!0}};b("DES-ECB",c.cipher.modes.ecb);b("DES-CBC",c.cipher.modes.cbc);b("DES-CFB",c.cipher.modes.cfb);b("DES-OFB",c.cipher.modes.ofb);b("DES-CTR",c.cipher.modes.ctr);b("3DES-ECB",c.cipher.modes.ecb);b("3DES-CBC",c.cipher.modes.cbc);b("3DES-CFB",
|
|
c.cipher.modes.cfb);b("3DES-OFB",c.cipher.modes.ofb);b("3DES-CTR",c.cipher.modes.ctr);var g=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,
|
|
0,65540,66560,0,16842756],n=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,
|
|
-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],k=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,
|
|
8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],h=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],C=[256,34078976,34078720,1107296512,
|
|
524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,
|
|
524288,0,1074266112,34078976,1073742080],p=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,
|
|
4194320,536887312,0,541081600,536870912,4194320,536887312],F=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,
|
|
67108866,67110912,2048,2097154],y=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,
|
|
268435456,268701696]}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.des)return b.des;b.defined.des=!0;for(var l=0;l<e.length;++l)e[l](b);return b.des}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,
|
|
Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/des",["require","module","./cipher","./cipherModes","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var d=c.pkcs5=c.pkcs5||{},g="undefined"!==typeof process&&process.versions&&process.versions.node,e;g&&!c.disableNativeCode&&(e=b("crypto"));c.pbkdf2=d.pbkdf2=function(a,b,d,h,l,p){function n(){if(u>A)return p(null,x);r.start(null,
|
|
null);r.update(b);r.update(c.util.int32ToBytes(u));G=H=r.digest().getBytes();q=2;y()}function y(){if(q<=d)return r.start(null,null),r.update(H),B=r.digest().getBytes(),G=c.util.xorBytes(G,B,z),H=B,++q,c.util.setImmediate(y);x+=u<A?G:G.substr(0,D);++u;n()}"function"===typeof l&&(p=l,l=null);if(g&&!c.disableNativeCode&&e.pbkdf2&&(null===l||"object"!==typeof l)&&(4<e.pbkdf2Sync.length||!l||"sha1"===l))return"string"!==typeof l&&(l="sha1"),b=new Buffer(b,"binary"),p?4===e.pbkdf2Sync.length?e.pbkdf2(a,
|
|
b,d,h,function(a,c){if(a)return p(a);p(null,c.toString("binary"))}):e.pbkdf2(a,b,d,h,l,function(a,c){if(a)return p(a);p(null,c.toString("binary"))}):4===e.pbkdf2Sync.length?e.pbkdf2Sync(a,b,d,h).toString("binary"):e.pbkdf2Sync(a,b,d,h,l).toString("binary");if("undefined"===typeof l||null===l)l=c.md.sha1.create();if("string"===typeof l){if(!(l in c.md.algorithms))throw Error("Unknown hash algorithm: "+l);l=c.md[l].create()}var z=l.digestLength;if(h>4294967295*z){a=Error("Derived key is too long.");
|
|
if(p)return p(a);throw a;}var A=Math.ceil(h/z),D=h-(A-1)*z,r=c.hmac.create();r.start(l,a);var x="",G,B,H;if(!p){for(var u=1;u<=A;++u){r.start(null,null);r.update(b);r.update(c.util.int32ToBytes(u));G=H=r.digest().getBytes();for(var q=2;q<=d;++q)r.start(null,null),r.update(H),B=r.digest().getBytes(),G=c.util.xorBytes(G,B,z),H=B;x+=u<A?G:G.substr(0,D)}return x}u=1;n()}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===
|
|
typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pbkdf2)return b.pbkdf2;b.defined.pbkdf2=!0;for(var l=0;l<e.length;++l)e[l](b);return b.pbkdf2}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pbkdf2",["require","module",
|
|
"./hmac","./md","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var d="undefined"!==typeof process&&process.versions&&process.versions.node,g=null;c.disableNativeCode||!d||process.versions["node-webkit"]||(g=b("crypto"));(c.prng=c.prng||{}).create=function(a){function b(a){if(32<=h.pools[0].messageLength)return d(),a();h.seedFile(32-h.pools[0].messageLength<<5,function(c,b){if(c)return a(c);h.collect(b);d();a()})}function d(){var a=h.plugin.md.create();
|
|
a.update(h.pools[0].digest().getBytes());h.pools[0].start();for(var c=1,b=1;32>b;++b)c=31===c?2147483648:c<<2,0===c%h.reseeds&&(a.update(h.pools[b].digest().getBytes()),h.pools[b].start());c=a.digest().getBytes();a.start();a.update(c);a=a.digest().getBytes();h.key=h.plugin.formatKey(c);h.seed=h.plugin.formatSeed(a);h.reseeds=4294967295===h.reseeds?0:h.reseeds+1;h.generated=0}function k(a){var b=null;if("undefined"!==typeof window){var d=window.crypto||window.msCrypto;d&&d.getRandomValues&&(b=function(a){return d.getRandomValues(a)})}var h=
|
|
c.util.createBuffer();if(b)for(;h.length()<a;){var e=Math.max(1,Math.min(a-h.length(),65536)/4),k=new Uint32Array(Math.floor(e));try{for(b(k),e=0;e<k.length;++e)h.putInt32(k[e])}catch(l){if(!("undefined"!==typeof QuotaExceededError&&l instanceof QuotaExceededError))throw l;}}if(h.length()<a)for(b=Math.floor(65536*Math.random());h.length()<a;)for(e=16807*(b&65535),b=16807*(b>>16),e+=(b&32767)<<16,e+=b>>15,e=(e&2147483647)+(e>>31),b=e&4294967295,e=0;3>e;++e)k=b>>>(e<<3),k^=Math.floor(256*Math.random()),
|
|
h.putByte(String.fromCharCode(k&255));return h.getBytes(a)}var h={plugin:a,key:null,seed:null,time:null,reseeds:0,generated:0};a=a.md;for(var l=Array(32),p=0;32>p;++p)l[p]=a.create();h.pools=l;h.pool=0;h.generate=function(a,d){function e(B){if(B)return d(B);if(p.length()>=a)return d(null,p.getBytes(a));1048575<h.generated&&(h.key=null);if(null===h.key)return c.util.nextTick(function(){b(e)});B=k(h.key,h.seed);h.generated+=B.length;p.putBytes(B);h.key=g(k(h.key,l(h.seed)));h.seed=x(k(h.key,h.seed));
|
|
c.util.setImmediate(e)}if(!d)return h.generateSync(a);var k=h.plugin.cipher,l=h.plugin.increment,g=h.plugin.formatKey,x=h.plugin.formatSeed,p=c.util.createBuffer();h.key=null;e()};h.generateSync=function(a){var b=h.plugin.cipher,e=h.plugin.increment,k=h.plugin.formatKey,l=h.plugin.formatSeed;h.key=null;for(var g=c.util.createBuffer();g.length()<a;){1048575<h.generated&&(h.key=null);null===h.key&&(32<=h.pools[0].messageLength||h.collect(h.seedFileSync(32-h.pools[0].messageLength<<5)),d());var p=b(h.key,
|
|
h.seed);h.generated+=p.length;g.putBytes(p);h.key=k(b(h.key,e(h.seed)));h.seed=l(b(h.key,h.seed))}return g.getBytes(a)};g?(h.seedFile=function(a,c){g.randomBytes(a,function(a,b){if(a)return c(a);c(null,b.toString())})},h.seedFileSync=function(a){return g.randomBytes(a).toString()}):(h.seedFile=function(a,c){try{c(null,k(a))}catch(b){c(b)}},h.seedFileSync=k);h.collect=function(a){for(var c=a.length,b=0;b<c;++b)h.pools[h.pool].update(a.substr(b,1)),h.pool=31===h.pool?0:h.pool+1};h.collectInt=function(a,
|
|
c){for(var b="",d=0;d<c;d+=8)b+=String.fromCharCode(a>>d&255);h.collect(b)};h.registerWorker=function(a){a===self?h.seedFile=function(a,c){function b(a){a=a.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",b),c(a.forge.prng.err,a.forge.prng.bytes))}self.addEventListener("message",b);self.postMessage({forge:{prng:{needed:a}}})}:a.addEventListener("message",function(c){c=c.data;c.forge&&c.forge.prng&&h.seedFile(c.forge.prng.needed,function(c,b){a.postMessage({forge:{prng:{err:c,bytes:b}}})})})};
|
|
return h}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.prng)return b.prng;b.defined.prng=!0;for(var l=0;l<e.length;++l)e[l](b);return b.prng}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,
|
|
0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/prng",["require","module","./md","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.random&&c.random.getBytes||function(a){function b(){var a=c.prng.create(d);a.getBytes=function(c,b){return a.generate(c,b)};a.getBytesSync=function(c){return a.generate(c)};return a}var d={},g=Array(4),n=c.util.createBuffer();d.formatKey=function(a){var b=c.util.createBuffer(a);a=Array(4);
|
|
a[0]=b.getInt32();a[1]=b.getInt32();a[2]=b.getInt32();a[3]=b.getInt32();return c.aes._expandKey(a,!1)};d.formatSeed=function(a){var b=c.util.createBuffer(a);a=Array(4);a[0]=b.getInt32();a[1]=b.getInt32();a[2]=b.getInt32();a[3]=b.getInt32();return a};d.cipher=function(a,b){c.aes._updateBlock(a,b,g,!1);n.putInt32(g[0]);n.putInt32(g[1]);n.putInt32(g[2]);n.putInt32(g[3]);return n.getBytes()};d.increment=function(a){++a[3];return a};d.md=c.md.sha256;var k=b(),h="undefined"!==typeof process&&process.versions&&
|
|
process.versions.node,C=null;if("undefined"!==typeof window){var p=window.crypto||window.msCrypto;p&&p.getRandomValues&&(C=function(a){return p.getRandomValues(a)})}if(c.disableNativeCode||!h&&!C){k.collectInt(+new Date,32);if("undefined"!==typeof navigator){var h="",F;for(F in navigator)try{"string"==typeof navigator[F]&&(h+=navigator[F])}catch(y){}k.collect(h);h=null}a&&(a().mousemove(function(a){k.collectInt(a.clientX,16);k.collectInt(a.clientY,16)}),a().keypress(function(a){k.collectInt(a.charCode,
|
|
8)}))}if(c.random)for(F in k)c.random[F]=k[F];else c.random=k;c.random.createInstance=b}("undefined"!==typeof jQuery?jQuery:null)}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.random)return b.random;b.defined.random=!0;for(var l=0;l<e.length;++l)e[l](b);
|
|
return b.random}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/random","require module ./aes ./md ./prng ./util".split(" "),function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var b=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,
|
|
139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,
|
|
175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],d=[1,2,3,5];c.rc2=c.rc2||{};c.rc2.expandKey=function(a,d){"string"===typeof a&&(a=c.util.createBuffer(a));d=d||128;var e=a,h=a.length(),g=d,p=Math.ceil(g/8),g=255>>(g&7),w;for(w=h;128>w;w++)e.putByte(b[e.at(w-
|
|
1)+e.at(w-h)&255]);e.setAt(128-p,b[e.at(128-p)&g]);for(w=127-p;0<=w;w--)e.setAt(w,b[e.at(w+1)^e.at(w+p)]);return e};var e=function(a,b,e){var h=!1,l=null,g=null,n=null,y,z,A,D,r=[];a=c.rc2.expandKey(a,b);for(A=0;64>A;A++)r.push(a.getInt16Le());e?(y=function(a){for(A=0;4>A;A++){a[A]+=r[D]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);var c=a[A],b=d[A];a[A]=c<<b&65535|(c&65535)>>16-b;D++}},z=function(a){for(A=0;4>A;A++)a[A]+=r[a[(A+3)%4]&63]}):(y=function(a){for(A=3;0<=A;A--){var c=a[A],b=d[A];a[A]=
|
|
(c&65535)>>b|c<<16-b&65535;a[A]-=r[D]+(a[(A+3)%4]&a[(A+2)%4])+(~a[(A+3)%4]&a[(A+1)%4]);D--}},z=function(a){for(A=3;0<=A;A--)a[A]-=r[a[(A+3)%4]&63]});var x=null;return x={start:function(a,b){a&&"string"===typeof a&&(a=c.util.createBuffer(a));h=!1;l=c.util.createBuffer();g=b||new c.util.createBuffer;n=a;x.output=g},update:function(a){for(h||l.putBuffer(a);8<=l.length();){a=[[5,y],[1,z],[6,y],[1,z],[5,y]];var c=[];for(A=0;4>A;A++){var b=l.getInt16Le();null!==n&&(e?b^=n.getInt16Le():n.putInt16Le(b));
|
|
c.push(b&65535)}D=e?0:63;for(b=0;b<a.length;b++)for(var d=0;d<a[b][0];d++)a[b][1](c);for(A=0;4>A;A++)null!==n&&(e?n.putInt16Le(c[A]):c[A]^=n.getInt16Le()),g.putInt16Le(c[A])}},finish:function(a){var c=!0;if(e)if(a)c=a(8,l,!e);else{var b=8===l.length()?8:8-l.length();l.fillWithByte(b,b)}c&&(h=!0,x.update());!e&&(c=0===l.length())&&(a?c=a(8,g,!e):(a=g.length(),b=g.at(a-1),b>a?c=!1:g.truncate(b)));return c}}};c.rc2.startEncrypting=function(a,b,d){a=c.rc2.createEncryptionCipher(a,128);a.start(b,d);return a};
|
|
c.rc2.createEncryptionCipher=function(a,c){return e(a,c,!0)};c.rc2.startDecrypting=function(a,b,d){a=c.rc2.createDecryptionCipher(a,128);a.start(b,d);return a};c.rc2.createDecryptionCipher=function(a,c){return e(a,c,!1)}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||
|
|
{};if(b.defined.rc2)return b.rc2;b.defined.rc2=!0;for(var l=0;l<e.length;++l)e[l](b);return b.rc2}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/rc2",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d){this.data=[];null!=a&&("number"==typeof a?
|
|
this.fromNumber(a,c,d):null==c&&"string"!=typeof a?this.fromString(a,256):this.fromString(a,c))}function d(){return new b(null)}function e(a,c,b,d,m,h){for(;0<=--h;){var e=c*this.data[a++]+b.data[d]+m;m=Math.floor(e/67108864);b.data[d++]=e&67108863}return m}function g(a,c,b,d,m,h){var e=c&32767;for(c>>=15;0<=--h;){var k=this.data[a]&32767,l=this.data[a++]>>15,x=c*k+l*e,k=e*k+((x&32767)<<15)+b.data[d]+(m&1073741823);m=(k>>>30)+(x>>>15)+c*l+(m>>>30);b.data[d++]=k&1073741823}return m}function n(a,c,
|
|
b,d,m,h){var e=c&16383;for(c>>=14;0<=--h;){var k=this.data[a]&16383,l=this.data[a++]>>14,g=c*k+l*e,k=e*k+((g&16383)<<14)+b.data[d]+m;m=(k>>28)+(g>>14)+c*l;b.data[d++]=k&268435455}return m}function k(a,c){var b=u[a.charCodeAt(c)];return null==b?-1:b}function h(a){var c=d();c.fromInt(a);return c}function C(a){var c=1,b;0!=(b=a>>>16)&&(a=b,c+=16);0!=(b=a>>8)&&(a=b,c+=8);0!=(b=a>>4)&&(a=b,c+=4);0!=(b=a>>2)&&(a=b,c+=2);0!=a>>1&&(c+=1);return c}function p(a){this.m=a}function F(a){this.m=a;this.mp=a.invDigit();
|
|
this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<a.DB-15)-1;this.mt2=2*a.t}function y(a,c){return a&c}function z(a,c){return a|c}function A(a,c){return a^c}function D(a,c){return a&~c}function r(){}function x(a){return a}function G(a){this.r2=d();this.q3=d();b.ONE.dlShiftTo(2*a.t,this.r2);this.mu=this.r2.divide(a);this.m=a}function B(){return{nextBytes:function(a){for(var c=0;c<a.length;++c)a[c]=Math.floor(256*Math.random())}}}var H;"undefined"===typeof navigator?(b.prototype.am=n,H=28):"Microsoft Internet Explorer"==
|
|
navigator.appName?(b.prototype.am=g,H=30):"Netscape"!=navigator.appName?(b.prototype.am=e,H=26):(b.prototype.am=n,H=28);b.prototype.DB=H;b.prototype.DM=(1<<H)-1;b.prototype.DV=1<<H;b.prototype.FV=Math.pow(2,52);b.prototype.F1=52-H;b.prototype.F2=2*H-52;var u=[],q;H=48;for(q=0;9>=q;++q)u[H++]=q;H=97;for(q=10;36>q;++q)u[H++]=q;H=65;for(q=10;36>q;++q)u[H++]=q;p.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};p.prototype.revert=function(a){return a};p.prototype.reduce=
|
|
function(a){a.divRemTo(this.m,null,a)};p.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};p.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};F.prototype.convert=function(a){var c=d();a.abs().dlShiftTo(this.m.t,c);c.divRemTo(this.m,null,c);0>a.s&&0<c.compareTo(b.ZERO)&&this.m.subTo(c,c);return c};F.prototype.revert=function(a){var c=d();a.copyTo(c);this.reduce(c);return c};F.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var c=0;c<this.m.t;++c){var b=
|
|
a.data[c]&32767,d=b*this.mpl+((b*this.mph+(a.data[c]>>15)*this.mpl&this.um)<<15)&a.DM,b=c+this.m.t;for(a.data[b]+=this.m.am(0,d,a,c,0,this.m.t);a.data[b]>=a.DV;)a.data[b]-=a.DV,a.data[++b]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};F.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};F.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};b.prototype.copyTo=function(a){for(var c=this.t-1;0<=c;--c)a.data[c]=this.data[c];a.t=this.t;a.s=this.s};
|
|
b.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};b.prototype.fromString=function(a,c){var d;if(16==c)d=4;else if(8==c)d=3;else if(256==c)d=8;else if(2==c)d=1;else if(32==c)d=5;else if(4==c)d=2;else{this.fromRadix(a,c);return}this.s=this.t=0;for(var m=a.length,h=!1,e=0;0<=--m;){var g=8==d?a[m]&255:k(a,m);0>g?"-"==a.charAt(m)&&(h=!0):(h=!1,0==e?this.data[this.t++]=g:e+d>this.DB?(this.data[this.t-1]|=(g&(1<<this.DB-e)-1)<<e,this.data[this.t++]=
|
|
g>>this.DB-e):this.data[this.t-1]|=g<<e,e+=d,e>=this.DB&&(e-=this.DB))}8==d&&0!=(a[0]&128)&&(this.s=-1,0<e&&(this.data[this.t-1]|=(1<<this.DB-e)-1<<e));this.clamp();h&&b.ZERO.subTo(this,this)};b.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};b.prototype.dlShiftTo=function(a,c){var b;for(b=this.t-1;0<=b;--b)c.data[b+a]=this.data[b];for(b=a-1;0<=b;--b)c.data[b]=0;c.t=this.t+a;c.s=this.s};b.prototype.drShiftTo=function(a,c){for(var b=a;b<this.t;++b)c.data[b-
|
|
a]=this.data[b];c.t=Math.max(this.t-a,0);c.s=this.s};b.prototype.lShiftTo=function(a,c){var b=a%this.DB,d=this.DB-b,m=(1<<d)-1,h=Math.floor(a/this.DB),e=this.s<<b&this.DM,k;for(k=this.t-1;0<=k;--k)c.data[k+h+1]=this.data[k]>>d|e,e=(this.data[k]&m)<<b;for(k=h-1;0<=k;--k)c.data[k]=0;c.data[h]=e;c.t=this.t+h+1;c.s=this.s;c.clamp()};b.prototype.rShiftTo=function(a,c){c.s=this.s;var b=Math.floor(a/this.DB);if(b>=this.t)c.t=0;else{var d=a%this.DB,m=this.DB-d,h=(1<<d)-1;c.data[0]=this.data[b]>>d;for(var e=
|
|
b+1;e<this.t;++e)c.data[e-b-1]|=(this.data[e]&h)<<m,c.data[e-b]=this.data[e]>>d;0<d&&(c.data[this.t-b-1]|=(this.s&h)<<m);c.t=this.t-b;c.clamp()}};b.prototype.subTo=function(a,c){for(var b=0,d=0,m=Math.min(a.t,this.t);b<m;)d+=this.data[b]-a.data[b],c.data[b++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;b<this.t;)d+=this.data[b],c.data[b++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;b<a.t;)d-=a.data[b],c.data[b++]=d&this.DM,d>>=this.DB;d-=a.s}c.s=0>d?-1:0;-1>d?c.data[b++]=this.DV+d:0<d&&
|
|
(c.data[b++]=d);c.t=b;c.clamp()};b.prototype.multiplyTo=function(a,c){var d=this.abs(),m=a.abs(),h=d.t;for(c.t=h+m.t;0<=--h;)c.data[h]=0;for(h=0;h<m.t;++h)c.data[h+d.t]=d.am(0,m.data[h],c,h,0,d.t);c.s=0;c.clamp();this.s!=a.s&&b.ZERO.subTo(c,c)};b.prototype.squareTo=function(a){for(var c=this.abs(),b=a.t=2*c.t;0<=--b;)a.data[b]=0;for(b=0;b<c.t-1;++b){var d=c.am(b,c.data[b],a,2*b,0,1);(a.data[b+c.t]+=c.am(b+1,2*c.data[b],a,2*b+1,d,c.t-b-1))>=c.DV&&(a.data[b+c.t]-=c.DV,a.data[b+c.t+1]=1)}0<a.t&&(a.data[a.t-
|
|
1]+=c.am(b,c.data[b],a,2*b,0,1));a.s=0;a.clamp()};b.prototype.divRemTo=function(a,c,m){var h=a.abs();if(!(0>=h.t)){var e=this.abs();if(e.t<h.t)null!=c&&c.fromInt(0),null!=m&&this.copyTo(m);else{null==m&&(m=d());var k=d(),g=this.s;a=a.s;var x=this.DB-C(h.data[h.t-1]);0<x?(h.lShiftTo(x,k),e.lShiftTo(x,m)):(h.copyTo(k),e.copyTo(m));h=k.t;e=k.data[h-1];if(0!=e){var p=e*(1<<this.F1)+(1<h?k.data[h-2]>>this.F2:0),q=this.FV/p,p=(1<<this.F1)/p,B=1<<this.F2,v=m.t,G=v-h,n=null==c?d():c;k.dlShiftTo(G,n);0<=m.compareTo(n)&&
|
|
(m.data[m.t++]=1,m.subTo(n,m));b.ONE.dlShiftTo(h,n);for(n.subTo(k,k);k.t<h;)k.data[k.t++]=0;for(;0<=--G;){var y=m.data[--v]==e?this.DM:Math.floor(m.data[v]*q+(m.data[v-1]+B)*p);if((m.data[v]+=k.am(0,y,m,G,0,h))<y)for(k.dlShiftTo(G,n),m.subTo(n,m);m.data[v]<--y;)m.subTo(n,m)}null!=c&&(m.drShiftTo(h,c),g!=a&&b.ZERO.subTo(c,c));m.t=h;m.clamp();0<x&&m.rShiftTo(x,m);0>g&&b.ZERO.subTo(m,m)}}}};b.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var c=a&3,c=c*(2-
|
|
(a&15)*c)&15,c=c*(2-(a&255)*c)&255,c=c*(2-((a&65535)*c&65535))&65535,c=c*(2-a*c%this.DV)%this.DV;return 0<c?this.DV-c:-c};b.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};b.prototype.exp=function(a,c){if(4294967295<a||1>a)return b.ONE;var m=d(),h=d(),e=c.convert(this),k=C(a)-1;for(e.copyTo(m);0<=--k;)if(c.sqrTo(m,h),0<(a&1<<k))c.mulTo(h,e,m);else var g=m,m=h,h=g;return c.revert(m)};b.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=
|
|
4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var c=(1<<a)-1,b,d=!1,m="",h=this.t,e=this.DB-h*this.DB%a;if(0<h--)for(e<this.DB&&0<(b=this.data[h]>>e)&&(d=!0,m="0123456789abcdefghijklmnopqrstuvwxyz".charAt(b));0<=h;)e<a?(b=(this.data[h]&(1<<e)-1)<<a-e,b|=this.data[--h]>>(e+=this.DB-a)):(b=this.data[h]>>(e-=a)&c,0>=e&&(e+=this.DB,--h)),0<b&&(d=!0),d&&(m+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(b));return d?m:"0"};b.prototype.negate=function(){var a=
|
|
d();b.ZERO.subTo(this,a);return a};b.prototype.abs=function(){return 0>this.s?this.negate():this};b.prototype.compareTo=function(a){var c=this.s-a.s;if(0!=c)return c;var b=this.t,c=b-a.t;if(0!=c)return 0>this.s?-c:c;for(;0<=--b;)if(0!=(c=this.data[b]-a.data[b]))return c;return 0};b.prototype.bitLength=function(){return 0>=this.t?0:this.DB*(this.t-1)+C(this.data[this.t-1]^this.s&this.DM)};b.prototype.mod=function(a){var c=d();this.abs().divRemTo(a,null,c);0>this.s&&0<c.compareTo(b.ZERO)&&a.subTo(c,
|
|
c);return c};b.prototype.modPowInt=function(a,c){var b;b=256>a||c.isEven()?new p(c):new F(c);return this.exp(a,b)};b.ZERO=h(0);b.ONE=h(1);r.prototype.convert=x;r.prototype.revert=x;r.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b)};r.prototype.sqrTo=function(a,c){a.squareTo(c)};G.prototype.convert=function(a){if(0>a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var c=d();a.copyTo(c);this.reduce(c);return c};G.prototype.revert=function(a){return a};G.prototype.reduce=function(a){a.drShiftTo(this.m.t-
|
|
1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};G.prototype.mulTo=function(a,c,b){a.multiplyTo(c,b);this.reduce(b)};G.prototype.sqrTo=function(a,c){a.squareTo(c);this.reduce(c)};var P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,
|
|
113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],M=67108864/P[P.length-1];b.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};b.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var c=this.chunkSize(a),c=Math.pow(a,
|
|
c),b=h(c),m=d(),e=d(),k="";for(this.divRemTo(b,m,e);0<m.signum();)k=(c+e.intValue()).toString(a).substr(1)+k,m.divRemTo(b,m,e);return e.intValue().toString(a)+k};b.prototype.fromRadix=function(a,c){this.fromInt(0);null==c&&(c=10);for(var d=this.chunkSize(c),m=Math.pow(c,d),h=!1,e=0,g=0,x=0;x<a.length;++x){var p=k(a,x);0>p?"-"==a.charAt(x)&&0==this.signum()&&(h=!0):(g=c*g+p,++e>=d&&(this.dMultiply(m),this.dAddOffset(g,0),g=e=0))}0<e&&(this.dMultiply(Math.pow(c,e)),this.dAddOffset(g,0));h&&b.ZERO.subTo(this,
|
|
this)};b.prototype.fromNumber=function(a,c,d){if("number"==typeof c)if(2>a)this.fromInt(1);else for(this.fromNumber(a,d),this.testBit(a-1)||this.bitwiseTo(b.ONE.shiftLeft(a-1),z,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(c);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(b.ONE.shiftLeft(a-1),this);else{d=[];var m=a&7;d.length=(a>>3)+1;c.nextBytes(d);d[0]=0<m?d[0]&(1<<m)-1:0;this.fromString(d,256)}};b.prototype.bitwiseTo=function(a,c,b){var d,m,h=Math.min(a.t,this.t);for(d=
|
|
0;d<h;++d)b.data[d]=c(this.data[d],a.data[d]);if(a.t<this.t){m=a.s&this.DM;for(d=h;d<this.t;++d)b.data[d]=c(this.data[d],m);b.t=this.t}else{m=this.s&this.DM;for(d=h;d<a.t;++d)b.data[d]=c(m,a.data[d]);b.t=a.t}b.s=c(this.s,a.s);b.clamp()};b.prototype.changeBit=function(a,c){var d=b.ONE.shiftLeft(a);this.bitwiseTo(d,c,d);return d};b.prototype.addTo=function(a,c){for(var b=0,d=0,m=Math.min(a.t,this.t);b<m;)d+=this.data[b]+a.data[b],c.data[b++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;b<this.t;)d+=
|
|
this.data[b],c.data[b++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;b<a.t;)d+=a.data[b],c.data[b++]=d&this.DM,d>>=this.DB;d+=a.s}c.s=0>d?-1:0;0<d?c.data[b++]=d:-1>d&&(c.data[b++]=this.DV+d);c.t=b;c.clamp()};b.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()};b.prototype.dAddOffset=function(a,c){if(0!=a){for(;this.t<=c;)this.data[this.t++]=0;for(this.data[c]+=a;this.data[c]>=this.DV;)this.data[c]-=this.DV,++c>=this.t&&(this.data[this.t++]=
|
|
0),++this.data[c]}};b.prototype.multiplyLowerTo=function(a,c,b){var d=Math.min(this.t+a.t,c);b.s=0;for(b.t=d;0<d;)b.data[--d]=0;var m;for(m=b.t-this.t;d<m;++d)b.data[d+this.t]=this.am(0,a.data[d],b,d,0,this.t);for(m=Math.min(a.t,c);d<m;++d)this.am(0,a.data[d],b,d,0,c-d);b.clamp()};b.prototype.multiplyUpperTo=function(a,c,b){--c;var d=b.t=this.t+a.t-c;for(b.s=0;0<=--d;)b.data[d]=0;for(d=Math.max(c-this.t,0);d<a.t;++d)b.data[this.t+d-c]=this.am(c-d,a.data[d],b,0,0,this.t+d-c);b.clamp();b.drShiftTo(1,
|
|
b)};b.prototype.modInt=function(a){if(0>=a)return 0;var c=this.DV%a,b=0>this.s?a-1:0;if(0<this.t)if(0==c)b=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)b=(c*b+this.data[d])%a;return b};b.prototype.millerRabin=function(a){var c=this.subtract(b.ONE),d=c.getLowestSetBit();if(0>=d)return!1;for(var m=c.shiftRight(d),h=B(),e,k=0;k<a;++k){do e=new b(this.bitLength(),h);while(0>=e.compareTo(b.ONE)||0<=e.compareTo(c));e=e.modPow(m,this);if(0!=e.compareTo(b.ONE)&&0!=e.compareTo(c)){for(var g=1;g++<d&&0!=
|
|
e.compareTo(c);)if(e=e.modPowInt(2,this),0==e.compareTo(b.ONE))return!1;if(0!=e.compareTo(c))return!1}}return!0};b.prototype.clone=function(){var a=d();this.copyTo(a);return a};b.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};b.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};b.prototype.shortValue=
|
|
function(){return 0==this.t?this.s:this.data[0]<<16>>16};b.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};b.prototype.toByteArray=function(){var a=this.t,c=[];c[0]=this.s;var b=this.DB-a*this.DB%8,d,m=0;if(0<a--)for(b<this.DB&&(d=this.data[a]>>b)!=(this.s&this.DM)>>b&&(c[m++]=d|this.s<<this.DB-b);0<=a;)if(8>b?(d=(this.data[a]&(1<<b)-1)<<8-b,d|=this.data[--a]>>(b+=this.DB-8)):(d=this.data[a]>>(b-=8)&255,0>=b&&(b+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==m&&
|
|
(this.s&128)!=(d&128)&&++m,0<m||d!=this.s)c[m++]=d;return c};b.prototype.equals=function(a){return 0==this.compareTo(a)};b.prototype.min=function(a){return 0>this.compareTo(a)?this:a};b.prototype.max=function(a){return 0<this.compareTo(a)?this:a};b.prototype.and=function(a){var c=d();this.bitwiseTo(a,y,c);return c};b.prototype.or=function(a){var c=d();this.bitwiseTo(a,z,c);return c};b.prototype.xor=function(a){var c=d();this.bitwiseTo(a,A,c);return c};b.prototype.andNot=function(a){var c=d();this.bitwiseTo(a,
|
|
D,c);return c};b.prototype.not=function(){for(var a=d(),c=0;c<this.t;++c)a.data[c]=this.DM&~this.data[c];a.t=this.t;a.s=~this.s;return a};b.prototype.shiftLeft=function(a){var c=d();0>a?this.rShiftTo(-a,c):this.lShiftTo(a,c);return c};b.prototype.shiftRight=function(a){var c=d();0>a?this.lShiftTo(-a,c):this.rShiftTo(a,c);return c};b.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var c=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var b=0;0==(a&65535)&&(a>>=16,b+=16);
|
|
0==(a&255)&&(a>>=8,b+=8);0==(a&15)&&(a>>=4,b+=4);0==(a&3)&&(a>>=2,b+=2);0==(a&1)&&++b;a=b}return c+a}return 0>this.s?this.t*this.DB:-1};b.prototype.bitCount=function(){for(var a=0,c=this.s&this.DM,b=0;b<this.t;++b){for(var d=this.data[b]^c,m=0;0!=d;)d&=d-1,++m;a+=m}return a};b.prototype.testBit=function(a){var c=Math.floor(a/this.DB);return c>=this.t?0!=this.s:0!=(this.data[c]&1<<a%this.DB)};b.prototype.setBit=function(a){return this.changeBit(a,z)};b.prototype.clearBit=function(a){return this.changeBit(a,
|
|
D)};b.prototype.flipBit=function(a){return this.changeBit(a,A)};b.prototype.add=function(a){var c=d();this.addTo(a,c);return c};b.prototype.subtract=function(a){var c=d();this.subTo(a,c);return c};b.prototype.multiply=function(a){var c=d();this.multiplyTo(a,c);return c};b.prototype.divide=function(a){var c=d();this.divRemTo(a,c,null);return c};b.prototype.remainder=function(a){var c=d();this.divRemTo(a,null,c);return c};b.prototype.divideAndRemainder=function(a){var c=d(),b=d();this.divRemTo(a,c,
|
|
b);return[c,b]};b.prototype.modPow=function(a,c){var b=a.bitLength(),m,e=h(1),k;if(0>=b)return e;m=18>b?1:48>b?3:144>b?4:768>b?5:6;k=8>b?new p(c):c.isEven()?new G(c):new F(c);var g=[],l=3,x=m-1,q=(1<<m)-1;g[1]=k.convert(this);if(1<m)for(b=d(),k.sqrTo(g[1],b);l<=q;)g[l]=d(),k.mulTo(b,g[l-2],g[l]),l+=2;for(var B=a.t-1,v,n=!0,y=d(),b=C(a.data[B])-1;0<=B;){b>=x?v=a.data[B]>>b-x&q:(v=(a.data[B]&(1<<b+1)-1)<<x-b,0<B&&(v|=a.data[B-1]>>this.DB+b-x));for(l=m;0==(v&1);)v>>=1,--l;0>(b-=l)&&(b+=this.DB,--B);
|
|
if(n)g[v].copyTo(e),n=!1;else{for(;1<l;)k.sqrTo(e,y),k.sqrTo(y,e),l-=2;0<l?k.sqrTo(e,y):(l=e,e=y,y=l);k.mulTo(y,g[v],e)}for(;0<=B&&0==(a.data[B]&1<<b);)k.sqrTo(e,y),l=e,e=y,y=l,0>--b&&(b=this.DB-1,--B)}return k.revert(e)};b.prototype.modInverse=function(a){var c=a.isEven();if(this.isEven()&&c||0==a.signum())return b.ZERO;for(var d=a.clone(),m=this.clone(),e=h(1),k=h(0),g=h(0),x=h(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),c?(e.isEven()&&k.isEven()||(e.addTo(this,e),k.subTo(a,k)),e.rShiftTo(1,
|
|
e)):k.isEven()||k.subTo(a,k),k.rShiftTo(1,k);for(;m.isEven();)m.rShiftTo(1,m),c?(g.isEven()&&x.isEven()||(g.addTo(this,g),x.subTo(a,x)),g.rShiftTo(1,g)):x.isEven()||x.subTo(a,x),x.rShiftTo(1,x);0<=d.compareTo(m)?(d.subTo(m,d),c&&e.subTo(g,e),k.subTo(x,k)):(m.subTo(d,m),c&&g.subTo(e,g),x.subTo(k,x))}if(0!=m.compareTo(b.ONE))return b.ZERO;if(0<=x.compareTo(a))return x.subtract(a);if(0>x.signum())x.addTo(a,x);else return x;return 0>x.signum()?x.add(a):x};b.prototype.pow=function(a){return this.exp(a,
|
|
new r)};b.prototype.gcd=function(a){var c=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>c.compareTo(a)){var b=c,c=a;a=b}var b=c.getLowestSetBit(),d=a.getLowestSetBit();if(0>d)return c;b<d&&(d=b);0<d&&(c.rShiftTo(d,c),a.rShiftTo(d,a));for(;0<c.signum();)0<(b=c.getLowestSetBit())&&c.rShiftTo(b,c),0<(b=a.getLowestSetBit())&&a.rShiftTo(b,a),0<=c.compareTo(a)?(c.subTo(a,c),c.rShiftTo(1,c)):(a.subTo(c,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};b.prototype.isProbablePrime=
|
|
function(a){var c,b=this.abs();if(1==b.t&&b.data[0]<=P[P.length-1]){for(c=0;c<P.length;++c)if(b.data[0]==P[c])return!0;return!1}if(b.isEven())return!1;for(c=1;c<P.length;){for(var d=P[c],m=c+1;m<P.length&&d<M;)d*=P[m++];for(d=b.modInt(d);c<m;)if(0==d%P[c++])return!1}return b.millerRabin(a)};c.jsbn=c.jsbn||{};c.jsbn.BigInteger=b}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,
|
|
r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.jsbn)return b.jsbn;b.defined.jsbn=!0;for(var g=0;g<e.length;++g)e[g](b);return b.jsbn}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/jsbn",["require","module"],function(){r.apply(null,Array.prototype.slice.call(arguments,
|
|
0))})})();(function(){function a(c){function b(a,d,g){g||(g=c.md.sha1.create());for(var k="",h=Math.ceil(d/g.digestLength),l=0;l<h;++l){var p=String.fromCharCode(l>>24&255,l>>16&255,l>>8&255,l&255);g.start();g.update(a+p);k+=g.digest().getBytes()}return k.substring(0,d)}var d=c.pkcs1=c.pkcs1||{};d.encode_rsa_oaep=function(a,d,g,k,h){var w,p,n,y;"string"===typeof g?(w=g,p=k||void 0,n=h||void 0):g&&(w=g.label||void 0,p=g.seed||void 0,n=g.md||void 0,g.mgf1&&g.mgf1.md&&(y=g.mgf1.md));n?n.start():n=c.md.sha1.create();
|
|
y||(y=n);a=Math.ceil(a.n.bitLength()/8);g=a-2*n.digestLength-2;if(d.length>g)throw y=Error("RSAES-OAEP input message length is too long."),y.length=d.length,y.maxLength=g,y;w||(w="");n.update(w,"raw");w=n.digest();k="";g-=d.length;for(h=0;h<g;h++)k+="\x00";d=w.getBytes()+k+"\u0001"+d;if(!p)p=c.random.getBytes(n.digestLength);else if(p.length!==n.digestLength)throw y=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),y.seedLength=p.length,y.digestLength=n.digestLength,
|
|
y;a=b(p,a-n.digestLength-1,y);d=c.util.xorBytes(d,a,d.length);n=b(d,n.digestLength,y);return"\x00"+c.util.xorBytes(p,n,p.length)+d};d.decode_rsa_oaep=function(a,d,g,k){var h,w,p;"string"===typeof g?(h=g,w=k||void 0):g&&(h=g.label||void 0,w=g.md||void 0,g.mgf1&&g.mgf1.md&&(p=g.mgf1.md));g=Math.ceil(a.n.bitLength()/8);if(d.length!==g)throw p=Error("RSAES-OAEP encoded message length is invalid."),p.length=d.length,p.expectedLength=g,p;void 0===w?w=c.md.sha1.create():w.start();p||(p=w);if(g<2*w.digestLength+
|
|
2)throw Error("RSAES-OAEP key is too short for the hash function.");h||(h="");w.update(h,"raw");h=w.digest().getBytes();a=d.charAt(0);k=d.substring(1,w.digestLength+1);d=d.substring(1+w.digestLength);var n=b(d,w.digestLength,p);k=c.util.xorBytes(k,n,k.length);p=b(k,g-w.digestLength-1,p);d=c.util.xorBytes(d,p,d.length);g=d.substring(0,w.digestLength);p="\x00"!==a;for(a=0;a<w.digestLength;++a)p|=h.charAt(a)!==g.charAt(a);h=1;for(w=a=w.digestLength;w<d.length;w++)g=d.charCodeAt(w),k=g&1^1,p|=g&(h?65534:
|
|
0),h&=k,a+=h;if(p||1!==d.charCodeAt(a))throw Error("Invalid RSAES-OAEP padding.");return d.substring(a+1)}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pkcs1)return b.pkcs1;b.defined.pkcs1=!0;for(var g=0;g<e.length;++g)e[g](b);return b.pkcs1}},
|
|
u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pkcs1",["require","module","./util","./random","./sha1"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,m,h){return"workers"in m?e(a,c,m,h):d(a,c,m,h)}function d(a,b,h,e){var k=g(a,b),l=0,p=n(k.bitLength());"millerRabinTests"in
|
|
h&&(p=h.millerRabinTests);var B=10;"maxBlockTime"in h&&(B=h.maxBlockTime);var H=+new Date;do{k.bitLength()>a&&(k=g(a,b));if(k.isProbablePrime(p))return e(null,k);k.dAddOffset(C[l++%8],0)}while(0>B||+new Date-H<B);c.util.setImmediate(function(){d(a,b,h,e)})}function e(a,b,e,k){function l(){function c(m){if(!w){--e;var l=m.data;if(l.found){for(m=0;m<d.length;++m)d[m].terminate();w=!0;return k(null,new h(l.prime,16))}x.bitLength()>a&&(x=g(a,b));l=x.toString(16);m.target.postMessage({hex:l,workLoad:B});
|
|
x.dAddOffset(n,0)}}p=Math.max(1,p);for(var d=[],m=0;m<p;++m)d[m]=new Worker(C);for(var e=p,m=0;m<p;++m)d[m].addEventListener("message",c);var w=!1}if("undefined"===typeof Worker)return d(a,b,e,k);var x=g(a,b),p=e.workers,B=e.workLoad||100,n=30*B/8,C=e.workerScript||"forge/prime.worker.js";if(-1===p)return c.util.estimateCores(function(a,c){a&&(c=2);p=c-1;l()});l()}function g(a,c){var b=new h(a,c),d=a-1;b.testBit(d)||b.bitwiseTo(h.ONE.shiftLeft(d),r,b);b.dAddOffset(31-b.mod(p).byteValue(),0);return b}
|
|
function n(a){return 100>=a?27:150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if(!c.prime){var k=c.prime=c.prime||{},h=c.jsbn.BigInteger,C=[6,4,2,4,2,4,6,2],p=new h(null);p.fromInt(30);var r=function(a,c){return a|c};k.generateProbablePrime=function(a,d,h){"function"===typeof d&&(h=d,d={});d=d||{};var e=d.algorithm||"PRIMEINC";"string"===typeof e&&(e={name:e});e.options=e.options||{};var k=d.prng||c.random;d={nextBytes:function(a){for(var c=k.getBytesSync(a.length),
|
|
b=0;b<a.length;++b)a[b]=c.charCodeAt(b)}};if("PRIMEINC"===e.name)return b(a,d,e.options,h);throw Error("Invalid prime generation algorithm: "+e.name);}}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.prime)return b.prime;b.defined.prime=!0;for(var g=
|
|
0;g<e.length;++g)e[g](b);return b.prime}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/prime",["require","module","./util","./jsbn","./random"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,d,h){var e=c.util.createBuffer();d=Math.ceil(d.n.bitLength()/8);if(a.length>d-11)throw e=
|
|
Error("Message is too long for PKCS#1 v1.5 padding."),e.length=a.length,e.max=d-11,e;e.putByte(0);e.putByte(h);d=d-3-a.length;if(0===h||1===h){h=0===h?0:255;for(var k=0;k<d;++k)e.putByte(h)}else for(;0<d;){for(var g=0,l=c.random.getBytes(d),k=0;k<d;++k)h=l.charCodeAt(k),0===h?++g:e.putByte(h);d=g}e.putByte(0);e.putBytes(a);return e}function d(a,b,e,h){b=Math.ceil(b.n.bitLength()/8);a=c.util.createBuffer(a);var k=a.getByte(),g=a.getByte();if(0!==k||e&&0!==g&&1!==g||!e&&2!=g||e&&0===g&&"undefined"===
|
|
typeof h)throw Error("Encryption block is invalid.");e=0;if(0===g)for(e=b-3-h,h=0;h<e;++h){if(0!==a.getByte())throw Error("Encryption block is invalid.");}else if(1===g)for(e=0;1<a.length();){if(255!==a.getByte()){--a.read;break}++e}else if(2===g)for(e=0;1<a.length();){if(0===a.getByte()){--a.read;break}++e}if(0!==a.getByte()||e!==b-3-a.length())throw Error("Encryption block is invalid.");return a.getBytes()}function e(a,b,d){function e(){h(a.pBits,function(c,b){if(c)return d(c);a.p=b;if(null!==a.q)return g(c,
|
|
a.q);h(a.qBits,g)})}function h(a,b){c.prime.generateProbablePrime(a,l,b)}function g(c,b){if(c)return d(c);a.q=b;if(0>a.p.compareTo(a.q)){var m=a.p;a.p=a.q;a.q=m}0!==a.p.subtract(k.ONE).gcd(a.e).compareTo(k.ONE)?(a.p=null,e()):0!==a.q.subtract(k.ONE).gcd(a.e).compareTo(k.ONE)?(a.q=null,h(a.qBits,g)):(a.p1=a.p.subtract(k.ONE),a.q1=a.q.subtract(k.ONE),a.phi=a.p1.multiply(a.q1),0!==a.phi.gcd(a.e).compareTo(k.ONE)?(a.p=a.q=null,e()):(a.n=a.p.multiply(a.q),a.n.bitLength()!==a.bits?(a.q=null,h(a.qBits,g)):
|
|
(m=a.e.modInverse(a.phi),a.keys={privateKey:C.rsa.setPrivateKey(a.n,a.e,m,a.p,a.q,m.mod(a.p1),m.mod(a.q1),a.q.modInverse(a.p)),publicKey:C.rsa.setPublicKey(a.n,a.e)},d(null,a.keys))))}"function"===typeof b&&(d=b,b={});b=b||{};var l={algorithm:{name:b.algorithm||"PRIMEINC",options:{workers:b.workers||2,workLoad:b.workLoad||100,workerScript:b.workerScript}}};"prng"in b&&(l.prng=b.prng);e()}function g(a){a=a.toString(16);"8"<=a[0]&&(a="00"+a);return c.util.hexToBytes(a)}function n(a){return 100>=a?27:
|
|
150>=a?18:200>=a?15:250>=a?12:300>=a?9:350>=a?8:400>=a?7:500>=a?6:600>=a?5:800>=a?4:1250>=a?3:2}if("undefined"===typeof k)var k=c.jsbn.BigInteger;var h=c.asn1;c.pki=c.pki||{};c.pki.rsa=c.rsa=c.rsa||{};var C=c.pki,p=[6,4,2,4,2,4,6,2],r={name:"PrivateKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:h.Class.UNIVERSAL,
|
|
type:h.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},y={name:"RSAPrivateKey",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",
|
|
tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",
|
|
tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},z={name:"RSAPublicKey",tagClass:h.Class.UNIVERSAL,
|
|
type:h.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},A=c.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,
|
|
type:h.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},D=function(a){var c;if(a.algorithm in C.oids)c=C.oids[a.algorithm];
|
|
else throw c=Error("Unknown message digest algorithm."),c.algorithm=a.algorithm,c;var b=h.oidToDer(c).getBytes();c=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);var d=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);d.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,b));d.value.push(h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,""));a=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,a.digest().getBytes());c.value.push(d);c.value.push(a);return h.toDer(c).getBytes()},u=function(a,b,d){if(d)return a.modPow(b.e,
|
|
b.n);if(!b.p||!b.q)return a.modPow(b.d,b.n);b.dP||(b.dP=b.d.mod(b.p.subtract(k.ONE)));b.dQ||(b.dQ=b.d.mod(b.q.subtract(k.ONE)));b.qInv||(b.qInv=b.q.modInverse(b.p));do d=new k(c.util.bytesToHex(c.random.getBytes(b.n.bitLength()/8)),16);while(0<=d.compareTo(b.n)||!d.gcd(b.n).equals(k.ONE));a=a.multiply(d.modPow(b.e,b.n)).mod(b.n);var e=a.mod(b.p).modPow(b.dP,b.p);for(a=a.mod(b.q).modPow(b.dQ,b.q);0>e.compareTo(a);)e=e.add(b.p);a=e.subtract(a).multiply(b.qInv).mod(b.p).multiply(b.q).add(a);return a=
|
|
a.multiply(d.modInverse(b.n)).mod(b.n)};C.rsa.encrypt=function(a,d,e){var h=e,g=Math.ceil(d.n.bitLength()/8);!1!==e&&!0!==e?(h=2===e,e=b(a,d,e)):(e=c.util.createBuffer(),e.putBytes(a));a=new k(e.toHex(),16);d=u(a,d,h).toString(16);h=c.util.createBuffer();for(g-=Math.ceil(d.length/2);0<g;)h.putByte(0),--g;h.putBytes(c.util.hexToBytes(d));return h.getBytes()};C.rsa.decrypt=function(a,b,e,h){var g=Math.ceil(b.n.bitLength()/8);if(a.length!==g)throw b=Error("Encrypted message length is invalid."),b.length=
|
|
a.length,b.expected=g,b;a=new k(c.util.createBuffer(a).toHex(),16);if(0<=a.compareTo(b.n))throw Error("Encrypted message is invalid.");a=u(a,b,e).toString(16);for(var l=c.util.createBuffer(),g=g-Math.ceil(a.length/2);0<g;)l.putByte(0),--g;l.putBytes(c.util.hexToBytes(a));return!1!==h?d(l.getBytes(),b,e):l.getBytes()};C.rsa.createKeyPairGenerationState=function(a,b,d){"string"===typeof a&&(a=parseInt(a,10));a=a||2048;d=d||{};var e=d.prng||c.random,h={nextBytes:function(a){for(var c=e.getBytesSync(a.length),
|
|
b=0;b<a.length;++b)a[b]=c.charCodeAt(b)}};d=d.algorithm||"PRIMEINC";if("PRIMEINC"===d)a={algorithm:d,state:0,bits:a,rng:h,eInt:b||65537,e:new k(null),p:null,q:null,qBits:a>>1,pBits:a-(a>>1),pqState:0,num:null,keys:null},a.e.fromInt(a.eInt);else throw Error("Invalid key generation algorithm: "+d);return a};C.rsa.stepKeyPairGenerationState=function(a,c){"algorithm"in a||(a.algorithm="PRIMEINC");var b=new k(null);b.fromInt(30);for(var d=0,m=function(a,c){return a|c},e=+new Date,h,g=0;null===a.keys&&
|
|
(0>=c||g<c);){if(0===a.state){h=null===a.p?a.pBits:a.qBits;var l=h-1;0===a.pqState?(a.num=new k(h,a.rng),a.num.testBit(l)||a.num.bitwiseTo(k.ONE.shiftLeft(l),m,a.num),a.num.dAddOffset(31-a.num.mod(b).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>h?a.pqState=0:a.num.isProbablePrime(n(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(p[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(k.ONE).gcd(a.e).compareTo(k.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,
|
|
null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(k.ONE),a.q1=a.q.subtract(k.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(k.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(h=a.e.modInverse(a.phi),a.keys={privateKey:C.rsa.setPrivateKey(a.n,a.e,h,a.p,a.q,
|
|
h.mod(a.p1),h.mod(a.q1),a.q.modInverse(a.p)),publicKey:C.rsa.setPublicKey(a.n,a.e)});h=+new Date;g+=h-e;e=h}return null!==a.keys};C.rsa.generateKeyPair=function(a,c,b,d){1===arguments.length?"object"===typeof a?(b=a,a=void 0):"function"===typeof a&&(d=a,a=void 0):2===arguments.length?"number"===typeof a?"function"===typeof c?(d=c,c=void 0):"number"!==typeof c&&(b=c,c=void 0):(b=a,d=c,c=a=void 0):3===arguments.length&&("number"===typeof c?"function"===typeof b&&(d=b,b=void 0):(d=b,b=c,c=void 0));b=
|
|
b||{};void 0===a&&(a=b.bits||2048);void 0===c&&(c=b.e||65537);var m=C.rsa.createKeyPairGenerationState(a,c,b);if(!d)return C.rsa.stepKeyPairGenerationState(m,0),m.keys;e(m,b,d)};C.setRsaPublicKey=C.rsa.setPublicKey=function(a,e){var k={n:a,e:e,encrypt:function(a,d,e){"string"===typeof d?d=d.toUpperCase():void 0===d&&(d="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===d)d={encode:function(a,c,d){return b(a,c,2).getBytes()}};else if("RSA-OAEP"===d||"RSAES-OAEP"===d)d={encode:function(a,b){return c.pkcs1.encode_rsa_oaep(b,
|
|
a,e)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(d))d={encode:function(a){return a}};else if("string"===typeof d)throw Error('Unsupported encryption scheme: "'+d+'".');a=d.encode(a,k,!0);return C.rsa.encrypt(a,k,!0)},verify:function(a,c,b){"string"===typeof b?b=b.toUpperCase():void 0===b&&(b="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===b)b={verify:function(a,c){c=d(c,k,!0);var b=h.fromDer(c);return a===b.value[1].value}};else if("NONE"===b||"NULL"===b||null===b)b={verify:function(a,c){c=d(c,
|
|
k,!0);return a===c}};c=C.rsa.decrypt(c,k,!0,!1);return b.verify(a,c,k.n.bitLength())}};return k};C.setRsaPrivateKey=C.rsa.setPrivateKey=function(a,b,e,h,k,g,l,p){var v={n:a,e:b,d:e,p:h,q:k,dP:g,dQ:l,qInv:p,decrypt:function(a,b,e){"string"===typeof b?b=b.toUpperCase():void 0===b&&(b="RSAES-PKCS1-V1_5");a=C.rsa.decrypt(a,v,!1,!1);if("RSAES-PKCS1-V1_5"===b)b={decode:d};else if("RSA-OAEP"===b||"RSAES-OAEP"===b)b={decode:function(a,b){return c.pkcs1.decode_rsa_oaep(b,a,e)}};else if(-1!==["RAW","NONE",
|
|
"NULL",null].indexOf(b))b={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+b+'".');return b.decode(a,v,!1)},sign:function(a,c){var b=!1;"string"===typeof c&&(c=c.toUpperCase());if(void 0===c||"RSASSA-PKCS1-V1_5"===c)c={encode:D},b=1;else if("NONE"===c||"NULL"===c||null===c)c={encode:function(){return a}},b=1;var d=c.encode(a,v.n.bitLength());return C.rsa.encrypt(d,v,b)}};return v};C.wrapRsaPrivateKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,
|
|
[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(0).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(C.oids.rsaEncryption).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,h.toDer(a).getBytes())])};C.privateKeyFromAsn1=function(a){var b={},d=[];h.validate(a,r,b,d)&&(a=h.fromDer(c.util.createBuffer(b.privateKey)));b={};d=[];if(!h.validate(a,y,b,d))throw b=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),
|
|
b.errors=d,b;var e,g,l,p,v,d=c.util.createBuffer(b.privateKeyModulus).toHex();a=c.util.createBuffer(b.privateKeyPublicExponent).toHex();e=c.util.createBuffer(b.privateKeyPrivateExponent).toHex();g=c.util.createBuffer(b.privateKeyPrime1).toHex();l=c.util.createBuffer(b.privateKeyPrime2).toHex();p=c.util.createBuffer(b.privateKeyExponent1).toHex();v=c.util.createBuffer(b.privateKeyExponent2).toHex();b=c.util.createBuffer(b.privateKeyCoefficient).toHex();return C.setRsaPrivateKey(new k(d,16),new k(a,
|
|
16),new k(e,16),new k(g,16),new k(l,16),new k(p,16),new k(v,16),new k(b,16))};C.privateKeyToAsn1=C.privateKeyToRSAPrivateKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(0).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.n)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.e)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.d)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.p)),h.create(h.Class.UNIVERSAL,
|
|
h.Type.INTEGER,!1,g(a.q)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.dP)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.dQ)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.qInv))])};C.publicKeyFromAsn1=function(a){var b={},d=[];if(h.validate(a,A,b,d)){d=h.derToOid(b.publicKeyOid);if(d!==C.oids.rsaEncryption)throw b=Error("Cannot read public key. Unknown OID."),b.oid=d,b;a=b.rsaPublicKey}d=[];if(!h.validate(a,z,b,d))throw b=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),
|
|
b.errors=d,b;d=c.util.createBuffer(b.publicKeyModulus).toHex();b=c.util.createBuffer(b.publicKeyExponent).toHex();return C.setRsaPublicKey(new k(d,16),new k(b,16))};C.publicKeyToAsn1=C.publicKeyToSubjectPublicKeyInfo=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(C.oids.rsaEncryption).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,
|
|
!1,[C.publicKeyToRSAPublicKey(a)])])};C.publicKeyToRSAPublicKey=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.n)),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,g(a.e))])}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||
|
|
{};b.defined=b.defined||{};if(b.defined.rsa)return b.rsa;b.defined.rsa=!0;for(var g=0;g<e.length;++g)e[g](b);return b.rsa}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/rsa","require module ./asn1 ./jsbn ./oids ./pkcs1 ./prime ./random ./util".split(" "),function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,
|
|
c){return a.start().update(c).digest().getBytes()}if("undefined"===typeof d)var d=c.jsbn.BigInteger;var e=c.asn1,g=c.pki=c.pki||{};g.pbe=c.pbe=c.pbe||{};var n=g.oids,k={name:"EncryptedPrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encryptionOid"},
|
|
{name:"AlgorithmIdentifier.parameters",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},h={name:"PBES2Algorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",
|
|
tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,onstructed:!0,capture:"kdfIterationCount"}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:e.Class.UNIVERSAL,
|
|
type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},C={name:"pkcs-12PbeParams",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"salt"},
|
|
{name:"pkcs-12PbeParams.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"iterations"}]};g.encryptPrivateKeyInfo=function(a,b,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||"aes128";var h=c.random.getBytesSync(d.saltSize),k=d.count,l=e.integerToDer(k),w;if(0===d.algorithm.indexOf("aes")||"des"===d.algorithm){var x,G;switch(d.algorithm){case "aes128":x=w=16;d=n["aes128-CBC"];G=c.aes.createEncryptionCipher;break;case "aes192":w=24;
|
|
x=16;d=n["aes192-CBC"];G=c.aes.createEncryptionCipher;break;case "aes256":w=32;x=16;d=n["aes256-CBC"];G=c.aes.createEncryptionCipher;break;case "des":x=w=8;d=n.desCBC;G=c.des.createEncryptionCipher;break;default:throw h=Error("Cannot encrypt private key. Unknown encryption algorithm."),h.algorithm=d.algorithm,h;}var B=c.pkcs5.pbkdf2(b,h,k,w);b=c.random.getBytesSync(x);k=G(B);k.start(b);k.update(e.toDer(a));k.finish();a=k.output.getBytes();h=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,
|
|
e.Type.OID,!1,e.oidToDer(n.pkcs5PBES2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.pkcs5PBKDF2).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,h),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,l.getBytes())])]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d).getBytes()),e.create(e.Class.UNIVERSAL,
|
|
e.Type.OCTETSTRING,!1,b)])])])}else if("3des"===d.algorithm)w=24,d=new c.util.ByteBuffer(h),B=g.pbe.generatePkcs12Key(b,d,1,k,w),b=g.pbe.generatePkcs12Key(b,d,2,k,w),k=c.des.createEncryptionCipher(B),k.start(b),k.update(e.toDer(a)),k.finish(),a=k.output.getBytes(),h=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,
|
|
!1,h),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,l.getBytes())])]);else throw h=Error("Cannot encrypt private key. Unknown encryption algorithm."),h.algorithm=d.algorithm,h;return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[h,e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,a)])};g.decryptPrivateKeyInfo=function(a,b){var d=null,h={},l=[];if(!e.validate(a,k,h,l))throw d=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=l,d;l=e.derToOid(h.encryptionOid);
|
|
l=g.pbe.getCipher(l,h.encryptionParams,b);h=c.util.createBuffer(h.encryptedData);l.update(h);l.finish()&&(d=e.fromDer(l.output));return d};g.encryptedPrivateKeyToPem=function(a,b){var d={type:"ENCRYPTED PRIVATE KEY",body:e.toDer(a).getBytes()};return c.pem.encode(d,{maxline:b})};g.encryptedPrivateKeyFromPem=function(a){a=c.pem.decode(a)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var b=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');b.headerType=
|
|
a.type;throw b;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return e.fromDer(a.body)};g.encryptRsaPrivateKey=function(a,b,d){d=d||{};if(!d.legacy)return a=g.wrapRsaPrivateKey(g.privateKeyToAsn1(a)),a=g.encryptPrivateKeyInfo(a,b,d),g.encryptedPrivateKeyToPem(a);var h,k,l;switch(d.algorithm){case "aes128":d="AES-128-CBC";k=16;h=c.random.getBytesSync(16);l=c.aes.createEncryptionCipher;break;case "aes192":d="AES-192-CBC";
|
|
k=24;h=c.random.getBytesSync(16);l=c.aes.createEncryptionCipher;break;case "aes256":d="AES-256-CBC";k=32;h=c.random.getBytesSync(16);l=c.aes.createEncryptionCipher;break;case "3des":d="DES-EDE3-CBC";k=24;h=c.random.getBytesSync(8);l=c.des.createEncryptionCipher;break;case "des":d="DES-CBC";k=8;h=c.random.getBytesSync(8);l=c.des.createEncryptionCipher;break;default:throw a=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+d.algorithm+'".'),a.algorithm=d.algorithm,a;}b=c.pbe.opensslDeriveBytes(b,
|
|
h.substr(0,8),k);b=l(b);b.start(h);b.update(e.toDer(g.privateKeyToAsn1(a)));b.finish();a={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:d,parameters:c.util.bytesToHex(h).toUpperCase()},body:b.output.getBytes()};return c.pem.encode(a)};g.decryptRsaPrivateKey=function(a,b){var d=null,h=c.pem.decode(a)[0];if("ENCRYPTED PRIVATE KEY"!==h.type&&"PRIVATE KEY"!==h.type&&"RSA PRIVATE KEY"!==h.type)throw d=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'),
|
|
d.headerType=d,d;if(h.procType&&"ENCRYPTED"===h.procType.type){var k,l;switch(h.dekInfo.algorithm){case "DES-CBC":k=8;l=c.des.createDecryptionCipher;break;case "DES-EDE3-CBC":k=24;l=c.des.createDecryptionCipher;break;case "AES-128-CBC":k=16;l=c.aes.createDecryptionCipher;break;case "AES-192-CBC":k=24;l=c.aes.createDecryptionCipher;break;case "AES-256-CBC":k=32;l=c.aes.createDecryptionCipher;break;case "RC2-40-CBC":k=5;l=function(a){return c.rc2.createDecryptionCipher(a,40)};break;case "RC2-64-CBC":k=
|
|
8;l=function(a){return c.rc2.createDecryptionCipher(a,64)};break;case "RC2-128-CBC":k=16;l=function(a){return c.rc2.createDecryptionCipher(a,128)};break;default:throw d=Error('Could not decrypt private key; unsupported encryption algorithm "'+h.dekInfo.algorithm+'".'),d.algorithm=h.dekInfo.algorithm,d;}var w=c.util.hexToBytes(h.dekInfo.parameters);k=c.pbe.opensslDeriveBytes(b,w.substr(0,8),k);l=l(k);l.start(w);l.update(c.util.createBuffer(h.body));if(l.finish())d=l.output.getBytes();else return d}else d=
|
|
h.body;d="ENCRYPTED PRIVATE KEY"===h.type?g.decryptPrivateKeyInfo(e.fromDer(d),b):e.fromDer(d);null!==d&&(d=g.privateKeyFromAsn1(d));return d};g.pbe.generatePkcs12Key=function(a,b,d,h,e,k){var g,l;if("undefined"===typeof k||null===k)k=c.md.sha1.create();var w=k.digestLength,n=k.blockLength,v=new c.util.ByteBuffer,C=new c.util.ByteBuffer;if(null!==a&&void 0!==a){for(l=0;l<a.length;l++)C.putInt16(a.charCodeAt(l));C.putInt16(0)}a=C.length();var q=b.length(),r=new c.util.ByteBuffer;r.fillWithByte(d,n);
|
|
var u=n*Math.ceil(q/n);d=new c.util.ByteBuffer;for(l=0;l<u;l++)d.putByte(b.at(l%q));u=n*Math.ceil(a/n);b=new c.util.ByteBuffer;for(l=0;l<u;l++)b.putByte(C.at(l%a));C=d;C.putBuffer(b);b=Math.ceil(e/w);for(d=1;d<=b;d++){u=new c.util.ByteBuffer;u.putBytes(r.bytes());u.putBytes(C.bytes());for(l=0;l<h;l++)k.start(),k.update(u.getBytes()),u=k.digest();var E=new c.util.ByteBuffer;for(l=0;l<n;l++)E.putByte(u.at(l%w));var S=Math.ceil(q/n)+Math.ceil(a/n),L=new c.util.ByteBuffer;for(g=0;g<S;g++){var R=new c.util.ByteBuffer(C.getBytes(n)),
|
|
W=511;for(l=E.length()-1;0<=l;l--)W>>=8,W+=E.at(l)+R.at(l),R.setAt(l,W&255);L.putBuffer(R)}C=L;v.putBuffer(u)}v.truncate(v.length()-e);return v};g.pbe.getCipher=function(a,c,b){switch(a){case g.oids.pkcs5PBES2:return g.pbe.getCipherForPBES2(a,c,b);case g.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case g.oids["pbewithSHAAnd40BitRC2-CBC"]:return g.pbe.getCipherForPKCS12PBE(a,c,b);default:throw c=Error("Cannot read encrypted PBE data block. Unsupported OID."),c.oid=a,c.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC",
|
|
"pbewithSHAAnd40BitRC2-CBC"],c;}};g.pbe.getCipherForPBES2=function(a,b,d){var k={};a=[];if(!e.validate(b,h,k,a)){var l=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");l.errors=a;throw l;}a=e.derToOid(k.kdfOid);if(a!==g.oids.pkcs5PBKDF2)throw l=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),l.oid=a,l.supportedOids=["pkcs5PBKDF2"],l;a=e.derToOid(k.encOid);if(a!==g.oids["aes128-CBC"]&&
|
|
a!==g.oids["aes192-CBC"]&&a!==g.oids["aes256-CBC"]&&a!==g.oids["des-EDE3-CBC"]&&a!==g.oids.desCBC)throw l=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),l.oid=a,l.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],l;b=k.kdfSalt;var w=c.util.createBuffer(k.kdfIterationCount),w=w.getInt(w.length()<<3),n;switch(g.oids[a]){case "aes128-CBC":n=16;l=c.aes.createDecryptionCipher;break;case "aes192-CBC":n=24;l=c.aes.createDecryptionCipher;break;
|
|
case "aes256-CBC":n=32;l=c.aes.createDecryptionCipher;break;case "des-EDE3-CBC":n=24;l=c.des.createDecryptionCipher;break;case "desCBC":n=8,l=c.des.createDecryptionCipher}a=c.pkcs5.pbkdf2(d,b,w,n);k=k.encIv;l=l(a);l.start(k);return l};g.pbe.getCipherForPKCS12PBE=function(a,b,d){var h={},k=[];if(!e.validate(b,C,h,k))throw d=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),d.errors=k,d;var k=c.util.createBuffer(h.salt),h=c.util.createBuffer(h.iterations),
|
|
h=h.getInt(h.length()<<3),l;switch(a){case g.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:l=24;b=8;a=c.des.startDecrypting;break;case g.oids["pbewithSHAAnd40BitRC2-CBC"]:l=5;b=8;a=function(a,b){var d=c.rc2.createDecryptionCipher(a,40);d.start(b,null);return d};break;default:throw d=Error("Cannot read PKCS #12 PBE data block. Unsupported OID."),d.oid=a,d;}l=g.pbe.generatePkcs12Key(d,k,1,h,l);d=g.pbe.generatePkcs12Key(d,k,2,h,b);return a(l,d)};g.pbe.opensslDeriveBytes=function(a,d,h,e){if("undefined"===
|
|
typeof e||null===e)e=c.md.md5.create();null===d&&(d="");for(var k=[b(e,a+d)],g=16,w=1;g<h;++w,g+=16)k.push(b(e,k[w-1]+a+d));return k.join("").substr(0,h)}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pbe)return b.pbe;b.defined.pbe=!0;for(var g=
|
|
0;g<e.length;++g)e[g](b);return b.pbe}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pbe","require module ./aes ./asn1 ./des ./md ./oids ./pem ./pbkdf2 ./random ./rc2 ./rsa ./util".split(" "),function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var b=c.asn1,d=c.pkcs7asn1=c.pkcs7asn1||{};c.pkcs7=
|
|
c.pkcs7||{};c.pkcs7.asn1=d;c={name:"ContentInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};d.contentInfoValidator=c;var e={name:"EncryptedContentInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",
|
|
tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:b.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",
|
|
tagClass:b.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};d.envelopedDataValidator={name:"EnvelopedData",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:b.Class.UNIVERSAL,type:b.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(e)};d.encryptedDataValidator={name:"EncryptedData",
|
|
tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"version"}].concat(e)};d.signedDataValidator={name:"SignedData",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:b.Class.UNIVERSAL,type:b.Type.SET,constructed:!0,
|
|
captureAsn1:"digestAlgorithms"},c,{name:"SignedData.Certificates",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:b.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:b.Class.UNIVERSAL,type:b.Type.SET,capture:"signerInfos",optional:!0,value:[{name:"SignerInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:b.Class.UNIVERSAL,
|
|
type:b.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,
|
|
value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:b.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,
|
|
constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:b.Class.UNIVERSAL,type:b.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:b.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]}]}]};d.recipientInfoValidator={name:"RecipientInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,
|
|
constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,
|
|
value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:b.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:b.Class.UNIVERSAL,type:b.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===
|
|
typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pkcs7asn1)return b.pkcs7asn1;b.defined.pkcs7asn1=!0;for(var g=0;g<e.length;++g)e[g](b);return b.pkcs7asn1}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pkcs7asn1",
|
|
["require","module","./asn1","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.mgf=c.mgf||{};(c.mgf.mgf1=c.mgf1=c.mgf1||{}).create=function(a){return{generate:function(b,d){for(var g=new c.util.ByteBuffer,n=Math.ceil(d/a.digestLength),k=0;k<n;k++){var h=new c.util.ByteBuffer;h.putInt32(k);a.start();a.update(b+h.getBytes());g.putBuffer(a.digest())}g.truncate(g.length()-d);return g.getBytes()}}}}if("function"!==typeof c)if("object"===typeof module&&
|
|
module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.mgf1)return b.mgf1;b.defined.mgf1=!0;for(var g=0;g<e.length;++g)e[g](b);return b.mgf1}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,
|
|
Array.prototype.slice.call(arguments,0))};c("js/mgf1",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.mgf=c.mgf||{};c.mgf.mgf1=c.mgf1}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||
|
|
{};if(b.defined.mgf)return b.mgf;b.defined.mgf=!0;for(var g=0;g<e.length;++g)e[g](b);return b.mgf}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/mgf",["require","module","./mgf1"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){(c.pss=c.pss||{}).create=function(a){3===arguments.length&&
|
|
(a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var b=a.md,d=a.mgf,g=b.digestLength,n=a.salt||null;"string"===typeof n&&(n=c.util.createBuffer(n));var k;if("saltLength"in a)k=a.saltLength;else if(null!==n)k=n.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==n&&n.length()!==k)throw Error("Given salt length does not match length of given salt.");var h=a.prng||c.random;return{encode:function(a,l){var r,y=l-1,z=Math.ceil(y/8),u=a.digest().getBytes();
|
|
if(z<g+k+2)throw Error("Message is too long to encrypt.");var D;D=null===n?h.getBytesSync(k):n.bytes();r=new c.util.ByteBuffer;r.fillWithByte(0,8);r.putBytes(u);r.putBytes(D);b.start();b.update(r.getBytes());u=b.digest().getBytes();r=new c.util.ByteBuffer;r.fillWithByte(0,z-k-g-2);r.putByte(1);r.putBytes(D);var N=r.getBytes(),x=z-g-1,G=d.generate(u,x);D="";for(r=0;r<x;r++)D+=String.fromCharCode(N.charCodeAt(r)^G.charCodeAt(r));y=65280>>8*z-y&255;D=String.fromCharCode(D.charCodeAt(0)&~y)+D.substr(1);
|
|
return D+u+String.fromCharCode(188)},verify:function(a,h,l){var n;n=l-1;l=Math.ceil(n/8);h=h.substr(-l);if(l<g+k+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==h.charCodeAt(l-1))throw Error("Encoded message does not end in 0xBC.");var r=l-g-1,u=h.substr(0,r);h=h.substr(r,g);var D=65280>>8*l-n&255;if(0!==(u.charCodeAt(0)&D))throw Error("Bits beyond keysize not zero as expected.");var E=d.generate(h,r),x="";for(n=0;n<r;n++)x+=String.fromCharCode(u.charCodeAt(n)^E.charCodeAt(n));
|
|
x=String.fromCharCode(x.charCodeAt(0)&~D)+x.substr(1);l=l-g-k-2;for(n=0;n<l;n++)if(0!==x.charCodeAt(n))throw Error("Leftmost octets not zero as expected");if(1!==x.charCodeAt(l))throw Error("Inconsistent PSS signature, 0x01 marker not found");l=x.substr(-k);r=new c.util.ByteBuffer;r.fillWithByte(0,8);r.putBytes(a);r.putBytes(l);b.start();b.update(r.getBytes());a=b.digest().getBytes();return h===a}}}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,
|
|
module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pss)return b.pss;b.defined.pss=!0;for(var g=0;g<e.length;++g)e[g](b);return b.pss}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pss",
|
|
["require","module","./random","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c){"string"===typeof c&&(c={shortName:c});for(var d=null,h,e=0;null===d&&e<a.attributes.length;++e)h=a.attributes[e],c.type&&c.type===h.type?d=h:c.name&&c.name===h.name?d=h:c.shortName&&c.shortName===h.shortName&&(d=h);return d}function d(a){var b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),e;a=a.attributes;for(var k=0;k<a.length;++k){e=a[k];
|
|
var g=e.value,l=h.Type.PRINTABLESTRING;"valueTagClass"in e&&(l=e.valueTagClass,l===h.Type.UTF8&&(g=c.util.encodeUtf8(g)));e=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.UNIVERSAL,l,!1,g)])]);b.value.push(e)}return b}function e(a){for(var c,b=0;b<a.length;++b){c=a[b];"undefined"===typeof c.name&&(c.type&&c.type in r.oids?c.name=r.oids[c.type]:c.shortName&&c.shortName in
|
|
u&&(c.name=r.oids[u[c.shortName]]));if("undefined"===typeof c.type)if(c.name&&c.name in r.oids)c.type=r.oids[c.name];else throw a=Error("Attribute type not specified."),a.attribute=c,a;"undefined"===typeof c.shortName&&c.name&&c.name in u&&(c.shortName=u[c.name]);if(c.type===p.extensionRequest&&(c.valueConstructed=!0,c.valueTagClass=h.Type.SEQUENCE,!c.value&&c.extensions)){c.value=[];for(var d=0;d<c.extensions.length;++d)c.value.push(r.certificateExtensionToAsn1(g(c.extensions[d])))}if("undefined"===
|
|
typeof c.value)throw a=Error("Attribute value not specified."),a.attribute=c,a;}}function g(a,b){b=b||{};"undefined"===typeof a.name&&a.id&&a.id in r.oids&&(a.name=r.oids[a.id]);if("undefined"===typeof a.id)if(a.name&&a.name in r.oids)a.id=r.oids[a.name];else{var d=Error("Extension ID not specified.");d.extension=a;throw d;}if("undefined"!==typeof a.value)return a;if("keyUsage"===a.name){var e=d=0,k=0;a.digitalSignature&&(e|=128,d=7);a.nonRepudiation&&(e|=64,d=6);a.keyEncipherment&&(e|=32,d=5);a.dataEncipherment&&
|
|
(e|=16,d=4);a.keyAgreement&&(e|=8,d=3);a.keyCertSign&&(e|=4,d=2);a.cRLSign&&(e|=2,d=1);a.encipherOnly&&(e|=1,d=0);a.decipherOnly&&(k|=128,d=7);d=String.fromCharCode(d);0!==k?d+=String.fromCharCode(e)+String.fromCharCode(k):0!==e&&(d+=String.fromCharCode(e));a.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,d)}else if("basicConstraints"===a.name)a.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),a.cA&&a.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,String.fromCharCode(255))),
|
|
"pathLenConstraint"in a&&a.value.value.push(h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(a.pathLenConstraint).getBytes()));else if("extKeyUsage"===a.name)for(e in a.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),d=a.value.value,a)!0===a[e]&&(e in p?d.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(p[e]).getBytes())):-1!==e.indexOf(".")&&d.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e).getBytes())));else if("nsCertType"===a.name)e=d=0,a.client&&(e|=128,
|
|
d=7),a.server&&(e|=64,d=6),a.email&&(e|=32,d=5),a.objsign&&(e|=16,d=4),a.reserved&&(e|=8,d=3),a.sslCA&&(e|=4,d=2),a.emailCA&&(e|=2,d=1),a.objCA&&(e|=1,d=0),d=String.fromCharCode(d),0!==e&&(d+=String.fromCharCode(e)),a.value=h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,d);else if("subjectAltName"===a.name||"issuerAltName"===a.name)for(a.value=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]),k=0;k<a.altNames.length;++k){e=a.altNames[k];d=e.value;if(7===e.type&&e.ip){if(d=c.util.bytesFromIP(e.ip),
|
|
null===d)throw d=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.'),d.extension=a,d;}else 8===e.type&&(d=e.oid?h.oidToDer(h.oidToDer(e.oid)):h.oidToDer(d));a.value.value.push(h.create(h.Class.CONTEXT_SPECIFIC,e.type,!1,d))}else"subjectKeyIdentifier"===a.name&&b.cert&&(d=b.cert.generateSubjectKeyIdentifier(),a.subjectKeyIdentifier=d.toHex(),a.value=h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,d.getBytes()));if("undefined"===typeof a.value)throw d=Error("Extension value not specified."),
|
|
d.extension=a,d;return a}function n(a,c){switch(a){case p["RSASSA-PSS"]:var b=[];void 0!==c.hash.algorithmOid&&b.push(h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(c.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])]));void 0!==c.mgf.algorithmOid&&b.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,
|
|
!1,h.oidToDer(c.mgf.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(c.mgf.hash.algorithmOid).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")])])]));void 0!==c.saltLength&&b.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(c.saltLength).getBytes())]));return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,b);default:return h.create(h.Class.UNIVERSAL,h.Type.NULL,
|
|
!1,"")}}function k(a){var b=h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===a.attributes.length)return b;a=a.attributes;for(var d=0;d<a.length;++d){var e=a[d],k=e.value,g=h.Type.UTF8;"valueTagClass"in e&&(g=e.valueTagClass);g===h.Type.UTF8&&(k=c.util.encodeUtf8(k));var l=!1;"valueConstructed"in e&&(l=e.valueConstructed);e=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(e.type).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,
|
|
g,l,k)])]);b.value.push(e)}return b}var h=c.asn1,r=c.pki=c.pki||{},p=r.oids,u={};u.CN=p.commonName;u.commonName="CN";u.C=p.countryName;u.countryName="C";u.L=p.localityName;u.localityName="L";u.ST=p.stateOrProvinceName;u.stateOrProvinceName="ST";u.O=p.organizationName;u.organizationName="O";u.OU=p.organizationalUnitName;u.organizationalUnitName="OU";u.E=p.emailAddress;u.emailAddress="E";var y=c.pki.rsa.publicKeyValidator,z={name:"Certificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,
|
|
value:[{name:"Certificate.TBSCertificate",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,
|
|
capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,
|
|
constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},
|
|
{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:h.Class.UNIVERSAL,type:h.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:h.Class.UNIVERSAL,type:h.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},y,{name:"Certificate.TBSCertificate.issuerUniqueID",
|
|
tagClass:h.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,capture:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:h.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,capture:"certSubjectUniqueId"}]},
|
|
{name:"Certificate.TBSCertificate.extensions",tagClass:h.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},
|
|
{name:"Certificate.signatureValue",tagClass:h.Class.UNIVERSAL,type:h.Type.BITSTRING,constructed:!1,capture:"certSignature"}]},A={name:"rsapss",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,
|
|
type:h.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:h.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:h.Class.UNIVERSAL,type:h.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:h.Class.UNIVERSAL,
|
|
type:h.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:h.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:h.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",
|
|
tagClass:h.Class.UNIVERSAL,type:h.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},D={name:"CertificationRequest",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
|
|
tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},y,{name:"CertificationRequestInfo.attributes",tagClass:h.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
|
|
tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:h.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:h.Class.UNIVERSAL,
|
|
type:h.Type.BITSTRING,constructed:!1,capture:"csrSignature"}]};r.RDNAttributesAsArray=function(a,c){for(var b=[],d,e,k,m=0;m<a.value.length;++m){d=a.value[m];for(var g=0;g<d.value.length;++g)k={},e=d.value[g],k.type=h.derToOid(e.value[0].value),k.value=e.value[1].value,k.valueTagClass=e.value[1].type,k.type in p&&(k.name=p[k.type],k.name in u&&(k.shortName=u[k.name])),c&&(c.update(k.type),c.update(k.value)),b.push(k)}return b};r.CRIAttributesAsArray=function(a){for(var c=[],b=0;b<a.length;++b)for(var d=
|
|
a[b],e=h.derToOid(d.value[0].value),d=d.value[1].value,k=0;k<d.length;++k){var m={};m.type=e;m.value=d[k].value;m.valueTagClass=d[k].type;m.type in p&&(m.name=p[m.type],m.name in u&&(m.shortName=u[m.name]));if(m.type===p.extensionRequest){m.extensions=[];for(var g=0;g<m.value.length;++g)m.extensions.push(r.certificateExtensionFromAsn1(m.value[g]))}c.push(m)}return c};var N=function(a,c,b){var d={};if(a!==p["RSASSA-PSS"])return d;b&&(d={hash:{algorithmOid:p.sha1},mgf:{algorithmOid:p.mgf1,hash:{algorithmOid:p.sha1}},
|
|
saltLength:20});b={};a=[];if(!h.validate(c,A,b,a))throw c=Error("Cannot read RSASSA-PSS parameter block."),c.errors=a,c;void 0!==b.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=h.derToOid(b.hashOid));void 0!==b.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=h.derToOid(b.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=h.derToOid(b.maskGenHashOid));void 0!==b.saltLength&&(d.saltLength=b.saltLength.charCodeAt(0));return d};r.certificateFromPem=function(a,b,d){a=c.pem.decode(a)[0];if("CERTIFICATE"!==
|
|
a.type&&"X509 CERTIFICATE"!==a.type&&"TRUSTED CERTIFICATE"!==a.type)throw b=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),b.headerType=a.type,b;if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");d=h.fromDer(a.body,d);return r.certificateFromAsn1(d,b)};r.certificateToPem=function(a,b){var d={type:"CERTIFICATE",body:h.toDer(r.certificateToAsn1(a)).getBytes()};
|
|
return c.pem.encode(d,{maxline:b})};r.publicKeyFromPem=function(a){a=c.pem.decode(a)[0];if("PUBLIC KEY"!==a.type&&"RSA PUBLIC KEY"!==a.type){var b=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');b.headerType=a.type;throw b;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");a=h.fromDer(a.body);return r.publicKeyFromAsn1(a)};r.publicKeyToPem=function(a,b){var d={type:"PUBLIC KEY",
|
|
body:h.toDer(r.publicKeyToAsn1(a)).getBytes()};return c.pem.encode(d,{maxline:b})};r.publicKeyToRSAPublicKeyPem=function(a,b){var d={type:"RSA PUBLIC KEY",body:h.toDer(r.publicKeyToRSAPublicKey(a)).getBytes()};return c.pem.encode(d,{maxline:b})};r.getPublicKeyFingerprint=function(a,b){b=b||{};var d=b.md||c.md.sha1.create(),e;switch(b.type||"RSAPublicKey"){case "RSAPublicKey":e=h.toDer(r.publicKeyToRSAPublicKey(a)).getBytes();break;case "SubjectPublicKeyInfo":e=h.toDer(r.publicKeyToAsn1(a)).getBytes();
|
|
break;default:throw Error('Unknown fingerprint type "'+b.type+'".');}d.start();d.update(e);d=d.digest();if("hex"===b.encoding)return d=d.toHex(),b.delimiter?d.match(/.{2}/g).join(b.delimiter):d;if("binary"===b.encoding)return d.getBytes();if(b.encoding)throw Error('Unknown encoding "'+b.encoding+'".');return d};r.certificationRequestFromPem=function(a,b,d){a=c.pem.decode(a)[0];if("CERTIFICATE REQUEST"!==a.type)throw b=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".'),
|
|
b.headerType=a.type,b;if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");d=h.fromDer(a.body,d);return r.certificationRequestFromAsn1(d,b)};r.certificationRequestToPem=function(a,b){var d={type:"CERTIFICATE REQUEST",body:h.toDer(r.certificationRequestToAsn1(a)).getBytes()};return c.pem.encode(d,{maxline:b})};r.createCertificate=function(){var a={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};a.siginfo.algorithmOid=
|
|
null;a.validity={};a.validity.notBefore=new Date;a.validity.notAfter=new Date;a.issuer={};a.issuer.getField=function(c){return b(a.issuer,c)};a.issuer.addField=function(c){e([c]);a.issuer.attributes.push(c)};a.issuer.attributes=[];a.issuer.hash=null;a.subject={};a.subject.getField=function(c){return b(a.subject,c)};a.subject.addField=function(c){e([c]);a.subject.attributes.push(c)};a.subject.attributes=[];a.subject.hash=null;a.extensions=[];a.publicKey=null;a.md=null;a.setSubject=function(c,b){e(c);
|
|
a.subject.attributes=c;delete a.subject.uniqueId;b&&(a.subject.uniqueId=b);a.subject.hash=null};a.setIssuer=function(c,b){e(c);a.issuer.attributes=c;delete a.issuer.uniqueId;b&&(a.issuer.uniqueId=b);a.issuer.hash=null};a.setExtensions=function(c){for(var b=0;b<c.length;++b)g(c[b],{cert:a});a.extensions=c};a.getExtension=function(c){"string"===typeof c&&(c={name:c});for(var b=null,d,e=0;null===b&&e<a.extensions.length;++e)d=a.extensions[e],c.id&&d.id===c.id?b=d:c.name&&d.name===c.name&&(b=d);return b};
|
|
a.sign=function(b,d){a.md=d||c.md.sha1.create();var e=p[a.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certificate digest. Unknown message digest algorithm OID."),e.algorithm=a.md.algorithm,e;a.signatureOid=a.siginfo.algorithmOid=e;a.tbsCertificate=r.getTBSCertificate(a);e=h.toDer(a.tbsCertificate);a.md.update(e.getBytes());a.signature=b.sign(a.md)};a.verify=function(b){var d=!1;if(!a.issued(b)){var d=a.subject,e=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
|
|
e.expectedIssuer=b.issuer.attributes;e.actualIssuer=d.attributes;throw e;}e=b.md;if(null===e){if(b.signatureOid in p)switch(p[b.signatureOid]){case "sha1WithRSAEncryption":e=c.md.sha1.create();break;case "md5WithRSAEncryption":e=c.md.md5.create();break;case "sha256WithRSAEncryption":e=c.md.sha256.create();break;case "sha512WithRSAEncryption":e=c.md.sha512.create();break;case "RSASSA-PSS":e=c.md.sha256.create()}if(null===e)throw e=Error("Could not compute certificate digest. Unknown signature OID."),
|
|
e.signatureOid=b.signatureOid,e;var k=b.tbsCertificate||r.getTBSCertificate(b),k=h.toDer(k);e.update(k.getBytes())}if(null!==e){var g;switch(b.signatureOid){case p.sha1WithRSAEncryption:g=void 0;break;case p["RSASSA-PSS"]:d=p[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===d||void 0===c.md[d])throw e=Error("Unsupported MGF hash function."),e.oid=b.signatureParameters.mgf.hash.algorithmOid,e.name=d,e;g=p[b.signatureParameters.mgf.algorithmOid];if(void 0===g||void 0===c.mgf[g])throw e=Error("Unsupported MGF function."),
|
|
e.oid=b.signatureParameters.mgf.algorithmOid,e.name=g,e;g=c.mgf[g].create(c.md[d].create());d=p[b.signatureParameters.hash.algorithmOid];if(void 0===d||void 0===c.md[d])throw{message:"Unsupported RSASSA-PSS hash function.",oid:b.signatureParameters.hash.algorithmOid,name:d};g=c.pss.create(c.md[d].create(),g,b.signatureParameters.saltLength)}d=a.publicKey.verify(e.digest().getBytes(),b.signature,g)}return d};a.isIssuer=function(c){var b=!1,d=a.issuer;c=c.subject;if(d.hash&&c.hash)b=d.hash===c.hash;
|
|
else if(d.attributes.length===c.attributes.length)for(var b=!0,e,h,k=0;b&&k<d.attributes.length;++k)if(e=d.attributes[k],h=c.attributes[k],e.type!==h.type||e.value!==h.value)b=!1;return b};a.issued=function(c){return c.isIssuer(a)};a.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(a.publicKey,{type:"RSAPublicKey"})};a.verifySubjectKeyIdentifier=function(){for(var b=p.subjectKeyIdentifier,d=0;d<a.extensions.length;++d){var e=a.extensions[d];if(e.id===b)return b=a.generateSubjectKeyIdentifier().getBytes(),
|
|
c.util.hexToBytes(e.subjectKeyIdentifier)===b}return!1};return a};r.certificateFromAsn1=function(a,d){var k={},g=[];if(!h.validate(a,z,k,g))throw k=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),k.errors=g,k;if("string"!==typeof k.certSignature){for(var g="\x00",n=0;n<k.certSignature.length;++n)g+=h.toDer(k.certSignature[n]).getBytes();k.certSignature=g}g=h.derToOid(k.publicKeyOid);if(g!==r.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");
|
|
var q=r.createCertificate();q.version=k.certVersion?k.certVersion.charCodeAt(0):0;g=c.util.createBuffer(k.certSerialNumber);q.serialNumber=g.toHex();q.signatureOid=c.asn1.derToOid(k.certSignatureOid);q.signatureParameters=N(q.signatureOid,k.certSignatureParams,!0);q.siginfo.algorithmOid=c.asn1.derToOid(k.certinfoSignatureOid);q.siginfo.parameters=N(q.siginfo.algorithmOid,k.certinfoSignatureParams,!1);g=c.util.createBuffer(k.certSignature);++g.read;q.signature=g.getBytes();g=[];void 0!==k.certValidity1UTCTime&&
|
|
g.push(h.utcTimeToDate(k.certValidity1UTCTime));void 0!==k.certValidity2GeneralizedTime&&g.push(h.generalizedTimeToDate(k.certValidity2GeneralizedTime));void 0!==k.certValidity3UTCTime&&g.push(h.utcTimeToDate(k.certValidity3UTCTime));void 0!==k.certValidity4GeneralizedTime&&g.push(h.generalizedTimeToDate(k.certValidity4GeneralizedTime));if(2<g.length)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(2>g.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");
|
|
q.validity.notBefore=g[0];q.validity.notAfter=g[1];q.tbsCertificate=k.tbsCertificate;if(d){q.md=null;if(q.signatureOid in p)switch(g=p[q.signatureOid],g){case "sha1WithRSAEncryption":q.md=c.md.sha1.create();break;case "md5WithRSAEncryption":q.md=c.md.md5.create();break;case "sha256WithRSAEncryption":q.md=c.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=c.md.sha512.create();break;case "RSASSA-PSS":q.md=c.md.sha256.create()}if(null===q.md)throw k=Error("Could not compute certificate digest. Unknown signature OID."),
|
|
k.signatureOid=q.signatureOid,k;g=h.toDer(q.tbsCertificate);q.md.update(g.getBytes())}g=c.md.sha1.create();q.issuer.getField=function(a){return b(q.issuer,a)};q.issuer.addField=function(a){e([a]);q.issuer.attributes.push(a)};q.issuer.attributes=r.RDNAttributesAsArray(k.certIssuer,g);k.certIssuerUniqueId&&(q.issuer.uniqueId=k.certIssuerUniqueId);q.issuer.hash=g.digest().toHex();g=c.md.sha1.create();q.subject.getField=function(a){return b(q.subject,a)};q.subject.addField=function(a){e([a]);q.subject.attributes.push(a)};
|
|
q.subject.attributes=r.RDNAttributesAsArray(k.certSubject,g);k.certSubjectUniqueId&&(q.subject.uniqueId=k.certSubjectUniqueId);q.subject.hash=g.digest().toHex();q.extensions=k.certExtensions?r.certificateExtensionsFromAsn1(k.certExtensions):[];q.publicKey=r.publicKeyFromAsn1(k.subjectPublicKeyInfo);return q};r.certificateExtensionsFromAsn1=function(a){for(var c=[],b=0;b<a.value.length;++b)for(var d=a.value[b],e=0;e<d.value.length;++e)c.push(r.certificateExtensionFromAsn1(d.value[e]));return c};r.certificateExtensionFromAsn1=
|
|
function(a){var b={};b.id=h.derToOid(a.value[0].value);b.critical=!1;a.value[1].type===h.Type.BOOLEAN?(b.critical=0!==a.value[1].value.charCodeAt(0),b.value=a.value[2].value):b.value=a.value[1].value;if(b.id in p)if(b.name=p[b.id],"keyUsage"===b.name){a=h.fromDer(b.value);var d=0,e=0;1<a.value.length&&(d=a.value.charCodeAt(1),e=2<a.value.length?a.value.charCodeAt(2):0);b.digitalSignature=128===(d&128);b.nonRepudiation=64===(d&64);b.keyEncipherment=32===(d&32);b.dataEncipherment=16===(d&16);b.keyAgreement=
|
|
8===(d&8);b.keyCertSign=4===(d&4);b.cRLSign=2===(d&2);b.encipherOnly=1===(d&1);b.decipherOnly=128===(e&128)}else if("basicConstraints"===b.name)a=h.fromDer(b.value),b.cA=0<a.value.length&&a.value[0].type===h.Type.BOOLEAN?0!==a.value[0].value.charCodeAt(0):!1,d=null,0<a.value.length&&a.value[0].type===h.Type.INTEGER?d=a.value[0].value:1<a.value.length&&(d=a.value[1].value),null!==d&&(b.pathLenConstraint=h.derToInteger(d));else if("extKeyUsage"===b.name)for(a=h.fromDer(b.value),d=0;d<a.value.length;++d)e=
|
|
h.derToOid(a.value[d].value),e in p?b[p[e]]=!0:b[e]=!0;else if("nsCertType"===b.name)a=h.fromDer(b.value),d=0,1<a.value.length&&(d=a.value.charCodeAt(1)),b.client=128===(d&128),b.server=64===(d&64),b.email=32===(d&32),b.objsign=16===(d&16),b.reserved=8===(d&8),b.sslCA=4===(d&4),b.emailCA=2===(d&2),b.objCA=1===(d&1);else if("subjectAltName"===b.name||"issuerAltName"===b.name)for(b.altNames=[],a=h.fromDer(b.value),e=0;e<a.value.length;++e){var d=a.value[e],k={type:d.type,value:d.value};b.altNames.push(k);
|
|
switch(d.type){case 7:k.ip=c.util.bytesToIP(d.value);break;case 8:k.oid=h.derToOid(d.value)}}else"subjectKeyIdentifier"===b.name&&(a=h.fromDer(b.value),b.subjectKeyIdentifier=c.util.bytesToHex(a.value));return b};r.certificationRequestFromAsn1=function(a,d){var k={},g=[];if(!h.validate(a,D,k,g))throw k=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),k.errors=g,k;if("string"!==typeof k.csrSignature){for(var g="\x00",n=0;n<k.csrSignature.length;++n)g+=
|
|
h.toDer(k.csrSignature[n]).getBytes();k.csrSignature=g}g=h.derToOid(k.publicKeyOid);if(g!==r.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var q=r.createCertificationRequest();q.version=k.csrVersion?k.csrVersion.charCodeAt(0):0;q.signatureOid=c.asn1.derToOid(k.csrSignatureOid);q.signatureParameters=N(q.signatureOid,k.csrSignatureParams,!0);q.siginfo.algorithmOid=c.asn1.derToOid(k.csrSignatureOid);q.siginfo.parameters=N(q.siginfo.algorithmOid,k.csrSignatureParams,!1);g=
|
|
c.util.createBuffer(k.csrSignature);++g.read;q.signature=g.getBytes();q.certificationRequestInfo=k.certificationRequestInfo;if(d){q.md=null;if(q.signatureOid in p)switch(g=p[q.signatureOid],g){case "sha1WithRSAEncryption":q.md=c.md.sha1.create();break;case "md5WithRSAEncryption":q.md=c.md.md5.create();break;case "sha256WithRSAEncryption":q.md=c.md.sha256.create();break;case "sha512WithRSAEncryption":q.md=c.md.sha512.create();break;case "RSASSA-PSS":q.md=c.md.sha256.create()}if(null===q.md)throw k=
|
|
Error("Could not compute certification request digest. Unknown signature OID."),k.signatureOid=q.signatureOid,k;g=h.toDer(q.certificationRequestInfo);q.md.update(g.getBytes())}g=c.md.sha1.create();q.subject.getField=function(a){return b(q.subject,a)};q.subject.addField=function(a){e([a]);q.subject.attributes.push(a)};q.subject.attributes=r.RDNAttributesAsArray(k.certificationRequestInfoSubject,g);q.subject.hash=g.digest().toHex();q.publicKey=r.publicKeyFromAsn1(k.subjectPublicKeyInfo);q.getAttribute=
|
|
function(a){return b(q,a)};q.addAttribute=function(a){e([a]);q.attributes.push(a)};q.attributes=r.CRIAttributesAsArray(k.certificationRequestInfoAttributes||[]);return q};r.createCertificationRequest=function(){var a={version:0,signatureOid:null,signature:null,siginfo:{}};a.siginfo.algorithmOid=null;a.subject={};a.subject.getField=function(c){return b(a.subject,c)};a.subject.addField=function(c){e([c]);a.subject.attributes.push(c)};a.subject.attributes=[];a.subject.hash=null;a.publicKey=null;a.attributes=
|
|
[];a.getAttribute=function(c){return b(a,c)};a.addAttribute=function(c){e([c]);a.attributes.push(c)};a.md=null;a.setSubject=function(c){e(c);a.subject.attributes=c;a.subject.hash=null};a.setAttributes=function(c){e(c);a.attributes=c};a.sign=function(b,d){a.md=d||c.md.sha1.create();var e=p[a.md.algorithm+"WithRSAEncryption"];if(!e)throw e=Error("Could not compute certification request digest. Unknown message digest algorithm OID."),e.algorithm=a.md.algorithm,e;a.signatureOid=a.siginfo.algorithmOid=
|
|
e;a.certificationRequestInfo=r.getCertificationRequestInfo(a);e=h.toDer(a.certificationRequestInfo);a.md.update(e.getBytes());a.signature=b.sign(a.md)};a.verify=function(){var b=!1,d=a.md;if(null===d){if(a.signatureOid in p)switch(p[a.signatureOid]){case "sha1WithRSAEncryption":d=c.md.sha1.create();break;case "md5WithRSAEncryption":d=c.md.md5.create();break;case "sha256WithRSAEncryption":d=c.md.sha256.create();break;case "sha512WithRSAEncryption":d=c.md.sha512.create();break;case "RSASSA-PSS":d=c.md.sha256.create()}if(null===
|
|
d)throw d=Error("Could not compute certification request digest. Unknown signature OID."),d.signatureOid=a.signatureOid,d;var e=a.certificationRequestInfo||r.getCertificationRequestInfo(a),e=h.toDer(e);d.update(e.getBytes())}if(null!==d){var k;switch(a.signatureOid){case p["RSASSA-PSS"]:b=p[a.signatureParameters.mgf.hash.algorithmOid];if(void 0===b||void 0===c.md[b])throw d=Error("Unsupported MGF hash function."),d.oid=a.signatureParameters.mgf.hash.algorithmOid,d.name=b,d;k=p[a.signatureParameters.mgf.algorithmOid];
|
|
if(void 0===k||void 0===c.mgf[k])throw d=Error("Unsupported MGF function."),d.oid=a.signatureParameters.mgf.algorithmOid,d.name=k,d;k=c.mgf[k].create(c.md[b].create());b=p[a.signatureParameters.hash.algorithmOid];if(void 0===b||void 0===c.md[b])throw d=Error("Unsupported RSASSA-PSS hash function."),d.oid=a.signatureParameters.hash.algorithmOid,d.name=b,d;k=c.pss.create(c.md[b].create(),k,a.signatureParameters.saltLength)}b=a.publicKey.verify(d.digest().getBytes(),a.signature,k)}return b};return a};
|
|
r.getTBSCertificate=function(a){var b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(a.version).getBytes())]),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,c.util.hexToBytes(a.serialNumber)),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.siginfo.algorithmOid).getBytes()),n(a.siginfo.algorithmOid,a.siginfo.parameters)]),d(a.issuer),h.create(h.Class.UNIVERSAL,
|
|
h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(a.validity.notBefore)),h.create(h.Class.UNIVERSAL,h.Type.UTCTIME,!1,h.dateToUtcTime(a.validity.notAfter))]),d(a.subject),r.publicKeyToAsn1(a.publicKey)]);a.issuer.uniqueId&&b.value.push(h.create(h.Class.CONTEXT_SPECIFIC,1,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+a.issuer.uniqueId)]));a.subject.uniqueId&&b.value.push(h.create(h.Class.CONTEXT_SPECIFIC,2,!0,[h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,
|
|
!1,String.fromCharCode(0)+a.subject.uniqueId)]));0<a.extensions.length&&b.value.push(r.certificateExtensionsToAsn1(a.extensions));return b};r.getCertificationRequestInfo=function(a){return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(a.version).getBytes()),d(a.subject),r.publicKeyToAsn1(a.publicKey),k(a)])};r.distinguishedNameToAsn1=function(a){return d(a)};r.certificateToAsn1=function(a){var c=a.tbsCertificate||r.getTBSCertificate(a);
|
|
return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[c,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.signatureOid).getBytes()),n(a.signatureOid,a.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};r.certificateExtensionsToAsn1=function(a){var c=h.create(h.Class.CONTEXT_SPECIFIC,3,!0,[]),b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);c.value.push(b);for(var d=0;d<a.length;++d)b.value.push(r.certificateExtensionToAsn1(a[d]));
|
|
return c};r.certificateExtensionToAsn1=function(a){var c=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[]);c.value.push(h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.id).getBytes()));a.critical&&c.value.push(h.create(h.Class.UNIVERSAL,h.Type.BOOLEAN,!1,String.fromCharCode(255)));var b=a.value;"string"!==typeof a.value&&(b=h.toDer(b).getBytes());c.value.push(h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,b));return c};r.certificationRequestToAsn1=function(a){var c=a.certificationRequestInfo||
|
|
r.getCertificationRequestInfo(a);return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[c,h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(a.signatureOid).getBytes()),n(a.signatureOid,a.signatureParameters)]),h.create(h.Class.UNIVERSAL,h.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};r.createCaStore=function(a){function b(a){if(!a.hash){var h=c.md.sha1.create();a.attributes=r.RDNAttributesAsArray(d(a),h);a.hash=h.digest().toHex()}return e.certs[a.hash]||
|
|
null}var e={certs:{},getIssuer:function(a){return b(a.issuer)},addCertificate:function(a){"string"===typeof a&&(a=c.pki.certificateFromPem(a));if(!a.subject.hash){var b=c.md.sha1.create();a.subject.attributes=r.RDNAttributesAsArray(d(a.subject),b);a.subject.hash=b.digest().toHex()}a.subject.hash in e.certs?(b=e.certs[a.subject.hash],c.util.isArray(b)||(b=[b]),b.push(a)):e.certs[a.subject.hash]=a},hasCertificate:function(a){var d=b(a.subject);if(!d)return!1;c.util.isArray(d)||(d=[d]);a=h.toDer(r.certificateToAsn1(a)).getBytes();
|
|
for(var e=0;e<d.length;++e){var k=h.toDer(r.certificateToAsn1(d[e])).getBytes();if(a===k)return!0}return!1}};if(a)for(var k=0;k<a.length;++k)e.addCertificate(a[k]);return e};r.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};
|
|
r.verifyCertificateChain=function(a,b,d){b=b.slice(0);var e=b.slice(0),h=new Date,k=!0,g=null,l=0;do{var p=b.shift(),n=null,v=!1;if(h<p.validity.notBefore||h>p.validity.notAfter)g={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:p.validity.notBefore,notAfter:p.validity.notAfter,now:h};if(null===g){n=b[0]||a.getIssuer(p);null===n&&p.isIssuer(p)&&(v=!0,n=p);if(n){var w=n;c.util.isArray(w)||(w=[w]);for(var u=!1;!u&&0<w.length;){n=w.shift();
|
|
try{u=n.verify(p)}catch(y){}}u||(g={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}null!==g||n&&!v||a.hasCertificate(p)||(g={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}null===g&&n&&!p.isIssuer(n)&&(g={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate});if(null===g)for(w={keyUsage:!0,basicConstraints:!0},u=0;null===g&&u<p.extensions.length;++u){var z=p.extensions[u];!z.critical||z.name in w||(g=
|
|
{message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}null!==g||k&&(0!==b.length||n&&!v)||(k=p.getExtension("basicConstraints"),p=p.getExtension("keyUsage"),null!==p&&(p.keyCertSign&&null!==k||(g={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:r.certificateError.bad_certificate})),
|
|
null!==g||null===k||k.cA||(g={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),null===g&&null!==p&&"pathLenConstraint"in k&&l-1>k.pathLenConstraint&&(g={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate}));p=null===g?!0:g.error;k=d?d(p,l,e):p;if(!0===k)g=null;else{!0===p&&(g={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate});
|
|
if(k||0===k)"object"!==typeof k||c.util.isArray(k)?"string"===typeof k&&(g.error=k):(k.message&&(g.message=k.message),k.error&&(g.error=k.error));throw g;}k=!1;++l}while(0<b.length);return!0}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.x509)return b.x509;
|
|
b.defined.x509=!0;for(var g=0;g<e.length;++g)e[g](b);return b.pki}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/x509","require module ./aes ./asn1 ./des ./md ./mgf ./oids ./pem ./pss ./rsa ./util".split(" "),function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,c,d,e){for(var h=
|
|
[],k=0;k<a.length;k++)for(var g=0;g<a[k].safeBags.length;g++){var m=a[k].safeBags[g];if(void 0===e||m.type===e)null===c?h.push(m):void 0!==m.attributes[c]&&0<=m.attributes[c].indexOf(d)&&h.push(m)}return h}function d(a){if(a.composed||a.constructed){for(var b=c.util.createBuffer(),e=0;e<a.value.length;++e)b.putBytes(a.value[e].value);a.composed=a.constructed=!1;a.value=b.getBytes()}return a}function e(a,b,e,l){b=k.fromDer(b,e);if(b.tagClass!==k.Class.UNIVERSAL||b.type!==k.Type.SEQUENCE||!0!==b.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");
|
|
for(var n=0;n<b.value.length;n++){var r={},u=[];if(!k.validate(b.value[n],p,r,u))throw a=Error("Cannot read ContentInfo."),a.errors=u,a;var u={encrypted:!1},q=null,q=r.content.value[0];switch(k.derToOid(r.contentType)){case h.oids.data:if(q.tagClass!==k.Class.UNIVERSAL||q.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");q=d(q).value;break;case h.oids.encryptedData:var y=l,r={},z=[];if(!k.validate(q,c.pkcs7.asn1.encryptedDataValidator,r,z))throw a=Error("Cannot read EncryptedContentInfo."),
|
|
a.errors=z,a;q=k.derToOid(r.contentType);if(q!==h.oids.data)throw a=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),a.oid=q,a;q=k.derToOid(r.encAlgorithm);q=h.pbe.getCipher(q,r.encParameter,y);r=d(r.encryptedContentAsn1);r=c.util.createBuffer(r.value);q.update(r);if(!q.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");q=q.output.getBytes();u.encrypted=!0;break;default:throw a=Error("Unsupported PKCS#12 contentType."),a.contentType=k.derToOid(r.contentType),a;}u.safeBags=
|
|
g(q,e,l);a.safeContents.push(u)}}function g(a,c,b){if(!c&&0===a.length)return[];a=k.fromDer(a,c);if(a.tagClass!==k.Class.UNIVERSAL||a.type!==k.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],e=0;e<a.value.length;e++){var m={},l=[];if(!k.validate(a.value[e],y,m,l))throw a=Error("Cannot read SafeBag."),a.errors=l,a;var p={type:k.derToOid(m.bagId),attributes:n(m.bagAttributes)};d.push(p);var v,w,r=m.bagValue.value[0];switch(p.type){case h.oids.pkcs8ShroudedKeyBag:if(r=
|
|
h.decryptPrivateKeyInfo(r,b),null===r)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case h.oids.keyBag:try{p.key=h.privateKeyFromAsn1(r)}catch(u){p.key=null,p.asn1=r}continue;case h.oids.certBag:v=A;w=function(){if(k.derToOid(m.certId)!==h.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=k.derToOid(m.certId);throw a;}a=k.fromDer(m.cert,c);try{p.cert=h.certificateFromAsn1(a,!0)}catch(b){p.cert=null,p.asn1=a}};break;default:throw a=
|
|
Error("Unsupported PKCS#12 SafeBag type."),a.oid=p.type,a;}if(void 0!==v&&!k.validate(r,v,m,l))throw a=Error("Cannot read PKCS#12 "+v.name),a.errors=l,a;w()}return d}function n(a){var c={};if(void 0!==a)for(var b=0;b<a.length;++b){var d={},e=[];if(!k.validate(a[b],z,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=k.derToOid(d.oid);if(void 0!==h.oids[e]){c[h.oids[e]]=[];for(var g=0;g<d.values.length;++g)c[h.oids[e]].push(d.values[g].value)}}return c}var k=c.asn1,h=c.pki,r=c.pkcs12=
|
|
c.pkcs12||{},p={name:"ContentInfo",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},u={name:"PFX",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,capture:"version"},
|
|
p,{name:"PFX.macData",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",
|
|
tagClass:k.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:k.Class.UNIVERSAL,type:k.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:k.Class.UNIVERSAL,type:k.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},y={name:"SafeBag",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,
|
|
value:[{name:"SafeBag.bagId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},z={name:"Attribute",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,
|
|
capture:"oid"},{name:"Attribute.attrValues",tagClass:k.Class.UNIVERSAL,type:k.Type.SET,constructed:!0,capture:"values"}]},A={name:"CertBag",tagClass:k.Class.UNIVERSAL,type:k.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:k.Class.UNIVERSAL,type:k.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:k.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:k.Class.UNIVERSAL,type:k.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};
|
|
r.pkcs12FromAsn1=function(a,g,p){"string"===typeof g?(p=g,g=!0):void 0===g&&(g=!0);var n={};if(!k.validate(a,u,n,[]))throw g=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),g.errors=g,g;var v={version:n.version.charCodeAt(0),safeContents:[],getBags:function(a){var d={},e;"localKeyId"in a?e=a.localKeyId:"localKeyIdHex"in a&&(e=c.util.hexToBytes(a.localKeyIdHex));void 0===e&&!("friendlyName"in a)&&"bagType"in a&&(d[a.bagType]=b(v.safeContents,null,null,a.bagType));void 0!==e&&
|
|
(d.localKeyId=b(v.safeContents,"localKeyId",e,a.bagType));"friendlyName"in a&&(d.friendlyName=b(v.safeContents,"friendlyName",a.friendlyName,a.bagType));return d},getBagsByFriendlyName:function(a,c){return b(v.safeContents,"friendlyName",a,c)},getBagsByLocalKeyId:function(a,c){return b(v.safeContents,"localKeyId",a,c)}};if(3!==n.version.charCodeAt(0))throw g=Error("PKCS#12 PFX of version other than 3 not supported."),g.version=n.version.charCodeAt(0),g;if(k.derToOid(n.contentType)!==h.oids.data)throw g=
|
|
Error("Only PKCS#12 PFX in password integrity mode supported."),g.oid=k.derToOid(n.contentType),g;a=n.content.value[0];if(a.tagClass!==k.Class.UNIVERSAL||a.type!==k.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");a=d(a);if(n.mac){var y=null,z=0,q=k.derToOid(n.macAlgorithm);switch(q){case h.oids.sha1:y=c.md.sha1.create();z=20;break;case h.oids.sha256:y=c.md.sha256.create();z=32;break;case h.oids.sha384:y=c.md.sha384.create();z=48;break;case h.oids.sha512:y=c.md.sha512.create();
|
|
z=64;break;case h.oids.md5:y=c.md.md5.create(),z=16}if(null===y)throw Error("PKCS#12 uses unsupported MAC algorithm: "+q);var q=new c.util.ByteBuffer(n.macSalt),A="macIterations"in n?parseInt(c.util.bytesToHex(n.macIterations),16):1,z=r.generateKey(p,q,3,A,z,y),q=c.hmac.create();q.start(y,z);q.update(a.value);if(q.getMac().getBytes()!==n.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}e(v,a.value,g,p);return v};r.toPkcs12Asn1=function(a,b,d,e){e=e||{};e.saltSize=e.saltSize||
|
|
8;e.count=e.count||2048;e.algorithm=e.algorithm||e.encAlgorithm||"aes128";"useMac"in e||(e.useMac=!0);"localKeyId"in e||(e.localKeyId=null);"generateLocalKeyId"in e||(e.generateLocalKeyId=!0);var g=e.localKeyId,l;if(null!==g)g=c.util.hexToBytes(g);else if(e.generateLocalKeyId)if(b){var p=c.util.isArray(b)?b[0]:b;"string"===typeof p&&(p=h.certificateFromPem(p));g=c.md.sha1.create();g.update(k.toDer(h.certificateToAsn1(p)).getBytes());g=g.digest().getBytes()}else g=c.random.getBytes(20);p=[];null!==
|
|
g&&p.push(k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.localKeyId).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,g)])]));"friendlyName"in e&&p.push(k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.friendlyName).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SET,!0,[k.create(k.Class.UNIVERSAL,k.Type.BMPSTRING,!1,e.friendlyName)])]));
|
|
0<p.length&&(l=k.create(k.Class.UNIVERSAL,k.Type.SET,!0,p));g=[];p=[];null!==b&&(p=c.util.isArray(b)?b:[b]);for(var n=[],v=0;v<p.length;++v){b=p[v];"string"===typeof b&&(b=h.certificateFromPem(b));var w=0===v?l:void 0;b=h.certificateToAsn1(b);b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.certBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.x509Certificate).getBytes()),
|
|
k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(b).getBytes())])])]),w]);n.push(b)}0<n.length&&(b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,n),b=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(b).getBytes())])]),g.push(b));b=null;null!==a&&(a=h.wrapRsaPrivateKey(h.privateKeyToAsn1(a)),
|
|
b=null===d?k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.keyBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[a]),l]):k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.pkcs8ShroudedKeyBag).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[h.encryptPrivateKeyInfo(a,d,e)]),l]),a=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[b]),a=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,
|
|
[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(a).getBytes())])]),g.push(a));l=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,g);var u;e.useMac&&(g=c.md.sha1.create(),u=new c.util.ByteBuffer(c.random.getBytes(e.saltSize)),e=e.count,a=r.generateKey(d,u,3,e,20),d=c.hmac.create(),d.start(g,a),d.update(k.toDer(l).getBytes()),d=d.getMac(),u=k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,
|
|
!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.sha1).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.NULL,!1,"")]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,d.getBytes())]),k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,u.getBytes()),k.create(k.Class.UNIVERSAL,k.Type.INTEGER,!1,k.integerToDer(e).getBytes())]));return k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,
|
|
k.Type.INTEGER,!1,k.integerToDer(3).getBytes()),k.create(k.Class.UNIVERSAL,k.Type.SEQUENCE,!0,[k.create(k.Class.UNIVERSAL,k.Type.OID,!1,k.oidToDer(h.oids.data).getBytes()),k.create(k.Class.CONTEXT_SPECIFIC,0,!0,[k.create(k.Class.UNIVERSAL,k.Type.OCTETSTRING,!1,k.toDer(l).getBytes())])]),u])};r.generateKey=c.pbe.generatePkcs12Key}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,
|
|
r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pkcs12)return b.pkcs12;b.defined.pkcs12=!0;for(var g=0;g<e.length;++g)e[g](b);return b.pkcs12}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/pkcs12","require module ./asn1 ./hmac ./oids ./pkcs7asn1 ./pbe ./random ./rsa ./sha1 ./util ./x509".split(" "),
|
|
function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var b=c.asn1,d=c.pki=c.pki||{};d.pemToDer=function(a){a=c.pem.decode(a)[0];if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert PEM to DER; PEM is encrypted.");return c.util.createBuffer(a.body)};d.privateKeyFromPem=function(a){a=c.pem.decode(a)[0];if("PRIVATE KEY"!==a.type&&"RSA PRIVATE KEY"!==a.type){var g=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
|
|
g.headerType=a.type;throw g;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert private key from PEM; PEM is encrypted.");a=b.fromDer(a.body);return d.privateKeyFromAsn1(a)};d.privateKeyToPem=function(a,g){var n={type:"RSA PRIVATE KEY",body:b.toDer(d.privateKeyToAsn1(a)).getBytes()};return c.pem.encode(n,{maxline:g})};d.privateKeyInfoToPem=function(a,d){var g={type:"PRIVATE KEY",body:b.toDer(a).getBytes()};return c.pem.encode(g,{maxline:d})}}if("function"!==typeof c)if("object"===
|
|
typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pki)return b.pki;b.defined.pki=!0;for(var g=0;g<e.length;++g)e[g](b);return b.pki}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,
|
|
Array.prototype.slice.call(arguments,0))};c("js/pki","require module ./asn1 ./oids ./pbe ./pem ./pbkdf2 ./pkcs12 ./pss ./rsa ./util ./x509".split(" "),function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var b=function(a,b,d,e){var h=c.util.createBuffer(),k=a.length>>1,g=k+(a.length&1),l=a.substr(0,g),g=a.substr(k,g);a=c.util.createBuffer();k=c.hmac.create();d=b+d;var p=Math.ceil(e/16);b=Math.ceil(e/20);k.start("MD5",l);l=c.util.createBuffer();a.putBytes(d);
|
|
for(var n=0;n<p;++n)k.start(null,null),k.update(a.getBytes()),a.putBuffer(k.digest()),k.start(null,null),k.update(a.bytes()+d),l.putBuffer(k.digest());k.start("SHA1",g);g=c.util.createBuffer();a.clear();a.putBytes(d);for(n=0;n<b;++n)k.start(null,null),k.update(a.getBytes()),a.putBuffer(k.digest()),k.start(null,null),k.update(a.bytes()+d),g.putBuffer(k.digest());h.putBytes(c.util.xorBytes(l.getBytes(),g.getBytes(),e));return h},d=function(a,b,d){d=!1;try{var e=a.deflate(b.fragment.getBytes());b.fragment=
|
|
c.util.createBuffer(e);b.length=e.length;d=!0}catch(h){}return d},e=function(a,b,d){d=!1;try{var e=a.inflate(b.fragment.getBytes());b.fragment=c.util.createBuffer(e);b.length=e.length;d=!0}catch(h){}return d},g=function(a,b){var d=0;switch(b){case 1:d=a.getByte();break;case 2:d=a.getInt16();break;case 3:d=a.getInt24();break;case 4:d=a.getInt32()}return c.util.createBuffer(a.getBytes(d))},n=function(a,c,b){a.putInt(b.length(),c<<3);a.putBuffer(b)},k={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,
|
|
minor:2},TLS_1_2:{major:3,minor:3}}};k.SupportedVersions=[k.Versions.TLS_1_1,k.Versions.TLS_1_0];k.Version=k.SupportedVersions[0];k.MaxFragment=15360;k.ConnectionEnd={server:0,client:1};k.PRFAlgorithm={tls_prf_sha256:0};k.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};k.CipherType={stream:0,block:1,aead:2};k.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};k.CompressionMethod={none:0,deflate:1};k.ContentType={change_cipher_spec:20,alert:21,handshake:22,
|
|
application_data:23,heartbeat:24};k.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};k.Alert={};k.Alert.Level={warning:1,fatal:2};k.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,
|
|
certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};k.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};k.CipherSuites={};k.getCipherSuite=function(a){var c=null,b;for(b in k.CipherSuites){var d=k.CipherSuites[b];if(d.id[0]===a.charCodeAt(0)&&d.id[1]===a.charCodeAt(1)){c=d;break}}return c};
|
|
k.handleUnexpected=function(a,c){(a.open||a.entity!==k.ConnectionEnd.client)&&a.error(a,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unexpected_message}})};k.handleHelloRequest=function(a,c,b){!a.handshaking&&0<a.handshakes&&(k.queue(a,k.createAlert(a,{level:k.Alert.Level.warning,description:k.Alert.Description.no_renegotiation})),k.flush(a));a.process()};k.parseHelloMessage=function(a,b,d){var e=null,h=a.entity===
|
|
k.ConnectionEnd.client;if(38>d)a.error(a,{message:h?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});else{b=b.fragment;var l=b.length(),e={version:{major:b.getByte(),minor:b.getByte()},random:c.util.createBuffer(b.getBytes(32)),session_id:g(b,1),extensions:[]};h?(e.cipher_suite=b.getBytes(2),e.compression_method=b.getByte()):(e.cipher_suites=g(b,2),e.compression_methods=
|
|
g(b,1));l=d-(l-b.length());if(0<l){for(d=g(b,2);0<d.length();)e.extensions.push({type:[d.getByte(),d.getByte()],data:g(d,2)});if(!h)for(d=0;d<e.extensions.length;++d)if(b=e.extensions[d],0===b.type[0]&&0===b.type[1])for(b=g(b.data,2);0<b.length()&&0===b.getByte();)a.session.extensions.server_name.serverNameList.push(g(b,2).getBytes())}if(a.session.version&&(e.version.major!==a.session.version.major||e.version.minor!==a.session.version.minor))return a.error(a,{message:"TLS version change is disallowed during renegotiation.",
|
|
send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.protocol_version}});if(h)a.session.cipherSuite=k.getCipherSuite(e.cipher_suite);else for(d=c.util.createBuffer(e.cipher_suites.bytes());0<d.length()&&(a.session.cipherSuite=k.getCipherSuite(d.getBytes(2)),null===a.session.cipherSuite););if(null===a.session.cipherSuite)return a.error(a,{message:"No cipher suites in common.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.handshake_failure},cipherSuite:c.util.bytesToHex(e.cipher_suite)});
|
|
a.session.compressionMethod=h?e.compression_method:k.CompressionMethod.none}return e};k.createSecurityParameters=function(a,c){var b=a.entity===k.ConnectionEnd.client,d=c.random.bytes(),e=b?a.session.sp.client_random:d,b=b?d:k.createRandom().getBytes();a.session.sp={entity:a.entity,prf_algorithm:k.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,
|
|
compression_algorithm:a.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:e,server_random:b}};k.handleServerHello=function(a,c,b){c=k.parseHelloMessage(a,c,b);if(!a.fail){if(c.version.minor<=a.version.minor)a.version.minor=c.version.minor;else return a.error(a,{message:"Incompatible TLS version.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.protocol_version}});a.session.version=a.version;b=c.session_id.bytes();0<b.length&&b===a.session.id?
|
|
(a.expect=y,a.session.resuming=!0,a.session.sp.server_random=c.random.bytes()):(a.expect=h,a.session.resuming=!1,k.createSecurityParameters(a,c));a.session.id=b;a.process()}};k.handleClientHello=function(a,b,d){b=k.parseHelloMessage(a,b,d);if(!a.fail){var e=b.session_id.bytes();d=null;if(a.sessionCache)if(d=a.sessionCache.getSession(e),null===d)e="";else if(d.version.major!==b.version.major||d.version.minor>b.version.minor)d=null,e="";0===e.length&&(e=c.random.getBytes(32));a.session.id=e;a.session.clientHelloVersion=
|
|
b.version;a.session.sp={};if(d)a.version=a.session.version=d.version,a.session.sp=d.sp;else{for(var h,e=1;e<k.SupportedVersions.length&&!(h=k.SupportedVersions[e],h.minor<=b.version.minor);++e);a.version={major:h.major,minor:h.minor};a.session.version=a.version}null!==d?(a.expect=B,a.session.resuming=!0,a.session.sp.client_random=b.random.bytes()):(a.expect=!1!==a.verifyClient?N:x,a.session.resuming=!1,k.createSecurityParameters(a,b));a.open=!0;k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,
|
|
data:k.createServerHello(a)}));a.session.resuming?(k.queue(a,k.createRecord(a,{type:k.ContentType.change_cipher_spec,data:k.createChangeCipherSpec()})),a.state.pending=k.createConnectionState(a),a.state.current.write=a.state.pending.write,k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createFinished(a)}))):(k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createCertificate(a)})),a.fail||(k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createServerKeyExchange(a)})),
|
|
!1!==a.verifyClient&&k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createCertificateRequest(a)})),k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createServerHelloDone(a)}))));k.flush(a);a.process()}};k.handleCertificate=function(a,b,d){if(3>d)return a.error(a,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});d=g(b.fragment,3);var e,h;b=[];try{for(;0<d.length();)e=
|
|
g(d,3),h=c.asn1.fromDer(e),e=c.pki.certificateFromAsn1(h,!0),b.push(e)}catch(l){return a.error(a,{message:"Could not parse certificate list.",cause:l,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}e=a.entity===k.ConnectionEnd.client;!e&&!0!==a.verifyClient||0!==b.length?0===b.length?a.expect=e?r:x:(e?a.session.serverCertificate=b[0]:a.session.clientCertificate=b[0],k.verifyCertificateChain(a,b)&&(a.expect=e?r:x)):a.error(a,{message:e?"No server certificate provided.":
|
|
"No client certificate provided.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});a.process()};k.handleServerKeyExchange=function(a,c,b){if(0<b)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unsupported_certificate}});a.expect=p;a.process()};k.handleClientKeyExchange=function(a,b,d){if(48>d)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",
|
|
send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unsupported_certificate}});b=g(b.fragment,2).getBytes();d=null;if(a.getPrivateKey)try{d=a.getPrivateKey(a,a.session.serverCertificate),d=c.pki.privateKeyFromPem(d)}catch(e){a.error(a,{message:"Could not get private key.",cause:e,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}})}if(null===d)return a.error(a,{message:"No private key set.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}});
|
|
try{var h=a.session.sp;h.pre_master_secret=d.decrypt(b);var l=a.session.clientHelloVersion;if(l.major!==h.pre_master_secret.charCodeAt(0)||l.minor!==h.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(e){h.pre_master_secret=c.random.getBytes(48)}a.expect=B;null!==a.session.clientCertificate&&(a.expect=G);a.process()};k.handleCertificateRequest=function(a,c,b){if(3>b)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,
|
|
description:k.Alert.Description.illegal_parameter}});c=c.fragment;c={certificate_types:g(c,1),certificate_authorities:g(c,2)};a.session.certificateRequest=c;a.expect=u;a.process()};k.handleCertificateVerify=function(a,b,d){if(2>d)return a.error(a,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});d=b.fragment;d.read-=4;b=d.bytes();d.read+=4;d=g(d,2).getBytes();var e=c.util.createBuffer();e.putBuffer(a.session.md5.digest());
|
|
e.putBuffer(a.session.sha1.digest());e=e.getBytes();try{if(!a.session.clientCertificate.publicKey.verify(e,d,"NONE"))throw Error("CertificateVerify signature does not match.");a.session.md5.update(b);a.session.sha1.update(b)}catch(h){return a.error(a,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.handshake_failure}})}a.expect=B;a.process()};k.handleServerHelloDone=function(a,b,d){if(0<d)return a.error(a,{message:"Invalid ServerHelloDone message. Invalid length.",
|
|
send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.record_overflow}});if(null===a.serverCertificate&&(b={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.insufficient_security}},d=a.verify(a,b.alert.description,0,[]),!0!==d)){if(d||0===d)"object"!==typeof d||c.util.isArray(d)?"number"===typeof d&&(b.alert.description=d):(d.message&&(b.message=d.message),d.alert&&(b.alert.description=d.alert));
|
|
return a.error(a,b)}null!==a.session.certificateRequest&&(b=k.createRecord(a,{type:k.ContentType.handshake,data:k.createCertificate(a)}),k.queue(a,b));b=k.createRecord(a,{type:k.ContentType.handshake,data:k.createClientKeyExchange(a)});k.queue(a,b);a.expect=D;b=function(a,c){null!==a.session.certificateRequest&&null!==a.session.clientCertificate&&k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createCertificateVerify(a,c)}));k.queue(a,k.createRecord(a,{type:k.ContentType.change_cipher_spec,
|
|
data:k.createChangeCipherSpec()}));a.state.pending=k.createConnectionState(a);a.state.current.write=a.state.pending.write;k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createFinished(a)}));a.expect=y;k.flush(a);a.process()};if(null===a.session.certificateRequest||null===a.session.clientCertificate)return b(a,null);k.getClientSignature(a,b)};k.handleChangeCipherSpec=function(a,c){if(1!==c.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,
|
|
alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.illegal_parameter}});var b=a.entity===k.ConnectionEnd.client;if(a.session.resuming&&b||!a.session.resuming&&!b)a.state.pending=k.createConnectionState(a);a.state.current.read=a.state.pending.read;if(!a.session.resuming&&b||a.session.resuming&&!b)a.state.pending=null;a.expect=b?z:H;a.process()};k.handleFinished=function(a,d,e){e=d.fragment;e.read-=4;var h=e.bytes();e.read+=4;d=d.fragment.getBytes();e=c.util.createBuffer();e.putBuffer(a.session.md5.digest());
|
|
e.putBuffer(a.session.sha1.digest());var g=a.entity===k.ConnectionEnd.client;e=b(a.session.sp.master_secret,g?"server finished":"client finished",e.getBytes(),12);if(e.getBytes()!==d)return a.error(a,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.decrypt_error}});a.session.md5.update(h);a.session.sha1.update(h);if(a.session.resuming&&g||!a.session.resuming&&!g)k.queue(a,k.createRecord(a,{type:k.ContentType.change_cipher_spec,
|
|
data:k.createChangeCipherSpec()})),a.state.current.write=a.state.pending.write,a.state.pending=null,k.queue(a,k.createRecord(a,{type:k.ContentType.handshake,data:k.createFinished(a)}));a.expect=g?A:aa;a.handshaking=!1;++a.handshakes;a.peerCertificate=g?a.session.serverCertificate:a.session.clientCertificate;k.flush(a);a.isConnected=!0;a.connected(a);a.process()};k.handleAlert=function(a,c){var b=c.fragment,b={level:b.getByte(),description:b.getByte()},d;switch(b.description){case k.Alert.Description.close_notify:d=
|
|
"Connection closed.";break;case k.Alert.Description.unexpected_message:d="Unexpected message.";break;case k.Alert.Description.bad_record_mac:d="Bad record MAC.";break;case k.Alert.Description.decryption_failed:d="Decryption failed.";break;case k.Alert.Description.record_overflow:d="Record overflow.";break;case k.Alert.Description.decompression_failure:d="Decompression failed.";break;case k.Alert.Description.handshake_failure:d="Handshake failure.";break;case k.Alert.Description.bad_certificate:d=
|
|
"Bad certificate.";break;case k.Alert.Description.unsupported_certificate:d="Unsupported certificate.";break;case k.Alert.Description.certificate_revoked:d="Certificate revoked.";break;case k.Alert.Description.certificate_expired:d="Certificate expired.";break;case k.Alert.Description.certificate_unknown:d="Certificate unknown.";break;case k.Alert.Description.illegal_parameter:d="Illegal parameter.";break;case k.Alert.Description.unknown_ca:d="Unknown certificate authority.";break;case k.Alert.Description.access_denied:d=
|
|
"Access denied.";break;case k.Alert.Description.decode_error:d="Decode error.";break;case k.Alert.Description.decrypt_error:d="Decrypt error.";break;case k.Alert.Description.export_restriction:d="Export restriction.";break;case k.Alert.Description.protocol_version:d="Unsupported protocol version.";break;case k.Alert.Description.insufficient_security:d="Insufficient security.";break;case k.Alert.Description.internal_error:d="Internal error.";break;case k.Alert.Description.user_canceled:d="User canceled.";
|
|
break;case k.Alert.Description.no_renegotiation:d="Renegotiation not supported.";break;default:d="Unknown error."}if(b.description===k.Alert.Description.close_notify)return a.close();a.error(a,{message:d,send:!1,origin:a.entity===k.ConnectionEnd.client?"server":"client",alert:b});a.process()};k.handleHandshake=function(a,b){var d=b.fragment,e=d.getByte(),h=d.getInt24();if(h>d.length())return a.fragmented=b,b.fragment=c.util.createBuffer(),d.read-=4,a.process();a.fragmented=null;d.read-=4;var g=d.bytes(h+
|
|
4);d.read+=4;e in V[a.entity][a.expect]?(a.entity!==k.ConnectionEnd.server||a.open||a.fail||(a.handshaking=!0,a.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:c.md.md5.create(),sha1:c.md.sha1.create()}),e!==k.HandshakeType.hello_request&&e!==k.HandshakeType.certificate_verify&&e!==k.HandshakeType.finished&&(a.session.md5.update(g),a.session.sha1.update(g)),V[a.entity][a.expect][e](a,b,h)):
|
|
k.handleUnexpected(a,b)};k.handleApplicationData=function(a,c){a.data.putBuffer(c.fragment);a.dataReady(a);a.process()};k.handleHeartbeat=function(a,b){var d=b.fragment,e=d.getByte(),h=d.getInt16(),d=d.getBytes(h);if(e===k.HeartbeatMessageType.heartbeat_request){if(a.handshaking||h>d.length)return a.process();k.queue(a,k.createRecord(a,{type:k.ContentType.heartbeat,data:k.createHeartbeat(k.HeartbeatMessageType.heartbeat_response,d)}));k.flush(a)}else if(e===k.HeartbeatMessageType.heartbeat_response){if(d!==
|
|
a.expectedHeartbeatPayload)return a.process();a.heartbeatReceived&&a.heartbeatReceived(a,c.util.createBuffer(d))}a.process()};var h=1,r=2,p=3,u=4,y=5,z=6,A=7,D=8,N=1,x=2,G=3,B=4,H=5,aa=6,q=k.handleUnexpected,P=k.handleChangeCipherSpec,M=k.handleAlert,K=k.handleHandshake,S=k.handleApplicationData,L=k.handleHeartbeat,R=[];R[k.ConnectionEnd.client]=[[q,M,K,q,L],[q,M,K,q,L],[q,M,K,q,L],[q,M,K,q,L],[q,M,K,q,L],[P,M,q,q,L],[q,M,K,q,L],[q,M,K,S,L],[q,M,K,q,L]];R[k.ConnectionEnd.server]=[[q,M,K,q,L],[q,M,
|
|
K,q,L],[q,M,K,q,L],[q,M,K,q,L],[P,M,q,q,L],[q,M,K,q,L],[q,M,K,S,L],[q,M,K,q,L]];var P=k.handleHelloRequest,M=k.handleCertificate,K=k.handleServerKeyExchange,S=k.handleCertificateRequest,L=k.handleServerHelloDone,W=k.handleFinished,V=[];V[k.ConnectionEnd.client]=[[q,q,k.handleServerHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[P,q,q,q,q,q,q,q,q,q,q,M,K,S,L,q,q,q,q,q,q],[P,q,q,q,q,q,q,q,q,q,q,q,K,S,L,q,q,q,q,q,q],[P,q,q,q,q,q,q,q,q,q,q,q,q,S,L,q,q,q,q,q,q],[P,q,q,q,q,q,q,q,q,q,q,q,q,q,L,q,q,q,q,q,q],
|
|
[P,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[P,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,W],[P,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[P,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];V[k.ConnectionEnd.server]=[[q,k.handleClientHello,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,M,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,k.handleClientKeyExchange,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,k.handleCertificateVerify,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,
|
|
q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,W],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q],[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q]];k.generateKeys=function(a,c){var d=c.client_random+c.server_random;a.session.resuming||(c.master_secret=b(c.pre_master_secret,"master secret",d,48).bytes(),c.pre_master_secret=null);var d=c.server_random+c.client_random,e=2*c.mac_key_length+2*c.enc_key_length,h=a.version.major===k.Versions.TLS_1_0.major&&a.version.minor===k.Versions.TLS_1_0.minor;h&&(e+=2*c.fixed_iv_length);d=
|
|
b(c.master_secret,"key expansion",d,e);e={client_write_MAC_key:d.getBytes(c.mac_key_length),server_write_MAC_key:d.getBytes(c.mac_key_length),client_write_key:d.getBytes(c.enc_key_length),server_write_key:d.getBytes(c.enc_key_length)};h&&(e.client_write_IV=d.getBytes(c.fixed_iv_length),e.server_write_IV=d.getBytes(c.fixed_iv_length));return e};k.createConnectionState=function(a){var c=a.entity===k.ConnectionEnd.client,b=function(){var a={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,
|
|
cipherState:null,cipherFunction:function(a){return!0},compressionState:null,compressFunction:function(a){return!0},updateSequenceNumber:function(){4294967295===a.sequenceNumber[1]?(a.sequenceNumber[1]=0,++a.sequenceNumber[0]):++a.sequenceNumber[1]}};return a},h={read:b(),write:b()};h.read.update=function(a,c){h.read.cipherFunction(c,h.read)?h.read.compressFunction(a,c,h.read)||a.error(a,{message:"Could not decompress record.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.decompression_failure}}):
|
|
a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_record_mac}});return!a.fail};h.write.update=function(a,c){h.write.compressFunction(a,c,h.write)?h.write.cipherFunction(c,h.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}});
|
|
return!a.fail};if(a.session)switch(b=a.session.sp,a.session.cipherSuite.initSecurityParameters(b),b.keys=k.generateKeys(a,b),h.read.macKey=c?b.keys.server_write_MAC_key:b.keys.client_write_MAC_key,h.write.macKey=c?b.keys.client_write_MAC_key:b.keys.server_write_MAC_key,a.session.cipherSuite.initConnectionState(h,a,b),b.compression_algorithm){case k.CompressionMethod.none:break;case k.CompressionMethod.deflate:h.read.compressFunction=e;h.write.compressFunction=d;break;default:throw Error("Unsupported compression algorithm.");
|
|
}return h};k.createRandom=function(){var a=new Date,a=+a+6E4*a.getTimezoneOffset(),b=c.util.createBuffer();b.putInt32(a);b.putBytes(c.random.getBytes(28));return b};k.createRecord=function(a,c){return c.data?{type:c.type,version:{major:a.version.major,minor:a.version.minor},length:c.data.length(),fragment:c.data}:null};k.createAlert=function(a,b){var d=c.util.createBuffer();d.putByte(b.level);d.putByte(b.description);return k.createRecord(a,{type:k.ContentType.alert,data:d})};k.createClientHello=
|
|
function(a){a.session.clientHelloVersion={major:a.version.major,minor:a.version.minor};for(var b=c.util.createBuffer(),d=0;d<a.cipherSuites.length;++d){var e=a.cipherSuites[d];b.putByte(e.id[0]);b.putByte(e.id[1])}var h=b.length(),d=c.util.createBuffer();d.putByte(k.CompressionMethod.none);var g=d.length(),e=c.util.createBuffer();if(a.virtualHost){var l=c.util.createBuffer();l.putByte(0);l.putByte(0);var p=c.util.createBuffer();p.putByte(0);n(p,2,c.util.createBuffer(a.virtualHost));var q=c.util.createBuffer();
|
|
n(q,2,p);n(l,2,q);e.putBuffer(l)}l=e.length();0<l&&(l+=2);p=a.session.id;h=p.length+1+2+4+28+2+h+1+g+l;g=c.util.createBuffer();g.putByte(k.HandshakeType.client_hello);g.putInt24(h);g.putByte(a.version.major);g.putByte(a.version.minor);g.putBytes(a.session.sp.client_random);n(g,1,c.util.createBuffer(p));n(g,2,b);n(g,1,d);0<l&&n(g,2,e);return g};k.createServerHello=function(a){var b=a.session.id,d=b.length+1+2+4+28+2+1,e=c.util.createBuffer();e.putByte(k.HandshakeType.server_hello);e.putInt24(d);e.putByte(a.version.major);
|
|
e.putByte(a.version.minor);e.putBytes(a.session.sp.server_random);n(e,1,c.util.createBuffer(b));e.putByte(a.session.cipherSuite.id[0]);e.putByte(a.session.cipherSuite.id[1]);e.putByte(a.session.compressionMethod);return e};k.createCertificate=function(a){var b=a.entity===k.ConnectionEnd.client,d=null;a.getCertificate&&(d=a.getCertificate(a,b?a.session.certificateRequest:a.session.extensions.server_name.serverNameList));var e=c.util.createBuffer();if(null!==d)try{c.util.isArray(d)||(d=[d]);for(var h=
|
|
null,g=0;g<d.length;++g){var l=c.pem.decode(d[g])[0];if("CERTIFICATE"!==l.type&&"X509 CERTIFICATE"!==l.type&&"TRUSTED CERTIFICATE"!==l.type){var p=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');p.headerType=l.type;throw p;}if(l.procType&&"ENCRYPTED"===l.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var q=c.util.createBuffer(l.body);null===h&&(h=c.asn1.fromDer(q.bytes(),!1));
|
|
var r=c.util.createBuffer();n(r,3,q);e.putBuffer(r)}d=c.pki.certificateFromAsn1(h);b?a.session.clientCertificate=d:a.session.serverCertificate=d}catch(v){return a.error(a,{message:"Could not send certificate list.",cause:v,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate}})}a=3+e.length();b=c.util.createBuffer();b.putByte(k.HandshakeType.certificate);b.putInt24(a);n(b,3,e);return b};k.createClientKeyExchange=function(a){var b=c.util.createBuffer();b.putByte(a.session.clientHelloVersion.major);
|
|
b.putByte(a.session.clientHelloVersion.minor);b.putBytes(c.random.getBytes(46));var d=a.session.sp;d.pre_master_secret=b.getBytes();b=a.session.serverCertificate.publicKey.encrypt(d.pre_master_secret);a=b.length+2;d=c.util.createBuffer();d.putByte(k.HandshakeType.client_key_exchange);d.putInt24(a);d.putInt16(b.length);d.putBytes(b);return d};k.createServerKeyExchange=function(a){return c.util.createBuffer()};k.getClientSignature=function(a,b){var d=c.util.createBuffer();d.putBuffer(a.session.md5.digest());
|
|
d.putBuffer(a.session.sha1.digest());d=d.getBytes();a.getSignature=a.getSignature||function(a,b,d){var e=null;if(a.getPrivateKey)try{e=a.getPrivateKey(a,a.session.clientCertificate),e=c.pki.privateKeyFromPem(e)}catch(h){a.error(a,{message:"Could not get private key.",cause:h,send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}})}null===e?a.error(a,{message:"No private key set.",send:!0,alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.internal_error}}):
|
|
b=e.sign(b,null);d(a,b)};a.getSignature(a,d,b)};k.createCertificateVerify=function(a,b){var d=b.length+2,e=c.util.createBuffer();e.putByte(k.HandshakeType.certificate_verify);e.putInt24(d);e.putInt16(b.length);e.putBytes(b);return e};k.createCertificateRequest=function(a){var b=c.util.createBuffer();b.putByte(1);var d=c.util.createBuffer(),e;for(e in a.caStore.certs){var h=c.pki.distinguishedNameToAsn1(a.caStore.certs[e].subject);d.putBuffer(c.asn1.toDer(h))}a=1+b.length()+2+d.length();e=c.util.createBuffer();
|
|
e.putByte(k.HandshakeType.certificate_request);e.putInt24(a);n(e,1,b);n(e,2,d);return e};k.createServerHelloDone=function(a){a=c.util.createBuffer();a.putByte(k.HandshakeType.server_hello_done);a.putInt24(0);return a};k.createChangeCipherSpec=function(){var a=c.util.createBuffer();a.putByte(1);return a};k.createFinished=function(a){var d=c.util.createBuffer();d.putBuffer(a.session.md5.digest());d.putBuffer(a.session.sha1.digest());d=b(a.session.sp.master_secret,a.entity===k.ConnectionEnd.client?"client finished":
|
|
"server finished",d.getBytes(),12);a=c.util.createBuffer();a.putByte(k.HandshakeType.finished);a.putInt24(d.length());a.putBuffer(d);return a};k.createHeartbeat=function(a,b,d){"undefined"===typeof d&&(d=b.length);var e=c.util.createBuffer();e.putByte(a);e.putInt16(d);e.putBytes(b);a=e.length();e.putBytes(c.random.getBytes(Math.max(16,a-d-3)));return e};k.queue=function(a,b){if(b){if(b.type===k.ContentType.handshake){var d=b.fragment.bytes();a.session.md5.update(d);a.session.sha1.update(d)}if(b.fragment.length()<=
|
|
k.MaxFragment)d=[b];else{for(var d=[],e=b.fragment.bytes();e.length>k.MaxFragment;)d.push(k.createRecord(a,{type:b.type,data:c.util.createBuffer(e.slice(0,k.MaxFragment))})),e=e.slice(k.MaxFragment);0<e.length&&d.push(k.createRecord(a,{type:b.type,data:c.util.createBuffer(e)}))}for(e=0;e<d.length&&!a.fail;++e){var h=d[e];a.state.current.write.update(a,h)&&a.records.push(h)}}};k.flush=function(a){for(var c=0;c<a.records.length;++c){var b=a.records[c];a.tlsData.putByte(b.type);a.tlsData.putByte(b.version.major);
|
|
a.tlsData.putByte(b.version.minor);a.tlsData.putInt16(b.fragment.length());a.tlsData.putBuffer(a.records[c].fragment)}a.records=[];return a.tlsDataReady(a)};var U=function(a){switch(a){case !0:return!0;case c.pki.certificateError.bad_certificate:return k.Alert.Description.bad_certificate;case c.pki.certificateError.unsupported_certificate:return k.Alert.Description.unsupported_certificate;case c.pki.certificateError.certificate_revoked:return k.Alert.Description.certificate_revoked;case c.pki.certificateError.certificate_expired:return k.Alert.Description.certificate_expired;
|
|
case c.pki.certificateError.certificate_unknown:return k.Alert.Description.certificate_unknown;case c.pki.certificateError.unknown_ca:return k.Alert.Description.unknown_ca;default:return k.Alert.Description.bad_certificate}},X=function(a){switch(a){case !0:return!0;case k.Alert.Description.bad_certificate:return c.pki.certificateError.bad_certificate;case k.Alert.Description.unsupported_certificate:return c.pki.certificateError.unsupported_certificate;case k.Alert.Description.certificate_revoked:return c.pki.certificateError.certificate_revoked;
|
|
case k.Alert.Description.certificate_expired:return c.pki.certificateError.certificate_expired;case k.Alert.Description.certificate_unknown:return c.pki.certificateError.certificate_unknown;case k.Alert.Description.unknown_ca:return c.pki.certificateError.unknown_ca;default:return c.pki.certificateError.bad_certificate}};k.verifyCertificateChain=function(a,b){try{c.pki.verifyCertificateChain(a.caStore,b,function(b,d,e){U(b);d=a.verify(a,b,d,e);if(!0!==d){if("object"===typeof d&&!c.util.isArray(d))throw b=
|
|
Error("The application rejected the certificate."),b.send=!0,b.alert={level:k.Alert.Level.fatal,description:k.Alert.Description.bad_certificate},d.message&&(b.message=d.message),d.alert&&(b.alert.description=d.alert),b;d!==b&&(d=X(d))}return d})}catch(d){var e=d;if("object"!==typeof e||c.util.isArray(e))e={send:!0,alert:{level:k.Alert.Level.fatal,description:U(d)}};"send"in e||(e.send=!0);"alert"in e||(e.alert={level:k.Alert.Level.fatal,description:U(e.error)});a.error(a,e)}return!a.fail};k.createSessionCache=
|
|
function(a,b){var d=null;if(a&&a.getSession&&a.setSession&&a.order)d=a;else{d={};d.cache=a||{};d.capacity=Math.max(b||100,1);d.order=[];for(var e in a)d.order.length<=b?d.order.push(e):delete a[e];d.getSession=function(a){var b=null,e=null;a?e=c.util.bytesToHex(a):0<d.order.length&&(e=d.order[0]);if(null!==e&&e in d.cache){b=d.cache[e];delete d.cache[e];for(var h in d.order)if(d.order[h]===e){d.order.splice(h,1);break}}return b};d.setSession=function(a,b){if(d.order.length===d.capacity){var e=d.order.shift();
|
|
delete d.cache[e]}e=c.util.bytesToHex(a);d.order.push(e);d.cache[e]=b}}return d};k.createConnection=function(a){var b=null,b=a.caStore?c.util.isArray(a.caStore)?c.pki.createCaStore(a.caStore):a.caStore:c.pki.createCaStore(),d=a.cipherSuites||null;if(null===d){var d=[],e;for(e in k.CipherSuites)d.push(k.CipherSuites[e])}e=a.server?k.ConnectionEnd.server:k.ConnectionEnd.client;var h=a.sessionCache?k.createSessionCache(a.sessionCache):null,g={version:{major:k.Version.major,minor:k.Version.minor},entity:e,
|
|
sessionId:a.sessionId,caStore:b,sessionCache:h,cipherSuites:d,connected:a.connected,virtualHost:a.virtualHost||null,verifyClient:a.verifyClient||!1,verify:a.verify||function(a,c,b,d){return c},getCertificate:a.getCertificate||null,getPrivateKey:a.getPrivateKey||null,getSignature:a.getSignature||null,input:c.util.createBuffer(),tlsData:c.util.createBuffer(),data:c.util.createBuffer(),tlsDataReady:a.tlsDataReady,dataReady:a.dataReady,heartbeatReceived:a.heartbeatReceived,closed:a.closed,error:function(c,
|
|
b){b.origin=b.origin||(c.entity===k.ConnectionEnd.client?"client":"server");b.send&&(k.queue(c,k.createAlert(c,b.alert)),k.flush(c));var d=!1!==b.fatal;d&&(c.fail=!0);a.error(c,b);d&&c.close(!1)},deflate:a.deflate||null,inflate:a.inflate||null,reset:function(a){g.version={major:k.Version.major,minor:k.Version.minor};g.record=null;g.session=null;g.peerCertificate=null;g.state={pending:null,current:null};g.expect=0;g.fragmented=null;g.records=[];g.open=!1;g.handshakes=0;g.handshaking=!1;g.isConnected=
|
|
!1;g.fail=!(a||"undefined"===typeof a);g.input.clear();g.tlsData.clear();g.data.clear();g.state.current=k.createConnectionState(g)}};g.reset();g.handshake=function(a){if(g.entity!==k.ConnectionEnd.client)g.error(g,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(g.handshaking)g.error(g,{message:"Handshake already in progress.",fatal:!1});else{g.fail&&!g.open&&0===g.handshakes&&(g.fail=!1);g.handshaking=!0;a=a||"";var b=null;0<a.length&&(g.sessionCache&&(b=g.sessionCache.getSession(a)),
|
|
null===b&&(a=""));0===a.length&&g.sessionCache&&(b=g.sessionCache.getSession(),null!==b&&(a=b.id));g.session={id:a,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:c.md.md5.create(),sha1:c.md.sha1.create()};b&&(g.version=b.version,g.session.sp=b.sp);g.session.sp.client_random=k.createRandom().getBytes();g.open=!0;k.queue(g,k.createRecord(g,{type:k.ContentType.handshake,data:k.createClientHello(g)}));k.flush(g)}};g.process=
|
|
function(a){var b=0;a&&g.input.putBytes(a);if(!g.fail){null!==g.record&&g.record.ready&&g.record.fragment.isEmpty()&&(g.record=null);if(null===g.record){b=0;a=g.input;var d=a.length();5>d?b=5-d:(g.record={type:a.getByte(),version:{major:a.getByte(),minor:a.getByte()},length:a.getInt16(),fragment:c.util.createBuffer(),ready:!1},(a=g.record.version.major===g.version.major)&&g.session&&g.session.version&&(a=g.record.version.minor===g.version.minor),a||g.error(g,{message:"Incompatible TLS version.",send:!0,
|
|
alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.protocol_version}}))}if(!g.fail&&null!==g.record&&!g.record.ready){b=g;a=0;var d=b.input,e=d.length();e<b.record.length?a=b.record.length-e:(b.record.fragment.putBytes(d.getBytes(b.record.length)),d.compact(),b.state.current.read.update(b,b.record)&&(null!==b.fragmented&&(b.fragmented.type===b.record.type?(b.fragmented.fragment.putBuffer(b.record.fragment),b.record=b.fragmented):b.error(b,{message:"Invalid fragmented record.",send:!0,
|
|
alert:{level:k.Alert.Level.fatal,description:k.Alert.Description.unexpected_message}})),b.record.ready=!0));b=a}if(!g.fail&&null!==g.record&&g.record.ready)if(a=g.record,d=a.type-k.ContentType.change_cipher_spec,e=R[g.entity][g.expect],d in e)e[d](g,a);else k.handleUnexpected(g,a)}return b};g.prepare=function(a){k.queue(g,k.createRecord(g,{type:k.ContentType.application_data,data:c.util.createBuffer(a)}));return k.flush(g)};g.prepareHeartbeatRequest=function(a,b){a instanceof c.util.ByteBuffer&&(a=
|
|
a.bytes());"undefined"===typeof b&&(b=a.length);g.expectedHeartbeatPayload=a;k.queue(g,k.createRecord(g,{type:k.ContentType.heartbeat,data:k.createHeartbeat(k.HeartbeatMessageType.heartbeat_request,a,b)}));return k.flush(g)};g.close=function(a){if(!g.fail&&g.sessionCache&&g.session){var c={id:g.session.id,version:g.session.version,sp:g.session.sp};c.sp.keys=null;g.sessionCache.setSession(c.id,c)}if(g.open){g.open=!1;g.input.clear();if(g.isConnected||g.handshaking)g.isConnected=g.handshaking=!1,k.queue(g,
|
|
k.createAlert(g,{level:k.Alert.Level.warning,description:k.Alert.Description.close_notify})),k.flush(g);g.closed(g)}g.reset(a)};return g};c.tls=c.tls||{};for(var T in k)"function"!==typeof k[T]&&(c.tls[T]=k[T]);c.tls.prf_tls1=b;c.tls.hmac_sha1=function(a,b,d){var e=c.hmac.create();e.start("SHA1",a);a=c.util.createBuffer();a.putInt32(b[0]);a.putInt32(b[1]);a.putByte(d.type);a.putByte(d.version.major);a.putByte(d.version.minor);a.putInt16(d.length);a.putBytes(d.fragment.bytes());e.update(a.getBytes());
|
|
return e.digest().getBytes()};c.tls.createSessionCache=k.createSessionCache;c.tls.createConnection=k.createConnection}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.tls)return b.tls;b.defined.tls=!0;for(var g=0;g<e.length;++g)e[g](b);return b.tls}},
|
|
u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/tls","require module ./asn1 ./hmac ./md ./pem ./pki ./random ./util".split(" "),function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,e,h){e=e.entity===c.tls.ConnectionEnd.client;a.read.cipherState={init:!1,cipher:c.cipher.createDecipher("AES-CBC",
|
|
e?h.keys.server_write_key:h.keys.client_write_key),iv:e?h.keys.server_write_IV:h.keys.client_write_IV};a.write.cipherState={init:!1,cipher:c.cipher.createCipher("AES-CBC",e?h.keys.client_write_key:h.keys.server_write_key),iv:e?h.keys.client_write_IV:h.keys.server_write_IV};a.read.cipherFunction=n;a.write.cipherFunction=d;a.read.macLength=a.write.macLength=h.mac_length;a.read.macFunction=a.write.macFunction=k.hmac_sha1}function d(a,b){var h=!1,g=b.macFunction(b.macKey,b.sequenceNumber,a);a.fragment.putBytes(g);
|
|
b.updateSequenceNumber();g=a.version.minor===k.Versions.TLS_1_0.minor?b.cipherState.init?null:b.cipherState.iv:c.random.getBytesSync(16);b.cipherState.init=!0;var l=b.cipherState.cipher;l.start({iv:g});a.version.minor>=k.Versions.TLS_1_1.minor&&l.output.putBytes(g);l.update(a.fragment);l.finish(e)&&(a.fragment=l.output,a.length=a.fragment.length(),h=!0);return h}function e(a,c,b){b||(a-=c.length()%a,c.fillWithByte(a-1,a));return!0}function g(a,c,b){a=!0;if(b){b=c.length();for(var d=c.last(),e=b-1-
|
|
d;e<b-1;++e)a=a&&c.at(e)==d;a&&c.truncate(d+1)}return a}function n(a,b){var d=!1;++h;d=a.version.minor===k.Versions.TLS_1_0.minor?b.cipherState.init?null:b.cipherState.iv:a.fragment.getBytes(16);b.cipherState.init=!0;var e=b.cipherState.cipher;e.start({iv:d});e.update(a.fragment);var d=e.finish(g),l=b.macLength,r=c.random.getBytesSync(l),w=e.output.length();w>=l?(a.fragment=e.output.getBytes(w-l),r=e.output.getBytes(l)):a.fragment=e.output.getBytes();a.fragment=c.util.createBuffer(a.fragment);a.length=
|
|
a.fragment.length();l=b.macFunction(b.macKey,b.sequenceNumber,a);b.updateSequenceNumber();e=b.macKey;w=c.hmac.create();w.start("SHA1",e);w.update(r);r=w.digest().getBytes();w.start(null,null);w.update(l);l=w.digest().getBytes();return r===l&&d}var k=c.tls;k.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=k.BulkCipherAlgorithm.aes;a.cipher_type=k.CipherType.block;a.enc_key_length=16;a.block_length=16;
|
|
a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=k.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:b};k.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=k.BulkCipherAlgorithm.aes;a.cipher_type=k.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=k.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=
|
|
20},initConnectionState:b};var h=0}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.aesCipherSuites)return b.aesCipherSuites;b.defined.aesCipherSuites=!0;for(var g=0;g<e.length;++g)e[g](b);return b.aesCipherSuites}},u=c;c=function(a,b){n="string"===
|
|
typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/aesCipherSuites",["require","module","./aes","./tls"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.debug=c.debug||{};c.debug.storage={};c.debug.get=function(a,b){var d;"undefined"===typeof a?d=c.debug.storage:a in c.debug.storage&&(d="undefined"===typeof b?c.debug.storage[a]:
|
|
c.debug.storage[a][b]);return d};c.debug.set=function(a,b,d){a in c.debug.storage||(c.debug.storage[a]={});c.debug.storage[a][b]=d};c.debug.clear=function(a,b){"undefined"===typeof a?c.debug.storage={}:a in c.debug.storage&&("undefined"===typeof b?delete c.debug.storage[a]:delete c.debug.storage[a][b])}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=
|
|
function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.debug)return b.debug;b.defined.debug=!0;for(var g=0;g<e.length;++g)e[g](b);return b.debug}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/debug",["require","module"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();
|
|
(function(){function a(c){function b(a,d,g,k){a.generate=function(a,b){for(var e=new c.util.ByteBuffer,l=Math.ceil(b/k)+g,n=new c.util.ByteBuffer,r=g;r<l;++r){n.putInt32(r);d.start();d.update(a+n.getBytes());var w=d.digest();e.putBytes(w.getBytes(k))}e.truncate(e.length()-b);return e.getBytes()}}c.kem=c.kem||{};var d=c.jsbn.BigInteger;c.kem.rsa={};c.kem.rsa.create=function(a,b){b=b||{};var g=b.prng||c.random;return{encrypt:function(b,h){var l=Math.ceil(b.n.bitLength()/8),p;do p=(new d(c.util.bytesToHex(g.getBytesSync(l)),
|
|
16)).mod(b.n);while(p.equals(d.ZERO));p=c.util.hexToBytes(p.toString(16));l-=p.length;0<l&&(p=c.util.fillString(String.fromCharCode(0),l)+p);l=b.encrypt(p,"NONE");p=a.generate(p,h);return{encapsulation:l,key:p}},decrypt:function(c,b,d){c=c.decrypt(b,"NONE");return a.generate(c,d)}}};c.kem.kdf1=function(a,c){b(this,a,0,c||a.digestLength)};c.kem.kdf2=function(a,c){b(this,a,1,c||a.digestLength)}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===
|
|
typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.kem)return b.kem;b.defined.kem=!0;for(var g=0;g<e.length;++g)e[g](b);return b.kem}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/kem",["require","module","./util","./random",
|
|
"./jsbn"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){c.log=c.log||{};c.log.levels="none error warning info debug verbose max".split(" ");var b={},d=[],e=null;c.log.LEVEL_LOCKED=2;c.log.NO_LEVEL_CHECK=4;c.log.INTERPOLATE=8;for(var g=0;g<c.log.levels.length;++g){var n=c.log.levels[g];b[n]={index:g,name:n.toUpperCase()}}c.log.logMessage=function(a){for(var e=b[a.level].index,g=0;g<d.length;++g){var k=d[g];k.flags&c.log.NO_LEVEL_CHECK?k.f(a):e<=b[k.level].index&&
|
|
k.f(k,a)}};c.log.prepareStandard=function(a){"standard"in a||(a.standard=b[a.level].name+" ["+a.category+"] "+a.message)};c.log.prepareFull=function(a){if(!("full"in a)){var b=[a.message],b=b.concat([]);a.full=c.util.format.apply(this,b)}};c.log.prepareStandardFull=function(a){"standardFull"in a||(c.log.prepareStandard(a),a.standardFull=a.standard)};n=["error","warning","info","debug","verbose"];for(g=0;g<n.length;++g)(function(a){c.log[a]=function(b,d){var e=Array.prototype.slice.call(arguments).slice(2);
|
|
c.log.logMessage({timestamp:new Date,level:a,category:b,message:d,arguments:e})}})(n[g]);c.log.makeLogger=function(a){a={flags:0,f:a};c.log.setLevel(a,"none");return a};c.log.setLevel=function(a,b){var d=!1;if(a&&!(a.flags&c.log.LEVEL_LOCKED))for(var e=0;e<c.log.levels.length;++e)if(b==c.log.levels[e]){a.level=b;d=!0;break}return d};c.log.lock=function(a,b){a.flags="undefined"===typeof b||b?a.flags|c.log.LEVEL_LOCKED:a.flags&~c.log.LEVEL_LOCKED};c.log.addLogger=function(a){d.push(a)};if("undefined"!==
|
|
typeof console&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)var k={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},e=function(a,b){c.log.prepareStandard(b);var d=k[b.level],e=[b.standard],e=e.concat(b.arguments.slice());d.apply(console,e)};else e=function(a,b){c.log.prepareStandardFull(b);console.log(b.standardFull)};e=c.log.makeLogger(e);c.log.setLevel(e,"debug");c.log.addLogger(e)}else console={log:function(){}};
|
|
null!==e&&(g=c.util.getQueryVariables(),"console.level"in g&&c.log.setLevel(e,g["console.level"].slice(-1)[0]),"console.lock"in g&&"true"==g["console.lock"].slice(-1)[0]&&c.log.lock(e));c.log.consoleLogger=e}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.log)return b.log;
|
|
b.defined.log=!0;for(var g=0;g<e.length;++g)e[g](b);return b.log}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/log",["require","module","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a){var d={},e=[];if(!p.validate(a,u.asn1.recipientInfoValidator,d,e))throw a=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo."),
|
|
a.errors=e,a;return{version:d.version.charCodeAt(0),issuer:c.pki.RDNAttributesAsArray(d.issuer),serialNumber:c.util.createBuffer(d.serial).toHex(),encryptedContent:{algorithm:p.derToOid(d.encAlgorithm),parameter:d.encParameter.value,content:d.encKey}}}function d(a){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(a.version).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[c.pki.distinguishedNameToAsn1({attributes:a.issuer}),
|
|
p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,c.util.hexToBytes(a.serialNumber))]),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(a.encryptedContent.algorithm).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,a.encryptedContent.content)])}function e(a){for(var c=[],b=0;b<a.length;++b)c.push(d(a[b]));return c}function g(a){var b=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,
|
|
p.Type.INTEGER,!1,p.integerToDer(a.version).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[c.pki.distinguishedNameToAsn1({attributes:a.issuer}),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,c.util.hexToBytes(a.serialNumber))]),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(a.digestAlgorithm).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")])]);a.authenticatedAttributesAsn1&&b.value.push(a.authenticatedAttributesAsn1);b.value.push(p.create(p.Class.UNIVERSAL,
|
|
p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(a.signatureAlgorithm).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]));b.value.push(p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,a.signature));if(0<a.unauthenticatedAttributes.length){for(var d=p.create(p.Class.CONTEXT_SPECIFIC,1,!0,[]),e=0;e<a.unauthenticatedAttributes.length;++e)d.values.push(n(a.unauthenticatedAttributes[e]));b.value.push(d)}return b}function n(a){var b;if(a.type===c.pki.oids.contentType)b=
|
|
p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(a.value).getBytes());else if(a.type===c.pki.oids.messageDigest)b=p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,a.value.bytes());else if(a.type===c.pki.oids.signingTime){b=new Date("Jan 1, 1950 00:00:00Z");var d=new Date("Jan 1, 2050 00:00:00Z"),e=a.value;if("string"===typeof e)var g=Date.parse(e),e=isNaN(g)?13===e.length?p.utcTimeToDate(e):p.generalizedTimeToDate(e):new Date(g);b=e>=b&&e<d?p.create(p.Class.UNIVERSAL,p.Type.UTCTIME,!1,p.dateToUtcTime(e)):
|
|
p.create(p.Class.UNIVERSAL,p.Type.GENERALIZEDTIME,!1,p.dateToGeneralizedTime(e))}return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(a.type).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SET,!0,[b])])}function k(a){return[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(c.pki.oids.data).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(a.algorithm).getBytes()),p.create(p.Class.UNIVERSAL,
|
|
p.Type.OCTETSTRING,!1,a.parameter.getBytes())]),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,a.content.getBytes())])]}function h(a,b,d){var e={};if(!p.validate(b,d,e,[]))throw a=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message."),a.errors=a,a;if(p.derToOid(e.contentType)!==c.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(e.encryptedContent){b="";if(c.util.isArray(e.encryptedContent))for(d=
|
|
0;d<e.encryptedContent.length;++d){if(e.encryptedContent[d].type!==p.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");b+=e.encryptedContent[d].value}else b=e.encryptedContent;a.encryptedContent={algorithm:p.derToOid(e.encAlgorithm),parameter:c.util.createBuffer(e.encParameter.value),content:c.util.createBuffer(b)}}if(e.content){b="";if(c.util.isArray(e.content))for(d=0;d<e.content.length;++d){if(e.content[d].type!==p.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");
|
|
b+=e.content[d].value}else b=e.content;a.content=c.util.createBuffer(b)}a.version=e.version.charCodeAt(0);return a.rawCapture=e}function r(a){if(void 0===a.encryptedContent.key)throw Error("Symmetric key not available.");if(void 0===a.content){var b;switch(a.encryptedContent.algorithm){case c.pki.oids["aes128-CBC"]:case c.pki.oids["aes192-CBC"]:case c.pki.oids["aes256-CBC"]:b=c.aes.createDecryptionCipher(a.encryptedContent.key);break;case c.pki.oids.desCBC:case c.pki.oids["des-EDE3-CBC"]:b=c.des.createDecryptionCipher(a.encryptedContent.key);
|
|
break;default:throw Error("Unsupported symmetric cipher, OID "+a.encryptedContent.algorithm);}b.start(a.encryptedContent.parameter);b.update(a.encryptedContent.content);if(!b.finish())throw Error("Symmetric decryption failed.");a.content=b.output}}var p=c.asn1,u=c.pkcs7=c.pkcs7||{};u.messageFromPem=function(a){a=c.pem.decode(a)[0];if("PKCS7"!==a.type){var b=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');b.headerType=a.type;throw b;}if(a.procType&&"ENCRYPTED"===
|
|
a.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");a=p.fromDer(a.body);return u.messageFromAsn1(a)};u.messageToPem=function(a,b){var d={type:"PKCS7",body:p.toDer(a.toAsn1()).getBytes()};return c.pem.encode(d,{maxline:b})};u.messageFromAsn1=function(a){var b={},d=[];if(!p.validate(a,u.asn1.contentInfoValidator,b,d))throw b=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo."),b.errors=d,b;d=p.derToOid(b.contentType);switch(d){case c.pki.oids.envelopedData:d=
|
|
u.createEnvelopedData();break;case c.pki.oids.encryptedData:d=u.createEncryptedData();break;case c.pki.oids.signedData:d=u.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+d+" is not (yet) supported.");}d.fromAsn1(b.content.value[0]);return d};u.createSignedData=function(){var a=null;return a={type:c.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(b){h(a,
|
|
b,u.asn1.signedDataValidator);a.certificates=[];a.crls=[];a.digestAlgorithmIdentifiers=[];a.contentInfo=null;a.signerInfos=[];b=a.rawCapture.certificates.value;for(var d=0;d<b.length;++d)a.certificates.push(c.pki.certificateFromAsn1(b[d]))},toAsn1:function(){a.contentInfo||a.sign();for(var b=[],d=0;d<a.certificates.length;++d)b.push(c.pki.certificateToAsn1(a.certificates[d]));var d=[],e=p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,
|
|
p.Type.INTEGER,!1,p.integerToDer(a.version).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SET,!0,a.digestAlgorithmIdentifiers),a.contentInfo])]);0<b.length&&e.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,0,!0,b));0<d.length&&e.value[0].value.push(p.create(p.Class.CONTEXT_SPECIFIC,1,!0,d));e.value[0].value.push(p.create(p.Class.UNIVERSAL,p.Type.SET,!0,a.signerInfos));return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(a.type).getBytes()),
|
|
e])},addSigner:function(b){var d=b.issuer,e=b.serialNumber;b.certificate&&(e=b.certificate,"string"===typeof e&&(e=c.pki.certificateFromPem(e)),d=e.issuer.attributes,e=e.serialNumber);var g=b.key;if(!g)throw Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof g&&(g=c.pki.privateKeyFromPem(g));var h=b.digestAlgorithm||c.pki.oids.sha1;switch(h){case c.pki.oids.sha1:case c.pki.oids.sha256:case c.pki.oids.sha384:case c.pki.oids.sha512:case c.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+
|
|
h);}b=b.authenticatedAttributes||[];if(0<b.length){for(var k=!1,l=!1,p=0;p<b.length;++p){var n=b[p];if(!k&&n.type===c.pki.oids.contentType){if(k=!0,l)break}else if(!l&&n.type===c.pki.oids.messageDigest&&(l=!0,k))break}if(!k||!l)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}a.signers.push({key:g,version:1,issuer:d,serialNumber:e,digestAlgorithm:h,
|
|
signatureAlgorithm:c.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:b,unauthenticatedAttributes:[]})},sign:function(){if("object"!==typeof a.content||null===a.contentInfo)if(a.contentInfo=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(c.pki.oids.data).getBytes())]),"content"in a){var b;a.content instanceof c.util.ByteBuffer?b=a.content.bytes():"string"===typeof a.content&&(b=c.util.encodeUtf8(a.content));a.contentInfo.value.push(p.create(p.Class.CONTEXT_SPECIFIC,
|
|
0,!0,[p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,b)]))}if(0!==a.signers.length){b={};for(var d=0;d<a.signers.length;++d){var e=a.signers[d],h=e.digestAlgorithm;h in b||(b[h]=c.md[c.pki.oids[h]].create());e.md=0===e.authenticatedAttributes.length?b[h]:c.md[c.pki.oids[h]].create()}a.digestAlgorithmIdentifiers=[];for(h in b)a.digestAlgorithmIdentifiers.push(p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(h).getBytes()),p.create(p.Class.UNIVERSAL,
|
|
p.Type.NULL,!1,"")]));if(2>a.contentInfo.value.length)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var h=p.derToOid(a.contentInfo.value[0].value),d=a.contentInfo.value[1],d=d.value[0],k=p.toDer(d);k.getByte();p.getBerValueLength(k);var k=k.getBytes(),l;for(l in b)b[l].start().update(k);l=new Date;for(d=0;d<a.signers.length;++d){e=a.signers[d];if(0===e.authenticatedAttributes.length){if(h!==c.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");
|
|
}else{e.authenticatedAttributesAsn1=p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var k=p.create(p.Class.UNIVERSAL,p.Type.SET,!0,[]),r=0;r<e.authenticatedAttributes.length;++r){var w=e.authenticatedAttributes[r];w.type===c.pki.oids.messageDigest?w.value=b[e.digestAlgorithm].digest():w.type!==c.pki.oids.signingTime||w.value||(w.value=l);k.value.push(n(w));e.authenticatedAttributesAsn1.value.push(n(w))}k=p.toDer(k).getBytes();e.md.start().update(k)}e.signature=e.key.sign(e.md,"RSASSA-PKCS1-V1_5")}b=
|
|
a;h=a.signers;l=[];for(d=0;d<h.length;++d)l.push(g(h[d]));b.signerInfos=l}},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.");},addCertificate:function(b){"string"===typeof b&&(b=c.pki.certificateFromPem(b));a.certificates.push(b)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.");}}};u.createEncryptedData=function(){var a=null;return a={type:c.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:c.pki.oids["aes256-CBC"]},
|
|
fromAsn1:function(c){h(a,c,u.asn1.encryptedDataValidator)},decrypt:function(c){void 0!==c&&(a.encryptedContent.key=c);r(a)}}};u.createEnvelopedData=function(){var a=null;return a={type:c.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:c.pki.oids["aes256-CBC"]},fromAsn1:function(c){var d=h(a,c,u.asn1.envelopedDataValidator);c=a;for(var d=d.recipientInfos.value,e=[],g=0;g<d.length;++g)e.push(b(d[g]));c.recipients=e},toAsn1:function(){return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,
|
|
!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(a.type).getBytes()),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(a.version).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SET,!0,e(a.recipients)),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,k(a.encryptedContent))])])])},findRecipient:function(c){for(var b=c.issuer.attributes,d=0;d<a.recipients.length;++d){var e=a.recipients[d],g=e.issuer;if(e.serialNumber===
|
|
c.serialNumber&&g.length===b.length){for(var h=!0,k=0;k<b.length;++k)if(g[k].type!==b[k].type||g[k].value!==b[k].value){h=!1;break}if(h)return e}}return null},decrypt:function(b,d){if(void 0===a.encryptedContent.key&&void 0!==b&&void 0!==d)switch(b.encryptedContent.algorithm){case c.pki.oids.rsaEncryption:case c.pki.oids.desCBC:var e=d.decrypt(b.encryptedContent.content);a.encryptedContent.key=c.util.createBuffer(e);break;default:throw Error("Unsupported asymmetric cipher, OID "+b.encryptedContent.algorithm);
|
|
}r(a)},addRecipient:function(b){a.recipients.push({version:0,issuer:b.issuer.attributes,serialNumber:b.serialNumber,encryptedContent:{algorithm:c.pki.oids.rsaEncryption,key:b.publicKey}})},encrypt:function(b,d){if(void 0===a.encryptedContent.content){d=d||a.encryptedContent.algorithm;b=b||a.encryptedContent.key;var e,g,h;switch(d){case c.pki.oids["aes128-CBC"]:g=e=16;h=c.aes.createEncryptionCipher;break;case c.pki.oids["aes192-CBC"]:e=24;g=16;h=c.aes.createEncryptionCipher;break;case c.pki.oids["aes256-CBC"]:e=
|
|
32;g=16;h=c.aes.createEncryptionCipher;break;case c.pki.oids["des-EDE3-CBC"]:e=24;g=8;h=c.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+d);}if(void 0===b)b=c.util.createBuffer(c.random.getBytes(e));else if(b.length()!=e)throw Error("Symmetric key has wrong length; got "+b.length()+" bytes, expected "+e+".");a.encryptedContent.algorithm=d;a.encryptedContent.key=b;a.encryptedContent.parameter=c.util.createBuffer(c.random.getBytes(g));e=h(b);e.start(a.encryptedContent.parameter.copy());
|
|
e.update(a.content);if(!e.finish())throw Error("Symmetric encryption failed.");a.encryptedContent.content=e.output}for(e=0;e<a.recipients.length;++e)if(g=a.recipients[e],void 0===g.encryptedContent.content)switch(g.encryptedContent.algorithm){case c.pki.oids.rsaEncryption:g.encryptedContent.content=g.encryptedContent.key.encrypt(a.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+g.encryptedContent.algorithm);}}}}}if("function"!==typeof c)if("object"===typeof module&&
|
|
module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.pkcs7)return b.pkcs7;b.defined.pkcs7=!0;for(var g=0;g<e.length;++g)e[g](b);return b.pkcs7}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,
|
|
Array.prototype.slice.call(arguments,0))};c("js/pkcs7","require module ./aes ./asn1 ./des ./oids ./pem ./pkcs7asn1 ./random ./util ./x509".split(" "),function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){function b(a,d){var e=d.toString(16);"8"<=e[0]&&(e="00"+e);e=c.util.hexToBytes(e);a.putInt32(e.length);a.putBytes(e)}function d(a,c){a.putInt32(c.length);a.putString(c)}function e(){for(var a=c.md.sha1.create(),b=arguments.length,d=0;d<b;++d)a.update(arguments[d]);
|
|
return a.digest()}var g=c.ssh=c.ssh||{};g.privateKeyToPutty=function(a,g,h){h=h||"";g=g||"";var n=""===g?"none":"aes256-cbc",p;p="PuTTY-User-Key-File-2: ssh-rsa\r\n"+("Encryption: "+n+"\r\n")+("Comment: "+h+"\r\n");var r=c.util.createBuffer();d(r,"ssh-rsa");b(r,a.e);b(r,a.n);var v=c.util.encode64(r.bytes(),64),u=Math.floor(v.length/66)+1;p+="Public-Lines: "+u+"\r\n";p+=v;v=c.util.createBuffer();b(v,a.d);b(v,a.p);b(v,a.q);b(v,a.qInv);g?(u=v.length()+16-1,u-=u%16,a=e(v.bytes()),a.truncate(a.length()-
|
|
u+v.length()),v.putBuffer(a),u=c.util.createBuffer(),u.putBuffer(e("\x00\x00\x00\x00",g)),u.putBuffer(e("\x00\x00\x00\u0001",g)),u=c.aes.createEncryptionCipher(u.truncate(8),"CBC"),u.start(c.util.createBuffer().fillWithByte(0,16)),u.update(v.copy()),u.finish(),u=u.output,u.truncate(16),a=c.util.encode64(u.bytes(),64)):a=c.util.encode64(v.bytes(),64);u=Math.floor(a.length/66)+1;p+="\r\nPrivate-Lines: "+u+"\r\n";p+=a;g=e("putty-private-key-file-mac-key",g);u=c.util.createBuffer();d(u,"ssh-rsa");d(u,
|
|
n);d(u,h);u.putInt32(r.length());u.putBuffer(r);u.putInt32(v.length());u.putBuffer(v);h=c.hmac.create();h.start("sha1",g);h.update(u.bytes());return p+="\r\nPrivate-MAC: "+h.digest().toHex()+"\r\n"};g.publicKeyToOpenSSH=function(a,e){e=e||"";var g=c.util.createBuffer();d(g,"ssh-rsa");b(g,a.e);b(g,a.n);return"ssh-rsa "+c.util.encode64(g.bytes())+" "+e};g.privateKeyToOpenSSH=function(a,b){return b?c.pki.encryptRsaPrivateKey(a,b,{legacy:!0,algorithm:"aes128"}):c.pki.privateKeyToPem(a)};g.getPublicKeyFingerprint=
|
|
function(a,e){e=e||{};var g=e.md||c.md.md5.create(),n=c.util.createBuffer();d(n,"ssh-rsa");b(n,a.e);b(n,a.n);g.start();g.update(n.getBytes());g=g.digest();if("hex"===e.encoding)return g=g.toHex(),e.delimiter?g.match(/.{2}/g).join(e.delimiter):g;if("binary"===e.encoding)return g.getBytes();if(e.encoding)throw Error('Unknown encoding "'+e.encoding+'".');return g}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&
|
|
(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.ssh)return b.ssh;b.defined.ssh=!0;for(var g=0;g<e.length;++g)e[g](b);return b.ssh}},u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/ssh","require module ./aes ./hmac ./md5 ./sha1 ./util".split(" "),
|
|
function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){function a(c){var b={},d=0;c.debug.set("forge.task","tasks",b);var e={};c.debug.set("forge.task","queues",e);var g={ready:{}};g.ready.stop="ready";g.ready.start="running";g.ready.cancel="done";g.ready.fail="error";g.running={};g.running.stop="ready";g.running.start="running";g.running.block="blocked";g.running.unblock="running";g.running.sleep="sleeping";g.running.wakeup="running";g.running.cancel="done";g.running.fail=
|
|
"error";g.blocked={};g.blocked.stop="blocked";g.blocked.start="blocked";g.blocked.block="blocked";g.blocked.unblock="blocked";g.blocked.sleep="blocked";g.blocked.wakeup="blocked";g.blocked.cancel="done";g.blocked.fail="error";g.sleeping={};g.sleeping.stop="sleeping";g.sleeping.start="sleeping";g.sleeping.block="sleeping";g.sleeping.unblock="sleeping";g.sleeping.sleep="sleeping";g.sleeping.wakeup="sleeping";g.sleeping.cancel="done";g.sleeping.fail="error";g.done={};g.done.stop="done";g.done.start=
|
|
"done";g.done.block="done";g.done.unblock="done";g.done.sleep="done";g.done.wakeup="done";g.done.cancel="done";g.done.fail="error";g.error={};g.error.stop="error";g.error.start="error";g.error.block="error";g.error.unblock="error";g.error.sleep="error";g.error.wakeup="error";g.error.cancel="error";g.error.fail="error";var n=function(a){this.id=-1;this.name=a.name||"?";this.parent=a.parent||null;this.run=a.run;this.subtasks=[];this.error=!1;this.state="ready";this.blocks=0;this.userData=this.swapTime=
|
|
this.timeoutId=null;this.id=d++;b[this.id]=this};n.prototype.debug=function(a){c.log.debug("forge.task",a||"","[%s][%s] task:",this.id,this.name,this,"subtasks:",this.subtasks.length,"queue:",e)};n.prototype.next=function(a,c){"function"===typeof a&&(c=a,a=this.name);var b=new n({run:c,name:a,parent:this});b.state="running";b.type=this.type;b.successCallback=this.successCallback||null;b.failureCallback=this.failureCallback||null;this.subtasks.push(b);return this};n.prototype.parallel=function(a,b){c.util.isArray(a)&&
|
|
(b=a,a=this.name);return this.next(a,function(d){d.block(b.length);for(var e=function(a,e){c.task.start({type:a,run:function(a){b[e](a)},success:function(a){d.unblock()},failure:function(a){d.unblock()}})},g=0;g<b.length;g++)e(a+"__parallel-"+d.id+"-"+g,g)})};n.prototype.stop=function(){this.state=g[this.state].stop};n.prototype.start=function(){this.error=!1;this.state=g[this.state].start;"running"===this.state&&(this.start=new Date,this.run(this),h(this,0))};n.prototype.block=function(a){this.blocks+=
|
|
"undefined"===typeof a?1:a;0<this.blocks&&(this.state=g[this.state].block)};n.prototype.unblock=function(a){this.blocks-="undefined"===typeof a?1:a;0===this.blocks&&"done"!==this.state&&(this.state="running",h(this,0));return this.blocks};n.prototype.sleep=function(a){this.state=g[this.state].sleep;var c=this;this.timeoutId=setTimeout(function(){c.timeoutId=null;c.state="running";h(c,0)},"undefined"===typeof a?0:a)};n.prototype.wait=function(a){a.wait(this)};n.prototype.wakeup=function(){"sleeping"===
|
|
this.state&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state="running",h(this,0))};n.prototype.cancel=function(){this.state=g[this.state].cancel;this.permitsNeeded=0;null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null);this.subtasks=[]};n.prototype.fail=function(a){this.error=!0;r(this,!0);if(a)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,h(a,0);else{if(null!==this.parent){for(a=this.parent;null!==a.parent;)a.error=this.error,a.swapTime=this.swapTime,
|
|
a.userData=this.userData,a=a.parent;r(a,!0)}this.failureCallback&&this.failureCallback(this)}};var k=function(a){a.error=!1;a.state=g[a.state].start;setTimeout(function(){"running"===a.state&&(a.swapTime=+new Date,a.run(a),h(a,0))},0)},h=function(a,c){var b=30<c||20<+new Date-a.swapTime,d=function(c){c++;if("running"===a.state)if(b&&(a.swapTime=+new Date),0<a.subtasks.length){var d=a.subtasks.shift();d.error=a.error;d.swapTime=a.swapTime;d.userData=a.userData;d.run(d);d.error||h(d,c)}else r(a),a.error||
|
|
null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,h(a.parent,c))};b?setTimeout(d,0):d(c)},r=function(a,d){a.state="done";delete b[a.id];null===a.parent&&(a.type in e?0===e[a.type].length?c.log.error("forge.task","[%s][%s] task queue empty [%s]",a.id,a.name,a.type):e[a.type][0]!==a?c.log.error("forge.task","[%s][%s] task not first in queue [%s]",a.id,a.name,a.type):(e[a.type].shift(),0===e[a.type].length?delete e[a.type]:e[a.type][0].start()):c.log.error("forge.task",
|
|
"[%s][%s] task queue missing [%s]",a.id,a.name,a.type),d||(a.error&&a.failureCallback?a.failureCallback(a):!a.error&&a.successCallback&&a.successCallback(a)))};c.task=c.task||{};c.task.start=function(a){var c=new n({run:a.run,name:a.name||"?"});c.type=a.type;c.successCallback=a.success||null;c.failureCallback=a.failure||null;c.type in e?e[a.type].push(c):(e[c.type]=[c],k(c))};c.task.cancel=function(a){a in e&&(e[a]=[e[a][0]])};c.task.createCondition=function(){var a={tasks:{},wait:function(c){c.id in
|
|
a.tasks||(c.block(),a.tasks[c.id]=c)},notify:function(){var c=a.tasks;a.tasks={};for(var b in c)c[b].unblock()}};return a}}if("function"!==typeof c)if("object"===typeof module&&module.exports){var g=!0;c=function(a,c){c(b,module)}}else return"undefined"===typeof forge&&(forge={}),a(forge);var n,r=function(c,b){b.exports=function(b){var e=n.map(function(a){return c(a)}).concat(a);b=b||{};b.defined=b.defined||{};if(b.defined.task)return b.task;b.defined.task=!0;for(var g=0;g<e.length;++g)e[g](b);return b.task}},
|
|
u=c;c=function(a,b){n="string"===typeof a?b.slice(2):a.slice(2);if(g)return delete c,u.apply(null,Array.prototype.slice.call(arguments,0));c=u;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/task",["require","module","./debug","./log","./util"],function(){r.apply(null,Array.prototype.slice.call(arguments,0))})})();(function(){if("function"!==typeof c)if("object"===typeof module&&module.exports){var a=!0;c=function(a,c){c(b,module)}}else{"undefined"===typeof forge&&(forge={disableNativeCode:!1});
|
|
return}var g,n=function(a,c){c.exports=function(c){var b=g.map(function(c){return a(c)});c=c||{};c.defined=c.defined||{};if(c.defined.forge)return c.forge;c.defined.forge=!0;for(var d=0;d<b.length;++d)b[d](c);return c};c.exports.disableNativeCode=!0;c.exports(c.exports)},r=c;c=function(b,m){g="string"===typeof b?m.slice(2):b.slice(2);if(a)return delete c,r.apply(null,Array.prototype.slice.call(arguments,0));c=r;return c.apply(null,Array.prototype.slice.call(arguments,0))};c("js/forge","require module ./aes ./aesCipherSuites ./asn1 ./cipher ./cipherModes ./debug ./des ./hmac ./kem ./log ./md ./mgf1 ./pbkdf2 ./pem ./pkcs7 ./pkcs1 ./pkcs12 ./pki ./prime ./prng ./pss ./random ./rc2 ./ssh ./task ./tls ./util".split(" "),
|
|
function(){n.apply(null,Array.prototype.slice.call(arguments,0))})})();return b("js/forge")});function amtcert_linkCertPrivateKey(a,b){for(var c in a){var d=a[c];try{if(0==xxCertPrivateKeys.length)break;for(var g=forge.pki.publicKeyToPem(forge.pki.certificateFromAsn1(forge.asn1.fromDer(d.X509Certificate)).publicKey).substring(60).replace(/(\r\n|\n|\r)/gm,""),n=0;n<b.length;n++)g===b[n].DERKey+"-----END PUBLIC KEY-----"&&(b[n].XCert=d,d.XPrivateKey=b[n])}catch(r){console.log(r)}}}
|
|
function amtcert_loadP12File(a,b,c){try{var d=window.forge.util.decode64(btoa(a)),g=window.forge.asn1.fromDer(d),n=window.forge.pkcs12.pkcs12FromAsn1(g,b),r=n.getBags({bagType:window.forge.pki.oids.pkcs8ShroudedKeyBag});console.assert(r[window.forge.pki.oids.pkcs8ShroudedKeyBag]&&0<r[window.forge.pki.oids.pkcs8ShroudedKeyBag].length);var u=r[window.forge.pki.oids.pkcs8ShroudedKeyBag][0].key,m=window.forge.pki.privateKeyToAsn1(u),l=window.forge.pki.wrapRsaPrivateKey(m);window.forge.asn1.toDer(l).getBytes();
|
|
var w=n.getBags({bagType:window.forge.pki.oids.certBag})[window.forge.pki.oids.certBag][0].cert.subject.attributes,e=n.getBags({bagType:forge.pki.oids.certBag})[forge.pki.oids.certBag][0].cert;c(u,w,e);return!0}catch(v){}return!1}function amtcert_signWithCaKey(a,b,c,d,g){b&&null!=b||(b=amtcert_createCertificate(d).key);return amtcert_createCertificate(c,b,a,d,g)}
|
|
function amtcert_createCertificate(a,b,c,d,g){var n,r=forge.pki.createCertificate();c?r.publicKey=forge.pki.publicKeyFromPem("-----BEGIN PUBLIC KEY-----"+c+"-----END PUBLIC KEY-----"):(n=forge.pki.rsa.generateKeyPair(2048),r.publicKey=n.publicKey);r.serialNumber=""+Math.floor(1E5*Math.random()+1);r.validity.notBefore=new Date;r.validity.notBefore.setFullYear(r.validity.notBefore.getFullYear()-1);r.validity.notAfter=new Date;r.validity.notAfter.setFullYear(r.validity.notAfter.getFullYear()+30);var u=
|
|
[];a.CN&&u.push({name:"commonName",value:a.CN});a.C&&u.push({name:"countryName",value:a.C});a.ST&&u.push({shortName:"ST",value:a.ST});a.O&&u.push({name:"organizationName",value:a.O});r.setSubject(u);b?(a=[],d.CN&&a.push({name:"commonName",value:d.CN}),d.C&&a.push({name:"countryName",value:d.C}),d.ST&&a.push({shortName:"ST",value:d.ST}),d.O&&a.push({name:"organizationName",value:d.O}),r.setIssuer(a)):r.setIssuer(u);void 0==b?r.setExtensions([{name:"basicConstraints",cA:!0},{name:"nsCertType",sslCA:!0,
|
|
emailCA:!0,objCA:!0},{name:"subjectKeyIdentifier"}]):(null==g?g={name:"extKeyUsage",serverAuth:!0}:g.name="extKeyUsage",r.setExtensions([{name:"basicConstraints"},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},g,{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0},{name:"subjectKeyIdentifier"}]));b?r.sign(b,forge.md.sha256.create()):r.sign(n.privateKey,forge.md.sha256.create());return c?r:{cert:r,key:n.privateKey}}
|
|
function _stringToArrayBuffer(a){for(var b=new ArrayBuffer(a.length),c=new Uint8Array(b),d=0,g=a.length;d<g;d++)c[d]=a.charCodeAt(d);return b}function _arrayBufferToString(a){var b="";a=new Uint8Array(a);for(var c=a.byteLength,d=0;d<c;d++)b+=String.fromCharCode(a[d]);return b}script_functionTable1="nop jump set print dialog getitem substr indexof split join length jsonparse jsonstr add substract parseint wsbatchenum wsput wscreate wsdelete wsexec scriptspeed wssubscribe wsunsubscribe readchar signwithdummyca".split(" ");
|
|
script_functionTable2="encodeuri decodeuri passwordcheck atob btoa hex2str str2hex random md5 maketoarray readshort readshortx readint readsint readintx shorttostr shorttostrx inttostr inttostrx".split(" ");script_functionTableX2=[encodeURI,decodeURI,passwordcheck,window.atob.bind(window),window.btoa.bind(window),hex2rstr,rstr2hex,random,rstr_md5,MakeToArray,ReadShort,ReadShortX,ReadInt,ReadSInt,ReadIntX,ShortToStr,ShortToStrX,IntToStr,IntToStrX];script_functionTable3="pullsystemstatus pulleventlog pullauditlog pullcertificates pullwatchdog pullsystemdefense pullhardware pulluserinfo pullremoteaccess highlightblock disconnect getsidstring getsidbytearray pulleventsubscriptions".split(" ");
|
|
script_functionTableX3=[PullSystemStatus,PullEventLog,PullAuditLog,PullCertificates,PullWatchdog,PullSystemDefense,PullHardware,PullUserInfo,PullRemoteAccess,script_HighlightBlock,,function(a,b){return GetSidString(b)},function(a,b){return GetSidByteArray(b)},PullEventSubscriptions];
|
|
function script_setup(a,b){var c={startvars:b};if(6>a.length)return console.error("Invalid script length"),null;if(612182341!=ReadInt(a,0))return console.error("Invalid binary script"),null;if(1<ReadShort(a,4))return console.error("Unsupported script version"),null;c.script=a.substring(6);c.reset=function(a){c.stop();c.ip=0;c.variables=b;c.state=1};c.start=function(a){c.stop();c.stepspeed=a;0<a&&(c.timer=setInterval(function(){c.step()},a))};c.stop=function(){null!=c.timer&&clearInterval(c.timer);
|
|
c.timer=null;c.stepspeed=0};c.getVar=function(a){return void 0==a?void 0:c.getVarEx(a.split("."),c.variables)};c.getVarEx=function(a,b){try{return void 0==a?void 0:0==a.length?b:c.getVarEx(a.slice(1),b[a[0]])}catch(n){return null}};c.setVar=function(a,b){c.setVarEx(a.split("."),c.variables,b)};c.setVarEx=function(a,b,n){1==a.length?b[a[0]]=n:c.setVarEx(a.slice(1),b[a[0]],n)};c.step=function(){if(1==c.state){if(c.ip<c.script.length){var a=ReadShort(c.script,c.ip),b=ReadShort(c.script,c.ip+2),n=ReadShort(c.script,
|
|
c.ip+4),r=c.ip+6,u=[],m;for(m in c.variables)m.startsWith("__")&&delete c.variables[m];for(m=0;m<n;m++){var l=ReadShort(c.script,r),w=c.script.substring(r+2,r+2+l),e=w.charCodeAt(0),w=w.substring(1);if(2>e){for(;1<w.split("{").length;)var v=w.split("{").pop().split("}").shift(),w=w.replace("{"+v+"}",c.getVar(v));1==e&&(c.variables["__"+m]=decodeURI(w),w="__"+m);u.push(w)}if(2==e||3==e)c.variables["__"+m]=ReadSInt(w,0),u.push("__"+m);r+=2+l}c.ip+=b;b=[];for(m=0;10>m;m++)b.push(c.getVar(u[m]));var E;
|
|
try{if(1E4>a)switch(a){case 0:break;case 1:if(b[2]){if("<"==b[2]&&b[1]<b[3]||"<="==b[2]&&b[1]<=b[3]||"!="==b[2]&&b[1]!=b[3]||"="==b[2]&&b[1]==b[3]||">="==b[2]&&b[1]>=b[3]||">"==b[2]&&b[1]>b[3])c.ip=b[0]}else c.ip=b[0];break;case 2:void 0==u[1]?delete c.variables[u[0]]:c.setVar(u[0],b[1]);break;case 3:if(c.onConsole)c.onConsole(c.toString(b[0]),c);else console.log(c.toString(b[0]));break;case 4:c.state=2;c.dialog=!0;setDialogMode(11,b[0],b[2],c.xxStepDialogOk,b[1],c);break;case 5:for(m in b[1])b[1][m][b[2]]==
|
|
b[3]&&(E=m);break;case 6:E=b[1].substr(b[2],b[3]);break;case 7:E=b[1].indexOf(b[2]);break;case 8:E=b[1].split(b[2]);break;case 9:E=b[1].join(b[2]);break;case 10:E=b[1].length;break;case 11:E=JSON.parse(b[1]);break;case 12:E=JSON.stringify(b[1]);break;case 13:E=b[1]+b[2];break;case 14:E=b[1]-b[2];break;case 15:E=parseInt(b[1]);break;case 16:c.state=2;c.amtstack.BatchEnum(b[0],b[1],c.xxWsmanReturn,c);break;case 17:c.state=2;c.amtstack.Put(b[0],b[1],c.xxWsmanReturn,c);break;case 18:c.state=2;c.amtstack.Create(b[0],
|
|
b[1],c.xxWsmanReturn,c);break;case 19:c.state=2;c.amtstack.Delete(b[0],b[1],c.xxWsmanReturn,c);break;case 20:c.state=2;c.amtstack.Exec(b[0],b[1],b[2],c.xxWsmanReturn,c,0,b[3]);break;case 21:c.stepspeed=b[0];null!=c.timer&&(clearInterval(c.timer),c.timer=setInterval(function(){c.step()},c.stepspeed));break;case 22:c.state=2;c.amtstack.Subscribe(b[0],b[1],b[2],c.xxWsmanReturn,c,0,b[3],b[4],b[5],b[6]);break;case 23:c.state=2;c.amtstack.UnSubscribe(b[0],c.xxWsmanReturn,c,0,b[1]);break;case 24:console.log(b[1],
|
|
b[2],b[1].charCodeAt(b[2]));E=b[1].charCodeAt(b[2]);break;case 25:c.state=2;amtcert_signWithCaKey(b[0],null,b[1],{CN:"Untrusted Root Certificate"},c.xxSignWithDummyCaReturn);break;default:c.state=9,console.error("Script Error, unknown command: "+a)}else 2E4>a?E=script_functionTableX2[a-1E4](b[1],b[2],b[3],b[4],b[5],b[6]):script_functionTableX3&&script_functionTableX3[a-2E4]&&(E=script_functionTableX3[a-2E4](c,b[1],b[2],b[3],b[4],b[5],b[6]));void 0!=E&&c.setVar(u[0],E)}catch(k){"object"==typeof k&&
|
|
(k=k.message),c.setVar("_exception",k)}}1==c.state&&c.ip>=c.script.length&&(c.state=0,c.stop());if(c.onStep)c.onStep(c);return c}};c.xxStepDialogOk=function(a){c.variables.DialogSelect=a;c.state=1;c.dialog=!1;if(c.onStep)c.onStep(c)};c.xxWsmanReturn=function(a,b,n,r){c.setVar(b,n);c.setVar("wsman_result",r);c.setVar("wsman_result_str",httpErrorTable[r]?httpErrorTable[r]:"Error #"+r);c.state=1;if(c.onStep)c.onStep(c)};c.xxSignWithDummyCaReturn=function(a){c.setVar("signed_cert",btoa(_arrayBufferToString(a)));
|
|
c.state=1;if(c.onStep)c.onStep(c)};c.toString=function(a){return"object"==typeof a?JSON.stringify(a):a};c.reset();return c}
|
|
function script_compile(a,b){var c="",d=a.split("\n"),g={},n=[],r=[],u;for(u in d){var m=d[u];if(m.startsWith("##SWAP ")){var l=m.split(" ");3==l.length&&(r[l[1]]=l[2])}if("#"!=m[0]&&0!=m.length){for(l in r)m=m.split(l).join(r[l]);var w=m.match(/"[^"]*"|[^\s"]+/g);if(0!=w.length)if(":"==m[0])g[w[0].toUpperCase()]=c.length;else{m=script_functionTable1.indexOf(w[0].toLowerCase());-1==m&&(m=script_functionTable2.indexOf(w[0].toLowerCase()),0<=m&&(m+=1E4));-1==m&&(m=script_functionTable3.indexOf(w[0].toLowerCase()),
|
|
0<=m&&(m+=2E4));if(-1==m)return b&&b("Unabled to compile, unknown command: "+w[0]),"";var e=ShortToStr(w.length-1),v;for(v in w)if(0!=v)if(":"==w[v][0])n.push([w[v],c.length+e.length+7]),e+=ShortToStr(5)+String.fromCharCode(3)+IntToStr(4294967295);else var E=parseInt(w[v]),e=E==w[v]?e+(ShortToStr(5)+String.fromCharCode(2)+IntToStr(E)):'"'==w[v][0]&&'"'==w[v][w[v].length-1]?e+(ShortToStr(w[v].length-1)+String.fromCharCode(1)+w[v].substring(1,w[v].length-1)):e+(ShortToStr(w[v].length+1)+String.fromCharCode(0)+
|
|
w[v]);e=ShortToStr(m)+ShortToStr(e.length+4)+e;c+=e}}}for(u in n){d=n[u][0].toUpperCase();r=n[u][1];l=g[d];if(void 0==l)return b&&b("Unabled to compile, unknown label: "+d),"";c=c.substr(0,r)+IntToStr(l)+c.substr(r+4)}return IntToStr(612182341)+ShortToStr(1)+c}
|
|
function script_decompile(a,b){var c="",d=6,g={};if(0<=b)d=b;else{if(6>a.length)return"# Invalid script length";var n=ReadInt(a,0),r=ReadShort(a,4);if(612182341!=n)return"# Invalid binary script: "+n;if(1!=r)return"# Invalid script version"}for(;d<a.length;){var n=ReadShort(a,d),r=ReadShort(a,d+2),u=ReadShort(a,d+4),m=d+6,l="";0<=b||(c+=":label"+(d-6)+"\n");for(var w=0;w<u;w++){var e=ReadShort(a,m),v=a.substring(m+2,m+2+e),E=v.charCodeAt(0);0==E?l+=" "+v.substring(1):1==E?l+=' "'+v.substring(1)+'"':
|
|
2==E?l+=" "+ReadInt(v,1):3==E&&(v=ReadInt(v,1),E=g[v],E||(E=":label"+v,g[E]=v),l+=" "+E);m+=2+e}c=1E4>n?c+(script_functionTable1[n]+l+"\n"):2E4<=n?c+(script_functionTable3[n-2E4]+l+"\n"):c+(script_functionTable2[n-1E4]+l+"\n");d+=r;if(0<=b)return c}d=c.split("\n");c="";for(w in d)n=d[w],":"!=n[0]?c+=n+"\n":g[n]&&(c+=n+"\n");return c}
|
|
var saveAs=saveAs||function(a){if("undefined"===typeof navigator||!/MSIE [1-9]\./.test(navigator.userAgent)){var b=a.document.createElementNS("http://www.w3.org/1999/xhtml","a"),c="download"in b,d=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),g=a.webkitRequestFileSystem,n=a.requestFileSystem||g||a.mozRequestFileSystem,r=function(b){(a.setImmediate||a.setTimeout)(function(){throw b;},0)},u=0,m=function(b){var c=function(){"string"===typeof b?(a.URL||a.webkitURL||a).revokeObjectURL(b):b.remove()};
|
|
a.chrome?c():setTimeout(c,500)},l=function(a,b,c){b=[].concat(b);for(var d=b.length;d--;){var e=a["on"+b[d]];if("function"===typeof e)try{e.call(a,c||a)}catch(g){r(g)}}},w=function(a){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\ufeff",a],{type:a.type}):a},e=function(e,k,h){h||(e=w(e));var r=this;h=e.type;var p=!1,v,y,z=function(){l(r,["writestart","progress","write","writeend"])},A=function(){if(y&&d&&"undefined"!==typeof FileReader){var b=
|
|
new FileReader;b.onloadend=function(){var a=b.result;y.location.href="data:attachment/file"+a.slice(a.search(/[,;]/));r.readyState=r.DONE;z()};b.readAsDataURL(e);r.readyState=r.INIT}else{if(p||!v)v=(a.URL||a.webkitURL||a).createObjectURL(e);y?y.location.href=v:void 0==a.open(v,"_blank")&&d&&(a.location.href=v);r.readyState=r.DONE;z();m(v)}},D=function(a){return function(){if(r.readyState!==r.DONE)return a.apply(this,arguments)}},N={create:!0,exclusive:!1},x;r.readyState=r.INIT;k||(k="download");if(c)v=
|
|
(a.URL||a.webkitURL||a).createObjectURL(e),b.href=v,b.download=k,setTimeout(function(){var a=new MouseEvent("click");b.dispatchEvent(a);z();m(v);r.readyState=r.DONE});else{a.chrome&&h&&"application/octet-stream"!==h&&(x=e.slice||e.webkitSlice,e=x.call(e,0,e.size,"application/octet-stream"),p=!0);g&&"download"!==k&&(k+=".download");if("application/octet-stream"===h||g)y=a;n?(u+=e.size,n(a.TEMPORARY,u,D(function(a){a.root.getDirectory("saved",N,D(function(a){var b=function(){a.getFile(k,N,D(function(a){a.createWriter(D(function(b){b.onwriteend=
|
|
function(b){y.location.href=a.toURL();r.readyState=r.DONE;l(r,"writeend",b);m(a)};b.onerror=function(){var a=b.error;a.code!==a.ABORT_ERR&&A()};["writestart","progress","write","abort"].forEach(function(a){b["on"+a]=r["on"+a]});b.write(e);r.abort=function(){b.abort();r.readyState=r.DONE};r.readyState=r.WRITING}),A)}),A)};a.getFile(k,{create:!1},D(function(a){a.remove();b()}),D(function(a){a.code===a.NOT_FOUND_ERR?b():A()}))}),A)}),A)):A()}},v=e.prototype;if("undefined"!==typeof navigator&&navigator.msSaveOrOpenBlob)return function(a,
|
|
b,c){c||(a=w(a));return navigator.msSaveOrOpenBlob(a,b||"download")};v.abort=function(){this.readyState=this.DONE;l(this,"abort")};v.readyState=v.INIT=0;v.WRITING=1;v.DONE=2;v.error=v.onwritestart=v.onprogress=v.onwrite=v.onabort=v.onerror=v.onwriteend=null;return function(a,b,c){return new e(a,b,c)}}}("undefined"!==typeof self&&self||"undefined"!==typeof window&&window||this.content);
|
|
"undefined"!==typeof module&&module.exports?module.exports.saveAs=saveAs:"undefined"!==typeof define&&null!==define&&null!=define.amd&&define([],function(){return saveAs});
|
|
var version="0.7.4",urlvars={},amtstack,wsstack=null,AllWsman="AMT_8021xCredentialContext AMT_8021XProfile AMT_ActiveFilterStatistics AMT_AgentPresenceCapabilities AMT_AgentPresenceInterfacePolicy AMT_AgentPresenceService AMT_AgentPresenceWatchdog AMT_AgentPresenceWatchdogAction AMT_AlarmClockService IPS_AlarmClockOccurrence AMT_AssetTable AMT_AssetTableService AMT_AuditLog AMT_AuditPolicyRule AMT_AuthorizationService AMT_BootCapabilities AMT_BootSettingData AMT_ComplexFilterEntryBase AMT_CRL AMT_CryptographicCapabilities AMT_EACCredentialContext AMT_EndpointAccessControlService AMT_EnvironmentDetectionInterfacePolicy AMT_EnvironmentDetectionSettingData AMT_EthernetPortSettings AMT_EventLogEntry AMT_EventManagerService AMT_EventSubscriber AMT_FilterEntryBase AMT_FilterInSystemDefensePolicy AMT_GeneralSettings AMT_GeneralSystemDefenseCapabilities AMT_Hdr8021Filter AMT_HeuristicPacketFilterInterfacePolicy AMT_HeuristicPacketFilterSettings AMT_HeuristicPacketFilterStatistics AMT_InterfacePolicy AMT_IPHeadersFilter AMT_KerberosSettingData AMT_ManagementPresenceRemoteSAP AMT_MessageLog AMT_MPSUsernamePassword AMT_NetworkFilter AMT_NetworkPortDefaultSystemDefensePolicy AMT_NetworkPortSystemDefenseCapabilities AMT_NetworkPortSystemDefensePolicy AMT_PCIDevice AMT_PETCapabilities AMT_PETFilterForTarget AMT_PETFilterSetting AMT_ProvisioningCertificateHash AMT_PublicKeyCertificate AMT_PublicKeyManagementCapabilities AMT_PublicKeyManagementService AMT_PublicPrivateKeyPair AMT_RedirectionService AMT_RemoteAccessCapabilities AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule AMT_RemoteAccessService AMT_SetupAndConfigurationService AMT_SNMPEventSubscriber AMT_StateTransitionCondition AMT_SystemDefensePolicy AMT_SystemDefensePolicyInService AMT_SystemDefenseService AMT_SystemPowerScheme AMT_ThirdPartyDataStorageAdministrationService AMT_ThirdPartyDataStorageService AMT_TimeSynchronizationService AMT_TLSCredentialContext AMT_TLSProtocolEndpoint AMT_TLSProtocolEndpointCollection AMT_TLSSettingData AMT_TrapTargetForService AMT_UserInitiatedConnectionService AMT_WebUIService AMT_WiFiPortConfigurationService CIM_AbstractIndicationSubscription CIM_Account CIM_AccountManagementCapabilities CIM_AccountManagementService CIM_AccountOnSystem CIM_AdminDomain CIM_AlertIndication CIM_AssignedIdentity CIM_AssociatedPowerManagementService CIM_AuthenticationService CIM_AuthorizationService CIM_BIOSElement CIM_BIOSFeature CIM_BIOSFeatureBIOSElements CIM_BootConfigSetting CIM_BootService CIM_BootSettingData CIM_BootSourceSetting CIM_Capabilities CIM_Card CIM_Chassis CIM_Chip CIM_Collection CIM_Component CIM_ComputerSystem CIM_ComputerSystemPackage CIM_ConcreteComponent CIM_ConcreteDependency CIM_Controller CIM_CoolingDevice CIM_Credential CIM_CredentialContext CIM_CredentialManagementService CIM_Dependency CIM_DeviceSAPImplementation CIM_ElementCapabilities CIM_ElementConformsToProfile CIM_ElementLocation CIM_ElementSettingData CIM_ElementSoftwareIdentity CIM_ElementStatisticalData CIM_EnabledLogicalElement CIM_EnabledLogicalElementCapabilities CIM_EthernetPort CIM_Fan CIM_FilterCollection CIM_FilterCollectionSubscription CIM_HostedAccessPoint CIM_HostedDependency CIM_HostedService CIM_Identity CIM_IEEE8021xCapabilities CIM_IEEE8021xSettings CIM_Indication CIM_IndicationService CIM_InstalledSoftwareIdentity CIM_KVMRedirectionSAP CIM_LANEndpoint CIM_ListenerDestination CIM_ListenerDestinationWSManagement CIM_Location CIM_Log CIM_LogEntry CIM_LogicalDevice CIM_LogicalElement CIM_LogicalPort CIM_LogicalPortCapabilities CIM_LogManagesRecord CIM_ManagedCredential CIM_ManagedElement CIM_ManagedSystemElement CIM_MediaAccessDevice CIM_MemberOfCollection CIM_Memory CIM_MessageLog CIM_NetworkPort CIM_NetworkPortCapabilities CIM_NetworkPortConfigurationService CIM_OrderedComponent CIM_OwningCollectionElement CIM_OwningJobElement CIM_PCIController CIM_PhysicalComponent CIM_PhysicalElement CIM_PhysicalElementLocation CIM_PhysicalFrame CIM_PhysicalMemory CIM_PhysicalPackage CIM_Policy CIM_PolicyAction CIM_PolicyCondition CIM_PolicyInSystem CIM_PolicyRule CIM_PolicyRuleInSystem CIM_PolicySet CIM_PolicySetAppliesToElement CIM_PolicySetInSystem CIM_PowerManagementCapabilities CIM_PowerManagementService CIM_PowerSupply CIM_Privilege CIM_PrivilegeManagementCapabilities CIM_PrivilegeManagementService CIM_ProcessIndication CIM_Processor CIM_ProtocolEndpoint CIM_ProvidesServiceToElement CIM_Realizes CIM_RecordForLog CIM_RecordLog CIM_RedirectionService CIM_ReferencedProfile CIM_RegisteredProfile CIM_RemoteAccessAvailableToElement CIM_RemoteIdentity CIM_RemotePort CIM_RemoteServiceAccessPoint CIM_Role CIM_RoleBasedAuthorizationService CIM_RoleBasedManagementCapabilities CIM_RoleLimitedToTarget CIM_SAPAvailableForElement CIM_SecurityService CIM_Sensor CIM_Service CIM_ServiceAccessBySAP CIM_ServiceAccessPoint CIM_ServiceAffectsElement CIM_ServiceAvailableToElement CIM_ServiceSAPDependency CIM_ServiceServiceDependency CIM_SettingData CIM_SharedCredential CIM_SoftwareElement CIM_SoftwareFeature CIM_SoftwareFeatureSoftwareElements CIM_SoftwareIdentity CIM_StatisticalData CIM_StorageExtent CIM_System CIM_SystemBIOS CIM_SystemComponent CIM_SystemDevice CIM_SystemPackaging CIM_UseOfLog CIM_Watchdog CIM_WiFiEndpoint CIM_WiFiEndpointCapabilities CIM_WiFiEndpointSettings CIM_WiFiPort CIM_WiFiPortCapabilities IPS_AdminProvisioningRecord IPS_ClientProvisioningRecord IPS_HostBasedSetupService IPS_HostIPSettings IPS_HTTPProxyService IPS_HTTPProxyAccessPoint IPS_IderSessionUsingPort IPS_IPv6PortSettings IPS_KVMRedirectionSettingData IPS_KvmSessionUsingPort IPS_ManualProvisioningRecord IPS_OptInService IPS_ProvisioningAuditRecord IPS_ProvisioningRecordLog IPS_RasSessionUsingPort IPS_ScreenConfigurationService IPS_ScreenSettingData IPS_SecIOService IPS_SessionUsingPort IPS_SolSessionUsingPort IPS_TLSProvisioningRecord IPS_WatchDogAction".split(" "),disconnecturl=
|
|
null,currentView=0,LoadingHtml="<div style=text-align:center;padding-top:20px>Loading...<div>",amtversion=0,amtversionmin=0,amtFirstPull=0,amtwirelessif=-1,currentMeshNode=null,webcompilerfeatures="AgentPresence Alarms AuditLog Certificates ComputerSelectorToolbar EventLog EventSubscriptions FileSaver HardwareInfo Look-MeshCentral Mode-MeshCentral2 NetworkSettings PowerControl PowerControl-Advanced RemoteAccess Scripting Scripting-Editor Storage SystemDefense VersionWarning Wireless WsmanBrowser".split(" "),
|
|
StatusStrs=["Disconnected","Connecting...","Setup...","Connected"],scriptstate,t,t2,rsepass=null;
|
|
function startup(){var a=document.getElementsByTagName("input");for(t=0;t<a.length;t++)a[t].id&&(window[a[t].id]=a[t]);urlvars=getUrlVars();for(var b in AllWsman)a=document.createElement("option"),a.text=AllWsman[b],a.id="WSB-"+AllWsman[b],Q(22).add(a);document.addEventListener("dragover",haltEvent,!1);document.addEventListener("dragleave",haltEvent,!1);document.addEventListener("drop",documentFileSelectHandler,!1);Q("p16").addEventListener("dragover",haltEvent,!1);Q("p16").addEventListener("dragleave",
|
|
haltEvent,!1);Q("p16").addEventListener("drop",cert_FileSelectHandler,!1);document.onkeyup=handleKeyUp;document.onkeydown=handleKeyDown;document.onkeypress=handleKeyPress;window.onresize=center;center();scriptLoadStartingBlocks()}
|
|
function documentFileSelectHandler(a){haltEvent(a);if(null!=a.dataTransfer&&1==a.dataTransfer.files.length){var b=null,c=a.dataTransfer.files[0].name.toLowerCase();21==currentView?UploadToStorage(a.dataTransfer.files[0],c):(null!=wsstack&&(c.endsWith(".mescript")||c.endsWith(".meblocks"))&&(b=script_onScriptRead),null!=b&&(c=new FileReader,c.onload=b,c.readAsBinaryString(a.dataTransfer.files[0])))}}
|
|
function connectButtonfunction(){wsstack&&0!=wsstack.socketState?disconnect():meshcentral2credCallback()}function connectButtonfunctionEx(){currentMeshNode=parent.getCurrentNode();connect(currentMeshNode._id,16992,null,null,0);Q("xconnectbutton1").value="Disconnect"}function getCurrentMeshNode(){return currentMeshNode}function setConnectionState(a){QE("xconnectbutton1",a);0==a&&disconnect()}function setFrameHeight(a){}function setAuthCallback(a){meshcentral2credCallback=a}function cleanup(){}
|
|
function handleKeyUp(a){}function handleKeyDown(a){}function handleKeyPress(a){}var connectFunc=null,connectFuncTag=null;
|
|
function connect(a,b,c,d,g,n,r){go(0);fullscreenonly=!1;connectFunc=n;connectFuncTag=r;wsstack=WsmanStackCreateService(a,b,c,d,g);amtstack=AmtStackCreateService(wsstack);amtstack.onProcessChanged=onProcessChanged;for(a=2;25>a;a++)QV("go"+a,!1);QV("go8",!0);QV("go12",!0);QV("go20",!0);amtversion=amtversionmin=amtFirstPull=0;amtsysstate=amtdeltatime=amtlogicalelements=HardwareInventory=void 0;amtPowerBootCapabilities=null;xxAccountFetch=999;QH(15,LoadingHtml);QH(19,
|
|
LoadingHtml);amtwirelessif=-1;xxWireless=void 0;QH(20,"");QH(16,LoadingHtml);xxAccountAdminName=null;xxAccountRealmInfo={};QH(21,LoadingHtml);eventmessages=null;QH(17,"");QH(18,LoadingHtml);auditLog=null;QH(25,"");QH(26,LoadingHtml);xxCertificates=null;QH(27,LoadingHtml);QH(24,"");xxPolicies=xxMPSUserPass=xxRemoteAccessCredentiaLinks=xxUserInitiatedCira=xxCiraServers=
|
|
xxEnvironementDetection=xxRemoteAccess=null;QH(28,LoadingHtml);QH(30,LoadingHtml);xxSystemDefense=null;xxSystemDefenceLinkedPolicy={};xxUpdatingDefenseStats=!1;xxFilterStatistics=[{},{}];xxFilterStatisticsTimer=null;xxFilterStatisticsTimerActive=!1;QH(29,LoadingHtml);amtstack.BatchEnum("",["CIM_SoftwareIdentity","*AMT_SetupAndConfigurationService"],processSystemVersion);QV(11,!1);fupdatescript()}
|
|
function disconnect(){StopDefenseStatsTimer();script_Stop();breakScriptButton();dialogclose(0);amtstack&&(amtstack.onProcessChanged=null,amtstack.CancelAllQueries(999),amtstack=null);cleanup();wsstack=null;delete amtstack;onProcessChanged(0,1);go(101);Q("xconnectbutton1").value="Connect";QH(5,"Disconnected");go(100)}
|
|
function onProcessChanged(a,b){QS(3).width=100*a/b+"%";0==a&&refreshButtons(!0);0==a&&amtstack&&(0<amtversion&&0==(amtFirstPull&64)?(amtFirstPull|=64,PullPowerPolicy(),subscriptionsFilters=null,PullEventSubscriptions(),PullWatchdog(),scriptViewButton(script_BuildingBlocks?1:0),5<amtversion&&(PullCertificates(),PullRemoteAccess())):0==(amtFirstPull&1)?PullHardware():0==(amtFirstPull&16)?PullEventLog():0==(amtFirstPull&32)&&PullAuditLog())}
|
|
function checkAmtVersion(a){var b=a.split(".");a=parseInt(b[0]);var c=parseInt(b[1]),b=parseInt(b[2]),b=1E3*c+b,d=0;5>=a||12<=a?d=1:6==a&&2061<=b?d=1:7==a&&1091<=b?d=1:8==a&&1071<=b?d=1:9==a?5>c&&1041<=b?d=1:5061<=b&&(d=1):10==a&&55<=b?d=1:11==a&&(5>c&&25<=b?d=1:6027<=b&&(d=1));return 0==d}
|
|
function processSystemVersion(a,b,c,d){if(200==d||400==d){if(200==d){amtlogicalelements=[];null!=c&&null!=c.CIM_SoftwareIdentity&&null!=c.CIM_SoftwareIdentity.responses&&(amtlogicalelements=c.CIM_SoftwareIdentity.responses,null!=c.AMT_SetupAndConfigurationService&&null!=c.AMT_SetupAndConfigurationService.response&&amtlogicalelements.push(c.AMT_SetupAndConfigurationService.response));if(0==amtlogicalelements.length){console.error("ERROR: Could not get Intel AMT version.");disconnect();return}b=getInstance(amtlogicalelements,
|
|
"AMT").VersionString}else if(b=a.wsman.comm.amtVersion,!b){errcheck(400,a);return}amtversion=parseInt(b.split(".")[0]);amtversionmin=parseInt(b.split(".")[1]);QV(11,checkAmtVersion(b));PullSystemStatus();updateSystemStatus();1!=urlvars.kvmonly&&0==fullscreenonly&&(PullUserInfo(),8<=amtversion&&PullAlarms());connectFunc&&(connectFunc(connectFuncTag),connectFuncTag=connectFunc=null)}else errcheck(d,a)}var refreshButtonsState=!0;
|
|
function refreshButtons(a){if(refreshButtonsState!=a){refreshButtonsState=a;for(var b=0,c=document.getElementsByTagName("input");b<c.length;b++)"refreshbtn"==c[b].name&&(c[b].disabled=!a)}}function PullPowerState(){amtstack&&0==amtstack.GetPendingActions()&&amtsysstate&&amtsysstate.CIM_ServiceAvailableToElement&&amtstack.Enum("CIM_ServiceAvailableToElement",function(a,b,c,d){errcheck(d,a)||(amtsysstate.CIM_ServiceAvailableToElement.responses=c,updateSystemStatus())})}
|
|
function PullSystemStatus(a){refreshButtons(!1);amtstack.AMT_TimeSynchronizationService_GetLowAccuracyTimeSynch(processSystemTime);var b=["CIM_ServiceAvailableToElement","*AMT_GeneralSettings","AMT_EthernetPortSettings","*AMT_RedirectionService","CIM_ElementSettingData"];5<amtversion&&b.push("IPS_IPv6PortSettings","*CIM_KVMRedirectionSAP","*IPS_OptInService","*IPS_KVMRedirectionSettingData");9<amtversion&&b.push("*IPS_ScreenConfigurationService");amtstack.BatchEnum("",b,processSystemStatus,!0);1==
|
|
a&&PullWireless()}function processSystemTime(a,b,c,d){errcheck(d,a)||200!=d||(a=new Date,b=new Date,a.setTime(1E3*c.Body.Ta0+6E4*a.getTimezoneOffset()),amtdeltatime=a-b,updateSystemStatus())}var amtdeltatime,amtsysstate,amtlogicalelements,amtfeatures={};
|
|
function processSystemStatus(a,b,c,d){if(void 0==c.IPS_ScreenConfigurationService||400==c.IPS_ScreenConfigurationService.status)c.IPS_ScreenConfigurationService=null;if(void 0==c.IPS_KVMRedirectionSettingData||400==c.IPS_KVMRedirectionSettingData.status)c.IPS_KVMRedirectionSettingData=null;if(void 0==c.CIM_KVMRedirectionSAP||400==c.CIM_KVMRedirectionSAP.status)c.CIM_KVMRedirectionSAP=null;if(void 0==c.IPS_OptInService||400==c.IPS_OptInService.status)c.IPS_OptInService=null;void 0!=c.AMT_RedirectionService&&
|
|
200==c.AMT_RedirectionService.status&&QV("go13",!0);d=0;for(var g in c)null!=c[g]&&c[g].status>d&&(d=c[g].status);400!=d&&errcheck(d,a)||(amtsysstate=c,updateSystemStatus())}var DMTFPowerStates=";;Power on;Light sleep;Deep sleep;Power cycle (Soft off);Off - Hard;Hibernate (Off soft);Soft off;Power cycle (Off-hard);Master bus reset;Diagnostic interrupt (NMI);Not applicable;Off - Soft graceful;Off - Hard graceful;Master bus reset graceful;Power cycle (Off - Soft graceful);Power cycle (Off - Hard graceful);Diagnostic interrupt (INIT)".split(";");
|
|
function updateSystemStatus(){if(amtsysstate&&!(99<currentView)){var a=0,b,c,d=TableStart(),g="",n=amtsysstate.AMT_GeneralSettings.response;t="Unknown";null!=amtsysstate.CIM_ServiceAvailableToElement&&(t=DMTFPowerStates[amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState]);n.PowerSource&&(t+=[", Plugged-in",", On Battery"][n.PowerSource]);d+=TableEntry("Power",addLink(t,"showPowerActionDlg()"));b=n.HostName;c=n.DomainName;null!=c&&0<c.length&&(b+="."+c);b=0==b.length?"<i>None</i>":EscapeHtml(b);
|
|
d+=TableEntry("Name & Domain",addLinkConditional(b,"showEditNameDlg()",xxAccountAdminName));HardwareInventory&&(d+=TableEntry("System ID",guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));if(amtlogicalelements){var r="",u=getItem(amtlogicalelements,"CreationClassName","AMT_SetupAndConfigurationService");2==u.ProvisioningState&&5<amtversion&&(r=" activated in Admin Control Mode (ACM)",4==u.ProvisioningMode&&(r=" activated in Client Control Mode (CCM)",a=9));
|
|
d+=TableEntry("Intel® ME","v"+getItem(amtlogicalelements,"InstanceID","AMT").VersionString+r)}if(200==amtsysstate.AMT_RedirectionService.status){var r=amtfeatures[0]=1==amtsysstate.AMT_RedirectionService.response.ListenerEnabled,u=amtfeatures[1]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&2),m=amtfeatures[2]=0!=(amtsysstate.AMT_RedirectionService.response.EnabledState&1),l=amtfeatures[3]=void 0;5<amtversion&&null!=amtsysstate.CIM_KVMRedirectionSAP&&(l=amtfeatures[3]=6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState&&
|
|
2==amtsysstate.CIM_KVMRedirectionSAP.response.RequestedState||2==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState||6==amtsysstate.CIM_KVMRedirectionSAP.response.EnabledState);r&&(g+=", Redirection Port");u&&(g+=", Serial-over-LAN");m&&(g+=", IDE-Redirect");l&&(g+=", KVM");""==g&&(g=" None");d+=TableEntry("Active Features",addLinkConditional(g.substring(2),"showFeaturesDlg()",xxAccountAdminName))}null!=amtsysstate.IPS_KVMRedirectionSettingData&&amtsysstate.IPS_KVMRedirectionSettingData.response&&
|
|
(r=amtsysstate.IPS_KVMRedirectionSettingData.response,g="Primary display",7<amtversion&&void 0!==r.DefaultScreen&&255>r.DefaultScreen&&(g=["Primary display","Secondary display","3rd display"][r.DefaultScreen]),g='<span title="The default remote display is the '+g.toLowerCase()+'">'+g+"</span>",1==r.Is5900PortEnabled&&(g+=", Port 5900 enabled"),1==r.OptInPolicy&&(g+=", "+r.OptInPolicyTimeout+" second"+(0<r.OptInPolicyTimeout?"s":"")+" opt-in"),g+=", "+r.SessionTimeout+" minute"+(0<r.SessionTimeout?
|
|
"s":"")+" session timeout",9<amtversion&&null!=amtsysstate.IPS_ScreenConfigurationService&&0!=(amtsysstate.IPS_ScreenConfigurationService.response.EnabledState&1)&&(g+=", Blanking Allowed"),d+=TableEntry("Remote Desktop",g));5<amtversion&&null!=amtsysstate.IPS_OptInService&&void 0!=amtsysstate.IPS_OptInService.response&&(g="Unknown state",r=amtsysstate.IPS_OptInService.response.OptInRequired,0==r&&(g="Not Required"),1==r&&(g="Required for KVM only"),4294967295==r&&(g="Always Required"),1==amtsysstate.IPS_OptInService.response.CanModifyOptInPolicy&&
|
|
(g=addLinkConditional(g,"showConsentDlg()",xxAccountAdminName)),d+=TableEntry("User Consent",g));if(null!=AmtSystemPowerSchemes)for(g=amtsysstate.CIM_ElementSettingData.responses,r=0;r<g.length;r++)if(g[r].SettingData&&1==g[r].IsCurrent&&"http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemPowerScheme"==g[r].SettingData.ReferenceParameters.ResourceURI)for(u=g[r].SettingData.ReferenceParameters.SelectorSet.Selector[1].Value,m=0;m<AmtSystemPowerSchemes.length;m++)AmtSystemPowerSchemes[m].SchemeGUID==
|
|
u&&(d+=TableEntry("Power Policy",addLinkConditional(AmtSystemPowerSchemes[m].Description.split(":")[1],'showPowerPolicyDlg("'+u+'")',xxAccountAdminName)));amtdeltatime&&(d+=TableEntry("Date & Time",(new Date((new Date).getTime()+amtdeltatime)).toLocaleString()));g=AddRefreshButton("PullSystemStatus()")+" ";g+=AddButton("Power Actions...","showPowerActionDlg()")+" ";g+=AddButton("Save State...","saveEntireAmtState()")+" ";g+=AddButton("Run Script...","script_runScriptDlg()")+" ";d+=TableEnd(g);QH(15,
|
|
d);d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+TableEnd("<div> "+AddRefreshButton("PullSystemStatus(1)")+" Changing network settings may cause this page to becaume unavailable.");d=d+"<br><h2>General Settings</h2>"+TableStart();g="";"<i>None</i>"!=b&&(1==n.SharedFQDN&&(g=", shared with OS"),0==n.SharedFQDN&&(g=", different from OS"));d+=TableEntry("Name & Domain",addLinkConditional(b+g,"showEditNameDlg(1)",xxAccountAdminName));b="Disabled";1==n.DDNSUpdateEnabled?
|
|
b="Enabled each "+n.DDNSPeriodicUpdateInterval+" minutes, TTL is "+n.DDNSTTL+" minutes":1==n.DDNSUpdateByDHCPServerEnabled&&(b="Update by DHCP server");d+=TableEntry("Dynamic DNS",addLinkConditional(b,"showEditDnsDlg()",xxAccountAdminName));d+=TableEnd();for(c in amtsysstate.AMT_EthernetPortSettings.responses){b=amtsysstate.AMT_EthernetPortSettings.responses[c];if(b.WLANLinkProtectionLevel||1==c)amtwirelessif=c;if(0!=c||amtwirelessif==c||"00-00-00-00-00-00"!=b.MACAddress){0==c&&a++;d+="<br><h2>"+
|
|
(amtwirelessif==c?"Wireless":"Wired")+" Interface</h2>";d+=TableStart();d+=TableEntry("Link state",1==b.LinkIsUp?"Link is up":"Link is down");"00-00-00-00-00-00"!=b.MACAddress&&(d+=TableEntry("MAC address",b.MACAddress));amtwirelessif==c&&xxWireless&&xxWireless.CIM_WiFiPortCapabilities.response&&(d+=TableEntry("State",addLinkConditional(xxWifiState[xxWireless.CIM_WiFiPort.response.EnabledState],"showWifiStateDlg()",xxAccountAdminName)),s=xxWireless.CIM_WiFiEndpoint.response.LANID,d+=TableEntry("Radio State",
|
|
xxRadioState[xxWireless.CIM_WiFiEndpoint.response.EnabledState]+", SSID: "+(s?s:"<i>None</i>")));amtwirelessif!=c&&(d+=TableEntry("Respond to ping",addLinkConditional(["Disabled","ICMP response","RMCP response","ICMP & RMCP response"][n.PingResponseEnabled+(n.RmcpPingResponseEnabled<<1)],"showPingActionDlg()",xxAccountAdminName)),d+=TableEntry("IPv4 state",addLinkConditional(1==b.DHCPEnabled?"Automatic using DHCP server":"Static IP address","showIPSetupDlg()",xxAccountAdminName)));d+=TableEntry("IPv4 address",
|
|
isIpAddress(b.IPAddress,"None"));isIpAddress(b.DefaultGateway)&&(d+=TableEntry("IPv4 gateway / Mask",b.DefaultGateway+" / "+isIpAddress(b.SubnetMask,"None")));g=b.PrimaryDNS;isIpAddress(g)&&(b.SecondaryDNS&&(g+=" / "+b.SecondaryDNS),d+=TableEntry("IPv4 domain name server",g));if(200==amtsysstate.IPS_IPv6PortSettings.status&&5<amtversion){b=amtsysstate.IPS_IPv6PortSettings.responses[c];for(var u="Disabled",w,g=amtsysstate.CIM_ElementSettingData.responses,r=0;r<g.length;r++)g[r].SettingData&&g[r].SettingData.ReferenceParameters.SelectorSet.Selector.Value==
|
|
"Intel(r) IPS IPv6 Settings "+c&&(w=1==g[r].IsCurrent);1==w&&(g=isIpAddress(b.IPv6Address)||isIpAddress(b.DefaultRouter)||isIpAddress(b.PrimaryDNS)||isIpAddress(b.SecondaryDNS),u="Enabled, Automatic "+(g?"& manual":"")+" addresses");d+=TableEntry("IPv6 state",addLinkConditional(u,"showIPv6StateDlg("+c+","+w+")",xxAccountAdminName));if(1==w){if(b.CurrentAddressInfo&&0<b.CurrentAddressInfo.length){b.CurrentAddressInfo=MakeToArray(b.CurrentAddressInfo);ipv6addr="";for(r=0;r<b.CurrentAddressInfo.length;r++)0<
|
|
ipv6addr.length&&(ipv6addr+=", "),ipv6addr+=b.CurrentAddressInfo[r].split(",")[0];d+=TableEntry("IPv6 address",addLink(ipv6addr,"showIPv6AddrDlg("+c+',"'+b.CurrentAddressInfo+'")'))}else d+=TableEntry("IPv6 address","None");isIpAddress(b.CurrentDefaultRouter)&&(d+=TableEntry("IPv6 default router",b.CurrentDefaultRouter));isIpAddress(b.CurrentPrimaryDNS)&&(g=b.CurrentPrimaryDNS,isIpAddress(b.CurrentSecondaryDNS)&&(g+=" / "+b.CurrentSecondaryDNS),d+=TableEntry("IPv6 domain name server",g))}}d+=TableEnd()}}1!=
|
|
urlvars.kvmonly&&0==fullscreenonly&&(-1!=amtwirelessif&&0==(amtFirstPull&2)&&PullWireless(),QH(19,d),1==a&&0==(amtFirstPull&4)&&PullSystemDefense(),0==(amtFirstPull&8)&&(11<amtversion||11==amtversion&&5<amtversionmin)&&PullStorage());0==currentView&&go(1,1)}}function isIpAddress(a,b){return a&&null!=a&&0<a.length&&"::"!=a&&"::0"!=a?a:b}var IntelAmtEntireState,IntelAmtEntireStateCalls;
|
|
function saveEntireAmtState(){if(!xxdialogMode){var a="",b=new Date;amtsysstate&&(a="-"+amtsysstate.AMT_GeneralSettings.response.HostName);a+="-"+b.getFullYear()+"-"+("0"+(b.getMonth()+1)).slice(-2)+"-"+("0"+b.getDate()).slice(-2)+"-"+("0"+b.getHours()).slice(-2)+"-"+("0"+b.getMinutes()).slice(-2);c18.value="amtstate"+a+".json";setDialogMode(19,"Save Entire Intel® AMT State",3,saveEntireAmtStateOk)}}
|
|
function saveEntireAmtStateOk(){IntelAmtEntireState={webappversion:version,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()};QH(36,"Fetching entire state, please wait...");setDialogMode(1,"Save Entire Intel® AMT State",0,null);IntelAmtEntireStateCalls=3;amtstack.BatchEnum(null,AllWsman,saveEntireAmtStateOk2,null,!0);amtstack.GetAuditLog(saveEntireAmtStateOk3);amtstack.GetMessageLog(saveEntireAmtStateOk4)}
|
|
function saveEntireAmtStateOk2(a,b,c,d){IntelAmtEntireState.wsmanenums=c;saveEntireAmtStateDone()}function saveEntireAmtStateOk3(a,b){IntelAmtEntireState.auditlog=b;saveEntireAmtStateDone()}function saveEntireAmtStateOk4(a,b){IntelAmtEntireState.eventlog=b;saveEntireAmtStateDone()}function saveEntireAmtStateDone(){0==--IntelAmtEntireStateCalls&&(setDialogMode(),saveAs(data2blob(JSON.stringify(IntelAmtEntireState,null," ").replace(/\n/g,"\r\n")),c18.value))}
|
|
function PullEventLog(a){1==a&&xxdialogMode||(amtFirstPull|=16,amtstack.Enum("AMT_MessageLog",processMessageLog0),amtstack.GetMessageLog(processMessageLog1))}var processMessageLog0responses=null;
|
|
function processMessageLog0(a,b,c,d){200==d&&(d&&QV("go6",!0),c&&(processMessageLog0responses=c),a="",b="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>",null!=processMessageLog0responses&&(a=1==processMessageLog0responses[0].IsFrozen?AddButton("Un-freeze Log","FreezeLog(0)"):AddButton("Freeze Log","FreezeLog(1)")),b+=TableEnd("<div style=float:right><input id=eventFilter placeholder=Filter style=margin:4px onkeyup=eventFilter()> </div><div> "+AddRefreshButton("PullEventLog(1)")+
|
|
AddButton("Clear Log","ClearLog()")+AddButton("Save...","SaveEventLog()")+a),QH(17,b+"<br>"))}function SaveEventLog(){xxdialogMode||null==eventmessages||SaveJsonFile("IntelAmtEventlog","events","Intel AMT Event Log",eventmessages)}var eventmessages=null;
|
|
function processMessageLog1(a,b){eventmessages=b;var c,d=0,g;g="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:90px><b> Event</b><td class=r1 style=width:110px><b>Time</b><td class=r1 style=width:160px><b>Source</b><td class=r1><b>Description</b>";for(c in b){d++;var n=1,r=b[c];8<=r.EventSeverity&&(n=2);16<=r.EventSeverity&&(n=3);g+="<tr id=xamtevent"+c+" class=r3 onclick=showEventDetails("+
|
|
c+")><td class=r1><p><div class=icon"+n+" style=display:block;float:left;margin-left:5px;margin-right:5px></div>"+(parseInt(c)+1)+"<td class=r1 title='"+r.Time.toLocaleString()+"'>"+r.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br>"+r.Time.toLocaleTimeString("en",{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+r.EntityStr.replace("(r)","®")+"<td class=r1>"+r.Desc}g+=TableEnd(0==d?" ":"");QH(18,g+"<br>");processMessageLog0()}
|
|
function FreezeLog(a){xxdialogMode||amtstack.AMT_MessageLog_FreezeLog(a,function(){amtstack.Enum("AMT_MessageLog",processMessageLog0)})}function ClearLog(a){xxdialogMode||(QH(36,"Clear event log?"),setDialogMode(1,"Event Log",3,ClearLogEx))}function ClearLogEx(){amtstack.AMT_MessageLog_ClearLog(function(a,b,c,d){200!=d?messagebox("Event Log","Unable to clear, Error: "+d):PullEventLog()})}
|
|
function showEventDetails(a){if(!xxdialogMode){var b=eventmessages[a],c;c="<div style=text-align:left>"+addHtmlValue("Time",b.Time.toLocaleString());c+=addHtmlValue("Source",b.EntityStr.replace("(r)","®"));c+=addHtmlValue("Description",b.Desc);c+=MoreStart();c+=addHtmlValue("Device Address",b.DeviceAddress);c+=addHtmlValue("Entity",b.Entity);c+=addHtmlValue("Entity Instance",b.EntityInstance);var d="",g;for(g in b.EventData)0<d.length&&(d+=","),d+=b.EventData[g];c+=addHtmlValue("Data",d);c+=addHtmlValue("Offset",
|
|
b.EventOffset);c+=addHtmlValue("Sensor Type",b.EventSensorType);c+=addHtmlValue("Severity",b.EventSeverity);c+=addHtmlValue("Source Type",b.EventSourceType);c+=addHtmlValue("Type",b.EventType);c+=addHtmlValue("Sensor Number",b.SensorNumber);c+=MoreEnd();messagebox("Event #"+(a+1)+" Details",c+"</div>")}}
|
|
function eventFilter(){var a=Q("eventFilter").value.toLowerCase(),b;for(b in eventmessages)QV("xamtevent"+b,""==a||0<=eventmessages[b].Desc.toLowerCase().indexOf(a)||0<=eventmessages[b].EntityStr.toLowerCase().indexOf(a))}var subscriptionsFilters=null,subscriptionsListeners=null;
|
|
function PullEventSubscriptions(){null==subscriptionsFilters&&amtstack.Enum("CIM_FilterCollection",processEventSubscriptions0);amtstack.BatchEnum(null,["CIM_ListenerDestination","CIM_FilterCollectionSubscription"],processEventSubscriptions1)}function processEventSubscriptions0(a,b,c,d){408!=d&&400!=d&&(d&&errcheck(d,a)||(subscriptionsFilters=c))}
|
|
function processEventSubscriptions1(a,b,c,d){if(!(408==d||400==d||d&&errcheck(d,a))){d&&QV("go22",!0);c&&(subscriptionsListeners=c);b=0;a=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage event subscribers.<br><br>";for(var g in subscriptionsListeners.CIM_ListenerDestination.responses)c=subscriptionsListeners.CIM_FilterCollectionSubscription.responses[g].Filter.ReferenceParameters.SelectorSet.Selector.Value.replace("(r)","®"),d=subscriptionsListeners.CIM_ListenerDestination.responses[g],
|
|
a+="<div class=itemBar onclick='showSubscriptionDetails("+g+")'><div style=float:right></div><div style=padding-top:3px;overflow-x:hidden title='"+c+" - "+d.Destination+"'><b>"+c+"</b> - "+d.Destination+"</div><div style=padding-top:3px></div></div>",b++;0==b&&(a+="<div style=padding-left:15px><br><i>No subscriptions found.</i></div><br>");g="<div> "+AddRefreshButton("PullEventSubscriptions()");xxAccountAdminName&&(g+=AddButton("New Subscription","newSubscriptionButton()"));a+="<br><td class=r1>"+
|
|
TableEnd(g+"</div>");QH(32,a)}}var subscriptionDeliveryModes={2:"Push",3:"Push with ACK",4:"Events",5:"Pull"};
|
|
function showSubscriptionDetails(a){if(!xxdialogMode){var b=subscriptionsListeners.CIM_FilterCollectionSubscription.responses[a].Filter.ReferenceParameters.SelectorSet.Selector.Value.replace("(r)","®"),c=subscriptionsListeners.CIM_ListenerDestination.responses[a],d;d="<div style=text-align:left>"+addHtmlValue("Destination",c.Destination);d+=addHtmlValue("Filter",b);d+=addHtmlValue("Delivery Mode",subscriptionDeliveryModes[c.DeliveryMode]);setDialogMode(11,"Subscription "+(a+1),xxAccountAdminName?
|
|
5:1,deleteSubscriptionButton,d+"</div>",a)}}
|
|
function deleteSubscriptionButton(a,b){2==a&&amtstack.UnSubscribe("CIM_FilterCollectionSubscription",PullEventSubscriptions,null,1,{Filter:'<a:EndpointReference><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_FilterCollection</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+subscriptionsListeners.CIM_FilterCollectionSubscription.responses[b].Filter.ReferenceParameters.SelectorSet.Selector.Value+"</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference>",
|
|
Handler:'<a:EndpointReference><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ListenerDestinationWSManagement</w:ResourceURI><w:SelectorSet><w:Selector Name="CreationClassName">CIM_ListenerDestinationWSMAN</w:Selector><w:Selector Name="Name">'+subscriptionsListeners.CIM_ListenerDestination.responses[b].Name+'</w:Selector><w:Selector Name="SystemCreationClassName">CIM_ComputerSystem</w:Selector><w:Selector Name="SystemName">Intel(r) AMT</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference>'})}
|
|
function newSubscriptionButton(){if(!xxdialogMode&&null!=subscriptionsFilters){var a;a="<div style=height:26px;margin-top:4px><select id=subtype style=float:right;width:260px><option value=Push>Push</option><option value=PushWithAck>Push with ACK</option></select><div style=padding-top:4px>Type</div></div><div style=height:26px;margin-top:4px><select id=subfilter style=float:right;width:260px>";for(var b in subscriptionsFilters)a+="<option value='"+subscriptionsFilters[b].InstanceID+"'>"+subscriptionsFilters[b].CollectionName.substring(13)+
|
|
"</option>";a+="</select><div style=padding-top:4px>Filter</div></div>";a+="<div style=height:26px;margin-top:4px><input id=suburl style=float:right;width:260px maxlength=253 onkeyup=newSubscriptionUpdate() value='http://'><div style=padding-top:4px>URL</div></div>";a+="<div style=height:26px;margin-top:4px><select id=subauth style=float:right;width:260px onchange=newSubscriptionUpdate()><option value=0>None</option><option value=1>Digest</option></select><div style=padding-top:4px>Authentication</div></div>";
|
|
a+="<div style=height:26px;margin-top:4px id=subxuser><input id=subuser style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>Username</div></div>";a+="<div style=height:26px;margin-top:4px id=subxpass><input id=subpass style=float:right;width:260px maxlength=32 onkeyup=newSubscriptionUpdate()><div style=padding-top:4px>Password</div></div>";a+="<div style=height:26px;margin-top:4px><input id=subargs style=float:right;width:260px maxlength=128><div style=padding-top:4px>Arguments</div></div>";
|
|
setDialogMode(11,"Add Event Subscription",3,newSubscriptionButtonOk,a);newSubscriptionUpdate()}}function newSubscriptionUpdate(){QE("c37",0<Q("suburl").value.length&&Q("suburl").value.startsWith("http://")&&(0==Q("subauth").value||0<Q("subuser").value.length&&0<Q("subpass").value.length));QV("subxuser",1==Q("subauth").value);QV("subxpass",1==Q("subauth").value)}
|
|
function newSubscriptionButtonOk(){var a=0==Q("subuser").value.length?void 0:Q("subuser").value,b=0==Q("subpass").value.length?void 0:Q("subpass").value;amtstack.Subscribe("CIM_FilterCollection",Q("subtype").value,Q("suburl").value,newSubscriptionButtonOk2,null,1,{InstanceID:Q("subfilter").value},0<Q("subargs").value.length?Q("subargs").value:null,a,b)}function newSubscriptionButtonOk2(a,b,c,d){200==d&&PullEventSubscriptions()}
|
|
function PullAuditLog(a){1==a&&xxdialogMode||(amtFirstPull|=32,amtstack.Enum("AMT_AuditLog",processAuditLog0))}var auditLog=null,auditLogEnabledStates="Unknown;Other;Enabled;Disabled;Shutting Down;Not Applicable;Enabled but Offline;In Test;Deferred;Quiesce;Starting".split(";");
|
|
function processAuditLog0(a,b,c,d){200==d&&(QV("go15",!0),b=c[0].AuditState,a=b&1?"Disabled":"Enabled",b&2&&(a+=", Locked"),b&4&&(a+=", Almost Full"),b&8&&(a+=", Full"),b&16&&(a+=", NoKey"),b="<h1>Audit Log Settings</h1>"+TableStart(),b+=TableEntry("State",a),b+=TableEntry("Storage",c[0].CurrentNumberOfRecords+" record(s), "+c[0].PercentageFree+"% free"),b+=TableEntry("Overwrite policy",2==c[0].OverwritePolicy?"Wraps when full":"Never overwrites"),b+=TableEnd(),QH(25,b),amtstack.GetAuditLog(processAuditLog1))}
|
|
function processAuditLog1(a,b){auditLog=b;var c,d;d="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>"+(TableEnd("<div style=float:right><input id=auditFilter placeholder=Filter style=margin:4px onkeyup=auditFilter()> </div><div> "+AddRefreshButton("PullAuditLog(1)")+AddButton("Save...","SaveAuditLog()")+AddButton("Clear Log","ClearAuditLog()"))+"<br>");if(0==b.length)d="No audit log events found.";else{var g=0;d+="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=80px><p><td><td><td><tr><td class=r1 style=width:110px> <b>Time</b><td class=r1 style=width:260px><b>Initiator</b><td class=r1><b>Action</b>";
|
|
for(c in b){var n=b[c],r=n.AuditApp,u=n.Initiator;g++;var m="";0<n.NetAddress.length&&(m=n.NetAddress.replace("0000:0000:0000:0000:0000:0000:0000:0001","::1"));n.Event&&(r+=", "+n.Event);null!=n.ExStr&&(r+=", "+n.ExStr);""!=u&&""!=m&&(u+=", ");d+="<tr id=xamtaudit"+c+" class=r3 onclick=showAuditDetails("+c+")><td class=r1 title='"+n.Time.toLocaleString()+"'> "+n.Time.toLocaleDateString("en",{year:"numeric",month:"2-digit",day:"numeric"})+"<br> "+n.Time.toLocaleTimeString("en",
|
|
{hour:"2-digit",minute:"2-digit",second:"2-digit"})+"<td class=r1>"+u+m+"<td class=r1>"+r}d+=TableEnd(0==g?" ":"")+"<br>"}QH(26,d)}function auditFilter(){var a=Q("auditFilter").value.toLowerCase(),b;for(b in auditLog)QV("xamtaudit"+b,""==a||0<=JSON.stringify(auditLog[b]).toLowerCase().indexOf(a))}function SaveAuditLog(){xxdialogMode||null==auditLog||SaveJsonFile("IntelAmtAuditlog","auditevents","Intel AMT Audit Log",auditLog)}
|
|
function ClearAuditLog(a){QH(36,"Clear audit log?");setDialogMode(1,"Audit Log",3,ClearAuditLogEx)}function ClearAuditLogEx(){var a=amtstack.AMT_AuditLog_SetAuditLock(1,0,a,function(){amtstack.AMT_AuditLog_ClearLog(function(){amtstack.AMT_AuditLog_SetAuditLock(0,2,a,function(){setTimeout(PullAuditLog,1E3)})})})}function ShowAuditLogSettings(){xxdialogMode||amtstack.AMT_AuditLog_RequestStateChange(2,0,AuditLogSettingsCompleted)}
|
|
function AuditLogSettingsCompleted(a,b,c,d){200==d?PullAuditLog():messagebox("Audit Log","Error: "+d)}
|
|
function showAuditDetails(a){if(!xxdialogMode){var b,c=auditLog[a],d;d="<div style=text-align:left>"+addHtmlValue("Time",c.Time.toLocaleString());""!=c.Initiator&&(d+=addHtmlValue("Initiator",c.Initiator));""!=c.NetAddress&&(d+=addHtmlValue("Address",c.NetAddress));d+=addHtmlValue("Application",c.AuditApp);d+=addHtmlValue("Event",c.Event);if(null!=c.ExStr)d+=addHtmlValue("Extended Data",c.ExStr);else if(0<c.Ex.length){var g="";for(b in c.Ex)0<g.length&&(g+=","),g+=c.Ex.charCodeAt(b);""!=g&&(d+=addHtmlValue("Data Values",
|
|
g));2<c.Ex.length&&ReadShort(c.Ex,0)==c.Ex.length-2&&(d+=addHtmlValue("Data String",c.Ex.substring(2)))}messagebox("Audit Event #"+(a+1)+" Details",d+"</div>")}}var xxCertificates=null,xxCertPrivateKeys=null,xxTlsSettings=null,xxTlsCurrentCert=null,xxTLSCredentialContext=null,xxCaPrivateKey=null,xxCaSubjectAttributes=null;function PullCertificates(){amtstack.BatchEnum(null,["AMT_PublicKeyCertificate","AMT_PublicPrivateKeyPair","AMT_TLSSettingData","AMT_TLSCredentialContext"],processCerts1)}
|
|
function processCerts1(a,b,c,d){if(400!=d&&!errcheck(d,a)){QV("go16",!0);xxCertificates=c.AMT_PublicKeyCertificate.responses;xxCertPrivateKeys=c.AMT_PublicPrivateKeyPair.responses;xxTlsSettings=c.AMT_TLSSettingData.responses;xxTLSCredentialContext=c.AMT_TLSCredentialContext.responses;xxTlsCurrentCert=null;if(0<xxTLSCredentialContext.length){a=xxTLSCredentialContext[0].ElementInContext.ReferenceParameters.SelectorSet.Selector.Value;for(var g in xxCertificates)xxCertificates[g].InstanceID==a&&(xxTlsCurrentCert=
|
|
g)}for(g in xxCertificates)xxCertificates[g].TrustedRootCertficate=1==xxCertificates[g].TrustedRootCertficate,xxCertificates[g].X509Certificate=window.atob(xxCertificates[g].X509Certificate),xxCertificates[g].XIssuer=parseCertName(xxCertificates[g].Issuer),xxCertificates[g].XSubject=parseCertName(xxCertificates[g].Subject);amtcert_linkCertPrivateKey(xxCertificates,xxCertPrivateKeys);updateCertificates()}}
|
|
function parseCertName(a){var b={},c=a.split(","),d;for(d in c)a=c[d].indexOf("="),b[c[d].substring(0,a)]=c[d].substring(a+1);return b}
|
|
function getTlsSecurityState(a){if(0==xxTlsSettings[a].Enabled)return"Disabled";var b=(1==xxTlsSettings[a].MutualAuthentication?"Mutual-auth TLS":"Server-auth TLS")+(1==xxTlsSettings[a].AcceptNonSecureConnections?" and non-TLS":"");1==xxTlsSettings[a].MutualAuthentication&&xxTlsSettings[a].TrustedCN&&(a=MakeToArray(xxTlsSettings[a].TrustedCN),0<a.length&&(b+=", Trusted name"+(1<a.length?"s":"")+": "+a.join(", ")+"."));return b}
|
|
function updateCertificates(){if(null!=xxCertificates){var a="Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1,b=1-a,c=TableStart(),c=c+TableEntry("Remote TLS security",addLinkConditional(getTlsSecurityState(b),"showSetTlsSecurityDlg()",xxAccountAdminName)),c=c+TableEntry("Local TLS security",addLinkConditional(getTlsSecurityState(a),"showSetTlsSecurityDlg()",xxAccountAdminName)),c=c+TableEnd(),c=c+("<br>"+TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT certificates for this computer.<br><br>");
|
|
if(0==xxCertificates.length&&0==xxCertPrivateKeys.length)c+="<div style=padding-left:15px><br><i>No certificates found.</i></div><br>";else{for(var d in xxCertificates)a="",xxCertificates[d].TrustedRootCertficate&&(a=", Trusted Root"),xxCertificates[d].XPrivateKey&&(a=", Private Key"),d==xxTlsCurrentCert&&(a+=", TLS cert"),c+="<div class=itemBar onclick=showCertDetails("+d+")><div style=padding-top:3px><b>"+EscapeHtml(xxCertificates[d].XSubject.CN)+"</b><i>"+a+"</i></div></div>";for(d in xxCertPrivateKeys)xxCertPrivateKeys[d].XCert||
|
|
(c+="<div class=itemBar onclick=showKeyPairDetails("+d+")><div style=padding-top:3px><i>Unassigned Private Key Pair #"+d+"</i></div></div>")}d=AddRefreshButton("PullCertificates()");xxAccountAdminName&&(d+=AddButton("Add Certificate...","addCertButton()")+AddButton("Issue Certificate...","issueCertButton()"));c+="<br><td class=r1>"+TableEnd(d);QH(27,c)}}
|
|
function showKeyPairDetails(a){setDialogMode(11,"Key Pair #"+a,5,function(b){2==b&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertPrivateKeys[a].InstanceID},PullCertificates,0,1)},"This is a public/private certificate key pair that does not belong to any certificates. This entry should be temporary.")}var xxCertSubjectNames={CN:"Common Name",O:"Organization",OU:"Org Unit",S:"State/Province",ST:"State/Province",L:"Locality",C:"Country",SN:"Surname",GN:"Given name"};
|
|
function showCertDetails(a){if(!xxdialogMode){var b=xxCertificates[a],c;c="<br>"+addHtmlValue("Certificate",b.X509Certificate.length+" bytes, <a style=cursor:pointer;color:blue onclick=downloadCert("+a+")>Download</a>");c+=addHtmlValue("Trusted root",b.TrustedRootCertficate?"Yes":"No");0==b.TrustedRootCertficate&&b.XPrivateKey&&(c+=addHtmlValue("Private key","Present"));c+='<br><div style="border-bottom:1px solid gray"><i>Certificate Subject</i></div><br>';for(var d in b.XSubject)b.XSubject[d]&&(c+=
|
|
addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(b.XSubject[d])));c+='<br><div style="border-bottom:1px solid gray"><i>Issuer Certificate</i></div><br>';for(d in b.XIssuer)b.XIssuer[d]&&(c+=addHtmlValue(xxCertSubjectNames[d]?xxCertSubjectNames[d]:d,EscapeHtml(b.XIssuer[d])));setDialogMode(11,"Certificate - "+EscapeHtml(b.XSubject.CN),5,function(b){2==b&&(xxCertificates[a].XPrivateKey&&amtstack.Delete("AMT_PublicPrivateKeyPair",{InstanceID:xxCertificates[a].XPrivateKey.InstanceID},
|
|
function(){},0,1),amtstack.Delete("AMT_PublicKeyCertificate",xxCertificates[a],certificateRemoved,0,1))},c)}}function downloadCert(a){saveAs(data2blob(xxCertificates[a].X509Certificate),xxCertificates[a].XSubject.CN+".cer")}function cert_FileSelectHandler(a){haltEvent(a);1==a.dataTransfer.files.length&&(a.dataTransfer.files[0].name.toLowerCase().endsWith(".p12")?issueCertButton(a.dataTransfer.files):addCertButton(a.dataTransfer.files))}var xxDragDropCertFiles=null;
|
|
function addCertButton(a){!xxdialogMode&&xxAccountAdminName&&(xxDragDropCertFiles=a,a="<input id=certopen onchange=addCertButtonUpdate() type=file style=float:right;width:260px accept='.cer,.pem'>",xxDragDropCertFiles&&(a='<input style=float:right;width:260px readonly disabled value="'+xxDragDropCertFiles[0].name+'">'),a="<div style=height:10px></div>"+("<div style=height:26px;margin-top:4px>"+a+"<div style=padding-top:4px>Certificate file</div></div>")+"<div style=height:26px;margin-top:4px><select id=certtype style=float:right;width:260px><option value=0>Chain Certificate</option><option value=1>Trusted Root Certificate</option></select><div style=padding-top:4px>Certificate type</div></div>",
|
|
setDialogMode(11,"Add Certificate",3,addCertButtonOk,a),addCertButtonUpdate())}function addCertButtonUpdate(){var a=getInputElement("certopen");QE("c37",!a||1==a.files.length)}function addCertButtonOk(){var a=getInputElement("certopen"),b=xxDragDropCertFiles;a&&(b=a.files);b&&1==b.length&&(a=new FileReader,a.onload=addCertButtonOk2,a.readAsBinaryString(b[0]))}
|
|
function addCertButtonOk2(a){a=a.target.result;var b=a.indexOf("-----BEGIN CERTIFICATE-----");0<b?(a=a.substring(b+27),b=a.indexOf("-----END CERTIFICATE-----"),0<b&&(a=a.substring(0,b)),a=a.replace(/\r\n/g,"")):a=btoa(a);1==getSelectElement("certtype").value?amtstack.AMT_PublicKeyManagementService_AddTrustedRootCertificate(a,certificateAdded):amtstack.AMT_PublicKeyManagementService_AddCertificate(a,certificateAdded)}
|
|
function issueCertButton(a){!xxdialogMode&&xxAccountAdminName&&(xxDragDropCertFiles=a,a="<input id=certopen type=file style=float:right;width:230px onchange=issueCertButtonUpdate() accept='.p12'>",xxDragDropCertFiles&&(a='<input style=float:right;width:230px readonly disabled value="'+xxDragDropCertFiles[0].name+'">'),a=""+("<div styleheight:26px;margin-top:14px>"+a+"<div style=padding-top:4px>Certificate file</div></div>")+"<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certopenpass type=password autocomplete=off style=float:right;width:230px><div style=padding-top:4px>Certificate password</div></div>",
|
|
a+='<br><div style="border-bottom:1px solid gray"><i>Intel® AMT Certificate</i></div>',a+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certcn style=float:right;width:230px><div style=padding-top:4px>Common Name</div></div>",a+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certo style=float:right;width:230px><div style=padding-top:4px>Organization</div></div>",a+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certst style=float:right;width:230px><div style=padding-top:4px>State/Province</div></div>",
|
|
a+="<div style=height:26px;margin-top:4px><input onkeyup=issueCertButtonUpdate() id=certc style=float:right;width:230px><div style=padding-top:4px>Country</div></div>",a+='<div>Certificate Usages</div><ul style="list-style-type:none;height:100px;overflow:auto;width:100%;border: 1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">',a+="<li><label><input type=checkbox id=d11_cu4 checked>TLS Server (HTTPS)</label></li>",a+="<li><label><input type=checkbox id=d11_cu5>TLS Client (HTTPS)</label></li>",
|
|
a+="<li><label><input type=checkbox id=d11_cu6>Email Protection</label></li>",a+="<li><label><input type=checkbox id=d11_cu7>Code Signing</label></li>",a+="<li><label><input type=checkbox id=d11_cu8>Time Stamp</label></li>",a+="</ul>",setDialogMode(11,"Issue Certificate",3,issueCertButtonOk,a),issueCertButtonUpdate())}
|
|
function issueCertButtonUpdate(){var a=getInputElement("certopen");QE("certopenpass",!a||a&&1==a.files.length);var b=!a||2>a.files.length;1==(!a||a&&a.files.length)&&""==Q("certopenpass").value&&(b=!1);if(""==getInputElement("certcn").value||""==getInputElement("certo").value||""==getInputElement("certst").value||""==getInputElement("certc").value)b=!1;QE("c37",b)}
|
|
function issueCertButtonOk(){var a=getInputElement("certopen"),b=xxDragDropCertFiles;a&&(b=a.files);b&&1==b.length?(a=new FileReader,a.onload=issueCertButtonOk2,a.readAsBinaryString(b[0])):issueCertButtonOk3(null)}function issueCertButtonOk2(a){0==amtcert_loadP12File(a.target.result,Q("certopenpass").value,issueCertButtonOk3)&&messagebox("Issue Certificate","Unable to decrypt/decode certificate.")}
|
|
function issueCertButtonOk3(a,b,c){xxCaPrivateKey=a;xxCaSubjectAttributes=b;amtstack.AMT_PublicKeyManagementService_GenerateKeyPair(0,2048,GenerateKeyPairResponse)}
|
|
function GenerateKeyPairResponse(a,b,c,d){200!=d?messagebox("Issue Certificate","Failed to generate key pair. Status: "+d):0!=c.Body.ReturnValue?messagebox("Issue Certificate","Failed to generate key pair, "+c.Body.ReturnValueStr):amtstack.Enum("AMT_PublicPrivateKeyPair",GenerateKeyPairResponse2,c.Body.KeyPair.ReferenceParameters.SelectorSet.Selector.Value)}
|
|
function GenerateKeyPairResponse2(a,b,c,d,g){if(200!=d)messagebox("Issue Certificate","Failed to generate key pair. Status: "+d);else{a=null;for(var n in c)c[n].InstanceID==g&&(a=c[n].DERKey);c={CN:getInputElement("certcn").value,O:getInputElement("certo").value,ST:getInputElement("certst").value,C:getInputElement("certc").value};g={CN:"Untrusted Root Certificate"};if(null!=xxCaPrivateKey&&xxCaSubjectAttributes)for(n in g={},xxCaSubjectAttributes)g[xxCaSubjectAttributes[n].shortName]=xxCaSubjectAttributes[n].value;
|
|
n={name:"extKeyUsage"};Q("d11_cu4").checked&&(n.serverAuth=!0);Q("d11_cu5").checked&&(n.clientAuth=!0);Q("d11_cu6").checked&&(n.emailProtection=!0);Q("d11_cu7").checked&&(n.codeSigning=!0);Q("d11_cu8").checked&&(n.timeStamping=!0);n=amtcert_signWithCaKey(a,xxCaPrivateKey,c,g,n);null==n?messagebox("Issue Certificate","Unable to sign certificate."):(n=forge.pki.certificateToPem(n).replace(/(\r\n|\n|\r)/gm,""),amtstack.AMT_PublicKeyManagementService_AddCertificate(n.substring(27,n.length-25),GenerateKeyPairResponse4))}}
|
|
function GenerateKeyPairResponse4(a,b,c,d){200!=d?messagebox("Issue Certificate","Failed to generate key pair. Status: "+d):PullCertificates()}function certificateAdded(a,b,c,d){200!=d||0!=c.Body.ReturnValue?messagebox("Add Certificate","Unable to add certificate, error "+(200!=d?d:c.Body.ReturnValueStr)):PullCertificates()}function certificateRemoved(a,b,c,d){200!=d?messagebox("Remove Certificate","Unable to remove certificate, error "+d):PullCertificates()}
|
|
function getInputElement(a){var b=document.getElementsByTagName("input");for(t=0;t<b.length;t++)if(b[t].id==a)return b[t]}function getSelectElement(a){var b=document.getElementsByTagName("select");for(t=0;t<b.length;t++)if(b[t].id==a)return b[t]}
|
|
function showSetTlsSecurityDlg(a){if(!xxdialogMode){a="<div style=height:26px;margin-top:4px><select onchange=showSetTlsSecurityDlgUpdate() id=tlscert style=float:right;width:260px><option value=-1>No Certificate, TLS Disabled</option>";for(var b in xxCertificates)0!=xxCertificates[b].TrustedRootCertficate||!xxCertificates[b].XPrivateKey||null!=xxTlsCurrentCert&&xxTlsCurrentCert!=b||(a+="<option value="+b+">"+xxCertificates[b].XSubject.CN+"</option>");a+="</select><div style=padding-top:4px>Certificate</div></div><div style=height:26px;margin-top:4px><select id=tlsremote style=float:right;width:260px onchange=showSetTlsSecurityDlgUpdate()><option value=0>Server-auth TLS only</option><option value=1>Server-auth, non-TLS allowed</option>";
|
|
8>amtversion&&(a+="<option value=2>Mutual-auth TLS only</option><option value=3>Mutual-auth, non-TLS allowed</option>");a+="</select><div style=padding-top:4px>Security</div></div><div style=height:26px id=d11rcn title='Comma seperated list of certificate common names that will be allowed to connect remotely.'><input id=d11_rcn style=float:right;width:260px onkeyup=showSetTlsSecurityDlgUpdate() placeholder='name1, name2'><div style=padding-top:4px>Remote CN's</div></div>";setDialogMode(11,"TLS Settings",
|
|
3,showSetTlsSecurityDlgOk,a);if(0==xxTLSCredentialContext.length||0==xxTlsSettings[0].Enabled||0==xxTlsSettings[1].Enabled)getSelectElement("tlscert").value=-1;else for(b in a=xxTLSCredentialContext[0].ElementInContext.ReferenceParameters.SelectorSet.Selector.Value,xxCertificates)xxCertificates[b].InstanceID==a&&(getSelectElement("tlscert").value=b);b=1-("Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1);getSelectElement("tlsremote").value=(1==xxTlsSettings[b].MutualAuthentication?
|
|
2:0)+(1==xxTlsSettings[b].AcceptNonSecureConnections?1:0);xxTlsSettings[b].TrustedCN&&(Q("d11_rcn").value=MakeToArray(xxTlsSettings[b].TrustedCN).join(", "));showSetTlsSecurityDlgUpdate()}}function showSetTlsSecurityDlgUpdate(){var a=getSelectElement("tlscert").value;QE("tlsremote",-1!=a);QV("d11rcn",-1!=a&&1<getSelectElement("tlsremote").value);a=!0;1<getSelectElement("tlsremote").value&&!splitDomains(Q("d11_rcn").value)&&(a=!1);QE("c37",a)}var setTlsSecurityPendingCalls,setTlsSecurityDeleteCredentialContext;
|
|
function showSetTlsSecurityDlgOk(){var a=getSelectElement("tlscert").value,b=getSelectElement("tlsremote").value,c=Clone(xxTlsSettings);setTlsSecurityPendingCalls=0;setTlsSecurityDeleteCredentialContext=null;if(-1!=a){if(0<xxTLSCredentialContext.length){var d=Clone(xxTLSCredentialContext[0]);d.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value=xxCertificates[a].InstanceID;amtstack.Put("AMT_TLSCredentialContext",d,setTlsSecurityResponse,0,1)}else amtstack.Create("AMT_TLSCredentialContext",
|
|
{ElementInContext:"<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+amtstack.CompleteName("AMT_PublicKeyCertificate")+'</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+xxCertificates[a].InstanceID+"</w:Selector></w:SelectorSet></a:ReferenceParameters>",ElementProvidingContext:"<a:Address>/wsman</a:Address><a:ReferenceParameters><w:ResourceURI>"+amtstack.CompleteName("AMT_TLSProtocolEndpointCollection")+'</w:ResourceURI><w:SelectorSet><w:Selector Name="ElementName">TLSProtocolEndpointInstances Collection</w:Selector></w:SelectorSet></a:ReferenceParameters>'},
|
|
setTlsSecurityResponse);setTlsSecurityPendingCalls++}else 0<xxTLSCredentialContext.length&&(setTlsSecurityDeleteCredentialContext=Clone(xxTLSCredentialContext[0]));var d="Intel(r) AMT LMS TLS Settings"==xxTlsSettings[0].InstanceID?0:1,g=1-d;c[g].Enabled=-1!=a;c[g].MutualAuthentication=2<=b;c[g].AcceptNonSecureConnections=1==b%2;c[g].TrustedCN=splitDomains(Q("d11_rcn").value);c[d].Enabled=-1!=a;amtstack.Put("AMT_TLSSettingData",c[0],setTlsSecurityResponse,0,1,c[0]);amtstack.Put("AMT_TLSSettingData",
|
|
c[1],setTlsSecurityResponse,0,1,c[1]);setTlsSecurityPendingCalls+=2;statusbox("TLS Settings","Applying new security settings...")}function splitDomains(a){a=a.split(",");if(0!=a.length){for(var b in a)if(a[b]=a[b].trim(),0<=a[b].indexOf(" ")||0==a[b].length)return;if(!(4<a.length))return a}}
|
|
function setTlsSecurityResponse(a,b,c,d,g){200!=d?messagebox("","Failed to set TLS security, status = "+d):c.Body.ReturnValueStr&&!methodcheck(c)||0!=--setTlsSecurityPendingCalls||amtstack.AMT_SetupAndConfigurationService_CommitChanges(null,setTlsSecurityResponse2)}function setTlsSecurityResponse2(a,b,c,d){200!=d?messagebox("","Failed to set TLS security, status = "+d):setTimeout(setTlsSecurityResponse3,2E3)}
|
|
function setTlsSecurityResponse3(){null!=setTlsSecurityDeleteCredentialContext&&amtstack.Delete("AMT_TLSCredentialContext",setTlsSecurityDeleteCredentialContext,function(){});PullCertificates();setDialogMode()}var xxWatchdog=null;function PullWatchdog(){amtstack.BatchEnum(null,["*AMT_AgentPresenceCapabilities","AMT_AgentPresenceWatchdog","AMT_AgentPresenceWatchdogAction","AMT_StateTransitionCondition","CIM_ConcreteDependency"],PullWatchdogResponse)}
|
|
function PullWatchdogResponse(a,b,c,d){if(200==d&&200==c.AMT_AgentPresenceCapabilities.status){xxWatchdog=c;for(var g in xxWatchdog.CIM_ConcreteDependency.responses)a=xxWatchdog.CIM_ConcreteDependency.responses[g],(b=getItem(a.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","CreationClassName"))&&"AMT_AgentPresenceWatchdog"==b.Value&&(d=getItem(a.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","DeviceID").Value,c=getItem(a.Dependent.ReferenceParameters.SelectorSet.Selector,
|
|
"@Name","PolicyConditionName").Value,d=getItem(xxWatchdog.AMT_AgentPresenceWatchdog.responses,"DeviceID",d),c=getItem(xxWatchdog.AMT_StateTransitionCondition.responses,"PolicyConditionName",c),d.transitions||(d.transitions=[]),d.transitions.push(c)),b&&"AMT_StateTransitionCondition"==b.Value&&(c=getItem(a.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyConditionName").Value,a=getItem(a.Dependent.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyActionName").Value,c=getItem(xxWatchdog.AMT_StateTransitionCondition.responses,
|
|
"PolicyConditionName",c),a=getItem(xxWatchdog.AMT_AgentPresenceWatchdogAction.responses,"PolicyActionName",a),c.actions||(c.actions=[]),c.actions.push(a));updateWatchdog();QV("go19",!0)}}var watchdogEnabledStates="Unknown;Other;Enabled;Disabled;Shutting Down;Not Applicable;Enabled but Offline;In Test;Deferred;Quiesce;Starting".split(";"),watchdogMonitoredEntity="Unknown;Other;Operating System;Operating System Boot Process;Operating System Shutdown Process;Firmware Boot Process;BIOS Boot Process;Application;Service Processor".split(";");
|
|
function updateWatchdog(){if(null!=xxWatchdog){var a;a=""+TableStart();a+=TableEntry("Maximum Watchdogs",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalAgents+" watchdogs");a+=TableEntry("Maximum Total Actions",xxWatchdog.AMT_AgentPresenceCapabilities.response.MaxTotalActions+" actions");a+=TableEnd()+"<br>";a+=TableStart2();a+="<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT agent presence watchdogs.<br><br>";if(null==xxWatchdog.AMT_AgentPresenceWatchdog.responses||
|
|
0==xxWatchdog.AMT_AgentPresenceWatchdog.responses.length)a+="<div style=padding-left:15px><i>No agent presence watchdog found.</i></div><br>";else for(var b in xxWatchdog.AMT_AgentPresenceWatchdog.responses){var c=xxWatchdog.AMT_AgentPresenceWatchdog.responses[b],d=guidToStr(rstr2hex(atob(c.DeviceID)));c.MonitoredEntityDescription&&""!=c.MonitoredEntityDescription&&(d=EscapeHtml(c.MonitoredEntityDescription));a+="<div class=itemBar onclick=showWatchdogDetails("+b+")><input type=button style=float:right value='Add Action...' onclick=addWatchdogAction(event,"+
|
|
b+")>";c.transitions&&(a+="<input type=button style=float:right value='Delete Actions...' onclick=deleteWatchdogActions(event,"+b+")>");a+="<div style=padding-top:3px><b>"+d+"</b>, "+amtstack.WatchdogCurrentStates[c.CurrentState]+"</div>";var d="",g;for(g in c.transitions){var n=c.transitions[g];""!=d&&(d+="<br>");d+=getWatchdogTransitionStr(n.OldState)+" → "+getWatchdogTransitionStr(n.NewState);n.actions&&1==n.actions[0].EventOnTransition&&(d+=" : Event to log")}""!=d&&(a+="<div style=padding:12px>"+
|
|
d+"</div>");a+="</div>"}a=a+"<br>"+TableEnd(AddRefreshButton("PullWatchdog()")+AddButton("Add Watchdog...","AddWatchdog()"));a+="<br>";QH(30,a)}}function getWatchdogTransitionStr(a){if(31==a)return"Any State";var b="",c;for(c in amtstack.WatchdogCurrentStates)0!=(a&c)&&(b+=", "+amtstack.WatchdogCurrentStates[c]);return b.substring(2)}
|
|
function showWatchdogDetails(a){a=xxWatchdog.AMT_AgentPresenceWatchdog.responses[a];var b="";a.MonitoredEntityDescription&&""!=a.MonitoredEntityDescription&&(b+=addHtmlValue("Description",EscapeHtml(a.MonitoredEntityDescription)));b+=addHtmlValue("Monitored Entity",watchdogMonitoredEntity[a.MonitoredEntity]);b+=addHtmlValue("Current State",amtstack.WatchdogCurrentStates[a.CurrentState]);b+=addHtmlValue("Enabled State",watchdogEnabledStates[a.EnabledState]);b+=addHtmlValue("Startup Interval",a.StartupInterval+
|
|
" second(s)");b+=addHtmlValue("Timeout Interval",a.TimeoutInterval+" second(s)");setDialogMode(11,"Watchdog "+guidToStr(rstr2hex(atob(a.DeviceID))),5,showWatchdogDetailsOk,b,a)}function showWatchdogDetailsOk(a,b){2==a&&amtstack.Delete("AMT_AgentPresenceWatchdog",{DeviceID:b.DeviceID},PullWatchdog)}
|
|
function AddWatchdog(){var a;a="<div style=height:26px;margin-top:4px><input id=wgname style=float:right;width:240px maxlength=16 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Name</div></div>"+("<div style=height:26px;margin-top:4px><input id=wgguid style=float:right;width:240px maxlength=36 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px title='Generate random DeviceID'>"+addLink("DeviceID","GenerateWatchdogGuid()")+"</div></div>");a+="<div style=height:26px;margin-top:4px><input id=wgstart style=float:right;width:240px maxlength=8 placeholder=3600 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Startup (seconds)</div></div>";
|
|
a+="<div style=height:26px;margin-top:4px><input id=wgtimeout style=float:right;width:240px maxlength=8 placeholder=60 onkeyup=AddWatchdogUpdate()><div style=padding-top:4px>Timeout (seconds)</div></div>";setDialogMode(11,"Add Watchdog",3,AddWatchdogOk,a);AddWatchdogUpdate()}function GenerateWatchdogGuid(){var a,b="";for(a=0;16>a;a++)b+=String.fromCharCode(random(255));Q("wgguid").value=guidToStr(rstr2hex(b));AddWatchdogUpdate()}
|
|
function AddWatchdogUpdate(){for(var a=(""==Q("wgstart").value||0<parseInt(Q("wgstart").value))&&(""==Q("wgtimeout").value||0<parseInt(Q("wgtimeout").value)),b=0,c=Q("wgguid").value.toLowerCase(),d=0;d<c.length;d++){var g=c.charCodeAt(d);45!=g&&(48<=g&&57>=g||97<=g&&102>=g?b++:a=!1)}32!=b&&(a=!1);QE("dlgOkButton",a)}
|
|
function AddWatchdogOk(){var a=Q("wgtimeout").value,b=Q("wgstart").value;""==a&&(a=60);""==b&&(b=3600);a={CreationClassName:0,DeviceID:btoa(hex2rstr(guidToStr(Q("wgguid").value.replace(/-/g,"")).replace(/-/g,""))),StartupInterval:b,SystemCreationClassName:0,SystemName:0,TimeoutInterval:a,MonitoredEntityDescription:Q("wgname").value};amtstack.Create("AMT_AgentPresenceWatchdog",a,AddWatchdogOk2)}
|
|
function AddWatchdogOk2(a,b,c,d){200!=d?messagebox("Watchdog","Unable to add watchdog, error #"+d):PullWatchdog()}
|
|
function addWatchdogAction(a,b){var c=xxWatchdog.AMT_AgentPresenceWatchdog.responses[b],d;d="<table><td style=width:180px>From<br>";for(b in amtstack.WatchdogCurrentStates)d+="<input id=wgsa"+b+" type=checkbox onclick=addWatchdogActionUpdate()> "+amtstack.WatchdogCurrentStates[b]+"<br />";d+="<td>To<br>";for(b in amtstack.WatchdogCurrentStates)d+="<input id=wgsb"+b+" type=checkbox onclick=addWatchdogActionUpdate()> "+amtstack.WatchdogCurrentStates[b]+"<br />";setDialogMode(11,"Add Watchdog Action",
|
|
3,addWatchdogActionOk,d+"</table><br>Perform Action<br><input id=wgsevent type=checkbox checked onclick=addWatchdogActionUpdate()>Write to event log<br />",c);addWatchdogActionUpdate();haltEvent(a)}function addWatchdogActionUpdate(){var a=0,b=0,c;for(c in amtstack.WatchdogCurrentStates)1==Q("wgsa"+c).checked&&(a+=parseInt(c)),1==Q("wgsb"+c).checked&&(b+=parseInt(c));QE("dlgOkButton",0<a&&0<b&&1==Q("wgsevent").checked)}
|
|
function addWatchdogActionOk(a,b){var c=0,d=0,g;for(g in amtstack.WatchdogCurrentStates)1==Q("wgsa"+g).checked&&(c+=parseInt(g)),1==Q("wgsb"+g).checked&&(d+=parseInt(g));amtstack.AMT_AgentPresenceWatchdog_AddAction(c,d,Q("wgsevent").checked,null,null,AddWatchdogActionResponse,null,0,{DeviceID:b.DeviceID})}function AddWatchdogActionResponse(a,b,c,d){200!=d?messagebox("Watchdog Action","Unable to add watchdog action, error #"+d):PullWatchdog()}
|
|
function deleteWatchdogActions(a,b){setDialogMode(11,"Delete Watchdog Actions",3,deleteWatchdogActionsOk,"Delete all actions for this watchdog?",xxWatchdog.AMT_AgentPresenceWatchdog.responses[b]);haltEvent(a)}function deleteWatchdogActionsOk(a,b){amtstack.AMT_AgentPresenceWatchdog_DeleteAllActions(deleteWatchdogActionResponse,null,0,{DeviceID:b.DeviceID})}
|
|
function deleteWatchdogActionResponse(a,b,c,d){200!=d?messagebox("Watchdog Action","Unable to remove watchdog actions, error #"+d):PullWatchdog()}
|
|
var xxSystemDefense=null,xxSystemDefenceLinkedPolicy={},xxUpdatingDefenseStats=!1,xxFilterStatistics=[{},{}],xxFilterStatisticsTimer=null,xxFilterStatisticsTimerActive=!1,xxSystemDefenceFilterEthernetTypes={2048:"All IP Packets",2054:"All ARP Packets"},xxSystemDefenceFilterIPTypes={4:"IPv4",6:"IPv6"},xxSystemDefenceFilterDesc={0:"Allow, Count",1:"Drop, Count",2:"Rate limit",3:"Allow",4:"Drop"},xxSystemDefenceFilters={HdrProtocolID:1,HdrDestAddress:2,HdrDestMask:2,HdrSrcAddress:2,HdrSrcMask:2,HdrSrcPortStart:1,
|
|
HdrSrcPortEnd:1,HdrDestPortStart:1,HdrDestPortEnd:1,HdrSrcAddressEndOfRange:2,"HdrDestAddressEndOfRange ":2,TCPFlagsOn:3,TCPFlagsOff:3};function PullSystemDefense(){amtFirstPull|=4;amtstack.BatchEnum(null,["AMT_SystemDefensePolicy","AMT_NetworkPortSystemDefensePolicy","AMT_Hdr8021Filter","AMT_IPHeadersFilter","AMT_NetworkFilter"],PullSystemDefenseResponse)}function PullSystemDefenseResponse(a,b,c,d){200==d&&(xxSystemDefense=c,updateSystemDefense(),QV("go18",!0))}
|
|
function updateSystemDefense(){if(null!=xxSystemDefense){var a="";xxSystemDefenceLinkedPolicy={};for(var b in xxSystemDefense.AMT_NetworkPortSystemDefensePolicy.responses){var c=xxSystemDefense.AMT_NetworkPortSystemDefensePolicy.responses[b],d=+getItem(c.Antecedent.ReferenceParameters.SelectorSet.Selector,"@Name","DeviceID").Value.substring(27),c=getItem(xxSystemDefense.AMT_SystemDefensePolicy.responses,"InstanceID",c.Dependent.ReferenceParameters.SelectorSet.Selector.Value);xxSystemDefenceLinkedPolicy[d]=
|
|
c}a+=TableStart();b="<i>None</i>";xxSystemDefenceLinkedPolicy[0]&&(b=xxSystemDefenceLinkedPolicy[0].PolicyName);a+=TableEntry("Default Wired Policy",addLink(b,"changeDefaultPolicy(0)"));for(b=0;2>b;b++){var c=xxFilterStatistics[b],g;for(g in c)d=c[g],d=1==d?d+" packet":d+" packets",a+=TableEntry((0==b?"Wired ":"Wireless ")+g,d)}a+=TableEnd();a=a+"<br>"+TableStart2();a+="<tr><td class=r1 style=padding-left:15px;border:0><br>Manage Intel® AMT system defense policies.<br><br>";if(0==xxSystemDefense.AMT_SystemDefensePolicy.responses.length)a+=
|
|
"<div style=padding-left:15px><i>No system defense policies found.</i></div><br>";else for(b in xxSystemDefense.AMT_SystemDefensePolicy.responses)c=xxSystemDefense.AMT_SystemDefensePolicy.responses[b],d="",c.FilterCreationHandles&&(c.FilterCreationHandles=MakeToArray(c.FilterCreationHandles),d=c.FilterCreationHandles.length,d=", "+d+" filter"+(1<d?"s":"")),a+="<div class=itemBar onclick=showPolicyDetails("+b+")><div style=padding-top:3px><b>"+EscapeHtml(c.PolicyName)+"</b>"+d+"</div></div>";a+="<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT system defense filters.<br><br>";
|
|
if(0==xxSystemDefense.AMT_Hdr8021Filter.responses.length&&0==xxSystemDefense.AMT_IPHeadersFilter.responses.length)a+="<div style=padding-left:15px><i>No system defense filters found.</i></div><br>";else{for(b in xxSystemDefense.AMT_Hdr8021Filter.responses)c=xxSystemDefense.AMT_Hdr8021Filter.responses[b],(d=xxSystemDefenceFilterEthernetTypes[c.HdrProtocolID8021])||(d="All Ethernet Protocol "+c.HdrProtocolID8021),d+=", "+xxSystemDefenceFilterDesc[c.FilterProfile],2==c.FilterProfile&&(d+=" at "+c.FilterProfileData+
|
|
" packet / sec"),1==c.ActionEventOnMatch&&(d+=", Event on match"),a+="<div class=itemBar onclick=showFilterDetails(0,"+b+")><div style=padding-top:3px><b>"+(0==c.FilterDirection?"← ":"→ ")+EscapeHtml(c.Name)+"</b>, "+d+"</div></div>";for(b in xxSystemDefense.AMT_IPHeadersFilter.responses){c=xxSystemDefense.AMT_IPHeadersFilter.responses[b];(d=xxSystemDefenceFilterIPTypes[c.HdrIPVersion])||(d="All Ethernet Protocol "+c.HdrIPVersion);d+=", "+xxSystemDefenceFilterDesc[c.FilterProfile];2==
|
|
c.FilterProfile&&(d+=" at "+c.FilterProfileData+" packet / sec");1==c.ActionEventOnMatch&&(d+=", Event on match");var n=0;for(g in xxSystemDefenceFilters)c[g]&&n++;0<n&&(d+=", "+n+" filter"+(1<n?"s":""));a+="<div class=itemBar onclick=showFilterDetails(1,"+b+")><div style=padding-top:3px><b>"+(0==c.FilterDirection?"← ":"→ ")+EscapeHtml(c.Name)+"</b>, "+d+"</div></div>"}}a+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullSystemDefense()")+AddButton("Add Filter...","AddDefenseFilter()")+
|
|
AddButton("Add Policy...","AddDefensePolicy()"));QH(29,a);null==xxFilterStatisticsTimer&&(UpdateDefenseStats(),xxFilterStatisticsTimerActive=!1,urlvars.norefresh||(xxFilterStatisticsTimer=setInterval(UpdateDefenseStats,5E3)))}}function StopDefenseStatsTimer(){null!=xxFilterStatisticsTimer&&(clearInterval(xxFilterStatisticsTimer),xxFilterStatisticsTimer=null);xxFilterStatisticsTimerActive=!1}
|
|
function UpdateDefenseStats(a){if(a||1!=xxFilterStatisticsTimerActive)xxFilterStatisticsTimerActive=!0,a=a?a:0,xxSystemDefenceLinkedPolicy[a]?amtstack.AMT_SystemDefensePolicy_UpdateStatistics('<a:Address></a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</w:ResourceURI><w:SelectorSet><w:Selector Name="DeviceID">Intel(r) AMT Ethernet Port '+a+"</w:Selector></w:SelectorSet></a:ReferenceParameters>",!1,UpdateDefenseStats2,a,0,{InstanceID:xxSystemDefenceLinkedPolicy[a].InstanceID}):
|
|
(xxFilterStatistics[a]={},updateSystemDefense(),StopDefenseStatsTimer())}function UpdateDefenseStats2(a,b,c,d,g){200==d?amtstack.Enum("AMT_ActiveFilterStatistics",UpdateDefenseStats3,g):StopDefenseStatsTimer()}
|
|
function UpdateDefenseStats3(a,b,c,d,g){a=0;if(200==d){xxFilterStatistics[g]={};for(var n in c)d=c[n].ReadCount,b=getItem(c[n].Dependent.ReferenceParameters.SelectorSet.Selector[1].Value.EndpointReference.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value,xxFilterStatistics[g][b]=d,a++;updateSystemDefense()}xxFilterStatisticsTimerActive=!1;0==a&&StopDefenseStatsTimer()}
|
|
function changeDefaultPolicy(a){if(!xxdialogMode){var b;b="<div style=height:26px;margin-top:4px><select id=policySelection style=float:right;width:266px><option value=-1>None";for(var c in xxSystemDefense.AMT_SystemDefensePolicy.responses)b+="<option value="+c+(xxSystemDefenceLinkedPolicy[a]&&xxSystemDefense.AMT_SystemDefensePolicy.responses[c].InstanceID==xxSystemDefenceLinkedPolicy[a].InstanceID?" selected":"")+">"+xxSystemDefense.AMT_SystemDefensePolicy.responses[c].PolicyName;setDialogMode(11,
|
|
"Default System Defense Policy",3,changeDefaultPolicyOk,b+"</select><div style=padding-top:4px>Default Policy</div></div>",a)}}
|
|
function changeDefaultPolicyOk(a,b){var c=Q("policySelection").value,d=xxSystemDefenceLinkedPolicy[b];d&&amtstack.Delete("AMT_NetworkPortSystemDefensePolicy",'<w:SelectorSet><w:Selector Name="Antecedent"><a:EndpointReference xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</w:ResourceURI><w:SelectorSet><w:Selector Name="CreationClassName">CIM_EthernetPort</w:Selector><w:Selector Name="DeviceID">Intel(r) AMT Ethernet Port '+b+
|
|
'</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference></w:Selector><w:Selector Name="Dependent"><a:EndpointReference xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address><a:ReferenceParameters><w:ResourceURI>http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemDefensePolicy</w:ResourceURI><w:SelectorSet><w:Selector Name="InstanceID">'+
|
|
d.InstanceID+"</w:Selector></w:SelectorSet></a:ReferenceParameters></a:EndpointReference></w:Selector></w:SelectorSet>",-1==c?PullSystemDefense:function(){});0<=c&&amtstack.Create("AMT_NetworkPortSystemDefensePolicy",{Antecedent:'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_EthernetPort</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="DeviceID">Intel(r) AMT Ethernet Port '+
|
|
b+"</Selector></SelectorSet></ReferenceParameters>",Dependent:'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_SystemDefensePolicy</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">'+
|
|
xxSystemDefense.AMT_SystemDefensePolicy.responses[c].InstanceID+"</Selector></SelectorSet></ReferenceParameters>"},changeDefaultPolicyOk2)}function changeDefaultPolicyOk2(a,b,c,d){200!=d?messagebox("Default System Defense Policy","Unable to set policy, error "+d):PullSystemDefense()}
|
|
function AddDefenseFilter(){if(!xxdialogMode){var a;a="<div style=height:26px;margin-top:4px><input id=filtername style=float:right;width:260px maxlength=16 onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Name</div></div><div style=height:26px;margin-top:4px><select id=filtertype style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Ethernet IP Packet Filter<option value=1>Ethernet ARP Packet Filter<option value=2>IPv4 Packet Filter<option value=3>IPv6 Packet Filter</select><div style=padding-top:4px>Type</div></div>";a+=
|
|
'<div style=height:26px;margin-top:4px id=ipfilterdiv><input id=ipfilter style=float:right;width:260px placeholder="Optional Rules" onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Matching Rules</div></div>';a+="<div style=height:26px;margin-top:4px><select id=filterdir style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Outbound / Transmit<option value=1>Inbound / Receive</select><div style=padding-top:4px>Direction</div></div>";a+="<div style=height:26px;margin-top:4px><select id=filterprofile style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=0>Allow, Count<option value=1>Drop, Count<option value=2>Rate Limit<option value=3>Allow<option value=4>Drop</select><div style=padding-top:4px>Action</div></div>";
|
|
a+="<div style=height:26px;margin-top:4px id=filterdatadiv><input id=filterdata style=float:right;width:260px maxlength=8 onkeyup=AddDefenseFilterUpdate()><div style=padding-top:4px>Packets / second</div></div>";a+="<div style=height:26px;margin-top:4px><select id=filteraction style=float:right;width:266px onchange=AddDefenseFilterUpdate()><option value=false>Do Nothing<option value=1>Event on match</select><div style=padding-top:4px>Event Log</div></div>";setDialogMode(11,"Add System Defense Filter",
|
|
3,AddDefenseFilterOk,a);AddDefenseFilterUpdate()}}
|
|
function AddDefenseFilterOk(){if(1>=Q("filtertype").value){var a=0==Q("filtertype").value?2048:2054,b={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrProtocolID8021:a,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value};2==Q("filterprofile").value&&(b.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_Hdr8021Filter",b,AddDefenseFilterOk2)}else{var a=2==Q("filtertype").value?
|
|
4:6,b={"InstanceID ":0,Name:Q("filtername").value,CreationClassName:0,SystemName:0,SystemCreationClassName:0,HdrIPVersion:a,FilterProfile:Q("filterprofile").value,FilterDirection:Q("filterdir").value,ActionEventOnMatch:Q("filteraction").value},c=Q("ipfilter").value.split(","),d;for(d in c){var g=c[d].indexOf("="),n=c[d].substring(0,g),g=c[d].substring(g+1),r=xxSystemDefenceFilters[n];r||(n="Hdr"+n,r=xxSystemDefenceFilters[n]);r&&(2==r&&4==a?(g=g.split("."),4==g.length&&(b[n]=rstr2hex(String.fromCharCode(parseInt(g[0]),
|
|
parseInt(g[1]),parseInt(g[2]),parseInt(g[3]))))):b[n]=g)}2==Q("filterprofile").value&&(b.FilterProfileData=Q("filterdata").value);amtstack.Create("AMT_IPHeadersFilter",b,AddDefenseFilterOk2)}}function AddDefenseFilterUpdate(){var a=0<Q("filtername").value.length;a&&2==Q("filterprofile").value&&(a=parseInt(Q("filterdata").value),a=0<a&&4294967295>a);QE("c37",a);QV("filterdatadiv",2==Q("filterprofile").value);QV("ipfilterdiv",2<=Q("filtertype").value)}
|
|
function AddDefenseFilterOk2(a,b,c,d){200!=d?messagebox("Add System Defense Filter","Unable to add filter, error #"+d):PullSystemDefense()}
|
|
function showFilterDetails(a,b){if(!xxdialogMode){var c,d,g,n;0==a?(n="AMT_Hdr8021Filter",g="Ethernet Traffic",d=xxSystemDefense[n].responses[b],(c=xxSystemDefenceFilterEthernetTypes[d.HdrProtocolID8021])||(c="All Ethernet Protocol "+d.HdrProtocolID8021)):(n="AMT_IPHeadersFilter",g="IP Traffic",d=xxSystemDefense[n].responses[b],(c=xxSystemDefenceFilterIPTypes[d.HdrIPVersion])||(c="All IP Protocol "+d.HdrIPVersion));var r;r=""+addHtmlValue("Name",EscapeHtml(d.Name));r+=addHtmlValue("Type",g);r+=addHtmlValue("Matching Traffic",
|
|
c);r+=addHtmlValue("Direction",0==d.FilterDirection?"Outbound / Transmit":"Inbound / Receive");if(1==a)for(var u in xxSystemDefenceFilters)d[u]&&(c=u,g=d[u],a=xxSystemDefenceFilters[u],2==a&&4==g.length&&(g=hex2rstr(g),g=g.charCodeAt(0)+"."+g.charCodeAt(1)+"."+g.charCodeAt(2)+"."+g.charCodeAt(3)),c.startsWith("Hdr")&&(c=c.substring(3)),r+=addHtmlValue("Filter "+c,g));r+=addHtmlValue("Event on match",1==d.ActionEventOnMatch?"Yes":"No");setDialogMode(11,"Ethernet Filter #"+d.InstanceID,5,showFilterDetailsOk,
|
|
r,[n,d])}}function showFilterDetailsOk(a,b){2==a&&amtstack.Delete(b[0],b[1],deleteDefenseFilter)}function deleteDefenseFilter(a,b,c,d){200!=d?messagebox("Remove Filter","Unable to remove filter, make sure it's not in use."):PullSystemDefense()}var xxAddDefensePolicyFilters;
|
|
function AddDefensePolicy(){if(!xxdialogMode){xxAddDefensePolicyFilters=[];var a;a="<div style=height:26px;margin-top:4px><input id=policyname title='<policy name>:<policy precedence number>' style=float:right;width:260px maxlength=16 onkeyup=AddDefensePolicyUpdate()><div style=padding-top:4px>Name</div></div><div style=height:26px;margin-top:4px><select id=policytx title='Default action to take for outbound traffic' style=float:right;width:133px><option value=0>Allow<option value=1>Drop<option value=2>Allow,Count<option value=3>Drop,Count<option value=4>Allow,Count,Event<option value=5>Drop,Count,Event</select><select id=policyrx style=float:right;width:133px title='Default action to take for inbound traffic'><option value=0>Allow<option value=1>Drop<option value=2>Allow,Count<option value=3>Drop,Count<option value=4>Allow,Count,Event<option value=5>Drop,Count,Event</select><div style=padding-top:4px>Default TX / RX</div></div>";a+=
|
|
"<div id=policyFilters></div>";if(0<xxSystemDefense.AMT_Hdr8021Filter.responses.length||0<xxSystemDefense.AMT_IPHeadersFilter.responses.length){a+="<div style=height:26px;margin-top:4px><div style=float:right><select id=xfilter style=width:186px>";for(var b in xxSystemDefense.AMT_Hdr8021Filter.responses){var c=xxSystemDefense.AMT_Hdr8021Filter.responses[b];a+="<option value="+c.InstanceID+">"+c.Name}for(b in xxSystemDefense.AMT_IPHeadersFilter.responses)c=xxSystemDefense.AMT_IPHeadersFilter.responses[b],
|
|
a+="<option value="+c.InstanceID+">"+c.Name;a+="</select><input id=addFilterButton type=button value=Add style=width:80px onclick=addFilterButton()></div><div style=padding-top:4px>Add Filter</div></div>"}setDialogMode(11,"Add System Defense Policy",3,AddDefensePolicyOk,a);AddDefensePolicyUpdate()}}function addFilterButton(){0<=xxAddDefensePolicyFilters.indexOf(Q("xfilter").value)||(xxAddDefensePolicyFilters.push(Q("xfilter").value),AddDefensePolicyUpdate())}
|
|
function removeFilterButton(a){xxAddDefensePolicyFilters.splice(a,1);AddDefensePolicyUpdate()}
|
|
function AddDefensePolicyUpdate(){var a=0<Q("policyname").value.split(":")[0].length;QE("c37",a);if(0==xxAddDefensePolicyFilters.length)QH("policyFilters","<br><i>This policy contains no filters.</i><br><br>");else{var a="",b;for(b in xxAddDefensePolicyFilters)a+="<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Remove","removeFilterButton("+b+")")+"</div><div style=padding-top:3px;max-width:260px;overflow:hidden><b>"+GetFilterById(xxAddDefensePolicyFilters[b]).Name+
|
|
"</b></div></div>";QH("policyFilters",a)}}function GetFilterById(a){for(var b in xxSystemDefense.AMT_Hdr8021Filter.responses){var c=xxSystemDefense.AMT_Hdr8021Filter.responses[b];if(c.InstanceID==a)return c}for(b in xxSystemDefense.AMT_IPHeadersFilter.responses)if(c=xxSystemDefense.AMT_IPHeadersFilter.responses[b],c.InstanceID==a)return c}
|
|
function AddDefensePolicyOk(){var a=Q("policytx").value,b=Q("policyrx").value,c=0,d=Q("policyname").value.split(":");2==d.length&&(c=parseInt(d[1]));a={"InstanceID ":0,PolicyName:d[0],PolicyPrecedence:c,TxDefaultCount:1<a,TxDefaultDrop:1==a%2,TxDefaultMatchEvent:3<a,RxDefaultCount:1<b,RxDefaultDrop:1==b%2,RxDefaultMatchEvent:3<b};0<xxAddDefensePolicyFilters.length&&(a.FilterCreationHandles=xxAddDefensePolicyFilters);amtstack.Create("AMT_SystemDefensePolicy",a,AddDefensePolicyOk2)}
|
|
function AddDefensePolicyOk2(a,b,c,d){200!=d?messagebox("Add System Defense Policy","Unable to add policy, error #"+d):PullSystemDefense()}
|
|
function showPolicyDetails(a){if(!xxdialogMode){var b=xxSystemDefense.AMT_SystemDefensePolicy.responses[a],c;c=""+addHtmlValue("Name",EscapeHtml(b.PolicyName));0!=b.PolicyPrecedence&&(c+=addHtmlValue("Precedence",b.PolicyPrecedence));var d=1==b.TxDefaultDrop?"Drop":"Allow";1==b.TxDefaultCount&&(d+=", Count");1==b.TxDefaultMatchEvent&&(d+=", Event");c+=addHtmlValue("Default TX Action",d);d=1==b.RxDefaultDrop?"Drop":"Allow";1==b.RxDefaultCount&&(d+=", Count");1==b.RxDefaultMatchEvent&&(d+=", Event");
|
|
c+=addHtmlValue("Default RX Action",d);if(b.FilterCreationHandles)for(a in b.FilterCreationHandles)c+=addHtmlValue("Filter #"+(+a+1),GetFilterById(b.FilterCreationHandles[a]).Name);setDialogMode(11,"Policy #"+b.InstanceID.substring(20),5,showPolicyDetailsOk,c,b)}}function showPolicyDetailsOk(a,b){2==a&&amtstack.Delete("AMT_SystemDefensePolicy",b,deleteDefensePolicy)}
|
|
function deleteDefensePolicy(a,b,c,d){200!=d?messagebox("Remove Policy","Unable to remove policy, make sure it's not in use."):PullSystemDefense()}var xxWireless;function PullWireless(){amtFirstPull|=2;-1!=amtwirelessif&&amtstack.BatchEnum("",["*CIM_WiFiPortCapabilities","*CIM_WiFiPort","*CIM_WiFiEndpoint","CIM_WiFiEndpointSettings"],processWireless)}function wifiRefresh(){xxdialogMode||PullWireless()}
|
|
var xxWifiState={3:"Disabled",32768:"Enabled in S0",32769:"Enabled in S0, Sx/AC"},xxRadioState={2:"On, Connected",3:"Off",6:"On, Disconnected"},xxWifiAuthenticationMethod={1:"Other",2:"Open",3:"Shared Key",4:"WPA PSK",5:"WPA IEEE 802.1x",6:"WPA2 PSK",7:"WPA2 IEEE 802.1x"},xxWifiEncryptionMethod={1:"Other",2:"WEP",3:"TKIP-RC4",4:"CCMP-AES",5:"None"};function processWireless(a,b,c,d){xxWireless=200==d?c:void 0;updateSystemStatus();showWirelessInfo()}
|
|
function showWirelessInfo(){if(xxWireless){var a,b,c="",d,g;if(xxWireless.CIM_WiFiPortCapabilities.response){g="<br><h2>Wireless Profiles</h2>"+TableStart2();g+="<tr><td class=r2 style=padding-left:15px><br>Wireless profiles that Intel® AMT will use for network connectivity.<br><br>";for(a=c=0;256>a;a++)for(b in xxWireless.CIM_WiFiEndpointSettings.responses)d=xxWireless.CIM_WiFiEndpointSettings.responses[b],1!=d.AuthenticationMethod&&d.Priority==a&&(g+="<div class=itemBar onclick=showWifiDetails("+
|
|
b+")><div style=float:right>"+EscapeHtml(d.SSID)+", "+xxWifiAuthenticationMethod[d.AuthenticationMethod]+", "+xxWifiEncryptionMethod[d.EncryptionMethod]+" ",xxAccountAdminName&&(g+=AddButton2("Remove",'wifiRemoveButton("'+b+'")')),g+="</div><div style=padding-top:3px><b>"+EscapeHtml(d.ElementName)+"</b></div></div>",c++);0==c&&(g+="<i>No Wireless Profiles Present</i><br>");g+="<br><td class=r2>";g=xxAccountAdminName?g+TableEnd(AddButton("New Profile","showWifiNewProfile()")):g+TableEnd("");
|
|
QH(20,g+"<br>")}}}function showWifiStateDlg(){if(!xxdialogMode){var a="",b;for(b in xxWifiState)a+="<input type=radio name=d11 id=wl"+b+" value="+b+" "+(xxWireless.CIM_WiFiPort.response.EnabledState==b?"checked":"")+">"+xxWifiState[b]+"<br>";setDialogMode(11,"Wireless State",3,wifiStateDlg,a)}}
|
|
function wifiStateDlg(){amtstack.CIM_WiFiPort_RequestStateChange(document.querySelector("input[name=d11]:checked").value,null,function(){amtstack.Get("CIM_WiFiPort",function(a,b,c,d){200==d&&(xxWireless.CIM_WiFiPort.response=c.Body,showWirelessInfo())})})}
|
|
function showWifiDetails(a){if(!xxdialogMode){a=xxWireless.CIM_WiFiEndpointSettings.responses[a];var b;b="<div style=text-align:left>"+addHtmlValue("Profile Name",EscapeHtml(a.ElementName));b+=addHtmlValue("SSID",a.SSID);b+=addHtmlValue("Authentication",xxWifiAuthenticationMethod[a.AuthenticationMethod]);b+=addHtmlValue("Encryption",xxWifiEncryptionMethod[a.EncryptionMethod]);b+=addHtmlValue("Priority",a.Priority);messagebox("Wireless Profile",b+"</div>")}}
|
|
function wifiRemoveButton(a){xxdialogMode||(QH(36,'Remove wireless profile "'+xxWireless.CIM_WiFiEndpointSettings.responses[a].ElementName+'"?'),setDialogMode(1,"Wireless Profile",3,function(){removeWifiButtonEx(a)}))}function removeWifiButtonEx(a){amtstack.Delete("CIM_WiFiEndpointSettings",{InstanceID:xxWireless.CIM_WiFiEndpointSettings.responses[a].InstanceID},removeWifiEntryResponse,0,1)}
|
|
function removeWifiEntryResponse(a,b,c,d,g){methodcheck(c)||amtstack.Enum("CIM_WiFiEndpointSettings",function(a,b,c,d){200==d&&(xxWireless.CIM_WiFiEndpointSettings.responses=c,showWirelessInfo())})}
|
|
function showWifiNewProfile(){if(!xxdialogMode){var a="";for(i=1;256>i;i++){var b=1;for(j in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[j].Priority==i&&(b=0);b&&(a+="<option value="+i+">"+i)}QH("c13",a);c14.value=6;c15.value=4;c11.value=c12.value=c16.value=c17.value="";setDialogMode(12,"Add Wireless Profile",3,function(){addWifiProfile()});updateWifiDialog()}}
|
|
function addWifiProfile(){amtstack.AMT_WiFiPortConfigurationService_AddWiFiSettings({__parameterType:"reference",__resourceUri:amtstack.CompleteName("CIM_WiFiEndpoint"),Name:"WiFi Endpoint 0"},{__parameterType:"instance",__namespace:amtstack.CompleteName("CIM_WiFiEndpointSettings"),ElementName:c11.value,InstanceID:"Intel(r) AMT:WiFi Endpoint Settings "+c11.value,AuthenticationMethod:c14.value,EncryptionMethod:c15.value,SSID:c12.value,Priority:c13.value,
|
|
PSKPassPhrase:c16.value},null,null,null,removeWifiEntryResponse)}
|
|
function updateWifiDialog(){var a=!0,b=c14.value,c=c15.value;QV(42,4>b);QV(41,3<b);QV(40,3<b);QV(43,4>b);4>b&&(3==c||4==c)&&(c15.value=2);3<b&&(2==c||5==c)&&(c15.value=3);for(var d in xxWireless.CIM_WiFiEndpointSettings.responses)xxWireless.CIM_WiFiEndpointSettings.responses[d].ElementName==c11.value&&(a=!1);QE("c37",1==a&&0<c11.value.length&&0<c12.value.length&&7<c16.value.length&&c16.value==
|
|
c17.value)}function PullHardware(){amtstack.BatchEnum("","*CIM_ComputerSystemPackage CIM_SystemPackaging *CIM_Chassis CIM_Chip *CIM_Card *CIM_BIOSElement CIM_Processor CIM_PhysicalMemory CIM_MediaAccessDevice CIM_PhysicalPackage".split(" "),processHardware);amtFirstPull|=1}
|
|
var DMTFCPUStatus="Unknown;Enabled;Disabled by User;Disabled By BIOS (POST Error);Idle;Other".split(";"),DMTFMemType="Unknown;Other;DRAM;Synchronous DRAM;Cache DRAM;EDO;EDRAM;VRAM;SRAM;RAM;ROM;Flash;EEPROM;FEPROM;EPROM;CDRAM;3DRAM;SDRAM;SGRAM;RDRAM;DDR;DDR-2;BRAM;FB-DIMM;DDR3;FBD2;DDR4;LPDDR;LPDDR2;LPDDR3;LPDDR4".split(";"),DMTFMemFormFactor=";Other;Unknown;SIMM;SIP;Chip;DIP;ZIP;Proprietary Card;DIMM;TSOP;Row of chips;RIMM;SODIMM;SRIMM;FB-DIM".split(";"),DMTFProcFamilly={191:"Intel® Core™ 2 Duo Processor",
|
|
192:"Intel® Core™ 2 Solo processor",193:"Intel® Core™ 2 Extreme processor",194:"Intel® Core™ 2 Quad processor",195:"Intel® Core™ 2 Extreme mobile processor",196:"Intel® Core™ 2 Duo mobile processor",197:"Intel® Core™ 2 Solo mobile processor",198:"Intel® Core™ i7 processor",199:"Dual-Core Intel® Celeron® processor"},HardwareInventory;
|
|
function processHardware(a,b,c,d){if(200==d){var g;a="<table class=log1 cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px>";HardwareInventory=c;QV("go2",!0);a+=TableEnd("<div> "+AddRefreshButton("PullHardware(1)")+AddButton("Save...","SaveHardwareLog()")+" Hardware information is gathered at system boot time.");b=c.CIM_Chassis.response;d=c.CIM_Card.response;var n=c.CIM_BIOSElement.response.SoftwareElementID;a=a+"<br><h2>Platform</h2>"+FullTable({"Computer model":b.Model,Manufacturer:b.Manufacturer,
|
|
Version:b.Version,"Serial number":b.SerialNumber,"System ID":guidToStr(c.CIM_SystemPackaging.responses[0].PlatformGUID).toLowerCase()},"");a+="<br><h2>Baseboard</h2>";a+=FullTable({Manufacturer:d.Manufacturer,"Product name":d.Model,Version:d.Version,"Serial number":d.SerialNumber,"Asset tag":d.Tag,"Replaceable?":1==d.CanBeFRUed?"Yes":"No"},"");a+="<br><h2>BIOS</h2>";a+=FullTable({Vendor:c.CIM_BIOSElement.response.Manufacturer,Version:n,"Release date":(new Date(c.CIM_BIOSElement.response.ReleaseDate.Datetime)).toLocaleDateString("en",
|
|
{timeZone:"UTC"})},"");a+="<br>";for(g in c.CIM_Processor.responses)b=c.CIM_Processor.responses[g],d=c.CIM_Chip.responses[g],a+="<h2>Processor "+(parseInt(g)+1)+"</h2>",a+=FullTable({Manufacturer:trademarks(d.Manufacturer),Family:DMTFProcFamilly[b.Family],Version:trademarks(d.Version),"Maximum socket speed":b.MaxClockSpeed+" MHz",Status:DMTFCPUStatus[b.CPUStatus]},"");a+="<br>";for(g in c.CIM_PhysicalMemory.responses)b=c.CIM_PhysicalMemory.responses[g],a+="<h2>Memory Module "+(+g+1)+"</h2>",a+=FullTable({"Bank Label":b.BankLabel,
|
|
Manufacturer:b.Manufacturer,"Serial Number":b.SerialNumber,Size:parseInt(b.Capacity/1048576)+" MB","Form factor":DMTFMemFormFactor[b.FormFactor],Type:DMTFMemType[b.MemoryType],"Asset tag":b.Tag,"Part number":b.PartNumber},"");a+="<br>";for(g in c.CIM_MediaAccessDevice.responses)b=c.CIM_MediaAccessDevice.responses[g],d=c.CIM_PhysicalPackage.responses[+g+1],a+="<h2>Storage Media "+(parseInt(g)+1)+"</h2>",a+=FullTable({Model:d.Model,"Serial number":""==d.SerialNumber?"Unknown":d.SerialNumber,Size:parseInt(Math.round(1E3*
|
|
b.MaxMediaSize/1048576))+" MB"},"");a+="<br>";QH(16,a);updateSystemStatus()}}function SaveHardwareLog(){!xxdialogMode&&HardwareInventory&&SaveJsonFile("IntelAmtHardware","hardware","Intel AMT Hardware Information",HardwareInventory)}var AmtSystemPowerSchemes=null;function PullPowerPolicy(){amtstack.Enum("AMT_SystemPowerScheme",powerPolicyResponse)}function powerPolicyResponse(a,b,c,d){AmtSystemPowerSchemes=c;updateSystemStatus()}
|
|
function showPowerPolicyDlg(a){if(!xxdialogMode){for(var b="",c=0;c<AmtSystemPowerSchemes.length;c++)b+='<input type=radio name=powerpolicy value="'+AmtSystemPowerSchemes[c].InstanceID+'" '+(AmtSystemPowerSchemes[c].SchemeGUID==a?" checked":"")+">"+AmtSystemPowerSchemes[c].Description+"<br>";setDialogMode(11,"Intel® AMT Power Policy",3,showPowerPolicyDlgOk,b)}}
|
|
function showPowerPolicyDlgOk(){for(var a=null,b=0,c=document.getElementsByTagName("input");b<c.length;b++)"powerpolicy"==c[b].name&&c[b].checked&&(a=c[b].value);amtstack.AMT_SystemPowerScheme_SetPowerScheme(showPowerPolicyDlgOkDone,a)}function showPowerPolicyDlgOkDone(a,b,c,d){200==d&&PullSystemStatus()}var xxAccountAdminName,xxAccountRealmInfo,xxAccountEnabledInfo={},xxAccountFetch,showHiddenAccounts=!1;
|
|
function PullUserInfo(){xxAccountFetch=1;delete xxAccountAdminName;xxAccountRealmInfo={};amtstack.AMT_AuthorizationService_GetAdminAclEntry(getAdminAclEntryResponse);amtstack.AMT_AuthorizationService_EnumerateUserAclEntries(1,enumerateUserAclEntriesResponse)}function getAdminAclEntryResponse(a,b,c,d){200==d&&(xxAccountRealmInfo[-1]={AccessPermission:999,DigestUsername:c.Body.Username,Realms:null},xxAccountAdminName=c.Body.Username,updateAccounts())}
|
|
function enumerateUserAclEntriesResponse(a,b,c,d){if(200==d){methodcheck(c);QV("go11",!0);xxAccountFetch=c.Body.Handles.length;for(var g in c.Body.Handles)a=c.Body.Handles[g],amtstack.AMT_AuthorizationService_GetAclEnabledState(a,getAclEnabledStateResponse,a),amtstack.AMT_AuthorizationService_GetUserAclEntryEx(a,getUserAclEntryExResponse,a);updateAccounts()}}
|
|
function getUserAclEntryExResponse(a,b,c,d,g){xxAccountFetch--;200==d&&(c.Body.Handle=g,c.Body.Realms?Array.isArray(c.Body.Realms)||(c.Body.Realms=[c.Body.Realms]):c.Body.Realms=[],xxAccountRealmInfo[g]=c.Body,updateAccounts())}function getAclEnabledStateResponse(a,b,c,d,g){200==d&&(xxAccountEnabledInfo[g]=c.Body,updateAccounts())}function setAclEnabledStateResponse(a,b,c,d,g){errcheck(d,a)||(methodcheck(c),amtstack.AMT_AuthorizationService_GetAclEnabledState(g,getAclEnabledStateResponse,g))}
|
|
function updateAccounts(){if(!(0<xxAccountFetch)){var a=TableStart2(),a=a+"<tr><td class=r1 style=padding-left:15px><br>Manage the Intel® AMT user accounts for this computer.<br><br>",b;for(b in xxAccountRealmInfo){var c=xxAccountRealmInfo[b],d,g=!1,n=0;c.DigestUsername?(d=c.DigestUsername,g="$"==d[0]&&"$"==d[1]):d=GetSidString(atob(c.KerberosUserSid));xxAccountEnabledInfo[b]&&"$$OsAdmin"!=d&&(n=1==xxAccountEnabledInfo[b].Enabled?1:2);if(showHiddenAccounts||!g){var r="";if(999!=c.AccessPermission){2==
|
|
n&&(r+="Disabled, ");var u=0;for(b in c.Realms)""!=amtstack.RealmNames[c.Realms[b]]&&u++;0<=c.Realms.indexOf(20)&&(r+="Auditor, ");r=0<=c.Realms.indexOf(3)?r+"Administrator":1==u?r+"1 realm":r+(u+" realms")}else r+="Administrator",c.Handle=-1;a+="<div class=itemBar onclick=showUserDetails("+c.Handle+")><div style=float:right>";0<n&&xxAccountAdminName&&(a+=" "+AddButton2(1==n?"Disable":"Enable","changeAccountStateButton(event,"+c.Handle+","+n+")"));!g&&xxAccountAdminName&&(a+=" "+AddButton2("Edit...",
|
|
"changeAccountButton(event,"+c.Handle+")"));a+="</div><div style=padding-top:3px;width:330px;float:left;overflow-x:hidden title='"+d+"'><b>"+d+"</b></div><div style=padding-top:3px>"+r+"</div></div>"}}b="<div style=float:right;margin-right:8px><a title='Toggle hidden accounts' style=color:gray;cursor:pointer onclick=toggleAccountButton()>"+(showHiddenAccounts?"▲":"▼")+"</a></div><div> "+AddRefreshButton("xxAccountFetch=999;PullUserInfo()");xxAccountAdminName&&(b+=AddButton("New Account",
|
|
"newAccountButton()"));a+="<br><td class=r1>"+TableEnd(b+"</div>");QH(21,a)}}function toggleAccountButton(){showHiddenAccounts=!showHiddenAccounts;updateAccounts()}function removeUserAclEntryResponse(a,b,c,d,g){methodcheck(c)||PullUserInfo()}function changeAccountStateButton(a,b,c){haltEvent(a);xxdialogMode||amtstack.AMT_AuthorizationService_SetAclEnabledState(b,1==c?!1:!0,setAclEnabledStateResponse,b)}
|
|
function changeAccountButton(a,b){haltEvent(a);xxdialogMode||(updateRealms(xxAccountRealmInfo[b].Realms),d2username.value=xxAccountRealmInfo[b].DigestUsername?xxAccountRealmInfo[b].DigestUsername:GetSidString(atob(xxAccountRealmInfo[b].KerberosUserSid)),d2password1.value=d2password2.value="",d2permission.value=xxAccountRealmInfo[b].AccessPermission,setDialogMode(2,"Edit Account",-1==b?3:7,function(a){changeAccountButtonEx(b,a)}),updateAccountDialog())}
|
|
function newAccountButton(){xxdialogMode||(updateRealms([]),d2username.value=d2password1.value=d2password2.value="",d2permission.value=2,setDialogMode(2,"New Account",3,function(){changeAccountButtonEx(null,1)}),updateAccountDialog())}
|
|
function changeAccountButtonEx(a,b){if(1==b){var c=[],d=d2username.value,g=d2permission.value,n=d2password1.value,r=GetSidByteArray(Q("d2username").value),u=null;if(0==d.length||n!=d2password2.value){messagebox("Account Error","Invalid Parameters");return}null==r?u=window.btoa(rstr_md5(d+":"+amtsysstate.AMT_GeneralSettings.response.DigestRealm+":"+n)):(d=null,r=btoa(r));if(-1!=a)for(var m in amtstack.RealmNames)(amtstack.RealmNames[m]||3==m)&&Q("rx"+m).checked&&c.push(m);null==a?amtstack.AMT_AuthorizationService_AddUserAclEntryEx(d,
|
|
u,r,g,c,userAclEntryExResponse):-1==a?amtstack.AMT_AuthorizationService_SetAdminAclEntryEx(d,u,userAclEntryExResponse):amtstack.AMT_AuthorizationService_UpdateUserAclEntryEx(a,d,u,r,g,c,userAclEntryExResponse)}2==b&&amtstack.AMT_AuthorizationService_RemoveUserAclEntry(a,removeUserAclEntryResponse)}function userAclEntryExResponse(a,b,c,d,g){methodcheck(c)||PullUserInfo()}
|
|
function updateRealms(a){QV(37,null!=a);if(null!=a){var b="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx3"+(0<=a.indexOf(3)?" checked":"")+">Administrator</label></li><hr />",c;for(c in amtstack.RealmNames){var d="";0<=a.indexOf(parseInt(c))&&(d=" checked");amtstack.RealmNames[c]&&(b+="<li><label><input type=checkbox onchange=updateAccountDialog() id=rx"+c+d+">"+amtstack.RealmNames[c]+"</label></li>")}QH(38,b)}}
|
|
function updateAccountDialog(){var a=!1,b;for(b in amtstack.RealmNames)(amtstack.RealmNames[b]||3==b)&&Q("rx"+b).checked&&(a=!0);a&=0<d2username.value.length&&passwordcheck(d2password1.value)&&d2password1.value==d2password2.value;QE("c37",a)}var xxUserPermissions=["Local only","Network only","All (Local & Network)"];
|
|
function showUserDetails(a){if(!xxdialogMode){var b=xxAccountRealmInfo[a],c="<div style=text-align:left>",d,g=b.DigestUsername;g||(g=GetSidString(atob(b.KerberosUserSid)));c+=addHtmlValue("Name",g);xxAccountEnabledInfo[a]&&(c+=addHtmlValue("State",1==xxAccountEnabledInfo[a].Enabled?"Enabled":"Disabled"));if(g==xxAccountAdminName)c+=addHtmlValue("Permission","Administrator");else{var c=c+addHtmlValue("Permission",xxUserPermissions[b.AccessPermission]),n="";if(0<=b.Realms.indexOf(3))n="Administrator",
|
|
0<=b.Realms.indexOf(20)&&(n+=", Auditor");else for(d in xxAccountRealmInfo[a].Realms)""!=amtstack.RealmNames[b.Realms[d]]&&(0<n.length&&(n+=", "),n+=amtstack.RealmNames[b.Realms[d]]);0==n.length&&(n="None");c+=addHtmlValue("Realms","")+"<b>"+n+"</b>"}messagebox("Account "+g,c+"</div>")}}
|
|
function wsmanQuery(){QH(24,"");var a=getSelectedOptions(Q(22)),b=[],c;for(c in a)""==QS("WSB-"+a[c]).display&&b.push(a[c]);0!=b.length&&(QE(23,!1),b&&0<b.length&&amtstack.BatchEnum("Browser",b,browserResponse,null,!0))}
|
|
function browserResponse(a,b,c,d){QE(23,!0);a="";for(var g in c)b=c[g],a+="<h2>"+g+"</h2><div style=margin-left:20px>",a=200==b.status?0==b.responses.length?a+"<br>(Empty)":a+ObjectToString(b.responses).replace(/Intel\(r\)/g,"Intel®"):a+("<br><div style=color:red>Error #"+b.status+"</div>"),a+="</div><br>";QH(24,a)}
|
|
function wsmanFilter(){var a=c0.value.toLowerCase(),b;for(b in AllWsman)QV("WSB-"+AllWsman[b],""==a||0<=AllWsman[b].toLowerCase().indexOf(a))}var xxRemoteAccess=null,xxEnvironementDetection=null,xxCiraServers=null,xxUserInitiatedCira=null,xxUserInitiatedEnabledState={32768:"Disabled",32769:"BIOS enabled",32770:"OS enable",32771:"BIOS & OS enabled"},xxRemoteAccessCredentiaLinks=null,xxMPSUserPass=null,xxPolicies=null;
|
|
function PullRemoteAccess(){var a="*AMT_EnvironmentDetectionSettingData AMT_ManagementPresenceRemoteSAP AMT_RemoteAccessCredentialContext AMT_RemoteAccessPolicyAppliesToMPS AMT_RemoteAccessPolicyRule *AMT_UserInitiatedConnectionService AMT_MPSUsernamePassword".split(" ");11<amtversion&&a.push("*IPS_HTTPProxyService","IPS_HTTPProxyAccessPoint");amtstack.BatchEnum(null,a,processRemote1)}
|
|
function processRemote1(a,b,c,d){if(400!=d&&!errcheck(d,a)&&void 0!=c.AMT_UserInitiatedConnectionService&&void 0!=c.AMT_UserInitiatedConnectionService.response){QV("go17",!0);xxRemoteAccess=c;xxEnvironementDetection=c.AMT_EnvironmentDetectionSettingData.response;xxEnvironementDetection.DetectionStrings=MakeToArray(xxEnvironementDetection.DetectionStrings);xxCiraServers=c.AMT_ManagementPresenceRemoteSAP.responses;xxUserInitiatedCira=c.AMT_UserInitiatedConnectionService.response;xxRemoteAccessCredentiaLinks=
|
|
c.AMT_RemoteAccessCredentialContext.responses;xxMPSUserPass=c.AMT_MPSUsernamePassword.responses;xxPolicies={User:[],Alert:[],Periodic:[]};for(var g in c.AMT_RemoteAccessPolicyAppliesToMPS.responses)b=c.AMT_RemoteAccessPolicyAppliesToMPS.responses[g],a=Clone(getItem(xxCiraServers,"Name",getItem(b.ManagedElement.ReferenceParameters.SelectorSet.Selector,"@Name","Name").Value)),a.MpsType=b.MpsType,b=getItem(b.PolicySet.ReferenceParameters.SelectorSet.Selector,"@Name","PolicyRuleName").Value.split(" ")[0],
|
|
xxPolicies[b].push(a);updateRemoteAccess()}}
|
|
function updateRemoteAccess(){if(null!=xxEnvironementDetection){var a,b="Disabled",c=xxRemoteAccess.IPS_HTTPProxyService&&xxRemoteAccess.IPS_HTTPProxyAccessPoint;xxEnvironementDetection.DetectionStrings&&0<xxEnvironementDetection.DetectionStrings.length&&(b="Enabled, "+xxEnvironementDetection.DetectionStrings.length+" domain"+(1<xxEnvironementDetection.DetectionStrings.length?"s":""));a=""+TableStart();a+=TableEntry("Environment detection",addLink(b,"editEnvironmentDetection()"));a+=TableEntry("User initiation options",
|
|
addLinkConditional(xxUserInitiatedEnabledState[xxUserInitiatedCira.EnabledState],"editUserInitiatedCira()",xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.User.length){var b="",d;for(d in xxPolicies.User)0<b.length&&(b+=", "),b+=xxPolicies.User[d].AccessInfo,1==xxPolicies.User[d].MpsType&&(b+=" (CILA)")}a+=TableEntry("User initiated connection",addLinkConditional(b,'editMpsPolicy("User")',xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.Alert.length)for(d in b="",xxPolicies.Alert)0<b.length&&
|
|
(b+=", "),b+=xxPolicies.Alert[d].AccessInfo,1==xxPolicies.Alert[d].MpsType&&(b+=" (CILA)");a+=TableEntry("Alert initiated connection",addLinkConditional(b,'editMpsPolicy("Alert")',xxAccountAdminName));b="<i>None</i>";if(0<xxPolicies.Periodic.length)for(d in b="",xxPolicies.Periodic)0<b.length&&(b+=", "),b+=xxPolicies.Periodic[d].AccessInfo,1==xxPolicies.Periodic[d].MpsType&&(b+=" (CILA)");var g=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName","Periodic");if(g){var n=atob(g.ExtendedData);
|
|
0==ReadInt(n,0)&&(b+=", each "+ReadInt(n,4)+" seconds");1==ReadInt(n,0)&&(g=ReadInt(n,4),n=ReadInt(n,8),10>n&&(n="0"+n),b+=", at "+g+":"+n+" daily")}a+=TableEntry("Periodic connection",addLinkConditional(b,'editMpsPolicy("Periodic")',xxAccountAdminName));a+=TableEnd();a=a+"<br>"+TableStart2();a+="<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT remote management servers.<br><br>";if(0==xxCiraServers.length)a+="<div style=padding-left:15px><br><i>No remote servers found.</i></div><br>";
|
|
else for(d in xxCiraServers)b=":"+xxCiraServers[d].Port,xxCiraServers[d].CN&&(b+=", "+xxCiraServers[d].CN),a+="<div class=itemBar onclick=showServerDetails("+d+")><div style=padding-top:3px><b>"+xxCiraServers[d].AccessInfo+"</b>"+EscapeHtml(b)+"</div></div>";if(c)if(a+="<br>Manage HTTP proxies used for management connections.<br><br>",b=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses,0==b.length)a+="<div style=padding-left:15px><br><i>No proxies configured.</i></div><br>";else for(d in b)a+="<div class=itemBar onclick=showProxyDetails("+
|
|
d+")><div style=padding-top:3px><b>"+EscapeHtml(b[d].AccessInfo)+":"+b[d].Port+"</b> / "+EscapeHtml(b[d].NetworkDnsSuffix)+"</div></div>";d="";xxAccountAdminName&&(d=AddButton("Add Server...","AddRemoteAccessServer()"),c&&(d+=AddButton("Add Proxy...","AddRemoteAccessProxy()")));a+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullRemoteAccess()")+d);QH(28,a)}}var xxEditMpsPolicyType;
|
|
function editMpsPolicy(a){var b="",c=11<amtversion||11==amtversion&&6<=amtversion,d=xxEditMpsPolicyType=a;"User"==d&&(d="User Initiated");var d=getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",d),b=b+"<div style=height:26px><select id=d2server1 style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=-1>(None)",g;for(g in xxCiraServers)b+="<option value="+g+""+(xxPolicies[a][0]&&xxPolicies[a][0].Name==xxCiraServers[g].Name?" selected":"")+">"+xxCiraServers[g].AccessInfo;
|
|
b+="</select><div>Primary server</div></div>";c&&(b+="<div style=height:26px><select id=d2server1cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - External<option value=1"+(xxPolicies[a][0]&&1==xxPolicies[a][0].MpsType?" selected":"")+">CILA - Internal</select><div>Primary MPS Type</div></div>");if(1<xxCiraServers.length){b+="<div style=height:26px><select id=d2server2 style=float:right;width:206px onchange=editMpsPolicyUpdate()>";b+="<option value=-1>(None)";
|
|
for(g in xxCiraServers)b+="<option value="+g+""+(xxPolicies[a][1]&&xxPolicies[a][1].Name==xxCiraServers[g].Name?" selected":"")+">"+xxCiraServers[g].AccessInfo;b+="</select><div>Secondary server</div></div>";c&&(b+="<div style=height:26px><select id=d2server2cira style=float:right;width:206px onchange=editMpsPolicyUpdate()><option value=0>CIRA - External<option value=1"+(xxPolicies[a][1]&&1==xxPolicies[a][1].MpsType?" selected":"")+">CILA - Internal</select><div>Secondary MPS Type</div></div>")}g=
|
|
0;d&&(g=d.TunnelLifeTime);b+="<div style=height:26px><input id=d2lifetime style=float:right;width:200px onchange=editMpsPolicyUpdate() value="+g+">";b+="<div>Tunnel lifetime (Seconds)</div></div>";"Periodic"==a&&(c=0,g=3600,d&&(d=atob(d.ExtendedData),c=ReadInt(d,0),g=ReadInt(d,4),1==c&&(d=ReadInt(d,8),10>d&&(d="0"+d),g+=":"+d)),b+="<div style=height:26px><select id=d2ttype style=float:right;width:206px onchange=editMpsPolicyUpdate()>",b+="<option value=0"+(0==c?" selected":"")+">Periodic, time interval<option value=1"+
|
|
(1==c?" selected":"")+">Time of day, once a day",b+="</select><div>Trigger type</div></div><div style=height:26px><input id=d2timer style=float:right;width:200px onkeyup=editMpsPolicyUpdate() value="+g+"><div id=ttypelabel></div></div>");setDialogMode(11,a+" Connection",3,editMpsPolicyOk,b);editMpsPolicyUpdate()}
|
|
function editMpsPolicyUpdate(){var a=11<amtversion||11==amtversion&&6<=amtversion,b=1>=xxCiraServers.length||-1==Q("d2server1").value||Q("d2server1").value!=Q("d2server2").value;if(1==b&&"Periodic"==xxEditMpsPolicyType&&1==Q("d2ttype").value){var c=Q("d2timer").value.split(":");if(2!=c.length)b=!1;else{var d=parseInt(c[0]),c=parseInt(c[1]);if(0>d||23<d||0>c||59<c)b=!1}}QE("c37",b);1<xxCiraServers.length&&QE("d2server2",-1!=Q("d2server1").value);"Periodic"==xxEditMpsPolicyType&&(QE("d2timer",
|
|
-1!=Q("d2server1").value),QH("ttypelabel",0==Q("d2ttype").value?"Trigger interval (Seconds)":"Time of day (HH:MM)"),QE("d2ttype",-1!=Q("d2server1").value));QE("d2lifetime",-1!=Q("d2server1").value);a&&(QE("d2server1cira",-1<Q("d2server1").value),1<xxCiraServers.length&&QE("d2server2cira",-1<Q("d2server1").value&&-1<Q("d2server2").value))}
|
|
function editMpsPolicyOk(){var a=xxEditMpsPolicyType;"User"==a&&(a="User Initiated");getItem(xxRemoteAccess.AMT_RemoteAccessPolicyRule.responses,"PolicyRuleName",a)?amtstack.Delete("AMT_RemoteAccessPolicyRule",{PolicyRuleName:a},editMpsPolicyOk2):editMpsPolicyOk2()}
|
|
function editMpsPolicyOk2(a,b,c,d){a=11<amtversion||11==amtversion&&6<=amtversion;if(-1==Q("d2server1").value)PullRemoteAccess();else{b=0;"Alert"==xxEditMpsPolicyType&&(b=1);"Periodic"==xxEditMpsPolicyType&&(b=2);c=null;2==b&&(c=Q("d2ttype").value,d=IntToStr(Q("d2timer").value),1==c&&(d=Q("d2timer").value.split(":"),d=IntToStr(parseInt(d[0]))+IntToStr(parseInt(d[1]))),c=btoa(IntToStr(c)+d));var g,n;0<=Q("d2server1").value&&(g='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
|
|
xxCiraServers[Q("d2server1").value].Name+"</Selector></SelectorSet></ReferenceParameters>");0<=Q("d2server1").value&&1<xxCiraServers.length&&0<=Q("d2server2").value&&(n='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_ManagementPresenceRemoteSAP</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="Name">'+
|
|
xxCiraServers[Q("d2server2").value].Name+"</Selector></SelectorSet></ReferenceParameters>");d=[];var r=[];a?g&&(0==Q("d2server1cira").value?d.push(g):r.push(g),n&&(0==Q("d2server2cira").value?d.push(n):r.push(n))):g&&(d.push(g),n&&d.push(n));amtstack.AMT_RemoteAccessService_AddRemoteAccessPolicyRule(b,Q("d2lifetime").value,c,d,r,PullRemoteAccess)}}var editEnvironmentDetectionTmp;
|
|
function editEnvironmentDetection(a){1!=a&&(editEnvironmentDetectionTmp=xxEnvironementDetection.DetectionStrings?Clone(xxEnvironementDetection.DetectionStrings):[]);var b="";xxAccountAdminName&&(b+="Enter up to 4 intranet domain suffix. If the computer is outside these domains, Intel® AMT local ports will be closed and remote server connections will be active.<br><br>");0==editEnvironmentDetectionTmp.length&&(b+="<i>No intranet domains, Environemnt detection disabled.</i><br>");for(var c in editEnvironmentDetectionTmp)b+=
|
|
"<div class=itemBar style=margin-right:0><div style=float:right>"+AddButton2("Remove","editEnvironmentDetectionRemove("+c+")")+"</div><div style=padding-top:3px;max-width:260px;overflow:hidden title='"+editEnvironmentDetectionTmp[c]+"'><b>"+editEnvironmentDetectionTmp[c]+"</b></div></div>";xxAccountAdminName&&4>editEnvironmentDetectionTmp.length&&(b+="<br><input id=edInput placeholder=intranet.org style=width:276px onkeyup=edInputChg() maxlength=63><input type=button id=edAdd value=Add style=width:80px;margin-left:5px onclick=editEnvironmentDetectionAdd()>");
|
|
1==a?QH(39,b):setDialogMode(11,"Environment Detection",xxAccountAdminName?3:1,editEnvironmentDetectionDlg,b);edInputChg()}function editEnvironmentDetectionDlg(){if(xxAccountAdminName){var a=Clone(xxEnvironementDetection);a.DetectionStrings=editEnvironmentDetectionTmp;amtstack.Put("AMT_EnvironmentDetectionSettingData",a,editEnvironmentDetectionDlg2,0,1)}}
|
|
function editEnvironmentDetectionDlg2(a,b,c,d){200!=d?messagebox("Environment Detection","Failed to add server, status "+d):c.Body.ReturnValue&&0!=c.Body.ReturnValue?messagebox("Environment Detection",c.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}function edInputChg(){4>editEnvironmentDetectionTmp.length&&QE("edAdd",0<Q("edInput").value.length)}function editEnvironmentDetectionAdd(){editEnvironmentDetectionTmp.push(Q("edInput").value);editEnvironmentDetection(1)}
|
|
function editEnvironmentDetectionRemove(a){editEnvironmentDetectionTmp.splice(a,1);editEnvironmentDetection(1)}function editUserInitiatedCira(){if(!xxdialogMode){var a="",b;for(b in xxUserInitiatedEnabledState)a+="<input type=radio name=d11 id=wl"+b+" value="+b+" "+(xxUserInitiatedCira.EnabledState==b?"checked":"")+">"+xxUserInitiatedEnabledState[b]+"<br>";setDialogMode(11,"User Initiated Tunnel",3,editUserInitiatedCiraDlg,a)}}
|
|
function editUserInitiatedCiraDlg(){amtstack.AMT_UserInitiatedConnectionService_RequestStateChange(document.querySelector("input[name=d11]:checked").value,null,editUserInitiatedCiraDlg2)}function editUserInitiatedCiraDlg2(a,b,c,d){200==d&&amtstack.Get("AMT_UserInitiatedConnectionService",editUserInitiatedCiraDlg3,0,1)}function editUserInitiatedCiraDlg3(a,b,c,d){200==d&&(xxUserInitiatedCira=c.Body,updateRemoteAccess())}var xxShowServerDetailsHandle;
|
|
function showServerDetails(a){xxShowServerDetailsHandle=a;var b=xxCiraServers[a],c;c=""+addHtmlValue("Access Name",b.AccessInfo);b.Port&&(c+=addHtmlValue("Port",b.Port));b.CN&&(c+=addHtmlValue("Common Name",b.CN));if(b=getElementWithContextSelectorValue(xxRemoteAccessCredentiaLinks,b.Name))b=b.ElementInContext.ReferenceParameters.SelectorSet.Selector.Value,0<b.indexOf("Username")?(c+=addHtmlValue("Authentication Type","User & Pass / Server-Auth TLS"),c+=addHtmlValue("Remote ID",getInstance(xxMPSUserPass,
|
|
b).RemoteID)):(c+=addHtmlValue("Authentication Type","Certificate / Mutual-Auth TLS"),b=getInstance(xxCertificates,b),c+=addHtmlValue("Certificate Name",parseCertName(b.Subject).CN));b=1;xxAccountAdminName&&(b=5);setDialogMode(11,"Remote Server #"+(a+1),b,showServerDetailsOk,c)}
|
|
function getElementWithContextSelectorValue(a,b){for(var c in a){a[c].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector=MakeToArray(a[c].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector);for(var d in a[c].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector)if(a[c].ElementProvidingContext.ReferenceParameters.SelectorSet.Selector[d].Value==b)return a[c]}return null}
|
|
function showServerDetailsOk(a){2==a&&amtstack.Delete("AMT_ManagementPresenceRemoteSAP",{Name:xxCiraServers[xxShowServerDetailsHandle].Name},showServerDetailsOk2)}function showServerDetailsOk2(a,b,c,d){408==d?messagebox("Remote Server Removal","Unable to remove server, access denied."):PullRemoteAccess()}function parseCertName(a){var b={},c=a.split(","),d;for(d in c)a=c[d].indexOf("="),b[c[d].substring(0,a)]=c[d].substring(a+1);return b}
|
|
function showProxyDetails(a){var b=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses[a],c=addHtmlValue("Access name",b.AccessInfo+":"+b.ProxyPort),c=c+addHtmlValue("DNS suffex",b.NetworkDnsSuffix),c=c+addHtmlValue("Proxy type",["Administrator","Operating system"][b.Type]),b=1;xxAccountAdminName&&(b=5);setDialogMode(11,"HTTP Proxy #"+(a+1),b,showProxyDetailsOk,c,a)}
|
|
function showProxyDetailsOk(a,b){var c=xxRemoteAccess.IPS_HTTPProxyAccessPoint.responses[b];2==a&&amtstack.Delete("IPS_HTTPProxyAccessPoint",{Name:c.Name},showProxyDetailsOk2)}function showProxyDetailsOk2(a,b,c,d){408==d?messagebox("HTTP Proxy Removal","Unable to remove HTTP proxy, access denied."):PullRemoteAccess()}
|
|
function AddRemoteAccessProxy(){var a;a='<div style=height:26px><select id=d2type style=float:right;width:206px onchange=AddRemoteAccessProxyUpdate()><option value=2>Hostname FQDN<option value=3>IPv4 address<option value=4>IPv6 address</select><div>Connection type</div></div><div style=height:26px><input id=d2host style=float:right;width:200px maxlength=255 onkeyup=AddRemoteAccessProxyUpdate()><div id=d2typespan></div></div><div style=height:26px><input id=d2port onkeypress="return (event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))" style=float:right;width:200px onkeyup=AddRemoteAccessProxyUpdate()><div>Port</div></div>';a+=
|
|
"<div style=height:26px><input id=d2domain style=float:right;width:200px maxlength=191 onkeyup=AddRemoteAccessProxyUpdate()><div>DNS suffix</div></div>";setDialogMode(11,"Add HTTP Proxy",3,AddRemoteAccessProxyOk,a);AddRemoteAccessProxyUpdate()}
|
|
function AddRemoteAccessProxyUpdate(){var a=0!=Q("d2host").value.length&&0!=Q("d2domain").value.length;if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))a=!1;QE("c37",a);QH("d2typespan",["","","FQDN / hostname","IPv4 address","IPv6 address"][Q("d2type").value])}function AddRemoteAccessProxyOk(){amtstack.IPS_HTTPProxyService_AddProxyAccessPoint(Q("d2host").value,Q("d2type").value,parseInt(Q("d2port").value),Q("d2domain").value,AddRemoteAccessProxyOk2)}
|
|
function AddRemoteAccessProxyOk2(a,b,c,d){200!=d?messagebox("Add Proxy Server","Failed to add proxy, status "+d):0!=c.Body.ReturnValue?messagebox("Add Proxy Server",c.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
|
|
function AddRemoteAccessServer(){var a=[],b;for(b in xxCertificates)xxCertificates[b].XPrivateKey&&a.push(xxCertificates[b]);var c;c="<div style=height:26px><select id=d2type style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()><option value=201>Hostname FQDN<option value=3>IPv4 address</select><div>Connection type</div></div><div style=height:26px><input id=d2name style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div id=d2lname></div></div>";c+='<div style=height:26px><input id=d2port onkeypress="return (event.charCode == 0 || (event.charCode >= 48 && event.charCode <= 57))" style=float:right;width:200px value=4433 onkeyup=AddRemoteAccessServerUpdate()><div>Server port</div></div>';
|
|
c+="<div style=height:26px id=d2ucn><input id=d2cn style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Server Common Name</div></div>";c+="<div style=height:26px><select id=d2auth style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()>";0<a.length&&(c+="<option value=1>Certificate");c+="<option value=2>Username/Password</select><div>Authentication type</div></div>";c+="<span id=d2utype>";c+="<div style=height:26px><input id=d2user style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Username</div></div>";
|
|
c+="<div style=height:26px><input id=d2pass style=float:right;width:200px onkeyup=AddRemoteAccessServerUpdate()><div>Strong Password</div></div>";c+="</span>";c+="<span id=d2ctype>";c+="<div style=height:26px><select id=d2cert style=float:right;width:206px onchange=AddRemoteAccessServerUpdate()>";for(b in a)c+="<option value="+a[b].InstanceID.substring(34)+">"+parseCertName(a[b].Subject).CN;c+="</select><div>Certificate</div></div></span>";setDialogMode(11,"Add Remote Server",3,AddRemoteAccessServerOk,
|
|
c);AddRemoteAccessServerUpdate()}
|
|
function AddRemoteAccessServerOk(){var a,b,c,d;1==Q("d2auth").value?a='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://intel.com/wbem/wscim/1/amt-schema/1/AMT_PublicKeyCertificate</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT Certificate: Handle: '+Q("d2cert").value+
|
|
"</Selector></SelectorSet></ReferenceParameters>":(b=Q("d2user").value,c=Q("d2pass").value);0<Q("d2cn").value.length&&(d=Q("d2cn").value);amtstack.AMT_RemoteAccessService_AddMpServer(Q("d2name").value,Q("d2type").value,Q("d2port").value,Q("d2auth").value,a,b,c,d,AddRemoteAccessServerOk2)}
|
|
function AddRemoteAccessServerOk2(a,b,c,d){200!=d?messagebox("Add Internet Server","Failed to add server, status "+d):0!=c.Body.ReturnValue?messagebox("Add Internet Server",c.Body.ReturnValueStr.replace(/_/g," ")):PullRemoteAccess()}
|
|
function AddRemoteAccessServerUpdate(){var a=0!=Q("d2name").value.length;3==Q("d2type").value&&1==a&&(a=0!=Q("d2cn").value.length);2==Q("d2auth").value&&1==a&&(a=0!=Q("d2user").value.length&&passwordcheck(Q("d2pass").value));if(0==Q("d2port").value.length||65535<parseInt(Q("d2port").value))a=!1;if(-1!=Q("d2name").value.indexOf(":")||3==Q("d2type").value&&-1!=Q("d2cn").value.indexOf(":"))a=!1;QH("d2lname",201==Q("d2type").value?"Hostname":"IPv4 Address");QV("d2utype",2==Q("d2auth").value);QV("d2ucn",
|
|
3==Q("d2type").value);QV("d2ctype",1==Q("d2auth").value);QE("c37",a)}
|
|
function showEditNameDlg(a){if(!xxdialogMode){var b=amtsysstate.AMT_GeneralSettings.response.HostName,c=amtsysstate.AMT_GeneralSettings.response.DomainName;null!=c&&0<c.length&&(b+="."+c);b='<br><div style=height:26px><input id=d11name value="'+b+'" style=float:right;width:200px><div>Name & Domain</div></div>';1==a&&(a=1==amtsysstate.AMT_GeneralSettings.response.SharedFQDN,b+="<div style=height:26px><select id=d11fqdn style=float:right;width:200px><option value=true "+(a?"selected":"")+'>Shared, same as OS<option value="false" '+
|
|
(a?"":"selected")+">Dedicated, different from OS</select><div>Name Sharing</div></div>");setDialogMode(11,"Computer Name",3,editNameDlgOk,b)}}function editNameDlgOk(){var a=Q("d11name").value,b=a.indexOf("."),c="";0<=b&&(c=a.substring(b+1),a=a.substring(0,b));b=Clone(amtsysstate.AMT_GeneralSettings.response);b.HostName=a;b.DomainName=c;Q("d11fqdn")&&(b.SharedFQDN=d11fqdn.value);amtstack.Put("AMT_GeneralSettings",b,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
|
|
function computerNameGet(a,b,c,d){200==d&&(amtsysstate.AMT_GeneralSettings.response=c.Body,updateSystemStatus())}function showEditDnsDlg(){if(!xxdialogMode){var a=amtsysstate.AMT_GeneralSettings.response,b=0;1==a.DDNSUpdateByDHCPServerEnabled&&(b=1);1==a.DDNSUpdateEnabled&&(b=2);c24.value=b;c25.value=a.DDNSPeriodicUpdateInterval;c26.value=a.DDNSTTL;showEditDnsDlgChange();setDialogMode(23,"Dynamic DNS client",3,showEditDnsDlgOk)}}
|
|
function showEditDnsDlgOk(){var a=Clone(amtsysstate.AMT_GeneralSettings.response);a.DDNSUpdateEnabled=2==c24.value?!0:!1;a.DDNSUpdateByDHCPServerEnabled=1==c24.value?!0:!1;2==c24.value&&(a.DDNSPeriodicUpdateInterval=c25.value,a.DDNSTTL=c26.value);amtstack.Put("AMT_GeneralSettings",a,function(){amtstack.Get("AMT_GeneralSettings",computerNameGet,0,1)},0,1)}
|
|
function showEditDnsDlgChange(){QE("c25",2==c24.value);QE("c26",2==c24.value)}function showFeaturesDlg(){!xxdialogMode&&xxAccountAdminName&&(c3.checked=amtfeatures[0],c5.checked=amtfeatures[3],c6.checked=amtfeatures[2],c7.checked=amtfeatures[1],QV("c4",void 0!=amtfeatures[3]),setDialogMode(9,"Intel® AMT Features",3,featuresDlgOk))}
|
|
function featuresDlgOk(){var a=amtsysstate.AMT_RedirectionService.response;a.ListenerEnabled=c3.checked;a.EnabledState=32768+((c6.checked?1:0)+(c7.checked?2:0));amtstack.AMT_RedirectionService_RequestStateChange(a.EnabledState,function(b,c,d,g){200!=g?messagebox("Error","RedirectionService, RequestStateChange Error "+g):amtstack.CIM_KVMRedirectionSAP_RequestStateChange(c5.checked?2:3,0,function(b,c,d,g){200!=g?messagebox("Error","KVMRedirectionSAP, RequestStateChange Error "+
|
|
g):amtstack.Put("AMT_RedirectionService",a,function(a,b,c,d){200!=d?messagebox("Error","RedirectionService PUT Error "+d):(amtstack.Get("AMT_RedirectionService",featuresDlgGet1,0,1),amtstack.Get("CIM_KVMRedirectionSAP",featuresDlgGet2,0,1))},0,1)})})}function featuresDlgGet1(a,b,c,d){200==d&&(amtsysstate.AMT_RedirectionService.response=c.Body,updateSystemStatus())}function featuresDlgGet2(a,b,c,d){200==d&&(amtsysstate.CIM_KVMRedirectionSAP.response=c.Body,updateSystemStatus())}
|
|
function showConsentDlg(){if(!xxdialogMode){var a=amtsysstate.IPS_OptInService.response.OptInRequired;c8.checked=0==a;c9.checked=1==a;c10.checked=4294967295==a;setDialogMode(10,"User Consent",3,consentDlgOk)}}function consentDlgOk(){amtsysstate.IPS_OptInService.response.OptInRequired=document.querySelector("input[name=d10]:checked").value;amtstack.Put("IPS_OptInService",amtsysstate.IPS_OptInService.response,function(){amtstack.Get("IPS_OptInService",consentGet,0,1)},0,1)}
|
|
function consentGet(a,b,c,d){200==d&&PullSystemStatus()}var ipv6addrtype="Link local address;Network local address;Global address;User configured;Not allowed;DAD in progress;valid;deprecated;preferred/deprecated;expired;collision;not allowed".split(";");
|
|
function showIPv6AddrDlg(a,b){if(!xxdialogMode){var c=TableStart();t=b.split(",");for(var d=0;d<t.length;d+=3)c+=TableEntry("<b>"+t[d]+"</b><br><span style=font-size:10px>"+ipv6addrtype[t[d+1]]+", "+ipv6addrtype[+t[d+2]+5]+"</span>","");setDialogMode(11,"IPv6 addresses for "+(0==a?"wired":"wireless")+" interface",1,null,c+TableEnd())}}
|
|
function showIPv6StateDlg(a,b){if(!xxdialogMode&&amtsysstate){var c=amtsysstate.IPS_IPv6PortSettings.responses[a];ipv6manual=0==a&&(isIpAddress(c.IPv6Address)||isIpAddress(c.DefaultRouter)||isIpAddress(c.PrimaryDNS)||isIpAddress(c.SecondaryDNS));QV(44,0==a);QV(45,!1);QV("d21o0",!0);QV("d21l0",!0);QH("d21l0","IPv6 disabled");QH("d21l1","IPv6 enabled, automatic");QH("d21l2","IPv6 enabled, automatic + manual addresse");d21o0.checked=!b;d21o1.checked=b&&!ipv6manual;d21o2.checked=
|
|
b&&ipv6manual;c19.value=isIpAddress(c.IPv6Address,"");c21.value=isIpAddress(c.DefaultRouter,"");c22.value=isIpAddress(c.PrimaryDNS,"");c23.value=isIpAddress(c.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,"IPv6 support for "+(0==a?"wired":"wireless")+" interface",3,function(){showIPv6StateDlgOk(a)})}}
|
|
function showIPv6StateDlgOk(a){var b=amtsysstate.IPS_IPv6PortSettings.responses[a];0==a&&(d21o1.checked&&(b.IPv6Address=b.DefaultRouter=b.PrimaryDNS=b.SecondaryDNS="::",amtstack.Put("IPS_IPv6PortSettings",b,showIPv6StateDlgDone)),d21o2.checked&&(b.IPv6Address=c19.value,b.DefaultRouter=c21.value,b.PrimaryDNS=c22.value,b.SecondaryDNS=c23.value,amtstack.Put("IPS_IPv6PortSettings",b,showIPv6StateDlgDone)));for(var b=amtsysstate.CIM_ElementSettingData.responses,c=
|
|
0;c<b.length;c++)if(b[c].SettingData&&b[c].SettingData.ReferenceParameters.SelectorSet.Selector.Value=="Intel(r) IPS IPv6 Settings "+a){var d=Clone(b[c]);d.IsCurrent=d21o0.checked?2:1;amtstack.Put("CIM_ElementSettingData",d,showIPv6StateDlgDone)}}function showIPv6StateDlgDone(a,b,c,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("IPv6 support","Unable to set IPv6 state, error "+d)}
|
|
function showPingActionDlg(){if(!xxdialogMode){var a=amtsysstate.AMT_GeneralSettings.response,a=(1==a.PingResponseEnabled)+((1==a.RmcpPingResponseEnabled)<<1);d20a.checked=0==a;d20b.checked=1==a;d20c.checked=2==a;d20d.checked=3==a;setDialogMode(20,"Intel® AMT Ping Response",3,showPingActionDlgOk)}}
|
|
function showPingActionDlgOk(){var a=Clone(amtsysstate.AMT_GeneralSettings.response),b=document.querySelector("input[name=d20]:checked").value;a.PingResponseEnabled=0!=(b&1);a.RmcpPingResponseEnabled=0!=(b&2);amtstack.Put("AMT_GeneralSettings",a,PullSystemStatus,0,1)}
|
|
function showIPSetupDlg(){if(!xxdialogMode){var a=amtsysstate.AMT_EthernetPortSettings.responses[0];QV(44,!0);QV(45,!0);QV("d21o0",!1);QV("d21l0",!1);QH("d21l1","Automatic configuration using DHCP server");QH("d21l2","Static configuration using IPv4 settings below");d21o1.checked=1==a.DHCPEnabled;d21o2.checked=!d21o1.checked;c19.value=isIpAddress(a.IPAddress,"");c20.value=isIpAddress(a.SubnetMask,"");c21.value=isIpAddress(a.DefaultGateway,
|
|
"");c22.value=isIpAddress(a.PrimaryDNS,"");c23.value=isIpAddress(a.SecondaryDNS,"");updateIPSetupDlg();setDialogMode(21,"IPv4 Settings",3,showIPSetupDlgOk)}}function updateIPSetupDlg(){c19.disabled=c20.disabled=c21.disabled=c22.disabled=c23.disabled=!d21o2.checked}
|
|
function showIPSetupDlgOk(){var a=Clone(amtsysstate.AMT_EthernetPortSettings.responses[0]);a.DHCPEnabled=d21o1.checked;delete a.IPAddress;delete a.SubnetMask;delete a.DefaultGateway;delete a.PrimaryDNS;delete a.SecondaryDNS;0==d21o1.checked&&(a.IPAddress=c19.value,a.SubnetMask=c20.value,a.DefaultGateway=c21.value,""!=c22.value&&(a.PrimaryDNS=c22.value),""!=c23.value&&(a.SecondaryDNS=c23.value));amtstack.Put("AMT_EthernetPortSettings",
|
|
a,showIPSetupDlgDone,0,1)}function showIPSetupDlgDone(a,b,c,d){200==d?(amtsysstate=void 0,PullSystemStatus()):messagebox("IPv4 Settings","Unable to set network parameters, error "+d)}amtPowerBootCapabilities=null;function showPowerActionDlg(){xxdialogMode||(statusbox("Power Actions","Checking capabilities..."),amtstack.Get("AMT_BootCapabilities",powerActionResponse00,0,1))}
|
|
function powerActionResponse00(a,b,c,d){200==d?(amtPowerBootCapabilities=c.Body,QH("d5actionSelect",""),addOption("d5actionSelect","Power up",2),addOption("d5actionSelect","Power cycle",5),addOption("d5actionSelect","Power down",8),addOption("d5actionSelect","Reset",10),1==amtPowerBootCapabilities.ForceDiagnosticBoot&&(addOption("d5actionSelect","Power on to diagnostic",300),addOption("d5actionSelect","Reset to diagnostic",301)),9<amtversion&&(addOption("d5actionSelect","Soft-off",12),addOption("d5actionSelect",
|
|
"Soft-reset",14),addOption("d5actionSelect","Sleep",4),addOption("d5actionSelect","Hibernate",7)),1==amtPowerBootCapabilities.BIOSSetup&&(addOption("d5actionSelect","Power up to BIOS",100),addOption("d5actionSelect","Reset to BIOS",101)),1==amtPowerBootCapabilities.SecureErase&&(addOption("d5actionSelect","Power up to Secure Erase",104),addOption("d5actionSelect","Reset to Secure Erase",105)),addOption("d5actionSelect","Reset to PXE",400),addOption("d5actionSelect","Power on to PXE",401),addOption("d5actionSelect",
|
|
"Custom action...",999),5<amtversion&&addOption("d5actionSelect","User consent...",998),setDialogMode(5,"Power Actions",3,powerActionDlgCheck)):messagebox("Power Action","Unable to get system capabilities, error "+d)}
|
|
function powerActionDlgCheck(){var a=d5actionSelect.value;104==a||105==a?(a="Confirm execution of Intel® Remote Secure Erase?<br>Enter Secure Erase password if required.<br><br><div style=height:16px><input type=password id=rsepass maxlength=32 style=float:right;width:240px><div>Password</div></div><br><div style=color:red><b>WARNING:</b> This will wipe data on the remote system.</div>",rsepass=1,setDialogMode(11,"Power Actions",3,powerActionDlg,a)):powerActionDlg()}
|
|
function powerActionDlg(){var a=d5actionSelect.value;if(999==a)showAdvPowerDlg();else if(998==a)amtstack.Get("IPS_OptInService",powerActionResponse0,0,1);else{statusbox("Power Action","Checking state...");null!=rsepass&&1===rsepass&&(rsepass=Q("rsepass").value);var b=!0;6>amtversion&&(b=!1);13==currentView&&8==a&&(b=!1);13!=currentView&&10>=a&&(b=!1);b?amtstack.Get("IPS_OptInService",powerActionResponse0,0,1):amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1)}}var AvdPowerDlg;
|
|
function showAdvPowerDlg(){QV("d24dBiosPause",1==amtPowerBootCapabilities.BIOSPause);QV("d24dBiosSecureBoot",1==amtPowerBootCapabilities.BIOSSecureBoot);QV("d24dReflashBios",1==amtPowerBootCapabilities.BIOSReflash);QV("d24dBiosSetup",1==amtPowerBootCapabilities.BIOSSetup);QV("d24dForceProgressEvents",1==amtPowerBootCapabilities.ForcedProgressEvents);QV("d24dUseIDER",1==amtPowerBootCapabilities.IDER);QV("d24dLockKeyboard",1==amtPowerBootCapabilities.KeyboardLock);QV("d24dLockPowerButton",1==amtPowerBootCapabilities.PowerButtonLock);
|
|
QV("d24dLockResetButton",1==amtPowerBootCapabilities.ResetButtonLock);QV("d24dSerialOverLan",1==amtPowerBootCapabilities.SOL);QV("d24dSecureErase",1==amtPowerBootCapabilities.SecureErase);QV("d24dLockSleepButton",1==amtPowerBootCapabilities.SleepButtonLock);QV("d24dUserPasswordBypass",1==amtPowerBootCapabilities.UserPasswordBypass);QV("c33",1==amtPowerBootCapabilities.VerbosityQuiet);QV("c34",1==amtPowerBootCapabilities.VerbosityVerbose);QV("c35",1==amtPowerBootCapabilities.VerbosityScreenBlank);
|
|
setDialogMode(24,"Custom Power Action",3,showAdvPowerDlgOk);showAdvPowerDlgChange()}
|
|
function showAdvPowerDlgChange(){QV("idd_d24IDERBootDevice",Q("d24UseIDER").checked);QV("idd_d24RSEPass",Q("d24SecureErase")?Q("d24SecureErase").checked:!1);var a="d24BiosPause d24BiosSecureBoot d24BiosSetup d24ForceProgressEvents d24LockPowerButton d24LockResetButton d24LockSleepButton d24LockKeyboard d24UserPasswordBypass d24ReflashBios d24SafeMode d24UseIDER d24SerialOverLan d24SecureErase".split(" ");if(0<c29.value)for(var b in a)Q(a[b]).checked=!1;for(b in a)QE(a[b],0==c29.value)}
|
|
function showAdvPowerDlgOk(){AvdPowerDlg={};AvdPowerDlg.Action=Q("c27").value;AvdPowerDlg.BIOSPause=Q("d24BiosPause").checked;AvdPowerDlg.BIOSSecureBoot=Q("d24BiosSecureBoot").checked;AvdPowerDlg.BIOSSetup=Q("d24BiosSetup").checked;AvdPowerDlg.BootMediaIndex=Q("c30").value;AvdPowerDlg.FirmwareVerbosity=Q("c32").value;AvdPowerDlg.ForcedProgressEvents=Q("d24ForceProgressEvents").checked;AvdPowerDlg.IDERBootDevice=Q("c31").value;AvdPowerDlg.LockKeyboard=
|
|
Q("d24LockKeyboard").checked;AvdPowerDlg.LockPowerButton=Q("d24LockPowerButton").checked;AvdPowerDlg.LockResetButton=Q("d24LockResetButton").checked;AvdPowerDlg.LockSleepButton=Q("d24LockSleepButton").checked;AvdPowerDlg.ReflashBIOS=Q("d24ReflashBios").checked;AvdPowerDlg.UseIDER=Q("d24UseIDER").checked;AvdPowerDlg.UseSOL=Q("d24SerialOverLan").checked;AvdPowerDlg.UseSafeMode=Q("d24SafeMode").checked;AvdPowerDlg.UserPasswordBypass=Q("d24UserPasswordBypass").checked;AvdPowerDlg.SecureErase=Q("d24SecureErase").checked;
|
|
!0===AvdPowerDlg.SecureErase&&0<Q("d24rsepass").value.length&&(AvdPowerDlg.RSEPassword=Q("d24rsepass").value);statusbox("Power Action","Checking state...");amtstack.Get("IPS_OptInService",powerActionResponse0,0,1)}
|
|
function powerActionResponse0(a,b,c,d){200!=d?messagebox("Power Action","Error #"+d):4294967295==c.Body.OptInRequired&&3!=c.Body.OptInState&&4!=c.Body.OptInState?2==c.Body.OptInState?(d6ConsentText.value="",setDialogMode(6,"User Consent",11,powerActionSendConsent),checkConsentDisplay(),consentChanged()):(statusbox("Power Action","Starting opt-in..."),amtstack.IPS_OptInService_StartOptIn(powerActionResponseC1,0,1)):998==d5actionSelect.value?messagebox("User Consent","User consent not needed."):(statusbox("Power Action",
|
|
"Getting Boot Settings..."),amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1))}
|
|
function powerActionResponseC1(a,b,c,d){200!=d?messagebox("Power Action","Error #"+d):0!=c.Body.ReturnValue?messagebox("User Consent Error",c.Body.ReturnValueStr.replace(/_/g," ")):(d6ConsentText.value="",setDialogMode(6,"User Consent",11,powerActionSendConsent),checkConsentDisplay(),consentChanged(),amtstack.Enum("CIM_ServiceAvailableToElement",function(a,b,c,d){errcheck(d,a)||(amtsysstate.CIM_ServiceAvailableToElement.responses=c,updateSystemStatus(),2!=amtsysstate.CIM_ServiceAvailableToElement.responses[0].PowerState&&
|
|
amtstack.RequestPowerStateChange(2,function(a,b,c,d){}))}))}function powerActionSendConsent(a){0==a?amtstack.IPS_OptInService_CancelOptIn(function(){}):(statusbox("Power Action","Sending user consent..."),amtstack.IPS_OptInService_SendOptInCode(d6ConsentText.value,powerActionResponseC2,0,1))}
|
|
function powerActionResponseC2(a,b,c,d){200!=d?messagebox("Power Action","Error #"+d):0!=c.Body.ReturnValue?amtstack.Get("IPS_OptInService",powerActionResponse0,0,1):998==d5actionSelect.value?messagebox("User Consent","User consent succesful."):(statusbox("Power Action","Checking state..."),amtstack.Get("AMT_BootSettingData",powerActionResponse1,0,1))}
|
|
function powerActionResponse1(a,b,c,d){200!=d?messagebox("Power Action","Error #"+d):(a=d5actionSelect.value,c=c.Body,c.ConfigurationDataReset=!1,999==a?(c.BIOSPause=AvdPowerDlg.BIOSPause,c.EnforceSecureBoot=AvdPowerDlg.BIOSSecureBoot,c.BIOSSetup=AvdPowerDlg.BIOSSetup,c.BootMediaIndex=AvdPowerDlg.BootMediaIndex,c.FirmwareVerbosity=AvdPowerDlg.FirmwareVerbosity,c.ForcedProgressEvents=AvdPowerDlg.ForcedProgressEvents,c.IDERBootDevice=AvdPowerDlg.IDERBootDevice,c.LockKeyboard=AvdPowerDlg.LockKeyboard,
|
|
c.LockPowerButton=AvdPowerDlg.LockPowerButton,c.LockResetButton=AvdPowerDlg.LockResetButton,c.LockSleepButton=AvdPowerDlg.LockSleepButton,c.ReflashBIOS=AvdPowerDlg.ReflashBIOS,c.UseIDER=AvdPowerDlg.UseIDER,c.UseSOL=AvdPowerDlg.UseSOL,c.UseSafeMode=AvdPowerDlg.UseSafeMode,c.UserPasswordBypass=AvdPowerDlg.UserPasswordBypass,null!=c.SecureErase&&(c.SecureErase=AvdPowerDlg.SecureErase&&1==amtPowerBootCapabilities.SecureErase,1==c.SecureErase&&AvdPowerDlg.RSEPassword&&(c.RSEPassword=AvdPowerDlg.RSEPassword))):
|
|
(c.BIOSPause=!1,c.EnforceSecureBoot=!1,c.BIOSSetup=99<a&&104>a,c.BootMediaIndex=0,c.FirmwareVerbosity=0,c.ForcedProgressEvents=!1,c.IDERBootDevice=202==a||203==a?1:0,c.LockKeyboard=!1,c.LockPowerButton=!1,c.LockResetButton=!1,c.LockSleepButton=!1,c.ReflashBIOS=!1,c.UseIDER=199<a&&300>a,c.UseSOL=13==currentView&&8!=a&&300>a,c.UseSafeMode=!1,c.UserPasswordBypass=!1,null!=c.SecureErase&&(c.SecureErase=(104==a||105==a)&&1==amtPowerBootCapabilities.SecureErase,!0===c.SecureErase&&0<rsepass.length&&(c.RSEPassword=
|
|
rsepass)),rsepass=null),console.log("Boot Action: "+a),console.log("Setting Boot Settings: "+ObjectToString2(c)),statusbox("Power Action","Setting boot settings..."),amtstack.Put("AMT_BootSettingData",c,powerActionResponse2,c,1))}function powerActionResponse2(a,b,c,d,g){200!=d?(messagebox("Power Action","PUT AMT_BootSettingData, Error #"+d),console.log(g)):(statusbox("Power Action","Setting next boot..."),amtstack.SetBootConfigRole(1,powerActionResponse3x,0,1))}
|
|
function powerActionResponse3x(a,b,c,d){a=d5actionSelect.value;b=null;if(999==a)0<c29.value&&(b=["Force CD/DVD Boot","Force PXE Boot","Force Hard-drive Boot","Force Diagnostic Boot"][c29.value-1]);else{if(300==a||301==a)b="Force Diagnostic Boot";if(400==a||401==a)b="Force PXE Boot"}console.log("ChangeBootOrder: "+b);amtstack.CIM_BootConfigSetting_ChangeBootOrder(null==b?b:'<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: '+
|
|
b+"</Selector></SelectorSet></ReferenceParameters>",powerActionResponse3)}var targetPowerAction=0;
|
|
function powerActionResponse3(a,b,c,d){console.log("powerActionResponse3("+b+","+c+","+d+")");if(!errcheck(d,a)){statusbox("Power Action","Performing power action...");a=d5actionSelect.value;if(100==a||201==a||203==a||300==a||401==a)a=2;if(101==a||200==a||202==a||301==a||400==a)a=10;104==a&&(a=2);105==a&&(a=10);999==a&&(a=AvdPowerDlg.Action);targetPowerAction=a;11==a&&(a=10);999>a?(console.log("RequestPowerStateChange("+a+")"),amtstack.RequestPowerStateChange(a,powerActionResponse4)):messagebox("Power Action",
|
|
"Next boot action set.")}}function powerActionResponse4(a,b,c,d){200==d&&(QH(36,"Power action completed."),setDialogMode(1,"Power Action",0),setTimeout(function(){setDialogMode(0)},1300));amtstack.Get("CIM_AssociatedPowerManagementService",powerActionResponse5,0,1)}function powerActionResponse5(a,b,c,d){}function consentChanged(){QE("c37",6==d6ConsentText.value.length)}function changeConsentDisplay(){xxchangeConsentDisplay=!0;checkConsentDisplay()}
|
|
function checkConsentDisplay(){amtstack.Get("IPS_SecIOService",checkConsentDisplayResponse1)}var xxchangeConsentDisplay=!1;
|
|
function checkConsentDisplayResponse1(a,b,c,d){200==d&&(c.Body.DefaultScreen&&(c.Body.DefaultScreen=parseInt(c.Body.DefaultScreen)),c.Body.NumberOfScreens&&(c.Body.NumberOfScreens=parseInt(c.Body.NumberOfScreens)),1==xxchangeConsentDisplay?(xxchangeConsentDisplay=!1,c.Body.DefaultScreen=d6Display.value,amtstack.Put("IPS_SecIOService",c.Body,checkConsentDisplayResponse1)):(d6Display.value=c.Body.DefaultScreen,QV("d6ThirdDisplay",2<c.Body.NumberOfScreens)))}
|
|
var xxStorage=null,xxStorageVendors=[],xxStorageApplications=[];function PullStorage(){amtFirstPull|=8;wsstack.comm.PerformAjax("",PullStorageResponse,null,0,"/amt-storage/","GET")}
|
|
function PullStorageResponse(a,b,c){0==amtstack.PendingBatchOperations&&refreshButtons(!0);if(200==b){QV("go21",!0);for(b=0;32>b;b++){do c=a.length,a=a.replace(String.fromCharCode(b),"");while(c>a.length)}try{xxStorage=JSON.parse(a)}catch(v){return}xxStorageVendors=[];xxStorageApplications=[];a=xxStorage.content;if(Array.isArray(a)){c={};for(b in a){var d=a[b].vendor?a[b].vendor:"";c[d]||(c[d]={});var g=a[b].app?a[b].app:"";c[d][g]||(c[d][g]={});a[b].name&&(c[d][g][a[b].name]=a[b])}xxStorage.content=
|
|
a=c}else{if(a["index.htm"]||a["logon.htm"])a[""]={"":{}};a["index.htm"]&&(a[""][""]["index.htm"]=a["index.htm"],delete a["index.htm"]);a["logon.htm"]&&(a[""][""]["logon.htm"]=a["logon.htm"],delete a["logon.htm"])}c=0;var d=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage Intel® AMT storage for this computer.<br><br>",n,r,g="";for(b in a){var u=0,m;for(m in a[b]){u++;var l=0,w;for(w in a[b][m]){l++;if(b!=n||m!=r)""!=g&&(d+=g,g="<br>"),n=b,r=m,g=""!=b?g+EscapeHtml(b+" / "+m):g+
|
|
"Root";var e='"'+b+(""!=b?"/":"")+m+(""!=m?"/":"")+w+'"',g=g+('<div class=itemBar onclick=showStorageDetails("'+b+'","'+m+'","'+w+'",'+e+")><div style=float:right>"),g=g+(" "+AddButton2("Download","DownloadFromStorage("+e+',"'+w+'",event)')),g=g+("</div><div style=padding-top:3px><b>"+EscapeHtml(w)+"</b>, <i>"+a[b][m][w].size+" bytes</i></div></div>");c++;-1==xxStorageVendors.indexOf(b)&&xxStorageVendors.push(b);-1==xxStorageApplications.indexOf(m)&&xxStorageApplications.push(m)}0==l&&wsstack.comm.PerformAjax("",
|
|
function(){},null,0,"/amt-storage/"+b+"/"+m,"DELETE")}0==u&&wsstack.comm.PerformAjax("",function(){},null,0,"/amt-storage/"+b,"DELETE")}""!=g&&(d+=g);0==c&&(d+="<div style=padding-left:15px><br><i>No files found.</i></div><br>");d+="<br><td class=r1>"+TableEnd(AddRefreshButton("PullStorage()")+AddButton("Upload...","UploadToStorage()"));QH(31,d)}else QH(31,"Unable to load storage data...<br/>"+AddButton("Refresh","PullStorage()"))}
|
|
function showStorageDetails(a,b,c,d){if(!xxdialogMode){var g="",n=xxStorage.content[a][b][c];""!=a&&(g+=addHtmlValue("Vendor",a));""!=b&&(g+=addHtmlValue("Application",b));g+=addHtmlValue("Name",c);g+=addHtmlValue("Size",n.size+" bytes");n.link&&(g+=addHtmlValue("Link",n.link));setDialogMode(11,"Storage Item",5,showStorageDetailsEx,g,d)}}function showStorageDetailsEx(a,b){2==a&&wsstack.comm.PerformAjax("",storageDeleteResponse,null,0,"/amt-storage/"+b,"DELETE")}
|
|
function storageDeleteResponse(a,b){200!=b?messagebox("Storage","Unable to delete file (ERR"+b+"), check that the computer is powered on."):PullStorage()}function DownloadFromStorage(a,b,c){xxdialogMode||(haltEvent(c),wsstack.comm.PerformAjax("",DownloadFromStorageEx,b,0,"/amt-storage/"+a,"GET"))}function DownloadFromStorageEx(a,b,c){200!=b||null==a?console.log(b,"Data = null"):saveAs(data2blob(a),c)}
|
|
function OpenFromStorage(a,b){if(!xxdialogMode){haltEvent(b);var c=window.open("http://"+wsstack.comm.host+":"+wsstack.comm.port+"/amt-storage/"+a,"_blank");c.opener=null;c.focus()}}function PushToStorage(a,b,c){var d=null;7E3<b.length&&(d=[a,b.substring(7E3)],b=b.substring(0,7E3));wsstack.comm.PerformAjax(b,PushToStorageResponse,d,0,"/amt-storage/"+a+(1==c?"?append=":""),"PUT")}
|
|
function PushToStorageResponse(a,b,c){200!=b?messagebox("Storage","Unable to push file (ERR"+b+"), check that the computer is powered on."):null!=c?PushToStorage(c[0],c[1],!0):PullStorage()}
|
|
function UploadToStorage(a,b){if(!xxdialogMode){b||(b="");var c;c="<br>Select a small file to upload to storage and enter a vendor, application and filename.<br>";c=(a?c+('<br><div style=height:20px><input id=mstoragefile style=float:right;width:240px readonly disabled=disabled value="'+b+'" ><div>Upload file</div></div>'):c+"<br><div style=height:20px><input type=file id=mstoragefile style=float:right;width:240px onchange=SetStorageName()><div>Upload file</div></div>")+"<br><div style=height:16px><input id=mstoragevendor placeholder=Vendor list=mstoragevendorlist maxlength=11 style=float:right;width:240px><div>Vendor name</div></div>";
|
|
c+="<br><div style=height:16px><input id=mstorageapplication placeholder=App list=mstorageapplicationlist maxlength=11 style=float:right;width:240px><div>Application name</div></div>";c+="<br><div style=height:16px><input id=mstoragefilename placeholder=Filename maxlength=11 style=float:right;width:240px><div>Filename</div></div>";c+="<br><div style=height:16px><input id=mstoragetype placeholder=application/octet-stream list=mstoragetypelist style=float:right;width:240px><div>MIME Type</div></div>";
|
|
c+='<br><div style=height:16px><input id=mstoragelink style=float:right;width:240px><div title="If set, creates a link to this content from the main web page">Link</div></div><br>';c+="<datalist id=mstoragevendorlist>";for(var d in xxStorageVendors)c+='<option value="'+xxStorageVendors[d]+'">';c+="</datalist>";c+="<datalist id=mstorageapplicationlist>";for(d in xxStorageApplications)c+='<option value="'+xxStorageApplications[d]+'">';c+='</datalist><datalist id=mstoragetypelist><option value="application/octet-stream"><option value="image/jpeg"><option value="text/html"><option value="text/plain"></datalist>';
|
|
setDialogMode(11,"Storage Upload",3,UploadToStorageEx,c,a);a&&SetStorageName(b)}}function UploadToStorageEx(a,b){if(b)d=new FileReader,d.onload=UploadToStorageEx2,d.filename=Q("mstoragefile").value,d.readAsBinaryString(b);else{var c=Q("mstoragefile");if(1==c.files.length){var d=new FileReader;d.onload=UploadToStorageEx2;d.filename=c.files[0].name;d.readAsBinaryString(c.files[0])}}}
|
|
function SetStorageName(a){a||(a=Q("mstoragefile"),a=1==a.files.length?a.files[0].name:"");a=a.split(" ").join("");var b=a.split("-");3==b.length&&12>b[0].length&&12>b[1].length&&(Q("mstoragevendor").value=b[0],Q("mstorageapplication").value=b[1],a=b[2]);a=a.split("-").join("");a.endsWith(".gz")&&(a=a.substring(0,a.length-3));a.endsWith(".htm")||a.endsWith(".html")?Q("mstoragetype").value="text/html":a.endsWith(".txt")&&(Q("mstoragetype").value="text/plain");11<a.length&&(a=a.substring(0,11));Q("mstoragefilename").value=
|
|
a}
|
|
function UploadToStorageEx2(a){var b;b=Q("mstoragevendor").value;var c=Q("mstorageapplication").value,d=Q("mstoragefilename").value;""==d&&(d="Filename");var g=Q("mstoragetype").value;""==g&&(g="application/octet-stream");var n=Q("mstoragelink").value;""!=b||""!=c||"logon.htm"!=d.toLowerCase()&&"index.htm"!=d.toLowerCase()?(""==b&&(b="Vendor"),""==c&&(c="App"),b=b+"/"+c+"/"+d):b=d.toLowerCase();c="<metadata><headers>";d=a.target.filename;d||(d=Q("mstoragefile").files[0].name);d.endsWith(".gz")&&(c+=
|
|
"<h>Content-Encoding: gzip</h>");c+="<h>Content-Type: "+g+"</h></headers>";""!=n&&(c+="<link>"+n+"</link>");c+="</metadata>"+a.target.result;PushToStorage(b,c)}function _fmtdatetime(a){return a.replace("T"," ").replace("Z","")}
|
|
function _fmtinterval(a){a=a.replace("T","").substring(a.indexOf("P")+1);a=" "+a.replace("D"," days ").replace("H"," hours ").replace("M"," minutes ");a=a.replace(" 1 days "," 1 day ").replace(" 1 hours "," 1 hour ").replace(" 1 minutes "," 1 minute ");return a.substring(0,a.length-1)}function _fmttimepad(a){for(a=""+a;2>a.length;)a="0"+a;return a}var xxAlarms=null;
|
|
function PullAlarms(){var a=TableStart2()+"<tr><td class=r1 style=padding-left:15px><br>Manage wake alarms.<br><br>";amtstack.Enum("IPS_AlarmClockOccurrence",function(b,c,d,g){if(200==g){QV("go23",!0);if(0<d.length)for(xxAlarms=d,b=0;b<d.length;b++)c="<b>"+d[b].ElementName+"</b>, wake on "+(new Date(d[b].StartTime.Datetime)).toLocaleString().replace(", "," at "),void 0!=d[b].Interval&&(c+=" and each"+_fmtinterval(d[b].Interval.Interval)),1==d[b].DeleteOnCompletion&&(c+=", delete when done"),a+="<div class=itemBar onclick=showAlertDetails("+
|
|
b+")><div style=float:right>",xxAccountAdminName&&(a+=" "+AddButton2("Edit...","showAddAlarm("+b+")")),a+="</div><div style=padding-top:3px;width:auto;float:left;overflow-x:hidden>"+c+"</div></div>";else xxAlarms=null,a+="<div style=padding-left:15px><br><i>No wake alarms registered.</i></div><br>";d="<div> "+AddRefreshButton("PullAlarms()");xxAccountAdminName&&(d+=AddButton("Remove all alarms","RemoveAllAlarms()")+AddButton("Add","showAddAlarm()"));a+="<br><td class=r1>"+TableEnd(d+"</div>");
|
|
QH(33,a)}},null,!0)}
|
|
function prepareAlarmOccurenceTemplate(a,b,c,d,g){return'<d:AlarmTemplate xmlns:d="http://intel.com/wbem/wscim/1/amt-schema/1/AMT_AlarmClockService" xmlns:s="http://intel.com/wbem/wscim/1/ips-schema/1/IPS_AlarmClockOccurrence"><s:InstanceID>'+a+'</s:InstanceID><s:StartTime><p:Datetime xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+c+'</p:Datetime></s:StartTime><s:Interval><p:Interval xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Interval></s:Interval><s:DeleteOnCompletion>"+g+
|
|
"</s:DeleteOnCompletion></d:AlarmTemplate>"}function RemoveAllAlarms(){setDialogMode(1,"Remove all wake alarms",3,RemoveAllAlarmsEx,"Confirm removal of all wake alarms?")}function RemoveAllAlarmsEx(){var a=xxAlarms.length,b;for(b in xxAlarms)amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[b],function(b,d,g,n){0==--a&&PullAlarms()})}
|
|
function showAddAlarm(a){if(!xxdialogMode){QE("d25alarm_name",!a);if(void 0!=a){var b=xxAlarms[a],c=new Date(b.StartTime.Datetime);Q("d25alarm_name").value=b.ElementName;Q("d25alarm_sdate").value=c.getFullYear()+"-"+_fmttimepad(c.getMonth()+1)+"-"+_fmttimepad(c.getDate());Q("d25alarm_stime").value=c.getHours()+":"+_fmttimepad(c.getMinutes())+":"+_fmttimepad(c.getSeconds());if(b.Interval){var c=b.Interval.Interval.replace("P","").replace("T","").replace("D","D,").replace("H","H,").replace("M","M,").split(","),
|
|
d=[0,0,0],g;for(g in c){var n=c[g].length-1;"D"==c[g][n]&&(d[0]=parseInt(c[g].substring(0,n)));"H"==c[g][n]&&(d[1]=parseInt(c[g].substring(0,n)));"M"==c[g][n]&&(d[2]=parseInt(c[g].substring(0,n)))}Q("d25alarm_interval").value=d.join("-")}else Q("d25alarm_interval").value="";Q("d25alarm_doc").value=1==b.DeleteOnCompletion?1:0}else b=new Date,b.setDate((new Date).getDate()+1),Q("d25alarm_name").value="",Q("d25alarm_sdate").value=b.getFullYear()+"-"+_fmttimepad(b.getMonth()+1)+"-"+_fmttimepad(b.getDate()),
|
|
Q("d25alarm_stime").value=b.getHours()+":"+_fmttimepad(b.getMinutes())+":00",Q("d25alarm_interval").value="",Q("d25alarm_doc").value=0;setDialogMode(25,"Add new alarm",void 0!=a?7:3,showAddAlarmOk,"",a);alertDialogUpdate()}}function alertDialogUpdate(){var a=Q("d25alarm_interval").value.split("-").length,a=0<Q("d25alarm_name").value.length&&3==Q("d25alarm_sdate").value.split("-").length&&3==Q("d25alarm_stime").value.split(":").length&&(1==a||3==a);QE("c37",a)}
|
|
function showAddAlarmOk(a,b){if(2==a)showAlertDetailsDelete(a,b);else{var c=Q("d25alarm_name").value,d=Q("d25alarm_sdate").value.split("-"),g=Q("d25alarm_stime").value.split(":"),d=new Date(d[0],d[1]-1,d[2],g[0],g[1],g[2],0),d=_fmttimepad(d.getUTCFullYear())+"-"+_fmttimepad(d.getUTCMonth()+1)+"-"+_fmttimepad(d.getUTCDate())+"T"+_fmttimepad(d.getUTCHours())+":"+_fmttimepad(d.getUTCMinutes())+":"+_fmttimepad(d.getUTCSeconds())+"Z",g=Q("d25alarm_interval").value.split("-");3!=g.length&&(g=[0,0,0]);var g=
|
|
"P"+g[0]+"DT"+g[1]+"H"+g[2]+"M",n=1==Q("d25alarm_doc").value,c=prepareAlarmOccurenceTemplate(c,c,d,g,n);void 0==b?wsstack.ExecMethodXml(amtstack.CompleteName("AMT_AlarmClockService"),"AddAlarm",c,function(a,b,c,d){200!=d?messagebox("Add alarm","Failed to add alarm. Status: "+d+".<br/>Verify the alarm is for a future time."):0!=c.Body.ReturnValue?messagebox("Add alarm","Failed to add alarm, "+c.Body.ReturnValueStr+".<br/>Verify the alarm is for a future time."):PullAlarms()}):(c=Clone(xxAlarms[b]),
|
|
c.StartTime='<p:Datetime xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+d+"</p:Datetime>",c.Interval='<p:Interval xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/common">'+g+"</p:Interval>",c.DeleteOnCompletion=n,amtstack.Put("IPS_AlarmClockOccurrence",c,function(a,b,c,d){200!=d?messagebox("Edit alarm","Failed to change alarm. Status: "+d+".<br/>Verify the alarm for at a future time."):PullAlarms()},null,null,{InstanceID:c.InstanceID}))}}
|
|
function showAlertDetails(a){if(!xxdialogMode){var b=xxAlarms[a],c=new Date(b.StartTime.Datetime),c="<div style=text-align:left>"+addHtmlValue("Name",b.ElementName)+addHtmlValue("Wake time",c.toLocaleString().replace(", "," at "));void 0!=b.Interval&&(c+=addHtmlValue("Internal",_fmtinterval(b.Interval.Interval)));c+=addHtmlValue("After wake",1==b.DeleteOnCompletion?"Delete Alarm":"Keep Alarm")+"</div>";messagebox("Alarm "+b.ElementName,c);setDialogMode(11,"Alarm "+b.ElementName,5,showAlertDetailsDelete,
|
|
c,a)}}function showAlertDetailsDelete(a,b){2==a&&amtstack.Delete("IPS_AlarmClockOccurrence",xxAlarms[b],function(a,b,g,n){PullAlarms()})}function script_runScriptDlg(){xxdialogMode||scriptstate||setDialogMode(11,"Run Script",3,script_runScriptDlgOk,"<br><input id=scriptopen type=file style=width:100% accept=.mescript>")}function script_runScriptDlgOk(a){if(1==a&&(a=Q("scriptopen"),1==a.files.length)){var b=new FileReader;b.onload=script_onScriptRead;b.readAsBinaryString(a.files[0])}}
|
|
function script_onScriptRead(a){var b;try{b=JSON.parse(a.target.result)}catch(g){}if(20==currentView){b.scriptText&&(Q("scriptarea").value=b.scriptText);b.mescript&&(Q("compiledarea").value=rstr2hex(atob(b.mescript)));b.blocks?(script_setBuildBlocks(b.blocks),scriptViewButton(1)):(script_setBuildBlocks(),scriptViewButton(0));b.scriptBlocks?script_BlockScript=b.scriptBlocks:script_BuildingBlocks||(script_BlockScript=[]);for(var c in script_BlockScript)if(b=script_BlockScript[c],a=script_BuildingBlocks[b.xname]){a=
|
|
Clone(a);a.id=b.id;a.xname=b.xname;for(var d in a.vars)b.vars[d]&&(a.vars[d].value=b.vars[d].value);script_BlockScript[c]=a}fupdatescript();delete scriptstate;resetScriptButton()}else c={_interactive:1,_certificates:1,_mode:"Firmware"},b&&b.mescript&&(scriptstate=script_setup(atob(b.mescript),c)),scriptstate?(scriptstate.wsstack=wsstack,scriptstate.amtstack=amtstack,scriptstate.onStep=script_updateScriptState,scriptstate.onConsole=script_console,scriptstate.start(100)):messagebox("Run Script","Invalid script file.")}
|
|
function script_updateScriptState(){scriptstate&&(QV(9,0<scriptstate.state),center(),0==scriptstate.state&&(scriptstate=void 0))}function script_console(a){0==a.indexOf("INFO: ")&&(a=a.substring(6));0==a.indexOf("SUCCESS: ")&&(a=a.substring(9));0==a.indexOf("ERROR: ")&&(a=a.substring(7));QH(10,", "+a)}function script_Stop(){scriptstate&&(1==scriptstate.dialog&&setDialogMode(0),scriptstate.stop(),scriptstate.state=0,script_updateScriptState())}
|
|
var script_BuildingBlocks,script_StartingBuildingBlocks,script_BlockScript=[],script_BlockScriptSelectedId=null,script_BuilderView=0,editscriptstate;
|
|
function scriptLoadStartingBlocks(){var a=new XMLHttpRequest;a.onload=function(){if(200<=a.status&&400>a.status){var b;try{b=JSON.parse(a.responseText)}catch(c){}b&&b.blocks&&(script_StartingBuildingBlocks=b.blocks,script_setBuildBlocks(script_StartingBuildingBlocks))}};a.onerror=function(){console.log("Failed to get script blocks")};a.open("GET","scriptblocks.txt",!0);a.send()}
|
|
function scriptViewButton(a){script_BuilderView=a;QV("scripteditor",0==a);QV("scriptbuilder",1==a);QV("viewEditorButton",script_BuildingBlocks&&1==a);QV("viewBuilderButton",script_BuildingBlocks&&0==a)}
|
|
function script_setBuildBlocks(a){script_BuildingBlocks=a;var b="";if(a)for(var c in a)95!=c.charCodeAt(0)&&(b+="<div id=sblock_"+c+' style=cursor:pointer;background-color:#ccc;width:auto;padding:5px;margin:2px ondblclick=script_faddblock("'+c+'") draggable=true ondragstart=script_fondragstart(event,this) ondragend=script_fondragend(event,this) title="'+a[c].desc+'"',b+=">"+a[c].name+"</div>");QH("blocks",b);script_fonfilterchanged();scriptViewButton(script_BuildingBlocks?1:0)}
|
|
function script_faddblock(a){var b=Clone(script_BuildingBlocks[a]);b.id=Math.random();b.xname=a;script_BlockScript.push(b);script_BlockScriptSelectedId=script_BlockScript.length-1;fupdatescript()}function script_feditblock(a){xxdialogMode||setDialogMode(11,"Edit "+script_BuildingBlocks[a].name,3,script_feditblockEx,"Edit this block? This operation will reset the block editor and load the block code into the code editor.",a)}
|
|
function script_feditblockEx(a,b){script_newScriptDlgOk();scriptViewButton(0);var c,d=script_BuildingBlocks[b];c=""+("##!BLOCK!##\r\n#id="+b+"\r\n#name="+d.name+"\r\n#desc="+d.desc+"\r\n##!BLOCK!##\r\n");for(var g in d.vars){var n=d.vars[g];c+="##!VAR!##\r\n#id="+g+"\r\n#name="+n.name+"\r\n#desc="+n.desc+"\r\n#type="+n.type+"\r\n";n.maxlength&&(c+="#maxlength="+n.maxlength+"\r\n");if(n.values)for(var r in n.values)c+="#values-"+r+"="+n.values[r]+"\r\n";c+="#value="+n.value+"\r\n##SWAP %%%"+g+"%%% "+
|
|
n.value+"\r\n"}c+="##!VAR!##\r\n##SWAP %%%~%%% 0\r\n\r\n##!BLOCK!##\r\n"+d.code+"\r\n##!BLOCK!##\r\n";Q("scriptarea").value=c}
|
|
function script_fConvertScriptToJsonBlock(a){var b={};a=a.split("##!BLOCK!##\n");var c=a[1].split("\n"),d;for(d in c){var g=c[d].split("=");2==g.length&&(b[g[0].substring(1)]=g[1])}b.vars={};scriptvariables=a[2].split("##!VAR!##\n");for(d in scriptvariables){var c=scriptvariables[d].split("\n"),n={},r={},u=0,m;for(m in c)g=c[m].split("="),2==g.length&&g[1]&&g[0]&&0<g[0].length&&("#values-"==g[0].substring(0,8)?(r[g[0].substring(8)]=g[1],u++):n[g[0].substring(1)]=g[1]);n.id&&(0<u&&(n.values=r),c=n.id,
|
|
delete n.id,b.vars[c]=n)}b.code=a[3];c=b.id;delete b.id;d={};d[c]=b;return JSON.stringify(d,null," ")}function script_fonfilterchanged(){var a=Q("blockfilter").value.toLowerCase(),b;for(b in script_BuildingBlocks)95!=b.charCodeAt(0)&&QV("sblock_"+b,0<=script_BuildingBlocks[b].name.toLowerCase().indexOf(a)||0<=script_BuildingBlocks[b].desc.toLowerCase().indexOf(a))}var script_fonclickDblClickDetectIndex=null,script_fonclickDblClickDetectTime=null;
|
|
function script_fonclick(a,b){if(!xxdialogMode){script_BlockScriptSelectedId=null;b&&(b=fgetParentWithId(b),b.id.startsWith("xblock_")&&(script_BlockScriptSelectedId=b.id.substring(7)));fupdatescript();haltEvent(a);if(script_fonclickDblClickDetectIndex==script_BlockScriptSelectedId&&250>(new Date).getTime()-script_fonclickDblClickDetectTime)return script_foneditclick(script_BlockScriptSelectedId);script_fonclickDblClickDetectIndex=script_BlockScriptSelectedId;script_fonclickDblClickDetectTime=(new Date).getTime()}}
|
|
function script_fondragstart(a,b){xxdialogMode||(b=fgetParentWithId(b),b.style.opacity="0.4",a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("scriptbuilder/block",b.id))}function script_fondragend(a,b){xxdialogMode||(b=fgetParentWithId(b),b.style.opacity="1.0")}function script_fondragenter(a,b){xxdialogMode||(fgetParentWithId(b).style["border-top"]="solid 2px black")}
|
|
function script_fondragleave(a,b){if(!xxdialogMode){a=a.originalEvent||a;var c=document.elementFromPoint(a.pageX,a.pageY);b.contains(c)||(fgetParentWithId(b).style["border-top"]="none")}}
|
|
function script_fondrop(a,b){if(!xxdialogMode){b=fgetParentWithId(b);var c,d=a.dataTransfer.getData("scriptbuilder/block"),g=parseInt(b.id.substring(7));""==d?documentFileSelectHandler(a):(d.startsWith("sblock_")?(c=Clone(script_BuildingBlocks[d.substring(7)]),c.id=Math.random(),c.xname=d.substring(7)):(d=parseInt(d.substring(7)),c=script_BlockScript[d],script_BlockScript.splice(d,1),g>d&&g--),"scriptblocks"==b.id?(c&&script_BlockScript.push(c),script_BlockScriptSelectedId=script_BlockScript.length-
|
|
1):(script_BlockScript.splice(g,0,c),script_BlockScriptSelectedId=g),fupdatescript(),haltEvent(a))}}
|
|
function script_foneditclick(a){if(!xxdialogMode){var b=script_BlockScript[a];script_BlockScriptSelectedId=a;fupdatescript();if(null!=b){var c=b.vars?7:5,d=b.desc+"<br><br>";if(b.vars)for(var g in b.vars){var n=b.vars[g].value,r="";b.vars[g].maxlength&&(r+=" maxlength="+b.vars[g].maxlength);2==b.vars[g].type&&(r+=" onkeypress='return numbersOnly(event)'");if(1==b.vars[g].type||2==b.vars[g].type)n="<input title='"+b.vars[g].desc+"' id=scriptXvalue_"+g+" value='"+b.vars[g].value+"' "+r+" style=width:100%></input>";
|
|
if(3==b.vars[g].type){var n="<select title='"+b.vars[g].desc+"' id=scriptXvalue_"+g+" style=width:100%;padding:0;margin:0>",u;for(u in b.vars[g].values)n+="<option value="+u+(u==b.vars[g].value?" selected":"")+">"+b.vars[g].values[u]+"</option>";n+="</select>"}4==b.vars[g].type&&(n="<input type=password autocomplete=off title='"+b.vars[g].desc+"' id=scriptXvalue_"+g+" value='"+b.vars[g].value+"' "+r+" style=width:100%></input>");5==b.vars[g].type&&(n="");6==b.vars[g].type&&(n="<input type=file title='"+
|
|
b.vars[g].desc+"' id=scriptXvalue_"+g+" "+r+" style=width:100%></input>");d+='<table style=width:100% title="'+b.vars[g].desc+'"><td style=width:120px>'+b.vars[g].name+"<td><b>"+n+"</b></table>";if(5==b.vars[g].type){var d=d+("<ul id=scriptXvalue_"+g+' style="list-style-type:none;height:100px;overflow:auto;width:100%;border:1px solid #000;background-color:white;overflow-x:hidden;margin:0;padding:0">'),m;for(m in b.vars[g].values)n="",0<=b.vars[g].value.indexOf(m)&&(n=" checked"),d+="<li><label><input type=checkbox id=scriptXvaluex_"+
|
|
g+"-"+m+""+n+">"+b.vars[g].values[m]+"</label></li>";d+="</ul>"}}}setDialogMode(11,b.name,c,script_foneditclickEx,d,a)}}
|
|
function script_foneditclickEx(a,b){if(!xxdialogMode){if(2==a)script_BlockScript.splice(b,1),script_BlockScriptSelectedId==b&&(script_BlockScriptSelectedId=null);else{var c=script_BlockScript[b];if(c.vars)for(var d in c.vars)if(5==c.vars[d].type){c.vars[d].value=[];for(var g in c.vars[d].values)Q("scriptXvaluex_"+d+"-"+g).checked&&c.vars[d].value.push(g)}else if(6==c.vars[d].type){var n=Q("scriptXvalue_"+d);if(1==n.files.length){var r=new FileReader;r.onload=function(a){c.vars[d].value=btoa(a.target.result);
|
|
fupdatescript()};r.readAsBinaryString(n.files[0])}}else c.vars[d].value=Q("scriptXvalue_"+d).value}fupdatescript()}}function fgetParentWithId(a){for(;!a.id;)a=a.parentElement;return a}
|
|
function fupdatescript(){var a="",b;for(b in script_BlockScript){a+="<div id=xblock_"+b+" style=cursor:pointer;min-height:24px;background-color:#"+(script_BlockScriptSelectedId==b?"aaa":"ccc")+';width:auto;padding:5px;margin:2px draggable=true onclick=script_fonclick(event,this) ondragenter=script_fondragenter(event,this) ondragleave=script_fondragleave(event,this) ondragstart=script_fondragstart(event,this) ondragend=script_fondragend(event,this) ondrop=script_fondrop(event,this) title="'+script_BlockScript[b].desc+
|
|
'"';a+="><input style=float:right type=button value=Edit... onclick=script_foneditclick("+b+")><div style=font-size:16px><b>"+script_BlockScript[b].name+"</b>";if(script_BlockScript[b].vars){var c=0,a=a+"<table class='scriptBlockVar us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:5px;margin-top:8px>",d;for(d in script_BlockScript[b].vars){var g=script_BlockScript[b].vars[d].value;4==script_BlockScript[b].vars[d].type&&0<script_BlockScript[b].vars[d].value.length&&(g="*****");3==script_BlockScript[b].vars[d].type&&
|
|
(g=script_BlockScript[b].vars[d].values[script_BlockScript[b].vars[d].value]);6==script_BlockScript[b].vars[d].type&&(g=script_BlockScript[b].vars[d].value?"Binary file, "+script_BlockScript[b].vars[d].value.length+" bytes":"Not set");a+="<tr title='"+script_BlockScript[b].vars[d].desc+"'><td width=200px style='"+(0<c?"border-top:1px solid #a810a8":"")+"'><p>"+script_BlockScript[b].vars[d].name+"<td style='"+(0<c?"border-top:1px solid #a810a8":"")+"'>"+g;c++}a+="<tr><td style=height:3px></table>"}a+=
|
|
"</div></div>"}""==a&&(a='<div style="padding:15px;color:gray">Start your script by drag & dropping blocks from the left side into this scripting box.<div>');QH("scriptblocks",a+"<div style=height:80px></div>");for(b in script_BlockScript)QS("xblock_"+b).borderLeft=script_CurrentHighlightBlock==b?"3px solid black":"";script_blocksToScript()}
|
|
function script_blocksToScript(){var a="";if(script_BuildingBlocks){script_BuildingBlocks._start&&(a+="##### Starting Block #####\r\n"+script_BuildingBlocks._start.code+"\r\n\r\n");for(var b in script_BlockScript){var c=script_BlockScript[b].code,c=c.split("%%%~%%%").join(b),d;for(d in script_BlockScript[b].vars)c=c.split("%%%"+d+"%%%").join(script_BlockScript[b].vars[d].value);a+="##### Block: "+script_BlockScript[b].name+" #####\r\nHighlightBlock __t "+b+"\r\n"+c+"\r\n\r\n"}script_BuildingBlocks._end&&
|
|
(a+="##### Ending Block #####\r\n"+script_BuildingBlocks._end.code+"\r\nHighlightBlock\r\n")}Q("scriptarea").value=a}var script_CurrentHighlightBlock;function script_HighlightBlock(a,b){if(a==editscriptstate){script_CurrentHighlightBlock=b;for(var c in script_BlockScript)QS("xblock_"+c).borderLeft=script_CurrentHighlightBlock==c?"3px solid black":""}}function script_newScriptDlg(){xxdialogMode||setDialogMode(11,"New Script",3,script_newScriptDlgOk,"<br>Reset & clear the script editor?")}
|
|
function script_newScriptDlgOk(){script_setBuildBlocks(script_StartingBuildingBlocks);script_BlockScript=[];script_BlockScriptSelectedId=null;delete editscriptstate;scriptViewButton(script_BuildingBlocks?1:0);QH("variables","");Q("scriptarea").value="";resetScriptButton()}
|
|
function resetScriptButton(){breakScriptButton();Q("compiledarea").value=rstr2hex(script_compile(Q("scriptarea").value,function(a){messagebox("Script Compile Error",a)}));delete editscriptstate;Q("console").value="";QH("variables","");QH("EditScriptStatus","Stopped");1==script_BuilderView&&fupdatescript();0!=Q("compiledarea").value.length&&(editscriptstate=script_setup(hex2rstr(Q("compiledarea").value),{_interactive:1,_certificates:1,_mode:"Firmware"}),editscriptstate.wsstack=wsstack,editscriptstate.amtstack=
|
|
amtstack,editscriptstate.onStep=editscript_updateScriptState,editscriptstate.onConsole=editscript_console,editscript_updateScriptState(editscriptstate))}function runScriptButton(){null==editscriptstate&&resetScriptButton();null!=editscriptstate&&editscriptstate.start(100)}function breakScriptButton(){null!=editscriptstate&&editscriptstate.stop()}function stepScriptButton(){null==editscriptstate&&resetScriptButton();null!=editscriptstate&&(breakScriptButton(),editscriptstate.step())}
|
|
function editscript_console(a){Q("console").value+=a+"\n"}var script_states=["Stopped","Running","Paused"];
|
|
function editscript_updateScriptState(a){var b="";if(a&&null!=a){var c=[],d;for(d in a.variables)d.startsWith("__")||c.push(d);c.sort();for(d in c)b="object"==typeof a.variables[c[d]]?b+("<b>"+c[d]+"</b> = "+ObjectToStringEx(a.variables[c[d]],2)+"<br>"):b+("<b>"+c[d]+"</b> = "+EscapeHtml(script_toString(a.variables[c[d]]))+"<br>")}QH("variables",b);b="Stopped, No Script";a&&null!=a&&(b=script_states[a.state],0<a.state&&(b+=", "+a.ip+" : "+script_decompile(a.script,a.ip)));50<b.length&&(b=b.substring(0,
|
|
50)+"...");QH("EditScriptStatus",b)}function script_toString(a){return"object"==typeof a?JSON.stringify(a):a}
|
|
function script_saveScript(a){xxdialogMode||scriptstate||(a&&1==a.shiftKey?(setDialogMode(11,"Script Block",1,null,"<br><textarea id=scriptSaveScriptJsonBlock style=width:100%;height:200px;resize:vertical />"),QH("scriptSaveScriptJsonBlock",script_fConvertScriptToJsonBlock(Q("scriptarea").value))):setDialogMode(11,"Save Script",3,script_saveScriptOk,"<br><input id=scriptsavename style=width:100% value=test.mescript >"))}
|
|
function script_saveScriptOk(){if(!xxdialogMode){var a=JSON.stringify({scriptText:Q("scriptarea").value,mescript:btoa(script_compile(Q("scriptarea").value)),blocks:script_StartingBuildingBlocks,scriptBlocks:script_BlockScript},null," ");saveAs(data2blob(a),Q("scriptsavename").value)}}var xxdialogMode,xxdialogFunc,xxdialogButtons,xxdialogTag;
|
|
function setDialogMode(a,b,c,d,g,n){xxdialogMode=a;xxdialogFunc=d;xxdialogButtons=c;xxdialogTag=n;QE("c37",!0);QV("c37",c&1);QV("c36",c&2);QV(34,c&2);QV("c38",c&4);b&&QH(35,b);for(b=1;26>b;b++)QV("dialog"+b,b==a);QV("dialog",a);g&&(11==a?QH(39,g):QH(36,g))}function dialogclose(a){var b=xxdialogFunc,c=xxdialogButtons,d=xxdialogTag;setDialogMode();(c&8||a)&&b&&b(a,d)}
|
|
function center(){QS("dialog").left=(getDocWidth()-400)/2+"px"}function messagebox(a,b){QH(36,b);setDialogMode(1,a,1)}function statusbox(a,b){QH(36,b);setDialogMode(1,a)}
|
|
function SaveJsonFile(a,b,c,d){var g="",n={},r=new Date;amtsysstate&&(g="-"+amtsysstate.AMT_GeneralSettings.response.HostName,n={webappversion:version,description:c,hostname:amtsysstate.AMT_GeneralSettings.response.HostName,localtime:Date(),utctime:(new Date).toUTCString(),isotime:(new Date).toISOString()},HardwareInventory&&(n.systemid=guidToStr(HardwareInventory.CIM_ComputerSystemPackage.response.PlatformGUID.toLowerCase())));g+="-"+r.getFullYear()+"-"+("0"+(r.getMonth()+1)).slice(-2)+"-"+("0"+
|
|
r.getDate()).slice(-2)+"-"+("0"+r.getHours()).slice(-2)+"-"+("0"+r.getMinutes()).slice(-2);n[b]=d;saveAs(data2blob(JSON.stringify(n,null," ").replace(/\n/g,"\r\n")),a+g+".json")}var httpErrorTable={200:"OK",401:"Authentication Error",408:"Timeout Error",601:"WSMAN Parsing Error",602:"Unable to parse HTTP response header",603:"Unexpected HTTP enum response",604:"Unexpected HTTP pull response"};
|
|
function errcheck(a,b){if(null==wsstack||amtstack!=b)return!0;200!=a&&9!=a&&(setDialogMode(),wsstack.comm.FailAllError=999,amtstack.CancelAllQueries(999),QH(5,httpErrorTable[a]?httpErrorTable[a]:"Error #"+a),401==a&&QH(5,'Authentication Error<br /><br /><input type=button value="Set new credentials" onclick=meshcentral2credCallback(true)></input>'),go(100),QS(3).width=0);return 200!=a}
|
|
function goiFrame(a,b,c){if(!xxdialogMode){go(b);if(1==a.shiftKey||0==Q(13).src.endsWith(c))Q(13).src=c;QV(14,!1);QV(12,!0)}}function go(a,b){if(!xxdialogMode||1==b){QV(12,!1);QV(14,!0);QV(4,100==a);QV(6,100>a);for(var c=0;80>c;c++){QV("p"+c,c==a);var d=QS("go"+c);d&&(d["background-color"]=c==a?"#abcae1":"");d&&(d["background-color"]=c==a?"gray":"")}currentView=a}}
|
|
function portsFromHost(a,b){var c=decodeURIComponent(a).split(":"),d=0==b?16992:16993,g=0==b?16994:16995;1<c.length&&(d=parseInt(c[1]));2<c.length&&(g=parseInt(c[2]));return{host:c[0],http:d,redir:g}}function addLink(a,b){return"<a style=cursor:pointer;color:blue onclick='"+b+"'>♦ "+a+"</a>"}function addLinkConditional(a,b,c){return c?addLink(a,b):a}function haltEvent(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return!1}
|
|
function addOption(a,b,c){var d=document.createElement("option");d.text=b;d.value=c;Q(a).add(d)}function addDisabledOption(a,b,c){var d=document.createElement("option");d.text=b;d.value=c;d.disabled=1;Q(a).add(d)}function passwordcheck(a){if(8>a.length)return!1;var b=0,c=0,d=0,g=0,n;for(n in a){var r=a.charCodeAt(n);64<r&&91>r?b=1:96<r&&123>r?c=1:47<r&&58>r?d=1:g=1}return 4==b+c+d+g}
|
|
function methodcheck(a){return a&&null!=a&&a.Body&&0!=a.Body.ReturnValue?(messagebox("Call Error",a.Header.Method+": "+(a.Body.ReturnValueStr+"").replace("_"," ")),!0):!1}function TableStart(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td width=200px><p><td>"}function TableStart2(){return"<table class='log1 us' cellpadding=0 cellspacing=0 style=width:100%;border-radius:8px><tr><td><p><td>"}
|
|
function TableEntry(a,b){return"<tr><td class=r1><p>"+a+"<td class=r1>"+b}function FullTable(a,b){var c=TableStart();for(i in a)i&&a[i]&&(c+=TableEntry(i,a[i]));return c+TableEnd(b)}function TableEnd(a){return"<tr><td colspan=2><p>"+(a?a:"")+"</table>"}function AddButton(a,b){return"<input type=button value='"+a+"' onclick='"+b+"' style=margin:4px>"}function AddButton2(a,b,c){return"<input type=button value='"+a+"' onclick='"+b+"' "+c+">"}
|
|
function AddRefreshButton(a){return"<input type=button name=refreshbtn value=Refresh onclick='refreshButtons(false);"+a+"' style=margin:4px "+(0==refreshButtonsState?"disabled":"")+">"}function MoreStart(){return'<a style=cursor:pointer;color:blue id=morexxx1 onclick=QV("morexxx1",false);QV("morexxx2",true)>▼ More</a><div id=morexxx2 style=display:none><br><hr>'}
|
|
function MoreEnd(){return'<a style=cursor:pointer;color:blue onclick=QV("morexxx2",false);QV("morexxx1",true)>▲ Less</a></div>'}function getSelectedOptions(a){for(var b=[],c,d=0,g=a.options.length;d<g;d++)c=a.options[d],c.selected&&b.push(c.value);return b}function getInstance(a,b){for(var c in a)if(a[c].InstanceID==b)return a[c];return null}function getItem(a,b,c){for(var d in a)if(a[d][b]==c)return a[d];return null}
|
|
function guidToStr(a){return a.substring(6,8)+a.substring(4,6)+a.substring(2,4)+a.substring(0,2)+"-"+a.substring(10,12)+a.substring(8,10)+"-"+a.substring(14,16)+a.substring(12,14)+"-"+a.substring(16,20)+"-"+a.substring(20)}function getUrlVars(){for(var a,b=[],c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),d=0;d<c.length;d++)a=c[d].indexOf("="),0<a&&(b[c[d].substring(0,a)]=c[d].substring(a+1,c[d].length));return b}
|
|
function getDocWidth(){return window.innerWidth?window.innerWidth:document.documentElement&&document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement.clientWidth:document.getElementsByTagName("body")[0].clientWidth}
|
|
function getDocHeight(){return window.innerHeight?window.innerHeight:document.documentElement&&document.documentElement.clientHeight&&0!=document.documentElement.clientHeight?document.documentElement.clientHeight:document.getElementsByTagName("body")[0].clientHeight}function addHtmlValue(a,b){return'<div style=height:20px><div style=float:right;width:220px;overflow:hidden><b title="'+b+'">'+b+"</b></div><div>"+a+"</div></div>"}
|
|
function addHtmlValueNoTitle(a,b){return"<div style=height:20px><div style=float:right;width:220px;overflow:hidden>"+b+"</b></div><div>"+a+"</div></div>"}function numbersOnly(a,b){return 0==event.charCode||event.charCode==b||48<=event.charCode&&57>=event.charCode}startup();
|
|
</script> |