certselect.js 67 KB

1
  1. var __certselect=function(a){var W=function(e){function x(){if(!a.certsList)return null;var c=a.certsList,b=c.list.length,f=[],d=[],h=e.args.dn,g=null;null!=a.ESVS.Policy&&(-1!=a.ESVS.Policy.indexOf("|")?g=a.ESVS.Policy.split("|"):(g=[],g[0]=a.ESVS.Policy));var k=null;null!=a.ESVS.Organization&&(-1!=a.ESVS.Organization.indexOf("|")?k=a.ESVS.Organization.split("|"):(k=[],k[0]=a.ESVS.Organization));for(var m=0;m<b;m++){var l=c.list[m].index,p;if(c.list[m].cert){a.usWebToolkit.x509Certificate.parser(c.list[m].cert,"Base64");var n=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid();var A=a.usWebToolkit.x509Certificate.getSubjectName();var q=a.usWebToolkit.x509Certificate.getNotAfter();var D=a.usWebToolkit.x509Certificate.getNotAfter();var R=a.certUtil().getIssuerName(n);"undefined"==R&&(R=a.certUtil().getO(A))}else n=c.list[m].info.policyOID,A=c.list[m].info.subject,q=c.list[m].info.notAfter.split(" ")[0],D=c.list[m].info.notAfter.split(" ")[0],R=a.certUtil().getIssuerName(n);if(null==h||A.toLowerCase()==h.toLowerCase()){if(null!=a.ESVS.Policy){for(p=0;p<g.length&&g[p]!=n;p++);if(g.length<=p)continue}if(null!=a.ESVS.Organization&&("CERT_RENEWAL"==e.type||"CERT_RENEWAL_SIGN"==e.type||"CERT_RENEWAL_KMCERT"==e.type||"CERT_REVOCATION"==e.type||"CERT_SOE"==e.type||"CERT_RENEWAL_SIGN"==e.type||"CERT_RENEWAL_KMCERT"==e.type)){for(p=0;p<k.length&&k[p].toLowerCase()!=a.certUtil().getO(A).toLowerCase();p++);if(k.length<=p)continue}if(a.ESVS.ShowExpiredCerts||2!==a.certUtil().getExpirationStateValue(D))p=[""],p[1]=a.certUtil().getCertType(n),p[2]=a.certUtil().getCN(A),p[3]=R,p[4]=a.certUtil().getLocalDate(q),p[5]=l,p[6]=a.certUtil().getExpirationStateValue(D),"crosscert"==a.certUtil().getO(A).toLowerCase()?f.push(p):d.push(p)}}return{list:f.concat(d)}}function w(c,b,f,d,h){if(a.CONST.__USFB_M_DISK.device>c||0>b||!f)return-1;var g=0,k=0;v=b;a.certsList&&(a.certsList=null);l=!0;if(a.CONST.__PF_M_LS.device===c&&2&a.ESVS.Mode){a.PFSH||h(-1);try{a.PFSH.SelectStorage(1)}catch(D){h(-1)}try{a.PFSH.LoadAllCerts(document.domain)}catch(D){301E5===D.code&&(a.PFSH.InstallCACerts(document.domain),a.PFSH.LoadAllCerts(document.domain))}b=null;try{b=a.PFSH.GetUserCerts(document.domain),a.PFUC=b}catch(D){g=0}b&&(g=b.length-1);if(0<g){d=[];for(var n=0;n<g;n++){var u=n+1,p={};p.index=u;p.cert=b[u].signcert;d[n]=p}a.certsList={list:d}}else a.certsList=null,k=0;h(k)}else if(c==a.CONST.__PF_M_SS.device&&a.CCPFSH())l=!1,a.CCPFSH().GetCCStorageHandler(a.ESVS.EncAlgo,a.ESVS.HashAlgo,a.ESVS.BSPKI,function(b,c){0==b&&a.CCPFSH().GetCertificateList(function(b,c){if(0==b){var d=0;(a.PFUC=c)&&(d=c.length-1);if(0<d){for(var f=[],g=0;g<d;g++){var e=g+1,k={};k.index=e;k.cert=c[e].signcert;f[g]=k}a.certsList={list:f}}}h(b)})});else if(c==a.CONST.__PF_M_CLOUDSIGN.device){l=!1;if(e.CS_phoneNumber)A(e.CS_phoneNumber);else{var y=a.loadUI("phoneNumber")({type:"phoneNumber",args:null,onConfirm:function(a){N=a;A(a);y.dispose()},onCancel:function(){y.dispose();h(k)}});y.show()}var A=function(b){a.uiUtil().loadingBox(!0,"us-div-list-load",0);a.PFCS().reqMemberInfo(b,function(c,d,f){if(0!=c)return a.uiUtil().loadingBox(!1,"us-div-list-load",0),alert(d+"\n\nError Code [ "+c+" ]"),!1;d=parseInt(f.split("|")[0]);if(0<d)q(b,h);else{if(-1==d){d=a.loadUI("cloudservice");var g=d({type:"double",args:{pNumber:b},onCancel:function(){g.dispose(!0);a.uiUtil().loadingBox(!1,"us-div-list-load",0);h(c)}})}else d=a.loadUI("cloudservice"),g=d({type:"joinus",args:{pNumber:b},onCancel:function(){g.dispose(!0);a.uiUtil().loadingBox(!1,"us-div-list-load",0);h(c)}});g.show()}})},q=function(b,c){a.PFCS().reqGetCert(b,"LOGIN",function(d,f,h){if("0021"==d)a.PFCS().reqGetCert(b,"LOGIN",function(b,d,f){if(0<f.length){d=[];for(var h=0;h<f.length;h++){var g={};g.index=h+1;g.cert=f[h];d[h]=g}a.certsList={list:d}}c(b)});else{if(0!=d)return a.uiUtil().loadingBox(!1,"us-div-list-load",0),a.uiUtil().errMsgBox(f,d),c(d),!1;if(0<h.length){f=[];for(var g=0;g<h.length;g++){var e={};e.index=g+1;e.cert=h[g];f[g]=e}a.certsList={list:f}}c(d);return!0}})}}else!a.uiUtil().isItPFDevice(c)&&4&a.ESVS.Mode?a.CONST.__USFB_M_HDD.device!=c&&a.CONST.__USFB_M_DISK.device!=c||null==a.Whale()||!O?a.nimservice()?a.nimservice().GetAllUserCertListNum(c,b,d,function(b,d,e){if(m!=c)return!1;g=e;if(0==b)0<g?a.nimservice().GetAllUserCert(e,function(b,c){0==b?a.certsList={list:c}:win&&"none"!=win.style.display&&a.uiUtil().errMsgBox(a.nimservice().GetLastErrorMessage(),b);a.uiUtil().loadingBox(!1,"us-div-list-load");h(b)}):(a.certsList=null,a.uiUtil().loadingBox(!1,"us-div-list-load"),h(0));else{if(c==a.CONST.__USFB_M_MOBILE.device&&61E6==b)return a.ERROR.Code=11003,a.ERROR.Message=f.IDS_MSGBOX_NOT_INSTALL_MOBILE,confirm(f.IDS_MSGBOX_NOT_INSTALL_MOBILE_CFM)?(document.getElementById("us-cls-btn").click(),d="firefox"==a.browserName?window.open(a.ubiKeyEnv.downloadURL,"ubikey_url","scrollbars=1, op=100px, left=100px, height=500px, width=500px"):window.open(a.ubiKeyEnv.downloadURL,"ubikey_url","top=100px, left=100px, height=500px, width=500px"),null==d&&a.uiUtil().msgBox(f.IDS_MSGBOX_BLOCK_POPUP_WINDOW),a.certsList=null):(a.certsList=null,a.uiUtil().loadingBox(!1,"us-div-list-load"),h(0)),!1;if(c==a.CONST.__USFB_M_SECUREDISK.device&&8005E4==b)return a.ERROR.Code=31001,a.ERROR.Message=f.IDS_MSGBOX_NOT_INSTALL_SD,confirm(f.IDS_CONFIRMBOX_NOT_INSTALL_SD)&&(d="firefox"==a.browserName?window.open(a.ESVS.SDInstallURL,"securedisk_url","scrollbars=1, op=100px, left=100px, height=500px, width=380px"):window.open(a.ESVS.SDInstallURL,"securedisk_url","top=100px, left=100px, height=500px, width=380px"),null==d&&a.uiUtil().msgBox(f.IDS_MSGBOX_BLOCK_POPUP_WINDOW)),a.certsList=null,a.uiUtil().loadingBox(!1,"us-div-list-load"),h(b),!1;-1!==g&&(a.nimservice().GetLastErrorCode(),a.nimservice().GetLastErrorMessage());h(b);a.certsList=null;a.uiUtil().loadingBox(!1,"us-div-list-load")}}):(a.uiUtil().msgBox(f.IDS_MSGBOX_NIM_ERROR_UNLOAD),h(-1)):a.Whale().getCerts(c,b,function(b,c,d){0==b?(a.certsList=0==d.length?null:{list:d},a.uiUtil().loadingBox(!1,"us-div-list-load")):(a.uiUtil().loadingBox(!1,"us-div-list-load"),a.uiUtil().errMsgBox(c,b));h(b)}):h(k)}function E(c,b){if(!c||!b)return!1;if(!a.certsList||0>n.selectedIndex())return a.uiUtil().msgBox(b.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),!1;var f=a.loadUI("certverify")({type:null,args:{idx:parseInt(n.selectedIndex())},onConfirm:function(){f.dispose();c.focus()},onCancel:function(){f.dispose();c.focus()}});f.show();a.uiUtil().loadingBox(!1,"us-div-list-load");return!0}function F(c,b){if(!c||!b)return!1;if(!a.certsList||0>n.selectedIndex())return a.uiUtil().msgBox(b.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),!1;var f=a.loadUI("certview")({type:null,args:{type:"Base64",idx:parseInt(n.selectedIndex()),cert:a.certsList.list[parseInt(n.selectedIndex())-1].cert},onConfirm:function(){f.dispose();c.focus()},onCancel:function(){f.dispose();c.focus()}});f.show();a.uiUtil().loadingBox(!1,"us-div-list-load");return!0}function la(c){if(!c)return!1;var b="https://raadmin.crosscert.com/customer/tk/Main.jsp?";if(4<=a.ESVS.Mode)if(a.nimservice()){var f=a.usWebToolkit.util.encode64(document.URL);a.nimservice().EncryptDataWithSymmKey("SEED","mOdFccVPHK7xnZYc",f,"utf-8",!1,function(c,f,g){0==c&&(b+="&Y3Jvc3NjZXJ0=",b+=g);"firefox"==a.browserName?window.open(b,"crosscert_url","scrollbars=1"):window.open(b)})}else"firefox"==a.browserName?window.open(b,"crosscert_url","scrollbars=1"):window.open(b);else"firefox"==a.browserName?window.open(b,"crosscert_url","scrollbars=1"):window.open(b);c.focus()}function ma(c){if(!c)return!1;var b=document.getElementById("us-div-cert-select");b.style.display="none";var f=a.loadUI("certmanage")({type:"CERT_MANAGEMENT",args:{style:"child"},onCancel:function(){f.dispose();b.style.display="block";var d=document.getElementById("us-div-cert-select");switch(m){case a.CONST.__USFB_M_DISK.device:X(d,t);break;case a.CONST.__USFB_M_MOBILE.device:Y(d,t);break;case a.CONST.__USFB_M_HDD.device:Z(d,t);break;case a.CONST.__PF_M_LS.device:aa(d,t);break;case a.CONST.__PF_M_SS.device:K(d,t);break;case a.CONST.__USFB_M_MOBILETOKEN.device:case a.CONST.__USFB_M_SECUREDISK.device:case a.CONST.__USFB_M_HSMKEY.device:case a.CONST.__USFB_M_SMARTCARD.device:case a.CONST.__PF_M_CLOUDSIGN.device:break;default:M(d,t)}c.focus()}});f.show()}function ba(c,b,f,d){if(a.CONST.__USFB_M_DISK.device>c||!b||!f||!d)return l=!1;var h=a.loadUI("driveselect")({type:"DEVICE_REMOVABLE_DISK",args:b,onConfirm:function(g){g=b.list[g-1].index;0<g?w(c,g,d,"",function(b){0!=b?(a.uiUtil().errMsgBox(d.IDS_MSGBOX_COMMON_ERROR_GET_CERT,b),n.redrawList(null,0)):(b=x())?n.redrawList(b.list,b.list.length):n.redrawList(null,0);l=!1;a.ESVS.Embedded?setTimeout(function(){h.dispose()},10):h.dispose();f.focus();a.uiUtil().loadingBox(!1,"us-div-list-load")}):l=!1},onCancel:function(){l=!1;a.uiUtil().loadingBox(!1,"us-div-list-load");h.dispose();f.focus()}});h.show()}function na(c,b,f,d){if(a.CONST.__USFB_M_DISK.device>c||!f||!d)return l=!1;var h=a.loadUI("sectokenselect")({type:c,args:b,onConfirm:function(g){var k=b.list[g-1].name;if(0==a.ESVS.IssueCertInBIOToken&&("CERT_RENEWAL_KMCERT"===e.type||"CERT_RENEWAL"===e.type||"CERT_RENEWAL_SIGN"===e.type||"CERT_REVOCATION"===e.type||"CERT_SOE"===e.type)&&c==a.CONST.__USFB_M_HSMKEY.device&&-1!=k.indexOf("BIO_"))return a.uiUtil().errMsgBox(d.IDS_CANT_ISSUECERT_BIOTOKEN,-1),l=!1;0<g?(a.ESVS.Embedded?setTimeout(function(){h.dispose()},10):h.dispose(),w(c,g,d,"",function(b){if(0!=b){switch(b){case 4812E4:case 4813E4:a.uiUtil().msgBox(d.IDS_MSGBOX_HSM_ERROR_CONNECTION);break;default:a.uiUtil().errMsgBox(d.IDS_MSGBOX_COMMON_ERROR_GET_CERT,b)}n.redrawList(null,0)}else(b=x())?n.redrawList(b.list,b.list.length):n.redrawList(null,0);l=!1;f.focus()})):l=!1},onCancel:function(){l=!1;h.dispose();f.focus()}});h.show()}function oa(c,b,f,d){if(a.CONST.__USFB_M_DISK.device>c||!b||!f||!d)return l=!1;var h=a.loadUI("driveselect")({type:"DEVICE_SAVE_TOKEN",args:b,onConfirm:function(b){h.dispose();a.nimservice()?a.nimservice().CheckSCardConnected(function(b,h){0===b?(PINDialog=a.loadUI("pin")({type:"PIN_SAVE_TOKEN",args:null,onConfirm:function(b){a.ESVS.Embedded?setTimeout(function(){PINDialog.dispose()},10):PINDialog.dispose();a.nimservice().CheckSCardPin(b,function(h,g){if(0!=h){switch(h){case 4904E4:a.uiUtil().msgBox(d.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(d.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;default:a.uiUtil().errMsgBox(d.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN,h)}n.redrawList(null,0);l=!1;setTimeout(function(){f.focus()},10)}else w(c,0,d,b,function(b){0!=b?(a.uiUtil().errMsgBox(d.IDS_MSGBOX_COMMON_ERROR_GET_CERT,b),n.redrawList(null,0)):(b=x())?n.redrawList(b.list,b.list.length):n.redrawList(null,0);l=!1;setTimeout(function(){f.focus()},10)})})},onCancel:function(){l=!1;PINDialog.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");setTimeout(function(){f.focus()},10)}}),PINDialog.show()):(l=!1,a.uiUtil().msgBox(d.IDS_MSGBOX_SMART_CARD_UNCONNECTED),a.uiUtil().loadingBox(!1,"us-div-list-load"),setTimeout(function(){f.focus()},10))}):(l=!1,a.uiUtil().msgBox(d.IDS_MSGBOX_NIM_ERROR_UNLOAD),a.uiUtil().loadingBox(!1,"us-div-list-load"),setTimeout(function(){f.focus()},10))},onCancel:function(){l=!1;h.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");f.focus()}});h.show()}function K(c,b){if(!c||!b)return l=!1;m=a.CONST.__PF_M_SS.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);if("CERT_SELECT"!=e.type&&(I(b),B(),"MPKI"==a.ESVS.PKI)){c=document.getElementById("us-lbl-pw");var f=document.getElementById("us-lbl-pw2"),d=document.getElementById("us-pw-text");c.disabled=!1;f.disabled=!1;d.readOnly=!1;d.disabled=!1}a.uiUtil().loadingBox(!0,"us-div-list-load",0);setTimeout(function(){w(a.CONST.__PF_M_SS.device,0,b,"",function(c){if(0!=c)return a.uiUtil().errMsgBox(b.IDS_MSGBOX_COMMON_ERROR_GET_CERT,c),n.redrawList(null,0),l=!1;(c=x())?n.redrawList(c.list,c.list.length):n.redrawList(null,0);l=!1})},0)}function aa(c,b){if(!c||!b)return l=!1;m=a.CONST.__PF_M_LS.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);"CERT_SELECT"!=e.type&&(I(b),B());a.uiUtil().loadingBox(!0,"us-div-list-load",0);setTimeout(function(){w(a.CONST.__PF_M_LS.device,0,b,"",function(c){a.uiUtil().loadingBox(!1,"us-div-list-load",0);if(0!=c)return a.uiUtil().errMsgBox(b.IDS_MSGBOX_COMMON_ERROR_GET_CERT,c),n.redrawList(null,0),l=!1;(c=x())?n.redrawList(c.list,c.list.length):n.redrawList(null,0);l=!1})},10)}function ca(c,b){if(!c||!b)return l=!1;m=a.CONST.__PF_M_CLOUDSIGN.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);I(b);da("123456789012345678901234567890");w(a.CONST.__PF_M_CLOUDSIGN.device,0,b,"",function(c){if(0!=c)return a.uiUtil().errMsgBox(b.IDS_MSGBOX_COMMON_ERROR_GET_CERT,c),n.redrawList(null,0),l=!1;(c=x())?n.redrawList(c.list,c.list.length):n.redrawList(null,0);l=!1})}function Z(c,b){if(!c||!b)return l=!1;m=a.CONST.__USFB_M_HDD.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);"CERT_SELECT"!=e.type&&(I(b),B());if("MPKI"==a.ESVS.PKI){c=document.getElementById("us-lbl-pw");var f=document.getElementById("us-lbl-pw2"),d=document.getElementById("us-pw-text");c.disabled=!0;f.disabled=!0;d.readOnly=!0;d.disabled=!0}w(a.CONST.__USFB_M_HDD.device,0,b,"",function(c){if(0!=c)return a.uiUtil().errMsgBox(b.IDS_MSGBOX_COMMON_ERROR_GET_CERT,c),n.redrawList(null,0),l=!1;(c=x())?n.redrawList(c.list,c.list.length):n.redrawList(null,0);l=!1;return!0})}function X(c,b){if(!c||!b)return l=!1;l=!0;var f=null;m=a.CONST.__USFB_M_DISK.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);"CERT_SELECT"!=e.type&&(I(b),B());if(4&a.ESVS.Mode&&!a.uiUtil().isItPFDevice(m))if(null!=a.Whale()&&O)a.Whale().getDiskList(function(d,h,g){h=0;g&&(h=g.length);if(0==d&&0<h){d=[];for(var e=0,m=0;e<h;e++)if("MacIntel"!=navigator.platform||"Macintosh HD"!=g[e]){var u={};u.index=e+1;u.name=g[e];d[m++]=u}f={list:d};l=!1}else return a.uiUtil().loadingBox(!1,"us-div-list-load"),a.certsList=null,l=!1;ba(a.CONST.__USFB_M_DISK.device,f,c,b)});else if(a.nimservice())a.nimservice().GetDiskList(function(d,h,g){h=0;g&&(h=g.length);if(0==d&&0<h){d=[];for(var e=0,m=0;e<h;e++)if("MacIntel"!=navigator.platform||"Macintosh HD"!=g[e]){var u={};u.index=e+1;u.name=g[e];d[m++]=u}f={list:d}}else return a.nimservice().GetLastErrorCode(),a.nimservice().GetLastErrorMessage(),a.uiUtil().loadingBox(!1,"us-div-list-load"),a.certsList=null,l=!1;l=!1;ba(a.CONST.__USFB_M_DISK.device,f,c,b)});else return l=!1,a.uiUtil().loadingBox(!1,"us-div-list-load"),a.uiUtil().msgBox(b.IDS_MSGBOX_NIM_ERROR_UNLOAD),!1;else l=!1;return!0}function W(c,b){if(!c||!b)return l=!1;l=!0;var f=null;m=a.CONST.__USFB_M_HSMKEY.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);pa(b);B();if(4&a.ESVS.Mode)if(a.nimservice()){var d=0;if("CERT_RENEWAL_SIGN"==e.type||"CERT_RENEWAL_KMCERT"==e.type||"CERT_REVOCATION"==e.type||"CERT_SOE"==e.type)d=1;a.nimservice().GetHSMList(d,function(d,g,e){g=0;e&&(g=e.length);if(0==d&&0<g){d=0;for(var h=[],k=0;k<g;k++){var m=k+1,n={},A=e[k].split("|");n.index=m;n.name=A[0];n.driver=A[1];n.passage=A[2];n.validity=A[3];h[d++]=n}f={list:h}}else a.uiUtil().loadingBox(!1,"us-div-list-load"),a.nimservice().GetLastErrorCode();l=!1;na(a.CONST.__USFB_M_HSMKEY.device,f,c,b)})}else return l=!1,a.uiUtil().msgBox(b.IDS_MSGBOX_NIM_ERROR_UNLOAD),!1;else l=!1;return!0}function qa(c,b){if(!c||!b)return l=!1;m=a.CONST.__USFB_M_SECUREDISK.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);I(b);B();a.nimservice().IsSDInstalled(function(c,d){a.uiUtil().loadingBox(!1,"us-div-list-load");0!=c?(l=!1,a.ERROR.Code=31001,a.ERROR.Message=b.IDS_MSGBOX_NOT_INSTALL_SD,confirm(b.IDS_CONFIRMBOX_NOT_INSTALL_SD)&&(document.getElementById("us-cls-btn").click(),null==("firefox"==a.browserName?window.open(a.ESVS.SDInstallURL,"securedisk_url","scrollbars=1, op=100px, left=100px, height=500px, width=380px"):window.open(a.ESVS.SDInstallURL,"securedisk_url","top=100px, left=100px, height=500px, width=380px"))&&a.uiUtil().msgBox(b.IDS_MSGBOX_BLOCK_POPUP_WINDOW))):w(a.CONST.__USFB_M_SECUREDISK.device,1,b,"",function(c){if(0!=c)return a.uiUtil().errMsgBox(b.IDS_MSGBOX_COMMON_ERROR_GET_CERT,c),n.redrawList(null,0),l=!1;(c=x())?n.redrawList(c.list,c.list.length):n.redrawList(null,0);l=!1;return!0})})}function ra(c,b){if(!c||!b)return l=!1,!0;m=a.CONST.__USFB_M_MOBILETOKEN.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);I(b);B();l=!1;if("undefined"!=typeof jSmartCertNP)return document.getElementById("us-confirm-btn").click(),!1;4&a.ESVS.Mode?a.nimservice()?a.nimservice().IsInstalledUSIMModule(2,!1,function(c,d){a.uiUtil().loadingBox(!1,"us-div-list-load");if(0==c)a.nimservice().SetUSIMOptions(a.usimEnv.sitecode,a.usimEnv.modecode,a.usimEnv.siteURL,a.usimEnv.serviceIP,a.usimEnv.servicePort,a.usimEnv.downloadURL,function(a){a=document.getElementById("us-confirm-btn");l=!1;a.click();return!1});else{if(4847E4==c||4117E4==c){if(a.ERROR.Code=21002,a.ERROR.Message=b.IDS_MSGBOX_NOT_INSTALL_SMARTCERT,confirm(b.IDS_CONFIRMBOX_NOT_INSTALL_SMARTCERT))return document.getElementById("us-cls-btn").click(),null==("firefox"==a.browserName?window.open(a.usimEnv.downloadURL,"usim_url","scrollbars=1, op=100px, left=100px, height=500px, width=380px"):window.open(a.usimEnv.downloadURL,"usim_url","top=100px, left=100px, height=500px, width=380px"))&&a.uiUtil().msgBox(b.IDS_MSGBOX_BLOCK_POPUP_WINDOW),!1}else a.ERROR.Code=a.nimservice().GetLastErrorCode(),a.ERROR.Message=a.nimservice().GetLastErrorMessage(),a.uiUtil().errMsgBox(a.ERROR.Message,a.ERROR.Code);n.redrawList(null,-1);document.getElementById("us-div-cert-select").style.display="";l=!1}}):(l=!1,a.uiUtil().msgBox(b.IDS_MSGBOX_NIM_ERROR_UNLOAD)):l=!1;return!0}function Y(c,b,f){if(!c||!b)return l=!1;var d=[function(){ca(c,b)},function(){a.ESVS._chkEXESetupCancel=!1;sa(c,b)}],e=a.loadUI("mobileselect")({type:null,args:null,onConfirm:function(a){d[a]();f&&f(a);e.dispose();c.focus()},onCancel:function(){l=!1;e.dispose();c.focus()}});e.show();return!0}function sa(c,b){if(!c||!b)return l=!1;m=a.CONST.__USFB_M_MOBILE.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);I(b);B();if(4&a.ESVS.Mode&&!a.uiUtil().isItPFDevice(m))if(a.nimservice())w(m,v,b,"",function(c){if(0!=c){switch(c){case 61E6:case 6101E4:a.ERROR.Code=11003;a.ERROR.Message=b.IDS_MSGBOX_NOT_INSTALL_MOBILE;confirm(b.IDS_MSGBOX_NOT_INSTALL_MOBILE_CFM)&&(c=document.getElementById("us-cls-btn"),l=!1,c.click(),null==("firefox"==a.browserName?window.open(a.ubiKeyEnv.downloadURL,"ubikey_url","scrollbars=1, op=100px, left=100px, height=500px, width=500px"):window.open(a.ubiKeyEnv.downloadURL,"ubikey_url","top=100px, left=100px, height=500px, width=500px"))&&a.uiUtil().msgBox(b.IDS_MSGBOX_BLOCK_POPUP_WINDOW));break;case 6102E4:a.uiUtil().errMsgBox(b.IDS_MSGBOX_UBIKEY_LOAD_LIBRARY,c);break;case 6107E4:a.uiUtil().errMsgBox(b.IDS_MSGBOX_UBIKEY_SET_ENV,c)}n.redrawList(null,0)}else(c=x())?n.redrawList(c.list,c.list.length):n.redrawList(null,0);l=!1});else return l=!1,a.uiUtil().msgBox(b.IDS_MSGBOX_NIM_ERROR_UNLOAD),!1;else l=!1;return!0}function M(c,b){if(!c||!b)return l=!1;l=!1;a.uiUtil().MsgBox(b.IDS_MSGBOX_NOT_SUPPORTED_MEDIA);return!0}function C(c){var b="browsersign";if(c==a.CONST.__PF_M_LS.device||c==a.CONST.__PF_M_SS.device)b="browsersign";else if(c==a.CONST.__PF_M_CLOUDSIGN.device)b="cloudsign";else{null!=J&&(J.dispose(),J=null);return}null!=J?J.changeMedia(b):setTimeout(function(){J=a.loadUI("guide")({type:b,onCancel:function(){J.dispose();J=null}});J.show()},10)}function I(a){if(!a)return!1;var b=document.getElementById("us-lbl-pw");b.removeChild(b.lastChild);b.appendChild(document.createTextNode(a.IDS_PASSWORD));document.getElementById("us-lbl-pw2").innerHTML=t.IDS_PASSWORD_DESCRIPTION;return!0}function pa(a){if(!a)return!1;var b=document.getElementById("us-lbl-pw");b.removeChild(b.lastChild);b.appendChild(document.createTextNode(a.IDS_PIN));document.getElementById("us-lbl-pw2").innerHTML="";return!0}function da(c){if(null==c||0>=c.length)return!1;var b=document.getElementById("us-pw-text");b.value=c;b.readOnly=!0;b.disabled=!0;if(m==a.CONST.__PF_M_CLOUDSIGN.device||"CERT_SELECT"==e.type)document.getElementById("us-div-pw").style.display="none";return!0}function B(){m!=a.CONST.__PF_M_CLOUDSIGN.device&&(document.getElementById("us-div-pw").style.display="block");var c=document.getElementById("us-pw-text");c&&(c.value="",c.readOnly=!1,c.disabled=!1)}function ta(c,b,f){if(!c||!b||!f)return!1;var d=0,e={};try{var g=a.PFSH.SetP12OnMemory(c,b);d=g.index;a.PFUC=e=g.aluc}catch(k){switch(k.code){case 1E7:0<=k.detail.indexOf("115010")?a.uiUtil().msgBox(f.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(f.IDS_MSGBOX_COMMON_ERROR_GET_CERT,k.detail);break;default:a.uiUtil().errMsgBox(f.IDS_MSGBOX_COMMON_ERROR_GET_CERT,k.code)}return!1}a.certsList&&(a.certsList=null);c=[];b={};b.index=d;b.cert=e[d].signcert;c[0]=b;a.certsList={list:c};if(d=x())return n.redrawList(d.list,d.list.length),!0;a.certsList=null;n.redrawList(null,-1);B();return!1}function P(){a.certsList&&(a.certsList=null);n.redrawList(null,-1);B();pw=""}function ea(c,b,f,d){(null==b||0>=b.length||null==f)&&d(-1);a.certsList&&(a.certsList=null);if(0<c)a.nimservice().GetSignCertFromCertList(c,function(f,e,h){e=[];var g={};0==f?(g.index=c,g.cert=h,e[0]=g,a.certsList={list:e},(f=x())?(n.redrawList(f.list,f.list.length),b="",d(0)):(P(),d(-1))):(P(),d(-1))});else{var e=a.nimservice().GetLastErrorCode();a.nimservice().GetLastErrorMessage();switch(e){case 4301E4:a.uiUtil().msgBox(f.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED);break;default:a.uiUtil().errMsgBox(f.IDS_MSGBOX_COMMON_ERROR_GET_CERT,e)}P();d(-1)}}function ua(c,b,f,d){(null==c||0>=c.length||null==b||0>=b.length||null==f)&&d(-1);a.nimservice()?a.nimservice().GetPfxCertList(1,c,b,function(c,e,k){0==c?ea(k,b,f,function(c){0==c?d(0):d(-1);b="";a.uiUtil().loadingBox(!1,"us-div-list-load")}):(a.uiUtil().errMsgBox(e,c),P(),d(0),a.uiUtil().loadingBox(!1,"us-div-list-load"))}):(a.uiUtil().msgBox(f.IDS_MSGBOX_NIM_ERROR_UNLOAD),b="",d(-1))}function S(c,b,e,d){(null==c||0>=c.length||null==b||0>=b.length||null==e)&&d(-1);4<=a.ESVS.Mode&&!a.uiUtil().isItPFDevice(m)?a.nimservice()?a.nimservice().GetPfxCertList(0,c,b,function(c,f,k){0==c?ea(k,b,e,function(c){0==c?d(0):d(-1);b="";a.uiUtil().loadingBox(!1,"us-div-list-load")}):(a.uiUtil().errMsgBox(f,c),P(),d(-1),a.uiUtil().loadingBox(!1,"us-div-list-load"))}):(a.uiUtil().msgBox(e.IDS_MSGBOX_NIM_ERROR_UNLOAD),d(-1)):(rv=ta(c,b,e),b="")}function r(){e.onConfirm=fa;T=!1}function va(c){function b(){ha++;if(ha>=a.ESVS.LimitNumOfTimesToTryToInputPW)if(a.ESVS.Embedded)a.bsUtil().AhnlabClearText("us-pw-text"),h.value="",setTimeout(function(){h.focus()},10);else{var b=d.IDS_MSGBOX_PW_ERROR_OVER_NUMBER_OF_ALLOWED_BEFORE+a.ESVS.LimitNumOfTimesToTryToInputPW+d.IDS_MSGBOX_PW_ERROR_OVER_NUMBER_OF_ALLOWED_AFTER;a.uiUtil().msgBox(b);if("DIGITAL_SIGNATURE_P7"===e.type){var c=a.certsList.list[u-1].cert;(!c||0>=c.length)&&L();c=a.certUtil().getTheCertAttributes(c,"Base64");f(b,null,c,-1,"",m)}else L(!0)}else a.bsUtil().AhnlabClearText("us-pw-text"),h.value="",setTimeout(function(){h.focus()},10)}n.restoreOnMouseEvent();if(!c)return!1;var f=e.onConfirm;if(0==T)fa=e.onConfirm,T=!0;else return!1;e.onConfirm=function(){};var d=c,h=document.getElementById("us-pw-text"),g=h.value;if(m==a.CONST.__USFB_M_ETC.device&&("CERT_RENEWAL_KMCERT"===e.type||"CERT_RENEWAL"===e.type||"CERT_RENEWAL_SIGN"===e.type||"CERT_REVOCATION"===e.type||"CERT_SOE"===e.type))return a.uiUtil().errMsgBox(d.IDS_CANT_WORK_WITH_PFX,-1),r(),!1;g&&4&a.ESVS.Mode&&("touchen"==a.ESVS.SecureKeyboardType&&a.bsUtil().isTouchEnKeyUsable()?g=a.bsUtil().GetEncryptPwd("us-keyboard-secure-frm","us-pw-text"):"ahnlab"==a.ESVS.SecureKeyboardType&&a.bsUtil().isAhnlabProtectorUsable()&&(g=a.bsUtil().GetAhnlabEncInputInfo("us-pw-text")));if(a.CONST.__USFB_M_MOBILETOKEN.device!=m&&(!a.certsList||0>n.selectedIndex()))return a.uiUtil().msgBox(d.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),h.value="",setTimeout(function(){h.focus()},10),r(),!1;if(4&a.ESVS.Mode&&!a.uiUtil().isItPFDevice(m)){var k=function(){var b=parseInt(n.selectedIndex());if("DIGITAL_SIGNATURE_P7"===e.type){var q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;var k=a.certUtil().getTheCertAttributes(q,"Base64");f(d.IDS_MSGBOX_SIGN_ERROR,q,k,b,g,m)}else if("DIGITAL_SIGNATURE_P7_EXT"===e.type||"DIGITAL_SIGNATURE_P7_EXT_DISABLE_SECTOKEN"==e.type)f(d.IDS_MSGBOX_SIGN_ERROR,b,g,m,v);else if("DIGITAL_SIGNATURE_P7_XML"===e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;k=a.certUtil().getTheCertAttributes(q,"Base64");f(d.IDS_MSGBOX_SIGN_ERROR,k,b,g,m,q)}else if("DIGITAL_SIGNATURE_P1"===e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;a.usWebToolkit.x509Certificate.parser(q,"Base64");k=a.usWebToolkit.x509Certificate.getSubjectName();if(!k||0>=k.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-2),r(),!1;f(q,k,d.IDS_MSGBOX_SIGN_ERROR,b,g,m)}else if("CERT_RENEWAL"==e.type||"CERT_RENEWAL_KMCERT"==e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_RENEW_ERROR,-1),r(),!1;a.usWebToolkit.x509Certificate.parser(q,"Base64");var l=a.usWebToolkit.x509Certificate.getNotAfter();if(!l||0>=l.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_RENEW_ERROR,-2),r(),!1;"CERT_RENEWAL"==e.type?f(l,c.IDS_CONFIRMBOX_CERT_RENEWAL,m,v,b,g):f(l,c.IDS_CONFIRMBOX_KMCERT_ISSUE,m,v,b,g)}else if("CERT_REVOCATION"==e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;k=a.certUtil().getTheCertAttributes(q,"Base64");f(d.IDS_CONFIRMBOX_CERT_REVOCATION,b,g,m,v,k)}else if("CERT_SOE"==e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;k=a.certUtil().getTheCertAttributes(q,"Base64");f(d.IDS_CONFIRMBOX_CERT_SOE,b,g,m,v,k)}else if("DIGITAL_SIGNATURE_P7_AND_VID_VERIFICATION"===e.type||"DIGITAL_SIGNATURE_P1_AND_VID_VERIFICATION"==e.type){l={signErr:d.IDS_MSGBOX_SIGN_ERROR,verifySuc:d.IDS_MSGBOX_VID_SUCCESS_VERIFICATION,verifyErr:d.IDS_MSGBOX_VID_ERROR_VERIFICATION};q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;k=a.certUtil().getTheCertAttributes(q,"Base64");f(b,g,l,q,k,m);h.value=""}else if("DIGITAL_SIGNATURE_P7_FILE"===e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;k=a.certUtil().getTheCertAttributes(q,"Base64");f(b,g,d.IDS_MSGBOX_SIGN_ERROR,d.IDS_CONFIRMBOX_FILE_ALREADY_EXIT,k,m)}else if("ENCRYPT_P7"==e.type)f(b,g,d.IDS_MSGBOX_ENCRYPT_ERROR);else if("VID_VERIFICATION"===e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;k=a.certUtil().getTheCertAttributes(q,"Base64");f(b,g,d.IDS_MSGBOX_VID_SUCCESS_VERIFICATION,d.IDS_MSGBOX_VID_ERROR_VERIFICATION,"NIM",q,k,m)}else if("CERT_RENEWAL_SIGN"==e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_RENEW_ERROR,-1),r(),!1;a.usWebToolkit.x509Certificate.parser(q,"Base64");l=a.usWebToolkit.x509Certificate.getNotAfter();if(!l||0>=l.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_RENEW_ERROR,-2),r(),!1;k=a.certUtil().getTheCertAttributes(q,"Base64");f(l,c.IDS_CONFIRMBOX_CERT_RENEWAL,m,v,b,g,k)}else if("CERT_SELECT"===e.type){q=a.certsList.list[b-1].cert;if(!q||0>=q.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;k=a.certUtil().getTheCertAttributes(q,"Base64");f(d.IDS_MSGBOX_SIGN_ERROR,q,k,b,"",m,N)}else f()};if(null==a.Whale()&&!a.nimservice())return r(),!1;if(a.CONST.__USFB_M_MOBILETOKEN.device==m){if("DIGITAL_SIGNATURE_P7"===e.type)f(d.IDS_MSGBOX_SIGN_ERROR,null,null,-1,"",m);else if("DIGITAL_SIGNATURE_P7_EXT"===e.type||"DIGITAL_SIGNATURE_P7_EXT_DISABLE_SECTOKEN"==e.type)f(d.IDS_MSGBOX_SIGN_ERROR,-1,"",m,v);else if("DIGITAL_SIGNATURE_P1"===e.type)f(null,"",d.IDS_MSGBOX_SIGN_ERROR,-1,"",m);else if("CERT_RENEWAL"==e.type)f("",c.IDS_CONFIRMBOX_CERT_RENEWAL,m,v,-1,"");else if("CERT_RENEWAL_KMCERT"==e.type)f("",c.IDS_CONFIRMBOX_KMCERT_ISSUE,m,v,-1,"");else if("CERT_RENEWAL_SIGN"==e.type)f("",c.IDS_CONFIRMBOX_CERT_RENEWAL,m,v,-1,"",null);else if("CERT_REVOCATION"==e.type)f(d.IDS_CONFIRMBOX_CERT_REVOCATION,-1,"",m,v);else if("DIGITAL_SIGNATURE_P7_AND_VID_VERIFICATION"===e.type||"DIGITAL_SIGNATURE_P1_AND_VID_VERIFICATION"===e.type){var l={signErr:d.IDS_MSGBOX_SIGN_ERROR,verifySuc:d.IDS_MSGBOX_VID_SUCCESS_VERIFICATION,verifyErr:d.IDS_MSGBOX_VID_ERROR_VERIFICATION};f(-1,"",l,null,null,m)}else"DIGITAL_SIGNATURE_P7_FILE"===e.type?f(-1,"",d.IDS_MSGBOX_SIGN_ERROR,d.IDS_CONFIRMBOX_FILE_ALREADY_EXIT,null,m):"ENCRYPT_P7"==e.type?f(-1,g,d.IDS_MSGBOX_ENCRYPT_ERROR):"VID_VERIFICATION"===e.type?f(-1,"",d.IDS_MSGBOX_VID_SUCCESS_VERIFICATION,d.IDS_MSGBOX_VID_ERROR_VERIFICATION,"NIM"):"DIGITAL_SIGNATURE_P7_XML"===e.type?f(d.IDS_MSGBOX_SIGN_ERROR,null,-1,"",m,null):"CERT_SOE"==e.type?f(d.IDS_CONFIRMBOX_CERT_SOE,-1,"",m,v):"ENCRYPT_P7"==e.type?f(-1,"",d.IDS_MSGBOX_ENCRYPT_ERROR):f();h.value="";a.ESVS.Embedded&&B();return!0}var u=parseInt(n.selectedIndex());if(a.CONST.__USFB_M_HDD.device!=m&&a.CONST.__USFB_M_DISK.device!=m||null==a.Whale()||!O){if("MPKI"==a.ESVS.PKI||m==a.CONST.__USFB_M_ETC.device||m==a.CONST.__USFB_M_HSMKEY.device||"CERT_RENEWAL"!=e.type&&"CERT_RENEWAL_SIGN"!=e.type&&"CERT_RENEWAL_KMCERT"!=e.type&&"CERT_REVOCATION"!==e.type&&"CERT_SOE"!==e.type&&"DIGITAL_SIGNATURE_P1"!==e.type&&"DIGITAL_SIGNATURE_P7"!==e.type&&"DIGITAL_SIGNATURE_P7_EXT"!=e.type&&"DIGITAL_SIGNATURE_P7_EXT_DISABLE_SECTOKEN"!=e.type&&"DIGITAL_SIGNATURE_P7_AND_VID_VERIFICATION"!==e.type&&"DIGITAL_SIGNATURE_P1_AND_VID_VERIFICATION"!==e.type&&"VID_VERIFICATION"!==e.type)k();else{if(!g||0>=g.length)return a.uiUtil().msgBox(d.IDS_MSGBOX_PW_ERROR_PLEASE_INPUT_PASSWORD),setTimeout(function(){h.focus()},10),r(),!1;a.nimservice().CheckPassword(m,v,u,g,!1,function(c,e){if(0==c)return k(),h.value="",a.ESVS.Embedded&&B(),!0;r();"Enabled"===a.ESVS.UniCRS?a.uiUtil().errMsgBox(d.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED_URS,c):a.uiUtil().msgBox(""==e?d.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED:e);b();a.uiUtil().loadingBox(!1,"us-div-list-load")})}h.value="";a.ESVS.Embedded&&B();return!0}"CERT_SELECT"==e.type&&k();if(!g||0>=g.length)return a.uiUtil().msgBox(d.IDS_MSGBOX_PW_ERROR_PLEASE_INPUT_PASSWORD),setTimeout(function(){h.focus()},10),r(),!1;var p=a.usWebToolkit.util.encode64(a.usWebToolkit.util.encodeUtf8("abcdefghijklmnopqrstuvwxyz1234567890~!@#$%^&amp;*()\ud55c\uae00"));a.Whale().getSignDataP7(p,u,g,!0,function(c,e,f){if(0!=c)a.uiUtil().msgBox(d.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED),r(),b();else return k(),h.value="",a.ESVS.Embedded&&B(),!0})}else if(2&a.ESVS.Mode&&a.uiUtil().isItPFDevice(m)){if(!g&&m!=a.CONST.__PF_M_CLOUDSIGN.device&&"CERT_SELECT"!=e.type)return a.uiUtil().msgBox(d.IDS_MSGBOX_PW_ERROR_PLEASE_INPUT_PASSWORD),setTimeout(function(){h.focus()},10),r(),!1;if(m==a.CONST.__PF_M_CLOUDSIGN.device||"CERT_SELECT"==e.type)y=!0;else{if(!a.PFUC)return r(),!1;u=parseInt(n.selectedIndex());p=null;try{p=a.usWebToolkit.pkcs8.encryptedPrivateKeyFromBase64(a.PFUC[u].signpri)}catch(A){}var y=!1;try{y=a.usWebToolkit.pkcs8.checkUserCertPassword(p,g)}catch(A){}finally{p=""}}if(!1===y)a.uiUtil().msgBox(d.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED),r(),b();else{p=null;u=parseInt(n.selectedIndex());p=m==a.CONST.__PF_M_CLOUDSIGN.device?a.certsList.list[u-1].cert:a.PFUC[u].signcert;if("DIGITAL_SIGNATURE_P7"===e.type){if(!p||0>=p.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;y=a.certUtil().getTheCertAttributes(p,"Base64");f(d.IDS_MSGBOX_SIGN_ERROR,p,y,u,g,m,N)}else if("CERT_SELECT"===e.type){if(!p||0>=p.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;y=a.certUtil().getTheCertAttributes(p,"Base64");f(d.IDS_MSGBOX_SIGN_ERROR,p,y,u,"",m,N)}else if("DIGITAL_SIGNATURE_P1"===e.type){if(!p||0>=p.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;y=a.certUtil().getTheCertAttributes(p,"Base64");f(p,y.subjectName,d.IDS_MSGBOX_SIGN_ERROR,u,g,m,N)}else if("DIGITAL_SIGNATURE_P7_AND_VID_VERIFICATION"==e.type||"DIGITAL_SIGNATURE_P1_AND_VID_VERIFICATION"==e.type){l={signErr:d.IDS_MSGBOX_SIGN_ERROR,verifySuc:d.IDS_MSGBOX_VID_SUCCESS_VERIFICATION,verifyErr:d.IDS_MSGBOX_VID_ERROR_VERIFICATION};if(!p||0>=p.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_SIGN_ERROR,-1),r(),!1;y=a.certUtil().getTheCertAttributes(p,"Base64");f(u,g,l,p,y,m)}else if("CERT_RENEWAL"==e.type){if(!p||0>=p.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_RENEW_ERROR,-1),r(),!1;a.usWebToolkit.x509Certificate.parser(p,"Base64");l=a.usWebToolkit.x509Certificate.getNotAfter();if(!l||0>=l.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_RENEW_ERROR,-2),r(),!1;f(l,d.IDS_CONFIRMBOX_CERT_RENEWAL,m,v,u,g)}else if("CERT_RENEWAL_SIGN"==e.type){if(!p||0>=p.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_RENEW_ERROR,-1),r(),!1;a.usWebToolkit.x509Certificate.parser(p,"Base64");l=a.usWebToolkit.x509Certificate.getNotAfter();if(!l||0>=l.length)return a.uiUtil().errMsgBox(d.IDS_MSGBOX_RENEW_ERROR,-2),r(),!1;y=a.certUtil().getTheCertAttributes(p,"Base64");f(l,c.IDS_CONFIRMBOX_CERT_RENEWAL,m,v,u,g,y)}else"CERT_REVOCATION"===e.type?f(d.IDS_CONFIRMBOX_CERT_REVOCATION,u,g,m,v):"VID_VERIFICATION"===e.type?a.CONST.__PF_M_CLOUDSIGN.device==m?f(u,g,d.IDS_MSGBOX_VID_SUCCESS_VERIFICATION,d.IDS_MSGBOX_VID_ERROR_VERIFICATION,"CLOUDSIGN"):f(u,g,d.IDS_MSGBOX_VID_SUCCESS_VERIFICATION,d.IDS_MSGBOX_VID_ERROR_VERIFICATION,"PFS"):"DIGITAL_SIGNATURE_P7_EXT"===e.type||"DIGITAL_SIGNATURE_P7_EXT_DISABLE_SECTOKEN"==e.type?f(d.IDS_MSGBOX_SIGN_ERROR,u,g,m,v):f();h.value="";a.ESVS.Embedded&&B();return!0}}return!1}function wa(c,b,e){if(!c||!b)return!1;ia=a.loadUI("gridlist");n=ia({type:"certslist",tblid:"us-tbl-list",tbltitleid:"us-tbl-list-th",titlelistid:"us-grid-head-div",titlerowid:"us-list-title-row",titleelementid:"us-list-title-element",titledividerid:"us-list-title-divider",titlelistcn:"us-layout-grid-head-div",titlerowcn:"us-layout-grid-head-row",titleelementcn:"us-layout-grid-row-title-element",titledividercn:"us-layout-grid-row-title-divider",tblbodyid:"us-tbl-list-td",datalistid:"us-grid-body-div",datarowid:"us-list-body-row",dataelementid:"us-list-data-element",datalistcn:"us-layout-grid-body-div",datarowcn:"us-layout-grid-body-row",dataelementcn:"us-layout-grid-row-data-element",dataselectcn:"us-layout-grid-row-data-selected-element",textObj:b});e=!0;"opera"==a.browserName&&(e=!1);n.drawList(c,c.length,null,0,ja,e);w(m,v,b,"",function(c){0!=c?a.uiUtil().errMsgBox(b.IDS_MSGBOX_COMMON_ERROR_GET_CERT,c):(c=x())?n.redrawList(c.list,c.list.length):n.redrawList(null,0);l=!1})}function H(c){if(!c)return!1;Q(c,t,"close");for(var b=a.ESVS.Media.list.split("|"),e=0;e<b.length;e++){var d=a.CONST.medias[b[e]];if(void 0!=d&&null!=d){var h=document.getElementById("us-btn-"+d.name);if(void 0!=h&&null!=h&&"us-layout-storage-btn-none"!=h.className)if(c===h){var g=document.getElementById("us-cert-get-btn");g&&(d.device!=a.CONST.__USFB_M_HDD.device&&d.device!=a.CONST.__PF_M_LS.device&&d.device!=a.CONST.__PF_M_SS.device&&d.device!=a.CONST.__USFB_M_DISK.device?(g.style.display="none",g.style.visibility="hidden"):(g.style.display="block",g.style.visibility="visible"));h.className="us-layout-storage-btn-on"}else h.className="us-layout-storage-btn-off"}}return!0}function xa(c){if(null==c||void 0==c)return!1;var b=!a.uiUtil().isItSupportingThisStorage(c);0==b&&null!=a.ESVS.Media&&null!=a.ESVS.Media.list&&0>a.ESVS.Media.list.indexOf(c.name)&&(b=!0);if(b)return!1;b=document.getElementById("us-storage-btn-list");var e=document.createElement("li");e.setAttribute("id","us-storage-btn-li-"+c.name,0);e.setAttribute("mediaIndex",c.mediaIndex,0);7==c.mediaIndex&&(e.className="line-first");"hidden"===c.visibility?(e.style.display="none",e.style.visibility="hidden"):(e.style.display="block",e.style.visibility="visible");var d=document.createElement("button");d.setAttribute("type","button",0);d.setAttribute("id","us-btn-"+c.name,0);d.setAttribute("title",c.label,0);d.setAttribute("tabindex",c.tabIndex,0);c.disabled?(d.onclick=function(){a.uiUtil().msgBox(t.IDS_MSGBOX_NOT_SUPPORTED_MEDIA)},d.className="us-layout-storage-btn-none"):(d.onclick=c.onclick,d.className=c.device===m?"us-layout-storage-btn-on":"us-layout-storage-btn-off");e.appendChild(d);if(!a.ESVS.chkEXESetup&&"cloudsign"!==c.name&&"webstorage"!==c.name&&"browsersign"!==c.name&&(c.device!=a.CONST.__USFB_M_DISK.device&&c.device!=a.CONST.__USFB_M_HDD.device||null==a.Whale()||!O)){var h=document.createElement("span");h.className="us-download-select";d.appendChild(h)}h=document.createElement("span");h.className="us-img-storage";var g=document.createElement("img");g.setAttribute("id","us-img-"+c.name,0);g.setAttribute("alt",c.label,0);"browsersign"==c.name?"unknown"==a.browserName?c.disabled?g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+c.name+"_d.png",0):g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+c.name+".png",0):c.disabled?g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/browser/"+a.browserName+"_d.png",0):g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/browser/"+a.browserName+".png",0):c.disabled?g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+c.name+"_d.png",0):g.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_"+c.name+".png",0);h.appendChild(g);d.appendChild(h);h=document.createElement("span");h.setAttribute("id","us-lbl-"+c.name,0);h.className="us-layout-lbl-storage";h.appendChild(document.createTextNode(c.label));d.appendChild(h);e.appendChild(d);b.appendChild(e);return!0}function Q(c,b,e){if("no_more"==e)a.uiUtil().msgBox(b.IDS_MSGBOX_NOT_MORE_MEDIA);else{document.getElementById("us-storage-wrap")&&("open"==e?(c=document.getElementById("us-div-storage"),c.style.height="186px",c=document.getElementById("us-storage-more-btn"),c.setAttribute("title",b.IDS_STORAGE_MORE_VIEW+b.IDS_STORAGE_MORE_VIEW_HIDDEN+b.IDS_BUTTON,0),c.onclick=function(){Q(this,b,"close")},c=document.getElementById("us-storage-more-btn-img"),c.setAttribute("alt",b.IDS_STORAGE_MORE_VIEW+b.IDS_STORAGE_MORE_VIEW_HIDDEN,0),c.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_more_btn_close.png",0)):(c=document.getElementById("us-div-storage"),c.style.height="96px",c=document.getElementById("us-storage-more-btn"),c.setAttribute("title",b.IDS_STORAGE_MORE_VIEW+b.IDS_STORAGE_MORE_VIEW_SHOW+b.IDS_BUTTON,0),c.onclick=function(){Q(this,b,"open")},c=document.getElementById("us-storage-more-btn-img"),c.setAttribute("alt",b.IDS_STORAGE_MORE_VIEW+b.IDS_STORAGE_MORE_VIEW_SHOW+b.IDS_BUTTON,0),c.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_more_btn_open.png",0)));c=a.ESVS.Media.list.split("|");for(var d=0;d<c.length;d++){var f=a.CONST.medias[c[d]];if(void 0!=f&&null!=f){var g=document.getElementById("us-storage-btn-li-"+f.name);if(void 0!=g&&null!=g){var k=g.getAttribute("mediaIndex");"open"==e?(g.style.display="block",g.style.visibility="visible"):6<k?(g.style.display="none",g.style.visibility="hidden"):(g.style.display="block",g.style.visibility="visible");1==k&&document.getElementById("us-btn-"+f.name)}}}}return!0}function L(c){a.ESVS._chkEXESetupCancel=!0;n.restoreOnMouseEvent();m==a.CONST.__PF_M_CLOUDSIGN.device&&a.PFCS().reqCloseSession();if(c)e.onCancel(!0);else e.onCancel()}var ya=function(){var c=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");c.open("GET",a.ESVS.SRCPath+(a.ESVS.Embedded?"unisignweb/rsrc/layout/certselect_embedded.html?version="+a.ver:"unisignweb/rsrc/layout/certselect.html?version="+a.ver),!1);c.send(null);return c.responseText},ka=function(){var c=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");c.open("GET",a.ESVS.SRCPath+"unisignweb/rsrc/lang/"+a.ESVS.Language+"/certselect_"+a.ESVS.Language+".js?version="+a.ver,!1);c.send(null);return c.responseText},t=a.CustomEval(ka,!0),ia=null,n=null,ha=0,z=a.ESVS.TabIndex+1,ja=0,m=a.CONST.__USFB_M_HDD.device,v=0,O=!1,N=null,l=!1,J=null;if(null!=a.ESVS.Media&&null!=a.ESVS.Media.defaultdevice){m=a.uiUtil().getMediaDevice(a.ESVS.Media.defaultdevice);a.uiUtil().isItPFDevice(m)&&4==a.ESVS.Mode&&(a.SELECTINFO.curdevice=m=a.CONST.__USFB_M_HDD.device);if(m==a.CONST.__USFB_M_SECUREDISK.device||m==a.CONST.__USFB_M_SMARTCARD.device||m==a.CONST.__USFB_M_DISK.device)v=1;a.SELECTINFO.curdevice=m}else 2==a.ESVS.Mode&&(m=a.CONST.__PF_M_LS.device,a.SELECTINFO.curdevice=m);var U=null,V=null;window.FileReader?(U=function(c,b){if(null==c)return!1;a.uiUtil().loadingBox(!0,"us-div-list-load");if(a.uiUtil().isItPortableDevice())a.uiUtil().ImportFromBackupStore();else if(a.uiUtil().isItPortableDevice())a.uiUtil().ImportFromBackupStore();else{var e=document.getElementById("us-confirm-btn"),d=document.getElementById("us-cert-search-btn"),h=a.loadUI("importcert")({type:"searchpfx",args:null,onConfirm:function(b,f,l){h.dispose();"MPKI"==a.ESVS.PKI?l?V(a.CONST.__USFB_M_HDD.device,0,b,f):S(b,f,c,function(a){f="";0===a?setTimeout(function(){e.focus()},10):setTimeout(function(){d.focus()},10)}):l?(SSDialog=a.loadUI("storageselect")({type:"CERT_IMPORT",args:null,onConfirm:function(c,d){SSDialog.dispose();a.uiUtil().loadingBox(!1,"us-div-list-load");V(c,d,b,f)},onCancel:function(){pw="";SSDialog.dispose();S(b,f,c,function(a){f="";0===a?setTimeout(function(){e.focus()},10):setTimeout(function(){d.focus()},10)})}}),SSDialog.show()):S(b,f,c,function(a){f="";if(0===a){var b=document.getElementById("us-confirm-btn");setTimeout(function(){b.focus()},10)}else{var c=document.getElementById("us-cert-search-btn");c&&setTimeout(function(){c.focus()},10)}})},onCancel:function(){a.uiUtil().loadingBox(!1,"us-div-list-load");a.uiUtil().msgBox(c.IDS_MSGBOX_CERT_IMPORT_CANCEL);h.dispose();setTimeout(function(){d.focus()},10)}});h.show()}return!0},V=function(c,b,f,d){function h(){var a=x();a?n.redrawList(a.list,a.list.length):n.redrawList(null,0)}function g(b,c,d,e){0===b&&m===c&&v===d&&(a.CONST.__USFB_M_SMARTCARD.device===m&&0===v&&w(m,v,t,e,function(a){(a=x())?n.redrawList(a.list,a.list.length):n.redrawList(null,0);l=!1}),w(m,v,t,"",function(a){(a=x())?n.redrawList(a.list,a.list.length):n.redrawList(null,0);l=!1}))}var k=d;document.getElementById("us-cert-get-btn");if(c==a.CONST.__PF_M_LS.device){var r=0;try{a.PFSH.LoadAllCerts(document.domain)}catch(D){301E5===D.code&&(a.PFSH.InstallCACerts(document.domain),a.PFSH.LoadAllCerts(document.domain))}try{var u=a.PFSH.SetP12OnMemory(f,k),p=u.aluc[u.index];a.usWebToolkit.x509Certificate.parser(p.signcert,"Base64");var y=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),A=a.certUtil().getIssuerEnName(y);a.PFSH.SaveUserCert(A,p,document.domain,!0)}catch(D){switch(r=D.code,D.code){case 1E7:0<=D.detail.indexOf("115010")?a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(t.IDS_MSGBOX_CERT_IMPORT_ERROR,D.detail);break;default:a.uiUtil().errMsgBox(t.IDS_MSGBOX_CERT_IMPORT_ERROR,D.code)}}g(r,c,b,"")}else if(c==a.CONST.__PF_M_SS.device){var q=function(d,e){a.CCPFSH().SetP12OnMemory(d,e,function(d,f,h){if(0==d)d=h.aluc[h.index],a.usWebToolkit.x509Certificate.parser(d.signcert,"Base64"),h=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),h=a.certUtil().getIssuerEnName(h),a.CCPFSH().SaveUserCert(h,d,!0,function(d){e="";0==d?g(d,c,b,""):a.uiUtil().errMsgBox(t.IDS_MSGBOX_CERT_IMPORT_ERROR,f)});else{switch(d){case 1E7:0<=f.indexOf("115010")?a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(t.IDS_MSGBOX_CERT_IMPORT_ERROR,f);break;default:a.uiUtil().errMsgBox(t.IDS_MSGBOX_CERT_IMPORT_ERROR,d)}e=""}})};a.CCPFSH().IsCCPFSHAvailable(function(b){a.CCPFSH().GetCCStorageHandler(a.ESVS.EncAlgo,a.ESVS.HashAlgo,a.ESVS.BSPKI,function(a,b){0==a&&q(f,k)})})}else a.CONST.__USFB_M_HSMKEY.device===c||a.CONST.__USFB_M_SMARTCARD.device===c?(r=null,r=a.CONST.__USFB_M_SMARTCARD.device===c?"PIN_SAVE_TOKEN":"PIN_SECURITY_TOKEN",PINDialog=a.loadUI("pin")({type:r,args:null,onConfirm:function(k){a.nimservice().ImportCert(0,f,d,c,b,k,function(d,f){if(0==d)m==c&&v==b&&c!=a.CONST.__USFB_M_MOBILE.device?g(d,c,b,k):(h(),a.uiUtil().msgBox(t.IDS_MSGBOX_CERT_IMPORT_SUCCESS)),e.args&&3==e.args.type&&L();else switch(a.uiUtil().loadingBox(!1,"us-div-list-load"),d){case 4823E4:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4844E4:a.uiUtil().msgBox(t.IDS_MSGBOX_HSM_ERROR_MEMORY_TOO_SMALL);break;case 4846E4:a.uiUtil().msgBox(t.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_KEY_LENGTH);break;case 4904E4:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;case 4843E4:case 4123E4:f=a.nimservice().GetLastErrorMessage();f=t.IDS_MSGBOX_CERT_COPY_ERROR_NEWEST_CERT+"\n\n"+f;a.uiUtil().msgBox(f);break;case 4019E4:a.uiUtil().errMsgBox(f,d);break;case 4301E4:0<=f.indexOf("3509")?a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD):a.uiUtil().errMsgBox(t.IDS_MSGBOX_CERT_IMPORT_ERROR,f);break;default:switch(d=a.nimservice().GetLastErrorCode(),a.nimservice().GetLastErrorMessage(),d){case 3509:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD);break;default:a.uiUtil().errMsgBox(f?f:t.IDS_MSGBOX_CERT_IMPORT_ERROR,d)}}});PINDialog.dispose()},onCancel:function(){k="";PINDialog.dispose()}}),PINDialog.show()):a.nimservice().ImportCert(0,f,d,c,b,"",function(d,f){if(0==d)m==c&&v==b&&c!=a.CONST.__USFB_M_MOBILE.device?g(d,c,b,""):(h(),a.uiUtil().msgBox(t.IDS_MSGBOX_CERT_IMPORT_SUCCESS)),e.args&&3==e.args.type&&L();else switch(a.uiUtil().loadingBox(!1,"us-div-list-load"),d){case 4823E4:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4844E4:a.uiUtil().msgBox(t.IDS_MSGBOX_HSM_ERROR_MEMORY_TOO_SMALL);break;case 4846E4:a.uiUtil().msgBox(t.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_KEY_LENGTH);break;case 4904E4:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;case 4843E4:case 4123E4:f=a.nimservice().GetLastErrorMessage();f=t.IDS_MSGBOX_CERT_COPY_ERROR_NEWEST_CERT+"\n\n"+f;a.uiUtil().msgBox(f);break;case 4019E4:a.uiUtil().errMsgBox(f,d);break;case 4301E4:0<=f.indexOf("3509")?a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD):a.uiUtil().errMsgBox(t.IDS_MSGBOX_CERT_IMPORT_ERROR,f);break;default:switch(d=a.nimservice().GetLastErrorCode(),a.nimservice().GetLastErrorMessage(),d){case 3509:a.uiUtil().msgBox(t.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD);break;default:a.uiUtil().errMsgBox(f?f:t.IDS_MSGBOX_CERT_IMPORT_ERROR,d)}}})}):(U=function(c,b){if(null==c)return!1;b=document.getElementById("us-file-search-hidden");if("safari"==a.browserName&&6>parseFloat(a.browserVersion))return a.uiUtil().msgBox(c.IDS_MSGBOX_SEARCH_CERT_GUIDE_FOR_SAFARI),!1;if("opera"==a.browserName||"safari"==a.browserName||"msie"==a.browserName&&8===parseInt(a.browserVersion))b.style.display="block";"safari"==a.browserName&&b.setAttribute("accept","",0);b.value="";if(""!=b.value){c=b.onchange;var e=b.parentNode;e.removeChild(b);b=document.createElement("input");b.setAttribute("type","file",0);"safari"==a.browserName?b.setAttribute("accept","",0):b.setAttribute("accept","application/x-pkcs12",0);b.setAttribute("id","us-file-search-hidden",0);b.className="us-layout-file-search-hidden";b.onchange=c;e.appendChild(b)}b.click();return!0},ImportPFX=function(c,b){function f(b,c,d,e){a.uiUtil().msgBox(h.IDS_MSGBOX_CERT_IMPORT_SUCCESS);a.CONST.__USFB_M_SMARTCARD.device===m&&1===v?w(m,v,h,e,function(a){(a=x())?n.redrawList(a.list,a.list.length):n.redrawList(null,0);l=!1}):w(m,v,h,"",function(a){(a=x())?n.redrawList(a.list,a.list.length):n.redrawList(null,0);l=!1})}function d(b,c,d,k,l){function q(d){var l=0,q=null;null!=g&&(l=1,q=g);a.nimservice().ImportCert(l,q,k,b,c,d,function(g,l){if(0==g)m==b&&v==c&&b!=a.CONST.__USFB_M_MOBILE.device?f(g,b,c,d):((g=x())?n.redrawList(g.list,g.list.length):n.redrawList(null,0),a.uiUtil().msgBox(h.IDS_MSGBOX_CERT_IMPORT_SUCCESS)),e.args&&3==e.args.type&&L(),k=d="";else switch(a.uiUtil().loadingBox(!1,"us-div-list-load"),g){case 4823E4:a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SEC_TOKEN_PIN);break;case 4825E4:a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_SEC_TOKEN_PIN_LOCKED);break;case 4844E4:a.uiUtil().msgBox(h.IDS_MSGBOX_HSM_ERROR_MEMORY_TOO_SMALL);break;case 4846E4:a.uiUtil().msgBox(h.IDS_MSGBOX_HSM_ERROR_UNSUPPORT_KEY_LENGTH);break;case 4904E4:a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_SAVE_TOKEN_PIN);break;case 4905E4:a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_SAVE_TOKEN_PIN_LOCKED);break;case 4843E4:case 4123E4:g=a.nimservice().GetLastErrorMessage();g=h.IDS_MSGBOX_CERT_COPY_ERROR_NEWEST_CERT+"\n\n"+g;a.uiUtil().msgBox(g);break;case 4019E4:a.uiUtil().errMsgBox(l,g);break;default:switch(g=a.CONST.__PF_M_LS.device===b?g:a.nimservice().GetLastErrorCode(),g){case 3509:a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_INPUT_WRONG_PASSWORD);break;default:a.uiUtil().errMsgBox(h.IDS_MSGBOX_CERT_IMPORT_ERROR,g)}}})}var p=document.getElementById("us-cert-manage-get-cert-btn");if(4<=a.ESVS.Mode)if(a.CONST.__PF_M_LS.device==b||a.CONST.__PF_M_SS.device==b){if(!a.PFSH)return a.uiUtil().msgBox("unsupport html5 storage"),!1;d=0;try{var u=a.PFSH.SetP12OnMemory(null,k),t=u.index,r=u.aluc[t];a.usWebToolkit.x509Certificate.parser(r.signcert,"Base64");var y=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),w=a.certUtil().getIssuerEnName(y);a.PFSH.SaveUserCert(w,r,document.domain,!0)}catch(G){switch(d=G.code,G.code){case 1E7:0<=G.detail.indexOf("115010")?a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(h.IDS_MSGBOX_CERT_IMPORT_ERROR,G.detail);break;default:a.uiUtil().errMsgBox(h.IDS_MSGBOX_CERT_IMPORT_ERROR,G.code)}}0==d&&f(d,b,c,"");k="";l&&l.dispose();setTimeout(function(){p.focus()},10)}else a.nimservice()?a.CONST.__USFB_M_HSMKEY.device===b||a.CONST.__USFB_M_SMARTCARD.device===b?(l&&l.dispose(),l=null,l=a.CONST.__USFB_M_SMARTCARD.device===b?"PIN_SAVE_TOKEN":"PIN_SECURITY_TOKEN",PINDialog=a.loadUI("pin")({type:l,args:null,onConfirm:function(a){q(a);PINDialog.dispose();setTimeout(function(){p.focus()},10)},onCancel:function(){k="";PINDialog.dispose();setTimeout(function(){p.focus()},10)}}),PINDialog.show()):(l&&l.dispose(),q("")):a.uiUtil().msgBox(h.IDS_MSGBOX_NIM_ERROR_UNLOAD);else{if(!a.PFSH)return a.uiUtil().msgBox("unsupport html5 storage"),!1;d=0;try{u=a.PFSH.SetP12OnMemory(null,k),t=u.index,r=u.aluc[t],a.usWebToolkit.x509Certificate.parser(r.signcert,"Base64"),y=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),w=a.certUtil().getIssuerEnName(y),a.PFSH.SaveUserCert(w,r,document.domain,!0)}catch(G){switch(d=G.code,G.code){case 1E7:0<=G.detail.indexOf("115010")?a.uiUtil().msgBox(h.IDS_MSGBOX_PW_ERROR_PASSWORD_IS_NOT_MATCHED):a.uiUtil().errMsgBox(h.IDS_MSGBOX_CERT_IMPORT_ERROR,G.detail);break;default:a.uiUtil().errMsgBox(h.IDS_MSGBOX_CERT_IMPORT_ERROR,G.code)}}0==d&&f(d,b,c,"");k="";l&&l.dispose();setTimeout(function(){p.focus()},10)}}if(!c||!b)return!1;m=a.CONST.__USFB_M_ETC.device;v=0;var h=b,g=null;document.getElementById("us-confirm-btn");var k=document.getElementById("us-cert-search-btn");if("opera"==a.browserName||"safari"==a.browserName)c.style.display="none";if("msie"==a.browserName&&8===parseInt(a.browserVersion))b=document.getElementById("us-div-cert-select"),b.onselectstart=function(){return!0},c.select(),g=c.value,c.style.display="none",b.onselectstart=function(){return!1};else if("msie"==a.browserName&&9===parseInt(a.browserVersion)){if(g=c.value,-1<g.indexOf("fakepath"))return a.uiUtil().msgBox(h.IDS_MSGBOX_SEARCH_CERT_GUIDE_FOR_IE9),setTimeout(function(){k.focus()},10),!1}else g=c.value;if(0==IsPFX(g,h))return setTimeout(function(){k.focus()},10),!1;var t=a.loadUI("confirm")({type:null,args:{msg:h.IDS_MSG_SAVE_CERT},onConfirm:function(){t.dispose();Dialog=a.loadUI("password")({type:null,args:null,onConfirm:function(b){Dialog.dispose();"MPKI"==a.ESVS.PKI?d(a.CONST.__USFB_M_HDD.device,0,g,b,null):(SSDialog=a.loadUI("storageselect")({type:"CERT_IMPORT",args:null,onConfirm:function(a,c){d(a,c,g,b,SSDialog)},onCancel:function(){b="";SSDialog.dispose();setTimeout(function(){certGetBtn.focus()},10)}}),SSDialog.show())},onCancel:function(){Dialog.dispose();setTimeout(function(){certGetBtn.focus()},10)}});Dialog.show()},onCancel:function(){t.dispose();Dialog=a.loadUI("password")({type:null,args:null,onConfirm:function(b){Dialog.dispose();"MPKI"==a.ESVS.PKI?d(a.CONST.__USFB_M_HDD.device,0,g,b,null):null!=g?(Dialog.dispose(),ua(g,b,h,function(a){b="";if(0===a){var c=document.getElementById("us-confirm-btn");setTimeout(function(){c.focus()},10)}else{var d=document.getElementById("us-cert-search-btn");d&&setTimeout(function(){d.focus()},10)}})):(Dialog.dispose(),S(null,b,h,function(a){b="";if(0===a){var c=document.getElementById("us-confirm-btn");setTimeout(function(){c.focus()},10)}else{var d=document.getElementById("us-cert-search-btn");d&&setTimeout(function(){d.focus()},10)}}))},onCancel:function(){Dialog.dispose();setTimeout(function(){certGetBtn.focus()},10)}});Dialog.show()}});t.show();return!0});var T=!1,fa=null;return function(){var c=a.CustomEval(ya),b=a.CustomEval(ka,!0);a.ESVS.TargetObj.innerHTML=c();e.args.device&&a.uiUtil().isValidDevice(e.args.device)&&(m=e.args.device,v=e.args.drive);!0===e.args.possibleWhale&&(O=!0);var f=document.getElementById("us-lbl-title");a.ESVS.Embedded?(c=document.getElementById("us-lbl-title"),c.appendChild(document.createTextNode(b.IDS_CERT_SELECTION+" "+b.IDS_CERT_SELECTION_PURPOSE_SIGN)),c.setAttribute("tabindex",z++,0),document.getElementById("us-cursor-disabled").setAttribute("tabindex",z++,0)):(f.appendChild(document.createTextNode(b.IDS_CERT_SELECTION)),f.setAttribute("tabindex",z++,0),f.setAttribute("title",b.IDS_SENSE_READER_INTRO,0),c=document.getElementById("us-cls-img-btn"),c.setAttribute("title",b.IDS_CLOSE_CERT_SELECTION_CLOSE,0),c.onclick=function(){l&&a.ESVS.chkEXESetup||L()},document.getElementById("us-cls-btn-img").setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/cert_close_btn.png",0),c=document.getElementById("us-logo-img"),c.setAttribute("alt",b.IDS_LOGO,0),null!=a.options.logo?c.setAttribute("src",a.options.logo,0):c.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/main_cert_logo.png",0),c=document.getElementById("us-legend-storage"),c.appendChild(document.createTextNode(b.IDS_STORAGE_SELECT)));c=0;for(var d=a.ESVS.Media.list.split("|"),h=0;h<d.length;h++){var g=d[h],k=a.CONST.medias[g];if(void 0!=k&&null!=k){switch(k.device){case a.CONST.__USFB_M_DISK.device:k.label=b.IDS_STORAGE_REMOVABLE;k.disabled=2==a.ESVS.Mode||"MPKI"==a.ESVS.PKI;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__USFB_M_DISK.device),a.ESVS._chkEXESetupCancel=!1,X(this,b),H(this),a.SELECTINFO.curdevice=a.CONST.__USFB_M_DISK.device)};break;case a.CONST.__USFB_M_HSMKEY.device:k.label=b.IDS_STORAGE_SECTOKEN;k.disabled="win"!=a.osName||2==a.ESVS.Mode||"MPKI"==a.ESVS.PKI;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__USFB_M_HSMKEY.device),a.ESVS._chkEXESetupCancel=!1,W(this,b),H(this),a.SELECTINFO.curdevice=a.CONST.__USFB_M_HSMKEY.device)};break;case a.CONST.__USFB_M_SMARTCARD.device:k.label=b.IDS_STORAGE_SAVETOKEN;k.disabled="win"!=a.osName||2==a.ESVS.Mode||"MPKI"==a.ESVS.PKI;k.onclick=function(){if(!l||!a.ESVS.chkEXESetup){C(a.CONST.__USFB_M_SMARTCARD.device);a.ESVS._chkEXESetupCancel=!1;if(this&&b){l=!0;m=a.CONST.__USFB_M_SMARTCARD.device;v=0;a.certsList&&(a.certsList=null);n.redrawList(null,-1);I(b);B();var c=[];var d={};d.index=a.CONST.__USFB_M_SMARTCARD.device;d.name=b.IDS_SAVETOKEN_SMART_CARD;c[0]=d;c={list:c};l=!1;oa(a.CONST.__USFB_M_SMARTCARD.device,c,this,b)}else l=!1;H(this);a.SELECTINFO.curdevice=a.CONST.__USFB_M_SMARTCARD.device}};break;case a.CONST.__USFB_M_MOBILE.device:k.label=b.IDS_STORAGE_MOBILEPHONE;k.disabled="win"!=a.osName||2==a.ESVS.Mode||"MPKI"==a.ESVS.PKI||e.type&&("CERT_RENEWAL"==e.type||"CERT_RENEWAL_SIGN"==e.type||"CERT_RENEWAL_KMCERT"==e.type||"CERT_REVOCATION"==e.type||"CERT_SOE"==e.type);k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__USFB_M_MOBILE.device),Y(this,b,function(b){a.SELECTINFO.curdevice="cloudsign"==b?a.CONST.__PF_M_CLOUDSIGN.device:a.CONST.__USFB_M_MOBILE.device}),H(this))};break;case a.CONST.__USFB_M_HDD.device:k.label=b.IDS_STORAGE_HARDDISK;k.disabled=2==a.ESVS.Mode;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__USFB_M_HDD.device),a.ESVS._chkEXESetupCancel=!1,Z(this,b),H(this),a.SELECTINFO.curdevice=a.CONST.__USFB_M_HDD.device)};break;case a.CONST.__USFB_M_MOBILETOKEN.device:k.label=b.IDS_STORAGE_MOBILETOKEN;k.disabled="CERT_RENEWAL"==e.type||"CERT_RENEWAL_SIGN"==e.type||"CERT_RENEWAL_KMCERT"==e.type?!0:"win"!=a.osName||2==a.ESVS.Mode||"MPKI"==a.ESVS.PKI||e.type&&("DIGITAL_SIGNATURE_P7_EXT"==e.type||"DIGITAL_SIGNATURE_P7_EXT_DISABLE_SECTOKEN"==e.type);k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__USFB_M_MOBILETOKEN.device),a.ESVS._chkEXESetupCancel=!1,document.getElementById("us-div-cert-select").style.display="none",a.SELECTINFO.curdevice=a.CONST.__USFB_M_MOBILETOKEN.device,ra(this,b)&&H(this))};break;case a.CONST.__USFB_M_SECUREDISK.device:k.label=b.IDS_STORAGE_SECUREDISK;k.disabled="win"!=a.osName||2==a.ESVS.Mode||"MPKI"==a.ESVS.PKI;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__USFB_M_SECUREDISK.device),a.ESVS._chkEXESetupCancel=!1,qa(this,b),H(this),a.SELECTINFO.curdevice=a.CONST.__USFB_M_SECUREDISK.device)};break;case a.CONST.__PF_M_LS.device:k.label=b.IDS_STORAGE_LS;k.disabled=1==a.ESVS.Mode||"CERT_SOE"==e.type||"CERT_REVOCATION"==e.type||"CERT_RENEWAL_KMCERT"==e.type;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__PF_M_LS.device),a.ESVS._chkEXESetupCancel=!0,aa(this,b),H(this),a.SELECTINFO.curdevice=a.CONST.__PF_M_LS.device)};break;case a.CONST.__PF_M_SS.device:k.label=b.IDS_STORAGE_SS;k.disabled=1==a.ESVS.Mode||"CERT_SOE"==e.type||"CERT_REVOCATION"==e.type||"CERT_RENEWAL_KMCERT"==e.type;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__PF_M_SS.device),a.ESVS._chkEXESetupCancel=!0,K(this,b),H(this),a.SELECTINFO.curdevice=a.CONST.__PF_M_SS.device)};break;case a.CONST.__PF_M_TOUCHSIGN.device:k.label=b.IDS_STORAGE_TOUCHSIGN;k.disabled=!0;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__PF_M_TOUCHSIGN.device),a.ESVS._chkEXESetupCancel=!1,M(this,b),a.SELECTINFO.curdevice=a.CONST.__PF_M_TOUCHSIGN.device)};break;case a.CONST.__PF_M_SMARTSIGN.device:k.label=b.IDS_STORAGE_SMARTSIGN;k.disabled=!0;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__PF_M_SMARTSIGN.device),a.ESVS._chkEXESetupCancel=!1,M(this,b),a.SELECTINFO.curdevice=a.CONST.__PF_M_SMARTSIGN.device)};break;case a.CONST.__PF_M_WEBSECTOKEN.device:k.label=b.IDS_STORAGE_WEBSECTOKEN;k.disabled=!0;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__PF_M_WEBSECTOKEN.device),a.ESVS._chkEXESetupCancel=!1,M(this,b),a.SELECTINFO.curdevice=a.CONST.__PF_M_WEBSECTOKEN.device)};break;case a.CONST.__PF_M_WEBSOFTTOKEN.device:k.label=b.IDS_STORAGE_WEBSOFTTOKEN;k.disabled=!0;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__PF_M_WEBSOFTTOKEN.device),a.ESVS._chkEXESetupCancel=!1,M(this,b),a.SELECTINFO.curdevice=a.CONST.__PF_M_WEBSOFTTOKEN.device)};break;case a.CONST.__PF_M_CLOUDSIGN.device:k.label=b.IDS_STORAGE_CLOUDSIGN;k.disabled=1==a.ESVS.Mode;k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(a.CONST.__PF_M_CLOUDSIGN.device),a.ESVS._chkEXESetupCancel=!0,ca(this,b),H(this),a.SELECTINFO.curdevice=a.CONST.__PF_M_CLOUDSIGN.device)};break;default:k.label=b.IDS_STORAGE_ETC,k.disabled=!0,k.onclick=function(){l&&a.ESVS.chkEXESetup||(C(0),a.ESVS._chkEXESetupCancel=!1,M(this,b),a.SELECTINFO.curdevice=0)}}a.ESVS.Media.option&&0>=a.ESVS.Media.option&&-1*a.ESVS.Media.option&Math.pow(2,h)&&a.ESVS.Media.defaultdevice!=g&&(k.disabled=!0);k.tabIndex=z;k.mediaIndex=c+1;k.visibility=6<k.mediaIndex?"hidden":"visible";xa(k)&&(z++,c++)}}d=document.getElementById("us-storage-more-btn");null!=d&&void 0!=d&&(d.setAttribute("title",b.IDS_STORAGE_MORE_VIEW+b.IDS_STORAGE_MORE_VIEW_SHOW+b.IDS_BUTTON,0),6<c?(d.style.display="block",d.style.visibility="visible",d.setAttribute("tabindex",z++,0),d.onclick=function(){Q(this,b,"open")}):(d.setAttribute("disabled","disabled",0),d.style.display="none",d.style.visibility="hidden",d.onclick=function(){Q(this,b,"no_more")}),c=document.getElementById("us-storage-more-btn-img"),c.setAttribute("alt",b.IDS_STORAGE_MORE_VIEW+b.IDS_STORAGE_MORE_VIEW_SHOW,0),c.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/media_more_btn_open.png",0));document.getElementById("us-h5-storage").innerText=b.IDS_H5_STORAGE;document.getElementById("us-h5-list").innerText=b.IDS_H5_LIST;c=document.getElementById("us-tbl-list");c.style.summary=b.IDS_CERT_LIST_TABLE_SUMMARY;c.setAttribute("title",b.IDS_CERT_LIST_CAPTION);a.ESVS.Mode&2&&a.uiUtil().loadingBox(!0,"us-div-list-load",0);var t=[{title:b.IDS_CERT_STATUS},{title:b.IDS_CERT_CLASSIFY},{title:b.IDS_CERT_USER},{title:b.IDS_CERT_ISSUER},{title:b.IDS_CERT_EXPIRATION_DAY}];ja=z++;setTimeout(function(){wa(t,b,e.args.list)},100);document.getElementById("us-lbl-pw").appendChild(document.createTextNode(b.IDS_PASSWORD));document.getElementById("us-lbl-pw2").innerHTML=b.IDS_PASSWORD_DESCRIPTION;document.getElementById("us-file-search-hidden").onchange=function(){ImportPFX(this,b)};c=document.getElementById("us-cert-search-btn");c.setAttribute("value",b.IDS_CERT_SEARCH,0);c.onclick=function(){U(b)};if(0==a.ESVS.CertRequestPageEnable||"CERT_RENEWAL"==e.type||"CERT_RENEWAL_SIGN"==e.type||"CERT_RENEWAL_KMCERT"==e.type||"DIGITAL_SIGNATURE_P7_EXT_DISABLE_SECTOKEN"==e.type)c.style.display="none",c.style.visibility="hidden";a.uiUtil().addCapsLockEvent("us-pw-text","us-err-msg-capslock",b.IDS_MSGBOX_CAPSLOCK_ON,null);var u=document.getElementById("us-pw-text");u.onkeydown=function(a){if(a=a?a:event)a=a||window.event,13==(a.which||a.keyCode)&&document.getElementById("us-confirm-btn").click()};u.onkeyup=function(a){a.getModifierState&&(a.getModifierState("CapsLock")?(document.getElementById("us-err-msg-capslock").style.top=u.offsetTop+0+30+"px",document.getElementById("us-err-msg-capslock").style.display="block"):document.getElementById("us-err-msg-capslock").style.display="none")};u.onfocus=function(a){"block"==document.getElementById("us-err-msg-capslock").style.display&&(document.getElementById("us-err-msg-capslock").style.top=u.offsetTop+0+30+"px")};u.value="";u.setAttribute("title",b.IDS_PASSWORD_LABEL+b.IDS_PASSWORD_DESCRIPTION);a.ESVS.Embedded||(document.getElementById("enabledpw").innerHTML='<input id="us-confirm-btn" class="us-normal-btn btn-confirm h35" type="button" />');"MPKI"==a.ESVS.PKI&&a.ESVS.Media.defaultdevice==a.CONST.__USFB_M_HDD.name&&(d=document.getElementById("us-lbl-pw"),h=document.getElementById("us-lbl-pw2"),d.disabled=!0,h.disabled=!0,u.readOnly=!0,u.disabled=!0);k=document.getElementById("us-confirm-btn");k.setAttribute("value",b.IDS_CONFIRM,0);k.onclick=function(){va(b)};if(d=document.getElementById("us-cert-verify-btn"))d.setAttribute("value",b.IDS_CERT_VERIFY,0),d.onclick=function(){E(this,b)};h=document.getElementById("us-cert-view-btn");h.setAttribute("value",b.IDS_CERT_VIEW,0);h.onclick=function(){F(this,b)};g=document.getElementById("us-cert-proposal-btn");g.setAttribute("value",b.IDS_CERT_PROPOSAL,0);g.setAttribute("title",b.IDS_LINK_TITLE,0);g.onclick=function(){la(this)};if(0==a.ESVS.CertRequestPageEnable||"MPKI"==a.ESVS.PKI)g.readOnly=!0,g.disabled=!0,g.style.display="none",g.style.visibility="hidden";document.getElementById("us-cert-get-btn");var p=document.getElementById("us-cls-btn"),r=document.getElementById("us-cert-manage-btn");r&&(r.setAttribute("value",b.IDS_CERT_MANAGE,0),r.onclick=function(){l||ma(this)},r.display="block",r.visibility="visible");a.uiUtil().isIraq()&&(c.style.visibility="hidden",g.style.visibility="hidden");if(a.ESVS.Embedded)u.setAttribute("tabindex",z++,0),k.setAttribute("tabindex",z++,0),c.setAttribute("tabindex",z++,0),g.setAttribute("tabindex",z++,0),h.setAttribute("tabindex",z++,0),d&&d.setAttribute("tabindex",z++,0);else if(u.setAttribute("tabindex",z++,0),"none"!=document.getElementById("us-div-cert").style.display&&k.setAttribute("tabindex",z++,0),c.setAttribute("tabindex",z++,0),g.setAttribute("tabindex",z++,0),h.setAttribute("tabindex",z++,0),d&&d.setAttribute("tabindex",z++,0),"none"==document.getElementById("us-div-cert").style.display&&k.setAttribute("tabindex",z++,0),r.setAttribute("tabindex",z++,0),p.setAttribute("value",b.IDS_CLOSE,0),p.setAttribute("tabindex",z++,0),p.onclick=function(){l&&a.ESVS.chkEXESetup||L()},k=document.getElementById("us-lbl-notice"),k.appendChild(document.createTextNode(b.IDS_NOTICE)),"MPKI"==a.ESVS.PKI||a.uiUtil().isIraq())k.style.visibility="hidden";p.onkeydown=function(a){a=a||window.event;var b=a.which||a.keyCode;9==b&&a.shiftKey&&(p.onblur=function(){setTimeout(function(){r.focus()},10)});9!=b||a.shiftKey||(p.onblur=function(){setTimeout(function(){f.focus()},10)})};var w=!1;f.onkeyup=function(a){a=a||window.event;9==(a.which||a.keyCode)&&a.shiftKey&&w&&(w=!1,setTimeout(function(){p.focus()},10))};f.onkeydown=function(a){a=a||window.event;if(9==(a.which||a.keyCode)&&a.shiftKey)return a.cancelBubble=!0,w=a.returnValue=!0,!1};null!=a.options.popup&&(document.getElementById("us-div-cert-select").className=document.getElementById("us-div-cert-select").className+" popup");a.ESVS.ShowGuide&&C(m);0<=a.ESVS.PKI.indexOf("MilPKI")&&(c.style.display="none",c.style.visibility="hidden",d.style.display="none",d.style.visibility="hidden",h.style.display="none",h.style.visibility="hidden",g.style.display="none",g.style.visibility="hidden",r.style.display="none",r.style.visibility="hidden");"DIGITAL_SIGNATURE_P7_EXT_DISABLE_SECTOKEN"==e.type&&(r.style.display="none",r.style.visibility="hidden");"CERT_SELECT"==e.type&&da("123456789012345678901234567890");return document.getElementById("us-div-cert-select")}()};return function(e){function x(){function e(){0<w.value.length?w.value="":(5>x&&setTimeout(e,10),x++)}var w=document.getElementById("us-pw-text"),x=0;e();a.uiUtil().setFirstFocus("us-lbl-title");for(var E=a.ESVS.Media.list.split("|"),F=0;F<E.length;F++){var K=a.CONST.medias[E[F]];if(void 0!=K&&null!=K&&(K=document.getElementById("us-btn-"+K.name))&&"us-layout-storage-btn-on"==K.className){a.bsUtil().SetSecurityStatus("us-pw-text");a.bsUtil().SetReScan();break}}}var w=W({type:e.type,args:e.args,onConfirm:e.onConfirm,onCancel:e.onCancel});if(!a.ESVS.Embedded&&(null==a.options.popup||-1<a.options.popup.indexOf("overlay=true"))){e=a.uiLayerLevel;var E=a.uiUtil().getOverlay(e);w.style.zIndex=e+1;document.body.insertBefore(E,document.body.firstChild)}var F=window.onresize;return{show:function(){a.ActiveUI=this;a.ESVS.Embedded?(w.style.left=a.uiUtil().getScrollLeft()+(a.uiUtil().getViewportWidth()-a.uiUtil().getNumSize(a.uiUtil().getStyle(w,"width","width")))/2+"px",w.style.display="block"):null==a.options.popup?(draggable(w,document.getElementById("us-div-title")),E.style.display="block",a.uiUtil().offsetResize(w)):(-1<a.options.popup.indexOf("move=true")?draggable(w,document.getElementById("us-div-title")):document.getElementById("us-div-title").style.cursor="default",-1<a.options.popup.indexOf("overlay=true")&&(E.style.display="block"),a.uiUtil().offsetResize(w,a.options.popup));window.onresize=a.ESVS.Embedded?function(){w&&(w.style.left=a.uiUtil().getScrollLeft()+(a.uiUtil().getViewportWidth()-a.uiUtil().getNumSize(a.uiUtil().getStyle(w,"width","width")))/2+"px");F&&F()}:function(){w&&a.uiUtil().offsetResize(w,a.options.popup);F&&F()};a.uiLayerLevel+=10;a.ESVS.TabIndex+=30;a.bsUtil().ahnlabInit();setTimeout(function(){x()},10)},hide:function(){a.ESVS.Embedded||(E.style.display="none",w.style.display="none")},dispose:function(e){1==e&&4&a.ESVS.Mode&&a.ESVS.chkEXESetup&&a.nimservice().ClearAllUserCertList(function(a,e){});window.onresize=function(){F&&F()};!a.ESVS.Embedded&&(null==a.options.popup||-1<a.options.popup.indexOf("overlay=true"))&&((e=w.parentNode)&&e.removeChild(w),E.parentNode&&E.parentNode.removeChild(E),a.uiLayerLevel-=10,a.ESVS.TabIndex-=30)}}}};