1/** 2 * Knihovna Signera - obsahuje vÅ¡echny dostupné verze Signera: Native Messaging (Chrome+Firefox+Chromium Edge) alias CERT, Javascript, SMS a Unknown 3 * (c) 2016 - 2025 Asseco Central Europe, a.s. 4 * Version: 1.12 5 * Author: Pavel Koukal 6 */ 7 8function GetSignerResources(){return{"NO_CALLBACK_FUNCTION":"Nebyla pÅedána callback funkce. Operaci nelze provést.","HASH256_NOT_SUPPORTED":"UpozornÄnÃ: Podpis bude vytvoÅen postaru.\r\nPodrobnosti naleznete na www.portalzp.cz - Älánek \"NaÅÃzenà MV ÄR...\"","SIGNER_NOT_LOADED_NM_CHROME":"Native Messaging komponenta Signer pro podepisovánà dat nenà nainstalována.","SIGNER_NOT_LOADED_NM_FIREFOX":"Native Messaging komponenta Signer pro podepisovánà dat nenà nainstalována.","SIGNER_NOT_LOADED_NM_EDGE":"Native Messaging komponenta Signer pro podepisovánà dat nenà nainstalována.","SIGNER_NOT_LOADED_JS":"Javascript komponenta Signer pro podepisovánà dat nenà nainstalována.","SIGNER_NOT_LOADED_XX":"Komponenta Signer pro podepisovánà dat nenà nainstalována.","SIGNER_NOT_LOADED_QUESTION":"PÅejete si zobrazit návod na ÅeÅ¡enà tohoto problému?","SIGNER_NOT_LOADED_INTERR":"Nebyla volána instalaÄnà funkce Signera. Podepisovacà komponenta nenà k dispozici.","SIGNER_FAQ_URL_AX":"https://www.portalzp.cz/faq.html#D1","SIGNER_FAQ_URL_NM_CHROME":"https://www.portalzp.cz/faq.html#D1","SIGNER_FAQ_URL_NM_FIREFOX":"https://www.portalzp.cz/faq.html#D1","SIGNER_FAQ_URL_NM_EDGE":"https://www.portalzp.cz/faq.html#D1","SIGNER_FAQ_URL_JS":"https://www.portalzp.cz/faq.html#D1","SIGNER_FAQ_URL_XX":"https://www.portalzp.cz/faq.html#D1","METHOD_NOT_SUPPORTED_NM_CHROME":"Native Messaging komponenta Signer nepodporuje metodu {0}","METHOD_NOT_SUPPORTED_NM_FIREFOX":"Native Messaging komponenta Signer nepodporuje metodu {0}","METHOD_NOT_SUPPORTED_NM_EDGE":"Native Messaging komponenta Signer nepodporuje metodu {0}","METHOD_NOT_SUPPORTED_SM":"SMS komponenta Signer nepodporuje metodu {0}","METHOD_NOT_SUPPORTED_JS":"Javascript komponenta Signer nepodporuje metodu {0}","METHOD_NOT_SUPPORTED_XX":"Podepisovacà komponenta Signer nepodporuje metodu {0}","NATIVEMESS_COMMUNICATION_ERROR":"Nastala internà chyba pÅi komunikaci s Native Messaging Signerem v metodÄ {0}","AJAX_SERVER_ERROR":"Nastala chyba pÅi komunikaci se serverem. {0}","AJAX_FILEUPLOAD_ERROR":"NepodaÅilo se odeslat data souboru na server.","UNKNOWN_SIGNER_MESSAGE":"Požadovaný typ signera \"{0}\" nenà k dispozici.","SIGNER_WAIT_FILE_UPLOAD":"ProbÃhá nahrávánà souboru \"{0}\" na server.","SIGNER_WAIT_SIGN_DATA":"ProbÃhá podepisovánà dat.","SIGNER_WAIT_SIGN_FILE":"ProbÃhá podepisovánà souboru \"{0}\".","SIGNER_WAIT_FILEDIALOG":"ProbÃhá výbÄr souboru.","SIGNER_WAIT_NM_INFO":"Je zobrazeno externà okno s podepisovacà komponentou.\r\nPokud nevidÃte jejà okno, zkuste použÃt ALT+TAB pro pÅepnutÃ.","SIGNER_INLOADING_INFO":"ProbÃhá naÄÃtánà podepisovacà komponenty Signer.","ERROR_DETAILS":"Podrobnosti chyby:"};} 9function SignerAlert(fcMessage,fceCallback){if(typeof fceCallback!=="function"){fceCallback=function(){};} 10if(typeof LAlert==="function"){LAlert(fcMessage,fceCallback,"UpozornÄnÃ");}else{alert(fcMessage);fceCallback(true);}} 11function SignerQuestion(fcMessage,fceCallback){if(typeof fceCallback!=="function"){fceCallback=function(){};} 12if(typeof LQuestion==="function"){LQuestion(fcMessage,function(){fceCallback(true);},function(){fceCallback(false);},"Dotaz");}else{if(typeof LConfirm==="function"){LConfirm(fcMessage,function(){fceCallback(true);},function(){fceCallback(false);},"Dotaz");}else{var res=confirm(fcMessage);fceCallback(res);}}} 13function ShowSignerError(fcMessage,foRes,fceCallback){foRes=foRes||{};var dispMsg=fcMessage+"";if((typeof foRes.errNo!=="undefined")&&(typeof foRes.errMsg!=="undefined")){dispMsg+="\r\n\r\n"+foRes.errNo+": "+foRes.errMsg;if((foRes.errNo==11)||(foRes.errNo==12)){SignerAlert(foRes.errMsg,fceCallback);}else{SignerAlert(dispMsg,fceCallback);}}else{SignerAlert(dispMsg,fceCallback);}} 14function SignerGetFileNameDlg(foFileNameElement,fcTitulek,fcFiltr,fceCallback){if((typeof window.Signer==="object")&&window.Signer.IsSignerInstalledSilent()){window.Signer.GetFileNameDlg(fcTitulek,fcFiltr,function(resFileDlg){if((resFileDlg.errNo===0)&&(!!foFileNameElement)){foFileNameElement.value=resFileDlg.data;} 15if(typeof fceCallback==="function"){fceCallback(resFileDlg);}});}else{if(typeof fceCallback==="function"){fceCallback({errNo:0,errMsg:"",data:""});}}} 16function SignerShowWaitWindow(fcHtmlMessage){if(typeof LZobrazOknoNacitani==="function"){LZobrazOknoNacitani(fcHtmlMessage);}
16else{var windHtml='<div style="background: none repeat scroll 0 0 rgba(0, 0, 0, 0.8);bottom: 0;height: 100%;left: 0;position: fixed;right: 0;top: 0;z-index: 99999;">'+' <div style="position: absolute;top: 0;left: 0;bottom: 0;right: 0;margin: auto;height: 165px;color: #ffffff;text-align: center;line-height: 1.5;font-weight: bold;">'+' <div style="width: 100%; display: inline-block; position: relative; height: 100px;">'+' <div style="position: absolute; width: 0px; z-index: 2000000000; left: 50%; top: 50%;" role="progressbar">'+' <div style="position: relative; top: -50px; left: -50px; width: 100px; height: 100px; background-image: url('+"'/img/loaders/loader1.gif'"+'); background-position: center center; background-repeat: no-repeat;"></div>'+' </div>'+' </div>'+' <div style="font-size: 24px;">Äekejte, prosÃm ...</div>'+' <div style="font-size: 14px" id="SignerWWDetailText">'+fcHtmlMessage+'</div>'+' </div>'+'</div>';var wind=jQuery("<div id='SignerWaitWindow'></div>");jQuery(wind).html(windHtml);jQuery("body").append(wind);}} 17function SignerChromeNMSignerInstallInstructions(fceCallback){var msg;if(jQuery("#NMSignerExtensionLoaded").length>0){msg='Podepisovacà komponenta Signer nenà správnÄ nainstalována. Máte v poÅádku nainstalováno rozÅ¡ÃÅenà prohlÞeÄe, ale pro správný bÄh podepisovacà komponenty je nutné '+'nainstalovat i vlastnà aplikaci, kterou nelze z bezpeÄnostnÃch důvodů instalovat pÅÃmo z prohlÞeÄe. Nainstalujte si, prosÃm, i podepisovacà aplikaci, jejÞ instalaci naleznete na <a href="https://www.portalzp.cz/download/NMSignerInstall.exe">https://www.portalzp.cz/download/NMSignerInstall.exe</a>.';}else{msg='Podepisovacà komponenta Signer nenà nainstalována. Tato komponenta je pro Váš prohlÞeÄ dostupná ve formÄ rozÅ¡ÃÅenÃ, '+'nainstalujte si ji, prosÃm, z internetového obchodu Chrome kliknutÃm na tlaÄÃtko:<div class="margined-top-sm margined-bottom"><form style="margin:0;padding:0;text-align:center;" method="get" action="https://chrome.google.com/webstore/detail/pfkjnfdnohdglpjapbcaeekfbndokklj" target="_blank"><button type="submit" class="btn btn-xs btn-primary">Nainstalovat podepisovacà komponentu</button></form></div>'+'Podepisovacà komponenta se skládá ze dvou Äástà (rozÅ¡ÃÅenà prohlÞeÄe a samotná aplikace podepisovacà komponenty) a z bezpeÄnostnÃch důvodů nelze aplikaÄnà Äást '+'instalovat pÅÃmo z prohlÞeÄe. Pokud jste tak jeÅ¡tÄ neuÄinili, prosÃm, nainstalujte si i vlastnà aplikaci, jejÞ instalaci naleznete na <a href="https://www.portalzp.cz/download/NMSignerInstall.exe">https://www.portalzp.cz/download/NMSignerInstall.exe</a>.';} 18msg+='<br><br>Po doinstalovánà podepisovacà komponenty znovu naÄtÄte tuto stránku.';SignerAlert(msg,function(){fceCallback();window.location.reload(false);});} 19function SignerFirefoxNMSignerInstallInstructions(fceCallback){var msg;if(jQuery("#NMSignerExtensionLoaded").length>0){msg='Podepisovacà komponenta Signer nenà správnÄ nainstalována. Máte v poÅádku nainstalováno rozÅ¡ÃÅenà prohlÞeÄe, ale pro správný bÄh podepisovacà komponenty je nutné '+'nainstalovat i vlastnà aplikaci, kterou nelze z bezpeÄnostnÃch důvodů instalovat pÅÃmo z prohlÞeÄe. Nainstalujte si, prosÃm, i podepisovacà aplikaci, jejÞ instalaci naleznete na <a href="https://www.portalzp.cz/download/NMSignerInstall.exe">https://www.portalzp.cz/download/NMSignerInstall.exe</a>.';}else{msg='Podepisovacà komponenta Signer nenà nainstalována. Tato komponenta je pro Váš prohlÞeÄ dostupná ve formÄ rozÅ¡ÃÅenÃ, '+'nainstalujte si ji, prosÃm, z internetových stránek prohlÞeÄe Firefox kliknutÃm na tlaÄÃtko:<div class="margined-top-sm margined-bottom"><form style="margin:0;padding:0;text-align:center;" method="get" action="https://addons.mozilla.org/cs/firefox/addon/podepis-komponenta-signer/" target="_blank"><button type="submit" class="btn btn-xs btn-primary">Nainstalovat podepisovacà komponentu</button></form></div>'+'Podepisovacà komponenta se skládá ze dvou Äástà (rozÅ¡ÃÅenà prohlÞeÄe a samotná aplikace podepisovacà komponenty) a z bezpeÄnostnÃch důvodů nelze aplikaÄnà Äást '+'instalovat pÅÃmo z prohlÞeÄe. Pokud jste tak jeÅ¡tÄ neuÄinili, prosÃm, nainstalujte si i vlastnà aplikaci, jejÞ instalaci naleznete na <a href="https://www.portalzp.cz/download/NMSignerInstall.exe">https://www.portalzp.cz/download/NMSignerInstall.exe</a>.';} 20msg+='<br><br>Po doinstalovánà podepisovacà komponenty znovu naÄtÄte tuto stránku.';SignerAlert(msg,function(){fceCallback();window.location.reload(false);});} 21function SignerEdgeNMSignerInstallInstructions(fceCallback){var msg;if(jQuery("#NMSignerExtensionLoaded").length>0){msg='Podepisovacà komponenta Signer nenà správnÄ nainstalována. Máte v poÅádku nainstalováno rozÅ¡ÃÅenà prohlÞeÄe, ale pro správný bÄh podepisovacà komponenty je nutné '+'nainstalovat i vlastnà aplikaci, kterou nelze z bezpeÄnostnÃch důvodů instalovat pÅÃmo z prohlÞeÄe. Nainstalujte si, prosÃm, i podepisovacà aplikaci, jejÞ instalaci naleznete na <a href="https://www.portalzp.cz/download/NMSignerInstall.exe">https://www.portalzp.cz/download/NMSignerInstall.exe</a>.';}else{msg='Podepisovacà komponenta Signer nenà nainstalována. Tato komponenta je pro Váš prohlÞeÄ dostupná ve formÄ rozÅ¡ÃÅenÃ, '+'nainstalujte si ji, prosÃm, z internetových stránek s doplÅky pro prohlÞeÄ Microsoft Edge kliknutÃm na tlaÄÃtko:<div class="margined-top-sm margined-bottom"><form style="margin:0;padding:0;text-align:center;" method="get" action="https://microsoftedge.microsoft.com/addons/detail/bhlaechjbkikglhincgjdmhceppidngc" target="_blank"><button type="submit" class="btn btn-xs btn-primary">Nainstalovat podepisovacà komponentu</button></form></div>'+'Podepisovacà komponenta se skládá ze dvou Äástà (rozÅ¡ÃÅenà prohlÞeÄe a samotná aplikace podepisovacà komponenty) a z bezpeÄnostnÃch důvodů nelze aplikaÄnà Äást '+'instalovat pÅÃmo z prohlÞeÄe. Pokud jste tak jeÅ¡tÄ neuÄinili, prosÃm, nainstalujte si i vlastnà aplikaci, jejÞ instalaci naleznete na <a href="https://www.portalzp.cz/download/NMSignerInstall.exe">https://www.portalzp.cz/download/NMSignerInstall.exe</a>.';} 22msg+='<br><br>Po doinstalovánà podepisovacà komponenty znovu naÄtÄte tuto stránku.';SignerAlert(msg,function(){fceCallback();window.location.reload(false);});} 23function SignerNativeAppNeedUpdateInstructions(){var instructions='Podepisovacà komponenta Signer vyžaduje provést aktualizaci aplikace NMSigner (aplikace pro podepisovánà dat pomocà klientského certifikátu), ' 24+'jejÞ instalaci naleznete na <a href="https://www.portalzp.cz/download/NMSignerInstall.exe">https://www.portalzp.cz/download/NMSignerInstall.exe</a>. ' 25+'Bez aktualizace této aplikace nemusà nÄkteré funkce pro podpis správnÄ fungovat.';var nativeWarn=jQuery('<div style="margin: 20px;" id="NativeNMWarning"><div class="hVarovani_container" align="left">' 26+'<div class="hClose" title="ZavÅÃt okno" onclick="Javascript: var el = document.getElementById(\'NativeNMWarning\'); if (el) { el.parentNode.removeChild(el); }">×</div>' 27+'<div class="hText" style="font-size: 1.1em !important;"><strong>UpozornÄnÃ: </strong>
27 '+instructions+'</div><div class="hClear"></div></div></div>');var elm=jQuery("#hlavniobsah");if(!elm||elm.length!=1){elm=jQuery(".hlavniobsah");} 28if(!elm||elm.length!=1){elm=jQuery(".hlavniobsahprilohy2");} 29if(elm&&elm.length==1){elm.prepend(nativeWarn);}} 30function SignerChangeWaitMessage(fcHtmlMessage){if(typeof LZmenOknoNacitani==="function"){LZmenOknoNacitani(fcHtmlMessage);}else{jQuery("#SignerWWDetailText").html(fcHtmlMessage);}} 31function SignerCloseWaitWindow(){if(typeof LZavriOknoNacitani==="function"){LZavriOknoNacitani();}else if(typeof LSkryjOknoNacitani==="function"){LSkryjOknoNacitani();}else{jQuery("#SignerWaitWindow").remove();}} 32function SignerHtmlEncode(fcStr){return(""+fcStr).replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,""");} 33function ACESigner(sSignerType){var SignerObj=this;SignerObj.nativeAppVersion=0;SignerObj.requestedNativeAppVersion=2;SignerObj.needUpdateNativeApp=false;SignerObj.loaded=false;SignerObj.inLoading=true;SignerObj.Signer={};SignerObj.lastCertSenderSignatureSN='';SignerObj.lastErrNo=0;SignerObj.lastErrStr="";SignerObj.NMComm={waiting:false,responseFce:false};SignerObj.signerType=String(sSignerType).toUpperCase();if(SignerObj.signerType=="NATIVEMESSAGING"||SignerObj.signerType=="CERT"||SignerObj.signerType=="ACTIVEX"){SignerObj.signerType="CERT";} 34if(SignerObj.signerType!="CERT"&&SignerObj.signerType!="SMS"&&SignerObj.signerType!="JAVASCRIPT"){SignerObj.signerType="UNKNOWN";} 35SignerObj.supportFileManagement=(SignerObj.signerType=="CERT");SignerObj.supportCertManagement=(SignerObj.signerType=="JAVASCRIPT");SignerObj.useFileServerStorage=SignerObj.supportFileManagement;SignerObj.fileServerStorageURL='/saveUserFile.phtml';SignerObj.NMSignerChromeExtensionOldId="alldahcdhngmcjagmefklhhecboiigni";SignerObj.NMSignerChromeExtensionNewId="pfkjnfdnohdglpjapbcaeekfbndokklj";SignerObj.NMSignerChromeExtensionActiveId="";SignerObj.NMSignerEdgeExtensionId="bhlaechjbkikglhincgjdmhceppidngc";SignerObj.res=GetSignerResources();SignerObj._setNotLoadedError=function(){SignerObj.lastErrNo=-31590;switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj.lastErrStr=SignerObj.res["SIGNER_NOT_LOADED_NM_CHROME"];break;case"NATIVEMESSAGING_FIREFOX":SignerObj.lastErrStr=SignerObj.res["SIGNER_NOT_LOADED_NM_FIREFOX"];break;case"NATIVEMESSAGING_EDGE":SignerObj.lastErrStr=SignerObj.res["SIGNER_NOT_LOADED_NM_EDGE"];break;case"JAVASCRIPT":SignerObj.lastErrStr=SignerObj.res["SIGNER_NOT_LOADED_JS"];break;default:SignerObj.lastErrStr=SignerObj.res["SIGNER_NOT_LOADED_XX"];}};SignerObj._setNoCallbakError=function(fceName){SignerObj.lastErrNo=-31591;SignerObj.lastErrStr=SignerObj.res["NO_CALLBACK_FUNCTION"]+'('+fceName+')';alert(SignerObj.lastErrStr);};SignerObj._setNotSupportedError=function(fcMethod){SignerObj.lastErrNo=-31592;switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj.lastErrStr=String(SignerObj.res["METHOD_NOT_SUPPORTED_NM_CHROME"]).replace("{0}",fcMethod);break;case"NATIVEMESSAGING_FIREFOX":SignerObj.lastErrStr=String(SignerObj.res["METHOD_NOT_SUPPORTED_NM_FIREFOX"]).replace("{0}",fcMethod);break;case"NATIVEMESSAGING_EDGE":SignerObj.lastErrStr=String(SignerObj.res["METHOD_NOT_SUPPORTED_NM_EDGE"]).replace("{0}",fcMethod);break;case"JAVASCRIPT":SignerObj.lastErrStr=String(SignerObj.res["METHOD_NOT_SUPPORTED_JS"]).replace("{0}",fcMethod);break;case"SMS":SignerObj.lastErrStr=String(SignerObj.res["METHOD_NOT_SUPPORTED_SM"]).replace("{0}",fcMethod);break;default:SignerObj.lastErrStr=String(SignerObj.res["METHOD_NOT_SUPPORTED_XX"]).replace("{0}",fcMethod);}};SignerObj._checkIfCanRunFunction=function(fceName,fceCallback){if(typeof fceCallback!=="function"){SignerObj._setNoCallbakError(fceName);return false;} 36if(!SignerObj.loaded){SignerObj._setNotLoadedError();fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});return false;} 37if(SignerObj.signerType=="UNKNOWN"){SignerObj.lastErrNo=-31529;SignerObj.lastErrStr=String(SignerObj.res["UNKNOWN_SIGNER_MESSAGE"]).replace("{0}",sSignerType);fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});return false;} 38return true;};SignerObj._formatSign=function(fcSign){if(SignerObj.signerType=="NATIVEMESSAGING_CHROME"||SignerObj.signerType=="NATIVEMESSAGING_FIREFOX"||SignerObj.signerType=="NATIVEMESSAGING_EDGE"){var frmOutput=String(fcSign);var xoo=frmOutput.indexOf("\x00");if(xoo>0){frmOutput=frmOutput.substr(0,xoo);} 39frmOutput="-----BEGIN PKCS7-----\r\n"+frmOutput+"-----END PKCS7-----\r\n";return frmOutput;}else{return fcSign;}};SignerObj._showWaitWindow=function(fcMessage,flMustShow){fcMessage=String(fcMessage).replace(/\n/g,"<br>");if(SignerObj.signerType=="NATIVEMESSAGING_CHROME"||SignerObj.signerType=="NATIVEMESSAGING_FIREFOX"||SignerObj.signerType=="NATIVEMESSAGING_EDGE"){if(!flMustShow){fcMessage+="<br><br>"+String(SignerObj.res["SIGNER_WAIT_NM_INFO"]).replace(/\n/g,"<br>");} 40SignerShowWaitWindow(fcMessage);}else{if(!!flMustShow){SignerShowWaitWindow(fcMessage);}}};SignerObj._closeWaitWindow=function(){SignerCloseWaitWindow();};SignerObj._findActiveChromeExtension=function(fceCallback){var testMsg={"message":"NMSigner_SendMessage","method":"About"};try{chrome.runtime.sendMessage(SignerObj.NMSignerChromeExtensionNewId,testMsg,function(response){if(!chrome.runtime.lastError&&(typeof response==="object")&&(typeof response.errNo!=="undefined")){fceCallback(SignerObj.NMSignerChromeExtensionNewId);}else{chrome.runtime.sendMessage(SignerObj.NMSignerChromeExtensionOldId,testMsg,function(response){if(!chrome.runtime.lastError&&(typeof response==="object")&&(typeof response.errNo!=="undefined")){fceCallback(SignerObj.NMSignerChromeExtensionOldId);}else{fceCallback("");}});}});}catch(err){fceCallback("");}} 41SignerObj._doNativeMessagingCommunicationChrome=function(foMsg,fceCallback){var NMErrNo=-31571;var NMErrStr=String(SignerObj.res["NATIVEMESS_COMMUNICATION_ERROR"]).replace("{0}",foMsg["method"]);if(typeof foMsg["message"]==="undefined"){foMsg["message"]="NMSigner_SendMessage";} 42try{chrome.runtime.sendMessage(SignerObj.NMSignerChromeExtensionActiveId,foMsg,function(response){if((typeof response==="object")&&(typeof response.errNo!=="undefined")){SignerObj.lastErrNo=response.errNo;SignerObj.lastErrStr=response.errMsg;fceCallback({"errNo":response.errNo,"errMsg":response.errMsg,"data":response.result.data});}else{SignerObj.lastErrNo=NMErrNo;SignerObj.lastErrStr=NMErrStr;fceCallback({"errNo":NMErrNo,"errMsg":NMErrStr,"data":""});}});}catch(err){SignerObj.lastErrNo=NMErrNo;SignerObj.lastErrStr=NMErrStr;fceCallback({"errNo":NMErrNo,"errMsg":NMErrStr,"data":""});}};SignerObj._doNativeMessagingCommunicationFirefox=function(foMsg,fceCallback){var NMErrNo=-31572;var NMErrStr=String(SignerObj.res["NATIVEMESS_COMMUNICATION_ERROR"]).replace("{0}",foMsg["method"]);if(typeof foMsg["message"]==="undefined"){foMsg["message"]="NMSigner_SendMessage";} 43try{SignerObj.NMComm.waiting=true;SignerObj.NMComm.responseFce=fceCallback;window.postMessage({type:"FROM_ACE_SIGNER",msg:foMsg},"*");}catch(err){SignerObj.lastErrNo=NMErrNo;SignerObj.lastErrStr=NMErrStr;fceCallback({"errNo":NMErrNo,"errMsg":NMErrStr,"data":""});}};SignerObj._doNativeMessagingCommunicationEdge=function(foMsg,fceCallback){var NMErrNo=-31573;var NMErrStr=String(SignerObj.res["NATIVEMESS_COMMUNICATION_ERROR"]).replace("{0}",foMsg["method"]);if(typeof foMsg["message"]==="undefined"){foMsg["message"]="NMSigner_SendMessage";}
44try{chrome.runtime.sendMessage(SignerObj.NMSignerEdgeExtensionId,foMsg,function(response){if((typeof response==="object")&&(typeof response.errNo!=="undefined")){SignerObj.lastErrNo=response.errNo;SignerObj.lastErrStr=response.errMsg;fceCallback({"errNo":response.errNo,"errMsg":response.errMsg,"data":response.result.data});}else{SignerObj.lastErrNo=NMErrNo;SignerObj.lastErrStr=NMErrStr;fceCallback({"errNo":NMErrNo,"errMsg":NMErrStr,"data":""});}});}catch(err){SignerObj.lastErrNo=NMErrNo;SignerObj.lastErrStr=NMErrStr;fceCallback({"errNo":NMErrNo,"errMsg":NMErrStr,"data":""});}};SignerObj._setHashAlgorithm=function(fnHashAlgorithm,fceCallback){switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj._doNativeMessagingCommunicationChrome({"method":"SetCfgSignatureHashAlgorithmNumber","param1":fnHashAlgorithm},fceCallback);break;case"NATIVEMESSAGING_FIREFOX":SignerObj._doNativeMessagingCommunicationFirefox({"method":"SetCfgSignatureHashAlgorithmNumber","param1":fnHashAlgorithm},fceCallback);break;case"NATIVEMESSAGING_EDGE":SignerObj._doNativeMessagingCommunicationEdge({"method":"SetCfgSignatureHashAlgorithmNumber","param1":fnHashAlgorithm},fceCallback);break;case"JAVASCRIPT":SignerObj.Signer.SetCfgSignatureHashAlgorithmNumber(fnHashAlgorithm);SignerObj.Signer.SetCfgSigningCertificateHashAlgorithmNumber(fnHashAlgorithm);SignerObj.lastErrNo=SignerObj.Signer.LastErrorNumber;SignerObj.lastErrStr=SignerObj.Signer.LastErrorStr;fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});break;default:SignerObj.lastErrNo=0;SignerObj.lastErrStr="";fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._setCfgCodePageNumber=function(fnCodePage,fceCallback){switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj._doNativeMessagingCommunicationChrome({"method":"SetCfgCodePageNumber","param1":fnCodePage},fceCallback);break;case"NATIVEMESSAGING_FIREFOX":SignerObj._doNativeMessagingCommunicationFirefox({"method":"SetCfgCodePageNumber","param1":fnCodePage},fceCallback);break;case"NATIVEMESSAGING_EDGE":SignerObj._doNativeMessagingCommunicationEdge({"method":"SetCfgCodePageNumber","param1":fnCodePage},fceCallback);break;case"JAVASCRIPT":SignerObj.Signer.SetCfgCodePageNumber(fnCodePage);SignerObj.lastErrNo=SignerObj.Signer.LastErrorNumber;SignerObj.lastErrStr=SignerObj.Signer.LastErrorStr;fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});break;default:SignerObj.lastErrNo=0;SignerObj.lastErrStr="";fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._signDetached=function(fData,flSoubor,flag,fceCallback){var podpis="";var sMethod=flSoubor?"SignFileDetached":"SignDetached";switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj._doNativeMessagingCommunicationChrome({"method":sMethod,"param1":flSoubor?SignerObj._GetFileName(fData):fData,"param2":flag},function(resNM){if(resNM.errNo===0){resNM.data=SignerObj._formatSign(resNM.data);} 45fceCallback(resNM);});break;case"NATIVEMESSAGING_FIREFOX":SignerObj._doNativeMessagingCommunicationFirefox({"method":sMethod,"param1":flSoubor?SignerObj._GetFileName(fData):fData,"param2":flag},function(resNM){if(resNM.errNo===0){resNM.data=SignerObj._formatSign(resNM.data);} 46fceCallback(resNM);});break;case"NATIVEMESSAGING_EDGE":SignerObj._doNativeMessagingCommunicationEdge({"method":sMethod,"param1":flSoubor?SignerObj._GetFileName(fData):fData,"param2":flag},function(resNM){if(resNM.errNo===0){resNM.data=SignerObj._formatSign(resNM.data);} 47fceCallback(resNM);});break;case"JAVASCRIPT":var fceInnerCallback=function(resSign){if(resSign.errNo===0){resSign.data=SignerObj._formatSign(resSign.data);} 48fceCallback(resSign);};if(flSoubor){SignerObj.Signer.SignFileDetached(fData,flag,fceInnerCallback);}else{SignerObj.Signer.SignDetached(fData,flag,fceInnerCallback);} 49break;case"SMS":if(flSoubor){fData="File: "+SignerObj._GetFileName(fData);} 50podpis="-----BEGIN SMSAuth Data-----\r\n"+fData+"\r\n-----END SMSAuth Data-----\r\n";SignerObj.lastErrNo=0;SignerObj.lastErrStr="";fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":SignerObj._formatSign(podpis)});break;default:SignerObj.lastErrNo=0;SignerObj.lastErrStr="";fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._signSHA256=function(fData,flSoubor,flag,fceCallback){SignerObj._setHashAlgorithm(6,function(resdata){if(resdata.errNo===0){SignerObj._signDetached(fData,flSoubor,flag,fceCallback);}else{fceCallback(resData);}});};SignerObj._signSHA1=function(fData,flSoubor,flag,fceCallback){SignerObj._setHashAlgorithm(4,function(resdata){if(resdata.errNo===0){SignerObj._signDetached(fData,flSoubor,flag,fceCallback);}else{fceCallback(resData);}});};SignerObj._getCertSenderSignatureSN=function(fceCallback){var resSN="";switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj._doNativeMessagingCommunicationChrome({"method":"GetLastCertSenderSignatureSN"},fceCallback);break;case"NATIVEMESSAGING_FIREFOX":SignerObj._doNativeMessagingCommunicationFirefox({"method":"GetLastCertSenderSignatureSN"},fceCallback);break;case"NATIVEMESSAGING_EDGE":SignerObj._doNativeMessagingCommunicationEdge({"method":"GetLastCertSenderSignatureSN"},fceCallback);break;case"JAVASCRIPT":resSN=SignerObj.Signer.GetLastCertSenderSignatureSN();SignerObj.lastErrNo=SignerObj.Signer.LastErrorNumber;SignerObj.lastErrStr=SignerObj.Signer.LastErrorStr;fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":resSN});break;default:SignerObj.lastErrNo=0;SignerObj.lastErrStr="";fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":"12345"});}};SignerObj._doSign=function(foData,fceCallback){if(!SignerObj._checkIfCanRunFunction(foData.fce,fceCallback)){return;} 51var flSoubor=foData.soubor;var flag=foData.flag;var Podepis="";if(flSoubor){Podepis=SignerObj._GetFileName(foData.data);}else{var frmInput=new String(foData.data);frmInput=frmInput.replace(/\r\n/g,"\n");frmInput=frmInput.replace(/\n/g,"\r\n");Podepis=""+frmInput;} 52SignerObj._showWaitWindow(flSoubor?String(SignerObj.res["SIGNER_WAIT_SIGN_FILE"]).replace("{0}",Podepis):SignerObj.res["SIGNER_WAIT_SIGN_DATA"],false);var innerCallback=function(fceParam){SignerObj._closeWaitWindow();fceCallback(fceParam);};SignerObj._signSHA256(flSoubor?foData.data:Podepis,flSoubor,flag,function(resData){if(resData.errNo===0){SignerObj._getCertSenderSignatureSN(function(snData){if(snData.errNo===0){SignerObj.lastCertSenderSignatureSN=snData.data;innerCallback(resData);}else{innerCallback(snData);}});}else{if(resData.errNo==42||resData.errNo==8||resData.errNo==13||resData.errNo==501){SignerObj._closeWaitWindow();SignerAlert(SignerObj.res["HASH256_NOT_SUPPORTED"],function(ok){SignerObj._showWaitWindow(flSoubor?String(SignerObj.res["SIGNER_WAIT_SIGN_FILE"]).replace("{0}",Podepis):SignerObj.res["SIGNER_WAIT_SIGN_DATA"],false);SignerObj._signSHA1(flSoubor?foData.data:Podepis,flSoubor,flag,function(resSHA1Data){if(resSHA1Data.errNo===0){SignerObj._getCertSenderSignatureSN(function(snData){if(snData.errNo===0){SignerObj.lastCertSenderSignatureSN=snData.data;innerCallback(resSHA1Data);}else{innerCallback(snData);}});}else{innerCallback(resSHA1Data);}});});}else{innerCallback(resData);}}});};SignerObj._doImportPKCS12=function(fFile,fceCallback){if(SignerObj.supportCertManagement){switch(SignerObj.signerType){case"JAVASCRIPT":SignerObj.Signer.ImportPKCS12(fFile,function(resImp){if(resImp.errNo===0){resImp.data="OK";} 53fceCallback(resImp);});break;default:SignerObj._setNotSupportedError("ImportPKCS12");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}}else{SignerObj._setNotSupportedError("ImportPKCS12");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._doDeletePKCS12=function(fceCallback){if(SignerObj.supportCertManagement){switch(SignerObj.signerType){case"JAVASCRIPT":SignerObj.Signer.DeletePKCS12(fceCallback);break;default:SignerObj._setNotSupportedError("DeletePKCS12");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}}else{SignerObj._setNotSupportedError("DeletePKCS12");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._doShowCertsDialog=function(fceCallback){if(SignerObj.supportCertManagement){switch(SignerObj.signerType){case"JAVASCRIPT":SignerObj.Signer.ShowCertsDialog(fceCallback);break;default:SignerObj._setNotSupportedError("ShowCertsDialog");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}}else{SignerObj._setNotSupportedError("ShowCertsDialog");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._doGetFileNameDlg=function(titulek,filtr,flag,fceCallback){if(SignerObj.supportFileManagement){var innerCallback=function(fceParam){SignerObj._closeWaitWindow();fceCallback(fceParam);};switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj._showWaitWindow(SignerObj.res["SIGNER_WAIT_FILEDIALOG"],false);SignerObj._doNativeMessagingCommunicationChrome({"method":"GetFileNameDlg","param1":"","param2":"","param3":titulek,"param4":filtr,"param5":flag},function(resNM){if((resNM.errNo!==0)&&(resNM.errNo!=11)&&(resNM.errNo!=12)){SignerAlert("Error "+resNM.errNo+": "+resNM.errNo,function(ok){innerCallback(resNM);});}else{innerCallback(resNM);}});break;case"NATIVEMESSAGING_FIREFOX":SignerObj._showWaitWindow(SignerObj.res["SIGNER_WAIT_FILEDIALOG"],false);SignerObj._doNativeMessagingCommunicationFirefox({"method":"GetFileNameDlg","param1":"","param2":"","param3":titulek,"param4":filtr,"param5":flag},function(resNM){if((resNM.errNo!==0)&&(resNM.errNo!=11)&&(resNM.errNo!=12)){SignerAlert("Error "+resNM.errNo+": "+resNM.errNo,function(ok){innerCallback(resNM);});}else{innerCallback(resNM);}});break;case"NATIVEMESSAGING_EDGE":SignerObj._showWaitWindow(SignerObj.res["SIGNER_WAIT_FILEDIALOG"],false);SignerObj._doNativeMessagingCommunicationEdge({"method":"GetFileNameDlg","param1":"","param2":"","param3":titulek,"param4":filtr,"param5":flag},function(resNM){if((resNM.errNo!==0)&&(resNM.errNo!=11)&&(resNM.errNo!=12)){SignerAlert("Error "+resNM.errNo+": "+resNM.errNo,function(ok){innerCallback(resNM);});}else{innerCallback(resNM);}});break;default:SignerObj._setNotSupportedError("GetFileNameDlg");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}}else{SignerObj._setNotSupportedError("GetFileNameDlg");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._doGetFileSize=function(filename,fceCallback){var fceInnerCallback=function(res){if(res&&res.errNo===0){var size=parseInt(res.data,10);res.fileSize=!isNaN(size)&&size>0?size:0;}else{res.fileSize=0;} 54fceCallback(res);};if(SignerObj.supportFileManagement){if(SignerObj.nativeAppVersion>=2){switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj._doNativeMessagingCommunicationChrome({"method":"GetFileSize","param1":filename},fceInnerCallback);break;case"NATIVEMESSAGING_FIREFOX":SignerObj._doNativeMessagingCommunicationFirefox({"method":"GetFileSize","param1":filename},fceInnerCallback);break;case"NATIVEMESSAGING_EDGE":SignerObj._doNativeMessagingCommunicationEdge({"method":"GetFileSize","param1":filename},fceInnerCallback);break;default:SignerObj._setNotSupportedError("GetFileSize");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":"0","fileSize":0});}}
54else{SignerShowWaitWindow("ProbÃhá naÄÃtánà souboru");var encodingTimer=setTimeout(function(){SignerCloseWaitWindow();SignerAlert("NepodaÅilo se naÄÃst zvolený soubor, pravdÄpodobnÄ z důvodu nadmÄrné velikosti souboru.",function(){fceCallback({"errNo":666,"errMsg":"NepodaÅilo se naÄÃst zvolený soubor, pravdÄpodobnÄ z důvodu nadmÄrné velikosti souboru.","data":"0","fileSize":0});});},30000);SignerObj.EncodeFile(filename,function(resEncFile){clearTimeout(encodingTimer);SignerCloseWaitWindow();if(resEncFile.errNo===0){var b64=LStringValue(resEncFile.data).split(/[\r\n\s]+/).join('');var b64len=b64.length;var fileSize=3*Math.ceil(b64len/4);if(b64len>2){if(b64.substring(b64len-2,b64len)=="=="){fileSize-=2;}else if(b64.substring(b64len-1,b64len)=="="){fileSize--;}} 55fceCallback({"errNo":0,"errMsg":"","data":""+fileSize,"fileSize":fileSize});}else{fceCallback({"errNo":666,"errMsg":"NepodaÅila se naÄÃst data souboru","data":"0","fileSize":0});}});}}else{SignerObj._setNotSupportedError("GetFileSize");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":"0","fileSize":0});}};SignerObj._doEncodeFile=function(fFile,fceCallback){if(SignerObj.supportFileManagement){var resFN='';switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj._doNativeMessagingCommunicationChrome({"method":"EncodeFile","param1":SignerObj._GetFileName(fFile)},fceCallback);break;case"NATIVEMESSAGING_FIREFOX":SignerObj._doNativeMessagingCommunicationFirefox({"method":"EncodeFile","param1":SignerObj._GetFileName(fFile)},fceCallback);break;case"NATIVEMESSAGING_EDGE":SignerObj._doNativeMessagingCommunicationEdge({"method":"EncodeFile","param1":SignerObj._GetFileName(fFile)},fceCallback);break;default:SignerObj._setNotSupportedError("EncodeFile");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}}else{SignerObj._setNotSupportedError("EncodeFile");fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._doCloseSigner=function(fceCallback){var NMErrNo=-31578;var NMErrStr=String(SignerObj.res["NATIVEMESS_COMMUNICATION_ERROR"]).replace("{0}","CloseSigner");switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerObj._doNativeMessagingCommunicationChrome({"message":"NMSigner_CloseSigner","method":"About"},fceCallback);break;case"NATIVEMESSAGING_FIREFOX":SignerObj._doNativeMessagingCommunicationFirefox({"message":"NMSigner_CloseSigner","method":"About"},fceCallback);break;case"NATIVEMESSAGING_EDGE":SignerObj._doNativeMessagingCommunicationEdge({"message":"NMSigner_CloseSigner","method":"About"},fceCallback);break;default:SignerObj.lastErrNo=0;SignerObj.lastErrStr="";fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}};SignerObj._GetFileName=function(fFile){if((typeof fFile==="object")&&fFile.type&&(fFile.type.toLowerCase()==="file")&&(typeof fFile.files==="object")){return fFile.files.length===1?""+fFile.files[0].name:"";}else{return""+fFile;}};SignerObj.SignEx=function(frmData,flag,fceCallback){SignerObj._doSign({"fce":"Sign","flag":flag,"data":frmData,"soubor":false},fceCallback);};SignerObj.Sign=function(frmData,fceCallback){SignerObj.SignEx(frmData,0,fceCallback);};SignerObj.SignFileEx=function(fFile,flag,elemFileData,fceCallback){SignerObj._doSign({"fce":"SignFile","flag":flag,"data":fFile,"soubor":true},function(resSign){if(elemFileData&&(resSign.errNo===0)&&SignerObj.supportFileManagement){SignerObj.EncodeFile(fFile,function(resEncFile){if(resEncFile.errNo===0){if((SignerObj.useFileServerStorage===true)&&(SignerObj.fileServerStorageURL!=='')&&(typeof jQuery!=="undefined")){var loData={"fileData":resEncFile.data};SignerObj._showWaitWindow(String(SignerObj.res["SIGNER_WAIT_FILE_UPLOAD"]).replace("{0}",SignerObj._GetFileName(fFile)),true);jQuery.post(SignerObj.fileServerStorageURL,loData).done(function(data){if(data&&(typeof data==="object")&&data.guid&&(typeof data.guid==="string")){elemFileData.value=data.guid;SignerObj._closeWaitWindow();fceCallback(resSign);}else{SignerObj.lastErrNo=-31580;SignerObj.lastErrStr=String(SignerObj.res["AJAX_SERVER_ERROR"]).replace("{0}",SignerObj.res["AJAX_FILEUPLOAD_ERROR"])+"<br><br>"+SignerObj.res["ERROR_DETAILS"]+" "+SignerHtmlEncode(JSON.stringify(data));SignerObj._closeWaitWindow();fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}}).fail(function(xhr,status,error){var loDebug={obj:xhr,errStatus:status,errMsg:error};SignerObj.lastErrNo=-31581;SignerObj.lastErrStr=String(SignerObj.res["AJAX_SERVER_ERROR"]).replace("{0}",SignerObj.res["AJAX_FILEUPLOAD_ERROR"])+"<br><br>"+SignerObj.res["ERROR_DETAILS"]+" "+SignerHtmlEncode(JSON.stringify(loDebug));
55SignerObj._closeWaitWindow();fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});});}else{elemFileData.value=resEncFile.data;fceCallback(resSign);}}else{elemFileData.value="";fceCallback(resEncFile);}});}else{fceCallback(resSign);}});};SignerObj.SignFile=function(fFile,elemFileData,fceCallback){SignerObj.SignFileEx(fFile,0,elemFileData,fceCallback);};SignerObj.GetLastErrorNumber=function(){return SignerObj.lastErrNo;};SignerObj.GetLastErrorStr=function(){return SignerObj.lastErrStr;};SignerObj.GetLastCertSenderSignatureSN=function(){return SignerObj.lastCertSenderSignatureSN;};SignerObj.SetCfgCodePageNumber=function(fnCodePage,fceCallback){if(!SignerObj._checkIfCanRunFunction("SetCfgCodePageNumber",fceCallback)){return;} 56SignerObj._setCfgCodePageNumber(fnCodePage,fceCallback);};SignerObj.ImportPKCS12=function(fFile,fceCallback){if(!SignerObj._checkIfCanRunFunction("ImportPKCS12",fceCallback)){return;} 57SignerObj._doImportPKCS12(fFile,fceCallback);};SignerObj.DeletePKCS12=function(fceCallback){if(!SignerObj._checkIfCanRunFunction("DeletePKCS12",fceCallback)){return;} 58SignerObj._doDeletePKCS12(fceCallback);};SignerObj.ShowCertsDialog=function(fceCallback){if(!SignerObj._checkIfCanRunFunction("ShowCertsDialog",fceCallback)){return;} 59SignerObj._doShowCertsDialog(fceCallback);};SignerObj.GetFileNameDlg=function(titulek,filtr,fceCallback){if(!SignerObj._checkIfCanRunFunction("GetFileNameDlg",fceCallback)){return;} 60if(typeof titulek==="undefined"){titulek="";} 61if((typeof filtr==="undefined")||(filtr==="")){filtr='Všechny soubory (*.*)\t*.*\t\t';} 62SignerObj._doGetFileNameDlg(titulek,filtr,"0",fceCallback);};SignerObj.GetMultiFileNameDlg=function(titulek,filtr,fceCallback){if(!SignerObj._checkIfCanRunFunction("GetFileNameDlg",fceCallback)){return;} 63if(typeof titulek==="undefined"){titulek="";} 64if((typeof filtr==="undefined")||(filtr==="")){filtr='Všechny soubory (*.*)\t*.*\t\t';} 65SignerObj._doGetFileNameDlg(titulek,filtr,"2",fceCallback);};SignerObj.GetFileSize=function(filename,fceCallback){if(!SignerObj._checkIfCanRunFunction("GetFileSize",fceCallback)){return;} 66SignerObj._doGetFileSize(filename,fceCallback);};SignerObj.EncodeFile=function(fFile,fceCallback){if(!SignerObj._checkIfCanRunFunction("EncodeFile",fceCallback)){return;} 67SignerObj._doEncodeFile(fFile,fceCallback);};SignerObj.IsSignerInstalledSilent=function(){return SignerObj.loaded;};SignerObj.IsSignerInstalled=function(fceCallback){if(typeof fceCallback!=="function"){SignerObj._setNoCallbakError("IsSignerInstalled");return;} 68if(!SignerObj.IsSignerInstalledSilent()){switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":SignerChromeNMSignerInstallInstructions(function(){SignerObj._setNotLoadedError();fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});});break;case"NATIVEMESSAGING_FIREFOX":SignerFirefoxNMSignerInstallInstructions(function(){SignerObj._setNotLoadedError();fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});});break;case"NATIVEMESSAGING_EDGE":SignerEdgeNMSignerInstallInstructions(function(){SignerObj._setNotLoadedError();fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});});break;default:SignerObj._setNotLoadedError();SignerQuestion(SignerObj.lastErrStr+"\r\n"+SignerObj.res["SIGNER_NOT_LOADED_QUESTION"],function(resOK){if(resOK){var postFix="";switch(SignerObj.signerType){case"JAVASCRIPT":postFix="JS";break;case"SMS":postFix="SM";break;default:postFix="XX";} 69window.open(SignerObj.res["SIGNER_FAQ_URL_"+postFix],'_blank','toolbar=1, scrollbars=1, menubar=1, resizable=1, width=800, height=600');} 70SignerObj._setNotLoadedError();fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});});}}else{if(SignerObj.lastErrNo!==0){SignerObj.lastErrNo=0;SignerObj.lastErrStr="";} 71fceCallback({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":"OK"});}};SignerObj.GetSignerType=function(){return SignerObj.signerType;};SignerObj.CloseSigner=function(fceCallback){if(typeof fceCallback!=="function"){SignerObj._setNoCallbakError("CloseSigner");return;} 72SignerObj._doCloseSigner(fceCallback);};function RunWhenSignerExtensionLoaded(fceToRun,iCnt){if(jQuery("#NMSignerExtensionLoaded").length>0){fceToRun();}else{if(iCnt<6){setTimeout(function(){RunWhenSignerExtensionLoaded(fceToRun,iCnt+1);},250);}}}
73var LoadingTimer=setTimeout(function(){if(SignerObj.inLoading){SignerObj.inLoading=false;SignerObj.loaded=false;}},5000);var usrAgent=window.navigator&&window.navigator.userAgent?window.navigator.userAgent:"";SignerObj.loaded=false;SignerObj.inLoading=true;SignerObj.Signer={};SignerObj.supportChromeMessaging=(typeof window.chrome==="object");SignerObj.supportFirefoxMessaging=false;SignerObj.supportEdgeMessaging=SignerObj.supportChromeMessaging&&(usrAgent.indexOf("Edg/")>-1);SignerObj.nativeAppVersion=0;if(SignerObj.supportEdgeMessaging&&SignerObj.supportChromeMessaging){SignerObj.supportChromeMessaging=false;} 74var bs=usrAgent.match(/Firefox\/(\d+)/);if(bs&&(parseInt(bs[1],10)>57)){SignerObj.supportFirefoxMessaging=true;} 75if(SignerObj.signerType=="CERT"){SignerObj.signerType="UNKNOWN";if(SignerObj.supportChromeMessaging){SignerObj.signerType="NATIVEMESSAGING_CHROME";} 76if(SignerObj.supportFirefoxMessaging){SignerObj.signerType="NATIVEMESSAGING_FIREFOX";} 77if(SignerObj.supportEdgeMessaging){SignerObj.signerType="NATIVEMESSAGING_EDGE";}} 78switch(SignerObj.signerType){case"NATIVEMESSAGING_CHROME":try{SignerObj._findActiveChromeExtension(function(activeID){if(activeID){SignerObj.NMSignerChromeExtensionActiveId=activeID;SignerObj._doNativeMessagingCommunicationChrome({"message":"NMSigner_SendMessage","method":"About"},function(response){if((typeof response==="object")&&(typeof response.errNo!=="undefined")&&(response.errNo===0)){SignerObj.loaded=true;SignerObj.inLoading=false;clearTimeout(LoadingTimer);SignerObj.needUpdateNativeApp=true;SignerObj._doNativeMessagingCommunicationChrome({"message":"NMSigner_SendMessage","method":"NativeVersion"},function(response){if((typeof response==="object")&&(typeof response.errNo!=="undefined")&&(response.errNo===0)&&response.data){var nativeVersion=parseInt(response.data,10);if(!isNaN(nativeVersion)&&nativeVersion>0&&nativeVersion>=SignerObj.requestedNativeAppVersion){SignerObj.needUpdateNativeApp=false;SignerObj.nativeAppVersion=nativeVersion;}} 79if(SignerObj.needUpdateNativeApp){SignerNativeAppNeedUpdateInstructions();}});}});}else{SignerObj.loaded=false;SignerObj.inLoading=false;clearTimeout(LoadingTimer);}});}catch(err){SignerObj.loaded=false;SignerObj.inLoading=false;clearTimeout(LoadingTimer);} 80break;case"NATIVEMESSAGING_FIREFOX":try{window.addEventListener("message",function(event){if(event.source!=window){return;} 81if(event.data.type&&event.data.msg&&(event.data.type=="TO_ACE_SIGNER")){if(SignerObj.NMComm.waiting&&(typeof SignerObj.NMComm.responseFce=="function")){SignerObj.NMComm.waiting=false;if((typeof event.data.msg==="object")&&(typeof event.data.msg.errNo!=="undefined")){SignerObj.lastErrNo=event.data.msg.errNo;SignerObj.lastErrStr=event.data.msg.errMsg;SignerObj.NMComm.responseFce({"errNo":event.data.msg.errNo,"errMsg":event.data.msg.errMsg,"data":event.data.msg.result.data});}else{SignerObj.lastErrNo=-31579;SignerObj.lastErrStr=String(SignerObj.res["NATIVEMESS_COMMUNICATION_ERROR"]).replace("{0}",foMsg["method"]);SignerObj.NMComm.responseFce({"errNo":SignerObj.lastErrNo,"errMsg":SignerObj.lastErrStr,"data":""});}}}},false);RunWhenSignerExtensionLoaded(function(){SignerObj._doNativeMessagingCommunicationFirefox({"message":"NMSigner_SendMessage","method":"About"},function(response){if((typeof response==="object")&&(typeof response.errNo!=="undefined")&&(response.errNo===0)){SignerObj.loaded=true;SignerObj.inLoading=false;clearTimeout(LoadingTimer);SignerObj.needUpdateNativeApp=true;SignerObj._doNativeMessagingCommunicationFirefox({"message":"NMSigner_SendMessage","method":"NativeVersion"},function(response){if((typeof response==="object")&&(typeof response.errNo!=="undefined")&&(response.errNo===0)&&response.data){var nativeVersion=parseInt(response.data,10);if(!isNaN(nativeVersion)&&nativeVersion>0&&nativeVersion>=SignerObj.requestedNativeAppVersion){SignerObj.needUpdateNativeApp=false;SignerObj.nativeAppVersion=nativeVersion;}} 82if(SignerObj.needUpdateNativeApp){SignerNativeAppNeedUpdateInstructions();}});}});},0);}catch(err){SignerObj.loaded=false;SignerObj.inLoading=false;clearTimeout(LoadingTimer);} 83break;case"NATIVEMESSAGING_EDGE":try{SignerObj._doNativeMessagingCommunicationEdge({"message":"NMSigner_SendMessage","method":"About"},function(response){if((typeof response==="object")&&(typeof response.errNo!=="undefined")&&(response.errNo===0)){SignerObj.loaded=true;SignerObj.inLoading=false;clearTimeout(LoadingTimer);SignerObj.needUpdateNativeApp=true;SignerObj._doNativeMessagingCommunicationEdge({"message":"NMSigner_SendMessage","method":"NativeVersion"},function(response){if((typeof response==="object")&&(typeof response.errNo!=="undefined")&&(response.errNo===0)&&response.data){var nativeVersion=parseInt(response.data,10);if(!isNaN(nativeVersion)&&nativeVersion>0&&nativeVersion>=SignerObj.requestedNativeAppVersion){SignerObj.needUpdateNativeApp=false;SignerObj.nativeAppVersion=nativeVersion;}} 84if(SignerObj.needUpdateNativeApp){SignerNativeAppNeedUpdateInstructions();}});}});}catch(err){SignerObj.loaded=false;SignerObj.inLoading=false;clearTimeout(LoadingTimer);} 85break;case"JAVASCRIPT":if(typeof ACEJavascriptSigner==="function"){SignerObj.Signer=new ACEJavascriptSigner();SignerObj.loaded=SignerObj.Signer.Init();}else{SignerObj.loaded=false;} 86SignerObj.inLoading=false;clearTimeout(LoadingTimer);break;case"SMS":SignerObj.loaded=true;SignerObj.inLoading=false;clearTimeout(LoadingTimer);break;default:SignerObj.loaded=false;SignerObj.inLoading=false;clearTimeout(LoadingTimer);}} 87function GetSignerObject(SignType){return new ACESigner(SignType);} 88function InstallSigner(SignType){window.Signer=new ACESigner(new String(SignType).toUpperCase());} 89function IsSignerInstalled(){if(typeof window.Signer==="object"){var res=window.Signer.IsSignerInstalledSilent();if(!res){window.Signer.IsSignerInstalled(function(){});} 90return res;}else{var resource=GetSignerResources();SignerAlert(resource["SIGNER_NOT_LOADED_INTERR"]);return false;}} 91function IsSignerInstalledSilent(){return(typeof window.Signer==="object")?window.Signer.IsSignerInstalledSilent():false;} 92function UnInstallSigner(fceCallback,SignType){if(typeof window.Signer==="object"){window.Signer.CloseSigner(function(res){window.Signer=undefined;if(typeof fceCallback==="function"){fceCallback();}});}else{window.Signer=undefined;if(typeof fceCallback==="function"){fceCallback();}}} 93var SignerInstalledInterval;var SignerWaitInterval;function WaitForSignerInstalled(fceCallback,fSilent){if(typeof fceCallback!=="function"){return;} 94var pSilent=!!fSilent;if(IsSignerInstalledSilent()){fceCallback(true);}else{if(document.readyState==="complete"){if((typeof window.Signer==="object")&&!!window.Signer.inLoading){SignerShowWaitWindow(window.Signer.res["SIGNER_INLOADING_INFO"]);SignerWaitInterval=setInterval(function(){if(!window.Signer.inLoading){clearInterval(SignerWaitInterval);SignerCloseWaitWindow();if(IsSignerInstalledSilent()){fceCallback(true);}else{if(!pSilent){window.Signer.IsSignerInstalled(function(){});} 95fceCallback(false);}}},250);}else{if(typeof window.Signer==="object"){if(!pSilent){window.Signer.IsSignerInstalled(function(){});}} 96fceCallback(false);}}else{SignerInstalledInterval=setInterval(function(){if(document.readyState==="complete"){clearInterval(SignerInstalledInterval);WaitForSignerInstalled(fceCallback,pSilent);}},250);}}} 97function WaitForSignerObjectInstalled(signerObj,fceCallback,fSilent){if(typeof fceCallback!=="function"){return;} 98if((typeof signerObj!=="object")||(typeof signerObj.IsSignerInstalledSilent!=="function")){fceCallback(false);} 99var pSilent=!!fSilent;if(signerObj.IsSignerInstalledSilent()){fceCallback(true);}else{if(!!signerObj.inLoading){SignerShowWaitWindow(signerObj.res["SIGNER_INLOADING_INFO"]);SignerWaitInterval=setInterval(function(){if(!signerObj.inLoading){clearInterval(SignerWaitInterval);SignerCloseWaitWindow();if(signerObj.IsSignerInstalledSilent()){fceCallback(true);}else{if(!pSilent){signerObj.IsSignerInstalled(function(){});} 100fceCallback(false);}}},250);}else{fceCallback(false);}}}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.